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 "dsdt_patcher.h"␊ |
12 | ␊ |
13 | #ifndef DEBUG_DSDT␊ |
14 | #define DEBUG_DSDT 0␊ |
15 | #endif␊ |
16 | ␊ |
17 | #if DEBUG_DSDT==2␊ |
18 | #define DBG(x...) {printf(x); sleep(1);}␊ |
19 | #elif DEBUG_DSDT==1␊ |
20 | #define DBG(x...) printf(x)␊ |
21 | #else␊ |
22 | #define DBG(x...)␊ |
23 | #endif␊ |
24 | ␊ |
25 | /* Gets the ACPI 1.0 RSDP address */␊ |
26 | static struct acpi_2_rsdp* getAddressOfAcpiTable()␊ |
27 | {␊ |
28 | /* TODO: Before searching the BIOS space we are supposed to search the first 1K of the EBDA */␊ |
29 | ␉␊ |
30 | void *acpi_addr = (void*)ACPI_RANGE_START;␊ |
31 | for(; acpi_addr <= (void*)ACPI_RANGE_END; acpi_addr += 16)␊ |
32 | {␊ |
33 | if(*(uint64_t *)acpi_addr == ACPI_SIGNATURE_UINT64_LE)␊ |
34 | {␊ |
35 | uint8_t csum = checksum8(acpi_addr, 20);␊ |
36 | if(csum == 0)␊ |
37 | {␊ |
38 | // Only return the table if it is a true version 1.0 table (Revision 0)␊ |
39 | if(((struct acpi_2_rsdp*)acpi_addr)->Revision == 0)␊ |
40 | return acpi_addr;␊ |
41 | }␊ |
42 | }␊ |
43 | }␊ |
44 | return NULL;␊ |
45 | }␊ |
46 | ␊ |
47 | /* Gets the ACPI 2.0 RSDP address */␊ |
48 | static struct acpi_2_rsdp* getAddressOfAcpi20Table()␊ |
49 | {␊ |
50 | /* TODO: Before searching the BIOS space we are supposed to search the first 1K of the EBDA */␊ |
51 | ␉␊ |
52 | void *acpi_addr = (void*)ACPI_RANGE_START;␊ |
53 | for(; acpi_addr <= (void*)ACPI_RANGE_END; acpi_addr += 16)␊ |
54 | {␊ |
55 | if(*(uint64_t *)acpi_addr == ACPI_SIGNATURE_UINT64_LE)␊ |
56 | {␊ |
57 | uint8_t csum = checksum8(acpi_addr, 20);␊ |
58 | ␊ |
59 | /* Only assume this is a 2.0 or better table if the revision is greater than 0␊ |
60 | * NOTE: ACPI 3.0 spec only seems to say that 1.0 tables have revision 1␊ |
61 | * and that the current revision is 2.. I am going to assume that rev > 0 is 2.0.␊ |
62 | */␊ |
63 | ␊ |
64 | if(csum == 0 && (((struct acpi_2_rsdp*)acpi_addr)->Revision > 0))␊ |
65 | {␊ |
66 | uint8_t csum2 = checksum8(acpi_addr, sizeof(struct acpi_2_rsdp));␊ |
67 | if(csum2 == 0)␊ |
68 | return acpi_addr;␊ |
69 | }␊ |
70 | }␊ |
71 | }␊ |
72 | return NULL;␊ |
73 | }␊ |
74 | ␊ |
75 | ␊ |
76 | /* Setup ACPI without replacing DSDT. */␊ |
77 | int setupAcpiNoMod()␊ |
78 | {␊ |
79 | //␉addConfigurationTable(&gEfiAcpiTableGuid, getAddressOfAcpiTable(), "ACPI");␊ |
80 | //␉addConfigurationTable(&gEfiAcpi20TableGuid, getAddressOfAcpi20Table(), "ACPI_20");␊ |
81 | ␉acpi10_p = (uint32_t)getAddressOfAcpiTable();␊ |
82 | ␉acpi20_p = (uint32_t)getAddressOfAcpi20Table();␊ |
83 | ␉addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI");␊ |
84 | ␉if(acpi20_p) addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20");␊ |
85 | ␉return 1;␊ |
86 | }␊ |
87 | ␊ |
88 | /* Setup ACPI. Replace DSDT if DSDT.aml is found */␊ |
89 | int setupAcpi()␊ |
90 | {␊ |
91 | ␉int fd, version;␊ |
92 | ␉void *new_dsdt;␊ |
93 | ␉const char *dsdt_filename;␊ |
94 | ␉char dirspec[512];␊ |
95 | ␉int len;␊ |
96 | ␉boolean_t drop_ssdt=NO;␊ |
97 | ␊ |
98 | ␉//DBG("Enter setupACPI\n");␊ |
99 | ␊ |
100 | ␉if (!getValueForKey("DSDT", &dsdt_filename, &len, &bootInfo->bootConfig))␊ |
101 | ␉␉dsdt_filename="DSDT.aml";␊ |
102 | ␉␊ |
103 | ␉// Check booting partition␊ |
104 | ␉sprintf(dirspec,"%s",dsdt_filename);␊ |
105 | ␉fd=open (dirspec,0);␊ |
106 | ␉if (fd<0)␊ |
107 | ␉{␉// Check Extra on booting partition␊ |
108 | ␉␉sprintf(dirspec,"/Extra/%s",dsdt_filename);␊ |
109 | ␉␉fd=open (dirspec,0);␊ |
110 | ␉␉if (fd<0)␊ |
111 | ␉␉{␉// Fall back to booter partition␊ |
112 | ␉␉␉sprintf(dirspec,"bt(0,0)/Extra/%s",dsdt_filename);␊ |
113 | ␉␉␉fd=open (dirspec,0);␊ |
114 | ␉␉␉if (fd<0)␊ |
115 | ␉␉␉{␊ |
116 | ␉␉␉␉verbose("No DSDT replacement found. Leaving ACPI data as is\n");␊ |
117 | ␉␉␉␉return setupAcpiNoMod();␊ |
118 | ␉␉␉}␊ |
119 | ␉␉}␊ |
120 | ␉}␊ |
121 | ␉␊ |
122 | ␉// Load replacement DSDT␊ |
123 | ␉new_dsdt=(void*)AllocateKernelMemory(file_size (fd));␊ |
124 | ␉if (!new_dsdt)␊ |
125 | ␉{␊ |
126 | ␉␉printf("Couldn't allocate memory for DSDT\n");␊ |
127 | ␉␉return setupAcpiNoMod();␊ |
128 | ␉}␊ |
129 | ␉if (read (fd, new_dsdt, file_size (fd))!=file_size (fd))␊ |
130 | ␉{␊ |
131 | ␉␉printf("Couldn't read file\n");␊ |
132 | ␉␉return setupAcpiNoMod();␊ |
133 | ␉}␊ |
134 | ␉close (fd);␊ |
135 | ␉␊ |
136 | ␉DBG("New DSDT Loaded in memory\n");␊ |
137 | ␉␊ |
138 | ␉{␊ |
139 | ␉␉BOOL tmp;␊ |
140 | ␉␉drop_ssdt=getBoolForKey("DropSSDT",&tmp, &bootInfo->bootConfig)&&tmp;␊ |
141 | ␉}␊ |
142 | ␉␊ |
143 | ␉// Do the same procedure for both versions of ACPI␊ |
144 | ␉for (version=0;version<2;version++)␊ |
145 | ␉{␊ |
146 | ␉␉struct acpi_2_rsdp *rsdp, *rsdp_mod;␊ |
147 | ␉␉struct acpi_2_rsdt *rsdt, *rsdt_mod;␊ |
148 | ␉␉int rsdplength;␊ |
149 | ␉␉␊ |
150 | ␉␉// Find original rsdp␊ |
151 | ␉␉rsdp=(struct acpi_2_rsdp *)(version?getAddressOfAcpi20Table():getAddressOfAcpiTable());␊ |
152 | ␉␉if (!rsdp)␊ |
153 | ␉␉{␊ |
154 | ␉␉␉DBG("No ACPI version %d found. Ignoring\n", version+1);␊ |
155 | ␉␉␉if (version)␊ |
156 | ␉␉␉␉addConfigurationTable(&gEfiAcpi20TableGuid, NULL, "ACPI_20");␊ |
157 | ␉␉␉else␊ |
158 | ␉␉␉␉addConfigurationTable(&gEfiAcpiTableGuid, NULL, "ACPI");␊ |
159 | ␉␉␉continue;␊ |
160 | ␉␉}␊ |
161 | ␉␉rsdplength=version?rsdp->Length:20;␊ |
162 | ␊ |
163 | ␉␉DBG("RSDP version %d found @%x. Length=%d\n",version+1,rsdp,rsdplength);␊ |
164 | ␊ |
165 | ␉␉/* FIXME: no check that memory allocation succeeded ␊ |
166 | ␉␉ * Copy and patch RSDP,RSDT, XSDT and FADT␊ |
167 | ␉␉ * For more info see ACPI Specification pages 110 and following␊ |
168 | ␉␉ */␊ |
169 | ␊ |
170 | ␉␉rsdp_mod=(struct acpi_2_rsdp *) AllocateKernelMemory(rsdplength);␊ |
171 | ␉␉memcpy(rsdp_mod, rsdp, rsdplength); ␊ |
172 | ␉␉rsdt=(struct acpi_2_rsdt *)(rsdp->RsdtAddress);␊ |
173 | ␊ |
174 | ␉␉DBG("RSDT @%x, Length %d\n",rsdt, rsdt->Length);␊ |
175 | ␉␉␊ |
176 | ␉␉if (rsdt && (uint32_t)rsdt !=0xffffffff && rsdt->Length<0x10000)␊ |
177 | ␉␉{␊ |
178 | ␉␉␉uint32_t *rsdt_entries;␊ |
179 | ␉␉␉int rsdt_entries_num;␊ |
180 | ␉␉␉int dropoffset=0, i;␊ |
181 | ␉␉␉␊ |
182 | ␉␉␉rsdt_mod=(struct acpi_2_rsdt *)AllocateKernelMemory(rsdt->Length); ␊ |
183 | ␉␉␉memcpy (rsdt_mod, rsdt, rsdt->Length);␊ |
184 | ␉␉␉rsdp_mod->RsdtAddress=(uint32_t)rsdt_mod;␊ |
185 | ␉␉␉rsdt_entries_num=(rsdt_mod->Length-sizeof(struct acpi_2_rsdt))/4;␊ |
186 | ␉␉␉rsdt_entries=(uint32_t *)(rsdt_mod+1);␊ |
187 | ␉␉␉for (i=0;i<rsdt_entries_num;i++)␊ |
188 | ␉␉␉{␊ |
189 | ␉␉␉␉char *table=(char *)(rsdt_entries[i]);␊ |
190 | ␉␉␉␉if (!table)␊ |
191 | ␉␉␉␉␉continue;␊ |
192 | ␊ |
193 | ␉␉␉␉DBG("TABLE %c%c%c%c,",table[0],table[1],table[2],table[3]);␊ |
194 | ␊ |
195 | ␉␉␉␉rsdt_entries[i-dropoffset]=rsdt_entries[i];␊ |
196 | ␉␉␉␉if (drop_ssdt && table[0]=='S' && table[1]=='S' && table[2]=='D' && table[3]=='T')␊ |
197 | ␉␉␉␉{␊ |
198 | ␉␉␉␉␉dropoffset++;␊ |
199 | ␉␉␉␉␉continue;␊ |
200 | ␉␉␉␉}␊ |
201 | ␉␉␉␉if (table[0]=='D' && table[1]=='S' && table[2]=='D' && table[3]=='T')␊ |
202 | ␉␉␉␉{␊ |
203 | ␉␉␉␉␉DBG("DSDT found\n");␊ |
204 | ␉␉␉␉␉rsdt_entries[i-dropoffset]=(uint32_t)new_dsdt;␊ |
205 | ␉␉␉␉␉continue;␊ |
206 | ␉␉␉␉}␊ |
207 | ␉␉␉␉if (table[0]=='F' && table[1]=='A' && table[2]=='C' && table[3]=='P')␊ |
208 | ␉␉␉␉{␊ |
209 | ␉␉␉␉␉struct acpi_2_fadt *fadt, *fadt_mod;␊ |
210 | ␉␉␉␉␉fadt=(struct acpi_2_fadt *)rsdt_entries[i];␊ |
211 | ␊ |
212 | ␉␉␉␉␉DBG("FADT found @%x, Length %d\n",fadt, fadt->Length);␊ |
213 | ␊ |
214 | ␉␉␉␉␉if (!fadt || (uint32_t)fadt == 0xffffffff || fadt->Length>0x10000)␊ |
215 | ␉␉␉␉␉{␊ |
216 | ␉␉␉␉␉␉printf("FADT incorrect. Not modified\n");␊ |
217 | ␉␉␉␉␉␉continue;␊ |
218 | ␉␉␉␉␉}␊ |
219 | ␉␉␉␉␉␊ |
220 | ␉␉␉␉␉fadt_mod=(struct acpi_2_fadt *)AllocateKernelMemory(fadt->Length); ␊ |
221 | ␉␉␉␉␉memcpy(fadt_mod, fadt, fadt->Length);␊ |
222 | ␊ |
223 | ␉␉␉␉␉// Patch DSDT Address␊ |
224 | ␉␉␉␉␉DBG("Old DSDT @%x,%x\n",fadt_mod->DSDT,fadt_mod->X_DSDT);␊ |
225 | ␊ |
226 | ␉␉␉␉␉fadt_mod->DSDT=(uint32_t)new_dsdt;␊ |
227 | ␉␉␉␉␉if ((uint32_t)(&(fadt_mod->X_DSDT))-(uint32_t)fadt_mod+8<=fadt_mod->Length)␊ |
228 | ␉␉␉␉␉␉fadt_mod->X_DSDT=(uint32_t)new_dsdt;␊ |
229 | ␊ |
230 | ␉␉␉␉␉DBG("New DSDT @%x,%x\n",fadt_mod->DSDT,fadt_mod->X_DSDT);␊ |
231 | ␊ |
232 | ␉␉␉␉␉// Correct the checksum␊ |
233 | ␉␉␉␉␉fadt_mod->Checksum=0;␊ |
234 | ␉␉␉␉␉fadt_mod->Checksum=256-checksum8(fadt_mod,fadt_mod->Length);␊ |
235 | ␉␉␉␉␉␊ |
236 | ␉␉␉␉␉rsdt_entries[i-dropoffset]=(uint32_t)fadt_mod;␊ |
237 | ␉␉␉␉␉continue;␊ |
238 | ␉␉␉␉}␊ |
239 | ␉␉␉}␊ |
240 | ␊ |
241 | ␉␉␉// Correct the checksum of RSDT␊ |
242 | ␉␉␉rsdt_mod->Length-=4*dropoffset;␊ |
243 | ␊ |
244 | ␉␉␉DBG("RSDT: Original checksum %d, ", rsdt_mod->Checksum);␊ |
245 | ␊ |
246 | ␉␉␉rsdt_mod->Checksum=0;␊ |
247 | ␉␉␉rsdt_mod->Checksum=256-checksum8(rsdt_mod,rsdt_mod->Length);␊ |
248 | ␊ |
249 | ␉␉␉DBG("New checksum %d at %x\n", rsdt_mod->Checksum,rsdt_mod);␊ |
250 | ␉␉}␊ |
251 | ␉␉else␊ |
252 | ␉␉{␊ |
253 | ␉␉␉rsdp_mod->RsdtAddress=0;␊ |
254 | ␉␉␉printf("RSDT not found or RSDT incorrect\n");␊ |
255 | ␉␉}␊ |
256 | ␊ |
257 | ␉␉if (version)␊ |
258 | ␉␉{␊ |
259 | ␉␉␉struct acpi_2_xsdt *xsdt, *xsdt_mod;␊ |
260 | ␊ |
261 | ␉␉␉// FIXME: handle 64-bit address correctly␊ |
262 | ␊ |
263 | ␉␉␉xsdt=(struct acpi_2_xsdt*) ((uint32_t)rsdp->XsdtAddress);␊ |
264 | ␉␉␉DBG("XSDT @%x;%x, Length=%d\n", (uint32_t)(rsdp->XsdtAddress>>32),(uint32_t)rsdp->XsdtAddress,␊ |
265 | ␉␉␉␉␉xsdt->Length);␊ |
266 | ␉␉␉if (xsdt && (uint64_t)rsdp->XsdtAddress<0xffffffff && xsdt->Length<0x10000)␊ |
267 | ␉␉␉{␊ |
268 | ␉␉␉␉uint64_t *xsdt_entries;␊ |
269 | ␉␉␉␉int xsdt_entries_num, i;␊ |
270 | ␉␉␉␉int dropoffset=0;␊ |
271 | ␉␉␉␉␊ |
272 | ␉␉␉␉xsdt_mod=(struct acpi_2_xsdt*)AllocateKernelMemory(xsdt->Length); ␊ |
273 | ␉␉␉␉memcpy(xsdt_mod, xsdt, xsdt->Length);␊ |
274 | ␉␉␉␉rsdp_mod->XsdtAddress=(uint32_t)xsdt_mod;␊ |
275 | ␉␉␉␉xsdt_entries_num=(xsdt_mod->Length-sizeof(struct acpi_2_xsdt))/8;␊ |
276 | ␉␉␉␉xsdt_entries=(uint64_t *)(xsdt_mod+1);␊ |
277 | ␉␉␉␉for (i=0;i<xsdt_entries_num;i++)␊ |
278 | ␉␉␉␉{␊ |
279 | ␉␉␉␉␉char *table=(char *)((uint32_t)(xsdt_entries[i]));␊ |
280 | ␉␉␉␉␉if (!table)␊ |
281 | ␉␉␉␉␉␉continue;␊ |
282 | ␉␉␉␉␉xsdt_entries[i-dropoffset]=xsdt_entries[i];␊ |
283 | ␉␉␉␉␉if (drop_ssdt && table[0]=='S' && table[1]=='S' && table[2]=='D' && table[3]=='T')␊ |
284 | ␉␉␉␉␉{␊ |
285 | ␉␉␉␉␉␉dropoffset++;␊ |
286 | ␉␉␉␉␉␉continue;␊ |
287 | ␉␉␉␉␉}␉␉␉␉␉␊ |
288 | ␉␉␉␉␉if (table[0]=='D' && table[1]=='S' && table[2]=='D' && table[3]=='T')␊ |
289 | ␉␉␉␉␉{␊ |
290 | ␉␉␉␉␉␉DBG("DSDT found\n");␊ |
291 | ␊ |
292 | ␉␉␉␉␉␉xsdt_entries[i-dropoffset]=(uint32_t)new_dsdt;␊ |
293 | ␊ |
294 | ␉␉␉␉␉␉DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]);␊ |
295 | ␉␉␉␉␉␉␊ |
296 | ␉␉␉␉␉␉continue;␊ |
297 | ␉␉␉␉␉}␊ |
298 | ␉␉␉␉␉if (table[0]=='F' && table[1]=='A' && table[2]=='C' && table[3]=='P')␊ |
299 | ␉␉␉␉␉{␊ |
300 | ␉␉␉␉␉␉struct acpi_2_fadt *fadt, *fadt_mod;␊ |
301 | ␉␉␉␉␉␉fadt=(struct acpi_2_fadt *)(uint32_t)xsdt_entries[i];␊ |
302 | ␊ |
303 | ␉␉␉␉␉␉DBG("FADT found @%x,%x, Length %d\n",(uint32_t)(xsdt_entries[i]>>32),fadt, ␊ |
304 | ␉␉␉␉␉␉␉␉ fadt->Length);␊ |
305 | ␊ |
306 | ␉␉␉␉␉␉if (!fadt || (uint64_t)xsdt_entries[i] >= 0xffffffff || fadt->Length>0x10000)␊ |
307 | ␉␉␉␉␉␉{␊ |
308 | ␉␉␉␉␉␉␉printf("FADT incorrect or after 4GB. Dropping XSDT\n");␊ |
309 | ␉␉␉␉␉␉␉goto drop_xsdt;␊ |
310 | ␉␉␉␉␉␉}␊ |
311 | ␉␉␉␉␉␉fadt_mod=(struct acpi_2_fadt*)AllocateKernelMemory(fadt->Length); ␊ |
312 | ␉␉␉␉␉␉memcpy(fadt_mod, fadt, fadt->Length);␊ |
313 | ␊ |
314 | ␉␉␉␉␉␉// Patch DSDT Address␊ |
315 | ␉␉␉␉␉␉DBG("Old DSDT @%x,%x\n",fadt_mod->DSDT,fadt_mod->X_DSDT);␊ |
316 | ␊ |
317 | ␉␉␉␉␉␉fadt_mod->DSDT=(uint32_t)new_dsdt;␊ |
318 | ␉␉␉␉␉␉if ((uint32_t)(&(fadt_mod->X_DSDT))-(uint32_t)fadt_mod+8<=fadt_mod->Length)␊ |
319 | ␉␉␉␉␉␉␉fadt_mod->X_DSDT=(uint32_t)new_dsdt;␊ |
320 | ␊ |
321 | ␉␉␉␉␉␉DBG("New DSDT @%x,%x\n",fadt_mod->DSDT,fadt_mod->X_DSDT);␊ |
322 | ␊ |
323 | ␉␉␉␉␉␉// Correct the checksum␊ |
324 | ␉␉␉␉␉␉fadt_mod->Checksum=0;␊ |
325 | ␉␉␉␉␉␉fadt_mod->Checksum=256-checksum8(fadt_mod,fadt_mod->Length);␊ |
326 | ␉␉␉␉␉␉␊ |
327 | ␉␉␉␉␉␉xsdt_entries[i-dropoffset]=(uint32_t)fadt_mod;␊ |
328 | ␊ |
329 | ␉␉␉␉␉␉DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]);␊ |
330 | ␊ |
331 | ␉␉␉␉␉␉continue;␊ |
332 | ␉␉␉␉␉}␊ |
333 | ␊ |
334 | ␉␉␉␉␉DBG("TABLE %c%c%c%c@%x,",table[0],table[1],table[2],table[3],xsdt_entries[i]);␊ |
335 | ␊ |
336 | ␉␉␉␉}␊ |
337 | ␊ |
338 | ␉␉␉␉// Correct the checksum of XSDT␊ |
339 | ␉␉␉␉xsdt_mod->Length-=8*dropoffset;␊ |
340 | ␉␉␉␉xsdt_mod->Checksum=0;␊ |
341 | ␉␉␉␉xsdt_mod->Checksum=256-checksum8(xsdt_mod,xsdt_mod->Length);␊ |
342 | ␉␉␉}␊ |
343 | ␉␉␉else␊ |
344 | ␉␉␉{␊ |
345 | ␉␉␉drop_xsdt:␊ |
346 | ␊ |
347 | ␉␉␉␉DBG("About to drop XSDT\n");␊ |
348 | ␊ |
349 | ␉␉␉␉/*FIXME: Now we just hope that if MacOS doesn't find XSDT it reverts to RSDT. ␊ |
350 | ␉␉␉␉ * A Better strategy would be to generate␊ |
351 | ␉␉␉␉ */␊ |
352 | ␊ |
353 | ␉␉␉␉rsdp_mod->XsdtAddress=0xffffffffffffffffLL;␊ |
354 | ␉␉␉␉printf("XSDT not found or XSDT incorrect\n");␊ |
355 | ␉␉␉}␊ |
356 | ␉␉}␊ |
357 | ␊ |
358 | ␉␉// Correct the checksum of RSDP ␊ |
359 | ␊ |
360 | ␉␉DBG("RSDP: Original checksum %d, ", rsdp_mod->Checksum);␊ |
361 | ␊ |
362 | ␉␉rsdp_mod->Checksum=0;␊ |
363 | ␉␉rsdp_mod->Checksum=256-checksum8(rsdp_mod,20);␊ |
364 | ␊ |
365 | ␉␉DBG("New checksum %d\n", rsdp_mod->Checksum);␊ |
366 | ␊ |
367 | ␉␉if (version)␊ |
368 | ␉␉{␊ |
369 | ␉␉␉DBG("RSDP: Original extended checksum %d", rsdp_mod->ExtendedChecksum);␊ |
370 | ␊ |
371 | ␉␉␉rsdp_mod->ExtendedChecksum=0;␊ |
372 | ␉␉␉rsdp_mod->ExtendedChecksum=256-checksum8(rsdp_mod,rsdp_mod->Length);␊ |
373 | ␊ |
374 | ␉␉␉DBG("New extended checksum %d\n", rsdp_mod->ExtendedChecksum);␊ |
375 | ␊ |
376 | ␉␉}␊ |
377 | ␉␉␊ |
378 | ␉␉verbose("Patched ACPI version %d DSDT\n", version+1);␊ |
379 | ␉␉if (version)␊ |
380 | ␉␉{␊ |
381 | ␉␉␉acpi20_p = (uint32_t)rsdp_mod;␊ |
382 | ␉␉␉addConfigurationTable(&gEfiAcpi20TableGuid, &acpi20_p, "ACPI_20");␊ |
383 | ␉␉}␊ |
384 | ␉␉else␊ |
385 | ␉␉{␊ |
386 | ␉␉␉acpi10_p = (uint32_t)rsdp_mod;␊ |
387 | ␉␉␉addConfigurationTable(&gEfiAcpiTableGuid, &acpi10_p, "ACPI");␊ |
388 | ␉␉}␊ |
389 | ␉}␊ |
390 | ␉#if DEBUG_DSDT␊ |
391 | ␉printf("Press a key to continue... (DEBUG_DSDT)\n");␊ |
392 | ␉getc();␊ |
393 | ␉#endif␊ |
394 | ␉return 1;␊ |
395 | }␊ |
396 | |