mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
Detect and report ACPI- and APM-BIOS support.
svn path=/trunk/; revision=12362
This commit is contained in:
parent
280e3627d8
commit
ea579e1a95
8 changed files with 238 additions and 14 deletions
|
@ -207,6 +207,8 @@ ARCH_OBJS = fathelp.o \
|
|||
i386disk.o \
|
||||
portio.o \
|
||||
hardware.o \
|
||||
hwacpi.o \
|
||||
hwapm.o \
|
||||
hwcpu.o \
|
||||
hwpci.o \
|
||||
archmach.o \
|
||||
|
|
|
@ -2276,15 +2276,10 @@ PcHwDetect(VOID)
|
|||
|
||||
/* Detect buses */
|
||||
DetectPciBios(SystemKey, &BusNumber);
|
||||
#if 0
|
||||
DetectApmBios(&BusNumber);
|
||||
#endif
|
||||
DetectApmBios(SystemKey, &BusNumber);
|
||||
DetectPnpBios(SystemKey, &BusNumber);
|
||||
DetectIsaBios(SystemKey, &BusNumber);
|
||||
#if 0
|
||||
DetectAcpiBios(&BusNumber);
|
||||
#endif
|
||||
|
||||
DetectAcpiBios(SystemKey, &BusNumber);
|
||||
|
||||
DbgPrint((DPRINT_HWDETECT, "DetectHardware() Done\n"));
|
||||
|
||||
|
|
|
@ -167,6 +167,12 @@ VOID SetComponentInformation(HKEY ComponentKey,
|
|||
U32 Key,
|
||||
U32 Affinity);
|
||||
|
||||
/* hwacpi.c */
|
||||
VOID DetectAcpiBios(HKEY SystemKey, U32 *BusNumber);
|
||||
|
||||
/* hwapm.c */
|
||||
VOID DetectApmBios(HKEY SystemKey, U32 *BusNumber);
|
||||
|
||||
/* hwcpu.c */
|
||||
VOID DetectCPUs(HKEY SystemKey);
|
||||
|
||||
|
|
104
freeldr/freeldr/arch/i386/hwacpi.c
Normal file
104
freeldr/freeldr/arch/i386/hwacpi.c
Normal file
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* FreeLoader
|
||||
*
|
||||
* Copyright (C) 2004 Eric Kohl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <freeldr.h>
|
||||
#include <arch.h>
|
||||
#include <rtl.h>
|
||||
#include <debug.h>
|
||||
#include <mm.h>
|
||||
#include <portio.h>
|
||||
|
||||
#include "../../reactos/registry.h"
|
||||
#include "hardware.h"
|
||||
|
||||
|
||||
static BOOL
|
||||
FindAcpiBios(VOID)
|
||||
{
|
||||
PU8 Ptr;
|
||||
|
||||
/* Find the 'Root System Descriptor Table Pointer' */
|
||||
Ptr = (PU8)0xE0000;
|
||||
while ((U32)Ptr < 0x100000)
|
||||
{
|
||||
if (!memcmp(Ptr, "RSD PTR ", 8))
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT, "ACPI supported\n"));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Ptr = (PU8)((U32)Ptr + 0x10);
|
||||
}
|
||||
|
||||
DbgPrint((DPRINT_HWDETECT, "ACPI not supported\n"));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
DetectAcpiBios(HKEY SystemKey, U32 *BusNumber)
|
||||
{
|
||||
char Buffer[80];
|
||||
HKEY BiosKey;
|
||||
S32 Error;
|
||||
|
||||
if (FindAcpiBios())
|
||||
{
|
||||
/* Create new bus key */
|
||||
sprintf(Buffer,
|
||||
"MultifunctionAdapter\\%u", *BusNumber);
|
||||
Error = RegCreateKey(SystemKey,
|
||||
Buffer,
|
||||
&BiosKey);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n", (int)Error));
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Set 'Component Information' */
|
||||
SetComponentInformation(BiosKey,
|
||||
0x0,
|
||||
0x0,
|
||||
0xFFFFFFFF);
|
||||
#endif
|
||||
|
||||
/* Increment bus number */
|
||||
(*BusNumber)++;
|
||||
|
||||
/* Set 'Identifier' value */
|
||||
Error = RegSetValue(BiosKey,
|
||||
"Identifier",
|
||||
REG_SZ,
|
||||
(PU8)"ACPI BIOS",
|
||||
10);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
111
freeldr/freeldr/arch/i386/hwapm.c
Normal file
111
freeldr/freeldr/arch/i386/hwapm.c
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* FreeLoader
|
||||
*
|
||||
* Copyright (C) 2004 Eric Kohl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <freeldr.h>
|
||||
#include <arch.h>
|
||||
#include <rtl.h>
|
||||
#include <debug.h>
|
||||
#include <mm.h>
|
||||
#include <portio.h>
|
||||
|
||||
#include "../../reactos/registry.h"
|
||||
#include "hardware.h"
|
||||
|
||||
|
||||
static BOOL
|
||||
FindApmBios(VOID)
|
||||
{
|
||||
REGS RegsIn;
|
||||
REGS RegsOut;
|
||||
|
||||
RegsIn.b.ah = 0x53;
|
||||
RegsIn.b.al = 0x00;
|
||||
RegsIn.w.bx = 0x0000;
|
||||
|
||||
Int386(0x15, &RegsIn, &RegsOut);
|
||||
|
||||
if (INT386_SUCCESS(RegsOut))
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT, "Found APM BIOS\n"));
|
||||
DbgPrint((DPRINT_HWDETECT, "AH: %x\n", RegsOut.b.ah));
|
||||
DbgPrint((DPRINT_HWDETECT, "AL: %x\n", RegsOut.b.al));
|
||||
DbgPrint((DPRINT_HWDETECT, "BH: %x\n", RegsOut.b.bh));
|
||||
DbgPrint((DPRINT_HWDETECT, "BL: %x\n", RegsOut.b.bl));
|
||||
DbgPrint((DPRINT_HWDETECT, "CX: %x\n", RegsOut.w.cx));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
printf("No APM BIOS found\n");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
DetectApmBios(HKEY SystemKey, U32 *BusNumber)
|
||||
{
|
||||
char Buffer[80];
|
||||
HKEY BiosKey;
|
||||
S32 Error;
|
||||
|
||||
if (FindApmBios())
|
||||
{
|
||||
/* Create new bus key */
|
||||
sprintf(Buffer,
|
||||
"MultifunctionAdapter\\%u", *BusNumber);
|
||||
Error = RegCreateKey(SystemKey,
|
||||
Buffer,
|
||||
&BiosKey);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n", (int)Error));
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Set 'Component Information' */
|
||||
SetComponentInformation(BiosKey,
|
||||
0x0,
|
||||
0x0,
|
||||
0xFFFFFFFF);
|
||||
#endif
|
||||
|
||||
/* Increment bus number */
|
||||
(*BusNumber)++;
|
||||
|
||||
/* Set 'Identifier' value */
|
||||
Error = RegSetValue(BiosKey,
|
||||
"Identifier",
|
||||
REG_SZ,
|
||||
(PU8)"APM",
|
||||
4);
|
||||
if (Error != ERROR_SUCCESS)
|
||||
{
|
||||
DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* FIXME: Add congiguration data */
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
|
||||
#define MP_FP_SIGNATURE 0x5F504D5F /* "_MP_" */
|
||||
#define MP_CT_SIGNATURE 0x504D4350 /* "_MP_" */
|
||||
#define MP_CT_SIGNATURE 0x504D4350 /* "PCMP" */
|
||||
|
||||
|
||||
typedef struct _MP_FLOATING_POINT_TABLE
|
||||
|
|
|
@ -123,12 +123,12 @@ FindPciBios(PCM_PCI_BUS_DATA BusData)
|
|||
|
||||
if (INT386_SUCCESS(RegsOut) && RegsOut.d.edx == 0x20494350 && RegsOut.b.ah == 0)
|
||||
{
|
||||
// printf("Found PCI bios\n");
|
||||
DbgPrint((DPRINT_HWDETECT, "Found PCI bios\n"));
|
||||
|
||||
// printf("AL: %x\n", RegsOut.b.al);
|
||||
// printf("BH: %x\n", RegsOut.b.bh);
|
||||
// printf("BL: %x\n", RegsOut.b.bl);
|
||||
// printf("CL: %x\n", RegsOut.b.cl);
|
||||
DbgPrint((DPRINT_HWDETECT, "AL: %x\n", RegsOut.b.al));
|
||||
DbgPrint((DPRINT_HWDETECT, "BH: %x\n", RegsOut.b.bh));
|
||||
DbgPrint((DPRINT_HWDETECT, "BL: %x\n", RegsOut.b.bl));
|
||||
DbgPrint((DPRINT_HWDETECT, "CL: %x\n", RegsOut.b.cl));
|
||||
|
||||
BusData->BusCount = RegsOut.b.cl + 1;
|
||||
BusData->PciVersion = RegsOut.w.bx;
|
||||
|
@ -138,7 +138,7 @@ FindPciBios(PCM_PCI_BUS_DATA BusData)
|
|||
}
|
||||
|
||||
|
||||
// printf("No PCI bios found\n");
|
||||
DbgPrint((DPRINT_HWDETECT, "No PCI bios found\n"));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -506,6 +506,12 @@ for(;;);
|
|||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Load acpi.sys */
|
||||
if (!LoadDriver(SourcePath, "acpi.sys"))
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Load isapnp.sys */
|
||||
if (!LoadDriver(SourcePath, "isapnp.sys"))
|
||||
|
|
Loading…
Reference in a new issue