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