ReactOS  0.4.14-dev-1331-g167fa2c
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 
55  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
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,
75  MultiFunctionAdapter,
76  0x0,
77  0,
78  0xFFFFFFFF,
79  "APM",
80  PartialResourceList,
81  Size,
82  &BiosKey);
83 
84  /* Increment bus number */
85  (*BusNumber)++;
86 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
GLint x0
Definition: linetemp.h:95
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID NTAPI 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 PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
static BOOLEAN FindApmBios(VOID)
Definition: hwapm.c:14
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

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
unsigned short cx
Definition: pcbios.h:107
unsigned char ah
Definition: pcbios.h:126
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define INT386_SUCCESS(regs)
Definition: pcbios.h:173
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char bl
Definition: pcbios.h:128
BYTEREGS b
Definition: pcbios.h:157
unsigned char al
Definition: pcbios.h:125
unsigned char bh
Definition: pcbios.h:129
unsigned short bx
Definition: pcbios.h:106
unsigned short ax
Definition: pcbios.h:105
Definition: pcbios.h:152
WORDREGS w
Definition: pcbios.h:156

Referenced by DetectApmBios().