Changeset 77662 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg
- Timestamp:
- Mar 12, 2019 12:40:12 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129295
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 deleted
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776 /vendor/edk2/current 103735-103757,103769-103776,129194-129237
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/FrameworkSpecConformance.txt
r58466 r77662 2 2 # This file is used to document mismatches between Intel Platform Innovation Framework specification 3 3 # (http://www.intel.com/technology/framework/spec.htm) and data structures defind at IntelFrameworkPkg 4 # package in EdkII Open Source Project (https:// edk2.tianocore.org/source/browse/edk2/trunk/edk2/IntelFrameworkPkg)4 # package in EdkII Open Source Project (https://github.com/tianocore/edk2/tree/master/IntelFrameworkPkg) 5 5 ## 6 6 -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Include/Protocol/FrameworkFormCallback.h
r58466 r77662 150 150 Inconsistent with specification here: 151 151 Attributes data type has been changed from 152 UINT32 * to UINT32, because the input param ter is152 UINT32 * to UINT32, because the input parameter is 153 153 not necessary to use a pointer date type. 154 154 @param DataSize The size in bytes of the Buffer. A size of zero causes -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Include/Protocol/LegacyBios.h
r58466 r77662 10 10 environment. Reverse thunk is the code that does the opposite. 11 11 12 Copyright (c) 2007 - 201 0, Intel Corporation. All rights reserved.<BR>12 Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> 13 13 This program and the accompanying materials are licensed and made available under 14 14 the terms and conditions of the BSD License that accompanies this distribution. … … 21 21 @par Revision Reference: 22 22 This protocol is defined in Framework for EFI Compatibility Support Module spec 23 Version 0.9 7.23 Version 0.98. 24 24 25 25 **/ … … 229 229 /// 230 230 UINT8 LastPciBus; 231 232 /// 233 /// Start Address of Upper Memory Area (UMA) to be set as Read/Write. If 234 /// UmaAddress is a valid address in the shadow RAM, it also indicates that the region 235 /// from 0xC0000 to (UmaAddress - 1) can be used for Option ROM. 236 /// 237 UINT32 UmaAddress; 238 239 /// 240 /// Upper Memory Area size in bytes to be set as Read/Write. If zero, no UMA region 241 /// will be set as Read/Write (i.e. all Shadow RAM is set as Read-Only). 242 /// 243 UINT32 UmaSize; 244 245 /// 246 /// Start Address of high memory that can be used for permanent allocation. If zero, 247 /// high memory is not available for permanent allocation. 248 /// 249 UINT32 HiPermanentMemoryAddress; 250 251 /// 252 /// Size of high memory that can be used for permanent allocation in bytes. If zero, 253 /// high memory is not available for permanent allocation. 254 /// 255 UINT32 HiPermanentMemorySize; 231 256 } EFI_COMPATIBILITY16_TABLE; 232 257 … … 1173 1198 - 02 = ROM is a valid legacy ROM. 1174 1199 1175 @retval EFI_SUCCESS The Legacy Option ROM avail ible for this device1200 @retval EFI_SUCCESS The Legacy Option ROM available for this device 1176 1201 @retval EFI_UNSUPPORTED The Legacy Option ROM is not supported. 1177 1202 … … 1494 1519 }; 1495 1520 1521 // 1522 // Legacy BIOS needs to access memory in page 0 (0-4095), which is disabled if 1523 // NULL pointer detection feature is enabled. Following macro can be used to 1524 // enable/disable page 0 before/after accessing it. 1525 // 1526 #define ACCESS_PAGE0_CODE(statements) \ 1527 do { \ 1528 EFI_STATUS Status_; \ 1529 EFI_GCD_MEMORY_SPACE_DESCRIPTOR Desc_; \ 1530 \ 1531 Desc_.Attributes = 0; \ 1532 Status_ = gDS->GetMemorySpaceDescriptor (0, &Desc_); \ 1533 ASSERT_EFI_ERROR (Status_); \ 1534 if ((Desc_.Attributes & EFI_MEMORY_RP) != 0) { \ 1535 Status_ = gDS->SetMemorySpaceAttributes ( \ 1536 0, \ 1537 EFI_PAGES_TO_SIZE(1), \ 1538 Desc_.Attributes & ~(UINT64)EFI_MEMORY_RP \ 1539 ); \ 1540 ASSERT_EFI_ERROR (Status_); \ 1541 } \ 1542 \ 1543 { \ 1544 statements; \ 1545 } \ 1546 \ 1547 if ((Desc_.Attributes & EFI_MEMORY_RP) != 0) { \ 1548 Status_ = gDS->SetMemorySpaceAttributes ( \ 1549 0, \ 1550 EFI_PAGES_TO_SIZE(1), \ 1551 Desc_.Attributes \ 1552 ); \ 1553 ASSERT_EFI_ERROR (Status_); \ 1554 } \ 1555 } while (FALSE) 1556 1496 1557 extern EFI_GUID gEfiLegacyBiosProtocolGuid; 1497 1558 -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/IntelFrameworkPkg.dec
r58466 r77662 3 3 # 4 4 # This package provides definitions and libraries that comply to Intel Framework Specifications. 5 # Copyright (c) 2007 - 201 4, Intel Corporation. All rights reserved.<BR>5 # Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> 6 6 # 7 7 # This program and the accompanying materials are licensed and made available … … 18 18 PACKAGE_UNI_FILE = IntelFrameworkPkg.uni 19 19 PACKAGE_GUID = 2759ded5-bb57-4b06-af4f-c398fa552719 20 PACKAGE_VERSION = 0.9 420 PACKAGE_VERSION = 0.96 21 21 22 22 [Includes] -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/IntelFrameworkPkg.dsc
r58459 r77662 4 4 # This DSC file is used for Package Level build. 5 5 # 6 # Copyright (c) 2007 - 201 4, Intel Corporation. All rights reserved.<BR>6 # Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> 7 7 # 8 8 # This program and the accompanying materials … … 24 24 PLATFORM_NAME = IntelFramework 25 25 PLATFORM_GUID = E76EB141-6EDB-43f3-A455-EF24A79673DD 26 PLATFORM_VERSION = 0.9 426 PLATFORM_VERSION = 0.96 27 27 DSC_SPECIFICATION = 0x00010005 28 28 OUTPUT_DIRECTORY = Build/IntelFramework 29 29 SUPPORTED_ARCHITECTURES = IA32|IPF|X64|EBC|ARM 30 BUILD_TARGETS = DEBUG|RELEASE 30 BUILD_TARGETS = DEBUG|RELEASE|NOOPT 31 31 SKUID_IDENTIFIER = DEFAULT 32 32 … … 71 71 IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLibFramework.inf 72 72 73 [BuildOptions] 74 *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES 75 -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/IntelFrameworkPkg.uni
r58464 r77662 1 // /** @file1 // /** @file 2 2 // Intel Framework Package Reference Implementations 3 3 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/IntelFrameworkPkgExtra.uni
r58464 r77662 1 // /** @file1 // /** @file 2 2 // IntelFramework Package Localized Strings and Content. 3 3 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeCpuIoLibInternal.h
r58466 r77662 6 6 7 7 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> 8 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR> 9 8 10 This program and the accompanying materials 9 11 are licensed and made available under the terms and conditions of the BSD License … … 36 38 37 39 Reads the I/O port specified by Port with registers width specified by Width. 38 The read value is returned. If such operations are not supported, then ASSERT(). 40 The read value is returned. 41 39 42 This function must guarantee that all I/O read and write operations are serialized. 43 If such operations are not supported, then ASSERT(). 40 44 41 45 @param Port The base address of the I/O operation. … … 49 53 EFIAPI 50 54 IoReadWorker ( 51 IN UINTN Port,52 IN EFI_CPU_IO_PROTOCOL_WIDTH Width55 IN UINTN Port, 56 IN EFI_CPU_IO_PROTOCOL_WIDTH Width 53 57 ); 54 58 … … 57 61 58 62 Writes the I/O port specified by Port with registers width and value specified by Width 59 and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). 63 and Data respectively. Data is returned. 64 60 65 This function must guarantee that all I/O read and write operations are serialized. 66 If such operations are not supported, then ASSERT(). 61 67 62 68 @param Port The base address of the I/O operation. … … 65 71 @param Data The value to write to the I/O port. 66 72 67 @return The param ter of Data.73 @return The parameter of Data. 68 74 69 75 **/ … … 71 77 EFIAPI 72 78 IoWriteWorker ( 73 IN UINTN Port, 74 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 75 IN UINT64 Data 79 IN UINTN Port, 80 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 81 IN UINT64 Data 82 ); 83 84 /** 85 Reads registers in the EFI CPU I/O space. 86 87 Reads the I/O port specified by Port with registers width specified by Width. 88 The port is read Count times, and the read data is stored in the provided Buffer. 89 90 This function must guarantee that all I/O read and write operations are serialized. 91 If such operations are not supported, then ASSERT(). 92 93 @param Port The base address of the I/O operation. 94 The caller is responsible for aligning the Address if required. 95 @param Width The width of the I/O operation. 96 @param Count The number of times to read I/O port. 97 @param Buffer The buffer to store the read data into. 98 99 **/ 100 VOID 101 EFIAPI 102 IoReadFifoWorker ( 103 IN UINTN Port, 104 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 105 IN UINTN Count, 106 IN VOID *Buffer 107 ); 108 109 /** 110 Writes registers in the EFI CPU I/O space. 111 112 Writes the I/O port specified by Port with registers width specified by Width. 113 The port is written Count times, and the write data is retrieved from the provided Buffer. 114 115 This function must guarantee that all I/O read and write operations are serialized. 116 If such operations are not supported, then ASSERT(). 117 118 @param Port The base address of the I/O operation. 119 The caller is responsible for aligning the Address if required. 120 @param Width The width of the I/O operation. 121 @param Count The number of times to write I/O port. 122 @param Buffer The buffer to store the read data into. 123 124 **/ 125 VOID 126 EFIAPI 127 IoWriteFifoWorker ( 128 IN UINTN Port, 129 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 130 IN UINTN Count, 131 IN VOID *Buffer 76 132 ); 77 133 -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/DxeIoLibCpuIo/DxeIoLibCpuIo.uni
r58464 r77662 1 // /** @file1 // /** @file 2 2 // I/O Library implementation that uses the CPU I/O Protocol for I/O and MMIO operations. 3 3 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoLib.c
r58466 r77662 5 5 6 6 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> 7 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR> 8 7 9 This program and the accompanying materials 8 10 are licensed and made available under the terms and conditions of the BSD License … … 94 96 @param Data The value to write to the I/O port. 95 97 96 @return The param ter of Data.98 @return The parameter of Data. 97 99 98 100 **/ … … 114 116 115 117 /** 118 Reads registers in the EFI CPU I/O space. 119 120 Reads the I/O port specified by Port with registers width specified by Width. 121 The port is read Count times, and the read data is stored in the provided Buffer. 122 123 This function must guarantee that all I/O read and write operations are serialized. 124 If such operations are not supported, then ASSERT(). 125 126 @param Port The base address of the I/O operation. 127 The caller is responsible for aligning the Address if required. 128 @param Width The width of the I/O operation. 129 @param Count The number of times to read I/O port. 130 @param Buffer The buffer to store the read data into. 131 132 **/ 133 VOID 134 EFIAPI 135 IoReadFifoWorker ( 136 IN UINTN Port, 137 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 138 IN UINTN Count, 139 IN VOID *Buffer 140 ) 141 { 142 EFI_STATUS Status; 143 144 Status = mCpuIo->Io.Read (mCpuIo, Width, Port, Count, Buffer); 145 ASSERT_EFI_ERROR (Status); 146 } 147 148 /** 149 Writes registers in the EFI CPU I/O space. 150 151 Writes the I/O port specified by Port with registers width specified by Width. 152 The port is written Count times, and the write data is retrieved from the provided Buffer. 153 154 This function must guarantee that all I/O read and write operations are serialized. 155 If such operations are not supported, then ASSERT(). 156 157 @param Port The base address of the I/O operation. 158 The caller is responsible for aligning the Address if required. 159 @param Width The width of the I/O operation. 160 @param Count The number of times to write I/O port. 161 @param Buffer The buffer to store the read data into. 162 163 **/ 164 VOID 165 EFIAPI 166 IoWriteFifoWorker ( 167 IN UINTN Port, 168 IN EFI_CPU_IO_PROTOCOL_WIDTH Width, 169 IN UINTN Count, 170 IN VOID *Buffer 171 ) 172 { 173 EFI_STATUS Status; 174 175 Status = mCpuIo->Io.Write (mCpuIo, Width, Port, Count, Buffer); 176 ASSERT_EFI_ERROR (Status); 177 } 178 179 /** 116 180 Reads memory-mapped registers in the EFI system memory space. 117 181 … … 403 467 404 468 /** 469 Reads an 8-bit I/O port fifo into a block of memory. 470 471 Reads the 8-bit I/O fifo port specified by Port. 472 The port is read Count times, and the read data is 473 stored in the provided Buffer. 474 475 This function must guarantee that all I/O read and write operations are 476 serialized. 477 478 If 8-bit I/O port operations are not supported, then ASSERT(). 479 480 @param Port The I/O port to read. 481 @param Count The number of times to read I/O port. 482 @param Buffer The buffer to store the read data into. 483 484 **/ 485 VOID 486 EFIAPI 487 IoReadFifo8 ( 488 IN UINTN Port, 489 IN UINTN Count, 490 OUT VOID *Buffer 491 ) 492 { 493 IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer); 494 } 495 496 /** 497 Writes a block of memory into an 8-bit I/O port fifo. 498 499 Writes the 8-bit I/O fifo port specified by Port. 500 The port is written Count times, and the write data is 501 retrieved from the provided Buffer. 502 503 This function must guarantee that all I/O write and write operations are 504 serialized. 505 506 If 8-bit I/O port operations are not supported, then ASSERT(). 507 508 @param Port The I/O port to write. 509 @param Count The number of times to write I/O port. 510 @param Buffer The buffer to retrieve the write data from. 511 512 **/ 513 VOID 514 EFIAPI 515 IoWriteFifo8 ( 516 IN UINTN Port, 517 IN UINTN Count, 518 IN VOID *Buffer 519 ) 520 { 521 IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer); 522 } 523 524 /** 525 Reads a 16-bit I/O port fifo into a block of memory. 526 527 Reads the 16-bit I/O fifo port specified by Port. 528 The port is read Count times, and the read data is 529 stored in the provided Buffer. 530 531 This function must guarantee that all I/O read and write operations are 532 serialized. 533 534 If 16-bit I/O port operations are not supported, then ASSERT(). 535 536 @param Port The I/O port to read. 537 @param Count The number of times to read I/O port. 538 @param Buffer The buffer to store the read data into. 539 540 **/ 541 VOID 542 EFIAPI 543 IoReadFifo16 ( 544 IN UINTN Port, 545 IN UINTN Count, 546 OUT VOID *Buffer 547 ) 548 { 549 // 550 // Make sure Port is aligned on a 16-bit boundary. 551 // 552 ASSERT ((Port & 1) == 0); 553 IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer); 554 } 555 556 /** 557 Writes a block of memory into a 16-bit I/O port fifo. 558 559 Writes the 16-bit I/O fifo port specified by Port. 560 The port is written Count times, and the write data is 561 retrieved from the provided Buffer. 562 563 This function must guarantee that all I/O write and write operations are 564 serialized. 565 566 If 16-bit I/O port operations are not supported, then ASSERT(). 567 568 @param Port The I/O port to write. 569 @param Count The number of times to write I/O port. 570 @param Buffer The buffer to retrieve the write data from. 571 572 **/ 573 VOID 574 EFIAPI 575 IoWriteFifo16 ( 576 IN UINTN Port, 577 IN UINTN Count, 578 IN VOID *Buffer 579 ) 580 { 581 // 582 // Make sure Port is aligned on a 16-bit boundary. 583 // 584 ASSERT ((Port & 1) == 0); 585 IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer); 586 } 587 588 /** 589 Reads a 32-bit I/O port fifo into a block of memory. 590 591 Reads the 32-bit I/O fifo port specified by Port. 592 The port is read Count times, and the read data is 593 stored in the provided Buffer. 594 595 This function must guarantee that all I/O read and write operations are 596 serialized. 597 598 If 32-bit I/O port operations are not supported, then ASSERT(). 599 600 @param Port The I/O port to read. 601 @param Count The number of times to read I/O port. 602 @param Buffer The buffer to store the read data into. 603 604 **/ 605 VOID 606 EFIAPI 607 IoReadFifo32 ( 608 IN UINTN Port, 609 IN UINTN Count, 610 OUT VOID *Buffer 611 ) 612 { 613 // 614 // Make sure Port is aligned on a 32-bit boundary. 615 // 616 ASSERT ((Port & 3) == 0); 617 IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer); 618 } 619 620 /** 621 Writes a block of memory into a 32-bit I/O port fifo. 622 623 Writes the 32-bit I/O fifo port specified by Port. 624 The port is written Count times, and the write data is 625 retrieved from the provided Buffer. 626 627 This function must guarantee that all I/O write and write operations are 628 serialized. 629 630 If 32-bit I/O port operations are not supported, then ASSERT(). 631 632 @param Port The I/O port to write. 633 @param Count The number of times to write I/O port. 634 @param Buffer The buffer to retrieve the write data from. 635 636 **/ 637 VOID 638 EFIAPI 639 IoWriteFifo32 ( 640 IN UINTN Port, 641 IN UINTN Count, 642 IN VOID *Buffer 643 ) 644 { 645 // 646 // Make sure Port is aligned on a 32-bit boundary. 647 // 648 ASSERT ((Port & 3) == 0); 649 IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer); 650 } 651 652 /** 405 653 Reads an 8-bit MMIO register. 406 654 -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/DxeSmmDriverEntryPoint/DxeSmmDriverEntryPoint.uni
r58464 r77662 1 // /** @file1 // /** @file 2 2 // Framework SMM driver entry point library. 3 3 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.uni
r58464 r77662 1 // /** @file1 // /** @file 2 2 // Library to abstract Framework extensions that conflict with UEFI 2.0 Specification. 3 3 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c
r58466 r77662 6 6 and print messages on the console output and standard error devices. 7 7 8 Copyright (c) 2006 - 20 08, Intel Corporation. All rights reserved.<BR>8 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 9 9 This program and the accompanying materials 10 10 are licensed and made available under the terms and conditions of the BSD License … … 281 281 282 282 return Status; 283 } 284 285 /** 286 Signals an event group by placing a new event in the group temporarily and 287 signaling it. 288 289 @param[in] EventGroup Supplies the unique identifier of the event 290 group to signal. 291 292 @retval EFI_SUCCESS The event group was signaled successfully. 293 @retval EFI_INVALID_PARAMETER EventGroup is NULL. 294 @return Error codes that report problems about event 295 creation or signaling. 296 **/ 297 EFI_STATUS 298 EFIAPI 299 EfiEventGroupSignal ( 300 IN CONST EFI_GUID *EventGroup 301 ) 302 { 303 EFI_STATUS Status; 304 EFI_EVENT Event; 305 306 if (EventGroup == NULL) { 307 return EFI_INVALID_PARAMETER; 308 } 309 310 Status = gBS->CreateEventEx ( 311 EVT_NOTIFY_SIGNAL, 312 TPL_CALLBACK, 313 EfiEventEmptyFunction, 314 NULL, 315 EventGroup, 316 &Event 317 ); 318 if (EFI_ERROR (Status)) { 319 return Status; 320 } 321 322 Status = gBS->SignalEvent (Event); 323 gBS->CloseEvent (Event); 324 325 return Status; 326 } 327 328 /** 329 An empty function that can be used as NotifyFunction parameter of 330 CreateEvent() or CreateEventEx(). 331 332 @param Event Event whose notification function is being invoked. 333 @param Context The pointer to the notification function's context, 334 which is implementation-dependent. 335 336 **/ 337 VOID 338 EFIAPI 339 EfiEventEmptyFunction ( 340 IN EFI_EVENT Event, 341 IN VOID *Context 342 ) 343 { 283 344 } 284 345 … … 1278 1339 } 1279 1340 1341 /** 1342 Returns the status whether get the variable success. The function retrieves 1343 variable through the UEFI Runtime Service GetVariable(). The 1344 returned buffer is allocated using AllocatePool(). The caller is responsible 1345 for freeing this buffer with FreePool(). 1346 1347 If Name is NULL, then ASSERT(). 1348 If Guid is NULL, then ASSERT(). 1349 If Value is NULL, then ASSERT(). 1350 1351 @param[in] Name The pointer to a Null-terminated Unicode string. 1352 @param[in] Guid The pointer to an EFI_GUID structure 1353 @param[out] Value The buffer point saved the variable info. 1354 @param[out] Size The buffer size of the variable. 1355 1356 @return EFI_OUT_OF_RESOURCES Allocate buffer failed. 1357 @return EFI_SUCCESS Find the specified variable. 1358 @return Others Errors Return errors from call to gRT->GetVariable. 1359 1360 **/ 1361 EFI_STATUS 1362 EFIAPI 1363 GetVariable2 ( 1364 IN CONST CHAR16 *Name, 1365 IN CONST EFI_GUID *Guid, 1366 OUT VOID **Value, 1367 OUT UINTN *Size OPTIONAL 1368 ) 1369 { 1370 EFI_STATUS Status; 1371 UINTN BufferSize; 1372 1373 ASSERT (Name != NULL && Guid != NULL && Value != NULL); 1374 1375 // 1376 // Try to get the variable size. 1377 // 1378 BufferSize = 0; 1379 *Value = NULL; 1380 if (Size != NULL) { 1381 *Size = 0; 1382 } 1383 1384 Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value); 1385 if (Status != EFI_BUFFER_TOO_SMALL) { 1386 return Status; 1387 } 1388 1389 // 1390 // Allocate buffer to get the variable. 1391 // 1392 *Value = AllocatePool (BufferSize); 1393 ASSERT (*Value != NULL); 1394 if (*Value == NULL) { 1395 return EFI_OUT_OF_RESOURCES; 1396 } 1397 1398 // 1399 // Get the variable data. 1400 // 1401 Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value); 1402 if (EFI_ERROR (Status)) { 1403 FreePool(*Value); 1404 *Value = NULL; 1405 } 1406 1407 if (Size != NULL) { 1408 *Size = BufferSize; 1409 } 1410 1411 return Status; 1412 } 1413 1414 /** 1415 Returns a pointer to an allocated buffer that contains the contents of a 1416 variable retrieved through the UEFI Runtime Service GetVariable(). This 1417 function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. 1418 The returned buffer is allocated using AllocatePool(). The caller is 1419 responsible for freeing this buffer with FreePool(). 1420 1421 If Name is NULL, then ASSERT(). 1422 If Value is NULL, then ASSERT(). 1423 1424 @param[in] Name The pointer to a Null-terminated Unicode string. 1425 @param[out] Value The buffer point saved the variable info. 1426 @param[out] Size The buffer size of the variable. 1427 1428 @return EFI_OUT_OF_RESOURCES Allocate buffer failed. 1429 @return EFI_SUCCESS Find the specified variable. 1430 @return Others Errors Return errors from call to gRT->GetVariable. 1431 1432 **/ 1433 EFI_STATUS 1434 EFIAPI 1435 GetEfiGlobalVariable2 ( 1436 IN CONST CHAR16 *Name, 1437 OUT VOID **Value, 1438 OUT UINTN *Size OPTIONAL 1439 ) 1440 { 1441 return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size); 1442 } 1280 1443 1281 1444 /** … … 1416 1579 } 1417 1580 1581 /** 1582 Returns an array of protocol instance that matches the given protocol. 1583 1584 @param[in] Protocol Provides the protocol to search for. 1585 @param[out] NoProtocols The number of protocols returned in Buffer. 1586 @param[out] Buffer A pointer to the buffer to return the requested 1587 array of protocol instances that match Protocol. 1588 The returned buffer is allocated using 1589 EFI_BOOT_SERVICES.AllocatePool(). The caller is 1590 responsible for freeing this buffer with 1591 EFI_BOOT_SERVICES.FreePool(). 1592 1593 @retval EFI_SUCCESS The array of protocols was returned in Buffer, 1594 and the number of protocols in Buffer was 1595 returned in NoProtocols. 1596 @retval EFI_NOT_FOUND No protocols found. 1597 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the 1598 matching results. 1599 @retval EFI_INVALID_PARAMETER Protocol is NULL. 1600 @retval EFI_INVALID_PARAMETER NoProtocols is NULL. 1601 @retval EFI_INVALID_PARAMETER Buffer is NULL. 1602 1603 **/ 1604 EFI_STATUS 1605 EFIAPI 1606 EfiLocateProtocolBuffer ( 1607 IN EFI_GUID *Protocol, 1608 OUT UINTN *NoProtocols, 1609 OUT VOID ***Buffer 1610 ) 1611 { 1612 EFI_STATUS Status; 1613 UINTN NoHandles; 1614 EFI_HANDLE *HandleBuffer; 1615 UINTN Index; 1616 1617 // 1618 // Check input parameters 1619 // 1620 if (Protocol == NULL || NoProtocols == NULL || Buffer == NULL) { 1621 return EFI_INVALID_PARAMETER; 1622 } 1623 1624 // 1625 // Initialze output parameters 1626 // 1627 *NoProtocols = 0; 1628 *Buffer = NULL; 1629 1630 // 1631 // Retrieve the array of handles that support Protocol 1632 // 1633 Status = gBS->LocateHandleBuffer ( 1634 ByProtocol, 1635 Protocol, 1636 NULL, 1637 &NoHandles, 1638 &HandleBuffer 1639 ); 1640 if (EFI_ERROR (Status)) { 1641 return Status; 1642 } 1643 1644 // 1645 // Allocate array of protocol instances 1646 // 1647 Status = gBS->AllocatePool ( 1648 EfiBootServicesData, 1649 NoHandles * sizeof (VOID *), 1650 (VOID **)Buffer 1651 ); 1652 if (EFI_ERROR (Status)) { 1653 // 1654 // Free the handle buffer 1655 // 1656 gBS->FreePool (HandleBuffer); 1657 return EFI_OUT_OF_RESOURCES; 1658 } 1659 ZeroMem (*Buffer, NoHandles * sizeof (VOID *)); 1660 1661 // 1662 // Lookup Protocol on each handle in HandleBuffer to fill in the array of 1663 // protocol instances. Handle case where protocol instance was present when 1664 // LocateHandleBuffer() was called, but is not present when HandleProtocol() 1665 // is called. 1666 // 1667 for (Index = 0, *NoProtocols = 0; Index < NoHandles; Index++) { 1668 Status = gBS->HandleProtocol ( 1669 HandleBuffer[Index], 1670 Protocol, 1671 &((*Buffer)[*NoProtocols]) 1672 ); 1673 if (!EFI_ERROR (Status)) { 1674 (*NoProtocols)++; 1675 } 1676 } 1677 1678 // 1679 // Free the handle buffer 1680 // 1681 gBS->FreePool (HandleBuffer); 1682 1683 // 1684 // Make sure at least one protocol instance was found 1685 // 1686 if (*NoProtocols == 0) { 1687 gBS->FreePool (*Buffer); 1688 *Buffer = NULL; 1689 return EFI_NOT_FOUND; 1690 } 1691 1692 return EFI_SUCCESS; 1693 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibInternal.h
r48674 r77662 2 2 Internal include file for UefiLib. 3 3 4 Copyright (c) 2007 - 20 08, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c
r58466 r77662 3 3 Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE 4 4 5 Copyright (c) 2007 - 201 2, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR> 6 6 This program and the accompanying materials 7 7 are licensed and made available under the terms and conditions of the BSD License … … 475 475 ASSERT (UgaDraw!= NULL); 476 476 477 Blt->Image.Bitmap = AllocateZeroPool (Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); 477 // 478 // Ensure Width * Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow. 479 // 480 if (Blt->Width > DivU64x32 (MAX_UINTN, Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) { 481 goto Error; 482 } 483 484 Blt->Image.Bitmap = AllocateZeroPool ((UINT32) Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); 478 485 ASSERT (Blt->Image.Bitmap != NULL); 479 486 … … 755 762 } 756 763 757 BufferToReturn = Allocate ZeroPool(SizeRequired);764 BufferToReturn = AllocatePool(SizeRequired); 758 765 759 766 if (BufferToReturn == NULL) { 760 767 return NULL; 768 } else { 769 BufferToReturn[0] = L'\0'; 761 770 } 762 771 763 772 if (String != NULL) { 764 StrCpy (BufferToReturn, String);773 StrCpyS(BufferToReturn, SizeRequired / sizeof(CHAR16), String); 765 774 } 766 775 -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiNotTiano.c
r58466 r77662 21 21 22 22 #include "UefiLibInternal.h" 23 24 /**25 An empty function to pass error checking of CreateEventEx ().26 27 This empty function ensures that EVT_NOTIFY_SIGNAL_ALL is error28 checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.29 30 @param Event Event whose notification function is being invoked.31 @param Context Pointer to the notification function's context,32 which is implementation-dependent.33 34 **/35 VOID36 EFIAPI37 InternalEmptyFuntion (38 IN EFI_EVENT Event,39 IN VOID *Context40 )41 {42 return;43 }44 23 45 24 /** … … 67 46 return EfiCreateEventLegacyBootEx ( 68 47 TPL_CALLBACK, 69 InternalEmptyFuntion,48 EfiEventEmptyFunction, 70 49 NULL, 71 50 LegacyBootEvent … … 157 136 return EfiCreateEventReadyToBootEx ( 158 137 TPL_CALLBACK, 159 InternalEmptyFuntion,138 EfiEventEmptyFunction, 160 139 NULL, 161 140 ReadyToBootEvent -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/PeiHobLibFramework/HobLib.c
r58466 r77662 6 6 to implement HobLib BuildCvHob() API. 7 7 8 Copyright (c) 2007 - 201 4, Intel Corporation. All rights reserved.<BR>8 Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR> 9 9 This program and the accompanying materials 10 10 are licensed and made available under the terms and conditions of the BSD License … … 477 477 478 478 /** 479 Check FV alignment. 480 481 @param BaseAddress The base address of the Firmware Volume. 482 @param Length The size of the Firmware Volume in bytes. 483 484 @retval TRUE FvImage buffer is at its required alignment. 485 @retval FALSE FvImage buffer is not at its required alignment. 486 487 **/ 488 BOOLEAN 489 InternalCheckFvAlignment ( 490 IN EFI_PHYSICAL_ADDRESS BaseAddress, 491 IN UINT64 Length 492 ) 493 { 494 EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader; 495 UINT32 FvAlignment; 496 497 FvAlignment = 0; 498 FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress; 499 500 // 501 // If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first byte of the volume 502 // can be aligned on any power-of-two boundary. A weakly aligned volume can not be moved from 503 // its initial linked location and maintain its alignment. 504 // 505 if ((FwVolHeader->Attributes & EFI_FVB2_WEAK_ALIGNMENT) != EFI_FVB2_WEAK_ALIGNMENT) { 506 // 507 // Get FvHeader alignment 508 // 509 FvAlignment = 1 << ((FwVolHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16); 510 // 511 // FvAlignment must be greater than or equal to 8 bytes of the minimum FFS alignment value. 512 // 513 if (FvAlignment < 8) { 514 FvAlignment = 8; 515 } 516 if ((UINTN)BaseAddress % FvAlignment != 0) { 517 // 518 // FvImage buffer is not at its required alignment. 519 // 520 DEBUG (( 521 DEBUG_ERROR, 522 "Unaligned FvImage found at 0x%lx:0x%lx, the required alignment is 0x%x\n", 523 BaseAddress, 524 Length, 525 FvAlignment 526 )); 527 return FALSE; 528 } 529 } 530 531 return TRUE; 532 } 533 534 /** 479 535 Builds a Firmware Volume HOB. 480 536 … … 484 540 485 541 If there is no additional space for HOB creation, then ASSERT(). 542 If the FvImage buffer is not at its required alignment, then ASSERT(). 486 543 487 544 @param BaseAddress The base address of the Firmware Volume. … … 498 555 EFI_HOB_FIRMWARE_VOLUME *Hob; 499 556 557 if (!InternalCheckFvAlignment (BaseAddress, Length)) { 558 ASSERT (FALSE); 559 return; 560 } 561 500 562 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME)); 501 563 if (Hob == NULL) { … … 515 577 516 578 If there is no additional space for HOB creation, then ASSERT(). 579 If the FvImage buffer is not at its required alignment, then ASSERT(). 517 580 518 581 @param BaseAddress The base address of the Firmware Volume. … … 533 596 EFI_HOB_FIRMWARE_VOLUME2 *Hob; 534 597 598 if (!InternalCheckFvAlignment (BaseAddress, Length)) { 599 ASSERT (FALSE); 600 return; 601 } 602 535 603 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME2)); 536 604 if (Hob == NULL) { … … 545 613 546 614 /** 615 Builds a EFI_HOB_TYPE_FV3 HOB. 616 617 This function builds a EFI_HOB_TYPE_FV3 HOB. 618 It can only be invoked during PEI phase; 619 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. 620 621 If there is no additional space for HOB creation, then ASSERT(). 622 If the FvImage buffer is not at its required alignment, then ASSERT(). 623 624 @param BaseAddress The base address of the Firmware Volume. 625 @param Length The size of the Firmware Volume in bytes. 626 @param AuthenticationStatus The authentication status. 627 @param ExtractedFv TRUE if the FV was extracted as a file within 628 another firmware volume. FALSE otherwise. 629 @param FvName The name of the Firmware Volume. 630 Valid only if IsExtractedFv is TRUE. 631 @param FileName The name of the file. 632 Valid only if IsExtractedFv is TRUE. 633 634 **/ 635 VOID 636 EFIAPI 637 BuildFv3Hob ( 638 IN EFI_PHYSICAL_ADDRESS BaseAddress, 639 IN UINT64 Length, 640 IN UINT32 AuthenticationStatus, 641 IN BOOLEAN ExtractedFv, 642 IN CONST EFI_GUID *FvName, OPTIONAL 643 IN CONST EFI_GUID *FileName OPTIONAL 644 ) 645 { 646 EFI_HOB_FIRMWARE_VOLUME3 *Hob; 647 648 if (!InternalCheckFvAlignment (BaseAddress, Length)) { 649 ASSERT (FALSE); 650 return; 651 } 652 653 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV3, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME3)); 654 if (Hob == NULL) { 655 return; 656 } 657 658 Hob->BaseAddress = BaseAddress; 659 Hob->Length = Length; 660 Hob->AuthenticationStatus = AuthenticationStatus; 661 Hob->ExtractedFv = ExtractedFv; 662 if (ExtractedFv) { 663 CopyGuid (&Hob->FvName, FvName); 664 CopyGuid (&Hob->FileName, FileName); 665 } 666 } 667 668 /** 547 669 Builds a Capsule Volume HOB. 548 670 -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/PeiHobLibFramework/PeiHobLib.uni
r58464 r77662 1 // /** @file1 // /** @file 2 2 // Instance of HOB Library using PEI Services. 3 3 // -
trunk/src/VBox/Devices/EFI/FirmwareNew/IntelFrameworkPkg/Library/PeiSmbusLibSmbusPpi/PeiSmbusLibSmbusPpi.uni
r58464 r77662 1 // /** @file1 // /** @file 2 2 // SMBUS library that layers on top of the SMBUS PPI. 3 3 //
Note:
See TracChangeset
for help on using the changeset viewer.