ReactOS 0.4.15-dev-7942-gd23573b
hwapm.c File Reference
#include <freeldr.h>
#include <debug.h>
Include dependency graph for hwapm.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (HWDETECT)
 
static BOOLEAN FindApmBios (VOID)
 
VOID DetectApmBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( HWDETECT  )

◆ DetectApmBios()

VOID DetectApmBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)

Definition at line 46 of file hwapm.c.

47{
49 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
50 ULONG Size;
51
52 if (!FindApmBios())
53 return;
54
57
58 /* Set 'Configuration Data' value */
59 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
60 if (PartialResourceList == NULL)
61 {
62 ERR("Failed to allocate resource descriptor\n");
63 return;
64 }
65 RtlZeroMemory(PartialResourceList, Size);
66 PartialResourceList->Version = 0;
67 PartialResourceList->Revision = 0;
68 PartialResourceList->Count = 0;
69
70 /* FIXME: Add configuration data */
71
72 /* Create new bus key */
73 FldrCreateComponentKey(SystemKey,
76 0,
77 0,
78 0xFFFFFFFF,
79 "APM",
80 PartialResourceList,
81 Size,
82 &BiosKey);
83
84 /* Increment bus number */
85 (*BusNumber)++;
86}
VOID FldrCreateComponentKey(_In_ PCONFIGURATION_COMPONENT_DATA SystemNode, _In_ CONFIGURATION_CLASS Class, _In_ CONFIGURATION_TYPE Type, _In_ IDENTIFIER_FLAG Flags, _In_ ULONG Key, _In_ ULONG Affinity, _In_ PCSTR IdentifierString, _In_ PCM_PARTIAL_RESOURCE_LIST ResourceList, _In_ ULONG Size, _Out_ PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:198
#define ERR(fmt,...)
Definition: debug.h:110
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
#define NULL
Definition: types.h:112
static BOOLEAN FindApmBios(VOID)
Definition: hwapm.c:14
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
@ AdapterClass
Definition: arc.h:93
@ MultiFunctionAdapter
Definition: arc.h:116
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define TAG_HW_RESOURCE_LIST
Definition: uefidisk.c:15
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by Pc98HwDetect(), and PcHwDetect().

◆ FindApmBios()

static BOOLEAN FindApmBios ( VOID  )
static

Definition at line 14 of file hwapm.c.

15{
16 REGS RegsIn, RegsOut;
17
18 /* APM BIOS - Installation check */
19#if defined(SARCH_PC98)
20 RegsIn.w.ax = 0x9A00;
21 RegsIn.w.bx = 0x0000;
22 Int386(0x1F, &RegsIn, &RegsOut);
23#else
24 RegsIn.w.ax = 0x5300;
25 RegsIn.w.bx = 0x0000;
26 Int386(0x15, &RegsIn, &RegsOut);
27#endif
28 if (INT386_SUCCESS(RegsOut) && RegsOut.w.bx == 'PM')
29 {
30 TRACE("Found APM BIOS\n");
31 TRACE("AH: %x\n", RegsOut.b.ah);
32 TRACE("AL: %x\n", RegsOut.b.al);
33 TRACE("BH: %x\n", RegsOut.b.bh);
34 TRACE("BL: %x\n", RegsOut.b.bl);
35 TRACE("CX: %x\n", RegsOut.w.cx);
36
37 return TRUE;
38 }
39
40 TRACE("No APM BIOS found\n");
41
42 return FALSE;
43}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define INT386_SUCCESS(regs)
Definition: pcbios.h:179
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char bl
Definition: pcbios.h:134
unsigned char al
Definition: pcbios.h:131
unsigned char ah
Definition: pcbios.h:132
unsigned char bh
Definition: pcbios.h:135
unsigned short cx
Definition: pcbios.h:113
unsigned short bx
Definition: pcbios.h:112
unsigned short ax
Definition: pcbios.h:111
Definition: pcbios.h:159
BYTEREGS b
Definition: pcbios.h:163
WORDREGS w
Definition: pcbios.h:162

Referenced by DetectApmBios().