1 | /*␊ |
2 | * Copyright 2008 mackerintel␊ |
3 | */␊ |
4 | ␊ |
5 | //Azi:include␊ |
6 | //#include "libsaio.h" // included on boot.h, acpi_patcher.h, platform.h...␊ |
7 | #include "boot.h"␊ |
8 | #include "bootstruct.h"␊ |
9 | #include "acpi.h"␊ |
10 | #include "efi_tables.h"␊ |
11 | #include "fake_efi.h"␊ |
12 | #include "acpi_patcher.h"␊ |
13 | #include "platform.h"␊ |
14 | #include "cpu.h"␊ |
15 | #include "aml_generator.h"␊ |
16 | ␊ |
17 | #ifndef DEBUG_ACPI␊ |
18 | #define DEBUG_ACPI 0␊ |
19 | #endif␊ |
20 | ␊ |
21 | #if DEBUG_ACPI==2␊ |
22 | #define DBG(x...) {printf(x); sleep(1);}␊ |
23 | #elif DEBUG_ACPI==1␊ |
24 | #define DBG(x...) printf(x)␊ |
25 | #else␊ |
26 | #define DBG(x...)␊ |
27 | #endif␊ |
28 | ␊ |
29 | static uint64_t acpi10_p; //Azi: aserebln␊ |
30 | static uint64_t acpi20_p; //␉␉||␊ |
31 | ␊ |
32 | // Slice: New signature compare function␊ |
33 | boolean_t tableSign(char *table, const char *sgn)␊ |
34 | {␊ |
35 | ␉int i;␊ |
36 | ␉for (i=0; i<4; i++) {␊ |
37 | ␉␉if ((table[i] &~0x20) != (sgn[i] &~0x20)) {␊ |
38 | ␉␉␉return false;␊ |
39 | ␉␉}␊ |
40 | ␉}␊ |
41 | ␉return true;␊ |
42 | }␊ |
43 | ␊ |
44 | /* Gets the ACPI 1.0 RSDP address */␊ |
45 | static struct acpi_2_rsdp* getAddressOfAcpiTable()␊ |
46 | {␊ |
47 | /* TODO: Before searching the BIOS space we are supposed to search the first 1K of the EBDA */␊ |
48 | ␉␊ |
49 | void *acpi_addr = (void*)ACPI_RANGE_START;␊ |
50 | for(; acpi_addr <= (void*)ACPI_RANGE_END; acpi_addr += 16)␊ |
51 | {␊ |
52 | if(*(uint64_t *)acpi_addr == ACPI_SIGNATURE_UINT64_LE)␊ |
53 | {␊ |
54 | uint8_t csum = checksum8(acpi_addr, 20);␊ |
55 | if(csum == 0)␊ |
56 | {␊ |
57 | // Only return the table if it is a true version 1.0 table (Revision 0)␊ |
58 | if(((struct acpi_2_rsdp*)acpi_addr)->Revision == 0)␊ |
59 | return acpi_addr;␊ |
60 | }␊ |
61 | }␊ |
62 | }␊ |
63 | return NULL;␊ |
64 | }␊ |
65 | ␊ |
66 | /* Gets the ACPI 2.0 RSDP address */␊ |
67 | static struct acpi_2_rsdp* getAddressOfAcpi20Table()␊ |
68 | {␊ |
69 | /* TODO: Before searching the BIOS space we are supposed to search the first 1K of the EBDA */␊ |
70 | ␉␊ |
71 | void *acpi_addr = (void*)ACPI_RANGE_START;␊ |
72 | for(; acpi_addr <= (void*)ACPI_RANGE_END; acpi_addr += 16)␊ |
73 | {␊ |
74 | if(*(uint64_t *)acpi_addr == ACPI_SIGNATURE_UINT64_LE)␊ |
75 | {␊ |
76 | uint8_t csum = checksum8(acpi_addr, 20);␊ |
77 | ␉␉␉␊ |
78 | /* Only assume this is a 2.0 or better table if the revision is greater than 0␊ |
79 | * NOTE: ACPI 3.0 spec only seems to say that 1.0 tables have revision 1␊ |
80 | * and that the current revision is 2.. I am going to assume that rev > 0 is 2.0.␊ |
81 | */␊ |
82 | ␉␉␉␊ |
83 | if(csum == 0 && (((struct acpi_2_rsdp*)acpi_addr)->Revision > 0))␊ |
84 | {␊ |
85 | uint8_t csum2 = checksum8(acpi_addr, sizeof(struct acpi_2_rsdp));␊ |
86 | if(csum2 == 0)␊ |
87 | return acpi_addr;␊ |
88 | }␊ |
89 | }␊ |
90 | }␊ |
91 | return NULL;␊ |
92 | }␊ |
93 | ␊ |
94 | /** The following ACPI Table search algo, should be reused anywhere needed: */␊ |
95 | int search_and_get_acpi_fd(const char * filename, const char ** outDirspec) //Azi:searchalgo␊ |
96 | {␊ |
97 | ␉char␉␉dirSpecDSDT[128] = ""; //Azi:alloc - was 512␊ |
98 | ␉const char *override_pathname = NULL;␊ |
99 | ␉int␉␉␉len = 0, fd = 0;␊ |
100 | ␉extern char gMacOSVersion;␊ |
101 | ␉␊ |
102 | ␉// Take in account user overriding␊ |
103 | ␉if (getValueForKey(kDSDTKey, &override_pathname, &len, &bootInfo->bootConfig))␊ |
104 | ␉{␊ |
105 | ␉␉// Specify a path to a file, e.g. /Extra/test.aml␊ |
106 | ␉␉sprintf(dirSpecDSDT, override_pathname);␊ |
107 | ␉␉fd = open(dirSpecDSDT, 0);␊ |
108 | ␉␉if (fd >= 0) goto success_fd;␊ |
109 | ␉}␊ |
110 | ␉␊ |
111 | ␉// Check drivers.c, LoadDrivers, for more comments on these.␊ |
112 | ␉␊ |
113 | ␉sprintf(dirSpecDSDT, "rd(0,0)/%s", filename);␊ |
114 | ␉fd = open(dirSpecDSDT, 0);␊ |
115 | ␉if (fd >= 0) goto success_fd;␊ |
116 | ␉␊ |
117 | ␉sprintf(dirSpecDSDT, "bt(0,0)/Extra/%s/%s", &gMacOSVersion, filename);␊ |
118 | ␉fd = open(dirSpecDSDT, 0);␊ |
119 | ␉if (fd >= 0) goto success_fd;␊ |
120 | ␉␊ |
121 | ␉// Removed /Extra path from search algo. If needed can be specified on override key!␊ |
122 | ␉␊ |
123 | ␉sprintf(dirSpecDSDT, "bt(0,0)/Extra/%s", filename);␊ |
124 | ␉fd = open(dirSpecDSDT, 0);␊ |
125 | ␉if (fd >= 0) goto success_fd;␊ |
126 | ␉␊ |
127 | ␉// Add helper partitions??␊ |
128 | ␉␊ |
129 | ␉// Azi: ok, one gone.. let's kill this one too?␊ |
130 | ␉// All "config" files go in Extra!␊ |
131 | ␉//sprintf(dirspec, "/%s", filename); // search root␊ |
132 | ␉//fd=open (dirspec,0);␊ |
133 | ␉//if (fd>=0) goto success_fd;␊ |
134 | ␉␊ |
135 | ␉// NOT FOUND:␊ |
136 | ␉//Azi: handling this only on pci_root.c, getPciRootUID() (it's enough to check if .aml file exists),␊ |
137 | ␉// to reduce number of printed messages and the confusion caused by them on users.␊ |
138 | ␉//verbose("ACPI Table not found: %s\n", filename);␊ |
139 | ␉␊ |
140 | ␉if (outDirspec) *outDirspec = "";␊ |
141 | ␉return -1;␊ |
142 | ␉// FOUND␊ |
143 | success_fd:␊ |
144 | ␉if (outDirspec) *outDirspec = dirSpecDSDT;␊ |
145 | ␉return fd;␊ |
146 | }␊ |
147 | ␊ |
148 | void *loadACPITable (const char * filename) //Azi: called on setupAcpi()␊ |
149 | {␊ |
150 | ␉void *tableAddr;␊ |
151 | ␉const char * dsdt_filename = NULL; //Azi: = dirSpecDSDT␊ |
152 | ␉␊ |
153 | ␉//Azi:dsdt - call 2; call 1 on pci_root.c (getPciRootUID), changed dirspec to dsdt_filename according (review this!!!).␊ |
154 | ␉int fd = search_and_get_acpi_fd(filename, &dsdt_filename);␊ |
155 | ␉␊ |
156 | ␉if (fd >= 0)␊ |
157 | ␉{␊ |
158 | ␉␉tableAddr = (void*)AllocateKernelMemory(file_size (fd));␊ |
159 | ␉␉␊ |
160 | ␉␉if (tableAddr)␊ |
161 | ␉␉{␊ |
162 | ␉␉␉if (read (fd, tableAddr, file_size (fd)) != file_size (fd))␊ |
163 | ␉␉␉{␊ |
164 | ␉␉␉␉printf("Couldn't read table %s\n",dsdt_filename);␊ |
165 | ␉␉␉␉free (tableAddr);␊ |
166 | ␉␉␉␉close (fd);␊ |
167 | ␉␉␉␉return NULL;␊ |
168 | ␉␉␉}␊ |
169 | ␉␉␉␊ |
170 | ␉␉␉DBG("Table %s read and stored at: %x\n", dsdt_filename, tableAddr);␊ |
171 | ␉␉␉close (fd);␊ |
172 | ␉␉␉return tableAddr;␊ |
173 | ␉␉}␊ |
174 | ␉␉close (fd);␊ |
175 | ␉␉printf("Couldn't allocate memory for table \n", dsdt_filename);␊ |
176 | ␉}␊ |
177 | ␉return NULL;␊ |
178 | }␊ |
179 | ␊ |
180 | uint8_t␉acpi_cpu_count = 0;␊ |
181 | char* acpi_cpu_name[32];␊ |
182 | ␊ |
183 | void get_acpi_cpu_names(unsigned char* dsdt, uint32_t length)␊ |
184 | {␊ |
185 | ␉uint32_t i;␊ |
186 | ␉␊ |
187 | ␉for (i=0; i<length-7; i++) ␊ |
188 | ␉{␊ |
189 | ␉␉if (dsdt[i] == 0x5B && dsdt[i+1] == 0x83) // ProcessorOP␊ |
190 | ␉␉{␊ |
191 | ␉␉␉uint32_t offset = i + 3 + (dsdt[i+2] >> 6);␊ |
192 | ␉␉␉␊ |
193 | ␉␉␉bool add_name = true;␊ |
194 | ␊ |
195 | ␉␉␉uint8_t j;␊ |
196 | ␉␉␉␊ |
197 | ␉␉␉for (j=0; j<4; j++) ␊ |
198 | ␉␉␉{␊ |
199 | ␉␉␉␉char c = dsdt[offset+j];␊ |
200 | ␉␉␉␉␊ |
201 | ␉␉␉␉if (!aml_isvalidchar(c)) ␊ |
202 | ␉␉␉␉{␊ |
203 | ␉␉␉␉␉add_name = false;␊ |
204 | ␉␉␉␉␉verbose("Invalid character found in ProcessorOP 0x%x!\n", c);␊ |
205 | ␉␉␉␉␉break;␊ |
206 | ␉␉␉␉}␊ |
207 | ␉␉␉}␊ |
208 | ␉␉␉␊ |
209 | ␉␉␉if (add_name) ␊ |
210 | ␉␉␉{␊ |
211 | ␉␉␉␉acpi_cpu_name[acpi_cpu_count] = malloc(4);␊ |
212 | ␉␉␉␉memcpy(acpi_cpu_name[acpi_cpu_count], dsdt+offset, 4);␊ |
213 | ␉␉␉␉i = offset + 5;␊ |
214 | ␉␉␉␉␊ |
215 | ␉␉␉␉verbose("Found ACPI CPU: %c%c%c%c\n", acpi_cpu_name[acpi_cpu_count][0], acpi_cpu_name[acpi_cpu_count][1], acpi_cpu_name[acpi_cpu_count][2], acpi_cpu_name[acpi_cpu_count][3]);␊ |
216 | ␉␉␉␉␊ |
217 | ␉␉␉␉if (++acpi_cpu_count == 32) return;␊ |
218 | ␉␉␉}␊ |
219 | ␉␉}␊ |
220 | ␉}␊ |
221 | }␊ |
222 | ␊ |
223 | struct acpi_2_ssdt *generate_cst_ssdt(struct acpi_2_fadt* fadt)␊ |
224 | {␊ |
225 | ␉char ssdt_header[] =␊ |
226 | ␉{␊ |
227 | ␉␉0x53, 0x53, 0x44, 0x54, 0xE7, 0x00, 0x00, 0x00, /* SSDT.... */␊ |
228 | ␉␉0x01, 0x17, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x41, /* ..PmRefA */␊ |
229 | ␉␉0x43, 0x70, 0x75, 0x43, 0x73, 0x74, 0x00, 0x00, /* CpuCst.. */␊ |
230 | ␉␉0x00, 0x10, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C, /* ....INTL */␊ |
231 | ␉␉0x31, 0x03, 0x10, 0x20 ␉␉␉␉␉␉␉/* 1.._␉␉*/␊ |
232 | ␉};␊ |
233 | ␉␊ |
234 | ␉char cstate_resource_template[] = ␊ |
235 | ␉{␊ |
236 | ␉␉0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x7F, ␊ |
237 | ␉␉0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, ␊ |
238 | ␉␉0x00, 0x00, 0x00, 0x79, 0x00␊ |
239 | ␉};␊ |
240 | ␊ |
241 | ␉if (Platform.CPU.Vendor != 0x756E6547) {␊ |
242 | ␉␉verbose ("Not an Intel platform: C-States will not be generated !!!\n");␊ |
243 | ␉␉return NULL;␊ |
244 | ␉}␊ |
245 | ␉␊ |
246 | ␉if (fadt == NULL) {␊ |
247 | ␉␉verbose ("FACP not exists: C-States will not be generated !!!\n");␊ |
248 | ␉␉return NULL;␊ |
249 | ␉}␊ |
250 | ␉␊ |
251 | ␉struct acpi_2_dsdt* dsdt = (void*)fadt->DSDT;␊ |
252 | ␉␊ |
253 | ␉if (dsdt == NULL) {␊ |
254 | ␉␉verbose ("DSDT not found: C-States will not be generated !!!\n");␊ |
255 | ␉␉return NULL;␊ |
256 | ␉}␊ |
257 | ␉␊ |
258 | ␉if (acpi_cpu_count == 0) ␊ |
259 | ␉␉get_acpi_cpu_names((void*)dsdt, dsdt->Length);␊ |
260 | ␉␊ |
261 | ␉if (acpi_cpu_count > 0) ␊ |
262 | ␉{␊ |
263 | ␉␉bool c2_enabled = fadt->C2_Latency < 100;␊ |
264 | ␉␉bool c3_enabled = fadt->C3_Latency < 1000;␊ |
265 | ␉␉bool c4_enabled = false;␊ |
266 | ␉␉␊ |
267 | ␉␉getBoolForKey(kEnableC4States, &c4_enabled, &bootInfo->bootConfig);␊ |
268 | ␊ |
269 | ␉␉unsigned char cstates_count = 1 + (c2_enabled ? 1 : 0) + (c3_enabled ? 1 : 0);␊ |
270 | ␉␉␊ |
271 | ␉␉struct aml_chunk* root = aml_create_node(NULL);␊ |
272 | ␉␉␉aml_add_buffer(root, ssdt_header, sizeof(ssdt_header)); // SSDT header␊ |
273 | ␉␉␉struct aml_chunk* scop = aml_add_scope(root, "\\_PR_");␊ |
274 | ␉␉␉␉struct aml_chunk* name = aml_add_name(scop, "CST_");␊ |
275 | ␉␉␉␉␉struct aml_chunk* pack = aml_add_package(name);␊ |
276 | ␉␉␉␉␉␉aml_add_byte(pack, cstates_count);␊ |
277 | ␉␉␊ |
278 | ␉␉␉␉␉␉struct aml_chunk* tmpl = aml_add_package(pack);␊ |
279 | ␉␉␉␉␉␉␉cstate_resource_template[11] = 0x00; // C1␊ |
280 | ␉␉␉␉␉␉␉aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template));␊ |
281 | ␉␉␉␉␉␉␉aml_add_byte(tmpl, 0x01); // C1␊ |
282 | ␉␉␉␉␉␉␉aml_add_byte(tmpl, 0x01); // Latency␊ |
283 | ␉␉␉␉␉␉␉aml_add_word(tmpl, 0x03e8); // Power␊ |
284 | ␊ |
285 | ␉␉␉␉␉␉// C2␊ |
286 | ␉␉␉␉␉␉if (c2_enabled) ␊ |
287 | ␉␉␉␉␉␉{␊ |
288 | ␉␉␉␉␉␉␉tmpl = aml_add_package(pack);␊ |
289 | ␉␉␉␉␉␉␉␉cstate_resource_template[11] = 0x10; // C2␊ |
290 | ␉␉␉␉␉␉␉␉aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template));␊ |
291 | ␉␉␉␉␉␉␉␉aml_add_byte(tmpl, 0x02); // C2␊ |
292 | ␉␉␉␉␉␉␉␉aml_add_byte(tmpl, fadt->C2_Latency);␊ |
293 | ␉␉␉␉␉␉␉␉aml_add_word(tmpl, 0x01f4); // Power␊ |
294 | ␉␉␉␉␉␉}␊ |
295 | ␉␉␉␉␉␉// C4␊ |
296 | ␉␉␉␉␉␉if (c4_enabled) ␊ |
297 | ␉␉␉␉␉␉{␊ |
298 | ␉␉␉␉␉␉␉tmpl = aml_add_package(pack);␊ |
299 | ␉␉␉␉␉␉␉cstate_resource_template[11] = 0x30; // C4␊ |
300 | ␉␉␉␉␉␉␉aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template));␊ |
301 | ␉␉␉␉␉␉␉aml_add_byte(tmpl, 0x04); // C4␊ |
302 | ␉␉␉␉␉␉␉aml_add_word(tmpl, fadt->C3_Latency / 2); // TODO: right latency for C4␊ |
303 | ␉␉␉␉␉␉␉aml_add_byte(tmpl, 0xfa); // Power␊ |
304 | ␉␉␉␉␉␉}␊ |
305 | ␉␉␉␉␉␉else␊ |
306 | ␉␉␉␉␉␉// C3␊ |
307 | ␉␉␉␉␉␉if (c3_enabled) ␊ |
308 | ␉␉␉␉␉␉{␊ |
309 | ␉␉␉␉␉␉␉tmpl = aml_add_package(pack);␊ |
310 | ␉␉␉␉␉␉␉cstate_resource_template[11] = 0x20; // C3␊ |
311 | ␉␉␉␉␉␉␉aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template));␊ |
312 | ␉␉␉␉␉␉␉aml_add_byte(tmpl, 0x03); // C3␊ |
313 | ␉␉␉␉␉␉␉aml_add_word(tmpl, fadt->C3_Latency);␊ |
314 | ␉␉␉␉␉␉␉aml_add_word(tmpl, 0x015e); // Power␊ |
315 | ␉␉␉␉␉␉}␊ |
316 | ␉␉␉␉␉␉␊ |
317 | ␉␉␉␊ |
318 | ␉␉␉// Aliaces␊ |
319 | ␉␉␉int i;␊ |
320 | ␉␉␉for (i = 0; i < acpi_cpu_count; i++) ␊ |
321 | ␉␉␉{␊ |
322 | ␉␉␉␉char name[9];␊ |
323 | ␉␉␉␉sprintf(name, "_PR_%c%c%c%c", acpi_cpu_name[i][0], acpi_cpu_name[i][1], acpi_cpu_name[i][2], acpi_cpu_name[i][3]);␊ |
324 | ␉␉␉␉␊ |
325 | ␉␉␉␉scop = aml_add_scope(root, name);␊ |
326 | ␉␉␉␉␉aml_add_alias(scop, "CST_", "_CST");␊ |
327 | ␉␉␉}␊ |
328 | ␉␉␊ |
329 | ␉␉aml_calculate_size(root);␊ |
330 | ␉␉␊ |
331 | ␉␉struct acpi_2_ssdt *ssdt = (struct acpi_2_ssdt *)AllocateKernelMemory(root->Size);␊ |
332 | ␉␊ |
333 | ␉␉aml_write_node(root, (void*)ssdt, 0);␊ |
334 | ␉␉␊ |
335 | ␉␉ssdt->Length = root->Size;␊ |
336 | ␉␉ssdt->Checksum = 0;␊ |
337 | ␉␉ssdt->Checksum = 256 - checksum8(ssdt, ssdt->Length);␊ |
338 | ␉␉␊ |
339 | ␉␉aml_destroy_node(root);␊ |
340 | ␉␉␊ |
341 | ␉␉//dumpPhysAddr("C-States SSDT content: ", ssdt, ssdt->Length);␊ |
342 | ␉␉␉␉␊ |
343 | ␉␉verbose ("SSDT with CPU C-States generated successfully\n");␊ |
344 | ␉␉␊ |
345 | ␉␉return ssdt;␊ |
346 | ␉}␊ |
347 | ␉else ␊ |
348 | ␉{␊ |
349 | ␉␉verbose ("ACPI CPUs not found: C-States not generated !!!\n");␊ |
350 | ␉}␊ |
351 | ␊ |
352 | ␉return NULL;␊ |
353 | }␊ |
354 | ␊ |
355 | struct acpi_2_ssdt *generate_pss_ssdt(struct acpi_2_dsdt* dsdt)␊ |
356 | {␊ |
357 | ␉char ssdt_header[] =␊ |
358 | ␉{␊ |
359 | ␉␉0x53, 0x53, 0x44, 0x54, 0x7E, 0x00, 0x00, 0x00, /* SSDT.... */␊ |
360 | ␉␉0x01, 0x6A, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x00, /* ..PmRef. */␊ |
361 | ␉␉0x43, 0x70, 0x75, 0x50, 0x6D, 0x00, 0x00, 0x00, /* CpuPm... */␊ |
362 | ␉␉0x00, 0x30, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C, /* .0..INTL */␊ |
363 | ␉␉0x31, 0x03, 0x10, 0x20,␉␉␉␉␉␉␉/* 1.._␉␉*/␊ |
364 | ␉};␊ |
365 | ␉␊ |
366 | ␉if (Platform.CPU.Vendor != 0x756E6547) {␊ |
367 | ␉␉verbose ("Not an Intel platform: P-States will not be generated !!!\n");␊ |
368 | ␉␉return NULL;␊ |
369 | ␉}␊ |
370 | ␉␊ |
371 | ␉if (!(Platform.CPU.Features & CPU_FEATURE_MSR)) {␊ |
372 | ␉␉verbose ("Unsupported CPU: P-States will not be generated !!!\n");␊ |
373 | ␉␉return NULL;␊ |
374 | ␉}␊ |
375 | ␉␊ |
376 | ␉if (acpi_cpu_count == 0) ␊ |
377 | ␉␉get_acpi_cpu_names((void*)dsdt, dsdt->Length);␊ |
378 | ␉␊ |
379 | ␉if (acpi_cpu_count > 0) ␊ |
380 | ␉{␊ |
381 | ␉␉struct p_state initial, maximum, minimum, p_states[32];␊ |
382 | ␉␉uint8_t p_states_count = 0;␉␉␊ |
383 | ␉␉␊ |
384 | ␉␉// Retrieving P-States, ported from code by superhai (c)␊ |
385 | ␉␉switch (Platform.CPU.Family) {␊ |
386 | ␉␉␉case 0x06: ␊ |
387 | ␉␉␉{␊ |
388 | ␉␉␉␉switch (Platform.CPU.Model) ␊ |
389 | ␉␉␉␉{␊ |
390 | ␉␉␉␉␉case 0x0D: // ?␊ |
391 | ␉␉␉␉␉case CPU_MODEL_YONAH: // Yonah␊ |
392 | ␉␉␉␉␉case CPU_MODEL_MEROM: // Merom␊ |
393 | ␉␉␉␉␉case CPU_MODEL_PENRYN: // Penryn␊ |
394 | ␉␉␉␉␉case CPU_MODEL_ATOM: // Intel Atom (45nm)␊ |
395 | ␉␉␉␉␉{␊ |
396 | ␉␉␉␉␉␉bool cpu_dynamic_fsb = false;␊ |
397 | ␉␉␉␉␉␉␊ |
398 | ␉␉␉␉␉␉if (rdmsr64(MSR_IA32_EXT_CONFIG) & (1 << 27)) ␊ |
399 | ␉␉␉␉␉␉{␊ |
400 | ␉␉␉␉␉␉␉wrmsr64(MSR_IA32_EXT_CONFIG, (rdmsr64(MSR_IA32_EXT_CONFIG) | (1 << 28))); ␊ |
401 | ␉␉␉␉␉␉␉delay(1);␊ |
402 | ␉␉␉␉␉␉␉cpu_dynamic_fsb = rdmsr64(MSR_IA32_EXT_CONFIG) & (1 << 28);␊ |
403 | ␉␉␉␉␉␉}␊ |
404 | ␉␉␉␉␉␉␊ |
405 | ␉␉␉␉␉␉bool cpu_noninteger_bus_ratio = (rdmsr64(MSR_IA32_PERF_STATUS) & (1ULL << 46));␊ |
406 | ␉␉␉␉␉␉␊ |
407 | ␉␉␉␉␉␉initial.Control = rdmsr64(MSR_IA32_PERF_STATUS);␊ |
408 | ␉␉␉␉␉␉␊ |
409 | ␉␉␉␉␉␉maximum.Control = ((rdmsr64(MSR_IA32_PERF_STATUS) >> 32) & 0x1F3F) | (0x4000 * cpu_noninteger_bus_ratio);␊ |
410 | ␉␉␉␉␉␉maximum.CID = ((maximum.FID & 0x1F) << 1) | cpu_noninteger_bus_ratio;␊ |
411 | ␉␉␉␉␉␉␊ |
412 | ␉␉␉␉␉␉minimum.FID = ((rdmsr64(MSR_IA32_PERF_STATUS) >> 24) & 0x1F) | (0x80 * cpu_dynamic_fsb);␊ |
413 | ␉␉␉␉␉␉minimum.VID = ((rdmsr64(MSR_IA32_PERF_STATUS) >> 48) & 0x3F);␊ |
414 | ␉␉␉␉␉␉␊ |
415 | ␉␉␉␉␉␉if (minimum.FID == 0) ␊ |
416 | ␉␉␉␉␉␉{␊ |
417 | ␉␉␉␉␉␉␉uint64_t msr;␊ |
418 | ␉␉␉␉␉␉␉uint8_t i;␊ |
419 | ␉␉␉␉␉␉␉// Probe for lowest fid␊ |
420 | ␉␉␉␉␉␉␉for (i = maximum.FID; i >= 0x6; i--) ␊ |
421 | ␉␉␉␉␉␉␉{␊ |
422 | ␉␉␉␉␉␉␉␉msr = rdmsr64(MSR_IA32_PERF_CONTROL);␊ |
423 | ␉␉␉␉␉␉␉␉wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (i << 8) | minimum.VID);␊ |
424 | ␉␉␉␉␉␉␉␉intel_waitforsts();␊ |
425 | ␉␉␉␉␉␉␉␉minimum.FID = (rdmsr64(MSR_IA32_PERF_STATUS) >> 8) & 0x1F; ␊ |
426 | ␉␉␉␉␉␉␉␉delay(1);␊ |
427 | ␉␉␉␉␉␉␉}␊ |
428 | ␉␉␉␉␉␉␉␊ |
429 | ␉␉␉␉␉␉␉msr = rdmsr64(MSR_IA32_PERF_CONTROL);␊ |
430 | ␉␉␉␉␉␉␉wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (maximum.FID << 8) | maximum.VID);␊ |
431 | ␉␉␉␉␉␉␉intel_waitforsts();␊ |
432 | ␉␉␉␉␉␉}␊ |
433 | ␉␉␉␉␉␉␊ |
434 | ␉␉␉␉␉␉if (minimum.VID == maximum.VID) ␊ |
435 | ␉␉␉␉␉␉{␉␊ |
436 | ␉␉␉␉␉␉␉uint64_t msr;␊ |
437 | ␉␉␉␉␉␉␉uint8_t i;␊ |
438 | ␉␉␉␉␉␉␉// Probe for lowest vid␊ |
439 | ␉␉␉␉␉␉␉for (i = maximum.VID; i > 0xA; i--) ␊ |
440 | ␉␉␉␉␉␉␉{␊ |
441 | ␉␉␉␉␉␉␉␉msr = rdmsr64(MSR_IA32_PERF_CONTROL);␊ |
442 | ␉␉␉␉␉␉␉␉wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (minimum.FID << 8) | i);␊ |
443 | ␉␉␉␉␉␉␉␉intel_waitforsts();␊ |
444 | ␉␉␉␉␉␉␉␉minimum.VID = rdmsr64(MSR_IA32_PERF_STATUS) & 0x3F; ␊ |
445 | ␉␉␉␉␉␉␉␉delay(1);␊ |
446 | ␉␉␉␉␉␉␉}␊ |
447 | ␉␉␉␉␉␉␉␊ |
448 | ␉␉␉␉␉␉␉msr = rdmsr64(MSR_IA32_PERF_CONTROL);␊ |
449 | ␉␉␉␉␉␉␉wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (maximum.FID << 8) | maximum.VID);␊ |
450 | ␉␉␉␉␉␉␉intel_waitforsts();␊ |
451 | ␉␉␉␉␉␉}␊ |
452 | ␉␉␉␉␉␉␊ |
453 | ␉␉␉␉␉␉minimum.CID = ((minimum.FID & 0x1F) << 1) >> cpu_dynamic_fsb;␊ |
454 | ␉␉␉␉␉␉␊ |
455 | ␉␉␉␉␉␉// Sanity check␊ |
456 | ␉␉␉␉␉␉if (maximum.CID < minimum.CID) ␊ |
457 | ␉␉␉␉␉␉{␊ |
458 | ␉␉␉␉␉␉␉DBG("Insane FID values!");␊ |
459 | ␉␉␉␉␉␉␉p_states_count = 1;␊ |
460 | ␉␉␉␉␉␉}␊ |
461 | ␉␉␉␉␉␉else␊ |
462 | ␉␉␉␉␉␉{␊ |
463 | ␉␉␉␉␉␉␉// Finalize P-States␊ |
464 | ␉␉␉␉␉␉␉// Find how many P-States machine supports␊ |
465 | ␉␉␉␉␉␉␉p_states_count = maximum.CID - minimum.CID + 1;␊ |
466 | ␉␉␉␉␉␉␉␊ |
467 | ␉␉␉␉␉␉␉if (p_states_count > 32) ␊ |
468 | ␉␉␉␉␉␉␉␉p_states_count = 32;␊ |
469 | ␉␉␉␉␉␉␉␊ |
470 | ␉␉␉␉␉␉␉uint8_t vidstep;␊ |
471 | ␉␉␉␉␉␉␉uint8_t i = 0, u, invalid = 0;␊ |
472 | ␉␉␉␉␉␉␉␊ |
473 | ␉␉␉␉␉␉␉vidstep = ((maximum.VID << 2) - (minimum.VID << 2)) / (p_states_count - 1);␊ |
474 | ␉␉␉␉␉␉␉␊ |
475 | ␉␉␉␉␉␉␉for (u = 0; u < p_states_count; u++) ␊ |
476 | ␉␉␉␉␉␉␉{␊ |
477 | ␉␉␉␉␉␉␉␉i = u - invalid;␊ |
478 | ␉␉␉␉␉␉␉␉␊ |
479 | ␉␉␉␉␉␉␉␉p_states[i].CID = maximum.CID - u;␊ |
480 | ␉␉␉␉␉␉␉␉p_states[i].FID = (p_states[i].CID >> 1);␊ |
481 | ␉␉␉␉␉␉␉␉␊ |
482 | ␉␉␉␉␉␉␉␉if (p_states[i].FID < 0x6) ␊ |
483 | ␉␉␉␉␉␉␉␉{␊ |
484 | ␉␉␉␉␉␉␉␉␉if (cpu_dynamic_fsb) ␊ |
485 | ␉␉␉␉␉␉␉␉␉␉p_states[i].FID = (p_states[i].FID << 1) | 0x80;␊ |
486 | ␉␉␉␉␉␉␉␉} ␊ |
487 | ␉␉␉␉␉␉␉␉else if (cpu_noninteger_bus_ratio) ␊ |
488 | ␉␉␉␉␉␉␉␉{␊ |
489 | ␉␉␉␉␉␉␉␉␉p_states[i].FID = p_states[i].FID | (0x40 * (p_states[i].CID & 0x1));␊ |
490 | ␉␉␉␉␉␉␉␉}␊ |
491 | ␉␉␉␉␉␉␉␉␊ |
492 | ␉␉␉␉␉␉␉␉if (i && p_states[i].FID == p_states[i-1].FID)␊ |
493 | ␉␉␉␉␉␉␉␉␉invalid++;␊ |
494 | ␉␉␉␉␉␉␉␉␊ |
495 | ␉␉␉␉␉␉␉␉p_states[i].VID = ((maximum.VID << 2) - (vidstep * u)) >> 2;␊ |
496 | ␉␉␉␉␉␉␉␉␊ |
497 | ␉␉␉␉␉␉␉␉uint32_t multiplier = p_states[i].FID & 0x1f;␉␉// = 0x08␊ |
498 | ␉␉␉␉␉␉␉␉bool half = p_states[i].FID & 0x40;␉␉␉␉␉// = 0x01␊ |
499 | ␉␉␉␉␉␉␉␉bool dfsb = p_states[i].FID & 0x80;␉␉␉␉␉// = 0x00␊ |
500 | ␉␉␉␉␉␉␉␉uint32_t fsb = Platform.CPU.FSBFrequency / 1000000; // = 400␊ |
501 | ␉␉␉␉␉␉␉␉uint32_t halffsb = (fsb + 1) >> 1;␉␉␉␉␉// = 200␊ |
502 | ␉␉␉␉␉␉␉␉uint32_t frequency = (multiplier * fsb);␉␉␉// = 3200␊ |
503 | ␉␉␉␉␉␉␉␉␊ |
504 | ␉␉␉␉␉␉␉␉p_states[i].Frequency = (frequency + (half * halffsb)) >> dfsb;␉// = 3200 + 200 = 3400␊ |
505 | ␉␉␉␉␉␉␉}␊ |
506 | ␉␉␉␉␉␉␉␊ |
507 | ␉␉␉␉␉␉␉p_states_count -= invalid;␊ |
508 | ␉␉␉␉␉␉}␊ |
509 | ␉␉␉␉␉} break;␊ |
510 | ␉␉␉␉␉case CPU_MODEL_FIELDS:␊ |
511 | ␉␉␉␉␉case CPU_MODEL_DALES:␊ |
512 | ␉␉␉␉␉case CPU_MODEL_DALES_32NM:␊ |
513 | ␉␉␉␉␉case CPU_MODEL_NEHALEM:␊ |
514 | ␉␉␉␉␉case CPU_MODEL_NEHALEM_EX:␊ |
515 | ␉␉␉␉␉case CPU_MODEL_WESTMERE:␊ |
516 | ␉␉␉␉␉case CPU_MODEL_WESTMERE_EX:␊ |
517 | ␉␉␉␉␉default:␊ |
518 | ␉␉␉␉␉␉verbose ("Unsupported CPU: P-States not generated !!!\n");␊ |
519 | ␉␉␉␉␉␉break;␊ |
520 | ␉␉␉␉}␊ |
521 | ␉␉␉}␊ |
522 | ␉␉}␊ |
523 | ␉␉␊ |
524 | ␉␉// Generating SSDT␊ |
525 | ␉␉if (p_states_count > 0) ␊ |
526 | ␉␉{␉␊ |
527 | ␉␉␉int i;␊ |
528 | ␉␉␉␊ |
529 | ␉␉␉struct aml_chunk* root = aml_create_node(NULL);␊ |
530 | ␉␉␉␉aml_add_buffer(root, ssdt_header, sizeof(ssdt_header)); // SSDT header␊ |
531 | ␉␉␉␉␉struct aml_chunk* scop = aml_add_scope(root, "\\_PR_");␊ |
532 | ␉␉␉␉␉␉struct aml_chunk* name = aml_add_name(scop, "PSS_");␊ |
533 | ␉␉␉␉␉␉␉struct aml_chunk* pack = aml_add_package(name);␊ |
534 | ␉␉␉␊ |
535 | ␉␉␉␉␉␉␉␉for (i = 0; i < p_states_count; i++) ␊ |
536 | ␉␉␉␉␉␉␉␉{␊ |
537 | ␉␉␉␉␉␉␉␉␉struct aml_chunk* pstt = aml_add_package(pack);␊ |
538 | ␉␉␉␉␉␉␉␉␉␊ |
539 | ␉␉␉␉␉␉␉␉␉aml_add_dword(pstt, p_states[i].Frequency);␊ |
540 | ␉␉␉␉␉␉␉␉␉aml_add_dword(pstt, 0x00000000); // Power␊ |
541 | ␉␉␉␉␉␉␉␉␉aml_add_dword(pstt, 0x0000000A); // Latency␊ |
542 | ␉␉␉␉␉␉␉␉␉aml_add_dword(pstt, 0x0000000A); // Latency␊ |
543 | ␉␉␉␉␉␉␉␉␉aml_add_dword(pstt, p_states[i].Control);␊ |
544 | ␉␉␉␉␉␉␉␉␉aml_add_dword(pstt, i+1); // Status␊ |
545 | ␉␉␉␉␉␉␉␉}␊ |
546 | ␉␉␉␉␊ |
547 | ␉␉␉// Add aliaces␊ |
548 | ␉␉␉for (i = 0; i < acpi_cpu_count; i++) ␊ |
549 | ␉␉␉{␊ |
550 | ␉␉␉␉char name[9];␊ |
551 | ␉␉␉␉sprintf(name, "_PR_%c%c%c%c", acpi_cpu_name[i][0], acpi_cpu_name[i][1], acpi_cpu_name[i][2], acpi_cpu_name[i][3]);␊ |
552 | ␉␉␉␉␊ |
553 | ␉␉␉␉scop = aml_add_scope(root, name);␊ |
554 | ␉␉␉␉aml_add_alias(scop, "PSS_", "_PSS");␊ |
555 | ␉␉␉}␊ |
556 | ␉␉␉␊ |
557 | ␉␉␉aml_calculate_size(root);␊ |
558 | ␉␉␉␊ |
559 | ␉␉␉struct acpi_2_ssdt *ssdt = (struct acpi_2_ssdt *)AllocateKernelMemory(root->Size);␊ |
560 | ␉␉␉␊ |
561 | ␉␉␉aml_write_node(root, (void*)ssdt, 0);␊ |
562 | ␉␉␉␊ |
563 | ␉␉␉ssdt->Length = root->Size;␊ |
564 | ␉␉␉ssdt->Checksum = 0;␊ |
565 | ␉␉␉ssdt->Checksum = 256 - checksum8(ssdt, ssdt->Length);␊ |
566 | ␉␉␉␊ |
567 | ␉␉␉aml_destroy_node(root);␊ |
568 | ␉␉␉␊ |
569 | ␉␉␉//dumpPhysAddr("P-States SSDT content: ", ssdt, ssdt->Length);␊ |
570 | ␉␉␉␊ |
571 | ␉␉␉verbose ("SSDT with CPU P-States generated successfully\n");␊ |
572 | ␉␉␉␊ |
573 | ␉␉␉return ssdt;␊ |
574 | ␉␉}␊ |
575 | ␉}␊ |
576 | ␉else ␊ |
577 | ␉{␊ |
578 | ␉␉verbose ("ACPI CPUs not found: P-States not generated !!!\n");␊ |
579 | ␉}␊ |
580 | ␉␊ |
581 | ␉return NULL;␊ |
582 | }␊ |
583 | ␊ |
584 | struct acpi_2_fadt *patch_fadt(struct acpi_2_fadt *fadt, struct acpi_2_dsdt *new_dsdt)␊ |
585 | {␊ |
586 | ␉extern void setupSystemType(); ␊ |
587 | ␉␊ |
588 | ␉struct acpi_2_fadt *fadt_mod;␊ |
589 | ␉bool fadt_rev2_needed = false;␊ |
590 | ␉bool fix_restart;␊ |
591 | ␉const char * value;␊ |
592 | ␉␊ |
593 | ␉// Restart Fix␊ |
594 | ␉if (Platform.CPU.Vendor == 0x756E6547) {␉/* Intel */␊ |
595 | ␉␉fix_restart = false; //Azi: I'm on Intel and i don't need this enabled by default!?␊ |
596 | ␉␉getBoolForKey(kRestartFixKey, &fix_restart, &bootInfo->bootConfig);␊ |
597 | ␉} else {␊ |
598 | ␉␉verbose ("Not an Intel platform: Restart Fix not applied !!!\n");␊ |
599 | ␉␉fix_restart = false;␊ |
600 | ␉}␊ |
601 | ␉␊ |
602 | ␉if (fix_restart) fadt_rev2_needed = true;␊ |
603 | ␉␊ |
604 | ␉// Allocate new fadt table␊ |
605 | ␉if (fadt->Length < 0x84 && fadt_rev2_needed)␊ |
606 | ␉{␊ |
607 | ␉␉fadt_mod=(struct acpi_2_fadt *)AllocateKernelMemory(0x84);␊ |
608 | ␉␉memcpy(fadt_mod, fadt, fadt->Length);␊ |
609 | ␉␉fadt_mod->Length = 0x84;␊ |
610 | ␉␉fadt_mod->Revision = 0x02; // FADT rev 2 (ACPI 1.0B MS extensions)␊ |
611 | ␉}␊ |
612 | ␉else␊ |
613 | ␉{␊ |
614 | ␉␉fadt_mod=(struct acpi_2_fadt *)AllocateKernelMemory(fadt->Length);␊ |
615 | ␉␉memcpy(fadt_mod, fadt, fadt->Length);␊ |
616 | ␉}␊ |
617 | ␉// Determine system type / PM_Model␊ |
618 | ␉if ( (value=getStringForKey(kSystemTypeKey, &bootInfo->bootConfig))!=NULL)␊ |
619 | ␉{␊ |
620 | ␉␉if (Platform.Type > 6) ␊ |
621 | ␉␉{␊ |
622 | ␉␉␉if(fadt_mod->PM_Profile<=6)␊ |
623 | ␉␉␉␉Platform.Type = fadt_mod->PM_Profile; // get the fadt if correct␊ |
624 | ␉␉␉else ␊ |
625 | ␉␉␉␉Platform.Type = 1;␉␉/* Set a fixed value (Desktop) */␊ |
626 | ␉␉␉verbose("Error: system-type must be 0..6. Defaulting to %d !\n", Platform.Type);␊ |
627 | ␉␉}␊ |
628 | ␉␉else␊ |
629 | ␉␉␉Platform.Type = (unsigned char) strtoul(value, NULL, 10);␊ |
630 | ␉}␊ |
631 | ␊ |
632 | ␉// Set PM_Profile from System-type only if user wanted this value to be forced␊ |
633 | ␉if (fadt_mod->PM_Profile != Platform.Type) ␊ |
634 | ␉{␊ |
635 | ␉ if (value) ␊ |
636 | ␉␉{ // user has overriden the SystemType so take care of it in FACP␊ |
637 | ␉␉␉verbose("FADT: changing PM_Profile from 0x%02x to 0x%02x\n", fadt_mod->PM_Profile, Platform.Type);␊ |
638 | ␉␉␉fadt_mod->PM_Profile = Platform.Type;␊ |
639 | ␉ }␊ |
640 | ␉ else␊ |
641 | ␉ { // PM_Profile has a different value and no override has been set, so reflect the user value to ioregs␊ |
642 | ␉␉␉Platform.Type = fadt_mod->PM_Profile <= 6 ? fadt_mod->PM_Profile : 1;␊ |
643 | ␉ } ␊ |
644 | ␉}␊ |
645 | ␉// We now have to write the systemm-type in ioregs: we cannot do it before in setupDeviceTree()␊ |
646 | ␉// because we need to take care of facp original content, if it is correct.␊ |
647 | ␉setupSystemType();␊ |
648 | ␉␊ |
649 | ␉// Patch FADT to fix restart␊ |
650 | ␉if (fix_restart)␊ |
651 | ␉{␊ |
652 | ␉␉fadt_mod->Flags|= 0x400;␊ |
653 | ␉␉fadt_mod->Reset_SpaceID␉␉= 0x01; // System I/O␊ |
654 | ␉␉fadt_mod->Reset_BitWidth␉= 0x08; // 1 byte␊ |
655 | ␉␉fadt_mod->Reset_BitOffset␉= 0x00; // Offset 0␊ |
656 | ␉␉fadt_mod->Reset_AccessWidth␉= 0x01; // Byte access␊ |
657 | ␉␉fadt_mod->Reset_Address␉␉= 0x0cf9; // Address of the register␊ |
658 | ␉␉fadt_mod->Reset_Value␉␉= 0x06; // Value to write to reset the system␊ |
659 | ␉␉verbose("FADT: Restart Fix applied!\n");␊ |
660 | ␉}␊ |
661 | ␉␊ |
662 | ␉// Patch DSDT Address if we have loaded DSDT.aml␊ |
663 | ␉if(new_dsdt)␊ |
664 | ␉{␊ |
665 | ␉␉DBG("DSDT: Old @%x,%x, ",fadt_mod->DSDT,fadt_mod->X_DSDT);␊ |
666 | ␉␉␊ |
667 | ␉␉fadt_mod->DSDT=(uint32_t)new_dsdt;␊ |
668 | ␉␉if ((uint32_t)(&(fadt_mod->X_DSDT))-(uint32_t)fadt_mod+8<=fadt_mod->Length)␊ |
669 | ␉␉␉fadt_mod->X_DSDT=(uint32_t)new_dsdt;␊ |
670 | ␉␉␊ |
671 | ␉␉DBG("New @%x,%x\n",fadt_mod->DSDT,fadt_mod->X_DSDT);␊ |
672 | ␉␉␊ |
673 | ␉␉//Azi: using only getPciRootUID() to signal user supplied acpi table.␊ |
674 | ␉␉//verbose("FADT: Using custom DSDT!\n");␊ |
675 | ␉}␊ |
676 | ␉␊ |
677 | ␉// Correct the checksum␊ |
678 | ␉fadt_mod->Checksum=0;␊ |
679 | ␉fadt_mod->Checksum=256-checksum8(fadt_mod,fadt_mod->Length);␊ |
680 | ␉␊ |
681 | ␉return fadt_mod;␊ |
682 | }␊ |
683 | ␊ |
684 | /* Setup ACPI without replacing DSDT. */␊ |
685 | int setupAcpiNoMod() //Azi:mozo - not used atm.␊ |
686 | {␊ |
687 | ␉//␉addConfigurationTable(&gEfiAcpiTableGuid, getAddressOfAcpiTable(), "ACPI");␊ |
688 | ␉//␉addConfigurationTable(&gEfiAcpi20TableGuid, getAddressOfAcpi20Table(), "ACPI_20");␊ |
689 | ␉// XXX aserebln why uint32 cast if pointer is uint64?␊ |
690 | ␉//Azi: "Slice: because rsdp_mod is a pointer (32bit in i386) to a structure uint64_t*"␊ |
691 | ␉acpi10_p = /*(uint64_t)*/(uint32_t)getAddressOfAcpiTable();␊ |
692 | ␉acpi20_p = /*(uint64_t)*/(uint32_t)getAddressOfAcpi20Table();␊ |
693 | ␉addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI");␊ |
694 | ␉if(acpi20_p) addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20");␊ |
695 | ␉return 1;␊ |
696 | }␊ |
697 | ␊ |
698 | /* Setup ACPI. Replace DSDT if DSDT.aml is found */␊ |
699 | int setupAcpi(void)␊ |
700 | {␊ |
701 | ␉int version;␊ |
702 | ␉void *new_dsdt;␊ |
703 | ␉␊ |
704 | ␉// Load replacement DSDT␊ |
705 | ␉new_dsdt = loadACPITable("DSDT.aml"); //Azi:dsdt␊ |
706 | ␉// Mozodojo: going to patch FACP and load SSDT's even if DSDT.aml is not present␊ |
707 | ␉/*if (!new_dsdt)␊ |
708 | ␉{␊ |
709 | ␉␉return setupAcpiNoMod();␊ |
710 | ␉}*/␊ |
711 | ␉␊ |
712 | ␉// Mozodojo: Load additional SSDTs␊ |
713 | ␉struct acpi_2_ssdt *new_ssdt[32]; // 30 + 2 additional tables for pss & cst␊ |
714 | ␉int ssdt_count=0;␊ |
715 | ␉␊ |
716 | ␉// SSDT Options␊ |
717 | ␉bool drop_ssdt=false, generate_pstates=false, generate_cstates=false; ␊ |
718 | ␉␊ |
719 | ␉getBoolForKey(kDropSSDTKey, &drop_ssdt, &bootInfo->bootConfig);␊ |
720 | ␉getBoolForKey(kGeneratePStatesKey, &generate_pstates, &bootInfo->bootConfig);␊ |
721 | ␉getBoolForKey(kGenerateCStatesKey, &generate_cstates, &bootInfo->bootConfig);␊ |
722 | ␉␊ |
723 | ␉{␊ |
724 | ␉␉int i;␊ |
725 | ␉␉␊ |
726 | ␉␉for (i=0; i<30; i++)␊ |
727 | ␉␉{␊ |
728 | ␉␉␉char filename[512];␊ |
729 | ␊ |
730 | ␉␉␉sprintf(filename, i>0?"SSDT-%d.aml":"SSDT.aml", i);␊ |
731 | ␉␉␉␊ |
732 | ␉␉␉if(new_ssdt[ssdt_count] = loadACPITable(filename)) ␊ |
733 | ␉␉␉{␉␉␉␉␊ |
734 | ␉␉␉␉ssdt_count++;␊ |
735 | ␉␉␉}␊ |
736 | ␉␉␉else ␊ |
737 | ␉␉␉{␊ |
738 | ␉␉␉␉break;␊ |
739 | ␉␉␉}␊ |
740 | ␉␉}␊ |
741 | ␉}␊ |
742 | ␉␉␊ |
743 | ␉// Do the same procedure for both versions of ACPI␊ |
744 | ␉for (version=0; version<2; version++) {␊ |
745 | ␉␉struct acpi_2_rsdp *rsdp, *rsdp_mod;␊ |
746 | ␉␉struct acpi_2_rsdt *rsdt, *rsdt_mod;␊ |
747 | ␉␉int rsdplength;␊ |
748 | ␉␉␊ |
749 | ␉␉// Find original rsdp␊ |
750 | ␉␉rsdp=(struct acpi_2_rsdp *)(version?getAddressOfAcpi20Table():getAddressOfAcpiTable());␊ |
751 | ␉␉if (!rsdp)␊ |
752 | ␉␉{␊ |
753 | ␉␉␉DBG("No ACPI version %d found. Ignoring\n", version+1);␊ |
754 | ␉␉␉if (version)␊ |
755 | ␉␉␉␉addConfigurationTable(&gEfiAcpi20TableGuid, NULL, "ACPI_20");␊ |
756 | ␉␉␉else␊ |
757 | ␉␉␉␉addConfigurationTable(&gEfiAcpiTableGuid, NULL, "ACPI");␊ |
758 | ␉␉␉continue;␊ |
759 | ␉␉}␊ |
760 | ␉␉rsdplength=version?rsdp->Length:20;␊ |
761 | ␉␉␊ |
762 | ␉␉DBG("RSDP version %d found @%x. Length=%d\n",version+1,rsdp,rsdplength);␊ |
763 | ␉␉␊ |
764 | ␉␉/* FIXME: no check that memory allocation succeeded ␊ |
765 | ␉␉ * Copy and patch RSDP,RSDT, XSDT and FADT␊ |
766 | ␉␉ * For more info see ACPI Specification pages 110 and following␊ |
767 | ␉␉ */␊ |
768 | ␉␉␊ |
769 | ␉␉rsdp_mod=(struct acpi_2_rsdp *) AllocateKernelMemory(rsdplength);␊ |
770 | ␉␉memcpy(rsdp_mod, rsdp, rsdplength); ␊ |
771 | ␉␉rsdt=(struct acpi_2_rsdt *)(rsdp->RsdtAddress);␊ |
772 | ␉␉␊ |
773 | ␉␉DBG("RSDT @%x, Length %d\n",rsdt, rsdt->Length);␊ |
774 | ␉␉␊ |
775 | ␉␉if (rsdt && (uint32_t)rsdt !=0xffffffff && rsdt->Length<0x10000)␊ |
776 | ␉␉{␊ |
777 | ␉␉␉uint32_t *rsdt_entries;␊ |
778 | ␉␉␉int rsdt_entries_num;␊ |
779 | ␉␉␉int dropoffset=0, i;␊ |
780 | ␉␉␉␊ |
781 | ␉␉␉// mozo: using malloc cos I didn't found how to free already allocated kernel memory␊ |
782 | ␉␉␉rsdt_mod=(struct acpi_2_rsdt *)malloc(rsdt->Length); ␊ |
783 | ␉␉␉memcpy (rsdt_mod, rsdt, rsdt->Length);␊ |
784 | ␉␉␉rsdp_mod->RsdtAddress=(uint32_t)rsdt_mod;␊ |
785 | ␉␉␉rsdt_entries_num=(rsdt_mod->Length-sizeof(struct acpi_2_rsdt))/4;␊ |
786 | ␉␉␉rsdt_entries=(uint32_t *)(rsdt_mod+1);␊ |
787 | ␉␉␉for (i=0;i<rsdt_entries_num;i++)␊ |
788 | ␉␉␉{␊ |
789 | ␉␉␉␉char *table=(char *)(rsdt_entries[i]);␊ |
790 | ␉␉␉␉if (!table)␊ |
791 | ␉␉␉␉␉continue;␊ |
792 | ␉␉␉␉␊ |
793 | ␉␉␉␉DBG("TABLE %c%c%c%c,",table[0],table[1],table[2],table[3]);␊ |
794 | ␉␉␉␉␊ |
795 | ␉␉␉␉rsdt_entries[i-dropoffset]=rsdt_entries[i];␊ |
796 | ␉␉␉␉␊ |
797 | ␉␉␉␉if (drop_ssdt && tableSign(table, "SSDT"))␊ |
798 | ␉␉␉␉{␊ |
799 | ␉␉␉␉␉dropoffset++;␊ |
800 | ␉␉␉␉␉continue;␊ |
801 | ␉␉␉␉}␊ |
802 | ␉␉␉␉if (tableSign(table, "DSDT"))␊ |
803 | ␉␉␉␉{␊ |
804 | ␉␉␉␉␉DBG("DSDT found\n");␊ |
805 | ␉␉␉␉␉␊ |
806 | ␉␉␉␉␉if(new_dsdt)␊ |
807 | ␉␉␉␉␉␉rsdt_entries[i-dropoffset]=(uint32_t)new_dsdt;␊ |
808 | ␉␉␉␉␉␉␉␉␉␉␊ |
809 | ␉␉␉␉␉continue;␊ |
810 | ␉␉␉␉}␊ |
811 | ␉␉␉␉if (tableSign(table, "FACP"))␊ |
812 | ␉␉␉␉{␊ |
813 | ␉␉␉␉␉struct acpi_2_fadt *fadt, *fadt_mod;␊ |
814 | ␉␉␉␉␉fadt=(struct acpi_2_fadt *)rsdt_entries[i];␊ |
815 | ␉␉␉␉␉␊ |
816 | ␉␉␉␉␉DBG("FADT found @%x, Length %d\n",fadt, fadt->Length);␊ |
817 | ␉␉␉␉␉␊ |
818 | ␉␉␉␉␉if (!fadt || (uint32_t)fadt == 0xffffffff || fadt->Length>0x10000)␊ |
819 | ␉␉␉␉␉{␊ |
820 | ␉␉␉␉␉␉printf("FADT incorrect. Not modified\n");␊ |
821 | ␉␉␉␉␉␉continue;␊ |
822 | ␉␉␉␉␉}␊ |
823 | ␉␉␉␉␉␊ |
824 | ␉␉␉␉␉fadt_mod = patch_fadt(fadt, new_dsdt);␊ |
825 | ␉␉␉␉␉rsdt_entries[i-dropoffset]=(uint32_t)fadt_mod;␊ |
826 | ␉␉␉␉␉␊ |
827 | ␉␉␉␉␉// Generate _CST SSDT␊ |
828 | ␉␉␉␉␉if (generate_cstates && (new_ssdt[ssdt_count] = generate_cst_ssdt(fadt_mod)))␊ |
829 | ␉␉␉␉␉{␊ |
830 | ␉␉␉␉␉␉generate_cstates = false; // Generate SSDT only once!␊ |
831 | ␉␉␉␉␉␉ssdt_count++;␊ |
832 | ␉␉␉␉␉}␊ |
833 | ␉␉␉␉␉␊ |
834 | ␉␉␉␉␉// Generating _PSS SSDT␊ |
835 | ␉␉␉␉␉if (generate_pstates && (new_ssdt[ssdt_count] = generate_pss_ssdt((void*)fadt_mod->DSDT)))␊ |
836 | ␉␉␉␉␉{␊ |
837 | ␉␉␉␉␉␉generate_pstates = false; // Generate SSDT only once!␊ |
838 | ␉␉␉␉␉␉ssdt_count++;␊ |
839 | ␉␉␉␉␉}␊ |
840 | ␉␉␉␉␉␊ |
841 | ␉␉␉␉␉continue;␊ |
842 | ␉␉␉␉}␊ |
843 | ␉␉␉}␊ |
844 | ␉␉␉DBG("\n");␊ |
845 | ␉␉␉␊ |
846 | ␉␉␉// Allocate rsdt in Kernel memory area␊ |
847 | ␉␉␉rsdt_mod->Length += 4*ssdt_count - 4*dropoffset;␊ |
848 | ␉␉␉struct acpi_2_rsdt *rsdt_copy = (struct acpi_2_rsdt *)AllocateKernelMemory(rsdt_mod->Length);␊ |
849 | ␉␉␉memcpy (rsdt_copy, rsdt_mod, rsdt_mod->Length);␊ |
850 | ␉␉␉free(rsdt_mod); rsdt_mod = rsdt_copy;␊ |
851 | ␉␉␉rsdp_mod->RsdtAddress=(uint32_t)rsdt_mod;␊ |
852 | ␉␉␉rsdt_entries_num=(rsdt_mod->Length-sizeof(struct acpi_2_rsdt))/4;␊ |
853 | ␉␉␉rsdt_entries=(uint32_t *)(rsdt_mod+1);␊ |
854 | ␉␉␉␊ |
855 | ␉␉␉// Mozodojo: Insert additional SSDTs into RSDT␊ |
856 | ␉␉␉if(ssdt_count>0)␊ |
857 | ␉␉␉{␊ |
858 | ␉␉␉␉int j;␊ |
859 | ␉␉␉␉␊ |
860 | ␉␉␉␉for (j=0; j<ssdt_count; j++)␊ |
861 | ␉␉␉␉␉rsdt_entries[i-dropoffset+j]=(uint32_t)new_ssdt[j];␊ |
862 | ␉␉␉␉␉␊ |
863 | ␉␉␉␉verbose("RSDT: Added %d SSDT table(s)\n", ssdt_count);␊ |
864 | ␉␉␉}␊ |
865 | ␊ |
866 | ␉␉␉// Correct the checksum of RSDT␊ |
867 | ␉␉␉DBG("RSDT: Original checksum %d, ", rsdt_mod->Checksum);␊ |
868 | ␉␉␉␊ |
869 | ␉␉␉rsdt_mod->Checksum=0;␊ |
870 | ␉␉␉rsdt_mod->Checksum=256-checksum8(rsdt_mod,rsdt_mod->Length);␊ |
871 | ␉␉␉␊ |
872 | ␉␉␉DBG("New checksum %d at %x\n", rsdt_mod->Checksum,rsdt_mod);␊ |
873 | ␉␉}␊ |
874 | ␉␉else␊ |
875 | ␉␉{␊ |
876 | ␉␉␉rsdp_mod->RsdtAddress=0;␊ |
877 | ␉␉␉printf("RSDT not found or RSDT incorrect\n");␊ |
878 | ␉␉}␊ |
879 | ␉␉␊ |
880 | ␉␉if (version)␊ |
881 | ␉␉{␊ |
882 | ␉␉␉struct acpi_2_xsdt *xsdt, *xsdt_mod;␊ |
883 | ␉␉␉␊ |
884 | ␉␉␉// FIXME: handle 64-bit address correctly␊ |
885 | ␉␉␉␊ |
886 | ␉␉␉xsdt=(struct acpi_2_xsdt*) ((uint32_t)rsdp->XsdtAddress);␊ |
887 | ␉␉␉DBG("XSDT @%x;%x, Length=%d\n", (uint32_t)(rsdp->XsdtAddress>>32),(uint32_t)rsdp->XsdtAddress,␊ |
888 | ␉␉␉␉xsdt->Length);␊ |
889 | ␉␉␉if (xsdt && (uint64_t)rsdp->XsdtAddress<0xffffffff && xsdt->Length<0x10000)␊ |
890 | ␉␉␉{␊ |
891 | ␉␉␉␉uint64_t *xsdt_entries;␊ |
892 | ␉␉␉␉int xsdt_entries_num, i;␊ |
893 | ␉␉␉␉int dropoffset=0;␊ |
894 | ␉␉␉␉␊ |
895 | ␉␉␉␉// mozo: using malloc cos I didn't found how to free already allocated kernel memory␊ |
896 | ␉␉␉␉xsdt_mod=(struct acpi_2_xsdt*)malloc(xsdt->Length); ␊ |
897 | ␉␉␉␉memcpy(xsdt_mod, xsdt, xsdt->Length);␊ |
898 | ␉␉␉␉rsdp_mod->XsdtAddress=(uint32_t)xsdt_mod;␊ |
899 | ␉␉␉␉xsdt_entries_num=(xsdt_mod->Length-sizeof(struct acpi_2_xsdt))/8;␊ |
900 | ␉␉␉␉xsdt_entries=(uint64_t *)(xsdt_mod+1);␊ |
901 | ␉␉␉␉for (i=0;i<xsdt_entries_num;i++)␊ |
902 | ␉␉␉␉{␊ |
903 | ␉␉␉␉␉char *table=(char *)((uint32_t)(xsdt_entries[i]));␊ |
904 | ␉␉␉␉␉if (!table)␊ |
905 | ␉␉␉␉␉␉continue;␊ |
906 | ␉␉␉␉␉␊ |
907 | ␉␉␉␉␉xsdt_entries[i-dropoffset]=xsdt_entries[i];␊ |
908 | ␉␉␉␉␉␊ |
909 | ␉␉␉␉␉if (drop_ssdt && tableSign(table, "SSDT"))␊ |
910 | ␉␉␉␉␉{␊ |
911 | ␉␉␉␉␉␉dropoffset++;␊ |
912 | ␉␉␉␉␉␉continue;␊ |
913 | ␉␉␉␉␉}␉␉␉␉␉␊ |
914 | ␉␉␉␉␉if (tableSign(table, "DSDT"))␊ |
915 | ␉␉␉␉␉{␊ |
916 | ␉␉␉␉␉␉DBG("DSDT found\n");␊ |
917 | ␉␉␉␉␉␉␊ |
918 | ␉␉␉␉␉␉if (new_dsdt) ␊ |
919 | ␉␉␉␉␉␉␉xsdt_entries[i-dropoffset]=(uint32_t)new_dsdt;␊ |
920 | ␉␉␉␉␉␉␊ |
921 | ␉␉␉␉␉␉DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]);␊ |
922 | ␉␉␉␉␉␉␊ |
923 | ␉␉␉␉␉␉continue;␊ |
924 | ␉␉␉␉␉}␊ |
925 | ␉␉␉␉␉if (tableSign(table, "FACP"))␊ |
926 | ␉␉␉␉␉{␊ |
927 | ␉␉␉␉␉␉struct acpi_2_fadt *fadt, *fadt_mod;␊ |
928 | ␉␉␉␉␉␉fadt=(struct acpi_2_fadt *)(uint32_t)xsdt_entries[i];␊ |
929 | ␉␉␉␉␉␉␊ |
930 | ␉␉␉␉␉␉DBG("FADT found @%x,%x, Length %d\n",(uint32_t)(xsdt_entries[i]>>32),fadt, ␊ |
931 | ␉␉␉␉␉␉␉fadt->Length);␊ |
932 | ␉␉␉␉␉␉␊ |
933 | ␉␉␉␉␉␉if (!fadt || (uint64_t)xsdt_entries[i] >= 0xffffffff || fadt->Length>0x10000)␊ |
934 | ␉␉␉␉␉␉{␊ |
935 | ␉␉␉␉␉␉␉verbose("FADT incorrect or after 4GB. Dropping XSDT\n");␊ |
936 | ␉␉␉␉␉␉␉goto drop_xsdt;␊ |
937 | ␉␉␉␉␉␉}␊ |
938 | ␉␉␉␉␉␉␊ |
939 | ␉␉␉␉␉␉fadt_mod = patch_fadt(fadt, new_dsdt);␊ |
940 | ␉␉␉␉␉␉xsdt_entries[i-dropoffset]=(uint32_t)fadt_mod;␊ |
941 | ␉␉␉␉␉␉␊ |
942 | ␉␉␉␉␉␉DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]);␊ |
943 | ␉␉␉␉␉␉␊ |
944 | ␉␉␉␉␉␉// Generate _CST SSDT␊ |
945 | ␉␉␉␉␉␉if (generate_cstates && (new_ssdt[ssdt_count] = generate_cst_ssdt(fadt_mod))) ␊ |
946 | ␉␉␉␉␉␉{␊ |
947 | ␉␉␉␉␉␉␉generate_cstates = false; // Generate SSDT only once!␊ |
948 | ␉␉␉␉␉␉␉ssdt_count++;␊ |
949 | ␉␉␉␉␉␉}␊ |
950 | ␉␉␉␉␉␉␊ |
951 | ␉␉␉␉␉␉// Generating _PSS SSDT␊ |
952 | ␉␉␉␉␉␉if (generate_pstates && (new_ssdt[ssdt_count] = generate_pss_ssdt((void*)fadt_mod->DSDT)))␊ |
953 | ␉␉␉␉␉␉{␊ |
954 | ␉␉␉␉␉␉␉generate_pstates = false; // Generate SSDT only once!␊ |
955 | ␉␉␉␉␉␉␉ssdt_count++;␊ |
956 | ␉␉␉␉␉␉}␊ |
957 | ␉␉␉␉␉␉␊ |
958 | ␉␉␉␉␉␉continue;␊ |
959 | ␉␉␉␉␉}␊ |
960 | ␉␉␉␉␉␊ |
961 | ␉␉␉␉␉DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]);␊ |
962 | ␉␉␉␉␉␊ |
963 | ␉␉␉␉}␊ |
964 | ␉␉␉␉␊ |
965 | ␉␉␉␉// Allocate xsdt in Kernel memory area␊ |
966 | ␉␉␉␉xsdt_mod->Length += 8*ssdt_count - 8*dropoffset;␊ |
967 | ␉␉␉␉struct acpi_2_xsdt *xsdt_copy = (struct acpi_2_xsdt *)AllocateKernelMemory(xsdt_mod->Length);␊ |
968 | ␉␉␉␉memcpy(xsdt_copy, xsdt_mod, xsdt_mod->Length);␊ |
969 | ␉␉␉␉free(xsdt_mod); xsdt_mod = xsdt_copy;␊ |
970 | ␉␉␉␉rsdp_mod->XsdtAddress=(uint32_t)xsdt_mod;␊ |
971 | ␉␉␉␉xsdt_entries_num=(xsdt_mod->Length-sizeof(struct acpi_2_xsdt))/8;␊ |
972 | ␉␉␉␉xsdt_entries=(uint64_t *)(xsdt_mod+1);␊ |
973 | ␉␉␉␉␊ |
974 | ␉␉␉␉// Mozodojo: Insert additional SSDTs into XSDT␊ |
975 | ␉␉␉␉if(ssdt_count>0)␊ |
976 | ␉␉␉␉{␊ |
977 | ␉␉␉␉␉int j;␊ |
978 | ␉␉␉␉␉␊ |
979 | ␉␉␉␉␉for (j=0; j<ssdt_count; j++)␊ |
980 | ␉␉␉␉␉␉xsdt_entries[i-dropoffset+j]=(uint32_t)new_ssdt[j];␊ |
981 | ␉␉␉␉␉␉␊ |
982 | ␉␉␉␉␉verbose("Added %d SSDT table(s) into XSDT\n", ssdt_count);␊ |
983 | ␉␉␉␉}␊ |
984 | ␊ |
985 | ␉␉␉␉// Correct the checksum of XSDT␊ |
986 | ␉␉␉␉xsdt_mod->Checksum=0;␊ |
987 | ␉␉␉␉xsdt_mod->Checksum=256-checksum8(xsdt_mod,xsdt_mod->Length);␊ |
988 | ␉␉␉}␊ |
989 | ␉␉␉else␊ |
990 | ␉␉␉{␊ |
991 | ␉␉␉drop_xsdt:␊ |
992 | ␉␉␉␉␊ |
993 | ␉␉␉␉DBG("About to drop XSDT\n");␊ |
994 | ␉␉␉␉␊ |
995 | ␉␉␉␉/*FIXME: Now we just hope that if MacOS doesn't find XSDT it reverts to RSDT. ␊ |
996 | ␉␉␉␉ * A Better strategy would be to generate␊ |
997 | ␉␉␉␉ */␊ |
998 | ␉␉␉␉␊ |
999 | ␉␉␉␉rsdp_mod->XsdtAddress=0xffffffffffffffffLL;␊ |
1000 | ␉␉␉␉verbose("XSDT not found or XSDT incorrect\n");␊ |
1001 | ␉␉␉}␊ |
1002 | ␉␉}␊ |
1003 | ␉␉␊ |
1004 | ␉␉// Correct the checksum of RSDP ␊ |
1005 | ␉␉␊ |
1006 | ␉␉DBG("RSDP: Original checksum %d, ", rsdp_mod->Checksum);␊ |
1007 | ␉␉␊ |
1008 | ␉␉rsdp_mod->Checksum=0;␊ |
1009 | ␉␉rsdp_mod->Checksum=256-checksum8(rsdp_mod,20);␊ |
1010 | ␉␉␊ |
1011 | ␉␉DBG("New checksum %d\n", rsdp_mod->Checksum);␊ |
1012 | ␉␉␊ |
1013 | ␉␉if (version)␊ |
1014 | ␉␉{␊ |
1015 | ␉␉␉DBG("RSDP: Original extended checksum %d", rsdp_mod->ExtendedChecksum);␊ |
1016 | ␉␉␉␊ |
1017 | ␉␉␉rsdp_mod->ExtendedChecksum=0;␊ |
1018 | ␉␉␉rsdp_mod->ExtendedChecksum=256-checksum8(rsdp_mod,rsdp_mod->Length);␊ |
1019 | ␉␉␉␊ |
1020 | ␉␉␉DBG("New extended checksum %d\n", rsdp_mod->ExtendedChecksum);␊ |
1021 | ␉␉␉␊ |
1022 | ␉␉}␊ |
1023 | ␉␉␊ |
1024 | ␉␉//Azi:mozo - commented out; using instead of "FADT: Using custom DSDT!"␊ |
1025 | ␉␉verbose("ACPI version %d\n", version + 1); // always prints so, just print acpi version.␊ |
1026 | ␉␉if (version)␊ |
1027 | ␉␉{␊ |
1028 | ␉␉␉// XXX aserebln why uint32 cast if pointer is uint64?␊ |
1029 | ␉␉␉//Azi: See setupAcpiNoMod.␊ |
1030 | ␉␉␉acpi20_p = (/*uint64_t)(*/uint32_t)rsdp_mod;␊ |
1031 | ␉␉␉addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20");␊ |
1032 | ␉␉}␊ |
1033 | ␉␉else␊ |
1034 | ␉␉{␊ |
1035 | ␉␉␉// XXX aserebln why uint32 cast if pointer is uint64?␊ |
1036 | ␉␉␉acpi10_p = (/*uint64_t)(*/uint32_t)rsdp_mod;␊ |
1037 | ␉␉␉addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI");␊ |
1038 | ␉␉}␊ |
1039 | ␉}␊ |
1040 | #if DEBUG_ACPI␊ |
1041 | ␉printf("Press a key to continue... (DEBUG_ACPI)\n");␊ |
1042 | ␉getc();␊ |
1043 | #endif␊ |
1044 | ␉return 1;␊ |
1045 | }␊ |
1046 | |