Fix some Rtl Prototype inconsistencies, more are in ntifs/winddk but i have fixed...
[reactos.git] / freeldr / freeldr / arch / i386 / hwacpi.c
1 /*
2 * FreeLoader
3 *
4 * Copyright (C) 2004 Eric Kohl
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #include <freeldr.h>
22 #include <arch.h>
23 #include <rtl.h>
24 #include <debug.h>
25 #include <mm.h>
26 #include <portio.h>
27
28 #include "../../reactos/registry.h"
29 #include "hardware.h"
30
31
32 static BOOL
33 FindAcpiBios(VOID)
34 {
35 PU8 Ptr;
36
37 /* Find the 'Root System Descriptor Table Pointer' */
38 Ptr = (PU8)0xE0000;
39 while ((U32)Ptr < 0x100000)
40 {
41 if (!memcmp(Ptr, "RSD PTR ", 8))
42 {
43 DbgPrint((DPRINT_HWDETECT, "ACPI supported\n"));
44
45 return TRUE;
46 }
47
48 Ptr = (PU8)((U32)Ptr + 0x10);
49 }
50
51 DbgPrint((DPRINT_HWDETECT, "ACPI not supported\n"));
52
53 return FALSE;
54 }
55
56
57 VOID
58 DetectAcpiBios(HKEY SystemKey, U32 *BusNumber)
59 {
60 char Buffer[80];
61 HKEY BiosKey;
62 S32 Error;
63
64 if (FindAcpiBios())
65 {
66 /* Create new bus key */
67 sprintf(Buffer,
68 "MultifunctionAdapter\\%u", *BusNumber);
69 Error = RegCreateKey(SystemKey,
70 Buffer,
71 &BiosKey);
72 if (Error != ERROR_SUCCESS)
73 {
74 DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n", (int)Error));
75 return;
76 }
77
78 #if 0
79 /* Set 'Component Information' */
80 SetComponentInformation(BiosKey,
81 0x0,
82 0x0,
83 0xFFFFFFFF);
84 #endif
85
86 /* Increment bus number */
87 (*BusNumber)++;
88
89 /* Set 'Identifier' value */
90 Error = RegSetValue(BiosKey,
91 "Identifier",
92 REG_SZ,
93 (PU8)"ACPI BIOS",
94 10);
95 if (Error != ERROR_SUCCESS)
96 {
97 DbgPrint((DPRINT_HWDETECT, "RegSetValue() failed (Error %u)\n", (int)Error));
98 return;
99 }
100
101 }
102 }
103
104 /* EOF */