- Timestamp:
- Oct 12, 2015 11:05:13 AM (9 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware/Config.kmk
r58173 r58175 140 140 MdeModulePkg/Core/Pei/PeiMain/$(VBOX_EFI_DEBUG_DIR)/PeiCore \ 141 141 MdeModulePkg/Core/RuntimeDxe/RuntimeDxe/$(VBOX_EFI_DEBUG_DIR)/RuntimeDxe \ 142 MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe/$(VBOX_EFI_DEBUG_DIR)/AcpiPlatform \ 142 143 MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe/$(VBOX_EFI_DEBUG_DIR)/AcpiTableDxe \ 143 144 MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe/$(VBOX_EFI_DEBUG_DIR)/CapsuleRuntimeDxe \ … … 178 179 UefiCpuPkg/CpuDxe/CpuDxe/$(VBOX_EFI_DEBUG_DIR)/CpuDxe \ 179 180 UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe/$(VBOX_EFI_DEBUG_DIR)/CpuIo2Dxe \ 180 VBoxPkg/AcpiPlatformDxe/AcpiPlatformDxe/$(VBOX_EFI_DEBUG_DIR)/AcpiPlatform \181 181 VBoxPkg/PartitionDxe/PartitionDxe/$(VBOX_EFI_DEBUG_DIR)/PartitionDxe \ 182 182 OvmfPkg/PlatformPei/PlatformPei/$(VBOX_EFI_DEBUG_DIR)/PlatformPei \ -
trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c
r48674 r58175 154 154 155 155 156 #ifdef VBOX 157 158 # define ACPI_RSD_PTR SIGNATURE_64('R', 'S', 'D', ' ', 'P', 'T', 'R', ' ') 159 # define EBDA_BASE (0x9FC0 << 4) 160 161 VOID * 162 FindAcpiRsdPtr(VOID) 163 { 164 UINTN Address; 165 UINTN Index; 166 167 // 168 // First Search 0x0e0000 - 0x0fffff for RSD Ptr 169 // 170 for (Address = 0xe0000; Address < 0xfffff; Address += 0x10) { 171 if (*(UINT64 *)(Address) == ACPI_RSD_PTR) { 172 return (VOID *)Address; 173 } 174 } 175 176 // 177 // Search EBDA 178 // 179 Address = EBDA_BASE; 180 for (Index = 0; Index < 0x400 ; Index += 16) { 181 if (*(UINT64 *)(Address + Index) == ACPI_RSD_PTR) { 182 return (VOID *)Address; 183 } 184 } 185 return NULL; 186 } 187 188 VOID *FindSignature(VOID* Start, UINT32 Signature, BOOLEAN NoChecksum) 189 { 190 UINT8 *Ptr = (UINT8*)Start; 191 UINT32 Count = 0x10000; // 16 pages 192 193 while (Count-- > 0) { 194 if ( *(UINT32*)Ptr == Signature 195 && ((EFI_ACPI_DESCRIPTION_HEADER *)Ptr)->Length <= Count 196 && (NoChecksum || 197 CalculateCheckSum8(Ptr, ((EFI_ACPI_DESCRIPTION_HEADER *)Ptr)->Length) == 0 198 )) { 199 return Ptr; 200 } 201 202 Ptr++; 203 } 204 return NULL; 205 } 206 207 VOID 208 FillSysTablesInfo(VOID **Tables, UINT32 TablesSize) 209 { 210 UINT32 Table = 0; 211 EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *RsdPtr; 212 VOID *TablesPage; 213 #define FLAG_OPTIONAL 1<<0 214 #define FLAG_NO_CHECKSUM 1<<1 215 static struct { 216 UINT32 Signature; 217 UINT32 Flags; 218 CHAR8* Name; 219 } TableInfo[] = { 220 // MADT, optional 221 { SIGNATURE_32('A', 'P', 'I', 'C'), FLAG_OPTIONAL, "MADT"}, 222 // FACP (also called FADT) 223 { SIGNATURE_32('F', 'A', 'C', 'P'), 0, "FADT"}, 224 // FACS, according 5.2.9 of ACPI v2. spec FACS doesn't have checksum field 225 { SIGNATURE_32('F', 'A', 'C', 'S'), FLAG_NO_CHECKSUM, "FACS"}, 226 // DSDT 227 { SIGNATURE_32('D', 'S', 'D', 'T'), 0, "DSDT"}, 228 // SSDT 229 { SIGNATURE_32('S', 'S', 'D', 'T'), FLAG_OPTIONAL, "SSDT"}, 230 // HPET 231 { SIGNATURE_32('H', 'P', 'E', 'T'), FLAG_OPTIONAL, "HPET"}, 232 // MCFG 233 { SIGNATURE_32('M', 'C', 'F', 'G'), FLAG_OPTIONAL, "MCFG"} 234 }; 235 UINT32 Index; 236 237 RsdPtr = (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER*)FindAcpiRsdPtr(); 238 ASSERT(RsdPtr != NULL); 239 TablesPage = (VOID*)(UINTN)((RsdPtr->RsdtAddress) & ~0xfff); 240 DEBUG((DEBUG_INFO, "TablesPage:%p\n", TablesPage)); 241 242 for (Index = 0; Index < sizeof TableInfo / sizeof TableInfo[0]; Index++) 243 { 244 VOID *Ptr = FindSignature(TablesPage, TableInfo[Index].Signature, 245 (BOOLEAN)((TableInfo[Index].Flags & FLAG_NO_CHECKSUM) != 0)); 246 if (TableInfo[Index].Signature == SIGNATURE_32('F', 'A', 'C', 'P')) 247 { 248 // we actually have 2 FADTs, see https://xtracker.innotek.de/index.php?bug=4082 249 Ptr = FindSignature((UINT8*)Ptr+32, SIGNATURE_32('F', 'A', 'C', 'P'), FALSE); 250 } 251 if (!(TableInfo[Index].Flags & FLAG_OPTIONAL)) 252 { 253 if (!Ptr) 254 DEBUG((EFI_D_ERROR, "%a: isn't optional %p\n", TableInfo[Index].Name, Ptr)); 255 ASSERT(Ptr != NULL); 256 } 257 DEBUG((EFI_D_ERROR, "%a: %p\n", TableInfo[Index].Name, Ptr)); 258 if (Ptr) 259 Tables[Table++] = Ptr; 260 } 261 262 #if 0 263 // RSDT 264 ASSERT(Table < TablesSize); 265 Tables[Table] = FindSignature(TablesPage, SIGNATURE_32('R', 'S', 'D', 'T')); 266 DEBUG ((EFI_D_ERROR, "RSDT: %p\n", Tables[Table])); 267 ASSERT(Tables[Table] != NULL); 268 Table++; 269 270 // XSDT 271 ASSERT(Table < TablesSize); 272 Tables[Table] = FindSignature(TablesPage, SIGNATURE_32('X', 'S', 'D', 'T')); 273 DEBUG ((EFI_D_ERROR, "XSDT: %p\n", Tables[Table])); 274 ASSERT(Tables[Table] != NULL); 275 Table++; 276 #endif 277 278 DEBUG((DEBUG_INFO, "We found %d tables from %d\n", Table, TablesSize)); 279 Tables[Table] = NULL; 280 } 281 282 #endif /* VBOX */ 283 284 156 285 /** 157 286 Entrypoint of Acpi Platform driver. … … 174 303 EFI_STATUS Status; 175 304 EFI_ACPI_TABLE_PROTOCOL *AcpiTable; 305 #ifdef VBOX 306 VOID *VBoxTables[10]; 307 #else 176 308 EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol; 309 #endif 177 310 INTN Instance; 178 311 EFI_ACPI_COMMON_HEADER *CurrentTable; 179 312 UINTN TableHandle; 313 #ifndef VBOX 180 314 UINT32 FvStatus; 315 #endif 181 316 UINTN TableSize; 182 317 UINTN Size; … … 194 329 } 195 330 331 #ifdef VBOX 332 // 333 // VBOX already has tables prepared in memory - just reuse them. 334 // 335 FillSysTablesInfo(VBoxTables, sizeof(VBoxTables)/sizeof(VBoxTables[0])); 336 #else 337 // 196 338 // 197 339 // Locate the firmware volume protocol … … 201 343 return EFI_ABORTED; 202 344 } 345 #endif 203 346 // 204 347 // Read tables from the storage file. … … 206 349 while (Status == EFI_SUCCESS) { 207 350 351 #ifdef VBOX 352 CurrentTable = (EFI_ACPI_COMMON_HEADER *)VBoxTables[Instance]; 353 Status = (CurrentTable == NULL) ? EFI_NOT_FOUND : EFI_SUCCESS; 354 if (CurrentTable) { 355 Size = CurrentTable->Length; 356 DEBUG((EFI_D_ERROR, "adding %p %d\n", CurrentTable, Size)); 357 } 358 #else 208 359 Status = FwVol->ReadSection ( 209 360 FwVol, … … 215 366 &FvStatus 216 367 ); 368 #endif 217 369 if (!EFI_ERROR(Status)) { 218 370 // … … 222 374 223 375 TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length; 376 #ifdef VBOX 377 DEBUG((DEBUG_INFO, "Size:%d, TableSize:%d\n", Size, TableSize)); 378 #endif 224 379 ASSERT (Size >= TableSize); 225 380 … … 239 394 ); 240 395 396 #ifndef VBOX /* In case we're reading ACPI tables from memory we haven't 397 allocated this memory, so it isn't required to free it */ 241 398 // 242 399 // Free memory allocated by ReadSection … … 247 404 return EFI_ABORTED; 248 405 } 406 #endif 249 407 250 408 // -
trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgIa32.dsc
r58173 r58175 471 471 # 472 472 MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf 473 !ifndef $(VBOX)474 473 MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf 474 !ifndef $(VBOX) 475 475 OvmfPkg/AcpiTables/AcpiTables.inf 476 !else477 VBoxPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf478 476 !endif 479 477 -
trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgIa32.fdf
r58173 r58175 234 234 235 235 INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf 236 !ifndef $(VBOX)237 236 INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf 237 !ifndef $(VBOX) 238 238 INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf 239 !else240 INF VBoxPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf241 239 !endif 242 240 -
trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgX64.dsc
r58173 r58175 471 471 # 472 472 MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf 473 !ifndef $(VBOX)474 473 MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf 474 !ifndef $(VBOX) 475 475 OvmfPkg/AcpiTables/AcpiTables.inf 476 !else477 VBoxPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf478 476 !endif 479 477 -
trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/OvmfPkgX64.fdf
r58173 r58175 232 232 233 233 INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf 234 !ifndef $(VBOX)235 234 INF MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf 235 !ifndef $(VBOX) 236 236 INF RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf 237 !else238 INF VBoxPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf239 237 !endif 240 238
Note:
See TracChangeset
for help on using the changeset viewer.