summaryrefslogtreecommitdiff
path: root/EdkModulePkg
diff options
context:
space:
mode:
authorlhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524>2008-12-31 16:26:40 +0000
committerlhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524>2008-12-31 16:26:40 +0000
commit808def96aa4589fba9c2d0ea55837754a3b7a4f7 (patch)
tree0ea221c59abb2474c694e7ab5bd61006be77e47e /EdkModulePkg
parent9216450d1143056a50a5f916984a2d7faf590488 (diff)
downloadedk2-808def96aa4589fba9c2d0ea55837754a3b7a4f7.zip
edk2-808def96aa4589fba9c2d0ea55837754a3b7a4f7.tar.gz
edk2-808def96aa4589fba9c2d0ea55837754a3b7a4f7.tar.bz2
Retiring the ANT/JAVA build and removing the older EDK II packages that required ANT/JAVA.
Last Ant/Java build was r7166 Developers requiring the Java/Ant packages should checkout the branch from: https://edk2.tianocore.org/svn/edk2/branches/AntJava git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7168 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg')
-rw-r--r--EdkModulePkg/Application/HelloWorld/HelloWorld.c27
-rw-r--r--EdkModulePkg/Application/HelloWorld/HelloWorld.msa56
-rw-r--r--EdkModulePkg/Blank.padbin12 -> 0 bytes
-rw-r--r--EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c2141
-rw-r--r--EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.h814
-rw-r--r--EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.msa77
-rw-r--r--EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/ComponentName.c120
-rw-r--r--EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.c316
-rw-r--r--EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.h291
-rw-r--r--EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.msa76
-rw-r--r--EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430UgaDraw.c867
-rw-r--r--EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/ComponentName.c183
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/ComponentName.c179
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/Debug.c55
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c2679
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h2918
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.msa78
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciMem.c771
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciReg.c1730
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c3240
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.c210
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.h80
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverConfiguration.c321
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverDiagnostics.c199
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c2624
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/atapi.c2140
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.c1824
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.h1328
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.c1377
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.h392
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.msa116
-rw-r--r--EdkModulePkg/Bus/Pci/IdeBus/Dxe/idedata.h893
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.c133
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.h87
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa186
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.c207
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.h175
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c1351
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.h477
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c175
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.h108
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.c2168
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.h628
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.c2254
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.h598
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c463
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.h264
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c1980
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.h773
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.c2885
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.h385
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.c564
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.h119
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.c83
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.h48
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.c2314
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.h740
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.c197
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.h107
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c332
-rw-r--r--EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.h270
-rw-r--r--EdkModulePkg/Bus/Pci/Uhci/Dxe/ComponentName.c179
-rw-r--r--EdkModulePkg/Bus/Pci/Uhci/Dxe/Uhci.msa78
-rw-r--r--EdkModulePkg/Bus/Pci/Uhci/Dxe/uhchlp.c4206
-rw-r--r--EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c4236
-rw-r--r--EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h2995
-rw-r--r--EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Decode.c1647
-rw-r--r--EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.c3756
-rw-r--r--EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.h668
-rw-r--r--EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Init.c1088
-rw-r--r--EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi.msa96
-rw-r--r--EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi32.h359
-rw-r--r--EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ComponentName.c134
-rw-r--r--EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.c727
-rw-r--r--EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.h312
-rw-r--r--EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.msa78
-rw-r--r--EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ComponentName.c180
-rw-r--r--EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c2354
-rw-r--r--EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.h774
-rw-r--r--EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.msa72
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBot/Dxe/ComponentName.c179
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBot/Dxe/UsbBot.msa81
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBot/Dxe/bot.c962
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBot/Dxe/bot.h129
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/ComponentName.c133
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/UsbBus.msa96
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/hub.c507
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/hub.h138
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/usb.c825
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c3719
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.h1203
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbio.c1183
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbutil.c554
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbutil.h94
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/Cbi0.c1025
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/ComponentName.c179
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/UsbCbi0.msa84
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/cbi.h94
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/ComponentName.c181
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/UsbCbi1.msa84
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi.h94
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c850
-rw-r--r--EdkModulePkg/Bus/Usb/UsbKb/Dxe/ComponentName.c194
-rw-r--r--EdkModulePkg/Bus/Usb/UsbKb/Dxe/UsbKb.msa94
-rw-r--r--EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c730
-rw-r--r--EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.h150
-rw-r--r--EdkModulePkg/Bus/Usb/UsbKb/Dxe/keyboard.c1150
-rw-r--r--EdkModulePkg/Bus/Usb/UsbKb/Dxe/keyboard.h127
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/ComponentName.c133
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.c684
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.h112
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.msa75
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageData.h395
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c1542
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.h111
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMouse/Dxe/ComponentName.c195
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMouse/Dxe/UsbMouse.msa83
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMouse/Dxe/mousehid.c395
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMouse/Dxe/mousehid.h84
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMouse/Dxe/usbmouse.c988
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMouse/Dxe/usbmouse.h134
-rw-r--r--EdkModulePkg/Core/Dxe/DebugImageInfo.h126
-rw-r--r--EdkModulePkg/Core/Dxe/Dispatcher/Dispatcher.c1170
-rw-r--r--EdkModulePkg/Core/Dxe/Dispatcher/dependency.c452
-rw-r--r--EdkModulePkg/Core/Dxe/DxeMain.h2762
-rw-r--r--EdkModulePkg/Core/Dxe/DxeMain.msa243
-rw-r--r--EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c996
-rw-r--r--EdkModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c297
-rw-r--r--EdkModulePkg/Core/Dxe/Event/event.c757
-rw-r--r--EdkModulePkg/Core/Dxe/Event/execdata.c51
-rw-r--r--EdkModulePkg/Core/Dxe/Event/timer.c388
-rw-r--r--EdkModulePkg/Core/Dxe/Event/tpl.c198
-rw-r--r--EdkModulePkg/Core/Dxe/Exec.h208
-rw-r--r--EdkModulePkg/Core/Dxe/FwVol/Ffs.c266
-rw-r--r--EdkModulePkg/Core/Dxe/FwVol/FwVol.c547
-rw-r--r--EdkModulePkg/Core/Dxe/FwVol/FwVolAttrib.c99
-rw-r--r--EdkModulePkg/Core/Dxe/FwVol/FwVolRead.c516
-rw-r--r--EdkModulePkg/Core/Dxe/FwVol/FwVolWrite.c60
-rw-r--r--EdkModulePkg/Core/Dxe/FwVolBlock.h324
-rw-r--r--EdkModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c598
-rw-r--r--EdkModulePkg/Core/Dxe/FwVolDriver.h466
-rw-r--r--EdkModulePkg/Core/Dxe/Gcd/gcd.c2496
-rw-r--r--EdkModulePkg/Core/Dxe/Hand/DriverSupport.c845
-rw-r--r--EdkModulePkg/Core/Dxe/Hand/Notify.c333
-rw-r--r--EdkModulePkg/Core/Dxe/Hand/handle.c1700
-rw-r--r--EdkModulePkg/Core/Dxe/Hand/locate.c733
-rw-r--r--EdkModulePkg/Core/Dxe/Image.h379
-rw-r--r--EdkModulePkg/Core/Dxe/Image/Image.c1390
-rw-r--r--EdkModulePkg/Core/Dxe/Image/ImageFile.c499
-rw-r--r--EdkModulePkg/Core/Dxe/Library.h407
-rw-r--r--EdkModulePkg/Core/Dxe/Library/Library.c613
-rw-r--r--EdkModulePkg/Core/Dxe/Mem/Page.c1656
-rw-r--r--EdkModulePkg/Core/Dxe/Mem/memdata.c41
-rw-r--r--EdkModulePkg/Core/Dxe/Mem/pool.c613
-rw-r--r--EdkModulePkg/Core/Dxe/Misc/DebugImageInfo.c260
-rw-r--r--EdkModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c225
-rw-r--r--EdkModulePkg/Core/Dxe/Misc/SetWatchdogTimer.c83
-rw-r--r--EdkModulePkg/Core/Dxe/Misc/Stall.c82
-rw-r--r--EdkModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c1342
-rw-r--r--EdkModulePkg/Core/Dxe/gcd.h51
-rw-r--r--EdkModulePkg/Core/Dxe/hand.h337
-rw-r--r--EdkModulePkg/Core/Dxe/imem.h227
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/DxeIpl.dxs28
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/DxeIpl.h112
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/DxeIpl.msa168
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/DxeLoad.c995
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c131
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/Ia32/ImageRead.c112
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/Ia32/VirtualMemory.c168
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/Ia32/VirtualMemory.h107
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c72
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/Ipf/ImageRead.c72
-rw-r--r--EdkModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c60
-rw-r--r--EdkModulePkg/Core/Pei/BootMode/BootMode.c106
-rw-r--r--EdkModulePkg/Core/Pei/Dependency/dependency.c262
-rw-r--r--EdkModulePkg/Core/Pei/Dependency/dependency.h38
-rw-r--r--EdkModulePkg/Core/Pei/Dispatcher/Dispatcher.c534
-rw-r--r--EdkModulePkg/Core/Pei/Dispatcher/Stack.c50
-rw-r--r--EdkModulePkg/Core/Pei/FwVol/FwVol.c474
-rw-r--r--EdkModulePkg/Core/Pei/Hob/Hob.c192
-rw-r--r--EdkModulePkg/Core/Pei/Image/Image.c267
-rw-r--r--EdkModulePkg/Core/Pei/Ipf/IpfCpuCore.i93
-rw-r--r--EdkModulePkg/Core/Pei/Ipf/IpfCpuCore.s192
-rw-r--r--EdkModulePkg/Core/Pei/Ipf/IpfPeiMain.h52
-rw-r--r--EdkModulePkg/Core/Pei/Ipf/Stack.c58
-rw-r--r--EdkModulePkg/Core/Pei/Ipf/SwitchToCacheMode.c71
-rw-r--r--EdkModulePkg/Core/Pei/Memory/MemoryServices.c321
-rw-r--r--EdkModulePkg/Core/Pei/PeiMain.h1142
-rw-r--r--EdkModulePkg/Core/Pei/PeiMain.msa117
-rw-r--r--EdkModulePkg/Core/Pei/PeiMain/PeiMain.c246
-rw-r--r--EdkModulePkg/Core/Pei/Ppi/Ppi.c658
-rw-r--r--EdkModulePkg/Core/Pei/Reset/Reset.c68
-rw-r--r--EdkModulePkg/Core/Pei/Security/Security.c194
-rw-r--r--EdkModulePkg/Core/Pei/StatusCode/StatusCode.c95
-rw-r--r--EdkModulePkg/EdkModulePkg.fpd22035
-rw-r--r--EdkModulePkg/EdkModulePkg.spd1296
-rw-r--r--EdkModulePkg/Include/Common/CapsuleName.h28
-rw-r--r--EdkModulePkg/Include/Common/DecompressLibraryHob.h47
-rw-r--r--EdkModulePkg/Include/Common/FlashMap.h112
-rw-r--r--EdkModulePkg/Include/Common/Variable.h87
-rw-r--r--EdkModulePkg/Include/Common/WorkingBlockHeader.h47
-rw-r--r--EdkModulePkg/Include/EdkDxe.h98
-rw-r--r--EdkModulePkg/Include/EdkDxeCore.h53
-rw-r--r--EdkModulePkg/Include/EdkPeiCore.h38
-rw-r--r--EdkModulePkg/Include/EdkPeim.h58
-rw-r--r--EdkModulePkg/Include/Guid/AlternateFvBlock.h32
-rw-r--r--EdkModulePkg/Include/Guid/Bmp.h62
-rw-r--r--EdkModulePkg/Include/Guid/BootState.h36
-rw-r--r--EdkModulePkg/Include/Guid/CapsuleVendor.h35
-rw-r--r--EdkModulePkg/Include/Guid/CompatibleMemoryTested.h32
-rw-r--r--EdkModulePkg/Include/Guid/ConsoleInDevice.h29
-rw-r--r--EdkModulePkg/Include/Guid/ConsoleOutDevice.h29
-rw-r--r--EdkModulePkg/Include/Guid/ExtendedSalGuid.h386
-rw-r--r--EdkModulePkg/Include/Guid/FlashMapHob.h33
-rw-r--r--EdkModulePkg/Include/Guid/GenericPlatformVariable.h27
-rw-r--r--EdkModulePkg/Include/Guid/HotPlugDevice.h28
-rw-r--r--EdkModulePkg/Include/Guid/MemoryStatusCodeRecord.h54
-rw-r--r--EdkModulePkg/Include/Guid/MemoryTypeInformation.h35
-rw-r--r--EdkModulePkg/Include/Guid/MiniShellFile.h30
-rw-r--r--EdkModulePkg/Include/Guid/PciHotplugDevice.h30
-rw-r--r--EdkModulePkg/Include/Guid/PciOptionRomTable.h46
-rw-r--r--EdkModulePkg/Include/Guid/PeiPeCoffLoader.h71
-rw-r--r--EdkModulePkg/Include/Guid/PeiPerformanceHob.h56
-rw-r--r--EdkModulePkg/Include/Guid/PrimaryConsoleInDevice.h29
-rw-r--r--EdkModulePkg/Include/Guid/PrimaryConsoleOutDevice.h28
-rw-r--r--EdkModulePkg/Include/Guid/PrimaryStandardErrorDevice.h28
-rw-r--r--EdkModulePkg/Include/Guid/ShellFile.h31
-rw-r--r--EdkModulePkg/Include/Guid/StandardErrorDevice.h29
-rw-r--r--EdkModulePkg/Include/Guid/StatusCode.h33
-rw-r--r--EdkModulePkg/Include/Guid/StatusCodeCallerId.h30
-rw-r--r--EdkModulePkg/Include/Guid/SystemNvDataGuid.h45
-rw-r--r--EdkModulePkg/Include/Library/CustomDecompressLib.h42
-rw-r--r--EdkModulePkg/Include/Library/EdkDxeSalLib.h139
-rw-r--r--EdkModulePkg/Include/Library/EdkFvbServiceLib.h250
-rw-r--r--EdkModulePkg/Include/Library/EdkGenericBdsLib.h395
-rw-r--r--EdkModulePkg/Include/Library/EdkGenericPlatformBdsLib.h140
-rw-r--r--EdkModulePkg/Include/Library/EdkGraphicsLib.h185
-rw-r--r--EdkModulePkg/Include/Library/EdkIfrSupportLib.h1270
-rw-r--r--EdkModulePkg/Include/Library/EdkPeCoffLoaderLib.h32
-rw-r--r--EdkModulePkg/Include/Library/EdkScsiLib.h299
-rw-r--r--EdkModulePkg/Include/Library/EdkUsbLib.h373
-rw-r--r--EdkModulePkg/Include/Library/ExtendedSalLib.h439
-rw-r--r--EdkModulePkg/Include/Library/OemHookStatusCodeLib.h73
-rw-r--r--EdkModulePkg/Include/Library/PciIncompatibleDeviceSupportLib.h134
-rw-r--r--EdkModulePkg/Include/Library/SerialPortLib.h76
-rw-r--r--EdkModulePkg/Include/Library/TianoDecompressLib.h42
-rw-r--r--EdkModulePkg/Include/Ppi/BaseMemoryTest.h56
-rw-r--r--EdkModulePkg/Include/Ppi/FlashMap.h52
-rw-r--r--EdkModulePkg/Include/Ppi/PeiInMemory.h29
-rw-r--r--EdkModulePkg/Include/Ppi/StatusCodeMemory.h53
-rw-r--r--EdkModulePkg/Include/Protocol/AcpiS3Save.h61
-rw-r--r--EdkModulePkg/Include/Protocol/Capsule.h39
-rw-r--r--EdkModulePkg/Include/Protocol/ConsoleControl.h121
-rw-r--r--EdkModulePkg/Include/Protocol/CustomizedDecompress.h137
-rw-r--r--EdkModulePkg/Include/Protocol/DebugAssert.h89
-rw-r--r--EdkModulePkg/Include/Protocol/DebugLevel.h40
-rw-r--r--EdkModulePkg/Include/Protocol/DiskInfo.h179
-rw-r--r--EdkModulePkg/Include/Protocol/EdkDecompress.h137
-rw-r--r--EdkModulePkg/Include/Protocol/ExtendedSalBootService.h113
-rw-r--r--EdkModulePkg/Include/Protocol/FaultTolerantWriteLite.h88
-rw-r--r--EdkModulePkg/Include/Protocol/FvbExtension.h53
-rw-r--r--EdkModulePkg/Include/Protocol/GenericMemoryTest.h156
-rw-r--r--EdkModulePkg/Include/Protocol/IsaAcpi.h177
-rw-r--r--EdkModulePkg/Include/Protocol/IsaIo.h174
-rw-r--r--EdkModulePkg/Include/Protocol/LoadPe32Image.h68
-rw-r--r--EdkModulePkg/Include/Protocol/OEMBadging.h79
-rw-r--r--EdkModulePkg/Include/Protocol/PciHotPlugRequest.h54
-rw-r--r--EdkModulePkg/Include/Protocol/Performance.h166
-rw-r--r--EdkModulePkg/Include/Protocol/Print.h50
-rw-r--r--EdkModulePkg/Include/Protocol/PxeDhcp4.h350
-rw-r--r--EdkModulePkg/Include/Protocol/PxeDhcp4CallBack.h85
-rw-r--r--EdkModulePkg/Include/Protocol/ScsiIo.h241
-rw-r--r--EdkModulePkg/Include/Protocol/UgaIo.h233
-rw-r--r--EdkModulePkg/Include/Protocol/UgaSplash.h29
-rw-r--r--EdkModulePkg/Include/Protocol/usbatapi.h83
-rw-r--r--EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.c80
-rw-r--r--EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.msa40
-rw-r--r--EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.c840
-rw-r--r--EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.msa50
-rw-r--r--EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLibInternals.h224
-rw-r--r--EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.c106
-rw-r--r--EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.msa62
-rw-r--r--EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c637
-rw-r--r--EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa90
-rw-r--r--EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.c107
-rw-r--r--EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.msa62
-rw-r--r--EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.c106
-rw-r--r--EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.msa62
-rw-r--r--EdkModulePkg/Library/DxeDebugLibSerialPort/DebugLib.c243
-rw-r--r--EdkModulePkg/Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.msa76
-rw-r--r--EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c250
-rw-r--r--EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.msa62
-rw-r--r--EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/EdkDxePeCoffLoaderFromHobLib.msa48
-rw-r--r--EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/PeCoff.c38
-rw-r--r--EdkModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.msa48
-rw-r--r--EdkModulePkg/Library/EdkDxePrintLib/PrintLib.c145
-rw-r--r--EdkModulePkg/Library/EdkDxeRuntimeSalLib/EdkDxeRuntimeSalLib.msa55
-rw-r--r--EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/AsmEsalServiceLib.s149
-rw-r--r--EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/EsalServiceLib.c280
-rw-r--r--EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa49
-rw-r--r--EdkModulePkg/Library/EdkDxeSalLib/Ipf/AsmEsalServiceLib.s149
-rw-r--r--EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c246
-rw-r--r--EdkModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa81
-rw-r--r--EdkModulePkg/Library/EdkFvbServiceLib/Fvb.h24
-rw-r--r--EdkModulePkg/Library/EdkFvbServiceLib/Ia32/Fvb.c611
-rw-r--r--EdkModulePkg/Library/EdkFvbServiceLib/Ipf/Fvb.c349
-rw-r--r--EdkModulePkg/Library/EdkFvbServiceLib/x64/Fvb.c611
-rw-r--r--EdkModulePkg/Library/EdkGenericBdsLib/BdsBoot.c1102
-rw-r--r--EdkModulePkg/Library/EdkGenericBdsLib/BdsConnect.c357
-rw-r--r--EdkModulePkg/Library/EdkGenericBdsLib/BdsConsole.c387
-rw-r--r--EdkModulePkg/Library/EdkGenericBdsLib/BdsMisc.c1089
-rw-r--r--EdkModulePkg/Library/EdkGenericBdsLib/DevicePath.c1027
-rw-r--r--EdkModulePkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa116
-rw-r--r--EdkModulePkg/Library/EdkGenericBdsLib/Ipf/ShadowRom.c48
-rw-r--r--EdkModulePkg/Library/EdkGenericBdsLib/Performance.c399
-rw-r--r--EdkModulePkg/Library/EdkGenericBdsLib/Performance.h55
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.dxs26
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.h44
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsBoot.c103
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsEntry.c362
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.c1605
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.h83
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Bm.vfr495
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmLib.c627
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmString.unibin36240 -> 0 bytes
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.c1315
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.h1159
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootOption.c1685
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/ConsoleOption.c840
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Data.c324
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FE.vfr138
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FileExplorer.c339
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FormGuid.h32
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/UpdatePage.c1267
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Variable.c1278
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.c355
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.h50
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerStrings.unibin3948 -> 0 bytes
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerVfr.Vfr55
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/Capsules.c213
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.c497
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.h59
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerStrings.unibin4232 -> 0 bytes
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerVfr.Vfr75
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/EdkGenericPlatformBdsLib.msa230
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.c901
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.h94
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageStrings.unibin9938 -> 0 bytes
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageVfr.Vfr159
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.c435
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.h34
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/MemoryTest.c430
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.c136
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.h59
-rw-r--r--EdkModulePkg/Library/EdkGenericPlatformBdsLib/Strings.unibin7870 -> 0 bytes
-rw-r--r--EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa75
-rw-r--r--EdkModulePkg/Library/EdkGraphicsLib/Graphics.c865
-rw-r--r--EdkModulePkg/Library/EdkIfrSupportLib/EdkIfrSupportLib.msa81
-rw-r--r--EdkModulePkg/Library/EdkIfrSupportLib/IfrCommon.c1000
-rw-r--r--EdkModulePkg/Library/EdkIfrSupportLib/IfrOnTheFly.c972
-rw-r--r--EdkModulePkg/Library/EdkIfrSupportLib/IfrOpCodeCreation.c613
-rw-r--r--EdkModulePkg/Library/EdkIfrSupportLib/IfrVariable.c488
-rw-r--r--EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/EdkOemHookStatusCodeLibNull.msa40
-rw-r--r--EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/OemHookStatusCodeLibNull.c73
-rw-r--r--EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.c388
-rw-r--r--EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa44
-rw-r--r--EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h209
-rw-r--r--EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c112
-rw-r--r--EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa44
-rw-r--r--EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLibInternals.h48
-rw-r--r--EdkModulePkg/Library/EdkScsiLib/EdkScsiLib.msa43
-rw-r--r--EdkModulePkg/Library/EdkScsiLib/ScsiLib.c648
-rw-r--r--EdkModulePkg/Library/EdkSerialPortLibNull/EdkSerialPortLibNull.msa40
-rw-r--r--EdkModulePkg/Library/EdkSerialPortLibNull/SerialPortLibNull.c73
-rw-r--r--EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c173
-rw-r--r--EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeService.c454
-rw-r--r--EdkModulePkg/Library/EdkUefiRuntimeLib/EdkUefiRuntimeLib.msa65
-rw-r--r--EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c238
-rw-r--r--EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c552
-rw-r--r--EdkModulePkg/Library/EdkUefiRuntimeLib/RuntimeLibInternal.h25
-rw-r--r--EdkModulePkg/Library/EdkUsbLib/EdkUsbLib.msa44
-rw-r--r--EdkModulePkg/Library/EdkUsbLib/UsbDxeLib.c699
-rw-r--r--EdkModulePkg/Library/EdkUsbLib/hid.c459
-rw-r--r--EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c332
-rw-r--r--EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa76
-rw-r--r--EdkModulePkg/Logo/Logo.bmpbin12446 -> 0 bytes
-rw-r--r--EdkModulePkg/Logo/Logo.msa34
-rw-r--r--EdkModulePkg/Universal/Capsule/RuntimeDxe/Capsule.c68
-rw-r--r--EdkModulePkg/Universal/Capsule/RuntimeDxe/Capsule.dxs26
-rw-r--r--EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleRuntime.msa97
-rw-r--r--EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleService.c231
-rw-r--r--EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleService.h47
-rw-r--r--EdkModulePkg/Universal/ConPlatform/Dxe/ComponentName.c141
-rw-r--r--EdkModulePkg/Universal/ConPlatform/Dxe/ComponentName.h44
-rw-r--r--EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.c868
-rw-r--r--EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.h127
-rw-r--r--EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.msa135
-rw-r--r--EdkModulePkg/Universal/Console/ConSplitter/Dxe/ComponentName.c480
-rw-r--r--EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c3386
-rw-r--r--EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.h662
-rw-r--r--EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.msa126
-rw-r--r--EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c1215
-rw-r--r--EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/ComponentName.c139
-rw-r--r--EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/ComponentName.h51
-rw-r--r--EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c1821
-rw-r--r--EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.h187
-rw-r--r--EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa92
-rw-r--r--EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/LaffStd.c290
-rw-r--r--EdkModulePkg/Universal/Console/Terminal/Dxe/ComponentName.c195
-rw-r--r--EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c1187
-rw-r--r--EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.h549
-rw-r--r--EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.msa129
-rw-r--r--EdkModulePkg/Universal/Console/Terminal/Dxe/TerminalConIn.c1177
-rw-r--r--EdkModulePkg/Universal/Console/Terminal/Dxe/TerminalConOut.c995
-rw-r--r--EdkModulePkg/Universal/Console/Terminal/Dxe/ansi.c68
-rw-r--r--EdkModulePkg/Universal/Console/Terminal/Dxe/vtutf8.c270
-rw-r--r--EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.c660
-rw-r--r--EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.dxs25
-rw-r--r--EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.h122
-rw-r--r--EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.msa71
-rw-r--r--EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.c163
-rw-r--r--EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.dxs26
-rw-r--r--EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.msa73
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c151
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.dxs25
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa96
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/AsmFuncs.S270
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/AsmFuncs.asm548
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c449
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.h319
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/ipf/AsmFuncs.s1389
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/ipf/Ds64Macros.i85
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/ipf/common.i34
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c586
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.h319
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/x64/AsmFuncs.S57
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/x64/AsmFuncs.asm654
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c446
-rw-r--r--EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.h322
-rw-r--r--EdkModulePkg/Universal/Debugger/Debugport/Dxe/ComponentName.c108
-rw-r--r--EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.c812
-rw-r--r--EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.dxs25
-rw-r--r--EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.h172
-rw-r--r--EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.msa108
-rw-r--r--EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c109
-rw-r--r--EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h407
-rw-r--r--EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa117
-rw-r--r--EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c2370
-rw-r--r--EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c1498
-rw-r--r--EdkModulePkg/Universal/DevicePath/Dxe/DevicePathUtilities.c211
-rw-r--r--EdkModulePkg/Universal/Disk/DiskIo/Dxe/ComponentName.c139
-rw-r--r--EdkModulePkg/Universal/Disk/DiskIo/Dxe/DiskIo.h117
-rw-r--r--EdkModulePkg/Universal/Disk/DiskIo/Dxe/DiskIo.msa75
-rw-r--r--EdkModulePkg/Universal/Disk/DiskIo/Dxe/diskio.c729
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/ComponentName.c139
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c285
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c785
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c328
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.c701
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.h184
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.msa101
-rw-r--r--EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/English.msa55
-rw-r--r--EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.c478
-rw-r--r--EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.h102
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/Ebc.dxs25
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/Ebc.msa81
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.c4564
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.h323
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/EbcInt.c1172
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/EbcInt.h264
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcLowLevel.S54
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcLowLevel.asm163
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcSupport.c545
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcLowLevel.s197
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcSupport.c869
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcSupport.h56
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/x64/EbcLowLevel.S144
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/x64/EbcLowLevel.asm154
-rw-r--r--EdkModulePkg/Universal/Ebc/Dxe/x64/EbcSupport.c619
-rw-r--r--EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.c849
-rw-r--r--EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.dxs25
-rw-r--r--EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.msa75
-rw-r--r--EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariableIpf.msa75
-rw-r--r--EdkModulePkg/Universal/EmuVariable/RuntimeDxe/InitVariable.c214
-rw-r--r--EdkModulePkg/Universal/EmuVariable/RuntimeDxe/Ipf/InitVariable.c180
-rw-r--r--EdkModulePkg/Universal/EmuVariable/RuntimeDxe/Variable.h151
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c931
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.dxs27
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h675
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.msa105
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwMisc.c530
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwWorkSpace.c561
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/Ia32/Ia32FtwMisc.c403
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/Ipf/IpfFtwMisc.c143
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/x64/x64FtwMisc.c140
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.c230
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.dxs26
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.h94
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.msa67
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/GuidedSection.c61
-rw-r--r--EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/GuidedSection.h52
-rw-r--r--EdkModulePkg/Universal/GenericMemoryTest/Dxe/Common.h59
-rw-r--r--EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.c214
-rw-r--r--EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.dxs25
-rw-r--r--EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.h65
-rw-r--r--EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.msa65
-rw-r--r--EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.c151
-rw-r--r--EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.h87
-rw-r--r--EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.msa56
-rw-r--r--EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.c299
-rw-r--r--EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.dxs26
-rw-r--r--EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.h36
-rw-r--r--EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.msa65
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/BC.msa117
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/Bc.h547
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/ComponentName.c139
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/bc.c2403
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/dhcp.h632
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/hton.h42
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/ip.h742
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_arp.c611
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_dhcp.c3308
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_igmp.c462
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_ip.c853
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_mtftp.c2379
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_udp.c564
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_loadfile.c1657
-rw-r--r--EdkModulePkg/Universal/Network/PxeBc/Dxe/tftp.h153
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/ComponentName.c144
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/Dhcp4.msa85
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4.c294
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4.h357
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4InitSelect.c762
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Release.c246
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4RenewRebind.c408
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Run.c191
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Setup.c258
-rw-r--r--EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/support.c1101
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/ComponentName.c139
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/SNP.msa100
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/Snp.h449
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/WaitForPacket.c100
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/callback.c610
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/get_status.c194
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/initialize.c237
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/mcast_ip_to_mac.c168
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/nvdata.c184
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive.c256
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive_filters.c414
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/reset.c125
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/shutdown.c152
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/snp.c1209
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/start.c191
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/station_address.c249
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/statistics.c193
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/stop.c120
-rw-r--r--EdkModulePkg/Universal/Network/Snp32_64/Dxe/transmit.c398
-rw-r--r--EdkModulePkg/Universal/PCD/Dxe/Pcd.c732
-rw-r--r--EdkModulePkg/Universal/PCD/Dxe/Pcd.dxs26
-rw-r--r--EdkModulePkg/Universal/PCD/Dxe/Pcd.msa99
-rw-r--r--EdkModulePkg/Universal/PCD/Dxe/Service.c1153
-rw-r--r--EdkModulePkg/Universal/PCD/Dxe/Service.h480
-rw-r--r--EdkModulePkg/Universal/PCD/Pei/Pcd.c796
-rw-r--r--EdkModulePkg/Universal/PCD/Pei/Pcd.dxs25
-rw-r--r--EdkModulePkg/Universal/PCD/Pei/Pcd.msa129
-rw-r--r--EdkModulePkg/Universal/PCD/Pei/Service.c728
-rw-r--r--EdkModulePkg/Universal/PCD/Pei/Service.h457
-rw-r--r--EdkModulePkg/Universal/Runtime/RuntimeDxe/Crc32.c147
-rw-r--r--EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.c508
-rw-r--r--EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.dxs25
-rw-r--r--EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.h168
-rw-r--r--EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.msa87
-rw-r--r--EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.c156
-rw-r--r--EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.dxs26
-rw-r--r--EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.h47
-rw-r--r--EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.msa56
-rw-r--r--EdkModulePkg/Universal/StatusCode/Dxe/Common/DxeStatusCodeCommon.c228
-rw-r--r--EdkModulePkg/Universal/StatusCode/Dxe/Common/StatusCode.dxs25
-rw-r--r--EdkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c334
-rw-r--r--EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c155
-rw-r--r--EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h238
-rw-r--r--EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.msa182
-rw-r--r--EdkModulePkg/Universal/StatusCode/Dxe/Ipf/DxeStatusCodeIpf.c354
-rw-r--r--EdkModulePkg/Universal/StatusCode/Dxe/Ipf/StatusCode.dxs26
-rw-r--r--EdkModulePkg/Universal/StatusCode/Dxe/RtMemoryStatusCodeWorker.c120
-rw-r--r--EdkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c223
-rw-r--r--EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c151
-rw-r--r--EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c146
-rw-r--r--EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.h139
-rw-r--r--EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa111
-rw-r--r--EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c169
-rw-r--r--EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.c593
-rw-r--r--EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.dxs26
-rw-r--r--EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.h60
-rw-r--r--EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.msa101
-rw-r--r--EdkModulePkg/Universal/UserInterface/DriverSample/Inventory.vfr123
-rw-r--r--EdkModulePkg/Universal/UserInterface/DriverSample/InventoryStrings.unibin8302 -> 0 bytes
-rw-r--r--EdkModulePkg/Universal/UserInterface/DriverSample/NVDataStruc.h62
-rw-r--r--EdkModulePkg/Universal/UserInterface/DriverSample/Vfr.vfr622
-rw-r--r--EdkModulePkg/Universal/UserInterface/DriverSample/VfrStrings.unibin35590 -> 0 bytes
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Fonts.c266
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Forms.c1577
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.c407
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.dxs25
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.h302
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.msa87
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Keyboard.c43
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Package.c673
-rw-r--r--EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Strings.c1271
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Boolean.c1367
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Colors.h54
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/InputHandler.c1570
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Presentation.c1485
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Print.c293
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Print.h39
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/ProcessOptions.c1687
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Setup.c2219
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Setup.h504
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/SetupBrowser.msa102
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/SetupBrowserStr.unibin11028 -> 0 bytes
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c3150
-rw-r--r--EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.h435
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Ebc/VarMachine.h19
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Ia32/VarMachine.h19
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Ipf/VarMachine.h20
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c57
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Variable.c519
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Variable.dxs27
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Variable.h184
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/Variable.msa76
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/VariableWorker.c63
-rw-r--r--EdkModulePkg/Universal/Variable/Pei/x64/VarMachine.h18
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/InitVariable.c214
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/Ipf/InitVariable.c180
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/IpfVariable.dxs27
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c1476
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.dxs27
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.h153
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.msa108
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/VariableIpf.msa108
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/reclaim.c241
-rw-r--r--EdkModulePkg/Universal/Variable/RuntimeDxe/reclaim.h45
-rw-r--r--EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.c311
-rw-r--r--EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.dxs26
-rw-r--r--EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.h62
-rw-r--r--EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.msa61
646 files changed, 0 insertions, 294761 deletions
diff --git a/EdkModulePkg/Application/HelloWorld/HelloWorld.c b/EdkModulePkg/Application/HelloWorld/HelloWorld.c
deleted file mode 100644
index 8a29989..0000000
--- a/EdkModulePkg/Application/HelloWorld/HelloWorld.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/** @file
- This simple application just print a "UEFI Hello World!" to the UEFI Console.
-
- Copyright (c) 2006 - 2007, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-EFI_STATUS
-EFIAPI
-UefiMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-
-{
-
- Print ((CHAR16 *)L"UEFI Hello World!\n");
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Application/HelloWorld/HelloWorld.msa b/EdkModulePkg/Application/HelloWorld/HelloWorld.msa
deleted file mode 100644
index f58eddd..0000000
--- a/EdkModulePkg/Application/HelloWorld/HelloWorld.msa
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Hello_World_UEFI_Application</ModuleName>
- <ModuleType>UEFI_APPLICATION</ModuleType>
- <GuidValue>6987936E-ED34-44db-AE97-1FA5E4ED2116</GuidValue>
- <Version>1.0</Version>
- <Abstract>Sample UEFI Application Reference Module</Abstract>
- <Description>This is a shell application that will display Hello World.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>HelloWorld</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiApplicationEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>HelloWorld.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>UefiMain</ModuleEntryPoint>
- </Extern>
- </Externs>
- <ModuleBuildOptions>
- <Options>
- <Option ToolChainFamily="INTEL" ToolCode="CC">/WX-</Option>
- </Options>
- </ModuleBuildOptions>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Blank.pad b/EdkModulePkg/Blank.pad
deleted file mode 100644
index a503f7b..0000000
--- a/EdkModulePkg/Blank.pad
+++ /dev/null
Binary files differ
diff --git a/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c b/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c
deleted file mode 100644
index 96ed4d5..0000000
--- a/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.c
+++ /dev/null
@@ -1,2141 +0,0 @@
-/** @file
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "AtapiPassThru.h"
-
-///
-/// IDE registers' fixed address
-///
-static IDE_BASE_REGISTERS gAtapiIoPortRegisters[2] = {
- { 0x1f0, { 0x1f1 }, 0x1f2, 0x1f3, 0x1f4, 0x1f5, 0x1f6, { 0x1f7 }, { 0x3f6 }, 0x3f7, 0 },
- { 0x170, { 0x171 }, 0x172, 0x173, 0x174, 0x175, 0x176, { 0x177 }, { 0x376 }, 0x377, 0 }
-};
-
-static SCSI_COMMAND_SET gEndTable = { 0xff, (DATA_DIRECTION) 0xff };
-
-///
-/// This table contains all the supported ATAPI commands.
-///
-static SCSI_COMMAND_SET gSupportedATAPICommands[] = {
- { OP_INQUIRY, DataIn },
- { OP_LOAD_UNLOAD_CD, NoData },
- { OP_MECHANISM_STATUS, DataIn },
- { OP_MODE_SELECT_10, DataOut },
- { OP_MODE_SENSE_10, DataIn },
- { OP_PAUSE_RESUME, NoData },
- { OP_PLAY_AUDIO_10, DataIn },
- { OP_PLAY_AUDIO_MSF, DataIn },
- { OP_PLAY_CD, DataIn },
- { OP_PLAY_CD_MSF, DataIn },
- { OP_PREVENT_ALLOW_MEDIUM_REMOVAL,NoData },
- { OP_READ_10, DataIn },
- { OP_READ_12, DataIn },
- { OP_READ_CAPACITY, DataIn },
- { OP_READ_CD, DataIn },
- { OP_READ_CD_MSF, DataIn },
- { OP_READ_HEADER, DataIn },
- { OP_READ_SUB_CHANNEL, DataIn },
- { OP_READ_TOC, DataIn },
- { OP_REQUEST_SENSE, DataIn },
- { OP_SCAN, NoData },
- { OP_SEEK_10, NoData },
- { OP_SET_CD_SPEED, DataOut },
- { OP_STOPPLAY_SCAN, NoData },
- { OP_START_STOP_UNIT, NoData },
- { OP_TEST_UNIT_READY, NoData },
- { OP_FORMAT_UNIT, DataOut },
- { OP_READ_FORMAT_CAPACITIES, DataIn },
- { OP_VERIFY, DataOut },
- { OP_WRITE_10, DataOut },
- { OP_WRITE_12, DataOut },
- { OP_WRITE_AND_VERIFY, DataOut },
- { 0xff, (DATA_DIRECTION) 0xff }
-};
-
-static CHAR16 *gControllerNameString = (CHAR16 *) L"ATAPI Controller";
-static CHAR16 *gAtapiChannelString = (CHAR16 *) L"ATAPI Channel";
-
-EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding = {
- AtapiScsiPassThruDriverBindingSupported,
- AtapiScsiPassThruDriverBindingStart,
- AtapiScsiPassThruDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-/**
- Supported.
-
- (Standard DriverBinding Protocol Supported() function)
-
- @return EFI_STATUS
-
- @todo This - add argument and description to function comment
- @todo Controller - add argument and description to function comment
- @todo RemainingDevicePath - add argument and description to function comment
- @todo EFI_UNSUPPORTED - add return value to function comment
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE00 Pci;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Use the PCI I/O Protocol to see if Controller is a IDE Controller that
- // can be managed by this driver. Read the PCI Configuration Header
- // for this device.
- //
- Status = PciIo->Pci.Read (
- PciIo,
- EfiPciIoWidthUint32,
- 0,
- sizeof (Pci) / sizeof (UINT32),
- &Pci
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_UNSUPPORTED;
- }
-
- if (Pci.Hdr.ClassCode[2] != PCI_CLASS_MASS_STORAGE || Pci.Hdr.ClassCode[1] != PCI_CLASS_IDE) {
-
- Status = EFI_UNSUPPORTED;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-/**
- Create handles for IDE channels specified by RemainingDevicePath.
- Install SCSI Pass Thru Protocol onto each created handle.
-
- (Standard DriverBinding Protocol Start() function)
-
- @return EFI_STATUS
-
- @todo This - add argument and description to function comment
- @todo Controller - add argument and description to function comment
- @todo RemainingDevicePath - add argument and description to function comment
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
-
- PciIo = NULL;
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationEnable,
- EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- //
- // Create SCSI Pass Thru instance for the IDE channel.
- //
- Status = RegisterAtapiScsiPassThru (This, Controller, PciIo);
-
-Done:
- if (EFI_ERROR (Status)) {
- if (PciIo) {
- PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationDisable,
- EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE,
- NULL
- );
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- return Status;
-}
-
-/**
- Stop.
-
- (Standard DriverBinding Protocol Stop() function)
-
- @return EFI_STATUS
-
- @todo This - add argument and description to function comment
- @todo Controller - add argument and description to function comment
- @todo NumberOfChildren - add argument and description to function comment
- @todo ChildHandleBuffer - add argument and description to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- EFI_STATUS Status;
- EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiScsiPassThruProtocolGuid,
- (VOID **) &ScsiPassThru,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (ScsiPassThru);
-
- Status = gBS->UninstallProtocolInterface (
- Controller,
- &gEfiScsiPassThruProtocolGuid,
- &AtapiScsiPrivate->ScsiPassThru
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Release Pci Io protocol on the controller handle.
- //
- AtapiScsiPrivate->PciIo->Attributes (
- AtapiScsiPrivate->PciIo,
- EfiPciIoAttributeOperationDisable,
- EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE,
- NULL
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- gBS->FreePool (AtapiScsiPrivate);
-
- return EFI_SUCCESS;
-}
-
-/**
- Attaches SCSI Pass Thru Protocol for specified IDE channel.
-
- @param Controller: Parent device handle to the IDE channel.
- @param PciIo: PCI I/O protocol attached on the "Controller".
-
- @return EFI_SUCCESS Always returned unless installing SCSI Pass Thru Protocol failed.
-
- @todo This - add argument and description to function comment
- @todo Controller - add argument and description to function comment
- @todo PciIo - add argument and description to function comment
- @todo EFI_OUT_OF_RESOURCES - add return value to function comment
-**/
-EFI_STATUS
-RegisterAtapiScsiPassThru (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_PCI_IO_PROTOCOL *PciIo
- )
-{
- EFI_STATUS Status;
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate;
- UINT64 Attributes;
-
- AtapiScsiPrivate = AllocateZeroPool (sizeof (ATAPI_SCSI_PASS_THRU_DEV));
- if (AtapiScsiPrivate == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Attributes = EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE;
- CopyMem (AtapiScsiPrivate->ChannelName, gAtapiChannelString, sizeof (gAtapiChannelString));
-
- //
- // Enable channel
- //
- PciIo->Attributes (PciIo, EfiPciIoAttributeOperationSet, Attributes, NULL);
-
- AtapiScsiPrivate->Signature = ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE;
- AtapiScsiPrivate->Handle = Controller;
-
- //
- // will reset the IoPort inside each API function.
- //
- AtapiScsiPrivate->IoPort = gAtapiIoPortRegisters;
- AtapiScsiPrivate->PciIo = PciIo;
-
- //
- // initialize SCSI Pass Thru Protocol interface
- //
- AtapiScsiPrivate->ScsiPassThru.Mode = &AtapiScsiPrivate->ScsiPassThruMode;
- AtapiScsiPrivate->ScsiPassThru.PassThru = AtapiScsiPassThruFunction;
- AtapiScsiPrivate->ScsiPassThru.GetNextDevice = AtapiScsiPassThruGetNextDevice;
- AtapiScsiPrivate->ScsiPassThru.BuildDevicePath = AtapiScsiPassThruBuildDevicePath;
- AtapiScsiPrivate->ScsiPassThru.GetTargetLun = AtapiScsiPassThruGetTargetLun;
- AtapiScsiPrivate->ScsiPassThru.ResetChannel = AtapiScsiPassThruResetChannel;
- AtapiScsiPrivate->ScsiPassThru.ResetTarget = AtapiScsiPassThruResetTarget;
-
- //
- // Set Mode
- //
- CopyMem (AtapiScsiPrivate->ControllerName, gControllerNameString, sizeof (gControllerNameString));
-
- AtapiScsiPrivate->ScsiPassThruMode.ControllerName = AtapiScsiPrivate->ControllerName;
- AtapiScsiPrivate->ScsiPassThruMode.ChannelName = AtapiScsiPrivate->ChannelName;
- AtapiScsiPrivate->ScsiPassThruMode.AdapterId = 4;
- //
- // non-RAID SCSI controllers should set both physical and logical attributes
- //
- AtapiScsiPrivate->ScsiPassThruMode.Attributes = EFI_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL |
- EFI_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL;
- AtapiScsiPrivate->ScsiPassThruMode.IoAlign = 0;
-
- //
- // Initialize the LatestTargetId to 0xFFFFFFFF (for the GetNextDevice() call).
- //
- AtapiScsiPrivate->LatestTargetId = 0xFFFFFFFF;
- AtapiScsiPrivate->LatestLun = 0;
-
- Status = gBS->InstallProtocolInterface (
- &Controller,
- &gEfiScsiPassThruProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &AtapiScsiPrivate->ScsiPassThru
- );
- return Status;
-}
-
-/**
- Implements EFI_SCSI_PASS_THRU_PROTOCOL.PassThru() function.
-
- @param This The EFI_SCSI_PASS_THRU_PROTOCOL instance.
- @param Target The Target ID of the ATAPI device to send the SCSI
- Request Packet. To ATAPI devices attached on an IDE
- Channel, Target ID 0 indicates Master device;Target
- ID 1 indicates Slave device.
- @param Lun The LUN of the ATAPI device to send the SCSI Request
- Packet. To the ATAPI device, Lun is always 0.
- @param Packet The SCSI Request Packet to send to the ATAPI device
- specified by Target and Lun.
- @param Event If non-blocking I/O is not supported then Event is ignored,
- and blocking I/O is performed.<br>
- If Event is NULL, then blocking I/O is performed.<br>
- If Event is not NULL and non blocking I/O is supported,
- then non-blocking I/O is performed, and Event will be signaled
- when the SCSI Request Packet completes.
-
- @todo This - add argument and description to function comment
- @todo EFI_INVALID_PARAMETER - add return value to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruFunction (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
- IN UINT32 Target,
- IN UINT64 Lun,
- IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
- IN EFI_EVENT Event OPTIONAL
- )
-{
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate;
- EFI_STATUS Status;
-
- AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (This);
-
- //
- // Target is not allowed beyond MAX_TARGET_ID
- //
- if (Target > MAX_TARGET_ID) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // check the data fields in Packet parameter.
- //
- Status = CheckSCSIRequestPacket (Packet);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // If Request Packet targets at the IDE channel itself,
- // do nothing.
- //
- if (Target == This->Mode->AdapterId) {
- Packet->TransferLength = 0;
- return EFI_SUCCESS;
- }
-
- //
- // According to Target ID, reset the Atapi I/O Register mapping
- // (Target Id in [0,1] area, using gAtapiIoPortRegisters[0],
- // Target Id in [2,3] area, using gAtapiIoPortRegisters[1]
- //
- if ((Target / 2) == 0) {
- AtapiScsiPrivate->IoPort = &gAtapiIoPortRegisters[0];
- } else {
- AtapiScsiPrivate->IoPort = &gAtapiIoPortRegisters[1];
- }
-
- //
- // the ATAPI SCSI interface does not support non-blocking I/O
- // ignore the Event parameter
- //
- // Performs blocking I/O.
- //
- Status = SubmitBlockingIoCommand (AtapiScsiPrivate, Target, Packet);
- return Status;
-}
-
-/**
- Used to retrieve the list of legal Target IDs for SCSI devices
- on a SCSI channel.
-
- @param This Protocol instance pointer.
- @param Target On input, a pointer to the Target ID of a SCSI
- device present on the SCSI channel. On output,
- a pointer to the Target ID of the next SCSI device
- present on a SCSI channel. An input value of
- 0xFFFFFFFF retrieves the Target ID of the first
- SCSI device present on a SCSI channel.
- @param Lun On input, a pointer to the LUN of a SCSI device
- present on the SCSI channel. On output, a pointer
- to the LUN of the next SCSI device present on
- a SCSI channel.
-
- @retval EFI_SUCCESS The Target ID and Lun of the next SCSI device
- on the SCSI channel was returned in Target and Lun.
- @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.
- @retval EFI_INVALID_PARAMETER Target is not 0xFFFFFFFF,and Target and Lun were not
- returned on a previous call to GetNextDevice().
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruGetNextDevice (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
- IN OUT UINT32 *Target,
- IN OUT UINT64 *Lun
- )
-{
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate;
-
- //
- // Retrieve Device Private Data Structure.
- //
- AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (This);
-
- //
- // Check whether Target is valid.
- //
- if (Target == NULL || Lun == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((*Target != 0xFFFFFFFF) &&
- ((*Target != AtapiScsiPrivate->LatestTargetId) ||
- (*Lun != AtapiScsiPrivate->LatestLun))) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (*Target == MAX_TARGET_ID) {
- return EFI_NOT_FOUND;
- }
-
- if (*Target == 0xFFFFFFFF) {
- *Target = 0;
- } else {
- *Target = AtapiScsiPrivate->LatestTargetId + 1;
- }
-
- *Lun = 0;
-
- //
- // Update the LatestTargetId.
- //
- AtapiScsiPrivate->LatestTargetId = *Target;
- AtapiScsiPrivate->LatestLun = *Lun;
-
- return EFI_SUCCESS;
-
-}
-
-/**
- Used to allocate and build a device path node for a SCSI device
- on a SCSI channel. Would not build device path for a SCSI Host Controller.
-
- @param This Protocol instance pointer.
- @param Target The Target ID of the SCSI device for which
- a device path node is to be allocated and built.
- @param Lun The LUN of the SCSI device for which a device
- path node is to be allocated and built.
- @param DevicePath A pointer to a single device path node that
- describes the SCSI device specified by
- Target and Lun. This function is responsible
- for allocating the buffer DevicePath with the boot
- service AllocatePool(). It is the caller's
- responsibility to free DevicePath when the caller
- is finished with DevicePath.
-
- @retval EFI_SUCCESS The device path node that describes the SCSI device
- specified by Target and Lun was allocated and
- returned in DevicePath.
- @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does
- not exist on the SCSI channel.
- @retval EFI_INVALID_PARAMETER DevicePath is NULL.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate
- DevicePath.
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruBuildDevicePath (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
- IN UINT32 Target,
- IN UINT64 Lun,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
- )
-{
- EFI_DEV_PATH *Node;
-
- //
- // Validate parameters passed in.
- //
-
- if (DevicePath == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // can not build device path for the SCSI Host Controller.
- //
- if ((Target > (MAX_TARGET_ID - 1)) || (Lun != 0)) {
- return EFI_NOT_FOUND;
- }
-
- Node = AllocateZeroPool (sizeof (EFI_DEV_PATH));
- if (Node == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Node->DevPath.Type = MESSAGING_DEVICE_PATH;
- Node->DevPath.SubType = MSG_ATAPI_DP;
- SetDevicePathNodeLength (&Node->DevPath, sizeof (ATAPI_DEVICE_PATH));
-
- Node->Atapi.PrimarySecondary = (UINT8) (Target / 2);
- Node->Atapi.SlaveMaster = (UINT8) (Target % 2);
- Node->Atapi.Lun = (UINT16) Lun;
-
- *DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Node;
-
- return EFI_SUCCESS;
-}
-
-/**
- Used to translate a device path node to a Target ID and LUN.
-
- @param This Protocol instance pointer.
- @param DevicePath A pointer to the device path node that
- describes a SCSI device on the SCSI channel.
- @param Target A pointer to the Target ID of a SCSI device
- on the SCSI channel.
- @param Lun A pointer to the LUN of a SCSI device on
- the SCSI channel.
-
- @retval EFI_SUCCESS DevicePath was successfully translated to a
- Target ID and LUN, and they were returned
- in Target and Lun.
- @retval EFI_INVALID_PARAMETER DevicePath is NULL.
- @retval EFI_INVALID_PARAMETER Target is NULL.
- @retval EFI_INVALID_PARAMETER Lun is NULL.
- @retval EFI_UNSUPPORTED This driver does not support the device path
- node type in DevicePath.
- @retval EFI_NOT_FOUND A valid translation from DevicePath to a
- Target ID and LUN does not exist.
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruGetTargetLun (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT UINT32 *Target,
- OUT UINT64 *Lun
- )
-{
- EFI_DEV_PATH *Node;
-
- //
- // Validate parameters passed in.
- //
- if (DevicePath == NULL || Target == NULL || Lun == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check whether the DevicePath belongs to SCSI_DEVICE_PATH
- //
- if ((DevicePath->Type != MESSAGING_DEVICE_PATH) ||
- (DevicePath->SubType != MSG_ATAPI_DP) ||
- (DevicePathNodeLength(DevicePath) != sizeof(ATAPI_DEVICE_PATH))) {
- return EFI_UNSUPPORTED;
- }
-
- Node = (EFI_DEV_PATH *) DevicePath;
-
- *Target = Node->Atapi.PrimarySecondary * 2 + Node->Atapi.SlaveMaster;
- *Lun = Node->Atapi.Lun;
-
- if (*Target > (MAX_TARGET_ID - 1) || *Lun != 0) {
- return EFI_NOT_FOUND;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Resets a SCSI channel.This operation resets all the
- SCSI devices connected to the SCSI channel.
-
- @param This Protocol instance pointer.
-
- @retval EFI_SUCCESS The SCSI channel was reset.
- @retval EFI_UNSUPPORTED The SCSI channel does not support
- a channel reset operation.
- @retval EFI_DEVICE_ERROR A device error occurred while
- attempting to reset the SCSI channel.
- @retval EFI_TIMEOUT A timeout occurred while attempting
- to reset the SCSI channel.
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruResetChannel (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This
- )
-{
- UINT8 DeviceControlValue;
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate;
- UINT8 Index;
-
- AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (This);
-
- //
- // Reset both Primary channel and Secondary channel.
- // so, the IoPort pointer must point to the right I/O Register group
- //
- for (Index = 0; Index < 2; Index++) {
- //
- // Reset
- //
- AtapiScsiPrivate->IoPort = &gAtapiIoPortRegisters[Index];
-
- DeviceControlValue = 0;
- //
- // set SRST bit to initiate soft reset
- //
- DeviceControlValue |= SRST;
- //
- // disable Interrupt
- //
- DeviceControlValue |= bit (1);
- WritePortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Alt.DeviceControl,
- DeviceControlValue
- );
-
- //
- // Wait 10us
- //
- gBS->Stall (10);
-
- //
- // Clear SRST bit
- // 0xfb:1111,1011
- //
- DeviceControlValue &= 0xfb;
-
- WritePortB (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->Alt.DeviceControl, DeviceControlValue);
-
- //
- // slave device needs at most 31s to clear BSY
- //
- if (StatusWaitForBSYClear (AtapiScsiPrivate, 31000) == EFI_TIMEOUT) {
- return EFI_DEVICE_ERROR;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Resets a SCSI device that is connected to a SCSI channel.
-
- @param This Protocol instance pointer.
- @param Target The Target ID of the SCSI device to reset.
- @param Lun The LUN of the SCSI device to reset.
-
- @retval EFI_SUCCESS The SCSI device specified by Target and
- Lun was reset.
- @retval EFI_UNSUPPORTED The SCSI channel does not support a target
- reset operation.
- @retval EFI_INVALID_PARAMETER Target or Lun are invalid.
- @retval EFI_DEVICE_ERROR A device error occurred while attempting
- to reset the SCSI device specified by Target
- and Lun.
- @retval EFI_TIMEOUT A timeout occurred while attempting to reset
- the SCSI device specified by Target and Lun.
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruResetTarget (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
- IN UINT32 Target,
- IN UINT64 Lun
- )
-{
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate;
- UINT8 Command;
- UINT8 DeviceSelect;
-
- AtapiScsiPrivate = ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS (This);
-
- if (Target > MAX_TARGET_ID) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Directly return EFI_SUCCESS if want to reset the host controller
- //
- if (Target == This->Mode->AdapterId) {
- return EFI_SUCCESS;
- }
-
- //
- // According to Target ID, reset the Atapi I/O Register mapping
- // (Target Id in [0,1] area, using gAtapiIoPortRegisters[0],
- // Target Id in [2,3] area, using gAtapiIoPortRegisters[1]
- //
- if ((Target / 2) == 0) {
- AtapiScsiPrivate->IoPort = &gAtapiIoPortRegisters[0];
- } else {
- AtapiScsiPrivate->IoPort = &gAtapiIoPortRegisters[1];
- }
-
- //
- // for ATAPI device, no need to wait DRDY ready after device selecting.
- //
- // bit7 and bit5 are both set to 1 for backward compatibility
- //
- DeviceSelect = (UINT8) (((bit (7) | bit (5)) | (Target << 4)));
- WritePortB (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->Head, DeviceSelect);
-
- Command = ATAPI_SOFT_RESET_CMD;
- WritePortB (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->Reg.Command, Command);
-
- //
- // BSY clear is the only status return to the host by the device
- // when reset is complete.
- // slave device needs at most 31s to clear BSY
- //
- if (EFI_ERROR (StatusWaitForBSYClear (AtapiScsiPrivate, 31000))) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // stall 5 seconds to make the device status stable
- //
- gBS->Stall (5000000);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Checks the parameters in the SCSI Request Packet to make sure
- they are valid for a SCSI Pass Thru request.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo Packet - add argument and description to function comment
- @todo EFI_INVALID_PARAMETER - add return value to function comment
- @todo EFI_INVALID_PARAMETER - add return value to function comment
- @todo EFI_INVALID_PARAMETER - add return value to function comment
- @todo EFI_UNSUPPORTED - add return value to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-CheckSCSIRequestPacket (
- EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
- )
-{
- if (Packet == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!ValidCdbLength (Packet->CdbLength)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Packet->Cdb == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Checks whether the request command is supported.
- //
- if (!IsCommandValid (Packet)) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Checks the requested SCSI command:
- Is it supported by this driver?
- Is the Data transfer direction reasonable?
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo Packet - add argument and description to function comment
-**/
-BOOLEAN
-IsCommandValid (
- EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
- )
-{
- UINT8 Index;
- UINT8 *OpCode;
-
- OpCode = (UINT8 *) (Packet->Cdb);
-
- for (Index = 0; CompareMem (&gSupportedATAPICommands[Index], &gEndTable, sizeof (SCSI_COMMAND_SET)); Index++) {
-
- if (*OpCode == gSupportedATAPICommands[Index].OpCode) {
- //
- // Check whether the requested Command is supported by this driver
- //
- if (Packet->DataDirection == DataIn) {
- //
- // Check whether the requested data direction conforms to
- // what it should be.
- //
- if (gSupportedATAPICommands[Index].Direction == DataOut) {
- return FALSE;
- }
- }
-
- if (Packet->DataDirection == DataOut) {
- //
- // Check whether the requested data direction conforms to
- // what it should be.
- //
- if (gSupportedATAPICommands[Index].Direction == DataIn) {
- return FALSE;
- }
- }
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/**
- Performs blocking I/O request.
-
- @param AtapiScsiPrivate Private data structure for the specified channel.
- @param Target The Target ID of the ATAPI device to send the SCSI
- Request Packet. To ATAPI devices attached on an IDE
- Channel, Target ID 0 indicates Master device;Target
- ID 1 indicates Slave device.
- @param Packet The SCSI Request Packet to send to the ATAPI device
- specified by Target.
-
- @todo AtapiScsiPrivate - add argument and description to function comment
-**/
-EFI_STATUS
-SubmitBlockingIoCommand (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT32 Target,
- EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
- )
-{
- UINT8 PacketCommand[12];
- UINT64 TimeoutInMicroSeconds;
- EFI_STATUS PacketCommandStatus;
-
- //
- // Fill ATAPI Command Packet according to CDB
- //
- ZeroMem (&PacketCommand, 12);
- CopyMem (&PacketCommand, Packet->Cdb, Packet->CdbLength);
-
- //
- // Timeout is 100ns unit, convert it to 1000ns (1us) unit.
- //
- TimeoutInMicroSeconds = DivU64x32 (Packet->Timeout, (UINT32) 10);
-
- //
- // Submit ATAPI Command Packet
- //
- PacketCommandStatus = AtapiPacketCommand (
- AtapiScsiPrivate,
- Target,
- PacketCommand,
- Packet->DataBuffer,
- &(Packet->TransferLength),
- (DATA_DIRECTION) Packet->DataDirection,
- TimeoutInMicroSeconds
- );
- if (!EFI_ERROR (PacketCommandStatus) || (Packet->SenseData == NULL)) {
- Packet->SenseDataLength = 0;
- return PacketCommandStatus;
- }
- //
- // Return SenseData if PacketCommandStatus matches
- // the following return codes.
- //
- if ((PacketCommandStatus == EFI_WARN_BUFFER_TOO_SMALL) ||
- (PacketCommandStatus == EFI_DEVICE_ERROR) ||
- (PacketCommandStatus == EFI_TIMEOUT)) {
-
- //
- // avoid submit request sense command continuously.
- //
- if (PacketCommand[0] == OP_REQUEST_SENSE) {
- Packet->SenseDataLength = 0;
- return PacketCommandStatus;
- }
-
- RequestSenseCommand (
- AtapiScsiPrivate,
- Target,
- Packet->Timeout,
- Packet->SenseData,
- &Packet->SenseDataLength
- );
- }
-
- return PacketCommandStatus;
-}
-
-/**
- RequestSenseCommand
-
- @param AtapiScsiPrivate
- @param Target
- @param Timeout
- @param SenseData
- @param SenseDataLength
-
- @todo Add function description
- @todo AtapiScsiPrivate TODO: add argument description
- @todo Target TODO: add argument description
- @todo Timeout TODO: add argument description
- @todo SenseData TODO: add argument description
- @todo SenseDataLength TODO: add argument description
- @todo add return values
-**/
-EFI_STATUS
-RequestSenseCommand (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT32 Target,
- UINT64 Timeout,
- VOID *SenseData,
- UINT8 *SenseDataLength
- )
-{
- EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET Packet;
- UINT8 Cdb[12];
- EFI_STATUS Status;
-
- ZeroMem (&Packet, sizeof (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 12);
-
- Cdb[0] = OP_REQUEST_SENSE;
- Cdb[4] = (UINT8) (*SenseDataLength);
-
- Packet.Timeout = Timeout;
- Packet.DataBuffer = SenseData;
- Packet.SenseData = NULL;
- Packet.Cdb = Cdb;
- Packet.TransferLength = *SenseDataLength;
- Packet.CdbLength = 12;
- Packet.DataDirection = DataIn;
-
- Status = SubmitBlockingIoCommand (AtapiScsiPrivate, Target, &Packet);
- *SenseDataLength = (UINT8) (Packet.TransferLength);
- return Status;
-}
-
-/**
- Submits ATAPI command packet to the specified ATAPI device.
-
- @param AtapiScsiPrivate: Private data structure for the specified channel.
- @param Target: The Target ID of the ATAPI device to send the SCSI
- Request Packet. To ATAPI devices attached on an IDE
- Channel, Target ID 0 indicates Master device;Target
- ID 1 indicates Slave device.
- @param PacketCommand: Points to the ATAPI command packet.
- @param Buffer: Points to the transferred data.
- @param ByteCount: When input,indicates the buffer size; when output,
- indicates the actually transferred data size.
- @param Direction: Indicates the data transfer direction.
- @param TimeoutInMicroSeconds: The timeout, in micro second units,
- to use for the execution of this ATAPI command.
- A TimeoutInMicroSeconds value of 0 means that
- this function will wait indefinitely for the ATAPI
- command to execute.
- <P>
- If TimeoutInMicroSeconds is greater than zero, then
- this function will return EFI_TIMEOUT if the time
- required to execute the ATAPI command is greater
- than TimeoutInMicroSeconds.
- </P>
-
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo PacketCommand - add argument and description to function comment
- @todo Buffer - add argument and description to function comment
- @todo ByteCount - add argument and description to function comment
- @todo Direction - add argument and description to function comment
-**/
-EFI_STATUS
-AtapiPacketCommand (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT32 Target,
- UINT8 *PacketCommand,
- VOID *Buffer,
- UINT32 *ByteCount,
- DATA_DIRECTION Direction,
- UINT64 TimeoutInMicroSeconds
- )
-{
-
- UINT16 *CommandIndex;
- UINT8 Count;
- EFI_STATUS Status;
-
- //
- // Set all the command parameters by fill related registers.
- // Before write to all the following registers, BSY and DRQ must be 0.
- //
- Status = StatusDRQClear (AtapiScsiPrivate, TimeoutInMicroSeconds);
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ABORTED) {
- Status = EFI_DEVICE_ERROR;
- }
-
- *ByteCount = 0;
- return Status;
- }
- //
- // Select device via Device/Head Register.
- // "Target = 0" indicates device 0; "Target = 1" indicates device 1
- //
- WritePortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Head,
- (UINT8) ((Target << 4) | DEFAULT_CMD) // DEFAULT_CMD: 0xa0 (1010,0000)
- );
-
- //
- // No OVL; No DMA (by setting feature register)
- //
- WritePortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg1.Feature,
- 0x00
- );
-
- //
- // set the transfersize to MAX_ATAPI_BYTE_COUNT to let the device
- // determine how much data should be transfered.
- //
- WritePortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->CylinderLsb,
- (UINT8) (MAX_ATAPI_BYTE_COUNT & 0x00ff)
- );
- WritePortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->CylinderMsb,
- (UINT8) (MAX_ATAPI_BYTE_COUNT >> 8)
- );
-
- //
- // DEFAULT_CTL:0x0a (0000,1010)
- // Disable interrupt
- //
- WritePortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Alt.DeviceControl,
- DEFAULT_CTL
- );
-
- //
- // Send Packet command to inform device
- // that the following data bytes are command packet.
- //
- WritePortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg.Command,
- PACKET_CMD
- );
-
- //
- // Before data transfer, BSY should be 0 and DRQ should be 1.
- // if they are not in specified time frame,
- // retrieve Sense Key from Error Register before return.
- //
- Status = StatusDRQReady (AtapiScsiPrivate, TimeoutInMicroSeconds);
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ABORTED) {
- Status = EFI_DEVICE_ERROR;
- }
-
- *ByteCount = 0;
- return Status;
- }
-
- //
- // Send out command packet
- //
- CommandIndex = (UINT16 *) PacketCommand;
- for (Count = 0; Count < 6; Count++, CommandIndex++) {
- WritePortW (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->Data, *CommandIndex);
- }
-
- //
- // call AtapiPassThruPioReadWriteData() function to get
- // requested transfer data form device.
- //
- return AtapiPassThruPioReadWriteData (
- AtapiScsiPrivate,
- Buffer,
- ByteCount,
- Direction,
- TimeoutInMicroSeconds
- );
-}
-
-/**
- Performs data transfer between ATAPI device and host after the
- ATAPI command packet is sent.
-
- @param AtapiScsiPrivate: Private data structure for the specified channel.
- @param Buffer: Points to the transferred data.
- @param ByteCount: When input,indicates the buffer size; when output,
- indicates the actually transferred data size.
- @param Direction: Indicates the data transfer direction.
- @param TimeoutInMicroSeconds: The timeout, in micro second units,
- to use for the execution of this ATAPI command.
- A TimeoutInMicroSeconds value of 0 means that
- this function will wait indefinitely for the ATAPI
- command to execute.
- <P>
- If TimeoutInMicroSeconds is greater than zero, then
- this function will return EFI_TIMEOUT if the time
- required to execute the ATAPI command is greater
- than TimeoutInMicroSeconds.
- </P>
-
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo Buffer - add argument and description to function comment
- @todo ByteCount - add argument and description to function comment
- @todo Direction - add argument and description to function comment
- @todo EFI_DEVICE_ERROR - add return value to function comment
- @todo EFI_DEVICE_ERROR - add return value to function comment
- @todo EFI_WARN_BUFFER_TOO_SMALL - add return value to function comment
-**/
-EFI_STATUS
-AtapiPassThruPioReadWriteData (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT16 *Buffer,
- UINT32 *ByteCount,
- DATA_DIRECTION Direction,
- UINT64 TimeoutInMicroSeconds
- )
-{
- UINT32 Index;
- UINT32 RequiredWordCount;
- UINT32 ActualWordCount;
-
- UINT32 WordCount;
- EFI_STATUS Status;
- UINT16 *ptrBuffer;
-
- Status = EFI_SUCCESS;
-
- //
- // Non Data transfer request is also supported.
- //
- if (*ByteCount == 0 || Buffer == NULL) {
- *ByteCount = 0;
- if (EFI_ERROR (StatusWaitForBSYClear (AtapiScsiPrivate, TimeoutInMicroSeconds))) {
- return EFI_DEVICE_ERROR;
- }
- }
-
- ptrBuffer = Buffer;
- RequiredWordCount = *ByteCount / 2;
-
- //
- // ActuralWordCount means the word count of data really transfered.
- //
- ActualWordCount = 0;
-
- while (ActualWordCount < RequiredWordCount) {
- //
- // before each data transfer stream, the host should poll DRQ bit ready,
- // which indicates device's ready for data transfer .
- //
- Status = StatusDRQReady (AtapiScsiPrivate, TimeoutInMicroSeconds);
- if (EFI_ERROR (Status)) {
- *ByteCount = ActualWordCount * 2;
-
- AtapiPassThruCheckErrorStatus (AtapiScsiPrivate);
-
- if (ActualWordCount == 0) {
- return EFI_DEVICE_ERROR;
- }
- //
- // ActualWordCount > 0
- //
- if (ActualWordCount < RequiredWordCount) {
- return EFI_WARN_BUFFER_TOO_SMALL;
- }
- }
- //
- // get current data transfer size from Cylinder Registers.
- //
- WordCount = ReadPortB (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->CylinderMsb) << 8;
- WordCount = WordCount | ReadPortB (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->CylinderLsb);
- WordCount = WordCount & 0xffff;
- WordCount /= 2;
-
- //
- // perform a series data In/Out.
- //
- for (Index = 0; (Index < WordCount) && (ActualWordCount < RequiredWordCount); Index++, ActualWordCount++) {
-
- if (Direction == DataIn) {
-
- *ptrBuffer = ReadPortW (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->Data);
- } else {
-
- WritePortW (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->Data, *ptrBuffer);
- }
-
- ptrBuffer++;
-
- }
- }
- //
- // After data transfer is completed, normally, DRQ bit should clear.
- //
- StatusDRQClear (AtapiScsiPrivate, TimeoutInMicroSeconds);
-
- //
- // read status register to check whether error happens.
- //
- Status = AtapiPassThruCheckErrorStatus (AtapiScsiPrivate);
-
- *ByteCount = ActualWordCount * 2;
-
- return Status;
-}
-
-
-/**
- Read one byte from a specified I/O port.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo PciIo - add argument and description to function comment
- @todo Port - add argument and description to function comment
-**/
-UINT8
-ReadPortB (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port
- )
-{
- UINT8 Data;
-
- Data = 0;
- PciIo->Io.Read (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) Port,
- 1,
- &Data
- );
- return Data;
-}
-
-
-/**
- Read one word from a specified I/O port.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo PciIo - add argument and description to function comment
- @todo Port - add argument and description to function comment
-**/
-UINT16
-ReadPortW (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port
- )
-{
- UINT16 Data;
-
- Data = 0;
- PciIo->Io.Read (
- PciIo,
- EfiPciIoWidthUint16,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) Port,
- 1,
- &Data
- );
- return Data;
-}
-
-
-/**
- Write one byte to a specified I/O port.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo PciIo - add argument and description to function comment
- @todo Port - add argument and description to function comment
- @todo Data - add argument and description to function comment
-**/
-VOID
-WritePortB (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINT8 Data
- )
-{
-
- PciIo->Io.Write (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) Port,
- 1,
- &Data
- );
-
-}
-
-
-/**
- Write one word to a specified I/O port.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo PciIo - add argument and description to function comment
- @todo Port - add argument and description to function comment
- @todo Data - add argument and description to function comment
-**/
-VOID
-WritePortW (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINT16 Data
- )
-{
-
- PciIo->Io.Write (
- PciIo,
- EfiPciIoWidthUint16,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) Port,
- 1,
- &Data
- );
-}
-
-/**
- Check whether DRQ is clear in the Status Register. (BSY must also be cleared)
- If TimeoutInMicroSeconds is zero, this routine should wait infinitely for
- DRQ clear. Otherwise, it will return EFI_TIMEOUT when specified time is
- elapsed.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo TimeoutInMicroSeconds - add argument and description to function comment
- @todo EFI_ABORTED - add return value to function comment
- @todo EFI_TIMEOUT - add return value to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-StatusDRQClear (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-{
- UINT64 Delay;
- UINT8 StatusRegister;
- UINT8 ErrRegister;
-
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- } else {
- Delay = DivU64x32 (TimeoutInMicroSeconds, (UINT32) 30) + 1;
- }
-
- do {
-
- StatusRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg.Status
- );
-
- //
- // wait for BSY == 0 and DRQ == 0
- //
- if ((StatusRegister & (DRQ | BSY)) == 0) {
- break;
- }
- //
- // check whether the command is aborted by the device
- //
- if ((StatusRegister & (BSY | ERR)) == ERR) {
-
- ErrRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg1.Error
- );
- if ((ErrRegister & ABRT_ERR) == ABRT_ERR) {
-
- return EFI_ABORTED;
- }
- }
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- //
- // Loop infinitely if not meeting expected condition
- //
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- }
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Check whether DRQ is clear in the Alternate Status Register.
- (BSY must also be cleared).
- If TimeoutInMicroSeconds is zero, this routine should wait infinitely for
- DRQ clear. Otherwise, it will return EFI_TIMEOUT when specified time is
- elapsed.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo TimeoutInMicroSeconds - add argument and description to function comment
- @todo EFI_ABORTED - add return value to function comment
- @todo EFI_TIMEOUT - add return value to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-AltStatusDRQClear (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-{
- UINT64 Delay;
- UINT8 AltStatusRegister;
- UINT8 ErrRegister;
-
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- } else {
- Delay = DivU64x32 (TimeoutInMicroSeconds, (UINT32) 30) + 1;
- }
-
- do {
-
- AltStatusRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Alt.AltStatus
- );
-
- //
- // wait for BSY == 0 and DRQ == 0
- //
- if ((AltStatusRegister & (DRQ | BSY)) == 0) {
- break;
- }
-
- if ((AltStatusRegister & (BSY | ERR)) == ERR) {
-
- ErrRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg1.Error
- );
- if ((ErrRegister & ABRT_ERR) == ABRT_ERR) {
-
- return EFI_ABORTED;
- }
- }
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- //
- // Loop infinitely if not meeting expected condition
- //
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- }
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Check whether DRQ is ready in the Status Register. (BSY must also be cleared)
- If TimeoutInMicroSeconds is zero, this routine should wait infinitely for
- DRQ ready. Otherwise, it will return EFI_TIMEOUT when specified time is
- elapsed.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo TimeoutInMicroSeconds - add argument and description to function comment
- @todo EFI_ABORTED - add return value to function comment
- @todo EFI_TIMEOUT - add return value to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-StatusDRQReady (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-{
- UINT64 Delay;
- UINT8 StatusRegister;
- UINT8 ErrRegister;
-
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- } else {
- Delay = DivU64x32 (TimeoutInMicroSeconds, (UINT32) 30) + 1;
- }
-
- do {
- //
- // read Status Register will clear interrupt
- //
- StatusRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg.Status
- );
-
- //
- // BSY==0,DRQ==1
- //
- if ((StatusRegister & (BSY | DRQ)) == DRQ) {
- break;
- }
-
- if ((StatusRegister & (BSY | ERR)) == ERR) {
-
- ErrRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg1.Error
- );
- if ((ErrRegister & ABRT_ERR) == ABRT_ERR) {
- return EFI_ABORTED;
- }
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- //
- // Loop infinitely if not meeting expected condition
- //
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- }
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Check whether DRQ is ready in the Alternate Status Register.
- (BSY must also be cleared)
- If TimeoutInMicroSeconds is zero, this routine should wait infinitely for
- DRQ ready. Otherwise, it will return EFI_TIMEOUT when specified time is
- elapsed.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo TimeoutInMicroSeconds - add argument and description to function comment
- @todo EFI_ABORTED - add return value to function comment
- @todo EFI_TIMEOUT - add return value to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-AltStatusDRQReady (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-{
- UINT64 Delay;
- UINT8 AltStatusRegister;
- UINT8 ErrRegister;
-
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- } else {
- Delay = DivU64x32 (TimeoutInMicroSeconds, (UINT32) 30) + 1;
- }
-
- do {
- //
- // read Status Register will clear interrupt
- //
- AltStatusRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Alt.AltStatus
- );
- //
- // BSY==0,DRQ==1
- //
- if ((AltStatusRegister & (BSY | DRQ)) == DRQ) {
- break;
- }
-
- if ((AltStatusRegister & (BSY | ERR)) == ERR) {
-
- ErrRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg1.Error
- );
- if ((ErrRegister & ABRT_ERR) == ABRT_ERR) {
- return EFI_ABORTED;
- }
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- //
- // Loop infinitely if not meeting expected condition
- //
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- }
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Check whether BSY is clear in the Status Register.
- If TimeoutInMicroSeconds is zero, this routine should wait infinitely for
- BSY clear. Otherwise, it will return EFI_TIMEOUT when specified time is
- elapsed.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo TimeoutInMicroSeconds - add argument and description to function comment
- @todo EFI_TIMEOUT - add return value to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-StatusWaitForBSYClear (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-{
- UINT64 Delay;
- UINT8 StatusRegister;
-
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- } else {
- Delay = DivU64x32 (TimeoutInMicroSeconds, (UINT32) 30) + 1;
- }
-
- do {
-
- StatusRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg.Status
- );
- if ((StatusRegister & BSY) == 0x00) {
- break;
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- //
- // Loop infinitely if not meeting expected condition
- //
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- }
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Check whether BSY is clear in the Alternate Status Register.
- If TimeoutInMicroSeconds is zero, this routine should wait infinitely for
- BSY clear. Otherwise, it will return EFI_TIMEOUT when specified time is
- elapsed.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo TimeoutInMicroSeconds - add argument and description to function comment
- @todo EFI_TIMEOUT - add return value to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-AltStatusWaitForBSYClear (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-{
- UINT64 Delay;
- UINT8 AltStatusRegister;
-
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- } else {
- Delay = DivU64x32 (TimeoutInMicroSeconds, (UINT32) 30) + 1;
- }
-
- do {
-
- AltStatusRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Alt.AltStatus
- );
- if ((AltStatusRegister & BSY) == 0x00) {
- break;
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
- //
- // Loop infinitely if not meeting expected condition
- //
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- }
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Check whether DRDY is ready in the Status Register.
- (BSY must also be cleared)
- If TimeoutInMicroSeconds is zero, this routine should wait infinitely for
- DRDY ready. Otherwise, it will return EFI_TIMEOUT when specified time is
- elapsed.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo TimeoutInMicroSeconds - add argument and description to function comment
- @todo EFI_ABORTED - add return value to function comment
- @todo EFI_TIMEOUT - add return value to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-StatusDRDYReady (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-{
- UINT64 Delay;
- UINT8 StatusRegister;
- UINT8 ErrRegister;
-
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- } else {
- Delay = DivU64x32 (TimeoutInMicroSeconds, (UINT32) 30) + 1;
- }
-
- do {
- StatusRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg.Status
- );
- //
- // BSY == 0 , DRDY == 1
- //
- if ((StatusRegister & (DRDY | BSY)) == DRDY) {
- break;
- }
-
- if ((StatusRegister & (BSY | ERR)) == ERR) {
-
- ErrRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg1.Error
- );
- if ((ErrRegister & ABRT_ERR) == ABRT_ERR) {
- return EFI_ABORTED;
- }
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
- //
- // Loop infinitely if not meeting expected condition
- //
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- }
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Check whether DRDY is ready in the Alternate Status Register.
- (BSY must also be cleared)
- If TimeoutInMicroSeconds is zero, this routine should wait infinitely for
- DRDY ready. Otherwise, it will return EFI_TIMEOUT when specified time is
- elapsed.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo TimeoutInMicroSeconds - add argument and description to function comment
- @todo EFI_ABORTED - add return value to function comment
- @todo EFI_TIMEOUT - add return value to function comment
- @todo EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-AltStatusDRDYReady (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-{
- UINT64 Delay;
- UINT8 AltStatusRegister;
- UINT8 ErrRegister;
-
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- } else {
- Delay = DivU64x32 (TimeoutInMicroSeconds, (UINT32) 30) + 1;
- }
-
- do {
- AltStatusRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Alt.AltStatus
- );
- //
- // BSY == 0 , DRDY == 1
- //
- if ((AltStatusRegister & (DRDY | BSY)) == DRDY) {
- break;
- }
-
- if ((AltStatusRegister & (BSY | ERR)) == ERR) {
-
- ErrRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg1.Error
- );
- if ((ErrRegister & ABRT_ERR) == ABRT_ERR) {
- return EFI_ABORTED;
- }
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
- //
- // Loop infinitely if not meeting expected condition
- //
- if (TimeoutInMicroSeconds == 0) {
- Delay = 2;
- }
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Check Error Register for Error Information.
-
- @todo function comment is missing 'Routine Description:'
- @todo function comment is missing 'Arguments:'
- @todo function comment is missing 'Returns:'
- @todo AtapiScsiPrivate - add argument and description to function comment
- @todo EFI_SUCCESS - add return value to function comment
- @todo EFI_DEVICE_ERROR - add return value to function comment
-**/
-EFI_STATUS
-AtapiPassThruCheckErrorStatus (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate
- )
-{
- UINT8 StatusRegister;
- UINT8 ErrorRegister;
-
- StatusRegister = ReadPortB (
- AtapiScsiPrivate->PciIo,
- AtapiScsiPrivate->IoPort->Reg.Status
- );
-
- DEBUG_CODE_BEGIN ();
-
- if (StatusRegister & DWF) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Write Fault\n",
- StatusRegister)
- );
- }
-
- if (StatusRegister & CORR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Corrected Data\n",
- StatusRegister)
- );
- }
-
- if (StatusRegister & ERR) {
- ErrorRegister = ReadPortB (AtapiScsiPrivate->PciIo, AtapiScsiPrivate->IoPort->Reg1.Error);
-
-
- if (ErrorRegister & BBK_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Bad Block Detected\n",
- ErrorRegister)
- );
- }
-
- if (ErrorRegister & UNC_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Uncorrectable Data\n",
- ErrorRegister)
- );
- }
-
- if (ErrorRegister & MC_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Media Change\n",
- ErrorRegister)
- );
- }
-
- if (ErrorRegister & ABRT_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Abort\n",
- ErrorRegister)
- );
- }
-
- if (ErrorRegister & TK0NF_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Track 0 Not Found\n",
- ErrorRegister)
- );
- }
-
- if (ErrorRegister & AMNF_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "AtapiPassThruCheckErrorStatus()-- %02x : Error : Address Mark Not Found\n",
- ErrorRegister)
- );
- }
- }
-
- DEBUG_CODE_END ();
-
- if ((StatusRegister & (ERR | DWF | CORR)) == 0) {
- return EFI_SUCCESS;
- }
-
-
- return EFI_DEVICE_ERROR;
-}
diff --git a/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.h b/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.h
deleted file mode 100644
index f14388b..0000000
--- a/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.h
+++ /dev/null
@@ -1,814 +0,0 @@
-/** @file
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: AtapiPassThru.h
-
-**/
-
-#ifndef _APT_H
-#define _APT_H
-
-
-#include <IndustryStandard/pci22.h>
-
-///
-/// bit definition
-///
-#define bit(a) (1 << (a))
-
-#define MAX_TARGET_ID 4
-
-//
-// IDE Registers
-//
-typedef union {
- UINT16 Command; /* when write */
- UINT16 Status; /* when read */
-} IDE_CMD_OR_STATUS;
-
-typedef union {
- UINT16 Error; /* when read */
- UINT16 Feature; /* when write */
-} IDE_ERROR_OR_FEATURE;
-
-typedef union {
- UINT16 AltStatus; /* when read */
- UINT16 DeviceControl; /* when write */
-} IDE_AltStatus_OR_DeviceControl;
-
-///
-/// IDE registers set
-///
-typedef struct {
- UINT16 Data;
- IDE_ERROR_OR_FEATURE Reg1;
- UINT16 SectorCount;
- UINT16 SectorNumber;
- UINT16 CylinderLsb;
- UINT16 CylinderMsb;
- UINT16 Head;
- IDE_CMD_OR_STATUS Reg;
-
- IDE_AltStatus_OR_DeviceControl Alt;
- UINT16 DriveAddress;
-
- UINT16 MasterSlave;
-} IDE_BASE_REGISTERS;
-
-#define ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE EFI_SIGNATURE_32 ('a', 's', 'p', 't')
-
-typedef struct {
- UINTN Signature;
-
- EFI_HANDLE Handle;
- EFI_SCSI_PASS_THRU_PROTOCOL ScsiPassThru;
- EFI_SCSI_PASS_THRU_MODE ScsiPassThruMode;
- EFI_PCI_IO_PROTOCOL *PciIo;
-
- //
- // Local Data goes here
- //
- IDE_BASE_REGISTERS *IoPort;
-
- CHAR16 ControllerName[100];
- CHAR16 ChannelName[100];
-
- UINT32 LatestTargetId;
- UINT64 LatestLun;
-
-} ATAPI_SCSI_PASS_THRU_DEV;
-
-#define ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS(a) \
- CR (a, \
- ATAPI_SCSI_PASS_THRU_DEV, \
- ScsiPassThru, \
- ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE \
- )
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName;
-
-//
-// ATAPI Command op code
-//
-#define OP_INQUIRY 0x12
-#define OP_LOAD_UNLOAD_CD 0xa6
-#define OP_MECHANISM_STATUS 0xbd
-#define OP_MODE_SELECT_10 0x55
-#define OP_MODE_SENSE_10 0x5a
-#define OP_PAUSE_RESUME 0x4b
-#define OP_PLAY_AUDIO_10 0x45
-#define OP_PLAY_AUDIO_MSF 0x47
-#define OP_PLAY_CD 0xbc
-#define OP_PLAY_CD_MSF 0xb4
-#define OP_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
-#define OP_READ_10 0x28
-#define OP_READ_12 0xa8
-#define OP_READ_CAPACITY 0x25
-#define OP_READ_CD 0xbe
-#define OP_READ_CD_MSF 0xb9
-#define OP_READ_HEADER 0x44
-#define OP_READ_SUB_CHANNEL 0x42
-#define OP_READ_TOC 0x43
-#define OP_REQUEST_SENSE 0x03
-#define OP_SCAN 0xba
-#define OP_SEEK_10 0x2b
-#define OP_SET_CD_SPEED 0xbb
-#define OP_STOPPLAY_SCAN 0x4e
-#define OP_START_STOP_UNIT 0x1b
-#define OP_TEST_UNIT_READY 0x00
-
-#define OP_FORMAT_UNIT 0x04
-#define OP_READ_FORMAT_CAPACITIES 0x23
-#define OP_VERIFY 0x2f
-#define OP_WRITE_10 0x2a
-#define OP_WRITE_12 0xaa
-#define OP_WRITE_AND_VERIFY 0x2e
-
-//
-// ATA Command
-//
-#define ATAPI_SOFT_RESET_CMD 0x08
-
-typedef enum {
- DataIn = 0,
- DataOut = 1,
- NoData = 2,
- End = 0xff
-} DATA_DIRECTION;
-
-typedef struct {
- UINT8 OpCode;
- DATA_DIRECTION Direction;
-} SCSI_COMMAND_SET;
-
-#define MAX_CHANNEL 2
-
-#define ValidCdbLength(Len) ((Len) == 6 || (Len) == 10 || (Len) == 12) ? 1 : 0
-
-//
-// IDE registers bit definitions
-//
-// ATA Err Reg bitmap
-//
-#define BBK_ERR bit (7) ///< Bad block detected
-#define UNC_ERR bit (6) ///< Uncorrectable Data
-#define MC_ERR bit (5) ///< Media Change
-#define IDNF_ERR bit (4) ///< ID Not Found
-#define MCR_ERR bit (3) ///< Media Change Requested
-#define ABRT_ERR bit (2) ///< Aborted Command
-#define TK0NF_ERR bit (1) ///< Track 0 Not Found
-#define AMNF_ERR bit (0) ///< Address Mark Not Found
-
-//
-// ATAPI Err Reg bitmap
-//
-#define SENSE_KEY_ERR (bit (7) | bit (6) | bit (5) | bit (4))
-#define EOM_ERR bit (1) ///< End of Media Detected
-#define ILI_ERR bit (0) ///< Illegal Length Indication
-
-//
-// Device/Head Reg
-//
-#define LBA_MODE bit (6)
-#define DEV bit (4)
-#define HS3 bit (3)
-#define HS2 bit (2)
-#define HS1 bit (1)
-#define HS0 bit (0)
-#define CHS_MODE (0)
-#define DRV0 (0)
-#define DRV1 (1)
-#define MST_DRV DRV0
-#define SLV_DRV DRV1
-
-//
-// Status Reg
-//
-#define BSY bit (7) ///< Controller Busy
-#define DRDY bit (6) ///< Drive Ready
-#define DWF bit (5) ///< Drive Write Fault
-#define DSC bit (4) ///< Disk Seek Complete
-#define DRQ bit (3) ///< Data Request
-#define CORR bit (2) ///< Corrected Data
-#define IDX bit (1) ///< Index
-#define ERR bit (0) ///< Error
-#define CHECK bit (0) ///< Check bit for ATAPI Status Reg
-
-//
-// Device Control Reg
-//
-#define SRST bit (2) ///< Software Reset
-#define IEN_L bit (1) ///< Interrupt Enable
-
-//
-// ATAPI Feature Register
-//
-#define OVERLAP bit (1)
-#define DMA bit (0)
-
-//
-// ATAPI Interrupt Reason Reson Reg (ATA Sector Count Register)
-//
-#define RELEASE bit (2)
-#define IO bit (1)
-#define CoD bit (0)
-
-#define PACKET_CMD 0xA0
-
-#define DEFAULT_CMD (0xa0)
-//
-// default content of device control register, disable INT
-//
-#define DEFAULT_CTL (0x0a)
-#define MAX_ATAPI_BYTE_COUNT (0xfffe)
-
-//
-// function prototype
-//
-
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-/**
- AtapiScsiPassThruDriverEntryPoint
-
- @param ImageHandle
- @param SystemTable
-
- @todo Add function description
- @todo ImageHandle - add argument description
- @todo SystemTable - add argument description
- @todo add return values
---*/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruDriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-/**
- RegisterAtapiScsiPassThru
-
- @param This
- @param Controller
- @param PciIo
-
- @todo Add function description
- @todo This add argument description
- @todo Controller add argument description
- @todo PciIo add argument description
- @todo add return values
-**/
-EFI_STATUS
-RegisterAtapiScsiPassThru (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_PCI_IO_PROTOCOL *PciIo
- )
-;
-
-/**
- AtapiScsiPassThruFunction
-
- @param This
- @param Target
- @param Lun
- @param Packet
- @param Event
-
- @todo Add function description
- @todo This - add argument description
- @todo Target - add argument description
- @todo Lun - add argument description
- @todo Packet - add argument description
- @todo Event - add argument description
- @todo add return values
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruFunction (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
- IN UINT32 Target,
- IN UINT64 Lun,
- IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
- IN EFI_EVENT Event OPTIONAL
- )
-;
-
-/**
- AtapiScsiPassThruGetNextDevice
-
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Target TODO: add argument description
- @param Lun TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruGetNextDevice (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
- IN OUT UINT32 *Target,
- IN OUT UINT64 *Lun
- )
-;
-
-/**
- AtapiScsiPassThruBuildDevicePath
-
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Target TODO: add argument description
- @param Lun TODO: add argument description
- @param DevicePath TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruBuildDevicePath (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
- IN UINT32 Target,
- IN UINT64 Lun,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
- )
-;
-
-/**
- AtapiScsiPassThruGetTargetLun
-
- TODO: Add function description
-
- @param This TODO: add argument description
- @param DevicePath TODO: add argument description
- @param Target TODO: add argument description
- @param Lun TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruGetTargetLun (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT UINT32 *Target,
- OUT UINT64 *Lun
- )
-;
-
-/**
- AtapiScsiPassThruResetChannel
-
- TODO: Add function description
-
- @param This TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruResetChannel (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This
- )
-;
-
-/**
- AtapiScsiPassThruResetTarget
-
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Target TODO: add argument description
- @param Lun TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruResetTarget (
- IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
- IN UINT32 Target,
- IN UINT64 Lun
- )
-;
-
-/**
- CheckSCSIRequestPacket
-
- TODO: Add function description
-
- @param Packet TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-CheckSCSIRequestPacket (
- EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
- )
-;
-
-/**
- SubmitBlockingIoCommand
-
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param Target TODO: add argument description
- @param Packet TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-SubmitBlockingIoCommand (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT32 Target,
- EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
- )
-;
-
-/**
- IsCommandValid
-
- TODO: Add function description
-
- @param Packet - TODO: add argument description
-
- @return TODO: add return values
-
---*/
-BOOLEAN
-IsCommandValid (
- EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
- )
-;
-
-/**
- RequestSenseCommand
-
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param Target TODO: add argument description
- @param Timeout TODO: add argument description
- @param SenseData TODO: add argument description
- @param SenseDataLength TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-RequestSenseCommand (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT32 Target,
- UINT64 Timeout,
- VOID *SenseData,
- UINT8 *SenseDataLength
- )
-;
-
-/**
- AtapiPacketCommand
-
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param Target TODO: add argument description
- @param PacketCommand TODO: add argument description
- @param Buffer TODO: add argument description
- @param ByteCount TODO: add argument description
- @param Direction TODO: add argument description
- @param TimeOutInMicroSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiPacketCommand (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT32 Target,
- UINT8 *PacketCommand,
- VOID *Buffer,
- UINT32 *ByteCount,
- DATA_DIRECTION Direction,
- UINT64 TimeOutInMicroSeconds
- )
-;
-
-
-/**
- ReadPortB
-
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
-
- TODO: add return values
-
-**/
-UINT8
-ReadPortB (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port
- )
-;
-
-
-/**
- ReadPortW
-
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
-
- TODO: add return values
-
-**/
-UINT16
-ReadPortW (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port
- )
-;
-
-
-/**
- WritePortB
-
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
- @param Data TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-WritePortB (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINT8 Data
- )
-;
-
-
-/**
- WritePortW
-
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
- @param Data TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-WritePortW (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINT16 Data
- )
-;
-
-/**
- StatusDRQClear
-
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param TimeOutInMicroSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-StatusDRQClear (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeOutInMicroSeconds
- )
-;
-
-/**
- AltStatusDRQClear
-
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param TimeOutInMicroSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AltStatusDRQClear (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeOutInMicroSeconds
- )
-;
-
-/**
- StatusDRQReady
-
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param TimeOutInMicroSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-StatusDRQReady (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeOutInMicroSeconds
- )
-;
-
-/**
- AltStatusDRQReady
-
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param TimeOutInMicroSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AltStatusDRQReady (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeOutInMicroSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param TimeoutInMicroSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-StatusWaitForBSYClear (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param TimeoutInMicroSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AltStatusWaitForBSYClear (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param TimeoutInMicroSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-StatusDRDYReady (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param TimeoutInMicroSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AltStatusDRDYReady (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT64 TimeoutInMicroSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
- @param Buffer TODO: add argument description
- @param ByteCount TODO: add argument description
- @param Direction TODO: add argument description
- @param TimeOutInMicroSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiPassThruPioReadWriteData (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
- UINT16 *Buffer,
- UINT32 *ByteCount,
- DATA_DIRECTION Direction,
- UINT64 TimeOutInMicroSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param AtapiScsiPrivate TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiPassThruCheckErrorStatus (
- ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate
- )
-;
-#endif
diff --git a/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.msa b/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.msa
deleted file mode 100644
index 971080c..0000000
--- a/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.msa
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>AtapiPassThru</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>E49061CE-99A7-41d3-AB3A-36E5CFBAD63E</GuidValue>
- <Version>1.0</Version>
- <Abstract>Description file for the Atapi Passthru component.</Abstract>
- <Description>
- This driver simulates SCSI devices with Atapi devices to test the SCSI io
- protocol.
- </Description>
- <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>AtapiPassThru</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>AtapiPassThru.h</Filename>
- <Filename>AtapiPassThru.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiScsiPassThruProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gAtapiScsiPassThruDriverBinding</DriverBinding>
- <ComponentName>gAtapiScsiPassThruComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/ComponentName.c b/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/ComponentName.c
deleted file mode 100644
index 1731571..0000000
--- a/EdkModulePkg/Bus/Pci/AtapiPassThru/Dxe/ComponentName.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/** @file
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: ComponentName.c
-
-**/
-#include "AtapiPassThru.h"
-
-///
-/// EFI Component Name Protocol
-///
-EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName = {
- AtapiScsiPassThruComponentNameGetDriverName,
- AtapiScsiPassThruComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mAtapiScsiPassThruDriverNameTable[] = {
- { "eng", (CHAR16 *) L"ATAPI SCSI Pass Thru Driver" },
- { NULL , NULL }
-};
-
-/**
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- @param Language A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- @param DriverName A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString (
- Language,
- gAtapiScsiPassThruComponentName.SupportedLanguages,
- mAtapiScsiPassThruDriverNameTable,
- DriverName
- );
-}
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- @param ControllerHandle The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- @param ChildHandle The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- @param Language A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- @param ControllerName A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-AtapiScsiPassThruComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.c b/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.c
deleted file mode 100644
index c5fa534..0000000
--- a/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/** @file
- Cirrus Logic 5430 Controller Driver.
- This driver is a sample implementation of the UGA Draw Protocol for the
- Cirrus Logic 5430 family of PCI video controllers. This driver is only
- usable in the EFI pre-boot environment. This sample is intended to show
- how the UGA Draw Protocol is able to function. The UGA I/O Protocol is not
- implemented in this sample. A fully compliant EFI UGA driver requires both
- the UGA Draw and the UGA I/O Protocol. Please refer to Microsoft's
- documentation on UGA for details on how to write a UGA driver that is able
- to function both in the EFI pre-boot environment and from the OS runtime.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-//
-// Cirrus Logic 5430 Controller Driver
-//
-
-#include "CirrusLogic5430.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gCirrusLogic5430DriverBinding = {
- CirrusLogic5430ControllerDriverSupported,
- CirrusLogic5430ControllerDriverStart,
- CirrusLogic5430ControllerDriverStop,
- 0xa,
- NULL,
- NULL
-};
-
-/**
- CirrusLogic5430ControllerDriverSupported
-
- TODO: This - add argument and description to function comment
- TODO: Controller - add argument and description to function comment
- TODO: RemainingDevicePath - add argument and description to function comment
-**/
-EFI_STATUS
-EFIAPI
-CirrusLogic5430ControllerDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE00 Pci;
-
- //
- // Open the PCI I/O Protocol
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Read the PCI Configuration Header from the PCI Device
- //
- Status = PciIo->Pci.Read (
- PciIo,
- EfiPciIoWidthUint32,
- 0,
- sizeof (Pci) / sizeof (UINT32),
- &Pci
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Status = EFI_UNSUPPORTED;
- //
- // See if the I/O enable is on. Most systems only allow one VGA device to be turned on
- // at a time, so see if this is one that is turned on.
- //
- // if (((Pci.Hdr.Command & 0x01) == 0x01)) {
- //
- // See if this is a Cirrus Logic PCI controller
- //
- if (Pci.Hdr.VendorId == CIRRUS_LOGIC_VENDOR_ID) {
- //
- // See if this is a 5430 or a 5446 PCI controller
- //
- if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_DEVICE_ID) {
- Status = EFI_SUCCESS;
- }
-
- if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID) {
- Status = EFI_SUCCESS;
- }
-
- if (Pci.Hdr.DeviceId == CIRRUS_LOGIC_5446_DEVICE_ID) {
- Status = EFI_SUCCESS;
- }
- }
-
-Done:
- //
- // Close the PCI I/O Protocol
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-/**
- CirrusLogic5430ControllerDriverStart
-
- TODO: This - add argument and description to function comment
- TODO: Controller - add argument and description to function comment
- TODO: RemainingDevicePath - add argument and description to function comment
-**/
-EFI_STATUS
-EFIAPI
-CirrusLogic5430ControllerDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
-
- //
- // Allocate Private context data for UGA Draw inteface.
- //
- Private = NULL;
- Private = AllocateZeroPool (sizeof (CIRRUS_LOGIC_5430_PRIVATE_DATA));
- if (Private == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
- }
-
- //
- // Set up context record
- //
- Private->Signature = CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE;
- Private->Handle = Controller;
-
- //
- // Open PCI I/O Protocol
- //
- Status = gBS->OpenProtocol (
- Private->Handle,
- &gEfiPciIoProtocolGuid,
- (VOID **) &Private->PciIo,
- This->DriverBindingHandle,
- Private->Handle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- Status = Private->PciIo->Attributes (
- Private->PciIo,
- EfiPciIoAttributeOperationEnable,
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- //
- // Start the UGA Draw software stack.
- //
- Status = CirrusLogic5430UgaDrawConstructor (Private);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- //
- // Publish the UGA Draw interface to the world
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->Handle,
- &gEfiUgaDrawProtocolGuid,
- &Private->UgaDraw,
- NULL
- );
-
-Error:
- if (EFI_ERROR (Status)) {
- if (Private) {
- if (Private->PciIo) {
- Private->PciIo->Attributes (
- Private->PciIo,
- EfiPciIoAttributeOperationDisable,
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,
- NULL
- );
- }
- }
-
- //
- // Close the PCI I/O Protocol
- //
- gBS->CloseProtocol (
- Private->Handle,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Private->Handle
- );
- if (Private) {
- gBS->FreePool (Private);
- }
- }
-
- return Status;
-}
-
-/**
- CirrusLogic5430ControllerDriverStop
-
- TODO: This - add argument and description to function comment
- TODO: Controller - add argument and description to function comment
- TODO: NumberOfChildren - add argument and description to function comment
- TODO: ChildHandleBuffer - add argument and description to function comment
- TODO: EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-EFIAPI
-CirrusLogic5430ControllerDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_STATUS Status;
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- //
- // If the UGA Draw interface does not exist the driver is not started
- //
- return Status;
- }
-
- //
- // Get our private context information
- //
- Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (UgaDraw);
-
- //
- // Remove the UGA Draw interface from the system
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Private->Handle,
- &gEfiUgaDrawProtocolGuid,
- &Private->UgaDraw,
- NULL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Shutdown the hardware
- //
- CirrusLogic5430UgaDrawDestructor (Private);
-
- Private->PciIo->Attributes (
- Private->PciIo,
- EfiPciIoAttributeOperationDisable,
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO,
- NULL
- );
-
- //
- // Close the PCI I/O Protocol
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- //
- // Free our instance data
- //
- gBS->FreePool (Private);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.h b/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.h
deleted file mode 100644
index af841b7..0000000
--- a/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/** @file
- Cirrus Logic 5430 Controller Driver
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-//
-// Cirrus Logic 5430 Controller Driver
-//
-
-#ifndef _CIRRUS_LOGIC_5430_H_
-#define _CIRRUS_LOGIC_5430_H_
-
-
-#include <IndustryStandard/pci22.h>
-//
-// Cirrus Logic 5430 PCI Configuration Header values
-//
-#define CIRRUS_LOGIC_VENDOR_ID 0x1013
-#define CIRRUS_LOGIC_5430_DEVICE_ID 0x00a8
-#define CIRRUS_LOGIC_5430_ALTERNATE_DEVICE_ID 0x00a0
-#define CIRRUS_LOGIC_5446_DEVICE_ID 0x00b8
-
-//
-// Cirrus Logic Graphical Mode Data
-//
-#define CIRRUS_LOGIC_5430_UGA_DRAW_MODE_COUNT 3
-
-typedef struct {
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
-} CIRRUS_LOGIC_5430_UGA_DRAW_MODE_DATA;
-
-//
-// Cirrus Logic 5440 Private Data Structure
-//
-#define CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('C', 'L', '5', '4')
-
-typedef struct {
- UINT64 Signature;
- EFI_HANDLE Handle;
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_UGA_DRAW_PROTOCOL UgaDraw;
-
- //
- // UGA Draw Private Data
- //
- BOOLEAN HardwareNeedsStarting;
- UINTN CurrentMode;
- UINTN MaxMode;
- CIRRUS_LOGIC_5430_UGA_DRAW_MODE_DATA ModeData[CIRRUS_LOGIC_5430_UGA_DRAW_MODE_COUNT];
- UINT8 *LineBuffer;
-} CIRRUS_LOGIC_5430_PRIVATE_DATA;
-
-///
-/// Video Mode structure
-///
-typedef struct {
- UINT32 Width;
- UINT32 Height;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- UINT8 *CrtcSettings;
- UINT16 *SeqSettings;
- UINT8 MiscSetting;
-} CIRRUS_LOGIC_5430_VIDEO_MODES;
-
-#define CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS(a) \
- CR(a, CIRRUS_LOGIC_5430_PRIVATE_DATA, UgaDraw, CIRRUS_LOGIC_5430_PRIVATE_DATA_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gCirrusLogic5430DriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gCirrusLogic5430ComponentName;
-
-//
-// Io Registers defined by VGA
-//
-#define CRTC_ADDRESS_REGISTER 0x3d4
-#define CRTC_DATA_REGISTER 0x3d5
-#define SEQ_ADDRESS_REGISTER 0x3c4
-#define SEQ_DATA_REGISTER 0x3c5
-#define GRAPH_ADDRESS_REGISTER 0x3ce
-#define GRAPH_DATA_REGISTER 0x3cf
-#define ATT_ADDRESS_REGISTER 0x3c0
-#define MISC_OUTPUT_REGISTER 0x3c2
-#define INPUT_STATUS_1_REGISTER 0x3da
-#define DAC_PIXEL_MASK_REGISTER 0x3c6
-#define PALETTE_INDEX_REGISTER 0x3c8
-#define PALETTE_DATA_REGISTER 0x3c9
-
-//
-// UGA Draw Hardware abstraction internal worker functions
-//
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-CirrusLogic5430UgaDrawConstructor (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
- )
-;
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-CirrusLogic5430UgaDrawDestructor (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
- )
-;
-
-//
-// EFI 1.1 driver model prototypes for Cirrus Logic 5430 UGA Draw
-//
-/**
- TODO: Add function description
-
- @param ImageHandle TODO: add argument description
- @param SystemTable TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-CirrusLogic5430DriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-//
-// EFI_DRIVER_BINDING_PROTOCOL Protocol Interface
-//
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Controller TODO: add argument description
- @param RemainingDevicePath TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-CirrusLogic5430ControllerDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Controller TODO: add argument description
- @param RemainingDevicePath TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-CirrusLogic5430ControllerDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Controller TODO: add argument description
- @param NumberOfChildren TODO: add argument description
- @param ChildHandleBuffer TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-CirrusLogic5430ControllerDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-;
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-CirrusLogic5430ComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-CirrusLogic5430ComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// Local Function Prototypes
-//
-VOID
-InitializeGraphicsMode (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- CIRRUS_LOGIC_5430_VIDEO_MODES *ModeData
- );
-
-VOID
-SetPaletteColor (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- UINTN Index,
- UINT8 Red,
- UINT8 Green,
- UINT8 Blue
- );
-
-VOID
-SetDefaultPalette (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
- );
-
-VOID
-DrawLogo (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
- );
-
-VOID
-outb (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- UINTN Address,
- UINT8 Data
- );
-
-VOID
-outw (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- UINTN Address,
- UINT16 Data
- );
-
-UINT8
-inb (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- UINTN Address
- );
-
-UINT16
-inw (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- UINTN Address
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.msa b/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.msa
deleted file mode 100644
index a675ad5..0000000
--- a/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.msa
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>CirrusLogic5430UgaDraw</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>555F76EA-785F-40d7-9174-153C43636C68</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for CirrusLogic5430 module</Abstract>
- <Description>Cirrus Logic 5430 Controller Driver.This driver is a sample implementation
- of the UGA Draw Protocol for the Cirrus Logic 5430 family of PCI video controllers.
- This driver is only usable in the EFI pre-boot environment. This sample is
- intended to show how the UGA Draw Protocol is able to function. The UGA I/O
- Protocol is not implemented in this sample. A fully compliant EFI UGA driver
- requires both the UGA Draw and the UGA I/O Protocol. Please refer to Microsoft's
- documentation on UGA for details on how to write a UGA driver that is able
- to function both in the EFI pre-boot environment and from the OS runtime.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>CirrusLogic5430UgaDraw</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>CirrusLogic5430.h</Filename>
- <Filename>CirrusLogic5430.c</Filename>
- <Filename>CirrusLogic5430UgaDraw.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gCirrusLogic5430DriverBinding</DriverBinding>
- <ComponentName>gCirrusLogic5430ComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430UgaDraw.c b/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430UgaDraw.c
deleted file mode 100644
index 056d115..0000000
--- a/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430UgaDraw.c
+++ /dev/null
@@ -1,867 +0,0 @@
-/** @file
- This file produces the graphics abstration of UGA Draw. It is called by
- CirrusLogic5430.c file which deals with the EFI 1.1 driver model.
- This file just does graphics.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "CirrusLogic5430.h"
-
-STATIC
-VOID
-ClearScreen (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
- );
-
-///
-/// Generic Attribute Controller Register Settings
-///
-static UINT8 AttributeController[21] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x41, 0x00, 0x0F, 0x00, 0x00
-};
-
-///
-/// Generic Graphics Controller Register Settings
-///
-static UINT8 GraphicsController[9] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, 0xFF
-};
-
-//
-// 640 x 480 x 256 color @ 60 Hertz
-//
-static UINT8 Crtc_640_480_256_60[28] = {
- 0x5d, 0x4f, 0x50, 0x82, 0x53, 0x9f, 0x00, 0x3e,
- 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe1, 0x83, 0xdf, 0x50, 0x00, 0xe7, 0x04, 0xe3,
- 0xff, 0x00, 0x00, 0x22
-};
-
-static UINT16 Seq_640_480_256_60[15] = {
- 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
- 0x5b0c, 0x450d, 0x7e0e, 0x2b1b, 0x2f1c, 0x301d, 0x331e
-};
-
-//
-// 800 x 600 x 256 color @ 60 Hertz
-//
-static UINT8 Crtc_800_600_256_60[28] = {
- 0x7F, 0x63, 0x64, 0x80, 0x6B, 0x1B, 0x72, 0xF0,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x58, 0x8C, 0x57, 0x64, 0x00, 0x5F, 0x91, 0xE3,
- 0xFF, 0x00, 0x00, 0x22
-};
-
-static UINT16 Seq_800_600_256_60[15] = {
- 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
- 0x5b0c, 0x450d, 0x510e, 0x2b1b, 0x2f1c, 0x301d, 0x3a1e
-};
-
-//
-// 1024 x 768 x 256 color @ 60 Hertz
-//
-static UINT8 Crtc_1024_768_256_60[28] = {
- 0xA3, 0x7F, 0x80, 0x86, 0x85, 0x96, 0x24, 0xFD,
- 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x88, 0xFF, 0x80, 0x00, 0x00, 0x24, 0xE3,
- 0xFF, 0x4A, 0x00, 0x22
-};
-
-static UINT16 Seq_1024_768_256_60[15] = {
- 0x0100, 0x0101, 0x0f02, 0x0003, 0x0e04, 0x1107, 0x0008, 0x4a0b,
- 0x5b0c, 0x450d, 0x760e, 0x2b1b, 0x2f1c, 0x301d, 0x341e
-};
-
-///
-/// Table of supported video modes
-///
-static CIRRUS_LOGIC_5430_VIDEO_MODES CirrusLogic5430VideoModes[] = {
- { 640, 480, 8, 60, Crtc_640_480_256_60, Seq_640_480_256_60, 0xe3 },
- { 800, 600, 8, 60, Crtc_800_600_256_60, Seq_800_600_256_60, 0xef },
- { 1024, 768, 8, 60, Crtc_1024_768_256_60, Seq_1024_768_256_60, 0xef }
-};
-
-//
-// UGA Draw Protocol Member Functions
-//
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param HorizontalResolution TODO: add argument description
- @param VerticalResolution TODO: add argument description
- @param ColorDepth TODO: add argument description
- @param RefreshRate TODO: add argument description
-
- @retval EFI_NOT_STARTED TODO: Add description for return value
- @retval EFI_INVALID_PARAMETER TODO: Add description for return value
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-CirrusLogic5430UgaDrawGetMode (
- IN EFI_UGA_DRAW_PROTOCOL *This,
- OUT UINT32 *HorizontalResolution,
- OUT UINT32 *VerticalResolution,
- OUT UINT32 *ColorDepth,
- OUT UINT32 *RefreshRate
- )
-{
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
-
- Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This);
-
- if (Private->HardwareNeedsStarting) {
- return EFI_NOT_STARTED;
- }
-
- if ((HorizontalResolution == NULL) ||
- (VerticalResolution == NULL) ||
- (ColorDepth == NULL) ||
- (RefreshRate == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- *HorizontalResolution = Private->ModeData[Private->CurrentMode].HorizontalResolution;
- *VerticalResolution = Private->ModeData[Private->CurrentMode].VerticalResolution;
- *ColorDepth = Private->ModeData[Private->CurrentMode].ColorDepth;
- *RefreshRate = Private->ModeData[Private->CurrentMode].RefreshRate;
-
- return EFI_SUCCESS;
-}
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param HorizontalResolution TODO: add argument description
- @param VerticalResolution TODO: add argument description
- @param ColorDepth TODO: add argument description
- @param RefreshRate TODO: add argument description
-
- @retval EFI_OUT_OF_RESOURCES TODO: Add description for return value
- @retval EFI_SUCCESS TODO: Add description for return value
- @retval EFI_NOT_FOUND TODO: Add description for return value
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-CirrusLogic5430UgaDrawSetMode (
- IN EFI_UGA_DRAW_PROTOCOL *This,
- IN UINT32 HorizontalResolution,
- IN UINT32 VerticalResolution,
- IN UINT32 ColorDepth,
- IN UINT32 RefreshRate
- )
-{
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
- UINTN Index;
-
- Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This);
-
- for (Index = 0; Index < Private->MaxMode; Index++) {
-
- if (HorizontalResolution != Private->ModeData[Index].HorizontalResolution) {
- continue;
- }
-
- if (VerticalResolution != Private->ModeData[Index].VerticalResolution) {
- continue;
- }
-
- if (ColorDepth != Private->ModeData[Index].ColorDepth) {
- continue;
- }
-
- if (RefreshRate != Private->ModeData[Index].RefreshRate) {
- continue;
- }
-
- if (Private->LineBuffer) {
- gBS->FreePool (Private->LineBuffer);
- }
-
- Private->LineBuffer = NULL;
- Private->LineBuffer = AllocatePool (HorizontalResolution);
- if (Private->LineBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- InitializeGraphicsMode (Private, &CirrusLogic5430VideoModes[Index]);
-
- Private->CurrentMode = Index;
-
- Private->HardwareNeedsStarting = FALSE;
-
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
-}
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param BltBuffer TODO: add argument description
- @param BltOperation TODO: add argument description
- @param SourceX TODO: add argument description
- @param SourceY TODO: add argument description
- @param DestinationX TODO: add argument description
- @param DestinationY TODO: add argument description
- @param Width TODO: add argument description
- @param Height TODO: add argument description
- @param Delta TODO: add argument description
-
- @retval EFI_INVALID_PARAMETER TODO: Add description for return value
- @retval EFI_INVALID_PARAMETER TODO: Add description for return value
- @retval EFI_INVALID_PARAMETER TODO: Add description for return value
- @retval EFI_INVALID_PARAMETER TODO: Add description for return value
- @retval EFI_INVALID_PARAMETER TODO: Add description for return value
- @retval EFI_INVALID_PARAMETER TODO: Add description for return value
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-CirrusLogic5430UgaDrawBlt (
- IN EFI_UGA_DRAW_PROTOCOL *This,
- IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL
- IN EFI_UGA_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta
- )
-{
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private;
- EFI_TPL OriginalTPL;
- UINTN DstY;
- UINTN SrcY;
- EFI_UGA_PIXEL *Blt;
- UINTN X;
- UINT8 Pixel;
- UINT32 WidePixel;
- UINTN ScreenWidth;
- UINTN Offset;
- UINTN SourceOffset;
-
- Private = CIRRUS_LOGIC_5430_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This);
-
- if ((BltOperation < 0) || (BltOperation >= EfiUgaBltMax)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width == 0 || Height == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // If Delta is zero, then the entire BltBuffer is being used, so Delta
- // is the number of bytes in each row of BltBuffer. Since BltBuffer is Width pixels size,
- // the number of bytes in each row can be computed.
- //
- if (Delta == 0) {
- Delta = Width * sizeof (EFI_UGA_PIXEL);
- }
-
- //
- // We need to fill the Virtual Screen buffer with the blt data.
- // The virtual screen is upside down, as the first row is the bootom row of
- // the image.
- //
-
- //
- // Make sure the SourceX, SourceY, DestinationX, DestinationY, Width, and Height parameters
- // are valid for the operation and the current screen geometry.
- //
- if (BltOperation == EfiUgaVideoToBltBuffer) {
- //
- // Video to BltBuffer: Source is Video, destination is BltBuffer
- //
- if (SourceY + Height > Private->ModeData[Private->CurrentMode].VerticalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (SourceX + Width > Private->ModeData[Private->CurrentMode].HorizontalResolution) {
- return EFI_INVALID_PARAMETER;
- }
- } else {
- //
- // BltBuffer to Video: Source is BltBuffer, destination is Video
- //
- if (DestinationY + Height > Private->ModeData[Private->CurrentMode].VerticalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (DestinationX + Width > Private->ModeData[Private->CurrentMode].HorizontalResolution) {
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
- // We would not want a timer based event (Cursor, ...) to come in while we are
- // doing this operation.
- //
- OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
-
- switch (BltOperation) {
- case EfiUgaVideoToBltBuffer:
- //
- // Video to BltBuffer: Source is Video, destination is BltBuffer
- //
- for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) {
-
- Offset = (SrcY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + SourceX;
- if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) {
- Private->PciIo->Mem.Read (
- Private->PciIo,
- EfiPciIoWidthUint32,
- 0,
- Offset,
- Width >> 2,
- Private->LineBuffer
- );
- } else {
- Private->PciIo->Mem.Read (
- Private->PciIo,
- EfiPciIoWidthUint8,
- 0,
- Offset,
- Width,
- Private->LineBuffer
- );
- }
-
- for (X = 0; X < Width; X++) {
- Blt = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (DstY * Delta) + (DestinationX + X) * sizeof (EFI_UGA_PIXEL));
-
- Blt->Red = (UINT8) (Private->LineBuffer[X] & 0xe0);
- Blt->Green = (UINT8) ((Private->LineBuffer[X] & 0x1c) << 3);
- Blt->Blue = (UINT8) ((Private->LineBuffer[X] & 0x03) << 6);
- }
- }
- break;
-
- case EfiUgaVideoToVideo:
- //
- // Perform hardware acceleration for Video to Video operations
- //
- ScreenWidth = Private->ModeData[Private->CurrentMode].HorizontalResolution;
- SourceOffset = (SourceY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (SourceX);
- Offset = (DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (DestinationX);
-
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0000);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0010);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0012);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0014);
-
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0001);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0011);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0013);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0015);
-
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((Width << 8) & 0xff00) | 0x20));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((Width & 0xff00) | 0x21));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((Height << 8) & 0xff00) | 0x22));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((Height & 0xff00) | 0x23));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((ScreenWidth << 8) & 0xff00) | 0x24));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((ScreenWidth & 0xff00) | 0x25));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) (((ScreenWidth << 8) & 0xff00) | 0x26));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((ScreenWidth & 0xff00) | 0x27));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) << 8) & 0xff00) | 0x28));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) >> 0) & 0xff00) | 0x29));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((Offset) >> 8) & 0xff00) | 0x2a));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) << 8) & 0xff00) | 0x2c));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) >> 0) & 0xff00) | 0x2d));
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((((SourceOffset) >> 8) & 0xff00) | 0x2e));
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x002f);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0030);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0d32);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0033);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0034);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0035);
-
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0231);
-
- outb (Private, GRAPH_ADDRESS_REGISTER, 0x31);
- while ((inb (Private, GRAPH_DATA_REGISTER) & 0x01) == 0x01)
- ;
- break;
-
- case EfiUgaVideoFill:
- Blt = BltBuffer;
- Pixel = (UINT8) ((Blt->Red & 0xe0) | ((Blt->Green >> 3) & 0x1c) | ((Blt->Blue >> 6) & 0x03));
- WidePixel = (Pixel << 8) | Pixel;
- WidePixel = (WidePixel << 16) | WidePixel;
-
- if (DestinationX == 0 && Width == Private->ModeData[Private->CurrentMode].HorizontalResolution) {
- Offset = DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution;
- if (((Offset & 0x03) == 0) && (((Width * Height) & 0x03) == 0)) {
- Private->PciIo->Mem.Write (
- Private->PciIo,
- EfiPciIoWidthFillUint32,
- 0,
- Offset,
- (Width * Height) >> 2,
- &WidePixel
- );
- } else {
- Private->PciIo->Mem.Write (
- Private->PciIo,
- EfiPciIoWidthFillUint8,
- 0,
- Offset,
- Width * Height,
- &Pixel
- );
- }
- } else {
- for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) {
- Offset = (DstY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + DestinationX;
- if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) {
- Private->PciIo->Mem.Write (
- Private->PciIo,
- EfiPciIoWidthFillUint32,
- 0,
- Offset,
- Width >> 2,
- &WidePixel
- );
- } else {
- Private->PciIo->Mem.Write (
- Private->PciIo,
- EfiPciIoWidthFillUint8,
- 0,
- Offset,
- Width,
- &Pixel
- );
- }
- }
- }
- break;
-
- case EfiUgaBltBufferToVideo:
- for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) {
-
- for (X = 0; X < Width; X++) {
- Blt = (EFI_UGA_PIXEL *) ((UINT8 *) BltBuffer + (SrcY * Delta) + (SourceX + X) * sizeof (EFI_UGA_PIXEL));
- Private->LineBuffer[X] = (UINT8) ((Blt->Red & 0xe0) | ((Blt->Green >> 3) & 0x1c) | ((Blt->Blue >> 6) & 0x03));
- }
-
- Offset = (DstY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + DestinationX;
-
- if (((Offset & 0x03) == 0) && ((Width & 0x03) == 0)) {
- Private->PciIo->Mem.Write (
- Private->PciIo,
- EfiPciIoWidthUint32,
- 0,
- Offset,
- Width >> 2,
- Private->LineBuffer
- );
- } else {
- Private->PciIo->Mem.Write (
- Private->PciIo,
- EfiPciIoWidthUint8,
- 0,
- Offset,
- Width,
- Private->LineBuffer
- );
- }
- }
- break;
-
- default:
- break;
- }
-
- gBS->RestoreTPL (OriginalTPL);
-
- return EFI_SUCCESS;
-}
-
-//
-// Construction and Destruction functions
-//
-
-/**
- CirrusLogic5430UgaDrawConstructor
-
- TODO: Private - add argument and description to function comment
- TODO: EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-CirrusLogic5430UgaDrawConstructor (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
- )
-{
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UINTN Index;
-
- //
- // Fill in Private->UgaDraw protocol
- //
- UgaDraw = &Private->UgaDraw;
-
- UgaDraw->GetMode = CirrusLogic5430UgaDrawGetMode;
- UgaDraw->SetMode = CirrusLogic5430UgaDrawSetMode;
- UgaDraw->Blt = CirrusLogic5430UgaDrawBlt;
-
- //
- // Initialize the private data
- //
- Private->MaxMode = CIRRUS_LOGIC_5430_UGA_DRAW_MODE_COUNT;
- Private->CurrentMode = 0;
- for (Index = 0; Index < Private->MaxMode; Index++) {
- Private->ModeData[Index].HorizontalResolution = CirrusLogic5430VideoModes[Index].Width;
- Private->ModeData[Index].VerticalResolution = CirrusLogic5430VideoModes[Index].Height;
- Private->ModeData[Index].ColorDepth = 32;
- Private->ModeData[Index].RefreshRate = CirrusLogic5430VideoModes[Index].RefreshRate;
- }
-
- Private->HardwareNeedsStarting = TRUE;
- Private->LineBuffer = NULL;
-
- //
- // Initialize the hardware
- //
- UgaDraw->SetMode (
- UgaDraw,
- Private->ModeData[Private->CurrentMode].HorizontalResolution,
- Private->ModeData[Private->CurrentMode].VerticalResolution,
- Private->ModeData[Private->CurrentMode].ColorDepth,
- Private->ModeData[Private->CurrentMode].RefreshRate
- );
- DrawLogo (Private);
-
- return EFI_SUCCESS;
-}
-
-/**
- CirrusLogic5430UgaDrawDestructor
-
- TODO: Private - add argument and description to function comment
- TODO: EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-CirrusLogic5430UgaDrawDestructor (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
- )
-{
- return EFI_SUCCESS;
-}
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
- @param Address TODO: add argument description
- @param Data TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-outb (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- UINTN Address,
- UINT8 Data
- )
-{
- Private->PciIo->Io.Write (
- Private->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- Address,
- 1,
- &Data
- );
-}
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
- @param Address TODO: add argument description
- @param Data TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-outw (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- UINTN Address,
- UINT16 Data
- )
-{
- Private->PciIo->Io.Write (
- Private->PciIo,
- EfiPciIoWidthUint16,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- Address,
- 1,
- &Data
- );
-}
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
- @param Address TODO: add argument description
-
- TODO: add return values
-
-**/
-UINT8
-inb (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- UINTN Address
- )
-{
- UINT8 Data;
-
- Private->PciIo->Io.Read (
- Private->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- Address,
- 1,
- &Data
- );
- return Data;
-}
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
- @param Address TODO: add argument description
-
- TODO: add return values
-
-**/
-UINT16
-inw (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- UINTN Address
- )
-{
- UINT16 Data;
-
- Private->PciIo->Io.Read (
- Private->PciIo,
- EfiPciIoWidthUint16,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- Address,
- 1,
- &Data
- );
- return Data;
-}
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
- @param Index TODO: add argument description
- @param Red TODO: add argument description
- @param Green TODO: add argument description
- @param Blue TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-SetPaletteColor (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- UINTN Index,
- UINT8 Red,
- UINT8 Green,
- UINT8 Blue
- )
-{
- outb (Private, PALETTE_INDEX_REGISTER, (UINT8) Index);
- outb (Private, PALETTE_DATA_REGISTER, (UINT8) (Red >> 2));
- outb (Private, PALETTE_DATA_REGISTER, (UINT8) (Green >> 2));
- outb (Private, PALETTE_DATA_REGISTER, (UINT8) (Blue >> 2));
-}
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-SetDefaultPalette (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
- )
-{
- UINTN Index;
- UINTN RedIndex;
- UINTN GreenIndex;
- UINTN BlueIndex;
-
- Index = 0;
- for (RedIndex = 0; RedIndex < 8; RedIndex++) {
- for (GreenIndex = 0; GreenIndex < 8; GreenIndex++) {
- for (BlueIndex = 0; BlueIndex < 4; BlueIndex++) {
- SetPaletteColor (Private, Index, (UINT8) (RedIndex << 5), (UINT8) (GreenIndex << 5), (UINT8) (BlueIndex << 6));
- Index++;
- }
- }
- }
-}
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- TODO: add return values
-
-**/
-STATIC
-VOID
-ClearScreen (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
- )
-{
- UINT32 Color;
-
- Color = 0;
- Private->PciIo->Mem.Write (
- Private->PciIo,
- EfiPciIoWidthFillUint32,
- 0,
- 0,
- 0x100000 >> 2,
- &Color
- );
-}
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-DrawLogo (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private
- )
-{
- UINTN Offset;
- UINTN X;
- UINTN Y;
- UINTN ScreenWidth;
- UINTN ScreenHeight;
- UINT8 Color;
-
- ScreenWidth = Private->ModeData[Private->CurrentMode].HorizontalResolution;
- ScreenHeight = Private->ModeData[Private->CurrentMode].VerticalResolution;
-
- Offset = 0;
- for (Y = 0; Y < ScreenHeight; Y++) {
- for (X = 0; X < ScreenWidth; X++) {
- Color = (UINT8) (256 * (X + Y) / (ScreenWidth + ScreenHeight));
- Private->LineBuffer[X] = Color;
- }
-
- Private->PciIo->Mem.Write (
- Private->PciIo,
- EfiPciIoWidthUint32,
- 0,
- Offset + (Y * ScreenWidth),
- ScreenWidth >> 2,
- Private->LineBuffer
- );
- }
-}
-
-/**
- TODO: Add function description
-
- @param Private TODO: add argument description
- @param ModeData TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-InitializeGraphicsMode (
- CIRRUS_LOGIC_5430_PRIVATE_DATA *Private,
- CIRRUS_LOGIC_5430_VIDEO_MODES *ModeData
- )
-{
- UINT8 Byte;
- UINTN Index;
-
- outw (Private, SEQ_ADDRESS_REGISTER, 0x1206);
- outw (Private, SEQ_ADDRESS_REGISTER, 0x0012);
-
- for (Index = 0; Index < 15; Index++) {
- outw (Private, SEQ_ADDRESS_REGISTER, ModeData->SeqSettings[Index]);
- }
-
- outb (Private, SEQ_ADDRESS_REGISTER, 0x0f);
- Byte = (UINT8) ((inb (Private, SEQ_DATA_REGISTER) & 0xc7) ^ 0x30);
- outb (Private, SEQ_DATA_REGISTER, Byte);
-
- outb (Private, MISC_OUTPUT_REGISTER, ModeData->MiscSetting);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0506);
- outw (Private, SEQ_ADDRESS_REGISTER, 0x0300);
- outw (Private, CRTC_ADDRESS_REGISTER, 0x2011);
-
- for (Index = 0; Index < 28; Index++) {
- outw (Private, CRTC_ADDRESS_REGISTER, (UINT16) ((ModeData->CrtcSettings[Index] << 8) | Index));
- }
-
- for (Index = 0; Index < 9; Index++) {
- outw (Private, GRAPH_ADDRESS_REGISTER, (UINT16) ((GraphicsController[Index] << 8) | Index));
- }
-
- inb (Private, INPUT_STATUS_1_REGISTER);
-
- for (Index = 0; Index < 21; Index++) {
- outb (Private, ATT_ADDRESS_REGISTER, (UINT8) Index);
- outb (Private, ATT_ADDRESS_REGISTER, AttributeController[Index]);
- }
-
- outb (Private, ATT_ADDRESS_REGISTER, 0x20);
-
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x0009);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x000a);
- outw (Private, GRAPH_ADDRESS_REGISTER, 0x000b);
- outb (Private, DAC_PIXEL_MASK_REGISTER, 0xff);
-
- SetDefaultPalette (Private);
- ClearScreen (Private);
-}
diff --git a/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/ComponentName.c b/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/ComponentName.c
deleted file mode 100644
index 361bf83..0000000
--- a/EdkModulePkg/Bus/Pci/CirrusLogic/Dxe/ComponentName.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/** @file
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "CirrusLogic5430.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gCirrusLogic5430ComponentName = {
- CirrusLogic5430ComponentNameGetDriverName,
- CirrusLogic5430ComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mCirrusLogic5430DriverNameTable[] = {
- { "eng", (CHAR16 *) L"Cirrus Logic 5430 UGA Driver" },
- { NULL , NULL }
-};
-
-static EFI_UNICODE_STRING_TABLE mCirrusLogic5430ControllerNameTable[] = {
- { "eng", (CHAR16 *) L"Cirrus Logic 5430 PCI Adapter" },
- { NULL , NULL }
-};
-
-/**
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- @param Language A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- @param DriverName A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-CirrusLogic5430ComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString (
- Language,
- gCirrusLogic5430ComponentName.SupportedLanguages,
- mCirrusLogic5430DriverNameTable,
- DriverName
- );
-}
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- @param ControllerHandle The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- @param ChildHandle The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- @param Language A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- @param ControllerName A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-CirrusLogic5430ComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-{
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIoProtocol;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Check Controller's handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIoProtocol,
- gCirrusLogic5430DriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiPciIoProtocolGuid,
- gCirrusLogic5430DriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status != EFI_ALREADY_STARTED) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Get the UGA Draw Protocol on Controller
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw,
- gCirrusLogic5430DriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the Cirrus Logic 5430's Device structure
- //
- return LookupUnicodeString (
- Language,
- gCirrusLogic5430ComponentName.SupportedLanguages,
- mCirrusLogic5430ControllerNameTable,
- ControllerName
- );
-}
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/ComponentName.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/ComponentName.c
deleted file mode 100644
index 5d332e0..0000000
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/ComponentName.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*++
-
-Copyright 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "Ehci.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName = {
- EhciComponentNameGetDriverName,
- EhciComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mEhciDriverNameTable[] = {
- { "eng", L"UEFI Usb Ehci Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-EhciComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gEhciComponentName.SupportedLanguages,
- mEhciDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-EhciComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle, OPTIONAL
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *EhciDev;
- EFI_USB2_HC_PROTOCOL *Usb2Hc;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gEhciDriverBinding.DriverBindingHandle,
- &gEfiPciIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the device context
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsb2HcProtocolGuid,
- (VOID **) &Usb2Hc,
- gEhciDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- EhciDev = USB2_HC_DEV_FROM_THIS (Usb2Hc);
-
- return LookupUnicodeString (
- Language,
- gEhciComponentName.SupportedLanguages,
- EhciDev->ControllerNameTable,
- ControllerName
- );
-
-}
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Debug.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Debug.c
deleted file mode 100644
index a700d8f..0000000
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Debug.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Debug.c
-
-Abstract:
-
-
-Revision History
---*/
-
-
-#include "Ehci.h"
-
-
-VOID
-DumpEHCIPortsStatus (
- IN USB2_HC_DEV *HcDev
- )
-{
- UINT8 PortNumber;
- UINT8 Index;
- UINT32 Value;
-
- ReadEhcCapabiltiyReg (
- HcDev,
- HCSPARAMS,
- &Value
- );
-
- PortNumber = (UINT8) (Value & HCSP_NPORTS);
-
- for (Index = 0; Index < PortNumber; Index++) {
- ReadEhcOperationalReg (
- HcDev,
- PORTSC + 4 * Index,
- &Value
- );
- DEBUG((gEHCDebugLevel, "Port[%d] = 0x%x\n", Index, Value));
- }
-
-
-}
-
-
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c
deleted file mode 100644
index 9065a2a..0000000
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c
+++ /dev/null
@@ -1,2679 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ehci.c
-
-Abstract:
-
-
-Revision History
---*/
-
-
-#include "Ehci.h"
-
-
-GLOBAL_REMOVE_IF_UNREFERENCED UINTN gEHCDebugLevel = EFI_D_ERROR;
-GLOBAL_REMOVE_IF_UNREFERENCED UINTN gEHCErrorLevel = EFI_D_ERROR;
-
-
-//
-// Ehci Driver Global Variables
-//
-EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding = {
- EhciDriverBindingSupported,
- EhciDriverBindingStart,
- EhciDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-EFI_STATUS
-EFIAPI
-EhciDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
-
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- that has Usb2HcProtocol installed will be supported.
-
- Arguments:
-
- This - Protocol instance pointer.
- Controlle - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
-
- EFI_SUCCESS This driver supports this device.
- EFI_UNSUPPORTED This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- USB_CLASSC UsbClassCReg;
-
-
- //
- // Test whether there is PCI IO Protocol attached on the controller handle.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- goto exit;
- }
-
- Status = PciIo->Pci.Read (
- PciIo,
- EfiPciIoWidthUint8,
- CLASSC,
- sizeof (USB_CLASSC) / sizeof (UINT8),
- &UsbClassCReg
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- Status = EFI_UNSUPPORTED;
- goto exit;
- }
-
- //
- // Test whether the controller belongs to Ehci type
- //
- if ((UsbClassCReg.BaseCode != PCI_CLASS_SERIAL) ||
- (UsbClassCReg.SubClassCode != PCI_CLASS_SERIAL_USB) ||
- (UsbClassCReg.PI != PCI_CLASSC_PI_EHCI)
- ) {
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- Status = EFI_UNSUPPORTED;
- goto exit;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
-
- Starting the Usb EHCI Driver
-
- Arguments:
-
- This - Protocol instance pointer.
- Controller - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
-
- EFI_SUCCESS supports this device.
- EFI_UNSUPPORTED do not support this device.
- EFI_DEVICE_ERROR cannot be started due to device Error
- EFI_OUT_OF_RESOURCES cannot allocate resources
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT8 MaxSpeed;
- UINT8 PortNumber;
- UINT8 Is64BitCapable;
- UINT64 Supports;
-
- //
- // Open the PciIo Protocol
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
-
- //
- // Enable the USB Host Controller
- //
- Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationSupported,
- 0,
- &Supports
- );
- if (!EFI_ERROR (Status)) {
- Supports &= EFI_PCI_DEVICE_ENABLE;
- Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationEnable,
- Supports,
- NULL
- );
- }
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto close_pciio_protocol;
- }
-
- //
- // Allocate memory for EHC private data structure
- //
- HcDev = AllocateZeroPool (sizeof (USB2_HC_DEV));
- if (NULL == HcDev) {
- Status = EFI_OUT_OF_RESOURCES;
- goto close_pciio_protocol;
- }
-
- //
- // Init EFI_USB2_HC_PROTOCOL interface and private data structure
- //
- HcDev->Usb2Hc.GetCapability = EhciGetCapability;
- HcDev->Usb2Hc.Reset = EhciReset;
- HcDev->Usb2Hc.GetState = EhciGetState;
- HcDev->Usb2Hc.SetState = EhciSetState;
- HcDev->Usb2Hc.ControlTransfer = EhciControlTransfer;
- HcDev->Usb2Hc.BulkTransfer = EhciBulkTransfer;
- HcDev->Usb2Hc.AsyncInterruptTransfer = EhciAsyncInterruptTransfer;
- HcDev->Usb2Hc.SyncInterruptTransfer = EhciSyncInterruptTransfer;
- HcDev->Usb2Hc.IsochronousTransfer = EhciIsochronousTransfer;
- HcDev->Usb2Hc.AsyncIsochronousTransfer = EhciAsyncIsochronousTransfer;
- HcDev->Usb2Hc.GetRootHubPortStatus = EhciGetRootHubPortStatus;
- HcDev->Usb2Hc.SetRootHubPortFeature = EhciSetRootHubPortFeature;
- HcDev->Usb2Hc.ClearRootHubPortFeature = EhciClearRootHubPortFeature;
- HcDev->Usb2Hc.MajorRevision = 0x1;
- HcDev->Usb2Hc.MinorRevision = 0x1;
-
- HcDev->AsyncRequestList = NULL;
- HcDev->ControllerNameTable = NULL;
- HcDev->Signature = USB2_HC_DEV_SIGNATURE;
- HcDev->PciIo = PciIo;
-
- //
- // Install USB2_HC_PROTOCOL
- //
- Status = gBS->InstallProtocolInterface (
- &Controller,
- &gEfiUsb2HcProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &HcDev->Usb2Hc
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto free_pool;
- }
-
- //
- // Get Capability Register Length
- //
- Status = GetCapabilityLen (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto uninstall_usb2hc_protocol;
- }
-
- ClearLegacySupport (HcDev);
- HostReset (HcDev);
-
- DEBUG_CODE (
- DumpEHCIPortsStatus (HcDev);
- );
-
- //
- // Create and Init Perodic Frame List
- //
- Status = EhciGetCapability (
- &HcDev->Usb2Hc,
- &MaxSpeed,
- &PortNumber,
- &Is64BitCapable
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto uninstall_usb2hc_protocol;
- }
- HcDev->Is64BitCapable = Is64BitCapable;
-
- //
- // Create and Init Perodic Frame List
- //
- Status = InitialPeriodicFrameList (
- HcDev,
- EHCI_MAX_FRAME_LIST_LENGTH
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto uninstall_usb2hc_protocol;
- }
-
- //
- // Init memory pool management
- //
- Status = InitialMemoryManagement (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto deinit_perodic_frame_list;
- }
-
- Status = CreateNULLQH (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto deinit_perodic_frame_list;
- }
- //
- // Create AsyncRequest Polling Timer
- //
- Status = CreatePollingTimer (HcDev, (EFI_EVENT_NOTIFY) AsyncRequestMoniter);
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto deinit_null_qh;
- }
-
- //
- // Default Maxximum Interrupt Interval is 8,
- // it means that 8 micro frame = 1ms
- //
-
- //
- // Start the Host Controller
- //
- if (IsEhcHalted (HcDev)) {
- Status = StartScheduleExecution (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto deinit_timer;
- }
- }
-
- //
- // Set all ports routing to EHC
- //
- Status = SetPortRoutingEhc (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto deinit_timer;
- }
-
- //
- // Component name protocol
- //
- Status = AddUnicodeString (
- "eng",
- gEhciComponentName.SupportedLanguages,
- &HcDev->ControllerNameTable,
- L"Usb Enhanced Host Controller"
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto deinit_timer;
- }
-
- goto exit;
-
- //
- // Error handle process
- //
-deinit_timer:
- DestoryPollingTimer (HcDev);
-deinit_null_qh:
- DestroyNULLQH(HcDev);
- DeinitialMemoryManagement (HcDev);
-deinit_perodic_frame_list:
- DeinitialPeriodicFrameList (HcDev);
-uninstall_usb2hc_protocol:
- gBS->UninstallProtocolInterface (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- &HcDev->Usb2Hc
- );
-free_pool:
- gBS->FreePool (HcDev);
-close_pciio_protocol:
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
-
- Stop this driver on ControllerHandle. Support stoping any child handles
- created by this driver.
-
- Arguments:
-
- This - Protocol instance pointer.
- Controller - Handle of device to stop driver on
- NumberOfChildren - Number of Children in the ChildHandleBuffer
- ChildHandleBuffer - List of handles for the children we need to stop.
-
- Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
---*/
-{
- EFI_STATUS Status;
- EFI_USB2_HC_PROTOCOL *Usb2Hc;
- USB2_HC_DEV *HcDev;
- UINT64 Supports;
-
- //
- // Test whether the Controller handler passed in is a valid
- // Usb controller handle that should be supported, if not,
- // return the error status directly
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- (VOID **) &Usb2Hc,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- HcDev = USB2_HC_DEV_FROM_THIS (Usb2Hc);
-
- //
- // free all the controller related memory and uninstall UHCI Protocol.
- //
- Status = gBS->UninstallProtocolInterface (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- Usb2Hc
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Set Host Controller state as halt
- //
- Status = Usb2Hc->SetState (
- Usb2Hc,
- EfiUsbHcStateHalt
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Stop AsyncRequest Polling Timer
- //
- Status = StopPollingTimer (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Destroy Asynchronous Request Event
- //
- DestoryPollingTimer (HcDev);
-
- //
- // Destroy Perodic Frame List
- //
- DeinitialPeriodicFrameList (HcDev);
-
- //
- // Destroy NULLQH
- //
- DestroyNULLQH (HcDev);
-
- //
- // Deinit Ehci pool memory management
- //
- DeinitialMemoryManagement (HcDev);
-
- //
- // Denint Unicode String Table
- //
- FreeUnicodeStringTable (HcDev->ControllerNameTable);
-
- //
- // Disable the USB Host Controller
- //
- Status = HcDev->PciIo->Attributes (
- HcDev->PciIo,
- EfiPciIoAttributeOperationSupported,
- 0,
- &Supports
- );
- if (!EFI_ERROR (Status)) {
- Supports &= EFI_PCI_DEVICE_ENABLE;
- Status = HcDev->PciIo->Attributes (
- HcDev->PciIo,
- EfiPciIoAttributeOperationDisable,
- Supports,
- NULL
- );
- }
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- gBS->FreePool (HcDev);
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciGetCapability (
- IN EFI_USB2_HC_PROTOCOL *This,
- OUT UINT8 *MaxSpeed,
- OUT UINT8 *PortNumber,
- OUT UINT8 *Is64BitCapable
- )
-/*++
-
- Routine Description:
-
- Retrieves the capablility of root hub ports.
-
- Arguments:
-
- This - A pointer to the EFI_USB_HC_PROTOCOL instance.
- MaxSpeed - A pointer to the number of the host controller.
- PortNumber - A pointer to the number of the root hub ports.
- Is64BitCapable - A pointer to the flag for whether controller supports
- 64-bit memory addressing.
-
- Returns:
-
- EFI_SUCCESS host controller capability were retrieved successfully.
- EFI_INVALID_PARAMETER MaxSpeed or PortNumber or Is64BitCapable is NULL.
- EFI_DEVICE_ERROR An error was encountered while attempting to retrieve the capabilities.
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINT32 HcStructParamsAddr;
- UINT32 HcStructParamsReg;
- UINT32 HcCapParamsAddr;
- UINT32 HcCapParamsReg;
-
- if (MaxSpeed == NULL || PortNumber == NULL || Is64BitCapable == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- HcStructParamsAddr = HCSPARAMS;
- HcCapParamsAddr = HCCPARAMS;
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- Status = ReadEhcCapabiltiyReg (
- HcDev,
- HcStructParamsAddr,
- &HcStructParamsReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = ReadEhcCapabiltiyReg (
- HcDev,
- HcCapParamsAddr,
- &HcCapParamsReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- *MaxSpeed = EFI_USB_SPEED_HIGH;
- *PortNumber = (UINT8) (HcStructParamsReg & HCSP_NPORTS);
- *Is64BitCapable = (UINT8) (HcCapParamsReg & HCCP_64BIT);
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciReset (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT16 Attributes
- )
-/*++
-
- Routine Description:
-
- Provides software reset for the USB host controller.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
- Attributes - A bit mask of the reset operation to perform.
- See below for a list of the supported bit mask values.
-
- #define EFI_USB_HC_RESET_GLOBAL 0x0001
- #define EFI_USB_HC_RESET_HOST_CONTROLLER 0x0002
- #define EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG 0x0004
- #define EFI_USB_HC_RESET_HOST_WITH_DEBUG 0x0008
-
- EFI_USB_HC_RESET_GLOBAL
- If this bit is set, a global reset signal will be sent to the USB bus.
- This resets all of the USB bus logic, including the USB host
- controller hardware and all the devices attached on the USB bus.
- EFI_USB_HC_RESET_HOST_CONTROLLER
- If this bit is set, the USB host controller hardware will be reset.
- No reset signal will be sent to the USB bus.
- EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG
- If this bit is set, a global reset signal will be sent to the USB bus.
- This resets all of the USB bus logic, including the USB host
- controller hardware and all the devices attached on the USB bus.
- If this is an EHCI controller and the debug port has configured, then
- this is will still reset the host controller.
- EFI_USB_HC_RESET_HOST_WITH_DEBUG
- If this bit is set, the USB host controller hardware will be reset.
- If this is an EHCI controller and the debug port has been configured,
- then this will still reset the host controller.
-
- Returns:
-
- EFI_SUCCESS
- The reset operation succeeded.
- EFI_INVALID_PARAMETER
- Attributes is not valid.
- EFI_UNSUPPOURTED
- The type of reset specified by Attributes is not currently supported by
- the host controller hardware.
- EFI_ACCESS_DENIED
- Reset operation is rejected due to the debug port being configured and
- active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or
- EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Atrributes can be used to
- perform reset operation for this host controller.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to perform
- the reset operation.
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINTN FrameIndex;
- FRAME_LIST_ENTRY *FrameEntryPtr;
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- switch (Attributes) {
-
- case EFI_USB_HC_RESET_GLOBAL:
-
- //
- // Same behavior as Host Controller Reset
- //
-
- case EFI_USB_HC_RESET_HOST_CONTROLLER:
-
- //
- // Host Controller must be Halt when Reset it
- //
- if (IsEhcHalted (HcDev)) {
- Status = ResetEhc (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- //
- // Set to zero by Host Controller when reset process completes
- //
- Status = WaitForEhcReset (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- Status = EFI_TIMEOUT;
- goto exit;
- }
- } else {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // only asynchronous interrupt transfers are always alive on the bus, need to cleanup
- //
- CleanUpAllAsyncRequestTransfer (HcDev);
- Status = ClearEhcAllStatus (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Set appropriate 4G Segment Selector
- //
- Status = SetCtrlDataStructSeg (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Init Perodic List Base Addr and Frame List
- //
- Status = SetFrameListBaseAddr (
- HcDev,
- (UINT32)GET_0B_TO_31B (HcDev->PeriodicFrameListBuffer)
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- FrameEntryPtr = (FRAME_LIST_ENTRY *) HcDev->PeriodicFrameListBuffer;
- for (FrameIndex = 0; FrameIndex < HcDev->PeriodicFrameListLength; FrameIndex++) {
- FrameEntryPtr->LinkTerminate = TRUE;
- FrameEntryPtr++;
- }
-
- //
- // Start the Host Controller
- //
- if (IsEhcHalted (HcDev)) {
- Status = StartScheduleExecution (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- }
-
- //
- // Set all ports routing to EHC
- //
- Status = SetPortRoutingEhc (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- break;
-
- case EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG:
-
- Status = EFI_UNSUPPORTED;
- break;
-
- case EFI_USB_HC_RESET_HOST_WITH_DEBUG:
-
- Status = EFI_UNSUPPORTED;
- break;
-
- default:
- Status = EFI_INVALID_PARAMETER;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciGetState (
- IN EFI_USB2_HC_PROTOCOL *This,
- OUT EFI_USB_HC_STATE *State
- )
-/*++
-
- Routine Description:
-
- Retrieves current state of the USB host controller.
-
- Arguments:
-
- This A pointer to the EFI_USB2_HC_PROTOCOL instance.
- State A pointer to the EFI_USB_HC_STATE data structure that
- indicates current state of the USB host controller.
- Type EFI_USB_HC_STATE is defined below.
-
- typedef enum {
- EfiUsbHcStateHalt,
- EfiUsbHcStateOperational,
- EfiUsbHcStateSuspend,
- EfiUsbHcStateMaximum
- } EFI_USB_HC_STATE;
-
- Returns:
-
- EFI_SUCCESS
- The state information of the host controller was returned in State.
- EFI_INVALID_PARAMETER
- State is NULL.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to retrieve the
- host controller's current state.
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINT32 UsbStatusAddr;
- UINT32 UsbStatusReg;
-
- if (State == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- UsbStatusAddr = USBSTS;
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbStatusAddr,
- &UsbStatusReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- if (UsbStatusReg & USBSTS_HCH) {
- *State = EfiUsbHcStateHalt;
- } else {
- *State = EfiUsbHcStateOperational;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciSetState (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN EFI_USB_HC_STATE State
- )
-/*++
-
- Routine Description:
-
- Sets the USB host controller to a specific state.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
- State - Indicates the state of the host controller that will be set.
-
- Returns:
-
- EFI_SUCCESS
- The USB host controller was successfully placed in the state
- specified by State.
- EFI_INVALID_PARAMETER
- State is invalid.
- EFI_DEVICE_ERROR
- Failed to set the state specified by State due to device error.
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
- EFI_USB_HC_STATE CurrentState;
-
- UsbCommandAddr = USBCMD;
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- Status = EhciGetState (This, &CurrentState);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- switch (State) {
-
- case EfiUsbHcStateHalt:
-
- if (EfiUsbHcStateHalt == CurrentState) {
- Status = EFI_SUCCESS;
- goto exit;
- } else if (EfiUsbHcStateOperational == CurrentState) {
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- UsbCommandReg &= ~USBCMD_RS;
- Status = WriteEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- //
- // Ensure the HC is in halt status after send the stop command
- //
- Status = WaitForEhcHalt (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- Status = EFI_TIMEOUT;
- goto exit;
- }
- }
- break;
-
- case EfiUsbHcStateOperational:
-
- if (IsEhcSysError (HcDev)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- if (EfiUsbHcStateOperational == CurrentState) {
- Status = EFI_SUCCESS;
- goto exit;
- } else if (EfiUsbHcStateHalt == CurrentState) {
- //
- // Set Host Controller Run
- //
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- UsbCommandReg |= USBCMD_RS;
- Status = WriteEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- }
- break;
-
- case EfiUsbHcStateSuspend:
-
- Status = EFI_UNSUPPORTED;
- break;
-
- default:
-
- Status = EFI_INVALID_PARAMETER;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciGetRootHubPortStatus (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS *PortStatus
- )
-/*++
-
- Routine Description:
-
- Retrieves the current status of a USB root hub port.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL.
- PortNumber - Specifies the root hub port from which the status
- is to be retrieved. This value is zero-based. For example,
- if a root hub has two ports, then the first port is numbered 0,
- and the second port is numbered 1.
- PortStatus - A pointer to the current port status bits and
- port status change bits.
-
- Returns:
-
- EFI_SUCCESS The status of the USB root hub port specified
- by PortNumber was returned in PortStatus.
- EFI_INVALID_PARAMETER PortNumber is invalid.
- EFI_DEVICE_ERROR Can't read register
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINT32 PortStatusControlAddr;
- UINT32 PortStatusControlReg;
- UINT8 MaxSpeed;
- UINT8 TotalPortNumber;
- UINT8 Is64BitCapable;
-
- if (PortStatus == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- EhciGetCapability (
- This,
- &MaxSpeed,
- &TotalPortNumber,
- &Is64BitCapable
- );
-
- if (PortNumber >= TotalPortNumber) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
- PortStatusControlAddr = (UINT32) (PORTSC + (4 * PortNumber));
-
- //
- // Clear port status
- //
- PortStatus->PortStatus = 0;
- PortStatus->PortChangeStatus = 0;
-
- Status = ReadEhcOperationalReg (
- HcDev,
- PortStatusControlAddr,
- &PortStatusControlReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Fill Port Status bits
- //
-
- //
- // Current Connect Status
- //
- if (PORTSC_CCS & PortStatusControlReg) {
- PortStatus->PortStatus |= USB_PORT_STAT_CONNECTION;
- }
- //
- // Port Enabled/Disabled
- //
- if (PORTSC_PED & PortStatusControlReg) {
- PortStatus->PortStatus |= USB_PORT_STAT_ENABLE;
- }
- //
- // Port Suspend
- //
- if (PORTSC_SUSP & PortStatusControlReg) {
- PortStatus->PortStatus |= USB_PORT_STAT_SUSPEND;
- }
- //
- // Over-current Active
- //
- if (PORTSC_OCA & PortStatusControlReg) {
- PortStatus->PortStatus |= USB_PORT_STAT_OVERCURRENT;
- }
- //
- // Port Reset
- //
- if (PORTSC_PR & PortStatusControlReg) {
- PortStatus->PortStatus |= USB_PORT_STAT_RESET;
- }
- //
- // Port Power
- //
- if (PORTSC_PP & PortStatusControlReg) {
- PortStatus->PortStatus |= USB_PORT_STAT_POWER;
- }
- //
- // Port Owner
- //
- if (PORTSC_PO & PortStatusControlReg) {
- PortStatus->PortStatus |= USB_PORT_STAT_OWNER;
- }
- //
- // Identify device speed
- //
- if (PORTSC_LS_KSTATE & PortStatusControlReg) {
- //
- // Low Speed Device Attached
- //
- PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
- } else {
- //
- // Not Low Speed Device Attached
- //
- if ((PORTSC_CCS & PortStatusControlReg) && (PORTSC_CSC & PortStatusControlReg)) {
- HcDev->DeviceSpeed[PortNumber] = (UINT16) (IsHighSpeedDevice (This, PortNumber) ? USB_PORT_STAT_HIGH_SPEED : 0);
- }
- PortStatus->PortStatus = (UINT16) (PortStatus->PortStatus | HcDev->DeviceSpeed[PortNumber]);
- }
- //
- // Fill Port Status Change bits
- //
- //
- // Connect Status Change
- //
- if (PORTSC_CSC & PortStatusControlReg) {
- PortStatus->PortChangeStatus |= USB_PORT_STAT_C_CONNECTION;
- }
- //
- // Port Enabled/Disabled Change
- //
- if (PORTSC_PEDC & PortStatusControlReg) {
- PortStatus->PortChangeStatus |= USB_PORT_STAT_C_ENABLE;
- }
- //
- // Port Over Current Change
- //
- if (PORTSC_OCC & PortStatusControlReg) {
- PortStatus->PortChangeStatus |= USB_PORT_STAT_C_OVERCURRENT;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciSetRootHubPortFeature (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-/*++
-
- Routine Description:
-
- Sets a feature for the specified root hub port.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL.
- PortNumber - Specifies the root hub port whose feature
- is requested to be set.
- PortFeature - Indicates the feature selector associated
- with the feature set request.
-
- Returns:
-
- EFI_SUCCESS
- The feature specified by PortFeature was set for the
- USB root hub port specified by PortNumber.
- EFI_INVALID_PARAMETER
- PortNumber is invalid or PortFeature is invalid.
- EFI_DEVICE_ERROR
- Can't read register
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINT32 PortStatusControlAddr;
- UINT32 PortStatusControlReg;
- UINT8 MaxSpeed;
- UINT8 TotalPortNumber;
- UINT8 Is64BitCapable;
-
- EhciGetCapability (
- This,
- &MaxSpeed,
- &TotalPortNumber,
- &Is64BitCapable
- );
-
- if (PortNumber >= TotalPortNumber) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
- PortStatusControlAddr = (UINT32) (PORTSC + (4 * PortNumber));
-
- Status = ReadEhcOperationalReg (
- HcDev,
- PortStatusControlAddr,
- &PortStatusControlReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- switch (PortFeature) {
-
- case EfiUsbPortEnable:
-
- //
- // Sofeware can't set this bit, Port can only be enable by the Host Controller
- // as a part of the reset and enable
- //
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg |= PORTSC_PED;
- break;
-
- case EfiUsbPortSuspend:
-
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg |= PORTSC_SUSP;
- break;
-
- case EfiUsbPortReset:
-
- //
- // Make sure Host Controller not halt before reset it
- //
- if (IsEhcHalted (HcDev)) {
- Status = StartScheduleExecution (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- Status = WaitForEhcNotHalt (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- DEBUG ((gEHCDebugLevel, "EHCI: WaitForEhcNotHalt TimeOut\n"));
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- }
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg |= PORTSC_PR;
- //
- // Set one to PortReset bit must also set zero to PortEnable bit
- //
- PortStatusControlReg &= ~PORTSC_PED;
- break;
-
- case EfiUsbPortPower:
-
- //
- // No support, no operation
- //
- goto exit;
-
- case EfiUsbPortOwner:
-
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg |= PORTSC_PO;
- break;
-
- default:
-
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- Status = WriteEhcOperationalReg (
- HcDev,
- PortStatusControlAddr,
- PortStatusControlReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciClearRootHubPortFeature (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-/*++
-
- Routine Description:
-
- Clears a feature for the specified root hub port.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
- PortNumber - Specifies the root hub port whose feature
- is requested to be cleared.
- PortFeature - Indicates the feature selector associated with the
- feature clear request.
-
- Returns:
-
- EFI_SUCCESS
- The feature specified by PortFeature was cleared for the
- USB root hub port specified by PortNumber.
- EFI_INVALID_PARAMETER
- PortNumber is invalid or PortFeature is invalid.
- EFI_DEVICE_ERROR
- Can't read register
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINT32 PortStatusControlAddr;
- UINT32 PortStatusControlReg;
- UINT8 MaxSpeed;
- UINT8 TotalPortNumber;
- UINT8 Is64BitCapable;
-
- EhciGetCapability (
- This,
- &MaxSpeed,
- &TotalPortNumber,
- &Is64BitCapable
- );
-
- if (PortNumber >= TotalPortNumber) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
- PortStatusControlAddr = (UINT32) (PORTSC + (4 * PortNumber));
-
- Status = ReadEhcOperationalReg (
- HcDev,
- PortStatusControlAddr,
- &PortStatusControlReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- switch (PortFeature) {
-
- case EfiUsbPortEnable:
-
- //
- // Clear PORT_ENABLE feature means disable port.
- //
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg &= ~PORTSC_PED;
- break;
-
- case EfiUsbPortSuspend:
-
- //
- // A write of zero to this bit is ignored by the host controller.
- // The host controller will unconditionally set this bit to a zero when:
- // 1. software sets the Forct Port Resume bit to a zero from a one.
- // 2. software sets the Port Reset bit to a one frome a zero.
- //
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg &= ~PORTSC_FPR;
- break;
-
- case EfiUsbPortReset:
-
- //
- // Clear PORT_RESET means clear the reset signal.
- //
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg &= ~PORTSC_PR;
- break;
-
- case EfiUsbPortPower:
-
- //
- // No support, no operation
- //
- goto exit;
-
- case EfiUsbPortOwner:
-
- //
- // Clear port owner means this port owned by EHC
- //
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg &= ~PORTSC_PO;
- break;
-
- case EfiUsbPortConnectChange:
-
- //
- // Clear connect status change
- //
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg |= PORTSC_CSC;
- break;
-
- case EfiUsbPortEnableChange:
-
- //
- // Clear enable status change
- //
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg |= PORTSC_PEDC;
- break;
-
- case EfiUsbPortSuspendChange:
-
- //
- // No related bit, no operation
- //
- goto exit;
-
- case EfiUsbPortOverCurrentChange:
-
- //
- // Clear PortOverCurrent change
- //
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg |= PORTSC_OCC;
- break;
-
- case EfiUsbPortResetChange:
-
- //
- // No related bit, no operation
- //
- goto exit;
-
- default:
-
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- Status = WriteEhcOperationalReg (
- HcDev,
- PortStatusControlAddr,
- PortStatusControlReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciControlTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Submits control transfer to a target USB device.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- DeviceSpeed - Indicates target device speed.
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
- Request - A pointer to the USB device request that will be sent
- to the USB device.
- TransferDirection - Specifies the data direction for the transfer.
- There are three values available, DataIn, DataOut
- and NoData.
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- DataLength - Indicates the size, in bytes, of the data buffer
- specified by Data.
- TimeOut - Indicates the maximum time, in microseconds,
- which the transfer is allowed to complete.
- Translator - A pointr to the transaction translator data.
- TransferResult - A pointer to the detailed result information generated
- by this control transfer.
-
- Returns:
-
- EFI_SUCCESS
- The control transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The control transfer could not be completed due to a lack of resources.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The control transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The control transfer failed due to host controller or device error.
- Caller should check TranferResult for detailed error information.
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINT8 PktId;
- EHCI_QH_ENTITY *QhPtr;
- EHCI_QTD_ENTITY *ControlQtdsPtr;
- UINT8 *DataCursor;
- VOID *DataMap;
- UINT8 *RequestCursor;
- VOID *RequestMap;
-
- QhPtr = NULL;
- ControlQtdsPtr = NULL;
- DataCursor = NULL;
- DataMap = NULL;
- RequestCursor = NULL;
- RequestMap = NULL;
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- //
- // Parameters Checking
- //
- if (TransferDirection != EfiUsbDataIn &&
- TransferDirection != EfiUsbDataOut &&
- TransferDirection != EfiUsbNoData
- ) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (EfiUsbNoData == TransferDirection) {
- if (NULL != Data || 0 != *DataLength) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
- } else {
- if (NULL == Data || 0 == *DataLength) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
- }
-
- if (Request == NULL || TransferResult == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (EFI_USB_SPEED_LOW == DeviceSpeed) {
- if (MaximumPacketLength != 8) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
- } else if (MaximumPacketLength != 8 &&
- MaximumPacketLength != 16 &&
- MaximumPacketLength != 32 &&
- MaximumPacketLength != 64
- ) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- //
- // If errors exist that cause host controller halt,
- // then return EFI_DEVICE_ERROR.
- //
- if (IsEhcHalted (HcDev) || IsEhcSysError (HcDev)) {
- ClearEhcAllStatus (HcDev);
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Map the Request for bus master access.
- // BusMasterRead means cpu write
- //
- Status = MapRequestBuffer (
- HcDev,
- Request,
- &RequestCursor,
- &RequestMap
- );
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Map the source data buffer for bus master access.
- //
- Status = MapDataBuffer (
- HcDev,
- TransferDirection,
- Data,
- DataLength,
- &PktId,
- &DataCursor,
- &DataMap
- );
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_DEVICE_ERROR;
- goto unmap_request;
- }
-
- //
- // Create and init control Qh
- //
- Status = CreateControlQh (
- HcDev,
- DeviceAddress,
- DeviceSpeed,
- MaximumPacketLength,
- Translator,
- &QhPtr
- );
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_OUT_OF_RESOURCES;
- goto unmap_data;
- }
-
- //
- // Create and init control Qtds
- //
- Status = CreateControlQtds (
- HcDev,
- PktId,
- RequestCursor,
- DataCursor,
- *DataLength,
- Translator,
- &ControlQtdsPtr
- );
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_OUT_OF_RESOURCES;
- goto destory_qh;
- }
-
- //
- // Link Qtds to Qh
- //
- LinkQtdToQh (QhPtr, ControlQtdsPtr);
-
- ClearEhcAllStatus (HcDev);
-
- //
- // Link Qh and Qtds to Async Schedule List
- //
- Status = LinkQhToAsyncList (HcDev, QhPtr);
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_DEVICE_ERROR;
- goto destory_qtds;
- }
-
- //
- // Poll Qh-Qtds execution and get result.
- // detail status is returned
- //
- Status = ExecuteTransfer (
- HcDev,
- TRUE,
- QhPtr,
- DataLength,
- 0,
- TimeOut,
- TransferResult
- );
- if (EFI_ERROR (Status)) {
- goto destory_qtds;
- }
-
- //
- // If has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (IsEhcHalted (HcDev) || IsEhcSysError (HcDev)) {
- *TransferResult |= EFI_USB_ERR_SYSTEM;
- }
-
- ClearEhcAllStatus (HcDev);
-
-destory_qtds:
- UnlinkQhFromAsyncList (HcDev, QhPtr);
- DestoryQtds (HcDev, ControlQtdsPtr);
-destory_qh:
- DestoryQh (HcDev, QhPtr);
-unmap_data:
- HcDev->PciIo->Unmap (HcDev->PciIo, DataMap);
-unmap_request:
- HcDev->PciIo->Unmap (HcDev->PciIo, RequestMap);
-exit:
- HcDev->PciIo->Flush (HcDev->PciIo);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciBulkTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Submits bulk transfer to a bulk endpoint of a USB device.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - The combination of an endpoint number and an
- endpoint direction of the target USB device.
- Each endpoint address supports data transfer in
- one direction except the control endpoint
- (whose default endpoint address is 0).
- It is the caller's responsibility to make sure that
- the EndPointAddress represents a bulk endpoint.
- DeviceSpeed - Indicates device speed. The supported values are EFI_USB_SPEED_FULL
- and EFI_USB_SPEED_HIGH.
- MaximumPacketLength - Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
- DataBuffersNumber - Number of data buffers prepared for the transfer.
- Data - Array of pointers to the buffers of data that will be transmitted
- to USB device or received from USB device.
- DataLength - When input, indicates the size, in bytes, of the data buffer
- specified by Data. When output, indicates the actually
- transferred data size.
- DataToggle - A pointer to the data toggle value. On input, it indicates
- the initial data toggle value the bulk transfer should adopt;
- on output, it is updated to indicate the data toggle value
- of the subsequent bulk transfer.
- Translator - A pointr to the transaction translator data.
- TimeOut - Indicates the maximum time, in microseconds, which the
- transfer is allowed to complete.
- TransferResult - A pointer to the detailed result information of the
- bulk transfer.
-
- Returns:
-
- EFI_SUCCESS
- The bulk transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The bulk transfer could not be submitted due to lack of resource.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The bulk transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The bulk transfer failed due to host controller or device error.
- Caller should check TranferResult for detailed error information.
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINT8 PktId;
- EHCI_QH_ENTITY *QhPtr;
- EHCI_QTD_ENTITY *BulkQtdsPtr;
- UINT8 *DataCursor;
- VOID *DataMap;
- EFI_USB_DATA_DIRECTION TransferDirection;
-
- QhPtr = NULL;
- BulkQtdsPtr = NULL;
- DataCursor = NULL;
- DataMap = NULL;
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- //
- // Parameters Checking
- //
- if (NULL == DataLength ||
- NULL == Data ||
- NULL == Data[0] ||
- NULL == TransferResult
- ) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (*DataLength == 0) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (1 != *DataToggle && 0 != *DataToggle) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (EFI_USB_SPEED_LOW == DeviceSpeed) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (EFI_USB_SPEED_FULL == DeviceSpeed) {
- if (MaximumPacketLength > 64) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
- }
-
- if (EFI_USB_SPEED_HIGH == DeviceSpeed) {
- if (MaximumPacketLength > 512) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
- }
-
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (IsEhcHalted (HcDev) || IsEhcSysError (HcDev)) {
- ClearEhcAllStatus (HcDev);
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = ClearEhcAllStatus (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // construct QH and TD data structures,
- // and link them together
- //
- if (EndPointAddress & 0x80) {
- TransferDirection = EfiUsbDataIn;
- } else {
- TransferDirection = EfiUsbDataOut;
- }
-
- Status = MapDataBuffer (
- HcDev,
- TransferDirection,
- Data[0],
- DataLength,
- &PktId,
- &DataCursor,
- &DataMap
- );
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Create and init Bulk Qh
- //
- Status = CreateBulkQh (
- HcDev,
- DeviceAddress,
- EndPointAddress,
- DeviceSpeed,
- *DataToggle,
- MaximumPacketLength,
- Translator,
- &QhPtr
- );
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_OUT_OF_RESOURCES;
- goto unmap_data;
- }
-
- //
- // Create and init Bulk Qtds
- //
- Status = CreateBulkOrInterruptQtds (
- HcDev,
- PktId,
- DataCursor,
- *DataLength,
- Translator,
- &BulkQtdsPtr
- );
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_OUT_OF_RESOURCES;
- goto destory_qh;
- }
-
- //
- // Link Qtds to Qh
- //
- LinkQtdToQh (QhPtr, BulkQtdsPtr);
-
- ClearEhcAllStatus (HcDev);
-
- //
- // Link Qh and qtds to Async Schedule List
- //
- Status = LinkQhToAsyncList (HcDev, QhPtr);
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_DEVICE_ERROR;
- goto destory_qtds;
- }
-
- //
- // Poll QH-TDs execution and get result.
- // detail status is returned
- //
- Status = ExecuteTransfer (
- HcDev,
- FALSE,
- QhPtr,
- DataLength,
- DataToggle,
- TimeOut,
- TransferResult
- );
- if (EFI_ERROR (Status)) {
- goto destory_qtds;
- }
-
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (IsEhcHalted (HcDev) || IsEhcSysError (HcDev)) {
- *TransferResult |= EFI_USB_ERR_SYSTEM;
- }
-
- ClearEhcAllStatus (HcDev);
-
-destory_qtds:
- UnlinkQhFromAsyncList (HcDev, QhPtr);
- DestoryQtds (HcDev, BulkQtdsPtr);
-destory_qh:
- DestoryQh (HcDev, QhPtr);
-unmap_data:
- HcDev->PciIo->Unmap (HcDev->PciIo, DataMap);
-exit:
- HcDev->PciIo->Flush (HcDev->PciIo);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciAsyncInterruptTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN BOOLEAN IsNewTransfer,
- IN OUT UINT8 *DataToggle,
- IN UINTN PollingInterval,
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR * Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
- IN VOID *Context OPTIONAL
- )
-/*++
-
- Routine Description:
-
- Submits an asynchronous interrupt transfer to an
- interrupt endpoint of a USB device.
- Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated
- in the following specification version.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - The combination of an endpoint number and an endpoint
- direction of the target USB device. Each endpoint address
- supports data transfer in one direction except the
- control endpoint (whose default endpoint address is 0).
- It is the caller's responsibility to make sure that
- the EndPointAddress represents an interrupt endpoint.
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
- IsNewTransfer - If TRUE, an asynchronous interrupt pipe is built between
- the host and the target interrupt endpoint.
- If FALSE, the specified asynchronous interrupt pipe
- is canceled.
- DataToggle - A pointer to the data toggle value. On input, it is valid
- when IsNewTransfer is TRUE, and it indicates the initial
- data toggle value the asynchronous interrupt transfer
- should adopt.
- On output, it is valid when IsNewTransfer is FALSE,
- and it is updated to indicate the data toggle value of
- the subsequent asynchronous interrupt transfer.
- PollingInterval - Indicates the interval, in milliseconds, that the
- asynchronous interrupt transfer is polled.
- This parameter is required when IsNewTransfer is TRUE.
- DataLength - Indicates the length of data to be received at the
- rate specified by PollingInterval from the target
- asynchronous interrupt endpoint. This parameter
- is only required when IsNewTransfer is TRUE.
- Translator - A pointr to the transaction translator data.
- CallBackFunction - The Callback function.This function is called at the
- rate specified by PollingInterval.This parameter is
- only required when IsNewTransfer is TRUE.
- Context - The context that is passed to the CallBackFunction.
- - This is an optional parameter and may be NULL.
-
- Returns:
-
- EFI_SUCCESS
- The asynchronous interrupt transfer request has been successfully
- submitted or canceled.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_OUT_OF_RESOURCES
- The request could not be completed due to a lack of resources.
- EFI_DEVICE_ERROR
- Can't read register
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINT8 PktId;
- EHCI_QH_ENTITY *QhPtr;
- EHCI_QTD_ENTITY *InterruptQtdsPtr;
- UINT8 *DataPtr;
- UINT8 *DataCursor;
- VOID *DataMap;
- UINTN MappedLength;
- EHCI_ASYNC_REQUEST *AsyncRequestPtr;
- EFI_TPL OldTpl;
-
- QhPtr = NULL;
- InterruptQtdsPtr = NULL;
- DataPtr = NULL;
- DataCursor = NULL;
- DataMap = NULL;
- AsyncRequestPtr = NULL;
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- //
- // Parameters Checking
- //
- if (!IsDataInTransfer (EndPointAddress)) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (IsNewTransfer) {
- if (0 == DataLength) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (*DataToggle != 1 && *DataToggle != 0) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (PollingInterval > 255 || PollingInterval < 1) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
- }
-
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (IsEhcHalted (HcDev) || IsEhcSysError (HcDev)) {
- ClearEhcAllStatus (HcDev);
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = ClearEhcAllStatus (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Delete Async interrupt transfer request
- //
- if (!IsNewTransfer) {
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = DeleteAsyncRequestTransfer (
- HcDev,
- DeviceAddress,
- EndPointAddress,
- DataToggle
- );
-
- gBS->RestoreTPL (OldTpl);
-
- goto exit;
- }
-
- Status = EhciAllocatePool (
- HcDev,
- (UINT8 **) &AsyncRequestPtr,
- sizeof (EHCI_ASYNC_REQUEST)
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
-
- Status = EhciAllocatePool (HcDev, &DataPtr, DataLength);
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto free_request;
- }
-
- MappedLength = DataLength;
- Status = MapDataBuffer (
- HcDev,
- EfiUsbDataIn,
- DataPtr,
- &MappedLength,
- &PktId,
- &DataCursor,
- &DataMap
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto free_data;
- }
-
- //
- // Create and init Interrupt Qh
- //
- Status = CreateInterruptQh (
- HcDev,
- DeviceAddress,
- EndPointAddress,
- DeviceSpeed,
- *DataToggle,
- MaximumPacketLength,
- PollingInterval,
- Translator,
- &QhPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto unmap_data;
- }
-
- //
- // Create and init Interrupt Qtds
- //
- Status = CreateBulkOrInterruptQtds (
- HcDev,
- PktId,
- DataCursor,
- MappedLength,
- Translator,
- &InterruptQtdsPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto destory_qh;
- }
-
- //
- // Link Qtds to Qh
- //
- LinkQtdToQh (QhPtr, InterruptQtdsPtr);
-
- //
- // Init AsyncRequest Entry
- //
- AsyncRequestPtr->Context = Context;
- AsyncRequestPtr->CallBackFunc = CallBackFunction;
- AsyncRequestPtr->TransferType = ASYNC_INTERRUPT_TRANSFER;
- AsyncRequestPtr->QhPtr = QhPtr;
- AsyncRequestPtr->Prev = NULL;
- AsyncRequestPtr->Next = NULL;
-
- if (NULL == HcDev->AsyncRequestList) {
- Status = StartPollingTimer (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- CleanUpAllAsyncRequestTransfer (HcDev);
- goto exit;
- }
- }
-
- //
- // Link Entry to AsyncRequest List
- //
- LinkToAsyncReqeust (HcDev, AsyncRequestPtr);
-
- ClearEhcAllStatus (HcDev);
-
- Status = DisablePeriodicSchedule (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = WaitForPeriodicScheduleDisable (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- Status = EFI_TIMEOUT;
- goto exit;
- }
-
- //
- // Link Qh and Qtds to Periodic Schedule List
- //
- LinkQhToPeriodicList (HcDev, QhPtr);
-
- Status = EnablePeriodicSchedule (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = WaitForPeriodicScheduleEnable (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- Status = EFI_TIMEOUT;
- goto exit;
- }
-
- if (IsEhcHalted (HcDev)) {
- Status = StartScheduleExecution (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- }
-
- HcDev->PciIo->Flush (HcDev->PciIo);
- goto exit;
-
-destory_qh:
- DestoryQh (HcDev, QhPtr);
-free_data:
- EhciFreePool (HcDev, DataPtr, DataLength);
-free_request:
- EhciFreePool (
- HcDev,
- (UINT8 *) AsyncRequestPtr,
- sizeof (EHCI_ASYNC_REQUEST)
- );
-unmap_data:
- HcDev->PciIo->Unmap (HcDev->PciIo, DataMap);
-exit:
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciSyncInterruptTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Submits synchronous interrupt transfer to an interrupt endpoint
- of a USB device.
- Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated
- in the following specification version.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - The combination of an endpoint number and an endpoint
- direction of the target USB device. Each endpoint
- address supports data transfer in one direction
- except the control endpoint (whose default
- endpoint address is 0). It is the caller's responsibility
- to make sure that the EndPointAddress represents
- an interrupt endpoint.
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- DataLength - On input, the size, in bytes, of the data buffer specified
- by Data. On output, the number of bytes transferred.
- DataToggle - A pointer to the data toggle value. On input, it indicates
- the initial data toggle value the synchronous interrupt
- transfer should adopt;
- on output, it is updated to indicate the data toggle value
- of the subsequent synchronous interrupt transfer.
- TimeOut - Indicates the maximum time, in microseconds, which the
- transfer is allowed to complete.
- Translator - A pointr to the transaction translator data.
- TransferResult - A pointer to the detailed result information from
- the synchronous interrupt transfer.
-
- Returns:
-
- EFI_SUCCESS
- The synchronous interrupt transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The synchronous interrupt transfer could not be submitted due
- to lack of resource.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The synchronous interrupt transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The synchronous interrupt transfer failed due to host controller
- or device error. Caller should check TranferResult for detailed
- error information.
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- UINT8 PktId;
- EHCI_QH_ENTITY *QhPtr;
- EHCI_QTD_ENTITY *InterruptQtdsPtr;
- UINT8 *DataCursor;
- VOID *DataMap;
-
- QhPtr = NULL;
- InterruptQtdsPtr = NULL;
- DataCursor = NULL;
- DataMap = NULL;
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- //
- // Parameters Checking
- //
- if (DataLength == NULL ||
- Data == NULL ||
- TransferResult == NULL
- ) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (!IsDataInTransfer (EndPointAddress)) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (0 == *DataLength) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (*DataToggle != 1 && *DataToggle != 0) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (EFI_USB_SPEED_LOW == DeviceSpeed && 8 != MaximumPacketLength) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (EFI_USB_SPEED_FULL == DeviceSpeed && MaximumPacketLength > 64) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- if (EFI_USB_SPEED_HIGH == DeviceSpeed && MaximumPacketLength > 3072) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (IsEhcHalted (HcDev) || IsEhcSysError (HcDev)) {
- ClearEhcAllStatus (HcDev);
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = ClearEhcAllStatus (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = MapDataBuffer (
- HcDev,
- EfiUsbDataIn,
- Data,
- DataLength,
- &PktId,
- &DataCursor,
- &DataMap
- );
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- //
- // Create and init Interrupt Qh
- //
- Status = CreateInterruptQh (
- HcDev,
- DeviceAddress,
- EndPointAddress,
- DeviceSpeed,
- *DataToggle,
- MaximumPacketLength,
- 0,
- Translator,
- &QhPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto unmap_data;
- }
-
- //
- // Create and init Interrupt Qtds
- //
- Status = CreateBulkOrInterruptQtds (
- HcDev,
- PktId,
- DataCursor,
- *DataLength,
- Translator,
- &InterruptQtdsPtr
- );
- if (EFI_ERROR (Status)) {
- *TransferResult = EFI_USB_ERR_SYSTEM;
- Status = EFI_OUT_OF_RESOURCES;
- goto destory_qh;
- }
-
- //
- // Link Qtds to Qh
- //
- LinkQtdToQh (QhPtr, InterruptQtdsPtr);
-
- ClearEhcAllStatus (HcDev);
-
- Status = DisablePeriodicSchedule (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = WaitForPeriodicScheduleDisable (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- Status = EFI_TIMEOUT;
- goto exit;
- }
-
- //
- // Link Qh and Qtds to Periodic Schedule List
- //
- LinkQhToPeriodicList (HcDev, QhPtr);
-
- Status = EnablePeriodicSchedule (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = WaitForPeriodicScheduleEnable (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- Status = EFI_TIMEOUT;
- goto exit;
- }
-
- if (IsEhcHalted (HcDev)) {
- Status = StartScheduleExecution (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- }
-
- //
- // Poll QH-TDs execution and get result.
- // detail status is returned
- //
- Status = ExecuteTransfer (
- HcDev,
- FALSE,
- QhPtr,
- DataLength,
- DataToggle,
- TimeOut,
- TransferResult
- );
- if (EFI_ERROR (Status)) {
- goto destory_qtds;
- }
-
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (IsEhcHalted (HcDev) || IsEhcSysError (HcDev)) {
- *TransferResult |= EFI_USB_ERR_SYSTEM;
- }
-
- ClearEhcAllStatus (HcDev);
-
-destory_qtds:
- UnlinkQhFromPeriodicList (HcDev, QhPtr, 0);
- DestoryQtds (HcDev, InterruptQtdsPtr);
-destory_qh:
- DestoryQh (HcDev, QhPtr);
-unmap_data:
- HcDev->PciIo->Unmap (HcDev->PciIo, DataMap);
-exit:
- HcDev->PciIo->Flush (HcDev->PciIo);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-EhciIsochronousTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Submits isochronous transfer to a target USB device.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - End point address
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
- DataBuffersNumber - Number of data buffers prepared for the transfer.
- Data - Array of pointers to the buffers of data that will be
- transmitted to USB device or received from USB device.
- DataLength - Indicates the size, in bytes, of the data buffer
- specified by Data.
- Translator - A pointr to the transaction translator data.
- TransferResult - A pointer to the detailed result information generated
- by this control transfer.
-
- Returns:
-
- EFI_UNSUPPORTED
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-EhciAsyncIsochronousTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
-
- Submits Async isochronous transfer to a target USB device.
-
- Arguments:
-
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - End point address
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
- DataBuffersNumber - Number of data buffers prepared for the transfer.
- Data - Array of pointers to the buffers of data that will be transmitted
- to USB device or received from USB device.
- Translator - A pointr to the transaction translator data.
- IsochronousCallBack - When the transfer complete, the call back function will be called
- Context - Pass to the call back function as parameter
-
- Returns:
-
- EFI_UNSUPPORTED
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h
deleted file mode 100644
index 7ac5d28..0000000
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h
+++ /dev/null
@@ -1,2918 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ehci.h
-
-Abstract:
-
-
-Revision History
---*/
-
-#ifndef _EHCI_H
-#define _EHCI_H
-
-//
-// Universal Host Controller Interface data structures and defines
-//
-#include <IndustryStandard/pci22.h>
-
-
-extern UINTN gEHCDebugLevel;
-extern UINTN gEHCErrorLevel;
-
-
-#define STALL_1_MACRO_SECOND 1
-#define STALL_1_MILLI_SECOND 1000 * STALL_1_MACRO_SECOND
-#define STALL_1_SECOND 1000 * STALL_1_MILLI_SECOND
-
-#define MEM_UNIT_SIZE 128
-
-
-#define SETUP_PACKET_PID_CODE 0x02
-#define INPUT_PACKET_PID_CODE 0x01
-#define OUTPUT_PACKET_PID_CODE 0x0
-
-#define ITD_SELECT_TYPE 0x0
-#define QH_SELECT_TYPE 0x01
-#define SITD_SELECT_TYPE 0x02
-#define FSTN_SELECT_TYPE 0x03
-
-#define EHCI_SET_PORT_RESET_RECOVERY_TIME 50 * STALL_1_MILLI_SECOND
-#define EHCI_CLEAR_PORT_RESET_RECOVERY_TIME STALL_1_MILLI_SECOND
-#define EHCI_GENERIC_TIMEOUT 50 * STALL_1_MILLI_SECOND
-#define EHCI_GENERIC_RECOVERY_TIME 50 * STALL_1_MACRO_SECOND
-#define EHCI_SYNC_REQUEST_POLLING_TIME 50 * STALL_1_MACRO_SECOND
-#define EHCI_ASYNC_REQUEST_POLLING_TIME 50 * STALL_1_MILLI_SECOND
-
-#define USB_BAR_INDEX 0 /* how many bytes away from USB_BASE to 0x10 */
-
-#define NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES 16
-
-#define EHCI_MIN_PACKET_SIZE 8
-#define EHCI_MAX_PACKET_SIZE 1024
-#define EHCI_MAX_FRAME_LIST_LENGTH 1024
-#define EHCI_BLOCK_SIZE_WITH_TT 64
-#define EHCI_BLOCK_SIZE 512
-#define EHCI_MAX_QTD_CAPACITY (EFI_PAGE_SIZE * 5)
-
-#define NAK_COUNT_RELOAD 3
-#define QTD_ERROR_COUNTER 3
-#define HIGH_BANDWIDTH_PIPE_MULTIPLIER 1
-
-#define QTD_STATUS_ACTIVE 0x80
-#define QTD_STATUS_HALTED 0x40
-#define QTD_STATUS_BUFFER_ERR 0x20
-#define QTD_STATUS_BABBLE_ERR 0x10
-#define QTD_STATUS_TRANSACTION_ERR 0x08
-#define QTD_STATUS_DO_STOP_SPLIT 0x02
-#define QTD_STATUS_DO_START_SPLIT 0
-#define QTD_STATUS_DO_PING 0x01
-#define QTD_STATUS_DO_OUT 0
-
-#define DATA0 0
-#define DATA1 1
-
-#define MICRO_FRAME_0_CHANNEL 0x01
-#define MICRO_FRAME_1_CHANNEL 0x02
-#define MICRO_FRAME_2_CHANNEL 0x04
-#define MICRO_FRAME_3_CHANNEL 0x08
-#define MICRO_FRAME_4_CHANNEL 0x10
-#define MICRO_FRAME_5_CHANNEL 0x20
-#define MICRO_FRAME_6_CHANNEL 0x40
-#define MICRO_FRAME_7_CHANNEL 0x80
-
-#define CONTROL_TRANSFER 0x01
-#define BULK_TRANSFER 0x02
-#define SYNC_INTERRUPT_TRANSFER 0x04
-#define ASYNC_INTERRUPT_TRANSFER 0x08
-#define SYNC_ISOCHRONOUS_TRANSFER 0x10
-#define ASYNC_ISOCHRONOUS_TRANSFER 0x20
-
-
-//
-// Enhanced Host Controller Registers definitions
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gEhciDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName;
-
-#define USBCMD 0x0 /* Command Register Offset 00-03h */
-#define USBCMD_RS 0x01 /* Run / Stop */
-#define USBCMD_HCRESET 0x02 /* Host controller reset */
-#define USBCMD_FLS_512 0x04 /* 512 elements (2048bytes) in Frame List */
-#define USBCMD_FLS_256 0x08 /* 256 elements (1024bytes) in Frame List */
-#define USBCMD_PSE 0x10 /* Periodic schedule enable */
-#define USBCMD_ASE 0x20 /* Asynchronous schedule enable */
-#define USBCMD_IAAD 0x40 /* Interrupt on async advance doorbell */
-
-#define USBSTS 0x04 /* Statue Register Offset 04-07h */
-#define USBSTS_HSE 0x10 /* Host system error */
-#define USBSTS_IAA 0x20 /* Interrupt on async advance */
-#define USBSTS_HCH 0x1000 /* Host controller halted */
-#define USBSTS_PSS 0x4000 /* Periodic schedule status */
-#define USBSTS_ASS 0x8000 /* Asynchronous schedule status */
-
-#define USBINTR 0x08 /* Command Register Offset 08-0bh */
-
-#define FRINDEX 0x0c /* Frame Index Offset 0c-0fh */
-
-#define CTRLDSSGMENT 0x10 /* 4G Segment Selector Offset 10-13h */
-
-#define PERIODICLISTBASE 0x14 /* Frame List Base Address Offset 14-17h */
-
-#define ASYNCLISTADDR 0x18 /* Next Asynchronous List Address Offset 18-1bh */
-
-#define CONFIGFLAG 0x40 /* Configured Flag Register Offset 40-43h */
-#define CONFIGFLAG_CF 0x01 /* Configure Flag */
-
-#define PORTSC 0x44 /* Port Status/Control Offset 44-47h */
-#define PORTSC_CCS 0x01 /* Current Connect Status*/
-#define PORTSC_CSC 0x02 /* Connect Status Change */
-#define PORTSC_PED 0x04 /* Port Enable / Disable */
-#define PORTSC_PEDC 0x08 /* Port Enable / Disable Change */
-#define PORTSC_OCA 0x10 /* Over current Active */
-#define PORTSC_OCC 0x20 /* Over current Change */
-#define PORTSC_FPR 0x40 /* Force Port Resume */
-#define PORTSC_SUSP 0x80 /* Port Suspend State */
-#define PORTSC_PR 0x100 /* Port Reset */
-#define PORTSC_LS_KSTATE 0x400 /* Line Status K-state */
-#define PORTSC_LS_JSTATE 0x800 /* Line Status J-state */
-#define PORTSC_PP 0x1000 /* Port Power */
-#define PORTSC_PO 0x2000 /* Port Owner */
-
-#define CAPLENGTH 0 /* Capability Register Length 00h */
-
-#define HCIVERSION 0x02 /* Interface Version Number 02-03h */
-
-#define HCSPARAMS 0x04 /* Structural Parameters 04-07h */
-#define HCSP_NPORTS 0x0f /* Number of physical downstream ports on host controller */
-
-#define HCCPARAMS 0x08 /* Capability Parameters 08-0bh */
-#define HCCP_64BIT 0x01 /* 64-bit Addressing Capability */
-#define HCCP_PFLF 0x02 /* Programmable Frame List Flag */
-#define HCCP_EECP 0xff00 /* EHCI Extemded Capabilities Pointer */
-
-#define HCSPPORTROUTE 0x0c /* Companion Port Route Description 60b */
-
-#define CLASSC 0x09 /* Class Code 09-0bh */
-
-#define USBBASE 0x10 /* Base Address to Memory-mapped Host Controller Register Space 10-13h */
-
-#define SBRN 0x60 /* Serial Bus Release Number 60h */
-
-#define FLADJ 0x61 /* Frame Length Adjustment Register 61h */
-
-#define PORTWAKECAP 0x62 /* Port wake capablilities register(OPIONAL) 61-62h */
-
-//
-// PCI Configuration Registers
-//
-#define EHCI_PCI_CLASSC 0x09
-#define EHCI_PCI_MEMORY_BASE 0x10
-
-//
-// Memory Offset Registers
-//
-#define EHCI_MEMORY_CAPLENGTH 0x0
-#define EHCI_MEMORY_CONFIGFLAG 0x40
-
-//
-// USB Base Class Code,Sub-Class Code and Programming Interface
-//
-#define PCI_CLASSC_PI_EHCI PCI_IF_EHCI
-
-#define SETUP_PACKET_ID 0x2D
-#define INPUT_PACKET_ID 0x69
-#define OUTPUT_PACKET_ID 0xE1
-#define ERROR_PACKET_ID 0x55
-
-#define bit(a) (1 << (a))
-
-#define GET_0B_TO_31B(Addr) (((UINTN) Addr) & (0xffffffff))
-#define GET_32B_TO_63B(Addr) ((UINTN)RShiftU64((UINTN) Addr, 32) & (0xffffffff))
-
-
-//
-// Ehci Data and Ctrl Structures
-//
-#pragma pack(1)
-
-typedef struct {
- UINT8 PI;
- UINT8 SubClassCode;
- UINT8 BaseCode;
-} USB_CLASSC;
-
-//
-//32 Bytes Aligned
-//
-typedef struct {
- UINT32 NextQtdTerminate : 1;
- UINT32 Rsvd1 : 4;
- UINT32 NextQtdPointer : 27;
-
- UINT32 AltNextQtdTerminate : 1;
- UINT32 Rsvd2 : 4;
- UINT32 AltNextQtdPointer : 27;
-
- UINT32 Status : 8;
- UINT32 PidCode : 2;
- UINT32 ErrorCount : 2;
- UINT32 CurrentPage : 3;
- UINT32 InterruptOnComplete : 1;
- UINT32 TotalBytes : 15;
- UINT32 DataToggle : 1;
-
- UINT32 CurrentOffset : 12;
- UINT32 BufferPointer0 : 20;
-
- UINT32 Rsvd3 : 12;
- UINT32 BufferPointer1 : 20;
-
- UINT32 Rsvd4 : 12;
- UINT32 BufferPointer2 : 20;
-
- UINT32 Rsvd5 : 12;
- UINT32 BufferPointer3 : 20;
-
- UINT32 Rsvd6 : 12;
- UINT32 BufferPointer4 : 20;
-
- UINT32 PAD[5];
-} EHCI_QTD_HW;
-
-//
-//32 Bytes Aligned
-//
-typedef struct {
- UINT32 QhTerminate : 1;
- UINT32 SelectType : 2;
- UINT32 Rsvd1 : 2;
- UINT32 QhHorizontalPointer : 27;
-
- UINT32 DeviceAddr : 7;
- UINT32 Inactive : 1;
- UINT32 EndpointNum : 4;
- UINT32 EndpointSpeed : 2;
- UINT32 DataToggleControl : 1;
- UINT32 HeadReclamationFlag : 1;
- UINT32 MaxPacketLen : 11;
- UINT32 ControlEndpointFlag : 1;
- UINT32 NakCountReload : 4;
-
- UINT32 InerruptScheduleMask : 8;
- UINT32 SplitComletionMask : 8;
- UINT32 HubAddr : 7;
- UINT32 PortNum : 7;
- UINT32 Multiplier : 2;
-
- UINT32 Rsvd2 : 5;
- UINT32 CurrentQtdPointer : 27;
-
- UINT32 NextQtdTerminate : 1;
- UINT32 Rsvd3 : 4;
- UINT32 NextQtdPointer : 27;
-
- UINT32 AltNextQtdTerminate : 1;
- UINT32 NakCount : 4;
- UINT32 AltNextQtdPointer : 27;
-
- UINT32 Status : 8;
- UINT32 PidCode : 2;
- UINT32 ErrorCount : 2;
- UINT32 CurrentPage : 3;
- UINT32 InterruptOnComplete : 1;
- UINT32 TotalBytes : 15;
- UINT32 DataToggle : 1;
-
- UINT32 CurrentOffset : 12;
- UINT32 BufferPointer0 : 20;
-
- UINT32 CompleteSplitMask : 8;
- UINT32 Rsvd4 : 4;
- UINT32 BufferPointer1 : 20;
-
- UINT32 FrameTag : 5;
- UINT32 SplitBytes : 7;
- UINT32 BufferPointer2 : 20;
-
- UINT32 Rsvd5 : 12;
- UINT32 BufferPointer3 : 20;
-
- UINT32 Rsvd6 : 12;
- UINT32 BufferPointer4 : 20;
-
- UINT32 Pad[5];
-} EHCI_QH_HW;
-
-typedef struct {
- UINT32 LinkTerminate : 1;
- UINT32 SelectType : 2;
- UINT32 Rsvd : 2;
- UINT32 LinkPointer : 27;
-} FRAME_LIST_ENTRY;
-
-#pragma pack()
-
-typedef struct _EHCI_QTD_ENTITY EHCI_QTD_ENTITY;
-typedef struct _EHCI_QH_ENTITY EHCI_QH_ENTITY;
-typedef struct _EHCI_ASYNC_REQUEST EHCI_ASYNC_REQUEST;
-//
-//Aligan On 32 Bytes
-//
-struct _EHCI_QTD_ENTITY {
- EHCI_QTD_HW Qtd;
- UINT32 TotalBytes;
- UINT32 StaticTotalBytes;
- UINT32 StaticCurrentOffset;
- EHCI_QTD_ENTITY *Prev;
- EHCI_QTD_ENTITY *Next;
- EHCI_QTD_ENTITY *AltNext;
- EHCI_QH_ENTITY *SelfQh;
-};
-//
-//Aligan On 32 Bytes
-//
-struct _EHCI_QH_ENTITY {
- EHCI_QH_HW Qh;
- EHCI_QH_ENTITY *Next;
- EHCI_QH_ENTITY *Prev;
- EHCI_QTD_ENTITY *FirstQtdPtr;
- EHCI_QTD_ENTITY *LastQtdPtr;
- EHCI_QTD_ENTITY *AltQtdPtr;
- UINTN Interval;
- UINT8 TransferType;
-};
-
-#define GET_QH_ENTITY_ADDR(a) ((EHCI_QH_ENTITY *) a)
-#define GET_QTD_ENTITY_ADDR(a) ((EHCI_QTD_ENTITY *) a)
-
-
-//
-// Ehci Managment Structures
-//
-#define USB2_HC_DEV_FROM_THIS(a) CR (a, USB2_HC_DEV, Usb2Hc, USB2_HC_DEV_SIGNATURE)
-
-#define USB2_HC_DEV_SIGNATURE EFI_SIGNATURE_32 ('e', 'h', 'c', 'i')
-
-struct _EHCI_ASYNC_REQUEST {
- UINT8 TransferType;
- EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunc;
- VOID *Context;
- EHCI_ASYNC_REQUEST *Prev;
- EHCI_ASYNC_REQUEST *Next;
- EHCI_QH_ENTITY *QhPtr;
-};
-
-typedef struct _MEMORY_MANAGE_HEADER {
- UINT8 *BitArrayPtr;
- UINTN BitArraySizeInBytes;
- UINT8 *MemoryBlockPtr;
- UINTN MemoryBlockSizeInBytes;
- VOID *Mapping;
- struct _MEMORY_MANAGE_HEADER *Next;
-} MEMORY_MANAGE_HEADER;
-
-typedef struct _USB2_HC_DEV {
- UINTN Signature;
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_USB2_HC_PROTOCOL Usb2Hc;
- UINTN PeriodicFrameListLength;
- VOID *PeriodicFrameListBuffer;
- VOID *PeriodicFrameListMap;
- VOID *AsyncList;
- EHCI_ASYNC_REQUEST *AsyncRequestList;
- EFI_EVENT AsyncRequestEvent;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
- MEMORY_MANAGE_HEADER *MemoryHeader;
- UINT8 Is64BitCapable;
- UINT32 High32BitAddr;
- EHCI_QH_ENTITY *NULLQH;
- UINT32 UsbCapabilityLen;
- UINT16 DeviceSpeed[16];
-} USB2_HC_DEV;
-
-
-//
-// Prototypes
-// Driver model protocol interface
-//
-
-EFI_STATUS
-EFIAPI
-EhciDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-EhciDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-EhciDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// Ehci protocol interface
-//
-EFI_STATUS
-EFIAPI
-EhciGetCapability (
- IN EFI_USB2_HC_PROTOCOL *This,
- OUT UINT8 *MaxSpeed,
- OUT UINT8 *PortNumber,
- OUT UINT8 *Is64BitCapable
- );
-
-EFI_STATUS
-EFIAPI
-EhciReset (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT16 Attributes
- );
-
-EFI_STATUS
-EFIAPI
-EhciGetState (
- IN EFI_USB2_HC_PROTOCOL *This,
- OUT EFI_USB_HC_STATE *State
- );
-
-EFI_STATUS
-EFIAPI
-EhciSetState (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN EFI_USB_HC_STATE State
- );
-
-EFI_STATUS
-EFIAPI
-EhciControlTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-EhciBulkTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-EhciAsyncInterruptTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaxiumPacketLength,
- IN BOOLEAN IsNewTransfer,
- IN OUT UINT8 *DataToggle,
- IN UINTN PollingInterval,
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
- IN VOID *Context OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-EhciSyncInterruptTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-EhciIsochronousTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-EhciAsyncIsochronousTransfer (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context
- );
-
-EFI_STATUS
-EFIAPI
-EhciGetRootHubPortStatus (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS *PortStatus
- );
-
-EFI_STATUS
-EFIAPI
-EhciSetRootHubPortFeature (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- );
-
-EFI_STATUS
-EFIAPI
-EhciClearRootHubPortFeature (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-EhciComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-EhciComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle, OPTIONAL
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// Internal Functions Declaration
-//
-
-//
-// EhciMem Functions
-//
-EFI_STATUS
-CreateMemoryBlock (
- IN USB2_HC_DEV *HcDev,
- OUT MEMORY_MANAGE_HEADER **MemoryHeader,
- IN UINTN MemoryBlockSizeInPages
- )
-/*++
-
-Routine Description:
-
- Use PciIo->AllocateBuffer to allocate common buffer for the memory block,
- and use PciIo->Map to map the common buffer for Bus Master Read/Write.
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- MemoryHeader - MEMORY_MANAGE_HEADER to output
- MemoryBlockSizeInPages - MemoryBlockSizeInPages
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Fail for no resources
- EFI_UNSUPPORTED Unsupported currently
-
---*/
-;
-
-EFI_STATUS
-FreeMemoryHeader (
- IN USB2_HC_DEV *HcDev,
- IN MEMORY_MANAGE_HEADER *MemoryHeader
- )
-/*++
-
-Routine Description:
-
- Free Memory Header
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- MemoryHeader - MemoryHeader to be freed
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_INVALID_PARAMETER Parameter is error
-
---*/
-;
-
-VOID
-InsertMemoryHeaderToList (
- IN MEMORY_MANAGE_HEADER *MemoryHeader,
- IN MEMORY_MANAGE_HEADER *NewMemoryHeader
- )
-/*++
-
-Routine Description:
-
- Insert Memory Header To List
-
-Arguments:
-
- MemoryHeader - MEMORY_MANAGE_HEADER
- NewMemoryHeader - MEMORY_MANAGE_HEADER
-
-Returns:
-
- VOID
-
---*/
-;
-
-EFI_STATUS
-AllocMemInMemoryBlock (
- IN MEMORY_MANAGE_HEADER *MemoryHeader,
- OUT VOID **Pool,
- IN UINTN NumberOfMemoryUnit
- )
-/*++
-
-Routine Description:
-
- Alloc Memory In MemoryBlock
-
-Arguments:
-
- MemoryHeader - MEMORY_MANAGE_HEADER
- Pool - Place to store pointer to memory
- NumberOfMemoryUnit - Number Of Memory Unit
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_NOT_FOUND Can't find the free memory
-
---*/
-;
-
-BOOLEAN
-IsMemoryBlockEmptied (
- IN MEMORY_MANAGE_HEADER *MemoryHeaderPtr
- )
-/*++
-
-Routine Description:
-
- Is Memory Block Emptied
-
-Arguments:
-
- MemoryHeaderPtr - MEMORY_MANAGE_HEADER
-
-Returns:
-
- TRUE Empty
- FALSE Not Empty
-
---*/
-;
-
-VOID
-DelinkMemoryBlock (
- IN MEMORY_MANAGE_HEADER *FirstMemoryHeader,
- IN MEMORY_MANAGE_HEADER *NeedFreeMemoryHeader
- )
-/*++
-
-Routine Description:
-
- Delink Memory Block
-
-Arguments:
-
- FirstMemoryHeader - MEMORY_MANAGE_HEADER
- NeedFreeMemoryHeader - MEMORY_MANAGE_HEADER
-
-Returns:
-
- VOID
-
---*/
-;
-
-EFI_STATUS
-InitialMemoryManagement (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Initialize Memory Management
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-DeinitialMemoryManagement (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Deinitialize Memory Management
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-EhciAllocatePool (
- IN USB2_HC_DEV *HcDev,
- OUT UINT8 **Pool,
- IN UINTN AllocSize
- )
-/*++
-
-Routine Description:
-
- Ehci Allocate Pool
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Pool - Place to store pointer to the memory buffer
- AllocSize - Alloc Size
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-VOID
-EhciFreePool (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 *Pool,
- IN UINTN AllocSize
- )
-/*++
-
-Routine Description:
-
- Uhci Free Pool
-
-Arguments:
-
- HcDev - USB_HC_DEV
- Pool - Pool to free
- AllocSize - Pool size
-
-Returns:
-
- VOID
-
---*/
-;
-
-//
-// EhciReg Functions
-//
-EFI_STATUS
-ReadEhcCapabiltiyReg (
- IN USB2_HC_DEV *HcDev,
- IN UINT32 CapabiltiyRegAddr,
- IN OUT UINT32 *Data
- )
-/*++
-
-Routine Description:
-
- Read Ehc Capabitlity register
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- CapabiltiyRegAddr - Ehc Capability register address
- Data - A pointer to data read from register
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-ReadEhcOperationalReg (
- IN USB2_HC_DEV *HcDev,
- IN UINT32 OperationalRegAddr,
- IN OUT UINT32 *Data
- )
-/*++
-
-Routine Description:
-
- Read Ehc Operation register
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- OperationalRegAddr - Ehc Operation register address
- Data - A pointer to data read from register
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-WriteEhcOperationalReg (
- IN USB2_HC_DEV *HcDev,
- IN UINT32 OperationalRegAddr,
- IN UINT32 Data
- )
-/*++
-
-Routine Description:
-
- Write Ehc Operation register
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- OperationalRegAddr - Ehc Operation register address
- Data - 32bit write to register
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-SetEhcDoorbell (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Set Ehc door bell bit
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-SetFrameListLen (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Length
- )
-/*++
-
-Routine Description:
-
- Set the length of Frame List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Length - the required length of frame list
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_INVALID_PARAMETER Invalid parameter
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-BOOLEAN
-IsFrameListProgrammable (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether frame list is programmable
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Programmable
- FALSE Unprogrammable
-
---*/
-;
-
-BOOLEAN
-IsPeriodicScheduleEnabled (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether periodic schedule is enabled
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Enabled
- FALSE Disabled
-
---*/
-;
-
-BOOLEAN
-IsAsyncScheduleEnabled (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether asynchronous schedule is enabled
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Enabled
- FALSE Disabled
-
---*/
-;
-
-BOOLEAN
-IsEhcPortEnabled (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 PortNum
- )
-/*++
-
-Routine Description:
-
- Whether port is enabled
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Enabled
- FALSE Disabled
-
---*/
-;
-
-BOOLEAN
-IsEhcReseted (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether Ehc is halted
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Reseted
- FALSE Unreseted
-
---*/
-;
-
-BOOLEAN
-IsEhcHalted (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether Ehc is halted
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Halted
- FALSE Not halted
-
---*/
-;
-
-BOOLEAN
-IsEhcSysError (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether Ehc is system error
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE System error
- FALSE No system error
-
---*/
-;
-
-BOOLEAN
-IsHighSpeedDevice (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 PortNum
- )
-/*++
-
-Routine Description:
-
- Whether high speed device attached
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE High speed
- FALSE Full speed
-
---*/
-;
-
-EFI_STATUS
-WaitForEhcReset (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- wait for Ehc reset or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-;
-
-EFI_STATUS
-WaitForEhcHalt (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- wait for Ehc halt or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-;
-
-EFI_STATUS
-WaitForEhcNotHalt (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- wait for Ehc not halt or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-;
-
-EFI_STATUS
-WaitForEhcDoorbell (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait for periodic schedule disable or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-;
-
-EFI_STATUS
-WaitForAsyncScheduleEnable (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait for Ehc asynchronous schedule enable or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-;
-
-EFI_STATUS
-WaitForAsyncScheduleDisable (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait for Ehc asynchronous schedule disable or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-;
-
-EFI_STATUS
-WaitForPeriodicScheduleEnable (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait for Ehc periodic schedule enable or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-;
-
-EFI_STATUS
-WaitForPeriodicScheduleDisable (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait for periodic schedule disable or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-;
-
-EFI_STATUS
-GetCapabilityLen (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Get the length of capability register
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-SetFrameListBaseAddr (
- IN USB2_HC_DEV *HcDev,
- IN UINT32 FrameBuffer
- )
-/*++
-
-Routine Description:
-
- Set base address of frame list first entry
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- FrameBuffer - base address of first entry of frame list
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-SetAsyncListAddr (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Set address of first Async schedule Qh
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to first Qh in the Async schedule
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-SetCtrlDataStructSeg (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Set address of first Async schedule Qh
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to first Qh in the Async schedule
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-SetPortRoutingEhc (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Set Ehc port routing bit
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-EnablePeriodicSchedule (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Enable periodic schedule
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-DisablePeriodicSchedule (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Disable periodic schedule
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-EnableAsynchronousSchedule (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Enable asynchrounous schedule
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-DisableAsynchronousSchedule (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Disable asynchrounous schedule
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-StartScheduleExecution (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Start Ehc schedule execution
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-ResetEhc (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Reset Ehc
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-ClearEhcAllStatus (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Clear Ehc all status bits
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-//
-// EhciSched Functions
-//
-EFI_STATUS
-InitialPeriodicFrameList (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Length
- )
-/*++
-
-Routine Description:
-
- Initialize Periodic Schedule Frame List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Length - Frame List Length
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-VOID
-DeinitialPeriodicFrameList (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Deinitialize Periodic Schedule Frame List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- VOID
-
---*/
-;
-
-EFI_STATUS
-CreatePollingTimer (
- IN USB2_HC_DEV *HcDev,
- IN EFI_EVENT_NOTIFY NotifyFunction
- )
-/*++
-
-Routine Description:
-
- Create Async Request Polling Timer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- NotifyFunction - Timer Notify Function
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-DestoryPollingTimer (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Destory Async Request Polling Timer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-StartPollingTimer (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Start Async Request Polling Timer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-StopPollingTimer (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Stop Async Request Polling Timer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-CreateQh (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DeviceAddr,
- IN UINT8 Endpoint,
- IN UINT8 DeviceSpeed,
- IN UINTN MaxPacketLen,
- OUT EHCI_QH_ENTITY **QhPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qh Structure and Pre-Initialize
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DeviceAddr - Address of Device
- Endpoint - Endpoint Number
- DeviceSpeed - Device Speed
- MaxPacketLen - Max Length of one Packet
- QhPtrPtr - A pointer of pointer to Qh for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-CreateControlQh (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DeviceAddr,
- IN UINT8 DeviceSpeed,
- IN UINTN MaxPacketLen,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT EHCI_QH_ENTITY **QhPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qh for Control Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DeviceAddr - Address of Device
- DeviceSpeed - Device Speed
- MaxPacketLen - Max Length of one Packet
- Translator - Translator Transaction for SplitX
- QhPtrPtr - A pointer of pointer to Qh for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-CreateBulkQh (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DeviceAddr,
- IN UINT8 EndPointAddr,
- IN UINT8 DeviceSpeed,
- IN UINT8 DataToggle,
- IN UINTN MaxPacketLen,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT EHCI_QH_ENTITY **QhPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qh for Bulk Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DeviceAddr - Address of Device
- EndPointAddr - Address of Endpoint
- DeviceSpeed - Device Speed
- MaxPacketLen - Max Length of one Packet
- Translator - Translator Transaction for SplitX
- QhPtrPtr - A pointer of pointer to Qh for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-CreateInterruptQh (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DeviceAddr,
- IN UINT8 EndPointAddr,
- IN UINT8 DeviceSpeed,
- IN UINT8 DataToggle,
- IN UINTN MaxPacketLen,
- IN UINTN Interval,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT EHCI_QH_ENTITY **QhPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qh for Control Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DeviceAddr - Address of Device
- EndPointAddr - Address of Endpoint
- DeviceSpeed - Device Speed
- MaxPacketLen - Max Length of one Packet
- Interval - value of interval
- Translator - Translator Transaction for SplitX
- QhPtrPtr - A pointer of pointer to Qh for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-VOID
-DestoryQh (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Destory Qh Structure
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to Qh
-
-Returns:
-
- VOID
-
---*/
-;
-
-EFI_STATUS
-CreateQtd (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 *DataPtr,
- IN UINTN DataLen,
- IN UINT8 PktId,
- IN UINT8 Toggle,
- IN UINT8 QtdStatus,
- OUT EHCI_QTD_ENTITY **QtdPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qtd Structure and Pre-Initialize it
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DataPtr - A pointer to user data buffer to transfer
- DataLen - Length of user data to transfer
- PktId - Packet Identification of this Qtd
- Toggle - Data Toggle of this Qtd
- QtdStatus - Default value of status of this Qtd
- QtdPtrPtr - A pointer of pointer to Qtd for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-;
-
-EFI_STATUS
-CreateSetupQtd (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 *DevReqPtr,
- OUT EHCI_QTD_ENTITY **QtdPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qtd Structure for Setup
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DevReqPtr - A pointer to Device Request Data
- QtdPtrPtr - A pointer of pointer to Qtd for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-;
-
-EFI_STATUS
-CreateDataQtd (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 *DataPtr,
- IN UINTN DataLen,
- IN UINT8 PktId,
- IN UINT8 Toggle,
- OUT EHCI_QTD_ENTITY **QtdPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qtd Structure for data
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DataPtr - A pointer to user data buffer to transfer
- DataLen - Length of user data to transfer
- PktId - Packet Identification of this Qtd
- Toggle - Data Toggle of this Qtd
- QtdPtrPtr - A pointer of pointer to Qtd for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-;
-
-EFI_STATUS
-CreateStatusQtd (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 PktId,
- OUT EHCI_QTD_ENTITY **QtdPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qtd Structure for status
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- PktId - Packet Identification of this Qtd
- QtdPtrPtr - A pointer of pointer to Qtd for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-;
-
-EFI_STATUS
-CreateAltQtd (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 PktId,
- OUT EHCI_QTD_ENTITY **QtdPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qtd Structure for Alternative
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- PktId - Packet Identification of this Qtd
- QtdPtrPtr - A pointer of pointer to Qtd for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-;
-
-EFI_STATUS
-CreateControlQtds (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DataPktId,
- IN UINT8 *RequestCursor,
- IN UINT8 *DataCursor,
- IN UINTN DataLen,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT EHCI_QTD_ENTITY **ControlQtdsHead
- )
-/*++
-
-Routine Description:
-
- Create Qtds list for Control Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DataPktId - Packet Identification of Data Qtds
- RequestCursor - A pointer to request structure buffer to transfer
- DataCursor - A pointer to user data buffer to transfer
- DataLen - Length of user data to transfer
- ControlQtdsHead - A pointer of pointer to first Qtd for control tranfer for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-CreateBulkOrInterruptQtds (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 PktId,
- IN UINT8 *DataCursor,
- IN UINTN DataLen,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT EHCI_QTD_ENTITY **QtdsHead
- )
-/*++
-
-Routine Description:
-
- Create Qtds list for Bulk or Interrupt Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- PktId - Packet Identification of Qtds
- DataCursor - A pointer to user data buffer to transfer
- DataLen - Length of user data to transfer
- DataToggle - Data Toggle to start
- Translator - Translator Transaction for SplitX
- QtdsHead - A pointer of pointer to first Qtd for control tranfer for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-VOID
-DestoryQtds (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QTD_ENTITY *FirstQtdPtr
- )
-/*++
-
-Routine Description:
-
- Destory all Qtds in the list
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- FirstQtdPtr - A pointer to first Qtd in the list
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-LinkQtdToQtd (
- IN EHCI_QTD_ENTITY *PreQtdPtr,
- IN EHCI_QTD_ENTITY *QtdPtr
- )
-/*++
-
-Routine Description:
-
- Link Qtds together
-
-Arguments:
-
- PreQtdPtr - A pointer to pre Qtd
- QtdPtr - A pointer to next Qtd
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-LinkQtdsToAltQtd (
- IN EHCI_QTD_ENTITY *FirstQtdPtr,
- IN EHCI_QTD_ENTITY *AltQtdPtr
- )
-/*++
-
-Routine Description:
-
- Link AlterQtds together
-
-Arguments:
-
- FirstQtdPtr - A pointer to first Qtd in the list
- AltQtdPtr - A pointer to alternative Qtd
-
-Returns:
- VOID
-
---*/
-;
-
-VOID
-LinkQtdToQh (
- IN EHCI_QH_ENTITY *QhPtr,
- IN EHCI_QTD_ENTITY *QtdEntryPtr
- )
-/*++
-
-Routine Description:
-
- Link Qtds list to Qh
-
-Arguments:
-
- QhPtr - A pointer to Qh
- QtdPtr - A pointer to first Qtd in the list
-
-Returns:
-
- VOID
-
---*/
-;
-
-EFI_STATUS
-LinkQhToAsyncList (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Link Qh to Async Schedule List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to Qh
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-UnlinkQhFromAsyncList (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Unlink Qh from Async Schedule List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to Qh
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-VOID
-LinkQhToPeriodicList (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Link Qh to Periodic Schedule List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to Qh
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-UnlinkQhFromPeriodicList (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr,
- IN UINTN Interval
- )
-/*++
-
-Routine Description:
-
- Unlink Qh from Periodic Schedule List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to Qh
- Interval - Interval of this periodic transfer
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-LinkToAsyncReqeust (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_ASYNC_REQUEST *AsyncRequestPtr
- )
-/*++
-
-Routine Description:
-
- Llink AsyncRequest Entry to Async Request List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- AsyncRequestPtr - A pointer to Async Request Entry
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-UnlinkFromAsyncReqeust (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_ASYNC_REQUEST *AsyncRequestPtr
- )
-/*++
-
-Routine Description:
-
- Unlink AsyncRequest Entry from Async Request List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- AsyncRequestPtr - A pointer to Async Request Entry
-
-Returns:
-
- VOID
-
---*/
-;
-
-UINTN
-GetNumberOfQtd (
- IN EHCI_QTD_ENTITY *FirstQtdPtr
- )
-/*++
-
-Routine Description:
-
- Number of Qtds in the list
-
-Arguments:
-
- FirstQtdPtr - A pointer to first Qtd in the list
-
-Returns:
-
- Number of Qtds in the list
-
---*/
-;
-
-
-
-UINTN
-GetCapacityOfQtd (
- IN UINT8 *BufferCursor
- )
-/*++
-
-Routine Description:
-
- Get Capacity of Qtd
-
-Arguments:
-
- BufferCursor - BufferCursor of the Qtd
-
-Returns:
-
- Capacity of Qtd
-
---*/
-;
-
-UINTN
-GetApproxiOfInterval (
- IN UINTN Interval
- )
-/*++
-
-Routine Description:
-
- Get the approximate value in the 2 index sequence
-
-Arguments:
-
- Interval - the value of interval
-
-Returns:
-
- approximate value of interval in the 2 index sequence
-
---*/
-;
-
-EHCI_QTD_HW *
-GetQtdNextPointer (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Get Qtd next pointer field
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- A pointer to next hardware Qtd structure
-
---*/
-;
-
-BOOLEAN
-IsQtdStatusActive (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Whether Qtd status is active or not
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- TRUE Active
- FALSE Inactive
-
---*/
-;
-
-BOOLEAN
-IsQtdStatusHalted (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Whether Qtd status is halted or not
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- TRUE Halted
- FALSE Not halted
-
---*/
-;
-
-BOOLEAN
-IsQtdStatusBufferError (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Whether Qtd status is buffer error or not
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- TRUE Buffer error
- FALSE No buffer error
-
---*/
-;
-
-BOOLEAN
-IsQtdStatusBabbleError (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Whether Qtd status is babble error or not
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- TRUE Babble error
- FALSE No babble error
-
---*/
-;
-
-BOOLEAN
-IsQtdStatusTransactionError (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Whether Qtd status is transaction error or not
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- TRUE Transaction error
- FALSE No transaction error
-
---*/
-;
-
-BOOLEAN
-IsDataInTransfer (
- IN UINT8 EndPointAddress
- )
-/*++
-
-Routine Description:
-
- Whether is a DataIn direction transfer
-
-Arguments:
-
- EndPointAddress - address of the endpoint
-
-Returns:
-
- TRUE DataIn
- FALSE DataOut
-
---*/
-;
-
-EFI_STATUS
-MapDataBuffer (
- IN USB2_HC_DEV *HcDev,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- OUT UINT8 *PktId,
- OUT UINT8 **DataCursor,
- OUT VOID **DataMap
- )
-/*++
-
-Routine Description:
-
- Map address of user data buffer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- TransferDirection - direction of transfer
- Data - A pointer to user data buffer
- DataLength - length of user data
- PktId - Packte Identificaion
- DataCursor - mapped address to return
- DataMap - identificaion of this mapping to return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-EFI_STATUS
-MapRequestBuffer (
- IN USB2_HC_DEV *HcDev,
- IN OUT VOID *Request,
- OUT UINT8 **RequestCursor,
- OUT VOID **RequestMap
- )
-/*++
-
-Routine Description:
-
- Map address of request structure buffer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Request - A pointer to request structure
- RequestCursor - Mapped address of request structure to return
- RequestMap - Identificaion of this mapping to return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-VOID
-SetQtdBufferPointer (
- IN EHCI_QTD_HW *QtdHwPtr,
- IN VOID *DataPtr,
- IN UINTN DataLen
- )
-/*++
-
-Routine Description:
-
- Set data buffer pointers in Qtd
-
-Arguments:
-
- QtdHwPtr - A pointer to Qtd hardware structure
- DataPtr - A pointer to user data buffer
- DataLen - Length of the user data buffer
-
-Returns:
-
- VOID
-
---*/
-;
-
-EHCI_QTD_HW *
-GetQtdAlternateNextPointer (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Get Qtd alternate next pointer field
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- A pointer to hardware alternate Qtd
-
---*/
-;
-
-VOID
-ZeroOutQhOverlay (
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Zero out the fields in Qh structure
-
-Arguments:
-
- QhPtr - A pointer to Qh structure
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-UpdateAsyncRequestTransfer (
- IN EHCI_ASYNC_REQUEST *AsyncRequestPtr,
- IN UINT32 TransferResult,
- IN UINTN ErrTDPos
- )
-/*++
-
-Routine Description:
-
- Update asynchronous request transfer
-
-Arguments:
-
- AsyncRequestPtr - A pointer to async request
- TransferResult - transfer result
- ErrQtdPos - postion of error Qtd
-
-Returns:
-
- VOID
-
---*/
-;
-
-
-EFI_STATUS
-DeleteAsyncRequestTransfer (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- OUT UINT8 *DataToggle
- )
-/*++
-
-Routine Description:
-
- Delete all asynchronous request transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DeviceAddress - address of usb device
- EndPointAddress - address of endpoint
- DataToggle - stored data toggle
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-VOID
-CleanUpAllAsyncRequestTransfer (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Clean up all asynchronous request transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
- VOID
-
---*/
-;
-
-EFI_STATUS
-ExecuteTransfer (
- IN USB2_HC_DEV *HcDev,
- IN BOOLEAN IsControl,
- IN EHCI_QH_ENTITY *QhPtr,
- IN OUT UINTN *ActualLen,
- OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- )
-/*++
-
-Routine Description:
-
- Execute Bulk or SyncInterrupt Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- IsControl - Is control transfer or not
- QhPtr - A pointer to Qh
- ActualLen - Actual transfered Len
- DataToggle - Data Toggle
- TimeOut - TimeOut threshold
- TransferResult - Transfer result
-
-Returns:
-
- EFI_SUCCESS Sucess
- EFI_DEVICE_ERROR Error
-
---*/
-;
-
-BOOLEAN
-CheckQtdsTransferResult (
- IN BOOLEAN IsControl,
- IN EHCI_QH_ENTITY *QhPtr,
- OUT UINT32 *Result,
- OUT UINTN *ErrQtdPos,
- OUT UINTN *ActualLen
- )
-/*++
-
-Routine Description:
-
- Check transfer result of Qtds
-
-Arguments:
-
- IsControl - Is control transfer or not
- QhPtr - A pointer to Qh
- Result - Transfer result
- ErrQtdPos - Error TD Position
- ActualLen - Actual Transfer Size
-
-Returns:
-
- TRUE Qtds finished
- FALSE Not finish
-
---*/
-;
-
-EFI_STATUS
-AsyncRequestMoniter (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Interrupt transfer periodic check handler
-
-Arguments:
-
- Event - Interrupt event
- Context - Pointer to USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-;
-
-
-EFI_STATUS
-CreateNULLQH (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Create the NULL QH to make it as the Async QH header
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
---*/
-;
-
-VOID
-DestroyNULLQH (
- IN USB2_HC_DEV *HcDev
- );
-
-VOID
-ClearLegacySupport (
- IN USB2_HC_DEV *HcDev
- );
-
-VOID
-HostReset (
- IN USB2_HC_DEV *HcDev
- );
-
-
-VOID
-DumpEHCIPortsStatus (
- IN USB2_HC_DEV *HcDev
- );
-
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.msa b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.msa
deleted file mode 100644
index 9e71d0e..0000000
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.msa
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Ehci</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>BDFE430E-8F2A-4db0-9991-6F856594777E</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Ehci module</Abstract>
- <Description>This module provides USB2 Host Controller Protocol implementation for Enhanced Host Controller Interface</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Ehci</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Ehci.c</Filename>
- <Filename>Debug.c</Filename>
- <Filename>EhciMem.c</Filename>
- <Filename>EhciReg.c</Filename>
- <Filename>EhciSched.c</Filename>
- <Filename>ComponentName.c</Filename>
- <Filename>Ehci.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiUsb2HcProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gEhciDriverBinding</DriverBinding>
- <ComponentName>gEhciComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciMem.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciMem.c
deleted file mode 100644
index db7412b..0000000
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciMem.c
+++ /dev/null
@@ -1,771 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EhciMem.c
-
-Abstract:
-
-
-Revision History
---*/
-
-#include "Ehci.h"
-
-
-EFI_STATUS
-CreateMemoryBlock (
- IN USB2_HC_DEV *HcDev,
- OUT MEMORY_MANAGE_HEADER **MemoryHeader,
- IN UINTN MemoryBlockSizeInPages
- )
-/*++
-
-Routine Description:
-
- Use PciIo->AllocateBuffer to allocate common buffer for the memory block,
- and use PciIo->Map to map the common buffer for Bus Master Read/Write.
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- MemoryHeader - MEMORY_MANAGE_HEADER to output
- MemoryBlockSizeInPages - MemoryBlockSizeInPages
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Fail for no resources
- EFI_UNSUPPORTED Unsupported currently
-
---*/
-{
- EFI_STATUS Status;
- VOID *CommonBuffer;
- EFI_PHYSICAL_ADDRESS MappedAddress;
- UINTN MemoryBlockSizeInBytes;
- VOID *Mapping;
-
- //
- // Allocate memory for MemoryHeader
- //
- *MemoryHeader = AllocateZeroPool (sizeof (MEMORY_MANAGE_HEADER));
- if (*MemoryHeader == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- (*MemoryHeader)->Next = NULL;
-
- //
- // set Memory block size
- //
- (*MemoryHeader)->MemoryBlockSizeInBytes = EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages);
-
- //
- // each bit in Bit Array will manage 32 bytes memory in memory block
- //
- (*MemoryHeader)->BitArraySizeInBytes = ((*MemoryHeader)->MemoryBlockSizeInBytes / MEM_UNIT_SIZE) / 8;
-
- //
- // Allocate memory for BitArray
- //
- (*MemoryHeader)->BitArrayPtr = AllocateZeroPool ((*MemoryHeader)->BitArraySizeInBytes);
- if ((*MemoryHeader)->BitArrayPtr == NULL) {
- gBS->FreePool (*MemoryHeader);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Memory Block uses MemoryBlockSizeInPages pages,
- // and it is allocated as common buffer use.
- //
- Status = HcDev->PciIo->AllocateBuffer (
- HcDev->PciIo,
- AllocateAnyPages,
- EfiBootServicesData,
- MemoryBlockSizeInPages,
- &CommonBuffer,
- 0
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool ((*MemoryHeader)->BitArrayPtr);
- gBS->FreePool (*MemoryHeader);
- return EFI_OUT_OF_RESOURCES;
- }
-
- MemoryBlockSizeInBytes = EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages);
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterCommonBuffer,
- CommonBuffer,
- &MemoryBlockSizeInBytes,
- &MappedAddress,
- &Mapping
- );
- //
- // If returned Mapped size is less than the size
- // we request,do not support.
- //
- if (EFI_ERROR (Status) || (MemoryBlockSizeInBytes != EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages))) {
- HcDev->PciIo->FreeBuffer (HcDev->PciIo, MemoryBlockSizeInPages, CommonBuffer);
- gBS->FreePool ((*MemoryHeader)->BitArrayPtr);
- gBS->FreePool (*MemoryHeader);
- return EFI_UNSUPPORTED;
- }
-
- //
- // Data structure involved by host controller
- // should be restricted into the same 4G
- //
- if (HcDev->Is64BitCapable != 0) {
- if (HcDev->High32BitAddr != GET_32B_TO_63B (MappedAddress)) {
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- HcDev->PciIo->FreeBuffer (HcDev->PciIo, MemoryBlockSizeInPages, CommonBuffer);
- gBS->FreePool ((*MemoryHeader)->BitArrayPtr);
- gBS->FreePool (*MemoryHeader);
- return EFI_UNSUPPORTED;
- }
- }
-
- //
- // Set Memory block initial address
- //
- (*MemoryHeader)->MemoryBlockPtr = (UINT8 *) ((UINTN) MappedAddress);
- (*MemoryHeader)->Mapping = Mapping;
-
- ZeroMem (
- (*MemoryHeader)->MemoryBlockPtr,
- EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages)
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FreeMemoryHeader (
- IN USB2_HC_DEV *HcDev,
- IN MEMORY_MANAGE_HEADER *MemoryHeader
- )
-/*++
-
-Routine Description:
-
- Free Memory Header
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- MemoryHeader - MemoryHeader to be freed
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_INVALID_PARAMETER Parameter is error
-
---*/
-{
- if ((MemoryHeader == NULL) || (HcDev == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // unmap the common buffer used by the memory block
- //
- HcDev->PciIo->Unmap (HcDev->PciIo, MemoryHeader->Mapping);
-
- //
- // free common buffer
- //
- HcDev->PciIo->FreeBuffer (
- HcDev->PciIo,
- EFI_SIZE_TO_PAGES (MemoryHeader->MemoryBlockSizeInBytes),
- MemoryHeader->MemoryBlockPtr
- );
- //
- // free bit array
- //
- gBS->FreePool (MemoryHeader->BitArrayPtr);
- //
- // free memory header
- //
- gBS->FreePool (MemoryHeader);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EhciAllocatePool (
- IN USB2_HC_DEV *HcDev,
- OUT UINT8 **Pool,
- IN UINTN AllocSize
- )
-/*++
-
-Routine Description:
-
- Ehci Allocate Pool
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Pool - Place to store pointer to the memory buffer
- AllocSize - Alloc Size
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- MEMORY_MANAGE_HEADER *MemoryHeader;
- MEMORY_MANAGE_HEADER *TempHeaderPtr;
- MEMORY_MANAGE_HEADER *NewMemoryHeader;
- UINTN RealAllocSize;
- UINTN MemoryBlockSizeInPages;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- *Pool = NULL;
-
- MemoryHeader = HcDev->MemoryHeader;
- ASSERT (MemoryHeader != NULL);
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY + 1);
-
- //
- // allocate unit is 32 bytes (align on 32 byte)
- //
- if (AllocSize & (MEM_UNIT_SIZE - 1)) {
- RealAllocSize = (AllocSize / MEM_UNIT_SIZE + 1) * MEM_UNIT_SIZE;
- } else {
- RealAllocSize = AllocSize;
- }
-
- //
- // There may be linked MemoryHeaders.
- // To allocate a free pool in Memory blocks,
- // must search in the MemoryHeader link list
- // until enough free pool is found.
- //
- Status = EFI_NOT_FOUND;
- for (TempHeaderPtr = MemoryHeader; TempHeaderPtr != NULL; TempHeaderPtr = TempHeaderPtr->Next) {
-
- Status = AllocMemInMemoryBlock (
- TempHeaderPtr,
- (VOID **) Pool,
- RealAllocSize / MEM_UNIT_SIZE
- );
- if (!EFI_ERROR (Status)) {
- break;
- }
- }
-
- gBS->RestoreTPL (OldTpl);
-
- if (!EFI_ERROR (Status)) {
- ZeroMem (*Pool, AllocSize);
- return EFI_SUCCESS;
- }
-
-
- //
- // There is no enough memory,
- // Create a new Memory Block
- //
-
- //
- // if pool size is larger than NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES,
- // just allocate a large enough memory block.
- //
- if (RealAllocSize > EFI_PAGES_TO_SIZE (NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES)) {
- MemoryBlockSizeInPages = EFI_SIZE_TO_PAGES (RealAllocSize) + 1;
- } else {
- MemoryBlockSizeInPages = NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES;
- }
-
- Status = CreateMemoryBlock (HcDev, &NewMemoryHeader, MemoryBlockSizeInPages);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY + 1);
-
- //
- // Link the new Memory Block to the Memory Header list
- //
- InsertMemoryHeaderToList (MemoryHeader, NewMemoryHeader);
-
- Status = AllocMemInMemoryBlock (
- NewMemoryHeader,
- (VOID **) Pool,
- RealAllocSize / MEM_UNIT_SIZE
- );
-
- gBS->RestoreTPL (OldTpl);
-
- if (!EFI_ERROR (Status)) {
- ZeroMem (*Pool, AllocSize);
- }
-
- return Status;
-}
-
-VOID
-EhciFreePool (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 *Pool,
- IN UINTN AllocSize
- )
-/*++
-
-Routine Description:
-
- Uhci Free Pool
-
-Arguments:
-
- HcDev - USB_HC_DEV
- Pool - Pool to free
- AllocSize - Pool size
-
-Returns:
-
- VOID
-
---*/
-{
- MEMORY_MANAGE_HEADER *MemoryHeader;
- MEMORY_MANAGE_HEADER *TempHeaderPtr;
- UINTN StartBytePos;
- UINTN Index;
- UINT8 StartBitPos;
- UINT8 Index2;
- UINTN Count;
- UINTN RealAllocSize;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY + 1);
-
- MemoryHeader = HcDev->MemoryHeader;
-
- //
- // allocate unit is 32 byte (align on 32 byte)
- //
- if (AllocSize & (MEM_UNIT_SIZE - 1)) {
- RealAllocSize = (AllocSize / MEM_UNIT_SIZE + 1) * MEM_UNIT_SIZE;
- } else {
- RealAllocSize = AllocSize;
- }
-
- //
- // scan the memory header linked list for
- // the asigned memory to free.
- //
- for (TempHeaderPtr = MemoryHeader; TempHeaderPtr != NULL; TempHeaderPtr = TempHeaderPtr->Next) {
-
- if ((Pool >= TempHeaderPtr->MemoryBlockPtr) &&
- ((Pool + RealAllocSize) <= (TempHeaderPtr->MemoryBlockPtr + TempHeaderPtr->MemoryBlockSizeInBytes))
- ) {
- //
- // Pool is in the Memory Block area,
- // find the start byte and bit in the bit array
- //
- StartBytePos = ((Pool - TempHeaderPtr->MemoryBlockPtr) / MEM_UNIT_SIZE) / 8;
- StartBitPos = (UINT8) (((Pool - TempHeaderPtr->MemoryBlockPtr) / MEM_UNIT_SIZE) & 0x7);
-
- //
- // reset associated bits in bit arry
- //
- for (Index = StartBytePos, Index2 = StartBitPos, Count = 0; Count < (RealAllocSize / MEM_UNIT_SIZE); Count++) {
- ASSERT ((TempHeaderPtr->BitArrayPtr[Index] & bit (Index2) )== bit (Index2));
-
- TempHeaderPtr->BitArrayPtr[Index] = (UINT8) (TempHeaderPtr->BitArrayPtr[Index] ^ (bit (Index2)));
- Index2++;
- if (Index2 == 8) {
- Index += 1;
- Index2 = 0;
- }
- }
- //
- // break the loop
- //
- break;
- }
- }
-
- //
- // Release emptied memory blocks (only if the memory block is not
- // the first one in the memory header list
- //
- for (TempHeaderPtr = MemoryHeader->Next; TempHeaderPtr != NULL;) {
-
- ASSERT (MemoryHeader->Next != NULL);
-
- if (IsMemoryBlockEmptied (TempHeaderPtr)) {
-
- DelinkMemoryBlock (MemoryHeader, TempHeaderPtr);
- //
- // when the TempHeaderPtr is freed in FreeMemoryHeader(),
- // the TempHeaderPtr is pointing to nonsense content.
- //
- gBS->RestoreTPL (OldTpl);
- FreeMemoryHeader (HcDev, TempHeaderPtr);
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY + 1);
- //
- // reset the TempHeaderPtr, continue search for
- // another empty memory block.
- //
- TempHeaderPtr = MemoryHeader->Next;
- continue;
- }
-
- TempHeaderPtr = TempHeaderPtr->Next;
- }
-
- gBS->RestoreTPL (OldTpl);
-}
-
-VOID
-InsertMemoryHeaderToList (
- IN MEMORY_MANAGE_HEADER *MemoryHeader,
- IN MEMORY_MANAGE_HEADER *NewMemoryHeader
- )
-/*++
-
-Routine Description:
-
- Insert Memory Header To List
-
-Arguments:
-
- MemoryHeader - MEMORY_MANAGE_HEADER
- NewMemoryHeader - MEMORY_MANAGE_HEADER
-
-Returns:
-
- VOID
-
---*/
-{
- MEMORY_MANAGE_HEADER *TempHeaderPtr;
-
- for (TempHeaderPtr = MemoryHeader; TempHeaderPtr != NULL; TempHeaderPtr = TempHeaderPtr->Next) {
- if (TempHeaderPtr->Next == NULL) {
- TempHeaderPtr->Next = NewMemoryHeader;
- break;
- }
- }
-}
-
-EFI_STATUS
-AllocMemInMemoryBlock (
- IN MEMORY_MANAGE_HEADER *MemoryHeader,
- OUT VOID **Pool,
- IN UINTN NumberOfMemoryUnit
- )
-/*++
-
-Routine Description:
-
- Alloc Memory In MemoryBlock
-
-Arguments:
-
- MemoryHeader - MEMORY_MANAGE_HEADER
- Pool - Place to store pointer to memory
- NumberOfMemoryUnit - Number Of Memory Unit
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_NOT_FOUND Can't find the free memory
-
---*/
-{
- UINTN TempBytePos;
- UINTN FoundBytePos;
- UINT8 Index;
- UINT8 FoundBitPos;
- UINT8 ByteValue;
- UINT8 BitValue;
- UINTN NumberOfZeros;
- UINTN Count;
-
- FoundBytePos = 0;
- FoundBitPos = 0;
- ByteValue = MemoryHeader->BitArrayPtr[0];
- NumberOfZeros = 0;
- Index = 0;
-
- for (TempBytePos = 0; TempBytePos < MemoryHeader->BitArraySizeInBytes;) {
-
- //
- // Pop out BitValue from a byte in TempBytePos.
- //
- BitValue = (UINT8) (ByteValue & 0x1);
-
- //
- // right shift the byte
- //
- ByteValue = (UINT8) (ByteValue >> 1);
-
- if (BitValue == 0) {
- //
- // Found a free bit, the NumberOfZeros only record the number
- // of those consecutive zeros
- //
- NumberOfZeros++;
- //
- // Found enough consecutive free space, break the loop
- //
- if (NumberOfZeros >= NumberOfMemoryUnit) {
- break;
- }
- } else {
- //
- // Encountering a '1', meant the bit is ocupied.
- //
- if (NumberOfZeros >= NumberOfMemoryUnit) {
- //
- // Found enough consecutive free space,break the loop
- //
- break;
- } else {
- //
- // the NumberOfZeros only record the number of those consecutive zeros,
- // so reset the NumberOfZeros to 0 when encountering '1' before finding
- // enough consecutive '0's
- //
- NumberOfZeros = 0;
- //
- // reset the (FoundBytePos,FoundBitPos) to the position of '1'
- //
- FoundBytePos = TempBytePos;
- FoundBitPos = Index;
- }
- }
-
- //
- // step forward a bit
- //
- Index++;
- if (Index == 8) {
- //
- // step forward a byte, getting the byte value,
- // and reset the bit pos.
- //
- TempBytePos += 1;
- ByteValue = MemoryHeader->BitArrayPtr[TempBytePos];
- Index = 0;
- }
- }
-
- if (NumberOfZeros < NumberOfMemoryUnit) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Found enough free space.
- //
-
- //
- // The values recorded in (FoundBytePos,FoundBitPos) have two conditions:
- // 1)(FoundBytePos,FoundBitPos) record the position
- // of the last '1' before the consecutive '0's, it must
- // be adjusted to the start position of the consecutive '0's.
- // 2)the start address of the consecutive '0's is just the start of
- // the bitarray. so no need to adjust the values of
- // (FoundBytePos,FoundBitPos).
- //
- if ((MemoryHeader->BitArrayPtr[FoundBytePos] & bit (FoundBitPos)) != 0) {
- FoundBitPos += 1;
- }
-
- //
- // Have the (FoundBytePos,FoundBitPos) make sense.
- //
- if (FoundBitPos > 7) {
- FoundBytePos += 1;
- FoundBitPos -= 8;
- }
-
- //
- // Set the memory as allocated
- //
- for (TempBytePos = FoundBytePos, Index = FoundBitPos, Count = 0; Count < NumberOfMemoryUnit; Count++) {
-
- ASSERT ((MemoryHeader->BitArrayPtr[TempBytePos] & bit (Index) )== 0);
- MemoryHeader->BitArrayPtr[TempBytePos] = (UINT8) (MemoryHeader->BitArrayPtr[TempBytePos] | bit (Index));
- Index++;
- if (Index == 8) {
- TempBytePos += 1;
- Index = 0;
- }
- }
-
- *Pool = MemoryHeader->MemoryBlockPtr + (FoundBytePos * 8 + FoundBitPos) * MEM_UNIT_SIZE;
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-IsMemoryBlockEmptied (
- IN MEMORY_MANAGE_HEADER *MemoryHeaderPtr
- )
-/*++
-
-Routine Description:
-
- Is Memory Block Emptied
-
-Arguments:
-
- MemoryHeaderPtr - MEMORY_MANAGE_HEADER
-
-Returns:
-
- TRUE Empty
- FALSE Not Empty
-
---*/
-{
- UINTN Index;
-
- for (Index = 0; Index < MemoryHeaderPtr->BitArraySizeInBytes; Index++) {
- if (MemoryHeaderPtr->BitArrayPtr[Index] != 0) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-VOID
-DelinkMemoryBlock (
- IN MEMORY_MANAGE_HEADER *FirstMemoryHeader,
- IN MEMORY_MANAGE_HEADER *NeedFreeMemoryHeader
- )
-/*++
-
-Routine Description:
-
- Delink Memory Block
-
-Arguments:
-
- FirstMemoryHeader - MEMORY_MANAGE_HEADER
- NeedFreeMemoryHeader - MEMORY_MANAGE_HEADER
-
-Returns:
-
- VOID
-
---*/
-{
- MEMORY_MANAGE_HEADER *TempHeaderPtr;
-
- if ((FirstMemoryHeader == NULL) || (NeedFreeMemoryHeader == NULL)) {
- return ;
- }
-
- for (TempHeaderPtr = FirstMemoryHeader; TempHeaderPtr != NULL; TempHeaderPtr = TempHeaderPtr->Next) {
-
- if (TempHeaderPtr->Next == NeedFreeMemoryHeader) {
- //
- // Link the before and after
- //
- TempHeaderPtr->Next = NeedFreeMemoryHeader->Next;
- NeedFreeMemoryHeader->Next = NULL;
- break;
- }
- }
-}
-
-EFI_STATUS
-InitialMemoryManagement (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Initialize Memory Management
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- MEMORY_MANAGE_HEADER *MemoryHeader;
- UINTN MemPages;
-
- MemPages = NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES;
- Status = CreateMemoryBlock (HcDev, &MemoryHeader, MemPages);
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
-
- HcDev->MemoryHeader = MemoryHeader;
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-DeinitialMemoryManagement (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Deinitialize Memory Management
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- MEMORY_MANAGE_HEADER *TempHeaderPtr;
-
- for (TempHeaderPtr = HcDev->MemoryHeader->Next; TempHeaderPtr != NULL;) {
-
- DelinkMemoryBlock (HcDev->MemoryHeader, TempHeaderPtr);
- //
- // when the TempHeaderPtr is freed in FreeMemoryHeader(),
- // the TempHeaderPtr is pointing to nonsense content.
- //
- FreeMemoryHeader (HcDev, TempHeaderPtr);
- //
- // reset the TempHeaderPtr,continue free another memory block.
- //
- TempHeaderPtr = HcDev->MemoryHeader->Next;
- }
-
- FreeMemoryHeader (HcDev, HcDev->MemoryHeader);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciReg.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciReg.c
deleted file mode 100644
index 78bca3b..0000000
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciReg.c
+++ /dev/null
@@ -1,1730 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ehchlp.c
-
-Abstract:
-
-
-Revision History
---*/
-
-#include "Ehci.h"
-
-
-VOID
-HostReset (
- IN USB2_HC_DEV *HcDev
- )
-{
- UINT32 Value;
- UINT32 TimeOut;
-
- ReadEhcOperationalReg (
- HcDev,
- USBCMD,
- &Value
- );
-
- Value = Value & (~USBCMD_RS);
- WriteEhcOperationalReg (
- HcDev,
- USBCMD,
- Value
- );
-
- TimeOut = 40;
- while (TimeOut --) {
- gBS->Stall (500);
- ReadEhcOperationalReg (
- HcDev,
- USBSTS,
- &Value
- );
- if ((Value & USBSTS_HCH) != 0) {
- break;
- }
- }
-
- if (TimeOut == 0) {
- DEBUG((gEHCErrorLevel, "TimeOut for clearing Run/Stop bit\n"));
- }
-
- ReadEhcOperationalReg (
- HcDev,
- USBCMD,
- &Value
- );
- Value = Value | USBCMD_HCRESET;
- WriteEhcOperationalReg (
- HcDev,
- USBCMD,
- Value
- );
-
- TimeOut = 40;
- while (TimeOut --) {
- gBS->Stall (500);
- ReadEhcOperationalReg (
- HcDev,
- USBCMD,
- &Value
- );
- if ((Value & USBCMD_HCRESET) == 0) {
- break;
- }
- }
-
- if (TimeOut == 0) {
- DEBUG((gEHCErrorLevel, "TimeOut for Host Reset\n"));
- }
-
-}
-
-EFI_STATUS
-ReadEhcCapabiltiyReg (
- IN USB2_HC_DEV *HcDev,
- IN UINT32 CapabiltiyRegAddr,
- IN OUT UINT32 *Data
- )
-/*++
-
-Routine Description:
-
- Read Ehc Capabitlity register
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- CapabiltiyRegAddr - Ehc Capability register address
- Data - A pointer to data read from register
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- return HcDev->PciIo->Mem.Read (
- HcDev->PciIo,
- EfiPciIoWidthUint32,
- USB_BAR_INDEX,
- (UINT64) CapabiltiyRegAddr,
- 1,
- Data
- );
-}
-
-EFI_STATUS
-ReadEhcOperationalReg (
- IN USB2_HC_DEV *HcDev,
- IN UINT32 OperationalRegAddr,
- IN OUT UINT32 *Data
- )
-/*++
-
-Routine Description:
-
- Read Ehc Operation register
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- OperationalRegAddr - Ehc Operation register address
- Data - A pointer to data read from register
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- ASSERT (HcDev->UsbCapabilityLen);
- return HcDev->PciIo->Mem.Read (
- HcDev->PciIo,
- EfiPciIoWidthUint32,
- USB_BAR_INDEX,
- (UINT64) (OperationalRegAddr + HcDev->UsbCapabilityLen),
- 1,
- Data
- );
-}
-
-EFI_STATUS
-WriteEhcOperationalReg (
- IN USB2_HC_DEV *HcDev,
- IN UINT32 OperationalRegAddr,
- IN UINT32 Data
- )
-/*++
-
-Routine Description:
-
- Write Ehc Operation register
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- OperationalRegAddr - Ehc Operation register address
- Data - 32bit write to register
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- ASSERT (HcDev->UsbCapabilityLen);
- return HcDev->PciIo->Mem.Write (
- HcDev->PciIo,
- EfiPciIoWidthUint32,
- USB_BAR_INDEX,
- (UINT64) (OperationalRegAddr + HcDev->UsbCapabilityLen),
- 1,
- &Data
- );
-}
-
-
-
-VOID
-ClearLegacySupport (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Stop the legacy USB SMI
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- UINT32 EECP;
- UINT32 Value;
- UINT32 TimeOut;
-
- ReadEhcCapabiltiyReg (
- HcDev,
- HCCPARAMS,
- &EECP
- );
-
- EECP = (EECP >> 8) & 0xFF;
-
- DEBUG ((gEHCDebugLevel, "EHCI: EECPBase = 0x%x\n", EECP));
-
-
- HcDev->PciIo->Pci.Read (
- HcDev->PciIo,
- EfiPciIoWidthUint32,
- EECP,
- 1,
- &Value
- );
-
- DEBUG((gEHCDebugLevel, "EECP[0] = 0x%x\n", Value));
-
- HcDev->PciIo->Pci.Read (
- HcDev->PciIo,
- EfiPciIoWidthUint32,
- EECP + 0x4,
- 1,
- &Value
- );
-
- DEBUG((gEHCDebugLevel, "EECP[4] = 0x%x\n", Value));
-
- HcDev->PciIo->Pci.Read (
- HcDev->PciIo,
- EfiPciIoWidthUint32,
- EECP,
- 1,
- &Value
- );
-
- Value = Value | (0x1 << 24);
- DEBUG((gEHCErrorLevel, "Value Written = 0x%x\n", Value));
-
- HcDev->PciIo->Pci.Write (
- HcDev->PciIo,
- EfiPciIoWidthUint32,
- EECP,
- 1,
- &Value
- );
-
- TimeOut = 40;
- while (TimeOut --) {
- gBS->Stall (500);
-
- HcDev->PciIo->Pci.Read (
- HcDev->PciIo,
- EfiPciIoWidthUint32,
- EECP,
- 1,
- &Value
- );
- if ((Value & 0x01010000) == 0x01000000) {
- break;
- }
- }
-
- if (TimeOut == 0) {
- DEBUG((gEHCErrorLevel, "Timeout for getting HC OS Owned Semaphore\n" ));
- }
-
- DEBUG((gEHCErrorLevel, "After Release Value\n" ));
-
- HcDev->PciIo->Pci.Read (
- HcDev->PciIo,
- EfiPciIoWidthUint32,
- EECP,
- 1,
- &Value
- );
-
- DEBUG((gEHCDebugLevel, "EECP[0] = 0x%x\n", Value));
-
- HcDev->PciIo->Pci.Read (
- HcDev->PciIo,
- EfiPciIoWidthUint32,
- EECP + 0x4,
- 1,
- &Value
- );
-
- DEBUG((gEHCDebugLevel, "EECP[4] = 0x%x\n", Value));
-
-
-}
-
-EFI_STATUS
-GetCapabilityLen (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Get the length of capability register
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 CapabilityLenAddr;
-
- CapabilityLenAddr = CAPLENGTH;
-
- Status = ReadEhcCapabiltiyReg (
- HcDev,
- CapabilityLenAddr,
- &(HcDev->UsbCapabilityLen)
- );
- HcDev->UsbCapabilityLen = (UINT8) HcDev->UsbCapabilityLen;
-
- return Status;
-}
-
-EFI_STATUS
-SetFrameListLen (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Length
- )
-/*++
-
-Routine Description:
-
- Set the length of Frame List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Length - the required length of frame list
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_INVALID_PARAMETER Invalid parameter
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
-
- UsbCommandAddr = USBCMD;
-
- if (256 != Length && 512 != Length) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- if (256 == Length) {
- UsbCommandReg |= USBCMD_FLS_256;
- } else {
- UsbCommandReg |= USBCMD_FLS_512;
- }
-
- Status = WriteEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-SetFrameListBaseAddr (
- IN USB2_HC_DEV *HcDev,
- IN UINT32 FrameBuffer
- )
-/*++
-
-Routine Description:
-
- Set base address of frame list first entry
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- FrameBuffer - base address of first entry of frame list
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- UINT32 PeriodicListBaseAddr;
- UINT32 PeriodicListBaseReg;
-
- Status = EFI_SUCCESS;
- PeriodicListBaseAddr = PERIODICLISTBASE;
- PeriodicListBaseReg = FrameBuffer & 0xfffff000;
-
- if (IsEhcHalted (HcDev)) {
-
- Status = WriteEhcOperationalReg (
- HcDev,
- PeriodicListBaseAddr,
- PeriodicListBaseReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-SetAsyncListAddr (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Set address of first Async schedule Qh
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to first Qh in the Async schedule
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 AsyncListAddr;
- UINT32 AsyncListReg;
-
- AsyncListAddr = ASYNCLISTADDR;
- AsyncListReg = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh));
-
- Status = WriteEhcOperationalReg (
- HcDev,
- AsyncListAddr,
- AsyncListReg
- );
-
- return Status;
-}
-
-EFI_STATUS
-SetCtrlDataStructSeg (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Set register of control and data structure segment
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
-
---*/
-{
- EFI_STATUS Status;
- UINT32 CtrlDsSegmentAddr;
- UINT32 CtrlDsSegmentReg;
-
- CtrlDsSegmentAddr = CTRLDSSGMENT;
- CtrlDsSegmentReg = HcDev->High32BitAddr;
-
- Status = WriteEhcOperationalReg (
- HcDev,
- CtrlDsSegmentAddr,
- CtrlDsSegmentReg
- );
-
- return Status;
-}
-
-EFI_STATUS
-SetPortRoutingEhc (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Set Ehc port routing bit
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 ConfigFlagAddr;
- UINT32 ConfigFlagReg;
-
- ConfigFlagAddr = CONFIGFLAG;
-
- Status = ReadEhcOperationalReg (
- HcDev,
- ConfigFlagAddr,
- &ConfigFlagReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- ConfigFlagReg |= CONFIGFLAG_CF;
- Status = WriteEhcOperationalReg (
- HcDev,
- ConfigFlagAddr,
- ConfigFlagReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-SetEhcDoorbell (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Set Ehc door bell bit
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
-
- UsbCommandAddr = USBCMD;
-
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- UsbCommandReg |= USBCMD_IAAD;
- Status = WriteEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-ClearEhcAllStatus (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Clear Ehc all status bits
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- UINT32 UsbStatusAddr;
-
- UsbStatusAddr = USBSTS;
-
- return WriteEhcOperationalReg (
- HcDev,
- UsbStatusAddr,
- 0x003F
- );
-}
-
-EFI_STATUS
-EnablePeriodicSchedule (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Enable periodic schedule
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
-
- UsbCommandAddr = USBCMD;
-
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- UsbCommandReg |= USBCMD_PSE;
- Status = WriteEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-DisablePeriodicSchedule (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Disable periodic schedule
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
-
- UsbCommandAddr = USBCMD;
-
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- UsbCommandReg &= ~USBCMD_PSE;
- Status = WriteEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- return Status;
-}
-
-EFI_STATUS
-EnableAsynchronousSchedule (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Enable asynchrounous schedule
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
-
- UsbCommandAddr = USBCMD;
-
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- UsbCommandReg |= USBCMD_ASE;
- Status = WriteEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-DisableAsynchronousSchedule (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Disable asynchrounous schedule
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
-
- UsbCommandAddr = USBCMD;
-
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- UsbCommandReg &= ~USBCMD_ASE;
- Status = WriteEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- return Status;
-}
-
-EFI_STATUS
-ResetEhc (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Reset Ehc
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
-
- UsbCommandAddr = USBCMD;
-
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- UsbCommandReg |= USBCMD_HCRESET;
- Status = WriteEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-StartScheduleExecution (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Start Ehc schedule execution
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
-
- UsbCommandAddr = USBCMD;
-
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- UsbCommandReg |= USBCMD_RS;
- Status = WriteEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
-exit:
- return Status;
-}
-
-BOOLEAN
-IsFrameListProgrammable (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether frame list is programmable
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Programmable
- FALSE Unprogrammable
-
---*/
-{
- BOOLEAN Value;
- UINT32 HcCapParamsAddr;
- UINT32 HcCapParamsReg;
-
- HcCapParamsAddr = HCCPARAMS;
-
- ReadEhcCapabiltiyReg(
- HcDev,
- HcCapParamsAddr,
- &HcCapParamsReg
- );
-
- if (HcCapParamsReg & HCCP_PFLF) {
- Value = TRUE;
- } else {
- Value = FALSE;
- }
-
- return Value;
-}
-
-BOOLEAN
-IsPeriodicScheduleEnabled (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether periodic schedule is enabled
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Enabled
- FALSE Disabled
-
---*/
-{
- BOOLEAN Value;
- UINT32 UsbStatusAddr;
- UINT32 UsbStatusReg;
-
- UsbStatusAddr = USBSTS;
-
- ReadEhcOperationalReg (
- HcDev,
- UsbStatusAddr,
- &UsbStatusReg
- );
-
- if (UsbStatusReg & USBSTS_PSS) {
- Value = TRUE;
- } else {
- Value = FALSE;
- }
-
- return Value;
-}
-
-BOOLEAN
-IsAsyncScheduleEnabled (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether asynchronous schedule is enabled
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Enabled
- FALSE Disabled
-
---*/
-{
- BOOLEAN Value;
- UINT32 UsbStatusAddr;
- UINT32 UsbStatusReg;
-
- UsbStatusAddr = USBSTS;
-
- ReadEhcOperationalReg (
- HcDev,
- UsbStatusAddr,
- &UsbStatusReg
- );
-
- if (UsbStatusReg & USBSTS_ASS) {
- Value = TRUE;
- } else {
- Value = FALSE;
- }
-
- return Value;
-}
-
-BOOLEAN
-IsEhcPortEnabled (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 PortNum
- )
-/*++
-
-Routine Description:
-
- Whether port is enabled
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Enabled
- FALSE Disabled
-
---*/
-{
- UINT32 PortStatusControlAddr;
- UINT32 PortStatusControlReg;
-
- PortStatusControlAddr = (UINT32) (PORTSC + (4 * PortNum));
-
- ReadEhcOperationalReg (
- HcDev,
- PortStatusControlAddr,
- &PortStatusControlReg
- );
-
- return ((BOOLEAN) ((PortStatusControlReg & PORTSC_PED) ? TRUE : FALSE));
-}
-
-BOOLEAN
-IsEhcReseted (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether Ehc is reseted
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Reseted
- FALSE Unreseted
-
---*/
-{
- BOOLEAN Value;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
-
- UsbCommandAddr = USBCMD;
-
- ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
-
- if (UsbCommandReg & USBCMD_HCRESET) {
- Value = FALSE;
- } else {
- Value = TRUE;
- }
-
- return Value;
-}
-
-BOOLEAN
-IsEhcHalted (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether Ehc is halted
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE Halted
- FALSE Not halted
-
---*/
-{
- BOOLEAN Value;
- UINT32 UsbStatusAddr;
- UINT32 UsbStatusReg;
-
- UsbStatusAddr = USBSTS;
-
- ReadEhcOperationalReg (
- HcDev,
- UsbStatusAddr,
- &UsbStatusReg
- );
-
- if (UsbStatusReg & USBSTS_HCH) {
- Value = TRUE;
- } else {
- Value = FALSE;
- }
-
- return Value;
-}
-
-BOOLEAN
-IsEhcSysError (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Whether Ehc is system error
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE System error
- FALSE No system error
-
---*/
-{
- BOOLEAN Value;
- UINT32 UsbStatusAddr;
- UINT32 UsbStatusReg;
-
- UsbStatusAddr = USBSTS;
-
- ReadEhcOperationalReg (
- HcDev,
- UsbStatusAddr,
- &UsbStatusReg
- );
-
- if (UsbStatusReg & USBSTS_HSE) {
- Value = TRUE;
- } else {
- Value = FALSE;
- }
-
- return Value;
-}
-
-BOOLEAN
-IsHighSpeedDevice (
- IN EFI_USB2_HC_PROTOCOL *This,
- IN UINT8 PortNum
- )
-/*++
-
-Routine Description:
-
- Whether high speed device attached
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- TRUE High speed
- FALSE Full speed
-
---*/
-{
- USB2_HC_DEV *HcDev;
- UINT32 PortStatusControlAddr;
- UINT32 PortStatusControlReg;
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
- PortStatusControlAddr = (UINT32) (PORTSC + (4 * PortNum));
-
- //
- // Set port reset bit
- //
- ReadEhcOperationalReg (
- HcDev,
- PortStatusControlAddr,
- &PortStatusControlReg
- );
- //
- // Make sure Host Controller not halt before reset it
- //
- if (IsEhcHalted (HcDev)) {
- StartScheduleExecution (HcDev);
- WaitForEhcNotHalt (HcDev, EHCI_GENERIC_TIMEOUT);
- }
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg |= PORTSC_PR;
- //
- // Set one to PortReset bit must also set zero to PortEnable bit
- //
- PortStatusControlReg &= ~PORTSC_PED;
- WriteEhcOperationalReg (
- HcDev,
- PortStatusControlAddr,
- PortStatusControlReg
- );
-
- //
- // Set Port reset recovery time
- //
- gBS->Stall (EHCI_SET_PORT_RESET_RECOVERY_TIME);
-
- //
- // Clear port reset bit
- //
- ReadEhcOperationalReg (
- HcDev,
- PortStatusControlAddr,
- &PortStatusControlReg
- );
- PortStatusControlReg &= 0xffffffd5;
- PortStatusControlReg &= ~PORTSC_PR;
- WriteEhcOperationalReg (
- HcDev,
- PortStatusControlAddr,
- PortStatusControlReg
- );
-
- //
- // Clear port reset recovery time
- //
- gBS->Stall (EHCI_CLEAR_PORT_RESET_RECOVERY_TIME);
-
- return ((BOOLEAN) (IsEhcPortEnabled (HcDev, PortNum) ? TRUE : FALSE));
-}
-
-EFI_STATUS
-WaitForEhcReset (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- wait for Ehc reset or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-{
- EFI_STATUS Status;
- UINTN Delay;
-
- //
- // Timeout is in US unit
- //
- Delay = (Timeout / 50) + 1;
- do {
-
- if (IsEhcReseted (HcDev)) {
- Status = EFI_SUCCESS;
- goto exit;
- }
- gBS->Stall (EHCI_GENERIC_RECOVERY_TIME);
-
- } while (Delay--);
-
- Status = EFI_TIMEOUT;
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-WaitForEhcHalt (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- wait for Ehc halt or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-{
- EFI_STATUS Status;
- UINTN Delay;
-
- //
- // Timeout is in US unit
- //
- Delay = (Timeout / 50) + 1;
- do {
-
- if (IsEhcHalted (HcDev)) {
- Status = EFI_SUCCESS;
- goto exit;
- }
- gBS->Stall (EHCI_GENERIC_RECOVERY_TIME);
-
- } while (Delay--);
-
- Status = EFI_TIMEOUT;
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-WaitForEhcNotHalt (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- wait for Ehc not halt or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-{
- EFI_STATUS Status;
- UINTN Delay;
-
- //
- // Timeout is in US unit
- //
- Delay = (Timeout / 50) + 1;
- do {
-
- if (!IsEhcHalted (HcDev)) {
- Status = EFI_SUCCESS;
- goto exit;
- }
- gBS->Stall (EHCI_GENERIC_RECOVERY_TIME);
-
- } while (Delay--);
-
- Status = EFI_TIMEOUT;
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-WaitForAsyncScheduleEnable (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait for Ehc asynchronous schedule enable or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-{
- EFI_STATUS Status;
- UINTN Delay;
-
- //
- // Timeout is in US unit
- //
- Delay = (Timeout / 50) + 1;
- do {
-
- if (IsAsyncScheduleEnabled (HcDev)) {
- Status = EFI_SUCCESS;
- goto exit;
- }
- gBS->Stall (EHCI_GENERIC_RECOVERY_TIME);
-
- } while (Delay--);
-
- Status = EFI_TIMEOUT;
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-WaitForAsyncScheduleDisable (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait for Ehc asynchronous schedule disable or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-{
- EFI_STATUS Status;
- UINTN Delay;
-
- //
- // Timeout is in US unit
- //
- Delay = (Timeout / 50) + 1;
- do {
-
- if (!IsAsyncScheduleEnabled (HcDev)) {
- Status = EFI_SUCCESS;
- goto exit;
- }
- gBS->Stall (EHCI_GENERIC_RECOVERY_TIME);
-
- } while (Delay--);
-
- Status = EFI_TIMEOUT;
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-WaitForPeriodicScheduleEnable (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait for Ehc periodic schedule enable or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-{
- EFI_STATUS Status;
- UINTN Delay;
-
- //
- // Timeout is in US unit
- //
- Delay = (Timeout / 50) + 1;
- do {
-
- if (IsPeriodicScheduleEnabled (HcDev)) {
- Status = EFI_SUCCESS;
- goto exit;
- }
- gBS->Stall (EHCI_GENERIC_RECOVERY_TIME);
-
- } while (Delay--);
-
- Status = EFI_TIMEOUT;
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-WaitForPeriodicScheduleDisable (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait for periodic schedule disable or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-{
- EFI_STATUS Status;
- UINTN Delay;
-
- //
- // Timeout is in US unit
- //
- Delay = (Timeout / 50) + 1;
- do {
-
- if (!IsPeriodicScheduleEnabled (HcDev)) {
- Status = EFI_SUCCESS;
- goto exit;
- }
- gBS->Stall (EHCI_GENERIC_RECOVERY_TIME);
-
- } while (Delay--);
-
- Status = EFI_TIMEOUT;
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-WaitForEhcDoorbell (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait for periodic schedule disable or timeout
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Timeout - timeout threshold
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_TIMEOUT Timeout
-
---*/
-{
- EFI_STATUS Status;
- UINT32 UsbCommandAddr;
- UINT32 UsbCommandReg;
- UINTN Delay;
-
- UsbCommandAddr = USBCMD;
- Delay = (Timeout / 50) + 1;
-
- do {
- Status = ReadEhcOperationalReg (
- HcDev,
- UsbCommandAddr,
- &UsbCommandReg
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- if (!(UsbCommandReg & USBCMD_IAAD)) {
- break;
- }
-
- } while (--Delay);
-
- if (0 == Delay) {
- Status = EFI_TIMEOUT;
- }
-
-exit:
- return Status;
-}
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c
deleted file mode 100644
index 4e4a54c..0000000
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c
+++ /dev/null
@@ -1,3240 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EhciSched.c
-
-Abstract:
-
-
-Revision History
---*/
-
-#include "Ehci.h"
-
-STATIC
-EFI_STATUS
-SetAndWaitDoorBell (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Set DoorBell and wait it to complete
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINT32 Data;
- UINTN Delay;
-
- Status = ReadEhcOperationalReg (
- HcDev,
- USBCMD,
- &Data
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Data |= USBCMD_IAAD;
- Status = WriteEhcOperationalReg (
- HcDev,
- USBCMD,
- Data
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
- //
- // Timeout is in US unit
- //
- Delay = (Timeout / 50) + 1;
- do {
- Status = ReadEhcOperationalReg (
- HcDev,
- USBSTS,
- &Data
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- if ((Data & USBSTS_IAA) == USBSTS_IAA) {
- break;
- }
-
- gBS->Stall (EHCI_GENERIC_RECOVERY_TIME);
-
- } while (Delay--);
-
- Data = Data & 0xFFFFFFC0;
- Data |= USBSTS_IAA;
- Status = WriteEhcOperationalReg (
- HcDev,
- USBSTS,
- Data
- );
-
-exit:
- return Status;
-}
-
-
-
-
-
-EFI_STATUS
-CreateNULLQH (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Create the NULL QH to make it as the Async QH header
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
---*/
-{
- EFI_STATUS Status;
- EHCI_QH_ENTITY *NULLQhPtr;
- //
- // Allocate memory for Qh structure
- //
- Status = EhciAllocatePool (
- HcDev,
- (UINT8 **) &NULLQhPtr,
- sizeof (EHCI_QH_ENTITY)
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- NULLQhPtr->Qh.Status = QTD_STATUS_HALTED;
- NULLQhPtr->Qh.HeadReclamationFlag = 1;
- NULLQhPtr->Qh.QhHorizontalPointer = (UINT32) (GET_0B_TO_31B (&(NULLQhPtr->Qh) >> 5));
- NULLQhPtr->Qh.SelectType = QH_SELECT_TYPE;
- NULLQhPtr->Qh.NextQtdTerminate = 1;
-
- NULLQhPtr->Next = NULLQhPtr;
- NULLQhPtr->Prev = NULLQhPtr;
-
- HcDev->NULLQH = NULLQhPtr;
-
- return Status;
-}
-
-
-
-VOID
-DestroyNULLQH (
- IN USB2_HC_DEV *HcDev
- )
-{
-
- if (HcDev->NULLQH != NULL) {
- EhciFreePool (HcDev, (UINT8 *)HcDev->NULLQH, sizeof (EHCI_QH_ENTITY));
- HcDev->NULLQH = NULL;
- }
-}
-
-
-
-EFI_STATUS
-InitialPeriodicFrameList (
- IN USB2_HC_DEV *HcDev,
- IN UINTN Length
- )
-/*++
-
-Routine Description:
-
- Initialize Periodic Schedule Frame List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Length - Frame List Length
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- VOID *CommonBuffer;
- EFI_PHYSICAL_ADDRESS FrameBuffer;
- VOID *Map;
- UINTN BufferSizeInPages;
- UINTN BufferSizeInBytes;
- UINTN FrameIndex;
- FRAME_LIST_ENTRY *FrameEntryPtr;
-
- //
- // The Frame List is a common buffer that will be
- // accessed by both the cpu and the usb bus master
- // at the same time.
- // The Frame List ocupies 4K bytes,
- // and must be aligned on 4-Kbyte boundaries.
- //
- if (EHCI_MAX_FRAME_LIST_LENGTH != Length && IsFrameListProgrammable (HcDev)) {
- Status = SetFrameListLen (HcDev, Length);
- if (EFI_ERROR (Status)) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
- }
-
- BufferSizeInBytes = EFI_PAGE_SIZE;
- BufferSizeInPages = EFI_SIZE_TO_PAGES (BufferSizeInBytes);
- Status = HcDev->PciIo->AllocateBuffer (
- HcDev->PciIo,
- AllocateAnyPages,
- EfiBootServicesData,
- BufferSizeInPages,
- &CommonBuffer,
- 0
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((gEHCErrorLevel, "EHCI: PciIo->AllocateBuffer Failed\n"));
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
-
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterCommonBuffer,
- CommonBuffer,
- &BufferSizeInBytes,
- &FrameBuffer,
- &Map
- );
- if (EFI_ERROR (Status) || (BufferSizeInBytes != EFI_PAGE_SIZE)) {
- DEBUG ((gEHCErrorLevel, "EHCI: PciIo->MapBuffer Failed\n"));
- Status = EFI_OUT_OF_RESOURCES;
- goto free_buffer;
- }
-
- //
- // Put high 32bit into CtrlDataStructSeg reg
- // when 64bit addressing range capability
- //
- if (HcDev->Is64BitCapable != 0) {
- HcDev->High32BitAddr = (UINT32) GET_32B_TO_63B (FrameBuffer);
-
- Status = SetCtrlDataStructSeg (HcDev);
- if (EFI_ERROR (Status)) {
- DEBUG ((gEHCErrorLevel, "EHCI: SetCtrlDataStructSeg Failed\n"));
- Status = EFI_DEVICE_ERROR;
- goto unmap_buffer;
- }
- }
-
- //
- // Tell the Host Controller where the Frame List lies,
- // by set the Frame List Base Address Register.
- //
- Status = SetFrameListBaseAddr (HcDev, (UINT32) FrameBuffer);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto unmap_buffer;
- }
-
- HcDev->PeriodicFrameListLength = Length;
- HcDev->PeriodicFrameListBuffer = (VOID *) ((UINTN) FrameBuffer);
- HcDev->PeriodicFrameListMap = Map;
-
- //
- // Init Frame List Array fields
- //
- FrameEntryPtr = (FRAME_LIST_ENTRY *) HcDev->PeriodicFrameListBuffer;
- for (FrameIndex = 0; FrameIndex < HcDev->PeriodicFrameListLength; FrameIndex++) {
- FrameEntryPtr->LinkPointer = 0;
- FrameEntryPtr->Rsvd = 0;
- FrameEntryPtr->SelectType = 0;
- FrameEntryPtr->LinkTerminate = TRUE;
- FrameEntryPtr++;
- }
-
- goto exit;
-
-unmap_buffer:
- HcDev->PciIo->Unmap (HcDev->PciIo, Map);
-free_buffer:
- HcDev->PciIo->FreeBuffer (HcDev->PciIo, BufferSizeInPages, CommonBuffer);
-exit:
- return Status;
-}
-
-VOID
-DeinitialPeriodicFrameList (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Deinitialize Periodic Schedule Frame List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- VOID
-
---*/
-{
- HcDev->PciIo->Unmap (HcDev->PciIo, HcDev->PeriodicFrameListMap);
- HcDev->PciIo->FreeBuffer (HcDev->PciIo, EFI_SIZE_TO_PAGES (EFI_PAGE_SIZE), HcDev->PeriodicFrameListBuffer);
- return ;
-}
-
-EFI_STATUS
-CreatePollingTimer (
- IN USB2_HC_DEV *HcDev,
- IN EFI_EVENT_NOTIFY NotifyFunction
- )
-/*++
-
-Routine Description:
-
- Create Async Request Polling Timer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- NotifyFunction - Timer Notify Function
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- return gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- NotifyFunction,
- HcDev,
- &HcDev->AsyncRequestEvent
- );
-}
-
-EFI_STATUS
-DestoryPollingTimer (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Destory Async Request Polling Timer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- return gBS->CloseEvent (HcDev->AsyncRequestEvent);
-}
-
-EFI_STATUS
-StartPollingTimer (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Start Async Request Polling Timer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- return gBS->SetTimer (
- HcDev->AsyncRequestEvent,
- TimerPeriodic,
- EHCI_ASYNC_REQUEST_POLLING_TIME
- );
-}
-
-EFI_STATUS
-StopPollingTimer (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Stop Async Request Polling Timer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- return gBS->SetTimer (
- HcDev->AsyncRequestEvent,
- TimerCancel,
- EHCI_ASYNC_REQUEST_POLLING_TIME
- );
-}
-
-EFI_STATUS
-CreateQh (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DeviceAddr,
- IN UINT8 Endpoint,
- IN UINT8 DeviceSpeed,
- IN UINTN MaxPacketLen,
- OUT EHCI_QH_ENTITY **QhPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qh Structure and Pre-Initialize
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DeviceAddr - Address of Device
- Endpoint - Endpoint Number
- DeviceSpeed - Device Speed
- MaxPacketLen - Max Length of one Packet
- QhPtrPtr - A pointer of pointer to Qh for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- EFI_STATUS Status;
- EHCI_QH_HW *QhHwPtr;
-
- ASSERT (HcDev);
- ASSERT (QhPtrPtr);
-
- *QhPtrPtr = NULL;
-
- //
- // Allocate memory for Qh structure
- //
- Status = EhciAllocatePool (
- HcDev,
- (UINT8 **) QhPtrPtr,
- sizeof (EHCI_QH_ENTITY)
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
-
- //
- // Software field
- //
- (*QhPtrPtr)->Next = NULL;
- (*QhPtrPtr)->Prev = NULL;
- (*QhPtrPtr)->FirstQtdPtr = NULL;
- (*QhPtrPtr)->AltQtdPtr = NULL;
- (*QhPtrPtr)->LastQtdPtr = NULL;
-
- //
- // Hardware field
- //
- QhHwPtr = &((*QhPtrPtr)->Qh);
- QhHwPtr->QhHorizontalPointer = 0;
- QhHwPtr->SelectType = 0;
- QhHwPtr->MaxPacketLen = (UINT32) MaxPacketLen;
- QhHwPtr->EndpointSpeed = (DeviceSpeed & 0x3);
- QhHwPtr->EndpointNum = (Endpoint & 0x0F);
- QhHwPtr->DeviceAddr = (DeviceAddr & 0x7F);
- QhHwPtr->Multiplier = HIGH_BANDWIDTH_PIPE_MULTIPLIER;
- QhHwPtr->Rsvd1 = 0;
- QhHwPtr->Rsvd2 = 0;
- QhHwPtr->Rsvd3 = 0;
- QhHwPtr->Rsvd4 = 0;
- QhHwPtr->Rsvd5 = 0;
- QhHwPtr->Rsvd6 = 0;
-
-exit:
- return Status;
-}
-
-VOID
-DestoryQh (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Destory Qh Structure
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to Qh
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- ASSERT (HcDev);
- ASSERT (QhPtr);
-
- EhciFreePool (HcDev, (UINT8 *) QhPtr, sizeof (EHCI_QH_ENTITY));
- return ;
-}
-
-EFI_STATUS
-CreateControlQh (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DeviceAddr,
- IN UINT8 DeviceSpeed,
- IN UINTN MaxPacketLen,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT EHCI_QH_ENTITY **QhPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qh for Control Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DeviceAddr - Address of Device
- DeviceSpeed - Device Speed
- MaxPacketLen - Max Length of one Packet
- Translator - Translator Transaction for SplitX
- QhPtrPtr - A pointer of pointer to Qh for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Create and init Control Qh
- //
- Status = CreateQh (
- HcDev,
- DeviceAddr,
- 0,
- DeviceSpeed,
- MaxPacketLen,
- QhPtrPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
- //
- // Software field
- //
- (*QhPtrPtr)->Next = (*QhPtrPtr);
- (*QhPtrPtr)->Prev = (*QhPtrPtr);
- (*QhPtrPtr)->TransferType = CONTROL_TRANSFER;
-
- //
- // Hardware field
- //
- // Control Transfer use DataToggleControl
- //
- (*QhPtrPtr)->Qh.DataToggleControl = TRUE;
- (*QhPtrPtr)->Qh.QhHorizontalPointer = (UINT32) (GET_0B_TO_31B (&((*QhPtrPtr)->Qh)) >> 5);
- (*QhPtrPtr)->Qh.SelectType = QH_SELECT_TYPE;
- (*QhPtrPtr)->Qh.QhTerminate = FALSE;
- if (EFI_USB_SPEED_HIGH != DeviceSpeed) {
- (*QhPtrPtr)->Qh.ControlEndpointFlag = TRUE;
- }
- (*QhPtrPtr)->Qh.NakCountReload = NAK_COUNT_RELOAD;
- if (NULL != Translator) {
- (*QhPtrPtr)->Qh.PortNum = Translator->TranslatorPortNumber;
- (*QhPtrPtr)->Qh.HubAddr = Translator->TranslatorHubAddress;
- (*QhPtrPtr)->Qh.Status |= QTD_STATUS_DO_START_SPLIT;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-CreateBulkQh (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DeviceAddr,
- IN UINT8 EndPointAddr,
- IN UINT8 DeviceSpeed,
- IN UINT8 DataToggle,
- IN UINTN MaxPacketLen,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT EHCI_QH_ENTITY **QhPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qh for Bulk Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DeviceAddr - Address of Device
- EndPointAddr - Address of Endpoint
- DeviceSpeed - Device Speed
- MaxPacketLen - Max Length of one Packet
- Translator - Translator Transaction for SplitX
- QhPtrPtr - A pointer of pointer to Qh for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Create and init Bulk Qh
- //
- Status = CreateQh (
- HcDev,
- DeviceAddr,
- EndPointAddr,
- DeviceSpeed,
- MaxPacketLen,
- QhPtrPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
-
- //
- // Software fields
- //
- (*QhPtrPtr)->Next = (*QhPtrPtr);
- (*QhPtrPtr)->Prev = (*QhPtrPtr);
- (*QhPtrPtr)->TransferType = BULK_TRANSFER;
-
- //
- // Hardware fields
- //
- // BulkTransfer don't use DataToggleControl
- //
- (*QhPtrPtr)->Qh.DataToggleControl = FALSE;
- (*QhPtrPtr)->Qh.QhHorizontalPointer = (UINT32) (GET_0B_TO_31B (&((*QhPtrPtr)->Qh)) >> 5);
- (*QhPtrPtr)->Qh.SelectType = QH_SELECT_TYPE;
- (*QhPtrPtr)->Qh.QhTerminate = FALSE;
- (*QhPtrPtr)->Qh.NakCountReload = NAK_COUNT_RELOAD;
- (*QhPtrPtr)->Qh.DataToggle = DataToggle;
- if (NULL != Translator) {
- (*QhPtrPtr)->Qh.PortNum = Translator->TranslatorPortNumber;
- (*QhPtrPtr)->Qh.HubAddr = Translator->TranslatorHubAddress;
- (*QhPtrPtr)->Qh.Status |= QTD_STATUS_DO_START_SPLIT;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-CreateInterruptQh (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DeviceAddr,
- IN UINT8 EndPointAddr,
- IN UINT8 DeviceSpeed,
- IN UINT8 DataToggle,
- IN UINTN MaxPacketLen,
- IN UINTN Interval,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT EHCI_QH_ENTITY **QhPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qh for Control Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DeviceAddr - Address of Device
- EndPointAddr - Address of Endpoint
- DeviceSpeed - Device Speed
- MaxPacketLen - Max Length of one Packet
- Interval - value of interval
- Translator - Translator Transaction for SplitX
- QhPtrPtr - A pointer of pointer to Qh for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Create and init InterruptQh
- //
- Status = CreateQh (
- HcDev,
- DeviceAddr,
- EndPointAddr,
- DeviceSpeed,
- MaxPacketLen,
- QhPtrPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
-
- //
- // Software fields
- //
- if (Interval == 0) {
- (*QhPtrPtr)->TransferType = SYNC_INTERRUPT_TRANSFER;
- } else {
- (*QhPtrPtr)->TransferType = ASYNC_INTERRUPT_TRANSFER;
- }
- (*QhPtrPtr)->Interval = GetApproxiOfInterval (Interval);
-
- //
- // Hardware fields
- //
- // InterruptTranfer don't use DataToggleControl
- //
- (*QhPtrPtr)->Qh.DataToggleControl = FALSE;
- (*QhPtrPtr)->Qh.QhHorizontalPointer = 0;
- (*QhPtrPtr)->Qh.QhTerminate = TRUE;
- (*QhPtrPtr)->Qh.NakCountReload = 0;
- (*QhPtrPtr)->Qh.InerruptScheduleMask = MICRO_FRAME_0_CHANNEL;
- (*QhPtrPtr)->Qh.SplitComletionMask = (MICRO_FRAME_2_CHANNEL | MICRO_FRAME_3_CHANNEL | MICRO_FRAME_4_CHANNEL);
- (*QhPtrPtr)->Qh.DataToggle = DataToggle;
- if (NULL != Translator) {
- (*QhPtrPtr)->Qh.PortNum = Translator->TranslatorPortNumber;
- (*QhPtrPtr)->Qh.HubAddr = Translator->TranslatorHubAddress;
- (*QhPtrPtr)->Qh.Status |= QTD_STATUS_DO_START_SPLIT;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-CreateQtd (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 *DataPtr,
- IN UINTN DataLen,
- IN UINT8 PktId,
- IN UINT8 Toggle,
- IN UINT8 QtdStatus,
- OUT EHCI_QTD_ENTITY **QtdPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qtd Structure and Pre-Initialize it
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DataPtr - A pointer to user data buffer to transfer
- DataLen - Length of user data to transfer
- PktId - Packet Identification of this Qtd
- Toggle - Data Toggle of this Qtd
- QtdStatus - Default value of status of this Qtd
- QtdPtrPtr - A pointer of pointer to Qtd for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- EFI_STATUS Status;
- EHCI_QTD_HW *QtdHwPtr;
-
- ASSERT (HcDev);
- ASSERT (QtdPtrPtr);
-
- //
- // Create memory for Qtd structure
- //
- Status = EhciAllocatePool (
- HcDev,
- (UINT8 **) QtdPtrPtr,
- sizeof (EHCI_QTD_ENTITY)
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
-
- //
- // Software field
- //
- (*QtdPtrPtr)->TotalBytes = (UINT32) DataLen;
- (*QtdPtrPtr)->StaticTotalBytes = (UINT32) DataLen;
- (*QtdPtrPtr)->Prev = NULL;
- (*QtdPtrPtr)->Next = NULL;
-
- //
- // Hardware field
- //
- QtdHwPtr = &((*QtdPtrPtr)->Qtd);
- QtdHwPtr->NextQtdPointer = 0;
- QtdHwPtr->NextQtdTerminate = TRUE;
- QtdHwPtr->AltNextQtdPointer = 0;
- QtdHwPtr->AltNextQtdTerminate = TRUE;
- QtdHwPtr->DataToggle = Toggle;
- QtdHwPtr->TotalBytes = (UINT32) DataLen;
- QtdHwPtr->CurrentPage = 0;
- QtdHwPtr->ErrorCount = QTD_ERROR_COUNTER;
- QtdHwPtr->Status = QtdStatus;
- QtdHwPtr->Rsvd1 = 0;
- QtdHwPtr->Rsvd2 = 0;
- QtdHwPtr->Rsvd3 = 0;
- QtdHwPtr->Rsvd4 = 0;
- QtdHwPtr->Rsvd5 = 0;
- QtdHwPtr->Rsvd6 = 0;
-
- //
- // Set PacketID [Setup/Data/Status]
- //
- switch (PktId) {
- case SETUP_PACKET_ID:
- QtdHwPtr->PidCode = SETUP_PACKET_PID_CODE;
- break;
-
- case INPUT_PACKET_ID:
- QtdHwPtr->PidCode = INPUT_PACKET_PID_CODE;
- break;
-
- case OUTPUT_PACKET_ID:
- QtdHwPtr->PidCode = OUTPUT_PACKET_PID_CODE;
- break;
-
- default:
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- //
- // Set Data Buffer Pointers
- //
- if (NULL != DataPtr) {
- SetQtdBufferPointer (
- QtdHwPtr,
- DataPtr,
- DataLen
- );
- (*QtdPtrPtr)->StaticCurrentOffset = QtdHwPtr->CurrentOffset;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-CreateSetupQtd (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 *DevReqPtr,
- OUT EHCI_QTD_ENTITY **QtdPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qtd Structure for Setup
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DevReqPtr - A pointer to Device Request Data
- QtdPtrPtr - A pointer of pointer to Qtd for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- return CreateQtd (
- HcDev,
- DevReqPtr,
- sizeof (EFI_USB_DEVICE_REQUEST),
- SETUP_PACKET_ID,
- DATA0,
- QTD_STATUS_ACTIVE,
- QtdPtrPtr
- );
-}
-
-EFI_STATUS
-CreateDataQtd (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 *DataPtr,
- IN UINTN DataLen,
- IN UINT8 PktId,
- IN UINT8 Toggle,
- OUT EHCI_QTD_ENTITY **QtdPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qtd Structure for data
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DataPtr - A pointer to user data buffer to transfer
- DataLen - Length of user data to transfer
- PktId - Packet Identification of this Qtd
- Toggle - Data Toggle of this Qtd
- QtdPtrPtr - A pointer of pointer to Qtd for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- return CreateQtd (
- HcDev,
- DataPtr,
- DataLen,
- PktId,
- Toggle,
- QTD_STATUS_ACTIVE,
- QtdPtrPtr
- );
-}
-
-EFI_STATUS
-CreateAltQtd (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 PktId,
- OUT EHCI_QTD_ENTITY **QtdPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qtd Structure for Alternative
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- PktId - Packet Identification of this Qtd
- QtdPtrPtr - A pointer of pointer to Qtd for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- return CreateQtd (
- HcDev,
- NULL,
- 0,
- PktId,
- 0,
- QTD_STATUS_ACTIVE,
- QtdPtrPtr
- );
-}
-
-EFI_STATUS
-CreateStatusQtd (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 PktId,
- OUT EHCI_QTD_ENTITY **QtdPtrPtr
- )
-/*++
-
-Routine Description:
-
- Create Qtd Structure for status
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- PktId - Packet Identification of this Qtd
- QtdPtrPtr - A pointer of pointer to Qtd for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- return CreateQtd (
- HcDev,
- NULL,
- 0,
- PktId,
- DATA1,
- QTD_STATUS_ACTIVE,
- QtdPtrPtr
- );
-}
-
-EFI_STATUS
-CreateControlQtds (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DataPktId,
- IN UINT8 *RequestCursor,
- IN UINT8 *DataCursor,
- IN UINTN DataLen,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT EHCI_QTD_ENTITY **ControlQtdsHead
- )
-/*++
-
-Routine Description:
-
- Create Qtds list for Control Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DataPktId - Packet Identification of Data Qtds
- RequestCursor - A pointer to request structure buffer to transfer
- DataCursor - A pointer to user data buffer to transfer
- DataLen - Length of user data to transfer
- ControlQtdsHead - A pointer of pointer to first Qtd for control tranfer for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- EFI_STATUS Status;
- EHCI_QTD_ENTITY *QtdPtr;
- EHCI_QTD_ENTITY *PreQtdPtr;
- EHCI_QTD_ENTITY *SetupQtdPtr;
- EHCI_QTD_ENTITY *FirstDataQtdPtr;
- EHCI_QTD_ENTITY *LastDataQtdPtr;
- EHCI_QTD_ENTITY *StatusQtdPtr;
- UINT8 DataToggle;
- UINT8 StatusPktId;
- UINTN CapacityOfQtd;
- UINTN SizePerQtd;
- UINTN DataCount;
-
- QtdPtr = NULL;
- PreQtdPtr = NULL;
- SetupQtdPtr = NULL;
- FirstDataQtdPtr = NULL;
- LastDataQtdPtr = NULL;
- StatusQtdPtr = NULL;
- CapacityOfQtd = 0;
-
- //
- // Setup Stage of Control Transfer
- //
- Status = CreateSetupQtd (
- HcDev,
- RequestCursor,
- &SetupQtdPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
-
- //
- // Data Stage of Control Transfer
- //
- DataToggle = 1;
- DataCount = DataLen;
-
- //
- // Create Qtd structure and link together
- //
- while (DataCount > 0) {
- //
- // PktSize is the data load size that each Qtd.
- //
- CapacityOfQtd = GetCapacityOfQtd (DataCursor);
- SizePerQtd = DataCount;
- if (DataCount > CapacityOfQtd) {
- SizePerQtd = CapacityOfQtd;
- }
-
- Status = CreateDataQtd (
- HcDev,
- DataCursor,
- SizePerQtd,
- DataPktId,
- DataToggle,
- &QtdPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- if (NULL == FirstDataQtdPtr) {
- goto destory_setup_qtd;
- } else {
- goto destory_qtds;
- }
- }
-
- if (NULL == FirstDataQtdPtr) {
- FirstDataQtdPtr = QtdPtr;
- } else {
- LinkQtdToQtd (PreQtdPtr, QtdPtr);
- }
-
- DataToggle ^= 1;
-
- PreQtdPtr = QtdPtr;
- DataCursor += SizePerQtd;
- DataCount -= SizePerQtd;
- }
-
- LastDataQtdPtr = QtdPtr;
-
- //
- // Status Stage of Control Transfer
- //
- if (OUTPUT_PACKET_ID == DataPktId) {
- StatusPktId = INPUT_PACKET_ID;
- } else {
- StatusPktId = OUTPUT_PACKET_ID;
- }
-
- Status = CreateStatusQtd (
- HcDev,
- StatusPktId,
- &StatusQtdPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto destory_qtds;
- }
-
- //
- // Link setup Qtd -> data Qtds -> status Qtd
- //
- if (FirstDataQtdPtr != NULL) {
- LinkQtdToQtd (SetupQtdPtr, FirstDataQtdPtr);
- LinkQtdToQtd (LastDataQtdPtr, StatusQtdPtr);
- } else {
- LinkQtdToQtd (SetupQtdPtr, StatusQtdPtr);
- }
-
- *ControlQtdsHead = SetupQtdPtr;
-
- goto exit;
-
-destory_qtds:
- DestoryQtds (HcDev, FirstDataQtdPtr);
-destory_setup_qtd:
- DestoryQtds (HcDev, SetupQtdPtr);
-exit:
- return Status;
-}
-
-EFI_STATUS
-CreateBulkOrInterruptQtds (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 PktId,
- IN UINT8 *DataCursor,
- IN UINTN DataLen,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT EHCI_QTD_ENTITY **QtdsHead
- )
-/*++
-
-Routine Description:
-
- Create Qtds list for Bulk or Interrupt Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- PktId - Packet Identification of Qtds
- DataCursor - A pointer to user data buffer to transfer
- DataLen - Length of user data to transfer
- DataToggle - Data Toggle to start
- Translator - Translator Transaction for SplitX
- QtdsHead - A pointer of pointer to first Qtd for control tranfer for return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- EFI_STATUS Status;
- EHCI_QTD_ENTITY *QtdPtr;
- EHCI_QTD_ENTITY *PreQtdPtr;
- EHCI_QTD_ENTITY *FirstQtdPtr;
- EHCI_QTD_ENTITY *AltQtdPtr;
- UINTN DataCount;
- UINTN CapacityOfQtd;
- UINTN SizePerQtd;
-
- Status = EFI_SUCCESS;
- QtdPtr = NULL;
- PreQtdPtr = NULL;
- FirstQtdPtr = NULL;
- AltQtdPtr = NULL;
- CapacityOfQtd = 0;
-
- DataCount = DataLen;
- while (DataCount > 0) {
-
- CapacityOfQtd = GetCapacityOfQtd (DataCursor);
- SizePerQtd = DataCount;
- if (DataCount > CapacityOfQtd) {
- SizePerQtd = CapacityOfQtd;
- }
-
- Status = CreateDataQtd (
- HcDev,
- DataCursor,
- SizePerQtd,
- PktId,
- 0,
- &QtdPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- if (NULL == FirstQtdPtr) {
- goto exit;
- } else {
- goto destory_qtds;
- }
- }
-
- if (NULL == FirstQtdPtr) {
- FirstQtdPtr = QtdPtr;
- } else {
- LinkQtdToQtd (PreQtdPtr, QtdPtr);
- }
-
- PreQtdPtr = QtdPtr;
- DataCursor += SizePerQtd;
- DataCount -= SizePerQtd;
- }
-
- //
- // Set Alternate Qtd
- //
- if (INPUT_PACKET_ID == PktId && 0 < GetNumberOfQtd (FirstQtdPtr)) {
- Status = CreateAltQtd (
- HcDev,
- PktId,
- &AltQtdPtr
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto destory_qtds;
- }
-
- LinkQtdsToAltQtd (FirstQtdPtr, AltQtdPtr);
- }
-
- *QtdsHead = FirstQtdPtr;
- goto exit;
-
-destory_qtds:
- DestoryQtds (HcDev, FirstQtdPtr);
-exit:
- return Status;
-}
-
-VOID
-DestoryQtds (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QTD_ENTITY *FirstQtdPtr
- )
-/*++
-
-Routine Description:
-
- Destory all Qtds in the list
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- FirstQtdPtr - A pointer to first Qtd in the list
-
-Returns:
-
- VOID
-
---*/
-{
- EHCI_QTD_ENTITY *PrevQtd;
- EHCI_QTD_ENTITY *NextQtd;
-
- if (!FirstQtdPtr) {
- goto exit;
- }
-
- PrevQtd = FirstQtdPtr;
-
- //
- // Delete all the Qtds.
- //
- do {
- NextQtd = PrevQtd->Next;
- EhciFreePool (HcDev, (UINT8 *) PrevQtd, sizeof (EHCI_QTD_ENTITY));
- PrevQtd = NextQtd;
- } while (NULL != PrevQtd);
-
-exit:
- return ;
-}
-
-UINTN
-GetNumberOfQtd (
- IN EHCI_QTD_ENTITY *FirstQtdPtr
- )
-/*++
-
-Routine Description:
-
- Number of Qtds in the list
-
-Arguments:
-
- FirstQtdPtr - A pointer to first Qtd in the list
-
-Returns:
-
- Number of Qtds in the list
-
---*/
-{
- UINTN Count;
- EHCI_QTD_ENTITY *QtdPtr;
- Count = 0;
- QtdPtr = FirstQtdPtr;
-
- while (NULL != QtdPtr) {
- Count++;
- QtdPtr = QtdPtr->Next;
- }
-
- return Count;
-}
-
-UINTN
-GetCapacityOfQtd (
- IN UINT8 *BufferCursor
- )
-/*++
-
-Routine Description:
-
- Get Size of First Qtd
-
-Arguments:
-
- BufferCursor - BufferCursor of the Qtd
-
-Returns:
-
- Size of First Qtd
-
---*/
-{
-
- if (EFI_PAGE_MASK & GET_0B_TO_31B (BufferCursor)) {
- return EFI_PAGE_SIZE * 4;
- } else {
- return EFI_PAGE_SIZE * 5;
- }
-
-}
-
-UINTN
-GetApproxiOfInterval (
- IN UINTN Interval
- )
-/*++
-
-Routine Description:
-
- Get the approximate value in the 2 index sequence
-
-Arguments:
-
- Interval - the value of interval
-
-Returns:
-
- approximate value of interval in the 2 index sequence
-
---*/
-{
- UINTN Orignate;
- UINTN Approxi;
-
- Orignate = Interval;
- Approxi = 1;
-
- while (Orignate != 1 && Orignate != 0) {
- Orignate = Orignate >> 1;
- Approxi = Approxi << 1;
- }
-
- if (Interval & (Approxi >> 1)) {
- Approxi = Approxi << 1;
- }
-
- return Approxi;
-}
-
-EHCI_QTD_HW *
-GetQtdAlternateNextPointer (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Get Qtd alternate next pointer field
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- A pointer to hardware alternate Qtd
-
---*/
-{
- EHCI_QTD_HW *Value;
-
- Value = NULL;
-
- if (!HwQtdPtr->AltNextQtdTerminate) {
- Value = (EHCI_QTD_HW *) GET_0B_TO_31B (HwQtdPtr->AltNextQtdPointer << 5);
- }
-
- return Value;
-}
-
-EHCI_QTD_HW *
-GetQtdNextPointer (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Get Qtd next pointer field
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- A pointer to next hardware Qtd structure
-
---*/
-{
- EHCI_QTD_HW *Value;
-
- Value = NULL;
-
- if (!HwQtdPtr->NextQtdTerminate) {
- Value = (EHCI_QTD_HW *) GET_0B_TO_31B (HwQtdPtr->NextQtdPointer << 5);
- }
-
- return Value;
-}
-
-VOID
-LinkQtdToQtd (
- IN EHCI_QTD_ENTITY * PreQtdPtr,
- IN EHCI_QTD_ENTITY * QtdPtr
- )
-/*++
-
-Routine Description:
-
- Link Qtds together
-
-Arguments:
-
- PreQtdPtr - A pointer to pre Qtd
- QtdPtr - A pointer to next Qtd
-
-Returns:
-
- VOID
-
---*/
-{
- EHCI_QTD_HW *QtdHwPtr;
-
- ASSERT(PreQtdPtr);
- ASSERT(QtdPtr);
-
- //
- // Software link
- //
- PreQtdPtr->Next = QtdPtr;
- QtdPtr->Prev = PreQtdPtr;
-
- //
- // Hardware link
- //
- QtdHwPtr = &(QtdPtr->Qtd);
- PreQtdPtr->Qtd.NextQtdPointer = (UINT32) (GET_0B_TO_31B(QtdHwPtr) >> 5);
- PreQtdPtr->Qtd.NextQtdTerminate = FALSE;
-
- return ;
-}
-
-
-VOID
-LinkQtdsToAltQtd (
- IN EHCI_QTD_ENTITY * FirstQtdPtr,
- IN EHCI_QTD_ENTITY * AltQtdPtr
- )
-/*++
-
-Routine Description:
-
- Link AlterQtds together
-
-Arguments:
-
- FirstQtdPtr - A pointer to first Qtd in the list
- AltQtdPtr - A pointer to alternative Qtd
-
-Returns:
-
- VOID
-
---*/
-{
- EHCI_QTD_ENTITY *QtdPtr;
- EHCI_QTD_HW *AltQtdHwPtr;
-
- ASSERT(FirstQtdPtr);
- ASSERT(AltQtdPtr);
-
- AltQtdHwPtr = &(AltQtdPtr->Qtd);
- QtdPtr = FirstQtdPtr;
-
- while (NULL != QtdPtr) {
- //
- // Software link
- //
- QtdPtr->AltNext = AltQtdPtr;
- //
- // Hardware link
- //
- QtdPtr->Qtd.AltNextQtdPointer = (UINT32) (GET_0B_TO_31B(AltQtdHwPtr) >> 5);
- QtdPtr->Qtd.AltNextQtdTerminate = FALSE;
- QtdPtr = QtdPtr->Next;
- }
-
- return ;
-}
-
-VOID
-LinkQtdToQh (
- IN EHCI_QH_ENTITY *QhPtr,
- IN EHCI_QTD_ENTITY *QtdPtr
- )
-/*++
-
-Routine Description:
-
- Link Qtds list to Qh
-
-Arguments:
-
- QhPtr - A pointer to Qh
- QtdPtr - A pointer to first Qtd in the list
-
-Returns:
-
- VOID
-
---*/
-{
- EHCI_QTD_ENTITY *Cursor;
- EHCI_QTD_HW *QtdHwPtr;
-
- ASSERT (QhPtr);
- ASSERT (QtdPtr);
-
- QhPtr->FirstQtdPtr = QtdPtr;
- if (NULL != QtdPtr->AltNext) {
- QhPtr->AltQtdPtr = QtdPtr->AltNext;
- }
-
- Cursor = QtdPtr;
- while (NULL != Cursor) {
- Cursor->SelfQh = QhPtr;
- if (NULL == Cursor->Next) {
- QhPtr->LastQtdPtr = Cursor;
- }
-
- Cursor = Cursor->Next;
- }
-
- QtdHwPtr = &(QtdPtr->Qtd);
- QhPtr->Qh.NextQtdPointer = (UINT32) (GET_0B_TO_31B (QtdHwPtr) >> 5);
- QhPtr->Qh.NextQtdTerminate = FALSE;
-
- QhPtr->Qh.AltNextQtdPointer = 0;
- QhPtr->Qh.AltNextQtdTerminate = TRUE;
-
-
- if ((QtdPtr->Qtd.PidCode == OUTPUT_PACKET_PID_CODE) &&
- (QhPtr->TransferType == BULK_TRANSFER)) {
- //
- //Start PING first
- //
- QhPtr->Qh.Status |= QTD_STATUS_DO_PING;
- }
-
- return ;
-}
-
-EFI_STATUS
-LinkQhToAsyncList (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Link Qh to Async Schedule List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to Qh
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
-
- ASSERT (HcDev);
- ASSERT (QhPtr);
-
-
- //
- // NULL QH created before
- //
-
- HcDev->NULLQH->Next = QhPtr;
- HcDev->NULLQH->Prev = QhPtr;
-
- QhPtr->Next = HcDev->NULLQH;
- QhPtr->Prev = HcDev->NULLQH;
-
-
- HcDev->NULLQH->Qh.QhHorizontalPointer = (UINT32) (GET_0B_TO_31B (&(QhPtr->Qh) >> 5));
- QhPtr->Qh.QhHorizontalPointer = (UINT32) (GET_0B_TO_31B (&(HcDev->NULLQH->Qh) >> 5));
-
-
- Status = SetAsyncListAddr (HcDev, HcDev->NULLQH);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- if (!IsAsyncScheduleEnabled (HcDev)) {
-
- Status = EnableAsynchronousSchedule (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = WaitForAsyncScheduleEnable (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- DEBUG ((gEHCDebugLevel, "EHCI: WaitForAsyncScheduleEnable TimeOut"));
- Status = EFI_TIMEOUT;
- goto exit;
- }
-
- if (IsEhcHalted (HcDev)) {
- Status = StartScheduleExecution (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
- }
-
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-UnlinkQhFromAsyncList (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Unlink Qh from Async Schedule List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to Qh
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- ASSERT (HcDev);
- ASSERT (QhPtr);
-
-
- HcDev->NULLQH->Next = HcDev->NULLQH;
- HcDev->NULLQH->Prev = HcDev->NULLQH;
-
-
- QhPtr->Next = QhPtr;
- QhPtr->Prev = QhPtr;
-
- HcDev->NULLQH->Qh.QhHorizontalPointer = (UINT32) (GET_0B_TO_31B (&(HcDev->NULLQH->Qh) >> 5));
-
-
- SetAndWaitDoorBell (HcDev, 2 * EHCI_GENERIC_TIMEOUT);
-
- QhPtr->Qh.QhTerminate = 1;
- QhPtr->Qh.QhHorizontalPointer = 0;
-
-
- Status = DisableAsynchronousSchedule (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = WaitForAsyncScheduleDisable (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- DEBUG ((gEHCErrorLevel, "EHCI: WaitForAsyncScheduleDisable TimeOut\n"));
- Status = EFI_TIMEOUT;
- goto exit;
- }
-
-
-exit:
- return Status;
-}
-
-VOID
-LinkQhToPeriodicList (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Link Qh to Periodic Schedule List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to Qh
-
-Returns:
-
- VOID
-
---*/
-{
- FRAME_LIST_ENTRY *FrameEntryPtr;
- EHCI_QH_ENTITY *FindQhPtr;
- EHCI_QH_HW *FindQhHwPtr;
- UINTN FrameIndex;
-
- ASSERT (HcDev);
- ASSERT (QhPtr);
-
- FindQhPtr = NULL;
- FindQhHwPtr = NULL;
- FrameIndex = 0;
- FrameEntryPtr = (FRAME_LIST_ENTRY *) HcDev->PeriodicFrameListBuffer;
-
- QhPtr->Qh.HeadReclamationFlag = FALSE;
-
- if (QhPtr->TransferType == ASYNC_INTERRUPT_TRANSFER) {
-
- //
- // AsyncInterruptTransfer Qh
- //
-
- //
- // Link to Frame[0] List
- //
- if (!FrameEntryPtr->LinkTerminate) {
- //
- // Not Null FrameList
- //
- FindQhHwPtr = (EHCI_QH_HW *) GET_0B_TO_31B (FrameEntryPtr->LinkPointer << 5);
- FindQhPtr = (EHCI_QH_ENTITY *) GET_QH_ENTITY_ADDR (FindQhHwPtr);
- //
- // FindQh is Left/Right to Qh
- //
- while ((NULL != FindQhPtr->Next) && (FindQhPtr->Interval > QhPtr->Interval)) {
- FindQhPtr = FindQhPtr->Next;
- }
-
- if (FindQhPtr->Interval == QhPtr->Interval) {
- //
- // Link Qh after FindQh
- //
- if (NULL != FindQhPtr->Next) {
- FindQhPtr->Next->Prev = QhPtr;
- QhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(FindQhPtr->Next->Qh) >> 5);
- QhPtr->Qh.SelectType = QH_SELECT_TYPE;
- QhPtr->Qh.QhTerminate = FALSE;
- }
-
- FindQhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
- FindQhPtr->Qh.SelectType = QH_SELECT_TYPE;
- FindQhPtr->Qh.QhTerminate = FALSE;
-
- QhPtr->Prev = FindQhPtr;
- QhPtr->Next = FindQhPtr->Next;
- FindQhPtr->Next = QhPtr;
- } else if (FindQhPtr->Interval < QhPtr->Interval) {
- //
- // Link Qh before FindQh
- //
- if (NULL == FindQhPtr->Prev) {
- //
- // Qh is the First one in Frame[0] List
- //
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
- FrameEntryPtr->SelectType = QH_SELECT_TYPE;
- FrameEntryPtr->LinkTerminate = FALSE;
- } else {
- //
- // Qh is not the First one in Frame[0] List
- //
- FindQhPtr->Prev->Next = QhPtr;
- FindQhPtr->Prev->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
- FindQhPtr->Prev->Qh.SelectType = QH_SELECT_TYPE;
- FindQhPtr->Prev->Qh.QhTerminate = FALSE;
- }
-
- QhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(FindQhPtr->Qh) >> 5);
- QhPtr->Qh.SelectType = QH_SELECT_TYPE;
- QhPtr->Qh.QhTerminate = FALSE;
-
- QhPtr->Next = FindQhPtr;
- QhPtr->Prev = FindQhPtr->Prev;
- FindQhPtr->Prev = QhPtr;
- } else {
- //
- // Link Qh after FindQh, Qh is the Last one
- //
- FindQhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
- FindQhPtr->Prev->Qh.SelectType = QH_SELECT_TYPE;
- FindQhPtr->Qh.QhTerminate = FALSE;
-
- QhPtr->Prev = FindQhPtr;
- QhPtr->Next = NULL;
- FindQhPtr->Next = QhPtr;
- }
- } else {
- //
- // Null FrameList
- //
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
- FrameEntryPtr->SelectType = QH_SELECT_TYPE;
- FrameEntryPtr->LinkTerminate = FALSE;
- }
- //
- // Other Frame[X]
- //
- if (NULL == QhPtr->Prev) {
- //
- // Qh is the First one in Frame[0] List
- //
- FrameIndex += QhPtr->Interval;
- while (FrameIndex < HcDev->PeriodicFrameListLength) {
- FrameEntryPtr = (FRAME_LIST_ENTRY *) (FrameEntryPtr + QhPtr->Interval);
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
- FrameEntryPtr->SelectType = QH_SELECT_TYPE;
- FrameEntryPtr->LinkTerminate = FALSE;
- FrameIndex += QhPtr->Interval;
- }
- } else if (QhPtr->Interval < QhPtr->Prev->Interval) {
- //
- // Qh is not the First one in Frame[0] List, and Prev.interval > Qh.interval
- //
- FrameIndex += QhPtr->Interval;
- while (FrameIndex < HcDev->PeriodicFrameListLength) {
- FrameEntryPtr = (FRAME_LIST_ENTRY *) (FrameEntryPtr + QhPtr->Interval);
- if ((FrameIndex % QhPtr->Prev->Interval) != 0) {
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
- FrameEntryPtr->SelectType = QH_SELECT_TYPE;
- FrameEntryPtr->LinkTerminate = FALSE;
- }
-
- FrameIndex += QhPtr->Interval;
- }
- }
- } else {
-
- //
- // SyncInterruptTransfer Qh
- //
-
- if (!FrameEntryPtr->LinkTerminate) {
- //
- // Not Null FrameList
- //
- FindQhHwPtr = (EHCI_QH_HW *) GET_0B_TO_31B (FrameEntryPtr->LinkPointer << 5);
- FindQhPtr = (EHCI_QH_ENTITY *) GET_QH_ENTITY_ADDR (FindQhHwPtr);
- //
- // FindQh is Last Qh in the Asynchronous List, Link Qh after FindQh
- //
- while (NULL != FindQhPtr->Next) {
- FindQhPtr = FindQhPtr->Next;
- }
-
- FindQhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
- FindQhPtr->Qh.SelectType = QH_SELECT_TYPE;
- FindQhPtr->Qh.QhTerminate = FALSE;
-
- FindQhPtr->Next = QhPtr;
- QhPtr->Prev = FindQhPtr;
- } else {
- //
- // Null FrameList
- //
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
- FrameEntryPtr->SelectType = QH_SELECT_TYPE;
- FrameEntryPtr->LinkTerminate = FALSE;
- }
- }
-
- return ;
-}
-
-VOID
-UnlinkQhFromPeriodicList (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_QH_ENTITY *QhPtr,
- IN UINTN Interval
- )
-/*++
-
-Routine Description:
-
- Unlink Qh from Periodic Schedule List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- QhPtr - A pointer to Qh
- Interval - Interval of this periodic transfer
-
-Returns:
-
- VOID
-
---*/
-{
- FRAME_LIST_ENTRY *FrameEntryPtr;
- UINTN FrameIndex;
-
- FrameIndex = 0;
-
- ASSERT (HcDev);
- ASSERT (QhPtr);
-
- FrameIndex = 0;
- FrameEntryPtr = (FRAME_LIST_ENTRY *) HcDev->PeriodicFrameListBuffer;
-
- if (QhPtr->TransferType == ASYNC_INTERRUPT_TRANSFER) {
-
- //
- // AsyncInterruptTransfer Qh
- //
-
- if (NULL == QhPtr->Prev) {
- //
- // Qh is the First one on Frame[0] List
- //
- if (NULL == QhPtr->Next) {
- //
- // Only one on Frame[0] List
- //
- while (FrameIndex < HcDev->PeriodicFrameListLength) {
- FrameEntryPtr->LinkPointer = 0;
- FrameEntryPtr->SelectType = 0;
- FrameEntryPtr->LinkTerminate = TRUE;
- FrameEntryPtr += Interval;
- FrameIndex += Interval;
- }
- } else {
- while (FrameIndex < HcDev->PeriodicFrameListLength) {
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Next->Qh) >> 5);
- FrameEntryPtr->SelectType = QH_SELECT_TYPE;
- FrameEntryPtr->LinkTerminate = FALSE;
- FrameEntryPtr += Interval;
- FrameIndex += Interval;
- }
- }
- } else {
-
- //
- // Not First one on Frame[0] List
- //
- if (NULL == QhPtr->Next) {
- //
- // Qh is the Last one on Frame[0] List
- //
- QhPtr->Prev->Qh.QhHorizontalPointer = 0;
- QhPtr->Prev->Qh.SelectType = 0;
- QhPtr->Prev->Qh.QhTerminate = TRUE;
- } else {
- QhPtr->Prev->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Next->Qh) >> 5);
- QhPtr->Prev->Qh.SelectType = QH_SELECT_TYPE;
- QhPtr->Prev->Qh.QhTerminate = FALSE;
- }
-
- if (Interval == QhPtr->Prev->Interval) {
- //
- // Interval is the same as Prev
- // Not involed Frame[X]
- //
- } else {
- //
- // Other Frame[X]
- //
- while (FrameIndex < HcDev->PeriodicFrameListLength) {
- if ((FrameIndex % QhPtr->Prev->Interval) != 0) {
- FrameEntryPtr->LinkPointer = QhPtr->Prev->Qh.QhHorizontalPointer;
- FrameEntryPtr->SelectType = QhPtr->Prev->Qh.SelectType;
- FrameEntryPtr->LinkTerminate = QhPtr->Prev->Qh.QhTerminate;
- }
- FrameEntryPtr += Interval;
- FrameIndex += Interval;
- }
- }
- }
-
- if (NULL != QhPtr->Next) {
- QhPtr->Next->Prev = QhPtr->Prev;
- }
-
- if (NULL != QhPtr->Prev) {
- QhPtr->Prev->Next = QhPtr->Next;
- }
- } else {
- //
- // SyncInterruptTransfer Qh
- //
- if (NULL == QhPtr->Prev) {
- //
- // Qh is the only one Qh on Frame[0] List
- //
- FrameEntryPtr->LinkPointer = 0;
- FrameEntryPtr->SelectType = 0;
- FrameEntryPtr->LinkTerminate = TRUE;
- } else {
- QhPtr->Prev->Qh.QhHorizontalPointer = 0;
- QhPtr->Prev->Qh.SelectType = 0;
- QhPtr->Prev->Qh.QhTerminate = TRUE;
- }
-
- if (NULL != QhPtr->Prev) {
- QhPtr->Prev->Next = NULL;
- }
- }
-
- return ;
-}
-
-VOID
-LinkToAsyncReqeust (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_ASYNC_REQUEST *AsyncRequestPtr
- )
-/*++
-
-Routine Description:
-
- Llink AsyncRequest Entry to Async Request List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- AsyncRequestPtr - A pointer to Async Request Entry
-
-Returns:
-
- VOID
-
---*/
-{
- EHCI_ASYNC_REQUEST *CurrentPtr;
-
- CurrentPtr = HcDev->AsyncRequestList;
- HcDev->AsyncRequestList = AsyncRequestPtr;
- AsyncRequestPtr->Prev = NULL;
- AsyncRequestPtr->Next = CurrentPtr;
-
- if (NULL != CurrentPtr) {
- CurrentPtr->Prev = AsyncRequestPtr;
- }
-
- return ;
-}
-
-VOID
-UnlinkFromAsyncReqeust (
- IN USB2_HC_DEV *HcDev,
- IN EHCI_ASYNC_REQUEST *AsyncRequestPtr
- )
-/*++
-
-Routine Description:
-
- Unlink AsyncRequest Entry from Async Request List
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- AsyncRequestPtr - A pointer to Async Request Entry
-
-Returns:
-
- VOID
-
---*/
-{
- if (NULL == AsyncRequestPtr->Prev) {
- HcDev->AsyncRequestList = AsyncRequestPtr->Next;
- if (NULL != AsyncRequestPtr->Next) {
- AsyncRequestPtr->Next->Prev = NULL;
- }
- } else {
- AsyncRequestPtr->Prev->Next = AsyncRequestPtr->Next;
- if (NULL != AsyncRequestPtr->Next) {
- AsyncRequestPtr->Next->Prev = AsyncRequestPtr->Prev;
- }
- }
-
- return ;
-}
-
-VOID
-SetQtdBufferPointer (
- IN EHCI_QTD_HW *QtdHwPtr,
- IN VOID *DataPtr,
- IN UINTN DataLen
- )
-/*++
-
-Routine Description:
-
- Set data buffer pointers in Qtd
-
-Arguments:
-
- QtdHwPtr - A pointer to Qtd hardware structure
- DataPtr - A pointer to user data buffer
- DataLen - Length of the user data buffer
-
-Returns:
-
- VOID
-
---*/
-{
- UINTN RemainLen;
-
- ASSERT (QtdHwPtr);
- ASSERT (DataLen <= 5 * EFI_PAGE_SIZE);
-
- RemainLen = DataLen;
- //
- // Allow buffer address range across 4G.
- // But EFI_USB_MAX_BULK_BUFFER_NUM = 1, so don't allow
- // seperate buffer array.
- //
- //
- // Set BufferPointer0, ExtBufferPointer0 and Offset
- //
- QtdHwPtr->BufferPointer0 = (UINT32) (GET_0B_TO_31B (DataPtr) >> EFI_PAGE_SHIFT);
- QtdHwPtr->CurrentOffset = (UINT32) (GET_0B_TO_31B (DataPtr) & EFI_PAGE_MASK);
-
- //
- // Set BufferPointer1 and ExtBufferPointer1
- //
- RemainLen = RemainLen > (EFI_PAGE_SIZE - QtdHwPtr->CurrentOffset) ? (RemainLen - (EFI_PAGE_SIZE - QtdHwPtr->CurrentOffset)) : 0;
- if (RemainLen == 0) {
- goto exit;
- }
-
- QtdHwPtr->BufferPointer1 = QtdHwPtr->BufferPointer0 + 1;
-
- //
- // Set BufferPointer2 and ExtBufferPointer2
- //
- RemainLen = RemainLen > EFI_PAGE_SIZE ? (RemainLen - EFI_PAGE_SIZE) : 0;
- if (RemainLen == 0) {
- goto exit;
- }
-
- QtdHwPtr->BufferPointer2 = QtdHwPtr->BufferPointer1 + 1;
-
- //
- // Set BufferPointer3 and ExtBufferPointer3
- //
- RemainLen = RemainLen > EFI_PAGE_SIZE ? (RemainLen - EFI_PAGE_SIZE) : 0;
- if (RemainLen == 0) {
- goto exit;
- }
-
- QtdHwPtr->BufferPointer3 = QtdHwPtr->BufferPointer2 + 1;
-
- //
- // Set BufferPointer4 and ExtBufferPointer4
- //
- RemainLen = RemainLen > EFI_PAGE_SIZE ? (RemainLen - EFI_PAGE_SIZE) : 0;
- if (RemainLen == 0) {
- goto exit;
- }
-
- QtdHwPtr->BufferPointer4 = QtdHwPtr->BufferPointer3 + 1;
-
-exit:
- return ;
-}
-
-BOOLEAN
-IsQtdStatusActive (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Whether Qtd status is active or not
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- TRUE Active
- FALSE Inactive
-
---*/
-{
- UINT8 QtdStatus;
- BOOLEAN Value;
-
- QtdStatus = (UINT8) (HwQtdPtr->Status);
- Value = (BOOLEAN) (QtdStatus & QTD_STATUS_ACTIVE);
- //DEBUG ((gEHCErrorLevel, "EHCI: IsQtdStatusActive 0x%X, Address = %x\r\n",HwQtdPtr->Status, HwQtdPtr));
-
- return Value;
-}
-
-BOOLEAN
-IsQtdStatusHalted (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Whether Qtd status is halted or not
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- TRUE Halted
- FALSE Not halted
-
---*/
-{
- UINT8 QtdStatus;
- BOOLEAN Value;
-
- QtdStatus = (UINT8) (HwQtdPtr->Status);
- Value = (BOOLEAN) (QtdStatus & QTD_STATUS_HALTED);
-
- return Value;
-}
-
-BOOLEAN
-IsQtdStatusBufferError (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Whether Qtd status is buffer error or not
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- TRUE Buffer error
- FALSE No buffer error
-
---*/
-{
- UINT8 QtdStatus;
- BOOLEAN Value;
-
- QtdStatus = (UINT8) (HwQtdPtr->Status);
- Value = (BOOLEAN) (QtdStatus & QTD_STATUS_BUFFER_ERR);
-
- return Value;
-}
-
-BOOLEAN
-IsQtdStatusBabbleError (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Whether Qtd status is babble error or not
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- TRUE Babble error
- FALSE No babble error
-
---*/
-{
- UINT8 QtdStatus;
- BOOLEAN Value;
-
- QtdStatus = (UINT8) (HwQtdPtr->Status);
- Value = (BOOLEAN) (QtdStatus & QTD_STATUS_BABBLE_ERR);
-
- return Value;
-}
-
-BOOLEAN
-IsQtdStatusTransactionError (
- IN EHCI_QTD_HW *HwQtdPtr
- )
-/*++
-
-Routine Description:
-
- Whether Qtd status is transaction error or not
-
-Arguments:
-
- HwQtdPtr - A pointer to hardware Qtd structure
-
-Returns:
-
- TRUE Transaction error
- FALSE No transaction error
-
---*/
-{
- UINT8 QtdStatus;
- BOOLEAN Value;
-
- QtdStatus = (UINT8) (HwQtdPtr->Status);
- Value = (BOOLEAN) (QtdStatus & QTD_STATUS_TRANSACTION_ERR);
-
- return Value;
-}
-
-BOOLEAN
-IsDataInTransfer (
- IN UINT8 EndPointAddress
- )
-/*++
-
-Routine Description:
-
- Whether is a DataIn direction transfer
-
-Arguments:
-
- EndPointAddress - address of the endpoint
-
-Returns:
-
- TRUE DataIn
- FALSE DataOut
-
---*/
-{
- BOOLEAN Value;
-
- if (EndPointAddress & 0x80) {
- Value = TRUE;
- } else {
- Value = FALSE;
- }
-
- return Value;
-}
-
-EFI_STATUS
-MapDataBuffer (
- IN USB2_HC_DEV *HcDev,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN VOID *Data,
- IN OUT UINTN *DataLength,
- OUT UINT8 *PktId,
- OUT UINT8 **DataCursor,
- OUT VOID **DataMap
- )
-/*++
-
-Routine Description:
-
- Map address of user data buffer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- TransferDirection - direction of transfer
- Data - A pointer to user data buffer
- DataLength - length of user data
- PktId - Packte Identificaion
- DataCursor - mapped address to return
- DataMap - identificaion of this mapping to return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS TempPhysicalAddr;
-
- Status = EFI_SUCCESS;
-
- switch (TransferDirection) {
-
- case EfiUsbDataIn:
-
- *PktId = INPUT_PACKET_ID;
- //
- // BusMasterWrite means cpu read
- //
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterWrite,
- Data,
- DataLength,
- &TempPhysicalAddr,
- DataMap
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((gEHCDebugLevel, "EHCI: MapDataBuffer Failed\n"));
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- *DataCursor = (UINT8 *) ((UINTN) TempPhysicalAddr);
- break;
-
- case EfiUsbDataOut:
-
- *PktId = OUTPUT_PACKET_ID;
- //
- // BusMasterRead means cpu write
- //
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterRead,
- Data,
- DataLength,
- &TempPhysicalAddr,
- DataMap
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- *DataCursor = (UINT8 *) ((UINTN) TempPhysicalAddr);
- break;
-
- case EfiUsbNoData:
-
- *PktId = OUTPUT_PACKET_ID;
- Data = NULL;
- *DataLength = 0;
- *DataCursor = NULL;
- *DataMap = NULL;
- break;
-
- default:
-
- Status = EFI_INVALID_PARAMETER;
- }
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-MapRequestBuffer (
- IN USB2_HC_DEV *HcDev,
- IN OUT VOID *Request,
- OUT UINT8 **RequestCursor,
- OUT VOID **RequestMap
- )
-/*++
-
-Routine Description:
-
- Map address of request structure buffer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- Request - A pointer to request structure
- RequestCursor - Mapped address of request structure to return
- RequestMap - Identificaion of this mapping to return
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINTN RequestLen;
- EFI_PHYSICAL_ADDRESS TempPhysicalAddr;
-
- RequestLen = sizeof (EFI_USB_DEVICE_REQUEST);
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterRead,
- (UINT8 *) Request,
- (UINTN *) &RequestLen,
- &TempPhysicalAddr,
- RequestMap
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- *RequestCursor = (UINT8 *) ((UINTN) TempPhysicalAddr);
-
-exit:
- return Status;
-}
-
-EFI_STATUS
-DeleteAsyncRequestTransfer (
- IN USB2_HC_DEV *HcDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- OUT UINT8 *DataToggle
- )
-/*++
-
-Routine Description:
-
- Delete all asynchronous request transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- DeviceAddress - address of usb device
- EndPointAddress - address of endpoint
- DataToggle - stored data toggle
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- EHCI_ASYNC_REQUEST *AsyncRequestPtr;
- EHCI_ASYNC_REQUEST *MatchPtr;
- EHCI_QH_HW *QhHwPtr;
- UINT8 EndPointNum;
-
- if (NULL == HcDev->AsyncRequestList) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- MatchPtr = NULL;
- QhHwPtr = NULL;
- EndPointNum = (UINT8) (EndPointAddress & 0x0f);
- AsyncRequestPtr = HcDev->AsyncRequestList;
-
- //
- // Find QH of AsyncRequest by DeviceAddress and EndPointNum
- //
- do {
-
- QhHwPtr = &(AsyncRequestPtr->QhPtr->Qh);
- if (QhHwPtr->DeviceAddr == DeviceAddress && QhHwPtr->EndpointNum == EndPointNum) {
- MatchPtr = AsyncRequestPtr;
- break;
- }
-
- AsyncRequestPtr = AsyncRequestPtr->Next;
-
- } while (NULL != AsyncRequestPtr);
-
- if (NULL == MatchPtr) {
- Status = EFI_INVALID_PARAMETER;
- goto exit;
- }
-
- Status = DisablePeriodicSchedule (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = WaitForPeriodicScheduleDisable (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- DEBUG ((gEHCErrorLevel, "EHCI: WaitForPeriodicScheduleDisable TimeOut\n"));
- Status = EFI_TIMEOUT;
- goto exit;
- }
-
- *DataToggle = (UINT8) MatchPtr->QhPtr->Qh.DataToggle;
- UnlinkQhFromPeriodicList (HcDev, MatchPtr->QhPtr, MatchPtr->QhPtr->Interval);
- UnlinkFromAsyncReqeust (HcDev, MatchPtr);
-
- if (NULL == HcDev->AsyncRequestList) {
-
- Status = StopPollingTimer (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- } else {
-
- Status = EnablePeriodicSchedule (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
-
- Status = WaitForPeriodicScheduleEnable (HcDev, EHCI_GENERIC_TIMEOUT);
- if (EFI_ERROR (Status)) {
- DEBUG ((gEHCErrorLevel, "EHCI: WaitForPeriodicScheduleEnable TimeOut\n"));
- Status = EFI_TIMEOUT;
- goto exit;
- }
-
- if (IsEhcHalted (HcDev)) {
- Status = StartScheduleExecution (HcDev);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto exit;
- }
- }
-
- }
-
- DestoryQtds (HcDev, MatchPtr->QhPtr->FirstQtdPtr);
- DestoryQh (HcDev, MatchPtr->QhPtr);
- EhciFreePool (HcDev, (UINT8 *) MatchPtr, sizeof (EHCI_ASYNC_REQUEST));
-
-exit:
- return Status;
-}
-
-VOID
-CleanUpAllAsyncRequestTransfer (
- IN USB2_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Clean up all asynchronous request transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
-
-Returns:
-
- VOID
-
---*/
-{
- EHCI_ASYNC_REQUEST *AsyncRequestPtr;
- EHCI_ASYNC_REQUEST *FreePtr;
-
- AsyncRequestPtr = NULL;
- FreePtr = NULL;
-
- StopPollingTimer (HcDev);
-
- AsyncRequestPtr = HcDev->AsyncRequestList;
- while (NULL != AsyncRequestPtr) {
-
- FreePtr = AsyncRequestPtr;
- AsyncRequestPtr = AsyncRequestPtr->Next;
- UnlinkFromAsyncReqeust (HcDev, FreePtr);
- UnlinkQhFromPeriodicList (HcDev, FreePtr->QhPtr, FreePtr->QhPtr->Interval);
- DestoryQtds (HcDev, FreePtr->QhPtr->FirstQtdPtr);
- DestoryQh (HcDev, FreePtr->QhPtr);
- EhciFreePool (HcDev, (UINT8 *) FreePtr, sizeof (EHCI_ASYNC_REQUEST));
-
- }
-
- return ;
-}
-
-VOID
-ZeroOutQhOverlay (
- IN EHCI_QH_ENTITY *QhPtr
- )
-/*++
-
-Routine Description:
-
- Zero out the fields in Qh structure
-
-Arguments:
-
- QhPtr - A pointer to Qh structure
-
-Returns:
-
- VOID
-
---*/
-{
- QhPtr->Qh.CurrentQtdPointer = 0;
- QhPtr->Qh.AltNextQtdPointer = 0;
- QhPtr->Qh.NakCount = 0;
- QhPtr->Qh.AltNextQtdTerminate = 0;
- QhPtr->Qh.TotalBytes = 0;
- QhPtr->Qh.InterruptOnComplete = 0;
- QhPtr->Qh.CurrentPage = 0;
- QhPtr->Qh.ErrorCount = 0;
- QhPtr->Qh.PidCode = 0;
- QhPtr->Qh.Status = 0;
- QhPtr->Qh.BufferPointer0 = 0;
- QhPtr->Qh.CurrentOffset = 0;
- QhPtr->Qh.BufferPointer1 = 0;
- QhPtr->Qh.CompleteSplitMask = 0;
- QhPtr->Qh.BufferPointer2 = 0;
- QhPtr->Qh.SplitBytes = 0;
- QhPtr->Qh.FrameTag = 0;
- QhPtr->Qh.BufferPointer3 = 0;
- QhPtr->Qh.BufferPointer4 = 0;
-}
-
-VOID
-UpdateAsyncRequestTransfer (
- IN EHCI_ASYNC_REQUEST *AsyncRequestPtr,
- IN UINT32 TransferResult,
- IN UINTN ErrQtdPos
- )
-/*++
-
-Routine Description:
-
- Update asynchronous request transfer
-
-Arguments:
-
- AsyncRequestPtr - A pointer to async request
- TransferResult - transfer result
- ErrQtdPos - postion of error Qtd
-
-Returns:
-
- VOID
-
---*/
-{
- EHCI_QTD_ENTITY *QtdPtr;
-
- QtdPtr = NULL;
-
- if (EFI_USB_NOERROR == TransferResult) {
-
- //
- // Update Qh for next trigger
- //
-
- QtdPtr = AsyncRequestPtr->QhPtr->FirstQtdPtr;
-
- //
- // Update fields in Qh
- //
-
- //
- // Get DataToggle from Overlay in Qh
- //
- // ZeroOut Overlay in Qh except DataToggle, HostController will update this field
- //
- ZeroOutQhOverlay (AsyncRequestPtr->QhPtr);
- AsyncRequestPtr->QhPtr->Qh.NextQtdPointer = (UINT32) (GET_0B_TO_31B (&(QtdPtr->Qtd)) >> 5);
- AsyncRequestPtr->QhPtr->Qh.NextQtdTerminate = FALSE;
-
- //
- // Update fields in Qtd
- //
- while (NULL != QtdPtr) {
- QtdPtr->Qtd.TotalBytes = QtdPtr->StaticTotalBytes;
- QtdPtr->Qtd.CurrentOffset = QtdPtr->StaticCurrentOffset;
- QtdPtr->Qtd.CurrentPage = 0;
- QtdPtr->Qtd.ErrorCount = QTD_ERROR_COUNTER;
- QtdPtr->Qtd.Status = QTD_STATUS_ACTIVE;
-
- QtdPtr->TotalBytes = QtdPtr->StaticTotalBytes;
- QtdPtr = QtdPtr->Next;
- }
- }
-
- return ;
-}
-
-BOOLEAN
-CheckQtdsTransferResult (
- IN BOOLEAN IsControl,
- IN EHCI_QH_ENTITY *QhPtr,
- OUT UINT32 *Result,
- OUT UINTN *ErrQtdPos,
- OUT UINTN *ActualLen
- )
-/*++
-
-Routine Description:
-
- Check transfer result of Qtds
-
-Arguments:
-
- IsControl - Is control transfer or not
- QhPtr - A pointer to Qh
- Result - Transfer result
- ErrQtdPos - Error TD Position
- ActualLen - Actual Transfer Size
-
-Returns:
-
- TRUE Qtds finished
- FALSE Not finish
-
---*/
-{
- UINTN ActualLenPerQtd;
- EHCI_QTD_ENTITY *QtdPtr;
- EHCI_QTD_HW *QtdHwPtr;
- BOOLEAN Value;
-
- ASSERT (QhPtr);
- ASSERT (Result);
- ASSERT (ErrQtdPos);
- ASSERT (ActualLen);
-
- Value = TRUE;
- QtdPtr = QhPtr->FirstQtdPtr;
- QtdHwPtr = &(QtdPtr->Qtd);
-
- while (NULL != QtdHwPtr) {
- if (IsQtdStatusActive (QtdHwPtr)) {
- *Result |= EFI_USB_ERR_NOTEXECUTE;
- }
-
- if (IsQtdStatusHalted (QtdHwPtr)) {
-
- DEBUG ((gEHCErrorLevel, "EHCI: QTD_STATUS_HALTED 0x%X\n", QtdHwPtr->Status));
- *Result |= EFI_USB_ERR_STALL;
- }
-
- if (IsQtdStatusBufferError (QtdHwPtr)) {
- DEBUG ((gEHCErrorLevel, "EHCI: QTD_STATUS_BUFFER_ERR 0x%X\n", QtdHwPtr->Status));
- *Result |= EFI_USB_ERR_BUFFER;
- }
-
- if (IsQtdStatusBabbleError (QtdHwPtr)) {
- DEBUG ((gEHCErrorLevel, "EHCI: StatusBufferError 0x%X\n", QtdHwPtr->Status));
- *Result |= EFI_USB_ERR_BABBLE;
- }
-
- if (IsQtdStatusTransactionError (QtdHwPtr)) {
-
- //
- //Exclude Special Case
- //
- if (((QtdHwPtr->Status & QTD_STATUS_HALTED) == QTD_STATUS_HALTED) ||
- ((QtdHwPtr->Status & QTD_STATUS_ACTIVE) == QTD_STATUS_ACTIVE) ||
- ((QtdHwPtr->ErrorCount != QTD_ERROR_COUNTER))) {
- *Result |= EFI_USB_ERR_TIMEOUT;
- DEBUG ((gEHCErrorLevel, "EHCI: QTD_STATUS_TRANSACTION_ERR: 0x%X\n", QtdHwPtr->Status));
- }
- }
-
- ActualLenPerQtd = QtdPtr->TotalBytes - QtdHwPtr->TotalBytes;
- QtdPtr->TotalBytes = QtdHwPtr->TotalBytes;
- //
- // Accumulate actual transferred data length in each DataQtd.
- //
- if (SETUP_PACKET_PID_CODE != QtdHwPtr->PidCode) {
- *ActualLen += ActualLenPerQtd;
- }
-
- if (*Result) {
- Value = FALSE;
- break;
- }
-
- if ((INPUT_PACKET_PID_CODE == QtdHwPtr->PidCode)&& (QtdPtr->TotalBytes > 0)) {
- //
- // Short Packet: IN, Short
- //
- DEBUG ((gEHCDebugLevel, "EHCI: Short Packet Status: 0x%x\n", QtdHwPtr->Status));
- break;
- }
-
- if (QtdPtr->Next != NULL) {
- (*ErrQtdPos)++;
- QtdPtr = QtdPtr->Next;
- QtdHwPtr = &(QtdPtr->Qtd);
- } else {
- QtdHwPtr = NULL;
- }
-
- }
-
- return Value;
-}
-
-EFI_STATUS
-ExecuteTransfer (
- IN USB2_HC_DEV *HcDev,
- IN BOOLEAN IsControl,
- IN EHCI_QH_ENTITY *QhPtr,
- IN OUT UINTN *ActualLen,
- OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- )
-/*++
-
-Routine Description:
-
- Execute Bulk or SyncInterrupt Transfer
-
-Arguments:
-
- HcDev - USB2_HC_DEV
- IsControl - Is control transfer or not
- QhPtr - A pointer to Qh
- ActualLen - Actual transfered Len
- DataToggle - Data Toggle
- TimeOut - TimeOut threshold
- TransferResult - Transfer result
-
-Returns:
-
- EFI_SUCCESS Sucess
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- UINTN ErrQtdPos;
- UINTN Delay;
- BOOLEAN Finished;
-
- Status = EFI_SUCCESS;
- ErrQtdPos = 0;
- *TransferResult = EFI_USB_NOERROR;
- *ActualLen = 0;
- Finished = FALSE;
-
- Delay = (TimeOut * STALL_1_MILLI_SECOND / 50);
-
- do {
- *TransferResult = 0;
- Finished = CheckQtdsTransferResult (
- IsControl,
- QhPtr,
- TransferResult,
- &ErrQtdPos,
- ActualLen
- );
- if (Finished) {
- break;
- }
- //
- // Qtd is inactive, which means bulk or interrupt transfer's end.
- //
- if (!(*TransferResult & EFI_USB_ERR_NOTEXECUTE)) {
- break;
- }
-
- gBS->Stall (EHCI_SYNC_REQUEST_POLLING_TIME);
-
- } while (--Delay);
-
- if (EFI_USB_NOERROR != *TransferResult) {
- if (0 == Delay) {
- DEBUG((gEHCErrorLevel, "EHCI: QTDS TimeOut\n"));
- Status = EFI_TIMEOUT;
- } else {
- Status = EFI_DEVICE_ERROR;
- }
- }
-
- //
- // Special for Bulk and Interrupt Transfer
- //
- *DataToggle = (UINT8) QhPtr->Qh.DataToggle;
-
- return Status;
-}
-
-EFI_STATUS
-AsyncRequestMoniter (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-Routine Description:
-
- Interrupt transfer periodic check handler
-
-Arguments:
- Event - Interrupt event
- Context - Pointer to USB2_HC_DEV
-
-Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
- USB2_HC_DEV *HcDev;
- EHCI_ASYNC_REQUEST *AsyncRequestPtr;
- EHCI_ASYNC_REQUEST *NextPtr;
- EHCI_QTD_HW *QtdHwPtr;
- UINTN ErrQtdPos;
- UINTN ActualLen;
- UINT32 TransferResult;
- UINT8 *ReceiveBuffer;
- UINT8 *ProcessBuffer;
-
- Status = EFI_SUCCESS;
- QtdHwPtr = NULL;
- ReceiveBuffer = NULL;
- ProcessBuffer = NULL;
- HcDev = (USB2_HC_DEV *) Context;
- AsyncRequestPtr = HcDev->AsyncRequestList;
-
- while (NULL != AsyncRequestPtr) {
-
- TransferResult = 0;
- ErrQtdPos = 0;
- ActualLen = 0;
-
- CheckQtdsTransferResult (
- FALSE,
- AsyncRequestPtr->QhPtr,
- &TransferResult,
- &ErrQtdPos,
- &ActualLen
- );
-
- if ((TransferResult & EFI_USB_ERR_NAK) || (TransferResult & EFI_USB_ERR_NOTEXECUTE)) {
- AsyncRequestPtr = AsyncRequestPtr->Next;
- continue;
- }
- //
- // Allocate memory for EHC private data structure
- //
- ProcessBuffer = AllocateZeroPool (ActualLen);
- if (NULL == ProcessBuffer) {
- Status = EFI_OUT_OF_RESOURCES;
- goto exit;
- }
-
- QtdHwPtr = &(AsyncRequestPtr->QhPtr->FirstQtdPtr->Qtd);
- ReceiveBuffer = (UINT8 *) GET_0B_TO_31B ((QtdHwPtr->BufferPointer0 << EFI_PAGE_SHIFT) | AsyncRequestPtr->QhPtr->FirstQtdPtr->StaticCurrentOffset);
- CopyMem (
- ProcessBuffer,
- ReceiveBuffer,
- ActualLen
- );
-
- UpdateAsyncRequestTransfer (AsyncRequestPtr, TransferResult, ErrQtdPos);
-
- NextPtr = AsyncRequestPtr->Next;
-
- if (EFI_USB_NOERROR == TransferResult) {
-
- if (AsyncRequestPtr->CallBackFunc != NULL) {
- (AsyncRequestPtr->CallBackFunc) (ProcessBuffer, ActualLen, AsyncRequestPtr->Context, TransferResult);
- }
-
- } else {
-
- //
- // leave error recovery to its related device driver. A common case of
- // the error recovery is to re-submit the interrupt transfer.
- // When an interrupt transfer is re-submitted, its position in the linked
- // list is changed. It is inserted to the head of the linked list, while
- // this function scans the whole list from head to tail. Thus, the
- // re-submitted interrupt transfer's callback function will not be called
- // again in this round.
- //
- if (AsyncRequestPtr->CallBackFunc != NULL) {
- (AsyncRequestPtr->CallBackFunc) (NULL, 0, AsyncRequestPtr->Context, TransferResult);
- }
-
- }
-
- if (NULL != ProcessBuffer) {
- gBS->FreePool (ProcessBuffer);
- }
-
- AsyncRequestPtr = NextPtr;
- }
-
-exit:
- return Status;
-}
-
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.c b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.c
deleted file mode 100644
index 12673c9..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/** @file
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "idebus.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName = {
- IDEBusComponentNameGetDriverName,
- IDEBusComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mIDEBusDriverNameTable[] = {
- { "eng", (CHAR16 *) L"PCI IDE/ATAPI Bus Driver" },
- { NULL , NULL }
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mIDEBusControllerNameTable[] = {
- { "eng", (CHAR16 *) L"PCI IDE/ATAPI Controller" },
- { NULL , NULL }
-};
-
-/**
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- @param Language A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- @param DriverName A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- @retval EFI_SUCCESS The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER DriverName is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-{
- return LookupUnicodeString (
- Language,
- gIDEBusComponentName.SupportedLanguages,
- mIDEBusDriverNameTable,
- DriverName
- );
-}
-
-/**
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- @param ControllerHandle The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- @param ChildHandle The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- @param Language A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- @param ControllerName A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- @retval EFI_SUCCESS The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER ControllerName is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- language specified by Language.
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- IDE_BLK_IO_DEV *IdeBlkIoDevice;
-
- //
- // Make sure this driver is currently managing ControllHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gIDEBusDriverBinding.DriverBindingHandle,
- &gEfiIdeControllerInitProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (ChildHandle == NULL) {
- return LookupUnicodeString (
- Language,
- gIDEBusComponentName.SupportedLanguages,
- mIDEBusControllerNameTable,
- ControllerName
- );
- }
-
- Status = EfiTestChildHandle (
- ControllerHandle,
- ChildHandle,
- &gEfiPciIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the child context
- //
- Status = gBS->OpenProtocol (
- ChildHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlockIo,
- gIDEBusDriverBinding.DriverBindingHandle,
- ChildHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlockIo);
-
- return LookupUnicodeString (
- Language,
- gIDEBusComponentName.SupportedLanguages,
- IdeBlkIoDevice->ControllerNameTable,
- ControllerName
- );
-}
-
-/**
- Add the component name for the IDE/ATAPI device
-
- @param IdeBlkIoDevicePtr A pointer to the IDE_BLK_IO_DEV instance.
-
-**/
-VOID
-AddName (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevicePtr
- )
-{
- UINTN StringIndex;
- CHAR16 ModelName[41];
-
- //
- // Add Component Name for the IDE/ATAPI device that was discovered.
- //
- IdeBlkIoDevicePtr->ControllerNameTable = NULL;
- for (StringIndex = 0; StringIndex < 41; StringIndex++) {
- ModelName[StringIndex] = IdeBlkIoDevicePtr->ModelName[StringIndex];
- }
-
- AddUnicodeString (
- "eng",
- gIDEBusComponentName.SupportedLanguages,
- &IdeBlkIoDevicePtr->ControllerNameTable,
- ModelName
- );
-}
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.h b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.h
deleted file mode 100644
index e6bf11f..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ComponentName.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _IDE_BUS_COMPONENT_NAME_H
-#define _IDE_BUS_COMPONENT_NAME_H
-
-#define ADD_NAME(x) AddName ((x));
-
-extern EFI_COMPONENT_NAME_PROTOCOL gIDEBusComponentName;
-
-
-//
-// EFI Component Name Functions
-//
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Language TODO: add argument description
- @param DriverName TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param ControllerHandle TODO: add argument description
- @param ChildHandle TODO: add argument description
- @param Language TODO: add argument description
- @param ControllerName TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeBlkIoDevicePtr TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-AddName (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevicePtr
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverConfiguration.c b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverConfiguration.c
deleted file mode 100644
index 7ee2ab3..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverConfiguration.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/** @file
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "idebus.h"
-
-CHAR16 *OptionString[4] = {
- L"Enable Primary Master (Y/N)? -->",
- L"Enable Primary Slave (Y/N)? -->",
- L"Enable Secondary Master (Y/N)? -->",
- L"Enable Secondary Slave (Y/N)? -->"
-};
-
-//
-// EFI Driver Configuration Protocol
-//
-EFI_DRIVER_CONFIGURATION_PROTOCOL gIDEBusDriverConfiguration = {
- IDEBusDriverConfigurationSetOptions,
- IDEBusDriverConfigurationOptionsValid,
- IDEBusDriverConfigurationForceDefaults,
- "eng"
-};
-
-/**
- TODO: Add function description
-
- @retval EFI_ABORTED TODO: Add description for return value
- @retval EFI_SUCCESS TODO: Add description for return value
- @retval EFI_NOT_FOUND TODO: Add description for return value
-
-**/
-STATIC
-EFI_STATUS
-GetResponse (
- VOID
- )
-{
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
-
- while (TRUE) {
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (!EFI_ERROR (Status)) {
- if (Key.ScanCode == SCAN_ESC) {
- return EFI_ABORTED;
- }
-
- switch (Key.UnicodeChar) {
-
- //
- // fall through
- //
- case L'y':
- case L'Y':
- gST->ConOut->OutputString (gST->ConOut, L"Y\n");
- return EFI_SUCCESS;
-
- //
- // fall through
- //
- case L'n':
- case L'N':
- gST->ConOut->OutputString (gST->ConOut, L"N\n");
- return EFI_NOT_FOUND;
- }
-
- }
- }
-}
-
-/**
- Allows the user to set controller specific options for a controller that a
- driver is currently managing.
-
- @param This A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
- instance.
- @param ControllerHandle The handle of the controller to set options on.
- @param ChildHandle The handle of the child controller to set options on.
- This is an optional parameter that may be NULL.
- It will be NULL for device drivers, and for a bus drivers
- that wish to set options for the bus controller.
- It will not be NULL for a bus driver that wishes to set
- options for one of its child controllers.
- @param Language A pointer to a three character ISO 639-2 language
- identifier. This is the language of the user interface
- that should be presented to the user, and it must match
- one of the languages specified in SupportedLanguages.
- The number of languages supported by a driver is up to
- the driver writer.
- @param ActionRequired A pointer to the action that the calling agent is
- required to perform when this function returns.
- See "Related Definitions" for a list of the actions that
- the calling agent is required to perform prior to
- accessing ControllerHandle again.
-
- @retval EFI_SUCCESS The driver specified by This successfully set the
- configuration options for the controller specified
- by ControllerHandle..
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a
- valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER ActionRequired is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- setting configuration options for the controller
- specified by ControllerHandle and ChildHandle.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- language specified by Language.
- @retval EFI_DEVICE_ERROR A device error occurred while attempt to set the
- configuration options for the controller specified
- by ControllerHandle and ChildHandle.
- @retval EFI_OUT_RESOURCES There are not enough resources available to set the
- configuration options for the controller specified
- by ControllerHandle and ChildHandle.
-
-**/
-EFI_STATUS
-IDEBusDriverConfigurationSetOptions (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- )
-{
- EFI_STATUS Status;
- UINT8 Value;
- UINT8 NewValue;
- UINTN DataSize;
- UINTN Index;
-
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- *ActionRequired = EfiDriverConfigurationActionNone;
-
- DataSize = sizeof (Value);
- Status = gRT->GetVariable (
- L"Configuration",
- &gEfiCallerIdGuid,
- NULL,
- &DataSize,
- &Value
- );
-
- gST->ConOut->OutputString (gST->ConOut, L"IDE Bus Driver Configuration\n");
- gST->ConOut->OutputString (gST->ConOut, L"===============================\n");
-
- NewValue = 0;
- for (Index = 0; Index < 4; Index++) {
- gST->ConOut->OutputString (gST->ConOut, OptionString[Index]);
-
- Status = GetResponse ();
- if (Status == EFI_ABORTED) {
- return EFI_SUCCESS;
- }
-
- if (!EFI_ERROR (Status)) {
- NewValue = (UINT8) (NewValue | (1 << Index));
- }
- }
-
- if (EFI_ERROR (Status) || (NewValue != Value)) {
- gRT->SetVariable (
- L"Configuration",
- &gEfiCallerIdGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof (NewValue),
- &NewValue
- );
-
- *ActionRequired = EfiDriverConfigurationActionRestartController;
- } else {
- *ActionRequired = EfiDriverConfigurationActionNone;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Tests to see if a controller's current configuration options are valid.
-
- @param This A pointer to the EFI_DRIVER_CONFIGURATION_PROTOCOL
- instance.
- @param ControllerHandle The handle of the controller to test if it's current
- configuration options are valid.
- @param ChildHandle The handle of the child controller to test if it's
- current
- configuration options are valid. This is an optional
- parameter that may be NULL. It will be NULL for device
- drivers. It will also be NULL for a bus drivers that
- wish to test the configuration options for the bus
- controller. It will not be NULL for a bus driver that
- wishes to test configuration options for one of
- its child controllers.
-
- @retval EFI_SUCCESS The controller specified by ControllerHandle and
- ChildHandle that is being managed by the driver
- specified by This has a valid set of configuration
- options.
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- @retval EFI_UNSUPPORTED The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- @retval EFI_DEVICE_ERROR The controller specified by ControllerHandle and
- ChildHandle that is being managed by the driver
- specified by This has an invalid set of
- configuration options.
-
-**/
-EFI_STATUS
-IDEBusDriverConfigurationOptionsValid (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL
- )
-{
- EFI_STATUS Status;
- UINT8 Value;
- UINTN DataSize;
-
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- DataSize = sizeof (Value);
- Status = gRT->GetVariable (
- L"Configuration",
- &gEfiCallerIdGuid,
- NULL,
- &DataSize,
- &Value
- );
- if (EFI_ERROR (Status) || Value > 0x0f) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Forces a driver to set the default configuration options for a controller.
-
- @param This A pointer to the EFI_DRIVER_CONFIGURATION_ PROTOCOL
- instance.
- @param ControllerHandle The handle of the controller to force default
- configuration options on.
- @param ChildHandle The handle of the child controller to force default
- configuration options on This is an optional parameter
- that may be NULL. It will be NULL for device drivers.
- It will also be NULL for a bus drivers that wish to
- force default configuration options for the bus
- controller. It will not be NULL for a bus driver that
- wishes to force default configuration options for one
- of its child controllers.
- @param DefaultType The type of default configuration options to force on
- the controller specified by ControllerHandle and
- ChildHandle. See Table 9-1 for legal values.
- A DefaultType of 0x00000000 must be supported
- by this protocol.
- @param ActionRequired A pointer to the action that the calling agent
- is required to perform when this function returns.
-
- @retval EFI_SUCCESS The driver specified by This successfully forced
- the default configuration options on the
- controller specified by ControllerHandle and
- ChildHandle.
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a
- valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER ActionRequired is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- forcing the default configuration options on
- the controller specified by ControllerHandle
- and ChildHandle.
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- the configuration type specified by DefaultType.
- @retval EFI_DEVICE_ERROR A device error occurred while attempt to force
- the default configuration options on the controller
- specified by ControllerHandle and ChildHandle.
- @retval EFI_OUT_RESOURCES There are not enough resources available to force
- the default configuration options on the controller
- specified by ControllerHandle and ChildHandle.
-
-**/
-EFI_STATUS
-IDEBusDriverConfigurationForceDefaults (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN UINT32 DefaultType,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- )
-{
- UINT8 Value;
-
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Value = 0x0f;
- gRT->SetVariable (
- L"Configuration",
- &gEfiCallerIdGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof (Value),
- &Value
- );
- *ActionRequired = EfiDriverConfigurationActionRestartController;
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverDiagnostics.c b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverDiagnostics.c
deleted file mode 100644
index 44d767c..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/DriverDiagnostics.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/** @file
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "idebus.h"
-
-#define IDE_BUS_DIAGNOSTIC_ERROR L"PCI IDE/ATAPI Driver Diagnostics Failed"
-
-//
-// EFI Driver Diagnostics Protocol
-//
-EFI_DRIVER_DIAGNOSTICS_PROTOCOL gIDEBusDriverDiagnostics = {
- IDEBusDriverDiagnosticsRunDiagnostics,
- "eng"
-};
-
-/**
- Runs diagnostics on a controller.
-
- @param This A pointer to the EFI_DRIVER_DIAGNOSTICS_PROTOCOL
- instance.
- @param ControllerHandle The handle of the controller to run diagnostics on.
- @param ChildHandle The handle of the child controller to run diagnostics on
- This is an optional parameter that may be NULL. It will
- be NULL for device drivers. It will also be NULL for a
- bus drivers that wish to run diagnostics on the bus
- controller. It will not be NULL for a bus driver that
- wishes to run diagnostics on one of its child
- controllers.
- @param DiagnosticType Indicates type of diagnostics to perform on the
- controller specified by ControllerHandle and ChildHandle.
- See "Related Definitions" for the list of supported
- types.
- @param Language A pointer to a three character ISO 639-2 language
- identifier. This is the language in which the optional
- error message should be returned in Buffer, and it must
- match one of the languages specified in
- SupportedLanguages. The number of languages supported by
- a driver is up to the driver writer.
- @param ErrorType A GUID that defines the format of the data returned in
- Buffer.
- @param BufferSize The size, in bytes, of the data returned in Buffer.
- @param Buffer A buffer that contains a Null-terminated Unicode string
- plus some additional data whose format is defined by
- ErrorType. Buffer is allocated by this function with
- AllocatePool(), and it is the caller's responsibility
- to free it with a call to FreePool().
-
- @retval EFI_SUCCESS The controller specified by ControllerHandle and
- ChildHandle passed the diagnostic.
- @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- @retval EFI_INVALID_PARAMETER Language is NULL.
- @retval EFI_INVALID_PARAMETER ErrorType is NULL.
- @retval EFI_INVALID_PARAMETER BufferType is NULL.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_UNSUPPORTED The driver specified by This does not support
- running diagnostics for the controller specified
- by ControllerHandle and ChildHandle.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- type of diagnostic specified by DiagnosticType.
- @retval EFI_UNSUPPORTED The driver specified by This does not support the
- language specified by Language.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources available to complete
- the diagnostics.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources available to return
- the status information in ErrorType, BufferSize,
- and Buffer.
- @retval EFI_DEVICE_ERROR The controller specified by ControllerHandle and
- ChildHandle did not pass the diagnostic.
-
-**/
-EFI_STATUS
-IDEBusDriverDiagnosticsRunDiagnostics (
- IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
- IN CHAR8 *Language,
- OUT EFI_GUID **ErrorType,
- OUT UINTN *BufferSize,
- OUT CHAR16 **Buffer
- )
-{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
- IDE_BLK_IO_DEV *IdeBlkIoDevice;
- UINT32 VendorDeviceId;
- VOID *BlockBuffer;
-
- *ErrorType = NULL;
- *BufferSize = 0;
-
- if (ChildHandle == NULL) {
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiCallerIdGuid,
- NULL,
- gIDEBusDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- gIDEBusDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Use services of PCI I/O Protocol to test the PCI IDE/ATAPI Controller
- // The following test simply reads the Device ID and Vendor ID.
- // It should never fail. A real test would perform more advanced
- // diagnostics.
- //
-
- Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0, 1, &VendorDeviceId);
- if (EFI_ERROR (Status) || VendorDeviceId == 0xffffffff) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
- }
-
- Status = gBS->OpenProtocol (
- ChildHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo,
- gIDEBusDriverBinding.DriverBindingHandle,
- ChildHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlkIo);
-
- //
- // Use services available from IdeBlkIoDevice to test the IDE/ATAPI device
- //
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- IdeBlkIoDevice->BlkMedia.BlockSize,
- (VOID **) &BlockBuffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = IdeBlkIoDevice->BlkIo.ReadBlocks (
- &IdeBlkIoDevice->BlkIo,
- IdeBlkIoDevice->BlkMedia.MediaId,
- 0,
- IdeBlkIoDevice->BlkMedia.BlockSize,
- BlockBuffer
- );
-
- if (EFI_ERROR (Status)) {
- *ErrorType = &gEfiCallerIdGuid;
- *BufferSize = sizeof (IDE_BUS_DIAGNOSTIC_ERROR);
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- (UINTN) (*BufferSize),
- (VOID **) Buffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- CopyMem (*Buffer, IDE_BUS_DIAGNOSTIC_ERROR, *BufferSize);
-
- Status = EFI_DEVICE_ERROR;
- }
-
- gBS->FreePool (BlockBuffer);
-
- return Status;
-}
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c
deleted file mode 100644
index 3c94c87..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ata.c
+++ /dev/null
@@ -1,2624 +0,0 @@
-/** @file
- Copyright (c) 2006 - 2007 Intel Corporation. <BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- @par Revision Reference:
- 2002-6: Add Atapi6 enhancement, support >120GB hard disk, including
- update - ATAIdentity() func
- update - AtaBlockIoReadBlocks() func
- update - AtaBlockIoWriteBlocks() func
- add - AtaAtapi6Identify() func
- add - AtaReadSectorsExt() func
- add - AtaWriteSectorsExt() func
- add - AtaPioDataInExt() func
- add - AtaPioDataOutExt() func
-
-**/
-
-#include "idebus.h"
-
-/**
- Sends out an ATA Identify Command to the specified device.
-
- This function is called by DiscoverIdeDevice() during its device
- identification. It sends out the ATA Identify Command to the
- specified device. Only ATA device responses to this command. If
- the command succeeds, it returns the Identify data structure which
- contains information about the device. This function extracts the
- information it needs to fill the IDE_BLK_IO_DEV data structure,
- including device type, media block size, media capacity, and etc.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure,used
- to record all the information of the IDE device.
-
- @retval EFI_SUCCESS Identify ATA device successfully.
-
- @retval EFI_DEVICE_ERROR ATA Identify Device Command failed or
- device is not ATA device.
-
- @note
- parameter IdeDev will be updated in this function.
-
-**/
-EFI_STATUS
-ATAIdentify (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- EFI_STATUS Status;
- EFI_IDENTIFY_DATA *AtaIdentifyPointer;
- UINT32 Capacity;
- UINT8 DeviceSelect;
-
- //
- // AtaIdentifyPointer is used for accommodating returned IDENTIFY data of
- // the ATA Identify command
- //
- AtaIdentifyPointer = (EFI_IDENTIFY_DATA *) AllocateZeroPool (sizeof (EFI_IDENTIFY_DATA));
-
- //
- // use ATA PIO Data In protocol to send ATA Identify command
- // and receive data from device
- //
- DeviceSelect = (UINT8) ((IdeDev->Device) << 4);
- Status = AtaPioDataIn (
- IdeDev,
- (VOID *) AtaIdentifyPointer,
- sizeof (EFI_IDENTIFY_DATA),
- IDENTIFY_DRIVE_CMD,
- DeviceSelect,
- 0,
- 0,
- 0,
- 0
- );
- //
- // If ATA Identify command succeeds, then according to the received
- // IDENTIFY data,
- // identify the device type ( ATA or not ).
- // If ATA device, fill the information in IdeDev.
- // If not ATA device, return IDE_DEVICE_ERROR
- //
- if (!EFI_ERROR (Status)) {
-
- IdeDev->pIdData = AtaIdentifyPointer;
-
- //
- // Print ATA Module Name
- //
- PrintAtaModuleName (IdeDev);
-
- //
- // bit 15 of pAtaIdentify->config is used to identify whether device is
- // ATA device or ATAPI device.
- // if 0, means ATA device; if 1, means ATAPI device.
- //
- if ((AtaIdentifyPointer->AtaData.config & 0x8000) == 0x00) {
- //
- // Detect if support S.M.A.R.T. If yes, enable it as default
- //
- AtaSMARTSupport (IdeDev);
-
- //
- // Check whether this device needs 48-bit addressing (ATAPI-6 ata device)
- //
- Status = AtaAtapi6Identify (IdeDev);
- if (!EFI_ERROR (Status)) {
- //
- // It's a disk with >120GB capacity, initialized in AtaAtapi6Identify()
- //
- return EFI_SUCCESS;
- }
- //
- // This is a hard disk <= 120GB capacity, treat it as normal hard disk
- //
- IdeDev->Type = IdeHardDisk;
-
- //
- // Block Media Information:
- // Media->LogicalPartition , Media->WriteCaching will be filled
- // in the DiscoverIdeDevcie() function.
- //
- IdeDev->BlkIo.Media->IoAlign = 4;
- IdeDev->BlkIo.Media->MediaId = 1;
- IdeDev->BlkIo.Media->RemovableMedia = FALSE;
- IdeDev->BlkIo.Media->MediaPresent = TRUE;
- IdeDev->BlkIo.Media->ReadOnly = FALSE;
- IdeDev->BlkIo.Media->BlockSize = 0x200;
-
- //
- // Calculate device capacity
- //
- Capacity = ((UINT32)AtaIdentifyPointer->AtaData.user_addressable_sectors_hi << 16) |
- AtaIdentifyPointer->AtaData.user_addressable_sectors_lo ;
- IdeDev->BlkIo.Media->LastBlock = Capacity - 1;
-
- return EFI_SUCCESS;
-
- }
- }
-
- gBS->FreePool (AtaIdentifyPointer);
- //
- // Make sure the pIdData will not be freed again.
- //
- IdeDev->pIdData = NULL;
-
- return EFI_DEVICE_ERROR;
-}
-
-
-/**
- This function is called by ATAIdentify() to identity whether this disk
- supports ATA/ATAPI6 48bit addressing, ie support >120G capacity
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @retval EFI_SUCCESS The disk specified by IdeDev is a Atapi6 supported one
- and 48-bit addressing must be used
-
- @retval EFI_UNSUPPORTED The disk dosn't not support Atapi6 or it supports but
- the capacity is below 120G, 48bit addressing is not
- needed
-
- @note
- This function must be called after DEVICE_IDENTITY command has been
- successfully returned
-
-**/
-EFI_STATUS
-AtaAtapi6Identify (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- UINT8 Index;
- EFI_LBA TmpLba;
- EFI_LBA Capacity;
- EFI_IDENTIFY_DATA *Atapi6IdentifyStruct;
-
- if (IdeDev->pIdData == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Atapi6IdentifyStruct = IdeDev->pIdData;
-
- if ((Atapi6IdentifyStruct->AtapiData.cmd_set_support_83 & bit10) == 0) {
- //
- // The device dosn't support 48 bit addressing
- //
- return EFI_UNSUPPORTED;
- }
-
- //
- // 48 bit address feature set is supported, get maximum capacity
- //
- Capacity = Atapi6IdentifyStruct->AtapiData.max_user_lba_for_48bit_addr[0];
- for (Index = 1; Index < 4; Index++) {
- //
- // Lower byte goes first: word[100] is the lowest word, word[103] is highest
- //
- TmpLba = Atapi6IdentifyStruct->AtapiData.max_user_lba_for_48bit_addr[Index];
- Capacity |= LShiftU64 (TmpLba, 16 * Index);
- }
-
- if (Capacity > MAX_28BIT_ADDRESSING_CAPACITY) {
- //
- // Capacity exceeds 120GB. 48-bit addressing is really needed
- //
- IdeDev->Type = Ide48bitAddressingHardDisk;
-
- //
- // Fill block media information:Media->LogicalPartition ,
- // Media->WriteCaching will be filledin the DiscoverIdeDevcie() function.
- //
- IdeDev->BlkIo.Media->IoAlign = 4;
- IdeDev->BlkIo.Media->MediaId = 1;
- IdeDev->BlkIo.Media->RemovableMedia = FALSE;
- IdeDev->BlkIo.Media->MediaPresent = TRUE;
- IdeDev->BlkIo.Media->ReadOnly = FALSE;
- IdeDev->BlkIo.Media->BlockSize = 0x200;
- IdeDev->BlkIo.Media->LastBlock = Capacity - 1;
-
- return EFI_SUCCESS;
- }
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- This function is called by ATAIdentify() or ATAPIIdentify()
- to print device's module name.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
-**/
-VOID
-PrintAtaModuleName (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- if (IdeDev->pIdData == NULL) {
- return ;
- }
-
- SwapStringChars (IdeDev->ModelName, IdeDev->pIdData->AtaData.ModelName, 40);
- IdeDev->ModelName[40] = 0x00;
-}
-
-/**
- This function is used to send out ATA commands conforms to the
- PIO Data In Protocol.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *Buffer
- buffer contained data transferred from device to host.
-
- @param[in] ByteCount
- data size in byte unit of the buffer.
-
- @param[in] AtaCommand
- value of the Command Register
-
- @param[in] Head
- value of the Head/Device Register
-
- @param[in] SectorCount
- value of the Sector Count Register
-
- @param[in] SectorNumber
- value of the Sector Number Register
-
- @param[in] CylinderLsb
- value of the low byte of the Cylinder Register
-
- @param[in] CylinderMsb
- value of the high byte of the Cylinder Register
-
- @retval EFI_SUCCESS send out the ATA command and device send required
- data successfully.
-
- @retval EFI_DEVICE_ERROR command sent failed.
-
-**/
-EFI_STATUS
-AtaPioDataIn (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *Buffer,
- IN UINT32 ByteCount,
- IN UINT8 AtaCommand,
- IN UINT8 Head,
- IN UINT8 SectorCount,
- IN UINT8 SectorNumber,
- IN UINT8 CylinderLsb,
- IN UINT8 CylinderMsb
- )
-{
- UINTN WordCount;
- UINTN Increment;
- UINT16 *Buffer16;
- EFI_STATUS Status;
-
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // e0:1110,0000-- bit7 and bit5 are reserved bits.
- // bit6 set means LBA mode
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((IdeDev->Device << 4) | 0xe0 | Head)
- );
-
- //
- // All ATAPI device's ATA commands can be issued regardless of the
- // state of the DRDY
- //
- if (IdeDev->Type == IdeHardDisk) {
-
- Status = DRDYReady (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- }
- //
- // set all the command parameters
- // Before write to all the following registers, BSY and DRQ must be 0.
- //
- Status = DRQClear2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- if (AtaCommand == SET_FEATURES_CMD) {
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, 0x03);
- }
-
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, SectorNumber);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, CylinderLsb);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, CylinderMsb);
-
- //
- // send command via Command Register
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, AtaCommand);
-
- Buffer16 = (UINT16 *) Buffer;
-
- //
- // According to PIO data in protocol, host can perform a series of reads to
- // the data register after each time device set DRQ ready;
- // The data size of "a series of read" is command specific.
- // For most ATA command, data size received from device will not exceed
- // 1 sector, hence the data size for "a series of read" can be the whole data
- // size of one command request.
- // For ATA command such as Read Sector command, the data size of one ATA
- // command request is often larger than 1 sector, according to the
- // Read Sector command, the data size of "a series of read" is exactly 1
- // sector.
- // Here for simplification reason, we specify the data size for
- // "a series of read" to 1 sector (256 words) if data size of one ATA command
- // request is larger than 256 words.
- //
- Increment = 256;
-
- //
- // used to record bytes of currently transfered data
- //
- WordCount = 0;
-
- while (WordCount < ByteCount / 2) {
- //
- // Poll DRQ bit set, data transfer can be performed only when DRQ is ready.
- //
- Status = DRQReady2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = CheckErrorStatus (IdeDev);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Get the byte count for one series of read
- //
- if ((WordCount + Increment) > ByteCount / 2) {
- Increment = ByteCount / 2 - WordCount;
- }
-
- IDEReadPortWMultiple (
- IdeDev->PciIo,
- IdeDev->IoPort->Data,
- Increment,
- Buffer16
- );
-
- WordCount += Increment;
- Buffer16 += Increment;
-
- }
-
- DRQClear (IdeDev, ATATIMEOUT);
-
- return CheckErrorStatus (IdeDev);
-}
-
-/**
- This function is used to send out ATA commands conforms to the
- PIO Data Out Protocol.
-
- @param *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param *Buffer buffer contained data transferred from host to device.
- @param ByteCount data size in byte unit of the buffer.
- @param AtaCommand value of the Command Register
- @param Head value of the Head/Device Register
- @param SectorCount value of the Sector Count Register
- @param SectorNumber value of the Sector Number Register
- @param CylinderLsb value of the low byte of the Cylinder Register
- @param CylinderMsb value of the high byte of the Cylinder Register
-
- @retval EFI_SUCCESS send out the ATA command and device received required
- data successfully.
-
- @retval EFI_DEVICE_ERROR command sent failed.
-
-**/
-EFI_STATUS
-AtaPioDataOut (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *Buffer,
- IN UINT32 ByteCount,
- IN UINT8 AtaCommand,
- IN UINT8 Head,
- IN UINT8 SectorCount,
- IN UINT8 SectorNumber,
- IN UINT8 CylinderLsb,
- IN UINT8 CylinderMsb
- )
-{
- UINTN WordCount;
- UINTN Increment;
- UINT16 *Buffer16;
- EFI_STATUS Status;
-
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // select device via Head/Device register.
- // Before write Head/Device register, BSY and DRQ must be 0.
- //
- Status = DRQClear2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // e0:1110,0000-- bit7 and bit5 are reserved bits.
- // bit6 set means LBA mode
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((IdeDev->Device << 4) | 0xe0 | Head)
- );
-
- Status = DRDYReady (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // set all the command parameters
- // Before write to all the following registers, BSY and DRQ must be 0.
- //
- Status = DRQClear2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, SectorNumber);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, CylinderLsb);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, CylinderMsb);
-
- //
- // send command via Command Register
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, AtaCommand);
-
- Buffer16 = (UINT16 *) Buffer;
-
- //
- // According to PIO data out protocol, host can perform a series of
- // writes to the data register after each time device set DRQ ready;
- // The data size of "a series of read" is command specific.
- // For most ATA command, data size written to device will not exceed 1 sector,
- // hence the data size for "a series of write" can be the data size of one
- // command request.
- // For ATA command such as Write Sector command, the data size of one
- // ATA command request is often larger than 1 sector, according to the
- // Write Sector command, the data size of "a series of read" is exactly
- // 1 sector.
- // Here for simplification reason, we specify the data size for
- // "a series of write" to 1 sector (256 words) if data size of one ATA command
- // request is larger than 256 words.
- //
- Increment = 256;
- WordCount = 0;
-
- while (WordCount < ByteCount / 2) {
-
- //
- // DRQReady2-- read Alternate Status Register to determine the DRQ bit
- // data transfer can be performed only when DRQ is ready.
- //
- Status = DRQReady2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = CheckErrorStatus (IdeDev);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Check the remaining byte count is less than 512 bytes
- //
- if ((WordCount + Increment) > ByteCount / 2) {
- Increment = ByteCount / 2 - WordCount;
- }
- //
- // perform a series of write without check DRQ ready
- //
-
- IDEWritePortWMultiple (
- IdeDev->PciIo,
- IdeDev->IoPort->Data,
- Increment,
- Buffer16
- );
- WordCount += Increment;
- Buffer16 += Increment;
-
- }
-
- DRQClear (IdeDev, ATATIMEOUT);
-
- return CheckErrorStatus (IdeDev);
-}
-
-/**
- This function is used to analyze the Status Register and print out
- some debug information and if there is ERR bit set in the Status
- Register, the Error Register's value is also be parsed and print out.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @retval EFI_SUCCESS No err information in the Status Register.
- @retval EFI_DEVICE_ERROR Any err information in the Status Register.
-
-**/
-EFI_STATUS
-CheckErrorStatus (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- UINT8 StatusRegister;
- UINT8 ErrorRegister;
-
- StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);
-
- DEBUG_CODE_BEGIN ();
-
- if (StatusRegister & DWF) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Write Fault\n",
- StatusRegister)
- );
- }
-
- if (StatusRegister & CORR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Corrected Data\n",
- StatusRegister)
- );
- }
-
- if (StatusRegister & ERR) {
- ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);
-
- if (ErrorRegister & BBK_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Bad Block Detected\n",
- ErrorRegister)
- );
- }
-
- if (ErrorRegister & UNC_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Uncorrectable Data\n",
- ErrorRegister)
- );
- }
-
- if (ErrorRegister & MC_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Media Change\n",
- ErrorRegister)
- );
- }
-
- if (ErrorRegister & ABRT_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Abort\n",
- ErrorRegister)
- );
- }
-
- if (ErrorRegister & TK0NF_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Track 0 Not Found\n",
- ErrorRegister)
- );
- }
-
- if (ErrorRegister & AMNF_ERR) {
- DEBUG (
- (EFI_D_BLKIO,
- "CheckErrorStatus()-- %02x : Error : Address Mark Not Found\n",
- ErrorRegister)
- );
- }
- }
-
- DEBUG_CODE_END ();
-
- if ((StatusRegister & (ERR | DWF | CORR)) == 0) {
- return EFI_SUCCESS;
- }
-
- return EFI_DEVICE_ERROR;
-
-}
-
-/**
- This function is called by the AtaBlkIoReadBlocks() to perform
- reading from media in block unit.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *DataBuffer
- A pointer to the destination buffer for the data.
-
- @param[in] Lba
- The starting logical block address to read from
- on the device media.
-
- @param[in] NumberOfBlocks
- The number of transfer data blocks.
-
- @return return status is fully dependent on the return status
- of AtaPioDataIn() function.
-
-**/
-EFI_STATUS
-AtaReadSectors (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- )
-{
- EFI_STATUS Status;
- UINTN BlocksRemaining;
- UINT32 Lba32;
- UINT8 Lba0;
- UINT8 Lba1;
- UINT8 Lba2;
- UINT8 Lba3;
- UINT8 AtaCommand;
- UINT8 SectorCount8;
- UINT16 SectorCount;
- UINTN ByteCount;
- VOID *Buffer;
-
- Buffer = DataBuffer;
-
- //
- // Using ATA Read Sector(s) command (opcode=0x20) with PIO DATA IN protocol
- //
- AtaCommand = READ_SECTORS_CMD;
-
-
- BlocksRemaining = NumberOfBlocks;
-
- Lba32 = (UINT32) Lba;
-
- Status = EFI_SUCCESS;
-
- while (BlocksRemaining > 0) {
-
- //
- // in ATA-3 spec, LBA is in 28 bit width
- //
- Lba0 = (UINT8) Lba32;
- Lba1 = (UINT8) (Lba32 >> 8);
- Lba2 = (UINT8) (Lba32 >> 16);
- //
- // low 4 bit of Lba3 stands for LBA bit24~bit27.
- //
- Lba3 = (UINT8) ((Lba32 >> 24) & 0x0f);
-
- if (BlocksRemaining >= 0x100) {
-
- //
- // SectorCount8 is sent to Sector Count register, 0x00 means 256
- // sectors to be read
- //
- SectorCount8 = 0x00;
- //
- // SectorCount is used to record the number of sectors to be read
- //
- SectorCount = 256;
- } else {
-
- SectorCount8 = (UINT8) BlocksRemaining;
- SectorCount = (UINT16) BlocksRemaining;
- }
-
- //
- // ByteCount is the number of bytes that will be read
- //
- ByteCount = SectorCount * (IdeDev->BlkIo.Media->BlockSize);
-
- //
- // call AtaPioDataIn() to send Read Sector Command and receive data read
- //
- Status = AtaPioDataIn (
- IdeDev,
- Buffer,
- (UINT32) ByteCount,
- AtaCommand,
- Lba3,
- SectorCount8,
- Lba0,
- Lba1,
- Lba2
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Lba32 += SectorCount;
- Buffer = ((UINT8 *) Buffer + ByteCount);
- BlocksRemaining -= SectorCount;
- }
-
- return Status;
-}
-
-/**
- This function is called by the AtaBlkIoWriteBlocks() to perform
- writing onto media in block unit.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure,used
- to record all the information of the IDE device.
-
- @param[in] *BufferData
- A pointer to the source buffer for the data.
-
- @param[in] Lba
- The starting logical block address to write onto
- the device media.
-
- @param[in] NumberOfBlocks
- The number of transfer data blocks.
-
- @return return status is fully dependent on the return status
- of AtaPioDataOut() function.
-
-**/
-EFI_STATUS
-AtaWriteSectors (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *BufferData,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- )
-{
- EFI_STATUS Status;
- UINTN BlocksRemaining;
- UINT32 Lba32;
- UINT8 Lba0;
- UINT8 Lba1;
- UINT8 Lba2;
- UINT8 Lba3;
- UINT8 AtaCommand;
- UINT8 SectorCount8;
- UINT16 SectorCount;
- UINTN ByteCount;
- VOID *Buffer;
-
- Buffer = BufferData;
-
- //
- // Using Write Sector(s) command (opcode=0x30) with PIO DATA OUT protocol
- //
- AtaCommand = WRITE_SECTORS_CMD;
-
- BlocksRemaining = NumberOfBlocks;
-
- Lba32 = (UINT32) Lba;
-
- Status = EFI_SUCCESS;
-
- while (BlocksRemaining > 0) {
-
- Lba0 = (UINT8) Lba32;
- Lba1 = (UINT8) (Lba32 >> 8);
- Lba2 = (UINT8) (Lba32 >> 16);
- Lba3 = (UINT8) ((Lba32 >> 24) & 0x0f);
-
- if (BlocksRemaining >= 0x100) {
-
- //
- // SectorCount8 is sent to Sector Count register, 0x00 means 256 sectors
- // to be written
- //
- SectorCount8 = 0x00;
- //
- // SectorCount is used to record the number of sectors to be written
- //
- SectorCount = 256;
- } else {
-
- SectorCount8 = (UINT8) BlocksRemaining;
- SectorCount = (UINT16) BlocksRemaining;
- }
-
- ByteCount = SectorCount * (IdeDev->BlkIo.Media->BlockSize);
-
- Status = AtaPioDataOut (
- IdeDev,
- Buffer,
- (UINT32) ByteCount,
- AtaCommand,
- Lba3,
- SectorCount8,
- Lba0,
- Lba1,
- Lba2
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Lba32 += SectorCount;
- Buffer = ((UINT8 *) Buffer + ByteCount);
- BlocksRemaining -= SectorCount;
- }
-
- return Status;
-}
-
-/**
- This function is used to implement the Soft Reset on the specified
- device. But, the ATA Soft Reset mechanism is so strong a reset method
- that it will force resetting on both devices connected to the
- same cable.
-
- It is called by IdeBlkIoReset(), a interface function of Block
- I/O protocol.
-
- This function can also be used by the ATAPI device to perform reset when
- ATAPI Reset command is failed.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @retval EFI_SUCCESS Soft reset completes successfully.
- @retval EFI_DEVICE_ERROR Any step during the reset process is failed.
-
- @note
- The registers initial values after ATA soft reset are different
- to the ATA device and ATAPI device.
-
-**/
-EFI_STATUS
-AtaSoftReset (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
-
- UINT8 DeviceControl;
-
- DeviceControl = 0;
- //
- // set SRST bit to initiate soft reset
- //
- DeviceControl |= SRST;
-
- //
- // disable Interrupt
- //
- DeviceControl |= bit1;
-
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Alt.DeviceControl, DeviceControl);
-
- //
- // SRST should assert for at least 5 us, we use 10 us for
- // better compatibility
- //
- gBS->Stall (10);
-
- //
- // Enable interrupt to support UDMA, and clear SRST bit
- //
- DeviceControl = 0;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Alt.DeviceControl, DeviceControl);
-
- //
- // Wait for at least 2 ms to check BSY status, we use 10 ms
- // for better compatibility
- //
- gBS->Stall(10000);
- //
- // slave device needs at most 31s to clear BSY
- //
- if (WaitForBSYClear (IdeDev, 31000) == EFI_TIMEOUT) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is the ATA implementation for ReadBlocks in the
- Block I/O Protocol interface.
-
- @param[in] *IdeBlkIoDevice
- Indicates the calling context.
-
- @param[in] MediaId
- The media id that the read request is for.
-
- @param[in] LBA
- The starting logical block address to read from
- on the device.
-
- @param[in] BufferSize
- The size of the Buffer in bytes. This must be a
- multiple of the intrinsic block size of the device.
-
- @param[out] *Buffer
- A pointer to the destination buffer for the data.
- The caller is responsible for either having implicit
- or explicit ownership of the memory that data is read into.
-
- @retval EFI_SUCCESS Read Blocks successfully.
- @retval EFI_DEVICE_ERROR Read Blocks failed.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGE The MediaId is not for the current media.
-
- @retval EFI_BAD_BUFFER_SIZE
- The BufferSize parameter is not a multiple of the
- intrinsic block size of the device.
-
- @retval EFI_INVALID_PARAMETER
- The read request contains LBAs that are not valid,
- or the data buffer is not valid.
-
- @note
- If Read Block error because of device error, this function will call
- AtaSoftReset() function to reset device.
-
-**/
-EFI_STATUS
-AtaBlkIoReadBlocks (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_BLOCK_IO_MEDIA *Media;
- UINTN BlockSize;
- UINTN NumberOfBlocks;
- EFI_STATUS Status;
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
-
- Status = EFI_SUCCESS;
-
- //
- // Get the intrinsic block size
- //
- Media = IdeBlkIoDevice->BlkIo.Media;
- BlockSize = Media->BlockSize;
-
- NumberOfBlocks = BufferSize / BlockSize;
-
- if (MediaId != Media->MediaId) {
- return EFI_MEDIA_CHANGED;
- }
-
- if (BufferSize % BlockSize != 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- if (!(Media->MediaPresent)) {
- return EFI_NO_MEDIA;
- }
-
- if (LBA > Media->LastBlock) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((Media->IoAlign > 1) && (((UINTN) Buffer & (Media->IoAlign - 1)) != 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = EFI_SUCCESS;
- if (IdeBlkIoDevice->Type == Ide48bitAddressingHardDisk) {
- //
- // For ATA/ATAPI-6 device(capcity > 120GB), use ATA-6 read block mechanism
- //
- if (IdeBlkIoDevice->UdmaMode.Valid) {
- Status = AtaUdmaReadExt (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);
- } else {
- Status = AtaReadSectorsExt (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);
- }
- } else {
- //
- // For ATA-3 compatible device, use ATA-3 read block mechanism
- //
- if (IdeBlkIoDevice->UdmaMode.Valid) {
- Status = AtaUdmaRead (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);
- } else {
- Status = AtaReadSectors (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);
- }
- }
-
- if (EFI_ERROR (Status)) {
- AtaSoftReset (IdeBlkIoDevice);
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-
-}
-
-/**
- This function is the ATA implementation for WriteBlocks in the
- Block I/O Protocol interface.
-
- @param[in] *IdeBlkIoDevice
- Indicates the calling context.
-
- @param[in] MediaId
- The media id that the write request is for.
-
- @param[in] LBA
- The starting logical block address to write onto
- the device.
-
- @param[in] BufferSize
- The size of the Buffer in bytes. This must be a
- multiple of the intrinsic block size of the device.
-
- @param[out] *Buffer
- A pointer to the source buffer for the data.
- The caller is responsible for either having implicit
- or explicit ownership of the memory that data is
- written from.
-
- @retval EFI_SUCCESS Write Blocks successfully.
- @retval EFI_DEVICE_ERROR Write Blocks failed.
- @retval EFI_NO_MEDIA There is no media in the device.
- @retval EFI_MEDIA_CHANGE The MediaId is not for the current media.
-
- @retval EFI_BAD_BUFFER_SIZE
- The BufferSize parameter is not a multiple of the
- intrinsic block size of the device.
-
- @retval EFI_INVALID_PARAMETER
- The write request contains LBAs that are not valid,
- or the data buffer is not valid.
-
- @note
- If Write Block error because of device error, this function will call
- AtaSoftReset() function to reset device.
-
-**/
-EFI_STATUS
-AtaBlkIoWriteBlocks (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-{
-
- EFI_BLOCK_IO_MEDIA *Media;
- UINTN BlockSize;
- UINTN NumberOfBlocks;
- EFI_STATUS Status;
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
-
- Status = EFI_SUCCESS;
-
- //
- // Get the intrinsic block size
- //
- Media = IdeBlkIoDevice->BlkIo.Media;
- BlockSize = Media->BlockSize;
- NumberOfBlocks = BufferSize / BlockSize;
-
- if (MediaId != Media->MediaId) {
- return EFI_MEDIA_CHANGED;
- }
-
- if (BufferSize % BlockSize != 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- if (LBA > Media->LastBlock) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((Media->IoAlign > 1) && (((UINTN) Buffer & (Media->IoAlign - 1)) != 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = EFI_SUCCESS;
- if (IdeBlkIoDevice->Type == Ide48bitAddressingHardDisk) {
- //
- // For ATA/ATAPI-6 device(capcity > 120GB), use ATA-6 write block mechanism
- //
- if (IdeBlkIoDevice->UdmaMode.Valid) {
- Status = AtaUdmaWriteExt (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);
- } else {
- Status = AtaWriteSectorsExt (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);
- }
- } else {
- //
- // For ATA-3 compatible device, use ATA-3 write block mechanism
- //
- if (IdeBlkIoDevice->UdmaMode.Valid) {
- Status = AtaUdmaWrite (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);
- } else {
- Status = AtaWriteSectors (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);
- }
- }
-
- if (EFI_ERROR (Status)) {
- AtaSoftReset (IdeBlkIoDevice);
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is called by the AtaBlkIoReadBlocks() to perform
- reading from media in block unit. The function has been enhanced to
- support >120GB access and transfer at most 65536 blocks per command
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *DataBuffer A pointer to the destination buffer for the data.
- @param[in] StartLba The starting logical block address to read from
- on the device media.
- @param[in] NumberOfBlocks The number of transfer data blocks.
-
- @return return status is fully dependent on the return status
- of AtaPioDataInExt() function.
-
-**/
-EFI_STATUS
-AtaReadSectorsExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-{
- EFI_STATUS Status;
- UINTN BlocksRemaining;
- EFI_LBA Lba64;
- UINT8 AtaCommand;
- UINT16 SectorCount;
- UINT32 ByteCount;
- VOID *Buffer;
-
- //
- // Using ATA "Read Sectors Ext" command(opcode=0x24) with PIO DATA IN protocol
- //
- AtaCommand = READ_SECTORS_EXT_CMD;
- Buffer = DataBuffer;
- BlocksRemaining = NumberOfBlocks;
- Lba64 = StartLba;
- Status = EFI_SUCCESS;
-
- while (BlocksRemaining > 0) {
-
- if (BlocksRemaining >= 0x10000) {
- //
- // SectorCount is used to record the number of sectors to be read
- // Max 65536 sectors can be transfered at a time.
- //
- SectorCount = 0xffff;
- } else {
- SectorCount = (UINT16) BlocksRemaining;
- }
-
- //
- // ByteCount is the number of bytes that will be read
- //
- ByteCount = SectorCount * (IdeDev->BlkIo.Media->BlockSize);
-
- //
- // call AtaPioDataInExt() to send Read Sector Command and receive data read
- //
- Status = AtaPioDataInExt (
- IdeDev,
- Buffer,
- ByteCount,
- AtaCommand,
- Lba64,
- SectorCount
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Lba64 += SectorCount;
- Buffer = ((UINT8 *) Buffer + ByteCount);
- BlocksRemaining -= SectorCount;
- }
-
- return Status;
-}
-
-/**
- This function is called by the AtaBlkIoWriteBlocks() to perform
- writing onto media in block unit. The function has been enhanced to
- support >120GB access and transfer at most 65536 blocks per command
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure,used
- to record all the information of the IDE device.
-
- @param[in] *DataBuffer
- A pointer to the source buffer for the data.
-
- @param[in] Lba
- The starting logical block address to write onto
- the device media.
-
- @param[in] NumberOfBlocks
- The number of transfer data blocks.
-
- @return status is fully dependent on the return status
- of AtaPioDataOutExt() function.
-
-**/
-EFI_STATUS
-AtaWriteSectorsExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-{
- EFI_STATUS Status;
- EFI_LBA Lba64;
- UINTN BlocksRemaining;
- UINT8 AtaCommand;
- UINT16 SectorCount;
- UINT32 ByteCount;
- VOID *Buffer;
-
- //
- // Using ATA "Write Sectors Ext" cmd(opcode=0x24) with PIO DATA OUT protocol
- //
- AtaCommand = WRITE_SECTORS_EXT_CMD;
- Lba64 = StartLba;
- Buffer = DataBuffer;
- BlocksRemaining = NumberOfBlocks;
-
- Status = EFI_SUCCESS;
-
- while (BlocksRemaining > 0) {
-
- if (BlocksRemaining >= 0x10000) {
- //
- // SectorCount is used to record the number of sectors to be written.
- // Max 65536 sectors can be transfered at a time.
- //
- SectorCount = 0xffff;
- } else {
- SectorCount = (UINT16) BlocksRemaining;
- }
-
- //
- // ByteCount is the number of bytes that will be written
- //
- ByteCount = SectorCount * (IdeDev->BlkIo.Media->BlockSize);
-
- //
- // Call AtaPioDataOutExt() to send "Write Sectors Ext" Command
- //
- Status = AtaPioDataOutExt (
- IdeDev,
- Buffer,
- ByteCount,
- AtaCommand,
- Lba64,
- SectorCount
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Lba64 += SectorCount;
- Buffer = ((UINT8 *) Buffer + ByteCount);
- BlocksRemaining -= SectorCount;
- }
-
- return Status;
-}
-
-/**
- This function is used to send out ATA commands conforms to the
- PIO Data In Protocol, supporting ATA/ATAPI-6 standard
-
- Comparing with ATA-3 data in protocol, we have two differents here:<BR>
- 1. Do NOT wait for DRQ clear before sending command into IDE device.(the
- wait will frequently fail... cause writing function return error)
-
- 2. Do NOT wait for DRQ clear after all data readed.(the wait greatly
- slow down writing performance by 100 times!)
-
- @param[in] *IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in,out] *Buffer buffer contained data transferred from device to host.
- @param[in] ByteCount data size in byte unit of the buffer.
- @param[in] AtaCommand value of the Command Register
- @param[in] StartLba the start LBA of this transaction
- @param[in] SectorCount the count of sectors to be transfered
-
- @retval EFI_SUCCESS send out the ATA command and device send required
- data successfully.
-
- @retval EFI_DEVICE_ERROR command sent failed.
-
-**/
-EFI_STATUS
-AtaPioDataInExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN OUT VOID *Buffer,
- IN UINT32 ByteCount,
- IN UINT8 AtaCommand,
- IN EFI_LBA StartLba,
- IN UINT16 SectorCount
- )
-{
- UINT8 DevSel;
- UINT8 SectorCount8;
- UINT8 LbaLow;
- UINT8 LbaMid;
- UINT8 LbaHigh;
- UINTN WordCount;
- UINTN Increment;
- UINT16 *Buffer16;
- EFI_STATUS Status;
-
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Select device, set bit6 as 1 to indicate LBA mode is used
- //
- DevSel = (UINT8) (IdeDev->Device << 4);
- DevSel |= 0x40;
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- DevSel
- );
-
- //
- // Wait for DRDY singnal asserting. ATAPI device needn't wait
- //
- if ( (IdeDev->Type == IdeHardDisk) ||
- (IdeDev->Type == Ide48bitAddressingHardDisk)) {
-
- Status = DRDYReady (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- }
-
- //
- // Fill feature register if needed
- //
- if (AtaCommand == SET_FEATURES_CMD) {
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, 0x03);
- }
-
- //
- // Fill the sector count register, which is a two-byte FIFO. Need write twice.
- //
- SectorCount8 = (UINT8) (SectorCount >> 8);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount8);
-
- SectorCount8 = (UINT8) SectorCount;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount8);
-
- //
- // Fill the start LBA registers, which are also two-byte FIFO
- //
- LbaLow = (UINT8) RShiftU64 (StartLba, 24);
- LbaMid = (UINT8) RShiftU64 (StartLba, 32);
- LbaHigh = (UINT8) RShiftU64 (StartLba, 40);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, LbaLow);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, LbaMid);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, LbaHigh);
-
- LbaLow = (UINT8) StartLba;
- LbaMid = (UINT8) RShiftU64 (StartLba, 8);
- LbaHigh = (UINT8) RShiftU64 (StartLba, 16);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, LbaLow);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, LbaMid);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, LbaHigh);
-
- //
- // Send command via Command Register, invoking the processing of this command
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, AtaCommand);
-
- Buffer16 = (UINT16 *) Buffer;
-
- //
- // According to PIO data in protocol, host can perform a series of reads to
- // the data register after each time device set DRQ ready;
- //
-
- //
- // 256 words
- //
- Increment = 256;
-
- //
- // used to record bytes of currently transfered data
- //
- WordCount = 0;
-
- while (WordCount < ByteCount / 2) {
- //
- // Poll DRQ bit set, data transfer can be performed only when DRQ is ready.
- //
- Status = DRQReady2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = CheckErrorStatus (IdeDev);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Get the byte count for one series of read
- //
- if ((WordCount + Increment) > ByteCount / 2) {
- Increment = ByteCount / 2 - WordCount;
- }
-
- IDEReadPortWMultiple (
- IdeDev->PciIo,
- IdeDev->IoPort->Data,
- Increment,
- Buffer16
- );
-
- WordCount += Increment;
- Buffer16 += Increment;
-
- }
-
- return CheckErrorStatus (IdeDev);
-}
-
-/**
- This function is used to send out ATA commands conforms to the
- PIO Data Out Protocol, supporting ATA/ATAPI-6 standard
-
- Comparing with ATA-3 data out protocol, we have two differents here:<BR>
- 1. Do NOT wait for DRQ clear before sending command into IDE device.(the
- wait will frequently fail... cause writing function return error)
-
- 2. Do NOT wait for DRQ clear after all data readed.(the wait greatly
- slow down writing performance by 100 times!)
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *Buffer buffer contained data transferred from host to device.
- @param[in] ByteCount data size in byte unit of the buffer.
- @param[in] AtaCommand value of the Command Register
- @param[in] StartLba the start LBA of this transaction
- @param[in] SectorCount the count of sectors to be transfered
-
- @retval EFI_SUCCESS send out the ATA command and device receive required
- data successfully.
-
- @retval EFI_DEVICE_ERROR command sent failed.
-
-**/
-EFI_STATUS
-AtaPioDataOutExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *Buffer,
- IN UINT32 ByteCount,
- IN UINT8 AtaCommand,
- IN EFI_LBA StartLba,
- IN UINT16 SectorCount
- )
-{
- UINT8 DevSel;
- UINT8 SectorCount8;
- UINT8 LbaLow;
- UINT8 LbaMid;
- UINT8 LbaHigh;
- UINTN WordCount;
- UINTN Increment;
- UINT16 *Buffer16;
- EFI_STATUS Status;
-
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Select device. Set bit6 as 1 to indicate LBA mode is used
- //
- DevSel = (UINT8) (IdeDev->Device << 4);
- DevSel |= 0x40;
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- DevSel
- );
-
- //
- // Wait for DRDY singnal asserting.
- //
- Status = DRDYReady (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Fill feature register if needed
- //
- if (AtaCommand == SET_FEATURES_CMD) {
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, 0x03);
- }
-
- //
- // Fill the sector count register, which is a two-byte FIFO. Need write twice.
- //
- SectorCount8 = (UINT8) (SectorCount >> 8);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount8);
-
- SectorCount8 = (UINT8) SectorCount;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount8);
-
- //
- // Fill the start LBA registers, which are also two-byte FIFO
- //
- LbaLow = (UINT8) RShiftU64 (StartLba, 24);
- LbaMid = (UINT8) RShiftU64 (StartLba, 32);
- LbaHigh = (UINT8) RShiftU64 (StartLba, 40);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, LbaLow);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, LbaMid);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, LbaHigh);
-
- LbaLow = (UINT8) StartLba;
- LbaMid = (UINT8) RShiftU64 (StartLba, 8);
- LbaHigh = (UINT8) RShiftU64 (StartLba, 16);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, LbaLow);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, LbaMid);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, LbaHigh);
-
- //
- // Send command via Command Register, invoking the processing of this command
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, AtaCommand);
-
- Buffer16 = (UINT16 *) Buffer;
-
- //
- // According to PIO Data Out protocol, host can perform a series of writes to
- // the data register after each time device set DRQ ready;
- //
- Increment = 256;
-
- //
- // used to record bytes of currently transfered data
- //
- WordCount = 0;
-
- while (WordCount < ByteCount / 2) {
- //
- // Poll DRQ bit set, data transfer can be performed only when DRQ is ready.
- //
- Status = DRQReady2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = CheckErrorStatus (IdeDev);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Write data into device by one series of writing to data register
- //
- if ((WordCount + Increment) > ByteCount / 2) {
- Increment = ByteCount / 2 - WordCount;
- }
-
- IDEWritePortWMultiple (
- IdeDev->PciIo,
- IdeDev->IoPort->Data,
- Increment,
- Buffer16
- );
-
- WordCount += Increment;
- Buffer16 += Increment;
-
- }
- //
- // while
- //
-
- return CheckErrorStatus (IdeDev);
-}
-
-
-/**
- Enable SMART of the disk if supported
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure,used
- to record all the information of the IDE device.
-
-**/
-VOID
-AtaSMARTSupport (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- EFI_STATUS Status;
- BOOLEAN SMARTSupported;
- UINT8 Device;
- EFI_IDENTIFY_DATA *TmpAtaIdentifyPointer;
- UINT8 DeviceSelect;
- UINT8 LBAMid;
- UINT8 LBAHigh;
-
- //
- // Detect if the device supports S.M.A.R.T.
- //
- if ((IdeDev->pIdData->AtaData.command_set_supported_83 & 0xc000) != 0x4000) {
- //
- // Data in word 82 is not valid (bit15 shall be zero and bit14 shall be to one)
- //
- return ;
- } else {
- if ((IdeDev->pIdData->AtaData.command_set_supported_82 & 0x0001) != 0x0001) {
- //
- // S.M.A.R.T is not supported by the device
- //
- SMARTSupported = FALSE;
- } else {
- SMARTSupported = TRUE;
- }
- }
-
- if (!SMARTSupported) {
- //
- // Report nonsupport status code
- //
- REPORT_STATUS_CODE (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_NOTSUPPORTED)
- );
- } else {
- //
- // Enable this feature
- //
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_ENABLE)
- );
-
- Device = (UINT8) ((IdeDev->Device << 4) | 0xe0);
- Status = AtaNonDataCommandIn (
- IdeDev,
- ATA_SMART_CMD,
- Device,
- ATA_SMART_ENABLE_OPERATION,
- 0,
- 0,
- ATA_CONSTANT_4F,
- ATA_CONSTANT_C2
- );
- //
- // Detect if this feature is enabled
- //
- TmpAtaIdentifyPointer = (EFI_IDENTIFY_DATA *) AllocateZeroPool (sizeof (EFI_IDENTIFY_DATA));
-
- DeviceSelect = (UINT8) ((IdeDev->Device) << 4);
- Status = AtaPioDataIn (
- IdeDev,
- (VOID *) TmpAtaIdentifyPointer,
- sizeof (EFI_IDENTIFY_DATA),
- IDENTIFY_DRIVE_CMD,
- DeviceSelect,
- 0,
- 0,
- 0,
- 0
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (TmpAtaIdentifyPointer);
- return ;
- }
-
- //
- // Check if the feature is enabled
- //
- if ((TmpAtaIdentifyPointer->AtaData.command_set_feature_enb_85 & 0x0001) == 0x0001) {
- //
- // Read status data
- //
- AtaNonDataCommandIn (
- IdeDev,
- ATA_SMART_CMD,
- Device,
- ATA_SMART_RETURN_STATUS,
- 0,
- 0,
- ATA_CONSTANT_4F,
- ATA_CONSTANT_C2
- );
- LBAMid = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb);
- LBAHigh = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb);
-
- if ((LBAMid == 0x4f) && (LBAHigh == 0xc2)) {
- //
- // The threshold exceeded condition is not detected by the device
- //
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_UNDERTHRESHOLD)
- );
-
- } else if ((LBAMid == 0xf4) && (LBAHigh == 0x2c)) {
- //
- // The threshold exceeded condition is detected by the device
- //
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD)
- );
- }
-
- } else {
- //
- // Report disabled status code
- //
- REPORT_STATUS_CODE (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_ATA_BUS_SMART_DISABLED)
- );
- }
-
- gBS->FreePool (TmpAtaIdentifyPointer);
- }
-
- return ;
-}
-
-/**
- Send ATA Ext command into device with NON_DATA protocol
-
- @param IdeDev Standard IDE device private data structure
- @param AtaCommand The ATA command to be sent
- @param Device The value in Device register
- @param Feature The value in Feature register
- @param SectorCount The value in SectorCount register
- @param LbaAddress The LBA address in 48-bit mode
-
- @retval EFI_SUCCESS Reading succeed
- @retval EFI_DEVICE_ERROR Error executing commands on this device
-
-**/
-EFI_STATUS
-AtaCommandIssueExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINT8 AtaCommand,
- IN UINT8 Device,
- IN UINT16 Feature,
- IN UINT16 SectorCount,
- IN EFI_LBA LbaAddress
- )
-{
- EFI_STATUS Status;
- UINT8 SectorCount8;
- UINT8 Feature8;
- UINT8 LbaLow;
- UINT8 LbaMid;
- UINT8 LbaHigh;
-
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Select device (bit4), set LBA mode(bit6) (use 0xe0 for compatibility)
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((IdeDev->Device << 4) | 0xe0)
- );
-
- //
- // ATA commands for ATA device must be issued when DRDY is set
- //
- Status = DRDYReady (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Pass parameter into device register block
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Head, Device);
-
- //
- // Fill the feature register, which is a two-byte FIFO. Need write twice.
- //
- Feature8 = (UINT8) (Feature >> 8);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, Feature8);
-
- Feature8 = (UINT8) Feature;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, Feature8);
-
- //
- // Fill the sector count register, which is a two-byte FIFO. Need write twice.
- //
- SectorCount8 = (UINT8) (SectorCount >> 8);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount8);
-
- SectorCount8 = (UINT8) SectorCount;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount8);
-
- //
- // Fill the start LBA registers, which are also two-byte FIFO
- //
- LbaLow = (UINT8) RShiftU64 (LbaAddress, 24);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, LbaLow);
- LbaLow = (UINT8) LbaAddress;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, LbaLow);
-
- LbaMid = (UINT8) RShiftU64 (LbaAddress, 32);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, LbaMid);
- LbaMid = (UINT8) RShiftU64 (LbaAddress, 8);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, LbaMid);
-
- LbaHigh = (UINT8) RShiftU64 (LbaAddress, 40);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, LbaHigh);
- LbaHigh = (UINT8) RShiftU64 (LbaAddress, 16);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, LbaHigh);
-
- //
- // Work around for Segate 160G disk writing
- //
- gBS->Stall (1800);
-
- //
- // Send command via Command Register
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, AtaCommand);
-
- //
- // Stall at least 400ns
- //
- gBS->Stall (100);
-
- return EFI_SUCCESS;
-}
-
-/**
- Send ATA Ext command into device with NON_DATA protocol
-
- @param IdeDev Standard IDE device private data structure
- @param AtaCommand The ATA command to be sent
- @param Device The value in Device register
- @param Feature The value in Feature register
- @param SectorCount The value in SectorCount register
- @param LbaAddress The LBA address in 48-bit mode
-
- @retval EFI_SUCCESS Reading succeed
- @retval EFI_DEVICE_ERROR Error executing commands on this device
-
-**/
-EFI_STATUS
-AtaCommandIssue (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINT8 AtaCommand,
- IN UINT8 Device,
- IN UINT16 Feature,
- IN UINT16 SectorCount,
- IN EFI_LBA LbaAddress
- )
-{
- EFI_STATUS Status;
- UINT8 SectorCount8;
- UINT8 Feature8;
- UINT8 Lba0;
- UINT8 Lba1;
- UINT8 Lba2;
- UINT8 Lba3;
-
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Select device (bit4), set LBA mode(bit6) (use 0xe0 for compatibility)
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((IdeDev->Device << 4) | 0xe0)
- );
-
- //
- // ATA commands for ATA device must be issued when DRDY is set
- //
- Status = DRDYReady (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Lba0 = (UINT8) LbaAddress;
- Lba1 = (UINT8) RShiftU64 (LbaAddress, 8);
- Lba2 = (UINT8) RShiftU64 (LbaAddress, 16);
- Lba3 = (UINT8) RShiftU64 (LbaAddress, 24);
- Device = (UINT8) (Device | Lba3);
-
- //
- // Pass parameter into device register block
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Head, Device);
-
- //
- // Fill the feature register, which is a two-byte FIFO. Need write twice.
- //
- Feature8 = (UINT8) Feature;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, Feature8);
-
- //
- // Fill the sector count register, which is a two-byte FIFO. Need write twice.
- //
- SectorCount8 = (UINT8) SectorCount;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount8);
-
- //
- // Fill the start LBA registers, which are also two-byte FIFO
- //
-
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, Lba0);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, Lba1);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, Lba2);
-
- //
- // Send command via Command Register
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, AtaCommand);
-
- //
- // Stall at least 400ns
- //
- gBS->Stall (100);
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is called by the AtaBlkIoReadBlocks() to perform
- reading from media in block unit. The function has been enhanced to
- support >120GB access and transfer at most 65536 blocks per command
-
- @param[in] *IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *DataBuffer A pointer to the destination buffer for the data.
-
- @param[in] StartLba The starting logical block address to read from
- on the device media.
-
- @param[in] NumberOfBlocks The number of transfer data blocks.
-
- @return The device status of UDMA operation. If the operation is
- successful, return EFI_SUCCESS.
-
- TODO: EFI_UNSUPPORTED - add return value to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
-**/
-EFI_STATUS
-AtaUdmaReadExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-{
- return DoAtaUdma (IdeDev, DataBuffer, StartLba, NumberOfBlocks, AtaUdmaReadExtOp);
-}
-
-/**
- This function is called by the AtaBlkIoReadBlocks() to perform
- reading from media in block unit. The function has been enhanced to
- support >120GB access and transfer at most 65536 blocks per command
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *DataBuffer A pointer to the destination buffer for the data.
- @param[in] StartLba The starting logical block address to read from
- on the device media.
- @param[in] NumberOfBlocks The number of transfer data blocks.
-
- @return The device status of UDMA operation. If the operation is
- successful, return EFI_SUCCESS.
-
- TODO: EFI_UNSUPPORTED - add return value to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
-**/
-EFI_STATUS
-AtaUdmaRead (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-{
- return DoAtaUdma (IdeDev, DataBuffer, StartLba, NumberOfBlocks, AtaUdmaReadOp);
-}
-
-/**
- This function is called by the AtaBlkIoWriteBlocks() to perform
- writing to media in block unit. The function has been enhanced to
- support >120GB access and transfer at most 65536 blocks per command
-
- @param[in] *IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *DataBuffer A pointer to the source buffer for the data.
-
- @param[in] StartLba The starting logical block address to write to
- on the device media.
-
- @param[in] NumberOfBlocks The number of transfer data blocks.
-
- @return The device status of UDMA operation. If the operation is
- successful, return EFI_SUCCESS.
-
- TODO: EFI_UNSUPPORTED - add return value to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
-**/
-EFI_STATUS
-AtaUdmaWriteExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-{
- return DoAtaUdma (IdeDev, DataBuffer, StartLba, NumberOfBlocks, AtaUdmaWriteExtOp);
-}
-
-/**
- This function is called by the AtaBlkIoWriteBlocks() to perform
- writing to media in block unit. The function has been enhanced to
- support >120GB access and transfer at most 65536 blocks per command
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *DataBuffer
- A pointer to the source buffer for the data.
-
- @param[in] StartLba
- The starting logical block address to write to
- on the device media.
-
- @param[in] NumberOfBlocks
- The number of transfer data blocks.
-
- @return The device status of UDMA operation. If the operation is
- successful, return EFI_SUCCESS.
-
- TODO: EFI_UNSUPPORTED - add return value to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
-**/
-EFI_STATUS
-AtaUdmaWrite (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-{
- return DoAtaUdma (IdeDev, DataBuffer, StartLba, NumberOfBlocks, AtaUdmaWriteOp);
-}
-
-/**
- Perform an ATA Udma operation (Read, ReadExt, Write, WriteExt).
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *DataBuffer
- A pointer to the source buffer for the data.
-
- @param[in] StartLba
- The starting logical block address to write to
- on the device media.
-
- @param[in] NumberOfBlocks
- The number of transfer data blocks.
-
- @param[in] UdmaOp
- The perform operations could be AtaUdmaReadOp, AtaUdmaReadExOp,
- AtaUdmaWriteOp, AtaUdmaWriteExOp
-
- @return The device status of UDMA operation. If the operation is
- successful, return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-DoAtaUdma (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks,
- IN ATA_UDMA_OPERATION UdmaOp
- )
-{
- IDE_DMA_PRD *PrdAddr;
- IDE_DMA_PRD *UsedPrdAddr;
- IDE_DMA_PRD *TempPrdAddr;
- UINT8 RegisterValue;
- UINT8 Device;
- UINT64 IoPortForBmic;
- UINT64 IoPortForBmis;
- UINT64 IoPortForBmid;
- EFI_STATUS Status;
- UINTN PrdTableNum;
- UINTN ByteCount;
- UINTN ByteAvailable;
- UINT8 *PrdBuffer;
- UINTN RemainBlockNum;
- UINT8 DeviceControl;
- UINT32 Count;
- UINTN PageCount;
- VOID *Map;
- VOID *MemPage;
- EFI_PHYSICAL_ADDRESS DeviceAddress;
- UINTN MaxDmaCommandSectors;
- EFI_PCI_IO_PROTOCOL_OPERATION PciIoProtocolOp;
- UINT8 AtaCommand;
-
- switch (UdmaOp) {
- case AtaUdmaReadOp:
- MaxDmaCommandSectors = MAX_DMA_COMMAND_SECTORS;
- PciIoProtocolOp = EfiPciIoOperationBusMasterWrite;
- AtaCommand = READ_DMA_CMD;
- break;
- case AtaUdmaReadExtOp:
- MaxDmaCommandSectors = MAX_DMA_EXT_COMMAND_SECTORS;
- PciIoProtocolOp = EfiPciIoOperationBusMasterWrite;
- AtaCommand = READ_DMA_EXT_CMD;
- break;
- case AtaUdmaWriteOp:
- MaxDmaCommandSectors = MAX_DMA_COMMAND_SECTORS;
- PciIoProtocolOp = EfiPciIoOperationBusMasterRead;
- AtaCommand = WRITE_DMA_CMD;
- break;
- case AtaUdmaWriteExtOp:
- MaxDmaCommandSectors = MAX_DMA_EXT_COMMAND_SECTORS;
- PciIoProtocolOp = EfiPciIoOperationBusMasterRead;
- AtaCommand = WRITE_DMA_EXT_CMD;
- break;
- default:
- return EFI_UNSUPPORTED;
- break;
- }
-
- //
- // Channel and device differential
- //
- Device = (UINT8) ((IdeDev->Device << 4) | 0xe0);
-
- //
- // Enable interrupt to support UDMA and Select device
- //
- DeviceControl = 0;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Alt.DeviceControl, DeviceControl);
-
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Head, Device);
-
- if (IdePrimary == IdeDev->Channel) {
- IoPortForBmic = IdeDev->IoPort->BusMasterBaseAddr + BMICP_OFFSET;
- IoPortForBmis = IdeDev->IoPort->BusMasterBaseAddr + BMISP_OFFSET;
- IoPortForBmid = IdeDev->IoPort->BusMasterBaseAddr + BMIDP_OFFSET;
- } else {
- if (IdeSecondary == IdeDev->Channel) {
- IoPortForBmic = IdeDev->IoPort->BusMasterBaseAddr + BMICS_OFFSET;
- IoPortForBmis = IdeDev->IoPort->BusMasterBaseAddr + BMISS_OFFSET;
- IoPortForBmid = IdeDev->IoPort->BusMasterBaseAddr + BMIDS_OFFSET;
- } else {
- return EFI_UNSUPPORTED;
- }
- }
-
- RemainBlockNum = NumberOfBlocks;
- while (RemainBlockNum > 0) {
-
- if (RemainBlockNum >= MaxDmaCommandSectors) {
- //
- // SectorCount is used to record the number of sectors to be read
- // Max 65536 sectors can be transfered at a time.
- //
- NumberOfBlocks = MaxDmaCommandSectors;
- RemainBlockNum -= MaxDmaCommandSectors;
- } else {
- NumberOfBlocks = (UINT16) RemainBlockNum;
- RemainBlockNum = 0;
- }
-
- //
- // Calculate the number of PRD table to make sure the memory region
- // not cross 64K boundary
- //
- ByteCount = NumberOfBlocks * IdeDev->BlkIo.Media->BlockSize;
- PrdTableNum = ((ByteCount >> 16) + 1) + 1;
-
- //
- // Build PRD table
- //
- PageCount = EFI_SIZE_TO_PAGES (2 * PrdTableNum * sizeof (IDE_DMA_PRD));
- Status = IdeDev->PciIo->AllocateBuffer (
- IdeDev->PciIo,
- AllocateAnyPages,
- EfiBootServicesData,
- PageCount,
- &MemPage,
- 0
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
- ZeroMem ((VOID *) ((UINTN) MemPage), EFI_PAGES_TO_SIZE (PageCount));
-
- PrdAddr = (IDE_DMA_PRD *) ((UINTN) MemPage);
- //
- // To make sure PRD is allocated in one 64K page
- //
- if (((UINTN) PrdAddr & 0x0FFFF) > (((UINTN) PrdAddr + PrdTableNum * sizeof (IDE_DMA_PRD) - 1) & 0x0FFFF)) {
- UsedPrdAddr = (IDE_DMA_PRD *) ((UINTN) ((UINT8 *) PrdAddr + 0x10000) & 0xFFFF0000);
- } else {
- if ((UINTN) PrdAddr & 0x03) {
- UsedPrdAddr = (IDE_DMA_PRD *) ((UINTN) ((UINT8 *) PrdAddr + 0x04) & 0xFFFFFFFC);
- } else {
- UsedPrdAddr = PrdAddr;
- }
- }
-
- //
- // Build the PRD table
- //
- Status = IdeDev->PciIo->Map (
- IdeDev->PciIo,
- PciIoProtocolOp,
- DataBuffer,
- &ByteCount,
- &DeviceAddress,
- &Map
- );
- if (EFI_ERROR (Status)) {
- IdeDev->PciIo->FreeBuffer (IdeDev->PciIo, PageCount, MemPage);
- return EFI_OUT_OF_RESOURCES;
- }
- PrdBuffer = (VOID *) ((UINTN) DeviceAddress);
- TempPrdAddr = UsedPrdAddr;
- while (TRUE) {
-
- ByteAvailable = 0x10000 - ((UINTN) PrdBuffer & 0xFFFF);
-
- if (ByteCount <= ByteAvailable) {
- TempPrdAddr->RegionBaseAddr = (UINT32) ((UINTN) PrdBuffer);
- TempPrdAddr->ByteCount = (UINT16) ByteCount;
- TempPrdAddr->EndOfTable = 0x8000;
- break;
- }
-
- TempPrdAddr->RegionBaseAddr = (UINT32) ((UINTN) PrdBuffer);
- TempPrdAddr->ByteCount = (UINT16) ByteAvailable;
-
- ByteCount -= ByteAvailable;
- PrdBuffer += ByteAvailable;
- TempPrdAddr++;
- }
-
- //
- // Set the base address to BMID register
- //
- IdeDev->PciIo->Io.Write (
- IdeDev->PciIo,
- EfiPciIoWidthUint32,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmid,
- 1,
- &UsedPrdAddr
- );
-
- //
- // Set BMIC register to identify the operation direction
- //
- IdeDev->PciIo->Io.Read (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmic,
- 1,
- &RegisterValue
- );
-
- if (UdmaOp == AtaUdmaReadExtOp || UdmaOp == AtaUdmaReadOp) {
- RegisterValue |= BMIC_nREAD;
- } else {
- RegisterValue &= ~((UINT8) BMIC_nREAD);
- }
-
- IdeDev->PciIo->Io.Write (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmic,
- 1,
- &RegisterValue
- );
-
- //
- // Read BMIS register and clear ERROR and INTR bit
- //
- IdeDev->PciIo->Io.Read (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmis,
- 1,
- &RegisterValue
- );
-
- RegisterValue |= (BMIS_INTERRUPT | BMIS_ERROR);
-
- IdeDev->PciIo->Io.Write (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmis,
- 1,
- &RegisterValue
- );
-
- if (UdmaOp == AtaUdmaWriteExtOp || UdmaOp == AtaUdmaReadExtOp) {
- Status = AtaCommandIssueExt (
- IdeDev,
- AtaCommand,
- Device,
- 0,
- (UINT16) NumberOfBlocks,
- StartLba
- );
- } else {
- Status = AtaCommandIssue (
- IdeDev,
- AtaCommand,
- Device,
- 0,
- (UINT16) NumberOfBlocks,
- StartLba
- );
- }
-
- if (EFI_ERROR (Status)) {
- IdeDev->PciIo->FreeBuffer (IdeDev->PciIo, PageCount, MemPage);
- IdeDev->PciIo->Unmap (IdeDev->PciIo, Map);
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Set START bit of BMIC register
- //
- IdeDev->PciIo->Io.Read (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmic,
- 1,
- &RegisterValue
- );
-
- RegisterValue |= BMIC_START;
-
- IdeDev->PciIo->Io.Write (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmic,
- 1,
- &RegisterValue
- );
-
- //
- // Check the INTERRUPT and ERROR bit of BMIS
- // Max transfer number of sectors for one command is 65536(32Mbyte),
- // it will cost 1 second to transfer these data in UDMA mode 2(33.3MBps).
- // So set the variable Count to 2000, for about 2 second timeout time.
- //
- Count = 2000;
- while (TRUE) {
-
- IdeDev->PciIo->Io.Read (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmis,
- 1,
- &RegisterValue
- );
- if ((RegisterValue & (BMIS_INTERRUPT | BMIS_ERROR)) || (Count == 0)) {
- if ((RegisterValue & BMIS_ERROR) || (Count == 0)) {
- //
- // Clear START bit of BMIC register before return EFI_DEVICE_ERROR
- //
- IdeDev->PciIo->Io.Read (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmic,
- 1,
- &RegisterValue
- );
-
- RegisterValue &= ~((UINT8)BMIC_START);
-
- IdeDev->PciIo->Io.Write (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmic,
- 1,
- &RegisterValue
- );
- IdeDev->PciIo->FreeBuffer (IdeDev->PciIo, PageCount, MemPage);
- IdeDev->PciIo->Unmap (IdeDev->PciIo, Map);
- return EFI_DEVICE_ERROR;
- }
- break;
- }
-
- gBS->Stall (1000);
- Count --;
- }
-
- IdeDev->PciIo->FreeBuffer (IdeDev->PciIo, PageCount, MemPage);
- IdeDev->PciIo->Unmap (IdeDev->PciIo, Map);
- //
- // Read Status Register of IDE device to clear interrupt
- //
- RegisterValue = IDEReadPortB(IdeDev->PciIo,IdeDev->IoPort->Reg.Status);
- //
- // Clear START bit of BMIC register
- //
- IdeDev->PciIo->Io.Read (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmic,
- 1,
- &RegisterValue
- );
-
- RegisterValue &= ~((UINT8) BMIC_START);
-
- IdeDev->PciIo->Io.Write (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmic,
- 1,
- &RegisterValue
- );
-
- if (RegisterValue & BMIS_ERROR) {
- return EFI_DEVICE_ERROR;
- }
-
- DataBuffer = (UINT8 *) DataBuffer + NumberOfBlocks * IdeDev->BlkIo.Media->BlockSize;
- StartLba += NumberOfBlocks;
- }
-
- //
- // Disable interrupt of Select device
- //
- IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Alt.DeviceControl);
- DeviceControl |= IEN_L;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Alt.DeviceControl, DeviceControl);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/atapi.c b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/atapi.c
deleted file mode 100644
index 27f7f99..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/atapi.c
+++ /dev/null
@@ -1,2140 +0,0 @@
-/** @file
- Copyright (c) 2006 - 2007, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "idebus.h"
-
-/**
- This function is used to get the current status of the media residing
- in the LS-120 drive or ZIP drive. The media status is returned in the
- Error Status.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @retval EFI_SUCCESS
- The media status is achieved successfully and the media
- can be read/written.
-
- @retval EFI_DEVICE_ERROR
- Get Media Status Command is failed.
-
- @retval EFI_NO_MEDIA
- There is no media in the drive.
-
- @retval EFI_WRITE_PROTECTED
- The media is writing protected.
-
- @note
- This function must be called after the LS120EnableMediaStatus()
- with second parameter set to TRUE
- (means enable media status notification) is called.
-
-**/
-STATIC
-EFI_STATUS
-LS120GetMediaStatus (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- UINT8 DeviceSelect;
- UINT8 StatusValue;
- EFI_STATUS EfiStatus;
- //
- // Poll Alternate Register for BSY clear within timeout.
- //
- EfiStatus = WaitForBSYClear2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (EfiStatus)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Select device via Device/Head Register.
- //
- DeviceSelect = (UINT8) ((IdeDev->Device) << 4 | 0xe0);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Head, DeviceSelect);
-
- //
- // Poll Alternate Register for DRDY set within timeout.
- // After device is selected, DRDY set indicates the device is ready to
- // accept command.
- //
- EfiStatus = DRDYReady2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (EfiStatus)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Get Media Status Command is sent
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, 0xDA);
-
- //
- // BSY bit will clear after command is complete.
- //
- EfiStatus = WaitForBSYClear2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (EfiStatus)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // the media status is returned by the command in the ERROR register
- //
- StatusValue = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);
-
- if (StatusValue & bit1) {
- return EFI_NO_MEDIA;
- }
-
- if (StatusValue & bit6) {
- return EFI_WRITE_PROTECTED;
- } else {
- return EFI_SUCCESS;
- }
-}
-
-/**
- This function is used to send Enable Media Status Notification Command
- or Disable Media Status Notification Command.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] Enable
- a flag that indicates whether enable or disable media
- status notification.
-
- @retval EFI_SUCCESS
- If command completes successfully.
-
- @retval EFI_DEVICE_ERROR
- If command failed.
-
-**/
-STATIC
-EFI_STATUS
-LS120EnableMediaStatus (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN BOOLEAN Enable
- )
-{
- UINT8 DeviceSelect;
- EFI_STATUS Status;
-
- //
- // Poll Alternate Register for BSY clear within timeout.
- //
- Status = WaitForBSYClear2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Select device via Device/Head Register.
- //
- DeviceSelect = (UINT8) ((IdeDev->Device) << 4 | 0xe0);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Head, DeviceSelect);
-
- //
- // Poll Alternate Register for DRDY set within timeout.
- // After device is selected, DRDY set indicates the device is ready to
- // accept command.
- //
- Status = DRDYReady2 (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- if (Enable) {
- //
- // 0x95: Enable media status notification
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, 0x95);
- } else {
- //
- // 0x31: Disable media status notification
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, 0x31);
- }
- //
- // Set Feature Command is sent
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, 0xEF);
-
- //
- // BSY bit will clear after command is complete.
- //
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is called by DiscoverIdeDevice() during its device
- identification.
-
- Its main purpose is to get enough information for the device media
- to fill in the Media data structure of the Block I/O Protocol interface.
-
- There are 5 steps to reach such objective:
-
- 1. Sends out the ATAPI Identify Command to the specified device.
- Only ATAPI device responses to this command. If the command succeeds,
- it returns the Identify data structure which filled with information
- about the device. Since the ATAPI device contains removable media,
- the only meaningful information is the device module name.
-
- 2. Sends out ATAPI Inquiry Packet Command to the specified device.
- This command will return inquiry data of the device, which contains
- the device type information.
-
- 3. Allocate sense data space for future use. We don't detect the media
- presence here to improvement boot performance, especially when CD
- media is present. The media detection will be performed just before
- each BLK_IO read/write
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @retval EFI_SUCCESS
- Identify ATAPI device successfully.
-
- @retval EFI_DEVICE_ERROR
- ATAPI Identify Device Command failed or device type
- is not supported by this IDE driver.
-
- @note
- Parameter "IdeDev" will be updated in this function.
-
- TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
- TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-**/
-EFI_STATUS
-ATAPIIdentify (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- EFI_IDENTIFY_DATA *AtapiIdentifyPointer;
- UINT8 DeviceSelect;
- EFI_STATUS Status;
-
- //
- // device select bit
- //
- DeviceSelect = (UINT8) ((IdeDev->Device) << 4);
-
- AtapiIdentifyPointer = AllocatePool (sizeof (EFI_IDENTIFY_DATA));
- if (AtapiIdentifyPointer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Send ATAPI Identify Command to get IDENTIFY data.
- //
- Status = AtaPioDataIn (
- IdeDev,
- (VOID *) AtapiIdentifyPointer,
- sizeof (EFI_IDENTIFY_DATA),
- ATAPI_IDENTIFY_DEVICE_CMD,
- DeviceSelect,
- 0,
- 0,
- 0,
- 0
- );
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (AtapiIdentifyPointer);
- return EFI_DEVICE_ERROR;
- }
-
- IdeDev->pIdData = AtapiIdentifyPointer;
- PrintAtaModuleName (IdeDev);
-
- //
- // Send ATAPI Inquiry Packet Command to get INQUIRY data.
- //
- Status = AtapiInquiry (IdeDev);
- if (EFI_ERROR (Status)) {
- gBS->FreePool (IdeDev->pIdData);
- //
- // Make sure the pIdData will not be freed again.
- //
- IdeDev->pIdData = NULL;
- return EFI_DEVICE_ERROR;
- }
- //
- // Get media removable info from INQUIRY data.
- //
- IdeDev->BlkIo.Media->RemovableMedia = (UINT8) ((IdeDev->pInquiryData->RMB & 0x80) == 0x80);
-
- //
- // Identify device type via INQUIRY data.
- //
- switch (IdeDev->pInquiryData->peripheral_type & 0x1f) {
-
- //
- // Magnetic Disk
- //
- case 0x00:
-
- //
- // device is LS120 or ZIP drive.
- //
- IdeDev->Type = IdeMagnetic;
-
- IdeDev->BlkIo.Media->MediaId = 0;
- //
- // Give initial value
- //
- IdeDev->BlkIo.Media->MediaPresent = FALSE;
-
- IdeDev->BlkIo.Media->LastBlock = 0;
- IdeDev->BlkIo.Media->BlockSize = 0x200;
- break;
-
- //
- // CD-ROM
- //
- case 0x05:
-
- IdeDev->Type = IdeCdRom;
- IdeDev->BlkIo.Media->MediaId = 0;
- //
- // Give initial value
- //
- IdeDev->BlkIo.Media->MediaPresent = FALSE;
-
- IdeDev->BlkIo.Media->LastBlock = 0;
- IdeDev->BlkIo.Media->BlockSize = 0x800;
- IdeDev->BlkIo.Media->ReadOnly = TRUE;
- break;
-
- //
- // Tape
- //
- case 0x01:
-
- //
- // WORM
- //
- case 0x04:
-
- //
- // Optical
- //
- case 0x07:
-
- default:
- IdeDev->Type = IdeUnknown;
- gBS->FreePool (IdeDev->pIdData);
- gBS->FreePool (IdeDev->pInquiryData);
- //
- // Make sure the pIdData and pInquiryData will not be freed again.
- //
- IdeDev->pIdData = NULL;
- IdeDev->pInquiryData = NULL;
- return EFI_DEVICE_ERROR;
- }
-
- //
- // original sense data numbers
- //
- IdeDev->SenseDataNumber = 20;
-
- IdeDev->SenseData = AllocatePool (IdeDev->SenseDataNumber * sizeof (REQUEST_SENSE_DATA));
- if (IdeDev->SenseData == NULL) {
- gBS->FreePool (IdeDev->pIdData);
- gBS->FreePool (IdeDev->pInquiryData);
- //
- // Make sure the pIdData and pInquiryData will not be freed again.
- //
- IdeDev->pIdData = NULL;
- IdeDev->pInquiryData = NULL;
- return EFI_OUT_OF_RESOURCES;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Sends out ATAPI Inquiry Packet Command to the specified device.
- This command will return INQUIRY data of the device.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @retval EFI_SUCCESS
- Inquiry command completes successfully.
-
- @retval EFI_DEVICE_ERROR
- Inquiry command failed.
-
- @note
- Parameter "IdeDev" will be updated in this function.
-
-**/
-EFI_STATUS
-AtapiInquiry (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- ATAPI_PACKET_COMMAND Packet;
- EFI_STATUS Status;
- INQUIRY_DATA *InquiryData;
-
- //
- // prepare command packet for the ATAPI Inquiry Packet Command.
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.Inquiry.opcode = INQUIRY;
- Packet.Inquiry.page_code = 0;
- Packet.Inquiry.allocation_length = sizeof (INQUIRY_DATA);
-
- InquiryData = AllocatePool (sizeof (INQUIRY_DATA));
- if (InquiryData == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Send command packet and get requested Inquiry data.
- //
- Status = AtapiPacketCommandIn (
- IdeDev,
- &Packet,
- (UINT16 *) InquiryData,
- sizeof (INQUIRY_DATA),
- ATAPITIMEOUT
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (InquiryData);
- return EFI_DEVICE_ERROR;
- }
-
- IdeDev->pInquiryData = InquiryData;
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is used to send out ATAPI commands conforms to the
- Packet Command with PIO Data In Protocol.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *Packet
- pointer pointing to ATAPI_PACKET_COMMAND data structure
- which contains the contents of the command.
-
- @param[in] *Buffer
- buffer contained data transferred from device to host.
-
- @param[in] ByteCount
- data size in byte unit of the buffer.
-
- @param[in] TimeOut
- this parameter is used to specify the timeout
- value for the PioReadWriteData() function.
-
- @retval EFI_SUCCESS
- send out the ATAPI packet command successfully
- and device sends data successfully.
-
- @retval EFI_DEVICE_ERROR
- the device failed to send data.
-
-**/
-EFI_STATUS
-AtapiPacketCommandIn (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN ATAPI_PACKET_COMMAND *Packet,
- IN UINT16 *Buffer,
- IN UINT32 ByteCount,
- IN UINTN TimeOut
- )
-{
- UINT16 *CommandIndex;
- EFI_STATUS Status;
- UINT32 Count;
-
- //
- // Set all the command parameters by fill related registers.
- // Before write to all the following registers, BSY and DRQ must be 0.
- //
- Status = DRQClear2 (IdeDev, ATAPITIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Select device via Device/Head Register.
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((IdeDev->Device << 4) | DEFAULT_CMD) // DEFAULT_CMD: 0xa0 (1010,0000)
- );
-
- //
- // No OVL; No DMA
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, 0x00);
-
- //
- // set the transfersize to MAX_ATAPI_BYTE_COUNT to let the device
- // determine how many data should be transferred.
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->CylinderLsb,
- (UINT8) (MAX_ATAPI_BYTE_COUNT & 0x00ff)
- );
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->CylinderMsb,
- (UINT8) (MAX_ATAPI_BYTE_COUNT >> 8)
- );
-
- //
- // DEFAULT_CTL:0x0a (0000,1010)
- // Disable interrupt
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Alt.DeviceControl, DEFAULT_CTL);
-
- //
- // Send Packet command to inform device
- // that the following data bytes are command packet.
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, PACKET_CMD);
-
- Status = DRQReady (IdeDev, ATAPITIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Send out command packet
- //
- CommandIndex = Packet->Data16;
- for (Count = 0; Count < 6; Count++, CommandIndex++) {
-
- IDEWritePortW (IdeDev->PciIo, IdeDev->IoPort->Data, *CommandIndex);
- gBS->Stall (10);
- }
-
- //
- // call PioReadWriteData() function to get
- // requested transfer data form device.
- //
- return PioReadWriteData (IdeDev, Buffer, ByteCount, 1, TimeOut);
-}
-
-/**
- This function is used to send out ATAPI commands conforms to the
- Packet Command with PIO Data Out Protocol.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *Packet
- pointer pointing to ATAPI_PACKET_COMMAND data structure
- which contains the contents of the command.
-
- @param[in] *Buffer
- buffer contained data transferred from host to device.
-
- @param[in] ByteCount
- data size in byte unit of the buffer.
-
- @param[in] TimeOut
- this parameter is used to specify the timeout
- value for the PioReadWriteData() function.
-
- @retval EFI_SUCCESS
- send out the ATAPI packet command successfully
- and device received data successfully.
-
- @retval EFI_DEVICE_ERROR
- the device failed to send data.
-
-**/
-EFI_STATUS
-AtapiPacketCommandOut (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN ATAPI_PACKET_COMMAND *Packet,
- IN UINT16 *Buffer,
- IN UINT32 ByteCount,
- IN UINTN TimeOut
- )
-{
- UINT16 *CommandIndex;
- EFI_STATUS Status;
- UINT32 Count;
-
- //
- // set all the command parameters
- // Before write to all the following registers, BSY and DRQ must be 0.
- //
- Status = DRQClear2 (IdeDev, ATAPITIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Select device via Device/Head Register.
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((IdeDev->Device << 4) | DEFAULT_CMD) // DEFAULT_CMD: 0xa0 (1010,0000)
- );
-
- //
- // No OVL; No DMA
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, 0x00);
-
- //
- // set the transfersize to MAX_ATAPI_BYTE_COUNT to
- // let the device determine how many data should be transferred.
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->CylinderLsb,
- (UINT8) (MAX_ATAPI_BYTE_COUNT & 0x00ff)
- );
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->CylinderMsb,
- (UINT8) (MAX_ATAPI_BYTE_COUNT >> 8)
- );
-
- //
- // DEFAULT_CTL:0x0a (0000,1010)
- // Disable interrupt
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Alt.DeviceControl, DEFAULT_CTL);
-
- //
- // Send Packet command to inform device
- // that the following data bytes are command packet.
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, PACKET_CMD);
-
- Status = DRQReady2 (IdeDev, ATAPITIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Send out command packet
- //
- CommandIndex = Packet->Data16;
- for (Count = 0; Count < 6; Count++, CommandIndex++) {
- IDEWritePortW (IdeDev->PciIo, IdeDev->IoPort->Data, *CommandIndex);
- gBS->Stall (10);
- }
-
- //
- // call PioReadWriteData() function to send requested transfer data to device.
- //
- return PioReadWriteData (IdeDev, Buffer, ByteCount, 0, TimeOut);
-}
-
-/**
- This function is called by either AtapiPacketCommandIn() or
- AtapiPacketCommandOut(). It is used to transfer data between
- host and device. The data direction is specified by the fourth
- parameter.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *Buffer
- buffer contained data transferred between host and device.
-
- @param[in] ByteCount
- data size in byte unit of the buffer.
-
- @param[in] Read
- flag used to determine the data transfer direction.
- Read equals 1, means data transferred from device to host;
- Read equals 0, means data transferred from host to device.
-
- @param[in] TimeOut
- timeout value for wait DRQ ready before each data
- stream's transfer.
-
- @retval EFI_SUCCESS
- data is transferred successfully.
-
- @retval EFI_DEVICE_ERROR
- the device failed to transfer data.
-
-**/
-EFI_STATUS
-PioReadWriteData (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINT16 *Buffer,
- IN UINT32 ByteCount,
- IN BOOLEAN Read,
- IN UINTN TimeOut
- )
-{
- //
- // required transfer data in word unit.
- //
- UINT32 RequiredWordCount;
-
- //
- // actual transfer data in word unit.
- //
- UINT32 ActualWordCount;
- UINT32 WordCount;
- EFI_STATUS Status;
- UINT16 *PtrBuffer;
-
- //
- // No data transfer is premitted.
- //
- if (ByteCount == 0) {
- return EFI_SUCCESS;
- }
- //
- // for performance, we assert the ByteCount is an even number
- // which is actually a resonable assumption
- ASSERT((ByteCount%2) == 0);
-
- PtrBuffer = Buffer;
- RequiredWordCount = ByteCount / 2;
- //
- // ActuralWordCount means the word count of data really transferred.
- //
- ActualWordCount = 0;
-
- while (ActualWordCount < RequiredWordCount) {
-
- //
- // before each data transfer stream, the host should poll DRQ bit ready,
- // to see whether indicates device is ready to transfer data.
- //
- Status = DRQReady2 (IdeDev, TimeOut);
- if (EFI_ERROR (Status)) {
- return CheckErrorStatus (IdeDev);
- }
-
- //
- // read Status Register will clear interrupt
- //
- IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);
-
- //
- // get current data transfer size from Cylinder Registers.
- //
- WordCount = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb) << 8;
- WordCount = WordCount | IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb);
- WordCount = WordCount & 0xffff;
- WordCount /= 2;
-
- WordCount = EFI_MIN (WordCount, (RequiredWordCount - ActualWordCount));
-
- if (Read) {
- IDEReadPortWMultiple (
- IdeDev->PciIo,
- IdeDev->IoPort->Data,
- WordCount,
- PtrBuffer
- );
- } else {
- IDEWritePortWMultiple (
- IdeDev->PciIo,
- IdeDev->IoPort->Data,
- WordCount,
- PtrBuffer
- );
- }
-
- PtrBuffer += WordCount;
- ActualWordCount += WordCount;
- }
-
- if (Read) {
- //
- // In the case where the drive wants to send more data than we need to read,
- // the DRQ bit will be set and cause delays from DRQClear2().
- // We need to read data from the drive until it clears DRQ so we can move on.
- //
- AtapiReadPendingData (IdeDev);
- }
-
- //
- // After data transfer is completed, normally, DRQ bit should clear.
- //
- Status = DRQClear2 (IdeDev, ATAPITIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // read status register to check whether error happens.
- //
- return CheckErrorStatus (IdeDev);
-}
-
-/**
- Sends out ATAPI Test Unit Ready Packet Command to the specified device
- to find out whether device is accessible.
-
- @param[in] *IdeDev Pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
- @param[in] *SenseCount Sense count for this packet command
-
- @retval EFI_SUCCESS Device is accessible.
- @retval EFI_DEVICE_ERROR Device is not accessible.
-
-**/
-EFI_STATUS
-AtapiTestUnitReady (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT UINTN *SenseCount
- )
-{
- ATAPI_PACKET_COMMAND Packet;
- EFI_STATUS Status;
-
- *SenseCount = 0;
-
- //
- // fill command packet
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.TestUnitReady.opcode = TEST_UNIT_READY;
-
- //
- // send command packet
- //
- Status = AtapiPacketCommandIn (IdeDev, &Packet, NULL, 0, ATAPITIMEOUT);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = AtapiRequestSense (IdeDev, SenseCount);
- if (EFI_ERROR (Status)) {
- *SenseCount = 0;
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Sends out ATAPI Request Sense Packet Command to the specified device.
- This command will return all the current Sense data in the device.
- This function will pack all the Sense data in one single buffer.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[out] **SenseBuffers
- allocated in this function, and freed by the calling function.
- This buffer is used to accommodate all the sense data returned
- by the device.
-
- @param[out] *BufUnit
- record the unit size of the sense data block in the SenseBuffers,
-
- @param[out] *BufNumbers
- record the number of units in the SenseBuffers.
-
- @retval EFI_SUCCESS
- Request Sense command completes successfully.
-
- @retval EFI_DEVICE_ERROR
- Request Sense command failed.
-
-**/
-EFI_STATUS
-AtapiRequestSense (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT UINTN *SenseCounts
- )
-{
- EFI_STATUS Status;
- REQUEST_SENSE_DATA *Sense;
- UINT16 *Ptr;
- BOOLEAN FetchSenseData;
- ATAPI_PACKET_COMMAND Packet;
-
- *SenseCounts = 0;
-
- ZeroMem (IdeDev->SenseData, sizeof (REQUEST_SENSE_DATA) * (IdeDev->SenseDataNumber));
- //
- // fill command packet for Request Sense Packet Command
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.RequestSence.opcode = REQUEST_SENSE;
- Packet.RequestSence.allocation_length = sizeof (REQUEST_SENSE_DATA);
-
- //
- // initialize pointer
- //
- Ptr = (UINT16 *) IdeDev->SenseData;
- //
- // request sense data from device continuously until no sense data
- // exists in the device.
- //
- for (FetchSenseData = TRUE; FetchSenseData;) {
-
- Sense = (REQUEST_SENSE_DATA *) Ptr;
-
- //
- // send out Request Sense Packet Command and get one Sense data form device
- //
- Status = AtapiPacketCommandIn (
- IdeDev,
- &Packet,
- Ptr,
- sizeof (REQUEST_SENSE_DATA),
- ATAPITIMEOUT
- );
- //
- // failed to get Sense data
- //
- if (EFI_ERROR (Status)) {
- if (*SenseCounts == 0) {
- return EFI_DEVICE_ERROR;
- } else {
- return EFI_SUCCESS;
- }
- }
-
- (*SenseCounts)++;
- //
- // We limit MAX sense data count to 20 in order to avoid dead loop. Some
- // incompatible ATAPI devices don't retrive NO_SENSE when there is no media.
- // In this case, dead loop occurs if we don't have a gatekeeper. 20 is
- // supposed to be large enough for any ATAPI device.
- //
- if ((Sense->sense_key != SK_NO_SENSE) && ((*SenseCounts) < 20)) {
- //
- // Ptr is word-based pointer
- //
- Ptr += (sizeof (REQUEST_SENSE_DATA) + 1) >> 1;
-
- } else {
- //
- // when no sense key, skip out the loop
- //
- FetchSenseData = FALSE;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Sends out ATAPI Read Capacity Packet Command to the specified device.
- This command will return the information regarding the capacity of the
- media in the device.
-
- Current device status will impact device's response to the Read Capacity
- Command. For example, if the device once reset, the Read Capacity
- Command will fail. The Sense data record the current device status, so
- if the Read Capacity Command failed, the Sense data must be requested
- and be analyzed to determine if the Read Capacity Command should retry.
-
- @param[in] *IdeDev Pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
- @param[in] SenseCount Sense count for this packet command
-
- @retval EFI_SUCCESS Read Capacity Command finally completes successfully.
- @retval EFI_DEVICE_ERROR Read Capacity Command failed because of device error.
-
- @note Parameter "IdeDev" will be updated in this function.
-
- TODO: EFI_NOT_READY - add return value to function comment
-**/
-EFI_STATUS
-AtapiReadCapacity (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT UINTN *SenseCount
- )
-{
- //
- // status returned by Read Capacity Packet Command
- //
- EFI_STATUS Status;
- EFI_STATUS SenseStatus;
- ATAPI_PACKET_COMMAND Packet;
-
- //
- // used for capacity data returned from ATAPI device
- //
- READ_CAPACITY_DATA Data;
- READ_FORMAT_CAPACITY_DATA FormatData;
-
- *SenseCount = 0;
-
- ZeroMem (&Data, sizeof (Data));
- ZeroMem (&FormatData, sizeof (FormatData));
-
- if (IdeDev->Type == IdeCdRom) {
-
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.Inquiry.opcode = READ_CAPACITY;
- Status = AtapiPacketCommandIn (
- IdeDev,
- &Packet,
- (UINT16 *) &Data,
- sizeof (READ_CAPACITY_DATA),
- ATAPITIMEOUT
- );
-
- } else {
- //
- // Type == IdeMagnetic
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.ReadFormatCapacity.opcode = READ_FORMAT_CAPACITY;
- Packet.ReadFormatCapacity.allocation_length_lo = 12;
- Status = AtapiPacketCommandIn (
- IdeDev,
- &Packet,
- (UINT16 *) &FormatData,
- sizeof (READ_FORMAT_CAPACITY_DATA),
- ATAPITIMEOUT
- );
- }
-
- if (Status == EFI_TIMEOUT) {
- *SenseCount = 0;
- return Status;
- }
-
- SenseStatus = AtapiRequestSense (IdeDev, SenseCount);
-
- if (!EFI_ERROR (SenseStatus)) {
-
- if (!EFI_ERROR (Status)) {
-
- if (IdeDev->Type == IdeCdRom) {
-
- IdeDev->BlkIo.Media->LastBlock = (Data.LastLba3 << 24) |
- (Data.LastLba2 << 16) |
- (Data.LastLba1 << 8) |
- Data.LastLba0;
-
- if (IdeDev->BlkIo.Media->LastBlock != 0) {
-
- IdeDev->BlkIo.Media->BlockSize = (Data.BlockSize3 << 24) |
- (Data.BlockSize2 << 16) |
- (Data.BlockSize1 << 8) |
- Data.BlockSize0;
-
- IdeDev->BlkIo.Media->MediaPresent = TRUE;
- } else {
- IdeDev->BlkIo.Media->MediaPresent = FALSE;
- return EFI_DEVICE_ERROR;
- }
-
- IdeDev->BlkIo.Media->ReadOnly = TRUE;
-
- //
- // Because the user data portion in the sector of the Data CD supported
- // is always 0x800
- //
- IdeDev->BlkIo.Media->BlockSize = 0x800;
- }
-
- if (IdeDev->Type == IdeMagnetic) {
-
- if (FormatData.DesCode == 3) {
- IdeDev->BlkIo.Media->MediaPresent = FALSE;
- IdeDev->BlkIo.Media->LastBlock = 0;
- } else {
-
- IdeDev->BlkIo.Media->LastBlock = (FormatData.LastLba3 << 24) |
- (FormatData.LastLba2 << 16) |
- (FormatData.LastLba1 << 8) |
- FormatData.LastLba0;
- if (IdeDev->BlkIo.Media->LastBlock != 0) {
- IdeDev->BlkIo.Media->LastBlock--;
-
- IdeDev->BlkIo.Media->BlockSize = (FormatData.BlockSize2 << 16) |
- (FormatData.BlockSize1 << 8) |
- FormatData.BlockSize0;
-
- IdeDev->BlkIo.Media->MediaPresent = TRUE;
- } else {
- IdeDev->BlkIo.Media->MediaPresent = FALSE;
- //
- // Return EFI_NOT_READY operation succeeds but returned capacity is 0
- //
- return EFI_NOT_READY;
- }
-
- IdeDev->BlkIo.Media->BlockSize = 0x200;
-
- }
- }
- }
-
- return EFI_SUCCESS;
-
- } else {
- *SenseCount = 0;
- return EFI_DEVICE_ERROR;
- }
-}
-
-/**
- Used before read/write blocks from/to ATAPI device media.
- Since ATAPI device media is removable, it is necessary to detect
- whether media is present and get current present media's
- information, and if media has been changed, Block I/O Protocol
- need to be reinstalled.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[out] *MediaChange
- return value that indicates if the media of the device has been
- changed.
-
- @retval EFI_SUCCESS
- media found successfully.
-
- @retval EFI_DEVICE_ERROR
- any error encounters during media detection.
-
- @retval EFI_NO_MEDIA
- media not found.
-
- @note
- parameter IdeDev may be updated in this function.
-
-**/
-EFI_STATUS
-AtapiDetectMedia (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT BOOLEAN *MediaChange
- )
-{
- EFI_STATUS Status;
- EFI_STATUS CleanStateStatus;
- EFI_BLOCK_IO_MEDIA OldMediaInfo;
- UINTN RetryTimes;
- UINTN RetryNotReady;
- UINTN SenseCount;
- SENSE_RESULT SResult;
- BOOLEAN WriteProtected;
-
- CopyMem (&OldMediaInfo, IdeDev->BlkIo.Media, sizeof (EFI_BLOCK_IO_MEDIA));
- *MediaChange = FALSE;
- //
- // Retry for SenseDeviceNotReadyNeedRetry.
- // Each retry takes 1s and we limit the upper boundary to
- // 120 times about 2 min.
- //
- RetryNotReady = 120;
-
- //
- // Do Test Unit Ready
- //
- DoTUR:
- //
- // Retry 5 times
- //
- RetryTimes = 5;
- while (RetryTimes != 0) {
-
- Status = AtapiTestUnitReady (IdeDev, &SenseCount);
-
- if (EFI_ERROR (Status)) {
- //
- // Test Unit Ready error without sense data.
- // For some devices, this means there's extra data
- // that has not been read, so we read these extra
- // data out before going on.
- //
- CleanStateStatus = AtapiReadPendingData (IdeDev);
- if (EFI_ERROR (CleanStateStatus)) {
- //
- // Busy wait failed, try again
- //
- RetryTimes--;
- }
- //
- // Try again without counting down RetryTimes
- //
- continue;
- } else {
-
- ParseSenseData (IdeDev, SenseCount, &SResult);
-
- switch (SResult) {
- case SenseNoSenseKey:
- if (IdeDev->BlkIo.Media->MediaPresent) {
- goto Done;
- } else {
- //
- // Media present but the internal structure need refreshed.
- // Try Read Capacity
- //
- goto DoRC;
- }
- break;
-
- case SenseDeviceNotReadyNeedRetry:
- if (--RetryNotReady == 0) {
- return EFI_DEVICE_ERROR;
- }
- gBS->Stall (1000 * STALL_1_MILLI_SECOND);
- continue;
- break;
-
- case SenseNoMedia:
- IdeDev->BlkIo.Media->MediaPresent = FALSE;
- IdeDev->BlkIo.Media->LastBlock = 0;
- goto Done;
- break;
-
- case SenseDeviceNotReadyNoRetry:
- case SenseMediaError:
- return EFI_DEVICE_ERROR;
-
- case SenseMediaChange:
- IdeDev->BlkIo.Media->MediaId++;
- goto DoRC;
- break;
-
- default:
- RetryTimes--;
- break;
- }
- }
- }
-
- return EFI_DEVICE_ERROR;
-
- //
- // Do Read Capacity
- //
- DoRC:
- RetryTimes = 5;
-
- while (RetryTimes != 0) {
-
- Status = AtapiReadCapacity (IdeDev, &SenseCount);
-
- if (EFI_ERROR (Status)) {
- RetryTimes--;
- continue;
- } else {
-
- ParseSenseData (IdeDev, SenseCount, &SResult);
-
- switch (SResult) {
- case SenseNoSenseKey:
- goto Done;
- break;
-
- case SenseDeviceNotReadyNeedRetry:
- //
- // We use Test Unit Ready to retry which
- // is faster.
- //
- goto DoTUR;
- break;
-
- case SenseNoMedia:
- IdeDev->BlkIo.Media->MediaPresent = FALSE;
- IdeDev->BlkIo.Media->LastBlock = 0;
- goto Done;
- break;
-
- case SenseDeviceNotReadyNoRetry:
- case SenseMediaError:
- return EFI_DEVICE_ERROR;
-
- case SenseMediaChange:
- IdeDev->BlkIo.Media->MediaId++;
- continue;
- break;
-
- default:
- RetryTimes--;
- break;
- }
- }
- }
-
- return EFI_DEVICE_ERROR;
-
- Done:
- //
- // the following code is to check the write-protected for LS120 media
- //
- if ((IdeDev->BlkIo.Media->MediaPresent) && (IdeDev->Type == IdeMagnetic)) {
-
- Status = IsLS120orZipWriteProtected (IdeDev, &WriteProtected);
- if (!EFI_ERROR (Status)) {
-
- if (WriteProtected) {
-
- IdeDev->BlkIo.Media->ReadOnly = TRUE;
- } else {
-
- IdeDev->BlkIo.Media->ReadOnly = FALSE;
- }
-
- }
- }
-
- if (IdeDev->BlkIo.Media->MediaId != OldMediaInfo.MediaId) {
- //
- // Media change information got from the device
- //
- *MediaChange = TRUE;
- }
-
- if (IdeDev->BlkIo.Media->ReadOnly != OldMediaInfo.ReadOnly) {
- *MediaChange = TRUE;
- IdeDev->BlkIo.Media->MediaId += 1;
- }
-
- if (IdeDev->BlkIo.Media->BlockSize != OldMediaInfo.BlockSize) {
- *MediaChange = TRUE;
- IdeDev->BlkIo.Media->MediaId += 1;
- }
-
- if (IdeDev->BlkIo.Media->LastBlock != OldMediaInfo.LastBlock) {
- *MediaChange = TRUE;
- IdeDev->BlkIo.Media->MediaId += 1;
- }
-
- if (IdeDev->BlkIo.Media->MediaPresent != OldMediaInfo.MediaPresent) {
- if (IdeDev->BlkIo.Media->MediaPresent) {
- //
- // when change from no media to media present, reset the MediaId to 1.
- //
- IdeDev->BlkIo.Media->MediaId = 1;
- } else {
- //
- // when no media, reset the MediaId to zero.
- //
- IdeDev->BlkIo.Media->MediaId = 0;
- }
-
- *MediaChange = TRUE;
- }
-
- //
- // if any change on current existing media,
- // the Block I/O protocol need to be reinstalled.
- //
- if (*MediaChange) {
- gBS->ReinstallProtocolInterface (
- IdeDev->Handle,
- &gEfiBlockIoProtocolGuid,
- &IdeDev->BlkIo,
- &IdeDev->BlkIo
- );
- }
-
- if (IdeDev->BlkIo.Media->MediaPresent) {
- return EFI_SUCCESS;
- } else {
- return EFI_NO_MEDIA;
- }
-}
-
-/**
- This function is called by the AtapiBlkIoReadBlocks() to perform
- read from media in block unit.
-
- The main command used to access media here is READ(10) Command.
- READ(10) Command requests that the ATAPI device media transfer
- specified data to the host. Data is transferred in block(sector)
- unit. The maximum number of blocks that can be transferred once is
- 65536. This is the main difference between READ(10) and READ(12)
- Command. The maximum number of blocks in READ(12) is 2 power 32.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *Buffer
- A pointer to the destination buffer for the data.
-
- @param[in] Lba
- The starting logical block address to read from
- on the device media.
-
- @param[in] NumberOfBlocks
- The number of transfer data blocks.
-
- @return status is fully dependent on the return status
- of AtapiPacketCommandIn() function.
-
-**/
-EFI_STATUS
-AtapiReadSectors (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *Buffer,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- )
-{
-
- ATAPI_PACKET_COMMAND Packet;
- READ10_CMD *Read10Packet;
- EFI_STATUS Status;
- UINTN BlocksRemaining;
- UINT32 Lba32;
- UINT32 BlockSize;
- UINT32 ByteCount;
- UINT16 SectorCount;
- VOID *PtrBuffer;
- UINT16 MaxBlock;
- UINTN TimeOut;
-
- //
- // fill command packet for Read(10) command
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Read10Packet = &Packet.Read10;
- Lba32 = (UINT32) Lba;
- PtrBuffer = Buffer;
-
- BlockSize = IdeDev->BlkIo.Media->BlockSize;
-
- //
- // limit the data bytes that can be transferred by one Read(10) Command
- //
- MaxBlock = 65535;
-
- BlocksRemaining = NumberOfBlocks;
-
- Status = EFI_SUCCESS;
- while (BlocksRemaining > 0) {
-
- if (BlocksRemaining <= MaxBlock) {
-
- SectorCount = (UINT16) BlocksRemaining;
- } else {
-
- SectorCount = MaxBlock;
- }
-
- //
- // fill the Packet data structure
- //
-
- Read10Packet->opcode = READ_10;
-
- //
- // Lba0 ~ Lba3 specify the start logical block address of the data transfer.
- // Lba0 is MSB, Lba3 is LSB
- //
- Read10Packet->Lba3 = (UINT8) (Lba32 & 0xff);
- Read10Packet->Lba2 = (UINT8) (Lba32 >> 8);
- Read10Packet->Lba1 = (UINT8) (Lba32 >> 16);
- Read10Packet->Lba0 = (UINT8) (Lba32 >> 24);
-
- //
- // TranLen0 ~ TranLen1 specify the transfer length in block unit.
- // TranLen0 is MSB, TranLen is LSB
- //
- Read10Packet->TranLen1 = (UINT8) (SectorCount & 0xff);
- Read10Packet->TranLen0 = (UINT8) (SectorCount >> 8);
-
- ByteCount = SectorCount * BlockSize;
-
- if (IdeDev->Type == IdeCdRom) {
- TimeOut = CDROMLONGTIMEOUT;
- } else {
- TimeOut = ATAPILONGTIMEOUT;
- }
-
- Status = AtapiPacketCommandIn (
- IdeDev,
- &Packet,
- (UINT16 *) PtrBuffer,
- ByteCount,
- TimeOut
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Lba32 += SectorCount;
- PtrBuffer = (UINT8 *) PtrBuffer + SectorCount * BlockSize;
- BlocksRemaining -= SectorCount;
- }
-
- return Status;
-}
-
-/**
- This function is called by the AtapiBlkIoWriteBlocks() to perform
- write onto media in block unit.
- The main command used to access media here is Write(10) Command.
- Write(10) Command requests that the ATAPI device media transfer
- specified data to the host. Data is transferred in block (sector)
- unit. The maximum number of blocks that can be transferred once is
- 65536.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *Buffer
- A pointer to the source buffer for the data.
-
- @param[in] Lba
- The starting logical block address to write onto
- the device media.
-
- @param[in] NumberOfBlocks
- The number of transfer data blocks.
-
- @return status is fully dependent on the return status
- of AtapiPacketCommandOut() function.
-
-**/
-EFI_STATUS
-AtapiWriteSectors (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *Buffer,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- )
-{
-
- ATAPI_PACKET_COMMAND Packet;
- READ10_CMD *Read10Packet;
-
- EFI_STATUS Status;
- UINTN BlocksRemaining;
- UINT32 Lba32;
- UINT32 BlockSize;
- UINT32 ByteCount;
- UINT16 SectorCount;
- VOID *PtrBuffer;
- UINT16 MaxBlock;
-
- //
- // fill command packet for Write(10) command
- // Write(10) command packet has the same data structure as
- // Read(10) command packet,
- // so here use the Read10Packet data structure
- // for the Write(10) command packet.
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Read10Packet = &Packet.Read10;
-
- Lba32 = (UINT32) Lba;
- PtrBuffer = Buffer;
-
- BlockSize = IdeDev->BlkIo.Media->BlockSize;
-
- //
- // limit the data bytes that can be transferred by one Read(10) Command
- //
- MaxBlock = (UINT16) (65536 / BlockSize);
-
- BlocksRemaining = NumberOfBlocks;
-
- Status = EFI_SUCCESS;
- while (BlocksRemaining > 0) {
-
- if (BlocksRemaining >= MaxBlock) {
- SectorCount = MaxBlock;
- } else {
- SectorCount = (UINT16) BlocksRemaining;
- }
-
- //
- // Command code is WRITE_10.
- //
- Read10Packet->opcode = WRITE_10;
-
- //
- // Lba0 ~ Lba3 specify the start logical block address of the data transfer.
- // Lba0 is MSB, Lba3 is LSB
- //
- Read10Packet->Lba3 = (UINT8) (Lba32 & 0xff);
- Read10Packet->Lba2 = (UINT8) (Lba32 >> 8);
- Read10Packet->Lba1 = (UINT8) (Lba32 >> 16);
- Read10Packet->Lba0 = (UINT8) (Lba32 >> 24);
-
- //
- // TranLen0 ~ TranLen1 specify the transfer length in block unit.
- // TranLen0 is MSB, TranLen is LSB
- //
- Read10Packet->TranLen1 = (UINT8) (SectorCount & 0xff);
- Read10Packet->TranLen0 = (UINT8) (SectorCount >> 8);
-
- ByteCount = SectorCount * BlockSize;
-
- Status = AtapiPacketCommandOut (
- IdeDev,
- &Packet,
- (UINT16 *) PtrBuffer,
- ByteCount,
- ATAPILONGTIMEOUT
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Lba32 += SectorCount;
- PtrBuffer = ((UINT8 *) PtrBuffer + SectorCount * BlockSize);
- BlocksRemaining -= SectorCount;
- }
-
- return Status;
-}
-
-/**
- This function is used to implement the Soft Reset on the specified
- ATAPI device. Different from the AtaSoftReset(), here reset is a ATA
- Soft Reset Command special for ATAPI device, and it only take effects
- on the specified ATAPI device, not on the whole IDE bus.
- Since the ATAPI soft reset is needed when device is in exceptional
- condition (such as BSY bit is always set ), I think the Soft Reset
- command should be sent without waiting for the BSY clear and DRDY
- set.
- This function is called by IdeBlkIoReset(),
- a interface function of Block I/O protocol.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @retval EFI_SUCCESS
- Soft reset completes successfully.
-
- @retval EFI_DEVICE_ERROR
- Any step during the reset process is failed.
-
-**/
-EFI_STATUS
-AtapiSoftReset (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- UINT8 Command;
- UINT8 DeviceSelect;
- EFI_STATUS Status;
-
- //
- // for ATAPI device, no need to wait DRDY ready after device selecting.
- // (bit7 and bit5 are both set to 1 for backward compatibility)
- //
- DeviceSelect = (UINT8) (((bit7 | bit5) | (IdeDev->Device << 4)));
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Head, DeviceSelect);
-
- Command = ATAPI_SOFT_RESET_CMD;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, Command);
-
- //
- // BSY cleared is the only status return to the host by the device
- // when reset is completed.
- // slave device needs at most 31s to clear BSY
- //
- Status = WaitForBSYClear (IdeDev, 31000);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // stall 5 seconds to make the device status stable
- //
- gBS->Stall (5000000);
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is the ATAPI implementation for ReadBlocks in the
- Block I/O Protocol interface.
-
- @param[in] *IdeBlkIoDev
- Indicates the calling context.
-
- @param[in] MediaId
- The media id that the read request is for.
-
- @param[in] LBA
- The starting logical block address to read from
- on the device.
-
- @param[in] BufferSize
- The size of the Buffer in bytes. This must be a
- multiple of the intrinsic block size of the device.
-
- @param[out] *Buffer
- A pointer to the destination buffer for the data.
- The caller is responsible for either having implicit
- or explicit ownership of the memory that data is read into.
-
- @retval EFI_SUCCESS
- Read Blocks successfully.
-
- @retval EFI_DEVICE_ERROR
- Read Blocks failed.
-
- @retval EFI_NO_MEDIA
- There is no media in the device.
-
- @retval EFI_MEDIA_CHANGED
- The MediaId is not for the current media.
-
- @retval EFI_BAD_BUFFER_SIZE
- The BufferSize parameter is not a multiple of the
- intrinsic block size of the device.
-
- @retval EFI_INVALID_PARAMETER
- The read request contains LBAs that are not valid,
- or the data buffer is not valid.
-
-**/
-EFI_STATUS
-AtapiBlkIoReadBlocks (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-{
- EFI_BLOCK_IO_MEDIA *Media;
- UINTN BlockSize;
- UINTN NumberOfBlocks;
- EFI_STATUS Status;
-
- BOOLEAN MediaChange;
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
-
- //
- // ATAPI device media is removable, so it is a must
- // to detect media first before read operation
- //
- MediaChange = FALSE;
- Status = AtapiDetectMedia (IdeBlkIoDevice, &MediaChange);
- if (EFI_ERROR (Status)) {
-
- if (IdeBlkIoDevice->Cache != NULL) {
- gBS->FreePool (IdeBlkIoDevice->Cache);
- IdeBlkIoDevice->Cache = NULL;
- }
-
- return Status;
- }
- //
- // Get the intrinsic block size
- //
- Media = IdeBlkIoDevice->BlkIo.Media;
- BlockSize = Media->BlockSize;
-
- NumberOfBlocks = BufferSize / BlockSize;
-
- if (!(Media->MediaPresent)) {
-
- if (IdeBlkIoDevice->Cache != NULL) {
- gBS->FreePool (IdeBlkIoDevice->Cache);
- IdeBlkIoDevice->Cache = NULL;
- }
- return EFI_NO_MEDIA;
-
- }
-
- if ((MediaId != Media->MediaId) || MediaChange) {
-
- if (IdeBlkIoDevice->Cache != NULL) {
- gBS->FreePool (IdeBlkIoDevice->Cache);
- IdeBlkIoDevice->Cache = NULL;
- }
- return EFI_MEDIA_CHANGED;
- }
-
- if (BufferSize % BlockSize != 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- if (LBA > Media->LastBlock) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((Media->IoAlign > 1) && (((UINTN) Buffer & (Media->IoAlign - 1)) != 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // if all the parameters are valid, then perform read sectors command
- // to transfer data from device to host.
- //
- Status = AtapiReadSectors (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Read blocks succeeded
- //
-
- //
- // save the first block to the cache for performance
- //
- if (LBA == 0 && !IdeBlkIoDevice->Cache) {
- IdeBlkIoDevice->Cache = AllocatePool (BlockSize);
- if (IdeBlkIoDevice != NULL) {
- CopyMem ((UINT8 *) IdeBlkIoDevice->Cache, (UINT8 *) Buffer, BlockSize);
- }
- }
-
- return EFI_SUCCESS;
-
-}
-
-/**
- This function is the ATAPI implementation for WriteBlocks in the
- Block I/O Protocol interface.
-
- @param[in] *This
- Indicates the calling context.
-
- @param[in] MediaId
- The media id that the write request is for.
-
- @param[in] LBA
- The starting logical block address to write onto
- the device.
-
- @param[in] BufferSize
- The size of the Buffer in bytes. This must be a
- multiple of the intrinsic block size of the device.
-
- @param[out] *Buffer
- A pointer to the source buffer for the data.
- The caller is responsible for either having implicit
- or explicit ownership of the memory that data is
- written from.
-
- @retval EFI_SUCCESS
- Write Blocks successfully.
-
- @retval EFI_DEVICE_ERROR
- Write Blocks failed.
-
- @retval EFI_NO_MEDIA
- There is no media in the device.
-
- @retval EFI_MEDIA_CHANGE
- The MediaId is not for the current media.
-
- @retval EFI_BAD_BUFFER_SIZE
- The BufferSize parameter is not a multiple of the
- intrinsic block size of the device.
-
- @retval EFI_INVALID_PARAMETER
- The write request contains LBAs that are not valid,
- or the data buffer is not valid.
-
- TODO: EFI_MEDIA_CHANGED - add return value to function comment
- TODO: EFI_WRITE_PROTECTED - add return value to function comment
-**/
-EFI_STATUS
-AtapiBlkIoWriteBlocks (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-{
-
- EFI_BLOCK_IO_MEDIA *Media;
- UINTN BlockSize;
- UINTN NumberOfBlocks;
- EFI_STATUS Status;
- BOOLEAN MediaChange;
-
- if (LBA == 0 && IdeBlkIoDevice->Cache) {
- gBS->FreePool (IdeBlkIoDevice->Cache);
- IdeBlkIoDevice->Cache = NULL;
- }
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
-
- //
- // ATAPI device media is removable,
- // so it is a must to detect media first before write operation
- //
- MediaChange = FALSE;
- Status = AtapiDetectMedia (IdeBlkIoDevice, &MediaChange);
- if (EFI_ERROR (Status)) {
-
- if (LBA == 0 && IdeBlkIoDevice->Cache) {
- gBS->FreePool (IdeBlkIoDevice->Cache);
- IdeBlkIoDevice->Cache = NULL;
- }
- return Status;
- }
-
- //
- // Get the intrinsic block size
- //
- Media = IdeBlkIoDevice->BlkIo.Media;
- BlockSize = Media->BlockSize;
- NumberOfBlocks = BufferSize / BlockSize;
-
- if (!(Media->MediaPresent)) {
-
- if (LBA == 0 && IdeBlkIoDevice->Cache) {
- gBS->FreePool (IdeBlkIoDevice->Cache);
- IdeBlkIoDevice->Cache = NULL;
- }
- return EFI_NO_MEDIA;
- }
-
- if ((MediaId != Media->MediaId) || MediaChange) {
-
- if (LBA == 0 && IdeBlkIoDevice->Cache) {
- gBS->FreePool (IdeBlkIoDevice->Cache);
- IdeBlkIoDevice->Cache = NULL;
- }
- return EFI_MEDIA_CHANGED;
- }
-
- if (Media->ReadOnly) {
- return EFI_WRITE_PROTECTED;
- }
-
- if (BufferSize % BlockSize != 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- if (LBA > Media->LastBlock) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((Media->IoAlign > 1) && (((UINTN) Buffer & (Media->IoAlign - 1)) != 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // if all the parameters are valid,
- // then perform write sectors command to transfer data from host to device.
- //
- Status = AtapiWriteSectors (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-
-}
-
-/**
- This function is used to parse sense data. Only the first
- sense data is honoured.
-
- @param[in] IdeDev Indicates the calling context.
- @param[in] SenseCount Count of sense data.
- @param[out] Result The parsed result.
-
- @retval EFI_SUCCESS Successfully parsed.
- @retval EFI_INVALID_PARAMETER Count of sense data is zero.
-
-**/
-EFI_STATUS
-ParseSenseData (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN SenseCount,
- OUT SENSE_RESULT *Result
- )
-{
- REQUEST_SENSE_DATA *SenseData;
-
- if (SenseCount == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Only use the first sense data
- //
- SenseData = IdeDev->SenseData;
- *Result = SenseOtherSense;
-
- switch (SenseData->sense_key) {
- case SK_NO_SENSE:
- *Result = SenseNoSenseKey;
- break;
- case SK_NOT_READY:
- switch (SenseData->addnl_sense_code) {
- case ASC_NO_MEDIA:
- *Result = SenseNoMedia;
- break;
- case ASC_MEDIA_UPSIDE_DOWN:
- *Result = SenseMediaError;
- break;
- case ASC_NOT_READY:
- if (SenseData->addnl_sense_code_qualifier == ASCQ_IN_PROGRESS) {
- *Result = SenseDeviceNotReadyNeedRetry;
- } else {
- *Result = SenseDeviceNotReadyNoRetry;
- }
- break;
- }
- break;
- case SK_UNIT_ATTENTION:
- if (SenseData->addnl_sense_code == ASC_MEDIA_CHANGE) {
- *Result = SenseMediaChange;
- }
- break;
- case SK_MEDIUM_ERROR:
- switch (SenseData->addnl_sense_code) {
- case ASC_MEDIA_ERR1:
- case ASC_MEDIA_ERR2:
- case ASC_MEDIA_ERR3:
- case ASC_MEDIA_ERR4:
- *Result = SenseMediaError;
- break;
- }
- break;
- default:
- break;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function reads the pending data in the device.
-
- @param[in] IdeDev Indicates the calling context.
-
- @retval EFI_SUCCESS Successfully read.
- @retval EFI_NOT_READY The BSY is set avoiding reading.
-
-**/
-EFI_STATUS
-AtapiReadPendingData (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- UINT8 AltRegister;
- UINT16 TempWordBuffer;
-
- AltRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Alt.AltStatus);
- if ((AltRegister & BSY) == BSY) {
- return EFI_NOT_READY;
- }
- if ((AltRegister & (BSY | DRQ)) == DRQ) {
- TempWordBuffer = IDEReadPortB (IdeDev->PciIo,IdeDev->IoPort->Alt.AltStatus);
- while ((TempWordBuffer & (BSY | DRQ)) == DRQ) {
- IDEReadPortWMultiple (
- IdeDev->PciIo,
- IdeDev->IoPort->Data,
- 1,
- &TempWordBuffer
- );
- TempWordBuffer = IDEReadPortB (IdeDev->PciIo,IdeDev->IoPort->Alt.AltStatus);
- }
- }
- return EFI_SUCCESS;
-}
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param WriteProtected TODO: add argument description
-
- @retval EFI_DEVICE_ERROR TODO: Add description for return value
- @retval EFI_DEVICE_ERROR TODO: Add description for return value
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-EFI_STATUS
-IsLS120orZipWriteProtected (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT BOOLEAN *WriteProtected
- )
-{
- EFI_STATUS Status;
-
- *WriteProtected = FALSE;
-
- Status = LS120EnableMediaStatus (IdeDev, TRUE);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // the Get Media Status Command is only valid
- // if a Set Features/Enable Media Status Command has been priviously issued.
- //
- if (LS120GetMediaStatus (IdeDev) == EFI_WRITE_PROTECTED) {
-
- *WriteProtected = TRUE;
- } else {
-
- *WriteProtected = FALSE;
- }
-
- //
- // After Get Media Status Command completes,
- // Set Features/Disable Media Command should be sent.
- //
- Status = LS120EnableMediaStatus (IdeDev, FALSE);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.c b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.c
deleted file mode 100644
index 4b4a8ef..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.c
+++ /dev/null
@@ -1,1824 +0,0 @@
-/** @file
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "idebus.h"
-
-BOOLEAN ChannelDeviceDetected = FALSE;
-BOOLEAN SlaveDeviceExist = FALSE;
-UINT8 SlaveDeviceType = INVALID_DEVICE_TYPE;
-BOOLEAN MasterDeviceExist = FALSE;
-UINT8 MasterDeviceType = INVALID_DEVICE_TYPE;
-
-/**
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
-
- TODO: add return values
-
-**/
-UINT8
-IDEReadPortB (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port
- )
-{
- UINT8 Data;
-
- Data = 0;
- //
- // perform 1-byte data read from register
- //
- PciIo->Io.Read (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) Port,
- 1,
- &Data
- );
- return Data;
-}
-
-/**
- Reads multiple words of data from the IDE data port.
- Call the IO abstraction once to do the complete read,
- not one word at a time
-
- @param PciIo Pointer to the EFI_PCI_IO instance
- @param Port IO port to read
- @param Count No. of UINT16's to read
- @param Buffer Pointer to the data buffer for read
-
-**/
-VOID
-IDEReadPortWMultiple (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINTN Count,
- IN VOID *Buffer
- )
-{
- UINT16 *AlignedBuffer;
- UINT16 *WorkingBuffer;
- UINTN Size;
-
- //
- // Prepare an 16-bit alligned working buffer. CpuIo will return failure and
- // not perform actual I/O operations if buffer pointer passed in is not at
- // natural boundary. The "Buffer" argument is passed in by user and may not
- // at 16-bit natural boundary.
- //
- Size = sizeof (UINT16) * Count;
-
- gBS->AllocatePool (
- EfiBootServicesData,
- Size + 1,
- (VOID**)&WorkingBuffer
- );
-
- AlignedBuffer = (UINT16 *) ((UINTN)(((UINTN) WorkingBuffer + 0x1) & (~0x1)));
-
- //
- // Perform UINT16 data read from FIFO
- //
- PciIo->Io.Read (
- PciIo,
- EfiPciIoWidthFifoUint16,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) Port,
- Count,
- (UINT16*)AlignedBuffer
- );
-
- //
- // Copy data to user buffer
- //
- CopyMem (Buffer, (UINT16*)AlignedBuffer, Size);
- gBS->FreePool (WorkingBuffer);
-}
-
-/**
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
- @param Data TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-IDEWritePortB (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINT8 Data
- )
-{
- //
- // perform 1-byte data write to register
- //
- PciIo->Io.Write (
- PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) Port,
- 1,
- &Data
- );
-
-}
-
-/**
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
- @param Data TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-IDEWritePortW (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINT16 Data
- )
-{
- //
- // perform 1-word data write to register
- //
- PciIo->Io.Write (
- PciIo,
- EfiPciIoWidthUint16,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) Port,
- 1,
- &Data
- );
-}
-
-/**
- Write multiple words of data to the IDE data port.
- Call the IO abstraction once to do the complete read,
- not one word at a time
-
- @param PciIo Pointer to the EFI_PCI_IO instance
- @param Port IO port to read
- @param Count No. of UINT16's to read
- @param Buffer Pointer to the data buffer for read
-
-**/
-VOID
-IDEWritePortWMultiple (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINTN Count,
- IN VOID *Buffer
- )
-{
- UINT16 *AlignedBuffer;
- UINT32 *WorkingBuffer;
- UINTN Size;
-
- //
- // Prepare an 16-bit alligned working buffer. CpuIo will return failure and
- // not perform actual I/O operations if buffer pointer passed in is not at
- // natural boundary. The "Buffer" argument is passed in by user and may not
- // at 16-bit natural boundary.
- //
- Size = sizeof (UINT16) * Count;
-
- gBS->AllocatePool (
- EfiBootServicesData,
- Size + 1,
- (VOID **) &WorkingBuffer
- );
-
- AlignedBuffer = (UINT16 *) ((UINTN)(((UINTN) WorkingBuffer + 0x1) & (~0x1)));
-
- //
- // Copy data from user buffer to working buffer
- //
- CopyMem ((UINT16 *) AlignedBuffer, Buffer, Size);
-
- //
- // perform UINT16 data write to the FIFO
- //
- PciIo->Io.Write (
- PciIo,
- EfiPciIoWidthFifoUint16,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- (UINT64) Port,
- Count,
- (UINT16 *) AlignedBuffer
- );
-
- gBS->FreePool (WorkingBuffer);
-}
-
-//
-// GetIdeRegistersBaseAddr
-//
-/**
- Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode,
- use fixed addresses. In Native-PCI mode, get base addresses from BARs in
- the PCI IDE controller's Configuration Space.
-
- The steps to get IDE IO port registers' base addresses for each channel
- as follows:
-
- 1. Examine the Programming Interface byte of the Class Code fields in PCI IDE
- controller's Configuration Space to determine the operating mode.
-
- 2. a) In 'Compatibility' mode, use fixed addresses shown in the Table 1 below.
- <pre>
- ___________________________________________
- | | Command Block | Control Block |
- | Channel | Registers | Registers |
- |___________|_______________|_______________|
- | Primary | 1F0h - 1F7h | 3F6h - 3F7h |
- |___________|_______________|_______________|
- | Secondary | 170h - 177h | 376h - 377h |
- |___________|_______________|_______________|
-
- Table 1. Compatibility resource mappings
- </pre>
-
- b) In Native-PCI mode, IDE registers are mapped into IO space using the BARs
- in IDE controller's PCI Configuration Space, shown in the Table 2 below.
- <pre>
- ___________________________________________________
- | | Command Block | Control Block |
- | Channel | Registers | Registers |
- |___________|___________________|___________________|
- | Primary | BAR at offset 0x10| BAR at offset 0x14|
- |___________|___________________|___________________|
- | Secondary | BAR at offset 0x18| BAR at offset 0x1C|
- |___________|___________________|___________________|
-
- Table 2. BARs for Register Mapping
- </pre>
- @note Refer to Intel ICH4 datasheet, Control Block Offset: 03F4h for
- primary, 0374h for secondary. So 2 bytes extra offset should be
- added to the base addresses read from BARs.
-
- For more details, please refer to PCI IDE Controller Specification and Intel
- ICH4 Datasheet.
-
- @param PciIo Pointer to the EFI_PCI_IO_PROTOCOL instance
- @param IdeRegsBaseAddr Pointer to IDE_REGISTERS_BASE_ADDR to
- receive IDE IO port registers' base addresses
-
-**/
-EFI_STATUS
-GetIdeRegistersBaseAddr (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr
- )
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_TYPE00 PciData;
-
- Status = PciIo->Pci.Read (
- PciIo,
- EfiPciIoWidthUint8,
- 0,
- sizeof (PciData),
- &PciData
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if ((PciData.Hdr.ClassCode[0] & IDE_PRIMARY_OPERATING_MODE) == 0) {
- IdeRegsBaseAddr[IdePrimary].CommandBlockBaseAddr = 0x1f0;
- IdeRegsBaseAddr[IdePrimary].ControlBlockBaseAddr = 0x3f6;
- IdeRegsBaseAddr[IdePrimary].BusMasterBaseAddr =
- (UINT16)((PciData.Device.Bar[4] & 0x0000fff0));
- } else {
- //
- // The BARs should be of IO type
- //
- if ((PciData.Device.Bar[0] & bit0) == 0 ||
- (PciData.Device.Bar[1] & bit0) == 0) {
- return EFI_UNSUPPORTED;
- }
-
- IdeRegsBaseAddr[IdePrimary].CommandBlockBaseAddr =
- (UINT16) (PciData.Device.Bar[0] & 0x0000fff8);
- IdeRegsBaseAddr[IdePrimary].ControlBlockBaseAddr =
- (UINT16) ((PciData.Device.Bar[1] & 0x0000fffc) + 2);
- IdeRegsBaseAddr[IdePrimary].BusMasterBaseAddr =
- (UINT16) ((PciData.Device.Bar[4] & 0x0000fff0));
- }
-
- if ((PciData.Hdr.ClassCode[0] & IDE_SECONDARY_OPERATING_MODE) == 0) {
- IdeRegsBaseAddr[IdeSecondary].CommandBlockBaseAddr = 0x170;
- IdeRegsBaseAddr[IdeSecondary].ControlBlockBaseAddr = 0x376;
- IdeRegsBaseAddr[IdeSecondary].BusMasterBaseAddr =
- (UINT16) ((PciData.Device.Bar[4] & 0x0000fff0));
- } else {
- //
- // The BARs should be of IO type
- //
- if ((PciData.Device.Bar[2] & bit0) == 0 ||
- (PciData.Device.Bar[3] & bit0) == 0) {
- return EFI_UNSUPPORTED;
- }
-
- IdeRegsBaseAddr[IdeSecondary].CommandBlockBaseAddr =
- (UINT16) (PciData.Device.Bar[2] & 0x0000fff8);
- IdeRegsBaseAddr[IdeSecondary].ControlBlockBaseAddr =
- (UINT16) ((PciData.Device.Bar[3] & 0x0000fffc) + 2);
- IdeRegsBaseAddr[IdeSecondary].BusMasterBaseAddr =
- (UINT16) ((PciData.Device.Bar[4] & 0x0000fff0));
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is used to requery IDE resources. The IDE controller will
- probably switch between native and legacy modes during the EFI->CSM->OS
- transfer. We do this everytime before an BlkIo operation to ensure its
- succeess.
-
- @param IdeDev The BLK_IO private data which specifies the IDE device
-
-**/
-EFI_STATUS
-ReassignIdeResources (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- IDE_REGISTERS_BASE_ADDR IdeRegsBaseAddr[IdeMaxChannel];
- UINT16 CommandBlockBaseAddr;
- UINT16 ControlBlockBaseAddr;
-
- //
- // Requery IDE IO port registers' base addresses in case of the switch of
- // native and legacy modes
- //
- Status = GetIdeRegistersBaseAddr (IdeDev->PciIo, IdeRegsBaseAddr);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ZeroMem (IdeDev->IoPort, sizeof (IDE_BASE_REGISTERS));
- CommandBlockBaseAddr = IdeRegsBaseAddr[IdeDev->Channel].CommandBlockBaseAddr;
- ControlBlockBaseAddr = IdeRegsBaseAddr[IdeDev->Channel].ControlBlockBaseAddr;
-
- IdeDev->IoPort->Data = CommandBlockBaseAddr;
- (*(UINT16 *) &IdeDev->IoPort->Reg1) = (UINT16) (CommandBlockBaseAddr + 0x01);
- IdeDev->IoPort->SectorCount = (UINT16) (CommandBlockBaseAddr + 0x02);
- IdeDev->IoPort->SectorNumber = (UINT16) (CommandBlockBaseAddr + 0x03);
- IdeDev->IoPort->CylinderLsb = (UINT16) (CommandBlockBaseAddr + 0x04);
- IdeDev->IoPort->CylinderMsb = (UINT16) (CommandBlockBaseAddr + 0x05);
- IdeDev->IoPort->Head = (UINT16) (CommandBlockBaseAddr + 0x06);
-
- (*(UINT16 *) &IdeDev->IoPort->Reg) = (UINT16) (CommandBlockBaseAddr + 0x07);
- (*(UINT16 *) &IdeDev->IoPort->Alt) = ControlBlockBaseAddr;
- IdeDev->IoPort->DriveAddress = (UINT16) (ControlBlockBaseAddr + 0x01);
- IdeDev->IoPort->MasterSlave = (UINT16) ((IdeDev->Device == IdeMaster) ? 1 : 0);
-
- IdeDev->IoPort->BusMasterBaseAddr = IdeRegsBaseAddr[IdeDev->Channel].BusMasterBaseAddr;
- return EFI_SUCCESS;
-}
-
-//
-// DiscoverIdeDevice
-//
-/**
- Detect if there is disk connected to this port
-
- @param IdeDev The BLK_IO private data which specifies the IDE device
-
-**/
-EFI_STATUS
-DiscoverIdeDevice (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
-
- //
- // If a channel has not been checked, check it now. Then set it to "checked" state
- // After this step, all devices in this channel have been checked.
- //
- if (ChannelDeviceDetected == FALSE) {
- Status = DetectIDEController (IdeDev);
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- }
-
- Status = EFI_NOT_FOUND;
-
- //
- // Device exists. test if it is an ATA device.
- // Prefer the result from DetectIDEController,
- // if failed, try another device type to handle
- // devices that not follow the spec.
- //
- if ((IdeDev->Device == IdeMaster) && (MasterDeviceExist)) {
- if (MasterDeviceType == ATA_DEVICE_TYPE) {
- Status = ATAIdentify (IdeDev);
- if (EFI_ERROR (Status)) {
- Status = ATAPIIdentify (IdeDev);
- if (!EFI_ERROR (Status)) {
- MasterDeviceType = ATAPI_DEVICE_TYPE;
- }
- }
- } else {
- Status = ATAPIIdentify (IdeDev);
- if (EFI_ERROR (Status)) {
- Status = ATAIdentify (IdeDev);
- if (!EFI_ERROR (Status)) {
- MasterDeviceType = ATA_DEVICE_TYPE;
- }
- }
- }
- }
- if ((IdeDev->Device == IdeSlave) && (SlaveDeviceExist)) {
- if (SlaveDeviceType == ATA_DEVICE_TYPE) {
- Status = ATAIdentify (IdeDev);
- if (EFI_ERROR (Status)) {
- Status = ATAPIIdentify (IdeDev);
- if (!EFI_ERROR (Status)) {
- SlaveDeviceType = ATAPI_DEVICE_TYPE;
- }
- }
- } else {
- Status = ATAPIIdentify (IdeDev);
- if (EFI_ERROR (Status)) {
- Status = ATAIdentify (IdeDev);
- if (!EFI_ERROR (Status)) {
- SlaveDeviceType = ATA_DEVICE_TYPE;
- }
- }
- }
- }
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- //
- // Init Block I/O interface
- //
- IdeDev->BlkIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION;
- IdeDev->BlkIo.Reset = IDEBlkIoReset;
- IdeDev->BlkIo.ReadBlocks = IDEBlkIoReadBlocks;
- IdeDev->BlkIo.WriteBlocks = IDEBlkIoWriteBlocks;
- IdeDev->BlkIo.FlushBlocks = IDEBlkIoFlushBlocks;
-
- IdeDev->BlkMedia.LogicalPartition = FALSE;
- IdeDev->BlkMedia.WriteCaching = FALSE;
-
- //
- // Init Disk Info interface
- //
- gBS->CopyMem (&IdeDev->DiskInfo.Interface, &gEfiDiskInfoIdeInterfaceGuid, sizeof (EFI_GUID));
- IdeDev->DiskInfo.Inquiry = IDEDiskInfoInquiry;
- IdeDev->DiskInfo.Identify = IDEDiskInfoIdentify;
- IdeDev->DiskInfo.SenseData = IDEDiskInfoSenseData;
- IdeDev->DiskInfo.WhichIde = IDEDiskInfoWhichIde;
-
- return EFI_SUCCESS;
-}
-
-/**
- This interface is used to initialize all state data related to the detection of one
- channel.
-
- @retval EFI_SUCCESS Completed Successfully.
-
-**/
-EFI_STATUS
-InitializeIDEChannelData (
- VOID
- )
-{
- ChannelDeviceDetected = FALSE;
- MasterDeviceExist = FALSE;
- MasterDeviceType = 0xff;
- SlaveDeviceExist = FALSE;
- SlaveDeviceType = 0xff;
- return EFI_SUCCESS;
-}
-
-/**
- This function is called by DiscoverIdeDevice(). It is used for detect
- whether the IDE device exists in the specified Channel as the specified
- Device Number.
-
- There is two IDE channels: one is Primary Channel, the other is
- Secondary Channel.(Channel is the logical name for the physical "Cable".)
- Different channel has different register group.
-
- On each IDE channel, at most two IDE devices attach,
- one is called Device 0 (Master device), the other is called Device 1
- (Slave device). The devices on the same channel co-use the same register
- group, so before sending out a command for a specified device via command
- register, it is a must to select the current device to accept the command
- by set the device number in the Head/Device Register.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @retval TRUE
- successfully detects device.
-
- @retval FALSE
- any failure during detection process will return this
- value.
-
- @note
- TODO: EFI_SUCCESS - add return value to function comment
- TODO: EFI_NOT_FOUND - add return value to function comment
-
-**/
-EFI_STATUS
-DetectIDEController (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- EFI_STATUS Status;
- UINT8 SectorCountReg;
- UINT8 LBALowReg;
- UINT8 LBAMidReg;
- UINT8 LBAHighReg;
- UINT8 InitStatusReg;
- UINT8 StatusReg;
-
- //
- // Select slave device
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((1 << 4) | 0xe0)
- );
- gBS->Stall (100);
-
- //
- // Save the init slave status register
- //
- InitStatusReg = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);
-
- //
- // Select Master back
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((0 << 4) | 0xe0)
- );
- gBS->Stall (100);
-
- //
- // Send ATA Device Execut Diagnostic command.
- // This command should work no matter DRDY is ready or not
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, 0x90);
-
- Status = WaitForBSYClear (IdeDev, 3500);
- if (EFI_ERROR (Status)) {
- DEBUG((EFI_D_ERROR, "New detecting method: Send Execute Diagnostic Command: WaitForBSYClear: Status: %d\n", Status));
- return Status;
- }
- //
- // Read device signature
- //
- //
- // Select Master
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((0 << 4) | 0xe0)
- );
- gBS->Stall (100);
- SectorCountReg = IDEReadPortB (
- IdeDev->PciIo,
- IdeDev->IoPort->SectorCount
- );
- LBALowReg = IDEReadPortB (
- IdeDev->PciIo,
- IdeDev->IoPort->SectorNumber
- );
- LBAMidReg = IDEReadPortB (
- IdeDev->PciIo,
- IdeDev->IoPort->CylinderLsb
- );
- LBAHighReg = IDEReadPortB (
- IdeDev->PciIo,
- IdeDev->IoPort->CylinderMsb
- );
- if ((SectorCountReg == 0x1) &&
- (LBALowReg == 0x1) &&
- (LBAMidReg == 0x0) &&
- (LBAHighReg == 0x0)) {
- MasterDeviceExist = TRUE;
- MasterDeviceType = ATA_DEVICE_TYPE;
- } else {
- if ((LBAMidReg == 0x14) &&
- (LBAHighReg == 0xeb)) {
- MasterDeviceExist = TRUE;
- MasterDeviceType = ATAPI_DEVICE_TYPE;
- }
- }
-
- //
- // For some Hard Drive, it takes some time to get
- // the right signature when operating in single slave mode.
- // We stall 20ms to work around this.
- //
- if (!MasterDeviceExist) {
- gBS->Stall (20000);
- }
-
- //
- // Select Slave
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((1 << 4) | 0xe0)
- );
- gBS->Stall (100);
- SectorCountReg = IDEReadPortB (
- IdeDev->PciIo,
- IdeDev->IoPort->SectorCount
- );
- LBALowReg = IDEReadPortB (
- IdeDev->PciIo,
- IdeDev->IoPort->SectorNumber
- );
- LBAMidReg = IDEReadPortB (
- IdeDev->PciIo,
- IdeDev->IoPort->CylinderLsb
- );
- LBAHighReg = IDEReadPortB (
- IdeDev->PciIo,
- IdeDev->IoPort->CylinderMsb
- );
- StatusReg = IDEReadPortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Reg.Status
- );
- if ((SectorCountReg == 0x1) &&
- (LBALowReg == 0x1) &&
- (LBAMidReg == 0x0) &&
- (LBAHighReg == 0x0)) {
- SlaveDeviceExist = TRUE;
- SlaveDeviceType = ATA_DEVICE_TYPE;
- } else {
- if ((LBAMidReg == 0x14) &&
- (LBAHighReg == 0xeb)) {
- SlaveDeviceExist = TRUE;
- SlaveDeviceType = ATAPI_DEVICE_TYPE;
- }
- }
-
- //
- // When single master is plugged, slave device
- // will be wrongly detected. Here's the workaround
- // for ATA devices by detecting DRY bit in status
- // register.
- // NOTE: This workaround doesn't apply to ATAPI.
- //
- if (MasterDeviceExist && SlaveDeviceExist &&
- (StatusReg & DRDY) == 0 &&
- (InitStatusReg & DRDY) == 0 &&
- MasterDeviceType == SlaveDeviceType &&
- SlaveDeviceType != ATAPI_DEVICE_TYPE) {
- SlaveDeviceExist = FALSE;
- }
-
- //
- // Indicate this channel has been detected
- //
- ChannelDeviceDetected = TRUE;
- return EFI_SUCCESS;
-}
-
-/**
- This function is used to poll for the DRQ bit clear in the Status
- Register. DRQ is cleared when the device is finished transferring data.
- So this function is called after data transfer is finished.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] TimeoutInMilliSeconds
- used to designate the timeout for the DRQ clear.
-
- @retval EFI_SUCCESS
- DRQ bit clear within the time out.
-
- @retval EFI_TIMEOUT
- DRQ bit not clear within the time out.
-
- @note
- Read Status Register will clear interrupt status.
-
-**/
-EFI_STATUS
-DRQClear (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: IdeDev - add argument and description to function comment
-// TODO: TimeoutInMilliSeconds - add argument and description to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-{
- UINT32 Delay;
- UINT8 StatusRegister;
- UINT8 ErrorRegister;
-
- Delay = (UINT32) (((TimeoutInMilliSeconds * STALL_1_MILLI_SECOND) / 30) + 1);
- do {
-
- StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);
-
- //
- // wait for BSY == 0 and DRQ == 0
- //
- if ((StatusRegister & (DRQ | BSY)) == 0) {
- break;
- }
-
- if ((StatusRegister & (BSY | ERR)) == ERR) {
-
- ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);
- if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {
- return EFI_ABORTED;
- }
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- Delay--;
-
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is used to poll for the DRQ bit clear in the Alternate
- Status Register. DRQ is cleared when the device is finished
- transferring data. So this function is called after data transfer
- is finished.
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] TimeoutInMilliSeconds
- used to designate the timeout for the DRQ clear.
-
- @retval EFI_SUCCESS
- DRQ bit clear within the time out.
-
- @retval EFI_TIMEOUT
- DRQ bit not clear within the time out.
-
- @note
- Read Alternate Status Register will not clear interrupt status.
-
-**/
-EFI_STATUS
-DRQClear2 (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: IdeDev - add argument and description to function comment
-// TODO: TimeoutInMilliSeconds - add argument and description to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-{
- UINT32 Delay;
- UINT8 AltRegister;
- UINT8 ErrorRegister;
-
- Delay = (UINT32) (((TimeoutInMilliSeconds * STALL_1_MILLI_SECOND) / 30) + 1);
- do {
-
- AltRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Alt.AltStatus);
-
- //
- // wait for BSY == 0 and DRQ == 0
- //
- if ((AltRegister & (DRQ | BSY)) == 0) {
- break;
- }
-
- if ((AltRegister & (BSY | ERR)) == ERR) {
-
- ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);
- if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {
- return EFI_ABORTED;
- }
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- Delay--;
-
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is used to poll for the DRQ bit set in the
- Status Register.
- DRQ is set when the device is ready to transfer data. So this function
- is called after the command is sent to the device and before required
- data is transferred.
-
- @param[in] IDE_BLK_IO_DEV IN *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure,used
- to record all the information of the IDE device.
-
- @param[in] UINTN IN TimeoutInMilliSeconds
- used to designate the timeout for the DRQ ready.
-
- @retval EFI_SUCCESS
- DRQ bit set within the time out.
-
- @retval EFI_TIMEOUT
- DRQ bit not set within the time out.
-
- @retval EFI_ABORTED
- DRQ bit not set caused by the command abort.
-
- @note
- Read Status Register will clear interrupt status.
-
-**/
-EFI_STATUS
-DRQReady (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: IdeDev - add argument and description to function comment
-// TODO: TimeoutInMilliSeconds - add argument and description to function comment
-{
- UINT32 Delay;
- UINT8 StatusRegister;
- UINT8 ErrorRegister;
-
- Delay = (UINT32) (((TimeoutInMilliSeconds * STALL_1_MILLI_SECOND) / 30) + 1);
- do {
- //
- // read Status Register will clear interrupt
- //
- StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);
-
- //
- // BSY==0,DRQ==1
- //
- if ((StatusRegister & (BSY | DRQ)) == DRQ) {
- break;
- }
-
- if ((StatusRegister & (BSY | ERR)) == ERR) {
-
- ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);
- if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {
- return EFI_ABORTED;
- }
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is used to poll for the DRQ bit set in the
- Alternate Status Register. DRQ is set when the device is ready to
- transfer data. So this function is called after the command
- is sent to the device and before required data is transferred.
-
- @param[in] IDE_BLK_IO_DEV IN *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] UINTN IN TimeoutInMilliSeconds
- used to designate the timeout for the DRQ ready.
-
- @retval EFI_SUCCESS
- DRQ bit set within the time out.
-
- @retval EFI_TIMEOUT
- DRQ bit not set within the time out.
-
- @retval EFI_ABORTED
- DRQ bit not set caused by the command abort.
-
- @note
- Read Alternate Status Register will not clear interrupt status.
-
-**/
-EFI_STATUS
-DRQReady2 (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: IdeDev - add argument and description to function comment
-// TODO: TimeoutInMilliSeconds - add argument and description to function comment
-{
- UINT32 Delay;
- UINT8 AltRegister;
- UINT8 ErrorRegister;
-
- Delay = (UINT32) (((TimeoutInMilliSeconds * STALL_1_MILLI_SECOND) / 30) + 1);
-
- do {
- //
- // Read Alternate Status Register will not clear interrupt status
- //
- AltRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Alt.AltStatus);
- //
- // BSY == 0 , DRQ == 1
- //
- if ((AltRegister & (BSY | DRQ)) == DRQ) {
- break;
- }
-
- if ((AltRegister & (BSY | ERR)) == ERR) {
-
- ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);
- if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {
- return EFI_ABORTED;
- }
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- This function is used to poll for the BSY bit clear in the
- Status Register. BSY is clear when the device is not busy.
- Every command must be sent after device is not busy.
-
- @param[in] IDE_BLK_IO_DEV IN *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] UINTN IN TimeoutInMilliSeconds
- used to designate the timeout for the DRQ ready.
-
- @retval EFI_SUCCESS
- BSY bit clear within the time out.
-
- @retval EFI_TIMEOUT
- BSY bit not clear within the time out.
-
- @note
- Read Status Register will clear interrupt status.
-
-**/
-EFI_STATUS
-WaitForBSYClear (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: IdeDev - add argument and description to function comment
-// TODO: TimeoutInMilliSeconds - add argument and description to function comment
-{
- UINT32 Delay;
- UINT8 StatusRegister;
-
- Delay = (UINT32) (((TimeoutInMilliSeconds * STALL_1_MILLI_SECOND) / 30) + 1);
- do {
-
- StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);
- if ((StatusRegister & BSY) == 0x00) {
- break;
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- Delay--;
-
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-//
-// WaitForBSYClear2
-//
-/**
- This function is used to poll for the BSY bit clear in the
- Alternate Status Register. BSY is clear when the device is not busy.
- Every command must be sent after device is not busy.
-
- @param[in] IDE_BLK_IO_DEV IN *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] UINTN IN TimeoutInMilliSeconds
- used to designate the timeout for the DRQ ready.
-
- @retval EFI_SUCCESS
- BSY bit clear within the time out.
-
- @retval EFI_TIMEOUT
- BSY bit not clear within the time out.
-
- @note
- Read Alternate Status Register will not clear interrupt status.
-
-**/
-EFI_STATUS
-WaitForBSYClear2 (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: IdeDev - add argument and description to function comment
-// TODO: TimeoutInMilliSeconds - add argument and description to function comment
-{
- UINT32 Delay;
- UINT8 AltRegister;
-
- Delay = (UINT32) (((TimeoutInMilliSeconds * STALL_1_MILLI_SECOND) / 30) + 1);
- do {
- AltRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Alt.AltStatus);
- if ((AltRegister & BSY) == 0x00) {
- break;
- }
-
- gBS->Stall (30);
-
- Delay--;
-
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// DRDYReady
-//
-/**
- This function is used to poll for the DRDY bit set in the
- Status Register. DRDY bit is set when the device is ready
- to accept command. Most ATA commands must be sent after
- DRDY set except the ATAPI Packet Command.
-
- @param[in] IDE_BLK_IO_DEV IN *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] UINTN IN TimeoutInMilliSeconds
- used to designate the timeout for the DRQ ready.
-
- @retval EFI_SUCCESS
- DRDY bit set within the time out.
-
- @retval EFI_TIMEOUT
- DRDY bit not set within the time out.
-
- @note
- Read Status Register will clear interrupt status.
-
-**/
-EFI_STATUS
-DRDYReady (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN DelayInMilliSeconds
- )
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: IdeDev - add argument and description to function comment
-// TODO: DelayInMilliSeconds - add argument and description to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-{
- UINT32 Delay;
- UINT8 StatusRegister;
- UINT8 ErrorRegister;
-
- Delay = (UINT32) (((DelayInMilliSeconds * STALL_1_MILLI_SECOND) / 30) + 1);
- do {
- StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);
- //
- // BSY == 0 , DRDY == 1
- //
- if ((StatusRegister & (DRDY | BSY)) == DRDY) {
- break;
- }
-
- if ((StatusRegister & (BSY | ERR)) == ERR) {
-
- ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);
- if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {
- return EFI_ABORTED;
- }
- }
-
- gBS->Stall (30);
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// DRDYReady2
-//
-/**
- This function is used to poll for the DRDY bit set in the
- Alternate Status Register. DRDY bit is set when the device is ready
- to accept command. Most ATA commands must be sent after
- DRDY set except the ATAPI Packet Command.
-
- @param[in] IDE_BLK_IO_DEV IN *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] UINTN IN TimeoutInMilliSeconds
- used to designate the timeout for the DRQ ready.
-
- @retval EFI_SUCCESS
- DRDY bit set within the time out.
-
- @retval EFI_TIMEOUT
- DRDY bit not set within the time out.
-
- @note
- Read Alternate Status Register will clear interrupt status.
-
-**/
-EFI_STATUS
-DRDYReady2 (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN DelayInMilliSeconds
- )
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: IdeDev - add argument and description to function comment
-// TODO: DelayInMilliSeconds - add argument and description to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-{
- UINT32 Delay;
- UINT8 AltRegister;
- UINT8 ErrorRegister;
-
- Delay = (UINT32) (((DelayInMilliSeconds * STALL_1_MILLI_SECOND) / 30) + 1);
- do {
- AltRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Alt.AltStatus);
- //
- // BSY == 0 , DRDY == 1
- //
- if ((AltRegister & (DRDY | BSY)) == DRDY) {
- break;
- }
-
- if ((AltRegister & (BSY | ERR)) == ERR) {
-
- ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);
- if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {
- return EFI_ABORTED;
- }
- }
-
- gBS->Stall (30);
-
- Delay--;
- } while (Delay);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// SwapStringChars
-//
-/**
- This function is a helper function used to change the char order in a
- string. It is designed specially for the PrintAtaModuleName() function.
- After the IDE device is detected, the IDE driver gets the device module
- name by sending ATA command called ATA Identify Command or ATAPI
- Identify Command to the specified IDE device. The module name returned
- is a string of ASCII characters: the first character is bit8--bit15
- of the first word, the second character is bit0--bit7 of the first word
- and so on. Thus the string can not be print directly before it is
- preprocessed by this func to change the order of characters in
- each word in the string.
-
- @param[in] CHAR8 IN *Destination
- Indicates the destination string.
-
- @param[in] CHAR8 IN *Source
- Indicates the source string.
-
- @param[in] UINT8 IN Size
- the length of the string
-
-**/
-VOID
-SwapStringChars (
- IN CHAR8 *Destination,
- IN CHAR8 *Source,
- IN UINT32 Size
- )
-{
- UINT32 Index;
- CHAR8 Temp;
-
- for (Index = 0; Index < Size; Index += 2) {
-
- Temp = Source[Index + 1];
- Destination[Index + 1] = Source[Index];
- Destination[Index] = Temp;
- }
-}
-
-//
-// ReleaseIdeResources
-//
-/**
- Release resources of an IDE device before stopping it.
-
- @param[in] *IdeBlkIoDevice Standard IDE device private data structure
-
-**/
-VOID
-ReleaseIdeResources (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice
- )
-{
- if (IdeBlkIoDevice == NULL) {
- return ;
- }
-
- //
- // Release all the resourses occupied by the IDE_BLK_IO_DEV
- //
-
- if (IdeBlkIoDevice->SenseData != NULL) {
- gBS->FreePool (IdeBlkIoDevice->SenseData);
- IdeBlkIoDevice->SenseData = NULL;
- }
-
- if (IdeBlkIoDevice->Cache != NULL) {
- gBS->FreePool (IdeBlkIoDevice->Cache);
- IdeBlkIoDevice->Cache = NULL;
- }
-
- if (IdeBlkIoDevice->pIdData != NULL) {
- gBS->FreePool (IdeBlkIoDevice->pIdData);
- IdeBlkIoDevice->pIdData = NULL;
- }
-
- if (IdeBlkIoDevice->pInquiryData != NULL) {
- gBS->FreePool (IdeBlkIoDevice->pInquiryData);
- IdeBlkIoDevice->pInquiryData = NULL;
- }
-
- if (IdeBlkIoDevice->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (IdeBlkIoDevice->ControllerNameTable);
- IdeBlkIoDevice->ControllerNameTable = NULL;
- }
-
- if (IdeBlkIoDevice->IoPort != NULL) {
- gBS->FreePool (IdeBlkIoDevice->IoPort);
- }
-
- if (IdeBlkIoDevice->DevicePath != NULL) {
- gBS->FreePool (IdeBlkIoDevice->DevicePath);
- }
-
- if (IdeBlkIoDevice->ExitBootServiceEvent != NULL) {
- gBS->CloseEvent (IdeBlkIoDevice->ExitBootServiceEvent);
- IdeBlkIoDevice->ExitBootServiceEvent = NULL;
- }
-
- gBS->FreePool (IdeBlkIoDevice);
- IdeBlkIoDevice = NULL;
-
- return ;
-}
-
-//
-// SetDeviceTransferMode
-//
-/**
- Set the calculated Best transfer mode to a detected device
-
- @param[in] *IdeDev Standard IDE device private data structure
- @param[in] *TransferMode The device transfer mode to be set
-
- @return Set transfer mode Command execute status
-
-**/
-EFI_STATUS
-SetDeviceTransferMode (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN ATA_TRANSFER_MODE *TransferMode
- )
-// TODO: function comment is missing 'Routine Description:'
-{
- EFI_STATUS Status;
- UINT8 DeviceSelect;
- UINT8 SectorCount;
-
- DeviceSelect = 0;
- DeviceSelect = (UINT8) ((IdeDev->Device) << 4);
- SectorCount = *((UINT8 *) TransferMode);
-
- //
- // Send SET FEATURE command (sub command 0x03) to set pio mode.
- //
- Status = AtaNonDataCommandIn (
- IdeDev,
- SET_FEATURES_CMD,
- DeviceSelect,
- 0x03,
- SectorCount,
- 0,
- 0,
- 0
- );
-
- return Status;
-}
-
-/**
- Send ATA command into device with NON_DATA protocol
-
- @param IdeDev Standard IDE device private data structure
- @param AtaCommand The ATA command to be sent
- @param Device The value in Device register
- @param Feature The value in Feature register
- @param SectorCount The value in SectorCount register
- @param LbaLow The value in LBA_LOW register
- @param LbaMiddle The value in LBA_MIDDLE register
- @param LbaHigh The value in LBA_HIGH register
-
- @retval EFI_SUCCESS Reading succeed
- @retval EFI_ABORTED Command failed
- @retval EFI_DEVICE_ERROR Device status error
-
-**/
-EFI_STATUS
-AtaNonDataCommandIn (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINT8 AtaCommand,
- IN UINT8 Device,
- IN UINT8 Feature,
- IN UINT8 SectorCount,
- IN UINT8 LbaLow,
- IN UINT8 LbaMiddle,
- IN UINT8 LbaHigh
- )
-{
- EFI_STATUS Status;
- UINT8 StatusRegister;
-
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Select device (bit4), set LBA mode(bit6) (use 0xe0 for compatibility)
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((IdeDev->Device << 4) | 0xe0)
- );
-
- //
- // ATA commands for ATA device must be issued when DRDY is set
- //
- Status = DRDYReady (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Pass parameter into device register block
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Head, Device);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, Feature);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, LbaLow);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, LbaMiddle);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, LbaHigh);
-
- //
- // Send command via Command Register
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, AtaCommand);
-
- //
- // Wait for command completion
- // For ATA_SMART_CMD, we may need more timeout to let device
- // adjust internal states.
- //
- if (AtaCommand == ATA_SMART_CMD) {
- Status = WaitForBSYClear (IdeDev, ATASMARTTIMEOUT);
- } else {
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- }
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);
- if ((StatusRegister & ERR) == ERR) {
- //
- // Failed to execute command, abort operation
- //
- return EFI_ABORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Send ATA Ext command into device with NON_DATA protocol
-
- @param IdeDev Standard IDE device private data structure
- @param AtaCommand The ATA command to be sent
- @param Device The value in Device register
- @param Feature The value in Feature register
- @param SectorCount The value in SectorCount register
- @param LbaAddress The LBA address in 48-bit mode
-
- @retval EFI_SUCCESS Reading succeed
- @retval EFI_ABORTED Command failed
- @retval EFI_DEVICE_ERROR Device status error
-
-**/
-EFI_STATUS
-AtaNonDataCommandInExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINT8 AtaCommand,
- IN UINT8 Device,
- IN UINT16 Feature,
- IN UINT16 SectorCount,
- IN EFI_LBA LbaAddress
- )
-{
- EFI_STATUS Status;
- UINT8 StatusRegister;
- UINT8 SectorCount8;
- UINT8 Feature8;
- UINT8 LbaLow;
- UINT8 LbaMid;
- UINT8 LbaHigh;
-
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Select device (bit4), set LBA mode(bit6) (use 0xe0 for compatibility)
- //
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- (UINT8) ((IdeDev->Device << 4) | 0xe0)
- );
-
- //
- // ATA commands for ATA device must be issued when DRDY is set
- //
- Status = DRDYReady (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Pass parameter into device register block
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Head, Device);
-
- //
- // Fill the feature register, which is a two-byte FIFO. Need write twice.
- //
- Feature8 = (UINT8) (Feature >> 8);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, Feature8);
-
- Feature8 = (UINT8) Feature;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Feature, Feature8);
-
- //
- // Fill the sector count register, which is a two-byte FIFO. Need write twice.
- //
- SectorCount8 = (UINT8) (SectorCount >> 8);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount8);
-
- SectorCount8 = (UINT8) SectorCount;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorCount, SectorCount8);
-
- //
- // Fill the start LBA registers, which are also two-byte FIFO
- //
- LbaLow = (UINT8) RShiftU64 (LbaAddress, 24);
- LbaMid = (UINT8) RShiftU64 (LbaAddress, 32);
- LbaHigh = (UINT8) RShiftU64 (LbaAddress, 40);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, LbaLow);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, LbaMid);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, LbaHigh);
-
- LbaLow = (UINT8) LbaAddress;
- LbaMid = (UINT8) RShiftU64 (LbaAddress, 8);
- LbaHigh = (UINT8) RShiftU64 (LbaAddress, 16);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->SectorNumber, LbaLow);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderLsb, LbaMid);
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->CylinderMsb, LbaHigh);
-
- //
- // Send command via Command Register
- //
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Command, AtaCommand);
-
- //
- // Wait for command completion
- //
- Status = WaitForBSYClear (IdeDev, ATATIMEOUT);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);
- if ((StatusRegister & ERR) == ERR) {
- //
- // Failed to execute command, abort operation
- //
- return EFI_ABORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// SetDriveParameters
-//
-/**
- Set drive parameters for devices not support PACKETS command
-
- @param[in] IdeDev Standard IDE device private data structure
- @param[in] DriveParameters The device parameters to be set into the disk
-
- @return SetParameters Command execute status
-
-**/
-EFI_STATUS
-SetDriveParameters (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN ATA_DRIVE_PARMS *DriveParameters
- )
-{
- EFI_STATUS Status;
- UINT8 DeviceSelect;
-
- DeviceSelect = 0;
- DeviceSelect = (UINT8) ((IdeDev->Device) << 4);
-
- //
- // Send Init drive parameters
- //
- Status = AtaNonDataCommandIn (
- IdeDev,
- INIT_DRIVE_PARAM_CMD,
- (UINT8) (DeviceSelect + DriveParameters->Heads),
- 0,
- DriveParameters->Sector,
- 0,
- 0,
- 0
- );
-
- //
- // Send Set Multiple parameters
- //
- Status = AtaNonDataCommandIn (
- IdeDev,
- SET_MULTIPLE_MODE_CMD,
- DeviceSelect,
- 0,
- DriveParameters->MultipleSector,
- 0,
- 0,
- 0
- );
- return Status;
-}
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- @retval EFI_SUCCESS TODO: Add description for return value
-
-**/
-EFI_STATUS
-EnableInterrupt (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-{
- UINT8 DeviceControl;
-
- //
- // Enable interrupt for DMA operation
- //
- DeviceControl = 0;
- IDEWritePortB (IdeDev->PciIo, IdeDev->IoPort->Alt.DeviceControl, DeviceControl);
-
- return EFI_SUCCESS;
-}
-
-/**
- Clear pending IDE interrupt before OS loader/kernel take control of the IDE device.
-
- @param[in] Event Pointer to this event
- @param[in] Context Event hanlder private data
-
-**/
-VOID
-EFIAPI
-ClearInterrupt (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINT64 IoPortForBmis;
- UINT8 RegisterValue;
- IDE_BLK_IO_DEV *IdeDev;
-
- //
- // Get our context
- //
- IdeDev = (IDE_BLK_IO_DEV *) Context;
-
- //
- // Obtain IDE IO port registers' base addresses
- //
- Status = ReassignIdeResources (IdeDev);
- if (EFI_ERROR (Status)) {
- return;
- }
-
- //
- // Check whether interrupt is pending
- //
-
- //
- // Reset IDE device to force it de-assert interrupt pin
- // Note: this will reset all devices on this IDE channel
- //
- AtaSoftReset (IdeDev);
- if (EFI_ERROR (Status)) {
- return;
- }
-
- //
- // Get base address of IDE Bus Master Status Regsiter
- //
- if (IdePrimary == IdeDev->Channel) {
- IoPortForBmis = IdeDev->IoPort->BusMasterBaseAddr + BMISP_OFFSET;
- } else {
- if (IdeSecondary == IdeDev->Channel) {
- IoPortForBmis = IdeDev->IoPort->BusMasterBaseAddr + BMISS_OFFSET;
- } else {
- return;
- }
- }
- //
- // Read BMIS register and clear ERROR and INTR bit
- //
- IdeDev->PciIo->Io.Read (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmis,
- 1,
- &RegisterValue
- );
-
- RegisterValue |= (BMIS_INTERRUPT | BMIS_ERROR);
-
- IdeDev->PciIo->Io.Write (
- IdeDev->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_IO_PASS_THROUGH_BAR,
- IoPortForBmis,
- 1,
- &RegisterValue
- );
-
- //
- // Select the other device on this channel to ensure this device to release the interrupt pin
- //
- if (IdeDev->Device == 0) {
- RegisterValue = (1 << 4) | 0xe0;
- } else {
- RegisterValue = (0 << 4) | 0xe0;
- }
- IDEWritePortB (
- IdeDev->PciIo,
- IdeDev->IoPort->Head,
- RegisterValue
- );
-
-}
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.h b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.h
deleted file mode 100644
index ec1f9e0..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/ide.h
+++ /dev/null
@@ -1,1328 +0,0 @@
-/** @file
- Header file for IDE Bus Driver, containing the helper functions'
- entire prototype.
-
- Copyright (c) 2006 - 2007 Intel Corporation. <BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- @par Revision Reference:
- 2002-6: Add Atapi6 enhancement, support >120GB hard disk, including
- Add - IDEBlkIoReadBlocksExt() func definition
- Add - IDEBlkIoWriteBlocksExt() func definition
-
-**/
-
-#ifndef _IDE_H
-#define _IDE_H
-
-//
-// Helper functions Prototype
-//
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Controller TODO: add argument description
- @param Handle TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-DeRegisterIdeDevice (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_HANDLE Handle
- )
-;
-
-/**
- TODO: Add function description
-
- @param Controller TODO: add argument description
- @param PciIo TODO: add argument description
- @param ParentDevicePath TODO: add argument description
- @param RemainingDevicePath TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EnableIdeDevice (
- IN EFI_HANDLE Controller,
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-/**
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
-
- TODO: add return values
-
-**/
-UINT8
-IDEReadPortB (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port
- )
-;
-
-/**
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
- @param Count TODO: add argument description
- @param Buffer TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-IDEReadPortWMultiple (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINTN Count,
- OUT VOID *Buffer
- )
-;
-
-/**
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
- @param Data TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-IDEWritePortB (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINT8 Data
- )
-;
-
-/**
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
- @param Data TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-IDEWritePortW (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINT16 Data
- )
-;
-
-/**
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Port TODO: add argument description
- @param Count TODO: add argument description
- @param Buffer TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-IDEWritePortWMultiple (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT16 Port,
- IN UINTN Count,
- IN VOID *Buffer
- )
-;
-
-/**
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param IdeRegsBaseAddr TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-GetIdeRegistersBaseAddr (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-ReassignIdeResources (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-DiscoverIdeDevice (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- This interface is used to initialize all state data related to the
- detection of one channel.
-
- @retval EFI_SUCCESS Completed successfully.
-
-**/
-EFI_STATUS
-InitializeIDEChannelData (
- VOID
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-DetectIDEController (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param TimeoutInMilliSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-DRQClear (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param TimeoutInMilliSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-DRQClear2 (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param TimeoutInMilliSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-DRQReady (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param TimeoutInMilliSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-DRQReady2 (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param TimeoutInMilliSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-WaitForBSYClear (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param TimeoutInMilliSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-WaitForBSYClear2 (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN TimeoutInMilliSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param DelayInMilliSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-DRDYReady (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN DelayInMilliSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param DelayInMilliSeconds TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-DRDYReady2 (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN DelayInMilliSeconds
- )
-;
-
-/**
- TODO: Add function description
-
- @param Destination TODO: add argument description
- @param Source TODO: add argument description
- @param Size TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-SwapStringChars (
- IN CHAR8 *Destination,
- IN CHAR8 *Source,
- IN UINT32 Size
- )
-;
-
-//
-// ATA device functions' prototype
-//
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-ATAIdentify (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-PrintAtaModuleName (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param Buffer TODO: add argument description
- @param ByteCount TODO: add argument description
- @param AtaCommand TODO: add argument description
- @param Head TODO: add argument description
- @param SectorCount TODO: add argument description
- @param SectorNumber TODO: add argument description
- @param CylinderLsb TODO: add argument description
- @param CylinderMsb TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaPioDataIn (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *Buffer,
- IN UINT32 ByteCount,
- IN UINT8 AtaCommand,
- IN UINT8 Head,
- IN UINT8 SectorCount,
- IN UINT8 SectorNumber,
- IN UINT8 CylinderLsb,
- IN UINT8 CylinderMsb
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param Buffer TODO: add argument description
- @param ByteCount TODO: add argument description
- @param AtaCommand TODO: add argument description
- @param Head TODO: add argument description
- @param SectorCount TODO: add argument description
- @param SectorNumber TODO: add argument description
- @param CylinderLsb TODO: add argument description
- @param CylinderMsb TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaPioDataOut (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *Buffer,
- IN UINT32 ByteCount,
- IN UINT8 AtaCommand,
- IN UINT8 Head,
- IN UINT8 SectorCount,
- IN UINT8 SectorNumber,
- IN UINT8 CylinderLsb,
- IN UINT8 CylinderMsb
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-CheckErrorStatus (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param DataBuffer TODO: add argument description
- @param Lba TODO: add argument description
- @param NumberOfBlocks TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaReadSectors (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param BufferData TODO: add argument description
- @param Lba TODO: add argument description
- @param NumberOfBlocks TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaWriteSectors (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *BufferData,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaSoftReset (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeBlkIoDevice TODO: add argument description
- @param MediaId TODO: add argument description
- @param LBA TODO: add argument description
- @param BufferSize TODO: add argument description
- @param Buffer TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaBlkIoReadBlocks (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeBlkIoDevice TODO: add argument description
- @param MediaId TODO: add argument description
- @param LBA TODO: add argument description
- @param BufferSize TODO: add argument description
- @param Buffer TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaBlkIoWriteBlocks (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-;
-
-//
-// ATAPI device functions' prototype
-//
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-ATAPIIdentify (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiInquiry (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param Packet TODO: add argument description
- @param Buffer TODO: add argument description
- @param ByteCount TODO: add argument description
- @param TimeOut TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiPacketCommandIn (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN ATAPI_PACKET_COMMAND *Packet,
- IN UINT16 *Buffer,
- IN UINT32 ByteCount,
- IN UINTN TimeOut
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param Packet TODO: add argument description
- @param Buffer TODO: add argument description
- @param ByteCount TODO: add argument description
- @param TimeOut TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiPacketCommandOut (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN ATAPI_PACKET_COMMAND *Packet,
- IN UINT16 *Buffer,
- IN UINT32 ByteCount,
- IN UINTN TimeOut
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param Buffer TODO: add argument description
- @param ByteCount TODO: add argument description
- @param Read TODO: add argument description
- @param TimeOut TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-PioReadWriteData (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINT16 *Buffer,
- IN UINT32 ByteCount,
- IN BOOLEAN Read,
- IN UINTN TimeOut
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiTestUnitReady (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT UINTN *SenseCount
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param SenseCounts TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiRequestSense (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT UINTN *SenseCounts
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiReadCapacity (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT UINTN *SenseCount
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param MediaChange TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiDetectMedia (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT BOOLEAN *MediaChange
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param Buffer TODO: add argument description
- @param Lba TODO: add argument description
- @param NumberOfBlocks TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiReadSectors (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *Buffer,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param Buffer TODO: add argument description
- @param Lba TODO: add argument description
- @param NumberOfBlocks TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiWriteSectors (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *Buffer,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiSoftReset (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeBlkIoDevice TODO: add argument description
- @param MediaId TODO: add argument description
- @param LBA TODO: add argument description
- @param BufferSize TODO: add argument description
- @param Buffer TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiBlkIoReadBlocks (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeBlkIoDevice TODO: add argument description
- @param MediaId TODO: add argument description
- @param LBA TODO: add argument description
- @param BufferSize TODO: add argument description
- @param Buffer TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiBlkIoWriteBlocks (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param SenseCount TODO: add argument description
- @param Result TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-ParseSenseData (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINTN SenseCount,
- OUT SENSE_RESULT *Result
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtapiReadPendingData (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param WriteProtected TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-IsLS120orZipWriteProtected (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT BOOLEAN *WriteProtected
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeBlkIoDevice TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-ReleaseIdeResources (
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param TransferMode TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-SetDeviceTransferMode (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN ATA_TRANSFER_MODE *TransferMode
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param NativeMaxAddress TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-ReadNativeMaxAddress (
- IN IDE_BLK_IO_DEV *IdeDev,
- OUT EFI_LBA *NativeMaxAddress
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param MaxAddress TODO: add argument description
- @param bVolatile TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-SetMaxAddress (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN EFI_LBA MaxAddress,
- IN BOOLEAN bVolatile
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param AtaCommand TODO: add argument description
- @param Device TODO: add argument description
- @param Feature TODO: add argument description
- @param SectorCount TODO: add argument description
- @param LbaLow TODO: add argument description
- @param LbaMiddle TODO: add argument description
- @param LbaHigh TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaNonDataCommandIn (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINT8 AtaCommand,
- IN UINT8 Device,
- IN UINT8 Feature,
- IN UINT8 SectorCount,
- IN UINT8 LbaLow,
- IN UINT8 LbaMiddle,
- IN UINT8 LbaHigh
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param AtaCommand TODO: add argument description
- @param Device TODO: add argument description
- @param Feature TODO: add argument description
- @param SectorCount TODO: add argument description
- @param LbaAddress TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaNonDataCommandInExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINT8 AtaCommand,
- IN UINT8 Device,
- IN UINT16 Feature,
- IN UINT16 SectorCount,
- IN EFI_LBA LbaAddress
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param DataBuffer TODO: add argument description
- @param StartLba TODO: add argument description
- @param NumberOfBlocks TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaReadSectorsExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param DataBuffer TODO: add argument description
- @param StartLba TODO: add argument description
- @param NumberOfBlocks TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaWriteSectorsExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param DataBuffer TODO: add argument description
- @param StartLba TODO: add argument description
- @param NumberOfBlocks TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaUdmaReadExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param DataBuffer TODO: add argument description
- @param StartLba TODO: add argument description
- @param NumberOfBlocks TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaUdmaRead (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param DataBuffer TODO: add argument description
- @param StartLba TODO: add argument description
- @param NumberOfBlocks TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaUdmaWriteExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-;
-
-/**
- Perform an ATA Udma operation (Read, ReadExt, Write, WriteExt).
-
- @param[in] *IdeDev
- pointer pointing to IDE_BLK_IO_DEV data structure, used
- to record all the information of the IDE device.
-
- @param[in] *DataBuffer
- A pointer to the source buffer for the data.
-
- @param[in] StartLba
- The starting logical block address to write to
- on the device media.
-
- @param[in] NumberOfBlocks
- The number of transfer data blocks.
-
- @param[in] UdmaOp
- The perform operations could be AtaUdmaReadOp, AtaUdmaReadExOp,
- AtaUdmaWriteOp, AtaUdmaWriteExOp
-
- @return The device status of UDMA operation. If the operation is
- successful, return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-DoAtaUdma (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks,
- IN ATA_UDMA_OPERATION UdmaOp
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param DataBuffer TODO: add argument description
- @param StartLba TODO: add argument description
- @param NumberOfBlocks TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaUdmaWrite (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *DataBuffer,
- IN EFI_LBA StartLba,
- IN UINTN NumberOfBlocks
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param AtaCommand TODO: add argument description
- @param Device TODO: add argument description
- @param Feature TODO: add argument description
- @param SectorCount TODO: add argument description
- @param LbaAddress TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaCommandIssueExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINT8 AtaCommand,
- IN UINT8 Device,
- IN UINT16 Feature,
- IN UINT16 SectorCount,
- IN EFI_LBA LbaAddress
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param AtaCommand TODO: add argument description
- @param Device TODO: add argument description
- @param Feature TODO: add argument description
- @param SectorCount TODO: add argument description
- @param LbaAddress TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaCommandIssue (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN UINT8 AtaCommand,
- IN UINT8 Device,
- IN UINT16 Feature,
- IN UINT16 SectorCount,
- IN EFI_LBA LbaAddress
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaAtapi6Identify (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-VOID
-AtaSMARTSupport (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param Buffer TODO: add argument description
- @param ByteCount TODO: add argument description
- @param AtaCommand TODO: add argument description
- @param StartLba TODO: add argument description
- @param SectorCount TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaPioDataInExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN OUT VOID *Buffer,
- IN UINT32 ByteCount,
- IN UINT8 AtaCommand,
- IN EFI_LBA StartLba,
- IN UINT16 SectorCount
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param Buffer TODO: add argument description
- @param ByteCount TODO: add argument description
- @param AtaCommand TODO: add argument description
- @param StartLba TODO: add argument description
- @param SectorCount TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-AtaPioDataOutExt (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN VOID *Buffer,
- IN UINT32 ByteCount,
- IN UINT8 AtaCommand,
- IN EFI_LBA StartLba,
- IN UINT16 SectorCount
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
- @param DriveParameters TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-SetDriveParameters (
- IN IDE_BLK_IO_DEV *IdeDev,
- IN ATA_DRIVE_PARMS *DriveParameters
- )
-;
-
-/**
- TODO: Add function description
-
- @param IdeDev TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EnableInterrupt (
- IN IDE_BLK_IO_DEV *IdeDev
- )
-;
-
-/**
- Clear pending IDE interrupt before OS loader/kernel take control of the IDE device.
-
- @param[in] Event Pointer to this event
- @param[in] Context Event hanlder private data
-
- @retval EFI_SUCCESS - Interrupt cleared
-
-**/
-VOID
-EFIAPI
-ClearInterrupt (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.c b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.c
deleted file mode 100644
index c45238c..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.c
+++ /dev/null
@@ -1,1377 +0,0 @@
-/** @file
- Copyright (c) 2006 - 2007 Intel Corporation. <BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- @par Revision Reference:
- This module is modified from DXE\IDE module for Ide Contriller Init support
-
-**/
-
-#include "idebus.h"
-
-#define PCI_CLASS_MASS_STORAGE 0x01
-#define PCI_SUB_CLASS_IDE 0x01
-
-
-//
-// IDE Bus Driver Binding Protocol Instance
-//
-EFI_DRIVER_BINDING_PROTOCOL gIDEBusDriverBinding = {
- IDEBusDriverBindingSupported,
- IDEBusDriverBindingStart,
- IDEBusDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-//
-// ***********************************************************************************
-// IDEBusDriverBindingSupported
-// ***********************************************************************************
-//
-/**
- Register Driver Binding protocol for this driver.
-
- @param[in] This -- A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- @param[in] ControllerHandle -- The handle of the controller to test.
- @param[in] RemainingDevicePath -- A pointer to the remaining portion of a device path.
-
- @retval EFI_SUCCESS Driver loaded.
- @retval other Driver not loaded.
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-// TODO: Controller - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_DEV_PATH *Node;
- EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeInit;
-
- if (RemainingDevicePath != NULL) {
- Node = (EFI_DEV_PATH *) RemainingDevicePath;
- if (Node->DevPath.Type != MESSAGING_DEVICE_PATH ||
- Node->DevPath.SubType != MSG_ATAPI_DP ||
- DevicePathNodeLength(&Node->DevPath) != sizeof(ATAPI_DEVICE_PATH)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Close protocol, don't use device path protocol in the .Support() function
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- //
- // Verify the Ide Controller Init Protocol, which installed by the
- // IdeController module.
- // Note 1: PciIo protocol has been opened BY_DRIVER by ide_init, so We can't
- // open BY_DRIVER here) That's why we don't check pciio protocol
- // Note 2: ide_init driver check ide controller's pci config space, so we dont
- // check here any more to save code size
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiIdeControllerInitProtocolGuid,
- (VOID **) &IdeInit,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- //
- // If protocols were opened normally, closed it
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiIdeControllerInitProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-//
-// ***********************************************************************************
-// IDEBusDriverBindingStart
-// ***********************************************************************************
-//
-/**
- Start this driver on Controller by detecting all disks and installing
- BlockIo protocol on them.
-
- @param This Protocol instance pointer.
- @param Controller Handle of device to bind driver to.
- @param RemainingDevicePath Not used, always produce all possible children.
-
- @retval EFI_SUCCESS This driver is added to ControllerHandle.
- @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle.
- @retval other This driver does not support this device.
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_STATUS SavedStatus;
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_DEV_PATH *Node;
- UINT8 IdeChannel;
- UINT8 BeginningIdeChannel;
- UINT8 EndIdeChannel;
- UINT8 IdeDevice;
- UINT8 BeginningIdeDevice;
- UINT8 EndIdeDevice;
- IDE_BLK_IO_DEV *IdeBlkIoDevice[IdeMaxChannel][IdeMaxDevice];
- IDE_BLK_IO_DEV *IdeBlkIoDevicePtr;
- IDE_REGISTERS_BASE_ADDR IdeRegsBaseAddr[IdeMaxChannel];
- ATA_TRANSFER_MODE TransferMode;
- ATA_DRIVE_PARMS DriveParameters;
- EFI_DEV_PATH NewNode;
- UINT8 ConfigurationOptions;
- UINT16 CommandBlockBaseAddr;
- UINT16 ControlBlockBaseAddr;
- UINTN DataSize;
- IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;
-
- //
- // Local variables declaration for IdeControllerInit support
- //
- EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeInit;
- BOOLEAN EnumAll;
- BOOLEAN ChannelEnabled;
- UINT8 MaxDevices;
- EFI_IDENTIFY_DATA IdentifyData;
- EFI_ATA_COLLECTIVE_MODE *SupportedModes;
-
- IdeBusDriverPrivateData = NULL;
- SupportedModes = NULL;
-
- //
- // Perform IdeBus initialization
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if ((EFI_ERROR (Status)) && (Status != EFI_ALREADY_STARTED)) {
- return Status;
- }
-
- //
- // Now open the IDE_CONTROLLER_INIT protocol. Step7.1
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiIdeControllerInitProtocolGuid,
- (VOID **) &IdeInit,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- //
- // The following OpenProtocol function with _GET_PROTOCOL attribute and
- // will not return EFI_ALREADY_STARTED, so save it for now
- //
- SavedStatus = Status;
-
- if ((EFI_ERROR (Status)) && (Status != EFI_ALREADY_STARTED)) {
- DEBUG ((EFI_D_ERROR, "Open Init, Status=%x", Status));
- //
- // open protocol is not SUCCESS or not ALREADY_STARTED, error exit
- //
- goto ErrorExit;
- }
-
- //
- // Save Enumall. Step7.2
- //
- EnumAll = IdeInit->EnumAll;
-
- //
- // Consume PCI I/O protocol. Note that the OpenProtocol with _GET_PROTOCOL
- // attribute will not return EFI_ALREADY_STARTED
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Open PciIo, Status=%x", Status));
- goto ErrorExit;
- }
-
- //
- // We must check EFI_ALREADY_STARTED because many ATAPI devices are removable
- //
- if (SavedStatus != EFI_ALREADY_STARTED) {
- IdeBusDriverPrivateData = AllocatePool (sizeof (IDE_BUS_DRIVER_PRIVATE_DATA));
- if (IdeBusDriverPrivateData == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
-
- ZeroMem (IdeBusDriverPrivateData, sizeof (IDE_BUS_DRIVER_PRIVATE_DATA));
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Controller,
- &gEfiCallerIdGuid,
- IdeBusDriverPrivateData,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- } else {
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiCallerIdGuid,
- (VOID **) &IdeBusDriverPrivateData,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- IdeBusDriverPrivateData = NULL;
- goto ErrorExit;
- }
- }
-
- Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationEnable,
- EFI_PCI_DEVICE_ENABLE,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- //
- // Read the environment variable that contains the IDEBus Driver's
- // Config options that were set by the Driver Configuration Protocol
- //
- DataSize = sizeof (ConfigurationOptions);
- Status = gRT->GetVariable (
- (CHAR16 *) L"Configuration",
- &gEfiCallerIdGuid,
- NULL,
- &DataSize,
- &ConfigurationOptions
- );
- if (EFI_ERROR (Status)) {
- ConfigurationOptions = 0x0f;
- }
-
- if (EnumAll) {
- //
- // If IdeInit->EnumAll is TRUE, must enumerate all IDE device anyway
- //
- BeginningIdeChannel = IdePrimary;
- EndIdeChannel = IdeSecondary;
- BeginningIdeDevice = IdeMaster;
- EndIdeDevice = IdeSlave;
- } else if (RemainingDevicePath == NULL) {
- //
- // RemainingDevicePath is NULL, scan IDE bus for each device;
- //
- BeginningIdeChannel = IdePrimary;
- EndIdeChannel = IdeSecondary;
- BeginningIdeDevice = IdeMaster;
- //
- // default, may be redefined by IdeInit
- //
- EndIdeDevice = IdeSlave;
- } else {
- //
- // RemainingDevicePath is not NULL, only scan the specified device.
- //
- Node = (EFI_DEV_PATH *) RemainingDevicePath;
- BeginningIdeChannel = Node->Atapi.PrimarySecondary;
- EndIdeChannel = BeginningIdeChannel;
- BeginningIdeDevice = Node->Atapi.SlaveMaster;
- EndIdeDevice = BeginningIdeDevice;
- }
-
- //
- // Obtain IDE IO port registers' base addresses
- //
- Status = GetIdeRegistersBaseAddr (PciIo, IdeRegsBaseAddr);
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- //
- // Report status code: begin IdeBus initialization
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_RESET),
- ParentDevicePath
- );
-
- //
- // Strictly follow the enumeration based on IDE_CONTROLLER_INIT protocol
- //
- for (IdeChannel = BeginningIdeChannel; IdeChannel <= EndIdeChannel; IdeChannel++) {
-
- IdeInit->NotifyPhase (IdeInit, EfiIdeBeforeChannelEnumeration, IdeChannel);
-
- //
- // now obtain channel information fron IdeControllerInit protocol. Step9
- //
- Status = IdeInit->GetChannelInfo (
- IdeInit,
- IdeChannel,
- &ChannelEnabled,
- &MaxDevices
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "[GetChannel, Status=%x]", Status));
- continue;
- }
-
- if (!ChannelEnabled) {
- continue;
- }
-
- EndIdeDevice = (UINT8) EFI_MIN ((MaxDevices - 1), EndIdeDevice);
-
- //
- // Now inform the IDE Controller Init Module. Sept10
- //
- IdeInit->NotifyPhase (IdeInit, EfiIdeBeforeChannelReset, IdeChannel);
-
- //
- // No reset channel function implemented. Sept11
- //
- IdeInit->NotifyPhase (IdeInit, EfiIdeAfterChannelReset, IdeChannel);
-
- //
- // Step13
- //
- IdeInit->NotifyPhase (
- IdeInit,
- EfiIdeBusBeforeDevicePresenceDetection,
- IdeChannel
- );
-
- //
- // Prepare to detect IDE device of this channel
- //
- InitializeIDEChannelData ();
-
- //
- // -- 1st inner loop --- Master/Slave ------------ Step14
- //
- for (IdeDevice = BeginningIdeDevice; IdeDevice <= EndIdeDevice; IdeDevice++) {
- //
- // Check whether the configuration options allow this device
- //
- if (!(ConfigurationOptions & (1 << (IdeChannel * 2 + IdeDevice)))) {
- continue;
- }
-
- //
- // The device has been scanned in another Start(), No need to scan it again
- // for perf optimization.
- //
- if (IdeBusDriverPrivateData->HaveScannedDevice[IdeChannel * 2 + IdeDevice]) {
- continue;
- }
-
- //
- // create child handle for the detected device.
- //
- IdeBlkIoDevice[IdeChannel][IdeDevice] = AllocatePool (sizeof (IDE_BLK_IO_DEV));
- if (IdeBlkIoDevice[IdeChannel][IdeDevice] == NULL) {
- continue;
- }
-
- IdeBlkIoDevicePtr = IdeBlkIoDevice[IdeChannel][IdeDevice];
-
- ZeroMem (IdeBlkIoDevicePtr, sizeof (IDE_BLK_IO_DEV));
-
- IdeBlkIoDevicePtr->Signature = IDE_BLK_IO_DEV_SIGNATURE;
- IdeBlkIoDevicePtr->Channel = (EFI_IDE_CHANNEL) IdeChannel;
- IdeBlkIoDevicePtr->Device = (EFI_IDE_DEVICE) IdeDevice;
-
- //
- // initialize Block IO interface's Media pointer
- //
- IdeBlkIoDevicePtr->BlkIo.Media = &IdeBlkIoDevicePtr->BlkMedia;
-
- //
- // Initialize IDE IO port addresses, including Command Block registers
- // and Control Block registers
- //
- IdeBlkIoDevicePtr->IoPort = AllocatePool (sizeof (IDE_BASE_REGISTERS));
- if (IdeBlkIoDevicePtr->IoPort == NULL) {
- continue;
- }
-
- ZeroMem (IdeBlkIoDevicePtr->IoPort, sizeof (IDE_BASE_REGISTERS));
- CommandBlockBaseAddr = IdeRegsBaseAddr[IdeChannel].CommandBlockBaseAddr;
- ControlBlockBaseAddr = IdeRegsBaseAddr[IdeChannel].ControlBlockBaseAddr;
-
- IdeBlkIoDevicePtr->IoPort->Data = CommandBlockBaseAddr;
- (*(UINT16 *) &IdeBlkIoDevicePtr->IoPort->Reg1) = (UINT16) (CommandBlockBaseAddr + 0x01);
- IdeBlkIoDevicePtr->IoPort->SectorCount = (UINT16) (CommandBlockBaseAddr + 0x02);
- IdeBlkIoDevicePtr->IoPort->SectorNumber = (UINT16) (CommandBlockBaseAddr + 0x03);
- IdeBlkIoDevicePtr->IoPort->CylinderLsb = (UINT16) (CommandBlockBaseAddr + 0x04);
- IdeBlkIoDevicePtr->IoPort->CylinderMsb = (UINT16) (CommandBlockBaseAddr + 0x05);
- IdeBlkIoDevicePtr->IoPort->Head = (UINT16) (CommandBlockBaseAddr + 0x06);
- (*(UINT16 *) &IdeBlkIoDevicePtr->IoPort->Reg) = (UINT16) (CommandBlockBaseAddr + 0x07);
-
- (*(UINT16 *) &IdeBlkIoDevicePtr->IoPort->Alt) = ControlBlockBaseAddr;
- IdeBlkIoDevicePtr->IoPort->DriveAddress = (UINT16) (ControlBlockBaseAddr + 0x01);
-
- IdeBlkIoDevicePtr->IoPort->MasterSlave = (UINT16) ((IdeDevice == IdeMaster) ? 1 : 0);
-
- IdeBlkIoDevicePtr->PciIo = PciIo;
- IdeBlkIoDevicePtr->IdeBusDriverPrivateData = IdeBusDriverPrivateData;
- IdeBlkIoDevicePtr->IoPort->BusMasterBaseAddr = IdeRegsBaseAddr[IdeChannel].BusMasterBaseAddr;
-
- //
- // Report Status code: is about to detect IDE drive
- //
- REPORT_STATUS_CODE_EX (
- EFI_PROGRESS_CODE,
- (EFI_IO_BUS_ATA_ATAPI | EFI_P_PC_PRESENCE_DETECT),
- 0,
- &gEfiCallerIdGuid,
- NULL,
- NULL,
- 0
- );
-
- //
- // Discover device, now!
- //
- PERF_START (0, "DiscoverIdeDevice", "IDE", 0);
- Status = DiscoverIdeDevice (IdeBlkIoDevicePtr);
- PERF_END (0, "DiscoverIdeDevice", "IDE", 0);
-
- IdeBusDriverPrivateData->HaveScannedDevice[IdeChannel * 2 + IdeDevice] = TRUE;
- IdeBusDriverPrivateData->DeviceProcessed[IdeChannel * 2 + IdeDevice] = FALSE;
-
- if (!EFI_ERROR (Status)) {
- //
- // Set Device Path
- //
- ZeroMem (&NewNode, sizeof (NewNode));
- NewNode.DevPath.Type = MESSAGING_DEVICE_PATH;
- NewNode.DevPath.SubType = MSG_ATAPI_DP;
- SetDevicePathNodeLength (&NewNode.DevPath, sizeof (ATAPI_DEVICE_PATH));
-
- NewNode.Atapi.PrimarySecondary = (UINT8) IdeBlkIoDevicePtr->Channel;
- NewNode.Atapi.SlaveMaster = (UINT8) IdeBlkIoDevicePtr->Device;
- NewNode.Atapi.Lun = IdeBlkIoDevicePtr->Lun;
- IdeBlkIoDevicePtr->DevicePath = AppendDevicePathNode (
- ParentDevicePath,
- &NewNode.DevPath
- );
- if (IdeBlkIoDevicePtr->DevicePath == NULL) {
- ReleaseIdeResources (IdeBlkIoDevicePtr);
- continue;
- }
-
- //
- // Submit identify data to IDE controller init driver
- //
- CopyMem (&IdentifyData, IdeBlkIoDevicePtr->pIdData, sizeof (IdentifyData));
- IdeBusDriverPrivateData->DeviceFound[IdeChannel * 2 + IdeDevice] = TRUE;
- IdeInit->SubmitData (IdeInit, IdeChannel, IdeDevice, &IdentifyData);
- } else {
- //
- // Device detection failed
- //
- IdeBusDriverPrivateData->DeviceFound[IdeChannel * 2 + IdeDevice] = FALSE;
- IdeInit->SubmitData (IdeInit, IdeChannel, IdeDevice, NULL);
- ReleaseIdeResources (IdeBlkIoDevicePtr);
- IdeBlkIoDevicePtr = NULL;
- }
- //
- // end of 1st inner loop ---
- //
- }
- //
- // end of 1st outer loop =========
- //
- }
-
- //
- // = 2nd outer loop == Primary/Secondary =================
- //
- for (IdeChannel = BeginningIdeChannel; IdeChannel <= EndIdeChannel; IdeChannel++) {
-
- //
- // -- 2nd inner loop --- Master/Slave --------
- //
- for (IdeDevice = BeginningIdeDevice; IdeDevice <= EndIdeDevice; IdeDevice++) {
-
- if (IdeBusDriverPrivateData->DeviceProcessed[IdeChannel * 2 + IdeDevice]) {
- continue;
- }
-
- if (!IdeBusDriverPrivateData->DeviceFound[IdeChannel * 2 + IdeDevice]) {
- continue;
- }
-
- Status = IdeInit->CalculateMode (
- IdeInit,
- IdeChannel,
- IdeDevice,
- &SupportedModes
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "[bStStp20S=%x]", Status));
- continue;
- }
-
- IdeBlkIoDevicePtr = IdeBlkIoDevice[IdeChannel][IdeDevice];
-
- //
- // Set best supported PIO mode on this IDE device
- //
- if (SupportedModes->PioMode.Mode <= ATA_PIO_MODE_2) {
- TransferMode.ModeCategory = ATA_MODE_CATEGORY_DEFAULT_PIO;
- } else {
- TransferMode.ModeCategory = ATA_MODE_CATEGORY_FLOW_PIO;
- }
-
- TransferMode.ModeNumber = (UINT8) (SupportedModes->PioMode.Mode);
-
- if (SupportedModes->ExtModeCount == 0){
- Status = SetDeviceTransferMode (IdeBlkIoDevicePtr, &TransferMode);
-
- if (EFI_ERROR (Status)) {
- IdeBusDriverPrivateData->DeviceFound[IdeChannel * 2 + IdeDevice] = FALSE;
- ReleaseIdeResources (IdeBlkIoDevicePtr);
- IdeBlkIoDevicePtr = NULL;
- continue;
- }
- }
-
- //
- // Set supported DMA mode on this IDE device. Note that UDMA & MDMA cann't
- // be set together. Only one DMA mode can be set to a device. If setting
- // DMA mode operation fails, we can continue moving on because we only use
- // PIO mode at boot time. DMA modes are used by certain kind of OS booting
- //
- if (SupportedModes->UdmaMode.Valid) {
-
- TransferMode.ModeCategory = ATA_MODE_CATEGORY_UDMA;
- TransferMode.ModeNumber = (UINT8) (SupportedModes->UdmaMode.Mode);
- Status = SetDeviceTransferMode (IdeBlkIoDevicePtr, &TransferMode);
-
- if (EFI_ERROR (Status)) {
- IdeBusDriverPrivateData->DeviceFound[IdeChannel * 2 + IdeDevice] = FALSE;
- ReleaseIdeResources (IdeBlkIoDevicePtr);
- IdeBlkIoDevicePtr = NULL;
- continue;
- }
- //
- // Record Udma Mode
- //
- IdeBlkIoDevicePtr->UdmaMode.Valid = TRUE;
- IdeBlkIoDevicePtr->UdmaMode.Mode = SupportedModes->UdmaMode.Mode;
- EnableInterrupt (IdeBlkIoDevicePtr);
- } else if (SupportedModes->MultiWordDmaMode.Valid) {
-
- TransferMode.ModeCategory = ATA_MODE_CATEGORY_MDMA;
- TransferMode.ModeNumber = (UINT8) SupportedModes->MultiWordDmaMode.Mode;
- Status = SetDeviceTransferMode (IdeBlkIoDevicePtr, &TransferMode);
-
- if (EFI_ERROR (Status)) {
- IdeBusDriverPrivateData->DeviceFound[IdeChannel * 2 + IdeDevice] = FALSE;
- ReleaseIdeResources (IdeBlkIoDevicePtr);
- IdeBlkIoDevicePtr = NULL;
- continue;
- }
-
- EnableInterrupt (IdeBlkIoDevicePtr);
- }
- //
- // Init driver parameters
- //
- DriveParameters.Sector = (UINT8) IdeBlkIoDevicePtr->pIdData->AtaData.sectors_per_track;
- DriveParameters.Heads = (UINT8) (IdeBlkIoDevicePtr->pIdData->AtaData.heads - 1);
- DriveParameters.MultipleSector = (UINT8) IdeBlkIoDevicePtr->pIdData->AtaData.multi_sector_cmd_max_sct_cnt;
- //
- // Set Parameters for the device:
- // 1) Init
- // 2) Establish the block count for READ/WRITE MULTIPLE (EXT) command
- //
- if ((IdeBlkIoDevicePtr->Type == IdeHardDisk) || (IdeBlkIoDevicePtr->Type == Ide48bitAddressingHardDisk)) {
- Status = SetDriveParameters (IdeBlkIoDevicePtr, &DriveParameters);
- }
-
- //
- // Record PIO mode used in private data
- //
- IdeBlkIoDevicePtr->PioMode = (ATA_PIO_MODE) SupportedModes->PioMode.Mode;
-
- //
- // Set IDE controller Timing Blocks in the PCI Configuration Space
- //
- IdeInit->SetTiming (IdeInit, IdeChannel, IdeDevice, SupportedModes);
-
- //
- // Add Component Name for the IDE/ATAPI device that was discovered.
- //
- IdeBlkIoDevicePtr->ControllerNameTable = NULL;
- ADD_NAME (IdeBlkIoDevicePtr);
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &IdeBlkIoDevicePtr->Handle,
- &gEfiDevicePathProtocolGuid,
- IdeBlkIoDevicePtr->DevicePath,
- &gEfiBlockIoProtocolGuid,
- &IdeBlkIoDevicePtr->BlkIo,
- &gEfiDiskInfoProtocolGuid,
- &IdeBlkIoDevicePtr->DiskInfo,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- ReleaseIdeResources (IdeBlkIoDevicePtr);
- }
-
- gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- IdeBlkIoDevicePtr->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
-
- IdeBusDriverPrivateData->DeviceProcessed[IdeChannel * 2 + IdeDevice] = TRUE;
-
- //
- // Report status code: device eanbled!
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- (EFI_IO_BUS_ATA_ATAPI | EFI_P_PC_ENABLE),
- IdeBlkIoDevicePtr->DevicePath
- );
-
- //
- // Create event to clear pending IDE interrupt
- //
- Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_NOTIFY,
- ClearInterrupt,
- IdeBlkIoDevicePtr,
- &IdeBlkIoDevicePtr->ExitBootServiceEvent
- );
-
- //
- // end of 2nd inner loop ----
- //
- }
- //
- // end of 2nd outer loop ==========
- //
- }
-
- //
- // All configurations done! Notify IdeController to do post initialization
- // work such as saving IDE controller PCI settings for S3 resume
- //
- IdeInit->NotifyPhase (IdeInit, EfiIdeBusPhaseMaximum, 0);
-
- if (SupportedModes != NULL) {
- gBS->FreePool (SupportedModes);
- }
-
- PERF_START (0, "Finish IDE detection", "IDE", 1);
- PERF_END (0, "Finish IDE detection", "IDE", 0);
-
- return EFI_SUCCESS;
-
-ErrorExit:
-
- //
- // Report error code: controller error
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_EC_CONTROLLER_ERROR),
- ParentDevicePath
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiIdeControllerInitProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- gBS->UninstallMultipleProtocolInterfaces (
- Controller,
- &gEfiCallerIdGuid,
- IdeBusDriverPrivateData,
- NULL
- );
-
- if (IdeBusDriverPrivateData != NULL) {
- gBS->FreePool (IdeBusDriverPrivateData);
- }
-
- if (SupportedModes != NULL) {
- gBS->FreePool (SupportedModes);
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-
-}
-
-//
-// ***********************************************************************************
-// IDEBusDriverBindingStop
-// ***********************************************************************************
-//
-/**
- Stop this driver on Controller Handle.
-
- @param This Protocol instance pointer.
- @param DeviceHandle Handle of device to stop driver on
- @param NumberOfChildren Not used
- @param ChildHandleBuffer Not used
-
- @retval EFI_SUCCESS This driver is removed DeviceHandle
- @retval other This driver was not removed from this device
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-// TODO: Controller - add argument and description to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- BOOLEAN AllChildrenStopped;
- UINTN Index;
- IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;
-
- IdeBusDriverPrivateData = NULL;
-
- if (NumberOfChildren == 0) {
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationDisable,
- EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE,
- NULL
- );
- }
-
- gBS->OpenProtocol (
- Controller,
- &gEfiCallerIdGuid,
- (VOID **) &IdeBusDriverPrivateData,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- gBS->UninstallMultipleProtocolInterfaces (
- Controller,
- &gEfiCallerIdGuid,
- IdeBusDriverPrivateData,
- NULL
- );
-
- if (IdeBusDriverPrivateData != NULL) {
- gBS->FreePool (IdeBusDriverPrivateData);
- }
- //
- // Close the bus driver
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiIdeControllerInitProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return EFI_SUCCESS;
- }
-
- AllChildrenStopped = TRUE;
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
-
- Status = DeRegisterIdeDevice (This, Controller, ChildHandleBuffer[Index]);
-
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// ***********************************************************************************
-// DeRegisterIdeDevice
-// ***********************************************************************************
-//
-/**
- Deregister an IDE device and free resources
-
- @param This Protocol instance pointer.
- @param Controller Ide device handle
- @param Handle Handle of device to deregister driver on
-
- @return EFI_STATUS
-
-**/
-EFI_STATUS
-DeRegisterIdeDevice (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_HANDLE Handle
- )
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
- IDE_BLK_IO_DEV *IdeBlkIoDevice;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINTN Index;
-
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (BlkIo);
-
- //
- // Report Status code: Device disabled
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- (EFI_IO_BUS_ATA_ATAPI | EFI_P_PC_DISABLE),
- IdeBlkIoDevice->DevicePath
- );
-
- //
- // Close the child handle
- //
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Handle
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Handle,
- &gEfiDevicePathProtocolGuid,
- IdeBlkIoDevice->DevicePath,
- &gEfiBlockIoProtocolGuid,
- &IdeBlkIoDevice->BlkIo,
- &gEfiDiskInfoProtocolGuid,
- &IdeBlkIoDevice->DiskInfo,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- return Status;
- }
-
- //
- // Release allocated resources
- //
- Index = IdeBlkIoDevice->Channel * 2 + IdeBlkIoDevice->Device;
- IdeBlkIoDevice->IdeBusDriverPrivateData->HaveScannedDevice[Index] = FALSE;
-
- ReleaseIdeResources (IdeBlkIoDevice);
-
- return EFI_SUCCESS;
-}
-
-//
-// ***********************************************************************************
-// IDEBlkIoReset
-// ***********************************************************************************
-//
-/**
- TODO: This - add argument and description to function comment
- TODO: ExtendedVerification - add argument and description to function comment
- TODO: EFI_DEVICE_ERROR - add return value to function comment
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBlkIoReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-{
- IDE_BLK_IO_DEV *IdeBlkIoDevice;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (This);
- //
- // Requery IDE IO resources in case of the switch of native and legacy modes
- //
- ReassignIdeResources (IdeBlkIoDevice);
-
- //
- // for ATA device, using ATA reset method
- //
- if (IdeBlkIoDevice->Type == IdeHardDisk ||
- IdeBlkIoDevice->Type == Ide48bitAddressingHardDisk) {
- Status = AtaSoftReset (IdeBlkIoDevice);
- goto Done;
- }
-
- if (IdeBlkIoDevice->Type == IdeUnknown) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- //
- // for ATAPI device, using ATAPI reset method
- //
- Status = AtapiSoftReset (IdeBlkIoDevice);
- if (ExtendedVerification) {
- Status = AtaSoftReset (IdeBlkIoDevice);
- }
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-/**
- Read data from block io device
-
- @param This Protocol instance pointer.
- @param MediaId The media ID of the device
- @param LBA Starting LBA address to read data
- @param BufferSize The size of data to be read
- @param Buffer Caller supplied buffer to save data
-
- @return read data status
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBlkIoReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-{
- IDE_BLK_IO_DEV *IdeBlkIoDevice;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (This);
-
- //
- // Requery IDE IO resources in case of the switch of native and legacy modes
- //
- ReassignIdeResources (IdeBlkIoDevice);
-
- //
- // For ATA compatible device, use ATA read block's mechanism
- //
- if (IdeBlkIoDevice->Type == IdeHardDisk ||
- IdeBlkIoDevice->Type == Ide48bitAddressingHardDisk) {
- Status = AtaBlkIoReadBlocks (
- IdeBlkIoDevice,
- MediaId,
- LBA,
- BufferSize,
- Buffer
- );
- goto Done;
- }
-
- if (IdeBlkIoDevice->Type == IdeUnknown) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- //
- // for ATAPI device, using ATAPI read block's mechanism
- //
- Status = AtapiBlkIoReadBlocks (
- IdeBlkIoDevice,
- MediaId,
- LBA,
- BufferSize,
- Buffer
- );
-
-Done:
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-/**
- Write data to block io device
-
- @param This Protocol instance pointer.
- @param MediaId The media ID of the device
- @param LBA Starting LBA address to write data
- @param BufferSize The size of data to be written
- @param Buffer Caller supplied buffer to save data
-
- @return write data status
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBlkIoWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-{
- IDE_BLK_IO_DEV *IdeBlkIoDevice;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_THIS (This);
- //
- // Requery IDE IO resources in case of the switch of native and legacy modes
- //
- ReassignIdeResources (IdeBlkIoDevice);
-
- //
- // for ATA device, using ATA write block's mechanism
- //
- if (IdeBlkIoDevice->Type == IdeHardDisk ||
- IdeBlkIoDevice->Type == Ide48bitAddressingHardDisk) {
-
- Status = AtaBlkIoWriteBlocks (
- IdeBlkIoDevice,
- MediaId,
- LBA,
- BufferSize,
- Buffer
- );
- goto Done;
- }
-
- if (IdeBlkIoDevice->Type == IdeUnknown) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- //
- // for ATAPI device, using ATAPI write block's mechanism
- //
- Status = AtapiBlkIoWriteBlocks (
- IdeBlkIoDevice,
- MediaId,
- LBA,
- BufferSize,
- Buffer
- );
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-//
-// ***********************************************************************************
-// IDEBlkIoFlushBlocks
-// ***********************************************************************************
-//
-/**
- TODO: This - add argument and description to function comment
- TODO: EFI_SUCCESS - add return value to function comment
-**/
-EFI_STATUS
-EFIAPI
-IDEBlkIoFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-{
- //
- // return directly
- //
- return EFI_SUCCESS;
-}
-
-/**
- Return the results of the Inquiry command to a drive in InquiryData.
- Data format of Inquiry data is defined by the Interface GUID.
-
- @param This Protocol instance pointer.
- @param InquiryData Results of Inquiry command to device
- @param InquiryDataSize Size of InquiryData in bytes.
-
- @retval EFI_SUCCESS InquiryData valid
- @retval EFI_NOT_FOUND Device does not support this data class
- @retval EFI_DEVICE_ERROR Error reading InquiryData from device
- @retval EFI_BUFFER_TOO_SMALL IntquiryDataSize not big enough
-
-**/
-EFI_STATUS
-EFIAPI
-IDEDiskInfoInquiry (
- IN EFI_DISK_INFO_PROTOCOL *This,
- IN OUT VOID *InquiryData,
- IN OUT UINT32 *InquiryDataSize
- )
-{
- IDE_BLK_IO_DEV *IdeBlkIoDevice;
-
- IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_DISK_INFO_THIS (This);
-
- if (*InquiryDataSize < sizeof (INQUIRY_DATA)) {
- *InquiryDataSize = sizeof (INQUIRY_DATA);
- return EFI_BUFFER_TOO_SMALL;
- }
-
- if (IdeBlkIoDevice->pInquiryData == NULL) {
- return EFI_NOT_FOUND;
- }
-
- gBS->CopyMem (InquiryData, IdeBlkIoDevice->pInquiryData, sizeof (INQUIRY_DATA));
- *InquiryDataSize = sizeof (INQUIRY_DATA);
-
- return EFI_SUCCESS;
-}
-
-/**
- Return the results of the Identify command to a drive in IdentifyData.
- Data format of Identify data is defined by the Interface GUID.
-
- @param This Protocol instance pointer.
- @param IdentifyData Results of Identify command to device
- @param IdentifyDataSize Size of IdentifyData in bytes.
-
- @retval EFI_SUCCESS IdentifyData valid
- @retval EFI_NOT_FOUND Device does not support this data class
- @retval EFI_DEVICE_ERROR Error reading IdentifyData from device
- @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
-
-**/
-EFI_STATUS
-EFIAPI
-IDEDiskInfoIdentify (
- IN EFI_DISK_INFO_PROTOCOL *This,
- IN OUT VOID *IdentifyData,
- IN OUT UINT32 *IdentifyDataSize
- )
-{
- IDE_BLK_IO_DEV *IdeBlkIoDevice;
-
- IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_DISK_INFO_THIS (This);
-
- if (*IdentifyDataSize < sizeof (EFI_IDENTIFY_DATA)) {
- *IdentifyDataSize = sizeof (EFI_IDENTIFY_DATA);
- return EFI_BUFFER_TOO_SMALL;
- }
-
- if (IdeBlkIoDevice->pIdData == NULL) {
- return EFI_NOT_FOUND;
- }
-
- gBS->CopyMem (IdentifyData, IdeBlkIoDevice->pIdData, sizeof (EFI_IDENTIFY_DATA));
- *IdentifyDataSize = sizeof (EFI_IDENTIFY_DATA);
-
- return EFI_SUCCESS;
-}
-
-/**
- Return the results of the Request Sense command to a drive in SenseData.
- Data format of Sense data is defined by the Interface GUID.
-
- @param This Protocol instance pointer.
- @param SenseData Results of Request Sense command to device
- @param SenseDataSize Size of SenseData in bytes.
- @param SenseDataNumber Type of SenseData
-
- @retval EFI_SUCCESS InquiryData valid
- @retval EFI_NOT_FOUND Device does not support this data class
- @retval EFI_DEVICE_ERROR Error reading InquiryData from device
- @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough
-
-**/
-EFI_STATUS
-EFIAPI
-IDEDiskInfoSenseData (
- IN EFI_DISK_INFO_PROTOCOL *This,
- IN OUT VOID *SenseData,
- IN OUT UINT32 *SenseDataSize,
- OUT UINT8 *SenseDataNumber
- )
-{
- return EFI_NOT_FOUND;
-}
-
-/**
- Return the results of the Request Sense command to a drive in SenseData.
- Data format of Sense data is defined by the Interface GUID.
-
- @param This Protocol instance pointer.
- @param IdeChannel Primary or Secondary
- @param IdeDevice Master or Slave
-
- @retval EFI_SUCCESS IdeChannel and IdeDevice are valid
- @retval EFI_UNSUPPORTED This is not an IDE device
-
-**/
-EFI_STATUS
-EFIAPI
-IDEDiskInfoWhichIde (
- IN EFI_DISK_INFO_PROTOCOL *This,
- OUT UINT32 *IdeChannel,
- OUT UINT32 *IdeDevice
- )
-{
- IDE_BLK_IO_DEV *IdeBlkIoDevice;
-
- IdeBlkIoDevice = IDE_BLOCK_IO_DEV_FROM_DISK_INFO_THIS (This);
- *IdeChannel = IdeBlkIoDevice->Channel;
- *IdeDevice = IdeBlkIoDevice->Device;
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.h b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.h
deleted file mode 100644
index 0b680bd..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.h
+++ /dev/null
@@ -1,392 +0,0 @@
-/** @file
- Header file for IDE Bus Driver.
-
- Copyright (c) 2006 - 2007 Intel Corporation. <BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _IDE_BUS_H
-#define _IDE_BUS_H
-
-
-#include <IndustryStandard/pci22.h>
-#include "idedata.h"
-
-//
-// Extra Definition to porting
-//
-#define EFI_MIN(a, b) (((a) < (b)) ? (a) : (b))
-
-#define MAX_IDE_DEVICE 4
-#define MAX_IDE_CHANNELS 2
-#define MAX_IDE_DRIVES 2
-
-#define INVALID_DEVICE_TYPE 0xff
-#define ATA_DEVICE_TYPE 0x00
-#define ATAPI_DEVICE_TYPE 0x01
-
-typedef struct {
- BOOLEAN HaveScannedDevice[MAX_IDE_DEVICE];
- BOOLEAN DeviceFound[MAX_IDE_DEVICE];
- BOOLEAN DeviceProcessed[MAX_IDE_DEVICE];
-} IDE_BUS_DRIVER_PRIVATE_DATA;
-
-#define IDE_BLK_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('i', 'b', 'i', 'd')
-
-typedef struct {
- UINT32 Signature;
-
- EFI_HANDLE Handle;
- EFI_BLOCK_IO_PROTOCOL BlkIo;
- EFI_BLOCK_IO_MEDIA BlkMedia;
- EFI_DISK_INFO_PROTOCOL DiskInfo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_PCI_IO_PROTOCOL *PciIo;
- IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;
-
- //
- // Local Data for IDE interface goes here
- //
- EFI_IDE_CHANNEL Channel;
- EFI_IDE_DEVICE Device;
- UINT16 Lun;
- IDE_DEVICE_TYPE Type;
-
- IDE_BASE_REGISTERS *IoPort;
- UINT16 AtapiError;
-
- INQUIRY_DATA *pInquiryData;
- EFI_IDENTIFY_DATA *pIdData;
- ATA_PIO_MODE PioMode;
- EFI_ATA_MODE UdmaMode;
- CHAR8 ModelName[41];
- REQUEST_SENSE_DATA *SenseData;
- UINT8 SenseDataNumber;
- UINT8 *Cache;
-
- //
- // ExitBootService Event, it is used to clear pending IDE interrupt
- //
- EFI_EVENT ExitBootServiceEvent;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} IDE_BLK_IO_DEV;
-
-#include "ComponentName.h"
-
-#define IDE_BLOCK_IO_DEV_FROM_THIS(a) CR (a, IDE_BLK_IO_DEV, BlkIo, IDE_BLK_IO_DEV_SIGNATURE)
-#define IDE_BLOCK_IO_DEV_FROM_DISK_INFO_THIS(a) CR (a, IDE_BLK_IO_DEV, DiskInfo, IDE_BLK_IO_DEV_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gIDEBusDriverBinding;
-
-#include "ide.h"
-
-//
-// Prototypes
-// Driver model protocol interface
-//
-/**
- TODO: Add function description
-
- @param ImageHandle TODO: add argument description
- @param SystemTable TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusControllerDriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Controller TODO: add argument description
- @param RemainingDevicePath TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Controller TODO: add argument description
- @param RemainingDevicePath TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param Controller TODO: add argument description
- @param NumberOfChildren TODO: add argument description
- @param ChildHandleBuffer TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-;
-
-//
-// EFI Driver Configuration Functions
-//
-EFI_STATUS
-IDEBusDriverConfigurationSetOptions (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- );
-
-EFI_STATUS
-IDEBusDriverConfigurationOptionsValid (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL
- );
-
-EFI_STATUS
-IDEBusDriverConfigurationForceDefaults (
- IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN UINT32 DefaultType,
- OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
- );
-
-//
-// EFI Driver Diagnostics Functions
-//
-EFI_STATUS
-IDEBusDriverDiagnosticsRunDiagnostics (
- IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
- IN CHAR8 *Language,
- OUT EFI_GUID **ErrorType,
- OUT UINTN *BufferSize,
- OUT CHAR16 **Buffer
- );
-
-//
-// Block I/O Protocol Interface
-//
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param ExtendedVerification TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBlkIoReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param MediaId TODO: add argument description
- @param LBA TODO: add argument description
- @param BufferSize TODO: add argument description
- @param Buffer TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBlkIoReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param MediaId TODO: add argument description
- @param LBA TODO: add argument description
- @param BufferSize TODO: add argument description
- @param Buffer TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBlkIoWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEBlkIoFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-;
-
-/**
- TODO: Add function description
-
- @param PciIo TODO: add argument description
- @param Enable TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-IDERegisterDecodeEnableorDisable (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN BOOLEAN Enable
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param InquiryData TODO: add argument description
- @param IntquiryDataSize TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEDiskInfoInquiry (
- IN EFI_DISK_INFO_PROTOCOL *This,
- IN OUT VOID *InquiryData,
- IN OUT UINT32 *IntquiryDataSize
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param IdentifyData TODO: add argument description
- @param IdentifyDataSize TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEDiskInfoIdentify (
- IN EFI_DISK_INFO_PROTOCOL *This,
- IN OUT VOID *IdentifyData,
- IN OUT UINT32 *IdentifyDataSize
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param SenseData TODO: add argument description
- @param SenseDataSize TODO: add argument description
- @param SenseDataNumber TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEDiskInfoSenseData (
- IN EFI_DISK_INFO_PROTOCOL *This,
- IN OUT VOID *SenseData,
- IN OUT UINT32 *SenseDataSize,
- OUT UINT8 *SenseDataNumber
- )
-;
-
-/**
- TODO: Add function description
-
- @param This TODO: add argument description
- @param IdeChannel TODO: add argument description
- @param IdeDevice TODO: add argument description
-
- TODO: add return values
-
-**/
-EFI_STATUS
-EFIAPI
-IDEDiskInfoWhichIde (
- IN EFI_DISK_INFO_PROTOCOL *This,
- OUT UINT32 *IdeChannel,
- OUT UINT32 *IdeDevice
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.msa b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.msa
deleted file mode 100644
index 89dd978..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idebus.msa
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>IdeBus</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>69FD8E47-A161-4550-B01A-5594CEB2B2B2</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for PS2 keyboard module.</Abstract>
- <Description>IDE bus driver. This driver will enumerate IDE device and export the blockIo
- protocol for every device.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>IdeBus</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>idebus.h</Filename>
- <Filename>ide.h</Filename>
- <Filename>idedata.h</Filename>
- <Filename>idebus.c</Filename>
- <Filename>ide.c</Filename>
- <Filename>ata.c</Filename>
- <Filename>atapi.c</Filename>
- <Filename>ComponentName.c</Filename>
- <Filename>ComponentName.h</Filename>
- <Filename>DriverConfiguration.c</Filename>
- <Filename>DriverDiagnostics.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiIdeControllerInitProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiDiskInfoProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Variables>
- <Variable Usage="ALWAYS_CONSUMED">
- <VariableName>0x0043 0x006F 0x006E 0x0066 0x0069 0x0067 0x0075 0x0072 0x0061 0x0074 0x0069 0x006F 0x006E</VariableName>
- <GuidC_Name>gConfigurationGuid</GuidC_Name>
- </Variable>
- </Variables>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiDiskInfoIdeInterfaceGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gIDEBusDriverBinding</DriverBinding>
- <ComponentName>gIDEBusComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idedata.h b/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idedata.h
deleted file mode 100644
index 277e74f..0000000
--- a/EdkModulePkg/Bus/Pci/IdeBus/Dxe/idedata.h
+++ /dev/null
@@ -1,893 +0,0 @@
-/** @file
- Header file for IDE Bus Driver's Data Structures
-
- Copyright (c) 2006 - 2007 Intel Corporation. <BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _IDE_DATA_H
-#define _IDE_DATA_H
-
-//
-// bit definition
-//
-#define bit0 (1 << 0)
-#define bit1 (1 << 1)
-#define bit2 (1 << 2)
-#define bit3 (1 << 3)
-#define bit4 (1 << 4)
-#define bit5 (1 << 5)
-#define bit6 (1 << 6)
-#define bit7 (1 << 7)
-#define bit8 (1 << 8)
-#define bit9 (1 << 9)
-#define bit10 (1 << 10)
-#define bit11 (1 << 11)
-#define bit12 (1 << 12)
-#define bit13 (1 << 13)
-#define bit14 (1 << 14)
-#define bit15 (1 << 15)
-#define bit16 (1 << 16)
-#define bit17 (1 << 17)
-#define bit18 (1 << 18)
-#define bit19 (1 << 19)
-#define bit20 (1 << 20)
-#define bit21 (1 << 21)
-#define bit22 (1 << 22)
-#define bit23 (1 << 23)
-#define bit24 (1 << 24)
-#define bit25 (1 << 25)
-#define bit26 (1 << 26)
-#define bit27 (1 << 27)
-#define bit28 (1 << 28)
-#define bit29 (1 << 29)
-#define bit30 (1 << 30)
-#define bit31 (1 << 31)
-
-//
-// common constants
-//
-#define STALL_1_MILLI_SECOND 1000 // stall 1 ms
-#define STALL_1_SECOND 1000000 // stall 1 second
-typedef enum {
- IdePrimary = 0,
- IdeSecondary = 1,
- IdeMaxChannel = 2
-} EFI_IDE_CHANNEL;
-
-typedef enum {
- IdeMaster = 0,
- IdeSlave = 1,
- IdeMaxDevice = 2
-} EFI_IDE_DEVICE;
-
-typedef enum {
- IdeMagnetic, /* ZIP Drive or LS120 Floppy Drive */
- IdeCdRom, /* ATAPI CDROM */
- IdeHardDisk, /* Hard Disk */
- Ide48bitAddressingHardDisk, /* Hard Disk larger than 120GB */
- IdeUnknown
-} IDE_DEVICE_TYPE;
-
-typedef enum {
- SenseNoSenseKey,
- SenseDeviceNotReadyNoRetry,
- SenseDeviceNotReadyNeedRetry,
- SenseNoMedia,
- SenseMediaChange,
- SenseMediaError,
- SenseOtherSense
-} SENSE_RESULT;
-
-typedef enum {
- AtaUdmaReadOp,
- AtaUdmaReadExtOp,
- AtaUdmaWriteOp,
- AtaUdmaWriteExtOp
-} ATA_UDMA_OPERATION;
-
-//
-// IDE Registers
-//
-typedef union {
- UINT16 Command; /* when write */
- UINT16 Status; /* when read */
-} IDE_CMD_OR_STATUS;
-
-typedef union {
- UINT16 Error; /* when read */
- UINT16 Feature; /* when write */
-} IDE_ERROR_OR_FEATURE;
-
-typedef union {
- UINT16 AltStatus; /* when read */
- UINT16 DeviceControl; /* when write */
-} IDE_AltStatus_OR_DeviceControl;
-
-//
-// IDE registers set
-//
-typedef struct {
- UINT16 Data;
- IDE_ERROR_OR_FEATURE Reg1;
- UINT16 SectorCount;
- UINT16 SectorNumber;
- UINT16 CylinderLsb;
- UINT16 CylinderMsb;
- UINT16 Head;
- IDE_CMD_OR_STATUS Reg;
-
- IDE_AltStatus_OR_DeviceControl Alt;
- UINT16 DriveAddress;
-
- UINT16 MasterSlave;
- UINT16 BusMasterBaseAddr;
-} IDE_BASE_REGISTERS;
-
-//
-// IDE registers' base addresses
-//
-typedef struct {
- UINT16 CommandBlockBaseAddr;
- UINT16 ControlBlockBaseAddr;
- UINT16 BusMasterBaseAddr;
-} IDE_REGISTERS_BASE_ADDR;
-
-//
-// Bit definitions in Programming Interface byte of the Class Code field
-// in PCI IDE controller's Configuration Space
-//
-#define IDE_PRIMARY_OPERATING_MODE bit0
-#define IDE_PRIMARY_PROGRAMMABLE_INDICATOR bit1
-#define IDE_SECONDARY_OPERATING_MODE bit2
-#define IDE_SECONDARY_PROGRAMMABLE_INDICATOR bit3
-
-//
-// IDE registers bit definitions
-//
-
-//
-// Err Reg
-//
-#define BBK_ERR bit7 /* Bad block detected */
-#define UNC_ERR bit6 /* Uncorrectable Data */
-#define MC_ERR bit5 /* Media Change */
-#define IDNF_ERR bit4 /* ID Not Found */
-#define MCR_ERR bit3 /* Media Change Requested */
-#define ABRT_ERR bit2 /* Aborted Command */
-#define TK0NF_ERR bit1 /* Track 0 Not Found */
-#define AMNF_ERR bit0 /* Address Mark Not Found */
-
-//
-// Device/Head Reg
-//
-#define LBA_MODE bit6
-#define DEV bit4
-#define HS3 bit3
-#define HS2 bit2
-#define HS1 bit1
-#define HS0 bit0
-#define CHS_MODE (0)
-#define DRV0 (0)
-#define DRV1 (1)
-#define MST_DRV DRV0
-#define SLV_DRV DRV1
-
-//
-// Status Reg
-//
-#define BSY bit7 /* Controller Busy */
-#define DRDY bit6 /* Drive Ready */
-#define DWF bit5 /* Drive Write Fault */
-#define DSC bit4 /* Disk Seek Complete */
-#define DRQ bit3 /* Data Request */
-#define CORR bit2 /* Corrected Data */
-#define IDX bit1 /* Index */
-#define ERR bit0 /* Error */
-
-//
-// Device Control Reg
-//
-#define SRST bit2 /* Software Reset */
-#define IEN_L bit1 /* Interrupt Enable #*/
-
-//
-// Bus Master Reg
-//
-#define BMIC_nREAD bit3
-#define BMIC_START bit0
-#define BMIS_INTERRUPT bit2
-#define BMIS_ERROR bit1
-
-#define BMICP_OFFSET 0x00
-#define BMISP_OFFSET 0x02
-#define BMIDP_OFFSET 0x04
-#define BMICS_OFFSET 0x08
-#define BMISS_OFFSET 0x0A
-#define BMIDS_OFFSET 0x0C
-
-//
-// Time Out Value For IDE Device Polling
-//
-
-//
-// ATATIMEOUT is used for waiting time out for ATA device
-//
-
-//
-// 1 second
-//
-#define ATATIMEOUT 1000
-
-//
-// ATAPITIMEOUT is used for waiting operation
-// except read and write time out for ATAPI device
-//
-
-//
-// 1 second
-//
-#define ATAPITIMEOUT 1000
-
-//
-// ATAPILONGTIMEOUT is used for waiting read and
-// write operation timeout for ATAPI device
-//
-
-//
-// 2 seconds
-//
-#define CDROMLONGTIMEOUT 2000
-
-//
-// 5 seconds
-//
-#define ATAPILONGTIMEOUT 5000
-
-//
-// 10 seconds
-//
-#define ATASMARTTIMEOUT 10000
-
-//
-// ATA Commands Code
-//
-#define ATA_INITIALIZE_DEVICE 0x91
-
-//
-// Class 1
-//
-#define IDENTIFY_DRIVE_CMD 0xec
-#define READ_BUFFER_CMD 0xe4
-#define READ_SECTORS_CMD 0x20
-#define READ_SECTORS_WITH_RETRY_CMD 0x21
-#define READ_LONG_CMD 0x22
-#define READ_LONG_WITH_RETRY_CMD 0x23
-//
-// Class 1 - Atapi6 enhanced commands
-//
-#define READ_SECTORS_EXT_CMD 0x24
-
-//
-// Class 2
-//
-#define FORMAT_TRACK_CMD 0x50
-#define WRITE_BUFFER_CMD 0xe8
-#define WRITE_SECTORS_CMD 0x30
-#define WRITE_SECTORS_WITH_RETRY_CMD 0x31
-#define WRITE_LONG_CMD 0x32
-#define WRITE_LONG_WITH_RETRY_CMD 0x33
-#define WRITE_VERIFY_CMD 0x3c
-//
-// Class 2 - Atapi6 enhanced commands
-//
-#define WRITE_SECTORS_EXT_CMD 0x34
-
-//
-// Class 3
-//
-#define ACK_MEDIA_CHANGE_CMD 0xdb
-#define BOOT_POST_BOOT_CMD 0xdc
-#define BOOT_PRE_BOOT_CMD 0xdd
-#define CHECK_POWER_MODE_CMD 0x98
-#define CHECK_POWER_MODE_CMD_ALIAS 0xe5
-#define DOOR_LOCK_CMD 0xde
-#define DOOR_UNLOCK_CMD 0xdf
-#define EXEC_DRIVE_DIAG_CMD 0x90
-#define IDLE_CMD_ALIAS 0x97
-#define IDLE_CMD 0xe3
-#define IDLE_IMMEDIATE_CMD 0x95
-#define IDLE_IMMEDIATE_CMD_ALIAS 0xe1
-#define INIT_DRIVE_PARAM_CMD 0x91
-#define RECALIBRATE_CMD 0x10 /* aliased to 1x */
-#define READ_DRIVE_STATE_CMD 0xe9
-#define SET_MULTIPLE_MODE_CMD 0xC6
-#define READ_DRIVE_STATE_CMD 0xe9
-#define READ_VERIFY_CMD 0x40
-#define READ_VERIFY_WITH_RETRY_CMD 0x41
-#define SEEK_CMD 0x70 /* aliased to 7x */
-#define SET_FEATURES_CMD 0xef
-#define STANDBY_CMD 0x96
-#define STANDBY_CMD_ALIAS 0xe2
-#define STANDBY_IMMEDIATE_CMD 0x94
-#define STANDBY_IMMEDIATE_CMD_ALIAS 0xe0
-
-//
-// Class 4
-//
-#define READ_DMA_CMD 0xc8
-#define READ_DMA_WITH_RETRY_CMD 0xc9
-#define READ_DMA_EXT_CMD 0x25
-#define WRITE_DMA_CMD 0xca
-#define WRITE_DMA_WITH_RETRY_CMD 0xcb
-#define WRITE_DMA_EXT_CMD 0x35
-
-//
-// Class 5
-//
-#define READ_MULTIPLE_CMD 0xc4
-#define REST_CMD 0xe7
-#define RESTORE_DRIVE_STATE_CMD 0xea
-#define SET_SLEEP_MODE_CMD 0x99
-#define SET_SLEEP_MODE_CMD_ALIAS 0xe6
-#define WRITE_MULTIPLE_CMD 0xc5
-#define WRITE_SAME_CMD 0xe9
-
-//
-// Class 6 - Host protected area access feature set
-//
-#define READ_NATIVE_MAX_ADDRESS_CMD 0xf8
-#define SET_MAX_ADDRESS_CMD 0xf9
-
-//
-// Class 6 - ATA/ATAPI-6 enhanced commands
-//
-#define READ_NATIVE_MAX_ADDRESS_EXT_CMD 0x27
-#define SET_MAX_ADDRESS_CMD_EXT 0x37
-
-//
-// Class 6 - SET_MAX related sub command (in feature register)
-//
-#define PARTIES_SET_MAX_ADDRESS_SUB_CMD 0x00
-#define PARTIES_SET_PASSWORD_SUB_CMD 0x01
-#define PARTIES_LOCK_SUB_CMD 0x02
-#define PARTIES_UNLOCK_SUB_CMD 0x03
-#define PARTIES_FREEZE_SUB_CMD 0x04
-
-//
-// S.M.A.R.T
-//
-#define ATA_SMART_CMD 0xb0
-#define ATA_CONSTANT_C2 0xc2
-#define ATA_CONSTANT_4F 0x4f
-#define ATA_SMART_ENABLE_OPERATION 0xd8
-#define ATA_SMART_RETURN_STATUS 0xda
-
-//
-// Error codes for Exec Drive Diag
-//
-#define DRIV_DIAG_NO_ERROR (0x01)
-#define DRIV_DIAG_FORMATTER_ERROR (0x02)
-#define DRIV_DIAG_DATA_BUFFER_ERROR (0x03)
-#define DRIV_DIAG_ECC_CKT_ERRROR (0x04)
-#define DRIV_DIAG_UP_ERROR (0x05)
-#define DRIV_DIAG_SLAVE_DRV_ERROR (0x80) /* aliased to 0x8x */
-
-//
-// Codes for Format Track
-//
-#define FORMAT_GOOD_SECTOR (0x00)
-#define FORMAT_SUSPEND_ALLOC (0x01)
-#define FORMAT_REALLOC_SECTOR (0x02)
-#define FORMAT_MARK_SECTOR_DEFECTIVE (0x03)
-
-//
-// IDE_IDENTIFY bits
-// config bits :
-//
-#define ID_CONFIG_RESERVED0 bit0
-#define ID_CONFIG_HARD_SECTORED_DRIVE bit1
-#define ID_CONFIG_SOFT_SECTORED_DRIVE bit2
-#define ID_CONFIG_NON_MFM bit3
-#define ID_CONFIG_15uS_HEAD_SWITCHING bit4
-#define ID_CONFIG_SPINDLE_MOTOR_CONTROL bit5
-#define ID_CONFIG_HARD_DRIVE bit6
-#define ID_CONFIG_CHANGEABLE_MEDIUM bit7
-#define ID_CONFIG_DATA_RATE_TO_5MHZ bit8
-#define ID_CONFIG_DATA_RATE_5_TO_10MHZ bit9
-#define ID_CONFIG_DATA_RATE_ABOVE_10MHZ bit10
-#define ID_CONFIG_MOTOR_SPEED_TOLERANCE_ABOVE_0_5_PERC bit11
-#define ID_CONFIG_DATA_CLK_OFFSET_AVAIL bit12
-#define ID_CONFIG_TRACK_OFFSET_AVAIL bit13
-#define ID_CONFIG_SPEED_TOLERANCE_GAP_NECESSARY bit14
-#define ID_CONFIG_RESERVED1 bit15
-
-#define ID_DOUBLE_WORD_IO_POSSIBLE bit01
-#define ID_LBA_SUPPORTED bit9
-#define ID_DMA_SUPPORTED bit8
-
-#define SET_FEATURE_ENABLE_8BIT_TRANSFER (0x01)
-#define SET_FEATURE_ENABLE_WRITE_CACHE (0x02)
-#define SET_FEATURE_TRANSFER_MODE (0x03)
-#define SET_FEATURE_WRITE_SAME_WRITE_SPECIFIC_AREA (0x22)
-#define SET_FEATURE_DISABLE_RETRIES (0x33)
-//
-// for Read & Write Longs
-//
-#define SET_FEATURE_VENDOR_SPEC_ECC_LENGTH (0x44)
-#define SET_FEATURE_PLACE_NO_OF_CACHE_SEGMENTS_IN_SECTOR_NO_REG (0x54)
-#define SET_FEATURE_DISABLE_READ_AHEAD (0x55)
-#define SET_FEATURE_MAINTAIN_PARAM_AFTER_RESET (0x66)
-#define SET_FEATURE_DISABLE_ECC (0x77)
-#define SET_FEATURE_DISABLE_8BIT_TRANSFER (0x81)
-#define SET_FEATURE_DISABLE_WRITE_CACHE (0x82)
-#define SET_FEATURE_ENABLE_ECC (0x88)
-#define SET_FEATURE_ENABLE_RETRIES (0x99)
-#define SET_FEATURE_ENABLE_READ_AHEAD (0xaa)
-#define SET_FEATURE_SET_SECTOR_CNT_REG_AS_NO_OF_READ_AHEAD_SECTORS (0xab)
-#define SET_FEATURE_ALLOW_REST_MODE (0xac)
-//
-// for Read & Write Longs
-//
-#define SET_FEATURE_4BYTE_ECC (0xbb)
-#define SET_FEATURE_DEFALUT_FEATURES_ON_SOFTWARE_RESET (0xcc)
-#define SET_FEATURE_WRITE_SAME_TO_WRITE_ENTIRE_MEDIUM (0xdd)
-
-#define BLOCK_TRANSFER_MODE (0x00)
-#define SINGLE_WORD_DMA_TRANSFER_MODE (0x10)
-#define MULTI_WORD_DMA_TRANSFER_MODE (0x20)
-#define TRANSFER_MODE_MASK (0x07) // 3 LSBs
-
-//
-// Drive 0 - Head 0
-//
-#define DEFAULT_DRIVE (0x00)
-#define DEFAULT_CMD (0xa0)
-//
-// default content of device control register, disable INT
-//
-#define DEFAULT_CTL (0x0a)
-#define DEFAULT_IDE_BM_IO_BASE_ADR (0xffa0)
-
-//
-// ATAPI6 related data structure definition
-//
-
-//
-// The maximum sectors count in 28 bit addressing mode
-//
-#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff
-
-//
-// Move the IDENTIFY section to DXE\Protocol\IdeControllerInit
-//
-
-//
-// ATAPI Command
-//
-#define ATAPI_SOFT_RESET_CMD 0x08
-#define ATAPI_PACKET_CMD 0xA0
-#define PACKET_CMD 0xA0
-#define ATAPI_IDENTIFY_DEVICE_CMD 0xA1
-#define ATAPI_SERVICE_CMD 0xA2
-
-//
-// ATAPI Packet Command
-//
-#pragma pack(1)
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1;
- UINT8 reserved_2;
- UINT8 reserved_3;
- UINT8 reserved_4;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
- UINT8 reserved_8;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} TEST_UNIT_READY_CMD;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1 : 4;
- UINT8 lun : 4;
- UINT8 page_code;
- UINT8 reserved_3;
- UINT8 allocation_length;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
- UINT8 reserved_8;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} INQUIRY_CMD;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1 : 4;
- UINT8 lun : 4;
- UINT8 reserved_2;
- UINT8 reserved_3;
- UINT8 allocation_length;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
- UINT8 reserved_8;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} REQUEST_SENSE_CMD;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1 : 4;
- UINT8 lun : 4;
- UINT8 page_code : 4;
- UINT8 page_control : 4;
- UINT8 reserved_3;
- UINT8 reserved_4;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 parameter_list_length_hi;
- UINT8 parameter_list_length_lo;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} MODE_SENSE_CMD;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1 : 5;
- UINT8 lun : 3;
- UINT8 Lba0;
- UINT8 Lba1;
- UINT8 Lba2;
- UINT8 Lba3;
- UINT8 reserved_6;
- UINT8 TranLen0;
- UINT8 TranLen1;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} READ10_CMD;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1;
- UINT8 reserved_2;
- UINT8 reserved_3;
- UINT8 reserved_4;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 allocation_length_hi;
- UINT8 allocation_length_lo;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} READ_FORMAT_CAP_CMD;
-
-typedef union {
- UINT16 Data16[6];
- TEST_UNIT_READY_CMD TestUnitReady;
- READ10_CMD Read10;
- REQUEST_SENSE_CMD RequestSence;
- INQUIRY_CMD Inquiry;
- MODE_SENSE_CMD ModeSense;
- READ_FORMAT_CAP_CMD ReadFormatCapacity;
-} ATAPI_PACKET_COMMAND;
-
-typedef struct {
- UINT32 RegionBaseAddr;
- UINT16 ByteCount;
- UINT16 EndOfTable;
-} IDE_DMA_PRD;
-
-#define MAX_DMA_EXT_COMMAND_SECTORS 0x10000
-#define MAX_DMA_COMMAND_SECTORS 0x100
-
-#pragma pack()
-
-//
-// Packet Command Code
-//
-#define TEST_UNIT_READY 0x00
-#define REZERO 0x01
-#define REQUEST_SENSE 0x03
-#define FORMAT_UNIT 0x04
-#define REASSIGN_BLOCKS 0x07
-#define INQUIRY 0x12
-#define START_STOP_UNIT 0x1B
-#define PREVENT_ALLOW_MEDIA_REMOVAL 0x1E
-#define READ_FORMAT_CAPACITY 0x23
-#define OLD_FORMAT_UNIT 0x24
-#define READ_CAPACITY 0x25
-#define READ_10 0x28
-#define WRITE_10 0x2A
-#define SEEK 0x2B
-#define SEND_DIAGNOSTICS 0x3D
-#define WRITE_VERIFY 0x2E
-#define VERIFY 0x2F
-#define READ_DEFECT_DATA 0x37
-#define WRITE_BUFFER 0x38
-#define READ_BUFFER 0x3C
-#define READ_LONG 0x3E
-#define WRITE_LONG 0x3F
-#define MODE_SELECT 0x55
-#define MODE_SENSE 0x5A
-#define READ_12 0xA8
-#define WRITE_12 0xAA
-#define MAX_ATAPI_BYTE_COUNT (0xfffe)
-
-//
-// Sense Key
-//
-#define REQUEST_SENSE_ERROR (0x70)
-#define SK_NO_SENSE (0x0)
-#define SK_RECOVERY_ERROR (0x1)
-#define SK_NOT_READY (0x2)
-#define SK_MEDIUM_ERROR (0x3)
-#define SK_HARDWARE_ERROR (0x4)
-#define SK_ILLEGAL_REQUEST (0x5)
-#define SK_UNIT_ATTENTION (0x6)
-#define SK_DATA_PROTECT (0x7)
-#define SK_BLANK_CHECK (0x8)
-#define SK_VENDOR_SPECIFIC (0x9)
-#define SK_RESERVED_A (0xA)
-#define SK_ABORT (0xB)
-#define SK_RESERVED_C (0xC)
-#define SK_OVERFLOW (0xD)
-#define SK_MISCOMPARE (0xE)
-#define SK_RESERVED_F (0xF)
-
-//
-// Additional Sense Codes
-//
-#define ASC_NOT_READY (0x04)
-#define ASC_MEDIA_ERR1 (0x10)
-#define ASC_MEDIA_ERR2 (0x11)
-#define ASC_MEDIA_ERR3 (0x14)
-#define ASC_MEDIA_ERR4 (0x30)
-#define ASC_MEDIA_UPSIDE_DOWN (0x06)
-#define ASC_INVALID_CMD (0x20)
-#define ASC_LBA_OUT_OF_RANGE (0x21)
-#define ASC_INVALID_FIELD (0x24)
-#define ASC_WRITE_PROTECTED (0x27)
-#define ASC_MEDIA_CHANGE (0x28)
-#define ASC_RESET (0x29) /* Power On Reset or Bus Reset occurred */
-#define ASC_ILLEGAL_FIELD (0x26)
-#define ASC_NO_MEDIA (0x3A)
-#define ASC_ILLEGAL_MODE_FOR_THIS_TRACK (0x64)
-
-//
-// Additional Sense Code Qualifier
-//
-#define ASCQ_IN_PROGRESS (0x01)
-
-#define SETFEATURE TRUE
-#define CLEARFEATURE FALSE
-
-//
-// ATAPI Data structure
-//
-#pragma pack(1)
-
-typedef struct {
- UINT8 peripheral_type;
- UINT8 RMB;
- UINT8 version;
- UINT8 response_data_format;
- UINT8 addnl_length;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
- UINT8 vendor_info[8];
- UINT8 product_id[12];
- UINT8 eeprom_product_code[4];
- UINT8 firmware_rev_level[4];
- UINT8 firmware_sub_rev_level[1];
- UINT8 reserved_37;
- UINT8 reserved_38;
- UINT8 reserved_39;
- UINT8 max_capacity_hi;
- UINT8 max_capacity_mid;
- UINT8 max_capacity_lo;
- UINT8 reserved_43_95[95 - 43 + 1];
-} INQUIRY_DATA;
-
-typedef struct {
- UINT8 peripheral_type;
- UINT8 RMB;
- UINT8 version;
- UINT8 response_data_format;
- UINT8 addnl_length;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
- UINT8 vendor_info[8];
- UINT8 product_id[16];
- UINT8 product_revision_level[4];
- UINT8 vendor_specific[20];
- UINT8 reserved_56_95[40];
-} CDROM_INQUIRY_DATA;
-
-typedef struct {
- UINT8 error_code : 7;
- UINT8 valid : 1;
- UINT8 reserved_1;
- UINT8 sense_key : 4;
- UINT8 reserved_21 : 1;
- UINT8 ILI : 1;
- UINT8 reserved_22 : 2;
- UINT8 vendor_specific_3;
- UINT8 vendor_specific_4;
- UINT8 vendor_specific_5;
- UINT8 vendor_specific_6;
- UINT8 addnl_sense_length; // n - 7
- UINT8 vendor_specific_8;
- UINT8 vendor_specific_9;
- UINT8 vendor_specific_10;
- UINT8 vendor_specific_11;
- UINT8 addnl_sense_code; // mandatory
- UINT8 addnl_sense_code_qualifier; // mandatory
- UINT8 field_replaceable_unit_code; // optional
- UINT8 reserved_15;
- UINT8 reserved_16;
- UINT8 reserved_17;
- //
- // Followed by additional sense bytes : FIXME
- //
-} REQUEST_SENSE_DATA;
-
-typedef struct {
- UINT8 LastLba3;
- UINT8 LastLba2;
- UINT8 LastLba1;
- UINT8 LastLba0;
- UINT8 BlockSize3;
- UINT8 BlockSize2;
- UINT8 BlockSize1;
- UINT8 BlockSize0;
-} READ_CAPACITY_DATA;
-
-typedef struct {
- UINT8 reserved_0;
- UINT8 reserved_1;
- UINT8 reserved_2;
- UINT8 Capacity_Length;
- UINT8 LastLba3;
- UINT8 LastLba2;
- UINT8 LastLba1;
- UINT8 LastLba0;
- UINT8 DesCode : 2;
- UINT8 reserved_9 : 6;
- UINT8 BlockSize2;
- UINT8 BlockSize1;
- UINT8 BlockSize0;
-} READ_FORMAT_CAPACITY_DATA;
-
-#pragma pack()
-
-//
-// PIO mode definition
-//
-typedef enum {
- ATA_PIO_MODE_BELOW_2,
- ATA_PIO_MODE_2,
- ATA_PIO_MODE_3,
- ATA_PIO_MODE_4
-} ATA_PIO_MODE;
-
-//
-// Multi word DMA definition
-//
-typedef enum {
- ATA_MDMA_MODE_0,
- ATA_MDMA_MODE_1,
- ATA_MDMA_MODE_2
-} ATA_MDMA_MODE;
-
-//
-// UDMA mode definition
-//
-typedef enum {
- ATA_UDMA_MODE_0,
- ATA_UDMA_MODE_1,
- ATA_UDMA_MODE_2,
- ATA_UDMA_MODE_3,
- ATA_UDMA_MODE_4,
- ATA_UDMA_MODE_5
-} ATA_UDMA_MODE;
-
-#define ATA_MODE_CATEGORY_DEFAULT_PIO 0x00
-#define ATA_MODE_CATEGORY_FLOW_PIO 0x01
-#define ATA_MODE_CATEGORY_MDMA 0x04
-#define ATA_MODE_CATEGORY_UDMA 0x08
-
-#pragma pack(1)
-
-typedef struct {
- UINT8 ModeNumber : 3;
- UINT8 ModeCategory : 5;
-} ATA_TRANSFER_MODE;
-
-typedef struct {
- UINT8 Sector;
- UINT8 Heads;
- UINT8 MultipleSector;
-} ATA_DRIVE_PARMS;
-
-#pragma pack()
-//
-// IORDY Sample Point field value
-//
-#define ISP_5_CLK 0
-#define ISP_4_CLK 1
-#define ISP_3_CLK 2
-#define ISP_2_CLK 3
-
-//
-// Recovery Time field value
-//
-#define RECVY_4_CLK 0
-#define RECVY_3_CLK 1
-#define RECVY_2_CLK 2
-#define RECVY_1_CLK 3
-
-//
-// Slave IDE Timing Register Enable
-//
-#define SITRE bit14
-
-//
-// DMA Timing Enable Only Select 1
-//
-#define DTE1 bit7
-
-//
-// Pre-fetch and Posting Enable Select 1
-//
-#define PPE1 bit6
-
-//
-// IORDY Sample Point Enable Select 1
-//
-#define IE1 bit5
-
-//
-// Fast Timing Bank Drive Select 1
-//
-#define TIME1 bit4
-
-//
-// DMA Timing Enable Only Select 0
-//
-#define DTE0 bit3
-
-//
-// Pre-fetch and Posting Enable Select 0
-//
-#define PPE0 bit2
-
-//
-// IOREY Sample Point Enable Select 0
-//
-#define IE0 bit1
-
-//
-// Fast Timing Bank Drive Select 0
-//
-#define TIME0 bit0
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.c
deleted file mode 100644
index b10ee93..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "pcibus.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName = {
- PciBusComponentNameGetDriverName,
- PciBusComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mPciBusDriverNameTable[] = {
- { "eng", (CHAR16 *) L"PCI Bus Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-PciBusComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gPciBusComponentName.SupportedLanguages,
- mPciBusDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-PciBusComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.h
deleted file mode 100644
index 0e5dbde..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/ComponentName.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.h
-
-Abstract:
-
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_BUS_COMPONENT_NAME_H
-#define _EFI_PCI_BUS_COMPONENT_NAME_H
-
-extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName;
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-PciBusComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Language - TODO: add argument description
- DriverName - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciBusComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ControllerHandle - TODO: add argument description
- ChildHandle - TODO: add argument description
- Language - TODO: add argument description
- ControllerName - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa
deleted file mode 100644
index f291218..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciBus.msa
+++ /dev/null
@@ -1,186 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>PciBus</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>93B80004-9FB3-11d4-9A3A-0090273FC14D</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for PciBus module.</Abstract>
- <Description>PCI bus driver. This module will probe all PCI devices and allocate MMIO and IO
- space for these devices. Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable
- support hot plug.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>PciBus</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PciIncompatibleDeviceSupportLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>pcibus.h</Filename>
- <Filename>PciIo.h</Filename>
- <Filename>PciCommand.h</Filename>
- <Filename>PciDeviceSupport.h</Filename>
- <Filename>PciResourceSupport.h</Filename>
- <Filename>PciEnumerator.h</Filename>
- <Filename>PciEnumeratorSupport.h</Filename>
- <Filename>PciOptionRomSupport.h</Filename>
- <Filename>PciRomTable.h</Filename>
- <Filename>PciHotPlugSupport.h</Filename>
- <Filename>PciLib.h</Filename>
- <Filename>PciHotPlugSupport.c</Filename>
- <Filename>PciRomTable.c</Filename>
- <Filename>PciDriverOverride.h</Filename>
- <Filename>PciPowerManagement.h</Filename>
- <Filename>PciPowerManagement.c</Filename>
- <Filename>PciDriverOverride.c</Filename>
- <Filename>PciOptionRomSupport.c</Filename>
- <Filename>PciEnumerator.c</Filename>
- <Filename>PciEnumeratorSupport.c</Filename>
- <Filename>PciResourceSupport.c</Filename>
- <Filename>PciCommand.c</Filename>
- <Filename>ComponentName.h</Filename>
- <Filename>ComponentName.c</Filename>
- <Filename>PciDeviceSupport.c</Filename>
- <Filename>pcibus.c</Filename>
- <Filename>PciIo.c</Filename>
- <Filename>PciLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciRootBridgeIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciPlatformProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiIncompatiblePciDeviceSupportProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciHostBridgeResourceAllocationProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciHotPlugInitProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiUgaIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiBusSpecificDriverOverrideProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiPciHotPlugRequestProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <SystemTables>
- <SystemTableCNames Usage="ALWAYS_CONSUMED">
- <SystemTableCName>gEfiUgaIoProtocolGuid</SystemTableCName>
- </SystemTableCNames>
- <SystemTableCNames Usage="SOMETIMES_CONSUMED">
- <SystemTableCName>gEfiPciOptionRomTableGuid</SystemTableCName>
- </SystemTableCNames>
- </SystemTables>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiPciOptionRomTableGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="PRIVATE">
- <GuidCName>gEfiPciHotplugDeviceGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>PciBusEntryPoint</ModuleEntryPoint>
- </Extern>
- <Extern>
- <DriverBinding>gPciBusDriverBinding</DriverBinding>
- <ComponentName>gPciBusComponentName</ComponentName>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdPciIsaEnable</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>Whether ISA decoding is enabled on this platform so we should avoid those aliased resources</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdPciVgaEnable</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>Whether VGA decoding is enabled on this platform so we should avoid those aliased resources</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdPciBusHotplugDeviceSupport</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>If TRUE, the PCI bus driver will support hot plug device. If not hot plug device is supported, this feature flag can be set to FALSE to save size.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The PCD masks for PCI incompatible devices support</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.c
deleted file mode 100644
index dd4b650..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciCommand.c
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-
-EFI_STATUS
-PciOperateRegister (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT16 Command,
- IN UINT8 Offset,
- IN UINT8 Operation,
- OUT UINT16 *PtrCommand
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: Command - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: Operation - add argument and description to function comment
-// TODO: PtrCommand - add argument and description to function comment
-{
- UINT16 OldCommand;
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
-
- OldCommand = 0;
- PciIo = &PciIoDevice->PciIo;
-
- if (Operation != EFI_SET_REGISTER) {
- Status = PciIoRead (
- PciIo,
- EfiPciIoWidthUint16,
- Offset,
- 1,
- &OldCommand
- );
-
- if (Operation == EFI_GET_REGISTER) {
- *PtrCommand = OldCommand;
- return Status;
- }
- }
-
- if (Operation == EFI_ENABLE_REGISTER) {
- OldCommand = (UINT16) (OldCommand | Command);
- } else if (Operation == EFI_DISABLE_REGISTER) {
- OldCommand = (UINT16) (OldCommand & ~(Command));
- } else {
- OldCommand = Command;
- }
-
- return PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- Offset,
- 1,
- &OldCommand
- );
-}
-
-BOOLEAN
-PciCapabilitySupport (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-{
-
- if (PciIoDevice->Pci.Hdr.Status & EFI_PCI_STATUS_CAPABILITY) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-LocateCapabilityRegBlock (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT8 CapId,
- IN OUT UINT8 *Offset,
- OUT UINT8 *NextRegBlock OPTIONAL
- )
-/*++
-
-Routine Description:
- Locate cap reg.
-
-Arguments:
- PciIoDevice - A pointer to the PCI_IO_DEVICE.
- CapId - The cap ID.
- Offset - A pointer to the offset.
- NextRegBlock - A pointer to the next block.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-{
- UINT8 CapabilityPtr;
- UINT16 CapabilityEntry;
- UINT8 CapabilityID;
-
- //
- // To check the cpability of this device supports
- //
- if (!PciCapabilitySupport (PciIoDevice)) {
- return EFI_UNSUPPORTED;
- }
-
- if (*Offset != 0) {
- CapabilityPtr = *Offset;
- } else {
-
- CapabilityPtr = 0;
- if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
-
- PciIoRead (
- &PciIoDevice->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR,
- 1,
- &CapabilityPtr
- );
- } else {
-
- PciIoRead (
- &PciIoDevice->PciIo,
- EfiPciIoWidthUint8,
- EFI_PCI_CAPABILITY_PTR,
- 1,
- &CapabilityPtr
- );
- }
- }
-
- while (CapabilityPtr > 0x3F) {
- //
- // Mask it to DWORD alignment per PCI spec
- //
- CapabilityPtr &= 0xFC;
- PciIoRead (
- &PciIoDevice->PciIo,
- EfiPciIoWidthUint16,
- CapabilityPtr,
- 1,
- &CapabilityEntry
- );
-
- CapabilityID = (UINT8) CapabilityEntry;
-
- if (CapabilityID == CapId) {
- *Offset = CapabilityPtr;
- if (NextRegBlock != NULL) {
- *NextRegBlock = (UINT8) (CapabilityEntry >> 8);
- }
-
- return EFI_SUCCESS;
- }
-
- CapabilityPtr = (UINT8) (CapabilityEntry >> 8);
- }
-
- return EFI_NOT_FOUND;
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.h
deleted file mode 100644
index e63d0d1..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciCommand.h
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_COMMAND_H
-#define _EFI_PCI_COMMAND_H
-
-//
-// The PCI Command register bits owned by PCI Bus driver.
-//
-// They should be cleared at the beginning. The other registers
-// are owned by chipset, we should not touch them.
-//
-#define EFI_PCI_COMMAND_BITS_OWNED ( \
- EFI_PCI_COMMAND_IO_SPACE | \
- EFI_PCI_COMMAND_MEMORY_SPACE | \
- EFI_PCI_COMMAND_BUS_MASTER | \
- EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE | \
- EFI_PCI_COMMAND_VGA_PALETTE_SNOOP | \
- EFI_PCI_COMMAND_FAST_BACK_TO_BACK \
- )
-
-//
-// The PCI Bridge Control register bits owned by PCI Bus driver.
-//
-// They should be cleared at the beginning. The other registers
-// are owned by chipset, we should not touch them.
-//
-#define EFI_PCI_BRIDGE_CONTROL_BITS_OWNED ( \
- EFI_PCI_BRIDGE_CONTROL_ISA | \
- EFI_PCI_BRIDGE_CONTROL_VGA | \
- EFI_PCI_BRIDGE_CONTROL_VGA_16 | \
- EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK \
- )
-
-//
-// The PCCard Bridge Control register bits owned by PCI Bus driver.
-//
-// They should be cleared at the beginning. The other registers
-// are owned by chipset, we should not touch them.
-//
-#define EFI_PCCARD_BRIDGE_CONTROL_BITS_OWNED ( \
- EFI_PCI_BRIDGE_CONTROL_ISA | \
- EFI_PCI_BRIDGE_CONTROL_VGA | \
- EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK \
- )
-
-
-#define EFI_GET_REGISTER 1
-#define EFI_SET_REGISTER 2
-#define EFI_ENABLE_REGISTER 3
-#define EFI_DISABLE_REGISTER 4
-
-EFI_STATUS
-PciOperateRegister (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT16 Command,
- IN UINT8 Offset,
- IN UINT8 Operation,
- OUT UINT16 *PtrCommand
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- Command - TODO: add argument description
- Offset - TODO: add argument description
- Operation - TODO: add argument description
- PtrCommand - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-PciCapabilitySupport (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-LocateCapabilityRegBlock (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT8 CapId,
- IN OUT UINT8 *Offset,
- OUT UINT8 *NextRegBlock OPTIONAL
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- CapId - TODO: add argument description
- Offset - TODO: add argument description
- NextRegBlock - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-
-#define PciReadCommandRegister(a,b) \
- PciOperateRegister (a,0, PCI_COMMAND_OFFSET, EFI_GET_REGISTER, b)
-
-#define PciSetCommandRegister(a,b) \
- PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_SET_REGISTER, NULL)
-
-#define PciEnableCommandRegister(a,b) \
- PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_ENABLE_REGISTER, NULL)
-
-#define PciDisableCommandRegister(a,b) \
- PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_DISABLE_REGISTER, NULL)
-
-#define PciReadBridgeControlRegister(a,b) \
- PciOperateRegister (a,0, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_GET_REGISTER, b)
-
-#define PciSetBridgeControlRegister(a,b) \
- PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_SET_REGISTER, NULL)
-
-#define PciEnableBridgeControlRegister(a,b) \
- PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_ENABLE_REGISTER, NULL)
-
-#define PciDisableBridgeControlRegister(a,b) \
- PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_DISABLE_REGISTER, NULL)
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c
deleted file mode 100644
index 0e95dc1..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.c
+++ /dev/null
@@ -1,1351 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciDeviceSupport.c
-
-Abstract:
-
- This file provides routine to support Pci device node manipulation
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-#include "PciDeviceSupport.h"
-
-//
-// This device structure is serviced as a header.
-// Its Next field points to the first root bridge device node
-//
-LIST_ENTRY gPciDevicePool;
-
-EFI_STATUS
-InitializePciDevicePool (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initialize the gPciDevicePool
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- InitializeListHead (&gPciDevicePool);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InsertRootBridge (
- PCI_IO_DEVICE *RootBridge
- )
-/*++
-
-Routine Description:
-
- Insert a root bridge into PCI device pool
-
-Arguments:
-
- RootBridge - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- InsertTailList (&gPciDevicePool, &(RootBridge->Link));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InsertPciDevice (
- PCI_IO_DEVICE *Bridge,
- PCI_IO_DEVICE *PciDeviceNode
- )
-/*++
-
-Routine Description:
-
- This function is used to insert a PCI device node under
- a bridge
-
-Arguments:
- Bridge - A pointer to the PCI_IO_DEVICE.
- PciDeviceNode - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- InsertTailList (&Bridge->ChildList, &(PciDeviceNode->Link));
- PciDeviceNode->Parent = Bridge;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DestroyRootBridge (
- IN PCI_IO_DEVICE *RootBridge
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
- RootBridge - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- DestroyPciDeviceTree (RootBridge);
-
- FreePciDevice (RootBridge);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FreePciDevice (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- Destroy a pci device node.
- Also all direct or indirect allocated resource for this node will be freed.
-
-Arguments:
-
- PciIoDevice - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- //
- // Assume all children have been removed underneath this device
- //
- if (PciIoDevice->ResourcePaddingDescriptors != NULL) {
- gBS->FreePool (PciIoDevice->ResourcePaddingDescriptors);
- }
-
- if (PciIoDevice->DevicePath != NULL) {
- gBS->FreePool (PciIoDevice->DevicePath);
- }
-
- gBS->FreePool (PciIoDevice);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DestroyPciDeviceTree (
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- Destroy all the pci device node under the bridge.
- Bridge itself is not included.
-
-Arguments:
-
- Bridge - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- LIST_ENTRY *CurrentLink;
- PCI_IO_DEVICE *Temp;
-
- while (!IsListEmpty (&Bridge->ChildList)) {
-
- CurrentLink = Bridge->ChildList.ForwardLink;
-
- //
- // Remove this node from the linked list
- //
- RemoveEntryList (CurrentLink);
-
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- if (!IsListEmpty (&Temp->ChildList)) {
- DestroyPciDeviceTree (Temp);
- }
-
- FreePciDevice (Temp);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DestroyRootBridgeByHandle (
- EFI_HANDLE Controller
- )
-/*++
-
-Routine Description:
-
- Destroy all device nodes under the root bridge
- specified by Controller.
- The root bridge itself is also included.
-
-Arguments:
-
- Controller - An efi handle.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-{
-
- LIST_ENTRY *CurrentLink;
- PCI_IO_DEVICE *Temp;
-
- CurrentLink = gPciDevicePool.ForwardLink;
-
- while (CurrentLink && CurrentLink != &gPciDevicePool) {
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- if (Temp->Handle == Controller) {
-
- RemoveEntryList (CurrentLink);
-
- DestroyPciDeviceTree (Temp);
-
- FreePciDevice (Temp);
-
- return EFI_SUCCESS;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-RegisterPciDevice (
- IN EFI_HANDLE Controller,
- IN PCI_IO_DEVICE *PciIoDevice,
- OUT EFI_HANDLE *Handle OPTIONAL
- )
-/*++
-
-Routine Description:
-
- This function registers the PCI IO device. It creates a handle for this PCI IO device
- (if the handle does not exist), attaches appropriate protocols onto the handle, does
- necessary initialization, and sets up parent/child relationship with its bus controller.
-
-Arguments:
-
- Controller - An EFI handle for the PCI bus controller.
- PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.
- Handle - A pointer to hold the EFI handle for the PCI IO device.
-
-Returns:
-
- EFI_SUCCESS - The PCI device is successfully registered.
- Others - An error occurred when registering the PCI device.
-
---*/
-{
- EFI_STATUS Status;
- VOID *PlatformOpRomBuffer;
- UINTN PlatformOpRomSize;
- UINT8 PciExpressCapRegOffset;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT8 Data8;
-
- //
- // Install the pciio protocol, device path protocol
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &PciIoDevice->Handle,
- &gEfiDevicePathProtocolGuid,
- PciIoDevice->DevicePath,
- &gEfiPciIoProtocolGuid,
- &PciIoDevice->PciIo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Detect if PCI Express Device
- //
- PciExpressCapRegOffset = 0;
- Status = LocateCapabilityRegBlock (
- PciIoDevice,
- EFI_PCI_CAPABILITY_ID_PCIEXP,
- &PciExpressCapRegOffset,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- PciIoDevice->IsPciExp = TRUE;
- }
-
- //
- // Force Interrupt line to "Unknown" or "No Connection"
- //
- PciIo = &(PciIoDevice->PciIo);
- Data8 = PCI_INT_LINE_UNKNOWN;
- PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &Data8);
-
- //
- // Process Platform OpRom
- //
- if (gPciPlatformProtocol != NULL && !PciIoDevice->AllOpRomProcessed) {
- PciIoDevice->AllOpRomProcessed = TRUE;
-
- Status = gPciPlatformProtocol->GetPciRom (
- gPciPlatformProtocol,
- PciIoDevice->Handle,
- &PlatformOpRomBuffer,
- &PlatformOpRomSize
- );
-
- if (!EFI_ERROR (Status)) {
-
- //
- // Have Platform OpRom
- //
- PciIoDevice->RomSize = PlatformOpRomSize;
- PciIoDevice->PciIo.RomSize = PlatformOpRomSize;
- PciIoDevice->PciIo.RomImage = PlatformOpRomBuffer;
-
- //
- // Process Image
- //
- ProcessOpRomImage (PciIoDevice);
- }
- }
-
- if (PciIoDevice->BusOverride) {
- //
- // Install BusSpecificDriverOverride Protocol
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &PciIoDevice->Handle,
- &gEfiBusSpecificDriverOverrideProtocolGuid,
- &PciIoDevice->PciDriverOverride,
- NULL
- );
- if (EFI_ERROR (Status)) {
- gBS->UninstallMultipleProtocolInterfaces (
- &PciIoDevice->Handle,
- &gEfiDevicePathProtocolGuid,
- PciIoDevice->DevicePath,
- &gEfiPciIoProtocolGuid,
- &PciIoDevice->PciIo,
- NULL
- );
-
- return Status;
- }
- }
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &(PciIoDevice->PciRootBridgeIo),
- gPciBusDriverBinding.DriverBindingHandle,
- PciIoDevice->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Install Pccard Hotplug GUID for Pccard device so that
- // to notify CardBus driver to stop the device when de-register happens
- //
- InstallPciHotplugGuid (PciIoDevice);
-
- if (Handle != NULL) {
- *Handle = PciIoDevice->Handle;
- }
-
- //
- // Indicate the pci device is registered
- //
- PciIoDevice->Registered = TRUE;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-RemoveAllPciDeviceOnBridge (
- EFI_HANDLE RootBridgeHandle,
- PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- This function is used to remove the whole PCI devices from the bridge.
-
-Arguments:
-
- RootBridgeHandle - An efi handle.
- Bridge - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- LIST_ENTRY *CurrentLink;
- PCI_IO_DEVICE *Temp;
-
- while (!IsListEmpty (&Bridge->ChildList)) {
-
- CurrentLink = Bridge->ChildList.ForwardLink;
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- //
- // Check if the current node has been deregistered before
- // If it is not, then deregister it
- //
- if (Temp->Registered) {
- DeRegisterPciDevice (RootBridgeHandle, Temp->Handle);
- }
-
- //
- // Remove this node from the linked list
- //
- RemoveEntryList (CurrentLink);
-
- if (!IsListEmpty (&Temp->ChildList)) {
- RemoveAllPciDeviceOnBridge (RootBridgeHandle, Temp);
- }
-
- FreePciDevice (Temp);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DeRegisterPciDevice (
- IN EFI_HANDLE Controller,
- IN EFI_HANDLE Handle
- )
-/*++
-
-Routine Description:
-
- This function is used to de-register the PCI device from the EFI,
- That includes un-installing PciIo protocol from the specified PCI
- device handle.
-
-Arguments:
-
- Controller - An efi handle.
- Handle - An efi handle.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
- PCI_IO_DEVICE *Node;
- LIST_ENTRY *CurrentLink;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- gPciBusDriverBinding.DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (PciIo);
-
- //
- // If it is already de-registered
- //
- if (!PciIoDevice->Registered) {
- return EFI_SUCCESS;
- }
-
- //
- // If it is PPB, first de-register its children
- //
-
- if (!IsListEmpty (&PciIoDevice->ChildList)) {
-
- CurrentLink = PciIoDevice->ChildList.ForwardLink;
-
- while (CurrentLink && CurrentLink != &PciIoDevice->ChildList) {
- Node = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- Status = DeRegisterPciDevice (Controller, Node->Handle);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
- }
- //
- // Uninstall Pccard Hotplug GUID for Pccard device
- //
- UninstallPciHotplugGuid (PciIoDevice);
-
- //
- // Close the child handle
- //
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiPciRootBridgeIoProtocolGuid,
- gPciBusDriverBinding.DriverBindingHandle,
- Handle
- );
-
- //
- // Un-install the device path protocol and pci io protocol
- //
- if (PciIoDevice->BusOverride) {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Handle,
- &gEfiDevicePathProtocolGuid,
- PciIoDevice->DevicePath,
- &gEfiPciIoProtocolGuid,
- &PciIoDevice->PciIo,
- &gEfiBusSpecificDriverOverrideProtocolGuid,
- &PciIoDevice->PciDriverOverride,
- NULL
- );
- } else {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Handle,
- &gEfiDevicePathProtocolGuid,
- PciIoDevice->DevicePath,
- &gEfiPciIoProtocolGuid,
- &PciIoDevice->PciIo,
- NULL
- );
- }
-
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- Controller,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &PciRootBridgeIo,
- gPciBusDriverBinding.DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- return Status;
- }
-
- //
- // The Device Driver should disable this device after disconnect
- // so the Pci Bus driver will not touch this device any more.
- // Restore the register field to the original value
- //
- PciIoDevice->Registered = FALSE;
- PciIoDevice->Handle = NULL;
- } else {
-
- //
- // Handle may be closed before
- //
- return EFI_SUCCESS;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-StartPciDevicesOnBridge (
- IN EFI_HANDLE Controller,
- IN PCI_IO_DEVICE *RootBridge,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
- IN OUT UINT8 *NumberOfChildren,
- IN OUT EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge
-
-Arguments:
-
- Controller - An efi handle.
- RootBridge - A pointer to the PCI_IO_DEVICE.
- RemainingDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCOL.
- NumberOfChildren - Children number.
- ChildHandleBuffer - A pointer to the child handle buffer.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_NOT_READY - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-{
- PCI_IO_DEVICE *Temp;
- PCI_IO_DEVICE *PciIoDevice;
- EFI_DEV_PATH_PTR Node;
- EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath;
- EFI_STATUS Status;
- LIST_ENTRY *CurrentLink;
- UINT64 Supports;
-
- CurrentLink = RootBridge->ChildList.ForwardLink;
-
- while (CurrentLink && CurrentLink != &RootBridge->ChildList) {
-
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- if (RemainingDevicePath != NULL) {
-
- Node.DevPath = RemainingDevicePath;
-
- if (Node.Pci->Device != Temp->DeviceNumber ||
- Node.Pci->Function != Temp->FunctionNumber) {
- CurrentLink = CurrentLink->ForwardLink;
- continue;
- }
-
- //
- // Check if the device has been assigned with required resource
- //
- if (!Temp->Allocated) {
- return EFI_NOT_READY;
- }
-
- //
- // Check if the current node has been registered before
- // If it is not, register it
- //
- if (!Temp->Registered) {
- PciIoDevice = Temp;
-
- Status = RegisterPciDevice (
- Controller,
- PciIoDevice,
- NULL
- );
-
- }
-
- if (NumberOfChildren != NULL && ChildHandleBuffer != NULL && Temp->Registered) {
- ChildHandleBuffer[*NumberOfChildren] = Temp->Handle;
- (*NumberOfChildren)++;
- }
-
- //
- // Get the next device path
- //
- CurrentDevicePath = EfiNextDevicePathNode (RemainingDevicePath);
- if (EfiIsDevicePathEnd (CurrentDevicePath)) {
- return EFI_SUCCESS;
- }
-
- //
- // If it is a PPB
- //
- if (!IsListEmpty (&Temp->ChildList)) {
- Status = StartPciDevicesOnBridge (
- Controller,
- Temp,
- CurrentDevicePath,
- NumberOfChildren,
- ChildHandleBuffer
- );
-
- Temp->PciIo.Attributes (
- &(Temp->PciIo),
- EfiPciIoAttributeOperationSupported,
- 0,
- &Supports
- );
- Supports &= EFI_PCI_DEVICE_ENABLE;
- Temp->PciIo.Attributes (
- &(Temp->PciIo),
- EfiPciIoAttributeOperationEnable,
- Supports,
- NULL
- );
-
- return Status;
- } else {
-
- //
- // Currently, the PCI bus driver only support PCI-PCI bridge
- //
- return EFI_UNSUPPORTED;
- }
-
- } else {
-
- //
- // If remaining device path is NULL,
- // try to enable all the pci devices under this bridge
- //
-
- if (!Temp->Registered && Temp->Allocated) {
-
- PciIoDevice = Temp;
-
- Status = RegisterPciDevice (
- Controller,
- PciIoDevice,
- NULL
- );
-
- }
-
- if (NumberOfChildren != NULL && ChildHandleBuffer != NULL && Temp->Registered) {
- ChildHandleBuffer[*NumberOfChildren] = Temp->Handle;
- (*NumberOfChildren)++;
- }
-
- if (!IsListEmpty (&Temp->ChildList)) {
- Status = StartPciDevicesOnBridge (
- Controller,
- Temp,
- RemainingDevicePath,
- NumberOfChildren,
- ChildHandleBuffer
- );
-
- Temp->PciIo.Attributes (
- &(Temp->PciIo),
- EfiPciIoAttributeOperationSupported,
- 0,
- &Supports
- );
- Supports &= EFI_PCI_DEVICE_ENABLE;
- Temp->PciIo.Attributes (
- &(Temp->PciIo),
- EfiPciIoAttributeOperationEnable,
- Supports,
- NULL
- );
-
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- continue;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-StartPciDevices (
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- Start to manage the PCI device according to RemainingDevicePath
- If RemainingDevicePath == NULL, the PCI bus driver will start
- to manage all the PCI devices it found previously
-
-Arguments:
- Controller - An efi handle.
- RemainingDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCOL.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_DEV_PATH_PTR Node;
- PCI_IO_DEVICE *RootBridge;
- LIST_ENTRY *CurrentLink;
-
- if (RemainingDevicePath != NULL) {
-
- //
- // Check if the RemainingDevicePath is valid
- //
- Node.DevPath = RemainingDevicePath;
- if ((Node.DevPath->Type != HARDWARE_DEVICE_PATH) ||
- ((Node.DevPath->SubType != HW_PCI_DP) &&
- (DevicePathNodeLength (Node.DevPath) != sizeof (PCI_DEVICE_PATH)))
- ) {
- return EFI_UNSUPPORTED;
- }
- }
-
- CurrentLink = gPciDevicePool.ForwardLink;
-
- while (CurrentLink && CurrentLink != &gPciDevicePool) {
-
- RootBridge = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- //
- // Locate the right root bridge to start
- //
- if (RootBridge->Handle == Controller) {
- StartPciDevicesOnBridge (
- Controller,
- RootBridge,
- RemainingDevicePath,
- NULL,
- NULL
- );
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_SUCCESS;
-}
-
-PCI_IO_DEVICE *
-CreateRootBridge (
- IN EFI_HANDLE RootBridgeHandle
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
- RootBridgeHandle - An efi handle.
-
-Returns:
-
- None
-
---*/
-{
-
- EFI_STATUS Status;
- PCI_IO_DEVICE *Dev;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- Dev = NULL;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (PCI_IO_DEVICE),
- (VOID **) &Dev
- );
-
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- ZeroMem (Dev, sizeof (PCI_IO_DEVICE));
- Dev->Signature = PCI_IO_DEVICE_SIGNATURE;
- Dev->Handle = RootBridgeHandle;
- InitializeListHead (&Dev->ChildList);
-
- Status = gBS->OpenProtocol (
- RootBridgeHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- gPciBusDriverBinding.DriverBindingHandle,
- RootBridgeHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (Dev);
- return NULL;
- }
-
- //
- // Record the root bridge parent device path
- //
- Dev->DevicePath = DuplicateDevicePath (ParentDevicePath);
-
- //
- // Get the pci root bridge io protocol
- //
- Status = gBS->OpenProtocol (
- RootBridgeHandle,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &PciRootBridgeIo,
- gPciBusDriverBinding.DriverBindingHandle,
- RootBridgeHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- FreePciDevice (Dev);
- return NULL;
- }
-
- Dev->PciRootBridgeIo = PciRootBridgeIo;
-
- //
- // Initialize the PCI I/O instance structure
- //
- Status = InitializePciIoInstance (Dev);
- Status = InitializePciDriverOverrideInstance (Dev);
-
- //
- // Initialize reserved resource list and
- // option rom driver list
- //
- InitializeListHead (&Dev->ReservedResourceList);
- InitializeListHead (&Dev->OptionRomDriverList);
-
- return Dev;
-}
-
-PCI_IO_DEVICE *
-GetRootBridgeByHandle (
- EFI_HANDLE RootBridgeHandle
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
- RootBridgeHandle - An efi handle.
-
-Returns:
-
- None
-
---*/
-{
- PCI_IO_DEVICE *RootBridgeDev;
- LIST_ENTRY *CurrentLink;
-
- CurrentLink = gPciDevicePool.ForwardLink;
-
- while (CurrentLink && CurrentLink != &gPciDevicePool) {
-
- RootBridgeDev = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- if (RootBridgeDev->Handle == RootBridgeHandle) {
- return RootBridgeDev;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return NULL;
-}
-
-BOOLEAN
-RootBridgeExisted (
- IN EFI_HANDLE RootBridgeHandle
- )
-/*++
-
-Routine Description:
-
- This function searches if RootBridgeHandle has already existed
- in current device pool.
-
- If so, it means the given root bridge has been already enumerated.
-
-Arguments:
-
- RootBridgeHandle - An efi handle.
-
-Returns:
-
- None
-
---*/
-{
- PCI_IO_DEVICE *Bridge;
-
- Bridge = GetRootBridgeByHandle (RootBridgeHandle);
-
- if (Bridge != NULL) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOLEAN
-PciDeviceExisted (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- Bridge - A pointer to the PCI_IO_DEVICE.
- PciIoDevice - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-{
-
- PCI_IO_DEVICE *Temp;
- LIST_ENTRY *CurrentLink;
-
- CurrentLink = Bridge->ChildList.ForwardLink;
-
- while (CurrentLink && CurrentLink != &Bridge->ChildList) {
-
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- if (Temp == PciIoDevice) {
- return TRUE;
- }
-
- if (!IsListEmpty (&Temp->ChildList)) {
- if (PciDeviceExisted (Temp, PciIoDevice)) {
- return TRUE;
- }
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return FALSE;
-}
-
-PCI_IO_DEVICE *
-ActiveVGADeviceOnTheSameSegment (
- IN PCI_IO_DEVICE *VgaDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- VgaDevice - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-{
- LIST_ENTRY *CurrentLink;
- PCI_IO_DEVICE *Temp;
-
- CurrentLink = gPciDevicePool.ForwardLink;
-
- while (CurrentLink && CurrentLink != &gPciDevicePool) {
-
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- if (Temp->PciRootBridgeIo->SegmentNumber == VgaDevice->PciRootBridgeIo->SegmentNumber) {
-
- Temp = ActiveVGADeviceOnTheRootBridge (Temp);
-
- if (Temp != NULL) {
- return Temp;
- }
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return NULL;
-}
-
-PCI_IO_DEVICE *
-ActiveVGADeviceOnTheRootBridge (
- IN PCI_IO_DEVICE *RootBridge
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- RootBridge - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-{
- LIST_ENTRY *CurrentLink;
- PCI_IO_DEVICE *Temp;
-
- CurrentLink = RootBridge->ChildList.ForwardLink;
-
- while (CurrentLink && CurrentLink != &RootBridge->ChildList) {
-
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- if (IS_PCI_VGA(&Temp->Pci) &&
- (Temp->Attributes &
- (EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY |
- EFI_PCI_IO_ATTRIBUTE_VGA_IO |
- EFI_PCI_IO_ATTRIBUTE_VGA_IO_16))) {
- return Temp;
- }
-
- if (IS_PCI_BRIDGE (&Temp->Pci)) {
-
- Temp = ActiveVGADeviceOnTheRootBridge (Temp);
-
- if (Temp != NULL) {
- return Temp;
- }
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return NULL;
-}
-
-EFI_STATUS
-GetHpcPciAddress (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
- OUT UINT64 *PciAddress
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- PciRootBridgeIo - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCL.
- PciAddress - A pointer to the pci address.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-{
- EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath;
- EFI_DEV_PATH_PTR Node;
- LIST_ENTRY *CurrentLink;
- PCI_IO_DEVICE *RootBridge;
- EFI_STATUS Status;
-
- CurrentDevicePath = HpcDevicePath;
-
- //
- // Get the remaining device path for this PCI device, if it is a PCI device
- //
- while (!EfiIsDevicePathEnd (CurrentDevicePath)) {
-
- Node.DevPath = CurrentDevicePath;
-
- //
- // Check if it is PCI device Path?
- //
- if ((Node.DevPath->Type != HARDWARE_DEVICE_PATH) ||
- ((Node.DevPath->SubType != HW_PCI_DP) &&
- (DevicePathNodeLength (Node.DevPath) != sizeof (PCI_DEVICE_PATH)))) {
- CurrentDevicePath = EfiNextDevicePathNode (CurrentDevicePath);
- continue;
- }
-
- break;
- }
-
- //
- // Check if it is not PCI device path
- //
- if (EfiIsDevicePathEnd (CurrentDevicePath)) {
- return EFI_NOT_FOUND;
- }
-
- CurrentLink = gPciDevicePool.ForwardLink;
-
- while (CurrentLink && CurrentLink != &gPciDevicePool) {
-
- RootBridge = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- //
- // Locate the right root bridge to start
- //
- if (RootBridge->PciRootBridgeIo == PciRootBridgeIo) {
- Status = GetHpcPciAddressFromRootBridge (
- RootBridge,
- CurrentDevicePath,
- PciAddress
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- return EFI_SUCCESS;
-
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-GetHpcPciAddressFromRootBridge (
- IN PCI_IO_DEVICE *RootBridge,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
- OUT UINT64 *PciAddress
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- PciRootBridgeIo - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCL.
- PciAddress - A pointer to the pci address.
-
-Returns:
-
- None
-
---*/
-// TODO: RootBridge - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_DEV_PATH_PTR Node;
- PCI_IO_DEVICE *Temp;
- EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath;
- LIST_ENTRY *CurrentLink;
- BOOLEAN MisMatch;
-
- MisMatch = FALSE;
-
- CurrentDevicePath = RemainingDevicePath;
- Node.DevPath = CurrentDevicePath;
- Temp = NULL;
-
- while (!EfiIsDevicePathEnd (CurrentDevicePath)) {
-
- CurrentLink = RootBridge->ChildList.ForwardLink;
- Node.DevPath = CurrentDevicePath;
-
- while (CurrentLink && CurrentLink != &RootBridge->ChildList) {
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- if (Node.Pci->Device == Temp->DeviceNumber &&
- Node.Pci->Function == Temp->FunctionNumber) {
- RootBridge = Temp;
- break;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- //
- // Check if we find the bridge
- //
- if (CurrentLink == &RootBridge->ChildList) {
-
- MisMatch = TRUE;
- break;
-
- }
-
- CurrentDevicePath = EfiNextDevicePathNode (CurrentDevicePath);
- }
-
- if (MisMatch) {
-
- CurrentDevicePath = EfiNextDevicePathNode (CurrentDevicePath);
-
- if (EfiIsDevicePathEnd (CurrentDevicePath)) {
- *PciAddress = EFI_PCI_ADDRESS (RootBridge->BusNumber, Node.Pci->Device, Node.Pci->Function, 0);
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
- }
-
- *PciAddress = EFI_PCI_ADDRESS (Temp->BusNumber, Temp->DeviceNumber, Temp->FunctionNumber, 0);
-
- return EFI_SUCCESS;
-
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.h
deleted file mode 100644
index 374f4df..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDeviceSupport.h
+++ /dev/null
@@ -1,477 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciDeviceSupport.h
-
-Abstract:
-
-
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_DEVICE_SUPPORT_H
-#define _EFI_PCI_DEVICE_SUPPORT_H
-
-EFI_STATUS
-InitializePciDevicePool (
- VOID
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-InsertRootBridge (
- PCI_IO_DEVICE *RootBridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-InsertPciDevice (
- PCI_IO_DEVICE *Bridge,
- PCI_IO_DEVICE *PciDeviceNode
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- PciDeviceNode - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-DestroyRootBridge (
- IN PCI_IO_DEVICE *RootBridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-DestroyPciDeviceTree (
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-DestroyRootBridgeByHandle (
- EFI_HANDLE Controller
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Controller - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-RegisterPciDevice (
- IN EFI_HANDLE Controller,
- IN PCI_IO_DEVICE *PciIoDevice,
- OUT EFI_HANDLE *Handle OPTIONAL
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Controller - TODO: add argument description
- PciIoDevice - TODO: add argument description
- Handle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-RemoveAllPciDeviceOnBridge (
- EFI_HANDLE RootBridgeHandle,
- PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridgeHandle - TODO: add argument description
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-DeRegisterPciDevice (
- IN EFI_HANDLE Controller,
- IN EFI_HANDLE Handle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Controller - TODO: add argument description
- Handle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-StartPciDevicesOnBridge (
- IN EFI_HANDLE Controller,
- IN PCI_IO_DEVICE *RootBridge,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
- IN OUT UINT8 *NumberOfChildren,
- IN OUT EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Controller - TODO: add argument description
- RootBridge - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-StartPciDevices (
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Controller - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_IO_DEVICE *
-CreateRootBridge (
- IN EFI_HANDLE RootBridgeHandle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridgeHandle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_IO_DEVICE *
-GetRootBridgeByHandle (
- EFI_HANDLE RootBridgeHandle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridgeHandle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-RootBridgeExisted (
- IN EFI_HANDLE RootBridgeHandle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridgeHandle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-PciDeviceExisted (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_IO_DEVICE *
-ActiveVGADeviceOnTheSameSegment (
- IN PCI_IO_DEVICE *VgaDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- VgaDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_IO_DEVICE *
-ActiveVGADeviceOnTheRootBridge (
- IN PCI_IO_DEVICE *RootBridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GetHpcPciAddress (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
- OUT UINT64 *PciAddress
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciRootBridgeIo - TODO: add argument description
- HpcDevicePath - TODO: add argument description
- PciAddress - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GetHpcPciAddressFromRootBridge (
- IN PCI_IO_DEVICE *RootBridge,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
- OUT UINT64 *PciAddress
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridge - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
- PciAddress - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-FreePciDevice (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
deleted file mode 100644
index 7643fc8..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciDriverOverride.c
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-
-EFI_STATUS
-InitializePciDriverOverrideInstance (
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- Initializes a PCI Driver Override Instance
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PciIoDevice->PciDriverOverride.GetDriver = GetDriver;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-GetDriver (
- IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This,
- IN OUT EFI_HANDLE *DriverImageHandle
- )
-/*++
-
-Routine Description:
-
- Get a overriding driver image
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: DriverImageHandle - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- PCI_IO_DEVICE *PciIoDevice;
- LIST_ENTRY *CurrentLink;
- PCI_DRIVER_OVERRIDE_LIST *Node;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_DRIVER_OVERRIDE_THIS (This);
-
- CurrentLink = PciIoDevice->OptionRomDriverList.ForwardLink;
-
- while (CurrentLink && CurrentLink != &PciIoDevice->OptionRomDriverList) {
-
- Node = DRIVER_OVERRIDE_FROM_LINK (CurrentLink);
-
- if (*DriverImageHandle == NULL) {
-
- *DriverImageHandle = Node->DriverImageHandle;
- return EFI_SUCCESS;
- }
-
- if (*DriverImageHandle == Node->DriverImageHandle) {
-
- if (CurrentLink->ForwardLink == &PciIoDevice->OptionRomDriverList ||
- CurrentLink->ForwardLink == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Get next node
- //
- Node = DRIVER_OVERRIDE_FROM_LINK (CurrentLink->ForwardLink);
- *DriverImageHandle = Node->DriverImageHandle;
- return EFI_SUCCESS;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_INVALID_PARAMETER;
-}
-
-EFI_STATUS
-AddDriver (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_HANDLE DriverImageHandle
- )
-/*++
-
-Routine Description:
-
- Add a overriding driver image
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: DriverImageHandle - add argument and description to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_IMAGE_DOS_HEADER *DosHdr;
- EFI_IMAGE_NT_HEADERS *PeHdr;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- PCI_DRIVER_OVERRIDE_LIST *Node;
-
- Status = gBS->HandleProtocol (DriverImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Node = AllocatePool (sizeof (PCI_DRIVER_OVERRIDE_LIST));
- if (Node == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Node->Signature = DRIVER_OVERRIDE_SIGNATURE;
- Node->DriverImageHandle = DriverImageHandle;
-
- InsertTailList (&PciIoDevice->OptionRomDriverList, &(Node->Link));
-
- PciIoDevice->BusOverride = TRUE;
-
- DosHdr = (EFI_IMAGE_DOS_HEADER *) LoadedImage->ImageBase;
- if (DosHdr->e_magic != EFI_IMAGE_DOS_SIGNATURE) {
- return EFI_SUCCESS;
- }
-
- PeHdr = (EFI_IMAGE_NT_HEADERS *) ((UINTN) LoadedImage->ImageBase + DosHdr->e_lfanew);
-
- if (PeHdr->FileHeader.Machine != EFI_IMAGE_MACHINE_EBC) {
- return EFI_SUCCESS;
- }
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.h
deleted file mode 100644
index 5992df9..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciDriverOverride.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciDriverOverride.h
-
-Abstract:
-
-
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_DRIVER_OVERRRIDE_H
-#define _EFI_PCI_DRIVER_OVERRRIDE_H
-
-#define DRIVER_OVERRIDE_SIGNATURE EFI_SIGNATURE_32 ('d', 'r', 'o', 'v')
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- EFI_HANDLE DriverImageHandle;
-} PCI_DRIVER_OVERRIDE_LIST;
-
-
-#define DRIVER_OVERRIDE_FROM_LINK(a) \
- CR (a, PCI_DRIVER_OVERRIDE_LIST, Link, DRIVER_OVERRIDE_SIGNATURE)
-
-
-EFI_STATUS
-InitializePciDriverOverrideInstance (
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-AddDriver (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_HANDLE DriverImageHandle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- DriverImageHandle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-GetDriver (
- IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This,
- IN OUT EFI_HANDLE *DriverImageHandle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- DriverImageHandle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.c
deleted file mode 100644
index e7a05a2..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.c
+++ /dev/null
@@ -1,2168 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciEnumerator.c
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-#include "PciEnumerator.h"
-#include "PciResourceSupport.h"
-#include "PciOptionRomSupport.h"
-
-EFI_STATUS
-PciEnumerator (
- IN EFI_HANDLE Controller
- )
-/*++
-
-Routine Description:
-
- This routine is used to enumerate entire pci bus system
- in a given platform
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Controller - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- EFI_HANDLE HostBridgeHandle;
- EFI_STATUS Status;
- EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- //
- // If PCI bus has already done the full enumeration, never do it again
- //
- if (!gFullEnumeration) {
- return PciEnumeratorLight (Controller);
- }
-
- //
- // If this host bridge has been already enumerated, then return successfully
- //
- if (RootBridgeExisted (Controller)) {
- return EFI_SUCCESS;
- }
-
- //
- // Get the rootbridge Io protocol to find the host bridge handle
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &PciRootBridgeIo,
- gPciBusDriverBinding.DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the host bridge handle
- //
- HostBridgeHandle = PciRootBridgeIo->ParentHandle;
-
- //
- // Get the pci host bridge resource allocation protocol
- //
- Status = gBS->OpenProtocol (
- HostBridgeHandle,
- &gEfiPciHostBridgeResourceAllocationProtocolGuid,
- (VOID **) &PciResAlloc,
- gPciBusDriverBinding.DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Notify the pci bus enumeration is about to begin
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginEnumeration);
-
- //
- // Start the bus allocation phase
- //
- Status = PciHostBridgeEnumerator (PciResAlloc);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Submit the resource request
- //
- Status = PciHostBridgeResourceAllocator (PciResAlloc);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Process P2C
- //
- Status = PciHostBridgeP2CProcess (PciResAlloc);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Process attributes for devices on this host bridge
- //
- Status = PciHostBridgeDeviceAttribute (PciResAlloc);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gFullEnumeration = FALSE;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciRootBridgeEnumerator (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
- IN PCI_IO_DEVICE *RootBridgeDev
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciResAlloc - add argument and description to function comment
-// TODO: RootBridgeDev - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *pConfiguration;
- UINT8 SubBusNumber;
- UINT8 StartBusNumber;
- UINT8 PaddedBusRange;
- EFI_HANDLE RootBridgeHandle;
-
- SubBusNumber = 0;
- StartBusNumber = 0;
- PaddedBusRange = 0;
-
- //
- // Get the root bridge handle
- //
- RootBridgeHandle = RootBridgeDev->Handle;
-
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_PCI | EFI_IOB_PCI_PC_BUS_ENUM,
- RootBridgeDev->DevicePath
- );
-
- //
- // Get the Bus information
- //
- Status = PciResAlloc->StartBusEnumeration (
- PciResAlloc,
- RootBridgeHandle,
- (VOID **) &pConfiguration
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the bus number to start with
- //
- StartBusNumber = (UINT8) (pConfiguration->AddrRangeMin);
-
- //
- // Initialize the subordinate bus number
- //
- SubBusNumber = StartBusNumber;
-
- //
- // Assign bus number
- //
- Status = PciScanBus (
- RootBridgeDev,
- (UINT8) (pConfiguration->AddrRangeMin),
- &SubBusNumber,
- &PaddedBusRange
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
-
- //
- // Assign max bus number scanned
- //
- pConfiguration->AddrLen = SubBusNumber - StartBusNumber + 1 + PaddedBusRange;
-
- //
- // Set bus number
- //
- Status = PciResAlloc->SetBusNumbers (
- PciResAlloc,
- RootBridgeHandle,
- pConfiguration
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ProcessOptionRom (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT64 RomBase,
- IN UINT64 MaxLength
- )
-/*++
-
-Routine Description:
-
- This routine is used to process option rom on a certain root bridge
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: RomBase - add argument and description to function comment
-// TODO: MaxLength - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- LIST_ENTRY *CurrentLink;
- PCI_IO_DEVICE *Temp;
- EFI_STATUS Status;
-
- //
- // Go through bridges to reach all devices
- //
- CurrentLink = Bridge->ChildList.ForwardLink;
- while (CurrentLink && CurrentLink != &Bridge->ChildList) {
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- if (!IsListEmpty (&Temp->ChildList)) {
-
- //
- // Go further to process the option rom under this bridge
- //
- Status = ProcessOptionRom (Temp, RomBase, MaxLength);
- }
-
- if (Temp->RomSize != 0 && Temp->RomSize <= MaxLength) {
-
- //
- // Load and process the option rom
- //
- Status = LoadOpRomImage (Temp, RomBase);
- if (Status == EFI_SUCCESS) {
- Status = ProcessOpRomImage (Temp);
- }
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciAssignBusNumber (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber
- )
-/*++
-
-Routine Description:
-
- This routine is used to assign bus number to the given PCI bus system
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: StartBusNumber - add argument and description to function comment
-// TODO: SubBusNumber - add argument and description to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_TYPE00 Pci;
- UINT8 Device;
- UINT8 Func;
- UINT64 Address;
- UINTN SecondBus;
- UINT16 Register;
- UINT8 Register8;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- PciRootBridgeIo = Bridge->PciRootBridgeIo;
-
- SecondBus = 0;
- Register = 0;
-
- *SubBusNumber = StartBusNumber;
-
- //
- // First check to see whether the parent is ppb
- //
- for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
- for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
-
- //
- // Check to see whether a pci device is present
- //
-
- Status = PciDevicePresent (
- PciRootBridgeIo,
- &Pci,
- StartBusNumber,
- Device,
- Func
- );
-
- if (!EFI_ERROR (Status) &&
- (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci))) {
-
- //
- // Reserved one bus for cardbus bridge
- //
- SecondBus = ++(*SubBusNumber);
-
- Register = (UINT16) ((SecondBus << 8) | (UINT16) StartBusNumber);
-
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);
-
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint16,
- Address,
- 1,
- &Register
- );
-
- //
- // Initialize SubBusNumber to SecondBus
- //
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- SubBusNumber
- );
- //
- // If it is PPB, resursively search down this bridge
- //
- if (IS_PCI_BRIDGE (&Pci)) {
-
- Register8 = 0xFF;
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- &Register8
- );
-
- Status = PciAssignBusNumber (
- Bridge,
- (UINT8) (SecondBus),
- SubBusNumber
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- }
-
- //
- // Set the current maximum bus number under the PPB
- //
-
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
-
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- SubBusNumber
- );
-
- }
-
- if (Func == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {
-
- //
- // Skip sub functions, this is not a multi function device
- //
-
- Func = PCI_MAX_FUNC;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DetermineRootBridgeAttributes (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
- IN PCI_IO_DEVICE *RootBridgeDev
- )
-/*++
-
-Routine Description:
-
- This routine is used to determine the root bridge attribute by interfacing
- the host bridge resource allocation protocol.
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciResAlloc - add argument and description to function comment
-// TODO: RootBridgeDev - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT64 Attributes;
- EFI_STATUS Status;
- EFI_HANDLE RootBridgeHandle;
-
- Attributes = 0;
- RootBridgeHandle = RootBridgeDev->Handle;
-
- //
- // Get root bridge attribute by calling into pci host bridge resource allocation protocol
- //
- Status = PciResAlloc->GetAllocAttributes (
- PciResAlloc,
- RootBridgeHandle,
- &Attributes
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Here is the point where PCI bus driver calls HOST bridge allocation protocol
- // Currently we hardcoded for ea815
- //
-
- if (Attributes & EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM) {
- RootBridgeDev->Decodes |= EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED;
- }
-
- if (Attributes & EFI_PCI_HOST_BRIDGE_MEM64_DECODE) {
- RootBridgeDev->Decodes |= EFI_BRIDGE_PMEM64_DECODE_SUPPORTED;
- }
-
- RootBridgeDev->Decodes |= EFI_BRIDGE_MEM32_DECODE_SUPPORTED;
- RootBridgeDev->Decodes |= EFI_BRIDGE_PMEM32_DECODE_SUPPORTED;
- RootBridgeDev->Decodes |= EFI_BRIDGE_IO16_DECODE_SUPPORTED;
-
- return EFI_SUCCESS;
-}
-
-UINT64
-GetMaxOptionRomSize (
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- Get Max Option Rom size on this bridge
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-{
- LIST_ENTRY *CurrentLink;
- PCI_IO_DEVICE *Temp;
- UINT64 MaxOptionRomSize;
- UINT64 TempOptionRomSize;
-
- MaxOptionRomSize = 0;
-
- //
- // Go through bridges to reach all devices
- //
- CurrentLink = Bridge->ChildList.ForwardLink;
- while (CurrentLink && CurrentLink != &Bridge->ChildList) {
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- if (!IsListEmpty (&Temp->ChildList)) {
-
- //
- // Get max option rom size under this bridge
- //
- TempOptionRomSize = GetMaxOptionRomSize (Temp);
-
- //
- // Compare with the option rom size of the bridge
- // Get the larger one
- //
- if (Temp->RomSize > TempOptionRomSize) {
- TempOptionRomSize = Temp->RomSize;
- }
-
- } else {
-
- //
- // For devices get the rom size directly
- //
- TempOptionRomSize = Temp->RomSize;
- }
-
- //
- // Get the largest rom size on this bridge
- //
- if (TempOptionRomSize > MaxOptionRomSize) {
- MaxOptionRomSize = TempOptionRomSize;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return MaxOptionRomSize;
-}
-
-EFI_STATUS
-PciHostBridgeDeviceAttribute (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-/*++
-
-Routine Description:
-
- Process attributes of devices on this host bridge
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciResAlloc - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_HANDLE RootBridgeHandle;
- PCI_IO_DEVICE *RootBridgeDev;
- EFI_STATUS Status;
-
- RootBridgeHandle = NULL;
-
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
-
- //
- // Get RootBridg Device by handle
- //
- RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Set the attributes for devcies behind the Root Bridge
- //
- Status = DetermineDeviceAttribute (RootBridgeDev);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetResourceAllocationStatus (
- VOID *AcpiConfig,
- OUT UINT64 *IoResStatus,
- OUT UINT64 *Mem32ResStatus,
- OUT UINT64 *PMem32ResStatus,
- OUT UINT64 *Mem64ResStatus,
- OUT UINT64 *PMem64ResStatus
- )
-/*++
-
-Routine Description:
-
- Get resource allocation status from the ACPI pointer
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: AcpiConfig - add argument and description to function comment
-// TODO: IoResStatus - add argument and description to function comment
-// TODO: Mem32ResStatus - add argument and description to function comment
-// TODO: PMem32ResStatus - add argument and description to function comment
-// TODO: Mem64ResStatus - add argument and description to function comment
-// TODO: PMem64ResStatus - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- UINT8 *Temp;
- UINT64 ResStatus;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *ptr;
-
- Temp = (UINT8 *) AcpiConfig;
-
- while (*Temp == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
-
- ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp;
- ResStatus = ptr->AddrTranslationOffset;
-
- switch (ptr->ResType) {
- case 0:
- if (ptr->AddrSpaceGranularity == 32) {
- if (ptr->SpecificFlag == 0x06) {
- //
- // Pmem32
- //
- *PMem32ResStatus = ResStatus;
- } else {
- //
- // Mem32
- //
- *Mem32ResStatus = ResStatus;
- }
- }
-
- if (ptr->AddrSpaceGranularity == 64) {
- if (ptr->SpecificFlag == 0x06) {
- //
- // PMem64
- //
- *PMem64ResStatus = ResStatus;
- } else {
- //
- // Mem64
- //
- *Mem64ResStatus = ResStatus;
- }
- }
-
- break;
-
- case 1:
- //
- // Io
- //
- *IoResStatus = ResStatus;
- break;
-
- default:
- break;
- }
-
- Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-RejectPciDevice (
- IN PCI_IO_DEVICE *PciDevice
- )
-/*++
-
-Routine Description:
-
- Remove a PCI device from device pool and mark its bar
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-{
- PCI_IO_DEVICE *Bridge;
- PCI_IO_DEVICE *Temp;
- LIST_ENTRY *CurrentLink;
-
- //
- // Remove the padding resource from a bridge
- //
- if ( IS_PCI_BRIDGE(&PciDevice->Pci) && \
- PciDevice->ResourcePaddingDescriptors ) {
- gBS->FreePool (PciDevice->ResourcePaddingDescriptors);
- PciDevice->ResourcePaddingDescriptors = NULL;
- return EFI_SUCCESS;
- }
-
- //
- // Skip RB and PPB
- //
- if (IS_PCI_BRIDGE (&PciDevice->Pci) || (!PciDevice->Parent)) {
- return EFI_ABORTED;
- }
-
- if (IS_CARDBUS_BRIDGE (&PciDevice->Pci)) {
- //
- // Get the root bridge device
- //
- Bridge = PciDevice;
- while (Bridge->Parent) {
- Bridge = Bridge->Parent;
- }
-
- RemoveAllPciDeviceOnBridge (Bridge->Handle, PciDevice);
-
- //
- // Mark its bar
- //
- InitializeP2C (PciDevice);
- }
-
- //
- // Remove the device
- //
- Bridge = PciDevice->Parent;
- CurrentLink = Bridge->ChildList.ForwardLink;
- while (CurrentLink && CurrentLink != &Bridge->ChildList) {
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- if (Temp == PciDevice) {
- InitializePciDevice (Temp);
- RemoveEntryList (CurrentLink);
- FreePciDevice (Temp);
- return EFI_SUCCESS;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_ABORTED;
-}
-
-BOOLEAN
-IsRejectiveDevice (
- IN PCI_RESOURCE_NODE *PciResNode
- )
-/*++
-
-Routine Description:
-
- Determine whethter a PCI device can be rejected
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciResNode - add argument and description to function comment
-{
- PCI_IO_DEVICE *Temp;
-
- Temp = PciResNode->PciDev;
-
- //
- // Ensure the device is present
- //
- if (!Temp) {
- return FALSE;
- }
-
- //
- // PPB and RB should go ahead
- //
- if (IS_PCI_BRIDGE (&Temp->Pci) || (!Temp->Parent)) {
- return TRUE;
- }
-
- //
- // Skip device on Bus0
- //
- if ((Temp->Parent) && (Temp->BusNumber == 0)) {
- return FALSE;
- }
-
- //
- // Skip VGA
- //
- if (IS_PCI_VGA (&Temp->Pci)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-PCI_RESOURCE_NODE *
-GetLargerConsumerDevice (
- IN PCI_RESOURCE_NODE *PciResNode1,
- IN PCI_RESOURCE_NODE *PciResNode2
- )
-/*++
-
-Routine Description:
-
- Get the larger resource consumer
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciResNode1 - add argument and description to function comment
-// TODO: PciResNode2 - add argument and description to function comment
-{
- if (!PciResNode2) {
- return PciResNode1;
- }
-
- if ((IS_PCI_BRIDGE(&(PciResNode2->PciDev->Pci)) || !(PciResNode2->PciDev->Parent)) \
- && (PciResNode2->ResourceUsage != PciResUsagePadding) )
- {
- return PciResNode1;
- }
-
- if (!PciResNode1) {
- return PciResNode2;
- }
-
- if ((PciResNode1->Length) > (PciResNode2->Length)) {
- return PciResNode1;
- }
-
- return PciResNode2;
-
-}
-
-PCI_RESOURCE_NODE *
-GetMaxResourceConsumerDevice (
- IN PCI_RESOURCE_NODE *ResPool
- )
-/*++
-
-Routine Description:
-
- Get the max resource consumer in the host resource pool
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: ResPool - add argument and description to function comment
-{
- PCI_RESOURCE_NODE *Temp;
- LIST_ENTRY *CurrentLink;
- PCI_RESOURCE_NODE *PciResNode;
- PCI_RESOURCE_NODE *PPBResNode;
-
- PciResNode = NULL;
-
- CurrentLink = ResPool->ChildList.ForwardLink;
- while (CurrentLink && CurrentLink != &ResPool->ChildList) {
-
- Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- if (!IsRejectiveDevice (Temp)) {
- CurrentLink = CurrentLink->ForwardLink;
- continue;
- }
-
- if ((IS_PCI_BRIDGE (&(Temp->PciDev->Pci)) || (!Temp->PciDev->Parent)) \
- && (Temp->ResourceUsage != PciResUsagePadding))
- {
- PPBResNode = GetMaxResourceConsumerDevice (Temp);
- PciResNode = GetLargerConsumerDevice (PciResNode, PPBResNode);
- } else {
- PciResNode = GetLargerConsumerDevice (PciResNode, Temp);
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return PciResNode;
-}
-
-EFI_STATUS
-PciHostBridgeAdjustAllocation (
- IN PCI_RESOURCE_NODE *IoPool,
- IN PCI_RESOURCE_NODE *Mem32Pool,
- IN PCI_RESOURCE_NODE *PMem32Pool,
- IN PCI_RESOURCE_NODE *Mem64Pool,
- IN PCI_RESOURCE_NODE *PMem64Pool,
- IN UINT64 IoResStatus,
- IN UINT64 Mem32ResStatus,
- IN UINT64 PMem32ResStatus,
- IN UINT64 Mem64ResStatus,
- IN UINT64 PMem64ResStatus
- )
-/*++
-
-Routine Description:
-
- Adjust host bridge allocation so as to reduce resource requirement
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: IoPool - add argument and description to function comment
-// TODO: Mem32Pool - add argument and description to function comment
-// TODO: PMem32Pool - add argument and description to function comment
-// TODO: Mem64Pool - add argument and description to function comment
-// TODO: PMem64Pool - add argument and description to function comment
-// TODO: IoResStatus - add argument and description to function comment
-// TODO: Mem32ResStatus - add argument and description to function comment
-// TODO: PMem32ResStatus - add argument and description to function comment
-// TODO: Mem64ResStatus - add argument and description to function comment
-// TODO: PMem64ResStatus - add argument and description to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-{
- BOOLEAN AllocationAjusted;
- PCI_RESOURCE_NODE *PciResNode;
- PCI_RESOURCE_NODE *ResPool[5];
- PCI_IO_DEVICE *RemovedPciDev[5];
- UINT64 ResStatus[5];
- UINTN RemovedPciDevNum;
- UINTN DevIndex;
- UINTN ResType;
- EFI_STATUS Status;
- REPORT_STATUS_CODE_LIBRARY_RESOURCE_ALLOC_FAILURE_ERROR_DATA AllocFailExtendedData;
-
- PciResNode = NULL;
- ZeroMem (RemovedPciDev, 5 * sizeof (PCI_IO_DEVICE *));
- RemovedPciDevNum = 0;
-
- ResPool[0] = IoPool;
- ResPool[1] = Mem32Pool;
- ResPool[2] = PMem32Pool;
- ResPool[3] = Mem64Pool;
- ResPool[4] = PMem64Pool;
-
- ResStatus[0] = IoResStatus;
- ResStatus[1] = Mem32ResStatus;
- ResStatus[2] = PMem32ResStatus;
- ResStatus[3] = Mem64ResStatus;
- ResStatus[4] = PMem64ResStatus;
-
- AllocationAjusted = FALSE;
-
- for (ResType = 0; ResType < 5; ResType++) {
-
- if (ResStatus[ResType] == EFI_RESOURCE_SATISFIED) {
- continue;
- }
-
- if (ResStatus[ResType] == EFI_RESOURCE_NONEXISTENT) {
- //
- // Hostbridge hasn't this resource type
- //
- return EFI_ABORTED;
- }
-
- //
- // Hostbridge hasn't enough resource
- //
- PciResNode = GetMaxResourceConsumerDevice (ResPool[ResType]);
- if (!PciResNode) {
- continue;
- }
-
- //
- // Check if the device has been removed before
- //
- for (DevIndex = 0; DevIndex < RemovedPciDevNum; DevIndex++) {
- if (PciResNode->PciDev == RemovedPciDev[DevIndex]) {
- continue;
- }
- }
-
- //
- // Remove the device if it isn't in the array
- //
- Status = RejectPciDevice (PciResNode->PciDev);
- if (Status == EFI_SUCCESS) {
-
- //
- // Raise the EFI_IOB_EC_RESOURCE_CONFLICT status code
- //
- //
- // Have no way to get ReqRes, AllocRes & Bar here
- //
- ZeroMem (&AllocFailExtendedData, sizeof (AllocFailExtendedData));
- AllocFailExtendedData.DevicePathSize = sizeof (EFI_DEVICE_PATH_PROTOCOL);
- AllocFailExtendedData.DevicePath = (UINT8 *) PciResNode->PciDev->DevicePath;
- AllocFailExtendedData.Bar = PciResNode->Bar;
-
- REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_PCI | EFI_IOB_EC_RESOURCE_CONFLICT,
- (VOID *) &AllocFailExtendedData,
- sizeof (AllocFailExtendedData)
- );
-
- //
- // Add it to the array and indicate at least a device has been rejected
- //
- RemovedPciDev[RemovedPciDevNum++] = PciResNode->PciDev;
- AllocationAjusted = TRUE;
- }
- }
- //
- // End for
- //
-
- if (AllocationAjusted) {
- return EFI_SUCCESS;
- } else {
- return EFI_ABORTED;
- }
-}
-
-EFI_STATUS
-ConstructAcpiResourceRequestor (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_RESOURCE_NODE *IoNode,
- IN PCI_RESOURCE_NODE *Mem32Node,
- IN PCI_RESOURCE_NODE *PMem32Node,
- IN PCI_RESOURCE_NODE *Mem64Node,
- IN PCI_RESOURCE_NODE *PMem64Node,
- OUT VOID **pConfig
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: IoNode - add argument and description to function comment
-// TODO: Mem32Node - add argument and description to function comment
-// TODO: PMem32Node - add argument and description to function comment
-// TODO: Mem64Node - add argument and description to function comment
-// TODO: PMem64Node - add argument and description to function comment
-// TODO: pConfig - add argument and description to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT8 NumConfig;
- UINT8 Aperture;
- UINT8 *Configuration;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
- EFI_ACPI_END_TAG_DESCRIPTOR *PtrEnd;
-
- NumConfig = 0;
- Aperture = 0;
-
- *pConfig = NULL;
-
- //
- // if there is io request, add to the io aperture
- //
- if (ResourceRequestExisted (IoNode)) {
- NumConfig++;
- Aperture |= 0x01;
- }
-
- //
- // if there is mem32 request, add to the mem32 aperture
- //
- if (ResourceRequestExisted (Mem32Node)) {
- NumConfig++;
- Aperture |= 0x02;
- }
-
- //
- // if there is pmem32 request, add to the pmem32 aperture
- //
- if (ResourceRequestExisted (PMem32Node)) {
- NumConfig++;
- Aperture |= 0x04;
- }
-
- //
- // if there is mem64 request, add to the mem64 aperture
- //
- if (ResourceRequestExisted (Mem64Node)) {
- NumConfig++;
- Aperture |= 0x08;
- }
-
- //
- // if there is pmem64 request, add to the pmem64 aperture
- //
- if (ResourceRequestExisted (PMem64Node)) {
- NumConfig++;
- Aperture |= 0x10;
- }
-
- if (NumConfig != 0) {
-
- //
- // If there is at least one type of resource request,
- // allocate a acpi resource node
- //
- Configuration = AllocatePool (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * NumConfig + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));
- if (Configuration == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- ZeroMem (
- Configuration,
- sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * NumConfig + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)
- );
-
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration;
-
- //
- // Deal with io aperture
- //
- if (Aperture & 0x01) {
- Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
- Ptr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3;
- //
- // Io
- //
- Ptr->ResType = ACPI_ADDRESS_SPACE_TYPE_IO;
- //
- // non ISA range
- //
- Ptr->SpecificFlag = 1;
- Ptr->AddrLen = IoNode->Length;
- Ptr->AddrRangeMax = IoNode->Alignment;
-
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) ((UINT8 *) Ptr + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR));
- }
- //
- // Deal with mem32 aperture
- //
- if (Aperture & 0x02) {
- Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
- Ptr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3;
- //
- // Mem
- //
- Ptr->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- //
- // Nonprefechable
- //
- Ptr->SpecificFlag = 0;
- //
- // 32 bit
- //
- Ptr->AddrSpaceGranularity = 32;
- Ptr->AddrLen = Mem32Node->Length;
- Ptr->AddrRangeMax = Mem32Node->Alignment;
-
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) ((UINT8 *) Ptr + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR));
- }
-
- //
- // Deal with Pmem32 aperture
- //
- if (Aperture & 0x04) {
- Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
- Ptr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3;
- //
- // Mem
- //
- Ptr->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- //
- // prefechable
- //
- Ptr->SpecificFlag = 0x6;
- //
- // 32 bit
- //
- Ptr->AddrSpaceGranularity = 32;
- Ptr->AddrLen = PMem32Node->Length;
- Ptr->AddrRangeMax = PMem32Node->Alignment;
-
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) ((UINT8 *) Ptr + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR));
- }
- //
- // Deal with mem64 aperture
- //
- if (Aperture & 0x08) {
- Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
- Ptr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3;
- //
- // Mem
- //
- Ptr->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- //
- // nonprefechable
- //
- Ptr->SpecificFlag = 0;
- //
- // 64 bit
- //
- Ptr->AddrSpaceGranularity = 64;
- Ptr->AddrLen = Mem64Node->Length;
- Ptr->AddrRangeMax = Mem64Node->Alignment;
-
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) ((UINT8 *) Ptr + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR));
- }
- //
- // Deal with Pmem64 aperture
- //
- if (Aperture & 0x10) {
- Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
- Ptr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3;
- //
- // Mem
- //
- Ptr->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- //
- // prefechable
- //
- Ptr->SpecificFlag = 0x06;
- //
- // 64 bit
- //
- Ptr->AddrSpaceGranularity = 64;
- Ptr->AddrLen = PMem64Node->Length;
- Ptr->AddrRangeMax = PMem64Node->Alignment;
-
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) (Configuration + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR));
- }
-
- //
- // put the checksum
- //
- PtrEnd = (EFI_ACPI_END_TAG_DESCRIPTOR *) ((UINT8 *) Ptr);
-
- PtrEnd->Desc = ACPI_END_TAG_DESCRIPTOR;
- PtrEnd->Checksum = 0;
-
- } else {
-
- //
- // If there is no resource request
- //
- Configuration = AllocatePool (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));
- if (Configuration == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- ZeroMem (Configuration, sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));
-
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) (Configuration);
- Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
-
- PtrEnd = (EFI_ACPI_END_TAG_DESCRIPTOR *) (Configuration + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR));
- PtrEnd->Desc = ACPI_END_TAG_DESCRIPTOR;
- PtrEnd->Checksum = 0;
- }
-
- *pConfig = Configuration;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetResourceBase (
- IN VOID *pConfig,
- OUT UINT64 *IoBase,
- OUT UINT64 *Mem32Base,
- OUT UINT64 *PMem32Base,
- OUT UINT64 *Mem64Base,
- OUT UINT64 *PMem64Base
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: pConfig - add argument and description to function comment
-// TODO: IoBase - add argument and description to function comment
-// TODO: Mem32Base - add argument and description to function comment
-// TODO: PMem32Base - add argument and description to function comment
-// TODO: Mem64Base - add argument and description to function comment
-// TODO: PMem64Base - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT8 *Temp;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
- UINT64 ResStatus;
-
- *IoBase = 0xFFFFFFFFFFFFFFFFULL;
- *Mem32Base = 0xFFFFFFFFFFFFFFFFULL;
- *PMem32Base = 0xFFFFFFFFFFFFFFFFULL;
- *Mem64Base = 0xFFFFFFFFFFFFFFFFULL;
- *PMem64Base = 0xFFFFFFFFFFFFFFFFULL;
-
- Temp = (UINT8 *) pConfig;
-
- while (*Temp == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
-
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Temp;
- ResStatus = Ptr->AddrTranslationOffset;
-
- if (ResStatus == EFI_RESOURCE_SATISFIED) {
-
- switch (Ptr->ResType) {
-
- //
- // Memory type aperture
- //
- case 0:
-
- //
- // Check to see the granularity
- //
- if (Ptr->AddrSpaceGranularity == 32) {
- if (Ptr->SpecificFlag & 0x06) {
- *PMem32Base = Ptr->AddrRangeMin;
- } else {
- *Mem32Base = Ptr->AddrRangeMin;
- }
- }
-
- if (Ptr->AddrSpaceGranularity == 64) {
- if (Ptr->SpecificFlag & 0x06) {
- *PMem64Base = Ptr->AddrRangeMin;
- } else {
- *Mem64Base = Ptr->AddrRangeMin;
- }
- }
- break;
-
- case 1:
-
- //
- // Io type aperture
- //
- *IoBase = Ptr->AddrRangeMin;
- break;
-
- default:
- break;
-
- }
- //
- // End switch
- //
- }
- //
- // End for
- //
- Temp += sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciBridgeEnumerator (
- IN PCI_IO_DEVICE *BridgeDev
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: BridgeDev - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT8 SubBusNumber;
- UINT8 StartBusNumber;
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_STATUS Status;
-
- SubBusNumber = 0;
- StartBusNumber = 0;
- PciIo = &(BridgeDev->PciIo);
- Status = PciIoRead (PciIo, EfiPciIoWidthUint8, 0x19, 1, &StartBusNumber);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = PciAssignBusNumber (
- BridgeDev,
- StartBusNumber,
- &SubBusNumber
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = PciPciDeviceInfoCollector (BridgeDev, StartBusNumber);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = PciBridgeResourceAllocator (BridgeDev);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = DetermineDeviceAttribute (BridgeDev);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-PciBridgeResourceAllocator (
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_RESOURCE_NODE *IoBridge;
- PCI_RESOURCE_NODE *Mem32Bridge;
- PCI_RESOURCE_NODE *PMem32Bridge;
- PCI_RESOURCE_NODE *Mem64Bridge;
- PCI_RESOURCE_NODE *PMem64Bridge;
- UINT64 IoBase;
- UINT64 Mem32Base;
- UINT64 PMem32Base;
- UINT64 Mem64Base;
- UINT64 PMem64Base;
- EFI_STATUS Status;
-
- IoBridge = CreateResourceNode (
- Bridge,
- 0,
- 0xFFF,
- 0,
- PciBarTypeIo16,
- PciResUsageTypical
- );
-
- Mem32Bridge = CreateResourceNode (
- Bridge,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypeMem32,
- PciResUsageTypical
- );
-
- PMem32Bridge = CreateResourceNode (
- Bridge,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypePMem32,
- PciResUsageTypical
- );
-
- Mem64Bridge = CreateResourceNode (
- Bridge,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypeMem64,
- PciResUsageTypical
- );
-
- PMem64Bridge = CreateResourceNode (
- Bridge,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypePMem64,
- PciResUsageTypical
- );
-
- //
- // Create resourcemap by going through all the devices subject to this root bridge
- //
- Status = CreateResourceMap (
- Bridge,
- IoBridge,
- Mem32Bridge,
- PMem32Bridge,
- Mem64Bridge,
- PMem64Bridge
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = GetResourceBaseFromBridge (
- Bridge,
- &IoBase,
- &Mem32Base,
- &PMem32Base,
- &Mem64Base,
- &PMem64Base
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Program IO resources
- //
- ProgramResource (
- IoBase,
- IoBridge
- );
-
- //
- // Program Mem32 resources
- //
- ProgramResource (
- Mem32Base,
- Mem32Bridge
- );
-
- //
- // Program PMem32 resources
- //
- ProgramResource (
- PMem32Base,
- PMem32Bridge
- );
-
- //
- // Program Mem64 resources
- //
- ProgramResource (
- Mem64Base,
- Mem64Bridge
- );
-
- //
- // Program PMem64 resources
- //
- ProgramResource (
- PMem64Base,
- PMem64Bridge
- );
-
- DestroyResourceTree (IoBridge);
- DestroyResourceTree (Mem32Bridge);
- DestroyResourceTree (PMem32Bridge);
- DestroyResourceTree (PMem64Bridge);
- DestroyResourceTree (Mem64Bridge);
-
- gBS->FreePool (IoBridge);
- gBS->FreePool (Mem32Bridge);
- gBS->FreePool (PMem32Bridge);
- gBS->FreePool (PMem64Bridge);
- gBS->FreePool (Mem64Bridge);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetResourceBaseFromBridge (
- IN PCI_IO_DEVICE *Bridge,
- OUT UINT64 *IoBase,
- OUT UINT64 *Mem32Base,
- OUT UINT64 *PMem32Base,
- OUT UINT64 *Mem64Base,
- OUT UINT64 *PMem64Base
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: IoBase - add argument and description to function comment
-// TODO: Mem32Base - add argument and description to function comment
-// TODO: PMem32Base - add argument and description to function comment
-// TODO: Mem64Base - add argument and description to function comment
-// TODO: PMem64Base - add argument and description to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- if (!Bridge->Allocated) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- *IoBase = gAllOne;
- *Mem32Base = gAllOne;
- *PMem32Base = gAllOne;
- *Mem64Base = gAllOne;
- *PMem64Base = gAllOne;
-
- if (IS_PCI_BRIDGE (&Bridge->Pci)) {
-
- if (Bridge->PciBar[PPB_IO_RANGE].Length) {
- *IoBase = Bridge->PciBar[PPB_IO_RANGE].BaseAddress;
- }
-
- if (Bridge->PciBar[PPB_MEM32_RANGE].Length) {
- *Mem32Base = Bridge->PciBar[PPB_MEM32_RANGE].BaseAddress;
- }
-
- if (Bridge->PciBar[PPB_PMEM32_RANGE].Length) {
- *PMem32Base = Bridge->PciBar[PPB_PMEM32_RANGE].BaseAddress;
- }
-
- if (Bridge->PciBar[PPB_PMEM64_RANGE].Length) {
- *PMem64Base = Bridge->PciBar[PPB_PMEM64_RANGE].BaseAddress;
- } else {
- *PMem64Base = gAllOne;
- }
-
- }
-
- if (IS_CARDBUS_BRIDGE (&Bridge->Pci)) {
- if (Bridge->PciBar[P2C_IO_1].Length) {
- *IoBase = Bridge->PciBar[P2C_IO_1].BaseAddress;
- } else {
- if (Bridge->PciBar[P2C_IO_2].Length) {
- *IoBase = Bridge->PciBar[P2C_IO_2].BaseAddress;
- }
- }
-
- if (Bridge->PciBar[P2C_MEM_1].Length) {
- if (Bridge->PciBar[P2C_MEM_1].BarType == PciBarTypePMem32) {
- *PMem32Base = Bridge->PciBar[P2C_MEM_1].BaseAddress;
- }
-
- if (Bridge->PciBar[P2C_MEM_1].BarType == PciBarTypeMem32) {
- *Mem32Base = Bridge->PciBar[P2C_MEM_1].BaseAddress;
- }
- }
-
- if (Bridge->PciBar[P2C_MEM_2].Length) {
- if (Bridge->PciBar[P2C_MEM_2].BarType == PciBarTypePMem32) {
- *PMem32Base = Bridge->PciBar[P2C_MEM_2].BaseAddress;
- }
-
- if (Bridge->PciBar[P2C_MEM_2].BarType == PciBarTypeMem32) {
- *Mem32Base = Bridge->PciBar[P2C_MEM_2].BaseAddress;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-NotifyPhase (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
- EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciResAlloc - add argument and description to function comment
-// TODO: Phase - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_HANDLE HostBridgeHandle;
- EFI_HANDLE RootBridgeHandle;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- EFI_STATUS Status;
-
- HostBridgeHandle = NULL;
- RootBridgeHandle = NULL;
- if (gPciPlatformProtocol != NULL) {
- //
- // Get Host Bridge Handle.
- //
- PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle);
-
- //
- // Get the rootbridge Io protocol to find the host bridge handle
- //
- Status = gBS->HandleProtocol (
- RootBridgeHandle,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &PciRootBridgeIo
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- HostBridgeHandle = PciRootBridgeIo->ParentHandle;
-
- //
- // Call PlatformPci::PhaseNotify() if the protocol is present.
- //
- gPciPlatformProtocol->PhaseNotify (
- gPciPlatformProtocol,
- HostBridgeHandle,
- Phase,
- ChipsetEntry
- );
- }
-
- Status = PciResAlloc->NotifyPhase (
- PciResAlloc,
- Phase
- );
-
- if (gPciPlatformProtocol != NULL) {
- //
- // Call PlatformPci::PhaseNotify() if the protocol is present.
- //
- gPciPlatformProtocol->PhaseNotify (
- gPciPlatformProtocol,
- HostBridgeHandle,
- Phase,
- ChipsetExit
- );
-
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PreprocessController (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 Bus,
- IN UINT8 Device,
- IN UINT8 Func,
- IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: Bus - add argument and description to function comment
-// TODO: Device - add argument and description to function comment
-// TODO: Func - add argument and description to function comment
-// TODO: Phase - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS RootBridgePciAddress;
- EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc;
- EFI_HANDLE RootBridgeHandle;
- EFI_HANDLE HostBridgeHandle;
- EFI_STATUS Status;
-
- //
- // Get the host bridge handle
- //
- HostBridgeHandle = Bridge->PciRootBridgeIo->ParentHandle;
-
- //
- // Get the pci host bridge resource allocation protocol
- //
- Status = gBS->OpenProtocol (
- HostBridgeHandle,
- &gEfiPciHostBridgeResourceAllocationProtocolGuid,
- (VOID **) &PciResAlloc,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Get Root Brige Handle
- //
- while (Bridge->Parent) {
- Bridge = Bridge->Parent;
- }
-
- RootBridgeHandle = Bridge->Handle;
-
- RootBridgePciAddress.Register = 0;
- RootBridgePciAddress.Function = Func;
- RootBridgePciAddress.Device = Device;
- RootBridgePciAddress.Bus = Bus;
- RootBridgePciAddress.ExtendedRegister = 0;
-
- if (gPciPlatformProtocol != NULL) {
- //
- // Call PlatformPci::PrepController() if the protocol is present.
- //
- gPciPlatformProtocol->PlatformPrepController (
- gPciPlatformProtocol,
- HostBridgeHandle,
- RootBridgeHandle,
- RootBridgePciAddress,
- Phase,
- ChipsetEntry
- );
- }
-
- Status = PciResAlloc->PreprocessController (
- PciResAlloc,
- RootBridgeHandle,
- RootBridgePciAddress,
- Phase
- );
-
- if (gPciPlatformProtocol != NULL) {
- //
- // Call PlatformPci::PrepController() if the protocol is present.
- //
- gPciPlatformProtocol->PlatformPrepController (
- gPciPlatformProtocol,
- HostBridgeHandle,
- RootBridgeHandle,
- RootBridgePciAddress,
- Phase,
- ChipsetExit
- );
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-PciHotPlugRequestNotify (
- IN EFI_PCI_HOTPLUG_REQUEST_PROTOCOL * This,
- IN EFI_PCI_HOTPLUG_OPERATION Operation,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL,
- IN OUT UINT8 *NumberOfChildren,
- IN OUT EFI_HANDLE * ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- Hot plug request notify.
-
-Arguments:
-
- This - A pointer to the hot plug request protocol.
- Operation - The operation.
- Controller - A pointer to the controller.
- RemainningDevicePath - A pointer to the device path.
- NumberOfChildren - A the number of child handle in the ChildHandleBuffer.
- ChildHandleBuffer - A pointer to the array contain the child handle.
-
-Returns:
-
- Status code.
-
---*/
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *Bridge;
- PCI_IO_DEVICE *Temp;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINTN Index;
- EFI_HANDLE RootBridgeHandle;
- EFI_STATUS Status;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- gPciBusDriverBinding.DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- Bridge = PCI_IO_DEVICE_FROM_PCI_IO_THIS (PciIo);
-
- //
- // Get root bridge handle
- //
- Temp = Bridge;
- while (Temp->Parent) {
- Temp = Temp->Parent;
- }
-
- RootBridgeHandle = Temp->Handle;
-
- if (Operation == EfiPciHotPlugRequestAdd) {
-
- if (NumberOfChildren != NULL) {
- *NumberOfChildren = 0;
- }
-
- if (IsListEmpty (&Bridge->ChildList)) {
-
- Status = PciBridgeEnumerator (Bridge);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- Status = StartPciDevicesOnBridge (
- RootBridgeHandle,
- Bridge,
- RemainingDevicePath,
- NumberOfChildren,
- ChildHandleBuffer
- );
-
- return EFI_SUCCESS;
- }
-
- if (Operation == EfiPciHotplugRequestRemove) {
-
- if (*NumberOfChildren == 0) {
- //
- // Remove all devices on the bridge
- //
- Status = RemoveAllPciDeviceOnBridge (RootBridgeHandle, Bridge);
- return Status;
-
- }
-
- for (Index = 0; Index < *NumberOfChildren; Index++) {
- //
- // De register all the pci device
- //
- Status = DeRegisterPciDevice (RootBridgeHandle, ChildHandleBuffer[Index]);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- }
- //
- // End for
- //
- return EFI_SUCCESS;
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-SearchHostBridgeHandle (
- IN EFI_HANDLE RootBridgeHandle
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: RootBridgeHandle - add argument and description to function comment
-{
- EFI_HANDLE HostBridgeHandle;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- UINTN Index;
- EFI_STATUS Status;
-
- //
- // Get the rootbridge Io protocol to find the host bridge handle
- //
- Status = gBS->OpenProtocol (
- RootBridgeHandle,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &PciRootBridgeIo,
- gPciBusDriverBinding.DriverBindingHandle,
- RootBridgeHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- HostBridgeHandle = PciRootBridgeIo->ParentHandle;
- for (Index = 0; Index < gPciHostBridgeNumber; Index++) {
- if (HostBridgeHandle == gPciHostBrigeHandles[Index]) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-AddHostBridgeEnumerator (
- IN EFI_HANDLE HostBridgeHandle
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: HostBridgeHandle - add argument and description to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINTN Index;
-
- if (!HostBridgeHandle) {
- return EFI_ABORTED;
- }
-
- for (Index = 0; Index < gPciHostBridgeNumber; Index++) {
- if (HostBridgeHandle == gPciHostBrigeHandles[Index]) {
- return EFI_ABORTED;
- }
- }
-
- if (Index < PCI_MAX_HOST_BRIDGE_NUM) {
- gPciHostBrigeHandles[Index] = HostBridgeHandle;
- gPciHostBridgeNumber++;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.h
deleted file mode 100644
index e7667d5..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumerator.h
+++ /dev/null
@@ -1,628 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciEnumerator.h
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_ENUMERATOR_H
-#define _EFI_PCI_ENUMERATOR_H
-
-#include "PciResourceSupport.h"
-
-EFI_STATUS
-PciEnumerator (
- IN EFI_HANDLE Controller
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Controller - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciRootBridgeEnumerator (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
- IN PCI_IO_DEVICE *RootBridgeDev
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciResAlloc - TODO: add argument description
- RootBridgeDev - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ProcessOptionRom (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT64 RomBase,
- IN UINT64 MaxLength
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- RomBase - TODO: add argument description
- MaxLength - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciAssignBusNumber (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- StartBusNumber - TODO: add argument description
- SubBusNumber - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-DetermineRootBridgeAttributes (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
- IN PCI_IO_DEVICE *RootBridgeDev
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciResAlloc - TODO: add argument description
- RootBridgeDev - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-UINT64
-GetMaxOptionRomSize (
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciHostBridgeDeviceAttribute (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciResAlloc - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GetResourceAllocationStatus (
- VOID *AcpiConfig,
- OUT UINT64 *IoResStatus,
- OUT UINT64 *Mem32ResStatus,
- OUT UINT64 *PMem32ResStatus,
- OUT UINT64 *Mem64ResStatus,
- OUT UINT64 *PMem64ResStatus
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AcpiConfig - TODO: add argument description
- IoResStatus - TODO: add argument description
- Mem32ResStatus - TODO: add argument description
- PMem32ResStatus - TODO: add argument description
- Mem64ResStatus - TODO: add argument description
- PMem64ResStatus - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-RejectPciDevice (
- IN PCI_IO_DEVICE *PciDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-IsRejectiveDevice (
- IN PCI_RESOURCE_NODE *PciResNode
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciResNode - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_RESOURCE_NODE *
-GetLargerConsumerDevice (
- IN PCI_RESOURCE_NODE *PciResNode1,
- IN PCI_RESOURCE_NODE *PciResNode2
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciResNode1 - TODO: add argument description
- PciResNode2 - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_RESOURCE_NODE *
-GetMaxResourceConsumerDevice (
- IN PCI_RESOURCE_NODE *ResPool
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ResPool - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciHostBridgeAdjustAllocation (
- IN PCI_RESOURCE_NODE *IoPool,
- IN PCI_RESOURCE_NODE *Mem32Pool,
- IN PCI_RESOURCE_NODE *PMem32Pool,
- IN PCI_RESOURCE_NODE *Mem64Pool,
- IN PCI_RESOURCE_NODE *PMem64Pool,
- IN UINT64 IoResStatus,
- IN UINT64 Mem32ResStatus,
- IN UINT64 PMem32ResStatus,
- IN UINT64 Mem64ResStatus,
- IN UINT64 PMem64ResStatus
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- IoPool - TODO: add argument description
- Mem32Pool - TODO: add argument description
- PMem32Pool - TODO: add argument description
- Mem64Pool - TODO: add argument description
- PMem64Pool - TODO: add argument description
- IoResStatus - TODO: add argument description
- Mem32ResStatus - TODO: add argument description
- PMem32ResStatus - TODO: add argument description
- Mem64ResStatus - TODO: add argument description
- PMem64ResStatus - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ConstructAcpiResourceRequestor (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_RESOURCE_NODE *IoNode,
- IN PCI_RESOURCE_NODE *Mem32Node,
- IN PCI_RESOURCE_NODE *PMem32Node,
- IN PCI_RESOURCE_NODE *Mem64Node,
- IN PCI_RESOURCE_NODE *PMem64Node,
- OUT VOID **pConfig
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- IoNode - TODO: add argument description
- Mem32Node - TODO: add argument description
- PMem32Node - TODO: add argument description
- Mem64Node - TODO: add argument description
- PMem64Node - TODO: add argument description
- pConfig - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GetResourceBase (
- IN VOID *pConfig,
- OUT UINT64 *IoBase,
- OUT UINT64 *Mem32Base,
- OUT UINT64 *PMem32Base,
- OUT UINT64 *Mem64Base,
- OUT UINT64 *PMem64Base
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- pConfig - TODO: add argument description
- IoBase - TODO: add argument description
- Mem32Base - TODO: add argument description
- PMem32Base - TODO: add argument description
- Mem64Base - TODO: add argument description
- PMem64Base - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciBridgeEnumerator (
- IN PCI_IO_DEVICE *BridgeDev
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- BridgeDev - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciBridgeResourceAllocator (
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GetResourceBaseFromBridge (
- IN PCI_IO_DEVICE *Bridge,
- OUT UINT64 *IoBase,
- OUT UINT64 *Mem32Base,
- OUT UINT64 *PMem32Base,
- OUT UINT64 *Mem64Base,
- OUT UINT64 *PMem64Base
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- IoBase - TODO: add argument description
- Mem32Base - TODO: add argument description
- PMem32Base - TODO: add argument description
- Mem64Base - TODO: add argument description
- PMem64Base - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciHostBridgeP2CProcess (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciResAlloc - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-NotifyPhase (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
- EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciResAlloc - TODO: add argument description
- Phase - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PreprocessController (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 Bus,
- IN UINT8 Device,
- IN UINT8 Func,
- IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- Bus - TODO: add argument description
- Device - TODO: add argument description
- Func - TODO: add argument description
- Phase - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciHotPlugRequestNotify (
- IN EFI_PCI_HOTPLUG_REQUEST_PROTOCOL * This,
- IN EFI_PCI_HOTPLUG_OPERATION Operation,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL,
- IN OUT UINT8 *NumberOfChildren,
- IN OUT EFI_HANDLE * ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Operation - TODO: add argument description
- Controller - TODO: add argument description
- RemainingDevicePath - TODO: add argument description
- NumberOfChildren - TODO: add argument description
- ChildHandleBuffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-SearchHostBridgeHandle (
- IN EFI_HANDLE RootBridgeHandle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridgeHandle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-AddHostBridgeEnumerator (
- IN EFI_HANDLE HostBridgeHandle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- HostBridgeHandle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.c
deleted file mode 100644
index 8020ab1..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.c
+++ /dev/null
@@ -1,2254 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciEnumeratorSupport.c
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-#include "PciEnumeratorSupport.h"
-#include "PciCommand.h"
-#include "PciIo.h"
-
-EFI_STATUS
-PciDevicePresent (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
- )
-/*++
-
-Routine Description:
-
- This routine is used to check whether the pci device is present
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciRootBridgeIo - add argument and description to function comment
-// TODO: Pci - add argument and description to function comment
-// TODO: Bus - add argument and description to function comment
-// TODO: Device - add argument and description to function comment
-// TODO: Func - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-{
- UINT64 Address;
- EFI_STATUS Status;
-
- //
- // Create PCI address map in terms of Bus, Device and Func
- //
- Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);
-
- //
- // Read the Vendor Id register
- //
- Status = PciRootBridgeIoRead (
- PciRootBridgeIo,
- NULL,
- EfiPciWidthUint32,
- Address,
- 1,
- Pci
- );
-
- if (!EFI_ERROR (Status) && (Pci->Hdr).VendorId != 0xffff) {
-
- //
- // Read the entire config header for the device
- //
-
- Status = PciRootBridgeIoRead (
- PciRootBridgeIo,
- NULL,
- EfiPciWidthUint32,
- Address,
- sizeof (PCI_TYPE00) / sizeof (UINT32),
- Pci
- );
-
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-PciPciDeviceInfoCollector (
- IN PCI_IO_DEVICE *Bridge,
- UINT8 StartBusNumber
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: StartBusNumber - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_TYPE00 Pci;
- UINT8 Device;
- UINT8 Func;
- UINT8 SecBus;
- PCI_IO_DEVICE *PciIoDevice;
- EFI_PCI_IO_PROTOCOL *PciIo;
-
- Status = EFI_SUCCESS;
- SecBus = 0;
-
- for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
-
- for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
-
- //
- // Check to see whether PCI device is present
- //
-
- Status = PciDevicePresent (
- Bridge->PciRootBridgeIo,
- &Pci,
- (UINT8) StartBusNumber,
- (UINT8) Device,
- (UINT8) Func
- );
-
- if (!EFI_ERROR (Status)) {
-
- //
- // Call back to host bridge function
- //
- PreprocessController (Bridge, (UINT8) StartBusNumber, Device, Func, EfiPciBeforeResourceCollection);
-
- //
- // Collect all the information about the PCI device discovered
- //
- Status = PciSearchDevice (
- Bridge,
- &Pci,
- (UINT8) StartBusNumber,
- Device,
- Func,
- &PciIoDevice
- );
-
- //
- // Recursively scan PCI busses on the other side of PCI-PCI bridges
- //
- //
-
- if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci))) {
-
- //
- // If it is PPB, we need to get the secondary bus to continue the enumeration
- //
- PciIo = &(PciIoDevice->PciIo);
-
- Status = PciIoRead (PciIo, EfiPciIoWidthUint8, 0x19, 1, &SecBus);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get resource padding for PPB
- //
- GetResourcePaddingPpb (PciIoDevice);
-
- //
- // Deep enumerate the next level bus
- //
- Status = PciPciDeviceInfoCollector (
- PciIoDevice,
- (UINT8) (SecBus)
- );
-
- }
-
- if (Func == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {
-
- //
- // Skip sub functions, this is not a multi function device
- //
- Func = PCI_MAX_FUNC;
- }
- }
-
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciSearchDevice (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_TYPE00 *Pci,
- IN UINT8 Bus,
- IN UINT8 Device,
- IN UINT8 Func,
- OUT PCI_IO_DEVICE **PciDevice
- )
-/*++
-
-Routine Description:
-
- Search required device.
-
-Arguments:
-
- Bridge - A pointer to the PCI_IO_DEVICE.
- Pci - A pointer to the PCI_TYPE00.
- Bus - Bus number.
- Device - Device number.
- Func - Function number.
- PciDevice - The Required pci device.
-
-Returns:
-
- Status code.
-
---*/
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = NULL;
-
- if (!IS_PCI_BRIDGE (Pci)) {
-
- if (IS_CARDBUS_BRIDGE (Pci)) {
- PciIoDevice = GatherP2CInfo (
- Bridge,
- Pci,
- Bus,
- Device,
- Func
- );
- if ((PciIoDevice != NULL) && gFullEnumeration) {
- InitializeP2C (PciIoDevice);
- }
- } else {
-
- //
- // Create private data for Pci Device
- //
- PciIoDevice = GatherDeviceInfo (
- Bridge,
- Pci,
- Bus,
- Device,
- Func
- );
-
- }
-
- } else {
-
- //
- // Create private data for PPB
- //
- PciIoDevice = GatherPpbInfo (
- Bridge,
- Pci,
- Bus,
- Device,
- Func
- );
-
- //
- // Special initialization for PPB including making the PPB quiet
- //
- if ((PciIoDevice != NULL) && gFullEnumeration) {
- InitializePpb (PciIoDevice);
- }
- }
-
- if (!PciIoDevice) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Update the bar information for this PCI device so as to support some specific device
- //
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT) {
- UpdatePciInfo (PciIoDevice);
- }
-
- if (PciIoDevice->DevicePath == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Detect this function has option rom
- //
- if (gFullEnumeration) {
-
- if (!IS_CARDBUS_BRIDGE (Pci)) {
-
- GetOpRomInfo (PciIoDevice);
-
- }
-
- ResetPowerManagementFeature (PciIoDevice);
-
- }
-
- //
- // Insert it into a global tree for future reference
- //
- InsertPciDevice (Bridge, PciIoDevice);
-
- //
- // Determine PCI device attributes
- //
-
- if (PciDevice != NULL) {
- *PciDevice = PciIoDevice;
- }
-
- return EFI_SUCCESS;
-}
-
-PCI_IO_DEVICE *
-GatherDeviceInfo (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: Pci - add argument and description to function comment
-// TODO: Bus - add argument and description to function comment
-// TODO: Device - add argument and description to function comment
-// TODO: Func - add argument and description to function comment
-{
- UINTN Offset;
- UINTN BarIndex;
- PCI_IO_DEVICE *PciIoDevice;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- PciRootBridgeIo = Bridge->PciRootBridgeIo;
- PciIoDevice = CreatePciIoDevice (
- PciRootBridgeIo,
- Pci,
- Bus,
- Device,
- Func
- );
-
- if (!PciIoDevice) {
- return NULL;
- }
-
- //
- // Create a device path for this PCI device and store it into its private data
- //
- CreatePciDevicePath (
- Bridge->DevicePath,
- PciIoDevice
- );
-
- //
- // If it is a full enumeration, disconnect the device in advance
- //
- if (gFullEnumeration) {
-
- PciDisableCommandRegister (PciIoDevice, EFI_PCI_COMMAND_BITS_OWNED);
-
- }
-
- //
- // Start to parse the bars
- //
- for (Offset = 0x10, BarIndex = 0; Offset <= 0x24; BarIndex++) {
- Offset = PciParseBar (PciIoDevice, Offset, BarIndex);
- }
-
- return PciIoDevice;
-}
-
-PCI_IO_DEVICE *
-GatherPpbInfo (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: Pci - add argument and description to function comment
-// TODO: Bus - add argument and description to function comment
-// TODO: Device - add argument and description to function comment
-// TODO: Func - add argument and description to function comment
-{
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- PCI_IO_DEVICE *PciIoDevice;
- EFI_STATUS Status;
- UINT32 Value;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT8 Temp;
-
- PciRootBridgeIo = Bridge->PciRootBridgeIo;
- PciIoDevice = CreatePciIoDevice (
- PciRootBridgeIo,
- Pci,
- Bus,
- Device,
- Func
- );
-
- if (!PciIoDevice) {
- return NULL;
- }
-
- //
- // Create a device path for this PCI device and store it into its private data
- //
- CreatePciDevicePath (
- Bridge->DevicePath,
- PciIoDevice
- );
-
- if (gFullEnumeration) {
- PciDisableCommandRegister (PciIoDevice, EFI_PCI_COMMAND_BITS_OWNED);
-
- //
- // Initalize the bridge control register
- //
- PciDisableBridgeControlRegister (PciIoDevice, EFI_PCI_BRIDGE_CONTROL_BITS_OWNED);
-
- }
-
- //
- // PPB can have two BARs
- //
- if (PciParseBar (PciIoDevice, 0x10, PPB_BAR_0) == 0x14) {
- //
- // Not 64-bit bar
- //
- PciParseBar (PciIoDevice, 0x14, PPB_BAR_1);
- }
-
- PciIo = &PciIoDevice->PciIo;
-
- //
- // Test whether it support 32 decode or not
- //
- PciIoRead (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Temp);
- PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &gAllOne);
- PciIoRead (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Value);
- PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &Temp);
-
- if (Value) {
- if (Value & 0x01) {
- PciIoDevice->Decodes |= EFI_BRIDGE_IO32_DECODE_SUPPORTED;
- } else {
- PciIoDevice->Decodes |= EFI_BRIDGE_IO16_DECODE_SUPPORTED;
- }
- }
-
- Status = BarExisted (
- PciIoDevice,
- 0x24,
- NULL,
- NULL
- );
-
- //
- // test if it supports 64 memory or not
- //
- if (!EFI_ERROR (Status)) {
-
- Status = BarExisted (
- PciIoDevice,
- 0x28,
- NULL,
- NULL
- );
-
- if (!EFI_ERROR (Status)) {
- PciIoDevice->Decodes |= EFI_BRIDGE_PMEM32_DECODE_SUPPORTED;
- PciIoDevice->Decodes |= EFI_BRIDGE_PMEM64_DECODE_SUPPORTED;
- } else {
- PciIoDevice->Decodes |= EFI_BRIDGE_PMEM32_DECODE_SUPPORTED;
- }
- }
-
- //
- // Memory 32 code is required for ppb
- //
- PciIoDevice->Decodes |= EFI_BRIDGE_MEM32_DECODE_SUPPORTED;
-
- GetResourcePaddingPpb (PciIoDevice);
-
- return PciIoDevice;
-}
-
-PCI_IO_DEVICE *
-GatherP2CInfo (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: Pci - add argument and description to function comment
-// TODO: Bus - add argument and description to function comment
-// TODO: Device - add argument and description to function comment
-// TODO: Func - add argument and description to function comment
-{
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciRootBridgeIo = Bridge->PciRootBridgeIo;
- PciIoDevice = CreatePciIoDevice (
- PciRootBridgeIo,
- Pci,
- Bus,
- Device,
- Func
- );
-
- if (!PciIoDevice) {
- return NULL;
- }
-
- //
- // Create a device path for this PCI device and store it into its private data
- //
- CreatePciDevicePath (
- Bridge->DevicePath,
- PciIoDevice
- );
-
- if (gFullEnumeration) {
- PciDisableCommandRegister (PciIoDevice, EFI_PCI_COMMAND_BITS_OWNED);
-
- //
- // Initalize the bridge control register
- //
- PciDisableBridgeControlRegister (PciIoDevice, EFI_PCCARD_BRIDGE_CONTROL_BITS_OWNED);
-
- }
- //
- // P2C only has one bar that is in 0x10
- //
- PciParseBar (PciIoDevice, 0x10, P2C_BAR_0);
-
- //
- // Read PciBar information from the bar register
- //
- GetBackPcCardBar (PciIoDevice);
- PciIoDevice->Decodes = EFI_BRIDGE_MEM32_DECODE_SUPPORTED |
- EFI_BRIDGE_PMEM32_DECODE_SUPPORTED |
- EFI_BRIDGE_IO32_DECODE_SUPPORTED;
-
- return PciIoDevice;
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-CreatePciDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: ParentDevicePath - add argument and description to function comment
-// TODO: PciIoDevice - add argument and description to function comment
-{
-
- PCI_DEVICE_PATH PciNode;
-
- //
- // Create PCI device path
- //
- PciNode.Header.Type = HARDWARE_DEVICE_PATH;
- PciNode.Header.SubType = HW_PCI_DP;
- SetDevicePathNodeLength (&PciNode.Header, sizeof (PciNode));
-
- PciNode.Device = PciIoDevice->DeviceNumber;
- PciNode.Function = PciIoDevice->FunctionNumber;
- PciIoDevice->DevicePath = AppendDevicePathNode (ParentDevicePath, &PciNode.Header);
-
- return PciIoDevice->DevicePath;
-}
-
-EFI_STATUS
-BarExisted (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINTN Offset,
- OUT UINT32 *BarLengthValue,
- OUT UINT32 *OriginalBarValue
- )
-/*++
-
-Routine Description:
-
- Check the bar is existed or not.
-
-Arguments:
-
- PciIoDevice - A pointer to the PCI_IO_DEVICE.
- Offset - The offset.
- BarLengthValue - The bar length value.
- OriginalBarValue - The original bar value.
-
-Returns:
-
- EFI_NOT_FOUND - The bar don't exist.
- EFI_SUCCESS - The bar exist.
-
---*/
-{
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT32 OriginalValue;
- UINT32 Value;
- EFI_TPL OldTpl;
-
- PciIo = &PciIoDevice->PciIo;
-
- //
- // Preserve the original value
- //
-
- PciIoRead (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);
-
- //
- // Raise TPL to high level to disable timer interrupt while the BAR is probed
- //
- OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-
- PciIoWrite (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &gAllOne);
- PciIoRead (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &Value);
-
- //
- // Write back the original value
- //
- PciIoWrite (PciIo, EfiPciIoWidthUint32, (UINT8) Offset, 1, &OriginalValue);
-
- //
- // Restore TPL to its original level
- //
- gBS->RestoreTPL (OldTpl);
-
- if (BarLengthValue != NULL) {
- *BarLengthValue = Value;
- }
-
- if (OriginalBarValue != NULL) {
- *OriginalBarValue = OriginalValue;
- }
-
- if (Value == 0) {
- return EFI_NOT_FOUND;
- } else {
- return EFI_SUCCESS;
- }
-}
-
-EFI_STATUS
-PciTestSupportedAttribute (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT16 *Command,
- IN UINT16 *BridgeControl,
- IN UINT16 *OldCommand,
- IN UINT16 *OldBridgeControl
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: Command - add argument and description to function comment
-// TODO: BridgeControl - add argument and description to function comment
-// TODO: OldCommand - add argument and description to function comment
-// TODO: OldBridgeControl - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_TPL OldTpl;
-
- //
- // Preserve the original value
- //
- PciReadCommandRegister (PciIoDevice, OldCommand);
-
- //
- // Raise TPL to high level to disable timer interrupt while the BAR is probed
- //
- OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-
- PciSetCommandRegister (PciIoDevice, *Command);
- PciReadCommandRegister (PciIoDevice, Command);
-
- //
- // Write back the original value
- //
- PciSetCommandRegister (PciIoDevice, *OldCommand);
-
- //
- // Restore TPL to its original level
- //
- gBS->RestoreTPL (OldTpl);
-
- if (IS_PCI_BRIDGE (&PciIoDevice->Pci) || IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
-
- //
- // Preserve the original value
- //
- PciReadBridgeControlRegister (PciIoDevice, OldBridgeControl);
-
- //
- // Raise TPL to high level to disable timer interrupt while the BAR is probed
- //
- OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-
- PciSetBridgeControlRegister (PciIoDevice, *BridgeControl);
- PciReadBridgeControlRegister (PciIoDevice, BridgeControl);
-
- //
- // Write back the original value
- //
- PciSetBridgeControlRegister (PciIoDevice, *OldBridgeControl);
-
- //
- // Restore TPL to its original level
- //
- gBS->RestoreTPL (OldTpl);
-
- } else {
- *OldBridgeControl = 0;
- *BridgeControl = 0;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciSetDeviceAttribute (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT16 Command,
- IN UINT16 BridgeControl,
- IN UINTN Option
- )
-/*++
-
- Routine Description:
- Set the supported or current attributes of a PCI device
-
- Arguments:
- PciIoDevice - Structure pointer for PCI device.
- Command - Command register value.
- BridgeControl - Bridge control value for PPB or P2C.
- Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
-
- Returns:
-
---*/
-
-/*++
-
-Routine Description:
-
-
-
-Arguments:
-
-
-Returns:
-
- EFI_SUCCESS Always success
-
-
---*/
-{
- UINT64 Attributes;
-
- Attributes = 0;
-
- if (Command & EFI_PCI_COMMAND_IO_SPACE) {
- Attributes |= EFI_PCI_IO_ATTRIBUTE_IO;
- }
-
- if (Command & EFI_PCI_COMMAND_MEMORY_SPACE) {
- Attributes |= EFI_PCI_IO_ATTRIBUTE_MEMORY;
- }
-
- if (Command & EFI_PCI_COMMAND_BUS_MASTER) {
- Attributes |= EFI_PCI_IO_ATTRIBUTE_BUS_MASTER;
- }
-
- if (Command & EFI_PCI_COMMAND_VGA_PALETTE_SNOOP) {
- Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO;
- }
-
- if (BridgeControl & EFI_PCI_BRIDGE_CONTROL_ISA) {
- Attributes |= EFI_PCI_IO_ATTRIBUTE_ISA_IO;
- }
-
- if (BridgeControl & EFI_PCI_BRIDGE_CONTROL_VGA) {
- Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_IO;
- Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY;
- Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO;
- }
-
- if (BridgeControl & EFI_PCI_BRIDGE_CONTROL_VGA_16) {
- Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_IO_16;
- Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16;
- }
-
- if (Option == EFI_SET_SUPPORTS) {
-
- Attributes |= EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE |
- EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED |
- EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE |
- EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE |
- EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM |
- EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE;
-
- if (Attributes & EFI_PCI_IO_ATTRIBUTE_IO) {
- Attributes |= EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO;
- Attributes |= EFI_PCI_IO_ATTRIBUTE_ISA_IO;
- }
-
- if (IS_PCI_BRIDGE (&PciIoDevice->Pci) || IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
- //
- // For bridge, it should support IDE attributes
- //
- Attributes |= EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO;
- Attributes |= EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO;
- } else {
-
- if (IS_PCI_IDE (&PciIoDevice->Pci)) {
- Attributes |= EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO;
- Attributes |= EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO;
- }
-
- if (IS_PCI_VGA (&PciIoDevice->Pci)) {
- Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY;
- Attributes |= EFI_PCI_IO_ATTRIBUTE_VGA_IO;
- }
- }
-
- PciIoDevice->Supports = Attributes;
- PciIoDevice->Supports &= ( (PciIoDevice->Parent->Supports) | \
- EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY | \
- EFI_PCI_IO_ATTRIBUTE_BUS_MASTER );
-
- } else {
- PciIoDevice->Attributes = Attributes;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetFastBackToBackSupport (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT8 StatusIndex
- )
-/*++
-
-Routine Description:
-
- Determine if the device can support Fast Back to Back attribute
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: StatusIndex - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_STATUS Status;
- UINT32 StatusRegister;
-
- //
- // Read the status register
- //
- PciIo = &PciIoDevice->PciIo;
- Status = PciIoRead (PciIo, EfiPciIoWidthUint16, StatusIndex, 1, &StatusRegister);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Check the Fast B2B bit
- //
- if (StatusRegister & EFI_PCI_FAST_BACK_TO_BACK_CAPABLE) {
- return EFI_SUCCESS;
- } else {
- return EFI_UNSUPPORTED;
- }
-
-}
-
-STATIC
-EFI_STATUS
-ProcessOptionRomLight (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- Process the option ROM for all the children of the specified parent PCI device.
- It can only be used after the first full Option ROM process.
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *Temp;
- LIST_ENTRY *CurrentLink;
-
- //
- // For RootBridge, PPB , P2C, go recursively to traverse all its children
- //
- CurrentLink = PciIoDevice->ChildList.ForwardLink;
- while (CurrentLink && CurrentLink != &PciIoDevice->ChildList) {
-
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- if (!IsListEmpty (&Temp->ChildList)) {
- ProcessOptionRomLight (Temp);
- }
-
- PciRomGetImageMapping (Temp);
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DetermineDeviceAttribute (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- Determine the related attributes of all devices under a Root Bridge
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT16 Command;
- UINT16 BridgeControl;
- UINT16 OldCommand;
- UINT16 OldBridgeControl;
- BOOLEAN FastB2BSupport;
-
- /*
- UINT8 IdePI;
- EFI_PCI_IO_PROTOCOL *PciIo;
- */
- PCI_IO_DEVICE *Temp;
- LIST_ENTRY *CurrentLink;
- EFI_STATUS Status;
-
- //
- // For Root Bridge, just copy it by RootBridgeIo proctocol
- // so as to keep consistent with the actual attribute
- //
- if (!PciIoDevice->Parent) {
- Status = PciIoDevice->PciRootBridgeIo->GetAttributes (
- PciIoDevice->PciRootBridgeIo,
- &PciIoDevice->Supports,
- &PciIoDevice->Attributes
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- } else {
-
- //
- // Set the attributes to be checked for common PCI devices and PPB or P2C
- // Since some devices only support part of them, it is better to set the
- // attribute according to its command or bridge control register
- //
- Command = EFI_PCI_COMMAND_IO_SPACE |
- EFI_PCI_COMMAND_MEMORY_SPACE |
- EFI_PCI_COMMAND_BUS_MASTER |
- EFI_PCI_COMMAND_VGA_PALETTE_SNOOP;
-
- BridgeControl = EFI_PCI_BRIDGE_CONTROL_ISA | EFI_PCI_BRIDGE_CONTROL_VGA | EFI_PCI_BRIDGE_CONTROL_VGA_16;
-
- //
- // Test whether the device can support attributes above
- //
- PciTestSupportedAttribute (PciIoDevice, &Command, &BridgeControl, &OldCommand, &OldBridgeControl);
-
- //
- // Set the supported attributes for specified PCI device
- //
- PciSetDeviceAttribute (PciIoDevice, Command, BridgeControl, EFI_SET_SUPPORTS);
-
- //
- // Set the current attributes for specified PCI device
- //
- PciSetDeviceAttribute (PciIoDevice, OldCommand, OldBridgeControl, EFI_SET_ATTRIBUTES);
-
- //
- // Enable other supported attributes but not defined in PCI_IO_PROTOCOL
- //
- PciEnableCommandRegister (PciIoDevice, EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE);
-
- //
- // Enable IDE native mode
- //
- /*
- if (IS_PCI_IDE(&PciIoDevice->Pci)) {
-
- PciIo = &PciIoDevice->PciIo;
-
- PciIoRead (
- PciIo,
- EfiPciIoWidthUint8,
- 0x09,
- 1,
- &IdePI
- );
-
- //
- // Set native mode if it can be supported
- //
- IdePI |= (((IdePI & 0x0F) >> 1) & 0x05);
-
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint8,
- 0x09,
- 1,
- &IdePI
- );
-
- }
- */
- }
-
- FastB2BSupport = TRUE;
-
- //
- // P2C can not support FB2B on the secondary side
- //
- if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
- FastB2BSupport = FALSE;
- }
-
- //
- // For RootBridge, PPB , P2C, go recursively to traverse all its children
- //
- CurrentLink = PciIoDevice->ChildList.ForwardLink;
- while (CurrentLink && CurrentLink != &PciIoDevice->ChildList) {
-
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- Status = DetermineDeviceAttribute (Temp);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Detect Fast Bact to Bact support for the device under the bridge
- //
- Status = GetFastBackToBackSupport (Temp, PCI_PRIMARY_STATUS_OFFSET);
- if (FastB2BSupport && EFI_ERROR (Status)) {
- FastB2BSupport = FALSE;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
- //
- // Set or clear Fast Back to Back bit for the whole bridge
- //
- if (!IsListEmpty (&PciIoDevice->ChildList)) {
-
- if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) {
-
- Status = GetFastBackToBackSupport (PciIoDevice, PCI_BRIDGE_STATUS_REGISTER_OFFSET);
-
- if (EFI_ERROR (Status) || (!FastB2BSupport)) {
- FastB2BSupport = FALSE;
- PciDisableBridgeControlRegister (PciIoDevice, EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK);
- } else {
- PciEnableBridgeControlRegister (PciIoDevice, EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK);
- }
- }
-
- CurrentLink = PciIoDevice->ChildList.ForwardLink;
- while (CurrentLink && CurrentLink != &PciIoDevice->ChildList) {
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
- if (FastB2BSupport) {
- PciEnableCommandRegister (Temp, EFI_PCI_COMMAND_FAST_BACK_TO_BACK);
- } else {
- PciDisableCommandRegister (Temp, EFI_PCI_COMMAND_FAST_BACK_TO_BACK);
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
- }
- //
- // End for IsListEmpty
- //
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UpdatePciInfo (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- This routine is used to update the bar information for those incompatible PCI device
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- UINTN BarIndex;
- UINTN BarEndIndex;
- BOOLEAN SetFlag;
- EFI_PCI_DEVICE_INFO PciDeviceInfo;
- VOID *Configuration;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
-
- Configuration = NULL;
-
- //
- // Check whether the device belongs to incompatible devices or not
- // If it is , then get its special requirement in the ACPI table
- //
- PciDeviceInfo.VendorID = PciIoDevice->Pci.Hdr.VendorId;
- PciDeviceInfo.DeviceID = PciIoDevice->Pci.Hdr.DeviceId;
- PciDeviceInfo.RevisionID = PciIoDevice->Pci.Hdr.RevisionID;
- PciDeviceInfo.SubsystemVendorID = PciIoDevice->Pci.Device.SubsystemVendorID;
- PciDeviceInfo.SubsystemID = PciIoDevice->Pci.Device.SubsystemID;
-
- Status = PciResourceUpdateCheck (&PciDeviceInfo, &Configuration);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Update PCI device information from the ACPI table
- //
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration;
-
- while (Ptr->Desc != ACPI_END_TAG_DESCRIPTOR) {
-
- if (Ptr->Desc != ACPI_ADDRESS_SPACE_DESCRIPTOR) {
- //
- // The format is not support
- //
- break;
- }
-
- BarIndex = (UINTN) Ptr->AddrTranslationOffset;
- BarEndIndex = BarIndex;
-
- //
- // Update all the bars in the device
- //
- if (BarIndex == PCI_BAR_ALL) {
- BarIndex = 0;
- BarEndIndex = PCI_MAX_BAR - 1;
- }
-
- if (BarIndex >= PCI_MAX_BAR) {
- Ptr++;
- continue;
- }
-
- for (; BarIndex <= BarEndIndex; BarIndex++) {
- SetFlag = FALSE;
- switch (Ptr->ResType) {
- case ACPI_ADDRESS_SPACE_TYPE_MEM:
-
- //
- // Make sure the bar is memory type
- //
- if (CheckBarType (PciIoDevice, (UINT8) BarIndex, PciBarTypeMem)) {
- SetFlag = TRUE;
- }
- break;
-
- case ACPI_ADDRESS_SPACE_TYPE_IO:
-
- //
- // Make sure the bar is IO type
- //
- if (CheckBarType (PciIoDevice, (UINT8) BarIndex, PciBarTypeIo)) {
- SetFlag = TRUE;
- }
- break;
- }
-
- if (SetFlag) {
-
- //
- // Update the new alignment for the device
- //
- SetNewAlign (&(PciIoDevice->PciBar[BarIndex].Alignment), Ptr->AddrRangeMax);
-
- //
- // Update the new length for the device
- //
- if (Ptr->AddrLen != PCI_BAR_NOCHANGE) {
- PciIoDevice->PciBar[BarIndex].Length = Ptr->AddrLen;
- }
- }
- }
-
- Ptr++;
- }
-
- gBS->FreePool (Configuration);
- return Status;
-
-}
-
-VOID
-SetNewAlign (
- IN UINT64 *Alignment,
- IN UINT64 NewAlignment
- )
-/*++
-
-Routine Description:
-
- This routine will update the alignment with the new alignment
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Alignment - add argument and description to function comment
-// TODO: NewAlignment - add argument and description to function comment
-{
- UINT64 OldAlignment;
- UINTN ShiftBit;
-
- //
- // The new alignment is the same as the original,
- // so skip it
- //
- if (NewAlignment == PCI_BAR_OLD_ALIGN) {
- return ;
- }
- //
- // Check the validity of the parameter
- //
- if (NewAlignment != PCI_BAR_EVEN_ALIGN &&
- NewAlignment != PCI_BAR_SQUAD_ALIGN &&
- NewAlignment != PCI_BAR_DQUAD_ALIGN ) {
- *Alignment = NewAlignment;
- return ;
- }
-
- OldAlignment = (*Alignment) + 1;
- ShiftBit = 0;
-
- //
- // Get the first non-zero hex value of the length
- //
- while ((OldAlignment & 0x0F) == 0x00) {
- OldAlignment = RShiftU64 (OldAlignment, 4);
- ShiftBit += 4;
- }
-
- //
- // Adjust the alignment to even, quad or double quad boundary
- //
- if (NewAlignment == PCI_BAR_EVEN_ALIGN) {
- if (OldAlignment & 0x01) {
- OldAlignment = OldAlignment + 2 - (OldAlignment & 0x01);
- }
- } else if (NewAlignment == PCI_BAR_SQUAD_ALIGN) {
- if (OldAlignment & 0x03) {
- OldAlignment = OldAlignment + 4 - (OldAlignment & 0x03);
- }
- } else if (NewAlignment == PCI_BAR_DQUAD_ALIGN) {
- if (OldAlignment & 0x07) {
- OldAlignment = OldAlignment + 8 - (OldAlignment & 0x07);
- }
- }
-
- //
- // Update the old value
- //
- NewAlignment = LShiftU64 (OldAlignment, ShiftBit) - 1;
- *Alignment = NewAlignment;
-
- return ;
-}
-
-UINTN
-PciParseBar (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINTN Offset,
- IN UINTN BarIndex
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-{
- UINT32 Value;
- UINT32 OriginalValue;
- UINT32 Mask;
- UINT32 Data;
- UINT8 Index;
- EFI_STATUS Status;
-
- OriginalValue = 0;
- Value = 0;
-
- Status = BarExisted (
- PciIoDevice,
- Offset,
- &Value,
- &OriginalValue
- );
-
- if (EFI_ERROR (Status)) {
- PciIoDevice->PciBar[BarIndex].BaseAddress = 0;
- PciIoDevice->PciBar[BarIndex].Length = 0;
- PciIoDevice->PciBar[BarIndex].Alignment = 0;
-
- //
- // Some devices don't fully comply to PCI spec 2.2. So be to scan all the BARs anyway
- //
- PciIoDevice->PciBar[BarIndex].Offset = (UINT8) Offset;
- return Offset + 4;
- }
-
- PciIoDevice->PciBar[BarIndex].Offset = (UINT8) Offset;
- if (Value & 0x01) {
- //
- // Device I/Os
- //
- Mask = 0xfffffffc;
-
- if (Value & 0xFFFF0000) {
- //
- // It is a IO32 bar
- //
- PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeIo32;
- PciIoDevice->PciBar[BarIndex].Length = ((~(Value & Mask)) + 1);
- PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
-
- } else {
- //
- // It is a IO16 bar
- //
- PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeIo16;
- PciIoDevice->PciBar[BarIndex].Length = 0x0000FFFF & ((~(Value & Mask)) + 1);
- PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
-
- }
- //
- // Workaround. Some platforms inplement IO bar with 0 length
- // Need to treat it as no-bar
- //
- if (PciIoDevice->PciBar[BarIndex].Length == 0) {
- PciIoDevice->PciBar[BarIndex].BarType = (PCI_BAR_TYPE) 0;
- }
-
- PciIoDevice->PciBar[BarIndex].Prefetchable = FALSE;
- PciIoDevice->PciBar[BarIndex].BaseAddress = OriginalValue & Mask;
-
- } else {
-
- Mask = 0xfffffff0;
-
- PciIoDevice->PciBar[BarIndex].BaseAddress = OriginalValue & Mask;
-
- switch (Value & 0x07) {
-
- //
- //memory space; anywhere in 32 bit address space
- //
- case 0x00:
- if (Value & 0x08) {
- PciIoDevice->PciBar[BarIndex].BarType = PciBarTypePMem32;
- } else {
- PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeMem32;
- }
-
- PciIoDevice->PciBar[BarIndex].Length = (~(Value & Mask)) + 1;
- PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
-
- break;
-
- //
- // memory space; anywhere in 64 bit address space
- //
- case 0x04:
- if (Value & 0x08) {
- PciIoDevice->PciBar[BarIndex].BarType = PciBarTypePMem64;
- } else {
- PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeMem64;
- }
-
- //
- // According to PCI 2.2,if the bar indicates a memory 64 decoding, next bar
- // is regarded as an extension for the first bar. As a result
- // the sizing will be conducted on combined 64 bit value
- // Here just store the masked first 32bit value for future size
- // calculation
- //
- PciIoDevice->PciBar[BarIndex].Length = Value & Mask;
- PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
-
- //
- // Increment the offset to point to next DWORD
- //
- Offset += 4;
-
- Status = BarExisted (
- PciIoDevice,
- Offset,
- &Value,
- &OriginalValue
- );
-
- if (EFI_ERROR (Status)) {
- return Offset + 4;
- }
-
- //
- // Fix the length to support some spefic 64 bit BAR
- //
- Data = Value;
- Index = 0;
- for (Data = Value; Data != 0; Data >>= 1) {
- Index ++;
- }
- Value |= ((UINT32)(-1) << Index);
-
- //
- // Calculate the size of 64bit bar
- //
- PciIoDevice->PciBar[BarIndex].BaseAddress |= LShiftU64 ((UINT64) OriginalValue, 32);
-
- PciIoDevice->PciBar[BarIndex].Length = PciIoDevice->PciBar[BarIndex].Length | LShiftU64 ((UINT64) Value, 32);
- PciIoDevice->PciBar[BarIndex].Length = (~(PciIoDevice->PciBar[BarIndex].Length)) + 1;
- PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
-
- break;
-
- //
- // reserved
- //
- default:
- PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeUnknown;
- PciIoDevice->PciBar[BarIndex].Length = (~(Value & Mask)) + 1;
- PciIoDevice->PciBar[BarIndex].Alignment = PciIoDevice->PciBar[BarIndex].Length - 1;
-
- break;
- }
- }
-
- //
- // Check the length again so as to keep compatible with some special bars
- //
- if (PciIoDevice->PciBar[BarIndex].Length == 0) {
- PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeUnknown;
- PciIoDevice->PciBar[BarIndex].BaseAddress = 0;
- PciIoDevice->PciBar[BarIndex].Alignment = 0;
- }
-
- //
- // Increment number of bar
- //
- return Offset + 4;
-}
-
-EFI_STATUS
-InitializePciDevice (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- This routine is used to initialize the bar of a PCI device
- It can be called typically when a device is going to be rejected
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT8 Offset;
-
- PciIo = &(PciIoDevice->PciIo);
-
- //
- // Put all the resource apertures
- // Resource base is set to all ones so as to indicate its resource
- // has not been alloacted
- //
- for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {
- PciIoWrite (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllOne);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InitializePpb (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_PCI_IO_PROTOCOL *PciIo;
-
- PciIo = &(PciIoDevice->PciIo);
-
- //
- // Put all the resource apertures including IO16
- // Io32, pMem32, pMem64 to quiescent state
- // Resource base all ones, Resource limit all zeros
- //
- PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x1C, 1, &gAllOne);
- PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x1D, 1, &gAllZero);
-
- PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x20, 1, &gAllOne);
- PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x22, 1, &gAllZero);
-
- PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x24, 1, &gAllOne);
- PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x26, 1, &gAllZero);
-
- PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllOne);
- PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x2C, 1, &gAllZero);
-
- //
- // don't support use io32 as for now
- //
- PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x30, 1, &gAllOne);
- PciIoWrite (PciIo, EfiPciIoWidthUint16, 0x32, 1, &gAllZero);
-
- //
- // Force Interrupt line to zero for cards that come up randomly
- //
- PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InitializeP2C (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_PCI_IO_PROTOCOL *PciIo;
-
- PciIo = &(PciIoDevice->PciIo);
-
- //
- // Put all the resource apertures including IO16
- // Io32, pMem32, pMem64 to quiescent state(
- // Resource base all ones, Resource limit all zeros
- //
- PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x1c, 1, &gAllOne);
- PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x20, 1, &gAllZero);
-
- PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x24, 1, &gAllOne);
- PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x28, 1, &gAllZero);
-
- PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x2c, 1, &gAllOne);
- PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x30, 1, &gAllZero);
-
- PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x34, 1, &gAllOne);
- PciIoWrite (PciIo, EfiPciIoWidthUint32, 0x38, 1, &gAllZero);
-
- //
- // Force Interrupt line to zero for cards that come up randomly
- //
- PciIoWrite (PciIo, EfiPciIoWidthUint8, 0x3C, 1, &gAllZero);
- return EFI_SUCCESS;
-}
-
-PCI_IO_DEVICE *
-CreatePciIoDevice (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciRootBridgeIo - add argument and description to function comment
-// TODO: Pci - add argument and description to function comment
-// TODO: Bus - add argument and description to function comment
-// TODO: Device - add argument and description to function comment
-// TODO: Func - add argument and description to function comment
-{
-
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = NULL;
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (PCI_IO_DEVICE),
- (VOID **) &PciIoDevice
- );
-
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- ZeroMem (PciIoDevice, sizeof (PCI_IO_DEVICE));
-
- PciIoDevice->Signature = PCI_IO_DEVICE_SIGNATURE;
- PciIoDevice->Handle = NULL;
- PciIoDevice->PciRootBridgeIo = PciRootBridgeIo;
- PciIoDevice->DevicePath = NULL;
- PciIoDevice->BusNumber = Bus;
- PciIoDevice->DeviceNumber = Device;
- PciIoDevice->FunctionNumber = Func;
- PciIoDevice->Decodes = 0;
- if (gFullEnumeration) {
- PciIoDevice->Allocated = FALSE;
- } else {
- PciIoDevice->Allocated = TRUE;
- }
-
- PciIoDevice->Registered = FALSE;
- PciIoDevice->Attributes = 0;
- PciIoDevice->Supports = 0;
- PciIoDevice->BusOverride = FALSE;
- PciIoDevice->AllOpRomProcessed = FALSE;
-
- PciIoDevice->IsPciExp = FALSE;
-
- CopyMem (&(PciIoDevice->Pci), Pci, sizeof (PCI_TYPE01));
-
- //
- // Initialize the PCI I/O instance structure
- //
-
- Status = InitializePciIoInstance (PciIoDevice);
- Status = InitializePciDriverOverrideInstance (PciIoDevice);
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (PciIoDevice);
- return NULL;
- }
-
- //
- // Initialize the reserved resource list
- //
- InitializeListHead (&PciIoDevice->ReservedResourceList);
-
- //
- // Initialize the driver list
- //
- InitializeListHead (&PciIoDevice->OptionRomDriverList);
-
- //
- // Initialize the child list
- //
- InitializeListHead (&PciIoDevice->ChildList);
-
- return PciIoDevice;
-}
-
-EFI_STATUS
-PciEnumeratorLight (
- IN EFI_HANDLE Controller
- )
-/*++
-
-Routine Description:
-
- This routine is used to enumerate entire pci bus system
- in a given platform
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Controller - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- EFI_STATUS Status;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- PCI_IO_DEVICE *RootBridgeDev;
- UINT16 MinBus;
- UINT16 MaxBus;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
-
- MinBus = 0;
- MaxBus = PCI_MAX_BUS;
- Descriptors = NULL;
-
- //
- // If this host bridge has been already enumerated, then return successfully
- //
- if (RootBridgeExisted (Controller)) {
- return EFI_SUCCESS;
- }
-
- //
- // Open pci root bridge io protocol
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &PciRootBridgeIo,
- gPciBusDriverBinding.DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Descriptors);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- while (PciGetBusRange (&Descriptors, &MinBus, &MaxBus, NULL) == EFI_SUCCESS) {
-
- //
- // Create a device node for root bridge device with a NULL host bridge controller handle
- //
- RootBridgeDev = CreateRootBridge (Controller);
-
- if (!RootBridgeDev) {
- Descriptors++;
- continue;
- }
-
- //
- // Record the root bridge io protocol
- //
- RootBridgeDev->PciRootBridgeIo = PciRootBridgeIo;
-
- Status = PciPciDeviceInfoCollector (
- RootBridgeDev,
- (UINT8) MinBus
- );
-
- if (!EFI_ERROR (Status)) {
-
- //
- // Remove those PCI devices which are rejected when full enumeration
- //
- RemoveRejectedPciDevices (RootBridgeDev->Handle, RootBridgeDev);
-
- //
- // Process option rom light
- //
- ProcessOptionRomLight (RootBridgeDev);
-
- //
- // Determine attributes for all devices under this root bridge
- //
- DetermineDeviceAttribute (RootBridgeDev);
-
- //
- // If successfully, insert the node into device pool
- //
- InsertRootBridge (RootBridgeDev);
- } else {
-
- //
- // If unsuccessly, destroy the entire node
- //
- DestroyRootBridge (RootBridgeDev);
- }
-
- Descriptors++;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciGetBusRange (
- IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,
- OUT UINT16 *MinBus,
- OUT UINT16 *MaxBus,
- OUT UINT16 *BusRange
- )
-/*++
-
-Routine Description:
-
- Get the bus range.
-
-Arguments:
-
- Descriptors - A pointer to the address space descriptor.
- MinBus - The min bus.
- MaxBus - The max bus.
- BusRange - The bus range.
-
-Returns:
-
- Status Code.
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-{
-
- while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {
- if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {
- if (MinBus != NULL) {
- *MinBus = (UINT16) (*Descriptors)->AddrRangeMin;
- }
-
- if (MaxBus != NULL) {
- *MaxBus = (UINT16) (*Descriptors)->AddrRangeMax;
- }
-
- if (BusRange != NULL) {
- *BusRange = (UINT16) (*Descriptors)->AddrLen;
- }
-
- return EFI_SUCCESS;
- }
-
- (*Descriptors)++;
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-StartManagingRootBridge (
- IN PCI_IO_DEVICE *RootBridgeDev
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: RootBridgeDev - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_HANDLE RootBridgeHandle;
- EFI_STATUS Status;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- //
- // Get the root bridge handle
- //
- RootBridgeHandle = RootBridgeDev->Handle;
- PciRootBridgeIo = NULL;
-
- //
- // Get the pci root bridge io protocol
- //
- Status = gBS->OpenProtocol (
- RootBridgeHandle,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &PciRootBridgeIo,
- gPciBusDriverBinding.DriverBindingHandle,
- RootBridgeHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- //
- // Store the PciRootBridgeIo protocol into root bridge private data
- //
- RootBridgeDev->PciRootBridgeIo = PciRootBridgeIo;
-
- return EFI_SUCCESS;
-
-}
-
-BOOLEAN
-IsPciDeviceRejected (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- This routine can be used to check whether a PCI device should be rejected when light enumeration
-
-Arguments:
-
-Returns:
-
- TRUE This device should be rejected
- FALSE This device shouldn't be rejected
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-{
- EFI_STATUS Status;
- UINT32 TestValue;
- UINT32 OldValue;
- UINT32 Mask;
- UINT8 BarOffset;
-
- //
- // PPB should be skip!
- //
- if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) {
- return FALSE;
- }
-
- if (IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
- //
- // Only test base registers for P2C
- //
- for (BarOffset = 0x1C; BarOffset <= 0x38; BarOffset += 2 * sizeof (UINT32)) {
-
- Mask = (BarOffset < 0x2C) ? 0xFFFFF000 : 0xFFFFFFFC;
- Status = BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- TestValue = TestValue & Mask;
- if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
- //
- // The bar isn't programed, so it should be rejected
- //
- return TRUE;
- }
- }
-
- return FALSE;
- }
-
- for (BarOffset = 0x14; BarOffset <= 0x24; BarOffset += sizeof (UINT32)) {
- //
- // Test PCI devices
- //
- Status = BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- if (TestValue & 0x01) {
-
- //
- // IO Bar
- //
-
- Mask = 0xFFFFFFFC;
- TestValue = TestValue & Mask;
- if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
- return TRUE;
- }
-
- } else {
-
- //
- // Mem Bar
- //
-
- Mask = 0xFFFFFFF0;
- TestValue = TestValue & Mask;
-
- if ((TestValue & 0x07) == 0x04) {
-
- //
- // Mem64 or PMem64
- //
- BarOffset += sizeof (UINT32);
- if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
-
- //
- // Test its high 32-Bit BAR
- //
-
- Status = BarExisted (PciIoDevice, BarOffset, &TestValue, &OldValue);
- if (TestValue == OldValue) {
- return TRUE;
- }
- }
-
- } else {
-
- //
- // Mem32 or PMem32
- //
- if ((TestValue != 0) && (TestValue == (OldValue & Mask))) {
- return TRUE;
- }
- }
- }
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-ResetAllPpbBusReg (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- StartBusNumber - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- PCI_TYPE00 Pci;
- UINT8 Device;
- UINT32 Register;
- UINT8 Func;
- UINT64 Address;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- PciRootBridgeIo = Bridge->PciRootBridgeIo;
-
- for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
- for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
-
- //
- // Check to see whether a pci device is present
- //
- Status = PciDevicePresent (
- PciRootBridgeIo,
- &Pci,
- StartBusNumber,
- Device,
- Func
- );
-
- if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci))) {
- Register = 0;
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);
- Status = PciRootBridgeIoRead (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint32,
- Address,
- 1,
- &Register
- );
- //
- // Reset register 18h, 19h, 1Ah on PCI Bridge
- //
- Register &= 0xFF000000;
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint32,
- Address,
- 1,
- &Register
- );
- }
-
- if (Func == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {
- //
- // Skip sub functions, this is not a multi function device
- //
- Func = PCI_MAX_FUNC;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.h
deleted file mode 100644
index 41d6efb..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciEnumeratorSupport.h
+++ /dev/null
@@ -1,598 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciEnumeratorSupport.h
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H
-#define _EFI_PCI_ENUMERATOR_SUPPORT_H
-
-EFI_STATUS
-PciDevicePresent (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciRootBridgeIo - TODO: add argument description
- Pci - TODO: add argument description
- Bus - TODO: add argument description
- Device - TODO: add argument description
- Func - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciPciDeviceInfoCollector (
- IN PCI_IO_DEVICE *Bridge,
- UINT8 StartBusNumber
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- StartBusNumber - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciSearchDevice (
- IN PCI_IO_DEVICE *Bridge,
- PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func,
- PCI_IO_DEVICE **PciDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- Pci - TODO: add argument description
- Bus - TODO: add argument description
- Device - TODO: add argument description
- Func - TODO: add argument description
- PciDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_IO_DEVICE *
-GatherDeviceInfo (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- Pci - TODO: add argument description
- Bus - TODO: add argument description
- Device - TODO: add argument description
- Func - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_IO_DEVICE *
-GatherPpbInfo (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- Pci - TODO: add argument description
- Bus - TODO: add argument description
- Device - TODO: add argument description
- Func - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_IO_DEVICE *
-GatherP2CInfo (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- Pci - TODO: add argument description
- Bus - TODO: add argument description
- Device - TODO: add argument description
- Func - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_DEVICE_PATH_PROTOCOL *
-CreatePciDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ParentDevicePath - TODO: add argument description
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-BarExisted (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINTN Offset,
- OUT UINT32 *BarLengthValue,
- OUT UINT32 *OriginalBarValue
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- Offset - TODO: add argument description
- BarLengthValue - TODO: add argument description
- OriginalBarValue - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciTestSupportedAttribute (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT16 *Command,
- IN UINT16 *BridgeControl,
- IN UINT16 *OldCommand,
- IN UINT16 *OldBridgeControl
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- Command - TODO: add argument description
- BridgeControl - TODO: add argument description
- OldCommand - TODO: add argument description
- OldBridgeControl - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciSetDeviceAttribute (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT16 Command,
- IN UINT16 BridgeControl,
- IN UINTN Option
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- Command - TODO: add argument description
- BridgeControl - TODO: add argument description
- Option - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GetFastBackToBackSupport (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT8 StatusIndex
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- StatusIndex - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-DetermineDeviceAttribute (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UpdatePciInfo (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-SetNewAlign (
- IN UINT64 *Alignment,
- IN UINT64 NewAlignment
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Alignment - TODO: add argument description
- NewAlignment - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-UINTN
-PciParseBar (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINTN Offset,
- IN UINTN BarIndex
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- Offset - TODO: add argument description
- BarIndex - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-InitializePciDevice (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-InitializePpb (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-InitializeP2C (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_IO_DEVICE *
-CreatePciIoDevice (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- IN PCI_TYPE00 *Pci,
- UINT8 Bus,
- UINT8 Device,
- UINT8 Func
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciRootBridgeIo - TODO: add argument description
- Pci - TODO: add argument description
- Bus - TODO: add argument description
- Device - TODO: add argument description
- Func - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciEnumeratorLight (
- IN EFI_HANDLE Controller
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Controller - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciGetBusRange (
- IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,
- OUT UINT16 *MinBus,
- OUT UINT16 *MaxBus,
- OUT UINT16 *BusRange
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Descriptors - TODO: add argument description
- MinBus - TODO: add argument description
- MaxBus - TODO: add argument description
- BusRange - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-StartManagingRootBridge (
- IN PCI_IO_DEVICE *RootBridgeDev
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridgeDev - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-IsPciDeviceRejected (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c
deleted file mode 100644
index 3ef1daf..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciHotPlugSupport.c
-
-Abstract:
-
-
-
-Revision History
-
---*/
-
-#include "Pcibus.h"
-#include "PciHotPlugSupport.h"
-
-EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
-EFI_HPC_LOCATION *gPciRootHpcPool;
-UINTN gPciRootHpcCount;
-ROOT_HPC_DATA *gPciRootHpcData;
-
-VOID
-EFIAPI
-PciHPCInitialized (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Event - add argument and description to function comment
-// TODO: Context - add argument and description to function comment
-{
- ROOT_HPC_DATA *HpcData;
-
- HpcData = (ROOT_HPC_DATA *) Context;
- HpcData->Initialized = TRUE;
-
-}
-
-BOOLEAN
-EfiCompareDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: DevicePath1 - add argument and description to function comment
-// TODO: DevicePath2 - add argument and description to function comment
-{
- UINTN Size1;
- UINTN Size2;
-
- Size1 = GetDevicePathSize (DevicePath1);
- Size2 = GetDevicePathSize (DevicePath2);
-
- if (Size1 != Size2) {
- return FALSE;
- }
-
- if (CompareMem (DevicePath1, DevicePath2, Size1)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-EFI_STATUS
-InitializeHotPlugSupport (
- VOID
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_HPC_LOCATION *HpcList;
- UINTN HpcCount;
-
- //
- // Locate the PciHotPlugInit Protocol
- // If it doesn't exist, that means there is no
- // hot plug controller supported on the platform
- // the PCI Bus driver is running on. HotPlug Support
- // is an optional feature, so absence of the protocol
- // won't incur the penalty
- //
- gPciHotPlugInit = NULL;
- gPciRootHpcPool = NULL;
- gPciRootHpcCount = 0;
- gPciRootHpcData = NULL;
-
- Status = gBS->LocateProtocol (
- &gEfiPciHotPlugInitProtocolGuid,
- NULL,
- (VOID **) &gPciHotPlugInit
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = gPciHotPlugInit->GetRootHpcList (
- gPciHotPlugInit,
- &HpcCount,
- &HpcList
- );
-
- if (!EFI_ERROR (Status)) {
-
- gPciRootHpcPool = HpcList;
- gPciRootHpcCount = HpcCount;
- gPciRootHpcData = AllocateZeroPool (sizeof (ROOT_HPC_DATA) * gPciRootHpcCount);
- if (gPciRootHpcData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-IsRootPciHotPlugBus (
- IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
- OUT UINTN *HpIndex
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCOL.
- HpIndex - A pointer to the Index.
-
-Returns:
-
- None
-
---*/
-// TODO: HpbDevicePath - add argument and description to function comment
-{
- UINTN Index;
-
- for (Index = 0; Index < gPciRootHpcCount; Index++) {
-
- if (EfiCompareDevicePath (gPciRootHpcPool[Index].HpbDevicePath, HpbDevicePath)) {
-
- if (HpIndex != NULL) {
- *HpIndex = Index;
- }
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-BOOLEAN
-IsRootPciHotPlugController (
- IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
- OUT UINTN *HpIndex
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCOL.
- HpIndex - A pointer to the Index.
-
-Returns:
-
- None
-
---*/
-{
- UINTN Index;
-
- for (Index = 0; Index < gPciRootHpcCount; Index++) {
-
- if (EfiCompareDevicePath (gPciRootHpcPool[Index].HpcDevicePath, HpcDevicePath)) {
-
- if (HpIndex != NULL) {
- *HpIndex = Index;
- }
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-CreateEventForHpc (
- IN UINTN HpIndex,
- OUT EFI_EVENT *Event
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: HpIndex - add argument and description to function comment
-// TODO: Event - add argument and description to function comment
-{
- EFI_STATUS Status;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- PciHPCInitialized,
- gPciRootHpcData + HpIndex,
- &((gPciRootHpcData + HpIndex)->Event)
- );
-
- if (!EFI_ERROR (Status)) {
- *Event = (gPciRootHpcData + HpIndex)->Event;
- }
-
- return Status;
-}
-
-EFI_STATUS
-AllRootHPCInitialized (
- IN UINTN TimeoutInMicroSeconds
- )
-/*++
-
-Routine Description:
-
-Arguments:
- TimeoutInMicroSeconds - microseconds to wait for all root hpc's initialization
-
-Returns:
- EFI_SUCCESS - All root hpc's initialization is finished before the timeout
- EFI_TIMEOUT - Time out
-
---*/
-// TODO: TimeoutInMilliSeconds - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_TIMEOUT - add return value to function comment
-{
- UINT32 Delay;
- UINTN Index;
-
- Delay = (UINT32) ((TimeoutInMicroSeconds / 30) + 1);
- do {
-
- for (Index = 0; Index < gPciRootHpcCount; Index++) {
-
- if (!gPciRootHpcData[Index].Initialized) {
- break;
- }
- }
-
- if (Index == gPciRootHpcCount) {
- return EFI_SUCCESS;
- }
-
- //
- // Stall for 30 us
- //
- gBS->Stall (30);
-
- Delay--;
-
- } while (Delay);
-
- return EFI_TIMEOUT;
-}
-
-EFI_STATUS
-IsSHPC (
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-{
-
- EFI_STATUS Status;
- UINT8 Offset;
-
- if (!PciIoDevice) {
- return EFI_NOT_FOUND;
- }
-
- Offset = 0;
- Status = LocateCapabilityRegBlock (
- PciIoDevice,
- EFI_PCI_CAPABILITY_ID_HOTPLUG,
- &Offset,
- NULL
- );
-
- //
- // If the PPB has the hot plug controller build-in,
- // then return TRUE;
- //
- if (!EFI_ERROR (Status)) {
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-GetResourcePaddingForHpb (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_HPC_STATE State;
- UINT64 PciAddress;
- EFI_HPC_PADDING_ATTRIBUTES Attributes;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
-
- Status = IsPciHotPlugBus (PciIoDevice);
-
- if (!EFI_ERROR (Status)) {
- PciAddress = EFI_PCI_ADDRESS (PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, 0);
- Status = gPciHotPlugInit->GetResourcePadding (
- gPciHotPlugInit,
- PciIoDevice->DevicePath,
- PciAddress,
- &State,
- (VOID **) &Descriptors,
- &Attributes
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if ((State & EFI_HPC_STATE_ENABLED) && (State & EFI_HPC_STATE_INITIALIZED)) {
- PciIoDevice->ResourcePaddingDescriptors = Descriptors;
- PciIoDevice->PaddingAttributes = Attributes;
- }
-
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-IsPciHotPlugBus (
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-{
- BOOLEAN Result;
- EFI_STATUS Status;
-
- Status = IsSHPC (PciIoDevice);
-
- //
- // If the PPB has the hot plug controller build-in,
- // then return TRUE;
- //
- if (!EFI_ERROR (Status)) {
- return EFI_SUCCESS;
- }
-
- //
- // Otherwise, see if it is a Root HPC
- //
- Result = IsRootPciHotPlugBus (PciIoDevice->DevicePath, NULL);
-
- if (Result) {
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.h
deleted file mode 100644
index 7b15a3c..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciHotPlugSupport.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciHotPlugSupport.h
-
-Abstract:
-
-
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_HOT_PLUG_SUPPORT_H
-#define _EFI_PCI_HOT_PLUG_SUPPORT_H
-
-
-//
-// stall 1 second
-//
-#define STALL_1_SECOND 1000000
-
-typedef struct {
- EFI_EVENT Event;
- BOOLEAN Initialized;
- VOID *Padding;
-} ROOT_HPC_DATA;
-
-extern EFI_PCI_HOT_PLUG_INIT_PROTOCOL *gPciHotPlugInit;
-extern EFI_HPC_LOCATION *gPciRootHpcPool;
-extern UINTN gPciRootHpcCount;
-extern ROOT_HPC_DATA *gPciRootHpcData;
-
-VOID
-EFIAPI
-PciHPCInitialized (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Event - TODO: add argument description
- Context - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-EfiCompareDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- DevicePath1 - TODO: add argument description
- DevicePath2 - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-InitializeHotPlugSupport (
- VOID
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- None
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-IsPciHotPlugBus (
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-IsRootPciHotPlugBus (
- IN EFI_DEVICE_PATH_PROTOCOL *HpbDevicePath,
- OUT UINTN *HpIndex
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- HpbDevicePath - TODO: add argument description
- HpIndex - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-IsRootPciHotPlugController (
- IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
- OUT UINTN *HpIndex
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- HpcDevicePath - TODO: add argument description
- HpIndex - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-CreateEventForHpc (
- IN UINTN HpIndex,
- OUT EFI_EVENT *Event
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- HpIndex - TODO: add argument description
- Event - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-AllRootHPCInitialized (
- IN UINTN TimeoutInMicroSeconds
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
- TimeoutInMicroSeconds - microseconds to wait for all root hpc's initialization
-
-Returns:
- EFI_SUCCESS - All root hpc's initialization is finished before the timeout
- EFI_TIMEOUT - Time out
-
---*/
-;
-
-EFI_STATUS
-IsSHPC (
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GetResourcePaddingForHpb (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c
deleted file mode 100644
index a636d4f..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c
+++ /dev/null
@@ -1,1980 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciIo.c
-
-Abstract:
-
- PCI I/O Abstraction Driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-
-//
-// Internal use only
-//
-STATIC
-EFI_STATUS
-ReportErrorStatusCode (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_STATUS_CODE_VALUE Code
- );
-
-//
-// PCI I/O Support Function Prototypes
-//
-//
-//
-// Pci Io Protocol Interface
-//
-static EFI_PCI_IO_PROTOCOL PciIoInterface = {
- PciIoPollMem,
- PciIoPollIo,
- {
- PciIoMemRead,
- PciIoMemWrite
- },
- {
- PciIoIoRead,
- PciIoIoWrite
- },
- {
- PciIoConfigRead,
- PciIoConfigWrite
- },
- PciIoCopyMem,
- PciIoMap,
- PciIoUnmap,
- PciIoAllocateBuffer,
- PciIoFreeBuffer,
- PciIoFlush,
- PciIoGetLocation,
- PciIoAttributes,
- PciIoGetBarAttributes,
- PciIoSetBarAttributes,
- 0,
- NULL
-};
-
-STATIC
-EFI_STATUS
-ReportErrorStatusCode (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_STATUS_CODE_VALUE Code
- )
-/*++
-
-Routine Description:
-
- report a error Status code of PCI bus driver controller
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: Code - add argument and description to function comment
-{
- return REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- Code,
- PciIoDevice->DevicePath
- );
-}
-
-EFI_STATUS
-InitializePciIoInstance (
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- Initializes a PCI I/O Instance
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- CopyMem (&PciIoDevice->PciIo, &PciIoInterface, sizeof (EFI_PCI_IO_PROTOCOL));
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciIoVerifyBarAccess (
- PCI_IO_DEVICE *PciIoDevice,
- UINT8 BarIndex,
- PCI_BAR_TYPE Type,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- UINT64 *Offset
- )
-/*++
-
-Routine Description:
-
- Verifies access to a PCI Base Address Register (BAR)
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-// TODO: Type - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: Count - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- if (Width < 0 || Width >= EfiPciIoWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BarIndex == EFI_PCI_IO_PASS_THROUGH_BAR) {
- return EFI_SUCCESS;
- }
-
- //
- // BarIndex 0-5 is legal
- //
- if (BarIndex >= PCI_MAX_BAR) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!CheckBarType (PciIoDevice, BarIndex, Type)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // If Width is EfiPciIoWidthFifoUintX then convert to EfiPciIoWidthUintX
- // If Width is EfiPciIoWidthFillUintX then convert to EfiPciIoWidthUintX
- //
- if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) {
- Count = 1;
- }
-
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) (Width & 0x03);
-
- if ((*Offset + Count * (UINTN)(1 << Width)) - 1 >= PciIoDevice->PciBar[BarIndex].Length) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Offset = *Offset + PciIoDevice->PciBar[BarIndex].BaseAddress;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciIoVerifyConfigAccess (
- PCI_IO_DEVICE *PciIoDevice,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- IN UINT64 *Offset
- )
-/*++
-
-Routine Description:
-
- Verifies access to a PCI Config Header
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: Count - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT64 ExtendOffset;
-
- if (Width < 0 || Width >= EfiPciIoWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // If Width is EfiPciIoWidthFillUintX then convert to EfiPciIoWidthUintX
- //
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) (Width & 0x03);
-
- if (PciIoDevice->IsPciExp) {
- if ((*Offset + Count * (UINTN)(1 << Width)) - 1 >= PCI_EXP_MAX_CONFIG_OFFSET) {
- return EFI_UNSUPPORTED;
- }
-
- ExtendOffset = LShiftU64 (*Offset, 32);
- *Offset = EFI_PCI_ADDRESS (PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, 0);
- *Offset = (*Offset) | ExtendOffset;
-
- } else {
- if ((*Offset + Count * (UINTN)(1 << Width)) - 1 >= PCI_MAX_CONFIG_OFFSET) {
- return EFI_UNSUPPORTED;
- }
-
- *Offset = EFI_PCI_ADDRESS (PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, *Offset);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoPollMem (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- )
-/*++
-
-Routine Description:
-
- Poll PCI Memmory
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: Mask - add argument and description to function comment
-// TODO: Value - add argument and description to function comment
-// TODO: Delay - add argument and description to function comment
-// TODO: Result - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (Width < 0 || Width >= EfiPciIoWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = PciIoVerifyBarAccess (PciIoDevice, BarIndex, PciBarTypeMem, Width, 1, &Offset);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- if (Width > EfiPciIoWidthUint64) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = PciIoDevice->PciRootBridgeIo->PollMem (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Offset,
- Mask,
- Value,
- Delay,
- Result
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoPollIo (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- )
-/*++
-
-Routine Description:
-
- Poll PCI IO
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: Mask - add argument and description to function comment
-// TODO: Value - add argument and description to function comment
-// TODO: Delay - add argument and description to function comment
-// TODO: Result - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (Width < 0 || Width > EfiPciIoWidthUint64) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = PciIoVerifyBarAccess (PciIoDevice, BarIndex, PciBarTypeIo, Width, 1, &Offset);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = PciIoDevice->PciRootBridgeIo->PollIo (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Offset,
- Mask,
- Value,
- Delay,
- Result
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoMemRead (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Performs a PCI Memory Read Cycle
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: Count - add argument and description to function comment
-// TODO: Buffer - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (Width < 0 || Width >= EfiPciIoWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = PciIoVerifyBarAccess (PciIoDevice, BarIndex, PciBarTypeMem, Width, Count, &Offset);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = PciIoDevice->PciRootBridgeIo->Mem.Read (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Offset,
- Count,
- Buffer
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_READ_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoMemWrite (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Performs a PCI Memory Write Cycle
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: Count - add argument and description to function comment
-// TODO: Buffer - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (Width < 0 || Width >= EfiPciIoWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = PciIoVerifyBarAccess (PciIoDevice, BarIndex, PciBarTypeMem, Width, Count, &Offset);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = PciIoDevice->PciRootBridgeIo->Mem.Write (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Offset,
- Count,
- Buffer
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_WRITE_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoIoRead (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Performs a PCI I/O Read Cycle
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: Count - add argument and description to function comment
-// TODO: Buffer - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (Width < 0 || Width >= EfiPciIoWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = PciIoVerifyBarAccess (PciIoDevice, BarIndex, PciBarTypeIo, Width, Count, &Offset);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = PciIoDevice->PciRootBridgeIo->Io.Read (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Offset,
- Count,
- Buffer
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_READ_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoIoWrite (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Performs a PCI I/O Write Cycle
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: Count - add argument and description to function comment
-// TODO: Buffer - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (Width < 0 || Width >= EfiPciIoWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = PciIoVerifyBarAccess (PciIoDevice, BarIndex, PciBarTypeIo, Width, Count, &Offset);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = PciIoDevice->PciRootBridgeIo->Io.Write (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Offset,
- Count,
- Buffer
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_WRITE_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoConfigRead (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Performs a PCI Configuration Read Cycle
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: Count - add argument and description to function comment
-// TODO: Buffer - add argument and description to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
- UINT64 Address;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- Address = Offset;
- Status = PciIoVerifyConfigAccess (PciIoDevice, Width, Count, &Address);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = PciIoDevice->PciRootBridgeIo->Pci.Read (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- Count,
- Buffer
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_READ_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoConfigWrite (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Performs a PCI Configuration Write Cycle
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: Count - add argument and description to function comment
-// TODO: Buffer - add argument and description to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
- UINT64 Address;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- Address = Offset;
- Status = PciIoVerifyConfigAccess (PciIoDevice, Width, Count, &Address);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = PciIoDevice->PciRootBridgeIo->Pci.Write (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- Count,
- Buffer
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_WRITE_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoCopyMem (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 DestBarIndex,
- IN UINT64 DestOffset,
- IN UINT8 SrcBarIndex,
- IN UINT64 SrcOffset,
- IN UINTN Count
- )
-/*++
-
-Routine Description:
-
- Copy PCI Memory
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Width - add argument and description to function comment
-// TODO: DestBarIndex - add argument and description to function comment
-// TODO: DestOffset - add argument and description to function comment
-// TODO: SrcBarIndex - add argument and description to function comment
-// TODO: SrcOffset - add argument and description to function comment
-// TODO: Count - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (Width < 0 || Width >= EfiPciIoWidthMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width == EfiPciIoWidthFifoUint8 ||
- Width == EfiPciIoWidthFifoUint16 ||
- Width == EfiPciIoWidthFifoUint32 ||
- Width == EfiPciIoWidthFifoUint64 ||
- Width == EfiPciIoWidthFillUint8 ||
- Width == EfiPciIoWidthFillUint16 ||
- Width == EfiPciIoWidthFillUint32 ||
- Width == EfiPciIoWidthFillUint64) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = PciIoVerifyBarAccess (PciIoDevice, DestBarIndex, PciBarTypeMem, Width, Count, &DestOffset);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = PciIoVerifyBarAccess (PciIoDevice, SrcBarIndex, PciBarTypeMem, Width, Count, &SrcOffset);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = PciIoDevice->PciRootBridgeIo->CopyMem (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- DestOffset,
- SrcOffset,
- Count
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoMap (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- )
-/*++
-
-Routine Description:
-
- Maps a memory region for DMA
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Operation - add argument and description to function comment
-// TODO: HostAddress - add argument and description to function comment
-// TODO: NumberOfBytes - add argument and description to function comment
-// TODO: DeviceAddress - add argument and description to function comment
-// TODO: Mapping - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (Operation < 0 || Operation >= EfiPciIoOperationMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (HostAddress == NULL || NumberOfBytes == NULL || DeviceAddress == NULL || Mapping == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (PciIoDevice->Attributes & EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE) {
- Operation = (EFI_PCI_IO_PROTOCOL_OPERATION) (Operation + EfiPciOperationBusMasterRead64);
- }
-
- Status = PciIoDevice->PciRootBridgeIo->Map (
- PciIoDevice->PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION) Operation,
- HostAddress,
- NumberOfBytes,
- DeviceAddress,
- Mapping
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoUnmap (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN VOID *Mapping
- )
-/*++
-
-Routine Description:
-
- Unmaps a memory region for DMA
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Mapping - add argument and description to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- Status = PciIoDevice->PciRootBridgeIo->Unmap (
- PciIoDevice->PciRootBridgeIo,
- Mapping
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoAllocateBuffer (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT VOID **HostAddress,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- Allocates a common buffer for DMA
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Type - add argument and description to function comment
-// TODO: MemoryType - add argument and description to function comment
-// TODO: Pages - add argument and description to function comment
-// TODO: HostAddress - add argument and description to function comment
-// TODO: Attributes - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- if (Attributes &
- (~(EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE | EFI_PCI_ATTRIBUTE_MEMORY_CACHED))) {
- return EFI_UNSUPPORTED;
- }
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (PciIoDevice->Attributes & EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE) {
- Attributes |= EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE;
- }
-
- Status = PciIoDevice->PciRootBridgeIo->AllocateBuffer (
- PciIoDevice->PciRootBridgeIo,
- Type,
- MemoryType,
- Pages,
- HostAddress,
- Attributes
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoFreeBuffer (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN UINTN Pages,
- IN VOID *HostAddress
- )
-/*++
-
-Routine Description:
-
- Frees a common buffer
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Pages - add argument and description to function comment
-// TODO: HostAddress - add argument and description to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- Status = PciIoDevice->PciRootBridgeIo->FreeBuffer (
- PciIoDevice->PciRootBridgeIo,
- Pages,
- HostAddress
- );
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoFlush (
- IN EFI_PCI_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- Flushes a DMA buffer
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- Status = PciIoDevice->PciRootBridgeIo->Flush (
- PciIoDevice->PciRootBridgeIo
- );
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoGetLocation (
- IN EFI_PCI_IO_PROTOCOL *This,
- OUT UINTN *Segment,
- OUT UINTN *Bus,
- OUT UINTN *Device,
- OUT UINTN *Function
- )
-/*++
-
-Routine Description:
-
- Gets a PCI device's current bus number, device number, and function number.
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Segment - add argument and description to function comment
-// TODO: Bus - add argument and description to function comment
-// TODO: Device - add argument and description to function comment
-// TODO: Function - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *PciIoDevice;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (Segment == NULL || Bus == NULL || Device == NULL || Function == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Segment = PciIoDevice->PciRootBridgeIo->SegmentNumber;
- *Bus = PciIoDevice->BusNumber;
- *Device = PciIoDevice->DeviceNumber;
- *Function = PciIoDevice->FunctionNumber;
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-CheckBarType (
- IN PCI_IO_DEVICE *PciIoDevice,
- UINT8 BarIndex,
- PCI_BAR_TYPE BarType
- )
-/*++
-
-Routine Description:
-
- Sets a PCI controllers attributes on a resource range
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-// TODO: BarType - add argument and description to function comment
-{
- switch (BarType) {
-
- case PciBarTypeMem:
-
- if (PciIoDevice->PciBar[BarIndex].BarType != PciBarTypeMem32 &&
- PciIoDevice->PciBar[BarIndex].BarType != PciBarTypePMem32 &&
- PciIoDevice->PciBar[BarIndex].BarType != PciBarTypePMem64 &&
- PciIoDevice->PciBar[BarIndex].BarType != PciBarTypeMem64 ) {
- return FALSE;
- }
-
- return TRUE;
-
- case PciBarTypeIo:
- if (PciIoDevice->PciBar[BarIndex].BarType != PciBarTypeIo32 &&
- PciIoDevice->PciBar[BarIndex].BarType != PciBarTypeIo16){
- return FALSE;
- }
-
- return TRUE;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-ModifyRootBridgeAttributes (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT64 Attributes,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
- )
-/*++
-
-Routine Description:
-
- Set new attributes to a Root Bridge
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: Attributes - add argument and description to function comment
-// TODO: Operation - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT64 PciRootBridgeSupports;
- UINT64 PciRootBridgeAttributes;
- UINT64 NewPciRootBridgeAttributes;
- EFI_STATUS Status;
-
- //
- // Get the current attributes of this PCI device's PCI Root Bridge
- //
- Status = PciIoDevice->PciRootBridgeIo->GetAttributes (
- PciIoDevice->PciRootBridgeIo,
- &PciRootBridgeSupports,
- &PciRootBridgeAttributes
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Record the new attribute of the Root Bridge
- //
- if (Operation == EfiPciIoAttributeOperationEnable) {
- NewPciRootBridgeAttributes = PciRootBridgeAttributes | Attributes;
- } else {
- NewPciRootBridgeAttributes = PciRootBridgeAttributes & (~Attributes);
- }
-
- //
- // Call the PCI Root Bridge to attempt to modify the attributes
- //
- if (NewPciRootBridgeAttributes ^ PciRootBridgeAttributes) {
-
- Status = PciIoDevice->PciRootBridgeIo->SetAttributes (
- PciIoDevice->PciRootBridgeIo,
- NewPciRootBridgeAttributes,
- NULL,
- NULL
- );
- if (EFI_ERROR (Status)) {
- //
- // The PCI Root Bridge could not modify the attributes, so return the error.
- //
- return EFI_UNSUPPORTED;
- }
- }
-
- //
- // Also update the attributes for this Root Bridge structure
- //
- PciIoDevice->Attributes = NewPciRootBridgeAttributes;
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-SupportPaletteSnoopAttributes (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
- )
-/*++
-
-Routine Description:
-
- Check whether this device can be enable/disable to snoop
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: Operation - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *Temp;
- UINT16 VGACommand;
-
- //
- // Snoop attribute can be only modified by GFX
- //
- if (!IS_PCI_GFX (&PciIoDevice->Pci)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Get the boot VGA on the same segement
- //
- Temp = ActiveVGADeviceOnTheSameSegment (PciIoDevice);
-
- if (!Temp) {
- //
- // If there is no VGA device on the segement, set
- // this graphics card to decode the palette range
- //
- return EFI_SUCCESS;
- }
-
- //
- // Check these two agents are on the same path
- //
- if (!PciDevicesOnTheSamePath (Temp, PciIoDevice)) {
- //
- // they are not on the same path, so snoop can be enabled or disabled
- //
- return EFI_SUCCESS;
- }
- //
- // Check if they are on the same bus
- //
- if (Temp->Parent == PciIoDevice->Parent) {
-
- PciReadCommandRegister (Temp, &VGACommand);
-
- //
- // If they are on the same bus, either one can
- // be set to snoop, the other set to decode
- //
- if (VGACommand & EFI_PCI_COMMAND_VGA_PALETTE_SNOOP) {
- //
- // VGA has set to snoop, so GFX can be only set to disable snoop
- //
- if (Operation == EfiPciIoAttributeOperationEnable) {
- return EFI_UNSUPPORTED;
- }
- } else {
- //
- // VGA has disabled to snoop, so GFX can be only enabled
- //
- if (Operation == EfiPciIoAttributeOperationDisable) {
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_SUCCESS;
- }
-
- //
- // If they are on the same path but on the different bus
- // The first agent is set to snoop, the second one set to
- // decode
- //
-
- if (Temp->BusNumber < PciIoDevice->BusNumber) {
- //
- // GFX should be set to decode
- //
- if (Operation == EfiPciIoAttributeOperationDisable) {
- PciEnableCommandRegister (Temp, EFI_PCI_COMMAND_VGA_PALETTE_SNOOP);
- Temp->Attributes |= EFI_PCI_COMMAND_VGA_PALETTE_SNOOP;
- } else {
- return EFI_UNSUPPORTED;
- }
-
- } else {
- //
- // GFX should be set to snoop
- //
- if (Operation == EfiPciIoAttributeOperationEnable) {
- PciDisableCommandRegister (Temp, EFI_PCI_COMMAND_VGA_PALETTE_SNOOP);
- Temp->Attributes &= (~EFI_PCI_COMMAND_VGA_PALETTE_SNOOP);
- } else {
- return EFI_UNSUPPORTED;
- }
-
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoAttributes (
- IN EFI_PCI_IO_PROTOCOL * This,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
- IN UINT64 Attributes,
- OUT UINT64 *Result OPTIONAL
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Operation - add argument and description to function comment
-// TODO: Attributes - add argument and description to function comment
-// TODO: Result - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
-
- PCI_IO_DEVICE *PciIoDevice;
- PCI_IO_DEVICE *UpStreamBridge;
- PCI_IO_DEVICE *Temp;
-
- UINT64 Supports;
- UINT64 UpStreamAttributes;
- UINT16 BridgeControl;
- UINT16 Command;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- switch (Operation) {
- case EfiPciIoAttributeOperationGet:
- if (Result == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Result = PciIoDevice->Attributes;
- return EFI_SUCCESS;
-
- case EfiPciIoAttributeOperationSupported:
- if (Result == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Result = PciIoDevice->Supports;
- return EFI_SUCCESS;
-
- case EfiPciIoAttributeOperationSet:
- Status = PciIoDevice->PciIo.Attributes (
- &(PciIoDevice->PciIo),
- EfiPciIoAttributeOperationEnable,
- Attributes,
- NULL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = PciIoDevice->PciIo.Attributes (
- &(PciIoDevice->PciIo),
- EfiPciIoAttributeOperationDisable,
- (~Attributes) & (PciIoDevice->Supports),
- NULL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-
- case EfiPciIoAttributeOperationEnable:
- case EfiPciIoAttributeOperationDisable:
- break;
-
- default:
- return EFI_INVALID_PARAMETER;
- }
- //
- // Just a trick for ENABLE attribute
- //
- if ((Attributes & EFI_PCI_DEVICE_ENABLE) == EFI_PCI_DEVICE_ENABLE) {
- Attributes &= (PciIoDevice->Supports);
-
- //
- // Raise the EFI_P_PC_ENABLE Status code
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_PCI | EFI_P_PC_ENABLE,
- PciIoDevice->DevicePath
- );
- }
-
- //
- // If no attributes can be supported, then return.
- // Otherwise, set the attributes that it can support.
- //
- Supports = (PciIoDevice->Supports) & Attributes;
- if (Supports != Attributes) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // For Root Bridge, just call RootBridgeIo to set attributes;
- //
- if (!PciIoDevice->Parent) {
- Status = ModifyRootBridgeAttributes (PciIoDevice, Attributes, Operation);
- return Status;
- }
-
- Command = 0;
- BridgeControl = 0;
-
- //
- // Check VGA and VGA16, they can not be set at the same time
- //
- if (((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) &&
- (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) ||
- ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) &&
- (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) ||
- ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) &&
- (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) ||
- ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) &&
- (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) ) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // For PPB & P2C, set relevant attribute bits
- //
- if (IS_PCI_BRIDGE (&PciIoDevice->Pci) || IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) {
-
- if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) {
- BridgeControl |= EFI_PCI_BRIDGE_CONTROL_VGA;
- }
-
- if (Attributes & EFI_PCI_IO_ATTRIBUTE_ISA_IO) {
- BridgeControl |= EFI_PCI_BRIDGE_CONTROL_ISA;
- }
-
- if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) {
- Command |= EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO;
- }
-
- if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) {
- BridgeControl |= EFI_PCI_BRIDGE_CONTROL_VGA_16;
- }
-
- } else {
- //
- // Do with the attributes on VGA
- // Only for VGA's legacy resource, we just can enable once.
- //
- if (Attributes &
- (EFI_PCI_IO_ATTRIBUTE_VGA_IO |
- EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 |
- EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY)) {
- //
- // Check if a VGA has been enabled before enabling a new one
- //
- if (Operation == EfiPciIoAttributeOperationEnable) {
- //
- // Check if there have been an active VGA device on the same segment
- //
- Temp = ActiveVGADeviceOnTheSameSegment (PciIoDevice);
- if (Temp && Temp != PciIoDevice) {
- //
- // An active VGA has been detected, so can not enable another
- //
- return EFI_UNSUPPORTED;
- }
- }
- }
-
- //
- // Do with the attributes on GFX
- //
- if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) {
-
- if (Operation == EfiPciIoAttributeOperationEnable) {
- //
- // Check if snoop can be enabled in current configuration
- //
- Status = SupportPaletteSnoopAttributes (PciIoDevice, Operation);
-
- if (EFI_ERROR (Status)) {
-
- //
- // Enable operation is forbidden, so mask the bit in attributes
- // so as to keep consistent with the actual Status
- //
- // Attributes &= (~EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO);
- //
- //
- //
- return EFI_UNSUPPORTED;
-
- }
- }
-
- //
- // It can be supported, so get ready to set the bit
- //
- Command |= EFI_PCI_COMMAND_VGA_PALETTE_SNOOP;
- }
- }
-
- if (Attributes & EFI_PCI_IO_ATTRIBUTE_IO) {
- Command |= EFI_PCI_COMMAND_IO_SPACE;
- }
-
- if (Attributes & EFI_PCI_IO_ATTRIBUTE_MEMORY) {
- Command |= EFI_PCI_COMMAND_MEMORY_SPACE;
- }
-
- if (Attributes & EFI_PCI_IO_ATTRIBUTE_BUS_MASTER) {
- Command |= EFI_PCI_COMMAND_BUS_MASTER;
- }
- //
- // The upstream bridge should be also set to revelant attribute
- // expect for IO, Mem and BusMaster
- //
- UpStreamAttributes = Attributes &
- (~(EFI_PCI_IO_ATTRIBUTE_IO |
- EFI_PCI_IO_ATTRIBUTE_MEMORY |
- EFI_PCI_IO_ATTRIBUTE_BUS_MASTER
- )
- );
- UpStreamBridge = PciIoDevice->Parent;
-
- if (Operation == EfiPciIoAttributeOperationEnable) {
- //
- // Enable relevant attributes to command register and bridge control register
- //
- Status = PciEnableCommandRegister (PciIoDevice, Command);
- if (BridgeControl) {
- Status = PciEnableBridgeControlRegister (PciIoDevice, BridgeControl);
- }
-
- PciIoDevice->Attributes |= Attributes;
-
- //
- // Enable attributes of the upstream bridge
- //
- Status = UpStreamBridge->PciIo.Attributes (
- &(UpStreamBridge->PciIo),
- EfiPciIoAttributeOperationEnable,
- UpStreamAttributes,
- NULL
- );
- } else {
-
- //
- // Disable relevant attributes to command register and bridge control register
- //
- Status = PciDisableCommandRegister (PciIoDevice, Command);
- if (BridgeControl) {
- Status = PciDisableBridgeControlRegister (PciIoDevice, BridgeControl);
- }
-
- PciIoDevice->Attributes &= (~Attributes);
- Status = EFI_SUCCESS;
-
- }
-
- if (EFI_ERROR (Status)) {
- ReportErrorStatusCode (PciIoDevice, EFI_IO_BUS_PCI | EFI_IOB_EC_CONTROLLER_ERROR);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoGetBarAttributes (
- IN EFI_PCI_IO_PROTOCOL * This,
- IN UINT8 BarIndex,
- OUT UINT64 *Supports, OPTIONAL
- OUT VOID **Resources OPTIONAL
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-// TODO: Supports - add argument and description to function comment
-// TODO: Resources - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- UINT8 *Configuration;
- UINT8 NumConfig;
- PCI_IO_DEVICE *PciIoDevice;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
- EFI_ACPI_END_TAG_DESCRIPTOR *PtrEnd;
-
- NumConfig = 0;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- if (Supports == NULL && Resources == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BarIndex >= PCI_MAX_BAR) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // This driver does not support modifications to the WRITE_COMBINE or
- // CACHED attributes for BAR ranges.
- //
- if (Supports != NULL) {
- *Supports = PciIoDevice->Supports & EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED & EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE;
- }
-
- if (Resources != NULL) {
-
- if (PciIoDevice->PciBar[BarIndex].BarType != PciBarTypeUnknown) {
- NumConfig = 1;
- }
-
- Configuration = AllocatePool (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * NumConfig + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));
- if (Configuration == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- ZeroMem (
- Configuration,
- sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * NumConfig + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)
- );
-
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration;
-
- if (NumConfig == 1) {
- Ptr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
- Ptr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3;
-
- Ptr->AddrRangeMin = PciIoDevice->PciBar[BarIndex].BaseAddress;
- Ptr->AddrLen = PciIoDevice->PciBar[BarIndex].Length;
- Ptr->AddrRangeMax = PciIoDevice->PciBar[BarIndex].Alignment;
-
- switch (PciIoDevice->PciBar[BarIndex].BarType) {
- case PciBarTypeIo16:
- case PciBarTypeIo32:
- //
- // Io
- //
- Ptr->ResType = ACPI_ADDRESS_SPACE_TYPE_IO;
- break;
-
- case PciBarTypeMem32:
- //
- // Mem
- //
- Ptr->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- //
- // 32 bit
- //
- Ptr->AddrSpaceGranularity = 32;
- break;
-
- case PciBarTypePMem32:
- //
- // Mem
- //
- Ptr->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- //
- // prefechable
- //
- Ptr->SpecificFlag = 0x6;
- //
- // 32 bit
- //
- Ptr->AddrSpaceGranularity = 32;
- break;
-
- case PciBarTypeMem64:
- //
- // Mem
- //
- Ptr->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- //
- // 64 bit
- //
- Ptr->AddrSpaceGranularity = 64;
- break;
-
- case PciBarTypePMem64:
- //
- // Mem
- //
- Ptr->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
- //
- // prefechable
- //
- Ptr->SpecificFlag = 0x6;
- //
- // 64 bit
- //
- Ptr->AddrSpaceGranularity = 64;
- break;
-
- default:
- break;
- }
-
- Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) ((UINT8 *) Ptr + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR));
- }
-
- //
- // put the checksum
- //
- PtrEnd = (EFI_ACPI_END_TAG_DESCRIPTOR *) ((UINT8 *) Ptr);
- PtrEnd->Desc = ACPI_END_TAG_DESCRIPTOR;
- PtrEnd->Checksum = 0;
-
- *Resources = Configuration;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-PciIoSetBarAttributes (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN UINT64 Attributes,
- IN UINT8 BarIndex,
- IN OUT UINT64 *Offset,
- IN OUT UINT64 *Length
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Attributes - add argument and description to function comment
-// TODO: BarIndex - add argument and description to function comment
-// TODO: Offset - add argument and description to function comment
-// TODO: Length - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_IO_DEVICE *PciIoDevice;
- UINT64 NonRelativeOffset;
- UINT64 Supports;
-
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);
-
- //
- // Make sure Offset and Length are not NULL
- //
- if (Offset == NULL || Length == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (PciIoDevice->PciBar[BarIndex].BarType == PciBarTypeUnknown) {
- return EFI_UNSUPPORTED;
- }
- //
- // This driver does not support setting the WRITE_COMBINE or the CACHED attributes.
- // If Attributes is not 0, then return EFI_UNSUPPORTED.
- //
- Supports = PciIoDevice->Supports & EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED & EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE;
-
- if (Attributes != (Attributes & Supports)) {
- return EFI_UNSUPPORTED;
- }
- //
- // Attributes must be supported. Make sure the BAR range describd by BarIndex, Offset, and
- // Length are valid for this PCI device.
- //
- NonRelativeOffset = *Offset;
- Status = PciIoVerifyBarAccess (
- PciIoDevice,
- BarIndex,
- PciBarTypeMem,
- EfiPciIoWidthUint8,
- (UINT32) *Length,
- &NonRelativeOffset
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UpStreamBridgesAttributes (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: Operation - add argument and description to function comment
-// TODO: Attributes - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *Parent;
- EFI_PCI_IO_PROTOCOL *PciIo;
-
- Parent = PciIoDevice->Parent;
-
- while (Parent && IS_PCI_BRIDGE (&Parent->Pci)) {
-
- //
- // Get the PciIo Protocol
- //
- PciIo = &Parent->PciIo;
-
- PciIo->Attributes (PciIo, Operation, Attributes, NULL);
-
- Parent = Parent->Parent;
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-PciDevicesOnTheSamePath (
- IN PCI_IO_DEVICE *PciDevice1,
- IN PCI_IO_DEVICE *PciDevice2
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciDevice1 - add argument and description to function comment
-// TODO: PciDevice2 - add argument and description to function comment
-{
- BOOLEAN Existed1;
- BOOLEAN Existed2;
-
- if (PciDevice1->Parent == PciDevice2->Parent) {
- return TRUE;
- }
-
- Existed1 = PciDeviceExisted (PciDevice1->Parent, PciDevice2);
- Existed2 = PciDeviceExisted (PciDevice2->Parent, PciDevice1);
-
- return (BOOLEAN) (Existed1 || Existed2);
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.h
deleted file mode 100644
index 5733f59..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.h
+++ /dev/null
@@ -1,773 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciIo.h
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_IO_PROTOCOL_H
-#define _EFI_PCI_IO_PROTOCOL_H
-
-EFI_STATUS
-InitializePciIoInstance (
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciIoVerifyBarAccess (
- PCI_IO_DEVICE *PciIoDevice,
- UINT8 BarIndex,
- PCI_BAR_TYPE Type,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- UINT64 *Offset
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- BarIndex - TODO: add argument description
- Type - TODO: add argument description
- Width - TODO: add argument description
- Count - TODO: add argument description
- Offset - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciIoVerifyConfigAccess (
- PCI_IO_DEVICE *PciIoDevice,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINTN Count,
- IN UINT64 *Offset
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- Width - TODO: add argument description
- Count - TODO: add argument description
- Offset - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoPollMem (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Width - TODO: add argument description
- BarIndex - TODO: add argument description
- Offset - TODO: add argument description
- Mask - TODO: add argument description
- Value - TODO: add argument description
- Delay - TODO: add argument description
- Result - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoPollIo (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINT64 Mask,
- IN UINT64 Value,
- IN UINT64 Delay,
- OUT UINT64 *Result
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Width - TODO: add argument description
- BarIndex - TODO: add argument description
- Offset - TODO: add argument description
- Mask - TODO: add argument description
- Value - TODO: add argument description
- Delay - TODO: add argument description
- Result - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoMemRead (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Width - TODO: add argument description
- BarIndex - TODO: add argument description
- Offset - TODO: add argument description
- Count - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoMemWrite (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Width - TODO: add argument description
- BarIndex - TODO: add argument description
- Offset - TODO: add argument description
- Count - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoIoRead (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Width - TODO: add argument description
- BarIndex - TODO: add argument description
- Offset - TODO: add argument description
- Count - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoIoWrite (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 BarIndex,
- IN UINT64 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Width - TODO: add argument description
- BarIndex - TODO: add argument description
- Offset - TODO: add argument description
- Count - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoConfigRead (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Width - TODO: add argument description
- Offset - TODO: add argument description
- Count - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoConfigWrite (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Width - TODO: add argument description
- Offset - TODO: add argument description
- Count - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoCopyMem (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT8 DestBarIndex,
- IN UINT64 DestOffset,
- IN UINT8 SrcBarIndex,
- IN UINT64 SrcOffset,
- IN UINTN Count
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Width - TODO: add argument description
- DestBarIndex - TODO: add argument description
- DestOffset - TODO: add argument description
- SrcBarIndex - TODO: add argument description
- SrcOffset - TODO: add argument description
- Count - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoMap (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Operation - TODO: add argument description
- HostAddress - TODO: add argument description
- NumberOfBytes - TODO: add argument description
- DeviceAddress - TODO: add argument description
- Mapping - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoUnmap (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN VOID *Mapping
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Mapping - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoAllocateBuffer (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT VOID **HostAddress,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Type - TODO: add argument description
- MemoryType - TODO: add argument description
- Pages - TODO: add argument description
- HostAddress - TODO: add argument description
- Attributes - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoFreeBuffer (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN UINTN Pages,
- IN VOID *HostAddress
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Pages - TODO: add argument description
- HostAddress - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoFlush (
- IN EFI_PCI_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoGetLocation (
- IN EFI_PCI_IO_PROTOCOL *This,
- OUT UINTN *Segment,
- OUT UINTN *Bus,
- OUT UINTN *Device,
- OUT UINTN *Function
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Segment - TODO: add argument description
- Bus - TODO: add argument description
- Device - TODO: add argument description
- Function - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-CheckBarType (
- IN PCI_IO_DEVICE *PciIoDevice,
- UINT8 BarIndex,
- PCI_BAR_TYPE BarType
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- BarIndex - TODO: add argument description
- BarType - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ModifyRootBridgeAttributes (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN UINT64 Attributes,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- Attributes - TODO: add argument description
- Operation - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SupportPaletteSnoopAttributes (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- Operation - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoAttributes (
- IN EFI_PCI_IO_PROTOCOL * This,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
- IN UINT64 Attributes,
- OUT UINT64 *Result OPTIONAL
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Operation - TODO: add argument description
- Attributes - TODO: add argument description
- Result - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoGetBarAttributes (
- IN EFI_PCI_IO_PROTOCOL * This,
- IN UINT8 BarIndex,
- OUT UINT64 *Supports, OPTIONAL
- OUT VOID **Resources OPTIONAL
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- BarIndex - TODO: add argument description
- Supports - TODO: add argument description
- Resources - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PciIoSetBarAttributes (
- IN EFI_PCI_IO_PROTOCOL *This,
- IN UINT64 Attributes,
- IN UINT8 BarIndex,
- IN OUT UINT64 *Offset,
- IN OUT UINT64 *Length
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Attributes - TODO: add argument description
- BarIndex - TODO: add argument description
- Offset - TODO: add argument description
- Length - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-UpStreamBridgesAttributes (
- IN PCI_IO_DEVICE *PciIoDevice,
- IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
- Operation - TODO: add argument description
- Attributes - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-PciDevicesOnTheSamePath (
- IN PCI_IO_DEVICE *PciDevice1,
- IN PCI_IO_DEVICE *PciDevice2
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDevice1 - TODO: add argument description
- PciDevice2 - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.c
deleted file mode 100644
index eaeca2a..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.c
+++ /dev/null
@@ -1,2885 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciLib.c
-
-Abstract:
-
- PCI Bus Driver Lib file
- It abstracts some functions that can be different
- between light PCI bus driver and full PCI bus driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_PCI_HOTPLUG_REQUEST_PROTOCOL gPciHotPlugRequest = {
- PciHotPlugRequestNotify
-};
-
-
-VOID
-InstallHotPlugRequestProtocol (
- IN EFI_STATUS *Status
- )
-/*++
-
-Routine Description:
-
-Arguments:
- Status - A pointer to the status.
-
-Returns:
-
- None
-
---*/
-{
- EFI_HANDLE Handle;
-
- if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return;
- }
-
- Handle = NULL;
- *Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiPciHotPlugRequestProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &gPciHotPlugRequest
- );
-}
-
-VOID
-InstallPciHotplugGuid (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- PciIoDevice - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
-
- if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return;
- }
-
- if (IS_CARDBUS_BRIDGE (&PciIoDevice->Parent->Pci)) {
-
- Status = gBS->InstallProtocolInterface (
- &PciIoDevice->Handle,
- &gEfiPciHotplugDeviceGuid,
- EFI_NATIVE_INTERFACE,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
- }
-}
-
-VOID
-UninstallPciHotplugGuid (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- PciIoDevice - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
-
- if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return;
- }
-
- Status = gBS->OpenProtocol (
- PciIoDevice->Handle,
- &gEfiPciHotplugDeviceGuid,
- NULL,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
-
- if (Status == EFI_SUCCESS) {
- //
- // This may triger CardBus driver to stop for
- // Pccard devices opened the GUID via BY_DRIVER
- //
- Status = gBS->UninstallProtocolInterface (
- PciIoDevice->Handle,
- &gEfiPciHotplugDeviceGuid,
- NULL
- );
- }
-}
-
-VOID
-GetBackPcCardBar (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
- PciIoDevice - A pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-{
- UINT32 Address;
-
- if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return;
- }
-
- //
- // Read PciBar information from the bar register
- //
- if (!gFullEnumeration) {
-
- Address = 0;
- PciIoRead (
- &(PciIoDevice->PciIo),
- EfiPciIoWidthUint32,
- 0x1c,
- 1,
- &Address
- );
-
- (PciIoDevice->PciBar)[P2C_MEM_1].BaseAddress = (UINT64) (Address);
- (PciIoDevice->PciBar)[P2C_MEM_1].Length = 0x2000000;
- (PciIoDevice->PciBar)[P2C_MEM_1].BarType = PciBarTypeMem32;
-
- Address = 0;
- PciIoRead (
- &(PciIoDevice->PciIo),
- EfiPciIoWidthUint32,
- 0x20,
- 1,
- &Address
- );
- (PciIoDevice->PciBar)[P2C_MEM_2].BaseAddress = (UINT64) (Address);
- (PciIoDevice->PciBar)[P2C_MEM_2].Length = 0x2000000;
- (PciIoDevice->PciBar)[P2C_MEM_2].BarType = PciBarTypePMem32;
-
- Address = 0;
- PciIoRead (
- &(PciIoDevice->PciIo),
- EfiPciIoWidthUint32,
- 0x2c,
- 1,
- &Address
- );
- (PciIoDevice->PciBar)[P2C_IO_1].BaseAddress = (UINT64) (Address);
- (PciIoDevice->PciBar)[P2C_IO_1].Length = 0x100;
- (PciIoDevice->PciBar)[P2C_IO_1].BarType = PciBarTypeIo16;
-
- Address = 0;
- PciIoRead (
- &(PciIoDevice->PciIo),
- EfiPciIoWidthUint32,
- 0x34,
- 1,
- &Address
- );
- (PciIoDevice->PciBar)[P2C_IO_2].BaseAddress = (UINT64) (Address);
- (PciIoDevice->PciBar)[P2C_IO_2].Length = 0x100;
- (PciIoDevice->PciBar)[P2C_IO_2].BarType = PciBarTypeIo16;
-
- }
-
- if (gPciHotPlugInit != NULL) {
- GetResourcePaddingForHpb (PciIoDevice);
- }
-}
-
-EFI_STATUS
-RemoveRejectedPciDevices (
- EFI_HANDLE RootBridgeHandle,
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
- RootBridgeHandle - An efi handle.
- Bridge - An pointer to the PCI_IO_DEVICE.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *Temp;
- LIST_ENTRY *CurrentLink;
- LIST_ENTRY *LastLink;
-
- if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return EFI_SUCCESS;
- }
-
- CurrentLink = Bridge->ChildList.ForwardLink;
-
- while (CurrentLink && CurrentLink != &Bridge->ChildList) {
-
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- if (IS_PCI_BRIDGE (&Temp->Pci)) {
- //
- // Remove rejected devices recusively
- //
- RemoveRejectedPciDevices (RootBridgeHandle, Temp);
- } else {
- //
- // Skip rejection for all PPBs, while detect rejection for others
- //
- if (IsPciDeviceRejected (Temp)) {
-
- //
- // For P2C, remove all devices on it
- //
-
- if (!IsListEmpty (&Temp->ChildList)) {
- RemoveAllPciDeviceOnBridge (RootBridgeHandle, Temp);
- }
-
- //
- // Finally remove itself
- //
-
- LastLink = CurrentLink->BackLink;
- RemoveEntryList (CurrentLink);
- FreePciDevice (Temp);
-
- CurrentLink = LastLink;
- }
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciHostBridgeResourceAllocator (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-{
- if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
- PciResAlloc
- );
- } else {
- return PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
- PciResAlloc
- );
- }
-}
-
-
-EFI_STATUS
-PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciResAlloc - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *RootBridgeDev;
- EFI_HANDLE RootBridgeHandle;
- VOID *AcpiConfig;
- EFI_STATUS Status;
- UINT64 IoBase;
- UINT64 Mem32Base;
- UINT64 PMem32Base;
- UINT64 Mem64Base;
- UINT64 PMem64Base;
- UINT64 MaxOptionRomSize;
- PCI_RESOURCE_NODE *IoBridge;
- PCI_RESOURCE_NODE *Mem32Bridge;
- PCI_RESOURCE_NODE *PMem32Bridge;
- PCI_RESOURCE_NODE *Mem64Bridge;
- PCI_RESOURCE_NODE *PMem64Bridge;
- PCI_RESOURCE_NODE IoPool;
- PCI_RESOURCE_NODE Mem32Pool;
- PCI_RESOURCE_NODE PMem32Pool;
- PCI_RESOURCE_NODE Mem64Pool;
- PCI_RESOURCE_NODE PMem64Pool;
- REPORT_STATUS_CODE_LIBRARY_DEVICE_HANDLE_EXTENDED_DATA ExtendedData;
-
- //
- // Initialize resource pool
- //
-
- InitializeResourcePool (&IoPool, PciBarTypeIo16);
- InitializeResourcePool (&Mem32Pool, PciBarTypeMem32);
- InitializeResourcePool (&PMem32Pool, PciBarTypePMem32);
- InitializeResourcePool (&Mem64Pool, PciBarTypeMem64);
- InitializeResourcePool (&PMem64Pool, PciBarTypePMem64);
-
- RootBridgeDev = NULL;
- RootBridgeHandle = 0;
-
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
- //
- // Get RootBridg Device by handle
- //
- RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Get host bridge handle for status report
- //
- ExtendedData.Handle = RootBridgeDev->PciRootBridgeIo->ParentHandle;
-
- //
- // Create the entire system resource map from the information collected by
- // enumerator. Several resource tree was created
- //
-
- IoBridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFF,
- 0,
- PciBarTypeIo16,
- PciResUsageTypical
- );
-
- Mem32Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypeMem32,
- PciResUsageTypical
- );
-
- PMem32Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypePMem32,
- PciResUsageTypical
- );
-
- Mem64Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypeMem64,
- PciResUsageTypical
- );
-
- PMem64Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypePMem64,
- PciResUsageTypical
- );
-
- //
- // Create resourcemap by going through all the devices subject to this root bridge
- //
- Status = CreateResourceMap (
- RootBridgeDev,
- IoBridge,
- Mem32Bridge,
- PMem32Bridge,
- Mem64Bridge,
- PMem64Bridge
- );
-
- //
- // Get the max ROM size that the root bridge can process
- //
- RootBridgeDev->RomSize = Mem32Bridge->Length;
-
- //
- // Get Max Option Rom size for current root bridge
- //
- MaxOptionRomSize = GetMaxOptionRomSize (RootBridgeDev);
-
- //
- // Enlarger the mem32 resource to accomdate the option rom
- // if the mem32 resource is not enough to hold the rom
- //
- if (MaxOptionRomSize > Mem32Bridge->Length) {
-
- Mem32Bridge->Length = MaxOptionRomSize;
- RootBridgeDev->RomSize = MaxOptionRomSize;
-
- //
- // Alignment should be adjusted as well
- //
- if (Mem32Bridge->Alignment < MaxOptionRomSize - 1) {
- Mem32Bridge->Alignment = MaxOptionRomSize - 1;
- }
- }
-
- //
- // Based on the all the resource tree, contruct ACPI resource node to
- // submit the resource aperture to pci host bridge protocol
- //
- Status = ConstructAcpiResourceRequestor (
- RootBridgeDev,
- IoBridge,
- Mem32Bridge,
- PMem32Bridge,
- Mem64Bridge,
- PMem64Bridge,
- &AcpiConfig
- );
-
- //
- // Insert these resource nodes into the database
- //
- InsertResourceNode (&IoPool, IoBridge);
- InsertResourceNode (&Mem32Pool, Mem32Bridge);
- InsertResourceNode (&PMem32Pool, PMem32Bridge);
- InsertResourceNode (&Mem64Pool, Mem64Bridge);
- InsertResourceNode (&PMem64Pool, PMem64Bridge);
-
- if (Status == EFI_SUCCESS) {
- //
- // Submit the resource requirement
- //
- Status = PciResAlloc->SubmitResources (
- PciResAlloc,
- RootBridgeDev->Handle,
- AcpiConfig
- );
- }
- //
- // Free acpi resource node
- //
- if (AcpiConfig != NULL) {
- FreePool (AcpiConfig);
- }
-
- if (EFI_ERROR (Status)) {
- //
- // Destroy all the resource tree
- //
- DestroyResourceTree (&IoPool);
- DestroyResourceTree (&Mem32Pool);
- DestroyResourceTree (&PMem32Pool);
- DestroyResourceTree (&Mem64Pool);
- DestroyResourceTree (&PMem64Pool);
- return Status;
- }
- }
- //
- // End while
- //
-
- //
- // Notify pci bus driver starts to program the resource
- //
- Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeAllocateResources);
-
- if (EFI_ERROR (Status)) {
- //
- // Allocation failed, then return
- //
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Raise the EFI_IOB_PCI_RES_ALLOC status code
- //
- REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_PCI | EFI_IOB_PCI_PC_RES_ALLOC,
- (VOID *) &ExtendedData,
- sizeof (ExtendedData)
- );
-
- //
- // Notify pci bus driver starts to program the resource
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeSetResources);
-
- RootBridgeDev = NULL;
-
- RootBridgeHandle = 0;
-
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
- //
- // Get RootBridg Device by handle
- //
- RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Get acpi resource node for all the resource types
- //
- AcpiConfig = NULL;
- Status = PciResAlloc->GetProposedResources (
- PciResAlloc,
- RootBridgeDev->Handle,
- &AcpiConfig
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the resource base by interpreting acpi resource node
- //
- //
- GetResourceBase (
- AcpiConfig,
- &IoBase,
- &Mem32Base,
- &PMem32Base,
- &Mem64Base,
- &PMem64Base
- );
-
- //
- // Process option rom for this root bridge
- //
- Status = ProcessOptionRom (RootBridgeDev, Mem32Base, RootBridgeDev->RomSize);
-
- //
- // Create the entire system resource map from the information collected by
- // enumerator. Several resource tree was created
- //
- Status = GetResourceMap (
- RootBridgeDev,
- &IoBridge,
- &Mem32Bridge,
- &PMem32Bridge,
- &Mem64Bridge,
- &PMem64Bridge,
- &IoPool,
- &Mem32Pool,
- &PMem32Pool,
- &Mem64Pool,
- &PMem64Pool
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Program IO resources
- //
- ProgramResource (
- IoBase,
- IoBridge
- );
-
- //
- // Program Mem32 resources
- //
- ProgramResource (
- Mem32Base,
- Mem32Bridge
- );
-
- //
- // Program PMem32 resources
- //
- ProgramResource (
- PMem32Base,
- PMem32Bridge
- );
-
- //
- // Program Mem64 resources
- //
- ProgramResource (
- Mem64Base,
- Mem64Bridge
- );
-
- //
- // Program PMem64 resources
- //
- ProgramResource (
- PMem64Base,
- PMem64Bridge
- );
-
- if (AcpiConfig != NULL) {
- FreePool (AcpiConfig);
- }
- }
-
- //
- // Destroy all the resource tree
- //
- DestroyResourceTree (&IoPool);
- DestroyResourceTree (&Mem32Pool);
- DestroyResourceTree (&PMem32Pool);
- DestroyResourceTree (&Mem64Pool);
- DestroyResourceTree (&PMem64Pool);
-
- //
- // Notify the resource allocation phase is to end
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeEndResourceAllocation);
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-/*++
-
-Routine Description:
-
- Host brige resource allocator.
-
-Arguments:
-
- PciResAlloc - A pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.
-
-Returns:
-
- EFI Status.
-
---*/
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *RootBridgeDev;
- EFI_HANDLE RootBridgeHandle;
- VOID *AcpiConfig;
- EFI_STATUS Status;
- UINT64 IoBase;
- UINT64 Mem32Base;
- UINT64 PMem32Base;
- UINT64 Mem64Base;
- UINT64 PMem64Base;
- UINT64 IoResStatus;
- UINT64 Mem32ResStatus;
- UINT64 PMem32ResStatus;
- UINT64 Mem64ResStatus;
- UINT64 PMem64ResStatus;
- UINT64 MaxOptionRomSize;
- PCI_RESOURCE_NODE *IoBridge;
- PCI_RESOURCE_NODE *Mem32Bridge;
- PCI_RESOURCE_NODE *PMem32Bridge;
- PCI_RESOURCE_NODE *Mem64Bridge;
- PCI_RESOURCE_NODE *PMem64Bridge;
- PCI_RESOURCE_NODE IoPool;
- PCI_RESOURCE_NODE Mem32Pool;
- PCI_RESOURCE_NODE PMem32Pool;
- PCI_RESOURCE_NODE Mem64Pool;
- PCI_RESOURCE_NODE PMem64Pool;
- BOOLEAN ReAllocate;
- REPORT_STATUS_CODE_LIBRARY_DEVICE_HANDLE_EXTENDED_DATA HandleExtendedData;
- REPORT_STATUS_CODE_LIBRARY_RESOURCE_ALLOC_FAILURE_ERROR_DATA AllocFailExtendedData;
-
- //
- // Reallocate flag
- //
- ReAllocate = FALSE;
-
- //
- // It will try several times if the resource allocation fails
- //
- while (TRUE) {
-
- //
- // Initialize resource pool
- //
- InitializeResourcePool (&IoPool, PciBarTypeIo16);
- InitializeResourcePool (&Mem32Pool, PciBarTypeMem32);
- InitializeResourcePool (&PMem32Pool, PciBarTypePMem32);
- InitializeResourcePool (&Mem64Pool, PciBarTypeMem64);
- InitializeResourcePool (&PMem64Pool, PciBarTypePMem64);
-
- RootBridgeDev = NULL;
- RootBridgeHandle = 0;
-
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
-
- //
- // Get RootBridg Device by handle
- //
- RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Create the entire system resource map from the information collected by
- // enumerator. Several resource tree was created
- //
-
- IoBridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFF,
- 0,
- PciBarTypeIo16,
- PciResUsageTypical
- );
-
- Mem32Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypeMem32,
- PciResUsageTypical
- );
-
- PMem32Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypePMem32,
- PciResUsageTypical
- );
-
- Mem64Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypeMem64,
- PciResUsageTypical
- );
-
- PMem64Bridge = CreateResourceNode (
- RootBridgeDev,
- 0,
- 0xFFFFF,
- 0,
- PciBarTypePMem64,
- PciResUsageTypical
- );
-
- //
- // Create resourcemap by going through all the devices subject to this root bridge
- //
- Status = CreateResourceMap (
- RootBridgeDev,
- IoBridge,
- Mem32Bridge,
- PMem32Bridge,
- Mem64Bridge,
- PMem64Bridge
- );
-
- //
- // Get the max ROM size that the root bridge can process
- //
- RootBridgeDev->RomSize = Mem32Bridge->Length;
-
- //
- // Skip to enlarge the resource request during realloction
- //
- if (!ReAllocate) {
- //
- // Get Max Option Rom size for current root bridge
- //
- MaxOptionRomSize = GetMaxOptionRomSize (RootBridgeDev);
-
- //
- // Enlarger the mem32 resource to accomdate the option rom
- // if the mem32 resource is not enough to hold the rom
- //
- if (MaxOptionRomSize > Mem32Bridge->Length) {
-
- Mem32Bridge->Length = MaxOptionRomSize;
- RootBridgeDev->RomSize = MaxOptionRomSize;
-
- //
- // Alignment should be adjusted as well
- //
- if (Mem32Bridge->Alignment < MaxOptionRomSize - 1) {
- Mem32Bridge->Alignment = MaxOptionRomSize - 1;
- }
- }
- }
-
- //
- // Based on the all the resource tree, contruct ACPI resource node to
- // submit the resource aperture to pci host bridge protocol
- //
- Status = ConstructAcpiResourceRequestor (
- RootBridgeDev,
- IoBridge,
- Mem32Bridge,
- PMem32Bridge,
- Mem64Bridge,
- PMem64Bridge,
- &AcpiConfig
- );
-
- //
- // Insert these resource nodes into the database
- //
- InsertResourceNode (&IoPool, IoBridge);
- InsertResourceNode (&Mem32Pool, Mem32Bridge);
- InsertResourceNode (&PMem32Pool, PMem32Bridge);
- InsertResourceNode (&Mem64Pool, Mem64Bridge);
- InsertResourceNode (&PMem64Pool, PMem64Bridge);
-
- if (Status == EFI_SUCCESS) {
- //
- // Submit the resource requirement
- //
- Status = PciResAlloc->SubmitResources (
- PciResAlloc,
- RootBridgeDev->Handle,
- AcpiConfig
- );
- }
-
- //
- // Free acpi resource node
- //
- if (AcpiConfig != NULL) {
- FreePool (AcpiConfig);
- }
-
- if (EFI_ERROR (Status)) {
- //
- // Destroy all the resource tree
- //
- DestroyResourceTree (&IoPool);
- DestroyResourceTree (&Mem32Pool);
- DestroyResourceTree (&PMem32Pool);
- DestroyResourceTree (&Mem64Pool);
- DestroyResourceTree (&PMem64Pool);
- return Status;
- }
- }
-
- //
- // Notify pci bus driver starts to program the resource
- //
-
- Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeAllocateResources);
-
- if (!EFI_ERROR (Status)) {
- //
- // Allocation succeed, then continue the following
- //
- break;
- }
-
- //
- // If the resource allocation is unsuccessful, free resources on bridge
- //
-
- RootBridgeDev = NULL;
- RootBridgeHandle = 0;
-
- IoResStatus = EFI_RESOURCE_SATISFIED;
- Mem32ResStatus = EFI_RESOURCE_SATISFIED;
- PMem32ResStatus = EFI_RESOURCE_SATISFIED;
- Mem64ResStatus = EFI_RESOURCE_SATISFIED;
- PMem64ResStatus = EFI_RESOURCE_SATISFIED;
-
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
- //
- // Get RootBridg Device by handle
- //
- RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
- if (RootBridgeDev == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Get host bridge handle for status report
- //
- HandleExtendedData.Handle = RootBridgeDev->PciRootBridgeIo->ParentHandle;
-
- //
- // Get acpi resource node for all the resource types
- //
- AcpiConfig = NULL;
-
- Status = PciResAlloc->GetProposedResources (
- PciResAlloc,
- RootBridgeDev->Handle,
- &AcpiConfig
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (AcpiConfig != NULL) {
- //
- // Adjust resource allocation policy for each RB
- //
- GetResourceAllocationStatus (
- AcpiConfig,
- &IoResStatus,
- &Mem32ResStatus,
- &PMem32ResStatus,
- &Mem64ResStatus,
- &PMem64ResStatus
- );
- FreePool (AcpiConfig);
- }
- }
- //
- // End while
- //
-
- //
- // Raise the EFI_IOB_EC_RESOURCE_CONFLICT status code
- //
- //
- // It is very difficult to follow the spec here
- // Device path , Bar index can not be get here
- //
- ZeroMem (&AllocFailExtendedData, sizeof (AllocFailExtendedData));
-
- REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_PCI | EFI_IOB_EC_RESOURCE_CONFLICT,
- (VOID *) &AllocFailExtendedData,
- sizeof (AllocFailExtendedData)
- );
-
- Status = PciHostBridgeAdjustAllocation (
- &IoPool,
- &Mem32Pool,
- &PMem32Pool,
- &Mem64Pool,
- &PMem64Pool,
- IoResStatus,
- Mem32ResStatus,
- PMem32ResStatus,
- Mem64ResStatus,
- PMem64ResStatus
- );
-
- //
- // Destroy all the resource tree
- //
- DestroyResourceTree (&IoPool);
- DestroyResourceTree (&Mem32Pool);
- DestroyResourceTree (&PMem32Pool);
- DestroyResourceTree (&Mem64Pool);
- DestroyResourceTree (&PMem64Pool);
-
- NotifyPhase (PciResAlloc, EfiPciHostBridgeFreeResources);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ReAllocate = TRUE;
-
- }
- //
- // End main while
- //
-
- //
- // Raise the EFI_IOB_PCI_RES_ALLOC status code
- //
- REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_PCI | EFI_IOB_PCI_PC_RES_ALLOC,
- (VOID *) &HandleExtendedData,
- sizeof (HandleExtendedData)
- );
-
- //
- // Notify pci bus driver starts to program the resource
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeSetResources);
-
- RootBridgeDev = NULL;
-
- RootBridgeHandle = 0;
-
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
-
- //
- // Get RootBridg Device by handle
- //
- RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Get acpi resource node for all the resource types
- //
- AcpiConfig = NULL;
- Status = PciResAlloc->GetProposedResources (
- PciResAlloc,
- RootBridgeDev->Handle,
- &AcpiConfig
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the resource base by interpreting acpi resource node
- //
- //
- GetResourceBase (
- AcpiConfig,
- &IoBase,
- &Mem32Base,
- &PMem32Base,
- &Mem64Base,
- &PMem64Base
- );
-
- //
- // Process option rom for this root bridge
- //
- Status = ProcessOptionRom (RootBridgeDev, Mem32Base, RootBridgeDev->RomSize);
-
- //
- // Create the entire system resource map from the information collected by
- // enumerator. Several resource tree was created
- //
- Status = GetResourceMap (
- RootBridgeDev,
- &IoBridge,
- &Mem32Bridge,
- &PMem32Bridge,
- &Mem64Bridge,
- &PMem64Bridge,
- &IoPool,
- &Mem32Pool,
- &PMem32Pool,
- &Mem64Pool,
- &PMem64Pool
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Program IO resources
- //
- ProgramResource (
- IoBase,
- IoBridge
- );
-
- //
- // Program Mem32 resources
- //
- ProgramResource (
- Mem32Base,
- Mem32Bridge
- );
-
- //
- // Program PMem32 resources
- //
- ProgramResource (
- PMem32Base,
- PMem32Bridge
- );
-
- //
- // Program Mem64 resources
- //
- ProgramResource (
- Mem64Base,
- Mem64Bridge
- );
-
- //
- // Program PMem64 resources
- //
- ProgramResource (
- PMem64Base,
- PMem64Bridge
- );
-
- if (AcpiConfig != NULL) {
- gBS->FreePool (AcpiConfig);
- }
- }
-
- //
- // Destroy all the resource tree
- //
- DestroyResourceTree (&IoPool);
- DestroyResourceTree (&Mem32Pool);
- DestroyResourceTree (&PMem32Pool);
- DestroyResourceTree (&Mem64Pool);
- DestroyResourceTree (&PMem64Pool);
-
- //
- // Notify the resource allocation phase is to end
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeEndResourceAllocation);
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-PciScanBus (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber,
- OUT UINT8 *PaddedBusRange
- )
-{
- if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return PciScanBus_WithHotPlugDeviceSupport (
- Bridge,
- StartBusNumber,
- SubBusNumber,
- PaddedBusRange
- );
- } else {
- return PciScanBus_WithoutHotPlugDeviceSupport (
- Bridge,
- StartBusNumber,
- SubBusNumber,
- PaddedBusRange
- );
- }
-}
-
-
-EFI_STATUS
-PciScanBus_WithoutHotPlugDeviceSupport (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber,
- OUT UINT8 *PaddedBusRange
- )
-/*++
-
-Routine Description:
-
- This routine is used to assign bus number to the given PCI bus system
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: StartBusNumber - add argument and description to function comment
-// TODO: SubBusNumber - add argument and description to function comment
-// TODO: PaddedBusRange - add argument and description to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_TYPE00 Pci;
- UINT8 Device;
- UINT8 Func;
- UINT64 Address;
- UINTN SecondBus;
- UINT16 Register;
- PCI_IO_DEVICE *PciDevice;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- PciRootBridgeIo = Bridge->PciRootBridgeIo;
- SecondBus = 0;
- Register = 0;
-
- ResetAllPpbBusReg (Bridge, StartBusNumber);
-
- for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
- for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
-
- //
- // Check to see whether a pci device is present
- //
- Status = PciDevicePresent (
- PciRootBridgeIo,
- &Pci,
- StartBusNumber,
- Device,
- Func
- );
-
- if (!EFI_ERROR (Status) &&
- (IS_PCI_BRIDGE (&Pci) ||
- IS_CARDBUS_BRIDGE (&Pci))) {
-
- //
- // Get the bridge information
- //
- Status = PciSearchDevice (
- Bridge,
- &Pci,
- StartBusNumber,
- Device,
- Func,
- &PciDevice
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- (*SubBusNumber)++;
-
- SecondBus = (*SubBusNumber);
-
- Register = (UINT16) ((SecondBus << 8) | (UINT16) StartBusNumber);
-
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);
-
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint16,
- Address,
- 1,
- &Register
- );
-
- //
- // Initialize SubBusNumber to SecondBus
- //
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- SubBusNumber
- );
- //
- // If it is PPB, resursively search down this bridge
- //
- if (IS_PCI_BRIDGE (&Pci)) {
- //
- // Temporarily initialize SubBusNumber to maximum bus number to ensure the
- // PCI configuration transaction to go through any PPB
- //
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
- Register = 0xFF;
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- &Register
- );
-
- PreprocessController (
- PciDevice,
- PciDevice->BusNumber,
- PciDevice->DeviceNumber,
- PciDevice->FunctionNumber,
- EfiPciBeforeChildBusEnumeration
- );
-
- Status = PciScanBus (
- PciDevice,
- (UINT8) (SecondBus),
- SubBusNumber,
- PaddedBusRange
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- }
-
- //
- // Set the current maximum bus number under the PPB
- //
-
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
-
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- SubBusNumber
- );
-
- }
-
- if (Func == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {
-
- //
- // Skip sub functions, this is not a multi function device
- //
-
- Func = PCI_MAX_FUNC;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciScanBus_WithHotPlugDeviceSupport (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber,
- OUT UINT8 *PaddedBusRange
- )
-/*++
-
-Routine Description:
-
- This routine is used to assign bus number to the given PCI bus system
-
-Arguments:
-
- Bridge - A pointer to the PCI_IO_DEVICE structure.
- StartBusNumber - The start bus number.
- SubBusNumber - A pointer to the sub bus number.
- PaddedBusRange - A pointer to the padded bus range.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- PCI_TYPE00 Pci;
- UINT8 Device;
- UINT8 Func;
- UINT64 Address;
- UINTN SecondBus;
- UINT16 Register;
- UINTN HpIndex;
- PCI_IO_DEVICE *PciDevice;
- EFI_EVENT Event;
- EFI_HPC_STATE State;
- UINT64 PciAddress;
- EFI_HPC_PADDING_ATTRIBUTES Attributes;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
- UINT16 BusRange;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- BOOLEAN BusPadding;
-
- PciRootBridgeIo = Bridge->PciRootBridgeIo;
- SecondBus = 0;
- Register = 0;
- State = 0;
- Attributes = (EFI_HPC_PADDING_ATTRIBUTES) 0;
- BusRange = 0;
-
- ResetAllPpbBusReg (Bridge, StartBusNumber);
-
- for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
- for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
-
- //
- // Check to see whether a pci device is present
- //
- Status = PciDevicePresent (
- PciRootBridgeIo,
- &Pci,
- StartBusNumber,
- Device,
- Func
- );
-
- if (EFI_ERROR (Status)) {
- if (Func == 0) {
- //
- // Skip sub functions, this is not a multi function device
- //
- Func = PCI_MAX_FUNC;
- }
-
- continue;
- }
-
- //
- // Get the PCI device information
- //
- Status = PciSearchDevice (
- Bridge,
- &Pci,
- StartBusNumber,
- Device,
- Func,
- &PciDevice
- );
-
- ASSERT (!EFI_ERROR (Status));
-
- PciAddress = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0);
-
- if (!IS_PCI_BRIDGE (&Pci)) {
- //
- // PCI bridges will be called later
- // Here just need for PCI device or PCI to cardbus controller
- // EfiPciBeforeChildBusEnumeration for PCI Device Node
- //
- PreprocessController (
- PciDevice,
- PciDevice->BusNumber,
- PciDevice->DeviceNumber,
- PciDevice->FunctionNumber,
- EfiPciBeforeChildBusEnumeration
- );
- }
-
- //
- // For Pci Hotplug controller devcie only
- //
- if (gPciHotPlugInit != NULL) {
- //
- // Check if it is a Hotplug PCI controller
- //
- if (IsRootPciHotPlugController (PciDevice->DevicePath, &HpIndex)) {
-
- if (!gPciRootHpcData[HpIndex].Initialized) {
-
- Status = CreateEventForHpc (HpIndex, &Event);
-
- ASSERT (!EFI_ERROR (Status));
-
- Status = gPciHotPlugInit->InitializeRootHpc (
- gPciHotPlugInit,
- gPciRootHpcPool[HpIndex].HpcDevicePath,
- PciAddress,
- Event,
- &State
- );
-
- PreprocessController (
- PciDevice,
- PciDevice->BusNumber,
- PciDevice->DeviceNumber,
- PciDevice->FunctionNumber,
- EfiPciBeforeChildBusEnumeration
- );
- continue;
- }
- }
- }
-
- if (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci)) {
- //
- // For PPB
- // Get the bridge information
- //
- BusPadding = FALSE;
- if (gPciHotPlugInit != NULL) {
-
- if (IsRootPciHotPlugBus (PciDevice->DevicePath, &HpIndex)) {
-
- //
- // If it is initialized, get the padded bus range
- //
- Status = gPciHotPlugInit->GetResourcePadding (
- gPciHotPlugInit,
- gPciRootHpcPool[HpIndex].HpbDevicePath,
- PciAddress,
- &State,
- (VOID **) &Descriptors,
- &Attributes
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BusRange = 0;
- Status = PciGetBusRange (
- &Descriptors,
- NULL,
- NULL,
- &BusRange
- );
-
- gBS->FreePool (Descriptors);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BusPadding = TRUE;
- }
- }
-
- (*SubBusNumber)++;
- SecondBus = *SubBusNumber;
-
- Register = (UINT16) ((SecondBus << 8) | (UINT16) StartBusNumber);
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x18);
-
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint16,
- Address,
- 1,
- &Register
- );
-
-
- //
- // If it is PPB, resursively search down this bridge
- //
- if (IS_PCI_BRIDGE (&Pci)) {
-
- //
- // Initialize SubBusNumber to Maximum bus number
- //
- Register = 0xFF;
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- &Register
- );
-
- //
- // Nofify EfiPciBeforeChildBusEnumeration for PCI Brige
- //
- PreprocessController (
- PciDevice,
- PciDevice->BusNumber,
- PciDevice->DeviceNumber,
- PciDevice->FunctionNumber,
- EfiPciBeforeChildBusEnumeration
- );
-
- Status = PciScanBus (
- PciDevice,
- (UINT8) (SecondBus),
- SubBusNumber,
- PaddedBusRange
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- }
-
- if (BusPadding) {
- //
- // Ensure the device is enabled and initialized
- //
- if ((Attributes == EfiPaddingPciRootBridge) &&
- (State & EFI_HPC_STATE_ENABLED) &&
- (State & EFI_HPC_STATE_INITIALIZED) ) {
- *PaddedBusRange = (UINT8) ((UINT8) (BusRange) +*PaddedBusRange);
- } else {
- *SubBusNumber = (UINT8) ((UINT8) (BusRange) +*SubBusNumber);
- }
- }
-
- //
- // Set the current maximum bus number under the PPB
- //
- Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0x1A);
-
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &Pci,
- EfiPciWidthUint8,
- Address,
- 1,
- SubBusNumber
- );
- }
-
- if (Func == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {
-
- //
- // Skip sub functions, this is not a multi function device
- //
- Func = PCI_MAX_FUNC;
- }
-
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciRootBridgeP2CProcess (
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- Process Option Rom on this host bridge
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- LIST_ENTRY *CurrentLink;
- PCI_IO_DEVICE *Temp;
- EFI_HPC_STATE State;
- UINT64 PciAddress;
- EFI_STATUS Status;
-
- CurrentLink = Bridge->ChildList.ForwardLink;
-
- while (CurrentLink && CurrentLink != &Bridge->ChildList) {
-
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- if (IS_CARDBUS_BRIDGE (&Temp->Pci)) {
-
- if (gPciHotPlugInit && Temp->Allocated) {
-
- //
- // Raise the EFI_IOB_PCI_HPC_INIT status code
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_PCI | EFI_IOB_PCI_PC_HPC_INIT,
- Temp->DevicePath
- );
-
- PciAddress = EFI_PCI_ADDRESS (Temp->BusNumber, Temp->DeviceNumber, Temp->FunctionNumber, 0);
- Status = gPciHotPlugInit->InitializeRootHpc (
- gPciHotPlugInit,
- Temp->DevicePath,
- PciAddress,
- NULL,
- &State
- );
-
- if (!EFI_ERROR (Status)) {
- Status = PciBridgeEnumerator (Temp);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- continue;
-
- }
- }
-
- if (!IsListEmpty (&Temp->ChildList)) {
- Status = PciRootBridgeP2CProcess (Temp);
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciHostBridgeP2CProcess (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciResAlloc - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_HANDLE RootBridgeHandle;
- PCI_IO_DEVICE *RootBridgeDev;
- EFI_STATUS Status;
-
- if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
- return EFI_SUCCESS;
- }
-
- RootBridgeHandle = NULL;
-
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
-
- //
- // Get RootBridg Device by handle
- //
- RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_NOT_FOUND;
- }
-
- Status = PciRootBridgeP2CProcess (RootBridgeDev);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciHostBridgeEnumerator (
- EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-/*++
-
-Routine Description:
-
- This function is used to enumerate the entire host bridge
- in a given platform
-
-Arguments:
-
- PciResAlloc - A pointer to the resource allocate protocol.
-
-Returns:
-
- None
-
---*/
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_HANDLE RootBridgeHandle;
- PCI_IO_DEVICE *RootBridgeDev;
- EFI_STATUS Status;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- UINT16 MinBus;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;
-
- InitializeHotPlugSupport ();
-
- //
- // Notify the bus allocation phase is about to start
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
-
- RootBridgeHandle = NULL;
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
-
- //
- // if a root bridge instance is found, create root bridge device for it
- //
-
- RootBridgeDev = CreateRootBridge (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Enumerate all the buses under this root bridge
- //
-
- Status = PciRootBridgeEnumerator (
- PciResAlloc,
- RootBridgeDev
- );
-
- DestroyRootBridge (RootBridgeDev);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- //
- // Notify the bus allocation phase is finished for the first time
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeEndBusAllocation);
-
- if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
-
- if (gPciHotPlugInit != NULL) {
- //
- // Wait for all HPC initialized
- //
- Status = AllRootHPCInitialized (STALL_1_SECOND * 15);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Notify the bus allocation phase is about to start for the 2nd time
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
-
- RootBridgeHandle = NULL;
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
-
- //
- // if a root bridge instance is found, create root bridge device for it
- //
-
- RootBridgeDev = CreateRootBridge (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Enumerate all the buses under this root bridge
- //
-
- Status = PciRootBridgeEnumerator (
- PciResAlloc,
- RootBridgeDev
- );
-
- DestroyRootBridge (RootBridgeDev);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- //
- // Notify the bus allocation phase is to end for the 2nd time
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeEndBusAllocation);
- }
- }
-
- //
- // Notify the resource allocation phase is to start
- //
- NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginResourceAllocation);
-
- RootBridgeHandle = NULL;
- while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
-
- //
- // if a root bridge instance is found, create root bridge device for it
- //
-
- RootBridgeDev = CreateRootBridge (RootBridgeHandle);
-
- if (RootBridgeDev == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = StartManagingRootBridge (RootBridgeDev);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- PciRootBridgeIo = RootBridgeDev->PciRootBridgeIo;
- Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Descriptors);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = PciGetBusRange (&Descriptors, &MinBus, NULL, NULL);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Determine root bridge attribute by calling interface of Pcihostbridge
- // protocol
- //
- DetermineRootBridgeAttributes (
- PciResAlloc,
- RootBridgeDev
- );
-
- //
- // Collect all the resource information under this root bridge
- // A database that records all the information about pci device subject to this
- // root bridge will then be created
- //
- Status = PciPciDeviceInfoCollector (
- RootBridgeDev,
- (UINT8) MinBus
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- InsertRootBridge (RootBridgeDev);
-
- //
- // Record the hostbridge handle
- //
- AddHostBridgeEnumerator (RootBridgeDev->PciRootBridgeIo->ParentHandle);
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Read PCI device configuration register by specified address.
-
- This function check the incompatiblilites on PCI device. Return the register
- value.
-
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param PciIo A pointer to EFI_PCI_PROTOCOL.
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-STATIC
-EFI_STATUS
-ReadConfigData (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OPTIONAL
- IN EFI_PCI_IO_PROTOCOL *PciIo, OPTIONAL
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN UINT64 Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- UINT64 AccessWidth;
- EFI_PCI_REGISTER_ACCESS_DATA *PciRegisterAccessData;
- UINT64 AccessAddress;
- UINTN Stride;
- UINT64 TempBuffer;
- UINT8 *Pointer;
-
- ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));
-
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT) {
- //
- // check access compatibility at first time
- //
- Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_READ, Address & 0xff, Width, &PciRegisterAccessData);
-
- if (Status == EFI_SUCCESS) {
- //
- // there exist incompatibility on this operation
- //
- AccessWidth = Width;
-
- if (PciRegisterAccessData->Width != VALUE_NOCARE) {
- AccessWidth = PciRegisterAccessData->Width;
- }
-
- AccessAddress = Address & ~((1 << AccessWidth) - 1);
-
- TempBuffer = 0;
- Stride = 0;
- Pointer = (UINT8 *) &TempBuffer;
-
- while (1) {
-
- if (PciRootBridgeIo != NULL) {
- Status = PciRootBridgeIo->Pci.Read (
- PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) AccessWidth,
- AccessAddress,
- 1,
- Pointer
- );
- } else if (PciIo != NULL) {
- Status = PciIo->Pci.Read (
- PciIo,
- (EFI_PCI_IO_PROTOCOL_WIDTH) AccessWidth,
- (UINT32) AccessAddress,
- 1,
- Pointer
- );
- }
-
- if (Status != EFI_SUCCESS) {
- return Status;
- }
-
- Stride = 1 << AccessWidth;
- AccessAddress += Stride;
- if (AccessAddress >= (Address + (1 << Width))) {
- //
- // if all datas have been read, exist
- //
- break;
- }
-
- Pointer += Stride;
-
- if ((AccessAddress & 0xff) < PciRegisterAccessData->EndOffset) {
- //
- // if current offset doesn't reach the end
- //
- continue;
- }
-
- FreePool (PciRegisterAccessData);
-
- //
- // continue checking access incompatibility
- //
- Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_READ, AccessAddress & 0xff, AccessWidth, &PciRegisterAccessData);
- if (Status == EFI_SUCCESS) {
- if (PciRegisterAccessData->Width != VALUE_NOCARE) {
- AccessWidth = PciRegisterAccessData->Width;
- }
- }
- }
-
- FreePool (PciRegisterAccessData);
-
- switch (Width) {
- case EfiPciWidthUint8:
- * (UINT8 *) Buffer = (UINT8) TempBuffer;
- break;
- case EfiPciWidthUint16:
- * (UINT16 *) Buffer = (UINT16) TempBuffer;
- break;
- case EfiPciWidthUint32:
- * (UINT32 *) Buffer = (UINT32) TempBuffer;
- break;
- default:
- return EFI_UNSUPPORTED;
- }
-
- return Status;
- }
- }
- //
- // AccessWidth incompatible check not supportted
- // or, there doesn't exist incompatibility on this operation
- //
- if (PciRootBridgeIo != NULL) {
- Status = PciRootBridgeIo->Pci.Read (
- PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- 1,
- Buffer
- );
-
- } else {
- Status = PciIo->Pci.Read (
- PciIo,
- (EFI_PCI_IO_PROTOCOL_WIDTH) Width,
- (UINT32) Address,
- 1,
- Buffer
- );
- }
-
- return Status;
-}
-
-/**
- Update register value by checking PCI device incompatibility.
-
- This function check register value incompatibilites on PCI device. Return the register
- value.
-
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
- @param AccessType Access type, READ or WRITE.
- @Param Address The address within the PCI configuration space.
- @param Buffer Store the register data.
-
- @retval EFI_SUCCESS The data has been updated.
-
-**/
-STATIC
-EFI_STATUS
-UpdateConfigData (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN UINT64 AccessType,
- IN UINT64 Width,
- IN UINT64 Address,
- IN OUT VOID *Buffer
-)
-{
- EFI_STATUS Status;
- EFI_PCI_REGISTER_VALUE_DATA *PciRegisterData;
- UINT32 AndValue;
- UINT32 OrValue;
- UINT32 TempValue;
-
- //
- // check register value incompatibility
- //
- Status = PciRegisterUpdateCheck (PciDeviceInfo, AccessType, Address & 0xff, &PciRegisterData);
-
- if (Status == EFI_SUCCESS) {
-
- AndValue = ((UINT32) PciRegisterData->AndValue) >> (((UINT8) Address & 0x3) * 8);
- OrValue = ((UINT32) PciRegisterData->OrValue) >> (((UINT8) Address & 0x3) * 8);
-
- TempValue = * (UINT32 *) Buffer;
- if (PciRegisterData->AndValue != VALUE_NOCARE) {
- TempValue &= AndValue;
- }
- if (PciRegisterData->OrValue != VALUE_NOCARE) {
- TempValue |= OrValue;
- }
-
- switch (Width) {
- case EfiPciWidthUint8:
- *(UINT8 *)Buffer = (UINT8) TempValue;
- break;
-
- case EfiPciWidthUint16:
- *(UINT16 *)Buffer = (UINT16) TempValue;
- break;
- case EfiPciWidthUint32:
- *(UINT32 *)Buffer = TempValue;
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
-
- FreePool (PciRegisterData);
- }
-
- return Status;
-}
-
-/**
- Write PCI device configuration register by specified address.
-
- This function check the incompatiblilites on PCI device, and write date
- into register.
-
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param PciIo A pointer to EFI_PCI_PROTOCOL.
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-STATIC
-EFI_STATUS
-WriteConfigData (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OPTIONAL
- IN EFI_PCI_IO_PROTOCOL *PciIo, OPTIONAL
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN UINT64 Width,
- IN UINT64 Address,
- IN VOID *Buffer
- )
-{
- EFI_STATUS Status;
- UINT64 AccessWidth;
- EFI_PCI_REGISTER_ACCESS_DATA *PciRegisterAccessData;
- UINT64 AccessAddress;
- UINTN Stride;
- UINT8 *Pointer;
- UINT64 Data;
- UINTN Shift;
-
- ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));
-
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT) {
- //
- // check access compatibility at first time
- //
- Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_WRITE, Address & 0xff, Width, &PciRegisterAccessData);
-
- if (Status == EFI_SUCCESS) {
- //
- // there exist incompatibility on this operation
- //
- AccessWidth = Width;
-
- if (PciRegisterAccessData->Width != VALUE_NOCARE) {
- AccessWidth = PciRegisterAccessData->Width;
- }
-
- AccessAddress = Address & ~((1 << AccessWidth) - 1);
-
- Stride = 0;
- Pointer = (UINT8 *) &Buffer;
- Data = * (UINT64 *) Buffer;
-
- while (1) {
-
- if (AccessWidth > Width) {
- //
- // if actual access width is larger than orignal one, additional data need to be read back firstly
- //
- Status = ReadConfigData (PciRootBridgeIo, PciIo, PciDeviceInfo, AccessWidth, AccessAddress, &Data);
- if (Status != EFI_SUCCESS) {
- return Status;
- }
-
- //
- // check data read incompatibility
- //
- UpdateConfigData (PciDeviceInfo, PCI_REGISTER_READ, AccessWidth, AccessAddress & 0xff, &Data);
-
- Shift = (UINTN) ((Address - AccessAddress) * 8);
- switch (Width) {
- case EfiPciWidthUint8:
- Data = (* (UINT8 *) Buffer) << Shift | (Data & ~(0xff << Shift));
- break;
-
- case EfiPciWidthUint16:
- Data = (* (UINT16 *) Buffer) << Shift | (Data & ~(0xffff << Shift));
- break;
- }
-
- //
- // check data write incompatibility
- //
- UpdateConfigData (PciDeviceInfo, PCI_REGISTER_WRITE, AccessWidth, AccessAddress * 0xff, &Data);
- }
-
- if (PciRootBridgeIo != NULL) {
- Status = PciRootBridgeIo->Pci.Write (
- PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) AccessWidth,
- AccessAddress,
- 1,
- &Data
- );
- } else {
- Status = PciIo->Pci.Write (
- PciIo,
- (EFI_PCI_IO_PROTOCOL_WIDTH) AccessWidth,
- (UINT32) AccessAddress,
- 1,
- &Data
- );
- }
-
- if (Status != EFI_SUCCESS) {
- return Status;
- }
-
- Data = RShiftU64 (Data, ((1 << AccessWidth) * 8));
-
- Stride = 1 << AccessWidth;
- AccessAddress += Stride;
- if (AccessAddress >= (Address + (1 << Width))) {
- //
- // if all datas have been written, exist
- //
- break;
- }
-
- Pointer += Stride;
-
- if ((AccessAddress & 0xff) < PciRegisterAccessData->EndOffset) {
- //
- // if current offset doesn't reach the end
- //
- continue;
- }
-
- FreePool (PciRegisterAccessData);
-
- //
- // continue checking access incompatibility
- //
- Status = PciRegisterAccessCheck (PciDeviceInfo, PCI_REGISTER_WRITE, AccessAddress & 0xff, AccessWidth, &PciRegisterAccessData);
- if (Status == EFI_SUCCESS) {
- if (PciRegisterAccessData->Width != VALUE_NOCARE) {
- AccessWidth = PciRegisterAccessData->Width;
- }
- }
- };
-
- FreePool (PciRegisterAccessData);
-
- return Status;
- }
-
- }
- //
- // AccessWidth incompatible check not supportted
- // or, there doesn't exist incompatibility on this operation
- //
- if (PciRootBridgeIo != NULL) {
- Status = PciRootBridgeIo->Pci.Write (
- PciRootBridgeIo,
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,
- Address,
- 1,
- Buffer
- );
- } else {
- Status = PciIo->Pci.Write (
- PciIo,
- (EFI_PCI_IO_PROTOCOL_WIDTH) Width,
- (UINT32) Address,
- 1,
- Buffer
- );
- }
-
- return Status;
-}
-
-/**
- Abstract PCI device device information.
-
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param PciIo A pointer to EFI_PCI_PROTOCOL.
- @param Pci A pointer to PCI_TYPE00.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
-
- @retval EFI_SUCCESS Pci device device information has been abstracted.
-
-**/
-STATIC
-EFI_STATUS
-GetPciDeviceDeviceInfo (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OPTIONAL
- IN EFI_PCI_IO_PROTOCOL *PciIo, OPTIONAL
- IN PCI_TYPE00 *Pci, OPTIONAL
- IN UINT64 Address, OPTIONAL
- OUT EFI_PCI_DEVICE_INFO *PciDeviceInfo
-)
-{
- EFI_STATUS Status;
- UINT64 PciAddress;
- UINT32 PciConfigData;
- PCI_IO_DEVICE *PciIoDevice;
-
- ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));
-
- if (PciIo != NULL) {
- PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (PciIo);
-
- //
- // get pointer to PCI_TYPE00 from PciIoDevice
- //
- Pci = &PciIoDevice->Pci;
- }
-
- if (Pci == NULL) {
- //
- // while PCI_TYPE00 hasn't been gotten, read PCI device device information directly
- //
- PciAddress = Address & 0xffffffffffffff00ULL;
- Status = PciRootBridgeIo->Pci.Read (
- PciRootBridgeIo,
- EfiPciWidthUint32,
- PciAddress,
- 1,
- &PciConfigData
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if ((PciConfigData & 0xffff) == 0xffff) {
- return EFI_NOT_FOUND;
- }
-
- PciDeviceInfo->VendorID = PciConfigData & 0xffff;
- PciDeviceInfo->DeviceID = PciConfigData >> 16;
-
- Status = PciRootBridgeIo->Pci.Read (
- PciRootBridgeIo,
- EfiPciWidthUint32,
- PciAddress + 8,
- 1,
- &PciConfigData
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- PciDeviceInfo->RevisionID = PciConfigData & 0xf;
-
- Status = PciRootBridgeIo->Pci.Read (
- PciRootBridgeIo,
- EfiPciWidthUint32,
- PciAddress + 0x2c,
- 1,
- &PciConfigData
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- PciDeviceInfo->SubsystemVendorID = PciConfigData & 0xffff;
- PciDeviceInfo->SubsystemID = PciConfigData >> 16;
-
- } else {
- PciDeviceInfo->VendorID = Pci->Hdr.VendorId;
- PciDeviceInfo->DeviceID = Pci->Hdr.DeviceId;
- PciDeviceInfo->RevisionID = Pci->Hdr.RevisionID;
- PciDeviceInfo->SubsystemVendorID = Pci->Device.SubsystemVendorID;
- PciDeviceInfo->SubsystemID = Pci->Device.SubsystemID;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Read PCI configuration space with incompatibility check.
-
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param PciIo A pointer to the EFI_PCI_IO_PROTOCOL.
- @param Pci A pointer to PCI_TYPE00.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-STATIC
-EFI_STATUS
-PciIncompatibilityCheckRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OPTIONAL
- IN EFI_PCI_IO_PROTOCOL *PciIo, OPTIONAL
- IN PCI_TYPE00 *Pci, OPTIONAL
- IN UINTN Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
-)
-{
- EFI_STATUS Status;
- EFI_PCI_DEVICE_INFO PciDeviceInfo;
- UINT32 Stride;
-
- ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));
-
- //
- // get PCI device device information
- //
- Status = GetPciDeviceDeviceInfo (PciRootBridgeIo, PciIo, Pci, Address, &PciDeviceInfo);
- if (Status != EFI_SUCCESS) {
- return Status;
- }
-
- Stride = 1 << Width;
-
- for (; Count > 0; Count--, Address += Stride, Buffer = (UINT8 *)Buffer + Stride) {
-
- //
- // read configuration register
- //
- Status = ReadConfigData (PciRootBridgeIo, PciIo, &PciDeviceInfo, (UINT64) Width, Address, Buffer);
-
- if (Status != EFI_SUCCESS) {
- return Status;
- }
-
- //
- // update the data read from configuration register
- //
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT) {
- UpdateConfigData (&PciDeviceInfo, PCI_REGISTER_READ, Width, Address & 0xff, Buffer);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Write PCI configuration space with incompatibility check.
-
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param PciIo A pointer to the EFI_PCI_IO_PROTOCOL.
- @param Pci A pointer to PCI_TYPE00.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-STATIC
-EFI_STATUS
-PciIncompatibilityCheckWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OPTIONAL
- IN EFI_PCI_IO_PROTOCOL *PciIo, OPTIONAL
- IN PCI_TYPE00 *Pci, OPTIONAL
- IN UINTN Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
-)
-{
- EFI_STATUS Status;
- EFI_PCI_DEVICE_INFO PciDeviceInfo;
- UINT32 Stride;
- UINT64 Data;
-
- ASSERT ((PciRootBridgeIo == NULL) ^ (PciIo == NULL));
-
- //
- // get PCI device device information
- //
- Status = GetPciDeviceDeviceInfo (PciRootBridgeIo, PciIo, Pci, Address, &PciDeviceInfo);
- if (Status != EFI_SUCCESS) {
- return Status;
- }
-
- Stride = 1 << Width;
-
- for (; Count > 0; Count--, Address += Stride, Buffer = (UINT8 *) Buffer + Stride) {
-
- Data = 0;
-
- switch (Width) {
- case EfiPciWidthUint8:
- Data = * (UINT8 *) Buffer;
- break;
- case EfiPciWidthUint16:
- Data = * (UINT16 *) Buffer;
- break;
-
- case EfiPciWidthUint32:
- Data = * (UINT32 *) Buffer;
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
-
- //
- // update the data writen into configuration register
- //
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT) {
- UpdateConfigData (&PciDeviceInfo, PCI_REGISTER_WRITE, Width, Address & 0xff, &Data);
- }
-
- //
- // write configuration register
- //
- Status = WriteConfigData (PciRootBridgeIo, PciIo, &PciDeviceInfo, Width, Address, &Data);
-
- if (Status != EFI_SUCCESS) {
- return Status;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Read PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
-
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Pci A pointer to PCI_TYPE00.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-EFI_STATUS
-PciRootBridgeIoRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- IN PCI_TYPE00 *Pci, OPTIONAL
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_READ_SUPPORT) {
- //
- // if PCI incompatibility check enabled
- //
- return PciIncompatibilityCheckRead (
- PciRootBridgeIo,
- NULL,
- Pci,
- (UINTN) Width,
- Address,
- Count,
- Buffer
- );
- } else {
- return PciRootBridgeIo->Pci.Read (
- PciRootBridgeIo,
- Width,
- Address,
- Count,
- Buffer
- );
- }
-}
-
-/**
- Write PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
-
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Pci A pointer to PCI_TYPE00.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-EFI_STATUS
-PciRootBridgeIoWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- IN PCI_TYPE00 *Pci,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_WRITE_SUPPORT) {
- //
- // if PCI incompatibility check enabled
- //
- return PciIncompatibilityCheckWrite (
- PciRootBridgeIo,
- NULL,
- Pci,
- Width,
- Address,
- Count,
- Buffer
- );
-
- } else {
- return PciRootBridgeIo->Pci.Write (
- PciRootBridgeIo,
- Width,
- Address,
- Count,
- Buffer
- );
- }
-}
-
-/**
- Read PCI configuration space through EFI_PCI_IO_PROTOCOL.
-
- @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-EFI_STATUS
-PciIoRead (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_READ_SUPPORT) {
- //
- // if PCI incompatibility check enabled
- //
- return PciIncompatibilityCheckRead (
- NULL,
- PciIo,
- NULL,
- (UINTN) Width,
- Address,
- Count,
- Buffer
- );
- } else {
- return PciIo->Pci.Read (
- PciIo,
- Width,
- Address,
- Count,
- Buffer
- );
- }
-}
-
-/**
- Write PCI configuration space through EFI_PCI_IO_PROTOCOL.
-
- @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-EFI_STATUS
-PciIoWrite (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- )
-{
- if (PcdGet8 (PcdPciIncompatibleDeviceSupportMask) & PCI_INCOMPATIBLE_WRITE_SUPPORT) {
-
- //
- // if PCI incompatibility check enabled
- //
- return PciIncompatibilityCheckWrite (
- NULL,
- PciIo,
- NULL,
- Width,
- Address,
- Count,
- Buffer
- );
-
- } else {
- return PciIo->Pci.Write (
- PciIo,
- Width,
- Address,
- Count,
- Buffer
- );
- }
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.h
deleted file mode 100644
index 17e3587..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciLib.h
+++ /dev/null
@@ -1,385 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciLib.h
-
-Abstract:
-
- PCI Bus Driver Lib header file.
- Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable
- support hot plug.
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_LIB_H
-#define _EFI_PCI_LIB_H
-
-//
-// Mask definistions for PCD PcdPciIncompatibleDeviceSupportMask
-//
-#define PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT 0x01
-#define PCI_INCOMPATIBLE_READ_SUPPORT 0x02
-#define PCI_INCOMPATIBLE_WRITE_SUPPORT 0x04
-#define PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT 0x08
-#define PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT 0x0a
-
-VOID
-InstallHotPlugRequestProtocol (
- IN EFI_STATUS *Status
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Status - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-InstallPciHotplugGuid (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-UninstallPciHotplugGuid (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-GetBackPcCardBar (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-RemoveRejectedPciDevices (
- EFI_HANDLE RootBridgeHandle,
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- RootBridgeHandle - TODO: add argument description
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciHostBridgeResourceAllocator (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciResAlloc - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-;
-
-EFI_STATUS
-PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-;
-
-EFI_STATUS
-PciScanBus (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber,
- OUT UINT8 *PaddedBusRange
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- StartBusNumber - TODO: add argument description
- SubBusNumber - TODO: add argument description
- PaddedBusRange - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciScanBus_WithHotPlugDeviceSupport (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber,
- OUT UINT8 *PaddedBusRange
- )
-;
-
-EFI_STATUS
-PciScanBus_WithoutHotPlugDeviceSupport (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber,
- OUT UINT8 *SubBusNumber,
- OUT UINT8 *PaddedBusRange
- )
-;
-
-EFI_STATUS
-PciRootBridgeP2CProcess (
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciHostBridgeP2CProcess (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciResAlloc - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciHostBridgeEnumerator (
- EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciResAlloc - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-/**
- Read PCI configuration space through EFI_PCI_IO_PROTOCOL.
-
- @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-EFI_STATUS
-PciIoRead (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Write PCI configuration space through EFI_PCI_IO_PROTOCOL.
-
- @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-EFI_STATUS
-PciIoWrite (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Write PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
-
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Pci A pointer to PCI_TYPE00.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-EFI_STATUS
-PciRootBridgeIoWrite (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- IN PCI_TYPE00 *Pci,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-/**
- Read PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
-
- @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
- @param Pci A pointer to PCI_TYPE00.
- @param Width Signifies the width of the memory operations.
- @Param Address The address within the PCI configuration space for the PCI controller.
- @param Buffer For read operations, the destination buffer to store the results. For
- write operations, the source buffer to write data from.
-
- @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
- @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
- @retval EFI_INVALID_PARAMETER Buffer is NULL.
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
-
-**/
-EFI_STATUS
-PciRootBridgeIoRead (
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- IN PCI_TYPE00 *Pci,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.c
deleted file mode 100644
index f6b371f..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciOptionRomSupport.c
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-#include "PciResourceSupport.h"
-
-//
-// Min Max
-//
-#define EFI_MIN(a, b) (((a) < (b)) ? (a) : (b))
-#define EFI_MAX(a, b) (((a) > (b)) ? (a) : (b))
-
-
-EFI_STATUS
-GetOpRomInfo (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT8 RomBarIndex;
- UINT32 AllOnes;
- UINT64 Address;
- EFI_STATUS Status;
- UINT8 Bus;
- UINT8 Device;
- UINT8 Function;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- Bus = PciIoDevice->BusNumber;
- Device = PciIoDevice->DeviceNumber;
- Function = PciIoDevice->FunctionNumber;
-
- PciRootBridgeIo = PciIoDevice->PciRootBridgeIo;
-
- //
- // offset is 0x30 if is not ppb
- //
-
- //
- // 0x30
- //
- RomBarIndex = PCI_DEVICE_ROMBAR;
-
- if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) {
- //
- // if is ppb
- //
-
- //
- // 0x38
- //
- RomBarIndex = PCI_BRIDGE_ROMBAR;
- }
- //
- // the bit0 is 0 to prevent the enabling of the Rom address decoder
- //
- AllOnes = 0xfffffffe;
- Address = EFI_PCI_ADDRESS (Bus, Device, Function, RomBarIndex);
-
- Status = PciRootBridgeIoWrite (
- PciRootBridgeIo,
- &PciIoDevice->Pci,
- EfiPciWidthUint32,
- Address,
- 1,
- &AllOnes
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // read back
- //
- Status = PciRootBridgeIoRead (
- PciRootBridgeIo,
- &PciIoDevice->Pci,
- EfiPciWidthUint32,
- Address,
- 1,
- &AllOnes
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Bits [1, 10] are reserved
- //
- AllOnes &= 0xFFFFF800;
- if ((AllOnes == 0) || (AllOnes == 0xFFFFF800)) {
- return EFI_NOT_FOUND;
- }
-
- PciIoDevice->RomSize = (UINT64) ((~AllOnes) + 1);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-LoadOpRomImage (
- IN PCI_IO_DEVICE *PciDevice,
- IN UINT64 RomBase
- )
-/*++
-
-Routine Description:
-
- Load option rom image for specified PCI device
-
-Arguments:
-
-Returns:
-
---*/
-// TODO: PciDevice - add argument and description to function comment
-// TODO: RomBase - add argument and description to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-{
- UINT8 RomBarIndex;
- UINT8 Indicator;
- UINT16 OffsetPcir;
- UINT32 RomBarOffset;
- UINT32 RomBar;
- EFI_STATUS retStatus;
- BOOLEAN FirstCheck;
- UINT8 *Image;
- PCI_EXPANSION_ROM_HEADER *RomHeader;
- PCI_DATA_STRUCTURE *RomPcir;
- UINT64 RomSize;
- UINT64 RomImageSize;
- UINT8 *RomInMemory;
- UINT8 CodeType;
-
- RomSize = PciDevice->RomSize;
-
- Indicator = 0;
- RomImageSize = 0;
- RomInMemory = NULL;
- CodeType = 0xFF;
-
- //
- // Get the RomBarIndex
- //
-
- //
- // 0x30
- //
- RomBarIndex = PCI_DEVICE_ROMBAR;
- if (IS_PCI_BRIDGE (&(PciDevice->Pci))) {
- //
- // if is ppb
- //
-
- //
- // 0x38
- //
- RomBarIndex = PCI_BRIDGE_ROMBAR;
- }
- //
- // Allocate memory for Rom header and PCIR
- //
- RomHeader = AllocatePool (sizeof (PCI_EXPANSION_ROM_HEADER));
- if (RomHeader == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- RomPcir = AllocatePool (sizeof (PCI_DATA_STRUCTURE));
- if (RomPcir == NULL) {
- gBS->FreePool (RomHeader);
- return EFI_OUT_OF_RESOURCES;
- }
-
- RomBar = (UINT32) RomBase;
-
- //
- // Enable RomBar
- //
- RomDecode (PciDevice, RomBarIndex, RomBar, TRUE);
-
- RomBarOffset = RomBar;
- retStatus = EFI_NOT_FOUND;
- FirstCheck = TRUE;
-
- do {
- PciDevice->PciRootBridgeIo->Mem.Read (
- PciDevice->PciRootBridgeIo,
- EfiPciWidthUint8,
- RomBarOffset,
- sizeof (PCI_EXPANSION_ROM_HEADER),
- (UINT8 *) RomHeader
- );
-
- if (RomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
- RomBarOffset = RomBarOffset + 512;
- if (FirstCheck) {
- break;
- } else {
- RomImageSize = RomImageSize + 512;
- continue;
- }
- }
-
- FirstCheck = FALSE;
- OffsetPcir = RomHeader->PcirOffset;
- PciDevice->PciRootBridgeIo->Mem.Read (
- PciDevice->PciRootBridgeIo,
- EfiPciWidthUint8,
- RomBarOffset + OffsetPcir,
- sizeof (PCI_DATA_STRUCTURE),
- (UINT8 *) RomPcir
- );
- if (RomPcir->CodeType == PCI_CODE_TYPE_PCAT_IMAGE) {
- CodeType = PCI_CODE_TYPE_PCAT_IMAGE;
- }
- Indicator = RomPcir->Indicator;
- RomImageSize = RomImageSize + RomPcir->ImageLength * 512;
- RomBarOffset = RomBarOffset + RomPcir->ImageLength * 512;
- } while (((Indicator & 0x80) == 0x00) && ((RomBarOffset - RomBar) < RomSize));
-
- //
- // Some Legacy Cards do not report the correct ImageLength so used the maximum
- // of the legacy length and the PCIR Image Length
- //
- if (CodeType == PCI_CODE_TYPE_PCAT_IMAGE) {
- RomImageSize = EFI_MAX(RomImageSize, (((EFI_LEGACY_EXPANSION_ROM_HEADER *)RomHeader)->Size512 * 512));
- }
-
- if (RomImageSize > 0) {
- retStatus = EFI_SUCCESS;
- Image = AllocatePool ((UINT32) RomImageSize);
- if (Image == NULL) {
- RomDecode (PciDevice, RomBarIndex, RomBar, FALSE);
- gBS->FreePool (RomHeader);
- gBS->FreePool (RomPcir);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Copy Rom image into memory
- //
- PciDevice->PciRootBridgeIo->Mem.Read (
- PciDevice->PciRootBridgeIo,
- EfiPciWidthUint8,
- RomBar,
- (UINT32) RomImageSize,
- Image
- );
- RomInMemory = Image;
- }
-
- RomDecode (PciDevice, RomBarIndex, RomBar, FALSE);
-
- PciDevice->PciIo.RomSize = RomImageSize;
- PciDevice->PciIo.RomImage = RomInMemory;
-
- PciRomAddImageMapping (
- NULL,
- PciDevice->PciRootBridgeIo->SegmentNumber,
- PciDevice->BusNumber,
- PciDevice->DeviceNumber,
- PciDevice->FunctionNumber,
- (UINT64) (UINTN) PciDevice->PciIo.RomImage,
- PciDevice->PciIo.RomSize
- );
-
- //
- // Free allocated memory
- //
- gBS->FreePool (RomHeader);
- gBS->FreePool (RomPcir);
-
- return retStatus;
-}
-
-EFI_STATUS
-RomDecode (
- IN PCI_IO_DEVICE *PciDevice,
- IN UINT8 RomBarIndex,
- IN UINT32 RomBar,
- IN BOOLEAN Enable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-// TODO: PciDevice - add argument and description to function comment
-// TODO: RomBarIndex - add argument and description to function comment
-// TODO: RomBar - add argument and description to function comment
-// TODO: Enable - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT32 Value32;
- UINT32 Offset;
- EFI_PCI_IO_PROTOCOL *PciIo;
-
- PciIo = &PciDevice->PciIo;
- if (Enable) {
- //
- // Clear all bars
- //
- for (Offset = 0x10; Offset <= 0x24; Offset += sizeof (UINT32)) {
- PciIoWrite (PciIo, EfiPciIoWidthUint32, Offset, 1, &gAllZero);
- }
-
- //
- // set the Rom base address: now is hardcode
- // enable its decoder
- //
- Value32 = RomBar | 0x1;
- PciIoWrite (
- PciIo,
- (EFI_PCI_IO_PROTOCOL_WIDTH) EfiPciWidthUint32,
- RomBarIndex,
- 1,
- &Value32
- );
-
- //
- // Programe all upstream bridge
- //
- ProgrameUpstreamBridgeForRom(PciDevice, RomBar, TRUE);
-
- //
- // Setting the memory space bit in the function's command register
- //
- PciEnableCommandRegister(PciDevice, EFI_PCI_COMMAND_MEMORY_SPACE);
-
- } else {
-
- //
- // disable command register decode to memory
- //
- PciDisableCommandRegister(PciDevice, EFI_PCI_COMMAND_MEMORY_SPACE);
-
- //
- // Destroy the programmed bar in all the upstream bridge.
- //
- ProgrameUpstreamBridgeForRom(PciDevice, RomBar, FALSE);
-
- //
- // disable rom decode
- //
- Value32 = 0xFFFFFFFE;
- PciIoWrite (
- PciIo,
- (EFI_PCI_IO_PROTOCOL_WIDTH) EfiPciWidthUint32,
- RomBarIndex,
- 1,
- &Value32
- );
-
- }
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-ProcessOpRomImage (
- PCI_IO_DEVICE *PciDevice
- )
-/*++
-
-Routine Description:
-
- Process the oprom image.
-
-Arguments:
- PciDevice A pointer to a pci device.
-
-Returns:
-
- EFI Status.
-
---*/
-{
- UINT8 Indicator;
- UINT32 ImageSize;
- UINT16 ImageOffset;
- VOID *RomBar;
- UINT8 *RomBarOffset;
- EFI_HANDLE ImageHandle;
- EFI_STATUS Status;
- EFI_STATUS retStatus;
- BOOLEAN FirstCheck;
- BOOLEAN SkipImage;
- UINT32 DestinationSize;
- UINT32 ScratchSize;
- UINT8 *Scratch;
- VOID *ImageBuffer;
- VOID *DecompressedImageBuffer;
- UINT32 ImageLength;
- EFI_DECOMPRESS_PROTOCOL *Decompress;
- EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader;
- PCI_DATA_STRUCTURE *Pcir;
-
- Indicator = 0;
-
- //
- // Get the Address of the Rom image
- //
- RomBar = PciDevice->PciIo.RomImage;
- RomBarOffset = (UINT8 *) RomBar;
- retStatus = EFI_NOT_FOUND;
- FirstCheck = TRUE;
-
- do {
- EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) RomBarOffset;
- if (EfiRomHeader->Signature != PCI_EXPANSION_ROM_HEADER_SIGNATURE) {
- RomBarOffset = RomBarOffset + 512;
- if (FirstCheck) {
- break;
- } else {
- continue;
- }
- }
-
- FirstCheck = FALSE;
- Pcir = (PCI_DATA_STRUCTURE *) (RomBarOffset + EfiRomHeader->PcirOffset);
- ImageSize = (UINT32) (Pcir->ImageLength * 512);
- Indicator = Pcir->Indicator;
-
- if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&
- (EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE)) {
-
- if ((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||
- (EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)) {
-
- ImageOffset = EfiRomHeader->EfiImageHeaderOffset;
- ImageSize = (UINT32) (EfiRomHeader->InitializationSize * 512);
-
- ImageBuffer = (VOID *) (RomBarOffset + ImageOffset);
- ImageLength = ImageSize - (UINT32)ImageOffset;
- DecompressedImageBuffer = NULL;
-
- //
- // decompress here if needed
- //
- SkipImage = FALSE;
- if (EfiRomHeader->CompressionType > EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
- SkipImage = TRUE;
- }
-
- if (EfiRomHeader->CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
- Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **) &Decompress);
- if (EFI_ERROR (Status)) {
- SkipImage = TRUE;
- } else {
- SkipImage = TRUE;
- Status = Decompress->GetInfo (
- Decompress,
- ImageBuffer,
- ImageLength,
- &DestinationSize,
- &ScratchSize
- );
- if (!EFI_ERROR (Status)) {
- DecompressedImageBuffer = NULL;
- DecompressedImageBuffer = AllocatePool (DestinationSize);
- if (DecompressedImageBuffer != NULL) {
- Scratch = AllocatePool (ScratchSize);
- if (Scratch != NULL) {
- Status = Decompress->Decompress (
- Decompress,
- ImageBuffer,
- ImageLength,
- DecompressedImageBuffer,
- DestinationSize,
- Scratch,
- ScratchSize
- );
- if (!EFI_ERROR (Status)) {
- ImageBuffer = DecompressedImageBuffer;
- ImageLength = DestinationSize;
- SkipImage = FALSE;
- }
-
- gBS->FreePool (Scratch);
- }
- }
- }
- }
- }
-
- if (!SkipImage) {
- //
- // load image and start image
- //
- Status = gBS->LoadImage (
- FALSE,
- gPciBusDriverBinding.DriverBindingHandle,
- PciDevice->Handle,
- ImageBuffer,
- ImageLength,
- &ImageHandle
- );
- if (!EFI_ERROR (Status)) {
- Status = gBS->StartImage (ImageHandle, NULL, NULL);
- if (!EFI_ERROR (Status)) {
- AddDriver (PciDevice, ImageHandle);
- PciRomAddImageMapping (
- ImageHandle,
- PciDevice->PciRootBridgeIo->SegmentNumber,
- PciDevice->BusNumber,
- PciDevice->DeviceNumber,
- PciDevice->FunctionNumber,
- (UINT64) (UINTN) PciDevice->PciIo.RomImage,
- PciDevice->PciIo.RomSize
- );
- retStatus = EFI_SUCCESS;
- }
- }
- }
-
- RomBarOffset = RomBarOffset + ImageSize;
- } else {
- RomBarOffset = RomBarOffset + ImageSize;
- }
- } else {
- RomBarOffset = RomBarOffset + ImageSize;
- }
-
- } while (((Indicator & 0x80) == 0x00) && ((UINTN) (RomBarOffset - (UINT8 *) RomBar) < PciDevice->RomSize));
-
- return retStatus;
-
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.h
deleted file mode 100644
index 2bb11bf..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciOptionRomSupport.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciOptionRomSupport.h
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_OP_ROM_SUPPORT_H
-#define _EFI_PCI_OP_ROM_SUPPORT_H
-
-EFI_STATUS
-GetOpRomInfo (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-LoadOpRomImage (
- IN PCI_IO_DEVICE *PciDevice,
- IN UINT64 RomBase
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDevice - TODO: add argument description
- RomBase - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-RomDecode (
- IN PCI_IO_DEVICE *PciDevice,
- IN UINT8 RomBarIndex,
- IN UINT32 RomBar,
- IN BOOLEAN Enable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDevice - TODO: add argument description
- RomBarIndex - TODO: add argument description
- RomBar - TODO: add argument description
- Enable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ProcessOpRomImage (
- PCI_IO_DEVICE *PciDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.c
deleted file mode 100644
index 4584198..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciPowerManagement.c
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-
-EFI_STATUS
-ResetPowerManagementFeature (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- This function is intended to turn off PWE assertion and
- put the device to D0 state if the device supports
- PCI Power Management.
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- UINT8 PowerManagementRegBlock;
- UINT16 PMCSR;
-
- PowerManagementRegBlock = 0;
-
- Status = LocateCapabilityRegBlock (
- PciIoDevice,
- EFI_PCI_CAPABILITY_ID_PMI,
- &PowerManagementRegBlock,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Turn off the PWE assertion and put the device into D0 State
- //
- PMCSR = 0x8000;
-
- //
- // Write PMCSR
- //
- PciIoWrite (
- &PciIoDevice->PciIo,
- EfiPciIoWidthUint16,
- PowerManagementRegBlock + 4,
- 1,
- &PMCSR
- );
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.h
deleted file mode 100644
index f33f7ab..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciPowerManagement.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciPowerManagement.h
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_POWER_MANAGEMENT_H
-#define _EFI_PCI_POWER_MANAGEMENT_H
-
-EFI_STATUS
-ResetPowerManagementFeature (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.c
deleted file mode 100644
index a6ae80f..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.c
+++ /dev/null
@@ -1,2314 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciResourceSupport.c
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-#include "PciResourceSupport.h"
-#include "PciCommand.h"
-
-EFI_STATUS
-SkipVGAAperture (
- OUT UINT64 *Start,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- The function is used to skip VGA range
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Start - add argument and description to function comment
-// TODO: Length - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT64 Original;
- UINT64 Mask;
- UINT64 StartOffset;
- UINT64 LimitOffset;
-
- //
- // For legacy VGA, bit 10 to bit 15 is not decoded
- //
- Mask = 0x3FF;
-
- Original = *Start;
- StartOffset = Original & Mask;
- LimitOffset = ((*Start) + Length - 1) & Mask;
- if (LimitOffset >= VGABASE1) {
- *Start = *Start - StartOffset + VGALIMIT2 + 1;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-SkipIsaAliasAperture (
- OUT UINT64 *Start,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- This function is used to skip ISA aliasing aperture
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Start - add argument and description to function comment
-// TODO: Length - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- UINT64 Original;
- UINT64 Mask;
- UINT64 StartOffset;
- UINT64 LimitOffset;
-
- //
- // For legacy ISA, bit 10 to bit 15 is not decoded
- //
- Mask = 0x3FF;
-
- Original = *Start;
- StartOffset = Original & Mask;
- LimitOffset = ((*Start) + Length - 1) & Mask;
-
- if (LimitOffset >= ISABASE) {
- *Start = *Start - StartOffset + ISALIMIT + 1;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InsertResourceNode (
- PCI_RESOURCE_NODE *Bridge,
- PCI_RESOURCE_NODE *ResNode
- )
-/*++
-
-Routine Description:
-
- This function inserts a resource node into the resource list.
- The resource list is sorted in descend order.
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: ResNode - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- LIST_ENTRY *CurrentLink;
- PCI_RESOURCE_NODE *Temp;
- UINT64 ResNodeAlignRest;
- UINT64 TempAlignRest;
-
- InsertHeadList (&Bridge->ChildList, &ResNode->Link);
-
- CurrentLink = Bridge->ChildList.ForwardLink->ForwardLink;
- while (CurrentLink != &Bridge->ChildList) {
- Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- if (ResNode->Alignment > Temp->Alignment) {
- break;
- } else if (ResNode->Alignment == Temp->Alignment) {
- ResNodeAlignRest = ResNode->Length & ResNode->Alignment;
- TempAlignRest = Temp->Length & Temp->Alignment;
- if ((ResNodeAlignRest == 0) || (ResNodeAlignRest >= TempAlignRest)) {
- break;
- }
- }
-
- SwapListEntries (&ResNode->Link, CurrentLink);
-
- CurrentLink = ResNode->Link.ForwardLink;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-MergeResourceTree (
- PCI_RESOURCE_NODE *Dst,
- PCI_RESOURCE_NODE *Res,
- BOOLEAN TypeMerge
- )
-/*++
-
-Routine Description:
-
- This routine is used to merge two different resource tree in need of
- resoure degradation. For example, if a upstream PPB doesn't support,
- prefetchable memory decoding, the PCI bus driver will choose to call this function
- to merge prefectchable memory resource list into normal memory list.
-
- If the TypeMerge is TRUE, Res resource type is changed to the type of destination resource
- type.
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Dst - add argument and description to function comment
-// TODO: Res - add argument and description to function comment
-// TODO: TypeMerge - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- LIST_ENTRY *CurrentLink;
- PCI_RESOURCE_NODE *Temp;
-
- while (!IsListEmpty (&Res->ChildList)) {
- CurrentLink = Res->ChildList.ForwardLink;
-
- Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- if (TypeMerge) {
- Temp->ResType = Dst->ResType;
- }
-
- RemoveEntryList (CurrentLink);
- InsertResourceNode (Dst, Temp);
-
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CalculateApertureIo16 (
- IN PCI_RESOURCE_NODE *Bridge
- )
-/*++
-
-Routine Description:
-
- This function is used to calculate the IO16 aperture
- for a bridge.
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- UINT64 Aperture;
- LIST_ENTRY *CurrentLink;
- PCI_RESOURCE_NODE *Node;
- UINT64 offset;
- BOOLEAN IsaEnable;
- BOOLEAN VGAEnable;
-
- //
- // Always assume there is ISA device and VGA device on the platform
- // will be customized later
- //
- IsaEnable = FALSE;
- VGAEnable = FALSE;
-
- if (FeaturePcdGet (PcdPciIsaEnable)){
- IsaEnable = TRUE;
- }
-
- if (FeaturePcdGet (PcdPciVgaEnable)){
- VGAEnable = TRUE;
- }
-
- Aperture = 0;
-
- if (!Bridge) {
- return EFI_SUCCESS;
- }
-
- CurrentLink = Bridge->ChildList.ForwardLink;
-
- //
- // Assume the bridge is aligned
- //
- while (CurrentLink != &Bridge->ChildList) {
-
- Node = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- //
- // Consider the aperture alignment
- //
- offset = Aperture & (Node->Alignment);
-
- if (offset) {
-
- Aperture = Aperture + (Node->Alignment + 1) - offset;
-
- }
-
- //
- // IsaEnable and VGAEnable can not be implemented now.
- // If both of them are enabled, then the IO resource would
- // become too limited to meet the requirement of most of devices.
- //
-
- if (IsaEnable || VGAEnable) {
- if (!IS_PCI_BRIDGE (&(Node->PciDev->Pci)) && !IS_CARDBUS_BRIDGE (&(Node->PciDev->Pci))) {
- //
- // Check if there is need to support ISA/VGA decoding
- // If so, we need to avoid isa/vga aliasing range
- //
- if (IsaEnable) {
- SkipIsaAliasAperture (
- &Aperture,
- Node->Length
- );
- offset = Aperture & (Node->Alignment);
- if (offset) {
- Aperture = Aperture + (Node->Alignment + 1) - offset;
- }
- } else if (VGAEnable) {
- SkipVGAAperture (
- &Aperture,
- Node->Length
- );
- offset = Aperture & (Node->Alignment);
- if (offset) {
- Aperture = Aperture + (Node->Alignment + 1) - offset;
- }
- }
- }
- }
-
- Node->Offset = Aperture;
-
- //
- // Increment aperture by the length of node
- //
- Aperture += Node->Length;
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- //
- // At last, adjust the aperture with the bridge's
- // alignment
- //
- offset = Aperture & (Bridge->Alignment);
-
- if (offset) {
- Aperture = Aperture + (Bridge->Alignment + 1) - offset;
- }
-
- Bridge->Length = Aperture;
- //
- // At last, adjust the bridge's alignment to the first child's alignment
- // if the bridge has at least one child
- //
- CurrentLink = Bridge->ChildList.ForwardLink;
- if (CurrentLink != &Bridge->ChildList) {
- Node = RESOURCE_NODE_FROM_LINK (CurrentLink);
- if (Node->Alignment > Bridge->Alignment) {
- Bridge->Alignment = Node->Alignment;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CalculateResourceAperture (
- IN PCI_RESOURCE_NODE *Bridge
- )
-/*++
-
-Routine Description:
-
- This function is used to calculate the resource aperture
- for a given bridge device
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- UINT64 Aperture;
- LIST_ENTRY *CurrentLink;
- PCI_RESOURCE_NODE *Node;
-
- UINT64 offset;
-
- Aperture = 0;
-
- if (!Bridge) {
- return EFI_SUCCESS;
- }
-
- if (Bridge->ResType == PciBarTypeIo16) {
- return CalculateApertureIo16 (Bridge);
- }
-
- CurrentLink = Bridge->ChildList.ForwardLink;
-
- //
- // Assume the bridge is aligned
- //
- while (CurrentLink != &Bridge->ChildList) {
-
- Node = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- //
- // Apply padding resource if available
- //
-
- offset = Aperture & (Node->Alignment);
-
- if (offset) {
-
- Aperture = Aperture + (Node->Alignment + 1) - offset;
-
- }
-
- //
- // Recode current aperture as a offset
- // this offset will be used in future real allocation
- //
- Node->Offset = Aperture;
-
- //
- // Increment aperture by the length of node
- //
- Aperture += Node->Length;
-
- //
- // Consider the aperture alignment
- //
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- //
- // At last, adjust the aperture with the bridge's
- // alignment
- //
- offset = Aperture & (Bridge->Alignment);
- if (offset) {
- Aperture = Aperture + (Bridge->Alignment + 1) - offset;
- }
-
- //
- // If the bridge has already padded the resource and the
- // amount of padded resource is larger, then keep the
- // padded resource
- //
- if (Bridge->Length < Aperture) {
- Bridge->Length = Aperture;
- }
-
- //
- // At last, adjust the bridge's alignment to the first child's alignment
- // if the bridge has at least one child
- //
- CurrentLink = Bridge->ChildList.ForwardLink;
- if (CurrentLink != &Bridge->ChildList) {
- Node = RESOURCE_NODE_FROM_LINK (CurrentLink);
- if (Node->Alignment > Bridge->Alignment) {
- Bridge->Alignment = Node->Alignment;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetResourceFromDevice (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciDev - add argument and description to function comment
-// TODO: IoNode - add argument and description to function comment
-// TODO: Mem32Node - add argument and description to function comment
-// TODO: PMem32Node - add argument and description to function comment
-// TODO: Mem64Node - add argument and description to function comment
-// TODO: PMem64Node - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- UINT8 Index;
- PCI_RESOURCE_NODE *Node;
- BOOLEAN ResourceRequested;
-
- Node = NULL;
- ResourceRequested = FALSE;
-
- for (Index = 0; Index < PCI_MAX_BAR; Index++) {
-
- switch ((PciDev->PciBar)[Index].BarType) {
-
- case PciBarTypeMem32:
-
- Node = CreateResourceNode (
- PciDev,
- (PciDev->PciBar)[Index].Length,
- (PciDev->PciBar)[Index].Alignment,
- Index,
- PciBarTypeMem32,
- PciResUsageTypical
- );
-
- InsertResourceNode (
- Mem32Node,
- Node
- );
-
- ResourceRequested = TRUE;
- break;
-
- case PciBarTypeMem64:
-
- Node = CreateResourceNode (
- PciDev,
- (PciDev->PciBar)[Index].Length,
- (PciDev->PciBar)[Index].Alignment,
- Index,
- PciBarTypeMem64,
- PciResUsageTypical
- );
-
- InsertResourceNode (
- Mem64Node,
- Node
- );
-
- ResourceRequested = TRUE;
- break;
-
- case PciBarTypePMem64:
-
- Node = CreateResourceNode (
- PciDev,
- (PciDev->PciBar)[Index].Length,
- (PciDev->PciBar)[Index].Alignment,
- Index,
- PciBarTypePMem64,
- PciResUsageTypical
- );
-
- InsertResourceNode (
- PMem64Node,
- Node
- );
-
- ResourceRequested = TRUE;
- break;
-
- case PciBarTypePMem32:
-
- Node = CreateResourceNode (
- PciDev,
- (PciDev->PciBar)[Index].Length,
- (PciDev->PciBar)[Index].Alignment,
- Index,
- PciBarTypePMem32,
- PciResUsageTypical
- );
-
- InsertResourceNode (
- PMem32Node,
- Node
- );
- ResourceRequested = TRUE;
- break;
-
- case PciBarTypeIo16:
- case PciBarTypeIo32:
-
- Node = CreateResourceNode (
- PciDev,
- (PciDev->PciBar)[Index].Length,
- (PciDev->PciBar)[Index].Alignment,
- Index,
- PciBarTypeIo16,
- PciResUsageTypical
- );
-
- InsertResourceNode (
- IoNode,
- Node
- );
- ResourceRequested = TRUE;
- break;
-
- case PciBarTypeUnknown:
- break;
-
- default:
- break;
- }
- }
-
- //
- // If there is no resource requested from this device,
- // then we indicate this device has been allocated naturally.
- //
- if (!ResourceRequested) {
- PciDev->Allocated = TRUE;
- }
-
- return EFI_SUCCESS;
-}
-
-PCI_RESOURCE_NODE *
-CreateResourceNode (
- IN PCI_IO_DEVICE *PciDev,
- IN UINT64 Length,
- IN UINT64 Alignment,
- IN UINT8 Bar,
- IN PCI_BAR_TYPE ResType,
- IN PCI_RESOURCE_USAGE ResUsage
- )
-/*++
-
-Routine Description:
-
- This function is used to create a resource node
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciDev - add argument and description to function comment
-// TODO: Length - add argument and description to function comment
-// TODO: Alignment - add argument and description to function comment
-// TODO: Bar - add argument and description to function comment
-// TODO: ResType - add argument and description to function comment
-// TODO: ResUsage - add argument and description to function comment
-{
- PCI_RESOURCE_NODE *Node;
-
- Node = NULL;
-
- Node = AllocatePool (sizeof (PCI_RESOURCE_NODE));
- if (Node == NULL) {
- return NULL;
- }
-
- ZeroMem (Node, sizeof (PCI_RESOURCE_NODE));
-
- Node->Signature = PCI_RESOURCE_SIGNATURE;
- Node->PciDev = PciDev;
- Node->Length = Length;
- Node->Alignment = Alignment;
- Node->Bar = Bar;
- Node->ResType = ResType;
- Node->Reserved = FALSE;
- Node->ResourceUsage = ResUsage;
- InitializeListHead (&Node->ChildList);
- return Node;
-}
-
-EFI_STATUS
-CreateResourceMap (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_RESOURCE_NODE *IoNode,
- IN PCI_RESOURCE_NODE *Mem32Node,
- IN PCI_RESOURCE_NODE *PMem32Node,
- IN PCI_RESOURCE_NODE *Mem64Node,
- IN PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
- This routine is used to extract resource request from
- device node list.
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: IoNode - add argument and description to function comment
-// TODO: Mem32Node - add argument and description to function comment
-// TODO: PMem32Node - add argument and description to function comment
-// TODO: Mem64Node - add argument and description to function comment
-// TODO: PMem64Node - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *Temp;
- PCI_RESOURCE_NODE *IoBridge;
- PCI_RESOURCE_NODE *Mem32Bridge;
- PCI_RESOURCE_NODE *PMem32Bridge;
- PCI_RESOURCE_NODE *Mem64Bridge;
- PCI_RESOURCE_NODE *PMem64Bridge;
- LIST_ENTRY *CurrentLink;
-
- CurrentLink = Bridge->ChildList.ForwardLink;
-
- while (CurrentLink && CurrentLink != &Bridge->ChildList) {
-
- Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
-
- //
- // Create resource nodes for this device by scanning the
- // Bar array in the device private data
- // If the upstream bridge doesn't support this device,
- // no any resource node will be created for this device
- //
- GetResourceFromDevice (
- Temp,
- IoNode,
- Mem32Node,
- PMem32Node,
- Mem64Node,
- PMem64Node
- );
-
- if (IS_PCI_BRIDGE (&Temp->Pci)) {
-
- //
- // If the device has children, create a bridge resource node for this PPB
- // Note: For PPB, memory aperture is aligned with 1MB and IO aperture
- // is aligned with 4KB
- // This device is typically a bridge device like PPB and P2C
- //
- IoBridge = CreateResourceNode (
- Temp,
- 0,
- 0xFFF,
- PPB_IO_RANGE,
- PciBarTypeIo16,
- PciResUsageTypical
- ); //0x1000 aligned
-
- Mem32Bridge = CreateResourceNode (
- Temp,
- 0,
- 0xFFFFF,
- PPB_MEM32_RANGE,
- PciBarTypeMem32,
- PciResUsageTypical
- );
-
- PMem32Bridge = CreateResourceNode (
- Temp,
- 0,
- 0xFFFFF,
- PPB_PMEM32_RANGE,
- PciBarTypePMem32,
- PciResUsageTypical
- );
-
- Mem64Bridge = CreateResourceNode (
- Temp,
- 0,
- 0xFFFFF,
- PPB_MEM64_RANGE,
- PciBarTypeMem64,
- PciResUsageTypical
- );
-
- PMem64Bridge = CreateResourceNode (
- Temp,
- 0,
- 0xFFFFF,
- PPB_PMEM64_RANGE,
- PciBarTypePMem64,
- PciResUsageTypical
- );
-
- //
- // Recursively create resouce map on this bridge
- //
- CreateResourceMap (
- Temp,
- IoBridge,
- Mem32Bridge,
- PMem32Bridge,
- Mem64Bridge,
- PMem64Bridge
- );
-
- if (ResourceRequestExisted (IoBridge)) {
- InsertResourceNode (
- IoNode,
- IoBridge
- );
- } else {
- gBS->FreePool (IoBridge);
- IoBridge = NULL;
- }
-
- //
- // If there is node under this resource bridge,
- // then calculate bridge's aperture of this type
- // and insert it into the respective resource tree.
- // If no, delete this resource bridge
- //
- if (ResourceRequestExisted (Mem32Bridge)) {
- InsertResourceNode (
- Mem32Node,
- Mem32Bridge
- );
- } else {
- gBS->FreePool (Mem32Bridge);
- Mem32Bridge = NULL;
- }
-
- //
- // If there is node under this resource bridge,
- // then calculate bridge's aperture of this type
- // and insert it into the respective resource tree.
- // If no, delete this resource bridge
- //
- if (ResourceRequestExisted (PMem32Bridge)) {
- InsertResourceNode (
- PMem32Node,
- PMem32Bridge
- );
- } else {
- gBS->FreePool (PMem32Bridge);
- PMem32Bridge = NULL;
- }
-
- //
- // If there is node under this resource bridge,
- // then calculate bridge's aperture of this type
- // and insert it into the respective resource tree.
- // If no, delete this resource bridge
- //
- if (ResourceRequestExisted (Mem64Bridge)) {
- InsertResourceNode (
- Mem64Node,
- Mem64Bridge
- );
- } else {
- gBS->FreePool (Mem64Bridge);
- Mem64Bridge = NULL;
- }
-
- //
- // If there is node under this resource bridge,
- // then calculate bridge's aperture of this type
- // and insert it into the respective resource tree.
- // If no, delete this resource bridge
- //
- if (ResourceRequestExisted (PMem64Bridge)) {
- InsertResourceNode (
- PMem64Node,
- PMem64Bridge
- );
- } else {
- gBS->FreePool (PMem64Bridge);
- PMem64Bridge = NULL;
- }
-
- }
-
- //
- // If it is P2C, apply hard coded resource padding
- //
- //
- if (IS_CARDBUS_BRIDGE (&Temp->Pci)) {
- ResourcePaddingForCardBusBridge (
- Temp,
- IoNode,
- Mem32Node,
- PMem32Node,
- Mem64Node,
- PMem64Node
- );
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
- //
- //
- // To do some platform specific resource padding ...
- //
- ResourcePaddingPolicy (
- Bridge,
- IoNode,
- Mem32Node,
- PMem32Node,
- Mem64Node,
- PMem64Node
- );
-
- //
- // Degrade resource if necessary
- //
- DegradeResource (
- Bridge,
- Mem32Node,
- PMem32Node,
- Mem64Node,
- PMem64Node
- );
-
- //
- // Calculate resource aperture for this bridge device
- //
- CalculateResourceAperture (Mem32Node);
- CalculateResourceAperture (PMem32Node);
- CalculateResourceAperture (Mem64Node);
- CalculateResourceAperture (PMem64Node);
- CalculateResourceAperture (IoNode);
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-ResourcePaddingPolicy (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
- This function is used to do the resource padding for a specific platform
-
-Arguments:
-
- PciDev - A pointer to the PCI_IO_DEVICE structrue.
- IoNode - A pointer to the PCI_RESOURCE_NODE structrue.
- Mem32Node - A pointer to the PCI_RESOURCE_NODE structrue.
- PMem32Node - A pointer to the PCI_RESOURCE_NODE structrue.
- Mem64Node - A pointer to the PCI_RESOURCE_NODE structrue.
- PMem64Node - A pointer to the PCI_RESOURCE_NODE structrue.
-
-Returns:
- Status code
-
- None
-
---*/
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- //
- // Create padding resource node
- //
- if (PciDev->ResourcePaddingDescriptors != NULL) {
- ApplyResourcePadding (
- PciDev,
- IoNode,
- Mem32Node,
- PMem32Node,
- Mem64Node,
- PMem64Node
- );
- }
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-DegradeResource (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_RESOURCE_NODE *Mem32Node,
- IN PCI_RESOURCE_NODE *PMem32Node,
- IN PCI_RESOURCE_NODE *Mem64Node,
- IN PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
- This function is used to degrade resource if the upstream bridge
- doesn't support certain resource. Degradation path is
- PMEM64 -> MEM64 -> MEM32
- PMEM64 -> PMEM32 -> MEM32
- IO32 -> IO16
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: Mem32Node - add argument and description to function comment
-// TODO: PMem32Node - add argument and description to function comment
-// TODO: Mem64Node - add argument and description to function comment
-// TODO: PMem64Node - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- //
- // If bridge doesn't support Prefetchable
- // memory64, degrade it to Prefetchable memory32
- //
- if (!BridgeSupportResourceDecode (Bridge, EFI_BRIDGE_PMEM64_DECODE_SUPPORTED)) {
- MergeResourceTree (
- PMem32Node,
- PMem64Node,
- TRUE
- );
- } else {
- //
- // if no PMem32 request, still keep PMem64. Otherwise degrade to PMem32
- //
- if (PMem32Node != NULL) {
- MergeResourceTree (
- PMem32Node,
- PMem64Node,
- TRUE
- );
- }
- }
-
-
- //
- // If bridge doesn't support Mem64
- // degrade it to mem32
- //
- if (!BridgeSupportResourceDecode (Bridge, EFI_BRIDGE_MEM64_DECODE_SUPPORTED)) {
- MergeResourceTree (
- Mem32Node,
- Mem64Node,
- TRUE
- );
- }
-
- //
- // If bridge doesn't support Pmem32
- // degrade it to mem32
- //
- if (!BridgeSupportResourceDecode (Bridge, EFI_BRIDGE_PMEM32_DECODE_SUPPORTED)) {
- MergeResourceTree (
- Mem32Node,
- PMem32Node,
- TRUE
- );
- }
-
- //
- // if bridge supports combined Pmem Mem decoding
- // merge these two type of resource
- //
- if (BridgeSupportResourceDecode (Bridge, EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED)) {
- MergeResourceTree (
- Mem32Node,
- PMem32Node,
- FALSE
- );
-
- MergeResourceTree (
- Mem64Node,
- PMem64Node,
- FALSE
- );
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-BridgeSupportResourceDecode (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT32 Decode
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- Decode - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- /*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
- if ((Bridge->Decodes) & Decode) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-ProgramResource (
- IN UINT64 Base,
- IN PCI_RESOURCE_NODE *Bridge
- )
-/*++
-
-Routine Description:
-
- This function is used to program the resource allocated
- for each resource node
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Base - add argument and description to function comment
-// TODO: Bridge - add argument and description to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- LIST_ENTRY *CurrentLink;
- PCI_RESOURCE_NODE *Node;
- EFI_STATUS Status;
-
- if (Base == gAllOne) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- CurrentLink = Bridge->ChildList.ForwardLink;
-
- while (CurrentLink != &Bridge->ChildList) {
-
- Node = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- if (!IS_PCI_BRIDGE (&(Node->PciDev->Pci))) {
-
- if (IS_CARDBUS_BRIDGE (&(Node->PciDev->Pci))) {
- ProgramP2C (Base, Node);
- } else {
- ProgramBar (Base, Node);
- }
- } else {
- Status = ProgramResource (Base + Node->Offset, Node);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ProgramPpbApperture (Base, Node);
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ProgramBar (
- IN UINT64 Base,
- IN PCI_RESOURCE_NODE *Node
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Base - add argument and description to function comment
-// TODO: Node - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT64 Address;
- UINT32 Address32;
-
- Address = 0;
- PciIo = &(Node->PciDev->PciIo);
-
- Address = Base + Node->Offset;
-
- //
- // Indicate pci bus driver has allocated
- // resource for this device
- // It might be a temporary solution here since
- // pci device could have multiple bar
- //
- Node->PciDev->Allocated = TRUE;
-
- switch ((Node->PciDev->PciBar[Node->Bar]).BarType) {
-
- case PciBarTypeIo16:
- case PciBarTypeIo32:
- case PciBarTypeMem32:
- case PciBarTypePMem32:
-
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- (Node->PciDev->PciBar[Node->Bar]).Offset,
- 1,
- &Address
- );
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
-
- break;
-
- case PciBarTypeMem64:
- case PciBarTypePMem64:
-
- Address32 = (UINT32) (Address & 0x00000000FFFFFFFF);
-
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- (Node->PciDev->PciBar[Node->Bar]).Offset,
- 1,
- &Address32
- );
-
- Address32 = (UINT32) RShiftU64 (Address, 32);
-
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- (UINT8) ((Node->PciDev->PciBar[Node->Bar]).Offset + 4),
- 1,
- &Address32
- );
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
-
- break;
-
- default:
- break;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ProgramPpbApperture (
- IN UINT64 Base,
- IN PCI_RESOURCE_NODE *Node
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Base - add argument and description to function comment
-// TODO: Node - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT64 Address;
- UINT32 Address32;
-
- Address = 0;
- //
- // if no device south of this PPB, return anyway
- // Apperture is set default in the initialization code
- //
- if (Node->Length == 0 || Node->ResourceUsage == PciResUsagePadding) {
- //
- // For padding resource node, just ignore when programming
- //
- return EFI_SUCCESS;
- }
-
- PciIo = &(Node->PciDev->PciIo);
- Address = Base + Node->Offset;
-
- //
- // Indicate the PPB resource has been allocated
- //
- Node->PciDev->Allocated = TRUE;
-
- switch (Node->Bar) {
-
- case PPB_BAR_0:
- case PPB_BAR_1:
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- (Node->PciDev->PciBar[Node->Bar]).Offset,
- 1,
- &Address
- );
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
- Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
-
- break;
-
- case PPB_IO_RANGE:
-
- Address32 = ((UINT32) (Address)) >> 8;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint8,
- 0x1C,
- 1,
- &Address32
- );
-
- Address32 >>= 8;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x30,
- 1,
- &Address32
- );
-
- Address32 = (UINT32) (Address + Node->Length - 1);
- Address32 = ((UINT32) (Address32)) >> 8;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint8,
- 0x1D,
- 1,
- &Address32
- );
-
- Address32 >>= 8;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x32,
- 1,
- &Address32
- );
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
- Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
- break;
-
- case PPB_MEM32_RANGE:
-
- Address32 = ((UINT32) (Address)) >> 16;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x20,
- 1,
- &Address32
- );
-
- Address32 = (UINT32) (Address + Node->Length - 1);
- Address32 = ((UINT32) (Address32)) >> 16;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x22,
- 1,
- &Address32
- );
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
- Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
- break;
-
- case PPB_PMEM32_RANGE:
- case PPB_PMEM64_RANGE:
-
- Address32 = ((UINT32) (Address)) >> 16;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x24,
- 1,
- &Address32
- );
-
- Address32 = (UINT32) (Address + Node->Length - 1);
- Address32 = ((UINT32) (Address32)) >> 16;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x26,
- 1,
- &Address32
- );
-
- Address32 = (UINT32) RShiftU64 (Address, 32);
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x28,
- 1,
- &Address32
- );
-
- Address32 = (UINT32) RShiftU64 ((Address + Node->Length - 1), 32);
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x2C,
- 1,
- &Address32
- );
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
- Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
- break;
-
- default:
- break;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ProgrameUpstreamBridgeForRom (
- IN PCI_IO_DEVICE *PciDevice,
- IN UINT32 OptionRomBase,
- IN BOOLEAN Enable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-// TODO: PciDevice - add argument and description to function comment
-// TODO: OptionRomBase - add argument and description to function comment
-// TODO: Enable - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_IO_DEVICE *Parent;
- PCI_RESOURCE_NODE Node;
- //
- // For root bridge, just return.
- //
- Parent = PciDevice->Parent;
- ZeroMem (&Node, sizeof (Node));
- while (Parent) {
- if (!IS_PCI_BRIDGE (&Parent->Pci)) {
- break;
- }
-
- Node.PciDev = Parent;
- Node.Length = PciDevice->RomSize;
- Node.Alignment = 0;
- Node.Bar = PPB_MEM32_RANGE;
- Node.ResType = PciBarTypeMem32;
- Node.Offset = 0;
-
- //
- // Program PPB to only open a single <= 16<MB apperture
- //
- if (Enable) {
- ProgramPpbApperture (OptionRomBase, &Node);
- PciEnableCommandRegister (Parent, EFI_PCI_COMMAND_MEMORY_SPACE);
- } else {
- InitializePpb (Parent);
- PciDisableCommandRegister (Parent, EFI_PCI_COMMAND_MEMORY_SPACE);
- }
-
- Parent = Parent->Parent;
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-ResourceRequestExisted (
- IN PCI_RESOURCE_NODE *Bridge
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- Bridge - A pointer to the PCI_RESOURCE_NODE.
-
-Returns:
-
- None
-
---*/
-{
- if (Bridge != NULL) {
- if (!IsListEmpty (&Bridge->ChildList) || Bridge->Length != 0) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-InitializeResourcePool (
- PCI_RESOURCE_NODE *ResourcePool,
- PCI_BAR_TYPE ResourceType
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: ResourcePool - add argument and description to function comment
-// TODO: ResourceType - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- ZeroMem (ResourcePool, sizeof (PCI_RESOURCE_NODE));
- ResourcePool->ResType = ResourceType;
- ResourcePool->Signature = PCI_RESOURCE_SIGNATURE;
- InitializeListHead (&ResourcePool->ChildList);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetResourceMap (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE **IoBridge,
- PCI_RESOURCE_NODE **Mem32Bridge,
- PCI_RESOURCE_NODE **PMem32Bridge,
- PCI_RESOURCE_NODE **Mem64Bridge,
- PCI_RESOURCE_NODE **PMem64Bridge,
- PCI_RESOURCE_NODE *IoPool,
- PCI_RESOURCE_NODE *Mem32Pool,
- PCI_RESOURCE_NODE *PMem32Pool,
- PCI_RESOURCE_NODE *Mem64Pool,
- PCI_RESOURCE_NODE *PMem64Pool
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciDev - add argument and description to function comment
-// TODO: IoBridge - add argument and description to function comment
-// TODO: Mem32Bridge - add argument and description to function comment
-// TODO: PMem32Bridge - add argument and description to function comment
-// TODO: Mem64Bridge - add argument and description to function comment
-// TODO: PMem64Bridge - add argument and description to function comment
-// TODO: IoPool - add argument and description to function comment
-// TODO: Mem32Pool - add argument and description to function comment
-// TODO: PMem32Pool - add argument and description to function comment
-// TODO: Mem64Pool - add argument and description to function comment
-// TODO: PMem64Pool - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
-
- PCI_RESOURCE_NODE *Temp;
- LIST_ENTRY *CurrentLink;
-
- CurrentLink = IoPool->ChildList.ForwardLink;
-
- //
- // Get Io resource map
- //
- while (CurrentLink != &IoPool->ChildList) {
-
- Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- if (Temp->PciDev == PciDev) {
- *IoBridge = Temp;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- //
- // Get Mem32 resource map
- //
- CurrentLink = Mem32Pool->ChildList.ForwardLink;
-
- while (CurrentLink != &Mem32Pool->ChildList) {
-
- Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- if (Temp->PciDev == PciDev) {
- *Mem32Bridge = Temp;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- //
- // Get Pmem32 resource map
- //
- CurrentLink = PMem32Pool->ChildList.ForwardLink;
-
- while (CurrentLink != &PMem32Pool->ChildList) {
-
- Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- if (Temp->PciDev == PciDev) {
- *PMem32Bridge = Temp;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- //
- // Get Mem64 resource map
- //
- CurrentLink = Mem64Pool->ChildList.ForwardLink;
-
- while (CurrentLink != &Mem64Pool->ChildList) {
-
- Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- if (Temp->PciDev == PciDev) {
- *Mem64Bridge = Temp;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- //
- // Get Pmem64 resource map
- //
- CurrentLink = PMem64Pool->ChildList.ForwardLink;
-
- while (CurrentLink != &PMem64Pool->ChildList) {
-
- Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- if (Temp->PciDev == PciDev) {
- *PMem64Bridge = Temp;
- }
-
- CurrentLink = CurrentLink->ForwardLink;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DestroyResourceTree (
- IN PCI_RESOURCE_NODE *Bridge
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Bridge - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_RESOURCE_NODE *Temp;
- LIST_ENTRY *CurrentLink;
-
- while (!IsListEmpty (&Bridge->ChildList)) {
-
- CurrentLink = Bridge->ChildList.ForwardLink;
-
- Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
-
- RemoveEntryList (CurrentLink);
-
- if (IS_PCI_BRIDGE (&(Temp->PciDev->Pci))) {
- DestroyResourceTree (Temp);
- }
-
- gBS->FreePool (Temp);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-RecordReservedResource (
- IN UINT64 Base,
- IN UINT64 Length,
- IN PCI_BAR_TYPE ResType,
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Base - add argument and description to function comment
-// TODO: Length - add argument and description to function comment
-// TODO: ResType - add argument and description to function comment
-// TODO: Bridge - add argument and description to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_RESERVED_RESOURCE_LIST *ReservedNode;
-
- ReservedNode = AllocatePool (sizeof (PCI_RESERVED_RESOURCE_LIST));
- if (ReservedNode == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- ReservedNode->Signature = RESERVED_RESOURCE_SIGNATURE;
- ReservedNode->Node.Base = Base;
- ReservedNode->Node.Length = Length;
- ReservedNode->Node.ResType = ResType;
-
- InsertTailList (&Bridge->ReservedResourceList, &(ReservedNode->Link));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ResourcePaddingForCardBusBridge (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciDev - add argument and description to function comment
-// TODO: IoNode - add argument and description to function comment
-// TODO: Mem32Node - add argument and description to function comment
-// TODO: PMem32Node - add argument and description to function comment
-// TODO: Mem64Node - add argument and description to function comment
-// TODO: PMem64Node - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- PCI_RESOURCE_NODE *Node;
-
- Node = NULL;
-
- //
- // Memory Base/Limit Register 0
- // Bar 1 denodes memory range 0
- //
- Node = CreateResourceNode (
- PciDev,
- 0x2000000,
- 0x1ffffff,
- 1,
- PciBarTypeMem32,
- PciResUsagePadding
- );
-
- InsertResourceNode (
- Mem32Node,
- Node
- );
-
- //
- // Memory Base/Limit Register 1
- // Bar 2 denodes memory range1
- //
- Node = CreateResourceNode (
- PciDev,
- 0x2000000,
- 0x1ffffff,
- 2,
- PciBarTypePMem32,
- PciResUsagePadding
- );
-
- InsertResourceNode (
- PMem32Node,
- Node
- );
-
- //
- // Io Base/Limit
- // Bar 3 denodes io range 0
- //
- Node = CreateResourceNode (
- PciDev,
- 0x100,
- 0xff,
- 3,
- PciBarTypeIo16,
- PciResUsagePadding
- );
-
- InsertResourceNode (
- IoNode,
- Node
- );
-
- //
- // Io Base/Limit
- // Bar 4 denodes io range 0
- //
- Node = CreateResourceNode (
- PciDev,
- 0x100,
- 0xff,
- 4,
- PciBarTypeIo16,
- PciResUsagePadding
- );
-
- InsertResourceNode (
- IoNode,
- Node
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ProgramP2C (
- IN UINT64 Base,
- IN PCI_RESOURCE_NODE *Node
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: Base - add argument and description to function comment
-// TODO: Node - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT64 Address;
- UINT64 TempAddress;
- UINT16 BridgeControl;
-
- Address = 0;
- PciIo = &(Node->PciDev->PciIo);
-
- Address = Base + Node->Offset;
-
- //
- // Indicate pci bus driver has allocated
- // resource for this device
- // It might be a temporary solution here since
- // pci device could have multiple bar
- //
- Node->PciDev->Allocated = TRUE;
-
- switch (Node->Bar) {
-
- case P2C_BAR_0:
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- (Node->PciDev->PciBar[Node->Bar]).Offset,
- 1,
- &Address
- );
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
- Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
- break;
-
- case P2C_MEM_1:
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x1c,
- 1,
- &Address
- );
-
- TempAddress = Address + Node->Length - 1;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x20,
- 1,
- &TempAddress
- );
-
- if (Node->ResType == PciBarTypeMem32) {
-
- //
- // Set non-prefetchable bit
- //
- PciIoRead (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
-
- BridgeControl &= 0xfeff;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
-
- } else {
-
- //
- // Set pre-fetchable bit
- //
- PciIoRead (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
-
- BridgeControl |= 0x0100;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
- }
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
- Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
- Node->PciDev->PciBar[Node->Bar].BarType = Node->ResType;
-
- break;
-
- case P2C_MEM_2:
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x24,
- 1,
- &Address
- );
-
- TempAddress = Address + Node->Length - 1;
-
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x28,
- 1,
- &TempAddress
- );
-
- if (Node->ResType == PciBarTypeMem32) {
-
- //
- // Set non-prefetchable bit
- //
- PciIoRead (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
-
- BridgeControl &= 0xfdff;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
- } else {
-
- //
- // Set pre-fetchable bit
- //
- PciIoRead (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
-
- BridgeControl |= 0x0200;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint16,
- 0x3e,
- 1,
- &BridgeControl
- );
- }
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
- Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
- Node->PciDev->PciBar[Node->Bar].BarType = Node->ResType;
- break;
-
- case P2C_IO_1:
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x2c,
- 1,
- &Address
- );
- TempAddress = Address + Node->Length - 1;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x30,
- 1,
- &TempAddress
- );
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
- Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
- Node->PciDev->PciBar[Node->Bar].BarType = Node->ResType;
-
- break;
-
- case P2C_IO_2:
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x34,
- 1,
- &Address
- );
-
- TempAddress = Address + Node->Length - 1;
- PciIoWrite (
- PciIo,
- EfiPciIoWidthUint32,
- 0x38,
- 1,
- &TempAddress
- );
-
- Node->PciDev->PciBar[Node->Bar].BaseAddress = Address;
- Node->PciDev->PciBar[Node->Bar].Length = Node->Length;
- Node->PciDev->PciBar[Node->Bar].BarType = Node->ResType;
- break;
-
- default:
- break;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ApplyResourcePadding (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-// TODO: PciDev - add argument and description to function comment
-// TODO: IoNode - add argument and description to function comment
-// TODO: Mem32Node - add argument and description to function comment
-// TODO: PMem32Node - add argument and description to function comment
-// TODO: Mem64Node - add argument and description to function comment
-// TODO: PMem64Node - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
- PCI_RESOURCE_NODE *Node;
- UINT8 DummyBarIndex;
-
- DummyBarIndex = 0;
- Ptr = PciDev->ResourcePaddingDescriptors;
-
- while (((EFI_ACPI_END_TAG_DESCRIPTOR *) Ptr)->Desc != ACPI_END_TAG_DESCRIPTOR) {
-
- if (Ptr->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR && Ptr->ResType == ACPI_ADDRESS_SPACE_TYPE_IO) {
- if (Ptr->AddrLen != 0) {
-
- Node = CreateResourceNode (
- PciDev,
- Ptr->AddrLen,
- Ptr->AddrRangeMax,
- DummyBarIndex,
- PciBarTypeIo16,
- PciResUsagePadding
- );
- InsertResourceNode (
- IoNode,
- Node
- );
- }
-
- Ptr++;
- continue;
- }
-
- if (Ptr->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR && Ptr->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) {
-
- if (Ptr->AddrSpaceGranularity == 32) {
-
- //
- // prefechable
- //
- if (Ptr->SpecificFlag == 0x6) {
- if (Ptr->AddrLen) {
- Node = CreateResourceNode (
- PciDev,
- Ptr->AddrLen,
- Ptr->AddrRangeMax,
- DummyBarIndex,
- PciBarTypePMem32,
- PciResUsagePadding
- );
- InsertResourceNode (
- PMem32Node,
- Node
- );
- }
-
- Ptr++;
- continue;
- }
-
- //
- // Non-prefechable
- //
- if (Ptr->SpecificFlag == 0) {
- if (Ptr->AddrLen) {
- Node = CreateResourceNode (
- PciDev,
- Ptr->AddrLen,
- Ptr->AddrRangeMax,
- DummyBarIndex,
- PciBarTypeMem32,
- PciResUsagePadding
- );
- InsertResourceNode (
- Mem32Node,
- Node
- );
- }
-
- Ptr++;
- continue;
- }
- }
-
- if (Ptr->AddrSpaceGranularity == 64) {
-
- //
- // prefechable
- //
- if (Ptr->SpecificFlag == 0x6) {
- if (Ptr->AddrLen) {
- Node = CreateResourceNode (
- PciDev,
- Ptr->AddrLen,
- Ptr->AddrRangeMax,
- DummyBarIndex,
- PciBarTypePMem64,
- PciResUsagePadding
- );
- InsertResourceNode (
- PMem64Node,
- Node
- );
- }
-
- Ptr++;
- continue;
- }
-
- //
- // Non-prefechable
- //
- if (Ptr->SpecificFlag == 0) {
- if (Ptr->AddrLen) {
- Node = CreateResourceNode (
- PciDev,
- Ptr->AddrLen,
- Ptr->AddrRangeMax,
- DummyBarIndex,
- PciBarTypeMem64,
- PciResUsagePadding
- );
- InsertResourceNode (
- Mem64Node,
- Node
- );
- }
-
- Ptr++;
- continue;
- }
- }
- }
-
- Ptr++;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// Light PCI bus driver woundn't support hotplug root device
-// So no need to pad resource for them
-//
-VOID
-GetResourcePaddingPpb (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- Get resource.
-
-Arguments:
-
- PciIoDevice A pointer to a pci device.
-
-Returns:
-
- None
-
---*/
-{
- if (gPciHotPlugInit) {
- if (PciIoDevice->ResourcePaddingDescriptors == NULL) {
- GetResourcePaddingForHpb (PciIoDevice);
- }
- }
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.h
deleted file mode 100644
index 61ec29f..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciResourceSupport.h
+++ /dev/null
@@ -1,740 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciResourceSupport.h
-
-Abstract:
-
-
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_RESOURCE_SUPPORT_H
-#define _EFI_PCI_RESOURCE_SUPPORT_H
-
-#define RESERVED_RESOURCE_SIGNATURE EFI_SIGNATURE_32 ('r', 's', 'v', 'd')
-
-typedef struct {
- UINT64 Base;
- UINT64 Length;
- PCI_BAR_TYPE ResType;
-} PCI_RESERVED_RESOURCE_NODE;
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- PCI_RESERVED_RESOURCE_NODE Node;
-} PCI_RESERVED_RESOURCE_LIST;
-
-#define RESOURCED_LIST_FROM_NODE(a) \
- CR (a, PCI_RESERVED_RESOURCE_LIST, Node, RESERVED_RESOURCE_SIGNATURE)
-
-#define RESOURCED_LIST_FROM_LINK(a) \
- CR (a, PCI_RESERVED_RESOURCE_LIST, Link, RESERVED_RESOURCE_SIGNATURE)
-
-typedef enum {
- PciResUsageTypical = 0,
- PciResUsagePadding,
- PciResUsageOptionRomProcessing
-} PCI_RESOURCE_USAGE;
-
-#define PCI_RESOURCE_SIGNATURE EFI_SIGNATURE_32 ('p', 'c', 'r', 'c')
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- LIST_ENTRY ChildList;
- PCI_IO_DEVICE *PciDev;
- UINT64 Alignment;
- UINT64 Offset;
- UINT8 Bar;
- PCI_BAR_TYPE ResType;
- UINT64 Length;
- BOOLEAN Reserved;
- PCI_RESOURCE_USAGE ResourceUsage;
-} PCI_RESOURCE_NODE;
-
-#define RESOURCE_NODE_FROM_LINK(a) \
- CR (a, PCI_RESOURCE_NODE, Link, PCI_RESOURCE_SIGNATURE)
-
-EFI_STATUS
-SkipVGAAperture (
- OUT UINT64 *Start,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Start - TODO: add argument description
- Length - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SkipIsaAliasAperture (
- OUT UINT64 *Start,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Start - TODO: add argument description
- Length - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-InsertResourceNode (
- PCI_RESOURCE_NODE *Bridge,
- PCI_RESOURCE_NODE *ResNode
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- ResNode - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-MergeResourceTree (
- PCI_RESOURCE_NODE *Dst,
- PCI_RESOURCE_NODE *Res,
- BOOLEAN TypeMerge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Dst - TODO: add argument description
- Res - TODO: add argument description
- TypeMerge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-CalculateApertureIo16 (
- IN PCI_RESOURCE_NODE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-CalculateResourceAperture (
- IN PCI_RESOURCE_NODE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GetResourceFromDevice (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDev - TODO: add argument description
- IoNode - TODO: add argument description
- Mem32Node - TODO: add argument description
- PMem32Node - TODO: add argument description
- Mem64Node - TODO: add argument description
- PMem64Node - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-PCI_RESOURCE_NODE *
-CreateResourceNode (
- IN PCI_IO_DEVICE *PciDev,
- IN UINT64 Length,
- IN UINT64 Alignment,
- IN UINT8 Bar,
- IN PCI_BAR_TYPE ResType,
- IN PCI_RESOURCE_USAGE ResUsage
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDev - TODO: add argument description
- Length - TODO: add argument description
- Alignment - TODO: add argument description
- Bar - TODO: add argument description
- ResType - TODO: add argument description
- ResUsage - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-CreateResourceMap (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_RESOURCE_NODE *IoNode,
- IN PCI_RESOURCE_NODE *Mem32Node,
- IN PCI_RESOURCE_NODE *PMem32Node,
- IN PCI_RESOURCE_NODE *Mem64Node,
- IN PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- IoNode - TODO: add argument description
- Mem32Node - TODO: add argument description
- PMem32Node - TODO: add argument description
- Mem64Node - TODO: add argument description
- PMem64Node - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ResourcePaddingPolicy (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDev - TODO: add argument description
- IoNode - TODO: add argument description
- Mem32Node - TODO: add argument description
- PMem32Node - TODO: add argument description
- Mem64Node - TODO: add argument description
- PMem64Node - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-DegradeResource (
- IN PCI_IO_DEVICE *Bridge,
- IN PCI_RESOURCE_NODE *Mem32Node,
- IN PCI_RESOURCE_NODE *PMem32Node,
- IN PCI_RESOURCE_NODE *Mem64Node,
- IN PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- Mem32Node - TODO: add argument description
- PMem32Node - TODO: add argument description
- Mem64Node - TODO: add argument description
- PMem64Node - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-BridgeSupportResourceDecode (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT32 Decode
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
- Decode - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ProgramResource (
- IN UINT64 Base,
- IN PCI_RESOURCE_NODE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Base - TODO: add argument description
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ProgramBar (
- IN UINT64 Base,
- IN PCI_RESOURCE_NODE *Node
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Base - TODO: add argument description
- Node - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ProgramPpbApperture (
- IN UINT64 Base,
- IN PCI_RESOURCE_NODE *Node
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Base - TODO: add argument description
- Node - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ProgrameUpstreamBridgeForRom (
- IN PCI_IO_DEVICE *PciDevice,
- IN UINT32 OptionRomBase,
- IN BOOLEAN Enable
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDevice - TODO: add argument description
- OptionRomBase - TODO: add argument description
- Enable - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-ResourceRequestExisted (
- IN PCI_RESOURCE_NODE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-InitializeResourcePool (
- PCI_RESOURCE_NODE *ResourcePool,
- PCI_BAR_TYPE ResourceType
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ResourcePool - TODO: add argument description
- ResourceType - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GetResourceMap (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE **IoBridge,
- PCI_RESOURCE_NODE **Mem32Bridge,
- PCI_RESOURCE_NODE **PMem32Bridge,
- PCI_RESOURCE_NODE **Mem64Bridge,
- PCI_RESOURCE_NODE **PMem64Bridge,
- PCI_RESOURCE_NODE *IoPool,
- PCI_RESOURCE_NODE *Mem32Pool,
- PCI_RESOURCE_NODE *PMem32Pool,
- PCI_RESOURCE_NODE *Mem64Pool,
- PCI_RESOURCE_NODE *PMem64Pool
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDev - TODO: add argument description
- IoBridge - TODO: add argument description
- Mem32Bridge - TODO: add argument description
- PMem32Bridge - TODO: add argument description
- Mem64Bridge - TODO: add argument description
- PMem64Bridge - TODO: add argument description
- IoPool - TODO: add argument description
- Mem32Pool - TODO: add argument description
- PMem32Pool - TODO: add argument description
- Mem64Pool - TODO: add argument description
- PMem64Pool - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-DestroyResourceTree (
- IN PCI_RESOURCE_NODE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-RecordReservedResource (
- IN UINT64 Base,
- IN UINT64 Length,
- IN PCI_BAR_TYPE ResType,
- IN PCI_IO_DEVICE *Bridge
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Base - TODO: add argument description
- Length - TODO: add argument description
- ResType - TODO: add argument description
- Bridge - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ResourcePaddingForCardBusBridge (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDev - TODO: add argument description
- IoNode - TODO: add argument description
- Mem32Node - TODO: add argument description
- PMem32Node - TODO: add argument description
- Mem64Node - TODO: add argument description
- PMem64Node - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ProgramP2C (
- IN UINT64 Base,
- IN PCI_RESOURCE_NODE *Node
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- Base - TODO: add argument description
- Node - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ApplyResourcePadding (
- PCI_IO_DEVICE *PciDev,
- PCI_RESOURCE_NODE *IoNode,
- PCI_RESOURCE_NODE *Mem32Node,
- PCI_RESOURCE_NODE *PMem32Node,
- PCI_RESOURCE_NODE *Mem64Node,
- PCI_RESOURCE_NODE *PMem64Node
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciDev - TODO: add argument description
- IoNode - TODO: add argument description
- Mem32Node - TODO: add argument description
- PMem32Node - TODO: add argument description
- Mem64Node - TODO: add argument description
- PMem64Node - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-GetResourcePaddingPpb (
- IN PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ResetAllPpbBusReg (
- IN PCI_IO_DEVICE *Bridge,
- IN UINT8 StartBusNumber
- )
-/*++
-
-Routine Description:
-
- Reset bus register
-
-Arguments:
-
- Bridge - a pointer to the PCI_IO_DEVICE
- StartBusNumber - the number of bus
-
-Returns:
-
- None
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.c
deleted file mode 100644
index 01249d4..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciRomTable.c
-
-Abstract:
-
- Option Rom Support for PCI Bus Driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-#include "PciRomTable.h"
-
-typedef struct {
- EFI_HANDLE ImageHandle;
- UINTN Seg;
- UINT8 Bus;
- UINT8 Dev;
- UINT8 Func;
- UINT64 RomAddress;
- UINT64 RomLength;
-} EFI_PCI_ROM_IMAGE_MAPPING;
-
-static UINTN mNumberOfPciRomImages = 0;
-static UINTN mMaxNumberOfPciRomImages = 0;
-static EFI_PCI_ROM_IMAGE_MAPPING *mRomImageTable = NULL;
-
-VOID
-PciRomAddImageMapping (
- IN EFI_HANDLE ImageHandle,
- IN UINTN Seg,
- IN UINT8 Bus,
- IN UINT8 Dev,
- IN UINT8 Func,
- IN UINT64 RomAddress,
- IN UINT64 RomLength
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- Seg - TODO: add argument description
- Bus - TODO: add argument description
- Dev - TODO: add argument description
- Func - TODO: add argument description
- RomAddress - TODO: add argument description
- RomLength - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_PCI_ROM_IMAGE_MAPPING *TempMapping;
-
- if (mNumberOfPciRomImages >= mMaxNumberOfPciRomImages) {
-
- mMaxNumberOfPciRomImages += 0x20;
-
- TempMapping = NULL;
- TempMapping = AllocatePool (mMaxNumberOfPciRomImages * sizeof (EFI_PCI_ROM_IMAGE_MAPPING));
- if (TempMapping == NULL) {
- return ;
- }
-
- CopyMem (TempMapping, mRomImageTable, mNumberOfPciRomImages * sizeof (EFI_PCI_ROM_IMAGE_MAPPING));
-
- if (mRomImageTable != NULL) {
- gBS->FreePool (mRomImageTable);
- }
-
- mRomImageTable = TempMapping;
- }
-
- mRomImageTable[mNumberOfPciRomImages].ImageHandle = ImageHandle;
- mRomImageTable[mNumberOfPciRomImages].Seg = Seg;
- mRomImageTable[mNumberOfPciRomImages].Bus = Bus;
- mRomImageTable[mNumberOfPciRomImages].Dev = Dev;
- mRomImageTable[mNumberOfPciRomImages].Func = Func;
- mRomImageTable[mNumberOfPciRomImages].RomAddress = RomAddress;
- mRomImageTable[mNumberOfPciRomImages].RomLength = RomLength;
- mNumberOfPciRomImages++;
-}
-
-EFI_STATUS
-PciRomGetRomResourceFromPciOptionRomTable (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: PciRootBridgeIo - add argument and description to function comment
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_PCI_OPTION_ROM_TABLE *PciOptionRomTable;
- EFI_PCI_OPTION_ROM_DESCRIPTOR *PciOptionRomDescriptor;
- UINTN Index;
-
- Status = EfiGetSystemConfigurationTable (&gEfiPciOptionRomTableGuid, (VOID **) &PciOptionRomTable);
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- for (Index = 0; Index < PciOptionRomTable->PciOptionRomCount; Index++) {
- PciOptionRomDescriptor = &PciOptionRomTable->PciOptionRomDescriptors[Index];
- if (PciOptionRomDescriptor->Seg == PciRootBridgeIo->SegmentNumber &&
- PciOptionRomDescriptor->Bus == PciIoDevice->BusNumber &&
- PciOptionRomDescriptor->Dev == PciIoDevice->DeviceNumber &&
- PciOptionRomDescriptor->Func == PciIoDevice->FunctionNumber ) {
-
- PciIoDevice->PciIo.RomImage = (VOID *) (UINTN) PciOptionRomDescriptor->RomAddress;
- PciIoDevice->PciIo.RomSize = (UINTN) PciOptionRomDescriptor->RomLength;
- }
- }
-
- for (Index = 0; Index < mNumberOfPciRomImages; Index++) {
- if (mRomImageTable[Index].Seg == PciRootBridgeIo->SegmentNumber &&
- mRomImageTable[Index].Bus == PciIoDevice->BusNumber &&
- mRomImageTable[Index].Dev == PciIoDevice->DeviceNumber &&
- mRomImageTable[Index].Func == PciIoDevice->FunctionNumber ) {
-
- AddDriver (PciIoDevice, mRomImageTable[Index].ImageHandle);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PciRomGetImageMapping (
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-// TODO: PciIoDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- UINTN Index;
-
- PciRootBridgeIo = PciIoDevice->PciRootBridgeIo;
-
- for (Index = 0; Index < mNumberOfPciRomImages; Index++) {
- if (mRomImageTable[Index].Seg == PciRootBridgeIo->SegmentNumber &&
- mRomImageTable[Index].Bus == PciIoDevice->BusNumber &&
- mRomImageTable[Index].Dev == PciIoDevice->DeviceNumber &&
- mRomImageTable[Index].Func == PciIoDevice->FunctionNumber ) {
-
- if (mRomImageTable[Index].ImageHandle != NULL) {
- AddDriver (PciIoDevice, mRomImageTable[Index].ImageHandle);
- } else {
- PciIoDevice->PciIo.RomImage = (VOID *) (UINTN) mRomImageTable[Index].RomAddress;
- PciIoDevice->PciIo.RomSize = (UINTN) mRomImageTable[Index].RomLength;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.h
deleted file mode 100644
index bb20c70..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciRomTable.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciRomTable.h
-
-Abstract:
-
- Option Rom Support for PCI Bus Driver
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_ROM_TABLE_H
-#define _EFI_PCI_ROM_TABLE_H
-
-VOID
-PciRomAddImageMapping (
- IN EFI_HANDLE ImageHandle,
- IN UINTN Seg,
- IN UINT8 Bus,
- IN UINT8 Dev,
- IN UINT8 Func,
- IN UINT64 RomAddress,
- IN UINT64 RomLength
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
- Seg - TODO: add argument description
- Bus - TODO: add argument description
- Dev - TODO: add argument description
- Func - TODO: add argument description
- RomAddress - TODO: add argument description
- RomLength - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-
-EFI_STATUS
-PciRomGetRomResourceFromPciOptionRomTable (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- PciRootBridgeIo - TODO: add argument description
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-PciRomGetImageMapping (
- PCI_IO_DEVICE *PciIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PciIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c
deleted file mode 100644
index a874b8a..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciBus.c
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#include "pcibus.h"
-
-//
-// PCI Bus Driver Global Variables
-//
-
-EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding = {
- PciBusDriverBindingSupported,
- PciBusDriverBindingStart,
- PciBusDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_HANDLE gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];
-UINTN gPciHostBridgeNumber;
-BOOLEAN gFullEnumeration;
-UINT64 gAllOne = 0xFFFFFFFFFFFFFFFFULL;
-UINT64 gAllZero = 0;
-
-EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;
-
-//
-// PCI Bus Driver Support Functions
-//
-EFI_STATUS
-EFIAPI
-PciBusEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Initialize the global variables
- publish the driver binding protocol
-
-Arguments:
-
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
-
-Returns:
-
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-// TODO: ImageHandle - add argument and description to function comment
-// TODO: SystemTable - add argument and description to function comment
-{
- EFI_STATUS Status;
-
- InitializePciDevicePool ();
-
- gFullEnumeration = TRUE;
-
- gPciHostBridgeNumber = 0;
-
- InstallHotPlugRequestProtocol (&Status);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PciBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- Check to see if pci bus driver supports the given controller
-
-Arguments:
-
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Controller - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- EFI_DEV_PATH_PTR Node;
-
- if (RemainingDevicePath != NULL) {
- Node.DevPath = RemainingDevicePath;
- if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||
- Node.DevPath->SubType != HW_PCI_DP ||
- DevicePathNodeLength(Node.DevPath) != sizeof(PCI_DEVICE_PATH)) {
- return EFI_UNSUPPORTED;
- }
- }
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciRootBridgeIoProtocolGuid,
- (VOID **) &PciRootBridgeIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciRootBridgeIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-PciBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- Start to management the controller passed in
-
-Arguments:
-
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
-
-Returns:
-
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Controller - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
-
- //
- // If PCI Platform protocol is available, get it now.
- // If the platform implements this, it must be installed before BDS phase
- //
- gPciPlatformProtocol = NULL;
- gBS->LocateProtocol (
- &gEfiPciPlatformProtocolGuid,
- NULL,
- (VOID **) &gPciPlatformProtocol
- );
-
- gFullEnumeration = (BOOLEAN) ((SearchHostBridgeHandle (Controller) ? FALSE : TRUE));
-
- //
- // Enumerate the entire host bridge
- // After enumeration, a database that records all the device information will be created
- //
- //
- Status = PciEnumerator (Controller);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Enable PCI device specified by remaining device path. BDS or other driver can call the
- // start more than once.
- //
-
- StartPciDevices (Controller, RemainingDevicePath);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-PciBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
- Stop one or more children created at start of pci bus driver
- if all the the children get closed, close the protocol
-
-Arguments:
-
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
-
-Returns:
-
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Controller - add argument and description to function comment
-// TODO: NumberOfChildren - add argument and description to function comment
-// TODO: ChildHandleBuffer - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- UINTN Index;
- BOOLEAN AllChildrenStopped;
-
- if (NumberOfChildren == 0) {
- //
- // Close the bus driver
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- gBS->CloseProtocol (
- Controller,
- &gEfiPciRootBridgeIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- DestroyRootBridgeByHandle (
- Controller
- );
-
- return EFI_SUCCESS;
- }
-
- //
- // Stop all the children
- //
-
- AllChildrenStopped = TRUE;
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
-
- //
- // De register all the pci device
- //
- Status = DeRegisterPciDevice (Controller, ChildHandleBuffer[Index]);
-
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.h b/EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.h
deleted file mode 100644
index 1cc9575..0000000
--- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/pcibus.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- pcibus.h
-
-Abstract:
-
- PCI Bus Driver
-
-Revision History
-
---*/
-
-#ifndef _EFI_PCI_BUS_H
-#define _EFI_PCI_BUS_H
-
-
-#include <IndustryStandard/pci22.h>
-#include <IndustryStandard/Acpi.h>
-#include "ComponentName.h"
-
-//
-// Driver Produced Protocol Prototypes
-//
-
-#define VGABASE1 0x3B0
-#define VGALIMIT1 0x3BB
-
-#define VGABASE2 0x3C0
-#define VGALIMIT2 0x3DF
-
-#define ISABASE 0x100
-#define ISALIMIT 0x3FF
-
-typedef enum {
- PciBarTypeUnknown = 0,
- PciBarTypeIo16,
- PciBarTypeIo32,
- PciBarTypeMem32,
- PciBarTypePMem32,
- PciBarTypeMem64,
- PciBarTypePMem64,
- PciBarTypeIo,
- PciBarTypeMem,
- PciBarTypeMaxType
-} PCI_BAR_TYPE;
-
-typedef struct {
- UINT64 BaseAddress;
- UINT64 Length;
- UINT64 Alignment;
- PCI_BAR_TYPE BarType;
- BOOLEAN Prefetchable;
- UINT8 MemType;
- UINT8 Offset;
-} PCI_BAR;
-
-#define PPB_BAR_0 0
-#define PPB_BAR_1 1
-#define PPB_IO_RANGE 2
-#define PPB_MEM32_RANGE 3
-#define PPB_PMEM32_RANGE 4
-#define PPB_PMEM64_RANGE 5
-#define PPB_MEM64_RANGE 0xFF
-
-#define P2C_BAR_0 0
-#define P2C_MEM_1 1
-#define P2C_MEM_2 2
-#define P2C_IO_1 3
-#define P2C_IO_2 4
-
-#define PCI_IO_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('p', 'c', 'i', 'o')
-
-#define EFI_BRIDGE_IO32_DECODE_SUPPORTED 0x0001
-#define EFI_BRIDGE_PMEM32_DECODE_SUPPORTED 0x0002
-#define EFI_BRIDGE_PMEM64_DECODE_SUPPORTED 0x0004
-#define EFI_BRIDGE_IO16_DECODE_SUPPORTED 0x0008
-#define EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED 0x0010
-#define EFI_BRIDGE_MEM64_DECODE_SUPPORTED 0x0020
-#define EFI_BRIDGE_MEM32_DECODE_SUPPORTED 0x0040
-
-#define PCI_MAX_HOST_BRIDGE_NUM 0x0010
-//
-// Define resource status constant
-//
-#define EFI_RESOURCE_NONEXISTENT 0xFFFFFFFFFFFFFFFFULL
-#define EFI_RESOURCE_LESS 0xFFFFFFFFFFFFFFFEULL
-#define EFI_RESOURCE_SATISFIED 0x0000000000000000ULL
-
-//
-// Define option for attribute
-//
-#define EFI_SET_SUPPORTS 0
-#define EFI_SET_ATTRIBUTES 1
-
-typedef struct _PCI_IO_DEVICE {
- UINT32 Signature;
- EFI_HANDLE Handle;
- EFI_PCI_IO_PROTOCOL PciIo;
- LIST_ENTRY Link;
-
- EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL PciDriverOverride;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- //
- // PCI configuration space header type
- //
- PCI_TYPE00 Pci;
-
- //
- // Bus number, Device number, Function number
- //
- UINT8 BusNumber;
- UINT8 DeviceNumber;
- UINT8 FunctionNumber;
-
- //
- // BAR for this PCI Device
- //
- PCI_BAR PciBar[PCI_MAX_BAR];
-
- //
- // The bridge device this pci device is subject to
- //
- struct _PCI_IO_DEVICE *Parent;
-
- //
- // A linked list for children Pci Device if it is bridge device
- //
- LIST_ENTRY ChildList;
-
- //
- // TURE if the PCI bus driver creates the handle for this PCI device
- //
- BOOLEAN Registered;
-
- //
- // TRUE if the PCI bus driver successfully allocates the resource required by
- // this PCI device
- //
- BOOLEAN Allocated;
-
- //
- // The attribute this PCI device currently set
- //
- UINT64 Attributes;
-
- //
- // The attributes this PCI device actually supports
- //
- UINT64 Supports;
-
- //
- // The resource decode the bridge supports
- //
- UINT32 Decodes;
-
- //
- // The OptionRom Size
- //
- UINT64 RomSize;
-
- //
- // The OptionRom Size
- //
- UINT64 RomBase;
-
- //
- // TRUE if all OpROM (in device or in platform specific position) have been processed
- //
- BOOLEAN AllOpRomProcessed;
-
- //
- // TRUE if there is any EFI driver in the OptionRom
- //
- BOOLEAN BusOverride;
-
- //
- // A list tracking reserved resource on a bridge device
- //
- LIST_ENTRY ReservedResourceList;
-
- //
- // A list tracking image handle of platform specific overriding driver
- //
- LIST_ENTRY OptionRomDriverList;
-
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *ResourcePaddingDescriptors;
- EFI_HPC_PADDING_ATTRIBUTES PaddingAttributes;
-
- BOOLEAN IsPciExp;
-
-} PCI_IO_DEVICE;
-
-
-#define PCI_IO_DEVICE_FROM_PCI_IO_THIS(a) \
- CR (a, PCI_IO_DEVICE, PciIo, PCI_IO_DEVICE_SIGNATURE)
-
-#define PCI_IO_DEVICE_FROM_PCI_DRIVER_OVERRIDE_THIS(a) \
- CR (a, PCI_IO_DEVICE, PciDriverOverride, PCI_IO_DEVICE_SIGNATURE)
-
-#define PCI_IO_DEVICE_FROM_LINK(a) \
- CR (a, PCI_IO_DEVICE, Link, PCI_IO_DEVICE_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gPciBusDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gPciBusComponentName;
-extern LIST_ENTRY gPciDevicePool;
-extern BOOLEAN gFullEnumeration;
-extern UINTN gPciHostBridgeNumber;
-extern EFI_HANDLE gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];
-extern UINT64 gAllOne;
-extern UINT64 gAllZero;
-
-extern EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol;
-
-#include "PciIo.h"
-#include "PciCommand.h"
-#include "PciDeviceSupport.h"
-#include "PciEnumerator.h"
-#include "PciEnumeratorSupport.h"
-#include "PciDriverOverride.h"
-#include "PciRomTable.h"
-#include "PciOptionRomSupport.h"
-#include "PciPowerManagement.h"
-#include "PciHotPlugSupport.h"
-#include "PciLib.h"
-
-//
-// PCI Bus Support Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-PciBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PciBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PciBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/Uhci/Dxe/ComponentName.c b/EdkModulePkg/Bus/Pci/Uhci/Dxe/ComponentName.c
deleted file mode 100644
index b6209e4..0000000
--- a/EdkModulePkg/Bus/Pci/Uhci/Dxe/ComponentName.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "uhci.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName = {
- UhciComponentNameGetDriverName,
- UhciComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mUhciDriverNameTable[] = {
- { "eng", (CHAR16 *) L"Usb Uhci Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-UhciComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUhciComponentName.SupportedLanguages,
- mUhciDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UhciComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle, OPTIONAL
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- USB_HC_DEV *UhciDev;
- EFI_USB_HC_PROTOCOL *UsbHc;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUhciDriverBinding.DriverBindingHandle,
- &gEfiPciIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the device context
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbHcProtocolGuid,
- (VOID **) &UsbHc,
- gUhciDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- UhciDev = USB_HC_DEV_FROM_THIS (UsbHc);
-
- return LookupUnicodeString (
- Language,
- gUhciComponentName.SupportedLanguages,
- UhciDev->ControllerNameTable,
- ControllerName
- );
-
-}
diff --git a/EdkModulePkg/Bus/Pci/Uhci/Dxe/Uhci.msa b/EdkModulePkg/Bus/Pci/Uhci/Dxe/Uhci.msa
deleted file mode 100644
index 4f5aa70..0000000
--- a/EdkModulePkg/Bus/Pci/Uhci/Dxe/Uhci.msa
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Uhci</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>2FB92EFA-2EE0-4bae-9EB6-7464125E1EF7</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Uhci module</Abstract>
- <Description>This module provides USB Host Controller Protocol implementation for Universal Host Controller Interface</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Uhci</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>uhci.c</Filename>
- <Filename>uhchlp.c</Filename>
- <Filename>ComponentName.c</Filename>
- <Filename>uhci.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiUsbHcProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiUsb2HcProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gUhciDriverBinding</DriverBinding>
- <ComponentName>gUhciComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhchlp.c b/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhchlp.c
deleted file mode 100644
index 2abc410..0000000
--- a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhchlp.c
+++ /dev/null
@@ -1,4206 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UhcHlp.c
-
-Abstract:
-
-
-Revision History
---*/
-
-#include "uhci.h"
-
-STATIC
-EFI_STATUS
-USBReadPortW (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 PortOffset,
- IN OUT UINT16 *Data
- )
-/*++
-
-Routine Description:
-
- USBReadPort Word
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- PortOffset - Port offset
- Data - Data to reutrn
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- //
- // Perform 16bit Read in PCI IO Space
- //
- return PciIo->Io.Read (
- PciIo,
- EfiPciIoWidthUint16,
- USB_BAR_INDEX,
- (UINT64) PortOffset,
- 1,
- Data
- );
-}
-
-STATIC
-EFI_STATUS
-USBWritePortW (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 PortOffset,
- IN UINT16 Data
- )
-/*++
-
-Routine Description:
-
- USB Write Port Word
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- PortOffset - Port offset
- Data - Data to write
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- //
- // Perform 16bit Write in PCI IO Space
- //
- return PciIo->Io.Write (
- PciIo,
- EfiPciIoWidthUint16,
- USB_BAR_INDEX,
- (UINT64) PortOffset,
- 1,
- &Data
- );
-}
-
-STATIC
-EFI_STATUS
-USBWritePortDW (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 PortOffset,
- IN UINT32 Data
- )
-/*++
-
-Routine Description:
-
- USB Write Port DWord
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- PortOffset - Port offset
- Data - Data to write
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- //
- // Perform 32bit Write in PCI IO Space
- //
- return PciIo->Io.Write (
- PciIo,
- EfiPciIoWidthUint32,
- USB_BAR_INDEX,
- (UINT64) PortOffset,
- 1,
- &Data
- );
-}
-//
-// USB register-base helper functions
-//
-EFI_STATUS
-WriteUHCCommandReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 CmdAddrOffset,
- IN UINT16 UsbCmd
- )
-/*++
-
-Routine Description:
-
- Write UHCI Command Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- CmdAddrOffset - Command address offset
- UsbCmd - Data to write
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- //
- // Write to UHC's Command Register
- //
- return USBWritePortW (PciIo, CmdAddrOffset, UsbCmd);
-}
-
-EFI_STATUS
-ReadUHCCommandReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 CmdAddrOffset,
- IN OUT UINT16 *Data
- )
-/*++
-
-Routine Description:
-
- Read UHCI Command Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- CmdAddrOffset - Command address offset
- Data - Data to return
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- //
- // Read from UHC's Command Register
- //
- return USBReadPortW (PciIo, CmdAddrOffset, Data);
-}
-
-EFI_STATUS
-WriteUHCStatusReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusAddrOffset,
- IN UINT16 UsbSts
- )
-/*++
-
-Routine Description:
-
- Write UHCI Staus Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusAddrOffset - Status address offset
- UsbSts - Data to write
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- //
- // Write to UHC's Status Register
- //
- return USBWritePortW (PciIo, StatusAddrOffset, UsbSts);
-}
-
-EFI_STATUS
-ReadUHCStatusReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusAddrOffset,
- IN OUT UINT16 *Data
- )
-/*++
-
-Routine Description:
-
- Read UHCI Staus Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusAddrOffset - Status address offset
- UsbSts - Data to return
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- //
- // Read from UHC's Status Register
- //
- return USBReadPortW (PciIo, StatusAddrOffset, Data);
-}
-
-
-EFI_STATUS
-ClearStatusReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusAddrOffset
- )
-/*++
-
-Routine Description:
-
- Clear the content of UHC's Status Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusAddrOffset - Status address offset
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
-
- return WriteUHCStatusReg (PciIo, StatusAddrOffset, 0x003F);
-}
-
-EFI_STATUS
-ReadUHCFrameNumberReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FrameNumAddrOffset,
- IN OUT UINT16 *Data
- )
-/*++
-
-Routine Description:
-
- Read from UHC's Frame Number Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- FrameNumAddrOffset - Frame number register offset
- Data - Data to return
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
-
- return USBReadPortW (PciIo, FrameNumAddrOffset, Data);
-}
-
-EFI_STATUS
-WriteUHCFrameListBaseReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FlBaseAddrOffset,
- IN UINT32 UsbFrameListBaseAddr
- )
-/*++
-
-Routine Description:
-
- Write to UHC's Frame List Base Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- FlBaseAddrOffset - Frame Base address register
- UsbFrameListBaseAddr - Address to write
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
-
- return USBWritePortDW (PciIo, FlBaseAddrOffset, UsbFrameListBaseAddr);
-}
-
-EFI_STATUS
-ReadRootPortReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 PortAddrOffset,
- IN OUT UINT16 *Data
- )
-/*++
-
-Routine Description:
-
- Read from UHC's Root Port Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- PortAddrOffset - Port Addrress Offset,
- Data - Data to return
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
-
- return USBReadPortW (PciIo, PortAddrOffset, Data);
-}
-
-EFI_STATUS
-WriteRootPortReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 PortAddrOffset,
- IN UINT16 ControlBits
- )
-/*++
-
-Routine Description:
-
- Write to UHC's Root Port Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- PortAddrOffset - Port Addrress Offset,
- ControlBits - Data to write
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
-
- return USBWritePortW (PciIo, PortAddrOffset, ControlBits);
-}
-
-
-
-EFI_STATUS
-WaitForUHCHalt (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusRegAddr,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait until UHCI halt or timeout
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusRegAddr - Status Register Address
- Timeout - Time out value in us
-
-Returns:
-
- EFI_DEVICE_ERROR - Unable to read the status register
- EFI_TIMEOUT - Time out
- EFI_SUCCESS - Success
-
---*/
-{
- UINTN Delay;
- EFI_STATUS Status;
- UINT16 HcStatus;
-
- //
- // Timeout is in us unit
- //
- Delay = (Timeout / 50) + 1;
- do {
- Status = ReadUHCStatusReg (PciIo, StatusRegAddr, &HcStatus);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- if ((HcStatus & USBSTS_HCH) == USBSTS_HCH) {
- break;
- }
- //
- // Stall for 50 us
- //
- gBS->Stall (50);
-
- } while (Delay--);
-
- if (Delay == 0) {
- return EFI_TIMEOUT;
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-IsStatusOK (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusRegAddr
- )
-/*++
-
-Routine Description:
-
- Judge whether the host controller operates well
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusRegAddr - Status register address
-
-Returns:
-
- TRUE - Status is good
- FALSE - Status is bad
-
---*/
-{
- EFI_STATUS Status;
- UINT16 HcStatus;
- //
- // Detect whether the interrupt is caused by fatal error.
- // see "UHCI Design Guid".
- //
- Status = ReadUHCStatusReg (PciIo, StatusRegAddr, &HcStatus);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- if (HcStatus & (USBSTS_HCPE | USBSTS_HSE | USBSTS_HCH)) {
- return FALSE;
- } else {
- return TRUE;
- }
-
-}
-
-
-BOOLEAN
-IsHostSysOrProcessErr (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusRegAddr
- )
-/*++
-
-Routine Description:
-
- Judge the status is HostSys,ProcessErr error or good
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusRegAddr - Status register address
-
-Returns:
-
- TRUE - Status is good
- FALSE - Status is bad
-
---*/
-{
- EFI_STATUS Status;
- UINT16 HcStatus;
- //
- // Detect whether the interrupt is caused by serious error.
- // see "UHCI Design Guid".
- //
- Status = ReadUHCStatusReg (PciIo, StatusRegAddr, &HcStatus);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- if (HcStatus & (USBSTS_HSE | USBSTS_HCPE)) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-
-UINT16
-GetCurrentFrameNumber (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FrameNumAddrOffset
- )
-/*++
-
-Routine Description:
-
- Get Current Frame Number
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- FrameNumAddrOffset - FrameNum register AddrOffset
-
-Returns:
-
- Frame number
-
---*/
-{
- //
- // Gets value in the USB frame number register.
- //
- UINT16 FrameNumber;
-
- ReadUHCFrameNumberReg (PciIo, FrameNumAddrOffset, &FrameNumber);
-
- return (UINT16) (FrameNumber & 0x03FF);
-}
-
-EFI_STATUS
-SetFrameListBaseAddress (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FlBaseAddrReg,
- IN UINT32 Addr
- )
-/*++
-
-Routine Description:
-
- Set FrameListBase Address
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- FlBaseAddrReg - FrameListBase register
- Addr - Address to set
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- //
- // Sets value in the USB Frame List Base Address register.
- //
- return WriteUHCFrameListBaseReg (PciIo, FlBaseAddrReg, (UINT32) (Addr & 0xFFFFF000));
-}
-
-VOID
-EnableMaxPacketSize (
- IN USB_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Enable Max Packet Size
-
-Arguments:
-
- HcDev - USB_HC_DEV
-
-Returns:
-
- VOID
-
---*/
-{
- UINT16 CommandContent;
-
- ReadUHCCommandReg (
- HcDev->PciIo,
- (UINT32) (USBCMD),
- &CommandContent
- );
-
- if ((CommandContent & USBCMD_MAXP) != USBCMD_MAXP) {
- CommandContent |= USBCMD_MAXP;
- WriteUHCCommandReg (
- HcDev->PciIo,
- (UINT32) (USBCMD),
- CommandContent
- );
- }
-
- return ;
-}
-
-EFI_STATUS
-CreateFrameList (
- IN USB_HC_DEV *HcDev,
- IN UINT32 FlBaseAddrReg
- )
-/*++
-
-Routine Description:
-
- CreateFrameList
-
-Arguments:
-
- HcDev - USB_HC_DEV
- FlBaseAddrReg - Frame List register
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can't allocate memory resources
- EFI_UNSUPPORTED - Map memory fail
- EFI_SUCCESS - Success
-
---*/
-{
- EFI_STATUS Status;
- VOID *CommonBuffer;
- EFI_PHYSICAL_ADDRESS MappedAddress;
- VOID *Mapping;
- UINTN BufferSizeInPages;
- UINTN BufferSizeInBytes;
-
- //
- // The Frame List is a common buffer that will be
- // accessed by both the cpu and the usb bus master
- // at the same time.
- // The Frame List ocupies 4K bytes,
- // and must be aligned on 4-Kbyte boundaries.
- //
- BufferSizeInBytes = 4096;
- BufferSizeInPages = EFI_SIZE_TO_PAGES (BufferSizeInBytes);
- Status = HcDev->PciIo->AllocateBuffer (
- HcDev->PciIo,
- AllocateAnyPages,
- EfiBootServicesData,
- BufferSizeInPages,
- &CommonBuffer,
- 0
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterCommonBuffer,
- CommonBuffer,
- &BufferSizeInBytes,
- &MappedAddress,
- &Mapping
- );
- if (EFI_ERROR (Status) || (BufferSizeInBytes != 4096)) {
- HcDev->PciIo->FreeBuffer (HcDev->PciIo, BufferSizeInPages, CommonBuffer);
- return EFI_UNSUPPORTED;
- }
-
- HcDev->FrameListEntry = (FRAMELIST_ENTRY *) ((UINTN) MappedAddress);
-
- HcDev->FrameListMapping = Mapping;
-
- InitFrameList (HcDev);
-
- //
- // Tell the Host Controller where the Frame List lies,
- // by set the Frame List Base Address Register.
- //
- SetFrameListBaseAddress (
- HcDev->PciIo,
- FlBaseAddrReg,
- (UINT32) ((UINTN) HcDev->FrameListEntry)
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FreeFrameListEntry (
- IN USB_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Free FrameList buffer
-
-Arguments:
-
- HcDev - USB_HC_DEV
-
-Returns:
-
- EFI_SUCCESS - success
-
---*/
-{
- //
- // Unmap the common buffer for framelist entry,
- // and free the common buffer.
- // Uhci's frame list occupy 4k memory.
- //
- HcDev->PciIo->Unmap (HcDev->PciIo, HcDev->FrameListMapping);
- HcDev->PciIo->FreeBuffer (
- HcDev->PciIo,
- EFI_SIZE_TO_PAGES (4096),
- (VOID *) (HcDev->FrameListEntry)
- );
- return EFI_SUCCESS;
-}
-
-VOID
-InitFrameList (
- IN USB_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Initialize FrameList
-
-Arguments:
-
- HcDev - USB_HC_DEV
-
-Returns:
- VOID
-
---*/
-{
- FRAMELIST_ENTRY *FrameListPtr;
- UINTN Index;
-
- //
- // Validate each Frame List Entry
- //
- FrameListPtr = HcDev->FrameListEntry;
- for (Index = 0; Index < 1024; Index++) {
- FrameListPtr->FrameListPtrTerminate = 1;
- FrameListPtr->FrameListPtr = 0;
- FrameListPtr->FrameListPtrQSelect = 0;
- FrameListPtr->FrameListRsvd = 0;
- FrameListPtr++;
- }
-}
-//
-// //////////////////////////////////////////////////////////////
-//
-// QH TD related Helper Functions
-//
-////////////////////////////////////////////////////////////////
-//
-// functions for QH
-//
-STATIC
-EFI_STATUS
-AllocateQHStruct (
- IN USB_HC_DEV *HcDev,
- OUT QH_STRUCT **ppQHStruct
- )
-/*++
-
-Routine Description:
-
- Allocate QH Struct
-
-Arguments:
-
- HcDev - USB_HC_DEV
- ppQHStruct - QH_STRUCT content to return
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- *ppQHStruct = NULL;
-
- //
- // QH must align on 16 bytes alignment,
- // since the memory allocated by UhciAllocatePool ()
- // is aligned on 32 bytes, it is no need to adjust
- // the allocated memory returned.
- //
- return UhciAllocatePool (HcDev, (UINT8 **) ppQHStruct, sizeof (QH_STRUCT));
-}
-
-
-EFI_STATUS
-CreateQH (
- IN USB_HC_DEV *HcDev,
- OUT QH_STRUCT **pptrQH
- )
-/*++
-
-Routine Description:
-
- CreateQH
-
-Arguments:
-
- HcDev - USB_HC_DEV
- ppQHStruct - QH_STRUCT content to return
-Returns:
-
- EFI_SUCCESS - Success
- EFI_OUT_OF_RESOURCES - Can't allocate memory
---*/
-{
- EFI_STATUS Status;
-
- //
- // allocate align memory for QH_STRUCT
- //
- Status = AllocateQHStruct (HcDev, pptrQH);
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // init each field of the QH_STRUCT
- //
- //
- // Make QH ready
- //
- SetQHHorizontalValidorInvalid (*pptrQH, FALSE);
- SetQHVerticalValidorInvalid (*pptrQH, FALSE);
-
- return EFI_SUCCESS;
-}
-
-VOID
-SetQHHorizontalLinkPtr (
- IN QH_STRUCT *PtrQH,
- IN VOID *ptrNext
- )
-/*++
-
-Routine Description:
-
- Set QH Horizontal Link Pointer
-
-Arguments:
-
- PtrQH - QH_STRUCT
- ptrNext - Data to write
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // Since the QH_STRUCT is aligned on 16-byte boundaries,
- // Only the highest 28bit of the address is valid
- // (take 32bit address as an example).
- //
- PtrQH->QH.QHHorizontalPtr = (UINT32) ((UINTN) ptrNext >> 4);
-}
-
-VOID *
-GetQHHorizontalLinkPtr (
- IN QH_STRUCT *PtrQH
- )
-/*++
-
-Routine Description:
-
- Get QH Horizontal Link Pointer
-
-Arguments:
-
- PtrQH - QH_STRUCT
-
-
-Returns:
-
- Data to return
-
---*/
-{
- //
- // Restore the 28bit address to 32bit address
- // (take 32bit address as an example)
- //
- return (VOID *) ((UINTN) (PtrQH->QH.QHHorizontalPtr << 4));
-}
-
-VOID
-SetQHHorizontalQHorTDSelect (
- IN QH_STRUCT *PtrQH,
- IN BOOLEAN bQH
- )
-/*++
-
-Routine Description:
-
- Set QH Horizontal QH or TD
-
-Arguments:
-
- PtrQH - QH_STRUCT
- bQH - TRUE is QH FALSE is TD
-
-Returns:
- VOID
-
---*/
-{
- //
- // if QH is connected, the specified bit is set,
- // if TD is connected, the specified bit is cleared.
- //
- PtrQH->QH.QHHorizontalQSelect = bQH ? 1 : 0;
-}
-
-
-VOID
-SetQHHorizontalValidorInvalid (
- IN QH_STRUCT *PtrQH,
- IN BOOLEAN bValid
- )
-/*++
-
-Routine Description:
-
- Set QH Horizontal Valid or Invalid
-
-Arguments:
-
- PtrQH - QH_STRUCT
- bValid - TRUE is Valid FALSE is Invalid
-
-Returns:
- VOID
-
---*/
-{
- //
- // Valid means the horizontal link pointer is valid,
- // else, it's invalid.
- //
- PtrQH->QH.QHHorizontalTerminate = bValid ? 0 : 1;
-}
-
-VOID
-SetQHVerticalLinkPtr (
- IN QH_STRUCT *PtrQH,
- IN VOID *ptrNext
- )
-/*++
-
-Routine Description:
-
- Set QH Vertical Link Pointer
-
-Arguments:
-
- PtrQH - QH_STRUCT
- ptrNext - Data to write
-Returns:
-
- VOID
-
---*/
-{
- //
- // Since the QH_STRUCT is aligned on 16-byte boundaries,
- // Only the highest 28bit of the address is valid
- // (take 32bit address as an example).
- //
- PtrQH->QH.QHVerticalPtr = (UINT32) ((UINTN) ptrNext >> 4);
-}
-
-VOID *
-GetQHVerticalLinkPtr (
- IN QH_STRUCT *PtrQH
- )
-/*++
-
-Routine Description:
-
- Get QH Vertical Link Pointer
-
-Arguments:
-
- PtrQH - QH_STRUCT
-
-Returns:
-
- Data to return
-
---*/
-{
- //
- // Restore the 28bit address to 32bit address
- // (take 32bit address as an example)
- //
- return (VOID *) ((UINTN) (PtrQH->QH.QHVerticalPtr << 4));
-}
-
-VOID
-SetQHVerticalQHorTDSelect (
- IN QH_STRUCT *PtrQH,
- IN BOOLEAN bQH
- )
-/*++
-
-Routine Description:
-
- Set QH Vertical QH or TD
-
-Arguments:
-
- PtrQH - QH_STRUCT
- bQH - TRUE is QH FALSE is TD
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // Set the specified bit if the Vertical Link Pointer pointing to a QH,
- // Clear the specified bit if the Vertical Link Pointer pointing to a TD.
- //
- PtrQH->QH.QHVerticalQSelect = bQH ? 1 : 0;
-}
-
-BOOLEAN
-IsQHHorizontalQHSelect (
- IN QH_STRUCT *PtrQH
- )
-/*++
-
-Routine Description:
-
- Is QH Horizontal QH Select
-
-Arguments:
-
- PtrQH - QH_STRUCT
-
-Returns:
-
- TRUE - QH
- FALSE - TD
-
---*/
-{
- //
- // Retrieve the information about whether the Horizontal Link Pointer
- // pointing to a QH or TD.
- //
- return (BOOLEAN) (PtrQH->QH.QHHorizontalQSelect ? TRUE : FALSE);
-}
-
-VOID
-SetQHVerticalValidorInvalid (
- IN QH_STRUCT *PtrQH,
- IN BOOLEAN IsValid
- )
-/*++
-
-Routine Description:
-
- Set QH Vertical Valid or Invalid
-
-Arguments:
-
- PtrQH - QH_STRUCT
- IsValid - TRUE is valid FALSE is invalid
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // If TRUE, indicates the Vertical Link Pointer field is valid,
- // else, the field is invalid.
- //
- PtrQH->QH.QHVerticalTerminate = IsValid ? 0 : 1;
-}
-
-
-BOOLEAN
-GetQHVerticalValidorInvalid (
- IN QH_STRUCT *PtrQH
- )
-/*++
-
-Routine Description:
-
- Get QH Vertical Valid or Invalid
-
-Arguments:
-
- PtrQH - QH_STRUCT
-
-Returns:
-
- TRUE - Valid
- FALSE - Invalid
-
---*/
-{
- //
- // If TRUE, indicates the Vertical Link Pointer field is valid,
- // else, the field is invalid.
- //
- return (BOOLEAN) (!(PtrQH->QH.QHVerticalTerminate));
-}
-
-STATIC
-BOOLEAN
-GetQHHorizontalValidorInvalid (
- IN QH_STRUCT *PtrQH
- )
-/*++
-
-Routine Description:
-
- Get QH Horizontal Valid or Invalid
-
-Arguments:
-
- PtrQH - QH_STRUCT
-
-Returns:
-
- TRUE - Valid
- FALSE - Invalid
-
---*/
-{
- //
- // If TRUE, meaning the Horizontal Link Pointer field is valid,
- // else, the field is invalid.
- //
- return (BOOLEAN) (!(PtrQH->QH.QHHorizontalTerminate));
-}
-//
-// functions for TD
-//
-EFI_STATUS
-AllocateTDStruct (
- IN USB_HC_DEV *HcDev,
- OUT TD_STRUCT **ppTDStruct
- )
-/*++
-
-Routine Description:
-
- Allocate TD Struct
-
-Arguments:
-
- HcDev - USB_HC_DEV
- ppTDStruct - place to store TD_STRUCT pointer
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- *ppTDStruct = NULL;
-
- //
- // TD must align on 16 bytes alignment,
- // since the memory allocated by UhciAllocatePool ()
- // is aligned on 32 bytes, it is no need to adjust
- // the allocated memory returned.
- //
- return UhciAllocatePool (
- HcDev,
- (UINT8 **) ppTDStruct,
- sizeof (TD_STRUCT)
- );
-}
-
-EFI_STATUS
-CreateTD (
- IN USB_HC_DEV *HcDev,
- OUT TD_STRUCT **pptrTD
- )
-/*++
-
-Routine Description:
-
- Create TD
-
-Arguments:
-
- HcDev - USB_HC_DEV
- pptrTD - TD_STRUCT pointer to store
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can't allocate resources
- EFI_SUCCESS - Success
-
---*/
-{
- EFI_STATUS Status;
- //
- // create memory for TD_STRUCT, and align the memory.
- //
- Status = AllocateTDStruct (HcDev, pptrTD);
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Make TD ready.
- //
- SetTDLinkPtrValidorInvalid (*pptrTD, FALSE);
-
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GenSetupStageTD (
- IN USB_HC_DEV *HcDev,
- IN UINT8 DevAddr,
- IN UINT8 Endpoint,
- IN BOOLEAN bSlow,
- IN UINT8 *pDevReq,
- IN UINT8 RequestLen,
- OUT TD_STRUCT **ppTD
- )
-/*++
-
-Routine Description:
-
- Generate Setup Stage TD
-
-Arguments:
-
- HcDev - USB_HC_DEV
- DevAddr - Device address
- Endpoint - Endpoint number
- bSlow - Full speed or low speed
- pDevReq - Device request
- RequestLen - Request length
- ppTD - TD_STRUCT to return
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can't allocate memory
- EFI_SUCCESS - Success
-
---*/
-{
- EFI_STATUS Status;
- TD_STRUCT *pTDStruct;
-
- Status = CreateTD (HcDev, &pTDStruct);
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetTDLinkPtr (pTDStruct, NULL);
-
- //
- // Depth first fashion
- //
- SetTDLinkPtrDepthorBreadth (pTDStruct, TRUE);
-
- //
- // initialize as the last TD in the QH context,
- // this field will be updated in the TD linkage process.
- //
- SetTDLinkPtrValidorInvalid (pTDStruct, FALSE);
-
- //
- // Disable Short Packet Detection by default
- //
- EnableorDisableTDShortPacket (pTDStruct, FALSE);
-
- //
- // Max error counter is 3, retry 3 times when error encountered.
- //
- SetTDControlErrorCounter (pTDStruct, 3);
-
- //
- // set device speed attribute
- // (TRUE - Slow Device; FALSE - Full Speed Device)
- //
- SetTDLoworFullSpeedDevice (pTDStruct, bSlow);
-
- //
- // Non isochronous transfer TD
- //
- SetTDControlIsochronousorNot (pTDStruct, FALSE);
-
- //
- // Interrupt On Complete bit be set to zero,
- // Disable IOC interrupt.
- //
- SetorClearTDControlIOC (pTDStruct, FALSE);
-
- //
- // Set TD Active bit
- //
- SetTDStatusActiveorInactive (pTDStruct, TRUE);
-
- SetTDTokenMaxLength (pTDStruct, RequestLen);
-
- SetTDTokenDataToggle0 (pTDStruct);
-
- SetTDTokenEndPoint (pTDStruct, Endpoint);
-
- SetTDTokenDeviceAddress (pTDStruct, DevAddr);
-
- SetTDTokenPacketID (pTDStruct, SETUP_PACKET_ID);
-
- pTDStruct->pTDBuffer = (UINT8 *) pDevReq;
- pTDStruct->TDBufferLength = RequestLen;
- SetTDDataBuffer (pTDStruct);
-
- *ppTD = pTDStruct;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GenDataTD (
- IN USB_HC_DEV *HcDev,
- IN UINT8 DevAddr,
- IN UINT8 Endpoint,
- IN UINT8 *pData,
- IN UINT8 Len,
- IN UINT8 PktID,
- IN UINT8 Toggle,
- IN BOOLEAN bSlow,
- OUT TD_STRUCT **ppTD
- )
-/*++
-
-Routine Description:
-
- Generate Data Stage TD
-
-Arguments:
-
- HcDev - USB_HC_DEV
- DevAddr - Device address
- Endpoint - Endpoint number
- pData - Data buffer
- Len - Data length
- PktID - Packet ID
- Toggle - Data toggle value
- bSlow - Full speed or low speed
- ppTD - TD_STRUCT to return
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can't allocate memory
- EFI_SUCCESS - Success
-
---*/
-{
- TD_STRUCT *pTDStruct;
- EFI_STATUS Status;
-
- Status = CreateTD (HcDev, &pTDStruct);
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetTDLinkPtr (pTDStruct, NULL);
-
- //
- // Depth first fashion
- //
- SetTDLinkPtrDepthorBreadth (pTDStruct, TRUE);
-
- //
- // Link pointer pointing to TD struct
- //
- SetTDLinkPtrQHorTDSelect (pTDStruct, FALSE);
-
- //
- // initialize as the last TD in the QH context,
- // this field will be updated in the TD linkage process.
- //
- SetTDLinkPtrValidorInvalid (pTDStruct, FALSE);
-
- //
- // Disable short packet detect
- //
- EnableorDisableTDShortPacket (pTDStruct, FALSE);
- //
- // Max error counter is 3
- //
- SetTDControlErrorCounter (pTDStruct, 3);
-
- //
- // set device speed attribute
- // (TRUE - Slow Device; FALSE - Full Speed Device)
- //
- SetTDLoworFullSpeedDevice (pTDStruct, bSlow);
-
- //
- // Non isochronous transfer TD
- //
- SetTDControlIsochronousorNot (pTDStruct, FALSE);
-
- //
- // Disable Interrupt On Complete
- // Disable IOC interrupt.
- //
- SetorClearTDControlIOC (pTDStruct, FALSE);
-
- //
- // Set Active bit
- //
- SetTDStatusActiveorInactive (pTDStruct, TRUE);
-
- SetTDTokenMaxLength (pTDStruct, Len);
-
- if (Toggle) {
- SetTDTokenDataToggle1 (pTDStruct);
- } else {
- SetTDTokenDataToggle0 (pTDStruct);
- }
-
- SetTDTokenEndPoint (pTDStruct, Endpoint);
-
- SetTDTokenDeviceAddress (pTDStruct, DevAddr);
-
- SetTDTokenPacketID (pTDStruct, PktID);
-
- pTDStruct->pTDBuffer = (UINT8 *) pData;
- pTDStruct->TDBufferLength = Len;
- SetTDDataBuffer (pTDStruct);
- *ppTD = pTDStruct;
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateStatusTD (
- IN USB_HC_DEV *HcDev,
- IN UINT8 DevAddr,
- IN UINT8 Endpoint,
- IN UINT8 PktID,
- IN BOOLEAN bSlow,
- OUT TD_STRUCT **ppTD
- )
-/*++
-
-Routine Description:
-
- Generate Status Stage TD
-
-Arguments:
-
- HcDev - USB_HC_DEV
- DevAddr - Device address
- Endpoint - Endpoint number
- PktID - Packet ID
- bSlow - Full speed or low speed
- ppTD - TD_STRUCT to return
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can't allocate memory
- EFI_SUCCESS - Success
-
---*/
-{
- TD_STRUCT *ptrTDStruct;
- EFI_STATUS Status;
-
- Status = CreateTD (HcDev, &ptrTDStruct);
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetTDLinkPtr (ptrTDStruct, NULL);
-
- //
- // Depth first fashion
- //
- SetTDLinkPtrDepthorBreadth (ptrTDStruct, TRUE);
-
- //
- // initialize as the last TD in the QH context,
- // this field will be updated in the TD linkage process.
- //
- SetTDLinkPtrValidorInvalid (ptrTDStruct, FALSE);
-
- //
- // Disable short packet detect
- //
- EnableorDisableTDShortPacket (ptrTDStruct, FALSE);
-
- //
- // Max error counter is 3
- //
- SetTDControlErrorCounter (ptrTDStruct, 3);
-
- //
- // set device speed attribute
- // (TRUE - Slow Device; FALSE - Full Speed Device)
- //
- SetTDLoworFullSpeedDevice (ptrTDStruct, bSlow);
-
- //
- // Non isochronous transfer TD
- //
- SetTDControlIsochronousorNot (ptrTDStruct, FALSE);
-
- //
- // Disable Interrupt On Complete
- // Disable IOC interrupt.
- //
- SetorClearTDControlIOC (ptrTDStruct, FALSE);
-
- //
- // Set TD Active bit
- //
- SetTDStatusActiveorInactive (ptrTDStruct, TRUE);
-
- SetTDTokenMaxLength (ptrTDStruct, 0);
-
- SetTDTokenDataToggle1 (ptrTDStruct);
-
- SetTDTokenEndPoint (ptrTDStruct, Endpoint);
-
- SetTDTokenDeviceAddress (ptrTDStruct, DevAddr);
-
- SetTDTokenPacketID (ptrTDStruct, PktID);
-
- ptrTDStruct->pTDBuffer = NULL;
- ptrTDStruct->TDBufferLength = 0;
- SetTDDataBuffer (ptrTDStruct);
-
- *ppTD = ptrTDStruct;
-
- return EFI_SUCCESS;
-}
-
-
-VOID
-SetTDLinkPtrValidorInvalid (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bValid
- )
-/*++
-
-Routine Description:
-
- Set TD Link Pointer Valid or Invalid
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- bValid - TRUE is valid FALSE is invalid
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // Valid means the link pointer is valid,
- // else, it's invalid.
- //
- ptrTDStruct->TDData.TDLinkPtrTerminate = (bValid ? 0 : 1);
-}
-
-VOID
-SetTDLinkPtrQHorTDSelect (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bQH
- )
-/*++
-
-Routine Description:
-
- Set TD Link Pointer QH or TD Select
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- bQH - TRUE is QH FALSE is TD
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // Indicate whether the Link Pointer pointing to a QH or TD
- //
- ptrTDStruct->TDData.TDLinkPtrQSelect = (bQH ? 1 : 0);
-}
-
-VOID
-SetTDLinkPtrDepthorBreadth (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bDepth
- )
-/*++
-
-Routine Description:
-
- Set TD Link Pointer depth or bread priority
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- bDepth - TRUE is Depth FALSE is Breadth
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // If TRUE, indicating the host controller should process in depth first
- // fashion,
- // else, the host controller should process in breadth first fashion
- //
- ptrTDStruct->TDData.TDLinkPtrDepthSelect = (bDepth ? 1 : 0);
-}
-
-VOID
-SetTDLinkPtr (
- IN TD_STRUCT *ptrTDStruct,
- IN VOID *ptrNext
- )
-/*++
-
-Routine Description:
-
- Set TD Link Pointer
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- ptrNext - Pointer to set
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // Set TD Link Pointer. Since QH,TD align on 16-byte boundaries,
- // only the highest 28 bits are valid. (if take 32bit address as an example)
- //
- ptrTDStruct->TDData.TDLinkPtr = (UINT32) ((UINTN) ptrNext >> 4);
-}
-
-VOID *
-GetTDLinkPtr (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Get TD Link Pointer
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
-
-Returns:
-
- Pointer to get
-
---*/
-{
- //
- // Get TD Link Pointer. Restore it back to 32bit
- // (if take 32bit address as an example)
- //
- return (VOID *) ((UINTN) (ptrTDStruct->TDData.TDLinkPtr << 4));
-}
-
-STATIC
-BOOLEAN
-IsTDLinkPtrQHOrTD (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Is TD Link Pointer is QH Or TD
-
-Arguments:
-
- ptrTDStruct - TODO: add argument description
-
-Returns:
-
- TRUE - QH
- FALSE - TD
-
---*/
-{
- //
- // Get the information about whether the Link Pointer field pointing to
- // a QH or a TD.
- //
- return (BOOLEAN) (ptrTDStruct->TDData.TDLinkPtrQSelect);
-}
-
-VOID
-EnableorDisableTDShortPacket (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bEnable
- )
-/*++
-
-Routine Description:
-
- Enable or Disable TD ShortPacket
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- bEnable - TRUE is Enanble FALSE is Disable
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // TRUE means enable short packet detection mechanism.
- //
- ptrTDStruct->TDData.TDStatusSPD = (bEnable ? 1 : 0);
-}
-
-VOID
-SetTDControlErrorCounter (
- IN TD_STRUCT *ptrTDStruct,
- IN UINT8 nMaxErrors
- )
-/*++
-
-Routine Description:
-
- Set TD Control ErrorCounter
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- nMaxErrors - Error counter number
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // valid value of nMaxErrors is 0,1,2,3
- //
- if (nMaxErrors > 3) {
- nMaxErrors = 3;
- }
-
- ptrTDStruct->TDData.TDStatusErr = nMaxErrors;
-}
-
-
-VOID
-SetTDLoworFullSpeedDevice (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bLowSpeedDevice
- )
-{
- //
- // TRUE means the TD is targeting at a Low-speed device
- //
- ptrTDStruct->TDData.TDStatusLS = (bLowSpeedDevice ? 1 : 0);
-}
-
-VOID
-SetTDControlIsochronousorNot (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN IsIsochronous
- )
-{
- //
- // TRUE means the TD belongs to Isochronous transfer type.
- //
- ptrTDStruct->TDData.TDStatusIOS = (IsIsochronous ? 1 : 0);
-}
-
-VOID
-SetorClearTDControlIOC (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN IsSet
- )
-{
- //
- // If this bit is set, it indicates that the host controller should issue
- // an interrupt on completion of the frame in which this TD is executed.
- //
- ptrTDStruct->TDData.TDStatusIOC = IsSet ? 1 : 0;
-}
-
-VOID
-SetTDStatusActiveorInactive (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN IsActive
- )
-{
- //
- // If this bit is set, it indicates that the TD is active and can be
- // executed.
- //
- if (IsActive) {
- ptrTDStruct->TDData.TDStatus |= 0x80;
- } else {
- ptrTDStruct->TDData.TDStatus &= 0x7F;
- }
-}
-
-UINT16
-SetTDTokenMaxLength (
- IN TD_STRUCT *ptrTDStruct,
- IN UINT16 MaximumLength
- )
-{
- //
- // Specifies the maximum number of data bytes allowed for the transfer.
- // the legal value extent is 0 ~ 0x500.
- //
- if (MaximumLength > 0x500) {
- MaximumLength = 0x500;
- }
- ptrTDStruct->TDData.TDTokenMaxLen = MaximumLength - 1;
-
- return MaximumLength;
-}
-
-VOID
-SetTDTokenDataToggle1 (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Set the data toggle bit to DATA1
- //
- ptrTDStruct->TDData.TDTokenDataToggle = 1;
-}
-
-VOID
-SetTDTokenDataToggle0 (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Set the data toggle bit to DATA0
- //
- ptrTDStruct->TDData.TDTokenDataToggle = 0;
-}
-
-UINT8
-GetTDTokenDataToggle (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Get the data toggle value.
- //
- return (UINT8) (ptrTDStruct->TDData.TDTokenDataToggle);
-}
-
-VOID
-SetTDTokenEndPoint (
- IN TD_STRUCT *ptrTDStruct,
- IN UINTN EndPoint
- )
-{
- //
- // Set EndPoint Number the TD is targeting at.
- //
- ptrTDStruct->TDData.TDTokenEndPt = (UINT8) EndPoint;
-}
-
-VOID
-SetTDTokenDeviceAddress (
- IN TD_STRUCT *ptrTDStruct,
- IN UINTN DeviceAddress
- )
-{
- //
- // Set Device Address the TD is targeting at.
- //
- ptrTDStruct->TDData.TDTokenDevAddr = (UINT8) DeviceAddress;
-}
-
-VOID
-SetTDTokenPacketID (
- IN TD_STRUCT *ptrTDStruct,
- IN UINT8 PID
- )
-{
- //
- // Set the Packet Identification to be used for this transaction.
- //
- ptrTDStruct->TDData.TDTokenPID = PID;
-}
-
-VOID
-SetTDDataBuffer (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Set the beginning address of the data buffer that will be used
- // during the transaction.
- //
- ptrTDStruct->TDData.TDBufferPtr = (UINT32) ((UINTN) (ptrTDStruct->pTDBuffer));
-}
-
-BOOLEAN
-IsTDStatusActive (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- UINT8 TDStatus;
-
- //
- // Detect whether the TD is active.
- //
- TDStatus = (UINT8) (ptrTDStruct->TDData.TDStatus);
- return (BOOLEAN) (TDStatus & 0x80);
-}
-
-BOOLEAN
-IsTDStatusStalled (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- UINT8 TDStatus;
-
- //
- // Detect whether the device/endpoint addressed by this TD is stalled.
- //
- TDStatus = (UINT8) (ptrTDStruct->TDData.TDStatus);
- return (BOOLEAN) (TDStatus & 0x40);
-}
-
-BOOLEAN
-IsTDStatusBufferError (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- UINT8 TDStatus;
- //
- // Detect whether Data Buffer Error is happened.
- //
- TDStatus = (UINT8) (ptrTDStruct->TDData.TDStatus);
- return (BOOLEAN) (TDStatus & 0x20);
-}
-
-BOOLEAN
-IsTDStatusBabbleError (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- UINT8 TDStatus;
-
- //
- // Detect whether Babble Error is happened.
- //
- TDStatus = (UINT8) (ptrTDStruct->TDData.TDStatus);
- return (BOOLEAN) (TDStatus & 0x10);
-}
-
-BOOLEAN
-IsTDStatusNAKReceived (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- UINT8 TDStatus;
-
- //
- // Detect whether NAK is received.
- //
- TDStatus = (UINT8) (ptrTDStruct->TDData.TDStatus);
- return (BOOLEAN) (TDStatus & 0x08);
-}
-
-BOOLEAN
-IsTDStatusCRCTimeOutError (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- UINT8 TDStatus;
-
- //
- // Detect whether CRC/Time Out Error is encountered.
- //
- TDStatus = (UINT8) (ptrTDStruct->TDData.TDStatus);
- return (BOOLEAN) (TDStatus & 0x04);
-}
-
-BOOLEAN
-IsTDStatusBitStuffError (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- UINT8 TDStatus;
-
- //
- // Detect whether Bitstuff Error is received.
- //
- TDStatus = (UINT8) (ptrTDStruct->TDData.TDStatus);
- return (BOOLEAN) (TDStatus & 0x02);
-}
-
-UINT16
-GetTDStatusActualLength (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Retrieve the actual number of bytes that were tansferred.
- // the value is encoded as n-1. so return the decoded value.
- //
- return (UINT16) ((ptrTDStruct->TDData.TDStatusActualLength) + 1);
-}
-
-UINT16
-GetTDTokenMaxLength (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Retrieve the maximum number of data bytes allowed for the trnasfer.
- //
- return (UINT16) ((ptrTDStruct->TDData.TDTokenMaxLen) + 1);
-}
-
-UINT8
-GetTDTokenEndPoint (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Retrieve the endpoint number the transaction is targeting at.
- //
- return (UINT8) (ptrTDStruct->TDData.TDTokenEndPt);
-}
-
-UINT8
-GetTDTokenDeviceAddress (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Retrieve the device address the transaction is targeting at.
- //
- return (UINT8) (ptrTDStruct->TDData.TDTokenDevAddr);
-}
-
-UINT8
-GetTDTokenPacketID (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Retrieve the Packet Identification information.
- //
- return (UINT8) (ptrTDStruct->TDData.TDTokenPID);
-}
-
-UINT8 *
-GetTDDataBuffer (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Retrieve the beginning address of the data buffer
- // that involved in this transaction.
- //
- return ptrTDStruct->pTDBuffer;
-}
-
-BOOLEAN
-GetTDLinkPtrValidorInvalid (
- IN TD_STRUCT *ptrTDStruct
- )
-{
- //
- // Retrieve the information of whether the Link Pointer field
- // is valid or not.
- //
- if (ptrTDStruct->TDData.TDLinkPtrTerminate) {
- return FALSE;
- } else {
- return TRUE;
- }
-
-}
-
-UINTN
-CountTDsNumber (
- IN TD_STRUCT *PtrFirstTD
- )
-{
- UINTN Number;
- TD_STRUCT *ptr;
- //
- // Count the queued TDs number.
- //
- Number = 0;
- ptr = PtrFirstTD;
- while (ptr) {
- ptr = (TD_STRUCT *) ptr->ptrNextTD;
- Number++;
- }
-
- return Number;
-}
-
-
-
-VOID
-LinkTDToQH (
- IN QH_STRUCT *PtrQH,
- IN TD_STRUCT *PtrTD
- )
-/*++
-
-Routine Description:
-
- Link TD To QH
-
-Arguments:
-
- PtrQH - QH_STRUCT
- PtrTD - TD_STRUCT
-Returns:
-
- VOID
-
---*/
-{
- if (PtrQH == NULL || PtrTD == NULL) {
- return ;
- }
- //
- // Validate QH Vertical Ptr field
- //
- SetQHVerticalValidorInvalid (PtrQH, TRUE);
-
- //
- // Vertical Ptr pointing to TD structure
- //
- SetQHVerticalQHorTDSelect (PtrQH, FALSE);
-
- SetQHVerticalLinkPtr (PtrQH, (VOID *) PtrTD);
-
- PtrQH->ptrDown = (VOID *) PtrTD;
-}
-
-VOID
-LinkTDToTD (
- IN TD_STRUCT *ptrPreTD,
- IN TD_STRUCT *PtrTD
- )
-/*++
-
-Routine Description:
-
- Link TD To TD
-
-Arguments:
-
- ptrPreTD - Previous TD_STRUCT to be linked
- PtrTD - TD_STRUCT to link
-Returns:
-
- VOID
-
---*/
-{
- if (ptrPreTD == NULL || PtrTD == NULL) {
- return ;
- }
- //
- // Depth first fashion
- //
- SetTDLinkPtrDepthorBreadth (ptrPreTD, TRUE);
-
- //
- // Link pointer pointing to TD struct
- //
- SetTDLinkPtrQHorTDSelect (ptrPreTD, FALSE);
-
- //
- // Validate the link pointer valid bit
- //
- SetTDLinkPtrValidorInvalid (ptrPreTD, TRUE);
-
- SetTDLinkPtr (ptrPreTD, PtrTD);
-
- ptrPreTD->ptrNextTD = (VOID *) PtrTD;
-}
-//
-// Transfer Schedule related Helper Functions
-//
-VOID
-SetorClearCurFrameListTerminate (
- IN FRAMELIST_ENTRY *pCurEntry,
- IN BOOLEAN IsSet
- )
-{
- //
- // If TRUE, empty the frame. If FALSE, indicate the Pointer field is valid.
- //
- pCurEntry->FrameListPtrTerminate = (IsSet ? 1 : 0);
-}
-
-VOID
-SetCurFrameListQHorTD (
- IN FRAMELIST_ENTRY *pCurEntry,
- IN BOOLEAN IsQH
- )
-{
- //
- // This bit indicates to the hardware whether the item referenced by the
- // link pointer is a TD or a QH.
- //
- pCurEntry->FrameListPtrQSelect = (IsQH ? 1 : 0);
-}
-
-STATIC
-BOOLEAN
-IsCurFrameListQHorTD (
- IN FRAMELIST_ENTRY *pCurEntry
- )
-{
- //
- // TRUE is QH
- // FALSE is TD
- //
- return (BOOLEAN) (pCurEntry->FrameListPtrQSelect);
-}
-
-BOOLEAN
-GetCurFrameListTerminate (
- IN FRAMELIST_ENTRY *pCurEntry
- )
-{
- //
- // TRUE means the frame is empty,
- // FALSE means the link pointer field is valid.
- //
- return (BOOLEAN) (pCurEntry->FrameListPtrTerminate);
-}
-
-VOID
-SetCurFrameListPointer (
- IN FRAMELIST_ENTRY *pCurEntry,
- IN UINT8 *ptr
- )
-{
- //
- // Set the pointer field of the frame.
- //
- pCurEntry->FrameListPtr = (UINT32) ((UINTN) ptr >> 4);
-}
-
-VOID *
-GetCurFrameListPointer (
- IN FRAMELIST_ENTRY *pCurEntry
- )
-{
- //
- // Get the link pointer of the frame.
- //
- return (VOID *) ((UINTN) (pCurEntry->FrameListPtr << 4));
-
-}
-
-VOID
-LinkQHToFrameList (
- IN FRAMELIST_ENTRY *pEntry,
- IN UINT16 FrameListIndex,
- IN QH_STRUCT *PtrQH
- )
-/*++
-
-Routine Description:
-
- Link QH To Frame List
-
-Arguments:
-
- pEntry - FRAMELIST_ENTRY
- FrameListIndex - Frame List Index
- PtrQH - QH to link
-Returns:
-
- VOID
-
---*/
-{
- FRAMELIST_ENTRY *pCurFrame;
- QH_STRUCT *TempQH;
- QH_STRUCT *NextTempQH;
- TD_STRUCT *TempTD;
- BOOLEAN LINK;
-
- //
- // Get frame list entry that the link process will begin from.
- //
- pCurFrame = pEntry + FrameListIndex;
-
- //
- // if current frame is empty
- // then link the specified QH directly to the Frame List.
- //
- if (GetCurFrameListTerminate (pCurFrame)) {
-
- //
- // Link new QH to the frame list entry.
- //
- SetCurFrameListQHorTD (pCurFrame, TRUE);
-
- SetCurFrameListPointer (pCurFrame, (UINT8 *) PtrQH);
-
- //
- // clear T bit in the Frame List, indicating that the frame list entry
- // is no longer empty.
- //
- SetorClearCurFrameListTerminate (pCurFrame, FALSE);
-
- return ;
-
- } else {
- //
- // current frame list has link pointer
- //
- if (!IsCurFrameListQHorTD (pCurFrame)) {
- //
- // a TD is linked to the framelist entry
- //
- TempTD = (TD_STRUCT *) GetCurFrameListPointer (pCurFrame);
-
- while (GetTDLinkPtrValidorInvalid (TempTD)) {
-
- if (IsTDLinkPtrQHOrTD (TempTD)) {
- //
- // QH linked next to the TD
- //
- break;
- }
-
- TempTD = (TD_STRUCT *) GetTDLinkPtr (TempTD);
- }
-
- //
- // either no ptr linked next to the TD or QH is linked next to the TD
- //
- if (!GetTDLinkPtrValidorInvalid (TempTD)) {
-
- //
- // no ptr linked next to the TD
- //
- TempTD->ptrNextQH = PtrQH;
- SetTDLinkPtrQHorTDSelect (TempTD, TRUE);
- SetTDLinkPtr (TempTD, PtrQH);
- SetTDLinkPtrValidorInvalid (TempTD, TRUE);
- return ;
-
- } else {
- //
- // QH is linked next to the TD
- //
- TempQH = (QH_STRUCT *) GetTDLinkPtr (TempTD);
- }
- } else {
- //
- // a QH is linked to the framelist entry
- //
- TempQH = (QH_STRUCT *) GetCurFrameListPointer (pCurFrame);
- }
-
- //
- // Set up Flag
- //
- LINK = TRUE;
-
- //
- // Avoid the same qh repeated linking in one frame entry
- //
- if (TempQH == PtrQH) {
- LINK = FALSE;
- return ;
- }
- //
- // if current QH has next QH connected
- //
- while (GetQHHorizontalValidorInvalid (TempQH)) {
- //
- // Get next QH pointer
- //
- NextTempQH = (QH_STRUCT *) GetQHHorizontalLinkPtr (TempQH);
-
- //
- // Bulk transfer qh may be self-linked,
- // so, the code below is to aVOID dead-loop when meeting self-linked qh
- //
- if (NextTempQH == TempQH) {
- LINK = FALSE;
- break;
- }
-
- TempQH = NextTempQH;
-
- //
- // Avoid the same qh repeated linking in one frame entry
- //
- if (TempQH == PtrQH) {
- LINK = FALSE;
- }
- }
-
- if (LINK) {
- TempQH->ptrNext = PtrQH;
- SetQHHorizontalQHorTDSelect (TempQH, TRUE);
- SetQHHorizontalLinkPtr (TempQH, PtrQH);
- SetQHHorizontalValidorInvalid (TempQH, TRUE);
- }
-
- return ;
- }
-}
-
-EFI_STATUS
-ExecuteControlTransfer (
- IN USB_HC_DEV *HcDev,
- IN TD_STRUCT *PtrTD,
- IN UINT32 wIndex,
- OUT UINTN *ActualLen,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- )
-/*++
-
-Routine Description:
-
- Execute Control Transfer
-
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrTD - TD_STRUCT
- wIndex - No use
- ActualLen - Actual transfered Len
- TimeOut - TimeOut value in milliseconds
- TransferResult - Transfer result
-Returns:
-
- EFI_SUCCESS - Sucess
- EFI_DEVICE_ERROR - Error
-
-
---*/
-{
- UINTN ErrTDPos;
- UINTN Delay;
- UINTN RequiredLen;
- BOOLEAN TransferFinished;
-
- ErrTDPos = 0;
- *TransferResult = EFI_USB_NOERROR;
- RequiredLen = *ActualLen;
- *ActualLen = 0;
-
- Delay = (TimeOut * STALL_1_MILLI_SECOND / 50) + 1;
-
- do {
- TransferFinished = CheckTDsResults (
- PtrTD,
- RequiredLen,
- TransferResult,
- &ErrTDPos,
- ActualLen
- );
-
- if (TransferFinished) {
- break;
- }
-
- //
- // TD is inactive, which means the control transfer is end.
- //
- if ((*TransferResult & EFI_USB_ERR_NOTEXECUTE) != EFI_USB_ERR_NOTEXECUTE) {
- break;
- }
-
- gBS->Stall (50);
-
- } while (Delay--);
-
- if (*TransferResult != EFI_USB_NOERROR) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ExecBulkorSyncInterruptTransfer (
- IN USB_HC_DEV *HcDev,
- IN TD_STRUCT *PtrTD,
- IN UINT32 wIndex,
- OUT UINTN *ActualLen,
- OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- )
-/*++
-
-Routine Description:
-
- Execute Bulk or SyncInterrupt Transfer
-
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrTD - TD_STRUCT
- wIndex - No use
- ActualLen - Actual transfered Len
- DataToggle - Data Toggle
- TimeOut - TimeOut value in milliseconds
- TransferResult - Transfer result
-Returns:
-
- EFI_SUCCESS - Sucess
- EFI_DEVICE_ERROR - Error
---*/
-{
- UINTN ErrTDPos;
- UINTN ScrollNum;
- UINTN Delay;
- UINTN RequiredLen;
- BOOLEAN TransferFinished;
-
- ErrTDPos = 0;
- *TransferResult = EFI_USB_NOERROR;
- RequiredLen = *ActualLen;
- *ActualLen = 0;
-
- Delay = (TimeOut * STALL_1_MILLI_SECOND / 50) + 1;
-
- do {
-
- TransferFinished = CheckTDsResults (
- PtrTD,
- RequiredLen,
- TransferResult,
- &ErrTDPos,
- ActualLen
- );
-
- if (TransferFinished) {
- break;
- }
-
- //
- // TD is inactive, which means bulk or interrupt transfer's end.
- //
- if ((*TransferResult & EFI_USB_ERR_NOTEXECUTE) != EFI_USB_ERR_NOTEXECUTE) {
- break;
- }
-
- gBS->Stall (50);
-
- } while (Delay--);
-
- //
- // has error
- //
- if (*TransferResult != EFI_USB_NOERROR) {
-
- //
- // scroll the Data Toggle back to the last success TD
- //
- ScrollNum = CountTDsNumber (PtrTD) - ErrTDPos;
- if (ScrollNum & 0x1) {
- *DataToggle ^= 1;
- }
-
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-DelLinkSingleQH (
- IN USB_HC_DEV *HcDev,
- IN QH_STRUCT *PtrQH,
- IN UINT16 FrameListIndex,
- IN BOOLEAN SearchOther,
- IN BOOLEAN Delete
- )
-/*++
-
-Routine Description:
-
- Unlink from frame list and delete single QH
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrQH - QH_STRUCT
- FrameListIndex - Frame List Index
- SearchOther - Search Other QH
- Delete - TRUE is to delete the QH
-Returns:
- VOID
---*/
-{
- FRAMELIST_ENTRY *pCurFrame;
- UINTN Index;
- UINTN BeginFrame;
- UINTN EndFrame;
- QH_STRUCT *CurrentQH;
- QH_STRUCT *NextQH;
- TD_STRUCT *CurrentTD;
- VOID *PtrPreQH;
- BOOLEAN Found;
-
- NextQH = NULL;
- PtrPreQH = NULL;
- Found = FALSE;
-
- if (PtrQH == NULL) {
- return ;
- }
-
- if (SearchOther) {
- BeginFrame = 0;
- EndFrame = 1024;
- } else {
- BeginFrame = FrameListIndex;
- EndFrame = FrameListIndex + 1;
- }
-
- for (Index = BeginFrame; Index < EndFrame; Index++) {
-
- pCurFrame = HcDev->FrameListEntry + (Index & 0x3FF);
-
- if (GetCurFrameListTerminate (pCurFrame)) {
- //
- // current frame list is empty,search next frame list entry
- //
- continue;
- }
-
- if (!IsCurFrameListQHorTD (pCurFrame)) {
- //
- // TD linked to current framelist
- //
- CurrentTD = (TD_STRUCT *) GetCurFrameListPointer (pCurFrame);
-
- while (GetTDLinkPtrValidorInvalid (CurrentTD)) {
-
- if (IsTDLinkPtrQHOrTD (CurrentTD)) {
- //
- // QH linked next to the TD,break while ()
- //
- break;
- }
-
- CurrentTD = (TD_STRUCT *) GetTDLinkPtr (CurrentTD);
- }
-
- if (!GetTDLinkPtrValidorInvalid (CurrentTD)) {
- //
- // no QH linked next to the last TD,
- // search next frame list
- //
- continue;
- }
-
- //
- // a QH linked next to the last TD
- //
- CurrentQH = (QH_STRUCT *) GetTDLinkPtr (CurrentTD);
-
- PtrPreQH = CurrentTD;
-
- } else {
- //
- // a QH linked to current framelist
- //
- CurrentQH = (QH_STRUCT *) GetCurFrameListPointer (pCurFrame);
-
- PtrPreQH = NULL;
- }
-
- if (CurrentQH == PtrQH) {
-
- if (GetQHHorizontalValidorInvalid (PtrQH)) {
- //
- // there is QH connected after the QH found
- //
- //
- // retrieve nex qh pointer of the qh found.
- //
- NextQH = GetQHHorizontalLinkPtr (PtrQH);
- } else {
- NextQH = NULL;
- }
-
- if (PtrPreQH) {
- //
- // QH linked to a TD struct
- //
- CurrentTD = (TD_STRUCT *) PtrPreQH;
-
- SetTDLinkPtrValidorInvalid (CurrentTD, (BOOLEAN) ((NextQH == NULL) ? FALSE : TRUE));
- SetTDLinkPtr (CurrentTD, NextQH);
- CurrentTD->ptrNextQH = NextQH;
-
- } else {
- //
- // QH linked directly to current framelist entry
- //
- SetorClearCurFrameListTerminate (pCurFrame, (BOOLEAN) ((NextQH == NULL) ? TRUE : FALSE));
- SetCurFrameListPointer (pCurFrame, (UINT8 *) NextQH);
- }
-
- Found = TRUE;
- //
- // search next framelist entry
- //
- continue;
- }
-
- while (GetQHHorizontalValidorInvalid (CurrentQH)) {
-
- PtrPreQH = CurrentQH;
- //
- // Get next horizontal linked QH
- //
- CurrentQH = (QH_STRUCT *) GetQHHorizontalLinkPtr (CurrentQH);
- //
- // the qh is found
- //
- if (CurrentQH == PtrQH) {
- break;
- }
- }
-
- //
- // search next frame list entry
- //
- if (CurrentQH != PtrQH) {
- //
- // Not find the QH
- //
- continue;
- }
- //
- // find the specified qh, then delink it from
- // the horizontal QH list in the frame entry.
- //
-
- if (GetQHHorizontalValidorInvalid (PtrQH)) {
- //
- // there is QH connected after the QH found
- //
- //
- // retrieve nex qh pointer of the qh found.
- //
- NextQH = GetQHHorizontalLinkPtr (PtrQH);
-
- } else {
- //
- // NO QH connected after the QH found
- //
- NextQH = NULL;
- //
- // NULL the previous QH's link ptr and set Terminate field.
- //
- SetQHHorizontalValidorInvalid ((QH_STRUCT *) PtrPreQH, FALSE);
- }
-
- SetQHHorizontalLinkPtr ((QH_STRUCT *) PtrPreQH, NextQH);
- ((QH_STRUCT *) PtrPreQH)->ptrNext = NextQH;
-
- Found = TRUE;
- }
-
- if (Found && Delete) {
- //
- // free memory once used by the specific QH
- //
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
- }
-
- return ;
-}
-
-
-VOID
-DeleteQueuedTDs (
- IN USB_HC_DEV *HcDev,
- IN TD_STRUCT *PtrFirstTD
- )
-/*++
-Routine Description:
-
- Delete Queued TDs
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrFirstTD - TD link list head
-
-Returns:
- VOID
-
---*/
-{
- TD_STRUCT *Tptr1;
- TD_STRUCT *Tptr2;
-
- Tptr1 = PtrFirstTD;
- //
- // Delete all the TDs in a queue.
- //
- while (Tptr1) {
-
- Tptr2 = Tptr1;
-
- if (!GetTDLinkPtrValidorInvalid (Tptr2)) {
- Tptr1 = NULL;
- } else {
-
- Tptr1 = GetTDLinkPtr (Tptr2);
-
- //
- // TD link to itself
- //
- if (Tptr1 == Tptr2) {
- Tptr1 = NULL;
- }
- }
-
- UhciFreePool (HcDev, (UINT8 *) Tptr2, sizeof (TD_STRUCT));
- }
-
- return ;
-}
-
-VOID
-InsertQHTDToINTList (
- IN USB_HC_DEV *HcDev,
- IN QH_STRUCT *PtrQH,
- IN TD_STRUCT *PtrFirstTD,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DataToggle,
- IN UINTN DataLength,
- IN UINTN PollingInterval,
- IN VOID *Mapping,
- IN UINT8 *DataBuffer,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
- IN VOID *Context
- )
-/*++
-Routine Description:
- Insert QH and TD To Interrupt List
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrQH - QH_STRUCT
- PtrFirstTD - First TD_STRUCT
- DeviceAddress - Device Address
- EndPointAddress - EndPoint Address
- DataToggle - Data Toggle
- DataLength - Data length
- PollingInterval - Polling Interval when inserted to frame list
- Mapping - Mapping alue
- DataBuffer - Data buffer
- CallBackFunction- CallBackFunction after interrupt transfeer
- Context - CallBackFunction Context passed as function parameter
-Returns:
- EFI_SUCCESS - Sucess
- EFI_INVALID_PARAMETER - Paremeter is error
-
---*/
-{
- INTERRUPT_LIST *Node;
-
- Node = AllocatePool (sizeof (INTERRUPT_LIST));
- if (Node == NULL) {
- return ;
- }
-
- //
- // Fill Node field
- //
- Node->Signature = INTERRUPT_LIST_SIGNATURE;
- Node->DevAddr = DeviceAddress;
- Node->EndPoint = EndPointAddress;
- Node->PtrQH = PtrQH;
- Node->PtrFirstTD = PtrFirstTD;
- Node->DataToggle = DataToggle;
- Node->DataLen = DataLength;
- Node->PollInterval = PollingInterval;
- Node->Mapping = Mapping;
- //
- // DataBuffer is allocated host memory, not mapped memory
- //
- Node->DataBuffer = DataBuffer;
- Node->InterruptCallBack = CallBackFunction;
- Node->InterruptContext = Context;
-
- //
- // insert the new interrupt transfer to the head of the list.
- // The interrupt transfer's monitor function scans the whole list from head
- // to tail. The new interrupt transfer MUST be added to the head of the list
- // for the sake of error recovery.
- //
- InsertHeadList (&(HcDev->InterruptListHead), &(Node->Link));
-
- return ;
-}
-
-
-EFI_STATUS
-DeleteAsyncINTQHTDs (
- IN USB_HC_DEV *HcDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- OUT UINT8 *DataToggle
- )
-/*++
-Routine Description:
-
- Delete Async INT QH and TDs
-Arguments:
-
- HcDev - USB_HC_DEV
- DeviceAddress - Device Address
- EndPointAddress - EndPoint Address
- DataToggle - Data Toggle
-
-Returns:
- EFI_SUCCESS - Sucess
- EFI_INVALID_PARAMETER - Paremeter is error
-
---*/
-{
- QH_STRUCT *MatchQH;
- QH_STRUCT *ptrNextQH;
- TD_STRUCT *MatchTD;
- LIST_ENTRY *Link;
- INTERRUPT_LIST *MatchList;
- INTERRUPT_LIST *PtrList;
- BOOLEAN Found;
-
- UINT32 Result;
- UINTN ErrTDPos;
- UINTN ActualLen;
-
- MatchQH = NULL;
- MatchTD = NULL;
- MatchList = NULL;
-
- //
- // no interrupt transaction exists
- //
- if (IsListEmpty (&(HcDev->InterruptListHead))) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // find the correct QH-TD that need to delete
- // (by matching Device address and EndPoint number to match QH-TD )
- //
- Found = FALSE;
- Link = &(HcDev->InterruptListHead);
- do {
-
- Link = Link->ForwardLink;
- PtrList = INTERRUPT_LIST_FROM_LINK (Link);
-
- if ((PtrList->DevAddr == DeviceAddress) && ((PtrList->EndPoint & 0x0f) == (EndPointAddress & 0x0f))) {
- MatchList = PtrList;
-
- Found = TRUE;
- break;
- }
-
- } while (Link->ForwardLink != &(HcDev->InterruptListHead));
-
- if (!Found) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // get current endpoint's data toggle bit and save.
- //
- ExecuteAsyncINTTDs (HcDev, MatchList, &Result, &ErrTDPos, &ActualLen);
- UpdateAsyncINTQHTDs (MatchList, Result, (UINT32) ErrTDPos);
- *DataToggle = MatchList->DataToggle;
-
- MatchTD = MatchList->PtrFirstTD;
- MatchQH = MatchList->PtrQH;
- //
- // find the first matching QH position in the FrameList
- //
- while (MatchQH) {
-
- ptrNextQH = MatchQH->ptrNextIntQH;
-
- //
- // Search all the entries
- //
- DelLinkSingleQH (HcDev, MatchQH, 0, TRUE, TRUE);
-
- MatchQH = ptrNextQH;
- }
-
- //
- // Call PciIo->Unmap() to unmap the busmaster read/write
- //
- HcDev->PciIo->Unmap (HcDev->PciIo, MatchList->Mapping);
-
- //
- // free host data buffer allocated,
- // mapped data buffer is freed by Unmap
- //
- if (MatchList->DataBuffer != NULL) {
- gBS->FreePool (MatchList->DataBuffer);
- }
-
- //
- // at last delete the TDs, to aVOID problems
- //
- DeleteQueuedTDs (HcDev, MatchTD);
-
- //
- // remove Match node from interrupt list
- //
- RemoveEntryList (&(MatchList->Link));
- gBS->FreePool (MatchList);
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-CheckTDsResults (
- IN TD_STRUCT *PtrTD,
- IN UINTN RequiredLen,
- OUT UINT32 *Result,
- OUT UINTN *ErrTDPos,
- OUT UINTN *ActualTransferSize
- )
-/*++
-
-Routine Description:
-
- Check TDs Results
-
-Arguments:
-
- PtrTD - TD_STRUCT to check
- RequiredLen - Required Len
- Result - Transfer result
- ErrTDPos - Error TD Position
- ActualTransferSize - Actual Transfer Size
-
-Returns:
-
- TRUE - Sucess
- FALSE - Fail
-
---*/
-{
- UINTN Len;
-
- *Result = EFI_USB_NOERROR;
- *ErrTDPos = 0;
-
- //
- // Init to zero.
- //
- *ActualTransferSize = 0;
-
- while (PtrTD) {
-
- if (IsTDStatusActive (PtrTD)) {
- *Result |= EFI_USB_ERR_NOTEXECUTE;
- }
-
- if (IsTDStatusStalled (PtrTD)) {
- *Result |= EFI_USB_ERR_STALL;
- }
-
- if (IsTDStatusBufferError (PtrTD)) {
- *Result |= EFI_USB_ERR_BUFFER;
- }
-
- if (IsTDStatusBabbleError (PtrTD)) {
- *Result |= EFI_USB_ERR_BABBLE;
- }
-
- if (IsTDStatusNAKReceived (PtrTD)) {
- *Result |= EFI_USB_ERR_NAK;
- }
-
- if (IsTDStatusCRCTimeOutError (PtrTD)) {
- *Result |= EFI_USB_ERR_TIMEOUT;
- }
-
- if (IsTDStatusBitStuffError (PtrTD)) {
- *Result |= EFI_USB_ERR_BITSTUFF;
- }
-
- //
- // if any error encountered, stop processing the left TDs.
- //
- if (*Result) {
- return FALSE;
- }
-
- Len = GetTDStatusActualLength (PtrTD) & 0x7FF;
- *ActualTransferSize += Len;
-
- if (*ActualTransferSize <= RequiredLen && Len < PtrTD->TDData.TDTokenMaxLen) {
- //
- // transter finished and actural length less than required length
- //
- goto Done;
- }
- //
- // Accumulate actual transferred data length in each TD.
- //
- PtrTD = (TD_STRUCT *) (PtrTD->ptrNextTD);
- //
- // Record the first Error TD's position in the queue,
- // this value is zero-based.
- //
- (*ErrTDPos)++;
- }
-
-Done:
- return TRUE;
-}
-
-
-VOID
-ExecuteAsyncINTTDs (
- IN USB_HC_DEV *HcDev,
- IN INTERRUPT_LIST *PtrList,
- OUT UINT32 *Result,
- OUT UINTN *ErrTDPos,
- OUT UINTN *ActualLen
- )
-/*++
-
-Routine Description:
-
- Execute Async Interrupt TDs
-
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrList - INTERRUPT_LIST
- Result - Transfer result
- ErrTDPos - Error TD Position
- ActualTransferSize - Actual Transfer Size
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // *ErrTDPos is zero-based value, indicating the first error TD's position
- // in the TDs' sequence.
- // *ErrTDPos value is only valid when *Result is not equal NOERROR.
- //
- UINTN RequiredLen;
-
- RequiredLen = *ActualLen;
- CheckTDsResults (PtrList->PtrFirstTD, RequiredLen, Result, ErrTDPos, ActualLen);
-
- return ;
-}
-
-
-VOID
-UpdateAsyncINTQHTDs (
- IN INTERRUPT_LIST *PtrList,
- IN UINT32 Result,
- IN UINT32 ErrTDPos
- )
-/*++
-
-Routine Description:
-
- Update Async Interrupt QH and TDs
-
-Arguments:
-
- PtrList - INTERRUPT_LIST
- Result - Transfer reslut
- ErrTDPos - Error TD Position
-
-Returns:
-
- VOID
-
---*/
-{
- QH_STRUCT *PtrFirstQH;
- QH_STRUCT *PtrQH;
- TD_STRUCT *PtrFirstTD;
- TD_STRUCT *PtrTD;
- UINT8 DataToggle;
- UINT32 Index;
-
- PtrFirstQH = PtrList->PtrQH;
- PtrFirstTD = PtrList->PtrFirstTD;
-
- DataToggle = 0;
-
- if (Result == EFI_USB_NOERROR) {
-
- PtrTD = PtrFirstTD;
- while (PtrTD) {
- DataToggle = GetTDTokenDataToggle (PtrTD);
- PtrTD = PtrTD->ptrNextTD;
- }
-
- //
- // save current DataToggle value to interrupt list.
- // this value is used for tracing the interrupt endpoint DataToggle.
- // when this interrupt transfer is deleted, the last DataToggle is saved
- //
- PtrList->DataToggle = DataToggle;
-
- PtrTD = PtrFirstTD;
-
- //
- // Since DataToggle bit should toggle after each success transaction,
- // the First TD's DataToggle bit will be updated to XOR of Last TD's
- // DataToggle bit. If the First TD's DataToggle bit is not equal Last
- // TD's DataToggle bit, that means it already be the XOR of Last TD's,
- // so no update is needed.
- //
- if (DataToggle == GetTDTokenDataToggle (PtrFirstTD)) {
- PtrTD = PtrFirstTD;
- while (PtrTD) {
-
- DataToggle ^= 1;
- if (DataToggle) {
- SetTDTokenDataToggle1 (PtrTD);
- } else {
- SetTDTokenDataToggle0 (PtrTD);
- }
-
- PtrTD = PtrTD->ptrNextTD;
- }
- }
- //
- // restore Link Pointer of QH to First TD
- // (because QH's Link Pointer will change during TD execution)
- //
- PtrQH = PtrFirstQH;
- while (PtrQH) {
-
- LinkTDToQH (PtrQH, PtrFirstTD);
- PtrQH = PtrQH->ptrNextIntQH;
- }
-
- //
- // set all the TDs active
- //
- PtrTD = PtrFirstTD;
- while (PtrTD) {
- SetTDStatusActiveorInactive (PtrTD, TRUE);
- PtrTD = PtrTD->ptrNextTD;
- }
-
- } else if (((Result & EFI_USB_ERR_NOTEXECUTE) == EFI_USB_ERR_NOTEXECUTE) ||
- ((Result & EFI_USB_ERR_NAK) == EFI_USB_ERR_NAK)
- ) {
- //
- // no update
- //
- } else {
- //
- // Have Errors
- //
- PtrTD = PtrFirstTD;
- //
- // not first TD error
- //
- if (ErrTDPos != 0) {
- //
- // get the last success TD
- //
- for (Index = 1; Index < ErrTDPos; Index++) {
- PtrTD = PtrTD->ptrNextTD;
- }
- //
- // update Data Toggle in the interrupt list node
- //
- PtrList->DataToggle = GetTDTokenDataToggle (PtrTD);
-
- //
- // get the error TD
- //
- PtrTD = PtrTD->ptrNextTD;
-
- } else {
- PtrList->DataToggle = GetTDTokenDataToggle (PtrTD);
- }
- //
- // do not restore the QH's vertical link pointer,
- // let the callback function do the rest of error handling.
- //
- }
-
- return ;
-}
-
-VOID
-ReleaseInterruptList (
- IN USB_HC_DEV *HcDev,
- IN LIST_ENTRY *ListHead
- )
-/*++
-
-Routine Description:
-
- Release Interrupt List
-Arguments:
-
- HcDev - USB_HC_DEV
- ListHead - List head
-
-Returns:
-
- VOID
-
---*/
-{
- LIST_ENTRY *Link;
- LIST_ENTRY *SavedLink;
- INTERRUPT_LIST *pNode;
- TD_STRUCT *PtrTD;
- TD_STRUCT *ptrNextTD;
- QH_STRUCT *PtrQH;
- QH_STRUCT *SavedQH;
-
- if (ListHead == NULL) {
- return ;
- }
-
- Link = ListHead;
-
- //
- // Free all the resources in the interrupt list
- //
- SavedLink = Link->ForwardLink;
- while (!IsListEmpty (ListHead)) {
-
- Link = SavedLink;
-
- SavedLink = Link->ForwardLink;
-
- pNode = INTERRUPT_LIST_FROM_LINK (Link);
-
- RemoveEntryList (&pNode->Link);
-
- SavedQH = pNode->PtrQH;
- for (PtrQH = SavedQH; PtrQH != NULL; PtrQH = SavedQH) {
- SavedQH = PtrQH->ptrNextIntQH;
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
- }
-
- PtrTD = pNode->PtrFirstTD;
- while (PtrTD != NULL) {
-
- ptrNextTD = PtrTD->ptrNextTD;
- UhciFreePool (HcDev, (UINT8 *) PtrTD, sizeof (TD_STRUCT));
- PtrTD = ptrNextTD;
- }
-
- gBS->FreePool (pNode);
- }
-}
-
-
-EFI_STATUS
-InitializeMemoryManagement (
- IN USB_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Initialize Memory Management
-
-Arguments:
-
- HcDev - USB_HC_DEV
-
-Returns:
-
- EFI_SUCCESS - Success
---*/
-{
- MEMORY_MANAGE_HEADER *MemoryHeader;
- EFI_STATUS Status;
- UINTN MemPages;
-
- MemPages = NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES;
- Status = CreateMemoryBlock (HcDev, &MemoryHeader, MemPages);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- HcDev->MemoryHeader = MemoryHeader;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CreateMemoryBlock (
- IN USB_HC_DEV *HcDev,
- OUT MEMORY_MANAGE_HEADER **MemoryHeader,
- IN UINTN MemoryBlockSizeInPages
- )
-/*++
-
-Routine Description:
-
- Use PciIo->AllocateBuffer to allocate common buffer for the memory block,
- and use PciIo->Map to map the common buffer for Bus Master Read/Write.
-
-
-Arguments:
-
- HcDev - USB_HC_DEV
- MemoryHeader - MEMORY_MANAGE_HEADER to output
- MemoryBlockSizeInPages - MemoryBlockSizeInPages
-Returns:
-
- EFI_SUCCESS - Success
---*/
-{
- EFI_STATUS Status;
- VOID *CommonBuffer;
- EFI_PHYSICAL_ADDRESS MappedAddress;
- UINTN MemoryBlockSizeInBytes;
- VOID *Mapping;
-
- //
- // Allocate memory for MemoryHeader
- //
- *MemoryHeader = AllocateZeroPool (sizeof (MEMORY_MANAGE_HEADER));
- if (*MemoryHeader == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- (*MemoryHeader)->Next = NULL;
-
- //
- // set Memory block size
- //
- (*MemoryHeader)->MemoryBlockSizeInBytes = EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages);
-
- //
- // each bit in Bit Array will manage 32 bytes memory in memory block
- //
- (*MemoryHeader)->BitArraySizeInBytes = ((*MemoryHeader)->MemoryBlockSizeInBytes / 32) / 8;
-
- //
- // Allocate memory for BitArray
- //
- (*MemoryHeader)->BitArrayPtr = AllocateZeroPool ((*MemoryHeader)->BitArraySizeInBytes);
- if ((*MemoryHeader)->BitArrayPtr == NULL) {
- gBS->FreePool (*MemoryHeader);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Memory Block uses MemoryBlockSizeInPages pages,
- // and it is allocated as common buffer use.
- //
- Status = HcDev->PciIo->AllocateBuffer (
- HcDev->PciIo,
- AllocateAnyPages,
- EfiBootServicesData,
- MemoryBlockSizeInPages,
- &CommonBuffer,
- 0
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool ((*MemoryHeader)->BitArrayPtr);
- gBS->FreePool (*MemoryHeader);
- return Status;
- }
-
- MemoryBlockSizeInBytes = EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages);
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterCommonBuffer,
- CommonBuffer,
- &MemoryBlockSizeInBytes,
- &MappedAddress,
- &Mapping
- );
- //
- // if returned Mapped size is less than the size we request,do not support.
- //
- if (EFI_ERROR (Status) || (MemoryBlockSizeInBytes != EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages))) {
- HcDev->PciIo->FreeBuffer (HcDev->PciIo, MemoryBlockSizeInPages, CommonBuffer);
- gBS->FreePool ((*MemoryHeader)->BitArrayPtr);
- gBS->FreePool (*MemoryHeader);
- return EFI_UNSUPPORTED;
- }
- //
- // Set Memory block initial address
- //
- (*MemoryHeader)->MemoryBlockPtr = (UINT8 *) ((UINTN) MappedAddress);
- (*MemoryHeader)->Mapping = Mapping;
-
- ZeroMem (
- (*MemoryHeader)->MemoryBlockPtr,
- EFI_PAGES_TO_SIZE (MemoryBlockSizeInPages)
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FreeMemoryHeader (
- IN USB_HC_DEV *HcDev,
- IN MEMORY_MANAGE_HEADER *MemoryHeader
- )
-/*++
-
-Routine Description:
-
- Free Memory Header
-
-Arguments:
-
- HcDev - USB_HC_DEV
- MemoryHeader - MemoryHeader to be freed
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
-
---*/
-{
- if ((MemoryHeader == NULL) || (HcDev == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // unmap the common buffer used by the memory block
- //
- HcDev->PciIo->Unmap (HcDev->PciIo, MemoryHeader->Mapping);
-
- //
- // free common buffer
- //
- HcDev->PciIo->FreeBuffer (
- HcDev->PciIo,
- EFI_SIZE_TO_PAGES (MemoryHeader->MemoryBlockSizeInBytes),
- MemoryHeader->MemoryBlockPtr
- );
- //
- // free bit array
- //
- gBS->FreePool (MemoryHeader->BitArrayPtr);
- //
- // free memory header
- //
- gBS->FreePool (MemoryHeader);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UhciAllocatePool (
- IN USB_HC_DEV *HcDev,
- OUT UINT8 **Pool,
- IN UINTN AllocSize
- )
-/*++
-
-Routine Description:
-
- Uhci Allocate Pool
-
-Arguments:
-
- HcDev - USB_HC_DEV
- Pool - Place to store pointer to the memory buffer
- AllocSize - Alloc Size
-
-Returns:
-
- EFI_SUCCESS - Success
-
---*/
-{
- MEMORY_MANAGE_HEADER *MemoryHeader;
- MEMORY_MANAGE_HEADER *TempHeaderPtr;
- MEMORY_MANAGE_HEADER *NewMemoryHeader;
- UINTN RealAllocSize;
- UINTN MemoryBlockSizeInPages;
- EFI_STATUS Status;
-
- *Pool = NULL;
-
- MemoryHeader = HcDev->MemoryHeader;
- ASSERT (MemoryHeader != NULL);
-
- //
- // allocate unit is 32 bytes (align on 32 byte)
- //
- if (AllocSize & 0x1F) {
- RealAllocSize = (AllocSize / 32 + 1) * 32;
- } else {
- RealAllocSize = AllocSize;
- }
-
- //
- // There may be linked MemoryHeaders.
- // To allocate a free pool in Memory blocks,
- // must search in the MemoryHeader link list
- // until enough free pool is found.
- //
- Status = EFI_NOT_FOUND;
- for (TempHeaderPtr = MemoryHeader; TempHeaderPtr != NULL;
- TempHeaderPtr = TempHeaderPtr->Next) {
-
- Status = AllocMemInMemoryBlock (
- TempHeaderPtr,
- (VOID **) Pool,
- RealAllocSize / 32
- );
- if (!EFI_ERROR (Status)) {
- ZeroMem (*Pool, AllocSize);
- return EFI_SUCCESS;
- }
- }
-
- //
- // There is no enough memory,
- // Create a new Memory Block
- //
-
- //
- // if pool size is larger than NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES,
- // just allocate a large enough memory block.
- //
- if (RealAllocSize > EFI_PAGES_TO_SIZE (NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES)) {
- MemoryBlockSizeInPages = EFI_SIZE_TO_PAGES (RealAllocSize) + 1;
- } else {
- MemoryBlockSizeInPages = NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES;
- }
-
- Status = CreateMemoryBlock (HcDev, &NewMemoryHeader, MemoryBlockSizeInPages);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Link the new Memory Block to the Memory Header list
- //
- InsertMemoryHeaderToList (MemoryHeader, NewMemoryHeader);
-
- Status = AllocMemInMemoryBlock (
- NewMemoryHeader,
- (VOID **) Pool,
- RealAllocSize / 32
- );
-
- if (!EFI_ERROR (Status)) {
- ZeroMem (*Pool, AllocSize);
- }
-
- return Status;
-}
-
-VOID
-UhciFreePool (
- IN USB_HC_DEV *HcDev,
- IN UINT8 *Pool,
- IN UINTN AllocSize
- )
-/*++
-
-Routine Description:
-
- Uhci Free Pool
-
-Arguments:
-
- HcDev - USB_HC_DEV
- Pool - Pool to free
- AllocSize - Pool size
-
-Returns:
-
- VOID
-
---*/
-{
- MEMORY_MANAGE_HEADER *MemoryHeader;
- MEMORY_MANAGE_HEADER *TempHeaderPtr;
- UINTN StartBytePos;
- UINTN Index;
- UINT8 StartBitPos;
- UINT8 Index2;
- UINTN Count;
- UINTN RealAllocSize;
-
- MemoryHeader = HcDev->MemoryHeader;
-
- //
- // allocate unit is 32 byte (align on 32 byte)
- //
- if (AllocSize & 0x1F) {
- RealAllocSize = (AllocSize / 32 + 1) * 32;
- } else {
- RealAllocSize = AllocSize;
- }
- //
- // scan the memory header linked list for
- // the asigned memory to free.
- //
- for (TempHeaderPtr = MemoryHeader;TempHeaderPtr != NULL;
- TempHeaderPtr = TempHeaderPtr->Next) {
-
- if ((Pool >= TempHeaderPtr->MemoryBlockPtr) &&
- ((Pool + RealAllocSize) <= (TempHeaderPtr->MemoryBlockPtr + TempHeaderPtr->MemoryBlockSizeInBytes))
- ) {
- //
- // Pool is in the Memory Block area,
- // find the start byte and bit in the bit array
- //
- StartBytePos = ((Pool - TempHeaderPtr->MemoryBlockPtr) / 32) / 8;
- StartBitPos = (UINT8) (((Pool - TempHeaderPtr->MemoryBlockPtr) / 32) & 0x7);
-
- //
- // reset associated bits in bit arry
- //
- for (Index = StartBytePos, Index2 = StartBitPos, Count = 0; Count < (RealAllocSize / 32); Count++) {
-
- TempHeaderPtr->BitArrayPtr[Index] = (UINT8) (TempHeaderPtr->BitArrayPtr[Index] ^ bit (Index2));
- Index2++;
- if (Index2 == 8) {
- Index += 1;
- Index2 = 0;
- }
- }
- //
- // break the loop
- //
- break;
- }
- }
-
- //
- // Release emptied memory blocks (only if the memory block is not
- // the first one in the memory header list
- //
- for (TempHeaderPtr = MemoryHeader->Next; TempHeaderPtr != NULL;) {
- //
- // Debug
- //
- ASSERT (MemoryHeader->Next != NULL);
-
- if (IsMemoryBlockEmptied (TempHeaderPtr)) {
-
- DelinkMemoryBlock (MemoryHeader, TempHeaderPtr);
- //
- // when the TempHeaderPtr is freed in FreeMemoryHeader(),
- // the TempHeaderPtr is pointing to nonsense content.
- //
- FreeMemoryHeader (HcDev, TempHeaderPtr);
- //
- // reset the TempHeaderPtr, continue search for
- // another empty memory block.
- //
- TempHeaderPtr = MemoryHeader->Next;
- continue;
- }
-
- TempHeaderPtr = TempHeaderPtr->Next;
- }
-}
-
-VOID
-InsertMemoryHeaderToList (
- IN MEMORY_MANAGE_HEADER *MemoryHeader,
- IN MEMORY_MANAGE_HEADER *NewMemoryHeader
- )
-/*++
-
-Routine Description:
-
- Insert Memory Header To List
-
-Arguments:
-
- MemoryHeader - MEMORY_MANAGE_HEADER
- NewMemoryHeader - MEMORY_MANAGE_HEADER
-
-Returns:
-
- VOID
-
---*/
-{
- MEMORY_MANAGE_HEADER *TempHeaderPtr;
-
- for (TempHeaderPtr = MemoryHeader; TempHeaderPtr != NULL;
- TempHeaderPtr = TempHeaderPtr->Next) {
- if (TempHeaderPtr->Next == NULL) {
- TempHeaderPtr->Next = NewMemoryHeader;
- break;
- }
- }
-}
-
-EFI_STATUS
-AllocMemInMemoryBlock (
- IN MEMORY_MANAGE_HEADER *MemoryHeader,
- OUT VOID **Pool,
- IN UINTN NumberOfMemoryUnit
- )
-/*++
-
-Routine Description:
-
- Alloc Memory In MemoryBlock
-
-Arguments:
-
- MemoryHeader - MEMORY_MANAGE_HEADER
- Pool - Place to store pointer to memory
- NumberOfMemoryUnit - Number Of Memory Unit
-
-Returns:
-
- EFI_NOT_FOUND - Can't find the free memory
- EFI_SUCCESS - Success
-
---*/
-{
- UINTN TempBytePos;
- UINTN FoundBytePos;
- UINT8 Index;
- UINT8 FoundBitPos;
- UINT8 ByteValue;
- UINT8 BitValue;
- UINTN NumberOfZeros;
- UINTN Count;
-
- FoundBytePos = 0;
- FoundBitPos = 0;
- ByteValue = MemoryHeader->BitArrayPtr[0];
- NumberOfZeros = 0;
- Index = 0;
-
- for (TempBytePos = 0; TempBytePos < MemoryHeader->BitArraySizeInBytes;) {
-
- //
- // Pop out BitValue from a byte in TempBytePos.
- //
- BitValue = (UINT8) (ByteValue & 0x1);
- //
- // right shift the byte
- //
- ByteValue /= 2;
-
- if (BitValue == 0) {
- //
- // Found a free bit, the NumberOfZeros only record the number
- // of those consecutive zeros
- //
- NumberOfZeros++;
- //
- // Found enough consecutive free space, break the loop
- //
- if (NumberOfZeros >= NumberOfMemoryUnit) {
- break;
- }
- } else {
- //
- // Encountering a '1', meant the bit is ocupied.
- //
- if (NumberOfZeros >= NumberOfMemoryUnit) {
- //
- // Found enough consecutive free space,break the loop
- //
- break;
- } else {
- //
- // the NumberOfZeros only record the number of those consecutive zeros,
- // so reset the NumberOfZeros to 0 when encountering '1' before finding
- // enough consecutive '0's
- //
- NumberOfZeros = 0;
- //
- // reset the (FoundBytePos,FoundBitPos) to the position of '1'
- //
- FoundBytePos = TempBytePos;
- FoundBitPos = Index;
- }
- }
- //
- // step forward a bit
- //
- Index++;
- if (Index == 8) {
- //
- // step forward a byte, getting the byte value,
- // and reset the bit pos.
- //
- TempBytePos += 1;
- ByteValue = MemoryHeader->BitArrayPtr[TempBytePos];
- Index = 0;
- }
- }
-
- if (NumberOfZeros < NumberOfMemoryUnit) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Found enough free space.
- //
-
- //
- // The values recorded in (FoundBytePos,FoundBitPos) have two conditions:
- // 1)(FoundBytePos,FoundBitPos) record the position
- // of the last '1' before the consecutive '0's, it must
- // be adjusted to the start position of the consecutive '0's.
- // 2)the start address of the consecutive '0's is just the start of
- // the bitarray. so no need to adjust the values of
- // (FoundBytePos,FoundBitPos).
- //
- if ((MemoryHeader->BitArrayPtr[0] & bit (0)) != 0) {
- FoundBitPos += 1;
- }
-
- //
- // Have the (FoundBytePos,FoundBitPos) make sense.
- //
- if (FoundBitPos > 7) {
- FoundBytePos += 1;
- FoundBitPos -= 8;
- }
-
- //
- // Set the memory as allocated
- //
- for (TempBytePos = FoundBytePos, Index = FoundBitPos,Count = 0;
- Count < NumberOfMemoryUnit; Count ++) {
-
- MemoryHeader->BitArrayPtr[TempBytePos] = (UINT8) (MemoryHeader->BitArrayPtr[TempBytePos] | bit (Index));
- Index++;
- if (Index == 8) {
- TempBytePos += 1;
- Index = 0;
- }
- }
-
- *Pool = MemoryHeader->MemoryBlockPtr + (FoundBytePos * 8 + FoundBitPos) * 32;
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-IsMemoryBlockEmptied (
- IN MEMORY_MANAGE_HEADER *MemoryHeaderPtr
- )
-/*++
-
-Routine Description:
-
- Is Memory Block Emptied
-
-Arguments:
-
- MemoryHeaderPtr - MEMORY_MANAGE_HEADER
-
-Returns:
-
- TRUE - Empty
- FALSE - Not Empty
-
---*/
-{
- UINTN Index;
-
- for (Index = 0; Index < MemoryHeaderPtr->BitArraySizeInBytes; Index++) {
- if (MemoryHeaderPtr->BitArrayPtr[Index] != 0) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-VOID
-DelinkMemoryBlock (
- IN MEMORY_MANAGE_HEADER *FirstMemoryHeader,
- IN MEMORY_MANAGE_HEADER *NeedFreeMemoryHeader
- )
-/*++
-
-Routine Description:
-
- Delink Memory Block
-
-Arguments:
-
- FirstMemoryHeader - MEMORY_MANAGE_HEADER
- NeedFreeMemoryHeader - MEMORY_MANAGE_HEADER
-
-Returns:
-
- VOID
-
---*/
-{
- MEMORY_MANAGE_HEADER *TempHeaderPtr;
-
- if ((FirstMemoryHeader == NULL) || (NeedFreeMemoryHeader == NULL)) {
- return ;
- }
- for (TempHeaderPtr = FirstMemoryHeader; TempHeaderPtr != NULL;
- TempHeaderPtr = TempHeaderPtr->Next) {
-
- if (TempHeaderPtr->Next == NeedFreeMemoryHeader) {
- //
- // Link the before and after
- //
- TempHeaderPtr->Next = NeedFreeMemoryHeader->Next;
- break;
- }
- }
-}
-
-EFI_STATUS
-DelMemoryManagement (
- IN USB_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Delete Memory Management
-
-Arguments:
-
- HcDev - USB_HC_DEV
-
-Returns:
-
- EFI_SUCCESS - Success
-
---*/
-{
- MEMORY_MANAGE_HEADER *TempHeaderPtr;
-
- for (TempHeaderPtr = HcDev->MemoryHeader->Next; TempHeaderPtr != NULL;) {
-
- DelinkMemoryBlock (HcDev->MemoryHeader, TempHeaderPtr);
- //
- // when the TempHeaderPtr is freed in FreeMemoryHeader(),
- // the TempHeaderPtr is pointing to nonsense content.
- //
- FreeMemoryHeader (HcDev, TempHeaderPtr);
- //
- // reset the TempHeaderPtr,continue free another memory block.
- //
- TempHeaderPtr = HcDev->MemoryHeader->Next;
- }
-
- FreeMemoryHeader (HcDev, HcDev->MemoryHeader);
-
- return EFI_SUCCESS;
-}
-
-
-VOID
-CleanUsbTransactions (
- IN USB_HC_DEV *HcDev
- )
-{
- //
- // only asynchronous interrupt transfers are always alive on the bus
- //
- ReleaseInterruptList (HcDev, &(HcDev->InterruptListHead));
-}
-
-VOID
-TurnOffUSBEmulation (
- IN EFI_PCI_IO_PROTOCOL *PciIo
- )
-/*++
-
- Routine Description:
- Disable USB Emulation
- Arguments:
- PciIo - EFI_PCI_IO_PROTOCOL
- Returns:
- VOID
---*/
-{
- UINT16 Command;
-
- //
- // Disable USB Emulation
- //
- Command = 0;
- PciIo->Pci.Write (
- PciIo,
- EfiPciIoWidthUint16,
- USB_EMULATION,
- 1,
- &Command
- );
-
- return ;
-}
diff --git a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c b/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c
deleted file mode 100644
index 7cb9605..0000000
--- a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c
+++ /dev/null
@@ -1,4236 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Uhci.c
-
-Abstract:
-
-
-Revision History
---*/
-
-#include "uhci.h"
-
-//
-// UHCI Driver Global Variables
-//
-EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding = {
- UHCIDriverBindingSupported,
- UHCIDriverBindingStart,
- UHCIDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-UHCIDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- that has UsbHcProtocol installed will be supported.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_UNSUPPORTED - This driver does not support this device.
-
---*/
-{
- EFI_STATUS OpenStatus;
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- USB_CLASSC UsbClassCReg;
-
- //
- // Test whether there is PCI IO Protocol attached on the controller handle.
- //
- OpenStatus = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (OpenStatus)) {
- return OpenStatus;
- }
-
- Status = PciIo->Pci.Read (
- PciIo,
- EfiPciIoWidthUint8,
- CLASSC,
- sizeof (USB_CLASSC) / sizeof (UINT8),
- &UsbClassCReg
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_UNSUPPORTED;
- }
- //
- // Test whether the controller belongs to UHCI type
- //
- if ((UsbClassCReg.BaseCode != PCI_CLASS_SERIAL) ||
- (UsbClassCReg.SubClassCode != PCI_CLASS_SERIAL_USB) ||
- (UsbClassCReg.PI != PCI_CLASSC_PI_UHCI)) {
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return EFI_UNSUPPORTED;
- }
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-EFIAPI
-UHCIDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Starting the Usb UHCI Driver
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_UNSUPPORTED - This driver does not support this device.
- EFI_DEVICE_ERROR - This driver cannot be started due to device
- Error
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- EFI_STATUS Status;
- UINTN FlBaseAddrReg;
- EFI_PCI_IO_PROTOCOL *PciIo;
- USB_HC_DEV *HcDev;
- UINT64 Supports;
-
- HcDev = NULL;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Turn off USB emulation
- //
- TurnOffUSBEmulation (PciIo);
-
- //
- // Enable the USB Host Controller
- //
- Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationSupported,
- 0,
- &Supports
- );
- if (!EFI_ERROR (Status)) {
- Supports &= EFI_PCI_DEVICE_ENABLE;
- Status = PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationEnable,
- Supports,
- NULL
- );
- }
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_UNSUPPORTED;
- }
-
- //
- // allocate memory for UHC private data structure
- //
- HcDev = AllocateZeroPool (sizeof (USB_HC_DEV));
- if (HcDev == NULL) {
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // init EFI_USB_HC_PROTOCOL protocol interface and install the protocol
- //
- HcDev->UsbHc.Reset = UHCIReset;
- HcDev->UsbHc.GetState = UHCIGetState;
- HcDev->UsbHc.SetState = UHCISetState;
- HcDev->UsbHc.ControlTransfer = UHCIControlTransfer;
- HcDev->UsbHc.BulkTransfer = UHCIBulkTransfer;
- HcDev->UsbHc.AsyncInterruptTransfer = UHCIAsyncInterruptTransfer;
- HcDev->UsbHc.SyncInterruptTransfer = UHCISyncInterruptTransfer;
- HcDev->UsbHc.IsochronousTransfer = UHCIIsochronousTransfer;
- HcDev->UsbHc.AsyncIsochronousTransfer = UHCIAsyncIsochronousTransfer;
- HcDev->UsbHc.GetRootHubPortNumber = UHCIGetRootHubPortNumber;
- HcDev->UsbHc.GetRootHubPortStatus = UHCIGetRootHubPortStatus;
- HcDev->UsbHc.SetRootHubPortFeature = UHCISetRootHubPortFeature;
- HcDev->UsbHc.ClearRootHubPortFeature = UHCIClearRootHubPortFeature;
-
- HcDev->UsbHc.MajorRevision = 0x1;
- HcDev->UsbHc.MinorRevision = 0x1;
-
- //
- //
- // init EFI_USB2_HC_PROTOCOL protocol interface and install the protocol
- //
- HcDev->Usb2Hc.GetCapability = UHCI2GetCapability;
- HcDev->Usb2Hc.Reset = UHCI2Reset;
- HcDev->Usb2Hc.GetState = UHCI2GetState;
- HcDev->Usb2Hc.SetState = UHCI2SetState;
- HcDev->Usb2Hc.ControlTransfer = UHCI2ControlTransfer;
- HcDev->Usb2Hc.BulkTransfer = UHCI2BulkTransfer;
- HcDev->Usb2Hc.AsyncInterruptTransfer = UHCI2AsyncInterruptTransfer;
- HcDev->Usb2Hc.SyncInterruptTransfer = UHCI2SyncInterruptTransfer;
- HcDev->Usb2Hc.IsochronousTransfer = UHCI2IsochronousTransfer;
- HcDev->Usb2Hc.AsyncIsochronousTransfer = UHCI2AsyncIsochronousTransfer;
- HcDev->Usb2Hc.GetRootHubPortStatus = UHCI2GetRootHubPortStatus;
- HcDev->Usb2Hc.SetRootHubPortFeature = UHCI2SetRootHubPortFeature;
- HcDev->Usb2Hc.ClearRootHubPortFeature = UHCI2ClearRootHubPortFeature;
-
- HcDev->Usb2Hc.MajorRevision = 0x1;
- HcDev->Usb2Hc.MinorRevision = 0x1;
-
- //
- // Init UHCI private data structures
- //
- HcDev->Signature = USB_HC_DEV_SIGNATURE;
- HcDev->PciIo = PciIo;
-
- FlBaseAddrReg = USBFLBASEADD;
-
- //
- // Allocate and Init Host Controller's Frame List Entry
- //
- Status = CreateFrameList (HcDev, (UINT32) FlBaseAddrReg);
- if (EFI_ERROR (Status)) {
-
- if (HcDev != NULL) {
- gBS->FreePool (HcDev);
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Init interrupt list head in the HcDev structure.
- //
- InitializeListHead (&(HcDev->InterruptListHead));
-
- //
- // Create timer for interrupt transfer result polling
- //
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- MonitorInterruptTrans,
- HcDev,
- &HcDev->InterruptTransTimer
- );
- if (EFI_ERROR (Status)) {
-
- FreeFrameListEntry (HcDev);
-
- if (HcDev != NULL) {
- gBS->FreePool (HcDev);
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_UNSUPPORTED;
- }
-
- //
- // Here set interrupt transfer polling timer in 50ms unit.
- //
- Status = gBS->SetTimer (
- HcDev->InterruptTransTimer,
- TimerPeriodic,
- INTERRUPT_POLLING_TIME
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (HcDev->InterruptTransTimer);
-
- FreeFrameListEntry (HcDev);
-
- if (HcDev != NULL) {
- gBS->FreePool (HcDev);
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_UNSUPPORTED;
- }
-
- //
- // QH,TD structures must in common buffer that will be
- // accessed by both cpu and usb bus master at the same time.
- // so, there must has memory management for QH,TD structures.
- //
- Status = InitializeMemoryManagement (HcDev);
- if (EFI_ERROR (Status)) {
-
- gBS->CloseEvent (HcDev->InterruptTransTimer);
-
- FreeFrameListEntry (HcDev);
-
- if (HcDev != NULL) {
- gBS->FreePool (HcDev);
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
-
- //
- // Install Host Controller Protocol
- //
- Status = gBS->InstallProtocolInterface (
- &Controller,
- &gEfiUsbHcProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &HcDev->UsbHc
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (HcDev->InterruptTransTimer);
- FreeFrameListEntry (HcDev);
- DelMemoryManagement (HcDev);
-
- if (HcDev != NULL) {
- gBS->FreePool (HcDev);
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
-
- //
- // Install USB2.0 Host Controller Protocol
- //
- Status = gBS->InstallProtocolInterface (
- &Controller,
- &gEfiUsb2HcProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &HcDev->Usb2Hc
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (HcDev->InterruptTransTimer);
- FreeFrameListEntry (HcDev);
- DelMemoryManagement (HcDev);
-
- if (HcDev != NULL) {
- gBS->FreePool (HcDev);
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
- }
-
- //
- // component name protocol.
- //
-
- HcDev->ControllerNameTable = NULL;
- AddUnicodeString (
- "eng",
- gUhciComponentName.SupportedLanguages,
- &HcDev->ControllerNameTable,
- (CHAR16 *) L"Usb Universal Host Controller"
- );
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-UnInstallUHCInterface (
- IN EFI_HANDLE Controller,
- IN EFI_USB_HC_PROTOCOL *This
- )
-/*++
- Routine Description:
- UnInstall UHCInterface
- Arguments:
- Controller - Controller handle
- This - Protocol instance pointer.
- Returns:
- EFI_SUCCESS
- others
---*/
-{
- USB_HC_DEV *HcDev;
- EFI_STATUS Status;
- UINT64 Supports;
-
- HcDev = USB_HC_DEV_FROM_THIS (This);
-
- gBS->UninstallProtocolInterface (
- Controller,
- &gEfiUsbHcProtocolGuid,
- &HcDev->UsbHc
- );
-
- gBS->UninstallProtocolInterface (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- &HcDev->Usb2Hc
- );
- //
- // first stop USB Host Controller
- //
- This->SetState (This, EfiUsbHcStateHalt);
-
- //
- // Delete interrupt transfer polling timer
- //
- gBS->CloseEvent (HcDev->InterruptTransTimer);
-
- //
- // Delete all the asynchronous interrupt transfers in the interrupt list
- // and free associated memory
- //
- ReleaseInterruptList (HcDev, &(HcDev->InterruptListHead));
-
- //
- // free Frame List Entry.
- //
- FreeFrameListEntry (HcDev);
-
- //
- // Free common buffer allocated for QH,TD structures
- //
- DelMemoryManagement (HcDev);
-
- if (HcDev->ControllerNameTable) {
- FreeUnicodeStringTable (HcDev->ControllerNameTable);
- }
- //
- // Disable the USB Host Controller
- //
- Status = HcDev->PciIo->Attributes (
- HcDev->PciIo,
- EfiPciIoAttributeOperationSupported,
- 0,
- &Supports
- );
- if (!EFI_ERROR (Status)) {
- Supports &= EFI_PCI_DEVICE_ENABLE;
- Status = HcDev->PciIo->Attributes (
- HcDev->PciIo,
- EfiPciIoAttributeOperationDisable,
- Supports,
- NULL
- );
- }
-
- gBS->FreePool (HcDev);
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-UHCIDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop this driver on ControllerHandle. Support stoping any child handles
- created by this driver.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to stop driver on
- NumberOfChildren - Number of Children in the ChildHandleBuffer
- ChildHandleBuffer - List of handles for the children we need to stop.
-
- Returns:
- EFI_SUCCESS
- others
-
---*/
-{
- EFI_USB_HC_PROTOCOL *UsbHc;
- EFI_USB2_HC_PROTOCOL *Usb2Hc;
- EFI_STATUS OpenStatus;
-
- OpenStatus = gBS->OpenProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- (VOID **)&UsbHc,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- //
- // Test whether the Controller handler passed in is a valid
- // Usb controller handle that should be supported, if not,
- // return the error status directly
- //
- if (EFI_ERROR (OpenStatus)) {
- return OpenStatus;
- }
-
- OpenStatus = gBS->OpenProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- (VOID **) &Usb2Hc,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- //
- // Test whether the Controller handler passed in is a valid
- // Usb controller handle that should be supported, if not,
- // return the error status directly
- //
- if (EFI_ERROR (OpenStatus)) {
- return OpenStatus;
- }
- //
- // free all the controller related memory and uninstall UHCI Protocol.
- //
- UnInstallUHCInterface (Controller, UsbHc);
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return EFI_SUCCESS;
-
-}
-
-
-EFI_STATUS
-EFIAPI
-UHCIReset (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT16 Attributes
- )
-/*++
-
- Routine Description:
- Provides software reset for the USB host controller.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- Attributes A bit mask of the reset operation to perform.
- See below for a list of the supported bit mask values.
-
- #define EFI_USB_HC_RESET_GLOBAL 0x0001
- #define EFI_USB_HC_RESET_HOST_CONTROLLER 0x0002
-
- EFI_USB_HC_RESET_GLOBAL
- If this bit is set, a global reset signal will be sent to the USB bus.
- This resets all of the USB bus logic, including the USB host
- controller hardware and all the devices attached on the USB bus.
- EFI_USB_HC_RESET_HOST_CONTROLLER
- If this bit is set, the USB host controller hardware will be reset.
- No reset signal will be sent to the USB bus.
-
- Returns:
- EFI_SUCCESS
- The reset operation succeeded.
- EFI_INVALID_PARAMETER
- Attributes is not valid.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to perform
- the reset operation.
---*/
-{
- BOOLEAN Match;
- USB_HC_DEV *HcDev;
- UINT32 CommandRegAddr;
- UINT32 FlBaseAddrReg;
- UINT16 Command;
- EFI_STATUS Status;
-
- Match = FALSE;
- HcDev = USB_HC_DEV_FROM_THIS (This);
-
- CommandRegAddr = (UINT32) (USBCMD);
- FlBaseAddrReg = (UINT32) (USBFLBASEADD);
-
- if ((Attributes & EFI_USB_HC_RESET_GLOBAL) != 0) {
- Match = TRUE;
- //
- // set the Global Reset bit in the command register
- //
- Status = ReadUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- &Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Command |= USBCMD_GRESET;
- Status = WriteUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Wait 50ms for root port to let reset complete
- // See UHCI spec page122 Reset signaling
- //
- gBS->Stall (ROOT_PORT_REST_TIME);
-
- //
- // Clear the Global Reset bit to zero.
- //
- Command &= ~USBCMD_GRESET;
- Status = WriteUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // UHCI spec page120 reset recovery time
- //
- gBS->Stall (PORT_RESET_RECOVERY_TIME);
- }
-
- if ((Attributes & EFI_USB_HC_RESET_HOST_CONTROLLER) != 0) {
- Match = TRUE;
- //
- // set Host Controller Reset bit to 1
- //
- Status = ReadUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- &Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Command |= USBCMD_HCRESET;
- Status = WriteUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // this bit will be reset by Host Controller when reset is completed.
- // wait 10ms to let reset complete
- //
- gBS->Stall (PORT_RESET_RECOVERY_TIME);
- }
-
- if (!Match) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Delete all old transactions on the USB bus
- //
- CleanUsbTransactions (HcDev);
-
- //
- // Initialize Universal Host Controller's Frame List Data Structure
- //
- InitFrameList (HcDev);
-
- //
- // Reset may cause Frame List Base Address Register reset to zero,
- // so set the original value back again.
- //
- SetFrameListBaseAddress (
- HcDev->PciIo,
- FlBaseAddrReg,
- (UINT32) ((UINTN) HcDev->FrameListEntry)
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UHCIGetState (
- IN EFI_USB_HC_PROTOCOL *This,
- OUT EFI_USB_HC_STATE *State
- )
-/*++
-
- Routine Description:
- Retrieves current state of the USB host controller.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- State A pointer to the EFI_USB_HC_STATE data structure that
- indicates current state of the USB host controller.
- Type EFI_USB_HC_STATE is defined below.
-
- typedef enum {
- EfiUsbHcStateHalt,
- EfiUsbHcStateOperational,
- EfiUsbHcStateSuspend,
- EfiUsbHcStateMaximum
- } EFI_USB_HC_STATE;
-
- Returns:
- EFI_SUCCESS
- The state information of the host controller was returned in State.
- EFI_INVALID_PARAMETER
- State is NULL.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to retrieve the
- host controller's current state.
---*/
-{
- USB_HC_DEV *HcDev;
- UINT32 CommandRegAddr;
- UINT32 StatusRegAddr;
- UINT16 UhcCommand;
- UINT16 UhcStatus;
- EFI_STATUS Status;
-
- if (State == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HcDev = USB_HC_DEV_FROM_THIS (This);
-
- CommandRegAddr = (UINT32) (USBCMD);
- StatusRegAddr = (UINT32) (USBSTS);
-
- Status = ReadUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- &UhcCommand
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = ReadUHCCommandReg (
- HcDev->PciIo,
- StatusRegAddr,
- &UhcStatus
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- if (UhcCommand & USBCMD_EGSM) {
- *State = EfiUsbHcStateSuspend;
- return EFI_SUCCESS;
- }
-
- if ((UhcStatus & USBSTS_HCH) == 0) {
- *State = EfiUsbHcStateOperational;
- } else {
- *State = EfiUsbHcStateHalt;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-UHCISetState (
- IN EFI_USB_HC_PROTOCOL *This,
- IN EFI_USB_HC_STATE State
- )
-/*++
-
- Routine Description:
- Sets the USB host controller to a specific state.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- State Indicates the state of the host controller that will be set.
-
- Returns:
- EFI_SUCCESS
- The USB host controller was successfully placed in the state
- specified by State.
- EFI_INVALID_PARAMETER
- State is invalid.
- EFI_DEVICE_ERROR
- Failed to set the state specified by State due to device error.
---*/
-{
- USB_HC_DEV *HcDev;
- UINT32 CommandRegAddr;
- UINT32 StatusRegAddr;
- UINT16 Command;
- EFI_USB_HC_STATE CurrentState;
- EFI_STATUS Status;
-
- HcDev = USB_HC_DEV_FROM_THIS (This);
-
- CommandRegAddr = (UINT32) (USBCMD);
- StatusRegAddr = (UINT32) (USBSTS);
-
- Status = UHCIGetState (This, &CurrentState);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (State) {
-
- case EfiUsbHcStateHalt:
- if (CurrentState == EfiUsbHcStateHalt) {
- return EFI_SUCCESS;
- }
-
- Status = ReadUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- &Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Command &= ~USBCMD_RS;
-
- Status = WriteUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- StatusRegAddr = (UINT32) (USBSTS);
- //
- // ensure the HC is in halt status after send the stop command
- //
- if (WaitForUHCHalt (HcDev->PciIo, StatusRegAddr, STALL_1_SECOND) == EFI_TIMEOUT) {
- return EFI_DEVICE_ERROR;
- }
- break;
-
- case EfiUsbHcStateOperational:
- if (IsHostSysOrProcessErr (HcDev->PciIo, StatusRegAddr)) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (CurrentState) {
-
- case EfiUsbHcStateOperational:
- return EFI_SUCCESS;
-
- case EfiUsbHcStateHalt:
- //
- // Set Run/Stop bit to 1.
- //
- Status = ReadUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- &Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Command |= USBCMD_RS | USBCMD_MAXP;
- Status = WriteUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- break;
-
- case EfiUsbHcStateSuspend:
- Status = ReadUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- &Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // FGR(Force Global Resume) bit is 0
- //
- if ((Command | (~USBCMD_FGR)) != 0xFF) {
- //
- // Write FGR bit to 1
- //
- Command |= USBCMD_FGR;
- WriteUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- Command
- );
- }
-
- //
- // wait 20ms to let resume complete
- // (20ms is specified by UHCI spec)
- //
- gBS->Stall (FORCE_GLOBAL_RESUME_TIME);
-
- //
- // Write FGR bit to 0 and EGSM(Enter Global Suspend Mode) bit to 0
- //
- Command &= ~USBCMD_FGR;
- Command &= ~USBCMD_EGSM;
- Command |= USBCMD_RS;
- WriteUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- Command
- );
- break;
-
- default:
- break;
- }
- break;
-
- case EfiUsbHcStateSuspend:
- if (CurrentState == EfiUsbHcStateSuspend) {
- return EFI_SUCCESS;
- }
-
- Status = UHCISetState (This, EfiUsbHcStateHalt);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Set Enter Global Suspend Mode bit to 1.
- //
- Status = ReadUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- &Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Command |= USBCMD_EGSM;
- Status = WriteUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- break;
-
- default:
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UHCIGetRootHubPortNumber (
- IN EFI_USB_HC_PROTOCOL *This,
- OUT UINT8 *PortNumber
- )
-/*++
-
- Routine Description:
- Retrieves the number of root hub ports.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- PortNumber A pointer to the number of the root hub ports.
-
- Returns:
- EFI_SUCCESS
- The port number was retrieved successfully.
- EFI_INVALID_PARAMETER
- PortNumber is NULL.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to
- retrieve the port number.
---*/
-{
- USB_HC_DEV *HcDev;
- UINT32 PSAddr;
- UINT16 RHPortControl;
- UINT32 Index;
- EFI_STATUS Status;
-
- HcDev = USB_HC_DEV_FROM_THIS (This);
-
- if (PortNumber == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *PortNumber = 0;
-
- for (Index = 0; Index < 2; Index++) {
- PSAddr = (UINT32) (USBPORTSC1 + Index * 2);
- Status = ReadRootPortReg (
- HcDev->PciIo,
- PSAddr,
- &RHPortControl
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Port Register content is valid
- //
- if (RHPortControl != 0xff) {
- (*PortNumber)++;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UHCIGetRootHubPortStatus (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS *PortStatus
- )
-/*++
-
- Routine Description:
- Retrieves the current status of a USB root hub port.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL.
-
- PortNumber Specifies the root hub port from which the status
- is to be retrieved. This value is zero-based. For example,
- if a root hub has two ports, then the first port is numbered 0,
- and the second port is numbered 1.
-
- PortStatus A pointer to the current port status bits and
- port status change bits.
-
- Returns:
- EFI_SUCCESS
- The status of the USB root hub port specified by PortNumber
- was returned in PortStatus.
- EFI_INVALID_PARAMETER
- PortNumber is invalid.
- EFI_DEVICE_ERROR - Can't read register
---*/
-{
- USB_HC_DEV *HcDev;
- UINT32 PSAddr;
- UINT16 RHPortStatus;
- UINT8 TotalPortNumber;
- EFI_STATUS Status;
-
- if (PortStatus == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- UHCIGetRootHubPortNumber (This, &TotalPortNumber);
- if (PortNumber >= TotalPortNumber) {
- return EFI_INVALID_PARAMETER;
- }
-
- HcDev = USB_HC_DEV_FROM_THIS (This);
- PSAddr = (UINT32) (USBPORTSC1 + PortNumber * 2);
-
- //
- // Clear port status
- //
- PortStatus->PortStatus = 0;
- PortStatus->PortChangeStatus = 0;
-
- Status = ReadRootPortReg (
- HcDev->PciIo,
- PSAddr,
- &RHPortStatus
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Fill Port Status bits
- //
-
- //
- // Current Connect Status
- //
- if (RHPortStatus & USBPORTSC_CCS) {
- PortStatus->PortStatus |= USB_PORT_STAT_CONNECTION;
- }
- //
- // Port Enabled/Disabled
- //
- if (RHPortStatus & USBPORTSC_PED) {
- PortStatus->PortStatus |= USB_PORT_STAT_ENABLE;
- }
-
- //
- // Port Suspend
- //
- if (RHPortStatus & USBPORTSC_SUSP) {
- PortStatus->PortStatus |= USB_PORT_STAT_SUSPEND;
- }
-
- //
- // Port Reset
- //
- if (RHPortStatus & USBPORTSC_PR) {
- PortStatus->PortStatus |= USB_PORT_STAT_RESET;
- }
-
- //
- // Low Speed Device Attached
- //
- if (RHPortStatus & USBPORTSC_LSDA) {
- PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED;
- }
- //
- // CHC will always return one in this bit
- //
- PortStatus->PortStatus |= USB_PORT_STAT_OWNER;
- //
- // Fill Port Status Change bits
- //
-
- //
- // Connect Status Change
- //
- if (RHPortStatus & USBPORTSC_CSC) {
- PortStatus->PortChangeStatus |= USB_PORT_STAT_C_CONNECTION;
- }
-
- //
- // Port Enabled/Disabled Change
- //
- if (RHPortStatus & USBPORTSC_PEDC) {
- PortStatus->PortChangeStatus |= USB_PORT_STAT_C_ENABLE;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UHCISetRootHubPortFeature (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-/*++
-
- Routine Description:
- Sets a feature for the specified root hub port.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL.
-
- PortNumber Specifies the root hub port whose feature
- is requested to be set.
-
- PortFeature Indicates the feature selector associated
- with the feature set request.
-
- Returns:
- EFI_SUCCESS
- The feature specified by PortFeature was set for the
- USB root hub port specified by PortNumber.
- EFI_INVALID_PARAMETER
- PortNumber is invalid or PortFeature is invalid.
- EFI_DEVICE_ERROR
- Can't read register
---*/
-{
- USB_HC_DEV *HcDev;
- UINT32 PSAddr;
- UINT32 CommandRegAddr;
- //
- // root hub port status
- //
- UINT16 RHPortControl;
- UINT16 Command;
- UINT8 TotalPortNumber;
- EFI_STATUS Status;
-
- UHCIGetRootHubPortNumber (This, &TotalPortNumber);
- if (PortNumber >= TotalPortNumber) {
- return EFI_INVALID_PARAMETER;
- }
-
- HcDev = USB_HC_DEV_FROM_THIS (This);
-
- PSAddr = (UINT32) (USBPORTSC1 + PortNumber * 2);
- CommandRegAddr = (UINT32) (USBCMD);
-
- Status = ReadRootPortReg (
- HcDev->PciIo,
- PSAddr,
- &RHPortControl
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (PortFeature) {
-
- case EfiUsbPortSuspend:
- Status = ReadUHCCommandReg (
- HcDev->PciIo,
- CommandRegAddr,
- &Command
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- if (!(Command & USBCMD_EGSM)) {
- //
- // if global suspend is not active, can set port suspend
- //
- RHPortControl &= 0xfff5;
- RHPortControl |= USBPORTSC_SUSP;
- }
- break;
-
- case EfiUsbPortReset:
- RHPortControl &= 0xfff5;
- //
- // Set the reset bit
- //
- RHPortControl |= USBPORTSC_PR;
- break;
-
- case EfiUsbPortPower:
- break;
-
- case EfiUsbPortEnable:
- RHPortControl &= 0xfff5;
- RHPortControl |= USBPORTSC_PED;
- break;
-
- default:
- return EFI_INVALID_PARAMETER;
- }
-
- WriteRootPortReg (
- HcDev->PciIo,
- PSAddr,
- RHPortControl
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UHCIClearRootHubPortFeature (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-/*++
-
- Routine Description:
- Clears a feature for the specified root hub port.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- PortNumber Specifies the root hub port whose feature
- is requested to be cleared.
-
- PortFeature Indicates the feature selector associated with the
- feature clear request.
-
- Returns:
- EFI_SUCCESS
- The feature specified by PortFeature was cleared for the
- USB root hub port specified by PortNumber.
- EFI_INVALID_PARAMETER
- PortNumber is invalid or PortFeature is invalid.
- EFI_DEVICE_ERROR
- Can't read register
---*/
-{
- USB_HC_DEV *HcDev;
- UINT32 PSAddr;
- UINT16 RHPortControl;
- UINT8 TotalPortNumber;
- EFI_STATUS Status;
-
- UHCIGetRootHubPortNumber (This, &TotalPortNumber);
-
- if (PortNumber >= TotalPortNumber) {
- return EFI_INVALID_PARAMETER;
- }
-
- HcDev = USB_HC_DEV_FROM_THIS (This);
- PSAddr = (UINT32) (USBPORTSC1 + PortNumber * 2);
-
- Status = ReadRootPortReg (
- HcDev->PciIo,
- PSAddr,
- &RHPortControl
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (PortFeature) {
- //
- // clear PORT_ENABLE feature means disable port.
- //
- case EfiUsbPortEnable:
- RHPortControl &= 0xfff5;
- RHPortControl &= ~USBPORTSC_PED;
- break;
-
- //
- // clear PORT_SUSPEND feature means resume the port.
- // (cause a resume on the specified port if in suspend mode)
- //
- case EfiUsbPortSuspend:
- RHPortControl &= 0xfff5;
- RHPortControl &= ~USBPORTSC_SUSP;
- break;
-
- //
- // no operation
- //
- case EfiUsbPortPower:
- break;
-
- //
- // clear PORT_RESET means clear the reset signal.
- //
- case EfiUsbPortReset:
- RHPortControl &= 0xfff5;
- RHPortControl &= ~USBPORTSC_PR;
- break;
-
- //
- // clear connect status change
- //
- case EfiUsbPortConnectChange:
- RHPortControl &= 0xfff5;
- RHPortControl |= USBPORTSC_CSC;
- break;
-
- //
- // clear enable/disable status change
- //
- case EfiUsbPortEnableChange:
- RHPortControl &= 0xfff5;
- RHPortControl |= USBPORTSC_PEDC;
- break;
-
- //
- // root hub does not support this request
- //
- case EfiUsbPortSuspendChange:
- break;
-
- //
- // root hub does not support this request
- //
- case EfiUsbPortOverCurrentChange:
- break;
-
- //
- // root hub does not support this request
- //
- case EfiUsbPortResetChange:
- break;
-
- default:
- return EFI_INVALID_PARAMETER;
- }
-
- WriteRootPortReg (
- HcDev->PciIo,
- PSAddr,
- RHPortControl
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UHCIControlTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN BOOLEAN IsSlowDevice,
- IN UINT8 MaximumPacketLength,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data, OPTIONAL
- IN OUT UINTN *DataLength, OPTIONAL
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
- Submits control transfer to a target USB device.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- DeviceAddress Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
-
- IsSlowDevice Indicates whether the target device is slow device
- or full-speed device.
-
- MaximumPacketLength Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
-
- Request A pointer to the USB device request that will be sent
- to the USB device.
-
- TransferDirection Specifies the data direction for the transfer.
- There are three values available, DataIn, DataOut
- and NoData.
-
- Data A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
-
- DataLength Indicates the size, in bytes, of the data buffer
- specified by Data.
-
- TimeOut Indicates the maximum time, in microseconds,
- which the transfer is allowed to complete.
-
- TransferResult A pointer to the detailed result information generated
- by this control transfer.
-
- Returns:
- EFI_SUCCESS
- The control transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The control transfer could not be completed due to a lack of resources.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The control transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The control transfer failed due to host controller or device error.
- Caller should check TranferResult for detailed error information.
-
---*/
-{
- USB_HC_DEV *HcDev;
- UINT32 StatusReg;
- UINT32 FrameNumReg;
- UINT8 PktID;
- QH_STRUCT *PtrQH;
- TD_STRUCT *PtrTD;
- TD_STRUCT *PtrPreTD;
- TD_STRUCT *PtrSetupTD;
- TD_STRUCT *PtrStatusTD;
- EFI_STATUS Status;
- UINTN Index;
- UINTN DataLen;
- UINT8 *PtrDataSource;
- UINT8 *Ptr;
- UINT8 DataToggle;
- UINT16 LoadFrameListIndex;
- UINT8 PktSize;
-
- UINT8 *RequestMappedAddress;
- VOID *RequestMapping;
- UINTN RequestLen;
-
- EFI_PHYSICAL_ADDRESS TempPtr;
- VOID *Mapping;
-
- TD_STRUCT *PtrFirstDataTD;
- TD_STRUCT *ptrLastDataTD;
- BOOLEAN FirstTD;
-
- FirstTD = FALSE;
- RequestMappedAddress = NULL;
- RequestMapping = NULL;
- Mapping = NULL;
- PtrFirstDataTD = NULL;
- ptrLastDataTD = NULL;
- PktID = INPUT_PACKET_ID;
- Mapping = NULL;
- HcDev = USB_HC_DEV_FROM_THIS (This);
- StatusReg = (UINT32) (USBSTS);
- FrameNumReg = (UINT32) (USBFRNUM);
- PtrPreTD = NULL;
- PtrTD = NULL;
-
- //
- // Parameters Checking
- //
- if (Request == NULL || TransferResult == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // if errors exist that cause host controller halt,
- // then return EFI_DEVICE_ERROR.
- //
- if (!IsStatusOK (HcDev->PciIo, StatusReg)) {
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
- *TransferResult = EFI_USB_ERR_SYSTEM;
- return EFI_DEVICE_ERROR;
- }
-
- //
- // low speed usb devices are limited to only an eight-byte
- // maximum data payload size
- //
- if (IsSlowDevice && (MaximumPacketLength != 8)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (MaximumPacketLength != 8 &&
- MaximumPacketLength != 16 &&
- MaximumPacketLength != 32 &&
- MaximumPacketLength != 64) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((TransferDirection != EfiUsbNoData) && (DataLength == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (TransferDirection) {
-
- case EfiUsbDataIn:
- PktID = INPUT_PACKET_ID;
- PtrDataSource = Data;
- DataLen = *DataLength;
-
- //
- // map the source data buffer for bus master access.
- // BusMasterWrite means cpu read
- //
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterWrite,
- PtrDataSource,
- &DataLen,
- &TempPtr,
- &Mapping
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Ptr = (UINT8 *) ((UINTN) TempPtr);
- break;
-
- case EfiUsbDataOut:
- PktID = OUTPUT_PACKET_ID;
- PtrDataSource = Data;
- DataLen = *DataLength;
-
- //
- // map the source data buffer for bus master access.
- // BusMasterRead means cpu write
- //
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterRead,
- PtrDataSource,
- &DataLen,
- &TempPtr,
- &Mapping
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Ptr = (UINT8 *) ((UINTN) TempPtr);
- break;
-
- //
- // no data stage
- //
- case EfiUsbNoData:
- if ((DataLength != NULL) && (*DataLength != 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- PktID = OUTPUT_PACKET_ID;
- PtrDataSource = NULL;
- DataLen = 0;
- Ptr = NULL;
- break;
-
- default:
- return EFI_INVALID_PARAMETER;
- }
-
- Status = ClearStatusReg (HcDev->PciIo, StatusReg);
- if (EFI_ERROR (Status)) {
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- return EFI_DEVICE_ERROR;
- }
- //
- // create QH structure and init
- //
- Status = CreateQH (HcDev, &PtrQH);
- if (EFI_ERROR (Status)) {
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- return Status;
- }
-
- //
- // map the Request for bus master access.
- // BusMasterRead means cpu write
- //
- RequestLen = sizeof (EFI_USB_DEVICE_REQUEST);
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterRead,
- (UINT8 *) Request,
- &RequestLen,
- &TempPtr,
- &RequestMapping
- );
-
- if (EFI_ERROR (Status)) {
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
- return Status;
- }
-
- RequestMappedAddress = (UINT8 *) ((UINTN) TempPtr);
-
- //
- // generate Setup Stage TD
- //
- Status = GenSetupStageTD (
- HcDev,
- DeviceAddress,
- 0,
- IsSlowDevice,
- (UINT8 *) RequestMappedAddress,
- sizeof (EFI_USB_DEVICE_REQUEST),
- &PtrSetupTD
- );
-
- if (EFI_ERROR (Status)) {
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
- HcDev->PciIo->Unmap (HcDev->PciIo, RequestMapping);
- return Status;
- }
-
- //
- // Data Stage of Control Transfer
- //
- DataToggle = 1;
- FirstTD = TRUE;
- while (DataLen > 0) {
- //
- // create TD structures and link together
- //
-
- //
- // PktSize is the data load size that each TD carries.
- //
- PktSize = (UINT8) DataLen;
- if (DataLen > MaximumPacketLength) {
- PktSize = MaximumPacketLength;
- }
-
- Status = GenDataTD (
- HcDev,
- DeviceAddress,
- 0,
- Ptr,
- PktSize,
- PktID,
- DataToggle,
- IsSlowDevice,
- &PtrTD
- );
-
- if (EFI_ERROR (Status)) {
- //
- // free all resources occupied
- //
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
- HcDev->PciIo->Unmap (HcDev->PciIo, RequestMapping);
- DeleteQueuedTDs (HcDev, PtrSetupTD);
- DeleteQueuedTDs (HcDev, PtrFirstDataTD);
- return Status;
- }
-
- //
- // Link two TDs in vertical depth
- //
- if (FirstTD) {
- PtrFirstDataTD = PtrTD;
- PtrFirstDataTD->ptrNextTD = NULL;
- FirstTD = FALSE;
- } else {
- LinkTDToTD (PtrPreTD, PtrTD);
- }
-
- PtrPreTD = PtrTD;
-
- DataToggle ^= 1;
- Ptr += PktSize;
- DataLen -= PktSize;
- }
-
- ptrLastDataTD = PtrTD;
-
- //
- // Status Stage of Control Transfer
- //
- if (PktID == OUTPUT_PACKET_ID) {
- PktID = INPUT_PACKET_ID;
- } else {
- PktID = OUTPUT_PACKET_ID;
- }
-
- //
- // create Status Stage TD structure
- //
- Status = CreateStatusTD (
- HcDev,
- DeviceAddress,
- 0,
- PktID,
- IsSlowDevice,
- &PtrStatusTD
- );
-
- if (EFI_ERROR (Status)) {
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
- HcDev->PciIo->Unmap (HcDev->PciIo, RequestMapping);
- DeleteQueuedTDs (HcDev, PtrSetupTD);
- DeleteQueuedTDs (HcDev, PtrFirstDataTD);
- return Status;
- }
-
- if (IsSlowDevice) {
- //
- // link setup TD structures to QH structure
- //
- LinkTDToQH (PtrQH, PtrSetupTD);
-
- LoadFrameListIndex = (UINT16) ((GetCurrentFrameNumber (HcDev->PciIo, FrameNumReg)) & 0x3FF);
-
- //
- // link QH-TDs to total 100 frame list entry to speed up the execution.
- //
- for (Index = 0; Index < 100; Index++) {
- LinkQHToFrameList (
- HcDev->FrameListEntry,
- (UINT16) ((LoadFrameListIndex + Index) & 0x3FF),
- PtrQH
- );
- }
- //
- // Poll QH-TDs execution and get result.
- // detail status is returned
- //
- Status = ExecuteControlTransfer (
- HcDev,
- PtrSetupTD,
- LoadFrameListIndex,
- DataLength,
- TimeOut,
- TransferResult
- );
- //
- // Remove Control Transfer QH-TDs structure from the frame list
- // and update the pointers in the Frame List
- // and other pointers in other related QH structures.
- //
- for (Index = 0; Index < 100; Index++) {
- DelLinkSingleQH (
- HcDev,
- PtrQH,
- (UINT16) ((LoadFrameListIndex + Index) & 0x3FF),
- FALSE,
- FALSE
- );
- }
- //
- // delete setup stage TD; the QH is reserved for the next stages.
- //
- DeleteQueuedTDs (HcDev, PtrSetupTD);
-
- //
- // if setup stage error, return error
- //
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // some control transfers do not have Data Stage
- //
- if (PtrFirstDataTD != NULL) {
-
- LinkTDToQH (PtrQH, PtrFirstDataTD);
- LoadFrameListIndex = (UINT16) ((GetCurrentFrameNumber (HcDev->PciIo, FrameNumReg)) & 0x3FF);
-
- for (Index = 0; Index < 500; Index++) {
- LinkQHToFrameList (
- HcDev->FrameListEntry,
- (UINT16) ((LoadFrameListIndex + Index) & 0x3FF),
- PtrQH
- );
- }
-
- Status = ExecuteControlTransfer (
- HcDev,
- PtrFirstDataTD,
- LoadFrameListIndex,
- DataLength,
- TimeOut,
- TransferResult
- );
-
- for (Index = 0; Index < 500; Index++) {
- DelLinkSingleQH (
- HcDev,
- PtrQH,
- (UINT16) ((LoadFrameListIndex + Index) & 0x3FF),
- FALSE,
- FALSE
- );
- }
- //
- // delete data stage TD; the QH is reserved for the next stage.
- //
- DeleteQueuedTDs (HcDev, PtrFirstDataTD);
- }
- //
- // if data stage error, goto done and return error
- //
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- LinkTDToQH (PtrQH, PtrStatusTD);
- //
- // get the frame list index that the QH-TDs will be linked to.
- //
- LoadFrameListIndex = (UINT16) ((GetCurrentFrameNumber (HcDev->PciIo, FrameNumReg)) & 0x3FF);
-
- for (Index = 0; Index < 100; Index++) {
- //
- // put the QH-TDs directly or indirectly into the proper place
- // in the Frame List
- //
- LinkQHToFrameList (
- HcDev->FrameListEntry,
- (UINT16) ((LoadFrameListIndex + Index) & 0x3FF),
- PtrQH
- );
- }
- //
- // Poll QH-TDs execution and get result.
- // detail status is returned
- //
- Status = ExecuteControlTransfer (
- HcDev,
- PtrStatusTD,
- LoadFrameListIndex,
- DataLength,
- TimeOut,
- TransferResult
- );
-
- //
- // Delete Control Transfer QH-TDs structure
- // and update the pointers in the Frame List
- // and other pointers in other related QH structures.
- //
- // TRUE means must search other framelistindex
- //
- for (Index = 0; Index < 100; Index++) {
- DelLinkSingleQH (
- HcDev,
- PtrQH,
- (UINT16) ((LoadFrameListIndex + Index) & 0x3FF),
- FALSE,
- FALSE
- );
- }
-
- DeleteQueuedTDs (HcDev, PtrStatusTD);
-
- } else {
- //
- // link setup stage TD with data stage TD
- //
- PtrPreTD = PtrSetupTD;
- if (PtrFirstDataTD != NULL) {
- LinkTDToTD (PtrSetupTD, PtrFirstDataTD);
- PtrPreTD = ptrLastDataTD;
- }
- //
- // link status TD with previous TD
- //
- LinkTDToTD (PtrPreTD, PtrStatusTD);
-
- //
- // link QH with TD
- //
- LinkTDToQH (PtrQH, PtrSetupTD);
-
- LoadFrameListIndex = (UINT16) ((GetCurrentFrameNumber (HcDev->PciIo, FrameNumReg)) & 0x3FF);
- for (Index = 0; Index < 500; Index++) {
- //
- // put the QH-TDs directly or indirectly into the proper place
- // in the Frame List
- //
- LinkQHToFrameList (
- HcDev->FrameListEntry,
- (UINT16) ((LoadFrameListIndex + Index) & 0x3FF),
- PtrQH
- );
- }
- //
- // Poll QH-TDs execution and get result.
- // detail status is returned
- //
- Status = ExecuteControlTransfer (
- HcDev,
- PtrSetupTD,
- LoadFrameListIndex,
- DataLength,
- TimeOut,
- TransferResult
- );
- //
- // Remove Control Transfer QH-TDs structure from the frame list
- // and update the pointers in the Frame List
- // and other pointers in other related QH structures.
- //
- for (Index = 0; Index < 500; Index++) {
- DelLinkSingleQH (
- HcDev,
- PtrQH,
- (UINT16) ((LoadFrameListIndex + Index) & 0x3FF),
- FALSE,
- FALSE
- );
- }
-
- DeleteQueuedTDs (HcDev, PtrSetupTD);
- }
-
-Done:
-
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
-
- if (Mapping != NULL) {
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- }
-
- if (RequestMapping != NULL) {
- HcDev->PciIo->Unmap (HcDev->PciIo, RequestMapping);
- }
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (!IsStatusOK (HcDev->PciIo, StatusReg)) {
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
- *TransferResult |= EFI_USB_ERR_SYSTEM;
- return EFI_DEVICE_ERROR;
- }
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
- HcDev->PciIo->Flush (HcDev->PciIo);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UHCIBulkTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
- Submits bulk transfer to a bulk endpoint of a USB device.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- DeviceAddress Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress The combination of an endpoint number and an
- endpoint direction of the target USB device.
- Each endpoint address supports data transfer in
- one direction except the control endpoint
- (whose default endpoint address is 0).
- It is the caller's responsibility to make sure that
- the EndPointAddress represents a bulk endpoint.
-
- MaximumPacketLength Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
-
- Data A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- DataLength When input, indicates the size, in bytes, of the data buffer
- specified by Data. When output, indicates the actually
- transferred data size.
-
- DataToggle A pointer to the data toggle value. On input, it indicates
- the initial data toggle value the bulk transfer should adopt;
- on output, it is updated to indicate the data toggle value
- of the subsequent bulk transfer.
-
- TimeOut Indicates the maximum time, in microseconds, which the
- transfer is allowed to complete.
-
- TransferResult A pointer to the detailed result information of the
- bulk transfer.
-
- Returns:
- EFI_SUCCESS
- The bulk transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The bulk transfer could not be submitted due to lack of resource.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The bulk transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The bulk transfer failed due to host controller or device error.
- Caller should check TranferResult for detailed error information.
-
---*/
-{
- USB_HC_DEV *HcDev;
- UINT32 StatusReg;
- UINT32 FrameNumReg;
- UINTN DataLen;
- QH_STRUCT *PtrQH;
- TD_STRUCT *PtrFirstTD;
- TD_STRUCT *PtrTD;
- TD_STRUCT *PtrPreTD;
- UINT16 LoadFrameListIndex;
- UINT16 SavedFrameListIndex;
- UINT8 PktID;
- UINT8 *PtrDataSource;
- UINT8 *Ptr;
- BOOLEAN IsFirstTD;
- EFI_STATUS Status;
- UINT32 Index;
- UINT8 PktSize;
-
- EFI_USB_DATA_DIRECTION TransferDirection;
- //
- // Used to calculate how many entries are linked to the
- // specified bulk transfer QH-TDs
- //
- UINT32 LinkTimes;
-
- BOOLEAN ShortPacketEnable;
- EFI_PHYSICAL_ADDRESS TempPtr;
- VOID *Mapping;
-
- HcDev = USB_HC_DEV_FROM_THIS (This);
- StatusReg = (UINT32) (USBSTS);
- FrameNumReg = (UINT32) (USBFRNUM);
- PktID = INPUT_PACKET_ID;
- PtrTD = NULL;
- PtrFirstTD = NULL;
- PtrPreTD = NULL;
- LinkTimes = 1;
- DataLen = 0;
- Ptr = NULL;
- ShortPacketEnable = FALSE;
- Mapping = NULL;
-
- //
- // Parameters Checking
- //
-
- if ((DataLength == NULL) ||
- (Data == NULL) ||
- (TransferResult == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (!IsStatusOK (HcDev->PciIo, StatusReg)) {
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
- *TransferResult = EFI_USB_ERR_SYSTEM;
- return EFI_DEVICE_ERROR;
- }
-
- if (*DataLength == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((*DataToggle != 1) && (*DataToggle != 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (MaximumPacketLength != 8 &&
- MaximumPacketLength != 16 &&
- MaximumPacketLength != 32 &&
- MaximumPacketLength != 64) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Enable the maximum packet size (64bytes)
- // that can be used for full speed bandwidth reclamation
- // at the end of a frame.
- //
- EnableMaxPacketSize (HcDev);
-
- Status = ClearStatusReg (HcDev->PciIo, StatusReg);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // construct QH and TD data structures,
- // and link them together
- //
- if (EndPointAddress & 0x80) {
- TransferDirection = EfiUsbDataIn;
- } else {
- TransferDirection = EfiUsbDataOut;
- }
-
- switch (TransferDirection) {
-
- case EfiUsbDataIn:
- ShortPacketEnable = TRUE;
- PktID = INPUT_PACKET_ID;
- PtrDataSource = Data;
- DataLen = *DataLength;
-
- //
- // BusMasterWrite means cpu read
- //
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterWrite,
- PtrDataSource,
- &DataLen,
- &TempPtr,
- &Mapping
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Ptr = (UINT8 *) ((UINTN) TempPtr);
- break;
-
- case EfiUsbDataOut:
- PktID = OUTPUT_PACKET_ID;
- PtrDataSource = Data;
- DataLen = *DataLength;
-
- //
- // BusMasterRead means cpu write
- //
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterRead,
- PtrDataSource,
- &DataLen,
- &TempPtr,
- &Mapping
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Ptr = (UINT8 *) ((UINTN) TempPtr);
- break;
-
- default:
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // create QH structure and init
- //
- Status = CreateQH (HcDev, &PtrQH);
- if (EFI_ERROR (Status)) {
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- return Status;
- }
-
- //
- // i is used to calculate the total number of TDs.
- //
- Index = 0;
-
- IsFirstTD = TRUE;
- while (DataLen > 0) {
-
- //
- // create TD structures and link together
- //
-
- PktSize = (UINT8) DataLen;
- if (DataLen > MaximumPacketLength) {
- PktSize = MaximumPacketLength;
- }
-
- Status = GenDataTD (
- HcDev,
- DeviceAddress,
- EndPointAddress,
- Ptr,
- PktSize,
- PktID,
- *DataToggle,
- FALSE,
- &PtrTD
- );
-
- if (EFI_ERROR (Status)) {
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
- DeleteQueuedTDs (HcDev, PtrFirstTD);
- return Status;
- }
-
- //
- // Enable short packet detection.
- // (default action is disabling short packet detection)
- //
- if (ShortPacketEnable) {
- EnableorDisableTDShortPacket (PtrTD, TRUE);
- }
-
- if (IsFirstTD) {
- PtrFirstTD = PtrTD;
- PtrFirstTD->ptrNextTD = NULL;
- IsFirstTD = FALSE;
- } else {
- //
- // Link two TDs in vertical depth
- //
- LinkTDToTD (PtrPreTD, PtrTD);
- }
-
- Index++;
-
- PtrPreTD = PtrTD;
-
- *DataToggle ^= 1;
- Ptr += PktSize;
- DataLen -= PktSize;
- }
-
- //
- // link TD structures to QH structure
- //
- LinkTDToQH (PtrQH, PtrFirstTD);
-
- //
- // calculate how many entries are linked to the specified bulk transfer QH-TDs
- // the below values are referred to the USB spec revision1.1.
- //
- switch (MaximumPacketLength) {
- case 8:
- LinkTimes = Index / 71 + 1;
- break;
-
- case 16:
- LinkTimes = Index / 51 + 1;
- break;
-
- case 32:
- LinkTimes = Index / 33 + 1;
- break;
-
- case 64:
- LinkTimes = Index / 19 + 1;
- break;
- }
-
- LinkTimes += 500;
-
- //
- // put QH-TDs into Frame list
- //
- LoadFrameListIndex = (UINT16) ((GetCurrentFrameNumber (HcDev->PciIo, FrameNumReg)) & 0x3FF);
- SavedFrameListIndex = LoadFrameListIndex;
-
- for (Index = 0; Index <= LinkTimes; Index++) {
-
- //
- // put the QH-TD directly or indirectly into the proper place
- // in the Frame List
- //
- LinkQHToFrameList (HcDev->FrameListEntry, LoadFrameListIndex, PtrQH);
-
- LoadFrameListIndex += 1;
- LoadFrameListIndex &= 0x3FF;
- }
-
- LoadFrameListIndex = SavedFrameListIndex;
-
- //
- // Execute QH-TD and get result
- //
- //
- // detail status is put into the Result field in the pIRP
- // the Data Toggle value is also re-updated to the value
- // of the last successful TD
- //
- Status = ExecBulkorSyncInterruptTransfer (
- HcDev,
- PtrFirstTD,
- LoadFrameListIndex,
- DataLength,
- DataToggle,
- TimeOut,
- TransferResult
- );
-
- //
- // Delete Bulk transfer QH-TD structure
- // and maitain the pointers in the Frame List
- // and other pointers in related QH structure
- //
- // TRUE means must search other framelistindex
- //
- for (Index = 0; Index <= LinkTimes; Index++) {
- DelLinkSingleQH (
- HcDev,
- PtrQH,
- LoadFrameListIndex,
- FALSE,
- FALSE
- );
- LoadFrameListIndex += 1;
- LoadFrameListIndex &= 0x3FF;
- }
-
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
-
- DeleteQueuedTDs (HcDev, PtrFirstTD);
-
- if (Mapping != NULL) {
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- }
-
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (!IsStatusOK (HcDev->PciIo, StatusReg)) {
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
- *TransferResult |= EFI_USB_ERR_SYSTEM;
- return EFI_DEVICE_ERROR;
- }
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
-
- HcDev->PciIo->Flush (HcDev->PciIo);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UHCIAsyncInterruptTransfer (
- IN EFI_USB_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN BOOLEAN IsSlowDevice,
- IN UINT8 MaximumPacketLength,
- IN BOOLEAN IsNewTransfer,
- IN OUT UINT8 *DataToggle,
- IN UINTN PollingInterval, OPTIONAL
- IN UINTN DataLength, OPTIONAL
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction, OPTIONAL
- IN VOID *Context OPTIONAL
- )
-/*++
-
- Routine Description:
- Submits an asynchronous interrupt transfer to an
- interrupt endpoint of a USB device.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- DeviceAddress Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
-
- EndPointAddress The combination of an endpoint number and an endpoint
- direction of the target USB device. Each endpoint address
- supports data transfer in one direction except the
- control endpoint (whose default endpoint address is 0).
- It is the caller's responsibility to make sure that
- the EndPointAddress represents an interrupt endpoint.
-
- IsSlowDevice Indicates whether the target device is slow device
- or full-speed device.
-
- MaximumPacketLength Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
-
- IsNewTransfer If TRUE, an asynchronous interrupt pipe is built between
- the host and the target interrupt endpoint.
- If FALSE, the specified asynchronous interrupt pipe
- is canceled.
-
- DataToggle A pointer to the data toggle value. On input, it is valid
- when IsNewTransfer is TRUE, and it indicates the initial
- data toggle value the asynchronous interrupt transfer
- should adopt.
- On output, it is valid when IsNewTransfer is FALSE,
- and it is updated to indicate the data toggle value of
- the subsequent asynchronous interrupt transfer.
-
- PollingInterval Indicates the interval, in milliseconds, that the
- asynchronous interrupt transfer is polled.
- This parameter is required when IsNewTransfer is TRUE.
-
- DataLength Indicates the length of data to be received at the
- rate specified by PollingInterval from the target
- asynchronous interrupt endpoint. This parameter
- is only required when IsNewTransfer is TRUE.
-
- CallBackFunction The Callback function.This function is called at the
- rate specified by PollingInterval.This parameter is
- only required when IsNewTransfer is TRUE.
-
- Context The context that is passed to the CallBackFunction.
- This is an optional parameter and may be NULL.
-
- Returns:
- EFI_SUCCESS
- The asynchronous interrupt transfer request has been successfully
- submitted or canceled.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_OUT_OF_RESOURCES
- The request could not be completed due to a lack of resources.
- EFI_DEVICE_ERROR
- Can't read register
---*/
-{
- USB_HC_DEV *HcDev;
- UINT32 StatusReg;
- UINT32 FrameNumReg;
- UINTN DataLen;
- QH_STRUCT *ptrFirstQH;
- QH_STRUCT *PtrQH;
- QH_STRUCT *ptrPreQH;
- TD_STRUCT *PtrFirstTD;
- TD_STRUCT *PtrTD;
- TD_STRUCT *PtrPreTD;
- UINT16 LoadFrameListIndex;
- UINT16 Index;
- UINT8 PktID;
- UINT8 *Ptr;
- UINT8 *MappedPtr;
- BOOLEAN IsFirstTD;
- BOOLEAN IsFirstQH;
- EFI_STATUS Status;
- BOOLEAN ShortPacketEnable;
- UINT8 CurrentDataToggle;
- EFI_PHYSICAL_ADDRESS TempPtr;
- VOID *Mapping;
- UINT8 PktSize;
- QH_STRUCT *TempQH;
- EFI_TPL OldTpl;
-
- HcDev = USB_HC_DEV_FROM_THIS (This);
- StatusReg = (UINT32) (USBSTS);
- FrameNumReg = (UINT32) (USBFRNUM);
- Mapping = NULL;
- ShortPacketEnable = FALSE;
-
- PktID = INPUT_PACKET_ID;
- PtrTD = NULL;
- PtrFirstTD = NULL;
- PtrPreTD = NULL;
- Ptr = NULL;
- PtrQH = NULL;
- ptrPreQH = NULL;
- ptrFirstQH = NULL;
-
- if ((EndPointAddress & 0x80) == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // delete Async interrupt transfer request
- //
- if (!IsNewTransfer) {
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Status = DeleteAsyncINTQHTDs (
- HcDev,
- DeviceAddress,
- EndPointAddress,
- DataToggle
- );
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
- }
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (!IsStatusOK (HcDev->PciIo, StatusReg)) {
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
- return EFI_DEVICE_ERROR;
- }
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
-
- //
- // submit Async interrupt transfer request
- //
- if (PollingInterval < 1 || PollingInterval > 255) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (DataLength == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((*DataToggle != 1) && (*DataToggle != 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- ShortPacketEnable = TRUE;
- PktID = INPUT_PACKET_ID;
- DataLen = DataLength;
- Ptr = AllocatePool (DataLen);
- if (Ptr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // BusMasterWrite means cpu read
- //
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterWrite,
- Ptr,
- &DataLen,
- &TempPtr,
- &Mapping
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (Ptr);
- return Status;
- }
-
- MappedPtr = (UINT8 *) ((UINTN) TempPtr);
-
- CurrentDataToggle = *DataToggle;
-
- IsFirstTD = TRUE;
-
- while (DataLen > 0) {
- //
- // create TD structures and link together
- //
-
- PktSize = (UINT8) DataLen;
- if (DataLen > MaximumPacketLength) {
- PktSize = MaximumPacketLength;
- }
-
- Status = GenDataTD (
- HcDev,
- DeviceAddress,
- EndPointAddress,
- MappedPtr,
- PktSize,
- PktID,
- CurrentDataToggle,
- IsSlowDevice,
- &PtrTD
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (Ptr);
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- DeleteQueuedTDs (HcDev, PtrFirstTD);
- return Status;
- }
- //
- // Enable short packet detection.
- //
- if (ShortPacketEnable) {
- EnableorDisableTDShortPacket (PtrTD, TRUE);
- }
-
- if (IsFirstTD) {
- PtrFirstTD = PtrTD;
- PtrFirstTD->ptrNextTD = NULL;
- IsFirstTD = FALSE;
- } else {
- //
- // Link two TDs in vertical depth
- //
- LinkTDToTD (PtrPreTD, PtrTD);
- }
-
- PtrPreTD = PtrTD;
-
- CurrentDataToggle ^= 1;
- MappedPtr += PktSize;
- DataLen -= PktSize;
- }
-
- //
- // roll one value back
- //
- CurrentDataToggle ^= 1;
-
- //
- // create a list of QH structures and init,
- // link TDs to all the QHs, and link all the QHs together using internal
- // defined pointer of the QH_STRUCT.
- //
- IsFirstQH = TRUE;
- ptrPreQH = NULL;
- for (Index = 0; Index < 1024;) {
-
- Status = CreateQH (HcDev, &PtrQH);
- if (EFI_ERROR (Status)) {
- gBS->FreePool (Ptr);
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- DeleteQueuedTDs (HcDev, PtrFirstTD);
- PtrQH = ptrFirstQH;
- while (PtrQH) {
- TempQH = PtrQH;
- PtrQH = TempQH->ptrNextIntQH;
- UhciFreePool (HcDev, (UINT8 *) TempQH, sizeof (QH_STRUCT));
- }
-
- return Status;
- }
-
- //
- // link TD structures to QH structure
- //
- LinkTDToQH (PtrQH, PtrFirstTD);
-
- if (IsFirstQH) {
- ptrFirstQH = PtrQH;
- ptrFirstQH->ptrNextIntQH = NULL;
- IsFirstQH = FALSE;
- } else {
- //
- // link neighbor QH structures together
- //
- ptrPreQH->ptrNextIntQH = PtrQH;
- }
-
- ptrPreQH = PtrQH;
-
- Index = (UINT16) (PollingInterval + Index);
- }
- //
- // last QH in QH list should set its next QH pointer to NULL.
- //
- PtrQH->ptrNextIntQH = NULL;
-
- //
- // Save QH-TD structures in Interrupt transfer list,
- // for monitor interrupt transfer execution routine use.
- //
- InsertQHTDToINTList (
- HcDev,
- ptrFirstQH,
- PtrFirstTD,
- DeviceAddress,
- EndPointAddress,
- CurrentDataToggle,
- DataLength,
- PollingInterval,
- Mapping,
- Ptr,
- CallBackFunction,
- Context
- );
-
- //
- // put QHs-TDs into Frame list
- //
- LoadFrameListIndex = (UINT16) ((GetCurrentFrameNumber (HcDev->PciIo, FrameNumReg)) & 0x3FF);
-
- PtrQH = ptrFirstQH;
-
- for (Index = LoadFrameListIndex; Index < (1024 + LoadFrameListIndex);) {
-
- //
- // put the QH-TD directly or indirectly into the proper place
- // in the Frame List
- //
- LinkQHToFrameList (HcDev->FrameListEntry, (UINT16) (Index & 0x3FF), PtrQH);
-
- Index = (UINT16) (PollingInterval + Index);
-
- PtrQH = PtrQH->ptrNextIntQH;
- }
-
- HcDev->PciIo->Flush (HcDev->PciIo);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UHCISyncInterruptTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN BOOLEAN IsSlowDevice,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
- Submits synchronous interrupt transfer to an interrupt endpoint
- of a USB device.
-
- Arguments:
-
- This A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- DeviceAddress Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
-
- EndPointAddress The combination of an endpoint number and an endpoint
- direction of the target USB device. Each endpoint
- address supports data transfer in one direction
- except the control endpoint (whose default
- endpoint address is 0). It is the caller's responsibility
- to make sure that the EndPointAddress represents
- an interrupt endpoint.
-
- IsSlowDevice Indicates whether the target device is slow device
- or full-speed device.
-
- MaximumPacketLength Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
-
- Data A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
-
- DataLength On input, the size, in bytes, of the data buffer specified
- by Data. On output, the number of bytes transferred.
-
- DataToggle A pointer to the data toggle value. On input, it indicates
- the initial data toggle value the synchronous interrupt
- transfer should adopt;
- on output, it is updated to indicate the data toggle value
- of the subsequent synchronous interrupt transfer.
-
- TimeOut Indicates the maximum time, in microseconds, which the
- transfer is allowed to complete.
-
- TransferResult A pointer to the detailed result information from
- the synchronous interrupt transfer.
-
- Returns:
- EFI_SUCCESS
- The synchronous interrupt transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The synchronous interrupt transfer could not be submitted due
- to lack of resource.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The synchronous interrupt transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The synchronous interrupt transfer failed due to host controller
- or device error. Caller should check TranferResult for detailed
- error information.
---*/
-{
- USB_HC_DEV *HcDev;
- UINT32 StatusReg;
- UINT32 FrameNumReg;
- UINTN DataLen;
- QH_STRUCT *PtrQH;
- TD_STRUCT *PtrFirstTD;
- TD_STRUCT *PtrTD;
- TD_STRUCT *PtrPreTD;
- UINT16 LoadFrameListIndex;
- UINT16 SavedFrameListIndex;
- UINT32 Index;
- UINT32 LinkTimes;
- UINT8 PktID;
- UINT8 *PtrDataSource;
- UINT8 *Ptr;
- BOOLEAN IsFirstTD;
- EFI_STATUS Status;
- BOOLEAN ShortPacketEnable;
- EFI_PHYSICAL_ADDRESS TempPtr;
- VOID *Mapping;
- UINT8 PktSize;
-
- HcDev = USB_HC_DEV_FROM_THIS (This);
- StatusReg = (UINT32) (USBSTS);
- FrameNumReg = (UINT32) (USBFRNUM);
- ShortPacketEnable = FALSE;
- Mapping = NULL;
- PktID = INPUT_PACKET_ID;
- PtrTD = NULL;
- PtrFirstTD = NULL;
- PtrPreTD = NULL;
- DataLen = 0;
- Ptr = NULL;
- Index = 0;
- LinkTimes = 0;
-
- //
- // Parameters Checking
- //
-
- if ((DataLength == NULL) ||
- (Data == NULL) ||
- (TransferResult == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (!IsStatusOK (HcDev->PciIo, StatusReg)) {
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
- *TransferResult = EFI_USB_ERR_SYSTEM;
- return EFI_DEVICE_ERROR;
- }
-
- if ((EndPointAddress & 0x80) == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (*DataLength == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((*DataToggle != 1) && (*DataToggle != 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (MaximumPacketLength > 64) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (IsSlowDevice && (MaximumPacketLength > 8)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (TransferResult == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
-
- //
- // submit Sync interrupt transfer request
- //
- ShortPacketEnable = TRUE;
- PktID = INPUT_PACKET_ID;
- DataLen = *DataLength;
- PtrDataSource = Data;
-
- //
- // create QH structure and init
- //
- Status = CreateQH (HcDev, &PtrQH);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // BusMasterWrite means cpu read
- //
- Status = HcDev->PciIo->Map (
- HcDev->PciIo,
- EfiPciIoOperationBusMasterWrite,
- PtrDataSource,
- &DataLen,
- &TempPtr,
- &Mapping
- );
- if (EFI_ERROR (Status)) {
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
- return Status;
- }
-
- Ptr = (UINT8 *) ((UINTN) TempPtr);
-
- IsFirstTD = TRUE;
- while (DataLen > 0) {
- //
- // create TD structures and link together
- //
- PktSize = (UINT8) DataLen;
- if (DataLen > MaximumPacketLength) {
- PktSize = MaximumPacketLength;
- }
-
- Status = GenDataTD (
- HcDev,
- DeviceAddress,
- EndPointAddress,
- Ptr,
- PktSize,
- PktID,
- *DataToggle,
- IsSlowDevice,
- &PtrTD
- );
- if (EFI_ERROR (Status)) {
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
- DeleteQueuedTDs (HcDev, PtrFirstTD);
- return Status;
- }
- //
- // Enable short packet detection.
- //
- if (ShortPacketEnable) {
- EnableorDisableTDShortPacket (PtrTD, TRUE);
- }
-
- if (IsFirstTD) {
- PtrFirstTD = PtrTD;
- PtrFirstTD->ptrNextTD = NULL;
- IsFirstTD = FALSE;
- } else {
- //
- // Link two TDs in vertical depth
- //
- LinkTDToTD (PtrPreTD, PtrTD);
- }
-
- Index++;
-
- PtrPreTD = PtrTD;
-
- *DataToggle ^= 1;
- Ptr += PktSize;
- DataLen -= PktSize;
- }
-
- //
- // link TD structures to QH structure
- //
- LinkTDToQH (PtrQH, PtrFirstTD);
-
- switch (MaximumPacketLength) {
- case 8:
- LinkTimes = Index / 71 + 1;
- break;
-
- case 16:
- LinkTimes = Index / 51 + 1;
- break;
-
- case 32:
- LinkTimes = Index / 33 + 1;
- break;
-
- case 64:
- LinkTimes = Index / 19 + 1;
- break;
- }
-
- LinkTimes += 100;
-
- LoadFrameListIndex = (UINT16) ((GetCurrentFrameNumber (HcDev->PciIo, FrameNumReg)) & 0x3FF);
- SavedFrameListIndex = LoadFrameListIndex;
-
- for (Index = 0; Index < LinkTimes; Index++) {
-
- //
- // put the QH-TD directly or indirectly into the proper place
- // in the Frame List
- //
- LinkQHToFrameList (HcDev->FrameListEntry, LoadFrameListIndex, PtrQH);
-
- LoadFrameListIndex += 1;
- LoadFrameListIndex &= 0x3FF;
- }
-
- LoadFrameListIndex = SavedFrameListIndex;
- //
- // detail status is put into the Result field in the pIRP
- // the Data Toggle value is also re-updated to the value
- // of the last successful TD
- //
- Status = ExecBulkorSyncInterruptTransfer (
- HcDev,
- PtrFirstTD,
- LoadFrameListIndex,
- DataLength,
- DataToggle,
- TimeOut,
- TransferResult
- );
- //
- // Delete Sync Interrupt transfer QH-TD structure
- // and maintain the pointers in the Frame List
- // and other pointers in related QH structure
- //
- // TRUE means must search other framelistindex
- //
- for (Index = 0; Index <= LinkTimes; Index++) {
- DelLinkSingleQH (
- HcDev,
- PtrQH,
- LoadFrameListIndex,
- FALSE,
- FALSE
- );
- LoadFrameListIndex += 1;
- LoadFrameListIndex &= 0x3FF;
- }
-
- UhciFreePool (HcDev, (UINT8 *) PtrQH, sizeof (QH_STRUCT));
-
- DeleteQueuedTDs (HcDev, PtrFirstTD);
-
- HcDev->PciIo->Unmap (HcDev->PciIo, Mapping);
-
- //
- // if has errors that cause host controller halt,
- // then return EFI_DEVICE_ERROR directly.
- //
- if (!IsStatusOK (HcDev->PciIo, StatusReg)) {
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
- *TransferResult |= EFI_USB_ERR_SYSTEM;
- return EFI_DEVICE_ERROR;
- }
-
- ClearStatusReg (HcDev->PciIo, StatusReg);
-
- HcDev->PciIo->Flush (HcDev->PciIo);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UHCIIsochronousTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
- Submits isochronous transfer to a target USB device.
-
- Arguments:
-
- This - A pointer to the EFI_USB_HC_PROTOCOL instance.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - End point address
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- DataLength - Indicates the size, in bytes, of the data buffer
- specified by Data.
- TransferResult - A pointer to the detailed result information generated
- by this control transfer.
- Returns:
- EFI_UNSUPPORTED
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-
-EFI_STATUS
-EFIAPI
-UHCIAsyncIsochronousTransfer (
- IN EFI_USB_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context OPTIONAL
- )
-/*++
-
- Routine Description:
- Submits Async isochronous transfer to a target USB device.
-
- Arguments:
-
- This - A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
-
- EndPointAddress - End point address
-
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
-
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
-
- IsochronousCallBack - When the transfer complete, the call back function will be called
-
- Context - Pass to the call back function as parameter
-
- Returns:
- EFI_UNSUPPORTED
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-//
-// UEFI 2.0 Protocol
-//
-EFI_STATUS
-EFIAPI
-UHCI2GetCapability(
- IN EFI_USB2_HC_PROTOCOL * This,
- OUT UINT8 *MaxSpeed,
- OUT UINT8 *PortNumber,
- OUT UINT8 *Is64BitCapable
- )
-/*++
-
- Routine Description:
- Retrieves capabilities of USB host controller according to UEFI 2.0 spec.
-
- Arguments:
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
-
- MaxSpeed - A pointer to the max speed USB host controller supports.
-
- PortNumber - A pointer to the number of root hub ports.
-
- Is64BitCapable - A pointer to an integer to show whether USB host controller
- supports 64-bit memory addressing.
- Returns:
- EFI_SUCCESS
- The host controller capabilities were retrieved successfully.
- EFI_INVALID_PARAMETER
- MaxSpeed or PortNumber or Is64BitCapable is NULL.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to retrieve the capabilities.
-
---*/
-{
- USB_HC_DEV *HcDev;
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- if ((NULL == MaxSpeed)
- ||(NULL == PortNumber)
- || (NULL == Is64BitCapable))
- {
- return EFI_INVALID_PARAMETER;
- }
-
- *MaxSpeed = EFI_USB_SPEED_FULL;
- *Is64BitCapable = (UINT8)FALSE;
- return UHCIGetRootHubPortNumber(&HcDev->UsbHc, PortNumber);
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2Reset (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT16 Attributes
- )
-/*++
-
- Routine Description:
- Provides software reset for the USB host controller according to UEFI 2.0 spec.
-
- Arguments:
- This - A pointer to the EFI_USB2_HC_PROTOCOL instance.
-
- Attributes - A bit mask of the reset operation to perform.
- See below for a list of the supported bit mask values.
-
- #define EFI_USB_HC_RESET_GLOBAL 0x0001
- #define EFI_USB_HC_RESET_HOST_CONTROLLER 0x0002
- #define EFI_USB_HC_RESET_GLOBAL _WITH_DEBUG 0x0004
- #define EFI_USB_HC_RESET_HOST_WITH_DEBUG 0x0008
-
- EFI_USB_HC_RESET_GLOBAL
- If this bit is set, a global reset signal will be sent to the USB bus.
- This resets all of the USB bus logic, including the USB host
- controller hardware and all the devices attached on the USB bus.
- EFI_USB_HC_RESET_HOST_CONTROLLER
- If this bit is set, the USB host controller hardware will be reset.
- No reset signal will be sent to the USB bus.
-
- Returns:
- EFI_SUCCESS
- The reset operation succeeded.
- EFI_INVALID_PARAMETER
- Attributes is not valid.
- EFI_UNSUPPORTED
- The type of reset specified by Attributes is not currently supported by the host controller hardware.
- EFI_ACCESS_DENIED
- Reset operation is rejected due to the debug port being configured and active.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to perform
- the reset operation.
---*/
-{
- USB_HC_DEV *HcDev;
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- if (Attributes==EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG || Attributes==EFI_USB_HC_RESET_HOST_WITH_DEBUG)
- return EFI_UNSUPPORTED;
-
- return UHCIReset(
- &HcDev->UsbHc,
- Attributes
- );
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2GetState (
- IN EFI_USB2_HC_PROTOCOL * This,
- OUT EFI_USB_HC_STATE * State
- )
-/*++
-
- Routine Description:
- Retrieves current state of the USB host controller according to UEFI 2.0 spec.
-
- Arguments:
-
- This - A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- State - A pointer to the EFI_USB_HC_STATE data structure that
- indicates current state of the USB host controller.
- Type EFI_USB_HC_STATE is defined below.
-
- typedef enum {
- EfiUsbHcStateHalt,
- EfiUsbHcStateOperational,
- EfiUsbHcStateSuspend,
- EfiUsbHcStateMaximum
- } EFI_USB_HC_STATE;
-
- Returns:
- EFI_SUCCESS
- The state information of the host controller was returned in State.
- EFI_INVALID_PARAMETER
- State is NULL.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to retrieve the
- host controller's current state.
---*/
-{
- USB_HC_DEV *HcDev;
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
- return UHCIGetState(
- &HcDev->UsbHc,
- State
- );
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2SetState (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN EFI_USB_HC_STATE State
- )
-/*++
-
- Routine Description:
- Sets the USB host controller to a specific state according to UEFI 2.0 spec.
-
- Arguments:
-
- This - A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- State - Indicates the state of the host controller that will be set.
-
- Returns:
- EFI_SUCCESS
- The USB host controller was successfully placed in the state
- specified by State.
- EFI_INVALID_PARAMETER
- State is invalid.
- EFI_DEVICE_ERROR
- Failed to set the state specified by State due to device error.
---*/
-{
- USB_HC_DEV *HcDev;
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
- return UHCISetState(
- &HcDev->UsbHc,
- State
- );
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2ControlTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN EFI_USB_DEVICE_REQUEST * Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
- Submits control transfer to a target USB device accroding to UEFI 2.0 spec..
-
- Arguments:
-
- This - A pointer to the EFI_USB_HC_PROTOCOL instance.
-
- DeviceAddress -Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
-
- DeviceSpeed - Indicates transfer speed of device.
-
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
-
- Request - A pointer to the USB device request that will be sent
- to the USB device.
-
- TransferDirection - Specifies the data direction for the transfer.
- There are three values available, DataIn, DataOut
- and NoData.
-
- Data -A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
-
- DataLength - Indicates the size, in bytes, of the data buffer
- specified by Data.
-
- TimeOut - Indicates the maximum time, in microseconds,
- which the transfer is allowed to complete.
-
- TransferResult - A pointer to the detailed result information generated
- by this control transfer.
-
- Returns:
- EFI_SUCCESS
- The control transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The control transfer could not be completed due to a lack of resources.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The control transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The control transfer failed due to host controller or device error.
- Caller should check TranferResult for detailed error information.
-
---*/
-{
- USB_HC_DEV *HcDev;
- BOOLEAN IsSlowDevice = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- return UHCIControlTransfer(
- &HcDev->UsbHc,
- DeviceAddress,
- IsSlowDevice,
- (UINT8) MaximumPacketLength,
- Request,
- TransferDirection,
- Data,
- DataLength,
- TimeOut,
- TransferResult
- );
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2BulkTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
- Submits bulk transfer to a bulk endpoint of a USB device according to UEFI 2.0 spec.
-
- Arguments:
-
- This A pointer to the EFI_USB2_HC_PROTOCOL instance.
-
- DeviceAddress Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
-
- EndPointAddress The combination of an endpoint number and an
- endpoint direction of the target USB device.
- Each endpoint address supports data transfer in
- one direction except the control endpoint
- (whose default endpoint address is 0).
- It is the caller's responsibility to make sure that
- the EndPointAddress represents a bulk endpoint.
-
- DeviceSpeed Indicates device speed. The supported values are EFI_USB_SPEED_FULL
- and EFI_USB_SPEED_HIGH.
-
- MaximumPacketLength Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
-
- DataBuffersNumber Number of data buffers prepared for the transfer.
-
- Data Array of pointers to the buffers of data that will be transmitted
- to USB device or received from USB device.
-
- DataLength When input, indicates the size, in bytes, of the data buffer
- specified by Data. When output, indicates the actually
- transferred data size.
-
- DataToggle A pointer to the data toggle value. On input, it indicates
- the initial data toggle value the bulk transfer should adopt;
- on output, it is updated to indicate the data toggle value
- of the subsequent bulk transfer.
-
- Translator A pointr to the transaction translator data.
-
- TimeOut Indicates the maximum time, in microseconds, which the
- transfer is allowed to complete.
-
- TransferResult A pointer to the detailed result information of the
- bulk transfer.
-
- Returns:
- EFI_SUCCESS
- The bulk transfer was completed successfully.
-
- EFI_OUT_OF_RESOURCES
- The bulk transfer could not be submitted due to lack of resource.
-
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
-
- EFI_TIMEOUT
- The bulk transfer failed due to timeout.
-
- EFI_DEVICE_ERROR
- The bulk transfer failed due to host controller or device error.
- Caller should check TranferResult for detailed error information.
-
---*/
-{
- USB_HC_DEV *HcDev;
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- if( Data == NULL || DeviceSpeed==EFI_USB_SPEED_LOW)
- return EFI_INVALID_PARAMETER;
- /* For full-speed bulk transfers only the data pointed by Data[0] shall be used */
-
- return UHCIBulkTransfer (
- &HcDev->UsbHc,
- DeviceAddress,
- EndPointAddress,
- (UINT8) MaximumPacketLength,
- *Data,
- DataLength,
- DataToggle,
- TimeOut,
- TransferResult
- );
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2AsyncInterruptTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN BOOLEAN IsNewTransfer,
- IN OUT UINT8 *DataToggle,
- IN UINTN PollingInterval,
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
- Submits an asynchronous interrupt transfer to an
- interrupt endpoint of a USB device according to UEFI 2.0 spec.
-
- Arguments:
-
- This A pointer to the EFI_USB2_HC_PROTOCOL instance.
-
- DeviceAddress Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
-
- EndPointAddress The combination of an endpoint number and an endpoint
- direction of the target USB device. Each endpoint address
- supports data transfer in one direction except the
- control endpoint (whose default endpoint address is 0).
- It is the caller's responsibility to make sure that
- the EndPointAddress represents an interrupt endpoint.
-
- DeviceSpeed Indicates device speed.
-
- MaximumPacketLength Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
-
- IsNewTransfer If TRUE, an asynchronous interrupt pipe is built between
- the host and the target interrupt endpoint.
- If FALSE, the specified asynchronous interrupt pipe
- is canceled.
-
- DataToggle A pointer to the data toggle value. On input, it is valid
- when IsNewTransfer is TRUE, and it indicates the initial
- data toggle value the asynchronous interrupt transfer
- should adopt.
- On output, it is valid when IsNewTransfer is FALSE,
- and it is updated to indicate the data toggle value of
- the subsequent asynchronous interrupt transfer.
-
- PollingInterval Indicates the interval, in milliseconds, that the
- asynchronous interrupt transfer is polled.
- This parameter is required when IsNewTransfer is TRUE.
-
- DataLength Indicates the length of data to be received at the
- rate specified by PollingInterval from the target
- asynchronous interrupt endpoint. This parameter
- is only required when IsNewTransfer is TRUE.
-
- Translator A pointr to the transaction translator data.
-
- CallBackFunction The Callback function.This function is called at the
- rate specified by PollingInterval.This parameter is
- only required when IsNewTransfer is TRUE.
-
- Context The context that is passed to the CallBackFunction.
- This is an optional parameter and may be NULL.
-
- Returns:
-
- EFI_SUCCESS
- The asynchronous interrupt transfer request has been successfully
- submitted or canceled.
-
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
-
- EFI_OUT_OF_RESOURCES
- The request could not be completed due to a lack of resources.
-
- EFI_DEVICE_ERROR
- Can't read register
---*/
-{
- USB_HC_DEV *HcDev;
- BOOLEAN IsSlowDevice = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
- return UHCIAsyncInterruptTransfer(
- &HcDev->UsbHc,
- DeviceAddress,
- EndPointAddress,
- IsSlowDevice,
- (UINT8) MaximumPacketLength,
- IsNewTransfer,
- DataToggle,
- PollingInterval,
- DataLength,
- CallBackFunction,
- Context
- );
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2SyncInterruptTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
- Submits synchronous interrupt transfer to an interrupt endpoint
- of a USB device according to UEFI 2.0 spec.
-
- Arguments:
-
- This A pointer to the EFI_USB2_HC_PROTOCOL instance.
-
- DeviceAddress Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
-
- EndPointAddress The combination of an endpoint number and an endpoint
- direction of the target USB device. Each endpoint
- address supports data transfer in one direction
- except the control endpoint (whose default
- endpoint address is 0). It is the caller's responsibility
- to make sure that the EndPointAddress represents
- an interrupt endpoint.
-
- DeviceSpeed Indicates device speed.
-
- MaximumPacketLength Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
-
- Data A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
-
- DataLength On input, the size, in bytes, of the data buffer specified
- by Data. On output, the number of bytes transferred.
-
- DataToggle A pointer to the data toggle value. On input, it indicates
- the initial data toggle value the synchronous interrupt
- transfer should adopt;
- on output, it is updated to indicate the data toggle value
- of the subsequent synchronous interrupt transfer.
-
- TimeOut Indicates the maximum time, in microseconds, which the
- transfer is allowed to complete.
- Translator A pointr to the transaction translator data.
- TransferResult A pointer to the detailed result information from
- the synchronous interrupt transfer.
-
- Returns:
- EFI_SUCCESS
- The synchronous interrupt transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The synchronous interrupt transfer could not be submitted due
- to lack of resource.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The synchronous interrupt transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The synchronous interrupt transfer failed due to host controller
- or device error. Caller should check TranferResult for detailed
- error information.
---*/
-{
- USB_HC_DEV *HcDev;
- BOOLEAN IsSlowDevice;
-
- if(DeviceSpeed==EFI_USB_SPEED_HIGH)
- return EFI_INVALID_PARAMETER;
-
- IsSlowDevice = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- return UHCISyncInterruptTransfer(
- &HcDev->UsbHc,
- DeviceAddress,
- EndPointAddress,
- IsSlowDevice,
- (UINT8) MaximumPacketLength,
- Data,
- DataLength,
- DataToggle,
- TimeOut,
- TransferResult
- );
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2IsochronousTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Submits isochronous transfer to a target USB device according to UEFI 2.0 spec.
-
- Arguments:
-
- This A pointer to the EFI_USB2_HC_PROTOCOL instance.
-
- DeviceAddress Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
-
- EndPointAddress End point address
-
- DeviceSpeed Indicates device speed.
-
- MaximumPacketLength Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
-
- DataBuffersNumber Number of data buffers prepared for the transfer.
-
- Data Array of pointers to the buffers of data that will be
- transmitted to USB device or received from USB device.
-
- DataLength Indicates the size, in bytes, of the data buffer
- specified by Data.
-
- Translator A pointr to the transaction translator data.
-
- TransferResult A pointer to the detailed result information generated
- by this control transfer.
- Returns:
-
- EFI_UNSUPPORTED
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2AsyncIsochronousTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
-
- Submits Async isochronous transfer to a target USB device according to UEFI 2.0 spec.
-
- Arguments:
-
- This A pointer to the EFI_USB2_HC_PROTOCOL instance.
-
- DeviceAddress Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
-
- EndPointAddress End point address
-
- DeviceSpeed Indicates device speed.
-
- MaximumPacketLength Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
-
- DataBuffersNumber Number of data buffers prepared for the transfer.
-
- Data Array of pointers to the buffers of data that will be transmitted
- to USB device or received from USB device.
-
- Translator A pointr to the transaction translator data.
-
- IsochronousCallBack When the transfer complete, the call back function will be called
-
- Context Pass to the call back function as parameter
-
- Returns:
-
- EFI_UNSUPPORTED
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2GetRootHubPortStatus (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS * PortStatus
- )
-/*++
-
- Routine Description:
- Retrieves the current status of a USB root hub port according to UEFI 2.0 spec.
-
- Arguments:
-
- This A pointer to the EFI_USB2_HC_PROTOCOL.
-
- PortNumber Specifies the root hub port from which the status
- is to be retrieved. This value is zero-based. For example,
- if a root hub has two ports, then the first port is numbered 0,
- and the second port is numbered 1.
-
- PortStatus A pointer to the current port status bits and
- port status change bits.
-
- Returns:
- EFI_SUCCESS
- The status of the USB root hub port specified by PortNumber
- was returned in PortStatus.
- EFI_INVALID_PARAMETER
- PortNumber is invalid.
- EFI_DEVICE_ERROR - Can't read register
---*/
-{
- USB_HC_DEV *HcDev;
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
-
- return UHCIGetRootHubPortStatus(
- &HcDev->UsbHc,
- PortNumber,
- PortStatus
- );
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2SetRootHubPortFeature (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-/*++
-
- Routine Description:
- Sets a feature for the specified root hub port according to UEFI 2.0 spec.
-
- Arguments:
-
- This A pointer to the EFI_USB2_HC_PROTOCOL.
-
- PortNumber Specifies the root hub port whose feature
- is requested to be set.
-
- PortFeature Indicates the feature selector associated
- with the feature set request.
-
- Returns:
- EFI_SUCCESS
- The feature specified by PortFeature was set for the
- USB root hub port specified by PortNumber.
- EFI_INVALID_PARAMETER
- PortNumber is invalid or PortFeature is invalid.
- EFI_DEVICE_ERROR
- Can't read register
---*/
-{
- USB_HC_DEV *HcDev;
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
- return UHCISetRootHubPortFeature(
- &HcDev->UsbHc,
- PortNumber,
- PortFeature
- );
-}
-
-EFI_STATUS
-EFIAPI
-UHCI2ClearRootHubPortFeature (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-/*++
-
- Routine Description:
- Clears a feature for the specified root hub port according to Uefi 2.0 spec.
-
- Arguments:
-
- This A pointer to the EFI_USB2_HC_PROTOCOL instance.
-
- PortNumber Specifies the root hub port whose feature
- is requested to be cleared.
-
- PortFeature Indicates the feature selector associated with the
- feature clear request.
-
- Returns:
- EFI_SUCCESS
- The feature specified by PortFeature was cleared for the
- USB root hub port specified by PortNumber.
- EFI_INVALID_PARAMETER
- PortNumber is invalid or PortFeature is invalid.
- EFI_DEVICE_ERROR
- Can't read register
---*/
-{
- USB_HC_DEV *HcDev;
-
- HcDev = USB2_HC_DEV_FROM_THIS (This);
- return UHCIClearRootHubPortFeature(
- &HcDev->UsbHc,
- PortNumber,
- PortFeature
- );
-}
-
-VOID
-EFIAPI
-MonitorInterruptTrans (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
- Routine Description:
- Interrupt transfer periodic check handler
- Arguments:
- Event - Interrupt event
- Contex - Pointer to USB_HC_DEV
- Returns:
- None
---*/
-{
-
- USB_HC_DEV *HcDev;
- INTERRUPT_LIST *PtrList;
- LIST_ENTRY *Link;
- UINT32 Result;
- VOID *DataBuffer;
- UINTN DataLen;
- UINTN ActualLen;
- UINTN ErrTDPos;
- LIST_ENTRY *NextLink;
-
- HcDev = (USB_HC_DEV *) Context;
-
- //
- // interrupt transfer list is empty, means that no interrupt transfer
- // is submitted by far.
- //
- if (IsListEmpty (&(HcDev->InterruptListHead))) {
- return ;
- }
-
- NextLink = HcDev->InterruptListHead.ForwardLink;
- do {
-
- Link = NextLink;
- NextLink = Link->ForwardLink;
-
- PtrList = INTERRUPT_LIST_FROM_LINK (Link);
-
- //
- // get TD execution results.
- // ErrTDPos is zero-based value indicating the first error TD's position
- // in the TDs' list.
- // This value is only valid when Result not equal NOERROR.
- //
- ExecuteAsyncINTTDs (
- HcDev,
- PtrList,
- &Result,
- &ErrTDPos,
- &ActualLen
- );
-
- //
- // interrupt transfer has not been executed yet.
- //
- if (((Result & EFI_USB_ERR_NAK) == EFI_USB_ERR_NAK) ||
- ((Result & EFI_USB_ERR_NOTEXECUTE) == EFI_USB_ERR_NOTEXECUTE)) {
- continue;
- }
- //
- // get actual data length transferred data and its data length.
- //
- DataLen = ActualLen;
- DataBuffer = AllocatePool (DataLen);
- if (DataBuffer == NULL) {
- return ;
- }
-
- CopyMem (
- DataBuffer,
- PtrList->PtrFirstTD->pTDBuffer,
- DataLen
- );
-
- //
- // only if interrupt endpoint responds
- // and the interrupt transfer stops because of completion
- // or error, then we will call callback function.
- //
- if (Result == EFI_USB_NOERROR) {
- //
- // add for real platform debug
- //
- if (PtrList->InterruptCallBack != NULL) {
- (PtrList->InterruptCallBack) (
- DataBuffer,
- DataLen,
- PtrList->InterruptContext,
- Result
- );
- }
-
- if (DataBuffer) {
- gBS->FreePool (DataBuffer);
- }
-
- //
- // update should done after data buffer got.
- //
- UpdateAsyncINTQHTDs (PtrList, Result, (UINT32) ErrTDPos);
-
- } else {
-
- DEBUG ((EFI_D_ERROR, "interrupt transfer error code is %x\n", Result));
-
- if (DataBuffer) {
- gBS->FreePool (DataBuffer);
- }
- //
- // leave error recovery to its related device driver.
- // A common case of the error recovery is to re-submit the interrupt
- // transfer.
- // When an interrupt transfer is re-submitted, its position in the linked
- // list is changed. It is inserted to the head of the linked list, while
- // this function scans the whole list from head to tail. Thus, the
- // re-submitted interrupt transfer's callback function will not be called
- // again in this round.
- //
- if (PtrList->InterruptCallBack != NULL) {
- (PtrList->InterruptCallBack) (
- NULL,
- 0,
- PtrList->InterruptContext,
- Result
- );
- }
- }
- } while (NextLink != &(HcDev->InterruptListHead));
-
-}
diff --git a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h b/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h
deleted file mode 100644
index 68571c5..0000000
--- a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h
+++ /dev/null
@@ -1,2995 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Uhci.h
-
-Abstract:
-
-
-Revision History
---*/
-
-#ifndef _UHCI_H
-#define _UHCI_H
-
-/*
- * Universal Host Controller Interface data structures and defines
- */
-
-#include <IndustryStandard/pci22.h>
-
-#define EFI_D_UHCI EFI_D_INFO
-
-//
-// stall time
-//
-#define STALL_1_MILLI_SECOND 1000
-#define STALL_1_SECOND 1000 * STALL_1_MILLI_SECOND
-
-#define FORCE_GLOBAL_RESUME_TIME 20 * STALL_1_MILLI_SECOND
-
-#define ROOT_PORT_REST_TIME 50 * STALL_1_MILLI_SECOND
-
-#define PORT_RESET_RECOVERY_TIME 10 * STALL_1_MILLI_SECOND
-
-//
-// 50 ms
-//
-#define INTERRUPT_POLLING_TIME 50 * 1000 * 10
-
-//
-// UHCI IO Space Address Register Register locates at
-// offset 20 ~ 23h of PCI Configuration Space (UHCI spec, Revision 1.1),
-// so, its BAR Index is 4.
-//
-#define USB_BAR_INDEX 4
-
-//
-// One memory block uses 1 page (common buffer for QH,TD use.)
-//
-#define NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES 1
-
-#define bit(a) (1 << (a))
-
-//
-// ////////////////////////////////////////////////////////////////////////
-//
-// Universal Host Controller Registers Definitions
-//
-//////////////////////////////////////////////////////////////////////////
-extern UINT16 USBBaseAddr;
-
-/* Command register */
-#define USBCMD 0 /* Command Register Offset 00-01h */
-#define USBCMD_RS bit (0) /* Run/Stop */
-#define USBCMD_HCRESET bit (1) /* Host reset */
-#define USBCMD_GRESET bit (2) /* Global reset */
-#define USBCMD_EGSM bit (3) /* Global Suspend Mode */
-#define USBCMD_FGR bit (4) /* Force Global Resume */
-#define USBCMD_SWDBG bit (5) /* SW Debug mode */
-#define USBCMD_CF bit (6) /* Config Flag (sw only) */
-#define USBCMD_MAXP bit (7) /* Max Packet (0 = 32, 1 = 64) */
-
-/* Status register */
-#define USBSTS 2 /* Status Register Offset 02-03h */
-#define USBSTS_USBINT bit (0) /* Interrupt due to IOC */
-#define USBSTS_ERROR bit (1) /* Interrupt due to error */
-#define USBSTS_RD bit (2) /* Resume Detect */
-#define USBSTS_HSE bit (3) /* Host System Error*/
-#define USBSTS_HCPE bit (4) /* Host Controller Process Error*/
-#define USBSTS_HCH bit (5) /* HC Halted */
-
-/* Interrupt enable register */
-#define USBINTR 4 /* Interrupt Enable Register 04-05h */
-#define USBINTR_TIMEOUT bit (0) /* Timeout/CRC error enable */
-#define USBINTR_RESUME bit (1) /* Resume interrupt enable */
-#define USBINTR_IOC bit (2) /* Interrupt On Complete enable */
-#define USBINTR_SP bit (3) /* Short packet interrupt enable */
-
-/* Frame Number Register Offset 06-08h */
-#define USBFRNUM 6
-
-/* Frame List Base Address Register Offset 08-0Bh */
-#define USBFLBASEADD 8
-
-/* Start of Frame Modify Register Offset 0Ch */
-#define USBSOF 0x0c
-
-/* USB port status and control registers */
-#define USBPORTSC1 0x10 /*Port 1 offset 10-11h */
-#define USBPORTSC2 0x12 /*Port 2 offset 12-13h */
-
-#define USBPORTSC_CCS bit (0) /* Current Connect Status*/
-#define USBPORTSC_CSC bit (1) /* Connect Status Change */
-#define USBPORTSC_PED bit (2) /* Port Enable / Disable */
-#define USBPORTSC_PEDC bit (3) /* Port Enable / Disable Change */
-#define USBPORTSC_LSL bit (4) /* Line Status Low bit*/
-#define USBPORTSC_LSH bit (5) /* Line Status High bit*/
-#define USBPORTSC_RD bit (6) /* Resume Detect */
-#define USBPORTSC_LSDA bit (8) /* Low Speed Device Attached */
-#define USBPORTSC_PR bit (9) /* Port Reset */
-#define USBPORTSC_SUSP bit (12) /* Suspend */
-
-/* PCI Configuration Registers for USB */
-
-//
-// Class Code Register offset
-//
-#define CLASSC 0x09
-//
-// USB IO Space Base Address Register offset
-//
-#define USBBASE 0x20
-
-//
-// USB legacy Support
-//
-#define USB_EMULATION 0xc0
-
-//
-// USB Base Class Code,Sub-Class Code and Programming Interface.
-//
-#define PCI_CLASSC_PI_UHCI 0x00
-
-#define SETUP_PACKET_ID 0x2D
-#define INPUT_PACKET_ID 0x69
-#define OUTPUT_PACKET_ID 0xE1
-#define ERROR_PACKET_ID 0x55
-
-//
-// ////////////////////////////////////////////////////////////////////////
-//
-// USB Transfer Mechanism Data Structures
-//
-//////////////////////////////////////////////////////////////////////////
-#pragma pack(1)
-//
-// USB Class Code structure
-//
-typedef struct {
- UINT8 PI;
- UINT8 SubClassCode;
- UINT8 BaseCode;
-} USB_CLASSC;
-
-typedef struct {
- UINT32 QHHorizontalTerminate : 1;
- UINT32 QHHorizontalQSelect : 1;
- UINT32 QHHorizontalRsvd : 2;
- UINT32 QHHorizontalPtr : 28;
- UINT32 QHVerticalTerminate : 1;
- UINT32 QHVerticalQSelect : 1;
- UINT32 QHVerticalRsvd : 2;
- UINT32 QHVerticalPtr : 28;
-} QUEUE_HEAD;
-
-typedef struct {
- UINT32 TDLinkPtrTerminate : 1;
- UINT32 TDLinkPtrQSelect : 1;
- UINT32 TDLinkPtrDepthSelect : 1;
- UINT32 TDLinkPtrRsvd : 1;
- UINT32 TDLinkPtr : 28;
- UINT32 TDStatusActualLength : 11;
- UINT32 TDStatusRsvd : 5;
- UINT32 TDStatus : 8;
- UINT32 TDStatusIOC : 1;
- UINT32 TDStatusIOS : 1;
- UINT32 TDStatusLS : 1;
- UINT32 TDStatusErr : 2;
- UINT32 TDStatusSPD : 1;
- UINT32 TDStatusRsvd2 : 2;
- UINT32 TDTokenPID : 8;
- UINT32 TDTokenDevAddr : 7;
- UINT32 TDTokenEndPt : 4;
- UINT32 TDTokenDataToggle : 1;
- UINT32 TDTokenRsvd : 1;
- UINT32 TDTokenMaxLen : 11;
- UINT32 TDBufferPtr;
-} TD;
-
-#pragma pack()
-
-typedef struct {
- QUEUE_HEAD QH;
- VOID *ptrNext;
- VOID *ptrDown;
- VOID *ptrNextIntQH; // for interrupt transfer's special use
- VOID *LoopPtr;
-} QH_STRUCT;
-
-typedef struct {
- TD TDData;
- UINT8 *pTDBuffer;
- VOID *ptrNextTD;
- VOID *ptrNextQH;
- UINT16 TDBufferLength;
- UINT16 reserved;
-} TD_STRUCT;
-
-//
-// ////////////////////////////////////////////////////////////////////////
-//
-// Universal Host Controller Device Data Structure
-//
-//////////////////////////////////////////////////////////////////////////
-#define USB_HC_DEV_FROM_THIS(a) CR (a, USB_HC_DEV, UsbHc, USB_HC_DEV_SIGNATURE)
-#define USB2_HC_DEV_FROM_THIS(a) CR (a, USB_HC_DEV, Usb2Hc, USB_HC_DEV_SIGNATURE)
-
-#define USB_HC_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'h', 'c', 'i')
-#define INTERRUPT_LIST_SIGNATURE EFI_SIGNATURE_32 ('i', 'n', 't', 's')
-typedef struct {
- UINTN Signature;
-
- LIST_ENTRY Link;
- UINT8 DevAddr;
- UINT8 EndPoint;
- UINT8 DataToggle;
- UINT8 Reserved[5];
- TD_STRUCT *PtrFirstTD;
- QH_STRUCT *PtrQH;
- UINTN DataLen;
- UINTN PollInterval;
- VOID *Mapping;
- UINT8 *DataBuffer; // allocated host memory, not mapped memory
- EFI_ASYNC_USB_TRANSFER_CALLBACK InterruptCallBack;
- VOID *InterruptContext;
-} INTERRUPT_LIST;
-
-#define INTERRUPT_LIST_FROM_LINK(a) CR (a, INTERRUPT_LIST, Link, INTERRUPT_LIST_SIGNATURE)
-
-typedef struct {
- UINT32 FrameListPtrTerminate : 1;
- UINT32 FrameListPtrQSelect : 1;
- UINT32 FrameListRsvd : 2;
- UINT32 FrameListPtr : 28;
-
-} FRAMELIST_ENTRY;
-
-typedef struct _MEMORY_MANAGE_HEADER {
- UINT8 *BitArrayPtr;
- UINTN BitArraySizeInBytes;
- UINT8 *MemoryBlockPtr;
- UINTN MemoryBlockSizeInBytes;
- VOID *Mapping;
- struct _MEMORY_MANAGE_HEADER *Next;
-} MEMORY_MANAGE_HEADER;
-
-typedef struct {
- UINTN Signature;
- EFI_USB_HC_PROTOCOL UsbHc;
- EFI_USB2_HC_PROTOCOL Usb2Hc;
- EFI_PCI_IO_PROTOCOL *PciIo;
-
- //
- // local data
- //
- LIST_ENTRY InterruptListHead;
- FRAMELIST_ENTRY *FrameListEntry;
- VOID *FrameListMapping;
- MEMORY_MANAGE_HEADER *MemoryHeader;
- EFI_EVENT InterruptTransTimer;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
-} USB_HC_DEV;
-
-extern EFI_DRIVER_BINDING_PROTOCOL gUhciDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUhciComponentName;
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UhciComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UhciComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle, OPTIONAL
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-EFI_STATUS
-WriteUHCCommandReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 CmdAddrOffset,
- IN UINT16 UsbCmd
- )
-/*++
-
-Routine Description:
-
- Write UHCI Command Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- CmdAddrOffset - Command address offset
- UsbCmd - Data to write
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-ReadUHCCommandReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 CmdAddrOffset,
- IN OUT UINT16 *Data
- )
-/*++
-
-Routine Description:
-
- Read UHCI Command Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- CmdAddrOffset - Command address offset
- Data - Data to return
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-WriteUHCStatusReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusAddrOffset,
- IN UINT16 UsbSts
- )
-/*++
-
-Routine Description:
-
- Write UHCI Staus Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusAddrOffset - Status address offset
- UsbSts - Data to write
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-ReadUHCStatusReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusAddrOffset,
- IN OUT UINT16 *Data
- )
-/*++
-
-Routine Description:
-
- Read UHCI Staus Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusAddrOffset - Status address offset
- UsbSts - Data to return
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-ClearStatusReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusAddrOffset
- )
-/*++
-
-Routine Description:
-
- Clear the content of UHC's Status Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusAddrOffset - Status address offset
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-ReadUHCFrameNumberReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FrameNumAddrOffset,
- IN OUT UINT16 *Data
- )
-/*++
-
-Routine Description:
-
- Read from UHC's Frame Number Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- FrameNumAddrOffset - Frame number register offset
- Data - Data to return
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-WriteUHCFrameListBaseReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FlBaseAddrOffset,
- IN UINT32 UsbFrameListBaseAddr
- )
-/*++
-
-Routine Description:
-
- Write to UHC's Frame List Base Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- FlBaseAddrOffset - Frame Base address register
- UsbFrameListBaseAddr - Address to write
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-ReadRootPortReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 PortAddrOffset,
- IN OUT UINT16 *Data
- )
-/*++
-
-Routine Description:
-
- Read from UHC's Root Port Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- PortAddrOffset - Port Addrress Offset,
- Data - Data to return
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-WriteRootPortReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 PortAddrOffset,
- IN UINT16 ControlBits
- )
-/*++
-
-Routine Description:
-
- Write to UHC's Root Port Register
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- PortAddrOffset - Port Addrress Offset,
- ControlBits - Data to write
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-WaitForUHCHalt (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusRegAddr,
- IN UINTN Timeout
- )
-/*++
-
-Routine Description:
-
- Wait until UHCI halt or timeout
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusRegAddr - Status Register Address
- Timeout - Time out value in us
-
-Returns:
-
- EFI_DEVICE_ERROR - Unable to read the status register
- EFI_TIMEOUT - Time out
- EFI_SUCCESS - Success
-
---*/
-;
-
-BOOLEAN
-IsStatusOK (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusRegAddr
- )
-/*++
-
-Routine Description:
-
- Judge whether the host controller operates well
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusRegAddr - Status register address
-
-Returns:
-
- TRUE - Status is good
- FALSE - Status is bad
-
---*/
-;
-
-BOOLEAN
-IsHostSysOrProcessErr (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 StatusRegAddr
- )
-/*++
-
-Routine Description:
-
- Judge the status is HostSys,ProcessErr error or good
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- StatusRegAddr - Status register address
-
-Returns:
-
- TRUE - Status is good
- FALSE - Status is bad
-
---*/
-;
-
-UINT16
-GetCurrentFrameNumber (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FrameNumAddrOffset
- )
-/*++
-
-Routine Description:
-
- Get Current Frame Number
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- FrameNumAddrOffset - FrameNum register AddrOffset
-
-Returns:
-
- Frame number
-
---*/
-;
-
-EFI_STATUS
-SetFrameListBaseAddress (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FLBASEADDRReg,
- IN UINT32 Addr
- )
-/*++
-
-Routine Description:
-
- Set FrameListBase Address
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- FlBaseAddrReg - FrameListBase register
- Addr - Address to set
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-UINT32
-GetFrameListBaseAddress (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 FLBAddr
- )
-/*++
-
-Routine Description:
-
- Get Current Frame Number
-
-Arguments:
-
- PciIo - EFI_PCI_IO_PROTOCOL
- FrameNumAddrOffset - FrameNum register AddrOffset
-
-Returns:
-
- Frame number
-
---*/
-;
-
-EFI_STATUS
-CreateFrameList (
- IN USB_HC_DEV *HcDev,
- IN UINT32 FLBASEADDRReg
- )
-/*++
-
-Routine Description:
-
- CreateFrameList
-
-Arguments:
-
- HcDev - USB_HC_DEV
- FlBaseAddrReg - Frame List register
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can't allocate memory resources
- EFI_UNSUPPORTED - Map memory fail
- EFI_SUCCESS - Success
-
---*/
-;
-
-EFI_STATUS
-FreeFrameListEntry (
- IN USB_HC_DEV *UhcDev
- )
-/*++
-
-Routine Description:
-
- Free FrameList buffer
-
-Arguments:
-
- HcDev - USB_HC_DEV
-
-Returns:
-
- EFI_SUCCESS - success
-
---*/
-;
-
-VOID
-InitFrameList (
- IN USB_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Initialize FrameList
-
-Arguments:
-
- HcDev - USB_HC_DEV
-
-Returns:
- VOID
-
---*/
-;
-
-EFI_STATUS
-CreateQH (
- IN USB_HC_DEV *HcDev,
- OUT QH_STRUCT **pptrQH
- )
-/*++
-
-Routine Description:
-
- CreateQH
-
-Arguments:
-
- HcDev - USB_HC_DEV
- pptrQH - QH_STRUCT content to return
-Returns:
-
- EFI_SUCCESS - Success
- EFI_OUT_OF_RESOURCES - Can't allocate memory
-
---*/
-;
-
-VOID
-SetQHHorizontalLinkPtr (
- IN QH_STRUCT *ptrQH,
- IN VOID *ptrNext
- )
-/*++
-
-Routine Description:
-
- Set QH Horizontal Link Pointer
-
-Arguments:
-
- PtrQH - QH_STRUCT
- ptrNext - Data to write
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID *
-GetQHHorizontalLinkPtr (
- IN QH_STRUCT *ptrQH
- )
-/*++
-
-Routine Description:
-
- Get QH Horizontal Link Pointer
-
-Arguments:
-
- PtrQH - QH_STRUCT
-
-
-Returns:
-
- Data to return
-
---*/
-;
-
-VOID
-SetQHHorizontalQHorTDSelect (
- IN QH_STRUCT *ptrQH,
- IN BOOLEAN bQH
- )
-/*++
-
-Routine Description:
-
- Set QH Horizontal QH or TD
-
-Arguments:
-
- PtrQH - QH_STRUCT
- bQH - TRUE is QH FALSE is TD
-
-Returns:
- VOID
-
---*/
-;
-
-VOID
-SetQHHorizontalValidorInvalid (
- IN QH_STRUCT *ptrQH,
- IN BOOLEAN bValid
- )
-/*++
-
-Routine Description:
-
- Set QH Horizontal Valid or Invalid
-
-Arguments:
-
- PtrQH - QH_STRUCT
- bValid - TRUE is Valid FALSE is Invalid
-
-Returns:
- VOID
-
---*/
-;
-
-VOID
-SetQHVerticalLinkPtr (
- IN QH_STRUCT *ptrQH,
- IN VOID *ptrNext
- )
-/*++
-
-Routine Description:
-
- Set QH Vertical Link Pointer
-
-Arguments:
-
- PtrQH - QH_STRUCT
- ptrNext - Data to write
-Returns:
-
- VOID
-
---*/
-;
-
-VOID *
-GetQHVerticalLinkPtr (
- IN QH_STRUCT *ptrQH
- )
-/*++
-
-Routine Description:
-
- Get QH Vertical Link Pointer
-
-Arguments:
-
- PtrQH - QH_STRUCT
-
-Returns:
-
- Data to return
-
---*/
-;
-
-VOID
-SetQHVerticalQHorTDSelect (
- IN QH_STRUCT *ptrQH,
- IN BOOLEAN bQH
- )
-/*++
-
-Routine Description:
-
- Set QH Vertical QH or TD
-
-Arguments:
-
- PtrQH - QH_STRUCT
- bQH - TRUE is QH FALSE is TD
-
-Returns:
-
- VOID
-
---*/
-;
-
-BOOLEAN
-IsQHHorizontalQHSelect (
- IN QH_STRUCT *ptrQH
- )
-/*++
-
-Routine Description:
-
- Is QH Horizontal QH Select
-
-Arguments:
-
- PtrQH - QH_STRUCT
-
-Returns:
-
- TRUE - QH
- FALSE - TD
-
---*/
-;
-
-VOID
-SetQHVerticalValidorInvalid (
- IN QH_STRUCT *ptrQH,
- IN BOOLEAN bValid
- )
-/*++
-
-Routine Description:
-
- Set QH Vertical Valid or Invalid
-
-Arguments:
-
- PtrQH - QH_STRUCT
- IsValid - TRUE is valid FALSE is invalid
-
-Returns:
-
- VOID
-
---*/
-;
-
-BOOLEAN
-GetQHVerticalValidorInvalid (
- IN QH_STRUCT *ptrQH
- )
-/*++
-
-Routine Description:
-
- Get QH Vertical Valid or Invalid
-
-Arguments:
-
- PtrQH - QH_STRUCT
-
-Returns:
-
- TRUE - Valid
- FALSE - Invalid
-
---*/
-;
-
-EFI_STATUS
-AllocateTDStruct (
- IN USB_HC_DEV *HcDev,
- OUT TD_STRUCT **ppTDStruct
- )
-/*++
-
-Routine Description:
-
- Allocate TD Struct
-
-Arguments:
-
- HcDev - USB_HC_DEV
- ppTDStruct - place to store TD_STRUCT pointer
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-CreateTD (
- IN USB_HC_DEV *HcDev,
- OUT TD_STRUCT **pptrTD
- )
-/*++
-
-Routine Description:
-
- Create TD
-
-Arguments:
-
- HcDev - USB_HC_DEV
- pptrTD - TD_STRUCT pointer to store
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can't allocate resources
- EFI_SUCCESS - Success
-
---*/
-;
-
-
-EFI_STATUS
-GenSetupStageTD (
- IN USB_HC_DEV *HcDev,
- IN UINT8 DevAddr,
- IN UINT8 Endpoint,
- IN BOOLEAN bSlow,
- IN UINT8 *pDevReq,
- IN UINT8 RequestLen,
- OUT TD_STRUCT **ppTD
- )
-/*++
-
-Routine Description:
-
- Generate Setup Stage TD
-
-Arguments:
-
- HcDev - USB_HC_DEV
- DevAddr - Device address
- Endpoint - Endpoint number
- bSlow - Full speed or low speed
- pDevReq - Device request
- RequestLen - Request length
- ppTD - TD_STRUCT to return
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can't allocate memory
- EFI_SUCCESS - Success
-
---*/
-;
-
-EFI_STATUS
-GenDataTD (
- IN USB_HC_DEV *HcDev,
- IN UINT8 DevAddr,
- IN UINT8 Endpoint,
- IN UINT8 *pData,
- IN UINT8 Len,
- IN UINT8 PktID,
- IN UINT8 Toggle,
- IN BOOLEAN bSlow,
- OUT TD_STRUCT **ppTD
- )
-/*++
-
-Routine Description:
-
- Generate Data Stage TD
-
-Arguments:
-
- HcDev - USB_HC_DEV
- DevAddr - Device address
- Endpoint - Endpoint number
- pData - Data buffer
- Len - Data length
- PktID - Packet ID
- Toggle - Data toggle value
- bSlow - Full speed or low speed
- ppTD - TD_STRUCT to return
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can't allocate memory
- EFI_SUCCESS - Success
-
---*/
-;
-
-EFI_STATUS
-CreateStatusTD (
- IN USB_HC_DEV *HcDev,
- IN UINT8 DevAddr,
- IN UINT8 Endpoint,
- IN UINT8 PktID,
- IN BOOLEAN bSlow,
- OUT TD_STRUCT **ppTD
- )
-/*++
-
-Routine Description:
-
- Generate Setup Stage TD
-
-Arguments:
-
- HcDev - USB_HC_DEV
- DevAddr - Device address
- Endpoint - Endpoint number
- bSlow - Full speed or low speed
- pDevReq - Device request
- RequestLen - Request length
- ppTD - TD_STRUCT to return
-Returns:
-
- EFI_OUT_OF_RESOURCES - Can't allocate memory
- EFI_SUCCESS - Success
-
---*/
-;
-
-VOID
-SetTDLinkPtrValidorInvalid (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bValid
- )
-/*++
-
-Routine Description:
-
- Set TD Link Pointer Valid or Invalid
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- bValid - TRUE is valid FALSE is invalid
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDLinkPtrQHorTDSelect (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bQH
- )
-/*++
-
-Routine Description:
-
- Set TD Link Pointer QH or TD Select
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- bQH - TRUE is QH FALSE is TD
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDLinkPtrDepthorBreadth (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bDepth
- )
-/*++
-
-Routine Description:
-
- Set TD Link Pointer depth or bread priority
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- bDepth - TRUE is Depth FALSE is Breadth
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDLinkPtr (
- IN TD_STRUCT *ptrTDStruct,
- IN VOID *ptrNext
- )
-/*++
-
-Routine Description:
-
- Set TD Link Pointer
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- ptrNext - Pointer to set
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID *
-GetTDLinkPtr (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Get TD Link Pointer
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
-
-Returns:
-
- Pointer to get
-
---*/
-;
-
-VOID
-EnableorDisableTDShortPacket (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bEnable
- )
-/*++
-
-Routine Description:
-
- Enable or Disable TD ShortPacket
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- bEnable - TRUE is Enanble FALSE is Disable
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDControlErrorCounter (
- IN TD_STRUCT *ptrTDStruct,
- IN UINT8 nMaxErrors
- )
-/*++
-
-Routine Description:
-
- Set TD Control ErrorCounter
-
-Arguments:
-
- ptrTDStruct - TD_STRUCT
- nMaxErrors - Error counter number
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDLoworFullSpeedDevice (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bLowSpeedDevice
- )
-/*++
-
-Routine Description:
-
- Set TD status low speed or full speed
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
- bLowSpeedDevice - Show low speed or full speed
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDControlIsochronousorNot (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bIsochronous
- )
-/*++
-
-Routine Description:
-
- Set TD status Isochronous or not
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
- IsIsochronous - Show Isochronous or not
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetorClearTDControlIOC (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bSet
- )
-/*++
-
-Routine Description:
-
- Set TD status IOC IsSet
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
- IsSet - Show IOC set or not
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDStatusActiveorInactive (
- IN TD_STRUCT *ptrTDStruct,
- IN BOOLEAN bActive
- )
-/*++
-
-Routine Description:
-
- Set TD status active or not
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
- IsActive - Active or not
-
-Returns:
-
- VOID
-
---*/
-;
-
-UINT16
-SetTDTokenMaxLength (
- IN TD_STRUCT *ptrTDStruct,
- IN UINT16 nMaxLen
- )
-/*++
-
-Routine Description:
-
- Set TD Token maxlength
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
- MaximumLength - Maximum length of TD Token
-
-Returns:
-
- Real maximum length set to TD Token
-
---*/
-;
-
-VOID
-SetTDTokenDataToggle1 (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Set TD Token data toggle1
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDTokenDataToggle0 (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Set TD Token data toggle0
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- VOID
-
---*/
-;
-
-UINT8
-GetTDTokenDataToggle (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Get TD Token data toggle
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- data toggle value
-
---*/
-;
-
-VOID
-SetTDTokenEndPoint (
- IN TD_STRUCT *ptrTDStruct,
- IN UINTN nEndPoint
- )
-/*++
-
-Routine Description:
-
- Set Data Token endpoint number
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
- EndPoint - End point number
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDTokenDeviceAddress (
- IN TD_STRUCT *ptrTDStruct,
- IN UINTN nDevAddr
- )
-/*++
-
-Routine Description:
-
- Set TD Token device address
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
- DeviceAddress - Device address
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDTokenPacketID (
- IN TD_STRUCT *ptrTDStruct,
- IN UINT8 nPID
- )
-/*++
-
-Routine Description:
-
- Set TD Token packet ID
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
- PID - Packet ID
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetTDDataBuffer (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Set TD data buffer
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- VOID
-
---*/
-;
-
-BOOLEAN
-IsTDStatusActive (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Indicate whether TD status active or not
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- TRUE - Active
- FALSE - Inactive
-
---*/
-;
-
-BOOLEAN
-IsTDStatusStalled (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Indicate whether TD status stalled or not
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- TRUE - Stalled
- FALSE - not stalled
-
---*/
-;
-
-BOOLEAN
-IsTDStatusBufferError (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Indicate whether TD status buffer error or not
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- TRUE - Buffer error
- FALSE - No error
-
---*/
-;
-
-BOOLEAN
-IsTDStatusBabbleError (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Indicate whether TD status babble error or not
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- TRUE - Babble error
- FALSE - No error
-
---*/
-;
-
-BOOLEAN
-IsTDStatusNAKReceived (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Indicate whether TD status NAK received
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- TRUE - NAK received
- FALSE - NAK not received
-
---*/
-;
-
-BOOLEAN
-IsTDStatusCRCTimeOutError (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Indicate whether TD status CRC timeout error or not
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- TRUE - CRC timeout error
- FALSE - CRC timeout no error
-
---*/
-;
-
-BOOLEAN
-IsTDStatusBitStuffError (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Indicate whether TD status bit stuff error or not
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- TRUE - Bit stuff error
- FALSE - Bit stuff no error
-
---*/
-;
-
-UINT16
-GetTDStatusActualLength (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Get TD status length
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- Return Td status length
-
---*/
-;
-
-UINT16
-GetTDTokenMaxLength (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Get TD Token maximum length
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- Return TD token maximum length
-
---*/
-;
-
-UINT8
-GetTDTokenEndPoint (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Get TD Token endpoint number
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- Return TD Token endpoint number
-
---*/
-;
-
-UINT8
-GetTDTokenDeviceAddress (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Get TD Token device address
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- Return TD Token device address
-
---*/
-;
-
-UINT8
-GetTDTokenPacketID (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Get TD Token packet ID
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- Return TD Token packet ID
-
---*/
-;
-
-UINT8 *
-GetTDDataBuffer (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Get the point to TD data buffer
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- Return a point to TD data buffer
-
---*/
-;
-
-BOOLEAN
-GetTDLinkPtrValidorInvalid (
- IN TD_STRUCT *ptrTDStruct
- )
-/*++
-
-Routine Description:
-
- Get TD LinkPtr valid or not
-
-Arguments:
-
- ptrTDStruct - A point to TD_STRUCT
-
-Returns:
-
- TRUE - Invalid
- FALSE - Valid
-
---*/
-;
-
-UINTN
-CountTDsNumber (
- IN TD_STRUCT *ptrFirstTD
- )
-/*++
-
-Routine Description:
-
- Get the number of TDs
-
-Arguments:
-
- PtrFirstTD - A point to the first TD_STRUCT
-
-Returns:
-
- Return the number of TDs
-
---*/
-;
-
-VOID
-LinkTDToQH (
- IN QH_STRUCT *ptrQH,
- IN TD_STRUCT *ptrTD
- )
-/*++
-
-Routine Description:
-
- Link TD To QH
-
-Arguments:
-
- PtrQH - QH_STRUCT
- PtrTD - TD_STRUCT
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-LinkTDToTD (
- IN TD_STRUCT *ptrPreTD,
- IN TD_STRUCT *ptrTD
- )
-/*++
-
-Routine Description:
-
- Link TD To TD
-
-Arguments:
-
- ptrPreTD - Previous TD_STRUCT to be linked
- PtrTD - TD_STRUCT to link
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetorClearCurFrameListTerminate (
- IN FRAMELIST_ENTRY *pCurEntry,
- IN BOOLEAN bSet
- )
-/*++
-
-Routine Description:
-
- Set or clear current framelist terminate
-
-Arguments:
-
- pCurEntry - A point to FRAMELIST_ENTITY
- IsSet - TRUE to empty the frame and indicate the Pointer field is valid
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-SetCurFrameListQHorTD (
- IN FRAMELIST_ENTRY *pCurEntry,
- IN BOOLEAN bQH
- )
-/*++
-
-Routine Description:
-
- Set current framelist QH or TD
-
-Arguments:
-
- pCurEntry - A point to FRAMELIST_ENTITY
- IsQH - TRUE to set QH and FALSE to set TD
-
-Returns:
-
- VOID
-
---*/
-;
-
-BOOLEAN
-GetCurFrameListTerminate (
- IN FRAMELIST_ENTRY *pCurEntry
- )
-/*++
-
-Routine Description:
-
- Get current framelist terminate
-
-Arguments:
-
- pCurEntry - A point to FRAMELIST_ENTITY
-
-Returns:
-
- TRUE - Terminate
- FALSE - Not terminate
-
---*/
-;
-
-VOID
-SetCurFrameListPointer (
- IN FRAMELIST_ENTRY *pCurEntry,
- IN UINT8 *ptr
- )
-/*++
-
-Routine Description:
-
- Set current framelist pointer
-
-Arguments:
-
- pCurEntry - A point to FRAMELIST_ENTITY
- ptr - A point to FrameListPtr point to
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID *
-GetCurFrameListPointer (
- IN FRAMELIST_ENTRY *pCurEntry
- )
-/*++
-
-Routine Description:
-
- Get current framelist pointer
-
-Arguments:
-
- pCurEntry - A point to FRAMELIST_ENTITY
-
-Returns:
-
- A point FrameListPtr point to
-
---*/
-;
-
-VOID
-LinkQHToFrameList (
- IN FRAMELIST_ENTRY *pEntry,
- IN UINT16 FrameListIndex,
- IN QH_STRUCT *ptrQH
- )
-/*++
-
-Routine Description:
-
- Link QH To Frame List
-
-Arguments:
-
- pEntry - FRAMELIST_ENTRY
- FrameListIndex - Frame List Index
- PtrQH - QH to link
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-DelLinkSingleQH (
- IN USB_HC_DEV *HcDev,
- IN QH_STRUCT *ptrQH,
- IN UINT16 FrameListIndex,
- IN BOOLEAN SearchOther,
- IN BOOLEAN Delete
- )
-/*++
-
-Routine Description:
-
- Unlink from frame list and delete single QH
-
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrQH - QH_STRUCT
- FrameListIndex - Frame List Index
- SearchOther - Search Other QH
- Delete - TRUE is to delete the QH
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-DeleteQueuedTDs (
- IN USB_HC_DEV *HcDev,
- IN TD_STRUCT *ptrFirstTD
- )
-/*++
-
-Routine Description:
-
- Delete Queued TDs
-
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrFirstTD - TD link list head
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-InsertQHTDToINTList (
- IN USB_HC_DEV *HcDev,
- IN QH_STRUCT *ptrQH,
- IN TD_STRUCT *ptrFirstTD,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DataToggle,
- IN UINTN DataLength,
- IN UINTN PollingInterval,
- IN VOID *Mapping,
- IN UINT8 *DataBuffer,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
- IN VOID *Context
- )
-/*++
-Routine Description:
-
- Insert QH and TD To Interrupt List
-
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrQH - QH_STRUCT
- PtrFirstTD - First TD_STRUCT
- DeviceAddress - Device Address
- EndPointAddress - EndPoint Address
- DataToggle - Data Toggle
- DataLength - Data length
- PollingInterval - Polling Interval when inserted to frame list
- Mapping - Mapping alue
- DataBuffer - Data buffer
- CallBackFunction- CallBackFunction after interrupt transfeer
- Context - CallBackFunction Context passed as function parameter
-
-Returns:
-
- EFI_SUCCESS - Sucess
- EFI_INVALID_PARAMETER - Paremeter is error
-
---*/
-;
-
-EFI_STATUS
-DeleteAsyncINTQHTDs (
- IN USB_HC_DEV *HcDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- OUT UINT8 *DataToggle
- )
-/*++
-Routine Description:
-
- Delete Async INT QH and TDs
-
-Arguments:
-
- HcDev - USB_HC_DEV
- DeviceAddress - Device Address
- EndPointAddress - EndPoint Address
- DataToggle - Data Toggle
-
-Returns:
-
- EFI_SUCCESS - Sucess
- EFI_INVALID_PARAMETER - Paremeter is error
-
---*/
-;
-
-BOOLEAN
-CheckTDsResults (
- IN TD_STRUCT *ptrTD,
- IN UINTN RequiredLen,
- OUT UINT32 *Result,
- OUT UINTN *ErrTDPos,
- OUT UINTN *ActualTransferSize
- )
-/*++
-
-Routine Description:
-
- Check TDs Results
-
-Arguments:
-
- PtrTD - TD_STRUCT to check
- RequiredLen - Required Len
- Result - Transfer result
- ErrTDPos - Error TD Position
- ActualTransferSize - Actual Transfer Size
-
-Returns:
-
- TRUE - Sucess
- FALSE - Fail
-
---*/
-;
-
-VOID
-ExecuteAsyncINTTDs (
- IN USB_HC_DEV *HcDev,
- IN INTERRUPT_LIST *ptrList,
- OUT UINT32 *Result,
- OUT UINTN *ErrTDPos,
- OUT UINTN *ActualLen
- )
-/*++
-
-Routine Description:
-
- Execute Async Interrupt TDs
-
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrList - INTERRUPT_LIST
- Result - Transfer result
- ErrTDPos - Error TD Position
- ActualTransferSize - Actual Transfer Size
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-UpdateAsyncINTQHTDs (
- IN INTERRUPT_LIST *ptrList,
- IN UINT32 Result,
- IN UINT32 ErrTDPos
- )
-/*++
-
-Routine Description:
-
- Update Async Interrupt QH and TDs
-
-Arguments:
-
- PtrList - INTERRUPT_LIST
- Result - Transfer reslut
- ErrTDPos - Error TD Position
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-ReleaseInterruptList (
- IN USB_HC_DEV *HcDev,
- IN LIST_ENTRY *ListHead
- )
-/*++
-
-Routine Description:
-
- Release Interrupt List
-
-Arguments:
-
- HcDev - USB_HC_DEV
- ListHead - List head
-
-Returns:
-
- VOID
-
---*/
-;
-
-EFI_STATUS
-ExecuteControlTransfer (
- IN USB_HC_DEV *HcDev,
- IN TD_STRUCT *ptrTD,
- IN UINT32 wIndex,
- OUT UINTN *ActualLen,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- )
-/*++
-
-Routine Description:
-
- Execute Control Transfer
-
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrTD - TD_STRUCT
- wIndex - No use
- ActualLen - Actual transfered Len
- TimeOut - TimeOut value in milliseconds
- TransferResult - Transfer result
-Returns:
-
- EFI_SUCCESS - Sucess
- EFI_DEVICE_ERROR - Error
-
-
---*/
-;
-
-EFI_STATUS
-ExecBulkorSyncInterruptTransfer (
- IN USB_HC_DEV *HcDev,
- IN TD_STRUCT *ptrTD,
- IN UINT32 wIndex,
- OUT UINTN *ActualLen,
- OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- )
-/*++
-
-Routine Description:
-
- Execute Bulk or SyncInterrupt Transfer
-
-Arguments:
-
- HcDev - USB_HC_DEV
- PtrTD - TD_STRUCT
- wIndex - No use
- ActualLen - Actual transfered Len
- DataToggle - Data Toggle
- TimeOut - TimeOut value in milliseconds
- TransferResult - Transfer result
-Returns:
-
- EFI_SUCCESS - Sucess
- EFI_DEVICE_ERROR - Error
---*/
-;
-
-EFI_STATUS
-InitializeMemoryManagement (
- IN USB_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Initialize Memory Management
-
-Arguments:
-
- HcDev - USB_HC_DEV
-
-Returns:
-
- EFI_SUCCESS - Success
-
---*/
-;
-
-EFI_STATUS
-CreateMemoryBlock (
- IN USB_HC_DEV *HcDev,
- IN MEMORY_MANAGE_HEADER **MemoryHeader,
- IN UINTN MemoryBlockSizeInPages
- )
-/*++
-
-Routine Description:
-
- Use PciIo->AllocateBuffer to allocate common buffer for the memory block,
- and use PciIo->Map to map the common buffer for Bus Master Read/Write.
-
-
-Arguments:
-
- HcDev - USB_HC_DEV
- MemoryHeader - MEMORY_MANAGE_HEADER to output
- MemoryBlockSizeInPages - MemoryBlockSizeInPages
-
-Returns:
-
- EFI_SUCCESS - Success
- EFI_OUT_OF_RESOURCES - Out of resources
- EFI_UNSUPPORTED - Unsupported
-
---*/
-;
-
-EFI_STATUS
-FreeMemoryHeader (
- IN USB_HC_DEV *HcDev,
- IN MEMORY_MANAGE_HEADER *MemoryHeader
- )
-/*++
-
-Routine Description:
-
- Free Memory Header
-
-Arguments:
-
- HcDev - USB_HC_DEV
- MemoryHeader - MemoryHeader to be freed
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
-
---*/
-;
-
-EFI_STATUS
-UhciAllocatePool (
- IN USB_HC_DEV *UhcDev,
- IN UINT8 **Pool,
- IN UINTN AllocSize
- )
-/*++
-
-Routine Description:
-
- Uhci Allocate Pool
-
-Arguments:
-
- HcDev - USB_HC_DEV
- Pool - Place to store pointer to the memory buffer
- AllocSize - Alloc Size
-
-Returns:
-
- EFI_SUCCESS - Success
-
---*/
-;
-
-VOID
-UhciFreePool (
- IN USB_HC_DEV *HcDev,
- IN UINT8 *Pool,
- IN UINTN AllocSize
- )
-/*++
-
-Routine Description:
-
- Uhci Free Pool
-
-Arguments:
-
- HcDev - USB_HC_DEV
- Pool - Pool to free
- AllocSize - Pool size
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-InsertMemoryHeaderToList (
- IN MEMORY_MANAGE_HEADER *MemoryHeader,
- IN MEMORY_MANAGE_HEADER *NewMemoryHeader
- )
-/*++
-
-Routine Description:
-
- Insert Memory Header To List
-
-Arguments:
-
- MemoryHeader - MEMORY_MANAGE_HEADER
- NewMemoryHeader - MEMORY_MANAGE_HEADER
-
-Returns:
-
- VOID
-
---*/
-;
-
-EFI_STATUS
-AllocMemInMemoryBlock (
- IN MEMORY_MANAGE_HEADER *MemoryHeader,
- IN VOID **Pool,
- IN UINTN NumberOfMemoryUnit
- )
-/*++
-
-Routine Description:
-
- Alloc Memory In MemoryBlock
-
-Arguments:
-
- MemoryHeader - MEMORY_MANAGE_HEADER
- Pool - Place to store pointer to memory
- NumberOfMemoryUnit - Number Of Memory Unit
-
-Returns:
-
- EFI_NOT_FOUND - Can't find the free memory
- EFI_SUCCESS - Success
-
---*/
-;
-
-BOOLEAN
-IsMemoryBlockEmptied (
- IN MEMORY_MANAGE_HEADER *MemoryHeaderPtr
- )
-/*++
-
-Routine Description:
-
- Is Memory Block Emptied
-
-Arguments:
-
- MemoryHeaderPtr - MEMORY_MANAGE_HEADER
-
-Returns:
-
- TRUE - Empty
- FALSE - Not Empty
-
---*/
-;
-
-VOID
-DelinkMemoryBlock (
- IN MEMORY_MANAGE_HEADER *FirstMemoryHeader,
- IN MEMORY_MANAGE_HEADER *FreeMemoryHeader
- )
-/*++
-
-Routine Description:
-
- Delink Memory Block
-
-Arguments:
-
- FirstMemoryHeader - MEMORY_MANAGE_HEADER
- NeedFreeMemoryHeader - MEMORY_MANAGE_HEADER
-
-Returns:
-
- VOID
-
---*/
-;
-
-EFI_STATUS
-DelMemoryManagement (
- IN USB_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Delete Memory Management
-
-Arguments:
-
- HcDev - USB_HC_DEV
-
-Returns:
-
- EFI_SUCCESS - Success
-
---*/
-;
-
-VOID
-EnableMaxPacketSize (
- IN USB_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Enable Max Packet Size
-
-Arguments:
-
- HcDev - USB_HC_DEV
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-CleanUsbTransactions (
- IN USB_HC_DEV *HcDev
- )
-/*++
-
-Routine Description:
-
- Clean USB Transactions
-
-Arguments:
-
- HcDev - A point to USB_HC_DEV
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-TurnOffUSBEmulation (
- IN EFI_PCI_IO_PROTOCOL *PciIo
- )
-/*++
-
-Routine Description:
-
- Set current framelist QH or TD
-
-Arguments:
-
- pCurEntry - A point to FRAMELIST_ENTITY
- IsQH - TRUE to set QH and FALSE to set TD
-
-Returns:
-
- VOID
-
---*/
-;
-
-//
-// Prototypes
-// Driver model protocol interface
-//
-
-EFI_STATUS
-EFIAPI
-UHCIDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-UHCIDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-UHCIDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// UHCI interface functions
-//
-
-EFI_STATUS
-EFIAPI
-UHCIReset (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT16 Attributes
- );
-
-EFI_STATUS
-EFIAPI
-UHCIGetState (
- IN EFI_USB_HC_PROTOCOL *This,
- OUT EFI_USB_HC_STATE *State
- );
-
-EFI_STATUS
-EFIAPI
-UHCISetState (
- IN EFI_USB_HC_PROTOCOL *This,
- IN EFI_USB_HC_STATE State
- );
-
-EFI_STATUS
-EFIAPI
-UHCIControlTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN BOOLEAN IsSlowDevice,
- IN UINT8 MaximumPacketLength,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data, OPTIONAL
- IN OUT UINTN *DataLength, OPTIONAL
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-UHCIBulkTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-UHCIAsyncInterruptTransfer (
- IN EFI_USB_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN BOOLEAN IsSlowDevice,
- IN UINT8 MaximumPacketLength,
- IN BOOLEAN IsNewTransfer,
- IN OUT UINT8 *DataToggle,
- IN UINTN PollingInterval, OPTIONAL
- IN UINTN DataLength, OPTIONAL
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction, OPTIONAL
- IN VOID *Context OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-UHCISyncInterruptTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN BOOLEAN IsSlowDevice,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-UHCIIsochronousTransfer (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-UHCIAsyncIsochronousTransfer (
- IN EFI_USB_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 MaximumPacketLength,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-UHCIGetRootHubPortNumber (
- IN EFI_USB_HC_PROTOCOL *This,
- OUT UINT8 *PortNumber
- );
-
-EFI_STATUS
-EFIAPI
-UHCIGetRootHubPortStatus (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS *PortStatus
- );
-
-EFI_STATUS
-EFIAPI
-UHCISetRootHubPortFeature (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- );
-
-EFI_STATUS
-EFIAPI
-UHCIClearRootHubPortFeature (
- IN EFI_USB_HC_PROTOCOL *This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- );
-
-//
-// UEFI 2.0 Protocol
-//
-
-EFI_STATUS
-EFIAPI
-UHCI2GetCapability(
- IN EFI_USB2_HC_PROTOCOL * This,
- OUT UINT8 *MaxSpeed,
- OUT UINT8 *PortNumber,
- OUT UINT8 *Is64BitCapable
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2Reset (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT16 Attributes
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2GetState (
- IN EFI_USB2_HC_PROTOCOL * This,
- OUT EFI_USB_HC_STATE * State
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2SetState (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN EFI_USB_HC_STATE State
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2ControlTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN EFI_USB_DEVICE_REQUEST * Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data, OPTIONAL
- IN OUT UINTN *DataLength, OPTIONAL
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2BulkTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2AsyncInterruptTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN BOOLEAN IsNewTransfer,
- IN OUT UINT8 *DataToggle,
- IN UINTN PollingInterval, OPTIONAL
- IN UINTN DataLength, OPTIONAL
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction, OPTIONAL
- IN VOID *Context OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2SyncInterruptTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2IsochronousTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2AsyncIsochronousTransfer (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2GetRootHubPortStatus (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS * PortStatus
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2SetRootHubPortFeature (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- );
-
-EFI_STATUS
-EFIAPI
-UHCI2ClearRootHubPortFeature (
- IN EFI_USB2_HC_PROTOCOL * This,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- );
-
-//
-// Asynchronous interrupt transfer monitor function
-//
-VOID
-EFIAPI
-MonitorInterruptTrans (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Decode.c b/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Decode.c
deleted file mode 100644
index cb7fa89..0000000
--- a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Decode.c
+++ /dev/null
@@ -1,1647 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- decode.c
-
-Abstract:
-
-Revision history:
-
---*/
-
-// TODO: fix comment to add: Module Name: DECODE.C
-#include "Undi32.h"
-
-//
-// Global variables defined in this file
-//
-UNDI_CALL_TABLE api_table[PXE_OPCODE_LAST_VALID+1] = { \
- {PXE_CPBSIZE_NOT_USED,PXE_DBSIZE_NOT_USED,0, (UINT16)(ANY_STATE),UNDI_GetState },\
- {(UINT16)(DONT_CHECK),PXE_DBSIZE_NOT_USED,0,(UINT16)(ANY_STATE),UNDI_Start },\
- {PXE_CPBSIZE_NOT_USED,PXE_DBSIZE_NOT_USED,0,MUST_BE_STARTED,UNDI_Stop },\
- {PXE_CPBSIZE_NOT_USED,sizeof(PXE_DB_GET_INIT_INFO),0,MUST_BE_STARTED, UNDI_GetInitInfo },\
- {PXE_CPBSIZE_NOT_USED,sizeof(PXE_DB_GET_CONFIG_INFO),0,MUST_BE_STARTED, UNDI_GetConfigInfo },\
- {sizeof(PXE_CPB_INITIALIZE),(UINT16)(DONT_CHECK),(UINT16)(DONT_CHECK),MUST_BE_STARTED,UNDI_Initialize },\
- {PXE_CPBSIZE_NOT_USED,PXE_DBSIZE_NOT_USED,(UINT16)(DONT_CHECK), MUST_BE_INITIALIZED,UNDI_Reset },\
- {PXE_CPBSIZE_NOT_USED,PXE_DBSIZE_NOT_USED,0, MUST_BE_INITIALIZED,UNDI_Shutdown },\
- {PXE_CPBSIZE_NOT_USED,PXE_DBSIZE_NOT_USED,(UINT16)(DONT_CHECK), MUST_BE_INITIALIZED,UNDI_Interrupt },\
- {(UINT16)(DONT_CHECK),(UINT16)(DONT_CHECK),(UINT16)(DONT_CHECK), MUST_BE_INITIALIZED, UNDI_RecFilter },\
- {(UINT16)(DONT_CHECK),(UINT16)(DONT_CHECK),(UINT16)(DONT_CHECK), MUST_BE_INITIALIZED, UNDI_StnAddr },\
- {PXE_CPBSIZE_NOT_USED, (UINT16)(DONT_CHECK), (UINT16)(DONT_CHECK), MUST_BE_INITIALIZED, UNDI_Statistics },\
- {sizeof(PXE_CPB_MCAST_IP_TO_MAC),sizeof(PXE_DB_MCAST_IP_TO_MAC), (UINT16)(DONT_CHECK),MUST_BE_INITIALIZED, UNDI_ip2mac },\
- {(UINT16)(DONT_CHECK),(UINT16)(DONT_CHECK),(UINT16)(DONT_CHECK), MUST_BE_INITIALIZED, UNDI_NVData },\
- {PXE_CPBSIZE_NOT_USED,(UINT16)(DONT_CHECK),(UINT16)(DONT_CHECK), MUST_BE_INITIALIZED, UNDI_Status },\
- {(UINT16)(DONT_CHECK),PXE_DBSIZE_NOT_USED,(UINT16)(DONT_CHECK), MUST_BE_INITIALIZED, UNDI_FillHeader },\
- {(UINT16)(DONT_CHECK),PXE_DBSIZE_NOT_USED,(UINT16)(DONT_CHECK), MUST_BE_INITIALIZED, UNDI_Transmit },\
- {sizeof(PXE_CPB_RECEIVE),sizeof(PXE_DB_RECEIVE),0,MUST_BE_INITIALIZED, UNDI_Receive } \
-};
-
-//
-// end of global variables
-//
-
-VOID
-UNDI_GetState (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine determines the operational state of the UNDI. It updates the state flags in the
- Command Descriptor Block based on information derived from the AdapterInfo instance data.
-
- To ensure the command has completed successfully, CdbPtr->StatCode will contain the result of
- the command execution.
-
- The CdbPtr->StatFlags will contain a STOPPED, STARTED, or INITIALIZED state once the command
- has successfully completed.
-
- Keep in mind the AdapterInfo->State is the active state of the adapter (based on software
- interrogation), and the CdbPtr->StateFlags is the passed back information that is reflected
- to the caller of the UNDI API.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- CdbPtr->StatFlags = (PXE_STATFLAGS) (CdbPtr->StatFlags | AdapterInfo->State);
- return ;
-}
-
-VOID
-UNDI_Start (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to change the operational state of the UNDI from stopped to started.
- It will do this as long as the adapter's state is PXE_STATFLAGS_GET_STATE_STOPPED, otherwise
- the CdbPtr->StatFlags will reflect a command failure, and the CdbPtr->StatCode will reflect the
- UNDI as having already been started.
-
- This routine is modified to reflect the undi 1.1 specification changes. The
- changes in the spec are mainly in the callback routines, the new spec adds
- 3 more callbacks and a unique id.
- Since this UNDI supports both old and new undi specifications,
- The NIC's data structure is filled in with the callback routines (depending
- on the version) pointed to in the caller's CpbPtr. This seeds the Delay,
- Virt2Phys, Block, and Mem_IO for old and new versions and Map_Mem, UnMap_Mem
- and Sync_Mem routines and a unique id variable for the new version.
- This is the function which an external entity (SNP, O/S, etc) would call
- to provide it's I/O abstraction to the UNDI.
-
- It's final action is to change the AdapterInfo->State to PXE_STATFLAGS_GET_STATE_STARTED.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- PXE_CPB_START_30 *CpbPtr;
- PXE_CPB_START_31 *CpbPtr_31;
-
- //
- // check if it is already started.
- //
- if (AdapterInfo->State != PXE_STATFLAGS_GET_STATE_STOPPED) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_ALREADY_STARTED;
- return ;
- }
-
- if (CdbPtr->CPBsize != sizeof(PXE_CPB_START_30) &&
- CdbPtr->CPBsize != sizeof(PXE_CPB_START_31)) {
-
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- CpbPtr = (PXE_CPB_START_30 *) (UINTN) (CdbPtr->CPBaddr);
- CpbPtr_31 = (PXE_CPB_START_31 *) (UINTN) (CdbPtr->CPBaddr);
-
- if (AdapterInfo->VersionFlag == 0x30) {
- AdapterInfo->Delay_30 = (bsptr_30) (UINTN) CpbPtr->Delay;
- AdapterInfo->Virt2Phys_30 = (virtphys_30) (UINTN) CpbPtr->Virt2Phys;
- AdapterInfo->Block_30 = (block_30) (UINTN) CpbPtr->Block;
- //
- // patch for old buggy 3.0 code:
- // In EFI1.0 undi used to provide the full (absolute) I/O address to the
- // i/o calls and SNP used to provide a callback that used GlobalIoFncs and
- // everything worked fine! In EFI 1.1, UNDI is not using the full
- // i/o or memory address to access the device, The base values for the i/o
- // and memory address is abstracted by the device specific PciIoFncs and
- // UNDI only uses the offset values. Since UNDI3.0 cannot provide any
- // identification to SNP, SNP cannot use nic specific PciIoFncs callback!
- //
- // To fix this and make undi3.0 work with SNP in EFI1.1 we
- // use a TmpMemIo function that is defined in init.c
- // This breaks the runtime driver feature of undi, but what to do
- // if we have to provide the 3.0 compatibility (including the 3.0 bugs)
- //
- // This TmpMemIo function also takes a UniqueId parameter
- // (as in undi3.1 design) and so initialize the UniqueId as well here
- // Note: AdapterInfo->Mem_Io_30 is just filled for consistency with other
- // parameters but never used, we only use Mem_Io field in the In/Out routines
- // inside e100b.c.
- //
- AdapterInfo->Mem_Io_30 = (mem_io_30) (UINTN) CpbPtr->Mem_IO;
- AdapterInfo->Mem_Io = (mem_io) (UINTN) TmpMemIo;
- AdapterInfo->Unique_ID = (UINT64) (UINTN) AdapterInfo;
-
- } else {
- AdapterInfo->Delay = (bsptr) (UINTN) CpbPtr_31->Delay;
- AdapterInfo->Virt2Phys = (virtphys) (UINTN) CpbPtr_31->Virt2Phys;
- AdapterInfo->Block = (block) (UINTN) CpbPtr_31->Block;
- AdapterInfo->Mem_Io = (mem_io) (UINTN) CpbPtr_31->Mem_IO;
-
- AdapterInfo->Map_Mem = (map_mem) (UINTN) CpbPtr_31->Map_Mem;
- AdapterInfo->UnMap_Mem = (unmap_mem) (UINTN) CpbPtr_31->UnMap_Mem;
- AdapterInfo->Sync_Mem = (sync_mem) (UINTN) CpbPtr_31->Sync_Mem;
- AdapterInfo->Unique_ID = CpbPtr_31->Unique_ID;
- }
-
- AdapterInfo->State = PXE_STATFLAGS_GET_STATE_STARTED;
-
- return ;
-}
-
-VOID
-UNDI_Stop (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to change the operational state of the UNDI from started to stopped.
- It will not do this if the adapter's state is PXE_STATFLAGS_GET_STATE_INITIALIZED, otherwise
- the CdbPtr->StatFlags will reflect a command failure, and the CdbPtr->StatCode will reflect the
- UNDI as having already not been shut down.
-
- The NIC's data structure will have the Delay, Virt2Phys, and Block, pointers zero'd out..
-
- It's final action is to change the AdapterInfo->State to PXE_STATFLAGS_GET_STATE_STOPPED.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- if (AdapterInfo->State == PXE_STATFLAGS_GET_STATE_INITIALIZED) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_NOT_SHUTDOWN;
- return ;
- }
-
- AdapterInfo->Delay_30 = 0;
- AdapterInfo->Virt2Phys_30 = 0;
- AdapterInfo->Block_30 = 0;
-
- AdapterInfo->Delay = 0;
- AdapterInfo->Virt2Phys = 0;
- AdapterInfo->Block = 0;
-
- AdapterInfo->Map_Mem = 0;
- AdapterInfo->UnMap_Mem = 0;
- AdapterInfo->Sync_Mem = 0;
-
- AdapterInfo->State = PXE_STATFLAGS_GET_STATE_STOPPED;
-
- return ;
-}
-
-VOID
-UNDI_GetInitInfo (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to retrieve the initialization information that is needed by drivers and
- applications to initialize the UNDI. This will fill in data in the Data Block structure that is
- pointed to by the caller's CdbPtr->DBaddr. The fields filled in are as follows:
-
- MemoryRequired, FrameDataLen, LinkSpeeds[0-3], NvCount, NvWidth, MediaHeaderLen, HWaddrLen,
- MCastFilterCnt, TxBufCnt, TxBufSize, RxBufCnt, RxBufSize, IFtype, Duplex, and LoopBack.
-
- In addition, the CdbPtr->StatFlags ORs in that this NIC supports cable detection. (APRIORI knowledge)
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- PXE_DB_GET_INIT_INFO *DbPtr;
-
- DbPtr = (PXE_DB_GET_INIT_INFO *) (UINTN) (CdbPtr->DBaddr);
-
- DbPtr->MemoryRequired = MEMORY_NEEDED;
- DbPtr->FrameDataLen = PXE_MAX_TXRX_UNIT_ETHER;
- DbPtr->LinkSpeeds[0] = 10;
- DbPtr->LinkSpeeds[1] = 100;
- DbPtr->LinkSpeeds[2] = DbPtr->LinkSpeeds[3] = 0;
- DbPtr->NvCount = MAX_EEPROM_LEN;
- DbPtr->NvWidth = 4;
- DbPtr->MediaHeaderLen = PXE_MAC_HEADER_LEN_ETHER;
- DbPtr->HWaddrLen = PXE_HWADDR_LEN_ETHER;
- DbPtr->MCastFilterCnt = MAX_MCAST_ADDRESS_CNT;
-
- DbPtr->TxBufCnt = TX_BUFFER_COUNT;
- DbPtr->TxBufSize = sizeof (TxCB);
- DbPtr->RxBufCnt = RX_BUFFER_COUNT;
- DbPtr->RxBufSize = sizeof (RxFD);
-
- DbPtr->IFtype = PXE_IFTYPE_ETHERNET;
- DbPtr->SupportedDuplexModes = PXE_DUPLEX_ENABLE_FULL_SUPPORTED |
- PXE_DUPLEX_FORCE_FULL_SUPPORTED;
- DbPtr->SupportedLoopBackModes = PXE_LOOPBACK_INTERNAL_SUPPORTED |
- PXE_LOOPBACK_EXTERNAL_SUPPORTED;
-
- CdbPtr->StatFlags |= PXE_STATFLAGS_CABLE_DETECT_SUPPORTED;
- return ;
-}
-
-VOID
-UNDI_GetConfigInfo (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to retrieve the configuration information about the NIC being controlled by
- this driver. This will fill in data in the Data Block structure that is pointed to by the caller's CdbPtr->DBaddr.
- The fields filled in are as follows:
-
- DbPtr->pci.BusType, DbPtr->pci.Bus, DbPtr->pci.Device, and DbPtr->pci.
-
- In addition, the DbPtr->pci.Config.Dword[0-63] grabs a copy of this NIC's PCI configuration space.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- UINT16 Index;
- PXE_DB_GET_CONFIG_INFO *DbPtr;
-
- DbPtr = (PXE_DB_GET_CONFIG_INFO *) (UINTN) (CdbPtr->DBaddr);
-
- DbPtr->pci.BusType = PXE_BUSTYPE_PCI;
- DbPtr->pci.Bus = AdapterInfo->Bus;
- DbPtr->pci.Device = AdapterInfo->Device;
- DbPtr->pci.Function = AdapterInfo->Function;
-
- for (Index = 0; Index < MAX_PCI_CONFIG_LEN; Index++) {
- DbPtr->pci.Config.Dword[Index] = AdapterInfo->Config[Index];
- }
-
- return ;
-}
-
-VOID
-UNDI_Initialize (
- IN PXE_CDB *CdbPtr,
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine resets the network adapter and initializes the UNDI using the parameters supplied in
- the CPB. This command must be issued before the network adapter can be setup to transmit and
- receive packets.
-
- Once the memory requirements of the UNDI are obtained by using the GetInitInfo command, a block
- of non-swappable memory may need to be allocated. The address of this memory must be passed to
- UNDI during the Initialize in the CPB. This memory is used primarily for transmit and receive buffers.
-
- The fields CableDetect, LinkSpeed, Duplex, LoopBack, MemoryPtr, and MemoryLength are set with information
- that was passed in the CPB and the NIC is initialized.
-
- If the NIC initialization fails, the CdbPtr->StatFlags are updated with PXE_STATFLAGS_COMMAND_FAILED
- Otherwise, AdapterInfo->State is updated with PXE_STATFLAGS_GET_STATE_INITIALIZED showing the state of
- the UNDI is now initialized.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- PXE_CPB_INITIALIZE *CpbPtr;
-
- if ((CdbPtr->OpFlags != PXE_OPFLAGS_INITIALIZE_DETECT_CABLE) &&
- (CdbPtr->OpFlags != PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE)) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- //
- // check if it is already initialized
- //
- if (AdapterInfo->State == PXE_STATFLAGS_GET_STATE_INITIALIZED) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_ALREADY_INITIALIZED;
- return ;
- }
-
- CpbPtr = (PXE_CPB_INITIALIZE *) (UINTN) CdbPtr->CPBaddr;
-
- if (CpbPtr->MemoryLength < (UINT32) MEMORY_NEEDED) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CPB;
- return ;
- }
-
- //
- // default behaviour is to detect the cable, if the 3rd param is 1,
- // do not do that
- //
- AdapterInfo->CableDetect = (UINT8) ((CdbPtr->OpFlags == (UINT16) PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE) ? (UINT8) 0 : (UINT8) 1);
- AdapterInfo->LinkSpeedReq = (UINT16) CpbPtr->LinkSpeed;
- AdapterInfo->DuplexReq = CpbPtr->DuplexMode;
- AdapterInfo->LoopBack = CpbPtr->LoopBackMode;
- AdapterInfo->MemoryPtr = CpbPtr->MemoryAddr;
- AdapterInfo->MemoryLength = CpbPtr->MemoryLength;
-
- CdbPtr->StatCode = (PXE_STATCODE) E100bInit (AdapterInfo);
-
- if (CdbPtr->StatCode != PXE_STATCODE_SUCCESS) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- } else {
- AdapterInfo->State = PXE_STATFLAGS_GET_STATE_INITIALIZED;
- }
-
- return ;
-}
-
-VOID
-UNDI_Reset (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine resets the network adapter and initializes the UNDI using the parameters supplied in
- the CPB. The transmit and receive queues are emptied and any pending interrupts are cleared.
-
- If the NIC reset fails, the CdbPtr->StatFlags are updated with PXE_STATFLAGS_COMMAND_FAILED
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- if (CdbPtr->OpFlags != PXE_OPFLAGS_NOT_USED &&
- CdbPtr->OpFlags != PXE_OPFLAGS_RESET_DISABLE_INTERRUPTS &&
- CdbPtr->OpFlags != PXE_OPFLAGS_RESET_DISABLE_FILTERS ) {
-
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- CdbPtr->StatCode = (UINT16) E100bReset (AdapterInfo, CdbPtr->OpFlags);
-
- if (CdbPtr->StatCode != PXE_STATCODE_SUCCESS) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- }
-}
-
-VOID
-UNDI_Shutdown (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine resets the network adapter and leaves it in a safe state for another driver to
- initialize. Any pending transmits or receives are lost. Receive filters and external
- interrupt enables are disabled. Once the UNDI has been shutdown, it can then be stopped
- or initialized again.
-
- If the NIC reset fails, the CdbPtr->StatFlags are updated with PXE_STATFLAGS_COMMAND_FAILED
-
- Otherwise, AdapterInfo->State is updated with PXE_STATFLAGS_GET_STATE_STARTED showing the state of
- the NIC as being started.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- //
- // do the shutdown stuff here
- //
- CdbPtr->StatCode = (UINT16) E100bShutdown (AdapterInfo);
-
- if (CdbPtr->StatCode != PXE_STATCODE_SUCCESS) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- } else {
- AdapterInfo->State = PXE_STATFLAGS_GET_STATE_STARTED;
- }
-
- return ;
-}
-
-VOID
-UNDI_Interrupt (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine can be used to read and/or change the current external interrupt enable
- settings. Disabling an external interrupt enable prevents and external (hardware)
- interrupt from being signaled by the network device. Internally the interrupt events
- can still be polled by using the UNDI_GetState command.
-
- The resulting information on the interrupt state will be passed back in the CdbPtr->StatFlags.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- UINT8 IntMask;
-
- IntMask = (UINT8)(UINTN)(CdbPtr->OpFlags & (PXE_OPFLAGS_INTERRUPT_RECEIVE |
- PXE_OPFLAGS_INTERRUPT_TRANSMIT |
- PXE_OPFLAGS_INTERRUPT_COMMAND |
- PXE_OPFLAGS_INTERRUPT_SOFTWARE));
-
- switch (CdbPtr->OpFlags & PXE_OPFLAGS_INTERRUPT_OPMASK) {
- case PXE_OPFLAGS_INTERRUPT_READ:
- break;
-
- case PXE_OPFLAGS_INTERRUPT_ENABLE:
- if (IntMask == 0) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- AdapterInfo->int_mask = IntMask;
- E100bSetInterruptState (AdapterInfo);
- break;
-
- case PXE_OPFLAGS_INTERRUPT_DISABLE:
- if (IntMask != 0) {
- AdapterInfo->int_mask = (UINT16) (AdapterInfo->int_mask & ~(IntMask));
- E100bSetInterruptState (AdapterInfo);
- break;
- }
-
- //
- // else fall thru.
- //
- default:
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- if ((AdapterInfo->int_mask & PXE_OPFLAGS_INTERRUPT_RECEIVE) != 0) {
- CdbPtr->StatFlags |= PXE_STATFLAGS_INTERRUPT_RECEIVE;
-
- }
-
- if ((AdapterInfo->int_mask & PXE_OPFLAGS_INTERRUPT_TRANSMIT) != 0) {
- CdbPtr->StatFlags |= PXE_STATFLAGS_INTERRUPT_TRANSMIT;
-
- }
-
- if ((AdapterInfo->int_mask & PXE_OPFLAGS_INTERRUPT_COMMAND) != 0) {
- CdbPtr->StatFlags |= PXE_STATFLAGS_INTERRUPT_COMMAND;
-
- }
-
- return ;
-}
-
-VOID
-UNDI_RecFilter (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to read and change receive filters and, if supported, read
- and change multicast MAC address filter list.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- UINT16 NewFilter;
- UINT16 OpFlags;
- PXE_DB_RECEIVE_FILTERS *DbPtr;
- UINT8 *MacAddr;
- UINTN MacCount;
- UINT16 Index;
- UINT16 copy_len;
- UINT8 *ptr1;
- UINT8 *ptr2;
- OpFlags = CdbPtr->OpFlags;
- NewFilter = (UINT16) (OpFlags & 0x1F);
-
- switch (OpFlags & PXE_OPFLAGS_RECEIVE_FILTER_OPMASK) {
- case PXE_OPFLAGS_RECEIVE_FILTER_READ:
-
- //
- // not expecting a cpb, not expecting any filter bits
- //
- if ((NewFilter != 0) || (CdbPtr->CPBsize != 0)) {
- goto BadCdb;
-
- }
-
- if ((NewFilter & PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST) == 0) {
- goto JustRead;
-
- }
-
- NewFilter = (UINT16) (NewFilter | AdapterInfo->Rx_Filter);
- //
- // all other flags are ignored except mcast_reset
- //
- break;
-
- case PXE_OPFLAGS_RECEIVE_FILTER_ENABLE:
- //
- // there should be atleast one other filter bit set.
- //
- if (NewFilter == 0) {
- //
- // nothing to enable
- //
- goto BadCdb;
- }
-
- if (CdbPtr->CPBsize != 0) {
- //
- // this must be a multicast address list!
- // don't accept the list unless selective_mcast is set
- // don't accept confusing mcast settings with this
- //
- if (((NewFilter & PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST) == 0) ||
- ((NewFilter & PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST) != 0) ||
- ((NewFilter & PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST) != 0) ||
- ((CdbPtr->CPBsize % sizeof (PXE_MAC_ADDR)) != 0) ) {
- goto BadCdb;
- }
-
- MacAddr = (UINT8 *) ((UINTN) (CdbPtr->CPBaddr));
- MacCount = CdbPtr->CPBsize / sizeof (PXE_MAC_ADDR);
-
- for (; MacCount-- != 0; MacAddr += sizeof (PXE_MAC_ADDR)) {
- if (MacAddr[0] != 0x01 || MacAddr[1] != 0x00 || MacAddr[2] != 0x5E || (MacAddr[3] & 0x80) != 0) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CPB;
- return ;
- }
- }
- }
-
- //
- // check selective mcast case enable case
- //
- if ((OpFlags & PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST) != 0) {
- if (((OpFlags & PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST) != 0) ||
- ((OpFlags & PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST) != 0) ) {
- goto BadCdb;
-
- }
- //
- // if no cpb, make sure we have an old list
- //
- if ((CdbPtr->CPBsize == 0) && (AdapterInfo->mcast_list.list_len == 0)) {
- goto BadCdb;
- }
- }
- //
- // if you want to enable anything, you got to have unicast
- // and you have what you already enabled!
- //
- NewFilter = (UINT16) (NewFilter | (PXE_OPFLAGS_RECEIVE_FILTER_UNICAST | AdapterInfo->Rx_Filter));
-
- break;
-
- case PXE_OPFLAGS_RECEIVE_FILTER_DISABLE:
-
- //
- // mcast list not expected, i.e. no cpb here!
- //
- if (CdbPtr->CPBsize != PXE_CPBSIZE_NOT_USED) {
- goto BadCdb;
- }
-
- NewFilter = (UINT16) ((~(CdbPtr->OpFlags & 0x1F)) & AdapterInfo->Rx_Filter);
-
- break;
-
- default:
- goto BadCdb;
- }
-
- if ((OpFlags & PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST) != 0) {
- AdapterInfo->mcast_list.list_len = 0;
- NewFilter &= (~PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST);
- }
-
- E100bSetfilter (AdapterInfo, NewFilter, CdbPtr->CPBaddr, CdbPtr->CPBsize);
-
-JustRead:
- //
- // give the current mcast list
- //
- if ((CdbPtr->DBsize != 0) && (AdapterInfo->mcast_list.list_len != 0)) {
- //
- // copy the mc list to db
- //
-
- DbPtr = (PXE_DB_RECEIVE_FILTERS *) (UINTN) CdbPtr->DBaddr;
- ptr1 = (UINT8 *) (&DbPtr->MCastList[0]);
-
- //
- // DbPtr->mc_count = AdapterInfo->mcast_list.list_len;
- //
- copy_len = (UINT16) (AdapterInfo->mcast_list.list_len * PXE_MAC_LENGTH);
-
- if (copy_len > CdbPtr->DBsize) {
- copy_len = CdbPtr->DBsize;
-
- }
-
- ptr2 = (UINT8 *) (&AdapterInfo->mcast_list.mc_list[0]);
- for (Index = 0; Index < copy_len; Index++) {
- ptr1[Index] = ptr2[Index];
- }
- }
- //
- // give the stat flags here
- //
- if (AdapterInfo->Receive_Started) {
- CdbPtr->StatFlags = (PXE_STATFLAGS) (CdbPtr->StatFlags | AdapterInfo->Rx_Filter);
-
- }
-
- return ;
-
-BadCdb:
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
-}
-
-VOID
-UNDI_StnAddr (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to get the current station and broadcast MAC addresses, and to change the
- current station MAC address.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- PXE_CPB_STATION_ADDRESS *CpbPtr;
- PXE_DB_STATION_ADDRESS *DbPtr;
- UINT16 Index;
-
- if (CdbPtr->OpFlags == PXE_OPFLAGS_STATION_ADDRESS_RESET) {
- //
- // configure the permanent address.
- // change the AdapterInfo->CurrentNodeAddress field.
- //
- if (CompareMem (
- &AdapterInfo->CurrentNodeAddress[0],
- &AdapterInfo->PermNodeAddress[0],
- PXE_MAC_LENGTH
- ) != 0) {
- for (Index = 0; Index < PXE_MAC_LENGTH; Index++) {
- AdapterInfo->CurrentNodeAddress[Index] = AdapterInfo->PermNodeAddress[Index];
- }
-
- E100bSetupIAAddr (AdapterInfo);
- }
- }
-
- if (CdbPtr->CPBaddr != (UINT64) 0) {
- CpbPtr = (PXE_CPB_STATION_ADDRESS *) (UINTN) (CdbPtr->CPBaddr);
- //
- // configure the new address
- //
- for (Index = 0; Index < PXE_MAC_LENGTH; Index++) {
- AdapterInfo->CurrentNodeAddress[Index] = CpbPtr->StationAddr[Index];
- }
-
- E100bSetupIAAddr (AdapterInfo);
- }
-
- if (CdbPtr->DBaddr != (UINT64) 0) {
- DbPtr = (PXE_DB_STATION_ADDRESS *) (UINTN) (CdbPtr->DBaddr);
- //
- // fill it with the new values
- //
- for (Index = 0; Index < PXE_MAC_LENGTH; Index++) {
- DbPtr->StationAddr[Index] = AdapterInfo->CurrentNodeAddress[Index];
- DbPtr->BroadcastAddr[Index] = AdapterInfo->BroadcastNodeAddress[Index];
- DbPtr->PermanentAddr[Index] = AdapterInfo->PermNodeAddress[Index];
- }
- }
-
- return ;
-}
-
-VOID
-UNDI_Statistics (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to read and clear the NIC traffic statistics. This command is supported only
- if the !PXE structure's Implementation flags say so.
-
- Results will be parsed out in the following manner:
- CdbPtr->DBaddr.Data[0] R Total Frames (Including frames with errors and dropped frames)
- CdbPtr->DBaddr.Data[1] R Good Frames (All frames copied into receive buffer)
- CdbPtr->DBaddr.Data[2] R Undersize Frames (Frames below minimum length for media <64 for ethernet)
- CdbPtr->DBaddr.Data[4] R Dropped Frames (Frames that were dropped because receive buffers were full)
- CdbPtr->DBaddr.Data[8] R CRC Error Frames (Frames with alignment or CRC errors)
- CdbPtr->DBaddr.Data[A] T Total Frames (Including frames with errors and dropped frames)
- CdbPtr->DBaddr.Data[B] T Good Frames (All frames copied into transmit buffer)
- CdbPtr->DBaddr.Data[C] T Undersize Frames (Frames below minimum length for media <64 for ethernet)
- CdbPtr->DBaddr.Data[E] T Dropped Frames (Frames that were dropped because of collisions)
- CdbPtr->DBaddr.Data[14] T Total Collision Frames (Total collisions on this subnet)
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- if ((CdbPtr->OpFlags &~(PXE_OPFLAGS_STATISTICS_RESET)) != 0) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- if ((CdbPtr->OpFlags & PXE_OPFLAGS_STATISTICS_RESET) != 0) {
- //
- // Reset the statistics
- //
- CdbPtr->StatCode = (UINT16) E100bStatistics (AdapterInfo, 0, 0);
- } else {
- CdbPtr->StatCode = (UINT16) E100bStatistics (AdapterInfo, CdbPtr->DBaddr, CdbPtr->DBsize);
- }
-
- return ;
-}
-
-VOID
-UNDI_ip2mac (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to translate a multicast IP address to a multicast MAC address.
-
- This results in a MAC address composed of 25 bits of fixed data with the upper 23 bits of the IP
- address being appended to it. Results passed back in the equivalent of CdbPtr->DBaddr->MAC[0-5].
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- PXE_CPB_MCAST_IP_TO_MAC *CpbPtr;
- PXE_DB_MCAST_IP_TO_MAC *DbPtr;
- UINT8 *TmpPtr;
-
- CpbPtr = (PXE_CPB_MCAST_IP_TO_MAC *) (UINTN) CdbPtr->CPBaddr;
- DbPtr = (PXE_DB_MCAST_IP_TO_MAC *) (UINTN) CdbPtr->DBaddr;
-
- if ((CdbPtr->OpFlags & PXE_OPFLAGS_MCAST_IPV6_TO_MAC) != 0) {
- //
- // for now this is not supported
- //
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_UNSUPPORTED;
- return ;
- }
-
- TmpPtr = (UINT8 *) (&CpbPtr->IP.IPv4);
- //
- // check if the ip given is a mcast IP
- //
- if ((TmpPtr[0] & 0xF0) != 0xE0) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CPB;
- }
- //
- // take the last 23 bits in IP.
- // be very careful. accessing word on a non-word boundary will hang motherboard codenamed Big Sur
- // casting the mac array (in the middle) to a UINT32 pointer and accessing
- // the UINT32 content hung the system...
- //
- DbPtr->MAC[0] = 0x01;
- DbPtr->MAC[1] = 0x00;
- DbPtr->MAC[2] = 0x5e;
- DbPtr->MAC[3] = (UINT8) (TmpPtr[1] & 0x7f);
- DbPtr->MAC[4] = (UINT8) TmpPtr[2];
- DbPtr->MAC[5] = (UINT8) TmpPtr[3];
-
- return ;
-}
-
-VOID
-UNDI_NVData (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to read and write non-volatile storage on the NIC (if supported). The NVRAM
- could be EEPROM, FLASH, or battery backed RAM.
-
- This is an optional function according to the UNDI specification (or will be......)
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- PXE_DB_NVDATA *DbPtr;
- UINT16 Index;
-
- if ((CdbPtr->OpFlags == PXE_OPFLAGS_NVDATA_READ) != 0) {
-
- if ((CdbPtr->DBsize == PXE_DBSIZE_NOT_USED) != 0) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- DbPtr = (PXE_DB_NVDATA *) (UINTN) CdbPtr->DBaddr;
-
- for (Index = 0; Index < MAX_PCI_CONFIG_LEN; Index++) {
- DbPtr->Data.Dword[Index] = AdapterInfo->NVData[Index];
-
- }
-
- } else {
- //
- // no write for now
- //
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_UNSUPPORTED;
- }
-
- return ;
-}
-
-VOID
-UNDI_Status (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine returns the current interrupt status and/or the transmitted buffer addresses.
- If the current interrupt status is returned, pending interrupts will be acknowledged by this
- command. Transmitted buffer addresses that are written to the DB are removed from the transmit
- buffer queue.
-
- Normally, this command would be polled with interrupts disabled.
-
- The transmit buffers are returned in CdbPtr->DBaddr->TxBufer[0 - NumEntries].
- The interrupt status is returned in CdbPtr->StatFlags.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- PXE_DB_GET_STATUS *DbPtr;
- PXE_DB_GET_STATUS TmpGetStatus;
- UINT16 Index;
- UINT16 Status;
- UINT16 NumEntries;
- RxFD *RxPtr;
-
- //
- // Fill in temporary GetStatus storage.
- //
- RxPtr = &AdapterInfo->rx_ring[AdapterInfo->cur_rx_ind];
-
- if ((RxPtr->cb_header.status & RX_COMPLETE) != 0) {
- TmpGetStatus.RxFrameLen = RxPtr->ActualCount & 0x3fff;
- } else {
- TmpGetStatus.RxFrameLen = 0;
- }
-
- TmpGetStatus.reserved = 0;
-
- //
- // Fill in size of next available receive packet and
- // reserved field in caller's DB storage.
- //
- DbPtr = (PXE_DB_GET_STATUS *) (UINTN) CdbPtr->DBaddr;
-
- if (CdbPtr->DBsize > 0 && CdbPtr->DBsize < sizeof (UINT32) * 2) {
- CopyMem (DbPtr, &TmpGetStatus, CdbPtr->DBsize);
- } else {
- CopyMem (DbPtr, &TmpGetStatus, sizeof (UINT32) * 2);
- }
-
- //
- //
- //
- if ((CdbPtr->OpFlags & PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS) != 0) {
- //
- // DBsize of zero is invalid if Tx buffers are requested.
- //
- if (CdbPtr->DBsize == 0) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- //
- // remember this b4 we overwrite
- //
- NumEntries = (UINT16) (CdbPtr->DBsize - sizeof (UINT64));
-
- //
- // We already filled in 2 UINT32s.
- //
- CdbPtr->DBsize = sizeof (UINT32) * 2;
-
- //
- // will claim any hanging free CBs
- //
- CheckCBList (AdapterInfo);
-
- if (AdapterInfo->xmit_done_head == AdapterInfo->xmit_done_tail) {
- CdbPtr->StatFlags |= PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY;
- } else {
- for (Index = 0; NumEntries >= sizeof (UINT64); Index++, NumEntries -= sizeof (UINT64)) {
- if (AdapterInfo->xmit_done_head != AdapterInfo->xmit_done_tail) {
- DbPtr->TxBuffer[Index] = AdapterInfo->xmit_done[AdapterInfo->xmit_done_head];
- AdapterInfo->xmit_done_head = next (AdapterInfo->xmit_done_head);
- CdbPtr->DBsize += sizeof (UINT64);
- } else {
- break;
- }
- }
- }
-
- if (AdapterInfo->xmit_done_head != AdapterInfo->xmit_done_tail) {
- CdbPtr->StatFlags |= PXE_STATFLAGS_DB_WRITE_TRUNCATED;
-
- }
- //
- // check for a receive buffer and give it's size in db
- //
- }
- //
- //
- //
- if ((CdbPtr->OpFlags & PXE_OPFLAGS_GET_INTERRUPT_STATUS) != 0) {
-
- Status = InWord (AdapterInfo, AdapterInfo->ioaddr + SCBStatus);
- AdapterInfo->Int_Status = (UINT16) (AdapterInfo->Int_Status | Status);
-
- //
- // acknoledge the interrupts
- //
- OutWord (AdapterInfo, (UINT16) (Status & 0xfc00), (UINT32) (AdapterInfo->ioaddr + SCBStatus));
-
- //
- // report all the outstanding interrupts
- //
- Status = AdapterInfo->Int_Status;
- if ((Status & SCB_STATUS_FR) != 0) {
- CdbPtr->StatFlags |= PXE_STATFLAGS_GET_STATUS_RECEIVE;
- }
-
- if ((Status & SCB_STATUS_SWI) != 0) {
- CdbPtr->StatFlags |= PXE_STATFLAGS_GET_STATUS_SOFTWARE;
- }
- }
-
- return ;
-}
-
-VOID
-UNDI_FillHeader (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to fill media header(s) in transmit packet(s).
- Copies the MAC address into the media header whether it is dealing
- with fragmented or non-fragmented packets.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- PXE_CPB_FILL_HEADER *Cpb;
- PXE_CPB_FILL_HEADER_FRAGMENTED *Cpbf;
- EtherHeader *MacHeader;
- UINTN Index;
-
- if (CdbPtr->CPBsize == PXE_CPBSIZE_NOT_USED) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- if ((CdbPtr->OpFlags & PXE_OPFLAGS_FILL_HEADER_FRAGMENTED) != 0) {
- Cpbf = (PXE_CPB_FILL_HEADER_FRAGMENTED *) (UINTN) CdbPtr->CPBaddr;
-
- //
- // assume 1st fragment is big enough for the mac header
- //
- if ((Cpbf->FragCnt == 0) || (Cpbf->FragDesc[0].FragLen < PXE_MAC_HEADER_LEN_ETHER)) {
- //
- // no buffers given
- //
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- MacHeader = (EtherHeader *) (UINTN) Cpbf->FragDesc[0].FragAddr;
- //
- // we don't swap the protocol bytes
- //
- MacHeader->type = Cpbf->Protocol;
-
- for (Index = 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {
- MacHeader->dest_addr[Index] = Cpbf->DestAddr[Index];
- MacHeader->src_addr[Index] = Cpbf->SrcAddr[Index];
- }
- } else {
- Cpb = (PXE_CPB_FILL_HEADER *) (UINTN) CdbPtr->CPBaddr;
-
- MacHeader = (EtherHeader *) (UINTN) Cpb->MediaHeader;
- //
- // we don't swap the protocol bytes
- //
- MacHeader->type = Cpb->Protocol;
-
- for (Index = 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {
- MacHeader->dest_addr[Index] = Cpb->DestAddr[Index];
- MacHeader->src_addr[Index] = Cpb->SrcAddr[Index];
- }
- }
-
- return ;
-}
-
-VOID
-UNDI_Transmit (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine is used to place a packet into the transmit queue. The data buffers given to
- this command are to be considered locked and the application or network driver loses
- ownership of these buffers and must not free or relocate them until the ownership returns.
-
- When the packets are transmitted, a transmit complete interrupt is generated (if interrupts
- are disabled, the transmit interrupt status is still set and can be checked using the UNDI_Status
- command.
-
- Some implementations and adapters support transmitting multiple packets with one transmit
- command. If this feature is supported, the transmit CPBs can be linked in one transmit
- command.
-
- All UNDIs support fragmented frames, now all network devices or protocols do. If a fragmented
- frame CPB is given to UNDI and the network device does not support fragmented frames
- (see !PXE.Implementation flag), the UNDI will have to copy the fragments into a local buffer
- before transmitting.
-
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
-
- if (CdbPtr->CPBsize == PXE_CPBSIZE_NOT_USED) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- CdbPtr->StatCode = (PXE_STATCODE) E100bTransmit (AdapterInfo, CdbPtr->CPBaddr, CdbPtr->OpFlags);
-
- if (CdbPtr->StatCode != PXE_STATCODE_SUCCESS) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- }
-
- return ;
-}
-
-VOID
-UNDI_Receive (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- When the network adapter has received a frame, this command is used to copy the frame
- into the driver/application storage location. Once a frame has been copied, it is
- removed from the receive queue.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
-
- //
- // check if RU has started...
- //
- if (!AdapterInfo->Receive_Started) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_NOT_INITIALIZED;
- return ;
- }
-
-
- CdbPtr->StatCode = (UINT16) E100bReceive (AdapterInfo, CdbPtr->CPBaddr, CdbPtr->DBaddr);
- if (CdbPtr->StatCode != PXE_STATCODE_SUCCESS) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
-
- }
-
- return ;
-}
-
-VOID
-UNDI_APIEntry_old (
- IN UINT64 cdb
- )
-/*++
-
-Routine Description:
- This is the main SW UNDI API entry using the older nii protocol.
- The parameter passed in is a 64 bit flat model virtual
- address of the cdb. We then jump into the common routine for both old and
- new nii protocol entries.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-// TODO: cdb - add argument and description to function comment
-{
- PXE_CDB *CdbPtr;
- NIC_DATA_INSTANCE *AdapterInfo;
-
- if (cdb == (UINT64) 0) {
- return ;
-
- }
-
- CdbPtr = (PXE_CDB *) (UINTN) cdb;
-
- if (CdbPtr->IFnum >= pxe->IFcnt) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- AdapterInfo = &(UNDI32DeviceList[CdbPtr->IFnum]->NicInfo);
-
- //
- // entering from older entry point
- //
- AdapterInfo->VersionFlag = 0x30;
- UNDI_APIEntry_Common (cdb);
-}
-
-VOID
-UNDI_APIEntry_new (
- IN UINT64 cdb
- )
-/*++
-
-Routine Description:
- This is the main SW UNDI API entry using the newer nii protocol.
- The parameter passed in is a 64 bit flat model virtual
- address of the cdb. We then jump into the common routine for both old and
- new nii protocol entries.
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-// TODO: cdb - add argument and description to function comment
-{
- PXE_CDB *CdbPtr;
- NIC_DATA_INSTANCE *AdapterInfo;
-
- if (cdb == (UINT64) 0) {
- return ;
-
- }
-
- CdbPtr = (PXE_CDB *) (UINTN) cdb;
-
- if (CdbPtr->IFnum >= pxe_31->IFcnt) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
- }
-
- AdapterInfo = &(UNDI32DeviceList[CdbPtr->IFnum]->NicInfo);
- //
- // entering from older entry point
- //
- AdapterInfo->VersionFlag = 0x31;
- UNDI_APIEntry_Common (cdb);
-}
-
-VOID
-UNDI_APIEntry_Common (
- IN UINT64 cdb
- )
-/*++
-
-Routine Description:
- This is the common routine for both old and new entry point procedures.
- The parameter passed in is a 64 bit flat model virtual
- address of the cdb. We then jump into the service routine pointed to by the
- Api_Table[OpCode].
-
-Arguments:
- CdbPtr - Pointer to the command descriptor block.
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-// TODO: cdb - add argument and description to function comment
-{
- PXE_CDB *CdbPtr;
- NIC_DATA_INSTANCE *AdapterInfo;
- UNDI_CALL_TABLE *tab_ptr;
-
- CdbPtr = (PXE_CDB *) (UINTN) cdb;
-
- //
- // check the OPCODE range
- //
- if ((CdbPtr->OpCode > PXE_OPCODE_LAST_VALID) ||
- (CdbPtr->StatCode != PXE_STATCODE_INITIALIZE) ||
- (CdbPtr->StatFlags != PXE_STATFLAGS_INITIALIZE) ||
- (CdbPtr->IFnum >= pxe_31->IFcnt) ) {
- goto badcdb;
-
- }
-
- if (CdbPtr->CPBsize == PXE_CPBSIZE_NOT_USED) {
- if (CdbPtr->CPBaddr != PXE_CPBADDR_NOT_USED) {
- goto badcdb;
- }
- } else if (CdbPtr->CPBaddr == PXE_CPBADDR_NOT_USED) {
- goto badcdb;
- }
-
- if (CdbPtr->DBsize == PXE_DBSIZE_NOT_USED) {
- if (CdbPtr->DBaddr != PXE_DBADDR_NOT_USED) {
- goto badcdb;
- }
- } else if (CdbPtr->DBaddr == PXE_DBADDR_NOT_USED) {
- goto badcdb;
- }
-
- //
- // check if cpbsize and dbsize are as needed
- // check if opflags are as expected
- //
- tab_ptr = &api_table[CdbPtr->OpCode];
-
- if (tab_ptr->cpbsize != (UINT16) (DONT_CHECK) && tab_ptr->cpbsize != CdbPtr->CPBsize) {
- goto badcdb;
- }
-
- if (tab_ptr->dbsize != (UINT16) (DONT_CHECK) && tab_ptr->dbsize != CdbPtr->DBsize) {
- goto badcdb;
- }
-
- if (tab_ptr->opflags != (UINT16) (DONT_CHECK) && tab_ptr->opflags != CdbPtr->OpFlags) {
- goto badcdb;
-
- }
-
- AdapterInfo = &(UNDI32DeviceList[CdbPtr->IFnum]->NicInfo);
-
- //
- // check if UNDI_State is valid for this call
- //
- if (tab_ptr->state != (UINT16) (-1)) {
- //
- // should atleast be started
- //
- if (AdapterInfo->State == PXE_STATFLAGS_GET_STATE_STOPPED) {
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_NOT_STARTED;
- return ;
- }
- //
- // check if it should be initialized
- //
- if (tab_ptr->state == 2) {
- if (AdapterInfo->State != PXE_STATFLAGS_GET_STATE_INITIALIZED) {
- CdbPtr->StatCode = PXE_STATCODE_NOT_INITIALIZED;
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- return ;
- }
- }
- }
- //
- // set the return variable for success case here
- //
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_COMPLETE;
- CdbPtr->StatCode = PXE_STATCODE_SUCCESS;
-
- tab_ptr->api_ptr (CdbPtr, AdapterInfo);
- return ;
- //
- // %% AVL - check for command linking
- //
-badcdb:
- CdbPtr->StatFlags = PXE_STATFLAGS_COMMAND_FAILED;
- CdbPtr->StatCode = PXE_STATCODE_INVALID_CDB;
- return ;
-}
-
-STATIC
-UINT8
-ChkSum (
- IN VOID *Buffer,
- IN UINT16 Len
- )
-/*++
-
-Routine Description:
- This does an 8 bit check sum of the passed in buffer for Len bytes.
- This is primarily used to update the check sum in the SW UNDI header.
-
-Arguments:
- Buffer - Pointer to the passed in buffer to check sum
- Len - Length of buffer to be check summed in bytes.
-
-Returns:
- None
-
---*/
-{
- UINT8 Chksum;
- INT8 *Bp;
-
- Chksum = 0;
- if ((Bp = Buffer) != NULL) {
- while (Len--) {
- Chksum = (UINT8) (Chksum +*Bp++);
-
- }
-
- }
-
- return Chksum;
-}
-
-VOID
-PxeUpdate (
- IN NIC_DATA_INSTANCE *NicPtr,
- IN PXE_SW_UNDI *PxePtr
- )
-/*++
-
-Routine Description:
- When called with a null NicPtr, this routine decrements the number of NICs
- this UNDI is supporting and removes the NIC_DATA_POINTER from the array.
- Otherwise, it increments the number of NICs this UNDI is supported and
- updates the pxe.Fudge to ensure a proper check sum results.
-
-Arguments:
- NicPtr - Pointer to the NIC data structure.
-
-Returns:
- None
-
---*/
-// TODO: PxePtr - add argument and description to function comment
-{
- if (NicPtr == NULL) {
- if (PxePtr->IFcnt > 0) {
- //
- // number of NICs this undi supports
- //
- PxePtr->IFcnt--;
- }
-
- PxePtr->Fudge = (UINT8) (PxePtr->Fudge - ChkSum ((VOID *) PxePtr, PxePtr->Len));
- return ;
- }
-
- //
- // number of NICs this undi supports
- //
- PxePtr->IFcnt++;
- PxePtr->Fudge = (UINT8) (PxePtr->Fudge - ChkSum ((VOID *) PxePtr, PxePtr->Len));
-
- return ;
-}
-
-VOID
-PxeStructInit (
- IN PXE_SW_UNDI *PxePtr,
- IN UINTN VersionFlag
- )
-/*++
-
-Routine Description:
- Initialize the !PXE structure
-
-Arguments:
- RemainingDevicePath - Not used, always produce all possible children.
-
-Returns:
- EFI_SUCCESS - This driver is added to Controller.
- other - This driver does not support this device.
-
---*/
-// TODO: PxePtr - add argument and description to function comment
-// TODO: VersionFlag - add argument and description to function comment
-{
- //
- // Initialize the !PXE structure
- //
- PxePtr->Signature = PXE_ROMID_SIGNATURE;
- PxePtr->Len = sizeof (PXE_SW_UNDI);
- //
- // cksum
- //
- PxePtr->Fudge = 0;
- //
- // number of NICs this undi supports
- //
- PxePtr->IFcnt = 0;
- PxePtr->Rev = PXE_ROMID_REV;
- PxePtr->MajorVer = PXE_ROMID_MAJORVER;
- PxePtr->MinorVer = PXE_ROMID_MINORVER;
- PxePtr->reserved1 = 0;
-
- PxePtr->Implementation = PXE_ROMID_IMP_SW_VIRT_ADDR |
- PXE_ROMID_IMP_FRAG_SUPPORTED |
- PXE_ROMID_IMP_CMD_LINK_SUPPORTED |
- PXE_ROMID_IMP_NVDATA_READ_ONLY |
- PXE_ROMID_IMP_STATION_ADDR_SETTABLE |
- PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED |
- PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED |
- PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED |
- PXE_ROMID_IMP_FILTERED_MULTICAST_RX_SUPPORTED |
- PXE_ROMID_IMP_SOFTWARE_INT_SUPPORTED |
- PXE_ROMID_IMP_PACKET_RX_INT_SUPPORTED;
-
- if (VersionFlag == 0x30) {
- PxePtr->EntryPoint = (UINT64) UNDI_APIEntry_old;
- } else {
- PxePtr->EntryPoint = (UINT64) UNDI_APIEntry_new;
- PxePtr->MinorVer = PXE_ROMID_MINORVER_31;
- }
-
- PxePtr->reserved2[0] = 0;
- PxePtr->reserved2[1] = 0;
- PxePtr->reserved2[2] = 0;
- PxePtr->BusCnt = 1;
- PxePtr->BusType[0] = PXE_BUSTYPE_PCI;
-
- PxePtr->Fudge = (UINT8) (PxePtr->Fudge - ChkSum ((VOID *) PxePtr, PxePtr->Len));
-}
-
diff --git a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.c b/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.c
deleted file mode 100644
index d425778..0000000
--- a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.c
+++ /dev/null
@@ -1,3756 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
-
- E100B.C
-
-Abstract:
-
-
-Revision History
-
---*/
-
-#include "Undi32.h"
-
-static UINT8 basic_config_cmd[22] = {
- 22, 0x08,
- 0, 0,
- 0, (UINT8)0x80,
- 0x32, 0x03,
- 1, 0,
- 0x2E, 0,
- 0x60, 0,
- (UINT8)0xf2, 0x48,
- 0, 0x40,
- (UINT8)0xf2, (UINT8)0x80, // 0x40=Force full-duplex
- 0x3f, 0x05,
-};
-
-//
-// How to wait for the command unit to accept a command.
-// Typically this takes 0 ticks.
-//
-#define wait_for_cmd_done(cmd_ioaddr) \
-{ \
- INT16 wait_count = 2000; \
- while ((InByte (AdapterInfo, cmd_ioaddr) != 0) && --wait_count >= 0) \
- DelayIt (AdapterInfo, 10); \
- if (wait_count == 0) \
- DelayIt (AdapterInfo, 50); \
-}
-
-UINT8
-InByte (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT32 Port
- )
-/*++
-
-Routine Description:
- This function calls the MemIo callback to read a byte from the device's
- address space
- Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
- to make undi3.0 a special case
-
-Arguments:
- Port - Which port to read from.
-
-Returns:
- Results - The data read from the port.
-
---*/
-// TODO: AdapterInfo - add argument and description to function comment
-{
- UINT8 Results;
-
- (*AdapterInfo->Mem_Io) (
- AdapterInfo->Unique_ID,
- PXE_MEM_READ,
- 1,
- (UINT64)Port,
- (UINT64) (UINTN) &Results
- );
- return Results;
-}
-
-UINT16
-InWord (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT32 Port
- )
-/*++
-
-Routine Description:
- This function calls the MemIo callback to read a word from the device's
- address space
- Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
- to make undi3.0 a special case
-
-Arguments:
- Port - Which port to read from.
-
-Returns:
- Results - The data read from the port.
-
---*/
-// TODO: AdapterInfo - add argument and description to function comment
-{
- UINT16 Results;
-
- (*AdapterInfo->Mem_Io) (
- AdapterInfo->Unique_ID,
- PXE_MEM_READ,
- 2,
- (UINT64)Port,
- (UINT64)(UINTN)&Results
- );
- return Results;
-}
-
-UINT32
-InLong (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT32 Port
- )
-/*++
-
-Routine Description:
- This function calls the MemIo callback to read a dword from the device's
- address space
- Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
- to make undi3.0 a special case
-
-Arguments:
- Port - Which port to read from.
-
-Returns:
- Results - The data read from the port.
-
---*/
-// TODO: AdapterInfo - add argument and description to function comment
-{
- UINT32 Results;
-
- (*AdapterInfo->Mem_Io) (
- AdapterInfo->Unique_ID,
- PXE_MEM_READ,
- 4,
- (UINT64)Port,
- (UINT64)(UINTN)&Results
- );
- return Results;
-}
-
-VOID
-OutByte (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT8 Data,
- IN UINT32 Port
- )
-/*++
-
-Routine Description:
- This function calls the MemIo callback to write a byte from the device's
- address space
- Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
- to make undi3.0 a special case
-
-Arguments:
- Data - Data to write to Port.
- Port - Which port to write to.
-
-Returns:
- none
-
---*/
-// TODO: AdapterInfo - add argument and description to function comment
-{
- UINT8 Val;
-
- Val = Data;
- (*AdapterInfo->Mem_Io) (
- AdapterInfo->Unique_ID,
- PXE_MEM_WRITE,
- 1,
- (UINT64)Port,
- (UINT64)(UINTN)(UINTN)&Val
- );
- return ;
-}
-
-VOID
-OutWord (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT16 Data,
- IN UINT32 Port
- )
-/*++
-
-Routine Description:
- This function calls the MemIo callback to write a word from the device's
- address space
- Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
- to make undi3.0 a special case
-
-Arguments:
- Data - Data to write to Port.
- Port - Which port to write to.
-
-Returns:
- none
-
---*/
-// TODO: AdapterInfo - add argument and description to function comment
-{
- UINT16 Val;
-
- Val = Data;
- (*AdapterInfo->Mem_Io) (
- AdapterInfo->Unique_ID,
- PXE_MEM_WRITE,
- 2,
- (UINT64)Port,
- (UINT64)(UINTN)&Val
- );
- return ;
-}
-
-VOID
-OutLong (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT32 Data,
- IN UINT32 Port
- )
-/*++
-
-Routine Description:
- This function calls the MemIo callback to write a dword from the device's
- address space
- Since UNDI3.0 uses the TmpMemIo function (instead of the callback routine)
- which also takes the UniqueId parameter (as in UNDI3.1 spec) we don't have
- to make undi3.0 a special case
-
-Arguments:
- Data - Data to write to Port.
- Port - Which port to write to.
-
-Returns:
- none
-
---*/
-// TODO: AdapterInfo - add argument and description to function comment
-{
- UINT32 Val;
-
- Val = Data;
- (*AdapterInfo->Mem_Io) (
- AdapterInfo->Unique_ID,
- PXE_MEM_WRITE,
- 4,
- (UINT64)Port,
- (UINT64)(UINTN)&Val
- );
- return ;
-}
-
-STATIC
-UINTN
-MapIt (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT64 MemAddr,
- IN UINT32 Size,
- IN UINT32 Direction,
- OUT UINT64 MappedAddr
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
- MemAddr - TODO: add argument description
- Size - TODO: add argument description
- Direction - TODO: add argument description
- MappedAddr - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UINT64 *PhyAddr;
-
- PhyAddr = (UINT64 *) (UINTN) MappedAddr;
- //
- // mapping is different for theold and new NII protocols
- //
- if (AdapterInfo->VersionFlag == 0x30) {
- if (AdapterInfo->Virt2Phys_30 == (VOID *) NULL) {
- *PhyAddr = (UINT64) AdapterInfo->MemoryPtr;
- } else {
- (*AdapterInfo->Virt2Phys_30) (MemAddr, (UINT64) (UINTN) PhyAddr);
- }
-
- if (*PhyAddr > FOUR_GIGABYTE) {
- return PXE_STATCODE_INVALID_PARAMETER;
- }
- } else {
- if (AdapterInfo->Map_Mem == (VOID *) NULL) {
- //
- // this UNDI cannot handle addresses beyond 4 GB without a map routine
- //
- if (MemAddr > FOUR_GIGABYTE) {
- return PXE_STATCODE_INVALID_PARAMETER;
- } else {
- *PhyAddr = MemAddr;
- }
- } else {
- (*AdapterInfo->Map_Mem) (
- AdapterInfo->Unique_ID,
- MemAddr,
- Size,
- Direction,
- MappedAddr
- );
- }
- }
-
- return PXE_STATCODE_SUCCESS;
-}
-
-STATIC
-VOID
-UnMapIt (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT64 MemAddr,
- IN UINT32 Size,
- IN UINT32 Direction,
- IN UINT64 MappedAddr
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
- MemAddr - TODO: add argument description
- Size - TODO: add argument description
- Direction - TODO: add argument description
- MappedAddr - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- if (AdapterInfo->VersionFlag > 0x30) {
- //
- // no mapping service
- //
- if (AdapterInfo->UnMap_Mem != (VOID *) NULL) {
- (*AdapterInfo->UnMap_Mem) (
- AdapterInfo->Unique_ID,
- MemAddr,
- Size,
- Direction,
- MappedAddr
- );
-
- }
- }
-
- return ;
-}
-
-STATIC
-VOID
-DelayIt (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- UINT16 MicroSeconds
- )
-/*++
-
-Routine Description:
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information
- which the UNDI driver is layering on..
-
-Returns:
-
---*/
-// TODO: MicroSeconds - add argument and description to function comment
-{
- if (AdapterInfo->VersionFlag == 0x30) {
- (*AdapterInfo->Delay_30) (MicroSeconds);
- } else {
- (*AdapterInfo->Delay) (AdapterInfo->Unique_ID, MicroSeconds);
- }
-}
-
-STATIC
-VOID
-BlockIt (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- UINT32 flag
- )
-/*++
-
-Routine Description:
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information
- which the UNDI driver is layering on..
-
-Returns:
-
---*/
-// TODO: flag - add argument and description to function comment
-{
- if (AdapterInfo->VersionFlag == 0x30) {
- (*AdapterInfo->Block_30) (flag);
- } else {
- (*AdapterInfo->Block) (AdapterInfo->Unique_ID, flag);
- }
-}
-
-STATIC
-UINT8
-Load_Base_Regs (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- //
- // we will use the linear (flat) memory model and fill our base registers
- // with 0's so that the entire physical address is our offset
- //
- //
- // we reset the statistics totals here because this is where we are loading stats addr
- //
- AdapterInfo->RxTotals = 0;
- AdapterInfo->TxTotals = 0;
-
- //
- // Load the statistics block address.
- //
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
- OutLong (AdapterInfo, (UINT32) AdapterInfo->stat_phy_addr, AdapterInfo->ioaddr + SCBPointer);
- OutByte (AdapterInfo, CU_STATSADDR, AdapterInfo->ioaddr + SCBCmd);
- AdapterInfo->statistics->done_marker = 0;
-
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
- OutLong (AdapterInfo, 0, AdapterInfo->ioaddr + SCBPointer);
- OutByte (AdapterInfo, RX_ADDR_LOAD, AdapterInfo->ioaddr + SCBCmd);
-
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
- OutLong (AdapterInfo, 0, AdapterInfo->ioaddr + SCBPointer);
- OutByte (AdapterInfo, CU_CMD_BASE, AdapterInfo->ioaddr + SCBCmd);
-
- return 0;
-}
-
-STATIC
-UINT8
-IssueCB (
- NIC_DATA_INSTANCE *AdapterInfo,
- TxCB *cmd_ptr
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
- cmd_ptr - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UINT16 status;
-
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
-
- //
- // read the CU status, if it is idle, write the address of cb_ptr
- // in the scbpointer and issue a cu_start,
- // if it is suspended, remove the suspend bit in the previous command
- // block and issue a resume
- //
- // Ensure that the CU Active Status bit is not on from previous CBs.
- //
- status = InWord (AdapterInfo, AdapterInfo->ioaddr + SCBStatus);
-
- //
- // Skip acknowledging the interrupt if it is not already set
- //
-
- //
- // ack only the cna the integer
- //
- if ((status & SCB_STATUS_CNA) != 0) {
- OutWord (AdapterInfo, SCB_STATUS_CNA, AdapterInfo->ioaddr + SCBStatus);
-
- }
-
- if ((status & SCB_STATUS_CU_MASK) == SCB_STATUS_CU_IDLE) {
- //
- // give a cu_start
- //
- OutLong (AdapterInfo, cmd_ptr->PhysTCBAddress, AdapterInfo->ioaddr + SCBPointer);
- OutByte (AdapterInfo, CU_START, AdapterInfo->ioaddr + SCBCmd);
- } else {
- //
- // either active or suspended, give a resume
- //
-
- cmd_ptr->PrevTCBVirtualLinkPtr->cb_header.command &= ~(CmdSuspend | CmdIntr);
- OutByte (AdapterInfo, CU_RESUME, AdapterInfo->ioaddr + SCBCmd);
- }
-
- return 0;
-}
-
-STATIC
-UINT8
-Configure (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- //
- // all command blocks are of TxCB format
- //
- TxCB *cmd_ptr;
- UINT8 *data_ptr;
- volatile INT16 Index;
- UINT8 my_filter;
-
- cmd_ptr = GetFreeCB (AdapterInfo);
- data_ptr = (UINT8 *) (&cmd_ptr->PhysTBDArrayAddres);
-
- //
- // start the config data right after the command header
- //
- for (Index = 0; Index < sizeof (basic_config_cmd); Index++) {
- data_ptr[Index] = basic_config_cmd[Index];
- }
-
- my_filter = (UINT8) ((AdapterInfo->Rx_Filter & PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS) ? 1 : 0);
- my_filter = (UINT8) ((my_filter | (AdapterInfo->Rx_Filter & PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST) ? 0 : 2));
-
- data_ptr[15] = (UINT8) (data_ptr[15] | my_filter);
- data_ptr[19] = (UINT8) (AdapterInfo->Duplex ? 0xC0 : 0x80);
- data_ptr[21] = (UINT8) ((AdapterInfo->Rx_Filter & PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST) ? 0x0D : 0x05);
-
- //
- // check if we have to use the AUI port instead
- //
- if ((AdapterInfo->PhyRecord[0] & 0x8000) != 0) {
- data_ptr[15] |= 0x80;
- data_ptr[8] = 0;
- }
-
- BlockIt (AdapterInfo, TRUE);
- cmd_ptr->cb_header.command = CmdSuspend | CmdConfigure;
-
- IssueCB (AdapterInfo, cmd_ptr);
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
-
- BlockIt (AdapterInfo, FALSE);
-
- CommandWaitForCompletion (cmd_ptr, AdapterInfo);
-
- //
- // restore the cb values for tx
- //
- cmd_ptr->PhysTBDArrayAddres = cmd_ptr->PhysArrayAddr;
- cmd_ptr->ByteCount = cmd_ptr->Threshold = cmd_ptr->TBDCount = 0;
- //
- // fields beyond the immediatedata are assumed to be safe
- // add the CB to the free list again
- //
- SetFreeCB (AdapterInfo, cmd_ptr);
- return 0;
-}
-
-UINT8
-E100bSetupIAAddr (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- //
- // all command blocks are of TxCB format
- //
- TxCB *cmd_ptr;
- UINT16 *data_ptr;
- UINT16 *eaddrs;
-
- eaddrs = (UINT16 *) AdapterInfo->CurrentNodeAddress;
-
- cmd_ptr = GetFreeCB (AdapterInfo);
- data_ptr = (UINT16 *) (&cmd_ptr->PhysTBDArrayAddres);
-
- //
- // AVOID a bug (?!) here by marking the command already completed.
- //
- cmd_ptr->cb_header.command = (CmdSuspend | CmdIASetup);
- cmd_ptr->cb_header.status = 0;
- data_ptr[0] = eaddrs[0];
- data_ptr[1] = eaddrs[1];
- data_ptr[2] = eaddrs[2];
-
- BlockIt (AdapterInfo, TRUE);
- IssueCB (AdapterInfo, cmd_ptr);
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
- BlockIt (AdapterInfo, FALSE);
-
- CommandWaitForCompletion (cmd_ptr, AdapterInfo);
-
- //
- // restore the cb values for tx
- //
- cmd_ptr->PhysTBDArrayAddres = cmd_ptr->PhysArrayAddr;
- cmd_ptr->ByteCount = cmd_ptr->Threshold = cmd_ptr->TBDCount = 0;
- //
- // fields beyond the immediatedata are assumed to be safe
- // add the CB to the free list again
- //
- SetFreeCB (AdapterInfo, cmd_ptr);
- return 0;
-}
-
-STATIC
-VOID
-StopRU (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- Instructs the NIC to stop receiving packets.
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information
- which the UNDI driver is layering on..
-Returns:
-
---*/
-{
- if (AdapterInfo->Receive_Started) {
-
- //
- // Todo: verify that we must wait for previous command completion.
- //
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
-
- //
- // Disable interrupts, and stop the chip's Rx process.
- //
- OutWord (AdapterInfo, INT_MASK, AdapterInfo->ioaddr + SCBCmd);
- OutWord (AdapterInfo, INT_MASK | RX_ABORT, AdapterInfo->ioaddr + SCBCmd);
-
- AdapterInfo->Receive_Started = FALSE;
- }
-
- return ;
-}
-
-STATIC
-INT8
-StartRU (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- Instructs the NIC to start receiving packets.
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information
- which the UNDI driver is layering on..
-Returns:
- 0 - Successful
- -1 - Already Started
---*/
-{
-
- if (AdapterInfo->Receive_Started) {
- //
- // already started
- //
- return -1;
- }
-
- AdapterInfo->cur_rx_ind = 0;
- AdapterInfo->Int_Status = 0;
-
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
-
- OutLong (AdapterInfo, (UINT32) AdapterInfo->rx_phy_addr, AdapterInfo->ioaddr + SCBPointer);
- OutByte (AdapterInfo, RX_START, AdapterInfo->ioaddr + SCBCmd);
-
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
-
- AdapterInfo->Receive_Started = TRUE;
- return 0;
-}
-
-UINTN
-E100bInit (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- Configures the chip. This routine expects the NIC_DATA_INSTANCE structure to be filled in.
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information
- which the UNDI driver is layering on..
-
-Returns:
- 0 - Successful
- PXE_STATCODE_NOT_ENOUGH_MEMORY - Insufficient length of locked memory
- other - Failure initializing chip
---*/
-{
- PCI_CONFIG_HEADER *CfgHdr;
- UINTN stat;
- UINTN rx_size;
- UINTN tx_size;
-
- if (AdapterInfo->MemoryLength < MEMORY_NEEDED) {
- return PXE_STATCODE_NOT_ENOUGH_MEMORY;
- }
-
- stat = MapIt (
- AdapterInfo,
- AdapterInfo->MemoryPtr,
- AdapterInfo->MemoryLength,
- TO_AND_FROM_DEVICE,
- (UINT64)(UINTN) &AdapterInfo->Mapped_MemoryPtr
- );
-
- if (stat != 0) {
- return stat;
- }
-
- CfgHdr = (PCI_CONFIG_HEADER *) &(AdapterInfo->Config[0]);
-
- //
- // fill in the ioaddr, int... from the config space
- //
- AdapterInfo->int_num = CfgHdr->int_line;
-
- //
- // we don't need to validate integer number, what if they don't want to assign one?
- // if (AdapterInfo->int_num == 0 || AdapterInfo->int_num == 0xff)
- // return PXE_STATCODE_DEVICE_FAILURE;
- //
- AdapterInfo->ioaddr = 0;
- AdapterInfo->VendorID = CfgHdr->VendorID;
- AdapterInfo->DeviceID = CfgHdr->DeviceID;
- AdapterInfo->RevID = CfgHdr->RevID;
- AdapterInfo->SubVendorID = CfgHdr->SubVendorID;
- AdapterInfo->SubSystemID = CfgHdr->SubSystemID;
- AdapterInfo->flash_addr = 0;
-
- //
- // Read the station address EEPROM before doing the reset.
- // Perhaps this should even be done before accepting the device,
- // then we wouldn't have a device name with which to report the error.
- //
- if (E100bReadEepromAndStationAddress (AdapterInfo) != 0) {
- return PXE_STATCODE_DEVICE_FAILURE;
-
- }
- //
- // ## calculate the buffer #s depending on memory given
- // ## calculate the rx and tx ring pointers
- //
-
- AdapterInfo->TxBufCnt = TX_BUFFER_COUNT;
- AdapterInfo->RxBufCnt = RX_BUFFER_COUNT;
- rx_size = (AdapterInfo->RxBufCnt * sizeof (RxFD));
- tx_size = (AdapterInfo->TxBufCnt * sizeof (TxCB));
- AdapterInfo->rx_ring = (RxFD *) (UINTN) (AdapterInfo->MemoryPtr);
- AdapterInfo->tx_ring = (TxCB *) (UINTN) (AdapterInfo->MemoryPtr + rx_size);
- AdapterInfo->statistics = (struct speedo_stats *) (UINTN) (AdapterInfo->MemoryPtr + rx_size + tx_size);
-
- AdapterInfo->rx_phy_addr = AdapterInfo->Mapped_MemoryPtr;
- AdapterInfo->tx_phy_addr = AdapterInfo->Mapped_MemoryPtr + rx_size;
- AdapterInfo->stat_phy_addr = AdapterInfo->tx_phy_addr + tx_size;
-
- //
- // auto detect.
- //
- AdapterInfo->PhyAddress = 0xFF;
- AdapterInfo->Rx_Filter = PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST;
- AdapterInfo->Receive_Started = FALSE;
- AdapterInfo->mcast_list.list_len = 0;
- return InitializeChip (AdapterInfo);
-}
-
-UINT8
-E100bSetInterruptState (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- Sets the interrupt state for the NIC.
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information
- which the UNDI driver is layering on..
-Returns:
- 0 - Successful
---*/
-{
- //
- // don't set receive interrupt if receiver is disabled...
- //
- UINT16 cmd_word;
-
- if ((AdapterInfo->int_mask & PXE_OPFLAGS_INTERRUPT_RECEIVE) != 0) {
- cmd_word = InWord (AdapterInfo, AdapterInfo->ioaddr + SCBCmd);
- cmd_word &= ~INT_MASK;
- OutWord (AdapterInfo, cmd_word, AdapterInfo->ioaddr + SCBCmd);
- } else {
- //
- // disable ints, should not be given for SW Int.
- //
- OutWord (AdapterInfo, INT_MASK, AdapterInfo->ioaddr + SCBCmd);
- }
-
- if ((AdapterInfo->int_mask & PXE_OPFLAGS_INTERRUPT_SOFTWARE) != 0) {
- //
- // reset the bit in our mask, it is only one time!!
- //
- AdapterInfo->int_mask &= ~(PXE_OPFLAGS_INTERRUPT_SOFTWARE);
- cmd_word = InWord (AdapterInfo, AdapterInfo->ioaddr + SCBCmd);
- cmd_word |= DRVR_INT;
- OutWord (AdapterInfo, cmd_word, AdapterInfo->ioaddr + SCBCmd);
- }
-
- return 0;
-}
-//
-// we are not going to disable broadcast for the WOL's sake!
-//
-UINTN
-E100bSetfilter (
- NIC_DATA_INSTANCE *AdapterInfo,
- UINT16 new_filter,
- UINT64 cpb,
- UINT32 cpbsize
- )
-/*++
-
-Routine Description:
- Instructs the NIC to start receiving packets.
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information
- which the UNDI driver is layering on..
- new_filter -
- cpb -
- cpbsize -
-
-Returns:
- 0 - Successful
- -1 - Already Started
---*/
-{
- PXE_CPB_RECEIVE_FILTERS *mc_list = (PXE_CPB_RECEIVE_FILTERS *) (UINTN)cpb;
- UINT16 cfg_flt;
- UINT16 old_filter;
- UINT16 Index;
- UINT16 Index2;
- UINT16 mc_count;
- TxCB *cmd_ptr;
- struct MC_CB_STRUCT *data_ptr;
- UINT16 mc_byte_cnt;
-
- old_filter = AdapterInfo->Rx_Filter;
-
- //
- // only these bits need a change in the configuration
- // actually change in bcast requires configure but we ignore that change
- //
- cfg_flt = PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS |
- PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST;
-
- if ((old_filter & cfg_flt) != (new_filter & cfg_flt)) {
- XmitWaitForCompletion (AdapterInfo);
-
- if (AdapterInfo->Receive_Started) {
- StopRU (AdapterInfo);
- }
-
- AdapterInfo->Rx_Filter = (UINT8) (new_filter | PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST);
- Configure (AdapterInfo);
- }
-
- //
- // check if mcast setting changed
- //
- if ( ((new_filter & PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST) !=
- (old_filter & PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST) ) ||
- (mc_list != NULL) ) {
-
-
- if (mc_list != NULL) {
- mc_count = AdapterInfo->mcast_list.list_len = (UINT16) (cpbsize / PXE_MAC_LENGTH);
-
- for (Index = 0; (Index < mc_count && Index < MAX_MCAST_ADDRESS_CNT); Index++) {
- for (Index2 = 0; Index2 < PXE_MAC_LENGTH; Index2++) {
- AdapterInfo->mcast_list.mc_list[Index][Index2] = mc_list->MCastList[Index][Index2];
- }
- }
- }
-
- //
- // are we setting the list or resetting??
- //
- if ((new_filter & PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST) != 0) {
- //
- // we are setting a new list!
- //
- mc_count = AdapterInfo->mcast_list.list_len;
- //
- // count should be the actual # of bytes in the list
- // so multiply this with 6
- //
- mc_byte_cnt = (UINT16) ((mc_count << 2) + (mc_count << 1));
- AdapterInfo->Rx_Filter |= PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST;
- } else {
- //
- // disabling the list in the NIC.
- //
- mc_byte_cnt = mc_count = 0;
- AdapterInfo->Rx_Filter &= (~PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST);
- }
-
- //
- // before issuing any new command!
- //
- XmitWaitForCompletion (AdapterInfo);
-
- if (AdapterInfo->Receive_Started) {
- StopRU (AdapterInfo);
-
- }
-
- cmd_ptr = GetFreeCB (AdapterInfo);
- if (cmd_ptr == NULL) {
- return PXE_STATCODE_QUEUE_FULL;
- }
- //
- // fill the command structure and issue
- //
- data_ptr = (struct MC_CB_STRUCT *) (&cmd_ptr->PhysTBDArrayAddres);
- //
- // first 2 bytes are the count;
- //
- data_ptr->count = mc_byte_cnt;
- for (Index = 0; Index < mc_count; Index++) {
- for (Index2 = 0; Index2 < PXE_HWADDR_LEN_ETHER; Index2++) {
- data_ptr->m_list[Index][Index2] = AdapterInfo->mcast_list.mc_list[Index][Index2];
- }
- }
-
- cmd_ptr->cb_header.command = CmdSuspend | CmdMulticastList;
- cmd_ptr->cb_header.status = 0;
-
- BlockIt (AdapterInfo, TRUE);
- IssueCB (AdapterInfo, cmd_ptr);
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
-
- BlockIt (AdapterInfo, FALSE);
-
- CommandWaitForCompletion (cmd_ptr, AdapterInfo);
-
- cmd_ptr->PhysTBDArrayAddres = cmd_ptr->PhysArrayAddr;
- cmd_ptr->ByteCount = cmd_ptr->Threshold = cmd_ptr->TBDCount = 0;
- //
- // fields beyond the immediatedata are assumed to be safe
- // add the CB to the free list again
- //
- SetFreeCB (AdapterInfo, cmd_ptr);
- }
-
- if (new_filter != 0) {
- //
- // enable unicast and start the RU
- //
- AdapterInfo->Rx_Filter = (UINT8) (AdapterInfo->Rx_Filter | (new_filter | PXE_OPFLAGS_RECEIVE_FILTER_UNICAST));
- StartRU (AdapterInfo);
- } else {
- //
- // may be disabling everything!
- //
- if (AdapterInfo->Receive_Started) {
- StopRU (AdapterInfo);
- }
-
- AdapterInfo->Rx_Filter |= (~PXE_OPFLAGS_RECEIVE_FILTER_UNICAST);
- }
-
- return 0;
-}
-
-UINTN
-E100bTransmit (
- NIC_DATA_INSTANCE *AdapterInfo,
- UINT64 cpb,
- UINT16 opflags
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
- cpb - TODO: add argument description
- opflags - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- PXE_CPB_TRANSMIT_FRAGMENTS *tx_ptr_f;
- PXE_CPB_TRANSMIT *tx_ptr_1;
- TxCB *tcb_ptr;
- UINT64 Tmp_ptr;
- UINTN stat;
- INT32 Index;
- UINT16 wait_sec;
-
- tx_ptr_1 = (PXE_CPB_TRANSMIT *) (UINTN) cpb;
- tx_ptr_f = (PXE_CPB_TRANSMIT_FRAGMENTS *) (UINTN) cpb;
-
- //
- // stop reentrancy here
- //
- if (AdapterInfo->in_transmit) {
- return PXE_STATCODE_BUSY;
-
- }
-
- AdapterInfo->in_transmit = TRUE;
-
- //
- // Prevent interrupts from changing the Tx ring from underneath us.
- //
- // Calculate the Tx descriptor entry.
- //
- if ((tcb_ptr = GetFreeCB (AdapterInfo)) == NULL) {
- AdapterInfo->in_transmit = FALSE;
- return PXE_STATCODE_QUEUE_FULL;
- }
-
- AdapterInfo->TxTotals++;
-
- tcb_ptr->cb_header.command = (CmdSuspend | CmdTx | CmdTxFlex);
- tcb_ptr->cb_header.status = 0;
-
- //
- // no immediate data, set EOF in the ByteCount
- //
- tcb_ptr->ByteCount = 0x8000;
-
- //
- // The data region is always in one buffer descriptor, Tx FIFO
- // threshold of 256.
- // 82557 multiplies the threashold value by 8, so give 256/8
- //
- tcb_ptr->Threshold = 32;
- if ((opflags & PXE_OPFLAGS_TRANSMIT_FRAGMENTED) != 0) {
-
- if (tx_ptr_f->FragCnt > MAX_XMIT_FRAGMENTS) {
- SetFreeCB (AdapterInfo, tcb_ptr);
- AdapterInfo->in_transmit = FALSE;
- return PXE_STATCODE_INVALID_PARAMETER;
- }
-
- tcb_ptr->TBDCount = (UINT8) tx_ptr_f->FragCnt;
-
- for (Index = 0; Index < tx_ptr_f->FragCnt; Index++) {
- stat = MapIt (
- AdapterInfo,
- tx_ptr_f->FragDesc[Index].FragAddr,
- tx_ptr_f->FragDesc[Index].FragLen,
- TO_DEVICE,
- (UINT64)(UINTN) &Tmp_ptr
- );
- if (stat != 0) {
- SetFreeCB (AdapterInfo, tcb_ptr);
- AdapterInfo->in_transmit = FALSE;
- return PXE_STATCODE_INVALID_PARAMETER;
- }
-
- tcb_ptr->TBDArray[Index].phys_buf_addr = (UINT32) Tmp_ptr;
- tcb_ptr->TBDArray[Index].buf_len = tx_ptr_f->FragDesc[Index].FragLen;
- }
-
- tcb_ptr->free_data_ptr = tx_ptr_f->FragDesc[0].FragAddr;
-
- } else {
- //
- // non fragmented case
- //
- tcb_ptr->TBDCount = 1;
- stat = MapIt (
- AdapterInfo,
- tx_ptr_1->FrameAddr,
- tx_ptr_1->DataLen + tx_ptr_1->MediaheaderLen,
- TO_DEVICE,
- (UINT64)(UINTN) &Tmp_ptr
- );
- if (stat != 0) {
- SetFreeCB (AdapterInfo, tcb_ptr);
- AdapterInfo->in_transmit = FALSE;
- return PXE_STATCODE_INVALID_PARAMETER;
- }
-
- tcb_ptr->TBDArray[0].phys_buf_addr = (UINT32) (Tmp_ptr);
- tcb_ptr->TBDArray[0].buf_len = tx_ptr_1->DataLen + tx_ptr_1->MediaheaderLen;
- tcb_ptr->free_data_ptr = tx_ptr_1->FrameAddr;
- }
-
- //
- // must wait for previous command completion only if it was a non-transmit
- //
- BlockIt (AdapterInfo, TRUE);
- IssueCB (AdapterInfo, tcb_ptr);
- BlockIt (AdapterInfo, FALSE);
-
- //
- // see if we need to wait for completion here
- //
- if ((opflags & PXE_OPFLAGS_TRANSMIT_BLOCK) != 0) {
- //
- // don't wait for more than 1 second!!!
- //
- wait_sec = 1000;
- while (tcb_ptr->cb_header.status == 0) {
- DelayIt (AdapterInfo, 10);
- wait_sec--;
- if (wait_sec == 0) {
- break;
- }
- }
- //
- // we need to un-map any mapped buffers here
- //
- if ((opflags & PXE_OPFLAGS_TRANSMIT_FRAGMENTED) != 0) {
-
- for (Index = 0; Index < tx_ptr_f->FragCnt; Index++) {
- Tmp_ptr = tcb_ptr->TBDArray[Index].phys_buf_addr;
- UnMapIt (
- AdapterInfo,
- tx_ptr_f->FragDesc[Index].FragAddr,
- tx_ptr_f->FragDesc[Index].FragLen,
- TO_DEVICE,
- (UINT64) Tmp_ptr
- );
- }
- } else {
- Tmp_ptr = tcb_ptr->TBDArray[0].phys_buf_addr;
- UnMapIt (
- AdapterInfo,
- tx_ptr_1->FrameAddr,
- tx_ptr_1->DataLen + tx_ptr_1->MediaheaderLen,
- TO_DEVICE,
- (UINT64) Tmp_ptr
- );
- }
-
- if (tcb_ptr->cb_header.status == 0) {
- SetFreeCB (AdapterInfo, tcb_ptr);
- AdapterInfo->in_transmit = FALSE;
- return PXE_STATCODE_DEVICE_FAILURE;
- }
-
- SetFreeCB (AdapterInfo, tcb_ptr);
- }
- //
- // CB will be set free later in get_status (or when we run out of xmit buffers
- //
- AdapterInfo->in_transmit = FALSE;
-
- return 0;
-}
-
-UINTN
-E100bReceive (
- NIC_DATA_INSTANCE *AdapterInfo,
- UINT64 cpb,
- UINT64 db
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
- cpb - TODO: add argument description
- db - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- PXE_CPB_RECEIVE *rx_cpbptr;
- PXE_DB_RECEIVE *rx_dbptr;
- RxFD *rx_ptr;
- INT32 status;
- INT32 Index;
- UINT16 pkt_len;
- UINT16 ret_code;
- PXE_FRAME_TYPE pkt_type;
- UINT16 Tmp_len;
- EtherHeader *hdr_ptr;
- ret_code = PXE_STATCODE_NO_DATA;
- pkt_type = PXE_FRAME_TYPE_NONE;
- status = InWord (AdapterInfo, AdapterInfo->ioaddr + SCBStatus);
- AdapterInfo->Int_Status = (UINT16) (AdapterInfo->Int_Status | status);
- //
- // acknoledge the interrupts
- //
- OutWord (AdapterInfo, (UINT16) (status & 0xfc00), (UINT32) (AdapterInfo->ioaddr + SCBStatus));
-
- //
- // include the prev ints as well
- //
- status = AdapterInfo->Int_Status;
- rx_cpbptr = (PXE_CPB_RECEIVE *) (UINTN) cpb;
- rx_dbptr = (PXE_DB_RECEIVE *) (UINTN) db;
-
- rx_ptr = &AdapterInfo->rx_ring[AdapterInfo->cur_rx_ind];
-
- //
- // be in a loop just in case (we may drop a pkt)
- //
- while ((status = rx_ptr->cb_header.status) & RX_COMPLETE) {
-
- AdapterInfo->RxTotals++;
- //
- // If we own the next entry, it's a new packet. Send it up.
- //
- if (rx_ptr->forwarded) {
- goto FreeRFD;
-
- }
-
- //
- // discard bad frames
- //
-
- //
- // crc, align, dma overrun, too short, receive error (v22 no coll)
- //
- if ((status & 0x0D90) != 0) {
- goto FreeRFD;
-
- }
-
- //
- // make sure the status is OK
- //
- if ((status & 0x02000) == 0) {
- goto FreeRFD;
- }
-
- pkt_len = (UINT16) (rx_ptr->ActualCount & 0x3fff);
-
- if (pkt_len != 0) {
-
- Tmp_len = pkt_len;
- if (pkt_len > rx_cpbptr->BufferLen) {
- Tmp_len = (UINT16) rx_cpbptr->BufferLen;
- }
-
- CopyMem ((INT8 *) (UINTN) rx_cpbptr->BufferAddr, (INT8 *) &rx_ptr->RFDBuffer, Tmp_len);
-
- hdr_ptr = (EtherHeader *) &rx_ptr->RFDBuffer;
- //
- // fill the CDB and break the loop
- //
-
- //
- // includes header
- //
- rx_dbptr->FrameLen = pkt_len;
- rx_dbptr->MediaHeaderLen = PXE_MAC_HEADER_LEN_ETHER;
-
- for (Index = 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {
- if (hdr_ptr->dest_addr[Index] != AdapterInfo->CurrentNodeAddress[Index]) {
- break;
- }
- }
-
- if (Index >= PXE_HWADDR_LEN_ETHER) {
- pkt_type = PXE_FRAME_TYPE_UNICAST;
- } else {
- for (Index = 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {
- if (hdr_ptr->dest_addr[Index] != AdapterInfo->BroadcastNodeAddress[Index]) {
- break;
- }
- }
-
- if (Index >= PXE_HWADDR_LEN_ETHER) {
- pkt_type = PXE_FRAME_TYPE_BROADCAST;
- } else {
- if ((hdr_ptr->dest_addr[0] & 1) == 1) {
- //
- // mcast
- //
-
- pkt_type = PXE_FRAME_TYPE_MULTICAST;
- } else {
- pkt_type = PXE_FRAME_TYPE_PROMISCUOUS;
- }
- }
- }
-
- rx_dbptr->Type = pkt_type;
- rx_dbptr->Protocol = hdr_ptr->type;
-
- for (Index = 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {
- rx_dbptr->SrcAddr[Index] = hdr_ptr->src_addr[Index];
- rx_dbptr->DestAddr[Index] = hdr_ptr->dest_addr[Index];
- }
-
- rx_ptr->forwarded = TRUE;
- //
- // success
- //
- ret_code = 0;
- Recycle_RFD (AdapterInfo, AdapterInfo->cur_rx_ind);
- AdapterInfo->cur_rx_ind++;
- if (AdapterInfo->cur_rx_ind == AdapterInfo->RxBufCnt) {
- AdapterInfo->cur_rx_ind = 0;
- }
- break;
- }
-
-FreeRFD:
- Recycle_RFD (AdapterInfo, AdapterInfo->cur_rx_ind);
- AdapterInfo->cur_rx_ind++;
- if (AdapterInfo->cur_rx_ind == AdapterInfo->RxBufCnt) {
- AdapterInfo->cur_rx_ind = 0;
- }
-
- rx_ptr = &AdapterInfo->rx_ring[AdapterInfo->cur_rx_ind];
- }
-
- if (pkt_type == PXE_FRAME_TYPE_NONE) {
- AdapterInfo->Int_Status &= (~SCB_STATUS_FR);
- }
-
- status = InWord (AdapterInfo, AdapterInfo->ioaddr + SCBStatus);
- if ((status & SCB_RUS_NO_RESOURCES) != 0) {
- //
- // start the receive unit here!
- // leave all the filled frames,
- //
- SetupReceiveQueues (AdapterInfo);
- OutLong (AdapterInfo, (UINT32) AdapterInfo->rx_phy_addr, AdapterInfo->ioaddr + SCBPointer);
- OutWord (AdapterInfo, RX_START, AdapterInfo->ioaddr + SCBCmd);
- AdapterInfo->cur_rx_ind = 0;
- }
-
- return ret_code;
-}
-
-INT16
-E100bReadEepromAndStationAddress (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- INT32 Index;
- INT32 Index2;
- UINT16 sum;
- UINT16 eeprom_len;
- UINT8 addr_len;
- UINT16 *eedata;
-
- eedata = (UINT16 *) (&AdapterInfo->NVData[0]);
-
- sum = 0;
- addr_len = E100bGetEepromAddrLen (AdapterInfo);
-
- //
- // in words
- //
- AdapterInfo->NVData_Len = eeprom_len = (UINT16) (1 << addr_len);
- for (Index2 = 0, Index = 0; Index < eeprom_len; Index++) {
- UINT16 value;
- value = E100bReadEeprom (AdapterInfo, Index, addr_len);
- eedata[Index] = value;
- sum = (UINT16) (sum + value);
- if (Index < 3) {
- AdapterInfo->PermNodeAddress[Index2++] = (UINT8) value;
- AdapterInfo->PermNodeAddress[Index2++] = (UINT8) (value >> 8);
- }
- }
-
- if (sum != 0xBABA) {
- return -1;
- }
-
- for (Index = 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {
- AdapterInfo->CurrentNodeAddress[Index] = AdapterInfo->PermNodeAddress[Index];
- }
-
- for (Index = 0; Index < PXE_HWADDR_LEN_ETHER; Index++) {
- AdapterInfo->BroadcastNodeAddress[Index] = 0xff;
- }
-
- for (Index = PXE_HWADDR_LEN_ETHER; Index < PXE_MAC_LENGTH; Index++) {
- AdapterInfo->CurrentNodeAddress[Index] = 0;
- AdapterInfo->PermNodeAddress[Index] = 0;
- AdapterInfo->BroadcastNodeAddress[Index] = 0;
- }
-
- return 0;
-}
-
-//
-// CBList is a circular linked list
-// 1) When all are free, Tail->next == Head and FreeCount == # allocated
-// 2) When none are free, Tail == Head and FreeCount == 0
-// 3) when one is free, Tail == Head and Freecount == 1
-// 4) First non-Free frame is always at Tail->next
-//
-UINT8
-SetupCBlink (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- TxCB *head_ptr;
- TxCB *tail_ptr;
- TxCB *cur_ptr;
- INT32 Index;
- UINTN array_off;
-
- cur_ptr = &(AdapterInfo->tx_ring[0]);
- array_off = (UINTN) (&cur_ptr->TBDArray) - (UINTN) cur_ptr;
- for (Index = 0; Index < AdapterInfo->TxBufCnt; Index++) {
- cur_ptr[Index].cb_header.status = 0;
- cur_ptr[Index].cb_header.command = 0;
-
- cur_ptr[Index].PhysTCBAddress =
- (UINT32) AdapterInfo->tx_phy_addr + (Index * sizeof (TxCB));
-
- cur_ptr[Index].PhysArrayAddr = (UINT32)(cur_ptr[Index].PhysTCBAddress + array_off);
- cur_ptr[Index].PhysTBDArrayAddres = (UINT32)(cur_ptr[Index].PhysTCBAddress + array_off);
-
- cur_ptr->free_data_ptr = (UINT64) 0;
-
- if (Index < AdapterInfo->TxBufCnt - 1) {
- cur_ptr[Index].cb_header.link = cur_ptr[Index].PhysTCBAddress + sizeof (TxCB);
- cur_ptr[Index].NextTCBVirtualLinkPtr = &cur_ptr[Index + 1];
- cur_ptr[Index + 1].PrevTCBVirtualLinkPtr = &cur_ptr[Index];
- }
- }
-
- head_ptr = &cur_ptr[0];
- tail_ptr = &cur_ptr[AdapterInfo->TxBufCnt - 1];
- tail_ptr->cb_header.link = head_ptr->PhysTCBAddress;
- tail_ptr->NextTCBVirtualLinkPtr = head_ptr;
- head_ptr->PrevTCBVirtualLinkPtr = tail_ptr;
-
- AdapterInfo->FreeCBCount = AdapterInfo->TxBufCnt;
- AdapterInfo->FreeTxHeadPtr = head_ptr;
- //
- // set tail of the free list, next to this would be either in use
- // or the head itself
- //
- AdapterInfo->FreeTxTailPtr = tail_ptr;
-
- AdapterInfo->xmit_done_head = AdapterInfo->xmit_done_tail = 0;
-
- return 0;
-}
-
-TxCB *
-GetFreeCB (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- TxCB *free_cb_ptr;
-
- //
- // claim any hanging free CBs
- //
- if (AdapterInfo->FreeCBCount <= 1) {
- CheckCBList (AdapterInfo);
- }
-
- //
- // don't use up the last CB problem if the previous CB that the CU used
- // becomes the last CB we submit because of the SUSPEND bit we set.
- // the CU thinks it was never cleared.
- //
-
- if (AdapterInfo->FreeCBCount <= 1) {
- return NULL;
- }
-
- BlockIt (AdapterInfo, TRUE);
- free_cb_ptr = AdapterInfo->FreeTxHeadPtr;
- AdapterInfo->FreeTxHeadPtr = free_cb_ptr->NextTCBVirtualLinkPtr;
- --AdapterInfo->FreeCBCount;
- BlockIt (AdapterInfo, FALSE);
- return free_cb_ptr;
-}
-
-VOID
-SetFreeCB (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN TxCB *cb_ptr
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
- cb_ptr - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- //
- // here we assume cb are returned in the order they are taken out
- // and we link the newly freed cb at the tail of free cb list
- //
- cb_ptr->cb_header.status = 0;
- cb_ptr->free_data_ptr = (UINT64) 0;
-
- AdapterInfo->FreeTxTailPtr = cb_ptr;
- ++AdapterInfo->FreeCBCount;
- return ;
-}
-
-UINT16
-next (
- IN UINT16 ind
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ind - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UINT16 Tmp;
-
- Tmp = (UINT16) (ind + 1);
- if (Tmp >= (TX_BUFFER_COUNT << 1)) {
- Tmp = 0;
- }
-
- return Tmp;
-}
-
-UINT16
-CheckCBList (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- TxCB *Tmp_ptr;
- UINT16 cnt;
-
- cnt = 0;
- while (1) {
- Tmp_ptr = AdapterInfo->FreeTxTailPtr->NextTCBVirtualLinkPtr;
- if ((Tmp_ptr->cb_header.status & CMD_STATUS_MASK) != 0) {
- //
- // check if Q is full
- //
- if (next (AdapterInfo->xmit_done_tail) != AdapterInfo->xmit_done_head) {
- AdapterInfo->xmit_done[AdapterInfo->xmit_done_tail] = Tmp_ptr->free_data_ptr;
-
- UnMapIt (
- AdapterInfo,
- Tmp_ptr->free_data_ptr,
- Tmp_ptr->TBDArray[0].buf_len,
- TO_DEVICE,
- (UINT64) Tmp_ptr->TBDArray[0].phys_buf_addr
- );
-
- AdapterInfo->xmit_done_tail = next (AdapterInfo->xmit_done_tail);
- }
-
- SetFreeCB (AdapterInfo, Tmp_ptr);
- } else {
- break;
- }
- }
-
- return cnt;
-}
-//
-// Description : Initialize the RFD list list by linking each element together
-// in a circular list. The simplified memory model is used.
-// All data is in the RFD. The RFDs are linked together and the
-// last one points back to the first one. When the current RFD
-// is processed (frame received), its EL bit is set and the EL
-// bit in the previous RXFD is cleared.
-// Allocation done during INIT, this is making linked list.
-//
-UINT8
-SetupReceiveQueues (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- RxFD *rx_ptr;
- RxFD *tail_ptr;
- UINT16 Index;
-
- AdapterInfo->cur_rx_ind = 0;
- rx_ptr = (&AdapterInfo->rx_ring[0]);
-
- for (Index = 0; Index < AdapterInfo->RxBufCnt; Index++) {
- rx_ptr[Index].cb_header.status = 0;
- rx_ptr[Index].cb_header.command = 0;
- rx_ptr[Index].RFDSize = RX_BUFFER_SIZE;
- rx_ptr[Index].ActualCount = 0;
- //
- // RBDs not used, simple memory model
- //
- rx_ptr[Index].rx_buf_addr = (UINT32) (-1);
-
- //
- // RBDs not used, simple memory model
- //
- rx_ptr[Index].forwarded = FALSE;
-
- //
- // don't use Tmp_ptr if it is beyond the last one
- //
- if (Index < AdapterInfo->RxBufCnt - 1) {
- rx_ptr[Index].cb_header.link = (UINT32) AdapterInfo->rx_phy_addr + ((Index + 1) * sizeof (RxFD));
- }
- }
-
- tail_ptr = (&AdapterInfo->rx_ring[AdapterInfo->RxBufCnt - 1]);
- tail_ptr->cb_header.link = (UINT32) AdapterInfo->rx_phy_addr;
-
- //
- // set the EL bit
- //
- tail_ptr->cb_header.command = 0xC000;
- AdapterInfo->RFDTailPtr = tail_ptr;
- return 0;
-}
-
-VOID
-Recycle_RFD (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT16 rx_index
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
- rx_index - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- RxFD *rx_ptr;
- RxFD *tail_ptr;
- //
- // change the EL bit and change the AdapterInfo->RxTailPtr
- // rx_ptr is assumed to be the head of the Q
- // AdapterInfo->rx_forwarded[rx_index] = FALSE;
- //
- rx_ptr = &AdapterInfo->rx_ring[rx_index];
- tail_ptr = AdapterInfo->RFDTailPtr;
- //
- // set el_bit and suspend bit
- //
- rx_ptr->cb_header.command = 0xc000;
- rx_ptr->cb_header.status = 0;
- rx_ptr->ActualCount = 0;
- rx_ptr->forwarded = FALSE;
- AdapterInfo->RFDTailPtr = rx_ptr;
- //
- // resetting the el_bit.
- //
- tail_ptr->cb_header.command = 0;
- //
- // check the receive unit, fix if there is any problem
- //
- return ;
-}
-//
-// Serial EEPROM section.
-//
-// EEPROM_Ctrl bits.
-//
-#define EE_SHIFT_CLK 0x01 /* EEPROM shift clock. */
-#define EE_CS 0x02 /* EEPROM chip select. */
-#define EE_DI 0x04 /* EEPROM chip data in. */
-#define EE_WRITE_0 0x01
-#define EE_WRITE_1 0x05
-#define EE_DO 0x08 /* EEPROM chip data out. */
-#define EE_ENB (0x4800 | EE_CS)
-
-//
-// Delay between EEPROM clock transitions.
-// This will actually work with no delay on 33Mhz PCI.
-//
-#define eeprom_delay(nanosec) DelayIt (AdapterInfo, nanosec);
-
-//
-// The EEPROM commands include the alway-set leading bit.
-//
-#define EE_WRITE_CMD 5 // 101b
-#define EE_READ_CMD 6 // 110b
-#define EE_ERASE_CMD (7 << 6)
-
-STATIC
-VOID
-shift_bits_out (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT16 val,
- IN UINT8 num_bits
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
- val - TODO: add argument description
- num_bits - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- INT32 Index;
- UINT8 Tmp;
- UINT32 EEAddr;
-
- EEAddr = AdapterInfo->ioaddr + SCBeeprom;
-
- for (Index = num_bits; Index >= 0; Index--) {
- INT16 dataval;
-
- //
- // will be 0 or 4
- //
- dataval = (INT16) ((val & (1 << Index)) ? EE_DI : 0);
-
- //
- // mask off the data_in bit
- //
- Tmp = (UINT8) (InByte (AdapterInfo, EEAddr) &~EE_DI);
- Tmp = (UINT8) (Tmp | dataval);
- OutByte (AdapterInfo, Tmp, EEAddr);
- eeprom_delay (100);
- //
- // raise the eeprom clock
- //
- OutByte (AdapterInfo, (UINT8) (Tmp | EE_SHIFT_CLK), EEAddr);
- eeprom_delay (150);
- //
- // lower the eeprom clock
- //
- OutByte (AdapterInfo, (UINT8) (Tmp &~EE_SHIFT_CLK), EEAddr);
- eeprom_delay (150);
- }
-}
-
-STATIC
-UINT16
-shift_bits_in (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UINT8 Tmp;
- INT32 Index;
- UINT16 retval;
- UINT32 EEAddr;
-
- EEAddr = AdapterInfo->ioaddr + SCBeeprom;
-
- retval = 0;
- for (Index = 15; Index >= 0; Index--) {
- //
- // raise the clock
- //
-
- //
- // mask off the data_in bit
- //
- Tmp = InByte (AdapterInfo, EEAddr);
- OutByte (AdapterInfo, (UINT8) (Tmp | EE_SHIFT_CLK), EEAddr);
- eeprom_delay (100);
- Tmp = InByte (AdapterInfo, EEAddr);
- retval = (UINT16) ((retval << 1) | ((Tmp & EE_DO) ? 1 : 0));
- //
- // lower the clock
- //
- OutByte (AdapterInfo, (UINT8) (Tmp &~EE_SHIFT_CLK), EEAddr);
- eeprom_delay (100);
- }
-
- return retval;
-}
-
-STATIC
-BOOLEAN
-E100bSetEepromLockOut (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine sets the EEPROM lockout bit to gain exclusive access to the
- eeprom. the access bit is the most significant bit in the General Control
- Register 2 in the SCB space.
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- TRUE - if it got the access
- FALSE - if it fails to get the exclusive access
-
---*/
-{
- UINTN wait;
- UINT8 tmp;
-
- if ((AdapterInfo->DeviceID == D102_DEVICE_ID) ||
- (AdapterInfo->RevID >= D102_REVID)) {
-
- wait = 500;
-
- while (wait--) {
-
- tmp = InByte (AdapterInfo, AdapterInfo->ioaddr + SCBGenCtrl2);
- tmp |= GCR2_EEPROM_ACCESS_SEMAPHORE;
- OutByte (AdapterInfo, tmp, AdapterInfo->ioaddr + SCBGenCtrl2);
-
- DelayIt (AdapterInfo, 50);
- tmp = InByte (AdapterInfo, AdapterInfo->ioaddr + SCBGenCtrl2);
-
- if (tmp & GCR2_EEPROM_ACCESS_SEMAPHORE) {
- return TRUE;
- }
- }
-
- return FALSE;
- }
-
- return TRUE;
-}
-
-STATIC
-VOID
-E100bReSetEepromLockOut (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine Resets the EEPROM lockout bit to giveup access to the
- eeprom. the access bit is the most significant bit in the General Control
- Register 2 in the SCB space.
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- None
-
---*/
-{
- UINT8 tmp;
-
- if ((AdapterInfo->DeviceID == D102_DEVICE_ID) ||
- (AdapterInfo->RevID >= D102_REVID)) {
-
- tmp = InByte (AdapterInfo, AdapterInfo->ioaddr + SCBGenCtrl2);
- tmp &= ~(GCR2_EEPROM_ACCESS_SEMAPHORE);
- OutByte (AdapterInfo, tmp, AdapterInfo->ioaddr + SCBGenCtrl2);
-
- DelayIt (AdapterInfo, 50);
- }
-}
-
-UINT16
-E100bReadEeprom (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN INT32 Location,
- IN UINT8 AddrLen
- )
-/*++
-
-Routine Description:
- Using the NIC data structure information, read the EEPROM to get a Word of data for the MAC address.
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
- Location - Word offset into the MAC address to read.
- AddrLen - Number of bits of address length.
-
-Returns:
- RetVal - The word read from the EEPROM.
-
---*/
-{
- UINT16 RetVal;
- UINT8 Tmp;
-
- UINT32 EEAddr;
- UINT16 ReadCmd;
-
- EEAddr = AdapterInfo->ioaddr + SCBeeprom;
- ReadCmd = (UINT16) (Location | (EE_READ_CMD << AddrLen));
-
- RetVal = 0;
-
- //
- // get exclusive access to the eeprom first!
- //
- E100bSetEepromLockOut (AdapterInfo);
-
- //
- // eeprom control reg bits: x,x,x,x,DO,DI,CS,SK
- // to write the opcode+data value out one bit at a time in DI starting at msb
- // and then out a 1 to sk, wait, out 0 to SK and wait
- // repeat this for all the bits to be written
- //
-
- //
- // 11110010b
- //
- Tmp = (UINT8) (InByte (AdapterInfo, EEAddr) & 0xF2);
- OutByte (AdapterInfo, (UINT8) (Tmp | EE_CS), EEAddr);
-
- //
- // 3 for the read opcode 110b
- //
- shift_bits_out (AdapterInfo, ReadCmd, (UINT8) (3 + AddrLen));
-
- //
- // read the eeprom word one bit at a time
- //
- RetVal = shift_bits_in (AdapterInfo);
-
- //
- // Terminate the EEPROM access and leave eeprom in a clean state.
- //
- Tmp = InByte (AdapterInfo, EEAddr);
- Tmp &= ~(EE_CS | EE_DI);
- OutByte (AdapterInfo, Tmp, EEAddr);
-
- //
- // raise the clock and lower the eeprom shift clock
- //
- OutByte (AdapterInfo, (UINT8) (Tmp | EE_SHIFT_CLK), EEAddr);
- eeprom_delay (100);
-
- OutByte (AdapterInfo, (UINT8) (Tmp &~EE_SHIFT_CLK), EEAddr);
- eeprom_delay (100);
-
- //
- // giveup access to the eeprom
- //
- E100bReSetEepromLockOut (AdapterInfo);
-
- return RetVal;
-}
-
-UINT8
-E100bGetEepromAddrLen (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- Using the NIC data structure information, read the EEPROM to determine how many bits of address length
- this EEPROM is in Words.
-
-Arguments:
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
- RetVal - The word read from the EEPROM.
-
---*/
-{
- UINT8 Tmp;
- UINT8 AddrLen;
- UINT32 EEAddr;
- //
- // assume 64word eeprom (so,6 bits of address_length)
- //
- UINT16 ReadCmd;
-
- EEAddr = AdapterInfo->ioaddr + SCBeeprom;
- ReadCmd = (EE_READ_CMD << 6);
-
- //
- // get exclusive access to the eeprom first!
- //
- E100bSetEepromLockOut (AdapterInfo);
-
- //
- // address we are trying to read is 0
- // eeprom control reg bits: x,x,x,x,DO,,DI,,CS,SK
- // to write the opcode+data value out one bit at a time in DI starting at msb
- // and then out a 1 to sk, wait, out 0 to SK and wait
- // repeat this for all the bits to be written
- //
- Tmp = (UINT8) (InByte (AdapterInfo, EEAddr) & 0xF2);
-
- //
- // enable eeprom access
- //
- OutByte (AdapterInfo, (UINT8) (Tmp | EE_CS), EEAddr);
-
- //
- // 3 for opcode, 6 for the default address len
- //
- shift_bits_out (AdapterInfo, ReadCmd, (UINT8) (3 + 6));
-
- //
- // (in case of a 64 word eeprom).
- // read the "dummy zero" from EE_DO to say that the address we wrote
- // (six 0s) is accepted, write more zeros (until 8) to get a "dummy zero"
- //
-
- //
- // assume the smallest
- //
- AddrLen = 6;
- Tmp = InByte (AdapterInfo, EEAddr);
- while ((AddrLen < 8) && ((Tmp & EE_DO) != 0)) {
- OutByte (AdapterInfo, (UINT8) (Tmp &~EE_DI), EEAddr);
- eeprom_delay (100);
-
- //
- // raise the eeprom clock
- //
- OutByte (AdapterInfo, (UINT8) (Tmp | EE_SHIFT_CLK), EEAddr);
- eeprom_delay (150);
-
- //
- // lower the eeprom clock
- //
- OutByte (AdapterInfo, (UINT8) (Tmp &~EE_SHIFT_CLK), EEAddr);
- eeprom_delay (150);
- Tmp = InByte (AdapterInfo, EEAddr);
- AddrLen++;
- }
-
- //
- // read the eeprom word, even though we don't need this
- //
- shift_bits_in (AdapterInfo);
-
- //
- // Terminate the EEPROM access.
- //
- Tmp = InByte (AdapterInfo, EEAddr);
- Tmp &= ~(EE_CS | EE_DI);
- OutByte (AdapterInfo, Tmp, EEAddr);
-
- //
- // raise the clock and lower the eeprom shift clock
- //
- OutByte (AdapterInfo, (UINT8) (Tmp | EE_SHIFT_CLK), EEAddr);
- eeprom_delay (100);
-
- OutByte (AdapterInfo, (UINT8) (Tmp &~EE_SHIFT_CLK), EEAddr);
- eeprom_delay (100);
-
- //
- // giveup access to the eeprom!
- //
- E100bReSetEepromLockOut (AdapterInfo);
-
- return AddrLen;
-}
-
-UINTN
-E100bStatistics (
- NIC_DATA_INSTANCE *AdapterInfo,
- UINT64 DBaddr,
- UINT16 DBsize
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
- DBaddr - TODO: add argument description
- DBsize - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- PXE_DB_STATISTICS db;
- //
- // wait upto one second (each wait is 100 micro s)
- //
- UINT32 Wait;
- Wait = 10000;
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
-
- //
- // Clear statistics done marker.
- //
- AdapterInfo->statistics->done_marker = 0;
-
- //
- // Issue statistics dump (or dump w/ reset) command.
- //
- OutByte (
- AdapterInfo,
- (UINT8) (DBsize ? CU_SHOWSTATS : CU_DUMPSTATS),
- (UINT32) (AdapterInfo->ioaddr + SCBCmd)
- );
-
- //
- // Wait for command to complete.
- //
- // zero the db here just to chew up a little more time.
- //
-
- ZeroMem ((VOID *) &db, sizeof db);
-
- while (Wait != 0) {
- //
- // Wait a bit before checking.
- //
-
- DelayIt (AdapterInfo, 100);
-
- //
- // Look for done marker at end of statistics.
- //
-
- switch (AdapterInfo->statistics->done_marker) {
- case 0xA005:
- case 0xA007:
- break;
-
- default:
- Wait--;
- continue;
- }
-
- //
- // if we did not "continue" from the above switch, we are done,
- //
- break;
- }
-
- //
- // If this is a reset, we are out of here!
- //
- if (DBsize == 0) {
- return PXE_STATCODE_SUCCESS;
- }
-
- //
- // Convert NIC statistics counter format to EFI/UNDI
- // specification statistics counter format.
- //
-
- //
- // 54 3210 fedc ba98 7654 3210
- // db.Supported = 01 0000 0100 1101 0001 0111;
- //
- db.Supported = 0x104D17;
-
- //
- // Statistics from the NIC
- //
-
- db.Data[0x01] = AdapterInfo->statistics->rx_good_frames;
-
- db.Data[0x02] = AdapterInfo->statistics->rx_runt_errs;
-
- db.Data[0x08] = AdapterInfo->statistics->rx_crc_errs +
- AdapterInfo->statistics->rx_align_errs;
-
- db.Data[0x04] = db.Data[0x02] +
- db.Data[0x08] +
- AdapterInfo->statistics->rx_resource_errs +
- AdapterInfo->statistics->rx_overrun_errs;
-
- db.Data[0x00] = db.Data[0x01] + db.Data[0x04];
-
- db.Data[0x0B] = AdapterInfo->statistics->tx_good_frames;
-
- db.Data[0x0E] = AdapterInfo->statistics->tx_coll16_errs +
- AdapterInfo->statistics->tx_late_colls +
- AdapterInfo->statistics->tx_underruns +
- AdapterInfo->statistics->tx_one_colls +
- AdapterInfo->statistics->tx_multi_colls;
-
- db.Data[0x14] = AdapterInfo->statistics->tx_total_colls;
-
- db.Data[0x0A] = db.Data[0x0B] +
- db.Data[0x0E] +
- AdapterInfo->statistics->tx_lost_carrier;
-
- if (DBsize > sizeof db) {
- DBsize = sizeof db;
- }
-
- CopyMem ((VOID *) (UINTN) DBaddr, (VOID *) &db, (UINTN) DBsize);
-
- return PXE_STATCODE_SUCCESS;
-}
-
-UINTN
-E100bReset (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN INT32 OpFlags
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
- OpFlags - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
-
- UINT16 save_filter;
- //
- // disable the interrupts
- //
- OutWord (AdapterInfo, INT_MASK, AdapterInfo->ioaddr + SCBCmd);
-
- //
- // wait for the tx queue to complete
- //
- CheckCBList (AdapterInfo);
-
- XmitWaitForCompletion (AdapterInfo);
-
- if (AdapterInfo->Receive_Started) {
- StopRU (AdapterInfo);
- }
-
- InitializeChip (AdapterInfo);
-
- //
- // check the opflags and restart receive filters
- //
- if ((OpFlags & PXE_OPFLAGS_RESET_DISABLE_FILTERS) == 0) {
-
- save_filter = AdapterInfo->Rx_Filter;
- //
- // if we give the filter same as Rx_Filter,
- // this routine will not set mcast list (it thinks there is no change)
- // to force it, we will reset that flag in the Rx_Filter
- //
- AdapterInfo->Rx_Filter &= (~PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST);
- E100bSetfilter (AdapterInfo, save_filter, (UINT64) 0, (UINT32) 0);
- }
-
- if ((OpFlags & PXE_OPFLAGS_RESET_DISABLE_INTERRUPTS) != 0) {
- //
- // disable the interrupts
- //
- AdapterInfo->int_mask = 0;
- }
- //
- // else leave the interrupt in the pre-set state!!!
- //
- E100bSetInterruptState (AdapterInfo);
-
- return 0;
-}
-
-UINTN
-E100bShutdown (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- //
- // disable the interrupts
- //
- OutWord (AdapterInfo, INT_MASK, AdapterInfo->ioaddr + SCBCmd);
-
- //
- // stop the receive unit
- //
- if (AdapterInfo->Receive_Started) {
- StopRU (AdapterInfo);
- }
-
- //
- // wait for the tx queue to complete
- //
- CheckCBList (AdapterInfo);
- if (AdapterInfo->FreeCBCount != AdapterInfo->TxBufCnt) {
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
- }
-
- //
- // we do not want to reset the phy, it takes a long time to renegotiate the
- // link after that (3-4 seconds)
- //
- InitializeChip (AdapterInfo);
- SelectiveReset (AdapterInfo);
- return 0;
-}
-
-VOID
-MdiWrite (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT8 RegAddress,
- IN UINT8 PhyAddress,
- IN UINT16 DataValue
- )
-/*++
-
-Routine Description:
- This routine will write a value to the specified MII register
- of an external MDI compliant device (e.g. PHY 100). The command will
- execute in polled mode.
-
-Arguments:
- AdapterInfo - pointer to the structure that contains the NIC's context.
- RegAddress - The MII register that we are writing to
- PhyAddress - The MDI address of the Phy component.
- DataValue - The value that we are writing to the MII register.
-
-Returns:
- nothing
---*/
-{
- UINT32 WriteCommand;
-
- WriteCommand = ((UINT32) DataValue) |
- ((UINT32)(RegAddress << 16)) |
- ((UINT32)(PhyAddress << 21)) |
- ((UINT32)(MDI_WRITE << 26));
-
- //
- // Issue the write command to the MDI control register.
- //
- OutLong (AdapterInfo, WriteCommand, AdapterInfo->ioaddr + SCBCtrlMDI);
-
- //
- // wait 20usec before checking status
- //
- DelayIt (AdapterInfo, 20);
-
- //
- // poll for the mdi write to complete
- while ((InLong (AdapterInfo, AdapterInfo->ioaddr + SCBCtrlMDI) &
- MDI_PHY_READY) == 0){
- DelayIt (AdapterInfo, 20);
- }
-}
-
-VOID
-MdiRead (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT8 RegAddress,
- IN UINT8 PhyAddress,
- IN OUT UINT16 *DataValue
- )
-/*++
-
-Routine Description:
- This routine will read a value from the specified MII register
- of an external MDI compliant device (e.g. PHY 100), and return
- it to the calling routine. The command will execute in polled mode.
-
-Arguments:
- AdapterInfo - pointer to the structure that contains the NIC's context.
- RegAddress - The MII register that we are reading from
- PhyAddress - The MDI address of the Phy component.
- DataValue - pointer to the value that we read from the MII register.
-
-Returns:
-
---*/
-{
- UINT32 ReadCommand;
-
- ReadCommand = ((UINT32) (RegAddress << 16)) |
- ((UINT32) (PhyAddress << 21)) |
- ((UINT32) (MDI_READ << 26));
-
- //
- // Issue the read command to the MDI control register.
- //
- OutLong (AdapterInfo, ReadCommand, AdapterInfo->ioaddr + SCBCtrlMDI);
-
- //
- // wait 20usec before checking status
- //
- DelayIt (AdapterInfo, 20);
-
- //
- // poll for the mdi read to complete
- //
- while ((InLong (AdapterInfo, AdapterInfo->ioaddr + SCBCtrlMDI) &
- MDI_PHY_READY) == 0) {
- DelayIt (AdapterInfo, 20);
-
- }
-
- *DataValue = InWord (AdapterInfo, AdapterInfo->ioaddr + SCBCtrlMDI);
-}
-
-VOID
-PhyReset (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine will reset the PHY that the adapter is currently
- configured to use.
-
-Arguments:
- AdapterInfo - pointer to the structure that contains the NIC's context.
-
-Returns:
-
---*/
-{
- UINT16 MdiControlReg;
-
- MdiControlReg = (MDI_CR_AUTO_SELECT |
- MDI_CR_RESTART_AUTO_NEG |
- MDI_CR_RESET);
-
- //
- // Write the MDI control register with our new Phy configuration
- //
- MdiWrite (
- AdapterInfo,
- MDI_CONTROL_REG,
- AdapterInfo->PhyAddress,
- MdiControlReg
- );
-
- return ;
-}
-
-BOOLEAN
-PhyDetect (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine will detect what phy we are using, set the line
- speed, FDX or HDX, and configure the phy if necessary.
-
- The following combinations are supported:
- - TX or T4 PHY alone at PHY address 1
- - T4 or TX PHY at address 1 and MII PHY at address 0
- - 82503 alone (10Base-T mode, no full duplex support)
- - 82503 and MII PHY (TX or T4) at address 0
-
- The sequence / priority of detection is as follows:
- - PHY 1 with cable termination
- - PHY 0 with cable termination
- - PHY 1 (if found) without cable termination
- - 503 interface
-
- Additionally auto-negotiation capable (NWAY) and parallel
- detection PHYs are supported. The flow-chart is described in
- the 82557 software writer's manual.
-
- NOTE: 1. All PHY MDI registers are read in polled mode.
- 2. The routines assume that the 82557 has been RESET and we have
- obtained the virtual memory address of the CSR.
- 3. PhyDetect will not RESET the PHY.
- 4. If FORCEFDX is set, SPEED should also be set. The driver will
- check the values for inconsistency with the detected PHY
- technology.
- 5. PHY 1 (the PHY on the adapter) may have an address in the range
- 1 through 31 inclusive. The driver will accept addresses in
- this range.
- 6. Driver ignores FORCEFDX and SPEED overrides if a 503 interface
- is detected.
-
-Arguments:
- AdapterInfo - pointer to the structure that contains the NIC's context.
-
-Returns:
- TRUE - If a Phy was detected, and configured correctly.
- FALSE - If a valid phy could not be detected and configured.
-
---*/
-{
- UINT16 *eedata;
- UINT16 MdiControlReg;
- UINT16 MdiStatusReg;
- BOOLEAN FoundPhy1;
- UINT8 ReNegotiateTime;
-
- eedata = (UINT16 *) (&AdapterInfo->NVData[0]);
-
- FoundPhy1 = FALSE;
- ReNegotiateTime = 35;
- //
- // EEPROM word [6] contains the Primary PHY record in which the least 3 bits
- // indicate the PHY address
- // and word [7] contains the secondary PHY record
- //
- AdapterInfo->PhyRecord[0] = eedata[6];
- AdapterInfo->PhyRecord[1] = eedata[7];
- AdapterInfo->PhyAddress = (UINT8) (AdapterInfo->PhyRecord[0] & 7);
-
- //
- // Check for a phy address over-ride of 32 which indicates force use of 82503
- // not detecting the link in this case
- //
- if (AdapterInfo->PhyAddress == 32) {
- //
- // 503 interface over-ride
- // Record the current speed and duplex. We will be in half duplex
- // mode unless the user used the force full duplex over-ride.
- //
- AdapterInfo->LinkSpeed = 10;
- return (TRUE);
- }
-
- //
- // If the Phy Address is between 1-31 then we must first look for phy 1,
- // at that address.
- //
- if ((AdapterInfo->PhyAddress > 0) && (AdapterInfo->PhyAddress < 32)) {
-
- //
- // Read the MDI control and status registers at phy 1
- // and check if we found a valid phy
- //
- MdiRead (
- AdapterInfo,
- MDI_CONTROL_REG,
- AdapterInfo->PhyAddress,
- &MdiControlReg
- );
-
- MdiRead (
- AdapterInfo,
- MDI_STATUS_REG,
- AdapterInfo->PhyAddress,
- &MdiStatusReg
- );
-
- if (!((MdiControlReg == 0xffff) ||
- ((MdiStatusReg == 0) && (MdiControlReg == 0)))) {
-
- //
- // we have a valid phy1
- // Read the status register again because of sticky bits
- //
- FoundPhy1 = TRUE;
- MdiRead (
- AdapterInfo,
- MDI_STATUS_REG,
- AdapterInfo->PhyAddress,
- &MdiStatusReg
- );
-
- //
- // If there is a valid link then use this Phy.
- //
- if (MdiStatusReg & MDI_SR_LINK_STATUS) {
- return (SetupPhy(AdapterInfo));
- }
- }
- }
-
- //
- // Next try to detect a PHY at address 0x00 because there was no Phy 1,
- // or Phy 1 didn't have link, or we had a phy 0 over-ride
- //
-
- //
- // Read the MDI control and status registers at phy 0
- //
- MdiRead (AdapterInfo, MDI_CONTROL_REG, 0, &MdiControlReg);
- MdiRead (AdapterInfo, MDI_STATUS_REG, 0, &MdiStatusReg);
-
- //
- // check if we found a valid phy 0
- //
- if (((MdiControlReg == 0xffff) ||
- ((MdiStatusReg == 0) && (MdiControlReg == 0)))) {
-
- //
- // we don't have a valid phy at address 0
- // if phy address was forced to 0, then error out because we
- // didn't find a phy at that address
- //
- if (AdapterInfo->PhyAddress == 0x0000) {
- return (FALSE);
- } else {
- //
- // at this point phy1 does not have link and there is no phy 0 at all
- // if we are forced to detect the cable, error out here!
- //
- if (AdapterInfo->CableDetect != 0) {
- return FALSE;
-
- }
-
- if (FoundPhy1) {
- //
- // no phy 0, but there is a phy 1 (no link I guess), so use phy 1
- //
- return SetupPhy (AdapterInfo);
- } else {
- //
- // didn't find phy 0 or phy 1, so assume a 503 interface
- //
- AdapterInfo->PhyAddress = 32;
-
- //
- // Record the current speed and duplex. We'll be in half duplex
- // mode unless the user used the force full duplex over-ride.
- //
- AdapterInfo->LinkSpeed = 10;
- return (TRUE);
- }
- }
- } else {
- //
- // We have a valid phy at address 0. If phy 0 has a link then we use
- // phy 0. If Phy 0 doesn't have a link then we use Phy 1 (no link)
- // if phy 1 is present, or phy 0 if phy 1 is not present
- // If phy 1 was present, then we must isolate phy 1 before we enable
- // phy 0 to see if Phy 0 has a link.
- //
- if (FoundPhy1) {
- //
- // isolate phy 1
- //
- MdiWrite (
- AdapterInfo,
- MDI_CONTROL_REG,
- AdapterInfo->PhyAddress,
- MDI_CR_ISOLATE
- );
-
- //
- // wait 100 microseconds for the phy to isolate.
- //
- DelayIt (AdapterInfo, 100);
- }
-
- //
- // Since this Phy is at address 0, we must enable it. So clear
- // the isolate bit, and set the auto-speed select bit
- //
- MdiWrite (
- AdapterInfo,
- MDI_CONTROL_REG,
- 0,
- MDI_CR_AUTO_SELECT
- );
-
- //
- // wait 100 microseconds for the phy to be enabled.
- //
- DelayIt (AdapterInfo, 100);
-
- //
- // restart the auto-negotion process
- //
- MdiWrite (
- AdapterInfo,
- MDI_CONTROL_REG,
- 0,
- MDI_CR_RESTART_AUTO_NEG | MDI_CR_AUTO_SELECT
- );
-
- //
- // wait no more than 3.5 seconds for auto-negotiation to complete
- //
- while (ReNegotiateTime) {
- //
- // Read the status register twice because of sticky bits
- //
- MdiRead (AdapterInfo, MDI_STATUS_REG, 0, &MdiStatusReg);
- MdiRead (AdapterInfo, MDI_STATUS_REG, 0, &MdiStatusReg);
-
- if (MdiStatusReg & MDI_SR_AUTO_NEG_COMPLETE) {
- break;
- }
-
- DelayIt (AdapterInfo, 100);
- ReNegotiateTime--;
- }
-
- //
- // Read the status register again because of sticky bits
- //
- MdiRead (AdapterInfo, MDI_STATUS_REG, 0, &MdiStatusReg);
-
- //
- // If the link was not set
- //
- if ((MdiStatusReg & MDI_SR_LINK_STATUS) == 0) {
- //
- // PHY1 does not have a link and phy 0 does not have a link
- // do not proceed if we need to detect the link!
- //
- if (AdapterInfo->CableDetect != 0) {
- return FALSE;
- }
-
- //
- // the link wasn't set, so use phy 1 if phy 1 was present
- //
- if (FoundPhy1) {
- //
- // isolate phy 0
- //
- MdiWrite (AdapterInfo, MDI_CONTROL_REG, 0, MDI_CR_ISOLATE);
-
- //
- // wait 100 microseconds for the phy to isolate.
- //
- DelayIt (AdapterInfo, 100);
-
- //
- // Now re-enable PHY 1
- //
- MdiWrite (
- AdapterInfo,
- MDI_CONTROL_REG,
- AdapterInfo->PhyAddress,
- MDI_CR_AUTO_SELECT
- );
-
- //
- // wait 100 microseconds for the phy to be enabled
- //
- DelayIt (AdapterInfo, 100);
-
- //
- // restart the auto-negotion process
- //
- MdiWrite (
- AdapterInfo,
- MDI_CONTROL_REG,
- AdapterInfo->PhyAddress,
- MDI_CR_RESTART_AUTO_NEG | MDI_CR_AUTO_SELECT
- );
-
- //
- // Don't wait for it to complete (we didn't have link earlier)
- //
- return (SetupPhy (AdapterInfo));
- }
- }
-
- //
- // Definitely using Phy 0
- //
- AdapterInfo->PhyAddress = 0;
- return (SetupPhy(AdapterInfo));
- }
-}
-
-BOOLEAN
-SetupPhy (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
- This routine will setup phy 1 or phy 0 so that it is configured
- to match a speed and duplex over-ride option. If speed or
- duplex mode is not explicitly specified in the registry, the
- driver will skip the speed and duplex over-ride code, and
- assume the adapter is automatically setting the line speed, and
- the duplex mode. At the end of this routine, any truly Phy
- specific code will be executed (each Phy has its own quirks,
- and some require that certain special bits are set).
-
- NOTE: The driver assumes that SPEED and FORCEFDX are specified at the
- same time. If FORCEDPX is set without speed being set, the driver
- will encouter a fatal error and log a message into the event viewer.
-
-Arguments:
- AdapterInfo - pointer to the structure that contains the NIC's context.
-
-Returns:
- TRUE - If the phy could be configured correctly
- FALSE - If the phy couldn't be configured correctly, because an
- unsupported over-ride option was used
-
---*/
-{
- UINT16 MdiControlReg;
- UINT16 MdiStatusReg;
- UINT16 MdiIdLowReg;
- UINT16 MdiIdHighReg;
- UINT16 MdiMiscReg;
- UINT32 PhyId;
- BOOLEAN ForcePhySetting;
-
- ForcePhySetting = FALSE;
-
- //
- // If we are NOT forcing a setting for line speed or full duplex, then
- // we won't force a link setting, and we'll jump down to the phy
- // specific code.
- //
- if (((AdapterInfo->LinkSpeedReq) || (AdapterInfo->DuplexReq))) {
- //
- // Find out what kind of technology this Phy is capable of.
- //
- MdiRead (
- AdapterInfo,
- MDI_STATUS_REG,
- AdapterInfo->PhyAddress,
- &MdiStatusReg
- );
-
- //
- // Read the MDI control register at our phy
- //
- MdiRead (
- AdapterInfo,
- MDI_CONTROL_REG,
- AdapterInfo->PhyAddress,
- &MdiControlReg
- );
-
- //
- // Now check the validity of our forced option. If the force option is
- // valid, then force the setting. If the force option is not valid,
- // we'll set a flag indicating that we should error out.
- //
-
- //
- // If speed is forced to 10mb
- //
- if (AdapterInfo->LinkSpeedReq == 10) {
- //
- // If half duplex is forced
- //
- if ((AdapterInfo->DuplexReq & PXE_FORCE_HALF_DUPLEX) != 0) {
- if (MdiStatusReg & MDI_SR_10T_HALF_DPX) {
-
- MdiControlReg &= ~(MDI_CR_10_100 | MDI_CR_AUTO_SELECT | MDI_CR_FULL_HALF);
- ForcePhySetting = TRUE;
- }
- } else if ((AdapterInfo->DuplexReq & PXE_FORCE_FULL_DUPLEX) != 0) {
-
- //
- // If full duplex is forced
- //
- if (MdiStatusReg & MDI_SR_10T_FULL_DPX) {
-
- MdiControlReg &= ~(MDI_CR_10_100 | MDI_CR_AUTO_SELECT);
- MdiControlReg |= MDI_CR_FULL_HALF;
- ForcePhySetting = TRUE;
- }
- } else {
- //
- // If auto duplex (we actually set phy to 1/2)
- //
- if (MdiStatusReg & (MDI_SR_10T_FULL_DPX | MDI_SR_10T_HALF_DPX)) {
-
- MdiControlReg &= ~(MDI_CR_10_100 | MDI_CR_AUTO_SELECT | MDI_CR_FULL_HALF);
- ForcePhySetting = TRUE;
- }
- }
- }
-
- //
- // If speed is forced to 100mb
- //
- else if (AdapterInfo->LinkSpeedReq == 100) {
- //
- // If half duplex is forced
- //
- if ((AdapterInfo->DuplexReq & PXE_FORCE_HALF_DUPLEX) != 0) {
- if (MdiStatusReg & (MDI_SR_TX_HALF_DPX | MDI_SR_T4_CAPABLE)) {
-
- MdiControlReg &= ~(MDI_CR_AUTO_SELECT | MDI_CR_FULL_HALF);
- MdiControlReg |= MDI_CR_10_100;
- ForcePhySetting = TRUE;
- }
- } else if ((AdapterInfo->DuplexReq & PXE_FORCE_FULL_DUPLEX) != 0) {
- //
- // If full duplex is forced
- //
- if (MdiStatusReg & MDI_SR_TX_FULL_DPX) {
- MdiControlReg &= ~MDI_CR_AUTO_SELECT;
- MdiControlReg |= (MDI_CR_10_100 | MDI_CR_FULL_HALF);
- ForcePhySetting = TRUE;
- }
- } else {
- //
- // If auto duplex (we set phy to 1/2)
- //
- if (MdiStatusReg & (MDI_SR_TX_HALF_DPX | MDI_SR_T4_CAPABLE)) {
-
- MdiControlReg &= ~(MDI_CR_AUTO_SELECT | MDI_CR_FULL_HALF);
- MdiControlReg |= MDI_CR_10_100;
- ForcePhySetting = TRUE;
- }
- }
- }
-
- if (!ForcePhySetting) {
- return (FALSE);
- }
-
- //
- // Write the MDI control register with our new Phy configuration
- //
- MdiWrite (
- AdapterInfo,
- MDI_CONTROL_REG,
- AdapterInfo->PhyAddress,
- MdiControlReg
- );
-
- //
- // wait 100 milliseconds for auto-negotiation to complete
- //
- DelayIt (AdapterInfo, 100);
- }
-
- //
- // Find out specifically what Phy this is. We do this because for certain
- // phys there are specific bits that must be set so that the phy and the
- // 82557 work together properly.
- //
-
- MdiRead (
- AdapterInfo,
- PHY_ID_REG_1,
- AdapterInfo->PhyAddress,
- &MdiIdLowReg
- );
- MdiRead (
- AdapterInfo,
- PHY_ID_REG_2,
- AdapterInfo->PhyAddress,
- &MdiIdHighReg
- );
-
- PhyId = ((UINT32) MdiIdLowReg | ((UINT32) MdiIdHighReg << 16));
-
- //
- // And out the revsion field of the Phy ID so that we'll be able to detect
- // future revs of the same Phy.
- //
- PhyId &= PHY_MODEL_REV_ID_MASK;
-
- //
- // Handle the National TX
- //
- if (PhyId == PHY_NSC_TX) {
-
- MdiRead (
- AdapterInfo,
- NSC_CONG_CONTROL_REG,
- AdapterInfo->PhyAddress,
- &MdiMiscReg
- );
-
- MdiMiscReg |= (NSC_TX_CONG_TXREADY | NSC_TX_CONG_F_CONNECT);
-
- MdiWrite (
- AdapterInfo,
- NSC_CONG_CONTROL_REG,
- AdapterInfo->PhyAddress,
- MdiMiscReg
- );
- }
-
- FindPhySpeedAndDpx (AdapterInfo, PhyId);
-
- //
- // We put a hardware fix on to our adapters to work-around the PHY_100 errata
- // described below. The following code is only compiled in, if we wanted
- // to attempt a software workaround to the PHY_100 A/B step problem.
- //
-
- return (TRUE);
-}
-
-VOID
-FindPhySpeedAndDpx (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT32 PhyId
- )
-/*++
-
-Routine Description:
- This routine will figure out what line speed and duplex mode
- the PHY is currently using.
-
-Arguments:
- AdapterInfo - pointer to the structure that contains the NIC's context.
- PhyId - The ID of the PHY in question.
-
-Returns:
- NOTHING
---*/
-{
- UINT16 MdiStatusReg;
- UINT16 MdiMiscReg;
- UINT16 MdiOwnAdReg;
- UINT16 MdiLinkPartnerAdReg;
-
- //
- // If there was a speed and/or duplex override, then set our current
- // value accordingly
- //
- AdapterInfo->LinkSpeed = AdapterInfo->LinkSpeedReq;
- AdapterInfo->Duplex = (UINT8) ((AdapterInfo->DuplexReq & PXE_FORCE_FULL_DUPLEX) ?
- FULL_DUPLEX : HALF_DUPLEX);
-
- //
- // If speed and duplex were forced, then we know our current settings, so
- // we'll just return. Otherwise, we'll need to figure out what NWAY set
- // us to.
- //
- if (AdapterInfo->LinkSpeed && AdapterInfo->Duplex) {
- return ;
-
- }
- //
- // If we didn't have a valid link, then we'll assume that our current
- // speed is 10mb half-duplex.
- //
-
- //
- // Read the status register twice because of sticky bits
- //
- MdiRead (
- AdapterInfo,
- MDI_STATUS_REG,
- AdapterInfo->PhyAddress,
- &MdiStatusReg
- );
- MdiRead (
- AdapterInfo,
- MDI_STATUS_REG,
- AdapterInfo->PhyAddress,
- &MdiStatusReg
- );
-
- //
- // If there wasn't a valid link then use default speed & duplex
- //
- if (!(MdiStatusReg & MDI_SR_LINK_STATUS)) {
-
- AdapterInfo->LinkSpeed = 10;
- AdapterInfo->Duplex = HALF_DUPLEX;
- return ;
- }
-
- //
- // If this is an Intel PHY (a T4 PHY_100 or a TX PHY_TX), then read bits
- // 1 and 0 of extended register 0, to get the current speed and duplex
- // settings.
- //
- if ((PhyId == PHY_100_A) || (PhyId == PHY_100_C) || (PhyId == PHY_TX_ID)) {
- //
- // Read extended register 0
- //
- MdiRead (
- AdapterInfo,
- EXTENDED_REG_0,
- AdapterInfo->PhyAddress,
- &MdiMiscReg
- );
-
- //
- // Get current speed setting
- //
- if (MdiMiscReg & PHY_100_ER0_SPEED_INDIC) {
- AdapterInfo->LinkSpeed = 100;
- } else {
- AdapterInfo->LinkSpeed = 10;
- }
-
- //
- // Get current duplex setting -- if bit is set then FDX is enabled
- //
- if (MdiMiscReg & PHY_100_ER0_FDX_INDIC) {
- AdapterInfo->Duplex = FULL_DUPLEX;
- } else {
- AdapterInfo->Duplex = HALF_DUPLEX;
- }
-
- return ;
- }
- //
- // Read our link partner's advertisement register
- //
- MdiRead (
- AdapterInfo,
- AUTO_NEG_LINK_PARTNER_REG,
- AdapterInfo->PhyAddress,
- &MdiLinkPartnerAdReg
- );
-
- //
- // See if Auto-Negotiation was complete (bit 5, reg 1)
- //
- MdiRead (
- AdapterInfo,
- MDI_STATUS_REG,
- AdapterInfo->PhyAddress,
- &MdiStatusReg
- );
-
- //
- // If a True NWAY connection was made, then we can detect speed/duplex by
- // ANDing our adapter's advertised abilities with our link partner's
- // advertised ablilities, and then assuming that the highest common
- // denominator was chosed by NWAY.
- //
- if ((MdiLinkPartnerAdReg & NWAY_LP_ABILITY) &&
- (MdiStatusReg & MDI_SR_AUTO_NEG_COMPLETE)) {
-
- //
- // Read our advertisement register
- //
- MdiRead (
- AdapterInfo,
- AUTO_NEG_ADVERTISE_REG,
- AdapterInfo->PhyAddress,
- &MdiOwnAdReg
- );
-
- //
- // AND the two advertisement registers together, and get rid of any
- // extraneous bits.
- //
- MdiOwnAdReg = (UINT16) (MdiOwnAdReg & (MdiLinkPartnerAdReg & NWAY_LP_ABILITY));
-
- //
- // Get speed setting
- //
- if (MdiOwnAdReg & (NWAY_AD_TX_HALF_DPX | NWAY_AD_TX_FULL_DPX | NWAY_AD_T4_CAPABLE)) {
- AdapterInfo->LinkSpeed = 100;
- } else {
- AdapterInfo->LinkSpeed = 10;
- }
-
- //
- // Get duplex setting -- use priority resolution algorithm
- //
- if (MdiOwnAdReg & (NWAY_AD_T4_CAPABLE)) {
- AdapterInfo->Duplex = HALF_DUPLEX;
- return ;
- } else if (MdiOwnAdReg & (NWAY_AD_TX_FULL_DPX)) {
- AdapterInfo->Duplex = FULL_DUPLEX;
- return ;
- } else if (MdiOwnAdReg & (NWAY_AD_TX_HALF_DPX)) {
- AdapterInfo->Duplex = HALF_DUPLEX;
- return ;
- } else if (MdiOwnAdReg & (NWAY_AD_10T_FULL_DPX)) {
- AdapterInfo->Duplex = FULL_DUPLEX;
- return ;
- } else {
- AdapterInfo->Duplex = HALF_DUPLEX;
- return ;
- }
- }
-
- //
- // If we are connected to a dumb (non-NWAY) repeater or hub, and the line
- // speed was determined automatically by parallel detection, then we have
- // no way of knowing exactly what speed the PHY is set to unless that PHY
- // has a propietary register which indicates speed in this situation. The
- // NSC TX PHY does have such a register. Also, since NWAY didn't establish
- // the connection, the duplex setting should HALF duplex.
- //
- AdapterInfo->Duplex = HALF_DUPLEX;
-
- if (PhyId == PHY_NSC_TX) {
- //
- // Read register 25 to get the SPEED_10 bit
- //
- MdiRead (
- AdapterInfo,
- NSC_SPEED_IND_REG,
- AdapterInfo->PhyAddress,
- &MdiMiscReg
- );
-
- //
- // If bit 6 was set then we're at 10mb
- //
- if (MdiMiscReg & NSC_TX_SPD_INDC_SPEED) {
- AdapterInfo->LinkSpeed = 10;
- } else {
- AdapterInfo->LinkSpeed = 100;
- }
- }
-
- //
- // If we don't know what line speed we are set at, then we'll default to
- // 10mbs
- //
- else {
- AdapterInfo->LinkSpeed = 10;
- }
-}
-
-VOID
-XmitWaitForCompletion (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- TxCB *TxPtr;
-
- if (AdapterInfo->FreeCBCount == AdapterInfo->TxBufCnt) {
- return ;
- }
-
- //
- // used xmit cb list starts right after the free tail (ends before the
- // free head ptr)
- //
- TxPtr = AdapterInfo->FreeTxTailPtr->NextTCBVirtualLinkPtr;
- while (TxPtr != AdapterInfo->FreeTxHeadPtr) {
- CommandWaitForCompletion (TxPtr, AdapterInfo);
- SetFreeCB (AdapterInfo, TxPtr);
- TxPtr = TxPtr->NextTCBVirtualLinkPtr;
- }
-}
-
-INT8
-CommandWaitForCompletion (
- TxCB *cmd_ptr,
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- cmd_ptr - TODO: add argument description
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- INT16 wait;
- wait = 5000;
- while ((cmd_ptr->cb_header.status == 0) && (--wait > 0)) {
- DelayIt (AdapterInfo, 10);
- }
-
- if (cmd_ptr->cb_header.status == 0) {
- return -1;
- }
-
- return 0;
-}
-
-STATIC
-INT8
-SoftwareReset (
- NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UINT8 tco_stat;
- UINT16 wait;
-
- tco_stat = 0;
-
- //
- // Reset the chip: stop Tx and Rx processes and clear counters.
- // This takes less than 10usec and will easily finish before the next
- // action.
- //
-
- OutLong (AdapterInfo, PORT_RESET, AdapterInfo->ioaddr + SCBPort);
- //
- // wait for 5 milli seconds here!
- //
- DelayIt (AdapterInfo, 5000);
- //
- // TCO Errata work around for 559s only
- // -----------------------------------------------------------------------------------
- // TCO Workaround Code
- // haifa workaround
- // -----------------------------------------------------------------------------------
- // 1. Issue SW-RST ^^^ (already done above)
- // 2. Issue a redundant Set CU Base CMD immediately
- // Do not set the General Pointer before the Set CU Base cycle
- // Do not check the SCB CMD before the Set CU Base cycle
- // 3. Wait for the SCB-CMD to be cleared
- // this indicates the transition to post-driver
- // 4. Poll the TCO-Req bit in the PMDR to be cleared
- // this indicates the tco activity has stopped for real
- // 5. Proceed with the nominal Driver Init:
- // Actual Set CU & RU Base ...
- //
- // Check for ICH2 device ID. If this is an ICH2,
- // do the TCO workaround code.
- //
- if (AdapterInfo->VendorID == D102_DEVICE_ID ||
- AdapterInfo->VendorID == ICH3_DEVICE_ID_1 ||
- AdapterInfo->VendorID == ICH3_DEVICE_ID_2 ||
- AdapterInfo->VendorID == ICH3_DEVICE_ID_3 ||
- AdapterInfo->VendorID == ICH3_DEVICE_ID_4 ||
- AdapterInfo->VendorID == ICH3_DEVICE_ID_5 ||
- AdapterInfo->VendorID == ICH3_DEVICE_ID_6 ||
- AdapterInfo->VendorID == ICH3_DEVICE_ID_7 ||
- AdapterInfo->VendorID == ICH3_DEVICE_ID_8 ||
- AdapterInfo->RevID >= 8) { // do the TCO fix
- //
- // donot load the scb pointer but just give load_cu cmd.
- //
- OutByte (AdapterInfo, CU_CMD_BASE, AdapterInfo->ioaddr + SCBCmd);
- //
- // wait for command to be accepted.
- //
- wait_for_cmd_done (AdapterInfo->ioaddr + SCBCmd);
- //
- // read PMDR register and check bit 1 in it to see if TCO is active
- //
-
- //
- // wait for 5 milli seconds
- //
- wait = 5000;
- while (wait) {
- tco_stat = InByte (AdapterInfo, AdapterInfo->ioaddr + 0x1b);
- if ((tco_stat & 2) == 0) {
- //
- // is the activity bit clear??
- //
- break;
- }
-
- wait--;
- DelayIt (AdapterInfo, 1);
- }
-
- if ((tco_stat & 2) != 0) {
- //
- // not zero??
- //
- return -1;
- }
- }
-
- return 0;
-}
-
-UINT8
-SelectiveReset (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UINT16 wait;
- UINT32 stat;
-
- wait = 10;
- stat = 0;
- OutLong (AdapterInfo, POR_SELECTIVE_RESET, AdapterInfo->ioaddr + SCBPort);
- //
- // wait for this to complete
- //
-
- //
- // wait for 2 milli seconds here!
- //
- DelayIt (AdapterInfo, 2000);
- while (wait > 0) {
- wait--;
- stat = InLong (AdapterInfo, AdapterInfo->ioaddr + SCBPort);
- if (stat == 0) {
- break;
- }
-
- //
- // wait for 1 milli second
- //
- DelayIt (AdapterInfo, 1000);
- }
-
- if (stat != 0) {
- return PXE_STATCODE_DEVICE_FAILURE;
- }
-
- return 0;
-}
-
-UINT16
-InitializeChip (
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- AdapterInfo - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UINT16 ret_val;
- if (SoftwareReset (AdapterInfo) != 0) {
- return PXE_STATCODE_DEVICE_FAILURE;
- }
-
- //
- // disable interrupts
- //
- OutWord (AdapterInfo, INT_MASK, AdapterInfo->ioaddr + SCBCmd);
-
- //
- // Load the base registers with 0s (we will give the complete address as
- // offset later when we issue any command
- //
- if ((ret_val = Load_Base_Regs (AdapterInfo)) != 0) {
- return ret_val;
- }
-
- if ((ret_val = SetupCBlink (AdapterInfo)) != 0) {
- return ret_val;
- }
-
- if ((ret_val = SetupReceiveQueues (AdapterInfo)) != 0) {
- return ret_val;
- }
-
- //
- // detect the PHY only if we need to detect the cable as requested by the
- // initialize parameters
- //
- AdapterInfo->PhyAddress = 0xFF;
-
- if (AdapterInfo->CableDetect != 0) {
- if (!PhyDetect (AdapterInfo)) {
- return PXE_STATCODE_DEVICE_FAILURE;
- }
- }
-
- if ((ret_val = E100bSetupIAAddr (AdapterInfo)) != 0) {
- return ret_val;
- }
-
- if ((ret_val = Configure (AdapterInfo)) != 0) {
- return ret_val;
- }
-
- return 0;
-}
diff --git a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.h b/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.h
deleted file mode 100644
index e832cb2..0000000
--- a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/E100b.h
+++ /dev/null
@@ -1,668 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- E100B.H
-
-Abstract:
-
-
-Revision History
-
---*/
-// pci config offsets:
-
-#define RX_BUFFER_COUNT 32
-#define TX_BUFFER_COUNT 32
-
-#define PCI_VENDOR_ID_INTEL 0x8086
-#define PCI_DEVICE_ID_INTEL_82557 0x1229
-#define D100_VENDOR_ID 0x8086
-#define D100_DEVICE_ID 0x1229
-#define D102_DEVICE_ID 0x2449
-
-#define ICH3_DEVICE_ID_1 0x1031
-#define ICH3_DEVICE_ID_2 0x1032
-#define ICH3_DEVICE_ID_3 0x1033
-#define ICH3_DEVICE_ID_4 0x1034
-#define ICH3_DEVICE_ID_5 0x1035
-#define ICH3_DEVICE_ID_6 0x1036
-#define ICH3_DEVICE_ID_7 0x1037
-#define ICH3_DEVICE_ID_8 0x1038
-
-#define SPEEDO_DEVICE_ID 0x1227
-#define SPLASH1_DEVICE_ID 0x1226
-
-
-// bit fields for the command
-#define PCI_COMMAND_MASTER 0x04 // bit 2
-#define PCI_COMMAND_IO 0x01 // bit 0
-#define PCI_COMMAND 0x04
-#define PCI_LATENCY_TIMER 0x0D
-
-#define ETHER_MAC_ADDR_LEN 6
-#ifdef AVL_XXX
-#define ETHER_HEADER_LEN 14
-// media interface type
-// #define INTERFACE_TYPE "
-
-// Hardware type values
-#define HW_ETHER_TYPE 1
-#define HW_EXPERIMENTAL_ETHER_TYPE 2
-#define HW_IEEE_TYPE 6
-#define HW_ARCNET_TYPE 7
-
-#endif // AVL_XXX
-
-#define MAX_ETHERNET_PKT_SIZE 1514 // including eth header
-#define RX_BUFFER_SIZE 1536 // including crc and padding
-#define TX_BUFFER_SIZE 64
-#define ETH_MTU 1500 // does not include ethernet header length
-
-#define SPEEDO3_TOTAL_SIZE 0x20
-
-#pragma pack(1)
-
-typedef struct eth {
- UINT8 dest_addr[PXE_HWADDR_LEN_ETHER];
- UINT8 src_addr[PXE_HWADDR_LEN_ETHER];
- UINT16 type;
-} EtherHeader;
-
-#pragma pack(1)
-typedef struct CONFIG_HEADER {
- UINT16 VendorID;
- UINT16 DeviceID;
- UINT16 Command;
- UINT16 Status;
- UINT16 RevID;
- UINT16 ClassID;
- UINT8 CacheLineSize;
- UINT8 LatencyTimer;
- UINT8 HeaderType; // must be zero to impose this structure...
- UINT8 BIST; // built-in self test
- UINT32 BaseAddressReg_0; // memory mapped address
- UINT32 BaseAddressReg_1; //io mapped address, Base IO address
- UINT32 BaseAddressReg_2; // option rom address
- UINT32 BaseAddressReg_3;
- UINT32 BaseAddressReg_4;
- UINT32 BaseAddressReg_5;
- UINT32 CardBusCISPtr;
- UINT16 SubVendorID;
- UINT16 SubSystemID;
- UINT32 ExpansionROMBaseAddr;
- UINT8 CapabilitiesPtr;
- UINT8 reserved1;
- UINT16 Reserved2;
- UINT32 Reserved3;
- UINT8 int_line;
- UINT8 int_pin;
- UINT8 Min_gnt;
- UINT8 Max_lat;
-} PCI_CONFIG_HEADER;
-#pragma pack()
-
-//-------------------------------------------------------------------------
-// Offsets to the various registers.
-// All accesses need not be longword aligned.
-//-------------------------------------------------------------------------
-enum speedo_offsets {
- SCBStatus = 0, SCBCmd = 2, // Rx/Command Unit command and status.
- SCBPointer = 4, // General purpose pointer.
- SCBPort = 8, // Misc. commands and operands.
- SCBflash = 12, SCBeeprom = 14, // EEPROM and flash memory control.
- SCBCtrlMDI = 16, // MDI interface control.
- SCBEarlyRx = 20, // Early receive byte count.
- SCBEarlyRxInt = 24, SCBFlowCtrlReg = 25, SCBPmdr = 27,
- // offsets for general control registers (GCRs)
- SCBGenCtrl = 28, SCBGenStatus = 29, SCBGenCtrl2 = 30, SCBRsvd = 31
-};
-
-#define GCR2_EEPROM_ACCESS_SEMAPHORE 0x80 // bit offset into the gcr2
-
-//-------------------------------------------------------------------------
-// Action commands - Commands that can be put in a command list entry.
-//-------------------------------------------------------------------------
-enum commands {
- CmdNOp = 0, CmdIASetup = 1, CmdConfigure = 2, CmdMulticastList = 3,
- CmdTx = 4, CmdTDR = 5, CmdDump = 6, CmdDiagnose = 7,
- CmdSuspend = 0x4000, /* Suspend after completion. */
- CmdIntr = 0x2000, /* Interrupt after completion. */
- CmdTxFlex = 0x0008 /* Use "Flexible mode" for CmdTx command. */
-};
-
-//-------------------------------------------------------------------------
-// port commands
-//-------------------------------------------------------------------------
-#define PORT_RESET 0
-#define PORT_SELF_TEST 1
-#define POR_SELECTIVE_RESET 2
-#define PORT_DUMP_POINTER 2
-
-//-------------------------------------------------------------------------
-// SCB Command Word bit definitions
-//-------------------------------------------------------------------------
-//- CUC fields
-#define CU_START 0x0010
-#define CU_RESUME 0x0020
-#define CU_STATSADDR 0x0040
-#define CU_SHOWSTATS 0x0050 /* Dump statistics counters. */
-#define CU_CMD_BASE 0x0060 /* Base address to add to add CU commands. */
-#define CU_DUMPSTATS 0x0070 /* Dump then reset stats counters. */
-
-//- RUC fields
-#define RX_START 0x0001
-#define RX_RESUME 0x0002
-#define RX_ABORT 0x0004
-#define RX_ADDR_LOAD 0x0006 /* load ru_base_reg */
-#define RX_RESUMENR 0x0007
-
-// Interrupt fields (assuming byte addressing)
-#define INT_MASK 0x0100
-#define DRVR_INT 0x0200 /* Driver generated interrupt. */
-
-//- CB Status Word
-#define CMD_STATUS_COMPLETE 0x8000
-#define RX_STATUS_COMPLETE 0x8000
-#define CMD_STATUS_MASK 0xF000
-
-//-------------------------------------------------------------------------
-//- SCB Status bits:
-// Interrupts are ACKed by writing to the upper 6 interrupt bits
-//-------------------------------------------------------------------------
-#define SCB_STATUS_MASK 0xFC00 // bits 2-7 - STATUS/ACK Mask
-#define SCB_STATUS_CX_TNO 0x8000 // BIT_15 - CX or TNO Interrupt
-#define SCB_STATUS_FR 0x4000 // BIT_14 - FR Interrupt
-#define SCB_STATUS_CNA 0x2000 // BIT_13 - CNA Interrupt
-#define SCB_STATUS_RNR 0x1000 // BIT_12 - RNR Interrupt
-#define SCB_STATUS_MDI 0x0800 // BIT_11 - MDI R/W Done Interrupt
-#define SCB_STATUS_SWI 0x0400 // BIT_10 - SWI Interrupt
-
-// CU STATUS: bits 6 & 7
-#define SCB_STATUS_CU_MASK 0x00C0 // bits 6 & 7
-#define SCB_STATUS_CU_IDLE 0x0000 // 00
-#define SCB_STATUS_CU_SUSPEND 0x0040 // 01
-#define SCB_STATUS_CU_ACTIVE 0x0080 // 10
-
-// RU STATUS: bits 2-5
-#define SCB_RUS_IDLE 0x0000
-#define SCB_RUS_SUSPENDED 0x0004 // bit 2
-#define SCB_RUS_NO_RESOURCES 0x0008 // bit 3
-#define SCB_RUS_READY 0x0010 // bit 4
-
-//-------------------------------------------------------------------------
-// Bit Mask definitions
-//-------------------------------------------------------------------------
-#define BIT_0 0x0001
-#define BIT_1 0x0002
-#define BIT_2 0x0004
-#define BIT_3 0x0008
-#define BIT_4 0x0010
-#define BIT_5 0x0020
-#define BIT_6 0x0040
-#define BIT_7 0x0080
-#define BIT_8 0x0100
-#define BIT_9 0x0200
-#define BIT_10 0x0400
-#define BIT_11 0x0800
-#define BIT_12 0x1000
-#define BIT_13 0x2000
-#define BIT_14 0x4000
-#define BIT_15 0x8000
-#define BIT_24 0x01000000
-#define BIT_28 0x10000000
-
-
-//-------------------------------------------------------------------------
-// MDI Control register bit definitions
-//-------------------------------------------------------------------------
-#define MDI_DATA_MASK BIT_0_15 // MDI Data port
-#define MDI_REG_ADDR BIT_16_20 // which MDI register to read/write
-#define MDI_PHY_ADDR BIT_21_25 // which PHY to read/write
-#define MDI_PHY_OPCODE BIT_26_27 // which PHY to read/write
-#define MDI_PHY_READY BIT_28 // PHY is ready for another MDI cycle
-#define MDI_PHY_INT_ENABLE BIT_29 // Assert INT at MDI cycle completion
-
-#define BIT_0_2 0x0007
-#define BIT_0_3 0x000F
-#define BIT_0_4 0x001F
-#define BIT_0_5 0x003F
-#define BIT_0_6 0x007F
-#define BIT_0_7 0x00FF
-#define BIT_0_8 0x01FF
-#define BIT_0_13 0x3FFF
-#define BIT_0_15 0xFFFF
-#define BIT_1_2 0x0006
-#define BIT_1_3 0x000E
-#define BIT_2_5 0x003C
-#define BIT_3_4 0x0018
-#define BIT_4_5 0x0030
-#define BIT_4_6 0x0070
-#define BIT_4_7 0x00F0
-#define BIT_5_7 0x00E0
-#define BIT_5_9 0x03E0
-#define BIT_5_12 0x1FE0
-#define BIT_5_15 0xFFE0
-#define BIT_6_7 0x00c0
-#define BIT_7_11 0x0F80
-#define BIT_8_10 0x0700
-#define BIT_9_13 0x3E00
-#define BIT_12_15 0xF000
-
-#define BIT_16_20 0x001F0000
-#define BIT_21_25 0x03E00000
-#define BIT_26_27 0x0C000000
-
-//-------------------------------------------------------------------------
-// MDI Control register opcode definitions
-//-------------------------------------------------------------------------
-#define MDI_WRITE 1 // Phy Write
-#define MDI_READ 2 // Phy read
-
-//-------------------------------------------------------------------------
-// PHY 100 MDI Register/Bit Definitions
-//-------------------------------------------------------------------------
-// MDI register set
-#define MDI_CONTROL_REG 0x00 // MDI control register
-#define MDI_STATUS_REG 0x01 // MDI Status regiser
-#define PHY_ID_REG_1 0x02 // Phy indentification reg (word 1)
-#define PHY_ID_REG_2 0x03 // Phy indentification reg (word 2)
-#define AUTO_NEG_ADVERTISE_REG 0x04 // Auto-negotiation advertisement
-#define AUTO_NEG_LINK_PARTNER_REG 0x05 // Auto-negotiation link partner ability
-#define AUTO_NEG_EXPANSION_REG 0x06 // Auto-negotiation expansion
-#define AUTO_NEG_NEXT_PAGE_REG 0x07 // Auto-negotiation next page transmit
-#define EXTENDED_REG_0 0x10 // Extended reg 0 (Phy 100 modes)
-#define EXTENDED_REG_1 0x14 // Extended reg 1 (Phy 100 error indications)
-#define NSC_CONG_CONTROL_REG 0x17 // National (TX) congestion control
-#define NSC_SPEED_IND_REG 0x19 // National (TX) speed indication
-
-// MDI Control register bit definitions
-#define MDI_CR_COLL_TEST_ENABLE BIT_7 // Collision test enable
-#define MDI_CR_FULL_HALF BIT_8 // FDX =1, half duplex =0
-#define MDI_CR_RESTART_AUTO_NEG BIT_9 // Restart auto negotiation
-#define MDI_CR_ISOLATE BIT_10 // Isolate PHY from MII
-#define MDI_CR_POWER_DOWN BIT_11 // Power down
-#define MDI_CR_AUTO_SELECT BIT_12 // Auto speed select enable
-#define MDI_CR_10_100 BIT_13 // 0 = 10Mbs, 1 = 100Mbs
-#define MDI_CR_LOOPBACK BIT_14 // 0 = normal, 1 = loopback
-#define MDI_CR_RESET BIT_15 // 0 = normal, 1 = PHY reset
-
-// MDI Status register bit definitions
-#define MDI_SR_EXT_REG_CAPABLE BIT_0 // Extended register capabilities
-#define MDI_SR_JABBER_DETECT BIT_1 // Jabber detected
-#define MDI_SR_LINK_STATUS BIT_2 // Link Status -- 1 = link
-#define MDI_SR_AUTO_SELECT_CAPABLE BIT_3 // Auto speed select capable
-#define MDI_SR_REMOTE_FAULT_DETECT BIT_4 // Remote fault detect
-#define MDI_SR_AUTO_NEG_COMPLETE BIT_5 // Auto negotiation complete
-#define MDI_SR_10T_HALF_DPX BIT_11 // 10BaseT Half Duplex capable
-#define MDI_SR_10T_FULL_DPX BIT_12 // 10BaseT full duplex capable
-#define MDI_SR_TX_HALF_DPX BIT_13 // TX Half Duplex capable
-#define MDI_SR_TX_FULL_DPX BIT_14 // TX full duplex capable
-#define MDI_SR_T4_CAPABLE BIT_15 // T4 capable
-
-// Auto-Negotiation advertisement register bit definitions
-#define NWAY_AD_SELCTOR_FIELD BIT_0_4 // identifies supported protocol
-#define NWAY_AD_ABILITY BIT_5_12 // technologies that are supported
-#define NWAY_AD_10T_HALF_DPX BIT_5 // 10BaseT Half Duplex capable
-#define NWAY_AD_10T_FULL_DPX BIT_6 // 10BaseT full duplex capable
-#define NWAY_AD_TX_HALF_DPX BIT_7 // TX Half Duplex capable
-#define NWAY_AD_TX_FULL_DPX BIT_8 // TX full duplex capable
-#define NWAY_AD_T4_CAPABLE BIT_9 // T4 capable
-#define NWAY_AD_REMOTE_FAULT BIT_13 // indicates local remote fault
-#define NWAY_AD_RESERVED BIT_14 // reserved
-#define NWAY_AD_NEXT_PAGE BIT_15 // Next page (not supported)
-
-// Auto-Negotiation link partner ability register bit definitions
-#define NWAY_LP_SELCTOR_FIELD BIT_0_4 // identifies supported protocol
-#define NWAY_LP_ABILITY BIT_5_9 // technologies that are supported
-#define NWAY_LP_REMOTE_FAULT BIT_13 // indicates partner remote fault
-#define NWAY_LP_ACKNOWLEDGE BIT_14 // acknowledge
-#define NWAY_LP_NEXT_PAGE BIT_15 // Next page (not supported)
-
-// Auto-Negotiation expansion register bit definitions
-#define NWAY_EX_LP_NWAY BIT_0 // link partner is NWAY
-#define NWAY_EX_PAGE_RECEIVED BIT_1 // link code word received
-#define NWAY_EX_NEXT_PAGE_ABLE BIT_2 // local is next page able
-#define NWAY_EX_LP_NEXT_PAGE_ABLE BIT_3 // partner is next page able
-#define NWAY_EX_PARALLEL_DET_FLT BIT_4 // parallel detection fault
-#define NWAY_EX_RESERVED BIT_5_15 // reserved
-
-
-// PHY 100 Extended Register 0 bit definitions
-#define PHY_100_ER0_FDX_INDIC BIT_0 // 1 = FDX, 0 = half duplex
-#define PHY_100_ER0_SPEED_INDIC BIT_1 // 1 = 100mbs, 0= 10mbs
-#define PHY_100_ER0_WAKE_UP BIT_2 // Wake up DAC
-#define PHY_100_ER0_RESERVED BIT_3_4 // Reserved
-#define PHY_100_ER0_REV_CNTRL BIT_5_7 // Revsion control (A step = 000)
-#define PHY_100_ER0_FORCE_FAIL BIT_8 // Force Fail is enabled
-#define PHY_100_ER0_TEST BIT_9_13 // Revsion control (A step = 000)
-#define PHY_100_ER0_LINKDIS BIT_14 // Link integrity test is disabled
-#define PHY_100_ER0_JABDIS BIT_15 // Jabber function is disabled
-
-
-// PHY 100 Extended Register 1 bit definitions
-#define PHY_100_ER1_RESERVED BIT_0_8 // Reserved
-#define PHY_100_ER1_CH2_DET_ERR BIT_9 // Channel 2 EOF detection error
-#define PHY_100_ER1_MANCH_CODE_ERR BIT_10 // Manchester code error
-#define PHY_100_ER1_EOP_ERR BIT_11 // EOP error
-#define PHY_100_ER1_BAD_CODE_ERR BIT_12 // bad code error
-#define PHY_100_ER1_INV_CODE_ERR BIT_13 // invalid code error
-#define PHY_100_ER1_DC_BAL_ERR BIT_14 // DC balance error
-#define PHY_100_ER1_PAIR_SKEW_ERR BIT_15 // Pair skew error
-
-// National Semiconductor TX phy congestion control register bit definitions
-#define NSC_TX_CONG_TXREADY BIT_10 // Makes TxReady an input
-#define NSC_TX_CONG_ENABLE BIT_8 // Enables congestion control
-#define NSC_TX_CONG_F_CONNECT BIT_5 // Enables congestion control
-
-// National Semiconductor TX phy speed indication register bit definitions
-#define NSC_TX_SPD_INDC_SPEED BIT_6 // 0 = 100mb, 1=10mb
-
-//-------------------------------------------------------------------------
-// Phy related constants
-//-------------------------------------------------------------------------
-#define PHY_503 0
-#define PHY_100_A 0x000003E0
-#define PHY_100_C 0x035002A8
-#define PHY_TX_ID 0x015002A8
-#define PHY_NSC_TX 0x5c002000
-#define PHY_OTHER 0xFFFF
-
-#define PHY_MODEL_REV_ID_MASK 0xFFF0FFFF
-#define PARALLEL_DETECT 0
-#define N_WAY 1
-
-#define RENEGOTIATE_TIME 35 // (3.5 Seconds)
-
-#define CONNECTOR_AUTO 0
-#define CONNECTOR_TPE 1
-#define CONNECTOR_MII 2
-
-//-------------------------------------------------------------------------
-
-/* The Speedo3 Rx and Tx frame/buffer descriptors. */
-#pragma pack(1)
-struct CB_Header { /* A generic descriptor. */
- UINT16 status; /* Offset 0. */
- UINT16 command; /* Offset 2. */
- UINT32 link; /* struct descriptor * */
-};
-
-/* transmit command block structure */
-#pragma pack(1)
-typedef struct s_TxCB {
- struct CB_Header cb_header;
- UINT32 PhysTBDArrayAddres; /* address of an array that contains
- physical TBD pointers */
- UINT16 ByteCount; /* immediate data count = 0 always */
- UINT8 Threshold;
- UINT8 TBDCount;
- UINT8 ImmediateData[TX_BUFFER_SIZE];
- /* following fields are not seen by the 82557 */
- struct TBD {
- UINT32 phys_buf_addr;
- UINT32 buf_len;
- } TBDArray[MAX_XMIT_FRAGMENTS];
- UINT32 PhysArrayAddr; /* in case the one in the header is lost */
- UINT32 PhysTCBAddress; /* for this TCB */
- struct s_TxCB *NextTCBVirtualLinkPtr;
- struct s_TxCB *PrevTCBVirtualLinkPtr;
- UINT64 free_data_ptr; // to be given to the upper layer when this xmit completes1
-}TxCB;
-
-/* The Speedo3 Rx and Tx buffer descriptors. */
-#pragma pack(1)
-typedef struct s_RxFD { /* Receive frame descriptor. */
- struct CB_Header cb_header;
- UINT32 rx_buf_addr; /* VOID * */
- UINT16 ActualCount;
- UINT16 RFDSize;
- UINT8 RFDBuffer[RX_BUFFER_SIZE];
- UINT8 forwarded;
- UINT8 junk[3];
-}RxFD;
-
-/* Elements of the RxFD.status word. */
-#define RX_COMPLETE 0x8000
-#define RX_FRAME_OK 0x2000
-
-/* Elements of the dump_statistics block. This block must be lword aligned. */
-#pragma pack(1)
-struct speedo_stats {
- UINT32 tx_good_frames;
- UINT32 tx_coll16_errs;
- UINT32 tx_late_colls;
- UINT32 tx_underruns;
- UINT32 tx_lost_carrier;
- UINT32 tx_deferred;
- UINT32 tx_one_colls;
- UINT32 tx_multi_colls;
- UINT32 tx_total_colls;
- UINT32 rx_good_frames;
- UINT32 rx_crc_errs;
- UINT32 rx_align_errs;
- UINT32 rx_resource_errs;
- UINT32 rx_overrun_errs;
- UINT32 rx_colls_errs;
- UINT32 rx_runt_errs;
- UINT32 done_marker;
-};
-#pragma pack()
-
-
-struct Krn_Mem{
- RxFD rx_ring[RX_BUFFER_COUNT];
- TxCB tx_ring[TX_BUFFER_COUNT];
- struct speedo_stats statistics;
-};
-#define MEMORY_NEEDED sizeof(struct Krn_Mem)
-
-/* The parameters for a CmdConfigure operation.
- There are so many options that it would be difficult to document each bit.
- We mostly use the default or recommended settings.
-*/
-
-/*
- *--------------------------------------------------------------------------
- * Configuration CB Parameter Bit Definitions
- *--------------------------------------------------------------------------
- */
-// - Byte 0 (Default Value = 16h)
-#define CFIG_BYTE_COUNT 0x16 // 22 Configuration Bytes
-
-//- Byte 1 (Default Value = 88h)
-#define CFIG_TXRX_FIFO_LIMIT 0x88
-
-//- Byte 2 (Default Value = 0)
-#define CFIG_ADAPTIVE_IFS 0
-
-//- Byte 3 (Default Value = 0, ALWAYS. This byte is RESERVED)
-#define CFIG_RESERVED 0
-
-//- Byte 4 (Default Value = 0. Default implies that Rx DMA cannot be
-//- preempted).
-#define CFIG_RXDMA_BYTE_COUNT 0
-
-//- Byte 5 (Default Value = 80h. Default implies that Tx DMA cannot be
-//- preempted. However, setting these counters is enabled.)
-#define CFIG_DMBC_ENABLE 0x80
-
-//- Byte 6 (Default Value = 33h. Late SCB enabled, No TNO interrupts,
-//- CNA interrupts and do not save bad frames.)
-#define CFIG_LATE_SCB 1 // BIT 0
-#define CFIG_TNO_INTERRUPT 0x4 // BIT 2
-#define CFIG_CI_INTERRUPT 0x8 // BIT 3
-#define CFIG_SAVE_BAD_FRAMES 0x80 // BIT_7
-
-//- Byte 7 (Default Value = 7h. Discard short frames automatically and
-//- attempt upto 3 retries on transmit.)
-#define CFIG_DISCARD_SHORTRX 0x00001
-#define CFIG_URUN_RETRY BIT_1 OR BIT_2
-
-//- Byte 8 (Default Value = 1. Enable MII mode.)
-#define CFIG_503_MII BIT_0
-
-//- Byte 9 (Default Value = 0, ALWAYS)
-
-//- Byte 10 (Default Value = 2Eh)
-#define CFIG_NSAI BIT_3
-#define CFIG_PREAMBLE_LENGTH BIT_5 ;- Bit 5-4 = 1-0
-#define CFIG_NO_LOOPBACK 0
-#define CFIG_INTERNAL_LOOPBACK BIT_6
-#define CFIG_EXT_LOOPBACK BIT_7
-#define CFIG_EXT_PIN_LOOPBACK BIT_6 OR BIT_7
-
-//- Byte 11 (Default Value = 0)
-#define CFIG_LINEAR_PRIORITY 0
-
-//- Byte 12 (Default Value = 60h)
-#define CFIG_LPRIORITY_MODE 0
-#define CFIG_IFS 6 ;- 6 * 16 = 96
-
-//- Byte 13 (Default Value = 0, ALWAYS)
-
-//- Byte 14 (Default Value = 0F2h, ALWAYS)
-
-//- Byte 15 (Default Value = E8h)
-#define CFIG_PROMISCUOUS_MODE BIT_0
-#define CFIG_BROADCAST_DISABLE BIT_1
-#define CFIG_CRS_CDT BIT_7
-
-//- Byte 16 (Default Value = 0, ALWAYS)
-
-//- Byte 17 (Default Value = 40h, ALWAYS)
-
-//- Byte 18 (Default Value = F2h)
-#define CFIG_STRIPPING BIT_0
-#define CFIG_PADDING BIT_1
-#define CFIG_RX_CRC_TRANSFER BIT_2
-
-//- Byte 19 (Default Value = 80h)
-#define CFIG_FORCE_FDX BIT_6
-#define CFIG_FDX_PIN_ENABLE BIT_7
-
-//- Byte 20 (Default Value = 3Fh)
-#define CFIG_MULTI_IA BIT_6
-
-//- Byte 21 (Default Value = 05)
-#define CFIG_MC_ALL BIT_3
-
-/*-----------------------------------------------------------------------*/
-#define D102_REVID 0x0b
-
-#define HALF_DUPLEX 1
-#define FULL_DUPLEX 2
-
-typedef struct s_data_instance {
-
- UINT16 State; // stopped, started or initialized
- UINT16 Bus;
- UINT8 Device;
- UINT8 Function;
- UINT16 VendorID;
- UINT16 DeviceID;
- UINT16 RevID;
- UINT16 SubVendorID;
- UINT16 SubSystemID;
-
- UINT8 PermNodeAddress[PXE_MAC_LENGTH];
- UINT8 CurrentNodeAddress[PXE_MAC_LENGTH];
- UINT8 BroadcastNodeAddress[PXE_MAC_LENGTH];
- UINT32 Config[MAX_PCI_CONFIG_LEN];
- UINT32 NVData[MAX_EEPROM_LEN];
-
- UINT32 ioaddr;
- UINT32 flash_addr;
-
- UINT16 LinkSpeed; // actual link speed setting
- UINT16 LinkSpeedReq; // requested (forced) link speed
- UINT8 DuplexReq; // requested duplex
- UINT8 Duplex; // Duplex set
- UINT8 CableDetect; // 1 to detect and 0 not to detect the cable
- UINT8 LoopBack;
-
- UINT16 TxBufCnt;
- UINT16 TxBufSize;
- UINT16 RxBufCnt;
- UINT16 RxBufSize;
- UINT32 RxTotals;
- UINT32 TxTotals;
-
- UINT16 int_mask;
- UINT16 Int_Status;
- UINT16 PhyRecord[2]; // primary and secondary PHY record registers from eeprom
- UINT8 PhyAddress;
- UINT8 int_num;
- UINT16 NVData_Len;
- UINT32 MemoryLength;
-
- RxFD *rx_ring; // array of rx buffers
- TxCB *tx_ring; // array of tx buffers
- struct speedo_stats *statistics;
- TxCB *FreeTxHeadPtr;
- TxCB *FreeTxTailPtr;
- RxFD *RFDTailPtr;
-
- UINT64 rx_phy_addr; // physical addresses
- UINT64 tx_phy_addr;
- UINT64 stat_phy_addr;
- UINT64 MemoryPtr;
- UINT64 Mapped_MemoryPtr;
-
- UINT64 xmit_done[TX_BUFFER_COUNT << 1]; // circular buffer
- UINT16 xmit_done_head; // index into the xmit_done array
- UINT16 xmit_done_tail; // where are we filling now (index into xmit_done)
- UINT16 cur_rx_ind; // current RX Q head index
- UINT16 FreeCBCount;
-
- BOOLEAN in_interrupt;
- BOOLEAN in_transmit;
- BOOLEAN Receive_Started;
- UINT8 Rx_Filter;
- UINT8 VersionFlag; // UNDI30 or UNDI31??
- UINT8 rsvd[3];
-
- struct mc{
- UINT16 reserved [3]; // padding for this structure to make it 8 byte aligned
- UINT16 list_len;
- UINT8 mc_list[MAX_MCAST_ADDRESS_CNT][PXE_MAC_LENGTH]; // 8*32 is the size
- } mcast_list;
-
- UINT64 Unique_ID;
-
- EFI_PCI_IO_PROTOCOL *Io_Function;
-
- VOID (*Delay_30)(UINTN); // call back routine
- VOID (*Virt2Phys_30)(UINT64 virtual_addr, UINT64 physical_ptr); // call back routine
- VOID (*Block_30)(UINT32 enable); // call back routine
- VOID (*Mem_Io_30)(UINT8 read_write, UINT8 len, UINT64 port, UINT64 buf_addr);
- VOID (*Delay)(UINT64, UINTN); // call back routine
- VOID (*Virt2Phys)(UINT64 unq_id, UINT64 virtual_addr, UINT64 physical_ptr); // call back routine
- VOID (*Block)(UINT64 unq_id, UINT32 enable); // call back routine
- VOID (*Mem_Io)(UINT64 unq_id, UINT8 read_write, UINT8 len, UINT64 port,
- UINT64 buf_addr);
- VOID (*Map_Mem)(UINT64 unq_id, UINT64 virtual_addr, UINT32 size,
- UINT32 Direction, UINT64 mapped_addr);
- VOID (*UnMap_Mem)(UINT64 unq_id, UINT64 virtual_addr, UINT32 size,
- UINT32 Direction, UINT64 mapped_addr);
- VOID (*Sync_Mem)(UINT64 unq_id, UINT64 virtual_addr,
- UINT32 size, UINT32 Direction, UINT64 mapped_addr);
-} NIC_DATA_INSTANCE;
-
-#pragma pack(1)
-struct MC_CB_STRUCT{
- UINT16 count;
- UINT8 m_list[MAX_MCAST_ADDRESS_CNT][ETHER_MAC_ADDR_LEN];
-};
-#pragma pack()
-
-#define FOUR_GIGABYTE (UINT64)0x100000000ULL
diff --git a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Init.c b/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Init.c
deleted file mode 100644
index a32c62a..0000000
--- a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Init.c
+++ /dev/null
@@ -1,1088 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- init.c
-
-Abstract:
-
- Initialization functions for EFI UNDI32 driver
-
-Revision History
-
---*/
-
-#include "Undi32.h"
-
-//
-// Global Variables
-//
-PXE_SW_UNDI *pxe = 0; // 3.0 entry point
-PXE_SW_UNDI *pxe_31 = 0; // 3.1 entry
-UNDI32_DEV *UNDI32DeviceList[MAX_NIC_INTERFACES];
-
-NII_TABLE *UnidiDataPointer=NULL;
-
-VOID
-EFIAPI
-UndiNotifyVirtual (
- EFI_EVENT Event,
- VOID *Context
- )
-/*++
-
-Routine Description:
-
- When address mapping changes to virtual this should make the appropriate
- address conversions.
-
-Arguments:
-
- (Standard Event handler)
-
-Returns:
-
- None
-
---*/
-// TODO: Context - add argument and description to function comment
-{
- UINT16 Index;
- VOID *Pxe31Pointer;
-
- if (pxe_31 != NULL) {
- Pxe31Pointer = (VOID *) pxe_31;
-
- EfiConvertPointer (
- EFI_OPTIONAL_POINTER,
- (VOID **) &Pxe31Pointer
- );
-
- //
- // UNDI32DeviceList is an array of pointers
- //
- for (Index = 0; Index < pxe_31->IFcnt; Index++) {
- UNDI32DeviceList[Index]->NIIProtocol_31.ID = (UINT64) (UINTN) Pxe31Pointer;
- EfiConvertPointer (
- EFI_OPTIONAL_POINTER,
- (VOID **) &(UNDI32DeviceList[Index])
- );
- }
-
- EfiConvertPointer (
- EFI_OPTIONAL_POINTER,
- (VOID **) &(pxe_31->EntryPoint)
- );
- pxe_31 = Pxe31Pointer;
- }
-
- for (Index = 0; Index <= PXE_OPCODE_LAST_VALID; Index++) {
- EfiConvertPointer (
- EFI_OPTIONAL_POINTER,
- (VOID **) &api_table[Index].api_ptr
- );
- }
-}
-
-VOID
-EFIAPI
-UndiNotifyExitBs (
- EFI_EVENT Event,
- VOID *Context
- )
-/*++
-
-Routine Description:
-
- When EFI is shuting down the boot services, we need to install a
- configuration table for UNDI to work at runtime!
-
-Arguments:
-
- (Standard Event handler)
-
-Returns:
-
- None
-
---*/
-// TODO: Context - add argument and description to function comment
-{
- InstallConfigTable ();
-}
-//
-// UNDI Class Driver Global Variables
-//
-EFI_DRIVER_BINDING_PROTOCOL gUndiDriverBinding = {
- UndiDriverSupported,
- UndiDriverStart,
- UndiDriverStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-InitializeUNDIDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Register Driver Binding protocol for this driver.
-
-Arguments:
-
- ImageHandle - Image Handle
-
- SystemTable - Pointer to system table
-
-Returns:
-
- EFI_SUCCESS - Driver loaded.
-
- other - Driver not loaded.
-
---*/
-{
- EFI_STATUS Status;
- EFI_EVENT Event;
-
- Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_NOTIFY,
- UndiNotifyExitBs,
- NULL,
- &Event
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UndiDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- than contains a DevicePath, PciIo protocol, Class code of 2, Vendor ID of 0x8086,
- and DeviceId of (D100_DEVICE_ID || D102_DEVICE_ID || ICH3_DEVICE_ID_1 ||
- ICH3_DEVICE_ID_2 || ICH3_DEVICE_ID_3 || ICH3_DEVICE_ID_4 || ICH3_DEVICE_ID_5 ||
- ICH3_DEVICE_ID_6 || ICH3_DEVICE_ID_7 || ICH3_DEVICE_ID_8) can be supported.
-
-Arguments:
-
- This - Protocol instance pointer.
-
- Controller - Handle of device to test.
-
- RemainingDevicePath - Not used.
-
-Returns:
-
- EFI_SUCCESS - This driver supports this device.
-
- other - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE00 Pci;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- NULL,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = PciIo->Pci.Read (
- PciIo,
- EfiPciIoWidthUint8,
- 0,
- sizeof (PCI_CONFIG_HEADER),
- &Pci
- );
-
- if (!EFI_ERROR (Status)) {
- Status = EFI_UNSUPPORTED;
-
- if (Pci.Hdr.ClassCode[2] == 0x02 && Pci.Hdr.VendorId == PCI_VENDOR_ID_INTEL) {
- switch (Pci.Hdr.DeviceId) {
- case D100_DEVICE_ID:
- case D102_DEVICE_ID:
- case ICH3_DEVICE_ID_1:
- case ICH3_DEVICE_ID_2:
- case ICH3_DEVICE_ID_3:
- case ICH3_DEVICE_ID_4:
- case ICH3_DEVICE_ID_5:
- case ICH3_DEVICE_ID_6:
- case ICH3_DEVICE_ID_7:
- case ICH3_DEVICE_ID_8:
- case 0x1039:
- case 0x103A:
- case 0x103B:
- case 0x103C:
- case 0x103D:
- case 0x103E:
- case 0x1050:
- case 0x1051:
- case 0x1052:
- case 0x1053:
- case 0x1054:
- case 0x1055:
- case 0x1056:
- case 0x1057:
- case 0x1059:
- case 0x1064:
- Status = EFI_SUCCESS;
- }
- }
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UndiDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
- Start this driver on Controller by opening PciIo and DevicePath protocol.
- Initialize PXE structures, create a copy of the Controller Device Path with the
- NIC's MAC address appended to it, install the NetworkInterfaceIdentifier protocol
- on the newly created Device Path.
-
-Arguments:
-
- This - Protocol instance pointer.
-
- Controller - Handle of device to work with.
-
- RemainingDevicePath - Not used, always produce all possible children.
-
-Returns:
-
- EFI_SUCCESS - This driver is added to Controller.
-
- other - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *UndiDevicePath;
- PCI_CONFIG_HEADER *CfgHdr;
- UNDI32_DEV *UNDI32Device;
- UINT16 NewCommand;
- UINT8 *TmpPxePointer;
- EFI_PCI_IO_PROTOCOL *PciIoFncs;
- UINTN Len;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIoFncs,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &UndiDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
- }
-
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- sizeof (UNDI32_DEV),
- (VOID **) &UNDI32Device
- );
-
- if (EFI_ERROR (Status)) {
- goto UndiError;
- }
-
- ZeroMem ((CHAR8 *) UNDI32Device, sizeof (UNDI32_DEV));
-
- //
- // allocate and initialize both (old and new) the !pxe structures here,
- // there should only be one copy of each of these structure for any number
- // of NICs this undi supports. Also, these structures need to be on a
- // paragraph boundary as per the spec. so, while allocating space for these,
- // make sure that there is space for 2 !pxe structures (old and new) and a
- // 32 bytes padding for alignment adjustment (in case)
- //
- TmpPxePointer = NULL;
- if (pxe_31 == NULL) {
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- (sizeof (PXE_SW_UNDI) + sizeof (PXE_SW_UNDI) + 32),
- (VOID **) &TmpPxePointer
- );
-
- if (EFI_ERROR (Status)) {
- goto UndiErrorDeleteDevice;
- }
-
- ZeroMem (
- TmpPxePointer,
- sizeof (PXE_SW_UNDI) + sizeof (PXE_SW_UNDI) + 32
- );
- //
- // check for paragraph alignment here, assuming that the pointer is
- // already 8 byte aligned.
- //
- if (((UINTN) TmpPxePointer & 0x0F) != 0) {
- pxe_31 = (PXE_SW_UNDI *) ((UINTN) (TmpPxePointer + 8));
- } else {
- pxe_31 = (PXE_SW_UNDI *) TmpPxePointer;
- }
- //
- // assuming that the sizeof pxe_31 is a 16 byte multiple
- //
- pxe = (PXE_SW_UNDI *) ((CHAR8 *) (pxe_31) + sizeof (PXE_SW_UNDI));
-
- PxeStructInit (pxe, 0x30);
- PxeStructInit (pxe_31, 0x31);
- }
-
- UNDI32Device->NIIProtocol.ID = (UINT64) (UINTN) (pxe);
- UNDI32Device->NIIProtocol_31.ID = (UINT64) (UINTN) (pxe_31);
-
- Status = PciIoFncs->Attributes (
- PciIoFncs,
- EfiPciIoAttributeOperationEnable,
- EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER,
- NULL
- );
- //
- // Read all the registers from device's PCI Configuration space
- //
- Status = PciIoFncs->Pci.Read (
- PciIoFncs,
- EfiPciIoWidthUint32,
- 0,
- MAX_PCI_CONFIG_LEN,
- &UNDI32Device->NicInfo.Config
- );
-
- CfgHdr = (PCI_CONFIG_HEADER *) &(UNDI32Device->NicInfo.Config[0]);
-
- //
- // make sure that this device is a PCI bus master
- //
-
- NewCommand = (UINT16) (CfgHdr->Command | PCI_COMMAND_MASTER | PCI_COMMAND_IO);
- if (CfgHdr->Command != NewCommand) {
- PciIoFncs->Pci.Write (
- PciIoFncs,
- EfiPciIoWidthUint16,
- PCI_COMMAND,
- 1,
- &NewCommand
- );
- CfgHdr->Command = NewCommand;
- }
-
- //
- // make sure that the latency timer is at least 32
- //
- if (CfgHdr->LatencyTimer < 32) {
- CfgHdr->LatencyTimer = 32;
- PciIoFncs->Pci.Write (
- PciIoFncs,
- EfiPciIoWidthUint8,
- PCI_LATENCY_TIMER,
- 1,
- &CfgHdr->LatencyTimer
- );
- }
- //
- // the IfNum index for the current interface will be the total number
- // of interfaces initialized so far
- //
- UNDI32Device->NIIProtocol.IfNum = pxe->IFcnt;
- UNDI32Device->NIIProtocol_31.IfNum = pxe_31->IFcnt;
-
- PxeUpdate (&UNDI32Device->NicInfo, pxe);
- PxeUpdate (&UNDI32Device->NicInfo, pxe_31);
-
- UNDI32Device->NicInfo.Io_Function = PciIoFncs;
- UNDI32DeviceList[UNDI32Device->NIIProtocol.IfNum] = UNDI32Device;
- UNDI32Device->Undi32BaseDevPath = UndiDevicePath;
-
- Status = AppendMac2DevPath (
- &UNDI32Device->Undi32DevPath,
- UNDI32Device->Undi32BaseDevPath,
- &UNDI32Device->NicInfo
- );
-
- if (Status != 0) {
- goto UndiErrorDeletePxe;
- }
-
- UNDI32Device->Signature = UNDI_DEV_SIGNATURE;
-
- UNDI32Device->NIIProtocol.Revision = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION;
- UNDI32Device->NIIProtocol.Type = EfiNetworkInterfaceUndi;
- UNDI32Device->NIIProtocol.MajorVer = PXE_ROMID_MAJORVER;
- UNDI32Device->NIIProtocol.MinorVer = PXE_ROMID_MINORVER;
- UNDI32Device->NIIProtocol.ImageSize = 0;
- UNDI32Device->NIIProtocol.ImageAddr = 0;
- UNDI32Device->NIIProtocol.Ipv6Supported = FALSE;
-
- UNDI32Device->NIIProtocol.StringId[0] = 'U';
- UNDI32Device->NIIProtocol.StringId[1] = 'N';
- UNDI32Device->NIIProtocol.StringId[2] = 'D';
- UNDI32Device->NIIProtocol.StringId[3] = 'I';
-
- UNDI32Device->NIIProtocol_31.Revision = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31;
- UNDI32Device->NIIProtocol_31.Type = EfiNetworkInterfaceUndi;
- UNDI32Device->NIIProtocol_31.MajorVer = PXE_ROMID_MAJORVER;
- UNDI32Device->NIIProtocol_31.MinorVer = PXE_ROMID_MINORVER_31;
- UNDI32Device->NIIProtocol_31.ImageSize = 0;
- UNDI32Device->NIIProtocol_31.ImageAddr = 0;
- UNDI32Device->NIIProtocol_31.Ipv6Supported = FALSE;
-
- UNDI32Device->NIIProtocol_31.StringId[0] = 'U';
- UNDI32Device->NIIProtocol_31.StringId[1] = 'N';
- UNDI32Device->NIIProtocol_31.StringId[2] = 'D';
- UNDI32Device->NIIProtocol_31.StringId[3] = 'I';
-
- UNDI32Device->DeviceHandle = NULL;
-
- //
- // install both the 3.0 and 3.1 NII protocols.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &UNDI32Device->DeviceHandle,
- &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
- &UNDI32Device->NIIProtocol_31,
- &gEfiNetworkInterfaceIdentifierProtocolGuid,
- &UNDI32Device->NIIProtocol,
- &gEfiDevicePathProtocolGuid,
- UNDI32Device->Undi32DevPath,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- goto UndiErrorDeleteDevicePath;
- }
-
- //
- // if the table exists, free it and alloc again, or alloc it directly
- //
- if (UnidiDataPointer != NULL) {
- Status = gBS->FreePool(UnidiDataPointer);
- }
- if (EFI_ERROR (Status)) {
- goto UndiErrorDeleteDevicePath;
- }
-
- Len = (pxe_31->IFcnt * sizeof (NII_ENTRY)) + sizeof (UnidiDataPointer);
- Status = gBS->AllocatePool (EfiRuntimeServicesData, Len, (VOID **) &UnidiDataPointer);
-
- if (EFI_ERROR (Status)) {
- goto UndiErrorAllocDataPointer;
- }
-
- //
- // Open For Child Device
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIoFncs,
- This->DriverBindingHandle,
- UNDI32Device->DeviceHandle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
-
- return EFI_SUCCESS;
-UndiErrorAllocDataPointer:
- gBS->UninstallMultipleProtocolInterfaces (
- &UNDI32Device->DeviceHandle,
- &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
- &UNDI32Device->NIIProtocol_31,
- &gEfiNetworkInterfaceIdentifierProtocolGuid,
- &UNDI32Device->NIIProtocol,
- &gEfiDevicePathProtocolGuid,
- UNDI32Device->Undi32DevPath,
- NULL
- );
-
-UndiErrorDeleteDevicePath:
- UNDI32DeviceList[UNDI32Device->NIIProtocol.IfNum] = NULL;
- gBS->FreePool (UNDI32Device->Undi32DevPath);
-
-UndiErrorDeletePxe:
- PxeUpdate (NULL, pxe);
- PxeUpdate (NULL, pxe_31);
- if (TmpPxePointer != NULL) {
- gBS->FreePool (TmpPxePointer);
-
- }
-
-UndiErrorDeleteDevice:
- gBS->FreePool (UNDI32Device);
-
-UndiError:
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UndiDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
- Stop this driver on Controller by removing NetworkInterfaceIdentifier protocol and
- closing the DevicePath and PciIo protocols on Controller.
-
-Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to stop driver on.
- NumberOfChildren - How many children need to be stopped.
- ChildHandleBuffer - Not used.
-
-Returns:
- EFI_SUCCESS - This driver is removed Controller.
- other - This driver was not removed from this device.
-
---*/
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-{
- EFI_STATUS Status;
- BOOLEAN AllChildrenStopped;
- UINTN Index;
- UNDI32_DEV *UNDI32Device;
- EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NIIProtocol;
- EFI_PCI_IO_PROTOCOL *PciIo;
-
- //
- // Complete all outstanding transactions to Controller.
- // Don't allow any new transaction to Controller to be started.
- //
- if (NumberOfChildren == 0) {
-
- //
- // Close the bus driver
- //
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
- }
-
- AllChildrenStopped = TRUE;
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
-
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiNetworkInterfaceIdentifierProtocolGuid,
- (VOID **) &NIIProtocol,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
-
- UNDI32Device = UNDI_DEV_FROM_THIS (NIIProtocol);
-
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index]
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ChildHandleBuffer[Index],
- &gEfiDevicePathProtocolGuid,
- UNDI32Device->Undi32DevPath,
- &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
- &UNDI32Device->NIIProtocol_31,
- &gEfiNetworkInterfaceIdentifierProtocolGuid,
- &UNDI32Device->NIIProtocol,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index],
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- gBS->FreePool (UNDI32Device->Undi32DevPath);
- gBS->FreePool (UNDI32Device);
- }
- }
-
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-
-}
-
-VOID
-TmpDelay (
- IN UINT64 UnqId,
- IN UINTN MicroSeconds
- )
-/*++
-
-Routine Description:
-
- Use the EFI boot services to produce a pause. This is also the routine which
- gets replaced during RunTime by the O/S in the NIC_DATA_INSTANCE so it can
- do it's own pause.
-
-Arguments:
-
- UnqId - Runtime O/S routine might use this, this temp routine does not use it
-
- MicroSeconds - Determines the length of pause.
-
-Returns:
-
- none
-
---*/
-{
- gBS->Stall ((UINT32) MicroSeconds);
-}
-
-VOID
-TmpMemIo (
- IN UINT64 UnqId,
- IN UINT8 ReadWrite,
- IN UINT8 Len,
- IN UINT64 Port,
- IN UINT64 BuffAddr
- )
-/*++
-
-Routine Description:
-
- Use the PCI IO abstraction to issue memory or I/O reads and writes. This is also the routine which
- gets replaced during RunTime by the O/S in the NIC_DATA_INSTANCE so it can do it's own I/O abstractions.
-
-Arguments:
-
- UnqId - Runtime O/S routine may use this field, this temp routine does not.
-
- ReadWrite - Determine if it is an I/O or Memory Read/Write Operation.
-
- Len - Determines the width of the data operation.
-
- Port - What port to Read/Write from.
-
- BuffAddr - Address to read to or write from.
-
-Returns:
-
- none
-
---*/
-{
- EFI_PCI_IO_PROTOCOL_WIDTH Width;
- NIC_DATA_INSTANCE *AdapterInfo;
-
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 0;
- AdapterInfo = (NIC_DATA_INSTANCE *) (UINTN) UnqId;
- switch (Len) {
- case 2:
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 1;
- break;
-
- case 4:
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 2;
- break;
-
- case 8:
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 3;
- break;
- }
-
- switch (ReadWrite) {
- case PXE_IO_READ:
- AdapterInfo->Io_Function->Io.Read (
- AdapterInfo->Io_Function,
- Width,
- 1,
- Port,
- 1,
- (VOID *) (UINTN) (BuffAddr)
- );
- break;
-
- case PXE_IO_WRITE:
- AdapterInfo->Io_Function->Io.Write (
- AdapterInfo->Io_Function,
- Width,
- 1,
- Port,
- 1,
- (VOID *) (UINTN) (BuffAddr)
- );
- break;
-
- case PXE_MEM_READ:
- AdapterInfo->Io_Function->Mem.Read (
- AdapterInfo->Io_Function,
- Width,
- 0,
- Port,
- 1,
- (VOID *) (UINTN) (BuffAddr)
- );
- break;
-
- case PXE_MEM_WRITE:
- AdapterInfo->Io_Function->Mem.Write (
- AdapterInfo->Io_Function,
- Width,
- 0,
- Port,
- 1,
- (VOID *) (UINTN) (BuffAddr)
- );
- break;
- }
-
- return ;
-}
-
-EFI_STATUS
-AppendMac2DevPath (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPtr,
- IN EFI_DEVICE_PATH_PROTOCOL *BaseDevPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- )
-/*++
-
-Routine Description:
-
- Using the NIC data structure information, read the EEPROM to get the MAC address and then allocate space
- for a new devicepath (**DevPtr) which will contain the original device path the NIC was found on (*BaseDevPtr)
- and an added MAC node.
-
-Arguments:
-
- DevPtr - Pointer which will point to the newly created device path with the MAC node attached.
-
- BaseDevPtr - Pointer to the device path which the UNDI device driver is latching on to.
-
- AdapterInfo - Pointer to the NIC data structure information which the UNDI driver is layering on..
-
-Returns:
-
- EFI_SUCCESS - A MAC address was successfully appended to the Base Device Path.
-
- other - Not enough resources available to create new Device Path node.
-
---*/
-{
- EFI_MAC_ADDRESS MACAddress;
- PCI_CONFIG_HEADER *CfgHdr;
- INT32 Val;
- INT32 Index;
- INT32 Index2;
- UINT8 AddrLen;
- MAC_ADDR_DEVICE_PATH MacAddrNode;
- EFI_DEVICE_PATH_PROTOCOL *EndNode;
- UINT8 *DevicePtr;
- UINT16 TotalPathLen;
- UINT16 BasePathLen;
- EFI_STATUS Status;
-
- //
- // set the environment ready (similar to UNDI_Start call) so that we can
- // execute the other UNDI_ calls to get the mac address
- // we are using undi 3.1 style
- //
- AdapterInfo->Delay = TmpDelay;
- AdapterInfo->Virt2Phys = (VOID *) 0;
- AdapterInfo->Block = (VOID *) 0;
- AdapterInfo->Map_Mem = (VOID *) 0;
- AdapterInfo->UnMap_Mem = (VOID *) 0;
- AdapterInfo->Sync_Mem = (VOID *) 0;
- AdapterInfo->Mem_Io = TmpMemIo;
- //
- // these tmp call-backs follow 3.1 undi style
- // i.e. they have the unique_id parameter.
- //
- AdapterInfo->VersionFlag = 0x31;
- AdapterInfo->Unique_ID = (UINT64) (UINTN) AdapterInfo;
-
- //
- // undi init portion
- //
- CfgHdr = (PCI_CONFIG_HEADER *) &(AdapterInfo->Config[0]);
- AdapterInfo->ioaddr = 0;
- AdapterInfo->RevID = CfgHdr->RevID;
-
- AddrLen = E100bGetEepromAddrLen (AdapterInfo);
-
- for (Index = 0, Index2 = 0; Index < 3; Index++) {
- Val = E100bReadEeprom (AdapterInfo, Index, AddrLen);
- MACAddress.Addr[Index2++] = (UINT8) Val;
- MACAddress.Addr[Index2++] = (UINT8) (Val >> 8);
- }
-
- SetMem (MACAddress.Addr + Index2, sizeof (EFI_MAC_ADDRESS) - Index2, 0);
- //for (; Index2 < sizeof (EFI_MAC_ADDRESS); Index2++) {
- // MACAddress.Addr[Index2] = 0;
- //}
- //
- // stop undi
- //
- AdapterInfo->Delay = (VOID *) 0;
- AdapterInfo->Mem_Io = (VOID *) 0;
-
- //
- // fill the mac address node first
- //
- ZeroMem ((CHAR8 *) &MacAddrNode, sizeof MacAddrNode);
- CopyMem (
- (CHAR8 *) &MacAddrNode.MacAddress,
- (CHAR8 *) &MACAddress,
- sizeof (EFI_MAC_ADDRESS)
- );
-
- MacAddrNode.Header.Type = MESSAGING_DEVICE_PATH;
- MacAddrNode.Header.SubType = MSG_MAC_ADDR_DP;
- MacAddrNode.Header.Length[0] = sizeof (MacAddrNode);
- MacAddrNode.Header.Length[1] = 0;
-
- //
- // find the size of the base dev path.
- //
- EndNode = BaseDevPtr;
-
- while (!IsDevicePathEnd (EndNode)) {
- EndNode = NextDevicePathNode (EndNode);
- }
-
- BasePathLen = (UINT16) ((UINTN) (EndNode) - (UINTN) (BaseDevPtr));
-
- //
- // create space for full dev path
- //
- TotalPathLen = (UINT16) (BasePathLen + sizeof (MacAddrNode) + sizeof (EFI_DEVICE_PATH_PROTOCOL));
-
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- TotalPathLen,
- (VOID **) &DevicePtr
- );
-
- if (Status != EFI_SUCCESS) {
- return Status;
- }
- //
- // copy the base path, mac addr and end_dev_path nodes
- //
- *DevPtr = (EFI_DEVICE_PATH_PROTOCOL *) DevicePtr;
- CopyMem (DevicePtr, (CHAR8 *) BaseDevPtr, BasePathLen);
- DevicePtr += BasePathLen;
- CopyMem (DevicePtr, (CHAR8 *) &MacAddrNode, sizeof (MacAddrNode));
- DevicePtr += sizeof (MacAddrNode);
- CopyMem (DevicePtr, (CHAR8 *) EndNode, sizeof (EFI_DEVICE_PATH_PROTOCOL));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InstallConfigTable (
- IN VOID
- )
-/*++
-
-Routine Description:
-
- Install a GUID/Pointer pair into the system's configuration table.
-
-Arguments:
-
- none
-
-Returns:
-
- EFI_SUCCESS - Install a GUID/Pointer pair into the system's configuration table.
-
- other - Did not successfully install the GUID/Pointer pair into the configuration table.
-
---*/
-// TODO: VOID - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_CONFIGURATION_TABLE *CfgPtr;
- NII_TABLE *TmpData;
- UINT16 Index;
- NII_TABLE *UndiData;
-
- if (pxe_31 == NULL) {
- return EFI_SUCCESS;
- }
-
- if(UnidiDataPointer == NULL) {
- return EFI_SUCCESS;
- }
-
- UndiData = (NII_TABLE *)UnidiDataPointer;
-
- UndiData->NumEntries = pxe_31->IFcnt;
- UndiData->NextLink = NULL;
-
- for (Index = 0; Index < pxe_31->IFcnt; Index++) {
- UndiData->NiiEntry[Index].InterfacePointer = &UNDI32DeviceList[Index]->NIIProtocol_31;
- UndiData->NiiEntry[Index].DevicePathPointer = UNDI32DeviceList[Index]->Undi32DevPath;
- }
-
- //
- // see if there is an entry in the config table already
- //
- CfgPtr = gST->ConfigurationTable;
-
- for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
- if (CompareGuid (&CfgPtr->VendorGuid, &gEfiNetworkInterfaceIdentifierProtocolGuid_31)) {
- TmpData = (NII_TABLE *) CfgPtr->VendorTable;
- //
- // go to the last link
- //
- while (TmpData->NextLink != NULL) {
- TmpData = TmpData->NextLink;
- }
-
- TmpData->NextLink = UndiData;
-
- //
- // 1st one in chain
- //
- UndiData = (NII_TABLE *) CfgPtr->VendorTable;
- break;
- }
-
- CfgPtr++;
- }
-
- //
- // create an entry in the configuration table for our GUID
- //
- Status = gBS->InstallConfigurationTable (
- &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
- UndiData
- );
- return Status;
-}
diff --git a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi.msa b/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi.msa
deleted file mode 100644
index b9c7b28..0000000
--- a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi.msa
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Undi</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>A1f436EA-A127-4EF8-957C-8048606FF670</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Undi module.</Abstract>
- <Description>This module provides support for Universal Network Driver Interface</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Undi</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Init.c</Filename>
- <Filename>Decode.c</Filename>
- <Filename>E100b.c</Filename>
- <Filename>E100b.h</Filename>
- <Filename>Undi32.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiNetworkInterfaceIdentifierProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiNetworkInterfaceIdentifierProtocolGuid_31</ProtocolCName>
- </Protocol>
- </Protocols>
- <Events>
- <CreateEvents>
- <EventTypes EventGuidCName="gEfiEventVirtualAddressChangeGuid" Usage="ALWAYS_CONSUMED">
- <EventType>EVENT_GROUP_GUID</EventType>
- </EventTypes>
- <EventTypes EventGuidCName="gEfiEventExitBootServicesGuid" Usage="ALWAYS_CONSUMED">
- <EventType>EVENT_GROUP_GUID</EventType>
- </EventTypes>
- </CreateEvents>
- </Events>
- <SystemTables>
- <SystemTableCNames Usage="SOMETIMES_PRODUCED">
- <SystemTableCName>gEfiNetworkInterfaceIdentifierProtocolGuid_31</SystemTableCName>
- </SystemTableCNames>
- </SystemTables>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>InitializeUNDIDriver</ModuleEntryPoint>
- </Extern>
- <Extern>
- <DriverBinding>gUndiDriverBinding</DriverBinding>
- </Extern>
- <Extern>
- <SetVirtualAddressMapCallBack>UndiNotifyVirtual</SetVirtualAddressMapCallBack>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi32.h b/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi32.h
deleted file mode 100644
index b7c7212..0000000
--- a/EdkModulePkg/Bus/Pci/Undi/RuntimeDxe/Undi32.h
+++ /dev/null
@@ -1,359 +0,0 @@
-
-/*++
-
-Copyright (c) 2006, Intel Corporation.
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- undi32.h
-
-Abstract:
-
- EFI internal structures for the EFI UNDI driver
-
-
-
-Revision History
-
---*/
-
-#ifndef _UNDI_32_H_
-#define _UNDI_32_H_
-
-
-#include "E100b.h"
-#include <IndustryStandard/pci22.h>
-
-#define MAX_NIC_INTERFACES 16
-
-#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION_31 0x00010001
-#define PXE_ROMID_MINORVER_31 0x10
-#define PXE_STATFLAGS_DB_WRITE_TRUNCATED 0x2000
-
-//
-// UNDI_CALL_TABLE.state can have the following values
-//
-#define DONT_CHECK -1
-#define ANY_STATE -1
-#define MUST_BE_STARTED 1
-#define MUST_BE_INITIALIZED 2
-
-#define UNDI_DEV_SIGNATURE EFI_SIGNATURE_32('u','n','d','i')
-#define UNDI_DEV_FROM_THIS(a) CR(a, UNDI32_DEV, NIIProtocol, UNDI_DEV_SIGNATURE)
-#define UNDI_DEV_FROM_NIC(a) CR(a, UNDI32_DEV, NicInfo, UNDI_DEV_SIGNATURE)
-
-typedef struct {
- UINTN Signature;
- EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol;
- EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL NIIProtocol_31;
- EFI_HANDLE DeviceHandle;
- EFI_DEVICE_PATH_PROTOCOL *Undi32BaseDevPath;
- EFI_DEVICE_PATH_PROTOCOL *Undi32DevPath;
- NIC_DATA_INSTANCE NicInfo;
-} UNDI32_DEV;
-
-typedef struct {
- UINT16 cpbsize;
- UINT16 dbsize;
- UINT16 opflags;
- UINT16 state;
- VOID (*api_ptr)();
-} UNDI_CALL_TABLE;
-
-typedef struct {
- EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *InterfacePointer;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathPointer;
-} NII_ENTRY;
-
-typedef struct NII_CONFIG_ENTRY {
- UINT32 NumEntries;
- UINT32 Reserved; // padding for alignment
- struct NII_CONFIG_ENTRY *NextLink;
- NII_ENTRY NiiEntry[1];
-} NII_TABLE;
-
-typedef VOID (*ptr)(VOID);
-typedef VOID (*bsptr_30)(UINTN);
-typedef VOID (*virtphys_30)(UINT64, UINT64);
-typedef VOID (*block_30)(UINT32);
-typedef VOID (*mem_io_30)(UINT8, UINT8, UINT64, UINT64);
-
-typedef VOID (*bsptr)(UINT64, UINTN);
-typedef VOID (*virtphys)(UINT64, UINT64, UINT64);
-typedef VOID (*block)(UINT64, UINT32);
-typedef VOID (*mem_io)(UINT64, UINT8, UINT8, UINT64, UINT64);
-
-typedef VOID (*map_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
-typedef VOID (*unmap_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
-typedef VOID (*sync_mem)(UINT64, UINT64, UINT32, UINT32, UINT64);
-
-extern UNDI_CALL_TABLE api_table[];
-extern PXE_SW_UNDI *pxe; // !pxe structure
-extern PXE_SW_UNDI *pxe_31; // !pxe structure for 3.1 drivers
-extern UNDI32_DEV *UNDI32DeviceList[MAX_NIC_INTERFACES];
-
-//
-// functions defined in e100b.c
-//
-UINT8 InByte (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
-UINT16 InWord (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
-UINT32 InLong (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Port);
-VOID OutByte (NIC_DATA_INSTANCE *AdapterInfo, UINT8 Data, UINT32 Port);
-VOID OutWord (NIC_DATA_INSTANCE *AdapterInfo, UINT16 Data, UINT32 Port);
-VOID OutLong (NIC_DATA_INSTANCE *AdapterInfo, UINT32 Data, UINT32 Port);
-
-UINTN E100bInit (NIC_DATA_INSTANCE *AdapterInfo);
-UINTN E100bReset (NIC_DATA_INSTANCE *AdapterInfo, INT32 OpFlags);
-UINTN E100bShutdown (NIC_DATA_INSTANCE *AdapterInfo);
-UINTN E100bTransmit (NIC_DATA_INSTANCE *AdapterInfo, UINT64 cpb, UINT16 opflags);
-UINTN E100bReceive (NIC_DATA_INSTANCE *AdapterInfo, UINT64 cpb, UINT64 db);
-UINTN E100bSetfilter (NIC_DATA_INSTANCE *AdapterInfo, UINT16 New_filter,
- UINT64 cpb, UINT32 cpbsize);
-UINTN E100bStatistics(NIC_DATA_INSTANCE *AdapterInfo, UINT64 db, UINT16 dbsize);
-UINT8 E100bSetupIAAddr (NIC_DATA_INSTANCE *AdapterInfo);
-UINT8 E100bSetInterruptState (NIC_DATA_INSTANCE *AdapterInfo);
-
-UINT8 E100bGetEepromAddrLen (NIC_DATA_INSTANCE *AdapterInfo);
-UINT16 E100bReadEeprom (NIC_DATA_INSTANCE *AdapterInfo, INT32 Location, UINT8 address_len);
-INT16 E100bReadEepromAndStationAddress (NIC_DATA_INSTANCE *AdapterInfo);
-
-UINT16 next(UINT16);
-UINT8 SetupCBlink (NIC_DATA_INSTANCE *AdapterInfo);
-VOID SetFreeCB (NIC_DATA_INSTANCE *AdapterInfo,TxCB *);
-TxCB *GetFreeCB (NIC_DATA_INSTANCE *AdapterInfo);
-UINT16 CheckCBList (NIC_DATA_INSTANCE *AdapterInfo);
-
-UINT8 SelectiveReset (NIC_DATA_INSTANCE *AdapterInfo);
-UINT16 InitializeChip (NIC_DATA_INSTANCE *AdapterInfo);
-UINT8 SetupReceiveQueues (NIC_DATA_INSTANCE *AdapterInfo);
-VOID Recycle_RFD (NIC_DATA_INSTANCE *AdapterInfo, UINT16);
-VOID XmitWaitForCompletion (NIC_DATA_INSTANCE *AdapterInfo);
-INT8 CommandWaitForCompletion (TxCB *cmd_ptr, NIC_DATA_INSTANCE *AdapterInfo);
-
-BOOLEAN PhyDetect (NIC_DATA_INSTANCE *AdapterInfo);
-VOID PhyReset (NIC_DATA_INSTANCE *AdapterInfo);
-VOID
-MdiWrite (
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT8 RegAddress,
- IN UINT8 PhyAddress,
- IN UINT16 DataValue
- );
-
-VOID
-MdiRead(
- IN NIC_DATA_INSTANCE *AdapterInfo,
- IN UINT8 RegAddress,
- IN UINT8 PhyAddress,
- IN OUT UINT16 *DataValue
- );
-
-BOOLEAN SetupPhy (NIC_DATA_INSTANCE *AdapterInfo);
-VOID FindPhySpeedAndDpx (NIC_DATA_INSTANCE *AdapterInfo, UINT32 PhyId);
-
-
-
-//
-// functions defined in init.c
-//
-EFI_STATUS
-InstallConfigTable (
- IN VOID
- );
-
-EFI_STATUS
-EFIAPI
-InitializeUNDIDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-VOID
-UNDI_notify_virtual (
- EFI_EVENT event,
- VOID *context
- );
-
-VOID
-EFIAPI
-UndiNotifyExitBs (
- EFI_EVENT Event,
- VOID *Context
- );
-
-EFI_STATUS
-EFIAPI
-UndiDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-UndiDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-UndiDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-EFI_STATUS
-AppendMac2DevPath (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevPtr,
- IN EFI_DEVICE_PATH_PROTOCOL *BaseDevPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-TmpDelay (
- IN UINT64 UnqId,
- IN UINTN MicroSeconds
- );
-
-VOID
-TmpMemIo (
- IN UINT64 UnqId,
- IN UINT8 ReadWrite,
- IN UINT8 Len,
- IN UINT64 Port,
- IN UINT64 BufAddr
- );
-
-//
-// functions defined in decode.c
-//
-VOID
-UNDI_GetState (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_Start (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_Stop (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_GetInitInfo (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_GetConfigInfo (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_Initialize (
- IN PXE_CDB *CdbPtr,
- NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_Reset (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_Shutdown (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_Interrupt (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_RecFilter (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_StnAddr (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_Statistics (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_ip2mac (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_NVData (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_Status (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_FillHeader (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_Transmit (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID
-UNDI_Receive (
- IN PXE_CDB *CdbPtr,
- IN NIC_DATA_INSTANCE *AdapterInfo
- );
-
-VOID UNDI_APIEntry_new(UINT64);
-VOID UNDI_APIEntry_old(UINT64);
-VOID UNDI_APIEntry_Common(UINT64);
-
-PXE_IPV4 convert_mcip(PXE_MAC_ADDR *);
-INT32 validate_mcip (PXE_MAC_ADDR *MCastAddr);
-
-VOID PxeStructInit (PXE_SW_UNDI *PxePtr, UINTN VersionFlag);
-VOID PxeUpdate (NIC_DATA_INSTANCE *NicPtr, PXE_SW_UNDI *PxePtr);
-
-#endif
diff --git a/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ComponentName.c b/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ComponentName.c
deleted file mode 100644
index 2468108..0000000
--- a/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ComponentName.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "ScsiBus.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName = {
- ScsiBusComponentNameGetDriverName,
- ScsiBusComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[] = {
- { "eng", (CHAR16 *) L"SCSI Bus Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-ScsiBusComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gScsiBusComponentName.SupportedLanguages,
- mScsiBusDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-ScsiBusComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.c b/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.c
deleted file mode 100644
index 3c79e47..0000000
--- a/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.c
+++ /dev/null
@@ -1,727 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- scsibus.c
-
-Abstract:
-
-
-Revision History
---*/
-
-#include "ScsiBus.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gSCSIBusDriverBinding = {
- SCSIBusDriverBindingSupported,
- SCSIBusDriverBindingStart,
- SCSIBusDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-SCSIBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
-
- Arguments:
-
- Returns:
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Controller - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
-
- //
- // If RemainingDevicePath is not NULL, it should verify that the first device
- // path node in RemainingDevicePath is an ATAPI Device path node.
- //
- if (RemainingDevicePath != NULL) {
- if ((RemainingDevicePath->Type != MESSAGING_DEVICE_PATH) ||
- (RemainingDevicePath->SubType != MSG_ATAPI_DP) ||
- (DevicePathNodeLength (RemainingDevicePath) != sizeof(ATAPI_DEVICE_PATH))) {
- return EFI_UNSUPPORTED;
- }
- }
- //
- // check for the existence of SCSI Pass Thru Protocol
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiScsiPassThruProtocolGuid,
- NULL,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-SCSIBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
-
- Arguments:
-
- Returns:
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Controller - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
- UINT32 StartPun;
- UINT64 StartLun;
- UINT32 Pun;
- UINT64 Lun;
- BOOLEAN ScanOtherPuns;
-
- StartPun = 0;
- StartLun = 0;
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- //
- // Consume SCSI Pass Thru protocol.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiScsiPassThruProtocolGuid,
- (VOID **) &ScsiPassThru,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
-
- if (RemainingDevicePath == NULL) {
- StartPun = 0xFFFFFFFF;
- StartLun = 0;
- } else {
- ScsiPassThru->GetTargetLun (ScsiPassThru, RemainingDevicePath, &StartPun, &StartLun);
- }
-
- for (Pun = StartPun, ScanOtherPuns = TRUE; ScanOtherPuns;) {
-
- if (StartPun == 0xFFFFFFFF) {
- //
- // Remaining Device Path is NULL, scan all the possible Puns in the
- // SCSI Channel.
- //
- Status = ScsiPassThru->GetNextDevice (ScsiPassThru, &Pun, &Lun);
- if (EFI_ERROR (Status)) {
- //
- // no legal Pun and Lun found any more
- //
- break;
- }
- } else {
- //
- // Remaining Device Path is not NULL, only scan the specified Pun.
- //
- Pun = StartPun;
- Lun = StartLun;
- ScanOtherPuns = FALSE;
- }
-
- //
- // Avoid creating handle for the host adapter.
- //
- if (Pun == ScsiPassThru->Mode->AdapterId) {
- continue;
- }
-
- //
- // Scan for the scsi device, if it attaches to the scsi bus,
- // then create handle and install scsi i/o protocol.
- //
- Status = ScsiScanCreateDevice (This, Controller, Pun, Lun, ScsiPassThru, ParentDevicePath);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-SCSIBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
-
- Arguments:
-
- Returns:
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Controller - add argument and description to function comment
-// TODO: NumberOfChildren - add argument and description to function comment
-// TODO: ChildHandleBuffer - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- BOOLEAN AllChildrenStopped;
- UINTN Index;
- EFI_SCSI_IO_PROTOCOL *ScsiIo;
- SCSI_IO_DEV *ScsiIoDevice;
- EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
-
- if (NumberOfChildren == 0) {
- //
- // Close the bus driver
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiScsiPassThruProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return EFI_SUCCESS;
- }
-
- AllChildrenStopped = TRUE;
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
-
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiScsiIoProtocolGuid,
- (VOID **) &ScsiIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- continue;
- }
-
- ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (ScsiIo);
- //
- // Close the child handle
- //
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiScsiPassThruProtocolGuid,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index]
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ChildHandleBuffer[Index],
- &gEfiDevicePathProtocolGuid,
- ScsiIoDevice->DevicePath,
- &gEfiScsiIoProtocolGuid,
- &ScsiIoDevice->ScsiIo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- gBS->OpenProtocol (
- Controller,
- &gEfiScsiPassThruProtocolGuid,
- (VOID **) &ScsiPassThru,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index],
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- gBS->FreePool (ScsiIoDevice);
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ScsiGetDeviceType (
- IN EFI_SCSI_IO_PROTOCOL *This,
- OUT UINT8 *DeviceType
- )
-/*++
-
- Routine Description:
- Retrieves the device type information of the SCSI Controller.
-
- Arguments:
- This - Protocol instance pointer.
- DeviceType - A pointer to the device type information
- retrieved from the SCSI Controller.
-
- Returns:
- EFI_SUCCESS - Retrieves the device type information successfully.
- EFI_INVALID_PARAMETER - The DeviceType is NULL.
---*/
-{
- SCSI_IO_DEV *ScsiIoDevice;
-
- if (DeviceType == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
- *DeviceType = ScsiIoDevice->ScsiDeviceType;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-ScsiGetDeviceLocation (
- IN EFI_SCSI_IO_PROTOCOL *This,
- OUT UINT32 *Target,
- OUT UINT64 *Lun
- )
-/*++
- Routine Description:
- Retrieves the device location in the SCSI channel.
-
- Arguments:
- This - Protocol instance pointer.
- Target - A pointer to the Target ID of a SCSI device
- on the SCSI channel.
- Lun - A pointer to the LUN of the SCSI device on
- the SCSI channel.
-
- Returns:
- EFI_SUCCESS - Retrieves the device location successfully.
- EFI_INVALID_PARAMETER - The Target or Lun is NULL.
---*/
-{
- SCSI_IO_DEV *ScsiIoDevice;
-
- if (Target == NULL || Lun == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
-
- *Target = ScsiIoDevice->Pun;
- *Lun = ScsiIoDevice->Lun;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ScsiResetBus (
- IN EFI_SCSI_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Resets the SCSI Bus that the SCSI Controller is attached to.
-
- Arguments:
- This - Protocol instance pointer.
-
- Returns:
- EFI_SUCCESS - The SCSI bus is reset successfully.
- EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus.
- EFI_UNSUPPORTED - The bus reset operation is not supported by the
- SCSI Host Controller.
- EFI_TIMEOUT - A timeout occurred while attempting to reset
- the SCSI bus.
---*/
-{
- SCSI_IO_DEV *ScsiIoDevice;
-
- ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
-
- return ScsiIoDevice->ScsiPassThru->ResetChannel (ScsiIoDevice->ScsiPassThru);
-
-}
-
-EFI_STATUS
-EFIAPI
-ScsiResetDevice (
- IN EFI_SCSI_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Resets the SCSI Controller that the device handle specifies.
-
- Arguments:
- This - Protocol instance pointer.
-
-
- Returns:
- EFI_SUCCESS - Reset the SCSI controller successfully.
- EFI_DEVICE_ERROR - Errors are encountered when resetting the
- SCSI Controller.
- EFI_UNSUPPORTED - The SCSI bus does not support a device
- reset operation.
- EFI_TIMEOUT - A timeout occurred while attempting to
- reset the SCSI Controller.
---*/
-{
- SCSI_IO_DEV *ScsiIoDevice;
-
- ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
-
- return ScsiIoDevice->ScsiPassThru->ResetTarget (
- ScsiIoDevice->ScsiPassThru,
- ScsiIoDevice->Pun,
- ScsiIoDevice->Lun
- );
-}
-
-EFI_STATUS
-EFIAPI
-ScsiExecuteSCSICommand (
- IN EFI_SCSI_IO_PROTOCOL *This,
- IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
- IN EFI_EVENT Event OPTIONAL
- )
-/*++
-
- Routine Description:
- Sends a SCSI Request Packet to the SCSI Controller for execution.
-
- Arguments:
- This - Protocol instance pointer.
- Packet - The SCSI request packet to send to the SCSI
- Controller specified by the device handle.
- Event - If the SCSI bus where the SCSI device is attached
- does not support non-blocking I/O, then Event is
- ignored, and blocking I/O is performed.
- If Event is NULL, then blocking I/O is performed.
- If Event is not NULL and non-blocking I/O is
- supported, then non-blocking I/O is performed,
- and Event will be signaled when the SCSI Request
- Packet completes.
- Returns:
- EFI_SUCCESS - The SCSI Request Packet was sent by the host
- successfully, and TransferLength bytes were
- transferred to/from DataBuffer.See
- HostAdapterStatus, TargetStatus,
- SenseDataLength, and SenseData in that order
- for additional status information.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength. See HostAdapterStatus,
- TargetStatus, SenseDataLength, and SenseData in
- that order for additional status information.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.The caller may retry again later.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet. See HostAdapterStatus,
- TargetStatus, SenseDataLength, and SenseData in
- that order for additional status information.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- The SCSI Request Packet was not sent, so no
- additional status information is available.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller). The SCSI Request Packet was not
- sent, so no additional status information is
- available.
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute. See HostAdapterStatus,
- TargetStatus, SenseDataLength, and SenseData in
- that order for additional status information.
---*/
-{
- SCSI_IO_DEV *ScsiIoDevice;
- EFI_STATUS Status;
-
- EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *RequestPacket;
-
- if (Packet == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This);
-
- RequestPacket = (EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *) Packet;
-
- Status = ScsiIoDevice->ScsiPassThru->PassThru (
- ScsiIoDevice->ScsiPassThru,
- ScsiIoDevice->Pun,
- ScsiIoDevice->Lun,
- RequestPacket,
- Event
- );
- return Status;
-}
-
-EFI_STATUS
-ScsiScanCreateDevice (
- EFI_DRIVER_BINDING_PROTOCOL *This,
- EFI_HANDLE Controller,
- UINT32 Pun,
- UINT64 Lun,
- EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru,
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Controller - TODO: add argument description
- Pun - TODO: add argument description
- Lun - TODO: add argument description
- ScsiPassThru - TODO: add argument description
- ParentDevicePath - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
- EFI_OUT_OF_RESOURCES - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- SCSI_IO_DEV *ScsiIoDevice;
- EFI_DEVICE_PATH_PROTOCOL *ScsiDevicePath;
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (SCSI_IO_DEV),
- (VOID **) &ScsiIoDevice
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ZeroMem (ScsiIoDevice, sizeof (SCSI_IO_DEV));
-
- ScsiIoDevice->Signature = SCSI_IO_DEV_SIGNATURE;
- ScsiIoDevice->ScsiPassThru = ScsiPassThru;
- ScsiIoDevice->Pun = Pun;
- ScsiIoDevice->Lun = Lun;
-
- ScsiIoDevice->ScsiIo.GetDeviceType = ScsiGetDeviceType;
- ScsiIoDevice->ScsiIo.GetDeviceLocation = ScsiGetDeviceLocation;
- ScsiIoDevice->ScsiIo.ResetBus = ScsiResetBus;
- ScsiIoDevice->ScsiIo.ResetDevice = ScsiResetDevice;
- ScsiIoDevice->ScsiIo.ExecuteSCSICommand = ScsiExecuteSCSICommand;
-
- if (!DiscoverScsiDevice (ScsiIoDevice)) {
- gBS->FreePool (ScsiIoDevice);
- return EFI_SUCCESS;
- }
-
- //
- // Set Device Path
- //
- Status = ScsiIoDevice->ScsiPassThru->BuildDevicePath (
- ScsiIoDevice->ScsiPassThru,
- ScsiIoDevice->Pun,
- ScsiIoDevice->Lun,
- &ScsiDevicePath
- );
- if (Status == EFI_OUT_OF_RESOURCES) {
- gBS->FreePool (ScsiIoDevice);
- return Status;
- }
-
- ScsiIoDevice->DevicePath = AppendDevicePathNode (
- ParentDevicePath,
- ScsiDevicePath
- );
- //
- // The memory space for ScsiDevicePath is allocated in
- // ScsiPassThru->BuildDevicePath() function; It is no longer used
- // after EfiAppendDevicePathNode,so free the memory it occupies.
- //
- gBS->FreePool (ScsiDevicePath);
-
- if (ScsiIoDevice->DevicePath == NULL) {
- gBS->FreePool (ScsiIoDevice);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ScsiIoDevice->Handle,
- &gEfiDevicePathProtocolGuid,
- ScsiIoDevice->DevicePath,
- &gEfiScsiIoProtocolGuid,
- &ScsiIoDevice->ScsiIo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (ScsiIoDevice);
- } else {
- gBS->OpenProtocol (
- Controller,
- &gEfiScsiPassThruProtocolGuid,
- (VOID **) &ScsiPassThru,
- This->DriverBindingHandle,
- ScsiIoDevice->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-DiscoverScsiDevice (
- SCSI_IO_DEV *ScsiIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
- EFI_SCSI_INQUIRY_DATA InquiryData;
- UINT32 InquiryDataLength;
- EFI_SCSI_SENSE_DATA SenseData;
- UINT8 SenseDataLength;
- UINT8 HostAdapterStatus;
- UINT8 TargetStatus;
-
- HostAdapterStatus = 0;
- TargetStatus = 0;
- //
- // Using Inquiry command to scan for the device
- //
- InquiryDataLength = sizeof (EFI_SCSI_INQUIRY_DATA);
- SenseDataLength = sizeof (EFI_SCSI_SENSE_DATA);
-
- Status = SubmitInquiryCommand (
- &ScsiIoDevice->ScsiIo,
- EfiScsiStallSeconds (1),
- (VOID *) &SenseData,
- &SenseDataLength,
- &HostAdapterStatus,
- &TargetStatus,
- (VOID *) &InquiryData,
- &InquiryDataLength,
- FALSE
- );
- if (EFI_ERROR (Status)) {
- //
- // ParseSenseData (&SenseData,SenseDataLength);
- //
- return FALSE;
- }
- //
- // Retrieved inquiry data successfully
- //
- if ((InquiryData.Peripheral_Qualifier != 0) &&
- (InquiryData.Peripheral_Qualifier != 3)) {
- return FALSE;
- }
-
- if (InquiryData.Peripheral_Qualifier == 3) {
- if (InquiryData.Peripheral_Type != 0x1f) {
- return FALSE;
- }
- }
-
- if ((0x1e >= InquiryData.Peripheral_Type) && (InquiryData.Peripheral_Type >= 0xa)) {
- return FALSE;
- }
-
- //
- // valid device type and peripheral qualifier combination.
- //
- ScsiIoDevice->ScsiDeviceType = InquiryData.Peripheral_Type;
- ScsiIoDevice->RemovableDevice = InquiryData.RMB;
- if (InquiryData.Version == 0) {
- ScsiIoDevice->ScsiVersion = 0;
- } else {
- //
- // ANSI-approved version
- //
- ScsiIoDevice->ScsiVersion = (UINT8) (InquiryData.Version & 0x03);
- }
-
- return TRUE;
-}
diff --git a/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.h b/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.h
deleted file mode 100644
index 594953e..0000000
--- a/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ScsiBus.h
-
-Abstract:
-
- Header file for SCSI Bus Driver.
-
-Revision History
-++*/
-
-// TODO: fix comment to end with --*/
-#ifndef _SCSI_BUS_H
-#define _SCSI_BUS_H
-
-
-#include <IndustryStandard/scsi.h>
-//
-// 1000 * 1000 * 10
-//
-#define ONE_SECOND_TIMER 10000000
-
-#define SCSI_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 'i', 'o')
-
-typedef struct {
- UINT32 Signature;
-
- EFI_HANDLE Handle;
- EFI_SCSI_IO_PROTOCOL ScsiIo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
-
- UINT32 Pun;
- UINT64 Lun;
- UINT8 ScsiDeviceType;
- UINT8 ScsiVersion;
- BOOLEAN RemovableDevice;
-} SCSI_IO_DEV;
-
-#define SCSI_IO_DEV_FROM_THIS(a) CR (a, SCSI_IO_DEV, ScsiIo, SCSI_IO_DEV_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gScsiBusDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName;
-
-EFI_STATUS
-EFIAPI
-SCSIBusDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-SCSIBusDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-SCSIBusDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-ScsiBusComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-ScsiBusComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-EFI_STATUS
-EFIAPI
-ScsiGetDeviceType (
- IN EFI_SCSI_IO_PROTOCOL *This,
- OUT UINT8 *DeviceType
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- DeviceType - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-ScsiResetBus (
- IN EFI_SCSI_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-ScsiResetDevice (
- IN EFI_SCSI_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-ScsiExecuteSCSICommand (
- IN EFI_SCSI_IO_PROTOCOL *This,
- IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *CommandPacket,
- IN EFI_EVENT Event
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- CommandPacket - TODO: add argument description
- Event - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiScanCreateDevice (
- EFI_DRIVER_BINDING_PROTOCOL *This,
- EFI_HANDLE Controller,
- UINT32 Pun,
- UINT64 Lun,
- EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru,
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- Controller - TODO: add argument description
- Pun - TODO: add argument description
- Lun - TODO: add argument description
- ScsiPassThru - TODO: add argument description
- ParentDevicePath - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-DiscoverScsiDevice (
- SCSI_IO_DEV *ScsiIoDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiIoDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-GetLunList (
- EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru,
- UINT32 Target,
- UINT64 **LunArray,
- UINTN *NumberOfLuns
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiPassThru - TODO: add argument description
- Target - TODO: add argument description
- LunArray - TODO: add argument description
- NumberOfLuns - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiBusSubmitReportLunCommand (
- EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru,
- UINT32 Target,
- UINTN AllocationLength,
- VOID *Buffer,
- EFI_SCSI_SENSE_DATA *SenseData,
- UINT8 *SenseDataLength,
- UINT8 *HostAdapterStatus,
- UINT8 *TargetStatus
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiPassThru - TODO: add argument description
- Target - TODO: add argument description
- AllocationLength - TODO: add argument description
- Buffer - TODO: add argument description
- SenseData - TODO: add argument description
- SenseDataLength - TODO: add argument description
- HostAdapterStatus - TODO: add argument description
- TargetStatus - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-#endif
diff --git a/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.msa b/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.msa
deleted file mode 100644
index 4dba827..0000000
--- a/EdkModulePkg/Bus/Scsi/ScsiBus/Dxe/ScsiBus.msa
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>ScsiBus</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>0167CCC4-D0F7-4f21-A3EF-9E64B7CDCE8B</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Scsi Bus module.</Abstract>
- <Description>SCSI bus driver. This driver scans all SCSI devices and export SCSI IO protocol</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>ScsiBus</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkScsiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>ScsiBus.h</Filename>
- <Filename>ScsiBus.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiScsiPassThruProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiScsiIoProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00010010</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gSCSIBusDriverBinding</DriverBinding>
- <ComponentName>gScsiBusComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ComponentName.c b/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ComponentName.c
deleted file mode 100644
index 74a41e8..0000000
--- a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ComponentName.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "ScsiDisk.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName = {
- ScsiDiskComponentNameGetDriverName,
- ScsiDiskComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mScsiDiskDriverNameTable[] = {
- { "eng", (CHAR16 *) L"Scsi Disk Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-ScsiDiskComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gScsiDiskComponentName.SupportedLanguages,
- mScsiDiskDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-ScsiDiskComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- SCSI_DISK_DEV *ScsiDiskDevice;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gScsiDiskDriverBinding.DriverBindingHandle,
- &gEfiScsiIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the device context
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlockIo,
- gScsiDiskDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (BlockIo);
-
- return LookupUnicodeString (
- Language,
- gScsiDiskComponentName.SupportedLanguages,
- ScsiDiskDevice->ControllerNameTable,
- ControllerName
- );
-
-}
diff --git a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c b/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c
deleted file mode 100644
index 9b3c01f..0000000
--- a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c
+++ /dev/null
@@ -1,2354 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ScsiDisk.c
-
-Abstract:
-
---*/
-
-#include "ScsiDisk.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding = {
- ScsiDiskDriverBindingSupported,
- ScsiDiskDriverBindingStart,
- ScsiDiskDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-ScsiDiskDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
-
- Arguments:
-
- Returns:
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Controller - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-{
- EFI_STATUS Status;
- EFI_SCSI_IO_PROTOCOL *ScsiIo;
- UINT8 DeviceType;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiScsiIoProtocolGuid,
- (VOID **) &ScsiIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = ScsiIo->GetDeviceType (ScsiIo, &DeviceType);
- if (!EFI_ERROR (Status)) {
- if ((DeviceType == EFI_SCSI_TYPE_DISK) || (DeviceType == EFI_SCSI_TYPE_CDROM)) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_UNSUPPORTED;
- }
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiScsiIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-ScsiDiskDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
-
- Arguments:
-
- Returns:
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Controller - add argument and description to function comment
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- EFI_SCSI_IO_PROTOCOL *ScsiIo;
- SCSI_DISK_DEV *ScsiDiskDevice;
- BOOLEAN Temp;
- UINT8 Index;
- UINT8 MaxRetry;
- BOOLEAN NeedRetry;
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (SCSI_DISK_DEV),
- (VOID **) &ScsiDiskDevice
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ZeroMem (ScsiDiskDevice, sizeof (SCSI_DISK_DEV));
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiScsiIoProtocolGuid,
- (VOID **) &ScsiIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (ScsiDiskDevice);
- return Status;
- }
-
- ScsiDiskDevice->Signature = SCSI_DISK_DEV_SIGNATURE;
- ScsiDiskDevice->ScsiIo = ScsiIo;
- ScsiDiskDevice->BlkIo.Media = &ScsiDiskDevice->BlkIoMedia;
- ScsiDiskDevice->BlkIo.Reset = ScsiDiskReset;
- ScsiDiskDevice->BlkIo.ReadBlocks = ScsiDiskReadBlocks;
- ScsiDiskDevice->BlkIo.WriteBlocks = ScsiDiskWriteBlocks;
- ScsiDiskDevice->BlkIo.FlushBlocks = ScsiDiskFlushBlocks;
- ScsiDiskDevice->Handle = Controller;
-
- ScsiIo->GetDeviceType (ScsiIo, &(ScsiDiskDevice->DeviceType));
- switch (ScsiDiskDevice->DeviceType) {
- case EFI_SCSI_TYPE_DISK:
- ScsiDiskDevice->BlkIo.Media->BlockSize = 0x200;
- break;
-
- case EFI_SCSI_TYPE_CDROM:
- ScsiDiskDevice->BlkIo.Media->BlockSize = 0x800;
- break;
- }
- //
- // The Sense Data Array's initial size is 6
- //
- ScsiDiskDevice->SenseDataNumber = 6;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_SCSI_SENSE_DATA) * ScsiDiskDevice->SenseDataNumber,
- (VOID **) &(ScsiDiskDevice->SenseData)
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiScsiIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- gBS->FreePool (ScsiDiskDevice);
- return Status;
- }
-
- ZeroMem (
- ScsiDiskDevice->SenseData,
- sizeof (EFI_SCSI_SENSE_DATA) * ScsiDiskDevice->SenseDataNumber
- );
-
- //
- // Retrive device information
- //
- MaxRetry = 2;
- for (Index = 0; Index < MaxRetry; Index++) {
- Status = ScsiDiskInquiryDevice (ScsiDiskDevice, &NeedRetry);
- if (!EFI_ERROR (Status)) {
- break;
- }
-
- if (!NeedRetry) {
- gBS->FreePool (ScsiDiskDevice->SenseData);
- gBS->CloseProtocol (
- Controller,
- &gEfiScsiIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- gBS->FreePool (ScsiDiskDevice);
- return EFI_DEVICE_ERROR;
- }
- }
- //
- // The second parameter "TRUE" means must
- // retrieve media capacity
- //
- Status = ScsiDiskDetectMedia (ScsiDiskDevice, TRUE, &Temp);
- if (!EFI_ERROR (Status)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Controller,
- &gEfiBlockIoProtocolGuid,
- &ScsiDiskDevice->BlkIo,
- NULL
- );
- }
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (ScsiDiskDevice->SenseData);
- gBS->CloseProtocol (
- Controller,
- &gEfiScsiIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- gBS->FreePool (ScsiDiskDevice);
- return Status;
- }
-
- ScsiDiskDevice->ControllerNameTable = NULL;
- AddUnicodeString (
- "eng",
- gScsiDiskComponentName.SupportedLanguages,
- &ScsiDiskDevice->ControllerNameTable,
- (CHAR16 *) L"SCSI Disk Device"
- );
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-EFIAPI
-ScsiDiskDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
-
- Arguments:
-
- Returns:
-
---*/
-// TODO: This - add argument and description to function comment
-// TODO: Controller - add argument and description to function comment
-// TODO: NumberOfChildren - add argument and description to function comment
-// TODO: ChildHandleBuffer - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
- SCSI_DISK_DEV *ScsiDiskDevice;
- EFI_STATUS Status;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (BlkIo);
- Status = gBS->UninstallProtocolInterface (
- Controller,
- &gEfiBlockIoProtocolGuid,
- &ScsiDiskDevice->BlkIo
- );
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiScsiIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- ReleaseScsiDiskDeviceResources (ScsiDiskDevice);
-
- return EFI_SUCCESS;
- }
- //
- // errors met
- //
- return Status;
-}
-
-//
-// Block I/O Protocol Interface
-//
-
-EFI_STATUS
-EFIAPI
-ScsiDiskReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- SCSI_DISK_DEV *ScsiDiskDevice;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This);
-
- Status = ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo);
-
- if (!ExtendedVerification) {
- goto Done;
- }
-
- Status = ScsiDiskDevice->ScsiIo->ResetBus (ScsiDiskDevice->ScsiIo);
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-ScsiDiskReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- MediaId - TODO: add argument description
- LBA - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_NO_MEDIA - TODO: Add description for return value
- EFI_MEDIA_CHANGED - TODO: Add description for return value
- EFI_BAD_BUFFER_SIZE - TODO: Add description for return value
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_INVALID_PARAMETER - TODO: Add description for return value
-
---*/
-{
- SCSI_DISK_DEV *ScsiDiskDevice;
- EFI_BLOCK_IO_MEDIA *Media;
- EFI_STATUS Status;
- UINTN BlockSize;
- UINTN NumberOfBlocks;
- BOOLEAN MediaChange;
- EFI_TPL OldTpl;
-
- MediaChange = FALSE;
- if (!Buffer) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This);
-
- if (!IsDeviceFixed (ScsiDiskDevice)) {
-
- Status = ScsiDiskDetectMedia (ScsiDiskDevice, FALSE, &MediaChange);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- if (MediaChange) {
- gBS->ReinstallProtocolInterface (
- ScsiDiskDevice->Handle,
- &gEfiBlockIoProtocolGuid,
- &ScsiDiskDevice->BlkIo,
- &ScsiDiskDevice->BlkIo
- );
- }
- }
- //
- // Get the intrinsic block size
- //
- Media = ScsiDiskDevice->BlkIo.Media;
- BlockSize = Media->BlockSize;
-
- NumberOfBlocks = BufferSize / BlockSize;
-
- if (!(Media->MediaPresent)) {
- Status = EFI_NO_MEDIA;
- goto Done;
- }
-
- if (MediaId != Media->MediaId) {
- Status = EFI_MEDIA_CHANGED;
- goto Done;
- }
-
- if (BufferSize % BlockSize != 0) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto Done;
- }
-
- if (LBA > Media->LastBlock) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if ((Media->IoAlign > 1) && (((UINTN) Buffer & (Media->IoAlign - 1)) != 0)) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- //
- // if all the parameters are valid, then perform read sectors command
- // to transfer data from device to host.
- //
- Status = ScsiDiskReadSectors (ScsiDiskDevice, Buffer, LBA, NumberOfBlocks);
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-ScsiDiskWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- MediaId - TODO: add argument description
- LBA - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_NO_MEDIA - TODO: Add description for return value
- EFI_MEDIA_CHANGED - TODO: Add description for return value
- EFI_BAD_BUFFER_SIZE - TODO: Add description for return value
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_INVALID_PARAMETER - TODO: Add description for return value
- EFI_INVALID_PARAMETER - TODO: Add description for return value
-
---*/
-{
- SCSI_DISK_DEV *ScsiDiskDevice;
- EFI_BLOCK_IO_MEDIA *Media;
- EFI_STATUS Status;
- UINTN BlockSize;
- UINTN NumberOfBlocks;
- BOOLEAN MediaChange;
- EFI_TPL OldTpl;
-
- MediaChange = FALSE;
- if (!Buffer) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This);
-
- if (!IsDeviceFixed (ScsiDiskDevice)) {
-
- Status = ScsiDiskDetectMedia (ScsiDiskDevice, FALSE, &MediaChange);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- if (MediaChange) {
- gBS->ReinstallProtocolInterface (
- ScsiDiskDevice->Handle,
- &gEfiBlockIoProtocolGuid,
- &ScsiDiskDevice->BlkIo,
- &ScsiDiskDevice->BlkIo
- );
- }
- }
- //
- // Get the intrinsic block size
- //
- Media = ScsiDiskDevice->BlkIo.Media;
- BlockSize = Media->BlockSize;
-
- NumberOfBlocks = BufferSize / BlockSize;
-
- if (!(Media->MediaPresent)) {
- Status = EFI_NO_MEDIA;
- goto Done;
- }
-
- if (MediaId != Media->MediaId) {
- Status = EFI_MEDIA_CHANGED;
- goto Done;
- }
-
- if (BufferSize % BlockSize != 0) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto Done;
- }
-
- if (LBA > Media->LastBlock) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if ((Media->IoAlign > 1) && (((UINTN) Buffer & (Media->IoAlign - 1)) != 0)) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
- //
- // if all the parameters are valid, then perform read sectors command
- // to transfer data from device to host.
- //
- Status = ScsiDiskWriteSectors (ScsiDiskDevice, Buffer, LBA, NumberOfBlocks);
-
-Done:
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-ScsiDiskFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- //
- // return directly
- //
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ScsiDiskDetectMedia (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN MustReadCapacity,
- BOOLEAN *MediaChange
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- MustReadCapacity - TODO: add argument description
- MediaChange - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS ReadCapacityStatus;
- EFI_SCSI_SENSE_DATA *SenseData;
- UINTN NumberOfSenseKeys;
- BOOLEAN NeedRetry;
- BOOLEAN NeedReadCapacity;
- UINT8 Index;
- UINT8 MaxRetry;
- EFI_BLOCK_IO_MEDIA OldMedia;
- UINTN Action;
-
- Status = EFI_SUCCESS;
- ReadCapacityStatus = EFI_SUCCESS;
- SenseData = NULL;
- NumberOfSenseKeys = 0;
- NeedReadCapacity = FALSE;
- CopyMem (&OldMedia, ScsiDiskDevice->BlkIo.Media, sizeof (OldMedia));
- // OldMedia = *(ScsiDiskDevice->BlkIo.Media);
-
- *MediaChange = FALSE;
-
- MaxRetry = 3;
- for (Index = 0; Index < MaxRetry; Index++) {
- Status = ScsiDiskTestUnitReady (
- ScsiDiskDevice,
- &NeedRetry,
- &SenseData,
- &NumberOfSenseKeys
- );
- if (!EFI_ERROR (Status)) {
- break;
- }
-
- if (!NeedRetry) {
- return Status;
- }
- }
-
- if ((Index == MaxRetry) && EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = DetectMediaParsingSenseKeys (
- ScsiDiskDevice,
- SenseData,
- NumberOfSenseKeys,
- &Action
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // ACTION_NO_ACTION: need not read capacity
- // other action code: need read capacity
- //
- if (Action == ACTION_NO_ACTION) {
- NeedReadCapacity = FALSE;
- } else {
- NeedReadCapacity = TRUE;
- }
-
- //
- // either NeedReadCapacity is TRUE, or MustReadCapacity is TRUE,
- // retrieve capacity via Read Capacity command
- //
- if (NeedReadCapacity || MustReadCapacity) {
-
- //
- // retrieve media information
- //
- MaxRetry = 3;
- for (Index = 0; Index < MaxRetry; Index++) {
-
- ReadCapacityStatus = ScsiDiskReadCapacity (
- ScsiDiskDevice,
- &NeedRetry,
- &SenseData,
- &NumberOfSenseKeys
- );
- if (EFI_ERROR (ReadCapacityStatus) && !NeedRetry) {
- return EFI_DEVICE_ERROR;
- }
- //
- // analyze sense key to action
- //
- Status = DetectMediaParsingSenseKeys (
- ScsiDiskDevice,
- SenseData,
- NumberOfSenseKeys,
- &Action
- );
- //
- // if Status is error, it may indicate crisis error,
- // so return without retry.
- //
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- switch (Action) {
- case ACTION_NO_ACTION:
- //
- // no retry
- //
- Index = MaxRetry;
- break;
-
- case ACTION_RETRY_COMMAND_LATER:
- //
- // retry the ReadCapacity later and continuously, until the condition
- // no longer emerges.
- // stall time is 100000us, or say 0.1 second.
- //
- gBS->Stall (100000);
- Index = 0;
- break;
-
- default:
- //
- // other cases, just retry the command
- //
- break;
- }
- }
-
- if ((Index == MaxRetry) && EFI_ERROR (ReadCapacityStatus)) {
- return EFI_DEVICE_ERROR;
- }
- }
-
- if (ScsiDiskDevice->BlkIo.Media->MediaId != OldMedia.MediaId) {
- //
- // Media change information got from the device
- //
- *MediaChange = TRUE;
- }
-
- if (ScsiDiskDevice->BlkIo.Media->ReadOnly != OldMedia.ReadOnly) {
- *MediaChange = TRUE;
- ScsiDiskDevice->BlkIo.Media->MediaId += 1;
- }
-
- if (ScsiDiskDevice->BlkIo.Media->BlockSize != OldMedia.BlockSize) {
- *MediaChange = TRUE;
- ScsiDiskDevice->BlkIo.Media->MediaId += 1;
- }
-
- if (ScsiDiskDevice->BlkIo.Media->LastBlock != OldMedia.LastBlock) {
- *MediaChange = TRUE;
- ScsiDiskDevice->BlkIo.Media->MediaId += 1;
- }
-
- if (ScsiDiskDevice->BlkIo.Media->MediaPresent != OldMedia.MediaPresent) {
- if (ScsiDiskDevice->BlkIo.Media->MediaPresent) {
- //
- // when change from no media to media present, reset the MediaId to 1.
- //
- ScsiDiskDevice->BlkIo.Media->MediaId = 1;
- } else {
- //
- // when no media, reset the MediaId to zero.
- //
- ScsiDiskDevice->BlkIo.Media->MediaId = 0;
- }
-
- *MediaChange = TRUE;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ScsiDiskInquiryDevice (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- NeedRetry - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
-
---*/
-{
- UINT32 InquiryDataLength;
- UINT8 SenseDataLength;
- UINT8 HostAdapterStatus;
- UINT8 TargetStatus;
- EFI_SCSI_SENSE_DATA *SenseDataArray;
- UINTN NumberOfSenseKeys;
- EFI_STATUS Status;
- UINT8 MaxRetry;
- UINT8 Index;
-
- InquiryDataLength = sizeof (EFI_SCSI_INQUIRY_DATA);
- SenseDataLength = 0;
-
- Status = SubmitInquiryCommand (
- ScsiDiskDevice->ScsiIo,
- EfiScsiStallSeconds (1),
- NULL,
- &SenseDataLength,
- &HostAdapterStatus,
- &TargetStatus,
- (VOID *) &(ScsiDiskDevice->InquiryData),
- &InquiryDataLength,
- FALSE
- );
- if ((Status == EFI_SUCCESS) || (Status == EFI_WARN_BUFFER_TOO_SMALL)) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- ParseInquiryData (ScsiDiskDevice);
- return EFI_SUCCESS;
- } else if (Status == EFI_NOT_READY) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- } else if ((Status == EFI_INVALID_PARAMETER) || (Status == EFI_UNSUPPORTED)) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
- }
- //
- // go ahead to check HostAdapterStatus and TargetStatus
- // (EFI_TIMEOUT, EFI_DEVICE_ERROR)
- //
- Status = CheckHostAdapterStatus (HostAdapterStatus);
- if ((Status == EFI_TIMEOUT) || (Status == EFI_NOT_READY)) {
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- } else if (Status == EFI_DEVICE_ERROR) {
- //
- // reset the scsi channel
- //
- ScsiDiskDevice->ScsiIo->ResetBus (ScsiDiskDevice->ScsiIo);
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
- }
-
- Status = CheckTargetStatus (TargetStatus);
- if (Status == EFI_NOT_READY) {
- //
- // reset the scsi device
- //
- ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo);
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- } else if (Status == EFI_DEVICE_ERROR) {
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
- }
-
- //
- // if goes here, meant SubmitInquiryCommand() failed.
- // if ScsiDiskRequestSenseKeys() succeeds at last,
- // better retry SubmitInquiryCommand(). (by setting *NeedRetry = TRUE)
- //
- MaxRetry = 3;
- for (Index = 0; Index < MaxRetry; Index++) {
-
- Status = ScsiDiskRequestSenseKeys (
- ScsiDiskDevice,
- NeedRetry,
- &SenseDataArray,
- &NumberOfSenseKeys,
- TRUE
- );
- if (!EFI_ERROR (Status)) {
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- }
-
- if (!*NeedRetry) {
- return EFI_DEVICE_ERROR;
- }
- }
- //
- // ScsiDiskRequestSenseKeys() failed after several rounds of retry.
- // set *NeedRetry = FALSE to avoid the outside caller try again.
- //
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
-}
-
-EFI_STATUS
-ScsiDiskTestUnitReady (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry,
- EFI_SCSI_SENSE_DATA **SenseDataArray,
- UINTN *NumberOfSenseKeys
- )
-// TODO: function comment should start with '/*++'
-/*
- When Test Unit Ready command succeeds,
- retrieve Sense Keys via Request Sense;
- When Test Unit Ready command encounters any error caused by host adapter or
- target, return error without retrieving Sense Keys.
-*/
-// TODO: function comment should end with '--*/'
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: function comment is missing 'Returns:'
-// TODO: ScsiDiskDevice - add argument and description to function comment
-// TODO: NeedRetry - add argument and description to function comment
-// TODO: SenseDataArray - add argument and description to function comment
-// TODO: NumberOfSenseKeys - add argument and description to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-{
- EFI_STATUS Status;
- UINT8 SenseDataLength;
- UINT8 HostAdapterStatus;
- UINT8 TargetStatus;
- UINT8 Index;
- UINT8 MaxRetry;
-
- SenseDataLength = 0;
- *NumberOfSenseKeys = 0;
-
- //
- // Parameter 3 and 4: do not require sense data, retrieve it when needed.
- //
- Status = SubmitTestUnitReadyCommand (
- ScsiDiskDevice->ScsiIo,
- EfiScsiStallSeconds (1),
- NULL,
- &SenseDataLength,
- &HostAdapterStatus,
- &TargetStatus
- );
- if (Status == EFI_NOT_READY) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- } else if ((Status == EFI_INVALID_PARAMETER) || (Status == EFI_UNSUPPORTED)) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
- }
- //
- // go ahead to check HostAdapterStatus and TargetStatus
- //
- Status = CheckHostAdapterStatus (HostAdapterStatus);
- if ((Status == EFI_TIMEOUT) || (Status == EFI_NOT_READY)) {
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- } else if (Status == EFI_DEVICE_ERROR) {
- //
- // reset the scsi channel
- //
- ScsiDiskDevice->ScsiIo->ResetBus (ScsiDiskDevice->ScsiIo);
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
- }
-
- Status = CheckTargetStatus (TargetStatus);
- if (Status == EFI_NOT_READY) {
- //
- // reset the scsi device
- //
- ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo);
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- } else if (Status == EFI_DEVICE_ERROR) {
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
- }
-
- MaxRetry = 3;
- for (Index = 0; Index < MaxRetry; Index++) {
-
- Status = ScsiDiskRequestSenseKeys (
- ScsiDiskDevice,
- NeedRetry,
- SenseDataArray,
- NumberOfSenseKeys,
- FALSE
- );
- if (!EFI_ERROR (Status)) {
- return EFI_SUCCESS;
- }
-
- if (!*NeedRetry) {
- return EFI_DEVICE_ERROR;
- }
- }
- //
- // ScsiDiskRequestSenseKeys() failed after several rounds of retry.
- // set *NeedRetry = FALSE to avoid the outside caller try again.
- //
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
-}
-
-EFI_STATUS
-DetectMediaParsingSenseKeys (
- SCSI_DISK_DEV *ScsiDiskDevice,
- EFI_SCSI_SENSE_DATA *SenseData,
- UINTN NumberOfSenseKeys,
- UINTN *Action
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- SenseData - TODO: add argument description
- NumberOfSenseKeys - TODO: add argument description
- Action - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- BOOLEAN RetryLater;
-
- //
- // Default is to read capacity, unless..
- //
- *Action = ACTION_READ_CAPACITY;
-
- if (NumberOfSenseKeys == 0) {
- *Action = ACTION_NO_ACTION;
- return EFI_SUCCESS;
- }
-
- if (!ScsiDiskHaveSenseKey (SenseData, NumberOfSenseKeys)) {
- //
- // No Sense Key returned from last submitted command
- //
- *Action = ACTION_NO_ACTION;
- return EFI_SUCCESS;
- }
-
- if (ScsiDiskIsNoMedia (SenseData, NumberOfSenseKeys)) {
- ScsiDiskDevice->BlkIo.Media->MediaPresent = FALSE;
- ScsiDiskDevice->BlkIo.Media->LastBlock = 0;
- *Action = ACTION_NO_ACTION;
- return EFI_SUCCESS;
- }
-
- if (ScsiDiskIsMediaChange (SenseData, NumberOfSenseKeys)) {
- ScsiDiskDevice->BlkIo.Media->MediaId++;
- return EFI_SUCCESS;
- }
-
- if (ScsiDiskIsMediaError (SenseData, NumberOfSenseKeys)) {
- ScsiDiskDevice->BlkIo.Media->MediaPresent = FALSE;
- ScsiDiskDevice->BlkIo.Media->LastBlock = 0;
- return EFI_DEVICE_ERROR;
- }
-
- if (ScsiDiskIsHardwareError (SenseData, NumberOfSenseKeys)) {
- return EFI_DEVICE_ERROR;
- }
-
- if (!ScsiDiskIsDriveReady (SenseData, NumberOfSenseKeys, &RetryLater)) {
- if (RetryLater) {
- *Action = ACTION_RETRY_COMMAND_LATER;
- return EFI_SUCCESS;
- }
-
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ScsiDiskReadCapacity (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry,
- EFI_SCSI_SENSE_DATA **SenseDataArray,
- UINTN *NumberOfSenseKeys
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- NeedRetry - TODO: add argument description
- SenseDataArray - TODO: add argument description
- NumberOfSenseKeys - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
-
---*/
-{
- EFI_SCSI_DISK_CAPACITY_DATA CapacityData;
- UINT32 DataLength;
- UINT8 HostAdapterStatus;
- UINT8 TargetStatus;
- EFI_STATUS CommandStatus;
- EFI_STATUS Status;
- UINT8 Index;
- UINT8 MaxRetry;
- UINT8 SenseDataLength;
-
- SenseDataLength = 0;
- ZeroMem (&CapacityData, sizeof (EFI_SCSI_DISK_CAPACITY_DATA));
- DataLength = sizeof (EFI_SCSI_DISK_CAPACITY_DATA);
-
- *NumberOfSenseKeys = 0;
- *NeedRetry = FALSE;
- //
- // submit Read Capacity Command. in this call,not request sense data
- //
- CommandStatus = SubmitReadCapacityCommand (
- ScsiDiskDevice->ScsiIo,
- EfiScsiStallSeconds (1),
- NULL,
- &SenseDataLength,
- &HostAdapterStatus,
- &TargetStatus,
- (VOID *) &CapacityData,
- &DataLength,
- FALSE
- );
- if (CommandStatus == EFI_SUCCESS) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- GetMediaInfo (ScsiDiskDevice, &CapacityData);
- return EFI_SUCCESS;
- } else if (CommandStatus == EFI_NOT_READY) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- } else if ((CommandStatus == EFI_INVALID_PARAMETER) || (CommandStatus == EFI_UNSUPPORTED)) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
- }
- //
- // go ahead to check HostAdapterStatus and TargetStatus
- // (EFI_TIMEOUT, EFI_DEVICE_ERROR, EFI_WARN_BUFFER_TOO_SMALL)
- //
-
- Status = CheckHostAdapterStatus (HostAdapterStatus);
- if ((Status == EFI_TIMEOUT) || (Status == EFI_NOT_READY)) {
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- } else if (Status == EFI_DEVICE_ERROR) {
- //
- // reset the scsi channel
- //
- ScsiDiskDevice->ScsiIo->ResetBus (ScsiDiskDevice->ScsiIo);
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
- }
-
- Status = CheckTargetStatus (TargetStatus);
- if (Status == EFI_NOT_READY) {
- //
- // reset the scsi device
- //
- ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo);
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- } else if (Status == EFI_DEVICE_ERROR) {
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
- }
-
- //
- // if goes here, meant SubmitReadCapacityCommand() failed.
- // if ScsiDiskRequestSenseKeys() succeeds at last,
- // better retry SubmitReadCapacityCommand(). (by setting *NeedRetry = TRUE)
- //
- MaxRetry = 3;
- for (Index = 0; Index < MaxRetry; Index++) {
-
- Status = ScsiDiskRequestSenseKeys (
- ScsiDiskDevice,
- NeedRetry,
- SenseDataArray,
- NumberOfSenseKeys,
- TRUE
- );
- if (!EFI_ERROR (Status)) {
- *NeedRetry = TRUE;
- return EFI_DEVICE_ERROR;
- }
-
- if (!*NeedRetry) {
- return EFI_DEVICE_ERROR;
- }
- }
- //
- // ScsiDiskRequestSenseKeys() failed after several rounds of retry.
- // set *NeedRetry = FALSE to avoid the outside caller try again.
- //
- *NeedRetry = FALSE;
- return EFI_DEVICE_ERROR;
-}
-
-EFI_STATUS
-CheckHostAdapterStatus (
- UINT8 HostAdapterStatus
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- HostAdapterStatus - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
- EFI_TIMEOUT - TODO: Add description for return value
- EFI_NOT_READY - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- switch (HostAdapterStatus) {
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_OK:
- return EFI_SUCCESS;
-
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT:
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT:
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND:
- return EFI_TIMEOUT;
-
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_MESSAGE_REJECT:
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_PARITY_ERROR:
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED:
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN:
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_RESET:
- return EFI_NOT_READY;
-
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_FREE:
- case EFI_SCSI_IO_STATUS_HOST_ADAPTER_PHASE_ERROR:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_SUCCESS;
- }
-}
-
-EFI_STATUS
-CheckTargetStatus (
- UINT8 TargetStatus
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- TargetStatus - TODO: add argument description
-
-Returns:
-
- EFI_SUCCESS - TODO: Add description for return value
- EFI_NOT_READY - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- switch (TargetStatus) {
- case EFI_SCSI_IO_STATUS_TARGET_GOOD:
- case EFI_SCSI_IO_STATUS_TARGET_CHECK_CONDITION:
- case EFI_SCSI_IO_STATUS_TARGET_CONDITION_MET:
- return EFI_SUCCESS;
-
- case EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE:
- case EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE_CONDITION_MET:
- case EFI_SCSI_IO_STATUS_TARGET_BUSY:
- case EFI_SCSI_IO_STATUS_TARGET_COMMOND_TERMINATED:
- case EFI_SCSI_IO_STATUS_TARGET_QUEUE_FULL:
- return EFI_NOT_READY;
-
- case EFI_SCSI_IO_STATUS_TARGET_RESERVATION_CONFLICT:
- return EFI_DEVICE_ERROR;
- break;
-
- default:
- return EFI_SUCCESS;
- }
-}
-
-EFI_STATUS
-ScsiDiskRequestSenseKeys (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry,
- EFI_SCSI_SENSE_DATA **SenseDataArray,
- UINTN *NumberOfSenseKeys,
- BOOLEAN AskResetIfError
- )
-// TODO: function comment should start with '/*++'
-/*
- Retrieve all sense keys from the device.
- When encountering error during the process,
- if retrieve sense keys before error encounterred,
- return the sense keys with return status set to EFI_SUCCESS,
- and NeedRetry set to FALSE; otherwize, return the proper return
- status.
-*/
-// TODO: function comment should end with '--*/'
-// TODO: function comment is missing 'Routine Description:'
-// TODO: function comment is missing 'Arguments:'
-// TODO: function comment is missing 'Returns:'
-// TODO: ScsiDiskDevice - add argument and description to function comment
-// TODO: NeedRetry - add argument and description to function comment
-// TODO: SenseDataArray - add argument and description to function comment
-// TODO: NumberOfSenseKeys - add argument and description to function comment
-// TODO: AskResetIfError - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_SCSI_SENSE_DATA *PtrSenseData;
- UINT8 SenseDataLength;
- BOOLEAN SenseReq;
- EFI_STATUS Status;
- EFI_STATUS FallStatus;
- UINT8 HostAdapterStatus;
- UINT8 TargetStatus;
-
- FallStatus = EFI_SUCCESS;
- SenseDataLength = sizeof (EFI_SCSI_SENSE_DATA);
-
- ZeroMem (
- ScsiDiskDevice->SenseData,
- sizeof (EFI_SCSI_SENSE_DATA) * (ScsiDiskDevice->SenseDataNumber)
- );
-
- *NumberOfSenseKeys = 0;
- *SenseDataArray = ScsiDiskDevice->SenseData;
- PtrSenseData = ScsiDiskDevice->SenseData;
-
- for (SenseReq = TRUE; SenseReq;) {
-
- Status = SubmitRequestSenseCommand (
- ScsiDiskDevice->ScsiIo,
- EfiScsiStallSeconds (2),
- PtrSenseData,
- &SenseDataLength,
- &HostAdapterStatus,
- &TargetStatus
- );
- if ((Status == EFI_SUCCESS) || (Status == EFI_WARN_BUFFER_TOO_SMALL)) {
- FallStatus = EFI_SUCCESS;
- } else if ((Status == EFI_TIMEOUT) || (Status == EFI_NOT_READY)) {
- *NeedRetry = TRUE;
- FallStatus = EFI_DEVICE_ERROR;
- } else if ((Status == EFI_INVALID_PARAMETER) || (Status == EFI_UNSUPPORTED)) {
- *NeedRetry = FALSE;
- FallStatus = EFI_DEVICE_ERROR;
- } else if (Status == EFI_DEVICE_ERROR) {
- if (AskResetIfError) {
- ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo);
- }
-
- FallStatus = EFI_DEVICE_ERROR;
- }
-
- if (EFI_ERROR (FallStatus)) {
- if (*NumberOfSenseKeys != 0) {
- *NeedRetry = FALSE;
- return EFI_SUCCESS;
- } else {
- return EFI_DEVICE_ERROR;
- }
- }
-
- (*NumberOfSenseKeys) += 1;
-
- //
- // no more sense key or number of sense keys exceeds predefined,
- // skip the loop.
- //
- if ((PtrSenseData->Sense_Key == EFI_SCSI_SK_NO_SENSE) ||
- (*NumberOfSenseKeys == ScsiDiskDevice->SenseDataNumber)) {
- SenseReq = FALSE;
- }
-
- PtrSenseData += 1;
-
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-GetMediaInfo (
- SCSI_DISK_DEV *ScsiDiskDevice,
- EFI_SCSI_DISK_CAPACITY_DATA *Capacity
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- Capacity - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- ScsiDiskDevice->BlkIo.Media->LastBlock = (Capacity->LastLba3 << 24) |
- (Capacity->LastLba2 << 16) |
- (Capacity->LastLba1 << 8) |
- Capacity->LastLba0;
-
- ScsiDiskDevice->BlkIo.Media->MediaPresent = TRUE;
- ScsiDiskDevice->BlkIo.Media->BlockSize = (Capacity->BlockSize3 << 24) |
- (Capacity->BlockSize2 << 16) |
- (Capacity->BlockSize1 << 8) |
- Capacity->BlockSize0;
- if (ScsiDiskDevice->DeviceType == EFI_SCSI_TYPE_DISK) {
- ScsiDiskDevice->BlkIo.Media->BlockSize = 0x200;
- }
-
- if (ScsiDiskDevice->DeviceType == EFI_SCSI_TYPE_CDROM) {
- ScsiDiskDevice->BlkIo.Media->BlockSize = 0x800;
- }
-}
-
-VOID
-ParseInquiryData (
- SCSI_DISK_DEV *ScsiDiskDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- ScsiDiskDevice->FixedDevice = (BOOLEAN) (ScsiDiskDevice->InquiryData.RMB ? 0 : 1);
- ScsiDiskDevice->BlkIoMedia.RemovableMedia = (BOOLEAN) (!ScsiDiskDevice->FixedDevice);
-}
-
-EFI_STATUS
-ScsiDiskReadSectors (
- SCSI_DISK_DEV *ScsiDiskDevice,
- VOID *Buffer,
- EFI_LBA Lba,
- UINTN NumberOfBlocks
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- Buffer - TODO: add argument description
- Lba - TODO: add argument description
- NumberOfBlocks - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UINTN BlocksRemaining;
- UINT32 Lba32;
- UINT8 *PtrBuffer;
- UINT32 BlockSize;
- UINT32 ByteCount;
- UINT32 MaxBlock;
- UINT32 SectorCount;
- UINT64 Timeout;
- EFI_STATUS Status;
- UINT8 Index;
- UINT8 MaxRetry;
- BOOLEAN NeedRetry;
- EFI_SCSI_SENSE_DATA *SenseData;
- UINTN NumberOfSenseKeys;
-
- SenseData = NULL;
- NumberOfSenseKeys = 0;
-
- Status = EFI_SUCCESS;
-
- BlocksRemaining = NumberOfBlocks;
- BlockSize = ScsiDiskDevice->BlkIo.Media->BlockSize;
- //
- // limit the data bytes that can be transferred by one Read(10) Command
- //
- MaxBlock = 65536;
-
- PtrBuffer = Buffer;
- Lba32 = (UINT32) Lba;
-
- while (BlocksRemaining > 0) {
-
- if (BlocksRemaining <= MaxBlock) {
-
- SectorCount = (UINT16) BlocksRemaining;
- } else {
-
- SectorCount = MaxBlock;
- }
-
- ByteCount = SectorCount * BlockSize;
- Timeout = EfiScsiStallSeconds (2);
-
- MaxRetry = 2;
- for (Index = 0; Index < MaxRetry; Index++) {
-
- Status = ScsiDiskRead10 (
- ScsiDiskDevice,
- &NeedRetry,
- &SenseData,
- &NumberOfSenseKeys,
- Timeout,
- PtrBuffer,
- &ByteCount,
- Lba32,
- SectorCount
- );
- if (!EFI_ERROR (Status)) {
- break;
- }
-
- if (!NeedRetry) {
- return EFI_DEVICE_ERROR;
- }
-
- }
-
- if ((Index == MaxRetry) && (Status != EFI_SUCCESS)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // actual transferred sectors
- //
- SectorCount = ByteCount / BlockSize;
-
- Lba32 += SectorCount;
- PtrBuffer = PtrBuffer + SectorCount * BlockSize;
- BlocksRemaining -= SectorCount;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ScsiDiskWriteSectors (
- SCSI_DISK_DEV *ScsiDiskDevice,
- VOID *Buffer,
- EFI_LBA Lba,
- UINTN NumberOfBlocks
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- Buffer - TODO: add argument description
- Lba - TODO: add argument description
- NumberOfBlocks - TODO: add argument description
-
-Returns:
-
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_DEVICE_ERROR - TODO: Add description for return value
- EFI_SUCCESS - TODO: Add description for return value
-
---*/
-{
- UINTN BlocksRemaining;
- UINT32 Lba32;
- UINT8 *PtrBuffer;
- UINT32 BlockSize;
- UINT32 ByteCount;
- UINT32 MaxBlock;
- UINT32 SectorCount;
- UINT64 Timeout;
- EFI_STATUS Status;
- UINT8 Index;
- UINT8 MaxRetry;
- BOOLEAN NeedRetry;
- EFI_SCSI_SENSE_DATA *SenseData;
- UINTN NumberOfSenseKeys;
-
- SenseData = NULL;
- NumberOfSenseKeys = 0;
-
- Status = EFI_SUCCESS;
-
- BlocksRemaining = NumberOfBlocks;
- BlockSize = ScsiDiskDevice->BlkIo.Media->BlockSize;
- //
- // limit the data bytes that can be transferred by one Write(10) Command
- //
- MaxBlock = 65536;
-
- PtrBuffer = Buffer;
- Lba32 = (UINT32) Lba;
-
- while (BlocksRemaining > 0) {
-
- if (BlocksRemaining <= MaxBlock) {
-
- SectorCount = (UINT16) BlocksRemaining;
- } else {
-
- SectorCount = MaxBlock;
- }
-
- ByteCount = SectorCount * BlockSize;
- Timeout = EfiScsiStallSeconds (2);
- MaxRetry = 2;
- for (Index = 0; Index < MaxRetry; Index++) {
- Status = ScsiDiskWrite10 (
- ScsiDiskDevice,
- &NeedRetry,
- &SenseData,
- &NumberOfSenseKeys,
- Timeout,
- PtrBuffer,
- &ByteCount,
- Lba32,
- SectorCount
- );
- if (!EFI_ERROR (Status)) {
- break;
- }
-
- if (!NeedRetry) {
- return EFI_DEVICE_ERROR;
- }
- }
-
- if ((Index == MaxRetry) && (Status != EFI_SUCCESS)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // actual transferred sectors
- //
- SectorCount = ByteCount / BlockSize;
-
- Lba32 += SectorCount;
- PtrBuffer = PtrBuffer + SectorCount * BlockSize;
- BlocksRemaining -= SectorCount;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ScsiDiskRead10 (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry,
- EFI_SCSI_SENSE_DATA **SenseDataArray,
- UINTN *NumberOfSenseKeys,
- UINT64 Timeout,
- UINT8 *DataBuffer,
- UINT32 *DataLength,
- UINT32 StartLba,
- UINT32 SectorSize
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- NeedRetry - TODO: add argument description
- SenseDataArray - TODO: add argument description
- NumberOfSenseKeys - TODO: add argument description
- Timeout - TODO: add argument description
- DataBuffer - TODO: add argument description
- DataLength - TODO: add argument description
- StartLba - TODO: add argument description
- SectorSize - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- UINT8 SenseDataLength;
- EFI_STATUS Status;
- UINT8 HostAdapterStatus;
- UINT8 TargetStatus;
-
- *NeedRetry = FALSE;
- *NumberOfSenseKeys = 0;
- SenseDataLength = 0;
- Status = SubmitRead10Command (
- ScsiDiskDevice->ScsiIo,
- Timeout,
- NULL,
- &SenseDataLength,
- &HostAdapterStatus,
- &TargetStatus,
- DataBuffer,
- DataLength,
- StartLba,
- SectorSize
- );
- return Status;
-}
-
-EFI_STATUS
-ScsiDiskWrite10 (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry,
- EFI_SCSI_SENSE_DATA **SenseDataArray,
- UINTN *NumberOfSenseKeys,
- UINT64 Timeout,
- UINT8 *DataBuffer,
- UINT32 *DataLength,
- UINT32 StartLba,
- UINT32 SectorSize
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- NeedRetry - TODO: add argument description
- SenseDataArray - TODO: add argument description
- NumberOfSenseKeys - TODO: add argument description
- Timeout - TODO: add argument description
- DataBuffer - TODO: add argument description
- DataLength - TODO: add argument description
- StartLba - TODO: add argument description
- SectorSize - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_STATUS Status;
- UINT8 SenseDataLength;
- UINT8 HostAdapterStatus;
- UINT8 TargetStatus;
-
- *NeedRetry = FALSE;
- *NumberOfSenseKeys = 0;
- SenseDataLength = 0;
- Status = SubmitWrite10Command (
- ScsiDiskDevice->ScsiIo,
- Timeout,
- NULL,
- &SenseDataLength,
- &HostAdapterStatus,
- &TargetStatus,
- DataBuffer,
- DataLength,
- StartLba,
- SectorSize
- );
- return Status;
-}
-
-BOOLEAN
-ScsiDiskIsNoMedia (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_SCSI_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN IsNoMedia;
-
- IsNoMedia = FALSE;
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
-
- //
- // Sense Key is EFI_SCSI_SK_NOT_READY (0x2),
- // Additional Sense Code is ASC_NO_MEDIA (0x3A)
- //
- if ((SensePtr->Sense_Key == EFI_SCSI_SK_NOT_READY) &&
- (SensePtr->Addnl_Sense_Code == EFI_SCSI_ASC_NO_MEDIA)) {
- IsNoMedia = TRUE;
- }
-
- SensePtr++;
- }
-
- return IsNoMedia;
-}
-
-BOOLEAN
-ScsiDiskIsMediaError (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_SCSI_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN IsError;
-
- IsError = FALSE;
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
-
- switch (SensePtr->Sense_Key) {
-
- case EFI_SCSI_SK_MEDIUM_ERROR:
- //
- // Sense Key is EFI_SCSI_SK_MEDIUM_ERROR (0x3)
- //
- switch (SensePtr->Addnl_Sense_Code) {
-
- //
- // fall through
- //
- case EFI_SCSI_ASC_MEDIA_ERR1:
-
- //
- // fall through
- //
- case EFI_SCSI_ASC_MEDIA_ERR2:
-
- //
- // fall through
- //
- case EFI_SCSI_ASC_MEDIA_ERR3:
- case EFI_SCSI_ASC_MEDIA_ERR4:
- IsError = TRUE;
- break;
-
- default:
- break;
- }
-
- break;
-
- case EFI_SCSI_SK_NOT_READY:
- //
- // Sense Key is EFI_SCSI_SK_NOT_READY (0x2)
- //
- switch (SensePtr->Addnl_Sense_Code) {
- //
- // Additional Sense Code is ASC_MEDIA_UPSIDE_DOWN (0x6)
- //
- case EFI_SCSI_ASC_MEDIA_UPSIDE_DOWN:
- IsError = TRUE;
- break;
-
- default:
- break;
- }
- break;
-
- default:
- break;
- }
-
- SensePtr++;
- }
-
- return IsError;
-}
-
-BOOLEAN
-ScsiDiskIsHardwareError (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_SCSI_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN IsError;
-
- IsError = FALSE;
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
-
- //
- // Sense Key is EFI_SCSI_SK_HARDWARE_ERROR (0x4)
- //
- if (SensePtr->Sense_Key == EFI_SCSI_SK_HARDWARE_ERROR) {
- IsError = TRUE;
- }
-
- SensePtr++;
- }
-
- return IsError;
-}
-
-BOOLEAN
-ScsiDiskIsMediaChange (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_SCSI_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN IsMediaChanged;
-
- IsMediaChanged = FALSE;
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
- //
- // Sense Key is EFI_SCSI_SK_UNIT_ATTENTION (0x6),
- // Additional sense code is EFI_SCSI_ASC_MEDIA_CHANGE (0x28)
- //
- if ((SensePtr->Sense_Key == EFI_SCSI_SK_UNIT_ATTENTION) &&
- (SensePtr->Addnl_Sense_Code == EFI_SCSI_ASC_MEDIA_CHANGE)) {
- IsMediaChanged = TRUE;
- }
-
- SensePtr++;
- }
-
- return IsMediaChanged;
-}
-
-BOOLEAN
-ScsiDiskIsResetBefore (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_SCSI_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN IsResetBefore;
-
- IsResetBefore = FALSE;
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
-
- //
- // Sense Key is EFI_SCSI_SK_UNIT_ATTENTION (0x6)
- // Additional Sense Code is EFI_SCSI_ASC_RESET (0x29)
- //
- if ((SensePtr->Sense_Key == EFI_SCSI_SK_UNIT_ATTENTION) &&
- (SensePtr->Addnl_Sense_Code == EFI_SCSI_ASC_RESET)) {
- IsResetBefore = TRUE;
- }
-
- SensePtr++;
- }
-
- return IsResetBefore;
-}
-
-BOOLEAN
-ScsiDiskIsDriveReady (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts,
- OUT BOOLEAN *RetryLater
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
- RetryLater - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_SCSI_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN IsReady;
-
- IsReady = TRUE;
- *RetryLater = FALSE;
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
-
- switch (SensePtr->Sense_Key) {
-
- case EFI_SCSI_SK_NOT_READY:
- //
- // Sense Key is EFI_SCSI_SK_NOT_READY (0x2)
- //
- switch (SensePtr->Addnl_Sense_Code) {
- case EFI_SCSI_ASC_NOT_READY:
- //
- // Additional Sense Code is EFI_SCSI_ASC_NOT_READY (0x4)
- //
- switch (SensePtr->Addnl_Sense_Code_Qualifier) {
- case EFI_SCSI_ASCQ_IN_PROGRESS:
- //
- // Additional Sense Code Qualifier is
- // EFI_SCSI_ASCQ_IN_PROGRESS (0x1)
- //
- IsReady = FALSE;
- *RetryLater = TRUE;
- break;
-
- default:
- IsReady = FALSE;
- *RetryLater = FALSE;
- break;
- }
- break;
-
- default:
- break;
- }
- break;
-
- default:
- break;
- }
-
- SensePtr++;
- }
-
- return IsReady;
-}
-
-BOOLEAN
-ScsiDiskHaveSenseKey (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- EFI_SCSI_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN HaveSenseKey;
-
- if (SenseCounts == 0) {
- HaveSenseKey = FALSE;
- } else {
- HaveSenseKey = TRUE;
- }
-
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
-
- //
- // Sense Key is SK_NO_SENSE (0x0)
- //
- if ((SensePtr->Sense_Key == EFI_SCSI_SK_NO_SENSE) &&
- (Index == 0)) {
- HaveSenseKey = FALSE;
- }
-
- SensePtr++;
- }
-
- return HaveSenseKey;
-}
-
-VOID
-ReleaseScsiDiskDeviceResources (
- IN SCSI_DISK_DEV *ScsiDiskDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-{
- if (ScsiDiskDevice == NULL) {
- return ;
- }
-
- if (ScsiDiskDevice->SenseData != NULL) {
- gBS->FreePool (ScsiDiskDevice->SenseData);
- ScsiDiskDevice->SenseData = NULL;
- }
-
- if (ScsiDiskDevice->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (ScsiDiskDevice->ControllerNameTable);
- ScsiDiskDevice->ControllerNameTable = NULL;
- }
-
- gBS->FreePool (ScsiDiskDevice);
-
- ScsiDiskDevice = NULL;
-}
diff --git a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.h b/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.h
deleted file mode 100644
index 675c643..0000000
--- a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.h
+++ /dev/null
@@ -1,774 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ScsiDisk.h
-
-Abstract:
-
- Header file for SCSI Disk Driver.
-
---*/
-
-#ifndef _SCSI_DISK_H
-#define _SCSI_DISK_H
-
-
-#include <IndustryStandard/scsi.h>
-
-#define IsDeviceFixed(a) (a)->FixedDevice ? 1 : 0
-
-#define SCSI_DISK_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 'd', 'k')
-
-typedef struct {
- UINT32 Signature;
-
- EFI_HANDLE Handle;
-
- EFI_BLOCK_IO_PROTOCOL BlkIo;
- EFI_BLOCK_IO_MEDIA BlkIoMedia;
- EFI_SCSI_IO_PROTOCOL *ScsiIo;
- UINT8 DeviceType;
- BOOLEAN FixedDevice;
- UINT16 Reserved;
-
- EFI_SCSI_SENSE_DATA *SenseData;
- UINTN SenseDataNumber;
- EFI_SCSI_INQUIRY_DATA InquiryData;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
-} SCSI_DISK_DEV;
-
-#define SCSI_DISK_DEV_FROM_THIS(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName;
-//
-// action code used in detect media process
-//
-#define ACTION_NO_ACTION 0x00
-#define ACTION_READ_CAPACITY 0x01
-#define ACTION_RETRY_COMMAND_LATER 0x02
-
-EFI_STATUS
-EFIAPI
-ScsiDiskDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-ScsiDiskDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-ScsiDiskDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-ScsiDiskComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-ScsiDiskComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-EFI_STATUS
-EFIAPI
-ScsiDiskReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- ExtendedVerification - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-ScsiDiskReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- MediaId - TODO: add argument description
- LBA - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-ScsiDiskWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- MediaId - TODO: add argument description
- LBA - TODO: add argument description
- BufferSize - TODO: add argument description
- Buffer - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-ScsiDiskFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiDiskDetectMedia (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN MustReadCap,
- BOOLEAN *MediaChange
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- MustReadCap - TODO: add argument description
- MediaChange - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiDiskTestUnitReady (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry,
- EFI_SCSI_SENSE_DATA **SenseDataArray,
- UINTN *NumberOfSenseKeys
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- NeedRetry - TODO: add argument description
- SenseDataArray - TODO: add argument description
- NumberOfSenseKeys - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-DetectMediaParsingSenseKeys (
- SCSI_DISK_DEV *ScsiDiskDevice,
- EFI_SCSI_SENSE_DATA *SenseData,
- UINTN NumberOfSenseKeys,
- UINTN *Action
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- SenseData - TODO: add argument description
- NumberOfSenseKeys - TODO: add argument description
- Action - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiDiskReadCapacity (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry,
- EFI_SCSI_SENSE_DATA **SenseDataArray,
- UINTN *NumberOfSenseKeys
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- NeedRetry - TODO: add argument description
- SenseDataArray - TODO: add argument description
- NumberOfSenseKeys - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-CheckHostAdapterStatus (
- UINT8 HostAdapterStatus
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- HostAdapterStatus - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-CheckTargetStatus (
- UINT8 TargetStatus
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- TargetStatus - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiDiskRequestSenseKeys (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry,
- EFI_SCSI_SENSE_DATA **SenseDataArray,
- UINTN *NumberOfSenseKeys,
- BOOLEAN AskResetIfError
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- NeedRetry - TODO: add argument description
- SenseDataArray - TODO: add argument description
- NumberOfSenseKeys - TODO: add argument description
- AskResetIfError - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiDiskInquiryDevice (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- NeedRetry - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-ParseInquiryData (
- SCSI_DISK_DEV *ScsiDiskDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiDiskReadSectors (
- SCSI_DISK_DEV *ScsiDiskDevice,
- VOID *Buffer,
- EFI_LBA Lba,
- UINTN NumberOfBlocks
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- Buffer - TODO: add argument description
- Lba - TODO: add argument description
- NumberOfBlocks - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiDiskWriteSectors (
- SCSI_DISK_DEV *ScsiDiskDevice,
- VOID *Buffer,
- EFI_LBA Lba,
- UINTN NumberOfBlocks
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- Buffer - TODO: add argument description
- Lba - TODO: add argument description
- NumberOfBlocks - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiDiskRead10 (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry,
- EFI_SCSI_SENSE_DATA **SenseDataArray,
- UINTN *NumberOfSenseKeys,
- UINT64 Timeout,
- UINT8 *DataBuffer,
- UINT32 *DataLength,
- UINT32 StartLba,
- UINT32 SectorSize
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- NeedRetry - TODO: add argument description
- SenseDataArray - TODO: add argument description
- NumberOfSenseKeys - TODO: add argument description
- Timeout - TODO: add argument description
- DataBuffer - TODO: add argument description
- DataLength - TODO: add argument description
- StartLba - TODO: add argument description
- SectorSize - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-ScsiDiskWrite10 (
- SCSI_DISK_DEV *ScsiDiskDevice,
- BOOLEAN *NeedRetry,
- EFI_SCSI_SENSE_DATA **SenseDataArray,
- UINTN *NumberOfSenseKeys,
- UINT64 Timeout,
- UINT8 *DataBuffer,
- UINT32 *DataLength,
- UINT32 StartLba,
- UINT32 SectorSize
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- NeedRetry - TODO: add argument description
- SenseDataArray - TODO: add argument description
- NumberOfSenseKeys - TODO: add argument description
- Timeout - TODO: add argument description
- DataBuffer - TODO: add argument description
- DataLength - TODO: add argument description
- StartLba - TODO: add argument description
- SectorSize - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-GetMediaInfo (
- SCSI_DISK_DEV *ScsiDiskDevice,
- EFI_SCSI_DISK_CAPACITY_DATA *Capacity
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
- Capacity - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-ScsiDiskIsNoMedia (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-ScsiDiskIsMediaError (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-ScsiDiskIsHardwareError (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-ScsiDiskIsMediaChange (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-ScsiDiskIsResetBefore (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-ScsiDiskIsDriveReady (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts,
- OUT BOOLEAN *NeedRetry
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
- NeedRetry - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-BOOLEAN
-ScsiDiskHaveSenseKey (
- IN EFI_SCSI_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- SenseData - TODO: add argument description
- SenseCounts - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-ReleaseScsiDiskDeviceResources (
- IN SCSI_DISK_DEV *ScsiDiskDevice
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiDiskDevice - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.msa b/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.msa
deleted file mode 100644
index eb722a2..0000000
--- a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.msa
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>ScsiDisk</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>0A66E322-3740-4cce-AD62-BD172CECCA35</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Scsi Disk module.Revision History</Abstract>
- <Description>Scsi Disk driver. This driver detected the Scsi disk media and export block io protocol</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>ScsiDisk</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkScsiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>ScsiDisk.h</Filename>
- <Filename>ScsiDisk.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiScsiIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00010010</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gScsiDiskDriverBinding</DriverBinding>
- <ComponentName>gScsiDiskComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Bus/Usb/UsbBot/Dxe/ComponentName.c b/EdkModulePkg/Bus/Usb/UsbBot/Dxe/ComponentName.c
deleted file mode 100644
index 1b3d5ab..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBot/Dxe/ComponentName.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "bot.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUsbBotComponentName = {
- UsbBotComponentNameGetDriverName,
- UsbBotComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mUsbBotDriverNameTable[] = {
- { "eng", (CHAR16 *) L"Usb Bot Mass Storage Driver" },
- { NULL , NULL }
-};
-
-
-EFI_STATUS
-EFIAPI
-UsbBotComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUsbBotComponentName.SupportedLanguages,
- mUsbBotDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UsbBotComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- USB_BOT_DEVICE *UsbBotDev;
- EFI_USB_ATAPI_PROTOCOL *UsbAtapi;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUsbBotDriverBinding.DriverBindingHandle,
- &gEfiUsbIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the device context
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- (VOID **) &UsbAtapi,
- gUsbBotDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- UsbBotDev = USB_BOT_DEVICE_FROM_THIS (UsbAtapi);
-
- return LookupUnicodeString (
- Language,
- gUsbBotComponentName.SupportedLanguages,
- UsbBotDev->ControllerNameTable,
- ControllerName
- );
-
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbBot/Dxe/UsbBot.msa b/EdkModulePkg/Bus/Usb/UsbBot/Dxe/UsbBot.msa
deleted file mode 100644
index ac857bd..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBot/Dxe/UsbBot.msa
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>UsbBot</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>B40612B9-A063-11d4-9A3A-0090273FC14D</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for UsbBot module</Abstract>
- <Description>This module provides support for USB Bulk-Only Transport</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>UsbBot</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkUsbLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>bot.h</Filename>
- <Filename>bot.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiUsbIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiUsbAtapiProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gUsbBotDriverBinding</DriverBinding>
- <ComponentName>gUsbBotComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Usb/UsbBot/Dxe/bot.c b/EdkModulePkg/Bus/Usb/UsbBot/Dxe/bot.c
deleted file mode 100644
index fef5de9..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBot/Dxe/bot.c
+++ /dev/null
@@ -1,962 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BOT.c
-
-Abstract:
-
---*/
-
-#include "bot.h"
-
-GLOBAL_REMOVE_IF_UNREFERENCED UINT32 gBOTDebugLevel = EFI_D_INFO;
-GLOBAL_REMOVE_IF_UNREFERENCED UINT32 gBOTErrorLevel = EFI_D_INFO;
-
-EFI_DRIVER_BINDING_PROTOCOL gUsbBotDriverBinding = {
- BotDriverBindingSupported,
- BotDriverBindingStart,
- BotDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-//
-// Bot Protocol
-//
-STATIC
-EFI_STATUS
-BotCommandPhase (
- IN USB_BOT_DEVICE *UsbBotDev,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN UINT32 DataTransferLength,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 Timeout
- );
-
-STATIC
-EFI_STATUS
-BotDataPhase (
- IN USB_BOT_DEVICE *UsbBotDev,
- IN UINTN *DataSize,
- IN OUT VOID *DataBuffer,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 Timeout
- );
-
-STATIC
-EFI_STATUS
-BotStatusPhase (
- IN USB_BOT_DEVICE *UsbBotDev,
- OUT UINT32 *DataResidue,
- IN UINT16 Timeout
- );
-//
-// USB Atapi protocol prototype
-//
-STATIC
-EFI_STATUS
-EFIAPI
-BotAtapiCommand (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN VOID *DataBuffer,
- IN UINT32 BufferLength,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 TimeOutInMilliSeconds
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-BotMassStorageReset (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-STATIC
-VOID
-BotReportStatusCode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value
- );
-
-STATIC EFI_USB_ATAPI_PROTOCOL BotAtapiProtocol = {
- BotAtapiCommand,
- BotMassStorageReset,
- 0
-};
-
-EFI_STATUS
-EFIAPI
-BotDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- than contains a BlockIo and DiskIo protocol can be supported.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device
- EFI_ALREADY_STARTED - This driver is already running on this device
- other - This driver does not support this device
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
-
- //
- // Check if the Controller supports USB IO protocol
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the Default interface descriptor, now we only
- // suppose interface 1
- //
- Status = UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &InterfaceDescriptor
- );
- if (EFI_ERROR (Status)) {
- goto Exit;
- }
- //
- // Check if it is a BOT type Mass Storage Device
- //
- if ((InterfaceDescriptor.InterfaceClass != MASS_STORAGE_CLASS) ||
- (InterfaceDescriptor.InterfaceProtocol != BOT)) {
- Status = EFI_UNSUPPORTED;
- goto Exit;
- }
-
-Exit:
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-BotDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Start this driver on ControllerHandle by opening a Block IO and Disk IO
- protocol, reading Device Path, and creating a child handle with a
- Disk IO and device path protocol.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to bind driver to
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver is added to DeviceHandle
- EFI_ALREADY_STARTED - This driver is already running on DeviceHandle
- EFI_OUT_OF_RESOURCES- Can't allocate the memory resource
- other - This driver does not support this device
-
---*/
-{
- USB_BOT_DEVICE *UsbBotDev;
- UINT8 Index;
- EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;
- EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor;
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
-
- //
- // Check if the Controller supports USB IO protocol
- //
- UsbBotDev = NULL;
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- InterfaceDescriptor = AllocateZeroPool (sizeof (EFI_USB_INTERFACE_DESCRIPTOR));
- if (InterfaceDescriptor == NULL) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Get the controller interface descriptor,
- //
- Status = UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- InterfaceDescriptor
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (InterfaceDescriptor);
- goto ErrorExit;
- }
-
- BotAtapiProtocol.CommandProtocol = InterfaceDescriptor->InterfaceSubClass;
-
- UsbBotDev = AllocateZeroPool (sizeof (USB_BOT_DEVICE));
- if (UsbBotDev == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- gBS->FreePool (InterfaceDescriptor);
- goto ErrorExit;
- }
-
- UsbBotDev->Signature = USB_BOT_DEVICE_SIGNATURE;
- UsbBotDev->UsbIo = UsbIo;
- UsbBotDev->InterfaceDescriptor = InterfaceDescriptor;
- CopyMem (&UsbBotDev->UsbAtapiProtocol, &BotAtapiProtocol, sizeof (BotAtapiProtocol));
-
- //
- // Get the Device Path Protocol on Controller's handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &UsbBotDev->DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- for (Index = 0; Index < InterfaceDescriptor->NumEndpoints; Index++) {
- EndpointDescriptor = AllocatePool (sizeof (EFI_USB_INTERFACE_DESCRIPTOR));
- if (EndpointDescriptor == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
-
- UsbIo->UsbGetEndpointDescriptor (
- UsbIo,
- Index,
- EndpointDescriptor
- );
-
- //
- // We parse bulk endpoint
- //
- if ((EndpointDescriptor->Attributes & 0x03) == 0x02) {
- if ((EndpointDescriptor->EndpointAddress & 0x80) != 0) {
- UsbBotDev->BulkInEndpointDescriptor = EndpointDescriptor;
- } else {
- UsbBotDev->BulkOutEndpointDescriptor = EndpointDescriptor;
- }
-
- continue;
- }
-
- gBS->FreePool (EndpointDescriptor);
- }
- //
- // Double check we have these endpoint descriptors
- //
- if (!(UsbBotDev->BulkInEndpointDescriptor &&
- UsbBotDev->BulkOutEndpointDescriptor)) {
- Status = EFI_DEVICE_ERROR;
- goto ErrorExit;
- }
- //
- // After installing Usb-Atapi protocol onto this handle
- // it will be called by upper layer drivers such as Fat
- //
- BotReportStatusCode (
- UsbBotDev->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE)
- );
-
- //
- // Install Usb-Atapi Protocol onto the handle
- //
- Status = gBS->InstallProtocolInterface (
- &ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &UsbBotDev->UsbAtapiProtocol
- );
-
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- UsbBotDev->ControllerNameTable = NULL;
- AddUnicodeString (
- "eng",
- gUsbBotComponentName.SupportedLanguages,
- &UsbBotDev->ControllerNameTable,
- (CHAR16 *) L"Usb Bot Mass Storage"
- );
-
- return EFI_SUCCESS;
-
-ErrorExit:
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- if (UsbBotDev != NULL) {
- if (UsbBotDev->InterfaceDescriptor != NULL) {
- gBS->FreePool (UsbBotDev->InterfaceDescriptor);
- }
-
- if (UsbBotDev->BulkInEndpointDescriptor != NULL) {
- gBS->FreePool (UsbBotDev->BulkInEndpointDescriptor);
- }
-
- if (UsbBotDev->BulkOutEndpointDescriptor != NULL) {
- gBS->FreePool (UsbBotDev->BulkOutEndpointDescriptor);
- }
-
- gBS->FreePool (UsbBotDev);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-BotDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop this driver on ControllerHandle. Support stoping any child handles
- created by this driver.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to stop driver on
- NumberOfChildren - Number of Children in the ChildHandleBuffer
- ChildHandleBuffer - List of handles for the children we need to stop.
-
- Returns:
- EFI_SUCCESS - This driver is removed DeviceHandle
- EFI_UNSUPPORTED - Can't open the gEfiUsbAtapiProtocolGuid protocl
- other - This driver was not removed from this device
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_ATAPI_PROTOCOL *BotAtapiProtocol;
- USB_BOT_DEVICE *UsbBotDev;
-
- //
- // Get our context back.
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- (VOID **) &BotAtapiProtocol,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- UsbBotDev = USB_BOT_DEVICE_FROM_THIS (BotAtapiProtocol);
-
- //
- // After installing Usb-Atapi protocol onto this handle
- // it will be called by upper layer drivers such as Fat
- //
-
- BotReportStatusCode (
- UsbBotDev->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE)
- );
-
- //
- // Uninstall protocol
- //
- Status = gBS->UninstallProtocolInterface (
- ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- &UsbBotDev->UsbAtapiProtocol
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- //
- // Free all allocated resources
- //
- if (UsbBotDev->InterfaceDescriptor != NULL) {
- gBS->FreePool (UsbBotDev->InterfaceDescriptor);
- }
-
- if (UsbBotDev->BulkInEndpointDescriptor != NULL) {
- gBS->FreePool (UsbBotDev->BulkInEndpointDescriptor);
- }
-
- if (UsbBotDev->BulkOutEndpointDescriptor != NULL) {
- gBS->FreePool (UsbBotDev->BulkOutEndpointDescriptor);
- }
-
- if (UsbBotDev->ControllerNameTable) {
- FreeUnicodeStringTable (UsbBotDev->ControllerNameTable);
- }
-
- gBS->FreePool (UsbBotDev);
-
- return Status;
-}
-
-
-
-STATIC
-EFI_STATUS
-ClearBulkInPipe (
- IN USB_BOT_DEVICE *UsbBotDev
- )
-{
- UINT32 Result;
-
- return UsbClearEndpointHalt (
- UsbBotDev->UsbIo,
- UsbBotDev->BulkInEndpointDescriptor->EndpointAddress,
- &Result
- );
-}
-
-
-STATIC
-EFI_STATUS
-ClearBulkOutPipe (
- IN USB_BOT_DEVICE *UsbBotDev
- )
-{
- UINT32 Result;
- return UsbClearEndpointHalt (
- UsbBotDev->UsbIo,
- UsbBotDev->BulkOutEndpointDescriptor->EndpointAddress,
- &Result
- );
-}
-
-STATIC
-EFI_STATUS
-BotRecoveryReset (
- IN USB_BOT_DEVICE *UsbBotDev
- )
-/*++
-
-Routine Description:
-
- Bot reset routine
-
-Arguments:
-
- UsbBotDev - USB_BOT_DEVICE pointer
-
-Returns:
- EFI_SUCCESS - Success the operation
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_DEVICE_REQUEST Request;
- UINT32 Result;
- BotReportStatusCode (
- UsbBotDev->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_RESET)
- );
-
- ZeroMem (&Request, sizeof (EFI_USB_DEVICE_REQUEST));
-
- //
- // See BOT specification
- //
- Request.RequestType = 0x21;
- Request.Request = 0xFF;
-
- Status = UsbBotDev->UsbIo->UsbControlTransfer (
- UsbBotDev->UsbIo,
- &Request,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- &Result
- );
-
- gBS->Stall (100 * 1000);
-
- ClearBulkInPipe (UsbBotDev);
- ClearBulkOutPipe (UsbBotDev);
-
- return Status;
-}
-
-//
-// Bot Protocol Implementation
-//
-STATIC
-EFI_STATUS
-BotCommandPhase (
- IN USB_BOT_DEVICE *UsbBotDev,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN UINT32 DataTransferLength,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 Timeout
- )
-/*++
-
- Routine Description:
- Send ATAPI command through BOT interface.
-
- Parameters:
- UsbBotDev - USB_BOT_DEVICE
- Command - command packet
- CommandSize - Command size
- DataTransferLength - Data Transfer Length
- Direction - Data IN/OUT/NODATA
- Timeout - Time out value in milliseconds
- Return Values:
- EFI_SUCCESS
- Others
-
---*/
-{
- CBW cbw;
- EFI_STATUS Status;
- UINT32 Result;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINTN DataSize;
-
- UsbIo = UsbBotDev->UsbIo;
-
- ZeroMem (&cbw, sizeof (CBW));
-
- //
- // Fill the command block, detailed see BOT spec
- //
- cbw.dCBWSignature = CBWSIG;
- cbw.dCBWTag = 0x01;
- cbw.dCBWDataTransferLength = DataTransferLength;
- cbw.bmCBWFlags = (UINT8) ((Direction == EfiUsbDataIn) ? 0x80 : 0);
- cbw.bCBWCBLength = CommandSize;
-
- CopyMem (cbw.CBWCB, Command, CommandSize);
-
- DataSize = sizeof (CBW);
-
- Status = UsbIo->UsbBulkTransfer (
- UsbIo,
- UsbBotDev->BulkOutEndpointDescriptor->EndpointAddress,
- &cbw,
- &DataSize,
- Timeout,
- &Result
- );
- return Status;
-}
-
-STATIC
-EFI_STATUS
-BotDataPhase (
- IN USB_BOT_DEVICE *UsbBotDev,
- IN UINTN *DataSize,
- IN OUT VOID *DataBuffer,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 Timeout
- )
-/*++
-
- Routine Description:
- Get/Send Data through BOT interface
-
- Parameters:
- UsbBotDev - USB_BOT_DEVICE pointer
- DataSize - Data size
- DataBuffer - Data buffer pointer
- Direction - IN/OUT/NODATA
- Timeout - Time out value in milliseconds
- Return Value:
- EFI_SUCCESS
- Others
-
---*/
-{
- EFI_STATUS Status;
- UINT32 Result;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 EndpointAddr;
- UINT8 *BufferPtr;
-
- UsbIo = UsbBotDev->UsbIo;
- BufferPtr = (UINT8 *) DataBuffer;
-
- //
- // retrieve the the max packet length of the given endpoint
- //
- if (Direction == EfiUsbDataIn) {
- EndpointAddr = UsbBotDev->BulkInEndpointDescriptor->EndpointAddress;
- } else {
- EndpointAddr = UsbBotDev->BulkOutEndpointDescriptor->EndpointAddress;
- }
-
- Status = UsbIo->UsbBulkTransfer (
- UsbIo,
- EndpointAddr,
- BufferPtr,
- DataSize,
- (UINT16)(Timeout),
- &Result
- );
-
- if (EFI_ERROR (Status)) {
- if ((Result & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) {
- if (Direction == EfiUsbDataIn) {
- DEBUG((gBOTErrorLevel, "BOT: Data IN Stall, ClearBulkInPipe\n"));
- ClearBulkInPipe (UsbBotDev);
- } else {
- DEBUG((gBOTErrorLevel, "BOT: Data OUT Stall, ClearBulkInPipe\n"));
- ClearBulkOutPipe (UsbBotDev);
- }
- }
- // BotRecoveryReset (UsbBotDev);
- }
-
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-BotStatusPhase (
- IN USB_BOT_DEVICE *UsbBotDev,
- OUT UINT32 *DataResidue,
- IN UINT16 Timeout
- )
-/*++
-
- Routine Description:
- Get transfer status through BOT interface
-
- Parameters:
- UsbBotDev - USB_BOT_DEVICE pointer
- Timeout - Time out value in milliseconds
- Return Value:
- EFI_SUCCESS
- Others
-
---*/
-{
- CSW csw;
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 EndpointAddr;
- UINTN DataSize;
- UINT32 Result;
- UINT8 Index;
-
- UsbIo = UsbBotDev->UsbIo;
- EndpointAddr = UsbBotDev->BulkInEndpointDescriptor->EndpointAddress;
-
-
- for (Index = 0; Index < 3; Index ++) {
- ZeroMem (&csw, sizeof (CSW));
- DataSize = sizeof (CSW);
- Result = 0;
-
- Status = UsbIo->UsbBulkTransfer (
- UsbIo,
- EndpointAddr,
- &csw,
- &DataSize,
- Timeout,
- &Result
- );
- if (EFI_ERROR (Status)) {
- if ((Result & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) {
- DEBUG((gBOTDebugLevel, "BOT: CSW Stall, ClearBulkInPipe\n"));
- ClearBulkInPipe (UsbBotDev);
- continue;
- }
- }
-
- if (csw.dCSWSignature == CSWSIG) {
- if (csw.bCSWStatus == 0 || csw.bCSWStatus == 0x01) {
- if (DataResidue != NULL) {
- *DataResidue = csw.dCSWDataResidue;
- }
- if (csw.bCSWStatus == 0x01) {
- return EFI_DEVICE_ERROR;
- }
- break;
- } else if (csw.bCSWStatus == 0x02) {
- DEBUG((gBOTErrorLevel, "BOT: Bot Phase error\n"));
- BotRecoveryReset (UsbBotDev);
- }
-
- }
- }
-
- if (Index == 3) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// Usb Atapi Protocol implementation
-//
-EFI_STATUS
-EFIAPI
-BotAtapiCommand (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN VOID *DataBuffer,
- IN UINT32 BufferLength,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 TimeOutInMilliSeconds
- )
-/*++
-
- Routine Description:
- Send ATAPI command using BOT protocol.
-
- Arguments:
- This - Protocol instance pointer.
- Command - Command buffer
- CommandSize - Size of Command Buffer
- DataBuffer - Data buffer
- BufferLength - Length of Data buffer
- Direction - Data direction of this command
- TimeoutInMilliSeconds - Timeout value in ms
-
- Returns:
- EFI_SUCCESS - Command succeeded.
- EFI_DEVICE_ERROR - Command failed.
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS BotDataStatus;
- USB_BOT_DEVICE *UsbBotDev;
- UINTN BufferSize;
- UINT8 Index;
- UINT32 DataResidue;
-
- //
- // Get the context
- //
- UsbBotDev = USB_BOT_DEVICE_FROM_THIS (This);
- BotDataStatus = EFI_SUCCESS;
- BufferSize = 0;
-
- for (Index = 0; Index < 3; Index ++) {
- //
- // First send ATAPI command through Bot
- //
- Status = BotCommandPhase (
- UsbBotDev,
- Command,
- CommandSize,
- BufferLength,
- Direction,
- 10 * 1000
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG((gBOTErrorLevel, "BotCommandPhase Fail\n"));
- return Status;
- }
- //
- // Send/Get Data if there is a Data Stage
- //
- switch (Direction) {
-
- case EfiUsbDataIn:
- case EfiUsbDataOut:
- BufferSize = BufferLength;
-
- BotDataStatus = BotDataPhase (
- UsbBotDev,
- &BufferSize,
- DataBuffer,
- Direction,
- (UINT16) (TimeOutInMilliSeconds)
- );
-
-
- if (EFI_ERROR (BotDataStatus)) {
- DEBUG((gBOTErrorLevel, "BotDataPhase Fail\n"));
- }
- break;
-
- case EfiUsbNoData:
- break;
- }
-
- DataResidue = 0;
- //
- // Status Phase
- //
- Status = BotStatusPhase (
- UsbBotDev,
- &DataResidue,
- 10 * 1000
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG((gBOTErrorLevel, "BotStatusPhase Fail\n"));
- return Status;
- }
-
- if (!EFI_ERROR (BotDataStatus)) {
- break;
- }
-
- }
- return BotDataStatus;
-}
-
-EFI_STATUS
-EFIAPI
-BotMassStorageReset (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset Bot Devices
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - TRUE if we need to do strictly reset.
-
- Returns:
- EFI_SUCCESS - Command succeeded.
- EFI_DEVICE_ERROR - Command failed.
-
---*/
-{
- EFI_STATUS Status;
- USB_BOT_DEVICE *UsbBotDev;
- EFI_USB_IO_PROTOCOL *UsbIo;
-
- UsbBotDev = USB_BOT_DEVICE_FROM_THIS (This);
- UsbIo = UsbBotDev->UsbIo;
-
- if (ExtendedVerification) {
- //
- // If we need to do strictly reset, reset its parent hub port
- //
- Status = UsbIo->UsbPortReset (UsbIo);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- Status = BotRecoveryReset (UsbBotDev);
-
- return Status;
-}
-
-STATIC
-VOID
-BotReportStatusCode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value
- )
-/*++
-
- Routine Description:
- Report Status Code in Usb Bot Driver
-
- Arguments:
- DevicePath - Use this to get Device Path
- CodeType - Status Code Type
- CodeValue - Status Code Value
-
- Returns:
- None
-
---*/
-{
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- CodeType,
- Value,
- DevicePath
- );
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbBot/Dxe/bot.h b/EdkModulePkg/Bus/Usb/UsbBot/Dxe/bot.h
deleted file mode 100644
index 4fb76bb..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBot/Dxe/bot.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BOT.h
-
-Abstract:
-
---*/
-
-#ifndef _BOT_H
-#define _BOT_H
-
-
-#include <IndustryStandard/Usb.h>
-extern UINT32 gBOTDebugLevel;
-extern UINT32 gBOTErrorLevel;
-#define MASS_STORAGE_CLASS 0x08
-
-#pragma pack(1)
-//
-// Bulk Only device protocol
-//
-typedef struct {
- UINT32 dCBWSignature;
- UINT32 dCBWTag;
- UINT32 dCBWDataTransferLength;
- UINT8 bmCBWFlags;
- UINT8 bCBWLUN;
- UINT8 bCBWCBLength;
- UINT8 CBWCB[16];
-} CBW;
-
-typedef struct {
- UINT32 dCSWSignature;
- UINT32 dCSWTag;
- UINT32 dCSWDataResidue;
- UINT8 bCSWStatus;
-} CSW;
-
-#pragma pack()
-
-#define USB_BOT_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('u', 'b', 'o', 't')
-
-typedef struct {
- UINTN Signature;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_USB_ATAPI_PROTOCOL UsbAtapiProtocol;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor;
- EFI_USB_ENDPOINT_DESCRIPTOR *BulkInEndpointDescriptor;
- EFI_USB_ENDPOINT_DESCRIPTOR *BulkOutEndpointDescriptor;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} USB_BOT_DEVICE;
-
-#define USB_BOT_DEVICE_FROM_THIS(a) \
- CR(a, USB_BOT_DEVICE, UsbAtapiProtocol, USB_BOT_DEVICE_SIGNATURE)
-
-//
-// Status code, see Usb Bot device spec
-//
-#define CSWSIG 0x53425355
-#define CBWSIG 0x43425355
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUsbBotDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUsbBotComponentName;
-
-//
-// Bot Driver Binding Protocol
-//
-EFI_STATUS
-EFIAPI
-BotDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-BotDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-BotDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UsbBotComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UsbBotComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/ComponentName.c b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/ComponentName.c
deleted file mode 100644
index 1233eac..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/ComponentName.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "usbbus.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUsbBusComponentName = {
- UsbBusComponentNameGetDriverName,
- UsbBusComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mUsbBusDriverNameTable[] = {
- { "eng", (CHAR16 *) L"USB Bus Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-UsbBusComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUsbBusComponentName.SupportedLanguages,
- mUsbBusDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UsbBusComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle, OPTIONAL
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/UsbBus.msa b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/UsbBus.msa
deleted file mode 100644
index bc7715d..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/UsbBus.msa
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>UsbBus</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>240612B7-A063-11d4-9A3A-0090273FC14D</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for UsbBus module</Abstract>
- <Description>This module provides support for USB bus enumeration and USB IO protocol implementation</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>UsbBus</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkUsbLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>usbbus.h</Filename>
- <Filename>usbutil.h</Filename>
- <Filename>hub.h</Filename>
- <Filename>usbbus.c</Filename>
- <Filename>usbio.c</Filename>
- <Filename>usb.c</Filename>
- <Filename>usbutil.c</Filename>
- <Filename>hub.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiUsbIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiUsb2HcProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiUsbHcProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gUsbBusDriverBinding</DriverBinding>
- <ComponentName>gUsbBusComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/hub.c b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/hub.c
deleted file mode 100644
index fd9e673..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/hub.c
+++ /dev/null
@@ -1,507 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- Hub.c
-
- Abstract:
-
- Usb Hub Request
-
- Revision History
-
---*/
-
-#include "usbbus.h"
-
-EFI_STATUS
-HubGetPortStatus (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Port,
- OUT UINT32 *PortStatus
- )
-/*++
-
- Routine Description:
- Get a given hub port status
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL instance
- Port - Usb hub port number (starting from 1).
- PortStatus - Current Hub port status and change status.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE
- EFI_TIME_OUT
- EFI_INVALID_PARAMETER
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
- EFI_STATUS EfiStatus;
- UINT32 UsbStatus;
- UINT32 Timeout;
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- //
- // Fill Device request packet
- //
- DevReq.RequestType = HUB_GET_PORT_STATUS_REQ_TYPE;
- DevReq.Request = HUB_GET_PORT_STATUS;
- DevReq.Value = 0;
- DevReq.Index = Port;
- DevReq.Length = sizeof (UINT32);
-
- Timeout = 3000;
-
- EfiStatus = UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- Timeout,
- PortStatus,
- sizeof (UINT32),
- &UsbStatus
- );
-
- return EfiStatus;
-}
-
-EFI_STATUS
-HubSetPortFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Port,
- IN UINT8 Value
- )
-/*++
-
- Routine Description:
- Set specified feature to a give hub port
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL instance
- Port - Usb hub port number (starting from 1).
- Value - New feature value.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE
- EFI_TIME_OUT
- EFI_INVALID_PARAMETER
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
- EFI_STATUS EfiStatus;
- UINT32 UsbStatus;
- UINT32 Timeout;
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- //
- // Fill Device request packet
- //
- DevReq.RequestType = HUB_SET_PORT_FEATURE_REQ_TYPE;
- DevReq.Request = HUB_SET_PORT_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = Port;
- DevReq.Length = 0;
-
- Timeout = 3000;
- EfiStatus = UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- Timeout,
- NULL,
- 0,
- &UsbStatus
- );
-
- return EfiStatus;
-}
-
-EFI_STATUS
-HubClearPortFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Port,
- IN UINT8 Value
- )
-/*++
-
- Routine Description:
- Clear a specified feature of a given hub port
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL instance
- Port - Usb hub port number (starting from 1).
- Value - Feature value that will be cleared from
- that hub port.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE
- EFI_TIME_OUT
- EFI_INVALID_PARAMETER
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
- EFI_STATUS EfiStatus;
- UINT32 UsbStatus;
- UINT32 Timeout;
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- //
- // Fill Device request packet
- //
- DevReq.RequestType = HUB_CLEAR_FEATURE_PORT_REQ_TYPE;
- DevReq.Request = HUB_CLEAR_FEATURE_PORT;
- DevReq.Value = Value;
- DevReq.Index = Port;
- DevReq.Length = 0;
-
- Timeout = 3000;
- EfiStatus = UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- Timeout,
- NULL,
- 0,
- &UsbStatus
- );
-
- return EfiStatus;
-}
-
-EFI_STATUS
-HubGetHubStatus (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- OUT UINT32 *HubStatus
- )
-/*++
-
- Routine Description:
- Get Hub Status
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL instance
- HubStatus - Current Hub status and change status.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE
- EFI_TIME_OUT
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
- EFI_STATUS EfiStatus;
- UINT32 UsbStatus;
- UINT32 Timeout;
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- //
- // Fill Device request packet
- //
- DevReq.RequestType = HUB_GET_HUB_STATUS_REQ_TYPE;
- DevReq.Request = HUB_GET_HUB_STATUS;
- DevReq.Value = 0;
- DevReq.Index = 0;
- DevReq.Length = sizeof (UINT32);
-
- Timeout = 3000;
- EfiStatus = UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- Timeout,
- HubStatus,
- sizeof (UINT32),
- &UsbStatus
- );
-
- return EfiStatus;
-}
-
-EFI_STATUS
-HubSetHubFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Value
- )
-/*++
-
- Routine Description:
- Set a specified feature to the hub
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL instance
- Value - Feature value that will be set to the hub.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE
- EFI_TIME_OUT
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
- EFI_STATUS EfiStatus;
- UINT32 UsbStatus;
- UINT32 Timeout;
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- //
- // Fill Device request packet
- //
- DevReq.RequestType = HUB_SET_HUB_FEATURE_REQ_TYPE;
- DevReq.Request = HUB_SET_HUB_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = 0;
- DevReq.Length = 0;
-
- Timeout = 3000;
- EfiStatus = UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- Timeout,
- NULL,
- 0,
- &UsbStatus
- );
-
- return EfiStatus;
-}
-
-EFI_STATUS
-HubClearHubFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Value
- )
-/*++
-
- Routine Description:
- Set a specified feature to the hub
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL instance
- Value - Feature value that will be cleared from the hub.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE
- EFI_TIME_OUT
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
- EFI_STATUS EfiStatus;
- UINT32 UsbStatus;
- UINT32 Timeout;
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- //
- // Fill Device request packet
- //
- DevReq.RequestType = HUB_CLEAR_FEATURE_REQ_TYPE;
- DevReq.Request = HUB_CLEAR_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = 0;
- DevReq.Length = 0;
-
- Timeout = 3000;
- EfiStatus = UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- Timeout,
- NULL,
- 0,
- &UsbStatus
- );
-
- return EfiStatus;
-
-}
-
-EFI_STATUS
-GetHubDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINTN DescriptorSize,
- OUT EFI_USB_HUB_DESCRIPTOR *HubDescriptor
- )
-/*++
-
- Routine Description:
- Get the hub descriptor
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL instance
- DescriptorSize - The length of Hub Descriptor buffer.
- HubDescriptor - Caller allocated buffer to store the hub descriptor
- if successfully returned.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE
- EFI_TIME_OUT
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
- EFI_STATUS EfiStatus;
- UINT32 UsbStatus;
- UINT32 Timeout;
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- //
- // Fill Device request packet
- //
- DevReq.RequestType = USB_RT_HUB | 0x80;
- DevReq.Request = HUB_GET_DESCRIPTOR;
- DevReq.Value = USB_DT_HUB << 8;
- DevReq.Index = 0;
- DevReq.Length = (UINT16) DescriptorSize;
-
- Timeout = 3000;
- EfiStatus = UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- Timeout,
- HubDescriptor,
- (UINT16) DescriptorSize,
- &UsbStatus
- );
-
- return EfiStatus;
-
-}
-
-EFI_STATUS
-DoHubConfig (
- IN USB_IO_CONTROLLER_DEVICE *HubController
- )
-/*++
-
- Routine Description:
- Configure the hub
-
- Arguments:
- HubController - Indicating the hub controller device that
- will be configured
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_HUB_DESCRIPTOR HubDescriptor;
- EFI_STATUS Status;
- EFI_USB_HUB_STATUS HubStatus;
- UINTN Index;
- UINT32 PortStatus;
-
- UsbIo = &HubController->UsbIo;
-
- ZeroMem (&HubDescriptor, sizeof (HubDescriptor));
-
- //
- // First get the hub descriptor length
- //
- Status = GetHubDescriptor (UsbIo, 2, &HubDescriptor);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // First get the whole descriptor, then
- // get the number of hub ports
- //
- Status = GetHubDescriptor (
- UsbIo,
- HubDescriptor.Length,
- &HubDescriptor
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((gUSBErrorLevel, "Get hub descriptor fail\n"));
- return EFI_DEVICE_ERROR;
- }
-
- HubController->DownstreamPorts = HubDescriptor.NbrPorts;
-
- Status = HubGetHubStatus (UsbIo, (UINT32 *) &HubStatus);
- if (EFI_ERROR (Status)) {
- DEBUG ((gUSBErrorLevel, "Get hub status fail when configure\n"));
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Get all hub ports status
- //
- for (Index = 0; Index < HubController->DownstreamPorts; Index++) {
-
- Status = HubGetPortStatus (UsbIo, (UINT8) (Index + 1), &PortStatus);
- if (EFI_ERROR (Status)) {
- continue;
- }
- }
- //
- // Power all the hub ports
- //
- for (Index = 0; Index < HubController->DownstreamPorts; Index++) {
- Status = HubSetPortFeature (
- UsbIo,
- (UINT8) (Index + 1),
- EfiUsbPortPower
- );
- if (EFI_ERROR (Status)) {
- continue;
- }
- }
-
- //
- // Clear Hub Status Change
- //
- Status = HubGetHubStatus (UsbIo, (UINT32 *) &HubStatus);
- if (EFI_ERROR (Status)) {
- DEBUG ((gUSBErrorLevel, "Get hub status fail\n"));
- return EFI_DEVICE_ERROR;
- } else {
- //
- // Hub power supply change happens
- //
- if (HubStatus.HubChange & HUB_CHANGE_LOCAL_POWER) {
- HubClearHubFeature (UsbIo, C_HUB_LOCAL_POWER);
- }
- //
- // Hub change overcurrent happens
- //
- if (HubStatus.HubChange & HUB_CHANGE_OVERCURRENT) {
- HubClearHubFeature (UsbIo, C_HUB_OVER_CURRENT);
- }
- }
-
- return EFI_SUCCESS;
-
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/hub.h b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/hub.h
deleted file mode 100644
index 4545d71..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/hub.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- Hub.h
-
- Abstract:
-
- Constants definitions for Usb Hub
-
- Revision History
-
---*/
-
-#ifndef _HUB_H
-#define _HUB_H
-
-//
-// Hub feature numbers
-//
-#define C_HUB_LOCAL_POWER 0
-#define C_HUB_OVER_CURRENT 1
-
-//
-// Hub class code & sub class code
-//
-#define CLASS_CODE_HUB 0x09
-#define SUB_CLASS_CODE_HUB 0
-
-//
-// Hub Status & Hub Change bit masks
-//
-#define HUB_STATUS_LOCAL_POWER 0x0001
-#define HUB_STATUS_OVERCURRENT 0x0002
-
-#define HUB_CHANGE_LOCAL_POWER 0x0001
-#define HUB_CHANGE_OVERCURRENT 0x0002
-
-//
-// Hub Characteristics
-//
-#define HUB_CHAR_LPSM 0x0003
-#define HUB_CHAR_COMPOUND 0x0004
-#define HUB_CHAR_OCPM 0x0018
-
-//
-// Hub specific request
-//
-#define HUB_CLEAR_FEATURE 0x01
-#define HUB_CLEAR_FEATURE_REQ_TYPE 0x20
-
-#define HUB_CLEAR_FEATURE_PORT 0x01
-#define HUB_CLEAR_FEATURE_PORT_REQ_TYPE 0x23
-
-#define HUB_GET_BUS_STATE 0x02
-#define HUB_GET_BUS_STATE_REQ_TYPE 0xA3
-
-#define HUB_GET_DESCRIPTOR 0x06
-#define HUB_GET_DESCRIPTOR_REQ_TYPE 0xA0
-
-#define HUB_GET_HUB_STATUS 0x00
-#define HUB_GET_HUB_STATUS_REQ_TYPE 0xA0
-
-#define HUB_GET_PORT_STATUS 0x00
-#define HUB_GET_PORT_STATUS_REQ_TYPE 0xA3
-
-#define HUB_SET_DESCRIPTOR 0x07
-#define HUB_SET_DESCRIPTOR_REQ_TYPE 0x20
-
-#define HUB_SET_HUB_FEATURE 0x03
-#define HUB_SET_HUB_FEATURE_REQ_TYPE 0x20
-
-#define HUB_SET_PORT_FEATURE 0x03
-#define HUB_SET_PORT_FEATURE_REQ_TYPE 0x23
-
-#pragma pack(1)
-typedef struct usb_hub_status {
- UINT16 HubStatus;
- UINT16 HubChange;
-} EFI_USB_HUB_STATUS;
-#pragma pack()
-
-EFI_STATUS
-HubGetPortStatus (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Port,
- OUT UINT32 *PortStatus
- );
-
-EFI_STATUS
-HubSetPortFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Port,
- IN UINT8 Value
- );
-
-EFI_STATUS
-HubSetHubFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Value
- );
-
-EFI_STATUS
-HubGetHubStatus (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- OUT UINT32 *HubStatus
- );
-
-EFI_STATUS
-HubClearPortFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Port,
- IN UINT8 Value
- );
-
-EFI_STATUS
-HubClearHubFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Value
- );
-
-EFI_STATUS
-GetHubDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINTN DescriptorSize,
- OUT EFI_USB_HUB_DESCRIPTOR *HubDescriptor
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usb.c b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usb.c
deleted file mode 100644
index 2721610..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usb.c
+++ /dev/null
@@ -1,825 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- Usb.c
-
- Abstract:
-
- Parse usb device configurations.
-
- Revision History
-
---*/
-
-#include "usbbus.h"
-
-//
-// Here are some internal helper functions
-//
-STATIC
-EFI_STATUS
-GetExpectedDescriptor (
- IN UINT8 *Buffer,
- IN UINTN Length,
- IN UINT8 DescType,
- IN UINT8 DescLength,
- OUT UINTN *ParsedBytes
- );
-
-STATIC
-EFI_STATUS
-ParseThisEndpoint (
- IN ENDPOINT_DESC_LIST_ENTRY *EndpointEntry,
- IN UINT8 *Buffer,
- IN UINTN BufferLength,
- OUT UINTN *ParsedBytes
- );
-
-STATIC
-EFI_STATUS
-ParseThisInterface (
- IN INTERFACE_DESC_LIST_ENTRY *InterfaceEntry,
- IN UINT8 *Buffer,
- IN UINTN *BufferLen,
- OUT UINTN *ParsedBytes
- );
-
-STATIC
-EFI_STATUS
-ParseThisConfig (
- IN CONFIG_DESC_LIST_ENTRY *ConfigDescEntry,
- IN UINT8 *Buffer,
- IN UINTN Length
- );
-
-//
-// Implementations
-//
-BOOLEAN
-IsHub (
- IN USB_IO_CONTROLLER_DEVICE *Dev
- )
-/*++
-
- Routine Description:
- Tell if a usb controller is a hub controller.
-
- Arguments:
- Dev - UsbIoController device structure.
-
- Returns:
- TRUE/FALSE
---*/
-{
- EFI_USB_INTERFACE_DESCRIPTOR Interface;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
- UINT8 Index;
-
- if (Dev == NULL) {
- return FALSE;
- }
-
- UsbIo = &Dev->UsbIo;
-
- UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &Interface
- );
-
- //
- // Check classcode
- //
- if (Interface.InterfaceClass != 0x09) {
- return FALSE;
- }
-
- //
- // Check protocol
- //
- if (Interface.InterfaceProtocol != 0x0) {
- return FALSE;
- }
-
- for (Index = 0; Index < Interface.NumEndpoints; Index++) {
- UsbIo->UsbGetEndpointDescriptor (
- UsbIo,
- Index,
- &EndpointDescriptor
- );
-
- if ((EndpointDescriptor.EndpointAddress & 0x80) == 0) {
- continue;
- }
-
- if (EndpointDescriptor.Attributes != 0x03) {
- continue;
- }
-
- Dev->HubEndpointAddress = EndpointDescriptor.EndpointAddress;
- return TRUE;
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-UsbGetStringtable (
- IN USB_IO_DEVICE *Dev
- )
-/*++
-
- Routine Description:
- Get the string table stored in a usb device.
-
- Arguments:
- Dev - UsbIoController device structure.
-
- Returns:
- EFI_SUCCESS
- EFI_UNSUPPORTED
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- EFI_STATUS Result;
- UINT32 Status;
- EFI_USB_SUPPORTED_LANGUAGES *LanguageTable;
- UINT8 *Buffer;
- UINT8 *ptr;
- UINTN Index;
- UINTN LangTableSize;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT16 TempBuffer;
-
- UsbIo = &(Dev->UsbController[0]->UsbIo);
-
- //
- // We get first 2 byte of langID table,
- // so we can have the whole table length
- //
- Result = UsbGetString (
- UsbIo,
- 0,
- 0,
- &TempBuffer,
- 2,
- &Status
- );
- if (EFI_ERROR (Result)) {
- return EFI_UNSUPPORTED;
- }
-
- LanguageTable = (EFI_USB_SUPPORTED_LANGUAGES *) &TempBuffer;
-
- if (LanguageTable->Length == 0) {
- return EFI_UNSUPPORTED;
- }
- //
- // If length is 2, then there is no string table
- //
- if (LanguageTable->Length == 2) {
- return EFI_UNSUPPORTED;
- }
-
- Buffer = AllocateZeroPool (LanguageTable->Length);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Now we get the whole LangID table
- //
- Result = UsbGetString (
- UsbIo,
- 0,
- 0,
- Buffer,
- LanguageTable->Length,
- &Status
- );
- if (EFI_ERROR (Result)) {
- gBS->FreePool (Buffer);
- return EFI_UNSUPPORTED;
- }
-
- LanguageTable = (EFI_USB_SUPPORTED_LANGUAGES *) Buffer;
-
- //
- // ptr point to the LangID table
- //
- ptr = Buffer + 2;
- LangTableSize = (LanguageTable->Length - 2) / 2;
-
- for (Index = 0; Index < LangTableSize && Index < USB_MAXLANID; Index++) {
- Dev->LangID[Index] = *((UINT16 *) ptr);
- ptr += 2;
- }
-
- gBS->FreePool (Buffer);
- LanguageTable = NULL;
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-UsbGetAllConfigurations (
- IN USB_IO_DEVICE *UsbIoDevice
- )
-/*++
-
- Routine Description:
- This function is to parse all the configuration descriptor.
-
- Arguments:
- UsbIoDevice - USB_IO_DEVICE device structure.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- EFI_STATUS Result;
- UINT32 Status;
- UINTN Index;
- UINTN TotalLength;
- UINT8 *Buffer;
- CONFIG_DESC_LIST_ENTRY *ConfigDescEntry;
- EFI_USB_IO_PROTOCOL *UsbIo;
-
- InitializeListHead (&UsbIoDevice->ConfigDescListHead);
- UsbIo = &(UsbIoDevice->UsbController[0]->UsbIo);
-
- for (Index = 0; Index < UsbIoDevice->DeviceDescriptor.NumConfigurations; Index++) {
- ConfigDescEntry = NULL;
-
- ConfigDescEntry = AllocateZeroPool (sizeof (CONFIG_DESC_LIST_ENTRY));
- if (ConfigDescEntry == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // 1st only get 1st 4 bytes config descriptor,
- // so we can know the whole length
- //
- Result = UsbGetDescriptor (
- UsbIo,
- (UINT16) ((USB_DT_CONFIG << 8) | Index),
- 0,
- 4,
- &ConfigDescEntry->CongfigDescriptor,
- &Status
- );
- if (EFI_ERROR (Result)) {
- DEBUG ((gUSBErrorLevel, "First get config descriptor error\n"));
- gBS->FreePool (ConfigDescEntry);
- return EFI_DEVICE_ERROR;
- }
-
- TotalLength = ConfigDescEntry->CongfigDescriptor.TotalLength;
-
- Buffer = AllocateZeroPool (TotalLength);
- if (Buffer == NULL) {
- gBS->FreePool (ConfigDescEntry);
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Then we get the total descriptors for this configuration
- //
- Result = UsbGetDescriptor (
- UsbIo,
- (UINT16) ((USB_DT_CONFIG << 8) | Index),
- 0,
- (UINT16) TotalLength,
- Buffer,
- &Status
- );
- if (EFI_ERROR (Result)) {
- DEBUG ((gUSBErrorLevel, "Get whole config descriptor error\n"));
- gBS->FreePool (ConfigDescEntry);
- gBS->FreePool (Buffer);
- return EFI_DEVICE_ERROR;
- }
-
- InitializeListHead (&ConfigDescEntry->InterfaceDescListHead);
-
- //
- // Parse this whole configuration
- //
- Result = ParseThisConfig (ConfigDescEntry, Buffer, TotalLength);
-
- if (EFI_ERROR (Result)) {
- //
- // Ignore this configuration, parse next one
- //
- gBS->FreePool (ConfigDescEntry);
- gBS->FreePool (Buffer);
- continue;
- }
-
- InsertTailList (&UsbIoDevice->ConfigDescListHead, &ConfigDescEntry->Link);
-
- gBS->FreePool (Buffer);
-
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-GetExpectedDescriptor (
- IN UINT8 *Buffer,
- IN UINTN Length,
- IN UINT8 DescType,
- IN UINT8 DescLength,
- OUT UINTN *ParsedBytes
- )
-/*++
-
- Routine Description:
- Get the start position of next wanted descriptor.
-
- Arguments:
- Buffer - Buffer to parse
- Length - Buffer length
- DescType - Descriptor type
- DescLength - Descriptor length
- ParsedBytes - Parsed Bytes to return
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- UINT16 DescriptorHeader;
- UINT8 Len;
- UINT8 *ptr;
- UINTN Parsed;
-
- Parsed = 0;
- ptr = Buffer;
-
- while (TRUE) {
- //
- // Buffer length should not less than Desc length
- //
- if (Length < DescLength) {
- return EFI_DEVICE_ERROR;
- }
- //
- // DescriptorHeader = *((UINT16 *)ptr), compatible with IPF
- //
- DescriptorHeader = (UINT16) ((*(ptr + 1) << 8) | *ptr);
-
- Len = ptr[0];
-
- //
- // Check to see if it is a start of expected descriptor
- //
- if (DescriptorHeader == ((DescType << 8) | DescLength)) {
- break;
- }
-
- if ((UINT8) (DescriptorHeader >> 8) == DescType) {
- if (Len > DescLength) {
- return EFI_DEVICE_ERROR;
- }
- }
- //
- // Descriptor length should be at least 2
- // and should not exceed the buffer length
- //
- if (Len < 2) {
- return EFI_DEVICE_ERROR;
- }
-
- if (Len > Length) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Skip this mismatch descriptor
- //
- Length -= Len;
- ptr += Len;
- Parsed += Len;
- }
-
- *ParsedBytes = Parsed;
-
- return EFI_SUCCESS;
-}
-
-
-STATIC
-EFI_STATUS
-ParseThisEndpoint (
- IN ENDPOINT_DESC_LIST_ENTRY *EndpointEntry,
- IN UINT8 *Buffer,
- IN UINTN BufferLength,
- OUT UINTN *ParsedBytes
- )
-/*++
-
- Routine Description:
- Get the start position of next wanted endpoint descriptor.
-
- Arguments:
- EndpointEntry - ENDPOINT_DESC_LIST_ENTRY
- Buffer - Buffer to parse
- BufferLength - Buffer Length
- ParsedBytes - Parsed Bytes to return
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- UINT8 *ptr;
- EFI_STATUS Status;
- UINTN SkipBytes;
-
- //
- // Skip some data for this interface
- //
- Status = GetExpectedDescriptor (
- Buffer,
- BufferLength,
- USB_DT_ENDPOINT,
- sizeof (EFI_USB_ENDPOINT_DESCRIPTOR),
- &SkipBytes
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ptr = Buffer + SkipBytes;
- *ParsedBytes = SkipBytes;
-
- CopyMem (
- &EndpointEntry->EndpointDescriptor,
- ptr,
- sizeof (EFI_USB_ENDPOINT_DESCRIPTOR)
- );
-
- *ParsedBytes += sizeof (EFI_USB_ENDPOINT_DESCRIPTOR);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ParseThisInterface (
- IN INTERFACE_DESC_LIST_ENTRY *InterfaceEntry,
- IN UINT8 *Buffer,
- IN UINTN *BufferLen,
- OUT UINTN *ParsedBytes
- )
-/*++
-
- Routine Description:
- Get the start position of next wanted interface descriptor.
-
- Arguments:
- InterfaceEntry - INTERFACE_DESC_LIST_ENTRY
- Buffer - Buffer to parse
- BufferLength - Buffer Length
- ParsedBytes - Parsed Bytes to return
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- UINT8 *ptr;
- UINTN SkipBytes;
- UINTN Index;
- UINTN Length;
- UINTN Parsed;
- ENDPOINT_DESC_LIST_ENTRY *EndpointEntry;
- EFI_STATUS Status;
-
- Parsed = 0;
-
- //
- // Skip some data for this interface
- //
- Status = GetExpectedDescriptor (
- Buffer,
- *BufferLen,
- USB_DT_INTERFACE,
- sizeof (EFI_USB_INTERFACE_DESCRIPTOR),
- &SkipBytes
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ptr = Buffer + SkipBytes;
- *ParsedBytes = SkipBytes;
-
- //
- // Copy the interface descriptor
- //
- CopyMem (
- &InterfaceEntry->InterfaceDescriptor,
- ptr,
- sizeof (EFI_USB_INTERFACE_DESCRIPTOR)
- );
-
- ptr = Buffer + sizeof (EFI_USB_INTERFACE_DESCRIPTOR);
- *ParsedBytes += sizeof (EFI_USB_INTERFACE_DESCRIPTOR);
-
- InitializeListHead (&InterfaceEntry->EndpointDescListHead);
-
- Length = *BufferLen - SkipBytes - sizeof (EFI_USB_INTERFACE_DESCRIPTOR);
-
- for (Index = 0; Index < InterfaceEntry->InterfaceDescriptor.NumEndpoints; Index++) {
- EndpointEntry = AllocateZeroPool (sizeof (ENDPOINT_DESC_LIST_ENTRY));
- if (EndpointEntry == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Parses all the endpoint descriptors within this interface.
- //
- Status = ParseThisEndpoint (EndpointEntry, ptr, Length, &Parsed);
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (EndpointEntry);
- return Status;
- }
-
- InsertTailList (
- &InterfaceEntry->EndpointDescListHead,
- &EndpointEntry->Link
- );
-
- Length -= Parsed;
- ptr += Parsed;
- *ParsedBytes += Parsed;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ParseThisConfig (
- IN CONFIG_DESC_LIST_ENTRY *ConfigDescEntry,
- IN UINT8 *Buffer,
- IN UINTN Length
- )
-/*++
-
- Routine Description:
- Parse the current configuration descriptior.
-
- Arguments:
- ConfigDescEntry - CONFIG_DESC_LIST_ENTRY
- Buffer - Buffer to parse
- Length - Buffer Length
-
- Returns
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- UINT8 *ptr;
- UINT8 NumInterface;
- UINTN Index;
- INTERFACE_DESC_LIST_ENTRY *InterfaceEntry;
- UINTN SkipBytes;
- UINTN Parsed;
- EFI_STATUS Status;
- UINTN LengthLeft;
-
- Parsed = 0;
-
- //
- // First skip the current config descriptor;
- //
- Status = GetExpectedDescriptor (
- Buffer,
- Length,
- USB_DT_CONFIG,
- sizeof (EFI_USB_CONFIG_DESCRIPTOR),
- &SkipBytes
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ptr = Buffer + SkipBytes;
-
- CopyMem (
- &ConfigDescEntry->CongfigDescriptor,
- ptr,
- sizeof (EFI_USB_CONFIG_DESCRIPTOR)
- );
-
- NumInterface = ConfigDescEntry->CongfigDescriptor.NumInterfaces;
-
- //
- // Skip size of Configuration Descriptor
- //
- ptr += sizeof (EFI_USB_CONFIG_DESCRIPTOR);
-
- LengthLeft = Length - SkipBytes - sizeof (EFI_USB_CONFIG_DESCRIPTOR);
-
- for (Index = 0; Index < NumInterface; Index++) {
- //
- // Parse all Interface
- //
- InterfaceEntry = AllocateZeroPool (sizeof (INTERFACE_DESC_LIST_ENTRY));
- if (InterfaceEntry == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = ParseThisInterface (InterfaceEntry, ptr, &LengthLeft, &Parsed);
- if (EFI_ERROR (Status)) {
- gBS->FreePool (InterfaceEntry);
- return Status;
- }
-
- InsertTailList (
- &ConfigDescEntry->InterfaceDescListHead,
- &InterfaceEntry->Link
- );
-
- //
- // Parsed for next interface
- //
- LengthLeft -= Parsed;
- ptr += Parsed;
- }
- //
- // Parse for additional alt setting;
- //
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UsbSetConfiguration (
- IN USB_IO_DEVICE *UsbIoDev,
- IN UINTN ConfigurationValue
- )
-/*++
-
- Routine Description:
- Set the device to a configuration value.
-
- Arguments:
- UsbIoDev - USB_IO_DEVICE to be set configuration
- ConfigrationValue - The configuration value to be set to that device
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- LIST_ENTRY *NextEntry;
- CONFIG_DESC_LIST_ENTRY *ConfigEntry;
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_IO_PROTOCOL *UsbIo;
-
- UsbIo = &(UsbIoDev->UsbController[0]->UsbIo);
- NextEntry = UsbIoDev->ConfigDescListHead.ForwardLink;
-
- while (NextEntry != &UsbIoDev->ConfigDescListHead) {
- //
- // Get one entry
- //
- ConfigEntry = (CONFIG_DESC_LIST_ENTRY *) NextEntry;
- if (ConfigEntry->CongfigDescriptor.ConfigurationValue == ConfigurationValue) {
- //
- // Find one, set to the active configuration
- //
- UsbIoDev->ActiveConfig = ConfigEntry;
- break;
- }
-
- NextEntry = NextEntry->ForwardLink;
- }
- //
- // Next Entry should not be null
- //
- Result = UsbSetDeviceConfiguration (
- UsbIo,
- (UINT16) ConfigurationValue,
- &Status
- );
-
- return Result;
-}
-
-EFI_STATUS
-UsbSetDefaultConfiguration (
- IN USB_IO_DEVICE *UsbIoDev
- )
-/*++
-
- Routine Description:
- Set the device to a default configuration value.
-
- Arguments:
- UsbIoDev - USB_IO_DEVICE to be set configuration
-
- Returns
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- CONFIG_DESC_LIST_ENTRY *ConfigEntry;
- UINT16 ConfigValue;
- LIST_ENTRY *NextEntry;
-
- if (IsListEmpty (&UsbIoDev->ConfigDescListHead)) {
- return EFI_DEVICE_ERROR;
- }
-
- NextEntry = UsbIoDev->ConfigDescListHead.ForwardLink;
-
- ConfigEntry = (CONFIG_DESC_LIST_ENTRY *) NextEntry;
- ConfigValue = ConfigEntry->CongfigDescriptor.ConfigurationValue;
-
- return UsbSetConfiguration (UsbIoDev, ConfigValue);
-}
-
-VOID
-UsbDestroyAllConfiguration (
- IN USB_IO_DEVICE *UsbIoDevice
- )
-/*++
-
- Routine Description:
- Delete all configuration data when device is not used.
-
- Arguments:
- UsbIoDevice - USB_IO_DEVICE to be set configuration
-
- Returns:
- N/A
-
---*/
-{
- CONFIG_DESC_LIST_ENTRY *ConfigEntry;
- INTERFACE_DESC_LIST_ENTRY *InterfaceEntry;
- ENDPOINT_DESC_LIST_ENTRY *EndpointEntry;
- LIST_ENTRY *NextEntry;
-
- //
- // Delete all configuration descriptor data
- //
- ConfigEntry = (CONFIG_DESC_LIST_ENTRY *) UsbIoDevice->ConfigDescListHead.ForwardLink;
-
- while (ConfigEntry != (CONFIG_DESC_LIST_ENTRY *) &UsbIoDevice->ConfigDescListHead) {
- //
- // Delete all its interface descriptors
- //
- InterfaceEntry = (INTERFACE_DESC_LIST_ENTRY *) ConfigEntry->InterfaceDescListHead.ForwardLink;
-
- while (InterfaceEntry != (INTERFACE_DESC_LIST_ENTRY *) &ConfigEntry->InterfaceDescListHead) {
- //
- // Delete all its endpoint descriptors
- //
- EndpointEntry = (ENDPOINT_DESC_LIST_ENTRY *) InterfaceEntry->EndpointDescListHead.ForwardLink;
- while (EndpointEntry != (ENDPOINT_DESC_LIST_ENTRY *) &InterfaceEntry->EndpointDescListHead) {
- NextEntry = ((LIST_ENTRY *) EndpointEntry)->ForwardLink;
- RemoveEntryList ((LIST_ENTRY *) EndpointEntry);
- gBS->FreePool (EndpointEntry);
- EndpointEntry = (ENDPOINT_DESC_LIST_ENTRY *) NextEntry;
- }
-
- NextEntry = ((LIST_ENTRY *) InterfaceEntry)->ForwardLink;
- RemoveEntryList ((LIST_ENTRY *) InterfaceEntry);
- gBS->FreePool (InterfaceEntry);
- InterfaceEntry = (INTERFACE_DESC_LIST_ENTRY *) NextEntry;
- }
-
- NextEntry = ((LIST_ENTRY *) ConfigEntry)->ForwardLink;
- RemoveEntryList ((LIST_ENTRY *) ConfigEntry);
- gBS->FreePool (ConfigEntry);
- ConfigEntry = (CONFIG_DESC_LIST_ENTRY *) NextEntry;
- }
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c
deleted file mode 100644
index 97c9f5e..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c
+++ /dev/null
@@ -1,3719 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- UsbBus.c
-
- Abstract:
-
- USB Bus Driver
-
- Revision History
-
---*/
-
-#include "usbbus.h"
-
-
-GLOBAL_REMOVE_IF_UNREFERENCED UINTN gUSBDebugLevel = EFI_D_INFO;
-GLOBAL_REMOVE_IF_UNREFERENCED UINTN gUSBErrorLevel = EFI_D_ERROR;
-
-//
-// The UsbBusProtocol is just used to locate USB_BUS_CONTROLLER
-// structure in the UsbBusDriverControllerDriverStop(). Then we can
-// Close all opened protocols and release this structure.
-//
-STATIC EFI_GUID mUsbBusProtocolGuid = EFI_USB_BUS_PROTOCOL_GUID;
-
-EFI_DRIVER_BINDING_PROTOCOL gUsbBusDriverBinding = {
- UsbBusControllerDriverSupported,
- UsbBusControllerDriverStart,
- UsbBusControllerDriverStop,
- 0xa,
- NULL,
- NULL
-};
-
-//
-// Internal use only
-//
-STATIC
-EFI_STATUS
-ReportUsbStatusCode (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusController,
- IN EFI_STATUS_CODE_TYPE Type,
- IN EFI_STATUS_CODE_VALUE Code
- );
-
-STATIC
-USB_IO_CONTROLLER_DEVICE *
-CreateUsbIoControllerDevice (
- VOID
- );
-
-STATIC
-EFI_STATUS
-InitUsbIoController (
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController
- );
-
-//
-// USB Device Configuration / Deconfiguration
-//
-STATIC
-EFI_STATUS
-UsbDeviceConfiguration (
- IN USB_IO_CONTROLLER_DEVICE *ParentHubController,
- IN EFI_HANDLE HostController,
- IN UINT8 ParentPort,
- IN USB_IO_DEVICE *UsbIoDevice
- );
-
-//
-// Usb Bus enumeration function
-//
-STATIC
-VOID
-RootHubEnumeration (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-STATIC
-VOID
-HubEnumeration (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-STATIC
-EFI_STATUS
-UsbSetTransactionTranslator (
- IN USB_IO_CONTROLLER_DEVICE *ParentHubController,
- IN UINT8 ParentPort,
- IN OUT USB_IO_DEVICE *Device
- );
-
-STATIC
-EFI_STATUS
-UsbUnsetTransactionTranslator (
- USB_IO_DEVICE *Device
- );
-
-STATIC
-EFI_STATUS
-IdentifyDeviceSpeed (
- USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- USB_IO_DEVICE *NewDevice,
- UINT8 Index
- );
-
-STATIC
-EFI_STATUS
-ReleasePortToCHC (
- USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- UINT8 PortNum
- );
-
-STATIC
-EFI_STATUS
-ResetRootPort (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 PortNum,
- IN UINT8 RetryTimes
- );
-
-STATIC
-EFI_STATUS
-ResetHubPort (
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController,
- IN UINT8 PortIndex
- );
-
-STATIC
-EFI_STATUS
-ParentPortReset (
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController,
- IN BOOLEAN ReConfigure,
- IN UINT8 RetryTimes
- );
-
-//
-// Following are address allocate and free functions
-//
-STATIC
-UINT8
-UsbAllocateAddress (
- IN UINT8 *AddressPool
- )
-/*++
-
- Routine Description:
- Allocate address for usb device
-
- Arguments:
- AddressPool - Pool of usb device address
-
- Returns:
- Usb device address
-
---*/
-{
- UINT8 ByteIndex;
- UINT8 BitIndex;
-
- for (ByteIndex = 0; ByteIndex < 16; ByteIndex++) {
- for (BitIndex = 0; BitIndex < 8; BitIndex++) {
- if ((AddressPool[ByteIndex] & (1 << BitIndex)) == 0) {
- //
- // Found one, covert to address, and mark it use
- //
- AddressPool[ByteIndex] = (UINT8) (AddressPool[ByteIndex] | (1 << BitIndex));
- return (UINT8) (ByteIndex * 8 + BitIndex);
- }
- }
- }
-
- return 0;
-
-}
-
-STATIC
-VOID
-UsbFreeAddress (
- IN UINT8 DevAddress,
- IN UINT8 *AddressPool
- )
-/*++
-
- Routine Description:
- Free address for usb device
-
- Arguments:
- DevAddress - Usb device address
- AddressPool - Pool of usb device address
-
- Returns:
- VOID
-
---*/
-{
- UINT8 WhichByte;
- UINT8 WhichBit;
- //
- // Locate the position
- //
- WhichByte = (UINT8) (DevAddress / 8);
- WhichBit = (UINT8) (DevAddress & 0x7);
-
- AddressPool[WhichByte] = (UINT8) (AddressPool[WhichByte] & (~(1 << WhichBit)));
-}
-
-EFI_STATUS
-EFIAPI
-UsbBusControllerDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- that has UsbHcProtocol installed will be supported.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test
- RemainingDevicePath - Device Path Protocol instance pointer
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_UNSUPPORTED - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_USB2_HC_PROTOCOL *Usb2Hc;
- EFI_USB_HC_PROTOCOL *UsbHc;
- EFI_DEV_PATH_PTR Node;
-
- //
- // Check Device Path
- //
- if (RemainingDevicePath != NULL) {
- Node.DevPath = RemainingDevicePath;
- if (Node.DevPath->Type != MESSAGING_DEVICE_PATH ||
- Node.DevPath->SubType != MSG_USB_DP ||
- DevicePathNodeLength(Node.DevPath) != sizeof(USB_DEVICE_PATH)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- //
- // Check whether USB Host Controller Protocol is already
- // installed on this handle. If it is installed, we can start
- // USB Bus Driver now.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- (VOID **) &Usb2Hc,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- (VOID **) &UsbHc,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_SUCCESS;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UsbBusControllerDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
-
- Starting the Usb Bus Driver
-
- Arguments:
-
- This - Protocol instance pointer.
- Controller - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
-
- EFI_SUCCESS - This driver supports this device.
- EFI_DEVICE_ERROR - This driver cannot be started due to device
- EFI_OUT_OF_RESOURCES- Can't allocate memory resources
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS OpenStatus;
- USB_BUS_CONTROLLER_DEVICE *UsbBusDev;
- USB_IO_DEVICE *RootHub;
- USB_IO_CONTROLLER_DEVICE *RootHubController;
- UINT8 MaxSpeed;
- UINT8 PortNumber;
- UINT8 Is64BitCapable;
-
- //
- // Allocate USB_BUS_CONTROLLER_DEVICE structure
- //
- UsbBusDev = NULL;
- UsbBusDev = AllocateZeroPool (sizeof (USB_BUS_CONTROLLER_DEVICE));
- if (UsbBusDev == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- UsbBusDev->Signature = USB_BUS_DEVICE_SIGNATURE;
- UsbBusDev->AddressPool[0] = 1;
-
- //
- // Get the Device Path Protocol on Controller's handle
- //
- OpenStatus = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &UsbBusDev->DevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (OpenStatus)) {
- gBS->FreePool (UsbBusDev);
- return OpenStatus;
- }
- //
- // Locate the Host Controller Interface
- //
- OpenStatus = gBS->OpenProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- (VOID **) &(UsbBusDev->Usb2HCInterface),
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (OpenStatus)) {
-
- UsbBusDev->Hc2ProtocolSupported = FALSE;
- OpenStatus = gBS->OpenProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- (VOID **) &(UsbBusDev->UsbHCInterface),
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (OpenStatus)) {
- //
- // Report Status Code here since we will reset the host controller
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_IO_BUS_USB | EFI_IOB_EC_CONTROLLER_ERROR,
- UsbBusDev->DevicePath
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- gBS->FreePool (UsbBusDev);
- return OpenStatus;
- }
-
- DEBUG ((gUSBDebugLevel, "UsbHcProtocol Opened.\n"));
- } else {
- DEBUG ((gUSBDebugLevel, "Usb2HcProtocol Opened.\n"));
- UsbBusDev->Hc2ProtocolSupported = TRUE;
- }
-
- //
- // Attach EFI_USB_BUS_PROTOCOL to controller handle,
- // for locate UsbBusDev later
- //
- Status = gBS->InstallProtocolInterface (
- &Controller,
- &mUsbBusProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &UsbBusDev->BusIdentify
- );
-
- if (EFI_ERROR (Status)) {
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- if (UsbBusDev->Hc2ProtocolSupported) {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- gBS->FreePool (UsbBusDev);
- return Status;
- }
- //
- // Add root hub to the tree
- //
- RootHub = NULL;
- RootHub = AllocateZeroPool (sizeof (USB_IO_DEVICE));
- if (RootHub == NULL) {
- gBS->UninstallProtocolInterface (
- Controller,
- &mUsbBusProtocolGuid,
- &UsbBusDev->BusIdentify
- );
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- if (UsbBusDev->Hc2ProtocolSupported) {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- gBS->FreePool (UsbBusDev);
- return EFI_OUT_OF_RESOURCES;
- }
-
- RootHub->BusController = UsbBusDev;
- RootHub->DeviceAddress = UsbAllocateAddress (UsbBusDev->AddressPool);
-
- UsbBusDev->Root = RootHub;
-
- //
- // Allocate Root Hub Controller
- //
- RootHubController = CreateUsbIoControllerDevice ();
- if (RootHubController == NULL) {
- gBS->UninstallProtocolInterface (
- Controller,
- &mUsbBusProtocolGuid,
- &UsbBusDev->BusIdentify
- );
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- if (UsbBusDev->Hc2ProtocolSupported) {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
- gBS->FreePool (UsbBusDev);
- gBS->FreePool (RootHub);
- return EFI_OUT_OF_RESOURCES;
- }
-
- UsbVirtualHcGetCapability (
- UsbBusDev,
- &MaxSpeed,
- &PortNumber,
- &Is64BitCapable
- );
- RootHubController->DownstreamPorts = PortNumber;
- RootHubController->UsbDevice = RootHub;
- RootHubController->IsUsbHub = TRUE;
- RootHubController->DevicePath = UsbBusDev->DevicePath;
- RootHubController->HostController = Controller;
-
- RootHub->NumOfControllers = 1;
- RootHub->UsbController[0] = RootHubController;
- RootHub->DeviceSpeed = MaxSpeed;
-
- //
- // Report Status Code here since we will reset the host controller
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_USB | EFI_IOB_PC_RESET,
- UsbBusDev->DevicePath
- );
-
- //
- // Reset USB Host Controller
- //
- UsbVirtualHcReset (
- UsbBusDev,
- EFI_USB_HC_RESET_GLOBAL
- );
-
- //
- // Report Status Code while we are going to bring up the Host Controller
- // and start bus enumeration
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_USB | EFI_IOB_PC_ENABLE,
- UsbBusDev->DevicePath
- );
-
- //
- // Start USB Host Controller
- //
- UsbVirtualHcSetState (
- UsbBusDev,
- EfiUsbHcStateOperational
- );
-
- //
- // Create a timer to query root ports periodically
- //
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- RootHubEnumeration,
- RootHubController,
- &RootHubController->HubNotify
- );
- if (EFI_ERROR (Status)) {
- gBS->UninstallProtocolInterface (
- Controller,
- &mUsbBusProtocolGuid,
- &UsbBusDev->BusIdentify
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- gBS->FreePool (RootHubController);
- gBS->FreePool (RootHub);
- gBS->FreePool (UsbBusDev);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Before depending on the timer to check root ports periodically,
- // here we should check them immediately for the first time, or
- // there will be an interval between bus start and devices start.
- //
- gBS->SignalEvent (RootHubController->HubNotify);
-
- Status = gBS->SetTimer (
- RootHubController->HubNotify,
- TimerPeriodic,
- BUSPOLLING_PERIOD
- );
- if (EFI_ERROR (Status)) {
- gBS->UninstallProtocolInterface (
- Controller,
- &mUsbBusProtocolGuid,
- &UsbBusDev->BusIdentify
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- gBS->CloseEvent (RootHubController->HubNotify);
- gBS->FreePool (RootHubController);
- gBS->FreePool (RootHub);
- gBS->FreePool (UsbBusDev);
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-//
-// Stop the bus controller
-//
-EFI_STATUS
-EFIAPI
-UsbBusControllerDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop this driver on ControllerHandle. Support stoping any child handles
- created by this driver.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to stop driver on
- NumberOfChildren - Number of Children in the ChildHandleBuffer
- ChildHandleBuffer - List of handles for the children we need to stop.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- others
-
---*/
-{
- EFI_STATUS Status;
- USB_IO_DEVICE *Root;
- USB_IO_CONTROLLER_DEVICE *RootHubController;
- USB_BUS_CONTROLLER_DEVICE *UsbBusController;
- EFI_USB_BUS_PROTOCOL *UsbIdentifier;
- UINT8 Index2;
- USB_IO_CONTROLLER_DEVICE *UsbController;
- USB_IO_DEVICE *UsbIoDevice;
- USB_IO_CONTROLLER_DEVICE *HubController;
- UINTN Index;
- EFI_USB_IO_PROTOCOL *UsbIo;
-
- if (NumberOfChildren > 0) {
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- //
- // We are here since the handle passed in does not support
- // UsbIo protocol. There are several reasons that will cause
- // this.
- // For combo device such as keyboard, it may have 2 devices
- // in one, namely, keyboard and mouse. If we deconfigure one
- // of them, the other will be freed at the same time. This will
- // cause the status error. But this is the correct behavior.
- // For hub device, if we deconfigure hub first, the other chile
- // device will be disconnected also, this will also provide us
- // a status error. Now we will only report EFI_SUCCESS since Uhc
- // driver will be disconnected at the second time.(pls see
- // CoreDisconnectController for details)
- //
- continue;
- }
-
- UsbController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (UsbIo);
- UsbIoDevice = UsbController->UsbDevice;
- HubController = UsbController->Parent;
- UsbDeviceDeConfiguration (UsbIoDevice);
- for (Index2 = 0; Index2 < HubController->DownstreamPorts; Index2++) {
- if (HubController->Children[Index2] == UsbIoDevice) {
- HubController->Children[Index2] = NULL;
- }
- }
- }
-
- return EFI_SUCCESS;
- }
- //
- // Get the USB_BUS_CONTROLLER_DEVICE
- //
- Status = gBS->OpenProtocol (
- Controller,
- &mUsbBusProtocolGuid,
- (VOID **) &UsbIdentifier,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- UsbBusController = USB_BUS_CONTROLLER_DEVICE_FROM_THIS (UsbIdentifier);
-
- //
- // Stop USB Host Controller
- //
-
- //
- // Report Status Code here since we will reset the host controller
- //
- ReportUsbStatusCode (
- UsbBusController,
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_USB | EFI_IOB_PC_RESET
- );
-
- UsbVirtualHcSetState (
- UsbBusController,
- EfiUsbHcStateHalt
- );
-
- //
- // Deconfiguration all its devices
- //
- Root = UsbBusController->Root;
- RootHubController = Root->UsbController[0];
-
- gBS->CloseEvent (RootHubController->HubNotify);
-
- for (Index2 = 0; Index2 < RootHubController->DownstreamPorts; Index2++) {
- if (RootHubController->Children[Index2]) {
- UsbDeviceDeConfiguration (RootHubController->Children[Index2]);
- RootHubController->Children[Index2] = NULL;
- }
- }
-
- gBS->FreePool (RootHubController);
- gBS->FreePool (Root);
-
- //
- // Uninstall USB Bus Protocol
- //
- gBS->UninstallProtocolInterface (
- Controller,
- &mUsbBusProtocolGuid,
- &UsbBusController->BusIdentify
- );
-
- //
- // Close USB_HC_PROTOCOL & DEVICE_PATH_PROTOCOL
- // Opened by this Controller
- //
- if (UsbBusController->Hc2ProtocolSupported) {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsb2HcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbHcProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- gBS->FreePool (UsbBusController);
-
- return EFI_SUCCESS;
-}
-//
-// USB Device Configuration
-//
-STATIC
-EFI_STATUS
-UsbDeviceConfiguration (
- IN USB_IO_CONTROLLER_DEVICE *ParentHubController,
- IN EFI_HANDLE HostController,
- IN UINT8 ParentPort,
- IN USB_IO_DEVICE *UsbIoDevice
- )
-/*++
-
- Routine Description:
- Configurate a new device attached to the usb bus
-
- Arguments:
- ParentHubController - Parent Hub which this device is connected.
- HostController - Host Controller handle
- ParentPort - Parent Hub port which this device is connected.
- UsbIoDevice - The device to be configured.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- UINT8 DevAddress;
- UINT8 Index;
- EFI_STATUS Result;
- UINT32 Status;
- CHAR16 *StrManufacturer;
- CHAR16 *StrProduct;
- CHAR16 *StrSerialNumber;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 NumOfInterface;
- USB_IO_CONTROLLER_DEVICE *FirstController;
- USB_BUS_CONTROLLER_DEVICE *UsbBusDev;
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
-
- UsbBusDev = UsbIoDevice->BusController;
-
- UsbSetTransactionTranslator (
- ParentHubController,
- ParentPort,
- UsbIoDevice
- );
-
- //
- // Since a USB device must have at least on interface,
- // so create this instance first
- //
- FirstController = CreateUsbIoControllerDevice ();
- FirstController->UsbDevice = UsbIoDevice;
- UsbIoDevice->UsbController[0] = FirstController;
- FirstController->InterfaceNumber = 0;
- FirstController->ParentPort = ParentPort;
- FirstController->Parent = ParentHubController;
- FirstController->HostController = HostController;
-
- InitializeUsbIoInstance (FirstController);
-
- DEBUG ((gUSBDebugLevel, "Configuration Usb Device at 0x%x...\n", ParentPort));
-
- //
- // Ensure we used the correctly USB I/O instance
- //
- UsbIo = &FirstController->UsbIo;
-
- if (UsbIoDevice->DeviceSpeed != EFI_USB_SPEED_HIGH) {
- ParentPortReset (FirstController, FALSE, 0);
- }
-
- //
- // First retrieve the 1st 8 bytes of
- // in order to get the MaxPacketSize for Endpoint 0
- //
- for (Index = 0; Index < 3; Index++) {
-
- UsbIoDevice->DeviceDescriptor.MaxPacketSize0 = 8;
-
- gBS->Stall (100 * 1000);
-
- Result = UsbGetDescriptor (
- UsbIo,
- (USB_DT_DEVICE << 8),
- 0,
- 8,
- &UsbIoDevice->DeviceDescriptor,
- &Status
- );
- if (!EFI_ERROR (Result)) {
- DEBUG (
- (gUSBDebugLevel,
- "Get Device Descriptor Success, MaxPacketSize0 = 0x%x\n",
- UsbIoDevice->DeviceDescriptor.MaxPacketSize0)
- );
- break;
- }
-
- }
-
- if (Index == 3) {
- ReportUsbStatusCode (
- UsbBusDev,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_IO_BUS_USB | EFI_IOB_EC_READ_ERROR
- );
- DEBUG ((gUSBErrorLevel, "Get Device Descriptor Fail when configing\n"));
- gBS->FreePool (FirstController);
- return EFI_DEVICE_ERROR;
- }
-
- DevAddress = UsbAllocateAddress (UsbIoDevice->BusController->AddressPool);
- if (DevAddress == 0) {
- DEBUG ((gUSBErrorLevel, "Cannot allocate address\n"));
- gBS->FreePool (FirstController);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Result = UsbSetDeviceAddress (UsbIo, DevAddress, &Status);
-
- if (EFI_ERROR (Result)) {
- DEBUG ((gUSBErrorLevel, "Set address error\n"));
- ReportUsbStatusCode (
- UsbBusDev,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_IO_BUS_USB | EFI_IOB_EC_WRITE_ERROR
- );
-
- UsbFreeAddress (
- DevAddress,
- UsbIoDevice->BusController->AddressPool
- );
-
- gBS->FreePool (FirstController);
- return EFI_DEVICE_ERROR;
- }
-
- UsbIoDevice->DeviceAddress = DevAddress;
-
- //
- // SetAddress Complete Time by Spec, Max 50ms
- //
- gBS->Stall (10 * 1000);
-
- //
- // Get the whole device descriptor
- //
- Result = UsbGetDescriptor (
- UsbIo,
- (USB_DT_DEVICE << 8),
- 0,
- sizeof (EFI_USB_DEVICE_DESCRIPTOR),
- &UsbIoDevice->DeviceDescriptor,
- &Status
- );
-
- if (EFI_ERROR (Result)) {
- DEBUG ((gUSBErrorLevel, "Get whole Device Descriptor error\n"));
- ReportUsbStatusCode (
- UsbBusDev,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_IO_BUS_USB | EFI_IOB_EC_READ_ERROR
- );
- UsbFreeAddress (
- DevAddress,
- UsbIoDevice->BusController->AddressPool
- );
-
- gBS->FreePool (FirstController);
- return EFI_DEVICE_ERROR;
- }
- //
- // Get & parse all configurations for this device, including
- // all configuration descriptors, all interface descriptors, all
- // endpoint descriptors
- //
- Result = UsbGetAllConfigurations (UsbIoDevice);
-
- if (EFI_ERROR (Result)) {
- DEBUG ((gUSBErrorLevel, "Failed to get device configuration\n"));
- ReportUsbStatusCode (
- UsbBusDev,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_IO_BUS_USB | EFI_IOB_EC_READ_ERROR
- );
- UsbFreeAddress (
- DevAddress,
- UsbIoDevice->BusController->AddressPool
- );
-
- gBS->FreePool (FirstController);
- return EFI_DEVICE_ERROR;
- }
- //
- // Set the 1st configuration value
- //
- Result = UsbSetDefaultConfiguration (UsbIoDevice);
- if (EFI_ERROR (Result)) {
- DEBUG ((gUSBErrorLevel, "Failed to set device configuration\n"));
- ReportUsbStatusCode (
- UsbBusDev,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_IO_BUS_USB | EFI_IOB_EC_WRITE_ERROR
- );
- UsbFreeAddress (
- DevAddress,
- UsbIoDevice->BusController->AddressPool
- );
-
- gBS->FreePool (FirstController);
- return EFI_DEVICE_ERROR;
- }
-
- UsbIoDevice->IsConfigured = TRUE;
-
- //
- // Get all string table if applicable
- //
- Result = UsbGetStringtable (UsbIoDevice);
- if (EFI_ERROR (Result)) {
- DEBUG ((gUSBDebugLevel, "Device doesn't support string table\n"));
- } else {
-
- StrManufacturer = NULL;
- UsbIo->UsbGetStringDescriptor (
- UsbIo,
- UsbIoDevice->LangID[0],
- (UsbIoDevice->DeviceDescriptor).StrManufacturer,
- &StrManufacturer
- );
-
- StrProduct = NULL;
- UsbIo->UsbGetStringDescriptor (
- UsbIo,
- UsbIoDevice->LangID[0],
- (UsbIoDevice->DeviceDescriptor).StrProduct,
- &StrProduct
- );
-
- StrSerialNumber = NULL;
- UsbIo->UsbGetStringDescriptor (
- UsbIo,
- UsbIoDevice->LangID[0],
- (UsbIoDevice->DeviceDescriptor).StrSerialNumber,
- &StrSerialNumber
- );
-
- if (StrManufacturer) {
- gBS->FreePool (StrManufacturer);
- }
-
- if (StrProduct) {
- gBS->FreePool (StrProduct);
- }
-
- if (StrSerialNumber) {
- gBS->FreePool (StrSerialNumber);
- }
- }
- //
- // Create USB_IO_CONTROLLER_DEVICE for
- // each detected interface
- //
- FirstController->CurrentConfigValue =
- UsbIoDevice->ActiveConfig->CongfigDescriptor.ConfigurationValue;
-
- NumOfInterface =
- UsbIoDevice->ActiveConfig->CongfigDescriptor.NumInterfaces;
- UsbIoDevice->NumOfControllers = NumOfInterface;
-
- Result = InitUsbIoController (FirstController);
- if (EFI_ERROR (Result)) {
- ReportUsbStatusCode (
- UsbBusDev,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_IO_BUS_USB | EFI_IOB_EC_INTERFACE_ERROR
- );
- gBS->FreePool (FirstController);
- UsbIoDevice->UsbController[0] = NULL;
- return EFI_DEVICE_ERROR;
- }
-
- for (Index = 1; Index < NumOfInterface; Index++) {
- UsbIoController = CreateUsbIoControllerDevice ();
- UsbIoController->UsbDevice = UsbIoDevice;
- UsbIoController->CurrentConfigValue =
- UsbIoDevice->ActiveConfig->CongfigDescriptor.ConfigurationValue;
- UsbIoController->InterfaceNumber = Index;
- UsbIoDevice->UsbController[Index] = UsbIoController;
- UsbIoController->ParentPort = ParentPort;
- UsbIoController->Parent = ParentHubController;
- UsbIoController->HostController = HostController;
-
- //
- // First copy the USB_IO Protocol instance
- //
- CopyMem (
- &UsbIoController->UsbIo,
- UsbIo,
- sizeof (EFI_USB_IO_PROTOCOL)
- );
-
- Result = InitUsbIoController (UsbIoController);
- if (EFI_ERROR (Result)) {
- ReportUsbStatusCode (
- UsbBusDev,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_IO_BUS_USB | EFI_IOB_EC_INTERFACE_ERROR
- );
- gBS->FreePool (UsbIoController);
- UsbIoDevice->UsbController[Index] = NULL;
- }
- }
-
- return EFI_SUCCESS;
-}
-//
-// USB Device DeConfiguration
-//
-EFI_STATUS
-UsbDeviceDeConfiguration (
- IN USB_IO_DEVICE *UsbIoDevice
- )
-/*++
-
- Routine Description:
- Remove Device, Device Handles, Uninstall Protocols.
-
- Arguments:
- UsbIoDevice - The device to be deconfigured.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- USB_IO_CONTROLLER_DEVICE *UsbController;
- UINT8 index;
- USB_IO_DEVICE *ChildDevice;
- UINT8 Index;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_STATUS Status;
-
- //
- // Double check UsbIoDevice exists
- //
- if (UsbIoDevice == NULL) {
- return EFI_SUCCESS;
- }
-
- UsbUnsetTransactionTranslator (UsbIoDevice);
-
- for (index = 0; index < UsbIoDevice->NumOfControllers; index++) {
- //
- // Check if it is a hub, if so, de configuration all its
- // downstream ports
- //
- UsbController = UsbIoDevice->UsbController[index];
-
- //
- // Check the controller pointer
- //
- if (UsbController == NULL) {
- continue;
- }
-
- if (UsbController->IsUsbHub) {
-
- DEBUG ((gUSBDebugLevel, "Hub Deconfig, First Deconfig its downstream ports\n"));
-
- //
- // First Remove interrupt transfer request for the status
- // change port
- //
- UsbIo = &UsbController->UsbIo;
- UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- UsbController->HubEndpointAddress,
- FALSE,
- 0,
- 0,
- NULL,
- NULL
- );
-
- if (NULL != UsbController->HubNotify) {
- gBS->CloseEvent (UsbController->HubNotify);
- }
-
- for (Index = 0; Index < UsbController->DownstreamPorts; Index++) {
- if (UsbController->Children[Index]) {
- ChildDevice = UsbController->Children[Index];
- UsbDeviceDeConfiguration (ChildDevice);
- UsbController->Children[Index] = NULL;
- }
- }
- }
- //
- // If the controller is managed by a device driver, we need to
- // disconnect them
- //
- if (UsbController->IsManagedByDriver) {
- gBS->DisconnectController (
- UsbController->Handle,
- NULL,
- NULL
- );
- }
-
- //
- // remove child handle reference to the USB_HC_PROTOCOL
- //
- if (UsbIoDevice->BusController->Hc2ProtocolSupported) {
- gBS->CloseProtocol (
- UsbController->HostController,
- &gEfiUsb2HcProtocolGuid,
- gUsbBusDriverBinding.DriverBindingHandle,
- UsbController->Handle
- );
- } else {
- gBS->CloseProtocol (
- UsbController->HostController,
- &gEfiUsbHcProtocolGuid,
- gUsbBusDriverBinding.DriverBindingHandle,
- UsbController->Handle
- );
- }
- //
- // Uninstall EFI_USB_IO_PROTOCOL & DEVICE_PATH_PROTOCOL
- // installed on this handle
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- UsbController->Handle,
- &gEfiDevicePathProtocolGuid,
- UsbController->DevicePath,
- &gEfiUsbIoProtocolGuid,
- &UsbController->UsbIo,
- NULL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (UsbController->DevicePath != NULL) {
- gBS->FreePool (UsbController->DevicePath);
- }
-
- gBS->FreePool (UsbController);
- UsbIoDevice->UsbController[index] = NULL;
- }
- //
- // Free address for later use
- //
- UsbFreeAddress (
- UsbIoDevice->DeviceAddress,
- UsbIoDevice->BusController->AddressPool
- );
-
- //
- // Free all resouces allocated for all its configurations
- //
- UsbDestroyAllConfiguration (UsbIoDevice);
-
- if (UsbIoDevice) {
- gBS->FreePool (UsbIoDevice);
- UsbIoDevice = NULL;
- }
-
- return EFI_SUCCESS;
-}
-//
-// After interrupt complete, this function will be called,
-// This function need to be well-defined later
-//
-STATIC
-EFI_STATUS
-EFIAPI
-OnHubInterruptComplete (
- IN VOID *Data,
- IN UINTN DataLength,
- IN VOID *Context,
- IN UINT32 Result
- )
-/*++
-
- Routine Description:
- Whenever hub interrupt occurs, this routine will be called to check
- which event happens.
-
- Arguments:
- Data - Hub interrupt transfer data.
- DataLength - The length of the Data.
- Context - Hub Controller Device.
- Result - Hub interrupt transfer status.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- USB_IO_CONTROLLER_DEVICE *HubController;
- UINT8 Index;
- UINT8 *ptr;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT32 UsbResult;
- BOOLEAN Disconnected;
- EFI_STATUS Status;
-
- HubController = (USB_IO_CONTROLLER_DEVICE *) Context;
- UsbIo = &HubController->UsbIo;
-
- //
- // If something error in this interrupt transfer,
- //
- if (Result != EFI_USB_NOERROR) {
- if ((Result & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) {
- UsbClearEndpointHalt (
- UsbIo,
- HubController->HubEndpointAddress,
- &UsbResult
- );
- }
-
- //
- // Delete & Submit this interrupt again
- //
- UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- HubController->HubEndpointAddress,
- FALSE,
- 0,
- 0,
- NULL,
- NULL
- );
-
- //
- // try to detect if the hub itself was disconnected or not
- //
- Status = IsDeviceDisconnected (
- HubController,
- &Disconnected
- );
-
- if (!EFI_ERROR (Status) && Disconnected == TRUE) {
- DEBUG ((gUSBErrorLevel, "Hub is disconnected\n"));
- return EFI_DEVICE_ERROR;
- }
- //
- // Hub ports < 7
- //
- UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- HubController->HubEndpointAddress,
- TRUE,
- 100,
- 1,
- OnHubInterruptComplete,
- HubController
- );
-
- return EFI_DEVICE_ERROR;
- }
-
- if (DataLength == 0 || Data == NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // Scan which port has status change
- // Bit 0 stands for hub itself, other bit stands for
- // the corresponding port
- //
- for (Index = 0; Index < DataLength * 8; Index++) {
- ptr = (UINT8 *) Data + Index / 8;
- if ((*ptr) & (1 << (Index & 0x7))) {
- HubController->StatusChangePort = Index;
- break;
- }
- }
- //
- // Signal hub notify event
- //
- gBS->SignalEvent (HubController->HubNotify);
-
- return EFI_SUCCESS;
-}
-//
-// USB Root Hub Enumerator
-//
-STATIC
-VOID
-EFIAPI
-RootHubEnumeration (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
-
- This is USB RootHub enumerator
-
- Arguments:
-
- Event - Indicating which event is signaled
- Context - actually it is a USB_IO_DEVICE
-
- Returns:
-
- VOID
-
---*/
-{
- USB_IO_CONTROLLER_DEVICE *HubController;
- EFI_USB_PORT_STATUS HubPortStatus;
- EFI_STATUS Status;
- UINT8 Index;
- USB_IO_DEVICE *UsbIoDev;
- USB_BUS_CONTROLLER_DEVICE *UsbBusDev;
- EFI_HANDLE HostController;
- USB_IO_DEVICE *OldUsbIoDevice;
- USB_IO_DEVICE *NewDevice;
- USB_IO_CONTROLLER_DEVICE *NewController;
- UINT8 Index2;
- EFI_USB_IO_PROTOCOL *UsbIo;
-
- HubController = (USB_IO_CONTROLLER_DEVICE *) Context;
- HostController = HubController->HostController;
- UsbBusDev = HubController->UsbDevice->BusController;
-
- //
- // Root hub has the address 1
- //
- UsbIoDev = HubController->UsbDevice;
-
- for (Index = 0; Index < HubController->DownstreamPorts; Index++) {
-
- UsbVirtualHcGetRootHubPortStatus (
- UsbBusDev,
- Index,
- (EFI_USB_PORT_STATUS *) &HubPortStatus
- );
-
- if (!IsPortConnectChange (HubPortStatus.PortChangeStatus)) {
- continue;
- }
- //
- // Clear root hub status change status
- //
- UsbVirtualHcClearRootHubPortFeature (
- UsbBusDev,
- Index,
- EfiUsbPortConnectChange
- );
-
- gBS->Stall (100 * 1000);
-
- UsbVirtualHcGetRootHubPortStatus (
- UsbBusDev,
- Index,
- (EFI_USB_PORT_STATUS *) &HubPortStatus
- );
-
- if (IsPortConnect (HubPortStatus.PortStatus)) {
-
- //
- // There is something connected to this port
- //
- DEBUG ((gUSBDebugLevel, "Something connected to Root Hub at Port0x%x\n", Index));
-
- ReportUsbStatusCode (
- UsbBusDev,
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_USB | EFI_IOB_PC_HOTPLUG
- );
- //
- // if there is something physically detached, but still logically
- // attached...
- //
- OldUsbIoDevice = HubController->Children[Index];
-
- if (NULL != OldUsbIoDevice) {
- UsbDeviceDeConfiguration (OldUsbIoDevice);
- HubController->Children[Index] = NULL;
- }
-
- NewDevice = AllocateZeroPool (sizeof (USB_IO_DEVICE));
- if (NewDevice == NULL) {
- return ;
- }
- //
- // Initialize some fields by copying data from
- // its parents
- //
- NewDevice->DeviceDescriptor.MaxPacketSize0 = 8;
- NewDevice->BusController = UsbIoDev->BusController;
-
- //
- // Process of identify device speed
- //
- Status = IdentifyDeviceSpeed (
- UsbBusDev,
- NewDevice,
- Index
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (NewDevice);
- continue;
- }
-
- //
- // Configure that device
- //
- Status = UsbDeviceConfiguration (
- HubController,
- HostController,
- Index,
- NewDevice
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (NewDevice);
- return ;
- }
- //
- // Add this device to the usb bus tree
- //
- HubController->Children[Index] = NewDevice;
-
- for (Index2 = 0; Index2 < NewDevice->NumOfControllers; Index2++) {
- //
- // If this device is hub, add to the hub index
- //
- NewController = NewDevice->UsbController[Index2];
-
- Status = gBS->ConnectController (
- NewController->Handle,
- NULL,
- NULL,
- TRUE
- );
- //
- // If connect success, we need to disconnect when
- // stop the controller, otherwise we need not call
- // gBS->DisconnectController ()
- // This is used by those usb devices we don't plan
- // to support. We can allocate
- // controller handles for them, but we don't have
- // device drivers to manage them.
- //
- NewController->IsManagedByDriver = (BOOLEAN) (!EFI_ERROR (Status));
-
- if (IsHub (NewController)) {
-
- NewController->IsUsbHub = TRUE;
-
- //
- // Configure Hub Controller
- //
- Status = DoHubConfig (NewController);
- if (EFI_ERROR (Status)) {
- continue;
- }
- //
- // Create an event to do hub enumeration
- //
- gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- HubEnumeration,
- NewController,
- &NewController->HubNotify
- );
-
- //
- // Add request to do query hub status
- // change endpoint
- // Hub ports < 7
- //
- UsbIo = &NewController->UsbIo;
- UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- NewController->HubEndpointAddress,
- TRUE,
- 100,
- 1,
- OnHubInterruptComplete,
- NewController
- );
-
- }
- }
- } else {
- //
- // Something disconnected from USB root hub
- //
- DEBUG ((gUSBDebugLevel, "Something disconnected from Root Hub at Port0x%x\n", Index));
-
- OldUsbIoDevice = HubController->Children[Index];
-
- UsbDeviceDeConfiguration (OldUsbIoDevice);
-
- HubController->Children[Index] = NULL;
-
- UsbVirtualHcClearRootHubPortFeature (
- UsbBusDev,
- Index,
- EfiUsbPortEnableChange
- );
- }
- }
-
- return ;
-}
-//
-// USB Root Hub Enumerator
-//
-STATIC
-VOID
-EFIAPI
-HubEnumeration (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
-
- This is Usb Hub enumerator
-
- Arguments:
-
- Event - Indicating which event is signaled
- Context - actually it is a USB_IO_DEVICE
-
- Returns:
-
- VOID
-
---*/
-{
- USB_IO_CONTROLLER_DEVICE *HubController;
- EFI_USB_PORT_STATUS HubPortStatus;
- EFI_STATUS Status;
- USB_BUS_CONTROLLER_DEVICE *UsbBusDev;
- EFI_HANDLE HostController;
- USB_IO_DEVICE *OldUsbIoDevice;
- USB_IO_DEVICE *NewDevice;
- USB_IO_CONTROLLER_DEVICE *NewController;
- UINT8 Index2;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 StatusChangePort;
- UINT8 Number;
-
- HubController = (USB_IO_CONTROLLER_DEVICE *) Context;
- HostController = HubController->HostController;
- UsbBusDev = HubController->UsbDevice->BusController;
-
- //
- // Event from Hub, Get the hub controller handle
- //
- //
- // Get the status change endpoint
- //
- StatusChangePort = HubController->StatusChangePort;
-
- //
- // Clear HubController Status Change Bit
- //
- HubController->StatusChangePort = 0;
-
- if (StatusChangePort == 0) {
- //
- // Hub changes, we don't handle here
- //
- return ;
- }
- //
- // Check which event took place at that port
- //
- UsbIo = &HubController->UsbIo;
- Status = HubGetPortStatus (
- UsbIo,
- StatusChangePort,
- (UINT32 *) &HubPortStatus
- );
-
- if (EFI_ERROR (Status)) {
- return ;
- }
- //
- // Clear some change status
- //
- if (HubPortStatus.PortChangeStatus & USB_PORT_STAT_C_ENABLE) {
- //
- // Clear Hub port enable change
- //
- DEBUG ((gUSBDebugLevel, "Port Enable Change\n"));
- HubClearPortFeature (
- UsbIo,
- StatusChangePort,
- EfiUsbPortEnableChange
- );
-
- HubGetPortStatus (
- UsbIo,
- StatusChangePort,
- (UINT32 *) &HubPortStatus
- );
- }
-
- if (HubPortStatus.PortChangeStatus & USB_PORT_STAT_C_RESET) {
- //
- // Clear Hub reset change
- //
- DEBUG ((gUSBDebugLevel, "Port Reset Change\n"));
- HubClearPortFeature (
- UsbIo,
- StatusChangePort,
- EfiUsbPortResetChange
- );
-
- HubGetPortStatus (
- UsbIo,
- StatusChangePort,
- (UINT32 *) &HubPortStatus
- );
- }
-
- if (HubPortStatus.PortChangeStatus & USB_PORT_STAT_C_OVERCURRENT) {
- //
- // Clear Hub overcurrent change
- //
- DEBUG ((gUSBDebugLevel, "Port Overcurrent Change\n"));
- HubClearPortFeature (
- UsbIo,
- StatusChangePort,
- EfiUsbPortOverCurrentChange
- );
-
- HubGetPortStatus (
- UsbIo,
- StatusChangePort,
- (UINT32 *) &HubPortStatus
- );
- }
-
- if (IsPortConnectChange (HubPortStatus.PortChangeStatus)) {
- //
- // First clear port connection change
- //
- DEBUG ((gUSBDebugLevel, "Port Connection Change\n"));
- HubClearPortFeature (
- UsbIo,
- StatusChangePort,
- EfiUsbPortConnectChange
- );
-
- HubGetPortStatus (
- UsbIo,
- StatusChangePort,
- (UINT32 *) &HubPortStatus
- );
-
- if (IsPortConnect (HubPortStatus.PortStatus)) {
-
- DEBUG ((gUSBDebugLevel, "New Device Connect on Hub port \n"));
-
- ReportUsbStatusCode (
- UsbBusDev,
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_USB | EFI_IOB_PC_HOTPLUG
- );
-
- //
- // if there is something physically detached, but still logically
- // attached...
- //
- OldUsbIoDevice = HubController->Children[StatusChangePort - 1];
-
- if (NULL != OldUsbIoDevice) {
- UsbDeviceDeConfiguration (OldUsbIoDevice);
- HubController->Children[StatusChangePort - 1] = NULL;
- }
-
- NewDevice = AllocateZeroPool (sizeof (USB_IO_DEVICE));
- if (NewDevice == NULL) {
- return ;
- }
- //
- // Initialize some fields
- //
- NewDevice->DeviceDescriptor.MaxPacketSize0 = 8;
- NewDevice->BusController = HubController->UsbDevice->BusController;
-
- //
- // There is something connected to this port,
- // reset that port
- //
- // Disable the enable bit in port status
- //
- HubClearPortFeature (
- UsbIo,
- StatusChangePort,
- EfiUsbPortEnable
- );
-
- gBS->Stall (50 * 1000);
-
- //
- // Wait for bit change
- //
- Number = 10;
- do {
- HubGetPortStatus (
- UsbIo,
- StatusChangePort,
- (UINT32 *) &HubPortStatus
- );
- gBS->Stall (10 * 1000);
- Number -= 1;
- } while ((HubPortStatus.PortStatus & USB_PORT_STAT_ENABLE) == 1 && Number > 0);
-
- if (Number == 0) {
- //
- // Cannot disable port, return error
- //
- DEBUG ((gUSBErrorLevel, "Disable Port Failed\n"));
- gBS->FreePool (NewDevice);
- return ;
- }
-
- HubSetPortFeature (
- UsbIo,
- StatusChangePort,
- EfiUsbPortReset
- );
-
- gBS->Stall (50 * 1000);
-
- //
- // Wait for port reset complete
- //
- Number = 10;
- do {
- HubGetPortStatus (
- UsbIo,
- StatusChangePort,
- (UINT32 *) &HubPortStatus
- );
- gBS->Stall (10 * 1000);
- Number -= 1;
- } while ((HubPortStatus.PortStatus & USB_PORT_STAT_RESET) == 1 && Number > 0);
-
- if (Number == 0) {
- //
- // Cannot reset port, return error
- //
- DEBUG ((gUSBErrorLevel, "Reset Port Failed\n"));
- gBS->FreePool (NewDevice);
- return ;
- }
- //
- // Check high speed or full speed device
- //
- if (HubPortStatus.PortStatus & USB_PORT_STAT_LOW_SPEED) {
- DEBUG ((gUSBDebugLevel, "Low Speed Device Attached to Hub\n"));
- NewDevice->DeviceSpeed = EFI_USB_SPEED_LOW;
- } else if (HubPortStatus.PortStatus & USB_PORT_STAT_HIGH_SPEED) {
- DEBUG ((gUSBDebugLevel, "High Speed Device Attached to Hub\n"));
- NewDevice->DeviceSpeed = EFI_USB_SPEED_HIGH;
- } else {
- DEBUG ((gUSBDebugLevel, "Full Speed Device Attached to Hub\n"));
- NewDevice->DeviceSpeed = EFI_USB_SPEED_FULL;
- }
- //
- // Configure that device
- //
- Status = UsbDeviceConfiguration (
- HubController,
- HostController,
- (UINT8) (StatusChangePort - 1),
- NewDevice
- );
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (NewDevice);
- return ;
- }
- //
- // Add this device to the usb bus tree
- // StatusChangePort is begin from 1,
- //
- HubController->Children[StatusChangePort - 1] = NewDevice;
-
- for (Index2 = 0; Index2 < NewDevice->NumOfControllers; Index2++) {
- //
- // If this device is hub, add to the hub index
- //
- NewController = NewDevice->UsbController[Index2];
-
- //
- // Connect the controller to the driver image
- //
- Status = gBS->ConnectController (
- NewController->Handle,
- NULL,
- NULL,
- TRUE
- );
- //
- // If connect success, we need to disconnect when
- // stop the controller, otherwise we need not call
- // gBS->DisconnectController ()
- // This is used by those usb devices we don't plan
- // to support. We can allocate
- // controller handles for them, but we don't have
- // device drivers to manage them.
- //
- NewController->IsManagedByDriver = (BOOLEAN) (!EFI_ERROR (Status));
-
- //
- // If this device is hub, add to the hub index
- //
- if (IsHub (NewController)) {
-
- NewController->IsUsbHub = TRUE;
-
- //
- // Configure Hub
- //
- Status = DoHubConfig (NewController);
-
- if (EFI_ERROR (Status)) {
- continue;
- }
- //
- // Create an event to do hub enumeration
- //
- gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- HubEnumeration,
- NewController,
- &NewController->HubNotify
- );
-
- //
- // Add request to do query hub status
- // change endpoint
- //
- UsbIo = &NewController->UsbIo;
- UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- NewController->HubEndpointAddress, // Hub endpoint address
- TRUE,
- 100,
- 1, // Hub ports < 7
- OnHubInterruptComplete,
- NewController
- );
- }
- }
- } else {
- //
- // Something disconnected from USB hub
- //
- DEBUG ((gUSBDebugLevel, "Something Device Detached on Hub port\n"));
-
- OldUsbIoDevice = HubController->Children[StatusChangePort - 1];
-
- UsbDeviceDeConfiguration (OldUsbIoDevice);
-
- HubController->Children[StatusChangePort - 1] = NULL;
-
- }
-
- return ;
- }
-
- return ;
-}
-
-STATIC
-USB_IO_CONTROLLER_DEVICE *
-CreateUsbIoControllerDevice (
- VOID
- )
-/*++
-
- Routine Description:
- Allocate a structure for USB_IO_CONTROLLER_DEVICE
-
- Arguments:
- N/A
-
- Returns:
- A pointer to a USB_IO_CONTROLLER_DEVICE structure,
- Or NULL.
-
---*/
-{
- USB_IO_CONTROLLER_DEVICE *UsbIoControllerDev;
-
- //
- // Allocate USB_IO_CONTROLLER_DEVICE structure
- //
- UsbIoControllerDev = NULL;
- UsbIoControllerDev = AllocateZeroPool (sizeof (USB_IO_CONTROLLER_DEVICE));
-
- if (UsbIoControllerDev == NULL) {
- return NULL;
- }
-
- UsbIoControllerDev->Signature = USB_IO_CONTROLLER_SIGNATURE;
-
- return UsbIoControllerDev;
-}
-
-STATIC
-EFI_STATUS
-InitUsbIoController (
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController
- )
-/*++
-
- Routine Description:
- Init and install EFI_USB_IO_PROTOCOL onto that controller.
-
- Arguments:
- UsbIoController - The Controller to be operated.
-
- Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- USB_DEVICE_PATH UsbNode;
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_USB_HC_PROTOCOL *UsbHcProtocol;
- EFI_USB2_HC_PROTOCOL *Usb2HcProtocol;
-
- //
- // Build the child device path for each new USB_IO device
- //
- ZeroMem (&UsbNode, sizeof (UsbNode));
- UsbNode.Header.Type = MESSAGING_DEVICE_PATH;
- UsbNode.Header.SubType = MSG_USB_DP;
- SetDevicePathNodeLength (&UsbNode.Header, sizeof (UsbNode));
- UsbNode.InterfaceNumber = UsbIoController->InterfaceNumber;
- UsbNode.ParentPortNumber = UsbIoController->ParentPort;
- ParentDevicePath = UsbIoController->Parent->DevicePath;
-
- UsbIoController->DevicePath =
- AppendDevicePathNode (ParentDevicePath, &UsbNode.Header);
- if (UsbIoController->DevicePath == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &UsbIoController->Handle,
- &gEfiDevicePathProtocolGuid,
- UsbIoController->DevicePath,
- &gEfiUsbIoProtocolGuid,
- &UsbIoController->UsbIo,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (UsbIoController->UsbDevice->BusController->Hc2ProtocolSupported) {
- Status = gBS->OpenProtocol (
- UsbIoController->HostController,
- &gEfiUsb2HcProtocolGuid,
- (VOID **)&Usb2HcProtocol,
- gUsbBusDriverBinding.DriverBindingHandle,
- UsbIoController->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- Status = gBS->OpenProtocol (
- UsbIoController->HostController,
- &gEfiUsbHcProtocolGuid,
- (VOID **)&UsbHcProtocol,
- gUsbBusDriverBinding.DriverBindingHandle,
- UsbIoController->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-ParentPortReset (
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController,
- IN BOOLEAN ReConfigure,
- IN UINT8 RetryTimes
- )
-/*++
-
- Routine Description:
- Reset parent hub port to which this device is connected.
-
- Arguments:
- UsbIoController - Indicating the Usb Controller Device.
- ReConfigure - Do we need to reconfigure it.
- RetryTimes - Retry Times when failed
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- USB_IO_DEVICE *ParentIoDev;
- USB_IO_DEVICE *UsbIoDev;
- USB_IO_CONTROLLER_DEVICE *ParentController;
- UINT8 HubPort;
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 Address;
-
- ParentController = UsbIoController->Parent;
- ParentIoDev = ParentController->UsbDevice;
- UsbIoDev = UsbIoController->UsbDevice;
- HubPort = UsbIoController->ParentPort;
-
- gBS->Stall (100 * 1000);
-
- if (ParentIoDev->DeviceAddress == 1) {
- DEBUG ((gUSBDebugLevel, "Reset from Root Hub 0x%x\n", HubPort));
- ResetRootPort (ParentIoDev->BusController, HubPort, RetryTimes);
- } else {
- DEBUG ((gUSBDebugLevel, "Reset from Hub, Addr 0x%x\n", ParentIoDev->DeviceAddress));
- ResetHubPort (ParentController, (UINT8) (HubPort + 1));
- }
- //
- // If we only need port reset, just return
- //
- if (!ReConfigure) {
- return EFI_SUCCESS;
- }
- //
- // Re-config that USB device
- //
- UsbIo = &UsbIoController->UsbIo;
-
- //
- // Assign a unique address to this device
- //
- Address = UsbIoDev->DeviceAddress;
- UsbIoDev->DeviceAddress = 0;
-
- Result = UsbSetDeviceAddress (UsbIo, Address, &Status);
- UsbIoDev->DeviceAddress = Address;
-
- if (EFI_ERROR (Result)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Set the device to the default configuration
- //
- Result = UsbSetDefaultConfiguration (UsbIoDev);
- if (EFI_ERROR (Result)) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-UsbPortReset (
- IN EFI_USB_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Resets and reconfigures the USB controller. This function will
- work for all USB devices except USB Hub Controllers.
-
- Arguments:
- This - Indicates the calling context.
-
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_DEVICE_ERROR
-
---*/
-{
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
-
- UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
-
- if (IsHub (UsbIoController)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Since at this time, this device has already been configured,
- // it needs to be re-configured.
- //
- return ParentPortReset (UsbIoController, TRUE, 0);
-}
-
-STATIC
-EFI_STATUS
-ResetRootPort (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 PortNum,
- IN UINT8 RetryTimes
- )
-/*++
-
- Routine Description:
- Reset Root Hub port.
-
- Arguments:
- UsbBusDev - Bus controller of the device.
- PortNum - The given port to be reset.
- RetryTimes - RetryTimes when failed
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_PORT_STATUS PortStatus;
-
- //
- // reset root port
- //
- Status = UsbVirtualHcSetRootHubPortFeature (
- UsbBusDev,
- PortNum,
- EfiUsbPortReset
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- gBS->Stall (50 * 1000);
-
- //
- // clear reset root port
- //
- Status = UsbVirtualHcClearRootHubPortFeature (
- UsbBusDev,
- PortNum,
- EfiUsbPortReset
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- gBS->Stall (1000);
-
- Status = UsbVirtualHcClearRootHubPortFeature (
- UsbBusDev,
- PortNum,
- EfiUsbPortConnectChange
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- UsbVirtualHcGetRootHubPortStatus (
- UsbBusDev,
- PortNum,
- &PortStatus
- );
- if (PortStatus.PortStatus & USB_PORT_STAT_OWNER) {
- //
- // Set port enable
- //
- Status = UsbVirtualHcSetRootHubPortFeature (
- UsbBusDev,
- PortNum,
- EfiUsbPortEnable
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = UsbVirtualHcClearRootHubPortFeature (
- UsbBusDev,
- PortNum,
- EfiUsbPortEnableChange
- );
- }
-
- gBS->Stall ((1 + RetryTimes) * 50 * 1000);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ResetHubPort (
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController,
- IN UINT8 PortIndex
- )
-/*++
-
- Routine Description:
- Reset Hub port.
-
- Arguments:
- UsbIoController - The USB_IO_CONTROLLER_DEVICE instance.
- PortIndex - The given port to be reset.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_PORT_STATUS HubPortStatus;
- UINT8 Number;
-
- ASSERT (UsbIoController->IsUsbHub == TRUE);
-
- UsbIo = &UsbIoController->UsbIo;
-
- HubSetPortFeature (
- UsbIo,
- PortIndex,
- EfiUsbPortReset
- );
-
- gBS->Stall (10 * 1000);
-
- //
- // Wait for port reset complete
- //
- Number = 10;
- do {
- HubGetPortStatus (
- UsbIo,
- PortIndex,
- (UINT32 *) &HubPortStatus
- );
- gBS->Stall (10 * 100);
- Number -= 1;
- } while ((HubPortStatus.PortChangeStatus & USB_PORT_STAT_C_RESET) == 0 && Number > 0);
-
- if (Number == 0) {
- //
- // Cannot reset port, return error
- //
- return EFI_DEVICE_ERROR;
- }
-
- gBS->Stall (1000);
-
- HubGetPortStatus (
- UsbIo,
- PortIndex,
- (UINT32 *) &HubPortStatus
- );
- //
- // reset port will cause some bits change, clear them
- //
- if (HubPortStatus.PortChangeStatus & USB_PORT_STAT_C_ENABLE) {
- DEBUG ((gUSBDebugLevel, "Port Enable Change\n"));
- HubClearPortFeature (
- UsbIo,
- PortIndex,
- EfiUsbPortEnableChange
- );
- }
-
- if (HubPortStatus.PortChangeStatus & USB_PORT_STAT_C_RESET) {
- DEBUG ((gUSBDebugLevel, "Port Reset Change\n"));
- HubClearPortFeature (
- UsbIo,
- PortIndex,
- EfiUsbPortResetChange
- );
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ReportUsbStatusCode (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusController,
- IN EFI_STATUS_CODE_TYPE Type,
- IN EFI_STATUS_CODE_VALUE Code
- )
-/*++
-
-Routine Description:
-
- report a error Status code of USB bus driver controller
-
- Arguments:
- UsbBusController - USB_BUS_CONTROLLER_DEVICE
- Type - EFI_STATUS_CODE_TYPE
- Code - EFI_STATUS_CODE_VALUE
- Returns:
-
- None
-
---*/
-{
- return REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- Type,
- Code,
- UsbBusController->DevicePath
- );
-}
-
-EFI_STATUS
-IsDeviceDisconnected (
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController,
- IN OUT BOOLEAN *Disconnected
- )
-/*++
-
- Routine Description:
- Reset if the device is disconencted or not
-
- Arguments:
- UsbIoController - Indicating the Usb Controller Device.
- Disconnected - Indicate whether the device is disconencted or not
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- USB_IO_DEVICE *ParentIoDev;
- USB_IO_CONTROLLER_DEVICE *ParentController;
- UINT8 HubPort;
- EFI_STATUS Status;
- EFI_USB_PORT_STATUS PortStatus;
-
- ParentController = UsbIoController->Parent;
- ParentIoDev = ParentController->UsbDevice;
- HubPort = UsbIoController->ParentPort;
-
- if (ParentIoDev->DeviceAddress == 1) {
- //
- // Connected to the root hub
- //
- UsbVirtualHcGetRootHubPortStatus (
- ParentIoDev->BusController,
- HubPort,
- &PortStatus
- );
-
- } else {
- Status = HubGetPortStatus (
- &ParentController->UsbIo,
- (UINT8) (HubPort + 1),
- (UINT32 *) &PortStatus
- );
-
- if (EFI_ERROR (Status)) {
- return IsDeviceDisconnected (ParentController, Disconnected);
- }
- }
-
- *Disconnected = FALSE;
-
- if (!IsPortConnect (PortStatus.PortStatus)) {
- *Disconnected = TRUE;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-UsbSetTransactionTranslator (
- IN USB_IO_CONTROLLER_DEVICE *ParentHubController,
- IN UINT8 ParentPort,
- IN OUT USB_IO_DEVICE *Device
- )
-/*++
-
- Routine Description:
-
- Set Transaction Translator parameter
-
- Arguments:
-
- ParentHubController - Controller structure of the parent Hub device
- ParentPort - Number of parent port
- Device - Structure of the device
-
- Returns:
-
- EFI_SUCCESS Success
- EFI_OUT_OF_RESOURCES Cannot allocate resources
-
---*/
-{
- USB_IO_CONTROLLER_DEVICE *AncestorHubController;
-
- AncestorHubController = ParentHubController;
- Device->Translator = NULL;
-
- if (EFI_USB_SPEED_HIGH == Device->DeviceSpeed) {
- return EFI_SUCCESS;
- }
-
- do {
- if (EFI_USB_SPEED_HIGH == AncestorHubController->UsbDevice->DeviceSpeed) {
- break;
- }
-
- if (NULL == AncestorHubController->Parent) {
- return EFI_SUCCESS;
- }
-
- AncestorHubController = AncestorHubController->Parent;
- } while (1);
-
- Device->Translator = AllocatePool (sizeof (EFI_USB2_HC_TRANSACTION_TRANSLATOR));
- if (NULL == Device->Translator) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Device->Translator->TranslatorHubAddress = AncestorHubController->UsbDevice->DeviceAddress;
- Device->Translator->TranslatorPortNumber = ParentPort;
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-UsbUnsetTransactionTranslator (
- USB_IO_DEVICE *Device
- )
-/*++
-
- Routine Description:
-
- Unset Transaction Translator parameter
-
- Arguments:
-
- Device - Structure of the device
-
- Returns:
-
- EFI_SUCCESS Success
-
---*/
-{
- if (Device->Translator) {
- gBS->FreePool (Device->Translator);
- Device->Translator = NULL;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-IdentifyDeviceSpeed (
- USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- USB_IO_DEVICE *NewDevice,
- UINT8 Index
- )
-/*++
-
- Routine Description:
-
- Identify speed of USB device
-
- Arguments:
-
- UsbBusDev - UsbBus controller structure of the device
- NewDevice - Devcie controller structure
- Index - Number of the port
-
- Returns:
-
- EFI_SUCCESS Success
- EFI_NOT_FOUND Device release to CHC or can't be found
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_PORT_STATUS HubPortStatus;
-
- UsbVirtualHcGetRootHubPortStatus (
- UsbBusDev,
- Index,
- (EFI_USB_PORT_STATUS *) &HubPortStatus
- );
-
- //
- // Check device device
- //
- if (!(HubPortStatus.PortStatus & USB_PORT_STAT_OWNER)) {
- //
- // EHC Port Owner
- //
- if (HubPortStatus.PortStatus & USB_PORT_STAT_HIGH_SPEED) {
- DEBUG ((gUSBDebugLevel, "High Speed Device attached to EHC\n"));
- NewDevice->DeviceSpeed = EFI_USB_SPEED_HIGH;
- } else {
- Status = ReleasePortToCHC (UsbBusDev, Index);
- if (EFI_ERROR (Status)) {
- DEBUG ((gUSBErrorLevel, "Fail to release port to CHC\n"));
- } else {
- DEBUG ((gUSBDebugLevel, "Success to release port to CHC\n"));
- }
- return EFI_DEVICE_ERROR;
- }
- } else {
- //
- // CHC Port Owner
- //
- if (HubPortStatus.PortStatus & USB_PORT_STAT_LOW_SPEED) {
- DEBUG ((gUSBDebugLevel, "Low Speed Device attached to CHC\n"));
- NewDevice->DeviceSpeed = EFI_USB_SPEED_LOW;
- } else {
- DEBUG ((gUSBDebugLevel, "FULL Speed Device attached to CHC\n"));
- NewDevice->DeviceSpeed = EFI_USB_SPEED_FULL;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ReleasePortToCHC (
- USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- UINT8 PortNum
- )
-/*++
-
- Routine Description:
-
- Set bit to release the port owner to CHC
-
- Arguments:
-
- UsbBusDev - UsbBus controller structure of the device
- PortNum - Number of the port
-
- Returns:
-
- EFI_SUCCESS Success
- EFI_DEVICE_ERROR Fail
-
---*/
-{
- EFI_STATUS Status;
-
- Status = UsbVirtualHcSetRootHubPortFeature (
- UsbBusDev,
- PortNum,
- EfiUsbPortOwner
- );
-
- gBS->Stall (100 * 1000);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcGetCapability (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- OUT UINT8 *MaxSpeed,
- OUT UINT8 *PortNumber,
- OUT UINT8 *Is64BitCapable
- )
-/*++
-
- Routine Description:
-
- Virtual interface to Retrieves the capablility of root hub ports
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- MaxSpeed - A pointer to the number of the host controller.
- PortNumber - A pointer to the number of the root hub ports.
- Is64BitCapable - A pointer to the flag for whether controller supports
- 64-bit memory addressing.
-
- Returns:
-
- EFI_SUCCESS
- The host controller capability were retrieved successfully.
- EFI_INVALID_PARAMETER
- MaxSpeed or PortNumber or Is64BitCapable is NULL.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to retrieve the capabilities.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->GetCapability (
- UsbBusDev->Usb2HCInterface,
- MaxSpeed,
- PortNumber,
- Is64BitCapable
- );
- } else {
- Status = UsbBusDev->UsbHCInterface->GetRootHubPortNumber (
- UsbBusDev->UsbHCInterface,
- PortNumber
- );
- *MaxSpeed = EFI_USB_SPEED_FULL;
- *Is64BitCapable = (UINT8) FALSE;
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcReset (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT16 Attributes
- )
-/*++
-
- Routine Description:
-
- Virtual interface to provides software reset for the USB host controller
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- Attributes - A bit mask of the reset operation to perform.
- See below for a list of the supported bit mask values.
-
- #define EFI_USB_HC_RESET_GLOBAL 0x0001 // Hc2 and Hc
- #define EFI_USB_HC_RESET_HOST_CONTROLLER 0x0002 // Hc2 and Hc
- #define EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG 0x0004 // Hc2
- #define EFI_USB_HC_RESET_HOST_WITH_DEBUG 0x0008 // Hc2
-
- EFI_USB_HC_RESET_GLOBAL
- If this bit is set, a global reset signal will be sent to the USB bus.
- This resets all of the USB bus logic, including the USB host
- controller hardware and all the devices attached on the USB bus.
- EFI_USB_HC_RESET_HOST_CONTROLLER
- If this bit is set, the USB host controller hardware will be reset.
- No reset signal will be sent to the USB bus.
- EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG
- If this bit is set, a global reset signal will be sent to the USB bus.
- This resets all of the USB bus logic, including the USB host
- controller hardware and all the devices attached on the USB bus.
- If this is an EHCI controller and the debug port has configured, then
- this is will still reset the host controller.
- EFI_USB_HC_RESET_HOST_WITH_DEBUG
- If this bit is set, the USB host controller hardware will be reset.
- If this is an EHCI controller and the debug port has been configured,
- then this will still reset the host controller.
-
- Returns:
-
- EFI_SUCCESS
- The reset operation succeeded.
- EFI_INVALID_PARAMETER
- Attributes is not valid.
- EFI_UNSUPPOURTED
- The type of reset specified by Attributes is not currently supported by
- the host controller hardware.
- EFI_ACCESS_DENIED
- Reset operation is rejected due to the debug port being configured and
- active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or
- EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Atrributes can be used to
- perform reset operation for this host controller.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to perform
- the reset operation.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->Reset (
- UsbBusDev->Usb2HCInterface,
- EFI_USB_HC_RESET_GLOBAL
- );
- } else {
- Status = UsbBusDev->UsbHCInterface->Reset (
- UsbBusDev->UsbHCInterface,
- EFI_USB_HC_RESET_GLOBAL
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcGetState (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- OUT EFI_USB_HC_STATE *State
- )
-/*++
-
- Routine Description:
-
- Virtual interface to retrieves current state of the USB host controller
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- State - A pointer to the EFI_USB_HC_STATE data structure that
- indicates current state of the USB host controller.
- Type EFI_USB_HC_STATE is defined below.
-
- typedef enum {
- EfiUsbHcStateHalt,
- EfiUsbHcStateOperational,
- EfiUsbHcStateSuspend,
- EfiUsbHcStateMaximum
- } EFI_USB_HC_STATE;
-
- Returns:
-
- EFI_SUCCESS
- The state information of the host controller was returned in State.
- EFI_INVALID_PARAMETER
- State is NULL.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to retrieve the
- host controller's current state.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->GetState (
- UsbBusDev->Usb2HCInterface,
- State
- );
- } else {
- Status = UsbBusDev->UsbHCInterface->GetState (
- UsbBusDev->UsbHCInterface,
- State
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcSetState (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN EFI_USB_HC_STATE State
- )
-/*++
-
- Routine Description:
-
- Virtual interface to sets the USB host controller to a specific state
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- State - Indicates the state of the host controller that will be set.
-
- Returns:
-
- EFI_SUCCESS
- The USB host controller was successfully placed in the state
- specified by State.
- EFI_INVALID_PARAMETER
- State is invalid.
- EFI_DEVICE_ERROR
- Failed to set the state specified by State due to device error.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->SetState (
- UsbBusDev->Usb2HCInterface,
- State
- );
- } else {
- Status = UsbBusDev->UsbHCInterface->SetState (
- UsbBusDev->UsbHCInterface,
- State
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcGetRootHubPortStatus (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS *PortStatus
- )
-/*++
-
- Routine Description:
-
- Virtual interface to retrieves the current status of a USB root hub port
- both for Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- PortNumber - Specifies the root hub port from which the status
- is to be retrieved. This value is zero-based. For example,
- if a root hub has two ports, then the first port is numbered 0,
- and the second port is numbered 1.
- PortStatus - A pointer to the current port status bits and
- port status change bits.
-
- Returns:
-
- EFI_SUCCESS The status of the USB root hub port specified by PortNumber
- was returned in PortStatus.
- EFI_INVALID_PARAMETER PortNumber is invalid.
- EFI_DEVICE_ERROR Can't read register
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->GetRootHubPortStatus (
- UsbBusDev->Usb2HCInterface,
- PortNumber,
- PortStatus
- );
- } else {
- Status = UsbBusDev->UsbHCInterface->GetRootHubPortStatus (
- UsbBusDev->UsbHCInterface,
- PortNumber,
- PortStatus
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcSetRootHubPortFeature (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-/*++
-
- Routine Description:
- Virual interface to sets a feature for the specified root hub port
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- PortNumber - Specifies the root hub port whose feature
- is requested to be set.
- PortFeature - Indicates the feature selector associated
- with the feature set request.
-
- Returns:
-
- EFI_SUCCESS
- The feature specified by PortFeature was set for the
- USB root hub port specified by PortNumber.
- EFI_INVALID_PARAMETER
- PortNumber is invalid or PortFeature is invalid.
- EFI_DEVICE_ERROR
- Can't read register
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->SetRootHubPortFeature (
- UsbBusDev->Usb2HCInterface,
- PortNumber,
- PortFeature
- );
- } else {
- Status = UsbBusDev->UsbHCInterface->SetRootHubPortFeature (
- UsbBusDev->UsbHCInterface,
- PortNumber,
- PortFeature
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcClearRootHubPortFeature (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-/*++
-
- Routine Description:
-
- Virtual interface to clears a feature for the specified root hub port
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- PortNumber - Specifies the root hub port whose feature
- is requested to be cleared.
- PortFeature - Indicates the feature selector associated with the
- feature clear request.
-
- Returns:
-
- EFI_SUCCESS
- The feature specified by PortFeature was cleared for the
- USB root hub port specified by PortNumber.
- EFI_INVALID_PARAMETER
- PortNumber is invalid or PortFeature is invalid.
- EFI_DEVICE_ERROR
- Can't read register
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->ClearRootHubPortFeature (
- UsbBusDev->Usb2HCInterface,
- PortNumber,
- PortFeature
- );
- } else {
- Status = UsbBusDev->UsbHCInterface->ClearRootHubPortFeature (
- UsbBusDev->UsbHCInterface,
- PortNumber,
- PortFeature
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcControlTransfer (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Virtual interface to submits control transfer to a target USB device
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- DeviceSpeed - Indicates target device speed.
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
- Request - A pointer to the USB device request that will be sent
- to the USB device.
- TransferDirection - Specifies the data direction for the transfer.
- There are three values available, DataIn, DataOut
- and NoData.
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- DataLength - Indicates the size, in bytes, of the data buffer
- specified by Data.
- TimeOut - Indicates the maximum time, in microseconds,
- which the transfer is allowed to complete.
- Translator - A pointr to the transaction translator data.
- TransferResult - A pointer to the detailed result information generated
- by this control transfer.
-
- Returns:
-
- EFI_SUCCESS
- The control transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The control transfer could not be completed due to a lack of resources.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The control transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The control transfer failed due to host controller or device error.
- Caller should check TranferResult for detailed error information.
-
---*/
-{
- EFI_STATUS Status;
- BOOLEAN IsSlowDevice;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->ControlTransfer (
- UsbBusDev->Usb2HCInterface,
- DeviceAddress,
- DeviceSpeed,
- MaximumPacketLength,
- Request,
- TransferDirection,
- Data,
- DataLength,
- TimeOut,
- Translator,
- TransferResult
- );
- } else {
- IsSlowDevice = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
- Status = UsbBusDev->UsbHCInterface->ControlTransfer (
- UsbBusDev->UsbHCInterface,
- DeviceAddress,
- IsSlowDevice,
- (UINT8) MaximumPacketLength,
- Request,
- TransferDirection,
- Data,
- DataLength,
- TimeOut,
- TransferResult
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcBulkTransfer (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Virtual interface to submits bulk transfer to a bulk endpoint of a USB device
- both for Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - The combination of an endpoint number and an
- endpoint direction of the target USB device.
- Each endpoint address supports data transfer in
- one direction except the control endpoint
- (whose default endpoint address is 0).
- It is the caller's responsibility to make sure that
- the EndPointAddress represents a bulk endpoint.
- DeviceSpeed - Indicates device speed. The supported values are EFI_USB_SPEED_FULL
- and EFI_USB_SPEED_HIGH.
- MaximumPacketLength - Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
- DataBuffersNumber - Number of data buffers prepared for the transfer.
- Data - Array of pointers to the buffers of data that will be transmitted
- to USB device or received from USB device.
- DataLength - When input, indicates the size, in bytes, of the data buffer
- specified by Data. When output, indicates the actually
- transferred data size.
- DataToggle - A pointer to the data toggle value. On input, it indicates
- the initial data toggle value the bulk transfer should adopt;
- on output, it is updated to indicate the data toggle value
- of the subsequent bulk transfer.
- Translator - A pointr to the transaction translator data.
- TimeOut - Indicates the maximum time, in microseconds, which the
- transfer is allowed to complete.
- TransferResult - A pointer to the detailed result information of the
- bulk transfer.
-
- Returns:
-
- EFI_SUCCESS
- The bulk transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The bulk transfer could not be submitted due to lack of resource.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The bulk transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The bulk transfer failed due to host controller or device error.
- Caller should check TranferResult for detailed error information.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->BulkTransfer (
- UsbBusDev->Usb2HCInterface,
- DeviceAddress,
- EndPointAddress,
- DeviceSpeed,
- MaximumPacketLength,
- DataBuffersNumber,
- Data,
- DataLength,
- DataToggle,
- TimeOut,
- Translator,
- TransferResult
- );
- } else {
- Status = UsbBusDev->UsbHCInterface->BulkTransfer (
- UsbBusDev->UsbHCInterface,
- DeviceAddress,
- EndPointAddress,
- (UINT8) MaximumPacketLength,
- *Data,
- DataLength,
- DataToggle,
- TimeOut,
- TransferResult
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcAsyncInterruptTransfer (
- IN USB_BUS_CONTROLLER_DEVICE * UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN BOOLEAN IsNewTransfer,
- IN OUT UINT8 *DataToggle,
- IN UINTN PollingInterval,
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR * Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
- IN VOID *Context OPTIONAL
- )
-/*++
-
- Routine Description:
-
- Virtual interface to submits an asynchronous interrupt transfer to an
- interrupt endpoint of a USB device for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - The combination of an endpoint number and an endpoint
- direction of the target USB device. Each endpoint address
- supports data transfer in one direction except the
- control endpoint (whose default endpoint address is 0).
- It is the caller's responsibility to make sure that
- the EndPointAddress represents an interrupt endpoint.
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
- IsNewTransfer - If TRUE, an asynchronous interrupt pipe is built between
- the host and the target interrupt endpoint.
- If FALSE, the specified asynchronous interrupt pipe
- is canceled.
- DataToggle - A pointer to the data toggle value. On input, it is valid
- when IsNewTransfer is TRUE, and it indicates the initial
- data toggle value the asynchronous interrupt transfer
- should adopt.
- On output, it is valid when IsNewTransfer is FALSE,
- and it is updated to indicate the data toggle value of
- the subsequent asynchronous interrupt transfer.
- PollingInterval - Indicates the interval, in milliseconds, that the
- asynchronous interrupt transfer is polled.
- This parameter is required when IsNewTransfer is TRUE.
- DataLength - Indicates the length of data to be received at the
- rate specified by PollingInterval from the target
- asynchronous interrupt endpoint. This parameter
- is only required when IsNewTransfer is TRUE.
- Translator - A pointr to the transaction translator data.
- CallBackFunction - The Callback function.This function is called at the
- rate specified by PollingInterval.This parameter is
- only required when IsNewTransfer is TRUE.
- Context - The context that is passed to the CallBackFunction.
- - This is an optional parameter and may be NULL.
-
- Returns:
-
- EFI_SUCCESS
- The asynchronous interrupt transfer request has been successfully
- submitted or canceled.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_OUT_OF_RESOURCES
- The request could not be completed due to a lack of resources.
- EFI_DEVICE_ERROR
- Can't read register
-
---*/
-{
- EFI_STATUS Status;
- BOOLEAN IsSlowDevice;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->AsyncInterruptTransfer (
- UsbBusDev->Usb2HCInterface,
- DeviceAddress,
- EndPointAddress,
- DeviceSpeed,
- MaximumPacketLength,
- IsNewTransfer,
- DataToggle,
- PollingInterval,
- DataLength,
- Translator,
- CallBackFunction,
- Context
- );
- } else {
- IsSlowDevice = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
- Status = UsbBusDev->UsbHCInterface->AsyncInterruptTransfer (
- UsbBusDev->UsbHCInterface,
- DeviceAddress,
- EndPointAddress,
- IsSlowDevice,
- (UINT8) MaximumPacketLength,
- IsNewTransfer,
- DataToggle,
- PollingInterval,
- DataLength,
- CallBackFunction,
- Context
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcSyncInterruptTransfer (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Vitual interface to submits synchronous interrupt transfer to an interrupt endpoint
- of a USB device for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - The combination of an endpoint number and an endpoint
- direction of the target USB device. Each endpoint
- address supports data transfer in one direction
- except the control endpoint (whose default
- endpoint address is 0). It is the caller's responsibility
- to make sure that the EndPointAddress represents
- an interrupt endpoint.
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- DataLength - On input, the size, in bytes, of the data buffer specified
- by Data. On output, the number of bytes transferred.
- DataToggle - A pointer to the data toggle value. On input, it indicates
- the initial data toggle value the synchronous interrupt
- transfer should adopt;
- on output, it is updated to indicate the data toggle value
- of the subsequent synchronous interrupt transfer.
- TimeOut - Indicates the maximum time, in microseconds, which the
- transfer is allowed to complete.
- Translator - A pointr to the transaction translator data.
- TransferResult - A pointer to the detailed result information from
- the synchronous interrupt transfer.
-
- Returns:
-
- EFI_SUCCESS
- The synchronous interrupt transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The synchronous interrupt transfer could not be submitted due
- to lack of resource.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The synchronous interrupt transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The synchronous interrupt transfer failed due to host controller
- or device error. Caller should check TranferResult for detailed
- error information.
-
---*/
-{
- EFI_STATUS Status;
- BOOLEAN IsSlowDevice;
-
- Status = EFI_SUCCESS;
-
- if (UsbBusDev->Hc2ProtocolSupported) {
- Status = UsbBusDev->Usb2HCInterface->SyncInterruptTransfer (
- UsbBusDev->Usb2HCInterface,
- DeviceAddress,
- EndPointAddress,
- DeviceSpeed,
- MaximumPacketLength,
- Data,
- DataLength,
- DataToggle,
- TimeOut,
- Translator,
- TransferResult
- );
- } else {
- IsSlowDevice = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE);
- Status = UsbBusDev->UsbHCInterface->SyncInterruptTransfer (
- UsbBusDev->UsbHCInterface,
- DeviceAddress,
- EndPointAddress,
- IsSlowDevice,
- (UINT8) MaximumPacketLength,
- Data,
- DataLength,
- DataToggle,
- TimeOut,
- TransferResult
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcIsochronousTransfer (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Virtual interface to submits isochronous transfer to a target USB device
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - End point address
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
- DataBuffersNumber - Number of data buffers prepared for the transfer.
- Data - Array of pointers to the buffers of data that will be
- transmitted to USB device or received from USB device.
- DataLength - Indicates the size, in bytes, of the data buffer
- specified by Data.
- Translator - A pointr to the transaction translator data.
- TransferResult - A pointer to the detailed result information generated
- by this control transfer.
-
- Returns:
-
- EFI_UNSUPPORTED
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcAsyncIsochronousTransfer (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
-
- Vitual interface to submits Async isochronous transfer to a target USB device
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - End point address
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
- DataBuffersNumber - Number of data buffers prepared for the transfer.
- Data - Array of pointers to the buffers of data that will be transmitted
- to USB device or received from USB device.
- DataLength - Indicates the size, in bytes, of the data buffer
- specified by Data.
- Translator - A pointr to the transaction translator data.
- IsochronousCallBack - When the transfer complete, the call back function will be called
- Context - Pass to the call back function as parameter
-
- Returns:
-
- EFI_UNSUPPORTED
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.h b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.h
deleted file mode 100644
index be60aed..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.h
+++ /dev/null
@@ -1,1203 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- usbbus.h
-
- Abstract:
-
- Header file for USB bus driver Interface
-
- Revision History
-
-
-
---*/
-
-#ifndef _EFI_USB_BUS_H
-#define _EFI_USB_BUS_H
-
-
-#include <IndustryStandard/Usb.h>
-#include "hub.h"
-#include "usbutil.h"
-
-
-extern UINTN gUSBDebugLevel;
-extern UINTN gUSBErrorLevel;
-
-
-#define MICROSECOND 10000
-#define ONESECOND (1000 * MICROSECOND)
-#define BUSPOLLING_PERIOD ONESECOND
-//
-// We define some maximun value here
-//
-#define USB_MAXCONFIG 8
-#define USB_MAXALTSETTING 4
-#define USB_MAXINTERFACES 32
-#define USB_MAXENDPOINTS 16
-#define USB_MAXSTRINGS 16
-#define USB_MAXLANID 16
-#define USB_MAXCHILDREN 8
-#define USB_MAXCONTROLLERS 4
-
-#define USB_IO_CONTROLLER_SIGNATURE EFI_SIGNATURE_32 ('u', 's', 'b', 'd')
-
-typedef struct {
- LIST_ENTRY Link;
- UINT16 StringIndex;
- CHAR16 *String;
-} STR_LIST_ENTRY;
-
-typedef struct {
- LIST_ENTRY Link;
- UINT16 Toggle;
- EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
-} ENDPOINT_DESC_LIST_ENTRY;
-
-typedef struct {
- LIST_ENTRY Link;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
- LIST_ENTRY EndpointDescListHead;
-} INTERFACE_DESC_LIST_ENTRY;
-
-typedef struct {
- LIST_ENTRY Link;
- EFI_USB_CONFIG_DESCRIPTOR CongfigDescriptor;
- LIST_ENTRY InterfaceDescListHead;
- UINTN ActiveInterface;
-} CONFIG_DESC_LIST_ENTRY;
-
-//
-// Forward declaring
-//
-struct usb_io_device;
-
-//
-// This is used to form the USB Controller Handle
-//
-typedef struct usb_io_controller_device {
- UINTN Signature;
- EFI_HANDLE Handle;
- EFI_USB_IO_PROTOCOL UsbIo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_HANDLE HostController;
- UINT8 CurrentConfigValue;
- UINT8 InterfaceNumber;
- struct usb_io_device *UsbDevice;
-
- BOOLEAN IsUsbHub;
- BOOLEAN IsManagedByDriver;
-
- //
- // Fields specified for USB Hub
- //
- EFI_EVENT HubNotify;
- UINT8 HubEndpointAddress;
- UINT8 StatusChangePort;
- UINT8 DownstreamPorts;
-
- UINT8 ParentPort;
- struct usb_io_controller_device *Parent;
- struct usb_io_device *Children[USB_MAXCHILDREN];
-} USB_IO_CONTROLLER_DEVICE;
-
-#define USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS(a) \
- CR(a, USB_IO_CONTROLLER_DEVICE, UsbIo, USB_IO_CONTROLLER_SIGNATURE)
-
-//
-// This is used to keep the topology of USB bus
-//
-struct _usb_bus_controller_device;
-
-typedef struct usb_io_device {
- UINT8 DeviceAddress;
- BOOLEAN IsConfigured;
- BOOLEAN IsSlowDevice;
- UINT8 DeviceSpeed;
- EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator;
- EFI_USB_DEVICE_DESCRIPTOR DeviceDescriptor;
- LIST_ENTRY ConfigDescListHead;
- CONFIG_DESC_LIST_ENTRY *ActiveConfig;
- UINT16 LangID[USB_MAXLANID];
-
- struct _usb_bus_controller_device *BusController;
-
- //
- // Track the controller handle
- //
- UINT8 NumOfControllers;
- USB_IO_CONTROLLER_DEVICE *UsbController[USB_MAXCONTROLLERS];
-
-} USB_IO_DEVICE;
-
-//
-// Usb Bus Controller device strcuture
-//
-#define EFI_USB_BUS_PROTOCOL_GUID \
- { 0x2B2F68CC, 0x0CD2, 0x44cf, { 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } }
-
-typedef struct _EFI_USB_BUS_PROTOCOL {
- UINT64 Reserved;
-} EFI_USB_BUS_PROTOCOL;
-
-#define USB_BUS_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('u', 'b', 'u', 's')
-
-typedef struct _usb_bus_controller_device {
- UINTN Signature;
-
- EFI_USB_BUS_PROTOCOL BusIdentify;
- EFI_USB2_HC_PROTOCOL *Usb2HCInterface;
- EFI_USB_HC_PROTOCOL *UsbHCInterface;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINT8 AddressPool[16];
- USB_IO_DEVICE *Root;
- BOOLEAN Hc2ProtocolSupported;
-} USB_BUS_CONTROLLER_DEVICE;
-
-#define USB_BUS_CONTROLLER_DEVICE_FROM_THIS(a) \
- CR(a, USB_BUS_CONTROLLER_DEVICE, BusIdentify, USB_BUS_DEVICE_SIGNATURE)
-
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUsbBusDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUsbBusComponentName;
-
-//
-// EFI_DRIVER_BINDING_PROTOCOL Protocol Interface
-//
-EFI_STATUS
-EFIAPI
-UsbBusControllerDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-UsbBusControllerDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-UsbBusControllerDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UsbBusComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UsbBusComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle, OPTIONAL
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// Usb Device Configuration functions
-//
-BOOLEAN
-IsHub (
- IN USB_IO_CONTROLLER_DEVICE *Dev
- )
-/*++
-
- Routine Description:
- Tell if a usb controller is a hub controller.
-
- Arguments:
- Dev - UsbIoController device structure.
-
- Returns:
- TRUE/FALSE
---*/
-;
-
-EFI_STATUS
-UsbGetStringtable (
- IN USB_IO_DEVICE *UsbIoDevice
- )
-/*++
-
- Routine Description:
- Get the string table stored in a usb device.
-
- Arguments:
- Dev - UsbIoController device structure.
-
- Returns:
- EFI_SUCCESS
- EFI_UNSUPPORTED
- EFI_OUT_OF_RESOURCES
-
---*/
-;
-
-EFI_STATUS
-UsbGetAllConfigurations (
- IN USB_IO_DEVICE *UsbIoDevice
- )
-/*++
-
- Routine Description:
- This function is to parse all the configuration descriptor.
-
- Arguments:
- UsbIoDevice - USB_IO_DEVICE device structure.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_OUT_OF_RESOURCES
-
---*/
-;
-
-EFI_STATUS
-UsbSetConfiguration (
- IN USB_IO_DEVICE *Dev,
- IN UINTN ConfigurationValue
- )
-/*++
-
- Routine Description:
- Set the device to a configuration value.
-
- Arguments:
- UsbIoDev - USB_IO_DEVICE to be set configuration
- ConfigrationValue - The configuration value to be set to that device
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-;
-
-EFI_STATUS
-UsbSetDefaultConfiguration (
- IN USB_IO_DEVICE *Dev
- )
-/*++
-
- Routine Description:
- Set the device to a default configuration value.
-
- Arguments:
- UsbIoDev - USB_IO_DEVICE to be set configuration
-
- Returns
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-;
-
-//
-// Device Deconfiguration functions
-//
-VOID
-UsbDestroyAllConfiguration (
- IN USB_IO_DEVICE *UsbIoDevice
- )
-/*++
-
- Routine Description:
- Delete all configuration data when device is not used.
-
- Arguments:
- UsbIoDevice - USB_IO_DEVICE to be set configuration
-
- Returns:
- VOID
-
---*/
-;
-
-EFI_STATUS
-DoHubConfig (
- IN USB_IO_CONTROLLER_DEVICE *HubIoDevice
- )
-/*++
-
- Routine Description:
- Configure the hub
-
- Arguments:
- HubController - Indicating the hub controller device that
- will be configured
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-
-;
-
-VOID
-GetDeviceEndPointMaxPacketLength (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 EndpointAddr,
- OUT UINTN *MaxPacketLength
- )
-/*++
-
- Routine Description:
- Get the Max Packet Length of the speified Endpoint.
-
- Arguments:
- UsbIo - Given Usb Controller device.
- EndpointAddr - Given Endpoint address.
- MaxPacketLength - The max packet length of that endpoint
-
- Returns:
- N/A
-
---*/
-;
-
-VOID
-GetDataToggleBit (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 EndpointAddr,
- OUT UINT8 *DataToggle
- )
-/*++
-
- Routine Description:
- Get the datatoggle of a specified endpoint.
-
- Arguments:
- UsbIo - Given Usb Controller device.
- EndpointAddr - Given Endpoint address.
- DataToggle - The current data toggle of that endpoint
-
- Returns:
- VOID
-
---*/
-;
-
-VOID
-SetDataToggleBit (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 EndpointAddr,
- IN UINT8 DataToggle
- )
-/*++
-
- Routine Description:
- Set the datatoggle of a specified endpoint
-
- Arguments:
- UsbIo - Given Usb Controller device.
- EndpointAddr - Given Endpoint address.
- DataToggle - The current data toggle of that endpoint to be set
-
- Returns:
- VOID
-
---*/
-;
-
-INTERFACE_DESC_LIST_ENTRY *
-FindInterfaceListEntry (
- IN EFI_USB_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Find Interface ListEntry.
-
- Arguments:
- This - EFI_USB_IO_PROTOCOL
-
- Returns:
- INTERFACE_DESC_LIST_ENTRY pointer
-
---*/
-;
-
-ENDPOINT_DESC_LIST_ENTRY *
-FindEndPointListEntry (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 EndPointAddress
- )
-/*++
-
- Routine Description:
- Find EndPoint ListEntry.
-
- Arguments:
- This - EFI_USB_IO_PROTOCOL
- EndpointAddr - Endpoint address.
-
- Returns:
- ENDPOINT_DESC_LIST_ENTRY pointer
-
---*/
-;
-
-EFI_STATUS
-IsDeviceDisconnected (
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController,
- IN OUT BOOLEAN *Disconnected
- )
-/*++
-
- Routine Description:
- Reset if the device is disconencted or not
-
- Arguments:
- UsbIoController - Indicating the Usb Controller Device.
- Disconnected - Indicate whether the device is disconencted or not
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-;
-
-EFI_STATUS
-UsbDeviceDeConfiguration (
- IN USB_IO_DEVICE *UsbIoDevice
- )
-/*++
-
- Routine Description:
- Remove Device, Device Handles, Uninstall Protocols.
-
- Arguments:
- UsbIoDevice - The device to be deconfigured.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcGetCapability (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- OUT UINT8 *MaxSpeed,
- OUT UINT8 *PortNumber,
- OUT UINT8 *Is64BitCapable
- )
-/*++
-
- Routine Description:
-
- Virtual interface to Retrieves the capablility of root hub ports
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- MaxSpeed - A pointer to the number of the host controller.
- PortNumber - A pointer to the number of the root hub ports.
- Is64BitCapable - A pointer to the flag for whether controller supports
- 64-bit memory addressing.
-
- Returns:
-
- EFI_SUCCESS
- The host controller capability were retrieved successfully.
- EFI_INVALID_PARAMETER
- MaxSpeed or PortNumber or Is64BitCapable is NULL.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to retrieve the capabilities.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcReset (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT16 Attributes
- )
-/*++
-
- Routine Description:
-
- Virtual interface to provides software reset for the USB host controller
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- Attributes - A bit mask of the reset operation to perform.
- See below for a list of the supported bit mask values.
-
- #define EFI_USB_HC_RESET_GLOBAL 0x0001 // Hc2 and Hc
- #define EFI_USB_HC_RESET_HOST_CONTROLLER 0x0002 // Hc2 and Hc
- #define EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG 0x0004 // Hc2
- #define EFI_USB_HC_RESET_HOST_WITH_DEBUG 0x0008 // Hc2
-
- EFI_USB_HC_RESET_GLOBAL
- If this bit is set, a global reset signal will be sent to the USB bus.
- This resets all of the USB bus logic, including the USB host
- controller hardware and all the devices attached on the USB bus.
- EFI_USB_HC_RESET_HOST_CONTROLLER
- If this bit is set, the USB host controller hardware will be reset.
- No reset signal will be sent to the USB bus.
- EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG
- If this bit is set, a global reset signal will be sent to the USB bus.
- This resets all of the USB bus logic, including the USB host
- controller hardware and all the devices attached on the USB bus.
- If this is an EHCI controller and the debug port has configured, then
- this is will still reset the host controller.
- EFI_USB_HC_RESET_HOST_WITH_DEBUG
- If this bit is set, the USB host controller hardware will be reset.
- If this is an EHCI controller and the debug port has been configured,
- then this will still reset the host controller.
-
- Returns:
-
- EFI_SUCCESS
- The reset operation succeeded.
- EFI_INVALID_PARAMETER
- Attributes is not valid.
- EFI_UNSUPPOURTED
- The type of reset specified by Attributes is not currently supported by
- the host controller hardware.
- EFI_ACCESS_DENIED
- Reset operation is rejected due to the debug port being configured and
- active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or
- EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Atrributes can be used to
- perform reset operation for this host controller.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to perform
- the reset operation.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcGetState (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- OUT EFI_USB_HC_STATE *State
- )
-/*++
-
- Routine Description:
-
- Virtual interface to retrieves current state of the USB host controller
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- State - A pointer to the EFI_USB_HC_STATE data structure that
- indicates current state of the USB host controller.
- Type EFI_USB_HC_STATE is defined below.
-
- typedef enum {
- EfiUsbHcStateHalt,
- EfiUsbHcStateOperational,
- EfiUsbHcStateSuspend,
- EfiUsbHcStateMaximum
- } EFI_USB_HC_STATE;
-
- Returns:
-
- EFI_SUCCESS
- The state information of the host controller was returned in State.
- EFI_INVALID_PARAMETER
- State is NULL.
- EFI_DEVICE_ERROR
- An error was encountered while attempting to retrieve the
- host controller's current state.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcSetState (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN EFI_USB_HC_STATE State
- )
-/*++
-
- Routine Description:
-
- Virtual interface to sets the USB host controller to a specific state
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- State - Indicates the state of the host controller that will be set.
-
- Returns:
-
- EFI_SUCCESS
- The USB host controller was successfully placed in the state
- specified by State.
- EFI_INVALID_PARAMETER
- State is invalid.
- EFI_DEVICE_ERROR
- Failed to set the state specified by State due to device error.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcGetRootHubPortStatus (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 PortNumber,
- OUT EFI_USB_PORT_STATUS *PortStatus
- )
-/*++
-
- Routine Description:
-
- Virtual interface to retrieves the current status of a USB root hub port
- both for Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- PortNumber - Specifies the root hub port from which the status
- is to be retrieved. This value is zero-based. For example,
- if a root hub has two ports, then the first port is numbered 0,
- and the second port is numbered 1.
- PortStatus - A pointer to the current port status bits and
- port status change bits.
-
- Returns:
-
- EFI_SUCCESS The status of the USB root hub port specified by PortNumber
- was returned in PortStatus.
- EFI_INVALID_PARAMETER PortNumber is invalid.
- EFI_DEVICE_ERROR Can't read register
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcSetRootHubPortFeature (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-/*++
-
- Routine Description:
- Virual interface to sets a feature for the specified root hub port
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- PortNumber - Specifies the root hub port whose feature
- is requested to be set.
- PortFeature - Indicates the feature selector associated
- with the feature set request.
-
- Returns:
-
- EFI_SUCCESS
- The feature specified by PortFeature was set for the
- USB root hub port specified by PortNumber.
- EFI_INVALID_PARAMETER
- PortNumber is invalid or PortFeature is invalid.
- EFI_DEVICE_ERROR
- Can't read register
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcClearRootHubPortFeature (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 PortNumber,
- IN EFI_USB_PORT_FEATURE PortFeature
- )
-/*++
-
- Routine Description:
-
- Virtual interface to clears a feature for the specified root hub port
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- PortNumber - Specifies the root hub port whose feature
- is requested to be cleared.
- PortFeature - Indicates the feature selector associated with the
- feature clear request.
-
- Returns:
-
- EFI_SUCCESS
- The feature specified by PortFeature was cleared for the
- USB root hub port specified by PortNumber.
- EFI_INVALID_PARAMETER
- PortNumber is invalid or PortFeature is invalid.
- EFI_DEVICE_ERROR
- Can't read register
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcControlTransfer (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION TransferDirection,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Virtual interface to submits control transfer to a target USB device
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- DeviceSpeed - Indicates target device speed.
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
- Request - A pointer to the USB device request that will be sent
- to the USB device.
- TransferDirection - Specifies the data direction for the transfer.
- There are three values available, DataIn, DataOut
- and NoData.
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- DataLength - Indicates the size, in bytes, of the data buffer
- specified by Data.
- TimeOut - Indicates the maximum time, in microseconds,
- which the transfer is allowed to complete.
- Translator - A pointr to the transaction translator data.
- TransferResult - A pointer to the detailed result information generated
- by this control transfer.
-
- Returns:
-
- EFI_SUCCESS
- The control transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The control transfer could not be completed due to a lack of resources.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The control transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The control transfer failed due to host controller or device error.
- Caller should check TranferResult for detailed error information.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcBulkTransfer (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Virtual interface to submits bulk transfer to a bulk endpoint of a USB device
- both for Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - The combination of an endpoint number and an
- endpoint direction of the target USB device.
- Each endpoint address supports data transfer in
- one direction except the control endpoint
- (whose default endpoint address is 0).
- It is the caller's responsibility to make sure that
- the EndPointAddress represents a bulk endpoint.
- DeviceSpeed - Indicates device speed. The supported values are EFI_USB_SPEED_FULL
- and EFI_USB_SPEED_HIGH.
- MaximumPacketLength - Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
- DataBuffersNumber - Number of data buffers prepared for the transfer.
- Data - Array of pointers to the buffers of data that will be transmitted
- to USB device or received from USB device.
- DataLength - When input, indicates the size, in bytes, of the data buffer
- specified by Data. When output, indicates the actually
- transferred data size.
- DataToggle - A pointer to the data toggle value. On input, it indicates
- the initial data toggle value the bulk transfer should adopt;
- on output, it is updated to indicate the data toggle value
- of the subsequent bulk transfer.
- Translator - A pointr to the transaction translator data.
- TimeOut - Indicates the maximum time, in microseconds, which the
- transfer is allowed to complete.
- TransferResult - A pointer to the detailed result information of the
- bulk transfer.
-
- Returns:
-
- EFI_SUCCESS
- The bulk transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The bulk transfer could not be submitted due to lack of resource.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The bulk transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The bulk transfer failed due to host controller or device error.
- Caller should check TranferResult for detailed error information.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcAsyncInterruptTransfer (
- IN USB_BUS_CONTROLLER_DEVICE * UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN BOOLEAN IsNewTransfer,
- IN OUT UINT8 *DataToggle,
- IN UINTN PollingInterval,
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR * Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
- IN VOID *Context OPTIONAL
- )
-/*++
-
- Routine Description:
-
- Virtual interface to submits an asynchronous interrupt transfer to an
- interrupt endpoint of a USB device for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - The combination of an endpoint number and an endpoint
- direction of the target USB device. Each endpoint address
- supports data transfer in one direction except the
- control endpoint (whose default endpoint address is 0).
- It is the caller's responsibility to make sure that
- the EndPointAddress represents an interrupt endpoint.
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
- IsNewTransfer - If TRUE, an asynchronous interrupt pipe is built between
- the host and the target interrupt endpoint.
- If FALSE, the specified asynchronous interrupt pipe
- is canceled.
- DataToggle - A pointer to the data toggle value. On input, it is valid
- when IsNewTransfer is TRUE, and it indicates the initial
- data toggle value the asynchronous interrupt transfer
- should adopt.
- On output, it is valid when IsNewTransfer is FALSE,
- and it is updated to indicate the data toggle value of
- the subsequent asynchronous interrupt transfer.
- PollingInterval - Indicates the interval, in milliseconds, that the
- asynchronous interrupt transfer is polled.
- This parameter is required when IsNewTransfer is TRUE.
- DataLength - Indicates the length of data to be received at the
- rate specified by PollingInterval from the target
- asynchronous interrupt endpoint. This parameter
- is only required when IsNewTransfer is TRUE.
- Translator - A pointr to the transaction translator data.
- CallBackFunction - The Callback function.This function is called at the
- rate specified by PollingInterval.This parameter is
- only required when IsNewTransfer is TRUE.
- Context - The context that is passed to the CallBackFunction.
- - This is an optional parameter and may be NULL.
-
- Returns:
-
- EFI_SUCCESS
- The asynchronous interrupt transfer request has been successfully
- submitted or canceled.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_OUT_OF_RESOURCES
- The request could not be completed due to a lack of resources.
- EFI_DEVICE_ERROR
- Can't read register
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcSyncInterruptTransfer (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN OUT UINT8 *DataToggle,
- IN UINTN TimeOut,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Vitual interface to submits synchronous interrupt transfer to an interrupt endpoint
- of a USB device for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - The combination of an endpoint number and an endpoint
- direction of the target USB device. Each endpoint
- address supports data transfer in one direction
- except the control endpoint (whose default
- endpoint address is 0). It is the caller's responsibility
- to make sure that the EndPointAddress represents
- an interrupt endpoint.
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size the target endpoint
- is capable of sending or receiving.
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- DataLength - On input, the size, in bytes, of the data buffer specified
- by Data. On output, the number of bytes transferred.
- DataToggle - A pointer to the data toggle value. On input, it indicates
- the initial data toggle value the synchronous interrupt
- transfer should adopt;
- on output, it is updated to indicate the data toggle value
- of the subsequent synchronous interrupt transfer.
- TimeOut - Indicates the maximum time, in microseconds, which the
- transfer is allowed to complete.
- Translator - A pointr to the transaction translator data.
- TransferResult - A pointer to the detailed result information from
- the synchronous interrupt transfer.
-
- Returns:
-
- EFI_SUCCESS
- The synchronous interrupt transfer was completed successfully.
- EFI_OUT_OF_RESOURCES
- The synchronous interrupt transfer could not be submitted due
- to lack of resource.
- EFI_INVALID_PARAMETER
- Some parameters are invalid.
- EFI_TIMEOUT
- The synchronous interrupt transfer failed due to timeout.
- EFI_DEVICE_ERROR
- The synchronous interrupt transfer failed due to host controller
- or device error. Caller should check TranferResult for detailed
- error information.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcIsochronousTransfer (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- OUT UINT32 *TransferResult
- )
-/*++
-
- Routine Description:
-
- Virtual interface to submits isochronous transfer to a target USB device
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - End point address
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
- DataBuffersNumber - Number of data buffers prepared for the transfer.
- Data - Array of pointers to the buffers of data that will be
- transmitted to USB device or received from USB device.
- DataLength - Indicates the size, in bytes, of the data buffer
- specified by Data.
- Translator - A pointr to the transaction translator data.
- TransferResult - A pointer to the detailed result information generated
- by this control transfer.
-
- Returns:
-
- EFI_UNSUPPORTED
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbVirtualHcAsyncIsochronousTransfer (
- IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,
- IN UINT8 DeviceAddress,
- IN UINT8 EndPointAddress,
- IN UINT8 DeviceSpeed,
- IN UINTN MaximumPacketLength,
- IN UINT8 DataBuffersNumber,
- IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
- IN UINTN DataLength,
- IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
-
- Vitual interface to submits Async isochronous transfer to a target USB device
- for both Hc2 and Hc protocol.
-
- Arguments:
-
- UsbBusDev - A pointer to bus controller of the device.
- DeviceAddress - Represents the address of the target device on the USB,
- which is assigned during USB enumeration.
- EndPointAddress - End point address
- DeviceSpeed - Indicates device speed.
- MaximumPacketLength - Indicates the maximum packet size that the
- default control transfer endpoint is capable of
- sending or receiving.
- DataBuffersNumber - Number of data buffers prepared for the transfer.
- Data - Array of pointers to the buffers of data that will be transmitted
- to USB device or received from USB device.
- DataLength - Indicates the size, in bytes, of the data buffer
- specified by Data.
- Translator - A pointr to the transaction translator data.
- IsochronousCallBack - When the transfer complete, the call back function will be called
- Context - Pass to the call back function as parameter
-
- Returns:
-
- EFI_UNSUPPORTED
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-UsbPortReset (
- IN EFI_USB_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Resets and reconfigures the USB controller. This function will
- work for all USB devices except USB Hub Controllers.
-
- Arguments:
- This - Indicates the calling context.
-
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_DEVICE_ERROR
-
---*/
-;
-
-VOID
-InitializeUsbIoInstance (
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController
- )
-/*++
-
-Routine Description:
-
- Initialize the instance of UsbIo controller
-
-Arguments:
-
- UsbIoController - A pointer to controller structure of UsbIo
-
-Returns:
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbio.c b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbio.c
deleted file mode 100644
index 4601767..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbio.c
+++ /dev/null
@@ -1,1183 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- UsbIo.c
-
- Abstract:
-
- USB I/O Abstraction Driver
-
- Revision History
-
---*/
-
-#include "usbbus.h"
-
-//
-// USB I/O Support Function Prototypes
-//
-STATIC
-EFI_STATUS
-EFIAPI
-UsbControlTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT32 Timeout,
- IN OUT VOID *Data, OPTIONAL
- IN UINTN DataLength, OPTIONAL
- OUT UINT32 *Status
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbBulkTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN Timeout,
- OUT UINT32 *Status
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbAsyncInterruptTransfer (
- IN EFI_USB_IO_PROTOCOL * This,
- IN UINT8 DeviceEndpoint,
- IN BOOLEAN IsNewTransfer,
- IN UINTN PollingInterval, OPTIONAL
- IN UINTN DataLength, OPTIONAL
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK InterruptCallBack, OPTIONAL
- IN VOID *Context OPTIONAL
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbSyncInterruptTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN Timeout,
- OUT UINT32 *Status
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbIsochronousTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- OUT UINT32 *Status
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbAsyncIsochronousTransfer (
- IN EFI_USB_IO_PROTOCOL * This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context OPTIONAL
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetDeviceDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT EFI_USB_DEVICE_DESCRIPTOR *DeviceDescriptor
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetActiveConfigDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT EFI_USB_CONFIG_DESCRIPTOR *ConfigurationDescriptor
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetInterfaceDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetEndpointDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 EndpointIndex,
- OUT EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetStringDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT16 LangID,
- IN UINT8 StringIndex,
- OUT CHAR16 **String
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetSupportedLanguages (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT UINT16 **LangIDTable,
- OUT UINT16 *TableSize
- );
-
-//
-// USB I/O Interface structure
-//
-STATIC EFI_USB_IO_PROTOCOL UsbIoInterface = {
- UsbControlTransfer,
- UsbBulkTransfer,
- UsbAsyncInterruptTransfer,
- UsbSyncInterruptTransfer,
- UsbIsochronousTransfer,
- UsbAsyncIsochronousTransfer,
- UsbGetDeviceDescriptor,
- UsbGetActiveConfigDescriptor,
- UsbGetInterfaceDescriptor,
- UsbGetEndpointDescriptor,
- UsbGetStringDescriptor,
- UsbGetSupportedLanguages,
- UsbPortReset
-};
-
-VOID
-InitializeUsbIoInstance (
- IN USB_IO_CONTROLLER_DEVICE *UsbIoController
- )
-/*++
-
-Routine Description:
-
- Initialize the instance of UsbIo controller
-
-Arguments:
-
- UsbIoController - A pointer to controller structure of UsbIo
-
-Returns:
-
---*/
-{
- //
- // Copy EFI_USB_IO protocol instance
- //
- CopyMem (
- &UsbIoController->UsbIo,
- &UsbIoInterface,
- sizeof (EFI_USB_IO_PROTOCOL)
- );
-}
-//
-// Implementation
-//
-STATIC
-EFI_STATUS
-EFIAPI
-UsbControlTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT32 Timeout,
- IN OUT VOID *Data, OPTIONAL
- IN UINTN DataLength, OPTIONAL
- OUT UINT32 *Status
- )
-/*++
-
- Routine Description:
- This function is used to manage a USB device with a control transfer pipe.
-
- Arguments:
- This - Indicates calling context.
- Request - A pointer to the USB device request that will be sent to
- the USB device.
- Direction - Indicates the data direction.
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- Timeout - Indicates the transfer should be completed within this time
- frame.
- DataLength - The size, in bytes, of the data buffer specified by Data.
- Status - A pointer to the result of the USB transfer.
-
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_OUT_OF_RESOURCES
- EFI_TIMEOUT
- EFI_DEVICE_ERROR
-
---*/
-{
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
-
- EFI_STATUS RetStatus;
- USB_IO_DEVICE *UsbIoDev;
- UINT8 MaxPacketLength;
- UINT32 TransferResult;
- BOOLEAN Disconnected;
- //
- // Parameters Checking
- //
- if (Status == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // leave the HostController's ControlTransfer
- // to perform other parameters checking
- //
- UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
- UsbIoDev = UsbIoController->UsbDevice;
-
- MaxPacketLength = UsbIoDev->DeviceDescriptor.MaxPacketSize0;
-
-
- if (Request->Request == USB_DEV_CLEAR_FEATURE &&
- Request->RequestType == 0x02 &&
- Request->Value == EfiUsbEndpointHalt) {
- //
- //Reduce the remove delay time for system response
- //
- IsDeviceDisconnected (UsbIoController, &Disconnected);
- if (!EFI_ERROR (Status) && Disconnected == TRUE) {
- DEBUG ((gUSBErrorLevel, "Device is disconnected when trying reset\n"));
- return EFI_DEVICE_ERROR;
- }
- }
- //
- // using HostController's ControlTransfer to complete the request
- //
- RetStatus = UsbVirtualHcControlTransfer (
- UsbIoDev->BusController,
- UsbIoDev->DeviceAddress,
- UsbIoDev->DeviceSpeed,
- MaxPacketLength,
- Request,
- Direction,
- Data,
- &DataLength,
- (UINTN) Timeout,
- UsbIoDev->Translator,
- &TransferResult
- );
-
- *Status = TransferResult;
-
- if (Request->Request == USB_DEV_CLEAR_FEATURE &&
- Request->RequestType == 0x02 &&
- Request->Value == EfiUsbEndpointHalt) {
- //
- // This is a UsbClearEndpointHalt request
- // Need to clear data toggle
- // Request.Index == EndpointAddress
- //
- if (!EFI_ERROR (RetStatus) && TransferResult == EFI_USB_NOERROR) {
- SetDataToggleBit (
- This,
- (UINT8) Request->Index,
- 0
- );
- }
- }
- return RetStatus;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbBulkTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN Timeout,
- OUT UINT32 *Status
- )
-/*++
-
- Routine Description:
- This function is used to manage a USB device with the bulk transfer pipe.
-
- Arguments:
- This - Indicates calling context.
- DeviceEndpoint - The destination USB device endpoint to which the device
- request is being sent.
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- DataLength - On input, the size, in bytes, of the data buffer
- specified by Data. On output, the number of bytes that
- were actually transferred.
- Timeout - Indicates the transfer should be completed within this
- time frame.
- Status - This parameter indicates the USB transfer status.
-
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_OUT_OF_RESOURCES
- EFI_TIMEOUT
- EFI_DEVICE_ERROR
-
---*/
-{
- USB_IO_DEVICE *UsbIoDev;
- UINTN MaxPacketLength;
- UINT8 DataToggle;
- UINT8 OldToggle;
- EFI_STATUS RetStatus;
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
- ENDPOINT_DESC_LIST_ENTRY *EndPointListEntry;
- UINT8 DataBuffersNumber;
- UINT32 TransferResult;
-
- DataBuffersNumber = 1;
- UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
- UsbIoDev = UsbIoController->UsbDevice;
-
- //
- // Parameters Checking
- //
- if ((DeviceEndpoint & 0x7F) == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((DeviceEndpoint & 0x7F) > 15) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Status == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- EndPointListEntry = FindEndPointListEntry (
- This,
- DeviceEndpoint
- );
-
- if (EndPointListEntry == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((EndPointListEntry->EndpointDescriptor.Attributes & 0x03) != 0x02) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // leave the HostController's BulkTransfer
- // to perform other parameters checking
- //
- GetDeviceEndPointMaxPacketLength (
- This,
- DeviceEndpoint,
- &MaxPacketLength
- );
-
- GetDataToggleBit (
- This,
- DeviceEndpoint,
- &DataToggle
- );
-
- OldToggle = DataToggle;
-
- //
- // using HostController's BulkTransfer to complete the request
- //
- RetStatus = UsbVirtualHcBulkTransfer (
- UsbIoDev->BusController,
- UsbIoDev->DeviceAddress,
- DeviceEndpoint,
- UsbIoDev->DeviceSpeed,
- MaxPacketLength,
- DataBuffersNumber,
- &Data,
- DataLength,
- &DataToggle,
- Timeout,
- UsbIoDev->Translator,
- &TransferResult
- );
-
- if (OldToggle != DataToggle) {
- //
- // Write the toggle back
- //
- SetDataToggleBit (
- This,
- DeviceEndpoint,
- DataToggle
- );
- }
-
- *Status = TransferResult;
-
- return RetStatus;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbSyncInterruptTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN Timeout,
- OUT UINT32 *Status
- )
-/*++
-
- Routine Description:
- Usb Sync Interrupt Transfer
-
- Arguments:
- This - Indicates calling context.
- DeviceEndpoint - The destination USB device endpoint to which the device
- request is being sent.
- Data - A pointer to the buffer of data that will be transmitted
- to USB device or received from USB device.
- DataLength - On input, the size, in bytes, of the data buffer
- specified by Data. On output, the number of bytes that
- were actually transferred.
- Timeout - Indicates the transfer should be completed within this
- time frame.
- Status - This parameter indicates the USB transfer status.
-
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_OUT_OF_RESOURCES
- EFI_TIMEOUT
- EFI_DEVICE_ERROR
-
---*/
-{
- USB_IO_DEVICE *UsbIoDev;
- UINTN MaxPacketLength;
- UINT8 DataToggle;
- UINT8 OldToggle;
- EFI_STATUS RetStatus;
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
- ENDPOINT_DESC_LIST_ENTRY *EndPointListEntry;
-
- //
- // Parameters Checking
- //
- if ((DeviceEndpoint & 0x7F) == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((DeviceEndpoint & 0x7F) > 15) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Status == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- EndPointListEntry = FindEndPointListEntry (
- This,
- DeviceEndpoint
- );
-
- if (EndPointListEntry == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((EndPointListEntry->EndpointDescriptor.Attributes & 0x03) != 0x03) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // leave the HostController's SyncInterruptTransfer
- // to perform other parameters checking
- //
- UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
- UsbIoDev = UsbIoController->UsbDevice;
- GetDeviceEndPointMaxPacketLength (
- This,
- DeviceEndpoint,
- &MaxPacketLength
- );
-
- GetDataToggleBit (
- This,
- DeviceEndpoint,
- &DataToggle
- );
-
- OldToggle = DataToggle;
- //
- // using HostController's SyncInterruptTransfer to complete the request
- //
- RetStatus = UsbVirtualHcSyncInterruptTransfer (
- UsbIoDev->BusController,
- UsbIoDev->DeviceAddress,
- DeviceEndpoint,
- UsbIoDev->DeviceSpeed,
- MaxPacketLength,
- Data,
- DataLength,
- &DataToggle,
- Timeout,
- UsbIoDev->Translator,
- Status
- );
-
- if (OldToggle != DataToggle) {
- //
- // Write the toggle back
- //
- SetDataToggleBit (
- This,
- DeviceEndpoint,
- DataToggle
- );
- }
-
- return RetStatus;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbAsyncInterruptTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 DeviceEndpoint,
- IN BOOLEAN IsNewTransfer,
- IN UINTN PollingInterval, OPTIONAL
- IN UINTN DataLength, OPTIONAL
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK InterruptCallBack, OPTIONAL
- IN VOID *Context OPTIONAL
- )
-/*++
-
- Routine Description:
- Usb Async Interrput Transfer
-
- Arguments:
- This - Indicates calling context.
- DeviceEndpoint - The destination USB device endpoint to which the
- device request is being sent.
- IsNewTransfer - If TRUE, a new transfer will be submitted to USB
- controller. If FALSE, the interrupt transfer is
- deleted from the device's interrupt transfer queue.
- PollingInterval - Indicates the periodic rate, in milliseconds, that
- the transfer is to be executed.
- DataLength - Specifies the length, in bytes, of the data to be
- received from the USB device.
- InterruptCallBack - The Callback function. This function is called if
- the asynchronous interrupt transfer is completed.
- Context - Passed to InterruptCallback
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- USB_IO_DEVICE *UsbIoDev;
- UINTN MaxPacketLength;
- UINT8 DataToggle;
- EFI_STATUS RetStatus;
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
- ENDPOINT_DESC_LIST_ENTRY *EndpointListEntry;
-
- //
- // Check endpoint
- //
- if ((DeviceEndpoint & 0x7F) == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((DeviceEndpoint & 0x7F) > 15) {
- return EFI_INVALID_PARAMETER;
- }
-
- EndpointListEntry = FindEndPointListEntry (
- This,
- DeviceEndpoint
- );
-
- if (EndpointListEntry == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((EndpointListEntry->EndpointDescriptor.Attributes & 0x03) != 0x03) {
- return EFI_INVALID_PARAMETER;
- }
-
- UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
- UsbIoDev = UsbIoController->UsbDevice;
-
- if (!IsNewTransfer) {
- //
- // Delete this transfer
- //
- UsbVirtualHcAsyncInterruptTransfer (
- UsbIoDev->BusController,
- UsbIoDev->DeviceAddress,
- DeviceEndpoint,
- UsbIoDev->DeviceSpeed,
- 0,
- FALSE,
- &DataToggle,
- PollingInterval,
- DataLength,
- UsbIoDev->Translator,
- NULL,
- NULL
- );
-
- //
- // We need to store the toggle value
- //
- SetDataToggleBit (
- This,
- DeviceEndpoint,
- DataToggle
- );
-
- return EFI_SUCCESS;
- }
-
- GetDeviceEndPointMaxPacketLength (
- This,
- DeviceEndpoint,
- &MaxPacketLength
- );
-
- GetDataToggleBit (
- This,
- DeviceEndpoint,
- &DataToggle
- );
-
- RetStatus = UsbVirtualHcAsyncInterruptTransfer (
- UsbIoDev->BusController,
- UsbIoDev->DeviceAddress,
- DeviceEndpoint,
- UsbIoDev->DeviceSpeed,
- MaxPacketLength,
- TRUE,
- &DataToggle,
- PollingInterval,
- DataLength,
- UsbIoDev->Translator,
- InterruptCallBack,
- Context
- );
-
- return RetStatus;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbIsochronousTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- OUT UINT32 *Status
- )
-/*++
-
- Routine Description:
- Usb Isochronous Transfer
-
- Arguments:
- This - Indicates calling context.
- DeviceEndpoint - The destination USB device endpoint to which the
- device request is being sent.
- Data - A pointer to the buffer of data that will be
- transmitted to USB device or received from USB device.
- DataLength - The size, in bytes, of the data buffer specified by
- Data.
- Status - This parameter indicates the USB transfer status.
-
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_OUT_OF_RESOURCES
- EFI_TIMEOUT
- EFI_DEVICE_ERROR
- EFI_UNSUPPORTED
---*/
-{
- //
- // Currently we don't support this transfer
- //
- return EFI_UNSUPPORTED;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbAsyncIsochronousTransfer (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN UINTN DataLength,
- IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
- IN VOID *Context OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Usb Async Isochronous Transfer
-
-Arguments:
-
- This - EFI_USB_IO_PROTOCOL
- DeviceEndpoint - DeviceEndpoint number
- Data - Data to transfer
- DataLength - DataLength
- IsochronousCallBack - Isochronous CallBack function
- Context - Passed to IsochronousCallBack function
-Returns:
-
- EFI_UNSUPPORTED - Unsupported now
-
---*/
-{
- //
- // Currently we don't support this transfer
- //
- return EFI_UNSUPPORTED;
-}
-//
-// Here is new definitions
-//
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetDeviceDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT EFI_USB_DEVICE_DESCRIPTOR *DeviceDescriptor
- )
-/*++
-
- Routine Description:
- Retrieves the USB Device Descriptor.
-
- Arguments:
- This - Indicates the calling context.
- DeviceDescriptor - A pointer to the caller allocated USB Device
- Descriptor.
-
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_NOT_FOUND
-
---*/
-{
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
- USB_IO_DEVICE *UsbIoDev;
-
- //
- // This function just wrapps UsbGetDeviceDescriptor.
- //
-
- if (DeviceDescriptor == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
- UsbIoDev = UsbIoController->UsbDevice;
-
- if (!UsbIoDev->IsConfigured) {
- return EFI_NOT_FOUND;
- }
-
- CopyMem (
- DeviceDescriptor,
- &UsbIoDev->DeviceDescriptor,
- sizeof (EFI_USB_DEVICE_DESCRIPTOR)
- );
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetActiveConfigDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT EFI_USB_CONFIG_DESCRIPTOR *ConfigurationDescriptor
- )
-/*++
-
- Routine Description:
- Retrieves the current USB configuration Descriptor.
-
- Arguments:
- This - Indicates the calling context.
- ConfigurationDescriptor - A pointer to the caller allocated USB active
- Configuration Descriptor.
-
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_NOT_FOUND
-
---*/
-{
- USB_IO_DEVICE *UsbIoDev;
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
-
- //
- // This function just wrapps UsbGetActiveConfigDescriptor.
- //
- if (ConfigurationDescriptor == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
- UsbIoDev = UsbIoController->UsbDevice;
-
- if (!UsbIoDev->IsConfigured) {
- return EFI_NOT_FOUND;
- }
-
- CopyMem (
- ConfigurationDescriptor,
- &(UsbIoDev->ActiveConfig->CongfigDescriptor),
- sizeof (EFI_USB_CONFIG_DESCRIPTOR)
- );
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetInterfaceDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor
- )
-/*++
-
- Routine Description:
- Retrieves the interface Descriptor for that controller.
-
- Arguments:
- This - Indicates the calling context.
- InterfaceDescriptor - A pointer to the caller allocated USB interface
- Descriptor.
-
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_NOT_FOUND
-
---*/
-{
- INTERFACE_DESC_LIST_ENTRY *InterfaceListEntry;
-
- if (InterfaceDescriptor == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- InterfaceListEntry = FindInterfaceListEntry (This);
-
- if (InterfaceListEntry == NULL) {
- return EFI_NOT_FOUND;
- }
-
- CopyMem (
- InterfaceDescriptor,
- &(InterfaceListEntry->InterfaceDescriptor),
- sizeof (EFI_USB_INTERFACE_DESCRIPTOR)
- );
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetEndpointDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 EndpointIndex,
- OUT EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor
- )
-/*++
-
- Routine Description:
- Retrieves the endpoint Descriptor for a given endpoint.
-
- Arguments:
- This - Indicates the calling context.
- EndpointIndex - Indicates which endpoint descriptor to retrieve.
- The valid range is 0..15.
- EndpointDescriptor - A pointer to the caller allocated USB Endpoint
- Descriptor of a USB controller.
-
- Returns:
- EFI_SUCCESS - The endpoint descriptor was retrieved successfully.
- EFI_INVALID_PARAMETER - EndpointIndex is not valid.
- - EndpointDescriptor is NULL.
- EFI_NOT_FOUND - The endpoint descriptor cannot be found.
- The device may not be correctly configured.
-
---*/
-{
- INTERFACE_DESC_LIST_ENTRY *InterfaceListEntry;
- LIST_ENTRY *EndpointListHead;
- ENDPOINT_DESC_LIST_ENTRY *EndpointListEntry;
-
- if (EndpointDescriptor == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EndpointIndex > 15) {
- return EFI_INVALID_PARAMETER;
- }
-
- InterfaceListEntry = FindInterfaceListEntry (This);
-
- if (InterfaceListEntry == NULL) {
- return EFI_NOT_FOUND;
- }
-
- EndpointListHead = (LIST_ENTRY *) (&InterfaceListEntry->EndpointDescListHead);
- EndpointListEntry = (ENDPOINT_DESC_LIST_ENTRY *) (EndpointListHead->ForwardLink);
-
- if (EndpointIndex >= InterfaceListEntry->InterfaceDescriptor.NumEndpoints) {
- return EFI_NOT_FOUND;
- }
- //
- // Loop all endpoint descriptor to get match one.
- //
- while (EndpointIndex != 0) {
- EndpointListEntry = (ENDPOINT_DESC_LIST_ENTRY *) (EndpointListEntry->Link.ForwardLink);
- EndpointIndex--;
- }
-
- CopyMem (
- EndpointDescriptor,
- &EndpointListEntry->EndpointDescriptor,
- sizeof (EFI_USB_ENDPOINT_DESCRIPTOR)
- );
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetSupportedLanguages (
- IN EFI_USB_IO_PROTOCOL *This,
- OUT UINT16 **LangIDTable,
- OUT UINT16 *TableSize
- )
-/*++
-
- Routine Description:
- Get all the languages that the USB device supports
-
- Arguments:
- This - Indicates the calling context.
- LangIDTable - Language ID for the string the caller wants to get.
- TableSize - The size, in bytes, of the table LangIDTable.
-
- Returns:
- EFI_SUCCESS
- EFI_NOT_FOUND
-
---*/
-{
- USB_IO_DEVICE *UsbIoDev;
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
- UINTN Index;
- BOOLEAN Found;
-
- UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
- UsbIoDev = UsbIoController->UsbDevice;
-
- Found = FALSE;
- Index = 0;
- //
- // Loop language table
- //
- while (UsbIoDev->LangID[Index]) {
- Found = TRUE;
- Index++;
- }
-
- if (!Found) {
- return EFI_NOT_FOUND;
- }
-
- *LangIDTable = UsbIoDev->LangID;
- *TableSize = (UINT16) Index;
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbGetStringDescriptor (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT16 LangID,
- IN UINT8 StringIndex,
- OUT CHAR16 **String
- )
-/*++
-
- Routine Description:
- Get a given string descriptor
-
- Arguments:
- This - Indicates the calling context.
- LangID - The Language ID for the string being retrieved.
- StringIndex - The ID of the string being retrieved.
- String - A pointer to a buffer allocated by this function
- with AllocatePool() to store the string. If this
- function returns EFI_SUCCESS, it stores the string
- the caller wants to get. The caller should release
- the string buffer with FreePool() after the string
- is not used any more.
- Returns:
- EFI_SUCCESS
- EFI_NOT_FOUND
- EFI_OUT_OF_RESOURCES
- EFI_UNSUPPORTED
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_STRING_DESCRIPTOR *StrDescriptor;
- UINT8 *Buffer;
- CHAR16 *UsbString;
- UINT16 TempBuffer;
- USB_IO_DEVICE *UsbIoDev;
- UINT8 Index;
- BOOLEAN Found;
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
-
- if (StringIndex == 0) {
- return EFI_NOT_FOUND;
- }
- //
- // Search LanguageID, check if it is supported by this device
- //
- if (LangID == 0) {
- return EFI_NOT_FOUND;
- }
-
- UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
- UsbIoDev = UsbIoController->UsbDevice;
-
- Found = FALSE;
- Index = 0;
- while (UsbIoDev->LangID[Index]) {
- if (UsbIoDev->LangID[Index] == LangID) {
- Found = TRUE;
- break;
- }
-
- Index++;
- }
-
- if (!Found) {
- return EFI_NOT_FOUND;
- }
- //
- // Get String Length
- //
- Result = UsbGetString (
- This,
- LangID,
- StringIndex,
- &TempBuffer,
- 2,
- &Status
- );
- if (EFI_ERROR (Result)) {
- return EFI_NOT_FOUND;
- }
-
- StrDescriptor = (EFI_USB_STRING_DESCRIPTOR *) &TempBuffer;
-
- if (StrDescriptor->Length == 0) {
- return EFI_UNSUPPORTED;
- }
-
- Buffer = AllocateZeroPool (StrDescriptor->Length);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Result = UsbGetString (
- This,
- LangID,
- StringIndex,
- Buffer,
- StrDescriptor->Length,
- &Status
- );
-
- if (EFI_ERROR (Result)) {
- gBS->FreePool (Buffer);
- return EFI_NOT_FOUND;
- }
-
- StrDescriptor = (EFI_USB_STRING_DESCRIPTOR *) Buffer;
-
- //
- // UsbString is a UNICODE string
- //
- UsbString = AllocateZeroPool (StrDescriptor->Length);
- if (UsbString == NULL) {
- gBS->FreePool (Buffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (
- (VOID *) UsbString,
- Buffer + 2,
- StrDescriptor->Length - 2
- );
-
- *String = UsbString;
-
- gBS->FreePool (Buffer);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbutil.c b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbutil.c
deleted file mode 100644
index e338085..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbutil.c
+++ /dev/null
@@ -1,554 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
- usbutil.c
-
- Abstract:
-
- Helper functions for USB
-
- Revision History
-
---*/
-
-#include "usbbus.h"
-
-//
-// Following APIs are used to query Port Status
-//
-BOOLEAN
-IsPortConnect (
- IN UINT16 PortStatus
- )
-/*++
-
- Routine Description:
- Tell if there is a device connected to that port according to
- the Port Status.
-
- Arguments:
- PortStatus - The status value of that port.
-
- Returns:
- TRUE
- FALSE
-
---*/
-{
- //
- // return the bit 0 value of PortStatus
- //
- if ((PortStatus & USB_PORT_STAT_CONNECTION) != 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsPortEnable (
- IN UINT16 PortStatus
- )
-/*++
-
- Routine Description:
- Tell if Port is enabled.
-
- Arguments:
- PortStatus - The status value of that port.
-
- Returns:
- TRUE - Port is enable
- FALSE - Port is disable
-
---*/
-{
- //
- // return the bit 1 value of PortStatus
- //
- if ((PortStatus & USB_PORT_STAT_ENABLE) != 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsPortInReset (
- IN UINT16 PortStatus
- )
-/*++
-
- Routine Description:
- Tell if the port is being reset.
-
- Arguments:
- PortStatus - The status value of that port.
-
- Returns:
- TRUE
- FALSE
-
---*/
-{
- //
- // return the bit 4 value of PortStatus
- //
- if ((PortStatus & USB_PORT_STAT_RESET) != 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsPortPowerApplied (
- IN UINT16 PortStatus
- )
-/*++
-
- Routine Description:
- Tell if there is power applied to that port.
-
- Arguments:
- PortStatus - The status value of that port.
-
- Returns:
- TRUE
- FALSE
-
---*/
-{
- //
- // return the bit 8 value of PortStatus
- //
- if ((PortStatus & USB_PORT_STAT_POWER) != 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsPortLowSpeedDeviceAttached (
- IN UINT16 PortStatus
- )
-/*++
-
- Routine Description:
- Tell if the connected device is a low device.
-
- Arguments:
- PortStatus - The status value of that port.
-
- Returns:
- TRUE
- FALSE
-
---*/
-{
- //
- // return the bit 9 value of PortStatus
- //
- if ((PortStatus & USB_PORT_STAT_LOW_SPEED) != 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsPortSuspend (
- IN UINT16 PortStatus
- )
-/*++
-
- Routine Description:
- Tell if the port is suspend.
-
- Arguments:
- PortStatus - The status value of that port.
-
- Returns:
- TRUE
- FALSE
-
---*/
-{
- //
- // return the bit 2 value of PortStatus
- //
- if ((PortStatus & USB_PORT_STAT_SUSPEND) != 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-//
-// Following APIs are used to query Port Change Status
-//
-BOOLEAN
-IsPortConnectChange (
- IN UINT16 PortChangeStatus
- )
-/*++
-
- Routine Description:
- Tell if there is a Connect Change status in that port.
-
- Arguments:
- PortChangeStatus - The status value of that port.
-
- Returns:
- TRUE
- FALSE
-
---*/
-{
- //
- // return the bit 0 value of PortChangeStatus
- //
- if ((PortChangeStatus & USB_PORT_STAT_C_CONNECTION) != 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsPortEnableDisableChange (
- IN UINT16 PortChangeStatus
- )
-/*++
-
- Routine Description:
- Tell if there is a Enable/Disable change in that port.
-
- Arguments:
- PortChangeStatus - The status value of that port.
-
- Returns:
- TRUE
- FALSE
-
---*/
-{
- //
- // return the bit 1 value of PortChangeStatus
- //
- if ((PortChangeStatus & USB_PORT_STAT_C_ENABLE) != 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsPortResetChange (
- IN UINT16 PortChangeStatus
- )
-/*++
-
- Routine Description:
- Tell if there is a Port Reset Change status in that port.
-
- Arguments:
- PortChangeStatus - The status value of that port.
-
- Returns:
- TRUE
- FALSE
-
---*/
-{
- //
- // return the bit 4 value of PortChangeStatus
- //
- if ((PortChangeStatus & USB_PORT_STAT_C_RESET) != 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsPortSuspendChange (
- IN UINT16 PortChangeStatus
- )
-/*++
-
- Routine Description:
- Tell if there is a Suspend Change Status in that port.
-
- Arguments:
- PortChangeStatus - The status value of that port.
-
- Returns:
- TRUE
- FALSE
-
---*/
-{
- //
- // return the bit 2 value of PortChangeStatus
- //
- if ((PortChangeStatus & USB_PORT_STAT_C_SUSPEND) != 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-INTERFACE_DESC_LIST_ENTRY *
-FindInterfaceListEntry (
- IN EFI_USB_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Find Interface ListEntry.
-
- Arguments:
- This - EFI_USB_IO_PROTOCOL
-
- Returns:
- INTERFACE_DESC_LIST_ENTRY pointer
-
---*/
-{
- USB_IO_CONTROLLER_DEVICE *UsbIoController;
- USB_IO_DEVICE *UsbIoDev;
- LIST_ENTRY *InterfaceListHead;
- INTERFACE_DESC_LIST_ENTRY *InterfaceListEntry;
-
- UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
- UsbIoDev = UsbIoController->UsbDevice;
-
- if (!UsbIoDev->IsConfigured) {
- return NULL;
- }
-
- InterfaceListHead = &UsbIoDev->ActiveConfig->InterfaceDescListHead;
- InterfaceListEntry = (INTERFACE_DESC_LIST_ENTRY *) (InterfaceListHead->ForwardLink);
-
- //
- // Loop all interface descriptor to get match one.
- //
- while (InterfaceListEntry != (INTERFACE_DESC_LIST_ENTRY *) InterfaceListHead) {
- if (InterfaceListEntry->InterfaceDescriptor.InterfaceNumber == UsbIoController->InterfaceNumber) {
- return InterfaceListEntry;
- }
-
- InterfaceListEntry = (INTERFACE_DESC_LIST_ENTRY *) InterfaceListEntry->Link.ForwardLink;
- }
-
- return NULL;
-}
-
-ENDPOINT_DESC_LIST_ENTRY*
-FindEndPointListEntry (
- IN EFI_USB_IO_PROTOCOL *This,
- IN UINT8 EndPointAddress
- )
-/*++
-
- Routine Description:
- Find EndPoint ListEntry.
-
- Arguments:
- This - EFI_USB_IO_PROTOCOL
- EndPointAddress - Endpoint address.
-
- Returns:
- ENDPOINT_DESC_LIST_ENTRY pointer
-
---*/
-{
- INTERFACE_DESC_LIST_ENTRY *InterfaceListEntry;
- LIST_ENTRY *EndpointDescListHead;
- ENDPOINT_DESC_LIST_ENTRY *EndPointListEntry;
-
- InterfaceListEntry = FindInterfaceListEntry (This);
- if (InterfaceListEntry != NULL) {
- EndpointDescListHead = &InterfaceListEntry->EndpointDescListHead;
- EndPointListEntry = (ENDPOINT_DESC_LIST_ENTRY *) (EndpointDescListHead->ForwardLink);
-
- //
- // Loop all interface descriptor to get match one.
- //
- while (EndPointListEntry != (ENDPOINT_DESC_LIST_ENTRY *) EndpointDescListHead) {
- if (EndPointListEntry->EndpointDescriptor.EndpointAddress == EndPointAddress) {
- return EndPointListEntry;
- }
-
- EndPointListEntry = (ENDPOINT_DESC_LIST_ENTRY *) EndPointListEntry->Link.ForwardLink;
- }
- }
-
- return NULL;
-}
-
-VOID
-GetDataToggleBit (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 EndpointAddr,
- OUT UINT8 *DataToggle
- )
-/*++
-
- Routine Description:
- Get the datatoggle of a specified endpoint.
-
- Arguments:
- UsbIo - Given Usb Controller device.
- EndpointAddr - Given Endpoint address.
- DataToggle - The current data toggle of that endpoint
-
- Returns:
- N/A
-
---*/
-{
-
- ENDPOINT_DESC_LIST_ENTRY *EndpointListEntry;
-
- *DataToggle = 0;
-
- EndpointListEntry = FindEndPointListEntry (UsbIo, EndpointAddr);
- if (EndpointListEntry == NULL) {
- return ;
- }
-
- *DataToggle = (UINT8) (EndpointListEntry->Toggle);
- return ;
-}
-
-VOID
-SetDataToggleBit (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 EndpointAddr,
- IN UINT8 DataToggle
- )
-/*++
-
- Routine Description:
- Set the datatoggle of a specified endpoint
-
- Arguments:
- UsbIo - Given Usb Controller device.
- EndpointAddr - Given Endpoint address.
- DataToggle - The current data toggle of that endpoint to be set
-
- Returns:
- N/A
-
---*/
-{
-
- ENDPOINT_DESC_LIST_ENTRY *EndpointListEntry;
-
- EndpointListEntry = FindEndPointListEntry (UsbIo, EndpointAddr);
- if (EndpointListEntry == NULL) {
- return ;
- }
-
- EndpointListEntry->Toggle = DataToggle;
- return ;
-}
-
-VOID
-GetDeviceEndPointMaxPacketLength (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 EndpointAddr,
- OUT UINTN *MaxPacketLength
- )
-/*++
-
- Routine Description:
- Get the Max Packet Length of the speified Endpoint.
-
- Arguments:
- UsbIo - Given Usb Controller device.
- EndpointAddr - Given Endpoint address.
- MaxPacketLength - The max packet length of that endpoint
-
- Returns:
- N/A
-
---*/
-{
-
- ENDPOINT_DESC_LIST_ENTRY *EndpointListEntry;
-
- *MaxPacketLength = 0;
-
- EndpointListEntry = FindEndPointListEntry (UsbIo, EndpointAddr);
- if (EndpointListEntry == NULL) {
- return ;
- }
-
- *MaxPacketLength = (UINTN) (EndpointListEntry->EndpointDescriptor.MaxPacketSize);
-
- return ;
-}
-
-
-EFI_STATUS
-UsbSetDeviceAddress (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 AddressValue,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Set Device Address
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- AddressValue - Device address
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_SET_ADDRESS_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_ADDRESS;
- DevReq.Value = AddressValue;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- Status
- );
-}
-
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbutil.h b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbutil.h
deleted file mode 100644
index 259276c..0000000
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbutil.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
- usbutil.h
-
- Abstract:
-
- Helper functions for USB
-
- Revision History
-
-
---*/
-
-#ifndef _USB_UTIL_H
-#define _USB_UTIL_H
-
-//
-// Following APIs are used to query Port Status
-//
-BOOLEAN
-IsPortConnect (
- IN UINT16 PortStatus
- );
-
-BOOLEAN
-IsPortEnable (
- IN UINT16 PortStatus
- );
-
-BOOLEAN
-IsPortInReset (
- IN UINT16 PortStatus
- );
-
-BOOLEAN
-IsPortPowerApplied (
- IN UINT16 PortStatus
- );
-
-BOOLEAN
-IsPortLowSpeedDeviceAttached (
- IN UINT16 PortStatus
- );
-
-BOOLEAN
-IsPortSuspend (
- IN UINT16 PortStatus
- );
-
-//
-// Following APIs are used to query Port Change Status
-//
-BOOLEAN
-IsPortConnectChange (
- IN UINT16 PortChangeStatus
- );
-
-BOOLEAN
-IsPortEnableDisableChange (
- IN UINT16 PortChangeStatus
- );
-
-BOOLEAN
-IsPortResetChange (
- IN UINT16 PortChangeStatus
- );
-
-BOOLEAN
-IsPortSuspendChange (
- IN UINT16 PortChangeStatus
- );
-
-//
-// Set device address;
-//
-EFI_STATUS
-UsbSetDeviceAddress (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 AddressValue,
- OUT UINT32 *Status
- );
-
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/Cbi0.c b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/Cbi0.c
deleted file mode 100644
index 73b8940..0000000
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/Cbi0.c
+++ /dev/null
@@ -1,1025 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Cbi0.c
-
-Abstract:
-
---*/
-
-#include "cbi.h"
-
-//
-// Bot Driver Binding Protocol
-//
-STATIC
-EFI_STATUS
-EFIAPI
-Cbi0DriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-Cbi0DriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-Cbi0DriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-STATIC
-VOID
-Cbi0ReportStatusCode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value
- );
-
-
-EFI_DRIVER_BINDING_PROTOCOL gUsbCbi0DriverBinding = {
- Cbi0DriverBindingSupported,
- Cbi0DriverBindingStart,
- Cbi0DriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-STATIC
-EFI_STATUS
-Cbi0RecoveryReset (
- IN USB_CBI_DEVICE *UsbCbiDev
- );
-
-STATIC
-EFI_STATUS
-Cbi0CommandPhase (
- IN USB_CBI_DEVICE *UsbCbiDev,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN UINT16 Timeout
- );
-
-STATIC
-EFI_STATUS
-Cbi0DataPhase (
- IN USB_CBI_DEVICE *UsbCbiDev,
- IN UINT32 *DataSize,
- IN OUT VOID *DataBuffer,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 Timeout
- );
-
-STATIC
-EFI_STATUS
-Cbi0StatusPhase (
- IN USB_CBI_DEVICE *UsbCbiDev,
- OUT INTERRUPT_DATA_BLOCK *InterruptDataBlock,
- IN UINT16 Timeout
- );
-
-//
-// USB Atapi protocol prototype
-//
-STATIC
-EFI_STATUS
-EFIAPI
-Cbi0AtapiCommand (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN VOID *DataBuffer,
- IN UINT32 BufferLength,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 TimeOutInMilliSeconds
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-Cbi0MassStorageReset (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-STATIC EFI_USB_ATAPI_PROTOCOL Cbi0AtapiProtocol = {
- Cbi0AtapiCommand,
- Cbi0MassStorageReset,
- 0
-};
-
-STATIC
-EFI_STATUS
-EFIAPI
-Cbi0DriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- than contains a BlockIo and DiskIo protocol can be supported.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device
- EFI_ALREADY_STARTED - This driver is already running on this device
- other - This driver does not support this device
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
-
- //
- // Check if the Controller supports USB IO protocol
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the Default interface descriptor, now we only
- // suppose interface 1
- //
- Status = UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &InterfaceDescriptor
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
- }
- //
- // Check if it is a Cbi0 Type Mass Storage Device
- //
- if((InterfaceDescriptor.InterfaceClass != MASS_STORAGE_CLASS) ||
- (InterfaceDescriptor.InterfaceProtocol != CBI0_INTERFACE_PROTOCOL)) {
- Status = EFI_UNSUPPORTED;
- } else {
- Status = EFI_SUCCESS;
- }
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-Cbi0DriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Start this driver on ControllerHandle by opening a Block IO and Disk IO
- protocol, reading Device Path, and creating a child handle with a
- Disk IO and device path protocol.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to bind driver to
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver is added to DeviceHandle
- EFI_ALREADY_STARTED - This driver is already running on DeviceHandle
- other - This driver does not support this device
- EFI_OUT_OF_RESOURCES- Can't allocate memory
- EFI_UNSUPPORTED - Endpoint is not as expected
---*/
-{
- USB_CBI_DEVICE *UsbCbiDev;
- UINT8 Index;
- EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 EndpointExistMask;
-
- //
- // Check if the Controller supports USB IO protocol
- //
- UsbCbiDev = NULL;
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the controller interface descriptor
- //
- Status = UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &InterfaceDescriptor
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
- }
-
- Cbi0AtapiProtocol.CommandProtocol = InterfaceDescriptor.InterfaceSubClass;
-
- UsbCbiDev = AllocateZeroPool (sizeof (USB_CBI_DEVICE));
- if (UsbCbiDev == NULL) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return EFI_OUT_OF_RESOURCES;
- }
-
- UsbCbiDev->Signature = USB_CBI_DEVICE_SIGNATURE;
- UsbCbiDev->UsbIo = UsbIo;
- CopyMem (&UsbCbiDev->InterfaceDescriptor, &InterfaceDescriptor, sizeof (InterfaceDescriptor));
- CopyMem (&UsbCbiDev->UsbAtapiProtocol, &Cbi0AtapiProtocol, sizeof (Cbi0AtapiProtocol));
-
- //
- // Get the Device Path Protocol on Controller's handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &UsbCbiDev->DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- if (UsbCbiDev != NULL) {
- gBS->FreePool (UsbCbiDev);
- }
-
- return Status;
- }
- //
- // Mask used to see whether all three kinds of endpoints exist,
- // Mask value:
- // bit0: bulk in endpoint;
- // bit1: bulk out endpoint;
- // bit2: interrupt in endpoint;
- //
- EndpointExistMask = 0;
- for (Index = 0; Index < InterfaceDescriptor.NumEndpoints; Index++) {
- UsbIo->UsbGetEndpointDescriptor (
- UsbIo,
- Index,
- &EndpointDescriptor
- );
-
- //
- // We parse bulk endpoint
- //
- if (EndpointDescriptor.Attributes == 0x02) {
- if (EndpointDescriptor.EndpointAddress & 0x80) {
- CopyMem (&UsbCbiDev->BulkInEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
- EndpointExistMask |= bit (0);
- } else {
- CopyMem (&UsbCbiDev->BulkOutEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
- EndpointExistMask |= bit (1);
- }
- }
- //
- // We parse interrupt endpoint
- //
- if (EndpointDescriptor.Attributes == 0x03) {
- CopyMem (&UsbCbiDev->InterruptEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
- EndpointExistMask |= bit (2);
- }
-
- }
- //
- // Double check we have all endpoints needed
- //
- if (EndpointExistMask != (bit (0) | bit (1) | bit (2))) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- if (UsbCbiDev != NULL) {
- gBS->FreePool (UsbCbiDev);
- }
-
- return EFI_UNSUPPORTED;
- }
- //
- // After installing Usb-Atapi protocol onto this handle
- // it will be called by upper layer drivers such as Fat
- //
- Cbi0ReportStatusCode (
- UsbCbiDev->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE)
- );
-
- Status = gBS->InstallProtocolInterface (
- &ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &UsbCbiDev->UsbAtapiProtocol
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- if (UsbCbiDev != NULL) {
- gBS->FreePool (UsbCbiDev);
- }
-
- return Status;
- }
-
- UsbCbiDev->ControllerNameTable = NULL;
- AddUnicodeString (
- "eng",
- gUsbCbi0ComponentName.SupportedLanguages,
- &UsbCbiDev->ControllerNameTable,
- (CHAR16 *) L"Usb Cbi0 Mass Storage"
- );
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-Cbi0DriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop this driver on ControllerHandle. Support stoping any child handles
- created by this driver.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to stop driver on
- NumberOfChildren - Number of Children in the ChildHandleBuffer
- ChildHandleBuffer - List of handles for the children we need to stop.
-
- Returns:
- EFI_SUCCESS - This driver is removed DeviceHandle
- EFI_UNSUPPORTED - This driver was not removed from this device
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_ATAPI_PROTOCOL *Cbi0AtapiProtocol;
- USB_CBI_DEVICE *UsbCbiDev;
-
- //
- // Get our context back.
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- (VOID **) &Cbi0AtapiProtocol,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- UsbCbiDev = USB_CBI_DEVICE_FROM_THIS (Cbi0AtapiProtocol);
-
- Cbi0ReportStatusCode (
- UsbCbiDev->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE)
- );
-
- //
- // Uninstall protocol
- //
- Status = gBS->UninstallProtocolInterface (
- ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- &UsbCbiDev->UsbAtapiProtocol
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- //
- // Free all allocated resources
- //
- if (UsbCbiDev->ControllerNameTable) {
- FreeUnicodeStringTable (UsbCbiDev->ControllerNameTable);
- }
-
- gBS->FreePool (UsbCbiDev);
-
- return Status;
-}
-
-
-STATIC
-EFI_STATUS
-Cbi0RecoveryReset (
- IN USB_CBI_DEVICE *UsbCbiDev
- )
-/*++
-
-Routine Description:
-
- Cbi0 Recovery Reset routine
-
-Arguments:
-
- UsbCbiDev - Cbi0RecoveryReset
-
-Returns:
-
- EFI_SUCCESS - Success
-
---*/
-{
- UINT8 ResetCommand[12];
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 EndpointAddress;
- UINT32 Result;
- UINT16 Timeout;
-
- UsbIo = UsbCbiDev->UsbIo;
-
- Cbi0ReportStatusCode (
- UsbCbiDev->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_RESET)
- );
- //
- // CBI reset command protocol
- //
- SetMem (ResetCommand, sizeof (ResetCommand), 0xff);
- ResetCommand[0] = 0x1d;
- ResetCommand[1] = 0x04;
-
- //
- // (in millisecond unit)
- //
- Timeout = STALL_1_SECOND;
-
- Status = Cbi0AtapiCommand (
- &UsbCbiDev->UsbAtapiProtocol,
- ResetCommand,
- 12,
- NULL,
- 0,
- EfiUsbNoData,
- Timeout
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->Stall (100 * 1000);
- //
- // clear bulk in endpoint stall feature
- //
- EndpointAddress = UsbCbiDev->BulkInEndpointDescriptor.EndpointAddress;
- Status = UsbClearEndpointHalt (
- UsbIo,
- EndpointAddress,
- &Result
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // clear bulk out endpoint stall feature
- //
- EndpointAddress = UsbCbiDev->BulkOutEndpointDescriptor.EndpointAddress;
- Status = UsbClearEndpointHalt (
- UsbIo,
- EndpointAddress,
- &Result
- );
- //
- // according to CBI spec, no need to clear interrupt endpoint feature.
- //
- return Status;
-}
-
-STATIC
-EFI_STATUS
-Cbi0CommandPhase (
- IN USB_CBI_DEVICE *UsbCbiDev,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN UINT16 Timeout
- )
-/*++
-
- Routine Description:
- Send ATAPI command through CBI0 interface.
-
- Arguments:
- UsbCbiDev - USB_CBI_DEVICE
- Command - Command to send
- CommandSize - Command size
- Timeout - Time out value in milliseconds
- Returns:
- EFI_SUCCESS - Success
- EFI_DEVICE_ERROR - Fail
- Others
-
---*/
-{
- EFI_STATUS Status;
- UINT32 Result;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_DEVICE_REQUEST Request;
-
- UsbIo = UsbCbiDev->UsbIo;
-
- ZeroMem (&Request, sizeof (EFI_USB_DEVICE_REQUEST));
-
- //
- // Device request see CBI specification
- //
- Request.RequestType = 0x21;
- Request.Request = 0x00;
- Request.Value = 0;
- Request.Index = 0;
- Request.Length = CommandSize;
-
- Status = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataOut,
- Timeout,
- Command,
- CommandSize,
- &Result
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-Cbi0DataPhase (
- IN USB_CBI_DEVICE *UsbCbiDev,
- IN UINT32 *DataSize,
- IN OUT VOID *DataBuffer,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 Timeout
- )
-/*++
-
- Routine Description:
- Get/Send Data through CBI0 interface
-
- Arguments:
- UsbCbiDev - USB_CBI_DEVICE
- DataSize - Data size
- DataBuffer - Data buffer
- Direction - IN/OUT/NODATA
- Timeout - Time out value in milliseconds
- Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 EndpointAddress;
- UINTN Remain;
- UINTN Increment;
- UINT32 MaxPacketLength;
- UINT8 *BufferPtr;
- UINT32 Result;
- UINTN TransferredSize;
-
- UsbIo = UsbCbiDev->UsbIo;
-
- Remain = *DataSize;
- BufferPtr = (UINT8 *) DataBuffer;
- TransferredSize = 0;
- //
- // retrieve the the max packet length of the given endpoint
- //
- if (Direction == EfiUsbDataIn) {
- MaxPacketLength = UsbCbiDev->BulkInEndpointDescriptor.MaxPacketSize;
- EndpointAddress = UsbCbiDev->BulkInEndpointDescriptor.EndpointAddress;
- } else {
- MaxPacketLength = UsbCbiDev->BulkOutEndpointDescriptor.MaxPacketSize;
- EndpointAddress = UsbCbiDev->BulkOutEndpointDescriptor.EndpointAddress;
- }
-
- while (Remain > 0) {
-
- if (Remain > 16 * MaxPacketLength) {
- Increment = 16 * MaxPacketLength;
- } else {
- Increment = Remain;
- }
-
- Status = UsbIo->UsbBulkTransfer (
- UsbIo,
- EndpointAddress,
- BufferPtr,
- &Increment,
- Timeout,
- &Result
- );
- TransferredSize += Increment;
-
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- BufferPtr += Increment;
- Remain -= Increment;
- }
-
- return EFI_SUCCESS;
-
-ErrorExit:
-
- if (Direction == EfiUsbDataIn) {
- Cbi0ReportStatusCode (
- UsbCbiDev->DevicePath,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_INPUT_ERROR)
- );
- } else {
- Cbi0ReportStatusCode (
- UsbCbiDev->DevicePath,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_OUTPUT_ERROR)
- );
- }
-
- if ((Result & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) {
- Status = Cbi0RecoveryReset (UsbCbiDev);
- }
-
- *DataSize = (UINT32) TransferredSize;
- return Status;
-}
-
-STATIC
-EFI_STATUS
-Cbi0StatusPhase (
- IN USB_CBI_DEVICE *UsbCbiDev,
- OUT INTERRUPT_DATA_BLOCK *InterruptDataBlock,
- IN UINT16 Timeout
- )
-/*++
-
- Routine Description:
- Get transfer status through BOT interface
-
- Arguments:
- UsbCbiDev - USB_CBI_DEVICE
- InterruptDataBlock - Interrupt Data Block for interrupt transfer
- Timeout - Time out value in milliseconds
- Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- UINT8 EndpointAddress;
- UINTN InterruptDataBlockLength;
- UINT32 Result;
- EFI_STATUS Status;
-
- ZeroMem (InterruptDataBlock, sizeof (INTERRUPT_DATA_BLOCK));
-
- EndpointAddress = UsbCbiDev->InterruptEndpointDescriptor.EndpointAddress;
- InterruptDataBlockLength = sizeof (INTERRUPT_DATA_BLOCK);
-
- Status = UsbCbiDev->UsbIo->UsbSyncInterruptTransfer (
- UsbCbiDev->UsbIo,
- EndpointAddress,
- InterruptDataBlock,
- &InterruptDataBlockLength,
- Timeout,
- &Result
- );
- if (EFI_ERROR (Status)) {
- if ((Result & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) {
- //
- // just endpoint stall happens
- //
- UsbClearEndpointHalt (
- UsbCbiDev->UsbIo,
- EndpointAddress,
- &Result
- );
- gBS->Stall (100 * 1000);
- }
-
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-//
-// Cbi0 Atapi Protocol Implementation
-//
-STATIC
-EFI_STATUS
-EFIAPI
-Cbi0MassStorageReset (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset CBI Devices
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - TRUE if we need to do strictly reset.
-
- Returns:
- EFI_SUCCESS - Command succeeded.
- EFI_DEVICE_ERROR - Command failed.
-
---*/
-{
- EFI_STATUS Status;
- USB_CBI_DEVICE *UsbCbiDev;
-
- UsbCbiDev = USB_CBI_DEVICE_FROM_THIS (This);
-
- if (ExtendedVerification) {
- //
- // UsbIo->UsbPortReset (UsbIo);
- //
- }
-
- Status = Cbi0RecoveryReset (UsbCbiDev);
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-Cbi0AtapiCommand (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN VOID *DataBuffer,
- IN UINT32 BufferLength,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 TimeOutInMilliSeconds
- )
-/*++
-
- Routine Description:
- Send ATAPI command using BOT protocol.
-
- Arguments:
- This - Protocol instance pointer.
- Command - Command buffer
- CommandSize - Size of Command Buffer
- DataBuffer - Data buffer
- BufferLength - Length of Data buffer
- Direction - Data direction of this command
- TimeOutInMilliSeconds - Timeout value in ms
-
- Returns:
- EFI_SUCCESS - Command succeeded.
- EFI_DEVICE_ERROR - Command failed.
- EFI_INVALID_PARAMETER - Invalidate parameter
---*/
-{
- EFI_STATUS Status;
- USB_CBI_DEVICE *UsbCbiDev;
- UINT32 BufferSize;
- INTERRUPT_DATA_BLOCK InterruptDataBlock;
- EFI_STATUS DataPhaseStatus;
-
- if (Direction != EfiUsbNoData) {
- if (DataBuffer == NULL || BufferLength == 0) {
- return EFI_INVALID_PARAMETER;
- }
- }
-
- DataPhaseStatus = EFI_SUCCESS;
- //
- // Get the context
- //
- UsbCbiDev = USB_CBI_DEVICE_FROM_THIS (This);
-
- //
- // First send ATAPI command through Cbi
- //
- Status = Cbi0CommandPhase (
- UsbCbiDev,
- Command,
- CommandSize,
- TimeOutInMilliSeconds
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Send/Get Data if there is a Data Stage
- //
- switch (Direction) {
-
- case EfiUsbDataIn:
- case EfiUsbDataOut:
- BufferSize = BufferLength;
-
- DataPhaseStatus = Cbi0DataPhase (
- UsbCbiDev,
- &BufferSize,
- DataBuffer,
- Direction,
- TimeOutInMilliSeconds
- );
- break;
-
- case EfiUsbNoData:
- break;
- }
-
- if (EFI_ERROR (DataPhaseStatus)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Status Phase
- //
- Status = Cbi0StatusPhase (
- UsbCbiDev,
- &InterruptDataBlock,
- TimeOutInMilliSeconds
- );
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- if (This->CommandProtocol != EFI_USB_SUBCLASS_UFI) {
-
- if (InterruptDataBlock.bType == 0) {
- //
- // indicates command completion
- //
- switch (InterruptDataBlock.bValue & 0x03) {
-
- case 0:
- Status = EFI_SUCCESS;
- break;
-
- case 1:
- Status = EFI_DEVICE_ERROR;
- break;
-
- case 2:
- Status = Cbi0RecoveryReset (UsbCbiDev);
- if (EFI_ERROR (Status)) {
- UsbCbiDev->UsbIo->UsbPortReset (UsbCbiDev->UsbIo);
- }
-
- Status = EFI_DEVICE_ERROR;
- break;
-
- case 3:
- Status = EFI_DEVICE_ERROR;
- }
- } else {
- Status = DataPhaseStatus;
- }
-
- } else {
- //
- // UFI device, InterruptDataBlock.bType: ASC (Additional Sense Code)
- // InterruptDataBlock.bValue: ASCQ (Additional Snese Code Qualifier)
- //
- Status = DataPhaseStatus;
- }
-
- return Status;
-}
-
-STATIC
-VOID
-Cbi0ReportStatusCode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value
- )
-/*++
-
- Routine Description:
- Report Status Code in Usb Cbi0 Driver
-
- Arguments:
- DevicePath - Use this to get Device Path
- CodeType - Status Code Type
- CodeValue - Status Code Value
-
- Returns:
- None
-
---*/
-{
-
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- CodeType,
- Value,
- DevicePath
- );
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/ComponentName.c b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/ComponentName.c
deleted file mode 100644
index 87ff7d2..0000000
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/ComponentName.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "cbi.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUsbCbi0ComponentName = {
- UsbCbi0ComponentNameGetDriverName,
- UsbCbi0ComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mUsbCbi0DriverNameTable[] = {
- { "eng", (CHAR16 *) L"Usb Cbi0 Mass Storage Driver" },
- { NULL , NULL }
-};
-
-
-EFI_STATUS
-EFIAPI
-UsbCbi0ComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUsbCbi0ComponentName.SupportedLanguages,
- mUsbCbi0DriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UsbCbi0ComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- USB_CBI_DEVICE *UsbCbiDev;
- EFI_USB_ATAPI_PROTOCOL *UsbAtapi;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUsbCbi0DriverBinding.DriverBindingHandle,
- &gEfiUsbIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the device context
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- (VOID **) &UsbAtapi,
- gUsbCbi0DriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- UsbCbiDev = USB_CBI_DEVICE_FROM_THIS (UsbAtapi);
-
- return LookupUnicodeString (
- Language,
- gUsbCbi0ComponentName.SupportedLanguages,
- UsbCbiDev->ControllerNameTable,
- ControllerName
- );
-
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/UsbCbi0.msa b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/UsbCbi0.msa
deleted file mode 100644
index ad8e9f2..0000000
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/UsbCbi0.msa
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>UsbCbi0</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>A3527D16-E6CC-42f5-BADB-BF3DE177742B</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for UsbCbi0 module</Abstract>
- <Description>This module provides support for USB Control-Bulk-Interrupt Protocol with command completion interrupt</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>UsbCbi0</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkUsbLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>cbi.h</Filename>
- <Filename>Cbi0.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiUsbIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiUsbAtapiProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gUsbCbi0DriverBinding</DriverBinding>
- <ComponentName>gUsbCbi0ComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/cbi.h b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/cbi.h
deleted file mode 100644
index d312176..0000000
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/cbi.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- cbi.h
-
-Abstract:
-
- USB CBI transportation protocol definitions.
---*/
-
-#ifndef _CBI_H
-#define _CBI_H
-
-
-#include <IndustryStandard/Usb.h>
-
-#define bit(a) (1 << (a))
-
-#define MASS_STORAGE_CLASS 0x08
-#define CBI0_INTERFACE_PROTOCOL 0x00
-#define CBI1_INTERFACE_PROTOCOL 0x01
-
-//
-// in millisecond unit
-//
-#define STALL_1_SECOND 1000
-
-#pragma pack(1)
-//
-// Data block definition for transportation through interrupt endpoint
-//
-typedef struct {
- UINT8 bType;
- UINT8 bValue;
-} INTERRUPT_DATA_BLOCK;
-
-#pragma pack()
-
-#define USB_CBI_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('u', 'c', 'b', 'i')
-
-//
-// Device structure for CBI, interrupt endpoint may be not used in
-// CBI1 Protocol
-//
-typedef struct {
- UINT32 Signature;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_USB_ATAPI_PROTOCOL UsbAtapiProtocol;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
- EFI_USB_ENDPOINT_DESCRIPTOR BulkInEndpointDescriptor;
- EFI_USB_ENDPOINT_DESCRIPTOR BulkOutEndpointDescriptor;
- EFI_USB_ENDPOINT_DESCRIPTOR InterruptEndpointDescriptor;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} USB_CBI_DEVICE;
-
-#define USB_CBI_DEVICE_FROM_THIS(a) \
- CR(a, USB_CBI_DEVICE, UsbAtapiProtocol, USB_CBI_DEVICE_SIGNATURE)
-
-extern EFI_COMPONENT_NAME_PROTOCOL gUsbCbi0ComponentName;
-extern EFI_DRIVER_BINDING_PROTOCOL gUsbCbi0DriverBinding;
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UsbCbi0ComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UsbCbi0ComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/ComponentName.c b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/ComponentName.c
deleted file mode 100644
index 316c7f4..0000000
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/ComponentName.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "cbi.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUsbCbi1ComponentName = {
- UsbCbi1ComponentNameGetDriverName,
- UsbCbi1ComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mUsbCbi1DriverNameTable[] = {
- { "eng", (CHAR16 *) L"Usb Cbi1 Mass Storage Driver" },
- { NULL , NULL }
-};
-
-
-EFI_STATUS
-EFIAPI
-UsbCbi1ComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUsbCbi1ComponentName.SupportedLanguages,
- mUsbCbi1DriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UsbCbi1ComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- USB_CBI_DEVICE *UsbCbiDev;
- EFI_USB_ATAPI_PROTOCOL *UsbAtapi;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Make sure this driver is currently managing ControllerHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gUsbCbi1DriverBinding.DriverBindingHandle,
- &gEfiUsbIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get the device context
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- (VOID **) &UsbAtapi,
- gUsbCbi1DriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- UsbCbiDev = USB_CBI_DEVICE_FROM_THIS (UsbAtapi);
-
- return LookupUnicodeString (
- Language,
- gUsbCbi1ComponentName.SupportedLanguages,
- UsbCbiDev->ControllerNameTable,
- ControllerName
- );
-
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/UsbCbi1.msa b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/UsbCbi1.msa
deleted file mode 100644
index 2a0a86b..0000000
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/UsbCbi1.msa
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>UsbCbi1</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>B40612B2-A063-11d4-9A3A-0090273FC14D</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for UsbCbi1 module</Abstract>
- <Description>This module provides support for USB Control-Bulk-Interrupt Protocol with no command completion interrupt</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>UsbCbi1</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkUsbLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>cbi.h</Filename>
- <Filename>cbi1.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiUsbIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiUsbAtapiProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gUsbCbi1DriverBinding</DriverBinding>
- <ComponentName>gUsbCbi1ComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi.h b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi.h
deleted file mode 100644
index 77daa1a..0000000
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- cbi.h
-
-Abstract:
-
- USB CBI transportation protocol definitions.
---*/
-
-#ifndef _CBI_H
-#define _CBI_H
-
-
-#include <IndustryStandard/Usb.h>
-
-#define bit(a) (1 << (a))
-
-#define MASS_STORAGE_CLASS 0x08
-#define CBI0_INTERFACE_PROTOCOL 0x00
-#define CBI1_INTERFACE_PROTOCOL 0x01
-
-//
-// in millisecond unit
-//
-#define STALL_1_SECOND 1000
-
-#pragma pack(1)
-//
-// Data block definition for transportation through interrupt endpoint
-//
-typedef struct {
- UINT8 bType;
- UINT8 bValue;
-} INTERRUPT_DATA_BLOCK;
-
-#pragma pack()
-
-#define USB_CBI_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('u', 'c', 'b', 'i')
-
-//
-// Device structure for CBI, interrupt endpoint may be not used in
-// CBI1 Protocol
-//
-typedef struct {
- UINT32 Signature;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_USB_ATAPI_PROTOCOL UsbAtapiProtocol;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
- EFI_USB_ENDPOINT_DESCRIPTOR BulkInEndpointDescriptor;
- EFI_USB_ENDPOINT_DESCRIPTOR BulkOutEndpointDescriptor;
- EFI_USB_ENDPOINT_DESCRIPTOR InterruptEndpointDescriptor;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} USB_CBI_DEVICE;
-
-#define USB_CBI_DEVICE_FROM_THIS(a) \
- CR(a, USB_CBI_DEVICE, UsbAtapiProtocol, USB_CBI_DEVICE_SIGNATURE)
-
-extern EFI_DRIVER_BINDING_PROTOCOL gUsbCbi1DriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUsbCbi1ComponentName;
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UsbCbi1ComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UsbCbi1ComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c
deleted file mode 100644
index d98d022..0000000
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c
+++ /dev/null
@@ -1,850 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- cbi1.c
-
-Abstract:
- cbi1 transportation protocol implementation files
-
---*/
-
-#include "cbi.h"
-
-//
-// CBI Function prototypes
-//
-STATIC
-EFI_STATUS
-CBI1CommandPhase (
- IN USB_CBI_DEVICE *UsbCbiDev,
- IN VOID *Command,
- IN UINT8 CommandSize,
- OUT UINT32 *Result
- );
-
-STATIC
-EFI_STATUS
-CBI1DataPhase (
- IN USB_CBI_DEVICE *UsbCbiDev,
- IN UINT32 DataSize,
- IN OUT VOID *DataBuffer,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 Timeout,
- OUT UINT32 *Result
- );
-
-//
-// USB Atapi implementation
-//
-STATIC
-EFI_STATUS
-EFIAPI
-CBI1AtapiCommand (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN VOID *DataBuffer,
- IN UINT32 BufferLength,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 TimeOutInMilliSeconds
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-CBI1MassStorageReset (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-//
-// CBI1 Driver Binding Protocol
-//
-STATIC
-EFI_STATUS
-EFIAPI
-CBI1DriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-CBI1DriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-CBI1DriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-STATIC
-VOID
-Cbi1ReportStatusCode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value
- );
-
-
-EFI_DRIVER_BINDING_PROTOCOL gUsbCbi1DriverBinding = {
- CBI1DriverBindingSupported,
- CBI1DriverBindingStart,
- CBI1DriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-STATIC EFI_USB_ATAPI_PROTOCOL CBI1AtapiProtocol = {
- CBI1AtapiCommand,
- CBI1MassStorageReset,
- 0
-};
-
-//
-// CBI1 Driver Binding implementation
-//
-STATIC
-EFI_STATUS
-EFIAPI
-CBI1DriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- than contains a BlockIo and DiskIo protocol can be supported.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device
- EFI_ALREADY_STARTED - This driver is already running on this device
- other - This driver does not support this device
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
-
- //
- // Check if the Controller supports USB IO protocol
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the Controller interface descriptor
- //
- Status = UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &InterfaceDescriptor
- );
- if (EFI_ERROR (Status)) {
- goto Exit;
- }
- //
- // Bug here: just let Vendor specific CBI protocol get supported
- //
- if (!((InterfaceDescriptor.InterfaceClass == 0xFF) &&
- (InterfaceDescriptor.InterfaceProtocol == 0))) {
- Status = EFI_UNSUPPORTED;
- goto Exit;
- }
-
-Exit:
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
-
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-CBI1DriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Start this driver on ControllerHandle by opening a Block IO and Disk IO
- protocol, reading Device Path, and creating a child handle with a
- Disk IO and device path protocol.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to bind driver to
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver is added to DeviceHandle
- EFI_ALREADY_STARTED - This driver is already running on DeviceHandle
- other - This driver does not support this device
-
---*/
-{
- USB_CBI_DEVICE *UsbCbiDev;
- UINT8 Index;
- EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- BOOLEAN Found;
-
- Found = FALSE;
- //
- // Check if the Controller supports USB IO protocol
- //
- UsbCbiDev = NULL;
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the controller interface descriptor
- //
- Status = UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &InterfaceDescriptor
- );
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- CBI1AtapiProtocol.CommandProtocol = InterfaceDescriptor.InterfaceSubClass;
-
- UsbCbiDev = AllocateZeroPool (sizeof (USB_CBI_DEVICE));
- if (UsbCbiDev == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
-
- UsbCbiDev->Signature = USB_CBI_DEVICE_SIGNATURE;
- UsbCbiDev->UsbIo = UsbIo;
- CopyMem (&UsbCbiDev->InterfaceDescriptor, &InterfaceDescriptor, sizeof (InterfaceDescriptor));
- CopyMem (&UsbCbiDev->UsbAtapiProtocol , &CBI1AtapiProtocol, sizeof (CBI1AtapiProtocol));
-
- //
- // Get the Device Path Protocol on Controller's handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &UsbCbiDev->DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- for (Index = 0; Index < InterfaceDescriptor.NumEndpoints; Index++) {
- UsbIo->UsbGetEndpointDescriptor (
- UsbIo,
- Index,
- &EndpointDescriptor
- );
-
- //
- // We parse bulk endpoint
- //
- if (EndpointDescriptor.Attributes == 0x02) {
- if (EndpointDescriptor.EndpointAddress & 0x80) {
- CopyMem (&UsbCbiDev->BulkInEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
- } else {
- CopyMem (&UsbCbiDev->BulkOutEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
- }
-
- Found = TRUE;
- }
- //
- // We parse interrupt endpoint
- //
- if (EndpointDescriptor.Attributes == 0x03) {
- CopyMem (&UsbCbiDev->InterruptEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
- Found = TRUE;
- }
-
- }
- //
- // Double check we have these
- //
- if (!Found) {
- goto ErrorExit;
- }
- //
- // After installing Usb-Atapi protocol onto this handle
- // it will be called by upper layer drivers such as Fat
- //
- Cbi1ReportStatusCode (
- UsbCbiDev->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE)
- );
-
- Status = gBS->InstallProtocolInterface (
- &ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &UsbCbiDev->UsbAtapiProtocol
- );
-
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- UsbCbiDev->ControllerNameTable = NULL;
- AddUnicodeString (
- "eng",
- gUsbCbi1ComponentName.SupportedLanguages,
- &UsbCbiDev->ControllerNameTable,
- (CHAR16 *) L"Usb Cbi1 Mass Storage"
- );
-
- return EFI_SUCCESS;
-
-ErrorExit:
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- if (UsbCbiDev != NULL) {
- gBS->FreePool (UsbCbiDev);
- }
-
- return Status;
-
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-CBI1DriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop this driver on ControllerHandle. Support stoping any child handles
- created by this driver.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to stop driver on
- NumberOfChildren - Number of Children in the ChildHandleBuffer
- ChildHandleBuffer - List of handles for the children we need to stop.
-
- Returns:
- EFI_SUCCESS - This driver is removed DeviceHandle
- EFI_UNSUPPORTED - Can't open the gEfiUsbAtapiProtocolGuid protocol
- other - This driver was not removed from this device
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_ATAPI_PROTOCOL *CBI1AtapiProtocol;
- USB_CBI_DEVICE *UsbCbiDev;
-
- //
- // Get our context back.
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- (VOID **) &CBI1AtapiProtocol,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- UsbCbiDev = USB_CBI_DEVICE_FROM_THIS (CBI1AtapiProtocol);
-
- Cbi1ReportStatusCode (
- UsbCbiDev->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE)
- );
-
- Status = gBS->UninstallProtocolInterface (
- ControllerHandle,
- &gEfiUsbAtapiProtocolGuid,
- &UsbCbiDev->UsbAtapiProtocol
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- gBS->FreePool (UsbCbiDev);
-
- return Status;
-
-}
-//
-// CBI1 command
-//
-STATIC
-EFI_STATUS
-CBI1CommandPhase (
- IN USB_CBI_DEVICE *UsbCbiDev,
- IN VOID *Command,
- IN UINT8 CommandSize,
- OUT UINT32 *Result
- )
-/*++
-
- Routine Description:
- In order to make consistence, CBI transportation protocol does only use
- the first 3 parameters. Other parameters are not used here.
-
- Arguments:
- UsbCbiDev - USB_CBI_DEVICE
- Command - Command to send
- CommandSize - Command Size
- Result - Result to return
-
- Returns:
- EFI_SUCCESS - This driver is removed DeviceHandle
- other - This driver was not removed from this device
---*/
-{
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_DEVICE_REQUEST Request;
- UINT32 TimeOutInMilliSeconds;
-
- UsbIo = UsbCbiDev->UsbIo;
-
- ZeroMem (&Request, sizeof (EFI_USB_DEVICE_REQUEST));
-
- //
- // Device request see CBI specification
- //
- Request.RequestType = 0x21;
- Request.Length = CommandSize;
-
- TimeOutInMilliSeconds = 1000;
-
- Status = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataOut,
- TimeOutInMilliSeconds,
- Command,
- CommandSize,
- Result
- );
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-CBI1DataPhase (
- IN USB_CBI_DEVICE *UsbCbiDev,
- IN UINT32 DataSize,
- IN OUT VOID *DataBuffer,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 Timeout,
- OUT UINT32 *Result
- )
-/*++
-
-Routine Description:
-
- CBI1 Data Phase
-
-Arguments:
-
- UsbCbiDev - USB_CBI_DEVICE
- DataSize - Data Size
- DataBuffer - Data Buffer
- Direction - IN/OUT/NODATA
- Timeout - Time out value in milliseconds
- Result - Transfer result
-
-Returns:
-
- EFI_SUCCESS - Success
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 EndpointAddr;
- UINTN Remain;
- UINTN Increment;
- UINT32 MaxPacketLen;
- UINT8 *BufferPtr;
-
- UsbIo = UsbCbiDev->UsbIo;
-
- Remain = DataSize;
- BufferPtr = (UINT8 *) DataBuffer;
-
- //
- // retrieve the the max packet length of the given endpoint
- //
- if (Direction == EfiUsbDataIn) {
- MaxPacketLen = (UsbCbiDev->BulkInEndpointDescriptor).MaxPacketSize;
- EndpointAddr = (UsbCbiDev->BulkInEndpointDescriptor).EndpointAddress;
- } else {
- MaxPacketLen = (UsbCbiDev->BulkOutEndpointDescriptor).MaxPacketSize;
- EndpointAddr = (UsbCbiDev->BulkOutEndpointDescriptor).EndpointAddress;
- }
-
- while (Remain > 0) {
- //
- // Using 15 packets to aVOID Bitstuff error
- //
- if (Remain > 15 * MaxPacketLen) {
- Increment = 15 * MaxPacketLen;
- } else {
- Increment = Remain;
- }
-
- Status = UsbIo->UsbBulkTransfer (
- UsbIo,
- EndpointAddr,
- BufferPtr,
- &Increment,
- Timeout,
- Result
- );
-
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- BufferPtr += Increment;
- Remain -= Increment;
- }
-
- return EFI_SUCCESS;
-
-ErrorExit:
-
- if (Direction == EfiUsbDataIn) {
- Cbi1ReportStatusCode (
- UsbCbiDev->DevicePath,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_INPUT_ERROR)
- );
- } else {
- Cbi1ReportStatusCode (
- UsbCbiDev->DevicePath,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_EC_OUTPUT_ERROR)
- );
- }
-
- if (((*Result) & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) {
- //
- // just endpoint stall happens
- //
- UsbClearEndpointHalt (
- UsbIo,
- EndpointAddr,
- Result
- );
- }
-
- return Status;
-}
-//
-// CBI1 USB ATAPI Protocol
-//
-STATIC
-EFI_STATUS
-EFIAPI
-CBI1MassStorageReset (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset CBI Devices
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - TRUE if we need to do strictly reset.
-
- Returns:
- EFI_SUCCESS - Command succeeded.
- EFI_DEVICE_ERROR - Command failed.
-
---*/
-{
- UINT8 ResetCommand[12];
- EFI_USB_IO_PROTOCOL *UsbIo;
- USB_CBI_DEVICE *UsbCbiDev;
- UINT8 EndpointAddr;
- UINT32 Result;
-
- UsbCbiDev = USB_CBI_DEVICE_FROM_THIS (This);
- UsbIo = UsbCbiDev->UsbIo;
-
- Cbi1ReportStatusCode (
- UsbCbiDev->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_RESET)
- );
-
- if (ExtendedVerification) {
- UsbIo->UsbPortReset (UsbIo);
- }
- //
- // CBI reset command protocol
- //
- SetMem (ResetCommand, sizeof (ResetCommand), 0xff);
- ResetCommand[0] = 0x1d;
- ResetCommand[1] = 0x04;
-
- CBI1CommandPhase (
- UsbCbiDev,
- ResetCommand,
- 12,
- &Result
- );
-
- //
- // clear bulk in endpoint stall feature
- //
- EndpointAddr = UsbCbiDev->BulkInEndpointDescriptor.EndpointAddress;
- UsbClearEndpointHalt (
- UsbIo,
- EndpointAddr,
- &Result
- );
-
- //
- // clear bulk out endpoint stall feature
- //
- EndpointAddr = UsbCbiDev->BulkOutEndpointDescriptor.EndpointAddress;
- UsbClearEndpointHalt (
- UsbIo,
- EndpointAddr,
- &Result
- );
-
- return EFI_SUCCESS;
-
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-CBI1AtapiCommand (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN VOID *DataBuffer,
- IN UINT32 BufferLength,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 TimeOutInMilliSeconds
- )
-/*++
-
- Routine Description:
- Send ATAPI command using CBI1 protocol.
-
- Arguments:
- This - Protocol instance pointer.
- Command - Command buffer
- CommandSize - Size of Command Buffer
- DataBuffer - Data buffer
- BufferLength - Length of Data buffer
- Direction - Data direction of this command
- TimeOutInMilliSeconds - Timeout value in ms
-
- Returns:
- EFI_SUCCESS - Command succeeded.
- EFI_DEVICE_ERROR - Command failed.
-
---*/
-{
- EFI_STATUS Status;
- USB_CBI_DEVICE *UsbCbiDev;
- UINT32 Result;
- UINT8 Index;
- UINT8 MaxRetryNum;
-
- UsbCbiDev = USB_CBI_DEVICE_FROM_THIS (This);
-
- MaxRetryNum = 3;
-
- for (Index = 0; Index < MaxRetryNum; Index++) {
-
- //
- // First send ATAPI command through CBI1
- //
- Status = CBI1CommandPhase (
- UsbCbiDev,
- Command,
- CommandSize,
- &Result
- );
- if (EFI_ERROR (Status)) {
-
- switch (Result) {
-
- case EFI_USB_NOERROR:
- case EFI_USB_ERR_STALL:
- case EFI_USB_ERR_SYSTEM:
- return EFI_DEVICE_ERROR;
-
- default:
- continue;
- break;
- }
- } else {
- break;
- }
- }
-
- if (Index == MaxRetryNum) {
- return EFI_DEVICE_ERROR;
- }
-
- for (Index = 0; Index < MaxRetryNum; Index++) {
- //
- // Send/Get Data if there is a Data Stage
- //
- switch (Direction) {
-
- case EfiUsbDataIn:
- case EfiUsbDataOut:
- Status = CBI1DataPhase (
- UsbCbiDev,
- BufferLength,
- DataBuffer,
- Direction,
- TimeOutInMilliSeconds,
- &Result
- );
-
- if (EFI_ERROR (Status)) {
- switch (Result) {
-
- case EFI_USB_NOERROR:
- case EFI_USB_ERR_STALL:
- case EFI_USB_ERR_SYSTEM:
- return EFI_DEVICE_ERROR;
-
- default:
- continue;
- break;
- }
-
- } else {
-
- return EFI_SUCCESS;
- }
- break;
-
- case EfiUsbNoData:
- return EFI_SUCCESS;
- }
- }
- //
- // If goes here, means met error.
- //
- return EFI_DEVICE_ERROR;
-}
-
-STATIC
-VOID
-Cbi1ReportStatusCode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value
- )
-/*++
-
- Routine Description:
- Report Status Code in Usb Cbi1 Driver
-
- Arguments:
- DevicePath - Use this to get Device Path
- CodeType - Status Code Type
- CodeValue - Status Code Value
-
- Returns:
- None
-
---*/
-{
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- CodeType,
- Value,
- DevicePath
- );
-
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/ComponentName.c b/EdkModulePkg/Bus/Usb/UsbKb/Dxe/ComponentName.c
deleted file mode 100644
index 71a715f..0000000
--- a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/ComponentName.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "keyboard.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUsbKeyboardComponentName = {
- UsbKeyboardComponentNameGetDriverName,
- UsbKeyboardComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mUsbKeyboardDriverNameTable[] = {
- { "eng", (CHAR16 *) L"Usb Keyboard Driver" },
- { NULL , NULL }
-};
-
-
-EFI_STATUS
-EFIAPI
-UsbKeyboardComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUsbKeyboardComponentName.SupportedLanguages,
- mUsbKeyboardDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UsbKeyboardComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- USB_KB_DEV *UsbKbDev;
- EFI_SIMPLE_TEXT_IN_PROTOCOL *SimpleTxtIn;
- EFI_USB_IO_PROTOCOL *UsbIoProtocol;
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Check Controller's handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIoProtocol,
- gUsbKeyboardDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- gUsbKeyboardDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status != EFI_ALREADY_STARTED) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get the device context
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleTextInProtocolGuid,
- (VOID **) &SimpleTxtIn,
- gUsbKeyboardDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- UsbKbDev = USB_KB_DEV_FROM_THIS (SimpleTxtIn);
-
- return LookupUnicodeString (
- Language,
- gUsbKeyboardComponentName.SupportedLanguages,
- UsbKbDev->ControllerNameTable,
- ControllerName
- );
-
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/UsbKb.msa b/EdkModulePkg/Bus/Usb/UsbKb/Dxe/UsbKb.msa
deleted file mode 100644
index fa86077..0000000
--- a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/UsbKb.msa
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>UsbKb</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>2D2E62CF-9ECF-43b7-8219-94E7FC713DFE</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for UsbKb module</Abstract>
- <Description>This module provides support for USB Keyboard</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>UsbKb</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkUsbLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>efikey.h</Filename>
- <Filename>keyboard.h</Filename>
- <Filename>efikey.c</Filename>
- <Filename>keyboard.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiUsbIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiHotPlugDeviceGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gUsbKeyboardDriverBinding</DriverBinding>
- <ComponentName>gUsbKeyboardComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c b/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c
deleted file mode 100644
index 069e31d..0000000
--- a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c
+++ /dev/null
@@ -1,730 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EfiKey.c
-
-Abstract:
-
- USB Keyboard Driver
-
-Revision History
-
---*/
-
-#include "efikey.h"
-#include "keyboard.h"
-
-//
-// Simple Text In Protocol Interface
-//
-STATIC
-EFI_STATUS
-EFIAPI
-USBKeyboardReset (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-USBKeyboardReadKeyStroke (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- );
-
-STATIC
-VOID
-EFIAPI
-USBKeyboardWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-//
-// Helper functions
-//
-STATIC
-EFI_STATUS
-USBKeyboardCheckForKey (
- IN USB_KB_DEV *UsbKeyboardDevice
- );
-
-//
-// USB Keyboard Driver Global Variables
-//
-EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding = {
- USBKeyboardDriverBindingSupported,
- USBKeyboardDriverBindingStart,
- USBKeyboardDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-USBKeyboardDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Supported.
-
- Arguments:
- This - EFI_DRIVER_BINDING_PROTOCOL
- Controller - Controller handle
- RemainingDevicePath - EFI_DEVICE_PATH_PROTOCOL
- Returns:
- EFI_STATUS
-
---*/
-{
- EFI_STATUS OpenStatus;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_STATUS Status;
-
- //
- // Check if USB_IO protocol is attached on the controller handle.
- //
- OpenStatus = gBS->OpenProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (OpenStatus)) {
- return OpenStatus;
- }
-
- //
- // Use the USB I/O protocol interface to check whether the Controller is
- // the Keyboard controller that can be managed by this driver.
- //
- Status = EFI_SUCCESS;
-
- if (!IsUSBKeyboard (UsbIo)) {
- Status = EFI_UNSUPPORTED;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-USBKeyboardDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Start.
-
- Arguments:
- This - EFI_DRIVER_BINDING_PROTOCOL
- Controller - Controller handle
- RemainingDevicePath - EFI_DEVICE_PATH_PROTOCOL
- Returns:
- EFI_SUCCESS - Success
- EFI_OUT_OF_RESOURCES - Can't allocate memory
- EFI_UNSUPPORTED - The Start routine fail
---*/
-{
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- USB_KB_DEV *UsbKeyboardDevice;
- UINT8 EndpointNumber;
- EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
- UINT8 Index;
- UINT8 EndpointAddr;
- UINT8 PollingInterval;
- UINT8 PacketSize;
- BOOLEAN Found;
-
- UsbKeyboardDevice = NULL;
- Found = FALSE;
-
- //
- // Open USB_IO Protocol
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- UsbKeyboardDevice = AllocateZeroPool (sizeof (USB_KB_DEV));
- if (UsbKeyboardDevice == NULL) {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Get the Device Path Protocol on Controller's handle
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &UsbKeyboardDevice->DevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (UsbKeyboardDevice);
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
- //
- // Report that the usb keyboard is being enabled
- //
- KbdReportStatusCode (
- UsbKeyboardDevice->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE)
- );
-
- //
- // This is pretty close to keyboard detection, so log progress
- //
- KbdReportStatusCode (
- UsbKeyboardDevice->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_PRESENCE_DETECT)
- );
-
- //
- // Initialize UsbKeyboardDevice
- //
- UsbKeyboardDevice->UsbIo = UsbIo;
-
- //
- // Get interface & endpoint descriptor
- //
- UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &UsbKeyboardDevice->InterfaceDescriptor
- );
-
- EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;
-
- for (Index = 0; Index < EndpointNumber; Index++) {
-
- UsbIo->UsbGetEndpointDescriptor (
- UsbIo,
- Index,
- &EndpointDescriptor
- );
-
- if ((EndpointDescriptor.Attributes & 0x03) == 0x03) {
- //
- // We only care interrupt endpoint here
- //
- CopyMem (&UsbKeyboardDevice->IntEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
- Found = TRUE;
- }
- }
-
- if (!Found) {
- //
- // No interrupt endpoint found, then return unsupported.
- //
- gBS->FreePool (UsbKeyboardDevice);
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return EFI_UNSUPPORTED;
- }
-
- UsbKeyboardDevice->Signature = USB_KB_DEV_SIGNATURE;
- UsbKeyboardDevice->SimpleInput.Reset = USBKeyboardReset;
- UsbKeyboardDevice->SimpleInput.ReadKeyStroke = USBKeyboardReadKeyStroke;
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- USBKeyboardWaitForKey,
- UsbKeyboardDevice,
- &(UsbKeyboardDevice->SimpleInput.WaitForKey)
- );
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (UsbKeyboardDevice);
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
-
- //
- // Install simple txt in protocol interface
- // for the usb keyboard device.
- // Usb keyboard is a hot plug device, and expected to work immediately
- // when plugging into system, so a HotPlugDeviceGuid is installed onto
- // the usb keyboard device handle, to distinguish it from other conventional
- // console devices.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Controller,
- &gEfiSimpleTextInProtocolGuid,
- &UsbKeyboardDevice->SimpleInput,
- &gEfiHotPlugDeviceGuid,
- NULL,
- NULL
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (UsbKeyboardDevice->SimpleInput.WaitForKey);
- gBS->FreePool (UsbKeyboardDevice);
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
-
- //
- // Reset USB Keyboard Device
- //
- Status = UsbKeyboardDevice->SimpleInput.Reset (
- &UsbKeyboardDevice->SimpleInput,
- TRUE
- );
- if (EFI_ERROR (Status)) {
- gBS->UninstallMultipleProtocolInterfaces (
- Controller,
- &gEfiSimpleTextInProtocolGuid,
- &UsbKeyboardDevice->SimpleInput,
- &gEfiHotPlugDeviceGuid,
- NULL,
- NULL
- );
- gBS->CloseEvent (UsbKeyboardDevice->SimpleInput.WaitForKey);
- gBS->FreePool (UsbKeyboardDevice);
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
- //
- // submit async interrupt transfer
- //
- EndpointAddr = UsbKeyboardDevice->IntEndpointDescriptor.EndpointAddress;
- PollingInterval = UsbKeyboardDevice->IntEndpointDescriptor.Interval;
- PacketSize = (UINT8) (UsbKeyboardDevice->IntEndpointDescriptor.MaxPacketSize);
-
- Status = UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- EndpointAddr,
- TRUE,
- PollingInterval,
- PacketSize,
- KeyboardHandler,
- UsbKeyboardDevice
- );
-
- if (EFI_ERROR (Status)) {
-
- gBS->UninstallMultipleProtocolInterfaces (
- Controller,
- &gEfiSimpleTextInProtocolGuid,
- &UsbKeyboardDevice->SimpleInput,
- &gEfiHotPlugDeviceGuid,
- NULL,
- NULL
- );
- gBS->CloseEvent (UsbKeyboardDevice->SimpleInput.WaitForKey);
- gBS->FreePool (UsbKeyboardDevice);
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
-
- UsbKeyboardDevice->ControllerNameTable = NULL;
- AddUnicodeString (
- "eng",
- gUsbKeyboardComponentName.SupportedLanguages,
- &UsbKeyboardDevice->ControllerNameTable,
- (CHAR16 *) L"Generic Usb Keyboard"
- );
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-USBKeyboardDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop.
-
- Arguments:
- This - EFI_DRIVER_BINDING_PROTOCOL
- Controller - Controller handle
- NumberOfChildren - Child handle number
- ChildHandleBuffer - Child handle buffer
- Returns:
- EFI_SUCCESS - Success
- EFI_UNSUPPORTED - Can't support
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_IN_PROTOCOL *SimpleInput;
- USB_KB_DEV *UsbKeyboardDevice;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiSimpleTextInProtocolGuid,
- (VOID **) &SimpleInput,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Get USB_KB_DEV instance.
- //
- UsbKeyboardDevice = USB_KB_DEV_FROM_THIS (SimpleInput);
-
- gBS->CloseProtocol (
- Controller,
- &gEfiSimpleTextInProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- //
- // Uninstall the Asyn Interrupt Transfer from this device
- // will disable the key data input from this device
- //
- KbdReportStatusCode (
- UsbKeyboardDevice->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DISABLE)
- );
-
- //
- // Destroy asynchronous interrupt transfer
- //
- UsbKeyboardDevice->UsbIo->UsbAsyncInterruptTransfer (
- UsbKeyboardDevice->UsbIo,
- UsbKeyboardDevice->IntEndpointDescriptor.EndpointAddress,
- FALSE,
- UsbKeyboardDevice->IntEndpointDescriptor.Interval,
- 0,
- NULL,
- NULL
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Controller,
- &gEfiSimpleTextInProtocolGuid,
- &UsbKeyboardDevice->SimpleInput,
- &gEfiHotPlugDeviceGuid,
- NULL,
- NULL
- );
- //
- // free all the resources.
- //
- gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);
- gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);
- gBS->CloseEvent ((UsbKeyboardDevice->SimpleInput).WaitForKey);
-
- if (UsbKeyboardDevice->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (UsbKeyboardDevice->ControllerNameTable);
- }
-
- gBS->FreePool (UsbKeyboardDevice);
-
- return Status;
-
-}
-
-
-EFI_STATUS
-EFIAPI
-USBKeyboardReset (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Implements EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset() function.
-
- Arguments:
- This The EFI_SIMPLE_TEXT_IN_PROTOCOL instance.
- ExtendedVerification
- Indicates that the driver may perform a more exhaustive
- verification operation of the device during reset.
-
- Returns:
- EFI_SUCCESS - Success
- EFI_DEVICE_ERROR - Hardware Error
---*/
-{
- EFI_STATUS Status;
- USB_KB_DEV *UsbKeyboardDevice;
-
- UsbKeyboardDevice = USB_KB_DEV_FROM_THIS (This);
-
- KbdReportStatusCode (
- UsbKeyboardDevice->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_RESET)
- );
-
- //
- // Non Exhaustive reset:
- // only reset private data structures.
- //
- if (!ExtendedVerification) {
- //
- // Clear the key buffer of this Usb keyboard
- //
- KbdReportStatusCode (
- UsbKeyboardDevice->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER)
- );
-
- InitUSBKeyBuffer (&(UsbKeyboardDevice->KeyboardBuffer));
- UsbKeyboardDevice->CurKeyChar = 0;
- return EFI_SUCCESS;
- }
-
- //
- // Exhaustive reset
- //
- Status = InitUSBKeyboard (UsbKeyboardDevice);
- UsbKeyboardDevice->CurKeyChar = 0;
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-USBKeyboardReadKeyStroke (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
- Routine Description:
- Implements EFI_SIMPLE_TEXT_IN_PROTOCOL.ReadKeyStroke() function.
-
- Arguments:
- This The EFI_SIMPLE_TEXT_IN_PROTOCOL instance.
- Key A pointer to a buffer that is filled in with the keystroke
- information for the key that was pressed.
-
- Returns:
- EFI_SUCCESS - Success
---*/
-{
- USB_KB_DEV *UsbKeyboardDevice;
- EFI_STATUS Status;
- UINT8 KeyChar;
-
- UsbKeyboardDevice = USB_KB_DEV_FROM_THIS (This);
-
- //
- // if there is no saved ASCII byte, fetch it
- // by calling USBKeyboardCheckForKey().
- //
- if (UsbKeyboardDevice->CurKeyChar == 0) {
- Status = USBKeyboardCheckForKey (UsbKeyboardDevice);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- Key->UnicodeChar = 0;
- Key->ScanCode = SCAN_NULL;
-
- KeyChar = UsbKeyboardDevice->CurKeyChar;
-
- UsbKeyboardDevice->CurKeyChar = 0;
-
- //
- // Translate saved ASCII byte into EFI_INPUT_KEY
- //
- Status = USBKeyCodeToEFIScanCode (UsbKeyboardDevice, KeyChar, Key);
-
- return Status;
-
-}
-
-STATIC
-VOID
-EFIAPI
-USBKeyboardWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
- Handler function for WaitForKey event.
-
- Arguments:
- Event Event to be signaled when a key is pressed.
- Context Points to USB_KB_DEV instance.
-
- Returns:
- VOID
---*/
-{
- USB_KB_DEV *UsbKeyboardDevice;
-
- UsbKeyboardDevice = (USB_KB_DEV *) Context;
-
- if (UsbKeyboardDevice->CurKeyChar == 0) {
-
- if (EFI_ERROR (USBKeyboardCheckForKey (UsbKeyboardDevice))) {
- return ;
- }
- }
- //
- // If has key pending, signal the event.
- //
- gBS->SignalEvent (Event);
-}
-
-
-STATIC
-EFI_STATUS
-USBKeyboardCheckForKey (
- IN USB_KB_DEV *UsbKeyboardDevice
- )
-/*++
-
- Routine Description:
- Check whether there is key pending.
-
- Arguments:
- UsbKeyboardDevice The USB_KB_DEV instance.
-
- Returns:
- EFI_SUCCESS - Success
---*/
-{
- EFI_STATUS Status;
- UINT8 KeyChar;
-
- //
- // Fetch raw data from the USB keyboard input,
- // and translate it into ASCII data.
- //
- Status = USBParseKey (UsbKeyboardDevice, &KeyChar);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- UsbKeyboardDevice->CurKeyChar = KeyChar;
- return EFI_SUCCESS;
-}
-
-VOID
-KbdReportStatusCode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value
- )
-/*++
-
- Routine Description:
- Report Status Code in Usb Bot Driver
-
- Arguments:
- DevicePath - Use this to get Device Path
- CodeType - Status Code Type
- CodeValue - Status Code Value
-
- Returns:
- None
-
---*/
-{
-
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- CodeType,
- Value,
- DevicePath
- );
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.h b/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.h
deleted file mode 100644
index 4bdbfc9..0000000
--- a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EfiKey.h
-
-Abstract:
-
- Header file for USB Keyboard Driver's Data Structures
-
-Revision History
---*/
-#ifndef _USB_KB_H
-#define _USB_KB_H
-
-
-#include <IndustryStandard/Usb.h>
-
-#define MAX_KEY_ALLOWED 32
-
-#define HZ 1000 * 1000 * 10
-#define USBKBD_REPEAT_DELAY ((HZ) / 2)
-#define USBKBD_REPEAT_RATE ((HZ) / 50)
-
-#define CLASS_HID 3
-#define SUBCLASS_BOOT 1
-#define PROTOCOL_KEYBOARD 1
-
-#define BOOT_PROTOCOL 0
-#define REPORT_PROTOCOL 1
-
-typedef struct {
- UINT8 Down;
- UINT8 KeyCode;
-} USB_KEY;
-
-typedef struct {
- USB_KEY buffer[MAX_KEY_ALLOWED + 1];
- UINT8 bHead;
- UINT8 bTail;
-} USB_KB_BUFFER;
-
-#define USB_KB_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'k', 'b', 'd')
-typedef struct {
- UINTN Signature;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_EVENT DelayedRecoveryEvent;
- EFI_SIMPLE_TEXT_IN_PROTOCOL SimpleInput;
- EFI_USB_IO_PROTOCOL *UsbIo;
-
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
- EFI_USB_ENDPOINT_DESCRIPTOR IntEndpointDescriptor;
-
- USB_KB_BUFFER KeyboardBuffer;
- UINT8 CtrlOn;
- UINT8 AltOn;
- UINT8 ShiftOn;
- UINT8 NumLockOn;
- UINT8 CapsOn;
- UINT8 ScrollOn;
- UINT8 LastKeyCodeArray[8];
- UINT8 CurKeyChar;
-
- UINT8 RepeatKey;
- EFI_EVENT RepeatTimer;
-
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-
-} USB_KB_DEV;
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUsbKeyboardComponentName;
-extern EFI_GUID gEfiUsbKeyboardDriverGuid;
-
-VOID
-KbdReportStatusCode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value
- );
-
-#define USB_KB_DEV_FROM_THIS(a) \
- CR(a, USB_KB_DEV, SimpleInput, USB_KB_DEV_SIGNATURE)
-
-#define MOD_CONTROL_L 0x01
-#define MOD_CONTROL_R 0x10
-#define MOD_SHIFT_L 0x02
-#define MOD_SHIFT_R 0x20
-#define MOD_ALT_L 0x04
-#define MOD_ALT_R 0x40
-#define MOD_WIN_L 0x08
-#define MOD_WIN_R 0x80
-
-typedef struct {
- UINT8 Mask;
- UINT8 Key;
-} KB_MODIFIER;
-
-#define USB_KEYCODE_MAX_MAKE 0x64
-
-#define USBKBD_VALID_KEYCODE(key) ((UINT8) (key) > 3)
-
-typedef struct {
- UINT8 NumLock : 1;
- UINT8 CapsLock : 1;
- UINT8 ScrollLock : 1;
- UINT8 Resrvd : 5;
-} LED_MAP;
-
-//
-// Prototypes
-// Driver model protocol interface
-//
-EFI_STATUS
-EFIAPI
-USBKeyboardDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-USBKeyboardDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-USBKeyboardDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/keyboard.c b/EdkModulePkg/Bus/Usb/UsbKb/Dxe/keyboard.c
deleted file mode 100644
index d81a976..0000000
--- a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/keyboard.c
+++ /dev/null
@@ -1,1150 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Keyboard.c
-
-Abstract:
-
- Helper functions for USB Keyboard Driver
-
-Revision History
-
---*/
-
-#include "keyboard.h"
-
-//
-// USB Key Code to Efi key mapping table
-// Format:<efi scan code>, <unicode without shift>, <unicode with shift>
-//
-STATIC
-UINT8 KeyConvertionTable[USB_KEYCODE_MAX_MAKE][3] = {
- { SCAN_NULL, 'a', 'A' }, // 0x04
- { SCAN_NULL, 'b', 'B' }, // 0x05
- { SCAN_NULL, 'c', 'C' }, // 0x06
- { SCAN_NULL, 'd', 'D' }, // 0x07
- { SCAN_NULL, 'e', 'E' }, // 0x08
- { SCAN_NULL, 'f', 'F' }, // 0x09
- { SCAN_NULL, 'g', 'G' }, // 0x0A
- { SCAN_NULL, 'h', 'H' }, // 0x0B
- { SCAN_NULL, 'i', 'I' }, // 0x0C
- { SCAN_NULL, 'j', 'J' }, // 0x0D
- { SCAN_NULL, 'k', 'K' }, // 0x0E
- { SCAN_NULL, 'l', 'L' }, // 0x0F
- { SCAN_NULL, 'm', 'M' }, // 0x10
- { SCAN_NULL, 'n', 'N' }, // 0x11
- { SCAN_NULL, 'o', 'O' }, // 0x12
- { SCAN_NULL, 'p', 'P' }, // 0x13
- { SCAN_NULL, 'q', 'Q' }, // 0x14
- { SCAN_NULL, 'r', 'R' }, // 0x15
- { SCAN_NULL, 's', 'S' }, // 0x16
- { SCAN_NULL, 't', 'T' }, // 0x17
- { SCAN_NULL, 'u', 'U' }, // 0x18
- { SCAN_NULL, 'v', 'V' }, // 0x19
- { SCAN_NULL, 'w', 'W' }, // 0x1A
- { SCAN_NULL, 'x', 'X' }, // 0x1B
- { SCAN_NULL, 'y', 'Y' }, // 0x1C
- { SCAN_NULL, 'z', 'Z' }, // 0x1D
- { SCAN_NULL, '1', '!' }, // 0x1E
- { SCAN_NULL, '2', '@' }, // 0x1F
- { SCAN_NULL, '3', '#' }, // 0x20
- { SCAN_NULL, '4', '$' }, // 0x21
- { SCAN_NULL, '5', '%' }, // 0x22
- { SCAN_NULL, '6', '^' }, // 0x23
- { SCAN_NULL, '7', '&' }, // 0x24
- { SCAN_NULL, '8', '*' }, // 0x25
- { SCAN_NULL, '9', '(' }, // 0x26
- { SCAN_NULL, '0', ')' }, // 0x27
- { SCAN_NULL, 0x0d, 0x0d }, // 0x28 Enter
- { SCAN_ESC, 0x00, 0x00 }, // 0x29 Esc
- { SCAN_NULL, 0x08, 0x08 }, // 0x2A Backspace
- { SCAN_NULL, 0x09, 0x09 }, // 0x2B Tab
- { SCAN_NULL, ' ', ' ' }, // 0x2C Spacebar
- { SCAN_NULL, '-', '_' }, // 0x2D
- { SCAN_NULL, '=', '+' }, // 0x2E
- { SCAN_NULL, '[', '{' }, // 0x2F
- { SCAN_NULL, ']', '}' }, // 0x30
- { SCAN_NULL, '\\', '|' }, // 0x31
- { SCAN_NULL, '\\', '|' }, // 0x32 Keyboard US \ and |
- { SCAN_NULL, ';', ':' }, // 0x33
- { SCAN_NULL, '\'', '"' }, // 0x34
- { SCAN_NULL, '`', '~' }, // 0x35 Keyboard Grave Accent and Tlide
- { SCAN_NULL, ',', '<' }, // 0x36
- { SCAN_NULL, '.', '>' }, // 0x37
- { SCAN_NULL, '/', '?' }, // 0x38
- { SCAN_NULL, 0x00, 0x00 }, // 0x39 CapsLock
- { SCAN_F1, 0x00, 0x00 }, // 0x3A
- { SCAN_F2, 0x00, 0x00 }, // 0x3B
- { SCAN_F3, 0x00, 0x00 }, // 0x3C
- { SCAN_F4, 0x00, 0x00 }, // 0x3D
- { SCAN_F5, 0x00, 0x00 }, // 0x3E
- { SCAN_F6, 0x00, 0x00 }, // 0x3F
- { SCAN_F7, 0x00, 0x00 }, // 0x40
- { SCAN_F8, 0x00, 0x00 }, // 0x41
- { SCAN_F9, 0x00, 0x00 }, // 0x42
- { SCAN_F10, 0x00, 0x00 }, // 0x43
- { SCAN_F11, 0x00, 0x00 }, // 0x44 F11
- { SCAN_F12, 0x00, 0x00 }, // 0x45 F12
- { SCAN_NULL, 0x00, 0x00 }, // 0x46 PrintScreen
- { SCAN_NULL, 0x00, 0x00 }, // 0x47 Scroll Lock
- { SCAN_NULL, 0x00, 0x00 }, // 0x48 Pause
- { SCAN_INSERT, 0x00, 0x00 }, // 0x49
- { SCAN_HOME, 0x00, 0x00 }, // 0x4A
- { SCAN_PAGE_UP, 0x00, 0x00 }, // 0x4B
- { SCAN_DELETE, 0x00, 0x00 }, // 0x4C
- { SCAN_END, 0x00, 0x00 }, // 0x4D
- { SCAN_PAGE_DOWN, 0x00, 0x00 }, // 0x4E
- { SCAN_RIGHT, 0x00, 0x00 }, // 0x4F
- { SCAN_LEFT, 0x00, 0x00 }, // 0x50
- { SCAN_DOWN, 0x00, 0x00 }, // 0x51
- { SCAN_UP, 0x00, 0x00 }, // 0x52
- { SCAN_NULL, 0x00, 0x00 }, // 0x53 NumLock
- { SCAN_NULL, '/', '/' }, // 0x54
- { SCAN_NULL, '*', '*' }, // 0x55
- { SCAN_NULL, '-', '-' }, // 0x56
- { SCAN_NULL, '+', '+' }, // 0x57
- { SCAN_NULL, 0x0d, 0x0d }, // 0x58
- { SCAN_END, '1', '1' }, // 0x59
- { SCAN_DOWN, '2', '2' }, // 0x5A
- { SCAN_PAGE_DOWN, '3', '3' }, // 0x5B
- { SCAN_LEFT, '4', '4' }, // 0x5C
- { SCAN_NULL, '5', '5' }, // 0x5D
- { SCAN_RIGHT, '6', '6' }, // 0x5E
- { SCAN_HOME, '7', '7' }, // 0x5F
- { SCAN_UP, '8', '8' }, // 0x60
- { SCAN_PAGE_UP, '9', '9' }, // 0x61
- { SCAN_INSERT, '0', '0' }, // 0x62
- { SCAN_DELETE, '.', '.' }, // 0x63
- { SCAN_NULL, '\\', '|' }, // 0x64 Keyboard Non-US \ and |
- { SCAN_NULL, 0x00, 0x00 }, // 0x65 Keyboard Application
- { SCAN_NULL, 0x00, 0x00 }, // 0x66 Keyboard Power
- { SCAN_NULL, '=' , '=' } // 0x67 Keypad =
-};
-
-STATIC KB_MODIFIER KB_Mod[8] = {
- { MOD_CONTROL_L, 0xe0 }, // 11100000
- { MOD_CONTROL_R, 0xe4 }, // 11100100
- { MOD_SHIFT_L, 0xe1 }, // 11100001
- { MOD_SHIFT_R, 0xe5 }, // 11100101
- { MOD_ALT_L, 0xe2 }, // 11100010
- { MOD_ALT_R, 0xe6 }, // 11100110
- { MOD_WIN_L, 0xe3 }, // 11100011
- { MOD_WIN_R, 0xe7 } // 11100111
-};
-
-
-BOOLEAN
-IsUSBKeyboard (
- IN EFI_USB_IO_PROTOCOL *UsbIo
- )
-/*++
-
- Routine Description:
- Uses USB I/O to check whether the device is a USB Keyboard device.
-
- Arguments:
- UsbIo: Points to a USB I/O protocol instance.
-
- Returns:
-
---*/
-{
- EFI_STATUS Status;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
-
- //
- // Get the Default interface descriptor, currently we
- // assume it is interface 1
- //
- Status = UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &InterfaceDescriptor
- );
-
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- if (InterfaceDescriptor.InterfaceClass == CLASS_HID &&
- InterfaceDescriptor.InterfaceSubClass == SUBCLASS_BOOT &&
- InterfaceDescriptor.InterfaceProtocol == PROTOCOL_KEYBOARD
- ) {
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-EFI_STATUS
-InitUSBKeyboard (
- IN USB_KB_DEV *UsbKeyboardDevice
- )
-/*++
-
- Routine Description:
- Initialize USB Keyboard device and all private data structures.
-
- Arguments:
- UsbKeyboardDevice The USB_KB_DEV instance.
-
- Returns:
- EFI_SUCCESS - Success
- EFI_DEVICE_ERROR - Hardware Error
---*/
-{
- UINT8 ConfigValue;
- UINT8 Protocol;
- UINT8 ReportId;
- UINT8 Duration;
- EFI_STATUS Status;
- UINT32 TransferResult;
-
- KbdReportStatusCode (
- UsbKeyboardDevice->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST)
- );
-
- InitUSBKeyBuffer (&(UsbKeyboardDevice->KeyboardBuffer));
-
- //
- // default configurations
- //
- ConfigValue = 0x01;
-
- //
- // Uses default configuration to configure the USB Keyboard device.
- //
- Status = UsbSetDeviceConfiguration (
- UsbKeyboardDevice->UsbIo,
- (UINT16) ConfigValue,
- &TransferResult
- );
- if (EFI_ERROR (Status)) {
- //
- // If configuration could not be set here, it means
- // the keyboard interface has some errors and could
- // not be initialized
- //
- KbdReportStatusCode (
- UsbKeyboardDevice->DevicePath,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR)
- );
-
- return EFI_DEVICE_ERROR;
- }
-
- UsbGetProtocolRequest (
- UsbKeyboardDevice->UsbIo,
- UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
- &Protocol
- );
- //
- // Sets boot protocol for the USB Keyboard.
- // This driver only supports boot protocol.
- // !!BugBug: How about the device that does not support boot protocol?
- //
- if (Protocol != BOOT_PROTOCOL) {
- UsbSetProtocolRequest (
- UsbKeyboardDevice->UsbIo,
- UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
- BOOT_PROTOCOL
- );
- }
- //
- // the duration is indefinite, so the endpoint will inhibit reporting forever,
- // and only reporting when a change is detected in the report data.
- //
-
- //
- // idle value for all report ID
- //
- ReportId = 0;
- //
- // idle forever until there is a key pressed and released.
- //
- Duration = 0;
- UsbSetIdleRequest (
- UsbKeyboardDevice->UsbIo,
- UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
- ReportId,
- Duration
- );
-
- UsbKeyboardDevice->CtrlOn = 0;
- UsbKeyboardDevice->AltOn = 0;
- UsbKeyboardDevice->ShiftOn = 0;
- UsbKeyboardDevice->NumLockOn = 0;
- UsbKeyboardDevice->CapsOn = 0;
- UsbKeyboardDevice->ScrollOn = 0;
- ZeroMem (UsbKeyboardDevice->LastKeyCodeArray, sizeof (UINT8) * 8);
-
- //
- // Set a timer for repeat keys' generation.
- //
- if (UsbKeyboardDevice->RepeatTimer) {
- gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);
- UsbKeyboardDevice->RepeatTimer = 0;
- }
-
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- USBKeyboardRepeatHandler,
- UsbKeyboardDevice,
- &UsbKeyboardDevice->RepeatTimer
- );
-
- if (UsbKeyboardDevice->DelayedRecoveryEvent) {
- gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);
- UsbKeyboardDevice->DelayedRecoveryEvent = 0;
- }
-
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- USBKeyboardRecoveryHandler,
- UsbKeyboardDevice,
- &UsbKeyboardDevice->DelayedRecoveryEvent
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-KeyboardHandler (
- IN VOID *Data,
- IN UINTN DataLength,
- IN VOID *Context,
- IN UINT32 Result
- )
-/*++
-
- Routine Description:
- Handler function for USB Keyboard's asynchronous interrupt transfer.
-
- Arguments:
- Data A pointer to a buffer that is filled with key data which is
- retrieved via asynchronous interrupt transfer.
- DataLength Indicates the size of the data buffer.
- Context Pointing to USB_KB_DEV instance.
- Result Indicates the result of the asynchronous interrupt transfer.
-
- Returns:
- EFI_SUCCESS - Success
- EFI_DEVICE_ERROR - Hardware Error
---*/
-{
- USB_KB_DEV *UsbKeyboardDevice;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 *CurKeyCodeBuffer;
- UINT8 *OldKeyCodeBuffer;
- UINT8 CurModifierMap;
- UINT8 OldModifierMap;
- UINT8 Index;
- UINT8 Index2;
- BOOLEAN Down;
- BOOLEAN KeyRelease;
- BOOLEAN KeyPress;
- UINT8 SavedTail;
- USB_KEY UsbKey;
- UINT8 NewRepeatKey;
- UINT32 UsbStatus;
-
- ASSERT (Context);
-
- NewRepeatKey = 0;
- UsbKeyboardDevice = (USB_KB_DEV *) Context;
- UsbIo = UsbKeyboardDevice->UsbIo;
-
- //
- // Analyzes the Result and performs corresponding action.
- //
- if (Result != EFI_USB_NOERROR) {
- //
- // Some errors happen during the process
- //
- KbdReportStatusCode (
- UsbKeyboardDevice->DevicePath,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INPUT_ERROR)
- );
-
- //
- // stop the repeat key generation if any
- //
- UsbKeyboardDevice->RepeatKey = 0;
-
- gBS->SetTimer (
- UsbKeyboardDevice->RepeatTimer,
- TimerCancel,
- USBKBD_REPEAT_RATE
- );
-
- if ((Result & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) {
- UsbClearEndpointHalt (
- UsbIo,
- UsbKeyboardDevice->IntEndpointDescriptor.EndpointAddress,
- &UsbStatus
- );
- }
-
- //
- // Delete & Submit this interrupt again
- //
-
- UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- UsbKeyboardDevice->IntEndpointDescriptor.EndpointAddress,
- FALSE,
- 0,
- 0,
- NULL,
- NULL
- );
-
- gBS->SetTimer (
- UsbKeyboardDevice->DelayedRecoveryEvent,
- TimerRelative,
- EFI_USB_INTERRUPT_DELAY
- );
-
- return EFI_DEVICE_ERROR;
- }
-
- if (DataLength == 0 || Data == NULL) {
- return EFI_SUCCESS;
- }
-
- CurKeyCodeBuffer = (UINT8 *) Data;
- OldKeyCodeBuffer = UsbKeyboardDevice->LastKeyCodeArray;
-
- //
- // checks for new key stroke.
- // if no new key got, return immediately.
- //
- for (Index = 0; Index < 8; Index++) {
- if (OldKeyCodeBuffer[Index] != CurKeyCodeBuffer[Index]) {
- break;
- }
- }
-
- if (Index == 8) {
- return EFI_SUCCESS;
- }
-
- //
- // Parse the modifier key
- //
- CurModifierMap = CurKeyCodeBuffer[0];
- OldModifierMap = OldKeyCodeBuffer[0];
-
- //
- // handle modifier key's pressing or releasing situation.
- //
- for (Index = 0; Index < 8; Index++) {
-
- if ((CurModifierMap & KB_Mod[Index].Mask) != (OldModifierMap & KB_Mod[Index].Mask)) {
- //
- // if current modifier key is up, then
- // CurModifierMap & KB_Mod[Index].Mask = 0;
- // otherwize it is a non-zero value.
- // Inserts the pressed modifier key into key buffer.
- //
- Down = (UINT8) (CurModifierMap & KB_Mod[Index].Mask);
- InsertKeyCode (&(UsbKeyboardDevice->KeyboardBuffer), KB_Mod[Index].Key, Down);
- }
- }
-
- //
- // handle normal key's releasing situation
- //
- KeyRelease = FALSE;
- for (Index = 2; Index < 8; Index++) {
-
- if (!USBKBD_VALID_KEYCODE (OldKeyCodeBuffer[Index])) {
- continue;
- }
-
- KeyRelease = TRUE;
- for (Index2 = 2; Index2 < 8; Index2++) {
-
- if (!USBKBD_VALID_KEYCODE (CurKeyCodeBuffer[Index2])) {
- continue;
- }
-
- if (OldKeyCodeBuffer[Index] == CurKeyCodeBuffer[Index2]) {
- KeyRelease = FALSE;
- break;
- }
- }
-
- if (KeyRelease) {
- InsertKeyCode (
- &(UsbKeyboardDevice->KeyboardBuffer),
- OldKeyCodeBuffer[Index],
- 0
- );
- //
- // the original reapeat key is released.
- //
- if (OldKeyCodeBuffer[Index] == UsbKeyboardDevice->RepeatKey) {
- UsbKeyboardDevice->RepeatKey = 0;
- }
- }
- }
-
- //
- // original repeat key is released, cancel the repeat timer
- //
- if (UsbKeyboardDevice->RepeatKey == 0) {
- gBS->SetTimer (
- UsbKeyboardDevice->RepeatTimer,
- TimerCancel,
- USBKBD_REPEAT_RATE
- );
- }
-
- //
- // handle normal key's pressing situation
- //
- KeyPress = FALSE;
- for (Index = 2; Index < 8; Index++) {
-
- if (!USBKBD_VALID_KEYCODE (CurKeyCodeBuffer[Index])) {
- continue;
- }
-
- KeyPress = TRUE;
- for (Index2 = 2; Index2 < 8; Index2++) {
-
- if (!USBKBD_VALID_KEYCODE (OldKeyCodeBuffer[Index2])) {
- continue;
- }
-
- if (CurKeyCodeBuffer[Index] == OldKeyCodeBuffer[Index2]) {
- KeyPress = FALSE;
- break;
- }
- }
-
- if (KeyPress) {
- InsertKeyCode (&(UsbKeyboardDevice->KeyboardBuffer), CurKeyCodeBuffer[Index], 1);
- //
- // NumLock pressed or CapsLock pressed
- //
- if (CurKeyCodeBuffer[Index] == 0x53 || CurKeyCodeBuffer[Index] == 0x39) {
- UsbKeyboardDevice->RepeatKey = 0;
- } else {
- NewRepeatKey = CurKeyCodeBuffer[Index];
- //
- // do not repeat the original repeated key
- //
- UsbKeyboardDevice->RepeatKey = 0;
- }
- }
- }
-
- //
- // Update LastKeycodeArray[] buffer in the
- // Usb Keyboard Device data structure.
- //
- for (Index = 0; Index < 8; Index++) {
- UsbKeyboardDevice->LastKeyCodeArray[Index] = CurKeyCodeBuffer[Index];
- }
-
- //
- // pre-process KeyboardBuffer, pop out the ctrl,alt,del key in sequence
- // and judge whether it will invoke reset event.
- //
- SavedTail = UsbKeyboardDevice->KeyboardBuffer.bTail;
- Index = UsbKeyboardDevice->KeyboardBuffer.bHead;
- while (Index != SavedTail) {
- RemoveKeyCode (&(UsbKeyboardDevice->KeyboardBuffer), &UsbKey);
-
- switch (UsbKey.KeyCode) {
-
- case 0xe0:
- case 0xe4:
- if (UsbKey.Down) {
- UsbKeyboardDevice->CtrlOn = 1;
- } else {
- UsbKeyboardDevice->CtrlOn = 0;
- }
- break;
-
- case 0xe2:
- case 0xe6:
- if (UsbKey.Down) {
- UsbKeyboardDevice->AltOn = 1;
- } else {
- UsbKeyboardDevice->AltOn = 0;
- }
- break;
-
- //
- // Del Key Code
- //
- case 0x4c:
- case 0x63:
- if (UsbKey.Down) {
- if (UsbKeyboardDevice->CtrlOn && UsbKeyboardDevice->AltOn) {
- gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
- }
- }
- break;
-
- default:
- break;
- }
-
- //
- // insert the key back to the buffer.
- // so the key sequence will not be destroyed.
- //
- InsertKeyCode (
- &(UsbKeyboardDevice->KeyboardBuffer),
- UsbKey.KeyCode,
- UsbKey.Down
- );
- Index = UsbKeyboardDevice->KeyboardBuffer.bHead;
-
- }
- //
- // If have new key pressed, update the RepeatKey value, and set the
- // timer to repeate delay timer
- //
- if (NewRepeatKey != 0) {
- //
- // sets trigger time to "Repeat Delay Time",
- // to trigger the repeat timer when the key is hold long
- // enough time.
- //
- gBS->SetTimer (
- UsbKeyboardDevice->RepeatTimer,
- TimerRelative,
- USBKBD_REPEAT_DELAY
- );
- UsbKeyboardDevice->RepeatKey = NewRepeatKey;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-USBParseKey (
- IN OUT USB_KB_DEV *UsbKeyboardDevice,
- OUT UINT8 *KeyChar
- )
-/*++
-
- Routine Description:
- Retrieves a key character after parsing the raw data in keyboard buffer.
-
- Arguments:
- UsbKeyboardDevice The USB_KB_DEV instance.
- KeyChar Points to the Key character after key parsing.
-
- Returns:
- EFI_SUCCESS - Success
- EFI_NOT_READY - Device is not ready
---*/
-{
- USB_KEY UsbKey;
-
- *KeyChar = 0;
-
- while (!IsUSBKeyboardBufferEmpty (&UsbKeyboardDevice->KeyboardBuffer)) {
- //
- // pops one raw data off.
- //
- RemoveKeyCode (&(UsbKeyboardDevice->KeyboardBuffer), &UsbKey);
-
- if (!UsbKey.Down) {
- switch (UsbKey.KeyCode) {
-
- case 0xe0:
- case 0xe4:
- UsbKeyboardDevice->CtrlOn = 0;
- break;
-
- case 0xe1:
- case 0xe5:
- UsbKeyboardDevice->ShiftOn = 0;
- break;
-
- case 0xe2:
- case 0xe6:
- UsbKeyboardDevice->AltOn = 0;
- break;
-
- default:
- break;
- }
-
- continue;
- }
-
- //
- // Analyzes key pressing situation
- //
- switch (UsbKey.KeyCode) {
-
- case 0xe0:
- case 0xe4:
- UsbKeyboardDevice->CtrlOn = 1;
- continue;
- break;
-
- case 0xe1:
- case 0xe5:
- UsbKeyboardDevice->ShiftOn = 1;
- continue;
- break;
-
- case 0xe2:
- case 0xe6:
- UsbKeyboardDevice->AltOn = 1;
- continue;
- break;
-
- case 0xe3:
- case 0xe7:
- continue;
- break;
-
- case 0x53:
- UsbKeyboardDevice->NumLockOn ^= 1;
- SetKeyLED (UsbKeyboardDevice);
- continue;
- break;
-
- case 0x39:
- UsbKeyboardDevice->CapsOn ^= 1;
- SetKeyLED (UsbKeyboardDevice);
- continue;
- break;
-
- //
- // F11,F12,PrintScreen,ScrollLock,Pause,Application,Power
- // keys are not valid EFI key
- //
- case 0x44:
- //
- // fall through
- //
- case 0x45:
- //
- // fall through
- //
- case 0x46:
- //
- // fall through
- //
- case 0x47:
- //
- // Turn on the ScrollLock light on KB
- //
- UsbKeyboardDevice->ScrollOn ^= 1;
- SetKeyLED (UsbKeyboardDevice);
- continue;
- break;
- case 0x48:
- //
- // fall through
- //
- case 0x65:
- case 0x66:
- continue;
- break;
-
- default:
- break;
- }
-
- //
- // When encountered Del Key...
- //
- if (UsbKey.KeyCode == 0x4c || UsbKey.KeyCode == 0x63) {
- if (UsbKeyboardDevice->CtrlOn && UsbKeyboardDevice->AltOn) {
- gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
- }
- }
-
- *KeyChar = UsbKey.KeyCode;
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_READY;
-
-}
-
-
-EFI_STATUS
-USBKeyCodeToEFIScanCode (
- IN USB_KB_DEV *UsbKeyboardDevice,
- IN UINT8 KeyChar,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
- Routine Description:
- Converts USB Keyboard code to EFI Scan Code.
-
- Arguments:
- UsbKeyboardDevice The USB_KB_DEV instance.
- KeyChar Indicates the key code that will be interpreted.
- Key A pointer to a buffer that is filled in with
- the keystroke information for the key that
- was pressed.
- Returns:
- EFI_NOT_READY - Device is not ready
- EFI_SUCCESS - Success
---*/
-{
- UINT8 Index;
-
- if (!USBKBD_VALID_KEYCODE (KeyChar)) {
- return EFI_NOT_READY;
- }
-
- //
- // valid USB Key Code starts from 4
- //
- Index = (UINT8) (KeyChar - 4);
-
- if (Index >= USB_KEYCODE_MAX_MAKE) {
- return EFI_NOT_READY;
- }
-
- Key->ScanCode = KeyConvertionTable[Index][0];
-
- if (UsbKeyboardDevice->ShiftOn) {
-
- Key->UnicodeChar = KeyConvertionTable[Index][2];
-
- } else {
-
- Key->UnicodeChar = KeyConvertionTable[Index][1];
- }
-
- if (UsbKeyboardDevice->CapsOn) {
-
- if (Key->UnicodeChar >= 'a' && Key->UnicodeChar <= 'z') {
-
- Key->UnicodeChar = KeyConvertionTable[Index][2];
-
- } else if (Key->UnicodeChar >= 'A' && Key->UnicodeChar <= 'Z') {
-
- Key->UnicodeChar = KeyConvertionTable[Index][1];
-
- }
- }
-
- if (KeyChar >= 0x59 && KeyChar <= 0x63) {
-
- if (UsbKeyboardDevice->NumLockOn && !UsbKeyboardDevice->ShiftOn) {
-
- Key->ScanCode = SCAN_NULL;
-
- } else {
-
- Key->UnicodeChar = 0x00;
- }
- }
-
- if (Key->UnicodeChar == 0 && Key->ScanCode == SCAN_NULL) {
- return EFI_NOT_READY;
- }
-
- return EFI_SUCCESS;
-
-}
-
-
-EFI_STATUS
-InitUSBKeyBuffer (
- IN OUT USB_KB_BUFFER *KeyboardBuffer
- )
-/*++
-
- Routine Description:
- Resets USB Keyboard Buffer.
-
- Arguments:
- KeyboardBuffer - Points to the USB Keyboard Buffer.
-
- Returns:
- EFI_SUCCESS - Success
---*/
-{
- ZeroMem (KeyboardBuffer, sizeof (USB_KB_BUFFER));
-
- KeyboardBuffer->bHead = KeyboardBuffer->bTail;
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-IsUSBKeyboardBufferEmpty (
- IN USB_KB_BUFFER *KeyboardBuffer
- )
-/*++
-
- Routine Description:
- Check whether USB Keyboard buffer is empty.
-
- Arguments:
- KeyboardBuffer - USB Keyboard Buffer.
-
- Returns:
-
---*/
-{
- //
- // meet FIFO empty condition
- //
- return (BOOLEAN) (KeyboardBuffer->bHead == KeyboardBuffer->bTail);
-}
-
-
-BOOLEAN
-IsUSBKeyboardBufferFull (
- IN USB_KB_BUFFER *KeyboardBuffer
- )
-/*++
-
- Routine Description:
- Check whether USB Keyboard buffer is full.
-
- Arguments:
- KeyboardBuffer - USB Keyboard Buffer.
-
- Returns:
-
---*/
-{
- return (BOOLEAN)(((KeyboardBuffer->bTail + 1) % (MAX_KEY_ALLOWED + 1)) ==
- KeyboardBuffer->bHead);
-}
-
-
-EFI_STATUS
-InsertKeyCode (
- IN OUT USB_KB_BUFFER *KeyboardBuffer,
- IN UINT8 Key,
- IN UINT8 Down
- )
-/*++
-
- Routine Description:
- Inserts a key code into keyboard buffer.
-
- Arguments:
- KeyboardBuffer - Points to the USB Keyboard Buffer.
- Key - Key code
- Down - Special key
- Returns:
- EFI_SUCCESS - Success
---*/
-{
- USB_KEY UsbKey;
-
- //
- // if keyboard buffer is full, throw the
- // first key out of the keyboard buffer.
- //
- if (IsUSBKeyboardBufferFull (KeyboardBuffer)) {
- RemoveKeyCode (KeyboardBuffer, &UsbKey);
- }
-
- KeyboardBuffer->buffer[KeyboardBuffer->bTail].KeyCode = Key;
- KeyboardBuffer->buffer[KeyboardBuffer->bTail].Down = Down;
-
- //
- // adjust the tail pointer of the FIFO keyboard buffer.
- //
- KeyboardBuffer->bTail = (UINT8) ((KeyboardBuffer->bTail + 1) % (MAX_KEY_ALLOWED + 1));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-RemoveKeyCode (
- IN OUT USB_KB_BUFFER *KeyboardBuffer,
- OUT USB_KEY *UsbKey
- )
-/*++
-
- Routine Description:
- Pops a key code off from keyboard buffer.
-
- Arguments:
- KeyboardBuffer - Points to the USB Keyboard Buffer.
- UsbKey - Points to the buffer that contains a usb key code.
-
- Returns:
- EFI_SUCCESS - Success
- EFI_DEVICE_ERROR - Hardware Error
---*/
-{
- if (IsUSBKeyboardBufferEmpty (KeyboardBuffer)) {
- return EFI_DEVICE_ERROR;
- }
-
- UsbKey->KeyCode = KeyboardBuffer->buffer[KeyboardBuffer->bHead].KeyCode;
- UsbKey->Down = KeyboardBuffer->buffer[KeyboardBuffer->bHead].Down;
-
- //
- // adjust the head pointer of the FIFO keyboard buffer.
- //
- KeyboardBuffer->bHead = (UINT8) ((KeyboardBuffer->bHead + 1) % (MAX_KEY_ALLOWED + 1));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-SetKeyLED (
- IN USB_KB_DEV *UsbKeyboardDevice
- )
-/*++
-
- Routine Description:
- Sets USB Keyboard LED state.
-
- Arguments:
- UsbKeyboardDevice - The USB_KB_DEV instance.
-
- Returns:
- EFI_SUCCESS - Success
---*/
-{
- LED_MAP Led;
- UINT8 ReportId;
-
- //
- // Set each field in Led map.
- //
- Led.NumLock = (UINT8) UsbKeyboardDevice->NumLockOn;
- Led.CapsLock = (UINT8) UsbKeyboardDevice->CapsOn;
- Led.ScrollLock = (UINT8) UsbKeyboardDevice->ScrollOn;
- Led.Resrvd = 0;
-
- ReportId = 0;
- //
- // call Set Report Request to lighten the LED.
- //
- UsbSetReportRequest (
- UsbKeyboardDevice->UsbIo,
- UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
- ReportId,
- HID_OUTPUT_REPORT,
- 1,
- (UINT8 *) &Led
- );
-
- return EFI_SUCCESS;
-}
-
-VOID
-EFIAPI
-USBKeyboardRepeatHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
- Timer handler for Repeat Key timer.
-
- Arguments:
- Event - The Repeat Key event.
- Context - Points to the USB_KB_DEV instance.
-
- Returns:
-
---*/
-{
- USB_KB_DEV *UsbKeyboardDevice;
-
- UsbKeyboardDevice = (USB_KB_DEV *) Context;
-
- //
- // Do nothing when there is no repeat key.
- //
- if (UsbKeyboardDevice->RepeatKey != 0) {
- //
- // Inserts one Repeat key into keyboard buffer,
- //
- InsertKeyCode (
- &(UsbKeyboardDevice->KeyboardBuffer),
- UsbKeyboardDevice->RepeatKey,
- 1
- );
-
- //
- // set repeate rate for repeat key generation.
- //
- gBS->SetTimer (
- UsbKeyboardDevice->RepeatTimer,
- TimerRelative,
- USBKBD_REPEAT_RATE
- );
-
- }
-}
-
-VOID
-EFIAPI
-USBKeyboardRecoveryHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
- Timer handler for Delayed Recovery timer.
-
- Arguments:
- Event - The Delayed Recovery event.
- Context - Points to the USB_KB_DEV instance.
-
- Returns:
-
---*/
-{
-
- USB_KB_DEV *UsbKeyboardDevice;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 PacketSize;
-
- UsbKeyboardDevice = (USB_KB_DEV *) Context;
-
- UsbIo = UsbKeyboardDevice->UsbIo;
-
- PacketSize = (UINT8) (UsbKeyboardDevice->IntEndpointDescriptor.MaxPacketSize);
-
- UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- UsbKeyboardDevice->IntEndpointDescriptor.EndpointAddress,
- TRUE,
- UsbKeyboardDevice->IntEndpointDescriptor.Interval,
- PacketSize,
- KeyboardHandler,
- UsbKeyboardDevice
- );
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/keyboard.h b/EdkModulePkg/Bus/Usb/UsbKb/Dxe/keyboard.h
deleted file mode 100644
index ef4c1c3..0000000
--- a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/keyboard.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Keyboard.h
-
-Abstract:
-
- Function prototype for USB Keyboard Driver
-
-Revision History
---*/
-
-#ifndef _KEYBOARD_H
-#define _KEYBOARD_H
-
-#include "efikey.h"
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UsbKeyboardComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UsbKeyboardComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-BOOLEAN
-IsUSBKeyboard (
- IN EFI_USB_IO_PROTOCOL *UsbIo
- );
-
-EFI_STATUS
-InitUSBKeyboard (
- IN USB_KB_DEV *UsbKeyboardDevice
- );
-
-EFI_STATUS
-EFIAPI
-KeyboardHandler (
- IN VOID *Data,
- IN UINTN DataLength,
- IN VOID *Context,
- IN UINT32 Result
- );
-
-VOID
-EFIAPI
-USBKeyboardRecoveryHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-EFI_STATUS
-USBParseKey (
- IN OUT USB_KB_DEV *UsbKeyboardDevice,
- OUT UINT8 *KeyChar
- );
-
-EFI_STATUS
-USBKeyCodeToEFIScanCode (
- IN USB_KB_DEV *UsbKeyboardDevice,
- IN UINT8 KeyChar,
- OUT EFI_INPUT_KEY *Key
- );
-
-EFI_STATUS
-InitUSBKeyBuffer (
- IN OUT USB_KB_BUFFER *KeyboardBuffer
- );
-
-BOOLEAN
-IsUSBKeyboardBufferEmpty (
- IN USB_KB_BUFFER *KeyboardBuffer
- );
-
-BOOLEAN
-IsUSBKeyboardBufferFull (
- IN USB_KB_BUFFER *KeyboardBuffer
- );
-
-EFI_STATUS
-InsertKeyCode (
- IN OUT USB_KB_BUFFER *KeyboardBuffer,
- IN UINT8 Key,
- IN UINT8 Down
- );
-
-EFI_STATUS
-RemoveKeyCode (
- IN OUT USB_KB_BUFFER *KeyboardBuffer,
- OUT USB_KEY *UsbKey
- );
-
-VOID
-EFIAPI
-USBKeyboardRepeatHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-EFI_STATUS
-SetKeyLED (
- IN USB_KB_DEV *UsbKeyboardDevice
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/ComponentName.c b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/ComponentName.c
deleted file mode 100644
index 3e34361..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/ComponentName.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "UsbMassStorage.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUsbMassStorageComponentName = {
- UsbMassStorageComponentNameGetDriverName,
- UsbMassStorageComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mUsbMassStorageDriverNameTable[] = {
- { "eng", (CHAR16 *) L"Generic USB Mass Storage Driver" },
- { NULL , NULL }
-};
-
-EFI_STATUS
-EFIAPI
-UsbMassStorageComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUsbMassStorageComponentName.SupportedLanguages,
- mUsbMassStorageDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UsbMassStorageComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.c b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.c
deleted file mode 100644
index daaf3f8..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.c
+++ /dev/null
@@ -1,684 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UsbMassStorage.c
-
-Abstract:
-
- USB Mass Storage Driver
-
-Revision History
-
---*/
-
-#include "UsbMassStorage.h"
-#include "UsbMassStorageHelper.h"
-
-//
-// Block I/O Protocol Interface
-//
-STATIC
-EFI_STATUS
-EFIAPI
-USBFloppyReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-USBFloppyReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-USBFloppyWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- IN VOID *Buffer
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-USBFloppyFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- );
-
-//
-// USB Floppy Driver Global Variables
-//
-EFI_DRIVER_BINDING_PROTOCOL gUSBFloppyDriverBinding = {
- USBFloppyDriverBindingSupported,
- USBFloppyDriverBindingStart,
- USBFloppyDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-USBFloppyDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- that has UsbHcProtocol installed will be supported.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_UNSUPPORTED - This driver does not support this device.
-
---*/
-{
- EFI_STATUS OpenStatus;
- EFI_USB_ATAPI_PROTOCOL *AtapiProtocol;
-
- //
- // check whether EFI_USB_ATAPI_PROTOCOL exists, if it does,
- // then the controller must be a USB Mass Storage Controller
- //
- OpenStatus = gBS->OpenProtocol (
- Controller,
- &gEfiUsbAtapiProtocolGuid,
- (VOID **) &AtapiProtocol,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (OpenStatus)) {
- return OpenStatus;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbAtapiProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-USBFloppyDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Starting the Usb Bus Driver
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_UNSUPPORTED - This driver does not support this device.
- EFI_DEVICE_ERROR - This driver cannot be started due to device
- Error
- EFI_OUT_OF_RESOURCES- Can't allocate memory resources
- EFI_ALREADY_STARTED - Thios driver has been started
---*/
-{
- EFI_STATUS Status;
- EFI_USB_ATAPI_PROTOCOL *AtapiProtocol;
- USB_FLOPPY_DEV *UsbFloppyDevice;
-
- UsbFloppyDevice = NULL;
- //
- // Check whether Usb Atapi Protocol attached on the controller handle.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsbAtapiProtocolGuid,
- (VOID **) &AtapiProtocol,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (USB_FLOPPY_DEV),
- (VOID **) &UsbFloppyDevice
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbAtapiProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
-
- ZeroMem (UsbFloppyDevice, sizeof (USB_FLOPPY_DEV));
-
- UsbFloppyDevice->Handle = Controller;
- UsbFloppyDevice->BlkIo.Media = &UsbFloppyDevice->BlkMedia;
- UsbFloppyDevice->Signature = USB_FLOPPY_DEV_SIGNATURE;
- UsbFloppyDevice->BlkIo.Reset = USBFloppyReset;
- UsbFloppyDevice->BlkIo.ReadBlocks = USBFloppyReadBlocks;
- UsbFloppyDevice->BlkIo.WriteBlocks = USBFloppyWriteBlocks;
- UsbFloppyDevice->BlkIo.FlushBlocks = USBFloppyFlushBlocks;
- UsbFloppyDevice->AtapiProtocol = AtapiProtocol;
-
- //
- // Identify drive type and retrieve media information.
- //
- Status = USBFloppyIdentify (UsbFloppyDevice);
- if (EFI_ERROR (Status)) {
- if (UsbFloppyDevice->SenseData != NULL) {
- gBS->FreePool (UsbFloppyDevice->SenseData);
- }
-
- gBS->FreePool (UsbFloppyDevice);
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbAtapiProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
- //
- // Install Block I/O protocol for the usb floppy device.
- //
- Status = gBS->InstallProtocolInterface (
- &Controller,
- &gEfiBlockIoProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &UsbFloppyDevice->BlkIo
- );
- if (EFI_ERROR (Status)) {
- if (UsbFloppyDevice->SenseData != NULL) {
- gBS->FreePool (UsbFloppyDevice->SenseData);
- }
-
- gBS->FreePool (UsbFloppyDevice);
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbAtapiProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
-
- return EFI_SUCCESS;
-
-}
-
-
-EFI_STATUS
-EFIAPI
-USBFloppyDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop this driver on ControllerHandle. Support stoping any child handles
- created by this driver.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to stop driver on
- NumberOfChildren - Number of Children in the ChildHandleBuffer
- ChildHandleBuffer - List of handles for the children we need to stop.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- others
-
---*/
-{
- EFI_STATUS Status;
- USB_FLOPPY_DEV *UsbFloppyDevice;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
-
- //
- // First find USB_FLOPPY_DEV
- //
- gBS->OpenProtocol (
- Controller,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- UsbFloppyDevice = USB_FLOPPY_DEV_FROM_THIS (BlkIo);
-
- //
- // Uninstall Block I/O protocol from the device handle
- //
- Status = gBS->UninstallProtocolInterface (
- Controller,
- &gEfiBlockIoProtocolGuid,
- &UsbFloppyDevice->BlkIo
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Stop using EFI_USB_ATAPI_PROTOCOL
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbAtapiProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- if (UsbFloppyDevice->SenseData != NULL) {
- gBS->FreePool (UsbFloppyDevice->SenseData);
- }
-
- gBS->FreePool (UsbFloppyDevice);
-
- return EFI_SUCCESS;
-}
-
-
-STATIC
-EFI_STATUS
-EFIAPI
-USBFloppyReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Implements EFI_BLOCK_IO_PROTOCOL.Reset() function.
-
- Arguments:
- This The EFI_BLOCK_IO_PROTOCOL instance.
- ExtendedVerification
- Indicates that the driver may perform a more exhaustive
- verification operation of the device during reset.
- (This parameter is ingored in this driver.)
-
- Returns:
- EFI_SUCCESS - Success
---*/
-{
- USB_FLOPPY_DEV *UsbFloppyDevice;
- EFI_USB_ATAPI_PROTOCOL *UsbAtapiInterface;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- UsbFloppyDevice = USB_FLOPPY_DEV_FROM_THIS (This);
-
- UsbAtapiInterface = UsbFloppyDevice->AtapiProtocol;
-
- //
- // directly calling EFI_USB_ATAPI_PROTOCOL.Reset() to implement reset.
- //
- Status = UsbAtapiInterface->UsbAtapiReset (UsbAtapiInterface, ExtendedVerification);
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-USBFloppyReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
- Routine Description:
- Implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks() function.
-
- Arguments:
- This The EFI_BLOCK_IO_PROTOCOL instance.
- MediaId The media id that the read request is for.
- LBA The starting logical block address to read from on the device.
- BufferSize
- The size of the Buffer in bytes. This must be a multiple of
- the intrinsic block size of the device.
- Buffer A pointer to the destination buffer for the data. The caller
- is responsible for either having implicit or explicit ownership
- of the buffer.
-
- Returns:
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_DEVICE_ERROR - Hardware Error
- EFI_NO_MEDIA - No media
- EFI_MEDIA_CHANGED - Media Change
- EFI_BAD_BUFFER_SIZE - Buffer size is bad
- --*/
-{
- USB_FLOPPY_DEV *UsbFloppyDevice;
- EFI_STATUS Status;
- EFI_BLOCK_IO_MEDIA *Media;
- UINTN BlockSize;
- UINTN NumberOfBlocks;
- BOOLEAN MediaChange;
- EFI_TPL OldTpl;
-
- Status = EFI_SUCCESS;
- MediaChange = FALSE;
- UsbFloppyDevice = USB_FLOPPY_DEV_FROM_THIS (This);
-
- //
- // Check parameters
- //
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- UsbFloppyTestUnitReady (UsbFloppyDevice);
-
- Status = UsbFloppyDetectMedia (UsbFloppyDevice, &MediaChange);
- if (EFI_ERROR (Status)) {
-
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- if (MediaChange) {
- gBS->ReinstallProtocolInterface (
- UsbFloppyDevice->Handle,
- &gEfiBlockIoProtocolGuid,
- &UsbFloppyDevice->BlkIo,
- &UsbFloppyDevice->BlkIo
- );
- }
-
- Media = UsbFloppyDevice->BlkIo.Media;
- BlockSize = Media->BlockSize;
- NumberOfBlocks = BufferSize / BlockSize;
-
- if (!(Media->MediaPresent)) {
- Status = EFI_NO_MEDIA;
- goto Done;
- }
-
- if (MediaId != Media->MediaId) {
- Status = EFI_MEDIA_CHANGED;
- goto Done;
- }
-
- if (BufferSize % BlockSize != 0) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto Done;
- }
-
- if (LBA > Media->LastBlock) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if ((Media->IoAlign > 1) && (((UINTN) Buffer & (Media->IoAlign - 1)) != 0)) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- while (NumberOfBlocks > 0) {
-
- if (NumberOfBlocks > BLOCK_UNIT) {
- Status = USBFloppyRead10 (UsbFloppyDevice, Buffer, LBA, BLOCK_UNIT);
- } else {
- Status = USBFloppyRead10 (UsbFloppyDevice, Buffer, LBA, NumberOfBlocks);
- }
-
- if (EFI_ERROR (Status)) {
- This->Reset (This, TRUE);
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- if (NumberOfBlocks > BLOCK_UNIT) {
- NumberOfBlocks -= BLOCK_UNIT;
- LBA += BLOCK_UNIT;
- Buffer = (UINT8 *) Buffer + This->Media->BlockSize * BLOCK_UNIT;
- } else {
- NumberOfBlocks -= NumberOfBlocks;
- LBA += NumberOfBlocks;
- Buffer = (UINT8 *) Buffer + This->Media->BlockSize * NumberOfBlocks;
- }
- }
-
- Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-USBFloppyWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA LBA,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
- Routine Description:
- Implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks() function.
-
- Arguments:
- This The EFI_BLOCK_IO_PROTOCOL instance.
- MediaId The media id that the write request is for.
- LBA The starting logical block address to be written.
- The caller is responsible for writing to only
- legitimate locations.
- BufferSize
- The size of the Buffer in bytes. This must be a multiple of
- the intrinsic block size of the device.
- Buffer A pointer to the source buffer for the data. The caller
- is responsible for either having implicit or explicit ownership
- of the buffer.
-
- Returns:
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_DEVICE_ERROR - Hardware Error
- EFI_NO_MEDIA - No media
- EFI_MEDIA_CHANGED - Media Change
- EFI_BAD_BUFFER_SIZE - Buffer size is bad
-
---*/
-{
- USB_FLOPPY_DEV *UsbFloppyDevice;
- EFI_STATUS Status;
- EFI_BLOCK_IO_MEDIA *Media;
- UINTN BlockSize;
- UINTN NumberOfBlocks;
- BOOLEAN MediaChange;
- EFI_TPL OldTpl;
-
- Status = EFI_SUCCESS;
- MediaChange = FALSE;
-
- UsbFloppyDevice = USB_FLOPPY_DEV_FROM_THIS (This);
-
- //
- // Check parameters
- //
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferSize == 0) {
- return EFI_SUCCESS;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- UsbFloppyTestUnitReady (UsbFloppyDevice);
-
- Status = UsbFloppyDetectMedia (UsbFloppyDevice, &MediaChange);
- if (EFI_ERROR (Status)) {
-
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- if (MediaChange) {
- gBS->ReinstallProtocolInterface (
- UsbFloppyDevice->Handle,
- &gEfiBlockIoProtocolGuid,
- &UsbFloppyDevice->BlkIo,
- &UsbFloppyDevice->BlkIo
- );
- }
-
- Media = UsbFloppyDevice->BlkIo.Media;
- BlockSize = Media->BlockSize;
- NumberOfBlocks = BufferSize / BlockSize;
-
- if (!(Media->MediaPresent)) {
- Status = EFI_NO_MEDIA;
- goto Done;
- }
-
- if (MediaId != Media->MediaId) {
- Status = EFI_MEDIA_CHANGED;
- goto Done;
- }
-
- if (BufferSize % BlockSize != 0) {
- Status = EFI_BAD_BUFFER_SIZE;
- goto Done;
- }
-
- if (LBA > Media->LastBlock) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if ((Media->IoAlign > 1) && (((UINTN) Buffer & (Media->IoAlign - 1)) != 0)) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if (UsbFloppyDevice->BlkMedia.ReadOnly) {
- Status = EFI_WRITE_PROTECTED;
- goto Done;
- }
-
- while (NumberOfBlocks > 0) {
-
- if (NumberOfBlocks > BLOCK_UNIT) {
- Status = USBFloppyWrite10 (UsbFloppyDevice, Buffer, LBA, BLOCK_UNIT);
- } else {
- Status = USBFloppyWrite10 (UsbFloppyDevice, Buffer, LBA, NumberOfBlocks);
- }
-
- if (EFI_ERROR (Status)) {
- This->Reset (This, TRUE);
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
-
- if (NumberOfBlocks > BLOCK_UNIT) {
- NumberOfBlocks -= BLOCK_UNIT;
- LBA += BLOCK_UNIT;
- Buffer = (UINT8 *) Buffer + This->Media->BlockSize * BLOCK_UNIT;
- } else {
- NumberOfBlocks -= NumberOfBlocks;
- LBA += NumberOfBlocks;
- Buffer = (UINT8 *) Buffer + This->Media->BlockSize * NumberOfBlocks;
- }
- }
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-USBFloppyFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Implements EFI_BLOCK_IO_PROTOCOL.FlushBlocks() function.
- (In this driver, this function just returns EFI_SUCCESS.)
-
- Arguments:
- This The EFI_BLOCK_IO_PROTOCOL instance.
-
- Returns:
- EFI_SUCCESS - Success
---*/
-{
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.h b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.h
deleted file mode 100644
index 27912b0..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UsbMassStorage.h
-
-Abstract:
-
- Header file for USB Mass Storage Driver's Data Structures
-
-Revision History
---*/
-
-#ifndef _USB_FLP_H
-#define _USB_FLP_H
-
-
-#include <IndustryStandard/Usb.h>
-#include "UsbMassStorageData.h"
-
-#define CLASS_MASSTORAGE 8
-#define SUBCLASS_UFI 4
-#define SUBCLASS_8070 5
-#define PROTOCOL_BOT 0x50
-#define PROTOCOL_CBI0 0
-#define PROTOCOL_CBI1 1
-
-#define USBFLOPPY 1 // for those that use ReadCapacity(0x25) command to retrieve media capacity
-#define USBFLOPPY2 2 // for those that use ReadFormatCapacity(0x23) command to retrieve media capacity
-#define USBCDROM 3
-
-#define BLOCK_UNIT 128
-
-#define USB_FLOPPY_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'f', 'l', 'p')
-
-typedef struct {
- UINTN Signature;
-
- EFI_HANDLE Handle;
- EFI_BLOCK_IO_PROTOCOL BlkIo;
- EFI_BLOCK_IO_MEDIA BlkMedia;
- EFI_USB_ATAPI_PROTOCOL *AtapiProtocol;
-
- REQUEST_SENSE_DATA *SenseData;
- UINT8 SenseDataNumber;
- UINT8 DeviceType;
-} USB_FLOPPY_DEV;
-
-#define USB_FLOPPY_DEV_FROM_THIS(a) \
- CR(a, USB_FLOPPY_DEV, BlkIo, USB_FLOPPY_DEV_SIGNATURE)
-
-extern EFI_COMPONENT_NAME_PROTOCOL gUsbMassStorageComponentName;
-
-//
-// Prototypes
-// Driver model protocol interface
-//
-EFI_STATUS
-EFIAPI
-USBFloppyDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-USBFloppyDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-USBFloppyDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UsbMassStorageComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UsbMassStorageComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.msa b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.msa
deleted file mode 100644
index 7eec693..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.msa
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>UsbMassStorage</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>A5C6D68B-E78A-4426-9278-A8F0D9EB4D8F</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for UsbMassStorage module</Abstract>
- <Description>This module provides Block IO interface for USB mass storage class</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>UsbMassStorage</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>UsbMassStorage.h</Filename>
- <Filename>UsbMassStorageData.h</Filename>
- <Filename>UsbMassStorageHelper.h</Filename>
- <Filename>UsbMassStorage.c</Filename>
- <Filename>UsbMassStorageHelper.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiUsbAtapiProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gUSBFloppyDriverBinding</DriverBinding>
- <ComponentName>gUsbMassStorageComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageData.h b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageData.h
deleted file mode 100644
index 56dbcd8..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageData.h
+++ /dev/null
@@ -1,395 +0,0 @@
-/*++
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UsbMassStorageData.h
-
-Abstract:
-
- Header file for USB Mass Storage Device related Data Structures
-
-Revision History
---*/
-
-#ifndef _USB_FLP_DATA_H
-#define _USB_FLP_DATA_H
-
-//
-// bit definition
-//
-#define bit(a) (1 << (a))
-
-//
-// timeout unit is in millisecond.
-//
-
-#define STALL_1_MILLI_SECOND 1000
-#define USBFLPTIMEOUT STALL_1_MILLI_SECOND
-#define USBDATATIMEOUT 2 * STALL_1_MILLI_SECOND
-//
-// ATAPI Packet Command
-//
-#pragma pack(1)
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1;
- UINT8 reserved_2;
- UINT8 reserved_3;
- UINT8 reserved_4;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
- UINT8 reserved_8;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} TEST_UNIT_READY_CMD;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1 : 4;
- UINT8 lun : 4;
- UINT8 page_code;
- UINT8 reserved_3;
- UINT8 allocation_length;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
- UINT8 reserved_8;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} INQUIRY_CMD;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1 : 4;
- UINT8 lun : 4;
- UINT8 reserved_2;
- UINT8 reserved_3;
- UINT8 allocation_length;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
- UINT8 reserved_8;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} REQUEST_SENSE_CMD;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1 : 4;
- UINT8 lun : 4;
- UINT8 page_code : 6;
- UINT8 page_control : 2;
- UINT8 reserved_3;
- UINT8 reserved_4;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 parameter_list_length_hi;
- UINT8 parameter_list_length_lo;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} MODE_SENSE_CMD_UFI;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1 : 3;
- UINT8 dbd : 1;
- UINT8 reserved_2 : 1;
- UINT8 lun : 3;
- UINT8 page_code : 6;
- UINT8 page_control : 2;
- UINT8 reserved_3;
- UINT8 allocation_length;
- UINT8 control;
-} MODE_SENSE_CMD_SCSI;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1 : 5;
- UINT8 lun : 3;
- UINT8 Lba0;
- UINT8 Lba1;
- UINT8 Lba2;
- UINT8 Lba3;
- UINT8 reserved_6;
- UINT8 TranLen0;
- UINT8 TranLen1;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} READ10_CMD;
-
-typedef struct {
- UINT8 opcode;
- UINT8 reserved_1;
- UINT8 reserved_2;
- UINT8 reserved_3;
- UINT8 reserved_4;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 allocation_length_hi;
- UINT8 allocation_length_lo;
- UINT8 reserved_9;
- UINT8 reserved_10;
- UINT8 reserved_11;
-} READ_FORMAT_CAP_CMD;
-
-typedef union {
- UINT16 Data16[6];
- TEST_UNIT_READY_CMD TestUnitReady;
- READ10_CMD Read10;
- REQUEST_SENSE_CMD RequestSense;
- INQUIRY_CMD Inquiry;
- MODE_SENSE_CMD_UFI ModeSenseUFI;
- READ_FORMAT_CAP_CMD ReadFormatCapacity;
- MODE_SENSE_CMD_SCSI ModeSenseSCSI;
-} ATAPI_PACKET_COMMAND;
-
-#pragma pack()
-//
-// Packet Command Code
-//
-#define TEST_UNIT_READY 0x00
-#define REZERO 0x01
-#define REQUEST_SENSE 0x03
-#define FORMAT_UNIT 0x04
-#define REASSIGN_BLOCKS 0x07
-#define INQUIRY 0x12
-#define START_STOP_UNIT 0x1B
-#define PREVENT_ALLOW_MEDIA_REMOVAL 0x1E
-#define READ_FORMAT_CAPACITY 0x23
-#define OLD_FORMAT_UNIT 0x24
-#define READ_CAPACITY 0x25
-#define READ_10 0x28
-#define WRITE_10 0x2A
-#define SEEK 0x2B
-#define SEND_DIAGNOSTICS 0x3D
-#define WRITE_VERIFY 0x2E
-#define VERIFY 0x2F
-#define READ_DEFECT_DATA 0x37
-#define WRITE_BUFFER 0x38
-#define READ_BUFFER 0x3C
-#define READ_LONG 0x3E
-#define WRITE_LONG 0x3F
-#define MODE_SELECT 0x55
-#define UFI_MODE_SENSE5A 0x5A
-#define SCSI_MODE_SENSE1A 0x1A
-#define READ_12 0xA8
-#define WRITE_12 0xAA
-#define MAX_ATAPI_BYTE_COUNT (0xfffe)
-
-//
-// Sense Key
-//
-#define REQUEST_SENSE_ERROR (0x70)
-#define SK_NO_SENSE (0x0)
-#define SK_RECOVERY_ERROR (0x1)
-#define SK_NOT_READY (0x2)
-#define SK_MEDIUM_ERROR (0x3)
-#define SK_HARDWARE_ERROR (0x4)
-#define SK_ILLEGAL_REQUEST (0x5)
-#define SK_UNIT_ATTENTION (0x6)
-#define SK_DATA_PROTECT (0x7)
-#define SK_BLANK_CHECK (0x8)
-#define SK_VENDOR_SPECIFIC (0x9)
-#define SK_RESERVED_A (0xA)
-#define SK_ABORT (0xB)
-#define SK_RESERVED_C (0xC)
-#define SK_OVERFLOW (0xD)
-#define SK_MISCOMPARE (0xE)
-#define SK_RESERVED_F (0xF)
-
-//
-// Additional Sense Codes
-//
-#define ASC_NOT_READY (0x04)
-#define ASC_MEDIA_ERR1 (0x10)
-#define ASC_MEDIA_ERR2 (0x11)
-#define ASC_MEDIA_ERR3 (0x14)
-#define ASC_MEDIA_ERR4 (0x30)
-#define ASC_MEDIA_UPSIDE_DOWN (0x06)
-#define ASC_INVALID_CMD (0x20)
-#define ASC_LBA_OUT_OF_RANGE (0x21)
-#define ASC_INVALID_FIELD (0x24)
-#define ASC_WRITE_PROTECTED (0x27)
-#define ASC_MEDIA_CHANGE (0x28)
-#define ASC_RESET (0x29) /* Power On Reset or Bus Reset occurred */
-#define ASC_ILLEGAL_FIELD (0x26)
-#define ASC_NO_MEDIA (0x3A)
-#define ASC_ILLEGAL_MODE_FOR_THIS_TRACK (0x64)
-#define ASC_LOGICAL_UNIT_STATUS (0x08)
-
-//
-// Additional Sense Code Qualifier
-//
-#define ASCQ_IN_PROGRESS (0x01)
-#define ASCQ_DEVICE_BUSY (0xff)
-#define ASCQ_LOGICAL_UNIT_FAILURE (0x00)
-#define ASCQ_LOGICAL_UNIT_TIMEOUT (0x01)
-#define ASCQ_LOGICAL_UNIT_OVERRUN (0x80)
-
-#define SETFEATURE TRUE
-#define CLEARFEATURE FALSE
-
-//
-// ATAPI Data structure
-//
-#pragma pack(1)
-
-typedef struct {
- UINT8 peripheral_type;
- UINT8 RMB;
- UINT8 version;
- UINT8 response_data_format;
- UINT8 addnl_length;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
- UINT8 vendor_info[8];
- UINT8 product_id[12];
- UINT8 eeprom_product_code[4];
- UINT8 firmware_rev_level[4];
-} USB_INQUIRY_DATA;
-
-typedef struct {
- UINT8 error_code : 7;
- UINT8 valid : 1;
- UINT8 reserved_1;
- UINT8 sense_key : 4;
- UINT8 reserved_21 : 1;
- UINT8 ILI : 1;
- UINT8 reserved_22 : 2;
- UINT8 vendor_specific_3;
- UINT8 vendor_specific_4;
- UINT8 vendor_specific_5;
- UINT8 vendor_specific_6;
- UINT8 addnl_sense_length; // n - 7
- UINT8 vendor_specific_8;
- UINT8 vendor_specific_9;
- UINT8 vendor_specific_10;
- UINT8 vendor_specific_11;
- UINT8 addnl_sense_code; // mandatory
- UINT8 addnl_sense_code_qualifier; // mandatory
- UINT8 field_replaceable_unit_code; // optional
- UINT8 reserved_15;
- UINT8 reserved_16;
- UINT8 reserved_17;
- //
- // Followed by additional sense bytes : FIXME
- //
-} REQUEST_SENSE_DATA;
-
-typedef struct {
- UINT8 LastLba3;
- UINT8 LastLba2;
- UINT8 LastLba1;
- UINT8 LastLba0;
- UINT8 BlockSize3;
- UINT8 BlockSize2;
- UINT8 BlockSize1;
- UINT8 BlockSize0;
-} READ_CAPACITY_DATA;
-
-typedef struct {
- UINT8 reserved_0;
- UINT8 reserved_1;
- UINT8 reserved_2;
- UINT8 Capacity_Length;
- UINT8 LastLba3;
- UINT8 LastLba2;
- UINT8 LastLba1;
- UINT8 LastLba0;
- UINT8 DesCode : 2;
- UINT8 reserved_9 : 6;
- UINT8 BlockSize2;
- UINT8 BlockSize1;
- UINT8 BlockSize0;
-} READ_FORMAT_CAPACITY_DATA;
-
-typedef struct {
- UINT8 mode_data_len_hi;
- UINT8 mode_data_len_lo;
- UINT8 media_type_code;
- UINT8 reserved_3_0 : 4;
- UINT8 dpofua : 1;
- UINT8 reserved_3_1 : 2;
- UINT8 write_protected : 1;
- UINT8 reserved_4;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
-} UFI_MODE_PARAMETER_HEADER;
-
-typedef struct {
- UINT8 mode_data_len;
- UINT8 media_type_code;
- UINT8 speed : 4;
- UINT8 buffered_mode : 3;
- UINT8 write_protected : 1;
- UINT8 block_descritptor_length;
-} SCSI_MODE_PARAMETER_HEADER6;
-
-typedef struct {
- UINT8 page_code : 6;
- UINT8 reserved_0 : 1;
- UINT8 parameter_savable : 1;
- UINT8 page_length;
- UINT8 transfer_rate_msb;
- UINT8 transfer_rate_lsb;
- UINT8 number_of_heads;
- UINT8 sectors_per_track;
- UINT8 databytes_per_sector_msb;
- UINT8 databytes_per_sector_lsb;
- UINT8 number_of_cylinders_msb;
- UINT8 number_of_cylinders_lsb;
- UINT8 reserved_10_18[9];
- UINT8 motor_on_delay;
- UINT8 motor_off_delay;
- UINT8 reserved_21_27[7];
- UINT8 medium_rotation_rate_msb;
- UINT8 medium_rotation_rate_lsb;
- UINT8 reserved_30_31[2];
-} FLEXIBLE_DISK_PAGE;
-
-typedef struct {
- UFI_MODE_PARAMETER_HEADER mode_param_header;
- FLEXIBLE_DISK_PAGE flex_disk_page;
-} UFI_MODE_PARAMETER_PAGE_5;
-
-typedef struct {
- UINT8 page_code : 6;
- UINT8 reserved_0 : 1;
- UINT8 parameter_savable : 1;
- UINT8 page_length;
- UINT8 reserved_2;
- UINT8 inactive_time_multplier : 4;
- UINT8 reserved_3 : 4;
- UINT8 software_write_protect : 1;
- UINT8 disable_media_access : 1;
- UINT8 reserved_4 : 6;
- UINT8 reserved_5;
- UINT8 reserved_6;
- UINT8 reserved_7;
-} TIMER_AND_PROTECT_PAGE;
-
-typedef struct {
- UFI_MODE_PARAMETER_HEADER mode_param_header;
- TIMER_AND_PROTECT_PAGE time_and_protect_page;
-} UFI_MODE_PARAMETER_PAGE_1C;
-
-#pragma pack()
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c
deleted file mode 100644
index 6483601..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c
+++ /dev/null
@@ -1,1542 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UsbMassStorageHelper.c
-
-Abstract:
-
- Helper functions for USB Mass Storage Driver
-
-Revision History
-
---*/
-
-#include "UsbMassStorageHelper.h"
-
-STATIC
-BOOLEAN
-IsNoMedia (
- IN REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- );
-
-STATIC
-BOOLEAN
-IsMediaError (
- IN REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- );
-
-STATIC
-BOOLEAN
-IsMediaChange (
- IN REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- );
-
-STATIC
-BOOLEAN
-IsDriveReady (
- IN REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts,
- OUT BOOLEAN *NeedRetry
- );
-
-STATIC
-BOOLEAN
-IsMediaWriteProtected (
- IN REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- );
-
-
-EFI_STATUS
-USBFloppyPacketCommand (
- USB_FLOPPY_DEV *UsbFloppyDevice,
- VOID *Command,
- UINT8 CommandSize,
- VOID *DataBuffer,
- UINT32 BufferLength,
- EFI_USB_DATA_DIRECTION Direction,
- UINT16 TimeOutInMilliSeconds
- )
-/*++
-
- Routine Description:
- Sends Packet Command to USB Floppy Drive.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
- Command - A pointer to the command packet.
- CommandSize - Indicates the size of the command packet.
- DataBuffer - A pointer to the buffer for the data transfer
- after the command packet.
- BufferLength - Indicates the size of the Data Buffer.
- Direction - Transfer Direction
- TimeOutInMilliSeconds - Timeout Value
- Returns:
- EFI_SUCCESS - Success
---*/
-{
- EFI_USB_ATAPI_PROTOCOL *UsbAtapiInterface;
- EFI_STATUS Status;
-
- UsbAtapiInterface = UsbFloppyDevice->AtapiProtocol;
- //
- // Directly calling EFI_USB_ATAPI_PROTOCOL.UsbAtapiPacketCmd()
- // to perform the command request.
- //
- Status = UsbAtapiInterface->UsbAtapiPacketCmd (
- UsbAtapiInterface,
- Command,
- CommandSize,
- DataBuffer,
- BufferLength,
- Direction,
- TimeOutInMilliSeconds
- );
-
- return Status;
-}
-
-EFI_STATUS
-USBFloppyIdentify (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- )
-/*++
-
- Routine Description:
- Retrieves device information to tell the device type.
-
- Arguments:
- UsbFloppyDevice The USB_FLOPPY_DEV instance.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
---*/
-{
-
- EFI_STATUS Status;
- USB_INQUIRY_DATA *Idata;
- BOOLEAN MediaChange;
-
- //
- // Send Inquiry Packet Command to get INQUIRY data.
- //
- Status = USBFloppyInquiry (UsbFloppyDevice, &Idata);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Get media removable info from INQUIRY data.
- //
- UsbFloppyDevice->BlkIo.Media->RemovableMedia = (UINT8) ((Idata->RMB & 0x80) == 0x80);
-
- //
- // Identify device type via INQUIRY data.
- //
- switch ((Idata->peripheral_type) & 0x1f) {
- //
- // Floppy
- //
- case 0x00:
- UsbFloppyDevice->DeviceType = USBFLOPPY;
- UsbFloppyDevice->BlkIo.Media->MediaId = 0;
- UsbFloppyDevice->BlkIo.Media->MediaPresent = FALSE;
- UsbFloppyDevice->BlkIo.Media->LastBlock = 0;
- UsbFloppyDevice->BlkIo.Media->BlockSize = 0x200;
- break;
-
- //
- // CD-ROM
- //
- case 0x05:
- UsbFloppyDevice->DeviceType = USBCDROM;
- UsbFloppyDevice->BlkIo.Media->MediaId = 0;
- UsbFloppyDevice->BlkIo.Media->MediaPresent = FALSE;
- UsbFloppyDevice->BlkIo.Media->LastBlock = 0;
- UsbFloppyDevice->BlkIo.Media->BlockSize = 0x800;
- UsbFloppyDevice->BlkIo.Media->ReadOnly = TRUE;
- break;
-
- default:
- gBS->FreePool (Idata);
- return EFI_DEVICE_ERROR;
- };
-
- //
- // Initialize some device specific data.
- //
- //
- // original sense data numbers
- //
- UsbFloppyDevice->SenseDataNumber = 6;
-
- if (UsbFloppyDevice->SenseData != NULL) {
- gBS->FreePool (UsbFloppyDevice->SenseData);
- UsbFloppyDevice->SenseData = NULL;
- }
-
- UsbFloppyDevice->SenseData = AllocatePool (UsbFloppyDevice->SenseDataNumber * sizeof (REQUEST_SENSE_DATA));
-
- if (UsbFloppyDevice->SenseData == NULL) {
- gBS->FreePool (Idata);
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Get media information.
- //
- UsbFloppyDetectMedia (UsbFloppyDevice, &MediaChange);
-
- gBS->FreePool (Idata);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-USBFloppyInquiry (
- IN USB_FLOPPY_DEV *UsbFloppyDevice,
- OUT USB_INQUIRY_DATA **Idata
- )
-/*++
-
- Routine Description:
- Send Inquiry Packet Command to device and retrieve Inquiry Data.
-
- Arguments:
- UsbFloppyDevice The USB_FLOPPY_DEV instance.
- Idata A pointer pointing to the address of
- Inquiry Data.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
---*/
-{
- ATAPI_PACKET_COMMAND Packet;
- EFI_STATUS Status;
-
-
- //
- // prepare command packet for the Inquiry Packet Command.
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.Inquiry.opcode = INQUIRY;
- Packet.Inquiry.page_code = 0;
- Packet.Inquiry.allocation_length = sizeof (USB_INQUIRY_DATA);
-
- *Idata = AllocateZeroPool (sizeof (USB_INQUIRY_DATA));
- if (*Idata == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Send command packet and retrieve requested Inquiry Data.
- //
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (ATAPI_PACKET_COMMAND),
- (VOID *) (*Idata),
- sizeof (USB_INQUIRY_DATA),
- EfiUsbDataIn,
- USBFLPTIMEOUT * 3
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (*Idata);
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-USBFloppyRead10 (
- IN USB_FLOPPY_DEV *UsbFloppyDevice,
- IN VOID *Buffer,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- )
-/*++
-
- Routine Description:
- Sends Read10 Packet Command to device to perform data transfer
- from device to host.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
- Buffer - A pointer to the destination buffer for the data.
- The caller is responsible for either having implicit
- or explicit ownership of the buffer.
- Lba - The starting logical block address to read from
- on the device.
- NumberOfBlocks - Indicates the number of blocks that the read
- operation requests.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
---*/
-{
- ATAPI_PACKET_COMMAND Packet;
- READ10_CMD *Read10Packet;
- UINT16 MaxBlock;
- UINT16 BlocksRemaining;
- UINT16 SectorCount;
- UINT32 Lba32;
- UINT32 BlockSize;
- UINT32 ByteCount;
- VOID *ptrBuffer;
- EFI_STATUS Status;
- UINT16 TimeOut;
- UINT8 Index;
-
-
- //
- // prepare command packet for the Inquiry Packet Command.
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Read10Packet = &Packet.Read10;
- Lba32 = (UINT32) Lba;
- ptrBuffer = Buffer;
- BlockSize = UsbFloppyDevice->BlkIo.Media->BlockSize;
-
- MaxBlock = (UINT16) (65536 / BlockSize);
- BlocksRemaining = (UINT16) NumberOfBlocks;
-
- Status = EFI_SUCCESS;
- while (BlocksRemaining > 0) {
- if (BlocksRemaining <= MaxBlock) {
- SectorCount = BlocksRemaining;
- } else {
- SectorCount = MaxBlock;
- }
-
- for (Index = 0; Index < 3; Index ++) {
-
- //
- // fill the Packet data structure
- //
- Read10Packet->opcode = READ_10;
- //
- // Lba0 ~ Lba3 specify the start logical block address of the data transfer.
- // Lba0 is MSB, Lba3 is LSB
- //
- Read10Packet->Lba3 = (UINT8) (Lba32 & 0xff);
- Read10Packet->Lba2 = (UINT8) (Lba32 >> 8);
- Read10Packet->Lba1 = (UINT8) (Lba32 >> 16);
- Read10Packet->Lba0 = (UINT8) (Lba32 >> 24);
-
- //
- // TranLen0 ~ TranLen1 specify the transfer length in block unit.
- // TranLen0 is MSB, TranLen is LSB
- //
- Read10Packet->TranLen1 = (UINT8) (SectorCount & 0xff);
- Read10Packet->TranLen0 = (UINT8) (SectorCount >> 8);
-
- ByteCount = SectorCount * BlockSize;
-
- TimeOut = (UINT16) (SectorCount * USBDATATIMEOUT);
-
-
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (ATAPI_PACKET_COMMAND),
- (VOID *) ptrBuffer,
- ByteCount,
- EfiUsbDataIn,
- TimeOut
- );
- if (!EFI_ERROR (Status)) {
- break;
- }
- }
-
- if (Index == 3) {
- return EFI_DEVICE_ERROR;
- }
-
- Lba32 += SectorCount;
- ptrBuffer = (UINT8 *) ptrBuffer + SectorCount * BlockSize;
- BlocksRemaining = (UINT16) (BlocksRemaining - SectorCount);
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-USBFloppyReadCapacity (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- )
-/*++
-
- Routine Description:
- Retrieves media capacity information via
- sending Read Capacity Packet Command.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
---*/
-{
- //
- // status returned by Read Capacity Packet Command
- //
- EFI_STATUS Status;
- ATAPI_PACKET_COMMAND Packet;
-
- //
- // used for capacity data returned from Usb Floppy
- //
- READ_CAPACITY_DATA Data;
-
- ZeroMem (&Data, sizeof (Data));
-
-
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.Inquiry.opcode = READ_CAPACITY;
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (ATAPI_PACKET_COMMAND),
- (VOID *) &Data,
- sizeof (READ_CAPACITY_DATA),
- EfiUsbDataIn,
- USBFLPTIMEOUT
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- UsbFloppyDevice->BlkIo.Media->LastBlock = (Data.LastLba3 << 24) |
- (Data.LastLba2 << 16) |
- (Data.LastLba1 << 8) |
- Data.LastLba0;
-
- UsbFloppyDevice->BlkIo.Media->MediaPresent = TRUE;
-
- UsbFloppyDevice->BlkIo.Media->BlockSize = 0x800;
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-USBFloppyReadFormatCapacity (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- )
-/*++
-
- Routine Description:
- Retrieves media capacity information via sending Read Format
- Capacity Packet Command.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
---*/
-{
- //
- // status returned by Read Capacity Packet Command
- //
- EFI_STATUS Status;
- ATAPI_PACKET_COMMAND Packet;
-
- //
- // used for capacity data returned from Usb Floppy
- //
- READ_FORMAT_CAPACITY_DATA FormatData;
-
- ZeroMem (&FormatData, sizeof (FormatData));
-
-
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.ReadFormatCapacity.opcode = READ_FORMAT_CAPACITY;
- Packet.ReadFormatCapacity.allocation_length_lo = 12;
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (ATAPI_PACKET_COMMAND),
- (VOID *) &FormatData,
- sizeof (READ_FORMAT_CAPACITY_DATA),
- EfiUsbDataIn,
- USBFLPTIMEOUT
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- if (FormatData.DesCode == 3) {
- //
- // Media is not present
- //
- UsbFloppyDevice->BlkIo.Media->MediaId = 0;
- UsbFloppyDevice->BlkIo.Media->MediaPresent = FALSE;
- UsbFloppyDevice->BlkIo.Media->LastBlock = 0;
- } else {
-
- UsbFloppyDevice->BlkIo.Media->LastBlock = (FormatData.LastLba3 << 24) |
- (FormatData.LastLba2 << 16) |
- (FormatData.LastLba1 << 8) |
- FormatData.LastLba0;
-
- UsbFloppyDevice->BlkIo.Media->LastBlock--;
-
- UsbFloppyDevice->BlkIo.Media->BlockSize = (FormatData.BlockSize2 << 16) |
- (FormatData.BlockSize1 << 8) |
- FormatData.BlockSize0;
-
- UsbFloppyDevice->BlkIo.Media->MediaPresent = TRUE;
-
- UsbFloppyDevice->BlkIo.Media->BlockSize = 0x200;
-
- }
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-UsbFloppyRequestSense (
- IN USB_FLOPPY_DEV *UsbFloppyDevice,
- OUT UINTN *SenseCounts
- )
-/*++
-
- Routine Description:
- Retrieves Sense Data from device via
- sending Request Sense Packet Command.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
- SenseCounts - A pointer to the number of Sense Data returned.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
---*/
-{
- EFI_STATUS Status;
- REQUEST_SENSE_DATA *Sense;
- UINT8 *Ptr;
- BOOLEAN SenseReq;
- ATAPI_PACKET_COMMAND Packet;
-
-
- *SenseCounts = 0;
-
- ZeroMem (
- UsbFloppyDevice->SenseData,
- sizeof (REQUEST_SENSE_DATA) * (UsbFloppyDevice->SenseDataNumber)
- );
- //
- // fill command packet for Request Sense Packet Command
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.RequestSense.opcode = REQUEST_SENSE;
- Packet.RequestSense.allocation_length = sizeof (REQUEST_SENSE_DATA);
-
- //
- // initialize pointer
- //
- Ptr = (UINT8 *) (UsbFloppyDevice->SenseData);
-
- //
- // request sense data from device continuously
- // until no sense data exists in the device.
- //
- for (SenseReq = TRUE; SenseReq;) {
-
- Sense = (REQUEST_SENSE_DATA *) Ptr;
-
- //
- // send out Request Sense Packet Command and get one Sense
- // data from device.
- //
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (ATAPI_PACKET_COMMAND),
- (VOID *) Ptr,
- sizeof (REQUEST_SENSE_DATA),
- EfiUsbDataIn,
- USBFLPTIMEOUT
- );
- //
- // failed to get Sense data
- //
- if (EFI_ERROR (Status)) {
- //
- // Recovery the device back to normal state.
- //
- UsbFloppyDevice->AtapiProtocol->UsbAtapiReset (
- UsbFloppyDevice->AtapiProtocol,
- TRUE
- );
-
- if (*SenseCounts == 0) {
- //
- // never retrieved any sense data from device,
- // just return error.
- //
- return EFI_DEVICE_ERROR;
- } else {
- //
- // has retrieved some sense data from device,
- // so return success.
- //
- return EFI_SUCCESS;
- }
- }
-
- if (Sense->sense_key != SK_NO_SENSE) {
- //
- // Ptr is byte based pointer
- //
- Ptr += sizeof (REQUEST_SENSE_DATA);
-
- (*SenseCounts)++;
-
- } else {
- //
- // when no sense key, skip out the loop
- //
- SenseReq = FALSE;
- }
-
- //
- // If the sense key numbers exceed Sense Data Buffer size,
- // just skip the loop and do not fetch the sense key in this function.
- //
- if (*SenseCounts == UsbFloppyDevice->SenseDataNumber) {
- SenseReq = FALSE;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UsbFloppyTestUnitReady (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- )
-/*++
-
- Routine Description:
- Sends Test Unit ReadyPacket Command to the device.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
---*/
-{
- ATAPI_PACKET_COMMAND Packet;
- EFI_STATUS Status;
- UINT32 RetryIndex;
- UINT32 MaximumRetryTimes;
-
- MaximumRetryTimes = 2;
- //
- // fill command packet
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.TestUnitReady.opcode = TEST_UNIT_READY;
-
- //
- // send command packet
- //
- Status = EFI_DEVICE_ERROR;
-
- for (RetryIndex = 0; RetryIndex < MaximumRetryTimes && EFI_ERROR (Status); RetryIndex++) {
-
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (ATAPI_PACKET_COMMAND),
- NULL,
- 0,
- EfiUsbNoData,
- USBFLPTIMEOUT
- );
-
- if (EFI_ERROR (Status)) {
- gBS->Stall (100 * STALL_1_MILLI_SECOND);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-USBFloppyWrite10 (
- IN USB_FLOPPY_DEV *UsbFloppyDevice,
- IN VOID *Buffer,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- )
-/*++
-
- Routine Description:
- Sends Write10 Packet Command to device to perform data transfer
- from host to device.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
- Buffer - A pointer to the source buffer for the data.
- The caller is responsible for either having implicit
- or explicit ownership of the buffer.
- Lba - The starting logical block address to written to
- the device.
- NumberOfBlocks - Indicates the number of blocks that the write
- operation requests.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
---*/
-{
- ATAPI_PACKET_COMMAND Packet;
- READ10_CMD *Write10Packet;
- UINT16 MaxBlock;
- UINT16 BlocksRemaining;
- UINT16 SectorCount;
- UINT32 Lba32;
- UINT32 BlockSize;
- UINT32 ByteCount;
- VOID *ptrBuffer;
- EFI_STATUS Status;
- UINT16 TimeOut;
- UINT8 Index;
-
-
- //
- // prepare command packet for the Write10 Packet Command.
- //
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Write10Packet = &Packet.Read10;
- Lba32 = (UINT32) Lba;
- ptrBuffer = Buffer;
- BlockSize = UsbFloppyDevice->BlkIo.Media->BlockSize;
-
- MaxBlock = (UINT16) (65536 / BlockSize);
- BlocksRemaining = (UINT16) NumberOfBlocks;
-
- Status = EFI_SUCCESS;
- while (BlocksRemaining > 0) {
-
- if (BlocksRemaining <= MaxBlock) {
- SectorCount = BlocksRemaining;
- } else {
- SectorCount = MaxBlock;
- }
-
- for (Index = 0; Index < 3; Index ++) {
- //
- // fill the Packet data structure
- //
- Write10Packet->opcode = WRITE_10;
-
- //
- // Lba0 ~ Lba3 specify the start logical block address
- // of the data transfer.
- // Lba0 is MSB, Lba3 is LSB
- //
- Write10Packet->Lba3 = (UINT8) (Lba32 & 0xff);
- Write10Packet->Lba2 = (UINT8) (Lba32 >> 8);
- Write10Packet->Lba1 = (UINT8) (Lba32 >> 16);
- Write10Packet->Lba0 = (UINT8) (Lba32 >> 24);
-
- //
- // TranLen0 ~ TranLen1 specify the transfer length in block unit.
- // TranLen0 is MSB, TranLen is LSB
- //
- Write10Packet->TranLen1 = (UINT8) (SectorCount & 0xff);
- Write10Packet->TranLen0 = (UINT8) (SectorCount >> 8);
-
- ByteCount = SectorCount * BlockSize;
-
- TimeOut = (UINT16) (SectorCount * USBDATATIMEOUT);
-
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (ATAPI_PACKET_COMMAND),
- (VOID *) ptrBuffer,
- ByteCount,
- EfiUsbDataOut,
- TimeOut
- );
- if (!EFI_ERROR (Status)) {
- break;
- }
- }
-
- if (Index == 3) {
- return EFI_DEVICE_ERROR;
- }
-
- Lba32 += SectorCount;
- ptrBuffer = (UINT8 *) ptrBuffer + SectorCount * BlockSize;
- BlocksRemaining = (UINT16) (BlocksRemaining - SectorCount);
- }
-
- return Status;
-}
-
-EFI_STATUS
-UsbFloppyDetectMedia (
- IN USB_FLOPPY_DEV *UsbFloppyDevice,
- OUT BOOLEAN *MediaChange
- )
-/*++
-
- Routine Description:
- Retrieves media information.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
- MediaChange - Indicates whether media was changed.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
- EFI_INVALID_PARAMETER - Parameter is error
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS FloppyStatus;
- //
- // the following variables are used to record previous media information
- //
- EFI_BLOCK_IO_MEDIA OldMediaInfo;
- UINTN SenseCounts;
- UINTN RetryIndex;
- UINTN RetryTimes;
- UINTN MaximumRetryTimes;
- BOOLEAN NeedRetry;
- BOOLEAN NeedReadCapacity;
- //
- // a flag used to determine whether need to perform Read Capacity command.
- //
-
- //
- // init
- //
- Status = EFI_SUCCESS;
- FloppyStatus = EFI_SUCCESS;
- CopyMem (&OldMediaInfo, UsbFloppyDevice->BlkIo.Media, sizeof (OldMediaInfo));
- *MediaChange = FALSE;
- NeedReadCapacity = TRUE;
-
- //
- // if there is no media present,or media not changed,
- // the request sense command will detect faster than read capacity command.
- // read capacity command can be bypassed, thus improve performance.
- //
- SenseCounts = 0;
- Status = UsbFloppyRequestSense (UsbFloppyDevice, &SenseCounts);
-
- if (!EFI_ERROR (Status)) {
-
- //
- // No Media
- //
- if (IsNoMedia (UsbFloppyDevice->SenseData, SenseCounts)) {
-
- NeedReadCapacity = FALSE;
- UsbFloppyDevice->BlkIo.Media->MediaId = 0;
- UsbFloppyDevice->BlkIo.Media->MediaPresent = FALSE;
- UsbFloppyDevice->BlkIo.Media->LastBlock = 0;
- } else {
- //
- // Media Changed
- //
- if (IsMediaChange (UsbFloppyDevice->SenseData, SenseCounts)) {
- UsbFloppyDevice->BlkIo.Media->MediaId++;
- }
-
- //
- // Media Write-protected
- //
- if (IsMediaWriteProtected (UsbFloppyDevice->SenseData, SenseCounts)) {
- UsbFloppyDevice->BlkIo.Media->ReadOnly = TRUE;
- }
-
- //
- // Media Error
- //
- if (IsMediaError (UsbFloppyDevice->SenseData, SenseCounts)) {
- //
- // if media error encountered, make it look like no media present.
- //
- UsbFloppyDevice->BlkIo.Media->MediaId = 0;
- UsbFloppyDevice->BlkIo.Media->MediaPresent = FALSE;
- UsbFloppyDevice->BlkIo.Media->LastBlock = 0;
- }
-
- }
-
- }
-
- if (NeedReadCapacity) {
- //
- // at most retry 5 times
- //
- MaximumRetryTimes = 5;
- //
- // initial retry twice
- //
- RetryTimes = 2;
-
- for (RetryIndex = 0; (RetryIndex < RetryTimes) && (RetryIndex < MaximumRetryTimes); RetryIndex++) {
- //
- // Using different command to retrieve media capacity.
- //
- switch (UsbFloppyDevice->DeviceType) {
-
- case USBCDROM:
- Status = USBFloppyReadCapacity (UsbFloppyDevice);
- break;
-
- case USBFLOPPY2:
- UsbMassStorageModeSense (UsbFloppyDevice);
- Status = USBFloppyReadFormatCapacity (UsbFloppyDevice);
- if (EFI_ERROR (Status) || !UsbFloppyDevice->BlkMedia.MediaPresent) {
- //
- // retry the ReadCapacity command
- //
- UsbFloppyDevice->DeviceType = USBFLOPPY;
- Status = EFI_DEVICE_ERROR;
- }
- break;
-
- case USBFLOPPY:
- UsbMassStorageModeSense (UsbFloppyDevice);
- Status = USBFloppyReadCapacity (UsbFloppyDevice);
- if (EFI_ERROR (Status)) {
- //
- // retry the ReadFormatCapacity command
- //
- UsbFloppyDevice->DeviceType = USBFLOPPY2;
- }
- //
- // force the BlockSize to be 0x200.
- //
- UsbFloppyDevice->BlkIo.Media->BlockSize = 0x200;
- break;
-
- default:
- return EFI_INVALID_PARAMETER;
- }
-
- if (!EFI_ERROR (Status)) {
- //
- // skip the loop when read capacity succeeds.
- //
- break;
- }
-
- SenseCounts = 0;
-
- FloppyStatus = UsbFloppyRequestSense (UsbFloppyDevice, &SenseCounts);
-
- //
- // If Request Sense data failed,retry.
- //
- if (EFI_ERROR (FloppyStatus)) {
- //
- // retry once more
- //
- RetryTimes++;
- continue;
- }
- //
- // No Media
- //
- if (IsNoMedia (UsbFloppyDevice->SenseData, SenseCounts)) {
-
- UsbFloppyDevice->BlkIo.Media->MediaId = 0;
- UsbFloppyDevice->BlkIo.Media->MediaPresent = FALSE;
- UsbFloppyDevice->BlkIo.Media->LastBlock = 0;
- break;
- }
-
- if (IsMediaError (UsbFloppyDevice->SenseData, SenseCounts)) {
- //
- // if media error encountered, make it look like no media present.
- //
- UsbFloppyDevice->BlkIo.Media->MediaId = 0;
- UsbFloppyDevice->BlkIo.Media->MediaPresent = FALSE;
- UsbFloppyDevice->BlkIo.Media->LastBlock = 0;
- break;
- }
-
- if (IsMediaWriteProtected (UsbFloppyDevice->SenseData, SenseCounts)) {
- UsbFloppyDevice->BlkIo.Media->ReadOnly = TRUE;
- continue;
- }
-
- if (!IsDriveReady (UsbFloppyDevice->SenseData, SenseCounts, &NeedRetry)) {
-
- //
- // Drive not ready: if NeedRetry, then retry once more;
- // else return error
- //
- if (NeedRetry) {
- //
- // Stall 0.1 second to wait for drive becoming ready
- //
- gBS->Stall (100 * STALL_1_MILLI_SECOND);
- //
- // reset retry variable to zero,
- // to make it retry for "drive in progress of becoming ready".
- //
- RetryIndex = 0;
- continue;
- } else {
- return EFI_DEVICE_ERROR;
- }
- }
- //
- // if read capacity fail not for above reasons, retry once more
- //
- RetryTimes++;
-
- }
- //
- // ENDFOR
- //
-
- //
- // tell whether the readcapacity process is successful or not
- // ("Status" variable record the latest status returned
- // by ReadCapacity AND "FloppyStatus" record the latest status
- // returned by RequestSense)
- //
- if (EFI_ERROR (Status) && EFI_ERROR (FloppyStatus)) {
- return EFI_DEVICE_ERROR;
- }
-
- }
-
- if (UsbFloppyDevice->BlkIo.Media->MediaPresent != OldMediaInfo.MediaPresent) {
-
- if (UsbFloppyDevice->BlkIo.Media->MediaPresent) {
- UsbFloppyDevice->BlkIo.Media->MediaId = 1;
- }
-
- *MediaChange = TRUE;
- }
-
- if (UsbFloppyDevice->BlkIo.Media->ReadOnly != OldMediaInfo.ReadOnly) {
- *MediaChange = TRUE;
- UsbFloppyDevice->BlkIo.Media->MediaId += 1;
- }
-
- if (UsbFloppyDevice->BlkIo.Media->BlockSize != OldMediaInfo.BlockSize) {
- *MediaChange = TRUE;
- UsbFloppyDevice->BlkIo.Media->MediaId += 1;
- }
-
- if (UsbFloppyDevice->BlkIo.Media->LastBlock != OldMediaInfo.LastBlock) {
- *MediaChange = TRUE;
- UsbFloppyDevice->BlkIo.Media->MediaId += 1;
- }
-
- if (UsbFloppyDevice->BlkIo.Media->MediaId != OldMediaInfo.MediaId) {
- *MediaChange = TRUE;
- }
-
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-UsbFloppyModeSense5APage5 (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- )
-/*++
-
- Routine Description:
- Retrieves media capacity information via sending Read Format
- Capacity Packet Command.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
-
---*/
-{
- //
- // status returned by Read Capacity Packet Command
- //
- EFI_STATUS Status;
- ATAPI_PACKET_COMMAND Packet;
- UFI_MODE_PARAMETER_PAGE_5 ModePage5;
- EFI_LBA LastBlock;
- UINT32 SectorsPerTrack;
- UINT32 NumberOfCylinders;
- UINT32 NumberOfHeads;
- UINT32 DataBytesPerSector;
-
-
- ZeroMem (&ModePage5, sizeof (UFI_MODE_PARAMETER_PAGE_5));
-
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.ModeSenseUFI.opcode = UFI_MODE_SENSE5A;
- //
- // Flexible Disk Page
- //
- Packet.ModeSenseUFI.page_code = 5;
- //
- // current values
- //
- Packet.ModeSenseUFI.page_control = 0;
- Packet.ModeSenseUFI.parameter_list_length_hi = 0;
- Packet.ModeSenseUFI.parameter_list_length_lo = sizeof (UFI_MODE_PARAMETER_PAGE_5);
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (ATAPI_PACKET_COMMAND),
- (VOID *) &ModePage5,
- sizeof (UFI_MODE_PARAMETER_PAGE_5),
- EfiUsbDataIn,
- USBFLPTIMEOUT
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- NumberOfHeads = ModePage5.flex_disk_page.number_of_heads;
- SectorsPerTrack = ModePage5.flex_disk_page.sectors_per_track;
- NumberOfCylinders = ModePage5.flex_disk_page.number_of_cylinders_msb << 8 |
- ModePage5.flex_disk_page.number_of_cylinders_lsb;
-
- LastBlock = SectorsPerTrack * NumberOfHeads * NumberOfCylinders;
- DataBytesPerSector = ModePage5.flex_disk_page.databytes_per_sector_msb << 8 |
- ModePage5.flex_disk_page.databytes_per_sector_lsb;
-
- UsbFloppyDevice->BlkIo.Media->LastBlock = LastBlock;
-
- UsbFloppyDevice->BlkIo.Media->LastBlock--;
-
- UsbFloppyDevice->BlkIo.Media->BlockSize = DataBytesPerSector;
-
- UsbFloppyDevice->BlkIo.Media->MediaPresent = TRUE;
-
- UsbFloppyDevice->BlkIo.Media->ReadOnly =
- ModePage5.mode_param_header.write_protected;
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-UsbFloppyModeSense5APage1C (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- )
-/*++
-
- Routine Description:
- Retrieves media capacity information via sending Read Format
- Capacity Packet Command.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
-
---*/
-{
- //
- // status returned by Read Capacity Packet Command
- //
- EFI_STATUS Status;
- ATAPI_PACKET_COMMAND Packet;
- UFI_MODE_PARAMETER_PAGE_1C ModePage1C;
-
-
- ZeroMem (&ModePage1C, sizeof (UFI_MODE_PARAMETER_PAGE_1C));
-
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.ModeSenseUFI.opcode = UFI_MODE_SENSE5A;
- //
- // Flexible Disk Page
- //
- Packet.ModeSenseUFI.page_code = 0x1C;
- //
- // current values
- //
- Packet.ModeSenseUFI.page_control = 0;
- Packet.ModeSenseUFI.parameter_list_length_hi = 0;
- Packet.ModeSenseUFI.parameter_list_length_lo = sizeof (UFI_MODE_PARAMETER_PAGE_1C);
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (ATAPI_PACKET_COMMAND),
- (VOID *) &ModePage1C,
- sizeof (UFI_MODE_PARAMETER_PAGE_1C),
- EfiUsbDataIn,
- USBFLPTIMEOUT
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- UsbFloppyDevice->BlkIo.Media->ReadOnly = ModePage1C.mode_param_header.write_protected;
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-UsbMassStorageModeSense (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- )
-{
- if (UsbFloppyDevice->AtapiProtocol->CommandProtocol == EFI_USB_SUBCLASS_SCSI) {
- return UsbSCSIModeSense1APage3F (UsbFloppyDevice);
- } else {
- return UsbFloppyModeSense5APage3F (UsbFloppyDevice);
- }
-}
-
-EFI_STATUS
-UsbFloppyModeSense5APage3F (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- )
-/*++
-
- Routine Description:
- Retrieves mode sense information via sending Mode Sense
- Packet Command.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
-
---*/
-{
- //
- // status returned by Read Capacity Packet Command
- //
- EFI_STATUS Status;
- ATAPI_PACKET_COMMAND Packet;
- UFI_MODE_PARAMETER_HEADER Header;
- UINT32 Size;
-
-
- Size = sizeof (UFI_MODE_PARAMETER_HEADER);
-
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.ModeSenseUFI.opcode = UFI_MODE_SENSE5A;
- Packet.ModeSenseUFI.page_code = 0x3F;
- Packet.ModeSenseUFI.page_control = 0;
- Packet.ModeSenseUFI.parameter_list_length_hi = 0;
- Packet.ModeSenseUFI.parameter_list_length_lo = (UINT8) Size;
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (ATAPI_PACKET_COMMAND),
- &Header,
- Size,
- EfiUsbDataIn,
- USBFLPTIMEOUT
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- UsbFloppyDevice->BlkIo.Media->ReadOnly = Header.write_protected;
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-UsbSCSIModeSense1APage3F (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- )
-/*++
-
- Routine Description:
- Retrieves mode sense information via sending Mode Sense
- Packet Command.
-
- Arguments:
- UsbFloppyDevice - The USB_FLOPPY_DEV instance.
-
- Returns:
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
-
---*/
-{
- //
- // status returned by Read Capacity Packet Command
- //
- EFI_STATUS Status;
- ATAPI_PACKET_COMMAND Packet;
- SCSI_MODE_PARAMETER_HEADER6 Header;
- UINT32 Size;
-
-
- Size = sizeof (SCSI_MODE_PARAMETER_HEADER6);
-
- ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
- Packet.ModeSenseSCSI.opcode = SCSI_MODE_SENSE1A;
- Packet.ModeSenseSCSI.page_code = 0x3F;
- Packet.ModeSenseSCSI.page_control = 0;
- Packet.ModeSenseSCSI.allocation_length = (UINT8) Size;
- Status = USBFloppyPacketCommand (
- UsbFloppyDevice,
- &Packet,
- sizeof (MODE_SENSE_CMD_SCSI),
- &Header,
- Size,
- EfiUsbDataIn,
- USBFLPTIMEOUT
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- UsbFloppyDevice->BlkIo.Media->ReadOnly = Header.write_protected;
- return EFI_SUCCESS;
-
-}
-
-/*++
-
- The following functions are a set of helper functions,
- which are used to parse sense key returned by the device.
-
---*/
-BOOLEAN
-IsNoMedia (
- IN REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-{
- REQUEST_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN NoMedia;
-
- NoMedia = FALSE;
-
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
-
- if ((SensePtr->sense_key == SK_NOT_READY) &&
- (SensePtr->addnl_sense_code == ASC_NO_MEDIA)) {
-
- NoMedia = TRUE;
- }
-
- SensePtr++;
- }
-
- return NoMedia;
-}
-
-
-BOOLEAN
-IsMediaError (
- IN REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-{
- REQUEST_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN IsError;
-
- IsError = FALSE;
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
-
- switch (SensePtr->sense_key) {
-
- //
- // Medium error case
- //
- case SK_MEDIUM_ERROR:
- switch (SensePtr->addnl_sense_code) {
-
- case ASC_MEDIA_ERR1:
- case ASC_MEDIA_ERR2:
- case ASC_MEDIA_ERR3:
- case ASC_MEDIA_ERR4:
- IsError = TRUE;
- break;
-
- default:
- break;
- }
-
- break;
-
- //
- // Medium upside-down case
- //
- case SK_NOT_READY:
- switch (SensePtr->addnl_sense_code) {
- case ASC_MEDIA_UPSIDE_DOWN:
- IsError = TRUE;
- break;
-
- default:
- break;
- }
- break;
-
- default:
- break;
- }
-
- SensePtr++;
- }
-
- return IsError;
-}
-
-BOOLEAN
-IsMediaChange (
- IN REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-{
- REQUEST_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN MediaChanged;
-
- MediaChanged = FALSE;
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
-
- if ((SensePtr->sense_key == SK_UNIT_ATTENTION) &&
- (SensePtr->addnl_sense_code == ASC_MEDIA_CHANGE)) {
-
- MediaChanged = TRUE;
- }
-
- SensePtr++;
- }
-
- return MediaChanged;
-}
-
-BOOLEAN
-IsDriveReady (
- IN REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts,
- OUT BOOLEAN *NeedRetry
- )
-{
- REQUEST_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN IsReady;
-
- IsReady = TRUE;
- *NeedRetry = FALSE;
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
-
- if ((SensePtr->sense_key == SK_NOT_READY) &&
- (SensePtr->addnl_sense_code == ASC_NOT_READY)) {
-
- switch (SensePtr->addnl_sense_code_qualifier) {
-
- case ASCQ_IN_PROGRESS:
- case ASCQ_DEVICE_BUSY:
- IsReady = FALSE;
- *NeedRetry = TRUE;
- break;
-
- default:
- //
- // Drive is in error condition,
- // no need to retry.
- //
- IsReady = FALSE;
- *NeedRetry = FALSE;
- break;
- }
- }
-
- SensePtr++;
- }
-
- return IsReady;
-}
-
-BOOLEAN
-IsMediaWriteProtected (
- IN REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
- )
-{
- REQUEST_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN IsWriteProtected;
-
- IsWriteProtected = FALSE;
- SensePtr = SenseData;
-
- for (Index = 0; Index < SenseCounts; Index++) {
- //
- // catch media write-protected condition.
- //
- if ((SensePtr->sense_key == SK_DATA_PROTECT) &&
- (SensePtr->addnl_sense_code == ASC_WRITE_PROTECTED)) {
-
- IsWriteProtected = TRUE;
- }
-
- SensePtr++;
- }
-
- return IsWriteProtected;
-}
-
diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.h b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.h
deleted file mode 100644
index dc810bc..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UsbMassStorageHelper.h
-
-Abstract:
-
- Function prototype for USB Mass Storage Driver
-
-Revision History
---*/
-#ifndef _USB_FLPHLP_H
-#define _USB_FLPHLP_H
-
-#include "UsbMassStorage.h"
-
-EFI_STATUS
-USBFloppyIdentify (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- );
-
-EFI_STATUS
-USBFloppyPacketCommand (
- USB_FLOPPY_DEV *UsbFloppyDevice,
- VOID *Command,
- UINT8 CommandSize,
- VOID *DataBuffer,
- UINT32 BufferLength,
- EFI_USB_DATA_DIRECTION Direction,
- UINT16 TimeOutInMilliSeconds
- );
-
-EFI_STATUS
-USBFloppyInquiry (
- IN USB_FLOPPY_DEV *UsbFloppyDevice,
- OUT USB_INQUIRY_DATA **Idata
- );
-
-EFI_STATUS
-USBFloppyRead10 (
- IN USB_FLOPPY_DEV *UsbFloppyDevice,
- IN VOID *Buffer,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- );
-
-EFI_STATUS
-USBFloppyReadFormatCapacity (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- );
-
-EFI_STATUS
-UsbFloppyRequestSense (
- IN USB_FLOPPY_DEV *UsbFloppyDevice,
- OUT UINTN *SenseCounts
- );
-
-EFI_STATUS
-UsbFloppyTestUnitReady (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- );
-
-EFI_STATUS
-USBFloppyWrite10 (
- IN USB_FLOPPY_DEV *UsbFloppyDevice,
- IN VOID *Buffer,
- IN EFI_LBA Lba,
- IN UINTN NumberOfBlocks
- );
-
-EFI_STATUS
-UsbFloppyDetectMedia (
- IN USB_FLOPPY_DEV *UsbFloppyDevice,
- OUT BOOLEAN *MediaChange
- );
-
-EFI_STATUS
-UsbFloppyModeSense5APage5 (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- );
-
-EFI_STATUS
-UsbFloppyModeSense5APage1C (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- );
-
-EFI_STATUS
-UsbFloppyModeSense5APage3F (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- );
-
-EFI_STATUS
-UsbSCSIModeSense1APage3F (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- );
-
-EFI_STATUS
-UsbMassStorageModeSense (
- IN USB_FLOPPY_DEV *UsbFloppyDevice
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/ComponentName.c b/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/ComponentName.c
deleted file mode 100644
index 695961f..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/ComponentName.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "usbmouse.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gUsbMouseComponentName = {
- UsbMouseComponentNameGetDriverName,
- UsbMouseComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mUsbMouseDriverNameTable[] = {
- { "eng", (CHAR16 *) L"Usb Mouse Driver" },
- { NULL , NULL }
-};
-
-
-EFI_STATUS
-EFIAPI
-UsbMouseComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gUsbMouseComponentName.SupportedLanguages,
- mUsbMouseDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-UsbMouseComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- USB_MOUSE_DEV *UsbMouseDev;
- EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;
- EFI_USB_IO_PROTOCOL *UsbIoProtocol;
-
- //
- // This is a device driver, so ChildHandle must be NULL.
- //
- if (ChildHandle != NULL) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Check Controller's handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIoProtocol,
- gUsbMouseDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiUsbIoProtocolGuid,
- gUsbMouseDriverBinding.DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Status != EFI_ALREADY_STARTED) {
- return EFI_UNSUPPORTED;
- }
- //
- // Get the device context
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimplePointerProtocolGuid,
- (VOID **) &SimplePointerProtocol,
- gUsbMouseDriverBinding.DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- UsbMouseDev = USB_MOUSE_DEV_FROM_MOUSE_PROTOCOL (SimplePointerProtocol);
-
- return LookupUnicodeString (
- Language,
- gUsbMouseComponentName.SupportedLanguages,
- UsbMouseDev->ControllerNameTable,
- ControllerName
- );
-
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/UsbMouse.msa b/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/UsbMouse.msa
deleted file mode 100644
index 0cbae7a..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/UsbMouse.msa
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>UsbMouse</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>2D2E62AA-9ECF-43b7-8219-94E7FC713DFE</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for UsbMouse module</Abstract>
- <Description>This module provides support for USB mouse device</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>UsbMouse</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkUsbLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>usbmouse.h</Filename>
- <Filename>usbmouse.c</Filename>
- <Filename>mousehid.h</Filename>
- <Filename>mousehid.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiUsbIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimplePointerProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gUsbMouseDriverBinding</DriverBinding>
- <ComponentName>gUsbMouseComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/mousehid.c b/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/mousehid.c
deleted file mode 100644
index cbe0970..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/mousehid.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Mousehid.c
-
-Abstract:
- Parse mouse hid descriptor
-
---*/
-
-#include "usbmouse.h"
-#include "mousehid.h"
-
-//
-// Get an item from report descriptor
-//
-STATIC
-UINT8 *
-GetNextItem (
- IN UINT8 *StartPos,
- IN UINT8 *EndPos,
- OUT HID_ITEM *HidItem
- )
-/*++
-
-Routine Description:
-
- Get Next Item
-
-Arguments:
-
- StartPos - Start Position
- EndPos - End Position
- HidItem - HidItem to return
-
-Returns:
- Position
-
---*/
-{
- UINT8 Temp;
-
- if ((EndPos - StartPos) <= 0) {
- return NULL;
- }
-
- Temp = *StartPos;
- StartPos++;
- //
- // bit 2,3
- //
- HidItem->Type = (UINT8) ((Temp >> 2) & 0x03);
- //
- // bit 4-7
- //
- HidItem->Tag = (UINT8) ((Temp >> 4) & 0x0F);
-
- if (HidItem->Tag == HID_ITEM_TAG_LONG) {
- //
- // Long Items are not supported by HID rev1.0,
- // although we try to parse it.
- //
- HidItem->Format = HID_ITEM_FORMAT_LONG;
-
- if ((EndPos - StartPos) >= 2) {
- HidItem->Size = *StartPos++;
- HidItem->Tag = *StartPos++;
-
- if ((EndPos - StartPos) >= HidItem->Size) {
- HidItem->Data.LongData = StartPos;
- StartPos += HidItem->Size;
- return StartPos;
- }
- }
- } else {
- HidItem->Format = HID_ITEM_FORMAT_SHORT;
- //
- // bit 0, 1
- //
- HidItem->Size = (UINT8) (Temp & 0x03);
- switch (HidItem->Size) {
-
- case 0:
- //
- // No data
- //
- return StartPos;
-
- case 1:
- //
- // One byte data
- //
- if ((EndPos - StartPos) >= 1) {
- HidItem->Data.U8 = *StartPos++;
- return StartPos;
- }
-
- case 2:
- //
- // Two byte data
- //
- if ((EndPos - StartPos) >= 2) {
- CopyMem (&HidItem->Data.U16, StartPos, sizeof (UINT16));
- StartPos += 2;
- return StartPos;
- }
-
- case 3:
- //
- // 4 byte data, adjust size
- //
- HidItem->Size++;
- if ((EndPos - StartPos) >= 4) {
- CopyMem (&HidItem->Data.U32, StartPos, sizeof (UINT32));
- StartPos += 4;
- return StartPos;
- }
- }
- }
-
- return NULL;
-}
-
-STATIC
-UINT32
-GetItemData (
- IN HID_ITEM *HidItem
- )
-/*++
-
-Routine Description:
-
- Get Item Data
-
-Arguments:
-
- HidItem - HID_ITEM
-
-Returns:
- HidItem Data
-
-
---*/
-{
- //
- // Get Data from HID_ITEM structure
- //
- switch (HidItem->Size) {
-
- case 1:
- return HidItem->Data.U8;
-
- case 2:
- return HidItem->Data.U16;
-
- case 4:
- return HidItem->Data.U32;
- }
-
- return 0;
-}
-
-STATIC
-VOID
-ParseLocalItem (
- IN USB_MOUSE_DEV *UsbMouse,
- IN HID_ITEM *LocalItem
- )
-/*++
-
-Routine Description:
-
- Parse Local Item
-
-Arguments:
-
- UsbMouse - USB_MOUSE_DEV
- LocalItem - Local Item
-
-Returns:
-
---*/
-{
- UINT32 Data;
-
- if (LocalItem->Size == 0) {
- //
- // No expected data for local item
- //
- return ;
- }
-
- Data = GetItemData (LocalItem);
-
- switch (LocalItem->Tag) {
-
- case HID_LOCAL_ITEM_TAG_DELIMITER:
- //
- // we don't support delimiter here
- //
- return ;
-
- case HID_LOCAL_ITEM_TAG_USAGE:
- return ;
-
- case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM:
- if (UsbMouse->PrivateData.ButtonDetected) {
- UsbMouse->PrivateData.ButtonMinIndex = (UINT8) Data;
- }
-
- return ;
-
- case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM:
- {
- if (UsbMouse->PrivateData.ButtonDetected) {
- UsbMouse->PrivateData.ButtonMaxIndex = (UINT8) Data;
- }
-
- return ;
- }
- }
-}
-
-STATIC
-VOID
-ParseGlobalItem (
- IN USB_MOUSE_DEV *UsbMouse,
- IN HID_ITEM *GlobalItem
- )
-{
- UINT8 UsagePage;
-
- switch (GlobalItem->Tag) {
- case HID_GLOBAL_ITEM_TAG_USAGE_PAGE:
- {
- UsagePage = (UINT8) GetItemData (GlobalItem);
-
- //
- // We only care Button Page here
- //
- if (UsagePage == 0x09) {
- //
- // Button Page
- //
- UsbMouse->PrivateData.ButtonDetected = TRUE;
- return ;
- }
- break;
- }
-
- }
-}
-
-
-STATIC
-VOID
-ParseMainItem (
- IN USB_MOUSE_DEV *UsbMouse,
- IN HID_ITEM *MainItem
- )
-/*++
-
-Routine Description:
-
- Parse Main Item
-
-Arguments:
-
- UsbMouse - TODO: add argument description
- MainItem - HID_ITEM to parse
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // we don't care any main items, just skip
- //
- return ;
-}
-
-STATIC
-VOID
-ParseHidItem (
- IN USB_MOUSE_DEV *UsbMouse,
- IN HID_ITEM *HidItem
- )
-/*++
-
-Routine Description:
-
- Parse Hid Item
-
-Arguments:
-
- UsbMouse - USB_MOUSE_DEV
- HidItem - HidItem to parse
-
-Returns:
-
- VOID
-
---*/
-{
- switch (HidItem->Type) {
-
- case HID_ITEM_TYPE_MAIN:
- //
- // For Main Item, parse main item
- //
- ParseMainItem (UsbMouse, HidItem);
- break;
-
- case HID_ITEM_TYPE_GLOBAL:
- //
- // For global Item, parse global item
- //
- ParseGlobalItem (UsbMouse, HidItem);
- break;
-
- case HID_ITEM_TYPE_LOCAL:
- //
- // For Local Item, parse local item
- //
- ParseLocalItem (UsbMouse, HidItem);
- break;
- }
-}
-//
-// A simple parse just read some field we are interested in
-//
-EFI_STATUS
-ParseMouseReportDescriptor (
- IN USB_MOUSE_DEV *UsbMouse,
- IN UINT8 *ReportDescriptor,
- IN UINTN ReportSize
- )
-/*++
-
-Routine Description:
-
- Parse Mouse Report Descriptor
-
-Arguments:
-
- UsbMouse - USB_MOUSE_DEV
- ReportDescriptor - Report descriptor to parse
- ReportSize - Report descriptor size
-
-Returns:
-
- EFI_DEVICE_ERROR - Report descriptor error
- EFI_SUCCESS - Success
-
---*/
-{
- UINT8 *DescriptorEnd;
- UINT8 *ptr;
- HID_ITEM HidItem;
-
- DescriptorEnd = ReportDescriptor + ReportSize;
-
- ptr = GetNextItem (ReportDescriptor, DescriptorEnd, &HidItem);
-
- while (ptr != NULL) {
- if (HidItem.Format != HID_ITEM_FORMAT_SHORT) {
- //
- // Long Format Item is not supported at current HID revision
- //
- return EFI_DEVICE_ERROR;
- }
-
- ParseHidItem (UsbMouse, &HidItem);
-
- ptr = GetNextItem (ptr, DescriptorEnd, &HidItem);
- }
-
- UsbMouse->NumberOfButtons = (UINT8) (UsbMouse->PrivateData.ButtonMaxIndex - UsbMouse->PrivateData.ButtonMinIndex + 1);
- UsbMouse->XLogicMax = UsbMouse->YLogicMax = 127;
- UsbMouse->XLogicMin = UsbMouse->YLogicMin = -127;
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/mousehid.h b/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/mousehid.h
deleted file mode 100644
index ccce835..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/mousehid.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MouseHid.h
-
-Abstract:
-
---*/
-
-#ifndef __MOUSE_HID_H
-#define __MOUSE_HID_H
-
-#include "usbmouse.h"
-
-//
-// HID Item general structure
-//
-typedef struct _hid_item {
- UINT16 Format;
- UINT8 Size;
- UINT8 Type;
- UINT8 Tag;
- union {
- UINT8 U8;
- UINT16 U16;
- UINT32 U32;
- INT8 I8;
- INT16 I16;
- INT32 I32;
- UINT8 *LongData;
- } Data;
-} HID_ITEM;
-
-typedef struct {
- UINT16 UsagePage;
- INT32 LogicMin;
- INT32 LogicMax;
- INT32 PhysicalMin;
- INT32 PhysicalMax;
- UINT16 UnitExp;
- UINT16 UINT;
- UINT16 ReportId;
- UINT16 ReportSize;
- UINT16 ReportCount;
-} HID_GLOBAL;
-
-typedef struct {
- UINT16 Usage[16]; /* usage array */
- UINT16 UsageIndex;
- UINT16 UsageMin;
-} HID_LOCAL;
-
-typedef struct {
- UINT16 Type;
- UINT16 Usage;
-} HID_COLLECTION;
-
-typedef struct {
- HID_GLOBAL Global;
- HID_GLOBAL GlobalStack[8];
- UINT32 GlobalStackPtr;
- HID_LOCAL Local;
- HID_COLLECTION CollectionStack[8];
- UINT32 CollectionStackPtr;
-} HID_PARSER;
-
-EFI_STATUS
-ParseMouseReportDescriptor (
- IN USB_MOUSE_DEV *UsbMouse,
- IN UINT8 *ReportDescriptor,
- IN UINTN ReportSize
- );
-
-#endif
diff --git a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/usbmouse.c b/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/usbmouse.c
deleted file mode 100644
index a3fc6c7..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/usbmouse.c
+++ /dev/null
@@ -1,988 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- UsbMouse.c
-
- Abstract:
-
---*/
-
-#include "usbmouse.h"
-#include "mousehid.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gUsbMouseDriverBinding = {
- USBMouseDriverBindingSupported,
- USBMouseDriverBindingStart,
- USBMouseDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-//
-// helper functions
-//
-STATIC
-BOOLEAN
-IsUsbMouse (
- IN EFI_USB_IO_PROTOCOL *UsbIo
- );
-
-STATIC
-EFI_STATUS
-InitializeUsbMouseDevice (
- IN USB_MOUSE_DEV *UsbMouseDev
- );
-
-STATIC
-VOID
-EFIAPI
-UsbMouseWaitForInput (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-//
-// Mouse interrupt handler
-//
-STATIC
-EFI_STATUS
-EFIAPI
-OnMouseInterruptComplete (
- IN VOID *Data,
- IN UINTN DataLength,
- IN VOID *Context,
- IN UINT32 Result
- );
-
-//
-// Mouse Protocol
-//
-STATIC
-EFI_STATUS
-EFIAPI
-GetMouseState (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- OUT EFI_SIMPLE_POINTER_STATE *MouseState
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbMouseReset (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-EFI_STATUS
-EFIAPI
-USBMouseDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- that has UsbHcProtocol installed will be supported.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_UNSUPPORTED - This driver does not support this device.
-
---*/
-{
- EFI_STATUS OpenStatus;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_STATUS Status;
-
- OpenStatus = gBS->OpenProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (OpenStatus) && (OpenStatus != EFI_ALREADY_STARTED)) {
- return EFI_UNSUPPORTED;
- }
-
- if (OpenStatus == EFI_ALREADY_STARTED) {
- return EFI_ALREADY_STARTED;
- }
-
- //
- // Use the USB I/O protocol interface to see the Controller is
- // the Mouse controller that can be managed by this driver.
- //
- Status = EFI_SUCCESS;
- if (!IsUsbMouse (UsbIo)) {
- Status = EFI_UNSUPPORTED;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-USBMouseDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Starting the Usb Bus Driver
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_UNSUPPORTED - This driver does not support this device.
- EFI_DEVICE_ERROR - This driver cannot be started due to device
- Error
- EFI_OUT_OF_RESOURCES- Can't allocate memory resources
- EFI_ALREADY_STARTED - Thios driver has been started
---*/
-{
- EFI_STATUS Status;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDesc;
- USB_MOUSE_DEV *UsbMouseDevice;
- UINT8 EndpointNumber;
- UINT8 Index;
- UINT8 EndpointAddr;
- UINT8 PollingInterval;
- UINT8 PacketSize;
-
- UsbMouseDevice = NULL;
- Status = EFI_SUCCESS;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- (VOID **) &UsbIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- UsbMouseDevice = AllocateZeroPool (sizeof (USB_MOUSE_DEV));
- if (UsbMouseDevice == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
-
- UsbMouseDevice->UsbIo = UsbIo;
-
- UsbMouseDevice->Signature = USB_MOUSE_DEV_SIGNATURE;
-
- UsbMouseDevice->InterfaceDescriptor = AllocatePool (sizeof (EFI_USB_INTERFACE_DESCRIPTOR));
- if (UsbMouseDevice->InterfaceDescriptor == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
-
- EndpointDesc = AllocatePool (sizeof (EFI_USB_ENDPOINT_DESCRIPTOR));
- if (EndpointDesc == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
- //
- // Get the Device Path Protocol on Controller's handle
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &UsbMouseDevice->DevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
- //
- // Get interface & endpoint descriptor
- //
- UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- UsbMouseDevice->InterfaceDescriptor
- );
-
- EndpointNumber = UsbMouseDevice->InterfaceDescriptor->NumEndpoints;
-
- for (Index = 0; Index < EndpointNumber; Index++) {
- UsbIo->UsbGetEndpointDescriptor (
- UsbIo,
- Index,
- EndpointDesc
- );
-
- if ((EndpointDesc->Attributes & 0x03) == 0x03) {
-
- //
- // We only care interrupt endpoint here
- //
- UsbMouseDevice->IntEndpointDescriptor = EndpointDesc;
- }
- }
-
- if (UsbMouseDevice->IntEndpointDescriptor == NULL) {
- //
- // No interrupt endpoint, then error
- //
- Status = EFI_UNSUPPORTED;
- goto ErrorExit;
- }
-
- Status = InitializeUsbMouseDevice (UsbMouseDevice);
- if (EFI_ERROR (Status)) {
- MouseReportStatusCode (
- UsbMouseDevice->DevicePath,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_PERIPHERAL_MOUSE | EFI_P_EC_INTERFACE_ERROR)
- );
-
- goto ErrorExit;
- }
-
- UsbMouseDevice->SimplePointerProtocol.GetState = GetMouseState;
- UsbMouseDevice->SimplePointerProtocol.Reset = UsbMouseReset;
- UsbMouseDevice->SimplePointerProtocol.Mode = &UsbMouseDevice->Mode;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- UsbMouseWaitForInput,
- UsbMouseDevice,
- &((UsbMouseDevice->SimplePointerProtocol).WaitForInput)
- );
- if (EFI_ERROR (Status)) {
- goto ErrorExit;
- }
-
- Status = gBS->InstallProtocolInterface (
- &Controller,
- &gEfiSimplePointerProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &UsbMouseDevice->SimplePointerProtocol
- );
-
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto ErrorExit;
- }
-
- //
- // After Enabling Async Interrupt Transfer on this mouse Device
- // we will be able to get key data from it. Thus this is deemed as
- // the enable action of the mouse
- //
-
- MouseReportStatusCode (
- UsbMouseDevice->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_MOUSE | EFI_P_PC_ENABLE)
- );
-
- //
- // submit async interrupt transfer
- //
- EndpointAddr = UsbMouseDevice->IntEndpointDescriptor->EndpointAddress;
- PollingInterval = UsbMouseDevice->IntEndpointDescriptor->Interval;
- PacketSize = (UINT8) (UsbMouseDevice->IntEndpointDescriptor->MaxPacketSize);
-
- Status = UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- EndpointAddr,
- TRUE,
- PollingInterval,
- PacketSize,
- OnMouseInterruptComplete,
- UsbMouseDevice
- );
-
- if (!EFI_ERROR (Status)) {
-
- UsbMouseDevice->ControllerNameTable = NULL;
- AddUnicodeString (
- "eng",
- gUsbMouseComponentName.SupportedLanguages,
- &UsbMouseDevice->ControllerNameTable,
- (CHAR16 *) L"Generic Usb Mouse"
- );
-
- return EFI_SUCCESS;
- }
-
- //
- // If submit error, uninstall that interface
- //
- Status = EFI_DEVICE_ERROR;
- gBS->UninstallProtocolInterface (
- Controller,
- &gEfiSimplePointerProtocolGuid,
- &UsbMouseDevice->SimplePointerProtocol
- );
-
-ErrorExit:
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- if (UsbMouseDevice != NULL) {
- if (UsbMouseDevice->InterfaceDescriptor != NULL) {
- gBS->FreePool (UsbMouseDevice->InterfaceDescriptor);
- }
-
- if (UsbMouseDevice->IntEndpointDescriptor != NULL) {
- gBS->FreePool (UsbMouseDevice->IntEndpointDescriptor);
- }
-
- if ((UsbMouseDevice->SimplePointerProtocol).WaitForInput != NULL) {
- gBS->CloseEvent ((UsbMouseDevice->SimplePointerProtocol).WaitForInput);
- }
-
- gBS->FreePool (UsbMouseDevice);
- UsbMouseDevice = NULL;
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-USBMouseDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop this driver on ControllerHandle. Support stoping any child handles
- created by this driver.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to stop driver on
- NumberOfChildren - Number of Children in the ChildHandleBuffer
- ChildHandleBuffer - List of handles for the children we need to stop.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- others
-
---*/
-{
- EFI_STATUS Status;
- USB_MOUSE_DEV *UsbMouseDevice;
- EFI_SIMPLE_POINTER_PROTOCOL *SimplePointerProtocol;
- EFI_USB_IO_PROTOCOL *UsbIo;
-
- //
- // Get our context back.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiSimplePointerProtocolGuid,
- (VOID **) &SimplePointerProtocol,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- UsbMouseDevice = USB_MOUSE_DEV_FROM_MOUSE_PROTOCOL (SimplePointerProtocol);
-
- gBS->CloseProtocol (
- Controller,
- &gEfiSimplePointerProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- UsbIo = UsbMouseDevice->UsbIo;
-
- //
- // Uninstall the Asyn Interrupt Transfer from this device
- // will disable the mouse data input from this device
- //
- MouseReportStatusCode (
- UsbMouseDevice->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_MOUSE | EFI_P_PC_DISABLE)
- );
-
- //
- // Delete Mouse Async Interrupt Transfer
- //
- UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- UsbMouseDevice->IntEndpointDescriptor->EndpointAddress,
- FALSE,
- UsbMouseDevice->IntEndpointDescriptor->Interval,
- 0,
- NULL,
- NULL
- );
-
- gBS->CloseEvent (UsbMouseDevice->SimplePointerProtocol.WaitForInput);
-
- if (UsbMouseDevice->DelayedRecoveryEvent) {
- gBS->CloseEvent (UsbMouseDevice->DelayedRecoveryEvent);
- UsbMouseDevice->DelayedRecoveryEvent = 0;
- }
-
- Status = gBS->UninstallProtocolInterface (
- Controller,
- &gEfiSimplePointerProtocolGuid,
- &UsbMouseDevice->SimplePointerProtocol
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiUsbIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- gBS->FreePool (UsbMouseDevice->InterfaceDescriptor);
- gBS->FreePool (UsbMouseDevice->IntEndpointDescriptor);
-
- if (UsbMouseDevice->ControllerNameTable) {
- FreeUnicodeStringTable (UsbMouseDevice->ControllerNameTable);
- }
-
- gBS->FreePool (UsbMouseDevice);
-
- return EFI_SUCCESS;
-
-}
-
-BOOLEAN
-IsUsbMouse (
- IN EFI_USB_IO_PROTOCOL *UsbIo
- )
-/*++
-
- Routine Description:
- Tell if a Usb Controller is a mouse
-
- Arguments:
- UsbIo - Protocol instance pointer.
-
- Returns:
- TRUE - It is a mouse
- FALSE - It is not a mouse
---*/
-{
- EFI_STATUS Status;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
-
- //
- // Get the Default interface descriptor, now we only
- // suppose it is interface 1
- //
- Status = UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &InterfaceDescriptor
- );
-
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- if ((InterfaceDescriptor.InterfaceClass == CLASS_HID) &&
- (InterfaceDescriptor.InterfaceSubClass == SUBCLASS_BOOT) &&
- (InterfaceDescriptor.InterfaceProtocol == PROTOCOL_MOUSE)
- ) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-STATIC
-EFI_STATUS
-InitializeUsbMouseDevice (
- IN USB_MOUSE_DEV *UsbMouseDev
- )
-/*++
-
- Routine Description:
- Initialize the Usb Mouse Device.
-
- Arguments:
- UsbMouseDev - Device instance to be initialized
-
- Returns:
- EFI_SUCCESS - Success
- EFI_DEVICE_ERROR - Init error.
- EFI_OUT_OF_RESOURCES- Can't allocate memory
---*/
-{
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 Protocol;
- EFI_STATUS Status;
- EFI_USB_HID_DESCRIPTOR MouseHidDesc;
- UINT8 *ReportDesc;
-
- UsbIo = UsbMouseDev->UsbIo;
-
- //
- // Get HID descriptor
- //
- Status = UsbGetHidDescriptor (
- UsbIo,
- UsbMouseDev->InterfaceDescriptor->InterfaceNumber,
- &MouseHidDesc
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get Report descriptor
- //
- if (MouseHidDesc.HidClassDesc[0].DescriptorType != 0x22) {
- return EFI_UNSUPPORTED;
- }
-
- ReportDesc = AllocateZeroPool (MouseHidDesc.HidClassDesc[0].DescriptorLength);
- if (ReportDesc == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = UsbGetReportDescriptor (
- UsbIo,
- UsbMouseDev->InterfaceDescriptor->InterfaceNumber,
- MouseHidDesc.HidClassDesc[0].DescriptorLength,
- ReportDesc
- );
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (ReportDesc);
- return Status;
- }
-
- //
- // Parse report descriptor
- //
- Status = ParseMouseReportDescriptor (
- UsbMouseDev,
- ReportDesc,
- MouseHidDesc.HidClassDesc[0].DescriptorLength
- );
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (ReportDesc);
- return Status;
- }
-
- if (UsbMouseDev->NumberOfButtons >= 1) {
- UsbMouseDev->Mode.LeftButton = TRUE;
- }
-
- if (UsbMouseDev->NumberOfButtons > 1) {
- UsbMouseDev->Mode.RightButton = TRUE;
- }
-
- UsbMouseDev->Mode.ResolutionX = 8;
- UsbMouseDev->Mode.ResolutionY = 8;
- UsbMouseDev->Mode.ResolutionZ = 0;
- //
- // Here we just assume interface 0 is the mouse interface
- //
- UsbGetProtocolRequest (
- UsbIo,
- 0,
- &Protocol
- );
-
- if (Protocol != BOOT_PROTOCOL) {
- Status = UsbSetProtocolRequest (
- UsbIo,
- 0,
- BOOT_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (ReportDesc);
- return EFI_DEVICE_ERROR;
- }
- }
-
- //
- // Set indefinite Idle rate for USB Mouse
- //
- UsbSetIdleRequest (
- UsbIo,
- 0,
- 0,
- 0
- );
-
- gBS->FreePool (ReportDesc);
-
- if (UsbMouseDev->DelayedRecoveryEvent) {
- gBS->CloseEvent (UsbMouseDev->DelayedRecoveryEvent);
- UsbMouseDev->DelayedRecoveryEvent = 0;
- }
-
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- USBMouseRecoveryHandler,
- UsbMouseDev,
- &UsbMouseDev->DelayedRecoveryEvent
- );
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-OnMouseInterruptComplete (
- IN VOID *Data,
- IN UINTN DataLength,
- IN VOID *Context,
- IN UINT32 Result
- )
-/*++
-
- Routine Description:
- It is called whenever there is data received from async interrupt
- transfer.
-
- Arguments:
- Data - Data received.
- DataLength - Length of Data
- Context - Passed in context
- Result - Async Interrupt Transfer result
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
-
---*/
-{
- USB_MOUSE_DEV *UsbMouseDevice;
- EFI_USB_IO_PROTOCOL *UsbIo;
- UINT8 EndpointAddr;
- UINT32 UsbResult;
-
- UsbMouseDevice = (USB_MOUSE_DEV *) Context;
- UsbIo = UsbMouseDevice->UsbIo;
-
- if (Result != EFI_USB_NOERROR) {
- //
- // Some errors happen during the process
- //
- MouseReportStatusCode (
- UsbMouseDevice->DevicePath,
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_PERIPHERAL_MOUSE | EFI_P_EC_INPUT_ERROR)
- );
-
- if ((Result & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) {
- EndpointAddr = UsbMouseDevice->IntEndpointDescriptor->EndpointAddress;
-
- UsbClearEndpointHalt (
- UsbIo,
- EndpointAddr,
- &UsbResult
- );
- }
-
- UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- UsbMouseDevice->IntEndpointDescriptor->EndpointAddress,
- FALSE,
- 0,
- 0,
- NULL,
- NULL
- );
-
- gBS->SetTimer (
- UsbMouseDevice->DelayedRecoveryEvent,
- TimerRelative,
- EFI_USB_INTERRUPT_DELAY
- );
- return EFI_DEVICE_ERROR;
- }
-
- if (DataLength == 0 || Data == NULL) {
- return EFI_SUCCESS;
- }
-
- UsbMouseDevice->StateChanged = TRUE;
-
- //
- // Check mouse Data
- //
- UsbMouseDevice->State.LeftButton = (BOOLEAN) (*(UINT8 *) Data & 0x01);
- UsbMouseDevice->State.RightButton = (BOOLEAN) (*(UINT8 *) Data & 0x02);
- UsbMouseDevice->State.RelativeMovementX += *((INT8 *) Data + 1);
- UsbMouseDevice->State.RelativeMovementY += *((INT8 *) Data + 2);
-
- if (DataLength > 3) {
- UsbMouseDevice->State.RelativeMovementZ += *((INT8 *) Data + 3);
- }
-
- return EFI_SUCCESS;
-}
-
-/*
-STATIC VOID
-PrintMouseState(
- IN EFI_MOUSE_STATE *MouseState
- )
-{
- Aprint("(%x: %x, %x)\n",
- MouseState->ButtonStates,
- MouseState->dx,
- MouseState->dy
- );
-}
-*/
-STATIC
-EFI_STATUS
-EFIAPI
-GetMouseState (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- OUT EFI_SIMPLE_POINTER_STATE *MouseState
- )
-/*++
-
- Routine Description:
- Get the mouse state, see SIMPLE POINTER PROTOCOL.
-
- Arguments:
- This - Protocol instance pointer.
- MouseState - Current mouse state
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_NOT_READY
-
---*/
-{
- USB_MOUSE_DEV *MouseDev;
-
- if (MouseState == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- MouseDev = USB_MOUSE_DEV_FROM_MOUSE_PROTOCOL (This);
-
- if (!MouseDev->StateChanged) {
- return EFI_NOT_READY;
- }
-
- CopyMem (
- MouseState,
- &MouseDev->State,
- sizeof (EFI_SIMPLE_POINTER_STATE)
- );
-
- //
- // Clear previous move state
- //
- MouseDev->State.RelativeMovementX = 0;
- MouseDev->State.RelativeMovementY = 0;
- MouseDev->State.RelativeMovementZ = 0;
-
- MouseDev->StateChanged = FALSE;
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UsbMouseReset (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset the mouse device, see SIMPLE POINTER PROTOCOL.
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - Ignored here/
-
- Returns:
- EFI_SUCCESS
-
---*/
-{
- USB_MOUSE_DEV *UsbMouseDevice;
-
- UsbMouseDevice = USB_MOUSE_DEV_FROM_MOUSE_PROTOCOL (This);
-
- MouseReportStatusCode (
- UsbMouseDevice->DevicePath,
- EFI_PROGRESS_CODE,
- (EFI_PERIPHERAL_MOUSE | EFI_P_PC_RESET)
- );
-
- ZeroMem (
- &UsbMouseDevice->State,
- sizeof (EFI_SIMPLE_POINTER_STATE)
- );
- UsbMouseDevice->StateChanged = FALSE;
-
- return EFI_SUCCESS;
-}
-
-STATIC
-VOID
-EFIAPI
-UsbMouseWaitForInput (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Event notification function for SIMPLE_POINTER.WaitForInput event
- Signal the event if there is input from mouse
-
-Arguments:
- Event - Wait Event
- Context - Passed parameter to event handler
-Returns:
- VOID
---*/
-{
- USB_MOUSE_DEV *UsbMouseDev;
-
- UsbMouseDev = (USB_MOUSE_DEV *) Context;
-
- //
- // Someone is waiting on the mouse event, if there's
- // input from mouse, signal the event
- //
- if (UsbMouseDev->StateChanged) {
- gBS->SignalEvent (Event);
- }
-}
-
-VOID
-EFIAPI
-USBMouseRecoveryHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
- Timer handler for Delayed Recovery timer.
-
- Arguments:
- Event - The Delayed Recovery event.
- Context - Points to the USB_KB_DEV instance.
-
- Returns:
-
---*/
-{
- USB_MOUSE_DEV *UsbMouseDev;
- EFI_USB_IO_PROTOCOL *UsbIo;
-
- UsbMouseDev = (USB_MOUSE_DEV *) Context;
-
- UsbIo = UsbMouseDev->UsbIo;
-
- UsbIo->UsbAsyncInterruptTransfer (
- UsbIo,
- UsbMouseDev->IntEndpointDescriptor->EndpointAddress,
- TRUE,
- UsbMouseDev->IntEndpointDescriptor->Interval,
- UsbMouseDev->IntEndpointDescriptor->MaxPacketSize,
- OnMouseInterruptComplete,
- UsbMouseDev
- );
-}
-
-VOID
-MouseReportStatusCode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value
- )
-/*++
-
- Routine Description:
- Report Status Code in Usb Bot Driver
-
- Arguments:
- DevicePath - Use this to get Device Path
- CodeType - Status Code Type
- CodeValue - Status Code Value
-
- Returns:
- None
-
---*/
-{
-
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- CodeType,
- Value,
- DevicePath
- );
-}
diff --git a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/usbmouse.h b/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/usbmouse.h
deleted file mode 100644
index 47aecc8..0000000
--- a/EdkModulePkg/Bus/Usb/UsbMouse/Dxe/usbmouse.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- UsbMouse.h
-
- Abstract:
-
---*/
-
-#ifndef _USB_MOUSE_H
-#define _USB_MOUSE_H
-
-#include <IndustryStandard/Usb.h>
-
-#define CLASS_HID 3
-#define SUBCLASS_BOOT 1
-#define PROTOCOL_MOUSE 2
-
-#define BOOT_PROTOCOL 0
-#define REPORT_PROTOCOL 1
-
-#define USB_MOUSE_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'm', 'o', 'u')
-
-typedef struct {
- BOOLEAN ButtonDetected;
- UINT8 ButtonMinIndex;
- UINT8 ButtonMaxIndex;
- UINT8 Reserved;
-} PRIVATE_DATA;
-
-typedef struct {
- UINTN Signature;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_EVENT DelayedRecoveryEvent;
- EFI_USB_IO_PROTOCOL *UsbIo;
- EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor;
- EFI_USB_ENDPOINT_DESCRIPTOR *IntEndpointDescriptor;
- UINT8 NumberOfButtons;
- INT32 XLogicMax;
- INT32 XLogicMin;
- INT32 YLogicMax;
- INT32 YLogicMin;
- EFI_SIMPLE_POINTER_PROTOCOL SimplePointerProtocol;
- EFI_SIMPLE_POINTER_STATE State;
- EFI_SIMPLE_POINTER_MODE Mode;
- BOOLEAN StateChanged;
- PRIVATE_DATA PrivateData;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
-} USB_MOUSE_DEV;
-
-#define USB_MOUSE_DEV_FROM_MOUSE_PROTOCOL(a) \
- CR(a, USB_MOUSE_DEV, SimplePointerProtocol, USB_MOUSE_DEV_SIGNATURE)
-
-VOID
-EFIAPI
-USBMouseRecoveryHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gUsbMouseDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gUsbMouseComponentName;
-
-VOID
-MouseReportStatusCode (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value
- );
-
-//
-// Prototypes
-// Driver model protocol interface
-//
-EFI_STATUS
-EFIAPI
-USBMouseDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-USBMouseDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-USBMouseDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-UsbMouseComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-UsbMouseComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-#endif
diff --git a/EdkModulePkg/Core/Dxe/DebugImageInfo.h b/EdkModulePkg/Core/Dxe/DebugImageInfo.h
deleted file mode 100644
index 006f629..0000000
--- a/EdkModulePkg/Core/Dxe/DebugImageInfo.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DebugImageInfo.h
-
-Abstract:
-
- Support functions for managing debug image info table when loading and unloading
- images.
-
---*/
-
-#ifndef __DEBUG_IMAGE_INFO_H__
-#define __DEBUG_IMAGE_INFO_H__
-
-#define FOUR_MEG_PAGES 0x400
-#define FOUR_MEG_MASK ((FOUR_MEG_PAGES * EFI_PAGE_SIZE) - 1)
-
-#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof (VOID *))
-
-VOID
-CoreInitializeDebugImageInfoTable (
- VOID
- )
-/*++
-
-Routine Description:
-
- Creates and initializes the DebugImageInfo Table. Also creates the configuration
- table and registers it into the system table.
-
-Arguments:
- None
-
-Returns:
- NA
-
-Notes:
- This function allocates memory, frees it, and then allocates memory at an
- address within the initial allocation. Since this function is called early
- in DXE core initialization (before drivers are dispatched), this should not
- be a problem.
-
---*/
-;
-
-VOID
-CoreUpdateDebugTableCrc32 (
- VOID
- )
-/*++
-
-Routine Description:
-
- Update the CRC32 in the Debug Table.
- Since the CRC32 service is made available by the Runtime driver, we have to
- wait for the Runtime Driver to be installed before the CRC32 can be computed.
- This function is called elsewhere by the core when the runtime architectural
- protocol is produced.
-
-Arguments:
- None
-
-Returns:
- NA
-
---*/
-;
-
-VOID
-CoreNewDebugImageInfoEntry (
- UINT32 ImageInfoType,
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,
- EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
- the table if it's not large enough to accomidate another entry.
-
-Arguments:
-
- ImageInfoType - type of debug image information
- LoadedImage - pointer to the loaded image protocol for the image being loaded
- ImageHandle - image handle for the image being loaded
-
-Returns:
- NA
-
---*/
-;
-
-VOID
-CoreRemoveDebugImageInfoEntry (
- EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- Removes and frees an entry from the DebugImageInfo Table.
-
-Arguments:
-
- ImageHandle - image handle for the image being unloaded
-
-Returns:
-
- NA
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Core/Dxe/Dispatcher/Dispatcher.c b/EdkModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
deleted file mode 100644
index 9792a16..0000000
--- a/EdkModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
+++ /dev/null
@@ -1,1170 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Dispatcher.c
-
-Abstract:
-
- Tiano DXE Dispatcher.
-
- Step #1 - When a FV protocol is added to the system every driver in the FV
- is added to the mDiscoveredList. The SOR, Before, and After Depex are
- pre-processed as drivers are added to the mDiscoveredList. If an Apriori
- file exists in the FV those drivers are addeded to the
- mScheduledQueue. The mFvHandleList is used to make sure a
- FV is only processed once.
-
- Step #2 - Dispatch. Remove driver from the mScheduledQueue and load and
- start it. After mScheduledQueue is drained check the
- mDiscoveredList to see if any item has a Depex that is ready to
- be placed on the mScheduledQueue.
-
- Step #3 - Adding to the mScheduledQueue requires that you process Before
- and After dependencies. This is done recursively as the call to add
- to the mScheduledQueue checks for Before and recursively adds
- all Befores. It then addes the item that was passed in and then
- processess the After dependecies by recursively calling the routine.
-
- Dispatcher Rules:
- The rules for the dispatcher are in chapter 10 of the DXE CIS. Figure 10-3
- is the state diagram for the DXE dispatcher
-
- Depex - Dependency Expresion.
- SOR - Schedule On Request - Don't schedule if this bit is set.
-
---*/
-
-#include <DxeMain.h>
-
-//
-// The Driver List contains one copy of every driver that has been discovered.
-// Items are never removed from the driver list. List of EFI_CORE_DRIVER_ENTRY
-//
-LIST_ENTRY mDiscoveredList = INITIALIZE_LIST_HEAD_VARIABLE (mDiscoveredList);
-
-//
-// Queue of drivers that are ready to dispatch. This queue is a subset of the
-// mDiscoveredList.list of EFI_CORE_DRIVER_ENTRY.
-//
-LIST_ENTRY mScheduledQueue = INITIALIZE_LIST_HEAD_VARIABLE (mScheduledQueue);
-
-//
-// List of handles who's Fv's have been parsed and added to the mFwDriverList.
-//
-LIST_ENTRY mFvHandleList = INITIALIZE_LIST_HEAD_VARIABLE (mFvHandleList); // list of KNOWN_HANDLE
-
-//
-// Lock for mDiscoveredList, mScheduledQueue, gDispatcherRunning.
-//
-EFI_LOCK mDispatcherLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
-
-
-//
-// Flag for the DXE Dispacher. TRUE if dispatcher is execuing.
-//
-BOOLEAN gDispatcherRunning = FALSE;
-
-//
-// Module globals to manage the FwVol registration notification event
-//
-EFI_EVENT mFwVolEvent;
-VOID *mFwVolEventRegistration;
-
-//
-// List of file types supported by dispatcher
-//
-static EFI_FV_FILETYPE mDxeFileTypes[] = {
- EFI_FV_FILETYPE_DRIVER,
- EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,
- EFI_FV_FILETYPE_DXE_CORE,
- EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
-};
-
-typedef struct {
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH File;
- EFI_DEVICE_PATH_PROTOCOL End;
-} FV_FILEPATH_DEVICE_PATH;
-
-FV_FILEPATH_DEVICE_PATH mFvDevicePath;
-
-
-//
-// Function Prototypes
-//
-STATIC
-VOID
-CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
- IN EFI_CORE_DRIVER_ENTRY *InsertedDriverEntry
- );
-
-STATIC
-VOID
-EFIAPI
-CoreFwVolEventProtocolNotify (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-CoreFvToDevicePath (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *Fv,
- IN EFI_HANDLE FvHandle,
- IN EFI_GUID *DriverName
- );
-
-STATIC
-EFI_STATUS
-CoreAddToDriverList (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *Fv,
- IN EFI_HANDLE FvHandle,
- IN EFI_GUID *DriverName
- );
-
-STATIC
-EFI_STATUS
-CoreProcessFvImageFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *Fv,
- IN EFI_HANDLE FvHandle,
- IN EFI_GUID *DriverName
- );
-
-STATIC
-VOID
-CoreAcquireDispatcherLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Enter critical section by gaining lock on mDispatcherLock
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-
-{
- CoreAcquireLock (&mDispatcherLock);
-}
-
-STATIC
-VOID
-CoreReleaseDispatcherLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Exit critical section by releasing lock on mDispatcherLock
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- CoreReleaseLock (&mDispatcherLock);
-}
-
-STATIC
-EFI_STATUS
-CoreGetDepexSectionAndPreProccess (
- IN EFI_CORE_DRIVER_ENTRY *DriverEntry
- )
-/*++
-
-Routine Description:
-
- Read Depex and pre-process the Depex for Before and After. If Section Extraction
- protocol returns an error via ReadSection defer the reading of the Depex.
-
-Arguments:
-
- DriverEntry - Driver to work on.
-
-Returns:
-
- EFI_SUCCESS - Depex read and preprossesed
-
- EFI_PROTOCOL_ERROR - The section extraction protocol returned an error and
- Depex reading needs to be retried.
-
- Other Error - DEPEX not found.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SECTION_TYPE SectionType;
- UINT32 AuthenticationStatus;
- EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
-
-
- Fv = DriverEntry->Fv;
-
- //
- // Grab Depex info, it will never be free'ed.
- //
- SectionType = EFI_SECTION_DXE_DEPEX;
- Status = Fv->ReadSection (
- DriverEntry->Fv,
- &DriverEntry->FileName,
- SectionType,
- 0,
- &DriverEntry->Depex,
- (UINTN *)&DriverEntry->DepexSize,
- &AuthenticationStatus
- );
- if (EFI_ERROR (Status)) {
- if (Status == EFI_PROTOCOL_ERROR) {
- //
- // The section extraction protocol failed so set protocol error flag
- //
- DriverEntry->DepexProtocolError = TRUE;
- } else {
- //
- // If no Depex assume EFI 1.1 driver model
- //
- DriverEntry->Depex = NULL;
- DriverEntry->Dependent = TRUE;
- DriverEntry->DepexProtocolError = FALSE;
- }
- } else {
- //
- // Set Before, After, and Unrequested state information based on Depex
- // Driver will be put in Dependent or Unrequested state
- //
- CorePreProcessDepex (DriverEntry);
- DriverEntry->DepexProtocolError = FALSE;
- }
-
- return Status;
-}
-
-EFI_DXESERVICE
-EFI_STATUS
-EFIAPI
-CoreSchedule (
- IN EFI_HANDLE FirmwareVolumeHandle,
- IN EFI_GUID *DriverName
- )
-/*++
-
-Routine Description:
-
- Check every driver and locate a matching one. If the driver is found, the Unrequested
- state flag is cleared.
-
-Arguments:
-
- FirmwareVolumeHandle - The handle of the Firmware Volume that contains the firmware
- file specified by DriverName.
-
- DriverName - The Driver name to put in the Dependent state.
-
-Returns:
-
- EFI_SUCCESS - The DriverName was found and it's SOR bit was cleared
-
- EFI_NOT_FOUND - The DriverName does not exist or it's SOR bit was not set.
-
---*/
-{
- LIST_ENTRY *Link;
- EFI_CORE_DRIVER_ENTRY *DriverEntry;
-
- //
- // Check every driver
- //
- for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
- DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
- if (DriverEntry->FvHandle == FirmwareVolumeHandle &&
- DriverEntry->Unrequested &&
- CompareGuid (DriverName, &DriverEntry->FileName)) {
- //
- // Move the driver from the Unrequested to the Dependent state
- //
- CoreAcquireDispatcherLock ();
- DriverEntry->Unrequested = FALSE;
- DriverEntry->Dependent = TRUE;
- CoreReleaseDispatcherLock ();
-
- return EFI_SUCCESS;
- }
- }
- return EFI_NOT_FOUND;
-}
-
-
-EFI_DXESERVICE
-EFI_STATUS
-EFIAPI
-CoreTrust (
- IN EFI_HANDLE FirmwareVolumeHandle,
- IN EFI_GUID *DriverName
- )
-/*++
-
-Routine Description:
-
- Convert a driver from the Untrused back to the Scheduled state
-
-Arguments:
-
- FirmwareVolumeHandle - The handle of the Firmware Volume that contains the firmware
- file specified by DriverName.
-
- DriverName - The Driver name to put in the Scheduled state
-
-Returns:
-
- EFI_SUCCESS - The file was found in the untrusted state, and it was promoted
- to the trusted state.
-
- EFI_NOT_FOUND - The file was not found in the untrusted state.
-
---*/
-{
- LIST_ENTRY *Link;
- EFI_CORE_DRIVER_ENTRY *DriverEntry;
-
- //
- // Check every driver
- //
- for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
- DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
- if (DriverEntry->FvHandle == FirmwareVolumeHandle &&
- DriverEntry->Untrusted &&
- CompareGuid (DriverName, &DriverEntry->FileName)) {
- //
- // Transition driver from Untrusted to Scheduled state.
- //
- CoreAcquireDispatcherLock ();
- DriverEntry->Untrusted = FALSE;
- DriverEntry->Scheduled = TRUE;
- InsertTailList (&mScheduledQueue, &DriverEntry->ScheduledLink);
- CoreReleaseDispatcherLock ();
-
- return EFI_SUCCESS;
- }
- }
- return EFI_NOT_FOUND;
-}
-
-
-EFI_DXESERVICE
-EFI_STATUS
-EFIAPI
-CoreDispatcher (
- VOID
- )
-/*++
-
-Routine Description:
-
- This is the main Dispatcher for DXE and it exits when there are no more
- drivers to run. Drain the mScheduledQueue and load and start a PE
- image for each driver. Search the mDiscoveredList to see if any driver can
- be placed on the mScheduledQueue. If no drivers are placed on the
- mScheduledQueue exit the function. On exit it is assumed the Bds()
- will be called, and when the Bds() exits the Dispatcher will be called
- again.
-
-Arguments:
-
- NONE
-
-Returns:
-
- EFI_ALREADY_STARTED - The DXE Dispatcher is already running
-
- EFI_NOT_FOUND - No DXE Drivers were dispatched
-
- EFI_SUCCESS - One or more DXE Drivers were dispatched
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS ReturnStatus;
- LIST_ENTRY *Link;
- EFI_CORE_DRIVER_ENTRY *DriverEntry;
- BOOLEAN ReadyToRun;
-
- if (gDispatcherRunning) {
- //
- // If the dispatcher is running don't let it be restarted.
- //
- return EFI_ALREADY_STARTED;
- }
-
- gDispatcherRunning = TRUE;
-
-
- ReturnStatus = EFI_NOT_FOUND;
- do {
- //
- // Drain the Scheduled Queue
- //
- while (!IsListEmpty (&mScheduledQueue)) {
- DriverEntry = CR (
- mScheduledQueue.ForwardLink,
- EFI_CORE_DRIVER_ENTRY,
- ScheduledLink,
- EFI_CORE_DRIVER_ENTRY_SIGNATURE
- );
-
- //
- // Load the DXE Driver image into memory. If the Driver was transitioned from
- // Untrused to Scheduled it would have already been loaded so we may need to
- // skip the LoadImage
- //
- if (DriverEntry->ImageHandle == NULL) {
- Status = CoreLoadImage (
- FALSE,
- gDxeCoreImageHandle,
- DriverEntry->FvFileDevicePath,
- NULL,
- 0,
- &DriverEntry->ImageHandle
- );
-
- //
- // Update the driver state to reflect that it's been loaded
- //
- if (EFI_ERROR (Status)) {
- CoreAcquireDispatcherLock ();
-
- if (Status == EFI_SECURITY_VIOLATION) {
- //
- // Take driver from Scheduled to Untrused state
- //
- DriverEntry->Untrusted = TRUE;
- } else {
- //
- // The DXE Driver could not be loaded, and do not attempt to load or start it again.
- // Take driver from Scheduled to Initialized.
- //
- // This case include the Never Trusted state if EFI_ACCESS_DENIED is returned
- //
- DriverEntry->Initialized = TRUE;
- }
-
- DriverEntry->Scheduled = FALSE;
- RemoveEntryList (&DriverEntry->ScheduledLink);
-
- CoreReleaseDispatcherLock ();
-
- //
- // If it's an error don't try the StartImage
- //
- continue;
- }
- }
-
- CoreAcquireDispatcherLock ();
-
- DriverEntry->Scheduled = FALSE;
- DriverEntry->Initialized = TRUE;
- RemoveEntryList (&DriverEntry->ScheduledLink);
-
- CoreReleaseDispatcherLock ();
-
-
- CoreReportProgressCodeSpecific (EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_BEGIN, DriverEntry->ImageHandle);
- Status = CoreStartImage (DriverEntry->ImageHandle, NULL, NULL);
- CoreReportProgressCodeSpecific (EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END, DriverEntry->ImageHandle);
-
- ReturnStatus = EFI_SUCCESS;
- }
-
- //
- // Search DriverList for items to place on Scheduled Queue
- //
- ReadyToRun = FALSE;
- for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
- DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
-
- if (DriverEntry->DepexProtocolError){
- //
- // If Section Extraction Protocol did not let the Depex be read before retry the read
- //
- Status = CoreGetDepexSectionAndPreProccess (DriverEntry);
- }
-
- if (DriverEntry->Dependent) {
- if (CoreIsSchedulable (DriverEntry)) {
- CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry);
- ReadyToRun = TRUE;
- }
- }
- }
- } while (ReadyToRun);
-
- gDispatcherRunning = FALSE;
-
- return ReturnStatus;
-}
-
-STATIC
-VOID
-CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
- IN EFI_CORE_DRIVER_ENTRY *InsertedDriverEntry
- )
-/*++
-
-Routine Description:
-
- Insert InsertedDriverEntry onto the mScheduledQueue. To do this you
- must add any driver with a before dependency on InsertedDriverEntry first.
- You do this by recursively calling this routine. After all the Befores are
- processed you can add InsertedDriverEntry to the mScheduledQueue.
- Then you can add any driver with an After dependency on InsertedDriverEntry
- by recursively calling this routine.
-
-Arguments:
-
- InsertedDriverEntry - The driver to insert on the ScheduledLink Queue
-
-Returns:
-
- NONE
-
---*/
-{
- LIST_ENTRY *Link;
- EFI_CORE_DRIVER_ENTRY *DriverEntry;
-
- //
- // Process Before Dependency
- //
- for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
- DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
- if (DriverEntry->Before && DriverEntry->Dependent) {
- if (CompareGuid (&InsertedDriverEntry->FileName, &DriverEntry->BeforeAfterGuid)) {
- //
- // Recursively process BEFORE
- //
- CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry);
- }
- }
- }
-
- //
- // Convert driver from Dependent to Scheduled state
- //
- CoreAcquireDispatcherLock ();
-
- InsertedDriverEntry->Dependent = FALSE;
- InsertedDriverEntry->Scheduled = TRUE;
- InsertTailList (&mScheduledQueue, &InsertedDriverEntry->ScheduledLink);
-
- CoreReleaseDispatcherLock ();
-
- //
- // Process After Dependency
- //
- for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
- DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
- if (DriverEntry->After && DriverEntry->Dependent) {
- if (CompareGuid (&InsertedDriverEntry->FileName, &DriverEntry->BeforeAfterGuid)) {
- //
- // Recursively process AFTER
- //
- CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (DriverEntry);
- }
- }
- }
-}
-
-STATIC
-BOOLEAN
-FvHasBeenProcessed (
- IN EFI_HANDLE FvHandle
- )
-/*++
-
-Routine Description:
-
- Return TRUE if the Fv has been processed, FALSE if not.
-
-Arguments:
-
- FvHandle - The handle of a FV that's being tested
-
-Returns:
-
- TRUE - Fv protocol on FvHandle has been processed
-
- FALSE - Fv protocol on FvHandle has not yet been processed
-
---*/
-{
- LIST_ENTRY *Link;
- KNOWN_HANDLE *KnownHandle;
-
- for (Link = mFvHandleList.ForwardLink; Link != &mFvHandleList; Link = Link->ForwardLink) {
- KnownHandle = CR(Link, KNOWN_HANDLE, Link, KNOWN_HANDLE_SIGNATURE);
- if (KnownHandle->Handle == FvHandle) {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-STATIC
-VOID
-FvIsBeingProcesssed (
- IN EFI_HANDLE FvHandle
- )
-/*++
-
-Routine Description:
-
- Remember that Fv protocol on FvHandle has had it's drivers placed on the
- mDiscoveredList. This fucntion adds entries on the mFvHandleList. Items are
- never removed/freed from the mFvHandleList.
-
-Arguments:
-
- FvHandle - The handle of a FV that has been processed
-
-Returns:
-
- None
-
---*/
-{
- KNOWN_HANDLE *KnownHandle;
-
- KnownHandle = CoreAllocateBootServicesPool (sizeof (KNOWN_HANDLE));
- ASSERT (KnownHandle != NULL);
-
- KnownHandle->Signature = KNOWN_HANDLE_SIGNATURE;
- KnownHandle->Handle = FvHandle;
- InsertTailList (&mFvHandleList, &KnownHandle->Link);
-}
-
-
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-CoreFvToDevicePath (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *Fv,
- IN EFI_HANDLE FvHandle,
- IN EFI_GUID *DriverName
- )
-/*++
-
-Routine Description:
-
- Convert FvHandle and DriverName into an EFI device path
-
-Arguments:
-
- Fv - Fv protocol, needed to read Depex info out of FLASH.
-
- FvHandle - Handle for Fv, needed in the EFI_CORE_DRIVER_ENTRY so that the
- PE image can be read out of the FV at a later time.
-
- DriverName - Name of driver to add to mDiscoveredList.
-
-Returns:
-
- Pointer to device path constructed from FvHandle and DriverName
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *FvDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *FileNameDevicePath;
-
- //
- // Remember the device path of the FV
- //
- Status = CoreHandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
- if (EFI_ERROR (Status)) {
- FileNameDevicePath = NULL;
- } else {
- //
- // Build a device path to the file in the FV to pass into gBS->LoadImage
- //
- EfiInitializeFwVolDevicepathNode (&mFvDevicePath.File, DriverName);
- mFvDevicePath.End.Type = EFI_END_ENTIRE_DEVICE_PATH;
- mFvDevicePath.End.SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
- SetDevicePathNodeLength (&mFvDevicePath.End, sizeof (EFI_DEVICE_PATH_PROTOCOL));
-
- FileNameDevicePath = CoreAppendDevicePath (
- FvDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath
- );
- }
-
- return FileNameDevicePath;
-}
-
-
-
-EFI_STATUS
-CoreAddToDriverList (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *Fv,
- IN EFI_HANDLE FvHandle,
- IN EFI_GUID *DriverName
- )
-/*++
-
-Routine Description:
-
- Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry,
- and initilize any state variables. Read the Depex from the FV and store it
- in DriverEntry. Pre-process the Depex to set the SOR, Before and After state.
- The Discovered list is never free'ed and contains booleans that represent the
- other possible DXE driver states.
-
-Arguments:
-
- Fv - Fv protocol, needed to read Depex info out of FLASH.
-
- FvHandle - Handle for Fv, needed in the EFI_CORE_DRIVER_ENTRY so that the
- PE image can be read out of the FV at a later time.
-
- DriverName - Name of driver to add to mDiscoveredList.
-
-Returns:
-
- EFI_SUCCESS - If driver was added to the mDiscoveredList.
-
- EFI_ALREADY_STARTED - The driver has already been started. Only one DriverName
- may be active in the system at any one time.
-
---*/
-{
- EFI_CORE_DRIVER_ENTRY *DriverEntry;
-
-
- //
- // Create the Driver Entry for the list. ZeroPool initializes lots of variables to
- // NULL or FALSE.
- //
- DriverEntry = CoreAllocateZeroBootServicesPool (sizeof (EFI_CORE_DRIVER_ENTRY));
- ASSERT (DriverEntry != NULL);
-
- DriverEntry->Signature = EFI_CORE_DRIVER_ENTRY_SIGNATURE;
- CopyMem (&DriverEntry->FileName, DriverName, sizeof (EFI_GUID));
- DriverEntry->FvHandle = FvHandle;
- DriverEntry->Fv = Fv;
- DriverEntry->FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName);
-
- CoreGetDepexSectionAndPreProccess (DriverEntry);
-
- CoreAcquireDispatcherLock ();
-
- InsertTailList (&mDiscoveredList, &DriverEntry->Link);
-
- CoreReleaseDispatcherLock ();
-
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-CoreProcessFvImageFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *Fv,
- IN EFI_HANDLE FvHandle,
- IN EFI_GUID *DriverName
- )
-/*++
-
-Routine Description:
-
- Get the driver from the FV through driver name, and produce a FVB protocol on FvHandle.
-
-Arguments:
-
- Fv - The FIRMWARE_VOLUME protocol installed on the FV.
- FvHandle - The handle which FVB protocol installed on.
- DriverName - The driver guid specified.
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough memory or other resource.
-
- EFI_VOLUME_CORRUPTED - Corrupted volume.
-
- EFI_SUCCESS - Function successfully returned.
-
-
---*/
-{
- EFI_STATUS Status;
- EFI_SECTION_TYPE SectionType;
- UINT32 AuthenticationStatus;
- VOID *Buffer;
- UINTN BufferSize;
-
- //
- // Read the first (and only the first) firmware volume section
- //
- SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;
- Buffer = NULL;
- BufferSize = 0;
- Status = Fv->ReadSection (
- Fv,
- DriverName,
- SectionType,
- 0,
- &Buffer,
- &BufferSize,
- &AuthenticationStatus
- );
- if (!EFI_ERROR (Status)) {
- //
- // Produce a FVB protocol for the file
- //
- Status = ProduceFVBProtocolOnBuffer (
- (EFI_PHYSICAL_ADDRESS) (UINTN) Buffer,
- (UINT64)BufferSize,
- FvHandle,
- NULL
- );
- }
-
- if (EFI_ERROR (Status) && (Buffer != NULL)) {
- //
- // ReadSection or Produce FVB failed, Free data buffer
- //
- CoreFreePool (Buffer);
-
- }
-
- return Status;
-}
-
-STATIC
-VOID
-EFIAPI
-CoreFwVolEventProtocolNotify (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Event notification that is fired every time a FV dispatch protocol is added.
- More than one protocol may have been added when this event is fired, so you
- must loop on CoreLocateHandle () to see how many protocols were added and
- do the following to each FV:
-
- If the Fv has already been processed, skip it. If the Fv has not been
- processed then mark it as being processed, as we are about to process it.
-
- Read the Fv and add any driver in the Fv to the mDiscoveredList.The
- mDiscoveredList is never free'ed and contains variables that define
- the other states the DXE driver transitions to..
-
- While you are at it read the A Priori file into memory.
- Place drivers in the A Priori list onto the mScheduledQueue.
-
-Arguments:
-
- Event - The Event that is being processed, not used.
-
- Context - Event Context, not used.
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS GetNextFileStatus;
- EFI_STATUS SecurityStatus;
- EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
- EFI_DEVICE_PATH_PROTOCOL *FvDevicePath;
- EFI_HANDLE FvHandle;
- UINTN BufferSize;
- EFI_GUID NameGuid;
- UINTN Key;
- EFI_FV_FILETYPE Type;
- EFI_FV_FILE_ATTRIBUTES Attributes;
- UINTN Size;
- EFI_CORE_DRIVER_ENTRY *DriverEntry;
- EFI_GUID *AprioriFile;
- UINTN AprioriEntryCount;
- UINTN Index;
- LIST_ENTRY *Link;
- UINT32 AuthenticationStatus;
- UINTN SizeOfBuffer;
-
-
- while (TRUE) {
- BufferSize = sizeof (EFI_HANDLE);
- Status = CoreLocateHandle (
- ByRegisterNotify,
- NULL,
- mFwVolEventRegistration,
- &BufferSize,
- &FvHandle
- );
- if (EFI_ERROR (Status)) {
- //
- // If no more notification events exit
- //
- return;
- }
-
- if (FvHasBeenProcessed (FvHandle)) {
- //
- // This Fv has already been processed so lets skip it!
- //
- continue;
- }
-
- Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolumeDispatchProtocolGuid, (VOID **)&Fv);
- if (EFI_ERROR (Status)) {
- //
- // If no dispatch protocol then skip, but do not marked as being processed as it
- // may show up later.
- //
- continue;
- }
-
- //
- // Since we are about to process this Fv mark it as processed.
- //
- FvIsBeingProcesssed (FvHandle);
-
-
- Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolumeProtocolGuid, (VOID **)&Fv);
- if (EFI_ERROR (Status)) {
- //
- // The Handle has a FirmwareVolumeDispatch protocol and should also contiain
- // a FirmwareVolume protocol thus we should never get here.
- //
- ASSERT (FALSE);
- continue;
- }
-
- Status = CoreHandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
- if (EFI_ERROR (Status)) {
- //
- // The Firmware volume doesn't have device path, can't be dispatched.
- //
- continue;
- }
-
- //
- // Evaluate the authentication status of the Firmware Volume through
- // Security Architectural Protocol
- //
- if (gSecurity != NULL) {
- SecurityStatus = gSecurity->FileAuthenticationState (
- gSecurity,
- 0,
- FvDevicePath
- );
- if (SecurityStatus != EFI_SUCCESS) {
- //
- // Security check failed. The firmware volume should not be used for any purpose.
- //
- continue;
- }
- }
-
- //
- // Discover Drivers in FV and add them to the Discovered Driver List.
- // Process EFI_FV_FILETYPE_DRIVER type and then EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER
- // EFI_FV_FILETYPE_DXE_CORE is processed to produce a Loaded Image protocol for the core
- // EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE is processed to create a Fvb
- //
- for (Index = 0; Index < sizeof (mDxeFileTypes)/sizeof (EFI_FV_FILETYPE); Index++) {
- //
- // Initialize the search key
- //
- Key = 0;
- do {
- Type = mDxeFileTypes[Index];
- GetNextFileStatus = Fv->GetNextFile (
- Fv,
- &Key,
- &Type,
- &NameGuid,
- &Attributes,
- &Size
- );
- if (!EFI_ERROR (GetNextFileStatus)) {
- if (Type == EFI_FV_FILETYPE_DXE_CORE) {
- //
- // If this is the DXE core fill in it's DevicePath & DeviceHandle
- //
- if (gDxeCoreLoadedImage->FilePath == NULL) {
- if (CompareGuid (&NameGuid, gDxeCoreFileName)) {
- //
- // Maybe One specail Fv cantains only one DXE_CORE module, so its device path must
- // be initialized completely.
- //
- EfiInitializeFwVolDevicepathNode (&mFvDevicePath.File, &NameGuid);
- mFvDevicePath.End.Type = EFI_END_ENTIRE_DEVICE_PATH;
- mFvDevicePath.End.SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
- SetDevicePathNodeLength (&mFvDevicePath.End, sizeof (EFI_DEVICE_PATH_PROTOCOL));
-
- gDxeCoreLoadedImage->FilePath = CoreDuplicateDevicePath (
- (EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath
- );
- gDxeCoreLoadedImage->DeviceHandle = FvHandle;
- }
- }
- } else if (Type == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {
- //
- // Found a firmware volume image. Produce a firmware volume block
- // protocol for it so it gets dispatched from. This is usually a
- // capsule.
- //
- CoreProcessFvImageFile (Fv, FvHandle, &NameGuid);
- } else {
- //
- // Transition driver from Undiscovered to Discovered state
- //
- CoreAddToDriverList (Fv, FvHandle, &NameGuid);
- }
- }
- } while (!EFI_ERROR (GetNextFileStatus));
- }
-
- //
- // Read the array of GUIDs from the Apriori file if it is present in the firmware volume
- //
- AprioriFile = NULL;
- Status = Fv->ReadSection (
- Fv,
- &gAprioriGuid,
- EFI_SECTION_RAW,
- 0,
- (VOID **)&AprioriFile,
- &SizeOfBuffer,
- &AuthenticationStatus
- );
- if (!EFI_ERROR (Status)) {
- AprioriEntryCount = SizeOfBuffer / sizeof (EFI_GUID);
- } else {
- AprioriEntryCount = 0;
- }
-
- //
- // Put drivers on Apriori List on the Scheduled queue. The Discovered List includes
- // drivers not in the current FV and these must be skipped since the a priori list
- // is only valid for the FV that it resided in.
- //
- CoreAcquireDispatcherLock ();
-
- for (Index = 0; Index < AprioriEntryCount; Index++) {
- for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
- DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
- if (CompareGuid (&DriverEntry->FileName, &AprioriFile[Index]) &&
- (FvHandle == DriverEntry->FvHandle)) {
- DriverEntry->Dependent = FALSE;
- DriverEntry->Scheduled = TRUE;
- InsertTailList (&mScheduledQueue, &DriverEntry->ScheduledLink);
- break;
- }
- }
- }
-
- CoreReleaseDispatcherLock ();
-
- //
- // Free data allocated by Fv->ReadSection ()
- //
- CoreFreePool (AprioriFile);
- }
-}
-
-
-VOID
-CoreInitializeDispatcher (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initialize the dispatcher. Initialize the notification function that runs when
- a FV protocol is added to the system.
-
-Arguments:
-
- NONE
-
-Returns:
-
- NONE
-
---*/
-{
- mFwVolEvent = CoreCreateProtocolNotifyEvent (
- &gEfiFirmwareVolumeProtocolGuid,
- TPL_CALLBACK,
- CoreFwVolEventProtocolNotify,
- NULL,
- &mFwVolEventRegistration,
- TRUE
- );
-}
-
-//
-// Function only used in debug builds
-//
-VOID
-CoreDisplayDiscoveredNotDispatched (
- VOID
- )
-/*++
-
-Routine Description:
-
- Traverse the discovered list for any drivers that were discovered but not loaded
- because the dependency experessions evaluated to false
-
-Arguments:
-
- NONE
-
-Returns:
-
- NONE
-
---*/
-{
- LIST_ENTRY *Link;
- EFI_CORE_DRIVER_ENTRY *DriverEntry;
-
- for (Link = mDiscoveredList.ForwardLink;Link !=&mDiscoveredList; Link = Link->ForwardLink) {
- DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
- if (DriverEntry->Dependent) {
- DEBUG ((EFI_D_LOAD, "Driver %g was discovered but not loaded!!\n", &DriverEntry->FileName));
- }
- }
-}
diff --git a/EdkModulePkg/Core/Dxe/Dispatcher/dependency.c b/EdkModulePkg/Core/Dxe/Dispatcher/dependency.c
deleted file mode 100644
index 7c2093b..0000000
--- a/EdkModulePkg/Core/Dxe/Dispatcher/dependency.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- dependency.c
-
-Abstract:
-
- DXE Dispatcher Dependency Evaluator
-
- This routine evaluates a dependency expression (DEPENDENCY_EXPRESSION) to determine
- if a driver can be scheduled for execution. The criteria for
- schedulability is that the dependency expression is satisfied.
-
---*/
-
-#include <DxeMain.h>
-
-//
-// Global stack used to evaluate dependency expressions
-//
-BOOLEAN *mDepexEvaluationStack = NULL;
-BOOLEAN *mDepexEvaluationStackEnd = NULL;
-BOOLEAN *mDepexEvaluationStackPointer = NULL;
-
-//
-// Worker functions
-//
-
-STATIC
-EFI_STATUS
-GrowDepexStack (
- VOID
- )
-/*++
-
-Routine Description:
-
- Grow size of the Depex stack
-
-Arguments:
-
- Stack - Old stack on the way in and new stack on the way out
-
- StackSize - New size of the stack
-
-Returns:
-
- EFI_SUCCESS - Stack successfully growed.
-
- EFI_OUT_OF_RESOURCES - There is not enough system memory to grow the stack.
-
-
-
---*/
-{
- BOOLEAN *NewStack;
- UINTN Size;
-
- Size = DEPEX_STACK_SIZE_INCREMENT;
- if (mDepexEvaluationStack != NULL) {
- Size = Size + (mDepexEvaluationStackEnd - mDepexEvaluationStack);
- }
-
- NewStack = CoreAllocateBootServicesPool (Size * sizeof (BOOLEAN));
- if (NewStack == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (mDepexEvaluationStack != NULL) {
- //
- // Copy to Old Stack to the New Stack
- //
- CopyMem (
- NewStack,
- mDepexEvaluationStack,
- (mDepexEvaluationStackEnd - mDepexEvaluationStack) * sizeof (BOOLEAN)
- );
-
- //
- // Free The Old Stack
- //
- CoreFreePool (mDepexEvaluationStack);
- }
-
- //
- // Make the Stack pointer point to the old data in the new stack
- //
- mDepexEvaluationStackPointer = NewStack + (mDepexEvaluationStackPointer - mDepexEvaluationStack);
- mDepexEvaluationStack = NewStack;
- mDepexEvaluationStackEnd = NewStack + Size;
-
- return EFI_SUCCESS;
-}
-
-
-STATIC
-EFI_STATUS
-PushBool (
- IN BOOLEAN Value
- )
-/*++
-
-Routine Description:
-
- Push an element onto the Boolean Stack
-
-Arguments:
-
- Value - BOOLEAN to push.
-
-Returns:
-
- EFI_SUCCESS - The value was pushed onto the stack.
-
- EFI_OUT_OF_RESOURCES - There is not enough system memory to grow the stack.
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Check for a stack overflow condition
- //
- if (mDepexEvaluationStackPointer == mDepexEvaluationStackEnd) {
- //
- // Grow the stack
- //
- Status = GrowDepexStack ();
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- //
- // Push the item onto the stack
- //
- *mDepexEvaluationStackPointer = Value;
- mDepexEvaluationStackPointer++;
-
- return EFI_SUCCESS;
-}
-
-
-STATIC
-EFI_STATUS
-PopBool (
- OUT BOOLEAN *Value
- )
-/*++
-
-Routine Description:
-
- Pop an element from the Boolean stack.
-
-Arguments:
-
- Value - BOOLEAN to pop.
-
-Returns:
-
- EFI_SUCCESS - The value was popped onto the stack.
-
- EFI_ACCESS_DENIED - The pop operation underflowed the stack
-
---*/
-{
- //
- // Check for a stack underflow condition
- //
- if (mDepexEvaluationStackPointer == mDepexEvaluationStack) {
- return EFI_ACCESS_DENIED;
- }
-
- //
- // Pop the item off the stack
- //
- mDepexEvaluationStackPointer--;
- *Value = *mDepexEvaluationStackPointer;
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CorePreProcessDepex (
- IN EFI_CORE_DRIVER_ENTRY *DriverEntry
- )
-/*++
-
-Routine Description:
-
- Preprocess dependency expression and update DriverEntry to reflect the
- state of Before, After, and SOR dependencies. If DriverEntry->Before
- or DriverEntry->After is set it will never be cleared. If SOR is set
- it will be cleared by CoreSchedule(), and then the driver can be
- dispatched.
-
-Arguments:
-
- DriverEntry - DriverEntry element to update
-
-Returns:
-
- EFI_SUCCESS - It always works.
-
---*/
-{
- UINT8 *Iterator;
-
- Iterator = DriverEntry->Depex;
- if (*Iterator == EFI_DEP_SOR) {
- DriverEntry->Unrequested = TRUE;
- } else {
- DriverEntry->Dependent = TRUE;
- }
-
- if (*Iterator == EFI_DEP_BEFORE) {
- DriverEntry->Before = TRUE;
- } else if (*Iterator == EFI_DEP_AFTER) {
- DriverEntry->After = TRUE;
- }
-
- if (DriverEntry->Before || DriverEntry->After) {
- CopyMem (&DriverEntry->BeforeAfterGuid, Iterator + 1, sizeof (EFI_GUID));
- }
-
- return EFI_SUCCESS;
-}
-
-
-BOOLEAN
-CoreIsSchedulable (
- IN EFI_CORE_DRIVER_ENTRY *DriverEntry
- )
-/*++
-
-Routine Description:
-
- This is the POSTFIX version of the dependency evaluator. This code does
- not need to handle Before or After, as it is not valid to call this
- routine in this case. The SOR is just ignored and is a nop in the grammer.
-
- POSTFIX means all the math is done on top of the stack.
-
-Arguments:
-
- DriverEntry - DriverEntry element to update
-
-Returns:
-
- TRUE - If driver is ready to run.
-
- FALSE - If driver is not ready to run or some fatal error was found.
-
---*/
-{
- EFI_STATUS Status;
- UINT8 *Iterator;
- BOOLEAN Operator;
- BOOLEAN Operator2;
- EFI_GUID DriverGuid;
- VOID *Interface;
-
- if (DriverEntry->After || DriverEntry->Before) {
- //
- // If Before or After Depex skip as CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter ()
- // processes them.
- //
- return FALSE;
- }
-
- if (DriverEntry->Depex == NULL) {
- //
- // A NULL Depex means treat the driver like an EFI 1.0 thing.
- //
- Status = CoreAllEfiServicesAvailable ();
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
- return TRUE;
- }
-
- //
- // Clean out memory leaks in Depex Boolean stack. Leaks are only caused by
- // incorrectly formed DEPEX expressions
- //
- mDepexEvaluationStackPointer = mDepexEvaluationStack;
-
-
- Iterator = DriverEntry->Depex;
-
- while (TRUE) {
- //
- // Check to see if we are attempting to fetch dependency expression instructions
- // past the end of the dependency expression.
- //
- if (((UINTN)Iterator - (UINTN)DriverEntry->Depex) >= DriverEntry->DepexSize) {
- return FALSE;
- }
-
- //
- // Look at the opcode of the dependency expression instruction.
- //
- switch (*Iterator) {
- case EFI_DEP_BEFORE:
- case EFI_DEP_AFTER:
- //
- // For a well-formed Dependency Expression, the code should never get here.
- // The BEFORE and AFTER are processed prior to this routine's invocation.
- // If the code flow arrives at this point, there was a BEFORE or AFTER
- // that were not the first opcodes.
- //
- ASSERT (FALSE);
- case EFI_DEP_SOR:
- //
- // These opcodes can only appear once as the first opcode. If it is found
- // at any other location, then the dependency expression evaluates to FALSE
- //
- if (Iterator != DriverEntry->Depex) {
- return FALSE;
- }
- //
- // Otherwise, it is the first opcode and should be treated as a NOP.
- //
- break;
-
- case EFI_DEP_PUSH:
- //
- // Push operator is followed by a GUID. Test to see if the GUID protocol
- // is installed and push the boolean result on the stack.
- //
- CopyMem (&DriverGuid, Iterator + 1, sizeof (EFI_GUID));
-
- Status = CoreLocateProtocol (&DriverGuid, NULL, &Interface);
-
- if (EFI_ERROR (Status)) {
- Status = PushBool (FALSE);
- } else {
- *Iterator = EFI_DEP_REPLACE_TRUE;
- Status = PushBool (TRUE);
- }
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- Iterator += sizeof (EFI_GUID);
- break;
-
- case EFI_DEP_AND:
- Status = PopBool (&Operator);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- Status = PopBool (&Operator2);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- Status = PushBool ((BOOLEAN)(Operator && Operator2));
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
- break;
-
- case EFI_DEP_OR:
- Status = PopBool (&Operator);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- Status = PopBool (&Operator2);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- Status = PushBool ((BOOLEAN)(Operator || Operator2));
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
- break;
-
- case EFI_DEP_NOT:
- Status = PopBool (&Operator);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- Status = PushBool ((BOOLEAN)(!Operator));
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
- break;
-
- case EFI_DEP_TRUE:
- Status = PushBool (TRUE);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
- break;
-
- case EFI_DEP_FALSE:
- Status = PushBool (FALSE);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
- break;
-
- case EFI_DEP_END:
- Status = PopBool (&Operator);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
- return Operator;
-
- case EFI_DEP_REPLACE_TRUE:
- Status = PushBool (TRUE);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- Iterator += sizeof (EFI_GUID);
- break;
-
- default:
- goto Done;
- }
-
- //
- // Skip over the Dependency Op Code we just processed in the switch.
- // The math is done out of order, but it should not matter. That is
- // we may add in the sizeof (EFI_GUID) before we account for the OP Code.
- // This is not an issue, since we just need the correct end result. You
- // need to be careful using Iterator in the loop as it's intermediate value
- // may be strange.
- //
- Iterator++;
- }
-
-Done:
- return FALSE;
-}
-
diff --git a/EdkModulePkg/Core/Dxe/DxeMain.h b/EdkModulePkg/Core/Dxe/DxeMain.h
deleted file mode 100644
index b4cd76a..0000000
--- a/EdkModulePkg/Core/Dxe/DxeMain.h
+++ /dev/null
@@ -1,2762 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeMain.h
-
-Abstract:
-
-Revision History
-
---*/
-
-#ifndef _DXE_MAIN_H_
-#define _DXE_MAIN_H_
-
-
-#include "DebugImageInfo.h"
-#include "Library.h"
-#include "FwVolBlock.h"
-#include "FwVolDriver.h"
-#include "gcd.h"
-#include "imem.h"
-#include "Image.h"
-#include "Exec.h"
-#include "hand.h"
-
-///
-/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
-/// to save time. A EFI_DEP_PUSH is evauated one an
-/// replaced with EFI_DEP_REPLACE_TRUE
-///
-#define EFI_DEP_REPLACE_TRUE 0xff
-
-///
-/// Define the initial size of the dependency expression evaluation stack
-///
-#define DEPEX_STACK_SIZE_INCREMENT 0x1000
-
-typedef struct {
- EFI_GUID *ProtocolGuid;
- VOID **Protocol;
- EFI_EVENT Event;
- VOID *Registration;
- BOOLEAN Present;
-} ARCHITECTURAL_PROTOCOL_ENTRY;
-
-
-//
-// DXE Dispatcher Data structures
-//
-
-#define KNOWN_HANDLE_SIGNATURE EFI_SIGNATURE_32('k','n','o','w')
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link; // mFvHandleList
- EFI_HANDLE Handle;
-} KNOWN_HANDLE;
-
-
-#define EFI_CORE_DRIVER_ENTRY_SIGNATURE EFI_SIGNATURE_32('d','r','v','r')
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link; // mDriverList
-
- LIST_ENTRY ScheduledLink; // mScheduledQueue
-
- EFI_HANDLE FvHandle;
- EFI_GUID FileName;
- EFI_DEVICE_PATH_PROTOCOL *FvFileDevicePath;
- EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
-
- VOID *Depex;
- UINTN DepexSize;
-
- BOOLEAN Before;
- BOOLEAN After;
- EFI_GUID BeforeAfterGuid;
-
- BOOLEAN Dependent;
- BOOLEAN Unrequested;
- BOOLEAN Scheduled;
- BOOLEAN Untrusted;
- BOOLEAN Initialized;
- BOOLEAN DepexProtocolError;
-
- EFI_HANDLE ImageHandle;
-
-} EFI_CORE_DRIVER_ENTRY;
-
-//
-//The data structure of GCD memory map entry
-//
-#define EFI_GCD_MAP_SIGNATURE EFI_SIGNATURE_32('g','c','d','m')
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- EFI_PHYSICAL_ADDRESS BaseAddress;
- UINT64 EndAddress;
- UINT64 Capabilities;
- UINT64 Attributes;
- EFI_GCD_MEMORY_TYPE GcdMemoryType;
- EFI_GCD_IO_TYPE GcdIoType;
- EFI_HANDLE ImageHandle;
- EFI_HANDLE DeviceHandle;
-} EFI_GCD_MAP_ENTRY;
-
-//
-// DXE Core Global Variables
-//
-extern EFI_SYSTEM_TABLE *gDxeCoreST;
-extern EFI_BOOT_SERVICES *gDxeCoreBS;
-extern EFI_RUNTIME_SERVICES *gDxeCoreRT;
-extern EFI_DXE_SERVICES *gDxeCoreDS;
-extern EFI_HANDLE gDxeCoreImageHandle;
-
-extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress;
-extern EFI_PEI_PE_COFF_LOADER_PROTOCOL *gEfiPeiPeCoffLoader;
-
-extern EFI_RUNTIME_ARCH_PROTOCOL *gRuntime;
-extern EFI_CPU_ARCH_PROTOCOL *gCpu;
-extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer;
-extern EFI_METRONOME_ARCH_PROTOCOL *gMetronome;
-extern EFI_TIMER_ARCH_PROTOCOL *gTimer;
-extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity;
-extern EFI_BDS_ARCH_PROTOCOL *gBds;
-extern EFI_STATUS_CODE_PROTOCOL *gStatusCode;
-
-extern EFI_TPL gEfiCurrentTpl;
-
-extern EFI_GUID *gDxeCoreFileName;
-extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;
-
-extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1];
-
-extern BOOLEAN gDispatcherRunning;
-extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate;
-
-//
-// Service Initialization Functions
-//
-
-
-VOID
-CoreInitializePool (
- VOID
- )
-/*++
-
-Routine Description:
-
- Called to initialize the pool.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-VOID
-CoreAddMemoryDescriptor (
- IN EFI_MEMORY_TYPE Type,
- IN EFI_PHYSICAL_ADDRESS Start,
- IN UINT64 NumberOfPages,
- IN UINT64 Attribute
- )
-/*++
-
-Routine Description:
-
- Called to initialize the memory map and add descriptors to
- the current descriptor list.
-
- The first descriptor that is added must be general usable
- memory as the addition allocates heap.
-
-Arguments:
-
- Type - The type of memory to add
-
- Start - The starting address in the memory range
- Must be page aligned
-
- NumberOfPages - The number of pages in the range
-
- Attribute - Attributes of the memory to add
-
-Returns:
-
- None. The range is added to the memory map
-
---*/
-;
-
-VOID
-CoreReleaseGcdMemoryLock (
- VOID
- )
-/*++
-
-Routine Description:
- Release memory lock on mGcdMemorySpaceLock
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-;
-
-VOID
-CoreAcquireGcdMemoryLock (
- VOID
- )
-/*++
-
-Routine Description:
- Acquire memory lock on mGcdMemorySpaceLock
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-;
-
-EFI_STATUS
-CoreInitializeMemoryServices (
- IN VOID **HobStart,
- IN EFI_PHYSICAL_ADDRESS *MemoryBaseAddress,
- IN UINT64 *MemoryLength
- )
-/*++
-
-Routine Description:
-
- External function. Initializes the GCD and memory services based on the memory
- descriptor HOBs. This function is responsible for priming the GCD map and the
- memory map, so memory allocations and resource allocations can be made. The first
- part of this function can not depend on any memory services until at least one
- memory descriptor is provided to the memory services. Then the memory services
- can be used to intialize the GCD map.
-
-Arguments:
-
- HobStart - The start address of the HOB.
-
- MemoryBaseAddress - Start address of memory region found to init DXE core.
-
- MemoryLength - Length of memory region found to init DXE core.
-
-Returns:
-
- EFI_SUCCESS - Memory services successfully initialized.
-
---*/
-;
-
-
-EFI_STATUS
-CoreInitializeGcdServices (
- IN VOID **HobStart,
- IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress,
- IN UINT64 MemoryLength
- )
-/*++
-
-Routine Description:
-
- External function. Initializes the GCD and memory services based on the memory
- descriptor HOBs. This function is responsible for priming the GCD map and the
- memory map, so memory allocations and resource allocations can be made. The first
- part of this function can not depend on any memory services until at least one
- memory descriptor is provided to the memory services. Then the memory services
- can be used to intialize the GCD map.
-
-Arguments:
-
- HobStart - The start address of the HOB
-
- MemoryBaseAddress - Start address of memory region found to init DXE core.
-
- MemoryLength - Length of memory region found to init DXE core.
-
-
-Returns:
-
- EFI_SUCCESS - GCD services successfully initialized.
-
---*/
-;
-
-EFI_STATUS
-CoreInitializeEventServices (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initializes "event" support and populates parts of the System and Runtime Table.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - Always return success
-
---*/
-;
-
-EFI_STATUS
-CoreInitializeImageServices (
- IN VOID *HobStart
- )
-/*++
-
-Routine Description:
-
- Add the Image Services to EFI Boot Services Table and install the protocol
- interfaces for this image.
-
-Arguments:
-
- HobStart - The HOB to initialize
-
-Returns:
-
- Status code.
-
---*/
-;
-
-VOID
-CoreNotifyOnArchProtocolInstallation (
- VOID
- )
-/*++
-
-Routine Description:
- Creates an event that is fired everytime a Protocol of a specific type is installed
-
-Arguments:
- NONE
-
-Returns:
- NONE
-
---*/
-;
-
-EFI_STATUS
-CoreAllEfiServicesAvailable (
- VOID
- )
-/*++
-
-Routine Description:
- Return TRUE if all AP services are availible.
-
-Arguments:
- NONE
-
-Returns:
- EFI_SUCCESS - All AP services are available
- EFI_NOT_FOUND - At least one AP service is not available
-
---*/
-;
-
-VOID
-CalculateEfiHdrCrc (
- IN OUT EFI_TABLE_HEADER *Hdr
- )
-/*++
-
-Routine Description:
-
- Calcualte the 32-bit CRC in a EFI table using the service provided by the
- gRuntime service.
-
-Arguments:
-
- Hdr - Pointer to an EFI standard header
-
-Returns:
-
- None
-
---*/
-;
-
-VOID
-EFIAPI
-CoreTimerTick (
- IN UINT64 Duration
- )
-/*++
-
-Routine Description:
-
- Called by the platform code to process a tick.
-
-Arguments:
-
- Duration - The number of 100ns elasped since the last call to TimerTick
-
-Returns:
-
- None
-
---*/
-;
-
-VOID
-CoreInitializeDispatcher (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initialize the dispatcher. Initialize the notification function that runs when
- a FV protocol is added to the system.
-
-Arguments:
-
- NONE
-
-Returns:
-
- NONE
-
---*/
-;
-
-BOOLEAN
-CoreIsSchedulable (
- IN EFI_CORE_DRIVER_ENTRY *DriverEntry
- )
-/*++
-
-Routine Description:
-
- This is the POSTFIX version of the dependency evaluator. This code does
- not need to handle Before or After, as it is not valid to call this
- routine in this case. The SOR is just ignored and is a nop in the grammer.
-
- POSTFIX means all the math is done on top of the stack.
-
-Arguments:
-
- DriverEntry - DriverEntry element to update
-
-Returns:
-
- TRUE - If driver is ready to run.
-
- FALSE - If driver is not ready to run or some fatal error was found.
-
---*/
-;
-
-EFI_STATUS
-CorePreProcessDepex (
- IN EFI_CORE_DRIVER_ENTRY *DriverEntry
- )
-/*++
-
-Routine Description:
-
- Preprocess dependency expression and update DriverEntry to reflect the
- state of Before, After, and SOR dependencies. If DriverEntry->Before
- or DriverEntry->After is set it will never be cleared. If SOR is set
- it will be cleared by CoreSchedule(), and then the driver can be
- dispatched.
-
-Arguments:
-
- DriverEntry - DriverEntry element to update
-
-Returns:
-
- EFI_SUCCESS - It always works.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreExitBootServices (
- IN EFI_HANDLE ImageHandle,
- IN UINTN MapKey
- )
-/*++
-
-Routine Description:
-
- EFI 1.0 API to terminate Boot Services
-
-Arguments:
-
- ImageHandle - Handle that represents the identity of the calling image
-
- MapKey -Key to the latest memory map.
-
-Returns:
-
- EFI_SUCCESS - Boot Services terminated
- EFI_INVALID_PARAMETER - MapKey is incorrect.
-
---*/
-;
-
-EFI_STATUS
-CoreTerminateMemoryMap (
- IN UINTN MapKey
- )
-/*++
-
-Routine Description:
-
- Make sure the memory map is following all the construction rules,
- it is the last time to check memory map error before exit boot services.
-
-Arguments:
-
- MapKey - Memory map key
-
-Returns:
-
- EFI_INVALID_PARAMETER - Memory map not consistent with construction rules.
-
- EFI_SUCCESS - Valid memory map.
-
---*/
-;
-
-VOID
-CoreNotifySignalList (
- IN EFI_GUID *EventGroup
- )
-/*++
-
-Routine Description:
-
- Signals all events on the requested list
-
-Arguments:
-
- SignalType - The list to signal
-
-Returns:
-
- None
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreInstallConfigurationTable (
- IN EFI_GUID *Guid,
- IN VOID *Table
- )
-/*++
-
-Routine Description:
-
- Boot Service called to add, modify, or remove a system configuration table from
- the EFI System Table.
-
-Arguments:
-
- Guid: Pointer to the GUID for the entry to add, update, or remove
- Table: Pointer to the configuration table for the entry to add, update, or
- remove, may be NULL.
-
-Returns:
-
- EFI_SUCCESS Guid, Table pair added, updated, or removed.
- EFI_INVALID_PARAMETER Input GUID not valid.
- EFI_NOT_FOUND Attempted to delete non-existant entry
- EFI_OUT_OF_RESOURCES Not enough memory available
-
---*/
-;
-
-
-EFI_TPL
-EFIAPI
-CoreRaiseTpl (
- IN EFI_TPL NewTpl
- )
-/*++
-
-Routine Description:
-
- Raise the task priority level to the new level.
- High level is implemented by disabling processor interrupts.
-
-Arguments:
-
- NewTpl - New task priority level
-
-Returns:
-
- The previous task priority level
-
---*/
-;
-
-
-VOID
-EFIAPI
-CoreRestoreTpl (
- IN EFI_TPL NewTpl
- )
-/*++
-
-Routine Description:
-
- Lowers the task priority to the previous value. If the new
- priority unmasks events at a higher priority, they are dispatched.
-
-Arguments:
-
- NewTpl - New, lower, task priority
-
-Returns:
-
- None
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreStall (
- IN UINTN Microseconds
- )
-/*++
-
-Routine Description:
-
- Introduces a fine-grained stall.
-
-Arguments:
-
- Microseconds The number of microseconds to stall execution
-
-Returns:
-
- EFI_SUCCESS - Execution was stalled for at least the requested amount
- of microseconds.
-
- EFI_NOT_AVAILABLE_YET - gMetronome is not available yet
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreSetWatchdogTimer (
- IN UINTN Timeout,
- IN UINT64 WatchdogCode,
- IN UINTN DataSize,
- IN CHAR16 *WatchdogData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Sets the system's watchdog timer.
-
-Arguments:
-
- Timeout The number of seconds. Zero disables the timer.
-
- ///////following three parameters are left for platform specific using
-
- WatchdogCode The numberic code to log. 0x0 to 0xffff are firmware
- DataSize Size of the optional data
- WatchdogData Optional Null terminated unicode string followed by binary
- data.
-
-Returns:
-
- EFI_SUCCESS Timeout has been set
- EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
- EFI_UNSUPPORTED System does not have a timer (currently not used)
- EFI_DEVICE_ERROR Could not complete due to hardware error
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreInstallProtocolInterface (
- IN OUT EFI_HANDLE *UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_INTERFACE_TYPE InterfaceType,
- IN VOID *Interface
- )
-/*++
-
-Routine Description:
-
- Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
- Calls the private one which contains a BOOLEAN parameter for notifications
-
-Arguments:
-
- UserHandle - The handle to install the protocol handler on,
- or NULL if a new handle is to be allocated
-
- Protocol - The protocol to add to the handle
-
- InterfaceType - Indicates whether Interface is supplied in native form.
-
- Interface - The interface for the protocol being added
-
-Returns:
-
- Status code
-
---*/
-;
-
-EFI_STATUS
-CoreInstallProtocolInterfaceNotify (
- IN OUT EFI_HANDLE *UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_INTERFACE_TYPE InterfaceType,
- IN VOID *Interface,
- IN BOOLEAN Notify
- )
-/*++
-
-Routine Description:
-
- Installs a protocol interface into the boot services environment.
-
-Arguments:
-
- UserHandle - The handle to install the protocol handler on,
- or NULL if a new handle is to be allocated
-
- Protocol - The protocol to add to the handle
-
- InterfaceType - Indicates whether Interface is supplied in native form.
-
- Interface - The interface for the protocol being added
-
- Notify - Whether to notify the notification list for this protocol
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Protocol interface successfully installed
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreInstallMultipleProtocolInterfaces (
- IN OUT EFI_HANDLE *Handle,
- ...
- )
-/*++
-
-Routine Description:
-
- Installs a list of protocol interface into the boot services environment.
- This function calls InstallProtocolInterface() in a loop. If any error
- occures all the protocols added by this function are removed. This is
- basically a lib function to save space.
-
-Arguments:
-
- Handle - The handle to install the protocol handlers on,
- or NULL if a new handle is to be allocated
- ... - EFI_GUID followed by protocol instance. A NULL terminates the
- list. The pairs are the arguments to InstallProtocolInterface().
- All the protocols are added to Handle.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Handle is NULL.
-
- EFI_SUCCESS - Protocol interfaces successfully installed.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreUninstallMultipleProtocolInterfaces (
- IN EFI_HANDLE Handle,
- ...
- )
-/*++
-
-Routine Description:
-
- Uninstalls a list of protocol interface in the boot services environment.
- This function calls UnisatllProtocolInterface() in a loop. This is
- basically a lib function to save space.
-
-Arguments:
-
- Handle - The handle to uninstall the protocol
-
- ... - EFI_GUID followed by protocol instance. A NULL terminates the
- list. The pairs are the arguments to UninstallProtocolInterface().
- All the protocols are added to Handle.
-
-Returns:
-
- Status code
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreReinstallProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN VOID *OldInterface,
- IN VOID *NewInterface
- )
-/*++
-
-Routine Description:
-
- Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
-
-Arguments:
-
- UserHandle - Handle on which the interface is to be reinstalled
- Protocol - The numeric ID of the interface
- OldInterface - A pointer to the old interface
- NewInterface - A pointer to the new interface
-
-
-Returns:
-
- Status code.
-
- On EFI_SUCCESS The protocol interface was installed
- On EFI_NOT_FOUND The OldInterface on the handle was not found
- On EFI_INVALID_PARAMETER One of the parameters has an invalid value
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreUninstallProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN VOID *Interface
- )
-/*++
-
-Routine Description:
-
- Uninstalls all instances of a protocol:interfacer from a handle.
- If the last protocol interface is remove from the handle, the
- handle is freed.
-
-Arguments:
-
- UserHandle - The handle to remove the protocol handler from
-
- Protocol - The protocol, of protocol:interface, to remove
-
- Interface - The interface, of protocol:interface, to remove
-
-Returns:
-
- EFI_INVALID_PARAMETER - Protocol is NULL.
-
- EFI_SUCCESS - Protocol interface successfully uninstalled.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreHandleProtocol (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- OUT VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Queries a handle to determine if it supports a specified protocol.
-
-Arguments:
-
- UserHandle - The handle being queried.
-
- Protocol - The published unique identifier of the protocol.
-
- Interface - Supplies the address where a pointer to the corresponding Protocol
- Interface is returned.
-
-Returns:
-
- The requested protocol interface for the handle
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreOpenProtocol (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- OUT VOID **Interface OPTIONAL,
- IN EFI_HANDLE ImageHandle,
- IN EFI_HANDLE ControllerHandle,
- IN UINT32 Attributes
- )
-/*++
-
-Routine Description:
-
- Locates the installed protocol handler for the handle, and
- invokes it to obtain the protocol interface. Usage information
- is registered in the protocol data base.
-
-Arguments:
-
- UserHandle - The handle to obtain the protocol interface on
-
- Protocol - The ID of the protocol
-
- Interface - The location to return the protocol interface
-
- ImageHandle - The handle of the Image that is opening the protocol interface
- specified by Protocol and Interface.
-
- ControllerHandle - The controller handle that is requiring this interface.
-
- Attributes - The open mode of the protocol interface specified by Handle
- and Protocol.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Protocol is NULL.
-
- EFI_SUCCESS - Get the protocol interface.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreOpenProtocolInformation (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
- OUT UINTN *EntryCount
- )
-/*++
-
-Routine Description:
-
- Return information about Opened protocols in the system
-
-Arguments:
-
- UserHandle - The handle to close the protocol interface on
-
- Protocol - The ID of the protocol
-
- EntryBuffer - A pointer to a buffer of open protocol information in the form of
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
-
- EntryCount - Number of EntryBuffer entries
-
-Returns:
-
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreCloseProtocol (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_HANDLE ImageHandle,
- IN EFI_HANDLE ControllerHandle
- )
-/*++
-
-Routine Description:
-
- Close Protocol
-
-Arguments:
-
- UserHandle - The handle to close the protocol interface on
-
- Protocol - The ID of the protocol
-
- ImageHandle - The user of the protocol to close
-
- ControllerHandle - The user of the protocol to close
-
-Returns:
-
- EFI_INVALID_PARAMETER - Protocol is NULL.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreProtocolsPerHandle (
- IN EFI_HANDLE UserHandle,
- OUT EFI_GUID ***ProtocolBuffer,
- OUT UINTN *ProtocolBufferCount
- )
-/*++
-
-Routine Description:
-
- Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
- from pool.
-
-Arguments:
-
- UserHandle - The handle from which to retrieve the list of protocol interface
- GUIDs.
-
- ProtocolBuffer - A pointer to the list of protocol interface GUID pointers that are
- installed on Handle.
-
- ProtocolBufferCount - A pointer to the number of GUID pointers present in
- ProtocolBuffer.
-
-Returns:
- EFI_SUCCESS - The list of protocol interface GUIDs installed on Handle was returned in
- ProtocolBuffer. The number of protocol interface GUIDs was
- returned in ProtocolBufferCount.
- EFI_INVALID_PARAMETER - Handle is NULL.
- EFI_INVALID_PARAMETER - Handle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ProtocolBuffer is NULL.
- EFI_INVALID_PARAMETER - ProtocolBufferCount is NULL.
- EFI_OUT_OF_RESOURCES - There is not enough pool memory to store the results.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreRegisterProtocolNotify (
- IN EFI_GUID *Protocol,
- IN EFI_EVENT Event,
- OUT VOID **Registration
- )
-/*++
-
-Routine Description:
-
- Add a new protocol notification record for the request protocol.
-
-Arguments:
-
- Protocol - The requested protocol to add the notify registration
-
- Event - The event to signal
-
- Registration - Returns the registration record
-
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_SUCCESS - Successfully returned the registration record that has been added
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreLocateHandle (
- IN EFI_LOCATE_SEARCH_TYPE SearchType,
- IN EFI_GUID *Protocol OPTIONAL,
- IN VOID *SearchKey OPTIONAL,
- IN OUT UINTN *BufferSize,
- OUT EFI_HANDLE *Buffer
- )
-/*++
-
-Routine Description:
-
- Locates the requested handle(s) and returns them in Buffer.
-
-Arguments:
-
- SearchType - The type of search to perform to locate the handles
-
- Protocol - The protocol to search for
-
- SearchKey - Dependant on SearchType
-
- BufferSize - On input the size of Buffer. On output the
- size of data returned.
-
- Buffer - The buffer to return the results in
-
-
-Returns:
-
- EFI_BUFFER_TOO_SMALL - Buffer too small, required buffer size is returned in BufferSize.
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_SUCCESS - Successfully found the requested handle(s) and returns them in Buffer.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreLocateDevicePath (
- IN EFI_GUID *Protocol,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
- OUT EFI_HANDLE *Device
- )
-/*++
-
-Routine Description:
-
- Locates the handle to a device on the device path that supports the specified protocol.
-
-Arguments:
-
- Protocol - The protocol to search for.
- FilePath - On input, a pointer to a pointer to the device path. On output, the device
- path pointer is modified to point to the remaining part of the devicepath.
- Device - A pointer to the returned device handle.
-
-Returns:
-
- EFI_SUCCESS - The resulting handle was returned.
- EFI_NOT_FOUND - No handles matched the search.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreLocateHandleBuffer (
- IN EFI_LOCATE_SEARCH_TYPE SearchType,
- IN EFI_GUID *Protocol OPTIONAL,
- IN VOID *SearchKey OPTIONAL,
- IN OUT UINTN *NumberHandles,
- OUT EFI_HANDLE **Buffer
- )
-/*++
-
-Routine Description:
-
- Function returns an array of handles that support the requested protocol
- in a buffer allocated from pool. This is a version of CoreLocateHandle()
- that allocates a buffer for the caller.
-
-Arguments:
-
- SearchType - Specifies which handle(s) are to be returned.
- Protocol - Provides the protocol to search by.
- This parameter is only valid for SearchType ByProtocol.
- SearchKey - Supplies the search key depending on the SearchType.
- NumberHandles - The number of handles returned in Buffer.
- Buffer - A pointer to the buffer to return the requested array of
- handles that support Protocol.
-
-Returns:
-
- EFI_SUCCESS - The result array of handles was returned.
- EFI_NOT_FOUND - No handles match the search.
- EFI_OUT_OF_RESOURCES - There is not enough pool memory to store the matching results.
- EFI_INVALID_PARAMETER - Invalid parameter
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreLocateProtocol (
- IN EFI_GUID *Protocol,
- IN VOID *Registration OPTIONAL,
- OUT VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Return the first Protocol Interface that matches the Protocol GUID. If
- Registration is pasased in return a Protocol Instance that was just add
- to the system. If Retistration is NULL return the first Protocol Interface
- you find.
-
-Arguments:
-
- Protocol - The protocol to search for
-
- Registration - Optional Registration Key returned from RegisterProtocolNotify()
-
- Interface - Return the Protocol interface (instance).
-
-Returns:
-
- EFI_SUCCESS - If a valid Interface is returned
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_NOT_FOUND - Protocol interface not found
-
---*/
-;
-
-UINT64
-CoreGetHandleDatabaseKey (
- VOID
- )
-/*++
-
-Routine Description:
-
- return handle database key.
-
-Arguments:
-
- None
-
-Returns:
-
- Handle database key.
-
---*/
-;
-
-VOID
-CoreConnectHandlesByKey (
- UINT64 Key
- )
-/*++
-
-Routine Description:
-
- Go connect any handles that were created or modified while a image executed.
-
-Arguments:
-
- Key - The Key to show that the handle has been created/modified
-
-Returns:
-
- None
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreConnectController (
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE *DriverImageHandle OPTIONAL,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,
- IN BOOLEAN Recursive
- )
-/*++
-
-Routine Description:
-
- Connects one or more drivers to a controller.
-
-Arguments:
-
- ControllerHandle - Handle of the controller to be connected.
-
- DriverImageHandle - DriverImageHandle A pointer to an ordered list of driver image handles.
-
- RemainingDevicePath - RemainingDevicePath A pointer to the device path that specifies a child of the
- controller specified by ControllerHandle.
-
- Recursive - - Whether the function would be called recursively or not.
-
-Returns:
-
- Status code.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreDisconnectController (
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE DriverImageHandle OPTIONAL,
- IN EFI_HANDLE ChildHandle OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Disonnects a controller from a driver
-
-Arguments:
-
- ControllerHandle - ControllerHandle The handle of the controller from which driver(s)
- are to be disconnected.
- DriverImageHandle - DriverImageHandle The driver to disconnect from ControllerHandle.
- ChildHandle - ChildHandle The handle of the child to destroy.
-
-Returns:
-
- EFI_SUCCESS - One or more drivers were disconnected from the controller.
- EFI_SUCCESS - On entry, no drivers are managing ControllerHandle.
- EFI_SUCCESS - DriverImageHandle is not NULL, and on entry DriverImageHandle is not managing ControllerHandle.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL, and it is not a valid EFI_HANDLE.
- EFI_OUT_OF_RESOURCES - There are not enough resources available to disconnect any drivers from ControllerHandle.
- EFI_DEVICE_ERROR - The controller could not be disconnected because of a device error.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreAllocatePages (
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN NumberOfPages,
- IN OUT EFI_PHYSICAL_ADDRESS *Memory
- )
-/*++
-
-Routine Description:
-
- Allocates pages from the memory map.
-
-Arguments:
-
- Type - The type of allocation to perform
-
- MemoryType - The type of memory to turn the allocated pages into
-
- NumberOfPages - The number of pages to allocate
-
- Memory - A pointer to receive the base allocated memory address
-
-Returns:
-
- Status. On success, Memory is filled in with the base address allocated
-
- EFI_INVALID_PARAMETER - Parameters violate checking rules defined in spec.
-
- EFI_NOT_FOUND - Could not allocate pages match the requirement.
-
- EFI_OUT_OF_RESOURCES - No enough pages to allocate.
-
- EFI_SUCCESS - Pages successfully allocated.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreFreePages (
- IN EFI_PHYSICAL_ADDRESS Memory,
- IN UINTN NumberOfPages
- )
-/*++
-
-Routine Description:
-
- Frees previous allocated pages.
-
-Arguments:
-
- Memory - Base address of memory being freed
-
- NumberOfPages - The number of pages to free
-
-Returns:
-
- EFI_NOT_FOUND - Could not find the entry that covers the range
-
- EFI_INVALID_PARAMETER - Address not aligned
-
- EFI_SUCCESS -Pages successfully freed.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreGetMemoryMap (
- IN OUT UINTN *MemoryMapSize,
- IN OUT EFI_MEMORY_DESCRIPTOR *Desc,
- OUT UINTN *MapKey,
- OUT UINTN *DescriptorSize,
- OUT UINT32 *DescriptorVersion
- )
-/*++
-
-Routine Description:
-
- Returns the current memory map.
-
-Arguments:
-
- MemoryMapSize - On input the buffer size of MemoryMap allocated by caller
- On output the required buffer size to contain the memory map
-
- Desc - The buffer to return the current memory map
-
- MapKey - The address to return the current map key
-
- DescriptorSize - The size in bytes for an individual EFI_MEMORY_DESCRIPTOR
-
- DescriptorVersion - The version number associated with the EFI_MEMORY_DESCRIPTOR
-
-Returns:
-
- EFI_SUCCESS The current memory map was returned successfully
-
- EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small
-
- EFI_INVALID_PARAMETER One of the parameters has an invalid value
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreAllocatePool (
- IN EFI_MEMORY_TYPE PoolType,
- IN UINTN Size,
- OUT VOID **Buffer
- )
-/*++
-
-Routine Description:
-
- Allocate pool of a particular type.
-
-Arguments:
-
- PoolType - Type of pool to allocate
-
- Size - The amount of pool to allocate
-
- Buffer - The address to return a pointer to the allocated pool
-
-Returns:
-
- EFI_INVALID_PARAMETER - PoolType not valid
-
- EFI_OUT_OF_RESOURCES - Size exceeds max pool size or allocation failed.
-
- EFI_SUCCESS - Pool successfully allocated.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreFreePool (
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Frees pool.
-
-Arguments:
-
- Buffer - The allocated pool entry to free
-
-Returns:
-
- EFI_INVALID_PARAMETER - Buffer is not a valid value.
-
- EFI_SUCCESS - Pool successfully freed.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreLoadImage (
- IN BOOLEAN BootPolicy,
- IN EFI_HANDLE ParentImageHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN VOID *SourceBuffer OPTIONAL,
- IN UINTN SourceSize,
- OUT EFI_HANDLE *ImageHandle
- )
-/*++
-
-Routine Description:
-
- Loads an EFI image into memory and returns a handle to the image.
-
-Arguments:
-
- BootPolicy - If TRUE, indicates that the request originates from the boot manager,
- and that the boot manager is attempting to load FilePath as a boot selection.
- ParentImageHandle - The caller's image handle.
- FilePath - The specific file path from which the image is loaded.
- SourceBuffer - If not NULL, a pointer to the memory location containing a copy of
- the image to be loaded.
- SourceSize - The size in bytes of SourceBuffer.
- ImageHandle - Pointer to the returned image handle that is created when the image
- is successfully loaded.
-
-Returns:
-
- EFI_SUCCESS - The image was loaded into memory.
- EFI_NOT_FOUND - The FilePath was not found.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
- EFI_UNSUPPORTED - The image type is not supported, or the device path cannot be
- parsed to locate the proper protocol for loading the file.
- EFI_OUT_OF_RESOURCES - Image was not loaded due to insufficient resources.
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreUnloadImage (
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- Unload the specified image.
-
-Arguments:
-
- ImageHandle - The specified image handle.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Image handle is NULL.
-
- EFI_UNSUPPORTED - Attempt to unload an unsupported image.
-
- EFI_SUCCESS - Image successfully unloaded.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreStartImage (
- IN EFI_HANDLE ImageHandle,
- OUT UINTN *ExitDataSize,
- OUT CHAR16 **ExitData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Transfer control to a loaded image's entry point.
-
-Arguments:
-
- ImageHandle - Handle of image to be started.
-
- ExitDataSize - Pointer of the size to ExitData
-
- ExitData - Pointer to a pointer to a data buffer that includes a Null-terminated
- Unicode string, optionally followed by additional binary data. The string
- is a description that the caller may use to further indicate the reason for
- the image's exit.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Successfully transfer control to the image's entry point.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreExit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_STATUS Status,
- IN UINTN ExitDataSize,
- IN CHAR16 *ExitData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Terminates the currently loaded EFI image and returns control to boot services.
-
-Arguments:
-
- ImageHandle - Handle that identifies the image. This parameter is passed to the image
- on entry.
- Status - The image's exit code.
- ExitDataSize - The size, in bytes, of ExitData. Ignored if ExitStatus is
- EFI_SUCCESS.
- ExitData - Pointer to a data buffer that includes a Null-terminated Unicode string,
- optionally followed by additional binary data. The string is a
- description that the caller may use to further indicate the reason for
- the image's exit.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Image handle is NULL or it is not current image.
-
- EFI_SUCCESS - Successfully terminates the currently loaded EFI image.
-
- EFI_ACCESS_DENIED - Should never reach there.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreCreateEvent (
- IN UINT32 Type,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction,
- IN VOID *NotifyContext,
- OUT EFI_EVENT *pEvent
- )
-/*++
-
-Routine Description:
-
- Creates a general-purpose event structure
-
-Arguments:
-
- Type - The type of event to create and its mode and attributes
- NotifyTpl - The task priority level of event notifications
- NotifyFunction - Pointer to the event's notification function
- NotifyContext - Pointer to the notification function's context; corresponds to
- parameter "Context" in the notification function
- pEvent - Pointer to the newly created event if the call succeeds; undefined otherwise
-
-Returns:
-
- EFI_SUCCESS - The event structure was created
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value
- EFI_OUT_OF_RESOURCES - The event could not be allocated
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreCreateEventEx (
- IN UINT32 Type,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
- IN CONST VOID *NotifyContext, OPTIONAL
- IN CONST EFI_GUID *EventGroup, OPTIONAL
- OUT EFI_EVENT *Event
- )
-/*++
-
-Routine Description:
- Creates a general-purpose event structure
-
-Arguments:
- Type - The type of event to create and its mode and attributes
- NotifyTpl - The task priority level of event notifications
- NotifyFunction - Pointer to the events notification function
- NotifyContext - Pointer to the notification functions context; corresponds to
- parameter "Context" in the notification function
- EventGrout - GUID for EventGroup if NULL act the same as gBS->CreateEvent().
- Event - Pointer to the newly created event if the call succeeds; undefined otherwise
-
-Returns:
- EFI_SUCCESS - The event structure was created
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value
- EFI_OUT_OF_RESOURCES - The event could not be allocated
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreSetTimer (
- IN EFI_EVENT Event,
- IN EFI_TIMER_DELAY Type,
- IN UINT64 TriggerTime
- )
-/*++
-
-Routine Description:
-
- Sets the type of timer and the trigger time for a timer event.
-
-Arguments:
-
- UserEvent - The timer event that is to be signaled at the specified time
- Type - The type of time that is specified in TriggerTime
- TriggerTime - The number of 100ns units until the timer expires
-
-Returns:
-
- EFI_SUCCESS - The event has been set to be signaled at the requested time
- EFI_INVALID_PARAMETER - Event or Type is not valid
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreSignalEvent (
- IN EFI_EVENT Event
- )
-/*++
-
-Routine Description:
-
- Signals the event. Queues the event to be notified if needed
-
-Arguments:
-
- Event - The event to signal
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameters are not valid.
-
- EFI_SUCCESS - The event was signaled.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreWaitForEvent (
- IN UINTN NumberOfEvents,
- IN EFI_EVENT *UserEvents,
- OUT UINTN *UserIndex
- )
-/*++
-
-Routine Description:
-
- Stops execution until an event is signaled.
-
-Arguments:
-
- NumberOfEvents - The number of events in the UserEvents array
- UserEvents - An array of EFI_EVENT
- UserIndex - Pointer to the index of the event which satisfied the wait condition
-
-Returns:
-
- EFI_SUCCESS - The event indicated by Index was signaled.
- EFI_INVALID_PARAMETER - The event indicated by Index has a notification function or
- Event was not a valid type
- EFI_UNSUPPORTED - The current TPL is not TPL_APPLICATION
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreCloseEvent (
- IN EFI_EVENT Event
- )
-/*++
-
-Routine Description:
-
- Closes an event and frees the event structure.
-
-Arguments:
-
- UserEvent - Event to close
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameters are not valid.
-
- EFI_SUCCESS - The event has been closed
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreCheckEvent (
- IN EFI_EVENT Event
- )
-/*++
-
-Routine Description:
-
- Check the status of an event
-
-Arguments:
-
- UserEvent - The event to check
-
-Returns:
-
- EFI_SUCCESS - The event is in the signaled state
- EFI_NOT_READY - The event is not in the signaled state
- EFI_INVALID_PARAMETER - Event is of type EVT_NOTIFY_SIGNAL
-
---*/
-;
-
-EFI_STATUS
-CoreAddMemorySpace (
- IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Capabilities
- )
-/*++
-
-Routine Description:
-
- Add a segment of memory space to GCD map and add all available pages in this segment
- as memory descriptors.
-
-Arguments:
-
- GcdMemoryType - Memory type of the segment.
-
- BaseAddress - Base address of the segment.
-
- Length - Length of the segment.
-
- Capabilities - alterable attributes of the segment.
-
-Returns:
-
- EFI_SUCCESS - Merged this segment into GCD map.
-
---*/
-;
-
-EFI_STATUS
-CoreAllocateMemorySpace (
- IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
- IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
- IN UINTN Alignment,
- IN UINT64 Length,
- IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- IN EFI_HANDLE ImageHandle,
- IN EFI_HANDLE DeviceHandle OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Allocate memory space on GCD map.
-
-Arguments:
-
- GcdAllocateType - The type of allocate operation
-
- GcdMemoryType - The desired memory type
-
- Alignment - Align with 2^Alignment
-
- Length - Length to allocate
-
- BaseAddress - Base address to allocate
-
- ImageHandle - The image handle consume the allocated space.
-
- DeviceHandle - The device handle consume the allocated space.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter.
-
- EFI_NOT_FOUND - No descriptor contains the desired space.
-
- EFI_SUCCESS - Memory space successfully allocated.
-
---*/
-;
-
-EFI_STATUS
-CoreFreeMemorySpace (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:Routine Description:
-
- Free a segment of memory space in GCD map.
-
-Arguments:
-
- BaseAddress - Base address of the segment.
-
- Length - Length of the segment.
-
-Returns:
-
- EFI_SUCCESS - Space successfully freed.
-
---*/
-;
-
-EFI_STATUS
-CoreRemoveMemorySpace (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:Routine Description:
-
- Remove a segment of memory space in GCD map.
-
-Arguments:
-
- BaseAddress - Base address of the segment.
-
- Length - Length of the segment.
-
-Returns:
-
- EFI_SUCCESS - Successfully a segment of memory space.
-
---*/
-;
-
-EFI_STATUS
-CoreGetMemorySpaceDescriptor (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor
- )
-/*++
-
-Routine Description:
-
- Search all entries in GCD map which contains specified segment and build it to a descriptor.
-
-Arguments:
-
- BaseAddress - Specified start address
-
- Descriptor - Specified length
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_SUCCESS - Successfully get memory space descriptor.
-
---*/
-;
-
-EFI_STATUS
-CoreSetMemorySpaceAttributes (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- Set memory space with specified attributes.
-
-Arguments:
-
- BaseAddress - Specified start address
-
- Length - Specified length
-
- Attributes - Specified attributes
-
-Returns:
-
- EFI_SUCCESS - Successfully set attribute of a segment of memory space.
-
---*/
-;
-
-EFI_STATUS
-CoreGetMemorySpaceMap (
- OUT UINTN *NumberOfDescriptors,
- OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap
- )
-/*++
-
-Routine Description:
-
- Transer all entries of GCD memory map into memory descriptors and pass to caller.
-
-Arguments:
-
- NumberOfDescriptors - Number of descriptors.
-
- MemorySpaceMap - Descriptor array
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Successfully get memory space map.
-
---*/
-;
-
-EFI_STATUS
-CoreAddIoSpace (
- IN EFI_GCD_IO_TYPE GcdIoType,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- Add a segment of IO space to GCD map.
-
-Arguments:
-
- GcdIoType - IO type of the segment.
-
- BaseAddress - Base address of the segment.
-
- Length - Length of the segment.
-
-Returns:
-
- EFI_SUCCESS - Merged this segment into GCD map.
-
---*/
-;
-
-EFI_STATUS
-CoreAllocateIoSpace (
- IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
- IN EFI_GCD_IO_TYPE GcdIoType,
- IN UINTN Alignment,
- IN UINT64 Length,
- IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- IN EFI_HANDLE ImageHandle,
- IN EFI_HANDLE DeviceHandle OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Allocate IO space on GCD map.
-
-Arguments:
-
- GcdAllocateType - The type of allocate operation
-
- GcdIoType - The desired IO type
-
- Alignment - Align with 2^Alignment
-
- Length - Length to allocate
-
- BaseAddress - Base address to allocate
-
- ImageHandle - The image handle consume the allocated space.
-
- DeviceHandle - The device handle consume the allocated space.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter.
-
- EFI_NOT_FOUND - No descriptor contains the desired space.
-
- EFI_SUCCESS - IO space successfully allocated.
-
---*/
-;
-
-EFI_STATUS
-CoreFreeIoSpace (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:Routine Description:
-
- Free a segment of IO space in GCD map.
-
-Arguments:
-
- BaseAddress - Base address of the segment.
-
- Length - Length of the segment.
-
-Returns:
-
- EFI_SUCCESS - Space successfully freed.
-
---*/
-;
-
-EFI_STATUS
-CoreRemoveIoSpace (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:Routine Description:
-
- Remove a segment of IO space in GCD map.
-
-Arguments:
-
- BaseAddress - Base address of the segment.
-
- Length - Length of the segment.
-
-Returns:
-
- EFI_SUCCESS - Successfully removed a segment of IO space.
-
---*/
-;
-
-EFI_STATUS
-CoreGetIoSpaceDescriptor (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor
- )
-/*++
-
-Routine Description:
-
- Search all entries in GCD map which contains specified segment and build it to a descriptor.
-
-Arguments:
-
- BaseAddress - Specified start address
-
- Descriptor - Specified length
-
-Returns:
-
- EFI_INVALID_PARAMETER - Descriptor is NULL.
-
- EFI_SUCCESS - Successfully get the IO space descriptor.
-
---*/
-;
-
-EFI_STATUS
-CoreGetIoSpaceMap (
- OUT UINTN *NumberOfDescriptors,
- OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap
- )
-/*++
-
-Routine Description:
-
- Transer all entries of GCD IO map into IO descriptors and pass to caller.
-
-Arguments:
-
- NumberOfDescriptors - Number of descriptors.
-
- IoSpaceMap - Descriptor array
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Successfully get IO space map.
-
---*/
-;
-
-EFI_DXESERVICE
-EFI_STATUS
-EFIAPI
-CoreDispatcher (
- VOID
- )
-/*++
-
-Routine Description:
-
- This is the main Dispatcher for DXE and it exits when there are no more
- drivers to run. Drain the mScheduledQueue and load and start a PE
- image for each driver. Search the mDiscoveredList to see if any driver can
- be placed on the mScheduledQueue. If no drivers are placed on the
- mScheduledQueue exit the function. On exit it is assumed the Bds()
- will be called, and when the Bds() exits the Dispatcher will be called
- again.
-
-Arguments:
-
- NONE
-
-Returns:
-
- EFI_ALREADY_STARTED - The DXE Dispatcher is already running
-
- EFI_NOT_FOUND - No DXE Drivers were dispatched
-
- EFI_SUCCESS - One or more DXE Drivers were dispatched
-
---*/
-;
-EFI_DXESERVICE
-EFI_STATUS
-EFIAPI
-CoreSchedule (
- IN EFI_HANDLE FirmwareVolumeHandle,
- IN EFI_GUID *DriverName
- )
-/*++
-
-Routine Description:
-
- Check every driver and locate a matching one. If the driver is found, the Unrequested
- state flag is cleared.
-
-Arguments:
-
- FirmwareVolumeHandle - The handle of the Firmware Volume that contains the firmware
- file specified by DriverName.
-
- DriverName - The Driver name to put in the Dependent state.
-
-Returns:
-
- EFI_SUCCESS - The DriverName was found and it's SOR bit was cleared
-
- EFI_NOT_FOUND - The DriverName does not exist or it's SOR bit was not set.
-
---*/
-;
-
-EFI_DXESERVICE
-EFI_STATUS
-EFIAPI
-CoreTrust (
- IN EFI_HANDLE FirmwareVolumeHandle,
- IN EFI_GUID *DriverName
- )
-/*++
-
-Routine Description:
-
- Convert a driver from the Untrused back to the Scheduled state
-
-Arguments:
-
- FirmwareVolumeHandle - The handle of the Firmware Volume that contains the firmware
- file specified by DriverName.
-
- DriverName - The Driver name to put in the Scheduled state
-
-Returns:
-
- EFI_SUCCESS - The file was found in the untrusted state, and it was promoted
- to the trusted state.
-
- EFI_NOT_FOUND - The file was not found in the untrusted state.
-
---*/
-;
-
-BOOLEAN
-CoreGrowBuffer (
- IN OUT EFI_STATUS *Status,
- IN OUT VOID **Buffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
-
- Helper function called as part of the code needed
- to allocate the proper sized buffer for various
- EFI interfaces.
-
-Arguments:
-
- Status - Current status
-
- Buffer - Current allocated buffer, or NULL
-
- BufferSize - Current buffer size needed
-
-Returns:
-
- TRUE - if the buffer was reallocated and the caller
- should try the API again.
-
- FALSE - buffer could not be allocated and the caller
- should not try the API again.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-FwVolDriverInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This routine is the driver initialization entry point. It initializes the
- libraries, and registers two notification functions. These notification
- functions are responsible for building the FV stack dynamically.
-
-Arguments:
- ImageHandle - The image handle.
- SystemTable - The system table.
-
-Returns:
- EFI_SUCCESS - Function successfully returned.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-InitializeSectionExtraction (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Entry point of the section extraction code. Initializes an instance of the
- section extraction interface and installs it on a new handle.
-
-Arguments:
- ImageHandle EFI_HANDLE: A handle for the image that is initializing this driver
- SystemTable EFI_SYSTEM_TABLE: A pointer to the EFI system table
-
-Returns:
- EFI_SUCCESS: Driver initialized successfully
- EFI_OUT_OF_RESOURCES: Could not allocate needed resources
-
---*/
-;
-
-EFI_STATUS
-CoreProcessFirmwareVolume (
- IN VOID *FvHeader,
- IN UINTN Size,
- OUT EFI_HANDLE *FVProtocolHandle
- )
-/*++
-
-Routine Description:
- This DXE service routine is used to process a firmware volume. In
- particular, it can be called by BDS to process a single firmware
- volume found in a capsule.
-
-Arguments:
- FvHeader - pointer to a firmware volume header
- Size - the size of the buffer pointed to by FvHeader
- FVProtocolHandle - the handle on which a firmware volume protocol
- was produced for the firmware volume passed in.
-
-Returns:
- EFI_OUT_OF_RESOURCES - if an FVB could not be produced due to lack of
- system resources
- EFI_VOLUME_CORRUPTED - if the volume was corrupted
- EFI_SUCCESS - a firmware volume protocol was produced for the
- firmware volume
-
---*/
-;
-
-//
-//Functions used during debug buils
-//
-VOID
-CoreDisplayMissingArchProtocols (
- VOID
- )
-/*++
-
- Routine Description:
- Displays Architectural protocols that were not loaded and are required for DXE core to function
- Only used in Debug Builds
-
- Arguments:
- NONE
-
- Returns:
- NONE
-
---*/;
-
-VOID
-CoreDisplayDiscoveredNotDispatched (
- VOID
- )
-/*++
-
- Routine Description:
-
- Traverse the discovered list for any drivers that were discovered but not loaded
- because the dependency experessions evaluated to false
-
- Arguments:
-
- NONE
-
- Returns:
-
- NONE
-
---*/;
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg0 (
- VOID
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg1 (
- UINTN Arg1
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- Arg1 - Undefined
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg2 (
- UINTN Arg1,
- UINTN Arg2
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- Arg1 - Undefined
-
- Arg2 - Undefined
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg3 (
- UINTN Arg1,
- UINTN Arg2,
- UINTN Arg3
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- Arg1 - Undefined
-
- Arg2 - Undefined
-
- Arg3 - Undefined
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg4 (
- UINTN Arg1,
- UINTN Arg2,
- UINTN Arg3,
- UINTN Arg4
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- Arg1 - Undefined
-
- Arg2 - Undefined
-
- Arg3 - Undefined
-
- Arg4 - Undefined
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg5 (
- UINTN Arg1,
- UINTN Arg2,
- UINTN Arg3,
- UINTN Arg4,
- UINTN Arg5
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- Arg1 - Undefined
-
- Arg2 - Undefined
-
- Arg3 - Undefined
-
- Arg4 - Undefined
-
- Arg5 - Undefined
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-;
-
-EFI_STATUS
-CoreGetPeiProtocol (
- IN EFI_GUID *ProtocolGuid,
- IN VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Searches for a Protocol Interface passed from PEI through a HOB
-
-Arguments:
-
- ProtocolGuid - The Protocol GUID to search for in the HOB List
-
- Interface - A pointer to the interface for the Protocol GUID
-
-Returns:
-
- EFI_SUCCESS - The Protocol GUID was found and its interface is returned in Interface
-
- EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List
-
---*/
-;
-
-EFI_STATUS
-DxeMainUefiDecompressGetInfo (
- IN EFI_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- );
-
-EFI_STATUS
-EFIAPI
-DxeMainUefiDecompress (
- IN EFI_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- IN OUT VOID *Destination,
- IN UINT32 DestinationSize,
- IN OUT VOID *Scratch,
- IN UINT32 ScratchSize
- );
-
-EFI_STATUS
-DxeMainTianoDecompressGetInfo (
- IN EFI_TIANO_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- );
-
-EFI_STATUS
-EFIAPI
-DxeMainTianoDecompress (
- IN EFI_TIANO_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- IN OUT VOID *Destination,
- IN UINT32 DestinationSize,
- IN OUT VOID *Scratch,
- IN UINT32 ScratchSize
- );
-
-EFI_STATUS
-DxeMainCustomDecompressGetInfo (
- IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- );
-
-EFI_STATUS
-EFIAPI
-DxeMainCustomDecompress (
- IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- IN OUT VOID *Destination,
- IN UINT32 DestinationSize,
- IN OUT VOID *Scratch,
- IN UINT32 ScratchSize
- );
-
-#endif
diff --git a/EdkModulePkg/Core/Dxe/DxeMain.msa b/EdkModulePkg/Core/Dxe/DxeMain.msa
deleted file mode 100644
index 1ed9c09..0000000
--- a/EdkModulePkg/Core/Dxe/DxeMain.msa
+++ /dev/null
@@ -1,243 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeMain</ModuleName>
- <ModuleType>DXE_CORE</ModuleType>
- <GuidValue>D6A2CB7F-6A18-4e2f-B43B-9920A733700A</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for DxeMain module.</Abstract>
- <Description>This module provide an DXE CIS compliant implementation of DXE Core.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeMain</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DxeCoreEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>TianoDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>CustomDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkPeCoffLoaderLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>CacheMaintenanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeMain/DxeMain.c</Filename>
- <Filename>DxeMain/DxeProtocolNotify.c</Filename>
- <Filename>Dispatcher/Dispatcher.c</Filename>
- <Filename>Dispatcher/dependency.c</Filename>
- <Filename>Event/execdata.c</Filename>
- <Filename>Event/event.c</Filename>
- <Filename>Event/timer.c</Filename>
- <Filename>Event/tpl.c</Filename>
- <Filename>FwVol/FwVol.c</Filename>
- <Filename>FwVol/Ffs.c</Filename>
- <Filename>FwVol/FwVolAttrib.c</Filename>
- <Filename>FwVol/FwVolRead.c</Filename>
- <Filename>FwVol/FwVolWrite.c</Filename>
- <Filename>FwVolBlock/FwVolBlock.c</Filename>
- <Filename>Mem/memdata.c</Filename>
- <Filename>Mem/Page.c</Filename>
- <Filename>Mem/pool.c</Filename>
- <Filename>Gcd/gcd.c</Filename>
- <Filename>Hand/handle.c</Filename>
- <Filename>Hand/locate.c</Filename>
- <Filename>Hand/Notify.c</Filename>
- <Filename>Hand/DriverSupport.c</Filename>
- <Filename>Library/Library.c</Filename>
- <Filename>Misc/InstallConfigurationTable.c</Filename>
- <Filename>Misc/SetWatchdogTimer.c</Filename>
- <Filename>Misc/Stall.c</Filename>
- <Filename>Misc/DebugImageInfo.c</Filename>
- <Filename>Image/Image.c</Filename>
- <Filename>Image/ImageFile.c</Filename>
- <Filename>SectionExtraction/CoreSectionExtraction.c</Filename>
- <Filename>DebugImageInfo.h</Filename>
- <Filename>DxeMain.h</Filename>
- <Filename>Exec.h</Filename>
- <Filename>FwVolBlock.h</Filename>
- <Filename>FwVolDriver.h</Filename>
- <Filename>gcd.h</Filename>
- <Filename>hand.h</Filename>
- <Filename>Image.h</Filename>
- <Filename>imem.h</Filename>
- <Filename>Library.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiEbcProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiCpuArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiFirmwareVolumeProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiFirmwareVolumeDispatchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiSectionExtractionProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiDriverBindingProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiPlatformDriverOverrideProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiBusSpecificDriverOverrideProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiTimerArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiMetronomeArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiMonotonicCounterArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiVariableWriteArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiBdsArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiVariableArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSecurityArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiWatchdogTimerArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiRuntimeArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiRealTimeClockArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiResetArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiLoadFileProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiLoadPeImageProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiCustomizedDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiTianoDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiCapsuleArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiStatusCodeRuntimeProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiMemoryTypeInformationGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiDxeServicesTableGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiHobListGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiDebugImageInfoTableGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gAprioriGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiFirmwareFileSystemGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiFileInfoGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiHobMemoryAllocModuleGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiEventExitBootServicesGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiEventVirtualAddressChangeGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiEventMemoryMapChangeGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiEventReadyToBootGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiEventLegacyBootGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>DxeMain</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c b/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c
deleted file mode 100644
index 1e31a88..0000000
--- a/EdkModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ /dev/null
@@ -1,996 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeMain.c
-
-Abstract:
-
- DXE Core Main Entry Point
-
---*/
-
-#include <DxeMain.h>
-
-//
-// DXE Core Global Variables for Protocols from PEI
-//
-EFI_HANDLE mDecompressHandle = NULL;
-EFI_PEI_PE_COFF_LOADER_PROTOCOL *gEfiPeiPeCoffLoader = NULL;
-
-//
-// DXE Core globals for Architecture Protocols
-//
-EFI_SECURITY_ARCH_PROTOCOL *gSecurity = NULL;
-EFI_CPU_ARCH_PROTOCOL *gCpu = NULL;
-EFI_METRONOME_ARCH_PROTOCOL *gMetronome = NULL;
-EFI_TIMER_ARCH_PROTOCOL *gTimer = NULL;
-EFI_BDS_ARCH_PROTOCOL *gBds = NULL;
-EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer = NULL;
-
-
-//
-// BugBug: I'n not runtime, but is the PPI?
-//
-EFI_STATUS_CODE_PROTOCOL gStatusCodeInstance = {
- NULL
-};
-
-EFI_STATUS_CODE_PROTOCOL *gStatusCode = &gStatusCodeInstance;
-
-
-//
-// DXE Core Global used to update core loaded image protocol handle
-//
-EFI_GUID *gDxeCoreFileName;
-EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;
-
-
-
-//
-// DXE Core Module Variables
-//
-
-EFI_BOOT_SERVICES mBootServices = {
- {
- EFI_BOOT_SERVICES_SIGNATURE, // Signature
- EFI_BOOT_SERVICES_REVISION, // Revision
- sizeof (EFI_BOOT_SERVICES), // HeaderSize
- 0, // CRC32
- 0 // Reserved
- },
- (EFI_RAISE_TPL) CoreRaiseTpl, // RaiseTPL
- (EFI_RESTORE_TPL) CoreRestoreTpl, // RestoreTPL
- (EFI_ALLOCATE_PAGES) CoreAllocatePages, // AllocatePages
- (EFI_FREE_PAGES) CoreFreePages, // FreePages
- (EFI_GET_MEMORY_MAP) CoreGetMemoryMap, // GetMemoryMap
- (EFI_ALLOCATE_POOL) CoreAllocatePool, // AllocatePool
- (EFI_FREE_POOL) CoreFreePool, // FreePool
- (EFI_CREATE_EVENT) CoreCreateEvent, // CreateEvent
- (EFI_SET_TIMER) CoreSetTimer, // SetTimer
- (EFI_WAIT_FOR_EVENT) CoreWaitForEvent, // WaitForEvent
- (EFI_SIGNAL_EVENT) CoreSignalEvent, // SignalEvent
- (EFI_CLOSE_EVENT) CoreCloseEvent, // CloseEvent
- (EFI_CHECK_EVENT) CoreCheckEvent, // CheckEvent
- (EFI_INSTALL_PROTOCOL_INTERFACE) CoreInstallProtocolInterface, // InstallProtocolInterface
- (EFI_REINSTALL_PROTOCOL_INTERFACE) CoreReinstallProtocolInterface, // ReinstallProtocolInterface
- (EFI_UNINSTALL_PROTOCOL_INTERFACE) CoreUninstallProtocolInterface, // UninstallProtocolInterface
- (EFI_HANDLE_PROTOCOL) CoreHandleProtocol, // HandleProtocol
- (VOID *) NULL, // Reserved
- (EFI_REGISTER_PROTOCOL_NOTIFY) CoreRegisterProtocolNotify, // RegisterProtocolNotify
- (EFI_LOCATE_HANDLE) CoreLocateHandle, // LocateHandle
- (EFI_LOCATE_DEVICE_PATH) CoreLocateDevicePath, // LocateDevicePath
- (EFI_INSTALL_CONFIGURATION_TABLE) CoreInstallConfigurationTable, // InstallConfigurationTable
- (EFI_IMAGE_LOAD) CoreLoadImage, // LoadImage
- (EFI_IMAGE_START) CoreStartImage, // StartImage
- (EFI_EXIT) CoreExit, // Exit
- (EFI_IMAGE_UNLOAD) CoreUnloadImage, // UnloadImage
- (EFI_EXIT_BOOT_SERVICES) CoreExitBootServices, // ExitBootServices
- (EFI_GET_NEXT_MONOTONIC_COUNT) CoreEfiNotAvailableYetArg1, // GetNextMonotonicCount
- (EFI_STALL) CoreStall, // Stall
- (EFI_SET_WATCHDOG_TIMER) CoreSetWatchdogTimer, // SetWatchdogTimer
- (EFI_CONNECT_CONTROLLER) CoreConnectController, // ConnectController
- (EFI_DISCONNECT_CONTROLLER) CoreDisconnectController, // DisconnectController
- (EFI_OPEN_PROTOCOL) CoreOpenProtocol, // OpenProtocol
- (EFI_CLOSE_PROTOCOL) CoreCloseProtocol, // CloseProtocol
- (EFI_OPEN_PROTOCOL_INFORMATION) CoreOpenProtocolInformation, // OpenProtocolInformation
- (EFI_PROTOCOLS_PER_HANDLE) CoreProtocolsPerHandle, // ProtocolsPerHandle
- (EFI_LOCATE_HANDLE_BUFFER) CoreLocateHandleBuffer, // LocateHandleBuffer
- (EFI_LOCATE_PROTOCOL) CoreLocateProtocol, // LocateProtocol
- (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) CoreInstallMultipleProtocolInterfaces, // InstallMultipleProtocolInterfaces
- (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) CoreUninstallMultipleProtocolInterfaces, // UninstallMultipleProtocolInterfaces
- (EFI_CALCULATE_CRC32) CoreEfiNotAvailableYetArg3, // CalculateCrc32
- (EFI_COPY_MEM) CopyMem, // CopyMem
- (EFI_SET_MEM) SetMem, // SetMem
- (EFI_CREATE_EVENT_EX) CoreCreateEventEx // CreateEventEx
-};
-
-EFI_DXE_SERVICES mDxeServices = {
- {
- EFI_DXE_SERVICES_SIGNATURE, // Signature
- EFI_DXE_SERVICES_REVISION, // Revision
- sizeof (EFI_DXE_SERVICES), // HeaderSize
- 0, // CRC32
- 0 // Reserved
- },
- (EFI_ADD_MEMORY_SPACE) CoreAddMemorySpace, // AddMemorySpace
- (EFI_ALLOCATE_MEMORY_SPACE) CoreAllocateMemorySpace, // AllocateMemorySpace
- (EFI_FREE_MEMORY_SPACE) CoreFreeMemorySpace, // FreeMemorySpace
- (EFI_REMOVE_MEMORY_SPACE) CoreRemoveMemorySpace, // RemoveMemorySpace
- (EFI_GET_MEMORY_SPACE_DESCRIPTOR) CoreGetMemorySpaceDescriptor, // GetMemorySpaceDescriptor
- (EFI_SET_MEMORY_SPACE_ATTRIBUTES) CoreSetMemorySpaceAttributes, // SetMemorySpaceAttributes
- (EFI_GET_MEMORY_SPACE_MAP) CoreGetMemorySpaceMap, // GetMemorySpaceMap
- (EFI_ADD_IO_SPACE) CoreAddIoSpace, // AddIoSpace
- (EFI_ALLOCATE_IO_SPACE) CoreAllocateIoSpace, // AllocateIoSpace
- (EFI_FREE_IO_SPACE) CoreFreeIoSpace, // FreeIoSpace
- (EFI_REMOVE_IO_SPACE) CoreRemoveIoSpace, // RemoveIoSpace
- (EFI_GET_IO_SPACE_DESCRIPTOR) CoreGetIoSpaceDescriptor, // GetIoSpaceDescriptor
- (EFI_GET_IO_SPACE_MAP) CoreGetIoSpaceMap, // GetIoSpaceMap
- (EFI_DISPATCH) CoreDispatcher, // Dispatch
- (EFI_SCHEDULE) CoreSchedule, // Schedule
- (EFI_TRUST) CoreTrust, // Trust
- (EFI_PROCESS_FIRMWARE_VOLUME) CoreProcessFirmwareVolume, // ProcessFirmwareVolume
-};
-
-EFI_SYSTEM_TABLE mEfiSystemTableTemplate = {
- {
- EFI_SYSTEM_TABLE_SIGNATURE, // Signature
- EFI_SYSTEM_TABLE_REVISION, // Revision
- sizeof (EFI_SYSTEM_TABLE), // HeaderSize
- 0, // CRC32
- 0 // Reserved
- },
- NULL, // FirmwareVendor
- 0, // FirmwareRevision
- NULL, // ConsoleInHandle
- NULL, // ConIn
- NULL, // ConsoleOutHandle
- NULL, // ConOut
- NULL, // StandardErrorHandle
- NULL, // StdErr
- NULL, // RuntimeServices
- &mBootServices, // BootServices
- 0, // NumberOfConfigurationTableEntries
- NULL // ConfigurationTable
-};
-
-EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = {
- {
- EFI_RUNTIME_SERVICES_SIGNATURE, // Signature
- EFI_RUNTIME_SERVICES_REVISION, // Revision
- sizeof (EFI_RUNTIME_SERVICES), // HeaderSize
- 0, // CRC32
- 0 // Reserved
- },
- (EFI_GET_TIME) CoreEfiNotAvailableYetArg2, // GetTime
- (EFI_SET_TIME) CoreEfiNotAvailableYetArg1, // SetTime
- (EFI_GET_WAKEUP_TIME) CoreEfiNotAvailableYetArg3, // GetWakeupTime
- (EFI_SET_WAKEUP_TIME) CoreEfiNotAvailableYetArg2, // SetWakeupTime
- (EFI_SET_VIRTUAL_ADDRESS_MAP) CoreEfiNotAvailableYetArg4, // SetVirtualAddressMap
- (EFI_CONVERT_POINTER) CoreEfiNotAvailableYetArg2, // ConvertPointer
- (EFI_GET_VARIABLE) CoreEfiNotAvailableYetArg5, // GetVariable
- (EFI_GET_NEXT_VARIABLE_NAME) CoreEfiNotAvailableYetArg3, // GetNextVariableName
- (EFI_SET_VARIABLE) CoreEfiNotAvailableYetArg5, // SetVariable
- (EFI_GET_NEXT_HIGH_MONO_COUNT) CoreEfiNotAvailableYetArg1, // GetNextHighMonotonicCount
- (EFI_RESET_SYSTEM) CoreEfiNotAvailableYetArg4, // ResetSystem
- (EFI_UPDATE_CAPSULE) CoreEfiNotAvailableYetArg3, // UpdateCapsule
- (EFI_QUERY_CAPSULE_CAPABILITIES) CoreEfiNotAvailableYetArg4, // QueryCapsuleCapabilities
- (EFI_QUERY_VARIABLE_INFO) CoreEfiNotAvailableYetArg4 // QueryVariableInfo
-};
-
-EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate = {
- INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate.ImageHead),
- INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate.EventHead),
-
- //
- // Make sure Size != sizeof (EFI_MEMORY_DESCRIPTOR). This will
- // prevent people from having pointer math bugs in their code.
- // now you have to use *DescriptorSize to make things work.
- //
- sizeof (EFI_MEMORY_DESCRIPTOR) + sizeof (UINT64) - (sizeof (EFI_MEMORY_DESCRIPTOR) % sizeof (UINT64)),
- EFI_MEMORY_DESCRIPTOR_VERSION,
- 0,
- NULL,
- NULL,
- FALSE,
- FALSE
-};
-
-EFI_RUNTIME_ARCH_PROTOCOL *gRuntime = &gRuntimeTemplate;
-
-//
-// DXE Core Global Variables for the EFI System Table, Boot Services Table,
-// DXE Services Table, and Runtime Services Table
-//
-EFI_BOOT_SERVICES *gDxeCoreBS = &mBootServices;
-EFI_DXE_SERVICES *gDxeCoreDS = &mDxeServices;
-EFI_SYSTEM_TABLE *gDxeCoreST = NULL;
-
-//
-// For debug initialize gDxeCoreRT to template. gDxeCoreRT must be allocated from RT memory
-// but gDxeCoreRT is used for ASSERT () and DEBUG () type macros so lets give it
-// a value that will not cause debug infrastructure to crash early on.
-//
-EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;
-EFI_HANDLE gDxeCoreImageHandle = NULL;
-
-VOID *mHobStart;
-
-//
-// EFI Decompress Protocol
-//
-EFI_DECOMPRESS_PROTOCOL gEfiDecompress = {
- DxeMainUefiDecompressGetInfo,
- DxeMainUefiDecompress
-};
-
-//
-// Tiano Decompress Protocol
-//
-EFI_TIANO_DECOMPRESS_PROTOCOL gEfiTianoDecompress = {
- DxeMainTianoDecompressGetInfo,
- DxeMainTianoDecompress
-};
-
-//
-// Customized Decompress Protocol
-//
-EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL gEfiCustomizedDecompress = {
- DxeMainCustomDecompressGetInfo,
- DxeMainCustomDecompress
-};
-
-//
-// Main entry point to the DXE Core
-//
-VOID
-EFIAPI
-DxeMain (
- IN VOID *HobStart
- )
-/*++
-
-Routine Description:
-
- Main entry point to DXE Core.
-
-Arguments:
-
- HobStart - Pointer to the beginning of the HOB List from PEI
-
-Returns:
-
- This function should never return
-
---*/
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS MemoryBaseAddress;
- UINT64 MemoryLength;
-
- mHobStart = HobStart;
-
- //
- // Initialize Memory Services
- //
- CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLength);
-
- //
- // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData
- // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table
- //
- gDxeCoreST = CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);
- ASSERT (gDxeCoreST != NULL);
-
- gDxeCoreRT = CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);
- ASSERT (gDxeCoreRT != NULL);
-
- gDxeCoreST->RuntimeServices = gDxeCoreRT;
-
- //
- // Start the Image Services.
- //
- Status = CoreInitializeImageServices (HobStart);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Call constructor for all libraries
- //
- ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);
- PERF_END (0,PEI_TOK, NULL, 0) ;
- PERF_START (0,DXE_TOK, NULL, 0) ;
-
- //
- // Initialize the Global Coherency Domain Services
- //
- Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install the DXE Services Table into the EFI System Tables's Configuration Table
- //
- Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDxeCoreDS);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install the HOB List into the EFI System Tables's Configuration Table
- //
- Status = CoreInstallConfigurationTable (&gEfiHobListGuid, HobStart);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install Memory Type Information Table into the EFI System Tables's Configuration Table
- //
- Status = CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid, &gMemoryTypeInformation);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Initialize the ReportStatusCode with PEI version, if available
- //
- CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **)&gStatusCode->ReportStatusCode);
-
- //
- // Report Status Code here for DXE_ENTRY_POINT once it is available
- //
- CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT));
-
- //
- // Create the aligned system table pointer structure that is used by external
- // debuggers to locate the system table... Also, install debug image info
- // configuration table.
- //
- CoreInitializeDebugImageInfoTable ();
- CoreNewDebugImageInfoEntry (
- EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL,
- gDxeCoreLoadedImage,
- gDxeCoreImageHandle
- );
-
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "HOBLIST address in DXE = 0x%08x\n", HobStart));
-
- //
- // Initialize the Event Services
- //
- Status = CoreInitializeEventServices ();
- ASSERT_EFI_ERROR (Status);
-
-
- //
- // Get the Protocols that were passed in from PEI to DXE through GUIDed HOBs
- //
- // These Protocols are not architectural. This implementation is sharing code between
- // PEI and DXE in order to save FLASH space. These Protocols could also be implemented
- // as part of the DXE Core. However, that would also require the DXE Core to be ported
- // each time a different CPU is used, a different Decompression algorithm is used, or a
- // different Image type is used. By placing these Protocols in PEI, the DXE Core remains
- // generic, and only PEI and the Arch Protocols need to be ported from Platform to Platform,
- // and from CPU to CPU.
- //
-
- //
- // Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components
- //
- Status = CoreInstallMultipleProtocolInterfaces (
- &mDecompressHandle,
- &gEfiDecompressProtocolGuid, &gEfiDecompress,
- &gEfiTianoDecompressProtocolGuid, &gEfiTianoDecompress,
- &gEfiCustomizedDecompressProtocolGuid, &gEfiCustomizedDecompress,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- gEfiPeiPeCoffLoader = GetPeCoffLoaderProtocol ();
- ASSERT (gEfiPeiPeCoffLoader != NULL);
-
- //
- // Register for the GUIDs of the Architectural Protocols, so the rest of the
- // EFI Boot Services and EFI Runtime Services tables can be filled in.
- //
- CoreNotifyOnArchProtocolInstallation ();
-
- //
- // Produce Firmware Volume Protocols, one for each FV in the HOB list.
- //
- Status = FwVolBlockDriverInit (gDxeCoreImageHandle, gDxeCoreST);
- ASSERT_EFI_ERROR (Status);
-
- Status = FwVolDriverInit (gDxeCoreImageHandle, gDxeCoreST);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Produce the Section Extraction Protocol
- //
- Status = InitializeSectionExtraction (gDxeCoreImageHandle, gDxeCoreST);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Initialize the DXE Dispatcher
- //
- PERF_START (0,"CoreInitializeDispatcher", "DxeMain", 0) ;
- CoreInitializeDispatcher ();
- PERF_END (0,"CoreInitializeDispatcher", "DxeMain", 0) ;
-
- //
- // Invoke the DXE Dispatcher
- //
- PERF_START (0, "CoreDispatcher", "DxeMain", 0);
- CoreDispatcher ();
- PERF_END (0, "CoreDispatcher", "DxeMain", 0);
-
- //
- // Display Architectural protocols that were not loaded if this is DEBUG build
- //
- DEBUG_CODE_BEGIN ();
- CoreDisplayMissingArchProtocols ();
- DEBUG_CODE_END ();
-
- //
- // Assert if the Architectural Protocols are not present.
- //
- ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ());
-
- //
- // Report Status code before transfer control to BDS
- //
- CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT));
- //
- // Display any drivers that were not dispatched because dependency expression
- // evaluated to false if this is a debug build
- //
- DEBUG_CODE_BEGIN ();
- CoreDisplayDiscoveredNotDispatched ();
- DEBUG_CODE_END ();
-
- //
- // Transfer control to the BDS Architectural Protocol
- //
- gBds->Entry (gBds);
-
- //
- // BDS should never return
- //
- ASSERT (FALSE);
- CpuDeadLoop ();
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg0 (
- VOID
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-{
- //
- // This function should never be executed. If it does, then the architectural protocols
- // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
- // DXE Core and all the Architectural Protocols are complete.
- //
-
- return EFI_NOT_AVAILABLE_YET;
-}
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg1 (
- UINTN Arg1
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- Arg1 - Undefined
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-{
- //
- // This function should never be executed. If it does, then the architectural protocols
- // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
- // DXE Core and all the Architectural Protocols are complete.
- //
-
- return EFI_NOT_AVAILABLE_YET;
-}
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg2 (
- UINTN Arg1,
- UINTN Arg2
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- Arg1 - Undefined
-
- Arg2 - Undefined
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-{
- //
- // This function should never be executed. If it does, then the architectural protocols
- // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
- // DXE Core and all the Architectural Protocols are complete.
- //
-
- return EFI_NOT_AVAILABLE_YET;
-}
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg3 (
- UINTN Arg1,
- UINTN Arg2,
- UINTN Arg3
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- Arg1 - Undefined
-
- Arg2 - Undefined
-
- Arg3 - Undefined
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-{
- //
- // This function should never be executed. If it does, then the architectural protocols
- // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
- // DXE Core and all the Architectural Protocols are complete.
- //
-
- return EFI_NOT_AVAILABLE_YET;
-}
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg4 (
- UINTN Arg1,
- UINTN Arg2,
- UINTN Arg3,
- UINTN Arg4
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- Arg1 - Undefined
-
- Arg2 - Undefined
-
- Arg3 - Undefined
-
- Arg4 - Undefined
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-{
- //
- // This function should never be executed. If it does, then the architectural protocols
- // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
- // DXE Core and all the Architectural Protocols are complete.
- //
-
- return EFI_NOT_AVAILABLE_YET;
-}
-
-EFI_STATUS
-EFIAPI
-CoreEfiNotAvailableYetArg5 (
- UINTN Arg1,
- UINTN Arg2,
- UINTN Arg3,
- UINTN Arg4,
- UINTN Arg5
- )
-/*++
-
-Routine Description:
-
- Place holder function until all the Boot Services and Runtime Services are available
-
-Arguments:
-
- Arg1 - Undefined
-
- Arg2 - Undefined
-
- Arg3 - Undefined
-
- Arg4 - Undefined
-
- Arg5 - Undefined
-
-Returns:
-
- EFI_NOT_AVAILABLE_YET
-
---*/
-{
- //
- // This function should never be executed. If it does, then the architectural protocols
- // have not been designed correctly. The CpuBreakpoint () is commented out for now until the
- // DXE Core and all the Architectural Protocols are complete.
- //
-
- return EFI_NOT_AVAILABLE_YET;
-}
-
-
-EFI_STATUS
-CoreGetPeiProtocol (
- IN EFI_GUID *ProtocolGuid,
- IN VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Searches for a Protocol Interface passed from PEI through a HOB
-
-Arguments:
-
- ProtocolGuid - The Protocol GUID to search for in the HOB List
-
- Interface - A pointer to the interface for the Protocol GUID
-
-Returns:
-
- EFI_SUCCESS - The Protocol GUID was found and its interface is returned in Interface
-
- EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List
-
---*/
-{
- EFI_HOB_GUID_TYPE *GuidHob;
- VOID *Buffer;
-
- GuidHob = GetNextGuidHob (ProtocolGuid, mHobStart);
- if (GuidHob == NULL) {
- return EFI_NOT_FOUND;
- }
-
- Buffer = GET_GUID_HOB_DATA (GuidHob);
- ASSERT (Buffer != NULL);
-
- *Interface = (VOID *)(*(UINTN *)(Buffer));
-
- return EFI_SUCCESS;
-}
-
-
-VOID
-CalculateEfiHdrCrc (
- IN OUT EFI_TABLE_HEADER *Hdr
- )
-/*++
-
-Routine Description:
-
- Calcualte the 32-bit CRC in a EFI table using the service provided by the
- gRuntime service.
-
-Arguments:
-
- Hdr - Pointer to an EFI standard header
-
-Returns:
-
- None
-
---*/
-{
- UINT32 Crc;
-
- Hdr->CRC32 = 0;
-
- //
- // If gDxeCoreBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then
- // Crc will come back as zero if we set it to zero here
- //
- Crc = 0;
- gDxeCoreBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);
- Hdr->CRC32 = Crc;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreExitBootServices (
- IN EFI_HANDLE ImageHandle,
- IN UINTN MapKey
- )
-/*++
-
-Routine Description:
-
- Terminates all boot services.
-
-Arguments:
-
- ImageHandle - Handle that identifies the exiting image.
-
- MapKey -Key to the latest memory map.
-
-Returns:
-
- EFI_SUCCESS - Boot Services terminated
- EFI_INVALID_PARAMETER - MapKey is incorrect.
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Terminate memory services if the MapKey matches
- //
- Status = CoreTerminateMemoryMap (MapKey);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Notify other drivers that we are exiting boot services.
- //
- CoreNotifySignalList (&gEfiEventExitBootServicesGuid);
-
- //
- // Disable Timer
- //
- gTimer->SetTimerPeriod (gTimer, 0);
-
- //
- // Disable CPU Interrupts
- //
- gCpu->DisableInterrupt (gCpu);
-
- //
- // Report that ExitBootServices() has been called
- //
- // We are using gEfiDxeServicesTableGuid as the caller ID for Dxe Core
- //
- CoreReportProgressCode ((EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES));
-
- //
- // Clear the non-runtime values of the EFI System Table
- //
- gDxeCoreST->BootServices = NULL;
- gDxeCoreST->ConIn = NULL;
- gDxeCoreST->ConsoleInHandle = NULL;
- gDxeCoreST->ConOut = NULL;
- gDxeCoreST->ConsoleOutHandle = NULL;
- gDxeCoreST->StdErr = NULL;
- gDxeCoreST->StandardErrorHandle = NULL;
-
- //
- // Recompute the 32-bit CRC of the EFI System Table
- //
- CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
-
- //
- // Zero out the Boot Service Table
- //
- SetMem (gDxeCoreBS, sizeof (EFI_BOOT_SERVICES), 0);
- gDxeCoreBS = NULL;
-
- //
- // Update the AtRuntime field in Runtiem AP.
- //
- gRuntime->AtRuntime = TRUE;
-
- return Status;
-}
-
-EFI_STATUS
-DxeMainUefiDecompressGetInfo (
- IN EFI_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-{
- if (Source == NULL
- || DestinationSize == NULL
- || ScratchSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-EFI_STATUS
-EFIAPI
-DxeMainUefiDecompress (
- IN EFI_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- IN OUT VOID *Destination,
- IN UINT32 DestinationSize,
- IN OUT VOID *Scratch,
- IN UINT32 ScratchSize
- )
-{
- EFI_STATUS Status;
- UINT32 TestDestinationSize;
- UINT32 TestScratchSize;
-
- if (Source == NULL
- || Destination== NULL
- || Scratch == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = UefiDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {
- return RETURN_INVALID_PARAMETER;
- }
-
- return UefiDecompress (Source, Destination, Scratch);
-}
-
-EFI_STATUS
-DxeMainTianoDecompressGetInfo (
- IN EFI_TIANO_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-{
- if (Source == NULL
- || DestinationSize == NULL
- || ScratchSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- return TianoDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-EFI_STATUS
-EFIAPI
-DxeMainTianoDecompress (
- IN EFI_TIANO_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- IN OUT VOID *Destination,
- IN UINT32 DestinationSize,
- IN OUT VOID *Scratch,
- IN UINT32 ScratchSize
- )
-{
- EFI_STATUS Status;
- UINT32 TestDestinationSize;
- UINT32 TestScratchSize;
-
- if (Source == NULL
- || Destination== NULL
- || Scratch == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = TianoDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {
- return RETURN_INVALID_PARAMETER;
- }
-
- return TianoDecompress (Source, Destination, Scratch);
-}
-
-EFI_STATUS
-DxeMainCustomDecompressGetInfo (
- IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-{
- if (Source == NULL
- || DestinationSize == NULL
- || ScratchSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- return CustomDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-EFI_STATUS
-EFIAPI
-DxeMainCustomDecompress (
- IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- IN OUT VOID *Destination,
- IN UINT32 DestinationSize,
- IN OUT VOID *Scratch,
- IN UINT32 ScratchSize
- )
-{
- EFI_STATUS Status;
- UINT32 TestDestinationSize;
- UINT32 TestScratchSize;
-
- if (Source == NULL
- || Destination== NULL
- || Scratch == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = CustomDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {
- return RETURN_INVALID_PARAMETER;
- }
-
- return CustomDecompress (Source, Destination, Scratch);
-}
-
diff --git a/EdkModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c b/EdkModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c
deleted file mode 100644
index 5c9a5b8..0000000
--- a/EdkModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeProtocolNotify.c
-
-Abstract:
-
- This file deals with Architecture Protocol (AP) registration in
- the Dxe Core. The mArchProtocols[] array represents a list of
- events that represent the Architectural Protocols.
-
---*/
-
-#include <DxeMain.h>
-
-
-//
-// DXE Core Global Variables for all of the Architectural Protocols.
-// If a protocol is installed mArchProtocols[].Present will be TRUE.
-//
-// CoreNotifyOnArchProtocolInstallation () fills in mArchProtocols[].Event
-// and mArchProtocols[].Registration as it creates events for every array
-// entry.
-//
-
-ARCHITECTURAL_PROTOCOL_ENTRY mArchProtocols[] = {
- { &gEfiSecurityArchProtocolGuid, (VOID **)&gSecurity, NULL, NULL, FALSE },
- { &gEfiCpuArchProtocolGuid, (VOID **)&gCpu, NULL, NULL, FALSE },
- { &gEfiMetronomeArchProtocolGuid, (VOID **)&gMetronome, NULL, NULL, FALSE },
- { &gEfiTimerArchProtocolGuid, (VOID **)&gTimer, NULL, NULL, FALSE },
- { &gEfiBdsArchProtocolGuid, (VOID **)&gBds, NULL, NULL, FALSE },
- { &gEfiWatchdogTimerArchProtocolGuid, (VOID **)&gWatchdogTimer, NULL, NULL, FALSE },
- { &gEfiRuntimeArchProtocolGuid, (VOID **)&gRuntime, NULL, NULL, FALSE },
- { &gEfiVariableArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
- { &gEfiVariableWriteArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
- { &gEfiCapsuleArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE},
- { &gEfiMonotonicCounterArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
- { &gEfiResetArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
- { &gEfiRealTimeClockArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE },
- { NULL, (VOID **)NULL, NULL, NULL, FALSE }
-};
-
-
-EFI_STATUS
-CoreAllEfiServicesAvailable (
- VOID
- )
-/*++
-
-Routine Description:
- Return TRUE if all AP services are availible.
-
-Arguments:
- NONE
-
-Returns:
- EFI_SUCCESS - All AP services are available
- EFI_NOT_FOUND - At least one AP service is not available
-
---*/
-{
- ARCHITECTURAL_PROTOCOL_ENTRY *Entry;
-
- for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {
- if (!Entry->Present) {
- return EFI_NOT_FOUND;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-VOID
-EFIAPI
-GenericArchProtocolNotify (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
- Notification event handler registered by CoreNotifyOnArchProtocolInstallation ().
- This notify function is registered for every architectural protocol. This handler
- updates mArchProtocol[] array entry with protocol instance data and sets it's
- present flag to TRUE. If any constructor is required it is executed. The EFI
- System Table headers are updated.
-
-Arguments:
-
- Event - The Event that is being processed, not used.
-
- Context - Event Context, not used.
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- ARCHITECTURAL_PROTOCOL_ENTRY *Entry;
- VOID *Protocol;
- BOOLEAN Found;
- LIST_ENTRY *Link;
- LIST_ENTRY TempLinkNode;
-
- Found = FALSE;
- for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {
-
- Status = CoreLocateProtocol (Entry->ProtocolGuid, Entry->Registration, &Protocol);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- Found = TRUE;
- Entry->Present = TRUE;
-
- //
- // Update protocol global variable if one exists. Entry->Protocol points to a global variable
- // if one exists in the DXE core for this Architectural Protocol
- //
- if (Entry->Protocol != NULL) {
- *(Entry->Protocol) = Protocol;
- }
-
- if (CompareGuid (Entry->ProtocolGuid, &gEfiTimerArchProtocolGuid)) {
- //
- // Register the Core timer tick handler with the Timer AP
- //
- gTimer->RegisterHandler (gTimer, CoreTimerTick);
- }
-
- if (CompareGuid (Entry->ProtocolGuid, &gEfiRuntimeArchProtocolGuid)) {
- //
- // When runtime architectural protocol is available, updates CRC32 in the Debug Table
- //
- CoreUpdateDebugTableCrc32 ();
-
- //
- // Update the Runtime Architectural protocol with the template that the core was
- // using so there would not need to be a dependency on the Runtime AP
- //
-
- //
- // Copy all the registered Image to new gRuntime protocol
- //
- for (Link = gRuntimeTemplate.ImageHead.ForwardLink; Link != &gRuntimeTemplate.ImageHead; Link = TempLinkNode.ForwardLink) {
- CopyMem (&TempLinkNode, Link, sizeof(LIST_ENTRY));
- InsertTailList (&gRuntime->ImageHead, Link);
- }
- //
- // Copy all the registered Event to new gRuntime protocol
- //
- for (Link = gRuntimeTemplate.EventHead.ForwardLink; Link != &gRuntimeTemplate.EventHead; Link = TempLinkNode.ForwardLink) {
- CopyMem (&TempLinkNode, Link, sizeof(LIST_ENTRY));
- InsertTailList (&gRuntime->EventHead, Link);
- }
-
- //
- // Clean up gRuntimeTemplate
- //
- gRuntimeTemplate.ImageHead.ForwardLink = &gRuntimeTemplate.ImageHead;
- gRuntimeTemplate.ImageHead.BackLink = &gRuntimeTemplate.ImageHead;
- gRuntimeTemplate.EventHead.ForwardLink = &gRuntimeTemplate.EventHead;
- gRuntimeTemplate.EventHead.BackLink = &gRuntimeTemplate.EventHead;
- }
- }
-
- //
- // It's over kill to do them all every time, but it saves a lot of code.
- //
- if (Found) {
- CalculateEfiHdrCrc (&gDxeCoreRT->Hdr);
- CalculateEfiHdrCrc (&gDxeCoreBS->Hdr);
- CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
- CalculateEfiHdrCrc (&gDxeCoreDS->Hdr);
- }
-}
-
-
-
-VOID
-CoreNotifyOnArchProtocolInstallation (
- VOID
- )
-/*++
-
-Routine Description:
- Creates an event that is fired everytime a Protocol of a specific type is installed
-
-Arguments:
- NONE
-
-Returns:
- NONE
-
---*/
-{
- EFI_STATUS Status;
- ARCHITECTURAL_PROTOCOL_ENTRY *Entry;
-
- for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {
-
- //
- // Create the event
- //
- Status = CoreCreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- GenericArchProtocolNotify,
- NULL,
- &Entry->Event
- );
- ASSERT_EFI_ERROR(Status);
-
- //
- // Register for protocol notifactions on this event
- //
- Status = CoreRegisterProtocolNotify (
- Entry->ProtocolGuid,
- Entry->Event,
- &Entry->Registration
- );
- ASSERT_EFI_ERROR(Status);
-
- }
-}
-
-//
-// Following is needed to display missing architectural protocols in debug builds
-//
-typedef struct {
- EFI_GUID *ProtocolGuid;
- CHAR16 *GuidString;
-} GUID_TO_STRING_PROTOCOL_ENTRY;
-
-static const GUID_TO_STRING_PROTOCOL_ENTRY MissingProtocols[] = {
- { &gEfiSecurityArchProtocolGuid, (CHAR16 *)L"Security" },
- { &gEfiCpuArchProtocolGuid, (CHAR16 *)L"CPU" },
- { &gEfiMetronomeArchProtocolGuid, (CHAR16 *)L"Metronome" },
- { &gEfiTimerArchProtocolGuid, (CHAR16 *)L"Timer" },
- { &gEfiBdsArchProtocolGuid, (CHAR16 *)L"Bds" },
- { &gEfiWatchdogTimerArchProtocolGuid, (CHAR16 *)L"Watchdog Timer" },
- { &gEfiRuntimeArchProtocolGuid, (CHAR16 *)L"Runtime" },
- { &gEfiVariableArchProtocolGuid, (CHAR16 *)L"Variable" },
- { &gEfiVariableWriteArchProtocolGuid, (CHAR16 *)L"Variable Write" },
- { &gEfiCapsuleArchProtocolGuid, (CHAR16 *)L"Capsule" },
- { &gEfiMonotonicCounterArchProtocolGuid, (CHAR16 *)L"Monotonic Counter" },
- { &gEfiResetArchProtocolGuid, (CHAR16 *)L"Reset" },
-// { &gEfiStatusCodeRuntimeProtocolGuid, (CHAR16 *)L"Status Code" },
- { &gEfiRealTimeClockArchProtocolGuid, (CHAR16 *)L"Real Time Clock" }
-};
-
-VOID
-CoreDisplayMissingArchProtocols (
- VOID
- )
-/*++
-
-Routine Description:
- Displays Architectural protocols that were not loaded and are required for DXE core to function
- Only used in Debug Builds
-
-Arguments:
- NONE
-
-Returns:
- NONE
-
---*/
-{
- const GUID_TO_STRING_PROTOCOL_ENTRY *MissingEntry;
- ARCHITECTURAL_PROTOCOL_ENTRY *Entry;
-
- for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {
- if (!Entry->Present) {
- MissingEntry = MissingProtocols;
- for (MissingEntry = MissingProtocols; TRUE ; MissingEntry++) {
- if (CompareGuid (Entry->ProtocolGuid, MissingEntry->ProtocolGuid)) {
- DEBUG ((EFI_D_ERROR, "\n%s Arch Protocol not present!!\n", MissingEntry->GuidString));
- break;
- }
- }
- }
- }
-}
diff --git a/EdkModulePkg/Core/Dxe/Event/event.c b/EdkModulePkg/Core/Dxe/Event/event.c
deleted file mode 100644
index b3ba71d..0000000
--- a/EdkModulePkg/Core/Dxe/Event/event.c
+++ /dev/null
@@ -1,757 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- event.c
-
-Abstract:
-
- EFI Event support
-
---*/
-
-
-#include <DxeMain.h>
-
-//
-// Enumerate the valid types
-//
-UINT32 mEventTable[] = {
- //
- // 0x80000200 Timer event with a notification function that is
- // queue when the event is signaled with SignalEvent()
- //
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- //
- // 0x80000000 Timer event without a notification function. It can be
- // signaled with SignalEvent() and checked with CheckEvent() or WaitForEvent().
- //
- EVT_TIMER,
- //
- // 0x00000100 Generic event with a notification function that
- // can be waited on with CheckEvent() or WaitForEvent()
- //
- EVT_NOTIFY_WAIT,
- //
- // 0x00000200 Generic event with a notification function that
- // is queue when the event is signaled with SignalEvent()
- //
- EVT_NOTIFY_SIGNAL,
- //
- // 0x00000201 ExitBootServicesEvent.
- //
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- //
- // 0x60000202 SetVirtualAddressMapEvent.
- //
- EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
-
- //
- // 0x00000000 Generic event without a notification function.
- // It can be signaled with SignalEvent() and checked with CheckEvent()
- // or WaitForEvent().
- //
- 0x00000000,
- //
- // 0x80000100 Timer event with a notification function that can be
- // waited on with CheckEvent() or WaitForEvent()
- //
- EVT_TIMER | EVT_NOTIFY_WAIT,
-};
-
-STATIC
-VOID
-CoreAcquireEventLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Enter critical section by acquiring the lock on gEventQueueLock.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- CoreAcquireLock (&gEventQueueLock);
-}
-
-STATIC
-VOID
-CoreReleaseEventLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Exit critical section by releasing the lock on gEventQueueLock.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- CoreReleaseLock (&gEventQueueLock);
-}
-
-
-EFI_STATUS
-CoreInitializeEventServices (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initializes "event" support and populates parts of the System and Runtime Table.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - Always return success
-
---*/
-{
- UINTN Index;
-
- for (Index=0; Index <= TPL_HIGH_LEVEL; Index++) {
- InitializeListHead (&gEventQueue[Index]);
- }
-
- CoreInitializeTimer ();
-
- return EFI_SUCCESS;
-}
-
-
-VOID
-CoreDispatchEventNotifies (
- IN EFI_TPL Priority
- )
-/*++
-
-Routine Description:
-
- Dispatches all pending events.
-
-Arguments:
-
- Priority - The task priority level of event notifications to dispatch
-
-Returns:
-
- None
-
---*/
-{
- IEVENT *Event;
- LIST_ENTRY *Head;
-
- CoreAcquireEventLock ();
- ASSERT (gEventQueueLock.OwnerTpl == Priority);
- Head = &gEventQueue[Priority];
-
- //
- // Dispatch all the pending notifications
- //
- while (!IsListEmpty (Head)) {
-
- Event = CR (Head->ForwardLink, IEVENT, NotifyLink, EVENT_SIGNATURE);
- RemoveEntryList (&Event->NotifyLink);
-
- Event->NotifyLink.ForwardLink = NULL;
-
- //
- // Only clear the SIGNAL status if it is a SIGNAL type event.
- // WAIT type events are only cleared in CheckEvent()
- //
- if (Event->Type & EVT_NOTIFY_SIGNAL) {
- Event->SignalCount = 0;
- }
-
- CoreReleaseEventLock ();
-
- //
- // Notify this event
- //
- ASSERT (Event->NotifyFunction != NULL);
- Event->NotifyFunction (Event, Event->NotifyContext);
-
- //
- // Check for next pending event
- //
- CoreAcquireEventLock ();
- }
-
- gEventPending &= ~(1 << Priority);
- CoreReleaseEventLock ();
-}
-
-
-STATIC
-VOID
-CoreNotifyEvent (
- IN IEVENT *Event
- )
-/*++
-
-Routine Description:
-
- Queues the event's notification function to fire
-
-Arguments:
-
- Event - The Event to notify
-
-Returns:
-
- None
-
---*/
-{
-
- //
- // Event database must be locked
- //
- ASSERT_LOCKED (&gEventQueueLock);
-
- //
- // If the event is queued somewhere, remove it
- //
-
- if (Event->NotifyLink.ForwardLink != NULL) {
- RemoveEntryList (&Event->NotifyLink);
- Event->NotifyLink.ForwardLink = NULL;
- }
-
- //
- // Queue the event to the pending notification list
- //
-
- InsertTailList (&gEventQueue[Event->NotifyTpl], &Event->NotifyLink);
- gEventPending |= (UINTN)(1 << Event->NotifyTpl);
-}
-
-
-
-VOID
-CoreNotifySignalList (
- IN EFI_GUID *EventGroup
- )
-/*++
-
-Routine Description:
- Signals all events in the EventGroup
-
-Arguments:
- EventGroup - The list to signal
-
-Returns:
-
- None
-
---*/
-{
- LIST_ENTRY *Link;
- LIST_ENTRY *Head;
- IEVENT *Event;
-
- CoreAcquireEventLock ();
-
- Head = &gEventSignalQueue;
- for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
- Event = CR (Link, IEVENT, SignalLink, EVENT_SIGNATURE);
- if (CompareGuid (&Event->EventGroup, EventGroup)) {
- CoreNotifyEvent (Event);
- }
- }
-
- CoreReleaseEventLock ();
-}
-
-EFI_STATUS
-EFIAPI
-CoreCreateEvent (
- IN UINT32 Type,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
- IN VOID *NotifyContext, OPTIONAL
- OUT EFI_EVENT *Event
- )
-/*++
-
-Routine Description:
- Creates a general-purpose event structure
-
-Arguments:
- Type - The type of event to create and its mode and attributes
- NotifyTpl - The task priority level of event notifications
- NotifyFunction - Pointer to the events notification function
- NotifyContext - Pointer to the notification functions context; corresponds to
- parameter "Context" in the notification function
- Event - Pointer to the newly created event if the call succeeds; undefined otherwise
-
-Returns:
- EFI_SUCCESS - The event structure was created
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value
- EFI_OUT_OF_RESOURCES - The event could not be allocated
-
---*/
-{
- EFI_GUID *GuidPtr;
- EFI_EVENT_NOTIFY Function;
-
- GuidPtr = NULL;
- Function = NotifyFunction;
-
- //
- // Convert EFI 1.10 Events to thier UEFI 2.0 CreateEventEx mapping
- //
- if (Type == EVT_SIGNAL_EXIT_BOOT_SERVICES) {
- GuidPtr = &gEfiEventExitBootServicesGuid;
- } else if (Type == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {
- GuidPtr = &gEfiEventVirtualAddressChangeGuid;
- }
-
- return CoreCreateEventEx (Type, NotifyTpl, Function, NotifyContext, GuidPtr, Event);
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreCreateEventEx (
- IN UINT32 Type,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
- IN CONST VOID *NotifyContext, OPTIONAL
- IN CONST EFI_GUID *EventGroup, OPTIONAL
- OUT EFI_EVENT *Event
- )
-/*++
-
-Routine Description:
- Creates a general-purpose event structure
-
-Arguments:
- Type - The type of event to create and its mode and attributes
- NotifyTpl - The task priority level of event notifications
- NotifyFunction - Pointer to the events notification function
- NotifyContext - Pointer to the notification functions context; corresponds to
- parameter "Context" in the notification function
- EventGrout - GUID for EventGroup if NULL act the same as gBS->CreateEvent().
- Event - Pointer to the newly created event if the call succeeds; undefined otherwise
-
-Returns:
- EFI_SUCCESS - The event structure was created
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value
- EFI_OUT_OF_RESOURCES - The event could not be allocated
-
---*/
-{
- EFI_STATUS Status;
- IEVENT *IEvent;
- INTN Index;
-
-
- if ((Event == NULL) || (NotifyTpl == TPL_APPLICATION)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check to make sure no reserved flags are set
- //
- Status = EFI_INVALID_PARAMETER;
- for (Index = 0; Index < (sizeof (mEventTable) / sizeof (UINT32)); Index++) {
- if (Type == mEventTable[Index]) {
- Status = EFI_SUCCESS;
- break;
- }
- }
- if(EFI_ERROR (Status)) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // If it's a notify type of event, check its parameters
- //
- if ((Type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL))) {
- //
- // Check for an invalid NotifyFunction or NotifyTpl
- //
- if ((NotifyFunction == NULL) ||
- (NotifyTpl < TPL_APPLICATION) ||
- (NotifyTpl >= TPL_HIGH_LEVEL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- } else {
- //
- // No notification needed, zero ignored values
- //
- NotifyTpl = 0;
- NotifyFunction = NULL;
- NotifyContext = NULL;
- }
-
- //
- // Allcoate and initialize a new event structure.
- //
- Status = CoreAllocatePool (
- (Type & EVT_RUNTIME) ? EfiRuntimeServicesData: EfiBootServicesData,
- sizeof (IEVENT),
- (VOID **)&IEvent
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetMem (IEvent, sizeof (IEVENT), 0);
-
- IEvent->Signature = EVENT_SIGNATURE;
- IEvent->Type = Type;
-
- IEvent->NotifyTpl = NotifyTpl;
- IEvent->NotifyFunction = NotifyFunction;
- IEvent->NotifyContext = (VOID *)NotifyContext;
- if (EventGroup != NULL) {
- CopyGuid (&IEvent->EventGroup, EventGroup);
- IEvent->ExFlag = TRUE;
- }
-
- *Event = IEvent;
-
- if (Type & EVT_RUNTIME) {
- //
- // Keep a list of all RT events so we can tell the RT AP.
- //
- IEvent->RuntimeData.Type = Type;
- IEvent->RuntimeData.NotifyTpl = NotifyTpl;
- IEvent->RuntimeData.NotifyFunction = NotifyFunction;
- IEvent->RuntimeData.NotifyContext = (VOID *) NotifyContext;
- IEvent->RuntimeData.Event = (EFI_EVENT *) IEvent;
- InsertTailList (&gRuntime->EventHead, &IEvent->RuntimeData.Link);
- }
-
- CoreAcquireEventLock ();
-
- if ((Type & EVT_NOTIFY_SIGNAL) != 0x00000000) {
- //
- // The Event's NotifyFunction must be queued whenever the event is signaled
- //
- InsertHeadList (&gEventSignalQueue, &IEvent->SignalLink);
- }
-
- CoreReleaseEventLock ();
-
- //
- // Done
- //
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreSignalEvent (
- IN EFI_EVENT UserEvent
- )
-/*++
-
-Routine Description:
-
- Signals the event. Queues the event to be notified if needed
-
-Arguments:
-
- UserEvent - The event to signal
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameters are not valid.
-
- EFI_SUCCESS - The event was signaled.
-
---*/
-{
- IEVENT *Event;
-
- Event = UserEvent;
-
- if (Event == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Event->Signature != EVENT_SIGNATURE) {
- return EFI_INVALID_PARAMETER;
- }
-
- CoreAcquireEventLock ();
-
- //
- // If the event is not already signalled, do so
- //
-
- if (Event->SignalCount == 0x00000000) {
- Event->SignalCount++;
-
- //
- // If signalling type is a notify function, queue it
- //
- if (Event->Type & EVT_NOTIFY_SIGNAL) {
- if (Event->ExFlag) {
- //
- // The CreateEventEx() style requires all members of the Event Group
- // to be signaled.
- //
- CoreReleaseEventLock ();
- CoreNotifySignalList (&Event->EventGroup);
- CoreAcquireEventLock ();
- } else {
- CoreNotifyEvent (Event);
- }
- }
- }
-
- CoreReleaseEventLock ();
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreCheckEvent (
- IN EFI_EVENT UserEvent
- )
-/*++
-
-Routine Description:
-
- Check the status of an event
-
-Arguments:
-
- UserEvent - The event to check
-
-Returns:
-
- EFI_SUCCESS - The event is in the signaled state
- EFI_NOT_READY - The event is not in the signaled state
- EFI_INVALID_PARAMETER - Event is of type EVT_NOTIFY_SIGNAL
-
---*/
-
-{
- IEVENT *Event;
- EFI_STATUS Status;
-
- Event = UserEvent;
-
- if (Event == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Event->Signature != EVENT_SIGNATURE) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Event->Type & EVT_NOTIFY_SIGNAL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = EFI_NOT_READY;
-
- if (!Event->SignalCount && (Event->Type & EVT_NOTIFY_WAIT)) {
-
- //
- // Queue the wait notify function
- //
-
- CoreAcquireEventLock ();
- if (!Event->SignalCount) {
- CoreNotifyEvent (Event);
- }
- CoreReleaseEventLock ();
- }
-
- //
- // If the even looks signalled, get the lock and clear it
- //
-
- if (Event->SignalCount) {
- CoreAcquireEventLock ();
-
- if (Event->SignalCount) {
- Event->SignalCount = 0;
- Status = EFI_SUCCESS;
- }
-
- CoreReleaseEventLock ();
- }
-
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreWaitForEvent (
- IN UINTN NumberOfEvents,
- IN EFI_EVENT *UserEvents,
- OUT UINTN *UserIndex
- )
-/*++
-
-Routine Description:
-
- Stops execution until an event is signaled.
-
-Arguments:
-
- NumberOfEvents - The number of events in the UserEvents array
- UserEvents - An array of EFI_EVENT
- UserIndex - Pointer to the index of the event which satisfied the wait condition
-
-Returns:
-
- EFI_SUCCESS - The event indicated by Index was signaled.
- EFI_INVALID_PARAMETER - The event indicated by Index has a notification function or
- Event was not a valid type
- EFI_UNSUPPORTED - The current TPL is not TPL_APPLICATION
-
---*/
-
-{
- EFI_STATUS Status;
- UINTN Index;
-
- //
- // Can only WaitForEvent at TPL_APPLICATION
- //
- if (gEfiCurrentTpl != TPL_APPLICATION) {
- return EFI_UNSUPPORTED;
- }
-
- for(;;) {
-
- for(Index = 0; Index < NumberOfEvents; Index++) {
-
- Status = CoreCheckEvent (UserEvents[Index]);
-
- //
- // provide index of event that caused problem
- //
- if (Status != EFI_NOT_READY) {
- *UserIndex = Index;
- return Status;
- }
- }
-
- //
- // This was the location of the Idle loop callback in EFI 1.x reference
- // code. We don't have that concept in this base at this point.
- //
- }
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreCloseEvent (
- IN EFI_EVENT UserEvent
- )
-/*++
-
-Routine Description:
-
- Closes an event and frees the event structure.
-
-Arguments:
-
- UserEvent - Event to close
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameters are not valid.
-
- EFI_SUCCESS - The event has been closed
-
---*/
-
-{
- EFI_STATUS Status;
- IEVENT *Event;
-
- Event = UserEvent;
-
- if (Event == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Event->Signature != EVENT_SIGNATURE) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // If it's a timer event, make sure it's not pending
- //
- if (Event->Type & EVT_TIMER) {
- CoreSetTimer (Event, TimerCancel, 0);
- }
-
- CoreAcquireEventLock ();
-
- //
- // If the event is queued somewhere, remove it
- //
-
- if (Event->RuntimeData.Link.ForwardLink != NULL) {
- RemoveEntryList (&Event->RuntimeData.Link);
- }
-
- if (Event->NotifyLink.ForwardLink != NULL) {
- RemoveEntryList (&Event->NotifyLink);
- }
-
- if (Event->SignalLink.ForwardLink != NULL) {
- RemoveEntryList (&Event->SignalLink);
- }
-
- CoreReleaseEventLock ();
-
- //
- // If the event is registered on a protocol notify, then remove it from the protocol database
- //
- CoreUnregisterProtocolNotify (Event);
-
- Status = CoreFreePool (Event);
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/EdkModulePkg/Core/Dxe/Event/execdata.c b/EdkModulePkg/Core/Dxe/Event/execdata.c
deleted file mode 100644
index a6d388a..0000000
--- a/EdkModulePkg/Core/Dxe/Event/execdata.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- execdata.c
-
-Abstract:
-
-
-
-
-Revision History
-
---*/
-
-#include <DxeMain.h>
-
-
-//
-// gTpl - Task priority level
-//
-EFI_TPL gEfiCurrentTpl = TPL_APPLICATION;
-
-
-//
-// gEventQueueLock - Protects the event queus
-//
-EFI_LOCK gEventQueueLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
-
-//
-// gEventQueue - A list of event's to notify for each priority level
-// gEventPending - A bitmask of the EventQueues that are pending
-//
-LIST_ENTRY gEventQueue[TPL_HIGH_LEVEL + 1];
-UINTN gEventPending = 0;
-
-
-//
-// gEventSignalQueue - A list of events to signal based on EventGroup type
-//
-LIST_ENTRY gEventSignalQueue = INITIALIZE_LIST_HEAD_VARIABLE (gEventSignalQueue);
-
diff --git a/EdkModulePkg/Core/Dxe/Event/timer.c b/EdkModulePkg/Core/Dxe/Event/timer.c
deleted file mode 100644
index 0f886f9..0000000
--- a/EdkModulePkg/Core/Dxe/Event/timer.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- timer.c
-
-Abstract:
-
- EFI Event support
-
-Revision History
-
---*/
-
-
-#include <DxeMain.h>
-
-//
-// Internal prototypes
-//
-STATIC
-UINT64
-CoreCurrentSystemTime (
- VOID
- );
-
-STATIC
-VOID
-EFIAPI
-CoreCheckTimers (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-STATIC
-VOID
-CoreInsertEventTimer (
- IN IEVENT *Event
- );
-
-//
-// Internal data
-//
-
-static LIST_ENTRY mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);
-static EFI_LOCK mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);
-static EFI_EVENT mEfiCheckTimerEvent;
-
-static EFI_LOCK mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
-static UINT64 mEfiSystemTime = 0;
-
-//
-// Timer functions
-//
-
-VOID
-CoreInitializeTimer (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initializes timer support
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
-
- Status = CoreCreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_HIGH_LEVEL - 1,
- CoreCheckTimers,
- NULL,
- &mEfiCheckTimerEvent
- );
- ASSERT_EFI_ERROR (Status);
-}
-
-STATIC
-UINT64
-CoreCurrentSystemTime (
- VOID
- )
-/*++
-
-Routine Description:
-
- Returns the current system time
-
-Arguments:
-
- None
-
-Returns:
-
- Returns the current system time
-
---*/
-{
- UINT64 SystemTime;
-
- CoreAcquireLock (&mEfiSystemTimeLock);
- SystemTime = mEfiSystemTime;
- CoreReleaseLock (&mEfiSystemTimeLock);
- return SystemTime;
-}
-
-VOID
-EFIAPI
-CoreTimerTick (
- IN UINT64 Duration
- )
-/*++
-
-Routine Description:
-
- Called by the platform code to process a tick.
-
-Arguments:
-
- Duration - The number of 100ns elasped since the last call to TimerTick
-
-Returns:
-
- None
-
---*/
-{
- IEVENT *Event;
-
- //
- // Check runtiem flag in case there are ticks while exiting boot services
- //
-
- CoreAcquireLock (&mEfiSystemTimeLock);
-
- //
- // Update the system time
- //
-
- mEfiSystemTime += Duration;
-
- //
- // If the head of the list is expired, fire the timer event
- // to process it
- //
-
- if (!IsListEmpty (&mEfiTimerList)) {
- Event = CR (mEfiTimerList.ForwardLink, IEVENT, u.Timer.Link, EVENT_SIGNATURE);
-
- if (Event->u.Timer.TriggerTime <= mEfiSystemTime) {
- CoreSignalEvent (mEfiCheckTimerEvent);
- }
- }
-
- CoreReleaseLock (&mEfiSystemTimeLock);
-}
-
-STATIC
-VOID
-EFIAPI
-CoreCheckTimers (
- IN EFI_EVENT CheckEvent,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Checks the sorted timer list against the current system time.
- Signals any expired event timer.
-
-Arguments:
-
- CheckEvent - Not used
-
- Context - Not used
-
-Returns:
-
- None
-
---*/
-{
- UINT64 SystemTime;
- IEVENT *Event;
-
- //
- // Check the timer database for expired timers
- //
-
- CoreAcquireLock (&mEfiTimerLock);
- SystemTime = CoreCurrentSystemTime ();
-
- while (!IsListEmpty (&mEfiTimerList)) {
- Event = CR (mEfiTimerList.ForwardLink, IEVENT, u.Timer.Link, EVENT_SIGNATURE);
-
- //
- // If this timer is not expired, then we're done
- //
-
- if (Event->u.Timer.TriggerTime > SystemTime) {
- break;
- }
-
- //
- // Remove this timer from the timer queue
- //
-
- RemoveEntryList (&Event->u.Timer.Link);
- Event->u.Timer.Link.ForwardLink = NULL;
-
- //
- // Signal it
- //
- CoreSignalEvent (Event);
-
- //
- // If this is a periodic timer, set it
- //
- if (Event->u.Timer.Period) {
-
- //
- // Compute the timers new trigger time
- //
-
- Event->u.Timer.TriggerTime = Event->u.Timer.TriggerTime + Event->u.Timer.Period;
-
- //
- // If that's before now, then reset the timer to start from now
- //
- if (Event->u.Timer.TriggerTime <= SystemTime) {
- Event->u.Timer.TriggerTime = SystemTime;
- CoreSignalEvent (mEfiCheckTimerEvent);
- }
-
- //
- // Add the timer
- //
-
- CoreInsertEventTimer (Event);
- }
- }
-
- CoreReleaseLock (&mEfiTimerLock);
-}
-
-STATIC
-VOID
-CoreInsertEventTimer (
- IN IEVENT *Event
- )
-/*++
-
-Routine Description:
-
- Inserts the timer event
-
-Arguments:
-
- Event - Points to the internal structure of timer event to be installed
-
-Returns:
-
- None
-
---*/
-{
- UINT64 TriggerTime;
- LIST_ENTRY *Link;
- IEVENT *Event2;
-
- ASSERT_LOCKED (&mEfiTimerLock);
-
- //
- // Get the timer's trigger time
- //
-
- TriggerTime = Event->u.Timer.TriggerTime;
-
- //
- // Insert the timer into the timer database in assending sorted order
- //
-
- for (Link = mEfiTimerList.ForwardLink; Link != &mEfiTimerList; Link = Link->ForwardLink) {
- Event2 = CR (Link, IEVENT, u.Timer.Link, EVENT_SIGNATURE);
-
- if (Event2->u.Timer.TriggerTime > TriggerTime) {
- break;
- }
- }
-
- InsertTailList (Link, &Event->u.Timer.Link);
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreSetTimer (
- IN EFI_EVENT UserEvent,
- IN EFI_TIMER_DELAY Type,
- IN UINT64 TriggerTime
- )
-/*++
-
-Routine Description:
-
- Sets the type of timer and the trigger time for a timer event.
-
-Arguments:
-
- UserEvent - The timer event that is to be signaled at the specified time
- Type - The type of time that is specified in TriggerTime
- TriggerTime - The number of 100ns units until the timer expires
-
-Returns:
-
- EFI_SUCCESS - The event has been set to be signaled at the requested time
- EFI_INVALID_PARAMETER - Event or Type is not valid
-
---*/
-{
- IEVENT *Event;
-
- Event = UserEvent;
-
- if (Event == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Event->Signature != EVENT_SIGNATURE) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Type < 0 || Type > TimerRelative || !(Event->Type & EVT_TIMER)) {
- return EFI_INVALID_PARAMETER;
- }
-
- CoreAcquireLock (&mEfiTimerLock);
-
- //
- // If the timer is queued to the timer database, remove it
- //
-
- if (Event->u.Timer.Link.ForwardLink != NULL) {
- RemoveEntryList (&Event->u.Timer.Link);
- Event->u.Timer.Link.ForwardLink = NULL;
- }
-
- Event->u.Timer.TriggerTime = 0;
- Event->u.Timer.Period = 0;
-
- if (Type != TimerCancel) {
-
- if (Type == TimerPeriodic) {
- Event->u.Timer.Period = TriggerTime;
- }
-
- Event->u.Timer.TriggerTime = CoreCurrentSystemTime () + TriggerTime;
- CoreInsertEventTimer (Event);
-
- if (TriggerTime == 0) {
- CoreSignalEvent (mEfiCheckTimerEvent);
- }
- }
-
- CoreReleaseLock (&mEfiTimerLock);
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Dxe/Event/tpl.c b/EdkModulePkg/Core/Dxe/Event/tpl.c
deleted file mode 100644
index 437665f..0000000
--- a/EdkModulePkg/Core/Dxe/Event/tpl.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- tpl.c
-
-Abstract:
-
- Task priority function
-
---*/
-
-#include <DxeMain.h>
-
-STATIC
-VOID
-CoreSetInterruptState (
- IN BOOLEAN Enable
- )
-/*++
-
-Routine Description:
-
- Set Interrupt State
-
-Arguments:
-
- Enable - The state of enable or disable interrupt
-
-Returns:
-
- None
-
---*/
-
-{
- if (gCpu != NULL) {
- if (Enable) {
- gCpu->EnableInterrupt(gCpu);
- } else {
- gCpu->DisableInterrupt(gCpu);
- }
- }
-}
-
-//
-// Return the highest set bit
-//
-UINTN
-CoreHighestSetBit (
- IN UINTN Number
- )
-/*++
-
-Routine Description:
-
- Return the highest set bit
-
-Arguments:
-
- Number - The value to check
-
-Returns:
-
- Bit position of the highest set bit
-
---*/
-{
- UINTN msb;
-
- msb = 31;
- while ((msb > 0) && ((Number & (UINTN)(1 << msb)) == 0)) {
- msb--;
- }
-
- return msb;
-}
-
-
-
-EFI_TPL
-EFIAPI
-CoreRaiseTpl (
- IN EFI_TPL NewTpl
- )
-/*++
-
-Routine Description:
-
- Raise the task priority level to the new level.
- High level is implemented by disabling processor interrupts.
-
-Arguments:
-
- NewTpl - New task priority level
-
-Returns:
-
- The previous task priority level
-
---*/
-{
- EFI_TPL OldTpl;
-
- OldTpl = gEfiCurrentTpl;
- ASSERT (OldTpl <= NewTpl);
- ASSERT (VALID_TPL (NewTpl));
-
- //
- // If raising to high level, disable interrupts
- //
- if (NewTpl >= TPL_HIGH_LEVEL && OldTpl < TPL_HIGH_LEVEL) {
- CoreSetInterruptState (FALSE);
- }
-
- //
- // Set the new value
- //
- gEfiCurrentTpl = NewTpl;
-
- return OldTpl;
-}
-
-
-
-VOID
-EFIAPI
-CoreRestoreTpl (
- IN EFI_TPL NewTpl
- )
-/*++
-
-Routine Description:
-
- Lowers the task priority to the previous value. If the new
- priority unmasks events at a higher priority, they are dispatched.
-
-Arguments:
-
- NewTpl - New, lower, task priority
-
-Returns:
-
- None
-
---*/
-{
- EFI_TPL OldTpl;
-
- OldTpl = gEfiCurrentTpl;
- ASSERT (NewTpl <= OldTpl);
- ASSERT (VALID_TPL (NewTpl));
-
- //
- // If lowering below HIGH_LEVEL, make sure
- // interrupts are enabled
- //
-
- if (OldTpl >= TPL_HIGH_LEVEL && NewTpl < TPL_HIGH_LEVEL) {
- gEfiCurrentTpl = TPL_HIGH_LEVEL;
- }
-
- //
- // Dispatch any pending events
- //
-
- while ((-2 << NewTpl) & gEventPending) {
- gEfiCurrentTpl = CoreHighestSetBit (gEventPending);
- if (gEfiCurrentTpl < TPL_HIGH_LEVEL) {
- CoreSetInterruptState (TRUE);
- }
- CoreDispatchEventNotifies (gEfiCurrentTpl);
- }
-
- //
- // Set the new value
- //
-
- gEfiCurrentTpl = NewTpl;
-
- //
- // If lowering below HIGH_LEVEL, make sure
- // interrupts are enabled
- //
- if (gEfiCurrentTpl < TPL_HIGH_LEVEL) {
- CoreSetInterruptState (TRUE);
- }
-
-}
diff --git a/EdkModulePkg/Core/Dxe/Exec.h b/EdkModulePkg/Core/Dxe/Exec.h
deleted file mode 100644
index 5df7001..0000000
--- a/EdkModulePkg/Core/Dxe/Exec.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- exec.h
-
-Abstract:
-
- EFI Event support
-
---*/
-
-#ifndef _EXEC_H_
-#define _EXEC_H_
-
-#define VALID_TPL(a) ((a) <= TPL_HIGH_LEVEL)
-
-//
-// EFI_EVENT
-//
-
-
-
-#define EVENT_SIGNATURE EFI_SIGNATURE_32('e','v','n','t')
-typedef struct {
- UINTN Signature;
- UINT32 Type;
- UINT32 SignalCount;
-
- //
- // Entry if the event is registered to be signalled
- //
-
- LIST_ENTRY SignalLink;
-
- //
- // Notification information for this event
- //
-
- EFI_TPL NotifyTpl;
- EFI_EVENT_NOTIFY NotifyFunction;
- VOID *NotifyContext;
- EFI_GUID EventGroup;
- LIST_ENTRY NotifyLink;
- BOOLEAN ExFlag;
-
- //
- // A list of all runtime events
- //
- EFI_RUNTIME_EVENT_ENTRY RuntimeData;
-
- //
- // Information by event type
- //
-
- union {
- //
- // For timer events
- //
- struct {
- LIST_ENTRY Link;
- UINT64 TriggerTime;
- UINT64 Period;
- } Timer;
- } u;
-
-} IEVENT;
-
-//
-// Internal prototypes
-//
-
-VOID
-CoreDispatchEventNotifies (
- IN EFI_TPL Priority
- )
-/*++
-
-Routine Description:
-
- Dispatches all pending events.
-
-Arguments:
-
- Priority - The task priority level of event notifications to dispatch
-
-Returns:
-
- None
-
---*/
-;
-
-
-UINTN
-CoreHighestSetBit (
- IN UINTN Number
- )
-/*++
-
-Routine Description:
-
- Return the highest set bit
-
-Arguments:
-
- Number - The value to check
-
-Returns:
-
- Bit position of the highest set bit
-
---*/
-;
-
-
-BOOLEAN
-GetInterruptState (
- VOID
- )
-/*++
-
-Routine Description:
-
- Disables CPU interrupts.
-
-Arguments:
-
- This - Protocol instance structure
-
- State - Pointer to the CPU's current interrupt state
-
-Returns:
-
- EFI_SUCCESS - If interrupts were disabled in the CPU.
-
- EFI_INVALID_PARAMETER - State is NULL.
-
---*/
-;
-
-//
-// Exported functions
-//
-
-VOID
-CoreEventVirtualAddressFixup (
- VOID
- )
-/*++
-
-Routine Description:
-
- A function out of date, should be removed.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-
-VOID
-CoreInitializeTimer (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initializes timer support
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-//
-// extern data declarations
-//
-
-extern EFI_LOCK gEventQueueLock;
-extern UINTN gEventPending;
-extern LIST_ENTRY gEventQueue[];
-extern LIST_ENTRY gEventSignalQueue;
-extern UINT8 gHSB[];
-
-#endif
diff --git a/EdkModulePkg/Core/Dxe/FwVol/Ffs.c b/EdkModulePkg/Core/Dxe/FwVol/Ffs.c
deleted file mode 100644
index 23c84b3..0000000
--- a/EdkModulePkg/Core/Dxe/FwVol/Ffs.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ffs.c
-
-Abstract:
-
- FFS file access utilities.
-
---*/
-
-
-#include <DxeMain.h>
-
-#define PHYSICAL_ADDRESS_TO_POINTER(Address) ((VOID *)((UINTN)(Address)))
-
-
-EFI_FFS_FILE_STATE
-GetFileState (
- IN UINT8 ErasePolarity,
- IN EFI_FFS_FILE_HEADER *FfsHeader
- )
-/*++
-
-Routine Description:
- Get the FFS file state by checking the highest bit set in the header's state field
-
-Arguments:
- ErasePolarity - Erase polarity attribute of the firmware volume
- FfsHeader - Points to the FFS file header
-
-Returns:
- FFS File state
-
---*/
-{
- EFI_FFS_FILE_STATE FileState;
- UINT8 HighestBit;
-
- FileState = FfsHeader->State;
-
- if (ErasePolarity != 0) {
- FileState = (EFI_FFS_FILE_STATE)~FileState;
- }
-
- HighestBit = 0x80;
- while (HighestBit != 0 && ((HighestBit & FileState) == 0)) {
- HighestBit >>= 1;
- }
-
- return (EFI_FFS_FILE_STATE)HighestBit;
-}
-
-
-BOOLEAN
-IsBufferErased (
- IN UINT8 ErasePolarity,
- IN VOID *InBuffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
- Check if a block of buffer is erased
-
-Arguments:
- ErasePolarity - Erase polarity attribute of the firmware volume
- InBuffer - The buffer to be checked
- BufferSize - Size of the buffer in bytes
-
-Returns:
- TRUE - The block of buffer is erased
- FALSE - The block of buffer is not erased
-
---*/
-{
- UINTN Count;
- UINT8 EraseByte;
- UINT8 *Buffer;
-
- if(ErasePolarity == 1) {
- EraseByte = 0xFF;
- } else {
- EraseByte = 0;
- }
-
- Buffer = InBuffer;
- for (Count = 0; Count < BufferSize; Count++) {
- if (Buffer[Count] != EraseByte) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-
-BOOLEAN
-VerifyFvHeaderChecksum (
- IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader
- )
-/*++
-
-Routine Description:
- Verify checksum of the firmware volume header
-
-Arguments:
- FvHeader - Points to the firmware volume header to be checked
-
-Returns:
- TRUE - Checksum verification passed
- FALSE - Checksum verification failed
-
---*/
-{
- UINT32 Index;
- UINT32 HeaderLength;
- UINT16 Checksum;
- UINT16 *ptr;
-
- HeaderLength = FvHeader->HeaderLength;
- ptr = (UINT16 *)FvHeader;
- Checksum = 0;
-
- for (Index = 0; Index < HeaderLength / sizeof (UINT16); Index++) {
- Checksum = (UINT16)(Checksum + ptr[Index]);
- }
-
- if (Checksum == 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-STATIC
-BOOLEAN
-VerifyHeaderChecksum (
- IN EFI_FFS_FILE_HEADER *FfsHeader
- )
-/*++
-
-Routine Description:
- Verify checksum of the FFS file header
-
-Arguments:
- FfsHeader - Points to the FFS file header to be checked
-
-Returns:
- TRUE - Checksum verification passed
- FALSE - Checksum verification failed
-
---*/
-{
- UINT32 Index;
- UINT8 *ptr;
- UINT8 HeaderChecksum;
-
- ptr = (UINT8 *)FfsHeader;
- HeaderChecksum = 0;
- for (Index = 0; Index < sizeof(EFI_FFS_FILE_HEADER); Index++) {
- HeaderChecksum = (UINT8)(HeaderChecksum + ptr[Index]);
- }
-
- HeaderChecksum = (UINT8) (HeaderChecksum - FfsHeader->State - FfsHeader->IntegrityCheck.Checksum.File);
-
- if (HeaderChecksum == 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-
-BOOLEAN
-IsValidFfsHeader (
- IN UINT8 ErasePolarity,
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- OUT EFI_FFS_FILE_STATE *FileState
- )
-/*++
-
-Routine Description:
- Check if it's a valid FFS file header
-
-Arguments:
- ErasePolarity - Erase polarity attribute of the firmware volume
- FfsHeader - Points to the FFS file header to be checked
- FileState - FFS file state to be returned
-
-Returns:
- TRUE - Valid FFS file header
- FALSE - Invalid FFS file header
-
---*/
-{
- *FileState = GetFileState (ErasePolarity, FfsHeader);
-
- switch (*FileState) {
- case EFI_FILE_HEADER_VALID:
- case EFI_FILE_DATA_VALID:
- case EFI_FILE_MARKED_FOR_UPDATE:
- case EFI_FILE_DELETED:
- //
- // Here we need to verify header checksum
- //
- return VerifyHeaderChecksum (FfsHeader);
-
- case EFI_FILE_HEADER_CONSTRUCTION:
- case EFI_FILE_HEADER_INVALID:
- default:
- return FALSE;
- }
-}
-
-
-BOOLEAN
-IsValidFfsFile (
- IN UINT8 ErasePolarity,
- IN EFI_FFS_FILE_HEADER *FfsHeader
- )
-/*++
-
-Routine Description:
- Check if it's a valid FFS file.
- Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first.
-
-Arguments:
- ErasePolarity - Erase polarity attribute of the firmware volume
- FfsHeader - Points to the FFS file to be checked
-
-Returns:
- TRUE - Valid FFS file
- FALSE - Invalid FFS file
-
---*/
-{
- EFI_FFS_FILE_STATE FileState;
-
- FileState = GetFileState (ErasePolarity, FfsHeader);
- switch (FileState) {
-
- case EFI_FILE_DELETED:
- case EFI_FILE_DATA_VALID:
- case EFI_FILE_MARKED_FOR_UPDATE:
- //
- // Some other vliadation like file content checksum might be done here.
- // For performance issue, Tiano only do FileState check.
- //
- return TRUE;
-
- default:
- return FALSE;
- }
-}
-
diff --git a/EdkModulePkg/Core/Dxe/FwVol/FwVol.c b/EdkModulePkg/Core/Dxe/FwVol/FwVol.c
deleted file mode 100644
index a73a125..0000000
--- a/EdkModulePkg/Core/Dxe/FwVol/FwVol.c
+++ /dev/null
@@ -1,547 +0,0 @@
-/**@file
- Firmware File System driver that produce Firmware Volume protocol.
- Layers on top of Firmware Block protocol to produce a file abstraction
- of FV based files.
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <DxeMain.h>
-
-#define KEYSIZE sizeof (UINTN)
-
-//
-// Protocol notify related globals
-//
-VOID *gEfiFwVolBlockNotifyReg;
-EFI_EVENT gEfiFwVolBlockEvent;
-
-FV_DEVICE mFvDevice = {
- FV_DEVICE_SIGNATURE,
- NULL,
- NULL,
- {
- FvGetVolumeAttributes,
- FvSetVolumeAttributes,
- FvReadFile,
- FvReadFileSection,
- FvWriteFile,
- FvGetNextFile,
- KEYSIZE
- },
- NULL,
- NULL,
- NULL,
- NULL,
- { NULL, NULL },
- 0
-};
-
-
-//
-// FFS helper functions
-//
-
-EFI_STATUS
-GetFwVolHeader (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,
- OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
- )
-/*++
-
-Routine Description:
- given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
- copy the volume header into it.
-
-Arguments:
- Fvb - The FW_VOL_BLOCK_PROTOCOL instance from which to read the volume
- header
- FwVolHeader - Pointer to pointer to allocated buffer in which the volume
- header is returned.
-
-Returns:
- EFI_OUT_OF_RESOURCES - No enough buffer could be allocated.
- EFI_SUCCESS - Successfully read volume header to the allocated buffer.
-
---*/
-
-{
- EFI_STATUS Status;
- EFI_FIRMWARE_VOLUME_HEADER TempFvh;
- UINTN FvhLength;
- UINT8 *Buffer;
-
-
- //
- //Determine the real length of FV header
- //
- FvhLength = sizeof (EFI_FIRMWARE_VOLUME_HEADER);
- Status = Fvb->Read (Fvb, 0, 0, &FvhLength, (UINT8 *)&TempFvh);
-
- //
- // Allocate a buffer for the caller
- //
- *FwVolHeader = CoreAllocateBootServicesPool (TempFvh.HeaderLength);
- if (*FwVolHeader == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Copy the standard header into the buffer
- //
- CopyMem (*FwVolHeader, &TempFvh, sizeof (EFI_FIRMWARE_VOLUME_HEADER));
-
- //
- // Read the rest of the header
- //
- FvhLength = TempFvh.HeaderLength - sizeof (EFI_FIRMWARE_VOLUME_HEADER);
- Buffer = (UINT8 *)*FwVolHeader + sizeof (EFI_FIRMWARE_VOLUME_HEADER);
- Status = Fvb->Read (Fvb, 0, sizeof (EFI_FIRMWARE_VOLUME_HEADER), &FvhLength, Buffer);
- if (EFI_ERROR (Status)) {
- //
- // Read failed so free buffer
- //
- CoreFreePool (*FwVolHeader);
- }
-
- return Status;
-}
-
-
-STATIC
-VOID
-FreeFvDeviceResource (
- IN FV_DEVICE *FvDevice
- )
-/*++
-
-Routine Description:
- Free FvDevice resource when error happens
-
-Arguments:
- FvDevice - pointer to the FvDevice to be freed.
-
-Returns:
- None.
-
---*/
-{
- FFS_FILE_LIST_ENTRY *FfsFileEntry;
- LIST_ENTRY *NextEntry;
-
- //
- // Free File List Entry
- //
- FfsFileEntry = (FFS_FILE_LIST_ENTRY *)FvDevice->FfsFileListHeader.ForwardLink;
- while (&FfsFileEntry->Link != &FvDevice->FfsFileListHeader) {
- NextEntry = (&FfsFileEntry->Link)->ForwardLink;
-
- if (FfsFileEntry->StreamHandle != 0) {
- //
- // Close stream and free resources from SEP
- //
- FfsFileEntry->Sep->CloseSectionStream (FfsFileEntry->Sep, FfsFileEntry->StreamHandle);
- }
-
- CoreFreePool (FfsFileEntry);
-
- FfsFileEntry = (FFS_FILE_LIST_ENTRY *)NextEntry;
- }
-
-
- //
- // Free the cache
- //
- CoreFreePool (FvDevice->CachedFv);
-
- //
- // Free Volume Header
- //
- CoreFreePool (FvDevice->FwVolHeader);
-
- return;
-}
-
-
-EFI_STATUS
-FvCheck (
- IN OUT FV_DEVICE *FvDevice
- )
-/*++
-
-Routine Description:
- Check if a FV is consistent and allocate cache
-
-Arguments:
- FvDevice - pointer to the FvDevice to be checked.
-
-Returns:
- EFI_OUT_OF_RESOURCES - No enough buffer could be allocated.
- EFI_SUCCESS - FV is consistent and cache is allocated.
- EFI_VOLUME_CORRUPTED - File system is corrupted.
-
---*/
-{
- EFI_STATUS Status;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- EFI_FVB_ATTRIBUTES FvbAttributes;
- EFI_FV_BLOCK_MAP_ENTRY *BlockMap;
- FFS_FILE_LIST_ENTRY *FfsFileEntry;
- EFI_FFS_FILE_HEADER *FfsHeader;
- UINT8 *CacheLocation;
- UINTN LbaOffset;
- UINTN Index;
- EFI_LBA LbaIndex;
- UINTN Size;
- UINTN FileLength;
- EFI_FFS_FILE_STATE FileState;
- UINT8 *TopFvAddress;
- UINTN TestLength;
-
-
- Fvb = FvDevice->Fvb;
- FwVolHeader = FvDevice->FwVolHeader;
-
- Status = Fvb->GetVolumeAttributes (Fvb, &FvbAttributes);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Size is the size of the FV minus the head. We have already allocated
- // the header to check to make sure the volume is valid
- //
- Size = (UINTN)(FwVolHeader->FvLength - FwVolHeader->HeaderLength);
- FvDevice->CachedFv = CoreAllocateBootServicesPool (Size);
-
- if (FvDevice->CachedFv == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Remember a pointer to the end fo the CachedFv
- //
- FvDevice->EndOfCachedFv = FvDevice->CachedFv + Size;
-
- //
- // Copy FV minus header into memory using the block map we have all ready
- // read into memory.
- //
- BlockMap = FwVolHeader->FvBlockMap;
- CacheLocation = FvDevice->CachedFv;
- LbaIndex = 0;
- LbaOffset = FwVolHeader->HeaderLength;
- while ((BlockMap->NumBlocks != 0) || (BlockMap->BlockLength != 0)) {
-
- for (Index = 0; Index < BlockMap->NumBlocks; Index ++) {
-
- Size = BlockMap->BlockLength;
- if (Index == 0) {
- //
- // Cache does not include FV Header
- //
- Size -= LbaOffset;
- }
- Status = Fvb->Read (Fvb,
- LbaIndex,
- LbaOffset,
- &Size,
- CacheLocation
- );
- //
- // Not check EFI_BAD_BUFFER_SIZE, for Size = BlockMap->BlockLength
- //
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- //
- // After we skip Fv Header always read from start of block
- //
- LbaOffset = 0;
-
- LbaIndex++;
- CacheLocation += Size;
- }
- BlockMap++;
- }
-
- //
- // Scan to check the free space & File list
- //
- if (FvbAttributes & EFI_FVB_ERASE_POLARITY) {
- FvDevice->ErasePolarity = 1;
- } else {
- FvDevice->ErasePolarity = 0;
- }
-
-
- //
- // go through the whole FV cache, check the consistence of the FV.
- // Make a linked list off all the Ffs file headers
- //
- Status = EFI_SUCCESS;
- InitializeListHead (&FvDevice->FfsFileListHeader);
-
- //
- // Build FFS list
- //
- FfsHeader = (EFI_FFS_FILE_HEADER *)FvDevice->CachedFv;
- TopFvAddress = FvDevice->EndOfCachedFv;
- while ((UINT8 *)FfsHeader < TopFvAddress) {
-
- TestLength = TopFvAddress - ((UINT8 *)FfsHeader);
- if (TestLength > sizeof (EFI_FFS_FILE_HEADER)) {
- TestLength = sizeof (EFI_FFS_FILE_HEADER);
- }
-
- if (IsBufferErased (FvDevice->ErasePolarity, FfsHeader, TestLength)) {
- //
- // We have found the free space so we are done!
- //
- goto Done;
- }
-
- if (!IsValidFfsHeader (FvDevice->ErasePolarity, FfsHeader, &FileState)) {
- if ((FileState == EFI_FILE_HEADER_INVALID) ||
- (FileState == EFI_FILE_HEADER_CONSTRUCTION)) {
- FfsHeader++;
-
- continue;
-
- } else {
- //
- // File system is corrputed
- //
- Status = EFI_VOLUME_CORRUPTED;
- goto Done;
- }
- }
-
- if (!IsValidFfsFile (FvDevice->ErasePolarity, FfsHeader)) {
- //
- // File system is corrupted
- //
- Status = EFI_VOLUME_CORRUPTED;
- goto Done;
- }
-
- //
- // Size[3] is a three byte array, read 4 bytes and throw one away
- //
- FileLength = *(UINT32 *)&FfsHeader->Size[0] & 0x00FFFFFF;
-
- FileState = GetFileState (FvDevice->ErasePolarity, FfsHeader);
-
- //
- // check for non-deleted file
- //
- if (FileState != EFI_FILE_DELETED) {
- //
- // Create a FFS list entry for each non-deleted file
- //
- FfsFileEntry = CoreAllocateZeroBootServicesPool (sizeof (FFS_FILE_LIST_ENTRY));
- if (FfsFileEntry == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- FfsFileEntry->FfsHeader = FfsHeader;
- InsertTailList (&FvDevice->FfsFileListHeader, &FfsFileEntry->Link);
- }
-
- FfsHeader = (EFI_FFS_FILE_HEADER *)(((UINT8 *)FfsHeader) + FileLength);
-
- //
- // Adjust pointer to the next 8-byte aligned boundry.
- //
- FfsHeader = (EFI_FFS_FILE_HEADER *)(((UINTN)FfsHeader + 7) & ~0x07);
-
- }
-
-Done:
- if (EFI_ERROR (Status)) {
- FreeFvDeviceResource (FvDevice);
- }
-
- return Status;
-}
-
-
-STATIC
-VOID
-EFIAPI
-NotifyFwVolBlock (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
- This notification function is invoked when an instance of the
- EFI_FW_VOLUME_BLOCK_PROTOCOL is produced. It layers an instance of the
- EFI_FIRMWARE_VOLUME_PROTOCOL on the same handle. This is the function where
- the actual initialization of the EFI_FIRMWARE_VOLUME_PROTOCOL is done.
-
-Arguments:
- Event - The event that occured
- Context - For EFI compatiblity. Not used.
-
-Returns:
-
- None.
-
---*/
-{
- EFI_HANDLE Handle;
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
- FV_DEVICE *FvDevice;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- //
- // Examine all new handles
- //
- for (;;) {
- //
- // Get the next handle
- //
- BufferSize = sizeof (Handle);
- Status = CoreLocateHandle (
- ByRegisterNotify,
- NULL,
- gEfiFwVolBlockNotifyReg,
- &BufferSize,
- &Handle
- );
-
- //
- // If not found, we're done
- //
- if (EFI_NOT_FOUND == Status) {
- break;
- }
-
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Get the FirmwareVolumeBlock protocol on that handle
- //
- Status = CoreHandleProtocol (Handle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb);
- ASSERT_EFI_ERROR (Status);
-
-
- //
- // Make sure the Fv Header is O.K.
- //
- Status = GetFwVolHeader (Fvb, &FwVolHeader);
- if (EFI_ERROR (Status)) {
- return;
- }
-
- if (!VerifyFvHeaderChecksum (FwVolHeader)) {
- CoreFreePool (FwVolHeader);
- continue;
- }
-
-
- //
- // Check to see that the file system is indeed formatted in a way we can
- // understand it...
- //
- if (!CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystemGuid)) {
- continue;
- }
-
- //
- // Check if there is an FV protocol already installed in that handle
- //
- Status = CoreHandleProtocol (Handle, &gEfiFirmwareVolumeProtocolGuid, (VOID **)&Fv);
- if (!EFI_ERROR (Status)) {
- //
- // Update Fv to use a new Fvb
- //
- FvDevice = _CR (Fv, FV_DEVICE, Fv);
- if (FvDevice->Signature == FV_DEVICE_SIGNATURE) {
- //
- // Only write into our device structure if it's our device structure
- //
- FvDevice->Fvb = Fvb;
- }
-
- } else {
- //
- // No FwVol protocol on the handle so create a new one
- //
- FvDevice = CoreAllocateCopyPool (sizeof (FV_DEVICE), &mFvDevice);
- if (FvDevice == NULL) {
- return;
- }
-
- FvDevice->Fvb = Fvb;
- FvDevice->Handle = Handle;
- FvDevice->FwVolHeader = FwVolHeader;
- FvDevice->Fv.ParentHandle = Fvb->ParentHandle;
-
- //
- // Install an New FV protocol on the existing handle
- //
- Status = CoreInstallProtocolInterface (
- &Handle,
- &gEfiFirmwareVolumeProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &FvDevice->Fv
- );
- ASSERT_EFI_ERROR (Status);
- }
- }
-
- return;
-}
-
-
-EFI_STATUS
-EFIAPI
-FwVolDriverInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This routine is the driver initialization entry point. It initializes the
- libraries, and registers two notification functions. These notification
- functions are responsible for building the FV stack dynamically.
-
-Arguments:
- ImageHandle - The image handle.
- SystemTable - The system table.
-
-Returns:
- EFI_SUCCESS - Function successfully returned.
-
---*/
-{
- gEfiFwVolBlockEvent = CoreCreateProtocolNotifyEvent (
- &gEfiFirmwareVolumeBlockProtocolGuid,
- TPL_CALLBACK,
- NotifyFwVolBlock,
- NULL,
- &gEfiFwVolBlockNotifyReg,
- TRUE
- );
- return EFI_SUCCESS;
-}
-
diff --git a/EdkModulePkg/Core/Dxe/FwVol/FwVolAttrib.c b/EdkModulePkg/Core/Dxe/FwVol/FwVolAttrib.c
deleted file mode 100644
index 8a44653..0000000
--- a/EdkModulePkg/Core/Dxe/FwVol/FwVolAttrib.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FwVolAttrib.c
-
-Abstract:
-
- Implements get/set firmware volume attributes
-
---*/
-
-#include <DxeMain.h>
-
-EFI_STATUS
-EFIAPI
-FvGetVolumeAttributes (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- OUT EFI_FV_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter
-
-Arguments:
- This - Calling context
- Attributes - output buffer which contains attributes
-
-Returns:
- EFI_SUCCESS - Successfully got volume attributes
-
---*/
-{
- EFI_STATUS Status;
- FV_DEVICE *FvDevice;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_FVB_ATTRIBUTES FvbAttributes;
-
- FvDevice = FV_DEVICE_FROM_THIS (This);
- Fvb = FvDevice->Fvb;
-
- if (FvDevice->CachedFv == NULL) {
- Status = FvCheck (FvDevice);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- //
- // First get the Firmware Volume Block Attributes
- //
- Status = Fvb->GetVolumeAttributes (Fvb, &FvbAttributes);
-
- //
- // Mask out Fvb bits that are not defined in FV
- //
- FvbAttributes &= 0xfffff0ff;
-
- *Attributes = (EFI_FV_ATTRIBUTES)FvbAttributes;
-
- return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-FvSetVolumeAttributes (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN OUT EFI_FV_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Sets current attributes for volume
-
-Arguments:
- This - Calling context
- Attributes - At input, contains attributes to be set. At output contains
- new value of FV
-
-Returns:
- EFI_UNSUPPORTED - Could not be set.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
diff --git a/EdkModulePkg/Core/Dxe/FwVol/FwVolRead.c b/EdkModulePkg/Core/Dxe/FwVol/FwVolRead.c
deleted file mode 100644
index ff2fcb8..0000000
--- a/EdkModulePkg/Core/Dxe/FwVol/FwVolRead.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FwVolRead.c
-
-Abstract:
-
- Implements read firmware file
-
---*/
-
-#include <DxeMain.h>
-
-/*++
-
-Required Alignment Alignment Value in FFS Alignment Value in
-(bytes) Attributes Field Firmware Volume Interfaces
-1 0 0
-2 0 1
-4 0 2
-8 0 3
-16 1 4
-128 2 7
-512 3 9
-1 KB 4 10
-4 KB 5 12
-32 KB 6 15
-64 KB 7 16
-
---*/
-
-UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16};
-
-
-STATIC
-EFI_FV_FILE_ATTRIBUTES
-FfsAttributes2FvFileAttributes (
- IN EFI_FFS_FILE_ATTRIBUTES FfsAttributes
- )
-/*++
-
- Routine Description:
- Convert the FFS File Attributes to FV File Attributes
-
- Arguments:
- FfsAttributes - The attributes of UINT8 type.
-
- Returns:
- The attributes of EFI_FV_FILE_ATTRIBUTES
-
---*/
-{
- FfsAttributes = (EFI_FFS_FILE_ATTRIBUTES)((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT) >> 3);
- ASSERT (FfsAttributes < 8);
-
- return (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[FfsAttributes];
-}
-
-
-EFI_STATUS
-EFIAPI
-FvGetNextFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN OUT VOID *Key,
- IN OUT EFI_FV_FILETYPE *FileType,
- OUT EFI_GUID *NameGuid,
- OUT EFI_FV_FILE_ATTRIBUTES *Attributes,
- OUT UINTN *Size
- )
-/*++
-
-Routine Description:
- Given the input key, search for the next matching file in the volume.
-
-Arguments:
- This - Indicates the calling context.
- FileType - FileType is a pointer to a caller allocated
- EFI_FV_FILETYPE. The GetNextFile() API can filter it's
- search for files based on the value of *FileType input.
- A *FileType input of 0 causes GetNextFile() to search for
- files of all types. If a file is found, the file's type
- is returned in *FileType. *FileType is not modified if
- no file is found.
- Key - Key is a pointer to a caller allocated buffer that
- contains implementation specific data that is used to
- track where to begin the search for the next file.
- The size of the buffer must be at least This->KeySize
- bytes long. To reinitialize the search and begin from
- the beginning of the firmware volume, the entire buffer
- must be cleared to zero. Other than clearing the buffer
- to initiate a new search, the caller must not modify the
- data in the buffer between calls to GetNextFile().
- NameGuid - NameGuid is a pointer to a caller allocated EFI_GUID.
- If a file is found, the file's name is returned in
- *NameGuid. *NameGuid is not modified if no file is
- found.
- Attributes - Attributes is a pointer to a caller allocated
- EFI_FV_FILE_ATTRIBUTES. If a file is found, the file's
- attributes are returned in *Attributes. *Attributes is
- not modified if no file is found.
- Size - Size is a pointer to a caller allocated UINTN.
- If a file is found, the file's size is returned in *Size.
- *Size is not modified if no file is found.
-
-Returns:
- EFI_SUCCESS - Successfully find the file.
- EFI_DEVICE_ERROR - Device error.
- EFI_ACCESS_DENIED - Fv could not read.
- EFI_NOT_FOUND - No matching file found.
- EFI_INVALID_PARAMETER - Invalid parameter
-
---*/
-{
- EFI_STATUS Status;
- FV_DEVICE *FvDevice;
- EFI_FV_ATTRIBUTES FvAttributes;
- EFI_FFS_FILE_HEADER *FfsFileHeader;
- UINTN *KeyValue;
- LIST_ENTRY *Link;
- FFS_FILE_LIST_ENTRY *FfsFileEntry;
- UINTN FileLength;
-
- FvDevice = FV_DEVICE_FROM_THIS (This);
-
- Status = FvGetVolumeAttributes (This, &FvAttributes);
- if (EFI_ERROR (Status)){
- return Status;
- }
-
- //
- // Check if read operation is enabled
- //
- if ((FvAttributes & EFI_FV_READ_STATUS) == 0) {
- return EFI_ACCESS_DENIED;
- }
-
- if (*FileType > EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {
- //
- // File type needs to be in 0 - 0x0B
- //
- return EFI_INVALID_PARAMETER;
- }
-
- KeyValue = (UINTN *)Key;
- for (;;) {
- if (*KeyValue == 0) {
- //
- // Search for 1st matching file
- //
- Link = &FvDevice->FfsFileListHeader;
- } else {
- //
- // Key is pointer to FFsFileEntry, so get next one
- //
- Link = (LIST_ENTRY *)(*KeyValue);
- }
-
- if (Link->ForwardLink == &FvDevice->FfsFileListHeader) {
- //
- // Next is end of list so we did not find data
- //
- return EFI_NOT_FOUND;
- }
-
- FfsFileEntry = (FFS_FILE_LIST_ENTRY *)Link->ForwardLink;
- FfsFileHeader = (EFI_FFS_FILE_HEADER *)FfsFileEntry->FfsHeader;
-
- //
- // remember the key
- //
- *KeyValue = (UINTN)FfsFileEntry;
-
- if (FfsFileHeader->Type == EFI_FV_FILETYPE_FFS_PAD) {
- //
- // we ignore pad files
- //
- continue;
- }
-
- if (*FileType == 0) {
- //
- // Process all file types so we have a match
- //
- break;
- }
-
- if (*FileType == FfsFileHeader->Type) {
- //
- // Found a matching file type
- //
- break;
- }
-
- }
-
- //
- // Return FileType, NameGuid, and Attributes
- //
- *FileType = FfsFileHeader->Type;
- CopyMem (NameGuid, &FfsFileHeader->Name, sizeof (EFI_GUID));
- *Attributes = FfsAttributes2FvFileAttributes (FfsFileHeader->Attributes);
-
- //
- // Read four bytes out of the 3 byte array and throw out extra data
- //
- FileLength = *(UINT32 *)&FfsFileHeader->Size[0] & 0x00FFFFFF;
-
- //
- // we need to substract the header size
- //
- *Size = FileLength - sizeof(EFI_FFS_FILE_HEADER);
-
- if (FfsFileHeader->Attributes & FFS_ATTRIB_TAIL_PRESENT) {
- //
- // If tail is present substract it's size;
- //
- *Size -= sizeof(EFI_FFS_FILE_TAIL);
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-FvReadFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN EFI_GUID *NameGuid,
- IN OUT VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT EFI_FV_FILETYPE *FoundType,
- OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,
- OUT UINT32 *AuthenticationStatus
- )
-/*++
-
-Routine Description:
- Locates a file in the firmware volume and
- copies it to the supplied buffer.
-
-Arguments:
- This - Indicates the calling context.
- NameGuid - Pointer to an EFI_GUID, which is the filename.
- Buffer - Buffer is a pointer to pointer to a buffer in
- which the file or section contents or are returned.
- BufferSize - BufferSize is a pointer to caller allocated
- UINTN. On input *BufferSize indicates the size
- in bytes of the memory region pointed to by
- Buffer. On output, *BufferSize contains the number
- of bytes required to read the file.
- FoundType - FoundType is a pointer to a caller allocated
- EFI_FV_FILETYPE that on successful return from Read()
- contains the type of file read. This output reflects
- the file type irrespective of the value of the
- SectionType input.
- FileAttributes - FileAttributes is a pointer to a caller allocated
- EFI_FV_FILE_ATTRIBUTES. On successful return from
- Read(), *FileAttributes contains the attributes of
- the file read.
- AuthenticationStatus - AuthenticationStatus is a pointer to a caller
- allocated UINTN in which the authentication status
- is returned.
-Returns:
- EFI_SUCCESS - Successfully read to memory buffer.
- EFI_WARN_BUFFER_TOO_SMALL - Buffer too small.
- EFI_NOT_FOUND - Not found.
- EFI_DEVICE_ERROR - Device error.
- EFI_ACCESS_DENIED - Could not read.
- EFI_INVALID_PARAMETER - Invalid parameter.
- EFI_OUT_OF_RESOURCES - Not enough buffer to be allocated.
-
---*/
-{
- EFI_STATUS Status;
- FV_DEVICE *FvDevice;
- EFI_GUID SearchNameGuid;
- EFI_FV_FILETYPE LocalFoundType;
- EFI_FV_FILE_ATTRIBUTES LocalAttributes;
- UINTN FileSize;
- UINT8 *SrcPtr;
- EFI_FFS_FILE_HEADER *FfsHeader;
- UINTN InputBufferSize;
-
- if (NULL == NameGuid) {
- return EFI_INVALID_PARAMETER;
- }
-
- FvDevice = FV_DEVICE_FROM_THIS (This);
-
-
- //
- // Keep looking until we find the matching NameGuid.
- // The Key is really an FfsFileEntry
- //
- FvDevice->LastKey = 0;
- do {
- LocalFoundType = 0;
- Status = FvGetNextFile (
- This,
- &FvDevice->LastKey,
- &LocalFoundType,
- &SearchNameGuid,
- &LocalAttributes,
- &FileSize
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- } while (!CompareGuid (&SearchNameGuid, NameGuid));
-
- //
- // Get a pointer to the header
- //
- FfsHeader = FvDevice->LastKey->FfsHeader;
-
- //
- // Remember callers buffer size
- //
- InputBufferSize = *BufferSize;
-
- //
- // Calculate return values
- //
- *FoundType = FfsHeader->Type;
- *FileAttributes = FfsAttributes2FvFileAttributes (FfsHeader->Attributes);
- *AuthenticationStatus = 0;
- *BufferSize = FileSize;
-
- if (Buffer == NULL) {
- //
- // If Buffer is NULL, we only want to get the information colected so far
- //
- return EFI_SUCCESS;
- }
-
- //
- // Skip over file header
- //
- SrcPtr = ((UINT8 *)FfsHeader) + sizeof (EFI_FFS_FILE_HEADER);
-
- Status = EFI_SUCCESS;
- if (*Buffer == NULL) {
- //
- // Caller passed in a pointer so allocate buffer for them
- //
- *Buffer = CoreAllocateBootServicesPool (FileSize);
- if (*Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- } else if (FileSize > InputBufferSize) {
- //
- // Callers buffer was not big enough
- //
- Status = EFI_WARN_BUFFER_TOO_SMALL;
- FileSize = InputBufferSize;
- }
-
- //
- // Copy data into callers buffer
- //
- CopyMem (*Buffer, SrcPtr, FileSize);
-
- return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-FvReadFileSection (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN EFI_GUID *NameGuid,
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- IN OUT VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT UINT32 *AuthenticationStatus
- )
-/*++
-
- Routine Description:
- Locates a section in a given FFS File and
- copies it to the supplied buffer (not including section header).
-
- Arguments:
- This - Indicates the calling context.
- NameGuid - Pointer to an EFI_GUID, which is the filename.
- SectionType - Indicates the section type to return.
- SectionInstance - Indicates which instance of sections with a type of
- SectionType to return.
- Buffer - Buffer is a pointer to pointer to a buffer in which
- the file or section contents or are returned.
- BufferSize - BufferSize is a pointer to caller allocated UINTN.
- AuthenticationStatus -AuthenticationStatus is a pointer to a caller
- allocated UINT32 in which the authentication status
- is returned.
-
- Returns:
- EFI_SUCCESS - Successfully read the file section into buffer.
- EFI_WARN_BUFFER_TOO_SMALL - Buffer too small.
- EFI_NOT_FOUND - Section not found.
- EFI_DEVICE_ERROR - Device error.
- EFI_ACCESS_DENIED - Could not read.
- EFI_INVALID_PARAMETER - Invalid parameter.
-
---*/
-{
- EFI_STATUS Status;
- FV_DEVICE *FvDevice;
- EFI_FV_FILETYPE FileType;
- EFI_FV_FILE_ATTRIBUTES FileAttributes;
- UINTN FileSize;
- UINT8 *FileBuffer;
- EFI_SECTION_EXTRACTION_PROTOCOL *Sep;
- FFS_FILE_LIST_ENTRY *FfsEntry;
-
- if (NULL == NameGuid || Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- FvDevice = FV_DEVICE_FROM_THIS (This);
-
- //
- // Read the whole file into buffer
- //
- FileBuffer = NULL;
- Status = FvReadFile (
- This,
- NameGuid,
- (VOID **)&FileBuffer,
- &FileSize,
- &FileType,
- &FileAttributes,
- AuthenticationStatus
- );
- //
- // Get the last key used by our call to FvReadFile as it is the FfsEntry for this file.
- //
- FfsEntry = (FFS_FILE_LIST_ENTRY *)FvDevice->LastKey;
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Check to see that the file actually HAS sections before we go any further.
- //
- if (FileType == EFI_FV_FILETYPE_RAW) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- //
- // Use FfsEntry to cache Section Extraction Protocol Inforomation
- //
- if (FfsEntry->StreamHandle == 0) {
- //
- // Located the protocol
- //
- Status = CoreLocateProtocol (&gEfiSectionExtractionProtocolGuid, NULL, (VOID **)&Sep);
- //
- // Section Extraction Protocol is part of Dxe Core so this should never fail
- //
- ASSERT_EFI_ERROR (Status);
-
- Status = Sep->OpenSectionStream (
- Sep,
- FileSize,
- FileBuffer,
- &FfsEntry->StreamHandle
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- FfsEntry->Sep = Sep;
- } else {
- //
- // Get cached copy of Sep
- //
- Sep = FfsEntry->Sep;
- }
-
- //
- // If SectionType == 0 We need the whole section stream
- //
- Status = Sep->GetSection (
- Sep,
- FfsEntry->StreamHandle,
- (SectionType == 0) ? NULL : &SectionType,
- NULL,
- (SectionType == 0) ? 0 : SectionInstance,
- Buffer,
- BufferSize,
- AuthenticationStatus
- );
-
- //
- // Close of stream defered to close of FfsHeader list to allow SEP to cache data
- //
-
-Done:
- CoreFreePool (FileBuffer);
-
- return Status;
-}
-
diff --git a/EdkModulePkg/Core/Dxe/FwVol/FwVolWrite.c b/EdkModulePkg/Core/Dxe/FwVol/FwVolWrite.c
deleted file mode 100644
index 4368fe5..0000000
--- a/EdkModulePkg/Core/Dxe/FwVol/FwVolWrite.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FwVolWrite.c
-
-Abstract:
-
- Implements write firmware file
-
---*/
-
-#include <DxeMain.h>
-
-
-EFI_STATUS
-EFIAPI
-FvWriteFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN UINT32 NumberOfFiles,
- IN EFI_FV_WRITE_POLICY WritePolicy,
- IN EFI_FV_WRITE_FILE_DATA *FileData
- )
-/*++
-
- Routine Description:
- Writes one or more files to the firmware volume.
-
- Arguments:
- This - Indicates the calling context.
- NumberOfFiles - Number of files.
- WritePolicy - WritePolicy indicates the level of reliability for
- the write in the event of a power failure or other
- system failure during the write operation.
- FileData - FileData is an pointer to an array of EFI_FV_WRITE_DATA.
- Each element of FileData[] represents a file to be written.
-
- Returns:
- EFI_SUCCESS - Files successfully written to firmware volume
- EFI_OUT_OF_RESOURCES - Not enough buffer to be allocated.
- EFI_DEVICE_ERROR - Device error.
- EFI_WRITE_PROTECTED - Write protected.
- EFI_NOT_FOUND - Not found.
- EFI_INVALID_PARAMETER - Invalid parameter.
- EFI_UNSUPPORTED - This function not supported.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
diff --git a/EdkModulePkg/Core/Dxe/FwVolBlock.h b/EdkModulePkg/Core/Dxe/FwVolBlock.h
deleted file mode 100644
index 2e76242..0000000
--- a/EdkModulePkg/Core/Dxe/FwVolBlock.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FwVolBlock.h
-
-Abstract:
-
- Firmware Volume Block protocol.. Consumes FV hobs and creates
- appropriate block protocols.
-
- Also consumes NT_NON_MM_FV envinronment variable and produces appropriate
- block protocols fro them also... (this is TBD)
-
---*/
-
-#ifndef _FWVOL_BLOCK_H_
-#define _FWVOL_BLOCK_H_
-
-
-#define FVB_DEVICE_SIGNATURE EFI_SIGNATURE_32('_','F','V','B')
-
-typedef struct {
- UINTN Base;
- UINTN Length;
-} LBA_CACHE;
-
-typedef struct {
- MEMMAP_DEVICE_PATH MemMapDevPath;
- EFI_DEVICE_PATH_PROTOCOL EndDevPath;
-} FV_DEVICE_PATH;
-
-
-typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle;
- FV_DEVICE_PATH DevicePath;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
- UINTN NumBlocks;
- LBA_CACHE *LbaCache;
- UINT32 FvbAttributes;
- EFI_PHYSICAL_ADDRESS BaseAddress;
-} EFI_FW_VOL_BLOCK_DEVICE;
-
-#define FVB_DEVICE_FROM_THIS(a) \
- CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
-
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockDriverInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This routine is the driver initialization entry point. It initializes the
- libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
- produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
-Arguments:
- ImageHandle - The image handle.
- SystemTable - The system table.
-Returns:
- EFI_SUCCESS - Successfully initialized firmware volume block driver.
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockGetAttributes (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- OUT EFI_FVB_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Retrieves Volume attributes. No polarity translations are done.
-
-Arguments:
- This - Calling context
- Attributes - output buffer which contains attributes
-
-Returns:
- EFI_SUCCESS - The firmware volume attributes were returned.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockSetAttributes (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- OUT EFI_FVB_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Modifies the current settings of the firmware volume according to the input parameter.
-
-Arguments:
- This - Calling context
- Attributes - input buffer which contains attributes
-
-Returns:
- EFI_SUCCESS - The firmware volume attributes were returned.
- EFI_INVALID_PARAMETER - The attributes requested are in conflict with the capabilities as
- declared in the firmware volume header.
- EFI_UNSUPPORTED - Not supported.
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockEraseBlock (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- ...
- )
-/*++
-
-Routine Description:
- The EraseBlock() function erases one or more blocks as denoted by the
-variable argument list. The entire parameter list of blocks must be verified
-prior to erasing any blocks. If a block is requested that does not exist
-within the associated firmware volume (it has a larger index than the last
-block of the firmware volume), the EraseBlock() function must return
-EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
-
-Arguments:
- This - Calling context
- ... - Starting LBA followed by Number of Lba to erase. a -1 to terminate
- the list.
-
-Returns:
- EFI_SUCCESS - The erase request was successfully completed.
- EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state.
- EFI_DEVICE_ERROR - The block device is not functioning correctly and could not be
- written. The firmware device may have been partially erased.
- EFI_INVALID_PARAMETER - One or more of the LBAs listed in the variable argument list do
- EFI_UNSUPPORTED - Not supported.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockReadBlock (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
- Read the specified number of bytes from the block to the input buffer.
-
-Arguments:
- This - Indicates the calling context.
- Lba - The starting logical block index to read.
- Offset - Offset into the block at which to begin reading.
- NumBytes - Pointer to a UINT32. At entry, *NumBytes contains the
- total size of the buffer. At exit, *NumBytes contains the
- total number of bytes actually read.
- Buffer - Pinter to a caller-allocated buffer that contains the destine
- for the read.
-
-Returns:
- EFI_SUCCESS - The firmware volume was read successfully.
- EFI_BAD_BUFFER_SIZE - The read was attempted across an LBA boundary.
- EFI_ACCESS_DENIED - Access denied.
- EFI_DEVICE_ERROR - The block device is malfunctioning and could not be read.
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockWriteBlock (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
- Writes the specified number of bytes from the input buffer to the block.
-
-Arguments:
- This - Indicates the calling context.
- Lba - The starting logical block index to write to.
- Offset - Offset into the block at which to begin writing.
- NumBytes - Pointer to a UINT32. At entry, *NumBytes contains the
- total size of the buffer. At exit, *NumBytes contains the
- total number of bytes actually written.
- Buffer - Pinter to a caller-allocated buffer that contains the source
- for the write.
-
-Returns:
- EFI_SUCCESS - The firmware volume was written successfully.
- EFI_BAD_BUFFER_SIZE - The write was attempted across an LBA boundary. On output,
- NumBytes contains the total number of bytes actually written.
- EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state.
- EFI_DEVICE_ERROR - The block device is malfunctioning and could not be written.
- EFI_UNSUPPORTED - Not supported.
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockGetPhysicalAddress (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- OUT EFI_PHYSICAL_ADDRESS *Address
- )
-/*++
-
-Routine Description:
- Get Fvb's base address.
-
-Arguments:
- This - Indicates the calling context.
- Address - Fvb device base address.
-
-Returns:
- EFI_SUCCESS - Successfully got Fvb's base address.
- EFI_UNSUPPORTED - Not supported.
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockGetBlockSize (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumberOfBlocks
- )
-/*++
-
-Routine Description:
- Retrieves the size in bytes of a specific block within a firmware volume.
-
-Arguments:
- This - Indicates the calling context.
- Lba - Indicates the block for which to return the size.
- BlockSize - Pointer to a caller-allocated UINTN in which the size of the
- block is returned.
- NumberOfBlocks - Pointer to a caller-allocated UINTN in which the number of
- consecutive blocks starting with Lba is returned. All blocks
- in this range have a size of BlockSize.
-Returns:
- EFI_SUCCESS - The firmware volume base address is returned.
- EFI_INVALID_PARAMETER - The requested LBA is out of range.
---*/
-;
-EFI_STATUS
-FwVolBlockDriverInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This routine is the driver initialization entry point. It initializes the
- libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
- produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
-Arguments:
- ImageHandle - The image handle.
- SystemTable - The system table.
-Returns:
- Status code
-
---*/
-;
-
-EFI_STATUS
-ProduceFVBProtocolOnBuffer (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_HANDLE ParentHandle,
- OUT EFI_HANDLE *FvProtocolHandle OPTIONAL
- )
-/*++
-
-Routine Description:
- This routine produces a firmware volume block protocol on a given
- buffer.
-
-Arguments:
- BaseAddress - base address of the firmware volume image
- Length - length of the firmware volume image
- ParentHandle - handle of parent firmware volume, if this
- image came from an FV image file in another
- firmware volume (ala capsules)
- FvProtocolHandle - Firmware volume block protocol produced.
-
-Returns:
- EFI_VOLUME_CORRUPTED - Volume corrupted.
- EFI_OUT_OF_RESOURCES - No enough buffer to be allocated.
- EFI_SUCCESS - Successfully produced a FVB protocol on given buffer.
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c b/EdkModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
deleted file mode 100644
index 49f197f..0000000
--- a/EdkModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
+++ /dev/null
@@ -1,598 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FwVolBlock.c
-
-Abstract:
-
- Firmware Volume Block protocol.. Consumes FV hobs and creates
- appropriate block protocols.
-
- Also consumes NT_NON_MM_FV envinronment variable and produces appropriate
- block protocols fro them also... (this is TBD)
-
---*/
-
-#include <DxeMain.h>
-
-
-EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = {
- FVB_DEVICE_SIGNATURE,
- NULL,
- {
- {
- {
- HARDWARE_DEVICE_PATH,
- HW_MEMMAP_DP,
- { (UINT8)(sizeof (MEMMAP_DEVICE_PATH)), (UINT8)(sizeof (MEMMAP_DEVICE_PATH) >> 8) }
- },
- EfiMemoryMappedIO,
- (EFI_PHYSICAL_ADDRESS)0,
- (EFI_PHYSICAL_ADDRESS)0,
- },
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- { END_DEVICE_PATH_LENGTH, 0 }
- },
- },
- {
- FwVolBlockGetAttributes,
- (EFI_FVB_SET_ATTRIBUTES)FwVolBlockSetAttributes,
- FwVolBlockGetPhysicalAddress,
- FwVolBlockGetBlockSize,
- FwVolBlockReadBlock,
- (EFI_FVB_WRITE)FwVolBlockWriteBlock,
- (EFI_FVB_ERASE_BLOCKS)FwVolBlockEraseBlock,
- NULL
- },
- 0,
- NULL,
- 0,
- 0
-};
-
-
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockGetAttributes (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- OUT EFI_FVB_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Retrieves Volume attributes. No polarity translations are done.
-
-Arguments:
- This - Calling context
- Attributes - output buffer which contains attributes
-
-Returns:
- EFI_SUCCESS - The firmware volume attributes were returned.
-
---*/
-{
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- //
- // Since we are read only, it's safe to get attributes data from our in-memory copy.
- //
- *Attributes = FvbDevice->FvbAttributes;
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockSetAttributes (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_FVB_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Modifies the current settings of the firmware volume according to the input parameter.
-
-Arguments:
- This - Calling context
- Attributes - input buffer which contains attributes
-
-Returns:
- EFI_SUCCESS - The firmware volume attributes were returned.
- EFI_INVALID_PARAMETER - The attributes requested are in conflict with the capabilities as
- declared in the firmware volume header.
- EFI_UNSUPPORTED - Not supported.
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockEraseBlock (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- ...
- )
-/*++
-
-Routine Description:
- The EraseBlock() function erases one or more blocks as denoted by the
-variable argument list. The entire parameter list of blocks must be verified
-prior to erasing any blocks. If a block is requested that does not exist
-within the associated firmware volume (it has a larger index than the last
-block of the firmware volume), the EraseBlock() function must return
-EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.
-
-Arguments:
- This - Calling context
- ... - Starting LBA followed by Number of Lba to erase. a -1 to terminate
- the list.
-
-Returns:
- EFI_SUCCESS - The erase request was successfully completed.
- EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state.
- EFI_DEVICE_ERROR - The block device is not functioning correctly and could not be
- written. The firmware device may have been partially erased.
- EFI_INVALID_PARAMETER - One or more of the LBAs listed in the variable argument list do
- EFI_UNSUPPORTED - Not supported.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockReadBlock (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
- Read the specified number of bytes from the block to the input buffer.
-
-Arguments:
- This - Indicates the calling context.
- Lba - The starting logical block index to read.
- Offset - Offset into the block at which to begin reading.
- NumBytes - Pointer to a UINT32. At entry, *NumBytes contains the
- total size of the buffer. At exit, *NumBytes contains the
- total number of bytes actually read.
- Buffer - Pinter to a caller-allocated buffer that contains the destine
- for the read.
-
-Returns:
- EFI_SUCCESS - The firmware volume was read successfully.
- EFI_BAD_BUFFER_SIZE - The read was attempted across an LBA boundary.
- EFI_ACCESS_DENIED - Access denied.
- EFI_DEVICE_ERROR - The block device is malfunctioning and could not be read.
---*/
-{
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- UINT8 *LbaOffset;
- UINTN LbaStart;
- UINTN NumOfBytesRead;
- UINTN LbaIndex;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- //
- // Check if This FW can be read
- //
- if ((FvbDevice->FvbAttributes & EFI_FVB_READ_STATUS) == 0) {
- return EFI_ACCESS_DENIED;
- }
-
- LbaIndex = (UINTN)Lba;
- if (LbaIndex >= FvbDevice->NumBlocks) {
- //
- // Invalid Lba, read nothing.
- //
- *NumBytes = 0;
- return EFI_BAD_BUFFER_SIZE;
- }
-
- if (Offset > FvbDevice->LbaCache[LbaIndex].Length) {
- //
- // all exceed boundry, read nothing.
- //
- *NumBytes = 0;
- return EFI_BAD_BUFFER_SIZE;
- }
-
- NumOfBytesRead = *NumBytes;
- if (Offset + NumOfBytesRead > FvbDevice->LbaCache[LbaIndex].Length) {
- //
- // partial exceed boundry, read data from current postion to end.
- //
- NumOfBytesRead = FvbDevice->LbaCache[LbaIndex].Length - Offset;
- }
-
- LbaStart = FvbDevice->LbaCache[LbaIndex].Base;
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN)FvbDevice->BaseAddress);
- LbaOffset = (UINT8 *)FwVolHeader + LbaStart + Offset;
-
- //
- // Perform read operation
- //
- CopyMem (Buffer, LbaOffset, NumOfBytesRead);
-
- if (NumOfBytesRead == *NumBytes) {
- return EFI_SUCCESS;
- }
-
- *NumBytes = NumOfBytesRead;
- return EFI_BAD_BUFFER_SIZE;
-}
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockWriteBlock (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
- Writes the specified number of bytes from the input buffer to the block.
-
-Arguments:
- This - Indicates the calling context.
- Lba - The starting logical block index to write to.
- Offset - Offset into the block at which to begin writing.
- NumBytes - Pointer to a UINT32. At entry, *NumBytes contains the
- total size of the buffer. At exit, *NumBytes contains the
- total number of bytes actually written.
- Buffer - Pinter to a caller-allocated buffer that contains the source
- for the write.
-
-Returns:
- EFI_SUCCESS - The firmware volume was written successfully.
- EFI_BAD_BUFFER_SIZE - The write was attempted across an LBA boundary. On output,
- NumBytes contains the total number of bytes actually written.
- EFI_ACCESS_DENIED - The firmware volume is in the WriteDisabled state.
- EFI_DEVICE_ERROR - The block device is malfunctioning and could not be written.
- EFI_UNSUPPORTED - Not supported.
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockGetPhysicalAddress (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- OUT EFI_PHYSICAL_ADDRESS *Address
- )
-/*++
-
-Routine Description:
- Get Fvb's base address.
-
-Arguments:
- This - Indicates the calling context.
- Address - Fvb device base address.
-
-Returns:
- EFI_SUCCESS - Successfully got Fvb's base address.
- EFI_UNSUPPORTED - Not supported.
---*/
-{
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- if (FvbDevice->FvbAttributes & EFI_FVB_MEMORY_MAPPED) {
- *Address = FvbDevice->BaseAddress;
- return EFI_SUCCESS;
- }
-
- return EFI_UNSUPPORTED;
-}
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockGetBlockSize (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumberOfBlocks
- )
-/*++
-
-Routine Description:
- Retrieves the size in bytes of a specific block within a firmware volume.
-
-Arguments:
- This - Indicates the calling context.
- Lba - Indicates the block for which to return the size.
- BlockSize - Pointer to a caller-allocated UINTN in which the size of the
- block is returned.
- NumberOfBlocks - Pointer to a caller-allocated UINTN in which the number of
- consecutive blocks starting with Lba is returned. All blocks
- in this range have a size of BlockSize.
-Returns:
- EFI_SUCCESS - The firmware volume base address is returned.
- EFI_INVALID_PARAMETER - The requested LBA is out of range.
---*/
-{
- UINTN TotalBlocks;
- EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
- EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
-
- FvbDevice = FVB_DEVICE_FROM_THIS (This);
-
- //
- // Do parameter checking
- //
- if (Lba >= FvbDevice->NumBlocks) {
- return EFI_INVALID_PARAMETER;
- }
-
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN)FvbDevice->BaseAddress);
-
- PtrBlockMapEntry = FwVolHeader->FvBlockMap;
-
- //
- // Search the block map for the given block
- //
- TotalBlocks = 0;
- while ((PtrBlockMapEntry->NumBlocks != 0) || (PtrBlockMapEntry->BlockLength !=0 )) {
- TotalBlocks += PtrBlockMapEntry->NumBlocks;
- if (Lba < TotalBlocks) {
- //
- // We find the range
- //
- break;
- }
-
- PtrBlockMapEntry++;
- }
-
- *BlockSize = PtrBlockMapEntry->BlockLength;
- *NumberOfBlocks = TotalBlocks - (UINTN)Lba;
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-ProduceFVBProtocolOnBuffer (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_HANDLE ParentHandle,
- OUT EFI_HANDLE *FvProtocol OPTIONAL
- )
-/*++
-
-Routine Description:
- This routine produces a firmware volume block protocol on a given
- buffer.
-
-Arguments:
- BaseAddress - base address of the firmware volume image
- Length - length of the firmware volume image
- ParentHandle - handle of parent firmware volume, if this
- image came from an FV image file in another
- firmware volume (ala capsules)
- FvProtocol - Firmware volume block protocol produced.
-
-Returns:
- EFI_VOLUME_CORRUPTED - Volume corrupted.
- EFI_OUT_OF_RESOURCES - No enough buffer to be allocated.
- EFI_SUCCESS - Successfully produced a FVB protocol on given buffer.
-
---*/
-{
- EFI_STATUS Status;
- EFI_FW_VOL_BLOCK_DEVICE *FvbDev;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- UINTN BlockIndex;
- UINTN BlockIndex2;
- UINTN LinearOffset;
- EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
-
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)BaseAddress;
- //
- // Validate FV Header, if not as expected, return
- //
- if (FwVolHeader->Signature != EFI_FVH_SIGNATURE) {
- return EFI_VOLUME_CORRUPTED;
- }
- //
- // Allocate EFI_FW_VOL_BLOCK_DEVICE
- //
- FvbDev = CoreAllocateCopyPool (sizeof (EFI_FW_VOL_BLOCK_DEVICE), &mFwVolBlock);
- if (FvbDev == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- FvbDev->BaseAddress = BaseAddress;
- FvbDev->FvbAttributes = FwVolHeader->Attributes;
- FvbDev->FwVolBlockInstance.ParentHandle = ParentHandle;
-
- //
- // Init the block caching fields of the device
- // First, count the number of blocks
- //
- FvbDev->NumBlocks = 0;
- for (PtrBlockMapEntry = FwVolHeader->FvBlockMap;
- PtrBlockMapEntry->NumBlocks != 0;
- PtrBlockMapEntry++) {
- FvbDev->NumBlocks += PtrBlockMapEntry->NumBlocks;
- }
- //
- // Second, allocate the cache
- //
- FvbDev->LbaCache = CoreAllocateBootServicesPool (FvbDev->NumBlocks * sizeof (LBA_CACHE));
- if (FvbDev->LbaCache == NULL) {
- CoreFreePool (FvbDev);
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Last, fill in the cache with the linear address of the blocks
- //
- BlockIndex = 0;
- LinearOffset = 0;
- for (PtrBlockMapEntry = FwVolHeader->FvBlockMap;
- PtrBlockMapEntry->NumBlocks != 0; PtrBlockMapEntry++) {
- for (BlockIndex2 = 0; BlockIndex2 < PtrBlockMapEntry->NumBlocks; BlockIndex2++) {
- FvbDev->LbaCache[BlockIndex].Base = LinearOffset;
- FvbDev->LbaCache[BlockIndex].Length = PtrBlockMapEntry->BlockLength;
- LinearOffset += PtrBlockMapEntry->BlockLength;
- BlockIndex++;
- }
- }
-
- //
- // Set up the devicepath
- //
- FvbDev->DevicePath.MemMapDevPath.StartingAddress = BaseAddress;
- FvbDev->DevicePath.MemMapDevPath.EndingAddress = BaseAddress + FwVolHeader->FvLength - 1;
-
- //
- //
- // Attach FvVolBlock Protocol to new handle
- //
- Status = CoreInstallMultipleProtocolInterfaces (
- &FvbDev->Handle,
- &gEfiFirmwareVolumeBlockProtocolGuid, &FvbDev->FwVolBlockInstance,
- &gEfiDevicePathProtocolGuid, &FvbDev->DevicePath,
- &gEfiFirmwareVolumeDispatchProtocolGuid, NULL,
- NULL
- );
-
- //
- // If they want the handle back, set it.
- //
- if (FvProtocol != NULL) {
- *FvProtocol = FvbDev->Handle;
- }
-
- return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-FwVolBlockDriverInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This routine is the driver initialization entry point. It initializes the
- libraries, consumes FV hobs and NT_NON_MM_FV environment variable and
- produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
-Arguments:
- ImageHandle - The image handle.
- SystemTable - The system table.
-Returns:
- EFI_SUCCESS - Successfully initialized firmware volume block driver.
---*/
-{
- EFI_PEI_HOB_POINTERS FvHob;
- //
- // Core Needs Firmware Volumes to function
- //
- FvHob.Raw = GetHobList ();
- while ((FvHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, FvHob.Raw)) != NULL) {
- //
- // Produce an FVB protocol for it
- //
- ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.FirmwareVolume->Length, NULL, NULL);
- FvHob.Raw = GET_NEXT_HOB (FvHob);
- }
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CoreProcessFirmwareVolume (
- IN VOID *FvHeader,
- IN UINTN Size,
- OUT EFI_HANDLE *FVProtocolHandle
- )
-/*++
-
-Routine Description:
- This DXE service routine is used to process a firmware volume. In
- particular, it can be called by BDS to process a single firmware
- volume found in a capsule.
-
-Arguments:
- FvHeader - pointer to a firmware volume header
- Size - the size of the buffer pointed to by FvHeader
- FVProtocolHandle - the handle on which a firmware volume protocol
- was produced for the firmware volume passed in.
-
-Returns:
- EFI_OUT_OF_RESOURCES - if an FVB could not be produced due to lack of
- system resources
- EFI_VOLUME_CORRUPTED - if the volume was corrupted
- EFI_SUCCESS - a firmware volume protocol was produced for the
- firmware volume
-
---*/
-{
- VOID *Ptr;
- EFI_STATUS Status;
-
- *FVProtocolHandle = NULL;
- Status = ProduceFVBProtocolOnBuffer (
- (EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader,
- (UINT64)Size,
- NULL,
- FVProtocolHandle
- );
- //
- // Since in our implementation we use register-protocol-notify to put a
- // FV protocol on the FVB protocol handle, we can't directly verify that
- // the FV protocol was produced. Therefore here we will check the handle
- // and make sure an FV protocol is on it. This indicates that all went
- // well. Otherwise we have to assume that the volume was corrupted
- // somehow.
- //
- if (!EFI_ERROR(Status)) {
- Ptr = NULL;
- Status = CoreHandleProtocol (*FVProtocolHandle, &gEfiFirmwareVolumeProtocolGuid, (VOID **)&Ptr);
- if (EFI_ERROR(Status) || (Ptr == NULL)) {
- return EFI_VOLUME_CORRUPTED;
- }
- return EFI_SUCCESS;
- }
- return Status;
-}
-
-
diff --git a/EdkModulePkg/Core/Dxe/FwVolDriver.h b/EdkModulePkg/Core/Dxe/FwVolDriver.h
deleted file mode 100644
index fb4e0d5..0000000
--- a/EdkModulePkg/Core/Dxe/FwVolDriver.h
+++ /dev/null
@@ -1,466 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FwVolDriver.h
-
-Abstract:
-
- Firmware File System protocol. Layers on top of Firmware
- Block protocol to produce a file abstraction of FV based files.
-
---*/
-
-#ifndef __FWVOL_H
-#define __FWVOL_H
-
-
-//
-// Used to track all non-deleted files
-//
-typedef struct {
- LIST_ENTRY Link;
- EFI_FFS_FILE_HEADER *FfsHeader;
- UINTN StreamHandle;
- EFI_SECTION_EXTRACTION_PROTOCOL *Sep;
-} FFS_FILE_LIST_ENTRY;
-
-typedef struct {
- UINTN Signature;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_HANDLE Handle;
- EFI_FIRMWARE_VOLUME_PROTOCOL Fv;
-
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- UINT8 *CachedFv;
- UINT8 *EndOfCachedFv;
-
- FFS_FILE_LIST_ENTRY *LastKey;
-
- LIST_ENTRY FfsFileListHeader;
-
- UINT8 ErasePolarity;
-} FV_DEVICE;
-
-#define FV_DEVICE_FROM_THIS(a) CR(a, FV_DEVICE, Fv, FV_DEVICE_SIGNATURE)
-
-
-EFI_STATUS
-EFIAPI
-FvGetVolumeAttributes (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- OUT EFI_FV_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter
-
-Arguments:
- This - Calling context
- Attributes - output buffer which contains attributes
-
-Returns:
- EFI_SUCCESS - Successfully got volume attributes
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-FvSetVolumeAttributes (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN OUT EFI_FV_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Sets current attributes for volume
-
-Arguments:
- This - Calling context
- Attributes - At input, contains attributes to be set. At output contains
- new value of FV
-
-Returns:
- EFI_UNSUPPORTED - Could not be set.
---*/
-;
-
-EFI_STATUS
-EFIAPI
-FvGetNextFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN OUT VOID *Key,
- IN OUT EFI_FV_FILETYPE *FileType,
- OUT EFI_GUID *NameGuid,
- OUT EFI_FV_FILE_ATTRIBUTES *Attributes,
- OUT UINTN *Size
- )
-/*++
-
-Routine Description:
- Given the input key, search for the next matching file in the volume.
-
-Arguments:
- This - Indicates the calling context.
- FileType - FileType is a pointer to a caller allocated
- EFI_FV_FILETYPE. The GetNextFile() API can filter it's
- search for files based on the value of *FileType input.
- A *FileType input of 0 causes GetNextFile() to search for
- files of all types. If a file is found, the file's type
- is returned in *FileType. *FileType is not modified if
- no file is found.
- Key - Key is a pointer to a caller allocated buffer that
- contains implementation specific data that is used to
- track where to begin the search for the next file.
- The size of the buffer must be at least This->KeySize
- bytes long. To reinitialize the search and begin from
- the beginning of the firmware volume, the entire buffer
- must be cleared to zero. Other than clearing the buffer
- to initiate a new search, the caller must not modify the
- data in the buffer between calls to GetNextFile().
- NameGuid - NameGuid is a pointer to a caller allocated EFI_GUID.
- If a file is found, the file's name is returned in
- *NameGuid. *NameGuid is not modified if no file is
- found.
- Attributes - Attributes is a pointer to a caller allocated
- EFI_FV_FILE_ATTRIBUTES. If a file is found, the file's
- attributes are returned in *Attributes. *Attributes is
- not modified if no file is found.
- Size - Size is a pointer to a caller allocated UINTN.
- If a file is found, the file's size is returned in *Size.
- *Size is not modified if no file is found.
-
-Returns:
- EFI_SUCCESS - Successfully find the file.
- EFI_DEVICE_ERROR - Device error.
- EFI_ACCESS_DENIED - Fv could not read.
- EFI_NOT_FOUND - No matching file found.
- EFI_INVALID_PARAMETER - Invalid parameter
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-FvReadFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN EFI_GUID *NameGuid,
- IN OUT VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT EFI_FV_FILETYPE *FoundType,
- OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,
- OUT UINT32 *AuthenticationStatus
- )
-/*++
-
-Routine Description:
- Locates a file in the firmware volume and
- copies it to the supplied buffer.
-
-Arguments:
- This - Indicates the calling context.
- NameGuid - Pointer to an EFI_GUID, which is the filename.
- Buffer - Buffer is a pointer to pointer to a buffer in
- which the file or section contents or are returned.
- BufferSize - BufferSize is a pointer to caller allocated
- UINTN. On input *BufferSize indicates the size
- in bytes of the memory region pointed to by
- Buffer. On output, *BufferSize contains the number
- of bytes required to read the file.
- FoundType - FoundType is a pointer to a caller allocated
- EFI_FV_FILETYPE that on successful return from Read()
- contains the type of file read. This output reflects
- the file type irrespective of the value of the
- SectionType input.
- FileAttributes - FileAttributes is a pointer to a caller allocated
- EFI_FV_FILE_ATTRIBUTES. On successful return from
- Read(), *FileAttributes contains the attributes of
- the file read.
- AuthenticationStatus - AuthenticationStatus is a pointer to a caller
- allocated UINTN in which the authentication status
- is returned.
-Returns:
- EFI_SUCCESS - Successfully read to memory buffer.
- EFI_WARN_BUFFER_TOO_SMALL - Buffer too small.
- EFI_NOT_FOUND - Not found.
- EFI_DEVICE_ERROR - Device error.
- EFI_ACCESS_DENIED - Could not read.
- EFI_INVALID_PARAMETER - Invalid parameter.
- EFI_OUT_OF_RESOURCES - Not enough buffer to be allocated.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-FvReadFileSection (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN EFI_GUID *NameGuid,
- IN EFI_SECTION_TYPE SectionType,
- IN UINTN SectionInstance,
- IN OUT VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT UINT32 *AuthenticationStatus
- )
-/*++
-
- Routine Description:
- Locates a section in a given FFS File and
- copies it to the supplied buffer (not including section header).
-
- Arguments:
- This - Indicates the calling context.
- NameGuid - Pointer to an EFI_GUID, which is the filename.
- SectionType - Indicates the section type to return.
- SectionInstance - Indicates which instance of sections with a type of
- SectionType to return.
- Buffer - Buffer is a pointer to pointer to a buffer in which
- the file or section contents or are returned.
- BufferSize - BufferSize is a pointer to caller allocated UINTN.
- AuthenticationStatus -AuthenticationStatus is a pointer to a caller
- allocated UINT32 in which the authentication status
- is returned.
-
- Returns:
- EFI_SUCCESS - Successfully read the file section into buffer.
- EFI_WARN_BUFFER_TOO_SMALL - Buffer too small.
- EFI_NOT_FOUND - Section not found.
- EFI_DEVICE_ERROR - Device error.
- EFI_ACCESS_DENIED - Could not read.
- EFI_INVALID_PARAMETER - Invalid parameter.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-FvWriteFile (
- IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
- IN UINT32 NumberOfFiles,
- IN EFI_FV_WRITE_POLICY WritePolicy,
- IN EFI_FV_WRITE_FILE_DATA *FileData
- )
-/*++
-
- Routine Description:
- Writes one or more files to the firmware volume.
-
- Arguments:
- This - Indicates the calling context.
- WritePolicy - WritePolicy indicates the level of reliability for
- the write in the event of a power failure or other
- system failure during the write operation.
- FileData - FileData is an pointer to an array of EFI_FV_WRITE_DATA.
- Each element of FileData[] represents a file to be written.
-
- Returns:
- EFI_SUCCESS - Files successfully written to firmware volume
- EFI_OUT_OF_RESOURCES - Not enough buffer to be allocated.
- EFI_DEVICE_ERROR - Device error.
- EFI_WRITE_PROTECTED - Write protected.
- EFI_NOT_FOUND - Not found.
- EFI_INVALID_PARAMETER - Invalid parameter.
- EFI_UNSUPPORTED - This function not supported.
-
---*/
-;
-
-
-
-//
-//Internal functions
-//
-typedef enum {
- EfiCheckSumUint8 = 0,
- EfiCheckSumUint16 = 1,
- EfiCheckSumUint32 = 2,
- EfiCheckSumUint64 = 3,
- EfiCheckSumMaximum = 4
-} EFI_CHECKSUM_TYPE;
-
-
-BOOLEAN
-IsBufferErased (
- IN UINT8 ErasePolarity,
- IN VOID *Buffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
- Check if a block of buffer is erased
-
-Arguments:
- ErasePolarity - Erase polarity attribute of the firmware volume
- Buffer - The buffer to be checked
- BufferSize - Size of the buffer in bytes
-
-Returns:
- TRUE - The block of buffer is erased
- FALSE - The block of buffer is not erased
-
---*/
-;
-
-EFI_FFS_FILE_STATE
-GetFileState (
- IN UINT8 ErasePolarity,
- IN EFI_FFS_FILE_HEADER *FfsHeader
- )
-/*++
-
-Routine Description:
- Get the FFS file state by checking the highest bit set in the header's state field
-
-Arguments:
- ErasePolarity - Erase polarity attribute of the firmware volume
- FfsHeader - Points to the FFS file header
-
-Returns:
- FFS File state
-
---*/
-;
-
-VOID
-SetFileState (
- IN UINT8 State,
- IN EFI_FFS_FILE_HEADER *FfsHeader
- )
-/*++
-
-Routine Description:
- Set the FFS file state.
-
-Arguments:
- State - The state to be set.
- FfsHeader - Points to the FFS file header
-
-Returns:
- None.
-
---*/
-;
-
-BOOLEAN
-VerifyFvHeaderChecksum (
- IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader
- )
-/*++
-
-Routine Description:
- Verify checksum of the firmware volume header
-
-Arguments:
- FvHeader - Points to the firmware volume header to be checked
-
-Returns:
- TRUE - Checksum verification passed
- FALSE - Checksum verification failed
-
---*/
-;
-
-BOOLEAN
-IsValidFfsHeader (
- IN UINT8 ErasePolarity,
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- OUT EFI_FFS_FILE_STATE *FileState
- )
-/*++
-
-Routine Description:
- Check if it's a valid FFS file header
-
-Arguments:
- ErasePolarity - Erase polarity attribute of the firmware volume
- FfsHeader - Points to the FFS file header to be checked
- FileState - FFS file state to be returned
-
-Returns:
- TRUE - Valid FFS file header
- FALSE - Invalid FFS file header
-
---*/
-;
-
-BOOLEAN
-IsValidFfsFile (
- IN UINT8 ErasePolarity,
- IN EFI_FFS_FILE_HEADER *FfsHeader
- )
-/*++
-
-Routine Description:
- Check if it's a valid FFS file.
- Here we are sure that it has a valid FFS file header since we must call IsValidFfsHeader() first.
-
-Arguments:
- ErasePolarity - Erase polarity attribute of the firmware volume
- FfsHeader - Points to the FFS file to be checked
-
-Returns:
- TRUE - Valid FFS file
- FALSE - Invalid FFS file
-
---*/
-;
-
-EFI_STATUS
-GetFwVolHeader (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,
- OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
- )
-/*++
-
-Routine Description:
- given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
- copy the volume header into it.
-
-Arguments:
- Fvb - The FW_VOL_BLOCK_PROTOCOL instance from which to read the volume
- header
- FwVolHeader - Pointer to pointer to allocated buffer in which the volume
- header is returned.
-
-Returns:
- Status code.
-
---*/
-;
-
-
-EFI_STATUS
-FvCheck (
- IN OUT FV_DEVICE *FvDevice
- )
-/*++
-
-Routine Description:
- Check if a FV is consistent and allocate cache
-
-Arguments:
- FvDevice - pointer to the FvDevice to be checked.
-
-Returns:
- EFI_OUT_OF_RESOURCES - Not enough buffer to be allocated.
- EFI_SUCCESS - FV is consistent and cache is allocated.
- EFI_VOLUME_CORRUPTED - File system is corrupted.
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Core/Dxe/Gcd/gcd.c b/EdkModulePkg/Core/Dxe/Gcd/gcd.c
deleted file mode 100644
index 4d58687..0000000
--- a/EdkModulePkg/Core/Dxe/Gcd/gcd.c
+++ /dev/null
@@ -1,2496 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- gcd.c
-
-Abstract:
- The file contains the GCD related services in the EFI Boot Services Table.
- The GCD services are used to manage the memory and I/O regions that
- are accessible to the CPU that is executing the DXE core.
-
---*/
-
-#include <DxeMain.h>
-
-#define MINIMUM_INITIAL_MEMORY_SIZE 0x10000
-
-#define MEMORY_ATTRIBUTE_MASK (EFI_RESOURCE_ATTRIBUTE_PRESENT | \
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \
- EFI_RESOURCE_ATTRIBUTE_TESTED | \
- EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED | \
- EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED | \
- EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED | \
- EFI_RESOURCE_ATTRIBUTE_16_BIT_IO | \
- EFI_RESOURCE_ATTRIBUTE_32_BIT_IO | \
- EFI_RESOURCE_ATTRIBUTE_64_BIT_IO )
-
-#define TESTED_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT | \
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED | \
- EFI_RESOURCE_ATTRIBUTE_TESTED )
-
-#define INITIALIZED_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT | \
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED )
-
-#define PRESENT_MEMORY_ATTRIBUTES (EFI_RESOURCE_ATTRIBUTE_PRESENT)
-
-#define INVALID_CPU_ARCH_ATTRIBUTES 0xffffffff
-
-//
-// Module Variables
-//
-EFI_LOCK mGcdMemorySpaceLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);
-EFI_LOCK mGcdIoSpaceLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);
-LIST_ENTRY mGcdMemorySpaceMap = INITIALIZE_LIST_HEAD_VARIABLE (mGcdMemorySpaceMap);
-LIST_ENTRY mGcdIoSpaceMap = INITIALIZE_LIST_HEAD_VARIABLE (mGcdIoSpaceMap);
-
-EFI_GCD_MAP_ENTRY mGcdMemorySpaceMapEntryTemplate = {
- EFI_GCD_MAP_SIGNATURE,
- { NULL, NULL },
- 0,
- 0,
- 0,
- 0,
- EfiGcdMemoryTypeNonExistent,
- (EFI_GCD_IO_TYPE) 0,
- NULL,
- NULL
-};
-
-EFI_GCD_MAP_ENTRY mGcdIoSpaceMapEntryTemplate = {
- EFI_GCD_MAP_SIGNATURE,
- { NULL, NULL },
- 0,
- 0,
- 0,
- 0,
- (EFI_GCD_MEMORY_TYPE) 0,
- EfiGcdIoTypeNonExistent,
- NULL,
- NULL
-};
-
-GCD_ATTRIBUTE_CONVERSION_ENTRY mAttributeConversionTable[] = {
- { EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE, EFI_MEMORY_UC, TRUE },
- { EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED, EFI_MEMORY_UCE, TRUE },
- { EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE, EFI_MEMORY_WC, TRUE },
- { EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE, EFI_MEMORY_WT, TRUE },
- { EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE, EFI_MEMORY_WB, TRUE },
- { EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED, EFI_MEMORY_RP, TRUE },
- { EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED, EFI_MEMORY_WP, TRUE },
- { EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED, EFI_MEMORY_XP, TRUE },
- { EFI_RESOURCE_ATTRIBUTE_PRESENT, EFI_MEMORY_PRESENT, FALSE },
- { EFI_RESOURCE_ATTRIBUTE_INITIALIZED, EFI_MEMORY_INITIALIZED, FALSE },
- { EFI_RESOURCE_ATTRIBUTE_TESTED, EFI_MEMORY_TESTED, FALSE },
- { 0, 0, FALSE }
-};
-
-VOID
-CoreAcquireGcdMemoryLock (
- VOID
- )
-/*++
-
-Routine Description:
- Acquire memory lock on mGcdMemorySpaceLock
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- CoreAcquireLock (&mGcdMemorySpaceLock);
-}
-
-
-VOID
-CoreReleaseGcdMemoryLock (
- VOID
- )
-/*++
-
-Routine Description:
- Release memory lock on mGcdMemorySpaceLock
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- CoreReleaseLock (&mGcdMemorySpaceLock);
-}
-
-
-STATIC
-VOID
-CoreAcquireGcdIoLock (
- VOID
- )
-/*++
-
-Routine Description:
- Acquire memory lock on mGcdIoSpaceLock
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- CoreAcquireLock (&mGcdIoSpaceLock);
-}
-
-STATIC
-VOID
-CoreReleaseGcdIoLock (
- VOID
- )
-/*++
-
-Routine Description:
- Release memory lock on mGcdIoSpaceLock
-
-Arguments:
- None
-
-Returns:
- None
-
---*/
-{
- CoreReleaseLock (&mGcdIoSpaceLock);
-}
-
-
-
-//
-// GCD Initialization Worker Functions
-//
-STATIC
-UINT64
-AlignValue (
- IN UINT64 Value,
- IN UINTN Alignment,
- IN BOOLEAN RoundUp
- )
-/*++
-
-Routine Description:
-
- Aligns a value to the specified boundary.
-
-Arguments:
-
- Value - 64 bit value to align
- Alignment - Log base 2 of the boundary to align Value to
- RoundUp - TRUE if Value is to be rounded up to the nearest aligned boundary.
- FALSE is Value is to be rounded down to the nearest aligned boundary.
-
-Returns:
-
- A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment.
-
---*/
-{
- UINT64 AlignmentMask;
-
- AlignmentMask = LShiftU64 (1, Alignment) - 1;
- if (RoundUp) {
- Value += AlignmentMask;
- }
- return Value & (~AlignmentMask);
-}
-
-STATIC
-UINT64
-PageAlignAddress (
- IN UINT64 Value
- )
-/*++
-
-Routine Description:
-
- Aligns address to the page boundary.
-
-Arguments:
-
- Value - 64 bit address to align
-
-Returns:
-
- A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment.
-
---*/
-{
- return AlignValue (Value, EFI_PAGE_SHIFT, TRUE);
-}
-
-STATIC
-UINT64
-PageAlignLength (
- IN UINT64 Value
- )
-/*++
-
-Routine Description:
-
- Aligns length to the page boundary.
-
-Arguments:
-
- Value - 64 bit length to align
-
-Returns:
-
- A 64 bit value is the aligned to the value nearest Value with an alignment by Alignment.
-
---*/
-{
- return AlignValue (Value, EFI_PAGE_SHIFT, FALSE);
-}
-
-//
-// GCD Memory Space Worker Functions
-//
-STATIC
-EFI_STATUS
-CoreAllocateGcdMapEntry (
- IN OUT EFI_GCD_MAP_ENTRY **TopEntry,
- IN OUT EFI_GCD_MAP_ENTRY **BottomEntry
- )
-/*++
-
-Routine Description:
-
- Allocate pool for two entries.
-
-Arguments:
-
- TopEntry - An entry of GCD map
- BottomEntry - An entry of GCD map
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to be allocated.
- EFI_SUCCESS - Both entries successfully allocated.
-
---*/
-{
- *TopEntry = CoreAllocateZeroBootServicesPool (sizeof (EFI_GCD_MAP_ENTRY));
- if (*TopEntry == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- *BottomEntry = CoreAllocateZeroBootServicesPool (sizeof (EFI_GCD_MAP_ENTRY));
- if (*BottomEntry == NULL) {
- CoreFreePool (*TopEntry);
- return EFI_OUT_OF_RESOURCES;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-CoreInsertGcdMapEntry (
- IN LIST_ENTRY *Link,
- IN EFI_GCD_MAP_ENTRY *Entry,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN EFI_GCD_MAP_ENTRY *TopEntry,
- IN EFI_GCD_MAP_ENTRY *BottomEntry
- )
-/*++
-
-Routine Description:
-
- Internal function. Inserts a new descriptor into a sorted list
-
-Arguments:
-
- Link - The linked list to insert the range BaseAddress and Length into
-
- Entry - A pointer to the entry that is inserted
-
- BaseAddress - The base address of the new range
-
- Length - The length of the new range in bytes
-
- TopEntry - Top pad entry to insert if needed.
-
- BottomEntry - Bottom pad entry to insert if needed.
-
-Returns:
-
- EFI_SUCCESS - The new range was inserted into the linked list
-
---*/
-{
- ASSERT (Length != 0);
- ASSERT (TopEntry->Signature == 0);
- ASSERT (BottomEntry->Signature == 0);
-
- if (BaseAddress > Entry->BaseAddress) {
- CopyMem (BottomEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));
- Entry->BaseAddress = BaseAddress;
- BottomEntry->EndAddress = BaseAddress - 1;
- InsertTailList (Link, &BottomEntry->Link);
- }
-
- if ((BaseAddress + Length - 1) < Entry->EndAddress) {
- CopyMem (TopEntry, Entry, sizeof (EFI_GCD_MAP_ENTRY));
- TopEntry->BaseAddress = BaseAddress + Length;
- Entry->EndAddress = BaseAddress + Length - 1;
- InsertHeadList (Link, &TopEntry->Link);
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-CoreMergeGcdMapEntry (
- IN LIST_ENTRY *Link,
- IN BOOLEAN Forward,
- IN LIST_ENTRY *Map
- )
-/*++
-
-Routine Description:
-
- Merge the Gcd region specified by Link and its adjacent entry
-
-Arguments:
-
- Link - Specify the entry to be merged (with its adjacent entry).
-
- Forward - Direction (forward or backward).
-
- Map - Boundary.
-
-Returns:
-
- EFI_SUCCESS - Successfully returned.
-
- EFI_UNSUPPORTED - These adjacent regions could not merge.
-
---*/
-{
- LIST_ENTRY *AdjacentLink;
- EFI_GCD_MAP_ENTRY *Entry;
- EFI_GCD_MAP_ENTRY *AdjacentEntry;
-
- //
- // Get adjacent entry
- //
- if (Forward) {
- AdjacentLink = Link->ForwardLink;
- } else {
- AdjacentLink = Link->BackLink;
- }
-
- //
- // If AdjacentLink is the head of the list, then no merge can be performed
- //
- if (AdjacentLink == Map) {
- return EFI_SUCCESS;
- }
-
- Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- AdjacentEntry = CR (AdjacentLink, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
-
- if (Entry->Capabilities != AdjacentEntry->Capabilities) {
- return EFI_UNSUPPORTED;
- }
- if (Entry->Attributes != AdjacentEntry->Attributes) {
- return EFI_UNSUPPORTED;
- }
- if (Entry->GcdMemoryType != AdjacentEntry->GcdMemoryType) {
- return EFI_UNSUPPORTED;
- }
- if (Entry->GcdIoType != AdjacentEntry->GcdIoType) {
- return EFI_UNSUPPORTED;
- }
- if (Entry->ImageHandle != AdjacentEntry->ImageHandle) {
- return EFI_UNSUPPORTED;
- }
- if (Entry->DeviceHandle != AdjacentEntry->DeviceHandle) {
- return EFI_UNSUPPORTED;
- }
-
- if (Forward) {
- Entry->EndAddress = AdjacentEntry->EndAddress;
- } else {
- Entry->BaseAddress = AdjacentEntry->BaseAddress;
- }
- RemoveEntryList (AdjacentLink);
- CoreFreePool (AdjacentEntry);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-CoreCleanupGcdMapEntry (
- IN EFI_GCD_MAP_ENTRY *TopEntry,
- IN EFI_GCD_MAP_ENTRY *BottomEntry,
- IN LIST_ENTRY *StartLink,
- IN LIST_ENTRY *EndLink,
- IN LIST_ENTRY *Map
- )
-/*++
-
-Routine Description:
-
- Merge adjacent entries on total chain.
-
-Arguments:
-
- TopEntry - Top entry of GCD map.
-
- BottomEntry - Bottom entry of GCD map.
-
- StartLink - Start link of the list for this loop.
-
- EndLink - End link of the list for this loop.
-
- Map - Boundary.
-
-Returns:
-
- EFI_SUCCESS - GCD map successfully cleaned up.
-
---*/
-{
- LIST_ENTRY *Link;
-
- if (TopEntry->Signature == 0) {
- CoreFreePool (TopEntry);
- }
- if (BottomEntry->Signature == 0) {
- CoreFreePool (BottomEntry);
- }
-
- Link = StartLink;
- while (Link != EndLink->ForwardLink) {
- CoreMergeGcdMapEntry (Link, FALSE, Map);
- Link = Link->ForwardLink;
- }
- CoreMergeGcdMapEntry (EndLink, TRUE, Map);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-CoreSearchGcdMapEntry (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- OUT LIST_ENTRY **StartLink,
- OUT LIST_ENTRY **EndLink,
- IN LIST_ENTRY *Map
- )
-/*++
-
-Routine Description:
-
- Search a segment of memory space in GCD map. The result is a range of GCD entry list.
-
-Arguments:
-
- BaseAddress - The start address of the segment.
-
- Length - The length of the segment.
-
- StartLink - The first GCD entry involves this segment of memory space.
-
- EndLink - The first GCD entry involves this segment of memory space.
-
- Map - Points to the start entry to search.
-
-Returns:
-
- EFI_SUCCESS - Successfully found the entry.
-
- EFI_NOT_FOUND - Not found.
-
---*/
-{
- LIST_ENTRY *Link;
- EFI_GCD_MAP_ENTRY *Entry;
-
- ASSERT (Length != 0);
-
- *StartLink = NULL;
- *EndLink = NULL;
-
- Link = Map->ForwardLink;
- while (Link != Map) {
- Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- if (BaseAddress >= Entry->BaseAddress && BaseAddress <= Entry->EndAddress) {
- *StartLink = Link;
- }
- if (*StartLink != NULL) {
- if ((BaseAddress + Length - 1) >= Entry->BaseAddress &&
- (BaseAddress + Length - 1) <= Entry->EndAddress ) {
- *EndLink = Link;
- return EFI_SUCCESS;
- }
- }
- Link = Link->ForwardLink;
- }
- return EFI_NOT_FOUND;
-}
-
-STATIC
-UINTN
-CoreCountGcdMapEntry (
- IN LIST_ENTRY *Map
- )
-/*++
-
-Routine Description:
-
- Count the amount of GCD map entries.
-
-Arguments:
-
- Map - Points to the start entry to do the count loop.
-
-Returns:
-
- The count.
-
---*/
-{
- UINTN Count;
- LIST_ENTRY *Link;
-
- Count = 0;
- Link = Map->ForwardLink;
- while (Link != Map) {
- Count++;
- Link = Link->ForwardLink;
- }
- return Count;
-}
-
-
-STATIC
-UINT64
-ConverToCpuArchAttributes (
- UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- Return the memory attribute specified by Attributes
-
-Arguments:
-
- Attributes - A num with some attribute bits on.
-
-Returns:
-
- The enum value of memory attribute.
-
---*/
-{
- if ( (Attributes & EFI_MEMORY_UC) == EFI_MEMORY_UC) {
- return EFI_MEMORY_UC;
- }
-
- if ( (Attributes & EFI_MEMORY_WC ) == EFI_MEMORY_WC) {
- return EFI_MEMORY_WC;
- }
-
- if ( (Attributes & EFI_MEMORY_WT ) == EFI_MEMORY_WT) {
- return EFI_MEMORY_WT;
- }
-
- if ( (Attributes & EFI_MEMORY_WB) == EFI_MEMORY_WB) {
- return EFI_MEMORY_WB;
- }
-
- if ( (Attributes & EFI_MEMORY_WP) == EFI_MEMORY_WP) {
- return EFI_MEMORY_WP;
- }
-
- return INVALID_CPU_ARCH_ATTRIBUTES;
-
-}
-
-STATIC
-EFI_STATUS
-CoreConvertSpace (
- IN UINTN Operation,
- IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
- IN EFI_GCD_IO_TYPE GcdIoType,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Capabilities,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- Do operation on a segment of memory space specified (add, free, remove, change attribute ...).
-
-Arguments:
-
- Operation - The type of the operation
-
- GcdMemoryType - Additional information for the operation
-
- GcdIoType - Additional information for the operation
-
- BaseAddress - Start address of the segment
-
- Length - length of the segment
-
- Capabilities - The alterable attributes of a newly added entry
-
- Attributes - The attributes needs to be set
-
-Returns:
-
- EFI_INVALID_PARAMETER - Length is 0 or address (length) not aligned when setting attribute.
-
- EFI_SUCCESS - Action successfully done.
-
- EFI_UNSUPPORTED - Could not find the proper descriptor on this segment or
- set an upsupported attribute.
-
- EFI_ACCESS_DENIED - Operate on an space non-exist or is used for an image.
-
- EFI_NOT_FOUND - Free a non-using space or remove a non-exist space, and so on.
-
- EFI_OUT_OF_RESOURCES - No buffer could be allocated.
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *Map;
- LIST_ENTRY *Link;
- EFI_GCD_MAP_ENTRY *Entry;
- EFI_GCD_MAP_ENTRY *TopEntry;
- EFI_GCD_MAP_ENTRY *BottomEntry;
- LIST_ENTRY *StartLink;
- LIST_ENTRY *EndLink;
-
- EFI_CPU_ARCH_PROTOCOL *CpuArch;
- UINT64 CpuArchAttributes;
-
- if (Length == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- Map = NULL;
- if (Operation & GCD_MEMORY_SPACE_OPERATION) {
- CoreAcquireGcdMemoryLock ();
- Map = &mGcdMemorySpaceMap;
- }
- if (Operation & GCD_IO_SPACE_OPERATION) {
- CoreAcquireGcdIoLock ();
- Map = &mGcdIoSpaceMap;
- }
-
- //
- // Search for the list of descriptors that cover the range BaseAddress to BaseAddress+Length
- //
- Status = CoreSearchGcdMapEntry (BaseAddress, Length, &StartLink, &EndLink, Map);
- if (EFI_ERROR (Status)) {
- Status = EFI_UNSUPPORTED;
-
- goto Done;
- }
-
- //
- // Verify that the list of descriptors are unallocated non-existent memory.
- //
- Link = StartLink;
- while (Link != EndLink->ForwardLink) {
- Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- switch (Operation) {
- //
- // Add operations
- //
- case GCD_ADD_MEMORY_OPERATION:
- if (Entry->GcdMemoryType != EfiGcdMemoryTypeNonExistent ||
- Entry->ImageHandle != NULL ) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- break;
- case GCD_ADD_IO_OPERATION:
- if (Entry->GcdIoType != EfiGcdIoTypeNonExistent ||
- Entry->ImageHandle != NULL ) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- break;
- //
- // Free operations
- //
- case GCD_FREE_MEMORY_OPERATION:
- case GCD_FREE_IO_OPERATION:
- if (Entry->ImageHandle == NULL) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
- break;
- //
- // Remove operations
- //
- case GCD_REMOVE_MEMORY_OPERATION:
- if (Entry->GcdMemoryType == EfiGcdMemoryTypeNonExistent) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
- if (Entry->ImageHandle != NULL) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- break;
- case GCD_REMOVE_IO_OPERATION:
- if (Entry->GcdIoType == EfiGcdIoTypeNonExistent) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
- if (Entry->ImageHandle != NULL) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- break;
- //
- // Set attribute operations
- //
- case GCD_SET_ATTRIBUTES_MEMORY_OPERATION:
- if (Attributes & EFI_MEMORY_RUNTIME) {
- if ((BaseAddress & EFI_PAGE_MASK) != 0 || (Length & EFI_PAGE_MASK) != 0) {
- Status = EFI_INVALID_PARAMETER;
-
- goto Done;
- }
- }
- if ((Entry->Capabilities & Attributes) != Attributes) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
- break;
- }
- Link = Link->ForwardLink;
- }
-
- //
- // Allocate work space to perform this operation
- //
- Status = CoreAllocateGcdMapEntry (&TopEntry, &BottomEntry);
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- //
- //
- //
- if (Operation == GCD_SET_ATTRIBUTES_MEMORY_OPERATION) {
- //
- // Call CPU Arch Protocol to attempt to set attributes on the range
- //
- CpuArchAttributes = ConverToCpuArchAttributes (Attributes);
- if ( CpuArchAttributes != INVALID_CPU_ARCH_ATTRIBUTES ) {
- Status = CoreLocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&CpuArch);
- if (EFI_ERROR (Status)) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
-
- Status = CpuArch->SetMemoryAttributes (
- CpuArch,
- BaseAddress,
- Length,
- CpuArchAttributes
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- }
-
- }
-
- //
- // Convert/Insert the list of descriptors from StartLink to EndLink
- //
- Link = StartLink;
- while (Link != EndLink->ForwardLink) {
- Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- CoreInsertGcdMapEntry (Link, Entry, BaseAddress, Length, TopEntry, BottomEntry);
- switch (Operation) {
- //
- // Add operations
- //
- case GCD_ADD_MEMORY_OPERATION:
- Entry->GcdMemoryType = GcdMemoryType;
- if (GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) {
- Entry->Capabilities = Capabilities | EFI_MEMORY_RUNTIME | EFI_MEMORY_PORT_IO;
- } else {
- Entry->Capabilities = Capabilities | EFI_MEMORY_RUNTIME;
- }
- break;
- case GCD_ADD_IO_OPERATION:
- Entry->GcdIoType = GcdIoType;
- break;
- //
- // Free operations
- //
- case GCD_FREE_MEMORY_OPERATION:
- case GCD_FREE_IO_OPERATION:
- Entry->ImageHandle = NULL;
- Entry->DeviceHandle = NULL;
- break;
- //
- // Remove operations
- //
- case GCD_REMOVE_MEMORY_OPERATION:
- Entry->GcdMemoryType = EfiGcdMemoryTypeNonExistent;
- Entry->Capabilities = 0;
- break;
- case GCD_REMOVE_IO_OPERATION:
- Entry->GcdIoType = EfiGcdIoTypeNonExistent;
- break;
- //
- // Set attribute operations
- //
- case GCD_SET_ATTRIBUTES_MEMORY_OPERATION:
- Entry->Attributes = Attributes;
- break;
- }
- Link = Link->ForwardLink;
- }
-
- //
- // Cleanup
- //
- Status = CoreCleanupGcdMapEntry (TopEntry, BottomEntry, StartLink, EndLink, Map);
-
-Done:
- if (Operation & GCD_MEMORY_SPACE_OPERATION) {
- CoreReleaseGcdMemoryLock ();
- }
- if (Operation & GCD_IO_SPACE_OPERATION) {
- CoreReleaseGcdIoLock ();
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-CoreAllocateSpaceCheckEntry (
- IN UINTN Operation,
- IN EFI_GCD_MAP_ENTRY *Entry,
- IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
- IN EFI_GCD_IO_TYPE GcdIoType
- )
-/*++
-
-Routine Description:
-
- Check whether an entry could be used to allocate space.
-
-Arguments:
-
- Operation - Allocate memory or IO
-
- Entry - The entry to be tested
-
- GcdMemoryType - The desired memory type
-
- GcdIoType - The desired IO type
-
-Returns:
-
- EFI_NOT_FOUND - The memory type does not match or there's an image handle on the entry.
-
- EFI_UNSUPPORTED - The operation unsupported.
-
- EFI_SUCCESS - It's ok for this entry to be used to allocate space.
-
---*/
-{
- if (Entry->ImageHandle != NULL) {
- return EFI_NOT_FOUND;
- }
- switch (Operation) {
- case GCD_ALLOCATE_MEMORY_OPERATION:
- if (Entry->GcdMemoryType != GcdMemoryType) {
- return EFI_NOT_FOUND;
- }
- break;
- case GCD_ALLOCATE_IO_OPERATION:
- if (Entry->GcdIoType != GcdIoType) {
- return EFI_NOT_FOUND;
- }
- break;
- default:
- return EFI_UNSUPPORTED;
- }
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-CoreAllocateSpace (
- IN UINTN Operation,
- IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
- IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
- IN EFI_GCD_IO_TYPE GcdIoType,
- IN UINTN Alignment,
- IN UINT64 Length,
- IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- IN EFI_HANDLE ImageHandle,
- IN EFI_HANDLE DeviceHandle OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Allocate space on specified address and length.
-
-Arguments:
-
- Operation - The type of operation (memory or IO)
-
- GcdAllocateType - The type of allocate operation
-
- GcdMemoryType - The desired memory type
-
- GcdIoType - The desired IO type
-
- Alignment - Align with 2^Alignment
-
- Length - Length to allocate
-
- BaseAddress - Base address to allocate
-
- ImageHandle - The image handle consume the allocated space.
-
- DeviceHandle - The device handle consume the allocated space.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter.
-
- EFI_NOT_FOUND - No descriptor for the desired space exists.
-
- EFI_SUCCESS - Space successfully allocated.
-
---*/
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS AlignmentMask;
- EFI_PHYSICAL_ADDRESS MaxAddress;
- LIST_ENTRY *Map;
- LIST_ENTRY *Link;
- LIST_ENTRY *SubLink;
- EFI_GCD_MAP_ENTRY *Entry;
- EFI_GCD_MAP_ENTRY *TopEntry;
- EFI_GCD_MAP_ENTRY *BottomEntry;
- LIST_ENTRY *StartLink;
- LIST_ENTRY *EndLink;
- BOOLEAN Found;
-
- //
- // Make sure parameters are valid
- //
- if (GcdAllocateType < 0 || GcdAllocateType >= EfiGcdMaxAllocateType) {
- return EFI_INVALID_PARAMETER;
- }
- if (GcdMemoryType < 0 || GcdMemoryType >= EfiGcdMemoryTypeMaximum) {
- return EFI_INVALID_PARAMETER;
- }
- if (GcdIoType < 0 || GcdIoType >= EfiGcdIoTypeMaximum) {
- return EFI_INVALID_PARAMETER;
- }
- if (BaseAddress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- if (ImageHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- if (Alignment >= 64) {
- return EFI_NOT_FOUND;
- }
- if (Length == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- Map = NULL;
- if (Operation & GCD_MEMORY_SPACE_OPERATION) {
- CoreAcquireGcdMemoryLock ();
- Map = &mGcdMemorySpaceMap;
- }
- if (Operation & GCD_IO_SPACE_OPERATION) {
- CoreAcquireGcdIoLock ();
- Map = &mGcdIoSpaceMap;
- }
-
- Found = FALSE;
- StartLink = NULL;
- EndLink = NULL;
- //
- // Compute alignment bit mask
- //
- AlignmentMask = LShiftU64 (1, Alignment) - 1;
-
- if (GcdAllocateType == EfiGcdAllocateAddress) {
- //
- // Verify that the BaseAddress passed in is aligned correctly
- //
- if ((*BaseAddress & AlignmentMask) != 0) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- //
- // Search for the list of descriptors that cover the range BaseAddress to BaseAddress+Length
- //
- Status = CoreSearchGcdMapEntry (*BaseAddress, Length, &StartLink, &EndLink, Map);
- if (EFI_ERROR (Status)) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- //
- // Verify that the list of descriptors are unallocated memory matching GcdMemoryType.
- //
- Link = StartLink;
- while (Link != EndLink->ForwardLink) {
- Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- Link = Link->ForwardLink;
- Status = CoreAllocateSpaceCheckEntry (Operation, Entry, GcdMemoryType, GcdIoType);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- }
- Found = TRUE;
- } else {
-
- Entry = CR (Map->BackLink, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
-
- //
- // Compute the maximum address to use in the search algorithm
- //
- if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchBottomUp ||
- GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ) {
- MaxAddress = *BaseAddress;
- } else {
- MaxAddress = Entry->EndAddress;
- }
-
- //
- // Verify that the list of descriptors are unallocated memory matching GcdMemoryType.
- //
- if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
- GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
- Link = Map->BackLink;
- } else {
- Link = Map->ForwardLink;
- }
- while (Link != Map) {
- Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
-
- if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
- GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
- Link = Link->BackLink;
- } else {
- Link = Link->ForwardLink;
- }
-
- Status = CoreAllocateSpaceCheckEntry (Operation, Entry, GcdMemoryType, GcdIoType);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
- GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
- if ((Entry->BaseAddress + Length) > MaxAddress) {
- continue;
- }
- if (Length > (Entry->EndAddress + 1)) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
- if (Entry->EndAddress > MaxAddress) {
- *BaseAddress = MaxAddress;
- } else {
- *BaseAddress = Entry->EndAddress;
- }
- *BaseAddress = (*BaseAddress + 1 - Length) & (~AlignmentMask);
- } else {
- *BaseAddress = (Entry->BaseAddress + AlignmentMask) & (~AlignmentMask);
- if ((*BaseAddress + Length - 1) > MaxAddress) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
- }
-
- //
- // Search for the list of descriptors that cover the range BaseAddress to BaseAddress+Length
- //
- Status = CoreSearchGcdMapEntry (*BaseAddress, Length, &StartLink, &EndLink, Map);
- if (EFI_ERROR (Status)) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- Link = StartLink;
- //
- // Verify that the list of descriptors are unallocated memory matching GcdMemoryType.
- //
- Found = TRUE;
- SubLink = StartLink;
- while (SubLink != EndLink->ForwardLink) {
- Entry = CR (SubLink, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- Status = CoreAllocateSpaceCheckEntry (Operation, Entry, GcdMemoryType, GcdIoType);
- if (EFI_ERROR (Status)) {
- Link = SubLink;
- Found = FALSE;
- break;
- }
- SubLink = SubLink->ForwardLink;
- }
- if (Found) {
- break;
- }
- }
- }
- if (!Found) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- //
- // Allocate work space to perform this operation
- //
- Status = CoreAllocateGcdMapEntry (&TopEntry, &BottomEntry);
- if (EFI_ERROR (Status)) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- //
- // Convert/Insert the list of descriptors from StartLink to EndLink
- //
- Link = StartLink;
- while (Link != EndLink->ForwardLink) {
- Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- CoreInsertGcdMapEntry (Link, Entry, *BaseAddress, Length, TopEntry, BottomEntry);
- Entry->ImageHandle = ImageHandle;
- Entry->DeviceHandle = DeviceHandle;
- Link = Link->ForwardLink;
- }
-
- //
- // Cleanup
- //
- Status = CoreCleanupGcdMapEntry (TopEntry, BottomEntry, StartLink, EndLink, Map);
-
-Done:
- if (Operation & GCD_MEMORY_SPACE_OPERATION) {
- CoreReleaseGcdMemoryLock ();
- }
- if (Operation & GCD_IO_SPACE_OPERATION) {
- CoreReleaseGcdIoLock ();
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-CoreInternalAddMemorySpace (
- IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Capabilities
- )
-/*++
-
-Routine Description:
-
- Add a segment of memory to GCD map.
-
-Arguments:
-
- GcdMemoryType - Memory type of the segment.
-
- BaseAddress - Base address of the segment.
-
- Length - Length of the segment.
-
- Capabilities - alterable attributes of the segment.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameters.
-
- EFI_SUCCESS - Successfully add a segment of memory space.
-
---*/
-{
- //
- // Make sure parameters are valid
- //
- if (GcdMemoryType <= EfiGcdMemoryTypeNonExistent || GcdMemoryType >= EfiGcdMemoryTypeMaximum) {
- return EFI_INVALID_PARAMETER;
- }
-
- return CoreConvertSpace (GCD_ADD_MEMORY_OPERATION, GcdMemoryType, (EFI_GCD_IO_TYPE) 0, BaseAddress, Length, Capabilities, 0);
-}
-
-//
-// GCD Core Services
-//
-EFI_STATUS
-CoreAllocateMemorySpace (
- IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
- IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
- IN UINTN Alignment,
- IN UINT64 Length,
- IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- IN EFI_HANDLE ImageHandle,
- IN EFI_HANDLE DeviceHandle OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Allocates nonexistent memory, reserved memory, system memory, or memorymapped
-I/O resources from the global coherency domain of the processor.
-
-Arguments:
-
- GcdAllocateType - The type of allocate operation
-
- GcdMemoryType - The desired memory type
-
- Alignment - Align with 2^Alignment
-
- Length - Length to allocate
-
- BaseAddress - Base address to allocate
-
- ImageHandle - The image handle consume the allocated space.
-
- DeviceHandle - The device handle consume the allocated space.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter.
-
- EFI_NOT_FOUND - No descriptor contains the desired space.
-
- EFI_SUCCESS - Memory space successfully allocated.
-
---*/
-{
- return CoreAllocateSpace (
- GCD_ALLOCATE_MEMORY_OPERATION,
- GcdAllocateType,
- GcdMemoryType,
- (EFI_GCD_IO_TYPE) 0,
- Alignment,
- Length,
- BaseAddress,
- ImageHandle,
- DeviceHandle
- );
-}
-
-EFI_STATUS
-CoreAddMemorySpace (
- IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Capabilities
- )
-/*++
-
-Routine Description:
-
- Adds reserved memory, system memory, or memory-mapped I/O resources to the
-global coherency domain of the processor.
-
-Arguments:
-
- GcdMemoryType - Memory type of the memory space.
-
- BaseAddress - Base address of the memory space.
-
- Length - Length of the memory space.
-
- Capabilities - alterable attributes of the memory space.
-
-Returns:
-
- EFI_SUCCESS - Merged this memory space into GCD map.
-
---*/
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS PageBaseAddress;
- UINT64 PageLength;
-
- Status = CoreInternalAddMemorySpace (GcdMemoryType, BaseAddress, Length, Capabilities);
-
- if (!EFI_ERROR (Status) && GcdMemoryType == EfiGcdMemoryTypeSystemMemory) {
-
- PageBaseAddress = PageAlignLength (BaseAddress);
- PageLength = PageAlignLength (BaseAddress + Length - PageBaseAddress);
-
- Status = CoreAllocateMemorySpace (
- EfiGcdAllocateAddress,
- GcdMemoryType,
- EFI_PAGE_SHIFT,
- PageLength,
- &PageBaseAddress,
- gDxeCoreImageHandle,
- NULL
- );
-
- if (!EFI_ERROR (Status)) {
- CoreAddMemoryDescriptor (
- EfiConventionalMemory,
- PageBaseAddress,
- RShiftU64 (PageLength, EFI_PAGE_SHIFT),
- Capabilities
- );
- } else {
- for (; PageLength != 0; PageLength -= EFI_PAGE_SIZE, PageBaseAddress += EFI_PAGE_SIZE) {
- Status = CoreAllocateMemorySpace (
- EfiGcdAllocateAddress,
- GcdMemoryType,
- EFI_PAGE_SHIFT,
- EFI_PAGE_SIZE,
- &PageBaseAddress,
- gDxeCoreImageHandle,
- NULL
- );
-
- if (!EFI_ERROR (Status)) {
- CoreAddMemoryDescriptor (
- EfiConventionalMemory,
- PageBaseAddress,
- 1,
- Capabilities
- );
- }
- }
- }
- }
- return Status;
-}
-
-EFI_STATUS
-CoreFreeMemorySpace (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- Frees nonexistent memory, reserved memory, system memory, or memory-mapped
-I/O resources from the global coherency domain of the processor.
-
-Arguments:
-
- BaseAddress - Base address of the memory space.
-
- Length - Length of the memory space.
-
-Returns:
-
- EFI_SUCCESS - Space successfully freed.
-
---*/
-{
- return CoreConvertSpace (GCD_FREE_MEMORY_OPERATION, (EFI_GCD_MEMORY_TYPE) 0, (EFI_GCD_IO_TYPE) 0, BaseAddress, Length, 0, 0);
-}
-
-EFI_STATUS
-CoreRemoveMemorySpace (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- Removes reserved memory, system memory, or memory-mapped I/O resources from
-the global coherency domain of the processor.
-
-Arguments:
-
- BaseAddress - Base address of the memory space.
-
- Length - Length of the memory space.
-
-Returns:
-
- EFI_SUCCESS - Successfully remove a segment of memory space.
-
---*/
-{
- return CoreConvertSpace (GCD_REMOVE_MEMORY_OPERATION, (EFI_GCD_MEMORY_TYPE) 0, (EFI_GCD_IO_TYPE) 0, BaseAddress, Length, 0, 0);
-}
-
-STATIC
-VOID
-BuildMemoryDescriptor (
- IN OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor,
- IN EFI_GCD_MAP_ENTRY *Entry
- )
-/*++
-
-Routine Description:
-
- Build a memory descriptor according to an entry.
-
-Arguments:
-
- Descriptor - The descriptor to be built
-
- Entry - According to this entry
-
-Returns:
-
- None
-
---*/
-{
- Descriptor->BaseAddress = Entry->BaseAddress;
- Descriptor->Length = Entry->EndAddress - Entry->BaseAddress + 1;
- Descriptor->Capabilities = Entry->Capabilities;
- Descriptor->Attributes = Entry->Attributes;
- Descriptor->GcdMemoryType = Entry->GcdMemoryType;
- Descriptor->ImageHandle = Entry->ImageHandle;
- Descriptor->DeviceHandle = Entry->DeviceHandle;
-}
-
-EFI_STATUS
-CoreGetMemorySpaceDescriptor (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor
- )
-/*++
-
-Routine Description:
-
- Retrieves the descriptor for a memory region containing a specified address.
-
-Arguments:
-
- BaseAddress - Specified start address
-
- Descriptor - Specified length
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_SUCCESS - Successfully get memory space descriptor.
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *StartLink;
- LIST_ENTRY *EndLink;
- EFI_GCD_MAP_ENTRY *Entry;
-
- //
- // Make sure parameters are valid
- //
- if (Descriptor == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- CoreAcquireGcdMemoryLock ();
-
- //
- // Search for the list of descriptors that contain BaseAddress
- //
- Status = CoreSearchGcdMapEntry (BaseAddress, 1, &StartLink, &EndLink, &mGcdMemorySpaceMap);
- if (EFI_ERROR (Status)) {
- Status = EFI_NOT_FOUND;
- } else {
- //
- // Copy the contents of the found descriptor into Descriptor
- //
- Entry = CR (StartLink, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- BuildMemoryDescriptor (Descriptor, Entry);
- }
-
- CoreReleaseGcdMemoryLock ();
-
- return Status;
-}
-
-EFI_STATUS
-CoreSetMemorySpaceAttributes (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length,
- IN UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- Modifies the attributes for a memory region in the global coherency domain of the
-processor.
-
-Arguments:
-
- BaseAddress - Specified start address
-
- Length - Specified length
-
- Attributes - Specified attributes
-
-Returns:
-
- EFI_SUCCESS - Successfully set attribute of a segment of memory space.
-
---*/
-{
- return CoreConvertSpace (GCD_SET_ATTRIBUTES_MEMORY_OPERATION, (EFI_GCD_MEMORY_TYPE) 0, (EFI_GCD_IO_TYPE) 0, BaseAddress, Length, 0, Attributes);
-}
-
-EFI_STATUS
-CoreGetMemorySpaceMap (
- OUT UINTN *NumberOfDescriptors,
- OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap
- )
-/*++
-
-Routine Description:
-
- Returns a map of the memory resources in the global coherency domain of the
-processor.
-
-Arguments:
-
- NumberOfDescriptors - Number of descriptors.
-
- MemorySpaceMap - Descriptor array
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Successfully get memory space map.
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- EFI_GCD_MAP_ENTRY *Entry;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor;
-
- //
- // Make sure parameters are valid
- //
- if (NumberOfDescriptors == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- if (MemorySpaceMap == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- CoreAcquireGcdMemoryLock ();
-
- //
- // Count the number of descriptors
- //
- *NumberOfDescriptors = CoreCountGcdMapEntry (&mGcdMemorySpaceMap);
-
- //
- // Allocate the MemorySpaceMap
- //
- *MemorySpaceMap = CoreAllocateBootServicesPool (*NumberOfDescriptors * sizeof (EFI_GCD_MEMORY_SPACE_DESCRIPTOR));
- if (*MemorySpaceMap == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- //
- // Fill in the MemorySpaceMap
- //
- Descriptor = *MemorySpaceMap;
- Link = mGcdMemorySpaceMap.ForwardLink;
- while (Link != &mGcdMemorySpaceMap) {
- Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- BuildMemoryDescriptor (Descriptor, Entry);
- Descriptor++;
- Link = Link->ForwardLink;
- }
- Status = EFI_SUCCESS;
-
-Done:
- CoreReleaseGcdMemoryLock ();
- return Status;
-}
-
-EFI_STATUS
-CoreAddIoSpace (
- IN EFI_GCD_IO_TYPE GcdIoType,
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- Adds reserved I/O or I/O resources to the global coherency domain of the processor.
-
-Arguments:
-
- GcdIoType - IO type of the segment.
-
- BaseAddress - Base address of the segment.
-
- Length - Length of the segment.
-
-Returns:
-
- EFI_SUCCESS - Merged this segment into GCD map.
- EFI_INVALID_PARAMETER - Parameter not valid
-
---*/
-{
- //
- // Make sure parameters are valid
- //
- if (GcdIoType <= EfiGcdIoTypeNonExistent || GcdIoType >= EfiGcdIoTypeMaximum) {
- return EFI_INVALID_PARAMETER;
- }
- return CoreConvertSpace (GCD_ADD_IO_OPERATION, (EFI_GCD_MEMORY_TYPE) 0, GcdIoType, BaseAddress, Length, 0, 0);
-}
-
-EFI_STATUS
-CoreAllocateIoSpace (
- IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
- IN EFI_GCD_IO_TYPE GcdIoType,
- IN UINTN Alignment,
- IN UINT64 Length,
- IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
- IN EFI_HANDLE ImageHandle,
- IN EFI_HANDLE DeviceHandle OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
-domain of the processor.
-
-Arguments:
-
- GcdAllocateType - The type of allocate operation
-
- GcdIoType - The desired IO type
-
- Alignment - Align with 2^Alignment
-
- Length - Length to allocate
-
- BaseAddress - Base address to allocate
-
- ImageHandle - The image handle consume the allocated space.
-
- DeviceHandle - The device handle consume the allocated space.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter.
-
- EFI_NOT_FOUND - No descriptor contains the desired space.
-
- EFI_SUCCESS - IO space successfully allocated.
-
---*/
-{
- return CoreAllocateSpace (
- GCD_ALLOCATE_IO_OPERATION,
- GcdAllocateType,
- (EFI_GCD_MEMORY_TYPE) 0,
- GcdIoType,
- Alignment,
- Length,
- BaseAddress,
- ImageHandle,
- DeviceHandle
- );
-}
-
-EFI_STATUS
-CoreFreeIoSpace (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
-domain of the processor.
-
-Arguments:
-
- BaseAddress - Base address of the segment.
-
- Length - Length of the segment.
-
-Returns:
-
- EFI_SUCCESS - Space successfully freed.
-
---*/
-{
- return CoreConvertSpace (GCD_FREE_IO_OPERATION, (EFI_GCD_MEMORY_TYPE) 0, (EFI_GCD_IO_TYPE) 0, BaseAddress, Length, 0, 0);
-}
-
-EFI_STATUS
-CoreRemoveIoSpace (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- Removes reserved I/O or I/O resources from the global coherency domain of the
-processor.
-
-Arguments:
-
- BaseAddress - Base address of the segment.
-
- Length - Length of the segment.
-
-Returns:
-
- EFI_SUCCESS - Successfully removed a segment of IO space.
-
---*/
-{
- return CoreConvertSpace (GCD_REMOVE_IO_OPERATION, (EFI_GCD_MEMORY_TYPE) 0, (EFI_GCD_IO_TYPE) 0, BaseAddress, Length, 0, 0);
-}
-
-STATIC
-VOID
-BuildIoDescriptor (
- IN EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor,
- IN EFI_GCD_MAP_ENTRY *Entry
- )
-/*++
-
-Routine Description:
-
- Build a IO descriptor according to an entry.
-
-Arguments:
-
- Descriptor - The descriptor to be built
-
- Entry - According to this entry
-
-Returns:
-
- None
-
---*/
-{
- Descriptor->BaseAddress = Entry->BaseAddress;
- Descriptor->Length = Entry->EndAddress - Entry->BaseAddress + 1;
- Descriptor->GcdIoType = Entry->GcdIoType;
- Descriptor->ImageHandle = Entry->ImageHandle;
- Descriptor->DeviceHandle = Entry->DeviceHandle;
-}
-
-EFI_STATUS
-CoreGetIoSpaceDescriptor (
- IN EFI_PHYSICAL_ADDRESS BaseAddress,
- OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor
- )
-/*++
-
-Routine Description:
-
- Retrieves the descriptor for an I/O region containing a specified address.
-
-Arguments:
-
- BaseAddress - Specified start address
-
- Descriptor - Specified length
-
-Returns:
-
- EFI_INVALID_PARAMETER - Descriptor is NULL.
-
- EFI_SUCCESS - Successfully get the IO space descriptor.
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *StartLink;
- LIST_ENTRY *EndLink;
- EFI_GCD_MAP_ENTRY *Entry;
-
- //
- // Make sure parameters are valid
- //
- if (Descriptor == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- CoreAcquireGcdIoLock ();
-
- //
- // Search for the list of descriptors that contain BaseAddress
- //
- Status = CoreSearchGcdMapEntry (BaseAddress, 1, &StartLink, &EndLink, &mGcdIoSpaceMap);
- if (EFI_ERROR (Status)) {
- Status = EFI_NOT_FOUND;
- } else {
- //
- // Copy the contents of the found descriptor into Descriptor
- //
- Entry = CR (StartLink, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- BuildIoDescriptor (Descriptor, Entry);
- }
-
- CoreReleaseGcdIoLock ();
-
- return Status;
-}
-
-EFI_STATUS
-CoreGetIoSpaceMap (
- OUT UINTN *NumberOfDescriptors,
- OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap
- )
-/*++
-
-Routine Description:
-
- Returns a map of the I/O resources in the global coherency domain of the processor.
-
-Arguments:
-
- NumberOfDescriptors - Number of descriptors.
-
- IoSpaceMap - Descriptor array
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Successfully get IO space map.
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- EFI_GCD_MAP_ENTRY *Entry;
- EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor;
-
- //
- // Make sure parameters are valid
- //
- if (NumberOfDescriptors == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- if (IoSpaceMap == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- CoreAcquireGcdIoLock ();
-
- //
- // Count the number of descriptors
- //
- *NumberOfDescriptors = CoreCountGcdMapEntry (&mGcdIoSpaceMap);
-
- //
- // Allocate the IoSpaceMap
- //
- *IoSpaceMap = CoreAllocateBootServicesPool (*NumberOfDescriptors * sizeof (EFI_GCD_IO_SPACE_DESCRIPTOR));
- if (*IoSpaceMap == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- //
- // Fill in the IoSpaceMap
- //
- Descriptor = *IoSpaceMap;
- Link = mGcdIoSpaceMap.ForwardLink;
- while (Link != &mGcdIoSpaceMap) {
- Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- BuildIoDescriptor (Descriptor, Entry);
- Descriptor++;
- Link = Link->ForwardLink;
- }
- Status = EFI_SUCCESS;
-
-Done:
- CoreReleaseGcdIoLock ();
- return Status;
-}
-
-STATIC
-UINT64
-CoreConvertResourceDescriptorHobAttributesToCapabilities (
- EFI_GCD_MEMORY_TYPE GcdMemoryType,
- UINT64 Attributes
- )
-/*++
-
-Routine Description:
-
- Converts a Resource Descriptor HOB attributes mask to an EFI Memory Descriptor
- capabilities mask
-
-Arguments:
-
- GcdMemoryType - Type of resource in the GCD memory map.
- Attributes - The attribute mask in the Resource Descriptor HOB.
-
-Returns:
-
- The capabilities mask for an EFI Memory Descriptor.
-
---*/
-{
- UINT64 Capabilities;
- GCD_ATTRIBUTE_CONVERSION_ENTRY *Conversion;
-
- //
- // Convert the Resource HOB Attributes to an EFI Memory Capabilities mask
- //
- for (Capabilities = 0, Conversion = mAttributeConversionTable; Conversion->Attribute != 0; Conversion++) {
- if (Conversion->Memory || (GcdMemoryType != EfiGcdMemoryTypeSystemMemory)) {
- if (Attributes & Conversion->Attribute) {
- Capabilities |= Conversion->Capability;
- }
- }
- }
-
- return Capabilities;
-}
-
-EFI_STATUS
-CoreInitializeMemoryServices (
- IN VOID **HobStart,
- OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress,
- OUT UINT64 *MemoryLength
- )
-/*++
-
-Routine Description:
-
- External function. Initializes the GCD and memory services based on the memory
- descriptor HOBs. This function is responsible for priming the GCD map and the
- memory map, so memory allocations and resource allocations can be made. The first
- part of this function can not depend on any memory services until at least one
- memory descriptor is provided to the memory services. Then the memory services
- can be used to intialize the GCD map.
-
-Arguments:
-
- HobStart - The start address of the HOB.
- MemoryBaseAddress - Start address of memory region found to init DXE core.
- MemoryLength - Length of memory region found to init DXE core.
-
-Returns:
-
- EFI_SUCCESS - Memory services successfully initialized.
-
---*/
-{
- EFI_PEI_HOB_POINTERS Hob;
- EFI_MEMORY_TYPE_INFORMATION *EfiMemoryTypeInformation;
- UINTN DataSize;
- BOOLEAN Found;
- EFI_HOB_HANDOFF_INFO_TABLE *PhitHob;
- EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob;
- EFI_HOB_RESOURCE_DESCRIPTOR *PhitResourceHob;
- EFI_PHYSICAL_ADDRESS BaseAddress;
- UINT64 Length;
- UINT64 Attributes;
- UINT64 Capabilities;
- EFI_PHYSICAL_ADDRESS MaxMemoryBaseAddress;
- UINT64 MaxMemoryLength;
- UINT64 MaxMemoryAttributes;
- EFI_PHYSICAL_ADDRESS MaxAddress;
- EFI_PHYSICAL_ADDRESS HighAddress;
- EFI_HOB_RESOURCE_DESCRIPTOR *MaxResourceHob;
- EFI_HOB_GUID_TYPE *GuidHob;
-
- //
- // Point at the first HOB. This must be the PHIT HOB.
- //
- Hob.Raw = *HobStart;
- ASSERT (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_HANDOFF);
-
- //
- // Initialize the spin locks and maps in the memory services.
- // Also fill in the memory services into the EFI Boot Services Table
- //
- CoreInitializePool ();
-
- //
- // Initialize Local Variables
- //
- PhitResourceHob = NULL;
- MaxResourceHob = NULL;
- ResourceHob = NULL;
- BaseAddress = 0;
- Length = 0;
- Attributes = 0;
- MaxMemoryBaseAddress = 0;
- MaxMemoryLength = 0;
- MaxMemoryAttributes = 0;
-
- //
- // Cache the PHIT HOB for later use
- //
- PhitHob = Hob.HandoffInformationTable;
-
- //
- // See if a Memory Type Information HOB is available
- //
- GuidHob = GetFirstGuidHob (&gEfiMemoryTypeInformationGuid);
- if (GuidHob != NULL) {
- EfiMemoryTypeInformation = GET_GUID_HOB_DATA (GuidHob);
- DataSize = GET_GUID_HOB_DATA_SIZE (GuidHob);
- if (EfiMemoryTypeInformation != NULL && DataSize > 0 && DataSize <= (EfiMaxMemoryType + 1) * sizeof (EFI_MEMORY_TYPE_INFORMATION)) {
- CopyMem (&gMemoryTypeInformation, EfiMemoryTypeInformation, DataSize);
- }
- }
-
- //
- // Find the Resource Descriptor HOB that contains range FreeMemoryBaseAddress..FreeMemoryLength
- //
- Length = 0;
- Found = FALSE;
- for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
-
- if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
-
- ResourceHob = Hob.ResourceDescriptor;
-
- if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY &&
- (ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES ) {
-
- if (PhitHob->EfiFreeMemoryBottom >= ResourceHob->PhysicalStart &&
- PhitHob->EfiFreeMemoryTop <= (ResourceHob->PhysicalStart + ResourceHob->ResourceLength) ) {
-
- //
- // Cache the resource descriptor HOB for the memory region described by the PHIT HOB
- //
- PhitResourceHob = ResourceHob;
- Found = TRUE;
-
- Attributes = PhitResourceHob->ResourceAttribute;
- BaseAddress = PageAlignAddress (PhitHob->EfiMemoryTop);
- Length = PageAlignLength (ResourceHob->PhysicalStart + ResourceHob->ResourceLength - BaseAddress);
- if (Length < MINIMUM_INITIAL_MEMORY_SIZE) {
- BaseAddress = PageAlignAddress (PhitHob->EfiFreeMemoryBottom);
- Length = PageAlignLength (PhitHob->EfiFreeMemoryTop - BaseAddress);
- if (Length < MINIMUM_INITIAL_MEMORY_SIZE) {
- BaseAddress = PageAlignAddress (ResourceHob->PhysicalStart);
- Length = PageAlignLength ((UINT64)((UINTN)*HobStart - BaseAddress));
- }
- }
- break;
- }
- }
- }
- }
-
- //
- // Assert if a resource descriptor HOB for the memory region described by the PHIT was not found
- //
- ASSERT (Found);
-
- //
- // Search all the resource descriptor HOBs from the highest possible addresses down for a memory
- // region that is big enough to initialize the DXE core. Always skip the PHIT Resource HOB.
- // The max address must be within the physically addressible range for the processor.
- //
- MaxMemoryLength = 0;
- MaxAddress = EFI_MAX_ADDRESS;
- do {
- HighAddress = 0;
- Found = FALSE;
- //
- // Search for a tested memory region that is below MaxAddress
- //
- for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
-
- //
- // See if this is a resource descriptor HOB that does not contain the PHIT.
- //
- if (Hob.ResourceDescriptor != PhitResourceHob && GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
-
- ResourceHob = Hob.ResourceDescriptor;
- //
- // See if this resource descrior HOB describes tested system memory below MaxAddress
- //
- if (ResourceHob->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY &&
- (ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES &&
- ResourceHob->PhysicalStart + ResourceHob->ResourceLength <= MaxAddress ) {
-
- //
- // See if this is the highest tested system memory region below MaxAddress
- //
- if (ResourceHob->PhysicalStart > HighAddress) {
-
- MaxResourceHob = ResourceHob;
- HighAddress = MaxResourceHob->PhysicalStart;
- Found = TRUE;
- }
- }
- }
- }
- if (Found) {
- //
- // Compute the size of the tested memory region below MaxAddrees
- //
- MaxMemoryBaseAddress = PageAlignAddress (MaxResourceHob->PhysicalStart);
- MaxMemoryLength = PageAlignLength (MaxResourceHob->PhysicalStart + MaxResourceHob->ResourceLength - MaxMemoryBaseAddress);
- MaxMemoryAttributes = MaxResourceHob->ResourceAttribute;
- }
- MaxAddress = ResourceHob->PhysicalStart;
- } while (Found && MaxMemoryLength < MINIMUM_INITIAL_MEMORY_SIZE);
-
- //
- //
- //
- if ((Length < MINIMUM_INITIAL_MEMORY_SIZE) ||
- (MaxMemoryBaseAddress > BaseAddress && MaxMemoryLength >= MINIMUM_INITIAL_MEMORY_SIZE) ) {
- BaseAddress = MaxMemoryBaseAddress;
- Length = MaxMemoryLength;
- Attributes = MaxMemoryAttributes;
- }
-
- //
- // If no memory regions are found that are big enough to initialize the DXE core, then ASSERT().
- //
- ASSERT (Length >= MINIMUM_INITIAL_MEMORY_SIZE);
-
- //
- // Convert the Resource HOB Attributes to an EFI Memory Capabilities mask
- //
- Capabilities = CoreConvertResourceDescriptorHobAttributesToCapabilities (EfiGcdMemoryTypeSystemMemory, Attributes);
-
- //
- // Declare the very first memory region, so the EFI Memory Services are available.
- //
- CoreAddMemoryDescriptor (
- EfiConventionalMemory,
- BaseAddress,
- RShiftU64 (Length, EFI_PAGE_SHIFT),
- Capabilities
- );
-
- *MemoryBaseAddress = BaseAddress;
- *MemoryLength = Length;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CoreInitializeGcdServices (
- IN VOID **HobStart,
- IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress,
- IN UINT64 MemoryLength
- )
-/*++
-
-Routine Description:
-
- External function. Initializes the GCD and memory services based on the memory
- descriptor HOBs. This function is responsible for priming the GCD map and the
- memory map, so memory allocations and resource allocations can be made. The first
- part of this function can not depend on any memory services until at least one
- memory descriptor is provided to the memory services. Then the memory services
- can be used to intialize the GCD map.
-
-Arguments:
-
- HobStart - The start address of the HOB
-
- MemoryBaseAddress - Start address of memory region found to init DXE core.
-
- MemoryLength - Length of memory region found to init DXE core.
-
-
-Returns:
-
- EFI_SUCCESS - GCD services successfully initialized.
-
---*/
-{
- EFI_PEI_HOB_POINTERS Hob;
- VOID *NewHobList;
- EFI_HOB_HANDOFF_INFO_TABLE *PhitHob;
- UINT8 SizeOfMemorySpace;
- UINT8 SizeOfIoSpace;
- EFI_HOB_RESOURCE_DESCRIPTOR *ResourceHob;
- EFI_PHYSICAL_ADDRESS BaseAddress;
- UINT64 Length;
- EFI_STATUS Status;
- EFI_GCD_MAP_ENTRY *Entry;
- EFI_GCD_MEMORY_TYPE GcdMemoryType;
- EFI_GCD_IO_TYPE GcdIoType;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
- EFI_HOB_MEMORY_ALLOCATION *MemoryHob;
- EFI_HOB_FIRMWARE_VOLUME *FirmwareVolumeHob;
- UINTN NumberOfDescriptors;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
- UINTN Index;
- UINT64 Capabilities;
- EFI_HOB_CPU * CpuHob;
- //
- // Cache the PHIT HOB for later use
- //
- PhitHob = (EFI_HOB_HANDOFF_INFO_TABLE *)(*HobStart);
-
- //
- // Get the number of address lines in the I/O and Memory space for the CPU
- //
- CpuHob = GetFirstHob (EFI_HOB_TYPE_CPU);
- ASSERT (CpuHob != NULL);
- SizeOfMemorySpace = CpuHob->SizeOfMemorySpace;
- SizeOfIoSpace = CpuHob->SizeOfIoSpace;
-
- //
- // Initialize the GCD Memory Space Map
- //
- Entry = CoreAllocateCopyPool (sizeof (EFI_GCD_MAP_ENTRY), &mGcdMemorySpaceMapEntryTemplate);
- ASSERT (Entry != NULL);
-
- Entry->EndAddress = LShiftU64 (1, SizeOfMemorySpace) - 1;
-
- InsertHeadList (&mGcdMemorySpaceMap, &Entry->Link);
-
- //
- // Initialize the GCD I/O Space Map
- //
- Entry = CoreAllocateCopyPool (sizeof (EFI_GCD_MAP_ENTRY), &mGcdIoSpaceMapEntryTemplate);
- ASSERT (Entry != NULL);
-
- Entry->EndAddress = LShiftU64 (1, SizeOfIoSpace) - 1;
-
- InsertHeadList (&mGcdIoSpaceMap, &Entry->Link);
-
- //
- // Walk the HOB list and add all resource descriptors to the GCD
- //
- for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
-
- GcdMemoryType = EfiGcdMemoryTypeNonExistent;
- GcdIoType = EfiGcdIoTypeNonExistent;
-
- if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
-
- ResourceHob = Hob.ResourceDescriptor;
-
- switch (ResourceHob->ResourceType) {
- case EFI_RESOURCE_SYSTEM_MEMORY:
- if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == TESTED_MEMORY_ATTRIBUTES) {
- GcdMemoryType = EfiGcdMemoryTypeSystemMemory;
- }
- if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == INITIALIZED_MEMORY_ATTRIBUTES) {
- GcdMemoryType = EfiGcdMemoryTypeReserved;
- }
- if ((ResourceHob->ResourceAttribute & MEMORY_ATTRIBUTE_MASK) == PRESENT_MEMORY_ATTRIBUTES) {
- GcdMemoryType = EfiGcdMemoryTypeReserved;
- }
- break;
- case EFI_RESOURCE_MEMORY_MAPPED_IO:
- case EFI_RESOURCE_FIRMWARE_DEVICE:
- GcdMemoryType = EfiGcdMemoryTypeMemoryMappedIo;
- break;
- case EFI_RESOURCE_MEMORY_MAPPED_IO_PORT:
- case EFI_RESOURCE_MEMORY_RESERVED:
- GcdMemoryType = EfiGcdMemoryTypeReserved;
- break;
- case EFI_RESOURCE_IO:
- GcdIoType = EfiGcdIoTypeIo;
- break;
- case EFI_RESOURCE_IO_RESERVED:
- GcdIoType = EfiGcdIoTypeReserved;
- break;
- }
-
- if (GcdMemoryType != EfiGcdMemoryTypeNonExistent) {
-
- //
- // Convert the Resource HOB Attributes to an EFI Memory Capabilities mask
- //
- Capabilities = CoreConvertResourceDescriptorHobAttributesToCapabilities (
- GcdMemoryType,
- ResourceHob->ResourceAttribute
- );
-
- Status = CoreInternalAddMemorySpace (
- GcdMemoryType,
- ResourceHob->PhysicalStart,
- ResourceHob->ResourceLength,
- Capabilities
- );
- }
-
- if (GcdIoType != EfiGcdIoTypeNonExistent) {
- Status = CoreAddIoSpace (
- GcdIoType,
- ResourceHob->PhysicalStart,
- ResourceHob->ResourceLength
- );
- }
- }
- }
-
- //
- // Allocate first memory region from the GCD by the DXE core
- //
- Status = CoreAllocateMemorySpace (
- EfiGcdAllocateAddress,
- EfiGcdMemoryTypeSystemMemory,
- 0,
- MemoryLength,
- &MemoryBaseAddress,
- gDxeCoreImageHandle,
- NULL
- );
-
- //
- // Walk the HOB list and allocate all memory space that is consumed by memory allocation HOBs,
- // and Firmware Volume HOBs. Also update the EFI Memory Map with the memory allocation HOBs.
- //
- for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
- if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
- MemoryHob = Hob.MemoryAllocation;
- BaseAddress = MemoryHob->AllocDescriptor.MemoryBaseAddress;
- Status = CoreAllocateMemorySpace (
- EfiGcdAllocateAddress,
- EfiGcdMemoryTypeSystemMemory,
- 0,
- MemoryHob->AllocDescriptor.MemoryLength,
- &BaseAddress,
- gDxeCoreImageHandle,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- Status = CoreGetMemorySpaceDescriptor (MemoryHob->AllocDescriptor.MemoryBaseAddress, &Descriptor);
- if (!EFI_ERROR (Status)) {
- CoreAddMemoryDescriptor (
- MemoryHob->AllocDescriptor.MemoryType,
- MemoryHob->AllocDescriptor.MemoryBaseAddress,
- RShiftU64 (MemoryHob->AllocDescriptor.MemoryLength, EFI_PAGE_SHIFT),
- Descriptor.Capabilities & (~EFI_MEMORY_RUNTIME)
- );
- }
- }
- }
-
- if (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_FV) {
- FirmwareVolumeHob = Hob.FirmwareVolume;
- BaseAddress = FirmwareVolumeHob->BaseAddress;
- Status = CoreAllocateMemorySpace (
- EfiGcdAllocateAddress,
- EfiGcdMemoryTypeMemoryMappedIo,
- 0,
- FirmwareVolumeHob->Length,
- &BaseAddress,
- gDxeCoreImageHandle,
- NULL
- );
- }
- }
-
- //
- // Relocate HOB List to an allocated pool buffer.
- //
- NewHobList = CoreAllocateCopyPool (
- (UINTN)PhitHob->EfiFreeMemoryBottom - (UINTN)(*HobStart),
- *HobStart
- );
- ASSERT (NewHobList != NULL);
-
- *HobStart = NewHobList;
- gHobList = NewHobList;
-
- //
- // Add and allocate the remaining unallocated system memory to the memory services.
- //
- Status = CoreGetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMap);
- for (Index = 0; Index < NumberOfDescriptors; Index++) {
- if (MemorySpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeSystemMemory) {
- if (MemorySpaceMap[Index].ImageHandle == NULL) {
- BaseAddress = PageAlignAddress (MemorySpaceMap[Index].BaseAddress);
- Length = PageAlignLength (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length - BaseAddress);
- CoreAddMemoryDescriptor (
- EfiConventionalMemory,
- BaseAddress,
- RShiftU64 (Length, EFI_PAGE_SHIFT),
- MemorySpaceMap[Index].Capabilities & (~EFI_MEMORY_RUNTIME)
- );
- Status = CoreAllocateMemorySpace (
- EfiGcdAllocateAddress,
- EfiGcdMemoryTypeSystemMemory,
- 0,
- Length,
- &BaseAddress,
- gDxeCoreImageHandle,
- NULL
- );
- }
- }
- }
- CoreFreePool (MemorySpaceMap);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Dxe/Hand/DriverSupport.c b/EdkModulePkg/Core/Dxe/Hand/DriverSupport.c
deleted file mode 100644
index e8a400c..0000000
--- a/EdkModulePkg/Core/Dxe/Hand/DriverSupport.c
+++ /dev/null
@@ -1,845 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DriverSupport.c
-
-Abstract:
-
- EFI Driver Support Protocol
-
-Revision History
-
---*/
-
-#include <DxeMain.h>
-
-
-
-STATIC
-EFI_STATUS
-GetHandleFromDriverBinding (
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBindingNeed,
- OUT EFI_HANDLE *Handle
- );
-
-
-//
-// Driver Support Function Prototypes
-//
-STATIC
-EFI_STATUS
-CoreConnectSingleController (
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE *DriverImageHandle OPTIONAL,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- );
-
-//
-// Driver Support Functions
-//
-
-
-EFI_STATUS
-EFIAPI
-CoreConnectController (
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE *DriverImageHandle OPTIONAL,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,
- IN BOOLEAN Recursive
- )
-/*++
-
-Routine Description:
-
- Connects one or more drivers to a controller.
-
-Arguments:
-
- ControllerHandle - Handle of the controller to be connected.
-
- DriverImageHandle - DriverImageHandle A pointer to an ordered list of driver image handles.
-
- RemainingDevicePath - RemainingDevicePath A pointer to the device path that specifies a child of the
- controller specified by ControllerHandle.
-
- Recursive - Whether the function would be called recursively or not.
-
-Returns:
-
- Status code.
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS ReturnStatus;
- IHANDLE *Handle;
- PROTOCOL_INTERFACE *Prot;
- LIST_ENTRY *Link;
- LIST_ENTRY *ProtLink;
- OPEN_PROTOCOL_DATA *OpenData;
- EFI_DEVICE_PATH_PROTOCOL *AlignedRemainingDevicePath;
-
- //
- // Make sure ControllerHandle is valid
- //
- Status = CoreValidateHandle (ControllerHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Handle = ControllerHandle;
-
- //
- // Connect all drivers to ControllerHandle
- //
- AlignedRemainingDevicePath = NULL;
- if (RemainingDevicePath != NULL) {
- AlignedRemainingDevicePath = CoreDuplicateDevicePath (RemainingDevicePath);
- }
- ReturnStatus = CoreConnectSingleController (
- ControllerHandle,
- DriverImageHandle,
- AlignedRemainingDevicePath
- );
- if (AlignedRemainingDevicePath != NULL) {
- CoreFreePool (AlignedRemainingDevicePath);
- }
-
- //
- // If not recursive, then just return after connecting drivers to ControllerHandle
- //
- if (!Recursive) {
- return ReturnStatus;
- }
-
- //
- // If recursive, then connect all drivers to all of ControllerHandle's children
- //
- CoreAcquireProtocolLock ();
- for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
- Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
- for (ProtLink = Prot->OpenList.ForwardLink;
- ProtLink != &Prot->OpenList;
- ProtLink = ProtLink->ForwardLink) {
- OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
- CoreReleaseProtocolLock ();
- Status = CoreConnectController (
- OpenData->ControllerHandle,
- NULL,
- NULL,
- TRUE
- );
- CoreAcquireProtocolLock ();
- }
- }
- }
- CoreReleaseProtocolLock ();
-
- return ReturnStatus;
-}
-
-STATIC
-VOID
-AddSortedDriverBindingProtocol (
- IN EFI_HANDLE DriverBindingHandle,
- IN OUT UINTN *NumberOfSortedDriverBindingProtocols,
- IN OUT EFI_DRIVER_BINDING_PROTOCOL **SortedDriverBindingProtocols,
- IN UINTN DriverBindingHandleCount,
- IN OUT EFI_HANDLE *DriverBindingHandleBuffer
- )
-/*++
-
-Routine Description:
-
- Add Driver Binding Protocols from Context Driver Image Handles to sorted
- Driver Binding Protocol list.
-
-Arguments:
-
- DriverBindingHandle - Handle of the driver binding protocol.
-
- NumberOfSortedDriverBindingProtocols - Number Of sorted driver binding protocols
-
- SortedDriverBindingProtocols - The sorted protocol list.
-
- DriverBindingHandleCount - Driver Binding Handle Count.
-
- DriverBindingHandleBuffer - The buffer of driver binding protocol to be modified.
-
-Returns:
-
- None.
-
---*/
-{
- EFI_STATUS Status;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
- UINTN Index;
-
- //
- // Make sure the DriverBindingHandle is valid
- //
- Status = CoreValidateHandle (DriverBindingHandle);
- if (EFI_ERROR (Status)) {
- return;
- }
-
- //
- // Retrieve the Driver Binding Protocol from DriverBindingHandle
- //
- Status = CoreHandleProtocol(
- DriverBindingHandle,
- &gEfiDriverBindingProtocolGuid,
- (VOID **)&DriverBinding
- );
- //
- // If DriverBindingHandle does not support the Driver Binding Protocol then return
- //
- if (EFI_ERROR (Status) || DriverBinding == NULL) {
- return;
- }
-
- //
- // See if DriverBinding is already in the sorted list
- //
- for (Index = 0; Index < *NumberOfSortedDriverBindingProtocols; Index++) {
- if (DriverBinding == SortedDriverBindingProtocols[Index]) {
- return;
- }
- }
-
- //
- // Add DriverBinding to the end of the list
- //
- SortedDriverBindingProtocols[*NumberOfSortedDriverBindingProtocols] = DriverBinding;
- *NumberOfSortedDriverBindingProtocols = *NumberOfSortedDriverBindingProtocols + 1;
-
- //
- // Mark the cooresponding handle in DriverBindingHandleBuffer as used
- //
- for (Index = 0; Index < DriverBindingHandleCount; Index++) {
- if (DriverBindingHandleBuffer[Index] == DriverBindingHandle) {
- DriverBindingHandleBuffer[Index] = NULL;
- }
- }
-}
-
-STATIC
-EFI_STATUS
-CoreConnectSingleController (
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE *ContextDriverImageHandles OPTIONAL,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Connects a controller to a driver.
-
-Arguments:
-
- ControllerHandle - Handle of the controller to be connected.
- ContextDriverImageHandles - DriverImageHandle A pointer to an ordered list of driver image handles.
- RemainingDevicePath - RemainingDevicePath A pointer to the device path that specifies a child
- of the controller specified by ControllerHandle.
-
-Returns:
-
- EFI_SUCCESS - One or more drivers were connected to ControllerHandle.
- EFI_OUT_OF_RESOURCES - No enough system resources to complete the request.
- EFI_NOT_FOUND - No drivers were connected to ControllerHandle.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_HANDLE DriverImageHandle;
- EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *PlatformDriverOverride;
- EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;
- UINTN DriverBindingHandleCount;
- EFI_HANDLE *DriverBindingHandleBuffer;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
- UINTN NumberOfSortedDriverBindingProtocols;
- EFI_DRIVER_BINDING_PROTOCOL **SortedDriverBindingProtocols;
- UINT32 HighestVersion;
- UINTN HighestIndex;
- UINTN SortIndex;
- BOOLEAN OneStarted;
- BOOLEAN DriverFound;
- EFI_HANDLE DriverBindingHandle;
-
- //
- // DriverBindingHandle is used for performance measurement, initialize it here just in case.
- //
- DriverBindingHandle = NULL;
- //
- // Initialize local variables
- //
- DriverBindingHandleCount = 0;
- DriverBindingHandleBuffer = NULL;
- NumberOfSortedDriverBindingProtocols = 0;
- SortedDriverBindingProtocols = NULL;
-
- //
- // Get list of all Driver Binding Protocol Instances
- //
- Status = CoreLocateHandleBuffer (
- ByProtocol,
- &gEfiDriverBindingProtocolGuid,
- NULL,
- &DriverBindingHandleCount,
- &DriverBindingHandleBuffer
- );
- if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Allocate a duplicate array for the sorted Driver Binding Protocol Instances
- //
- SortedDriverBindingProtocols = CoreAllocateBootServicesPool (sizeof (VOID *) * DriverBindingHandleCount);
- if (SortedDriverBindingProtocols == NULL) {
- CoreFreePool (DriverBindingHandleBuffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Add Driver Binding Protocols from Context Driver Image Handles first
- //
- if (ContextDriverImageHandles != NULL) {
- for (Index = 0; ContextDriverImageHandles[Index] != NULL; Index++) {
- AddSortedDriverBindingProtocol (
- ContextDriverImageHandles[Index],
- &NumberOfSortedDriverBindingProtocols,
- SortedDriverBindingProtocols,
- DriverBindingHandleCount,
- DriverBindingHandleBuffer
- );
- }
- }
-
- //
- // Add the Platform Driver Override Protocol drivers for ControllerHandle next
- //
- Status = CoreLocateProtocol (
- &gEfiPlatformDriverOverrideProtocolGuid,
- NULL,
- (VOID **)&PlatformDriverOverride
- );
- if (!EFI_ERROR (Status) && (PlatformDriverOverride != NULL)) {
- DriverImageHandle = NULL;
- do {
- Status = PlatformDriverOverride->GetDriver (
- PlatformDriverOverride,
- ControllerHandle,
- &DriverImageHandle
- );
- if (!EFI_ERROR (Status)) {
- AddSortedDriverBindingProtocol (
- DriverImageHandle,
- &NumberOfSortedDriverBindingProtocols,
- SortedDriverBindingProtocols,
- DriverBindingHandleCount,
- DriverBindingHandleBuffer
- );
- }
- } while (!EFI_ERROR (Status));
- }
-
- //
- // Get the Bus Specific Driver Override Protocol instance on the Controller Handle
- //
- Status = CoreHandleProtocol(
- ControllerHandle,
- &gEfiBusSpecificDriverOverrideProtocolGuid,
- (VOID **)&BusSpecificDriverOverride
- );
- if (!EFI_ERROR (Status) && (BusSpecificDriverOverride != NULL)) {
- DriverImageHandle = NULL;
- do {
- Status = BusSpecificDriverOverride->GetDriver (
- BusSpecificDriverOverride,
- &DriverImageHandle
- );
- if (!EFI_ERROR (Status)) {
- AddSortedDriverBindingProtocol (
- DriverImageHandle,
- &NumberOfSortedDriverBindingProtocols,
- SortedDriverBindingProtocols,
- DriverBindingHandleCount,
- DriverBindingHandleBuffer
- );
- }
- } while (!EFI_ERROR (Status));
- }
-
- //
- // Then add all the remaining Driver Binding Protocols
- //
- SortIndex = NumberOfSortedDriverBindingProtocols;
- for (Index = 0; Index < DriverBindingHandleCount; Index++) {
- AddSortedDriverBindingProtocol (
- DriverBindingHandleBuffer[Index],
- &NumberOfSortedDriverBindingProtocols,
- SortedDriverBindingProtocols,
- DriverBindingHandleCount,
- DriverBindingHandleBuffer
- );
- }
-
- //
- // Free the Driver Binding Handle Buffer
- //
- CoreFreePool (DriverBindingHandleBuffer);
-
- //
- // Sort the remaining DriverBinding Protocol based on their Version field from
- // highest to lowest.
- //
- for ( ; SortIndex < NumberOfSortedDriverBindingProtocols; SortIndex++) {
- HighestVersion = SortedDriverBindingProtocols[SortIndex]->Version;
- HighestIndex = SortIndex;
- for (Index = SortIndex + 1; Index < NumberOfSortedDriverBindingProtocols; Index++) {
- if (SortedDriverBindingProtocols[Index]->Version > HighestVersion) {
- HighestVersion = SortedDriverBindingProtocols[Index]->Version;
- HighestIndex = Index;
- }
- }
- if (SortIndex != HighestIndex) {
- DriverBinding = SortedDriverBindingProtocols[SortIndex];
- SortedDriverBindingProtocols[SortIndex] = SortedDriverBindingProtocols[HighestIndex];
- SortedDriverBindingProtocols[HighestIndex] = DriverBinding;
- }
- }
-
- //
- // Loop until no more drivers can be started on ControllerHandle
- //
- OneStarted = FALSE;
- do {
-
- //
- // Loop through the sorted Driver Binding Protocol Instances in order, and see if
- // any of the Driver Binding Protocols support the controller specified by
- // ControllerHandle.
- //
- DriverBinding = NULL;
- DriverFound = FALSE;
- for (Index = 0; (Index < NumberOfSortedDriverBindingProtocols) && !DriverFound; Index++) {
- if (SortedDriverBindingProtocols[Index] != NULL) {
- DriverBinding = SortedDriverBindingProtocols[Index];
- Status = DriverBinding->Supported(
- DriverBinding,
- ControllerHandle,
- RemainingDevicePath
- );
- if (!EFI_ERROR (Status)) {
- SortedDriverBindingProtocols[Index] = NULL;
- DriverFound = TRUE;
-
- //
- // A driver was found that supports ControllerHandle, so attempt to start the driver
- // on ControllerHandle.
- //
- PERF_CODE_BEGIN ();
- GetHandleFromDriverBinding (DriverBinding, &DriverBindingHandle);
- PERF_CODE_END ();
-
- PERF_START (DriverBindingHandle, DRIVERBINDING_START_TOK, NULL, 0);
- Status = DriverBinding->Start (
- DriverBinding,
- ControllerHandle,
- RemainingDevicePath
- );
- PERF_END (DriverBindingHandle, DRIVERBINDING_START_TOK, NULL, 0);
-
- if (!EFI_ERROR (Status)) {
- //
- // The driver was successfully started on ControllerHandle, so set a flag
- //
- OneStarted = TRUE;
- }
- }
- }
- }
- } while (DriverFound);
-
- //
- // Free any buffers that were allocated with AllocatePool()
- //
- CoreFreePool (SortedDriverBindingProtocols);
-
- //
- // If at least one driver was started on ControllerHandle, then return EFI_SUCCESS.
- //
- if (OneStarted) {
- return EFI_SUCCESS;
- }
-
- //
- // If no drivers started and RemainingDevicePath is an End Device Path Node, then return EFI_SUCCESS
- //
- if (RemainingDevicePath != NULL) {
- if (IsDevicePathEnd (RemainingDevicePath)) {
- return EFI_SUCCESS;
- }
- }
-
- //
- // Otherwise, no drivers were started on ControllerHandle, so return EFI_NOT_FOUND
- //
- return EFI_NOT_FOUND;
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreDisconnectController (
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE DriverImageHandle OPTIONAL,
- IN EFI_HANDLE ChildHandle OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Disonnects a controller from a driver
-
-Arguments:
-
- ControllerHandle - ControllerHandle The handle of the controller from which driver(s)
- are to be disconnected.
- DriverImageHandle - DriverImageHandle The driver to disconnect from ControllerHandle.
- ChildHandle - ChildHandle The handle of the child to destroy.
-
-Returns:
-
- EFI_SUCCESS - One or more drivers were disconnected from the controller.
- EFI_SUCCESS - On entry, no drivers are managing ControllerHandle.
- EFI_SUCCESS - DriverImageHandle is not NULL, and on entry DriverImageHandle is not managing ControllerHandle.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL, and it is not a valid EFI_HANDLE.
- EFI_OUT_OF_RESOURCES - There are not enough resources available to disconnect any drivers from ControllerHandle.
- EFI_DEVICE_ERROR - The controller could not be disconnected because of a device error.
-
---*/
-{
- EFI_STATUS Status;
- IHANDLE *Handle;
- EFI_HANDLE *DriverImageHandleBuffer;
- EFI_HANDLE *ChildBuffer;
- UINTN Index;
- UINTN HandleIndex;
- UINTN DriverImageHandleCount;
- UINTN ChildrenToStop;
- UINTN ChildBufferCount;
- UINTN StopCount;
- BOOLEAN Duplicate;
- BOOLEAN ChildHandleValid;
- BOOLEAN DriverImageHandleValid;
- LIST_ENTRY *Link;
- LIST_ENTRY *ProtLink;
- OPEN_PROTOCOL_DATA *OpenData;
- PROTOCOL_INTERFACE *Prot;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
-
- //
- // Make sure ControllerHandle is valid
- //
- Status = CoreValidateHandle (ControllerHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Make sure ChildHandle is valid if it is not NULL
- //
- if (ChildHandle != NULL) {
- Status = CoreValidateHandle (ChildHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- Handle = ControllerHandle;
-
- //
- // Get list of drivers that are currently managing ControllerHandle
- //
- DriverImageHandleBuffer = NULL;
- DriverImageHandleCount = 1;
-
- if (DriverImageHandle == NULL) {
- //
- // Look at each protocol interface for a match
- //
- DriverImageHandleCount = 0;
-
- CoreAcquireProtocolLock ();
- for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
- Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
- for (ProtLink = Prot->OpenList.ForwardLink;
- ProtLink != &Prot->OpenList;
- ProtLink = ProtLink->ForwardLink) {
- OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
- DriverImageHandleCount++;
- }
- }
- }
- CoreReleaseProtocolLock ();
-
- //
- // If there are no drivers managing this controller, then return EFI_SUCCESS
- //
- if (DriverImageHandleCount == 0) {
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- DriverImageHandleBuffer = CoreAllocateBootServicesPool (sizeof (EFI_HANDLE) * DriverImageHandleCount);
- if (DriverImageHandleBuffer == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- DriverImageHandleCount = 0;
-
- CoreAcquireProtocolLock ();
- for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
- Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
- for (ProtLink = Prot->OpenList.ForwardLink;
- ProtLink != &Prot->OpenList;
- ProtLink = ProtLink->ForwardLink) {
- OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
- Duplicate = FALSE;
- for (Index = 0; Index< DriverImageHandleCount; Index++) {
- if (DriverImageHandleBuffer[Index] == OpenData->AgentHandle) {
- Duplicate = TRUE;
- break;
- }
- }
- if (!Duplicate) {
- DriverImageHandleBuffer[DriverImageHandleCount] = OpenData->AgentHandle;
- DriverImageHandleCount++;
- }
- }
- }
- }
- CoreReleaseProtocolLock ();
- }
-
- StopCount = 0;
- for (HandleIndex = 0; HandleIndex < DriverImageHandleCount; HandleIndex++) {
-
- if (DriverImageHandleBuffer != NULL) {
- DriverImageHandle = DriverImageHandleBuffer[HandleIndex];
- }
-
- //
- // Get the Driver Binding Protocol of the driver that is managing this controller
- //
- Status = CoreHandleProtocol (
- DriverImageHandle,
- &gEfiDriverBindingProtocolGuid,
- (VOID **)&DriverBinding
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- //
- // Look at each protocol interface for a match
- //
- DriverImageHandleValid = FALSE;
- ChildBufferCount = 0;
-
- CoreAcquireProtocolLock ();
- for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
- Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
- for (ProtLink = Prot->OpenList.ForwardLink;
- ProtLink != &Prot->OpenList;
- ProtLink = ProtLink->ForwardLink) {
- OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- if (OpenData->AgentHandle == DriverImageHandle) {
- if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
- ChildBufferCount++;
- }
- if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
- DriverImageHandleValid = TRUE;
- }
- }
- }
- }
- CoreReleaseProtocolLock ();
-
- if (DriverImageHandleValid) {
- ChildHandleValid = FALSE;
- ChildBuffer = NULL;
- if (ChildBufferCount != 0) {
- ChildBuffer = CoreAllocateBootServicesPool (sizeof (EFI_HANDLE) * ChildBufferCount);
- if (ChildBuffer == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- ChildBufferCount = 0;
-
- CoreAcquireProtocolLock ();
- for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
- Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
- for (ProtLink = Prot->OpenList.ForwardLink;
- ProtLink != &Prot->OpenList;
- ProtLink = ProtLink->ForwardLink) {
- OpenData = CR (ProtLink, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- if ((OpenData->AgentHandle == DriverImageHandle) &&
- ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0)) {
- Duplicate = FALSE;
- for (Index = 0; Index < ChildBufferCount; Index++) {
- if (ChildBuffer[Index] == OpenData->ControllerHandle) {
- Duplicate = TRUE;
- break;
- }
- }
- if (!Duplicate) {
- ChildBuffer[ChildBufferCount] = OpenData->ControllerHandle;
- if (ChildHandle == ChildBuffer[ChildBufferCount]) {
- ChildHandleValid = TRUE;
- }
- ChildBufferCount++;
- }
- }
- }
- }
- CoreReleaseProtocolLock ();
- }
-
- if (ChildHandle == NULL || ChildHandleValid) {
- ChildrenToStop = 0;
- Status = EFI_SUCCESS;
- if (ChildBufferCount > 0) {
- if (ChildHandle != NULL) {
- ChildrenToStop = 1;
- Status = DriverBinding->Stop (DriverBinding, ControllerHandle, ChildrenToStop, &ChildHandle);
- } else {
- ChildrenToStop = ChildBufferCount;
- Status = DriverBinding->Stop (DriverBinding, ControllerHandle, ChildrenToStop, ChildBuffer);
- }
- }
- if (!EFI_ERROR (Status) && ((ChildHandle == NULL) || (ChildBufferCount == ChildrenToStop))) {
- Status = DriverBinding->Stop (DriverBinding, ControllerHandle, 0, NULL);
- }
- if (!EFI_ERROR (Status)) {
- StopCount++;
- }
- }
-
- if (ChildBuffer != NULL) {
- CoreFreePool (ChildBuffer);
- }
- }
- }
-
- if (StopCount > 0) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_NOT_FOUND;
- }
-
-Done:
-
- if (DriverImageHandleBuffer != NULL) {
- CoreFreePool (DriverImageHandleBuffer);
- }
-
- return Status;
-}
-
-
-
-STATIC
-EFI_STATUS
-GetHandleFromDriverBinding (
- IN EFI_DRIVER_BINDING_PROTOCOL *DriverBindingNeed,
- OUT EFI_HANDLE *Handle
- )
-/*++
-
-Routine Description:
-
- Locate the driver binding handle which a specified driver binding protocol installed on.
-
-Arguments:
-
- DriverBindingNeed - The specified driver binding protocol.
-
- Handle - The driver binding handle which the protocol installed on.
-
-
-Returns:
-
- EFI_NOT_FOUND - Could not find the handle.
-
- EFI_SUCCESS - Successfully find the associated driver binding handle.
-
---*/
- {
- EFI_STATUS Status ;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
- UINTN DriverBindingHandleCount;
- EFI_HANDLE *DriverBindingHandleBuffer;
- UINTN Index;
-
- DriverBindingHandleCount = 0;
- DriverBindingHandleBuffer = NULL;
- *Handle = NULL_HANDLE;
- Status = CoreLocateHandleBuffer (
- ByProtocol,
- &gEfiDriverBindingProtocolGuid,
- NULL,
- &DriverBindingHandleCount,
- &DriverBindingHandleBuffer
- );
- if (EFI_ERROR (Status) || DriverBindingHandleCount == 0) {
- return EFI_NOT_FOUND;
- }
-
- for (Index = 0 ; Index < DriverBindingHandleCount; Index++ ) {
- Status = CoreOpenProtocol(
- DriverBindingHandleBuffer[Index],
- &gEfiDriverBindingProtocolGuid,
- (VOID **)&DriverBinding,
- gDxeCoreImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (!EFI_ERROR (Status) && DriverBinding != NULL) {
-
- if ( DriverBinding == DriverBindingNeed ) {
- *Handle = DriverBindingHandleBuffer[Index];
- CoreFreePool (DriverBindingHandleBuffer);
- return EFI_SUCCESS ;
- }
- }
- }
-
- CoreFreePool (DriverBindingHandleBuffer);
- return EFI_NOT_FOUND ;
-}
-
diff --git a/EdkModulePkg/Core/Dxe/Hand/Notify.c b/EdkModulePkg/Core/Dxe/Hand/Notify.c
deleted file mode 100644
index f48fee7..0000000
--- a/EdkModulePkg/Core/Dxe/Hand/Notify.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- notify.c
-
-Abstract:
-
- EFI notify infrastructure
-
-
-
-Revision History
-
---*/
-
-#include <DxeMain.h>
-
-VOID
-CoreNotifyProtocolEntry (
- IN PROTOCOL_ENTRY *ProtEntry
- )
-/*++
-
-Routine Description:
-
- Signal event for every protocol in protocol entry.
-
-Arguments:
-
- ProtEntry - Protocol entry
-
-Returns:
-
---*/
-{
- PROTOCOL_NOTIFY *ProtNotify;
- LIST_ENTRY *Link;
-
- ASSERT_LOCKED (&gProtocolDatabaseLock);
-
- for (Link=ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {
- ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
- CoreSignalEvent (ProtNotify->Event);
- }
-}
-
-
-PROTOCOL_INTERFACE *
-CoreRemoveInterfaceFromProtocol (
- IN IHANDLE *Handle,
- IN EFI_GUID *Protocol,
- IN VOID *Interface
- )
-/*++
-
-Routine Description:
-
- Removes Protocol from the protocol list (but not the handle list).
-
-Arguments:
-
- Handle - The handle to remove protocol on.
-
- Protocol - GUID of the protocol to be moved
-
- Interface - The interface of the protocol
-
-Returns:
-
- Protocol Entry
-
---*/
-{
- PROTOCOL_INTERFACE *Prot;
- PROTOCOL_NOTIFY *ProtNotify;
- PROTOCOL_ENTRY *ProtEntry;
- LIST_ENTRY *Link;
-
- ASSERT_LOCKED (&gProtocolDatabaseLock);
-
- Prot = CoreFindProtocolInterface (Handle, Protocol, Interface);
- if (Prot != NULL) {
-
- ProtEntry = Prot->Protocol;
-
- //
- // If there's a protocol notify location pointing to this entry, back it up one
- //
-
- for(Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {
- ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
-
- if (ProtNotify->Position == &Prot->ByProtocol) {
- ProtNotify->Position = Prot->ByProtocol.BackLink;
- }
- }
-
- //
- // Remove the protocol interface entry
- //
-
- RemoveEntryList (&Prot->ByProtocol);
- }
-
- return Prot;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreRegisterProtocolNotify (
- IN EFI_GUID *Protocol,
- IN EFI_EVENT Event,
- OUT VOID **Registration
- )
-/*++
-
-Routine Description:
-
- Add a new protocol notification record for the request protocol.
-
-Arguments:
-
- Protocol - The requested protocol to add the notify registration
-
- Event - The event to signal
-
- Registration - Returns the registration record
-
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_SUCCESS - Successfully returned the registration record that has been added
-
---*/
-{
- PROTOCOL_ENTRY *ProtEntry;
- PROTOCOL_NOTIFY *ProtNotify;
- EFI_STATUS Status;
-
- if ((Protocol == NULL) || (Event == NULL) || (Registration == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- CoreAcquireProtocolLock ();
-
- ProtNotify = NULL;
-
- //
- // Get the protocol entry to add the notification too
- //
-
- ProtEntry = CoreFindProtocolEntry (Protocol, TRUE);
- if (ProtEntry != NULL) {
-
- //
- // Allocate a new notification record
- //
-
- ProtNotify = CoreAllocateBootServicesPool (sizeof(PROTOCOL_NOTIFY));
-
- if (ProtNotify != NULL) {
-
- ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE;
- ProtNotify->Protocol = ProtEntry;
- ProtNotify->Event = Event;
- //
- // start at the begining
- //
- ProtNotify->Position = &ProtEntry->Protocols;
-
- InsertTailList (&ProtEntry->Notify, &ProtNotify->Link);
- }
- }
-
- CoreReleaseProtocolLock ();
-
- //
- // Done. If we have a protocol notify entry, then return it.
- // Otherwise, we must have run out of resources trying to add one
- //
-
- Status = EFI_OUT_OF_RESOURCES;
- if (ProtNotify != NULL) {
- *Registration = ProtNotify;
- Status = EFI_SUCCESS;
- }
-
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreReinstallProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN VOID *OldInterface,
- IN VOID *NewInterface
- )
-/*++
-
-Routine Description:
-
- Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
-
-Arguments:
-
- UserHandle - Handle on which the interface is to be reinstalled
- Protocol - The numeric ID of the interface
- OldInterface - A pointer to the old interface
- NewInterface - A pointer to the new interface
-
-
-Returns:
-
- Status code.
-
- On EFI_SUCCESS The protocol interface was installed
- On EFI_NOT_FOUND The OldInterface on the handle was not found
- On EFI_INVALID_PARAMETER One of the parameters has an invalid value
-
---*/
-{
- EFI_STATUS Status;
- IHANDLE *Handle;
- PROTOCOL_INTERFACE *Prot;
- PROTOCOL_ENTRY *ProtEntry;
-
- Status = CoreValidateHandle (UserHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (Protocol == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Handle = (IHANDLE *) UserHandle;
-
- //
- // Lock the protocol database
- //
- CoreAcquireProtocolLock ();
-
- //
- // Check that Protocol exists on UserHandle, and Interface matches the interface in the database
- //
- Prot = CoreFindProtocolInterface (UserHandle, Protocol, OldInterface);
- if (Prot == NULL) {
- CoreReleaseProtocolLock ();
- return EFI_NOT_FOUND;
- }
-
- //
- // Attempt to disconnect all drivers that are using the protocol interface that is about to be reinstalled
- //
- Status = CoreDisconnectControllersUsingProtocolInterface (
- UserHandle,
- Prot
- );
- if (EFI_ERROR (Status)) {
- //
- // One or more drivers refused to release, so return the error
- //
- CoreReleaseProtocolLock ();
- return Status;
- }
-
- //
- // Remove the protocol interface from the protocol
- //
- Prot = CoreRemoveInterfaceFromProtocol (Handle, Protocol, OldInterface);
-
- if (Prot == NULL) {
- CoreReleaseProtocolLock ();
- return EFI_NOT_FOUND;
- }
-
- ProtEntry = Prot->Protocol;
-
- //
- // Update the interface on the protocol
- //
- Prot->Interface = NewInterface;
-
- //
- // Add this protocol interface to the tail of the
- // protocol entry
- //
- InsertTailList (&ProtEntry->Protocols, &Prot->ByProtocol);
-
- //
- // Update the Key to show that the handle has been created/modified
- //
- gHandleDatabaseKey++;
- Handle->Key = gHandleDatabaseKey;
-
- //
- // Release the lock and connect all drivers to UserHandle
- //
- CoreReleaseProtocolLock ();
- Status = CoreConnectController (
- UserHandle,
- NULL,
- NULL,
- TRUE
- );
- CoreAcquireProtocolLock ();
-
- //
- // Notify the notification list for this protocol
- //
- CoreNotifyProtocolEntry (ProtEntry);
-
- CoreReleaseProtocolLock ();
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Dxe/Hand/handle.c b/EdkModulePkg/Core/Dxe/Hand/handle.c
deleted file mode 100644
index 42d96ff..0000000
--- a/EdkModulePkg/Core/Dxe/Hand/handle.c
+++ /dev/null
@@ -1,1700 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- handle.c
-
-Abstract:
-
- EFI handle & protocol handling
-
-
-
-Revision History
-
---*/
-
-#include <DxeMain.h>
-
-
-//
-// mProtocolDatabase - A list of all protocols in the system. (simple list for now)
-// gHandleList - A list of all the handles in the system
-// gProtocolDatabaseLock - Lock to protect the mProtocolDatabase
-// gHandleDatabaseKey - The Key to show that the handle has been created/modified
-//
-static LIST_ENTRY mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase);
-LIST_ENTRY gHandleList = INITIALIZE_LIST_HEAD_VARIABLE (gHandleList);
-EFI_LOCK gProtocolDatabaseLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);
-UINT64 gHandleDatabaseKey = 0;
-
-
-VOID
-CoreAcquireProtocolLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Acquire lock on gProtocolDatabaseLock.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- CoreAcquireLock (&gProtocolDatabaseLock);
-}
-
-
-VOID
-CoreReleaseProtocolLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Release lock on gProtocolDatabaseLock.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- CoreReleaseLock (&gProtocolDatabaseLock);
-}
-
-
-EFI_STATUS
-CoreValidateHandle (
- IN EFI_HANDLE UserHandle
- )
-/*++
-
-Routine Description:
-
- Check whether a handle is a valid EFI_HANDLE
-
-Arguments:
-
- UserHandle - The handle to check
-
-Returns:
-
- EFI_INVALID_PARAMETER - The handle is NULL or not a valid EFI_HANDLE.
-
- EFI_SUCCESS - The handle is valid EFI_HANDLE.
-
---*/
-{
- IHANDLE *Handle;
-
- Handle = (IHANDLE *)UserHandle;
- if (Handle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- if (Handle->Signature != EFI_HANDLE_SIGNATURE) {
- return EFI_INVALID_PARAMETER;
- }
- return EFI_SUCCESS;
-}
-
-
-PROTOCOL_ENTRY *
-CoreFindProtocolEntry (
- IN EFI_GUID *Protocol,
- IN BOOLEAN Create
- )
-/*++
-
-Routine Description:
-
- Finds the protocol entry for the requested protocol.
-
- The gProtocolDatabaseLock must be owned
-
-Arguments:
-
- Protocol - The ID of the protocol
-
- Create - Create a new entry if not found
-
-Returns:
-
- Protocol entry
-
---*/
-{
- LIST_ENTRY *Link;
- PROTOCOL_ENTRY *Item;
- PROTOCOL_ENTRY *ProtEntry;
-
- ASSERT_LOCKED(&gProtocolDatabaseLock);
-
- //
- // Search the database for the matching GUID
- //
-
- ProtEntry = NULL;
- for (Link = mProtocolDatabase.ForwardLink;
- Link != &mProtocolDatabase;
- Link = Link->ForwardLink) {
-
- Item = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
- if (CompareGuid (&Item->ProtocolID, Protocol)) {
-
- //
- // This is the protocol entry
- //
-
- ProtEntry = Item;
- break;
- }
- }
-
- //
- // If the protocol entry was not found and Create is TRUE, then
- // allocate a new entry
- //
- if ((ProtEntry == NULL) && Create) {
- ProtEntry = CoreAllocateBootServicesPool (sizeof(PROTOCOL_ENTRY));
-
- if (ProtEntry != NULL) {
- //
- // Initialize new protocol entry structure
- //
- ProtEntry->Signature = PROTOCOL_ENTRY_SIGNATURE;
- CopyMem ((VOID *)&ProtEntry->ProtocolID, Protocol, sizeof (EFI_GUID));
- InitializeListHead (&ProtEntry->Protocols);
- InitializeListHead (&ProtEntry->Notify);
-
- //
- // Add it to protocol database
- //
- InsertTailList (&mProtocolDatabase, &ProtEntry->AllEntries);
- }
- }
-
- return ProtEntry;
-}
-
-
-PROTOCOL_INTERFACE *
-CoreFindProtocolInterface (
- IN IHANDLE *Handle,
- IN EFI_GUID *Protocol,
- IN VOID *Interface
- )
-/*++
-
-Routine Description:
-
- Finds the protocol instance for the requested handle and protocol.
-
- Note: This function doesn't do parameters checking, it's caller's responsibility
- to pass in valid parameters.
-
-Arguments:
-
- Handle - The handle to search the protocol on
-
- Protocol - GUID of the protocol
-
- Interface - The interface for the protocol being searched
-
-Returns:
-
- Protocol instance (NULL: Not found)
-
---*/
-{
- PROTOCOL_INTERFACE *Prot;
- PROTOCOL_ENTRY *ProtEntry;
- LIST_ENTRY *Link;
-
- ASSERT_LOCKED(&gProtocolDatabaseLock);
- Prot = NULL;
-
- //
- // Lookup the protocol entry for this protocol ID
- //
-
- ProtEntry = CoreFindProtocolEntry (Protocol, FALSE);
- if (ProtEntry != NULL) {
-
- //
- // Look at each protocol interface for any matches
- //
- for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link=Link->ForwardLink) {
-
- //
- // If this protocol interface matches, remove it
- //
- Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
- if (Prot->Interface == Interface && Prot->Protocol == ProtEntry) {
- break;
- }
-
- Prot = NULL;
- }
- }
-
- return Prot;
-}
-
-STATIC
-EFI_STATUS
-CoreUnregisterProtocolNotifyEvent (
- IN EFI_EVENT Event
- )
-/*++
-
-Routine Description:
-
- Removes an event from a register protocol notify list on a protocol.
-
-Arguments:
-
- Event - The event to search for in the protocol database.
-
-Returns:
-
- EFI_SUCCESS if the event was found and removed.
- EFI_NOT_FOUND if the event was not found in the protocl database.
-
---*/
-{
- LIST_ENTRY *Link;
- PROTOCOL_ENTRY *ProtEntry;
- LIST_ENTRY *NotifyLink;
- PROTOCOL_NOTIFY *ProtNotify;
-
- CoreAcquireProtocolLock ();
-
- for ( Link = mProtocolDatabase.ForwardLink;
- Link != &mProtocolDatabase;
- Link = Link->ForwardLink) {
-
- ProtEntry = CR(Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
-
- for ( NotifyLink = ProtEntry->Notify.ForwardLink;
- NotifyLink != &ProtEntry->Notify;
- NotifyLink = NotifyLink->ForwardLink) {
-
- ProtNotify = CR(NotifyLink, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
-
- if (ProtNotify->Event == Event) {
- RemoveEntryList(&ProtNotify->Link);
- CoreFreePool(ProtNotify);
- CoreReleaseProtocolLock ();
- return EFI_SUCCESS;
- }
- }
- }
-
- CoreReleaseProtocolLock ();
- return EFI_NOT_FOUND;
-}
-
-
-EFI_STATUS
-CoreUnregisterProtocolNotify (
- IN EFI_EVENT Event
- )
-/*++
-
-Routine Description:
-
- Removes all the events in the protocol database that match Event.
-
-Arguments:
-
- Event - The event to search for in the protocol database.
-
-Returns:
-
- EFI_SUCCESS when done searching the entire database.
-
---*/
-{
- EFI_STATUS Status;
-
- do {
- Status = CoreUnregisterProtocolNotifyEvent (Event);
- } while (!EFI_ERROR (Status));
-
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreInstallProtocolInterface (
- IN OUT EFI_HANDLE *UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_INTERFACE_TYPE InterfaceType,
- IN VOID *Interface
- )
-/*++
-
-Routine Description:
-
- Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
- Calls the private one which contains a BOOLEAN parameter for notifications
-
-Arguments:
-
- UserHandle - The handle to install the protocol handler on,
- or NULL if a new handle is to be allocated
-
- Protocol - The protocol to add to the handle
-
- InterfaceType - Indicates whether Interface is supplied in native form.
-
- Interface - The interface for the protocol being added
-
-Returns:
-
- Status code
-
---*/
-{
- return CoreInstallProtocolInterfaceNotify (
- UserHandle,
- Protocol,
- InterfaceType,
- Interface,
- TRUE
- );
-}
-
-EFI_STATUS
-CoreInstallProtocolInterfaceNotify (
- IN OUT EFI_HANDLE *UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_INTERFACE_TYPE InterfaceType,
- IN VOID *Interface,
- IN BOOLEAN Notify
- )
-/*++
-
-Routine Description:
-
- Installs a protocol interface into the boot services environment.
-
-Arguments:
-
- UserHandle - The handle to install the protocol handler on,
- or NULL if a new handle is to be allocated
-
- Protocol - The protocol to add to the handle
-
- InterfaceType - Indicates whether Interface is supplied in native form.
-
- Interface - The interface for the protocol being added
-
- Notify - indicates whether notify the notification list
- for this protocol
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Protocol interface successfully installed
-
---*/
-{
- PROTOCOL_INTERFACE *Prot;
- PROTOCOL_ENTRY *ProtEntry;
- IHANDLE *Handle;
- EFI_STATUS Status;
- VOID *ExistingInterface;
-
- //
- // returns EFI_INVALID_PARAMETER if InterfaceType is invalid.
- // Also added check for invalid UserHandle and Protocol pointers.
- //
- if (UserHandle == NULL || Protocol == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (InterfaceType != EFI_NATIVE_INTERFACE) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Print debug message
- //
- DEBUG((EFI_D_ERROR | EFI_D_INFO, "InstallProtocolInterface: %g %p\n", Protocol, Interface));
-
- Status = EFI_OUT_OF_RESOURCES;
- Prot = NULL;
- Handle = NULL;
-
- ASSERT (NULL != gDxeCoreBS);
-
- if (*UserHandle != NULL_HANDLE) {
- Status = CoreHandleProtocol (*UserHandle, Protocol, (VOID **)&ExistingInterface);
- if (!EFI_ERROR (Status)) {
- return EFI_INVALID_PARAMETER;
- }
- }
-
- //
- // Lock the protocol database
- //
- CoreAcquireProtocolLock ();
-
- //
- // Lookup the Protocol Entry for the requested protocol
- //
- ProtEntry = CoreFindProtocolEntry (Protocol, TRUE);
- if (ProtEntry == NULL) {
- goto Done;
- }
-
- //
- // Allocate a new protocol interface structure
- //
- Prot = CoreAllocateZeroBootServicesPool (sizeof(PROTOCOL_INTERFACE));
- if (Prot == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- //
- // If caller didn't supply a handle, allocate a new one
- //
- Handle = (IHANDLE *)*UserHandle;
- if (Handle == NULL) {
- Handle = CoreAllocateZeroBootServicesPool (sizeof(IHANDLE));
- if (Handle == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- //
- // Initialize new handler structure
- //
- Handle->Signature = EFI_HANDLE_SIGNATURE;
- InitializeListHead (&Handle->Protocols);
-
- //
- // Initialize the Key to show that the handle has been created/modified
- //
- gHandleDatabaseKey++;
- Handle->Key = gHandleDatabaseKey;
-
- //
- // Add this handle to the list global list of all handles
- // in the system
- //
- InsertTailList (&gHandleList, &Handle->AllHandles);
- }
-
- Status = CoreValidateHandle (Handle);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- //
- // Each interface that is added must be unique
- //
- ASSERT (CoreFindProtocolInterface (Handle, Protocol, Interface) == NULL);
-
- //
- // Initialize the protocol interface structure
- //
- Prot->Signature = PROTOCOL_INTERFACE_SIGNATURE;
- Prot->Handle = Handle;
- Prot->Protocol = ProtEntry;
- Prot->Interface = Interface;
-
- //
- // Initalize OpenProtocol Data base
- //
- InitializeListHead (&Prot->OpenList);
- Prot->OpenListCount = 0;
-
- //
- // Add this protocol interface to the head of the supported
- // protocol list for this handle
- //
- InsertHeadList (&Handle->Protocols, &Prot->Link);
-
- //
- // Add this protocol interface to the tail of the
- // protocol entry
- //
- InsertTailList (&ProtEntry->Protocols, &Prot->ByProtocol);
-
- //
- // Notify the notification list for this protocol
- //
- if (Notify) {
- CoreNotifyProtocolEntry (ProtEntry);
- }
- Status = EFI_SUCCESS;
-
-Done:
- //
- // Done, unlock the database and return
- //
- CoreReleaseProtocolLock ();
- if (!EFI_ERROR (Status)) {
- //
- // Return the new handle back to the caller
- //
- *UserHandle = Handle;
- } else {
- //
- // There was an error, clean up
- //
- if (Prot != NULL) {
- CoreFreePool (Prot);
- }
- }
-
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreInstallMultipleProtocolInterfaces (
- IN OUT EFI_HANDLE *Handle,
- ...
- )
-/*++
-
-Routine Description:
-
- Installs a list of protocol interface into the boot services environment.
- This function calls InstallProtocolInterface() in a loop. If any error
- occures all the protocols added by this function are removed. This is
- basically a lib function to save space.
-
-Arguments:
-
- Handle - The handle to install the protocol handlers on,
- or NULL if a new handle is to be allocated
- ... - EFI_GUID followed by protocol instance. A NULL terminates the
- list. The pairs are the arguments to InstallProtocolInterface().
- All the protocols are added to Handle.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Handle is NULL.
-
- EFI_SUCCESS - Protocol interfaces successfully installed.
-
---*/
-{
- VA_LIST args;
- EFI_STATUS Status;
- EFI_GUID *Protocol;
- VOID *Interface;
- EFI_TPL OldTpl;
- UINTN Index;
- EFI_HANDLE OldHandle;
- EFI_HANDLE DeviceHandle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- if (Handle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Syncronize with notifcations.
- //
- OldTpl = CoreRaiseTpl (TPL_NOTIFY);
- OldHandle = *Handle;
-
- //
- // Check for duplicate device path and install the protocol interfaces
- //
- VA_START (args, Handle);
- for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {
- //
- // If protocol is NULL, then it's the end of the list
- //
- Protocol = VA_ARG (args, EFI_GUID *);
- if (Protocol == NULL) {
- break;
- }
-
- Interface = VA_ARG (args, VOID *);
-
- //
- // Make sure you are installing on top a device path that has already been added.
- //
- if (CompareGuid (Protocol, &gEfiDevicePathProtocolGuid)) {
- DeviceHandle = NULL;
- DevicePath = Interface;
- Status = CoreLocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, &DeviceHandle);
- if (!EFI_ERROR (Status) && (DeviceHandle != NULL_HANDLE) && IsDevicePathEnd(DevicePath)) {
- Status = EFI_ALREADY_STARTED;
- continue;
- }
- }
-
- //
- // Install it
- //
- Status = CoreInstallProtocolInterface (Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
- }
-
- //
- // If there was an error, remove all the interfaces that were installed without any errors
- //
- if (EFI_ERROR (Status)) {
- //
- // Reset the va_arg back to the first argument.
- //
- VA_START (args, Handle);
- for (; Index > 1; Index--) {
- Protocol = VA_ARG (args, EFI_GUID *);
- Interface = VA_ARG (args, VOID *);
- CoreUninstallProtocolInterface (*Handle, Protocol, Interface);
- }
- *Handle = OldHandle;
- }
-
- //
- // Done
- //
- CoreRestoreTpl (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-CoreDisconnectControllersUsingProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN PROTOCOL_INTERFACE *Prot
- )
-/*++
-
-Routine Description:
-
- Attempts to disconnect all drivers that are using the protocol interface being queried.
- If failed, reconnect all drivers disconnected.
-
- Note: This function doesn't do parameters checking, it's caller's responsibility
- to pass in valid parameters.
-
-Arguments:
-
- UserHandle - The handle on which the protocol is installed
- Prot - The protocol to disconnect drivers from
-
-Returns:
-
- EFI_SUCCESS - Drivers using the protocol interface are all disconnected
- EFI_ACCESS_DENIED - Failed to disconnect one or all of the drivers
-
---*/
-{
- EFI_STATUS Status;
- BOOLEAN ItemFound;
- LIST_ENTRY *Link;
- OPEN_PROTOCOL_DATA *OpenData;
-
- Status = EFI_SUCCESS;
-
- //
- // Attempt to disconnect all drivers from this protocol interface
- //
- do {
- ItemFound = FALSE;
- for ( Link = Prot->OpenList.ForwardLink;
- (Link != &Prot->OpenList) && !ItemFound;
- Link = Link->ForwardLink ) {
- OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- if (OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) {
- ItemFound = TRUE;
- CoreReleaseProtocolLock ();
- Status = CoreDisconnectController (UserHandle, OpenData->AgentHandle, NULL);
- CoreAcquireProtocolLock ();
- if (EFI_ERROR (Status)) {
- ItemFound = FALSE;
- break;
- }
- }
- }
- } while (ItemFound);
-
- if (!EFI_ERROR (Status)) {
- //
- // Attempt to remove BY_HANDLE_PROTOOCL and GET_PROTOCOL and TEST_PROTOCOL Open List items
- //
- do {
- ItemFound = FALSE;
- for ( Link = Prot->OpenList.ForwardLink;
- (Link != &Prot->OpenList) && !ItemFound;
- Link = Link->ForwardLink ) {
- OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- if (OpenData->Attributes &
- (EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) {
- ItemFound = TRUE;
- RemoveEntryList (&OpenData->Link);
- Prot->OpenListCount--;
- CoreFreePool (OpenData);
- }
- }
- } while (ItemFound);
- }
-
- //
- // If there are errors or still has open items in the list, then reconnect all the drivers and return an error
- //
- if (EFI_ERROR (Status) || (Prot->OpenListCount > 0)) {
- CoreReleaseProtocolLock ();
- CoreConnectController (UserHandle, NULL, NULL, TRUE);
- CoreAcquireProtocolLock ();
- Status = EFI_ACCESS_DENIED;
- }
-
- return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreUninstallProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN VOID *Interface
- )
-/*++
-
-Routine Description:
-
- Uninstalls all instances of a protocol:interfacer from a handle.
- If the last protocol interface is remove from the handle, the
- handle is freed.
-
-Arguments:
-
- UserHandle - The handle to remove the protocol handler from
-
- Protocol - The protocol, of protocol:interface, to remove
-
- Interface - The interface, of protocol:interface, to remove
-
-Returns:
-
- EFI_INVALID_PARAMETER - Protocol is NULL.
-
- EFI_SUCCESS - Protocol interface successfully uninstalled.
-
---*/
-{
- EFI_STATUS Status;
- IHANDLE *Handle;
- PROTOCOL_INTERFACE *Prot;
-
- //
- // Check that Protocol is valid
- //
- if (Protocol == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check that UserHandle is a valid handle
- //
- Status = CoreValidateHandle (UserHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Lock the protocol database
- //
- CoreAcquireProtocolLock ();
-
- //
- // Check that Protocol exists on UserHandle, and Interface matches the interface in the database
- //
- Prot = CoreFindProtocolInterface (UserHandle, Protocol, Interface);
- if (Prot == NULL) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- //
- // Attempt to disconnect all drivers that are using the protocol interface that is about to be removed
- //
- Status = CoreDisconnectControllersUsingProtocolInterface (
- UserHandle,
- Prot
- );
- if (EFI_ERROR (Status)) {
- //
- // One or more drivers refused to release, so return the error
- //
- goto Done;
- }
-
- //
- // Remove the protocol interface from the protocol
- //
- Status = EFI_NOT_FOUND;
- Handle = (IHANDLE *)UserHandle;
- Prot = CoreRemoveInterfaceFromProtocol (Handle, Protocol, Interface);
-
- if (Prot != NULL) {
- //
- // Update the Key to show that the handle has been created/modified
- //
- gHandleDatabaseKey++;
- Handle->Key = gHandleDatabaseKey;
-
- //
- // Remove the protocol interface from the handle
- //
- RemoveEntryList (&Prot->Link);
-
- //
- // Free the memory
- //
- Prot->Signature = 0;
- CoreFreePool (Prot);
- Status = EFI_SUCCESS;
- }
-
- //
- // If there are no more handlers for the handle, free the handle
- //
- if (IsListEmpty (&Handle->Protocols)) {
- Handle->Signature = 0;
- RemoveEntryList (&Handle->AllHandles);
- CoreFreePool (Handle);
- }
-
-Done:
- //
- // Done, unlock the database and return
- //
- CoreReleaseProtocolLock ();
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreUninstallMultipleProtocolInterfaces (
- IN EFI_HANDLE Handle,
- ...
- )
-/*++
-
-Routine Description:
-
- Uninstalls a list of protocol interface in the boot services environment.
- This function calls UnisatllProtocolInterface() in a loop. This is
- basically a lib function to save space.
-
-Arguments:
-
- Handle - The handle to uninstall the protocol
-
- ... - EFI_GUID followed by protocol instance. A NULL terminates the
- list. The pairs are the arguments to UninstallProtocolInterface().
- All the protocols are added to Handle.
-
-Returns:
-
- Status code
-
---*/
-{
- EFI_STATUS Status;
- VA_LIST args;
- EFI_GUID *Protocol;
- VOID *Interface;
- UINTN Index;
-
- VA_START (args, Handle);
- for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {
- //
- // If protocol is NULL, then it's the end of the list
- //
- Protocol = VA_ARG (args, EFI_GUID *);
- if (Protocol == NULL) {
- break;
- }
-
- Interface = VA_ARG (args, VOID *);
-
- //
- // Uninstall it
- //
- Status = CoreUninstallProtocolInterface (Handle, Protocol, Interface);
- }
-
- //
- // If there was an error, add all the interfaces that were
- // uninstalled without any errors
- //
- if (EFI_ERROR (Status)) {
- //
- // Reset the va_arg back to the first argument.
- //
- VA_START (args, Handle);
- for (; Index > 1; Index--) {
- Protocol = VA_ARG(args, EFI_GUID *);
- Interface = VA_ARG(args, VOID *);
- CoreInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
- }
- }
-
- return Status;
-}
-
-STATIC
-PROTOCOL_INTERFACE *
-CoreGetProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol
- )
-/*++
-
-Routine Description:
-
- Locate a certain GUID protocol interface in a Handle's protocols.
-
-Arguments:
-
- UserHandle - The handle to obtain the protocol interface on
-
- Protocol - The GUID of the protocol
-
-Returns:
-
- The requested protocol interface for the handle
-
---*/
-{
- EFI_STATUS Status;
- PROTOCOL_ENTRY *ProtEntry;
- PROTOCOL_INTERFACE *Prot;
- IHANDLE *Handle;
- LIST_ENTRY *Link;
-
- Status = CoreValidateHandle (UserHandle);
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- Handle = (IHANDLE *)UserHandle;
-
- //
- // Look at each protocol interface for a match
- //
- for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
- Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
- ProtEntry = Prot->Protocol;
- if (CompareGuid (&ProtEntry->ProtocolID, Protocol)) {
- return Prot;
- }
- }
- return NULL;
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreHandleProtocol (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- OUT VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Queries a handle to determine if it supports a specified protocol.
-
-Arguments:
-
- UserHandle - The handle being queried.
-
- Protocol - The published unique identifier of the protocol.
-
- Interface - Supplies the address where a pointer to the corresponding Protocol
- Interface is returned.
-
-Returns:
-
- The requested protocol interface for the handle
-
---*/
-{
- return CoreOpenProtocol (
- UserHandle,
- Protocol,
- Interface,
- gDxeCoreImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
- );
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreOpenProtocol (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- OUT VOID **Interface OPTIONAL,
- IN EFI_HANDLE ImageHandle,
- IN EFI_HANDLE ControllerHandle,
- IN UINT32 Attributes
- )
-/*++
-
-Routine Description:
-
- Locates the installed protocol handler for the handle, and
- invokes it to obtain the protocol interface. Usage information
- is registered in the protocol data base.
-
-Arguments:
-
- UserHandle - The handle to obtain the protocol interface on
-
- Protocol - The ID of the protocol
-
- Interface - The location to return the protocol interface
-
- ImageHandle - The handle of the Image that is opening the protocol interface
- specified by Protocol and Interface.
-
- ControllerHandle - The controller handle that is requiring this interface.
-
- Attributes - The open mode of the protocol interface specified by Handle
- and Protocol.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Protocol is NULL.
-
- EFI_SUCCESS - Get the protocol interface.
-
---*/
-{
- EFI_STATUS Status;
- PROTOCOL_INTERFACE *Prot;
- LIST_ENTRY *Link;
- OPEN_PROTOCOL_DATA *OpenData;
- BOOLEAN ByDriver;
- BOOLEAN Exclusive;
- BOOLEAN Disconnect;
- BOOLEAN ExactMatch;
-
- //
- // Check for invalid Protocol
- //
- if (Protocol == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check for invalid Interface
- //
- if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
- if (Interface == NULL) {
- return EFI_INVALID_PARAMETER;
- } else {
- *Interface = NULL;
- }
- }
-
- //
- // Check for invalid UserHandle
- //
- Status = CoreValidateHandle (UserHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Check for invalid Attributes
- //
- switch (Attributes) {
- case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER :
- Status = CoreValidateHandle (ImageHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Status = CoreValidateHandle (ControllerHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- if (UserHandle == ControllerHandle) {
- return EFI_INVALID_PARAMETER;
- }
- break;
- case EFI_OPEN_PROTOCOL_BY_DRIVER :
- case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE :
- Status = CoreValidateHandle (ImageHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Status = CoreValidateHandle (ControllerHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- break;
- case EFI_OPEN_PROTOCOL_EXCLUSIVE :
- Status = CoreValidateHandle (ImageHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- break;
- case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL :
- case EFI_OPEN_PROTOCOL_GET_PROTOCOL :
- case EFI_OPEN_PROTOCOL_TEST_PROTOCOL :
- break;
- default:
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Lock the protocol database
- //
- CoreAcquireProtocolLock ();
-
- //
- // Look at each protocol interface for a match
- //
- Prot = CoreGetProtocolInterface (UserHandle, Protocol);
- if (Prot == NULL) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- //
- // This is the protocol interface entry for this protocol
- //
- if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
- *Interface = Prot->Interface;
- }
- Status = EFI_SUCCESS;
-
- ByDriver = FALSE;
- Exclusive = FALSE;
- for ( Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) {
- OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- ExactMatch = (BOOLEAN)((OpenData->AgentHandle == ImageHandle) &&
- (OpenData->Attributes == Attributes) &&
- (OpenData->ControllerHandle == ControllerHandle));
- if (OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) {
- ByDriver = TRUE;
- if (ExactMatch) {
- Status = EFI_ALREADY_STARTED;
- goto Done;
- }
- }
- if (OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) {
- Exclusive = TRUE;
- } else if (ExactMatch) {
- OpenData->OpenCount++;
- Status = EFI_SUCCESS;
- goto Done;
- }
- }
-
- //
- // ByDriver TRUE -> A driver is managing (UserHandle, Protocol)
- // ByDriver FALSE -> There are no drivers managing (UserHandle, Protocol)
- // Exclusive TRUE -> Something has exclusive access to (UserHandle, Protocol)
- // Exclusive FALSE -> Nothing has exclusive access to (UserHandle, Protocol)
- //
-
- switch (Attributes) {
- case EFI_OPEN_PROTOCOL_BY_DRIVER :
- if (Exclusive || ByDriver) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- break;
- case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE :
- case EFI_OPEN_PROTOCOL_EXCLUSIVE :
- if (Exclusive) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- if (ByDriver) {
- do {
- Disconnect = FALSE;
- for ( Link = Prot->OpenList.ForwardLink; (Link != &Prot->OpenList) && (!Disconnect); Link = Link->ForwardLink) {
- OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- if (OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) {
- Disconnect = TRUE;
- CoreReleaseProtocolLock ();
- Status = CoreDisconnectController (UserHandle, OpenData->AgentHandle, NULL);
- CoreAcquireProtocolLock ();
- if (EFI_ERROR (Status)) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- }
- }
- } while (Disconnect);
- }
- break;
- case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER :
- case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL :
- case EFI_OPEN_PROTOCOL_GET_PROTOCOL :
- case EFI_OPEN_PROTOCOL_TEST_PROTOCOL :
- break;
- }
-
- if (ImageHandle == NULL) {
- Status = EFI_SUCCESS;
- goto Done;
- }
- //
- // Create new entry
- //
- OpenData = CoreAllocateBootServicesPool (sizeof(OPEN_PROTOCOL_DATA));
- if (OpenData == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- } else {
- OpenData->Signature = OPEN_PROTOCOL_DATA_SIGNATURE;
- OpenData->AgentHandle = ImageHandle;
- OpenData->ControllerHandle = ControllerHandle;
- OpenData->Attributes = Attributes;
- OpenData->OpenCount = 1;
- InsertTailList (&Prot->OpenList, &OpenData->Link);
- Prot->OpenListCount++;
- Status = EFI_SUCCESS;
- }
-
-Done:
- //
- // Done. Release the database lock are return
- //
- CoreReleaseProtocolLock ();
- return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreCloseProtocol (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_HANDLE AgentHandle,
- IN EFI_HANDLE ControllerHandle
- )
-/*++
-
-Routine Description:
-
- Closes a protocol on a handle that was opened using OpenProtocol().
-
-Arguments:
-
- UserHandle - The handle for the protocol interface that was previously opened
- with OpenProtocol(), and is now being closed.
- Protocol - The published unique identifier of the protocol. It is the caller's
- responsibility to pass in a valid GUID.
- AgentHandle - The handle of the agent that is closing the protocol interface.
- ControllerHandle - If the agent that opened a protocol is a driver that follows the
- EFI Driver Model, then this parameter is the controller handle
- that required the protocol interface. If the agent does not follow
- the EFI Driver Model, then this parameter is optional and may be NULL.
-
-Returns:
-
- EFI_SUCCESS - The protocol instance was closed.
- EFI_INVALID_PARAMETER - Handle, AgentHandle or ControllerHandle is not a valid EFI_HANDLE.
- EFI_NOT_FOUND - Can not find the specified protocol or AgentHandle.
-
---*/
-{
- EFI_STATUS Status;
- PROTOCOL_INTERFACE *ProtocolInterface;
- LIST_ENTRY *Link;
- OPEN_PROTOCOL_DATA *OpenData;
-
- //
- // Check for invalid parameters
- //
- Status = CoreValidateHandle (UserHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Status = CoreValidateHandle (AgentHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- if (ControllerHandle != NULL_HANDLE) {
- Status = CoreValidateHandle (ControllerHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- if (Protocol == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Lock the protocol database
- //
- CoreAcquireProtocolLock ();
-
- //
- // Look at each protocol interface for a match
- //
- Status = EFI_NOT_FOUND;
- ProtocolInterface = CoreGetProtocolInterface (UserHandle, Protocol);
- if (ProtocolInterface == NULL) {
- goto Done;
- }
-
- //
- // Walk the Open data base looking for AgentHandle
- //
- Link = ProtocolInterface->OpenList.ForwardLink;
- while (Link != &ProtocolInterface->OpenList) {
- OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- Link = Link->ForwardLink;
- if ((OpenData->AgentHandle == AgentHandle) && (OpenData->ControllerHandle == ControllerHandle)) {
- RemoveEntryList (&OpenData->Link);
- ProtocolInterface->OpenListCount--;
- CoreFreePool (OpenData);
- Status = EFI_SUCCESS;
- }
- }
-
-Done:
- //
- // Done. Release the database lock and return.
- //
- CoreReleaseProtocolLock ();
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreOpenProtocolInformation (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
- OUT UINTN *EntryCount
- )
-/*++
-
-Routine Description:
-
- Return information about Opened protocols in the system
-
-Arguments:
-
- UserHandle - The handle to close the protocol interface on
-
- Protocol - The ID of the protocol
-
- EntryBuffer - A pointer to a buffer of open protocol information in the form of
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
-
- EntryCount - Number of EntryBuffer entries
-
-Returns:
-
-
---*/
-{
- EFI_STATUS Status;
- PROTOCOL_INTERFACE *ProtocolInterface;
- LIST_ENTRY *Link;
- OPEN_PROTOCOL_DATA *OpenData;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *Buffer;
- UINTN Count;
- UINTN Size;
-
- *EntryBuffer = NULL;
- *EntryCount = 0;
-
- //
- // Lock the protocol database
- //
- CoreAcquireProtocolLock ();
-
- //
- // Look at each protocol interface for a match
- //
- Status = EFI_NOT_FOUND;
- ProtocolInterface = CoreGetProtocolInterface (UserHandle, Protocol);
- if (ProtocolInterface == NULL) {
- goto Done;
- }
-
- //
- // Count the number of Open Entries
- //
- for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
- (Link != &ProtocolInterface->OpenList) ;
- Link = Link->ForwardLink ) {
- Count++;
- }
-
- ASSERT (Count == ProtocolInterface->OpenListCount);
-
- if (Count == 0) {
- Size = sizeof(EFI_OPEN_PROTOCOL_INFORMATION_ENTRY);
- } else {
- Size = Count * sizeof(EFI_OPEN_PROTOCOL_INFORMATION_ENTRY);
- }
-
- Buffer = CoreAllocateBootServicesPool (Size);
- if (Buffer == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- Status = EFI_SUCCESS;
- for ( Link = ProtocolInterface->OpenList.ForwardLink, Count = 0;
- (Link != &ProtocolInterface->OpenList);
- Link = Link->ForwardLink, Count++ ) {
- OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
-
- Buffer[Count].AgentHandle = OpenData->AgentHandle;
- Buffer[Count].ControllerHandle = OpenData->ControllerHandle;
- Buffer[Count].Attributes = OpenData->Attributes;
- Buffer[Count].OpenCount = OpenData->OpenCount;
- }
-
- *EntryBuffer = Buffer;
- *EntryCount = Count;
-
-Done:
- //
- // Done. Release the database lock are return
- //
- CoreReleaseProtocolLock ();
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreProtocolsPerHandle (
- IN EFI_HANDLE UserHandle,
- OUT EFI_GUID ***ProtocolBuffer,
- OUT UINTN *ProtocolBufferCount
- )
-/*++
-
-Routine Description:
-
- Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
- from pool.
-
-Arguments:
-
- UserHandle - The handle from which to retrieve the list of protocol interface
- GUIDs.
-
- ProtocolBuffer - A pointer to the list of protocol interface GUID pointers that are
- installed on Handle.
-
- ProtocolBufferCount - A pointer to the number of GUID pointers present in
- ProtocolBuffer.
-
-Returns:
- EFI_SUCCESS - The list of protocol interface GUIDs installed on Handle was returned in
- ProtocolBuffer. The number of protocol interface GUIDs was
- returned in ProtocolBufferCount.
- EFI_INVALID_PARAMETER - Handle is NULL.
- EFI_INVALID_PARAMETER - Handle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ProtocolBuffer is NULL.
- EFI_INVALID_PARAMETER - ProtocolBufferCount is NULL.
- EFI_OUT_OF_RESOURCES - There is not enough pool memory to store the results.
-
---*/
-{
- EFI_STATUS Status;
- IHANDLE *Handle;
- PROTOCOL_INTERFACE *Prot;
- LIST_ENTRY *Link;
- UINTN ProtocolCount;
- EFI_GUID **Buffer;
-
- Status = CoreValidateHandle (UserHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Handle = (IHANDLE *)UserHandle;
-
- if (ProtocolBuffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (ProtocolBufferCount == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *ProtocolBufferCount = 0;
-
- ProtocolCount = 0;
-
- CoreAcquireProtocolLock ();
-
- for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
- ProtocolCount++;
- }
-
- //
- // If there are no protocol interfaces installed on Handle, then Handle is not a valid EFI_HANDLE
- //
- if (ProtocolCount == 0) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- Buffer = CoreAllocateBootServicesPool (sizeof (EFI_GUID *) * ProtocolCount);
- if (Buffer == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- *ProtocolBuffer = Buffer;
- *ProtocolBufferCount = ProtocolCount;
-
- for ( Link = Handle->Protocols.ForwardLink, ProtocolCount = 0;
- Link != &Handle->Protocols;
- Link = Link->ForwardLink, ProtocolCount++) {
- Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
- Buffer[ProtocolCount] = &(Prot->Protocol->ProtocolID);
- }
- Status = EFI_SUCCESS;
-
-Done:
- CoreReleaseProtocolLock ();
- return Status;
-}
-
-
-UINT64
-CoreGetHandleDatabaseKey (
- VOID
- )
-/*++
-
-Routine Description:
-
- return handle database key.
-
-Arguments:
-
- None
-
-Returns:
-
- Handle database key.
-
---*/
-{
- return gHandleDatabaseKey;
-}
-
-
-VOID
-CoreConnectHandlesByKey (
- UINT64 Key
- )
-/*++
-
-Routine Description:
-
- Go connect any handles that were created or modified while a image executed.
-
-Arguments:
-
- Key - The Key to show that the handle has been created/modified
-
-Returns:
-
- None
---*/
-{
- UINTN Count;
- LIST_ENTRY *Link;
- EFI_HANDLE *HandleBuffer;
- IHANDLE *Handle;
- UINTN Index;
-
- //
- // Lock the protocol database
- //
- CoreAcquireProtocolLock ();
-
- for (Link = gHandleList.ForwardLink, Count = 0; Link != &gHandleList; Link = Link->ForwardLink) {
- Handle = CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
- if (Handle->Key > Key) {
- Count++;
- }
- }
-
- HandleBuffer = CoreAllocateBootServicesPool (Count * sizeof (EFI_HANDLE));
- if (HandleBuffer == NULL) {
- CoreReleaseProtocolLock ();
- return;
- }
-
- for (Link = gHandleList.ForwardLink, Count = 0; Link != &gHandleList; Link = Link->ForwardLink) {
- Handle = CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
- if (Handle->Key > Key) {
- HandleBuffer[Count++] = Handle;
- }
- }
-
- //
- // Unlock the protocol database
- //
- CoreReleaseProtocolLock ();
-
- //
- // Connect all handles whose Key value is greater than Key
- //
- for (Index = 0; Index < Count; Index++) {
- CoreConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
- }
-
- CoreFreePool(HandleBuffer);
-}
diff --git a/EdkModulePkg/Core/Dxe/Hand/locate.c b/EdkModulePkg/Core/Dxe/Hand/locate.c
deleted file mode 100644
index 54d72c3..0000000
--- a/EdkModulePkg/Core/Dxe/Hand/locate.c
+++ /dev/null
@@ -1,733 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- locate.c
-
-Abstract:
-
- Locate handle functions
-
-Revision History
-
---*/
-
-#include <DxeMain.h>
-
-//
-// ProtocolRequest - Last LocateHandle request ID
-//
-UINTN mEfiLocateHandleRequest = 0;
-
-//
-// Internal prototypes
-//
-
-typedef struct {
- EFI_GUID *Protocol;
- VOID *SearchKey;
- LIST_ENTRY *Position;
- PROTOCOL_ENTRY *ProtEntry;
-} LOCATE_POSITION;
-
-typedef
-IHANDLE *
-(* CORE_GET_NEXT) (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
- );
-
-STATIC
-IHANDLE *
-CoreGetNextLocateAllHandles (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
- );
-
-STATIC
-IHANDLE *
-CoreGetNextLocateByRegisterNotify (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
- );
-
-STATIC
-IHANDLE *
-CoreGetNextLocateByProtocol (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
- );
-
-//
-//
-//
-
-
-
-
-EFI_STATUS
-EFIAPI
-CoreLocateHandle (
- IN EFI_LOCATE_SEARCH_TYPE SearchType,
- IN EFI_GUID *Protocol OPTIONAL,
- IN VOID *SearchKey OPTIONAL,
- IN OUT UINTN *BufferSize,
- OUT EFI_HANDLE *Buffer
- )
-/*++
-
-Routine Description:
-
- Locates the requested handle(s) and returns them in Buffer.
-
-Arguments:
-
- SearchType - The type of search to perform to locate the handles
-
- Protocol - The protocol to search for
-
- SearchKey - Dependant on SearchType
-
- BufferSize - On input the size of Buffer. On output the
- size of data returned.
-
- Buffer - The buffer to return the results in
-
-
-Returns:
-
- EFI_BUFFER_TOO_SMALL - Buffer too small, required buffer size is returned in BufferSize.
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_SUCCESS - Successfully found the requested handle(s) and returns them in Buffer.
-
---*/
-{
- EFI_STATUS Status;
- LOCATE_POSITION Position;
- PROTOCOL_NOTIFY *ProtNotify;
- CORE_GET_NEXT GetNext;
- UINTN ResultSize;
- IHANDLE *Handle;
- IHANDLE **ResultBuffer;
- VOID *Interface;
-
- if (BufferSize == NULL) {
- Status = EFI_INVALID_PARAMETER;
- }
-
- if ((*BufferSize > 0) && (Buffer == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- GetNext = NULL;
- //
- // Set initial position
- //
-
- Position.Protocol = Protocol;
- Position.SearchKey = SearchKey;
- Position.Position = &gHandleList;
-
- ResultSize = 0;
- ResultBuffer = (IHANDLE **) Buffer;
- Status = EFI_SUCCESS;
-
- //
- // Lock the protocol database
- //
-
- CoreAcquireProtocolLock ();
-
- //
- // Get the search function based on type
- //
- switch (SearchType) {
- case AllHandles:
- GetNext = CoreGetNextLocateAllHandles;
- break;
-
- case ByRegisterNotify:
- //
- // Must have SearchKey for locate ByRegisterNotify
- //
- if (SearchKey == NULL) {
- Status = EFI_INVALID_PARAMETER;
- break;
- }
- GetNext = CoreGetNextLocateByRegisterNotify;
- break;
-
- case ByProtocol:
- GetNext = CoreGetNextLocateByProtocol;
- if (Protocol == NULL) {
- Status = EFI_INVALID_PARAMETER;
- break;
- }
- //
- // Look up the protocol entry and set the head pointer
- //
- Position.ProtEntry = CoreFindProtocolEntry (Protocol, FALSE);
- if (Position.ProtEntry == NULL) {
- Status = EFI_NOT_FOUND;
- break;
- }
- Position.Position = &Position.ProtEntry->Protocols;
- break;
-
- default:
- Status = EFI_INVALID_PARAMETER;
- break;
- }
-
- if (EFI_ERROR(Status)) {
- CoreReleaseProtocolLock ();
- return Status;
- }
-
- //
- // Enumerate out the matching handles
- //
- mEfiLocateHandleRequest += 1;
- for (; ;) {
- //
- // Get the next handle. If no more handles, stop
- //
- Handle = GetNext (&Position, &Interface);
- if (NULL == Handle) {
- break;
- }
-
- //
- // Increase the resulting buffer size, and if this handle
- // fits return it
- //
- ResultSize += sizeof(Handle);
- if (ResultSize <= *BufferSize) {
- *ResultBuffer = Handle;
- ResultBuffer += 1;
- }
- }
-
- //
- // If the result is a zero length buffer, then there were no
- // matching handles
- //
- if (ResultSize == 0) {
- Status = EFI_NOT_FOUND;
- } else {
- //
- // Return the resulting buffer size. If it's larger than what
- // was passed, then set the error code
- //
- if (ResultSize > *BufferSize) {
- Status = EFI_BUFFER_TOO_SMALL;
- }
-
- *BufferSize = ResultSize;
-
- if (SearchType == ByRegisterNotify && !EFI_ERROR(Status)) {
- //
- // If this is a search by register notify and a handle was
- // returned, update the register notification position
- //
- ProtNotify = SearchKey;
- ProtNotify->Position = ProtNotify->Position->ForwardLink;
- }
- }
-
- CoreReleaseProtocolLock ();
- return Status;
-}
-
-
-STATIC
-IHANDLE *
-CoreGetNextLocateAllHandles (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Routine to get the next Handle, when you are searching for all handles.
-
-Arguments:
-
- Position - Information about which Handle to seach for.
-
- Interface - Return the interface structure for the matching protocol.
-
-Returns:
- IHANDLE - An IHANDLE is returned if the next Position is not the end of the
- list. A NULL_HANDLE is returned if it's the end of the list.
-
---*/
-{
- IHANDLE *Handle;
-
- //
- // Next handle
- //
- Position->Position = Position->Position->ForwardLink;
-
- //
- // If not at the end of the list, get the handle
- //
- Handle = NULL_HANDLE;
- *Interface = NULL;
- if (Position->Position != &gHandleList) {
- Handle = CR (Position->Position, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
- }
-
- return Handle;
-}
-
-
-STATIC
-IHANDLE *
-CoreGetNextLocateByRegisterNotify (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Routine to get the next Handle, when you are searching for register protocol
- notifies.
-
-Arguments:
-
- Position - Information about which Handle to seach for.
-
- Interface - Return the interface structure for the matching protocol.
-
-Returns:
- IHANDLE - An IHANDLE is returned if the next Position is not the end of the
- list. A NULL_HANDLE is returned if it's the end of the list.
-
---*/
-{
- IHANDLE *Handle;
- PROTOCOL_NOTIFY *ProtNotify;
- PROTOCOL_INTERFACE *Prot;
- LIST_ENTRY *Link;
-
- Handle = NULL_HANDLE;
- *Interface = NULL;
- ProtNotify = Position->SearchKey;
-
- //
- // If this is the first request, get the next handle
- //
- if (ProtNotify != NULL) {
- ASSERT(ProtNotify->Signature == PROTOCOL_NOTIFY_SIGNATURE);
- Position->SearchKey = NULL;
-
- //
- // If not at the end of the list, get the next handle
- //
- Link = ProtNotify->Position->ForwardLink;
- if (Link != &ProtNotify->Protocol->Protocols) {
- Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
- Handle = (IHANDLE *) Prot->Handle;
- *Interface = Prot->Interface;
- }
- }
-
- return Handle;
-}
-
-
-STATIC
-IHANDLE *
-CoreGetNextLocateByProtocol (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Routine to get the next Handle, when you are searching for a given protocol.
-
-Arguments:
-
- Position - Information about which Handle to seach for.
-
- Interface - Return the interface structure for the matching protocol.
-
-Returns:
- IHANDLE - An IHANDLE is returned if the next Position is not the end of the
- list. A NULL_HANDLE is returned if it's the end of the list.
-
---*/
-{
- IHANDLE *Handle;
- LIST_ENTRY *Link;
- PROTOCOL_INTERFACE *Prot;
-
- Handle = NULL_HANDLE;
- *Interface = NULL;
- for (; ;) {
- //
- // Next entry
- //
- Link = Position->Position->ForwardLink;
- Position->Position = Link;
-
- //
- // If not at the end, return the handle
- //
- if (Link == &Position->ProtEntry->Protocols) {
- Handle = NULL_HANDLE;
- break;
- }
-
- //
- // Get the handle
- //
- Prot = CR(Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
- Handle = (IHANDLE *) Prot->Handle;
- *Interface = Prot->Interface;
-
- //
- // If this handle has not been returned this request, then
- // return it now
- //
- if (Handle->LocateRequest != mEfiLocateHandleRequest) {
- Handle->LocateRequest = mEfiLocateHandleRequest;
- break;
- }
- }
-
- return Handle;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreLocateDevicePath (
- IN EFI_GUID *Protocol,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- OUT EFI_HANDLE *Device
- )
-/*++
-
-Routine Description:
-
- Locates the handle to a device on the device path that best matches the specified protocol.
-
-Arguments:
-
- Protocol - The protocol to search for.
- DevicePath - On input, a pointer to a pointer to the device path. On output, the device
- path pointer is modified to point to the remaining part of the devicepath.
- Device - A pointer to the returned device handle.
-
-Returns:
-
- EFI_SUCCESS - The resulting handle was returned.
- EFI_NOT_FOUND - No handles matched the search.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
-
---*/
-{
- INTN SourceSize;
- INTN Size;
- INTN BestMatch;
- UINTN HandleCount;
- UINTN Index;
- EFI_STATUS Status;
- EFI_HANDLE *Handles;
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *SourcePath;
- EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;
-
- if (Protocol == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((DevicePath == NULL) || (*DevicePath == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Device == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Device = NULL_HANDLE;
- SourcePath = *DevicePath;
- SourceSize = CoreDevicePathSize (SourcePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);
-
- //
- // The source path can only have 1 instance
- //
- if (CoreIsDevicePathMultiInstance (SourcePath)) {
- DEBUG((EFI_D_ERROR, "LocateDevicePath: Device path has too many instances\n"));
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Get a list of all handles that support the requested protocol
- //
- Status = CoreLocateHandleBuffer (ByProtocol, Protocol, NULL, &HandleCount, &Handles);
- if (EFI_ERROR (Status) || HandleCount == 0) {
- return EFI_NOT_FOUND;
- }
-
- BestMatch = -1;
- for(Index = 0; Index < HandleCount; Index += 1) {
- Handle = Handles[Index];
- Status = CoreHandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&TmpDevicePath);
- if (EFI_ERROR (Status)) {
- //
- // If this handle doesn't support device path, then skip it
- //
- continue;
- }
-
- //
- // Check if DevicePath is first part of SourcePath
- //
- Size = CoreDevicePathSize (TmpDevicePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);
- if ((Size <= SourceSize) && CompareMem (SourcePath, TmpDevicePath, Size) == 0) {
- //
- // If the size is equal to the best match, then we
- // have a duplice device path for 2 different device
- // handles
- //
- ASSERT (Size != BestMatch);
-
- //
- // We've got a match, see if it's the best match so far
- //
- if (Size > BestMatch) {
- BestMatch = Size;
- *Device = Handle;
- }
- }
- }
-
- CoreFreePool (Handles);
-
- //
- // If there wasn't any match, then no parts of the device path was found.
- // Which is strange since there is likely a "root level" device path in the system.
- //
- if (BestMatch == -1) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Return the remaining part of the device path
- //
- *DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) SourcePath) + BestMatch);
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreLocateProtocol (
- IN EFI_GUID *Protocol,
- IN VOID *Registration OPTIONAL,
- OUT VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Return the first Protocol Interface that matches the Protocol GUID. If
- Registration is pasased in return a Protocol Instance that was just add
- to the system. If Retistration is NULL return the first Protocol Interface
- you find.
-
-Arguments:
-
- Protocol - The protocol to search for
-
- Registration - Optional Registration Key returned from RegisterProtocolNotify()
-
- Interface - Return the Protocol interface (instance).
-
-Returns:
-
- EFI_SUCCESS - If a valid Interface is returned
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_NOT_FOUND - Protocol interface not found
-
---*/
-{
- EFI_STATUS Status;
- LOCATE_POSITION Position;
- PROTOCOL_NOTIFY *ProtNotify;
- IHANDLE *Handle;
-
- if (Interface == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Protocol == NULL) {
- return EFI_NOT_FOUND;
- }
-
- *Interface = NULL;
- Status = EFI_SUCCESS;
-
- //
- // Set initial position
- //
- Position.Protocol = Protocol;
- Position.SearchKey = Registration;
- Position.Position = &gHandleList;
-
- //
- // Lock the protocol database
- //
- CoreAcquireProtocolLock ();
-
- mEfiLocateHandleRequest += 1;
-
- if (NULL == Registration) {
- //
- // Look up the protocol entry and set the head pointer
- //
- Position.ProtEntry = CoreFindProtocolEntry (Protocol, FALSE);
- if (Position.ProtEntry == NULL) {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
- Position.Position = &Position.ProtEntry->Protocols;
-
- Handle = CoreGetNextLocateByProtocol (&Position, Interface);
- } else {
- Handle = CoreGetNextLocateByRegisterNotify (&Position, Interface);
- }
-
- if (NULL == Handle) {
- Status = EFI_NOT_FOUND;
- } else if (NULL != Registration) {
- //
- // If this is a search by register notify and a handle was
- // returned, update the register notification position
- //
- ProtNotify = Registration;
- ProtNotify->Position = ProtNotify->Position->ForwardLink;
- }
-
-Done:
- CoreReleaseProtocolLock ();
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreLocateHandleBuffer (
- IN EFI_LOCATE_SEARCH_TYPE SearchType,
- IN EFI_GUID *Protocol OPTIONAL,
- IN VOID *SearchKey OPTIONAL,
- IN OUT UINTN *NumberHandles,
- OUT EFI_HANDLE **Buffer
- )
-/*++
-
-Routine Description:
-
- Function returns an array of handles that support the requested protocol
- in a buffer allocated from pool. This is a version of CoreLocateHandle()
- that allocates a buffer for the caller.
-
-Arguments:
-
- SearchType - Specifies which handle(s) are to be returned.
- Protocol - Provides the protocol to search by.
- This parameter is only valid for SearchType ByProtocol.
- SearchKey - Supplies the search key depending on the SearchType.
- NumberHandles - The number of handles returned in Buffer.
- Buffer - A pointer to the buffer to return the requested array of
- handles that support Protocol.
-
-Returns:
-
- EFI_SUCCESS - The result array of handles was returned.
- EFI_NOT_FOUND - No handles match the search.
- EFI_OUT_OF_RESOURCES - There is not enough pool memory to store the matching results.
- EFI_INVALID_PARAMETER - Invalid parameter
-
---*/
-{
- EFI_STATUS Status;
- UINTN BufferSize;
-
- if (NumberHandles == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Buffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- BufferSize = 0;
- *NumberHandles = 0;
- *Buffer = NULL;
- Status = CoreLocateHandle (
- SearchType,
- Protocol,
- SearchKey,
- &BufferSize,
- *Buffer
- );
- //
- // LocateHandleBuffer() returns incorrect status code if SearchType is
- // invalid.
- //
- // Add code to correctly handle expected errors from CoreLocateHandle().
- //
- if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) {
- if (Status != EFI_INVALID_PARAMETER) {
- Status = EFI_NOT_FOUND;
- }
- return Status;
- }
-
- *Buffer = CoreAllocateBootServicesPool (BufferSize);
- if (*Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = CoreLocateHandle (
- SearchType,
- Protocol,
- SearchKey,
- &BufferSize,
- *Buffer
- );
-
- *NumberHandles = BufferSize/sizeof(EFI_HANDLE);
- if (EFI_ERROR(Status)) {
- *NumberHandles = 0;
- }
-
- return Status;
-}
-
-
diff --git a/EdkModulePkg/Core/Dxe/Image.h b/EdkModulePkg/Core/Dxe/Image.h
deleted file mode 100644
index 87214d3..0000000
--- a/EdkModulePkg/Core/Dxe/Image.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Image.h
-
-Abstract:
-
-Revision History
-
---*/
-
-
-#ifndef _IMAGE_H_
-#define _IMAGE_H_
-
-
-
-#define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32('l','d','r','i')
-
-typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle; // Image handle
- UINTN Type; // Image type
-
- BOOLEAN Started; // If entrypoint has been called
-
- EFI_IMAGE_ENTRY_POINT EntryPoint; // The image's entry point
- EFI_LOADED_IMAGE_PROTOCOL Info; // loaded image protocol
-
- EFI_PHYSICAL_ADDRESS ImageBasePage; // Location in memory
- UINTN NumberOfPages; // Number of pages
-
- CHAR8 *FixupData; // Original fixup data
-
- EFI_TPL Tpl; // Tpl of started image
- EFI_STATUS Status; // Status returned by started image
-
- UINTN ExitDataSize; // Size of ExitData from started image
- VOID *ExitData; // Pointer to exit data from started image
- VOID *JumpBuffer; // Pointer to pool allocation for context save/retore
- BASE_LIBRARY_JUMP_BUFFER *JumpContext; // Pointer to buffer for context save/retore
- UINT16 Machine; // Machine type from PE image
-
- EFI_EBC_PROTOCOL *Ebc; // EBC Protocol pointer
-
- EFI_RUNTIME_IMAGE_ENTRY *RuntimeData; // Runtime image list
-
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; // PeCoffLoader ImageContext
-
-} LOADED_IMAGE_PRIVATE_DATA;
-
-#define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
-
-
-
-#define LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32('l','p','e','i')
-
-typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle; // Image handle
- EFI_PE32_IMAGE_PROTOCOL Pe32Image;
-} LOAD_PE32_IMAGE_PRIVATE_DATA;
-
-#define LOAD_PE32_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, LOAD_PE32_IMAGE_PRIVATE_DATA, Pe32Image, LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE)
-
-
-
-//
-// Private Data Types
-//
-#define IMAGE_FILE_HANDLE_SIGNATURE EFI_SIGNATURE_32('i','m','g','f')
-typedef struct {
- UINTN Signature;
- BOOLEAN FreeBuffer;
- VOID *Source;
- UINTN SourceSize;
-} IMAGE_FILE_HANDLE;
-
-
-//
-// Abstractions for reading image contents
-//
-
-EFI_STATUS
-CoreOpenImageFile (
- IN BOOLEAN BootPolicy,
- IN VOID *SourceBuffer OPTIONAL,
- IN UINTN SourceSize,
- IN OUT EFI_DEVICE_PATH_PROTOCOL *FilePath,
- OUT EFI_HANDLE *DeviceHandle,
- IN IMAGE_FILE_HANDLE *ImageFileHandle,
- OUT UINT32 *AuthenticationStatus
- )
-/*++
-
-Routine Description:
-
- Opens a file for (simple) reading. The simple read abstraction
- will access the file either from a memory copy, from a file
- system interface, or from the load file interface.
-
-Arguments:
-
- BootPolicy - Policy for Open Image File.
- SourceBuffer - Pointer to the memory location containing copy
- of the image to be loaded.
- SourceSize - The size in bytes of SourceBuffer.
- FilePath - The specific file path from which the image is loaded
- DeviceHandle - Pointer to the return device handle.
- ImageFileHandle - Pointer to the image file handle.
- AuthenticationStatus - Pointer to a caller-allocated UINT32 in which the authentication status is returned.
-
-Returns:
-
- A handle to access the file
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-CoreReadImageFile (
- IN VOID *UserHandle,
- IN UINTN Offset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Read image file (specified by UserHandle) into user specified buffer with specified offset
- and length.
-
-Arguments:
-
- UserHandle - Image file handle
-
- Offset - Offset to the source file
-
- ReadSize - For input, pointer of size to read;
- For output, pointer of size actually read.
-
- Buffer - Buffer to write into
-
-Returns:
-
- EFI_SUCCESS - Successfully read the specified part of file into buffer.
-
---*/
-;
-
-VOID
-EFIAPI
-CoreCloseImageFile (
- IN IMAGE_FILE_HANDLE *ImageFileHandle
- )
-/*++
-
-Routine Description:
-
- A function out of date, should be removed.
-
-Arguments:
-
- ImageFileHandle - Handle of the file to close
-
-Returns:
-
- None
-
---*/
-;
-
-//
-// Image processing worker functions
-//
-EFI_STATUS
-CoreDevicePathToInterface (
- IN EFI_GUID *Protocol,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
- OUT VOID **Interface,
- OUT EFI_HANDLE *Handle
- )
-/*++
-
-Routine Description:
-
- Search a handle to a device on a specified device path that supports a specified protocol,
- interface of that protocol on that handle is another output.
-
-Arguments:
-
- Protocol - The protocol to search for
-
- FilePath - The specified device path
-
- Interface - Interface of the protocol on the handle
-
- Handle - The handle to the device on the specified device path that supports the protocol.
-
-Returns:
-
- Status code.
-
---*/
-;
-
-EFI_STATUS
-CoreLoadPeImage (
- IN VOID *Pe32Handle,
- IN LOADED_IMAGE_PRIVATE_DATA *Image,
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,
- IN UINT32 Attribute
- )
-/*++
-
-Routine Description:
-
- Loads, relocates, and invokes a PE/COFF image
-
-Arguments:
-
- Pe32Handle - The handle of PE32 image
- Image - PE image to be loaded
- DstBuffer - The buffer to store the image
- EntryPoint - A pointer to the entry point
- Attribute - The bit mask of attributes to set for the load PE image
-
-Returns:
-
- EFI_SUCCESS - The file was loaded, relocated, and invoked
-
- EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_BUFFER_TOO_SMALL - Buffer for image is too small
-
---*/
-;
-
-LOADED_IMAGE_PRIVATE_DATA *
-CoreLoadedImageInfo (
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ImageHandle - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-VOID
-CoreUnloadAndCloseImage (
- IN LOADED_IMAGE_PRIVATE_DATA *Image,
- IN BOOLEAN FreePage
- )
-/*++
-
-Routine Description:
-
- Unloads EFI image from memory.
-
-Arguments:
-
- Image - EFI image
- FreePage - Free allocated pages
-
-Returns:
-
- None
-
---*/
-;
-
-
-//
-// Exported Image functions
-//
-
-EFI_STATUS
-EFIAPI
-CoreLoadImageEx (
- IN EFI_PE32_IMAGE_PROTOCOL *This,
- IN EFI_HANDLE ParentImageHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN VOID *SourceBuffer OPTIONAL,
- IN UINTN SourceSize,
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
- OUT UINTN *NumberOfPages OPTIONAL,
- OUT EFI_HANDLE *ImageHandle,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,
- IN UINT32 Attribute
- )
-/*++
-
-Routine Description:
-
- Loads an EFI image into memory and returns a handle to the image with extended parameters.
-
-Arguments:
-
- ParentImageHandle - The caller's image handle.
- FilePath - The specific file path from which the image is loaded.
- SourceBuffer - If not NULL, a pointer to the memory location containing a copy of
- the image to be loaded.
- SourceSize - The size in bytes of SourceBuffer.
- DstBuffer - The buffer to store the image.
- NumberOfPages - For input, specifies the space size of the image by caller if not NULL.
- For output, specifies the actual space size needed.
- ImageHandle - Image handle for output.
- EntryPoint - Image entry point for output.
- Attribute - The bit mask of attributes to set for the load PE image.
-
-Returns:
-
- EFI_SUCCESS - The image was loaded into memory.
- EFI_NOT_FOUND - The FilePath was not found.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
- EFI_UNSUPPORTED - The image type is not supported, or the device path cannot be
- parsed to locate the proper protocol for loading the file.
- EFI_OUT_OF_RESOURCES - Image was not loaded due to insufficient resources.
---*/
-;
-
-EFI_STATUS
-EFIAPI
-CoreUnloadImageEx (
- IN EFI_PE32_IMAGE_PROTOCOL *This,
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- Unload the specified image.
-
-Arguments:
-
- This - Indicates the calling context.
-
- ImageHandle - The specified image handle.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Image handle is NULL.
-
- EFI_UNSUPPORTED - Attempt to unload an unsupported image.
-
- EFI_SUCCESS - Image successfully unloaded.
-
---*/
-;
-#endif
diff --git a/EdkModulePkg/Core/Dxe/Image/Image.c b/EdkModulePkg/Core/Dxe/Image/Image.c
deleted file mode 100644
index 341df42..0000000
--- a/EdkModulePkg/Core/Dxe/Image/Image.c
+++ /dev/null
@@ -1,1390 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Image.c
-
-Abstract:
-
- Core image handling services
-
---*/
-
-#include <DxeMain.h>
-//
-// Module Globals
-//
-
-LOADED_IMAGE_PRIVATE_DATA *mCurrentImage = NULL;
-
-LOAD_PE32_IMAGE_PRIVATE_DATA mLoadPe32PrivateData = {
- LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE,
- NULL,
- {
- CoreLoadImageEx,
- CoreUnloadImageEx
- }
-};
-
-
-//
-// This code is needed to build the Image handle for the DXE Core
-//
-LOADED_IMAGE_PRIVATE_DATA mCorePrivateImage = {
- LOADED_IMAGE_PRIVATE_DATA_SIGNATURE, // Signature
- NULL, // Image handle
- EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER, // Image type
- TRUE, // If entrypoint has been called
- NULL, // EntryPoint
- {
- EFI_LOADED_IMAGE_INFORMATION_REVISION, // Revision
- NULL, // Parent handle
- NULL, // System handle
-
- NULL, // Device handle
- NULL, // File path
- NULL, // Reserved
-
- 0, // LoadOptionsSize
- NULL, // LoadOptions
-
- NULL, // ImageBase
- 0, // ImageSize
- EfiBootServicesCode, // ImageCodeType
- EfiBootServicesData // ImageDataType
- },
- (EFI_PHYSICAL_ADDRESS)0, // ImageBasePage
- 0, // NumberOfPages
- NULL, // FixupData
- 0, // Tpl
- EFI_SUCCESS, // Status
- 0, // ExitDataSize
- NULL, // ExitData
- NULL, // JumpBuffer
- NULL, // JumpContext
- 0, // Machine
- NULL, // Ebc
- NULL, // RuntimeData
-};
-
-
-EFI_STATUS
-CoreInitializeImageServices (
- IN VOID *HobStart
- )
-/*++
-
-Routine Description:
-
- Add the Image Services to EFI Boot Services Table and install the protocol
- interfaces for this image.
-
-Arguments:
-
- HobStart - The HOB to initialize
-
-Returns:
-
- Status code.
-
---*/
-{
- EFI_STATUS Status;
- LOADED_IMAGE_PRIVATE_DATA *Image;
- EFI_PHYSICAL_ADDRESS DxeCoreImageBaseAddress;
- UINT64 DxeCoreImageLength;
- VOID *DxeCoreEntryPoint;
- EFI_PEI_HOB_POINTERS DxeCoreHob;
- //
- // Searching for image hob
- //
- DxeCoreHob.Raw = HobStart;
- while ((DxeCoreHob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, DxeCoreHob.Raw)) != NULL) {
- if (CompareGuid (&DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.Name, &gEfiHobMemoryAllocModuleGuid)) {
- //
- // Find Dxe Core HOB
- //
- break;
- }
- DxeCoreHob.Raw = GET_NEXT_HOB (DxeCoreHob);
- }
- ASSERT (DxeCoreHob.Raw != NULL);
-
- DxeCoreImageBaseAddress = DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.MemoryBaseAddress;
- DxeCoreImageLength = DxeCoreHob.MemoryAllocationModule->MemoryAllocationHeader.MemoryLength;
- DxeCoreEntryPoint = (VOID *) (UINTN) DxeCoreHob.MemoryAllocationModule->EntryPoint;
- gDxeCoreFileName = &DxeCoreHob.MemoryAllocationModule->ModuleName;
- //
- // Initialize the fields for an internal driver
- //
- Image = &mCorePrivateImage;
-
- Image->EntryPoint = (EFI_IMAGE_ENTRY_POINT)(UINTN)DxeCoreEntryPoint;
- Image->ImageBasePage = DxeCoreImageBaseAddress;
- Image->NumberOfPages = (UINTN)(EFI_SIZE_TO_PAGES((UINTN)(DxeCoreImageLength)));
- Image->Tpl = gEfiCurrentTpl;
- Image->Info.SystemTable = gDxeCoreST;
- Image->Info.ImageBase = (VOID *)(UINTN)DxeCoreImageBaseAddress;
- Image->Info.ImageSize = DxeCoreImageLength;
-
- //
- // Install the protocol interfaces for this image
- //
- Status = CoreInstallProtocolInterface (
- &Image->Handle,
- &gEfiLoadedImageProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &Image->Info
- );
- ASSERT_EFI_ERROR (Status);
-
- mCurrentImage = Image;
-
- //
- // Fill in DXE globals
- //
- gDxeCoreImageHandle = Image->Handle;
- gDxeCoreLoadedImage = &Image->Info;
-
- //
- // Export DXE Core PE Loader functionality
- //
- return CoreInstallProtocolInterface (
- &mLoadPe32PrivateData.Handle,
- &gEfiLoadPeImageProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mLoadPe32PrivateData.Pe32Image
- );
-}
-
-EFI_STATUS
-CoreLoadPeImage (
- IN VOID *Pe32Handle,
- IN LOADED_IMAGE_PRIVATE_DATA *Image,
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,
- IN UINT32 Attribute
- )
-/*++
-
-Routine Description:
-
- Loads, relocates, and invokes a PE/COFF image
-
-Arguments:
-
- Pe32Handle - The handle of PE32 image
- Image - PE image to be loaded
- DstBuffer - The buffer to store the image
- EntryPoint - A pointer to the entry point
- Attribute - The bit mask of attributes to set for the load PE image
-
-Returns:
-
- EFI_SUCCESS - The file was loaded, relocated, and invoked
-
- EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_BUFFER_TOO_SMALL - Buffer for image is too small
-
---*/
-{
- EFI_STATUS Status;
- BOOLEAN DstBufAlocated;
- UINTN Size;
-
- ZeroMem (&Image->ImageContext, sizeof (Image->ImageContext));
-
- Image->ImageContext.Handle = Pe32Handle;
- Image->ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE)CoreReadImageFile;
-
- //
- // Get information about the image being loaded
- //
- Status = gEfiPeiPeCoffLoader->GetImageInfo (gEfiPeiPeCoffLoader, &Image->ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (!EFI_IMAGE_MACHINE_TYPE_SUPPORTED (Image->ImageContext.Machine)) {
- //
- // The PE/COFF loader can support loading image types that can be executed.
- // If we loaded an image type that we can not execute return EFI_UNSUPORTED.
- //
- return EFI_UNSUPPORTED;
- }
-
-
- //
- // Allocate memory of the correct memory type aligned on the required image boundry
- //
- DstBufAlocated = FALSE;
- if (DstBuffer == 0) {
- //
- // Allocate Destination Buffer as caller did not pass it in
- //
-
- if (Image->ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
- Size = (UINTN)Image->ImageContext.ImageSize + Image->ImageContext.SectionAlignment;
- } else {
- Size = (UINTN)Image->ImageContext.ImageSize;
- }
-
- Image->NumberOfPages = EFI_SIZE_TO_PAGES (Size);
-
- //
- // If the image relocations have not been stripped, then load at any address.
- // Otherwise load at the address at which it was linked.
- //
- // Memory below 1MB should be treated reserved for CSM and there should be
- // no modules whose preferred load addresses are below 1MB.
- //
- Status = EFI_OUT_OF_RESOURCES;
- if (Image->ImageContext.ImageAddress >= 0x100000 || Image->ImageContext.RelocationsStripped) {
- Status = CoreAllocatePages (
- AllocateAddress,
- (EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType),
- Image->NumberOfPages,
- &Image->ImageContext.ImageAddress
- );
- }
- if (EFI_ERROR (Status) && !Image->ImageContext.RelocationsStripped) {
- Status = CoreAllocatePages (
- AllocateAnyPages,
- (EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType),
- Image->NumberOfPages,
- &Image->ImageContext.ImageAddress
- );
- }
- if (EFI_ERROR (Status)) {
- return Status;
- }
- DstBufAlocated = TRUE;
- } else {
- //
- // Caller provided the destination buffer
- //
-
- if (Image->ImageContext.RelocationsStripped && (Image->ImageContext.ImageAddress != DstBuffer)) {
- //
- // If the image relocations were stripped, and the caller provided a
- // destination buffer address that does not match the address that the
- // image is linked at, then the image cannot be loaded.
- //
- return EFI_INVALID_PARAMETER;
- }
-
- if (Image->NumberOfPages != 0 &&
- Image->NumberOfPages <
- (EFI_SIZE_TO_PAGES ((UINTN)Image->ImageContext.ImageSize + Image->ImageContext.SectionAlignment))) {
- Image->NumberOfPages = EFI_SIZE_TO_PAGES ((UINTN)Image->ImageContext.ImageSize + Image->ImageContext.SectionAlignment);
- return EFI_BUFFER_TOO_SMALL;
- }
-
- Image->NumberOfPages = EFI_SIZE_TO_PAGES ((UINTN)Image->ImageContext.ImageSize + Image->ImageContext.SectionAlignment);
- Image->ImageContext.ImageAddress = DstBuffer;
- }
-
- Image->ImageBasePage = Image->ImageContext.ImageAddress;
- Image->ImageContext.ImageAddress =
- (Image->ImageContext.ImageAddress + Image->ImageContext.SectionAlignment - 1) &
- ~((UINTN)Image->ImageContext.SectionAlignment - 1);
-
- //
- // Load the image from the file into the allocated memory
- //
- Status = gEfiPeiPeCoffLoader->LoadImage (gEfiPeiPeCoffLoader, &Image->ImageContext);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- //
- // If this is a Runtime Driver, then allocate memory for the FixupData that
- // is used to relocate the image when SetVirtualAddressMap() is called. The
- // relocation is done by the Runtime AP.
- //
- if (Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION) {
- if (Image->ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) {
- Image->ImageContext.FixupData = CoreAllocateRuntimePool ((UINTN)(Image->ImageContext.FixupDataSize));
- if (Image->ImageContext.FixupData == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
- }
- }
-
- //
- // Relocate the image in memory
- //
- Status = gEfiPeiPeCoffLoader->RelocateImage (gEfiPeiPeCoffLoader, &Image->ImageContext);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- //
- // Flush the Instruction Cache
- //
- InvalidateInstructionCacheRange ((VOID *)(UINTN)Image->ImageContext.ImageAddress, (UINTN)Image->ImageContext.ImageSize);
-
- //
- // Copy the machine type from the context to the image private data. This
- // is needed during image unload to know if we should call an EBC protocol
- // to unload the image.
- //
- Image->Machine = Image->ImageContext.Machine;
-
- //
- // Get the image entry point. If it's an EBC image, then call into the
- // interpreter to create a thunk for the entry point and use the returned
- // value for the entry point.
- //
- Image->EntryPoint = (EFI_IMAGE_ENTRY_POINT)(UINTN)Image->ImageContext.EntryPoint;
- if (Image->ImageContext.Machine == EFI_IMAGE_MACHINE_EBC) {
- //
- // Locate the EBC interpreter protocol
- //
- Status = CoreLocateProtocol (&gEfiEbcProtocolGuid, NULL, (VOID **)&Image->Ebc);
- if (EFI_ERROR(Status)) {
- goto Done;
- }
-
- //
- // Register a callback for flushing the instruction cache so that created
- // thunks can be flushed.
- //
- Status = Image->Ebc->RegisterICacheFlush (Image->Ebc, (EBC_ICACHE_FLUSH)InvalidateInstructionCacheRange);
- if (EFI_ERROR(Status)) {
- goto Done;
- }
-
- //
- // Create a thunk for the image's entry point. This will be the new
- // entry point for the image.
- //
- Status = Image->Ebc->CreateThunk (
- Image->Ebc,
- Image->Handle,
- (VOID *)(UINTN)Image->ImageContext.EntryPoint,
- (VOID **)&Image->EntryPoint
- );
- if (EFI_ERROR(Status)) {
- goto Done;
- }
- }
-
- //
- // Fill in the image information for the Loaded Image Protocol
- //
- Image->Type = Image->ImageContext.ImageType;
- Image->Info.ImageBase = (VOID *)(UINTN)Image->ImageContext.ImageAddress;
- Image->Info.ImageSize = Image->ImageContext.ImageSize;
- Image->Info.ImageCodeType = (EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType);
- Image->Info.ImageDataType = (EFI_MEMORY_TYPE) (Image->ImageContext.ImageDataMemoryType);
- if (Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION) {
- if (Image->ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) {
- //
- // Make a list off all the RT images so we can let the RT AP know about them.
- //
- Image->RuntimeData = CoreAllocateRuntimePool (sizeof(EFI_RUNTIME_IMAGE_ENTRY));
- if (Image->RuntimeData == NULL) {
- goto Done;
- }
- Image->RuntimeData->ImageBase = Image->Info.ImageBase;
- Image->RuntimeData->ImageSize = (UINT64) (Image->Info.ImageSize);
- Image->RuntimeData->RelocationData = Image->ImageContext.FixupData;
- Image->RuntimeData->Handle = Image->Handle;
- InsertTailList (&gRuntime->ImageHead, &Image->RuntimeData->Link);
- }
- }
-
- //
- // Fill in the entry point of the image if it is available
- //
- if (EntryPoint != NULL) {
- *EntryPoint = Image->ImageContext.EntryPoint;
- }
-
- //
- // Print the load address and the PDB file name if it is available
- //
-
- DEBUG_CODE_BEGIN ();
-
- UINTN Index;
- UINTN StartIndex;
- CHAR8 EfiFileName[256];
-
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading driver at 0x%10p EntryPoint=0x%10p ", (VOID *)(UINTN)Image->ImageContext.ImageAddress, (VOID *)(UINTN)Image->ImageContext.EntryPoint));
- if (Image->ImageContext.PdbPointer != NULL) {
- StartIndex = 0;
- for (Index = 0; Image->ImageContext.PdbPointer[Index] != 0; Index++) {
- if (Image->ImageContext.PdbPointer[Index] == '\\') {
- StartIndex = Index + 1;
- }
- }
- //
- // Copy the PDB file name to our temporary string, and replace .pdb with .efi
- //
- for (Index = 0; Index < sizeof (EfiFileName); Index++) {
- EfiFileName[Index] = Image->ImageContext.PdbPointer[Index + StartIndex];
- if (EfiFileName[Index] == 0) {
- EfiFileName[Index] = '.';
- }
- if (EfiFileName[Index] == '.') {
- EfiFileName[Index + 1] = 'e';
- EfiFileName[Index + 2] = 'f';
- EfiFileName[Index + 3] = 'i';
- EfiFileName[Index + 4] = 0;
- break;
- }
- }
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "%a", EfiFileName)); // &Image->ImageContext.PdbPointer[StartIndex]));
- }
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "\n"));
-
- DEBUG_CODE_END ();
-
- return EFI_SUCCESS;
-
-Done:
-
- //
- // Free memory.
- //
-
- if (DstBufAlocated) {
- CoreFreePages (Image->ImageContext.ImageAddress, Image->NumberOfPages);
- }
-
- if (Image->ImageContext.FixupData != NULL) {
- CoreFreePool (Image->ImageContext.FixupData);
- }
-
- return Status;
-}
-
-
-LOADED_IMAGE_PRIVATE_DATA *
-CoreLoadedImageInfo (
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- Get the image's private data from its handle.
-
-Arguments:
-
- ImageHandle - The image handle
-
-Returns:
-
- Return the image private data associated with ImageHandle.
-
---*/
-{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
- LOADED_IMAGE_PRIVATE_DATA *Image;
-
- Status = CoreHandleProtocol (
- ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **)&LoadedImage
- );
- if (!EFI_ERROR (Status)) {
- Image = LOADED_IMAGE_PRIVATE_DATA_FROM_THIS (LoadedImage);
- } else {
- DEBUG ((EFI_D_LOAD, "CoreLoadedImageInfo: Not an ImageHandle %x\n", ImageHandle));
- Image = NULL;
- }
-
- return Image;
-}
-
-STATIC
-EFI_STATUS
-CoreLoadImageCommon (
- IN BOOLEAN BootPolicy,
- IN EFI_HANDLE ParentImageHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN VOID *SourceBuffer OPTIONAL,
- IN UINTN SourceSize,
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
- IN OUT UINTN *NumberOfPages OPTIONAL,
- OUT EFI_HANDLE *ImageHandle,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,
- IN UINT32 Attribute
- )
-/*++
-
-Routine Description:
-
- Loads an EFI image into memory and returns a handle to the image.
-
-Arguments:
-
- BootPolicy - If TRUE, indicates that the request originates from the boot manager,
- and that the boot manager is attempting to load FilePath as a boot selection.
- ParentImageHandle - The caller's image handle.
- FilePath - The specific file path from which the image is loaded.
- SourceBuffer - If not NULL, a pointer to the memory location containing a copy of
- the image to be loaded.
- SourceSize - The size in bytes of SourceBuffer.
- DstBuffer - The buffer to store the image
- NumberOfPages - If not NULL, a pointer to the image's page number, if this number
- is not enough, return EFI_BUFFER_TOO_SMALL and this parameter contain
- the required number.
- ImageHandle - Pointer to the returned image handle that is created when the image
- is successfully loaded.
- EntryPoint - A pointer to the entry point
- Attribute - The bit mask of attributes to set for the load PE image
-
-Returns:
-
- EFI_SUCCESS - The image was loaded into memory.
- EFI_NOT_FOUND - The FilePath was not found.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
- EFI_BUFFER_TOO_SMALL - The buffer is too small
- EFI_UNSUPPORTED - The image type is not supported, or the device path cannot be
- parsed to locate the proper protocol for loading the file.
- EFI_OUT_OF_RESOURCES - Image was not loaded due to insufficient resources.
---*/
-{
- LOADED_IMAGE_PRIVATE_DATA *Image;
- LOADED_IMAGE_PRIVATE_DATA *ParentImage;
- IMAGE_FILE_HANDLE FHand;
- EFI_STATUS Status;
- EFI_STATUS SecurityStatus;
- EFI_HANDLE DeviceHandle;
- UINT32 AuthenticationStatus;
- EFI_DEVICE_PATH_PROTOCOL *OriginalFilePath;
- EFI_DEVICE_PATH_PROTOCOL *HandleFilePath;
- UINTN FilePathSize;
-
- SecurityStatus = EFI_SUCCESS;
-
- ASSERT (gEfiCurrentTpl < TPL_NOTIFY);
- ParentImage = NULL;
-
- //
- // The caller must pass in a valid ParentImageHandle
- //
- if (ImageHandle == NULL || ParentImageHandle == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ParentImage = CoreLoadedImageInfo (ParentImageHandle);
- if (ParentImage == NULL) {
- DEBUG((EFI_D_LOAD|EFI_D_ERROR, "LoadImageEx: Parent handle not an image handle\n"));
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Get simple read access to the source file
- //
- OriginalFilePath = FilePath;
- Status = CoreOpenImageFile (
- BootPolicy,
- SourceBuffer,
- SourceSize,
- FilePath,
- &DeviceHandle,
- &FHand,
- &AuthenticationStatus
- );
- if (Status == EFI_ALREADY_STARTED) {
- Image = NULL;
- goto Done;
- } else if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Verify the Authentication Status through the Security Architectural Protocol
- //
- if ((gSecurity != NULL) && (OriginalFilePath != NULL)) {
- SecurityStatus = gSecurity->FileAuthenticationState (
- gSecurity,
- AuthenticationStatus,
- OriginalFilePath
- );
- if (EFI_ERROR (SecurityStatus) && SecurityStatus != EFI_SECURITY_VIOLATION) {
- Status = SecurityStatus;
- Image = NULL;
- goto Done;
- }
- }
-
-
- //
- // Allocate a new image structure
- //
- Image = CoreAllocateZeroBootServicesPool (sizeof(LOADED_IMAGE_PRIVATE_DATA));
- if (Image == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Pull out just the file portion of the DevicePath for the LoadedImage FilePath
- //
- Status = CoreHandleProtocol (DeviceHandle, &gEfiDevicePathProtocolGuid, (VOID **)&HandleFilePath);
- if (!EFI_ERROR (Status)) {
- FilePathSize = CoreDevicePathSize (HandleFilePath) - sizeof(EFI_DEVICE_PATH_PROTOCOL);
- FilePath = (EFI_DEVICE_PATH_PROTOCOL *) ( ((UINT8 *)FilePath) + FilePathSize );
- }
-
- //
- // Initialize the fields for an internal driver
- //
- Image->Signature = LOADED_IMAGE_PRIVATE_DATA_SIGNATURE;
- Image->Info.SystemTable = gDxeCoreST;
- Image->Info.DeviceHandle = DeviceHandle;
- Image->Info.Revision = EFI_LOADED_IMAGE_INFORMATION_REVISION;
- Image->Info.FilePath = CoreDuplicateDevicePath (FilePath);
- Image->Info.ParentHandle = ParentImageHandle;
-
- if (NumberOfPages != NULL) {
- Image->NumberOfPages = *NumberOfPages ;
- } else {
- Image->NumberOfPages = 0 ;
- }
-
- //
- // Install the protocol interfaces for this image
- // don't fire notifications yet
- //
- Status = CoreInstallProtocolInterfaceNotify (
- &Image->Handle,
- &gEfiLoadedImageProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &Image->Info,
- FALSE
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- //
- // Load the image. If EntryPoint is Null, it will not be set.
- //
- Status = CoreLoadPeImage (&FHand, Image, DstBuffer, EntryPoint, Attribute);
- if (EFI_ERROR (Status)) {
- if ((Status == EFI_BUFFER_TOO_SMALL) || (Status == EFI_OUT_OF_RESOURCES)) {
- if (NumberOfPages != NULL) {
- *NumberOfPages = Image->NumberOfPages;
- }
- }
- goto Done;
- }
-
- //
- // Register the image in the Debug Image Info Table if the attribute is set
- //
- if (Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION) {
- CoreNewDebugImageInfoEntry (EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL, &Image->Info, Image->Handle);
- }
-
- //
- //Reinstall loaded image protocol to fire any notifications
- //
- Status = CoreReinstallProtocolInterface (
- Image->Handle,
- &gEfiLoadedImageProtocolGuid,
- &Image->Info,
- &Image->Info
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
-
- //
- // Success. Return the image handle
- //
- *ImageHandle = Image->Handle;
-
-Done:
- //
- // All done accessing the source file
- // If we allocated the Source buffer, free it
- //
- if (FHand.FreeBuffer) {
- CoreFreePool (FHand.Source);
- }
-
- //
- // There was an error. If there's an Image structure, free it
- //
- if (EFI_ERROR (Status)) {
- if (Image != NULL) {
- CoreUnloadAndCloseImage (Image, (BOOLEAN)(DstBuffer == 0));
- *ImageHandle = NULL;
- }
- } else if (EFI_ERROR (SecurityStatus)) {
- Status = SecurityStatus;
- }
-
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreLoadImage (
- IN BOOLEAN BootPolicy,
- IN EFI_HANDLE ParentImageHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN VOID *SourceBuffer OPTIONAL,
- IN UINTN SourceSize,
- OUT EFI_HANDLE *ImageHandle
- )
-/*++
-
-Routine Description:
-
- Loads an EFI image into memory and returns a handle to the image.
-
-Arguments:
-
- BootPolicy - If TRUE, indicates that the request originates from the boot manager,
- and that the boot manager is attempting to load FilePath as a boot selection.
- ParentImageHandle - The caller's image handle.
- FilePath - The specific file path from which the image is loaded.
- SourceBuffer - If not NULL, a pointer to the memory location containing a copy of
- the image to be loaded.
- SourceSize - The size in bytes of SourceBuffer.
- ImageHandle - Pointer to the returned image handle that is created when the image
- is successfully loaded.
-
-Returns:
-
- EFI_SUCCESS - The image was loaded into memory.
- EFI_NOT_FOUND - The FilePath was not found.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
- EFI_UNSUPPORTED - The image type is not supported, or the device path cannot be
- parsed to locate the proper protocol for loading the file.
- EFI_OUT_OF_RESOURCES - Image was not loaded due to insufficient resources.
---*/
-{
- EFI_STATUS Status;
-
- PERF_START (NULL, "LoadImage", NULL, 0);
-
- Status = CoreLoadImageCommon (
- BootPolicy,
- ParentImageHandle,
- FilePath,
- SourceBuffer,
- SourceSize,
- (EFI_PHYSICAL_ADDRESS) (UINTN) NULL,
- NULL,
- ImageHandle,
- NULL,
- EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION | EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION
- );
-
- PERF_END (NULL, "LoadImage", NULL, 0);
-
- return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreLoadImageEx (
- IN EFI_PE32_IMAGE_PROTOCOL *This,
- IN EFI_HANDLE ParentImageHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN VOID *SourceBuffer OPTIONAL,
- IN UINTN SourceSize,
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
- OUT UINTN *NumberOfPages OPTIONAL,
- OUT EFI_HANDLE *ImageHandle,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,
- IN UINT32 Attribute
- )
-/*++
-
-Routine Description:
-
- Loads an EFI image into memory and returns a handle to the image with extended parameters.
-
-Arguments:
-
- This - Calling context
- ParentImageHandle - The caller's image handle.
- FilePath - The specific file path from which the image is loaded.
- SourceBuffer - If not NULL, a pointer to the memory location containing a copy of
- the image to be loaded.
- SourceSize - The size in bytes of SourceBuffer.
- DstBuffer - The buffer to store the image.
- NumberOfPages - For input, specifies the space size of the image by caller if not NULL.
- For output, specifies the actual space size needed.
- ImageHandle - Image handle for output.
- EntryPoint - Image entry point for output.
- Attribute - The bit mask of attributes to set for the load PE image.
-
-Returns:
-
- EFI_SUCCESS - The image was loaded into memory.
- EFI_NOT_FOUND - The FilePath was not found.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
- EFI_UNSUPPORTED - The image type is not supported, or the device path cannot be
- parsed to locate the proper protocol for loading the file.
- EFI_OUT_OF_RESOURCES - Image was not loaded due to insufficient resources.
---*/
-{
- return CoreLoadImageCommon (
- TRUE,
- ParentImageHandle,
- FilePath,
- SourceBuffer,
- SourceSize,
- DstBuffer,
- NumberOfPages,
- ImageHandle,
- EntryPoint,
- Attribute
- );
-}
-
-
-
-
-EFI_STATUS
-EFIAPI
-CoreStartImage (
- IN EFI_HANDLE ImageHandle,
- OUT UINTN *ExitDataSize,
- OUT CHAR16 **ExitData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Transfer control to a loaded image's entry point.
-
-Arguments:
-
- ImageHandle - Handle of image to be started.
-
- ExitDataSize - Pointer of the size to ExitData
-
- ExitData - Pointer to a pointer to a data buffer that includes a Null-terminated
- Unicode string, optionally followed by additional binary data. The string
- is a description that the caller may use to further indicate the reason for
- the image's exit.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Successfully transfer control to the image's entry point.
-
---*/
-{
- EFI_STATUS Status;
- LOADED_IMAGE_PRIVATE_DATA *Image;
- LOADED_IMAGE_PRIVATE_DATA *LastImage;
- UINT64 HandleDatabaseKey;
- UINTN SetJumpFlag;
-
- Image = CoreLoadedImageInfo (ImageHandle);
- if (Image == NULL_HANDLE || Image->Started) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Don't profile Objects or invalid start requests
- //
- PERF_START (ImageHandle, START_IMAGE_TOK, NULL, 0);
-
-
- //
- // Push the current start image context, and
- // link the current image to the head. This is the
- // only image that can call Exit()
- //
- HandleDatabaseKey = CoreGetHandleDatabaseKey ();
- LastImage = mCurrentImage;
- mCurrentImage = Image;
- Image->Tpl = gEfiCurrentTpl;
-
- //
- // Set long jump for Exit() support
- // JumpContext must be aligned on a CPU specific boundary.
- // Overallocate the buffer and force the required alignment
- //
- Image->JumpBuffer = CoreAllocateBootServicesPool (sizeof (BASE_LIBRARY_JUMP_BUFFER) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT);
- if (Image->JumpBuffer == NULL) {
- PERF_END (ImageHandle, START_IMAGE_TOK, NULL, 0);
- return EFI_OUT_OF_RESOURCES;
- }
- Image->JumpContext = ALIGN_POINTER (Image->JumpBuffer, BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT);
-
- SetJumpFlag = SetJump (Image->JumpContext);
- //
- // The initial call to SetJump() must always return 0.
- // Subsequent calls to LongJump() cause a non-zero value to be returned by SetJump().
- //
- if (!SetJumpFlag) {
- //
- // Call the image's entry point
- //
- Image->Started = TRUE;
- Image->Status = Image->EntryPoint (ImageHandle, Image->Info.SystemTable);
-
- //
- // Add some debug information if the image returned with error.
- // This make the user aware and check if the driver image have already released
- // all the resource in this situation.
- //
- DEBUG_CODE_BEGIN ();
- if (EFI_ERROR (Image->Status)) {
- DEBUG ((EFI_D_ERROR, "Error: Image at %10p start failed: %r\n", Image->Info.ImageBase, Image->Status));
- }
- DEBUG_CODE_END ();
-
- //
- // If the image returns, exit it through Exit()
- //
- CoreExit (ImageHandle, Image->Status, 0, NULL);
- }
-
- //
- // Image has completed. Verify the tpl is the same
- //
- ASSERT (Image->Tpl == gEfiCurrentTpl);
- CoreRestoreTpl (Image->Tpl);
-
- CoreFreePool (Image->JumpBuffer);
-
- //
- // Pop the current start image context
- //
- mCurrentImage = LastImage;
-
- //
- // Go connect any handles that were created or modified while the image executed.
- //
- CoreConnectHandlesByKey (HandleDatabaseKey);
-
- //
- // Handle the image's returned ExitData
- //
- DEBUG_CODE_BEGIN ();
- if (Image->ExitDataSize != 0 || Image->ExitData != NULL) {
-
- DEBUG (
- (EFI_D_LOAD,
- "StartImage: ExitDataSize %d, ExitData %x",
- Image->ExitDataSize,
- Image->ExitData)
- );
- if (Image->ExitData != NULL) {
- DEBUG ((EFI_D_LOAD, " (%hs)", Image->ExitData));
- }
- DEBUG ((EFI_D_LOAD, "\n"));
- }
- DEBUG_CODE_END ();
-
- //
- // Return the exit data to the caller
- //
- if (ExitData != NULL && ExitDataSize != NULL) {
- *ExitDataSize = Image->ExitDataSize;
- *ExitData = Image->ExitData;
- } else {
- //
- // Caller doesn't want the exit data, free it
- //
- CoreFreePool (Image->ExitData);
- Image->ExitData = NULL;
- }
-
- //
- // Save the Status because Image will get destroyed if it is unloaded.
- //
- Status = Image->Status;
-
- //
- // If the image returned an error, or if the image is an application
- // unload it
- //
- if (EFI_ERROR (Image->Status) || Image->Type == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
- CoreUnloadAndCloseImage (Image, TRUE);
- }
-
- //
- // Done
- //
- PERF_END (ImageHandle, START_IMAGE_TOK, NULL, 0);
- return Status;
-}
-
-
-VOID
-CoreUnloadAndCloseImage (
- IN LOADED_IMAGE_PRIVATE_DATA *Image,
- IN BOOLEAN FreePage
- )
-/*++
-
-Routine Description:
-
- Unloads EFI image from memory.
-
-Arguments:
-
- Image - EFI image
- FreePage - Free allocated pages
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleIndex;
- EFI_GUID **ProtocolGuidArray;
- UINTN ArrayCount;
- UINTN ProtocolIndex;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo;
- UINTN OpenInfoCount;
- UINTN OpenInfoIndex;
-
- if (Image->Ebc != NULL) {
- //
- // If EBC protocol exists we must perform cleanups for this image.
- //
- Image->Ebc->UnloadImage (Image->Ebc, Image->Handle);
- }
-
- //
- // Unload image, free Image->ImageContext->ModHandle
- //
- gEfiPeiPeCoffLoader->UnloadImage (gEfiPeiPeCoffLoader, &Image->ImageContext);
-
- //
- // Free our references to the image handle
- //
- if (Image->Handle != NULL_HANDLE) {
-
- Status = CoreLocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (!EFI_ERROR (Status)) {
- for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
- Status = CoreProtocolsPerHandle (
- HandleBuffer[HandleIndex],
- &ProtocolGuidArray,
- &ArrayCount
- );
- if (!EFI_ERROR (Status)) {
- for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
- Status = CoreOpenProtocolInformation (
- HandleBuffer[HandleIndex],
- ProtocolGuidArray[ProtocolIndex],
- &OpenInfo,
- &OpenInfoCount
- );
- if (!EFI_ERROR (Status)) {
- for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) {
- if (OpenInfo[OpenInfoIndex].AgentHandle == Image->Handle) {
- Status = CoreCloseProtocol (
- HandleBuffer[HandleIndex],
- ProtocolGuidArray[ProtocolIndex],
- Image->Handle,
- OpenInfo[OpenInfoIndex].ControllerHandle
- );
- }
- }
- if (OpenInfo != NULL) {
- CoreFreePool(OpenInfo);
- }
- }
- }
- if (ProtocolGuidArray != NULL) {
- CoreFreePool(ProtocolGuidArray);
- }
- }
- }
- if (HandleBuffer != NULL) {
- CoreFreePool (HandleBuffer);
- }
- }
-
- CoreRemoveDebugImageInfoEntry (Image->Handle);
-
- Status = CoreUninstallProtocolInterface (
- Image->Handle,
- &gEfiLoadedImageProtocolGuid,
- &Image->Info
- );
- }
-
- if (Image->RuntimeData != NULL) {
- if (Image->RuntimeData->Link.ForwardLink != NULL) {
- //
- // Remove the Image from the Runtime Image list as we are about to Free it!
- //
- RemoveEntryList (&Image->RuntimeData->Link);
- }
- CoreFreePool (Image->RuntimeData);
- }
-
- //
- // Free the Image from memory
- //
- if ((Image->ImageBasePage != 0) && FreePage) {
- CoreFreePages (Image->ImageBasePage, Image->NumberOfPages);
- }
-
- //
- // Done with the Image structure
- //
- if (Image->Info.FilePath != NULL) {
- CoreFreePool (Image->Info.FilePath);
- }
-
- if (Image->FixupData != NULL) {
- CoreFreePool (Image->FixupData);
- }
-
- CoreFreePool (Image);
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreExit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_STATUS Status,
- IN UINTN ExitDataSize,
- IN CHAR16 *ExitData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Terminates the currently loaded EFI image and returns control to boot services.
-
-Arguments:
-
- ImageHandle - Handle that identifies the image. This parameter is passed to the image
- on entry.
- Status - The image's exit code.
- ExitDataSize - The size, in bytes, of ExitData. Ignored if ExitStatus is
- EFI_SUCCESS.
- ExitData - Pointer to a data buffer that includes a Null-terminated Unicode string,
- optionally followed by additional binary data. The string is a
- description that the caller may use to further indicate the reason for
- the image's exit.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Image handle is NULL or it is not current image.
-
- EFI_SUCCESS - Successfully terminates the currently loaded EFI image.
-
- EFI_ACCESS_DENIED - Should never reach there.
-
- EFI_OUT_OF_RESOURCES - Could not allocate pool
-
---*/
-{
- LOADED_IMAGE_PRIVATE_DATA *Image;
- EFI_TPL OldTpl;
-
- //
- // Prevent possible reentrance to this function
- // for the same ImageHandle
- //
- OldTpl = CoreRaiseTpl (TPL_NOTIFY);
-
- Image = CoreLoadedImageInfo (ImageHandle);
- if (Image == NULL_HANDLE) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if (!Image->Started) {
- //
- // The image has not been started so just free its resources
- //
- CoreUnloadAndCloseImage (Image, TRUE);
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- //
- // Image has been started, verify this image can exit
- //
- if (Image != mCurrentImage) {
- DEBUG ((EFI_D_LOAD|EFI_D_ERROR, "Exit: Image is not exitable image\n"));
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- //
- // Set status
- //
- Image->Status = Status;
-
- //
- // If there's ExitData info, move it
- //
- if (ExitData != NULL) {
- Image->ExitDataSize = ExitDataSize;
- Image->ExitData = CoreAllocateBootServicesPool (Image->ExitDataSize);
- if (Image->ExitData == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
- CopyMem (Image->ExitData, ExitData, Image->ExitDataSize);
- }
-
- CoreRestoreTpl (OldTpl);
- //
- // return to StartImage
- //
- LongJump (Image->JumpContext, (UINTN)-1);
-
- //
- // If we return from LongJump, then it is an error
- //
- ASSERT (FALSE);
- Status = EFI_ACCESS_DENIED;
-Done:
- CoreRestoreTpl (OldTpl);
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreUnloadImage (
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- Unloads an image.
-
-Arguments:
-
- ImageHandle - Handle that identifies the image to be unloaded.
-
-Returns:
-
- EFI_SUCCESS - The image has been unloaded.
- EFI_UNSUPPORTED - The image has been sarted, and does not support unload.
- EFI_INVALID_PARAMPETER - ImageHandle is not a valid image handle.
-
---*/
-{
- EFI_STATUS Status;
- LOADED_IMAGE_PRIVATE_DATA *Image;
- EFI_TPL OldTpl;
-
- //
- // Prevent possible reentrance to this function
- // for the same ImageHandle
- //
- OldTpl = CoreRaiseTpl (TPL_NOTIFY);
-
- Image = CoreLoadedImageInfo (ImageHandle);
- if (Image == NULL ) {
- //
- // The image handle is not valid
- //
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if (Image->Started) {
- //
- // The image has been started, request it to unload.
- //
- Status = EFI_UNSUPPORTED;
- if (Image->Info.Unload != NULL) {
- Status = Image->Info.Unload (ImageHandle);
- }
-
- } else {
- //
- // This Image hasn't been started, thus it can be unloaded
- //
- Status = EFI_SUCCESS;
- }
-
-
- if (!EFI_ERROR (Status)) {
- //
- // if the Image was not started or Unloaded O.K. then clean up
- //
- CoreUnloadAndCloseImage (Image, TRUE);
- }
-
-Done:
- CoreRestoreTpl (OldTpl);
- return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreUnloadImageEx (
- IN EFI_PE32_IMAGE_PROTOCOL *This,
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- Unload the specified image.
-
-Arguments:
-
- This - Indicates the calling context.
-
- ImageHandle - The specified image handle.
-
-Returns:
-
- EFI_INVALID_PARAMETER - Image handle is NULL.
-
- EFI_UNSUPPORTED - Attempt to unload an unsupported image.
-
- EFI_SUCCESS - Image successfully unloaded.
-
---*/
-{
- return CoreUnloadImage (ImageHandle);
-}
diff --git a/EdkModulePkg/Core/Dxe/Image/ImageFile.c b/EdkModulePkg/Core/Dxe/Image/ImageFile.c
deleted file mode 100644
index 408688c..0000000
--- a/EdkModulePkg/Core/Dxe/Image/ImageFile.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ImageFile.c
-
-
-Abstract:
-
-
-
-
-Revision History
-
---*/
-
-#include <DxeMain.h>
-
-EFI_STATUS
-CoreOpenImageFile (
- IN BOOLEAN BootPolicy,
- IN VOID *SourceBuffer OPTIONAL,
- IN UINTN SourceSize,
- IN OUT EFI_DEVICE_PATH_PROTOCOL *FilePath,
- OUT EFI_HANDLE *DeviceHandle,
- IN IMAGE_FILE_HANDLE *ImageFileHandle,
- OUT UINT32 *AuthenticationStatus
- )
-/*++
-
-Routine Description:
-
- Opens a file for (simple) reading. The simple read abstraction
- will access the file either from a memory copy, from a file
- system interface, or from the load file interface.
-
-Arguments:
-
- BootPolicy - Policy for Open Image File.
- SourceBuffer - Pointer to the memory location containing copy
- of the image to be loaded.
- SourceSize - The size in bytes of SourceBuffer.
- FilePath - The specific file path from which the image is loaded
- DeviceHandle - Pointer to the return device handle.
- ImageFileHandle - Pointer to the image file handle.
- AuthenticationStatus - Pointer to a caller-allocated UINT32 in which the authentication status is returned.
-
-Returns:
-
- EFI_SUCCESS - Image file successfully opened.
-
- EFI_LOAD_ERROR - If the caller passed a copy of the file, and SourceSize is 0.
-
- EFI_INVALID_PARAMETER - File path is not valid.
-
- EFI_NOT_FOUND - File not found.
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *TempFilePath;
- FILEPATH_DEVICE_PATH *FilePathNode;
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FwVolFilePathNode;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;
- EFI_FILE_HANDLE FileHandle;
- EFI_FILE_HANDLE LastHandle;
- EFI_LOAD_FILE_PROTOCOL *LoadFile;
- EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol;
- EFI_SECTION_TYPE SectionType;
- UINT8 *Pe32Buffer;
- UINTN Pe32BufferSize;
- EFI_FV_FILETYPE Type;
- EFI_FV_FILE_ATTRIBUTES Attrib;
- EFI_FILE_INFO *FileInfo;
- UINTN FileInfoSize;
- EFI_GUID *NameGuid;
-
- *AuthenticationStatus = 0;
- ZeroMem (ImageFileHandle, sizeof (IMAGE_FILE_HANDLE));
- ImageFileHandle->Signature = IMAGE_FILE_HANDLE_SIGNATURE;
-
- //
- // If the caller passed a copy of the file, then just use it
- //
- if (SourceBuffer != NULL) {
- ImageFileHandle->Source = SourceBuffer;
- ImageFileHandle->SourceSize = SourceSize;
- *DeviceHandle = NULL;
- if (SourceSize > 0) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_LOAD_ERROR;
- }
- goto Done;
- }
-
- //
- // Make sure FilePath is valid
- //
- if (FilePath == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Check to see if it's in a Firmware Volume
- //
- FwVolFilePathNode = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)FilePath;
- Status = CoreDevicePathToInterface (
- &gEfiFirmwareVolumeProtocolGuid,
- (EFI_DEVICE_PATH_PROTOCOL **)&FwVolFilePathNode,
- (VOID*)&FwVol,
- DeviceHandle
- );
- if (!EFI_ERROR (Status)) {
- //
- // For FwVol File system there is only a single file name that is a GUID.
- //
- NameGuid = EfiGetNameGuidFromFwVolDevicePathNode (FwVolFilePathNode);
- if (NameGuid != NULL) {
-
- SectionType = EFI_SECTION_PE32;
- Pe32Buffer = NULL;
- Status = FwVol->ReadSection (
- FwVol,
- NameGuid,
- SectionType,
- 0,
- (VOID **)&Pe32Buffer,
- &Pe32BufferSize,
- AuthenticationStatus
- );
- if (EFI_ERROR (Status)) {
- //
- // Try a raw file, since a PE32 SECTION does not exist
- //
- if (Pe32Buffer != NULL) {
- CoreFreePool (Pe32Buffer);
- *AuthenticationStatus = 0;
- }
- Pe32Buffer = NULL;
- Status = FwVol->ReadFile (
- FwVol,
- NameGuid,
- (VOID **)&Pe32Buffer,
- &Pe32BufferSize,
- &Type,
- &Attrib,
- AuthenticationStatus
- );
- }
-
- if (!EFI_ERROR (Status)) {
- //
- // One of the reads passed so we are done
- //
- ImageFileHandle->Source = Pe32Buffer;
- ImageFileHandle->SourceSize = Pe32BufferSize;
- ImageFileHandle->FreeBuffer = TRUE;
- goto Done;
- }
- }
- }
-
- //
- // Attempt to access the file via a file system interface
- //
- FilePathNode = (FILEPATH_DEVICE_PATH *) FilePath;
- Status = CoreDevicePathToInterface (
- &gEfiSimpleFileSystemProtocolGuid,
- (EFI_DEVICE_PATH_PROTOCOL **)&FilePathNode,
- (VOID*)&Volume,
- DeviceHandle
- );
- if (!EFI_ERROR (Status)) {
- //
- // Open the Volume to get the File System handle
- //
- Status = Volume->OpenVolume (Volume, &FileHandle);
- if (!EFI_ERROR (Status)) {
-
- //
- // Parse each MEDIA_FILEPATH_DP node. There may be more than one, since the
- // directory information and filename can be seperate. The goal is to inch
- // our way down each device path node and close the previous node
- //
- while (!IsDevicePathEnd (&FilePathNode->Header)) {
- if (DevicePathType (&FilePathNode->Header) != MEDIA_DEVICE_PATH ||
- DevicePathSubType (&FilePathNode->Header) != MEDIA_FILEPATH_DP) {
- Status = EFI_UNSUPPORTED;
- }
-
- if (EFI_ERROR (Status)) {
- //
- // Exit loop on Error
- //
- break;
- }
-
- LastHandle = FileHandle;
- FileHandle = NULL;
- Status = LastHandle->Open (
- LastHandle,
- &FileHandle,
- FilePathNode->PathName,
- EFI_FILE_MODE_READ,
- 0
- );
-
- //
- // Close the previous node
- //
- LastHandle->Close (LastHandle);
-
- FilePathNode = (FILEPATH_DEVICE_PATH *) NextDevicePathNode (&FilePathNode->Header);
- }
-
- if (!EFI_ERROR (Status)) {
- //
- // We have found the file. Now we need to read it. Before we can read the file we need to
- // figure out how big the file is.
- //
- FileInfo = NULL;
- FileInfoSize = sizeof (EFI_FILE_INFO);
- while (CoreGrowBuffer (&Status, (VOID **)&FileInfo, FileInfoSize)) {
- //
- // Automatically allocate buffer of the correct size and make the call
- //
- Status = FileHandle->GetInfo (
- FileHandle,
- &gEfiFileInfoGuid,
- &FileInfoSize,
- FileInfo
- );
- }
- if (!EFI_ERROR (Status)) {
- //
- // Allocate space for the file
- //
- ImageFileHandle->Source = CoreAllocateBootServicesPool ((UINTN)FileInfo->FileSize);
- if (ImageFileHandle->Source != NULL) {
- //
- // Read the file into the buffer we allocated
- //
- ImageFileHandle->SourceSize = (UINTN)FileInfo->FileSize;
- ImageFileHandle->FreeBuffer = TRUE;
- Status = FileHandle->Read (FileHandle, &ImageFileHandle->SourceSize, ImageFileHandle->Source);
-
- //
- // Close the file since we are done
- //
- FileHandle->Close (FileHandle);
- } else {
- Status = EFI_OUT_OF_RESOURCES;
- }
-
- goto Done;
- }
- }
- }
- }
-
-
- //
- // Try LoadFile style
- //
-
- TempFilePath = FilePath;
- Status = CoreDevicePathToInterface (
- &gEfiLoadFileProtocolGuid,
- &TempFilePath,
- (VOID*)&LoadFile,
- DeviceHandle
- );
- if (!EFI_ERROR (Status)) {
- //
- // Call LoadFile with the correct buffer size
- //
- while (CoreGrowBuffer (&Status, (VOID **)&ImageFileHandle->Source, ImageFileHandle->SourceSize)) {
- Status = LoadFile->LoadFile (
- LoadFile,
- TempFilePath,
- BootPolicy,
- &ImageFileHandle->SourceSize,
- ImageFileHandle->Source
- );
- //
- // If success or other error happens, stop loop
- //
- if (Status != EFI_BUFFER_TOO_SMALL) {
- break;
- }
- }
-
- if (!EFI_ERROR (Status) || Status == EFI_ALREADY_STARTED) {
- ImageFileHandle->FreeBuffer = TRUE;
- goto Done;
- }
- }
-
- //
- // Nothing else to try
- //
- DEBUG ((EFI_D_LOAD|EFI_D_WARN, "CoreOpenImageFile: Device did not support a known load protocol\n"));
- Status = EFI_NOT_FOUND;
-
-Done:
-
- //
- // If the file was not accessed, clean up
- //
- if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
- if (ImageFileHandle->FreeBuffer) {
- //
- // Free the source buffer if we allocated it
- //
- CoreFreePool (ImageFileHandle->Source);
- }
- }
-
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreReadImageFile (
- IN VOID *UserHandle,
- IN UINTN Offset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Read image file (specified by UserHandle) into user specified buffer with specified offset
- and length.
-
-Arguments:
-
- UserHandle - Image file handle
-
- Offset - Offset to the source file
-
- ReadSize - For input, pointer of size to read;
- For output, pointer of size actually read.
-
- Buffer - Buffer to write into
-
-Returns:
-
- EFI_SUCCESS - Successfully read the specified part of file into buffer.
-
---*/
-{
- UINTN EndPosition;
- IMAGE_FILE_HANDLE *FHand;
-
- FHand = (IMAGE_FILE_HANDLE *)UserHandle;
- ASSERT (FHand->Signature == IMAGE_FILE_HANDLE_SIGNATURE);
-
- //
- // Move data from our local copy of the file
- //
- EndPosition = Offset + *ReadSize;
- if (EndPosition > FHand->SourceSize) {
- *ReadSize = (UINT32)(FHand->SourceSize - Offset);
- }
- if (Offset >= FHand->SourceSize) {
- *ReadSize = 0;
- }
-
- CopyMem (Buffer, (CHAR8 *)FHand->Source + Offset, *ReadSize);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CoreDevicePathToInterface (
- IN EFI_GUID *Protocol,
- IN EFI_DEVICE_PATH_PROTOCOL **FilePath,
- OUT VOID **Interface,
- OUT EFI_HANDLE *Handle
- )
-/*++
-
-Routine Description:
-
- Search a handle to a device on a specified device path that supports a specified protocol,
- interface of that protocol on that handle is another output.
-
-Arguments:
-
- Protocol - The protocol to search for
-
- FilePath - The specified device path
-
- Interface - Interface of the protocol on the handle
-
- Handle - The handle to the device on the specified device path that supports the protocol.
-
-Returns:
-
- Status code.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = CoreLocateDevicePath (Protocol, FilePath, Handle);
- if (!EFI_ERROR (Status)) {
- Status = CoreHandleProtocol (*Handle, Protocol, Interface);
- }
- return Status;
-}
-
-BOOLEAN
-CoreGrowBuffer (
- IN OUT EFI_STATUS *Status,
- IN OUT VOID **Buffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
-
- Helper function called as part of the code needed
- to allocate the proper sized buffer for various
- EFI interfaces.
-
-Arguments:
-
- Status - Current status
-
- Buffer - Current allocated buffer, or NULL
-
- BufferSize - Current buffer size needed
-
-Returns:
-
- TRUE - if the buffer was reallocated and the caller
- should try the API again.
-
- FALSE - buffer could not be allocated and the caller
- should not try the API again.
-
---*/
-{
- BOOLEAN TryAgain;
-
- TryAgain = FALSE;
- //
- // If this is an initial request, buffer will be null with a new buffer size
- //
- if (*Buffer == NULL) {
- *Status = EFI_BUFFER_TOO_SMALL;
- }
-
- if (BufferSize == 0) {
- return TRUE;
- }
-
- //
- // If the status code is "buffer too small", resize the buffer
- //
-
- if (*Status == EFI_BUFFER_TOO_SMALL) {
- if (*Buffer != NULL) {
- CoreFreePool (*Buffer);
- }
-
- *Buffer = CoreAllocateBootServicesPool (BufferSize);
- if (*Buffer != NULL) {
- TryAgain = TRUE;
- } else {
- *Status = EFI_OUT_OF_RESOURCES;
- }
- }
-
- //
- // If there's an error, free the buffer
- //
- if ((!TryAgain) && (EFI_ERROR (*Status)) && (*Buffer)) {
- CoreFreePool (*Buffer);
- *Buffer = NULL;
- }
-
- return TryAgain;
-}
-
diff --git a/EdkModulePkg/Core/Dxe/Library.h b/EdkModulePkg/Core/Dxe/Library.h
deleted file mode 100644
index 5e33da5..0000000
--- a/EdkModulePkg/Core/Dxe/Library.h
+++ /dev/null
@@ -1,407 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Library.h
-
-Abstract:
-
-Revision History
-
---*/
-
-#ifndef _DXE_LIBRARY_H_
-#define _DXE_LIBRARY_H_
-
-
-VOID
-CoreReportProgressCode (
- IN EFI_STATUS_CODE_VALUE Value
- )
-/*++
-
-Routine Description:
-
- Report status code of type EFI_PROGRESS_CODE by caller ID gEfiDxeServicesTableGuid.
-
-Arguments:
-
- Value - Describes the class/subclass/operation of the hardware or software entity
- that the Status Code relates to.
-
-Returns:
-
- None
-
---*/
-;
-
-VOID
-CoreReportProgressCodeSpecific (
- IN EFI_STATUS_CODE_VALUE Value,
- IN EFI_HANDLE Handle
- )
-/*++
-
-Routine Description:
-
- Report status code of type EFI_PROGRESS_CODE by caller ID gEfiDxeServicesTableGuid,
- with a handle as additional information.
-
-Arguments:
-
- Value - Describes the class/subclass/operation of the hardware or software entity
- that the Status Code relates to.
-
- Handle - Additional information.
-
-Returns:
-
- None
-
---*/
-;
-
-VOID
-CoreAcquireLock (
- IN EFI_LOCK *Lock
- )
-/*++
-
-Routine Description:
-
- Raising to the task priority level of the mutual exclusion
- lock, and then acquires ownership of the lock.
-
-Arguments:
-
- Lock - The lock to acquire
-
-Returns:
-
- Lock owned
-
---*/
-;
-
-EFI_STATUS
-CoreAcquireLockOrFail (
- IN EFI_LOCK *Lock
- )
-/*++
-
-Routine Description:
-
- Initialize a basic mutual exclusion lock. Each lock
- provides mutual exclusion access at it's task priority
- level. Since there is no-premption (at any TPL) or
- multiprocessor support, acquiring the lock only consists
- of raising to the locks TPL.
-
-Arguments:
-
- Lock - The EFI_LOCK structure to initialize
-
-Returns:
-
- EFI_SUCCESS - Lock Owned.
- EFI_ACCESS_DENIED - Reentrant Lock Acquisition, Lock not Owned.
-
---*/
-;
-
-VOID
-CoreReleaseLock (
- IN EFI_LOCK *Lock
- )
-/*++
-
-Routine Description:
-
- Releases ownership of the mutual exclusion lock, and
- restores the previous task priority level.
-
-Arguments:
-
- Lock - The lock to release
-
-Returns:
-
- Lock unowned
-
---*/
-;
-
-//
-// Device Path functions
-//
-
-UINTN
-CoreDevicePathSize (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
-
- Calculate the size of a whole device path.
-
-Arguments:
-
- DevicePath - The pointer to the device path data.
-
-Returns:
-
- Size of device path data structure..
-
---*/
-;
-
-BOOLEAN
-CoreIsDevicePathMultiInstance (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Return TRUE is this is a multi instance device path.
-
-Arguments:
- DevicePath - A pointer to a device path data structure.
-
-
-Returns:
- TRUE - If DevicePath is multi instance. FALSE - If DevicePath is not multi
- instance.
-
---*/
-;
-
-
-EFI_DEVICE_PATH_PROTOCOL *
-CoreDuplicateDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Duplicate a new device path data structure from the old one.
-
-Arguments:
- DevicePath - A pointer to a device path data structure.
-
-Returns:
- A pointer to the new allocated device path data.
- Caller must free the memory used by DevicePath if it is no longer needed.
-
---*/
-;
-
-EFI_DEVICE_PATH_PROTOCOL *
-CoreAppendDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *Src1,
- IN EFI_DEVICE_PATH_PROTOCOL *Node
- )
-/*++
-
-Routine Description:
- Function is used to append a Src1 and Src2 together.
-
-Arguments:
- Src1 - A pointer to a device path data structure.
-
- Node - A pointer to a device path data structure.
-
-Returns:
-
- A pointer to the new device path is returned.
- NULL is returned if space for the new device path could not be allocated from pool.
- It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed.
-
---*/
-;
-
-VOID *
-CoreAllocateBootServicesPool (
- IN UINTN AllocationSize
- )
-/*++
-
-Routine Description:
-
- Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize.
-
-Arguments:
-
- AllocationSize - Size to allocate.
-
-Returns:
-
- Pointer of the allocated pool.
-
---*/
-;
-
-VOID *
-CoreAllocateZeroBootServicesPool (
- IN UINTN AllocationSize
- )
-/*++
-
-Routine Description:
-
- Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize.
-
-Arguments:
-
- AllocationSize - Size to allocate.
-
-Returns:
-
- Pointer of the allocated pool.
-
---*/
-;
-
-EFI_STATUS
-CoreGetConfigTable (
- IN EFI_GUID *Guid,
- IN OUT VOID **Table
- )
-/*++
-
-Routine Description:
-
- Find a config table by name in system table's ConfigurationTable.
-
-Arguments:
-
- Guid - The table name to look for
-
- Table - Pointer of the config table
-
-Returns:
-
- EFI_NOT_FOUND - Could not find the table in system table's ConfigurationTable.
-
- EFI_SUCCESS - Table successfully found.
-
---*/
-;
-
-VOID *
-CoreAllocateRuntimeCopyPool (
- IN UINTN AllocationSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool.
-
-Arguments:
-
- AllocationSize - Size to allocate.
-
- Buffer - Specified buffer that will be copy to the allocated pool
-
-Returns:
-
- Pointer of the allocated pool.
-
---*/
-;
-
-VOID *
-CoreAllocateRuntimePool (
- IN UINTN AllocationSize
- )
-/*++
-
-Routine Description:
-
- Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize.
-
-Arguments:
-
- AllocationSize - Size to allocate.
-
-Returns:
-
- Pointer of the allocated pool.
-
---*/
-;
-
-VOID *
-CoreAllocateCopyPool (
- IN UINTN AllocationSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool.
-
-Arguments:
-
- AllocationSize - Size to allocate.
-
- Buffer - Specified buffer that will be copy to the allocated pool
-
-Returns:
-
- Pointer of the allocated pool.
-
---*/
-;
-
-EFI_EVENT
-CoreCreateProtocolNotifyEvent (
- IN EFI_GUID *ProtocolGuid,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction,
- IN VOID *NotifyContext,
- OUT VOID **Registration,
- IN BOOLEAN SignalFlag
- )
-/*++
-
-Routine Description:
-
- Create a protocol notification event and return it.
-
-Arguments:
-
- ProtocolGuid - Protocol to register notification event on.
-
- NotifyTpl - Maximum TPL to signal the NotifyFunction.
-
- NotifyFuncition - EFI notification routine.
-
- NotifyContext - Context passed into Event when it is created.
-
- Registration - Registration key returned from RegisterProtocolNotify().
-
- SignalFlag - Boolean value to decide whether kick the event after register or not.
-
-Returns:
-
- The EFI_EVENT that has been registered to be signaled when a ProtocolGuid
- is added to the system.
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Core/Dxe/Library/Library.c b/EdkModulePkg/Core/Dxe/Library/Library.c
deleted file mode 100644
index 3d8a312..0000000
--- a/EdkModulePkg/Core/Dxe/Library/Library.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Library.c
-
-Abstract:
-
- DXE Core library services.
-
---*/
-
-#include <DxeMain.h>
-
-UINTN mErrorLevel = EFI_D_ERROR | EFI_D_LOAD;
-
-EFI_DEVICE_HANDLE_EXTENDED_DATA mStatusCodeData = {
- {
- sizeof (EFI_STATUS_CODE_DATA),
- 0,
- EFI_STATUS_CODE_SPECIFIC_DATA_GUID
- },
- NULL
-};
-
-VOID
-CoreReportProgressCodeSpecific (
- IN EFI_STATUS_CODE_VALUE Value,
- IN EFI_HANDLE Handle
- )
-/*++
-
-Routine Description:
-
- Report status code of type EFI_PROGRESS_CODE by caller ID gEfiDxeServicesTableGuid,
- with a handle as additional information.
-
-Arguments:
-
- Value - Describes the class/subclass/operation of the hardware or software entity
- that the Status Code relates to.
-
- Handle - Additional information.
-
-Returns:
-
- None
-
---*/
-{
- mStatusCodeData.DataHeader.Size = sizeof (EFI_DEVICE_HANDLE_EXTENDED_DATA) - sizeof (EFI_STATUS_CODE_DATA);
- mStatusCodeData.Handle = Handle;
-
- if ((gStatusCode != NULL) && (gStatusCode->ReportStatusCode != NULL) ) {
- gStatusCode->ReportStatusCode (
- EFI_PROGRESS_CODE,
- Value,
- 0,
- &gEfiDxeServicesTableGuid,
- (EFI_STATUS_CODE_DATA *) &mStatusCodeData
- );
- }
-}
-
-VOID
-CoreReportProgressCode (
- IN EFI_STATUS_CODE_VALUE Value
- )
-/*++
-
-Routine Description:
-
- Report status code of type EFI_PROGRESS_CODE by caller ID gEfiDxeServicesTableGuid.
-
-Arguments:
-
- Value - Describes the class/subclass/operation of the hardware or software entity
- that the Status Code relates to.
-
-Returns:
-
- None
-
---*/
-{
- if ((gStatusCode != NULL) && (gStatusCode->ReportStatusCode != NULL) ) {
- gStatusCode->ReportStatusCode (
- EFI_PROGRESS_CODE,
- Value,
- 0,
- &gEfiDxeServicesTableGuid,
- NULL
- );
- }
-}
-
-
-VOID *
-CoreAllocateBootServicesPool (
- IN UINTN AllocationSize
- )
-/*++
-
-Routine Description:
-
- Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize.
-
-Arguments:
-
- AllocationSize - Size to allocate.
-
-Returns:
-
- Pointer of the allocated pool.
-
---*/
-{
- VOID *Memory;
-
- CoreAllocatePool (EfiBootServicesData, AllocationSize, &Memory);
- return Memory;
-}
-
-
-VOID *
-CoreAllocateZeroBootServicesPool (
- IN UINTN AllocationSize
- )
-/*++
-
-Routine Description:
-
- Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize.
-
-Arguments:
-
- AllocationSize - Size to allocate.
-
-Returns:
-
- Pointer of the allocated pool.
-
---*/
-{
- VOID *Memory;
-
- Memory = CoreAllocateBootServicesPool (AllocationSize);
- SetMem (Memory, (Memory == NULL) ? 0 : AllocationSize, 0);
- return Memory;
-}
-
-
-VOID *
-CoreAllocateCopyPool (
- IN UINTN AllocationSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool.
-
-Arguments:
-
- AllocationSize - Size to allocate.
-
- Buffer - Specified buffer that will be copy to the allocated pool
-
-Returns:
-
- Pointer of the allocated pool.
-
---*/
-{
- VOID *Memory;
-
- Memory = CoreAllocateBootServicesPool (AllocationSize);
- CopyMem (Memory, Buffer, (Memory == NULL) ? 0 : AllocationSize);
-
- return Memory;
-}
-
-
-
-VOID *
-CoreAllocateRuntimePool (
- IN UINTN AllocationSize
- )
-/*++
-
-Routine Description:
-
- Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize.
-
-Arguments:
-
- AllocationSize - Size to allocate.
-
-Returns:
-
- Pointer of the allocated pool.
-
---*/
-{
- VOID *Memory;
-
- CoreAllocatePool (EfiRuntimeServicesData, AllocationSize, &Memory);
- return Memory;
-}
-
-VOID *
-CoreAllocateRuntimeCopyPool (
- IN UINTN AllocationSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool.
-
-Arguments:
-
- AllocationSize - Size to allocate.
-
- Buffer - Specified buffer that will be copy to the allocated pool
-
-Returns:
-
- Pointer of the allocated pool.
-
---*/
-
-{
- VOID *Memory;
-
- Memory = CoreAllocateRuntimePool (AllocationSize);
- CopyMem (Memory, Buffer, (Memory == NULL) ? 0 : AllocationSize);
-
- return Memory;
-}
-
-
-
-//
-// Lock Stuff
-//
-
-
-
-EFI_STATUS
-CoreAcquireLockOrFail (
- IN EFI_LOCK *Lock
- )
-/*++
-
-Routine Description:
-
- Initialize a basic mutual exclusion lock. Each lock
- provides mutual exclusion access at it's task priority
- level. Since there is no-premption (at any TPL) or
- multiprocessor support, acquiring the lock only consists
- of raising to the locks TPL.
-
-Arguments:
-
- Lock - The EFI_LOCK structure to initialize
-
-Returns:
-
- EFI_SUCCESS - Lock Owned.
- EFI_ACCESS_DENIED - Reentrant Lock Acquisition, Lock not Owned.
-
---*/
-{
- ASSERT (Lock != NULL);
- ASSERT (Lock->Lock != EfiLockUninitialized);
-
- if (Lock->Lock == EfiLockAcquired) {
- //
- // Lock is already owned, so bail out
- //
- return EFI_ACCESS_DENIED;
- }
-
- Lock->OwnerTpl = CoreRaiseTpl (Lock->Tpl);
-
- Lock->Lock = EfiLockAcquired;
- return EFI_SUCCESS;
-}
-
-
-VOID
-CoreAcquireLock (
- IN EFI_LOCK *Lock
- )
-/*++
-
-Routine Description:
-
- Raising to the task priority level of the mutual exclusion
- lock, and then acquires ownership of the lock.
-
-Arguments:
-
- Lock - The lock to acquire
-
-Returns:
-
- Lock owned
-
---*/
-{
- ASSERT (Lock != NULL);
- ASSERT (Lock->Lock == EfiLockReleased);
-
- Lock->OwnerTpl = CoreRaiseTpl (Lock->Tpl);
- Lock->Lock = EfiLockAcquired;
-}
-
-
-VOID
-CoreReleaseLock (
- IN EFI_LOCK *Lock
- )
-/*++
-
-Routine Description:
-
- Releases ownership of the mutual exclusion lock, and
- restores the previous task priority level.
-
-Arguments:
-
- Lock - The lock to release
-
-Returns:
-
- Lock unowned
-
---*/
-{
- EFI_TPL Tpl;
-
- ASSERT (Lock != NULL);
- ASSERT (Lock->Lock == EfiLockAcquired);
-
- Tpl = Lock->OwnerTpl;
-
- Lock->Lock = EfiLockReleased;
-
- CoreRestoreTpl (Tpl);
-}
-
-
-UINTN
-CoreDevicePathSize (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
-
- Calculate the size of a whole device path.
-
-Arguments:
-
- DevicePath - The pointer to the device path data.
-
-Returns:
-
- Size of device path data structure..
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *Start;
-
- if (DevicePath == NULL) {
- return 0;
- }
-
- //
- // Search for the end of the device path structure
- //
- Start = DevicePath;
- while (!EfiIsDevicePathEnd (DevicePath)) {
- DevicePath = EfiNextDevicePathNode (DevicePath);
- }
-
- //
- // Compute the size and add back in the size of the end device path structure
- //
- return ((UINTN)DevicePath - (UINTN)Start) + sizeof(EFI_DEVICE_PATH_PROTOCOL);
-}
-
-
-BOOLEAN
-CoreIsDevicePathMultiInstance (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Return TRUE is this is a multi instance device path.
-
-Arguments:
- DevicePath - A pointer to a device path data structure.
-
-
-Returns:
- TRUE - If DevicePath is multi instance. FALSE - If DevicePath is not multi
- instance.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *Node;
-
- if (DevicePath == NULL) {
- return FALSE;
- }
-
- Node = DevicePath;
- while (!EfiIsDevicePathEnd (Node)) {
- if (EfiIsDevicePathEndInstance (Node)) {
- return TRUE;
- }
- Node = EfiNextDevicePathNode (Node);
- }
- return FALSE;
-}
-
-
-
-EFI_DEVICE_PATH_PROTOCOL *
-CoreDuplicateDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Duplicate a new device path data structure from the old one.
-
-Arguments:
- DevicePath - A pointer to a device path data structure.
-
-Returns:
- A pointer to the new allocated device path data.
- Caller must free the memory used by DevicePath if it is no longer needed.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- UINTN Size;
-
- if (DevicePath == NULL) {
- return NULL;
- }
-
- //
- // Compute the size
- //
- Size = CoreDevicePathSize (DevicePath);
-
- //
- // Allocate space for duplicate device path
- //
- NewDevicePath = CoreAllocateCopyPool (Size, DevicePath);
-
- return NewDevicePath;
-}
-
-
-
-EFI_DEVICE_PATH_PROTOCOL *
-CoreAppendDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *Src1,
- IN EFI_DEVICE_PATH_PROTOCOL *Src2
- )
-/*++
-
-Routine Description:
- Function is used to append a Src1 and Src2 together.
-
-Arguments:
- Src1 - A pointer to a device path data structure.
-
- Src2 - A pointer to a device path data structure.
-
-Returns:
-
- A pointer to the new device path is returned.
- NULL is returned if space for the new device path could not be allocated from pool.
- It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed.
-
---*/
-{
- UINTN Size;
- UINTN Size1;
- UINTN Size2;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath;
-
- if (Src1 == NULL && Src2 == NULL) {
- return NULL;
- }
-
- //
- // Allocate space for the combined device path. It only has one end node of
- // length EFI_DEVICE_PATH_PROTOCOL
- //
- Size1 = CoreDevicePathSize (Src1);
- Size2 = CoreDevicePathSize (Src2);
- Size = Size1 + Size2 - sizeof(EFI_DEVICE_PATH_PROTOCOL);
-
- NewDevicePath = CoreAllocateCopyPool (Size, Src1);
- if (NewDevicePath != NULL) {
-
- //
- // Over write Src1 EndNode and do the copy
- //
- SecondDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)((CHAR8 *)NewDevicePath + (Size1 - sizeof(EFI_DEVICE_PATH_PROTOCOL)));
- CopyMem (SecondDevicePath, Src2, Size2);
- }
-
- return NewDevicePath;
-}
-
-
-
-EFI_EVENT
-CoreCreateProtocolNotifyEvent (
- IN EFI_GUID *ProtocolGuid,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction,
- IN VOID *NotifyContext,
- OUT VOID **Registration,
- IN BOOLEAN SignalFlag
- )
-/*++
-
-Routine Description:
-
- Create a protocol notification event and return it.
-
-Arguments:
-
- ProtocolGuid - Protocol to register notification event on.
-
- NotifyTpl - Maximum TPL to signal the NotifyFunction.
-
- NotifyFuncition - EFI notification routine.
-
- NotifyContext - Context passed into Event when it is created.
-
- Registration - Registration key returned from RegisterProtocolNotify().
-
- SignalFlag - Boolean value to decide whether kick the event after register or not.
-
-Returns:
-
- The EFI_EVENT that has been registered to be signaled when a ProtocolGuid
- is added to the system.
-
---*/
-{
- EFI_STATUS Status;
- EFI_EVENT Event;
-
- //
- // Create the event
- //
-
- Status = CoreCreateEvent (
- EVT_NOTIFY_SIGNAL,
- NotifyTpl,
- NotifyFunction,
- NotifyContext,
- &Event
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Register for protocol notifactions on this event
- //
-
- Status = CoreRegisterProtocolNotify (
- ProtocolGuid,
- Event,
- Registration
- );
- ASSERT_EFI_ERROR (Status);
-
- if (SignalFlag) {
- //
- // Kick the event so we will perform an initial pass of
- // current installed drivers
- //
- CoreSignalEvent (Event);
- }
-
- return Event;
-}
-
diff --git a/EdkModulePkg/Core/Dxe/Mem/Page.c b/EdkModulePkg/Core/Dxe/Mem/Page.c
deleted file mode 100644
index c4f3274..0000000
--- a/EdkModulePkg/Core/Dxe/Mem/Page.c
+++ /dev/null
@@ -1,1656 +0,0 @@
-/*++
-
-Copyright (c) 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- page.c
-
-Abstract:
-
- EFI Memory page management
-
-
-Revision History
-
---*/
-
-#include <DxeMain.h>
-
-#define EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
-
-//
-// Entry for tracking the memory regions for each memory type to help cooalese like memory types
-//
-typedef struct {
- EFI_PHYSICAL_ADDRESS BaseAddress;
- EFI_PHYSICAL_ADDRESS MaximumAddress;
- UINT64 CurrentNumberOfPages;
- UINTN InformationIndex;
-} EFI_MEMORY_TYPE_STAISTICS;
-
-//
-// MemoryMap - The current memory map
-//
-UINTN mMemoryMapKey = 0;
-
-//
-// mMapStack - space to use as temp storage to build new map descriptors
-// mMapDepth - depth of new descriptor stack
-//
-
-#define MAX_MAP_DEPTH 6
-UINTN mMapDepth = 0;
-MEMORY_MAP mMapStack[MAX_MAP_DEPTH];
-UINTN mFreeMapStack = 0;
-//
-// This list maintain the free memory map list
-//
-LIST_ENTRY mFreeMemoryMapEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mFreeMemoryMapEntryList);
-BOOLEAN mMemoryTypeInformationInitialized = FALSE;
-
-EFI_MEMORY_TYPE_STAISTICS mMemoryTypeStatistics[EfiMaxMemoryType + 1] = {
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiReservedMemoryType
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiLoaderCode
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiLoaderData
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiBootServicesCode
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiBootServicesData
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiRuntimeServicesCode
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiRuntimeServicesData
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiConventionalMemory
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiUnusableMemory
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiACPIReclaimMemory
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiACPIMemoryNVS
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiMemoryMappedIO
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiMemoryMappedIOPortSpace
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType }, // EfiPalCode
- { 0, EFI_MAX_ADDRESS, 0, EfiMaxMemoryType } // EfiMaxMemoryType
-};
-
-EFI_PHYSICAL_ADDRESS mDefaultMaximumAddress = EFI_MAX_ADDRESS;
-
-EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1] = {
- { EfiReservedMemoryType, 0 },
- { EfiLoaderCode, 0 },
- { EfiLoaderData, 0 },
- { EfiBootServicesCode, 0 },
- { EfiBootServicesData, 0 },
- { EfiRuntimeServicesCode, 0 },
- { EfiRuntimeServicesData, 0 },
- { EfiConventionalMemory, 0 },
- { EfiUnusableMemory, 0 },
- { EfiACPIReclaimMemory, 0 },
- { EfiACPIMemoryNVS, 0 },
- { EfiMemoryMappedIO, 0 },
- { EfiMemoryMappedIOPortSpace, 0 },
- { EfiPalCode, 0 },
- { EfiMaxMemoryType, 0 }
-};
-
-//
-// Internal prototypes
-//
-STATIC
-VOID
-PromoteMemoryResource (
- VOID
-);
-
-STATIC
-VOID
-CoreAddRange (
- IN EFI_MEMORY_TYPE Type,
- IN EFI_PHYSICAL_ADDRESS Start,
- IN EFI_PHYSICAL_ADDRESS End,
- IN UINT64 Attribute
- );
-
-STATIC
-VOID
-CoreFreeMemoryMapStack (
- VOID
- );
-
-STATIC
-EFI_STATUS
-CoreConvertPages (
- IN UINT64 Start,
- IN UINT64 NumberOfPages,
- IN EFI_MEMORY_TYPE NewType
- );
-
-STATIC
-VOID
-RemoveMemoryMapEntry (
- MEMORY_MAP *Entry
- );
-
-STATIC
-MEMORY_MAP *
-AllocateMemoryMapEntry (
- VOID
- );
-
-VOID
-CoreAcquireMemoryLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Enter critical section by gaining lock on gMemoryLock
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- CoreAcquireLock (&gMemoryLock);
-}
-
-
-VOID
-CoreReleaseMemoryLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Exit critical section by releasing lock on gMemoryLock
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- CoreReleaseLock (&gMemoryLock);
-}
-
-STATIC
-VOID
-PromoteMemoryResource (
- VOID
- )
-/*++
-
-Routine Description:
-
- Find untested but initialized memory regions in GCD map and convert them to be DXE allocatable.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- LIST_ENTRY *Link;
- EFI_GCD_MAP_ENTRY *Entry;
-
- DEBUG ((EFI_D_ERROR | EFI_D_PAGE, "Promote the memory resource\n"));
-
- CoreAcquireGcdMemoryLock ();
-
- Link = mGcdMemorySpaceMap.ForwardLink;
- while (Link != &mGcdMemorySpaceMap) {
-
- Entry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
-
- if (Entry->GcdMemoryType == EfiGcdMemoryTypeReserved &&
- Entry->EndAddress < EFI_MAX_ADDRESS &&
- (Entry->Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) ==
- (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED)) {
- //
- // Update the GCD map
- //
- Entry->GcdMemoryType = EfiGcdMemoryTypeSystemMemory;
- Entry->Capabilities |= EFI_MEMORY_TESTED;
- Entry->ImageHandle = gDxeCoreImageHandle;
- Entry->DeviceHandle = NULL;
-
- //
- // Add to allocable system memory resource
- //
-
- CoreAddRange (
- EfiConventionalMemory,
- Entry->BaseAddress,
- Entry->EndAddress,
- Entry->Capabilities & ~(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)
- );
- CoreFreeMemoryMapStack ();
-
- }
-
- Link = Link->ForwardLink;
- }
-
- CoreReleaseGcdMemoryLock ();
-
- return;
-}
-
-VOID
-CoreAddMemoryDescriptor (
- IN EFI_MEMORY_TYPE Type,
- IN EFI_PHYSICAL_ADDRESS Start,
- IN UINT64 NumberOfPages,
- IN UINT64 Attribute
- )
-/*++
-
-Routine Description:
-
- Called to initialize the memory map and add descriptors to
- the current descriptor list.
-
- The first descriptor that is added must be general usable
- memory as the addition allocates heap.
-
-Arguments:
-
- Type - The type of memory to add
-
- Start - The starting address in the memory range
- Must be page aligned
-
- NumberOfPages - The number of pages in the range
-
- Attribute - Attributes of the memory to add
-
-Returns:
-
- None. The range is added to the memory map
-
---*/
-{
- EFI_PHYSICAL_ADDRESS End;
- EFI_STATUS Status;
- UINTN Index;
- UINTN FreeIndex;
-
- if ((Start & EFI_PAGE_MASK) != 0) {
- return;
- }
-
- if (Type >= EfiMaxMemoryType && Type <= 0x7fffffff) {
- return;
- }
-
- CoreAcquireMemoryLock ();
- End = Start + LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT) - 1;
- CoreAddRange (Type, Start, End, Attribute);
- CoreFreeMemoryMapStack ();
- CoreReleaseMemoryLock ();
-
- //
- // Check to see if the statistics for the different memory types have already been established
- //
- if (mMemoryTypeInformationInitialized) {
- return;
- }
-
- //
- // Loop through each memory type in the order specified by the gMemoryTypeInformation[] array
- //
- for (Index = 0; gMemoryTypeInformation[Index].Type != EfiMaxMemoryType; Index++) {
- //
- // Make sure the memory type in the gMemoryTypeInformation[] array is valid
- //
- Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type);
- if (Type < 0 || Type > EfiMaxMemoryType) {
- continue;
- }
-
- if (gMemoryTypeInformation[Index].NumberOfPages != 0) {
- //
- // Allocate pages for the current memory type from the top of available memory
- //
- Status = CoreAllocatePages (
- AllocateAnyPages,
- Type,
- gMemoryTypeInformation[Index].NumberOfPages,
- &mMemoryTypeStatistics[Type].BaseAddress
- );
- if (EFI_ERROR (Status)) {
- //
- // If an error occurs allocating the pages for the current memory type, then
- // free all the pages allocates for the previous memory types and return. This
- // operation with be retied when/if more memory is added to the system
- //
- for (FreeIndex = 0; FreeIndex < Index; FreeIndex++) {
- //
- // Make sure the memory type in the gMemoryTypeInformation[] array is valid
- //
- Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[FreeIndex].Type);
- if (Type < 0 || Type > EfiMaxMemoryType) {
- continue;
- }
-
- if (gMemoryTypeInformation[FreeIndex].NumberOfPages != 0) {
- CoreFreePages (
- mMemoryTypeStatistics[Type].BaseAddress,
- gMemoryTypeInformation[FreeIndex].NumberOfPages
- );
- mMemoryTypeStatistics[Type].BaseAddress = 0;
- mMemoryTypeStatistics[Type].MaximumAddress = EFI_MAX_ADDRESS;
- }
- }
- return;
- }
-
- //
- // Compute the address at the top of the current statistics
- //
- mMemoryTypeStatistics[Type].MaximumAddress =
- mMemoryTypeStatistics[Type].BaseAddress +
- LShiftU64 (gMemoryTypeInformation[Index].NumberOfPages, EFI_PAGE_SHIFT) - 1;
-
- //
- // If the current base address is the lowest address so far, then update the default
- // maximum address
- //
- if (mMemoryTypeStatistics[Type].BaseAddress < mDefaultMaximumAddress) {
- mDefaultMaximumAddress = mMemoryTypeStatistics[Type].BaseAddress - 1;
- }
- }
- }
-
- //
- // There was enough system memory for all the the memory types were allocated. So,
- // those memory areas can be freed for future allocations, and all future memory
- // allocations can occur within their respective bins
- //
- for (Index = 0; gMemoryTypeInformation[Index].Type != EfiMaxMemoryType; Index++) {
- //
- // Make sure the memory type in the gMemoryTypeInformation[] array is valid
- //
- Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type);
- if (Type < 0 || Type > EfiMaxMemoryType) {
- continue;
- }
-
- if (gMemoryTypeInformation[Index].NumberOfPages != 0) {
- CoreFreePages (
- mMemoryTypeStatistics[Type].BaseAddress,
- gMemoryTypeInformation[Index].NumberOfPages
- );
- gMemoryTypeInformation[Index].NumberOfPages = 0;
- }
- }
-
- //
- // If the number of pages reserved for a memory type is 0, then all allocations for that type
- // should be in the default range.
- //
- for (Type = (EFI_MEMORY_TYPE) 0; Type < EfiMaxMemoryType; Type++) {
- for (Index = 0; gMemoryTypeInformation[Index].Type != EfiMaxMemoryType; Index++) {
- if (Type == (EFI_MEMORY_TYPE)gMemoryTypeInformation[Index].Type) {
- mMemoryTypeStatistics[Type].InformationIndex = Index;
- }
- }
- mMemoryTypeStatistics[Type].CurrentNumberOfPages = 0;
- if (mMemoryTypeStatistics[Type].MaximumAddress == EFI_MAX_ADDRESS) {
- mMemoryTypeStatistics[Type].MaximumAddress = mDefaultMaximumAddress;
- }
- }
-
- mMemoryTypeInformationInitialized = TRUE;
-}
-
-
-STATIC
-VOID
-CoreAddRange (
- IN EFI_MEMORY_TYPE Type,
- IN EFI_PHYSICAL_ADDRESS Start,
- IN EFI_PHYSICAL_ADDRESS End,
- IN UINT64 Attribute
- )
-/*++
-
-Routine Description:
-
- Internal function. Adds a ranges to the memory map.
- The range must not already exist in the map.
-
-Arguments:
-
- Type - The type of memory range to add
-
- Start - The starting address in the memory range
- Must be paged aligned
-
- End - The last address in the range
- Must be the last byte of a page
-
- Attribute - The attributes of the memory range to add
-
-Returns:
-
- None. The range is added to the memory map
-
---*/
-{
- LIST_ENTRY *Link;
- MEMORY_MAP *Entry;
-
- ASSERT ((Start & EFI_PAGE_MASK) == 0);
- ASSERT (End > Start) ;
-
- ASSERT_LOCKED (&gMemoryLock);
-
- DEBUG ((EFI_D_PAGE, "AddRange: %lx-%lx to %d\n", Start, End, Type));
-
- //
- // Memory map being altered so updated key
- //
- mMemoryMapKey += 1;
-
- //
- // UEFI 2.0 added an event group for notificaiton on memory map changes.
- // So we need to signal this Event Group every time the memory map changes.
- // If we are in EFI 1.10 compatability mode no event groups will be
- // found and nothing will happen we we call this function. These events
- // will get signaled but since a lock is held around the call to this
- // function the notificaiton events will only be called after this funciton
- // returns and the lock is released.
- //
- CoreNotifySignalList (&gEfiEventMemoryMapChangeGuid);
-
- //
- // Look for adjoining memory descriptor
- //
-
- // Two memory descriptors can only be merged if they have the same Type
- // and the same Attribute
- //
-
- Link = gMemoryMap.ForwardLink;
- while (Link != &gMemoryMap) {
- Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
- Link = Link->ForwardLink;
-
- if (Entry->Type != Type) {
- continue;
- }
-
- if (Entry->Attribute != Attribute) {
- continue;
- }
-
- if (Entry->End + 1 == Start) {
-
- Start = Entry->Start;
- RemoveMemoryMapEntry (Entry);
-
- } else if (Entry->Start == End + 1) {
-
- End = Entry->End;
- RemoveMemoryMapEntry (Entry);
- }
- }
-
- //
- // Add descriptor
- //
-
- mMapStack[mMapDepth].Signature = MEMORY_MAP_SIGNATURE;
- mMapStack[mMapDepth].FromPages = FALSE;
- mMapStack[mMapDepth].Type = Type;
- mMapStack[mMapDepth].Start = Start;
- mMapStack[mMapDepth].End = End;
- mMapStack[mMapDepth].VirtualStart = 0;
- mMapStack[mMapDepth].Attribute = Attribute;
- InsertTailList (&gMemoryMap, &mMapStack[mMapDepth].Link);
-
- mMapDepth += 1;
- ASSERT (mMapDepth < MAX_MAP_DEPTH);
-
- return ;
-}
-
-STATIC
-VOID
-CoreFreeMemoryMapStack (
- VOID
- )
-/*++
-
-Routine Description:
-
- Internal function. Moves any memory descriptors that are on the
- temporary descriptor stack to heap.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- MEMORY_MAP *Entry;
- MEMORY_MAP *Entry2;
- LIST_ENTRY *Link2;
-
- ASSERT_LOCKED (&gMemoryLock);
-
- //
- // If already freeing the map stack, then return
- //
- if (mFreeMapStack) {
- return ;
- }
-
- //
- // Move the temporary memory descriptor stack into pool
- //
- mFreeMapStack += 1;
-
- while (mMapDepth) {
- //
- // Deque an memory map entry from mFreeMemoryMapEntryList
- //
- Entry = AllocateMemoryMapEntry ();
-
- ASSERT (Entry);
-
- //
- // Update to proper entry
- //
- mMapDepth -= 1;
-
- if (mMapStack[mMapDepth].Link.ForwardLink != NULL) {
-
- //
- // Move this entry to general memory
- //
- RemoveEntryList (&mMapStack[mMapDepth].Link);
- mMapStack[mMapDepth].Link.ForwardLink = NULL;
-
- CopyMem (Entry , &mMapStack[mMapDepth], sizeof (MEMORY_MAP));
- Entry->FromPages = TRUE;
-
- //
- // Find insertion location
- //
- for (Link2 = gMemoryMap.ForwardLink; Link2 != &gMemoryMap; Link2 = Link2->ForwardLink) {
- Entry2 = CR (Link2, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
- if (Entry2->FromPages && Entry2->Start > Entry->Start) {
- break;
- }
- }
-
- InsertTailList (Link2, &Entry->Link);
-
- } else {
- //
- // This item of mMapStack[mMapDepth] has already been dequeued from gMemoryMap list,
- // so here no need to move it to memory.
- //
- InsertTailList (&mFreeMemoryMapEntryList, &Entry->Link);
- }
- }
-
- mFreeMapStack -= 1;
-}
-
-STATIC
-VOID
-RemoveMemoryMapEntry (
- MEMORY_MAP *Entry
- )
-/*++
-
-Routine Description:
-
- Internal function. Removes a descriptor entry.
-
-Arguments:
-
- Entry - The entry to remove
-
-Returns:
-
- None
-
---*/
-{
- RemoveEntryList (&Entry->Link);
- Entry->Link.ForwardLink = NULL;
-
- if (Entry->FromPages) {
- //
- // Insert the free memory map descriptor to the end of mFreeMemoryMapEntryList
- //
- InsertTailList (&mFreeMemoryMapEntryList, &Entry->Link);
- }
-}
-
-STATIC
-MEMORY_MAP *
-AllocateMemoryMapEntry (
- VOID
- )
-/*++
-
-Routine Description:
-
- Internal function. Deque a descriptor entry from the mFreeMemoryMapEntryList.
- If the list is emtry, then allocate a new page to refuel the list.
- Please Note this algorithm to allocate the memory map descriptor has a property
- that the memory allocated for memory entries always grows, and will never really be freed
- For example, if the current boot uses 2000 memory map entries at the maximum point, but
- ends up with only 50 at the time the OS is booted, then the memory associated with the 1950
- memory map entries is still allocated from EfiBootServicesMemory.
-
-Arguments:
-
- NONE
-
-Returns:
-
- The Memory map descriptor dequed from the mFreeMemoryMapEntryList
-
---*/
-{
- MEMORY_MAP* FreeDescriptorEntries;
- MEMORY_MAP* Entry;
- UINTN Index;
-
- if (IsListEmpty (&mFreeMemoryMapEntryList)) {
- //
- // The list is empty, to allocate one page to refuel the list
- //
- FreeDescriptorEntries = CoreAllocatePoolPages (EfiBootServicesData, EFI_SIZE_TO_PAGES(DEFAULT_PAGE_ALLOCATION), DEFAULT_PAGE_ALLOCATION);
- if(FreeDescriptorEntries != NULL) {
- //
- // Enque the free memmory map entries into the list
- //
- for (Index = 0; Index< DEFAULT_PAGE_ALLOCATION / sizeof(MEMORY_MAP); Index++) {
- FreeDescriptorEntries[Index].Signature = MEMORY_MAP_SIGNATURE;
- InsertTailList (&mFreeMemoryMapEntryList, &FreeDescriptorEntries[Index].Link);
- }
- } else {
- return NULL;
- }
- }
- //
- // dequeue the first descriptor from the list
- //
- Entry = CR (mFreeMemoryMapEntryList.ForwardLink, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
- RemoveEntryList (&Entry->Link);
-
- return Entry;
-}
-
-STATIC
-EFI_STATUS
-CoreConvertPages (
- IN UINT64 Start,
- IN UINT64 NumberOfPages,
- IN EFI_MEMORY_TYPE NewType
- )
-/*++
-
-Routine Description:
-
- Internal function. Converts a memory range to the specified type.
- The range must exist in the memory map.
-
-Arguments:
-
- Start - The first address of the range
- Must be page aligned
-
- NumberOfPages - The number of pages to convert
-
- NewType - The new type for the memory range
-
-Returns:
-
- EFI_INVALID_PARAMETER - Invalid parameter
-
- EFI_NOT_FOUND - Could not find a descriptor cover the specified range
- or convertion not allowed.
-
- EFI_SUCCESS - Successfully converts the memory range to the specified type.
-
---*/
-{
-
- UINT64 NumberOfBytes;
- UINT64 End;
- UINT64 RangeEnd;
- UINT64 Attribute;
- LIST_ENTRY *Link;
- MEMORY_MAP *Entry;
-
- Entry = NULL;
- NumberOfBytes = LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT);
- End = Start + NumberOfBytes - 1;
-
- ASSERT (NumberOfPages);
- ASSERT ((Start & EFI_PAGE_MASK) == 0);
- ASSERT (End > Start) ;
- ASSERT_LOCKED (&gMemoryLock);
-
- if (NumberOfPages == 0 || (Start & EFI_PAGE_MASK ) || (Start > (Start + NumberOfBytes))) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Convert the entire range
- //
-
- while (Start < End) {
-
- //
- // Find the entry that the covers the range
- //
- for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
- Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
-
- if (Entry->Start <= Start && Entry->End > Start) {
- break;
- }
- }
-
- if (Link == &gMemoryMap) {
- DEBUG ((EFI_D_ERROR | EFI_D_PAGE, "ConvertPages: failed to find range %lx - %lx\n", Start, End));
- return EFI_NOT_FOUND;
- }
-
- //
- // Convert range to the end, or to the end of the descriptor
- // if that's all we've got
- //
- RangeEnd = End;
- if (Entry->End < End) {
- RangeEnd = Entry->End;
- }
-
- DEBUG ((EFI_D_PAGE, "ConvertRange: %lx-%lx to %d\n", Start, RangeEnd, NewType));
-
- //
- // Debug code - verify conversion is allowed
- //
- if (!(NewType == EfiConventionalMemory ? 1 : 0) ^ (Entry->Type == EfiConventionalMemory ? 1 : 0)) {
- DEBUG ((EFI_D_ERROR , "ConvertPages: Incompatible memory types\n"));
- return EFI_NOT_FOUND;
- }
-
- //
- // Update counters for the number of pages allocated to each memory type
- //
- if (Entry->Type >= 0 && Entry->Type < EfiMaxMemoryType) {
- if (Start >= mMemoryTypeStatistics[Entry->Type].BaseAddress &&
- Start <= mMemoryTypeStatistics[Entry->Type].MaximumAddress) {
- if (NumberOfPages > mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages) {
- mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages = 0;
- } else {
- mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages -= NumberOfPages;
- }
- }
- }
-
- if (NewType >= 0 && NewType < EfiMaxMemoryType) {
- if (Start >= mMemoryTypeStatistics[NewType].BaseAddress && Start <= mMemoryTypeStatistics[NewType].MaximumAddress) {
- mMemoryTypeStatistics[NewType].CurrentNumberOfPages += NumberOfPages;
- if (mMemoryTypeStatistics[NewType].CurrentNumberOfPages >
- gMemoryTypeInformation[mMemoryTypeStatistics[NewType].InformationIndex].NumberOfPages) {
- gMemoryTypeInformation[mMemoryTypeStatistics[NewType].InformationIndex].NumberOfPages = (UINT32)mMemoryTypeStatistics[NewType].CurrentNumberOfPages;
- }
- }
- }
-
- //
- // Pull range out of descriptor
- //
- if (Entry->Start == Start) {
-
- //
- // Clip start
- //
- Entry->Start = RangeEnd + 1;
-
- } else if (Entry->End == RangeEnd) {
-
- //
- // Clip end
- //
- Entry->End = Start - 1;
-
- } else {
-
- //
- // Pull it out of the center, clip current
- //
-
- //
- // Add a new one
- //
- mMapStack[mMapDepth].Signature = MEMORY_MAP_SIGNATURE;
- mMapStack[mMapDepth].FromPages = FALSE;
- mMapStack[mMapDepth].Type = Entry->Type;
- mMapStack[mMapDepth].Start = RangeEnd+1;
- mMapStack[mMapDepth].End = Entry->End;
-
- //
- // Inherit Attribute from the Memory Descriptor that is being clipped
- //
- mMapStack[mMapDepth].Attribute = Entry->Attribute;
-
- Entry->End = Start - 1;
- ASSERT (Entry->Start < Entry->End);
-
- Entry = &mMapStack[mMapDepth];
- InsertTailList (&gMemoryMap, &Entry->Link);
-
- mMapDepth += 1;
- ASSERT (mMapDepth < MAX_MAP_DEPTH);
- }
-
- //
- // The new range inherits the same Attribute as the Entry
- //it is being cut out of
- //
- Attribute = Entry->Attribute;
-
- //
- // If the descriptor is empty, then remove it from the map
- //
- if (Entry->Start == Entry->End + 1) {
- RemoveMemoryMapEntry (Entry);
- Entry = NULL;
- }
-
- //
- // Add our new range in
- //
- CoreAddRange (NewType, Start, RangeEnd, Attribute);
-
- //
- // Move any map descriptor stack to general pool
- //
- CoreFreeMemoryMapStack ();
-
- //
- // Bump the starting address, and convert the next range
- //
- Start = RangeEnd + 1;
- }
-
- //
- // Converted the whole range, done
- //
-
- return EFI_SUCCESS;
-}
-
-
-STATIC
-UINT64
-CoreFindFreePagesI (
- IN UINT64 MaxAddress,
- IN UINT64 NumberOfPages,
- IN EFI_MEMORY_TYPE NewType,
- IN UINTN Alignment
- )
-/*++
-
-Routine Description:
-
- Internal function. Finds a consecutive free page range below
- the requested address.
-
-Arguments:
-
- MaxAddress - The address that the range must be below
-
- NumberOfPages - Number of pages needed
-
- NewType - The type of memory the range is going to be turned into
-
- Alignment - Bits to align with
-
-Returns:
-
- The base address of the range, or 0 if the range was not found
-
---*/
-{
- UINT64 NumberOfBytes;
- UINT64 Target;
- UINT64 DescStart;
- UINT64 DescEnd;
- UINT64 DescNumberOfBytes;
- LIST_ENTRY *Link;
- MEMORY_MAP *Entry;
-
- if ((MaxAddress < EFI_PAGE_MASK) ||(NumberOfPages == 0)) {
- return 0;
- }
-
- if ((MaxAddress & EFI_PAGE_MASK) != EFI_PAGE_MASK) {
-
- //
- // If MaxAddress is not aligned to the end of a page
- //
-
- //
- // Change MaxAddress to be 1 page lower
- //
- MaxAddress -= (EFI_PAGE_MASK + 1);
-
- //
- // Set MaxAddress to a page boundary
- //
- MaxAddress &= ~EFI_PAGE_MASK;
-
- //
- // Set MaxAddress to end of the page
- //
- MaxAddress |= EFI_PAGE_MASK;
- }
-
- NumberOfBytes = LShiftU64 (NumberOfPages, EFI_PAGE_SHIFT);
- Target = 0;
-
- for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
- Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
-
- //
- // If it's not a free entry, don't bother with it
- //
- if (Entry->Type != EfiConventionalMemory) {
- continue;
- }
-
- DescStart = Entry->Start;
- DescEnd = Entry->End;
-
- //
- // If desc is past max allowed address, skip it
- //
- if (DescStart >= MaxAddress) {
- continue;
- }
-
- //
- // If desc ends past max allowed address, clip the end
- //
- if (DescEnd >= MaxAddress) {
- DescEnd = MaxAddress;
- }
-
- DescEnd = ((DescEnd + 1) & (~(Alignment - 1))) - 1;
-
- //
- // Compute the number of bytes we can used from this
- // descriptor, and see it's enough to satisfy the request
- //
- DescNumberOfBytes = DescEnd - DescStart + 1;
-
- if (DescNumberOfBytes >= NumberOfBytes) {
-
- //
- // If this is the best match so far remember it
- //
- if (DescEnd > Target) {
- Target = DescEnd;
- }
- }
- }
-
- //
- // If this is a grow down, adjust target to be the allocation base
- //
- Target -= NumberOfBytes - 1;
-
- //
- // If we didn't find a match, return 0
- //
- if ((Target & EFI_PAGE_MASK) != 0) {
- return 0;
- }
-
- return Target;
-}
-
-STATIC
-UINT64
-FindFreePages (
- IN UINT64 MaxAddress,
- IN UINT64 NoPages,
- IN EFI_MEMORY_TYPE NewType,
- IN UINTN Alignment
- )
-/*++
-
-Routine Description:
-
- Internal function. Finds a consecutive free page range below
- the requested address
-
-Arguments:
-
- MaxAddress - The address that the range must be below
-
- NoPages - Number of pages needed
-
- NewType - The type of memory the range is going to be turned into
-
- Alignment - Bits to align with
-
-Returns:
-
- The base address of the range, or 0 if the range was not found.
-
---*/
-{
- UINT64 NewMaxAddress;
- UINT64 Start;
-
- NewMaxAddress = MaxAddress;
-
- if (NewType >= 0 && NewType < EfiMaxMemoryType && NewMaxAddress >= mMemoryTypeStatistics[NewType].MaximumAddress) {
- NewMaxAddress = mMemoryTypeStatistics[NewType].MaximumAddress;
- } else {
- if (NewMaxAddress > mDefaultMaximumAddress) {
- NewMaxAddress = mDefaultMaximumAddress;
- }
- }
-
- Start = CoreFindFreePagesI (NewMaxAddress, NoPages, NewType, Alignment);
- if (!Start) {
- Start = CoreFindFreePagesI (MaxAddress, NoPages, NewType, Alignment);
- if (!Start) {
- //
- // Here means there may be no enough memory to use, so try to go through
- // all the memory descript to promote the untested memory directly
- //
- PromoteMemoryResource ();
-
- //
- // Allocate memory again after the memory resource re-arranged
- //
- Start = CoreFindFreePagesI (MaxAddress, NoPages, NewType, Alignment);
- }
- }
-
- return Start;
-}
-
-
-EFI_STATUS
-EFIAPI
-CoreAllocatePages (
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN NumberOfPages,
- IN OUT EFI_PHYSICAL_ADDRESS *Memory
- )
-/*++
-
-Routine Description:
-
- Allocates pages from the memory map.
-
-Arguments:
-
- Type - The type of allocation to perform
-
- MemoryType - The type of memory to turn the allocated pages into
-
- NumberOfPages - The number of pages to allocate
-
- Memory - A pointer to receive the base allocated memory address
-
-Returns:
-
- Status. On success, Memory is filled in with the base address allocated
-
- EFI_INVALID_PARAMETER - Parameters violate checking rules defined in spec.
-
- EFI_NOT_FOUND - Could not allocate pages match the requirement.
-
- EFI_OUT_OF_RESOURCES - No enough pages to allocate.
-
- EFI_SUCCESS - Pages successfully allocated.
-
---*/
-{
- EFI_STATUS Status;
- UINT64 Start;
- UINT64 MaxAddress;
- UINTN Alignment;
-
- if (Type < AllocateAnyPages || Type >= (UINTN) MaxAllocateType) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((MemoryType >= EfiMaxMemoryType && MemoryType <= 0x7fffffff) ||
- MemoryType == EfiConventionalMemory) {
- return EFI_INVALID_PARAMETER;
- }
-
- Alignment = EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT;
-
- if (MemoryType == EfiACPIReclaimMemory ||
- MemoryType == EfiACPIMemoryNVS ||
- MemoryType == EfiRuntimeServicesCode ||
- MemoryType == EfiRuntimeServicesData) {
-
- Alignment = EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT;
- }
-
- if (Type == AllocateAddress) {
- if ((*Memory & (Alignment - 1)) != 0) {
- return EFI_NOT_FOUND;
- }
- }
-
- NumberOfPages += EFI_SIZE_TO_PAGES (Alignment) - 1;
- NumberOfPages &= ~(EFI_SIZE_TO_PAGES (Alignment) - 1);
-
- //
- // If this is for below a particular address, then
- //
- Start = *Memory;
-
- //
- // The max address is the max natively addressable address for the processor
- //
- MaxAddress = EFI_MAX_ADDRESS;
-
- if (Type == AllocateMaxAddress) {
- MaxAddress = Start;
- }
-
- CoreAcquireMemoryLock ();
-
- //
- // If not a specific address, then find an address to allocate
- //
- if (Type != AllocateAddress) {
- Start = FindFreePages (MaxAddress, NumberOfPages, MemoryType, Alignment);
- if (Start == 0) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
- }
-
- //
- // Convert pages from FreeMemory to the requested type
- //
- Status = CoreConvertPages (Start, NumberOfPages, MemoryType);
-
-Done:
- CoreReleaseMemoryLock ();
-
- if (!EFI_ERROR (Status)) {
- *Memory = Start;
- }
-
- return Status;
-}
-
-
-
-
-EFI_STATUS
-EFIAPI
-CoreFreePages (
- IN EFI_PHYSICAL_ADDRESS Memory,
- IN UINTN NumberOfPages
- )
-/*++
-
-Routine Description:
-
- Frees previous allocated pages.
-
-Arguments:
-
- Memory - Base address of memory being freed
-
- NumberOfPages - The number of pages to free
-
-Returns:
-
- EFI_NOT_FOUND - Could not find the entry that covers the range
-
- EFI_INVALID_PARAMETER - Address not aligned
-
- EFI_SUCCESS -Pages successfully freed.
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- MEMORY_MAP *Entry;
- UINTN Alignment;
-
- //
- // Free the range
- //
- CoreAcquireMemoryLock ();
-
- //
- // Find the entry that the covers the range
- //
- Entry = NULL;
- for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
- Entry = CR(Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
- if (Entry->Start <= Memory && Entry->End > Memory) {
- break;
- }
- }
- if (Link == &gMemoryMap) {
- CoreReleaseMemoryLock ();
- return EFI_NOT_FOUND;
- }
-
- Alignment = EFI_DEFAULT_PAGE_ALLOCATION_ALIGNMENT;
-
- if (Entry->Type == EfiACPIReclaimMemory ||
- Entry->Type == EfiACPIMemoryNVS ||
- Entry->Type == EfiRuntimeServicesCode ||
- Entry->Type == EfiRuntimeServicesData) {
-
- Alignment = EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT;
-
- }
-
- if ((Memory & (Alignment - 1)) != 0) {
- CoreReleaseMemoryLock ();
- return EFI_INVALID_PARAMETER;
- }
-
- NumberOfPages += EFI_SIZE_TO_PAGES (Alignment) - 1;
- NumberOfPages &= ~(EFI_SIZE_TO_PAGES (Alignment) - 1);
-
- Status = CoreConvertPages (Memory, NumberOfPages, EfiConventionalMemory);
-
- CoreReleaseMemoryLock ();
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Destroy the contents
- //
- if (Memory < EFI_MAX_ADDRESS) {
- DEBUG_CLEAR_MEMORY ((VOID *)(UINTN)Memory, NumberOfPages << EFI_PAGE_SHIFT);
- }
-
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreGetMemoryMap (
- IN OUT UINTN *MemoryMapSize,
- IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
- OUT UINTN *MapKey,
- OUT UINTN *DescriptorSize,
- OUT UINT32 *DescriptorVersion
- )
-/*++
-
-Routine Description:
-
- This function returns a copy of the current memory map. The map is an array of
- memory descriptors, each of which describes a contiguous block of memory.
-
-Arguments:
-
- MemoryMapSize - A pointer to the size, in bytes, of the MemoryMap buffer. On
- input, this is the size of the buffer allocated by the caller.
- On output, it is the size of the buffer returned by the firmware
- if the buffer was large enough, or the size of the buffer needed
- to contain the map if the buffer was too small.
- MemoryMap - A pointer to the buffer in which firmware places the current memory map.
- MapKey - A pointer to the location in which firmware returns the key for the
- current memory map.
- DescriptorSize - A pointer to the location in which firmware returns the size, in
- bytes, of an individual EFI_MEMORY_DESCRIPTOR.
- DescriptorVersion - A pointer to the location in which firmware returns the version
- number associated with the EFI_MEMORY_DESCRIPTOR.
-
-Returns:
-
- EFI_SUCCESS - The memory map was returned in the MemoryMap buffer.
- EFI_BUFFER_TOO_SMALL - The MemoryMap buffer was too small. The current buffer size
- needed to hold the memory map is returned in MemoryMapSize.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Size;
- UINTN BufferSize;
- UINTN NumberOfRuntimeEntries;
- LIST_ENTRY *Link;
- MEMORY_MAP *Entry;
- EFI_GCD_MAP_ENTRY *GcdMapEntry;
-
- //
- // Make sure the parameters are valid
- //
- if (MemoryMapSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- CoreAcquireGcdMemoryLock ();
-
- //
- // Count the number of Reserved and MMIO entries that are marked for runtime use
- //
- NumberOfRuntimeEntries = 0;
- for (Link = mGcdMemorySpaceMap.ForwardLink; Link != &mGcdMemorySpaceMap; Link = Link->ForwardLink) {
- GcdMapEntry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- if ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) ||
- (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo)) {
- if ((GcdMapEntry->Attributes & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) {
- NumberOfRuntimeEntries++;
- }
- }
- }
-
- Size = sizeof (EFI_MEMORY_DESCRIPTOR);
-
- //
- // Make sure Size != sizeof(EFI_MEMORY_DESCRIPTOR). This will
- // prevent people from having pointer math bugs in their code.
- // now you have to use *DescriptorSize to make things work.
- //
- Size += sizeof(UINT64) - (Size % sizeof (UINT64));
-
- if (DescriptorSize != NULL) {
- *DescriptorSize = Size;
- }
-
- if (DescriptorVersion != NULL) {
- *DescriptorVersion = EFI_MEMORY_DESCRIPTOR_VERSION;
- }
-
- CoreAcquireMemoryLock ();
-
- //
- // Compute the buffer size needed to fit the entire map
- //
- BufferSize = Size * NumberOfRuntimeEntries;
- for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
- BufferSize += Size;
- }
-
- if (*MemoryMapSize < BufferSize) {
- Status = EFI_BUFFER_TOO_SMALL;
- goto Done;
- }
-
- if (MemoryMap == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- //
- // Build the map
- //
- ZeroMem (MemoryMap, Size);
- for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
- Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
- ASSERT (Entry->VirtualStart == 0);
-
- MemoryMap->Type = Entry->Type;
- MemoryMap->PhysicalStart = Entry->Start;
- MemoryMap->VirtualStart = Entry->VirtualStart;
- MemoryMap->NumberOfPages = RShiftU64 (Entry->End - Entry->Start + 1, EFI_PAGE_SHIFT);
-
- switch (Entry->Type) {
- case EfiRuntimeServicesCode:
- case EfiRuntimeServicesData:
- case EfiPalCode:
- MemoryMap->Attribute = Entry->Attribute | EFI_MEMORY_RUNTIME;
- break;
-
- default:
- MemoryMap->Attribute = Entry->Attribute;
- break;
- }
-
- MemoryMap = NextMemoryDescriptor (MemoryMap, Size);
- }
-
- for (Link = mGcdMemorySpaceMap.ForwardLink; Link != &mGcdMemorySpaceMap; Link = Link->ForwardLink) {
- GcdMapEntry = CR (Link, EFI_GCD_MAP_ENTRY, Link, EFI_GCD_MAP_SIGNATURE);
- if ((GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) ||
- (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo)) {
- if ((GcdMapEntry->Attributes & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) {
-
- MemoryMap->PhysicalStart = GcdMapEntry->BaseAddress;
- MemoryMap->VirtualStart = 0;
- MemoryMap->NumberOfPages = RShiftU64 ((GcdMapEntry->EndAddress - GcdMapEntry->BaseAddress + 1), EFI_PAGE_SHIFT);
- MemoryMap->Attribute = GcdMapEntry->Attributes & ~EFI_MEMORY_PORT_IO;
-
- if (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeReserved) {
- MemoryMap->Type = EfiReservedMemoryType;
- } else if (GcdMapEntry->GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo) {
- if ((GcdMapEntry->Attributes & EFI_MEMORY_PORT_IO) == EFI_MEMORY_PORT_IO) {
- MemoryMap->Type = EfiMemoryMappedIOPortSpace;
- } else {
- MemoryMap->Type = EfiMemoryMappedIO;
- }
- }
-
- MemoryMap = NextMemoryDescriptor (MemoryMap, Size);
- }
- }
- }
-
- Status = EFI_SUCCESS;
-
-Done:
-
- CoreReleaseMemoryLock ();
-
- CoreReleaseGcdMemoryLock ();
-
- //
- // Update the map key finally
- //
- if (MapKey != NULL) {
- *MapKey = mMemoryMapKey;
- }
-
- *MemoryMapSize = BufferSize;
-
- return Status;
-}
-
-VOID *
-CoreAllocatePoolPages (
- IN EFI_MEMORY_TYPE PoolType,
- IN UINTN NumberOfPages,
- IN UINTN Alignment
- )
-/*++
-
-Routine Description:
-
- Internal function. Used by the pool functions to allocate pages
- to back pool allocation requests.
-
-Arguments:
-
- PoolType - The type of memory for the new pool pages
-
- NumberOfPages - No of pages to allocate
-
- Alignment - Bits to align.
-
-Returns:
-
- The allocated memory, or NULL
-
---*/
-{
- UINT64 Start;
-
- //
- // Find the pages to convert
- //
- Start = FindFreePages (EFI_MAX_ADDRESS, NumberOfPages, PoolType, Alignment);
-
- //
- // Convert it to boot services data
- //
- if (Start == 0) {
- DEBUG ((EFI_D_ERROR | EFI_D_PAGE, "AllocatePoolPages: failed to allocate %d pages\n", NumberOfPages));
- } else {
- CoreConvertPages (Start, NumberOfPages, PoolType);
- }
-
- return (VOID *)(UINTN)Start;
-}
-
-VOID
-CoreFreePoolPages (
- IN EFI_PHYSICAL_ADDRESS Memory,
- IN UINTN NumberOfPages
- )
-/*++
-
-Routine Description:
-
- Internal function. Frees pool pages allocated via AllocatePoolPages ()
-
-Arguments:
-
- Memory - The base address to free
-
- NumberOfPages - The number of pages to free
-
-Returns:
-
- None
-
---*/
-{
- CoreConvertPages (Memory, NumberOfPages, EfiConventionalMemory);
-}
-
-
-EFI_STATUS
-CoreTerminateMemoryMap (
- IN UINTN MapKey
- )
-/*++
-
-Routine Description:
-
- Make sure the memory map is following all the construction rules,
- it is the last time to check memory map error before exit boot services.
-
-Arguments:
-
- MapKey - Memory map key
-
-Returns:
-
- EFI_INVALID_PARAMETER - Memory map not consistent with construction rules.
-
- EFI_SUCCESS - Valid memory map.
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- MEMORY_MAP *Entry;
-
- Status = EFI_SUCCESS;
-
- CoreAcquireMemoryLock ();
-
- if (MapKey == mMemoryMapKey) {
-
- //
- // Make sure the memory map is following all the construction rules
- // This is the last chance we will be able to display any messages on
- // the console devices.
- //
-
- for (Link = gMemoryMap.ForwardLink; Link != &gMemoryMap; Link = Link->ForwardLink) {
- Entry = CR(Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
- if (Entry->Attribute & EFI_MEMORY_RUNTIME) {
- if (Entry->Type == EfiACPIReclaimMemory || Entry->Type == EfiACPIMemoryNVS) {
- DEBUG((EFI_D_ERROR, "ExitBootServices: ACPI memory entry has RUNTIME attribute set.\n"));
- CoreReleaseMemoryLock ();
- return EFI_INVALID_PARAMETER;
- }
- if (Entry->Start & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) {
- DEBUG((EFI_D_ERROR, "ExitBootServices: A RUNTIME memory entry is not on a proper alignment.\n"));
- CoreReleaseMemoryLock ();
- return EFI_INVALID_PARAMETER;
- }
- if ((Entry->End + 1) & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) {
- DEBUG((EFI_D_ERROR, "ExitBootServices: A RUNTIME memory entry is not on a proper alignment.\n"));
- CoreReleaseMemoryLock ();
- return EFI_INVALID_PARAMETER;
- }
- }
- }
-
- //
- // The map key they gave us matches what we expect. Fall through and
- // return success. In an ideal world we would clear out all of
- // EfiBootServicesCode and EfiBootServicesData. However this function
- // is not the last one called by ExitBootServices(), so we have to
- // preserve the memory contents.
- //
- } else {
- Status = EFI_INVALID_PARAMETER;
- }
-
- CoreReleaseMemoryLock ();
-
- return Status;
-}
-
-
-
-
-
-
-
-
diff --git a/EdkModulePkg/Core/Dxe/Mem/memdata.c b/EdkModulePkg/Core/Dxe/Mem/memdata.c
deleted file mode 100644
index 83a130d..0000000
--- a/EdkModulePkg/Core/Dxe/Mem/memdata.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- memdata.c
-
-Abstract:
-
- Global data used in memory service
-
-
-Revision History
-
---*/
-
-#include <DxeMain.h>
-
-
-//
-// MemoryLock - synchronizes access to the memory map and pool lists
-//
-EFI_LOCK gMemoryLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);
-
-//
-// MemoryMap - the current memory map
-//
-LIST_ENTRY gMemoryMap = INITIALIZE_LIST_HEAD_VARIABLE (gMemoryMap);
-
-//
-// MemoryLastConvert - the last memory descriptor used for a conversion request
-//
-MEMORY_MAP *gMemoryLastConvert;
diff --git a/EdkModulePkg/Core/Dxe/Mem/pool.c b/EdkModulePkg/Core/Dxe/Mem/pool.c
deleted file mode 100644
index c024f03..0000000
--- a/EdkModulePkg/Core/Dxe/Mem/pool.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- pool.c
-
-Abstract:
-
- EFI Memory pool management
-
-Revision History
-
---*/
-
-#include <DxeMain.h>
-
-#define POOL_FREE_SIGNATURE EFI_SIGNATURE_32('p','f','r','0')
-typedef struct {
- UINT32 Signature;
- UINT32 Index;
- LIST_ENTRY Link;
-} POOL_FREE;
-
-
-#define POOL_HEAD_SIGNATURE EFI_SIGNATURE_32('p','h','d','0')
-typedef struct {
- UINT32 Signature;
- UINT32 Size;
- EFI_MEMORY_TYPE Type;
- UINTN Reserved;
- CHAR8 Data[1];
-} POOL_HEAD;
-
-#define SIZE_OF_POOL_HEAD EFI_FIELD_OFFSET(POOL_HEAD,Data)
-
-#define POOL_TAIL_SIGNATURE EFI_SIGNATURE_32('p','t','a','l')
-typedef struct {
- UINT32 Signature;
- UINT32 Size;
-} POOL_TAIL;
-
-
-#define POOL_SHIFT 7
-
-#define POOL_OVERHEAD (SIZE_OF_POOL_HEAD + sizeof(POOL_TAIL))
-
-#define HEAD_TO_TAIL(a) \
- ((POOL_TAIL *) (((CHAR8 *) (a)) + (a)->Size - sizeof(POOL_TAIL)));
-
-
-#define SIZE_TO_LIST(a) ((a) >> POOL_SHIFT)
-#define LIST_TO_SIZE(a) ((a+1) << POOL_SHIFT)
-
-#define MAX_POOL_LIST SIZE_TO_LIST(DEFAULT_PAGE_ALLOCATION)
-
-#define MAX_POOL_SIZE (MAX_ADDRESS - POOL_OVERHEAD)
-
-//
-// Globals
-//
-
-#define POOL_SIGNATURE EFI_SIGNATURE_32('p','l','s','t')
-typedef struct {
- INTN Signature;
- UINTN Used;
- EFI_MEMORY_TYPE MemoryType;
- LIST_ENTRY FreeList[MAX_POOL_LIST];
- LIST_ENTRY Link;
-} POOL;
-
-
-POOL PoolHead[EfiMaxMemoryType];
-LIST_ENTRY PoolHeadList;
-
-//
-//
-//
-
-VOID
-CoreInitializePool (
- VOID
- )
-/*++
-
-Routine Description:
-
- Called to initialize the pool.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- UINTN Type;
- UINTN Index;
-
- for (Type=0; Type < EfiMaxMemoryType; Type++) {
- PoolHead[Type].Signature = 0;
- PoolHead[Type].Used = 0;
- PoolHead[Type].MemoryType = (EFI_MEMORY_TYPE) Type;
- for (Index=0; Index < MAX_POOL_LIST; Index++) {
- InitializeListHead (&PoolHead[Type].FreeList[Index]);
- }
- }
- InitializeListHead (&PoolHeadList);
-}
-
-STATIC
-POOL *
-LookupPoolHead (
- IN EFI_MEMORY_TYPE MemoryType
- )
-/*++
-
-Routine Description:
-
- Look up pool head for specified memory type.
-
-Arguments:
-
- MemoryType - Memory type of which pool head is looked for
-
-Returns:
-
- Pointer of Corresponding pool head.
-
---*/
-{
- LIST_ENTRY *Link;
- POOL *Pool;
- UINTN Index;
-
- if (MemoryType >= 0 && MemoryType < EfiMaxMemoryType) {
- return &PoolHead[MemoryType];
- }
-
- if (MemoryType < 0) {
-
- for (Link = PoolHeadList.ForwardLink; Link != &PoolHeadList; Link = Link->ForwardLink) {
- Pool = CR(Link, POOL, Link, POOL_SIGNATURE);
- if (Pool->MemoryType == MemoryType) {
- return Pool;
- }
- }
-
- Pool = CoreAllocatePoolI (EfiBootServicesData, sizeof (POOL));
- if (Pool == NULL) {
- return NULL;
- }
-
- Pool->Signature = POOL_SIGNATURE;
- Pool->Used = 0;
- Pool->MemoryType = MemoryType;
- for (Index=0; Index < MAX_POOL_LIST; Index++) {
- InitializeListHead (&Pool->FreeList[Index]);
- }
-
- InsertHeadList (&PoolHeadList, &Pool->Link);
-
- return Pool;
- }
-
- return NULL;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreAllocatePool (
- IN EFI_MEMORY_TYPE PoolType,
- IN UINTN Size,
- OUT VOID **Buffer
- )
-/*++
-
-Routine Description:
-
- Allocate pool of a particular type.
-
-Arguments:
-
- PoolType - Type of pool to allocate
-
- Size - The amount of pool to allocate
-
- Buffer - The address to return a pointer to the allocated pool
-
-Returns:
-
- EFI_INVALID_PARAMETER - PoolType not valid
-
- EFI_OUT_OF_RESOURCES - Size exceeds max pool size or allocation failed.
-
- EFI_SUCCESS - Pool successfully allocated.
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // If it's not a valid type, fail it
- //
- if ((PoolType >= EfiMaxMemoryType && PoolType <= 0x7fffffff) ||
- PoolType == EfiConventionalMemory) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Buffer = NULL;
-
- //
- // If size is too large, fail it
- // Base on the EFI spec, return status of EFI_OUT_OF_RESOURCES
- //
- if (Size > MAX_POOL_SIZE) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Acquire the memory lock and make the allocation
- //
- Status = CoreAcquireLockOrFail (&gMemoryLock);
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- *Buffer = CoreAllocatePoolI (PoolType, Size);
- CoreReleaseMemoryLock ();
- return (*Buffer != NULL) ? EFI_SUCCESS : EFI_OUT_OF_RESOURCES;
-}
-
-
-VOID *
-CoreAllocatePoolI (
- IN EFI_MEMORY_TYPE PoolType,
- IN UINTN Size
- )
-/*++
-
-Routine Description:
-
- Internal function to allocate pool of a particular type.
-
- Caller must have the memory lock held
-
-
-Arguments:
-
- PoolType - Type of pool to allocate
-
- Size - The amount of pool to allocate
-
-Returns:
-
- The allocate pool, or NULL
-
---*/
-{
- POOL *Pool;
- POOL_FREE *Free;
- POOL_HEAD *Head;
- POOL_TAIL *Tail;
- CHAR8 *NewPage;
- VOID *Buffer;
- UINTN Index;
- UINTN FSize;
- UINTN offset;
- UINTN Adjustment;
- UINTN NoPages;
-
- ASSERT_LOCKED (&gMemoryLock);
-
- //
- // Adjust the size by the pool header & tail overhead
- //
-
- //
- // Adjusting the Size to be of proper alignment so that
- // we don't get an unaligned access fault later when
- // pool_Tail is being initialized
- //
- ALIGN_VARIABLE (Size, Adjustment);
-
- Size += POOL_OVERHEAD;
- Index = SIZE_TO_LIST(Size);
- Pool = LookupPoolHead (PoolType);
- if (Pool== NULL) {
- return NULL;
- }
- Head = NULL;
-
- //
- // If allocation is over max size, just allocate pages for the request
- // (slow)
- //
- if (Index >= MAX_POOL_LIST) {
- NoPages = EFI_SIZE_TO_PAGES(Size) + EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1;
- NoPages &= ~(EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1);
- Head = CoreAllocatePoolPages (PoolType, NoPages, DEFAULT_PAGE_ALLOCATION);
- goto Done;
- }
-
- //
- // If there's no free pool in the proper list size, go get some more pages
- //
- if (IsListEmpty (&Pool->FreeList[Index])) {
-
- //
- // Get another page
- //
- NewPage = CoreAllocatePoolPages(PoolType, EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION), DEFAULT_PAGE_ALLOCATION);
- if (NewPage == NULL) {
- goto Done;
- }
-
- //
- // Carve up new page into free pool blocks
- //
- offset = 0;
- while (offset < DEFAULT_PAGE_ALLOCATION) {
- ASSERT (Index < MAX_POOL_LIST);
- FSize = LIST_TO_SIZE(Index);
-
- while (offset + FSize <= DEFAULT_PAGE_ALLOCATION) {
- Free = (POOL_FREE *) &NewPage[offset];
- Free->Signature = POOL_FREE_SIGNATURE;
- Free->Index = (UINT32)Index;
- InsertHeadList (&Pool->FreeList[Index], &Free->Link);
- offset += FSize;
- }
-
- Index -= 1;
- }
-
- ASSERT (offset == DEFAULT_PAGE_ALLOCATION);
- Index = SIZE_TO_LIST(Size);
- }
-
- //
- // Remove entry from free pool list
- //
- Free = CR (Pool->FreeList[Index].ForwardLink, POOL_FREE, Link, POOL_FREE_SIGNATURE);
- RemoveEntryList (&Free->Link);
-
- Head = (POOL_HEAD *) Free;
-
-Done:
- Buffer = NULL;
-
- if (Head != NULL) {
-
- //
- // If we have a pool buffer, fill in the header & tail info
- //
- Head->Signature = POOL_HEAD_SIGNATURE;
- Head->Size = (UINT32) Size;
- Head->Type = (EFI_MEMORY_TYPE) PoolType;
- Tail = HEAD_TO_TAIL (Head);
- Tail->Signature = POOL_TAIL_SIGNATURE;
- Tail->Size = (UINT32) Size;
- Buffer = Head->Data;
- DEBUG_CLEAR_MEMORY (Buffer, Size - POOL_OVERHEAD);
-
- DEBUG (
- (EFI_D_POOL,
- "AllcocatePoolI: Type %x, Addr %x (len %x) %,d\n",
- PoolType,
- Buffer,
- Size - POOL_OVERHEAD,
- Pool->Used)
- );
-
- //
- // Account the allocation
- //
- Pool->Used += Size;
-
- } else {
- DEBUG ((EFI_D_ERROR | EFI_D_POOL, "AllocatePool: failed to allocate %d bytes\n", Size));
- }
-
- return Buffer;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreFreePool (
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Frees pool.
-
-Arguments:
-
- Buffer - The allocated pool entry to free
-
-Returns:
-
- EFI_INVALID_PARAMETER - Buffer is not a valid value.
-
- EFI_SUCCESS - Pool successfully freed.
-
---*/
-{
- EFI_STATUS Status;
-
- if (NULL == Buffer) {
- return EFI_INVALID_PARAMETER;
- }
-
- CoreAcquireMemoryLock ();
- Status = CoreFreePoolI (Buffer);
- CoreReleaseMemoryLock ();
- return Status;
-}
-
-
-EFI_STATUS
-CoreFreePoolI (
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Internal function to free a pool entry.
-
- Caller must have the memory lock held
-
-
-Arguments:
-
- Buffer - The allocated pool entry to free
-
-Returns:
-
- EFI_INVALID_PARAMETER - Buffer not valid
-
- EFI_SUCCESS - Buffer successfully freed.
-
---*/
-{
- POOL *Pool;
- POOL_HEAD *Head;
- POOL_TAIL *Tail;
- POOL_FREE *Free;
- UINTN Index;
- UINTN NoPages;
- UINTN Size;
- CHAR8 *NewPage;
- UINTN FSize;
- UINTN offset;
- BOOLEAN AllFree;
-
- ASSERT(NULL != Buffer);
- //
- // Get the head & tail of the pool entry
- //
- Head = CR (Buffer, POOL_HEAD, Data, POOL_HEAD_SIGNATURE);
- ASSERT(NULL != Head);
-
- if (Head->Signature != POOL_HEAD_SIGNATURE) {
- return EFI_INVALID_PARAMETER;
- }
-
- Tail = HEAD_TO_TAIL (Head);
- ASSERT(NULL != Tail);
-
- //
- // Debug
- //
- ASSERT (Tail->Signature == POOL_TAIL_SIGNATURE);
- ASSERT (Head->Size == Tail->Size);
- ASSERT_LOCKED (&gMemoryLock);
-
- if (Tail->Signature != POOL_TAIL_SIGNATURE) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Head->Size != Tail->Size) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Determine the pool type and account for it
- //
- Size = Head->Size;
- Pool = LookupPoolHead (Head->Type);
- if (Pool == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- Pool->Used -= Size;
- DEBUG ((EFI_D_POOL, "FreePool: %x (len %x) %,d\n", Head->Data, Head->Size - POOL_OVERHEAD, Pool->Used));
-
- //
- // Determine the pool list
- //
- Index = SIZE_TO_LIST(Size);
- DEBUG_CLEAR_MEMORY (Head, Size);
-
- //
- // If it's not on the list, it must be pool pages
- //
- if (Index >= MAX_POOL_LIST) {
-
- //
- // Return the memory pages back to free memory
- //
- NoPages = EFI_SIZE_TO_PAGES(Size) + EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1;
- NoPages &= ~(EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION) - 1);
- CoreFreePoolPages ((EFI_PHYSICAL_ADDRESS) (UINTN) Head, NoPages);
-
- } else {
-
- //
- // Put the pool entry onto the free pool list
- //
- Free = (POOL_FREE *) Head;
- ASSERT(NULL != Free);
- Free->Signature = POOL_FREE_SIGNATURE;
- Free->Index = (UINT32)Index;
- InsertHeadList (&Pool->FreeList[Index], &Free->Link);
-
- //
- // See if all the pool entries in the same page as Free are freed pool
- // entries
- //
- NewPage = (CHAR8 *)((UINTN)Free & ~((DEFAULT_PAGE_ALLOCATION) -1));
- Free = (POOL_FREE *) &NewPage[0];
- ASSERT(NULL != Free);
-
- if (Free->Signature == POOL_FREE_SIGNATURE) {
-
- Index = Free->Index;
-
- AllFree = TRUE;
- offset = 0;
-
- while ((offset < DEFAULT_PAGE_ALLOCATION) && (AllFree)) {
- FSize = LIST_TO_SIZE(Index);
- while (offset + FSize <= DEFAULT_PAGE_ALLOCATION) {
- Free = (POOL_FREE *) &NewPage[offset];
- ASSERT(NULL != Free);
- if (Free->Signature != POOL_FREE_SIGNATURE) {
- AllFree = FALSE;
- }
- offset += FSize;
- }
- Index -= 1;
- }
-
- if (AllFree) {
-
- //
- // All of the pool entries in the same page as Free are free pool
- // entries
- // Remove all of these pool entries from the free loop lists.
- //
- Free = (POOL_FREE *) &NewPage[0];
- ASSERT(NULL != Free);
- Index = Free->Index;
- offset = 0;
-
- while (offset < DEFAULT_PAGE_ALLOCATION) {
- FSize = LIST_TO_SIZE(Index);
- while (offset + FSize <= DEFAULT_PAGE_ALLOCATION) {
- Free = (POOL_FREE *) &NewPage[offset];
- ASSERT(NULL != Free);
- RemoveEntryList (&Free->Link);
- offset += FSize;
- }
- Index -= 1;
- }
-
- //
- // Free the page
- //
- CoreFreePoolPages ((EFI_PHYSICAL_ADDRESS) (UINTN)NewPage, EFI_SIZE_TO_PAGES (DEFAULT_PAGE_ALLOCATION));
- }
- }
- }
-
- //
- // If this is an OS specific memory type, then check to see if the last
- // portion of that memory type has been freed. If it has, then free the
- // list entry for that memory type
- //
- if (Pool->MemoryType < 0 && Pool->Used == 0) {
- RemoveEntryList (&Pool->Link);
- CoreFreePoolI (Pool);
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Dxe/Misc/DebugImageInfo.c b/EdkModulePkg/Core/Dxe/Misc/DebugImageInfo.c
deleted file mode 100644
index 3512477..0000000
--- a/EdkModulePkg/Core/Dxe/Misc/DebugImageInfo.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DebugImageInfo.c
-
-Abstract:
-
- Support functions for managing debug image info table when loading and unloading
- images.
-
---*/
-
-#include <DxeMain.h>
-
-
-static EFI_DEBUG_IMAGE_INFO_TABLE_HEADER mDebugInfoTableHeader = {
- 0, // volatile UINT32 UpdateStatus;
- 0, // UINT32 TableSize;
- NULL // EFI_DEBUG_IMAGE_INFO *EfiDebugImageInfoTable;
-};
-
-static EFI_SYSTEM_TABLE_POINTER *mDebugTable = NULL;
-
-
-VOID
-CoreInitializeDebugImageInfoTable (
- VOID
- )
-/*++
-
-Routine Description:
-
- Creates and initializes the DebugImageInfo Table. Also creates the configuration
- table and registers it into the system table.
-
-Arguments:
- None
-
-Returns:
- NA
-
-Notes:
- This function allocates memory, frees it, and then allocates memory at an
- address within the initial allocation. Since this function is called early
- in DXE core initialization (before drivers are dispatched), this should not
- be a problem.
-
---*/
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS Mem;
- UINTN NumberOfPages;
-
- //
- // Allocate boot services memory for the structure. It's required to be aligned on
- // a 4M boundary, so allocate a 4M block (plus what we require), free it up, calculate
- // a 4M aligned address within the memory we just freed, and then allocate memory at that
- // address for our initial structure.
- //
- NumberOfPages = FOUR_MEG_PAGES + EFI_SIZE_TO_PAGES(sizeof (EFI_SYSTEM_TABLE_POINTER));
-
- Status = CoreAllocatePages (AllocateAnyPages, EfiBootServicesData, NumberOfPages , &Mem);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR(Status)) {
- return;
- }
- Status = CoreFreePages (Mem, NumberOfPages);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR(Status)) {
- return;
- }
- //
- // Now get a 4M aligned address within the memory range we were given.
- // Then allocate memory at that address
- //
- Mem = (Mem + FOUR_MEG_MASK) & (~FOUR_MEG_MASK);
-
- Status = CoreAllocatePages (AllocateAddress, EfiBootServicesData, NumberOfPages - FOUR_MEG_PAGES, &Mem);
- ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR(Status)) {
- return;
- }
- //
- // We now have a 4M aligned page allocated, so fill in the data structure.
- // Ideally we would update the CRC now as well, but the service may not yet be available.
- // See comments in the CoreUpdateDebugTableCrc32() function below for details.
- //
- mDebugTable = (EFI_SYSTEM_TABLE_POINTER *)(UINTN)Mem;
- mDebugTable->Signature = EFI_SYSTEM_TABLE_SIGNATURE;
- mDebugTable->EfiSystemTableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) gDxeCoreST;
- mDebugTable->Crc32 = 0;
- Status = CoreInstallConfigurationTable (&gEfiDebugImageInfoTableGuid, &mDebugInfoTableHeader);
- ASSERT_EFI_ERROR (Status);
-}
-
-VOID
-CoreUpdateDebugTableCrc32 (
- VOID
- )
-/*++
-
-Routine Description:
-
- Update the CRC32 in the Debug Table.
- Since the CRC32 service is made available by the Runtime driver, we have to
- wait for the Runtime Driver to be installed before the CRC32 can be computed.
- This function is called elsewhere by the core when the runtime architectural
- protocol is produced.
-
-Arguments:
- None
-
-Returns:
- NA
-
---*/
-{
- ASSERT(mDebugTable != NULL);
- mDebugTable->Crc32 = 0;
- gDxeCoreBS->CalculateCrc32 ((VOID *)mDebugTable, sizeof (EFI_SYSTEM_TABLE_POINTER), &mDebugTable->Crc32);
-}
-
-VOID
-CoreNewDebugImageInfoEntry (
- IN UINT32 ImageInfoType,
- IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
- the table if it's not large enough to accomidate another entry.
-
-Arguments:
-
- ImageInfoType - type of debug image information
- LoadedImage - pointer to the loaded image protocol for the image being loaded
- ImageHandle - image handle for the image being loaded
-
-Returns:
- NA
-
---*/
-{
- EFI_DEBUG_IMAGE_INFO *Table;
- EFI_DEBUG_IMAGE_INFO *NewTable;
- UINTN Index;
- UINTN MaxTableIndex;
- UINTN TableSize;
-
- //
- // Set the flag indicating that we're in the process of updating the table.
- //
- mDebugInfoTableHeader.UpdateStatus |= EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
-
- Table = mDebugInfoTableHeader.EfiDebugImageInfoTable;
- MaxTableIndex = mDebugInfoTableHeader.TableSize;
-
- for (Index = 0; Index < MaxTableIndex; Index++) {
- if (Table[Index].NormalImage == NULL) {
- //
- // We have found a free entry so exit the loop
- //
- break;
- }
- }
- if (Index == MaxTableIndex) {
- //
- // Table is full, so re-allocate another page for a larger table...
- //
- TableSize = MaxTableIndex * EFI_DEBUG_TABLE_ENTRY_SIZE;
- NewTable = CoreAllocateZeroBootServicesPool (TableSize + EFI_PAGE_SIZE);
- if (NewTable == NULL) {
- mDebugInfoTableHeader.UpdateStatus &= ~EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
- return;
- }
- //
- // Copy the old table into the new one
- //
- CopyMem (NewTable, Table, TableSize);
- //
- // Free the old table
- //
- CoreFreePool (Table);
- //
- // Update the table header
- //
- Table = NewTable;
- mDebugInfoTableHeader.EfiDebugImageInfoTable = NewTable;
- mDebugInfoTableHeader.TableSize += EFI_PAGE_SIZE / EFI_DEBUG_TABLE_ENTRY_SIZE;
- }
- //
- // Allocate data for new entry
- //
- Table[Index].NormalImage = CoreAllocateZeroBootServicesPool (sizeof (EFI_DEBUG_IMAGE_INFO_NORMAL));
- if (Table[Index].NormalImage != NULL) {
- //
- // Update the entry
- //
- Table[Index].NormalImage->ImageInfoType = (UINT32) ImageInfoType;
- Table[Index].NormalImage->LoadedImageProtocolInstance = LoadedImage;
- Table[Index].NormalImage->ImageHandle = ImageHandle;
- }
- mDebugInfoTableHeader.UpdateStatus &= ~EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
-}
-
-
-VOID
-CoreRemoveDebugImageInfoEntry (
- EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- Removes and frees an entry from the DebugImageInfo Table.
-
-Arguments:
-
- ImageHandle - image handle for the image being unloaded
-
-Returns:
-
- NA
-
---*/
-{
- EFI_DEBUG_IMAGE_INFO *Table;
- UINTN Index;
-
- mDebugInfoTableHeader.UpdateStatus |= EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
-
- Table = mDebugInfoTableHeader.EfiDebugImageInfoTable;
-
- for (Index = 0; Index < mDebugInfoTableHeader.TableSize; Index++) {
- if (Table[Index].NormalImage != NULL && Table[Index].NormalImage->ImageHandle == ImageHandle) {
- //
- // Found a match. Free up the record, then NULL the pointer to indicate the slot
- // is free.
- //
- CoreFreePool (Table[Index].NormalImage);
- Table[Index].NormalImage = NULL;
- break;
- }
- }
- mDebugInfoTableHeader.UpdateStatus &= ~EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
-}
-
diff --git a/EdkModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c b/EdkModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c
deleted file mode 100644
index 677a210..0000000
--- a/EdkModulePkg/Core/Dxe/Misc/InstallConfigurationTable.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- InstallConfigurationTable.c
-
-
-Abstract:
-
- Tiano Miscellaneous Services InstallConfigurationTable service
-
---*/
-
-#include <DxeMain.h>
-
-#define CONFIG_TABLE_SIZE_INCREASED 0x10
-
-UINTN mSystemTableAllocateSize = 0;
-
-
-EFI_STATUS
-CoreGetConfigTable (
- IN EFI_GUID *Guid,
- OUT VOID **Table
- )
-/*++
-
-Routine Description:
-
- Find a config table by name in system table's ConfigurationTable.
-
-Arguments:
-
- Guid - The table name to look for
-
- Table - Pointer of the config table
-
-Returns:
-
- EFI_NOT_FOUND - Could not find the table in system table's ConfigurationTable.
-
- EFI_SUCCESS - Table successfully found.
-
---*/
-{
- UINTN Index;
-
- for (Index = 0; Index < gDxeCoreST->NumberOfTableEntries; Index++) {
- if (CompareGuid (Guid, &(gDxeCoreST->ConfigurationTable[Index].VendorGuid))) {
- *Table = gDxeCoreST->ConfigurationTable[Index].VendorTable;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-CoreInstallConfigurationTable (
- IN EFI_GUID *Guid,
- IN VOID *Table
- )
-/*++
-
-Routine Description:
-
- Boot Service called to add, modify, or remove a system configuration table from
- the EFI System Table.
-
-Arguments:
-
- Guid - Pointer to the GUID for the entry to add, update, or remove
- Table - Pointer to the configuration table for the entry to add, update, or
- remove, may be NULL.
-
-Returns:
-
- EFI_SUCCESS Guid, Table pair added, updated, or removed.
- EFI_INVALID_PARAMETER Input GUID not valid.
- EFI_NOT_FOUND Attempted to delete non-existant entry
- EFI_OUT_OF_RESOURCES Not enough memory available
-
---*/
-{
- UINTN Index;
- EFI_CONFIGURATION_TABLE *EfiConfigurationTable;
-
- //
- // If Guid is NULL, then this operation cannot be performed
- //
- if (Guid == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- EfiConfigurationTable = gDxeCoreST->ConfigurationTable;
-
- //
- // Search all the table for an entry that matches Guid
- //
- for (Index = 0; Index < gDxeCoreST->NumberOfTableEntries; Index++) {
- if (CompareGuid (Guid, &(gDxeCoreST->ConfigurationTable[Index].VendorGuid))) {
- break;
- }
- }
-
- if (Index < gDxeCoreST->NumberOfTableEntries) {
- //
- // A match was found, so this is either a modify or a delete operation
- //
- if (Table != NULL) {
- //
- // If Table is not NULL, then this is a modify operation.
- // Modify the table enty and return.
- //
- gDxeCoreST->ConfigurationTable[Index].VendorTable = Table;
-
- //
- // Signal Configuration Table change
- //
- CoreNotifySignalList (Guid);
-
- return EFI_SUCCESS;
- }
-
- //
- // A match was found and Table is NULL, so this is a delete operation.
- //
- gDxeCoreST->NumberOfTableEntries--;
-
- //
- // Copy over deleted entry
- //
- CopyMem (
- &(EfiConfigurationTable[Index]),
- &(gDxeCoreST->ConfigurationTable[Index + 1]),
- (gDxeCoreST->NumberOfTableEntries - Index) * sizeof (EFI_CONFIGURATION_TABLE)
- );
-
- } else {
-
- //
- // No matching GUIDs were found, so this is an add operation.
- //
-
- if (Table == NULL) {
- //
- // If Table is NULL on an add operation, then return an error.
- //
- return EFI_NOT_FOUND;
- }
-
- //
- // Assume that Index == gDxeCoreST->NumberOfTableEntries
- //
- if ((Index * sizeof (EFI_CONFIGURATION_TABLE)) >= mSystemTableAllocateSize) {
- //
- // Allocate a table with one additional entry.
- //
- mSystemTableAllocateSize += (CONFIG_TABLE_SIZE_INCREASED * sizeof (EFI_CONFIGURATION_TABLE));
- EfiConfigurationTable = CoreAllocateRuntimePool (mSystemTableAllocateSize);
- if (EfiConfigurationTable == NULL) {
- //
- // If a new table could not be allocated, then return an error.
- //
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (gDxeCoreST->ConfigurationTable != NULL) {
- //
- // Copy the old table to the new table.
- //
- CopyMem (
- EfiConfigurationTable,
- gDxeCoreST->ConfigurationTable,
- Index * sizeof (EFI_CONFIGURATION_TABLE)
- );
-
- //
- // Free Old Table
- //
- CoreFreePool (gDxeCoreST->ConfigurationTable);
- }
-
- //
- // Update System Table
- //
- gDxeCoreST->ConfigurationTable = EfiConfigurationTable;
- }
-
- //
- // Fill in the new entry
- //
- CopyMem ((VOID *)&EfiConfigurationTable[Index].VendorGuid, Guid, sizeof (EFI_GUID));
- EfiConfigurationTable[Index].VendorTable = Table;
-
- //
- // This is an add operation, so increment the number of table entries
- //
- gDxeCoreST->NumberOfTableEntries++;
- }
-
- //
- // Fix up the CRC-32 in the EFI System Table
- //
- CalculateEfiHdrCrc (&gDxeCoreST->Hdr);
-
- //
- // Signal Configuration Table change
- //
- CoreNotifySignalList (Guid);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Dxe/Misc/SetWatchdogTimer.c b/EdkModulePkg/Core/Dxe/Misc/SetWatchdogTimer.c
deleted file mode 100644
index c11c926..0000000
--- a/EdkModulePkg/Core/Dxe/Misc/SetWatchdogTimer.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- SetWatchdogTimer.c
-
-Abstract:
-
- Tiano Miscellaneous Services SetWatchdogTimer service implementation
-
---*/
-
-#include <DxeMain.h>
-
-#define WATCHDOG_TIMER_CALIBRATE_PER_SECOND 10000000
-
-
-EFI_STATUS
-EFIAPI
-CoreSetWatchdogTimer (
- IN UINTN Timeout,
- IN UINT64 WatchdogCode,
- IN UINTN DataSize,
- IN CHAR16 *WatchdogData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Sets the system's watchdog timer.
-
-Arguments:
-
- Timeout The number of seconds. Zero disables the timer.
-
- ///////following three parameters are left for platform specific using
-
- WatchdogCode The numberic code to log. 0x0 to 0xffff are firmware
- DataSize Size of the optional data
- WatchdogData Optional Null terminated unicode string followed by binary
- data.
-
-Returns:
-
- EFI_SUCCESS Timeout has been set
- EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
- EFI_UNSUPPORTED System does not have a timer (currently not used)
- EFI_DEVICE_ERROR Could not complete due to hardware error
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Check our architectural protocol
- //
- if (gWatchdogTimer == NULL) {
- return EFI_NOT_AVAILABLE_YET;
- }
-
- //
- // Attempt to set the timeout
- //
- Status = gWatchdogTimer->SetTimerPeriod (gWatchdogTimer, MultU64x32 (Timeout, WATCHDOG_TIMER_CALIBRATE_PER_SECOND));
-
- //
- // Check for errors
- //
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Dxe/Misc/Stall.c b/EdkModulePkg/Core/Dxe/Misc/Stall.c
deleted file mode 100644
index c251f31..0000000
--- a/EdkModulePkg/Core/Dxe/Misc/Stall.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Stall.c
-
-Abstract:
-
- Tiano Miscellaneous Services Stall service implementation
-
---*/
-
-//
-// Include statements
-//
-
-#include <DxeMain.h>
-
-
-EFI_STATUS
-EFIAPI
-CoreStall (
- IN UINTN Microseconds
- )
-/*++
-
-Routine Description:
-
- Introduces a fine-grained stall.
-
-Arguments:
-
- Microseconds The number of microseconds to stall execution
-
-Returns:
-
- EFI_SUCCESS - Execution was stalled for at least the requested amount
- of microseconds.
-
- EFI_NOT_AVAILABLE_YET - gMetronome is not available yet
-
---*/
-{
- UINT32 Counter;
- UINT32 Remainder;
-
- if (gMetronome == NULL) {
- return EFI_NOT_AVAILABLE_YET;
- }
-
- //
- // Calculate the number of ticks by dividing the number of microseconds by
- // the TickPeriod.
- // Calcullation is based on 100ns unit.
- //
- Counter = (UINT32) DivU64x32Remainder (
- Microseconds * 10,
- gMetronome->TickPeriod,
- &Remainder
- );
-
- //
- // Call WaitForTick for Counter + 1 ticks to try to guarantee Counter tick
- // periods, thus attempting to ensure Microseconds of stall time.
- //
- if (Remainder != 0) {
- Counter++;
- }
-
- gMetronome->WaitForTick (gMetronome, Counter);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c b/EdkModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
deleted file mode 100644
index 817dbd8..0000000
--- a/EdkModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
+++ /dev/null
@@ -1,1342 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- CoreSectionExtraction.c
-
-Abstract:
-
- Section Extraction Protocol implementation.
-
- Stream database is implemented as a linked list of section streams,
- where each stream contains a linked list of children, which may be leaves or
- encapsulations.
-
- Children that are encapsulations generate new stream entries
- when they are created. Streams can also be created by calls to
- SEP->OpenSectionStream().
-
- The database is only created far enough to return the requested data from
- any given stream, or to determine that the requested data is not found.
-
- If a GUIDed encapsulation is encountered, there are three possiblilites.
-
- 1) A support protocol is found, in which the stream is simply processed with
- the support protocol.
-
- 2) A support protocol is not found, but the data is available to be read
- without processing. In this case, the database is built up through the
- recursions to return the data, and a RPN event is set that will enable
- the stream in question to be refreshed if and when the required section
- extraction protocol is published.This insures the AuthenticationStatus
- does not become stale in the cache.
-
- 3) A support protocol is not found, and the data is not available to be read
- without it. This results in EFI_PROTOCOL_ERROR.
-
---*/
-
-#include <DxeMain.h>
-
-//
-// Local defines and typedefs
-//
-#define CORE_SECTION_CHILD_SIGNATURE EFI_SIGNATURE_32('S','X','C','S')
-#define CHILD_SECTION_NODE_FROM_LINK(Node) \
- CR (Node, CORE_SECTION_CHILD_NODE, Link, CORE_SECTION_CHILD_SIGNATURE)
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- UINT32 Type;
- UINT32 Size;
- //
- // StreamBase + OffsetInStream == pointer to section header in stream. The
- // stream base is always known when walking the sections within.
- //
- UINT32 OffsetInStream;
- //
- // Then EncapsulatedStreamHandle below is always 0 if the section is NOT an
- // encapsulating section. Otherwise, it contains the stream handle
- // of the encapsulated stream. This handle is ALWAYS produced any time an
- // encapsulating child is encountered, irrespective of whether the
- // encapsulated stream is processed further.
- //
- UINTN EncapsulatedStreamHandle;
- EFI_GUID *EncapsulationGuid;
-} CORE_SECTION_CHILD_NODE;
-
-#define CORE_SECTION_STREAM_SIGNATURE EFI_SIGNATURE_32('S','X','S','S')
-#define STREAM_NODE_FROM_LINK(Node) \
- CR (Node, CORE_SECTION_STREAM_NODE, Link, CORE_SECTION_STREAM_SIGNATURE)
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
- UINTN StreamHandle;
- UINT8 *StreamBuffer;
- UINTN StreamLength;
- LIST_ENTRY Children;
- //
- // Authentication status is from GUIDed encapsulations.
- //
- UINT32 AuthenticationStatus;
-} CORE_SECTION_STREAM_NODE;
-
-#define NULL_STREAM_HANDLE 0
-
-typedef struct {
- CORE_SECTION_CHILD_NODE *ChildNode;
- CORE_SECTION_STREAM_NODE *ParentStream;
- VOID *Registration;
- EFI_EVENT Event;
-} RPN_EVENT_CONTEXT;
-
-
-
-//
-// Local prototypes
-//
-
-STATIC
-BOOLEAN
-ChildIsType (
- IN CORE_SECTION_STREAM_NODE *Stream,
- IN CORE_SECTION_CHILD_NODE *Child,
- IN EFI_SECTION_TYPE SearchType,
- IN EFI_GUID *SectionDefinitionGuid
- );
-
-STATIC
-VOID
-EFIAPI
-NotifyGuidedExtraction (
- IN EFI_EVENT Event,
- IN VOID *RpnContext
- );
-
-STATIC
-VOID
-CreateGuidedExtractionRpnEvent (
- IN CORE_SECTION_STREAM_NODE *ParentStream,
- IN CORE_SECTION_CHILD_NODE *ChildNode
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-OpenSectionStream (
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,
- IN UINTN SectionStreamLength,
- IN VOID *SectionStream,
- OUT UINTN *SectionStreamHandle
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-GetSection (
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,
- IN UINTN SectionStreamHandle,
- IN EFI_SECTION_TYPE *SectionType,
- IN EFI_GUID *SectionDefinitionGuid,
- IN UINTN SectionInstance,
- IN VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT UINT32 *AuthenticationStatus
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-CloseSectionStream (
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,
- IN UINTN StreamHandleToClose
- );
-
-STATIC
-EFI_STATUS
-FindStreamNode (
- IN UINTN SearchHandle,
- OUT CORE_SECTION_STREAM_NODE **FoundStream
- );
-
-STATIC
-EFI_STATUS
-FindChildNode (
- IN CORE_SECTION_STREAM_NODE *SourceStream,
- IN EFI_SECTION_TYPE SearchType,
- IN UINTN *SectionInstance,
- IN EFI_GUID *SectionDefinitionGuid,
- OUT CORE_SECTION_CHILD_NODE **FoundChild,
- OUT CORE_SECTION_STREAM_NODE **FoundStream,
- OUT UINT32 *AuthenticationStatus
- );
-
-STATIC
-EFI_STATUS
-CreateChildNode (
- IN CORE_SECTION_STREAM_NODE *Stream,
- IN UINT32 ChildOffset,
- OUT CORE_SECTION_CHILD_NODE **ChildNode
- );
-
-STATIC
-VOID
-FreeChildNode (
- IN CORE_SECTION_CHILD_NODE *ChildNode
- );
-
-STATIC
-EFI_STATUS
-OpenSectionStreamEx (
- IN UINTN SectionStreamLength,
- IN VOID *SectionStream,
- IN BOOLEAN AllocateBuffer,
- IN UINT32 AuthenticationStatus,
- OUT UINTN *SectionStreamHandle
- );
-
-STATIC
-BOOLEAN
-IsValidSectionStream (
- IN VOID *SectionStream,
- IN UINTN SectionStreamLength
- );
-
-//
-// Module globals
-//
-LIST_ENTRY mStreamRoot = INITIALIZE_LIST_HEAD_VARIABLE (mStreamRoot);
-
-EFI_HANDLE mSectionExtractionHandle = NULL;
-
-EFI_SECTION_EXTRACTION_PROTOCOL mSectionExtraction = {
- OpenSectionStream,
- GetSection,
- CloseSectionStream
-};
-
-
-EFI_STATUS
-EFIAPI
-InitializeSectionExtraction (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Entry point of the section extraction code. Initializes an instance of the
- section extraction interface and installs it on a new handle.
-
-Arguments:
- ImageHandle EFI_HANDLE: A handle for the image that is initializing this driver
- SystemTable EFI_SYSTEM_TABLE: A pointer to the EFI system table
-
-Returns:
- EFI_SUCCESS: Driver initialized successfully
- EFI_OUT_OF_RESOURCES: Could not allocate needed resources
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Install SEP to a new handle
- //
- Status = CoreInstallProtocolInterface (
- &mSectionExtractionHandle,
- &gEfiSectionExtractionProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mSectionExtraction
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-OpenSectionStream (
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,
- IN UINTN SectionStreamLength,
- IN VOID *SectionStream,
- OUT UINTN *SectionStreamHandle
- )
-/*++
-
-Routine Description:
- SEP member function. This function creates and returns a new section stream
- handle to represent the new section stream.
-
-Arguments:
- This - Indicates the calling context.
- SectionStreamLength - Size in bytes of the section stream.
- SectionStream - Buffer containing the new section stream.
- SectionStreamHandle - A pointer to a caller allocated UINTN that on output
- contains the new section stream handle.
-
-Returns:
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES - memory allocation failed.
- EFI_INVALID_PARAMETER - section stream does not end concident with end of
- last section.
-
---*/
-{
- //
- // Check to see section stream looks good...
- //
- if (!IsValidSectionStream (SectionStream, SectionStreamLength)) {
- return EFI_INVALID_PARAMETER;
- }
-
- return OpenSectionStreamEx (
- SectionStreamLength,
- SectionStream,
- TRUE,
- 0,
- SectionStreamHandle
- );
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-GetSection (
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,
- IN UINTN SectionStreamHandle,
- IN EFI_SECTION_TYPE *SectionType,
- IN EFI_GUID *SectionDefinitionGuid,
- IN UINTN SectionInstance,
- IN VOID **Buffer,
- IN OUT UINTN *BufferSize,
- OUT UINT32 *AuthenticationStatus
- )
-/*++
-
-Routine Description:
- SEP member function. Retrieves requested section from section stream.
-
-Arguments:
- This: Pointer to SEP instance.
- SectionStreamHandle: The section stream from which to extract the requested
- section.
- SectionType: A pointer to the type of section to search for.
- SectionDefinitionGuid: If the section type is EFI_SECTION_GUID_DEFINED, then
- SectionDefinitionGuid indicates which of these types
- of sections to search for.
- SectionInstance: Indicates which instance of the requested section to
- return.
- Buffer: Double indirection to buffer. If *Buffer is non-null on
- input, then the buffer is caller allocated. If
- *Buffer is NULL, then the buffer is callee allocated.
- In either case, the requried buffer size is returned
- in *BufferSize.
- BufferSize: On input, indicates the size of *Buffer if *Buffer is
- non-null on input. On output, indicates the required
- size (allocated size if callee allocated) of *Buffer.
- AuthenticationStatus: Indicates the authentication status of the retrieved
- section.
-
-Returns:
- EFI_SUCCESS: Section was retrieved successfully
- EFI_PROTOCOL_ERROR: A GUID defined section was encountered in the section
- stream with its EFI_GUIDED_SECTION_PROCESSING_REQUIRED
- bit set, but there was no corresponding GUIDed Section
- Extraction Protocol in the handle database. *Buffer is
- unmodified.
- EFI_NOT_FOUND: An error was encountered when parsing the SectionStream.
- This indicates the SectionStream is not correctly
- formatted.
- EFI_NOT_FOUND: The requested section does not exist.
- EFI_OUT_OF_RESOURCES: The system has insufficient resources to process the
- request.
- EFI_INVALID_PARAMETER: The SectionStreamHandle does not exist.
- EFI_WARN_TOO_SMALL: The size of the caller allocated input buffer is
- insufficient to contain the requested section. The
- input buffer is filled and contents are section contents
- are truncated.
-
---*/
-{
- CORE_SECTION_STREAM_NODE *StreamNode;
- EFI_TPL OldTpl;
- EFI_STATUS Status;
- CORE_SECTION_CHILD_NODE *ChildNode;
- CORE_SECTION_STREAM_NODE *ChildStreamNode;
- UINTN CopySize;
- UINT32 ExtractedAuthenticationStatus;
- UINTN Instance;
- UINT8 *CopyBuffer;
- UINTN SectionSize;
-
-
- OldTpl = CoreRaiseTpl (TPL_NOTIFY);
- Instance = SectionInstance + 1;
-
- //
- // Locate target stream
- //
- Status = FindStreamNode (SectionStreamHandle, &StreamNode);
- if (EFI_ERROR (Status)) {
- Status = EFI_INVALID_PARAMETER;
- goto GetSection_Done;
- }
-
- //
- // Found the stream, now locate and return the appropriate section
- //
- if (SectionType == NULL) {
- //
- // SectionType == NULL means return the WHOLE section stream...
- //
- CopySize = StreamNode->StreamLength;
- CopyBuffer = StreamNode->StreamBuffer;
- *AuthenticationStatus = StreamNode->AuthenticationStatus;
- } else {
- //
- // There's a requested section type, so go find it and return it...
- //
- Status = FindChildNode (
- StreamNode,
- *SectionType,
- &Instance,
- SectionDefinitionGuid,
- &ChildNode,
- &ChildStreamNode,
- &ExtractedAuthenticationStatus
- );
- if (EFI_ERROR (Status)) {
- goto GetSection_Done;
- }
- CopySize = ChildNode->Size - sizeof (EFI_COMMON_SECTION_HEADER);
- CopyBuffer = ChildStreamNode->StreamBuffer + ChildNode->OffsetInStream + sizeof (EFI_COMMON_SECTION_HEADER);
- *AuthenticationStatus = ExtractedAuthenticationStatus;
- }
-
- SectionSize = CopySize;
- if (*Buffer != NULL) {
- //
- // Caller allocated buffer. Fill to size and return required size...
- //
- if (*BufferSize < CopySize) {
- Status = EFI_WARN_BUFFER_TOO_SMALL;
- CopySize = *BufferSize;
- }
- } else {
- //
- // Callee allocated buffer. Allocate buffer and return size.
- //
- *Buffer = CoreAllocateBootServicesPool (CopySize);
- if (*Buffer == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto GetSection_Done;
- }
- }
- CopyMem (*Buffer, CopyBuffer, CopySize);
- *BufferSize = SectionSize;
-
-GetSection_Done:
- CoreRestoreTpl (OldTpl);
- return Status;
-}
-
-
-STATIC
-EFI_STATUS
-EFIAPI
-CloseSectionStream (
- IN EFI_SECTION_EXTRACTION_PROTOCOL *This,
- IN UINTN StreamHandleToClose
- )
-/*++
-
-Routine Description:
- SEP member function. Deletes an existing section stream
-
-Arguments:
- This - Indicates the calling context.
- StreamHandleToClose - Indicates the stream to close
-
-Returns:
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES - memory allocation failed.
- EFI_INVALID_PARAMETER - section stream does not end concident with end of
- last section.
-
---*/
-{
- CORE_SECTION_STREAM_NODE *StreamNode;
- EFI_TPL OldTpl;
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- CORE_SECTION_CHILD_NODE *ChildNode;
-
- OldTpl = CoreRaiseTpl (TPL_NOTIFY);
-
- //
- // Locate target stream
- //
- Status = FindStreamNode (StreamHandleToClose, &StreamNode);
- if (!EFI_ERROR (Status)) {
- //
- // Found the stream, so close it
- //
- RemoveEntryList (&StreamNode->Link);
- while (!IsListEmpty (&StreamNode->Children)) {
- Link = GetFirstNode (&StreamNode->Children);
- ChildNode = CHILD_SECTION_NODE_FROM_LINK (Link);
- FreeChildNode (ChildNode);
- }
- CoreFreePool (StreamNode->StreamBuffer);
- CoreFreePool (StreamNode);
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_INVALID_PARAMETER;
- }
-
- CoreRestoreTpl (OldTpl);
- return Status;
-}
-
-
-STATIC
-BOOLEAN
-ChildIsType (
- IN CORE_SECTION_STREAM_NODE *Stream,
- IN CORE_SECTION_CHILD_NODE *Child,
- IN EFI_SECTION_TYPE SearchType,
- IN EFI_GUID *SectionDefinitionGuid
- )
-/*++
-
-Routine Description:
- Worker function. Determine if the input stream:child matches the input type.
-
-Arguments:
- Stream - Indicates the section stream associated with the child
- Child - Indicates the child to check
- SearchType - Indicates the type of section to check against for
- SectionDefinitionGuid - Indicates the GUID to check against if the type is
- EFI_SECTION_GUID_DEFINED
-Returns:
- TRUE - The child matches
- FALSE - The child doesn't match
-
---*/
-{
- EFI_GUID_DEFINED_SECTION *GuidedSection;
-
- if (SearchType == EFI_SECTION_ALL) {
- return TRUE;
- }
- if (Child->Type != SearchType) {
- return FALSE;
- }
- if (SearchType != EFI_SECTION_GUID_DEFINED) {
- return TRUE;
- }
- GuidedSection = (EFI_GUID_DEFINED_SECTION * )(Stream->StreamBuffer + Child->OffsetInStream);
- return CompareGuid (&GuidedSection->SectionDefinitionGuid, SectionDefinitionGuid);
-}
-
-
-STATIC
-EFI_STATUS
-FindChildNode (
- IN CORE_SECTION_STREAM_NODE *SourceStream,
- IN EFI_SECTION_TYPE SearchType,
- IN OUT UINTN *SectionInstance,
- IN EFI_GUID *SectionDefinitionGuid,
- OUT CORE_SECTION_CHILD_NODE **FoundChild,
- OUT CORE_SECTION_STREAM_NODE **FoundStream,
- OUT UINT32 *AuthenticationStatus
- )
-/*++
-
-Routine Description:
- Worker function Recursively searches / builds section stream database
- looking for requested section.
-
-Arguments:
- SourceStream - Indicates the section stream in which to do the search.
- SearchType - Indicates the type of section to search for.
- SectionInstance - Indicates which instance of section to find. This is
- an in/out parameter to deal with recursions.
- SectionDefinitionGuid - Guid of section definition
- FoundChild - Output indicating the child node that is found.
- FoundStream - Output indicating which section stream the child was
- found in. If this stream was generated as a result of
- an encapsulation section, the streamhandle is visible
- within the SEP driver only.
- AuthenticationStatus- Indicates the authentication status of the found section.
-
-Returns:
- EFI_SUCCESS - Child node was found and returned.
- EFI_OUT_OF_RESOURCES- Memory allocation failed.
- EFI_NOT_FOUND - Requested child node does not exist.
- EFI_PROTOCOL_ERROR - a required GUIDED section extraction protocol does not
- exist
-
---*/
-{
- CORE_SECTION_CHILD_NODE *CurrentChildNode;
- CORE_SECTION_CHILD_NODE *RecursedChildNode;
- CORE_SECTION_STREAM_NODE *RecursedFoundStream;
- UINT32 NextChildOffset;
- EFI_STATUS ErrorStatus;
- EFI_STATUS Status;
-
- CurrentChildNode = NULL;
- ErrorStatus = EFI_NOT_FOUND;
-
- if (SourceStream->StreamLength == 0) {
- return EFI_NOT_FOUND;
- }
-
- if (IsListEmpty (&SourceStream->Children) &&
- SourceStream->StreamLength > sizeof (EFI_COMMON_SECTION_HEADER)) {
- //
- // This occurs when a section stream exists, but no child sections
- // have been parsed out yet. Therefore, extract the first child and add it
- // to the list of children so we can get started.
- //
- Status = CreateChildNode (SourceStream, 0, &CurrentChildNode);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- //
- // At least one child has been parsed out of the section stream. So, walk
- // through the sections that have already been parsed out looking for the
- // requested section, if necessary, continue parsing section stream and
- // adding children until either the requested section is found, or we run
- // out of data
- //
- CurrentChildNode = CHILD_SECTION_NODE_FROM_LINK (GetFirstNode(&SourceStream->Children));
-
- for (;;) {
- if (ChildIsType (SourceStream, CurrentChildNode, SearchType, SectionDefinitionGuid)) {
- //
- // The type matches, so check the instance count to see if it's the one we want
- //
- (*SectionInstance)--;
- if (*SectionInstance == 0) {
- //
- // Got it!
- //
- *FoundChild = CurrentChildNode;
- *FoundStream = SourceStream;
- *AuthenticationStatus = SourceStream->AuthenticationStatus;
- return EFI_SUCCESS;
- }
- }
-
- if (CurrentChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {
- //
- // If the current node is an encapsulating node, recurse into it...
- //
- Status = FindChildNode (
- (CORE_SECTION_STREAM_NODE *)CurrentChildNode->EncapsulatedStreamHandle,
- SearchType,
- SectionInstance,
- SectionDefinitionGuid,
- &RecursedChildNode,
- &RecursedFoundStream,
- AuthenticationStatus
- );
- //
- // If the status is not EFI_SUCCESS, just save the error code and continue
- // to find the request child node in the rest stream.
- //
- if (*SectionInstance == 0) {
- ASSERT_EFI_ERROR (Status);
- *FoundChild = RecursedChildNode;
- *FoundStream = RecursedFoundStream;
- return EFI_SUCCESS;
- } else {
- ErrorStatus = Status;
- }
- }
-
- if (!IsNodeAtEnd (&SourceStream->Children, &CurrentChildNode->Link)) {
- //
- // We haven't found the child node we're interested in yet, but there's
- // still more nodes that have already been parsed so get the next one
- // and continue searching..
- //
- CurrentChildNode = CHILD_SECTION_NODE_FROM_LINK (GetNextNode (&SourceStream->Children, &CurrentChildNode->Link));
- } else {
- //
- // We've exhausted children that have already been parsed, so see if
- // there's any more data and continue parsing out more children if there
- // is.
- //
- NextChildOffset = CurrentChildNode->OffsetInStream + CurrentChildNode->Size;
- //
- // Round up to 4 byte boundary
- //
- NextChildOffset += 3;
- NextChildOffset &= ~(UINTN)3;
- if (NextChildOffset <= SourceStream->StreamLength - sizeof (EFI_COMMON_SECTION_HEADER)) {
- //
- // There's an unparsed child remaining in the stream, so create a new child node
- //
- Status = CreateChildNode (SourceStream, NextChildOffset, &CurrentChildNode);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- } else {
- ASSERT (EFI_ERROR (ErrorStatus));
- return ErrorStatus;
- }
- }
- }
-}
-
-
-STATIC
-EFI_STATUS
-CreateChildNode (
- IN CORE_SECTION_STREAM_NODE *Stream,
- IN UINT32 ChildOffset,
- OUT CORE_SECTION_CHILD_NODE **ChildNode
- )
-/*++
-
-Routine Description:
- Worker function. Constructor for new child nodes.
-
-Arguments:
- Stream - Indicates the section stream in which to add the child.
- ChildOffset - Indicates the offset in Stream that is the beginning
- of the child section.
- ChildNode - Indicates the Callee allocated and initialized child.
-
-Returns:
- EFI_SUCCESS - Child node was found and returned.
- EFI_OUT_OF_RESOURCES- Memory allocation failed.
- EFI_PROTOCOL_ERROR - Encapsulation sections produce new stream handles when
- the child node is created. If the section type is GUID
- defined, and the extraction GUID does not exist, and
- producing the stream requires the GUID, then a protocol
- error is generated and no child is produced.
- Values returned by OpenSectionStreamEx.
-
---*/
-{
- EFI_STATUS Status;
- EFI_COMMON_SECTION_HEADER *SectionHeader;
- EFI_COMPRESSION_SECTION *CompressionHeader;
- EFI_GUID_DEFINED_SECTION *GuidedHeader;
- EFI_TIANO_DECOMPRESS_PROTOCOL *Decompress;
- EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *GuidedExtraction;
- VOID *NewStreamBuffer;
- VOID *ScratchBuffer;
- UINT32 ScratchSize;
- UINTN NewStreamBufferSize;
- UINT32 AuthenticationStatus;
- UINT32 SectionLength;
-
- CORE_SECTION_CHILD_NODE *Node;
-
- SectionHeader = (EFI_COMMON_SECTION_HEADER *) (Stream->StreamBuffer + ChildOffset);
-
- //
- // Allocate a new node
- //
- *ChildNode = CoreAllocateBootServicesPool (sizeof (CORE_SECTION_CHILD_NODE));
- Node = *ChildNode;
- if (Node == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Now initialize it
- //
- Node->Signature = CORE_SECTION_CHILD_SIGNATURE;
- Node->Type = SectionHeader->Type;
- Node->Size = SECTION_SIZE (SectionHeader);
- Node->OffsetInStream = ChildOffset;
- Node->EncapsulatedStreamHandle = NULL_STREAM_HANDLE;
- Node->EncapsulationGuid = NULL;
-
- //
- // If it's an encapsulating section, then create the new section stream also
- //
- switch (Node->Type) {
- case EFI_SECTION_COMPRESSION:
- //
- // Get the CompressionSectionHeader
- //
- ASSERT (Node->Size >= sizeof (EFI_COMPRESSION_SECTION));
-
- CompressionHeader = (EFI_COMPRESSION_SECTION *) SectionHeader;
-
- //
- // Allocate space for the new stream
- //
- if (CompressionHeader->UncompressedLength > 0) {
- NewStreamBufferSize = CompressionHeader->UncompressedLength;
- NewStreamBuffer = CoreAllocateBootServicesPool (NewStreamBufferSize);
- if (NewStreamBuffer == NULL) {
- CoreFreePool (Node);
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (CompressionHeader->CompressionType == EFI_NOT_COMPRESSED) {
- //
- // stream is not actually compressed, just encapsulated. So just copy it.
- //
- CopyMem (NewStreamBuffer, CompressionHeader + 1, NewStreamBufferSize);
- } else if (CompressionHeader->CompressionType == EFI_STANDARD_COMPRESSION ||
- CompressionHeader->CompressionType == EFI_CUSTOMIZED_COMPRESSION) {
- //
- // Decompress the stream
- //
- if (CompressionHeader->CompressionType == EFI_STANDARD_COMPRESSION) {
- Status = CoreLocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID **)&Decompress);
- } else {
- Status = CoreLocateProtocol (&gEfiCustomizedDecompressProtocolGuid, NULL, (VOID **)&Decompress);
- }
-
- ASSERT_EFI_ERROR (Status);
-
- Status = Decompress->GetInfo (
- Decompress,
- CompressionHeader + 1,
- Node->Size - sizeof (EFI_COMPRESSION_SECTION),
- (UINT32 *)&NewStreamBufferSize,
- &ScratchSize
- );
- ASSERT_EFI_ERROR (Status);
- ASSERT (NewStreamBufferSize == CompressionHeader->UncompressedLength);
-
- ScratchBuffer = CoreAllocateBootServicesPool (ScratchSize);
- if (ScratchBuffer == NULL) {
- CoreFreePool (Node);
- CoreFreePool (NewStreamBuffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = Decompress->Decompress (
- Decompress,
- CompressionHeader + 1,
- Node->Size - sizeof (EFI_COMPRESSION_SECTION),
- NewStreamBuffer,
- (UINT32)NewStreamBufferSize,
- ScratchBuffer,
- ScratchSize
- );
- ASSERT_EFI_ERROR (Status);
- CoreFreePool (ScratchBuffer);
- }
- } else {
- NewStreamBuffer = NULL;
- NewStreamBufferSize = 0;
- }
-
- Status = OpenSectionStreamEx (
- NewStreamBufferSize,
- NewStreamBuffer,
- FALSE,
- Stream->AuthenticationStatus,
- &Node->EncapsulatedStreamHandle
- );
- if (EFI_ERROR (Status)) {
- CoreFreePool (Node);
- CoreFreePool (NewStreamBuffer);
- return Status;
- }
- break;
-
- case EFI_SECTION_GUID_DEFINED:
- GuidedHeader = (EFI_GUID_DEFINED_SECTION *) SectionHeader;
- Node->EncapsulationGuid = &GuidedHeader->SectionDefinitionGuid;
- Status = CoreLocateProtocol (Node->EncapsulationGuid, NULL, (VOID **)&GuidedExtraction);
- if (!EFI_ERROR (Status)) {
- //
- // NewStreamBuffer is always allocated by ExtractSection... No caller
- // allocation here.
- //
- Status = GuidedExtraction->ExtractSection (
- GuidedExtraction,
- GuidedHeader,
- &NewStreamBuffer,
- &NewStreamBufferSize,
- &AuthenticationStatus
- );
- if (EFI_ERROR (Status)) {
- CoreFreePool (*ChildNode);
- return EFI_PROTOCOL_ERROR;
- }
-
- //
- // Make sure we initialize the new stream with the correct
- // authentication status for both aggregate and local status fields.
- //
- if (GuidedHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) {
- //
- // OR in the parent stream's aggregate status.
- //
- AuthenticationStatus |= Stream->AuthenticationStatus & EFI_AGGREGATE_AUTH_STATUS_ALL;
- } else {
- //
- // since there's no authentication data contributed by the section,
- // just inherit the full value from our immediate parent.
- //
- AuthenticationStatus = Stream->AuthenticationStatus;
- }
-
- Status = OpenSectionStreamEx (
- NewStreamBufferSize,
- NewStreamBuffer,
- FALSE,
- AuthenticationStatus,
- &Node->EncapsulatedStreamHandle
- );
- if (EFI_ERROR (Status)) {
- CoreFreePool (*ChildNode);
- CoreFreePool (NewStreamBuffer);
- return Status;
- }
- } else {
- //
- // There's no GUIDed section extraction protocol available.
- //
- if (GuidedHeader->Attributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) {
- //
- // If the section REQUIRES an extraction protocol, then we're toast
- //
- CoreFreePool (*ChildNode);
- return EFI_PROTOCOL_ERROR;
- }
-
- //
- // Figure out the proper authentication status
- //
- AuthenticationStatus = Stream->AuthenticationStatus;
- if (GuidedHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID) {
- //
- // The local status of the new stream is contained in
- // AuthenticaionStatus. This value needs to be ORed into the
- // Aggregate bits also...
- //
-
- //
- // Clear out and initialize the local status
- //
- AuthenticationStatus &= ~EFI_LOCAL_AUTH_STATUS_ALL;
- AuthenticationStatus |= EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED | EFI_LOCAL_AUTH_STATUS_NOT_TESTED;
- //
- // OR local status into aggregate status
- //
- AuthenticationStatus |= AuthenticationStatus >> 16;
- }
-
- SectionLength = SECTION_SIZE (GuidedHeader);
- Status = OpenSectionStreamEx (
- SectionLength - GuidedHeader->DataOffset,
- (UINT8 *) GuidedHeader + GuidedHeader->DataOffset,
- TRUE,
- AuthenticationStatus,
- &Node->EncapsulatedStreamHandle
- );
- if (EFI_ERROR (Status)) {
- CoreFreePool (Node);
- return Status;
- }
- }
-
- if ((AuthenticationStatus & EFI_LOCAL_AUTH_STATUS_ALL) ==
- (EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED | EFI_LOCAL_AUTH_STATUS_NOT_TESTED)) {
- //
- // Need to register for RPN for when the required GUIDed extraction
- // protocol becomes available. This will enable us to refresh the
- // AuthenticationStatus cached in the Stream if it's ever requested
- // again.
- //
- CreateGuidedExtractionRpnEvent (Stream, Node);
- }
-
- break;
-
- default:
-
- //
- // Nothing to do if it's a leaf
- //
- break;
- }
-
- //
- // Last, add the new child node to the stream
- //
- InsertTailList (&Stream->Children, &Node->Link);
-
- return EFI_SUCCESS;
-}
-
-
-STATIC
-VOID
-CreateGuidedExtractionRpnEvent (
- IN CORE_SECTION_STREAM_NODE *ParentStream,
- IN CORE_SECTION_CHILD_NODE *ChildNode
- )
-/*++
-
-Routine Description:
- Worker function. Constructor for RPN event if needed to keep AuthenticationStatus
- cache correct when a missing GUIDED_SECTION_EXTRACTION_PROTOCOL appears...
-
-Arguments:
- ParentStream - Indicates the parent of the ecnapsulation section (child)
- ChildNode - Indicates the child node that is the encapsulation section.
-
-Returns:
- None
-
---*/
-{
- RPN_EVENT_CONTEXT *Context;
-
- //
- // Allocate new event structure and context
- //
- Context = CoreAllocateBootServicesPool (sizeof (RPN_EVENT_CONTEXT));
- ASSERT (Context != NULL);
-
- Context->ChildNode = ChildNode;
- Context->ParentStream = ParentStream;
-
- Context->Event = CoreCreateProtocolNotifyEvent (
- Context->ChildNode->EncapsulationGuid,
- TPL_NOTIFY,
- NotifyGuidedExtraction,
- Context,
- &Context->Registration,
- FALSE
- );
-}
-
-
-STATIC
-VOID
-EFIAPI
-NotifyGuidedExtraction (
- IN EFI_EVENT Event,
- IN VOID *RpnContext
- )
-/*++
-
-Routine Description:
- RPN callback function. Removes a stale section stream and re-initializes it
- with an updated AuthenticationStatus.
-
-Arguments:
- Event - The event that fired
- RpnContext - A pointer to the context that allows us to identify
- the relevent encapsulation...
-
-Returns:
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_GUID_DEFINED_SECTION *GuidedHeader;
- EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *GuidedExtraction;
- VOID *NewStreamBuffer;
- UINTN NewStreamBufferSize;
- UINT32 AuthenticationStatus;
- RPN_EVENT_CONTEXT *Context;
-
- Context = RpnContext;
-
- Status = CloseSectionStream (&mSectionExtraction, Context->ChildNode->EncapsulatedStreamHandle);
- if (!EFI_ERROR (Status)) {
- //
- // The stream closed successfully, so re-open the stream with correct AuthenticationStatus
- //
-
- GuidedHeader = (EFI_GUID_DEFINED_SECTION *)
- (Context->ParentStream->StreamBuffer + Context->ChildNode->OffsetInStream);
- ASSERT (GuidedHeader->CommonHeader.Type == EFI_SECTION_GUID_DEFINED);
-
- Status = CoreLocateProtocol (Context->ChildNode->EncapsulationGuid, NULL, (VOID **)&GuidedExtraction);
- ASSERT_EFI_ERROR (Status);
-
-
- Status = GuidedExtraction->ExtractSection (
- GuidedExtraction,
- GuidedHeader,
- &NewStreamBuffer,
- &NewStreamBufferSize,
- &AuthenticationStatus
- );
- ASSERT_EFI_ERROR (Status);
- //
- // OR in the parent stream's aggregagate status.
- //
- AuthenticationStatus |= Context->ParentStream->AuthenticationStatus & EFI_AGGREGATE_AUTH_STATUS_ALL;
- Status = OpenSectionStreamEx (
- NewStreamBufferSize,
- NewStreamBuffer,
- FALSE,
- AuthenticationStatus,
- &Context->ChildNode->EncapsulatedStreamHandle
- );
- ASSERT_EFI_ERROR (Status);
- }
-
- //
- // If above, the stream did not close successfully, it indicates it's
- // alread been closed by someone, so just destroy the event and be done with
- // it.
- //
-
- CoreCloseEvent (Event);
- CoreFreePool (Context);
-}
-
-
-STATIC
-VOID
-FreeChildNode (
- IN CORE_SECTION_CHILD_NODE *ChildNode
- )
-/*++
-
-Routine Description:
- Worker function. Destructor for child nodes.
-
-Arguments:
- ChildNode - Indicates the node to destroy
-
-Returns:
- none
-
---*/
-{
- ASSERT (ChildNode->Signature == CORE_SECTION_CHILD_SIGNATURE);
- //
- // Remove the child from it's list
- //
- RemoveEntryList (&ChildNode->Link);
-
- if (ChildNode->EncapsulatedStreamHandle != NULL_STREAM_HANDLE) {
- //
- // If it's an encapsulating section, we close the resulting section stream.
- // CloseSectionStream will free all memory associated with the stream.
- //
- CloseSectionStream (&mSectionExtraction, ChildNode->EncapsulatedStreamHandle);
- }
- //
- // Last, free the child node itself
- //
- CoreFreePool (ChildNode);
-}
-
-
-STATIC
-EFI_STATUS
-OpenSectionStreamEx (
- IN UINTN SectionStreamLength,
- IN VOID *SectionStream,
- IN BOOLEAN AllocateBuffer,
- IN UINT32 AuthenticationStatus,
- OUT UINTN *SectionStreamHandle
- )
-/*++
-
- Routine Description:
- Worker function. Constructor for section streams.
-
- Arguments:
- SectionStreamLength - Size in bytes of the section stream.
- SectionStream - Buffer containing the new section stream.
- AllocateBuffer - Indicates whether the stream buffer is to be copied
- or the input buffer is to be used in place.
- AuthenticationStatus- Indicates the default authentication status for the
- new stream.
- SectionStreamHandle - A pointer to a caller allocated section stream handle.
-
- Returns:
- EFI_SUCCESS - Stream was added to stream database.
- EFI_OUT_OF_RESOURCES - memory allocation failed.
-
---*/
-{
- CORE_SECTION_STREAM_NODE *NewStream;
- EFI_TPL OldTpl;
-
- //
- // Allocate a new stream
- //
- NewStream = CoreAllocateBootServicesPool (sizeof (CORE_SECTION_STREAM_NODE));
- if (NewStream == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (AllocateBuffer) {
- //
- // if we're here, we're double buffering, allocate the buffer and copy the
- // data in
- //
- if (SectionStreamLength > 0) {
- NewStream->StreamBuffer = CoreAllocateBootServicesPool (SectionStreamLength);
- if (NewStream->StreamBuffer == NULL) {
- CoreFreePool (NewStream);
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Copy in stream data
- //
- CopyMem (NewStream->StreamBuffer, SectionStream, SectionStreamLength);
- } else {
- //
- // It's possible to have a zero length section stream.
- //
- NewStream->StreamBuffer = NULL;
- }
- } else {
- //
- // If were here, the caller has supplied the buffer (it's an internal call)
- // so just assign the buffer. This happens when we open section streams
- // as a result of expanding an encapsulating section.
- //
- NewStream->StreamBuffer = SectionStream;
- }
-
- //
- // Initialize the rest of the section stream
- //
- NewStream->Signature = CORE_SECTION_STREAM_SIGNATURE;
- NewStream->StreamHandle = (UINTN) NewStream;
- NewStream->StreamLength = SectionStreamLength;
- InitializeListHead (&NewStream->Children);
- NewStream->AuthenticationStatus = AuthenticationStatus;
-
- //
- // Add new stream to stream list
- //
- OldTpl = CoreRaiseTpl (TPL_NOTIFY);
- InsertTailList (&mStreamRoot, &NewStream->Link);
- CoreRestoreTpl (OldTpl);
-
- *SectionStreamHandle = NewStream->StreamHandle;
-
- return EFI_SUCCESS;
-}
-
-
-STATIC
-EFI_STATUS
-FindStreamNode (
- IN UINTN SearchHandle,
- OUT CORE_SECTION_STREAM_NODE **FoundStream
- )
-/*++
-
- Routine Description:
- Worker function. Search stream database for requested stream handle.
-
- Arguments:
- SearchHandle - Indicates which stream to look for.
- FoundStream - Output pointer to the found stream.
-
- Returns:
- EFI_SUCCESS - StreamHandle was found and *FoundStream contains
- the stream node.
- EFI_NOT_FOUND - SearchHandle was not found in the stream database.
-
---*/
-{
- CORE_SECTION_STREAM_NODE *StreamNode;
-
- if (!IsListEmpty (&mStreamRoot)) {
- StreamNode = STREAM_NODE_FROM_LINK (GetFirstNode (&mStreamRoot));
- for (;;) {
- if (StreamNode->StreamHandle == SearchHandle) {
- *FoundStream = StreamNode;
- return EFI_SUCCESS;
- } else if (IsNodeAtEnd (&mStreamRoot, &StreamNode->Link)) {
- break;
- } else {
- StreamNode = STREAM_NODE_FROM_LINK (GetNextNode (&mStreamRoot, &StreamNode->Link));
- }
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-
-STATIC
-BOOLEAN
-IsValidSectionStream (
- IN VOID *SectionStream,
- IN UINTN SectionStreamLength
- )
-/*++
-
-Routine Description:
- Check if a stream is valid.
-
-Arguments:
- SectionStream - The section stream to be checked
- SectionStreamLength - The length of section stream
-
-Returns:
- TRUE
- FALSE
-
---*/
-{
- UINTN TotalLength;
- UINTN SectionLength;
- EFI_COMMON_SECTION_HEADER *SectionHeader;
- EFI_COMMON_SECTION_HEADER *NextSectionHeader;
-
- TotalLength = 0;
- SectionHeader = (EFI_COMMON_SECTION_HEADER *)SectionStream;
-
- while (TotalLength < SectionStreamLength) {
- SectionLength = SECTION_SIZE (SectionHeader);
- TotalLength += SectionLength;
-
- if (TotalLength == SectionStreamLength) {
- return TRUE;
- }
-
- //
- // Move to the next byte following the section...
- //
- SectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) SectionHeader + SectionLength);
-
- //
- // Figure out where the next section begins
- //
- NextSectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINTN) SectionHeader + 3);
- NextSectionHeader = (EFI_COMMON_SECTION_HEADER *) ((UINTN) NextSectionHeader & ~(UINTN)3);
- TotalLength += (UINTN) NextSectionHeader - (UINTN) SectionHeader;
- SectionHeader = NextSectionHeader;
- }
-
- ASSERT (FALSE);
- return FALSE;
-}
diff --git a/EdkModulePkg/Core/Dxe/gcd.h b/EdkModulePkg/Core/Dxe/gcd.h
deleted file mode 100644
index 445821e..0000000
--- a/EdkModulePkg/Core/Dxe/gcd.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- gcd.h
-
-Abstract:
-
-Revision History
-
---*/
-
-#ifndef _GCD_H
-#define _GCD_H
-
-//
-// GCD Operations
-//
-#define GCD_MEMORY_SPACE_OPERATION 0x20
-#define GCD_IO_SPACE_OPERATION 0x40
-
-#define GCD_ADD_MEMORY_OPERATION (GCD_MEMORY_SPACE_OPERATION | 0)
-#define GCD_ALLOCATE_MEMORY_OPERATION (GCD_MEMORY_SPACE_OPERATION | 1)
-#define GCD_FREE_MEMORY_OPERATION (GCD_MEMORY_SPACE_OPERATION | 2)
-#define GCD_REMOVE_MEMORY_OPERATION (GCD_MEMORY_SPACE_OPERATION | 3)
-#define GCD_SET_ATTRIBUTES_MEMORY_OPERATION (GCD_MEMORY_SPACE_OPERATION | 4)
-
-#define GCD_ADD_IO_OPERATION (GCD_IO_SPACE_OPERATION | 0)
-#define GCD_ALLOCATE_IO_OPERATION (GCD_IO_SPACE_OPERATION | 1)
-#define GCD_FREE_IO_OPERATION (GCD_IO_SPACE_OPERATION | 2)
-#define GCD_REMOVE_IO_OPERATION (GCD_IO_SPACE_OPERATION | 3)
-
-//
-// The data structure used to convert from GCD attributes to EFI Memory Map attributes
-//
-typedef struct {
- UINT64 Attribute;
- UINT64 Capability;
- BOOLEAN Memory;
-} GCD_ATTRIBUTE_CONVERSION_ENTRY;
-
-#endif
diff --git a/EdkModulePkg/Core/Dxe/hand.h b/EdkModulePkg/Core/Dxe/hand.h
deleted file mode 100644
index c61af16..0000000
--- a/EdkModulePkg/Core/Dxe/hand.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- hand.h
-
-Abstract:
-
- EFI internal protocol definitions
-
-
-
-Revision History
-
---*/
-
-#ifndef _HAND_H_
-#define _HAND_H_
-
-
-//
-// IHANDLE - contains a list of protocol handles
-//
-
-#define EFI_HANDLE_SIGNATURE EFI_SIGNATURE_32('h','n','d','l')
-typedef struct {
- UINTN Signature;
- LIST_ENTRY AllHandles; // All handles list of IHANDLE
- LIST_ENTRY Protocols; // List of PROTOCOL_INTERFACE's for this handle
- UINTN LocateRequest; //
- UINT64 Key; // The Handle Database Key value when this handle was last created or modified
-} IHANDLE;
-
-#define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)
-
-
-//
-// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
-// database. Each handler that supports this protocol is listed, along
-// with a list of registered notifies.
-//
-
-#define PROTOCOL_ENTRY_SIGNATURE EFI_SIGNATURE_32('p','r','t','e')
-typedef struct {
- UINTN Signature;
- LIST_ENTRY AllEntries; // All entries
- EFI_GUID ProtocolID; // ID of the protocol
- LIST_ENTRY Protocols; // All protocol interfaces
- LIST_ENTRY Notify; // Registerd notification handlers
-} PROTOCOL_ENTRY;
-
-//
-// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
-// with a protocol interface structure
-//
-
-#define PROTOCOL_INTERFACE_SIGNATURE EFI_SIGNATURE_32('p','i','f','c')
-typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle; // Back pointer
- LIST_ENTRY Link; // Link on IHANDLE.Protocols
- LIST_ENTRY ByProtocol; // Link on PROTOCOL_ENTRY.Protocols
- PROTOCOL_ENTRY *Protocol; // The protocol ID
- VOID *Interface; // The interface value
-
- LIST_ENTRY OpenList; // OPEN_PROTOCOL_DATA list.
- UINTN OpenListCount;
-
- EFI_HANDLE ControllerHandle;
-
-} PROTOCOL_INTERFACE;
-
-#define OPEN_PROTOCOL_DATA_SIGNATURE EFI_SIGNATURE_32('p','o','d','l')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- EFI_HANDLE AgentHandle;
- EFI_HANDLE ControllerHandle;
- UINT32 Attributes;
- UINT32 OpenCount;
-} OPEN_PROTOCOL_DATA;
-
-
-//
-// PROTOCOL_NOTIFY - used for each register notification for a protocol
-//
-
-#define PROTOCOL_NOTIFY_SIGNATURE EFI_SIGNATURE_32('p','r','t','n')
-typedef struct {
- UINTN Signature;
- PROTOCOL_ENTRY *Protocol;
- LIST_ENTRY Link; // All notifications for this protocol
- EFI_EVENT Event; // Event to notify
- LIST_ENTRY *Position; // Last position notified
-} PROTOCOL_NOTIFY;
-
-//
-// Internal prototypes
-//
-
-
-PROTOCOL_ENTRY *
-CoreFindProtocolEntry (
- IN EFI_GUID *Protocol,
- IN BOOLEAN Create
- )
-/*++
-
-Routine Description:
-
- Finds the protocol entry for the requested protocol.
-
- The gProtocolDatabaseLock must be owned
-
-Arguments:
-
- Protocol - The ID of the protocol
-
- Create - Create a new entry if not found
-
-Returns:
-
- Protocol entry
-
---*/
-;
-
-VOID
-CoreNotifyProtocolEntry (
- IN PROTOCOL_ENTRY *ProtEntry
- )
-/*++
-
-Routine Description:
-
- Signal event for every protocol in protocol entry.
-
-Arguments:
-
- ProtEntry - Protocol entry
-
-Returns:
-
---*/
-;
-
-PROTOCOL_INTERFACE *
-CoreFindProtocolInterface (
- IN IHANDLE *Handle,
- IN EFI_GUID *Protocol,
- IN VOID *Interface
- )
-/*++
-
-Routine Description:
-
- Finds the protocol instance for the requested handle and protocol.
-
- Note: This function doesn't do parameters checking, it's caller's responsibility
- to pass in valid parameters.
-
-Arguments:
-
- Handle - The handle to search the protocol on
-
- Protocol - GUID of the protocol
-
- Interface - The interface for the protocol being searched
-
-Returns:
-
- Protocol instance (NULL: Not found)
-
---*/
-;
-
-PROTOCOL_INTERFACE *
-CoreRemoveInterfaceFromProtocol (
- IN IHANDLE *Handle,
- IN EFI_GUID *Protocol,
- IN VOID *Interface
- )
-/*++
-
-Routine Description:
-
- Removes Protocol from the protocol list (but not the handle list).
-
-Arguments:
-
- Handle - The handle to remove protocol on.
-
- Protocol - GUID of the protocol to be moved
-
- Interface - The interface of the protocol
-
-Returns:
-
- Protocol Entry
-
---*/
-;
-
-EFI_STATUS
-CoreUnregisterProtocolNotify (
- IN EFI_EVENT Event
- )
-/*++
-
-Routine Description:
-
- Removes all the events in the protocol database that match Event.
-
-Arguments:
-
- Event - The event to search for in the protocol database.
-
-Returns:
-
- EFI_SUCCESS when done searching the entire database.
-
---*/
-;
-
-EFI_STATUS
-CoreDisconnectControllersUsingProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN PROTOCOL_INTERFACE *Prot
- )
-/*++
-
-Routine Description:
-
- Attempts to disconnect all drivers that are using the protocol interface being queried.
- If failed, reconnect all drivers disconnected.
-
- Note: This function doesn't do parameters checking, it's caller's responsibility
- to pass in valid parameters.
-
-Arguments:
-
- UserHandle - The handle on which the protocol is installed
- Prot - The protocol to disconnect drivers from
-
-Returns:
-
- EFI_SUCCESS - Drivers using the protocol interface are all disconnected
- EFI_ACCESS_DENIED - Failed to disconnect one or all of the drivers
-
---*/
-;
-
-VOID
-CoreAcquireProtocolLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Acquire lock on gProtocolDatabaseLock.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-VOID
-CoreReleaseProtocolLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Release lock on gProtocolDatabaseLock.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-EFI_STATUS
-CoreValidateHandle (
- IN EFI_HANDLE UserHandle
- )
-/*++
-
-Routine Description:
-
- Check whether a handle is a valid EFI_HANDLE
-
-Arguments:
-
- UserHandle - The handle to check
-
-Returns:
-
- EFI_INVALID_PARAMETER - The handle is NULL or not a valid EFI_HANDLE.
-
- EFI_SUCCESS - The handle is valid EFI_HANDLE.
-
---*/
-;
-
-//
-// Externs
-//
-
-extern EFI_LOCK gProtocolDatabaseLock;
-extern LIST_ENTRY gHandleList;
-extern UINT64 gHandleDatabaseKey;
-
-#endif
diff --git a/EdkModulePkg/Core/Dxe/imem.h b/EdkModulePkg/Core/Dxe/imem.h
deleted file mode 100644
index 3337700..0000000
--- a/EdkModulePkg/Core/Dxe/imem.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- imem.h
-
-Abstract:
-
- Head file to imem.h
-
-
-Revision History
-
---*/
-
-#ifndef _IMEM_H_
-#define _IMEM_H_
-
-#if defined (MDE_CPU_IPF)
-//
-// For Itanium machines make the default allocations 8K aligned
-//
-#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2)
-#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2)
-
-#else
-//
-// For genric EFI machines make the default allocations 4K aligned
-//
-#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
-#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
-
-#endif
-
-
-//
-// MEMORY_MAP_ENTRY
-//
-
-#define MEMORY_MAP_SIGNATURE EFI_SIGNATURE_32('m','m','a','p')
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- BOOLEAN FromPages;
-
- EFI_MEMORY_TYPE Type;
- UINT64 Start;
- UINT64 End;
-
- UINT64 VirtualStart;
- UINT64 Attribute;
-} MEMORY_MAP;
-
-//
-// Internal prototypes
-//
-
-VOID *
-CoreAllocatePoolPages (
- IN EFI_MEMORY_TYPE PoolType,
- IN UINTN NumberOfPages,
- IN UINTN Alignment
- )
-/*++
-
-Routine Description:
-
- Internal function. Used by the pool functions to allocate pages
- to back pool allocation requests.
-
-Arguments:
-
- PoolType - The type of memory for the new pool pages
-
- NumberOfPages - No of pages to allocate
-
- Alignment - Bits to align.
-
-Returns:
-
- The allocated memory, or NULL
-
---*/
-;
-
-
-VOID
-CoreFreePoolPages (
- IN EFI_PHYSICAL_ADDRESS Memory,
- IN UINTN NumberOfPages
- )
-/*++
-
-Routine Description:
-
- Internal function. Frees pool pages allocated via AllocatePoolPages ()
-
-Arguments:
-
- Memory - The base address to free
-
- NumberOfPages - The number of pages to free
-
-Returns:
-
- None
-
---*/
-;
-
-
-VOID *
-CoreAllocatePoolI (
- IN EFI_MEMORY_TYPE PoolType,
- IN UINTN Size
- )
-/*++
-
-Routine Description:
-
- Internal function to allocate pool of a particular type.
-
- Caller must have the memory lock held
-
-
-Arguments:
-
- PoolType - Type of pool to allocate
-
- Size - The amount of pool to allocate
-
-Returns:
-
- The allocate pool, or NULL
-
---*/
-;
-
-
-EFI_STATUS
-CoreFreePoolI (
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Internal function to free a pool entry.
-
- Caller must have the memory lock held
-
-
-Arguments:
-
- Buffer - The allocated pool entry to free
-
-Returns:
-
- EFI_INVALID_PARAMETER - Buffer not valid
-
- EFI_SUCCESS - Buffer successfully freed.
-
---*/
-;
-
-
-VOID
-CoreAcquireMemoryLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Enter critical section by gaining lock on gMemoryLock
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-VOID
-CoreReleaseMemoryLock (
- VOID
- )
-/*++
-
-Routine Description:
-
- Exit critical section by releasing lock on gMemoryLock
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-
-//
-// Internal Global data
-//
-
-extern EFI_LOCK gMemoryLock;
-extern LIST_ENTRY gMemoryMap;
-extern MEMORY_MAP *gMemoryLastConvert;
-extern LIST_ENTRY mGcdMemorySpaceMap;
-#endif
diff --git a/EdkModulePkg/Core/DxeIplPeim/DxeIpl.dxs b/EdkModulePkg/Core/DxeIplPeim/DxeIpl.dxs
deleted file mode 100644
index 015c180..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/DxeIpl.dxs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeIpl.dxs
-
-Abstract:
-
- Dependency expression file for DXE Initial Program Loader PEIM.
-
---*/
-
-#include <PeimDepex.h>
-
-DEPENDENCY_START
- EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID
-DEPENDENCY_END
-
-
diff --git a/EdkModulePkg/Core/DxeIplPeim/DxeIpl.h b/EdkModulePkg/Core/DxeIplPeim/DxeIpl.h
deleted file mode 100644
index 2c711ed..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/DxeIpl.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeIpl.h
-
-Abstract:
-
---*/
-
-#ifndef __PEI_DXEIPL_H__
-#define __PEI_DXEIPL_H__
-
-#define STACK_SIZE 0x20000
-#define BSP_STORE_SIZE 0x4000
-
-#define GET_OCCUPIED_SIZE(ActualSize, Alignment) ((ActualSize + (Alignment - 1)) & ~(Alignment - 1))
-
-extern BOOLEAN gInMemory;
-
-EFI_STATUS
-PeiFindFile (
- IN UINT8 Type,
- IN UINT16 SectionType,
- OUT EFI_GUID *FileName,
- OUT VOID **Pe32Data
- )
-;
-
-EFI_STATUS
-PeiLoadFile (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader,
- IN VOID *Pe32Data,
- OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
- OUT UINT64 *ImageSize,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint
- )
-;
-
-
-EFI_STATUS
-GetImageReadFunction (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-;
-
-EFI_STATUS
-PeiImageRead (
- IN VOID *FileHandle,
- IN UINTN FileOffset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-DxeIplLoadFile (
- IN EFI_PEI_FV_FILE_LOADER_PPI *This,
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
- OUT UINT64 *ImageSize,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint
- );
-
-EFI_STATUS
-ShadowDxeIpl (
- IN EFI_FFS_FILE_HEADER *DxeIpl,
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader
- );
-
-EFI_STATUS
-EFIAPI
-DxeLoadCore (
- IN EFI_DXE_IPL_PPI *This,
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_HOB_POINTERS HobList
- );
-
-VOID
-HandOffToDxeCore (
- IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
- IN EFI_PEI_HOB_POINTERS HobList,
- IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal
- );
-
-EFI_STATUS
-PeiProcessFile (
- IN UINT16 SectionType,
- IN EFI_FFS_FILE_HEADER *FfsFileHeader,
- OUT VOID **Pe32Data,
- IN EFI_PEI_HOB_POINTERS *OrigHob
- );
-
-EFI_STATUS
-EFIAPI
-PeimInitializeDxeIpl (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- );
-
-
-#endif
diff --git a/EdkModulePkg/Core/DxeIplPeim/DxeIpl.msa b/EdkModulePkg/Core/DxeIplPeim/DxeIpl.msa
deleted file mode 100644
index c552966..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/DxeIpl.msa
+++ /dev/null
@@ -1,168 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeIpl</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>86D70125-BAA3-4296-A62F-602BEBBB9081</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for DxeIpl module</Abstract>
- <Description>The responsibility of this module is to load the DXE Core from a Firmware Volume. This implementation i used to load a 32-bit DXE Core.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeIpl</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeimEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeiServicesLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>CacheMaintenanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkPeCoffLoaderLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>TianoDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>CustomDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeiServicesTablePointerLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeCoffLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeLoad.c</Filename>
- <Filename>DxeIpl.h</Filename>
- <Filename>DxeIpl.dxs</Filename>
- <Filename SupArchList="IA32 X64 EBC">Ia32/ImageRead.c</Filename>
- <Filename SupArchList="IA32">Ia32/DxeLoadFunc.c</Filename>
- <Filename SupArchList="IA32">Ia32/VirtualMemory.c</Filename>
- <Filename SupArchList="IA32">Ia32/VirtualMemory.h</Filename>
- <Filename SupArchList="X64 EBC">X64/DxeLoadFunc.c</Filename>
- <Filename SupArchList="IPF">Ipf/ImageRead.c</Filename>
- <Filename SupArchList="IPF">Ipf/DxeLoadFunc.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="SOMETIMES_PRODUCED">
- <ProtocolCName>gEfiDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_PRODUCED">
- <ProtocolCName>gEfiTianoDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_PRODUCED">
- <ProtocolCName>gEfiCustomizedDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <PPIs>
- <Ppi Usage="SOMETIMES_PRODUCED">
- <PpiCName>gEfiDxeIplPpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="SOMETIMES_PRODUCED">
- <PpiCName>gEfiPeiFvFileLoaderPpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="SOMETIMES_PRODUCED">
- <PpiCName>gEfiEndOfPeiSignalPpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="SOMETIMES_CONSUMED">
- <PpiCName>gEfiPeiRecoveryModulePpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="SOMETIMES_CONSUMED">
- <PpiCName>gEfiPeiS3ResumePpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="SOMETIMES_CONSUMED">
- <PpiCName>gEfiPeiSectionExtractionPpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="SOMETIMES_CONSUMED">
- <PpiCName>gEfiPeiSecurityPpiGuid</PpiCName>
- </Ppi>
- </PPIs>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiPeiPeCoffLoaderGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>PeimInitializeDxeIpl</ModuleEntryPoint>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED" SupArchList="IA32">
- <C_Name>PcdDxeIplSwitchToLongMode</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>If this feature is enabled, then the DXE IPL will load a 64-bit DxeCore.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>If this feature is enabled, DXE IPL will build a series of HOBs to share code with DXE Core.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdDxeIplSupportEfiDecompress</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>If this feature is enabled, then the DXE IPL must support decompressing files compressed with the EFI Compression algorithm</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdDxeIplSupportTianoDecompress</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>If this feature is enabled, then the DXE IPL must support decompressing files compressed with the Tiano Compression algorithm</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdDxeIplSupportCustomDecompress</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>If this feature is enabled, then the DXE IPL must support decompressing files compressed with the Custom Compression algorithm</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Core/DxeIplPeim/DxeLoad.c b/EdkModulePkg/Core/DxeIplPeim/DxeLoad.c
deleted file mode 100644
index 1133f62..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/DxeLoad.c
+++ /dev/null
@@ -1,995 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeLoad.c
-
-Abstract:
-
- Last PEIM.
- Responsibility of this module is to load the DXE Core from a Firmware Volume.
-
---*/
-
-#include "DxeIpl.h"
-
-BOOLEAN gInMemory = FALSE;
-
-//
-// Module Globals used in the DXE to PEI handoff
-// These must be module globals, so the stack can be switched
-//
-static EFI_DXE_IPL_PPI mDxeIplPpi = {
- DxeLoadCore
-};
-
-static EFI_PEI_FV_FILE_LOADER_PPI mLoadFilePpi = {
- DxeIplLoadFile
-};
-
-static EFI_PEI_PPI_DESCRIPTOR mPpiList[] = {
- {
- EFI_PEI_PPI_DESCRIPTOR_PPI,
- &gEfiPeiFvFileLoaderPpiGuid,
- &mLoadFilePpi
- },
- {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiDxeIplPpiGuid,
- &mDxeIplPpi
- }
-};
-
-static EFI_PEI_PPI_DESCRIPTOR mPpiSignal = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiEndOfPeiSignalPpiGuid,
- NULL
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED DECOMPRESS_LIBRARY gEfiDecompress = {
- UefiDecompressGetInfo,
- UefiDecompress
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED DECOMPRESS_LIBRARY gTianoDecompress = {
- TianoDecompressGetInfo,
- TianoDecompress
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED DECOMPRESS_LIBRARY gCustomDecompress = {
- CustomDecompressGetInfo,
- CustomDecompress
-};
-
-EFI_STATUS
-EFIAPI
-PeimInitializeDxeIpl (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- Initializes the Dxe Ipl PPI
-
-Arguments:
-
- FfsHeader - Pointer to FFS file header
- PeiServices - General purpose services available to every PEIM.
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- EFI_STATUS Status;
- EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader;
- EFI_BOOT_MODE BootMode;
-
- Status = PeiServicesGetBootMode (&BootMode);
- ASSERT_EFI_ERROR (Status);
-
- if (!gInMemory && (BootMode != BOOT_ON_S3_RESUME)) {
- //
- // The DxeIpl has not yet been shadowed
- //
- PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();
-
- //
- // Shadow DxeIpl and then re-run its entry point
- //
- Status = ShadowDxeIpl (FfsHeader, PeiEfiPeiPeCoffLoader);
- } else {
- //
- // Install FvFileLoader and DxeIpl PPIs.
- //
- Status = PeiServicesInstallPpi (mPpiList);
- ASSERT_EFI_ERROR(Status);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-DxeLoadCore (
- IN EFI_DXE_IPL_PPI *This,
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_HOB_POINTERS HobList
- )
-/*++
-
-Routine Description:
-
- Main entry point to last PEIM
-
-Arguments:
- This - Entry point for DXE IPL PPI
- PeiServices - General purpose services available to every PEIM.
- HobList - Address to the Pei HOB list
-
-Returns:
-
- EFI_SUCCESS - DEX core was successfully loaded.
- EFI_OUT_OF_RESOURCES - There are not enough resources to load DXE core.
-
---*/
-{
- EFI_STATUS Status;
- EFI_GUID DxeCoreFileName;
- EFI_GUID FirmwareFileName;
- VOID *Pe32Data;
- VOID *FvImageData;
- EFI_PHYSICAL_ADDRESS DxeCoreAddress;
- UINT64 DxeCoreSize;
- EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint;
- EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader;
- EFI_BOOT_MODE BootMode;
- EFI_PEI_RECOVERY_MODULE_PPI *PeiRecovery;
- EFI_PEI_S3_RESUME_PPI *S3Resume;
-
-// PERF_START (PeiServices, L"DxeIpl", NULL, 0);
-
- //
- // if in S3 Resume, restore configure
- //
- Status = PeiServicesGetBootMode (&BootMode);
- ASSERT_EFI_ERROR(Status);
-
- if (BootMode == BOOT_ON_S3_RESUME) {
- Status = PeiServicesLocatePpi (
- &gEfiPeiS3ResumePpiGuid,
- 0,
- NULL,
- (VOID **)&S3Resume
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = S3Resume->S3RestoreConfig (PeiServices);
- ASSERT_EFI_ERROR (Status);
- } else if (BootMode == BOOT_IN_RECOVERY_MODE) {
-
- Status = PeiServicesLocatePpi (
- &gEfiPeiRecoveryModulePpiGuid,
- 0,
- NULL,
- (VOID **)&PeiRecovery
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = PeiRecovery->LoadRecoveryCapsule (PeiServices, PeiRecovery);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Load Recovery Capsule Failed.(Status = %r)\n", Status));
- CpuDeadLoop ();
- }
-
- //
- // Now should have a HOB with the DXE core w/ the old HOB destroyed
- //
- }
-
- //
- // Install the PEI Protocols that are shared between PEI and DXE
- //
- PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();
- ASSERT (PeiEfiPeiPeCoffLoader != NULL);
-
-
- //
- // Find the EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE type compressed Firmware Volume file
- // The file found will be processed by PeiProcessFile: It will first be decompressed to
- // a normal FV, then a corresponding FV type hob will be built.
- //
- Status = PeiFindFile (
- EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE,
- EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
- &FirmwareFileName,
- &FvImageData
- );
-
- //
- // Find the DXE Core in a Firmware Volume
- //
- Status = PeiFindFile (
- EFI_FV_FILETYPE_DXE_CORE,
- EFI_SECTION_PE32,
- &DxeCoreFileName,
- &Pe32Data
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Load the DXE Core from a Firmware Volume
- //
- Status = PeiLoadFile (
- PeiEfiPeiPeCoffLoader,
- Pe32Data,
- &DxeCoreAddress,
- &DxeCoreSize,
- &DxeCoreEntryPoint
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Add HOB for the DXE Core
- //
- BuildModuleHob (
- &DxeCoreFileName,
- DxeCoreAddress,
- DxeCoreSize,
- DxeCoreEntryPoint
- );
-
- //
- // Report Status Code EFI_SW_PEI_PC_HANDOFF_TO_NEXT
- //
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT
- );
-
- if (FeaturePcdGet (PcdDxeIplBuildShareCodeHobs)) {
- if (FeaturePcdGet (PcdDxeIplSupportEfiDecompress)) {
- //
- // Add HOB for the EFI Decompress Protocol
- //
- BuildGuidDataHob (
- &gEfiDecompressProtocolGuid,
- (VOID *)&gEfiDecompress,
- sizeof (gEfiDecompress)
- );
- }
- if (FeaturePcdGet (PcdDxeIplSupportTianoDecompress)) {
- //
- // Add HOB for the Tiano Decompress Protocol
- //
- BuildGuidDataHob (
- &gEfiTianoDecompressProtocolGuid,
- (VOID *)&gTianoDecompress,
- sizeof (gTianoDecompress)
- );
- }
- if (FeaturePcdGet (PcdDxeIplSupportCustomDecompress)) {
- //
- // Add HOB for the user customized Decompress Protocol
- //
- BuildGuidDataHob (
- &gEfiCustomizedDecompressProtocolGuid,
- (VOID *)&gCustomDecompress,
- sizeof (gCustomDecompress)
- );
- }
-
- //
- // Add HOB for the PE/COFF Loader Protocol
- //
- BuildGuidDataHob (
- &gEfiPeiPeCoffLoaderGuid,
- (VOID *)&PeiEfiPeiPeCoffLoader,
- sizeof (VOID *)
- );
- }
-
- //
- // Transfer control to the DXE Core
- // The handoff state is simply a pointer to the HOB list
- //
-
- DEBUG ((EFI_D_INFO, "DXE Core Entry Point 0x%08x\n", (UINTN) DxeCoreEntryPoint));
- HandOffToDxeCore (DxeCoreEntryPoint, HobList, &mPpiSignal);
- //
- // If we get here, then the DXE Core returned. This is an error
- // Dxe Core should not return.
- //
- ASSERT (FALSE);
- CpuDeadLoop ();
-
- return EFI_OUT_OF_RESOURCES;
-}
-
-EFI_STATUS
-PeiFindFile (
- IN UINT8 Type,
- IN UINT16 SectionType,
- OUT EFI_GUID *FileName,
- OUT VOID **Pe32Data
- )
-/*++
-
-Routine Description:
-
- Finds a PE/COFF of a specific Type and SectionType in the Firmware Volumes
- described in the HOB list. Able to search in a compression set in a FFS file.
- But only one level of compression is supported, that is, not able to search
- in a compression set that is within another compression set.
-
-Arguments:
-
- Type - The Type of file to retrieve
-
- SectionType - The type of section to retrieve from a file
-
- FileName - The name of the file found in the Firmware Volume
-
- Pe32Data - Pointer to the beginning of the PE/COFF file found in the Firmware Volume
-
-Returns:
-
- EFI_SUCCESS - The file was found, and the name is returned in FileName, and a pointer to
- the PE/COFF image is returned in Pe32Data
-
- EFI_NOT_FOUND - The file was not found in the Firmware Volumes present in the HOB List
-
---*/
-{
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- EFI_FFS_FILE_HEADER *FfsFileHeader;
- EFI_STATUS Status;
- EFI_PEI_HOB_POINTERS Hob;
-
-
- FwVolHeader = NULL;
- FfsFileHeader = NULL;
- Status = EFI_SUCCESS;
-
- //
- // For each Firmware Volume, look for a specified type
- // of file and break out until no one is found
- //
- Hob.Raw = GetHobList ();
- while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_FV, Hob.Raw)) != NULL) {
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (Hob.FirmwareVolume->BaseAddress);
- //
- // Make sure the FV HOB does not get corrupted.
- //
- ASSERT (FwVolHeader->Signature == EFI_FVH_SIGNATURE);
-
- Status = PeiServicesFfsFindNextFile (
- Type,
- FwVolHeader,
- &FfsFileHeader
- );
- if (!EFI_ERROR (Status)) {
- Status = PeiProcessFile (
- SectionType,
- FfsFileHeader,
- Pe32Data,
- &Hob
- );
- CopyMem (FileName, &FfsFileHeader->Name, sizeof (EFI_GUID));
- //
- // Find all Fv type ffs to get all FvImage and add them into FvHob
- //
- if (!EFI_ERROR (Status) && (Type != EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE)) {
- return EFI_SUCCESS;
- }
- }
- Hob.Raw = GET_NEXT_HOB (Hob);
- }
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-PeiLoadFile (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader,
- IN VOID *Pe32Data,
- OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
- OUT UINT64 *ImageSize,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint
- )
-/*++
-
-Routine Description:
-
- Loads and relocates a PE/COFF image into memory.
-
-Arguments:
-
- PeiEfiPeiPeCoffLoader - Pointer to a PE COFF loader protocol
-
- Pe32Data - The base address of the PE/COFF file that is to be loaded and relocated
-
- ImageAddress - The base address of the relocated PE/COFF image
-
- ImageSize - The size of the relocated PE/COFF image
-
- EntryPoint - The entry point of the relocated PE/COFF image
-
-Returns:
-
- EFI_SUCCESS - The file was loaded and relocated
-
- EFI_OUT_OF_RESOURCES - There was not enough memory to load and relocate the PE/COFF file
-
---*/
-{
- EFI_STATUS Status;
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
-
- ZeroMem (&ImageContext, sizeof (ImageContext));
- ImageContext.Handle = Pe32Data;
- Status = GetImageReadFunction (&ImageContext);
-
- ASSERT_EFI_ERROR (Status);
-
- Status = PeiEfiPeiPeCoffLoader->GetImageInfo (PeiEfiPeiPeCoffLoader, &ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Allocate Memory for the image
- //
- ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) AllocatePages (EFI_SIZE_TO_PAGES ((UINT32) ImageContext.ImageSize));
- ASSERT (ImageContext.ImageAddress != 0);
-
- //
- // Load the image to our new buffer
- //
- Status = PeiEfiPeiPeCoffLoader->LoadImage (PeiEfiPeiPeCoffLoader, &ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Relocate the image in our new buffer
- //
- Status = PeiEfiPeiPeCoffLoader->RelocateImage (PeiEfiPeiPeCoffLoader, &ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Flush the instruction cache so the image data is written before we execute it
- //
- InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize);
-
- *ImageAddress = ImageContext.ImageAddress;
- *ImageSize = ImageContext.ImageSize;
- *EntryPoint = ImageContext.EntryPoint;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ShadowDxeIpl (
- IN EFI_FFS_FILE_HEADER *DxeIplFileHeader,
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader
- )
-/*++
-
-Routine Description:
-
- Shadow the DXE IPL to a different memory location. This occurs after permanent
- memory has been discovered.
-
-Arguments:
-
- DxeIplFileHeader - Pointer to the FFS file header of the DXE IPL driver
-
- PeiEfiPeiPeCoffLoader - Pointer to a PE COFF loader protocol
-
-Returns:
-
- EFI_SUCCESS - DXE IPL was successfully shadowed to a different memory location.
-
- EFI_ ERROR - The shadow was unsuccessful.
-
-
---*/
-{
- UINTN SectionLength;
- UINTN OccupiedSectionLength;
- EFI_PHYSICAL_ADDRESS DxeIplAddress;
- UINT64 DxeIplSize;
- EFI_PHYSICAL_ADDRESS DxeIplEntryPoint;
- EFI_STATUS Status;
- EFI_COMMON_SECTION_HEADER *Section;
-
- Section = (EFI_COMMON_SECTION_HEADER *) (DxeIplFileHeader + 1);
-
- while ((Section->Type != EFI_SECTION_PE32) && (Section->Type != EFI_SECTION_TE)) {
- SectionLength = *(UINT32 *) (Section->Size) & 0x00ffffff;
- OccupiedSectionLength = GET_OCCUPIED_SIZE (SectionLength, 4);
- Section = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + OccupiedSectionLength);
- }
- //
- // Relocate DxeIpl into memory by using loadfile service
- //
- Status = PeiLoadFile (
- PeiEfiPeiPeCoffLoader,
- (VOID *) (Section + 1),
- &DxeIplAddress,
- &DxeIplSize,
- &DxeIplEntryPoint
- );
-
- if (Status == EFI_SUCCESS) {
- //
- // Set gInMemory global variable to TRUE to indicate the dxeipl is shadowed.
- //
- *(BOOLEAN *) ((UINTN) &gInMemory + (UINTN) DxeIplEntryPoint - (UINTN) _ModuleEntryPoint) = TRUE;
- Status = ((EFI_PEIM_ENTRY_POINT) (UINTN) DxeIplEntryPoint) (DxeIplFileHeader, GetPeiServicesTablePointer());
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-DxeIplLoadFile (
- IN EFI_PEI_FV_FILE_LOADER_PPI *This,
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- OUT EFI_PHYSICAL_ADDRESS *ImageAddress,
- OUT UINT64 *ImageSize,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint
- )
-/*++
-
-Routine Description:
-
- Given a pointer to an FFS file containing a PE32 image, get the
- information on the PE32 image, and then "load" it so that it
- can be executed.
-
-Arguments:
-
- This - pointer to our file loader protocol
-
- FfsHeader - pointer to the FFS file header of the FFS file that
- contains the PE32 image we want to load
-
- ImageAddress - returned address where the PE32 image is loaded
-
- ImageSize - returned size of the loaded PE32 image
-
- EntryPoint - entry point to the loaded PE32 image
-
-Returns:
-
- EFI_SUCCESS - The FFS file was successfully loaded.
-
- EFI_ERROR - Unable to load the FFS file.
-
---*/
-{
- EFI_PEI_PE_COFF_LOADER_PROTOCOL *PeiEfiPeiPeCoffLoader;
- EFI_STATUS Status;
- VOID *Pe32Data;
-
- Pe32Data = NULL;
- PeiEfiPeiPeCoffLoader = (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)GetPeCoffLoaderProtocol ();
-
- //
- // Preprocess the FFS file to get a pointer to the PE32 information
- // in the enclosed PE32 image.
- //
- Status = PeiProcessFile (
- EFI_SECTION_PE32,
- FfsHeader,
- &Pe32Data,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Load the PE image from the FFS file
- //
- Status = PeiLoadFile (
- PeiEfiPeiPeCoffLoader,
- Pe32Data,
- ImageAddress,
- ImageSize,
- EntryPoint
- );
-
- return Status;
-}
-
-EFI_STATUS
-PeiProcessFile (
- IN UINT16 SectionType,
- IN EFI_FFS_FILE_HEADER *FfsFileHeader,
- OUT VOID **Pe32Data,
- IN EFI_PEI_HOB_POINTERS *OrigHob
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
- SectionType - The type of section in the FFS file to process.
-
- FfsFileHeader - Pointer to the FFS file to process, looking for the
- specified SectionType
-
- Pe32Data - returned pointer to the start of the PE32 image found
- in the FFS file.
-
-Returns:
-
- EFI_SUCCESS - found the PE32 section in the FFS file
-
---*/
-{
- EFI_STATUS Status;
- VOID *SectionData;
- DECOMPRESS_LIBRARY *DecompressLibrary;
- UINT8 *DstBuffer;
- UINT8 *ScratchBuffer;
- UINT32 DstBufferSize;
- UINT32 ScratchBufferSize;
- EFI_COMMON_SECTION_HEADER *CmpSection;
- UINTN CmpSectionLength;
- UINTN OccupiedCmpSectionLength;
- VOID *CmpFileData;
- UINTN CmpFileSize;
- EFI_COMMON_SECTION_HEADER *Section;
- UINTN SectionLength;
- UINTN OccupiedSectionLength;
- UINT64 FileSize;
- UINT32 AuthenticationStatus;
- EFI_PEI_SECTION_EXTRACTION_PPI *SectionExtract;
- UINT32 BufferSize;
- UINT8 *Buffer;
- EFI_PEI_SECURITY_PPI *Security;
- BOOLEAN StartCrisisRecovery;
- EFI_GUID TempGuid;
- EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
- EFI_COMPRESSION_SECTION *CompressionSection;
-
- //
- // Initialize local variables.
- //
- DecompressLibrary = NULL;
- DstBuffer = NULL;
- DstBufferSize = 0;
-
- Status = PeiServicesFfsFindSectionData (
- EFI_SECTION_COMPRESSION,
- FfsFileHeader,
- &SectionData
- );
-
- //
- // First process the compression section
- //
- if (!EFI_ERROR (Status)) {
- //
- // Yes, there is a compression section, so extract the contents
- // Decompress the image here
- //
- Section = (EFI_COMMON_SECTION_HEADER *) (UINTN) (VOID *) ((UINT8 *) (FfsFileHeader) + (UINTN) sizeof (EFI_FFS_FILE_HEADER));
-
- do {
- SectionLength = *(UINT32 *) (Section->Size) & 0x00ffffff;
- OccupiedSectionLength = GET_OCCUPIED_SIZE (SectionLength, 4);
-
- //
- // Was the DXE Core file encapsulated in a GUID'd section?
- //
- if (Section->Type == EFI_SECTION_GUID_DEFINED) {
-
- //
- // This following code constitutes the addition of the security model
- // to the DXE IPL.
- //
- //
- // Set a default authenticatino state
- //
- AuthenticationStatus = 0;
-
- Status = PeiServicesLocatePpi (
- &gEfiPeiSectionExtractionPpiGuid,
- 0,
- NULL,
- (VOID **)&SectionExtract
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Verify Authentication State
- //
- CopyMem (&TempGuid, Section + 1, sizeof (EFI_GUID));
-
- Status = SectionExtract->PeiGetSection (
- GetPeiServicesTablePointer(),
- SectionExtract,
- (EFI_SECTION_TYPE *) &SectionType,
- &TempGuid,
- 0,
- (VOID **) &Buffer,
- &BufferSize,
- &AuthenticationStatus
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // If not ask the Security PPI, if exists, for disposition
- //
- //
- Status = PeiServicesLocatePpi (
- &gEfiPeiSecurityPpiGuid,
- 0,
- NULL,
- (VOID **)&Security
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = Security->AuthenticationState (
- GetPeiServicesTablePointer(),
- (struct _EFI_PEI_SECURITY_PPI *) Security,
- AuthenticationStatus,
- FfsFileHeader,
- &StartCrisisRecovery
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // If there is a security violation, report to caller and have
- // the upper-level logic possible engender a crisis recovery
- //
- if (StartCrisisRecovery) {
- return EFI_SECURITY_VIOLATION;
- }
- }
-
- if (Section->Type == EFI_SECTION_PE32) {
- //
- // This is what we want
- //
- *Pe32Data = (VOID *) (Section + 1);
- return EFI_SUCCESS;
- } else if (Section->Type == EFI_SECTION_COMPRESSION) {
- //
- // This is a compression set, expand it
- //
- CompressionSection = (EFI_COMPRESSION_SECTION *) Section;
-
- switch (CompressionSection->CompressionType) {
- case EFI_STANDARD_COMPRESSION:
- //
- // Load EFI standard compression.
- //
- if (FeaturePcdGet (PcdDxeIplSupportTianoDecompress)) {
- DecompressLibrary = &gEfiDecompress;
- } else {
- ASSERT (FALSE);
- return EFI_NOT_FOUND;
- }
- break;
-
- case EFI_CUSTOMIZED_COMPRESSION:
- //
- // Load user customized compression.
- //
- if (FeaturePcdGet (PcdDxeIplSupportCustomDecompress)) {
- DecompressLibrary = &gCustomDecompress;
- } else {
- ASSERT (FALSE);
- return EFI_NOT_FOUND;
- }
- break;
-
- case EFI_NOT_COMPRESSED:
- //
- // Allocate destination buffer
- //
- DstBufferSize = CompressionSection->UncompressedLength;
- DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));
- if (DstBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // stream is not actually compressed, just encapsulated. So just copy it.
- //
- CopyMem (DstBuffer, CompressionSection + 1, DstBufferSize);
- break;
-
- default:
- //
- // Don't support other unknown compression type.
- //
- ASSERT_EFI_ERROR (Status);
- return EFI_NOT_FOUND;
- }
-
- if (CompressionSection->CompressionType != EFI_NOT_COMPRESSED) {
- //
- // For compressed data, decompress them to dstbuffer.
- //
- Status = DecompressLibrary->GetInfo (
- (UINT8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),
- (UINT32) SectionLength - sizeof (EFI_COMPRESSION_SECTION),
- &DstBufferSize,
- &ScratchBufferSize
- );
- if (EFI_ERROR (Status)) {
- //
- // GetInfo failed
- //
- DEBUG ((EFI_D_ERROR, "Decompress GetInfo Failed - %r\n", Status));
- return EFI_NOT_FOUND;
- }
-
- //
- // Allocate scratch buffer
- //
- ScratchBuffer = AllocatePages (EFI_SIZE_TO_PAGES (ScratchBufferSize));
- if (ScratchBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Allocate destination buffer
- //
- DstBuffer = AllocatePages (EFI_SIZE_TO_PAGES (DstBufferSize));
- if (DstBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Call decompress function
- //
- Status = DecompressLibrary->Decompress (
- (CHAR8 *) ((EFI_COMPRESSION_SECTION *) Section + 1),
- DstBuffer,
- ScratchBuffer
- );
- if (EFI_ERROR (Status)) {
- //
- // Decompress failed
- //
- DEBUG ((EFI_D_ERROR, "Decompress Failed - %r\n", Status));
- return EFI_NOT_FOUND;
- }
- }
-
- //
- // Decompress successfully.
- // Loop the decompressed data searching for expected section.
- //
- CmpSection = (EFI_COMMON_SECTION_HEADER *) DstBuffer;
- CmpFileData = (VOID *) DstBuffer;
- CmpFileSize = DstBufferSize;
- do {
- CmpSectionLength = *(UINT32 *) (CmpSection->Size) & 0x00ffffff;
- if (CmpSection->Type == SectionType) {
- //
- // This is what we want
- //
- if (SectionType == EFI_SECTION_PE32) {
- *Pe32Data = (VOID *) (CmpSection + 1);
- return EFI_SUCCESS;
- } else if (SectionType == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {
- //
- // Firmware Volume Image in this Section
- // Skip the section header to get FvHeader
- //
- FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (CmpSection + 1);
-
- if (FvHeader->Signature == EFI_FVH_SIGNATURE) {
- //
- // Because FvLength in FvHeader is UINT64 type,
- // so FvHeader must meed at least 8 bytes alignment.
- // If current FvImage base address doesn't meet its alignment,
- // we need to reload this FvImage to another correct memory address.
- //
- if (((UINTN) FvHeader % sizeof (UINT64)) != 0) {
- DstBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES ((UINTN) CmpSectionLength - sizeof (EFI_COMMON_SECTION_HEADER)), sizeof (UINT64));
- if (DstBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- CopyMem (DstBuffer, FvHeader, (UINTN) CmpSectionLength - sizeof (EFI_COMMON_SECTION_HEADER));
- FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) DstBuffer;
- }
-
- //
- // Build new FvHob for new decompressed Fv image.
- //
- BuildFvHob ((EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader, FvHeader->FvLength);
-
- //
- // Set the original FvHob to unused.
- //
- if (OrigHob != NULL) {
- OrigHob->Header->HobType = EFI_HOB_TYPE_UNUSED;
- }
-
- //
- // return found FvImage data.
- //
- *Pe32Data = (VOID *) FvHeader;
- return EFI_SUCCESS;
- }
- }
- }
- OccupiedCmpSectionLength = GET_OCCUPIED_SIZE (CmpSectionLength, 4);
- CmpSection = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) CmpSection + OccupiedCmpSectionLength);
- } while (CmpSection->Type != 0 && (UINTN) ((UINT8 *) CmpSection - (UINT8 *) CmpFileData) < CmpFileSize);
- }
- //
- // End of the decompression activity
- //
-
- Section = (EFI_COMMON_SECTION_HEADER *) ((UINT8 *) Section + OccupiedSectionLength);
- FileSize = FfsFileHeader->Size[0] & 0xFF;
- FileSize += (FfsFileHeader->Size[1] << 8) & 0xFF00;
- FileSize += (FfsFileHeader->Size[2] << 16) & 0xFF0000;
- FileSize &= 0x00FFFFFF;
- } while (Section->Type != 0 && (UINTN) ((UINT8 *) Section - (UINT8 *) FfsFileHeader) < FileSize);
-
- //
- // search all sections (compression and non compression) in this FFS, don't
- // find expected section.
- //
- return EFI_NOT_FOUND;
- } else {
- //
- // For those FFS that doesn't contain compression section, directly search
- // PE or TE section in this FFS.
- //
-
- Status = PeiServicesFfsFindSectionData (
- EFI_SECTION_PE32,
- FfsFileHeader,
- &SectionData
- );
-
- if (EFI_ERROR (Status)) {
- Status = PeiServicesFfsFindSectionData (
- EFI_SECTION_TE,
- FfsFileHeader,
- &SectionData
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- }
-
- *Pe32Data = SectionData;
-
- return EFI_SUCCESS;
-}
-
diff --git a/EdkModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c b/EdkModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
deleted file mode 100644
index 7c9beff..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeLoadFunc.c
-
-Abstract:
-
- Ia32-specifc functionality for DxeLoad.
-
---*/
-
-#include "DxeIpl.h"
-#include "VirtualMemory.h"
-
-//
-// Global Descriptor Table (GDT)
-//
-GLOBAL_REMOVE_IF_UNREFERENCED IA32_GDT gGdtEntries [] = {
-/* selector { Global Segment Descriptor } */
-/* 0x00 */ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, //null descriptor
-/* 0x08 */ {{0xffff, 0, 0, 0x2, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //linear data segment descriptor
-/* 0x10 */ {{0xffff, 0, 0, 0xf, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //linear code segment descriptor
-/* 0x18 */ {{0xffff, 0, 0, 0x3, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //system data segment descriptor
-/* 0x20 */ {{0xffff, 0, 0, 0xa, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //system code segment descriptor
-/* 0x28 */ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, //spare segment descriptor
-/* 0x30 */ {{0xffff, 0, 0, 0x2, 1, 0, 1, 0xf, 0, 0, 1, 1, 0}}, //system data segment descriptor
-/* 0x38 */ {{0xffff, 0, 0, 0xa, 1, 0, 1, 0xf, 0, 1, 0, 1, 0}}, //system code segment descriptor
-/* 0x40 */ {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, //spare segment descriptor
-};
-
-//
-// IA32 Gdt register
-//
-GLOBAL_REMOVE_IF_UNREFERENCED CONST IA32_DESCRIPTOR gGdt = {
- sizeof (gGdtEntries) - 1,
- (UINTN) gGdtEntries
- };
-
-VOID
-HandOffToDxeCore (
- IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
- IN EFI_PEI_HOB_POINTERS HobList,
- IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal
- )
-{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS BaseOfStack;
- EFI_PHYSICAL_ADDRESS TopOfStack;
- UINTN PageTables;
-
- Status = PeiServicesAllocatePages (EfiBootServicesData, EFI_SIZE_TO_PAGES (STACK_SIZE), &BaseOfStack);
- ASSERT_EFI_ERROR (Status);
-
- if (FeaturePcdGet(PcdDxeIplSwitchToLongMode)) {
- //
- // Compute the top of the stack we were allocated, which is used to load X64 dxe core.
- // Pre-allocate a 32 bytes which confroms to x64 calling convention.
- //
- // The first four parameters to a function are passed in rcx, rdx, r8 and r9.
- // Any further parameters are pushed on the stack. Furthermore, space (4 * 8bytes) for the
- // register parameters is reserved on the stack, in case the called function
- // wants to spill them; this is important if the function is variadic.
- //
- TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - 32;
-
- //
- // X64 Calling Conventions requires that the stack must be aligned to 16 bytes
- //
- TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, 16);
-
- //
- // Load the GDT of Go64. Since the GDT of 32-bit Tiano locates in the BS_DATA
- // memory, it may be corrupted when copying FV to high-end memory
- //
- AsmWriteGdtr (&gGdt);
- //
- // Create page table and save PageMapLevel4 to CR3
- //
- PageTables = CreateIdentityMappingPageTables ();
-
- //
- // End of PEI phase singal
- //
- Status = PeiServicesInstallPpi (EndOfPeiSignal);
- ASSERT_EFI_ERROR (Status);
-
- AsmWriteCr3 (PageTables);
- //
- // Go to Long Mode. Interrupts will not get turned on until the CPU AP is loaded.
- // Call x64 drivers passing in single argument, a pointer to the HOBs.
- //
- AsmEnablePaging64 (
- SYS_CODE64_SEL,
- DxeCoreEntryPoint,
- (EFI_PHYSICAL_ADDRESS)(UINTN)(HobList.Raw),
- 0,
- TopOfStack
- );
- } else {
- //
- // Compute the top of the stack we were allocated. Pre-allocate a UINTN
- // for safety.
- //
- TopOfStack = BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT;
- TopOfStack = (EFI_PHYSICAL_ADDRESS) (UINTN) ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
-
- //
- // End of PEI phase singal
- //
- Status = PeiServicesInstallPpi (EndOfPeiSignal);
- ASSERT_EFI_ERROR (Status);
-
- SwitchStack (
- (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
- HobList.Raw,
- NULL,
- (VOID *) (UINTN) TopOfStack
- );
- }
-}
-
diff --git a/EdkModulePkg/Core/DxeIplPeim/Ia32/ImageRead.c b/EdkModulePkg/Core/DxeIplPeim/Ia32/ImageRead.c
deleted file mode 100644
index b4bd640..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/Ia32/ImageRead.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ImageRead.c
-
-Abstract:
-
---*/
-
-#include "DxeIpl.h"
-
-EFI_STATUS
-EFIAPI
-PeiImageRead (
- IN VOID *FileHandle,
- IN UINTN FileOffset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
-
-Arguments:
-
- FileHandle - The handle to the PE/COFF file
-
- FileOffset - The offset, in bytes, into the file to read
-
- ReadSize - The number of bytes to read from the file starting at FileOffset
-
- Buffer - A pointer to the buffer to read the data into.
-
-Returns:
-
- EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
-
---*/
-{
- UINT8 *Destination32;
- UINT8 *Source32;
- UINTN Length;
-
-
- Destination32 = Buffer;
- Source32 = (UINT8 *) ((UINTN) FileHandle + FileOffset);
-
- //
- // This function assumes 32-bit alignment to increase performance
- //
-// ASSERT (ALIGN_POINTER (Destination32, sizeof (UINT32)) == Destination32);
-// ASSERT (ALIGN_POINTER (Source32, sizeof (UINT32)) == Source32);
-
- Length = *ReadSize;
- while (Length--) {
- *(Destination32++) = *(Source32++);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetImageReadFunction (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-/*++
-
-Routine Description:
- Support routine to return the PE32 Image Reader.
- If the PeiImageRead() function is less than a page
- in legnth. If the function is more than a page the DXE IPL will crash!!!!
-
-Arguments:
- ImageContext - The context of the image being loaded
-
-Returns:
- EFI_SUCCESS - If Image function location is found
-
---*/
-{
- VOID *MemoryBuffer;
-
- if (gInMemory) {
- ImageContext->ImageRead = PeiImageRead;
- return EFI_SUCCESS;
- }
-
- //
- // BugBug; This code assumes PeiImageRead() is less than a page in size!
- // Allocate a page so we can shaddow the read function from FLASH into
- // memory to increase performance.
- //
-
- MemoryBuffer = AllocateCopyPool (0x400, (VOID *)(UINTN) PeiImageRead);
- ASSERT (MemoryBuffer != NULL);
-
- ImageContext->ImageRead = (PE_COFF_LOADER_READ_FILE) (UINTN) MemoryBuffer;
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/DxeIplPeim/Ia32/VirtualMemory.c b/EdkModulePkg/Core/DxeIplPeim/Ia32/VirtualMemory.c
deleted file mode 100644
index 89b18c3..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/Ia32/VirtualMemory.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- VirtualMemory.c
-
-Abstract:
-
- x64 Virtual Memory Management Services in the form of an IA-32 driver.
- Used to establish a 1:1 Virtual to Physical Mapping that is required to
- enter Long Mode (x64 64-bit mode).
-
- While we make a 1:1 mapping (identity mapping) for all physical pages
- we still need to use the MTRR's to ensure that the cachability attirbutes
- for all memory regions is correct.
-
- The basic idea is to use 2MB page table entries where ever possible. If
- more granularity of cachability is required then 4K page tables are used.
-
- References:
- 1) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 1:Basic Architecture, Intel
- 2) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 2:Instruction Set Reference, Intel
- 3) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 3:System Programmer's Guide, Intel
-
---*/
-
-#include "VirtualMemory.h"
-
-UINTN
-CreateIdentityMappingPageTables (
- VOID
- )
-/*++
-
-Routine Description:
-
- Allocates and fills in the Page Directory and Page Table Entries to
- establish a 1:1 Virtual to Physical mapping.
-
-Arguments:
-
- NumberOfProcessorPhysicalAddressBits - Number of processor address bits to use.
- Limits the number of page table entries
- to the physical address space.
-
-Returns:
-
- EFI_SUCCESS The 1:1 Virtual to Physical identity mapping was created
-
---*/
-{
- UINT8 PhysicalAddressBits;
- EFI_PHYSICAL_ADDRESS PageAddress;
- UINTN IndexOfPml4Entries;
- UINTN IndexOfPdpEntries;
- UINTN IndexOfPageDirectoryEntries;
- UINTN NumberOfPml4EntriesNeeded;
- UINTN NumberOfPdpEntriesNeeded;
- PAGE_MAP_AND_DIRECTORY_POINTER *PageMapLevel4Entry;
- PAGE_MAP_AND_DIRECTORY_POINTER *PageMap;
- PAGE_MAP_AND_DIRECTORY_POINTER *PageDirectoryPointerEntry;
- PAGE_TABLE_ENTRY *PageDirectoryEntry;
- UINTN TotalPagesNum;
- UINTN BigPageAddress;
- VOID *Hob;
-
- //
- // Get physical address bits supported from CPU HOB.
- //
- PhysicalAddressBits = 36;
-
- Hob = GetFirstHob (EFI_HOB_TYPE_CPU);
- if (Hob != NULL) {
- PhysicalAddressBits = ((EFI_HOB_CPU *) Hob)->SizeOfMemorySpace;
- }
-
- //
- // Calculate the table entries needed.
- //
- if (PhysicalAddressBits <= 39 ) {
- NumberOfPml4EntriesNeeded = 1;
- NumberOfPdpEntriesNeeded = 1 << (PhysicalAddressBits - 30);
- } else {
- NumberOfPml4EntriesNeeded = 1 << (PhysicalAddressBits - 39);
- NumberOfPdpEntriesNeeded = 512;
- }
-
- //
- // Pre-allocate big pages to avoid later allocations.
- //
- TotalPagesNum = (NumberOfPdpEntriesNeeded + 1) * NumberOfPml4EntriesNeeded + 1;
- BigPageAddress = (UINTN) AllocatePages (TotalPagesNum);
- ASSERT (BigPageAddress != 0);
-
- //
- // By architecture only one PageMapLevel4 exists - so lets allocate storage for it.
- //
- PageMap = (VOID *) BigPageAddress;
- BigPageAddress += EFI_PAGE_SIZE;
-
- PageMapLevel4Entry = PageMap;
- PageAddress = 0;
- for (IndexOfPml4Entries = 0; IndexOfPml4Entries < NumberOfPml4EntriesNeeded; IndexOfPml4Entries++, PageMapLevel4Entry++) {
- //
- // Each PML4 entry points to a page of Page Directory Pointer entires.
- // So lets allocate space for them and fill them in in the IndexOfPdpEntries loop.
- //
- PageDirectoryPointerEntry = (VOID *) BigPageAddress;
- BigPageAddress += EFI_PAGE_SIZE;
-
- //
- // Make a PML4 Entry
- //
- PageMapLevel4Entry->Uint64 = (UINT64)(UINTN)PageDirectoryPointerEntry;
- PageMapLevel4Entry->Bits.ReadWrite = 1;
- PageMapLevel4Entry->Bits.Present = 1;
-
- for (IndexOfPdpEntries = 0; IndexOfPdpEntries < NumberOfPdpEntriesNeeded; IndexOfPdpEntries++, PageDirectoryPointerEntry++) {
- //
- // Each Directory Pointer entries points to a page of Page Directory entires.
- // So allocate space for them and fill them in in the IndexOfPageDirectoryEntries loop.
- //
- PageDirectoryEntry = (VOID *) BigPageAddress;
- BigPageAddress += EFI_PAGE_SIZE;
-
- //
- // Fill in a Page Directory Pointer Entries
- //
- PageDirectoryPointerEntry->Uint64 = (UINT64)(UINTN)PageDirectoryEntry;
- PageDirectoryPointerEntry->Bits.ReadWrite = 1;
- PageDirectoryPointerEntry->Bits.Present = 1;
-
- for (IndexOfPageDirectoryEntries = 0; IndexOfPageDirectoryEntries < 512; IndexOfPageDirectoryEntries++, PageDirectoryEntry++, PageAddress += 0x200000) {
- //
- // Fill in the Page Directory entries
- //
- PageDirectoryEntry->Uint64 = (UINT64)PageAddress;
- PageDirectoryEntry->Bits.ReadWrite = 1;
- PageDirectoryEntry->Bits.Present = 1;
- PageDirectoryEntry->Bits.MustBe1 = 1;
-
- }
- }
- }
-
- //
- // For the PML4 entries we are not using fill in a null entry.
- // For now we just copy the first entry.
- //
- for (; IndexOfPml4Entries < 512; IndexOfPml4Entries++, PageMapLevel4Entry++) {
- CopyMem (
- PageMapLevel4Entry,
- PageMap,
- sizeof (PAGE_MAP_AND_DIRECTORY_POINTER)
- );
- }
-
- return (UINTN)PageMap; // FIXME
-}
-
diff --git a/EdkModulePkg/Core/DxeIplPeim/Ia32/VirtualMemory.h b/EdkModulePkg/Core/DxeIplPeim/Ia32/VirtualMemory.h
deleted file mode 100644
index 89a7f2e..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/Ia32/VirtualMemory.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- VirtualMemory.h
-
-Abstract:
-
- x64 Long Mode Virtual Memory Management Definitions
-
- References:
- 1) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 1:Basic Architecture, Intel
- 2) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 2:Instruction Set Reference, Intel
- 3) IA-32 Intel(R) Atchitecture Software Developer's Manual Volume 3:System Programmer's Guide, Intel
- 4) AMD64 Architecture Programmer's Manual Volume 2: System Programming
---*/
-#ifndef _VIRTUAL_MEMORY_H_
-#define _VIRTUAL_MEMORY_H_
-
-
-#define SYS_CODE64_SEL 0x38
-
-#pragma pack(1)
-
-typedef union {
- struct {
- UINT32 LimitLow : 16;
- UINT32 BaseLow : 16;
- UINT32 BaseMid : 8;
- UINT32 Type : 4;
- UINT32 System : 1;
- UINT32 Dpl : 2;
- UINT32 Present : 1;
- UINT32 LimitHigh : 4;
- UINT32 Software : 1;
- UINT32 Reserved : 1;
- UINT32 DefaultSize : 1;
- UINT32 Granularity : 1;
- UINT32 BaseHigh : 8;
- } Bits;
- UINT64 Uint64;
-} IA32_GDT;
-
-//
-// Page-Map Level-4 Offset (PML4) and
-// Page-Directory-Pointer Offset (PDPE) entries 4K & 2MB
-//
-
-typedef union {
- struct {
- UINT64 Present:1; // 0 = Not present in memory, 1 = Present in memory
- UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
- UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
- UINT64 WriteThrough:1; // 0 = Write-Back caching, 1=Write-Through caching
- UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
- UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
- UINT64 Reserved:1; // Reserved
- UINT64 MustBeZero:2; // Must Be Zero
- UINT64 Available:3; // Available for use by system software
- UINT64 PageTableBaseAddress:40; // Page Table Base Address
- UINT64 AvabilableHigh:11; // Available for use by system software
- UINT64 Nx:1; // No Execute bit
- } Bits;
- UINT64 Uint64;
-} PAGE_MAP_AND_DIRECTORY_POINTER;
-
-//
-// Page Table Entry 2MB
-//
-typedef union {
- struct {
- UINT64 Present:1; // 0 = Not present in memory, 1 = Present in memory
- UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
- UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
- UINT64 WriteThrough:1; // 0 = Write-Back caching, 1=Write-Through caching
- UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
- UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
- UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page
- UINT64 MustBe1:1; // Must be 1
- UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
- UINT64 Available:3; // Available for use by system software
- UINT64 PAT:1; //
- UINT64 MustBeZero:8; // Must be zero;
- UINT64 PageTableBaseAddress:31; // Page Table Base Address
- UINT64 AvabilableHigh:11; // Available for use by system software
- UINT64 Nx:1; // 0 = Execute Code, 1 = No Code Execution
- } Bits;
- UINT64 Uint64;
-} PAGE_TABLE_ENTRY;
-
-#pragma pack()
-
-UINTN
-CreateIdentityMappingPageTables (
- VOID
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c b/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c
deleted file mode 100644
index 34141ab..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/Ipf/DxeLoadFunc.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- IpfDxeLoad.c
-
-Abstract:
-
- Ipf-specifc functionality for DxeLoad.
-
---*/
-
-#include "DxeIpl.h"
-
-VOID
-HandOffToDxeCore (
- IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
- IN EFI_PEI_HOB_POINTERS HobList,
- IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal
- )
-{
- VOID *BaseOfStack;
- VOID *TopOfStack;
- VOID *BspStore;
- EFI_STATUS Status;
-
- //
- // Allocate 128KB for the Stack
- //
- BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));
- ASSERT (BaseOfStack != NULL);
-
- //
- // Allocate 16KB for the BspStore
- //
- BspStore = AllocatePages (EFI_SIZE_TO_PAGES (BSP_STORE_SIZE));
- ASSERT (BspStore != NULL);
- //
- // Build BspStoreHob
- //
- BuildBspStoreHob ((EFI_PHYSICAL_ADDRESS) (UINTN) BspStore, BSP_STORE_SIZE, EfiBootServicesData);
-
- //
- // Compute the top of the stack we were allocated. Pre-allocate a UINTN
- // for safety.
- //
- TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);
- TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
-
- //
- // End of PEI phase singal
- //
- Status = PeiServicesInstallPpi (EndOfPeiSignal);
- ASSERT_EFI_ERROR (Status);
-
- SwitchStack (
- (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
- HobList.Raw,
- NULL,
- TopOfStack,
- BspStore
- );
-}
diff --git a/EdkModulePkg/Core/DxeIplPeim/Ipf/ImageRead.c b/EdkModulePkg/Core/DxeIplPeim/Ipf/ImageRead.c
deleted file mode 100644
index b04c9a7..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/Ipf/ImageRead.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ImageRead.c
-
-Abstract:
-
---*/
-
-#include "DxeIpl.h"
-
-EFI_STATUS
-PeiImageRead (
- IN VOID *FileHandle,
- IN UINTN FileOffset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
-
-Arguments:
-
- FileHandle - The handle to the PE/COFF file
-
- FileOffset - The offset, in bytes, into the file to read
-
- ReadSize - The number of bytes to read from the file starting at FileOffset
-
- Buffer - A pointer to the buffer to read the data into.
-
-Returns:
-
- EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
-
---*/
-{
- CHAR8 *Destination8;
- CHAR8 *Source8;
- volatile UINTN Length;
-
- Destination8 = Buffer;
- Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
- Length = *ReadSize;
- while (Length--) {
- *(Destination8++) = *(Source8++);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetImageReadFunction (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- ImageContext->ImageRead = PeiImageRead;
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c b/EdkModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c
deleted file mode 100644
index 53febd5..0000000
--- a/EdkModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeLoadFunc.c
-
-Abstract:
-
- Ia32-specifc functionality for DxeLoad.
-
---*/
-
-#include "DxeIpl.h"
-
-VOID
-HandOffToDxeCore (
- IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
- IN EFI_PEI_HOB_POINTERS HobList,
- IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal
- )
-{
- VOID *BaseOfStack;
- VOID *TopOfStack;
- EFI_STATUS Status;
-
- //
- // Allocate 128KB for the Stack
- //
- BaseOfStack = AllocatePages (EFI_SIZE_TO_PAGES (STACK_SIZE));
- ASSERT (BaseOfStack != NULL);
-
- //
- // Compute the top of the stack we were allocated. Pre-allocate a UINTN
- // for safety.
- //
- TopOfStack = (VOID *) ((UINTN) BaseOfStack + EFI_SIZE_TO_PAGES (STACK_SIZE) * EFI_PAGE_SIZE - CPU_STACK_ALIGNMENT);
- TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
-
- //
- // End of PEI phase singal
- //
- Status = PeiServicesInstallPpi (EndOfPeiSignal);
- ASSERT_EFI_ERROR (Status);
-
- SwitchStack (
- (SWITCH_STACK_ENTRY_POINT)(UINTN)DxeCoreEntryPoint,
- HobList.Raw,
- NULL,
- TopOfStack
- );
-}
diff --git a/EdkModulePkg/Core/Pei/BootMode/BootMode.c b/EdkModulePkg/Core/Pei/BootMode/BootMode.c
deleted file mode 100644
index bec0304..0000000
--- a/EdkModulePkg/Core/Pei/BootMode/BootMode.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootMode.c
-
-Abstract:
-
- EFI PEI Core Boot Mode services
-
-
-
-Revision History
-
---*/
-
-#include <PeiMain.h>
-
-EFI_STATUS
-EFIAPI
-PeiGetBootMode (
- IN EFI_PEI_SERVICES **PeiServices,
- OUT EFI_BOOT_MODE *BootMode
- )
-/*++
-
-Routine Description:
-
- This service enables PEIMs to ascertain the present value of the boot mode.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- BootMode - A pointer to contain the value of the boot mode.
-
-Returns:
-
- EFI_SUCCESS - The boot mode was returned successfully.
- EFI_INVALID_PARAMETER - BootMode is NULL.
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
-
-
- if (BootMode == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- HandOffHob = (PrivateData->HobList.HandoffInformationTable);
-
- *BootMode = HandOffHob->BootMode;
-
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-PeiSetBootMode (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_BOOT_MODE BootMode
- )
-/*++
-
-Routine Description:
-
- This service enables PEIMs to update the boot mode variable.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- BootMode - The value of the boot mode to set.
-
-Returns:
-
- EFI_SUCCESS - The value was successfully updated
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
-
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- HandOffHob = (PrivateData->HobList.HandoffInformationTable);
-
- HandOffHob->BootMode = BootMode;
-
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Pei/Dependency/dependency.c b/EdkModulePkg/Core/Pei/Dependency/dependency.c
deleted file mode 100644
index c817a3d..0000000
--- a/EdkModulePkg/Core/Pei/Dependency/dependency.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- dependency.c
-
-Abstract:
-
- PEI Dispatcher Dependency Evaluator
-
- This routine evaluates a dependency expression (DEPENDENCY_EXPRESSION) to determine
- if a driver can be scheduled for execution. The criteria for
- schedulability is that the dependency expression is satisfied.
-
---*/
-
-#include <PeiMain.h>
-#include "dependency.h"
-
-STATIC
-BOOLEAN
-IsPpiInstalled (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EVAL_STACK_ENTRY *Stack
- )
-/*++
-
-Routine Description:
-
- This routine determines if a PPI has been installed.
- The truth value of a GUID is determined by if the PPI has
- been published and can be queried from the PPI database.
-
-Arguments:
- PeiServices - The PEI core services table.
- Stack - Reference to EVAL_STACK_ENTRY that contains PPI GUID to check
-
-Returns:
-
- True if the PPI is already installed.
- False if the PPI has yet to be installed.
-
---*/
-{
- VOID *PeiInstance;
- EFI_STATUS Status;
- EFI_GUID PpiGuid;
-
- //
- // If there is no GUID to evaluate, just return current result on stack.
- //
- if (Stack->Operator == NULL) {
- return Stack->Result;
- }
-
- //
- // Copy the Guid into a locale variable so that there are no
- // possibilities of alignment faults for cross-compilation
- // environments such as Intel?Itanium(TM).
- //
- CopyMem(&PpiGuid, Stack->Operator, sizeof(EFI_GUID));
-
- //
- // Check if the PPI is installed.
- //
- Status = PeiServicesLocatePpi(
- &PpiGuid, // GUID
- 0, // INSTANCE
- NULL, // EFI_PEI_PPI_DESCRIPTOR
- &PeiInstance // PPI
- );
-
- if (EFI_ERROR(Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-EFI_STATUS
-PeimDispatchReadiness (
- IN EFI_PEI_SERVICES **PeiServices,
- IN VOID *DependencyExpression,
- OUT BOOLEAN *Runnable
- )
-/*++
-
-Routine Description:
-
- This is the POSTFIX version of the dependency evaluator. When a
- PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
- the evaluation stack. When that entry is poped from the evaluation
- stack, the PPI is checked if it is installed. This method allows
- some time savings as not all PPIs must be checked for certain
- operation types (AND, OR).
-
-Arguments:
-
- PeiServices - Calling context.
-
- DependencyExpression - Pointer to a dependency expression. The Grammar adheres to
- the BNF described above and is stored in postfix notation.
- Runnable - is True if the driver can be scheduled and False if the driver
- cannot be scheduled. This is the value that the schedulers
- should use for deciding the state of the driver.
-
-Returns:
-
- Status = EFI_SUCCESS if it is a well-formed Grammar
- EFI_INVALID_PARAMETER if the dependency expression overflows
- the evaluation stack
- EFI_INVALID_PARAMETER if the dependency expression underflows
- the evaluation stack
- EFI_INVALID_PARAMETER if the dependency expression is not a
- well-formed Grammar.
---*/
-{
- DEPENDENCY_EXPRESSION_OPERAND *Iterator;
- EVAL_STACK_ENTRY *StackPtr;
- EVAL_STACK_ENTRY EvalStack[MAX_GRAMMAR_SIZE];
-
- Iterator = DependencyExpression;
- *Runnable = FALSE;
-
- StackPtr = &EvalStack[0];
-
- while (TRUE) {
-
- switch (*(Iterator++)) {
-
- //
- // For performance reason we put the frequently used items in front of
- // the rarely used items
- //
-
- case (EFI_DEP_PUSH):
- //
- // Check to make sure the dependency grammar doesn't overflow the
- // EvalStack on the push
- //
- if (StackPtr > &EvalStack[MAX_GRAMMAR_SIZE-1]) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Push the pointer to the PUSH opcode operator (pointer to PPI GUID)
- // We will evaluate if the PPI is insalled on the POP operation.
- //
- StackPtr->Operator = (VOID *) Iterator;
- Iterator = Iterator + sizeof (EFI_GUID);
- StackPtr++;
- break;
-
- case (EFI_DEP_AND):
- case (EFI_DEP_OR):
- //
- // Check to make sure the dependency grammar doesn't underflow the
- // EvalStack on the two POPs for the AND operation. Don't need to
- // check for the overflow on PUSHing the result since we already
- // did two POPs.
- //
- if (StackPtr < &EvalStack[2]) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Evaluate the first POPed operator only. If the operand is
- // EFI_DEP_AND and the POPed operator evaluates to FALSE, or the
- // operand is EFI_DEP_OR and the POPed operator evaluates to TRUE,
- // we don't need to check the second operator, and the result will be
- // evaluation of the POPed operator. Otherwise, don't POP the second
- // operator since it will now evaluate to the final result on the
- // next operand that causes a POP.
- //
- StackPtr--;
- //
- // Iterator has increased by 1 after we retrieve the operand, so here we
- // should get the value pointed by (Iterator - 1), in order to obtain the
- // same operand.
- //
- if (*(Iterator - 1) == EFI_DEP_AND) {
- if (!(IsPpiInstalled (PeiServices, StackPtr))) {
- (StackPtr-1)->Result = FALSE;
- (StackPtr-1)->Operator = NULL;
- }
- } else {
- if (IsPpiInstalled (PeiServices, StackPtr)) {
- (StackPtr-1)->Result = TRUE;
- (StackPtr-1)->Operator = NULL;
- }
- }
- break;
-
- case (EFI_DEP_END):
- StackPtr--;
- //
- // Check to make sure EvalStack is balanced. If not, then there is
- // an error in the dependency grammar, so return EFI_INVALID_PARAMETER.
- //
- if (StackPtr != &EvalStack[0]) {
- return EFI_INVALID_PARAMETER;
- }
- *Runnable = IsPpiInstalled (PeiServices, StackPtr);
- return EFI_SUCCESS;
- break;
-
- case (EFI_DEP_NOT):
- //
- // Check to make sure the dependency grammar doesn't underflow the
- // EvalStack on the POP for the NOT operation. Don't need to
- // check for the overflow on PUSHing the result since we already
- // did a POP.
- //
- if (StackPtr < &EvalStack[1]) {
- return EFI_INVALID_PARAMETER;
- }
- (StackPtr-1)->Result = (BOOLEAN) !IsPpiInstalled (PeiServices, (StackPtr-1));
- (StackPtr-1)->Operator = NULL;
- break;
-
- case (EFI_DEP_TRUE):
- case (EFI_DEP_FALSE):
- //
- // Check to make sure the dependency grammar doesn't overflow the
- // EvalStack on the push
- //
- if (StackPtr > &EvalStack[MAX_GRAMMAR_SIZE-1]) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Iterator has increased by 1 after we retrieve the operand, so here we
- // should get the value pointed by (Iterator - 1), in order to obtain the
- // same operand.
- //
- if (*(Iterator - 1) == EFI_DEP_TRUE) {
- StackPtr->Result = TRUE;
- } else {
- StackPtr->Result = FALSE;
- }
- StackPtr->Operator = NULL;
- StackPtr++;
- break;
-
- default:
- //
- // The grammar should never arrive here
- //
- return EFI_INVALID_PARAMETER;
- break;
- }
- }
-}
diff --git a/EdkModulePkg/Core/Pei/Dependency/dependency.h b/EdkModulePkg/Core/Pei/Dependency/dependency.h
deleted file mode 100644
index a1a54ed..0000000
--- a/EdkModulePkg/Core/Pei/Dependency/dependency.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- dependency.h
-
-Abstract:
-
- This module contains data specific to dependency expressions
- and local function prototypes.
-
---*/
-
-#ifndef _PEI_DEPENDENCY_H_
-#define _PEI_DEPENDENCY_H_
-
-#define MAX_GRAMMAR_SIZE 256
-
-//
-// type definitions
-//
-typedef UINT8 DEPENDENCY_EXPRESSION_OPERAND;
-
-typedef struct {
- BOOLEAN Result;
- VOID *Operator;
-} EVAL_STACK_ENTRY;
-
-#endif
diff --git a/EdkModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/EdkModulePkg/Core/Pei/Dispatcher/Dispatcher.c
deleted file mode 100644
index 4cf4452..0000000
--- a/EdkModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ /dev/null
@@ -1,534 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Dispatcher.c
-
-Abstract:
-
- EFI PEI Core dispatch services
-
-Revision History
-
---*/
-
-#include <PeiMain.h>
-
-STATIC
-VOID *
-TransferOldDataToNewDataRange (
- IN PEI_CORE_INSTANCE *PrivateData
- );
-
-EFI_STATUS
-PeiDispatcher (
- IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
- IN PEI_CORE_INSTANCE *PrivateData,
- IN PEI_CORE_DISPATCH_DATA *DispatchData
- )
-
-/*++
-
-Routine Description:
-
- Conduct PEIM dispatch.
-
-Arguments:
-
- PeiStartupDescriptor - Pointer to IN EFI_PEI_STARTUP_DESCRIPTOR
- PrivateData - Pointer to the private data passed in from caller
- DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data.
-
-Returns:
-
- EFI_SUCCESS - Successfully dispatched PEIM.
- EFI_NOT_FOUND - The dispatch failed.
-
---*/
-{
- EFI_STATUS Status;
- PEI_CORE_TEMP_POINTERS TempPtr;
- UINTN PrivateDataInMem;
- BOOLEAN NextFvFound;
- EFI_FIRMWARE_VOLUME_HEADER *NextFvAddress;
- EFI_FIRMWARE_VOLUME_HEADER *DefaultFvAddress;
- VOID *TopOfStack;
- //
- // Debug data for uninstalled Peim list
- //
- EFI_GUID DebugFoundPeimList[32];
- REPORT_STATUS_CODE_LIBRARY_DEVICE_HANDLE_EXTENDED_DATA ExtendedData;
-
- //
- // save the Current FV Address so that we will not process it again if FindFv returns it later
- //
- DefaultFvAddress = DispatchData->BootFvAddress;
-
- //
- // This is the main dispatch loop. It will search known FVs for PEIMs and
- // attempt to dispatch them. If any PEIM gets dispatched through a single
- // pass of the dispatcher, it will start over from the Bfv again to see
- // if any new PEIMs dependencies got satisfied. With a well ordered
- // FV where PEIMs are found in the order their dependencies are also
- // satisfied, this dipatcher should run only once.
- //
- for (;;) {
- //
- // This is the PEIM search loop. It will scan through all PEIMs it can find
- // looking for PEIMs to dispatch, and will dipatch them if they have not
- // already been dispatched and all of their dependencies are met.
- // If no more PEIMs can be found in this pass through all known FVs,
- // then it will break out of this loop.
- //
- for (;;) {
-
- Status = FindNextPeim (
- &PrivateData->PS,
- DispatchData->CurrentFvAddress,
- &DispatchData->CurrentPeimAddress
- );
-
- //
- // If we found a PEIM, check if it is dispatched. If so, go to the
- // next PEIM. If not, dispatch it if its dependencies are satisfied.
- // If its dependencies are not satisfied, go to the next PEIM.
- //
- if (Status == EFI_SUCCESS) {
-
- DEBUG_CODE_BEGIN ();
-
- //
- // Fill list of found Peims for later list of those not installed
- //
- CopyMem (
- &DebugFoundPeimList[DispatchData->CurrentPeim],
- &DispatchData->CurrentPeimAddress->Name,
- sizeof (EFI_GUID)
- );
-
- DEBUG_CODE_END ();
-
- if (!Dispatched (
- DispatchData->CurrentPeim,
- DispatchData->DispatchedPeimBitMap
- )) {
- if (DepexSatisfied (&PrivateData->PS, DispatchData->CurrentPeimAddress)) {
- Status = PeiLoadImage (
- &PrivateData->PS,
- DispatchData->CurrentPeimAddress,
- &TempPtr.Raw
- );
- if (Status == EFI_SUCCESS) {
-
- //
- // The PEIM has its dependencies satisfied, and its entry point
- // has been found, so invoke it.
- //
- PERF_START (
- (VOID *) (UINTN) (DispatchData->CurrentPeimAddress),
- "PEIM",
- NULL,
- 0
- );
-
- //
- // BUGBUG: Used to be EFI_PEI_REPORT_STATUS_CODE_CODE
- //
- ExtendedData.Handle = (EFI_HANDLE)DispatchData->CurrentPeimAddress;
-
- REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
- EFI_PROGRESS_CODE,
- EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_BEGIN,
- (VOID *)(&ExtendedData),
- sizeof (ExtendedData)
- );
-
- //
- // Is this a authentic image
- //
- Status = VerifyPeim (
- &PrivateData->PS,
- DispatchData->CurrentPeimAddress
- );
-
- if (Status != EFI_SECURITY_VIOLATION) {
-
- Status = TempPtr.PeimEntry (
- DispatchData->CurrentPeimAddress,
- &PrivateData->PS
- );
- }
-
- REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
- EFI_PROGRESS_CODE,
- EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT_END,
- (VOID *)(&ExtendedData),
- sizeof (ExtendedData)
- );
-
- PERF_END ((VOID *) (UINTN) (DispatchData->CurrentPeimAddress), "PEIM", NULL, 0);
-
- //
- // Mark the PEIM as dispatched so we don't attempt to run it again
- //
- SetDispatched (
- &PrivateData->PS,
- DispatchData->CurrentPeim,
- &DispatchData->DispatchedPeimBitMap
- );
-
- //
- // Process the Notify list and dispatch any notifies for
- // newly installed PPIs.
- //
- ProcessNotifyList (&PrivateData->PS);
-
- //
- // If real system memory was discovered and installed by this
- // PEIM, switch the stacks to the new memory. Since we are
- // at dispatch level, only the Core's private data is preserved,
- // nobody else should have any data on the stack.
- //
- if (PrivateData->SwitchStackSignal) {
- TempPtr.PeiCore = (PEI_CORE_ENTRY_POINT)PeiCore;
- PrivateDataInMem = (UINTN) TransferOldDataToNewDataRange (PrivateData);
- ASSERT (PrivateDataInMem != 0);
- //
- // Adjust the top of stack to be aligned at CPU_STACK_ALIGNMENT
- //
- TopOfStack = (VOID *)((UINTN)PrivateData->StackBase + (UINTN)PrivateData->StackSize - CPU_STACK_ALIGNMENT);
- TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
-
- PeiSwitchStacks (
- (SWITCH_STACK_ENTRY_POINT)(UINTN)TempPtr.Raw,
- PeiStartupDescriptor,
- (VOID*)PrivateDataInMem,
- TopOfStack,
- (VOID*)(UINTN)PrivateData->StackBase
- );
- }
- }
- }
- }
- DispatchData->CurrentPeim++;
- continue;
-
- } else {
-
- //
- // If we could not find another PEIM in the current FV, go try
- // the FindFv PPI to look in other FVs for more PEIMs. If we can
- // not locate the FindFv PPI, or if the FindFv PPI can not find
- // anymore FVs, then exit the PEIM search loop.
- //
- if (DispatchData->FindFv == NULL) {
- Status = PeiServicesLocatePpi (
- &gEfiFindFvPpiGuid,
- 0,
- NULL,
- (VOID **)&DispatchData->FindFv
- );
- if (Status != EFI_SUCCESS) {
- break;
- }
- }
- NextFvFound = FALSE;
- while (!NextFvFound) {
- Status = DispatchData->FindFv->FindFv (
- DispatchData->FindFv,
- &PrivateData->PS,
- &DispatchData->CurrentFv,
- &NextFvAddress
- );
- //
- // if there is no next fv, get out of this loop of finding FVs
- //
- if (Status != EFI_SUCCESS) {
- break;
- }
- //
- // don't process the default Fv again. (we don't know the order in which the hobs were created)
- //
- if ((NextFvAddress != DefaultFvAddress) &&
- (NextFvAddress != DispatchData->CurrentFvAddress)) {
-
- //
- // VerifyFv() is currently returns SUCCESS all the time, add code to it to
- // actually verify the given FV
- //
- Status = VerifyFv (NextFvAddress);
- if (Status == EFI_SUCCESS) {
- NextFvFound = TRUE;
- DispatchData->CurrentFvAddress = NextFvAddress;
- DispatchData->CurrentPeimAddress = NULL;
- //
- // current PRIM number (CurrentPeim) must continue as is, don't reset it here
- //
- }
- }
- }
- //
- // if there is no next fv, get out of this loop of dispatching PEIMs
- //
- if (!NextFvFound) {
- break;
- }
- //
- // continue in the inner for(;;) loop with a new FV;
- //
- }
- }
-
- //
- // If all the PEIMs that we have found have been dispatched, then
- // there is nothing left to dispatch and we don't need to go search
- // through all PEIMs again.
- //
- if ((~(DispatchData->DispatchedPeimBitMap) &
- ((1 << DispatchData->CurrentPeim)-1)) == 0) {
- break;
- }
-
- //
- // Check if no more PEIMs that depex was satisfied
- //
- if (DispatchData->DispatchedPeimBitMap == DispatchData->PreviousPeimBitMap) {
- break;
- }
-
- //
- // Case when Depex is not satisfied and has to traverse the list again
- //
- DispatchData->CurrentPeim = 0;
- DispatchData->CurrentPeimAddress = 0;
- DispatchData->PreviousPeimBitMap = DispatchData->DispatchedPeimBitMap;
-
- //
- // don't go back to the loop without making sure that the CurrentFvAddress is the
- // same as the 1st (or default) FV we started with. otherwise we will interpret the bimap wrongly and
- // mess it up, always start processing the PEIMs from the default FV just like in the first time around.
- //
- DispatchData->CurrentFv = 0;
- DispatchData->CurrentFvAddress = DefaultFvAddress;
- }
-
- DEBUG_CODE_BEGIN ();
- //
- // Debug data for uninstalled Peim list
- //
- UINT32 DebugNotDispatchedBitmap;
- UINT8 DebugFoundPeimPoint;
-
- DebugFoundPeimPoint = 0;
- //
- // Get bitmap of Peims that were not dispatched,
- //
-
- DebugNotDispatchedBitmap = ((DispatchData->DispatchedPeimBitMap) ^ ((1 << DispatchData->CurrentPeim)-1));
- //
- // Scan bitmap of Peims not installed and print GUIDS
- //
- while (DebugNotDispatchedBitmap != 0) {
- if ((DebugNotDispatchedBitmap & 1) != 0) {
- DEBUG ((EFI_D_INFO, "WARNING -> InstallPpi: Not Installed: %g\n",
- &DebugFoundPeimList[DebugFoundPeimPoint]
- ));
- }
- DebugFoundPeimPoint++;
- DebugNotDispatchedBitmap >>= 1;
- }
-
- DEBUG_CODE_END ();
-
- return EFI_NOT_FOUND;
-}
-
-VOID
-InitializeDispatcherData (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_CORE_INSTANCE *OldCoreData,
- IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor
- )
-/*++
-
-Routine Description:
-
- Initialize the Dispatcher's data members
-
-Arguments:
-
- PeiServices - The PEI core services table.
- OldCoreData - Pointer to old core data (before switching stack).
- NULL if being run in non-permament memory mode.
- PeiStartupDescriptor - Information and services provided by SEC phase.
-
-Returns:
-
- None.
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
-
- if (OldCoreData == NULL) {
- PrivateData->DispatchData.CurrentFvAddress = (EFI_FIRMWARE_VOLUME_HEADER *) PeiStartupDescriptor->BootFirmwareVolume;
- PrivateData->DispatchData.BootFvAddress = (EFI_FIRMWARE_VOLUME_HEADER *) PeiStartupDescriptor->BootFirmwareVolume;
- } else {
-
- //
- // Current peim has been dispatched, but not count
- //
- PrivateData->DispatchData.CurrentPeim = (UINT8)(OldCoreData->DispatchData.CurrentPeim + 1);
- }
-
- return;
-}
-
-
-BOOLEAN
-Dispatched (
- IN UINT8 CurrentPeim,
- IN UINT32 DispatchedPeimBitMap
- )
-/*++
-
-Routine Description:
-
- This routine checks to see if a particular PEIM has been dispatched during
- the PEI core dispatch.
-
-Arguments:
- CurrentPeim - The PEIM/FV in the bit array to check.
- DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
-
-Returns:
- TRUE - PEIM already dispatched
- FALSE - Otherwise
-
---*/
-{
- return (BOOLEAN)((DispatchedPeimBitMap & (1 << CurrentPeim)) != 0);
-}
-
-VOID
-SetDispatched (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINT8 CurrentPeim,
- OUT UINT32 *DispatchedPeimBitMap
- )
-/*++
-
-Routine Description:
-
- This routine sets a PEIM as having been dispatched once its entry
- point has been invoked.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- CurrentPeim - The PEIM/FV in the bit array to check.
- DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
-
-Returns:
- None
-
---*/
-{
- //
- // Check if the total number of PEIMs exceed the bitmap.
- // CurrentPeim is 0-based
- //
- ASSERT (CurrentPeim < (sizeof (*DispatchedPeimBitMap) * 8));
- *DispatchedPeimBitMap |= (1 << CurrentPeim);
- return;
-}
-
-BOOLEAN
-DepexSatisfied (
- IN EFI_PEI_SERVICES **PeiServices,
- IN VOID *CurrentPeimAddress
- )
-/*++
-
-Routine Description:
-
- This routine parses the Dependency Expression, if available, and
- decides if the module can be executed.
-
-Arguments:
- PeiServices - The PEI Service Table
- CurrentPeimAddress - Address of the PEIM Firmware File under investigation
-
-Returns:
- TRUE - Can be dispatched
- FALSE - Cannot be dispatched
-
---*/
-{
- EFI_STATUS Status;
- INT8 *DepexData;
- BOOLEAN Runnable;
-
- Status = PeiServicesFfsFindSectionData (
- EFI_SECTION_PEI_DEPEX,
- CurrentPeimAddress,
- (VOID **)&DepexData
- );
- //
- // If there is no DEPEX, assume the module can be executed
- //
- if (EFI_ERROR (Status)) {
- return TRUE;
- }
-
- //
- // Evaluate a given DEPEX
- //
- Status = PeimDispatchReadiness (
- PeiServices,
- DepexData,
- &Runnable
- );
-
- return Runnable;
-}
-
-STATIC
-VOID *
-TransferOldDataToNewDataRange (
- IN PEI_CORE_INSTANCE *PrivateData
- )
-/*++
-
-Routine Description:
-
- This routine transfers the contents of the pre-permanent memory
- PEI Core private data to a post-permanent memory data location.
-
-Arguments:
-
- PrivateData - Pointer to the current PEI Core private data pre-permanent memory
-
-Returns:
-
- Pointer to the PrivateData once the private data has been transferred to permanent memory
-
---*/
-{
- //
- //Build private HOB to PEI core to transfer old NEM-range data to new NEM-range
- //
- return BuildGuidDataHob (&gEfiPeiCorePrivateGuid, PrivateData, sizeof (PEI_CORE_INSTANCE));
-}
-
diff --git a/EdkModulePkg/Core/Pei/Dispatcher/Stack.c b/EdkModulePkg/Core/Pei/Dispatcher/Stack.c
deleted file mode 100644
index 057537e..0000000
--- a/EdkModulePkg/Core/Pei/Dispatcher/Stack.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
- PeiSwitchStacks() function for PEI dispatcher.
-
- Copyright (c) 2006, Intel Corporation<BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: String.c
-
-**/
-
-/**
- Transfers control to a function starting with a new stack.
-
- Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
-
- If EntryPoint is NULL, then ASSERT().
- If NewStack is NULL, then ASSERT().
-
- @param EntryPoint A pointer to function to call with the new stack.
- @param Context1 A pointer to the context to pass into the EntryPoint
- function.
- @param Context2 A pointer to the context to pass into the EntryPoint
- function.
- @param NewStack A pointer to the new stack to use for the EntryPoint
- function.
- @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
- Reserved on other architectures.
-
-**/
-VOID
-EFIAPI
-PeiSwitchStacks (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack,
- IN VOID *NewBsp
- )
-{
- SwitchStack (EntryPoint, Context1, Context2, NewStack);
-}
diff --git a/EdkModulePkg/Core/Pei/FwVol/FwVol.c b/EdkModulePkg/Core/Pei/FwVol/FwVol.c
deleted file mode 100644
index d06590c..0000000
--- a/EdkModulePkg/Core/Pei/FwVol/FwVol.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FwVol.c
-
-Abstract:
-
- Pei Core Firmware File System service routines.
-
---*/
-
-#include <PeiMain.h>
-
-#define GETOCCUPIEDSIZE(ActualSize, Alignment) \
- (ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1))
-
-STATIC
-EFI_FFS_FILE_STATE
-GetFileState(
- IN UINT8 ErasePolarity,
- IN EFI_FFS_FILE_HEADER *FfsHeader
- )
-/*++
-
-Routine Description:
-
- Returns the highest bit set of the State field
-
-Arguments:
-
- ErasePolarity - Erase Polarity as defined by EFI_FVB_ERASE_POLARITY
- in the Attributes field.
- FfsHeader - Pointer to FFS File Header.
-
-Returns:
- Returns the highest bit in the State field
-
---*/
-{
- EFI_FFS_FILE_STATE FileState;
- EFI_FFS_FILE_STATE HighestBit;
-
- FileState = FfsHeader->State;
-
- if (ErasePolarity != 0) {
- FileState = (EFI_FFS_FILE_STATE)~FileState;
- }
-
- HighestBit = 0x80;
- while (HighestBit != 0 && (HighestBit & FileState) == 0) {
- HighestBit >>= 1;
- }
-
- return HighestBit;
-}
-
-STATIC
-UINT8
-CalculateHeaderChecksum (
- IN EFI_FFS_FILE_HEADER *FileHeader
- )
-/*++
-
-Routine Description:
-
- Calculates the checksum of the header of a file.
-
-Arguments:
-
- FileHeader - Pointer to FFS File Header.
-
-Returns:
- Checksum of the header.
-
- The header is zero byte checksum.
- - Zero means the header is good.
- - Non-zero means the header is bad.
-
-
-Bugbug: For PEI performance reason, we comments this code at this time.
---*/
-{
- UINT8 *ptr;
- UINTN Index;
- UINT8 Sum;
-
- Sum = 0;
- ptr = (UINT8 *)FileHeader;
-
- for (Index = 0; Index < sizeof(EFI_FFS_FILE_HEADER) - 3; Index += 4) {
- Sum = (UINT8)(Sum + ptr[Index]);
- Sum = (UINT8)(Sum + ptr[Index+1]);
- Sum = (UINT8)(Sum + ptr[Index+2]);
- Sum = (UINT8)(Sum + ptr[Index+3]);
- }
-
- for (; Index < sizeof(EFI_FFS_FILE_HEADER); Index++) {
- Sum = (UINT8)(Sum + ptr[Index]);
- }
-
- //
- // State field (since this indicates the different state of file).
- //
- Sum = (UINT8)(Sum - FileHeader->State);
- //
- // Checksum field of the file is not part of the header checksum.
- //
- Sum = (UINT8)(Sum - FileHeader->IntegrityCheck.Checksum.File);
-
- return Sum;
-}
-
-STATIC
-EFI_STATUS
-PeiFfsFindNextFileEx (
- IN EFI_FV_FILETYPE SearchType,
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- IN OUT EFI_FFS_FILE_HEADER **FileHeader,
- IN BOOLEAN Flag
- )
-/*++
-
-Routine Description:
- Given the input file pointer, search for the next matching file in the
- FFS volume as defined by SearchType. The search starts from FileHeader inside
- the Firmware Volume defined by FwVolHeader.
-
-Arguments:
- PeiServices - Pointer to the PEI Core Services Table.
- SearchType - Filter to find only files of this type.
- Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
- FwVolHeader - Pointer to the FV header of the volume to search.
- This parameter must point to a valid FFS volume.
- FileHeader - Pointer to the current file from which to begin searching.
- This pointer will be updated upon return to reflect the file found.
- Flag - Indicator for if this is for PEI Dispath search
-Returns:
- EFI_NOT_FOUND - No files matching the search criteria were found
- EFI_SUCCESS
-
---*/
-{
- EFI_FFS_FILE_HEADER *FfsFileHeader;
- UINT32 FileLength;
- UINT32 FileOccupiedSize;
- UINT32 FileOffset;
- UINT64 FvLength;
- UINT8 ErasePolarity;
- UINT8 FileState;
-
-
- FvLength = FwVolHeader->FvLength;
- if (FwVolHeader->Attributes & EFI_FVB_ERASE_POLARITY) {
- ErasePolarity = 1;
- } else {
- ErasePolarity = 0;
- }
-
- //
- // If FileHeader is not specified (NULL) start with the first file in the
- // firmware volume. Otherwise, start from the FileHeader.
- //
- if (*FileHeader == NULL) {
- FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FwVolHeader + FwVolHeader->HeaderLength);
- } else {
- //
- // Length is 24 bits wide so mask upper 8 bits
- // FileLength is adjusted to FileOccupiedSize as it is 8 byte aligned.
- //
- FileLength = *(UINT32 *)(*FileHeader)->Size & 0x00FFFFFF;
- FileOccupiedSize = GETOCCUPIEDSIZE(FileLength, 8);
- FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)*FileHeader + FileOccupiedSize);
- }
-
- FileOffset = (UINT32) ((UINT8 *)FfsFileHeader - (UINT8 *)FwVolHeader);
- ASSERT (FileOffset <= 0xFFFFFFFF);
-
- while (FileOffset < (FvLength - sizeof(EFI_FFS_FILE_HEADER))) {
- //
- // Get FileState which is the highest bit of the State
- //
- FileState = GetFileState (ErasePolarity, FfsFileHeader);
-
- switch (FileState) {
-
- case EFI_FILE_HEADER_INVALID:
- FileOffset += sizeof(EFI_FFS_FILE_HEADER);
- FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + sizeof(EFI_FFS_FILE_HEADER));
- break;
-
- case EFI_FILE_DATA_VALID:
- case EFI_FILE_MARKED_FOR_UPDATE:
- if (CalculateHeaderChecksum (FfsFileHeader) == 0) {
- FileLength = *(UINT32 *)(FfsFileHeader->Size) & 0x00FFFFFF;
- FileOccupiedSize = GETOCCUPIEDSIZE(FileLength, 8);
- if (Flag) {
- if ((FfsFileHeader->Type == EFI_FV_FILETYPE_PEIM) ||
- (FfsFileHeader->Type == EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER)) {
-
- *FileHeader = FfsFileHeader;
-
-
- return EFI_SUCCESS;
- }
- } else {
- if ((SearchType == FfsFileHeader->Type) ||
- (SearchType == EFI_FV_FILETYPE_ALL)) {
-
- *FileHeader = FfsFileHeader;
-
-
- return EFI_SUCCESS;
- }
- }
-
- FileOffset += FileOccupiedSize;
- FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + FileOccupiedSize);
- } else {
- ASSERT (FALSE);
- return EFI_NOT_FOUND;
- }
- break;
-
- case EFI_FILE_DELETED:
- FileLength = *(UINT32 *)(FfsFileHeader->Size) & 0x00FFFFFF;
- FileOccupiedSize = GETOCCUPIEDSIZE(FileLength, 8);
- FileOffset += FileOccupiedSize;
- FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FfsFileHeader + FileOccupiedSize);
- break;
-
- default:
- return EFI_NOT_FOUND;
-
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-
-EFI_STATUS
-EFIAPI
-PeiFfsFindSectionData (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_SECTION_TYPE SectionType,
- IN EFI_FFS_FILE_HEADER *FfsFileHeader,
- IN OUT VOID **SectionData
- )
-/*++
-
-Routine Description:
- Given the input file pointer, search for the next matching section in the
- FFS volume.
-
-Arguments:
- PeiServices - Pointer to the PEI Core Services Table.
- SearchType - Filter to find only sections of this type.
- FfsFileHeader - Pointer to the current file to search.
- SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
- - NULL if section not found
-
-Returns:
- EFI_NOT_FOUND - No files matching the search criteria were found
- EFI_SUCCESS
-
---*/
-{
- UINT32 FileSize;
- EFI_COMMON_SECTION_HEADER *Section;
- UINT32 SectionLength;
- UINT32 ParsedLength;
-
-
- //
- // Size is 24 bits wide so mask upper 8 bits.
- // Does not include FfsFileHeader header size
- // FileSize is adjusted to FileOccupiedSize as it is 8 byte aligned.
- //
- Section = (EFI_COMMON_SECTION_HEADER *)(FfsFileHeader + 1);
- FileSize = *(UINT32 *)(FfsFileHeader->Size) & 0x00FFFFFF;
- FileSize -= sizeof(EFI_FFS_FILE_HEADER);
-
- *SectionData = NULL;
- ParsedLength = 0;
- while (ParsedLength < FileSize) {
- if (Section->Type == SectionType) {
- *SectionData = (VOID *)(Section + 1);
-
-
- return EFI_SUCCESS;
- }
- //
- // Size is 24 bits wide so mask upper 8 bits.
- // SectionLength is adjusted it is 4 byte aligned.
- // Go to the next section
- //
- SectionLength = *(UINT32 *)Section->Size & 0x00FFFFFF;
- SectionLength = GETOCCUPIEDSIZE (SectionLength, 4);
- ASSERT (SectionLength != 0);
- ParsedLength += SectionLength;
- Section = (EFI_COMMON_SECTION_HEADER *)((UINT8 *)Section + SectionLength);
- }
-
- return EFI_NOT_FOUND;
-
-}
-
-
-EFI_STATUS
-FindNextPeim (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- IN OUT EFI_FFS_FILE_HEADER **PeimFileHeader
- )
-/*++
-
-Routine Description:
- Given the input file pointer, search for the next matching file in the
- FFS volume. The search starts from FileHeader inside
- the Firmware Volume defined by FwVolHeader.
-
-Arguments:
- PeiServices - Pointer to the PEI Core Services Table.
-
- FwVolHeader - Pointer to the FV header of the volume to search.
- This parameter must point to a valid FFS volume.
-
- PeimFileHeader - Pointer to the current file from which to begin searching.
- This pointer will be updated upon return to reflect the file found.
-
-Returns:
- EFI_NOT_FOUND - No files matching the search criteria were found
- EFI_SUCCESS
-
---*/
-{
- return PeiFfsFindNextFileEx (
- 0,
- FwVolHeader,
- PeimFileHeader,
- TRUE
- );
-}
-
-EFI_STATUS
-EFIAPI
-PeiFfsFindNextFile (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_FV_FILETYPE SearchType,
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- IN OUT EFI_FFS_FILE_HEADER **FileHeader
- )
-/*++
-
-Routine Description:
- Given the input file pointer, search for the next matching file in the
- FFS volume as defined by SearchType. The search starts from FileHeader inside
- the Firmware Volume defined by FwVolHeader.
-
-Arguments:
- PeiServices - Pointer to the PEI Core Services Table.
-
- SearchType - Filter to find only files of this type.
- Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
-
- FwVolHeader - Pointer to the FV header of the volume to search.
- This parameter must point to a valid FFS volume.
-
- FileHeader - Pointer to the current file from which to begin searching.
- This pointer will be updated upon return to reflect the file found.
-
-Returns:
- EFI_NOT_FOUND - No files matching the search criteria were found
- EFI_SUCCESS
-
---*/
-{
- return PeiFfsFindNextFileEx (
- SearchType,
- FwVolHeader,
- FileHeader,
- FALSE
- );
-}
-
-EFI_STATUS
-EFIAPI
-PeiFvFindNextVolume (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINTN Instance,
- IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
- )
-/*++
-
-Routine Description:
-
- Return the BFV location
-
- BugBug -- Move this to the location of this code to where the
- other FV and FFS support code lives.
- Also, update to use FindFV for instances #'s >= 1.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- Instance - Instance of FV to find
- FwVolHeader - Pointer to contain the data to return
-
-Returns:
- Pointer to the Firmware Volume instance requested
-
- EFI_INVALID_PARAMETER - FwVolHeader is NULL
-
- EFI_SUCCESS - Firmware volume instance successfully found.
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- EFI_STATUS Status;
- EFI_PEI_FIND_FV_PPI *FindFvPpi;
- UINT8 LocalInstance;
-
-
- LocalInstance = (UINT8) Instance;
-
- Status = EFI_SUCCESS;
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- if (FwVolHeader == NULL) {
-
- return EFI_INVALID_PARAMETER;
- }
-
- if (Instance == 0) {
- *FwVolHeader = PrivateData->DispatchData.BootFvAddress;
-
-
- return Status;
- } else {
- //
- // Locate all instances of FindFV
- // Alternately, could use FV HOBs, but the PPI is cleaner
- //
- Status = PeiServicesLocatePpi (
- &gEfiFindFvPpiGuid,
- 0,
- NULL,
- (VOID **)&FindFvPpi
- );
-
- if (Status != EFI_SUCCESS) {
- Status = EFI_NOT_FOUND;
- } else {
- Status = FindFvPpi->FindFv (
- FindFvPpi,
- PeiServices,
- &LocalInstance,
- FwVolHeader
- );
-
- }
- }
- return Status;
-}
diff --git a/EdkModulePkg/Core/Pei/Hob/Hob.c b/EdkModulePkg/Core/Pei/Hob/Hob.c
deleted file mode 100644
index 9ac672b..0000000
--- a/EdkModulePkg/Core/Pei/Hob/Hob.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Hob.c
-
-Abstract:
-
- EFI PEI Core HOB services
-
---*/
-
-#include <PeiMain.h>
-
-EFI_STATUS
-EFIAPI
-PeiGetHobList (
- IN EFI_PEI_SERVICES **PeiServices,
- IN OUT VOID **HobList
- )
-/*++
-
-Routine Description:
-
- Gets the pointer to the HOB List.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- HobList - Pointer to the HOB List.
-
-Returns:
-
- EFI_SUCCESS - Get the pointer of HOB List
- EFI_NOT_AVAILABLE_YET - the HOB List is not yet published
- EFI_INVALID_PARAMETER - HobList is NULL (in debug mode)
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
-
-
- //
- // Only check this parameter in debug mode
- //
-
- DEBUG_CODE_BEGIN ();
- if (HobList == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- DEBUG_CODE_END ();
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- *HobList = PrivateData->HobList.Raw;
-
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-PeiCreateHob (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINT16 Type,
- IN UINT16 Length,
- IN OUT VOID **Hob
- )
-/*++
-
-Routine Description:
-
- Add a new HOB to the HOB List.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- Type - Type of the new HOB.
- Length - Length of the new HOB to allocate.
- Hob - Pointer to the new HOB.
-
-Returns:
-
- Status - EFI_SUCCESS
- - EFI_INVALID_PARAMETER if Hob is NULL
- - EFI_NOT_AVAILABLE_YET if HobList is still not available.
- - EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
-
---*/
-{
- EFI_STATUS Status;
- EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
- EFI_HOB_GENERIC_HEADER *HobEnd;
- EFI_PHYSICAL_ADDRESS FreeMemory;
-
-
- Status = PeiGetHobList (PeiServices, Hob);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- HandOffHob = *Hob;
-
- Length = (UINT16)((Length + 0x7) & (~0x7));
-
- FreeMemory = HandOffHob->EfiFreeMemoryTop -
- HandOffHob->EfiFreeMemoryBottom;
-
- if (FreeMemory < Length) {
- DEBUG ((EFI_D_ERROR, "PeiCreateHob fail: Length - 0x%08x\n", (UINTN)Length));
- DEBUG ((EFI_D_ERROR, " FreeMemoryTop - 0x%08x\n", (UINTN)HandOffHob->EfiFreeMemoryTop));
- DEBUG ((EFI_D_ERROR, " FreeMemoryBottom - 0x%08x\n", (UINTN)HandOffHob->EfiFreeMemoryBottom));
- return EFI_OUT_OF_RESOURCES;
- }
-
- *Hob = (VOID*) (UINTN) HandOffHob->EfiEndOfHobList;
- ((EFI_HOB_GENERIC_HEADER*) *Hob)->HobType = Type;
- ((EFI_HOB_GENERIC_HEADER*) *Hob)->HobLength = Length;
- ((EFI_HOB_GENERIC_HEADER*) *Hob)->Reserved = 0;
-
- HobEnd = (EFI_HOB_GENERIC_HEADER*) ((UINTN) *Hob + Length);
- HandOffHob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;
-
- HobEnd->HobType = EFI_HOB_TYPE_END_OF_HOB_LIST;
- HobEnd->HobLength = sizeof(EFI_HOB_GENERIC_HEADER);
- HobEnd->Reserved = 0;
- HobEnd++;
- HandOffHob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;
-
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-PeiCoreBuildHobHandoffInfoTable (
- IN EFI_BOOT_MODE BootMode,
- IN EFI_PHYSICAL_ADDRESS MemoryBegin,
- IN UINT64 MemoryLength
- )
-/*++
-
-Routine Description:
-
- Builds a Handoff Information Table HOB
-
-Arguments:
-
- BootMode - Current Bootmode
- MemoryBegin - Start Memory Address.
- MemoryLength - Length of Memory.
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- EFI_HOB_HANDOFF_INFO_TABLE *Hob;
- EFI_HOB_GENERIC_HEADER *HobEnd;
-
- Hob = (VOID *)(UINTN)MemoryBegin;
- HobEnd = (EFI_HOB_GENERIC_HEADER*) (Hob+1);
- Hob->Header.HobType = EFI_HOB_TYPE_HANDOFF;
- Hob->Header.HobLength = sizeof(EFI_HOB_HANDOFF_INFO_TABLE);
- Hob->Header.Reserved = 0;
-
- HobEnd->HobType = EFI_HOB_TYPE_END_OF_HOB_LIST;
- HobEnd->HobLength = sizeof(EFI_HOB_GENERIC_HEADER);
- HobEnd->Reserved = 0;
-
- Hob->Version = EFI_HOB_HANDOFF_TABLE_VERSION;
- Hob->BootMode = BootMode;
-
- Hob->EfiMemoryTop = MemoryBegin + MemoryLength;
- Hob->EfiMemoryBottom = MemoryBegin;
- Hob->EfiFreeMemoryTop = MemoryBegin + MemoryLength;
- Hob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS) (UINTN) (HobEnd+1);
- Hob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Pei/Image/Image.c b/EdkModulePkg/Core/Pei/Image/Image.c
deleted file mode 100644
index 2029368..0000000
--- a/EdkModulePkg/Core/Pei/Image/Image.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Image.c
-
-Abstract:
-
- Pei Core Load Image Support
-
---*/
-
-#include <PeiMain.h>
-
-
-
-EFI_STATUS
-PeiLoadImage (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_FFS_FILE_HEADER *PeimFileHeader,
- OUT VOID **EntryPoint
- )
-/*++
-
-Routine Description:
-
- Routine for loading file image.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- PeimFileHeader - Pointer to the FFS file header of the image.
- EntryPoint - Pointer to entry point of specified image file for output.
-
-Returns:
-
- Status - EFI_SUCCESS - Image is successfully loaded.
- EFI_NOT_FOUND - Fail to locate necessary PPI
- Others - Fail to load file.
-
---*/
-{
- EFI_STATUS Status;
- VOID *Pe32Data;
- EFI_PEI_FV_FILE_LOADER_PPI *FvLoadFilePpi;
- EFI_PHYSICAL_ADDRESS ImageAddress;
- UINT64 ImageSize;
- EFI_PHYSICAL_ADDRESS ImageEntryPoint;
- EFI_TE_IMAGE_HEADER *TEImageHeader;
- UINT16 Machine;
-
- *EntryPoint = NULL;
- TEImageHeader = NULL;
-
- //
- // Try to find a PE32 section.
- //
- Status = PeiServicesFfsFindSectionData (
- EFI_SECTION_PE32,
- PeimFileHeader,
- &Pe32Data
- );
- //
- // If we didn't find a PE32 section, try to find a TE section.
- //
- if (EFI_ERROR (Status)) {
- Status = PeiServicesFfsFindSectionData (
- EFI_SECTION_TE,
- PeimFileHeader,
- (VOID **) &TEImageHeader
- );
- if (EFI_ERROR (Status) || TEImageHeader == NULL) {
- //
- // There was not a PE32 or a TE section, so assume that it's a Compressed section
- // and use the LoadFile
- //
- Status = PeiServicesLocatePpi (
- &gEfiPeiFvFileLoaderPpiGuid,
- 0,
- NULL,
- (VOID **)&FvLoadFilePpi
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- Status = FvLoadFilePpi->FvLoadFile (
- FvLoadFilePpi,
- PeimFileHeader,
- &ImageAddress,
- &ImageSize,
- &ImageEntryPoint
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Got the entry point from ImageEntryPoint and ImageStartAddress
- //
- Pe32Data = (VOID *) ((UINTN) ImageAddress);
- *EntryPoint = (VOID *) ((UINTN) ImageEntryPoint);
- } else {
- //
- // Retrieve the entry point from the TE image header
- //
- ImageAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) TEImageHeader;
- *EntryPoint = (VOID *)((UINTN) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) +
- TEImageHeader->AddressOfEntryPoint - TEImageHeader->StrippedSize);
- }
- } else {
- //
- // Retrieve the entry point from the PE/COFF image header
- //
- ImageAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) Pe32Data;
- Status = PeCoffLoaderGetEntryPoint (Pe32Data, EntryPoint);
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- }
-
- if (((EFI_TE_IMAGE_HEADER *) (UINTN) ImageAddress)->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
- TEImageHeader = (EFI_TE_IMAGE_HEADER *) (UINTN) ImageAddress;
- Machine = TEImageHeader->Machine;
- } else {
- Machine = PeCoffLoaderGetMachineType (Pe32Data);
- }
-
- if (!EFI_IMAGE_MACHINE_TYPE_SUPPORTED (Machine)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Print debug message: Loading PEIM at 0x12345678 EntryPoint=0x12345688 Driver.efi
- //
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Loading PEIM at 0x%08x EntryPoint=0x%08x ", (UINTN) ImageAddress, *EntryPoint));
- DEBUG_CODE_BEGIN ();
- EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
- EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
- UINTN DirCount;
- UINTN Index;
- UINTN Index1;
- BOOLEAN FileNameFound;
- CHAR8 *AsciiString;
- CHAR8 AsciiBuffer[512];
- VOID *CodeViewEntryPointer;
- INTN TEImageAdjust;
- EFI_IMAGE_DOS_HEADER *DosHeader;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;
- UINT32 NumberOfRvaAndSizes;
-
- Hdr.Pe32 = NULL;
- if (TEImageHeader == NULL) {
- DosHeader = (EFI_IMAGE_DOS_HEADER *)Pe32Data;
- if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
- //
- // DOS image header is present, so read the PE header after the DOS image header
- //
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHeader->e_lfanew) & 0x0ffff));
- } else {
- //
- // DOS image header is not present, so PE header is at the image base
- //
- Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;
- }
- }
-
- //
- // Find the codeview info in the image and display the file name
- // being loaded.
- //
- // Per the PE/COFF spec, you can't assume that a given data directory
- // is present in the image. You have to check the NumberOfRvaAndSizes in
- // the optional header to verify a desired directory entry is there.
- //
- DebugEntry = NULL;
- DirectoryEntry = NULL;
- NumberOfRvaAndSizes = 0;
- TEImageAdjust = 0;
-
- if (TEImageHeader == NULL) {
- if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
- //
- // Use PE32 offset get Debug Directory Entry
- //
- NumberOfRvaAndSizes = Hdr.Pe32->OptionalHeader.NumberOfRvaAndSizes;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
- DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) ((UINTN) Pe32Data + DirectoryEntry->VirtualAddress);
- } else if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
- //
- // Use PE32+ offset get Debug Directory Entry
- //
- NumberOfRvaAndSizes = Hdr.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(Hdr.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG]);
- DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) ((UINTN) Pe32Data + DirectoryEntry->VirtualAddress);
- }
-
- if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_DEBUG) {
- DirectoryEntry = NULL;
- DebugEntry = NULL;
- }
- } else {
- if (TEImageHeader->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress != 0) {
- DirectoryEntry = &TEImageHeader->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG];
- TEImageAdjust = sizeof (EFI_TE_IMAGE_HEADER) - TEImageHeader->StrippedSize;
- DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) TEImageHeader +
- TEImageHeader->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress +
- TEImageAdjust);
- }
- }
-
- if (DebugEntry != NULL && DirectoryEntry != NULL) {
- for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {
- if (DebugEntry->Type == EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
- if (DebugEntry->SizeOfData > 0) {
- CodeViewEntryPointer = (VOID *) ((UINTN) DebugEntry->RVA + (UINTN) ImageAddress + (UINTN)TEImageAdjust);
- switch (* (UINT32 *) CodeViewEntryPointer) {
- case CODEVIEW_SIGNATURE_NB10:
- AsciiString = (CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY);
- break;
-
- case CODEVIEW_SIGNATURE_RSDS:
- AsciiString = (CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
- break;
-
- default:
- AsciiString = NULL;
- break;
- }
- if (AsciiString != NULL) {
- FileNameFound = FALSE;
- for (Index = 0, Index1 = 0; AsciiString[Index] != '\0'; Index++) {
- if (AsciiString[Index] == '\\') {
- Index1 = Index;
- FileNameFound = TRUE;
- }
- }
-
- if (FileNameFound) {
- for (Index = Index1 + 1; AsciiString[Index] != '.'; Index++) {
- AsciiBuffer[Index - (Index1 + 1)] = AsciiString[Index];
- }
- AsciiBuffer[Index - (Index1 + 1)] = 0;
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "%a.efi", AsciiBuffer));
- break;
- }
- }
- }
- }
- }
- }
- DEBUG_CODE_END ();
-
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "\n"));
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Pei/Ipf/IpfCpuCore.i b/EdkModulePkg/Core/Pei/Ipf/IpfCpuCore.i
deleted file mode 100644
index c8a209d..0000000
--- a/EdkModulePkg/Core/Pei/Ipf/IpfCpuCore.i
+++ /dev/null
@@ -1,93 +0,0 @@
-//++
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// IpfCpuCore.i
-//
-// Abstract:
-// IPF CPU definitions
-//
-//--
-
-#ifndef _IPF_CPU_CORE_
-#define _IPF_CPU_CORE_
-
-#define PEI_BSP_STORE_SIZE 0x4000
-#define ResetFn 0x00
-#define MachineCheckFn 0x01
-#define InitFn 0x02
-#define RecoveryFn 0x03
-#define GuardBand 0x10
-
-//
-// Define hardware RSE Configuration Register
-//
-
-//
-// RS Configuration (RSC) bit field positions
-//
-#define RSC_MODE 0
-#define RSC_PL 2
-#define RSC_BE 4
-//
-// RSC bits 5-15 reserved
-//
-#define RSC_MBZ0 5
-#define RSC_MBZ0_V 0x3ff
-#define RSC_LOADRS 16
-#define RSC_LOADRS_LEN 14
-//
-// RSC bits 30-63 reserved
-//
-#define RSC_MBZ1 30
-#define RSC_MBZ1_V 0x3ffffffffULL
-
-//
-// RSC modes
-//
-
-//
-// Lazy
-//
-#define RSC_MODE_LY (0x0)
-//
-// Store intensive
-//
-#define RSC_MODE_SI (0x1)
-//
-// Load intensive
-//
-#define RSC_MODE_LI (0x2)
-//
-// Eager
-//
-#define RSC_MODE_EA (0x3)
-
-//
-// RSC Endian bit values
-//
-#define RSC_BE_LITTLE 0
-#define RSC_BE_BIG 1
-
-//
-// RSC while in kernel: enabled, little endian, pl = 0, eager mode
-//
-#define RSC_KERNEL ((RSC_MODE_EA<<RSC_MODE) | (RSC_BE_LITTLE<<RSC_BE))
-//
-// Lazy RSC in kernel: enabled, little endian, pl = 0, lazy mode
-//
-#define RSC_KERNEL_LAZ ((RSC_MODE_LY<<RSC_MODE) | (RSC_BE_LITTLE<<RSC_BE))
-//
-// RSE disabled: disabled, pl = 0, little endian, eager mode
-//
-#define RSC_KERNEL_DISABLED ((RSC_MODE_LY<<RSC_MODE) | (RSC_BE_LITTLE<<RSC_BE))
-
-#endif
diff --git a/EdkModulePkg/Core/Pei/Ipf/IpfCpuCore.s b/EdkModulePkg/Core/Pei/Ipf/IpfCpuCore.s
deleted file mode 100644
index b1b5e2a..0000000
--- a/EdkModulePkg/Core/Pei/Ipf/IpfCpuCore.s
+++ /dev/null
@@ -1,192 +0,0 @@
-//++
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// IpfCpuCore.s
-//
-// Abstract:
-// IPF Specific assembly routines
-//
-//--
-
-.file "IpfCpuCore.s"
-
-#include "IpfMacro.i"
-#include "Ipf/IpfCpuCore.i"
-
-//----------------------------------------------------------------------------------
-// This module supports terminating CAR (Cache As RAM) stage. It copies all the
-// CAR data into real RAM and then makes a stack switch.
-
-// EFI_STATUS
-// SwitchCoreStacks (
-// IN VOID *EntryPoint,
-// IN UINTN CopySize,
-// IN VOID *OldBase,
-// IN VOID *NewBase
-// IN UINTN NewSP, OPTIONAL
-// IN UINTN NewBSP OPTIONAL
-// )
-// EFI_STATUS
-// SwitchCoreStacks (
-// IN VOID *EntryPointForContinuationFunction,
-// IN UINTN StartupDescriptor,
-// IN VOID PEICorePointer,
-// IN UINTN NewSP
-// )
-//----------------------------------------------------------------------------------
-PROCEDURE_ENTRY (SwitchCoreStacks)
-
- NESTED_SETUP (4,2,0,0)
-
- // first save all stack registers in GPRs.
- mov r13 = in0;; // this is a pointer to the PLABEL of the continuation function.
- ld8 r16 = [r13],8;; // r16 = address of continuation function from the PLABEL
- ld8 gp = [r13];; // gp = gp of continuation function from the PLABEL
- mov b1 = r16;;
-
- // save the parameters in r5, r6. these 2 seemed to be preserved across PAL calls
- mov r5 = in1;; // this is the parameter1 to pass to the continuation function
- mov r6 = in2;; // this is the parameter2 to pass to the continuation function
- dep r6=0,r6,63,1;; // zero the bit 63.
-
- mov r8 = in3;; // new stack pointer.
-
- // r8 has the sp, this is 128K stack size, from this we will reserve 16K for the bspstore
- movl r15 = PEI_BSP_STORE_SIZE;;
- sub r8 = r8, r15;;
- add r15 = (GuardBand),r8;; // some little buffer, now r15 will be our bspstore
-
- // save the bspstore value to r4, save sp value to r7
- mov r4 = r15
- mov r7 = r8
- mov r16 = r8;; // will be the new sp in uncache mode
-
-
- alloc r11=0,0,0,0;; // Set 0-size frame
- flushrs;;
-
- mov r21 = RSC_KERNEL_DISABLED;; // for rse disable
- mov ar.rsc = r21;; // turn off RSE
-
- add sp = r0, r16 // transfer to the EFI stack
- mov ar.bspstore = r15 // switch to EFI BSP
- invala // change of ar.bspstore needs invala.
-
- mov r19 = RSC_KERNEL_LAZ;; // RSC enabled, Lazy mode
- mov ar.rsc = r19;; // turn rse on, in kernel mode
-
-//-----------------------------------------------------------------------------------
-// Save here the meaningful stuff for next few lines and then make the PAL call.
-// Make PAL call to terminate the CAR status.
- // AVL: do this only for recovery check call...
-
- mov r28=ar.k3;;
- dep r2 = r28,r0,0,8;; // Extract Function bits from GR20.
- cmp.eq p6,p7 = RecoveryFn,r2;; // Is it Recovery check
- (p7) br.sptk.few DoneCARTermination; // if not, don't terminate car..
-
-TerminateCAR::
-
- mov r28 = ip;;
- add r28 = (DoneCARTerminationPALCall - TerminateCAR),r28;;
- mov b0 = r28
-
- mov r8 = ar.k5;;
- mov b6 = r8
- mov r28 = 0x208
-
- mov r29 = r0
- mov r30 = r0
- mov r31 = r0
- mov r8 = r0;;
- br.sptk.few b6;; // Call PAL-A call.
-
-DoneCARTerminationPALCall::
-
-// don't check error in soft sdv, it is always returning -1 for this call for some reason
-#if SOFT_SDV
-#else
-ReturnToPEIMain::
- cmp.eq p6,p7 = r8,r0;;
- //
- // dead loop if the PAL call failed, we have the CAR on but the stack is now pointing to memory
- //
- (p7) br.sptk.few ReturnToPEIMain;;
- //
- // PAL call successed,now the stack are in memory so come into cache mode
- // instead of uncache mode
- //
-
- alloc r11=0,0,0,0;; // Set 0-size frame
- flushrs;;
-
- mov r21 = RSC_KERNEL_DISABLED;; // for rse disable
- mov ar.rsc = r21;; // turn off RSE
-
- dep r6 = 0,r6,63,1 // zero the bit 63
- dep r7 = 0,r7,63,1 // zero the bit 63
- dep r4 = 0,r4,63,1;; // zero the bit 63
- add sp = r0, r7 // transfer to the EFI stack in cache mode
- mov ar.bspstore = r4 // switch to EFI BSP
- invala // change of ar.bspstore needs invala.
-
- mov r19 = RSC_KERNEL_LAZ;; // RSC enabled, Lazy mode
- mov ar.rsc = r19;; // turn rse on, in kernel mode
-
-#endif
-
-DoneCARTermination::
-
- // allocate a stack frame:
- alloc r11=0,2,2,0 ;; // alloc outs going to ensuing DXE IPL service
- // on the new stack
- mov out0 = r5;;
- mov out1 = r6;;
-
- mov r16 = b1;;
- mov b6 = r16;;
- br.call.sptk.few b0=b6;; // Call the continuation function
-
- NESTED_RETURN
-
-PROCEDURE_EXIT(SwitchCoreStacks)
-//-----------------------------------------------------------------------------------
-
-//---------------------------------------------------------------------------------
-//++
-// GetHandOffStatus
-//
-// This routine is called by all processors simultaneously, to get some hand-off
-// status that has been captured by IPF dispatcher and recorded in kernel registers.
-//
-// Arguments :
-//
-// On Entry : None.
-//
-// Return Value: Lid, R20Status.
-//
-//--
-//----------------------------------------------------------------------------------
-PROCEDURE_ENTRY (GetHandOffStatus)
-
- NESTED_SETUP (0,2+0,0,0)
-
- mov r8 = ar.k6 // Health Status (Self test params)
- mov r9 = ar.k4 // LID bits
- mov r10 = ar.k3;; // SAL_E entry state
- mov r11 = ar.k7 // Return address to PAL
-
- NESTED_RETURN
-PROCEDURE_EXIT (GetHandOffStatus)
-//----------------------------------------------------------------------------------
-
-
diff --git a/EdkModulePkg/Core/Pei/Ipf/IpfPeiMain.h b/EdkModulePkg/Core/Pei/Ipf/IpfPeiMain.h
deleted file mode 100644
index e2df073..0000000
--- a/EdkModulePkg/Core/Pei/Ipf/IpfPeiMain.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- IpfPeiMain.h
-
-Abstract:
-
- Definition of IPF specific function
-
-Revision History
-
---*/
-
-#ifndef _IPF_PEI_MAIN_H_
-#define _IPF_PEI_MAIN_H_
-
-#include <PeiMain.h>
-
-SAL_RETURN_REGS
-GetHandOffStatus (
- VOID
- )
-/*++
-
-Routine Description:
-
- This routine is called by all processors simultaneously, to get some hand-off
- status that has been captured by IPF dispatcher and recorded in kernel registers.
-
-Arguments :
-
- On Entry : None.
-
-Returns:
-
- Lid, R20Status.
-
---*/
-
-;
-
-#endif
diff --git a/EdkModulePkg/Core/Pei/Ipf/Stack.c b/EdkModulePkg/Core/Pei/Ipf/Stack.c
deleted file mode 100644
index 56a876d..0000000
--- a/EdkModulePkg/Core/Pei/Ipf/Stack.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/** @file
- PeiSwitchStacks() function for PEI dispatcher.
-
- Copyright (c) 2006 - 2007, Intel Corporation<BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: String.c
-
-**/
-
-#include <PeiMain.h>
-
-/**
- Transfers control to a function starting with a new stack.
-
- Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
-
- If EntryPoint is NULL, then ASSERT().
- If NewStack is NULL, then ASSERT().
-
- @param EntryPoint A pointer to function to call with the new stack.
- @param Context1 A pointer to the context to pass into the EntryPoint
- function.
- @param Context2 A pointer to the context to pass into the EntryPoint
- function.
- @param NewStack A pointer to the new stack to use for the EntryPoint
- function.
- @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
- Reserved on other architectures.
-
-**/
-VOID
-EFIAPI
-PeiSwitchStacks (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack,
- IN VOID *NewBsp
- )
-{
- SwitchStack (
- EntryPoint,
- Context1,
- Context2,
- NewStack,
- NewBsp
- );
-}
diff --git a/EdkModulePkg/Core/Pei/Ipf/SwitchToCacheMode.c b/EdkModulePkg/Core/Pei/Ipf/SwitchToCacheMode.c
deleted file mode 100644
index db9cb52..0000000
--- a/EdkModulePkg/Core/Pei/Ipf/SwitchToCacheMode.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- SwitchToCacheMode.c
-
-Abstract:
-
- Ipf CAR specific function used to switch to cache mode for the later memory access
-
-Revision History
-
---*/
-
-#include "IpfPeiMain.h"
-#include "IpfCpuCore.i"
-
-VOID
-SwitchToCacheMode (
- IN PEI_CORE_INSTANCE *CoreData
- )
-/*++
-
-Routine Description:
-
- Switch the PHIT pointers to cache mode after InstallPeiMemory in CAR.
-
-Arguments:
-
- CoreData - The PEI core Private Data
-
-Returns:
-
---*/
-{
- EFI_HOB_HANDOFF_INFO_TABLE *Phit;
-
- if (CoreData == NULL) {
- //
- // the first call with CoreData as NULL.
- //
- return;
- }
-
- if ((GetHandOffStatus().r10 & 0xFF) == RecoveryFn) {
- CoreData->StackBase = CoreData->StackBase & CACHE_MODE_ADDRESS_MASK;
- CoreData->HobList.Raw = (UINT8 *)((UINTN)CoreData->HobList.Raw & CACHE_MODE_ADDRESS_MASK);
-
- //
- // Change the PHIT pointer value to cache mode
- //
- Phit = CoreData->HobList.HandoffInformationTable;
-
- Phit->EfiMemoryTop = Phit->EfiMemoryTop & CACHE_MODE_ADDRESS_MASK;
- Phit->EfiFreeMemoryTop = Phit->EfiFreeMemoryTop & CACHE_MODE_ADDRESS_MASK;
- Phit->EfiMemoryBottom = Phit->EfiMemoryBottom & CACHE_MODE_ADDRESS_MASK;
- Phit->EfiFreeMemoryBottom = Phit->EfiFreeMemoryBottom & CACHE_MODE_ADDRESS_MASK;
- Phit->EfiEndOfHobList = Phit->EfiEndOfHobList & CACHE_MODE_ADDRESS_MASK;
- }
-
- return;
-}
diff --git a/EdkModulePkg/Core/Pei/Memory/MemoryServices.c b/EdkModulePkg/Core/Pei/Memory/MemoryServices.c
deleted file mode 100644
index 88046c7..0000000
--- a/EdkModulePkg/Core/Pei/Memory/MemoryServices.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MemoryServices.c
-
-Abstract:
-
- EFI PEI Core memory services
-
---*/
-
-#include <PeiMain.h>
-
-VOID
-InitializeMemoryServices (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
- IN PEI_CORE_INSTANCE *OldCoreData
- )
-/*++
-
-Routine Description:
-
- Initialize the memory services.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- PeiStartupDescriptor - Information and services provided by SEC phase.
- OldCoreData - Pointer to the PEI Core data.
- NULL if being run in non-permament memory mode.
-
-Returns:
-
- None
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- UINT64 SizeOfCarHeap;
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
- PrivateData->SwitchStackSignal = FALSE;
-
- if (OldCoreData == NULL) {
-
- PrivateData->PeiMemoryInstalled = FALSE;
-
- PrivateData->BottomOfCarHeap = (VOID *) (((UINTN)(VOID *)(&PrivateData))
- & (~((PeiStartupDescriptor->SizeOfCacheAsRam) - 1)));
- PrivateData->TopOfCarHeap = (VOID *)((UINTN)(PrivateData->BottomOfCarHeap) + PeiStartupDescriptor->SizeOfCacheAsRam);
- //
- // SizeOfCarHeap is 1/2 (arbitrary) of CacheAsRam Size.
- //
- SizeOfCarHeap = (UINT64) PeiStartupDescriptor->SizeOfCacheAsRam;
- SizeOfCarHeap = RShiftU64 (SizeOfCarHeap, 1);
-
- DEBUG_CODE_BEGIN ();
- PrivateData->SizeOfCacheAsRam = PeiStartupDescriptor->SizeOfCacheAsRam;
- PrivateData->MaxTopOfCarHeap = (VOID *) ((UINTN) PrivateData->BottomOfCarHeap + (UINTN) SizeOfCarHeap);
- DEBUG_CODE_END ();
-
- PrivateData->HobList.Raw = PrivateData->BottomOfCarHeap;
-
- PeiCoreBuildHobHandoffInfoTable (
- BOOT_WITH_FULL_CONFIGURATION,
- (EFI_PHYSICAL_ADDRESS) (UINTN) PrivateData->BottomOfCarHeap,
- (UINTN) SizeOfCarHeap
- );
- //
- // Copy PeiServices from ROM to Cache in PrivateData
- //
- CopyMem (&(PrivateData->ServiceTableShadow), *PeiServices, sizeof (EFI_PEI_SERVICES));
-
- //
- // Set PS to point to ServiceTableShadow in Cache
- //
- PrivateData->PS = &(PrivateData->ServiceTableShadow);
- } else {
- //
- // Set PS to point to ServiceTableShadow in Cache one time after the
- // stack switched to main memory
- //
- PrivateData->PS = &(PrivateData->ServiceTableShadow);
-}
-
- return;
-}
-
-EFI_STATUS
-EFIAPI
-PeiInstallPeiMemory (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PHYSICAL_ADDRESS MemoryBegin,
- IN UINT64 MemoryLength
- )
-/*++
-
-Routine Description:
-
- Install the permanent memory is now available.
- Creates HOB (PHIT and Stack).
-
-Arguments:
-
- PeiServices - The PEI core services table.
- MemoryBegin - Start of memory address.
- MemoryLength - Length of memory.
-
-Returns:
-
- Status - EFI_SUCCESS
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- EFI_HOB_HANDOFF_INFO_TABLE *OldHandOffHob;
- EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob;
- UINT64 PeiStackSize;
- UINT64 EfiFreeMemorySize;
- EFI_PHYSICAL_ADDRESS PhysicalAddressOfOldHob;
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
-
- PrivateData->SwitchStackSignal = TRUE;
- PrivateData->PeiMemoryInstalled = TRUE;
-
- PrivateData->StackBase = MemoryBegin;
-
- PeiStackSize = RShiftU64 (MemoryLength, 1);
- if (PEI_STACK_SIZE > PeiStackSize) {
- PrivateData->StackSize = PeiStackSize;
- } else {
- PrivateData->StackSize = PEI_STACK_SIZE;
- }
-
- OldHandOffHob = PrivateData->HobList.HandoffInformationTable;
-
- PrivateData->HobList.Raw = (VOID *)((UINTN)(MemoryBegin + PrivateData->StackSize));
- NewHandOffHob = PrivateData->HobList.HandoffInformationTable;
- PhysicalAddressOfOldHob = (EFI_PHYSICAL_ADDRESS) (UINTN) OldHandOffHob;
-
- EfiFreeMemorySize = OldHandOffHob->EfiFreeMemoryBottom - PhysicalAddressOfOldHob;
-
- DEBUG ((EFI_D_INFO, "HOBLIST address before memory init = 0x%08x\n", OldHandOffHob));
- DEBUG ((EFI_D_INFO, "HOBLIST address after memory init = 0x%08x\n", NewHandOffHob));
-
- CopyMem (
- NewHandOffHob,
- OldHandOffHob,
- (UINTN)EfiFreeMemorySize
- );
-
- NewHandOffHob->EfiMemoryTop = MemoryBegin + MemoryLength;
- NewHandOffHob->EfiFreeMemoryTop = NewHandOffHob->EfiMemoryTop;
- NewHandOffHob->EfiMemoryBottom = MemoryBegin;
-
- NewHandOffHob->EfiFreeMemoryBottom = (UINTN)NewHandOffHob + EfiFreeMemorySize;
-
- NewHandOffHob->EfiEndOfHobList = (UINTN)NewHandOffHob +
- (OldHandOffHob->EfiEndOfHobList -
- PhysicalAddressOfOldHob);
-
- ConvertPpiPointers (PeiServices, OldHandOffHob, NewHandOffHob);
-
- BuildStackHob (PrivateData->StackBase, PrivateData->StackSize);
-
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-PeiAllocatePages (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT EFI_PHYSICAL_ADDRESS *Memory
- )
-/*++
-
-Routine Description:
-
- Memory allocation service on permanent memory,
- not usable prior to the memory installation.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- MemoryType - Type of memory to allocate.
- Pages - Number of pages to allocate.
- Memory - Pointer of memory allocated.
-
-Returns:
-
- Status - EFI_SUCCESS The allocation was successful
- EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
- EFI_NOT_AVAILABLE_YET Called with permanent memory not available
- EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
- to allocate the number of pages.
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- EFI_PEI_HOB_POINTERS Hob;
- EFI_PHYSICAL_ADDRESS Offset;
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
-
- //
- // Check if Hob already available
- //
- if (!PrivateData->PeiMemoryInstalled) {
- return EFI_NOT_AVAILABLE_YET;
- }
-
- Hob.Raw = PrivateData->HobList.Raw;
-
- //
- // Check to see if on 4k boundary
- //
- Offset = Hob.HandoffInformationTable->EfiFreeMemoryTop & 0xFFF;
-
- //
- // If not aligned, make the allocation aligned.
- //
- if (Offset != 0) {
- Hob.HandoffInformationTable->EfiFreeMemoryTop -= Offset;
- }
-
- //
- // Verify that there is sufficient memory to satisfy the allocation
- //
- if (Hob.HandoffInformationTable->EfiFreeMemoryTop - ((Pages * EFI_PAGE_SIZE) + sizeof (EFI_HOB_MEMORY_ALLOCATION)) <
- Hob.HandoffInformationTable->EfiFreeMemoryBottom) {
- DEBUG ((EFI_D_ERROR, "AllocatePages failed: No 0x%x Pages is available.\n", Pages));
- DEBUG ((EFI_D_ERROR, "There is only left 0x%x pages memory resource to be allocated.\n", \
- EFI_SIZE_TO_PAGES ((UINTN) (Hob.HandoffInformationTable->EfiFreeMemoryTop - Hob.HandoffInformationTable->EfiFreeMemoryBottom))));
- return EFI_OUT_OF_RESOURCES;
- } else {
- //
- // Update the PHIT to reflect the memory usage
- //
- Hob.HandoffInformationTable->EfiFreeMemoryTop -= Pages * EFI_PAGE_SIZE;
-
- //
- // Update the value for the caller
- //
- *Memory = Hob.HandoffInformationTable->EfiFreeMemoryTop;
-
- //
- // Create a memory allocation HOB.
- //
- BuildMemoryAllocationHob (
- Hob.HandoffInformationTable->EfiFreeMemoryTop,
- Pages * EFI_PAGE_SIZE + Offset,
- MemoryType
- );
-
- return EFI_SUCCESS;
- }
-}
-
-
-EFI_STATUS
-EFIAPI
-PeiAllocatePool (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINTN Size,
- OUT VOID **Buffer
- )
-/*++
-
-Routine Description:
-
- Memory allocation service on the CAR.
-
-Arguments:
-
- PeiServices - The PEI core services table.
-
- Size - Amount of memory required
-
- Buffer - Address of pointer to the buffer
-
-Returns:
-
- Status - EFI_SUCCESS The allocation was successful
- EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
- to allocate the requested size.
-
---*/
-{
- EFI_STATUS Status;
- EFI_HOB_MEMORY_POOL *Hob;
-
- //
- // If some "post-memory" PEIM wishes to allocate larger pool,
- // it should use AllocatePages service instead.
- //
- ASSERT (Size < 0x10000 - sizeof (EFI_HOB_MEMORY_POOL));
- Status = PeiServicesCreateHob (
- EFI_HOB_TYPE_PEI_MEMORY_POOL,
- (UINT16)(sizeof (EFI_HOB_MEMORY_POOL) + Size),
- (VOID **)&Hob
- );
- *Buffer = Hob+1;
-
-
- return Status;
-}
diff --git a/EdkModulePkg/Core/Pei/PeiMain.h b/EdkModulePkg/Core/Pei/PeiMain.h
deleted file mode 100644
index 82121ac..0000000
--- a/EdkModulePkg/Core/Pei/PeiMain.h
+++ /dev/null
@@ -1,1142 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PeiMain.h
-
-Abstract:
-
- Definition of Pei Core Structures and Services
-
-Revision History
-
---*/
-
-#ifndef _PEI_MAIN_H_
-#define _PEI_MAIN_H_
-
-extern EFI_GUID gEfiPeiCorePrivateGuid;
-
-//
-// Pei Core private data structures
-//
-typedef union {
- EFI_PEI_PPI_DESCRIPTOR *Ppi;
- EFI_PEI_NOTIFY_DESCRIPTOR *Notify;
- VOID *Raw;
-} PEI_PPI_LIST_POINTERS;
-
-#define PEI_STACK_SIZE 0x20000
-
-#define MAX_PPI_DESCRIPTORS 64
-
-typedef struct {
- INTN PpiListEnd;
- INTN NotifyListEnd;
- INTN DispatchListEnd;
- INTN LastDispatchedInstall;
- INTN LastDispatchedNotify;
- PEI_PPI_LIST_POINTERS PpiListPtrs[MAX_PPI_DESCRIPTORS];
-} PEI_PPI_DATABASE;
-
-typedef struct {
- UINT8 CurrentPeim;
- UINT8 CurrentFv;
- UINT32 DispatchedPeimBitMap;
- UINT32 PreviousPeimBitMap;
- EFI_FFS_FILE_HEADER *CurrentPeimAddress;
- EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress;
- EFI_FIRMWARE_VOLUME_HEADER *BootFvAddress;
- EFI_PEI_FIND_FV_PPI *FindFv;
-} PEI_CORE_DISPATCH_DATA;
-
-
-//
-// Pei Core private data structure instance
-//
-
-#define PEI_CORE_HANDLE_SIGNATURE EFI_SIGNATURE_32('P','e','i','C')
-
-typedef struct{
- UINTN Signature;
- EFI_PEI_SERVICES *PS; // Point to ServiceTableShadow
- PEI_PPI_DATABASE PpiData;
- PEI_CORE_DISPATCH_DATA DispatchData;
- EFI_PEI_HOB_POINTERS HobList;
- BOOLEAN SwitchStackSignal;
- BOOLEAN PeiMemoryInstalled;
- EFI_PHYSICAL_ADDRESS StackBase;
- UINT64 StackSize;
- VOID *BottomOfCarHeap;
- VOID *TopOfCarHeap;
- VOID *CpuIo;
- EFI_PEI_SECURITY_PPI *PrivateSecurityPpi;
- EFI_PEI_SERVICES ServiceTableShadow;
- UINTN SizeOfCacheAsRam;
- VOID *MaxTopOfCarHeap;
-} PEI_CORE_INSTANCE;
-
-//
-// Pei Core Instance Data Macros
-//
-
-#define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
- CR(a, PEI_CORE_INSTANCE, PS, PEI_CORE_HANDLE_SIGNATURE)
-
-//
-// BUGBUG: Where does this go really?
-//
-typedef
-EFI_STATUS
-(EFIAPI *PEI_CORE_ENTRY_POINT)(
- IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
- IN PEI_CORE_INSTANCE *OldCoreData
- );
-
-//
-// Union of temporarily used function pointers (to save stack space)
-//
-typedef union {
- PEI_CORE_ENTRY_POINT PeiCore;
- EFI_PEIM_ENTRY_POINT PeimEntry;
- EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;
- EFI_DXE_IPL_PPI *DxeIpl;
- EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
- EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;
- VOID *Raw;
-} PEI_CORE_TEMP_POINTERS;
-
-
-//
-// PeiCore function
-//
-EFI_STATUS
-EFIAPI
-PeiCore (
- IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
- IN VOID *Data
- )
-/*++
-
-Routine Description:
-
- The entry routine to Pei Core, invoked by PeiMain during transition
- from SEC to PEI. After switching stack in the PEI core, it will restart
- with the old core data.
-
-Arguments:
-
- PeiStartupDescriptor - Information and services provided by SEC phase.
- OldCoreData - Pointer to old core data that is used to initialize the
- core's data areas.
-
-Returns:
-
- This function never returns
- EFI_NOT_FOUND - Never reach
-
---*/
-;
-
-//
-// Dispatcher support functions
-//
-
-EFI_STATUS
-PeimDispatchReadiness (
- IN EFI_PEI_SERVICES **PeiServices,
- IN VOID *DependencyExpression,
- IN OUT BOOLEAN *Runnable
- )
-/*++
-
-Routine Description:
-
- This is the POSTFIX version of the dependency evaluator. When a
- PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
- the evaluation stack. When that entry is poped from the evaluation
- stack, the PPI is checked if it is installed. This method allows
- some time savings as not all PPIs must be checked for certain
- operation types (AND, OR).
-
-Arguments:
-
- PeiServices - Calling context.
-
- DependencyExpression - Pointer to a dependency expression. The Grammar adheres to
- the BNF described above and is stored in postfix notation.
- Runnable - is True if the driver can be scheduled and False if the driver
- cannot be scheduled. This is the value that the schedulers
- should use for deciding the state of the driver.
-
-Returns:
-
- Status = EFI_SUCCESS if it is a well-formed Grammar
- EFI_INVALID_PARAMETER if the dependency expression overflows
- the evaluation stack
- EFI_INVALID_PARAMETER if the dependency expression underflows
- the evaluation stack
- EFI_INVALID_PARAMETER if the dependency expression is not a
- well-formed Grammar.
---*/
-;
-
-
-EFI_STATUS
-PeiDispatcher (
- IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
- IN PEI_CORE_INSTANCE *PrivateData,
- IN PEI_CORE_DISPATCH_DATA *DispatchData
- )
-
-/*++
-
-Routine Description:
-
- Conduct PEIM dispatch.
-
-Arguments:
-
- PeiStartupDescriptor - Pointer to IN EFI_PEI_STARTUP_DESCRIPTOR
- PrivateData - Pointer to the private data passed in from caller
- DispatchData - Pointer to PEI_CORE_DISPATCH_DATA data.
-
-Returns:
-
- EFI_SUCCESS - Successfully dispatched PEIM.
- EFI_NOT_FOUND - The dispatch failed.
-
---*/
-;
-
-
-VOID
-InitializeDispatcherData (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_CORE_INSTANCE *OldCoreData,
- IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor
- )
-/*++
-
-Routine Description:
-
- Initialize the Dispatcher's data members
-
-Arguments:
-
- PeiServices - The PEI core services table.
- OldCoreData - Pointer to old core data (before switching stack).
- NULL if being run in non-permament memory mode.
- PeiStartupDescriptor - Information and services provided by SEC phase.
-
-
-Returns:
-
- None
-
---*/
-;
-
-
-EFI_STATUS
-FindNextPeim (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- IN OUT EFI_FFS_FILE_HEADER **PeimFileHeader
- )
-/*++
-
-Routine Description:
- Given the input file pointer, search for the next matching file in the
- FFS volume. The search starts from FileHeader inside
- the Firmware Volume defined by FwVolHeader.
-
-Arguments:
- PeiServices - Pointer to the PEI Core Services Table.
-
- FwVolHeader - Pointer to the FV header of the volume to search.
- This parameter must point to a valid FFS volume.
-
- PeimFileHeader - Pointer to the current file from which to begin searching.
- This pointer will be updated upon return to reflect the file found.
-
-Returns:
- EFI_NOT_FOUND - No files matching the search criteria were found
- EFI_SUCCESS
-
---*/
-;
-
-BOOLEAN
-Dispatched (
- IN UINT8 CurrentPeim,
- IN UINT32 DispatchedPeimBitMap
- )
-/*++
-
-Routine Description:
-
- This routine checks to see if a particular PEIM has been dispatched during
- the PEI core dispatch.
-
-Arguments:
- CurrentPeim - The PEIM/FV in the bit array to check.
- DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
-
-Returns:
- TRUE if PEIM already dispatched
- FALSE if not
-
---*/
-;
-
-VOID
-SetDispatched (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINT8 CurrentPeim,
- OUT UINT32 *DispatchedPeimBitMap
- )
-/*++
-
-Routine Description:
-
- This routine sets a PEIM as having been dispatched once its entry
- point has been invoked.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- CurrentPeim - The PEIM/FV in the bit array to check.
- DispatchedPeimBitMap - Bit array, each bit corresponds to a PEIM/FV.
-
-Returns:
- None
-
---*/
-;
-
-BOOLEAN
-DepexSatisfied (
- IN EFI_PEI_SERVICES **PeiServices,
- IN VOID *CurrentPeimAddress
- )
-/*++
-
-Routine Description:
-
- This routine parses the Dependency Expression, if available, and
- decides if the module can be executed.
-
-Arguments:
- PeiServices - The PEI Service Table
- CurrentPeimAddress - Address of the PEIM Firmware File under investigation
-
-Returns:
- TRUE - Can be dispatched
- FALSE - Cannot be dispatched
-
---*/
-;
-
-#if defined (MDE_CPU_IPF)
- //
- // In Ipf we should make special changes for the PHIT pointers to support
- // recovery boot in cache mode.
- //
-#define SWITCH_TO_CACHE_MODE(CoreData) SwitchToCacheMode(CoreData)
-#define CACHE_MODE_ADDRESS_MASK 0x7FFFFFFFFFFFFFFFULL
-VOID
-SwitchToCacheMode (
- IN PEI_CORE_INSTANCE *CoreData
-)
-/*++
-
-Routine Description:
-
- Switch the PHIT pointers to cache mode after InstallPeiMemory in CAR.
-
-Arguments:
-
- CoreData - The PEI core Private Data
-
-Returns:
-
---*/
-;
-
-#else
-
-#define SWITCH_TO_CACHE_MODE(CoreData)
-
-#endif
-
-//
-// PPI support functions
-//
-VOID
-InitializePpiServices (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_CORE_INSTANCE *OldCoreData
- )
-/*++
-
-Routine Description:
-
- Initialize PPI services.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- OldCoreData - Pointer to the PEI Core data.
- NULL if being run in non-permament memory mode.
-
-Returns:
- Nothing
-
---*/
-;
-
-VOID
-ConvertPpiPointers (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_HOB_HANDOFF_INFO_TABLE *OldHandOffHob,
- IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob
- )
-/*++
-
-Routine Description:
-
- Migrate the Hob list from the CAR stack to PEI installed memory.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- OldHandOffHob - The old handoff HOB list.
- NewHandOffHob - The new handoff HOB list.
-
-Returns:
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiInstallPpi (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PPI_DESCRIPTOR *PpiList
- )
-/*++
-
-Routine Description:
-
- Install PPI services.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
- PpiList - Pointer to a list of PEI PPI Descriptors.
-
-Returns:
-
- EFI_SUCCESS - if all PPIs in PpiList are successfully installed.
- EFI_INVALID_PARAMETER - if PpiList is NULL pointer
- EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid
- EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiReInstallPpi (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,
- IN EFI_PEI_PPI_DESCRIPTOR *NewPpi
- )
-/*++
-
-Routine Description:
-
- Re-Install PPI services.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
- OldPpi - Pointer to the old PEI PPI Descriptors.
- NewPpi - Pointer to the new PEI PPI Descriptors.
-
-Returns:
-
- EFI_SUCCESS - if the operation was successful
- EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL
- EFI_INVALID_PARAMETER - if NewPpi is not valid
- EFI_NOT_FOUND - if the PPI was not in the database
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiLocatePpi (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_GUID *Guid,
- IN UINTN Instance,
- IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
- IN OUT VOID **Ppi
- )
-/*++
-
-Routine Description:
-
- Locate a given named PPI.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
- Guid - Pointer to GUID of the PPI.
- Instance - Instance Number to discover.
- PpiDescriptor - Pointer to reference the found descriptor. If not NULL,
- returns a pointer to the descriptor (includes flags, etc)
- Ppi - Pointer to reference the found PPI
-
-Returns:
-
- Status - EFI_SUCCESS if the PPI is in the database
- EFI_NOT_FOUND if the PPI is not in the database
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiNotifyPpi (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
- )
-/*++
-
-Routine Description:
-
- Install a notification for a given PPI.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
- NotifyList - Pointer to list of Descriptors to notify upon.
-
-Returns:
-
- Status - EFI_SUCCESS if successful
- EFI_OUT_OF_RESOURCES if no space in the database
- EFI_INVALID_PARAMETER if not a good decriptor
-
---*/
-;
-
-VOID
-ProcessNotifyList (
- IN EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- Process the Notify List at dispatch level.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
-
-Returns:
-
---*/
-;
-
-VOID
-DispatchNotify (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINTN NotifyType,
- IN INTN InstallStartIndex,
- IN INTN InstallStopIndex,
- IN INTN NotifyStartIndex,
- IN INTN NotifyStopIndex
- )
-/*++
-
-Routine Description:
-
- Dispatch notifications.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
- NotifyType - Type of notify to fire.
- InstallStartIndex - Install Beginning index.
- InstallStopIndex - Install Ending index.
- NotifyStartIndex - Notify Beginning index.
- NotifyStopIndex - Notify Ending index.
-
-Returns: None
-
---*/
-;
-
-//
-// Boot mode support functions
-//
-EFI_STATUS
-EFIAPI
-PeiGetBootMode (
- IN EFI_PEI_SERVICES **PeiServices,
- IN OUT EFI_BOOT_MODE *BootMode
- )
-/*++
-
-Routine Description:
-
- This service enables PEIMs to ascertain the present value of the boot mode.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- BootMode - A pointer to contain the value of the boot mode.
-
-Returns:
-
- EFI_SUCCESS - The boot mode was returned successfully.
- EFI_INVALID_PARAMETER - BootMode is NULL.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiSetBootMode (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_BOOT_MODE BootMode
- )
-/*++
-
-Routine Description:
-
- This service enables PEIMs to update the boot mode variable.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- BootMode - The value of the boot mode to set.
-
-Returns:
-
- EFI_SUCCESS - The value was successfully updated
-
---*/
-;
-
-//
-// Security support functions
-//
-VOID
-InitializeSecurityServices (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_CORE_INSTANCE *OldCoreData
- )
-/*++
-
-Routine Description:
-
- Initialize the security services.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- OldCoreData - Pointer to the old core data.
- NULL if being run in non-permament memory mode.
-Returns:
-
- None
-
---*/
-;
-
-EFI_STATUS
-VerifyFv (
- IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress
- )
-/*++
-
-Routine Description:
-
- Provide a callout to the OEM FV verification service.
-
-Arguments:
-
- CurrentFvAddress - Pointer to the FV under investigation.
-
-Returns:
-
- Status - EFI_SUCCESS
-
---*/
-;
-
-
-EFI_STATUS
-VerifyPeim (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_FFS_FILE_HEADER *CurrentPeimAddress
- )
-/*++
-
-Routine Description:
-
- Provide a callout to the security verification service.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- CurrentPeimAddress - Pointer to the Firmware File under investigation.
-
-Returns:
-
- EFI_SUCCESS - Image is OK
- EFI_SECURITY_VIOLATION - Image is illegal
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiGetHobList (
- IN EFI_PEI_SERVICES **PeiServices,
- IN OUT VOID **HobList
- )
-/*++
-
-Routine Description:
-
- Gets the pointer to the HOB List.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- HobList - Pointer to the HOB List.
-
-Returns:
-
- EFI_SUCCESS - Get the pointer of HOB List
- EFI_NOT_AVAILABLE_YET - the HOB List is not yet published
- EFI_INVALID_PARAMETER - HobList is NULL (in debug mode)
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiCreateHob (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINT16 Type,
- IN UINT16 Length,
- IN OUT VOID **Hob
- )
-/*++
-
-Routine Description:
-
- Add a new HOB to the HOB List.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- Type - Type of the new HOB.
- Length - Length of the new HOB to allocate.
- Hob - Pointer to the new HOB.
-
-Returns:
-
- Status - EFI_SUCCESS
- - EFI_INVALID_PARAMETER if Hob is NULL
- - EFI_NOT_AVAILABLE_YET if HobList is still not available.
- - EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
-
---*/
-;
-
-EFI_STATUS
-PeiCoreBuildHobHandoffInfoTable (
- IN EFI_BOOT_MODE BootMode,
- IN EFI_PHYSICAL_ADDRESS MemoryBegin,
- IN UINT64 MemoryLength
- )
-/*++
-
-Routine Description:
-
- Builds a Handoff Information Table HOB
-
-Arguments:
-
- BootMode - Current Bootmode
- MemoryBegin - Start Memory Address.
- MemoryLength - Length of Memory.
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-
-//
-// FFS Fw Volume support functions
-//
-EFI_STATUS
-EFIAPI
-PeiFfsFindNextFile (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINT8 SearchType,
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- IN OUT EFI_FFS_FILE_HEADER **FileHeader
- )
-/*++
-
-Routine Description:
- Given the input file pointer, search for the next matching file in the
- FFS volume as defined by SearchType. The search starts from FileHeader inside
- the Firmware Volume defined by FwVolHeader.
-
-Arguments:
- PeiServices - Pointer to the PEI Core Services Table.
-
- SearchType - Filter to find only files of this type.
- Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
-
- FwVolHeader - Pointer to the FV header of the volume to search.
- This parameter must point to a valid FFS volume.
-
- FileHeader - Pointer to the current file from which to begin searching.
- This pointer will be updated upon return to reflect the file found.
-
-Returns:
- EFI_NOT_FOUND - No files matching the search criteria were found
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiFfsFindSectionData (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_SECTION_TYPE SectionType,
- IN EFI_FFS_FILE_HEADER *FfsFileHeader,
- IN OUT VOID **SectionData
- )
-/*++
-
-Routine Description:
- Given the input file pointer, search for the next matching section in the
- FFS volume.
-
-Arguments:
- PeiServices - Pointer to the PEI Core Services Table.
- SearchType - Filter to find only sections of this type.
- FfsFileHeader - Pointer to the current file to search.
- SectionData - Pointer to the Section matching SectionType in FfsFileHeader.
- - NULL if section not found
-
-Returns:
- EFI_NOT_FOUND - No files matching the search criteria were found
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiFvFindNextVolume (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINTN Instance,
- IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
- )
-/*++
-
-Routine Description:
-
- Return the BFV location
-
- BugBug -- Move this to the location of this code to where the
- other FV and FFS support code lives.
- Also, update to use FindFV for instances #'s >= 1.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- Instance - Instance of FV to find
- FwVolHeader - Pointer to contain the data to return
-
-Returns:
- Pointer to the Firmware Volume instance requested
-
- EFI_INVALID_PARAMETER - FwVolHeader is NULL
-
- EFI_SUCCESS - Firmware volume instance successfully found.
-
---*/
-;
-
-//
-// Memory support functions
-//
-VOID
-InitializeMemoryServices (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
- IN PEI_CORE_INSTANCE *OldCoreData
- )
-/*++
-
-Routine Description:
-
- Initialize the memory services.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- PeiStartupDescriptor - Information and services provided by SEC phase.
- OldCoreData - Pointer to the PEI Core data.
- NULL if being run in non-permament memory mode.
-
-Returns:
-
- None
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiInstallPeiMemory (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PHYSICAL_ADDRESS MemoryBegin,
- IN UINT64 MemoryLength
- )
-/*++
-
-Routine Description:
-
- Install the permanent memory is now available.
- Creates HOB (PHIT and Stack).
-
-Arguments:
-
- PeiServices - The PEI core services table.
- MemoryBegin - Start of memory address.
- MemoryLength - Length of memory.
-
-Returns:
-
- Status - EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiAllocatePages (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT EFI_PHYSICAL_ADDRESS *Memory
- )
-/*++
-
-Routine Description:
-
- Memory allocation service on permanent memory,
- not usable prior to the memory installation.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- Type - Type of allocation.
- MemoryType - Type of memory to allocate.
- Pages - Number of pages to allocate.
- Memory - Pointer of memory allocated.
-
-Returns:
-
- Status - EFI_SUCCESS The allocation was successful
- EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
- EFI_NOT_AVAILABLE_YET Called with permanent memory not available
- EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
- to allocate the number of pages.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiAllocatePool (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINTN Size,
- OUT VOID **Buffer
- )
-/*++
-
-Routine Description:
-
- Memory allocation service on the CAR.
-
-Arguments:
-
- PeiServices - The PEI core services table.
-
- Size - Amount of memory required
-
- Buffer - Address of pointer to the buffer
-
-Returns:
-
- Status - EFI_SUCCESS The allocation was successful
- EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
- to allocate the requested size.
-
---*/
-;
-
-EFI_STATUS
-PeiLoadImage (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_FFS_FILE_HEADER *PeimFileHeader,
- OUT VOID **EntryPoint
- )
-/*++
-
-Routine Description:
-
- Get entry point of a Peim file.
-
-Arguments:
-
- PeiServices - Calling context.
-
- PeimFileHeader - Peim file's header.
-
- EntryPoint - Entry point of that Peim file.
-
-Returns:
-
- Status code.
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiReportStatusCode (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Core version of the Status Code reporter
-
-Arguments:
-
- PeiServices - The PEI core services table.
-
- CodeType - Type of Status Code.
-
- Value - Value to output for Status Code.
-
- Instance - Instance Number of this status code.
-
- CallerId - ID of the caller of this status code.
-
- Data - Optional data associated with this status code.
-
-Returns:
-
- Status - EFI_SUCCESS if status code is successfully reported
- - EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
-
---*/
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiResetSystem (
- IN EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- Core version of the Reset System
-
-Arguments:
-
- PeiServices - The PEI core services table.
-
-Returns:
-
- Status - EFI_NOT_AVAILABLE_YET. PPI not available yet.
- - EFI_DEVICE_ERROR. Did not reset system.
-
- Otherwise, resets the system.
-
---*/
-;
-
-/**
- Transfers control to a function starting with a new stack.
-
- Transfers control to the function specified by EntryPoint using the new stack
- specified by NewStack and passing in the parameters specified by Context1 and
- Context2. Context1 and Context2 are optional and may be NULL. The function
- EntryPoint must never return.
-
- If EntryPoint is NULL, then ASSERT().
- If NewStack is NULL, then ASSERT().
-
- @param EntryPoint A pointer to function to call with the new stack.
- @param Context1 A pointer to the context to pass into the EntryPoint
- function.
- @param Context2 A pointer to the context to pass into the EntryPoint
- function.
- @param NewStack A pointer to the new stack to use for the EntryPoint
- function.
- @param NewBsp A pointer to the new BSP for the EntryPoint on IPF. It's
- Reserved on other architectures.
-
-**/
-VOID
-EFIAPI
-PeiSwitchStacks (
- IN SWITCH_STACK_ENTRY_POINT EntryPoint,
- IN VOID *Context1, OPTIONAL
- IN VOID *Context2, OPTIONAL
- IN VOID *NewStack,
- IN VOID *NewBsp
- );
-
-#endif
diff --git a/EdkModulePkg/Core/Pei/PeiMain.msa b/EdkModulePkg/Core/Pei/PeiMain.msa
deleted file mode 100644
index b8873a8..0000000
--- a/EdkModulePkg/Core/Pei/PeiMain.msa
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>PeiMain</ModuleName>
- <ModuleType>PEI_CORE</ModuleType>
- <GuidValue>52C05B14-0B98-496c-BC3B-04B50211D680</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for PeiMain module</Abstract>
- <Description>This module provide an DXE CIS compliant implementation.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>PeiMain</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeiCoreEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeiServicesLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeCoffGetEntryPointLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>TimerLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>PeiMain.h</Filename>
- <Filename>BootMode/BootMode.c</Filename>
- <Filename>Dependency/dependency.h</Filename>
- <Filename>Dependency/dependency.c</Filename>
- <Filename>Dispatcher/Dispatcher.c</Filename>
- <Filename>FwVol/FwVol.c</Filename>
- <Filename>Hob/Hob.c</Filename>
- <Filename>Image/Image.c</Filename>
- <Filename>Memory/MemoryServices.c</Filename>
- <Filename>PeiMain/PeiMain.c</Filename>
- <Filename>Ppi/Ppi.c</Filename>
- <Filename>Reset/Reset.c</Filename>
- <Filename>Security/Security.c</Filename>
- <Filename>StatusCode/StatusCode.c</Filename>
- <Filename SupArchList="IPF">Ipf/SwitchToCacheMode.c</Filename>
- <Filename SupArchList="IPF">Ipf/IpfCpuCore.i</Filename>
- <Filename SupArchList="IPF">Ipf/IpfCpuCore.s</Filename>
- <Filename SupArchList="IPF">Ipf/IpfPeiMain.h</Filename>
- <Filename SupArchList="IPF">Ipf/Stack.c</Filename>
- <Filename SupArchList="IA32 X64 EBC">Dispatcher/Stack.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <PPIs>
- <Ppi Usage="ALWAYS_PRODUCED">
- <PpiCName>gEfiPeiMemoryDiscoveredPpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="ALWAYS_CONSUMED">
- <PpiCName>gEfiFindFvPpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="ALWAYS_CONSUMED">
- <PpiCName>gEfiPeiFvFileLoaderPpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="ALWAYS_CONSUMED">
- <PpiCName>gEfiDxeIplPpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="SOMETIMES_CONSUMED">
- <PpiCName>gEfiPeiResetPpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="SOMETIMES_CONSUMED">
- <PpiCName>gEfiPeiStatusCodePpiGuid</PpiCName>
- </Ppi>
- <PpiNotify Usage="SOMETIMES_CONSUMED">
- <PpiNotifyCName>gEfiPeiSecurityPpiGuid</PpiNotifyCName>
- </PpiNotify>
- </PPIs>
- <Guids>
- <GuidCNames Usage="PRIVATE">
- <GuidCName>gEfiPeiCorePrivateGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>PeiCore</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Core/Pei/PeiMain/PeiMain.c b/EdkModulePkg/Core/Pei/PeiMain/PeiMain.c
deleted file mode 100644
index 5d439f7..0000000
--- a/EdkModulePkg/Core/Pei/PeiMain/PeiMain.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PeiMain.c
-
-Abstract:
-
- Pei Core Main Entry Point
-
-Revision History
-
---*/
-
-#include <PeiMain.h>
-
-//
-//CAR is filled with this initial value during SEC phase
-//
-#define INIT_CAR_VALUE 0x5AA55AA5
-
-static EFI_PEI_PPI_DESCRIPTOR mMemoryDiscoveredPpi = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPeiMemoryDiscoveredPpiGuid,
- NULL
-};
-
-//
-// Pei Core Module Variables
-//
-//
-static EFI_PEI_SERVICES mPS = {
- {
- PEI_SERVICES_SIGNATURE,
- PEI_SERVICES_REVISION,
- sizeof (EFI_PEI_SERVICES),
- 0,
- 0
- },
- PeiInstallPpi,
- PeiReInstallPpi,
- PeiLocatePpi,
- PeiNotifyPpi,
-
- PeiGetBootMode,
- PeiSetBootMode,
-
- PeiGetHobList,
- PeiCreateHob,
-
- PeiFvFindNextVolume,
- PeiFfsFindNextFile,
- PeiFfsFindSectionData,
-
- PeiInstallPeiMemory,
- PeiAllocatePages,
- PeiAllocatePool,
- (EFI_PEI_COPY_MEM)CopyMem,
- (EFI_PEI_SET_MEM)SetMem,
-
- PeiReportStatusCode,
-
- PeiResetSystem
-};
-
-EFI_STATUS
-EFIAPI
-PeiCore (
- IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,
- IN VOID *Data
- )
-/*++
-
-Routine Description:
-
- The entry routine to Pei Core, invoked by PeiMain during transition
- from SEC to PEI. After switching stack in the PEI core, it will restart
- with the old core data.
-
-Arguments:
-
- PeiStartupDescriptor - Information and services provided by SEC phase.
- OldCoreData - Pointer to old core data that is used to initialize the
- core's data areas.
-
-Returns:
-
- This function never returns
- EFI_NOT_FOUND - Never reach
-
---*/
-{
- PEI_CORE_INSTANCE PrivateData;
- EFI_STATUS Status;
- PEI_CORE_TEMP_POINTERS TempPtr;
- PEI_CORE_DISPATCH_DATA *DispatchData;
- UINT64 mTick;
- PEI_CORE_INSTANCE *OldCoreData;
-
- mTick = 0;
- OldCoreData = (PEI_CORE_INSTANCE *) Data;
-
- if (PerformanceMeasurementEnabled()) {
- if (OldCoreData == NULL) {
- mTick = GetPerformanceCounter ();
- }
- }
-
- //
- // For IPF in CAR mode the real memory access is uncached,in InstallPeiMemory()
- // the 63-bit of address is set to 1.
- //
- SWITCH_TO_CACHE_MODE (OldCoreData);
-
- if (OldCoreData != NULL) {
- CopyMem (&PrivateData, OldCoreData, sizeof (PEI_CORE_INSTANCE));
- } else {
- ZeroMem (&PrivateData, sizeof (PEI_CORE_INSTANCE));
- }
-
- PrivateData.Signature = PEI_CORE_HANDLE_SIGNATURE;
- PrivateData.PS = &mPS;
-
- //
- // Initialize libraries that the PeiCore is linked against
- // BUGBUG: The FfsHeader is passed in as NULL. Do we look it up or remove it from the lib init?
- //
- ProcessLibraryConstructorList (NULL, &PrivateData.PS);
-
- InitializeMemoryServices (&PrivateData.PS, PeiStartupDescriptor, OldCoreData);
-
- InitializePpiServices (&PrivateData.PS, OldCoreData);
-
- InitializeSecurityServices (&PrivateData.PS, OldCoreData);
-
- InitializeDispatcherData (&PrivateData.PS, OldCoreData, PeiStartupDescriptor);
-
- if (OldCoreData != NULL) {
-
- PERF_END (NULL,"PreMem", NULL, 0);
- PERF_START (NULL,"PostMem", NULL, 0);
-
- //
- // The following code dumps out interesting cache as RAM usage information
- // so we can keep tabs on how the cache as RAM is being utilized. The
- // DEBUG_CODE_BEGIN macro is used to prevent this code from being compiled
- // on a debug build.
- //
- DEBUG_CODE_BEGIN ();
- UINTN *StackPointer;
- UINTN StackValue;
-
- StackValue = INIT_CAR_VALUE;
- for (StackPointer = (UINTN *) OldCoreData->MaxTopOfCarHeap;
- ((UINTN) StackPointer < ((UINTN) OldCoreData->BottomOfCarHeap + OldCoreData->SizeOfCacheAsRam))
- && StackValue == INIT_CAR_VALUE;
- StackPointer++) {
- StackValue = *StackPointer;
- }
-
- DEBUG ((EFI_D_INFO, "Total Cache as RAM: %d bytes.\n", OldCoreData->SizeOfCacheAsRam));
- DEBUG ((EFI_D_INFO, " CAR stack ever used: %d bytes.\n",
- ((UINTN) OldCoreData->TopOfCarHeap - (UINTN) StackPointer)
- ));
- DEBUG ((EFI_D_INFO, " CAR heap used: %d bytes.\n",
- ((UINTN) OldCoreData->HobList.HandoffInformationTable->EfiFreeMemoryBottom -
- (UINTN) OldCoreData->HobList.Raw)
- ));
- DEBUG_CODE_END ();
-
- //
- // Alert any listeners that there is permanent memory available
- //
-
- PERF_START (NULL,"DisMem", NULL, 0);
- Status = PeiServicesInstallPpi (&mMemoryDiscoveredPpi);
- PERF_END (NULL,"DisMem", NULL, 0);
-
- } else {
-
- //
- // Report Status Code EFI_SW_PC_INIT
- //
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- EFI_SOFTWARE_PEI_CORE | EFI_SW_PC_INIT
- );
-
- PERF_START (NULL,"PEI", NULL, mTick);
- //
- // If first pass, start performance measurement.
- //
- PERF_START (NULL,"PreMem", NULL, mTick);
-
- //
- // If SEC provided any PPI services to PEI, install them.
- //
- if (PeiStartupDescriptor->DispatchTable != NULL) {
- Status = PeiServicesInstallPpi (PeiStartupDescriptor->DispatchTable);
- ASSERT_EFI_ERROR (Status);
- }
- }
-
- DispatchData = &PrivateData.DispatchData;
-
- //
- // Call PEIM dispatcher
- //
- PeiDispatcher (PeiStartupDescriptor, &PrivateData, DispatchData);
-
- //
- // Check if InstallPeiMemory service was called.
- //
- ASSERT(PrivateData.PeiMemoryInstalled == TRUE);
-
- PERF_END (NULL, "PostMem", NULL, 0);
-
- Status = PeiServicesLocatePpi (
- &gEfiDxeIplPpiGuid,
- 0,
- NULL,
- (VOID **)&TempPtr.DxeIpl
- );
- ASSERT_EFI_ERROR (Status);
-
- DEBUG ((EFI_D_INFO, "DXE IPL Entry\n"));
- Status = TempPtr.DxeIpl->Entry (
- TempPtr.DxeIpl,
- &PrivateData.PS,
- PrivateData.HobList
- );
-
- ASSERT_EFI_ERROR (Status);
-
- return EFI_NOT_FOUND;
-}
-
diff --git a/EdkModulePkg/Core/Pei/Ppi/Ppi.c b/EdkModulePkg/Core/Pei/Ppi/Ppi.c
deleted file mode 100644
index c8bea85..0000000
--- a/EdkModulePkg/Core/Pei/Ppi/Ppi.c
+++ /dev/null
@@ -1,658 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ppi.c
-
-Abstract:
-
- EFI PEI Core PPI services
-
-Revision History
-
---*/
-
-#include <PeiMain.h>
-
-VOID
-InitializePpiServices (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_CORE_INSTANCE *OldCoreData
- )
-/*++
-
-Routine Description:
-
- Initialize PPI services.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- OldCoreData - Pointer to the PEI Core data.
- NULL if being run in non-permament memory mode.
-
-Returns:
- Nothing
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
-
- if (OldCoreData == NULL) {
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- PrivateData->PpiData.NotifyListEnd = MAX_PPI_DESCRIPTORS-1;
- PrivateData->PpiData.DispatchListEnd = MAX_PPI_DESCRIPTORS-1;
- PrivateData->PpiData.LastDispatchedNotify = MAX_PPI_DESCRIPTORS-1;
- }
-
- return;
-}
-
-VOID
-ConvertPpiPointers (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_HOB_HANDOFF_INFO_TABLE *OldHandOffHob,
- IN EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffHob
- )
-/*++
-
-Routine Description:
-
- Migrate the Hob list from the CAR stack to PEI installed memory.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- OldHandOffHob - The old handoff HOB list.
- NewHandOffHob - The new handoff HOB list.
-
-Returns:
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- UINT8 Index;
- PEI_PPI_LIST_POINTERS *PpiPointer;
- UINTN Fixup;
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- Fixup = (UINTN)NewHandOffHob - (UINTN)OldHandOffHob;
-
- for (Index = 0; Index < MAX_PPI_DESCRIPTORS; Index++) {
- if (Index < PrivateData->PpiData.PpiListEnd ||
- Index > PrivateData->PpiData.NotifyListEnd) {
- PpiPointer = &PrivateData->PpiData.PpiListPtrs[Index];
-
- if (((UINTN)PpiPointer->Raw < (UINTN)OldHandOffHob->EfiFreeMemoryBottom) &&
- ((UINTN)PpiPointer->Raw >= (UINTN)OldHandOffHob)) {
- //
- // Convert the pointer to the PEIM descriptor from the old HOB heap
- // to the relocated HOB heap.
- //
- PpiPointer->Raw = (VOID *) ((UINTN)PpiPointer->Raw + Fixup);
-
- //
- // Only when the PEIM descriptor is in the old HOB should it be necessary
- // to try to convert the pointers in the PEIM descriptor
- //
-
- if (((UINTN)PpiPointer->Ppi->Guid < (UINTN)OldHandOffHob->EfiFreeMemoryBottom) &&
- ((UINTN)PpiPointer->Ppi->Guid >= (UINTN)OldHandOffHob)) {
- //
- // Convert the pointer to the GUID in the PPI or NOTIFY descriptor
- // from the old HOB heap to the relocated HOB heap.
- //
- PpiPointer->Ppi->Guid = (VOID *) ((UINTN)PpiPointer->Ppi->Guid + Fixup);
- }
-
- //
- // Assume that no code is located in the temporary memory, so the pointer to
- // the notification function in the NOTIFY descriptor needs not be converted.
- //
- if (Index < PrivateData->PpiData.PpiListEnd &&
- (UINTN)PpiPointer->Ppi->Ppi < (UINTN)OldHandOffHob->EfiFreeMemoryBottom &&
- (UINTN)PpiPointer->Ppi->Ppi >= (UINTN)OldHandOffHob) {
- //
- // Convert the pointer to the PPI interface structure in the PPI descriptor
- // from the old HOB heap to the relocated HOB heap.
- //
- PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi+ Fixup);
- }
- }
- }
- }
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiInstallPpi (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PPI_DESCRIPTOR *PpiList
- )
-/*++
-
-Routine Description:
-
- Install PPI services.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
- PpiList - Pointer to a list of PEI PPI Descriptors.
-
-Returns:
-
- EFI_SUCCESS - if all PPIs in PpiList are successfully installed.
- EFI_INVALID_PARAMETER - if PpiList is NULL pointer
- EFI_INVALID_PARAMETER - if any PPI in PpiList is not valid
- EFI_OUT_OF_RESOURCES - if there is no more memory resource to install PPI
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- INTN Index;
- INTN LastCallbackInstall;
-
-
- if (PpiList == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- Index = PrivateData->PpiData.PpiListEnd;
- LastCallbackInstall = Index;
-
- //
- // This is loop installs all PPI descriptors in the PpiList. It is terminated
- // by the EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST being set in the last
- // EFI_PEI_PPI_DESCRIPTOR in the list.
- //
-
- for (;;) {
- //
- // Since PpiData is used for NotifyList and InstallList, max resource
- // is reached if the Install reaches the NotifyList
- //
- if (Index == PrivateData->PpiData.NotifyListEnd + 1) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Check if it is a valid PPI.
- // If not, rollback list to exclude all in this list.
- // Try to indicate which item failed.
- //
- if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_PPI) == 0) {
- PrivateData->PpiData.PpiListEnd = LastCallbackInstall;
- DEBUG((EFI_D_ERROR, "ERROR -> InstallPpi: %g %x\n", PpiList->Guid, PpiList->Ppi));
- return EFI_INVALID_PARAMETER;
- }
-
- DEBUG((EFI_D_INFO, "Install PPI: %g\n", PpiList->Guid));
- PrivateData->PpiData.PpiListPtrs[Index].Ppi = PpiList;
- PrivateData->PpiData.PpiListEnd++;
-
- //
- // Continue until the end of the PPI List.
- //
- if ((PpiList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==
- EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
- break;
- }
- PpiList++;
- Index++;
- }
-
- //
- // Dispatch any callback level notifies for newly installed PPIs.
- //
- DispatchNotify (
- PeiServices,
- EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
- LastCallbackInstall,
- PrivateData->PpiData.PpiListEnd,
- PrivateData->PpiData.DispatchListEnd,
- PrivateData->PpiData.NotifyListEnd
- );
-
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-PeiReInstallPpi (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,
- IN EFI_PEI_PPI_DESCRIPTOR *NewPpi
- )
-/*++
-
-Routine Description:
-
- Re-Install PPI services.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
- OldPpi - Pointer to the old PEI PPI Descriptors.
- NewPpi - Pointer to the new PEI PPI Descriptors.
-
-Returns:
-
- EFI_SUCCESS - if the operation was successful
- EFI_INVALID_PARAMETER - if OldPpi or NewPpi is NULL
- EFI_INVALID_PARAMETER - if NewPpi is not valid
- EFI_NOT_FOUND - if the PPI was not in the database
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- INTN Index;
-
-
- if ((OldPpi == NULL) || (NewPpi == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((NewPpi->Flags & EFI_PEI_PPI_DESCRIPTOR_PPI) == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- //
- // Find the old PPI instance in the database. If we can not find it,
- // return the EFI_NOT_FOUND error.
- //
- for (Index = 0; Index < PrivateData->PpiData.PpiListEnd; Index++) {
- if (OldPpi == PrivateData->PpiData.PpiListPtrs[Index].Ppi) {
- break;
- }
- }
- if (Index == PrivateData->PpiData.PpiListEnd) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Remove the old PPI from the database, add the new one.
- //
- DEBUG((EFI_D_INFO, "Reinstall PPI: %g\n", NewPpi->Guid));
- PrivateData->PpiData.PpiListPtrs[Index].Ppi = NewPpi;
-
- //
- // Dispatch any callback level notifies for the newly installed PPI.
- //
- DispatchNotify (
- PeiServices,
- EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
- Index,
- Index+1,
- PrivateData->PpiData.DispatchListEnd,
- PrivateData->PpiData.NotifyListEnd
- );
-
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-PeiLocatePpi (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_GUID *Guid,
- IN UINTN Instance,
- IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
- IN OUT VOID **Ppi
- )
-/*++
-
-Routine Description:
-
- Locate a given named PPI.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
- Guid - Pointer to GUID of the PPI.
- Instance - Instance Number to discover.
- PpiDescriptor - Pointer to reference the found descriptor. If not NULL,
- returns a pointer to the descriptor (includes flags, etc)
- Ppi - Pointer to reference the found PPI
-
-Returns:
-
- Status - EFI_SUCCESS if the PPI is in the database
- EFI_NOT_FOUND if the PPI is not in the database
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- INTN Index;
- EFI_GUID *CheckGuid;
- EFI_PEI_PPI_DESCRIPTOR *TempPtr;
-
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- //
- // Search the data base for the matching instance of the GUIDed PPI.
- //
- for (Index = 0; Index < PrivateData->PpiData.PpiListEnd; Index++) {
- TempPtr = PrivateData->PpiData.PpiListPtrs[Index].Ppi;
- CheckGuid = TempPtr->Guid;
-
- //
- // Don't use CompareGuid function here for performance reasons.
- // Instead we compare the GUID as INT32 at a time and branch
- // on the first failed comparison.
- //
- if ((((INT32 *)Guid)[0] == ((INT32 *)CheckGuid)[0]) &&
- (((INT32 *)Guid)[1] == ((INT32 *)CheckGuid)[1]) &&
- (((INT32 *)Guid)[2] == ((INT32 *)CheckGuid)[2]) &&
- (((INT32 *)Guid)[3] == ((INT32 *)CheckGuid)[3])) {
- if (Instance == 0) {
-
- if (PpiDescriptor != NULL) {
- *PpiDescriptor = TempPtr;
- }
-
- if (Ppi != NULL) {
- *Ppi = TempPtr->Ppi;
- }
-
-
- return EFI_SUCCESS;
- }
- Instance--;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-
-EFI_STATUS
-EFIAPI
-PeiNotifyPpi (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
- )
-/*++
-
-Routine Description:
-
- Install a notification for a given PPI.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
- NotifyList - Pointer to list of Descriptors to notify upon.
-
-Returns:
-
- Status - EFI_SUCCESS if successful
- EFI_OUT_OF_RESOURCES if no space in the database
- EFI_INVALID_PARAMETER if not a good decriptor
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- INTN Index;
- INTN NotifyIndex;
- INTN LastCallbackNotify;
- EFI_PEI_NOTIFY_DESCRIPTOR *NotifyPtr;
- UINTN NotifyDispatchCount;
-
-
- NotifyDispatchCount = 0;
-
- if (NotifyList == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- Index = PrivateData->PpiData.NotifyListEnd;
- LastCallbackNotify = Index;
-
- //
- // This is loop installs all Notify descriptors in the NotifyList. It is
- // terminated by the EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST being set in the last
- // EFI_PEI_NOTIFY_DESCRIPTOR in the list.
- //
-
- for (;;) {
- //
- // Since PpiData is used for NotifyList and InstallList, max resource
- // is reached if the Install reaches the PpiList
- //
- if (Index == PrivateData->PpiData.PpiListEnd - 1) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // If some of the PPI data is invalid restore original Notify PPI database value
- //
- if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES) == 0) {
- PrivateData->PpiData.NotifyListEnd = LastCallbackNotify;
- DEBUG((EFI_D_ERROR, "ERROR -> InstallNotify: %g %x\n", NotifyList->Guid, NotifyList->Notify));
- return EFI_INVALID_PARAMETER;
- }
-
- if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH) != 0) {
- NotifyDispatchCount ++;
- }
-
- PrivateData->PpiData.PpiListPtrs[Index].Notify = NotifyList;
-
- PrivateData->PpiData.NotifyListEnd--;
- DEBUG((EFI_D_INFO, "Register PPI Notify: %g\n", NotifyList->Guid));
- if ((NotifyList->Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) ==
- EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) {
- break;
- }
- //
- // Go the next descriptor. Remember the NotifyList moves down.
- //
- NotifyList++;
- Index--;
- }
-
- //
- // If there is Dispatch Notify PPI installed put them on the bottom
- //
- if (NotifyDispatchCount > 0) {
- for (NotifyIndex = LastCallbackNotify; NotifyIndex > PrivateData->PpiData.NotifyListEnd; NotifyIndex--) {
- if ((PrivateData->PpiData.PpiListPtrs[NotifyIndex].Notify->Flags & EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH) != 0) {
- NotifyPtr = PrivateData->PpiData.PpiListPtrs[NotifyIndex].Notify;
-
- for (Index = NotifyIndex; Index < PrivateData->PpiData.DispatchListEnd; Index++){
- PrivateData->PpiData.PpiListPtrs[Index].Notify = PrivateData->PpiData.PpiListPtrs[Index + 1].Notify;
- }
- PrivateData->PpiData.PpiListPtrs[Index].Notify = NotifyPtr;
- PrivateData->PpiData.DispatchListEnd--;
- }
- }
-
- LastCallbackNotify -= NotifyDispatchCount;
- }
-
- //
- // Dispatch any callback level notifies for all previously installed PPIs.
- //
- DispatchNotify (
- PeiServices,
- EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
- 0,
- PrivateData->PpiData.PpiListEnd,
- LastCallbackNotify,
- PrivateData->PpiData.NotifyListEnd
- );
-
-
- return EFI_SUCCESS;
-}
-
-
-VOID
-ProcessNotifyList (
- IN EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- Process the Notify List at dispatch level.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
-
-Returns:
-
---*/
-
-{
- PEI_CORE_INSTANCE *PrivateData;
- INTN TempValue;
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
-
- while (TRUE) {
- //
- // Check if the PEIM that was just dispatched resulted in any
- // Notifies getting installed. If so, go process any dispatch
- // level Notifies that match the previouly installed PPIs.
- // Use "while" instead of "if" since DispatchNotify can modify
- // DispatchListEnd (with NotifyPpi) so we have to iterate until the same.
- //
- while (PrivateData->PpiData.LastDispatchedNotify != PrivateData->PpiData.DispatchListEnd) {
- TempValue = PrivateData->PpiData.DispatchListEnd;
- DispatchNotify (
- PeiServices,
- EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH,
- 0,
- PrivateData->PpiData.LastDispatchedInstall,
- PrivateData->PpiData.LastDispatchedNotify,
- PrivateData->PpiData.DispatchListEnd
- );
- PrivateData->PpiData.LastDispatchedNotify = TempValue;
- }
-
-
- //
- // Check if the PEIM that was just dispatched resulted in any
- // PPIs getting installed. If so, go process any dispatch
- // level Notifies that match the installed PPIs.
- // Use "while" instead of "if" since DispatchNotify can modify
- // PpiListEnd (with InstallPpi) so we have to iterate until the same.
- //
- while (PrivateData->PpiData.LastDispatchedInstall != PrivateData->PpiData.PpiListEnd) {
- TempValue = PrivateData->PpiData.PpiListEnd;
- DispatchNotify (
- PeiServices,
- EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH,
- PrivateData->PpiData.LastDispatchedInstall,
- PrivateData->PpiData.PpiListEnd,
- MAX_PPI_DESCRIPTORS-1,
- PrivateData->PpiData.DispatchListEnd
- );
- PrivateData->PpiData.LastDispatchedInstall = TempValue;
- }
-
- if (PrivateData->PpiData.LastDispatchedNotify == PrivateData->PpiData.DispatchListEnd) {
- break;
- }
- }
- return;
-}
-
-VOID
-DispatchNotify (
- IN EFI_PEI_SERVICES **PeiServices,
- IN UINTN NotifyType,
- IN INTN InstallStartIndex,
- IN INTN InstallStopIndex,
- IN INTN NotifyStartIndex,
- IN INTN NotifyStopIndex
- )
-/*++
-
-Routine Description:
-
- Dispatch notifications.
-
-Arguments:
-
- PeiServices - Pointer to the PEI Service Table
- NotifyType - Type of notify to fire.
- InstallStartIndex - Install Beginning index.
- InstallStopIndex - Install Ending index.
- NotifyStartIndex - Notify Beginning index.
- NotifyStopIndex - Notify Ending index.
-
-Returns: None
-
---*/
-
-{
- PEI_CORE_INSTANCE *PrivateData;
- INTN Index1;
- INTN Index2;
- EFI_GUID *SearchGuid;
- EFI_GUID *CheckGuid;
- EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;
-
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
-
- //
- // Remember that Installs moves up and Notifies moves down.
- //
- for (Index1 = NotifyStartIndex; Index1 > NotifyStopIndex; Index1--) {
- NotifyDescriptor = PrivateData->PpiData.PpiListPtrs[Index1].Notify;
-
- CheckGuid = NotifyDescriptor->Guid;
-
- for (Index2 = InstallStartIndex; Index2 < InstallStopIndex; Index2++) {
- SearchGuid = PrivateData->PpiData.PpiListPtrs[Index2].Ppi->Guid;
- //
- // Don't use CompareGuid function here for performance reasons.
- // Instead we compare the GUID as INT32 at a time and branch
- // on the first failed comparison.
- //
- if ((((INT32 *)SearchGuid)[0] == ((INT32 *)CheckGuid)[0]) &&
- (((INT32 *)SearchGuid)[1] == ((INT32 *)CheckGuid)[1]) &&
- (((INT32 *)SearchGuid)[2] == ((INT32 *)CheckGuid)[2]) &&
- (((INT32 *)SearchGuid)[3] == ((INT32 *)CheckGuid)[3])) {
- DEBUG ((EFI_D_INFO, "Notify: PPI Guid: %g, Peim notify entry point: %x\n",
- SearchGuid,
- NotifyDescriptor->Notify
- ));
- NotifyDescriptor->Notify (
- PeiServices,
- NotifyDescriptor,
- (PrivateData->PpiData.PpiListPtrs[Index2].Ppi)->Ppi
- );
- }
- }
- }
-
- return;
-}
-
diff --git a/EdkModulePkg/Core/Pei/Reset/Reset.c b/EdkModulePkg/Core/Pei/Reset/Reset.c
deleted file mode 100644
index ef0ceb3..0000000
--- a/EdkModulePkg/Core/Pei/Reset/Reset.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Reset.c
-
-Abstract:
-
- Pei Core Reset System Support
-
-Revision History
-
---*/
-
-#include <PeiMain.h>
-
-EFI_STATUS
-EFIAPI
-PeiResetSystem (
- IN EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- Core version of the Reset System
-
-Arguments:
-
- PeiServices - The PEI core services table.
-
-Returns:
-
- Status - EFI_NOT_AVAILABLE_YET. PPI not available yet.
- - EFI_DEVICE_ERROR. Did not reset system.
-
- Otherwise, resets the system.
-
---*/
-{
- EFI_STATUS Status;
- EFI_PEI_RESET_PPI *ResetPpi;
-
- Status = PeiServicesLocatePpi (
- &gEfiPeiResetPpiGuid,
- 0,
- NULL,
- (VOID **)&ResetPpi
- );
-
- //
- // LocatePpi returns EFI_NOT_FOUND on error
- //
- if (!EFI_ERROR (Status)) {
- return ResetPpi->ResetSystem (PeiServices);
- }
- return EFI_NOT_AVAILABLE_YET;
-}
-
diff --git a/EdkModulePkg/Core/Pei/Security/Security.c b/EdkModulePkg/Core/Pei/Security/Security.c
deleted file mode 100644
index 089995e..0000000
--- a/EdkModulePkg/Core/Pei/Security/Security.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Security.c
-
-Abstract:
-
- EFI PEI Core Security services
-
---*/
-
-#include <PeiMain.h>
-
-STATIC
-EFI_STATUS
-EFIAPI
-SecurityPpiNotifyCallback (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
- );
-
-static EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList = {
- EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
- &gEfiPeiSecurityPpiGuid,
- SecurityPpiNotifyCallback
-};
-
-VOID
-InitializeSecurityServices (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_CORE_INSTANCE *OldCoreData
- )
-/*++
-
-Routine Description:
-
- Initialize the security services.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- OldCoreData - Pointer to the old core data.
- NULL if being run in non-permament memory mode.
-Returns:
-
- None
-
---*/
-{
- if (OldCoreData == NULL) {
- PeiServicesNotifyPpi (&mNotifyList);
- }
- return;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-SecurityPpiNotifyCallback (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
- )
-/*++
-
-Routine Description:
-
- Provide a callback for when the security PPI is installed.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- NotifyDescriptor - The descriptor for the notification event.
- Ppi - Pointer to the PPI in question.
-
-Returns:
-
- EFI_SUCCESS - The function is successfully processed.
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
-
- //
- // Get PEI Core private data
- //
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
-
- //
- // If there isn't a security PPI installed, use the one from notification
- //
- if (PrivateData->PrivateSecurityPpi == NULL) {
- PrivateData->PrivateSecurityPpi = (EFI_PEI_SECURITY_PPI *)Ppi;
- }
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-VerifyPeim (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_FFS_FILE_HEADER *CurrentPeimAddress
- )
-/*++
-
-Routine Description:
-
- Provide a callout to the security verification service.
-
-Arguments:
-
- PeiServices - The PEI core services table.
- CurrentPeimAddress - Pointer to the Firmware File under investigation.
-
-Returns:
-
- EFI_SUCCESS - Image is OK
- EFI_SECURITY_VIOLATION - Image is illegal
-
---*/
-{
- PEI_CORE_INSTANCE *PrivateData;
- EFI_STATUS Status;
- UINT32 AuthenticationStatus;
- BOOLEAN StartCrisisRecovery;
-
- //
- // Set a default authentication state
- //
- AuthenticationStatus = 0;
-
- //
- // get security PPI instance from PEI private data
- //
- PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
-
- if (PrivateData->PrivateSecurityPpi == NULL) {
- Status = EFI_NOT_FOUND;
- } else {
- //
- // Check to see if the image is OK
- //
- Status = PrivateData->PrivateSecurityPpi->AuthenticationState (
- PeiServices,
- PrivateData->PrivateSecurityPpi,
- AuthenticationStatus,
- CurrentPeimAddress,
- &StartCrisisRecovery
- );
- if (StartCrisisRecovery) {
- Status = EFI_SECURITY_VIOLATION;
- }
- }
- return Status;
-}
-
-
-EFI_STATUS
-VerifyFv (
- IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress
- )
-/*++
-
-Routine Description:
-
- Verify a Firmware volume
-
-Arguments:
-
- CurrentFvAddress - Pointer to the current Firmware Volume under consideration
-
-Returns:
-
- EFI_SUCCESS - Firmware Volume is legal
- EFI_SECURITY_VIOLATION - Firmware Volume fails integrity test
-
---*/
-{
- //
- // Right now just pass the test. Future can authenticate and/or check the
- // FV-header or other metric for goodness of binary.
- //
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Core/Pei/StatusCode/StatusCode.c b/EdkModulePkg/Core/Pei/StatusCode/StatusCode.c
deleted file mode 100644
index b9316b6..0000000
--- a/EdkModulePkg/Core/Pei/StatusCode/StatusCode.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- StatusCode.c
-
-Abstract:
-
- Pei Core Status Code Support
-
-Revision History
-
---*/
-
-#include <PeiMain.h>
-
-EFI_STATUS
-EFIAPI
-PeiReportStatusCode (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Core version of the Status Code reporter
-
-Arguments:
-
- PeiServices - The PEI core services table.
-
- CodeType - Type of Status Code.
-
- Value - Value to output for Status Code.
-
- Instance - Instance Number of this status code.
-
- CallerId - ID of the caller of this status code.
-
- Data - Optional data associated with this status code.
-
-Returns:
-
- Status - EFI_SUCCESS if status code is successfully reported
- - EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
-
---*/
-{
- EFI_STATUS Status;
- EFI_PEI_PROGRESS_CODE_PPI *StatusCodePpi;
-
-
- //
- //Locate StatusCode Ppi.
- //
- Status = PeiServicesLocatePpi (
- &gEfiPeiStatusCodePpiGuid,
- 0,
- NULL,
- (VOID **)&StatusCodePpi
- );
-
- if (!EFI_ERROR (Status)) {
- Status = StatusCodePpi->ReportStatusCode (
- PeiServices,
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
-
- return Status;
- }
-
-
- return EFI_NOT_AVAILABLE_YET;
-}
-
-
-
diff --git a/EdkModulePkg/EdkModulePkg.fpd b/EdkModulePkg/EdkModulePkg.fpd
deleted file mode 100644
index 66bc323..0000000
--- a/EdkModulePkg/EdkModulePkg.fpd
+++ /dev/null
@@ -1,22035 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<PlatformSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <PlatformHeader>
- <PlatformName>EdkModuleAll</PlatformName>
- <GuidValue>dc967761-e6e9-4d1a-b02c-818102db4cc6</GuidValue>
- <Version>0.3</Version>
- <Abstract>EFI/Framework Reference Module Package for All Architectures</Abstract>
- <Description>This FPD file is used for Package Level build.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </PlatformHeader>
- <PlatformDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BuildTargets>DEBUG RELEASE</BuildTargets>
- <IntermediateDirectories>UNIFIED</IntermediateDirectories>
- <OutputDirectory>Build/EdkModule</OutputDirectory>
- <SkuInfo>
- <UiSkuName SkuID="0">DEFAULT</UiSkuName>
- </SkuInfo>
- </PlatformDefinitions>
- <Flash>
- <FlashDefinitionFile>dummy.fdf</FlashDefinitionFile>
- </Flash>
- <FrameworkModules>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="80CF7257-87AB-47f9-A3FE-D50B76D89541">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdVpdBaseAddress</C_Name>
- <Token>0x00010010</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxePcdDatabaseTraverseEnabled</C_Name>
- <Token>0x00010021</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b694e0dc-cd4e-4b30-885b-9c164ed3e74a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaxPeiPcdCallBackNumberPerPcdEntry</C_Name>
- <Token>0x0001000f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x08</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdVpdBaseAddress</C_Name>
- <Token>0x00010010</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseTraverseEnabled</C_Name>
- <Token>0x00010020</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseCallbackOnSetEnabled</C_Name>
- <Token>0x00010032</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseExEnabled</C_Name>
- <Token>0x00010033</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseGetSizeEnabled</C_Name>
- <Token>0x00010031</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseSetEnabled</C_Name>
- <Token>0x00010030</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6987936E-ED34-44db-AE97-1FA5E4ED2116">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiApplicationEntryPoint Path: MdePkg\Library\UefiApplicationEntryPoint\UefiApplicationEntryPoint.msa-->
- <Instance ModuleGuid="DADE8301-CB29-4fd5-8148-56FD246C5B88" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>APPLICATION</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="1FA1F39E-FEFF-4aae-BD7B-38A070A3B609">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CD3BAFB6-50FB-4fe8-8E4E-AB74D2C1A600">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6B38F7B4-AD98-40e9-9093-ACA2B5A253C4">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="F80697E9-7FD6-4665-8646-88E33EF71DFC">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="D6A2CB7F-6A18-4e2f-B43B-9920A733700A">
- <Libraries>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="5c12c06f-5cf8-48a6-9860-6c5b2c036bbf" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="cef487a1-751d-4fe0-a39b-e6892b4610c8" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="942e0182-3e1d-47f9-92dc-4939d1a0ba00" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="ed3de5c8-c389-44f2-a35e-2ebdc9802a49" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="882ee1a3-35b2-412c-b8a2-7a8d34a7c390" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="d258d6af-2fc0-4019-9c1f-1101c3dd19b5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePcdLibNull Path: MdePkg\Library\BasePcdLibNull\BasePcdLibNull.msa-->
- <Instance ModuleGuid="40096a3a-5c2a-4fbc-aef7-5475dd7ab334" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>DXE_CORE</FfsFormatKey>
- <Options>
- <Option ToolChainFamily="MSFT" SupArchList="IA32" ToolCode="CC">/WX- /Ob0</Option>
- </Options>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="52C05B14-0B98-496c-BC3B-04B50211D680">
- <Libraries>
- <Instance ModuleGuid="b3b0654a-969d-4096-86cb-27e262a02083" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b2585b69-fb63-4220-844a-8fbea8bf01af" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: SecPeiDxeTimerLibCpu Path: MdePkg\Library\SecPeiDxeTimerLibCpu\SecPeiDxeTimerLibCpu.msa-->
- <Instance ModuleGuid="b5a05743-9b71-489b-a0ed-a0eb3950d23b" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdFSBClock</C_Name>
- <Token>0x0000000c</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>200000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PEI_CORE</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="86D70125-BAA3-4296-A62F-602BEBBB9081">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="d774c4d9-c121-4da3-a5e2-0f317e3c630c" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="e5566134-c75e-4ace-bad1-e23a3b335e30" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b694e0dc-cd4e-4b30-885b-9c164ed3e74a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="858bbbc9-474f-4556-a361-0ae52a44ffa5" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSwitchToLongMode</C_Name>
- <Token>0x0001003b</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportEfiDecompress</C_Name>
- <Token>0x00010034</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportTianoDecompress</C_Name>
- <Token>0x00010035</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportCustomDecompress</C_Name>
- <Token>0x00010036</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
- <Token>0x0001003c</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CCCB0C28-4B24-11d5-9A5A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B601F8C4-43B7-4784-95B1-F4226CB40CEE">
- <Libraries>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="AD608272-D07F-4964-801E-7BD3B7888652">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CBD2E4D5-7068-4FF5-B462-9822B4AD8D60">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bd4d540e-04b0-4b10-8fd5-4a7bb533cf67" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <!--Pkg: MdePkg Mod: DxePcdLib Path: MdePkg\Library\DxePcdLib\DxePcdLib.msa-->
- <Instance ModuleGuid="af97eb89-4cc6-45f8-a514-ca025b346480" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <Token>0x30000001</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFB0000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableSize</C_Name>
- <Token>0x30000002</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x0000A000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CBD2E4D5-7068-4FF5-B866-9822B4AD8D61">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiLib Path: MdePkg\Library\UefiLib\UefiLib.msa-->
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="736EB068-8C01-47c5-964B-1C57BD5D4D64">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="34C8C28F-B61C-45a2-8F2E-89E46BECC63B">
- <Libraries>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9dbf6f25-0da2-4a1d-8e12-e78de6ab4d0e" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <Token>0x30000001</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFB0000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="F099D67F-71AE-4c36-B2A3-DCEB0EB2B7D8">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="4C862FC6-0E54-4e36-8C8F-FF6F3167951F">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: DxePcdLib Path: MdePkg\Library\DxePcdLib\DxePcdLib.msa-->
- <Instance ModuleGuid="af97eb89-4cc6-45f8-a514-ca025b346480" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>
- <Token>0x30000013</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFC0000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>
- <Token>0x30000014</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x00010000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>
- <Token>0x30000010</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFBE000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>
- <Token>0x30000011</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x00002000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="73E9457A-CEA1-4917-9A9C-9F1F0F0FD322">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9E863906-A40F-4875-977F-5B93FF237FC6">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="53BCC14F-C24F-434C-B294-8ED2D4CC1860">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CA515306-00CE-4032-874E-11B755FF6866">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9B680FCE-AD6B-4F3A-B60B-F59899003443">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDevicePathSupportDevicePathToText</C_Name>
- <Token>0x00010037</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>
- <Token>0x00010038</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9B680FCE-AD6B-4F3A-B60B-F59899003443">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDevicePathSupportDevicePathToText</C_Name>
- <Token>0x00010037</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>
- <Token>0x00010038</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9B680FCE-AD6B-4F3A-B60B-F59899003443">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDevicePathSupportDevicePathToText</C_Name>
- <Token>0x00010037</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>
- <Token>0x00010038</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="96B5C032-DF4C-4b6e-8232-438DCF448D0E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FCD337AB-B1D3-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="408edcec-cf6d-477c-a5a8-b4844e3de281">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A3f436EA-A127-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="a46c3330-be36-4977-9d24-a7cf92eef0fe">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A2f436EA-A127-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="13AC6DD0-73D0-11D4-B06B-00AA00BD6DE7">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="EBf342FE-B1D3-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FE3542FE-C1D3-4EF8-657C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="93B80004-9FB3-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: EdkModulePkg Mod: EdkDxePciIncompatibleDeviceSuppportLib Path: EdkModulePkg\Library\EdkDxePciIncompatibleDeviceSupportLib\EdkDxePciIncompatibleDeviceSupportLib.msa-->
- <Instance ModuleGuid="1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciIsaEnable</C_Name>
- <Token>0x00010039</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciVgaEnable</C_Name>
- <Token>0x0001003a</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciBusHotplugDeviceSupport</C_Name>
- <Token>0x0001003d</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>
- <Token>0x0001003f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="E49061CE-99A7-41d3-AB3A-36E5CFBAD63E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="555F76EA-785F-40d7-9174-153C43636C68">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="69FD8E47-A161-4550-B01A-5594CEB2B2B2">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2FB92EFA-2EE0-4bae-9EB6-7464125E1EF7">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="BDFE430E-8F2A-4db0-9991-6F856594777E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="BDFE430E-8F2A-4db0-9991-6F856594777E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="BDFE430E-8F2A-4db0-9991-6F856594777E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="0167CCC4-D0F7-4f21-A3EF-9E64B7CDCE8B">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="46c9adef-aee6-410c-99e4-240e3af18d8b" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="0A66E322-3740-4cce-AD62-BD172CECCA35">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="46c9adef-aee6-410c-99e4-240e3af18d8b" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B40612B9-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="240612B7-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A3527D16-E6CC-42f5-BADB-BF3DE177742B">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B40612B2-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2D2E62CF-9ECF-43b7-8219-94E7FC713DFE">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A5C6D68B-E78A-4426-9278-A8F0D9EB4D8F">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2D2E62AA-9ECF-43b7-8219-94E7FC713DFE">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FEDE0A1B-BCA2-4A9F-BB2B-D9FD7DEC2E9F">
- <Libraries>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="E4541241-8897-411a-91F8-7D7E45837146" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="54D2878F-25CD-4a2b-8420-EBD18E609C76" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->
- <Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseHardSerial</C_Name>
- <Token>0x00010027</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseEfiSerial</C_Name>
- <Token>0x00010026</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseRuntimeMemory</C_Name>
- <Token>0x00010028</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseDataHub</C_Name>
- <Token>0x00010029</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <Token>0x00010024</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInSerial</C_Name>
- <Token>0x0001002a</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInDataHub</C_Name>
- <Token>0x0001002c</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInRuntimeMemory</C_Name>
- <Token>0x0001002b</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInOEM</C_Name>
- <Token>0x0001002d</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdStatusCodeRuntimeMemorySize</C_Name>
- <Token>0x0001002e</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT16</DatumType>
- <MaxDatumSize>2</MaxDatumSize>
- <Value>4</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FEDE0A1B-BCA2-4A9F-BB2B-D9FD7DEC2E9F">
- <Libraries>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="926c9cd0-4bb8-479b-9ac4-8a2a23f85307" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="E4541241-8897-411a-91F8-7D7E45837146" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="54D2878F-25CD-4a2b-8420-EBD18E609C76" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->
- <Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseHardSerial</C_Name>
- <Token>0x00010027</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseEfiSerial</C_Name>
- <Token>0x00010026</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseRuntimeMemory</C_Name>
- <Token>0x00010028</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseDataHub</C_Name>
- <Token>0x00010029</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <Token>0x00010024</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInSerial</C_Name>
- <Token>0x0001002a</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInDataHub</C_Name>
- <Token>0x0001002c</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInRuntimeMemory</C_Name>
- <Token>0x0001002b</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInOEM</C_Name>
- <Token>0x0001002d</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdStatusCodeRuntimeMemorySize</C_Name>
- <Token>0x0001002e</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT16</DatumType>
- <MaxDatumSize>2</MaxDatumSize>
- <Value>4</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="80CF7257-87AB-47f9-A3FE-D50B76D89541">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdVpdBaseAddress</C_Name>
- <Token>0x00010010</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxePcdDatabaseTraverseEnabled</C_Name>
- <Token>0x00010021</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b694e0dc-cd4e-4b30-885b-9c164ed3e74a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaxPeiPcdCallBackNumberPerPcdEntry</C_Name>
- <Token>0x0001000f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x08</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdVpdBaseAddress</C_Name>
- <Token>0x00010010</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseTraverseEnabled</C_Name>
- <Token>0x00010020</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseCallbackOnSetEnabled</C_Name>
- <Token>0x00010032</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseExEnabled</C_Name>
- <Token>0x00010033</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseGetSizeEnabled</C_Name>
- <Token>0x00010031</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseSetEnabled</C_Name>
- <Token>0x00010030</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6987936E-ED34-44db-AE97-1FA5E4ED2116">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiApplicationEntryPoint Path: MdePkg\Library\UefiApplicationEntryPoint\UefiApplicationEntryPoint.msa-->
- <Instance ModuleGuid="DADE8301-CB29-4fd5-8148-56FD246C5B88" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>APPLICATION</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="1FA1F39E-FEFF-4aae-BD7B-38A070A3B609">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CD3BAFB6-50FB-4fe8-8E4E-AB74D2C1A600">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6B38F7B4-AD98-40e9-9093-ACA2B5A253C4">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="F80697E9-7FD6-4665-8646-88E33EF71DFC">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="D6A2CB7F-6A18-4e2f-B43B-9920A733700A">
- <Libraries>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="5c12c06f-5cf8-48a6-9860-6c5b2c036bbf" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="cef487a1-751d-4fe0-a39b-e6892b4610c8" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="942e0182-3e1d-47f9-92dc-4939d1a0ba00" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="ed3de5c8-c389-44f2-a35e-2ebdc9802a49" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="882ee1a3-35b2-412c-b8a2-7a8d34a7c390" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="d258d6af-2fc0-4019-9c1f-1101c3dd19b5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePcdLibNull Path: MdePkg\Library\BasePcdLibNull\BasePcdLibNull.msa-->
- <Instance ModuleGuid="40096a3a-5c2a-4fbc-aef7-5475dd7ab334" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>DXE_CORE</FfsFormatKey>
- <Options>
- <Option ToolChainFamily="MSFT" SupArchList="X64" ToolCode="CC">/WX- /Ob0</Option>
- </Options>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="52C05B14-0B98-496c-BC3B-04B50211D680">
- <Libraries>
- <Instance ModuleGuid="b3b0654a-969d-4096-86cb-27e262a02083" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b2585b69-fb63-4220-844a-8fbea8bf01af" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: SecPeiDxeTimerLibCpu Path: MdePkg\Library\SecPeiDxeTimerLibCpu\SecPeiDxeTimerLibCpu.msa-->
- <Instance ModuleGuid="b5a05743-9b71-489b-a0ed-a0eb3950d23b" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdFSBClock</C_Name>
- <Token>0x0000000c</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>200000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PEI_CORE</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="86D70125-BAA3-4296-A62F-602BEBBB9081">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="d774c4d9-c121-4da3-a5e2-0f317e3c630c" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="e5566134-c75e-4ace-bad1-e23a3b335e30" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b694e0dc-cd4e-4b30-885b-9c164ed3e74a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="858bbbc9-474f-4556-a361-0ae52a44ffa5" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportEfiDecompress</C_Name>
- <Token>0x00010034</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportTianoDecompress</C_Name>
- <Token>0x00010035</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportCustomDecompress</C_Name>
- <Token>0x00010036</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
- <Token>0x0001003c</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CCCB0C28-4B24-11d5-9A5A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B601F8C4-43B7-4784-95B1-F4226CB40CEE">
- <Libraries>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="AD608272-D07F-4964-801E-7BD3B7888652">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CBD2E4D5-7068-4FF5-B462-9822B4AD8D60">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bd4d540e-04b0-4b10-8fd5-4a7bb533cf67" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <!--Pkg: MdePkg Mod: DxePcdLib Path: MdePkg\Library\DxePcdLib\DxePcdLib.msa-->
- <Instance ModuleGuid="af97eb89-4cc6-45f8-a514-ca025b346480" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <Token>0x30000001</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFB0000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableSize</C_Name>
- <Token>0x30000002</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x0000A000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CBD2E4D5-7068-4FF5-B866-9822B4AD8D61">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiLib Path: MdePkg\Library\UefiLib\UefiLib.msa-->
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="736EB068-8C01-47c5-964B-1C57BD5D4D64">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="34C8C28F-B61C-45a2-8F2E-89E46BECC63B">
- <Libraries>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9dbf6f25-0da2-4a1d-8e12-e78de6ab4d0e" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <Token>0x30000001</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFB0000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="F099D67F-71AE-4c36-B2A3-DCEB0EB2B7D8">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="4C862FC6-0E54-4e36-8C8F-FF6F3167951F">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: DxePcdLib Path: MdePkg\Library\DxePcdLib\DxePcdLib.msa-->
- <Instance ModuleGuid="af97eb89-4cc6-45f8-a514-ca025b346480" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>
- <Token>0x30000013</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFC0000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>
- <Token>0x30000014</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x00010000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>
- <Token>0x30000010</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFBE000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>
- <Token>0x30000011</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x00002000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="73E9457A-CEA1-4917-9A9C-9F1F0F0FD322">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9E863906-A40F-4875-977F-5B93FF237FC6">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="53BCC14F-C24F-434C-B294-8ED2D4CC1860">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CA515306-00CE-4032-874E-11B755FF6866">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="96B5C032-DF4C-4b6e-8232-438DCF448D0E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FCD337AB-B1D3-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="408edcec-cf6d-477c-a5a8-b4844e3de281">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A3f436EA-A127-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="a46c3330-be36-4977-9d24-a7cf92eef0fe">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A2f436EA-A127-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="13AC6DD0-73D0-11D4-B06B-00AA00BD6DE7">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="EBf342FE-B1D3-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FE3542FE-C1D3-4EF8-657C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="93B80004-9FB3-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: EdkModulePkg Mod: EdkDxePciIncompatibleDeviceSuppportLib Path: EdkModulePkg\Library\EdkDxePciIncompatibleDeviceSupportLib\EdkDxePciIncompatibleDeviceSupportLib.msa-->
- <Instance ModuleGuid="1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciIsaEnable</C_Name>
- <Token>0x00010039</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciVgaEnable</C_Name>
- <Token>0x0001003a</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciBusHotplugDeviceSupport</C_Name>
- <Token>0x0001003d</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>
- <Token>0x0001003f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="E49061CE-99A7-41d3-AB3A-36E5CFBAD63E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="555F76EA-785F-40d7-9174-153C43636C68">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="69FD8E47-A161-4550-B01A-5594CEB2B2B2">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2FB92EFA-2EE0-4bae-9EB6-7464125E1EF7">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="0167CCC4-D0F7-4f21-A3EF-9E64B7CDCE8B">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="46c9adef-aee6-410c-99e4-240e3af18d8b" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="0A66E322-3740-4cce-AD62-BD172CECCA35">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="46c9adef-aee6-410c-99e4-240e3af18d8b" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B40612B9-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="240612B7-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A3527D16-E6CC-42f5-BADB-BF3DE177742B">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B40612B2-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2D2E62CF-9ECF-43b7-8219-94E7FC713DFE">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A5C6D68B-E78A-4426-9278-A8F0D9EB4D8F">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2D2E62AA-9ECF-43b7-8219-94E7FC713DFE">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="80CF7257-87AB-47f9-A3FE-D50B76D89541">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdVpdBaseAddress</C_Name>
- <Token>0x00010010</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxePcdDatabaseTraverseEnabled</C_Name>
- <Token>0x00010021</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b694e0dc-cd4e-4b30-885b-9c164ed3e74a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaxPeiPcdCallBackNumberPerPcdEntry</C_Name>
- <Token>0x0001000f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x08</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdVpdBaseAddress</C_Name>
- <Token>0x00010010</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseTraverseEnabled</C_Name>
- <Token>0x00010020</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseCallbackOnSetEnabled</C_Name>
- <Token>0x00010032</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseExEnabled</C_Name>
- <Token>0x00010033</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseGetSizeEnabled</C_Name>
- <Token>0x00010031</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseSetEnabled</C_Name>
- <Token>0x00010030</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>IPF_PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6987936E-ED34-44db-AE97-1FA5E4ED2116">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiApplicationEntryPoint Path: MdePkg\Library\UefiApplicationEntryPoint\UefiApplicationEntryPoint.msa-->
- <Instance ModuleGuid="DADE8301-CB29-4fd5-8148-56FD246C5B88" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>APPLICATION</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="1FA1F39E-FEFF-4aae-BD7B-38A070A3B609">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CD3BAFB6-50FB-4fe8-8E4E-AB74D2C1A600">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6B38F7B4-AD98-40e9-9093-ACA2B5A253C4">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="F80697E9-7FD6-4665-8646-88E33EF71DFC">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="D6A2CB7F-6A18-4e2f-B43B-9920A733700A">
- <Libraries>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="5c12c06f-5cf8-48a6-9860-6c5b2c036bbf" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="cef487a1-751d-4fe0-a39b-e6892b4610c8" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="942e0182-3e1d-47f9-92dc-4939d1a0ba00" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="ed3de5c8-c389-44f2-a35e-2ebdc9802a49" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="882ee1a3-35b2-412c-b8a2-7a8d34a7c390" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="d258d6af-2fc0-4019-9c1f-1101c3dd19b5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePcdLibNull Path: MdePkg\Library\BasePcdLibNull\BasePcdLibNull.msa-->
- <Instance ModuleGuid="40096a3a-5c2a-4fbc-aef7-5475dd7ab334" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>DXE_CORE</FfsFormatKey>
- <Options>
- <Option ToolChainFamily="MSFT" SupArchList="IPF" ToolCode="CC">/WX- /Ob0</Option>
- </Options>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="52C05B14-0B98-496c-BC3B-04B50211D680">
- <Libraries>
- <Instance ModuleGuid="b3b0654a-969d-4096-86cb-27e262a02083" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b2585b69-fb63-4220-844a-8fbea8bf01af" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: SecPeiDxeTimerLibCpu Path: MdePkg\Library\SecPeiDxeTimerLibCpu\SecPeiDxeTimerLibCpu.msa-->
- <Instance ModuleGuid="b5a05743-9b71-489b-a0ed-a0eb3950d23b" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>IPF_PEI_CORE</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="86D70125-BAA3-4296-A62F-602BEBBB9081">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="d774c4d9-c121-4da3-a5e2-0f317e3c630c" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="e5566134-c75e-4ace-bad1-e23a3b335e30" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b694e0dc-cd4e-4b30-885b-9c164ed3e74a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="858bbbc9-474f-4556-a361-0ae52a44ffa5" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportEfiDecompress</C_Name>
- <Token>0x00010034</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportTianoDecompress</C_Name>
- <Token>0x00010035</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportCustomDecompress</C_Name>
- <Token>0x00010036</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
- <Token>0x0001003c</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>IPF_PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CCCB0C28-4B24-11d5-9A5A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B601F8C4-43B7-4784-95B1-F4226CB40CEE">
- <Libraries>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="36270801-b4db-45ac-a36f-53e674cf0612" PackageGuid="9082e5e9-5651-4a50-8b5d-7f50b387ce7f"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="AD608272-D07F-4964-801E-7BD3B7888652">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="36270801-b4db-45ac-a36f-53e674cf0612" PackageGuid="9082e5e9-5651-4a50-8b5d-7f50b387ce7f"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="736EB068-8C01-47c5-964B-1C57BD5D4D64">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>IPF_PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="34C8C28F-B61C-45a2-8F2E-89E46BECC63B">
- <Libraries>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9dbf6f25-0da2-4a1d-8e12-e78de6ab4d0e" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <Token>0x30000001</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFB0000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>IPF_PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="F099D67F-71AE-4c36-B2A3-DCEB0EB2B7D8">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="4C862FC6-0E54-4e36-8C8F-FF6F3167951F">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: DxePcdLib Path: MdePkg\Library\DxePcdLib\DxePcdLib.msa-->
- <Instance ModuleGuid="af97eb89-4cc6-45f8-a514-ca025b346480" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>
- <Token>0x30000013</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFC0000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>
- <Token>0x30000014</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x00010000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>
- <Token>0x30000010</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFBE000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>
- <Token>0x30000011</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x00002000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="73E9457A-CEA1-4917-9A9C-9F1F0F0FD322">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9E863906-A40F-4875-977F-5B93FF237FC6">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="53BCC14F-C24F-434C-B294-8ED2D4CC1860">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CA515306-00CE-4032-874E-11B755FF6866">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="96B5C032-DF4C-4b6e-8232-438DCF448D0E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FCD337AB-B1D3-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="408edcec-cf6d-477c-a5a8-b4844e3de281">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A3f436EA-A127-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="a46c3330-be36-4977-9d24-a7cf92eef0fe">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A2f436EA-A127-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="13AC6DD0-73D0-11D4-B06B-00AA00BD6DE7">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="EBf342FE-B1D3-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FE3542FE-C1D3-4EF8-657C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="93B80004-9FB3-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: EdkModulePkg Mod: EdkDxePciIncompatibleDeviceSuppportLib Path: EdkModulePkg\Library\EdkDxePciIncompatibleDeviceSupportLib\EdkDxePciIncompatibleDeviceSupportLib.msa-->
- <Instance ModuleGuid="1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciIsaEnable</C_Name>
- <Token>0x00010039</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciVgaEnable</C_Name>
- <Token>0x0001003a</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciBusHotplugDeviceSupport</C_Name>
- <Token>0x0001003d</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>
- <Token>0x0001003f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="E49061CE-99A7-41d3-AB3A-36E5CFBAD63E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="555F76EA-785F-40d7-9174-153C43636C68">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="69FD8E47-A161-4550-B01A-5594CEB2B2B2">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2FB92EFA-2EE0-4bae-9EB6-7464125E1EF7">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="0167CCC4-D0F7-4f21-A3EF-9E64B7CDCE8B">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="46c9adef-aee6-410c-99e4-240e3af18d8b" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="0A66E322-3740-4cce-AD62-BD172CECCA35">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="46c9adef-aee6-410c-99e4-240e3af18d8b" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B40612B9-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="240612B7-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A3527D16-E6CC-42f5-BADB-BF3DE177742B">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B40612B2-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2D2E62CF-9ECF-43b7-8219-94E7FC713DFE">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A5C6D68B-E78A-4426-9278-A8F0D9EB4D8F">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2D2E62AA-9ECF-43b7-8219-94E7FC713DFE">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="80CF7257-87AB-47f9-A3FE-D50B76D89541">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdVpdBaseAddress</C_Name>
- <Token>0x00010010</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxePcdDatabaseTraverseEnabled</C_Name>
- <Token>0x00010021</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b694e0dc-cd4e-4b30-885b-9c164ed3e74a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaxPeiPcdCallBackNumberPerPcdEntry</C_Name>
- <Token>0x0001000f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x08</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdVpdBaseAddress</C_Name>
- <Token>0x00010010</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseTraverseEnabled</C_Name>
- <Token>0x00010020</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseCallbackOnSetEnabled</C_Name>
- <Token>0x00010032</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseExEnabled</C_Name>
- <Token>0x00010033</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseGetSizeEnabled</C_Name>
- <Token>0x00010031</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPeiPcdDatabaseSetEnabled</C_Name>
- <Token>0x00010030</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6987936E-ED34-44db-AE97-1FA5E4ED2116">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: UefiApplicationEntryPoint Path: MdePkg\Library\UefiApplicationEntryPoint\UefiApplicationEntryPoint.msa-->
- <Instance ModuleGuid="DADE8301-CB29-4fd5-8148-56FD246C5B88" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>APPLICATION</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="1FA1F39E-FEFF-4aae-BD7B-38A070A3B609">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CD3BAFB6-50FB-4fe8-8E4E-AB74D2C1A600">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6B38F7B4-AD98-40e9-9093-ACA2B5A253C4">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="F80697E9-7FD6-4665-8646-88E33EF71DFC">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="D6A2CB7F-6A18-4e2f-B43B-9920A733700A">
- <Libraries>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="5c12c06f-5cf8-48a6-9860-6c5b2c036bbf" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="cef487a1-751d-4fe0-a39b-e6892b4610c8" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="942e0182-3e1d-47f9-92dc-4939d1a0ba00" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="ed3de5c8-c389-44f2-a35e-2ebdc9802a49" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="882ee1a3-35b2-412c-b8a2-7a8d34a7c390" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="d258d6af-2fc0-4019-9c1f-1101c3dd19b5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePcdLibNull Path: MdePkg\Library\BasePcdLibNull\BasePcdLibNull.msa-->
- <Instance ModuleGuid="40096a3a-5c2a-4fbc-aef7-5475dd7ab334" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>DXE_CORE</FfsFormatKey>
- <Options>
- <Option ToolChainFamily="INTEL" SupArchList="EBC" ToolCode="CC">/WX- /Ob0</Option>
- </Options>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="52C05B14-0B98-496c-BC3B-04B50211D680">
- <Libraries>
- <Instance ModuleGuid="b3b0654a-969d-4096-86cb-27e262a02083" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b2585b69-fb63-4220-844a-8fbea8bf01af" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->
- <Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PEI_CORE</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="86D70125-BAA3-4296-A62F-602BEBBB9081">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="123dd843-57c9-4158-8418-ce68b3944ce7" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="d774c4d9-c121-4da3-a5e2-0f317e3c630c" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="e5566134-c75e-4ace-bad1-e23a3b335e30" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="b694e0dc-cd4e-4b30-885b-9c164ed3e74a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="858bbbc9-474f-4556-a361-0ae52a44ffa5" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="556f5d10-7309-4af4-b80a-8196bd60946f" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportEfiDecompress</C_Name>
- <Token>0x00010034</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportTianoDecompress</C_Name>
- <Token>0x00010035</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplSupportCustomDecompress</C_Name>
- <Token>0x00010036</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
- <Token>0x0001003c</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CCCB0C28-4B24-11d5-9A5A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="736EB068-8C01-47c5-964B-1C57BD5D4D64">
- <Libraries>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="34C8C28F-B61C-45a2-8F2E-89E46BECC63B">
- <Libraries>
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a9759d2-53bc-4eb2-abcd-c93099419063" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="9dbf6f25-0da2-4a1d-8e12-e78de6ab4d0e" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <Token>0x30000001</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFB0000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="F099D67F-71AE-4c36-B2A3-DCEB0EB2B7D8">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="4C862FC6-0E54-4e36-8C8F-FF6F3167951F">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: DxePcdLib Path: MdePkg\Library\DxePcdLib\DxePcdLib.msa-->
- <Instance ModuleGuid="af97eb89-4cc6-45f8-a514-ca025b346480" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>
- <Token>0x30000013</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFC0000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>
- <Token>0x30000014</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x00010000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>
- <Token>0x30000010</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0xFFFBE000</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>
- <Token>0x30000011</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x00002000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="73E9457A-CEA1-4917-9A9C-9F1F0F0FD322">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="9E863906-A40F-4875-977F-5B93FF237FC6">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="53BCC14F-C24F-434C-B294-8ED2D4CC1860">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="CA515306-00CE-4032-874E-11B755FF6866">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="96B5C032-DF4C-4b6e-8232-438DCF448D0E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FCD337AB-B1D3-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="408edcec-cf6d-477c-a5a8-b4844e3de281">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="a46c3330-be36-4977-9d24-a7cf92eef0fe">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A2f436EA-A127-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="EBf342FE-B1D3-4EF8-957C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="FE3542FE-C1D3-4EF8-657C-8048606FF670">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="08c1a0e4-1208-47f8-a2c5-f42eabee653a" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="ea55bada-d488-427b-9d2d-227e0aaa3707" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="93B80004-9FB3-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="be490364-73d2-420d-950e-f6450ca75dfb" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: EdkModulePkg Mod: EdkDxePciIncompatibleDeviceSuppportLib Path: EdkModulePkg\Library\EdkDxePciIncompatibleDeviceSupportLib\EdkDxePciIncompatibleDeviceSupportLib.msa-->
- <Instance ModuleGuid="1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciIsaEnable</C_Name>
- <Token>0x00010039</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciVgaEnable</C_Name>
- <Token>0x0001003a</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdPciBusHotplugDeviceSupport</C_Name>
- <Token>0x0001003d</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>TRUE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>
- <Token>0x0001003f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="E49061CE-99A7-41d3-AB3A-36E5CFBAD63E">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="555F76EA-785F-40d7-9174-153C43636C68">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="69FD8E47-A161-4550-B01A-5594CEB2B2B2">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="FC120ED3-40E1-46dc-8C9C-AAE3CA139ACF" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <Token>0x00000009</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2FB92EFA-2EE0-4bae-9EB6-7464125E1EF7">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="0167CCC4-D0F7-4f21-A3EF-9E64B7CDCE8B">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="46c9adef-aee6-410c-99e4-240e3af18d8b" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="0A66E322-3740-4cce-AD62-BD172CECCA35">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="46c9adef-aee6-410c-99e4-240e3af18d8b" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B40612B9-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="240612B7-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A3527D16-E6CC-42f5-BADB-BF3DE177742B">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="B40612B2-A063-11d4-9A3A-0090273FC14D">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2D2E62CF-9ECF-43b7-8219-94E7FC713DFE">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="A5C6D68B-E78A-4426-9278-A8F0D9EB4D8F">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="2D2E62AA-9ECF-43b7-8219-94E7FC713DFE">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="87eb5df9-722a-4241-ad7f-370d0b3a56d7" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: PeiStatusCode Type: PEIM Path: EdkModulePkg\Universal\StatusCode\Pei\PeiStatusCode.msa-->
- <ModuleSA ModuleGuid="1EC0F53A-FDE0-4576-8F25-7A1A410F58EB" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IA32">
- <Libraries>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiReportStatusCodeLib Path: MdePkg\Library\PeiReportStatusCodeLib\PeiReportStatusCodeLib.msa-->
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseMemoryLib Path: MdePkg\Library\BaseMemoryLib\BaseMemoryLib.msa-->
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkOemHookStatusCodeLibNull Path: EdkModulePkg\Library\EdkOemHookStatusCodeLibNull\EdkOemHookStatusCodeLibNull.msa-->
- <Instance ModuleGuid="54D2878F-25CD-4a2b-8420-EBD18E609C76" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiServicesLib Path: MdePkg\Library\PeiServicesLib\PeiServicesLib.msa-->
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseIoLibIntrinsic Path: MdePkg\Library\BaseIoLibIntrinsic\BaseIoLibIntrinsic.msa-->
- <Instance ModuleGuid="926c9cd0-4bb8-479b-9ac4-8a2a23f85307" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiHobLib Path: MdePkg\Library\PeiHobLib\PeiHobLib.msa-->
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiServicesTablePointerLib Path: MdePkg\Library\PeiServicesTablePointerLib\PeiServicesTablePointerLib.msa-->
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkSerialPortLibNull Path: EdkModulePkg\Library\EdkSerialPortLibNull\EdkSerialPortLibNull.msa-->
- <Instance ModuleGuid="E4541241-8897-411a-91F8-7D7E45837146" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeimEntryPoint Path: MdePkg\Library\PeimEntryPoint\PeimEntryPoint.msa-->
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseSerial</C_Name>
- <Token>0x00010022</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseMemory</C_Name>
- <Token>0x00010023</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <Token>0x00010024</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdStatusCodeMemorySize</C_Name>
- <Token>0x00010025</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT16</DatumType>
- <MaxDatumSize>2</MaxDatumSize>
- <Value>4</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: PeiStatusCode Type: PEIM Path: EdkModulePkg\Universal\StatusCode\Pei\PeiStatusCode.msa-->
- <ModuleSA ModuleGuid="1EC0F53A-FDE0-4576-8F25-7A1A410F58EB" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="X64">
- <Libraries>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiReportStatusCodeLib Path: MdePkg\Library\PeiReportStatusCodeLib\PeiReportStatusCodeLib.msa-->
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseMemoryLib Path: MdePkg\Library\BaseMemoryLib\BaseMemoryLib.msa-->
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkOemHookStatusCodeLibNull Path: EdkModulePkg\Library\EdkOemHookStatusCodeLibNull\EdkOemHookStatusCodeLibNull.msa-->
- <Instance ModuleGuid="54D2878F-25CD-4a2b-8420-EBD18E609C76" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiServicesLib Path: MdePkg\Library\PeiServicesLib\PeiServicesLib.msa-->
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseIoLibIntrinsic Path: MdePkg\Library\BaseIoLibIntrinsic\BaseIoLibIntrinsic.msa-->
- <Instance ModuleGuid="926c9cd0-4bb8-479b-9ac4-8a2a23f85307" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiHobLib Path: MdePkg\Library\PeiHobLib\PeiHobLib.msa-->
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiServicesTablePointerLib Path: MdePkg\Library\PeiServicesTablePointerLib\PeiServicesTablePointerLib.msa-->
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkSerialPortLibNull Path: EdkModulePkg\Library\EdkSerialPortLibNull\EdkSerialPortLibNull.msa-->
- <Instance ModuleGuid="E4541241-8897-411a-91F8-7D7E45837146" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeimEntryPoint Path: MdePkg\Library\PeimEntryPoint\PeimEntryPoint.msa-->
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseSerial</C_Name>
- <Token>0x00010022</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseMemory</C_Name>
- <Token>0x00010023</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <Token>0x00010024</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdStatusCodeMemorySize</C_Name>
- <Token>0x00010025</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT16</DatumType>
- <MaxDatumSize>2</MaxDatumSize>
- <Value>4</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: PeiStatusCode Type: PEIM Path: EdkModulePkg\Universal\StatusCode\Pei\PeiStatusCode.msa-->
- <ModuleSA ModuleGuid="1EC0F53A-FDE0-4576-8F25-7A1A410F58EB" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IPF">
- <Libraries>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiReportStatusCodeLib Path: MdePkg\Library\PeiReportStatusCodeLib\PeiReportStatusCodeLib.msa-->
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseMemoryLib Path: MdePkg\Library\BaseMemoryLib\BaseMemoryLib.msa-->
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkOemHookStatusCodeLibNull Path: EdkModulePkg\Library\EdkOemHookStatusCodeLibNull\EdkOemHookStatusCodeLibNull.msa-->
- <Instance ModuleGuid="54D2878F-25CD-4a2b-8420-EBD18E609C76" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiServicesLib Path: MdePkg\Library\PeiServicesLib\PeiServicesLib.msa-->
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiHobLib Path: MdePkg\Library\PeiHobLib\PeiHobLib.msa-->
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiServicesTablePointerLib Path: MdePkg\Library\PeiServicesTablePointerLib\PeiServicesTablePointerLib.msa-->
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkSerialPortLibNull Path: EdkModulePkg\Library\EdkSerialPortLibNull\EdkSerialPortLibNull.msa-->
- <Instance ModuleGuid="E4541241-8897-411a-91F8-7D7E45837146" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeimEntryPoint Path: MdePkg\Library\PeimEntryPoint\PeimEntryPoint.msa-->
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseSerial</C_Name>
- <Token>0x00010022</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseMemory</C_Name>
- <Token>0x00010023</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <Token>0x00010024</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdStatusCodeMemorySize</C_Name>
- <Token>0x00010025</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT16</DatumType>
- <MaxDatumSize>2</MaxDatumSize>
- <Value>4</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>IPF_PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: PeiStatusCode Type: PEIM Path: EdkModulePkg\Universal\StatusCode\Pei\PeiStatusCode.msa-->
- <ModuleSA ModuleGuid="1EC0F53A-FDE0-4576-8F25-7A1A410F58EB" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="EBC">
- <Libraries>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiReportStatusCodeLib Path: MdePkg\Library\PeiReportStatusCodeLib\PeiReportStatusCodeLib.msa-->
- <Instance ModuleGuid="8c690838-7a22-45c4-aa58-a33e3e515cd4" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseMemoryLib Path: MdePkg\Library\BaseMemoryLib\BaseMemoryLib.msa-->
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkOemHookStatusCodeLibNull Path: EdkModulePkg\Library\EdkOemHookStatusCodeLibNull\EdkOemHookStatusCodeLibNull.msa-->
- <Instance ModuleGuid="54D2878F-25CD-4a2b-8420-EBD18E609C76" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiServicesLib Path: MdePkg\Library\PeiServicesLib\PeiServicesLib.msa-->
- <Instance ModuleGuid="a804239b-4155-446f-acc8-f0825d74908c" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiHobLib Path: MdePkg\Library\PeiHobLib\PeiHobLib.msa-->
- <Instance ModuleGuid="9643128f-ac24-4b3e-b6be-d8849a306153" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiServicesTablePointerLib Path: MdePkg\Library\PeiServicesTablePointerLib\PeiServicesTablePointerLib.msa-->
- <Instance ModuleGuid="1c747f6b-0a58-49ae-8ea3-0327a4fa10e3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkSerialPortLibNull Path: EdkModulePkg\Library\EdkSerialPortLibNull\EdkSerialPortLibNull.msa-->
- <Instance ModuleGuid="E4541241-8897-411a-91F8-7D7E45837146" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeimEntryPoint Path: MdePkg\Library\PeimEntryPoint\PeimEntryPoint.msa-->
- <Instance ModuleGuid="fa177ff7-1fc7-458d-a358-d9d62ae61cec" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseSerial</C_Name>
- <Token>0x00010022</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseMemory</C_Name>
- <Token>0x00010023</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <Token>0x00010024</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdStatusCodeMemorySize</C_Name>
- <Token>0x00010025</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT16</DatumType>
- <MaxDatumSize>2</MaxDatumSize>
- <Value>4</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>PE32_PEIM</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="51ccf399-4fdf-4e55-a45b-e123f84d456a">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="X64" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="51ccf399-4fdf-4e55-a45b-e123f84d456a">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="IPF" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="51ccf399-4fdf-4e55-a45b-e123f84d456a">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <ModuleSA SupArchList="EBC" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="51ccf399-4fdf-4e55-a45b-e123f84d456a">
- <Libraries>
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Instance ModuleGuid="50bcb105-6634-441d-b403-659110a03ad2" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: DxeIplX64 Type: PEIM Path: EdkModulePkg\Core\DxeIplX64Peim\DxeIplX64.msa-->
- <!--Mod: VariableIpf Type: DXE_SAL_DRIVER Path: EdkModulePkg\Universal\Variable\RuntimeDxe\VariableIpf.msa-->
- <ModuleSA ModuleGuid="9D0E793B-3970-4a6c-BA26-B4E2C30B437B" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IPF">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseMemoryLib Path: MdePkg\Library\BaseMemoryLib\BaseMemoryLib.msa-->
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeServicesTableLib Path: MdePkg\Library\DxeServicesTableLib\DxeServicesTableLib.msa-->
- <Instance ModuleGuid="baa1baa3-0a8d-402c-8042-985115fae953" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkFvbServiceLib Path: EdkModulePkg\Library\EdkFvbServiceLib\EdkFvbServiceLib.msa-->
- <Instance ModuleGuid="bd4d540e-04b0-4b10-8fd5-4a7bb533cf67" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePcdLibNull Path: MdePkg\Library\BasePcdLibNull\BasePcdLibNull.msa-->
- <Instance ModuleGuid="40096a3a-5c2a-4fbc-aef7-5475dd7ab334" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiLib Path: MdePkg\Library\UefiLib\UefiLib.msa-->
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkUefiRuntimeLib Path: EdkModulePkg\Library\EdkUefiRuntimeLib\EdkUefiRuntimeLib.msa-->
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeHobLib Path: MdePkg\Library\DxeHobLib\DxeHobLib.msa-->
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseDebugLibNull Path: MdePkg\Library\BaseDebugLibNull\BaseDebugLibNull.msa-->
- <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkDxeSalLib Path: EdkModulePkg\Library\EdkDxeSalLib\EdkDxeSalLib.msa-->
- <Instance ModuleGuid="61999c3c-72a5-4506-a4ff-4271d18a1d14" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <Token>0x30000001</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x0</Value>
- </PcdData>
- <PcdData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableSize</C_Name>
- <Token>0x30000002</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x0</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- </ModuleSA>
- <!--Mod: EmuVariableIpf Type: DXE_SAL_DRIVER Path: EdkModulePkg\Universal\EmuVariable\RuntimeDxe\EmuVariableIpf.msa-->
- <ModuleSA ModuleGuid="A46320E8-0514-489a-BC4E-481624D9CE33" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IPF">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkUefiRuntimeLib Path: EdkModulePkg\Library\EdkUefiRuntimeLib\EdkUefiRuntimeLib.msa-->
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseMemoryLib Path: MdePkg\Library\BaseMemoryLib\BaseMemoryLib.msa-->
- <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseDebugLibNull Path: MdePkg\Library\BaseDebugLibNull\BaseDebugLibNull.msa-->
- <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePcdLibNull Path: MdePkg\Library\BasePcdLibNull\BasePcdLibNull.msa-->
- <Instance ModuleGuid="40096a3a-5c2a-4fbc-aef7-5475dd7ab334" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiLib Path: MdePkg\Library\UefiLib\UefiLib.msa-->
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: ItaniumPlatformPkg Mod: DxeRuntimeExtendedSalLib Path: R9\ItaniumPlatformPkg\DxeRuntimeExtendedSalLib\DxeRuntimeExtendedSalLib.msa-->
- <Instance ModuleGuid="36270801-b4db-45ac-a36f-53e674cf0612" PackageGuid="9082e5e9-5651-4a50-8b5d-7f50b387ce7f"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>RT_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: Undi Type: DXE_RUNTIME_DRIVER Path: EdkModulePkg\Bus\Pci\Undi\RuntimeDxe\Undi.msa-->
- <ModuleSA ModuleGuid="A1f436EA-A127-4EF8-957C-8048606FF670" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IA32">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDriverModelLib Path: MdePkg\Library\UefiDriverModelLib\UefiDriverModelLib.msa-->
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkUefiRuntimeLib Path: EdkModulePkg\Library\EdkUefiRuntimeLib\EdkUefiRuntimeLib.msa-->
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->
- <Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseDebugLibNull Path: MdePkg\Library\BaseDebugLibNull\BaseDebugLibNull.msa-->
- <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: Undi Type: DXE_RUNTIME_DRIVER Path: EdkModulePkg\Bus\Pci\Undi\RuntimeDxe\Undi.msa-->
- <ModuleSA ModuleGuid="A1f436EA-A127-4EF8-957C-8048606FF670" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="X64">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiDriverModelLib Path: MdePkg\Library\UefiDriverModelLib\UefiDriverModelLib.msa-->
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkUefiRuntimeLib Path: EdkModulePkg\Library\EdkUefiRuntimeLib\EdkUefiRuntimeLib.msa-->
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->
- <Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseDebugLibNull Path: MdePkg\Library\BaseDebugLibNull\BaseDebugLibNull.msa-->
- <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: Undi Type: DXE_RUNTIME_DRIVER Path: EdkModulePkg\Bus\Pci\Undi\RuntimeDxe\Undi.msa-->
- <ModuleSA ModuleGuid="A1f436EA-A127-4EF8-957C-8048606FF670" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IPF">
- <Libraries>
- <!--Pkg: EdkModulePkg Mod: EdkUefiRuntimeLib Path: EdkModulePkg\Library\EdkUefiRuntimeLib\EdkUefiRuntimeLib.msa-->
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: ItaniumPlatformPkg Mod: DxeRuntimeExtendedSalLib Path: R9\ItaniumPlatformPkg\DxeRuntimeExtendedSalLib\DxeRuntimeExtendedSalLib.msa-->
- <Instance ModuleGuid="36270801-b4db-45ac-a36f-53e674cf0612" PackageGuid="9082e5e9-5651-4a50-8b5d-7f50b387ce7f"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDriverModelLib Path: MdePkg\Library\UefiDriverModelLib\UefiDriverModelLib.msa-->
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->
- <Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseDebugLibNull Path: MdePkg\Library\BaseDebugLibNull\BaseDebugLibNull.msa-->
- <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: Undi Type: DXE_RUNTIME_DRIVER Path: EdkModulePkg\Bus\Pci\Undi\RuntimeDxe\Undi.msa-->
- <ModuleSA ModuleGuid="A1f436EA-A127-4EF8-957C-8048606FF670" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="EBC">
- <Libraries>
- <!--Pkg: EdkModulePkg Mod: EdkUefiRuntimeLib Path: EdkModulePkg\Library\EdkUefiRuntimeLib\EdkUefiRuntimeLib.msa-->
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDriverModelLib Path: MdePkg\Library\UefiDriverModelLib\UefiDriverModelLib.msa-->
- <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->
- <Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseDebugLibNull Path: MdePkg\Library\BaseDebugLibNull\BaseDebugLibNull.msa-->
- <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdComponentNameDisable</C_Name>
- <Token>0x0000000d</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDriverDiagnosticsDisable</C_Name>
- <Token>0x0000000e</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: DebugSupport Type: DXE_DRIVER Path: EdkModulePkg\Universal\DebugSupport\Dxe\DebugSupport.msa-->
- <ModuleSA ModuleGuid="911D584C-35F7-4955-BEF9-B452769DDC3A" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IA32">
- <Libraries>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdNtEmulatorEnable</C_Name>
- <Token>0x0001003e</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: DebugSupport Type: DXE_DRIVER Path: EdkModulePkg\Universal\DebugSupport\Dxe\DebugSupport.msa-->
- <ModuleSA ModuleGuid="911D584C-35F7-4955-BEF9-B452769DDC3A" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="X64">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdNtEmulatorEnable</C_Name>
- <Token>0x0001003e</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: DebugSupport Type: DXE_DRIVER Path: EdkModulePkg\Universal\DebugSupport\Dxe\DebugSupport.msa-->
- <ModuleSA ModuleGuid="911D584C-35F7-4955-BEF9-B452769DDC3A" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IPF">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdNtEmulatorEnable</C_Name>
- <Token>0x0001003e</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: DevicePath Type: DXE_DRIVER Path: EdkModulePkg\Universal\DevicePath\Dxe\DevicePath.msa-->
- <!--Mod: DevicePath Type: DXE_DRIVER Path: EdkModulePkg\Universal\DevicePath\Dxe\DevicePath.msa-->
- <ModuleSA ModuleGuid="9B680FCE-AD6B-4F3A-B60B-F59899003443" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="EBC">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDevicePathLib Path: MdePkg\Library\UefiDevicePathLib\UefiDevicePathLib.msa-->
- <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDevicePathSupportDevicePathToText</C_Name>
- <Token>0x00010037</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>
- <Token>0x00010038</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: Crc32SectionExtract Type: DXE_DRIVER Path: EdkModulePkg\Universal\FirmwareVolume\GuidedSectionExtraction\Crc32SectionExtract\Dxe\Crc32SectionExtract.msa-->
- <ModuleSA ModuleGuid="51C9F40C-5243-4473-B265-B3C8FFAFF9FA" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IA32">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: Crc32SectionExtract Type: DXE_DRIVER Path: EdkModulePkg\Universal\FirmwareVolume\GuidedSectionExtraction\Crc32SectionExtract\Dxe\Crc32SectionExtract.msa-->
- <ModuleSA ModuleGuid="51C9F40C-5243-4473-B265-B3C8FFAFF9FA" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="X64">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: Crc32SectionExtract Type: DXE_DRIVER Path: EdkModulePkg\Universal\FirmwareVolume\GuidedSectionExtraction\Crc32SectionExtract\Dxe\Crc32SectionExtract.msa-->
- <ModuleSA ModuleGuid="51C9F40C-5243-4473-B265-B3C8FFAFF9FA" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IPF">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: Crc32SectionExtract Type: DXE_DRIVER Path: EdkModulePkg\Universal\FirmwareVolume\GuidedSectionExtraction\Crc32SectionExtract\Dxe\Crc32SectionExtract.msa-->
- <ModuleSA ModuleGuid="51C9F40C-5243-4473-B265-B3C8FFAFF9FA" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="EBC">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: MonotonicCounter Type: DXE_RUNTIME_DRIVER Path: EdkModulePkg\Universal\MonotonicCounter\RuntimeDxe\MonotonicCounter.msa-->
- <ModuleSA ModuleGuid="AD608272-D07F-4964-801E-7BD3B7888652" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="EBC">
- <Libraries>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkUefiRuntimeLib Path: EdkModulePkg\Library\EdkUefiRuntimeLib\EdkUefiRuntimeLib.msa-->
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->
- <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- <!--Mod: DxeStatusCode Type: DXE_RUNTIME_DRIVER Path: EdkModulePkg\Universal\StatusCode\Dxe\DxeStatusCode.msa-->
- <ModuleSA ModuleGuid="FEDE0A1B-BCA2-4A9F-BB2B-D9FD7DEC2E9F" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3" SupArchList="IPF">
- <Libraries>
- <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->
- <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeHobLib Path: MdePkg\Library\DxeHobLib\DxeHobLib.msa-->
- <Instance ModuleGuid="f12b59c9-76d0-4661-ad7c-f04d1bef0558" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkUefiRuntimeLib Path: EdkModulePkg\Library\EdkUefiRuntimeLib\EdkUefiRuntimeLib.msa-->
- <Instance ModuleGuid="b1ee6c28-54aa-4d17-b705-3e28ccb27b2e" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiLib Path: MdePkg\Library\UefiLib\UefiLib.msa-->
- <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: ItaniumPlatformPkg Mod: DxeRuntimeExtendedSalLib Path: R9\ItaniumPlatformPkg\DxeRuntimeExtendedSalLib\DxeRuntimeExtendedSalLib.msa-->
- <Instance ModuleGuid="36270801-b4db-45ac-a36f-53e674cf0612" PackageGuid="9082e5e9-5651-4a50-8b5d-7f50b387ce7f"/>
- <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->
- <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->
- <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeReportStatusCodeLib Path: MdePkg\Library\DxeReportStatusCodeLib\DxeReportStatusCodeLib.msa-->
- <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->
- <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->
- <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkOemHookStatusCodeLibNull Path: EdkModulePkg\Library\EdkOemHookStatusCodeLibNull\EdkOemHookStatusCodeLibNull.msa-->
- <Instance ModuleGuid="54D2878F-25CD-4a2b-8420-EBD18E609C76" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: PeiDxeDebugLibReportStatusCode Path: MdePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.msa-->
- <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: EdkModulePkg Mod: EdkSerialPortLibNull Path: EdkModulePkg\Library\EdkSerialPortLibNull\EdkSerialPortLibNull.msa-->
- <Instance ModuleGuid="E4541241-8897-411a-91F8-7D7E45837146" ModuleVersion="1.0" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: DxeMemoryLib Path: MdePkg\Library\DxeMemoryLib\DxeMemoryLib.msa-->
- <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- <!--Pkg: MdePkg Mod: BaseTimerLibNullTemplate Path: MdePkg\Library\BaseTimerLibNullTemplate\BaseTimerLibNullTemplate.msa-->
- <Instance ModuleGuid="f4731d79-537e-4505-bd52-c03f9b1f6b89" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>
- </Libraries>
- <PcdBuildDefinition>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseHardSerial</C_Name>
- <Token>0x00010027</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseEfiSerial</C_Name>
- <Token>0x00010026</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseRuntimeMemory</C_Name>
- <Token>0x00010028</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseDataHub</C_Name>
- <Token>0x00010029</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <Token>0x00010024</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInSerial</C_Name>
- <Token>0x0001002a</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInDataHub</C_Name>
- <Token>0x0001002c</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInRuntimeMemory</C_Name>
- <Token>0x0001002b</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInOEM</C_Name>
- <Token>0x0001002d</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>FALSE</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdStatusCodeRuntimeMemorySize</C_Name>
- <Token>0x0001002e</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT16</DatumType>
- <MaxDatumSize>2</MaxDatumSize>
- <Value>4</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdUefiLibMaxPrintBufferSize</C_Name>
- <Token>0x101</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>320</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumUnicodeStringLength</C_Name>
- <Token>0x00000001</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumAsciiStringLength</C_Name>
- <Token>0x00000002</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaximumLinkedListLength</C_Name>
- <Token>0x00000003</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>1000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdSpinLockTimeout</C_Name>
- <Token>0x00000004</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>10000000</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdReportStatusCodePropertyMask</C_Name>
- <Token>0x00000007</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x06</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <Token>0x00000005</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0x0f</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <Token>0x00000008</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <MaxDatumSize>1</MaxDatumSize>
- <Value>0xAF</Value>
- </PcdData>
- <PcdData ItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <Token>0x00000006</Token>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <Value>0x80000000</Value>
- </PcdData>
- </PcdBuildDefinition>
- <ModuleSaBuildOptions>
- <FvBinding>NULL</FvBinding>
- <FfsFormatKey>BS_DRIVER</FfsFormatKey>
- </ModuleSaBuildOptions>
- </ModuleSA>
- </FrameworkModules>
- <DynamicPcdBuildDefinitions>
- <PcdBuildData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <Token>0x30000001</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <SkuInfo>
- <SkuId>0</SkuId>
- <Value>0x0</Value>
- </SkuInfo>
- </PcdBuildData>
- <PcdBuildData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableSize</C_Name>
- <Token>0x30000002</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <SkuInfo>
- <SkuId>0</SkuId>
- <Value>0x0</Value>
- </SkuInfo>
- </PcdBuildData>
- <PcdBuildData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>
- <Token>0x30000010</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <SkuInfo>
- <SkuId>0</SkuId>
- <Value>0x0</Value>
- </SkuInfo>
- </PcdBuildData>
- <PcdBuildData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>
- <Token>0x30000011</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <SkuInfo>
- <SkuId>0</SkuId>
- <Value>0x0</Value>
- </SkuInfo>
- </PcdBuildData>
- <PcdBuildData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>
- <Token>0x30000013</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <SkuInfo>
- <SkuId>0</SkuId>
- <Value>0x0</Value>
- </SkuInfo>
- </PcdBuildData>
- <PcdBuildData ItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>
- <Token>0x30000014</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <MaxDatumSize>4</MaxDatumSize>
- <SkuInfo>
- <SkuId>0</SkuId>
- <Value>0x0</Value>
- </SkuInfo>
- </PcdBuildData>
- </DynamicPcdBuildDefinitions>
- <BuildOptions>
- <Ffs FfsKey="APPLICATION">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_APPLICATION"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections EncapsulationType="Compress">
- <Sections EncapsulationType="Guid-Defined">
- <Section SectionType="EFI_SECTION_PE32"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Sections>
- </Ffs>
- <Ffs FfsKey="BINARY">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections EncapsulationType="Compress">
- <Sections EncapsulationType="Guid-Defined">
- <Section SectionType="EFI_SECTION_RAW"/>
- </Sections>
- </Sections>
- </Ffs>
- <Ffs FfsKey="FILE">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections>
- <Section SectionType="EFI_SECTION_RAW"/>
- </Sections>
- </Ffs>
- <Ffs FfsKey="PE32_PEIM_CompressPEIM">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections>
- <Section SectionType="EFI_SECTION_PEI_DEPEX"/>
- <Sections EncapsulationType="Compress">
- <Section SectionType="EFI_SECTION_PE32"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Sections>
- </Ffs>
- <Ffs FfsKey="PEI_CORE">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEI_CORE"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections>
- <Section SectionType="EFI_SECTION_PE32"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Ffs>
- <Ffs FfsKey="PE32_PEIM_Relocatable">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections>
- <Section SectionType="EFI_SECTION_PEI_DEPEX"/>
- <Section SectionType="EFI_SECTION_PE32"/>
- </Sections>
- </Ffs>
- <Ffs FfsKey="DXE_CORE">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DXE_CORE"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections EncapsulationType="Compress">
- <Section SectionType="EFI_SECTION_PE32"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Ffs>
- <Ffs FfsKey="BS_DRIVER">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections EncapsulationType="Compress">
- <Sections EncapsulationType="Guid-Defined">
- <Section SectionType="EFI_SECTION_PEI_DEPEX"/>
- <Section SectionType="EFI_SECTION_PE32"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Sections>
- </Ffs>
- <Ffs FfsKey="RT_DRIVER">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections EncapsulationType="Compress">
- <Sections EncapsulationType="Guid-Defined">
- <Section SectionType="EFI_SECTION_PEI_DEPEX"/>
- <Section SectionType="EFI_SECTION_PE32"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Sections>
- </Ffs>
- <Ffs FfsKey="SAL_RT_DRIVER">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_DRIVER"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections EncapsulationType="Compress">
- <Sections EncapsulationType="Guid-Defined">
- <Section SectionType="EFI_SECTION_PEI_DEPEX"/>
- <Section SectionType="EFI_SECTION_PE32"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Sections>
- </Ffs>
- <Ffs FfsKey="COMBINED_PEIM_DRIVER">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections>
- <Section SectionType="EFI_SECTION_PEI_DEPEX"/>
- <Section SectionType="EFI_SECTION_PE32"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Ffs>
- <Ffs FfsKey="PE32_PEIM">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections>
- <Section SectionType="EFI_SECTION_PEI_DEPEX"/>
- <Section SectionType="EFI_SECTION_PE32"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Ffs>
- <Ffs FfsKey="Logo">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_FREEFORM"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Sections EncapsulationType="Compress">
- <Sections EncapsulationType="Guid-Defined">
- <Section SectionType="EFI_SECTION_RAW"/>
- </Sections>
- </Sections>
- </Ffs>
- <Ffs FfsKey="IPF_PE32_PEIM">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEIM"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Attribute Name="FFS_ATTRIB_DATA_ALIGNMENT" Value="1"/>
- <!--The PE32 should align on 16 bytes boundary.-->
- <Sections>
- <Section SectionType="EFI_SECTION_PE32" Alignment="1"/>
- <Section SectionType="EFI_SECTION_PEI_DEPEX"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Ffs>
- <Ffs FfsKey="IPF_PEI_CORE">
- <Attribute Name="FFS_FILETYPE" Value="EFI_FV_FILETYPE_PEI_CORE"/>
- <Attribute Name="FFS_ATTRIB_CHECKSUM" Value="TRUE"/>
- <Attribute Name="FFS_ATTRIB_DATA_ALIGNMENT" Value="1"/>
- <!--The PE32 should align on 16 bytes boundary.-->
- <Sections>
- <Section SectionType="EFI_SECTION_PE32" Alignment="1"/>
- <Section SectionType="EFI_SECTION_USER_INTERFACE"/>
- <Section SectionType="EFI_SECTION_VERSION"/>
- </Sections>
- </Ffs>
- </BuildOptions>
-</PlatformSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/EdkModulePkg.spd b/EdkModulePkg/EdkModulePkg.spd
deleted file mode 100644
index 00e7e5c..0000000
--- a/EdkModulePkg/EdkModulePkg.spd
+++ /dev/null
@@ -1,1296 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<PackageSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <SpdHeader>
- <PackageName>EdkModulePkg</PackageName>
- <GuidValue>68169ab0-d41b-4009-9060-292c253ac43d</GuidValue>
- <Version>0.3</Version>
- <Abstract>Edk Module Package Reference Implementations</Abstract>
- <Description>This Module provides standard reference information for EFI/Tiano implementations.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved.
- This program and the accompanying materials are licensed and made available
- under the terms and conditions of the BSD License which accompanies this distribution.
- The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES
- OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </SpdHeader>
- <PackageDefinitions>
- <ReadOnly>false</ReadOnly>
- <RePackage>false</RePackage>
- </PackageDefinitions>
- <LibraryClassDeclarations>
- <LibraryClass Name="CustomDecompressLib">
- <IncludeHeader>Include/Library/CustomDecompressLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="EdkDxeSalLib">
- <IncludeHeader>Include/Library/EdkDxeSalLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="ExtendedSalLib">
- <IncludeHeader>Include/Library/ExtendedSalLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="EdkFvbServiceLib">
- <IncludeHeader>Include/Library/EdkFvbServiceLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="EdkGraphicsLib">
- <IncludeHeader>Include/Library/EdkGraphicsLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="EdkIfrSupportLib">
- <IncludeHeader>Include/Library/EdkIfrSupportLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="EdkPeCoffLoaderLib">
- <IncludeHeader>Include/Library/EdkPeCoffLoaderLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="EdkScsiLib">
- <IncludeHeader>Include/Library/EdkScsiLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="EdkUsbLib">
- <IncludeHeader>Include/Library/EdkUsbLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="TianoDecompressLib">
- <IncludeHeader>Include/Library/TianoDecompressLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="SerialPortLib">
- <IncludeHeader>Include/Library/SerialPortLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="OemHookStatusCodeLib">
- <IncludeHeader>Include/Library/OemHookStatusCodeLib.h</IncludeHeader>
- <HelpText/>
- </LibraryClass>
- <LibraryClass Name="EdkGenericBdsLib">
- <IncludeHeader>Include/Library/EdkGenericBdsLib.h</IncludeHeader>
- <HelpText>Library to implement a Bbs</HelpText>
- </LibraryClass>
- <LibraryClass Name="EdkGenericPlatformBdsLib">
- <IncludeHeader>Include/Library/EdkGenericPlatformBdsLib.h</IncludeHeader>
- <HelpText>Generic Platform Bds library</HelpText>
- </LibraryClass>
- <LibraryClass Name="PciIncompatibleDeviceSupportLib">
- <IncludeHeader>Include/Library/PciIncompatibleDeviceSupportLib.h</IncludeHeader>
- <HelpText>This library includes the PCI incompatible devices list.</HelpText>
- </LibraryClass>
- </LibraryClassDeclarations>
- <IndustryStdIncludes>
- <IndustryStdHeader Name="CapsuleName">
- <IncludeHeader>Include/Common/CapsuleName.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="DecompressLibraryHob">
- <IncludeHeader>Include/Common/DecompressLibraryHob.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="FlashMap">
- <IncludeHeader>Include/Common/FlashMap.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="Variable">
- <IncludeHeader>Include/Common/Variable.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="WorkingBlockHeader">
- <IncludeHeader>Include/Common/WorkingBlockHeader.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="AlternateFvBlock">
- <IncludeHeader>Include/Guid/AlternateFvBlock.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="Bmp">
- <IncludeHeader>Include/Guid/Bmp.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="BootState">
- <IncludeHeader>Include/Guid/BootState.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="CapsuleVendor">
- <IncludeHeader>Include/Guid/CapsuleVendor.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="CompatibleMemoryTested">
- <IncludeHeader>Include/Guid/CompatibleMemoryTested.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="ConsoleInDevice">
- <IncludeHeader>Include/Guid/ConsoleInDevice.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="ConsoleOutDevice">
- <IncludeHeader>Include/Guid/ConsoleOutDevice.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="ExtendedSalGuid">
- <IncludeHeader>Include/Guid/ExtendedSalGuid.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="FlashMapHob">
- <IncludeHeader>Include/Guid/FlashMapHob.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="HotPlugDevice">
- <IncludeHeader>Include/Guid/HotPlugDevice.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="MemoryTypeInformation">
- <IncludeHeader>Include/Guid/MemoryTypeInformation.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="MiniShellFile">
- <IncludeHeader>Include/Guid/MiniShellFile.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PciHotplugDevice">
- <IncludeHeader>Include/Guid/PciHotplugDevice.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PciOptionRomTable">
- <IncludeHeader>Include/Guid/PciOptionRomTable.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PeiPeCoffLoader">
- <IncludeHeader>Include/Guid/PeiPeCoffLoader.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PeiPerformanceHob">
- <IncludeHeader>Include/Guid/PeiPerformanceHob.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PrimaryConsoleInDevice">
- <IncludeHeader>Include/Guid/PrimaryConsoleInDevice.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PrimaryConsoleOutDevice">
- <IncludeHeader>Include/Guid/PrimaryConsoleOutDevice.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PrimaryStandardErrorDevice">
- <IncludeHeader>Include/Guid/PrimaryStandardErrorDevice.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="ShellFile">
- <IncludeHeader>Include/Guid/ShellFile.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="StandardErrorDevice">
- <IncludeHeader>Include/Guid/StandardErrorDevice.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="StatusCode">
- <IncludeHeader>Include/Guid/StatusCode.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="StatusCodeCallerId">
- <IncludeHeader>Include/Guid/StatusCodeCallerId.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="SystemNvDataGuid">
- <IncludeHeader>Include/Guid/SystemNvDataGuid.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="CustomDecompressLib">
- <IncludeHeader>Include/Library/CustomDecompressLib.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkDxeSalLib">
- <IncludeHeader>Include/Library/EdkDxeSalLib.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="ExtendedSalLib">
- <IncludeHeader>Include/Library/ExtendedSalLib.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkFvbServiceLib">
- <IncludeHeader>Include/Library/EdkFvbServiceLib.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkGraphicsLib">
- <IncludeHeader>Include/Library/EdkGraphicsLib.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkIfrSupportLib">
- <IncludeHeader>Include/Library/EdkIfrSupportLib.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkPeCoffLoaderLib">
- <IncludeHeader>Include/Library/EdkPeCoffLoaderLib.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkScsiLib">
- <IncludeHeader>Include/Library/EdkScsiLib.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkUsbLib">
- <IncludeHeader>Include/Library/EdkUsbLib.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="TianoDecompressLib">
- <IncludeHeader>Include/Library/TianoDecompressLib.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="BaseMemoryTest">
- <IncludeHeader>Include/Ppi/BaseMemoryTest.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="FlashMap">
- <IncludeHeader>Include/Ppi/FlashMap.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PeiInMemory">
- <IncludeHeader>Include/Ppi/PeiInMemory.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="StatusCodeMemory">
- <IncludeHeader>Include/Ppi/StatusCodeMemory.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="AcpiS3Save">
- <IncludeHeader>Include/Protocol/AcpiS3Save.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="Capsule">
- <IncludeHeader>Include/Protocol/Capsule.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="ConsoleControl">
- <IncludeHeader>Include/Protocol/ConsoleControl.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="CustomizedDecompress">
- <IncludeHeader>Include/Protocol/CustomizedDecompress.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="DebugAssert">
- <IncludeHeader>Include/Protocol/DebugAssert.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="DebugLevel">
- <IncludeHeader>Include/Protocol/DebugLevel.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="DiskInfo">
- <IncludeHeader>Include/Protocol/DiskInfo.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkDecompress">
- <IncludeHeader>Include/Protocol/EdkDecompress.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="ExtendedSalBootService">
- <IncludeHeader>Include/Protocol/ExtendedSalBootService.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="FaultTolerantWriteLite">
- <IncludeHeader>Include/Protocol/FaultTolerantWriteLite.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="FvbExtension">
- <IncludeHeader>Include/Protocol/FvbExtension.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="GenericMemoryTest">
- <IncludeHeader>Include/Protocol/GenericMemoryTest.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="IsaAcpi">
- <IncludeHeader>Include/Protocol/IsaAcpi.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="IsaIo">
- <IncludeHeader>Include/Protocol/IsaIo.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="LoadPe32Image">
- <IncludeHeader>Include/Protocol/LoadPe32Image.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="OEMBadging">
- <IncludeHeader>Include/Protocol/OEMBadging.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PciHotPlugRequest">
- <IncludeHeader>Include/Protocol/PciHotPlugRequest.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="Performance">
- <IncludeHeader>Include/Protocol/Performance.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="Print">
- <IncludeHeader>Include/Protocol/Print.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PxeDhcp4">
- <IncludeHeader>Include/Protocol/PxeDhcp4.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="PxeDhcp4CallBack">
- <IncludeHeader>Include/Protocol/PxeDhcp4CallBack.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="ScsiIo">
- <IncludeHeader>Include/Protocol/ScsiIo.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="UgaIo">
- <IncludeHeader>Include/Protocol/UgaIo.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="UgaSplash">
- <IncludeHeader>Include/Protocol/UgaSplash.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="usbatapi">
- <IncludeHeader>Include/Protocol/usbatapi.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkDxe">
- <IncludeHeader>Include/EdkDxe.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkDxeCore">
- <IncludeHeader>Include/EdkDxeCore.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkPeiCore">
- <IncludeHeader>Include/EdkPeiCore.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- <IndustryStdHeader Name="EdkPeim">
- <IncludeHeader>Include/EdkPeim.h</IncludeHeader>
- <HelpText/>
- </IndustryStdHeader>
- </IndustryStdIncludes>
- <MsaFiles>
- <Filename>Application/HelloWorld/HelloWorld.msa</Filename>
- <Filename>Bus/Pci/AtapiPassThru/Dxe/AtapiPassThru.msa</Filename>
- <Filename>Bus/Pci/CirrusLogic/Dxe/CirrusLogic5430.msa</Filename>
- <Filename>Bus/Pci/IdeBus/Dxe/idebus.msa</Filename>
- <Filename>Bus/Pci/PciBus/Dxe/PciBus.msa</Filename>
- <Filename>Bus/Pci/Uhci/Dxe/Uhci.msa</Filename>
- <Filename>Bus/Pci/Ehci/Dxe/Ehci.msa</Filename>
- <Filename>Bus/Pci/Undi/RuntimeDxe/Undi.msa</Filename>
- <Filename>Bus/Scsi/ScsiBus/Dxe/ScsiBus.msa</Filename>
- <Filename>Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.msa</Filename>
- <Filename>Bus/Usb/UsbBot/Dxe/UsbBot.msa</Filename>
- <Filename>Bus/Usb/UsbBus/Dxe/UsbBus.msa</Filename>
- <Filename>Bus/Usb/UsbCbi/Dxe/Cbi0/UsbCbi0.msa</Filename>
- <Filename>Bus/Usb/UsbCbi/Dxe/Cbi1/UsbCbi1.msa</Filename>
- <Filename>Bus/Usb/UsbKb/Dxe/UsbKb.msa</Filename>
- <Filename>Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.msa</Filename>
- <Filename>Bus/Usb/UsbMouse/Dxe/UsbMouse.msa</Filename>
- <Filename>Core/Dxe/DxeMain.msa</Filename>
- <Filename>Core/DxeIplPeim/DxeIpl.msa</Filename>
- <Filename>Core/Pei/PeiMain.msa</Filename>
- <Filename>Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.msa</Filename>
- <Filename>Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.msa</Filename>
- <Filename>Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.msa</Filename>
- <Filename>Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa</Filename>
- <Filename>Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.msa</Filename>
- <Filename>Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.msa</Filename>
- <Filename>Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.msa</Filename>
- <Filename>Library/EdkDxePeCoffLoaderFromHobLib/EdkDxePeCoffLoaderFromHobLib.msa</Filename>
- <Filename>Library/DxePerformanceLib/DxePerformanceLib.msa</Filename>
- <Filename>Library/EdkDxePrintLib/EdkDxePrintLib.msa</Filename>
- <Filename>Library/EdkUefiRuntimeLib/EdkUefiRuntimeLib.msa</Filename>
- <Filename>Library/EdkDxeSalLib/EdkDxeSalLib.msa</Filename>
- <Filename>Library/EdkDxeRuntimeSalLib/EdkDxeRuntimeSalLib.msa</Filename>
- <Filename>Library/EdkFvbServiceLib/EdkFvbServiceLib.msa</Filename>
- <Filename>Library/EdkGraphicsLib/EdkGraphicsLib.msa</Filename>
- <Filename>Library/EdkIfrSupportLib/EdkIfrSupportLib.msa</Filename>
- <Filename>Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa</Filename>
- <Filename>Library/PeiPerformanceLib/PeiPerformanceLib.msa</Filename>
- <Filename>Library/EdkScsiLib/EdkScsiLib.msa</Filename>
- <Filename>Library/EdkUsbLib/EdkUsbLib.msa</Filename>
- <Filename>Library/EdkSerialPortLibNull/EdkSerialPortLibNull.msa</Filename>
- <Filename>Library/EdkOemHookStatusCodeLibNull/EdkOemHookStatusCodeLibNull.msa</Filename>
- <Filename>Library/EdkGenericBdsLib/EdkGenericBdsLib.msa</Filename>
- <Filename>Library/EdkGenericPlatformBdsLib/EdkGenericPlatformBdsLib.msa</Filename>
- <Filename>Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa</Filename>
- <Filename>Universal/Console/ConSplitter/Dxe/ConSplitter.msa</Filename>
- <Filename>Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa</Filename>
- <Filename>Universal/Console/Terminal/Dxe/Terminal.msa</Filename>
- <Filename>Universal/DataHub/DataHub/Dxe/DataHub.msa</Filename>
- <Filename>Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.msa</Filename>
- <Filename>Universal/DevicePath/Dxe/DevicePath.msa</Filename>
- <Filename>Universal/Debugger/Debugport/Dxe/DebugPort.msa</Filename>
- <Filename>Universal/DebugSupport/Dxe/DebugSupport.msa</Filename>
- <Filename>Universal/Disk/DiskIo/Dxe/DiskIo.msa</Filename>
- <Filename>Universal/Disk/Partition/Dxe/Partition.msa</Filename>
- <Filename>Universal/Disk/UnicodeCollation/English/Dxe/English.msa</Filename>
- <Filename>Universal/Ebc/Dxe/Ebc.msa</Filename>
- <Filename>Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.msa</Filename>
- <Filename>Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.msa</Filename>
- <Filename>Universal/GenericMemoryTest/Dxe/NullMemoryTest.msa</Filename>
- <Filename>Universal/GenericMemoryTest/Pei/BaseMemoryTest.msa</Filename>
- <Filename>Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.msa</Filename>
- <Filename>Universal/Network/PxeBc/Dxe/BC.msa</Filename>
- <Filename>Universal/Network/PxeDhcp4/Dxe/Dhcp4.msa</Filename>
- <Filename>Universal/Network/Snp32_64/Dxe/SNP.msa</Filename>
- <Filename>Universal/PCD/Pei/Pcd.msa</Filename>
- <Filename>Universal/PCD/Dxe/Pcd.msa</Filename>
- <Filename>Universal/Runtime/RuntimeDxe/Runtime.msa</Filename>
- <Filename>Universal/Security/SecurityStub/Dxe/SecurityStub.msa</Filename>
- <Filename>Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.msa</Filename>
- <Filename>Universal/UserInterface/DriverSample/DriverSample.msa</Filename>
- <Filename>Universal/UserInterface/SetupBrowser/Dxe/SetupBrowser.msa</Filename>
- <Filename>Universal/Variable/Pei/Variable.msa</Filename>
- <Filename>Universal/EmuVariable/RuntimeDxe/EmuVariable.msa</Filename>
- <Filename>Universal/EmuVariable/RuntimeDxe/EmuVariableIpf.msa</Filename>
- <Filename>Universal/Variable/RuntimeDxe/Variable.msa</Filename>
- <Filename>Universal/Variable/RuntimeDxe/VariableIpf.msa</Filename>
- <Filename>Universal/Capsule/RuntimeDxe/CapsuleRuntime.msa</Filename>
- <Filename>Universal/WatchdogTimer/Dxe/WatchDogTimer.msa</Filename>
- <Filename>Universal/StatusCode/Pei/PeiStatusCode.msa</Filename>
- <Filename>Universal/StatusCode/Dxe/DxeStatusCode.msa</Filename>
- <Filename>Universal/ConPlatform/Dxe/ConPlatform.msa</Filename>
- <Filename>Logo/Logo.msa</Filename>
- </MsaFiles>
- <PackageHeaders>
- <IncludePkgHeader ModuleType="SEC">Include/EdkPeim.h</IncludePkgHeader>
- <IncludePkgHeader ModuleType="PEI_CORE">Include/EdkPeiCore.h</IncludePkgHeader>
- <IncludePkgHeader ModuleType="PEIM">Include/EdkPeim.h</IncludePkgHeader>
- <IncludePkgHeader ModuleType="DXE_CORE">Include/EdkDxeCore.h</IncludePkgHeader>
- <IncludePkgHeader ModuleType="DXE_DRIVER">Include/EdkDxe.h</IncludePkgHeader>
- <IncludePkgHeader ModuleType="DXE_RUNTIME_DRIVER">Include/EdkDxe.h</IncludePkgHeader>
- <IncludePkgHeader ModuleType="DXE_SMM_DRIVER">Include/EdkDxe.h</IncludePkgHeader>
- <IncludePkgHeader ModuleType="DXE_SAL_DRIVER">Include/EdkDxe.h</IncludePkgHeader>
- <IncludePkgHeader ModuleType="UEFI_DRIVER">Include/EdkDxe.h</IncludePkgHeader>
- </PackageHeaders>
- <GuidDeclarations>
- <Entry Name="GenericPlatformTokenSpace">
- <C_Name>gEfiGenericPlatformTokenSpaceGuid</C_Name>
- <GuidValue>18D15EA6-9E14-40a1-B39C-59C44DA9D891</GuidValue>
- <HelpText>This is the token space GUID for platform generic PCD definitions.
- Now FlashLayout and Platform CPU belong to this space.</HelpText>
- </Entry>
- <Entry Name="EdkModulePkgTokenSpace">
- <C_Name>gEfiEdkModulePkgTokenSpaceGuid</C_Name>
- <GuidValue>8CC4092F-F60E-46d1-B41C-1E761DF50582</GuidValue>
- <HelpText>All PCD define in EdkModulePkg is in this token space scope</HelpText>
- </Entry>
- <Entry Name="PcdDataBaseHob">
- <C_Name>gPcdDataBaseHobGuid</C_Name>
- <GuidValue>EA296D92-0B69-423C-8C28-33B4E0A91268</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PcdPeiCallbackFnTable">
- <C_Name>gPcdPeiCallbackFnTableHobGuid</C_Name>
- <GuidValue>C625F4B2-EA09-4675-82D7-BA3682157A14</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PeiPeCoffLoader">
- <C_Name>gEfiPeiPeCoffLoaderGuid</C_Name>
- <GuidValue>D8117CFF-94A6-11D4-9A3A-0090273FC14D</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="FlashMapHob">
- <C_Name>gEfiFlashMapHobGuid</C_Name>
- <GuidValue>B091E7D2-05A0-4198-94F0-74B7B8C55459</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="SystemNvDataHob">
- <C_Name>gEfiSystemNvDataHobGuid</C_Name>
- <GuidValue>D6E5092D-C7B2-4872-AF66-FDC0E6F95E78</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="SystemNvDataFv">
- <C_Name>gEfiSystemNvDataFvGuid</C_Name>
- <GuidValue>FFF12B8D-7696-4C8B-A985-2747075B4F50</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="DiskInfoIde">
- <C_Name>gEfiDiskInfoIdeInterfaceGuid</C_Name>
- <GuidValue>5E948FE3-26D3-42B5-AF17-610287188DEC</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="DiskInfoScsi">
- <C_Name>gEfiDiskInfoScsiInterfaceGuid</C_Name>
- <GuidValue>08F74BAA-EA36-41D9-9521-21A70F8780BC</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="DiskInfoUsb">
- <C_Name>gEfiDiskInfoUsbInterfaceGuid</C_Name>
- <GuidValue>CB871572-C11A-47B5-B492-675EAFA77727</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="AlternateFvBlock">
- <C_Name>gEfiAlternateFvBlockGuid</C_Name>
- <GuidValue>F496922D-172F-4BBC-A1EB-0EEB949C3486</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ConsoleInDevice">
- <C_Name>gEfiConsoleInDeviceGuid</C_Name>
- <GuidValue>D3B36F2B-D551-11D4-9A46-0090273FC14D</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ConsoleOutDevice">
- <C_Name>gEfiConsoleOutDeviceGuid</C_Name>
- <GuidValue>D3B36F2C-D551-11D4-9A46-0090273FC14D</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="StandardErrorDevice">
- <C_Name>gEfiStandardErrorDeviceGuid</C_Name>
- <GuidValue>D3B36F2D-D551-11D4-9A46-0090273FC14D</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="HotPlugDevice">
- <C_Name>gEfiHotPlugDeviceGuid</C_Name>
- <GuidValue>220AC432-1D43-49E5-A74F-4C9DA67AD23B</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PrimaryStandardErrorDevice">
- <C_Name>gEfiPrimaryStandardErrorDeviceGuid</C_Name>
- <GuidValue>5A68191B-9B97-4752-9946-E36A5DA942B1</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PrimaryConsoleInDevice">
- <C_Name>gEfiPrimaryConsoleInDeviceGuid</C_Name>
- <GuidValue>E451DCBE-96A1-4729-A5CF-6B9C2CFF47FD</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PrimaryConsoleOutDevice">
- <C_Name>gEfiPrimaryConsoleOutDeviceGuid</C_Name>
- <GuidValue>62BDF38A-E3D5-492C-950C-23A7F66E672E</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="Bmp">
- <C_Name>gEfiDefaultBmpLogoGuid</C_Name>
- <GuidValue>7BB28B99-61BB-11D5-9A5D-0090273FC14D</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="BootState">
- <C_Name>gEfiBootStateGuid</C_Name>
- <GuidValue>60B5E939-0FCF-4227-BA83-6BBED45BC0E3</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ShellFile">
- <C_Name>gEfiShellFileGuid</C_Name>
- <GuidValue>C57AD6B7-0515-40A8-9D21-551652854E37</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="MiniShellFile">
- <C_Name>gEfiMiniShellFileGuid</C_Name>
- <GuidValue>86AD232B-D33A-465C-BF5F-41370BA92FE2</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="StatusCode">
- <C_Name>gEfiStatusCodeGuid</C_Name>
- <GuidValue>D083E94C-6560-42E4-B6D4-2DF75ADF6A2A</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PciOptionRomTable">
- <C_Name>gEfiPciOptionRomTableGuid</C_Name>
- <GuidValue>7462660F-1CBD-48DA-AD11-91717913831C</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PciHotplugDevice">
- <C_Name>gEfiPciHotplugDeviceGuid</C_Name>
- <GuidValue>0B280816-52E7-4E51-AA57-11BD41CBEFC3</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="MemoryTypeInformation">
- <C_Name>gEfiMemoryTypeInformationGuid</C_Name>
- <GuidValue>4C19049F-4137-4DD3-9C10-8B97A83FFDFA</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="CapsuleVendor">
- <C_Name>gEfiCapsuleVendorGuid</C_Name>
- <GuidValue>711C703F-C285-4B10-A3B0-36ECBD3C8BE2</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="CompatibleMemoryTested">
- <C_Name>gEfiCompatibleMemoryTestedGuid</C_Name>
- <GuidValue>64C475EF-344B-492C-93AD-AB9EB4395004</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PeiPerformanceHob">
- <C_Name>gPeiPerformanceHobGuid</C_Name>
- <GuidValue>EC4DF5AF-4395-4CC9-94DE-77506D12C7B8</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="MemoryStatusCodeRecord">
- <C_Name>gMemoryStatusCodeRecordGuid</C_Name>
- <GuidValue>060CC026-4C0D-4DDA-8F41-595FEF00A502</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="EfiPeiCorePrivateGuid">
- <C_Name>gEfiPeiCorePrivateGuid</C_Name>
- <GuidValue>d641a0f5-cb7c-4846-a380-1d01b4d9e3b9</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="GenericPlatformVariable" GuidTypeList="EFI_VARIABLE">
- <C_Name>gEfiGenericPlatformVariableGuid</C_Name>
- <GuidValue>59d1c24f-50f1-401a-b101-f33e0daed443</GuidValue>
- <HelpText>The variable space Guid to pair with a Unicode string name to tag an EFI variable</HelpText>
- </Entry>
- </GuidDeclarations>
- <ProtocolDeclarations>
- <Entry Name="Capsule">
- <C_Name>gEfiCapsuleArchProtocolGuid</C_Name>
- <GuidValue>5053697E-2EBC-4819-90D9-0580DEEE5754</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="CustomizedDecompress">
- <C_Name>gEfiCustomizedDecompressProtocolGuid</C_Name>
- <GuidValue>9A44198E-A4A2-44E6-8A1F-39BEFDAC896F</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="DebugLevel">
- <C_Name>gEfiDebugLevelProtocolGuid</C_Name>
- <GuidValue>8D4C62E6-CD98-4E1D-AD6E-48BB50D29FF7</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="TianoDecompress">
- <C_Name>gEfiTianoDecompressProtocolGuid</C_Name>
- <GuidValue>E84CF29C-191F-4EAE-96E1-F46AECEAEA0B</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="LoadPeImage">
- <C_Name>gEfiLoadPeImageProtocolGuid</C_Name>
- <GuidValue>5CB5C776-60D5-45EE-883C-452708CD743F</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="Print">
- <C_Name>gEfiPrintProtocolGuid</C_Name>
- <GuidValue>DF2D868E-32FC-4CF0-8E6B-FFD95D1343D0</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="GenericMemTest">
- <C_Name>gEfiGenericMemTestProtocolGuid</C_Name>
- <GuidValue>309DE7F1-7F5E-4ACE-B49C-531BE5AA95EF</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="DiskInfo">
- <C_Name>gEfiDiskInfoProtocolGuid</C_Name>
- <GuidValue>D432A67F-14DC-484B-B3BB-3F0291849327</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="FvbExtension">
- <C_Name>gEfiFvbExtensionProtocolGuid</C_Name>
- <GuidValue>53A4C71B-B581-4170-91B3-8DB87A4B5C46</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="FaultTolerantWriteLite">
- <C_Name>gEfiFaultTolerantWriteLiteProtocolGuid</C_Name>
- <GuidValue>3F557189-8DAE-45AE-A0B3-2B99CA7AA7A0</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ConsoleControl">
- <C_Name>gEfiConsoleControlProtocolGuid</C_Name>
- <GuidValue>F42F7782-012E-4C12-9956-49F94304F721</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="OEMBadging">
- <C_Name>gEfiOEMBadgingProtocolGuid</C_Name>
- <GuidValue>170E13C0-BF1B-4218-871D-2ABDC6F887BC</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="UgaSplash">
- <C_Name>gEfiUgaSplashProtocolGuid</C_Name>
- <GuidValue>A45B3A0D-2E55-4C03-AD9C-27D4820B507E</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="AcpiS3Save">
- <C_Name>gEfiAcpiS3SaveProtocolGuid</C_Name>
- <GuidValue>125F2DE1-FB85-440C-A54C-4D99358A8D38</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PxeDhcp4">
- <C_Name>gEfiPxeDhcp4ProtocolGuid</C_Name>
- <GuidValue>03C4E624-AC28-11D3-9A2D-0090293FC14D</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PxeDhcp4Callback">
- <C_Name>gEfiPxeDhcp4CallbackProtocolGuid</C_Name>
- <GuidValue>C1544C01-92A4-4198-8A84-778583C23621</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="UgaIo">
- <C_Name>gEfiUgaIoProtocolGuid</C_Name>
- <GuidValue>61A4D49E-6F68-4F1B-B922-A86EED0B07A2</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="DebugAssert">
- <C_Name>gEfiDebugAssertProtocolGuid</C_Name>
- <GuidValue>BE499C92-7D4B-11D4-BCEE-0080C73C8881</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="UsbAtapi">
- <C_Name>gEfiUsbAtapiProtocolGuid</C_Name>
- <GuidValue>2B2F68DA-0CD2-44CF-8E8B-BBA20B1B5B75</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="PciHotPlugRequest">
- <C_Name>gEfiPciHotPlugRequestProtocolGuid</C_Name>
- <GuidValue>19CB87AB-2CB9-4665-8360-DDCF6054F79D</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalBootService">
- <C_Name>gEfiExtendedSalBootServiceProtocolGuid</C_Name>
- <GuidValue>DE0EE9A4-3C7A-44F2-B78B-E3CCD69C3AF7</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalVariableServices">
- <C_Name>gEfiExtendedSalVariableServicesProtocolGuid</C_Name>
- <GuidValue>4ECB6C53-C641-4370-8CB2-3B0E496E8378</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalStatusCodeServices">
- <C_Name>gEfiExtendedSalStatusCodeServicesProtocolGuid</C_Name>
- <GuidValue>00DBD91D-55E9-420F-9639-5E9F8437B44F</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalBaseIoServices">
- <C_Name>gEfiExtendedSalBaseIoServicesProtocolGuid</C_Name>
- <GuidValue>5AEA42b5-31E1-4515-BC31-B8D5257565A6</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalStallServices">
- <C_Name>gEfiExtendedSalStallServicesProtocolGuid</C_Name>
- <GuidValue>53A58D06-AC27-4D8C-B5E9-F08A80654107</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalLockServices">
- <C_Name>gEfiExtendedSalLockServicesProtocolGuid</C_Name>
- <GuidValue>76b75C23-FE4F-4E17-A2AD-1A653DBB494A</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalVirtualServices">
- <C_Name>gEfiExtendedSalVirtualServicesProtocolGuid</C_Name>
- <GuidValue>C1A74056-260E-4871-A031-E645A65B6E11</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalRtcServices">
- <C_Name>gEfiExtendedSalRtcServicesProtocolGuid</C_Name>
- <GuidValue>7E97A470-EFDB-4D02-8FCE-6190D27BA296</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalMtcServices">
- <C_Name>gEfiExtendedSalMtcServicesProtocolGuid</C_Name>
- <GuidValue>899AFD18-75E8-408B-A41A-6E2E7ECDF454</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalResetServices">
- <C_Name>gEfiExtendedSalResetServicesProtocolGuid</C_Name>
- <GuidValue>7D019990-8CE1-46F5-A776-3C5198676AA0</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalFvBlockServices">
- <C_Name>gEfiExtendedSalFvBlockServicesProtocolGuid</C_Name>
- <GuidValue>a2271df1-bcbb-4f1d-98a9-06bc172f071a</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalMpServices">
- <C_Name>gEfiExtendedSalMpServicesProtocolGuid</C_Name>
- <GuidValue>697d81a2-cf18-4dc0-9e0d-06113b618a3f</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalPalServices">
- <C_Name>gEfiExtendedSalPalServicesProtocolGuid</C_Name>
- <GuidValue>e1cd9d21-0fc2-438d-9703-04e66d961e57</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalBaseServices">
- <C_Name>gEfiExtendedSalBaseServicesProtocolGuid</C_Name>
- <GuidValue>d9e9fa06-0fe0-41c3-96fb-83425a3394f8</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalMcaServices">
- <C_Name>gEfiExtendedSalMcaServicesProtocolGuid</C_Name>
- <GuidValue>2a591128-6cc7-42b1-8af0-58933b682dbb</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalPciServices">
- <C_Name>gEfiExtendedSalPciServicesProtocolGuid</C_Name>
- <GuidValue>a46b1a31-ad66-4905-92f6-2b4659dc3063</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalCacheServices">
- <C_Name>gEfiExtendedSalCacheServicesProtocolGuid</C_Name>
- <GuidValue>0edc9494-2743-4ba5-8818-0aef5213f188</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalMcaLogServices">
- <C_Name>gEfiExtendedSalMcaLogServicesProtocolGuid</C_Name>
- <GuidValue>cb3fd86e-38a3-4c03-9a5c-90cfa3a2ab7a</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalELogServices">
- <C_Name>gEfiExtendedSalELogServicesProtocolGuid</C_Name>
- <GuidValue>d5e4ee5f-3e0a-453c-a725-b692bb06365a</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalSensorServices">
- <C_Name>gEfiExtendedSalSensorServicesProtocolGuid</C_Name>
- <GuidValue>4a153b6e-85a1-4982-98f4-6a8cfca4aba1</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalSmComLayerServices">
- <C_Name>gEfiExtendedSalSmComLayerServicesProtocolGuid</C_Name>
- <GuidValue>04356799-81b7-4e08-a38d-d978fa47ba42</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalSstGuid">
- <C_Name>gEfiExtendedSalSstGuid</C_Name>
- <GuidValue>38802700-868a-4b4e-81d4-4f1bdccfb46f</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="IsaIo">
- <C_Name>gEfiIsaIoProtocolGuid</C_Name>
- <GuidValue>7EE2BD44-3DA0-11D4-9A38-0090273FC14D</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="IsaAcpi">
- <C_Name>gEfiIsaAcpiProtocolGuid</C_Name>
- <GuidValue>64A892DC-5561-4536-92C7-799BFC183355</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="Performance">
- <C_Name>gPerformanceProtocolGuid</C_Name>
- <GuidValue>76B6BDFA-2ACD-4462-9E3F-CB58C969D937</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ScsiIo">
- <C_Name>gEfiScsiIoProtocolGuid</C_Name>
- <GuidValue>403CD195-F233-48EC-8455-B2E52F1D9E02</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="ExtendedSalErrorEventInformation">
- <C_Name>gEfiExtendedSalErrorEventInfoProtocolGuid</C_Name>
- <GuidValue>D0D7913F-1114-4543-B568-C30C737AFF96</GuidValue>
- <HelpText>error event information-produced by Mca Handler</HelpText>
- </Entry>
- </ProtocolDeclarations>
- <PpiDeclarations>
- <Entry Name="PeiInMemory">
- <C_Name>gPeiInMemoryGuid</C_Name>
- <GuidValue>643B8786-B417-48D2-8F5E-7819931CAED8</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="FlashMap">
- <C_Name>gPeiFlashMapPpiGuid</C_Name>
- <GuidValue>F34C2FA0-DE88-4270-8414-961222F4521C</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="BaseMemoryTest">
- <C_Name>gPeiBaseMemoryTestPpiGuid</C_Name>
- <GuidValue>B6EC423C-21D2-490D-85C6-DD5864EAA674</GuidValue>
- <HelpText/>
- </Entry>
- <Entry Name="StatusCodeMemory">
- <C_Name>gPeiStatusCodeMemoryPpiGuid</C_Name>
- <GuidValue>26F8AB01-D3CD-489C-984F-DFDEF768395B</GuidValue>
- <HelpText/>
- </Entry>
- </PpiDeclarations>
- <PcdDeclarations>
- <PcdEntry>
- <C_Name>PcdMaxPeiPcdCallBackNumberPerPcdEntry</C_Name>
- <Token>0x0001000f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <ValidUsage>FIXED_AT_BUILD</ValidUsage>
- <DefaultValue>0x08</DefaultValue>
- <HelpText>The maximum number of callback function, which will be triggered when
- a PCD entry is been set, can be registered for a single PCD entry in PEI phase.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdVpdBaseAddress</C_Name>
- <Token>0x00010010</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <ValidUsage>FIXED_AT_BUILD</ValidUsage>
- <DefaultValue>0x0</DefaultValue>
- <HelpText>The base address of the VPD (Vital Product Data) region. It is
- normally a region reserved on flash.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdSupportUpdateCapsuleRest</C_Name>
- <Token>0x0001001d</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>Indicate whether platform can support update capsule across a system reset</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdMaxSizePopulateCapsule</C_Name>
- <Token>0x0001001e</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <ValidUsage>FIXED_AT_BUILD</ValidUsage>
- <DefaultValue>0x0</DefaultValue>
- <HelpText>Indicate the max size the platform can support in case of populated capsules</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdMaxSizeNonPopulateCapsule</C_Name>
- <Token>0x0001001f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <ValidUsage>FIXED_AT_BUILD</ValidUsage>
- <DefaultValue>0x0</DefaultValue>
- <HelpText>Indicate the max size the platform can support in case of non-populated capsules</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdPeiPcdDatabaseTraverseEnabled</C_Name>
- <Token>0x00010020</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable the Pcd PEIM database
- traverse capability. Disable it can reduce the size of final image generated.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdDxePcdDatabaseTraverseEnabled</C_Name>
- <Token>0x00010021</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable the Pcd DXE database
- traverse capability. Disable it can reduce the size of final image generated.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeUseSerial</C_Name>
- <Token>0x00010022</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable report staus code to serial I/O. Disable it can reduce the size of final image generated.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeUseMemory</C_Name>
- <Token>0x00010023</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable save statuc code in GUID'ed HOB. Disable it can reduce the size of final image generated.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <Token>0x00010024</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable send status code to OEM device. Disable it can reduce the size of final image generated.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeMemorySize</C_Name>
- <Token>0x00010025</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT16</DatumType>
- <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE DYNAMIC</ValidUsage>
- <DefaultValue>1</DefaultValue>
- <HelpText>kbytes size of GUID'ed HOB, if the GUID'ed HOB is full, create new GUID'ed HOB with this size.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeUseEfiSerial</C_Name>
- <Token>0x00010026</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>Use to switch on/off report status code through serial DXE.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeUseHardSerial</C_Name>
- <Token>0x00010027</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>Use to switch on/off report status code to serial device.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeUseRuntimeMemory</C_Name>
- <Token>0x00010028</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>Use to switch on/off save status code in runtime memory.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeUseDataHub</C_Name>
- <Token>0x00010029</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>Use to switch on/off log status code in data hub.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeReplayInSerial</C_Name>
- <Token>0x0001002a</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>Use to enable/dsable replay status code which saved in GUID'ed HOB in PEI phase to EFI serial.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeReplayInRuntimeMemory</C_Name>
- <Token>0x0001002b</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>Use to enable/dsable replay status code which saved in GUID'ed HOB in PEI phase to EFI serial.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeReplayInDataHub</C_Name>
- <Token>0x0001002c</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>Use to enable/dsable replay status code which saved in GUID'ed HOB in PEI phase to EFI serial.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeReplayInOEM</C_Name>
- <Token>0x0001002d</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>Use to enable/dsable replay status code which saved in GUID'ed HOB in PEI phase to EFI serial.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdStatusCodeRuntimeMemorySize</C_Name>
- <Token>0x0001002e</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT16</DatumType>
- <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE DYNAMIC</ValidUsage>
- <DefaultValue>4</DefaultValue>
- <HelpText>kbytes size of runtime memory.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdMaxPeiPerformanceLogEntries</C_Name>
- <Token>0x0001002f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE</ValidUsage>
- <DefaultValue>28</DefaultValue>
- <HelpText>Maximun number of performance log entries during PEI phase.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdPeiPcdDatabaseSetEnabled</C_Name>
- <Token>0x00010030</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable the SET capability of PCD service PEIM. If a platform does not do PCD SET operation in PEI phase. This flag can be set to DISABLE to save size.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdPeiPcdDatabaseGetSizeEnabled</C_Name>
- <Token>0x00010031</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable the GET size capability of PCD service PEIM. If a platform does not do PCD get size operation in PEI phase. This flag can be set to DISABLE to save size.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdPeiPcdDatabaseCallbackOnSetEnabled</C_Name>
- <Token>0x00010032</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable the Callback On SET capability of PCD service PEIM. If a platform does not register any callback on set in PEI phase. This flag can be set to DISABLE to save size.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdPeiPcdDatabaseExEnabled</C_Name>
- <Token>0x00010033</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable the PCD service PEIM to handle DynamicEX PCD. If a platform has no module to use DynamicEX in PEI phase. This flag can be set to DISABLE to save size.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <Token>0x30000001</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE DYNAMIC</ValidUsage>
- <DefaultValue>0x0</DefaultValue>
- <HelpText>Base address of the variable section in NV firmware volume.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdFlashNvStorageVariableSize</C_Name>
- <Token>0x30000002</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE DYNAMIC</ValidUsage>
- <DefaultValue>0x0</DefaultValue>
- <HelpText>Size of the variable section in NV firmware volume..</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>
- <Token>0x30000013</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE DYNAMIC</ValidUsage>
- <DefaultValue>0x0</DefaultValue>
- <HelpText>Base address of the FTW spare block section in NV firmware volume.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>
- <Token>0x30000014</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE DYNAMIC</ValidUsage>
- <DefaultValue>0x0</DefaultValue>
- <HelpText>Size of the FTW spare block section in NV firmware volume.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>
- <Token>0x30000010</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE DYNAMIC</ValidUsage>
- <DefaultValue>0x0</DefaultValue>
- <HelpText>Base address of the FTW working block section in NV firmware volume.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>
- <Token>0x30000011</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT32</DatumType>
- <ValidUsage>FIXED_AT_BUILD PATCHABLE_IN_MODULE DYNAMIC</ValidUsage>
- <DefaultValue>0x0</DefaultValue>
- <HelpText>Size of the FTW working block section in NV firmware volume.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdDxeIplSupportEfiDecompress</C_Name>
- <Token>0x00010034</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>If this feature is enabled, then the DXE IPL must support decompressing files compressed with the EFI Compression algorithm</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdDxeIplSupportTianoDecompress</C_Name>
- <Token>0x00010035</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>If this feature is enabled, then the DXE IPL must support decompressing files compressed with the Tiano Compression algorithm</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdDxeIplSupportCustomDecompress</C_Name>
- <Token>0x00010036</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>If this feature is enabled, then the DXE IPL must support decompressing files compressed with the Custom Compression algorithm</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdDevicePathSupportDevicePathToText</C_Name>
- <Token>0x00010037</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>If TRUE, then the Device Path To Text Protocol should be produced by the platform</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>
- <Token>0x00010038</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>If TRUE, then the Device Path From Text Protocol should be produced by the platform</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdPciIsaEnable</C_Name>
- <Token>0x00010039</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>This is a switch to enable ISA</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdPciVgaEnable</C_Name>
- <Token>0x0001003a</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>Whether VGA decoding is enabled on this platform so we should avoid those aliased resources</HelpText>
- </PcdEntry>
- <PcdEntry SupArchList="IA32">
- <C_Name>PcdDxeIplSwitchToLongMode</C_Name>
- <Token>0x0001003b</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>If this feature is enabled, then the DXE IPL will load a 64-bit DxeCore.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdDxeIplBuildShareCodeHobs</C_Name>
- <Token>0x0001003c</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>If this feature is enabled, DXE IPL will build a series of HOBs to share code with DXE Core.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdPciBusHotplugDeviceSupport</C_Name>
- <Token>0x0001003d</Token>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>TRUE</DefaultValue>
- <HelpText>If TRUE, the PCI bus driver will support hot plug device. If not hot plug device is supported, this feature flag can be set to FALSE to save size.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdNtEmulatorEnable</C_Name>
- <Token>0x0001003e</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>BOOLEAN</DatumType>
- <ValidUsage>FEATURE_FLAG</ValidUsage>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>If this PCD is set as TRUE, NT emulator will be endabled.</HelpText>
- </PcdEntry>
- <PcdEntry>
- <C_Name>PcdPciIncompatibleDeviceSupportMask</C_Name>
- <Token>0x0001003f</Token>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DatumType>UINT8</DatumType>
- <ValidUsage>FIXED_AT_BUILD</ValidUsage>
- <DefaultValue>0x0</DefaultValue>
- <HelpText>The PCD masks for PCI incompatible devices support.
- Acpi_Resource_Update_Support :1;
- Register_Read_Support :1;
- Register_Write_Support :1;
- Register_Update_Support :1;
- Register_Access_Width_Support :1;
- Reserved :3;</HelpText>
- </PcdEntry>
- </PcdDeclarations>
-</PackageSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Include/Common/CapsuleName.h b/EdkModulePkg/Include/Common/CapsuleName.h
deleted file mode 100644
index 651fbe3..0000000
--- a/EdkModulePkg/Include/Common/CapsuleName.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- CapsuleName.h
-
-Abstract:
-
---*/
-
-#ifndef _CAPSULE_NAME_H
-#define _CAPSULE_NAME_H
-
-//
-// If capsule data is passed via a variable, then this name should be used.
-//
-#define EFI_CAPSULE_VARIABLE_NAME L"CapsuleUpdateData"
-
-#endif
diff --git a/EdkModulePkg/Include/Common/DecompressLibraryHob.h b/EdkModulePkg/Include/Common/DecompressLibraryHob.h
deleted file mode 100644
index ee7b8a2..0000000
--- a/EdkModulePkg/Include/Common/DecompressLibraryHob.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DecompressLibraryHob.h
-
-Abstract:
-
- Declaration of HOB that is used to pass decompressor library functions from PEI to DXE
-
---*/
-
-#ifndef __DECOMPRESS_LIBRARY_HOB_H__
-#define __DECOMPRESS_LIBRARY_HOB_H__
-
-typedef
-RETURN_STATUS
-(EFIAPI *DECOMPRESS_LIBRARY_GET_INFO) (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- );
-
-typedef
-RETURN_STATUS
-(EFIAPI *DECOMPRESS_LIBRARY_DECOMPRESS) (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- );
-
-typedef struct {
- DECOMPRESS_LIBRARY_GET_INFO GetInfo;
- DECOMPRESS_LIBRARY_DECOMPRESS Decompress;
-} DECOMPRESS_LIBRARY;
-
-#endif
diff --git a/EdkModulePkg/Include/Common/FlashMap.h b/EdkModulePkg/Include/Common/FlashMap.h
deleted file mode 100644
index 9c0afc4..0000000
--- a/EdkModulePkg/Include/Common/FlashMap.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FlashMap.h
-
-Abstract:
-
- FlashMap PPI defined in Tiano
-
- This code abstracts FlashMap access
-
---*/
-
-#ifndef __COMMON_FLASHMAP_H__
-#define __COMMON_FLASHMAP_H__
-
-#include <Common/Hob.h>
-//
-// Definition for flash map GUIDed HOBs
-//
-typedef UINT32 EFI_FLASH_AREA_ATTRIBUTES;
-
-#define EFI_FLASH_AREA_FV 0x0001
-#define EFI_FLASH_AREA_SUBFV 0x0002
-#define EFI_FLASH_AREA_MEMMAPPED_FV 0x0004
-#define EFI_FLASH_AREA_REQUIRED 0x0008
-#define EFI_FLASH_AREA_CORRUPT 0x0010
-
-typedef UINT8 EFI_FLASH_AREA_TYPE;
-
-#define EFI_FLASH_AREA_RECOVERY_BIOS 0x0 // Recovery code
-#define EFI_FLASH_AREA_MAIN_BIOS 0x1 // Regular BIOS code
-#define EFI_FLASH_AREA_PAL_B 0x2 // PAL-B
-#define EFI_FLASH_AREA_RESERVED_03 0x3 // Reserved for backwards compatibility
-#define EFI_FLASH_AREA_RESERVED_04 0x4 // Reserved for backwards compatibility
-#define EFI_FLASH_AREA_DMI_FRU 0x5 // DMI FRU information
-#define EFI_FLASH_AREA_OEM_BINARY 0x6 // OEM Binary Code/data
-#define EFI_FLASH_AREA_RESERVED_07 0x7 // Reserved for backwards compatibility
-#define EFI_FLASH_AREA_RESERVED_08 0x8 // Reserved for backwards compatibility
-#define EFI_FLASH_AREA_RESERVED_09 0x9 // Reserved for backwards compatibility
-#define EFI_FLASH_AREA_RESERVED_0A 0x0a // Reserved for backwards compatibility
-#define EFI_FLASH_AREA_EFI_VARIABLES 0x0b // EFI variables
-#define EFI_FLASH_AREA_MCA_LOG 0x0c // MCA error log
-#define EFI_FLASH_AREA_SMBIOS_LOG 0x0d // SMBIOS error log
-#define EFI_FLASH_AREA_FTW_BACKUP 0x0e // A backup block during FTW operations
-#define EFI_FLASH_AREA_FTW_STATE 0x0f // State information during FTW operations
-#define EFI_FLASH_AREA_UNUSED 0x0fd // Not used
-#define EFI_FLASH_AREA_GUID_DEFINED 0x0fe // Usage defined by a GUID
-#pragma pack(1)
-//
-// An individual sub-area Entry.
-// A single flash area may consist of more than one sub-area.
-//
-typedef struct {
- EFI_FLASH_AREA_ATTRIBUTES Attributes;
- UINT32 Reserved;
- EFI_PHYSICAL_ADDRESS Base;
- EFI_PHYSICAL_ADDRESS Length;
- EFI_GUID FileSystem;
-} EFI_FLASH_SUBAREA_ENTRY;
-
-typedef struct {
- UINT8 Reserved[3];
- EFI_FLASH_AREA_TYPE AreaType;
- EFI_GUID AreaTypeGuid;
- UINT32 NumEntries;
- EFI_FLASH_SUBAREA_ENTRY Entries[1];
-} EFI_FLASH_MAP_ENTRY_DATA;
-
-typedef struct {
- EFI_HOB_GENERIC_HEADER Header;
- EFI_GUID Name;
- UINT8 Reserved[3];
- EFI_FLASH_AREA_TYPE AreaType;
- EFI_GUID AreaTypeGuid;
- UINT32 NumEntries;
- EFI_FLASH_SUBAREA_ENTRY Entries[1];
-} EFI_HOB_FLASH_MAP_ENTRY_TYPE;
-
-//
-// Internal definitions
-//
-typedef struct {
- UINT8 Reserved[3];
- EFI_FLASH_AREA_TYPE AreaType;
- EFI_GUID AreaTypeGuid;
- UINT32 NumberOfEntries;
- EFI_FLASH_SUBAREA_ENTRY SubAreaData;
-} EFI_FLASH_AREA_HOB_DATA;
-
-typedef struct {
- UINTN Base;
- UINTN Length;
- EFI_FLASH_AREA_ATTRIBUTES Attributes;
- EFI_FLASH_AREA_TYPE AreaType;
- UINT8 Reserved[3];
- EFI_GUID AreaTypeGuid;
-} EFI_FLASH_AREA_DATA;
-
-#pragma pack()
-
-#endif
diff --git a/EdkModulePkg/Include/Common/Variable.h b/EdkModulePkg/Include/Common/Variable.h
deleted file mode 100644
index a732323..0000000
--- a/EdkModulePkg/Include/Common/Variable.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/**@file
- Header file for EFI Variable Services.
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _EFI_VARIABLE_H_
-#define _EFI_VARIABLE_H_
-
-#define VARIABLE_STORE_SIGNATURE EFI_SIGNATURE_32 ('$', 'V', 'S', 'S')
-
-#define MAX_VARIABLE_SIZE 1024
-
-//
-// Enlarges the hardware error record maximum variable size to 32K bytes
-//
-#define MAX_HARDWARE_ERROR_VARIABLE_SIZE 0x8000
-
-#define VARIABLE_DATA 0x55AA
-
-//
-// Variable Store Header flags
-//
-#define VARIABLE_STORE_FORMATTED 0x5a
-#define VARIABLE_STORE_HEALTHY 0xfe
-
-//
-// The alignment of variable's start offset.
-// For IA32/X64 architecture, the alignment is set to 1, and
-// 8 is for IPF archtecture.
-//
-#if defined (MDE_CPU_IPF)
-#define ALIGNMENT 8
-#else
-#define ALIGNMENT 1
-#endif
-
-//
-// Variable Store Status
-//
-typedef enum {
- EfiRaw,
- EfiValid,
- EfiInvalid,
- EfiUnknown
-} VARIABLE_STORE_STATUS;
-
-//
-// Variable State flags
-//
-#define VAR_IN_DELETED_TRANSITION 0xfe // Variable is in obsolete transistion
-#define VAR_DELETED 0xfd // Variable is obsolete
-#define VAR_ADDED 0x7f // Variable has been completely added
-#define IS_VARIABLE_STATE(_c, _Mask) (BOOLEAN) (((~_c) & (~_Mask)) != 0)
-
-#pragma pack(1)
-
-typedef struct {
- UINT32 Signature;
- UINT32 Size;
- UINT8 Format;
- UINT8 State;
- UINT16 Reserved;
- UINT32 Reserved1;
-} VARIABLE_STORE_HEADER;
-
-typedef struct {
- UINT16 StartId;
- UINT8 State;
- UINT8 Reserved;
- UINT32 Attributes;
- UINT32 NameSize;
- UINT32 DataSize;
- EFI_GUID VendorGuid;
-} VARIABLE_HEADER;
-
-#pragma pack()
-
-#endif // _EFI_VARIABLE_H_
diff --git a/EdkModulePkg/Include/Common/WorkingBlockHeader.h b/EdkModulePkg/Include/Common/WorkingBlockHeader.h
deleted file mode 100644
index 234ebdd..0000000
--- a/EdkModulePkg/Include/Common/WorkingBlockHeader.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EfiWorkingBlockHeader.h
-
-Abstract:
-
- Defines data structure that is the headers found at the runtime
- updatable firmware volumes, such as the FileSystemGuid of the
- working block, the header structure of the variable block, FTW
- working block, or event log block.
-
---*/
-
-#ifndef _EFI_WORKING_BLOCK_HEADER_H_
-#define _EFI_WORKING_BLOCK_HEADER_H_
-
-//
-// EFI Fault tolerant working block header
-// The header is immediately followed by the write queue.
-//
-typedef struct {
- EFI_GUID Signature;
- UINT32 Crc;
- UINT8 WorkingBlockValid : 1;
- UINT8 WorkingBlockInvalid : 1;
-#define WORKING_BLOCK_VALID 0x1
-#define WORKING_BLOCK_INVALID 0x2
- UINT8 Reserved : 6;
- UINT8 Reserved3[3];
- UINT32 WriteQueueSize;
- //
- // UINT8 WriteQueue[WriteQueueSize];
- //
-} EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER;
-
-#endif
diff --git a/EdkModulePkg/Include/EdkDxe.h b/EdkModulePkg/Include/EdkDxe.h
deleted file mode 100644
index 80a55a3..0000000
--- a/EdkModulePkg/Include/EdkDxe.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- EdkDxe.h
-
-Abstract:
- This file defines the base package surface area for writting a PEIM
-
- Things defined in the Tiano specification go in DxeCis.h.
-
- Dxe.h contains build environment and library information needed to build
- a basic Dxe driver. This file must match the "base package" definition of
- how to write a Dxe driver.
-
---*/
-
-#ifndef __EDK_DXE_H__
-#define __EDK_DXE_H__
-
-#include <Common/FlashMap.h>
-#include <Guid/MemoryTypeInformation.h>
-#include <Guid/FlashMapHob.h>
-#include <Guid/SystemNvDataGuid.h>
-#include <Guid/AlternateFvBlock.h>
-#include <Guid/ConsoleInDevice.h>
-#include <Guid/ConsoleOutDevice.h>
-#include <Guid/StandardErrorDevice.h>
-#include <Guid/HotPlugDevice.h>
-#include <Guid/PrimaryStandardErrorDevice.h>
-#include <Guid/PrimaryConsoleInDevice.h>
-#include <Guid/PrimaryConsoleOutDevice.h>
-#include <Guid/Bmp.h>
-#include <Guid/BootState.h>
-#include <Guid/ShellFile.h>
-#include <Guid/MiniShellFile.h>
-#include <Guid/StatusCode.h>
-#include <Guid/PciOptionRomTable.h>
-#include <Guid/PciHotplugDevice.h>
-#if defined(MDE_CPU_IPF)
-#include <Guid/ExtendedSalGuid.h>
-#endif
-#include <Guid/PeiPeCoffLoader.h>
-#include <Guid/CapsuleVendor.h>
-#include <Guid/CompatibleMemoryTested.h>
-#include <Guid/MemoryStatusCodeRecord.h>
-#include <Guid/GenericPlatformVariable.h>
-
-#include <Ppi/StatusCodeMemory.h>
-
-#include <Protocol/CustomizedDecompress.h>
-#include <Protocol/DebugLevel.h>
-#include <Protocol/LoadPe32Image.h>
-#include <Protocol/EdkDecompress.h>
-#include <Protocol/Print.h>
-#include <Protocol/GenericMemoryTest.h>
-#include <Protocol/DiskInfo.h>
-#include <Protocol/FvbExtension.h>
-#include <Protocol/FaultTolerantWriteLite.h>
-#include <Protocol/ConsoleControl.h>
-#include <Protocol/OEMBadging.h>
-#include <Protocol/LegacyBios.h>
-#include <Protocol/UgaSplash.h>
-#include <Protocol/AcpiS3Save.h>
-#include <Protocol/Performance.h>
-#include <Protocol/PxeDhcp4.h>
-#include <Protocol/PxeDhcp4CallBack.h>
-#include <Protocol/UgaIo.h>
-#include <Protocol/DebugAssert.h>
-#include <Protocol/usbatapi.h>
-#include <Protocol/PciHotPlugRequest.h>
-#if defined(MDE_CPU_IPF)
-#include <Protocol/ExtendedSalBootService.h>
-#endif
-#include <Protocol/IsaAcpi.h>
-#include <Protocol/IsaIo.h>
-
-#if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))
-//
-// Old EDK modules use Module use ScsiPassThru protocol together with the original ScsiIo protocol
-// In UEFI2.0, Module use ScsiPassThruExt Protocol with new UEFI2.0 ScsiIo protocol
-//
-#include <Protocol/ScsiIo.h>
-#endif
-
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
-#include <Protocol/Capsule.h>
-#endif
-
-#endif
diff --git a/EdkModulePkg/Include/EdkDxeCore.h b/EdkModulePkg/Include/EdkDxeCore.h
deleted file mode 100644
index 2308e97..0000000
--- a/EdkModulePkg/Include/EdkDxeCore.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- EdkDxe.h
-
-Abstract:
- This file defines the base package surface area for writting a PEIM
-
- Things defined in the Tiano specification go in DxeCis.h.
-
- Dxe.h contains build environment and library information needed to build
- a basic Dxe driver. This file must match the "base package" definition of
- how to write a Dxe driver.
-
---*/
-
-#ifndef __EDK_DXE_CORE_H__
-#define __EDK_DXE_CORE_H__
-
-#include <Common/DecompressLibraryHob.h>
-
-//
-// BUGBUG: Performance related protocol and Guid.
-// They are Tiano-private, but are required for DxeCore
-//
-#include <Protocol/Performance.h>
-#include <Guid/PeiPerformanceHob.h>
-//
-// BUGBUG: Do these really belomg here?
-//
-#include <Guid/PeiPeCoffLoader.h>
-#include <Guid/MemoryTypeInformation.h>
-
-#include <Protocol/CustomizedDecompress.h>
-#include <Protocol/DebugLevel.h>
-#include <Protocol/LoadPe32Image.h>
-#include <Protocol/EdkDecompress.h>
-#include <Protocol/Print.h>
-
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
-#include <Protocol/Capsule.h>
-#endif
-
-#endif
diff --git a/EdkModulePkg/Include/EdkPeiCore.h b/EdkModulePkg/Include/EdkPeiCore.h
deleted file mode 100644
index c7870af..0000000
--- a/EdkModulePkg/Include/EdkPeiCore.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- EdkDxe.h
-
-Abstract:
- This file defines the base package surface area for writting a PEIM
-
- Things defined in the Tiano specification go in DxeCis.h.
-
- Dxe.h contains build environment and library information needed to build
- a basic Dxe driver. This file must match the "base package" definition of
- how to write a Dxe driver.
-
---*/
-
-#ifndef __EDK_PEI_CORE_H__
-#define __EDK_PEI_CORE_H__
-
-
-#include <Guid/PeiPeCoffLoader.h>
-
-//
-// BUGBUG: Performance related Guid.
-// It is Tiano-private, but is required for PeiCore
-//
-#include <Guid/PeiPerformanceHob.h>
-
-#endif
diff --git a/EdkModulePkg/Include/EdkPeim.h b/EdkModulePkg/Include/EdkPeim.h
deleted file mode 100644
index 229d24c..0000000
--- a/EdkModulePkg/Include/EdkPeim.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EdkPeim.h
-
-Abstract:
- This file defines the base package surface area for writting a PEIM
-
- Things defined in the PEI CIS specification go in PeiCis.h.
-
- EdkPeim.h contains build environment and library information needed to build
- a basic PEIM that needs Tiano specific definitiosn. T
-
- Currently we just add in some extra PPI and GUID definitions
-
---*/
-
-#ifndef __EDK_PEIM_H__
-#define __EDK_PEIM_H__
-
-//
-#include <Common/FlashMap.h>
-#include <Common/DecompressLibraryHob.h>
-//
-// BUGBUG: Performance related Guid.
-// It is Tiano-private, but is required for PeiCore
-//
-#include <Guid/PeiPerformanceHob.h>
-#include <Guid/PeiPeCoffLoader.h>
-#include <Guid/SystemNvDataGuid.h>
-#include <Guid/FlashMapHob.h>
-#include <Guid/MemoryTypeInformation.h>
-#include <Guid/CapsuleVendor.h>
-#include <Guid/BootState.h>
-#include <Guid/MemoryStatusCodeRecord.h>
-#include <Guid/GenericPlatformVariable.h>
-
-#include <Ppi/PeiInMemory.h>
-#include <Ppi/FlashMap.h>
-#include <Ppi/BaseMemoryTest.h>
-#include <Ppi/StatusCodeMemory.h>
-
-#include <Protocol/CustomizedDecompress.h>
-#include <Protocol/EdkDecompress.h>
-
-#include <Dxe/ArchProtocol/StatusCode.h>
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/AlternateFvBlock.h b/EdkModulePkg/Include/Guid/AlternateFvBlock.h
deleted file mode 100644
index e3a789a..0000000
--- a/EdkModulePkg/Include/Guid/AlternateFvBlock.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- AlternateFvBlock.h
-
-Abstract:
-
- Tiano Guid used to define the Alternate Firmware Volume Block Guid.
-
---*/
-
-#ifndef _ALT_FVB_GUID_H
-#define _ALT_FVB_GUID_H
-
-#define EFI_ALTERNATE_FV_BLOCK_GUID \
- { \
- 0xf496922d, 0x172f, 0x4bbc, {0xa1, 0xeb, 0xe, 0xeb, 0x94, 0x9c, 0x34, 0x86 } \
- }
-
-extern EFI_GUID gEfiAlternateFvBlockGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/Bmp.h b/EdkModulePkg/Include/Guid/Bmp.h
deleted file mode 100644
index 7a5f5a8..0000000
--- a/EdkModulePkg/Include/Guid/Bmp.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Bmp.h
-
-Abstract:
-
---*/
-
-#ifndef _BMP_GUID_H_
-#define _BMP_GUID_H_
-
-
-//
-// Definitions for BMP files
-//
-#pragma pack(1)
-
-typedef struct {
- UINT8 Blue;
- UINT8 Green;
- UINT8 Red;
- UINT8 Reserved;
-} BMP_COLOR_MAP;
-
-typedef struct {
- CHAR8 CharB;
- CHAR8 CharM;
- UINT32 Size;
- UINT16 Reserved[2];
- UINT32 ImageOffset;
- UINT32 HeaderSize;
- UINT32 PixelWidth;
- UINT32 PixelHeight;
- UINT16 Planes; // Must be 1
- UINT16 BitPerPixel; // 1, 4, 8, or 24
- UINT32 CompressionType;
- UINT32 ImageSize; // Compressed image size in bytes
- UINT32 XPixelsPerMeter;
- UINT32 YPixelsPerMeter;
- UINT32 NumberOfColors;
- UINT32 ImportantColors;
-} BMP_IMAGE_HEADER;
-
-#pragma pack()
-
-#define EFI_DEFAULT_BMP_LOGO_GUID \
- {0x7BB28B99,0x61BB,0x11d5,{0x9A,0x5D,0x00,0x90,0x27,0x3F,0xC1,0x4D}}
-
-extern EFI_GUID gEfiDefaultBmpLogoGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/BootState.h b/EdkModulePkg/Include/Guid/BootState.h
deleted file mode 100644
index 2d9a0d1..0000000
--- a/EdkModulePkg/Include/Guid/BootState.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootState.h
-
-Abstract:
-
- Constants and declarations that are common accross PEI and DXE.
---*/
-
-#ifndef _BOOT_STATE_H_
-#define _BOOT_STATE_H_
-
-//
-// BOOT STATE
-//
-
-typedef UINT32 EFI_BOOT_STATE;
-
-#define BOOT_STATE_VARIABLE_NAME L"BootState"
-
-#define EFI_BOOT_STATE_VARIABLE_GUID \
- {0x60b5e939, 0xfcf, 0x4227, {0xba, 0x83, 0x6b, 0xbe, 0xd4, 0x5b, 0xc0, 0xe3} }
-
-extern EFI_GUID gEfiBootStateGuid;
-#endif
diff --git a/EdkModulePkg/Include/Guid/CapsuleVendor.h b/EdkModulePkg/Include/Guid/CapsuleVendor.h
deleted file mode 100644
index 4f57628..0000000
--- a/EdkModulePkg/Include/Guid/CapsuleVendor.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- CapsuleVendor.h
-
-Abstract:
-
- Capsule update Guid definitions
-
---*/
-
-#ifndef _EFI_CAPSULE_VENDOR_GUID_H_
-#define _EFI_CAPSULE_VENDOR_GUID_H_
-
-//
-// Note -- This guid is used as a vendor GUID (depending on implementation)
-// for the capsule variable if the capsule pointer is passes through reset
-// via a variable.
-//
-#define EFI_CAPSULE_VENDOR_GUID \
- { 0x711C703F, 0xC285, 0x4B10, { 0xA3, 0xB0, 0x36, 0xEC, 0xBD, 0x3C, 0x8B, 0xE2 } }
-
-extern EFI_GUID gEfiCapsuleVendorGuid;
-
-#endif // #ifndef _EFI_CAPSULE_VENDOR_GUID_H_
diff --git a/EdkModulePkg/Include/Guid/CompatibleMemoryTested.h b/EdkModulePkg/Include/Guid/CompatibleMemoryTested.h
deleted file mode 100644
index 645cacf..0000000
--- a/EdkModulePkg/Include/Guid/CompatibleMemoryTested.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- CompatibleMemoryTested.h
-
-Abstract:
-
- Tiano Guid used for all Compatible Memory Range Tested GUID.
-
---*/
-
-#ifndef _COMPATIBLE_MEMORY_TESTED_GUID_H_
-#define _COMPATIBLE_MEMORY_TESTED_GUID_H_
-
-#define EFI_COMPATIBLE_MEMORY_TESTED_PROTOCOL_GUID \
- { \
- 0x64c475ef, 0x344b, 0x492c, 0x93, 0xad, 0xab, 0x9e, 0xb4, 0x39, 0x50, 0x4 \
- }
-
-extern EFI_GUID gEfiCompatibleMemoryTestedGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/ConsoleInDevice.h b/EdkModulePkg/Include/Guid/ConsoleInDevice.h
deleted file mode 100644
index 6e53028..0000000
--- a/EdkModulePkg/Include/Guid/ConsoleInDevice.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ConsoleInDevice.h
-
-Abstract:
-
-
---*/
-
-#ifndef _CONSOLE_IN_DEVICE_H_
-#define _CONSOLE_IN_DEVICE_H_
-
-#define EFI_CONSOLE_IN_DEVICE_GUID \
- { 0xd3b36f2b, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
-
-extern EFI_GUID gEfiConsoleInDeviceGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/ConsoleOutDevice.h b/EdkModulePkg/Include/Guid/ConsoleOutDevice.h
deleted file mode 100644
index 691aa41..0000000
--- a/EdkModulePkg/Include/Guid/ConsoleOutDevice.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ConsoleOutDevice.h
-
-Abstract:
-
-
---*/
-
-#ifndef _CONSOLE_OUT_DEVICE_H_
-#define _CONSOLE_OUT_DEVICE_H_
-
-#define EFI_CONSOLE_OUT_DEVICE_GUID \
- { 0xd3b36f2c, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
-
-extern EFI_GUID gEfiConsoleOutDeviceGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/ExtendedSalGuid.h b/EdkModulePkg/Include/Guid/ExtendedSalGuid.h
deleted file mode 100644
index 8f5ae15..0000000
--- a/EdkModulePkg/Include/Guid/ExtendedSalGuid.h
+++ /dev/null
@@ -1,386 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ExtendedSalGuid.h
-
-Abstract:
-
-
---*/
-
-#ifndef _EXTENDED_SAL_GUID_H_
-#define _EXTENDED_SAL_GUID_H_
-
-//
-// Extended SAL Services protocol GUIDs
-//
-
-
-#define GUID_STRUCTURE(Lo, Hi) \
-{ (Lo & 0xffffffff), \
- ((Lo >> 32) & 0xffff), \
- ((Lo >> 48) & 0xffff), \
- { (Hi & 0xff), \
- ((Hi >> 8) & 0xff), \
- ((Hi >> 16) & 0xff), \
- ((Hi >> 24) & 0xff), \
- ((Hi >> 32) & 0xff), \
- ((Hi >> 40) & 0xff), \
- ((Hi >> 48) & 0xff), \
- ((Hi >> 56) & 0xff) \
- } \
-}
-
-
-#define EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID_LO 0x451531e15aea42b5
-#define EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID_HI 0xa6657525d5b831bc
-#define EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID \
- { 0x5aea42b5, 0x31e1, 0x4515, {0xbc, 0x31, 0xb8, 0xd5, 0x25, 0x75, 0x65, 0xa6 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_STALL_SERVICES_PROTOCOL_GUID_LO 0x4d8cac2753a58d06
-#define EFI_EXTENDED_SAL_STALL_SERVICES_PROTOCOL_GUID_HI 0x704165808af0e9b5
-#define EFI_EXTENDED_SAL_STALL_SERVICES_PROTOCOL_GUID \
- { 0x53a58d06, 0xac27, 0x4d8c, {0xb5, 0xe9, 0xf0, 0x8a, 0x80, 0x65, 0x41, 0x70 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_STALL_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_STALL_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_LOCK_SERVICES_PROTOCOL_GUID_LO 0x4e17fe4f76b75c23
-#define EFI_EXTENDED_SAL_LOCK_SERVICES_PROTOCOL_GUID_HI 0x4a49bb3d651aada2
-#define EFI_EXTENDED_SAL_LOCK_SERVICES_PROTOCOL_GUID \
- { 0x76b75c23, 0xfe4f, 0x4e17, {0xa2, 0xad, 0x1a, 0x65, 0x3d, 0xbb, 0x49, 0x4a } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_LOCK_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_LOCK_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO 0x4871260ec1a74056
-#define EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI 0x116e5ba645e631a0
-#define EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID \
- { 0xc1a74056, 0x260e, 0x4871, {0xa0, 0x31, 0xe6, 0x45, 0xa6, 0x5b, 0x6e, 0x11 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO 0x4d02efdb7e97a470
-#define EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI 0x96a27bd29061ce8f
-#define EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID \
- { 0x7e97a470, 0xefdb, 0x4d02, {0x8f, 0xce, 0x61, 0x90, 0xd2, 0x7b, 0xa2, 0x96 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO 0x4370c6414ecb6c53
-#define EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI 0x78836e490e3bb28c
-#define EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID \
- { 0x4ecb6c53, 0xc641, 0x4370, {0x8c, 0xb2, 0x3b, 0x0e, 0x49, 0x6e, 0x83, 0x78 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_LO 0x408b75e8899afd18
-#define EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_HI 0x54f4cd7e2e6e1aa4
-#define EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID \
- { 0x899afd18, 0x75e8, 0x408b, {0xa4, 0x1a, 0x6e, 0x2e, 0x7e, 0xcd, 0xf4, 0x54 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_LO 0x46f58ce17d019990
-#define EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_HI 0xa06a6798513c76a7
-#define EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID \
- { 0x7d019990, 0x8ce1, 0x46f5, {0xa7, 0x76, 0x3c, 0x51, 0x98, 0x67, 0x6a, 0xa0 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_STATUS_CODE_SERVICES_PROTOCOL_GUID_LO 0x420f55e9dbd91d
-#define EFI_EXTENDED_SAL_STATUS_CODE_SERVICES_PROTOCOL_GUID_HI 0x4fb437849f5e3996
-#define EFI_EXTENDED_SAL_STATUS_CODE_SERVICES_PROTOCOL_GUID \
- { 0xdbd91d, 0x55e9, 0x420f, {0x96, 0x39, 0x5e, 0x9f, 0x84, 0x37, 0xb4, 0x4f } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_STATUS_CODE_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_STATUS_CODE_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO 0x4f1dbcbba2271df1
-#define EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI 0x1a072f17bc06a998
-#define EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID \
- { 0xa2271df1, 0xbcbb, 0x4f1d, {0x98, 0xa9, 0x06, 0xbc, 0x17, 0x2f, 0x07, 0x1a } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_MP_SERVICES_PROTOCOL_GUID_LO 0x4dc0cf18697d81a2
-#define EFI_EXTENDED_SAL_MP_SERVICES_PROTOCOL_GUID_HI 0x3f8a613b11060d9e
-#define EFI_EXTENDED_SAL_MP_SERVICES_PROTOCOL_GUID \
- { 0x697d81a2, 0xcf18, 0x4dc0, {0x9e, 0x0d, 0x06, 0x11, 0x3b, 0x61, 0x8a, 0x3f } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_MP_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_MP_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_PAL_SERVICES_PROTOCOL_GUID_LO 0x438d0fc2e1cd9d21
-#define EFI_EXTENDED_SAL_PAL_SERVICES_PROTOCOL_GUID_HI 0x571e966de6040397
-#define EFI_EXTENDED_SAL_PAL_SERVICES_PROTOCOL_GUID \
- { 0xe1cd9d21, 0x0fc2, 0x438d, {0x97, 0x03, 0x04, 0xe6, 0x6d, 0x96, 0x1e, 0x57 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_PAL_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_PAL_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_LO 0x41c30fe0d9e9fa06
-#define EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_HI 0xf894335a4283fb96
-#define EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID \
- { 0xd9e9fa06, 0x0fe0, 0x41c3, {0x96, 0xfb, 0x83, 0x42, 0x5a, 0x33, 0x94, 0xf8 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_MCA_SERVICES_PROTOCOL_GUID_LO 0x42b16cc72a591128
-#define EFI_EXTENDED_SAL_MCA_SERVICES_PROTOCOL_GUID_HI 0xbb2d683b9358f08a
-#define EFI_EXTENDED_SAL_MCA_SERVICES_PROTOCOL_GUID \
- { 0x2a591128, 0x6cc7, 0x42b1, {0x8a, 0xf0, 0x58, 0x93, 0x3b, 0x68, 0x2d, 0xbb } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_MCA_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_MCA_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID_LO 0x4905ad66a46b1a31
-#define EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID_HI 0x6330dc59462bf692
-#define EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID \
- { 0xa46b1a31, 0xad66, 0x4905, {0x92, 0xf6, 0x2b, 0x46, 0x59, 0xdc, 0x30, 0x63 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_CACHE_SERVICES_PROTOCOL_GUID_LO 0x4ba52743edc9494
-#define EFI_EXTENDED_SAL_CACHE_SERVICES_PROTOCOL_GUID_HI 0x88f11352ef0a1888
-#define EFI_EXTENDED_SAL_CACHE_SERVICES_PROTOCOL_GUID \
- { 0xedc9494, 0x2743, 0x4ba5, { 0x88, 0x18, 0x0a, 0xef, 0x52, 0x13, 0xf1, 0x88 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_CACHE_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_CACHE_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID_LO 0x4c0338a3cb3fd86e
-#define EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID_HI 0x7aaba2a3cf905c9a
-#define EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID \
- { 0xcb3fd86e, 0x38a3, 0x4c03, {0x9a, 0x5c, 0x90, 0xcf, 0xa3, 0xa2, 0xab, 0x7a } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_ELOG_SERVICES_PROTOCOL_GUID_LO 0x453c3e0ad5e4ee5f
-#define EFI_EXTENDED_SAL_ELOG_SERVICES_PROTOCOL_GUID_HI 0x5a3606bb92b625a7
-#define EFI_EXTENDED_SAL_ELOG_SERVICES_PROTOCOL_GUID \
- { 0xd5e4ee5f, 0x3e0a, 0x453c, {0xa7, 0x25, 0xb6, 0x92, 0xbb, 0x06, 0x36, 0x5a } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_ELOG_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_ELOG_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_SENSOR_SERVICES_PROTOCOL_GUID_LO 0x498285a14a153b6e
-#define EFI_EXTENDED_SAL_SENSOR_SERVICES_PROTOCOL_GUID_HI 0xa1aba4fc8c6af498
-#define EFI_EXTENDED_SAL_SENSOR_SERVICES_PROTOCOL_GUID \
- { 0x4a153b6e, 0x85a1, 0x4982, {0x98, 0xf4, 0x6a, 0x8c, 0xfc, 0xa4, 0xab, 0xa1 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_SENSOR_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_SENSOR_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_SM_COM_LAYER_SERVICES_PROTOCOL_GUID_LO 0x4e0881b74356799
-#define EFI_EXTENDED_SAL_SM_COM_LAYER_SERVICES_PROTOCOL_GUID_HI 0x42ba47fa78d98da3
-#define EFI_EXTENDED_SAL_SM_COM_LAYER_SERVICES_PROTOCOL_GUID \
- { 0x4356799, 0x81b7, 0x4e08, { 0xa3, 0x8d, 0xd9, 0x78, 0xfa, 0x47, 0xba, 0x42 } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_SM_COM_LAYER_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_SM_COM_LAYER_SERVICES_PROTOCOL_GUID_HI)
-
-#define EFI_EXTENDED_SAL_SST_GUID_LO 0x4b4e868a38802700
-#define EFI_EXTENDED_SAL_SST_GUID_HI 0x6fb4cfdc1b4fd481
-#define EFI_EXTENDED_SAL_SST_GUID \
- { 0x38802700, 0x868a, 0x4b4e, {0x81, 0xd4, 0x4f, 0x1b, 0xdc, 0xcf, 0xb4, 0x6f } }
-// GUID_STRUCTURE(EFI_EXTENDED_SAL_SST_GUID_LO, EFI_EXTENDED_SAL_SST_GUID_HI)
-
-#define EFI_ERROR_EVENT_INFORMATION_PROTOCOL_GUID_LO 0x45431114D0D7913F
-#define EFI_ERROR_EVENT_INFORMATION_PROTOCOL_GUID_HI 0x96FF7A730CC368B5
-#define EFI_ERROR_EVENT_INFORMATION_PROTOCOL_GUID \
- { 0xD0D7913F, 0x1114, 0x4543, {0xB5, 0x68, 0xC3, 0x0C, 0x73, 0x7A, 0xFF, 0x96 } }
-
-//
-// Extended Sal Proc Function IDs.
-//
-
-//
-// BugBug: These enums are name colisions waiting to happen. They should all be
-// prefixed with Esal! It might be better to just make them #define, so
-// they would be all caps.
-//
-
-typedef enum {
- IoReadFunctionId,
- IoWriteFunctionId,
- MemReadFunctionId,
- MemWriteFunctionId
-} EFI_EXTENDED_SAL_BASE_IO_SERVICES_FUNC_ID;
-
-typedef enum {
- StallFunctionId
-} EFI_EXTENDED_SAL_STALL_FUNC_ID;
-
-
-typedef enum {
- InitializeLockServiceFunctionId,
- AcquireLockServiceFunctionId,
- ReleaseLockServiceFunctionId,
- MaxLockServiceFunctionId
-} EFI_EXTENDED_SAL_LOCK_SERVICES_FUNC_ID;
-
-//
-// BugBug : Covert the first 3 functions into a lib functions
-// and move SalRegisterPhysicalAddress to SAL BASE Class
-//
-typedef enum {
- SetVirtualAddressFunctionId,
- IsVirtualFunctionId,
- IsEfiRuntimeFunctionId,
- SalRegisterPhysicalAddressFunctionId
-} EFI_EXTENDED_SAL_VIRTUAL_SERVICES_FUNC_ID;
-
-typedef enum {
- GetTimeFunctionId,
- SetTimeFunctionId,
- GetWakeupTimeFunctionId,
- SetWakeupTimeFunctionId,
- GetRtcFreqFunctionId,
- InitializeThresholdFunctionId,
- BumpThresholdCountFunctionId,
- GetThresholdCountFunctionId
-} EFI_EXTENDED_SAL_RTC_SERVICES_FUNC_ID;
-
-typedef enum {
- EsalGetVariableFunctionId,
- EsalGetNextVariableNameFunctionId,
- EsalSetVariableFunctionId
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
- ,
- EsalQueryVariableInfoFunctionId
-#endif
-} EFI_EXTENDED_SAL_VARIABLE_SERVICES_FUNC_ID;
-
-typedef enum {
- GetNextHighMonotonicCountFunctionId
-} EFI_EXTENDED_SAL_MTC_SERVICES_FUNC_ID;
-
-typedef enum {
- ResetSystemFunctionId
-} EFI_EXTENDED_SAL_RESET_SERVICES_FUNC_ID;
-
-typedef enum {
- StatusCodeFunctionId
-} EFI_EXTENDED_SAL_STATUS_CODE_FUNC_ID;
-
-typedef enum {
- ReportStatusCodeServiceFunctionId
-} EFI_EXTENDED_SAL_STATUS_CODE_SERVICES_FUNC_ID;
-
-typedef enum {
- ReadFunctionId,
- WriteFunctionId,
- EraseBlockFunctionId,
- GetVolumeAttributesFunctionId,
- SetVolumeAttributesFunctionId,
- GetPhysicalAddressFunctionId,
- GetBlockSizeFunctionId,
- EraseCustomBlockRangeFunctionId
-} EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_FUNC_ID;
-
-typedef enum {
- AddCpuDataFunctionId,
- RemoveCpuDataFunctionId,
- ModifyCpuDataFunctionId,
- GetCpuDataByIDFunctionId,
- GetCpuDataByIndexFunctionId,
- SendIpiFunctionId,
- CurrentProcInfoFunctionId,
- NumProcessorsFunctionId,
- SetMinStateFunctionId,
- GetMinStateFunctionId,
- EsalPhysicalIdInfoFunctionId
-} EFI_EXTENDED_SAL_MP_SERVICES_FUNC_ID;
-
-typedef enum {
- PalProcFunctionId,
- SetNewPalEntryFunctionId,
- GetNewPalEntryFunctionId,
- EsalUpdatePalFunctionId
-} EFI_EXTENDED_SAL_PAL_SERVICES_FUNC_ID;
-
-typedef enum {
- McaVector,
- BspInitVector,
- BootRendezVector,
- ApInitVector
-} ESAL_GET_VECTOR_TYPE;
-
-typedef enum {
- SalSetVectorsFunctionId,
- SalMcRendezFunctionId,
- SalMcSetParamsFunctionId,
- EsalGetVectorsFunctionId,
- EsalMcGetParamsFunctionId,
- EsalMcGetMcParamsFunctionId,
- EsalGetMcCheckinFlagsFunctionId,
- EsalGetPlatformBaseFreqFunctionId,
- EsalRegisterPhysicalAddrFunctionId
-} EFI_EXTENDED_SAL_BASE_SERVICES_FUNC_ID;
-
-typedef enum {
- McaGetStateInfoFunctionId,
- McaRegisterCpuFunctionId
-} EFI_EXTENDED_SAL_MCA_SERVICES_FUNC_ID;
-
-typedef enum {
- SalPciConfigReadFunctionId,
- SalPciConfigWriteFunctionId
-} EFI_EXTENDED_SAL_PCI_SERVICES_FUNC_ID;
-
-typedef enum {
- SalCacheInitFunctionId,
- SalCacheFlushFunctionId
-} EFI_EXTENDED_SAL_CACHE_SERVICES_FUNC_ID;
-
-typedef enum {
- SalGetStateInfoFunctionId,
- SalGetStateInfoSizeFunctionId,
- SalClearStateInfoFunctionId,
- EsalGetStateBufferFunctionId,
- EsalSaveStateBufferFunctionId
-} EFI_EXTENDED_SAL_MCA_LOG_SERVICES_FUNC_ID;
-
-typedef enum {
- SalSetEventLogDataFunctionId,
- SalGetEventLogDataFunctionId,
- SalEraseEventLogDataFunctionId,
- SalActivateEventLogDataFunctionId
-} EFI_EXTENDED_SAL_ELOG_SERVICES_FUNC_ID;
-
-typedef enum {
- EsalGetComControllerInfoFunctionId,
- EsalSendComDataFunctionId,
- EsalReceiveComDataFunctionId
-} EFI_EXTENDED_SAL_SM_COM_LAYER_SERVICES_FUNC_ID;
-
-typedef enum {
- SalUpdatePalFunctionId
-} EFI_EXTENDED_SAL_UPDATE_PAL_SERVICES_FUNC_ID;
-
-typedef enum {
- EsalReadSensorInfoFunctionId,
- EsalReadSensorStatusFunctionId,
- EsalRearmSensorFunctionId,
- EsalReadSensorDataFunctionId
-} EFI_EXTENDED_SAL_SENSOR_SERVICES_FUNC_ID;
-
-typedef enum {
- EsalGetProcessorErrorEventInfoFunctionId,
- EsalGetPlatformErrorEventInfoFunctionId,
- EsalClearProcessorErrorEventInfoFunctionId,
- EsalClearPlatformErrorEventInfoFunctionId
-} EFI_EXTENDED_SAL_ERROR_EVENT_INFO_FUNC_ID;
-
-typedef struct {
- UINT64 ProtoData;
-} ESAL_GUID_DUMMY_PROTOCOL;
-
-extern EFI_GUID gEfiExtendedSalBaseIoServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalStallServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalLockServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalVirtualServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalRtcServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalVariableServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalMtcServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalResetServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalStatusCodeServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalFvBlockServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalMpServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalPalServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalBaseServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalMcaServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalPciServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalCacheServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalMcaLogServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalElogServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalSensorServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalSmComLayerServicesProtocolGuid;
-extern EFI_GUID gEfiExtendedSalSstGuid;
-extern EFI_GUID gEfiExtendedSalErrorEventInfoProtocolGuid;
-
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/FlashMapHob.h b/EdkModulePkg/Include/Guid/FlashMapHob.h
deleted file mode 100644
index a9e9b67..0000000
--- a/EdkModulePkg/Include/Guid/FlashMapHob.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FlashMapHob.h
-
-Abstract:
-
- GUID used for Flash Map HOB entries in the HOB list.
-
---*/
-
-#ifndef _FLASH_MAP_HOB_GUID_H_
-#define _FLASH_MAP_HOB_GUID_H_
-
-//
-// Definitions for Flash Map
-//
-#define EFI_FLASH_MAP_HOB_GUID \
- { 0xb091e7d2, 0x5a0, 0x4198, {0x94, 0xf0, 0x74, 0xb7, 0xb8, 0xc5, 0x54, 0x59 } }
-
-extern EFI_GUID gEfiFlashMapHobGuid;
-
-#endif // _FLASH_MAP_HOB_GUID_H_
diff --git a/EdkModulePkg/Include/Guid/GenericPlatformVariable.h b/EdkModulePkg/Include/Guid/GenericPlatformVariable.h
deleted file mode 100644
index 00ae375..0000000
--- a/EdkModulePkg/Include/Guid/GenericPlatformVariable.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- GenericPlatformVariable.h
-
-Abstract:
-
- The variable space Guid to pair with a Unicode string name to tag an EFI variable.
-
---*/
-
-#ifndef _GENERIC_PLATFORM_VARIABLE_H_
-#define _GENERIC_PLATFORM_VARIABLE_H_
-
-extern EFI_GUID gEfiGenericPlatformVariableGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/HotPlugDevice.h b/EdkModulePkg/Include/Guid/HotPlugDevice.h
deleted file mode 100644
index 42fb6da..0000000
--- a/EdkModulePkg/Include/Guid/HotPlugDevice.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- HotPlugDevice.h
-
-Abstract:
-
-
---*/
-
-#ifndef _HOT_PLUG_DEVICE_H_
-#define _HOT_PLUG_DEVICE_H_
-
-#define HOT_PLUG_DEVICE_GUID \
- { 0x220ac432, 0x1d43, 0x49e5, {0xa7, 0x4f, 0x4c, 0x9d, 0xa6, 0x7a, 0xd2, 0x3b } }
-
-extern EFI_GUID gEfiHotPlugDeviceGuid;
-#endif
diff --git a/EdkModulePkg/Include/Guid/MemoryStatusCodeRecord.h b/EdkModulePkg/Include/Guid/MemoryStatusCodeRecord.h
deleted file mode 100644
index 0c0fd9a..0000000
--- a/EdkModulePkg/Include/Guid/MemoryStatusCodeRecord.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MemoryStatusCodeRecord.h
-
-Abstract:
-
- GUID used to identify status code records HOB that originate from the PEI status code
-
---*/
-
-#ifndef _MEMORY_STATUS_CODE_RECORD_H__
-#define _MEMORY_STATUS_CODE_RECORD_H__
-
-#define MEMORY_STATUS_CODE_RECORD_GUID \
- { \
- 0x60cc026, 0x4c0d, 0x4dda, {0x8f, 0x41, 0x59, 0x5f, 0xef, 0x0, 0xa5, 0x2} \
- }
-
-/**
- Memory status code records packet structure :
- +---------------+----------+----------+-----+----------+-----+----------+
- | Packet Header | Record 1 | Record 2 | ... + Record n | ... | Record m |
- +---------------+----------+----------+-----+----------+-----+----------+
- ^ ^ ^
- +--------- RecordIndex -----------+ |
- +---------------- MaxRecordsNumber----------------------+
-**/
-typedef struct {
- UINT16 PacketIndex; // Index of the Packet.
- UINT16 RecordIndex; // Index of record in the packet.
- UINT32 MaxRecordsNumber; // Max number of records in the packet.
-} MEMORY_STATUSCODE_PACKET_HEADER;
-
-typedef struct {
- EFI_STATUS_CODE_TYPE CodeType;
- EFI_STATUS_CODE_VALUE Value;
- UINT32 Instance;
-} MEMORY_STATUSCODE_RECORD;
-
-
-extern EFI_GUID gMemoryStatusCodeRecordGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/MemoryTypeInformation.h b/EdkModulePkg/Include/Guid/MemoryTypeInformation.h
deleted file mode 100644
index ed9270b..0000000
--- a/EdkModulePkg/Include/Guid/MemoryTypeInformation.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- MemoryTypeInformation.h
-
-Abstract:
- GUID used for Memory Type Information entries in the HOB list.
-
---*/
-
-#ifndef __MEMORY_TYPE_INFORMATION_GUID_H__
-#define __MEMORY_TYPE_INFORMATION_GUID_H__
-
-#define EFI_MEMORY_TYPE_INFORMATION_GUID \
- { 0x4c19049f,0x4137,0x4dd3, { 0x9c,0x10,0x8b,0x97,0xa8,0x3f,0xfd,0xfa } }
-
-#define EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME L"MemoryTypeInformation"
-
-extern EFI_GUID gEfiMemoryTypeInformationGuid;
-
-typedef struct {
- UINT32 Type;
- UINT32 NumberOfPages;
-} EFI_MEMORY_TYPE_INFORMATION;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/MiniShellFile.h b/EdkModulePkg/Include/Guid/MiniShellFile.h
deleted file mode 100644
index fa42d4d..0000000
--- a/EdkModulePkg/Include/Guid/MiniShellFile.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EfiShell.h
-
-Abstract:
-
- FFS Filename for EFI Shell
-
---*/
-
-#ifndef _MINISHELLFILE_H_
-#define _MINISHELLFILE_H_
-
-#define EFI_MINI_SHELL_FILE_GUID \
- { 0x86ad232b, 0xd33a, 0x465c, {0xbf, 0x5f, 0x41, 0x37, 0xb, 0xa9, 0x2f, 0xe2 } }
-
-extern EFI_GUID gEfiMiniShellFileGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/PciHotplugDevice.h b/EdkModulePkg/Include/Guid/PciHotplugDevice.h
deleted file mode 100644
index 3b488ce..0000000
--- a/EdkModulePkg/Include/Guid/PciHotplugDevice.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciHotplugDevice.h
-
-Abstract:
-
- GUIDs used to indicate the device is Pccard hotplug device
-
---*/
-
-#ifndef _PCI_HOTPLUG_DEVICE_GUID_H_
-#define _PCI_HOTPLUG_DEVICE_GUID_H_
-
-#define EFI_PCI_HOTPLUG_DEVICE_GUID \
- { 0x0b280816, 0x52e7, 0x4e51, {0xaa, 0x57, 0x11, 0xbd, 0x41, 0xcb, 0xef, 0xc3 } }
-
-extern EFI_GUID gEfiPciHotplugDeviceGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/PciOptionRomTable.h b/EdkModulePkg/Include/Guid/PciOptionRomTable.h
deleted file mode 100644
index 5ad956e..0000000
--- a/EdkModulePkg/Include/Guid/PciOptionRomTable.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciOptionRomTable.h
-
-Abstract:
-
- GUID and data structure used to describe the list of PCI Option ROMs present in a system.
-
---*/
-
-#ifndef _PCI_OPTION_ROM_TABLE_GUID_H_
-
-#define EFI_PCI_OPTION_ROM_TABLE_GUID \
- { 0x7462660f, 0x1cbd, 0x48da, {0xad, 0x11, 0x91, 0x71, 0x79, 0x13, 0x83, 0x1c } }
-
-extern EFI_GUID gEfiPciOptionRomTableGuid;
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS RomAddress;
- EFI_MEMORY_TYPE MemoryType;
- UINT32 RomLength;
- UINT32 Seg;
- UINT8 Bus;
- UINT8 Dev;
- UINT8 Func;
- BOOLEAN ExecutedLegacyBiosImage;
- BOOLEAN DontLoadEfiRom;
-} EFI_PCI_OPTION_ROM_DESCRIPTOR;
-
-typedef struct {
- UINT64 PciOptionRomCount;
- EFI_PCI_OPTION_ROM_DESCRIPTOR *PciOptionRomDescriptors;
-} EFI_PCI_OPTION_ROM_TABLE;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/PeiPeCoffLoader.h b/EdkModulePkg/Include/Guid/PeiPeCoffLoader.h
deleted file mode 100644
index 4a732a1..0000000
--- a/EdkModulePkg/Include/Guid/PeiPeCoffLoader.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- PeiPeCoffLoader.h
-
-Abstract:
- GUID for the PE/COFF Loader APIs shared between PEI and DXE
-
---*/
-
-#ifndef __PEI_PE_COFF_LOADER_H__
-#define __PEI_PE_COFF_LOADER_H__
-
-//
-// MdePkg/Include/Common/PeCoffLoaderImageContext.h
-//
-#include <Common/PeCoffLoaderImageContext.h>
-
-#define EFI_PEI_PE_COFF_LOADER_GUID \
- { 0xd8117cff, 0x94a6, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
-
-typedef struct _EFI_PEI_PE_COFF_LOADER_PROTOCOL EFI_PEI_PE_COFF_LOADER_PROTOCOL;
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PEI_PE_COFF_LOADER_GET_IMAGE_INFO) (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PEI_PE_COFF_LOADER_LOAD_IMAGE) (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PEI_PE_COFF_LOADER_RELOCATE_IMAGE) (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PEI_PE_COFF_LOADER_UNLOAD_IMAGE) (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-struct _EFI_PEI_PE_COFF_LOADER_PROTOCOL {
- EFI_PEI_PE_COFF_LOADER_GET_IMAGE_INFO GetImageInfo;
- EFI_PEI_PE_COFF_LOADER_LOAD_IMAGE LoadImage;
- EFI_PEI_PE_COFF_LOADER_RELOCATE_IMAGE RelocateImage;
- EFI_PEI_PE_COFF_LOADER_UNLOAD_IMAGE UnloadImage;
-};
-
-extern EFI_GUID gEfiPeiPeCoffLoaderGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/PeiPerformanceHob.h b/EdkModulePkg/Include/Guid/PeiPerformanceHob.h
deleted file mode 100644
index c3bfc1f..0000000
--- a/EdkModulePkg/Include/Guid/PeiPerformanceHob.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PeiPerformanceHob.h
-
-Abstract:
-
- GUIDs used for PEI Performance HOB data structures
-
---*/
-
-#ifndef __PEI_PERFORMANCE_HOB_H__
-#define __PEI_PERFORMANCE_HOB_H__
-
-//
-// This is the GUID of PEI performance HOB
-//
-#define PEI_PERFORMANCE_HOB_GUID \
- { 0xec4df5af, 0x4395, 0x4cc9, { 0x94, 0xde, 0x77, 0x50, 0x6d, 0x12, 0xc7, 0xb8 } }
-
-//
-// PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
-//
-#define PEI_PERFORMANCE_STRING_SIZE 8
-#define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1)
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS Handle;
- CHAR8 Token[PEI_PERFORMANCE_STRING_SIZE];
- CHAR8 Module[PEI_PERFORMANCE_STRING_SIZE];
- UINT64 StartTimeStamp;
- UINT64 EndTimeStamp;
-} PEI_PERFORMANCE_LOG_ENTRY;
-
-//
-// The header must be aligned at 8 bytes.
-//
-typedef struct {
- UINT32 NumberOfEntries;
- UINT32 Reserved;
-} PEI_PERFORMANCE_LOG_HEADER;
-
-
-extern EFI_GUID gPeiPerformanceHobGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/PrimaryConsoleInDevice.h b/EdkModulePkg/Include/Guid/PrimaryConsoleInDevice.h
deleted file mode 100644
index e5aa49c..0000000
--- a/EdkModulePkg/Include/Guid/PrimaryConsoleInDevice.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PrimaryConsoleInDevice.h
-
-Abstract:
-
-
---*/
-
-#ifndef _PRIMARY_CONSOLE_IN_DEVICE_H_
-#define _PRIMARY_CONSOLE_IN_DEVICE_H_
-
-#define EFI_PRIMARY_CONSOLE_IN_DEVICE_GUID \
- { 0xe451dcbe, 0x96a1, 0x4729, {0xa5, 0xcf, 0x6b, 0x9c, 0x2c, 0xff, 0x47, 0xfd } }
-
-extern EFI_GUID gEfiPrimaryConsoleInDeviceGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/PrimaryConsoleOutDevice.h b/EdkModulePkg/Include/Guid/PrimaryConsoleOutDevice.h
deleted file mode 100644
index f73d727..0000000
--- a/EdkModulePkg/Include/Guid/PrimaryConsoleOutDevice.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PrimaryConsoleOutDevice.h
-
-Abstract:
-
---*/
-
-#ifndef _PRIMARY_CONSOLE_OUT_DEVICE_H_
-#define _PRIMARY_CONSOLE_OUT_DEVICE_H_
-
-#define EFI_PRIMARY_CONSOLE_OUT_DEVICE_GUID \
- { 0x62bdf38a, 0xe3d5, 0x492c, {0x95, 0xc, 0x23, 0xa7, 0xf6, 0x6e, 0x67, 0x2e } }
-
-extern EFI_GUID gEfiPrimaryConsoleOutDeviceGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/PrimaryStandardErrorDevice.h b/EdkModulePkg/Include/Guid/PrimaryStandardErrorDevice.h
deleted file mode 100644
index 97905ea..0000000
--- a/EdkModulePkg/Include/Guid/PrimaryStandardErrorDevice.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PrimaryStandardErrorDevice.h
-
-Abstract:
-
---*/
-
-#ifndef _PRIMARY_STANDARD_ERROR_DEVICE_H_
-#define _PRIMARY_STANDARD_ERROR_DEVICE_H_
-
-#define EFI_PRIMARY_STANDARD_ERROR_DEVICE_GUID \
- { 0x5a68191b, 0x9b97, 0x4752, {0x99, 0x46, 0xe3, 0x6a, 0x5d, 0xa9, 0x42, 0xb1 } }
-
-extern EFI_GUID gEfiPrimaryStandardErrorDeviceGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/ShellFile.h b/EdkModulePkg/Include/Guid/ShellFile.h
deleted file mode 100644
index 1f3d3b3..0000000
--- a/EdkModulePkg/Include/Guid/ShellFile.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EfiShell.h
-
-Abstract:
-
- FFS Filename for EFI Shell
-
---*/
-
-#ifndef _SHELLFILE_H_
-#define _SHELLFILE_H_
-
-#define EFI_SHELL_FILE_GUID \
- { 0xc57ad6b7, 0x0515, 0x40a8, {0x9d, 0x21, 0x55, 0x16, 0x52, 0x85, 0x4e, 0x37 } }
-
-
-extern EFI_GUID gEfiShellFileGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/StandardErrorDevice.h b/EdkModulePkg/Include/Guid/StandardErrorDevice.h
deleted file mode 100644
index 32b5af4..0000000
--- a/EdkModulePkg/Include/Guid/StandardErrorDevice.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- StandardErrorDevice.h
-
-Abstract:
-
-
---*/
-
-#ifndef _STANDARD_ERROR_DEVICE_H_
-#define _STANDARD_ERROR_DEVICE_H_
-
-#define EFI_STANDARD_ERROR_DEVICE_GUID \
- { 0xd3b36f2d, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
-
-extern EFI_GUID gEfiStandardErrorDeviceGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/StatusCode.h b/EdkModulePkg/Include/Guid/StatusCode.h
deleted file mode 100644
index 8242290..0000000
--- a/EdkModulePkg/Include/Guid/StatusCode.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- StatusCode.h
-
-Abstract:
-
- GUID used to identify Data Hub records that originate from the Tiano
- ReportStatusCode API.
-
---*/
-
-#ifndef _STATUS_CODE_H__
-#define _STATUS_CODE_H__
-
-#define EFI_STATUS_CODE_GUID \
- { \
- 0xd083e94c, 0x6560, 0x42e4, {0xb6, 0xd4, 0x2d, 0xf7, 0x5a, 0xdf, 0x6a, 0x2a } \
- }
-
-extern EFI_GUID gEfiStatusCodeGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/StatusCodeCallerId.h b/EdkModulePkg/Include/Guid/StatusCodeCallerId.h
deleted file mode 100644
index 8cf9d16..0000000
--- a/EdkModulePkg/Include/Guid/StatusCodeCallerId.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- StatusCodeCallerId.h
-
-Abstract:
- GUID used to identify id for the caller who is initiating the Status Code.
-
---*/
-
-#ifndef __STATUS_CODE_CALLER_ID_H__
-#define __STATUS_CODE_CALLER_ID_H__
-
-
-#define EFI_STANDARD_CALLER_ID_GUID \
- {0xC9DCF469, 0xA7C4, 0x11D5, {0x87, 0xDA, 0x00, 0x06, 0x29, 0x45, 0xC3, 0xB9} }
-
-extern EFI_GUID gEfiCallerIdGuid;
-
-
-#endif
diff --git a/EdkModulePkg/Include/Guid/SystemNvDataGuid.h b/EdkModulePkg/Include/Guid/SystemNvDataGuid.h
deleted file mode 100644
index 946d4d8..0000000
--- a/EdkModulePkg/Include/Guid/SystemNvDataGuid.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- SystemNvDataGuid.h
-
-Abstract:
-
- GUIDs used for System Non Volatile HOB entries in the in the HOB list and FV Guids carrying
- the System specific information.
-
---*/
-
-#ifndef __SYSTEM_NV_DATA_GUID_H__
-#define __SYSTEM_NV_DATA_GUID_H__
-
-#define EFI_SYSTEM_NV_DATA_FV_GUID \
- {0xfff12b8d, 0x7696, 0x4c8b, {0xa9, 0x85, 0x27, 0x47, 0x7, 0x5b, 0x4f, 0x50} }
-
-#define EFI_SYSTEM_NV_DATA_HOB_GUID \
- {0xd6e5092d, 0xc7b2, 0x4872, {0xaf, 0x66, 0xfd, 0xc0, 0xe6, 0xf9, 0x5e, 0x78} }
-
-typedef struct {
- EFI_GUID SystemNvDataHobGuid;
- EFI_GUID SystemNvDataFvGuid;
- EFI_LBA StartLba;
- UINTN StartLbaOffset;
- EFI_LBA EndLba;
- UINTN EndLbaOffset;
- UINT32 DataTypeSignature;
-} NV_SYSTEM_DATA_GUID_TYPE;
-
-extern EFI_GUID gEfiSystemNvDataHobGuid;
-extern EFI_GUID gEfiSystemNvDataFvGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Library/CustomDecompressLib.h b/EdkModulePkg/Include/Library/CustomDecompressLib.h
deleted file mode 100644
index 6edd3ba..0000000
--- a/EdkModulePkg/Include/Library/CustomDecompressLib.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- CustomDecompressLib.h
-
-Abstract:
-
- Custom Decompress Functions
-
---*/
-
-#ifndef __CUSTOM_DECPOMPRESS_LIB_H__
-#define __CUSTOM_DECPOMPRESS_LIB_H__
-
-RETURN_STATUS
-EFIAPI
-CustomDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- );
-
-RETURN_STATUS
-EFIAPI
-CustomDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- );
-
-#endif
diff --git a/EdkModulePkg/Include/Library/EdkDxeSalLib.h b/EdkModulePkg/Include/Library/EdkDxeSalLib.h
deleted file mode 100644
index 1277e0a..0000000
--- a/EdkModulePkg/Include/Library/EdkDxeSalLib.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EdkDxeSalLib.h
-
-Abstract:
-
---*/
-
-#ifndef _ESAL_SERVICE_LIB_H__
-#define _ESAL_SERVICE_LIB_H__
-
-EFI_STATUS
-EFIAPI
-RegisterEsalFunction (
- IN UINT64 FunctionId,
- IN EFI_GUID *ClassGuid,
- IN SAL_INTERNAL_EXTENDED_SAL_PROC Function,
- IN VOID *ModuleGlobal
- )
-/*++
-
-Routine Description:
-
- Register ESAL Class Function and it's asociated global.
- This function is boot service only!
-
-Arguments:
- FunctionId - ID of function to register
- ClassGuid - GUID of function class
- Function - Function to register under ClassGuid/FunctionId pair
- ModuleGlobal - Module global for Function.
-
-Returns:
- EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-RegisterEsalClass (
- IN EFI_GUID *ClassGuid,
- IN VOID *ModuleGlobal,
- ...
- )
-/*++
-
-Routine Description:
-
- Register ESAL Class and it's asociated global.
- This function is boot service only!
-
-Arguments:
- ClassGuid - GUID of function class
- ModuleGlobal - Module global for Function.
- .. - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
- indicates the end of the list.
-
-Returns:
- EFI_SUCCESS - All members of ClassGuid registered
-
---*/
-;
-
-SAL_RETURN_REGS
-EFIAPI
-EfiCallEsalService (
- IN EFI_GUID *ClassGuid,
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8
- )
-/*++
-
-Routine Description:
-
- Call module that is not linked direclty to this module. This code is IP
- relative and hides the binding issues of virtual or physical calling. The
- function that gets dispatched has extra arguments that include the registered
- module global and a boolean flag to indicate if the system is in virutal mode.
-
-Arguments:
- ClassGuid - GUID of function
- FunctionId - Function in ClassGuid to call
- Arg2 - Argument 2 ClassGuid/FunctionId defined
- Arg3 - Argument 3 ClassGuid/FunctionId defined
- Arg4 - Argument 4 ClassGuid/FunctionId defined
- Arg5 - Argument 5 ClassGuid/FunctionId defined
- Arg6 - Argument 6 ClassGuid/FunctionId defined
- Arg7 - Argument 7 ClassGuid/FunctionId defined
- Arg8 - Argument 8 ClassGuid/FunctionId defined
-
-Returns:
- Status of ClassGuid/FuncitonId
-
---*/
-;
-
-SAL_RETURN_REGS
-EFIAPI
-SetEsalVirtualEntryPoint (
- IN UINT64 EntryPoint,
- IN UINT64 Gp
- )
-;
-
-SAL_RETURN_REGS
-EFIAPI
-SetEsalPhysicalEntryPoint (
- IN UINT64 EntryPoint,
- IN UINT64 Gp
- )
-;
-
-SAL_RETURN_REGS
-EFIAPI
-GetEsalEntryPoint (
- VOID
- )
-;
-
-
-#endif
diff --git a/EdkModulePkg/Include/Library/EdkFvbServiceLib.h b/EdkModulePkg/Include/Library/EdkFvbServiceLib.h
deleted file mode 100644
index 16e00d3..0000000
--- a/EdkModulePkg/Include/Library/EdkFvbServiceLib.h
+++ /dev/null
@@ -1,250 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EdkFvbServiceLib.h
-
-Abstract:
-
---*/
-#ifndef __EDK_FVB_SERVICE_LIB_H__
-#define __EDK_FVB_SERVICE_LIB_H__
-
-EFI_STATUS
-EfiFvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
- Reads specified number of bytes into a buffer from the specified block
-
-Arguments:
- Instance - The FV instance to be read from
- Lba - The logical block address to be read from
- Offset - Offset into the block at which to begin reading
- NumBytes - Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes read
- Buffer - Pointer to a caller allocated buffer that will be
- used to hold the data read
-
-Returns:
-
- Status code
-
- EFI_INVALID_PARAMETER - invalid parameter
-
---*/
-;
-
-EFI_STATUS
-EfiFvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
- Writes specified number of bytes from the input buffer to the block
-
-Arguments:
- Instance - The FV instance to be written to
- Lba - The starting logical block index to write to
- Offset - Offset into the block at which to begin writing
- NumBytes - Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes actually written
- Buffer - Pointer to a caller allocated buffer that contains
- the source for the write
-
-Returns:
-
- Status code
-
- EFI_INVALID_PARAMETER - invalid parameter
-
---*/
-;
-
-EFI_STATUS
-EfiFvbEraseBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba
- )
-/*++
-
-Routine Description:
- Erases and initializes a firmware volume block
-
-Arguments:
- Instance - The FV instance to be erased
- Lba - The logical block index to be erased
-
-Returns:
-
- Status code
-
- EFI_INVALID_PARAMETER - invalid parameter
-
---*/
-;
-
-EFI_STATUS
-EfiFvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter
-
-Arguments:
- Instance - The FV instance whose attributes is going to be
- returned
- Attributes - Output buffer which contains attributes
-
-Returns:
- Status code
-
- EFI_INVALID_PARAMETER - invalid parameter
-
---*/
-;
-
-EFI_STATUS
-EfiFvbSetVolumeAttributes (
- IN UINTN Instance,
- IN EFI_FVB_ATTRIBUTES Attributes
- )
-/*++
-
-Routine Description:
- Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
-
-Arguments:
- Instance - The FV instance whose attributes is going to be
- modified
- Attributes - On input, it is a pointer to EFI_FVB_ATTRIBUTES
- containing the desired firmware volume settings.
- On successful return, it contains the new settings
- of the firmware volume
-
-Returns:
- Status code
-
- EFI_INVALID_PARAMETER - invalid parameter
-
---*/
-;
-
-EFI_STATUS
-EfiFvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress
- )
-/*++
-
-Routine Description:
- Retrieves the physical address of a memory mapped FV
-
-Arguments:
- Instance - The FV instance whose base address is going to be
- returned
- BaseAddress - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
- that on successful return, contains the base address
- of the firmware volume.
-
-Returns:
-
- Status code
-
- EFI_INVALID_PARAMETER - invalid parameter
-
---*/
-;
-
-EFI_STATUS
-EfiFvbGetBlockSize (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- )
-/*++
-
-Routine Description:
- Retrieve the size of a logical block
-
-Arguments:
- Instance - The FV instance whose block size is going to be
- returned
- Lba - Indicates which block to return the size for.
- BlockSize - A pointer to a caller allocated UINTN in which
- the size of the block is returned
- NumOfBlocks - a pointer to a caller allocated UINTN in which the
- number of consecutive blocks starting with Lba is
- returned. All blocks in this range have a size of
- BlockSize
-
-Returns:
- EFI_SUCCESS - The firmware volume was read successfully and
- contents are in Buffer
-
- EFI_INVALID_PARAMETER - invalid parameter
-
---*/
-;
-
-EFI_STATUS
-EfiFvbEraseCustomBlockRange (
- IN UINTN Instance,
- IN EFI_LBA StartLba,
- IN UINTN OffsetStartLba,
- IN EFI_LBA LastLba,
- IN UINTN OffsetLastLba
- )
-/*++
-
-Routine Description:
- Erases and initializes a specified range of a firmware volume
-
-Arguments:
- Instance - The FV instance to be erased
- StartLba - The starting logical block index to be erased
- OffsetStartLba - Offset into the starting block at which to
- begin erasing
- LastLba - The last logical block index to be erased
- OffsetLastLba - Offset into the last block at which to end erasing
-
-Returns:
-
- Status code
-
- EFI_INVALID_PARAMETER - invalid parameter
-
- EFI_UNSUPPORTED - not support
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Include/Library/EdkGenericBdsLib.h b/EdkModulePkg/Include/Library/EdkGenericBdsLib.h
deleted file mode 100644
index 537856f..0000000
--- a/EdkModulePkg/Include/Library/EdkGenericBdsLib.h
+++ /dev/null
@@ -1,395 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsLib.h
-
-Abstract:
-
- BDS library definition, include the file and data structure
-
---*/
-
-#ifndef _BDS_LIB_H_
-#define _BDS_LIB_H_
-
-extern EFI_HANDLE mBdsImageHandle;
-
-//
-// Constants which are variable names used to access variables
-//
-#define VarLegacyDevOrder L"LegacyDevOrder"
-
-//
-// Data structures and defines
-//
-#define FRONT_PAGE_QUESTION_ID 0x0000
-#define FRONT_PAGE_DATA_WIDTH 0x01
-
-//
-// ConnectType
-//
-#define CONSOLE_OUT 0x00000001
-#define STD_ERROR 0x00000002
-#define CONSOLE_IN 0x00000004
-#define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
-
-//
-// Load Option Attributes defined in EFI Specification
-//
-#define LOAD_OPTION_ACTIVE 0x00000001
-#define LOAD_OPTION_FORCE_RECONNECT 0x00000002
-#define IS_LOAD_OPTION_TYPE(_c, _Mask) (BOOLEAN) (((_c) & (_Mask)) != 0)
-
-//
-// Define Maxmim characters that will be accepted
-//
-#define MAX_CHAR 480
-#define MAX_CHAR_SIZE (MAX_CHAR * 2)
-
-#define MIN_ALIGNMENT_SIZE 4
-#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
-
-//
-// Define maximum characters for boot option variable "BootXXXX"
-//
-#define BOOT_OPTION_MAX_CHAR 10
-
-//
-// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.
-//
-#define BDS_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 'C', 'O')
-
-typedef struct {
-
- UINTN Signature;
- LIST_ENTRY Link;
-
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- CHAR16 *OptionName;
- UINTN OptionNumber;
- UINT16 BootCurrent;
- UINT32 Attribute;
- CHAR16 *Description;
- VOID *LoadOptions;
- UINT32 LoadOptionsSize;
-
-} BDS_COMMON_OPTION;
-
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINTN ConnectType;
-} BDS_CONSOLE_CONNECT_ENTRY;
-
-//
-// Lib Functions
-//
-
-//
-// Bds boot relate lib functions
-//
-EFI_STATUS
-BdsLibUpdateBootOrderList (
- IN LIST_ENTRY *BdsOptionList,
- IN CHAR16 *VariableName
- );
-
-VOID
-BdsLibBootNext (
- VOID
- );
-
-EFI_STATUS
-BdsLibBootViaBootOption (
- IN BDS_COMMON_OPTION * Option,
- IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
- OUT UINTN *ExitDataSize,
- OUT CHAR16 **ExitData OPTIONAL
- );
-
-EFI_STATUS
-BdsLibEnumerateAllBootOption (
- IN OUT LIST_ENTRY *BdsBootOptionList
- );
-
-VOID
-BdsLibBuildOptionFromHandle (
- IN EFI_HANDLE Handle,
- IN LIST_ENTRY *BdsBootOptionList
- );
-
-VOID
-BdsLibBuildOptionFromShell (
- IN EFI_HANDLE Handle,
- IN LIST_ENTRY *BdsBootOptionList
- );
-
-//
-// Bds misc lib functions
-//
-UINT16
-BdsLibGetTimeout (
- VOID
- );
-
-VOID
-BdsLibLoadDrivers (
- IN LIST_ENTRY *BdsDriverLists
- );
-
-EFI_STATUS
-BdsLibBuildOptionFromVar (
- IN LIST_ENTRY *BdsCommonOptionList,
- IN CHAR16 *VariableName
- );
-
-VOID *
-BdsLibGetVariableAndSize (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid,
- OUT UINTN *VariableSize
- );
-
-EFI_STATUS
-BdsLibOutputStrings (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *ConOut,
- ...
- );
-
-BDS_COMMON_OPTION *
-BdsLibVariableToOption (
- IN OUT LIST_ENTRY *BdsCommonOptionList,
- IN CHAR16 *VariableName
- );
-
-EFI_STATUS
-BdsLibRegisterNewOption (
- IN LIST_ENTRY *BdsOptionList,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CHAR16 *String,
- IN CHAR16 *VariableName
- );
-
-//
-// Bds connect or disconnect driver lib funcion
-//
-VOID
-BdsLibConnectAllDriversToAllControllers (
- VOID
- );
-
-VOID
-BdsLibConnectAll (
- VOID
- );
-
-EFI_STATUS
-BdsLibConnectDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
- );
-
-EFI_STATUS
-BdsLibConnectAllEfi (
- VOID
- );
-
-EFI_STATUS
-BdsLibDisconnectAllEfi (
- VOID
- );
-
-//
-// Bds console relate lib functions
-//
-VOID
-BdsLibConnectAllConsoles (
- VOID
- );
-
-EFI_STATUS
-BdsLibConnectAllDefaultConsoles (
- VOID
- );
-
-EFI_STATUS
-BdsLibUpdateConsoleVariable (
- IN CHAR16 *ConVarName,
- IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
- );
-
-EFI_STATUS
-BdsLibConnectConsoleVariable (
- IN CHAR16 *ConVarName
- );
-
-//
-// Bds device path relate lib functions
-//
-EFI_DEVICE_PATH_PROTOCOL *
-BdsLibUnpackDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-VOID
-BdsLibSafeFreePool (
- IN VOID *Buffer
- );
-
-EFI_DEVICE_PATH_PROTOCOL *
-BdsLibDelPartMatchInstance (
- IN EFI_DEVICE_PATH_PROTOCOL *Multi,
- IN EFI_DEVICE_PATH_PROTOCOL *Single
- );
-
-BOOLEAN
-BdsLibMatchDevicePaths (
- IN EFI_DEVICE_PATH_PROTOCOL *Multi,
- IN EFI_DEVICE_PATH_PROTOCOL *Single
- );
-
-CHAR16 *
-DevicePathToStr (
- EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-VOID *
-EfiLibGetVariable (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid
- );
-
-//
-// Internal definitions
-//
-typedef struct {
- CHAR16 *str;
- UINTN len;
- UINTN maxlen;
-} POOL_PRINT;
-
-typedef struct {
- UINT8 Type;
- UINT8 SubType;
- VOID (*Function) (POOL_PRINT *, VOID *);
-} DEVICE_PATH_STRING_TABLE;
-
-//
-// Internal functions
-//
-EFI_STATUS
-BdsBootByDiskSignatureAndPartition (
- IN BDS_COMMON_OPTION * Option,
- IN HARDDRIVE_DEVICE_PATH * HardDriveDevicePath,
- IN UINT32 LoadOptionsSize,
- IN VOID *LoadOptions,
- OUT UINTN *ExitDataSize,
- OUT CHAR16 **ExitData OPTIONAL
- );
-
-//
-// Notes: EFI 64 shadow all option rom
-//
-#if defined (MDE_CPU_IPF)
-#define EFI64_SHADOW_ALL_LEGACY_ROM() ShadowAllOptionRom ();
-VOID
-ShadowAllOptionRom();
-#else
-#define EFI64_SHADOW_ALL_LEGACY_ROM()
-#endif
-
-//
-// BBS support macros and functions
-//
-#if defined (MDE_CPU_IA32)
-#define REFRESH_LEGACY_BOOT_OPTIONS \
- BdsDeleteAllInvalidLegacyBootOptions ();\
- BdsAddNonExistingLegacyBootOptions (); \
- BdsUpdateLegacyDevOrder ()
-#else
-#define REFRESH_LEGACY_BOOT_OPTIONS
-#endif
-
-EFI_STATUS
-BdsDeleteAllInvalidLegacyBootOptions (
- VOID
- );
-
-EFI_STATUS
-BdsAddNonExistingLegacyBootOptions (
- VOID
- );
-
-EFI_STATUS
-BdsUpdateLegacyDevOrder (
- VOID
- );
-
-EFI_STATUS
-BdsRefreshBbsTableForBoot (
- IN BDS_COMMON_OPTION *Entry
- );
-
-EFI_STATUS
-BdsDeleteBootOption (
- IN UINTN OptionNumber,
- IN OUT UINT16 *BootOrder,
- IN OUT UINTN *BootOrderSize
- );
-
-//
-//The interface functions relate with Setup Browser Reset Reminder feature
-//
-VOID
-EnableResetReminderFeature (
- VOID
- );
-
-VOID
-DisableResetReminderFeature (
- VOID
- );
-
-VOID
-EnableResetRequired (
- VOID
- );
-
-VOID
-DisableResetRequired (
- VOID
- );
-
-BOOLEAN
-IsResetReminderFeatureEnable (
- VOID
- );
-
-BOOLEAN
-IsResetRequired (
- VOID
- );
-
-VOID
-SetupResetReminder (
- VOID
- );
-
-EFI_STATUS
-BdsLibGetHiiHandles (
- IN EFI_HII_PROTOCOL *Hii,
- IN OUT UINT16 *HandleBufferLength,
- OUT EFI_HII_HANDLE **HiiHandles
- );
-
-#endif // _BDS_LIB_H_
diff --git a/EdkModulePkg/Include/Library/EdkGenericPlatformBdsLib.h b/EdkModulePkg/Include/Library/EdkGenericPlatformBdsLib.h
deleted file mode 100644
index 699abd8..0000000
--- a/EdkModulePkg/Include/Library/EdkGenericPlatformBdsLib.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsPlatform.h
-
-Abstract:
-
- Head file for BDS Platform specific code
-
---*/
-
-#ifndef _BDS_PLATFORM_LIB_H
-#define _BDS_PLATFORM_LIB_H
-
-extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
-extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];
-extern EFI_DEVICE_PATH_PROTOCOL *gPlatformDriverOption[];
-//
-// Bds AP Context data
-//
-#define EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('B', 'd', 's', 'A')
-typedef struct {
- UINTN Signature;
-
- EFI_HANDLE Handle;
-
- EFI_BDS_ARCH_PROTOCOL Bds;
-
- //
- // Save the current boot mode
- //
- EFI_BOOT_MODE BootMode;
-
- //
- // Set true if boot with default settings
- //
- BOOLEAN DefaultBoot;
-
- //
- // The system default timeout for choose the boot option
- //
- UINT16 TimeoutDefault;
-
- //
- // Memory Test Level
- //
- EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel;
-
-} EFI_BDS_ARCH_PROTOCOL_INSTANCE;
-
-#define EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS(_this) \
- CR (_this, \
- EFI_BDS_ARCH_PROTOCOL_INSTANCE, \
- Bds, \
- EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE \
- )
-
-
-#define gEndEntire \
- { \
- END_DEVICE_PATH_TYPE,\
- END_ENTIRE_DEVICE_PATH_SUBTYPE,\
- {\
- END_DEVICE_PATH_LENGTH,\
- 0\
- }\
- }
-
-//
-// Platform BDS Functions
-//
-VOID
-PlatformBdsInit (
- IN EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData
- )
-;
-
-VOID
-PlatformBdsPolicyBehavior (
- IN EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData,
- IN LIST_ENTRY *DriverOptionList,
- IN LIST_ENTRY *BootOptionList
- )
-;
-
-EFI_STATUS
-BdsMemoryTest (
- EXTENDMEM_COVERAGE_LEVEL Level
- )
-;
-
-EFI_STATUS
-PlatformBdsShowProgress (
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
- CHAR16 *Title,
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
- UINTN Progress,
- UINTN PreviousValue
- )
-;
-
-VOID
-PlatformBdsBootFail (
- IN BDS_COMMON_OPTION *Option,
- IN EFI_STATUS Status,
- IN CHAR16 *ExitData,
- IN UINTN ExitDataSize
- )
-;
-
-VOID
-PlatformBdsBootSuccess (
- IN BDS_COMMON_OPTION *Option
- )
-;
-
-EFI_STATUS
-ProcessCapsules (
- EFI_BOOT_MODE BootMode
- )
-;
-
-VOID
-PlatformBdsEnterFrontPage (
- IN UINT16 TimeoutDefault,
- IN BOOLEAN ConnectAllHappened
- );
-
-#endif // _BDS_PLATFORM_LIB_H
diff --git a/EdkModulePkg/Include/Library/EdkGraphicsLib.h b/EdkModulePkg/Include/Library/EdkGraphicsLib.h
deleted file mode 100644
index 30b2a7c..0000000
--- a/EdkModulePkg/Include/Library/EdkGraphicsLib.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- GraphicsLib.h
-
-Abstract:
-
-
---*/
-
-#ifndef _EFI_GRAPHICS_LIB_H_
-#define _EFI_GRAPHICS_LIB_H_
-
-EFI_STATUS
-GetGraphicsBitMapFromFV (
- IN EFI_GUID *FileNameGuid,
- OUT VOID **Image,
- OUT UINTN *ImageSize
- )
-/*++
-
-Routine Description:
-
- Return the graphics image file named FileNameGuid into Image and return it's
- size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
- file name.
-
-Arguments:
-
- FileNameGuid - File Name of graphics file in the FV(s).
-
- Image - Pointer to pointer to return graphics image. If NULL, a
- buffer will be allocated.
-
- ImageSize - Size of the graphics Image in bytes. Zero if no image found.
-
-
-Returns:
-
- EFI_SUCCESS - Image and ImageSize are valid.
- EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size
- EFI_NOT_FOUND - FileNameGuid not found
-
---*/
-;
-
-EFI_STATUS
-ConvertBmpToUgaBlt (
- IN VOID *BmpImage,
- IN UINTN BmpImageSize,
- IN OUT VOID **UgaBlt,
- IN OUT UINTN *UgaBltSize,
- OUT UINTN *PixelHeight,
- OUT UINTN *PixelWidth
- )
-/*++
-
-Routine Description:
-
- Convert a *.BMP graphics image to a UGA blt buffer. If a NULL UgaBlt buffer
- is passed in a UgaBlt buffer will be allocated by this routine. If a UgaBlt
- buffer is passed in it will be used if it is big enough.
-
-Arguments:
-
- BmpImage - Pointer to BMP file
-
- BmpImageSize - Number of bytes in BmpImage
-
- UgaBlt - Buffer containing UGA version of BmpImage.
-
- UgaBltSize - Size of UgaBlt in bytes.
-
- PixelHeight - Height of UgaBlt/BmpImage in pixels
-
- PixelWidth - Width of UgaBlt/BmpImage in pixels
-
-
-Returns:
-
- EFI_SUCCESS - UgaBlt and UgaBltSize are returned.
- EFI_UNSUPPORTED - BmpImage is not a valid *.BMP image
- EFI_BUFFER_TOO_SMALL - The passed in UgaBlt buffer is not big enough.
- UgaBltSize will contain the required size.
-
---*/
-;
-
-EFI_STATUS
-EnableQuietBoot (
- IN EFI_GUID *LogoFile
- )
-/*++
-
-Routine Description:
-
- Use Console Control to turn off UGA based Simple Text Out consoles from going
- to the UGA device. Put up LogoFile on every UGA device that is a console
-
-Arguments:
-
- LogoFile - File name of logo to display on the center of the screen.
-
-
-Returns:
-
- EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
- displayed.
- EFI_UNSUPPORTED - Logo not found
-
---*/
-;
-
-EFI_STATUS
-DisableQuietBoot (
- VOID
- )
-/*++
-
-Routine Description:
-
- Use Console Control to turn on UGA based Simple Text Out consoles. The UGA
- Simple Text Out screens will now be synced up with all non UGA output devices
-
-Arguments:
-
- NONE
-
-Returns:
-
- EFI_SUCCESS - UGA devices are back in text mode and synced up.
- EFI_UNSUPPORTED - Logo not found
-
---*/
-;
-
-EFI_STATUS
-LockKeyboards (
- IN CHAR16 *Password
- )
-/*++
-
-Routine Description:
- Use Console Control Protocol to lock the Console In Spliter virtual handle.
- This is the ConInHandle and ConIn handle in the EFI system table. All key
- presses will be ignored until the Password is typed in. The only way to
- disable the password is to type it in to a ConIn device.
-
-Arguments:
- Password - Password used to lock ConIn device
-
-
-Returns:
-
- EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
- displayed.
- EFI_UNSUPPORTED - Logo not found
-
---*/
-;
-
-UINTN
-EFIAPI
-PrintXY (
- IN UINTN X,
- IN UINTN Y,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background, OPTIONAL
- IN CHAR16 *Fmt,
- ...
- )
-;
-
-
-#endif
diff --git a/EdkModulePkg/Include/Library/EdkIfrSupportLib.h b/EdkModulePkg/Include/Library/EdkIfrSupportLib.h
deleted file mode 100644
index d2a1ff5..0000000
--- a/EdkModulePkg/Include/Library/EdkIfrSupportLib.h
+++ /dev/null
@@ -1,1270 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- IfrSupportLib.h
-
-Abstract:
-
- The file contain all library function for Ifr Operations.
-
---*/
-
-#ifndef _IFRSUPPORTLIBRARY_H
-#define _IFRSUPPORTLIBRARY_H
-
-#define DEFAULT_FORM_BUFFER_SIZE 0xFFFF
-#define DEFAULT_STRING_BUFFER_SIZE 0xFFFF
-
-#pragma pack(1)
-typedef struct {
- CHAR16 *OptionString; // Passed in string to generate a token for in a truly dynamic form creation
- STRING_REF StringToken; // This is used when creating a single op-code without generating a StringToken (have one already)
- UINT16 Value;
- UINT8 Flags;
- UINT16 Key;
-} IFR_OPTION;
-#pragma pack()
-
-EFI_STATUS
-GetCurrentLanguage (
- OUT CHAR16 *Lang
- )
-/*++
-
-Routine Description:
-
- Determine what is the current language setting
-
-Arguments:
-
- Lang - Pointer of system language
-
-Returns:
-
- Status code
-
---*/
-;
-
-EFI_STATUS
-AddString (
- IN VOID *StringBuffer,
- IN CHAR16 *Language,
- IN CHAR16 *String,
- IN OUT STRING_REF *StringToken
- )
-/*++
-
-Routine Description:
-
- Add a string to the incoming buffer and return the token and offset data
-
-Arguments:
-
- StringBuffer - The incoming buffer
-
- Language - Currrent language
-
- String - The string to be added
-
- StringToken - The index where the string placed
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - String successfully added to the incoming buffer
-
---*/
-;
-
-EFI_STATUS
-AddOpCode (
- IN VOID *FormBuffer,
- IN OUT VOID *OpCodeData
- )
-/*++
-
-Routine Description:
-
- Add op-code data to the FormBuffer
-
-Arguments:
-
- FormBuffer - Form buffer to be inserted to
-
- OpCodeData - Op-code data to be inserted
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Op-code data successfully inserted
-
---*/
-;
-
-EFI_STATUS
-CreateFormSet (
- IN CHAR16 *FormSetTitle,
- IN EFI_GUID *Guid,
- IN UINT8 Class,
- IN UINT8 SubClass,
- IN OUT VOID **FormBuffer,
- IN OUT VOID **StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a formset
-
-Arguments:
-
- FormSetTitle - Title of formset
-
- Guid - Guid of formset
-
- Class - Class of formset
-
- SubClass - Sub class of formset
-
- FormBuffer - Pointer of the formset created
-
- StringBuffer - Pointer of FormSetTitile string created
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Formset successfully created
-
---*/
-;
-
-EFI_STATUS
-CreateForm (
- IN CHAR16 *FormTitle,
- IN UINT16 FormId,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a form
-
-Arguments:
-
- FormTitle - Title of the form
-
- FormId - Id of the form
-
- FormBuffer - Pointer of the form created
-
- StringBuffer - Pointer of FormTitil string created
-
-Returns:
-
- EFI_SUCCESS - Form successfully created
-
---*/
-;
-
-EFI_STATUS
-CreateSubTitle (
- IN CHAR16 *SubTitle,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a SubTitle
-
-Arguments:
-
- SubTitle - Sub title to be created
-
- FormBuffer - Where this subtitle to add to
-
- StringBuffer - String buffer created for subtitle
-
-Returns:
-
- EFI_SUCCESS - Subtitle successfully created
-
---*/
-;
-
-EFI_STATUS
-CreateText (
- IN CHAR16 *String,
- IN CHAR16 *String2,
- IN CHAR16 *String3,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a line of text
-
-Arguments:
-
- String - First string of the text
-
- String2 - Second string of the text
-
- String3 - Help string of the text
-
- Flags - Flag of the text
-
- Key - Key of the text
-
- FormBuffer - The form where this text adds to
-
- StringBuffer - String buffer created for String, String2 and String3
-
-Returns:
-
- EFI_SUCCESS - Text successfully created
-
---*/
-;
-
-EFI_STATUS
-CreateGoto (
- IN UINT16 FormId,
- IN CHAR16 *Prompt,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a hyperlink
-
-Arguments:
-
- FormId - Form ID of the hyperlink
-
- Prompt - Prompt of the hyperlink
-
- FormBuffer - The form where this hyperlink adds to
-
- StringBuffer - String buffer created for Prompt
-
-Returns:
-
- EFI_SUCCESS - Hyperlink successfully created
-
---*/
-;
-
-EFI_STATUS
-CreateOneOf (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a one-of question with a set of options to choose from. The
- OptionsList is a pointer to a null-terminated list of option descriptions.
-
-Arguments:
-
- QuestionId - Question ID of the one-of box
-
- DataWidth - DataWidth of the one-of box
-
- Prompt - Prompt of the one-of box
-
- Help - Help of the one-of box
-
- OptionsList - Each string in it is an option of the one-of box
-
- OptionCount - Option string count
-
- FormBuffer - The form where this one-of box adds to
-
- StringBuffer - String buffer created for Prompt, Help and Option strings
-
-Returns:
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
- EFI_SUCCESS - One-Of box successfully created.
-
---*/
-;
-
-EFI_STATUS
-CreateOrderedList (
- IN UINT16 QuestionId,
- IN UINT8 MaxEntries,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a one-of question with a set of options to choose from. The
- OptionsList is a pointer to a null-terminated list of option descriptions.
-
-Arguments:
-
- QuestionId - Question ID of the ordered list
-
- MaxEntries - MaxEntries of the ordered list
-
- Prompt - Prompt of the ordered list
-
- Help - Help of the ordered list
-
- OptionsList - Each string in it is an option of the ordered list
-
- OptionCount - Option string count
-
- FormBuffer - The form where this ordered list adds to
-
- StringBuffer - String buffer created for Prompt, Help and Option strings
-
-Returns:
-
- EFI_SUCCESS - Ordered list successfully created.
-
---*/
-;
-
-EFI_STATUS
-CreateCheckBox (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN UINT8 Flags,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a checkbox
-
-Arguments:
-
- QuestionId - Question ID of the check box
-
- DataWidth - DataWidth of the check box
-
- Prompt - Prompt of the check box
-
- Help - Help of the check box
-
- Flags - Flags of the check box
-
- FormBuffer - The form where this check box adds to
-
- StringBuffer - String buffer created for Prompt and Help.
-
-Returns:
-
- EFI_DEVICE_ERROR - DataWidth > 1
-
- EFI_SUCCESS - Check box successfully created
-
---*/
-;
-
-EFI_STATUS
-CreateNumeric (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN UINT16 Minimum,
- IN UINT16 Maximum,
- IN UINT16 Step,
- IN UINT16 Default,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a numeric
-
-Arguments:
-
- QuestionId - Question ID of the numeric
-
- DataWidth - DataWidth of the numeric
-
- Prompt - Prompt of the numeric
-
- Help - Help of the numeric
-
- Minimum - Minumun boundary of the numeric
-
- Maximum - Maximum boundary of the numeric
-
- Step - Step of the numeric
-
- Default - Default value
-
- Flags - Flags of the numeric
-
- Key - Key of the numeric
-
- FormBuffer - The form where this numeric adds to
-
- StringBuffer - String buffer created for Prompt and Help.
-
-Returns:
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
- EFI_SUCCESS - Numeric is successfully created
-
---*/
-;
-
-EFI_STATUS
-CreateString (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN UINT8 MinSize,
- IN UINT8 MaxSize,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a string
-
-Arguments:
-
- QuestionId - Question ID of the string
-
- DataWidth - DataWidth of the string
-
- Prompt - Prompt of the string
-
- Help - Help of the string
-
- MinSize - Min size boundary of the string
-
- MaxSize - Max size boundary of the string
-
- Flags - Flags of the string
-
- Key - Key of the string
-
- FormBuffer - The form where this string adds to
-
- StringBuffer - String buffer created for Prompt and Help.
-
-Returns:
-
- EFI_SUCCESS - String successfully created.
-
---*/
-;
-
-EFI_STATUS
-ExtractDataFromHiiHandle (
- IN EFI_HII_HANDLE HiiHandle,
- IN OUT UINT16 *ImageLength,
- OUT UINT8 *DefaultImage,
- OUT EFI_GUID *Guid
- )
-/*++
-
-Routine Description:
-
- Extract information pertaining to the HiiHandle
-
-Arguments:
-
- HiiHandle - Hii handle
-
- ImageLength - For input, length of DefaultImage;
- For output, length of actually required
-
- DefaultImage - Image buffer prepared by caller
-
- Guid - Guid information about the form
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_BUFFER_TOO_SMALL - DefualtImage has no enough ImageLength
-
- EFI_SUCCESS - Successfully extract data from Hii database.
-
-
---*/
-;
-
-EFI_HII_HANDLE
-FindHiiHandle (
- IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL
- IN EFI_GUID *Guid
- )
-/*++
-
-Routine Description:
- Finds HII handle for given pack GUID previously registered with the HII.
-
-Arguments:
- HiiProtocol - pointer to pointer to HII protocol interface.
- If NULL, the interface will be found but not returned.
- If it points to NULL, the interface will be found and
- written back to the pointer that is pointed to.
- Guid - The GUID of the pack that registered with the HII.
-
-Returns:
- Handle to the HII pack previously registered by the memory driver.
-
---*/
-;
-
-EFI_STATUS
-CreateSubTitleOpCode (
- IN STRING_REF StringToken,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a SubTitle opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- StringToken - StringToken of the subtitle
-
- FormBuffer - Output of subtitle as a form
-
-Returns:
-
- EFI_SUCCESS - Subtitle created to be a form
-
---*/
-;
-
-EFI_STATUS
-CreateTextOpCode (
- IN STRING_REF StringToken,
- IN STRING_REF StringTokenTwo,
- IN STRING_REF StringTokenThree,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a Text opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- StringToken - First string token of the text
-
- StringTokenTwo - Second string token of the text
-
- StringTokenThree - Help string token of the text
-
- Flags - Flag of the text
-
- Key - Key of the text
-
- FormBuffer - Output of text as a form
-
-Returns:
-
- EFI_SUCCESS - Text created to be a form
-
---*/
-;
-
-EFI_STATUS
-CreateGotoOpCode (
- IN UINT16 FormId,
- IN STRING_REF StringToken,
- IN STRING_REF StringTokenTwo,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a hyperlink opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- FormId - Form ID of the hyperlink
-
- StringToken - Prompt string token of the hyperlink
-
- StringTokenTwo - Help string token of the hyperlink
-
- Flags - Flags of the hyperlink
-
- Key - Key of the hyperlink
-
- FormBuffer - Output of hyperlink as a form
-
-Returns:
-
- EFI_SUCCESS - Hyperlink created to be a form
-
---*/
-;
-
-EFI_STATUS
-CreateOneOfOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a one-of opcode with a set of option op-codes to choose from independent of string creation.
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
- OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken
- has been filled in since this routine will not generate StringToken values.
-
-Arguments:
-
- QuestionId - Question ID of the one-of box
-
- DataWidth - DataWidth of the one-of box
-
- PromptToken - Prompt string token of the one-of box
-
- HelpToken - Help string token of the one-of box
-
- OptionsList - Each string in it is an option of the one-of box
-
- OptionCount - Option string count
-
- FormBuffer - Output of One-Of box as a form
-
-Returns:
-
- EFI_SUCCESS - One-Of box created to be a form
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
---*/
-;
-
-EFI_STATUS
-CreateOrderedListOpCode (
- IN UINT16 QuestionId,
- IN UINT8 MaxEntries,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a ordered list opcode with a set of option op-codes to choose from independent of string creation.
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
- OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken
- has been filled in since this routine will not generate StringToken values.
-
-Arguments:
-
- QuestionId - Question ID of the ordered list
-
- MaxEntries - MaxEntries of the ordered list
-
- PromptToken - Prompt string token of the ordered list
-
- HelpToken - Help string token of the ordered list
-
- OptionsList - Each string in it is an option of the ordered list
-
- OptionCount - Option string count
-
- FormBuffer - Output of ordered list as a form
-
-Returns:
-
- EFI_SUCCESS - Ordered list created to be a form
-
---*/
-;
-
-EFI_STATUS
-CreateCheckBoxOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a checkbox opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- QuestionId - Question ID of the check box
-
- DataWidth - DataWidth of the check box
-
- PromptToken - Prompt string token of the check box
-
- HelpToken - Help string token of the check box
-
- Flags - Flags of the check box
-
- Key - Key of the check box
-
- FormBuffer - Output of the check box as a form
-
-Returns:
-
- EFI_SUCCESS - Checkbox created to be a form
-
- EFI_DEVICE_ERROR - DataWidth > 1
-
---*/
-;
-
-EFI_STATUS
-CreateNumericOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN UINT16 Minimum,
- IN UINT16 Maximum,
- IN UINT16 Step,
- IN UINT16 Default,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a numeric opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- QuestionId - Question ID of the numeric
-
- DataWidth - DataWidth of the numeric
-
- PromptToken - Prompt string token of the numeric
-
- HelpToken - Help string token of the numeric
-
- Minimum - Minumun boundary of the numeric
-
- Maximum - Maximum boundary of the numeric
-
- Step - Step of the numeric
-
- Default - Default value of the numeric
-
- Flags - Flags of the numeric
-
- Key - Key of the numeric
-
- FormBuffer - Output of the numeric as a form
-
-Returns:
-
- EFI_SUCCESS - The numeric created to be a form.
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
---*/
-;
-
-EFI_STATUS
-CreateStringOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN UINT8 MinSize,
- IN UINT8 MaxSize,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a numeric opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- QuestionId - Question ID of the string
-
- DataWidth - DataWidth of the string
-
- PromptToken - Prompt token of the string
-
- HelpToken - Help token of the string
-
- MinSize - Min size boundary of the string
-
- MaxSize - Max size boundary of the string
-
- Flags - Flags of the string
-
- Key - Key of the string
-
- FormBuffer - Output of the string as a form
-
-Returns:
-
- EFI_SUCCESS - String created to be a form.
-
---*/
-;
-
-EFI_STATUS
-ValidateDataFromHiiHandle (
- IN EFI_HII_HANDLE HiiHandle,
- OUT BOOLEAN *Results
- )
-/*++
-
-Routine Description:
-
- Validate that the data associated with the HiiHandle in NVRAM is within
- the reasonable parameters for that FormSet. Values for strings and passwords
- are not verified due to their not having the equivalent of valid range settings.
-
-Arguments:
-
- HiiHandle - Handle of the HII database entry to query
-
- Results - If return Status is EFI_SUCCESS, Results provides valid data
- TRUE = NVRAM Data is within parameters
- FALSE = NVRAM Data is NOT within parameters
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Data successfully validated
---*/
-;
-
-EFI_STATUS
-CreateBannerOpCode (
- IN UINT16 Title,
- IN UINT16 LineNumber,
- IN UINT8 Alignment,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a banner opcode. This is primarily used by the FrontPage implementation from BDS.
-
-Arguments:
-
- Title - Title of the banner
-
- LineNumber - LineNumber of the banner
-
- Alignment - Alignment of the banner
-
- FormBuffer - Output of banner as a form
-
-Returns:
-
- EFI_SUCCESS - Banner created to be a form.
-
---*/
-;
-
-VOID
-EfiLibHiiVariablePackGetMap (
- IN EFI_HII_VARIABLE_PACK *Pack,
- OUT CHAR16 **Name, OPTIONAL
- OUT EFI_GUID **Guid, OPTIONAL
- OUT UINT16 *Id, OPTIONAL
- OUT VOID **Var, OPTIONAL
- OUT UINTN *Size OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Extracts a variable form a Pack.
-
-Arguments:
-
- Pack - List of variables
- Name - Name of the variable/map
- Guid - GUID of the variable/map
- Var - Pointer to the variable/map
- Size - Size of the variable/map in bytes
-
-Returns:
-
- VOID.
-
---*/
-;
-
-UINTN
-EfiLibHiiVariablePackListGetMapCnt (
- IN EFI_HII_VARIABLE_PACK_LIST *List
- )
-/*++
-
-Routine Description:
-
- Finds a count of the variables/maps in the List.
-
-Arguments:
-
- List - List of variables
-
-Returns:
-
- Number of Map in the variable pack list.
-
---*/
-;
-
-typedef VOID (EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK) (
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN UINT16 Id,
- IN VOID *Var,
- IN UINTN Size
- )
-/*++
-
-Routine Description:
-
- type definition for the callback to be
- used with EfiLibHiiVariablePackListForEachVar().
-
-Arguments:
-
- Id - Variable/Map ID
- Name - Name of the variable/map
- Guid - GUID of the variable/map
- Var - Pointer to the variable/map
- Size - Size of the variable/map in bytes
-
-Returns:
-
- VOID
-
---*/
-;
-
-VOID
-EfiLibHiiVariablePackListForEachVar (
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback
- )
-/*++
-
-Routine Description:
-
- Will iterate all variable/maps as appearing
- in List and for each, it will call the Callback.
-
-Arguments:
-
- List - List of variables
- Callback - Routine to be called for each iterated variable.
-
-Returns:
-
- VOID
-
---*/
-;
-
-EFI_STATUS
-EfiLibHiiVariablePackListGetMapByIdx (
- IN UINTN Idx,
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- OUT CHAR16 **Name, OPTIONAL
- OUT EFI_GUID **Guid, OPTIONAL
- OUT UINT16 *Id, OPTIONAL
- OUT VOID **Var,
- OUT UINTN *Size
- )
-/*++
-
-Routine Description:
-
- Finds a variable form List given
- the order number as appears in the List.
-
-Arguments:
-
- Idx - The index of the variable/map to retrieve
- List - List of variables
- Name - Name of the variable/map
- Guid - GUID of the variable/map
- Var - Pointer to the variable/map
- Size - Size of the variable/map in bytes
-
-Returns:
-
- EFI_SUCCESS - Variable is found, OUT parameters are valid
- EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
-
---*/
-;
-
-EFI_STATUS
-EfiLibHiiVariablePackListGetMapById (
- IN UINT16 Id,
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- OUT CHAR16 **Name, OPTIONAL
- OUT EFI_GUID **Guid, OPTIONAL
- OUT VOID **Var,
- OUT UINTN *Size
- )
-/*++
-
-Routine Description:
-
- Finds a variable form List given the
- order number as appears in the List.
-
-Arguments:
-
- Id - The ID of the variable/map to retrieve
- List - List of variables
- Name - Name of the variable/map
- Guid - GUID of the variable/map
- Var - Pointer to the variable/map
- Size - Size of the variable/map in bytes
-
-Returns:
-
- EFI_SUCCESS - Variable is found, OUT parameters are valid
- EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
-
---*/
-;
-
-EFI_STATUS
-EfiLibHiiVariablePackListGetMap (
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- OUT UINT16 *Id,
- OUT VOID **Var,
- OUT UINTN *Size
- )
-/*++
-
-Routine Description:
-
- Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.
-
-Arguments:
-
- List - List of variables
- Name - Name of the variable/map to be found
- Guid - GUID of the variable/map to be found
- Var - Pointer to the variable/map found
- Size - Size of the variable/map in bytes found
-
-Returns:
-
- EFI_SUCCESS - variable is found, OUT parameters are valid
- EFI_NOT_FOUND - variable is not found, OUT parameters are not valid
-
---*/
-;
-
-EFI_STATUS
-EfiLibHiiVariableRetrieveFromNv (
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN UINTN Size,
- OUT VOID **Var
- )
-/*++
-
-Routine Description:
- Finds out if a variable of specific Name/Guid/Size exists in NV.
- If it does, it will retrieve it into the Var.
-
-Arguments:
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
- Var - Variable will be retrieved into buffer pointed by this pointer.
- If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer.
-Returns:
- EFI_SUCCESS - The variable of exact Name/Guid/Size parameters was retrieved and written to Var.
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
-
---*/
-;
-
-////
-//// Variable override support.
-////
-
-EFI_STATUS
-EfiLibHiiVariableOverrideIfSuffix (
- IN CHAR16 *Suffix,
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN UINTN Size,
- OUT VOID *Var
- )
-/*++
-
-Routine Description:
- Overrrides the variable with NV data if found.
- But it only does it if the Name ends with specified Suffix.
- For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride",
- the Suffix matches the end of Name, so the variable will be loaded from NV
- provided the variable exists and the GUID and Size matches.
-
-Arguments:
- Suffix - Suffix the Name should end with.
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
- Var - Variable will be retrieved into this buffer.
- Caller is responsible for providing storage of exactly Size size in bytes.
-Returns:
- EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.
- EFI_INVALID_PARAMETER - The name of the variable does not end with <Suffix>.
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
-
---*/
-;
-
-EFI_STATUS
-EfiLibHiiVariableOverrideBySuffix (
- IN CHAR16 *Suffix,
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN UINTN Size,
- OUT VOID *Var
- )
-/*++
-
-Routine Description:
- Overrrides the variable with NV data if found.
- But it only does it if the NV contains the same variable with Name is appended with Suffix.
- For example, if Suffix="MyOverride" and the Name="XyzSetup",
- the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride"
- will be loaded from NV provided the variable exists and the GUID and Size matches.
-
-Arguments:
- Suffix - Suffix the variable will be appended with.
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
- Var - Variable will be retrieved into this buffer.
- Caller is responsible for providing storage of exactly Size size in bytes.
-
-Returns:
- EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Include/Library/EdkPeCoffLoaderLib.h b/EdkModulePkg/Include/Library/EdkPeCoffLoaderLib.h
deleted file mode 100644
index ccacf7e..0000000
--- a/EdkModulePkg/Include/Library/EdkPeCoffLoaderLib.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EdkPeCoffLoaderLib.h
-
-Abstract:
- Wrap the Base PE/COFF loader with the PE COFF Protocol
-
-
-
---*/
-
-#ifndef __EDK_PE_COFF_LOADER_LIB__
-#define __EDK_PE_COFF_LOADER_LIB__
-
-EFI_PEI_PE_COFF_LOADER_PROTOCOL *
-EFIAPI
-GetPeCoffLoaderProtocol (
- VOID
- );
-
-#endif
diff --git a/EdkModulePkg/Include/Library/EdkScsiLib.h b/EdkModulePkg/Include/Library/EdkScsiLib.h
deleted file mode 100644
index bb1a1ad..0000000
--- a/EdkModulePkg/Include/Library/EdkScsiLib.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ScsiLib.h
-
- Abstract:
-
- Common Libarary for SCSI
-
- Revision History
-
---*/
-
-#ifndef _SCSI_LIB_H
-#define _SCSI_LIB_H
-
-//
-// the time unit is 100ns, since the SCSI I/O defines timeout in 100ns unit.
-//
-#define EFI_SCSI_STALL_1_MICROSECOND 10
-#define EFI_SCSI_STALL_1_MILLISECOND 10000
-#define EFI_SCSI_STALL_1_SECOND 10000000
-
-//
-// this macro cannot be directly used by the gBS->Stall(),
-// since the value output by this macro is in 100ns unit,
-// not 1us unit (1us = 1000ns)
-//
-#define EfiScsiStallSeconds(a) (a) * EFI_SCSI_STALL_1_SECOND
-
-EFI_STATUS
-SubmitTestUnitReadyCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- OUT VOID *SenseData,
- OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiIo - TODO: add argument description
- Timeout - TODO: add argument description
- SenseData - TODO: add argument description
- SenseDataLength - TODO: add argument description
- HostAdapterStatus - TODO: add argument description
- TargetStatus - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SubmitInquiryCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- IN OUT VOID *InquiryDataBuffer,
- IN OUT UINT32 *InquiryDataLength,
- IN BOOLEAN EnableVitalProductData
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiIo - TODO: add argument description
- Timeout - TODO: add argument description
- SenseData - TODO: add argument description
- SenseDataLength - TODO: add argument description
- HostAdapterStatus - TODO: add argument description
- TargetStatus - TODO: add argument description
- InquiryDataBuffer - TODO: add argument description
- InquiryDataLength - TODO: add argument description
- EnableVitalProductData - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SubmitModeSense10Command (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- IN VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN UINT8 DBDField, OPTIONAL
- IN UINT8 PageControl,
- IN UINT8 PageCode
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiIo - TODO: add argument description
- Timeout - TODO: add argument description
- SenseData - TODO: add argument description
- SenseDataLength - TODO: add argument description
- HostAdapterStatus - TODO: add argument description
- TargetStatus - TODO: add argument description
- DataBuffer - TODO: add argument description
- DataLength - TODO: add argument description
- DBDField - TODO: add argument description
- PageControl - TODO: add argument description
- PageCode - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SubmitRequestSenseCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiIo - TODO: add argument description
- Timeout - TODO: add argument description
- SenseData - TODO: add argument description
- SenseDataLength - TODO: add argument description
- HostAdapterStatus - TODO: add argument description
- TargetStatus - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-//
-// Commands for direct access command
-//
-EFI_STATUS
-SubmitReadCapacityCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- OUT VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN BOOLEAN PMI
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiIo - TODO: add argument description
- Timeout - TODO: add argument description
- SenseData - TODO: add argument description
- SenseDataLength - TODO: add argument description
- HostAdapterStatus - TODO: add argument description
- TargetStatus - TODO: add argument description
- DataBuffer - TODO: add argument description
- DataLength - TODO: add argument description
- PMI - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SubmitRead10Command (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- OUT VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN UINT32 StartLba,
- IN UINT32 SectorSize
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiIo - TODO: add argument description
- Timeout - TODO: add argument description
- SenseData - TODO: add argument description
- SenseDataLength - TODO: add argument description
- HostAdapterStatus - TODO: add argument description
- TargetStatus - TODO: add argument description
- DataBuffer - TODO: add argument description
- DataLength - TODO: add argument description
- StartLba - TODO: add argument description
- SectorSize - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-SubmitWrite10Command (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- OUT VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN UINT32 StartLba,
- IN UINT32 SectorSize
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- ScsiIo - TODO: add argument description
- Timeout - TODO: add argument description
- SenseData - TODO: add argument description
- SenseDataLength - TODO: add argument description
- HostAdapterStatus - TODO: add argument description
- TargetStatus - TODO: add argument description
- DataBuffer - TODO: add argument description
- DataLength - TODO: add argument description
- StartLba - TODO: add argument description
- SectorSize - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Include/Library/EdkUsbLib.h b/EdkModulePkg/Include/Library/EdkUsbLib.h
deleted file mode 100644
index 005e045..0000000
--- a/EdkModulePkg/Include/Library/EdkUsbLib.h
+++ /dev/null
@@ -1,373 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- UsbDxeLib.h
-
- Abstract:
-
- Common Dxe Libarary for USB
- Add Constants & structure definitions for Usb HID
-
- Revision History
-
---*/
-
-#ifndef _USB_DXE_LIB_H
-#define _USB_DXE_LIB_H
-
-//
-// define the timeout time as 3ms
-//
-#define TIMEOUT_VALUE 3 * 1000
-
-//
-// HID constants definition, see HID rev1.0
-//
-//
-// HID report item format
-//
-#define HID_ITEM_FORMAT_SHORT 0
-#define HID_ITEM_FORMAT_LONG 1
-
-//
-// Special tag indicating long items
-//
-#define HID_ITEM_TAG_LONG 15
-
-//
-// HID report descriptor item type (prefix bit 2,3)
-//
-#define HID_ITEM_TYPE_MAIN 0
-#define HID_ITEM_TYPE_GLOBAL 1
-#define HID_ITEM_TYPE_LOCAL 2
-#define HID_ITEM_TYPE_RESERVED 3
-
-//
-// HID report descriptor main item tags
-//
-#define HID_MAIN_ITEM_TAG_INPUT 8
-#define HID_MAIN_ITEM_TAG_OUTPUT 9
-#define HID_MAIN_ITEM_TAG_FEATURE 11
-#define HID_MAIN_ITEM_TAG_BEGIN_COLLECTION 10
-#define HID_MAIN_ITEM_TAG_END_COLLECTION 12
-
-//
-// HID report descriptor main item contents
-//
-#define HID_MAIN_ITEM_CONSTANT 0x001
-#define HID_MAIN_ITEM_VARIABLE 0x002
-#define HID_MAIN_ITEM_RELATIVE 0x004
-#define HID_MAIN_ITEM_WRAP 0x008
-#define HID_MAIN_ITEM_NONLINEAR 0x010
-#define HID_MAIN_ITEM_NO_PREFERRED 0x020
-#define HID_MAIN_ITEM_NULL_STATE 0x040
-#define HID_MAIN_ITEM_VOLATILE 0x080
-#define HID_MAIN_ITEM_BUFFERED_BYTE 0x100
-
-//
-// HID report descriptor collection item types
-//
-#define HID_COLLECTION_PHYSICAL 0
-#define HID_COLLECTION_APPLICATION 1
-#define HID_COLLECTION_LOGICAL 2
-
-//
-// HID report descriptor global item tags
-//
-#define HID_GLOBAL_ITEM_TAG_USAGE_PAGE 0
-#define HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM 1
-#define HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM 2
-#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM 3
-#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM 4
-#define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT 5
-#define HID_GLOBAL_ITEM_TAG_UNIT 6
-#define HID_GLOBAL_ITEM_TAG_REPORT_SIZE 7
-#define HID_GLOBAL_ITEM_TAG_REPORT_ID 8
-#define HID_GLOBAL_ITEM_TAG_REPORT_COUNT 9
-#define HID_GLOBAL_ITEM_TAG_PUSH 10
-#define HID_GLOBAL_ITEM_TAG_POP 11
-
-//
-// HID report descriptor local item tags
-//
-#define HID_LOCAL_ITEM_TAG_USAGE 0
-#define HID_LOCAL_ITEM_TAG_USAGE_MINIMUM 1
-#define HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM 2
-#define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX 3
-#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM 4
-#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM 5
-#define HID_LOCAL_ITEM_TAG_STRING_INDEX 7
-#define HID_LOCAL_ITEM_TAG_STRING_MINIMUM 8
-#define HID_LOCAL_ITEM_TAG_STRING_MAXIMUM 9
-#define HID_LOCAL_ITEM_TAG_DELIMITER 10
-
-//
-// HID usage tables
-//
-#define HID_USAGE_PAGE 0xffff0000
-
-#define HID_UP_GENDESK 0x00010000
-#define HID_UP_KEYBOARD 0x00070000
-#define HID_UP_LED 0x00080000
-#define HID_UP_BUTTON 0x00090000
-#define HID_UP_CONSUMER 0x000c0000
-#define HID_UP_DIGITIZER 0x000d0000
-#define HID_UP_PID 0x000f0000
-
-#define HID_USAGE 0x0000ffff
-
-#define HID_GD_POINTER 0x00010001
-#define HID_GD_MOUSE 0x00010002
-#define HID_GD_JOYSTICK 0x00010004
-#define HID_GD_GAMEPAD 0x00010005
-#define HID_GD_HATSWITCH 0x00010039
-
-//
-// HID report types
-//
-#define HID_INPUT_REPORT 1
-#define HID_OUTPUT_REPORT 2
-#define HID_FEATURE_REPORT 3
-
-//
-// HID device quirks.
-//
-#define HID_QUIRK_INVERT 0x01
-#define HID_QUIRK_NOTOUCH 0x02
-
-//
-// HID class protocol request
-//
-#define EFI_USB_GET_REPORT_REQUEST 0x01
-#define EFI_USB_GET_IDLE_REQUEST 0x02
-#define EFI_USB_GET_PROTOCOL_REQUEST 0x03
-#define EFI_USB_SET_REPORT_REQUEST 0x09
-#define EFI_USB_SET_IDLE_REQUEST 0x0a
-#define EFI_USB_SET_PROTOCOL_REQUEST 0x0b
-
-#pragma pack(1)
-//
-// Descriptor header for Report/Physical Descriptors
-//
-typedef struct hid_class_descriptor {
- UINT8 DescriptorType;
- UINT16 DescriptorLength;
-} EFI_USB_HID_CLASS_DESCRIPTOR;
-
-typedef struct hid_descriptor {
- UINT8 Length;
- UINT8 DescriptorType;
- UINT16 BcdHID;
- UINT8 CountryCode;
- UINT8 NumDescriptors;
- EFI_USB_HID_CLASS_DESCRIPTOR HidClassDesc[1];
-} EFI_USB_HID_DESCRIPTOR;
-
-#pragma pack()
-
-EFI_STATUS
-UsbGetHidDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 InterfaceNum,
- OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
- );
-
-EFI_STATUS
-UsbGetReportDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 InterfaceNum,
- IN UINT16 DescriptorSize,
- OUT UINT8 *DescriptorBuffer
- );
-
-EFI_STATUS
-UsbGetProtocolRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 *Protocol
- );
-
-EFI_STATUS
-UsbSetProtocolRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 Protocol
- );
-
-EFI_STATUS
-UsbSetIdleRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 Duration
- );
-
-EFI_STATUS
-UsbGetIdleRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- OUT UINT8 *Duration
- );
-
-EFI_STATUS
-UsbSetReportRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 ReportType,
- IN UINT16 ReportLen,
- IN UINT8 *Report
- );
-
-EFI_STATUS
-UsbGetReportRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 ReportType,
- IN UINT16 ReportLen,
- IN UINT8 *Report
- );
-
-//
-// Get Device Descriptor
-//
-EFI_STATUS
-UsbGetDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- OUT VOID *Descriptor,
- OUT UINT32 *Status
- );
-
-//
-// Set Device Descriptor
-//
-EFI_STATUS
-UsbSetDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- IN VOID *Descriptor,
- OUT UINT32 *Status
- );
-
-//
-// Get device Interface
-//
-EFI_STATUS
-UsbGetDeviceInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Index,
- OUT UINT8 *AltSetting,
- OUT UINT32 *Status
- );
-
-//
-// Set device interface
-//
-EFI_STATUS
-UsbSetDeviceInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 InterfaceNo,
- IN UINT16 AltSetting,
- OUT UINT32 *Status
- );
-
-//
-// Get device configuration
-//
-EFI_STATUS
-UsbGetDeviceConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- OUT UINT8 *ConfigValue,
- OUT UINT32 *Status
- );
-
-//
-// Set device configuration
-//
-EFI_STATUS
-UsbSetDeviceConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- OUT UINT32 *Status
- );
-
-//
-// Set Device Feature
-//
-EFI_STATUS
-UsbSetDeviceFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
- );
-
-//
-// Clear Device Feature
-//
-EFI_STATUS
-UsbClearDeviceFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
- );
-
-//
-// Get Device Status
-//
-EFI_STATUS
-UsbGetDeviceStatus (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Target,
- OUT UINT16 *DevStatus,
- OUT UINT32 *Status
- );
-
-//
-// The following APIs are not basic library, but they are common used.
-//
-//
-// Usb Get String
-//
-EFI_STATUS
-UsbGetString (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 LangID,
- IN UINT8 Index,
- IN VOID *Buf,
- IN UINTN BufSize,
- OUT UINT32 *Status
- );
-
-//
-// Clear endpoint stall
-//
-EFI_STATUS
-UsbClearEndpointHalt (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 EndpointNo,
- OUT UINT32 *Status
- );
-
-#endif
diff --git a/EdkModulePkg/Include/Library/ExtendedSalLib.h b/EdkModulePkg/Include/Library/ExtendedSalLib.h
deleted file mode 100644
index 577172b..0000000
--- a/EdkModulePkg/Include/Library/ExtendedSalLib.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/*++
-
-Copyright (c) 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ExtendedSalLib.h
-
-Abstract:
-
---*/
-
-#ifndef _EXTENDED_SAL_LIB_H__
-#define _EXTENDED_SAL_LIB_H__
-
-/**
- Register ESAL Class and it's asociated global.
-
- This function Registers one or more Extended SAL services in a given
- class along with the associated global context.
- This function is only available prior to ExitBootServices().
-
- @param ClassGuid GUID of function class
- @param ModuleGlobal Module global for Function.
-
- @retval EFI_SUCCESS The Extended SAL services were registered.
- @retval EFI_UNSUPPORTED This function was called after ExitBootServices().
- @retval EFI_OUT_OF_RESOURCES There are not enough resources available to register one or more of the specified services.
- @retval Other ClassGuid could not be installed onto a new handle.
-
-**/
-EFI_STATUS
-EFIAPI
-RegisterEsalClass (
- IN CONST EFI_GUID *ClassGuid,
- IN VOID *ModuleGlobal, OPTIONAL
- ...
- )
-;
-
-/**
- Calls an Extended SAL Class service that was previously registered with RegisterEsalClass().
-
- This function calls an Extended SAL Class service that was previously registered with RegisterEsalClass().
-
- @param ClassGuid GUID of function
- @param FunctionId Function in ClassGuid to call
- @param Arg2 Argument 2 ClassGuid/FunctionId defined
- @param Arg3 Argument 3 ClassGuid/FunctionId defined
- @param Arg4 Argument 4 ClassGuid/FunctionId defined
- @param Arg5 Argument 5 ClassGuid/FunctionId defined
- @param Arg6 Argument 6 ClassGuid/FunctionId defined
- @param Arg7 Argument 7 ClassGuid/FunctionId defined
- @param Arg8 Argument 8 ClassGuid/FunctionId defined
-
- @retval EFI_SAL_ERROR The address of ExtendedSalProc() can not be determined
- for the current CPU execution mode.
- @retval Other See the return status from ExtendedSalProc() in the
- EXTENDED_SAL_BOOT_SERVICE_PROTOCOL.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalCall (
- IN EFI_GUID *ClassGuid,
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8
- )
-;
-
-/**
- Wrapper for the EsalStallFunctionId service in the Extended SAL Stall Services Class.
-
- This function is a wrapper for the EsalStallFunctionId service in the Extended SAL
- Stall Services Class. See EsalStallFunctionId in the Extended SAL Specification.
-
- @param Microseconds The number of microseconds to delay.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalStall (
- IN UINTN Microseconds
- )
-;
-
-/**
- Wrapper for the EsalSetNewPalEntryFunctionId service in the Extended SAL PAL Services Services Class.
-
- This function is a wrapper for the EsalSetNewPalEntryFunctionId service in the Extended SAL
- PAL Services Services Class. See EsalSetNewPalEntryFunctionId in the Extended SAL Specification.
-
- @param PhyicalAddress If TRUE, then PalEntryPoint is a physical address.
- If FALSE, then PalEntryPoint is a virtual address.
- @param PalEntryPoint The PAL Entry Point being set.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalSetNewPalEntry (
- IN BOOLEAN PhysicalAddress,
- IN UINT64 PalEntryPoint
- )
-;
-
-/**
- Wrapper for the EsalGetStateBufferFunctionId service in the Extended SAL PAL Services Services Class.
-
- This function is a wrapper for the EsalGetStateBufferFunctionId service in the Extended SAL
- PAL Services Services Class. See EsalGetStateBufferFunctionId in the Extended SAL Specification.
-
- @param PhyicalAddress If TRUE, then PalEntryPoint is a physical address.
- If FALSE, then PalEntryPoint is a virtual address.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalGetNewPalEntry (
- IN BOOLEAN PhysicalAddress
- )
-;
-
-/**
- Wrapper for the EsalGetStateBufferFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalGetStateBufferFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalGetStateBufferFunctionId in the Extended SAL Specification.
-
- @param McaType See type parameter in the SAL Procedure SAL_GET_STATE_INFO.
- @param McaBuffer A pointer to the base address of the returned buffer. Copied from SAL_RETURN_REGS.r9.
- @param BufferSize A pointer to the size, in bytes, of the returned buffer. Copied from SAL_RETURN_REGS.r10.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalGetStateBuffer (
- IN UINT64 McaType,
- OUT UINT8 **McaBuffer,
- OUT UINTN *BufferSize
- )
-;
-
-/**
- Wrapper for the EsalSaveStateBufferFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalSaveStateBufferFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalSaveStateBufferFunctionId in the Extended SAL Specification.
-
- @param McaType See type parameter in the SAL Procedure SAL_GET_STATE_INFO.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalSaveStateBuffer (
- IN UINT64 McaType
- )
-;
-
-/**
- Wrapper for the EsalGetVectorsFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalGetVectorsFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalGetVectorsFunctionId in the Extended SAL Specification.
-
- @param VectorType The vector type to retrieve.
- 0 ¨C MCA, 1 - BSP INIT, 2 ¨C BOOT_RENDEZ, 3 ¨C AP INIT.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalGetVectors (
- IN UINT64 VectorType
- )
-;
-
-/**
- Wrapper for the EsalMcGetParamsFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalMcGetParamsFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalMcGetParamsFunctionId in the Extended SAL Specification.
-
- @param ParamInfoType The parameter type to retrieve.
- 1 ¨C rendezvous interrupt
- 2 ¨C wake up
- 3 ¨C Corrected Platform Error Vector.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalMcGetParams (
- IN UINT64 ParamInfoType
- )
-;
-
-/**
- Wrapper for the EsalMcGetParamsFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalMcGetParamsFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalMcGetParamsFunctionId in the Extended SAL Specification.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalMcGetMcParams (
- VOID
- )
-;
-
-/**
- Wrapper for the EsalGetMcCheckinFlagsFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalGetMcCheckinFlagsFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalGetMcCheckinFlagsFunctionId in the Extended SAL Specification.
-
- @param CpuIndex The index of the CPU in the set of enabled CPUs to check.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalGetMcCheckinFlags (
- IN UINT64 CpuIndex
- )
-;
-
-/**
- Wrapper for the EsalAddCpuDataFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalAddCpuDataFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalAddCpuDataFunctionId in the Extended SAL Specification.
-
- @param CpuGlobalId The Global ID for the CPU being added.
- @param Enabled The enable flag for the CPU being added.
- TRUE means the CPU is enabled.
- FALSE means the CPU is disabled.
- @param PalCompatibility The PAL Compatibility value for the CPU being added.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalAddCpuData (
- IN UINT64 CpuGlobalId,
- IN BOOLEAN Enabled,
- IN UINT64 PalCompatibility
- )
-;
-
-/**
- Wrapper for the EsalRemoveCpuDataFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalRemoveCpuDataFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalRemoveCpuDataFunctionId in the Extended SAL Specification.
-
- @param CpuGlobalId The Global ID for the CPU being removed.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalRemoveCpuData (
- IN UINT64 CpuGlobalId
- )
-;
-
-/**
- Wrapper for the EsalModifyCpuDataFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalModifyCpuDataFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalModifyCpuDataFunctionId in the Extended SAL Specification.
-
- @param CpuGlobalId The Global ID for the CPU being modified.
- @param Enabled The enable flag for the CPU being modified.
- TRUE means the CPU is enabled.
- FALSE means the CPU is disabled.
- @param PalCompatibility The PAL Compatibility value for the CPU being modified.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalModifyCpuData (
- IN UINT64 CpuGlobalId,
- IN BOOLEAN Enabled,
- IN UINT64 PalCompatibility
- )
-;
-
-/**
- Wrapper for the EsalGetCpuDataByIdFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalGetCpuDataByIdFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalGetCpuDataByIdFunctionId in the Extended SAL Specification.
-
- @param CpuGlobalId The Global ID for the CPU being looked up.
- @param IndexByEnabledCpu If TRUE, then the index in the set of enabled CPUs in the database is returned.
- If FALSE, then the index in the set of all CPUs in the database is returned.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalGetCpuDataById (
- IN UINT64 CpuGlobalId,
- IN BOOLEAN IndexByEnabledCpu
- )
-;
-
-/**
- Wrapper for the EsalGetCpuDataByIndexFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalGetCpuDataByIndexFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalGetCpuDataByIndexFunctionId in the Extended SAL Specification.
-
- @param Index The Global ID for the CPU being modified.
- @param IndexByEnabledCpu If TRUE, then the index in the set of enabled CPUs in the database is returned.
- If FALSE, then the index in the set of all CPUs in the database is returned.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalGetCpuDataByIndex (
- IN UINT64 Index,
- IN BOOLEAN IndexByEnabledCpu
- )
-;
-
-/**
- Wrapper for the EsalWhoAmIFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalWhoAmIFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalWhoAmIFunctionId in the Extended SAL Specification.
-
- @param IndexByEnabledCpu If TRUE, then the index in the set of enabled CPUs in the database is returned.
- If FALSE, then the index in the set of all CPUs in the database is returned.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalWhoAmI (
- IN BOOLEAN IndexByEnabledCpu
- )
-;
-
-/**
- Wrapper for the EsalNumProcessors service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalNumProcessors service in the Extended SAL
- MCA Log Services Class. See EsalNumProcessors in the Extended SAL Specification.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalNumProcessors (
- VOID
- )
-;
-
-/**
- Wrapper for the EsalSetMinStateFnctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalSetMinStateFnctionId service in the Extended SAL
- MCA Log Services Class. See EsalSetMinStateFnctionId in the Extended SAL Specification.
-
- @param CpuGlobalId The Global ID for the CPU whose MINSTATE pointer is being set.
- @param MinStatePointer The physical address of the MINSTATE buffer for the CPU specified by CpuGlobalId.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalSetMinState (
- IN UINT64 CpuGlobalId,
- IN EFI_PHYSICAL_ADDRESS MinStatePointer
- )
-;
-
-/**
- Wrapper for the EsalGetMinStateFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalGetMinStateFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalGetMinStateFunctionId in the Extended SAL Specification.
-
- @param CpuGlobalId The Global ID for the CPU whose MINSTATE pointer is being retrieved.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalGetMinState (
- IN UINT64 CpuGlobalId
- )
-;
-
-/**
- Wrapper for the EsalMcsGetStateInfoFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalMcsGetStateInfoFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalMcsGetStateInfoFunctionId in the Extended SAL Specification.
-
- @param CpuGlobalId The Global ID for the CPU whose MCA state buffer is being retrieved.
- @param StateBufferPointer A pointer to the returned MCA state buffer.
- @param RequiredStateBufferSize A pointer to the size, in bytes, of the returned MCA state buffer.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalMcaGetStateInfo (
- IN UINT64 CpuGlobalId,
- OUT EFI_PHYSICAL_ADDRESS *StateBufferPointer,
- OUT UINT64 *RequiredStateBufferSize
- )
-;
-
-/**
- Wrapper for the EsalMcaRegisterCpuFunctionId service in the Extended SAL MCA Log Services Class.
-
- This function is a wrapper for the EsalMcaRegisterCpuFunctionId service in the Extended SAL
- MCA Log Services Class. See EsalMcaRegisterCpuFunctionId in the Extended SAL Specification.
-
- @param CpuGlobalId The Global ID for the CPU whose MCA state buffer is being set.
- @param StateBufferPointer A pointer to the MCA state buffer.
-
-**/
-SAL_RETURN_REGS
-EFIAPI
-EsalMcaRegisterCpu (
- IN UINT64 CpuGlobalId,
- IN EFI_PHYSICAL_ADDRESS StateBufferPointer
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Include/Library/OemHookStatusCodeLib.h b/EdkModulePkg/Include/Library/OemHookStatusCodeLib.h
deleted file mode 100644
index 533df31..0000000
--- a/EdkModulePkg/Include/Library/OemHookStatusCodeLib.h
+++ /dev/null
@@ -1,73 +0,0 @@
-
-/** @file
- OEM hook status code library functions with no library constructor/destructor
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: OemHookStatusCodeLib.h
-
-**/
-
-#ifndef __OEM_HOOK_STATUSCODE_LIB__
-#define __OEM_HOOK_STATUSCODE_LIB__
-
-/**
-
- Initialize OEM status code device .
-
-
- @return Status of initialization of OEM status code device.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeInitialize (
- VOID
- );
-
-/**
- Report status code to OEM device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeReport (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId, OPTIONAL
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-#endif
diff --git a/EdkModulePkg/Include/Library/PciIncompatibleDeviceSupportLib.h b/EdkModulePkg/Include/Library/PciIncompatibleDeviceSupportLib.h
deleted file mode 100644
index 527a704..0000000
--- a/EdkModulePkg/Include/Library/PciIncompatibleDeviceSupportLib.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/** @file
- PCI Incompatible device support Libary.
-
-Copyright (c) 2007 Intel Corporation. All rights reserved. <BR>
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-**/
-
-#define PCI_REGISTER_READ 0xfffffffffffffff1ULL
-#define PCI_REGISTER_WRITE 0xfffffffffffffff2ULL
-#define VALUE_NOCARE 0xffffffffffffffffULL
-
-//
-// PCI device device information
-//
-typedef struct {
- UINT64 VendorID;
- UINT64 DeviceID;
- UINT64 RevisionID;
- UINT64 SubsystemVendorID;
- UINT64 SubsystemID;
-} EFI_PCI_DEVICE_INFO;
-
-
-//
-// store hardcode value of resgister
-//
-typedef struct {
- UINT64 AndValue;
- UINT64 OrValue;
-} EFI_PCI_REGISTER_VALUE_DATA;
-
-//
-// store access width information
-//
-typedef struct {
- UINT64 StartOffset;
- UINT64 EndOffset;
- UINT64 Width;
-} EFI_PCI_REGISTER_ACCESS_DATA;
-
-
-//
-// ACPI resource descriptor
-//
-typedef struct {
- UINT64 ResType;
- UINT64 GenFlag;
- UINT64 SpecificFlag;
- UINT64 AddrSpaceGranularity;
- UINT64 AddrRangeMin;
- UINT64 AddrRangeMax;
- UINT64 AddrTranslationOffset;
- UINT64 AddrLen;
-} EFI_PCI_RESOUCE_DESCRIPTOR;
-
-/**
- Checks the incompatible device list for ACPI resource update and return
- the configuration.
-
- This function searches the incompatible device list according to request
- information. If the PCI device belongs to the devices list, corresponding
- configuration informtion will be returned, in the meantime return EFI_SUCCESS.
-
- @param PciDeviceInfo A pointer to PCI device information.
- @param Configuration Returned information.
-
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
-**/
-RETURN_STATUS
-EFIAPI
-PciResourceUpdateCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- OUT VOID *Configuration
- );
-
-/**
- Checks the incompatible device list and return configuration register mask values.
-
- This function searches the incompatible device list according to request
- information. If the PCI device belongs to the devices list, corresponding
- configuration informtion will be returned, in the meantime return EFI_SUCCESS.
-
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
- @param AccessType Access Type, READ or WRITE.
- @param Offset The address within the PCI configuration space.
- @param Configuration Returned information.
-
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
-**/
-RETURN_STATUS
-EFIAPI
-PciRegisterUpdateCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN UINT64 AccessType,
- IN UINT64 Offset,
- OUT VOID *Configuration
- );
-
-/**
- Checks the incompatible device list for access width incompatibility and
- return the configuration
-
- This function searches the incompatible device list for access width
- incompatibility according to request information. If the PCI device
- belongs to the devices list, corresponding configuration informtion
- will be returned, in the meantime return EFI_SUCCESS.
-
- @param PciDeviceInfo A pointer to PCI device information.
- @param AccessType Access type, READ or WRITE.
- @param Offset The address within the PCI configuration space.
- @param AccessWidth Access width needs to check incompatibility.
- @param Configuration Returned information.
-
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
-**/
-RETURN_STATUS
-EFIAPI
-PciRegisterAccessCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN UINT64 AccessType,
- IN UINT64 Offset,
- IN UINT64 AccessWidth,
- OUT VOID *Configuration
- );
diff --git a/EdkModulePkg/Include/Library/SerialPortLib.h b/EdkModulePkg/Include/Library/SerialPortLib.h
deleted file mode 100644
index 153e38c..0000000
--- a/EdkModulePkg/Include/Library/SerialPortLib.h
+++ /dev/null
@@ -1,76 +0,0 @@
-
-/** @file
- Serial I/O Port library functions with no library constructor/destructor
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: SerialPortLib.h
-
-**/
-
-#ifndef __SERIAL_PORT_LIB__
-#define __SERIAL_PORT_LIB__
-
-/**
-
- Programmed hardware of Serial port.
-
- @return Status of Serial Port Device initialization.
-
-**/
-EFI_STATUS
-EFIAPI
-SerialPortInitialize (
- VOID
- );
-
-/**
- Write data to serial device.
-
- If the buffer is NULL, then return 0;
- if NumberOfBytes is zero, then return 0.
-
- @param Buffer Point of data buffer which need to be writed.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Write data failed.
- @retval !0 Actual number of bytes writed to serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
-);
-
-
-/**
- Read data from serial device and save the datas in buffer.
-
- If the buffer is NULL, then return zero;
- if NumberOfBytes is zero, then return zero.
-
- @param Buffer Point of data buffer which need to be writed.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Read data failed.
- @retval !0 Aactual number of bytes read from serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
-);
-
-
-#endif
diff --git a/EdkModulePkg/Include/Library/TianoDecompressLib.h b/EdkModulePkg/Include/Library/TianoDecompressLib.h
deleted file mode 100644
index 58e9426..0000000
--- a/EdkModulePkg/Include/Library/TianoDecompressLib.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- TianoDecompressLib.h
-
-Abstract:
-
- Tiano Decompress functions
-
---*/
-
-#ifndef __TIANO_DECPOMPRESS_LIB_H__
-#define __TIANO_DECPOMPRESS_LIB_H__
-
-RETURN_STATUS
-EFIAPI
-TianoDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- );
-
-RETURN_STATUS
-EFIAPI
-TianoDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- );
-
-#endif
diff --git a/EdkModulePkg/Include/Ppi/BaseMemoryTest.h b/EdkModulePkg/Include/Ppi/BaseMemoryTest.h
deleted file mode 100644
index 8b0be6e..0000000
--- a/EdkModulePkg/Include/Ppi/BaseMemoryTest.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BaseMemoryTest.h
-
-Abstract:
-
- Pei memory test PPI as defined in Tiano
-
- Used to Pei memory test in PEI
-
---*/
-
-#ifndef _BASE_MEMORY_TEST_H_
-#define _BASE_MEMORY_TEST_H_
-
-#define PEI_BASE_MEMORY_TEST_GUID \
- { 0xb6ec423c, 0x21d2, 0x490d, {0x85, 0xc6, 0xdd, 0x58, 0x64, 0xea, 0xa6, 0x74 } }
-
-typedef struct _PEI_BASE_MEMORY_TEST_PPI PEI_BASE_MEMORY_TEST_PPI;
-
-typedef enum {
- Ignore,
- Quick,
- Sparse,
- Extensive
-} PEI_MEMORY_TEST_OP;
-
-typedef
-EFI_STATUS
-(EFIAPI *PEI_BASE_MEMORY_TEST) (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_BASE_MEMORY_TEST_PPI * This,
- IN EFI_PHYSICAL_ADDRESS BeginAddress,
- IN UINT64 MemoryLength,
- IN PEI_MEMORY_TEST_OP Operation,
- OUT EFI_PHYSICAL_ADDRESS * ErrorAddress
- );
-
-struct _PEI_BASE_MEMORY_TEST_PPI {
- PEI_BASE_MEMORY_TEST BaseMemoryTest;
-};
-
-extern EFI_GUID gPeiBaseMemoryTestPpiGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Ppi/FlashMap.h b/EdkModulePkg/Include/Ppi/FlashMap.h
deleted file mode 100644
index 312f38b..0000000
--- a/EdkModulePkg/Include/Ppi/FlashMap.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FlashMap.h
-
-Abstract:
-
- FlashMap PPI defined in Tiano
-
- This code abstracts FlashMap access
-
---*/
-
-#ifndef _PEI_FLASH_MAP_PPI_H_
-#define _PEI_FLASH_MAP_PPI_H_
-
-#define PEI_FLASH_MAP_PPI_GUID \
- { 0xf34c2fa0, 0xde88, 0x4270, {0x84, 0x14, 0x96, 0x12, 0x22, 0xf4, 0x52, 0x1c } }
-
-typedef struct _PEI_FLASH_MAP_PPI PEI_FLASH_MAP_PPI;
-//
-// Functions
-//
-typedef
-EFI_STATUS
-(EFIAPI *PEI_GET_FLASH_AREA_INFO) (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_FLASH_MAP_PPI *This,
- IN EFI_FLASH_AREA_TYPE AreaType,
- IN EFI_GUID *AreaTypeGuid,
- OUT UINT32 *NumEntries,
- OUT EFI_FLASH_SUBAREA_ENTRY **Entries
- );
-
-
-struct _PEI_FLASH_MAP_PPI {
- PEI_GET_FLASH_AREA_INFO GetAreaInfo;
-};
-
-extern EFI_GUID gPeiFlashMapPpiGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Ppi/PeiInMemory.h b/EdkModulePkg/Include/Ppi/PeiInMemory.h
deleted file mode 100644
index 74d0905..0000000
--- a/EdkModulePkg/Include/Ppi/PeiInMemory.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PeiInMemory.h
-
-Abstract:
-
-
---*/
-
-#ifndef __PEI_IN_MEMORY_H__
-#define __PEI_IN_MEMORY_H__
-
-#define PEI_IN_MEMORY_GUID \
- {0x643b8786, 0xb417, 0x48d2, {0x8f, 0x5e, 0x78, 0x19, 0x93, 0x1c, 0xae, 0xd8} }
-
-extern EFI_GUID gPeiInMemoryGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Ppi/StatusCodeMemory.h b/EdkModulePkg/Include/Ppi/StatusCodeMemory.h
deleted file mode 100644
index e02e458..0000000
--- a/EdkModulePkg/Include/Ppi/StatusCodeMemory.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- StatusCodeMemory.h
-
-Abstract:
-
- Status Code memory descriptor PPI. Contains information about memory that
- the Status Code PEIM may use to journal Status Codes.
-
---*/
-
-#ifndef _PEI_STATUS_CODE_MEMORY_PPI_H_
-#define _PEI_STATUS_CODE_MEMORY_PPI_H_
-
-//
-// GUID definition
-//
-#define PEI_STATUS_CODE_MEMORY_PPI_GUID \
- { 0x26f8ab01, 0xd3cd, 0x489c, {0x98, 0x4f, 0xdf, 0xde, 0xf7, 0x68, 0x39, 0x5b } }
-
-//
-// Data types
-//
-typedef struct {
- EFI_STATUS_CODE_TYPE Type;
- EFI_STATUS_CODE_VALUE Value;
- UINT32 Instance;
-} EFI_STATUS_CODE_ENTRY;
-
-//
-// PPI definition
-//
-typedef struct {
- UINT32 FirstEntry;
- UINT32 LastEntry;
- EFI_PHYSICAL_ADDRESS Address;
- UINT32 Length;
-} PEI_STATUS_CODE_MEMORY_PPI;
-
-extern EFI_GUID gPeiStatusCodeMemoryPpiGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/AcpiS3Save.h b/EdkModulePkg/Include/Protocol/AcpiS3Save.h
deleted file mode 100644
index 1571e3d..0000000
--- a/EdkModulePkg/Include/Protocol/AcpiS3Save.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- AcpiS3Save.h
-
-Abstract:
-
-
---*/
-
-#ifndef _ACPI_S3_SAVE_PROTOCOL_H
-#define _ACPI_S3_SAVE_PROTOCOL_H
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_ACPI_S3_SAVE_PROTOCOL EFI_ACPI_S3_SAVE_PROTOCOL;
-
-//
-// S3 Save Protocol GUID
-//
-#define EFI_ACPI_S3_SAVE_GUID \
- { \
- 0x125f2de1, 0xfb85, 0x440c, {0xa5, 0x4c, 0x4d, 0x99, 0x35, 0x8a, 0x8d, 0x38 } \
- }
-
-//
-// Protocol Data Structures
-//
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ACPI_S3_SAVE) (
- IN EFI_ACPI_S3_SAVE_PROTOCOL * This,
- IN VOID * LegacyMemoryAddress
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ACPI_GET_LEGACY_MEMORY_SIZE) (
- IN EFI_ACPI_S3_SAVE_PROTOCOL * This,
- OUT UINTN * Size
-);
-
-struct _EFI_ACPI_S3_SAVE_PROTOCOL {
- EFI_ACPI_GET_LEGACY_MEMORY_SIZE GetLegacyMemorySize;
- EFI_ACPI_S3_SAVE S3Save;
-};
-
-extern EFI_GUID gEfiAcpiS3SaveProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/Capsule.h b/EdkModulePkg/Include/Protocol/Capsule.h
deleted file mode 100644
index 626f256..0000000
--- a/EdkModulePkg/Include/Protocol/Capsule.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Capsule.h
-
-Abstract:
-
- Capsule Architectural Protocol is newly added to produce UEFI2.0 capsule runtime services.
-
---*/
-
-#ifndef _ARCH_PROTOCOL_CAPSULE_ARCH_H_
-#define _ARCH_PROTOCOL_CAPSULE_ARCH_H_
-
-//
-// Global ID for the Capsule Architectural Protocol
-//
-#define EFI_CAPSULE_ARCH_PROTOCOL_GUID \
- { 0x5053697e, 0x2ebc, 0x4819, {0x90, 0xd9, 0x05, 0x80, 0xde, 0xee, 0x57, 0x54 }}
-
-extern EFI_GUID gEfiCapsuleArchProtocolGuid;
-
-typedef struct {
- UINT32 CapsuleArrayNumber;
- VOID* CapsulePtr[1];
-} EFI_CAPSULE_TABLE;
-
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/ConsoleControl.h b/EdkModulePkg/Include/Protocol/ConsoleControl.h
deleted file mode 100644
index c894302..0000000
--- a/EdkModulePkg/Include/Protocol/ConsoleControl.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ConsoleControl.h
-
-Abstract:
-
- Abstraction of a Text mode or UGA screen
-
---*/
-
-#ifndef __CONSOLE_CONTROL_H__
-#define __CONSOLE_CONTROL_H__
-
-#define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \
- { 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21 } }
-
-typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL;
-
-
-typedef enum {
- EfiConsoleControlScreenText,
- EfiConsoleControlScreenGraphics,
- EfiConsoleControlScreenMaxValue
-} EFI_CONSOLE_CONTROL_SCREEN_MODE;
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE) (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
- OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode,
- OUT BOOLEAN *UgaExists, OPTIONAL
- OUT BOOLEAN *StdInLocked OPTIONAL
- )
-/*++
-
- Routine Description:
- Return the current video mode information. Also returns info about existence
- of UGA Draw devices in system, and if the Std In device is locked. All the
- arguments are optional and only returned if a non NULL pointer is passed in.
-
- Arguments:
- This - Protocol instance pointer.
- Mode - Are we in text of grahics mode.
- UgaExists - TRUE if UGA Spliter has found a UGA device
- StdInLocked - TRUE if StdIn device is keyboard locked
-
- Returns:
- EFI_SUCCESS - Mode information returned.
-
---*/
-;
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE) (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
- OUT EFI_CONSOLE_CONTROL_SCREEN_MODE Mode
- )
-/*++
-
- Routine Description:
- Set the current mode to either text or graphics. Graphics is
- for Quiet Boot.
-
- Arguments:
- This - Protocol instance pointer.
- Mode - Mode to set the
-
- Returns:
- EFI_SUCCESS - Mode information returned.
-
---*/
-;
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN) (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
- IN CHAR16 *Password
- )
-/*++
-
- Routine Description:
- Lock Std In devices until Password is typed.
-
- Arguments:
- This - Protocol instance pointer.
- Password - Password needed to unlock screen. NULL means unlock keyboard
-
- Returns:
- EFI_SUCCESS - Mode information returned.
- EFI_DEVICE_ERROR - Std In not locked
-
---*/
-;
-
-
-
-struct _EFI_CONSOLE_CONTROL_PROTOCOL {
- EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE GetMode;
- EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE SetMode;
- EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN LockStdIn;
-};
-
-extern EFI_GUID gEfiConsoleControlProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/CustomizedDecompress.h b/EdkModulePkg/Include/Protocol/CustomizedDecompress.h
deleted file mode 100644
index bff8d46..0000000
--- a/EdkModulePkg/Include/Protocol/CustomizedDecompress.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- CustomizedDecompress.h
-
-Abstract:
- The user Customized Decompress Protocol Interface
-
---*/
-
-#ifndef __CUSTOMIZED_DECOMPRESS_H__
-#define __CUSTOMIZED_DECOMPRESS_H__
-
-#define EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL_GUID \
- { 0x9a44198e, 0xa4a2, 0x44e6, {0x8a, 0x1f, 0x39, 0xbe, 0xfd, 0xac, 0x89, 0x6f } }
-
-typedef struct _EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_CUSTOMIZED_DECOMPRESS_GET_INFO) (
- IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- );
-/*++
-
-Routine Description:
-
- The GetInfo() function retrieves the size of the uncompressed buffer
- and the temporary scratch buffer required to decompress the buffer
- specified by Source and SourceSize. If the size of the uncompressed
- buffer or the size of the scratch buffer cannot be determined from
- the compressed data specified by Source and SourceData, then
- EFI_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed
- buffer is returned in DestinationSize, the size of the scratch buffer is
- returned in ScratchSize, and EFI_SUCCESS is returned.
-
- The GetInfo() function does not have scratch buffer available to perform
- a thorough checking of the validity of the source data. It just retrieves
- the 'Original Size' field from the beginning bytes of the source data and
- output it as DestinationSize. And ScratchSize is specific to the decompression
- implementation.
-
-Arguments:
-
- This - The protocol instance pointer
- Source - The source buffer containing the compressed data.
- SourceSize - The size, in bytes, of source buffer.
- DestinationSize - A pointer to the size, in bytes, of the uncompressed buffer
- that will be generated when the compressed buffer specified
- by Source and SourceSize is decompressed.
- ScratchSize - A pointer to the size, in bytes, of the scratch buffer that
- is required to decompress the compressed buffer specified by
- Source and SourceSize.
-
-Returns:
- EFI_SUCCESS - The size of the uncompressed data was returned in DestinationSize
- and the size of the scratch buffer was returned in ScratchSize.
- EFI_INVALID_PARAMETER - The size of the uncompressed data or the size of the scratch
- buffer cannot be determined from the compressed data specified by
- Source and SourceData.
-
---*/
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_CUSTOMIZED_DECOMPRESS_DECOMPRESS) (
- IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,
- IN VOID* Source,
- IN UINT32 SourceSize,
- IN OUT VOID* Destination,
- IN UINT32 DestinationSize,
- IN OUT VOID* Scratch,
- IN UINT32 ScratchSize
- );
-/*++
-
-Routine Description:
-
- The Decompress() function extracts decompressed data to its original form.
-
- This protocol is designed so that the decompression algorithm can be
- implemented without using any memory services. As a result, the
- Decompress() function is not allowed to call AllocatePool() or
- AllocatePages() in its implementation. It is the caller's responsibility
- to allocate and free the Destination and Scratch buffers.
-
- If the compressed source data specified by Source and SourceSize is
- sucessfully decompressed into Destination, then EFI_SUCCESS is returned.
- If the compressed source data specified by Source and SourceSize is not in
- a valid compressed data format, then EFI_INVALID_PARAMETER is returned.
-
-Arguments:
-
- This - The protocol instance pointer
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source data.
- Destination - On output, the destination buffer that contains
- the uncompressed data.
- DestinationSize - The size of destination buffer. The size of destination
- buffer needed is obtained from GetInfo().
- Scratch - A temporary scratch buffer that is used to perform the
- decompression.
- ScratchSize - The size of scratch buffer. The size of scratch buffer needed
- is obtained from GetInfo().
-
-Returns:
-
- EFI_SUCCESS - Decompression completed successfully, and the uncompressed
- buffer is returned in Destination.
- EFI_INVALID_PARAMETER
- - The source buffer specified by Source and SourceSize is
- corrupted (not in a valid compressed format).
-
---*/
-
-struct _EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL {
- EFI_CUSTOMIZED_DECOMPRESS_GET_INFO GetInfo;
- EFI_CUSTOMIZED_DECOMPRESS_DECOMPRESS Decompress;
-};
-
-extern EFI_GUID gEfiCustomizedDecompressProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/DebugAssert.h b/EdkModulePkg/Include/Protocol/DebugAssert.h
deleted file mode 100644
index 9d26d83..0000000
--- a/EdkModulePkg/Include/Protocol/DebugAssert.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DebugAssert.h
-
-Abstract:
-
- This protocol allows provides debug services to a driver. This is not
- debugger support, but things like ASSERT() and DEBUG() macros
-
---*/
-
-#ifndef _DEBUG_ASSERT_H_
-#define _DEBUG_ASSERT_H_
-
-
-#define EFI_DEBUG_ASSERT_PROTOCOL_GUID \
- { 0xbe499c92, 0x7d4b, 0x11d4, {0xbc, 0xee, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_DEBUG_ASSERT_PROTOCOL EFI_DEBUG_ASSERT_PROTOCOL;
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_DEBUG_ASSERT) (
- IN EFI_DEBUG_ASSERT_PROTOCOL *This,
- IN CHAR8 *FileName,
- IN INTN LineNumber,
- IN CHAR8 *Description
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_DEBUG_PRINT) (
- IN EFI_DEBUG_ASSERT_PROTOCOL *This,
- IN UINTN ErrorLevel,
- IN CHAR8 *Format,
- IN VA_LIST Marker
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_POST_CODE) (
- IN EFI_DEBUG_ASSERT_PROTOCOL *This,
- IN UINT16 PostCode,
- IN CHAR8 *PostCodeString OPTIONAL
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_GET_ERROR_LEVEL) (
- IN EFI_DEBUG_ASSERT_PROTOCOL *This,
- IN UINTN *ErrorLevel
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SET_ERROR_LEVEL) (
- IN EFI_DEBUG_ASSERT_PROTOCOL *This,
- IN UINTN ErrorLevel
- );
-
-struct _EFI_DEBUG_ASSERT_PROTOCOL {
-
- EFI_DEBUG_ASSERT Assert;
- EFI_DEBUG_PRINT Print;
- EFI_POST_CODE PostCode;
-
- EFI_GET_ERROR_LEVEL GetErrorLevel;
- EFI_SET_ERROR_LEVEL SetErrorLevel;
-
-};
-
-extern EFI_GUID gEfiDebugAssertProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/DebugLevel.h b/EdkModulePkg/Include/Protocol/DebugLevel.h
deleted file mode 100644
index 9c5f06a..0000000
--- a/EdkModulePkg/Include/Protocol/DebugLevel.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DebugLevel.h
-
-Abstract:
- This protocol is used to abstract the Debug Mask serivces for
- the specific driver or application image.
-
---*/
-
-#ifndef __DEBUG_LEVEL_H__
-#define __DEBUG_LEVEL_H__
-
-//
-// 8D4C62E6-CD98-4e1d-AD6E-48BB50D29FF7
-//
-#define EFI_DEBUG_LEVEL_PROTOCOL_GUID \
- { 0x8d4c62e6, 0xcd98, 0x4e1d, {0xad, 0x6e, 0x48, 0xbb, 0x50, 0xd2, 0x9f, 0xf7 } }
-
-//
-// DebugLevel protocol definition
-//
-typedef struct _EFI_DEBUG_LEVEL_PROTOCOL {
- UINTN DebugLevel;
-} EFI_DEBUG_LEVEL_PROTOCOL;
-
-extern EFI_GUID gEfiDebugLevelProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/DiskInfo.h b/EdkModulePkg/Include/Protocol/DiskInfo.h
deleted file mode 100644
index 6952163..0000000
--- a/EdkModulePkg/Include/Protocol/DiskInfo.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DiskInfo.h
-
-Abstract:
-
- Disk Info protocol is used to export Inquiry Data for a drive.
- Its needed to support low level formating of drives in a mannor
- thats DOS compatible.
-
---*/
-
-#ifndef __DISK_INFO_H__
-#define __DISK_INFO_H__
-
-#define EFI_DISK_INFO_PROTOCOL_GUID \
- { \
- 0xd432a67f, 0x14dc, 0x484b, {0xb3, 0xbb, 0x3f, 0x2, 0x91, 0x84, 0x93, 0x27 } \
- }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_DISK_INFO_PROTOCOL EFI_DISK_INFO_PROTOCOL;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_DISK_INFO_INQUIRY) (
- IN EFI_DISK_INFO_PROTOCOL * This,
- IN OUT VOID *InquiryData,
- IN OUT UINT32 *IntquiryDataSize
- )
-/*++
-
- Routine Description:
- Return the results of the Inquiry command to a drive in InquiryData.
- Data format of Inquiry data is defined by the Interface GUID.
-
- Arguments:
- This - Protocol instance pointer.
- InquiryData - Results of Inquiry command to device
- InquiryDataSize - Size of InquiryData in bytes.
-
- Returns:
- EFI_SUCCESS - InquiryData valid
- EFI_NOT_FOUND - Device does not support this data class
- EFI_DEVICE_ERROR - Error reading InquiryData from device
- EFI_BUFFER_TOO_SMALL - IntquiryDataSize not big enough
-
---*/
-;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_DISK_INFO_IDENTIFY) (
- IN EFI_DISK_INFO_PROTOCOL * This,
- IN OUT VOID *IdentifyData,
- IN OUT UINT32 *IdentifyDataSize
- )
-/*++
-
- Routine Description:
- Return the results of the Identify command to a drive in IdentifyData.
- Data format of Identify data is defined by the Interface GUID.
-
- Arguments:
- This - Protocol instance pointer.
- IdentifyData - Results of Identify command to device
- IdentifyDataSize - Size of IdentifyData in bytes.
-
- Returns:
- EFI_SUCCESS - IdentifyData valid
- EFI_NOT_FOUND - Device does not support this data class
- EFI_DEVICE_ERROR - Error reading IdentifyData from device
- EFI_BUFFER_TOO_SMALL - IdentifyDataSize not big enough
-
---*/
-;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_DISK_INFO_SENSE_DATA) (
- IN EFI_DISK_INFO_PROTOCOL * This,
- IN OUT VOID *SenseData,
- IN OUT UINT32 *SenseDataSize,
- OUT UINT8 *SenseDataNumber
- )
-/*++
-
- Routine Description:
- Return the results of the Request Sense command to a drive in SenseData.
- Data format of Sense data is defined by the Interface GUID.
-
- Arguments:
- This - Protocol instance pointer.
- SenseData - Results of Request Sense command to device
- SenseDataSize - Size of SenseData in bytes.
- SenseDataNumber - Type of SenseData
-
- Returns:
- EFI_SUCCESS - InquiryData valid
- EFI_NOT_FOUND - Device does not support this data class
- EFI_DEVICE_ERROR - Error reading InquiryData from device
- EFI_BUFFER_TOO_SMALL - SenseDataSize not big enough
-
---*/
-;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_DISK_INFO_WHICH_IDE) (
- IN EFI_DISK_INFO_PROTOCOL * This,
- OUT UINT32 *IdeChannel,
- OUT UINT32 *IdeDevice
- )
-/*++
-
- Routine Description:
- Return the results of the Request Sense command to a drive in SenseData.
- Data format of Sense data is defined by the Interface GUID.
-
- Arguments:
- This - Protocol instance pointer.
- IdeChannel - Primary or Secondary
- IdeDevice - Master or Slave
-
- Returns:
- EFI_SUCCESS - IdeChannel and IdeDevice are valid
- EFI_UNSUPPORTED - This is not an IDE device
-
---*/
-;
-
-//
-// GUIDs for EFI_DISK_INFO_PROTOCOL.Interface. Defines the format of the
-// buffers returned by member functions
-//
-#define EFI_DISK_INFO_IDE_INTERFACE_GUID \
- { \
- 0x5e948fe3, 0x26d3, 0x42b5, {0xaf, 0x17, 0x61, 0x2, 0x87, 0x18, 0x8d, 0xec } \
- }
-extern EFI_GUID gEfiDiskInfoIdeInterfaceGuid;
-
-#define EFI_DISK_INFO_SCSI_INTERFACE_GUID \
- { \
- 0x8f74baa, 0xea36, 0x41d9, {0x95, 0x21, 0x21, 0xa7, 0xf, 0x87, 0x80, 0xbc } \
- }
-extern EFI_GUID gEfiDiskInfoScsiInterfaceGuid;
-
-#define EFI_DISK_INFO_USB_INTERFACE_GUID \
- { \
- 0xcb871572, 0xc11a, 0x47b5, {0xb4, 0x92, 0x67, 0x5e, 0xaf, 0xa7, 0x77, 0x27 } \
- }
-extern EFI_GUID gEfiDiskInfoUsbInterfaceGuid;
-
-struct _EFI_DISK_INFO_PROTOCOL {
- EFI_GUID Interface;
- EFI_DISK_INFO_INQUIRY Inquiry;
- EFI_DISK_INFO_IDENTIFY Identify;
- EFI_DISK_INFO_SENSE_DATA SenseData;
- EFI_DISK_INFO_WHICH_IDE WhichIde;
-};
-
-extern EFI_GUID gEfiDiskInfoProtocolGuid;
-
-#endif
-
-
diff --git a/EdkModulePkg/Include/Protocol/EdkDecompress.h b/EdkModulePkg/Include/Protocol/EdkDecompress.h
deleted file mode 100644
index ab9b840..0000000
--- a/EdkModulePkg/Include/Protocol/EdkDecompress.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- EdkDecompress.h
-
-Abstract:
- The Tiano Decompress Protocol Interface
-
---*/
-
-#ifndef __EDK_DECOMPRESS_H__
-#define __EDK_DECOMPRESS_H__
-
-#define EFI_TIANO_DECOMPRESS_PROTOCOL_GUID \
- { 0xe84cf29c, 0x191f, 0x4eae, {0x96, 0xe1, 0xf4, 0x6a, 0xec, 0xea, 0xea, 0x0b } }
-
-typedef struct _EFI_TIANO_DECOMPRESS_PROTOCOL EFI_TIANO_DECOMPRESS_PROTOCOL;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_TIANO_DECOMPRESS_GET_INFO) (
- IN EFI_TIANO_DECOMPRESS_PROTOCOL *This,
- IN VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- );
-/*++
-
-Routine Description:
-
- The GetInfo() function retrieves the size of the uncompressed buffer
- and the temporary scratch buffer required to decompress the buffer
- specified by Source and SourceSize. If the size of the uncompressed
- buffer or the size of the scratch buffer cannot be determined from
- the compressed data specified by Source and SourceData, then
- EFI_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed
- buffer is returned in DestinationSize, the size of the scratch buffer is
- returned in ScratchSize, and EFI_SUCCESS is returned.
-
- The GetInfo() function does not have scratch buffer available to perform
- a thorough checking of the validity of the source data. It just retrieves
- the 'Original Size' field from the beginning bytes of the source data and
- output it as DestinationSize. And ScratchSize is specific to the decompression
- implementation.
-
-Arguments:
-
- This - The protocol instance pointer
- Source - The source buffer containing the compressed data.
- SourceSize - The size, in bytes, of source buffer.
- DestinationSize - A pointer to the size, in bytes, of the uncompressed buffer
- that will be generated when the compressed buffer specified
- by Source and SourceSize is decompressed.
- ScratchSize - A pointer to the size, in bytes, of the scratch buffer that
- is required to decompress the compressed buffer specified by
- Source and SourceSize.
-
-Returns:
- EFI_SUCCESS - The size of the uncompressed data was returned in DestinationSize
- and the size of the scratch buffer was returned in ScratchSize.
- EFI_INVALID_PARAMETER - The size of the uncompressed data or the size of the scratch
- buffer cannot be determined from the compressed data specified by
- Source and SourceData.
-
---*/
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_TIANO_DECOMPRESS_DECOMPRESS) (
- IN EFI_TIANO_DECOMPRESS_PROTOCOL *This,
- IN VOID* Source,
- IN UINT32 SourceSize,
- IN OUT VOID* Destination,
- IN UINT32 DestinationSize,
- IN OUT VOID* Scratch,
- IN UINT32 ScratchSize
- );
-/*++
-
-Routine Description:
-
- The Decompress() function extracts decompressed data to its original form.
-
- This protocol is designed so that the decompression algorithm can be
- implemented without using any memory services. As a result, the
- Decompress() function is not allowed to call AllocatePool() or
- AllocatePages() in its implementation. It is the caller's responsibility
- to allocate and free the Destination and Scratch buffers.
-
- If the compressed source data specified by Source and SourceSize is
- sucessfully decompressed into Destination, then EFI_SUCCESS is returned.
- If the compressed source data specified by Source and SourceSize is not in
- a valid compressed data format, then EFI_INVALID_PARAMETER is returned.
-
-Arguments:
-
- This - The protocol instance pointer
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source data.
- Destination - On output, the destination buffer that contains
- the uncompressed data.
- DestinationSize - The size of destination buffer. The size of destination
- buffer needed is obtained from GetInfo().
- Scratch - A temporary scratch buffer that is used to perform the
- decompression.
- ScratchSize - The size of scratch buffer. The size of scratch buffer needed
- is obtained from GetInfo().
-
-Returns:
-
- EFI_SUCCESS - Decompression completed successfully, and the uncompressed
- buffer is returned in Destination.
- EFI_INVALID_PARAMETER
- - The source buffer specified by Source and SourceSize is
- corrupted (not in a valid compressed format).
-
---*/
-
-struct _EFI_TIANO_DECOMPRESS_PROTOCOL {
- EFI_TIANO_DECOMPRESS_GET_INFO GetInfo;
- EFI_TIANO_DECOMPRESS_DECOMPRESS Decompress;
-};
-
-extern EFI_GUID gEfiTianoDecompressProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/ExtendedSalBootService.h b/EdkModulePkg/Include/Protocol/ExtendedSalBootService.h
deleted file mode 100644
index 28aceb3..0000000
--- a/EdkModulePkg/Include/Protocol/ExtendedSalBootService.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ExtendedSalBootService.h
-
-Abstract:
-
---*/
-
-#ifndef _EXTENDED_SAL_PROTOCOL_H_
-#define _EXTENDED_SAL_PROTOCOL_H_
-
-#define EXTENDED_SAL_BOOT_SERVICE_PROTOCOL_GUID \
- {0xde0ee9a4,0x3c7a,0x44f2, {0xb7,0x8b,0xe3,0xcc,0xd6,0x9c,0x3a,0xf7}}
-
-#define EXTENDED_SAL_SIGNATURE EFI_SIGNATURE_32('e', 's', 'a', 'l')
-
-#define SAL_MIN_STATE_SIZE 0x400 * 1
-#define PAL_SCARTCH_SIZE 0x400 * 3
-#define ALIGN_MINSTATE_SIZE 512
-#define MAX_SAL_RECORD_SIZE 8*1024
-
-#define SAL_RUNTIMESERVICE
-
-typedef UINT16 EFI_SAL_PROCESSOR_ID;
-
-typedef struct _EXTENDED_SAL_BOOT_SERVICE_PROTOCOL EXTENDED_SAL_BOOT_SERVICE_PROTOCOL;
-
-typedef
-SAL_RUNTIMESERVICE
-SAL_RETURN_REGS
-(EFIAPI *SAL_EXTENDED_SAL_PROC) (
- IN EFI_GUID *ClassGuid,
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8
- );
-
-typedef
-SAL_RUNTIMESERVICE
-SAL_RETURN_REGS
-(EFIAPI *SAL_INTERNAL_EXTENDED_SAL_PROC) (
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8,
- IN SAL_EXTENDED_SAL_PROC ExtendedSalProc,
- IN BOOLEAN VirtualMode,
- IN VOID *ModuleGlobal
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EXTENDED_SAL_ADD_SST_INFO) (
- IN EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *This,
- IN UINT16 SalAVersion,
- IN UINT16 SalBVersion,
- IN CHAR8 *OemId,
- IN CHAR8 *ProductId
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EXTENDED_SAL_ADD_SST_ENTRY) (
- IN EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *This,
- IN UINT8 EntryType,
- IN UINT8 *TableEntry,
- IN UINTN EntrySize
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EXTENDED_SAL_REGISTER_INTERNAL_PROC) (
- IN EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *This,
- IN EFI_GUID *ClassGuid,
- IN UINT64 FunctionId,
- IN SAL_INTERNAL_EXTENDED_SAL_PROC InternalSalProc,
- IN VOID *PhysicalModuleGlobal
- );
-
-//
-// Extended Sal Boot Service Protocol Interface
-//
-struct _EXTENDED_SAL_BOOT_SERVICE_PROTOCOL{
- EXTENDED_SAL_ADD_SST_INFO AddSalSystemTableInfo;
- EXTENDED_SAL_ADD_SST_ENTRY AddSalSystemTableEntry;
- EXTENDED_SAL_REGISTER_INTERNAL_PROC AddExtendedSalProc;
- SAL_EXTENDED_SAL_PROC ExtendedSalProc;
- SAL_PROC SalProc;
-};
-
-extern EFI_GUID gEfiExtendedSalBootServiceProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/FaultTolerantWriteLite.h b/EdkModulePkg/Include/Protocol/FaultTolerantWriteLite.h
deleted file mode 100644
index c3ec825..0000000
--- a/EdkModulePkg/Include/Protocol/FaultTolerantWriteLite.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FaultTolerantWriteLite.h
-
-Abstract:
-
- This is a simple fault tolerant write driver, based on PlatformFd library.
- And it only supports write BufferSize <= SpareAreaLength.
-
---*/
-
-#ifndef _FW_FAULT_TOLERANT_WRITE_LITE_PROTOCOL_H_
-#define _FW_FAULT_TOLERANT_WRITE_LITE_PROTOCOL_H_
-
-#define EFI_FTW_LITE_PROTOCOL_GUID \
-{ 0x3f557189, 0x8dae, 0x45ae, {0xa0, 0xb3, 0x2b, 0x99, 0xca, 0x7a, 0xa7, 0xa0 } }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_FTW_LITE_PROTOCOL EFI_FTW_LITE_PROTOCOL;
-
-//
-// Protocol API definitions
-//
-
-typedef
-EFI_STATUS
-(EFIAPI * EFI_FTW_LITE_WRITE) (
- IN EFI_FTW_LITE_PROTOCOL *This,
- IN EFI_HANDLE FvbHandle,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN UINTN *NumBytes,
- IN VOID *Buffer
- );
-/*++
-
-Routine Description:
-
- Starts a target block update. This records information about the write
- in fault tolerant storage and will complete the write in a recoverable
- manner, ensuring at all times that either the original contents or
- the modified contents are available.
-
-Arguments:
-
- This - Calling context
- FvBlockHandle - The handle of FVB protocol that provides services for
- reading, writing, and erasing the target block.
- Lba - The logical block address of the target block.
- Offset - The offset within the target block to place the data.
- Length - The number of bytes to write to the target block.
- Buffer - The data to write.
-
-Returns:
-
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully.
- EFI_BAD_BUFFER_SIZE - The write would span a block boundary,
- which is not a valid action.
- EFI_ACCESS_DENIED - No writes have been allocated.
- EFI_NOT_READY - The last write has not been completed.
- Restart () must be called to complete it.
-
---*/
-
-//
-// Protocol declaration
-//
-struct _EFI_FTW_LITE_PROTOCOL {
- EFI_FTW_LITE_WRITE Write;
-};
-
-extern EFI_GUID gEfiFaultTolerantWriteLiteProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/FvbExtension.h b/EdkModulePkg/Include/Protocol/FvbExtension.h
deleted file mode 100644
index c2be78b..0000000
--- a/EdkModulePkg/Include/Protocol/FvbExtension.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FvbExtension.h
-
-Abstract:
-
- FVB Extension protocol that extends the FVB Class in a component fashion.
-
---*/
-
-#ifndef _FVB_EXTENSION_H_
-#define _FVB_EXTENSION_H_
-
-#define EFI_FVB_EXTENSION_PROTOCOL_GUID \
- {0x53a4c71b, 0xb581, 0x4170, {0x91, 0xb3, 0x8d, 0xb8, 0x7a, 0x4b, 0x5c, 0x46 } }
-
-typedef struct _EFI_FVB_EXTENSION_PROTOCOL EFI_FVB_EXTENSION_PROTOCOL;
-
-//
-// FVB Extension Function Prototypes
-//
-typedef
-EFI_STATUS
-(EFIAPI * EFI_FV_ERASE_CUSTOM_BLOCK) (
- IN EFI_FVB_EXTENSION_PROTOCOL *This,
- IN EFI_LBA StartLba,
- IN UINTN OffsetStartLba,
- IN EFI_LBA LastLba,
- IN UINTN OffsetLastLba
-);
-
-//
-// IPMI TRANSPORT PROTOCOL
-//
-struct _EFI_FVB_EXTENSION_PROTOCOL {
- EFI_FV_ERASE_CUSTOM_BLOCK EraseFvbCustomBlock;
-};
-
-extern EFI_GUID gEfiFvbExtensionProtocolGuid;
-
-#endif
-
diff --git a/EdkModulePkg/Include/Protocol/GenericMemoryTest.h b/EdkModulePkg/Include/Protocol/GenericMemoryTest.h
deleted file mode 100644
index 8f566d3..0000000
--- a/EdkModulePkg/Include/Protocol/GenericMemoryTest.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- GenericMemoryTest.h
-
-Abstract:
-
- The EFI generic memory test protocol
- For more information please look at EfiMemoryTest.doc
-
---*/
-
-#ifndef __GENERIC_MEMORY_TEST_H__
-#define __GENERIC_MEMORY_TEST_H__
-
-#define EFI_GENERIC_MEMORY_TEST_PROTOCOL_GUID \
- { 0x309de7f1, 0x7f5e, 0x4ace, {0xb4, 0x9c, 0x53, 0x1b, 0xe5, 0xaa, 0x95, 0xef} }
-
-typedef struct _EFI_GENERIC_MEMORY_TEST_PROTOCOL EFI_GENERIC_MEMORY_TEST_PROTOCOL;
-
-typedef enum {
- IGNORE,
- QUICK,
- SPARSE,
- EXTENSIVE,
- MAXLEVEL
-} EXTENDMEM_COVERAGE_LEVEL;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_MEMORY_TEST_INIT) (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- IN EXTENDMEM_COVERAGE_LEVEL Level,
- OUT BOOLEAN *RequireSoftECCInit
- )
-/*++
-
- Routine Description:
- Initialize the generic memory test.
-
- Arguments:
- This - Protocol instance pointer.
- Level - The coverage level of the memory test.
- RequireSoftECCInit - Indicate if the memory need software ECC init.
-
- Returns:
- EFI_SUCCESS - The generic memory test initialized correctly.
- EFI_NO_MEDIA - There is not any non-tested memory found, in this
- function if not any non-tesed memory found means
- that the memory test driver have not detect any
- non-tested extended memory of current system.
-
---*/
-;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PERFORM_MEMORY_TEST) (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- OUT UINT64 *TestedMemorySize,
- OUT UINT64 *TotalMemorySize,
- OUT BOOLEAN *ErrorOut,
- IN BOOLEAN IfTestAbort
- )
-/*++
-
- Routine Description:
- Perform the memory test.
-
- Arguments:
- This - Protocol instance pointer.
- TestedMemorySize - Return the tested extended memory size.
- TotalMemorySize - Return the whole system physical memory size, this
- value may be changed if in some case some error
- DIMMs be disabled.
- ErrorOut - Any time the memory error occurs, this will be TRUE.
- IfTestAbort - Indicate if the user press "ESC" to skip the memory
- test.
-
- Returns:
- EFI_SUCCESS - One block of memory test ok, the block size is hide
- internally.
- EFI_NOT_FOUND - Indicate all the non-tested memory blocks have
- already go through.
-
---*/
-;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_MEMORY_TEST_FINISHED) (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- The memory test finished.
-
- Arguments:
- This - Protocol instance pointer.
-
- Returns:
- EFI_SUCCESS - Successful free all the generic memory test driver
- allocated resource and notify to platform memory
- test driver that memory test finished.
-
---*/
-;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_MEMORY_TEST_COMPATIBLE_RANGE) (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS StartAddress,
- IN UINT64 Length
- )
-/*++
-
- Routine Description:
- Provide capability to test compatible range which used by some sepcial
- driver required using memory range before BDS perform memory test.
-
- Arguments:
- This - Protocol instance pointer.
- StartAddress - The start address of the memory range.
- Length - The memory range's length.
-
- Return:
- EFI_SUCCESS - The compatible memory range pass the memory test.
- EFI_DEVICE_ERROR - The compatible memory range test find memory error
- and also return return the error address.
-
---*/
-;
-
-struct _EFI_GENERIC_MEMORY_TEST_PROTOCOL {
- EFI_MEMORY_TEST_INIT MemoryTestInit;
- EFI_PERFORM_MEMORY_TEST PerformMemoryTest;
- EFI_MEMORY_TEST_FINISHED Finished;
- EFI_MEMORY_TEST_COMPATIBLE_RANGE CompatibleRangeTest;
-};
-
-extern EFI_GUID gEfiGenericMemTestProtocolGuid;
-
-#endif
-
diff --git a/EdkModulePkg/Include/Protocol/IsaAcpi.h b/EdkModulePkg/Include/Protocol/IsaAcpi.h
deleted file mode 100644
index c3d92f6..0000000
--- a/EdkModulePkg/Include/Protocol/IsaAcpi.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- IsaAcpi.h
-
-Abstract:
-
- EFI ISA Acpi Protocol
-
-Revision History
-
---*/
-
-#ifndef _ISA_ACPI_H_
-#define _ISA_ACPI_H_
-
-#define EFI_ISA_ACPI_PROTOCOL_GUID \
- { 0x64a892dc, 0x5561, 0x4536, { 0x92, 0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55 } }
-
-typedef struct _EFI_ISA_ACPI_PROTOCOL EFI_ISA_ACPI_PROTOCOL;
-
-//
-// Resource Attribute definition
-//
-#define EFI_ISA_ACPI_IRQ_TYPE_HIGH_TRUE_EDGE_SENSITIVE 0x01
-#define EFI_ISA_ACPI_IRQ_TYPE_LOW_TRUE_EDGE_SENSITIVE 0x02
-#define EFI_ISA_ACPI_IRQ_TYPE_HIGH_TRUE_LEVEL_SENSITIVE 0x04
-#define EFI_ISA_ACPI_IRQ_TYPE_LOW_TRUE_LEVEL_SENSITIVE 0x08
-
-#define EFI_ISA_ACPI_DMA_SPEED_TYPE_MASK 0x03
-
-#define EFI_ISA_ACPI_DMA_SPEED_TYPE_COMPATIBILITY 0x00
-#define EFI_ISA_ACPI_DMA_SPEED_TYPE_A 0x01
-#define EFI_ISA_ACPI_DMA_SPEED_TYPE_B 0x02
-#define EFI_ISA_ACPI_DMA_SPEED_TYPE_F 0x03
-#define EFI_ISA_ACPI_DMA_COUNT_BY_BYTE 0x04
-#define EFI_ISA_ACPI_DMA_COUNT_BY_WORD 0x08
-#define EFI_ISA_ACPI_DMA_BUS_MASTER 0x10
-#define EFI_ISA_ACPI_DMA_TRANSFER_TYPE_8_BIT 0x20
-#define EFI_ISA_ACPI_DMA_TRANSFER_TYPE_8_BIT_AND_16_BIT 0x40
-#define EFI_ISA_ACPI_DMA_TRANSFER_TYPE_16_BIT 0x80
-
-#define EFI_ISA_ACPI_MEMORY_WIDTH_MASK 0x03
-
-#define EFI_ISA_ACPI_MEMORY_WIDTH_8_BIT 0x00
-#define EFI_ISA_ACPI_MEMORY_WIDTH_16_BIT 0x01
-#define EFI_ISA_ACPI_MEMORY_WIDTH_8_BIT_AND_16_BIT 0x02
-#define EFI_ISA_ACPI_MEMORY_WRITEABLE 0x04
-#define EFI_ISA_ACPI_MEMORY_CACHEABLE 0x08
-#define EFI_ISA_ACPI_MEMORY_SHADOWABLE 0x10
-#define EFI_ISA_ACPI_MEMORY_EXPANSION_ROM 0x20
-
-#define EFI_ISA_ACPI_IO_DECODE_10_BITS 0x01
-#define EFI_ISA_ACPI_IO_DECODE_16_BITS 0x02
-
-//
-// Resource List definition:
-// at first, the resource was defined as below
-// but in the future, it will be defined again that follow ACPI spec: ACPI resource type
-// so that, in this driver, we can interpret the ACPI table and get the ISA device information.
-//
-
-typedef enum {
- EfiIsaAcpiResourceEndOfList,
- EfiIsaAcpiResourceIo,
- EfiIsaAcpiResourceMemory,
- EfiIsaAcpiResourceDma,
- EfiIsaAcpiResourceInterrupt
-} EFI_ISA_ACPI_RESOURCE_TYPE;
-
-typedef struct {
- EFI_ISA_ACPI_RESOURCE_TYPE Type;
- UINT32 Attribute;
- UINT32 StartRange;
- UINT32 EndRange;
-} EFI_ISA_ACPI_RESOURCE;
-
-typedef struct {
- UINT32 HID;
- UINT32 UID;
-} EFI_ISA_ACPI_DEVICE_ID;
-
-typedef struct {
- EFI_ISA_ACPI_DEVICE_ID Device;
- EFI_ISA_ACPI_RESOURCE *ResourceItem;
-} EFI_ISA_ACPI_RESOURCE_LIST;
-
-//
-// Prototypes for the ISA ACPI Protocol
-//
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_ACPI_DEVICE_ENUMERATE) (
- IN EFI_ISA_ACPI_PROTOCOL *This,
- OUT EFI_ISA_ACPI_DEVICE_ID **Device
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_ACPI_SET_DEVICE_POWER) (
- IN EFI_ISA_ACPI_PROTOCOL *This,
- IN EFI_ISA_ACPI_DEVICE_ID *Device,
- IN BOOLEAN OnOff
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_ACPI_GET_CUR_RESOURCE) (
- IN EFI_ISA_ACPI_PROTOCOL *This,
- IN EFI_ISA_ACPI_DEVICE_ID *Device,
- OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_ACPI_GET_POS_RESOURCE) (
- IN EFI_ISA_ACPI_PROTOCOL *This,
- IN EFI_ISA_ACPI_DEVICE_ID *Device,
- OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_ACPI_SET_RESOURCE) (
- IN EFI_ISA_ACPI_PROTOCOL *This,
- IN EFI_ISA_ACPI_DEVICE_ID *Device,
- IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_ACPI_ENABLE_DEVICE) (
- IN EFI_ISA_ACPI_PROTOCOL *This,
- IN EFI_ISA_ACPI_DEVICE_ID *Device,
- IN BOOLEAN Enable
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_ACPI_INIT_DEVICE) (
- IN EFI_ISA_ACPI_PROTOCOL *This,
- IN EFI_ISA_ACPI_DEVICE_ID *Device
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_ACPI_INTERFACE_INIT) (
- IN EFI_ISA_ACPI_PROTOCOL *This
- );
-
-//
-// Interface structure for the ISA ACPI Protocol
-//
-struct _EFI_ISA_ACPI_PROTOCOL {
- EFI_ISA_ACPI_DEVICE_ENUMERATE DeviceEnumerate;
- EFI_ISA_ACPI_SET_DEVICE_POWER SetPower;
- EFI_ISA_ACPI_GET_CUR_RESOURCE GetCurResource;
- EFI_ISA_ACPI_GET_POS_RESOURCE GetPosResource;
- EFI_ISA_ACPI_SET_RESOURCE SetResource;
- EFI_ISA_ACPI_ENABLE_DEVICE EnableDevice;
- EFI_ISA_ACPI_INIT_DEVICE InitDevice;
- EFI_ISA_ACPI_INTERFACE_INIT InterfaceInit;
-};
-
-extern EFI_GUID gEfiIsaAcpiProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/IsaIo.h b/EdkModulePkg/Include/Protocol/IsaIo.h
deleted file mode 100644
index 37b4bc5..0000000
--- a/EdkModulePkg/Include/Protocol/IsaIo.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- IsaIo.h
-
-Abstract:
-
- EFI ISA I/O Protocol
-
-Revision History
-
---*/
-
-#ifndef _EFI_ISA_IO_H
-#define _EFI_ISA_IO_H
-
-//
-// Global ID for the ISA I/O Protocol
-//
-
-#define EFI_ISA_IO_PROTOCOL_GUID \
- { 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
-
-typedef struct _EFI_ISA_IO_PROTOCOL EFI_ISA_IO_PROTOCOL;
-
-//
-// Prototypes for the ISA I/O Protocol
-//
-
-typedef enum {
- EfiIsaIoWidthUint8,
- EfiIsaIoWidthUint16,
- EfiIsaIoWidthUint32,
- EfiIsaIoWidthReserved,
- EfiIsaIoWidthFifoUint8,
- EfiIsaIoWidthFifoUint16,
- EfiIsaIoWidthFifoUint32,
- EfiIsaIoWidthFifoReserved,
- EfiIsaIoWidthFillUint8,
- EfiIsaIoWidthFillUint16,
- EfiIsaIoWidthFillUint32,
- EfiIsaIoWidthFillReserved,
- EfiIsaIoWidthMaximum
-} EFI_ISA_IO_PROTOCOL_WIDTH;
-
-//
-// Attributes for common buffer allocations
-//
-#define EFI_ISA_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x080 // Map a memory range so write are combined
-#define EFI_ISA_IO_ATTRIBUTE_MEMORY_CACHED 0x800 // Map a memory range so all r/w accesses are cached
-#define EFI_ISA_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 // Disable a memory range
-
-//
-// Channel attribute for DMA operations
-//
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE 0x001
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_A 0x002
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_B 0x004
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_C 0x008
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8 0x010
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16 0x020
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE 0x040
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE 0x080
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_AUTO_INITIALIZE 0x100
-
-typedef enum {
- EfiIsaIoOperationBusMasterRead,
- EfiIsaIoOperationBusMasterWrite,
- EfiIsaIoOperationBusMasterCommonBuffer,
- EfiIsaIoOperationSlaveRead,
- EfiIsaIoOperationSlaveWrite,
- EfiIsaIoOperationMaximum
-} EFI_ISA_IO_PROTOCOL_OPERATION;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_IO_PROTOCOL_IO_MEM) (
- IN EFI_ISA_IO_PROTOCOL *This,
- IN EFI_ISA_IO_PROTOCOL_WIDTH Width,
- IN UINT32 Offset,
- IN UINTN Count,
- IN OUT VOID *Buffer
- );
-
-typedef struct {
- EFI_ISA_IO_PROTOCOL_IO_MEM Read;
- EFI_ISA_IO_PROTOCOL_IO_MEM Write;
-} EFI_ISA_IO_PROTOCOL_ACCESS;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_IO_PROTOCOL_COPY_MEM) (
- IN EFI_ISA_IO_PROTOCOL *This,
- IN EFI_ISA_IO_PROTOCOL_WIDTH Width,
- IN UINT32 DestOffset,
- IN UINT32 SrcOffset,
- IN UINTN Count
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_IO_PROTOCOL_MAP) (
- IN EFI_ISA_IO_PROTOCOL *This,
- IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,
- IN UINT8 ChannelNumber OPTIONAL,
- IN UINT32 ChannelAttributes,
- IN VOID *HostAddress,
- IN OUT UINTN *NumberOfBytes,
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
- OUT VOID **Mapping
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_IO_PROTOCOL_UNMAP) (
- IN EFI_ISA_IO_PROTOCOL *This,
- IN VOID *Mapping
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER) (
- IN EFI_ISA_IO_PROTOCOL *This,
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN Pages,
- OUT VOID **HostAddress,
- IN UINT64 Attributes
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_IO_PROTOCOL_FREE_BUFFER) (
- IN EFI_ISA_IO_PROTOCOL *This,
- IN UINTN Pages,
- IN VOID *HostAddress
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_ISA_IO_PROTOCOL_FLUSH) (
- IN EFI_ISA_IO_PROTOCOL *This
- );
-
-//
-// Interface structure for the ISA I/O Protocol
-//
-struct _EFI_ISA_IO_PROTOCOL {
- EFI_ISA_IO_PROTOCOL_ACCESS Mem;
- EFI_ISA_IO_PROTOCOL_ACCESS Io;
- EFI_ISA_IO_PROTOCOL_COPY_MEM CopyMem;
- EFI_ISA_IO_PROTOCOL_MAP Map;
- EFI_ISA_IO_PROTOCOL_UNMAP Unmap;
- EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
- EFI_ISA_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
- EFI_ISA_IO_PROTOCOL_FLUSH Flush;
- EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;
- UINT32 RomSize;
- VOID *RomImage;
-};
-
-extern EFI_GUID gEfiIsaIoProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/LoadPe32Image.h b/EdkModulePkg/Include/Protocol/LoadPe32Image.h
deleted file mode 100644
index d6f54aa..0000000
--- a/EdkModulePkg/Include/Protocol/LoadPe32Image.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- LoadPe32Image.h
-
-Abstract:
- Load File protocol as defined in the EFI 1.0 specification.
-
- Load file protocol exists to supports the addition of new boot devices,
- and to support booting from devices that do not map well to file system.
- Network boot is done via a LoadFile protocol.
-
- EFI 1.0 can boot from any device that produces a LoadFile protocol.
-
---*/
-
-#ifndef __LOAD_PE32_IMAGE_H__
-#define __LOAD_PE32_IMAGE_H__
-
-#define PE32_IMAGE_PROTOCOL_GUID \
- {0x5cb5c776,0x60d5,0x45ee,{0x88,0x3c,0x45,0x27,0x8,0xcd,0x74,0x3f }}
-
-#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_NONE 0x00
-#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION 0x01
-#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION 0x02
-
-typedef struct _EFI_PE32_IMAGE_PROTOCOL EFI_PE32_IMAGE_PROTOCOL;
-
-typedef
-EFI_STATUS
-(EFIAPI *LOAD_PE_IMAGE) (
- IN EFI_PE32_IMAGE_PROTOCOL *This,
- IN EFI_HANDLE ParentImageHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN VOID *SourceBuffer OPTIONAL,
- IN UINTN SourceSize,
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
- OUT UINTN *NumberOfPages OPTIONAL,
- OUT EFI_HANDLE *ImageHandle,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,
- IN UINT32 Attribute
- );
-
-typedef
-EFI_STATUS
-(EFIAPI *UNLOAD_PE_IMAGE) (
- IN EFI_PE32_IMAGE_PROTOCOL *This,
- IN EFI_HANDLE ImageHandle
- );
-
-struct _EFI_PE32_IMAGE_PROTOCOL {
- LOAD_PE_IMAGE LoadPeImage;
- UNLOAD_PE_IMAGE UnLoadPeImage;
-};
-
-extern EFI_GUID gEfiLoadPeImageProtocolGuid;
-
-#endif
-
diff --git a/EdkModulePkg/Include/Protocol/OEMBadging.h b/EdkModulePkg/Include/Protocol/OEMBadging.h
deleted file mode 100644
index 6b4602e..0000000
--- a/EdkModulePkg/Include/Protocol/OEMBadging.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EfiOEMBadging.h
-
-Abstract:
-
- EFI OEM Badging Protocol definition header file
-
-Revision History
-
---*/
-
-#ifndef _EFI_OEM_BADGING_H_
-#define _EFI_OEM_BADGING_H_
-
-//
-// GUID for EFI OEM Badging Protocol
-//
-#define EFI_OEM_BADGING_PROTOCOL_GUID \
- { 0x170e13c0, 0xbf1b, 0x4218, {0x87, 0x1d, 0x2a, 0xbd, 0xc6, 0xf8, 0x87, 0xbc } }
-
-
-typedef struct _EFI_OEM_BADGING_PROTOCOL EFI_OEM_BADGING_PROTOCOL;
-
-typedef enum {
- EfiBadgingFormatBMP,
- EfiBadgingFormatJPEG,
- EfiBadgingFormatTIFF,
- EfiBadgingFormatGIF,
- EfiBadgingFormatUnknown
-} EFI_BADGING_FORMAT;
-
-typedef enum {
- EfiBadgingDisplayAttributeLeftTop,
- EfiBadgingDisplayAttributeCenterTop,
- EfiBadgingDisplayAttributeRightTop,
- EfiBadgingDisplayAttributeCenterRight,
- EfiBadgingDisplayAttributeRightBottom,
- EfiBadgingDisplayAttributeCenterBottom,
- EfiBadgingDisplayAttributeLeftBottom,
- EfiBadgingDisplayAttributeCenterLeft,
- EfiBadgingDisplayAttributeCenter,
- EfiBadgingDisplayAttributeCustomized
-} EFI_BADGING_DISPLAY_ATTRIBUTE;
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_BADGING_GET_IMAGE) (
- IN EFI_OEM_BADGING_PROTOCOL *This,
- IN OUT UINT32 *Instance,
- OUT EFI_BADGING_FORMAT *Format,
- OUT UINT8 **ImageData,
- OUT UINTN *ImageSize,
- OUT EFI_BADGING_DISPLAY_ATTRIBUTE *Attribute,
- OUT UINTN *CoordinateX,
- OUT UINTN *CoordinateY
-);
-
-
-struct _EFI_OEM_BADGING_PROTOCOL {
- EFI_BADGING_GET_IMAGE GetImage;
-};
-
-
-extern EFI_GUID gEfiOEMBadgingProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/PciHotPlugRequest.h b/EdkModulePkg/Include/Protocol/PciHotPlugRequest.h
deleted file mode 100644
index 6d194ae..0000000
--- a/EdkModulePkg/Include/Protocol/PciHotPlugRequest.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PciHotPlugRequest.h
-
-Abstract:
-
-
-
---*/
-
-#ifndef _PCI_HOTPLUG_REQUEST_H_
-#define _PCI_HOTPLUG_REQUEST_H_
-
-#define EFI_PCI_HOTPLUG_REQUEST_PROTOCOL_GUID \
-{0x19cb87ab,0x2cb9,{0x4665,0x83,0x60,0xdd,0xcf,0x60,0x54,0xf7,0x9d}}
-
-typedef enum {
- EfiPciHotPlugRequestAdd,
- EfiPciHotplugRequestRemove
-} EFI_PCI_HOTPLUG_OPERATION;
-
-typedef struct _EFI_PCI_HOTPLUG_REQUEST_PROTOCOL EFI_PCI_HOTPLUG_REQUEST_PROTOCOL;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PCI_HOTPLUG_REQUEST_NOTIFY) (
- IN EFI_PCI_HOTPLUG_REQUEST_PROTOCOL *This,
- IN EFI_PCI_HOTPLUG_OPERATION Operation,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,
- IN OUT UINT8 *NumberOfChildren,
- IN OUT EFI_HANDLE *ChildHandleBuffer
-);
-
-
-
-struct _EFI_PCI_HOTPLUG_REQUEST_PROTOCOL {
- EFI_PCI_HOTPLUG_REQUEST_NOTIFY Notify;
-};
-
-extern EFI_GUID gEfiPciHotPlugRequestProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/Performance.h b/EdkModulePkg/Include/Protocol/Performance.h
deleted file mode 100644
index c16ed8c..0000000
--- a/EdkModulePkg/Include/Protocol/Performance.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Performance.h
-
-Abstract:
-
-
---*/
-
-#ifndef __PERFORMANCE_H_
-#define __PERFORMANCE_H_
-
-#define PERFORMANCE_PROTOCOL_GUID \
- { 0x76b6bdfa, 0x2acd, 0x4462, {0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL;
-
-#define DXE_TOK "DXE"
-#define SHELL_TOK "SHELL"
-#define PEI_TOK "PEI"
-#define BDS_TOK "BDS"
-#define DRIVERBINDING_START_TOK "DriverBinding:Start"
-#define DRIVERBINDING_SUPPORT_TOK "DriverBinding:Support"
-#define START_IMAGE_TOK "StartImage"
-#define LOAD_IMAGE_TOK "LoadImage"
-
-//
-// DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.
-//
-#define DXE_PERFORMANCE_STRING_SIZE 32
-#define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)
-
-//
-// The default guage entries number for DXE phase.
-//
-#define INIT_DXE_GAUGE_DATA_ENTRIES 800
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS Handle;
- CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE];
- CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE];
- UINT64 StartTimeStamp;
- UINT64 EndTimeStamp;
-} GAUGE_DATA_ENTRY;
-
-//
-// The header must be aligned at 8 bytes
-//
-typedef struct {
- UINT32 NumberOfEntries;
- UINT32 Reserved;
-} GAUGE_DATA_HEADER;
-
-/**
- Adds a record at the end of the performance measurement log
- that records the start time of a performance measurement.
-
- Adds a record to the end of the performance measurement log
- that contains the Handle, Token, and Module.
- The end time of the new record must be set to zero.
- If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
- If TimeStamp is zero, the start time in the record is filled in with the value
- read from the current time stamp.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval EFI_SUCCESS The data was read correctly from the device.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI * PERFORMANCE_START_GAUGE) (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- );
-
-/**
- Searches the performance measurement log from the beginning of the log
- for the first matching record that contains a zero end time and fills in a valid end time.
-
- Searches the performance measurement log from the beginning of the log
- for the first record that matches Handle, Token, and Module and has an end time value of zero.
- If the record can not be found then return EFI_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then the end time in the record is filled in with the value specified by TimeStamp.
- If the record is found and TimeStamp is zero, then the end time in the matching record
- is filled in with the current time stamp value.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval EFI_SUCCESS The end of the measurement was recorded.
- @retval EFI_NOT_FOUND The specified measurement record could not be found.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI * PERFORMANCE_END_GAUGE) (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- );
-
-/**
- Retrieves a previously logged performance measurement.
-
- Retrieves the performance log entry from the performance log specified by LogEntryKey.
- If it stands for a valid entry, then EFI_SUCCESS is returned and
- GaugeDataEntry stores the pointer to that entry.
-
- @param LogEntryKey The key for the previous performance measurement log entry.
- If 0, then the first performance measurement log entry is retrieved.
- @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey
- if the retrieval is successful.
-
- @retval EFI_SUCCESS The GuageDataEntry is successfuly found based on LogEntryKey.
- @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).
- @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).
- @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI * PERFORMANCE_GET_GAUGE) (
- IN UINTN LogEntryKey,
- OUT GAUGE_DATA_ENTRY **GaugeDataEntry
- );
-
-struct _PERFORMANCE_PROTOCOL {
- PERFORMANCE_START_GAUGE StartGauge;
- PERFORMANCE_END_GAUGE EndGauge;
- PERFORMANCE_GET_GAUGE GetGauge;
-};
-
-extern EFI_GUID gPerformanceProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/Print.h b/EdkModulePkg/Include/Protocol/Print.h
deleted file mode 100644
index eee7a0d..0000000
--- a/EdkModulePkg/Include/Protocol/Print.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Print.h
-
-Abstract:
-
- This file defines the Print protocol
-
---*/
-
-#ifndef _PPRINT_H_
-#define _PPRINT_H_
-
-#define EFI_PRINT_PROTOCOL_GUID \
- { 0xdf2d868e, 0x32fc, 0x4cf0, {0x8e, 0x6b, 0xff, 0xd9, 0x5d, 0x13, 0x43, 0xd0 } }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_PRINT_PROTOCOL EFI_PRINT_PROTOCOL;
-
-
-typedef
-UINTN
-(EFIAPI *EFI_VSPRINT) (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN CONST CHAR16 *FormatString,
- IN VA_LIST Marker
- );
-
-struct _EFI_PRINT_PROTOCOL {
- EFI_VSPRINT VSPrint;
-};
-
-
-extern EFI_GUID gEfiPrintProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/PxeDhcp4.h b/EdkModulePkg/Include/Protocol/PxeDhcp4.h
deleted file mode 100644
index cd4602c..0000000
--- a/EdkModulePkg/Include/Protocol/PxeDhcp4.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- PxeDhcp4.h
-
-Abstract:
- EFI PXE DHCPv4 protocol definition
-
---*/
-
-#ifndef _PXEDHCP4_H_
-#define _PXEDHCP4_H_
-
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-//
-// PXE DHCPv4 GUID definition
-//
-
-#define EFI_PXE_DHCP4_PROTOCOL_GUID \
- { 0x03c4e624, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x29, 0x3f, 0xc1, 0x4d } }
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-//
-// Interface definition
-//
-
-typedef struct _EFI_PXE_DHCP4_PROTOCOL EFI_PXE_DHCP4_PROTOCOL;
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-//
-// Descriptions of the DHCP version 4 header and options can be found
-// in RFC-2131 and RFC-2132 at www.ietf.org
-//
-
-#pragma pack(1)
-typedef struct {
-
- UINT8 op;
-#define BOOTP_REQUEST 1
-#define BOOTP_REPLY 2
-
- UINT8 htype;
-
- UINT8 hlen;
-
- UINT8 hops;
-
- UINT32 xid;
-
- UINT16 secs;
-#define DHCP4_INITIAL_SECONDS 4
-
- UINT16 flags;
-#define DHCP4_BROADCAST_FLAG 0x8000
-
- UINT32 ciaddr;
-
- UINT32 yiaddr;
-
- UINT32 siaddr;
-
- UINT32 giaddr;
-
- UINT8 chaddr[16];
-
- UINT8 sname[64];
-
- UINT8 fname[128];
-
-//
-// This is the minimum option length as specified in RFC-2131.
-// The packet must be padded out this far with DHCP4_PAD.
-// DHCPv4 packets are usually 576 bytes in length. This length
-// includes the IPv4 and UDPv4 headers but not the media header.
-// Note: Not all DHCP relay agents will forward DHCPv4 packets
-// if they are less than 384 bytes or exceed 576 bytes. Even if
-// the underlying hardware can handle smaller and larger packets,
-// many older relay agents will not accept them.
-//
- UINT32 magik;
-#define DHCP4_MAGIK_NUMBER 0x63825363
-
- UINT8 options[308];
-
-} DHCP4_HEADER;
-#pragma pack()
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-//
-// DHCPv4 packet definition. Room for 576 bytes including IP and
-// UDP header.
-//
-
-#define DHCP4_MAX_PACKET_SIZE 576
-#define DHCP4_UDP_HEADER_SIZE 8
-#define DHCP4_IP_HEADER_SIZE 20
-
-#pragma pack(1)
-typedef union _DHCP4_PACKET {
- UINT32 _force_data_alignment;
-
- UINT8 raw[1500];
-
- DHCP4_HEADER dhcp4;
-} DHCP4_PACKET;
-#pragma pack()
-
-#define DHCP4_SERVER_PORT 67
-#define DHCP4_CLIENT_PORT 68
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-//
-// DHCPv4 and PXE option numbers.
-//
-
-#define DHCP4_PAD 0
-#define DHCP4_END 255
-#define DHCP4_SUBNET_MASK 1
-#define DHCP4_TIME_OFFSET 2
-#define DHCP4_ROUTER_LIST 3
-#define DHCP4_TIME_SERVERS 4
-#define DHCP4_NAME_SERVERS 5
-#define DHCP4_DNS_SERVERS 6
-#define DHCP4_LOG_SERVERS 7
-#define DHCP4_COOKIE_SERVERS 8
-#define DHCP4_LPR_SREVERS 9
-#define DHCP4_IMPRESS_SERVERS 10
-#define DHCP4_RESOURCE_LOCATION_SERVERS 11
-#define DHCP4_HOST_NAME 12
-#define DHCP4_BOOT_FILE_SIZE 13
-#define DHCP4_DUMP_FILE 14
-#define DHCP4_DOMAIN_NAME 15
-#define DHCP4_SWAP_SERVER 16
-#define DHCP4_ROOT_PATH 17
-#define DHCP4_EXTENSION_PATH 18
-#define DHCP4_IP_FORWARDING 19
-#define DHCP4_NON_LOCAL_SOURCE_ROUTE 20
-#define DHCP4_POLICY_FILTER 21
-#define DHCP4_MAX_DATAGRAM_SIZE 22
-#define DHCP4_DEFAULT_TTL 23
-#define DHCP4_MTU_AGING_TIMEOUT 24
-#define DHCP4_MTU_SIZES 25
-#define DHCP4_MTU_TO_USE 26
-#define DHCP4_ALL_SUBNETS_LOCAL 27
-#define DHCP4_BROADCAST_ADDRESS 28
-#define DHCP4_PERFORM_MASK_DISCOVERY 29
-#define DHCP4_RESPOND_TO_MASK_REQ 30
-#define DHCP4_PERFORM_ROUTER_DISCOVERY 31
-#define DHCP4_ROUTER_SOLICIT_ADDRESS 32
-#define DHCP4_STATIC_ROUTER_LIST 33
-#define DHCP4_USE_ARP_TRAILERS 34
-#define DHCP4_ARP_CACHE_TIMEOUT 35
-#define DHCP4_ETHERNET_ENCAPSULATION 36
-#define DHCP4_TCP_DEFAULT_TTL 37
-#define DHCP4_TCP_KEEP_ALIVE_INT 38
-#define DHCP4_KEEP_ALIVE_GARBAGE 39
-#define DHCP4_NIS_DOMAIN_NAME 40
-#define DHCP4_NIS_SERVERS 41
-#define DHCP4_NTP_SERVERS 42
-#define DHCP4_VENDOR_SPECIFIC 43
-# define PXE_MTFTP_IP 1
-# define PXE_MTFTP_CPORT 2
-# define PXE_MTFTP_SPORT 3
-# define PXE_MTFTP_TMOUT 4
-# define PXE_MTFTP_DELAY 5
-# define PXE_DISCOVERY_CONTROL 6
-# define PXE_DISABLE_BROADCAST_DISCOVERY 0x01
-# define PXE_DISABLE_MULTICAST_DISCOVERY 0x02
-# define PXE_ACCEPT_ONLY_PXE_BOOT_SERVERS 0x04
-# define PXE_DO_NOT_PROMPT 0x08
-# define PXE_DISCOVERY_MCAST_ADDR 7
-# define PXE_BOOT_SERVERS 8
-# define PXE_BOOT_MENU 9
-# define PXE_BOOT_PROMPT 10
-# define PXE_MCAST_ADDRS_ALLOC 11
-# define PXE_CREDENTIAL_TYPES 12
-# define PXE_BOOT_ITEM 71
-#define DHCP4_NBNS_SERVERS 44
-#define DHCP4_NBDD_SERVERS 45
-#define DHCP4_NETBIOS_NODE_TYPE 46
-#define DHCP4_NETBIOS_SCOPE 47
-#define DHCP4_XWINDOW_SYSTEM_FONT_SERVERS 48
-#define DHCP4_XWINDOW_SYSTEM_DISPLAY_MANAGERS 49
-#define DHCP4_REQUESTED_IP_ADDRESS 50
-#define DHCP4_LEASE_TIME 51
-#define DHCP4_OPTION_OVERLOAD 52
-# define DHCP4_OVERLOAD_FNAME 1
-# define DHCP4_OVERLOAD_SNAME 2
-# define DHCP4_OVERLOAD_FNAME_AND_SNAME 3
-#define DHCP4_MESSAGE_TYPE 53
-# define DHCP4_MESSAGE_TYPE_DISCOVER 1
-# define DHCP4_MESSAGE_TYPE_OFFER 2
-# define DHCP4_MESSAGE_TYPE_REQUEST 3
-# define DHCP4_MESSAGE_TYPE_DECLINE 4
-# define DHCP4_MESSAGE_TYPE_ACK 5
-# define DHCP4_MESSAGE_TYPE_NAK 6
-# define DHCP4_MESSAGE_TYPE_RELEASE 7
-# define DHCP4_MESSAGE_TYPE_INFORM 8
-#define DHCP4_SERVER_IDENTIFIER 54
-#define DHCP4_PARAMETER_REQUEST_LIST 55
-#define DHCP4_ERROR_MESSAGE 56
-#define DHCP4_MAX_MESSAGE_SIZE 57
-# define DHCP4_DEFAULT_MAX_MESSAGE_SIZE 576
-#define DHCP4_RENEWAL_TIME 58
-#define DHCP4_REBINDING_TIME 59
-#define DHCP4_CLASS_IDENTIFIER 60
-#define DHCP4_CLIENT_IDENTIFIER 61
-#define DHCP4_NISPLUS_DOMAIN_NAME 64
-#define DHCP4_NISPLUS_SERVERS 65
-#define DHCP4_TFTP_SERVER_NAME 66
-#define DHCP4_BOOTFILE 67
-#define DHCP4_MOBILE_IP_HOME_AGENTS 68
-#define DHCP4_SMPT_SERVERS 69
-#define DHCP4_POP3_SERVERS 70
-#define DHCP4_NNTP_SERVERS 71
-#define DHCP4_WWW_SERVERS 72
-#define DHCP4_FINGER_SERVERS 73
-#define DHCP4_IRC_SERVERS 74
-#define DHCP4_STREET_TALK_SERVERS 75
-#define DHCP4_STREET_TALK_DIR_ASSIST_SERVERS 76
-#define DHCP4_NDS_SERVERS 85
-#define DHCP4_NDS_TREE_NAME 86
-#define DHCP4_NDS_CONTEXT 87
-#define DHCP4_SYSTEM_ARCHITECTURE 93
-#define DHCP4_NETWORK_ARCHITECTURE 94
-#define DHCP4_PLATFORM_ID 97
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-//
-// DHCP4 option format.
-//
-
-#pragma pack(1)
-typedef struct {
- UINT8 op;
- UINT8 len;
- UINT8 data[1];
-} DHCP4_OP;
-#pragma pack()
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-typedef struct {
- DHCP4_PACKET Discover;
- DHCP4_PACKET Offer;
- DHCP4_PACKET Request;
- DHCP4_PACKET AckNak;
- BOOLEAN SetupCompleted;
- BOOLEAN InitCompleted;
- BOOLEAN SelectCompleted;
- BOOLEAN IsBootp;
- BOOLEAN IsAck;
-} EFI_PXE_DHCP4_DATA;
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PXE_DHCP4_RUN) (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN OPTIONAL UINTN OpLen,
- IN OPTIONAL VOID *OpList
- );
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PXE_DHCP4_SETUP) (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN OPTIONAL EFI_PXE_DHCP4_DATA * NewData
- );
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PXE_DHCP4_INIT) (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN SecondsTimeout,
- OUT UINTN *Offers,
- OUT DHCP4_PACKET **OfferList
- );
-
-#define DHCP4_MIN_SECONDS 1
-#define DHCP4_MAX_SECONDS 60
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PXE_DHCP4_SELECT) (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN SecondsTimeout,
- IN DHCP4_PACKET * offer
- );
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PXE_DHCP4_RENEW) (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- UINTN seconds_timeout
- );
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PXE_DHCP4_REBIND) (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- UINTN seconds_timeout
- );
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-typedef
-EFI_STATUS
-(EFIAPI *EFI_PXE_DHCP4_RELEASE) (
- IN EFI_PXE_DHCP4_PROTOCOL * This
- );
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-#define EFI_PXE_DHCP4_PROTOCOL_REVISION 0x00010000
-
-struct _EFI_PXE_DHCP4_PROTOCOL {
- UINT64 Revision;
- EFI_PXE_DHCP4_RUN Run;
- EFI_PXE_DHCP4_SETUP Setup;
- EFI_PXE_DHCP4_INIT Init;
- EFI_PXE_DHCP4_SELECT Select;
- EFI_PXE_DHCP4_RENEW Renew;
- EFI_PXE_DHCP4_REBIND Rebind;
- EFI_PXE_DHCP4_RELEASE Release;
- EFI_PXE_DHCP4_DATA *Data;
-};
-
-//
-//
-//
-
-extern EFI_GUID gEfiPxeDhcp4ProtocolGuid;
-
-#endif /* _PXEDHCP4_H_ */
-/* EOF - PxeDhcp4.h */
diff --git a/EdkModulePkg/Include/Protocol/PxeDhcp4CallBack.h b/EdkModulePkg/Include/Protocol/PxeDhcp4CallBack.h
deleted file mode 100644
index aa2b89a..0000000
--- a/EdkModulePkg/Include/Protocol/PxeDhcp4CallBack.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- PxeDhcp4Callback.h
-
-Abstract:
- EFI PXE DHCP4 Callback protocol definition.
-
---*/
-
-#ifndef _PXE_DHCP4CALLBACK_H
-#define _PXE_DHCP4CALLBACK_H
-
-#include <Protocol/PxeDhcp4.h>
-//
-// GUID definition
-//
-
-#define EFI_PXE_DHCP4_CALLBACK_PROTOCOL_GUID \
-{ 0xc1544c01, 0x92a4, 0x4198, {0x8a, 0x84, 0x77, 0x85, 0x83, 0xc2, 0x36, 0x21 } }
-
-
-//
-// Revision number
-//
-
-#define EFI_PXE_DHCP4_CALLBACK_INTERFACE_REVISION 0x00010000
-
-//
-// Interface definition
-//
-
-typedef struct _EFI_PXE_DHCP4_CALLBACK_PROTOCOL EFI_PXE_DHCP4_CALLBACK_PROTOCOL;
-
-typedef enum {
- EFI_PXE_DHCP4_FUNCTION_FIRST,
- EFI_PXE_DHCP4_FUNCTION_INIT,
- EFI_PXE_DHCP4_FUNCTION_SELECT,
- EFI_PXE_DHCP4_FUNCTION_RENEW,
- EFI_PXE_DHCP4_FUNCTION_REBIND,
- EFI_PXE_DHCP4_FUNCTION_LAST
-} EFI_PXE_DHCP4_FUNCTION;
-
-typedef enum {
- EFI_PXE_DHCP4_CALLBACK_STATUS_FIRST,
- EFI_PXE_DHCP4_CALLBACK_STATUS_ABORT,
- EFI_PXE_DHCP4_CALLBACK_STATUS_IGNORE_ABORT,
- EFI_PXE_DHCP4_CALLBACK_STATUS_KEEP_ABORT,
- EFI_PXE_DHCP4_CALLBACK_STATUS_CONTINUE,
- EFI_PXE_DHCP4_CALLBACK_STATUS_IGNORE_CONTINUE,
- EFI_PXE_DHCP4_CALLBACK_STATUS_KEEP_CONTINUE,
- EFI_PXE_DHCP4_CALLBACK_STATUS_LAST
-} EFI_PXE_DHCP4_CALLBACK_STATUS;
-
-typedef
-EFI_PXE_DHCP4_CALLBACK_STATUS
-(EFIAPI *EFI_PXE_DHCP4_CALLBACK) (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN EFI_PXE_DHCP4_FUNCTION Function,
- IN UINT32 PacketLen,
- IN DHCP4_PACKET *Packet OPTIONAL
- );
-
-struct _EFI_PXE_DHCP4_CALLBACK_PROTOCOL {
- UINT64 Revision;
- EFI_PXE_DHCP4_CALLBACK Callback;
-};
-
-//
-// GUID declaration
-//
-
-extern EFI_GUID gEfiPxeDhcp4CallbackProtocolGuid;
-
-#endif /* _PXE_DHCP4CALLBACK_H */
-/* EOF - PxeDhcp4Callback.h */
diff --git a/EdkModulePkg/Include/Protocol/ScsiIo.h b/EdkModulePkg/Include/Protocol/ScsiIo.h
deleted file mode 100644
index 1b0bbbf..0000000
--- a/EdkModulePkg/Include/Protocol/ScsiIo.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ScsiIo.h
-
-Abstract:
-
- SCSI I/O protocol.
-
---*/
-
-#ifndef __SCSI_IO_H__
-#define __SCSI_IO_H__
-
-#define EFI_SCSI_IO_PROTOCOL_GUID \
- { 0x403cd195, 0xf233, 0x48ec, {0x84, 0x55, 0xb2, 0xe5, 0x2f, 0x1d, 0x9e, 0x2 } }
-
-//
-// Forward reference for pure ANSI compatability
-//
-typedef struct _EFI_SCSI_IO_PROTOCOL EFI_SCSI_IO_PROTOCOL;
-
-//
-// SCSI Host Adapter Status definition
-//
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OK 0x00
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND 0x09 // timeout when processing the command
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_TIMEOUT 0x0b // timeout when waiting for the command processing
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_MESSAGE_REJECT 0x0d // a message reject was received when processing command
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_RESET 0x0e // a bus reset was detected
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PARITY_ERROR 0x0f
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED 0x10 // the adapter failed in issuing request sense command
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT 0x11 // selection timeout
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN 0x12 // data overrun or data underrun
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_BUS_FREE 0x13 // Unexepected bus free
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_PHASE_ERROR 0x14 // Target bus phase sequence failure
-#define EFI_SCSI_IO_STATUS_HOST_ADAPTER_OTHER 0x7f
-
-
-//
-// SCSI Target Status definition
-//
-#define EFI_SCSI_IO_STATUS_TARGET_GOOD 0x00
-#define EFI_SCSI_IO_STATUS_TARGET_CHECK_CONDITION 0x02 // check condition
-#define EFI_SCSI_IO_STATUS_TARGET_CONDITION_MET 0x04 // condition met
-#define EFI_SCSI_IO_STATUS_TARGET_BUSY 0x08 // busy
-#define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE 0x10 // intermediate
-#define EFI_SCSI_IO_STATUS_TARGET_INTERMEDIATE_CONDITION_MET 0x14 // intermediate-condition met
-#define EFI_SCSI_IO_STATUS_TARGET_RESERVATION_CONFLICT 0x18 // reservation conflict
-#define EFI_SCSI_IO_STATUS_TARGET_COMMOND_TERMINATED 0x22 // command terminated
-#define EFI_SCSI_IO_STATUS_TARGET_QUEUE_FULL 0x28 // queue full
-
-typedef struct {
- UINT64 Timeout;
- VOID *DataBuffer;
- VOID *SenseData;
- VOID *Cdb;
- UINT32 TransferLength;
- UINT8 CdbLength;
- UINT8 DataDirection;
- UINT8 HostAdapterStatus;
- UINT8 TargetStatus;
- UINT8 SenseDataLength;
-}EFI_SCSI_IO_SCSI_REQUEST_PACKET;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE) (
- IN EFI_SCSI_IO_PROTOCOL *This,
- OUT UINT8 *DeviceType
- )
-/*++
-
- Routine Description:
- Retrieves the device type information of the SCSI Controller.
-
- Arguments:
- This - Protocol instance pointer.
- DeviceType - A pointer to the device type information
- retrieved from the SCSI Controller.
-
- Returns:
- EFI_SUCCESS - Retrieves the device type information successfully.
- EFI_INVALID_PARAMETER - The DeviceType is NULL.
---*/
-;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION) (
- IN EFI_SCSI_IO_PROTOCOL *This,
- OUT UINT32 *Target,
- OUT UINT64 *Lun
- )
-/*++
- Routine Description:
- Retrieves the device location in the SCSI channel.
-
- Arguments:
- This - Protocol instance pointer.
- Target - A pointer to the Target ID of a SCSI device
- on the SCSI channel.
- Lun - A pointer to the LUN of the SCSI device on
- the SCSI channel.
-
- Returns:
- EFI_SUCCESS - Retrieves the device location successfully.
- EFI_INVALID_PARAMETER - The Target or Lun is NULL.
---*/
-;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_BUS) (
- IN EFI_SCSI_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Resets the SCSI Bus that the SCSI Controller is attached to.
-
- Arguments:
- This - Protocol instance pointer.
-
- Returns:
- EFI_SUCCESS - The SCSI bus is reset successfully.
- EFI_DEVICE_ERROR - Errors encountered when resetting the SCSI bus.
- EFI_UNSUPPORTED - The bus reset operation is not supported by the
- SCSI Host Controller.
- EFI_TIMEOUT - A timeout occurred while attempting to reset
- the SCSI bus.
---*/
-;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SCSI_IO_PROTOCOL_RESET_DEVICE) (
- IN EFI_SCSI_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Resets the SCSI Controller that the device handle specifies.
-
- Arguments:
- This - Protocol instance pointer.
-
-
- Returns:
- EFI_SUCCESS - Reset the SCSI controller successfully.
- EFI_DEVICE_ERROR - Errors are encountered when resetting the
- SCSI Controller.
- EFI_UNSUPPORTED - The SCSI bus does not support a device
- reset operation.
- EFI_TIMEOUT - A timeout occurred while attempting to
- reset the SCSI Controller.
---*/
-;
-
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_CMD) (
- IN EFI_SCSI_IO_PROTOCOL *This,
- IN OUT EFI_SCSI_IO_SCSI_REQUEST_PACKET *Packet,
- IN EFI_EVENT Event OPTIONAL
- )
-/*++
-
- Routine Description:
- Sends a SCSI Request Packet to the SCSI Controller for execution.
-
- Arguments:
- This - Protocol instance pointer.
- Packet - The SCSI request packet to send to the SCSI
- Controller specified by the device handle.
- Event - If the SCSI bus where the SCSI device is attached
- does not support non-blocking I/O, then Event is
- ignored, and blocking I/O is performed.
- If Event is NULL, then blocking I/O is performed.
- If Event is not NULL and non-blocking I/O is
- supported, then non-blocking I/O is performed,
- and Event will be signaled when the SCSI Request
- Packet completes.
- Returns:
- EFI_SUCCESS - The SCSI Request Packet was sent by the host
- successfully, and TransferLength bytes were
- transferred to/from DataBuffer.See
- HostAdapterStatus, TargetStatus,
- SenseDataLength, and SenseData in that order
- for additional status information.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength. See HostAdapterStatus,
- TargetStatus, SenseDataLength, and SenseData in
- that order for additional status information.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.The caller may retry again later.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet. See HostAdapterStatus,
- TargetStatus, SenseDataLength, and SenseData in
- that order for additional status information.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- The SCSI Request Packet was not sent, so no
- additional status information is available.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller). The SCSI Request Packet was not
- sent, so no additional status information is
- available.
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute. See HostAdapterStatus,
- TargetStatus, SenseDataLength, and SenseData in
- that order for additional status information.
---*/
-;
-
-struct _EFI_SCSI_IO_PROTOCOL {
- EFI_SCSI_IO_PROTOCOL_GET_DEVICE_TYPE GetDeviceType;
- EFI_SCSI_IO_PROTOCOL_GET_DEVICE_LOCATION GetDeviceLocation;
- EFI_SCSI_IO_PROTOCOL_RESET_BUS ResetBus;
- EFI_SCSI_IO_PROTOCOL_RESET_DEVICE ResetDevice;
- EFI_SCSI_IO_PROTOCOL_EXEC_SCSI_CMD ExecuteSCSICommand;
-};
-
-extern EFI_GUID gEfiScsiIoProtocolGuid;
-
-#endif
-
diff --git a/EdkModulePkg/Include/Protocol/UgaIo.h b/EdkModulePkg/Include/Protocol/UgaIo.h
deleted file mode 100644
index 561dafd..0000000
--- a/EdkModulePkg/Include/Protocol/UgaIo.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UgaIo.h
-
-Abstract:
-
- UGA IO protocol from the EFI 1.1 specification.
-
- Abstraction of a very simple graphics device.
-
---*/
-
-#ifndef __UGA_IO_H__
-#define __UGA_IO_H__
-
-#define EFI_UGA_IO_PROTOCOL_GUID \
- { \
- 0x61a4d49e, 0x6f68, 0x4f1b, { 0xb9, 0x22, 0xa8, 0x6e, 0xed, 0xb, 0x7, 0xa2 } \
- }
-
-typedef struct _EFI_UGA_IO_PROTOCOL EFI_UGA_IO_PROTOCOL;
-
-typedef UINT32 UGA_STATUS;
-
-typedef enum {
- UgaDtParentBus = 1,
- UgaDtGraphicsController,
- UgaDtOutputController,
- UgaDtOutputPort,
- UgaDtOther
-}
-UGA_DEVICE_TYPE, *PUGA_DEVICE_TYPE;
-
-typedef UINT32 UGA_DEVICE_ID, *PUGA_DEVICE_ID;
-
-typedef struct {
- UGA_DEVICE_TYPE deviceType;
- UGA_DEVICE_ID deviceId;
- UINT32 ui32DeviceContextSize;
- UINT32 ui32SharedContextSize;
-}
-UGA_DEVICE_DATA, *PUGA_DEVICE_DATA;
-
-typedef struct _UGA_DEVICE {
- VOID *pvDeviceContext;
- VOID *pvSharedContext;
- VOID *pvRunTimeContext;
- struct _UGA_DEVICE *pParentDevice;
- VOID *pvBusIoServices;
- VOID *pvStdIoServices;
- UGA_DEVICE_DATA deviceData;
-}
-UGA_DEVICE, *PUGA_DEVICE;
-
-//
-// Prevent conflicts with UGA typedefs.
-//
-typedef enum {
- UgaIoGetVersion = 1,
- UgaIoGetChildDevice,
- UgaIoStartDevice,
- UgaIoStopDevice,
- UgaIoFlushDevice,
- UgaIoResetDevice,
- UgaIoGetDeviceState,
- UgaIoSetDeviceState,
- UgaIoSetPowerState,
- UgaIoGetMemoryConfiguration,
- UgaIoSetVideoMode,
- UgaIoCopyRectangle,
- UgaIoGetEdidSegment,
- UgaIoDeviceChannelOpen,
- UgaIoDeviceChannelClose,
- UgaIoDeviceChannelRead,
- UgaIoDeviceChannelWrite,
- UgaIoGetPersistentDataSize,
- UgaIoGetPersistentData,
- UgaIoSetPersistentData,
- UgaIoGetDevicePropertySize,
- UgaIoGetDeviceProperty,
- UgaIoBtPrivateInterface
-}
-UGA_IO_REQUEST_CODE, *PUGA_IO_REQUEST_CODE;
-
-typedef struct {
- IN UGA_IO_REQUEST_CODE ioRequestCode;
- IN VOID *pvInBuffer;
- IN UINT64 ui64InBufferSize;
- OUT VOID *pvOutBuffer;
- IN UINT64 ui64OutBufferSize;
- OUT UINT64 ui64BytesReturned;
-}
-UGA_IO_REQUEST, *PUGA_IO_REQUEST;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_UGA_IO_PROTOCOL_CREATE_DEVICE) (
- IN EFI_UGA_IO_PROTOCOL * This,
- IN UGA_DEVICE * ParentDevice,
- IN UGA_DEVICE_DATA * DeviceData,
- IN VOID *RunTimeContext,
- OUT UGA_DEVICE **Device
- );
-
-/*++
-
- Routine Description:
-
- Dynamically allocate storage for a child UGA_DEVICE .
-
- Arguments:
-
- This - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is
- defined in Section 10.7.
-
- ParentDevice - ParentDevice specifies a pointer to the parent device of Device.
-
- DeviceData - A pointer to UGA_DEVICE_DATA returned from a call to DispatchService()
- with a UGA_DEVICE of Parent and an IoRequest of type UgaIoGetChildDevice.
-
- RuntimeContext - Context to associate with Device.
-
- Device - The Device returns a dynamically allocated child UGA_DEVICE object
- for ParentDevice. The caller is responsible for deleting Device.
-
- Returns:
-
- EFI_SUCCESS - Device was returned.
-
- EFI_INVALID_PARAMETER - One of the arguments was not valid.
-
- EFI_DEVICE_ERROR - The device had an error and could not complete the request.
-
---*/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_UGA_IO_PROTOCOL_DELETE_DEVICE) (
- IN EFI_UGA_IO_PROTOCOL * This,
- IN UGA_DEVICE * Device
- );
-
-/*++
-
- Routine Description:
-
- Delete a dynamically allocated child UGA_DEVICE object that was allocated via
- CreateDevice() .
-
- Arguments:
-
- This - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is defined
- in Section 10.7.
-
- Device - The Device points to a UGA_DEVICE object that was dynamically
- allocated via a CreateDevice() call.
-
- Returns:
-
- EFI_SUCCESS - Device was deleted.
-
- EFI_INVALID_PARAMETER - The Device was not allocated via CreateDevice()
-
---*/
-typedef UGA_STATUS (EFIAPI *PUGA_FW_SERVICE_DISPATCH) (IN PUGA_DEVICE pDevice, IN OUT PUGA_IO_REQUEST pIoRequest);
-
-/*++
-
- Routine Description:
-
- This is the main UGA service dispatch routine for all UGA_IO_REQUEST s.
-
- Arguments:
-
- pDevice - pDevice specifies a pointer to a device object associated with a
- device enumerated by a pIoRequest->ioRequestCode of type
- UgaIoGetChildDevice. The root device for the EFI_UGA_IO_PROTOCOL
- is represented by pDevice being set to NULL.
-
- pIoRequest - pIoRequest points to a caller allocated buffer that contains data
- defined by pIoRequest->ioRequestCode. See Related Definitions for
- a definition of UGA_IO_REQUEST_CODE s and their associated data
- structures.
-
- Returns:
-
- Varies depending on pIoRequest.
-
---*/
-struct _EFI_UGA_IO_PROTOCOL {
- EFI_UGA_IO_PROTOCOL_CREATE_DEVICE CreateDevice;
- EFI_UGA_IO_PROTOCOL_DELETE_DEVICE DeleteDevice;
- PUGA_FW_SERVICE_DISPATCH DispatchService;
-};
-
-extern EFI_GUID gEfiUgaIoProtocolGuid;
-
-//
-// Data structure that is stored in the EFI Configuration Table with the
-// EFI_UGA_IO_PROTOCOL_GUID. The option ROMs listed in this table may have
-// EBC UGA drivers.
-//
-typedef struct {
- UINT32 Version;
- UINT32 HeaderSize;
- UINT32 SizeOfEntries;
- UINT32 NumberOfEntries;
-} EFI_DRIVER_OS_HANDOFF_HEADER;
-
-typedef enum {
- EfiUgaDriverFromPciRom,
- EfiUgaDriverFromSystem,
- EfiDriverHandoffMax
-} EFI_DRIVER_HANOFF_ENUM;
-
-typedef struct {
- EFI_DRIVER_HANOFF_ENUM Type;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- VOID *PciRomImage;
- UINT64 PciRomSize;
-} EFI_DRIVER_OS_HANDOFF;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/UgaSplash.h b/EdkModulePkg/Include/Protocol/UgaSplash.h
deleted file mode 100644
index d404985..0000000
--- a/EdkModulePkg/Include/Protocol/UgaSplash.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/**@file
- UGA Splash screen protocol.
-
-Copyright (c) 2006 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __UGA_SPLASH_H__
-#define __UGA_SPLASH_H__
-
-#define EFI_UGA_SPLASH_PROTOCOL_GUID \
- { 0xa45b3a0d, 0x2e55, 0x4c03, {0xad, 0x9c, 0x27, 0xd4, 0x82, 0xb, 0x50, 0x7e } }
-
-typedef struct _EFI_UGA_SPLASH_PROTOCOL {
- UINT32 PixelWidth;
- UINT32 PixelHeight;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Image;
-} EFI_UGA_SPLASH_PROTOCOL;
-
-extern EFI_GUID gEfiUgaSplashProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Include/Protocol/usbatapi.h b/EdkModulePkg/Include/Protocol/usbatapi.h
deleted file mode 100644
index 8801a7a..0000000
--- a/EdkModulePkg/Include/Protocol/usbatapi.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UsbAtapi.h
-
-Abstract:
-
- EFI Atapi Protocol definition.
-
-Revision History
-
---*/
-
-#ifndef _EFI_USB_ATAPI_H
-#define _EFI_USB_ATAPI_H
-
-//
-// Transfer protocol types
-//
-#define BOT 0x50
-#define CBI0 0x00
-#define CBI1 0x01
-
-//
-// SubClass Code (defines command set)
-//
-#define EFI_USB_SUBCLASS_RBC 0x01
-#define EFI_USB_SUBCLASS_ATAPI 0x02
-#define EFI_USB_SUBCLASS_QIC_157 0x03
-#define EFI_USB_SUBCLASS_UFI 0x04
-#define EFI_USB_SUBCLASS_SFF_8070i 0x05
-#define EFI_USB_SUBCLASS_SCSI 0x06
-#define EFI_USB_SUBCLASS_RESERVED_LOW 0x07
-#define EFI_USB_SUBCLASS_RESERVED_HIGH 0xff
-//
-// Global GUID for transfer protocol interface
-//
-#define EFI_USB_ATAPI_PROTOCOL_GUID \
- { 0x2B2F68DA, 0x0CD2, 0x44cf, {0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } }
-
-typedef struct _EFI_USB_ATAPI_PROTOCOL EFI_USB_ATAPI_PROTOCOL;
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_USB_ATAPI_PACKET_CMD) (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN VOID *Command,
- IN UINT8 CommandSize,
- IN VOID *DataBuffer,
- IN UINT32 BufferLength,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT16 TimeOutInMilliSeconds
-);
-
-typedef
-EFI_STATUS
-(EFIAPI *EFI_USB_MASS_STORAGE_RESET) (
- IN EFI_USB_ATAPI_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
-);
-
-//
-// Protocol Interface Structure
-//
-struct _EFI_USB_ATAPI_PROTOCOL {
- EFI_USB_ATAPI_PACKET_CMD UsbAtapiPacketCmd;
- EFI_USB_MASS_STORAGE_RESET UsbAtapiReset;
- UINT32 CommandProtocol;
-};
-
-extern EFI_GUID gEfiUsbAtapiProtocolGuid;
-
-#endif
diff --git a/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.c b/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.c
deleted file mode 100644
index b165f47..0000000
--- a/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BaseCustomDecompressLibNull.c
-
-Abstract:
-
- NULL Custom Decompress Library
-
---*/
-
-RETURN_STATUS
-EFIAPI
-CustomDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-EFIAPI
-CustomDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return RETURN_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.msa b/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.msa
deleted file mode 100644
index f224cab..0000000
--- a/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.msa
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>BaseCustomDecompressLibNull</ModuleName>
- <ModuleType>BASE</ModuleType>
- <GuidValue>e5566134-c75e-4ace-bad1-e23a3b335e30</GuidValue>
- <Version>1.0</Version>
- <Abstract>Base Custom Decompression Library</Abstract>
- <Description>Customer Decompress Library with NULL implementation.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>BaseCustomDecompressLibNull</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>CustomDecompressLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>BaseCustomDecompressLibNull.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.c b/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.c
deleted file mode 100644
index 3d3fc4c..0000000
--- a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.c
+++ /dev/null
@@ -1,840 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BaseUefiTianoDecompressLib.c
-
-Abstract:
-
- UEFI and Tiano Decompress Library
-
---*/
-
-#include "BaseUefiTianoDecompressLibInternals.h"
-
-VOID
-FillBuf (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfBits
- )
-/*++
-
-Routine Description:
-
- Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
-
-Arguments:
-
- Sd - The global scratch data
- NumOfBits - The number of bits to shift and read.
-
-Returns: (VOID)
-
---*/
-{
- Sd->mBitBuf = (UINT32) (Sd->mBitBuf << NumOfBits);
-
- while (NumOfBits > Sd->mBitCount) {
-
- Sd->mBitBuf |= (UINT32) (Sd->mSubBitBuf << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));
-
- if (Sd->mCompSize > 0) {
- //
- // Get 1 byte into SubBitBuf
- //
- Sd->mCompSize--;
- Sd->mSubBitBuf = 0;
- Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++];
- Sd->mBitCount = 8;
-
- } else {
- //
- // No more bits from the source, just pad zero bit.
- //
- Sd->mSubBitBuf = 0;
- Sd->mBitCount = 8;
-
- }
- }
-
- Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);
- Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
-}
-
-UINT32
-GetBits (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfBits
- )
-/*++
-
-Routine Description:
-
- Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
- NumOfBits of bits from source. Returns NumOfBits of bits that are
- popped out.
-
-Arguments:
-
- Sd - The global scratch data.
- NumOfBits - The number of bits to pop and read.
-
-Returns:
-
- The bits that are popped out.
-
---*/
-{
- UINT32 OutBits;
-
- OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
-
- FillBuf (Sd, NumOfBits);
-
- return OutBits;
-}
-
-UINT16
-MakeTable (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfChar,
- IN UINT8 *BitLen,
- IN UINT16 TableBits,
- OUT UINT16 *Table
- )
-/*++
-
-Routine Description:
-
- Creates Huffman Code mapping table according to code length array.
-
-Arguments:
-
- Sd - The global scratch data
- NumOfChar - Number of symbols in the symbol set
- BitLen - Code length array
- TableBits - The width of the mapping table
- Table - The table
-
-Returns:
-
- 0 - OK.
- BAD_TABLE - The table is corrupted.
-
---*/
-{
- UINT16 Count[17];
- UINT16 Weight[17];
- UINT16 Start[18];
- UINT16 *Pointer;
- UINT16 Index3;
- volatile UINT16 Index;
- UINT16 Len;
- UINT16 Char;
- UINT16 JuBits;
- UINT16 Avail;
- UINT16 NextCode;
- UINT16 Mask;
- UINT16 WordOfStart;
- UINT16 WordOfCount;
-
- for (Index = 1; Index <= 16; Index++) {
- Count[Index] = 0;
- }
-
- for (Index = 0; Index < NumOfChar; Index++) {
- Count[BitLen[Index]]++;
- }
-
- Start[1] = 0;
-
- for (Index = 1; Index <= 16; Index++) {
- WordOfStart = Start[Index];
- WordOfCount = Count[Index];
- Start[Index + 1] = (UINT16) (WordOfStart + (WordOfCount << (16 - Index)));
- }
-
- if (Start[17] != 0) {
- /*(1U << 16)*/
- return (UINT16) BAD_TABLE;
- }
-
- JuBits = (UINT16) (16 - TableBits);
-
- for (Index = 1; Index <= TableBits; Index++) {
- Start[Index] >>= JuBits;
- Weight[Index] = (UINT16) (1U << (TableBits - Index));
- }
-
- while (Index <= 16) {
- Weight[Index] = (UINT16) (1U << (16 - Index));
- Index++;
- }
-
- Index = (UINT16) (Start[TableBits + 1] >> JuBits);
-
- if (Index != 0) {
- Index3 = (UINT16) (1U << TableBits);
- while (Index != Index3) {
- Table[Index++] = 0;
- }
- }
-
- Avail = NumOfChar;
- Mask = (UINT16) (1U << (15 - TableBits));
-
- for (Char = 0; Char < NumOfChar; Char++) {
-
- Len = BitLen[Char];
- if (Len == 0) {
- continue;
- }
-
- NextCode = (UINT16) (Start[Len] + Weight[Len]);
-
- if (Len <= TableBits) {
-
- for (Index = Start[Len]; Index < NextCode; Index++) {
- Table[Index] = Char;
- }
-
- } else {
-
- Index3 = Start[Len];
- Pointer = &Table[Index3 >> JuBits];
- Index = (UINT16) (Len - TableBits);
-
- while (Index != 0) {
- if (*Pointer == 0) {
- Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
- *Pointer = Avail++;
- }
-
- if (Index3 & Mask) {
- Pointer = &Sd->mRight[*Pointer];
- } else {
- Pointer = &Sd->mLeft[*Pointer];
- }
-
- Index3 <<= 1;
- Index--;
- }
-
- *Pointer = Char;
-
- }
-
- Start[Len] = NextCode;
- }
- //
- // Succeeds
- //
- return 0;
-}
-
-UINT32
-DecodeP (
- IN SCRATCH_DATA *Sd
- )
-/*++
-
-Routine Description:
-
- Decodes a position value.
-
-Arguments:
-
- Sd - the global scratch data
-
-Returns:
-
- The position value decoded.
-
---*/
-{
- UINT16 Val;
- UINT32 Mask;
- UINT32 Pos;
-
- Val = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
-
- if (Val >= MAXNP) {
- Mask = 1U << (BITBUFSIZ - 1 - 8);
-
- do {
-
- if (Sd->mBitBuf & Mask) {
- Val = Sd->mRight[Val];
- } else {
- Val = Sd->mLeft[Val];
- }
-
- Mask >>= 1;
- } while (Val >= MAXNP);
- }
- //
- // Advance what we have read
- //
- FillBuf (Sd, Sd->mPTLen[Val]);
-
- Pos = Val;
- if (Val > 1) {
- Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1)));
- }
-
- return Pos;
-}
-
-UINT16
-ReadPTLen (
- IN SCRATCH_DATA *Sd,
- IN UINT16 nn,
- IN UINT16 nbit,
- IN UINT16 Special
- )
-/*++
-
-Routine Description:
-
- Reads code lengths for the Extra Set or the Position Set
-
-Arguments:
-
- Sd - The global scratch data
- nn - Number of symbols
- nbit - Number of bits needed to represent nn
- Special - The special symbol that needs to be taken care of
-
-Returns:
-
- 0 - OK.
- BAD_TABLE - Table is corrupted.
-
---*/
-{
- UINT16 Number;
- UINT16 CharC;
- volatile UINT16 Index;
- UINT32 Mask;
-
- Number = (UINT16) GetBits (Sd, nbit);
-
- if (Number == 0) {
- CharC = (UINT16) GetBits (Sd, nbit);
-
- for (Index = 0; Index < 256; Index++) {
- Sd->mPTTable[Index] = CharC;
- }
-
- for (Index = 0; Index < nn; Index++) {
- Sd->mPTLen[Index] = 0;
- }
-
- return 0;
- }
-
- Index = 0;
-
- while (Index < Number) {
-
- CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3));
-
- if (CharC == 7) {
- Mask = 1U << (BITBUFSIZ - 1 - 3);
- while (Mask & Sd->mBitBuf) {
- Mask >>= 1;
- CharC += 1;
- }
- }
-
- FillBuf (Sd, (UINT16) ((CharC < 7) ? 3 : CharC - 3));
-
- Sd->mPTLen[Index++] = (UINT8) CharC;
-
- if (Index == Special) {
- CharC = (UINT16) GetBits (Sd, 2);
- while ((INT16) (--CharC) >= 0) {
- Sd->mPTLen[Index++] = 0;
- }
- }
- }
-
- while (Index < nn) {
- Sd->mPTLen[Index++] = 0;
- }
-
- return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
-}
-
-VOID
-ReadCLen (
- SCRATCH_DATA *Sd
- )
-/*++
-
-Routine Description:
-
- Reads code lengths for Char&Len Set.
-
-Arguments:
-
- Sd - the global scratch data
-
-Returns: (VOID)
-
---*/
-{
- UINT16 Number;
- UINT16 CharC;
- volatile UINT16 Index;
- UINT32 Mask;
-
- Number = (UINT16) GetBits (Sd, CBIT);
-
- if (Number == 0) {
- CharC = (UINT16) GetBits (Sd, CBIT);
-
- for (Index = 0; Index < NC; Index++) {
- Sd->mCLen[Index] = 0;
- }
-
- for (Index = 0; Index < 4096; Index++) {
- Sd->mCTable[Index] = CharC;
- }
-
- return ;
- }
-
- Index = 0;
- while (Index < Number) {
-
- CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
- if (CharC >= NT) {
- Mask = 1U << (BITBUFSIZ - 1 - 8);
-
- do {
-
- if (Mask & Sd->mBitBuf) {
- CharC = Sd->mRight[CharC];
- } else {
- CharC = Sd->mLeft[CharC];
- }
-
- Mask >>= 1;
-
- } while (CharC >= NT);
- }
- //
- // Advance what we have read
- //
- FillBuf (Sd, Sd->mPTLen[CharC]);
-
- if (CharC <= 2) {
-
- if (CharC == 0) {
- CharC = 1;
- } else if (CharC == 1) {
- CharC = (UINT16) (GetBits (Sd, 4) + 3);
- } else if (CharC == 2) {
- CharC = (UINT16) (GetBits (Sd, CBIT) + 20);
- }
-
- while ((INT16) (--CharC) >= 0) {
- Sd->mCLen[Index++] = 0;
- }
-
- } else {
-
- Sd->mCLen[Index++] = (UINT8) (CharC - 2);
-
- }
- }
-
- while (Index < NC) {
- Sd->mCLen[Index++] = 0;
- }
-
- MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
-
- return ;
-}
-
-UINT16
-DecodeC (
- SCRATCH_DATA *Sd
- )
-/*++
-
-Routine Description:
-
- Decode a character/length value.
-
-Arguments:
-
- Sd - The global scratch data.
-
-Returns:
-
- The value decoded.
-
---*/
-{
- UINT16 Index2;
- UINT32 Mask;
-
- if (Sd->mBlockSize == 0) {
- //
- // Starting a new block
- //
- Sd->mBlockSize = (UINT16) GetBits (Sd, 16);
- Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3);
- if (Sd->mBadTableFlag != 0) {
- return 0;
- }
-
- ReadCLen (Sd);
-
- Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, Sd->mPBit, (UINT16) (-1));
- if (Sd->mBadTableFlag != 0) {
- return 0;
- }
- }
-
- Sd->mBlockSize--;
- Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)];
-
- if (Index2 >= NC) {
- Mask = 1U << (BITBUFSIZ - 1 - 12);
-
- do {
- if (Sd->mBitBuf & Mask) {
- Index2 = Sd->mRight[Index2];
- } else {
- Index2 = Sd->mLeft[Index2];
- }
-
- Mask >>= 1;
- } while (Index2 >= NC);
- }
- //
- // Advance what we have read
- //
- FillBuf (Sd, Sd->mCLen[Index2]);
-
- return Index2;
-}
-
-VOID
-Decode (
- SCRATCH_DATA *Sd
- )
-/*++
-
-Routine Description:
-
- Decode the source data and put the resulting data into the destination buffer.
-
-Arguments:
-
- Sd - The global scratch data
-
-Returns: (VOID)
-
- --*/
-{
- UINT16 BytesRemain;
- UINT32 DataIdx;
- UINT16 CharC;
-
- BytesRemain = (UINT16) (-1);
-
- DataIdx = 0;
-
- for (;;) {
- CharC = DecodeC (Sd);
- if (Sd->mBadTableFlag != 0) {
- goto Done ;
- }
-
- if (CharC < 256) {
- //
- // Process an Original character
- //
- if (Sd->mOutBuf >= Sd->mOrigSize) {
- goto Done ;
- } else {
- Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
- }
-
- } else {
- //
- // Process a Pointer
- //
- CharC = (UINT16) (CharC - (UINT8_MAX + 1 - THRESHOLD));
-
- BytesRemain = CharC;
-
- DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
-
- BytesRemain--;
- while ((INT16) (BytesRemain) >= 0) {
- Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
- if (Sd->mOutBuf >= Sd->mOrigSize) {
- goto Done ;
- }
-
- BytesRemain--;
- }
- }
- }
-
-Done:
- return ;
-}
-
-RETURN_STATUS
-EFIAPI
-UefiDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- UINT32 CompressedSize;
-
- ASSERT (Source != NULL);
- ASSERT (DestinationSize != NULL);
- ASSERT (ScratchSize != NULL);
-
- *ScratchSize = sizeof (SCRATCH_DATA);
-
- if (SourceSize < 8) {
- return RETURN_INVALID_PARAMETER;
- }
-
- CopyMem (&CompressedSize, Source, sizeof (UINT32));
- CopyMem (DestinationSize, (VOID *)((UINT8 *)Source + 4), sizeof (UINT32));
-
- if (SourceSize < (CompressedSize + 8)) {
- return RETURN_INVALID_PARAMETER;
- }
-
- return RETURN_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-UefiTianoDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch,
- IN UINT32 Version
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
- Version - 1 for UEFI Decompress algoruthm, 2 for Tiano Decompess algorithm
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- volatile UINT32 Index;
- UINT32 CompSize;
- UINT32 OrigSize;
- SCRATCH_DATA *Sd;
- CONST UINT8 *Src;
- UINT8 *Dst;
-
- ASSERT (Source != NULL);
- ASSERT (Destination != NULL);
- ASSERT (Scratch != NULL);
-
- Src = Source;
- Dst = Destination;
-
- Sd = (SCRATCH_DATA *) Scratch;
-
- CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
- OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
-
- //
- // If compressed file size is 0, return
- //
- if (OrigSize == 0) {
- return RETURN_SUCCESS;
- }
-
- Src = Src + 8;
-
- for (Index = 0; Index < sizeof (SCRATCH_DATA); Index++) {
- ((UINT8 *) Sd)[Index] = 0;
- }
- //
- // The length of the field 'Position Set Code Length Array Size' in Block Header.
- // For EFI 1.1 de/compression algorithm(Version 1), mPBit = 4
- // For Tiano de/compression algorithm(Version 2), mPBit = 5
- //
- switch (Version) {
- case 1 :
- Sd->mPBit = 4;
- break;
- case 2 :
- Sd->mPBit = 5;
- break;
- default:
- ASSERT (FALSE);
- }
- Sd->mSrcBase = (UINT8 *)Src;
- Sd->mDstBase = Dst;
- Sd->mCompSize = CompSize;
- Sd->mOrigSize = OrigSize;
-
- //
- // Fill the first BITBUFSIZ bits
- //
- FillBuf (Sd, BITBUFSIZ);
-
- //
- // Decompress it
- //
- Decode (Sd);
-
- if (Sd->mBadTableFlag != 0) {
- //
- // Something wrong with the source
- //
- return RETURN_INVALID_PARAMETER;
- }
-
- return RETURN_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-UefiDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return UefiTianoDecompress (Source, Destination, Scratch, 1);
-}
-
-RETURN_STATUS
-EFIAPI
-TianoDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-RETURN_STATUS
-EFIAPI
-TianoDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return UefiTianoDecompress (Source, Destination, Scratch, 2);
-}
diff --git a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.msa b/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.msa
deleted file mode 100644
index eab5f54..0000000
--- a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.msa
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>BaseUefiTianoDecompressLib</ModuleName>
- <ModuleType>BASE</ModuleType>
- <GuidValue>d774c4d9-c121-4da3-a5e2-0f317e3c630c</GuidValue>
- <Version>1.0</Version>
- <Abstract>Uefi Tiano Decomression Library</Abstract>
- <Description>Uefi Decompression library instance</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>BaseUefiTianoDecompressLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>UefiDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>TianoDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>BaseUefiTianoDecompressLib.c</Filename>
- <Filename>BaseUefiTianoDecompressLibInternals.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLibInternals.h b/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLibInternals.h
deleted file mode 100644
index bb7aa5a..0000000
--- a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLibInternals.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/** @file
- Internal include file for Base UEFI Decompress Libary.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: BaseUefiDecompressLibInternals.h
-
-**/
-
-#ifndef __BASE_UEFI_TIANO_DECOMPRESS_LIB_INTERNALS_H__
-#define __BASE_UEFI_TIANO_DECOMPRESS_LIB_INTERNALS_H__
-
-//
-// Decompression algorithm begins here
-//
-#define BITBUFSIZ 32
-#define MAXMATCH 256
-#define THRESHOLD 3
-#define CODE_BIT 16
-#define BAD_TABLE - 1
-
-//
-// C: Char&Len Set; P: Position Set; T: exTra Set
-//
-#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
-#define CBIT 9
-#define MAXPBIT 5
-#define TBIT 5
-#define MAXNP ((1U << MAXPBIT) - 1)
-#define NT (CODE_BIT + 3)
-#if NT > MAXNP
-#define NPT NT
-#else
-#define NPT MAXNP
-#endif
-
-typedef struct {
- UINT8 *mSrcBase; // Starting address of compressed data
- UINT8 *mDstBase; // Starting address of decompressed data
- UINT32 mOutBuf;
- UINT32 mInBuf;
-
- UINT16 mBitCount;
- UINT32 mBitBuf;
- UINT32 mSubBitBuf;
- UINT16 mBlockSize;
- UINT32 mCompSize;
- UINT32 mOrigSize;
-
- UINT16 mBadTableFlag;
-
- UINT16 mLeft[2 * NC - 1];
- UINT16 mRight[2 * NC - 1];
- UINT8 mCLen[NC];
- UINT8 mPTLen[NPT];
- UINT16 mCTable[4096];
- UINT16 mPTTable[256];
-
- //
- // The length of the field 'Position Set Code Length Array Size' in Block Header.
- // For EFI 1.1 de/compression algorithm, mPBit = 4
- // For Tiano de/compression algorithm, mPBit = 5
- //
- UINT8 mPBit;
-} SCRATCH_DATA;
-
-/**
- Read NumOfBit of bits from source into mBitBuf
-
- Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
-
- @param Sd The global scratch data
- @param NumOfBits The number of bits to shift and read.
-
-**/
-VOID
-FillBuf (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfBits
- );
-
-/**
- Get NumOfBits of bits out from mBitBuf
-
- Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
- NumOfBits of bits from source. Returns NumOfBits of bits that are
- popped out.
-
- @param Sd The global scratch data.
- @param NumOfBits The number of bits to pop and read.
-
- @return The bits that are popped out.
-
-**/
-UINT32
-GetBits (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfBits
- );
-
-/**
- Creates Huffman Code mapping table according to code length array.
-
- Creates Huffman Code mapping table for Extra Set, Char&Len Set
- and Position Set according to code length array.
-
- @param Sd The global scratch data
- @param NumOfChar Number of symbols in the symbol set
- @param BitLen Code length array
- @param TableBits The width of the mapping table
- @param Table The table
-
- @retval 0 OK.
- @retval BAD_TABLE The table is corrupted.
-
-**/
-UINT16
-MakeTable (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfChar,
- IN UINT8 *BitLen,
- IN UINT16 TableBits,
- OUT UINT16 *Table
- );
-
-/**
- Decodes a position value.
-
- Get a position value according to Position Huffman Table.
-
- @param Sd the global scratch data
-
- @return The position value decoded.
-
-**/
-UINT32
-DecodeP (
- IN SCRATCH_DATA *Sd
- );
-
-/**
- Reads code lengths for the Extra Set or the Position Set.
-
- Read in the Extra Set or Pointion Set Length Arrary, then
- generate the Huffman code mapping for them.
-
- @param Sd The global scratch data.
- @param nn Number of symbols.
- @param nbit Number of bits needed to represent nn.
- @param Special The special symbol that needs to be taken care of.
-
- @retval 0 OK.
- @retval BAD_TABLE Table is corrupted.
-
-**/
-UINT16
-ReadPTLen (
- IN SCRATCH_DATA *Sd,
- IN UINT16 nn,
- IN UINT16 nbit,
- IN UINT16 Special
- );
-
-/**
- Reads code lengths for Char&Len Set.
-
- Read in and decode the Char&Len Set Code Length Array, then
- generate the Huffman Code mapping table for the Char&Len Set.
-
- @param Sd the global scratch data
-
-**/
-VOID
-ReadCLen (
- SCRATCH_DATA *Sd
- );
-
-/**
- Decode a character/length value.
-
- Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
- Huffman code mapping table for Extra Set, Code&Len Set and
- Position Set.
-
- @param Sd The global scratch data.
-
- @return The value decoded.
-
-**/
-UINT16
-DecodeC (
- SCRATCH_DATA *Sd
- );
-
-/**
- Decode the source data and put the resulting data into the destination buffer.
-
- Decode the source data and put the resulting data into the destination buffer.
-
- @param Sd The global scratch data
-
-**/
-VOID
-Decode (
- SCRATCH_DATA *Sd
- );
-
-RETURN_STATUS
-EFIAPI
-UefiTianoDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch,
- IN UINT32 Version
- );
-
-#endif
diff --git a/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.c b/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.c
deleted file mode 100644
index 8b58cfa..0000000
--- a/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeCoreCustomDecompressLibFromHob.c
-
-Abstract:
-
- Custom Decompress Library from HOBs
-
---*/
-
-static DECOMPRESS_LIBRARY mCustomDecompress;
-
-EFI_STATUS
-EFIAPI
-DxeCoreCustomDecompressLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gEfiCustomizedDecompressProtocolGuid);
- ASSERT (GuidHob != NULL);
- CopyMem (&mCustomDecompress, GET_GUID_HOB_DATA (GuidHob), sizeof (mCustomDecompress));
- return EFI_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-CustomDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mCustomDecompress.GetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-RETURN_STATUS
-EFIAPI
-CustomDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mCustomDecompress.Decompress (Source, Destination, Scratch);
-}
diff --git a/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.msa b/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.msa
deleted file mode 100644
index 59ba0ae..0000000
--- a/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.msa
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeCoreCustomDecompressLibFromHob</ModuleName>
- <ModuleType>DXE_CORE</ModuleType>
- <GuidValue>942e0182-3e1d-47f9-92dc-4939d1a0ba00</GuidValue>
- <Version>1.0</Version>
- <Abstract>Custom Decompress Library from HOBs</Abstract>
- <Description>Instance of Decompress Library, interfaces are retrieved from HOB</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeCoreCustomDecompressLibFromHob</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE">
- <Keyword>CustomDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeCoreCustomDecompressLibFromHob.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiCustomizedDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Hobs>
- <HobTypes HobGuidCName="gEfiCustomizedDecompressProtocolGuid" Usage="ALWAYS_CONSUMED">
- <HobType>GUID_EXTENSION</HobType>
- </HobTypes>
- </Hobs>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>DxeCoreCustomDecompressLibConstructor</Constructor>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
deleted file mode 100644
index 7271332..0000000
--- a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ /dev/null
@@ -1,637 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeCorePerformance.c
-
-Abstract:
-
- Support for measurement of DXE performance
-
---*/
-
-//
-// Interface declarations for Performance Protocol.
-//
-/**
- Adds a record at the end of the performance measurement log
- that records the start time of a performance measurement.
-
- Adds a record to the end of the performance measurement log
- that contains the Handle, Token, and Module.
- The end time of the new record must be set to zero.
- If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
- If TimeStamp is zero, the start time in the record is filled in with the value
- read from the current time stamp.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval EFI_SUCCESS The data was read correctly from the device.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-StartGauge (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- );
-
-/**
- Searches the performance measurement log from the beginning of the log
- for the first matching record that contains a zero end time and fills in a valid end time.
-
- Searches the performance measurement log from the beginning of the log
- for the first record that matches Handle, Token, and Module and has an end time value of zero.
- If the record can not be found then return EFI_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then the end time in the record is filled in with the value specified by TimeStamp.
- If the record is found and TimeStamp is zero, then the end time in the matching record
- is filled in with the current time stamp value.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval EFI_SUCCESS The end of the measurement was recorded.
- @retval EFI_NOT_FOUND The specified measurement record could not be found.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-EndGauge (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- );
-
-/**
- Retrieves a previously logged performance measurement.
-
- Retrieves the performance log entry from the performance log specified by LogEntryKey.
- If it stands for a valid entry, then EFI_SUCCESS is returned and
- GaugeDataEntry stores the pointer to that entry.
-
- @param LogEntryKey The key for the previous performance measurement log entry.
- If 0, then the first performance measurement log entry is retrieved.
- @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey
- if the retrieval is successful.
-
- @retval EFI_SUCCESS The GuageDataEntry is successfuly found based on LogEntryKey.
- @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).
- @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).
- @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-GetGauge (
- IN UINTN LogEntryKey,
- OUT GAUGE_DATA_ENTRY **GaugeDataEntry
- );
-
-//
-// Definition for global variables.
-//
-STATIC GAUGE_DATA_HEADER *mGaugeData;
-STATIC UINT32 mMaxGaugeRecords;
-
-EFI_HANDLE mHandle = NULL;
-PERFORMANCE_PROTOCOL mPerformanceInterface = {
- StartGauge,
- EndGauge,
- GetGauge
- };
-
-
-/**
- Searches in the gauge array with keyword Handle, Token and Module.
-
- This internal function searches for the gauge entry in the gauge array.
- If there is an entry that exactly matches the given key word triple
- and its end time stamp is zero, then the index of that gauge entry is returned;
- otherwise, the the number of gauge entries in the array is returned.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
-
- @retval The index of gauge entry in the array.
-
-**/
-STATIC
-UINT32
-InternalSearchForGaugeEntry (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module OPTIONAL
- )
-{
- UINT32 Index;
- UINT32 NumberOfEntries;
- GAUGE_DATA_ENTRY *GaugeEntryArray;
-
- if (Token == NULL) {
- Token = "";
- }
- if (Module == NULL) {
- Module = "";
- }
-
- NumberOfEntries = mGaugeData->NumberOfEntries;
- GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
-
- for (Index = 0; Index < NumberOfEntries; Index++) {
- if ((GaugeEntryArray[Index].Handle == (EFI_PHYSICAL_ADDRESS) (UINTN) Handle) &&
- AsciiStrnCmp (GaugeEntryArray[Index].Token, Token, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&
- AsciiStrnCmp (GaugeEntryArray[Index].Module, Module, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&
- GaugeEntryArray[Index].EndTimeStamp == 0
- ) {
- break;
- }
- }
-
- return Index;
-}
-
-/**
- Adds a record at the end of the performance measurement log
- that records the start time of a performance measurement.
-
- Adds a record to the end of the performance measurement log
- that contains the Handle, Token, and Module.
- The end time of the new record must be set to zero.
- If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
- If TimeStamp is zero, the start time in the record is filled in with the value
- read from the current time stamp.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval EFI_SUCCESS The data was read correctly from the device.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-StartGauge (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- GAUGE_DATA_ENTRY *GaugeEntryArray;
- UINTN GaugeDataSize;
- UINTN OldGaugeDataSize;
- GAUGE_DATA_HEADER *OldGaugeData;
- UINT32 Index;
-
- Index = mGaugeData->NumberOfEntries;
- if (Index >= mMaxGaugeRecords) {
- //
- // Try to enlarge the scale of gauge arrary.
- //
- OldGaugeData = mGaugeData;
- OldGaugeDataSize = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords;
-
- mMaxGaugeRecords *= 2;
- GaugeDataSize = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords;
-
- mGaugeData = AllocateZeroPool (GaugeDataSize);
- if (mGaugeData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Initialize new data arry and migrate old data one.
- //
- mGaugeData = CopyMem (mGaugeData, OldGaugeData, OldGaugeDataSize);
-
- FreePool (OldGaugeData);
- }
-
- GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
- GaugeEntryArray[Index].Handle = (EFI_PHYSICAL_ADDRESS) (UINTN) Handle;
-
- if (Token != NULL) {
- AsciiStrnCpy (GaugeEntryArray[Index].Token, Token, DXE_PERFORMANCE_STRING_LENGTH);
- }
- if (Module != NULL) {
- AsciiStrnCpy (GaugeEntryArray[Index].Module, Module, DXE_PERFORMANCE_STRING_LENGTH);
- }
-
- if (TimeStamp == 0) {
- TimeStamp = GetPerformanceCounter ();
- }
- GaugeEntryArray[Index].StartTimeStamp = TimeStamp;
-
- mGaugeData->NumberOfEntries++;
-
- return EFI_SUCCESS;
-}
-
-/**
- Searches the performance measurement log from the beginning of the log
- for the first matching record that contains a zero end time and fills in a valid end time.
-
- Searches the performance measurement log from the beginning of the log
- for the first record that matches Handle, Token, and Module and has an end time value of zero.
- If the record can not be found then return EFI_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then the end time in the record is filled in with the value specified by TimeStamp.
- If the record is found and TimeStamp is zero, then the end time in the matching record
- is filled in with the current time stamp value.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval EFI_SUCCESS The end of the measurement was recorded.
- @retval EFI_NOT_FOUND The specified measurement record could not be found.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-EndGauge (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- GAUGE_DATA_ENTRY *GaugeEntryArray;
- UINT32 Index;
-
- if (TimeStamp == 0) {
- TimeStamp = GetPerformanceCounter ();
- }
-
- Index = InternalSearchForGaugeEntry (Handle, Token, Module);
- if (Index >= mGaugeData->NumberOfEntries) {
- return EFI_NOT_FOUND;
- }
- GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
- GaugeEntryArray[Index].EndTimeStamp = TimeStamp;
-
- return EFI_SUCCESS;
-}
-
-/**
- Retrieves a previously logged performance measurement.
-
- Retrieves the performance log entry from the performance log specified by LogEntryKey.
- If it stands for a valid entry, then EFI_SUCCESS is returned and
- GaugeDataEntry stores the pointer to that entry.
-
- @param LogEntryKey The key for the previous performance measurement log entry.
- If 0, then the first performance measurement log entry is retrieved.
- @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey
- if the retrieval is successful.
-
- @retval EFI_SUCCESS The GuageDataEntry is successfuly found based on LogEntryKey.
- @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).
- @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).
- @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-GetGauge (
- IN UINTN LogEntryKey,
- OUT GAUGE_DATA_ENTRY **GaugeDataEntry
- )
-{
- UINTN NumberOfEntries;
- GAUGE_DATA_ENTRY *LogEntryArray;
-
- NumberOfEntries = (UINTN) (mGaugeData->NumberOfEntries);
- if (LogEntryKey > NumberOfEntries) {
- return EFI_INVALID_PARAMETER;
- }
- if (LogEntryKey == NumberOfEntries) {
- return EFI_NOT_FOUND;
- }
-
- LogEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
-
- if (GaugeDataEntry == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *GaugeDataEntry = &LogEntryArray[LogEntryKey];
-
- return EFI_SUCCESS;
-}
-
-/**
- Dumps all the PEI performance log to DXE performance gauge array.
-
- This internal function dumps all the PEI performance log to the DXE performance gauge array.
- It retrieves the optional GUID HOB for PEI performance and then saves the performance data
- to DXE performance data structures.
-
-**/
-STATIC
-VOID
-InternalGetPeiPerformance (
- VOID
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
- PEI_PERFORMANCE_LOG_HEADER *LogHob;
- PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;
- GAUGE_DATA_ENTRY *GaugeEntryArray;
- UINT32 Index;
- UINT32 NumberOfEntries;
-
- NumberOfEntries = 0;
- GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
-
- //
- // Dump PEI Log Entries to DXE Guage Data structure.
- //
- GuidHob = GetFirstGuidHob (&gPeiPerformanceHobGuid);
- if (GuidHob != NULL) {
- LogHob = GET_GUID_HOB_DATA (GuidHob);
- LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (LogHob + 1);
- GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
-
- NumberOfEntries = LogHob->NumberOfEntries;
- for (Index = 0; Index < NumberOfEntries; Index++) {
- GaugeEntryArray[Index].Handle = LogEntryArray[Index].Handle;
- AsciiStrnCpy (GaugeEntryArray[Index].Token, LogEntryArray[Index].Token, DXE_PERFORMANCE_STRING_LENGTH);
- AsciiStrnCpy (GaugeEntryArray[Index].Module, LogEntryArray[Index].Module, DXE_PERFORMANCE_STRING_LENGTH);
- GaugeEntryArray[Index].StartTimeStamp = LogEntryArray[Index].StartTimeStamp;
- GaugeEntryArray[Index].EndTimeStamp = LogEntryArray[Index].EndTimeStamp;
- }
- }
- mGaugeData->NumberOfEntries = NumberOfEntries;
-}
-
-/**
- The constructor function initializes Performance infrastructure for DXE phase.
-
- The constructor function publishes Performance protocol, allocates memory to log DXE performance
- and merges PEI performance data to DXE performance log.
- It will ASSERT() if one of these operations fails and it will always return EFI_SUCCESS.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-DxeCorePerformanceLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- if (!PerformanceMeasurementEnabled ()) {
- //
- // Do not initialize performance infrastructure if not required.
- //
- return EFI_SUCCESS;
- }
- //
- // Install the protocol interfaces.
- //
- Status = gBS->InstallProtocolInterface (
- &mHandle,
- &gPerformanceProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mPerformanceInterface
- );
- ASSERT_EFI_ERROR (Status);
-
- mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 (PcdMaxPeiPerformanceLogEntries);
-
- mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords));
- ASSERT (mGaugeData != NULL);
-
- InternalGetPeiPerformance ();
-
- return Status;
-}
-
-/**
- Adds a record at the end of the performance measurement log
- that records the start time of a performance measurement.
-
- Adds a record to the end of the performance measurement log
- that contains the Handle, Token, and Module.
- The end time of the new record must be set to zero.
- If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
- If TimeStamp is zero, the start time in the record is filled in with the value
- read from the current time stamp.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The start of the measurement was recorded.
- @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-RETURN_STATUS
-EFIAPI
-StartPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- EFI_STATUS Status;
-
- Status = StartGauge (Handle, Token, Module, TimeStamp);
- return (RETURN_STATUS) Status;
-}
-
-/**
- Searches the performance measurement log from the beginning of the log
- for the first matching record that contains a zero end time and fills in a valid end time.
-
- Searches the performance measurement log from the beginning of the log
- for the first record that matches Handle, Token, and Module and has an end time value of zero.
- If the record can not be found then return RETURN_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then the end time in the record is filled in with the value specified by TimeStamp.
- If the record is found and TimeStamp is zero, then the end time in the matching record
- is filled in with the current time stamp value.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The end of the measurement was recorded.
- @retval RETURN_NOT_FOUND The specified measurement record could not be found.
-
-**/
-RETURN_STATUS
-EFIAPI
-EndPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- EFI_STATUS Status;
-
- Status = EndGauge (Handle, Token, Module, TimeStamp);
- return (RETURN_STATUS) Status;
-}
-
-/**
- Attempts to retrieve a performance measurement log entry from the performance measurement log.
-
- Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
- zero on entry, then an attempt is made to retrieve the first entry from the performance log,
- and the key for the second entry in the log is returned. If the performance log is empty,
- then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
- log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
- returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
- retrieved and an implementation specific non-zero key value that specifies the end of the performance
- log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
- is retrieved and zero is returned. In the cases where a performance log entry can be returned,
- the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
- If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
- If Handle is NULL, then ASSERT().
- If Token is NULL, then ASSERT().
- If Module is NULL, then ASSERT().
- If StartTimeStamp is NULL, then ASSERT().
- If EndTimeStamp is NULL, then ASSERT().
-
- @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
- 0, then the first performance measurement log entry is retrieved.
- On exit, the key of the next performance lof entry entry.
- @param Handle Pointer to environment specific context used to identify the component
- being measured.
- @param Token Pointer to a Null-terminated ASCII string that identifies the component
- being measured.
- @param Module Pointer to a Null-terminated ASCII string that identifies the module
- being measured.
- @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was started.
- @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was ended.
-
- @return The key for the next performance log entry (in general case).
-
-**/
-UINTN
-EFIAPI
-GetPerformanceMeasurement (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp
- )
-{
- EFI_STATUS Status;
- GAUGE_DATA_ENTRY *GaugeData;
-
- ASSERT (Handle != NULL);
- ASSERT (Token != NULL);
- ASSERT (Module != NULL);
- ASSERT (StartTimeStamp != NULL);
- ASSERT (EndTimeStamp != NULL);
-
- Status = GetGauge (LogEntryKey++, &GaugeData);
-
- //
- // Make sure that LogEntryKey is a valid log entry key,
- //
- ASSERT (Status != EFI_INVALID_PARAMETER);
-
- if (EFI_ERROR (Status)) {
- //
- // The LogEntryKey is the last entry (equals to the total entry number).
- //
- return 0;
- }
-
- ASSERT (GaugeData != NULL);
-
- *Handle = (VOID *) (UINTN) GaugeData->Handle;
- *Token = GaugeData->Token;
- *Module = GaugeData->Module;
- *StartTimeStamp = GaugeData->StartTimeStamp;
- *EndTimeStamp = GaugeData->EndTimeStamp;
-
- return LogEntryKey;
-}
-
-/**
- Returns TRUE if the performance measurement macros are enabled.
-
- This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set.
- @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-PerformanceMeasurementEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
-}
diff --git a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa
deleted file mode 100644
index 444867a..0000000
--- a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeCorePerformanceLib</ModuleName>
- <ModuleType>DXE_CORE</ModuleType>
- <GuidValue>D0F78BBF-0A30-4c63-8A48-0F618A4AFACD</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for DxeCore Performance Library</Abstract>
- <Description>This library provides intrastructure for DxeCore to log performance.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeCorePerformanceLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>TimerLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeCorePerformanceLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gPerformanceProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gPeiPerformanceHobGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>DxeCorePerformanceLibConstructor</Constructor>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The bitmask of flags that specify the enable/disable of
- Performance Measurement.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdMaxPeiPerformanceLogEntries</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>Maximun number of performance log entries during PEI phase.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.c b/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.c
deleted file mode 100644
index 54f0bc2..0000000
--- a/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeCoreTianoDecompressLibFromHob.c
-
-Abstract:
-
- Tiano Decompress Library from HOBs
-
---*/
-
-static DECOMPRESS_LIBRARY mTianoDecompress;
-
-EFI_STATUS
-EFIAPI
-DxeCoreTianoDecompressLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gEfiTianoDecompressProtocolGuid);
- ASSERT (GuidHob != NULL);
- CopyMem (&mTianoDecompress, GET_GUID_HOB_DATA (GuidHob), sizeof (mTianoDecompress));
- return EFI_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-TianoDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mTianoDecompress.GetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-RETURN_STATUS
-EFIAPI
-TianoDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mTianoDecompress.Decompress (Source, Destination, Scratch);
-}
-
diff --git a/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.msa b/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.msa
deleted file mode 100644
index 4542089..0000000
--- a/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.msa
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeCoreTianoDecompressLibFromHob</ModuleName>
- <ModuleType>DXE_CORE</ModuleType>
- <GuidValue>cef487a1-751d-4fe0-a39b-e6892b4610c8</GuidValue>
- <Version>1.0</Version>
- <Abstract>Tiano Decompress Library from HOBs</Abstract>
- <Description>Instance of Decompress Library, interface is retrieved from HOB.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeCoreTianoDecompressLibFromHob</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>TianoDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeCoreTianoDecompressLibFromHob.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiTianoDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Hobs>
- <HobTypes HobGuidCName="gEfiTianoDecompressProtocolGuid" Usage="ALWAYS_CONSUMED">
- <HobType>GUID_EXTENSION</HobType>
- </HobTypes>
- </Hobs>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>DxeCoreTianoDecompressLibConstructor</Constructor>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.c b/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.c
deleted file mode 100644
index d0bf854..0000000
--- a/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeCoreUefiDecompressLibFromHob.c
-
-Abstract:
-
- UEFI Decompress Library from HOBs
-
---*/
-
-static DECOMPRESS_LIBRARY mEfiDecompress;
-
-EFI_STATUS
-EFIAPI
-DxeCoreUefiDecompressLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gEfiDecompressProtocolGuid);
- ASSERT (GuidHob != NULL);
- CopyMem (&mEfiDecompress, GET_GUID_HOB_DATA (GuidHob), sizeof (mEfiDecompress));
- return EFI_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-UefiDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mEfiDecompress.GetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-RETURN_STATUS
-EFIAPI
-UefiDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mEfiDecompress.Decompress (Source, Destination, Scratch);
-}
diff --git a/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.msa b/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.msa
deleted file mode 100644
index d137496..0000000
--- a/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.msa
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeCoreUefiDecompressLibFromHob</ModuleName>
- <ModuleType>DXE_CORE</ModuleType>
- <GuidValue>5c12c06f-5cf8-48a6-9860-6c5b2c036bbf</GuidValue>
- <Version>1.0</Version>
- <Abstract>UEFI Decompress Library from HOBs</Abstract>
- <Description>Instance of Decompression library based on EFI_DECOMPRESS_PROTOCOL_GUID'ed HOB</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeCoreUefiDecompressLibFromHob</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>UefiDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeCoreUefiDecompressLibFromHob.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Hobs>
- <HobTypes HobGuidCName="gEfiDecompressProtocolGuid" Usage="ALWAYS_CONSUMED">
- <HobType>GUID_EXTENSION</HobType>
- </HobTypes>
- </Hobs>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>DxeCoreUefiDecompressLibConstructor</Constructor>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/DxeDebugLibSerialPort/DebugLib.c b/EdkModulePkg/Library/DxeDebugLibSerialPort/DebugLib.c
deleted file mode 100644
index cf3ac78..0000000
--- a/EdkModulePkg/Library/DxeDebugLibSerialPort/DebugLib.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/** @file
- UEFI Debug Library that uses PrintLib to send messages to CONOUT.
-
- Copyright (c) 2006, Intel Corporation<BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-//
-// Define the maximum debug and assert message length that this library supports
-//
-#define MAX_DEBUG_MESSAGE_LENGTH 0x100
-
-
-/**
-
- Prints a debug message to the debug output device if the specified error level is enabled.
-
- If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print
- the message specified by Format and the associated variable argument list to
- the debug output device.
-
- If Format is NULL, then ASSERT().
-
- @param ErrorLevel The error level of the debug message.
- @param Format Format string for the debug message to print.
-
-**/
-VOID
-EFIAPI
-DebugPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- ...
- )
-{
- CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
- VA_LIST Marker;
-
- //
- // If Format is NULL, then ASSERT().
- //
- ASSERT (Format != NULL);
-
- //
- // Check driver debug mask value and global mask
- //
- if ((ErrorLevel & PcdGet32(PcdDebugPrintErrorLevel)) == 0) {
- return;
- }
-
- //
- // Convert the DEBUG() message to an ASCII String
- //
- VA_START (Marker, Format);
- AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
- VA_END (Marker);
-
- //
- // Send the print string to a Serial Port
- //
- SerialPortWrite ((UINT8 *) Buffer, AsciiStrLen(Buffer));
-}
-
-
-/**
-
- Prints an assert message containing a filename, line number, and description.
- This may be followed by a breakpoint or a dead loop.
-
- Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
- to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
- PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
- DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
- CpuDeadLoop() is called. If neither of these bits are set, then this function
- returns immediately after the message is printed to the debug output device.
- DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while
- processing another DebugAssert(), then DebugAssert() must return immediately.
-
- If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
-
- If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
-
- @param FileName Pointer to the name of the source file that generated the assert condition.
- @param LineNumber The line number in the source file that generated the assert condition
- @param Description Pointer to the description of the assert condition.
-
-**/
-VOID
-EFIAPI
-DebugAssert (
- IN CONST CHAR8 *FileName,
- IN UINTN LineNumber,
- IN CONST CHAR8 *Description
- )
-{
- CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
-
- //
- // Generate the ASSERT() message in Unicode format
- //
- AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT %a(%d): %a\n", FileName, LineNumber, Description);
-
- //
- // Send the print string to the Console Output device
- //
- SerialPortWrite ((UINT8 *) Buffer, AsciiStrLen(Buffer));
-
- //
- // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
- //
- if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
- CpuBreakpoint ();
- } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
- CpuDeadLoop ();
- }
-}
-
-
-/**
-
- Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
-
- This function fills Length bytes of Buffer with the value specified by
- PcdDebugClearMemoryValue, and returns Buffer.
-
- If Buffer is NULL, then ASSERT().
-
- If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
-
- @param Buffer Pointer to the target buffer to fill with PcdDebugClearMemoryValue.
- @param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue.
-
- @return Buffer
-
-**/
-VOID *
-EFIAPI
-DebugClearMemory (
- OUT VOID *Buffer,
- IN UINTN Length
- )
-{
- //
- // If Buffer is NULL, then ASSERT().
- //
- ASSERT (Buffer != NULL);
-
- //
- // SetMem() checks for the the ASSERT() condition on Length and returns Buffer
- //
- return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
-}
-
-
-/**
-
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
-
- Returns TRUE if DEBUG()macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
-
- Returns TRUE if DEBUG_CODE()macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
-
- Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
diff --git a/EdkModulePkg/Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.msa b/EdkModulePkg/Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.msa
deleted file mode 100644
index ddfb3ec..0000000
--- a/EdkModulePkg/Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.msa
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeDebugLibSerialPort</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>BB83F95F-EDBC-4884-A520-CD42AF388FAE</GuidValue>
- <Version>1.0</Version>
- <Abstract>Debug Library for UEFI drivers</Abstract>
- <Description>Library to abstract Framework extensions that conflict with UEFI 2.0 Specification</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>UefiDebugLibConOut</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>SerialPortLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DebugLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The bitmask of flags that specify the enable/disable of Debug
- Assert, Debug Print, Debug Code, Clear Memory, Assert
- Breakpoint and Assert Deadloop.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The value used by DebugClearMemory () to fill a certain range
- of memory.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The bitmask of flags that specify the kind of debug message
- output when Debug Print is enabled.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c b/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c
deleted file mode 100644
index d143039..0000000
--- a/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxePerformanceLib.c
-
-Abstract:
-
- Performance Library
-
---*/
-
-STATIC PERFORMANCE_PROTOCOL *mPerformance = NULL;
-
-/**
- The constructor function caches the pointer to Performance protocol.
-
- The constructor function locates Performance protocol from protocol database.
- It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
-
- @retval EFI_SUCCESS Performance protocol is successfully located.
- @retval Other Performance protocol is not located to log performance.
-
-**/
-STATIC
-EFI_STATUS
-GetPerformanceProtocol (
- VOID
- )
-{
- EFI_STATUS Status;
- PERFORMANCE_PROTOCOL *Performance;
-
- if (mPerformance != NULL) {
- return EFI_SUCCESS;
- }
-
- Status = gBS->LocateProtocol (&gPerformanceProtocolGuid, NULL, (VOID **) &Performance);
- if (!EFI_ERROR (Status)) {
- ASSERT (Performance != NULL);
- //
- // Cache performance protocol.
- //
- mPerformance = Performance;
- }
-
- return Status;
-}
-
-/**
- Creates a record for the beginning of a performance measurement.
-
- Creates a record that contains the Handle, Token, and Module.
- If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
- If TimeStamp is zero, then this function reads the current time stamp
- and adds that time stamp value to the record as the start time.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The start of the measurement was recorded.
- @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-RETURN_STATUS
-EFIAPI
-StartPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- EFI_STATUS Status;
-
- Status = GetPerformanceProtocol ();
- if (EFI_ERROR (Status)) {
- return RETURN_OUT_OF_RESOURCES;
- }
-
- Status = mPerformance->StartGauge (Handle, Token, Module, TimeStamp);
-
- return (RETURN_STATUS) Status;
-}
-
-/**
- Fills in the end time of a performance measurement.
-
- Looks up the record that matches Handle, Token, and Module.
- If the record can not be found then return RETURN_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then TimeStamp is added to the record as the end time.
- If the record is found and TimeStamp is zero, then this function reads
- the current time stamp and adds that time stamp value to the record as the end time.
- If this function is called multiple times for the same record, then the end time is overwritten.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The end of the measurement was recorded.
- @retval RETURN_NOT_FOUND The specified measurement record could not be found.
-
-**/
-RETURN_STATUS
-EFIAPI
-EndPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- EFI_STATUS Status;
-
- Status = GetPerformanceProtocol ();
- if (EFI_ERROR (Status)) {
- return RETURN_NOT_FOUND;
- }
-
- Status = mPerformance->EndGauge (Handle, Token, Module, TimeStamp);
-
- return (RETURN_STATUS) Status;
-}
-
-/**
- Attempts to retrieve a performance measurement log entry from the performance measurement log.
-
- Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
- zero on entry, then an attempt is made to retrieve the first entry from the performance log,
- and the key for the second entry in the log is returned. If the performance log is empty,
- then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
- log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
- returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
- retrieved and an implementation specific non-zero key value that specifies the end of the performance
- log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
- is retrieved and zero is returned. In the cases where a performance log entry can be returned,
- the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
- If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
- If Handle is NULL, then ASSERT().
- If Token is NULL, then ASSERT().
- If Module is NULL, then ASSERT().
- If StartTimeStamp is NULL, then ASSERT().
- If EndTimeStamp is NULL, then ASSERT().
-
- @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
- 0, then the first performance measurement log entry is retrieved.
- On exit, the key of the next performance lof entry entry.
- @param Handle Pointer to environment specific context used to identify the component
- being measured.
- @param Token Pointer to a Null-terminated ASCII string that identifies the component
- being measured.
- @param Module Pointer to a Null-terminated ASCII string that identifies the module
- being measured.
- @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was started.
- @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was ended.
-
- @return The key for the next performance log entry (in general case).
-
-**/
-UINTN
-EFIAPI
-GetPerformanceMeasurement (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp
- )
-{
- EFI_STATUS Status;
- GAUGE_DATA_ENTRY *GaugeData;
-
- ASSERT (Handle != NULL);
- ASSERT (Token != NULL);
- ASSERT (Module != NULL);
- ASSERT (StartTimeStamp != NULL);
- ASSERT (EndTimeStamp != NULL);
-
- Status = GetPerformanceProtocol ();
- if (EFI_ERROR (Status)) {
- return 0;
- }
-
- Status = mPerformance->GetGauge (LogEntryKey++, &GaugeData);
-
- //
- // Make sure that LogEntryKey is a valid log entry key,
- //
- ASSERT (Status != EFI_INVALID_PARAMETER);
-
- if (EFI_ERROR (Status)) {
- //
- // The LogEntryKey is the last entry (equals to the total entry number).
- //
- return 0;
- }
-
- ASSERT (GaugeData != NULL);
-
- *Handle = (VOID *) (UINTN) GaugeData->Handle;
- *Token = GaugeData->Token;
- *Module = GaugeData->Module;
- *StartTimeStamp = GaugeData->StartTimeStamp;
- *EndTimeStamp = GaugeData->EndTimeStamp;
-
- return LogEntryKey;
-}
-
-/**
- Returns TRUE if the performance measurement macros are enabled.
-
- This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set.
- @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-PerformanceMeasurementEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
-}
diff --git a/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.msa b/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.msa
deleted file mode 100644
index 3555a24..0000000
--- a/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.msa
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxePerformanceLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>8B8B4CCC-65FC-41a5-8067-308B8E42CCF2</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Dxe Performance Library</Abstract>
- <Description>This library provides intrastructure for Dxe driver to log performance.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxePerformanceLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxePerformanceLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gPerformanceProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The bitmask of flags that specify the enable/disable of
- Performance Measurement.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/EdkDxePeCoffLoaderFromHobLib.msa b/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/EdkDxePeCoffLoaderFromHobLib.msa
deleted file mode 100644
index 7351c73..0000000
--- a/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/EdkDxePeCoffLoaderFromHobLib.msa
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkDxePeCoffLoaderFromHobLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>ed3de5c8-c389-44f2-a35e-2ebdc9802a49</GuidValue>
- <Version>1.0</Version>
- <Abstract>EdkPeCoffLoaderLib library instance</Abstract>
- <Description>This library gets PeCoffLoader Protocol from Hob List</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkDxePeCoffLoaderFromHobLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkPeCoffLoaderLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>PeCoff.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiPeiPeCoffLoaderGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/PeCoff.c b/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/PeCoff.c
deleted file mode 100644
index 7afe9c2..0000000
--- a/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/PeCoff.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Decompress.c
-
-Abstract:
-
---*/
-
-
-
-
-
-EFI_PEI_PE_COFF_LOADER_PROTOCOL *
-EFIAPI
-GetPeCoffLoaderProtocol (
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gEfiPeiPeCoffLoaderGuid);
- if (GuidHob == NULL) {
- return NULL;
- } else {
- return (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
- }
-}
-
diff --git a/EdkModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.msa b/EdkModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.msa
deleted file mode 100644
index d302a8b..0000000
--- a/EdkModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.msa
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkDxePrintLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>50bcb105-6634-441d-b403-659110a03ad2</GuidValue>
- <Version>1.0</Version>
- <Abstract>DXE Print library</Abstract>
- <Description>Print Library based on EFI_PRINT_PROTOCOL</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkDxePrintLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>PrintLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiPrintProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkDxePrintLib/PrintLib.c b/EdkModulePkg/Library/EdkDxePrintLib/PrintLib.c
deleted file mode 100644
index 30c0354..0000000
--- a/EdkModulePkg/Library/EdkDxePrintLib/PrintLib.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PrintLib.c
-
-Abstract:
-
- Print Library
-
---*/
-
-
-
-static EFI_PRINT_PROTOCOL *gPrintProtocol = NULL;
-
-UINTN
-UnicodeVSPrint (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN const CHAR16 *FormatString,
- IN VA_LIST Marker
- )
-/*++
-
-Routine Description:
-
- VSPrint function to process format and place the results in Buffer. Since a
- VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
- this is the main print working routine
-
-Arguments:
-
- StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.
-
- BufferSize - Maximum number of characters to put into buffer. Zero means
- no limit.
-
- FormatString - Unicode format string see file header for more details.
-
- Marker - Vararg list consumed by processing Format.
-
-Returns:
-
- Number of characters printed.
-
---*/
-{
- EFI_STATUS Status;
-
- if (gPrintProtocol == NULL) {
- Status = gBS->LocateProtocol (
- &gEfiPrintProtocolGuid,
- NULL,
- (VOID **)&gPrintProtocol
- );
- if (EFI_ERROR (Status)) {
- gPrintProtocol = NULL;
- }
- if (gPrintProtocol == NULL) {
- return 0;
- }
- }
- return gPrintProtocol->VSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
-}
-
-UINTN
-UnicodeSPrint (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN const CHAR16 *FormatString,
- ...
- )
-
-{
- UINTN Return;
- VA_LIST Marker;
-
- VA_START (Marker, FormatString);
- Return = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
- VA_END (Marker);
- return Return;
-}
-
-UINTN
-AsciiVSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN const CHAR8 *FormatString,
- IN VA_LIST Marker
- )
-/*++
-
-Routine Description:
-
- VSPrint function to process format and place the results in Buffer. Since a
- VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
- this is the main print working routine
-
-Arguments:
-
- StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.
-
- BufferSize - Maximum number of characters to put into buffer. Zero means
- no limit.
-
- FormatString - Unicode format string see file header for more details.
-
- Marker - Vararg list consumed by processing Format.
-
-Returns:
-
- Number of characters printed.
-
---*/
-{
- return 0;
-}
-
-UINTN
-AsciiSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN const CHAR8 *FormatString,
- ...
- )
-
-{
- UINTN Return;
- VA_LIST Marker;
-
- VA_START (Marker, FormatString);
- Return = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
- VA_END (Marker);
- return Return;
-}
diff --git a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/EdkDxeRuntimeSalLib.msa b/EdkModulePkg/Library/EdkDxeRuntimeSalLib/EdkDxeRuntimeSalLib.msa
deleted file mode 100644
index 24a56a2..0000000
--- a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/EdkDxeRuntimeSalLib.msa
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkDxeRuntimeSalLib</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>61999c3c-72a5-4506-a4ff-4271d18a1d14</GuidValue>
- <Version>1.0</Version>
- <Abstract>SAL library for BS/RT drivers</Abstract>
- <Description>Contains APIs to register/invoke SAL functions.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkDxeSalLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_RUNTIME_DRIVER DXE_SAL_DRIVER">
- <Keyword>EdkDxeSalLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename SupArchList="IPF">Ipf/EsalServiceLib.c</Filename>
- <Filename SupArchList="IPF">Ipf/AsmEsalServiceLib.s</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiExtendedSalBootServiceProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <SetVirtualAddressMapCallBack>DxeSalVirtualNotifyEvent</SetVirtualAddressMapCallBack>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/AsmEsalServiceLib.s b/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/AsmEsalServiceLib.s
deleted file mode 100644
index c5cb881..0000000
--- a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/AsmEsalServiceLib.s
+++ /dev/null
@@ -1,149 +0,0 @@
-//++
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// EsalLib.s
-//
-// Abstract:
-//
-//
-// Revision History:
-//
-//--
-
-.file "EsalLib.s"
-
-#include "IpfMacro.i"
-
-//
-// Exports
-//
-.globl GetEsalEntryPoint
-
-
-//-----------------------------------------------------------------------------
-//++
-// GetEsalEntryPoint
-//
-// Return Esal global and PSR register.
-//
-// On Entry :
-//
-//
-// Return Value:
-// r8 = EFI_SAL_SUCCESS
-// r9 = Physical Plabel
-// r10 = Virtual Plabel
-// r11 = psr
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (GetEsalEntryPoint)
-
- NESTED_SETUP (0,8,0,0)
-
-EsalCalcStart:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart), r8;;
- mov r9 = r8;;
- add r10 = 0x10, r8;;
- mov r11 = psr;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (GetEsalEntryPoint)
-
-
-
-
-
-//-----------------------------------------------------------------------------
-//++
-// SetEsalPhysicalEntryPoint
-//
-// Set the dispatcher entry point
-//
-// On Entry:
-// in0 = Physical address of Esal Dispatcher
-// in1 = Physical GP
-//
-// Return Value:
-// r8 = EFI_SAL_SUCCESS
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (SetEsalPhysicalEntryPoint)
-
- NESTED_SETUP (2,8,0,0)
-
-EsalCalcStart1:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart1), r8;;
- st8 [r8] = in0;;
- add r8 = 0x08, r8;;
- st8 [r8] = in1;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (SetEsalPhysicalEntryPoint)
-
-
-//-----------------------------------------------------------------------------
-//++
-// SetEsalVirtualEntryPoint
-//
-// Register physical address of Esal globals.
-//
-// On Entry :
-// in0 = Virtual address of Esal Dispatcher
-// in1 = Virtual GP
-//
-// Return Value:
-// r8 = EFI_SAL_ERROR
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (SetEsalVirtualEntryPoint)
-
- NESTED_SETUP (2,8,0,0)
-
-EsalCalcStart2:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart2), r8;;
- add r8 = 0x10, r8;;
- st8 [r8] = in0;;
- add r8 = 0x08, r8;;
- st8 [r8] = in1;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (SetEsalVirtualEntryPoint)
-
-
-
-
-.align 32
-EsalEntryPoint:
- data8 0 // Physical Entry
- data8 0 // GP
- data8 0 // Virtual Entry
- data8 0 // GP
-
-
diff --git a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/EsalServiceLib.c b/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/EsalServiceLib.c
deleted file mode 100644
index 471525a..0000000
--- a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/EsalServiceLib.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EsalServiceLib.c
-
-Abstract:
-
---*/
-
-#include <Ipf/IpfDefines.h>
-
-EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService = NULL;
-EFI_PLABEL mPlabel;
-
-STATIC
-EFI_STATUS
-EFIAPI
-DxeSalLibInitialize (
- VOID
- )
-{
- EFI_PLABEL *Plabel;
- EFI_STATUS Status;
-
- if (mEsalBootService != NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // The protocol contains a function pointer, which is an indirect procedure call.
- // An indirect procedure call goes through a plabel, and pointer to a function is
- // a pointer to a plabel. To implement indirect procedure calls that can work in
- // both physical and virtual mode, two plabels are required (one physical and one
- // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it
- // away. We cache it in a module global, so we can register the vitrual version.
- //
- Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, (VOID **) &mEsalBootService);
- if (EFI_ERROR (Status)) {
- mEsalBootService = NULL;
- return EFI_SUCCESS;
- }
-
- Plabel = (EFI_PLABEL *) (UINTN) mEsalBootService->ExtendedSalProc;
-
- mPlabel.EntryPoint = Plabel->EntryPoint;
- mPlabel.GP = Plabel->GP;
- SetEsalPhysicalEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
-
- return EFI_SUCCESS;
-}
-
-VOID
-EFIAPI
-DxeSalVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Fixup virtual address pointer of label.
-
-Arguments:
-
- Event - The Event that is being processed
-
- Context - Event Context
-
-Returns:
-
- None
-
---*/
-{
- UINT64 PhysicalEntryPoint;
-
- PhysicalEntryPoint = mPlabel.EntryPoint;
-
- EfiConvertPointer (0x0, (VOID **) &mPlabel.EntryPoint);
- mPlabel.GP += mPlabel.EntryPoint - PhysicalEntryPoint;
-
- SetEsalVirtualEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
-}
-
-EFI_STATUS
-EFIAPI
-RegisterEsalFunction (
- IN UINT64 FunctionId,
- IN EFI_GUID *ClassGuid,
- IN SAL_INTERNAL_EXTENDED_SAL_PROC Function,
- IN VOID *ModuleGlobal
- )
-/*++
-
-Routine Description:
-
- Register ESAL Class Function and it's asociated global.
- This function is boot service only!
-
-Arguments:
- FunctionId - ID of function to register
- ClassGuid - GUID of function class
- Function - Function to register under ClassGuid/FunctionId pair
- ModuleGlobal - Module global for Function.
-
-Returns:
- EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
-
---*/
-{
- DxeSalLibInitialize ();
- return mEsalBootService->AddExtendedSalProc (
- mEsalBootService,
- ClassGuid,
- FunctionId,
- Function,
- ModuleGlobal
- );
-}
-
-EFI_STATUS
-EFIAPI
-RegisterEsalClass (
- IN EFI_GUID *ClassGuid,
- IN VOID *ModuleGlobal,
- ...
- )
-/*++
-
-Routine Description:
-
- Register ESAL Class and it's asociated global.
- This function is boot service only!
-
-Arguments:
- ClassGuid - GUID of function class
- ModuleGlobal - Module global for Function.
- ... - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
- indicates the end of the list.
-
-Returns:
- EFI_SUCCESS - All members of ClassGuid registered
-
---*/
-{
- VA_LIST Args;
- EFI_STATUS Status;
- SAL_INTERNAL_EXTENDED_SAL_PROC Function;
- UINT64 FunctionId;
- EFI_HANDLE NewHandle;
-
- VA_START (Args, ModuleGlobal);
-
- Status = EFI_SUCCESS;
- while (!EFI_ERROR (Status)) {
- Function = (SAL_INTERNAL_EXTENDED_SAL_PROC) VA_ARG (Args, SAL_INTERNAL_EXTENDED_SAL_PROC);
- if (Function == NULL) {
- break;
- }
-
- FunctionId = VA_ARG (Args, UINT64);
-
- Status = RegisterEsalFunction (FunctionId, ClassGuid, Function, ModuleGlobal);
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- NewHandle = NULL;
- return gBS->InstallProtocolInterface (
- &NewHandle,
- ClassGuid,
- EFI_NATIVE_INTERFACE,
- NULL
- );
-}
-
-SAL_RETURN_REGS
-EFIAPI
-EfiCallEsalService (
- IN EFI_GUID *ClassGuid,
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8
- )
-/*++
-
-Routine Description:
-
- Call module that is not linked direclty to this module. This code is IP
- relative and hides the binding issues of virtual or physical calling. The
- function that gets dispatched has extra arguments that include the registered
- module global and a boolean flag to indicate if the system is in virutal mode.
-
-Arguments:
- ClassGuid - GUID of function
- FunctionId - Function in ClassGuid to call
- Arg2 - Argument 2 ClassGuid/FunctionId defined
- Arg3 - Argument 3 ClassGuid/FunctionId defined
- Arg4 - Argument 4 ClassGuid/FunctionId defined
- Arg5 - Argument 5 ClassGuid/FunctionId defined
- Arg6 - Argument 6 ClassGuid/FunctionId defined
- Arg7 - Argument 7 ClassGuid/FunctionId defined
- Arg8 - Argument 8 ClassGuid/FunctionId defined
-
-Returns:
- Status of ClassGuid/FuncitonId
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- SAL_EXTENDED_SAL_PROC EsalProc;
-
- ReturnReg = GetEsalEntryPoint ();
- if (ReturnReg.Status != EFI_SAL_SUCCESS) {
- return ReturnReg;
- }
-
- //
- // Look at the physical mode ESAL entry point to determine of the ESAL entry point has been initialized
- //
- if (*(UINT64 *)ReturnReg.r9 == 0 && *(UINT64 *)(ReturnReg.r9 + 8) == 0) {
- //
- // Both the function ponter and the GP value are zero, so attempt to initialize the ESAL Entry Point
- //
- DxeSalLibInitialize ();
- ReturnReg = GetEsalEntryPoint ();
- if (ReturnReg.Status != EFI_SAL_SUCCESS) {
- return ReturnReg;
- }
- if (*(UINT64 *)ReturnReg.r9 == 0 && *(UINT64 *)(ReturnReg.r9 + 8) == 0) {
- //
- // The ESAL Entry Point could not be initialized
- //
- ReturnReg.Status = EFI_SAL_ERROR;
- return ReturnReg;
- }
- }
-
- if (ReturnReg.r11 & PSR_IT_MASK) {
- //
- // Virtual mode plabel to entry point
- //
- EsalProc = (SAL_EXTENDED_SAL_PROC) ReturnReg.r10;
- } else {
- //
- // Physical mode plabel to entry point
- //
- EsalProc = (SAL_EXTENDED_SAL_PROC) ReturnReg.r9;
- }
-
- return EsalProc (
- ClassGuid,
- FunctionId,
- Arg2,
- Arg3,
- Arg4,
- Arg5,
- Arg6,
- Arg7,
- Arg8
- );
-}
diff --git a/EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa b/EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa
deleted file mode 100644
index 3b55b13..0000000
--- a/EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkDxeSalLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>F0AC8548-34DE-45bd-9B0A-A5A2DE819E65</GuidValue>
- <Version>1.0</Version>
- <Abstract>SAL library for BS/RT drivers</Abstract>
- <Description>Contains APIs to register/invoke SAL functions.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkDxeSalLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkDxeSalLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename SupArchList="IPF">Ipf/EsalServiceLib.c</Filename>
- <Filename SupArchList="IPF">Ipf/AsmEsalServiceLib.s</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiExtendedSalBootServiceProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkDxeSalLib/Ipf/AsmEsalServiceLib.s b/EdkModulePkg/Library/EdkDxeSalLib/Ipf/AsmEsalServiceLib.s
deleted file mode 100644
index c5cb881..0000000
--- a/EdkModulePkg/Library/EdkDxeSalLib/Ipf/AsmEsalServiceLib.s
+++ /dev/null
@@ -1,149 +0,0 @@
-//++
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// EsalLib.s
-//
-// Abstract:
-//
-//
-// Revision History:
-//
-//--
-
-.file "EsalLib.s"
-
-#include "IpfMacro.i"
-
-//
-// Exports
-//
-.globl GetEsalEntryPoint
-
-
-//-----------------------------------------------------------------------------
-//++
-// GetEsalEntryPoint
-//
-// Return Esal global and PSR register.
-//
-// On Entry :
-//
-//
-// Return Value:
-// r8 = EFI_SAL_SUCCESS
-// r9 = Physical Plabel
-// r10 = Virtual Plabel
-// r11 = psr
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (GetEsalEntryPoint)
-
- NESTED_SETUP (0,8,0,0)
-
-EsalCalcStart:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart), r8;;
- mov r9 = r8;;
- add r10 = 0x10, r8;;
- mov r11 = psr;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (GetEsalEntryPoint)
-
-
-
-
-
-//-----------------------------------------------------------------------------
-//++
-// SetEsalPhysicalEntryPoint
-//
-// Set the dispatcher entry point
-//
-// On Entry:
-// in0 = Physical address of Esal Dispatcher
-// in1 = Physical GP
-//
-// Return Value:
-// r8 = EFI_SAL_SUCCESS
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (SetEsalPhysicalEntryPoint)
-
- NESTED_SETUP (2,8,0,0)
-
-EsalCalcStart1:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart1), r8;;
- st8 [r8] = in0;;
- add r8 = 0x08, r8;;
- st8 [r8] = in1;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (SetEsalPhysicalEntryPoint)
-
-
-//-----------------------------------------------------------------------------
-//++
-// SetEsalVirtualEntryPoint
-//
-// Register physical address of Esal globals.
-//
-// On Entry :
-// in0 = Virtual address of Esal Dispatcher
-// in1 = Virtual GP
-//
-// Return Value:
-// r8 = EFI_SAL_ERROR
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (SetEsalVirtualEntryPoint)
-
- NESTED_SETUP (2,8,0,0)
-
-EsalCalcStart2:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart2), r8;;
- add r8 = 0x10, r8;;
- st8 [r8] = in0;;
- add r8 = 0x08, r8;;
- st8 [r8] = in1;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (SetEsalVirtualEntryPoint)
-
-
-
-
-.align 32
-EsalEntryPoint:
- data8 0 // Physical Entry
- data8 0 // GP
- data8 0 // Virtual Entry
- data8 0 // GP
-
-
diff --git a/EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c b/EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c
deleted file mode 100644
index 98a401e..0000000
--- a/EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EsalServiceLib.c
-
-Abstract:
-
---*/
-
-#include <Ipf/IpfDefines.h>
-
-EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService = NULL;
-EFI_PLABEL mPlabel;
-
-STATIC
-EFI_STATUS
-EFIAPI
-DxeSalLibInitialize (
- VOID
- )
-{
- EFI_PLABEL *Plabel;
- EFI_STATUS Status;
-
- if (mEsalBootService != NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // The protocol contains a function pointer, which is an indirect procedure call.
- // An indirect procedure call goes through a plabel, and pointer to a function is
- // a pointer to a plabel. To implement indirect procedure calls that can work in
- // both physical and virtual mode, two plabels are required (one physical and one
- // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it
- // away. We cache it in a module global, so we can register the vitrual version.
- //
- Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, (VOID **) &mEsalBootService);
- if (EFI_ERROR (Status)) {
- mEsalBootService = NULL;
- return EFI_SUCCESS;
- }
-
- Plabel = (EFI_PLABEL *) (UINTN) mEsalBootService->ExtendedSalProc;
-
- mPlabel.EntryPoint = Plabel->EntryPoint;
- mPlabel.GP = Plabel->GP;
- SetEsalPhysicalEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-RegisterEsalFunction (
- IN UINT64 FunctionId,
- IN EFI_GUID *ClassGuid,
- IN SAL_INTERNAL_EXTENDED_SAL_PROC Function,
- IN VOID *ModuleGlobal
- )
-/*++
-
-Routine Description:
-
- Register ESAL Class Function and it's asociated global.
- This function is boot service only!
-
-Arguments:
- FunctionId - ID of function to register
- ClassGuid - GUID of function class
- Function - Function to register under ClassGuid/FunctionId pair
- ModuleGlobal - Module global for Function.
-
-Returns:
- EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
-
---*/
-{
- DxeSalLibInitialize ();
- return mEsalBootService->AddExtendedSalProc (
- mEsalBootService,
- ClassGuid,
- FunctionId,
- Function,
- ModuleGlobal
- );
-}
-
-EFI_STATUS
-EFIAPI
-RegisterEsalClass (
- IN EFI_GUID *ClassGuid,
- IN VOID *ModuleGlobal,
- ...
- )
-/*++
-
-Routine Description:
-
- Register ESAL Class and it's asociated global.
- This function is boot service only!
-
-Arguments:
- ClassGuid - GUID of function class
- ModuleGlobal - Module global for Function.
- ... - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
- indicates the end of the list.
-
-Returns:
- EFI_SUCCESS - All members of ClassGuid registered
-
---*/
-{
- VA_LIST Args;
- EFI_STATUS Status;
- SAL_INTERNAL_EXTENDED_SAL_PROC Function;
- UINT64 FunctionId;
- EFI_HANDLE NewHandle;
-
- VA_START (Args, ModuleGlobal);
-
- Status = EFI_SUCCESS;
- while (!EFI_ERROR (Status)) {
- Function = (SAL_INTERNAL_EXTENDED_SAL_PROC) VA_ARG (Args, SAL_INTERNAL_EXTENDED_SAL_PROC);
- if (Function == NULL) {
- break;
- }
-
- FunctionId = VA_ARG (Args, UINT64);
-
- Status = RegisterEsalFunction (FunctionId, ClassGuid, Function, ModuleGlobal);
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- NewHandle = NULL;
- return gBS->InstallProtocolInterface (
- &NewHandle,
- ClassGuid,
- EFI_NATIVE_INTERFACE,
- NULL
- );
-}
-
-SAL_RETURN_REGS
-EFIAPI
-EfiCallEsalService (
- IN EFI_GUID *ClassGuid,
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8
- )
-/*++
-
-Routine Description:
-
- Call module that is not linked direclty to this module. This code is IP
- relative and hides the binding issues of virtual or physical calling. The
- function that gets dispatched has extra arguments that include the registered
- module global and a boolean flag to indicate if the system is in virutal mode.
-
-Arguments:
- ClassGuid - GUID of function
- FunctionId - Function in ClassGuid to call
- Arg2 - Argument 2 ClassGuid/FunctionId defined
- Arg3 - Argument 3 ClassGuid/FunctionId defined
- Arg4 - Argument 4 ClassGuid/FunctionId defined
- Arg5 - Argument 5 ClassGuid/FunctionId defined
- Arg6 - Argument 6 ClassGuid/FunctionId defined
- Arg7 - Argument 7 ClassGuid/FunctionId defined
- Arg8 - Argument 8 ClassGuid/FunctionId defined
-
-Returns:
- Status of ClassGuid/FuncitonId
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- SAL_EXTENDED_SAL_PROC EsalProc;
-
- ReturnReg = GetEsalEntryPoint ();
- if (ReturnReg.Status != EFI_SAL_SUCCESS) {
- return ReturnReg;
- }
-
- //
- // Look at the physical mode ESAL entry point to determine of the ESAL entry point has been initialized
- //
- if (*(UINT64 *)ReturnReg.r9 == 0 && *(UINT64 *)(ReturnReg.r9 + 8) == 0) {
- //
- // Both the function ponter and the GP value are zero, so attempt to initialize the ESAL Entry Point
- //
- DxeSalLibInitialize ();
- ReturnReg = GetEsalEntryPoint ();
- if (ReturnReg.Status != EFI_SAL_SUCCESS) {
- return ReturnReg;
- }
- if (*(UINT64 *)ReturnReg.r9 == 0 && *(UINT64 *)(ReturnReg.r9 + 8) == 0) {
- //
- // The ESAL Entry Point could not be initialized
- //
- ReturnReg.Status = EFI_SAL_ERROR;
- return ReturnReg;
- }
- }
-
- if (ReturnReg.r11 & PSR_IT_MASK) {
- //
- // Virtual mode plabel to entry point
- //
- EsalProc = (SAL_EXTENDED_SAL_PROC) ReturnReg.r10;
- } else {
- //
- // Physical mode plabel to entry point
- //
- EsalProc = (SAL_EXTENDED_SAL_PROC) ReturnReg.r9;
- }
-
- return EsalProc (
- ClassGuid,
- FunctionId,
- Arg2,
- Arg3,
- Arg4,
- Arg5,
- Arg6,
- Arg7,
- Arg8
- );
-}
diff --git a/EdkModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa b/EdkModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa
deleted file mode 100644
index 08322c1..0000000
--- a/EdkModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkFvbServiceLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>bd4d540e-04b0-4b10-8fd5-4a7bb533cf67</GuidValue>
- <Version>1.0</Version>
- <Abstract>FvbService Library for UEFI drivers</Abstract>
- <Description>This library instance provide sevice functions to access Firmware Volume Block protocol.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkFvbServiceLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkFvbServiceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IPF">
- <Keyword>ExtendedSalLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Fvb.h</Filename>
- <Filename SupArchList="IA32">Ia32/Fvb.c</Filename>
- <Filename SupArchList="X64">x64/Fvb.c</Filename>
- <Filename SupArchList="IPF">Ipf/Fvb.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <ProtocolCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <ProtocolCName>gEfiFvbExtensionProtocolGuid</ProtocolCName>
- </Protocol>
- <ProtocolNotify Usage="SOMETIMES_CONSUMED">
- <ProtocolNotifyCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolNotifyCName>
- </ProtocolNotify>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>FvbLibInitialize</Constructor>
- </Extern>
- <Extern>
- <SetVirtualAddressMapCallBack>FvbVirtualAddressChangeNotifyEvent</SetVirtualAddressMapCallBack>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkFvbServiceLib/Fvb.h b/EdkModulePkg/Library/EdkFvbServiceLib/Fvb.h
deleted file mode 100644
index 3a0cd50..0000000
--- a/EdkModulePkg/Library/EdkFvbServiceLib/Fvb.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- The internal header file for EdkFvbServiceLib.
-
-Copyright (c) 2006 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-**/
-
-#ifndef __FVB_H__
-#define __FVB_H__
-
-#define MAX_FVB_COUNT 16
-
-typedef struct {
- EFI_HANDLE Handle;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_FVB_EXTENSION_PROTOCOL *FvbExtension;
- BOOLEAN IsRuntimeAccess;
-} FVB_ENTRY;
-
-#endif
diff --git a/EdkModulePkg/Library/EdkFvbServiceLib/Ia32/Fvb.c b/EdkModulePkg/Library/EdkFvbServiceLib/Ia32/Fvb.c
deleted file mode 100644
index 12a55c9..0000000
--- a/EdkModulePkg/Library/EdkFvbServiceLib/Ia32/Fvb.c
+++ /dev/null
@@ -1,611 +0,0 @@
-/**@file
-
- Firmware Volume Block Protocol Runtime Abstraction
-
- mFvbEntry is an array of Handle Fvb pairs. The Fvb Lib Instance matches the
- index in the mFvbEntry array. This should be the same sequence as the FVB's
- were described in the HOB. We have to remember the handle so we can tell if
- the protocol has been reinstalled and it needs updateing.
-
- If you are using any of these lib functions.you must first call FvbInitialize ().
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Fvb.h"
-
-//
-// Lib will ASSERT if more FVB devices than this are added to the system.
-//
-STATIC FVB_ENTRY *mFvbEntry;
-STATIC EFI_EVENT mFvbRegistration;
-STATIC BOOLEAN mEfiFvbInitialized = FALSE;
-STATIC UINTN mFvbCount;
-
-/**
- Check whether an address is runtime memory or not.
-
- @param Address The Address being checked.
-
- @retval TRUE The address is runtime memory.
- @retval FALSE The address is not runtime memory.
-**/
-BOOLEAN
-IsRuntimeMemory (
- IN VOID *Address
- )
-{
- EFI_STATUS Status;
- UINT8 TmpMemoryMap[1];
- UINTN MapKey;
- UINTN DescriptorSize;
- UINT32 DescriptorVersion;
- UINTN MemoryMapSize;
- EFI_MEMORY_DESCRIPTOR *MemoryMap;
- EFI_MEMORY_DESCRIPTOR *MemoryMapPtr;
- BOOLEAN IsRuntime;
- UINTN Index;
-
- IsRuntime = FALSE;
-
- //
- // Get System MemoryMapSize
- //
- MemoryMapSize = 1;
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- (EFI_MEMORY_DESCRIPTOR *)TmpMemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
- ASSERT (Status == EFI_BUFFER_TOO_SMALL);
- //
- // Enlarge space here, because we will allocate pool now.
- //
- MemoryMapSize += EFI_PAGE_SIZE;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- MemoryMapSize,
- (VOID**)&MemoryMap
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Get System MemoryMap
- //
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- MemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
- ASSERT_EFI_ERROR (Status);
-
- MemoryMapPtr = MemoryMap;
- //
- // Search the request Address
- //
- for (Index = 0; Index < (MemoryMapSize / DescriptorSize); Index++) {
- if (((EFI_PHYSICAL_ADDRESS)(UINTN)Address >= MemoryMap->PhysicalStart) &&
- ((EFI_PHYSICAL_ADDRESS)(UINTN)Address < MemoryMap->PhysicalStart
- + LShiftU64 (MemoryMap->NumberOfPages, EFI_PAGE_SHIFT))) {
- //
- // Found it
- //
- if (MemoryMap->Attribute & EFI_MEMORY_RUNTIME) {
- IsRuntime = TRUE;
- }
- break;
- }
- //
- // Get next item
- //
- MemoryMap = (EFI_MEMORY_DESCRIPTOR *)((UINTN)MemoryMap + DescriptorSize);
- }
-
- //
- // Done
- //
- gBS->FreePool (MemoryMapPtr);
-
- return IsRuntime;
-}
-
-/**
- Update mFvbEntry. Add new entry, or update existing entry if Fvb protocol is
- reinstalled.
-
- @param Event The Event that is being processed
- @param Context Event Context
-
-**/
-STATIC
-VOID
-EFIAPI
-FvbNotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- UINTN Index;
- UINTN UpdateIndex;
-
- while (TRUE) {
- BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- mFvbRegistration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // Exit Path of While Loop....
- //
- break;
- }
-
- UpdateIndex = MAX_FVB_COUNT;
- for (Index = 0; Index < mFvbCount; Index++) {
- if (mFvbEntry[Index].Handle == Handle) {
- //
- // If the handle is already in the table just update the protocol
- //
- UpdateIndex = Index;
- break;
- }
- }
-
- if (UpdateIndex == MAX_FVB_COUNT) {
- //
- // Use the next free slot for a new entry
- //
- UpdateIndex = mFvbCount++;
- //
- // Check the UpdateIndex whether exceed the maximum value.
- //
- ASSERT (UpdateIndex < MAX_FVB_COUNT);
- mFvbEntry[UpdateIndex].Handle = Handle;
- }
- //
- // The array does not have enough entries
- //
- ASSERT (UpdateIndex < MAX_FVB_COUNT);
-
- //
- // Get the interface pointer and if it's ours, skip it
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID **) &mFvbEntry[UpdateIndex].Fvb
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFvbExtensionProtocolGuid,
- (VOID **) &mFvbEntry[UpdateIndex].FvbExtension
- );
- if (Status != EFI_SUCCESS) {
- mFvbEntry[UpdateIndex].FvbExtension = NULL;
- }
-
- //
- // Check the FVB can be accessed in RUNTIME, The FVBs in FVB handle list comes
- // from two way:
- // 1) Dxe Core. (FVB information is transferred from FV HOB).
- // 2) FVB driver.
- // The FVB produced Dxe core is used for discoverying DXE driver and dispatch. These
- // FVBs can only be accessed in boot time.
- // FVB driver will discovery all FV in FLASH and these FVBs can be accessed in runtime.
- // The FVB itself produced by FVB driver is allocated in runtime memory. So we can
- // determine the what FVB can be accessed in RUNTIME by judging whether FVB itself is allocated
- // in RUNTIME memory.
- //
- mFvbEntry[UpdateIndex].IsRuntimeAccess = IsRuntimeMemory (mFvbEntry[UpdateIndex].Fvb);
- }
-}
-
-/**
- Convert all pointers in mFvbEntry after ExitBootServices.
-
- @param Event The Event that is being processed
- @param Context Event Context
-
-**/
-VOID
-EFIAPI
-FvbVirtualAddressChangeNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINTN Index;
- if (mFvbEntry != NULL) {
- for (Index = 0; Index < MAX_FVB_COUNT; Index++) {
- if (!mFvbEntry[Index].IsRuntimeAccess) {
- continue;
- }
-
- if (NULL != mFvbEntry[Index].Fvb) {
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetBlockSize);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetPhysicalAddress);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetVolumeAttributes);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->SetVolumeAttributes);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Read);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Write);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->EraseBlocks);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb);
- }
-
- if (NULL != mFvbEntry[Index].FvbExtension) {
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].FvbExtension->EraseFvbCustomBlock);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].FvbExtension);
- }
- }
-
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry);
- }
-}
-
-/**
- Library constructor function entry.
-
- @param ImageHandle The handle of image who call this libary.
- @param SystemTable The point of System Table.
-
- @retval EFI_SUCESS Sucess construct this library.
- @retval Others Fail to contruct this libary.
-**/
-EFI_STATUS
-EFIAPI
-FvbLibInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- UINTN Status;
- mFvbCount = 0;
-
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- (UINTN) sizeof (FVB_ENTRY) * MAX_FVB_COUNT,
- (VOID *) &mFvbEntry
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ZeroMem (mFvbEntry, sizeof (FVB_ENTRY) * MAX_FVB_COUNT);
-
- EfiCreateProtocolNotifyEvent (
- &gEfiFirmwareVolumeBlockProtocolGuid,
- TPL_CALLBACK,
- FvbNotificationEvent,
- NULL,
- &mFvbRegistration
- );
-
- //
- // Register SetVirtualAddressMap () notify function
- //
- // Status = gBS->CreateEvent (
- // EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
- // TPL_NOTIFY,
- // EfiRuntimeLibFvbVirtualNotifyEvent,
- // NULL,
- // &mEfiFvbVirtualNotifyEvent
- // );
- // ASSERT_EFI_ERROR (Status);
- //
-
- //
- // Register SetVirtualAddressMap () notify function
- //
-
- ASSERT_EFI_ERROR (Status);
-
- mEfiFvbInitialized = TRUE;
-
- return EFI_SUCCESS;
-}
-
-//
-// =============================================================================
-// The following functions wrap Fvb protocol in the Runtime Lib functions.
-// The Instance translates into Fvb instance. The Fvb order defined by HOBs and
-// thus the sequence of FVB protocol addition define Instance.
-//
-// EfiFvbInitialize () must be called before any of the following functions
-// must be called.
-// =============================================================================
-//
-
-/**
- Reads specified number of bytes into a buffer from the specified block
-
- @param Instance The FV instance to be read from.
- @param Lba The logical block address to be read from
- @param Offset Offset into the block at which to begin reading
- @param NumBytes Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes read
- @param Buffer Pointer to a caller allocated buffer that will be
- used to hold the data read
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to Read block
- @retval Others Fail to read block
-**/
-EFI_STATUS
-EfiFvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->Read (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);
-}
-
-/**
- Writes specified number of bytes from the input buffer to the block
-
- @param Instance The FV instance to be written to
- @param Lba The starting logical block index to write to
- @param Offset Offset into the block at which to begin writing
- @param NumBytes Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes actually written
- @param Buffer Pointer to a caller allocated buffer that contains
- the source for the write
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to write block
- @retval Others Fail to write block
-**/
-EFI_STATUS
-EfiFvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->Write (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);
-}
-
-/**
- Erases and initializes a firmware volume block
-
- @param Instance The FV instance to be erased
- @param Lba The logical block index to be erased
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to erase block
- @retval Others Fail to erase block
-**/
-EFI_STATUS
-EfiFvbEraseBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->EraseBlocks (mFvbEntry[Instance].Fvb, Lba, -1);
-}
-
-/**
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter
-
- @param Instance The FV instance whose attributes is going to be returned
- @param Attributes Output buffer which contains attributes
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get Fv attribute
- @retval Others Fail to get Fv attribute
-**/
-EFI_STATUS
-EfiFvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES *Attributes
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetVolumeAttributes (mFvbEntry[Instance].Fvb, Attributes);
-}
-
-/**
- Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
-
- @param Instance The FV instance whose attributes is going to be
- modified
- @param Attributes On input, it is a pointer to EFI_FVB_ATTRIBUTES
- containing the desired firmware volume settings.
- On successful return, it contains the new settings
- of the firmware volume
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to set Fv attribute
- @retval Others Fail to set Fv attribute
-**/
-EFI_STATUS
-EfiFvbSetVolumeAttributes (
- IN UINTN Instance,
- IN EFI_FVB_ATTRIBUTES Attributes
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->SetVolumeAttributes (mFvbEntry[Instance].Fvb, &Attributes);
-}
-
-/**
- Retrieves the physical address of a memory mapped FV
-
- @param Instance The FV instance whose base address is going to be
- returned
- @param BaseAddress Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
- that on successful return, contains the base address
- of the firmware volume.
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get physical address
- @retval Others Fail to get physical address
-**/
-EFI_STATUS
-EfiFvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetPhysicalAddress (mFvbEntry[Instance].Fvb, BaseAddress);
-}
-
-/**
- Retrieve the size of a logical block
-
- @param Instance The FV instance whose block size is going to be
- returned
- @param Lba Indicates which block to return the size for.
- @param BlockSize A pointer to a caller allocated UINTN in which
- the size of the block is returned
- @param NumOfBlocks a pointer to a caller allocated UINTN in which the
- number of consecutive blocks starting with Lba is
- returned. All blocks in this range have a size of
- BlockSize
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get block size
- @retval Others Fail to get block size
-**/
-EFI_STATUS
-EfiFvbGetBlockSize (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetBlockSize (mFvbEntry[Instance].Fvb, Lba, BlockSize, NumOfBlocks);
-}
-
-/**
- Erases and initializes a specified range of a firmware volume
-
- @param Instance The FV instance to be erased
- @param StartLba The starting logical block index to be erased
- @param OffsetStartLba Offset into the starting block at which to
- begin erasing
- @param LastLba The last logical block index to be erased
- @param OffsetLastLba Offset into the last block at which to end erasing
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to erase custom block range
- @retval Others Fail to erase custom block range
-**/
-EFI_STATUS
-EfiFvbEraseCustomBlockRange (
- IN UINTN Instance,
- IN EFI_LBA StartLba,
- IN UINTN OffsetStartLba,
- IN EFI_LBA LastLba,
- IN UINTN OffsetLastLba
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!(mFvbEntry[Instance].FvbExtension)) {
- return EFI_UNSUPPORTED;
- }
-
- if (!(mFvbEntry[Instance].FvbExtension->EraseFvbCustomBlock)) {
- return EFI_UNSUPPORTED;
- }
-
- return mFvbEntry[Instance].FvbExtension->EraseFvbCustomBlock (
- mFvbEntry[Instance].FvbExtension,
- StartLba,
- OffsetStartLba,
- LastLba,
- OffsetLastLba
- );
-}
diff --git a/EdkModulePkg/Library/EdkFvbServiceLib/Ipf/Fvb.c b/EdkModulePkg/Library/EdkFvbServiceLib/Ipf/Fvb.c
deleted file mode 100644
index fd455de..0000000
--- a/EdkModulePkg/Library/EdkFvbServiceLib/Ipf/Fvb.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Fvb.c
-
-Abstract:
-
- Light weight lib to support Tiano Firmware Volume Block
- protocol abstraction at runtime.
-
- All these functions convert EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID
- class function to the Runtime Lib function. There is a 1 to 1 mapping.
-
- If you are using any of these lib functions.you must first call FvbInitialize ().
-
---*/
-
-EFI_STATUS
-EFIAPI
-FvbLibInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Initialize globals and register Fvb Protocol notification function.
-
-Arguments:
- None
-
-Returns:
- EFI_SUCCESS
-
---*/
-{
- return EFI_SUCCESS;
-}
-//
-// The following functions wrap Fvb protocol in the Runtime Lib functions.
-// The Instance translates into Fvb instance. The Fvb order defined by HOBs and
-// thus the sequence of FVB protocol addition define Instance.
-//
-// EfiFvbInitialize () must be called before any of the following functions
-// must be called.
-//
-EFI_STATUS
-EfiFvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
- Reads specified number of bytes into a buffer from the specified block
-
-Arguments:
- Instance - The FV instance to be read from
- Lba - The logical block address to be read from
- Offset - Offset into the block at which to begin reading
- NumBytes - Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes read
- Buffer - Pointer to a caller allocated buffer that will be
- used to hold the data read
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, ReadFunctionId, Instance, Lba, Offset, (UINT64) NumBytes, (UINT64) Buffer, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
- Writes specified number of bytes from the input buffer to the block
-
-Arguments:
- Instance - The FV instance to be written to
- Lba - The starting logical block index to write to
- Offset - Offset into the block at which to begin writing
- NumBytes - Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes actually written
- Buffer - Pointer to a caller allocated buffer that contains
- the source for the write
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, WriteFunctionId, Instance, Lba, Offset, (UINT64) NumBytes, (UINT64) Buffer, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbEraseBlock (
- IN UINTN Instance,
- IN UINTN Lba
- )
-/*++
-
-Routine Description:
- Erases and initializes a firmware volume block
-
-Arguments:
- Instance - The FV instance to be erased
- Lba - The logical block index to be erased
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, EraseBlockFunctionId, Instance, Lba, 0, 0, 0, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter
-
-Arguments:
- Instance - The FV instance whose attributes is going to be
- returned
- Attributes - Output buffer which contains attributes
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, SetVolumeAttributesFunctionId, Instance, (UINT64) Attributes, 0, 0, 0, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbSetVolumeAttributes (
- IN UINTN Instance,
- IN EFI_FVB_ATTRIBUTES Attributes
- )
-/*++
-
-Routine Description:
- Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
-
-Arguments:
- Instance - The FV instance whose attributes is going to be
- modified
- Attributes - On input, it is a pointer to EFI_FVB_ATTRIBUTES
- containing the desired firmware volume settings.
- On successful return, it contains the new settings
- of the firmware volume
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, SetVolumeAttributesFunctionId, Instance, (UINT64) Attributes, 0, 0, 0, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress
- )
-/*++
-
-Routine Description:
- Retrieves the physical address of a memory mapped FV
-
-Arguments:
- Instance - The FV instance whose base address is going to be
- returned
- BaseAddress - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
- that on successful return, contains the base address
- of the firmware volume.
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, GetPhysicalAddressFunctionId, Instance, (UINT64) BaseAddress, 0, 0, 0, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbGetBlockSize (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- )
-/*++
-
-Routine Description:
- Retrieve the size of a logical block
-
-Arguments:
- Instance - The FV instance whose block size is going to be
- returned
- Lba - Indicates which block to return the size for.
- BlockSize - A pointer to a caller allocated UINTN in which
- the size of the block is returned
- NumOfBlocks - a pointer to a caller allocated UINTN in which the
- number of consecutive blocks starting with Lba is
- returned. All blocks in this range have a size of
- BlockSize
-
-Returns:
- EFI_SUCCESS - The firmware volume was read successfully and
- contents are in Buffer
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (
- &Guid,
- GetBlockSizeFunctionId,
- Instance,
- Lba,
- (UINT64) BlockSize,
- (UINT64) NumOfBlocks,
- 0,
- 0,
- 0
- ).Status;
-}
-
-EFI_STATUS
-EfiFvbEraseCustomBlockRange (
- IN UINTN Instance,
- IN EFI_LBA StartLba,
- IN UINTN OffsetStartLba,
- IN EFI_LBA LastLba,
- IN UINTN OffsetLastLba
- )
-/*++
-
-Routine Description:
- Erases and initializes a specified range of a firmware volume
-
-Arguments:
- Instance - The FV instance to be erased
- StartLba - The starting logical block index to be erased
- OffsetStartLba - Offset into the starting block at which to
- begin erasing
- LastLba - The last logical block index to be erased
- OffsetLastLba - Offset into the last block at which to end erasing
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (
- &Guid,
- EraseCustomBlockRangeFunctionId,
- Instance,
- StartLba,
- OffsetStartLba,
- LastLba,
- OffsetLastLba,
- 0,
- 0
- ).Status;
-}
-
-
-/**
- BugBug: Can't turn this off in the current MSA so we need a stub
-**/
-VOID
-EFIAPI
-FvbVirtualAddressChangeNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
-}
diff --git a/EdkModulePkg/Library/EdkFvbServiceLib/x64/Fvb.c b/EdkModulePkg/Library/EdkFvbServiceLib/x64/Fvb.c
deleted file mode 100644
index 12a55c9..0000000
--- a/EdkModulePkg/Library/EdkFvbServiceLib/x64/Fvb.c
+++ /dev/null
@@ -1,611 +0,0 @@
-/**@file
-
- Firmware Volume Block Protocol Runtime Abstraction
-
- mFvbEntry is an array of Handle Fvb pairs. The Fvb Lib Instance matches the
- index in the mFvbEntry array. This should be the same sequence as the FVB's
- were described in the HOB. We have to remember the handle so we can tell if
- the protocol has been reinstalled and it needs updateing.
-
- If you are using any of these lib functions.you must first call FvbInitialize ().
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Fvb.h"
-
-//
-// Lib will ASSERT if more FVB devices than this are added to the system.
-//
-STATIC FVB_ENTRY *mFvbEntry;
-STATIC EFI_EVENT mFvbRegistration;
-STATIC BOOLEAN mEfiFvbInitialized = FALSE;
-STATIC UINTN mFvbCount;
-
-/**
- Check whether an address is runtime memory or not.
-
- @param Address The Address being checked.
-
- @retval TRUE The address is runtime memory.
- @retval FALSE The address is not runtime memory.
-**/
-BOOLEAN
-IsRuntimeMemory (
- IN VOID *Address
- )
-{
- EFI_STATUS Status;
- UINT8 TmpMemoryMap[1];
- UINTN MapKey;
- UINTN DescriptorSize;
- UINT32 DescriptorVersion;
- UINTN MemoryMapSize;
- EFI_MEMORY_DESCRIPTOR *MemoryMap;
- EFI_MEMORY_DESCRIPTOR *MemoryMapPtr;
- BOOLEAN IsRuntime;
- UINTN Index;
-
- IsRuntime = FALSE;
-
- //
- // Get System MemoryMapSize
- //
- MemoryMapSize = 1;
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- (EFI_MEMORY_DESCRIPTOR *)TmpMemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
- ASSERT (Status == EFI_BUFFER_TOO_SMALL);
- //
- // Enlarge space here, because we will allocate pool now.
- //
- MemoryMapSize += EFI_PAGE_SIZE;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- MemoryMapSize,
- (VOID**)&MemoryMap
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Get System MemoryMap
- //
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- MemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
- ASSERT_EFI_ERROR (Status);
-
- MemoryMapPtr = MemoryMap;
- //
- // Search the request Address
- //
- for (Index = 0; Index < (MemoryMapSize / DescriptorSize); Index++) {
- if (((EFI_PHYSICAL_ADDRESS)(UINTN)Address >= MemoryMap->PhysicalStart) &&
- ((EFI_PHYSICAL_ADDRESS)(UINTN)Address < MemoryMap->PhysicalStart
- + LShiftU64 (MemoryMap->NumberOfPages, EFI_PAGE_SHIFT))) {
- //
- // Found it
- //
- if (MemoryMap->Attribute & EFI_MEMORY_RUNTIME) {
- IsRuntime = TRUE;
- }
- break;
- }
- //
- // Get next item
- //
- MemoryMap = (EFI_MEMORY_DESCRIPTOR *)((UINTN)MemoryMap + DescriptorSize);
- }
-
- //
- // Done
- //
- gBS->FreePool (MemoryMapPtr);
-
- return IsRuntime;
-}
-
-/**
- Update mFvbEntry. Add new entry, or update existing entry if Fvb protocol is
- reinstalled.
-
- @param Event The Event that is being processed
- @param Context Event Context
-
-**/
-STATIC
-VOID
-EFIAPI
-FvbNotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- UINTN Index;
- UINTN UpdateIndex;
-
- while (TRUE) {
- BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- mFvbRegistration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // Exit Path of While Loop....
- //
- break;
- }
-
- UpdateIndex = MAX_FVB_COUNT;
- for (Index = 0; Index < mFvbCount; Index++) {
- if (mFvbEntry[Index].Handle == Handle) {
- //
- // If the handle is already in the table just update the protocol
- //
- UpdateIndex = Index;
- break;
- }
- }
-
- if (UpdateIndex == MAX_FVB_COUNT) {
- //
- // Use the next free slot for a new entry
- //
- UpdateIndex = mFvbCount++;
- //
- // Check the UpdateIndex whether exceed the maximum value.
- //
- ASSERT (UpdateIndex < MAX_FVB_COUNT);
- mFvbEntry[UpdateIndex].Handle = Handle;
- }
- //
- // The array does not have enough entries
- //
- ASSERT (UpdateIndex < MAX_FVB_COUNT);
-
- //
- // Get the interface pointer and if it's ours, skip it
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID **) &mFvbEntry[UpdateIndex].Fvb
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFvbExtensionProtocolGuid,
- (VOID **) &mFvbEntry[UpdateIndex].FvbExtension
- );
- if (Status != EFI_SUCCESS) {
- mFvbEntry[UpdateIndex].FvbExtension = NULL;
- }
-
- //
- // Check the FVB can be accessed in RUNTIME, The FVBs in FVB handle list comes
- // from two way:
- // 1) Dxe Core. (FVB information is transferred from FV HOB).
- // 2) FVB driver.
- // The FVB produced Dxe core is used for discoverying DXE driver and dispatch. These
- // FVBs can only be accessed in boot time.
- // FVB driver will discovery all FV in FLASH and these FVBs can be accessed in runtime.
- // The FVB itself produced by FVB driver is allocated in runtime memory. So we can
- // determine the what FVB can be accessed in RUNTIME by judging whether FVB itself is allocated
- // in RUNTIME memory.
- //
- mFvbEntry[UpdateIndex].IsRuntimeAccess = IsRuntimeMemory (mFvbEntry[UpdateIndex].Fvb);
- }
-}
-
-/**
- Convert all pointers in mFvbEntry after ExitBootServices.
-
- @param Event The Event that is being processed
- @param Context Event Context
-
-**/
-VOID
-EFIAPI
-FvbVirtualAddressChangeNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINTN Index;
- if (mFvbEntry != NULL) {
- for (Index = 0; Index < MAX_FVB_COUNT; Index++) {
- if (!mFvbEntry[Index].IsRuntimeAccess) {
- continue;
- }
-
- if (NULL != mFvbEntry[Index].Fvb) {
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetBlockSize);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetPhysicalAddress);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetVolumeAttributes);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->SetVolumeAttributes);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Read);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Write);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->EraseBlocks);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb);
- }
-
- if (NULL != mFvbEntry[Index].FvbExtension) {
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].FvbExtension->EraseFvbCustomBlock);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].FvbExtension);
- }
- }
-
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry);
- }
-}
-
-/**
- Library constructor function entry.
-
- @param ImageHandle The handle of image who call this libary.
- @param SystemTable The point of System Table.
-
- @retval EFI_SUCESS Sucess construct this library.
- @retval Others Fail to contruct this libary.
-**/
-EFI_STATUS
-EFIAPI
-FvbLibInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- UINTN Status;
- mFvbCount = 0;
-
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- (UINTN) sizeof (FVB_ENTRY) * MAX_FVB_COUNT,
- (VOID *) &mFvbEntry
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ZeroMem (mFvbEntry, sizeof (FVB_ENTRY) * MAX_FVB_COUNT);
-
- EfiCreateProtocolNotifyEvent (
- &gEfiFirmwareVolumeBlockProtocolGuid,
- TPL_CALLBACK,
- FvbNotificationEvent,
- NULL,
- &mFvbRegistration
- );
-
- //
- // Register SetVirtualAddressMap () notify function
- //
- // Status = gBS->CreateEvent (
- // EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
- // TPL_NOTIFY,
- // EfiRuntimeLibFvbVirtualNotifyEvent,
- // NULL,
- // &mEfiFvbVirtualNotifyEvent
- // );
- // ASSERT_EFI_ERROR (Status);
- //
-
- //
- // Register SetVirtualAddressMap () notify function
- //
-
- ASSERT_EFI_ERROR (Status);
-
- mEfiFvbInitialized = TRUE;
-
- return EFI_SUCCESS;
-}
-
-//
-// =============================================================================
-// The following functions wrap Fvb protocol in the Runtime Lib functions.
-// The Instance translates into Fvb instance. The Fvb order defined by HOBs and
-// thus the sequence of FVB protocol addition define Instance.
-//
-// EfiFvbInitialize () must be called before any of the following functions
-// must be called.
-// =============================================================================
-//
-
-/**
- Reads specified number of bytes into a buffer from the specified block
-
- @param Instance The FV instance to be read from.
- @param Lba The logical block address to be read from
- @param Offset Offset into the block at which to begin reading
- @param NumBytes Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes read
- @param Buffer Pointer to a caller allocated buffer that will be
- used to hold the data read
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to Read block
- @retval Others Fail to read block
-**/
-EFI_STATUS
-EfiFvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->Read (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);
-}
-
-/**
- Writes specified number of bytes from the input buffer to the block
-
- @param Instance The FV instance to be written to
- @param Lba The starting logical block index to write to
- @param Offset Offset into the block at which to begin writing
- @param NumBytes Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes actually written
- @param Buffer Pointer to a caller allocated buffer that contains
- the source for the write
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to write block
- @retval Others Fail to write block
-**/
-EFI_STATUS
-EfiFvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->Write (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);
-}
-
-/**
- Erases and initializes a firmware volume block
-
- @param Instance The FV instance to be erased
- @param Lba The logical block index to be erased
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to erase block
- @retval Others Fail to erase block
-**/
-EFI_STATUS
-EfiFvbEraseBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->EraseBlocks (mFvbEntry[Instance].Fvb, Lba, -1);
-}
-
-/**
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter
-
- @param Instance The FV instance whose attributes is going to be returned
- @param Attributes Output buffer which contains attributes
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get Fv attribute
- @retval Others Fail to get Fv attribute
-**/
-EFI_STATUS
-EfiFvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES *Attributes
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetVolumeAttributes (mFvbEntry[Instance].Fvb, Attributes);
-}
-
-/**
- Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
-
- @param Instance The FV instance whose attributes is going to be
- modified
- @param Attributes On input, it is a pointer to EFI_FVB_ATTRIBUTES
- containing the desired firmware volume settings.
- On successful return, it contains the new settings
- of the firmware volume
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to set Fv attribute
- @retval Others Fail to set Fv attribute
-**/
-EFI_STATUS
-EfiFvbSetVolumeAttributes (
- IN UINTN Instance,
- IN EFI_FVB_ATTRIBUTES Attributes
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->SetVolumeAttributes (mFvbEntry[Instance].Fvb, &Attributes);
-}
-
-/**
- Retrieves the physical address of a memory mapped FV
-
- @param Instance The FV instance whose base address is going to be
- returned
- @param BaseAddress Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
- that on successful return, contains the base address
- of the firmware volume.
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get physical address
- @retval Others Fail to get physical address
-**/
-EFI_STATUS
-EfiFvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetPhysicalAddress (mFvbEntry[Instance].Fvb, BaseAddress);
-}
-
-/**
- Retrieve the size of a logical block
-
- @param Instance The FV instance whose block size is going to be
- returned
- @param Lba Indicates which block to return the size for.
- @param BlockSize A pointer to a caller allocated UINTN in which
- the size of the block is returned
- @param NumOfBlocks a pointer to a caller allocated UINTN in which the
- number of consecutive blocks starting with Lba is
- returned. All blocks in this range have a size of
- BlockSize
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get block size
- @retval Others Fail to get block size
-**/
-EFI_STATUS
-EfiFvbGetBlockSize (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetBlockSize (mFvbEntry[Instance].Fvb, Lba, BlockSize, NumOfBlocks);
-}
-
-/**
- Erases and initializes a specified range of a firmware volume
-
- @param Instance The FV instance to be erased
- @param StartLba The starting logical block index to be erased
- @param OffsetStartLba Offset into the starting block at which to
- begin erasing
- @param LastLba The last logical block index to be erased
- @param OffsetLastLba Offset into the last block at which to end erasing
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to erase custom block range
- @retval Others Fail to erase custom block range
-**/
-EFI_STATUS
-EfiFvbEraseCustomBlockRange (
- IN UINTN Instance,
- IN EFI_LBA StartLba,
- IN UINTN OffsetStartLba,
- IN EFI_LBA LastLba,
- IN UINTN OffsetLastLba
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!(mFvbEntry[Instance].FvbExtension)) {
- return EFI_UNSUPPORTED;
- }
-
- if (!(mFvbEntry[Instance].FvbExtension->EraseFvbCustomBlock)) {
- return EFI_UNSUPPORTED;
- }
-
- return mFvbEntry[Instance].FvbExtension->EraseFvbCustomBlock (
- mFvbEntry[Instance].FvbExtension,
- StartLba,
- OffsetStartLba,
- LastLba,
- OffsetLastLba
- );
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/BdsBoot.c b/EdkModulePkg/Library/EdkGenericBdsLib/BdsBoot.c
deleted file mode 100644
index 4513aa9..0000000
--- a/EdkModulePkg/Library/EdkGenericBdsLib/BdsBoot.c
+++ /dev/null
@@ -1,1102 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsBoot.c
-
-Abstract:
-
- BDS Lib functions which relate with create or process the boot
- option.
-
---*/
-#include "Performance.h"
-
-BOOLEAN mEnumBootDevice = FALSE;
-
-EFI_STATUS
-BdsLibDoLegacyBoot (
- IN BDS_COMMON_OPTION *Option
- )
-/*++
-
-Routine Description:
-
- Boot the legacy system with the boot option
-
-Arguments:
-
- Option - The legacy boot option which have BBS device path
-
-Returns:
-
- EFI_UNSUPPORTED - There is no legacybios protocol, do not support
- legacy boot.
-
- EFI_STATUS - Return the status of LegacyBios->LegacyBoot ().
-
---*/
-{
- EFI_STATUS Status;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
-
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL,
- (void **)&LegacyBios);
- if (EFI_ERROR (Status)) {
- //
- // If no LegacyBios protocol we do not support legacy boot
- //
- return EFI_UNSUPPORTED;
- }
- //
- // Notes: if we seperate the int 19, then we don't need to refresh BBS
- //
- BdsRefreshBbsTableForBoot (Option);
-
- //
- // Write boot to OS performance data to a file
- //
- PERF_CODE (
- WriteBootToOsPerformanceData ();
- );
-
-
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Legacy Boot: %S\n", Option->Description));
- return LegacyBios->LegacyBoot (
- LegacyBios,
- (BBS_BBS_DEVICE_PATH *) Option->DevicePath,
- Option->LoadOptionsSize,
- Option->LoadOptions
- );
-}
-
-EFI_STATUS
-BdsLibBootViaBootOption (
- IN BDS_COMMON_OPTION * Option,
- IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
- OUT UINTN *ExitDataSize,
- OUT CHAR16 **ExitData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Process the boot option follow the EFI 1.1 specification and
- special treat the legacy boot option with BBS_DEVICE_PATH.
-
-Arguments:
-
- Option - The boot option need to be processed
-
- DevicePath - The device path which describe where to load
- the boot image or the legcy BBS device path
- to boot the legacy OS
-
- ExitDataSize - Returned directly from gBS->StartImage ()
-
- ExitData - Returned directly from gBS->StartImage ()
-
-Returns:
-
- EFI_SUCCESS - Status from gBS->StartImage (),
- or BdsBootByDiskSignatureAndPartition ()
-
- EFI_NOT_FOUND - If the Device Path is not found in the system
-
---*/
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EFI_HANDLE ImageHandle;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *FilePath;
- EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
- EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
- VOID *Buffer;
-
- //
- // Record the performance data for End of BDS
- //
- PERF_END (0, BDS_TOK, NULL, 0);
-
- *ExitDataSize = 0;
- *ExitData = NULL;
-
- //
- // Notes: put EFI64 ROM Shadow Solution
- //
- EFI64_SHADOW_ALL_LEGACY_ROM ();
-
- //
- // Notes: this code can be remove after the s3 script table
- // hook on the event EFI_EVENT_SIGNAL_READY_TO_BOOT or
- // EFI_EVENT_SIGNAL_LEGACY_BOOT
- //
- Status = gBS->LocateProtocol (&gEfiAcpiS3SaveProtocolGuid, NULL,
- (VOID **)&AcpiS3Save);
- if (!EFI_ERROR (Status)) {
- AcpiS3Save->S3Save (AcpiS3Save, NULL);
- }
- //
- // If it's Device Path that starts with a hard drive path,
- // this routine will do the booting.
- //
- Status = BdsBootByDiskSignatureAndPartition (
- Option,
- (HARDDRIVE_DEVICE_PATH *) DevicePath,
- Option->LoadOptionsSize,
- Option->LoadOptions,
- ExitDataSize,
- ExitData
- );
- if (!EFI_ERROR (Status)) {
- //
- // If we found a disk signature and partition device path return success
- //
- return EFI_SUCCESS;
- }
-
- EfiSignalEventReadyToBoot ();
-
- //
- // Set Boot Current
- //
- gRT->SetVariable (
- L"BootCurrent",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (UINT16),
- &Option->BootCurrent
- );
-
- if ((DevicePathType (Option->DevicePath) == BBS_DEVICE_PATH) &&
- (DevicePathSubType (Option->DevicePath) == BBS_BBS_DP)
- ) {
- //
- // Check to see if we should legacy BOOT. If yes then do the legacy boot
- //
- return BdsLibDoLegacyBoot (Option);
- }
-
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Booting EFI 1.1 way %S\n", Option->Description));
-
- Status = gBS->LoadImage (
- TRUE,
- mBdsImageHandle,
- DevicePath,
- NULL,
- 0,
- &ImageHandle
- );
-
- //
- // If we didn't find an image, we may need to load the default
- // boot behavior for the device.
- //
- if (EFI_ERROR (Status)) {
- //
- // Find a Simple File System protocol on the device path. If the remaining
- // device path is set to end then no Files are being specified, so try
- // the removable media file name.
- //
- TempDevicePath = DevicePath;
- Status = gBS->LocateDevicePath (
- &gEfiSimpleFileSystemProtocolGuid,
- &TempDevicePath,
- &Handle
- );
- if (!EFI_ERROR (Status) && IsDevicePathEnd (TempDevicePath)) {
- FilePath = FileDevicePath (Handle, EFI_REMOVABLE_MEDIA_FILE_NAME);
- if (FilePath) {
- //
- // Issue a dummy read to the device to check for media change.
- // When the removable media is changed, any Block IO read/write will
- // cause the BlockIo protocol be reinstalled and EFI_MEDIA_CHANGED is
- // returned. After the Block IO protocol is reinstalled, subsequent
- // Block IO read/write will success.
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo
- );
- if (!EFI_ERROR (Status)) {
- Buffer = AllocatePool (BlkIo->Media->BlockSize);
- if (Buffer != NULL) {
- BlkIo->ReadBlocks (
- BlkIo,
- BlkIo->Media->MediaId,
- 0,
- BlkIo->Media->BlockSize,
- Buffer
- );
- gBS->FreePool (Buffer);
- }
- }
-
- Status = gBS->LoadImage (
- TRUE,
- mBdsImageHandle,
- FilePath,
- NULL,
- 0,
- &ImageHandle
- );
- if (EFI_ERROR (Status)) {
- //
- // The DevicePath failed, and it's not a valid
- // removable media device.
- //
- goto Done;
- }
- }
- } else {
- Status = EFI_NOT_FOUND;
- }
- }
-
- if (EFI_ERROR (Status)) {
- //
- // It there is any error from the Boot attempt exit now.
- //
- goto Done;
- }
- //
- // Provide the image with it's load options
- //
- Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid,
- (VOID **) &ImageInfo);
- ASSERT_EFI_ERROR (Status);
-
- if (Option->LoadOptionsSize != 0) {
- ImageInfo->LoadOptionsSize = Option->LoadOptionsSize;
- ImageInfo->LoadOptions = Option->LoadOptions;
- }
- //
- // Before calling the image, enable the Watchdog Timer for
- // the 5 Minute period
- //
- gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);
-
- Status = gBS->StartImage (ImageHandle, ExitDataSize, ExitData);
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Image Return Status = %r\n", Status));
-
- //
- // Clear the Watchdog Timer after the image returns
- //
- gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
-
-Done:
- //
- // Clear Boot Current
- //
- gRT->SetVariable (
- L"BootCurrent",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 0,
- &Option->BootCurrent
- );
-
- return Status;
-}
-
-EFI_STATUS
-BdsBootByDiskSignatureAndPartition (
- IN BDS_COMMON_OPTION * Option,
- IN HARDDRIVE_DEVICE_PATH * HardDriveDevicePath,
- IN UINT32 LoadOptionsSize,
- IN VOID *LoadOptions,
- OUT UINTN *ExitDataSize,
- OUT CHAR16 **ExitData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Check to see if a hard ware device path was passed in. If it was then search
- all the block IO devices for the passed in hard drive device path.
-
-Arguments:
-
- Option - The current processing boot option.
-
- HardDriveDevicePath - EFI Device Path to boot, if it starts with a hard
- drive device path.
-
- LoadOptionsSize - Passed into gBS->StartImage ()
- via the loaded image protocol.
-
- LoadOptions - Passed into gBS->StartImage ()
- via the loaded image protocol.
-
- ExitDataSize - returned directly from gBS->StartImage ()
-
- ExitData - returned directly from gBS->StartImage ()
-
-Returns:
-
- EFI_SUCCESS - Status from gBS->StartImage (),
- or BootByDiskSignatureAndPartition ()
-
- EFI_NOT_FOUND - If the Device Path is not found in the system
-
---*/
-{
- EFI_STATUS Status;
- UINTN BlockIoHandleCount;
- EFI_HANDLE *BlockIoBuffer;
- EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *BlockIoHdDevicePath;
- HARDDRIVE_DEVICE_PATH *TmpHdPath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- UINTN Index;
- BOOLEAN DevicePathMatch;
- HARDDRIVE_DEVICE_PATH *TempPath;
-
- *ExitDataSize = 0;
- *ExitData = NULL;
-
- if ( !((DevicePathType (&HardDriveDevicePath->Header) == MEDIA_DEVICE_PATH) &&
- (DevicePathSubType (&HardDriveDevicePath->Header) == MEDIA_HARDDRIVE_DP))
- ) {
- //
- // If the HardDriveDevicePath does not start with a Hard Drive Device Path
- // exit.
- //
- return EFI_NOT_FOUND;
- }
- //
- // The boot device have already been connected
- //
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &BlockIoHandleCount, &BlockIoBuffer);
- if (EFI_ERROR (Status) || BlockIoHandleCount == 0) {
- //
- // If there was an error or there are no device handles that support
- // the BLOCK_IO Protocol, then return.
- //
- return EFI_NOT_FOUND;
- }
- //
- // Loop through all the device handles that support the BLOCK_IO Protocol
- //
- for (Index = 0; Index < BlockIoHandleCount; Index++) {
-
- Status = gBS->HandleProtocol (BlockIoBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID *) &BlockIoDevicePath);
- if (EFI_ERROR (Status) || BlockIoDevicePath == NULL) {
- continue;
- }
- //
- // Make PreviousDevicePath == the device path node before the end node
- //
- DevicePath = BlockIoDevicePath;
- BlockIoHdDevicePath = NULL;
-
- //
- // find HardDriver device path node
- //
- while (!IsDevicePathEnd (DevicePath)) {
- if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) &&
- (DevicePathSubType (DevicePath) == MEDIA_HARDDRIVE_DP)
- ) {
- BlockIoHdDevicePath = DevicePath;
- break;
- }
-
- DevicePath = NextDevicePathNode (DevicePath);
- }
-
- if (BlockIoHdDevicePath == NULL) {
- continue;
- }
- //
- // See if the harddrive device path in blockio matches the orig Hard Drive Node
- //
- DevicePathMatch = FALSE;
-
- TmpHdPath = (HARDDRIVE_DEVICE_PATH *) BlockIoHdDevicePath;
- TempPath = (HARDDRIVE_DEVICE_PATH *) BdsLibUnpackDevicePath ((EFI_DEVICE_PATH_PROTOCOL *) HardDriveDevicePath);
-
- //
- // Only several fields will be checked. NOT whole NODE
- //
- if ( TmpHdPath->PartitionNumber == TempPath->PartitionNumber &&
- TmpHdPath->MBRType == TempPath->MBRType &&
- TmpHdPath->SignatureType == TempPath->SignatureType &&
- CompareGuid ((EFI_GUID *) TmpHdPath->Signature, (EFI_GUID *) TempPath->Signature)) {
- //
- // Get the matched device path
- //
- DevicePathMatch = TRUE;
- }
- //
- // Only do the boot, when devicepath match
- //
- if (DevicePathMatch) {
- //
- // Combine the Block IO and Hard Drive Device path together and try
- // to boot from it.
- //
- DevicePath = NextDevicePathNode ((EFI_DEVICE_PATH_PROTOCOL *) HardDriveDevicePath);
- NewDevicePath = AppendDevicePath (BlockIoDevicePath, DevicePath);
-
- //
- // Recursive boot with new device path
- //
- Status = BdsLibBootViaBootOption (Option, NewDevicePath, ExitDataSize, ExitData);
- if (!EFI_ERROR (Status)) {
- break;
- }
- }
- }
-
- gBS->FreePool (BlockIoBuffer);
- return Status;
-}
-
-EFI_STATUS
-BdsLibDeleteOptionFromHandle (
- IN EFI_HANDLE Handle
- )
-/*++
-
-Routine Description:
-
- Delete the boot option associated with the handle passed in
-
-Arguments:
-
- Handle - The handle which present the device path to create boot option
-
-Returns:
-
- EFI_SUCCESS - Delete the boot option success
-
- EFI_NOT_FOUND - If the Device Path is not found in the system
-
- EFI_OUT_OF_RESOURCES - Lack of memory resource
-
- Other - Error return value from SetVariable()
-
---*/
-{
- UINT16 *BootOrder;
- UINT8 *BootOptionVar;
- UINTN BootOrderSize;
- UINTN BootOptionSize;
- EFI_STATUS Status;
- UINTN Index;
- UINT16 BootOption[BOOT_OPTION_MAX_CHAR];
- UINTN DevicePathSize;
- UINTN OptionDevicePathSize;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath;
- UINT8 *TempPtr;
- CHAR16 *Description;
-
- Status = EFI_SUCCESS;
- BootOrder = NULL;
- BootOrderSize = 0;
-
- BootOrder = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- if (NULL == BootOrder) {
- return EFI_NOT_FOUND;
- }
-
- DevicePath = DevicePathFromHandle (Handle);
- if (DevicePath == NULL) {
- return EFI_NOT_FOUND;
- }
- DevicePathSize = GetDevicePathSize (DevicePath);
-
- Index = 0;
- while (Index < BootOrderSize / sizeof (UINT16)) {
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOption,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (NULL == BootOptionVar) {
- gBS->FreePool (BootOrder);
- return EFI_OUT_OF_RESOURCES;
- }
-
- TempPtr = BootOptionVar;
- TempPtr += sizeof (UINT32) + sizeof (UINT16);
- Description = (CHAR16 *) TempPtr;
- TempPtr += StrSize ((CHAR16 *) TempPtr);
- OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;
- OptionDevicePathSize = GetDevicePathSize (OptionDevicePath);
-
- //
- // Check whether the device path match
- //
- if ((OptionDevicePathSize == DevicePathSize) &&
- (CompareMem (DevicePath, OptionDevicePath, DevicePathSize) == 0)) {
- BdsDeleteBootOption (BootOrder[Index], BootOrder, &BootOrderSize);
- gBS->FreePool (BootOptionVar);
- break;
- }
-
- gBS->FreePool (BootOptionVar);
- Index++;
- }
-
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- BootOrderSize,
- BootOrder
- );
-
- gBS->FreePool (BootOrder);
-
- return Status;
-}
-
-EFI_STATUS
-BdsDeleteAllInvalidEfiBootOption (
- VOID
- )
-/*++
-
-Routine Description:
-
- Delete all invalid EFI boot options. The probable invalid boot option could
- be Removable media or Network boot device.
-
-Arguments:
-
- VOID
-
-Returns:
-
- EFI_SUCCESS - Delete all invalid boot option success
-
- EFI_NOT_FOUND - Variable "BootOrder" is not found
-
- EFI_OUT_OF_RESOURCES - Lack of memory resource
-
- Other - Error return value from SetVariable()
-
---*/
-{
- UINT16 *BootOrder;
- UINT8 *BootOptionVar;
- UINTN BootOrderSize;
- UINTN BootOptionSize;
- EFI_STATUS Status;
- UINTN Index;
- UINTN Index2;
- UINT16 BootOption[BOOT_OPTION_MAX_CHAR];
- UINTN OptionDevicePathSize;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *LastDeviceNode;
- EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath;
- UINT8 *TempPtr;
- CHAR16 *Description;
- EFI_HANDLE Handle;
- BOOLEAN NeedDelete;
-
- Status = EFI_SUCCESS;
- BootOrder = NULL;
- BootOrderSize = 0;
-
- BootOrder = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- if (NULL == BootOrder) {
- return EFI_NOT_FOUND;
- }
-
- Index = 0;
- while (Index < BootOrderSize / sizeof (UINT16)) {
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOption,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (NULL == BootOptionVar) {
- gBS->FreePool (BootOrder);
- return EFI_OUT_OF_RESOURCES;
- }
-
- TempPtr = BootOptionVar;
- TempPtr += sizeof (UINT32) + sizeof (UINT16);
- Description = (CHAR16 *) TempPtr;
- TempPtr += StrSize ((CHAR16 *) TempPtr);
- OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;
- OptionDevicePathSize = GetDevicePathSize (OptionDevicePath);
-
- //
- // Skip legacy boot option (BBS boot device)
- //
- if ((DevicePathType (OptionDevicePath) == BBS_DEVICE_PATH) &&
- (DevicePathSubType (OptionDevicePath) == BBS_BBS_DP)) {
- gBS->FreePool (BootOptionVar);
- Index++;
- continue;
- }
-
- TempDevicePath = OptionDevicePath;
- LastDeviceNode = OptionDevicePath;
- while (!EfiIsDevicePathEnd (TempDevicePath)) {
- LastDeviceNode = TempDevicePath;
- TempDevicePath = EfiNextDevicePathNode (TempDevicePath);
- }
- //
- // Skip the boot option that point to a file, since the device path in
- // removable media boot option doesn't contains a file name.
- //
- if (((DevicePathType (LastDeviceNode) == MEDIA_DEVICE_PATH) &&
- (DevicePathSubType (LastDeviceNode) == MEDIA_FILEPATH_DP)) ||
- //
- // Skip boot option for internal Shell, it's always valid
- //
- (EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) LastDeviceNode) != NULL)) {
- gBS->FreePool (BootOptionVar);
- Index++;
- continue;
- }
-
- NeedDelete = TRUE;
- //
- // Check if it's a valid boot option for removable media
- //
- TempDevicePath = OptionDevicePath;
- Status = gBS->LocateDevicePath (
- &gEfiSimpleFileSystemProtocolGuid,
- &TempDevicePath,
- &Handle
- );
- if (!EFI_ERROR (Status)) {
- NeedDelete = FALSE;
- }
- //
- // Check if it's a valid boot option for network boot device
- //
- TempDevicePath = OptionDevicePath;
- Status = gBS->LocateDevicePath (
- &gEfiLoadFileProtocolGuid,
- &TempDevicePath,
- &Handle
- );
- if (!EFI_ERROR (Status)) {
- NeedDelete = FALSE;
- }
-
- if (NeedDelete) {
- //
- // Delete this invalid boot option "Boot####"
- //
- Status = gRT->SetVariable (
- BootOption,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- NULL
- );
- //
- // Mark this boot option in boot order as deleted
- //
- BootOrder[Index] = 0xffff;
- }
-
- gBS->FreePool (BootOptionVar);
- Index++;
- }
-
- //
- // Adjust boot order array
- //
- Index2 = 0;
- for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
- if (BootOrder[Index] != 0xffff) {
- BootOrder[Index2] = BootOrder[Index];
- Index2 ++;
- }
- }
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- Index2 * sizeof (UINT16),
- BootOrder
- );
-
- gBS->FreePool (BootOrder);
-
- return Status;
-}
-
-EFI_STATUS
-BdsLibEnumerateAllBootOption (
- IN OUT LIST_ENTRY *BdsBootOptionList
- )
-/*++
-
-Routine Description:
-
- This function will enumerate all possible boot device in the system,
- it will only excute once of every boot.
-
-Arguments:
-
- BdsBootOptionList - The header of the link list which indexed all
- current boot options
-
-Returns:
-
- EFI_SUCCESS - Finished all the boot device enumerate and create
- the boot option base on that boot device
-
---*/
-{
- EFI_STATUS Status;
- UINT16 BootOptionNumber;
- UINTN NumberFileSystemHandles;
- EFI_HANDLE *FileSystemHandles;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
- UINTN Index;
- UINTN NumberLoadFileHandles;
- EFI_HANDLE *LoadFileHandles;
- VOID *ProtocolInstance;
- EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
- UINTN FvHandleCount;
- EFI_HANDLE *FvHandleBuffer;
- EFI_FV_FILETYPE Type;
- UINTN Size;
- EFI_FV_FILE_ATTRIBUTES Attributes;
- UINT32 AuthenticationStatus;
- EFI_DEVICE_PATH_PROTOCOL *FilePath;
- EFI_HANDLE ImageHandle;
- EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
- BOOLEAN NeedDelete;
-
- BootOptionNumber = 0;
-
- //
- // If the boot device enumerate happened, just get the boot
- // device from the boot order variable
- //
- if (mEnumBootDevice) {
- BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");
- return EFI_SUCCESS;
- }
- //
- // Notes: this dirty code is to get the legacy boot option from the
- // BBS table and create to variable as the EFI boot option, it should
- // be removed after the CSM can provide legacy boot option directly
- //
- REFRESH_LEGACY_BOOT_OPTIONS;
-
- //
- // Delete invalid boot option
- //
- BdsDeleteAllInvalidEfiBootOption ();
- //
- // Parse removable media
- //
- gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleFileSystemProtocolGuid,
- NULL,
- &NumberFileSystemHandles,
- &FileSystemHandles
- );
- for (Index = 0; Index < NumberFileSystemHandles; Index++) {
- Status = gBS->HandleProtocol (
- FileSystemHandles[Index],
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo
- );
- if (!EFI_ERROR (Status)) {
- if (!BlkIo->Media->RemovableMedia) {
- //
- // If the file system handle supports a BlkIo protocol,
- // skip the removable media devices
- //
- continue;
- }
- }
-
- //
- // Do the removable Media thing. \EFI\BOOT\boot{machinename}.EFI
- // machinename is ia32, ia64, x64, ...
- //
- FilePath = FileDevicePath (FileSystemHandles[Index], EFI_REMOVABLE_MEDIA_FILE_NAME);
- NeedDelete = TRUE;
- Status = gBS->LoadImage (
- TRUE,
- mBdsImageHandle,
- FilePath,
- NULL,
- 0,
- &ImageHandle
- );
- if (!EFI_ERROR(Status)) {
- //
- // Verify the image is a EFI application (and not a driver)
- //
- Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &ImageInfo);
- ASSERT (!EFI_ERROR(Status));
-
- if (ImageInfo->ImageCodeType == EfiLoaderCode) {
- NeedDelete = FALSE;
- }
- }
-
- if (NeedDelete) {
- //
- // No such file or the file is not a EFI application, delete this boot option
- //
- BdsLibDeleteOptionFromHandle (FileSystemHandles[Index]);
- } else {
- BdsLibBuildOptionFromHandle (FileSystemHandles[Index], BdsBootOptionList);
- BootOptionNumber++;
- }
- }
-
- if (NumberFileSystemHandles) {
- gBS->FreePool (FileSystemHandles);
- }
- //
- // Parse Network Boot Device
- //
- gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleNetworkProtocolGuid,
- NULL,
- &NumberLoadFileHandles,
- &LoadFileHandles
- );
- for (Index = 0; Index < NumberLoadFileHandles; Index++) {
- Status = gBS->HandleProtocol (
- LoadFileHandles[Index],
- &gEfiLoadFileProtocolGuid,
- (VOID **) &ProtocolInstance
- );
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- BdsLibBuildOptionFromHandle (LoadFileHandles[Index], BdsBootOptionList);
- BootOptionNumber++;
- }
-
- if (NumberLoadFileHandles) {
- gBS->FreePool (LoadFileHandles);
- }
- //
- // Check if we have on flash shell
- //
- gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolumeProtocolGuid,
- NULL,
- &FvHandleCount,
- &FvHandleBuffer
- );
- for (Index = 0; Index < FvHandleCount; Index++) {
- gBS->HandleProtocol (
- FvHandleBuffer[Index],
- &gEfiFirmwareVolumeProtocolGuid,
- (VOID **) &Fv
- );
-
- Status = Fv->ReadFile (
- Fv,
- &gEfiShellFileGuid,
- NULL,
- &Size,
- &Type,
- &Attributes,
- &AuthenticationStatus
- );
- if (EFI_ERROR (Status)) {
- //
- // Skip if no shell file in the FV
- //
- continue;
- }
- //
- // Build the shell boot option
- //
- BdsLibBuildOptionFromShell (FvHandleBuffer[Index], BdsBootOptionList);
- BootOptionNumber++;
- }
-
- if (FvHandleCount) {
- gBS->FreePool (FvHandleBuffer);
- }
- //
- // Make sure every boot only have one time
- // boot device enumerate
- //
- BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");
- mEnumBootDevice = TRUE;
-
- return EFI_SUCCESS;
-}
-
-VOID
-BdsLibBuildOptionFromHandle (
- IN EFI_HANDLE Handle,
- IN LIST_ENTRY *BdsBootOptionList
- )
-/*++
-
-Routine Description:
-
- Build the boot option with the handle parsed in
-
-Arguments:
-
- Handle - The handle which present the device path to create boot option
-
- BdsBootOptionList - The header of the link list which indexed all current
- boot options
-
-Returns:
-
- VOID
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- CHAR16 *TempString;
-
- DevicePath = DevicePathFromHandle (Handle);
- TempString = DevicePathToStr (DevicePath);
-
- //
- // Create and register new boot option
- //
- BdsLibRegisterNewOption (BdsBootOptionList, DevicePath, TempString, L"BootOrder");
-}
-
-VOID
-BdsLibBuildOptionFromShell (
- IN EFI_HANDLE Handle,
- IN OUT LIST_ENTRY *BdsBootOptionList
- )
-/*++
-
-Routine Description:
-
- Build the on flash shell boot option with the handle parsed in
-
-Arguments:
-
- Handle - The handle which present the device path to create on flash shell
- boot option
-
- BdsBootOptionList - The header of the link list which indexed all current
- boot options
-
-Returns:
-
- None
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH ShellNode;
-
- DevicePath = DevicePathFromHandle (Handle);
-
- //
- // Build the shell device path
- //
- EfiInitializeFwVolDevicepathNode (&ShellNode, &gEfiShellFileGuid);
- DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &ShellNode);
-
- //
- // Create and register the shell boot option
- //
- BdsLibRegisterNewOption (BdsBootOptionList, DevicePath, L"Internal EFI Shell", L"BootOrder");
-
-}
-
-VOID
-BdsLibBootNext (
- VOID
- )
-/*++
-
-Routine Description:
-
- Boot from the EFI1.1 spec defined "BootNext" variable
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- UINT16 *BootNext;
- UINTN BootNextSize;
- CHAR16 Buffer[20];
- BDS_COMMON_OPTION *BootOption;
- LIST_ENTRY TempList;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
-
- //
- // Init the boot option name buffer and temp link list
- //
- InitializeListHead (&TempList);
- ZeroMem (Buffer, sizeof (Buffer));
-
- BootNext = BdsLibGetVariableAndSize (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- &BootNextSize
- );
-
- //
- // Clear the boot next variable first
- //
- if (BootNext != NULL) {
- gRT->SetVariable (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- BootNext
- );
-
- //
- // Start to build the boot option and try to boot
- //
- UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *BootNext);
- BootOption = BdsLibVariableToOption (&TempList, Buffer);
- BdsLibConnectDevicePath (BootOption->DevicePath);
- BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
- }
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/BdsConnect.c b/EdkModulePkg/Library/EdkGenericBdsLib/BdsConnect.c
deleted file mode 100644
index 9c649f1..0000000
--- a/EdkModulePkg/Library/EdkGenericBdsLib/BdsConnect.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsConnect.c
-
-Abstract:
-
- BDS Lib functions which relate with connect the device
-
---*/
-
-VOID
-BdsLibConnectAll (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will connect all the system driver to controller
- first, and then special connect the default console, this make
- sure all the system controller avialbe and the platform default
- console connected.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- //
- // Connect the platform console first
- //
- BdsLibConnectAllDefaultConsoles ();
-
- //
- // Generic way to connect all the drivers
- //
- BdsLibConnectAllDriversToAllControllers ();
-
- //
- // Here we have the assumption that we have already had
- // platform default console
- //
- BdsLibConnectAllDefaultConsoles ();
-}
-
-VOID
-BdsLibGenericConnectAll (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will connect all the system drivers to all controllers
- first, and then connect all the console devices the system current
- have. After this we should get all the device work and console avariable
- if the system have console device.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- //
- // Most generic way to connect all the drivers
- //
- BdsLibConnectAllDriversToAllControllers ();
- BdsLibConnectAllConsoles ();
-}
-
-EFI_STATUS
-BdsLibConnectDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
- )
-/*++
-
-Routine Description:
- This function will create all handles associate with every device
- path node. If the handle associate with one device path node can not
- be created success, then still give one chance to do the dispatch,
- which load the missing drivers if possible.
-
-Arguments:
-
- DevicePathToConnect - The device path which will be connected, it can
- be a multi-instance device path
-
-Returns:
-
- EFI_SUCCESS - All handles associate with every device path
- node have been created
-
- EFI_OUT_OF_RESOURCES - There is no resource to create new handles
-
- EFI_NOT_FOUND - Create the handle associate with one device
- path node failed
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *Instance;
- EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *Next;
- EFI_HANDLE Handle;
- EFI_HANDLE PreviousHandle;
- UINTN Size;
-
- if (DevicePathToConnect == NULL) {
- return EFI_SUCCESS;
- }
-
- DevicePath = DuplicateDevicePath (DevicePathToConnect);
- CopyOfDevicePath = DevicePath;
- if (DevicePath == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- do {
- //
- // The outer loop handles multi instance device paths.
- // Only console variables contain multiple instance device paths.
- //
- // After this call DevicePath points to the next Instance
- //
- Instance = GetNextDevicePathInstance (&DevicePath, &Size);
- Next = Instance;
- while (!IsDevicePathEndType (Next)) {
- Next = NextDevicePathNode (Next);
- }
-
- SetDevicePathEndNode (Next);
-
- //
- // Start the real work of connect with RemainingDevicePath
- //
- PreviousHandle = NULL;
- do {
- //
- // Find the handle that best matches the Device Path. If it is only a
- // partial match the remaining part of the device path is returned in
- // RemainingDevicePath.
- //
- RemainingDevicePath = Instance;
- Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);
-
- if (!EFI_ERROR (Status)) {
- if (Handle == PreviousHandle) {
- //
- // If no forward progress is made try invoking the Dispatcher.
- // A new FV may have been added to the system an new drivers
- // may now be found.
- // Status == EFI_SUCCESS means a driver was dispatched
- // Status == EFI_NOT_FOUND means no new drivers were dispatched
- //
- Status = gDS->Dispatch ();
- }
-
- if (!EFI_ERROR (Status)) {
- PreviousHandle = Handle;
- //
- // Connect all drivers that apply to Handle and RemainingDevicePath,
- // the Recursive flag is FALSE so only one level will be expanded.
- //
- // Do not check the connect status here, if the connect controller fail,
- // then still give the chance to do dispatch, because partial
- // RemainingDevicepath may be in the new FV
- //
- // 1. If the connect fail, RemainingDevicepath and handle will not
- // change, so next time will do the dispatch, then dispatch's status
- // will take effect
- // 2. If the connect success, the RemainingDevicepath and handle will
- // change, then avoid the dispatch, we have chance to continue the
- // next connection
- //
- gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
- }
- }
- //
- // Loop until RemainingDevicePath is an empty device path
- //
- } while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath));
-
- } while (DevicePath != NULL);
-
- if (CopyOfDevicePath != NULL) {
- gBS->FreePool (CopyOfDevicePath);
- }
- //
- // All handle with DevicePath exists in the handle database
- //
- return Status;
-}
-
-EFI_STATUS
-BdsLibConnectAllEfi (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will connect all current system handles recursively. The
- connection will finish until every handle's child handle created if it have.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - All handles and it's child handle have been connected
-
- EFI_STATUS - Return the status of gBS->LocateHandleBuffer().
-
---*/
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
-
- Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
- }
-
- gBS->FreePool (HandleBuffer);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BdsLibDisconnectAllEfi (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will disconnect all current system handles. The disconnection
- will finish until every handle have been disconnected.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - All handles have been disconnected
-
- EFI_STATUS - Return the status of gBS->LocateHandleBuffer().
-
---*/
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
-
- //
- // Disconnect all
- //
- Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
- }
-
- gBS->FreePool (HandleBuffer);
-
- return EFI_SUCCESS;
-}
-
-VOID
-BdsLibConnectAllDriversToAllControllers (
- VOID
- )
-/*++
-
-Routine Description:
-
- Connects all drivers to all controllers.
- This function make sure all the current system driver will manage
- the correspoinding controllers if have. And at the same time, make
- sure all the system controllers have driver to manage it if have.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
-
- do {
- //
- // Connect All EFI 1.10 drivers following EFI 1.10 algorithm
- //
- BdsLibConnectAllEfi ();
-
- //
- // Check to see if it's possible to dispatch an more DXE drivers.
- // The BdsLibConnectAllEfi () may have made new DXE drivers show up.
- // If anything is Dispatched Status == EFI_SUCCESS and we will try
- // the connect again.
- //
- Status = gDS->Dispatch ();
-
- } while (!EFI_ERROR (Status));
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/BdsConsole.c b/EdkModulePkg/Library/EdkGenericBdsLib/BdsConsole.c
deleted file mode 100644
index 300c199..0000000
--- a/EdkModulePkg/Library/EdkGenericBdsLib/BdsConsole.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsConsole.c
-
-Abstract:
-
- BDS Lib functions which contain all the code to connect console device
-
---*/
-
-BOOLEAN
-IsNvNeed (
- IN CHAR16 *ConVarName
- )
-{
- CHAR16 *Ptr;
-
- Ptr = ConVarName;
-
- //
- // If the variable includes "Dev" at last, we consider
- // it does not support NV attribute.
- //
- while (*Ptr) {
- Ptr++;
- }
-
- if ((*(Ptr - 3) == 'D') && (*(Ptr - 2) == 'e') && (*(Ptr - 1) == 'v')) {
- return FALSE;
- } else {
- return TRUE;
- }
-}
-
-EFI_STATUS
-BdsLibUpdateConsoleVariable (
- IN CHAR16 *ConVarName,
- IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
- )
-/*++
-
-Routine Description:
-
- This function update console variable based on ConVarName, it can
- add or remove one specific console device path from the variable
-
-Arguments:
-
- ConVarName - Console related variable name, ConIn, ConOut, ErrOut.
-
- CustomizedConDevicePath - The console device path which will be added to
- the console variable ConVarName, this parameter
- can not be multi-instance.
-
- ExclusiveDevicePath - The console device path which will be removed
- from the console variable ConVarName, this
- parameter can not be multi-instance.
-
-Returns:
-
- EFI_UNSUPPORTED - Add or remove the same device path.
-
- EFI_SUCCESS - Success add or remove the device path from
- the console variable.
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *VarConsole;
- UINTN DevicePathSize;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath;
- UINT32 Attributes;
-
- VarConsole = NULL;
- DevicePathSize = 0;
- Status = EFI_UNSUPPORTED;
-
- //
- // Notes: check the device path point, here should check
- // with compare memory
- //
- if (CustomizedConDevicePath == ExclusiveDevicePath) {
- return EFI_UNSUPPORTED;
- }
- //
- // Delete the ExclusiveDevicePath from current default console
- //
- VarConsole = BdsLibGetVariableAndSize (
- ConVarName,
- &gEfiGlobalVariableGuid,
- &DevicePathSize
- );
-
- //
- // Initialize NewDevicePath
- //
- NewDevicePath = VarConsole;
-
- //
- // If ExclusiveDevicePath is even the part of the instance in VarConsole, delete it.
- // In the end, NewDevicePath is the final device path.
- //
- if (ExclusiveDevicePath != NULL && VarConsole != NULL) {
- NewDevicePath = BdsLibDelPartMatchInstance (VarConsole, ExclusiveDevicePath);
- }
- //
- // Try to append customized device path to NewDevicePath.
- //
- if (CustomizedConDevicePath != NULL) {
- if (!BdsLibMatchDevicePaths (NewDevicePath, CustomizedConDevicePath)) {
- //
- // Check if there is part of CustomizedConDevicePath in NewDevicePath, delete it.
- //
- NewDevicePath = BdsLibDelPartMatchInstance (NewDevicePath, CustomizedConDevicePath);
- //
- // In the first check, the default console variable will be null,
- // just append current customized device path
- //
- TempNewDevicePath = NewDevicePath;
- NewDevicePath = AppendDevicePathInstance (NewDevicePath, CustomizedConDevicePath);
- BdsLibSafeFreePool(TempNewDevicePath);
- }
- }
-
- //
- // The attribute for ConInDev, ConOutDev and ErrOutDev does not include NV.
- //
- if (IsNvNeed(ConVarName)) {
- //
- // ConVarName has NV attribute.
- //
- Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
- } else {
- //
- // ConVarName does not have NV attribute.
- //
- Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
- }
-
- //
- // Finally, Update the variable of the default console by NewDevicePath
- //
- gRT->SetVariable (
- ConVarName,
- &gEfiGlobalVariableGuid,
- Attributes,
- GetDevicePathSize (NewDevicePath),
- NewDevicePath
- );
-
- if (VarConsole == NewDevicePath) {
- BdsLibSafeFreePool(VarConsole);
- } else {
- BdsLibSafeFreePool(VarConsole);
- BdsLibSafeFreePool(NewDevicePath);
- }
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-BdsLibConnectConsoleVariable (
- IN CHAR16 *ConVarName
- )
-/*++
-
-Routine Description:
-
- Connect the console device base on the variable ConVarName, if
- device path of the ConVarName is multi-instance device path, if
- anyone of the instances is connected success, then this function
- will return success.
-
-Arguments:
-
- ConVarName - Console related variable name, ConIn, ConOut, ErrOut.
-
-Returns:
-
- EFI_NOT_FOUND - There is not any console devices connected success
-
- EFI_SUCCESS - Success connect any one instance of the console
- device path base on the variable ConVarName.
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *StartDevicePath;
- UINTN VariableSize;
- EFI_DEVICE_PATH_PROTOCOL *Instance;
- EFI_DEVICE_PATH_PROTOCOL *Next;
- EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
- UINTN Size;
- BOOLEAN DeviceExist;
-
- Status = EFI_SUCCESS;
- DeviceExist = FALSE;
-
- //
- // Check if the console variable exist
- //
- StartDevicePath = BdsLibGetVariableAndSize (
- ConVarName,
- &gEfiGlobalVariableGuid,
- &VariableSize
- );
- if (StartDevicePath == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- CopyOfDevicePath = StartDevicePath;
- do {
- //
- // Check every instance of the console variable
- //
- Instance = GetNextDevicePathInstance (&CopyOfDevicePath, &Size);
- Next = Instance;
- while (!IsDevicePathEndType (Next)) {
- Next = NextDevicePathNode (Next);
- }
-
- SetDevicePathEndNode (Next);
-
- //
- // Connect the instance device path
- //
- Status = BdsLibConnectDevicePath (Instance);
- if (EFI_ERROR (Status)) {
- //
- // Delete the instance from the console varialbe
- //
- BdsLibUpdateConsoleVariable (ConVarName, NULL, Instance);
- } else {
- DeviceExist = TRUE;
- }
- BdsLibSafeFreePool(Instance);
- } while (CopyOfDevicePath != NULL);
-
- gBS->FreePool (StartDevicePath);
-
- if (DeviceExist == FALSE) {
- return EFI_NOT_FOUND;
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-BdsLibConnectAllConsoles (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will search every simpletxt devive in current system,
- and make every simpletxt device as pertantial console device.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_DEVICE_PATH_PROTOCOL *ConDevicePath;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
-
- Index = 0;
- HandleCount = 0;
- HandleBuffer = NULL;
- ConDevicePath = NULL;
-
- //
- // Update all the console variables
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleTextInProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ConDevicePath
- );
- BdsLibUpdateConsoleVariable (L"ConIn", ConDevicePath, NULL);
- }
-
- BdsLibSafeFreePool(HandleBuffer);
-
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleTextOutProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ConDevicePath
- );
- BdsLibUpdateConsoleVariable (L"ConOut", ConDevicePath, NULL);
- BdsLibUpdateConsoleVariable (L"ErrOut", ConDevicePath, NULL);
- }
-
- BdsLibSafeFreePool(HandleBuffer);
-
- //
- // Connect all console variables
- //
- BdsLibConnectAllDefaultConsoles ();
-
-}
-
-EFI_STATUS
-BdsLibConnectAllDefaultConsoles (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will connect console device base on the console
- device variable ConIn, ConOut and ErrOut.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - At least one of the ConIn and ConOut device have
- been connected success.
-
- EFI_STATUS - Return the status of BdsLibConnectConsoleVariable ().
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Connect all default console variables
- //
- Status = BdsLibConnectConsoleVariable (L"ConIn");
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = BdsLibConnectConsoleVariable (L"ConOut");
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Special treat the err out device, becaues the null
- // err out var is legal.
- //
- BdsLibConnectConsoleVariable (L"ErrOut");
-
- return EFI_SUCCESS;
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/BdsMisc.c b/EdkModulePkg/Library/EdkGenericBdsLib/BdsMisc.c
deleted file mode 100644
index f159184..0000000
--- a/EdkModulePkg/Library/EdkGenericBdsLib/BdsMisc.c
+++ /dev/null
@@ -1,1089 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsMisc.c
-
-Abstract:
-
- Misc BDS library function
-
---*/
-
-#define MAX_STRING_LEN 200
-static BOOLEAN mFeaturerSwitch = TRUE;
-static BOOLEAN mResetRequired = FALSE;
-extern UINT16 gPlatformBootTimeOutDefault;
-
-UINT16
-BdsLibGetTimeout (
- VOID
- )
-/*++
-
-Routine Description:
-
- Return the default value for system Timeout variable.
-
-Arguments:
-
- None
-
-Returns:
-
- Timeout value.
-
---*/
-{
- UINT16 Timeout;
- UINTN Size;
- EFI_STATUS Status;
-
- //
- // Return Timeout variable or 0xffff if no valid
- // Timeout variable exists.
- //
- Size = sizeof (UINT16);
- Status = gRT->GetVariable (L"Timeout", &gEfiGlobalVariableGuid, NULL, &Size, &Timeout);
- if (!EFI_ERROR (Status)) {
- return Timeout;
- }
- //
- // To make the current EFI Automatic-Test activity possible, just add
- // following code to make AutoBoot enabled when this variable is not
- // present.
- // This code should be removed later.
- //
- Timeout = gPlatformBootTimeOutDefault;
-
- //
- // Notes: Platform should set default variable if non exists on all error cases!!!
- //
- Status = gRT->SetVariable (
- L"Timeout",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof (UINT16),
- &Timeout
- );
- return Timeout;
-}
-
-VOID
-BdsLibLoadDrivers (
- IN LIST_ENTRY *BdsDriverLists
- )
-/*++
-
-Routine Description:
-
- The function will go through the driver optoin link list, load and start
- every driver the driver optoin device path point to.
-
-Arguments:
-
- BdsDriverLists - The header of the current driver option link list
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- BDS_COMMON_OPTION *Option;
- EFI_HANDLE ImageHandle;
- EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
- BOOLEAN ReconnectAll;
-
- ReconnectAll = FALSE;
-
- //
- // Process the driver option
- //
- for (Link = BdsDriverLists->ForwardLink; Link != BdsDriverLists; Link = Link->ForwardLink) {
- Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
- //
- // If a load option is not marked as LOAD_OPTION_ACTIVE,
- // the boot manager will not automatically load the option.
- //
- if (!IS_LOAD_OPTION_TYPE (Option->Attribute, LOAD_OPTION_ACTIVE)) {
- continue;
- }
- //
- // If a driver load option is marked as LOAD_OPTION_FORCE_RECONNECT,
- // then all of the EFI drivers in the system will be disconnected and
- // reconnected after the last driver load option is processed.
- //
- if (IS_LOAD_OPTION_TYPE (Option->Attribute, LOAD_OPTION_FORCE_RECONNECT)) {
- ReconnectAll = TRUE;
- }
- //
- // Make sure the driver path is connected.
- //
- BdsLibConnectDevicePath (Option->DevicePath);
-
- //
- // Load and start the image that Driver#### describes
- //
- Status = gBS->LoadImage (
- FALSE,
- mBdsImageHandle,
- Option->DevicePath,
- NULL,
- 0,
- &ImageHandle
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid,
- (VOID **)&ImageInfo);
-
- //
- // Verify whether this image is a driver, if not,
- // exit it and continue to parse next load option
- //
- if (ImageInfo->ImageCodeType != EfiBootServicesCode && ImageInfo->ImageCodeType != EfiRuntimeServicesCode) {
- gBS->Exit (ImageHandle, EFI_INVALID_PARAMETER, 0, NULL);
- continue;
- }
-
- if (Option->LoadOptionsSize != 0) {
- ImageInfo->LoadOptionsSize = Option->LoadOptionsSize;
- ImageInfo->LoadOptions = Option->LoadOptions;
- }
- //
- // Before calling the image, enable the Watchdog Timer for
- // the 5 Minute period
- //
- gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);
-
- Status = gBS->StartImage (ImageHandle, &ExitDataSize, &ExitData);
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Driver Return Status = %r\n", Status));
-
- //
- // Clear the Watchdog Timer after the image returns
- //
- gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
- }
- }
- //
- // Process the LOAD_OPTION_FORCE_RECONNECT driver option
- //
- if (ReconnectAll) {
- BdsLibDisconnectAllEfi ();
- BdsLibConnectAll ();
- }
-
-}
-
-EFI_STATUS
-BdsLibRegisterNewOption (
- IN LIST_ENTRY *BdsOptionList,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CHAR16 *String,
- IN CHAR16 *VariableName
- )
-/*++
-
-Routine Description:
-
- This function will register the new boot#### or driver#### option base on
- the VariableName. The new registered boot#### or driver#### will be linked
- to BdsOptionList and also update to the VariableName. After the boot#### or
- driver#### updated, the BootOrder or DriverOrder will also be updated.
-
-Arguments:
-
- BdsOptionList - The header of the boot#### or driver#### link list
-
- DevicePath - The device path which the boot####
- or driver#### option present
-
- String - The description of the boot#### or driver####
-
- VariableName - Indicate if the boot#### or driver#### option
-
-Returns:
-
- EFI_SUCCESS - The boot#### or driver#### have been success registered
-
- EFI_STATUS - Return the status of gRT->SetVariable ().
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- UINT16 MaxOptionNumber;
- UINT16 RegisterOptionNumber;
- UINT16 *TempOptionPtr;
- UINTN TempOptionSize;
- UINT16 *OptionOrderPtr;
- VOID *OptionPtr;
- UINTN OptionSize;
- UINT8 *TempPtr;
- EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath;
- CHAR16 *Description;
- CHAR16 OptionName[10];
- BOOLEAN UpdateBootDevicePath;
-
- OptionPtr = NULL;
- OptionSize = 0;
- TempPtr = NULL;
- OptionDevicePath = NULL;
- Description = NULL;
- MaxOptionNumber = 0;
- OptionOrderPtr = NULL;
- UpdateBootDevicePath = FALSE;
- ZeroMem (OptionName, sizeof (OptionName));
-
- TempOptionSize = 0;
- TempOptionPtr = BdsLibGetVariableAndSize (
- VariableName,
- &gEfiGlobalVariableGuid,
- &TempOptionSize
- );
- //
- // Compare with current option variable
- //
- for (Index = 0; Index < TempOptionSize / sizeof (UINT16); Index++) {
- //
- // Got the max option#### number
- //
- if (MaxOptionNumber < TempOptionPtr[Index]) {
- MaxOptionNumber = TempOptionPtr[Index];
- }
-
- if (*VariableName == 'B') {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]);
- } else {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", TempOptionPtr[Index]);
- }
-
- OptionPtr = BdsLibGetVariableAndSize (
- OptionName,
- &gEfiGlobalVariableGuid,
- &OptionSize
- );
- TempPtr = OptionPtr;
- TempPtr += sizeof (UINT32) + sizeof (UINT16);
- Description = (CHAR16 *) TempPtr;
- TempPtr += StrSize ((CHAR16 *) TempPtr);
- OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;
-
- //
- // Notes: the description may will change base on the GetStringToken
- //
- if (CompareMem (Description, String, StrSize (Description)) == 0) {
- if (CompareMem (OptionDevicePath, DevicePath, GetDevicePathSize (OptionDevicePath)) == 0) {
- //
- // Got the option, so just return
- //
- gBS->FreePool (OptionPtr);
- gBS->FreePool (TempOptionPtr);
- return EFI_SUCCESS;
- } else {
- //
- // Boot device path changed, need update.
- //
- UpdateBootDevicePath = TRUE;
- break;
- }
- }
-
- gBS->FreePool (OptionPtr);
- }
-
- OptionSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (String) + GetDevicePathSize (DevicePath);
- OptionPtr = AllocateZeroPool (OptionSize);
- TempPtr = OptionPtr;
- *(UINT32 *) TempPtr = LOAD_OPTION_ACTIVE;
- TempPtr += sizeof (UINT32);
- *(UINT16 *) TempPtr = (UINT16) GetDevicePathSize (DevicePath);
- TempPtr += sizeof (UINT16);
- CopyMem (TempPtr, String, StrSize (String));
- TempPtr += StrSize (String);
- CopyMem (TempPtr, DevicePath, GetDevicePathSize (DevicePath));
-
- if (UpdateBootDevicePath) {
- //
- // The number in option#### to be updated
- //
- RegisterOptionNumber = TempOptionPtr[Index];
- } else {
- //
- // The new option#### number
- //
- RegisterOptionNumber = MaxOptionNumber + 1;
- }
-
- if (*VariableName == 'B') {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", RegisterOptionNumber);
- } else {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", RegisterOptionNumber);
- }
-
- Status = gRT->SetVariable (
- OptionName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- OptionSize,
- OptionPtr
- );
- if (EFI_ERROR (Status) || UpdateBootDevicePath) {
- gBS->FreePool (OptionPtr);
- gBS->FreePool (TempOptionPtr);
- return Status;
- }
-
- gBS->FreePool (OptionPtr);
-
- //
- // Update the option order variable
- //
- OptionOrderPtr = AllocateZeroPool ((Index + 1) * sizeof (UINT16));
- CopyMem (OptionOrderPtr, TempOptionPtr, Index * sizeof (UINT16));
- OptionOrderPtr[Index] = RegisterOptionNumber;
- Status = gRT->SetVariable (
- VariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- (Index + 1) * sizeof (UINT16),
- OptionOrderPtr
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (TempOptionPtr);
- gBS->FreePool (OptionOrderPtr);
- return Status;
- }
-
- gBS->FreePool (TempOptionPtr);
- gBS->FreePool (OptionOrderPtr);
-
- return EFI_SUCCESS;
-}
-
-BDS_COMMON_OPTION *
-BdsLibVariableToOption (
- IN OUT LIST_ENTRY *BdsCommonOptionList,
- IN CHAR16 *VariableName
- )
-/*++
-
-Routine Description:
-
- Build the boot#### or driver#### option from the VariableName, the
- build boot#### or driver#### will also be linked to BdsCommonOptionList
-
-Arguments:
-
- BdsCommonOptionList - The header of the boot#### or driver#### option link list
-
- VariableName - EFI Variable name indicate if it is boot#### or driver####
-
-Returns:
-
- BDS_COMMON_OPTION - Get the option just been created
-
- NULL - Failed to get the new option
-
---*/
-{
- UINT32 Attribute;
- UINT16 FilePathSize;
- UINT8 *Variable;
- UINT8 *TempPtr;
- UINTN VariableSize;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- BDS_COMMON_OPTION *Option;
- VOID *LoadOptions;
- UINT32 LoadOptionsSize;
- CHAR16 *Description;
-
- //
- // Read the variable. We will never free this data.
- //
- Variable = BdsLibGetVariableAndSize (
- VariableName,
- &gEfiGlobalVariableGuid,
- &VariableSize
- );
- if (Variable == NULL) {
- return NULL;
- }
- //
- // Notes: careful defined the variable of Boot#### or
- // Driver####, consider use some macro to abstract the code
- //
- //
- // Get the option attribute
- //
- TempPtr = Variable;
- Attribute = *(UINT32 *) Variable;
- TempPtr += sizeof (UINT32);
-
- //
- // Get the option's device path size
- //
- FilePathSize = *(UINT16 *) TempPtr;
- TempPtr += sizeof (UINT16);
-
- //
- // Get the option's description string
- //
- Description = (CHAR16 *) TempPtr;
-
- //
- // Get the option's description string size
- //
- TempPtr += StrSize ((CHAR16 *) TempPtr);
-
- //
- // Get the option's device path
- //
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;
- TempPtr += FilePathSize;
-
- LoadOptions = TempPtr;
- LoadOptionsSize = (UINT32) (VariableSize - (UINTN) (TempPtr - Variable));
-
- //
- // The Console variables may have multiple device paths, so make
- // an Entry for each one.
- //
- Option = AllocateZeroPool (sizeof (BDS_COMMON_OPTION));
- if (Option == NULL) {
- return NULL;
- }
-
- Option->Signature = BDS_LOAD_OPTION_SIGNATURE;
- Option->DevicePath = AllocateZeroPool (GetDevicePathSize (DevicePath));
- CopyMem (Option->DevicePath, DevicePath, GetDevicePathSize (DevicePath));
- Option->Attribute = Attribute;
- Option->Description = AllocateZeroPool (StrSize (Description));
- CopyMem (Option->Description, Description, StrSize (Description));
- Option->LoadOptions = AllocateZeroPool (LoadOptionsSize);
- CopyMem (Option->LoadOptions, LoadOptions, LoadOptionsSize);
- Option->LoadOptionsSize = LoadOptionsSize;
-
- //
- // Insert active entry to BdsDeviceList
- //
- if ((Option->Attribute & LOAD_OPTION_ACTIVE) == LOAD_OPTION_ACTIVE) {
- InsertTailList (BdsCommonOptionList, &Option->Link);
- gBS->FreePool (Variable);
- return Option;
- }
-
- gBS->FreePool (Variable);
- gBS->FreePool (Option);
- return NULL;
-
-}
-
-EFI_STATUS
-BdsLibBuildOptionFromVar (
- IN LIST_ENTRY *BdsCommonOptionList,
- IN CHAR16 *VariableName
- )
-/*++
-
-Routine Description:
-
- Process BootOrder, or DriverOrder variables, by calling
- BdsLibVariableToOption () for each UINT16 in the variables.
-
-Arguments:
-
- BdsCommonOptionList - The header of the option list base on variable
- VariableName
-
- VariableName - EFI Variable name indicate the BootOrder or DriverOrder
-
-Returns:
-
- EFI_SUCCESS - Success create the boot option or driver option list
-
- EFI_OUT_OF_RESOURCES - Failed to get the boot option or driver option list
-
---*/
-{
- UINT16 *OptionOrder;
- UINTN OptionOrderSize;
- UINTN Index;
- BDS_COMMON_OPTION *Option;
- CHAR16 OptionName[20];
-
- //
- // Zero Buffer in order to get all BOOT#### variables
- //
- ZeroMem (OptionName, sizeof (OptionName));
-
- //
- // Read the BootOrder, or DriverOrder variable.
- //
- OptionOrder = BdsLibGetVariableAndSize (
- VariableName,
- &gEfiGlobalVariableGuid,
- &OptionOrderSize
- );
- if (OptionOrder == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- for (Index = 0; Index < OptionOrderSize / sizeof (UINT16); Index++) {
- if (*VariableName == 'B') {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", OptionOrder[Index]);
- } else {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", OptionOrder[Index]);
- }
- Option = BdsLibVariableToOption (BdsCommonOptionList, OptionName);
- Option->BootCurrent = OptionOrder[Index];
-
- }
-
- gBS->FreePool (OptionOrder);
-
- return EFI_SUCCESS;
-}
-
-VOID *
-BdsLibGetVariableAndSize (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid,
- OUT UINTN *VariableSize
- )
-/*++
-
-Routine Description:
-
- Read the EFI variable (VendorGuid/Name) and return a dynamically allocated
- buffer, and the size of the buffer. If failure return NULL.
-
-Arguments:
-
- Name - String part of EFI variable name
-
- VendorGuid - GUID part of EFI variable name
-
- VariableSize - Returns the size of the EFI variable that was read
-
-Returns:
-
- Dynamically allocated memory that contains a copy of the EFI variable.
- Caller is responsible freeing the buffer.
-
- NULL - Variable was not read
-
---*/
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- VOID *Buffer;
-
- Buffer = NULL;
-
- //
- // Pass in a zero size buffer to find the required buffer size.
- //
- BufferSize = 0;
- Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // Allocate the buffer to return
- //
- Buffer = AllocateZeroPool (BufferSize);
- if (Buffer == NULL) {
- return NULL;
- }
- //
- // Read variable into the allocated buffer.
- //
- Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
- if (EFI_ERROR (Status)) {
- BufferSize = 0;
- }
- }
-
- *VariableSize = BufferSize;
- return Buffer;
-}
-
-VOID
-BdsLibSafeFreePool (
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Free pool safely.
-
-Arguments:
-
- Buffer - The allocated pool entry to free
-
-Returns:
-
- Pointer of the buffer allocated.
-
---*/
-{
- if (Buffer != NULL) {
- gBS->FreePool (Buffer);
- Buffer = NULL;
- }
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-BdsLibDelPartMatchInstance (
- IN EFI_DEVICE_PATH_PROTOCOL *Multi,
- IN EFI_DEVICE_PATH_PROTOCOL *Single
- )
-/*++
-
-Routine Description:
-
- Delete the instance in Multi which matches partly with Single instance
-
-Arguments:
-
- Multi - A pointer to a multi-instance device path data structure.
-
- Single - A pointer to a single-instance device path data structure.
-
-Returns:
-
- This function will remove the device path instances in Multi which partly
- match with the Single, and return the result device path. If there is no
- remaining device path as a result, this function will return NULL.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *Instance;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath;
- UINTN InstanceSize;
- UINTN SingleDpSize;
- UINTN Size;
-
- NewDevicePath = NULL;
- TempNewDevicePath = NULL;
-
- if (Multi == NULL || Single == NULL) {
- return Multi;
- }
-
- Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);
- SingleDpSize = GetDevicePathSize (Single) - END_DEVICE_PATH_LENGTH;
- InstanceSize -= END_DEVICE_PATH_LENGTH;
-
- while (Instance != NULL) {
-
- Size = (SingleDpSize < InstanceSize) ? SingleDpSize : InstanceSize;
-
- if ((CompareMem (Instance, Single, Size) != 0)) {
- //
- // Append the device path instance which does not match with Single
- //
- TempNewDevicePath = NewDevicePath;
- NewDevicePath = AppendDevicePathInstance (NewDevicePath, Instance);
- BdsLibSafeFreePool(TempNewDevicePath);
- }
- BdsLibSafeFreePool(Instance);
- Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);
- InstanceSize -= END_DEVICE_PATH_LENGTH;
- }
-
- return NewDevicePath;
-}
-
-BOOLEAN
-BdsLibMatchDevicePaths (
- IN EFI_DEVICE_PATH_PROTOCOL *Multi,
- IN EFI_DEVICE_PATH_PROTOCOL *Single
- )
-/*++
-
-Routine Description:
-
- Function compares a device path data structure to that of all the nodes of a
- second device path instance.
-
-Arguments:
-
- Multi - A pointer to a multi-instance device path data structure.
-
- Single - A pointer to a single-instance device path data structure.
-
-Returns:
-
- TRUE - If the Single is contained within Multi
-
- FALSE - The Single is not match within Multi
-
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
- UINTN Size;
-
- if (!Multi || !Single) {
- return FALSE;
- }
-
- DevicePath = Multi;
- DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
-
- //
- // Search for the match of 'Single' in 'Multi'
- //
- while (DevicePathInst != NULL) {
- //
- // If the single device path is found in multiple device paths,
- // return success
- //
- if (CompareMem (Single, DevicePathInst, Size) == 0) {
- gBS->FreePool (DevicePathInst);
- return TRUE;
- }
-
- gBS->FreePool (DevicePathInst);
- DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-BdsLibOutputStrings (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *ConOut,
- ...
- )
-/*++
-
-Routine Description:
-
- This function prints a series of strings.
-
-Arguments:
-
- ConOut - Pointer to EFI_SIMPLE_TEXT_OUT_PROTOCOL
-
- ... - A variable argument list containing series of strings,
- the last string must be NULL.
-
-Returns:
-
- EFI_SUCCESS - Success print out the string using ConOut.
-
- EFI_STATUS - Return the status of the ConOut->OutputString ().
-
---*/
-{
- VA_LIST args;
- EFI_STATUS Status;
- CHAR16 *String;
-
- Status = EFI_SUCCESS;
- VA_START (args, ConOut);
-
- while (!EFI_ERROR (Status)) {
- //
- // If String is NULL, then it's the end of the list
- //
- String = VA_ARG (args, CHAR16 *);
- if (!String) {
- break;
- }
-
- Status = ConOut->OutputString (ConOut, String);
-
- if (EFI_ERROR (Status)) {
- break;
- }
- }
-
- return Status;
-}
-
-//
-// Following are BDS Lib functions which contain all the code about setup browser reset reminder feature.
-// Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser if
-// user change any option setting which needs a reset to be effective, and the reset will be applied according to the user selection.
-//
-
-VOID
-EnableResetReminderFeature (
- VOID
- )
-/*++
-
-Routine Description:
-
- Enable the setup browser reset reminder feature.
- This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- mFeaturerSwitch = TRUE;
-}
-
-VOID
-DisableResetReminderFeature (
- VOID
- )
-/*++
-
-Routine Description:
-
- Disable the setup browser reset reminder feature.
- This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- mFeaturerSwitch = FALSE;
-}
-
-VOID
-EnableResetRequired (
- VOID
- )
-/*++
-
-Routine Description:
-
- Record the info that a reset is required.
- A module boolean variable is used to record whether a reset is required.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- mResetRequired = TRUE;
-}
-
-VOID
-DisableResetRequired (
- VOID
- )
-/*++
-
-Routine Description:
-
- Record the info that no reset is required.
- A module boolean variable is used to record whether a reset is required.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- mResetRequired = FALSE;
-}
-
-BOOLEAN
-IsResetReminderFeatureEnable (
- VOID
- )
-/*++
-
-Routine Description:
-
- Check whether platform policy enable the reset reminder feature. The default is enabled.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- return mFeaturerSwitch;
-}
-
-BOOLEAN
-IsResetRequired (
- VOID
- )
-/*++
-
-Routine Description:
-
- Check if user changed any option setting which needs a system reset to be effective.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- return mResetRequired;
-}
-
-VOID
-SetupResetReminder (
- VOID
- )
-/*++
-
-Routine Description:
-
- Check whether a reset is needed, and finish the reset reminder feature.
- If a reset is needed, Popup a menu to notice user, and finish the feature
- according to the user selection.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- EFI_STATUS Status;
- EFI_FORM_BROWSER_PROTOCOL *Browser;
- EFI_INPUT_KEY Key;
- CHAR16 *StringBuffer1;
- CHAR16 *StringBuffer2;
-
-
- //
- //check any reset required change is applied? if yes, reset system
- //
- if (IsResetReminderFeatureEnable ()) {
- if (IsResetRequired ()) {
-
- Status = gBS->LocateProtocol (
- &gEfiFormBrowserProtocolGuid,
- NULL,
- (VOID **)&Browser
- );
-
- StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
- ASSERT (StringBuffer1 != NULL);
- StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
- ASSERT (StringBuffer2 != NULL);
- StrCpy (StringBuffer1, L"Configuration changed. Reset to apply it Now ? ");
- StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)");
- //
- // Popup a menu to notice user
- //
- do {
- Browser->CreatePopUp (2, TRUE, 0, NULL, &Key, StringBuffer1, StringBuffer2);
- } while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
-
- gBS->FreePool (StringBuffer1);
- gBS->FreePool (StringBuffer2);
- //
- // If the user hits the YES Response key, reset
- //
- if ((Key.UnicodeChar == CHAR_CARRIAGE_RETURN)) {
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- }
- gST->ConOut->ClearScreen (gST->ConOut);
- }
- }
-}
-
-EFI_STATUS
-BdsLibGetHiiHandles (
- IN EFI_HII_PROTOCOL *Hii,
- IN OUT UINT16 *HandleBufferLength,
- OUT EFI_HII_HANDLE **HiiHandleBuffer
- )
-/*++
-
-Routine Description:
-
- Determines the handles that are currently active in the database.
- It's the caller's responsibility to free handle buffer.
-
-Arguments:
-
- This - A pointer to the EFI_HII_PROTOCOL instance.
- HandleBufferLength - On input, a pointer to the length of the handle buffer. On output,
- the length of the handle buffer that is required for the handles found.
- HiiHandleBuffer - Pointer to an array of EFI_HII_PROTOCOL instances returned.
-
-Returns:
-
- EFI_SUCCESS - Get an array of EFI_HII_PROTOCOL instances successfully.
- EFI_INVALID_PARAMETER - Hii is NULL.
- EFI_NOT_FOUND - Database not found.
-
---*/
-{
- UINT16 TempBufferLength;
- EFI_STATUS Status;
-
- TempBufferLength = 0;
-
- //
- // Try to find the actual buffer size for HiiHandle Buffer.
- //
- Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer);
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- *HiiHandleBuffer = AllocateZeroPool (TempBufferLength);
- Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer);
- //
- // we should not fail here.
- //
- ASSERT_EFI_ERROR (Status);
- }
-
- *HandleBufferLength = TempBufferLength;
-
- return Status;
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/DevicePath.c b/EdkModulePkg/Library/EdkGenericBdsLib/DevicePath.c
deleted file mode 100644
index 253f2a9..0000000
--- a/EdkModulePkg/Library/EdkGenericBdsLib/DevicePath.c
+++ /dev/null
@@ -1,1027 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DevicePath.c
-
-Abstract:
-
- BDS internal function define the default device path string, it can be
- replaced by platform device path.
-
---*/
-
-EFI_GUID mEfiUnixThunkProtocolGuid = EFI_UNIX_THUNK_PROTOCOL_GUID;
-EFI_GUID mEfiUnixUgaGuid = EFI_UNIX_UGA_GUID;
-EFI_GUID mEfiMsgPcAnsiGuid = DEVICE_PATH_MESSAGING_PC_ANSI;
-EFI_GUID mEfiMsgVt100Guid = DEVICE_PATH_MESSAGING_VT_100;
-EFI_GUID mEfiMsgVt100PlusGuid = DEVICE_PATH_MESSAGING_VT_100_PLUS;
-EFI_GUID mEfiMsgVt100Utf8Guid = DEVICE_PATH_MESSAGING_VT_UTF8;
-
-VOID *
-ReallocatePool (
- IN VOID *OldPool,
- IN UINTN OldSize,
- IN UINTN NewSize
- )
-/*++
-
-Routine Description:
-
- Adjusts the size of a previously allocated buffer.
-
-Arguments:
-
- OldPool - A pointer to the buffer whose size is being adjusted.
-
- OldSize - The size of the current buffer.
-
- NewSize - The size of the new buffer.
-
-Returns:
-
- EFI_SUCEESS - The requested number of bytes were allocated.
-
- EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.
-
- EFI_INVALID_PARAMETER - The buffer was invalid.
-
---*/
-{
- VOID *NewPool;
-
- NewPool = NULL;
- if (NewSize) {
- NewPool = AllocateZeroPool (NewSize);
- }
-
- if (OldPool) {
- if (NewPool) {
- CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
- }
-
- gBS->FreePool (OldPool);
- }
-
- return NewPool;
-}
-
-CHAR16 *
-CatPrint (
- IN OUT POOL_PRINT *Str,
- IN CHAR16 *fmt,
- ...
- )
-/*++
-
-Routine Description:
-
- Concatenates a formatted unicode string to allocated pool.
- The caller must free the resulting buffer.
-
-Arguments:
-
- Str - Tracks the allocated pool, size in use, and
- amount of pool allocated.
-
- fmt - The format string
-
-Returns:
-
- Allocated buffer with the formatted string printed in it.
- The caller must free the allocated buffer. The buffer
- allocation is not packed.
-
---*/
-{
- UINT16 *AppendStr;
- VA_LIST args;
- UINTN strsize;
-
- AppendStr = AllocateZeroPool (0x1000);
- if (AppendStr == NULL) {
- return Str->str;
- }
-
- VA_START (args, fmt);
- UnicodeVSPrint (AppendStr, 0x1000, fmt, args);
- VA_END (args);
- if (NULL == Str->str) {
- strsize = StrSize (AppendStr);
- Str->str = AllocateZeroPool (strsize);
- ASSERT (Str->str != NULL);
- } else {
- strsize = StrSize (AppendStr) + StrSize (Str->str) - sizeof (UINT16);
- Str->str = ReallocatePool (
- Str->str,
- StrSize (Str->str),
- strsize
- );
- ASSERT (Str->str != NULL);
- }
-
- Str->maxlen = MAX_CHAR * sizeof (UINT16);
- if (strsize < Str->maxlen) {
- StrCat (Str->str, AppendStr);
- Str->len = strsize - sizeof (UINT16);
- }
-
- gBS->FreePool (AppendStr);
- return Str->str;
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-BdsLibUnpackDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-/*++
-
-Routine Description:
-
- Function unpacks a device path data structure so that all the nodes
- of a device path are naturally aligned.
-
-Arguments:
-
- DevPath - A pointer to a device path data structure
-
-Returns:
-
- If the memory for the device path is successfully allocated, then a
- pointer to the new device path is returned. Otherwise, NULL is returned.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *Src;
- EFI_DEVICE_PATH_PROTOCOL *Dest;
- EFI_DEVICE_PATH_PROTOCOL *NewPath;
- UINTN Size;
-
- //
- // Walk device path and round sizes to valid boundries
- //
- Src = DevPath;
- Size = 0;
- for (;;) {
- Size += DevicePathNodeLength (Src);
- Size += ALIGN_SIZE (Size);
-
- if (IsDevicePathEnd (Src)) {
- break;
- }
-
- Src = NextDevicePathNode (Src);
- }
- //
- // Allocate space for the unpacked path
- //
- NewPath = AllocateZeroPool (Size);
- if (NewPath) {
-
- ASSERT (((UINTN) NewPath) % MIN_ALIGNMENT_SIZE == 0);
-
- //
- // Copy each node
- //
- Src = DevPath;
- Dest = NewPath;
- for (;;) {
- Size = DevicePathNodeLength (Src);
- CopyMem (Dest, Src, Size);
- Size += ALIGN_SIZE (Size);
- SetDevicePathNodeLength (Dest, Size);
- Dest->Type |= EFI_DP_TYPE_UNPACKED;
- Dest = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) Dest) + Size);
-
- if (IsDevicePathEnd (Src)) {
- break;
- }
-
- Src = NextDevicePathNode (Src);
- }
- }
-
- return NewPath;
-}
-
-VOID
-DevPathPci (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- PCI_DEVICE_PATH *Pci;
-
- Pci = DevPath;
- CatPrint (Str, L"Pci(%x|%x)", Pci->Device, Pci->Function);
-}
-
-VOID
-DevPathPccard (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- PCCARD_DEVICE_PATH *Pccard;
-
- Pccard = DevPath;
- CatPrint (Str, L"Pcmcia(Function%x)", Pccard->FunctionNumber);
-}
-
-VOID
-DevPathMemMap (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- MEMMAP_DEVICE_PATH *MemMap;
-
- MemMap = DevPath;
- CatPrint (
- Str,
- L"MemMap(%d:%.lx-%.lx)",
- MemMap->MemoryType,
- MemMap->StartingAddress,
- MemMap->EndingAddress
- );
-}
-
-VOID
-DevPathController (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- CONTROLLER_DEVICE_PATH *Controller;
-
- Controller = DevPath;
- CatPrint (Str, L"Ctrl(%d)", Controller->ControllerNumber);
-}
-
-VOID
-DevPathVendor (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-/*++
-
-Routine Description:
-
- Convert Vendor device path to device name
-
-Arguments:
-
- Str - The buffer store device name
- DevPath - Pointer to vendor device path
-
-Returns:
-
- When it return, the device name have been stored in *Str.
-
---*/
-{
- VENDOR_DEVICE_PATH *Vendor;
- CHAR16 *Type;
- INT32 *Temp;
-
- Vendor = DevPath;
- Temp = (INT32 *) (&Vendor->Guid);
-
- switch (DevicePathType (&Vendor->Header)) {
- case HARDWARE_DEVICE_PATH:
- //
- // If the device is an Unix device, we will give it a readable device name.
- //
- if (CompareGuid (&Vendor->Guid, &mEfiUnixThunkProtocolGuid)) {
- CatPrint (Str, L"%s", L"UnixBus");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &mEfiUnixUgaGuid)) {
- CatPrint (Str, L"%s", L"UGA");
- return ;
- } else {
- Type = L"Hw";
- break;
- }
-
- case MESSAGING_DEVICE_PATH:
- //
- // If the device is an Unix device, we will give it a readable device name.
- //
- if (CompareGuid (&Vendor->Guid, &mEfiMsgPcAnsiGuid)) {
- CatPrint (Str, L"%s", L"PC-ANSI");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100Guid)) {
- CatPrint (Str, L"%s", L"VT100");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100PlusGuid)) {
- CatPrint (Str, L"%s", L"VT100+");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100Utf8Guid)) {
- CatPrint (Str, L"%s", L"VT100-UTF8");
- return ;
- } else {
- Type = L"Msg";
- break;
- }
-
- case MEDIA_DEVICE_PATH:
- Type = L"Media";
- break;
-
- default:
- Type = L"?";
- break;
- }
-
- CatPrint (Str, L"Ven%s(%g)", Type, &Vendor->Guid);
-}
-
-VOID
-DevPathAcpi (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- ACPI_HID_DEVICE_PATH *Acpi;
-
- Acpi = DevPath;
- if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
- CatPrint (Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
- } else {
- CatPrint (Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);
- }
-}
-
-VOID
-DevPathAtapi (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- ATAPI_DEVICE_PATH *Atapi;
-
- Atapi = DevPath;
- CatPrint (
- Str,
- L"Ata(%s,%s)",
- Atapi->PrimarySecondary ? L"Secondary" : L"Primary",
- Atapi->SlaveMaster ? L"Slave" : L"Master"
- );
-}
-
-VOID
-DevPathScsi (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- SCSI_DEVICE_PATH *Scsi;
-
- Scsi = DevPath;
- CatPrint (Str, L"Scsi(Pun%x,Lun%x)", Scsi->Pun, Scsi->Lun);
-}
-
-VOID
-DevPathFibre (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- FIBRECHANNEL_DEVICE_PATH *Fibre;
-
- Fibre = DevPath;
- CatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun);
-}
-
-VOID
-DevPath1394 (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- F1394_DEVICE_PATH *F1394;
-
- F1394 = DevPath;
- CatPrint (Str, L"1394(%g)", &F1394->Guid);
-}
-
-VOID
-DevPathUsb (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- USB_DEVICE_PATH *Usb;
-
- Usb = DevPath;
- CatPrint (Str, L"Usb(%x, %x)", Usb->ParentPortNumber, Usb->InterfaceNumber);
-}
-
-VOID
-DevPathUsbClass (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- USB_CLASS_DEVICE_PATH *UsbClass;
-
- UsbClass = DevPath;
- CatPrint (
- Str,
- L"Usb Class(%x, %x, %x, %x, %x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceClass,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
-}
-
-VOID
-DevPathI2O (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- I2O_DEVICE_PATH *I2O;
-
- I2O = DevPath;
- CatPrint (Str, L"I2O(%x)", I2O->Tid);
-}
-
-VOID
-DevPathMacAddr (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- MAC_ADDR_DEVICE_PATH *MAC;
- UINTN HwAddressSize;
- UINTN Index;
-
- MAC = DevPath;
-
- HwAddressSize = sizeof (EFI_MAC_ADDRESS);
- if (MAC->IfType == 0x01 || MAC->IfType == 0x00) {
- HwAddressSize = 6;
- }
-
- CatPrint (Str, L"Mac(");
-
- for (Index = 0; Index < HwAddressSize; Index++) {
- CatPrint (Str, L"%02x", MAC->MacAddress.Addr[Index]);
- }
-
- CatPrint (Str, L")");
-}
-
-VOID
-DevPathIPv4 (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- IPv4_DEVICE_PATH *IP;
-
- IP = DevPath;
- CatPrint (
- Str,
- L"IPv4(%d.%d.%d.%d:%d)",
- IP->RemoteIpAddress.Addr[0],
- IP->RemoteIpAddress.Addr[1],
- IP->RemoteIpAddress.Addr[2],
- IP->RemoteIpAddress.Addr[3],
- IP->RemotePort
- );
-}
-
-VOID
-DevPathIPv6 (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- IPv6_DEVICE_PATH *IP;
-
- IP = DevPath;
- CatPrint (Str, L"IP-v6(not-done)");
-}
-
-VOID
-DevPathInfiniBand (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- INFINIBAND_DEVICE_PATH *InfiniBand;
-
- InfiniBand = DevPath;
- CatPrint (Str, L"InfiniBand(not-done)");
-}
-
-VOID
-DevPathUart (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- UART_DEVICE_PATH *Uart;
- CHAR8 Parity;
-
- Uart = DevPath;
- switch (Uart->Parity) {
- case 0:
- Parity = 'D';
- break;
-
- case 1:
- Parity = 'N';
- break;
-
- case 2:
- Parity = 'E';
- break;
-
- case 3:
- Parity = 'O';
- break;
-
- case 4:
- Parity = 'M';
- break;
-
- case 5:
- Parity = 'S';
- break;
-
- default:
- Parity = 'x';
- break;
- }
-
- if (Uart->BaudRate == 0) {
- CatPrint (Str, L"Uart(DEFAULT %c", Parity);
- } else {
- CatPrint (Str, L"Uart(%d %c", Uart->BaudRate, Parity);
- }
-
- if (Uart->DataBits == 0) {
- CatPrint (Str, L"D");
- } else {
- CatPrint (Str, L"%d", Uart->DataBits);
- }
-
- switch (Uart->StopBits) {
- case 0:
- CatPrint (Str, L"D)");
- break;
-
- case 1:
- CatPrint (Str, L"1)");
- break;
-
- case 2:
- CatPrint (Str, L"1.5)");
- break;
-
- case 3:
- CatPrint (Str, L"2)");
- break;
-
- default:
- CatPrint (Str, L"x)");
- break;
- }
-}
-
-VOID
-DevPathHardDrive (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- HARDDRIVE_DEVICE_PATH *Hd;
-
- Hd = DevPath;
- switch (Hd->SignatureType) {
- case SIGNATURE_TYPE_MBR:
- CatPrint (
- Str,
- L"HD(Part%d,Sig%08x)",
- Hd->PartitionNumber,
- *((UINT32 *) (&(Hd->Signature[0])))
- );
- break;
-
- case SIGNATURE_TYPE_GUID:
- CatPrint (
- Str,
- L"HD(Part%d,Sig%g)",
- Hd->PartitionNumber,
- (EFI_GUID *) &(Hd->Signature[0])
- );
- break;
-
- default:
- CatPrint (
- Str,
- L"HD(Part%d,MBRType=%02x,SigType=%02x)",
- Hd->PartitionNumber,
- Hd->MBRType,
- Hd->SignatureType
- );
- break;
- }
-}
-
-VOID
-DevPathCDROM (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- CDROM_DEVICE_PATH *Cd;
-
- Cd = DevPath;
- CatPrint (Str, L"CDROM(Entry%x)", Cd->BootEntry);
-}
-
-VOID
-DevPathFilePath (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- FILEPATH_DEVICE_PATH *Fp;
-
- Fp = DevPath;
- CatPrint (Str, L"%s", Fp->PathName);
-}
-
-VOID
-DevPathMediaProtocol (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- MEDIA_PROTOCOL_DEVICE_PATH *MediaProt;
-
- MediaProt = DevPath;
- CatPrint (Str, L"%g", &MediaProt->Protocol);
-}
-
-VOID
-DevPathFvFilePath (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;
-
- FvFilePath = DevPath;
- CatPrint (Str, L"%g", &FvFilePath->NameGuid);
-}
-
-VOID
-DevPathBssBss (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- BBS_BBS_DEVICE_PATH *Bbs;
- CHAR16 *Type;
-
- Bbs = DevPath;
- switch (Bbs->DeviceType) {
- case BBS_TYPE_FLOPPY:
- Type = L"Floppy";
- break;
-
- case BBS_TYPE_HARDDRIVE:
- Type = L"Harddrive";
- break;
-
- case BBS_TYPE_CDROM:
- Type = L"CDROM";
- break;
-
- case BBS_TYPE_PCMCIA:
- Type = L"PCMCIA";
- break;
-
- case BBS_TYPE_USB:
- Type = L"Usb";
- break;
-
- case BBS_TYPE_EMBEDDED_NETWORK:
- Type = L"Net";
- break;
-
- default:
- Type = L"?";
- break;
- }
- //
- // Since current Print function hasn't implemented %a (for ansi string)
- // we will only print Unicode strings.
- //
- CatPrint (Str, L"Legacy-%s", Type);
-}
-
-VOID
-DevPathEndInstance (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- CatPrint (Str, L",");
-}
-
-VOID
-DevPathNodeUnknown (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- CatPrint (Str, L"?");
-}
-
-DEVICE_PATH_STRING_TABLE DevPathTable[] = {
- {
- HARDWARE_DEVICE_PATH,
- HW_PCI_DP,
- DevPathPci
- },
- {
- HARDWARE_DEVICE_PATH,
- HW_PCCARD_DP,
- DevPathPccard
- },
- {
- HARDWARE_DEVICE_PATH,
- HW_MEMMAP_DP,
- DevPathMemMap
- },
- {
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- DevPathVendor
- },
- {
- HARDWARE_DEVICE_PATH,
- HW_CONTROLLER_DP,
- DevPathController
- },
- {
- ACPI_DEVICE_PATH,
- ACPI_DP,
- DevPathAcpi
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_ATAPI_DP,
- DevPathAtapi
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_SCSI_DP,
- DevPathScsi
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_FIBRECHANNEL_DP,
- DevPathFibre
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_1394_DP,
- DevPath1394
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_USB_DP,
- DevPathUsb
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_USB_CLASS_DP,
- DevPathUsbClass
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_I2O_DP,
- DevPathI2O
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_MAC_ADDR_DP,
- DevPathMacAddr
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_IPv4_DP,
- DevPathIPv4
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_IPv6_DP,
- DevPathIPv6
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_INFINIBAND_DP,
- DevPathInfiniBand
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_UART_DP,
- DevPathUart
- },
- {
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- DevPathVendor
- },
- {
- MEDIA_DEVICE_PATH,
- MEDIA_HARDDRIVE_DP,
- DevPathHardDrive
- },
- {
- MEDIA_DEVICE_PATH,
- MEDIA_CDROM_DP,
- DevPathCDROM
- },
- {
- MEDIA_DEVICE_PATH,
- MEDIA_VENDOR_DP,
- DevPathVendor
- },
- {
- MEDIA_DEVICE_PATH,
- MEDIA_FILEPATH_DP,
- DevPathFilePath
- },
- {
- MEDIA_DEVICE_PATH,
- MEDIA_PROTOCOL_DP,
- DevPathMediaProtocol
- },
-
- {
- BBS_DEVICE_PATH,
- BBS_BBS_DP,
- DevPathBssBss
- },
- {
- END_DEVICE_PATH_TYPE,
- END_INSTANCE_DEVICE_PATH_SUBTYPE,
- DevPathEndInstance
- },
- {
- 0,
- 0,
- NULL
- }
-};
-
-CHAR16 *
-DevicePathToStr (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-/*++
-
- Turns the Device Path into a printable string. Allcoates
- the string from pool. The caller must SafeFreePool the returned
- string.
-
---*/
-{
- POOL_PRINT Str;
- EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
- VOID (*DumpNode) (POOL_PRINT *, VOID *);
-
- UINTN Index;
- UINTN NewSize;
-
- ZeroMem (&Str, sizeof (Str));
-
- if (DevPath == NULL) {
- goto Done;
- }
- //
- // Unpacked the device path
- //
- DevPath = BdsLibUnpackDevicePath (DevPath);
- ASSERT (DevPath);
-
- //
- // Process each device path node
- //
- DevPathNode = DevPath;
- while (!IsDevicePathEnd (DevPathNode)) {
- //
- // Find the handler to dump this device path node
- //
- DumpNode = NULL;
- for (Index = 0; DevPathTable[Index].Function; Index += 1) {
-
- if (DevicePathType (DevPathNode) == DevPathTable[Index].Type &&
- DevicePathSubType (DevPathNode) == DevPathTable[Index].SubType
- ) {
- DumpNode = DevPathTable[Index].Function;
- break;
- }
- }
- //
- // If not found, use a generic function
- //
- if (!DumpNode) {
- DumpNode = DevPathNodeUnknown;
- }
- //
- // Put a path seperator in if needed
- //
- if (Str.len && DumpNode != DevPathEndInstance) {
- CatPrint (&Str, L"/");
- }
- //
- // Print this node of the device path
- //
- DumpNode (&Str, DevPathNode);
-
- //
- // Next device path node
- //
- DevPathNode = NextDevicePathNode (DevPathNode);
- }
- //
- // Shrink pool used for string allocation
- //
- gBS->FreePool (DevPath);
-
-Done:
- NewSize = (Str.len + 1) * sizeof (CHAR16);
- Str.str = ReallocatePool (Str.str, NewSize, NewSize);
- ASSERT (Str.str != NULL);
- Str.str[Str.len] = 0;
- return Str.str;
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-LibDuplicateDevicePathInstance (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-/*++
-
-Routine Description:
-
- Function creates a device path data structure that identically matches the
- device path passed in.
-
-Arguments:
-
- DevPath - A pointer to a device path data structure.
-
-Returns:
-
- The new copy of DevPath is created to identically match the input.
- Otherwise, NULL is returned.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *NewDevPath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
- EFI_DEVICE_PATH_PROTOCOL *Temp;
- UINTN Size;
-
- //
- // get the size of an instance from the input
- //
- Temp = DevPath;
- DevicePathInst = GetNextDevicePathInstance (&Temp, &Size);
-
- //
- // Make a copy
- //
- NewDevPath = NULL;
- if (Size) {
- NewDevPath = AllocateZeroPool (Size);
- ASSERT (NewDevPath != NULL);
- }
-
- if (NewDevPath) {
- CopyMem (NewDevPath, DevicePathInst, Size);
- }
-
- return NewDevPath;
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa b/EdkModulePkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa
deleted file mode 100644
index 8c2c718..0000000
--- a/EdkModulePkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>EdkGenericBdsLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>f3aaea62-8985-11db-baff-0040d02b1835</GuidValue>
- <Version>1.0</Version>
- <Abstract>EDK Generic BDS Common APIs Library Instance.</Abstract>
- <Description>The library instance provides common library routines help in
- performance measurement, device path debug print, boot device selections,
- boot device connection, console supports in BDS phase and boot from boot
- device.
- </Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkGenericBdsLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>EdkGenericBdsLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DxeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeCoffLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>BdsBoot.c</Filename>
- <Filename>BdsConsole.c</Filename>
- <Filename>BdsConnect.c</Filename>
- <Filename>DevicePath.c</Filename>
- <Filename>Performance.h</Filename>
- <Filename>Performance.c</Filename>
- <Filename>BdsMisc.c</Filename>
- <Filename SupArchList="IPF">Ipf/ShadowRom.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Package PackageGuid="f2805c44-8985-11db-9e98-0040d02b1835"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiFirmwareVolumeProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiAcpiS3SaveProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSimpleNetworkProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiShellFileGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/Ipf/ShadowRom.c b/EdkModulePkg/Library/EdkGenericBdsLib/Ipf/ShadowRom.c
deleted file mode 100644
index bbd7220..0000000
--- a/EdkModulePkg/Library/EdkGenericBdsLib/Ipf/ShadowRom.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ShadowRom.c
-
-Abstract:
-
- Shadow all option rom
-
-Revision History
-
---*/
-
-UINT8 mShadowRomFlag = 0;
-
-VOID
-ShadowAllOptionRom()
-{
- EFI_STATUS Status;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- //
- // Rom shadow only do once.
- //
- if (mShadowRomFlag == 0) {
- Status = gBS->LocateProtocol (
- &gEfiLegacyBiosProtocolGuid,
- NULL,
- &LegacyBios
- );
- if (!EFI_ERROR (Status)) {
- LegacyBios->PrepareToBootEfi (LegacyBios, NULL, NULL);
- }
-
- mShadowRomFlag = 1;
- }
-
- return ;
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/Performance.c b/EdkModulePkg/Library/EdkGenericBdsLib/Performance.c
deleted file mode 100644
index 1d92a4d..0000000
--- a/EdkModulePkg/Library/EdkGenericBdsLib/Performance.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Performance.c
-
-Abstract:
-
- This file include the file which can help to get the system
- performance, all the function will only include if the performance
- switch is set.
-
---*/
-
-#include "Performance.h"
-
-VOID
-ClearDebugRegisters (
- VOID
- )
-{
- //
- // BugBug: We should not need to do this. We need to root cause this bug!!!!
- //
- AsmWriteDr0 (0);
- AsmWriteDr1 (0);
-}
-
-STATIC
-VOID
-GetShortPdbFileName (
- CHAR8 *PdbFileName,
- CHAR8 *GaugeString
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINTN Index;
- UINTN Index1;
- UINTN StartIndex;
- UINTN EndIndex;
-
- if (PdbFileName == NULL) {
- AsciiStrCpy (GaugeString, " ");
- } else {
- StartIndex = 0;
- for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
- ;
-
- for (Index = 0; PdbFileName[Index] != 0; Index++) {
- if (PdbFileName[Index] == '\\') {
- StartIndex = Index + 1;
- }
-
- if (PdbFileName[Index] == '.') {
- EndIndex = Index;
- }
- }
-
- Index1 = 0;
- for (Index = StartIndex; Index < EndIndex; Index++) {
- GaugeString[Index1] = PdbFileName[Index];
- Index1++;
- if (Index1 == PERF_TOKEN_LENGTH - 1) {
- break;
- }
- }
-
- GaugeString[Index1] = 0;
- }
-
- return ;
-}
-
-
-
-STATIC
-CHAR8 *
-GetPdbPath (
- VOID *ImageBase
- )
-/*++
-
-Routine Description:
-
- Located PDB path name in PE image
-
-Arguments:
-
- ImageBase - base of PE to search
-
-Returns:
-
- Pointer into image at offset of PDB file name if PDB file name is found,
- Otherwise a pointer to an empty string.
-
---*/
-{
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
-
- ZeroMem (&ImageContext, sizeof (ImageContext));
- ImageContext.Handle = ImageBase;
- ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
-
- PeCoffLoaderGetImageInfo (&ImageContext);
-
- return ImageContext.PdbPointer;
-}
-
-
-STATIC
-VOID
-GetNameFromHandle (
- IN EFI_HANDLE Handle,
- OUT CHAR8 *GaugeString
- )
-{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *Image;
- CHAR8 *PdbFileName;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
-
- AsciiStrCpy (GaugeString, " ");
-
- //
- // Get handle name from image protocol
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **)&Image
- );
-
- if (EFI_ERROR (Status)) {
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiDriverBindingProtocolGuid,
- (VOID **) &DriverBinding,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return ;
- }
- //
- // Get handle name from image protocol
- //
- Status = gBS->HandleProtocol (
- DriverBinding->ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **)&Image
- );
- }
-
- PdbFileName = GetPdbPath (Image->ImageBase);
-
- if (PdbFileName != NULL) {
- GetShortPdbFileName (PdbFileName, GaugeString);
- }
-
- return ;
-}
-
-
-
-VOID
-WriteBootToOsPerformanceData (
- VOID
- )
-/*++
-
-Routine Description:
-
- Allocates a block of memory and writes performance data of booting to OS into it.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_CPU_ARCH_PROTOCOL *Cpu;
- EFI_PHYSICAL_ADDRESS mAcpiLowMemoryBase;
- UINT32 mAcpiLowMemoryLength;
- UINT32 LimitCount;
- PERF_HEADER mPerfHeader;
- PERF_DATA mPerfData;
- EFI_HANDLE *Handles;
- UINTN NoHandles;
- CHAR8 GaugeString[PERF_TOKEN_LENGTH];
- UINT8 *Ptr;
- UINT32 mIndex;
- UINT64 Ticker;
- UINT64 Freq;
- UINT32 Duration;
- UINT64 CurrentTicker;
- UINT64 TimerPeriod;
- UINTN LogEntryKey;
- CONST VOID *Handle;
- CONST CHAR8 *Token;
- CONST CHAR8 *Module;
- UINT64 StartTicker;
- UINT64 EndTicker;
-
- //
- // Retrive time stamp count as early as possilbe
- //
- Ticker = AsmReadTsc ();
-
- //
- // Allocate a block of memory that contain performance data to OS
- //
- mAcpiLowMemoryBase = 0xFFFFFFFF;
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiReservedMemoryType,
- 4,
- &mAcpiLowMemoryBase
- );
- if (EFI_ERROR (Status)) {
- return ;
- }
-
- mAcpiLowMemoryLength = EFI_PAGES_TO_SIZE(4);
-
- Ptr = (UINT8 *) ((UINT32) mAcpiLowMemoryBase + sizeof (PERF_HEADER));
- LimitCount = (mAcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);
-
- //
- // Initialize performance data structure
- //
- ZeroMem (&mPerfHeader, sizeof (PERF_HEADER));
-
- //
- // Get CPU frequency
- //
- Status = gBS->LocateProtocol (
- &gEfiCpuArchProtocolGuid,
- NULL,
- (VOID **)&Cpu
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePages (mAcpiLowMemoryBase, 4);
- return ;
- }
- //
- // Get Cpu Frequency
- //
- Status = Cpu->GetTimerValue (Cpu, 0, &(CurrentTicker), &TimerPeriod);
- if (EFI_ERROR (Status)) {
- gBS->FreePages (mAcpiLowMemoryBase, 4);
- return ;
- }
-
- Freq = DivU64x32 (1000000000000ULL, (UINTN) TimerPeriod);
-
- mPerfHeader.CpuFreq = Freq;
-
- //
- // Record BDS raw performance data
- //
- mPerfHeader.BDSRaw = Ticker;
-
- //
- // Put Detailed performance data into memory
- //
- Handles = NULL;
- Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &NoHandles,
- &Handles
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePages (mAcpiLowMemoryBase, 4);
- return ;
- }
- //
- // Get DXE drivers performance
- //
- for (mIndex = 0; mIndex < NoHandles; mIndex++) {
- Ticker = 0;
- LogEntryKey = 0;
- while ((LogEntryKey = GetPerformanceMeasurement (
- LogEntryKey,
- &Handle,
- &Token,
- &Module,
- &StartTicker,
- &EndTicker)) != 0) {
- if ((Handle == Handles[mIndex]) && (StartTicker < EndTicker)) {
- Ticker += (EndTicker - StartTicker);
- }
- }
-
- Duration = (UINT32) DivU64x32 (
- Ticker,
- (UINT32) Freq
- );
-
- if (Duration > 0) {
- ZeroMem (&mPerfData, sizeof (PERF_DATA));
-
- GetNameFromHandle (Handles[mIndex], GaugeString);
-
- AsciiStrCpy (mPerfData.Token, GaugeString);
- mPerfData.Duration = Duration;
-
- CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));
- Ptr += sizeof (PERF_DATA);
-
- mPerfHeader.Count++;
- if (mPerfHeader.Count == LimitCount) {
- goto Done;
- }
- }
- }
-
- gBS->FreePool (Handles);
-
- //
- // Get inserted performance data
- //
- LogEntryKey = 0;
- while ((LogEntryKey = GetPerformanceMeasurement (
- LogEntryKey,
- &Handle,
- &Token,
- &Module,
- &StartTicker,
- &EndTicker)) != 0) {
- if ((Handle == NULL) && (StartTicker <= EndTicker)) {
-
- ZeroMem (&mPerfData, sizeof (PERF_DATA));
-
- AsciiStrnCpy (mPerfData.Token, Token, DXE_PERFORMANCE_STRING_SIZE);
- mPerfData.Duration = (UINT32) DivU64x32 (
- EndTicker - StartTicker,
- (UINT32) Freq
- );
-
- CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));
- Ptr += sizeof (PERF_DATA);
-
- mPerfHeader.Count++;
- if (mPerfHeader.Count == LimitCount) {
- goto Done;
- }
- }
- }
-
-Done:
-
- ClearDebugRegisters ();
-
- mPerfHeader.Signiture = 0x66726550;
-
- //
- // Put performance data to memory
- //
- CopyMem (
- (UINT32 *) (UINT32) mAcpiLowMemoryBase,
- &mPerfHeader,
- sizeof (PERF_HEADER)
- );
-
- gRT->SetVariable (
- L"PerfDataMemAddr",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (UINT32),
- (VOID *) &mAcpiLowMemoryBase
- );
-
- return ;
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/Performance.h b/EdkModulePkg/Library/EdkGenericBdsLib/Performance.h
deleted file mode 100644
index e7f80ab..0000000
--- a/EdkModulePkg/Library/EdkGenericBdsLib/Performance.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Performance.h
-
-Abstract:
-
- This file included the performance relete function header and
- definition.
-
---*/
-
-#ifndef _PERF_H_
-#define _PERF_H_
-
-#define PERF_TOKEN_LENGTH 28
-#define PERF_PEI_ENTRY_MAX_NUM 50
-
-typedef struct {
- CHAR8 Token[PERF_TOKEN_LENGTH];
- UINT32 Duration;
-} PERF_DATA;
-
-typedef struct {
- UINT64 BootToOs;
- UINT64 S3Resume;
- UINT32 S3EntryNum;
- PERF_DATA S3Entry[PERF_PEI_ENTRY_MAX_NUM];
- UINT64 CpuFreq;
- UINT64 BDSRaw;
- UINT32 Count;
- UINT32 Signiture;
-} PERF_HEADER;
-
-VOID
-WriteBootToOsPerformanceData (
- VOID
- );
-
-VOID
-ClearDebugRegisters (
- VOID
- );
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.dxs b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.dxs
deleted file mode 100644
index 63355ef..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Bds.dxs
-
-Abstract:
-
- Dependency expression source file. This driver produces an arch protocol, so
- must dipatch early.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- EFI_HII_PROTOCOL_GUID
-DEPENDENCY_END \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.h
deleted file mode 100644
index 2548aaf..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Bds.h
-
-Abstract:
-
- Head file for BDS Architectural Protocol implementation
-
-Revision History
-
---*/
-
-#ifndef _BDS_H
-#define _BDS_H
-
-
-//
-// Prototypes
-//
-EFI_STATUS
-EFIAPI
-BdsInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-VOID
-EFIAPI
-BdsEntry (
- IN EFI_BDS_ARCH_PROTOCOL *This
- );
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsBoot.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsBoot.c
deleted file mode 100644
index 0a9d359..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsBoot.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsPlatform.c
-
-Abstract:
-
- This file include all platform action which can be customized
- by IBV/OEM.
-
---*/
-
-#include "String.h"
-
-VOID
-PlatformBdsBootSuccess (
- IN BDS_COMMON_OPTION *Option
- )
-/*++
-
-Routine Description:
-
- Hook point after a boot attempt succeeds. We don't expect a boot option to
- return, so the EFI 1.0 specification defines that you will default to an
- interactive mode and stop processing the BootOrder list in this case. This
- is alos a platform implementation and can be customized by IBV/OEM.
-
-Arguments:
-
- Option - Pointer to Boot Option that succeeded to boot.
-
-Returns:
-
- None.
-
---*/
-{
- CHAR16 *TmpStr;
-
- //
- // If Boot returned with EFI_SUCCESS and there is not in the boot device
- // select loop then we need to pop up a UI and wait for user input.
- //
- TmpStr = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
- if (TmpStr != NULL) {
- BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);
- gBS->FreePool (TmpStr);
- }
-}
-
-VOID
-PlatformBdsBootFail (
- IN BDS_COMMON_OPTION *Option,
- IN EFI_STATUS Status,
- IN CHAR16 *ExitData,
- IN UINTN ExitDataSize
- )
-/*++
-
-Routine Description:
-
- Hook point after a boot attempt fails.
-
-Arguments:
-
- Option - Pointer to Boot Option that failed to boot.
-
- Status - Status returned from failed boot.
-
- ExitData - Exit data returned from failed boot.
-
- ExitDataSize - Exit data size returned from failed boot.
-
-Returns:
-
- None.
-
---*/
-{
- CHAR16 *TmpStr;
-
- //
- // If Boot returned with failed status then we need to pop up a UI and wait
- // for user input.
- //
- TmpStr = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
- if (TmpStr != NULL) {
- BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);
- gBS->FreePool (TmpStr);
- }
-
-}
-
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsEntry.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsEntry.c
deleted file mode 100644
index 07789a3..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsEntry.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsEntry.c
-
-Abstract:
-
- The entry of the bds
-
---*/
-
-#include "Bds.h"
-#include "FrontPage.h"
-#include "Language.h"
-
-EFI_BDS_ARCH_PROTOCOL_INSTANCE gBdsInstanceTemplate = {
- EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE,
- NULL,
- {
- BdsEntry
- },
- 0xFFFF,
- TRUE,
- EXTENSIVE
-};
-
-UINT16 *mBootNext = NULL;
-
-EFI_HANDLE mBdsImageHandle;
-
-EFI_STATUS
-EFIAPI
-BdsInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Install Boot Device Selection Protocol
-
-Arguments:
-
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-Returns:
-
- EFI_SUCEESS - BDS has finished initializing.
- Rerun the
- dispatcher and recall BDS.Entry
-
- Other - Return value from EfiLibAllocatePool()
- or gBS->InstallProtocolInterface
-
---*/
-{
- EFI_STATUS Status;
-
- mBdsImageHandle = ImageHandle;
-
- //
- // Install protocol interface
- //
- Status = gBS->InstallProtocolInterface (
- &gBdsInstanceTemplate.Handle,
- &gEfiBdsArchProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &gBdsInstanceTemplate.Bds
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-VOID
-BdsBootDeviceSelect (
- VOID
- )
-/*++
-
-Routine Description:
-
- In the loop of attempt to boot for the boot order
-
-Arguments:
-
- None.
-
-Returns:
-
- None.
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- BDS_COMMON_OPTION *BootOption;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
- UINT16 Timeout;
- LIST_ENTRY BootLists;
- CHAR16 Buffer[20];
- BOOLEAN BootNextExist;
- LIST_ENTRY *LinkBootNext;
-
- //
- // Got the latest boot option
- //
- BootNextExist = FALSE;
- LinkBootNext = NULL;
- InitializeListHead (&BootLists);
-
- //
- // First check the boot next option
- //
- ZeroMem (Buffer, sizeof (Buffer));
-
- if (mBootNext != NULL) {
- //
- // Indicate we have the boot next variable, so this time
- // boot will always have this boot option
- //
- BootNextExist = TRUE;
-
- //
- // Clear the this variable so it's only exist in this time boot
- //
- gRT->SetVariable (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- mBootNext
- );
-
- //
- // Add the boot next boot option
- //
- UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext);
- BootOption = BdsLibVariableToOption (&BootLists, Buffer);
- }
- //
- // Parse the boot order to get boot option
- //
- BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
- Link = BootLists.ForwardLink;
-
- //
- // Parameter check, make sure the loop will be valid
- //
- if (Link == NULL) {
- return ;
- }
- //
- // Here we make the boot in a loop, every boot success will
- // return to the front page
- //
- for (;;) {
- //
- // Check the boot option list first
- //
- if (Link == &BootLists) {
- //
- // There are two ways to enter here:
- // 1. There is no active boot option, give user chance to
- // add new boot option
- // 2. All the active boot option processed, and there is no
- // one is success to boot, then we back here to allow user
- // add new active boot option
- //
- Timeout = 0xffff;
- PlatformBdsEnterFrontPage (Timeout, FALSE);
- InitializeListHead (&BootLists);
- BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
- Link = BootLists.ForwardLink;
- continue;
- }
- //
- // Get the boot option from the link list
- //
- BootOption = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
-
- //
- // According to EFI Specification, if a load option is not marked
- // as LOAD_OPTION_ACTIVE, the boot manager will not automatically
- // load the option.
- //
- if (!IS_LOAD_OPTION_TYPE (BootOption->Attribute, LOAD_OPTION_ACTIVE)) {
- //
- // skip the header of the link list, becuase it has no boot option
- //
- Link = Link->ForwardLink;
- continue;
- }
- //
- // Make sure the boot option device path connected,
- // but ignore the BBS device path
- //
- if (DevicePathType (BootOption->DevicePath) != BBS_DEVICE_PATH) {
- //
- // Notes: the internal shell can not been connected with device path
- // so we do not check the status here
- //
- BdsLibConnectDevicePath (BootOption->DevicePath);
- }
- //
- // All the driver options should have been processed since
- // now boot will be performed.
- //
- Status = BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
- if (EFI_ERROR (Status)) {
- //
- // Call platform action to indicate the boot fail
- //
- PlatformBdsBootFail (BootOption, Status, ExitData, ExitDataSize);
-
- //
- // Check the next boot option
- //
- Link = Link->ForwardLink;
-
- } else {
- //
- // Call platform action to indicate the boot success
- //
- PlatformBdsBootSuccess (BootOption);
-
- //
- // Boot success, then stop process the boot order, and
- // present the boot manager menu, front page
- //
- Timeout = 0xffff;
- PlatformBdsEnterFrontPage (Timeout, FALSE);
-
- //
- // Rescan the boot option list, avoid pertential risk of the boot
- // option change in front page
- //
- if (BootNextExist) {
- LinkBootNext = BootLists.ForwardLink;
- }
-
- InitializeListHead (&BootLists);
- if (LinkBootNext != NULL) {
- //
- // Reserve the boot next option
- //
- InsertTailList (&BootLists, LinkBootNext);
- }
-
- BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
- Link = BootLists.ForwardLink;
- }
- }
-
- return ;
-
-}
-
-VOID
-EFIAPI
-BdsEntry (
- IN EFI_BDS_ARCH_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- Service routine for BdsInstance->Entry(). Devices are connected, the
- consoles are initialized, and the boot options are tried.
-
-Arguments:
-
- This - Protocol Instance structure.
-
-Returns:
-
- EFI_SUCEESS - BDS->Entry has finished executing.
-
---*/
-{
- EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData;
- LIST_ENTRY DriverOptionList;
- LIST_ENTRY BootOptionList;
- UINTN BootNextSize;
-
- //
- // Insert the performance probe
- //
- PERF_END (0, DXE_TOK, NULL, 0);
- PERF_START (0, BDS_TOK, NULL, 0);
-
- //
- // Initialize the global system boot option and driver option
- //
- InitializeListHead (&DriverOptionList);
- InitializeListHead (&BootOptionList);
-
- //
- // Get the BDS private data
- //
- PrivateData = EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS (This);
-
- //
- // Do the platform init, can be customized by OEM/IBV
- //
- PERF_START (0, "PlatformBds", "BDS", 0);
- PlatformBdsInit (PrivateData);
-
- //
- // Initialize the platform specific string and language
- //
- InitializeStringSupport ();
- InitializeLanguage (TRUE);
- InitializeFrontPage (FALSE);
- //
- // Set up the device list based on EFI 1.1 variables
- // process Driver#### and Load the driver's in the
- // driver option list
- //
- BdsLibBuildOptionFromVar (&DriverOptionList, L"DriverOrder");
- if (!IsListEmpty (&DriverOptionList)) {
- BdsLibLoadDrivers (&DriverOptionList);
- }
- //
- // Check if we have the boot next option
- //
- mBootNext = BdsLibGetVariableAndSize (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- &BootNextSize
- );
-
- //
- // Setup some platform policy here
- //
- PlatformBdsPolicyBehavior (PrivateData, &DriverOptionList, &BootOptionList);
- PERF_END (0, "PlatformBds", "BDS", 0);
-
- //
- // BDS select the boot device to load OS
- //
- BdsBootDeviceSelect ();
-
- //
- // Only assert here since this is the right behavior, we should never
- // return back to DxeCore.
- //
- ASSERT (FALSE);
-}
-
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.c
deleted file mode 100644
index 76dd54f..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.c
+++ /dev/null
@@ -1,1605 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BBSsupport.c
-
-Abstract:
-
- This function deal with the legacy boot option, it create, delete
- and manage the legacy boot option, all legacy boot option is getting from
- the legacy BBS table.
-
---*/
-
-#include "BBSsupport.h"
-
-EFI_DEVICE_PATH_PROTOCOL EndDevicePath[] = {
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- END_DEVICE_PATH_LENGTH,
- 0
- }
- }
-};
-
-VOID
-AsciiToUnicodeSize (
- IN UINT8 *a,
- IN UINTN Size,
- OUT UINT16 *u
- )
-/*++
-
- Routine Description:
-
- Translate the first n characters of an Ascii string to
- Unicode characters. The count n is indicated by parameter
- Size. If Size is greater than the length of string, then
- the entire string is translated.
-
- Arguments:
-
- a - Pointer to input Ascii string.
- Size - The number of characters to translate.
- u - Pointer to output Unicode string buffer.
-
- Returns:
-
- None
-
---*/
-{
- UINTN i;
-
- i = 0;
- while (a[i] != 0) {
- u[i] = (CHAR16) a[i];
- if (i == Size) {
- break;
- }
-
- i++;
- }
- u[i] = 0;
-}
-
-VOID
-BdsBuildLegacyDevNameString (
- IN BBS_TABLE *CurBBSEntry,
- IN UINTN Index,
- IN UINTN BufSize,
- OUT CHAR16 *BootString
- )
-{
- CHAR16 *Fmt;
- CHAR16 *Type;
- UINT8 *StringDesc;
- CHAR16 temp[80];
-
- switch (Index) {
- //
- // Primary Master
- //
- case 1:
- Fmt = L"Primary Master %s";
- break;
-
- //
- // Primary Slave
- //
- case 2:
- Fmt = L"Primary Slave %s";
- break;
-
- //
- // Secondary Master
- //
- case 3:
- Fmt = L"Secondary Master %s";
- break;
-
- //
- // Secondary Slave
- //
- case 4:
- Fmt = L"Secondary Slave %s";
- break;
-
- default:
- Fmt = L"%s";
- break;
- }
-
- switch (CurBBSEntry->DeviceType) {
- case BBS_FLOPPY:
- Type = L"Floppy";
- break;
-
- case BBS_HARDDISK:
- Type = L"Harddisk";
- break;
-
- case BBS_CDROM:
- Type = L"CDROM";
- break;
-
- case BBS_PCMCIA:
- Type = L"PCMCIAe";
- break;
-
- case BBS_USB:
- Type = L"USB";
- break;
-
- case BBS_EMBED_NETWORK:
- Type = L"Network";
- break;
-
- case BBS_BEV_DEVICE:
- Type = L"BEVe";
- break;
-
- case BBS_UNKNOWN:
- default:
- Type = L"Unknown";
- break;
- }
- //
- // If current BBS entry has its description then use it.
- //
- StringDesc = (UINT8 *) (UINTN) ((CurBBSEntry->DescStringSegment << 4) + CurBBSEntry->DescStringOffset);
- if (NULL != StringDesc) {
- //
- // Only get fisrt 32 characters, this is suggested by BBS spec
- //
- AsciiToUnicodeSize (StringDesc, 32, temp);
- Fmt = L"%s";
- Type = temp;
- }
-
- UnicodeSPrint (BootString, BufSize, Fmt, Type);
-}
-
-EFI_STATUS
-BdsCreateLegacyBootOption (
- IN BBS_TABLE *CurrentBbsEntry,
- IN EFI_DEVICE_PATH_PROTOCOL *CurrentBbsDevPath,
- IN UINTN Index,
- IN OUT UINT16 **BootOrderList,
- IN OUT UINTN *BootOrderListSize
- )
-/*++
-
- Routine Description:
-
- Create a legacy boot option for the specified entry of
- BBS table, save it as variable, and append it to the boot
- order list.
-
- Arguments:
-
- CurrentBbsEntry - Pointer to current BBS table.
- CurrentBbsDevPath - Pointer to the Device Path Protocol instance of BBS
- Index - Index of the specified entry in BBS table.
- BootOrderList - On input, the original boot order list.
- On output, the new boot order list attached with the
- created node.
- BootOrderListSize - On input, the original size of boot order list.
- - On output, the size of new boot order list.
-
- Returns:
-
- EFI_SUCCESS - Boot Option successfully created.
- EFI_OUT_OF_RESOURCES - Fail to allocate necessary memory.
- Other - Error occurs while setting variable.
-
---*/
-{
- EFI_STATUS Status;
- UINT16 CurrentBootOptionNo;
- UINT16 BootString[10];
- UINT16 BootDesc[100];
- UINT16 *NewBootOrderList;
- UINTN BufferSize;
- VOID *Buffer;
- UINT8 *Ptr;
- UINT16 CurrentBbsDevPathSize;
- UINTN BootOrderIndex;
- UINTN BootOrderLastIndex;
- UINTN ArrayIndex;
- BOOLEAN IndexNotFound;
-
- if (NULL == (*BootOrderList)) {
- CurrentBootOptionNo = 0;
- } else {
- for (ArrayIndex = 0; ArrayIndex < (UINTN) (*BootOrderListSize / sizeof (UINT16)); ArrayIndex++) {
- IndexNotFound = TRUE;
- for (BootOrderIndex = 0; BootOrderIndex < (UINTN) (*BootOrderListSize / sizeof (UINT16)); BootOrderIndex++) {
- if ((*BootOrderList)[BootOrderIndex] == ArrayIndex) {
- IndexNotFound = FALSE;
- break;
- }
- }
-
- if (!IndexNotFound) {
- continue;
- } else {
- break;
- }
- }
-
- CurrentBootOptionNo = (UINT16) ArrayIndex;
- }
-
- UnicodeSPrint (
- BootString,
- sizeof (BootString),
- L"Boot%04x",
- CurrentBootOptionNo
- );
-
- BdsBuildLegacyDevNameString (CurrentBbsEntry, Index, sizeof (BootDesc), BootDesc);
-
- CurrentBbsDevPathSize = (UINT16) (GetDevicePathSize (CurrentBbsDevPath));
-
- BufferSize = sizeof (UINT32) +
- sizeof (UINT16) +
- StrSize (BootDesc) +
- CurrentBbsDevPathSize +
- sizeof (BBS_TABLE) +
- sizeof (UINT16);
-
- Buffer = AllocateZeroPool (BufferSize);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Ptr = (UINT8 *) Buffer;
-
- *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE;
- Ptr += sizeof (UINT32);
-
- *((UINT16 *) Ptr) = CurrentBbsDevPathSize;
- Ptr += sizeof (UINT16);
-
- CopyMem (
- Ptr,
- BootDesc,
- StrSize (BootDesc)
- );
- Ptr += StrSize (BootDesc);
-
- CopyMem (
- Ptr,
- CurrentBbsDevPath,
- CurrentBbsDevPathSize
- );
- Ptr += CurrentBbsDevPathSize;
-
- CopyMem (
- Ptr,
- CurrentBbsEntry,
- sizeof (BBS_TABLE)
- );
-
- Ptr += sizeof (BBS_TABLE);
- *((UINT16 *) Ptr) = (UINT16) Index;
-
- Status = gRT->SetVariable (
- BootString,
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BufferSize,
- Buffer
- );
-
- SafeFreePool (Buffer);
- Buffer = NULL;
-
- NewBootOrderList = AllocateZeroPool (*BootOrderListSize + sizeof (UINT16));
- if (NULL == NewBootOrderList) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (NULL != *BootOrderList) {
- CopyMem (NewBootOrderList, *BootOrderList, *BootOrderListSize);
- }
-
- SafeFreePool (*BootOrderList);
-
- BootOrderLastIndex = (UINTN) (*BootOrderListSize / sizeof (UINT16));
- NewBootOrderList[BootOrderLastIndex] = CurrentBootOptionNo;
- *BootOrderListSize += sizeof (UINT16);
- *BootOrderList = NewBootOrderList;
-
- return Status;
-}
-
-BOOLEAN
-BdsIsLegacyBootOption (
- IN UINT8 *BootOptionVar,
- OUT BBS_TABLE **BbsEntry,
- OUT UINT16 *BbsIndex
- )
-{
- UINT8 *Ptr;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- BOOLEAN Ret;
- UINT16 DevPathLen;
-
- Ptr = BootOptionVar;
- Ptr += sizeof (UINT32);
- DevPathLen = *(UINT16 *) Ptr;
- Ptr += sizeof (UINT16);
- Ptr += StrSize ((UINT16 *) Ptr);
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- if ((BBS_DEVICE_PATH == DevicePath->Type) && (BBS_BBS_DP == DevicePath->SubType)) {
- Ptr += DevPathLen;
- *BbsEntry = (BBS_TABLE *) Ptr;
- Ptr += sizeof (BBS_TABLE);
- *BbsIndex = *(UINT16 *) Ptr;
- Ret = TRUE;
- } else {
- *BbsEntry = NULL;
- Ret = FALSE;
- }
-
- return Ret;
-}
-
-EFI_STATUS
-BdsDeleteBootOption (
- IN UINTN OptionNumber,
- IN OUT UINT16 *BootOrder,
- IN OUT UINTN *BootOrderSize
- )
-{
- UINT16 BootOption[100];
- UINTN Index;
- EFI_STATUS Status;
- UINTN Index2Del;
-
- Status = EFI_SUCCESS;
- Index2Del = 0;
-
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", OptionNumber);
- Status = EfiLibDeleteVariable (BootOption, &gEfiGlobalVariableGuid);
- //
- // adjust boot order array
- //
- for (Index = 0; Index < *BootOrderSize / sizeof (UINT16); Index++) {
- if (BootOrder[Index] == OptionNumber) {
- Index2Del = Index;
- break;
- }
- }
-
- if (Index != *BootOrderSize / sizeof (UINT16)) {
- for (Index = 0; Index < *BootOrderSize / sizeof (UINT16) - 1; Index++) {
- if (Index >= Index2Del) {
- BootOrder[Index] = BootOrder[Index + 1];
- }
- }
-
- *BootOrderSize -= sizeof (UINT16);
- }
-
- return Status;
-
-}
-
-EFI_STATUS
-BdsDeleteAllInvalidLegacyBootOptions (
- VOID
- )
-/*++
-
- Routine Description:
-
- Delete all the invalid legacy boot options.
-
- Arguments:
-
- None.
-
- Returns:
-
- EFI_SUCCESS - All invalide legacy boot options are deleted.
- EFI_OUT_OF_RESOURCES - Fail to allocate necessary memory.
- EFI_NOT_FOUND - Fail to retrive variable of boot order.
- Other - Error occurs while setting variable or locating
- protocol.
-
---*/
-{
- UINT16 *BootOrder;
- UINT8 *BootOptionVar;
- UINTN BootOrderSize;
- UINTN BootOptionSize;
- EFI_STATUS Status;
- UINT16 HddCount;
- UINT16 BbsCount;
- HDD_INFO *LocalHddInfo;
- BBS_TABLE *LocalBbsTable;
- BBS_TABLE *BbsEntry;
- UINT16 BbsIndex;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINTN Index;
- UINT16 BootOption[10];
- UINT16 BootDesc[100];
- BOOLEAN DescStringMatch;
-
- Status = EFI_SUCCESS;
- BootOrder = NULL;
- BootOrderSize = 0;
- HddCount = 0;
- BbsCount = 0;
- LocalHddInfo = NULL;
- LocalBbsTable = NULL;
- BbsEntry = NULL;
-
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID**) &LegacyBios);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &LocalHddInfo,
- &BbsCount,
- &LocalBbsTable
- );
-
- BootOrder = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- if (NULL == BootOrder) {
- return EFI_NOT_FOUND;
- }
-
- Index = 0;
- while (Index < BootOrderSize / sizeof (UINT16)) {
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOption,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (NULL == BootOptionVar) {
- SafeFreePool (BootOrder);
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (!BdsIsLegacyBootOption (BootOptionVar, &BbsEntry, &BbsIndex)) {
- SafeFreePool (BootOptionVar);
- Index++;
- continue;
- }
-
- //
- // Check if BBS Description String is changed
- //
- DescStringMatch = FALSE;
-
- BdsBuildLegacyDevNameString (
- &LocalBbsTable[BbsIndex],
- BbsIndex,
- sizeof(BootDesc),
- BootDesc
- );
-
- if (StrCmp (BootDesc, (UINT16*)(BootOptionVar + sizeof (UINT32) + sizeof (UINT16))) == 0) {
- DescStringMatch = TRUE;
- }
-
- if (!((LocalBbsTable[BbsIndex].BootPriority == BBS_IGNORE_ENTRY) ||
- (LocalBbsTable[BbsIndex].BootPriority == BBS_DO_NOT_BOOT_FROM) ||
- (LocalBbsTable[BbsIndex].BootPriority == BBS_LOWEST_PRIORITY)) &&
- (LocalBbsTable[BbsIndex].DeviceType == BbsEntry->DeviceType) &&
- DescStringMatch) {
- Index++;
- continue;
- }
-
- SafeFreePool (BootOptionVar);
- //
- // should delete
- //
- BdsDeleteBootOption (
- BootOrder[Index],
- BootOrder,
- &BootOrderSize
- );
- }
-
- if (BootOrderSize) {
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BootOrderSize,
- BootOrder
- );
- } else {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- }
-
- SafeFreePool (BootOrder);
-
- return Status;
-}
-
-BOOLEAN
-BdsFindLegacyBootOptionByDevType (
- IN UINT16 *BootOrder,
- IN UINTN BootOptionNum,
- IN UINT16 DevType,
- OUT UINT32 *Attribute,
- OUT UINT16 *BbsIndex,
- OUT UINTN *OptionNumber
- )
-{
- UINTN Index;
- UINTN BootOrderIndex;
- UINT16 BootOption[100];
- UINTN BootOptionSize;
- UINT8 *BootOptionVar;
- BBS_TABLE *BbsEntry;
- BOOLEAN Found;
-
- BbsEntry = NULL;
- Found = FALSE;
-
- if (NULL == BootOrder) {
- return Found;
- }
-
- for (BootOrderIndex = 0; BootOrderIndex < BootOptionNum; BootOrderIndex++) {
- Index = (UINTN) BootOrder[BootOrderIndex];
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", Index);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOption,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (NULL == BootOptionVar) {
- continue;
- }
-
- if (!BdsIsLegacyBootOption (BootOptionVar, &BbsEntry, BbsIndex)) {
- SafeFreePool (BootOptionVar);
- continue;
- }
-
- if (BbsEntry->DeviceType != DevType) {
- SafeFreePool (BootOptionVar);
- continue;
- }
-
- *Attribute = *(UINT32 *) BootOptionVar;
- *OptionNumber = Index;
- Found = TRUE;
- SafeFreePool (BootOptionVar);
- break;
- }
-
- return Found;
-}
-
-EFI_STATUS
-BdsCreateOneLegacyBootOption (
- IN BBS_TABLE *BbsItem,
- IN UINTN Index,
- IN OUT UINT16 **BootOrderList,
- IN OUT UINTN *BootOrderListSize
- )
-{
- BBS_BBS_DEVICE_PATH BbsDevPathNode;
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevPath;
-
- DevPath = NULL;
-
- BbsDevPathNode.Header.Type = BBS_DEVICE_PATH;
- BbsDevPathNode.Header.SubType = BBS_BBS_DP;
- SetDevicePathNodeLength (&BbsDevPathNode.Header, sizeof (BBS_BBS_DEVICE_PATH));
- BbsDevPathNode.DeviceType = BbsItem->DeviceType;
- CopyMem (&BbsDevPathNode.StatusFlag, &BbsItem->StatusFlags, sizeof (UINT16));
-
- DevPath = AppendDevicePathNode (
- EndDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &BbsDevPathNode
- );
- if (NULL == DevPath) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = BdsCreateLegacyBootOption (
- BbsItem,
- DevPath,
- Index,
- BootOrderList,
- BootOrderListSize
- );
- BbsItem->BootPriority = 0x00;
-
- gBS->FreePool (DevPath);
-
- return Status;
-}
-
-EFI_STATUS
-BdsAddNonExistingLegacyBootOptions (
- VOID
- )
-/*++
-
-Routine Description:
-
- Add the legacy boot options from BBS table if they do not exist.
-
-Arguments:
-
- None.
-
-Returns:
-
- EFI_SUCCESS - The boot options are added successfully or they are already in boot options.
- others - An error occurred when creating legacy boot options.
-
---*/
-{
- UINT16 *BootOrder;
- UINTN BootOrderSize;
- EFI_STATUS Status;
- UINT16 HddCount;
- UINT16 BbsCount;
- HDD_INFO *LocalHddInfo;
- BBS_TABLE *LocalBbsTable;
- UINT16 BbsIndex;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINTN Index;
- UINT32 Attribute;
- UINTN OptionNumber;
- BOOLEAN Ret;
-
- BootOrder = NULL;
- HddCount = 0;
- BbsCount = 0;
- LocalHddInfo = NULL;
- LocalBbsTable = NULL;
-
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID**)&LegacyBios);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &LocalHddInfo,
- &BbsCount,
- &LocalBbsTable
- );
-
- BootOrder = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- if (NULL == BootOrder) {
- BootOrderSize = 0;
- }
-
- for (Index = 0; Index < BbsCount; Index++) {
- if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) ||
- (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM)
- ) {
- continue;
- }
-
- Ret = BdsFindLegacyBootOptionByDevType (
- BootOrder,
- BootOrderSize / sizeof (UINT16),
- LocalBbsTable[Index].DeviceType,
- &Attribute,
- &BbsIndex,
- &OptionNumber
- );
- if (Ret && (Attribute & LOAD_OPTION_ACTIVE) != 0) {
- continue;
- }
-
- if (Ret) {
- if (Index != BbsIndex) {
- BdsDeleteBootOption (
- OptionNumber,
- BootOrder,
- &BootOrderSize
- );
- } else {
- continue;
- }
- }
- //
- // Not found such type of legacy device in boot options or we found but it's disabled
- // so we have to create one and put it to the tail of boot order list
- //
- Status = BdsCreateOneLegacyBootOption (
- &LocalBbsTable[Index],
- Index,
- &BootOrder,
- &BootOrderSize
- );
- if (EFI_ERROR (Status)) {
- break;
- }
- }
-
- if (BootOrderSize > 0) {
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BootOrderSize,
- BootOrder
- );
- } else {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- }
-
- if (BootOrder != NULL) {
- SafeFreePool (BootOrder);
- }
-
- return Status;
-}
-
-UINT16 *
-BdsFillDevOrderBuf (
- IN BBS_TABLE *BbsTable,
- IN BBS_TYPE BbsType,
- IN UINTN BbsCount,
- IN UINT16 *Buf
- )
-{
- UINTN Index;
-
- for (Index = 0; Index < BbsCount; Index++) {
- if (BbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) {
- continue;
- }
-
- if (BbsTable[Index].DeviceType != BbsType) {
- continue;
- }
-
- *Buf = (UINT16) (Index & 0xFF);
- Buf++;
- }
-
- return Buf;
-}
-
-EFI_STATUS
-BdsCreateDevOrder (
- IN BBS_TABLE *BbsTable,
- IN UINT16 BbsCount
- )
-{
- UINTN Index;
- UINTN FDCount;
- UINTN HDCount;
- UINTN CDCount;
- UINTN NETCount;
- UINTN BEVCount;
- UINTN TotalSize;
- UINTN HeaderSize;
- UINT8 *DevOrder;
- UINT8 *Ptr;
- EFI_STATUS Status;
-
- FDCount = 0;
- HDCount = 0;
- CDCount = 0;
- NETCount = 0;
- BEVCount = 0;
- TotalSize = 0;
- HeaderSize = sizeof (BBS_TYPE) + sizeof (UINT16);
- DevOrder = NULL;
- Ptr = NULL;
- Status = EFI_SUCCESS;
-
- for (Index = 0; Index < BbsCount; Index++) {
- if (BbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) {
- continue;
- }
-
- switch (BbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- FDCount++;
- break;
-
- case BBS_HARDDISK:
- HDCount++;
- break;
-
- case BBS_CDROM:
- CDCount++;
- break;
-
- case BBS_EMBED_NETWORK:
- NETCount++;
- break;
-
- case BBS_BEV_DEVICE:
- BEVCount++;
- break;
-
- default:
- break;
- }
- }
-
- TotalSize += (HeaderSize + sizeof (UINT16) * FDCount);
- TotalSize += (HeaderSize + sizeof (UINT16) * HDCount);
- TotalSize += (HeaderSize + sizeof (UINT16) * CDCount);
- TotalSize += (HeaderSize + sizeof (UINT16) * NETCount);
- TotalSize += (HeaderSize + sizeof (UINT16) * BEVCount);
-
- DevOrder = AllocateZeroPool (TotalSize);
- if (NULL == DevOrder) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Ptr = DevOrder;
-
- *((BBS_TYPE *) Ptr) = BBS_FLOPPY;
- Ptr += sizeof (BBS_TYPE);
- *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + FDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
- if (FDCount) {
- Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_FLOPPY, BbsCount, (UINT16 *) Ptr);
- }
-
- *((BBS_TYPE *) Ptr) = BBS_HARDDISK;
- Ptr += sizeof (BBS_TYPE);
- *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + HDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
- if (HDCount) {
- Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_HARDDISK, BbsCount, (UINT16 *) Ptr);
- }
-
- *((BBS_TYPE *) Ptr) = BBS_CDROM;
- Ptr += sizeof (BBS_TYPE);
- *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
- if (CDCount) {
- Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_CDROM, BbsCount, (UINT16 *) Ptr);
- }
-
- *((BBS_TYPE *) Ptr) = BBS_EMBED_NETWORK;
- Ptr += sizeof (BBS_TYPE);
- *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
- if (NETCount) {
- Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_EMBED_NETWORK, BbsCount, (UINT16 *) Ptr);
- }
-
- *((BBS_TYPE *) Ptr) = BBS_BEV_DEVICE;
- Ptr += sizeof (BBS_TYPE);
- *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
- if (BEVCount) {
- Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_BEV_DEVICE, BbsCount, (UINT16 *) Ptr);
- }
-
- Status = gRT->SetVariable (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- VAR_FLAG,
- TotalSize,
- DevOrder
- );
- SafeFreePool (DevOrder);
-
- return Status;
-}
-
-EFI_STATUS
-BdsUpdateLegacyDevOrder (
- VOID
- )
-/*++
-Format of LegacyDevOrder variable:
-|-----------------------------------------------------------------------------------------------------------------
-| BBS_FLOPPY | Length | Index0 | Index1 | ... | BBS_HARDDISK | Length | Index0 | Index1 | ... | BBS_CDROM | Length | Index0 | ...
-|-----------------------------------------------------------------------------------------------------------------
-
-Length is a 16 bit integer, it indicates how many Indexes follows, including the size of itself.
-Index# is a 16 bit integer, the low byte of it stands for the index in BBS table
- the high byte of it only have two value 0 and 0xFF, 0xFF means this device has been
- disabled by user.
---*/
-{
- UINT8 *DevOrder;
- UINT8 *NewDevOrder;
- UINTN DevOrderSize;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- EFI_STATUS Status;
- UINT16 HddCount;
- UINT16 BbsCount;
- HDD_INFO *LocalHddInfo;
- BBS_TABLE *LocalBbsTable;
- UINTN Index;
- UINTN Index2;
- UINTN *Idx;
- UINTN FDCount;
- UINTN HDCount;
- UINTN CDCount;
- UINTN NETCount;
- UINTN BEVCount;
- UINTN TotalSize;
- UINTN HeaderSize;
- UINT8 *Ptr;
- UINT8 *NewPtr;
- UINT16 *NewFDPtr;
- UINT16 *NewHDPtr;
- UINT16 *NewCDPtr;
- UINT16 *NewNETPtr;
- UINT16 *NewBEVPtr;
- UINT16 *NewDevPtr;
- UINT16 Length;
- UINT16 tmp;
- UINTN FDIndex;
- UINTN HDIndex;
- UINTN CDIndex;
- UINTN NETIndex;
- UINTN BEVIndex;
-
- LocalHddInfo = NULL;
- LocalBbsTable = NULL;
- Idx = NULL;
- FDCount = 0;
- HDCount = 0;
- CDCount = 0;
- NETCount = 0;
- BEVCount = 0;
- TotalSize = 0;
- HeaderSize = sizeof (BBS_TYPE) + sizeof (UINT16);
- FDIndex = 0;
- HDIndex = 0;
- CDIndex = 0;
- NETIndex = 0;
- BEVIndex = 0;
- NewDevPtr = NULL;
-
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID**) &LegacyBios);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &LocalHddInfo,
- &BbsCount,
- &LocalBbsTable
- );
-
- DevOrder = (UINT8 *) BdsLibGetVariableAndSize (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- &DevOrderSize
- );
- if (NULL == DevOrder) {
- return BdsCreateDevOrder (LocalBbsTable, BbsCount);
- }
- //
- // First we figure out how many boot devices with same device type respectively
- //
- for (Index = 0; Index < BbsCount; Index++) {
- if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) ||
- (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM) ||
- (LocalBbsTable[Index].BootPriority == BBS_LOWEST_PRIORITY)
- ) {
- continue;
- }
-
- switch (LocalBbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- FDCount++;
- break;
-
- case BBS_HARDDISK:
- HDCount++;
- break;
-
- case BBS_CDROM:
- CDCount++;
- break;
-
- case BBS_EMBED_NETWORK:
- NETCount++;
- break;
-
- case BBS_BEV_DEVICE:
- BEVCount++;
- break;
-
- default:
- break;
- }
- }
-
- TotalSize += (HeaderSize + FDCount * sizeof (UINT16));
- TotalSize += (HeaderSize + HDCount * sizeof (UINT16));
- TotalSize += (HeaderSize + CDCount * sizeof (UINT16));
- TotalSize += (HeaderSize + NETCount * sizeof (UINT16));
- TotalSize += (HeaderSize + BEVCount * sizeof (UINT16));
-
- NewDevOrder = AllocateZeroPool (TotalSize);
- if (NULL == NewDevOrder) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewFDPtr = (UINT16 *) (NewDevOrder + HeaderSize);
- NewHDPtr = (UINT16 *) ((UINT8 *) NewFDPtr + FDCount * sizeof (UINT16) + HeaderSize);
- NewCDPtr = (UINT16 *) ((UINT8 *) NewHDPtr + HDCount * sizeof (UINT16) + HeaderSize);
- NewNETPtr = (UINT16 *) ((UINT8 *) NewCDPtr + CDCount * sizeof (UINT16) + HeaderSize);
- NewBEVPtr = (UINT16 *) ((UINT8 *) NewNETPtr + NETCount * sizeof (UINT16) + HeaderSize);
-
- //
- // copy FD
- //
- Ptr = DevOrder;
- NewPtr = NewDevOrder;
- *((BBS_TYPE *) NewPtr) = *((BBS_TYPE *) Ptr);
- Ptr += sizeof (BBS_TYPE);
- NewPtr += sizeof (BBS_TYPE);
- Length = *((UINT16 *) Ptr);
- *((UINT16 *) NewPtr) = (UINT16) (sizeof (UINT16) + FDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
-
- for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {
- if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||
- LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||
- LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||
- LocalBbsTable[*Ptr].DeviceType != BBS_FLOPPY
- ) {
- Ptr += sizeof (UINT16);
- continue;
- }
-
- NewFDPtr[FDIndex] = *(UINT16 *) Ptr;
- FDIndex++;
- Ptr += sizeof (UINT16);
- }
- //
- // copy HD
- //
- NewPtr = (UINT8 *) NewHDPtr - HeaderSize;
- *((BBS_TYPE *) NewPtr) = *((BBS_TYPE *) Ptr);
- Ptr += sizeof (BBS_TYPE);
- NewPtr += sizeof (BBS_TYPE);
- Length = *((UINT16 *) Ptr);
- *((UINT16 *) NewPtr) = (UINT16) (sizeof (UINT16) + HDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
-
- for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {
- if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||
- LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||
- LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||
- LocalBbsTable[*Ptr].DeviceType != BBS_HARDDISK
- ) {
- Ptr += sizeof (UINT16);
- continue;
- }
-
- NewHDPtr[HDIndex] = *(UINT16 *) Ptr;
- HDIndex++;
- Ptr += sizeof (UINT16);
- }
- //
- // copy CD
- //
- NewPtr = (UINT8 *) NewCDPtr - HeaderSize;
- *((BBS_TYPE *) NewPtr) = *((BBS_TYPE *) Ptr);
- Ptr += sizeof (BBS_TYPE);
- NewPtr += sizeof (BBS_TYPE);
- Length = *((UINT16 *) Ptr);
- *((UINT16 *) NewPtr) = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
-
- for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {
- if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||
- LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||
- LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||
- LocalBbsTable[*Ptr].DeviceType != BBS_CDROM
- ) {
- Ptr += sizeof (UINT16);
- continue;
- }
-
- NewCDPtr[CDIndex] = *(UINT16 *) Ptr;
- CDIndex++;
- Ptr += sizeof (UINT16);
- }
- //
- // copy NET
- //
- NewPtr = (UINT8 *) NewNETPtr - HeaderSize;
- *((BBS_TYPE *) NewPtr) = *((BBS_TYPE *) Ptr);
- Ptr += sizeof (BBS_TYPE);
- NewPtr += sizeof (BBS_TYPE);
- Length = *((UINT16 *) Ptr);
- *((UINT16 *) NewPtr) = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
-
- for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {
- if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||
- LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||
- LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||
- LocalBbsTable[*Ptr].DeviceType != BBS_EMBED_NETWORK
- ) {
- Ptr += sizeof (UINT16);
- continue;
- }
-
- NewNETPtr[NETIndex] = *(UINT16 *) Ptr;
- NETIndex++;
- Ptr += sizeof (UINT16);
- }
- //
- // copy BEV
- //
- NewPtr = (UINT8 *) NewBEVPtr - HeaderSize;
- *((BBS_TYPE *) NewPtr) = *((BBS_TYPE *) Ptr);
- Ptr += sizeof (BBS_TYPE);
- NewPtr += sizeof (BBS_TYPE);
- Length = *((UINT16 *) Ptr);
- *((UINT16 *) NewPtr) = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
-
- for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {
- if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||
- LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||
- LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||
- LocalBbsTable[*Ptr].DeviceType != BBS_BEV_DEVICE
- ) {
- Ptr += sizeof (UINT16);
- continue;
- }
-
- NewBEVPtr[BEVIndex] = *(UINT16 *) Ptr;
- BEVIndex++;
- Ptr += sizeof (UINT16);
- }
-
- for (Index = 0; Index < BbsCount; Index++) {
- if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) ||
- (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM) ||
- (LocalBbsTable[Index].BootPriority == BBS_LOWEST_PRIORITY)
- ) {
- continue;
- }
-
- switch (LocalBbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- Idx = &FDIndex;
- NewDevPtr = NewFDPtr;
- break;
-
- case BBS_HARDDISK:
- Idx = &HDIndex;
- NewDevPtr = NewHDPtr;
- break;
-
- case BBS_CDROM:
- Idx = &CDIndex;
- NewDevPtr = NewCDPtr;
- break;
-
- case BBS_EMBED_NETWORK:
- Idx = &NETIndex;
- NewDevPtr = NewNETPtr;
- break;
-
- case BBS_BEV_DEVICE:
- Idx = &BEVIndex;
- NewDevPtr = NewBEVPtr;
- break;
-
- default:
- Idx = NULL;
- break;
- }
- //
- // at this point we have copied those valid indexes to new buffer
- // and we should check if there is any new appeared boot device
- //
- if (Idx) {
- for (Index2 = 0; Index2 < *Idx; Index2++) {
- if ((NewDevPtr[Index2] & 0xFF) == (UINT16) Index) {
- break;
- }
- }
-
- if (Index2 == *Idx) {
- //
- // Index2 == *Idx means we didn't find Index
- // so Index is a new appeared device's index in BBS table
- // save it.
- //
- NewDevPtr[*Idx] = (UINT16) (Index & 0xFF);
- (*Idx)++;
- }
- }
- }
-
- if (FDCount) {
- //
- // Just to make sure that disabled indexes are all at the end of the array
- //
- for (Index = 0; Index < FDIndex - 1; Index++) {
- if (0xFF00 != (NewFDPtr[Index] & 0xFF00)) {
- continue;
- }
-
- for (Index2 = Index + 1; Index2 < FDIndex; Index2++) {
- if (0 == (NewFDPtr[Index2] & 0xFF00)) {
- tmp = NewFDPtr[Index];
- NewFDPtr[Index] = NewFDPtr[Index2];
- NewFDPtr[Index2] = tmp;
- break;
- }
- }
- }
- }
-
- if (HDCount) {
- //
- // Just to make sure that disabled indexes are all at the end of the array
- //
- for (Index = 0; Index < HDIndex - 1; Index++) {
- if (0xFF00 != (NewHDPtr[Index] & 0xFF00)) {
- continue;
- }
-
- for (Index2 = Index + 1; Index2 < HDIndex; Index2++) {
- if (0 == (NewHDPtr[Index2] & 0xFF00)) {
- tmp = NewHDPtr[Index];
- NewHDPtr[Index] = NewHDPtr[Index2];
- NewHDPtr[Index2] = tmp;
- break;
- }
- }
- }
- }
-
- if (CDCount) {
- //
- // Just to make sure that disabled indexes are all at the end of the array
- //
- for (Index = 0; Index < CDIndex - 1; Index++) {
- if (0xFF00 != (NewCDPtr[Index] & 0xFF00)) {
- continue;
- }
-
- for (Index2 = Index + 1; Index2 < CDIndex; Index2++) {
- if (0 == (NewCDPtr[Index2] & 0xFF00)) {
- tmp = NewCDPtr[Index];
- NewCDPtr[Index] = NewCDPtr[Index2];
- NewCDPtr[Index2] = tmp;
- break;
- }
- }
- }
- }
-
- if (NETCount) {
- //
- // Just to make sure that disabled indexes are all at the end of the array
- //
- for (Index = 0; Index < NETIndex - 1; Index++) {
- if (0xFF00 != (NewNETPtr[Index] & 0xFF00)) {
- continue;
- }
-
- for (Index2 = Index + 1; Index2 < NETIndex; Index2++) {
- if (0 == (NewNETPtr[Index2] & 0xFF00)) {
- tmp = NewNETPtr[Index];
- NewNETPtr[Index] = NewNETPtr[Index2];
- NewNETPtr[Index2] = tmp;
- break;
- }
- }
- }
- }
-
- if (BEVCount) {
- //
- // Just to make sure that disabled indexes are all at the end of the array
- //
- for (Index = 0; Index < BEVIndex - 1; Index++) {
- if (0xFF00 != (NewBEVPtr[Index] & 0xFF00)) {
- continue;
- }
-
- for (Index2 = Index + 1; Index2 < BEVIndex; Index2++) {
- if (0 == (NewBEVPtr[Index2] & 0xFF00)) {
- tmp = NewBEVPtr[Index];
- NewBEVPtr[Index] = NewBEVPtr[Index2];
- NewBEVPtr[Index2] = tmp;
- break;
- }
- }
- }
- }
-
- SafeFreePool (DevOrder);
-
- Status = gRT->SetVariable (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- VAR_FLAG,
- TotalSize,
- NewDevOrder
- );
- SafeFreePool (NewDevOrder);
-
- return Status;
-}
-
-EFI_STATUS
-BdsSetBootPriority4SameTypeDev (
- IN UINT16 DeviceType,
- IN OUT BBS_TABLE *LocalBbsTable,
- IN OUT UINT16 *Priority
- )
-/*++
-DeviceType - BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM and so on
-LocalBbsTable - BBS table instance
-Priority - As input arg, it is the start point of boot priority, as output arg, it is the start point of boot
- priority can be used next time.
---*/
-{
- UINT8 *DevOrder;
-
- UINT8 *OrigBuffer;
- UINT16 *DevIndex;
- UINTN DevOrderSize;
- UINTN DevCount;
- UINTN Index;
-
- DevOrder = BdsLibGetVariableAndSize (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- &DevOrderSize
- );
- if (NULL == DevOrder) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- OrigBuffer = DevOrder;
- while (DevOrder < OrigBuffer + DevOrderSize) {
- if (DeviceType == * (BBS_TYPE *) DevOrder) {
- break;
- }
-
- DevOrder += sizeof (BBS_TYPE);
- DevOrder += *(UINT16 *) DevOrder;
- }
-
- if (DevOrder >= OrigBuffer + DevOrderSize) {
- SafeFreePool (OrigBuffer);
- return EFI_NOT_FOUND;
- }
-
- DevOrder += sizeof (BBS_TYPE);
- DevCount = (*((UINT16 *) DevOrder) - sizeof (UINT16)) / sizeof (UINT16);
- DevIndex = (UINT16 *) (DevOrder + sizeof (UINT16));
- //
- // If the high byte of the DevIndex is 0xFF, it indicates that this device has been disabled.
- //
- for (Index = 0; Index < DevCount; Index++) {
- if ((DevIndex[Index] & 0xFF00) == 0xFF00) {
- //
- // LocalBbsTable[DevIndex[Index] & 0xFF].BootPriority = BBS_DISABLED_ENTRY;
- //
- } else {
- LocalBbsTable[DevIndex[Index] & 0xFF].BootPriority = *Priority;
- (*Priority)++;
- }
- }
-
- SafeFreePool (OrigBuffer);
- return EFI_SUCCESS;
-}
-
-VOID
-PrintBbsTable (
- IN BBS_TABLE *LocalBbsTable
- )
-{
- UINT16 Idx;
-
- DEBUG ((EFI_D_ERROR, "\n"));
- DEBUG ((EFI_D_ERROR, " NO Prio bb/dd/ff cl/sc Type Stat segm:offs\n"));
- DEBUG ((EFI_D_ERROR, "=============================================\n"));
- for (Idx = 0; Idx < MAX_BBS_ENTRIES; Idx++) {
- if ((LocalBbsTable[Idx].BootPriority == BBS_IGNORE_ENTRY) ||
- (LocalBbsTable[Idx].BootPriority == BBS_DO_NOT_BOOT_FROM) ||
- (LocalBbsTable[Idx].BootPriority == BBS_LOWEST_PRIORITY)
- ) {
- continue;
- }
-
- DEBUG (
- (EFI_D_ERROR,
- " %02x: %04x %02x/%02x/%02x %02x/02%x %04x %04x %04x:%04x\n",
- (UINTN) Idx,
- (UINTN) LocalBbsTable[Idx].BootPriority,
- (UINTN) LocalBbsTable[Idx].Bus,
- (UINTN) LocalBbsTable[Idx].Device,
- (UINTN) LocalBbsTable[Idx].Function,
- (UINTN) LocalBbsTable[Idx].Class,
- (UINTN) LocalBbsTable[Idx].SubClass,
- (UINTN) LocalBbsTable[Idx].DeviceType,
- (UINTN) * (UINT16 *) &LocalBbsTable[Idx].StatusFlags,
- (UINTN) LocalBbsTable[Idx].BootHandlerSegment,
- (UINTN) LocalBbsTable[Idx].BootHandlerOffset,
- (UINTN) ((LocalBbsTable[Idx].MfgStringSegment << 4) + LocalBbsTable[Idx].MfgStringOffset),
- (UINTN) ((LocalBbsTable[Idx].DescStringSegment << 4) + LocalBbsTable[Idx].DescStringOffset))
- );
- }
-
- DEBUG ((EFI_D_ERROR, "\n"));
-}
-
-EFI_STATUS
-BdsRefreshBbsTableForBoot (
- IN BDS_COMMON_OPTION *Entry
- )
-{
- EFI_STATUS Status;
- UINT16 HddCount;
- UINT16 BbsCount;
- HDD_INFO *LocalHddInfo;
- BBS_TABLE *LocalBbsTable;
- UINT16 DevType;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINTN Index;
- UINT16 Priority;
- UINT16 *BootOrder;
- UINTN BootOrderSize;
- UINT8 *BootOptionVar;
- UINTN BootOptionSize;
- UINT16 BootOption[100];
- UINT8 *Ptr;
- UINT16 DevPathLen;
- EFI_DEVICE_PATH_PROTOCOL *DevPath;
-
- HddCount = 0;
- BbsCount = 0;
- LocalHddInfo = NULL;
- LocalBbsTable = NULL;
- DevType = BBS_UNKNOWN;
-
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID**) &LegacyBios);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &LocalHddInfo,
- &BbsCount,
- &LocalBbsTable
- );
- //
- // First, set all the present devices' boot priority to BBS_UNPRIORITIZED_ENTRY
- // We will set them according to the settings setup by user
- //
- for (Index = 0; Index < BbsCount; Index++) {
- if (!((BBS_IGNORE_ENTRY == LocalBbsTable[Index].BootPriority) ||
- (BBS_DO_NOT_BOOT_FROM == LocalBbsTable[Index].BootPriority) ||
- (BBS_LOWEST_PRIORITY == LocalBbsTable[Index].BootPriority))) {
- LocalBbsTable[Index].BootPriority = BBS_UNPRIORITIZED_ENTRY;
- }
- }
- //
- // boot priority always starts at 0
- //
- Priority = 0;
- if (Entry->LoadOptionsSize == sizeof (BBS_TABLE) + sizeof (UINT16)) {
- //
- // If Entry stands for a legacy boot option, we prioritize the devices with the same type first.
- //
- DevType = ((BBS_TABLE *) Entry->LoadOptions)->DeviceType;
- Status = BdsSetBootPriority4SameTypeDev (
- DevType,
- LocalBbsTable,
- &Priority
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- //
- // we have to set the boot priority for other BBS entries with different device types
- //
- BootOrder = (UINT16 *) BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- for (Index = 0; BootOrder && Index < BootOrderSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOption,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (NULL == BootOptionVar) {
- continue;
- }
-
- Ptr = BootOptionVar;
-
- Ptr += sizeof (UINT32);
- DevPathLen = *(UINT16 *) Ptr;
- Ptr += sizeof (UINT16);
- Ptr += StrSize ((UINT16 *) Ptr);
- DevPath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- if (BBS_DEVICE_PATH != DevPath->Type || BBS_BBS_DP != DevPath->SubType) {
- SafeFreePool (BootOptionVar);
- continue;
- }
-
- Ptr += DevPathLen;
- if (DevType == ((BBS_TABLE *) Ptr)->DeviceType) {
- //
- // We don't want to process twice for a device type
- //
- SafeFreePool (BootOptionVar);
- continue;
- }
-
- Status = BdsSetBootPriority4SameTypeDev (
- ((BBS_TABLE *) Ptr)->DeviceType,
- LocalBbsTable,
- &Priority
- );
- SafeFreePool (BootOptionVar);
- if (EFI_ERROR (Status)) {
- break;
- }
- }
-
- if (BootOrder) {
- SafeFreePool (BootOrder);
- }
- //
- // For debug
- //
- PrintBbsTable (LocalBbsTable);
-
- return Status;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.h
deleted file mode 100644
index 9a2007c..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BBSsupport.h
-
-Abstract:
-
- declares interface functions
-
-Revision History
-
---*/
-
-#ifndef _EFI_BDS_BBS_SUPPORT_H
-#define _EFI_BDS_BBS_SUPPORT_H
-
-#include "BootMaint/BootMaint.h"
-
-#if defined (MDE_CPU_IA32)
-#define REFRESH_LEGACY_BOOT_OPTIONS \
- BdsDeleteAllInvalidLegacyBootOptions ();\
- BdsAddNonExistingLegacyBootOptions (); \
- BdsUpdateLegacyDevOrder ()
-#else
-#define REFRESH_LEGACY_BOOT_OPTIONS
-#endif
-
-VOID
-BdsBuildLegacyDevNameString (
- IN BBS_TABLE *CurBBSEntry,
- IN UINTN Index,
- IN UINTN BufSize,
- OUT CHAR16 *BootString
- );
-
-EFI_STATUS
-BdsDeleteAllInvalidLegacyBootOptions (
- VOID
- );
-
-EFI_STATUS
-BdsAddNonExistingLegacyBootOptions (
- VOID
- )
-/*++
-
-Routine Description:
-
- Add the legacy boot options from BBS table if they do not exist.
-
-Arguments:
-
- None.
-
-Returns:
-
- EFI_SUCCESS - The boot options are added successfully or they are already in boot options.
- others - An error occurred when creating legacy boot options.
-
---*/
-;
-
-EFI_STATUS
-BdsUpdateLegacyDevOrder (
- VOID
- );
-
-EFI_STATUS
-BdsRefreshBbsTableForBoot (
- IN BDS_COMMON_OPTION *Entry
- );
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Bm.vfr b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Bm.vfr
deleted file mode 100644
index b5364c3..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Bm.vfr
+++ /dev/null
@@ -1,495 +0,0 @@
-// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// bm.vfr
-//
-// Abstract:
-//
-// Boot Maintenance Utility Formset
-//
-// Revision History:
-//
-// --*/
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-#include "FormGuid.h"
-
-#pragma pack(1)
-
-//
-// This is the structure that will be used to store the
-// question's current value. Use it at initialize time to
-// set default value for each question. When using at run
-// time, this map is returned by the callback function,
-// so dynamically changing the question's value will be
-// possible through this mechanism
-//
-typedef struct {
-
-//
-// Three questions displayed at the main page
-// for Timeout, BootNext Variables respectively
-//
- UINT16 BootTimeOut;
- UINT16 BootNext;
-
-//
-// This is the COM1 Attributes value storage
-//
- UINT8 COM1BaudRate;
- UINT8 COM1DataRate;
- UINT8 COM1StopBits;
- UINT8 COM1Parity;
- UINT8 COM1TerminalType;
-
-//
-// This is the COM2 Attributes value storage
-//
- UINT8 COM2BaudRate;
- UINT8 COM2DataRate;
- UINT8 COM2StopBits;
- UINT8 COM2Parity;
- UINT8 COM2TerminalType;
-
-//
-// Driver Option Add Handle page storage
-//
- UINT16 DriverAddHandleDesc[100];
- UINT16 DriverAddHandleOptionalData[100];
- UINT8 DriverAddActive;
- UINT8 DriverAddForceReconnect;
-
-//
-// Console Input/Output/Errorout using COM port check storage
-//
- UINT8 ConsoleInputCOM1;
- UINT8 ConsoleInputCOM2;
- UINT8 ConsoleOutputCOM1;
- UINT8 ConsoleOutputCOM2;
- UINT8 ConsoleErrorCOM1;
- UINT8 ConsoleErrorCOM2;
-
-//
-// At most 100 input/output/errorout device for console storage
-//
- UINT8 ConsoleCheck[100];
-
-//
-// Boot or Driver Option Order storage
-//
- UINT8 OptionOrder[100];
- UINT8 DriverOptionToBeDeleted[100];
-
-//
-// Boot Option Delete storage
-//
- UINT8 BootOptionDel[100];
- UINT8 DriverOptionDel[100];
-
-//
-// This is the Terminal Attributes value storage
-//
- UINT8 COMBaudRate;
- UINT8 COMDataRate;
- UINT8 COMStopBits;
- UINT8 COMParity;
- UINT8 COMTerminalType;
-
-//
-// Legacy Device Order Selection Storage
-//
- UINT8 LegacyFD[100];
- UINT8 LegacyHD[100];
- UINT8 LegacyCD[100];
- UINT8 LegacyNET[100];
- UINT8 LegacyBEV[100];
-} BMM_FAKE_NV_DATA;
-#pragma pack()
-
-
-#define FORM_MAIN_ID 0x0001
-#define FORM_BOOT_ADD_ID 0x0002
-#define FORM_BOOT_DEL_ID 0x0003
-#define FORM_BOOT_CHG_ID 0x0004
-#define FORM_DRV_ADD_ID 0x0005
-#define FORM_DRV_DEL_ID 0x0006
-#define FORM_DRV_CHG_ID 0x0007
-#define FORM_CON_MAIN_ID 0x0008
-#define FORM_CON_IN_ID 0x0009
-#define FORM_CON_OUT_ID 0x000A
-#define FORM_CON_ERR_ID 0x000B
-#define FORM_FILE_SEEK_ID 0x000C
-#define FORM_FILE_NEW_SEEK_ID 0x000D
-#define FORM_DRV_ADD_FILE_ID 0x000E
-#define FORM_DRV_ADD_HANDLE_ID 0x000F
-#define FORM_DRV_ADD_HANDLE_DESC_ID 0x0010
-#define FORM_BOOT_NEXT_ID 0x0011
-#define FORM_TIME_OUT_ID 0x0012
-#define FORM_RESET 0x0013
-#define FORM_BOOT_SETUP_ID 0x0014
-#define FORM_DRIVER_SETUP_ID 0x0015
-#define FORM_BOOT_LEGACY_DEVICE_ID 0x0016
-#define FORM_CON_COM_ID 0x0017
-#define FORM_CON_COM_SETUP_ID 0x0018
-#define FORM_SET_FD_ORDER_ID 0x0019
-#define FORM_SET_HD_ORDER_ID 0x001A
-#define FORM_SET_CD_ORDER_ID 0x001B
-#define FORM_SET_NET_ORDER_ID 0x001C
-#define FORM_SET_BEV_ORDER_ID 0x001D
-
-#define KEY_VALUE_BOOT_FROM_FILE 0x0092
-
-formset
- guid = MAIN_FORMSET_GUID,
- title = STRING_TOKEN(STR_FORM_MAIN_TITLE), // uint8 opcode, uint8 length, guid Handle, uint16 Title
- help = STRING_TOKEN(STR_NULL_STRING),
- class = 0,
- subclass = 0,
-
- form formid = FORM_MAIN_ID,
- title = STRING_TOKEN(STR_FORM_MAIN_TITLE);
-
- goto FORM_BOOT_SETUP_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_SETUP_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_BOOT_SETUP_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- goto FORM_DRIVER_SETUP_ID,
- prompt = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE),
- help = STRING_TOKEN(STR_FORM_DRIVER_SETUP_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_DRIVER_SETUP_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- goto FORM_CON_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE),
- help = STRING_TOKEN(STR_FORM_CON_MAIN_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_CON_MAIN_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- text
- help = STRING_TOKEN(STR_BOOT_FROM_FILE_HELP),
- text = STRING_TOKEN(STR_BOOT_FROM_FILE),
- text = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE | NV_ACCESS,
- key = KEY_VALUE_BOOT_FROM_FILE;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
-// label FORM_MAIN_ID;
-
- goto FORM_BOOT_NEXT_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_NEXT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_BOOT_NEXT_ID;
-
- goto FORM_TIME_OUT_ID,
- prompt = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE),
- help = STRING_TOKEN(STR_FORM_TIME_OUT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_TIME_OUT_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_RESET),
- help = STRING_TOKEN(STR_RESET),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_RESET;
-
- endform;
-
- form formid = FORM_BOOT_SETUP_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_MAIN_ID;
-
- goto FORM_BOOT_ADD_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_ADD_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_BOOT_ADD_ID;
-
- goto FORM_BOOT_DEL_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE),
- help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_BOOT_DEL_ID;
-
- goto FORM_BOOT_CHG_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),
- help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_BOOT_CHG_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
- //
- // We will add "Select Legacy Boot Floppy Drive" and "Select Legacy Boot Hard Drive"
- // here dynamically
- //
- label FORM_BOOT_LEGACY_DEVICE_ID;
-
- endform;
-
- form formid = FORM_DRIVER_SETUP_ID,
- title = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_MAIN_ID;
-
- goto FORM_DRV_ADD_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE),
- help = STRING_TOKEN(STR_FORM_DRV_ADD_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_DRV_ADD_ID;
-
- goto FORM_DRV_DEL_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_DEL_TITLE),
- help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_DRV_DEL_ID;
-
- goto FORM_DRV_CHG_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),
- help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_DRV_CHG_ID;
- endform;
-
- form formid = FORM_BOOT_ADD_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
-
- label FORM_BOOT_ADD_ID;
- endform;
-
- form formid = FORM_BOOT_DEL_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE);
-
- label FORM_BOOT_DEL_ID;
- endform;
-
- form formid = FORM_BOOT_CHG_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE);
-
- label FORM_BOOT_CHG_ID;
-
- //
- // This tag is added for bypassing issue of setup browser
- // setup browser could not support dynamic form very well.
- //
- checkbox varid = BMM_FAKE_NV_DATA.OptionOrder[0],
- prompt = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),
- flags = 1,
- key = 0,
- endcheckbox;
-
- endform;
-
- form formid = FORM_BOOT_NEXT_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE);
-
- label FORM_BOOT_NEXT_ID;
- endform;
-
- form formid = FORM_TIME_OUT_ID,
- title = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE);
-
- label FORM_TIME_OUT_ID;
- endform;
-
- form formid = FORM_DRV_ADD_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_MAIN_ID;
-
- goto FORM_DRV_ADD_FILE_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE),
- help = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_DRV_ADD_FILE_ID;
-
- endform;
-
- form formid = FORM_DRV_DEL_ID,
- title = STRING_TOKEN(STR_FORM_DRV_DEL_TITLE);
-
- label FORM_DRV_DEL_ID;
-
- endform;
-
- form formid = FORM_DRV_CHG_ID,
- title = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE);
-
- label FORM_DRV_CHG_ID;
-
- //
- // This tag is added for bypassing issue of setup browser
- // setup browser could not support dynamic form very well.
- //
- checkbox varid = BMM_FAKE_NV_DATA.OptionOrder[0],
- prompt = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),
- help = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),
- flags = 1,
- key = 0,
- endcheckbox;
-
- endform;
-
- form formid = FORM_CON_MAIN_ID,
- title = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_MAIN_ID;
-
- goto FORM_CON_IN_ID,
- prompt = STRING_TOKEN(STR_FORM_CON_IN_TITLE),
- help = STRING_TOKEN(STR_FORM_CON_IN_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_CON_IN_ID;
-
- goto FORM_CON_OUT_ID,
- prompt = STRING_TOKEN(STR_FORM_CON_OUT_TITLE),
- help = STRING_TOKEN(STR_FORM_CON_OUT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_CON_OUT_ID;
-
- goto FORM_CON_ERR_ID,
- prompt = STRING_TOKEN(STR_FORM_STD_ERR_TITLE),
- help = STRING_TOKEN(STR_FORM_STD_ERR_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_CON_ERR_ID;
-
- goto FORM_CON_COM_ID,
- prompt = STRING_TOKEN(STR_FORM_COM_TITLE),
- help = STRING_TOKEN(STR_FORM_COM_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_CON_COM_ID;
- endform;
-
- form formid = FORM_CON_COM_ID,
- title = STRING_TOKEN(STR_FORM_COM_TITLE);
-
- label FORM_CON_COM_ID;
- endform;
-
- form formid = FORM_CON_COM_SETUP_ID,
- title = STRING_TOKEN(STR_CON_COM_SETUP);
-
- label FORM_CON_COM_SETUP_ID;
- endform;
-
- form formid = FORM_FILE_SEEK_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
-
- label FORM_FILE_SEEK_ID;
- endform;
-
- form formid = FORM_FILE_NEW_SEEK_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
-
- label FORM_FILE_NEW_SEEK_ID;
- endform;
-
- form formid = FORM_DRV_ADD_FILE_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE);
-
- label FORM_DRV_ADD_FILE_ID;
- endform;
-
- form formid = FORM_DRV_ADD_HANDLE_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_HANDLE_TITLE);
-
- label FORM_DRV_ADD_HANDLE_ID;
- endform;
-
- form formid = FORM_DRV_ADD_HANDLE_DESC_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_DESC_TITLE);
-
- label FORM_DRV_ADD_HANDLE_DESC_ID;
-
- endform;
-
- form formid = FORM_CON_IN_ID,
- title = STRING_TOKEN(STR_FORM_CON_IN_TITLE);
-
- label FORM_CON_IN_ID;
-
- endform;
-
- form formid = FORM_CON_OUT_ID,
- title = STRING_TOKEN(STR_FORM_CON_OUT_TITLE);
-
- label FORM_CON_OUT_ID;
-
- endform;
-
- form formid = FORM_CON_ERR_ID,
- title = STRING_TOKEN(STR_FORM_STD_ERR_TITLE);
-
- label FORM_CON_ERR_ID;
-
- endform;
-
- form formid = FORM_SET_FD_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_FD_ORDER_TITLE);
-
- label FORM_SET_FD_ORDER_ID;
- endform;
-
- form formid = FORM_SET_HD_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_HD_ORDER_TITLE);
-
- label FORM_SET_HD_ORDER_ID;
- endform;
-
- form formid = FORM_SET_CD_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_CD_ORDER_TITLE);
-
- label FORM_SET_CD_ORDER_ID;
- endform;
-
- form formid = FORM_SET_NET_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_NET_ORDER_TITLE);
-
- label FORM_SET_NET_ORDER_ID;
- endform;
-
- form formid = FORM_SET_BEV_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_BEV_ORDER_TITLE);
-
- label FORM_SET_BEV_ORDER_ID;
- endform;
-
-endformset;
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmLib.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmLib.c
deleted file mode 100644
index e9245d2..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmLib.c
+++ /dev/null
@@ -1,627 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BmLib.c
-
-AgBStract:
-
- Boot Maintainence Helper functions
-
---*/
-
-#include "BootMaint.h"
-
-EFI_STATUS
-EfiLibLocateProtocol (
- IN EFI_GUID *ProtocolGuid,
- OUT VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Find the first instance of this Protocol
- in the system and return it's interface
-
-Arguments:
-
- ProtocolGuid - Provides the protocol to search for
- Interface - On return, a pointer to the first interface
- that matches ProtocolGuid
-
-Returns:
-
- EFI_SUCCESS - A protocol instance matching ProtocolGuid was found
-
- EFI_NOT_FOUND - No protocol instances were found that match ProtocolGuid
-
---*/
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (
- ProtocolGuid,
- NULL,
- Interface
- );
- return Status;
-}
-
-EFI_FILE_HANDLE
-EfiLibOpenRoot (
- IN EFI_HANDLE DeviceHandle
- )
-/*++
-
-Routine Description:
-
- Function opens and returns a file handle to the root directory of a volume.
-
-Arguments:
-
- DeviceHandle - A handle for a device
-
-Returns:
-
- A valid file handle or NULL is returned
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;
- EFI_FILE_HANDLE File;
-
- File = NULL;
-
- //
- // File the file system interface to the device
- //
- Status = gBS->HandleProtocol (
- DeviceHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID *) &Volume
- );
-
- //
- // Open the root directory of the volume
- //
- if (!EFI_ERROR (Status)) {
- Status = Volume->OpenVolume (
- Volume,
- &File
- );
- }
- //
- // Done
- //
- return EFI_ERROR (Status) ? NULL : File;
-}
-
-BOOLEAN
-EfiGrowBuffer (
- IN OUT EFI_STATUS *Status,
- IN OUT VOID **Buffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
-
- Helper function called as part of the code needed
- to allocate the proper sized buffer for various
- EFI interfaces.
-
-Arguments:
-
- Status - Current status
-
- Buffer - Current allocated buffer, or NULL
-
- BufferSize - Current buffer size needed
-
-Returns:
-
- TRUE - if the buffer was reallocated and the caller
- should try the API again.
-
---*/
-{
- BOOLEAN TryAgain;
-
- //
- // If this is an initial request, buffer will be null with a new buffer size
- //
- if (!*Buffer && BufferSize) {
- *Status = EFI_BUFFER_TOO_SMALL;
- }
- //
- // If the status code is "buffer too small", resize the buffer
- //
- TryAgain = FALSE;
- if (*Status == EFI_BUFFER_TOO_SMALL) {
-
- SafeFreePool (*Buffer);
-
- *Buffer = AllocateZeroPool (BufferSize);
-
- if (*Buffer) {
- TryAgain = TRUE;
- } else {
- *Status = EFI_OUT_OF_RESOURCES;
- }
- }
- //
- // If there's an error, free the buffer
- //
- if (!TryAgain && EFI_ERROR (*Status) && *Buffer) {
- SafeFreePool (*Buffer);
- *Buffer = NULL;
- }
-
- return TryAgain;
-}
-
-VOID *
-EfiLibGetVariable (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid
- )
-/*++
-
-Routine Description:
- Function returns the value of the specified variable.
-
-Arguments:
- Name - A Null-terminated Unicode string that is
- the name of the vendor's variable.
-
- VendorGuid - A unique identifier for the vendor.
-
-Returns:
-
- None
-
---*/
-{
- UINTN VarSize;
-
- return BdsLibGetVariableAndSize (Name, VendorGuid, &VarSize);
-}
-
-EFI_STATUS
-EfiLibDeleteVariable (
- IN CHAR16 *VarName,
- IN EFI_GUID *VarGuid
- )
-/*++
-
-Routine Description:
- Function deletes the variable specified by VarName and VarGuid.
-
-Arguments:
- VarName - A Null-terminated Unicode string that is
- the name of the vendor's variable.
-
- VendorGuid - A unique identifier for the vendor.
-
-Returns:
-
- EFI_SUCCESS - The variable was found and removed
-
- EFI_UNSUPPORTED - The variable store was inaccessible
-
- EFI_OUT_OF_RESOURCES - The temporary buffer was not available
-
- EFI_NOT_FOUND - The variable was not found
-
---*/
-{
- VOID *VarBuf;
- EFI_STATUS Status;
-
- VarBuf = EfiLibGetVariable (VarName, VarGuid);
- Status = EFI_NOT_FOUND;
-
- if (VarBuf) {
- //
- // Delete variable from Storage
- //
- Status = gRT->SetVariable (VarName, VarGuid, VAR_FLAG, 0, NULL);
- ASSERT (!EFI_ERROR (Status));
- SafeFreePool (VarBuf);
- }
-
- return Status;
-}
-
-EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *
-EfiLibFileSystemVolumeLabelInfo (
- IN EFI_FILE_HANDLE FHand
- )
-/*++
-
-Routine Description:
-
- Function gets the file system information from an open file descriptor,
- and stores it in a buffer allocated from pool.
-
-Arguments:
-
- Fhand - A file handle
-
-Returns:
-
- A pointer to a buffer with file information or NULL is returned
-
---*/
-{
- EFI_STATUS Status;
- EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *Buffer;
- UINTN BufferSize;
- //
- // Initialize for GrowBuffer loop
- //
- Buffer = NULL;
- BufferSize = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO + 200;
-
- //
- // Call the real function
- //
- while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
- Status = FHand->GetInfo (
- FHand,
- &gEfiFileSystemVolumeLabelInfoIdGuid,
- &BufferSize,
- Buffer
- );
- }
-
- return Buffer;
-}
-
-CHAR16 *
-EfiStrDuplicate (
- IN CHAR16 *Src
- )
-{
- CHAR16 *Dest;
- UINTN Size;
-
- Size = StrSize (Src);
- Dest = AllocateZeroPool (Size);
- ASSERT (Dest != NULL);
- if (Dest) {
- CopyMem (Dest, Src, Size);
- }
-
- return Dest;
-}
-
-EFI_FILE_INFO *
-EfiLibFileInfo (
- IN EFI_FILE_HANDLE FHand
- )
-/*++
-
-Routine Description:
-
- Function gets the file information from an open file descriptor, and stores it
- in a buffer allocated from pool.
-
-Arguments:
-
- Fhand - A file handle
-
-Returns:
-
- A pointer to a buffer with file information or NULL is returned
-
---*/
-{
- EFI_STATUS Status;
- EFI_FILE_INFO *Buffer;
- UINTN BufferSize;
-
- //
- // Initialize for GrowBuffer loop
- //
- Buffer = NULL;
- BufferSize = SIZE_OF_EFI_FILE_INFO + 200;
-
- //
- // Call the real function
- //
- while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
- Status = FHand->GetInfo (
- FHand,
- &gEfiFileInfoGuid,
- &BufferSize,
- Buffer
- );
- }
-
- return Buffer;
-}
-
-UINTN
-EfiDevicePathInstanceCount (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Function is used to determine the number of device path instances
- that exist in a device path.
-
-Arguments:
- DevicePath - A pointer to a device path data structure.
-
-Returns:
-
- This function counts and returns the number of device path instances
- in DevicePath.
-
---*/
-{
- UINTN Count;
- UINTN Size;
-
- Count = 0;
- while (GetNextDevicePathInstance (&DevicePath, &Size)) {
- Count += 1;
- }
-
- return Count;
-}
-
-VOID *
-EfiReallocatePool (
- IN VOID *OldPool,
- IN UINTN OldSize,
- IN UINTN NewSize
- )
-/*++
-
-Routine Description:
- Adjusts the size of a previously allocated buffer.
-
-Arguments:
- OldPool - A pointer to the buffer whose size is being adjusted.
- OldSize - The size of the current buffer.
- NewSize - The size of the new buffer.
-
-Returns:
-
- EFI_SUCEESS - The requested number of bytes were allocated.
-
- EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.
-
- EFI_INVALID_PARAMETER - The buffer was invalid.
-
---*/
-{
- VOID *NewPool;
-
- NewPool = NULL;
- if (NewSize) {
- NewPool = AllocateZeroPool (NewSize);
- }
-
- if (OldPool) {
- if (NewPool) {
- CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
- }
-
- SafeFreePool (OldPool);
- }
-
- return NewPool;
-}
-
-EFI_STATUS
-EfiLibGetStringFromToken (
- IN EFI_GUID *ProducerGuid,
- IN STRING_REF Token,
- OUT CHAR16 **String
- )
-/*++
-
-Routine Description:
-
- Acquire the string associated with the ProducerGuid and return it.
-
-Arguments:
-
- ProducerGuid - The Guid to search the HII database for
- Token - The token value of the string to extract
- String - The string that is extracted
-
-Returns:
-
- EFI_SUCCESS - Buffer filled with the requested forms. BufferLength
- was updated.
- EFI_BUFFER_TOO_SMALL - The buffer provided was not large enough to allow the form to be stored.
-
---*/
-{
- EFI_STATUS Status;
- UINT16 HandleBufferLength;
- EFI_HII_HANDLE *HiiHandleBuffer;
- UINTN StringBufferLength;
- UINTN NumberOfHiiHandles;
- UINTN Index;
- UINT16 Length;
- EFI_GUID HiiGuid;
- EFI_HII_PROTOCOL *Hii;
-
- //
- // Initialize params.
- //
- HandleBufferLength = 0;
- HiiHandleBuffer = NULL;
-
- Status = gBS->LocateProtocol (
- &gEfiHiiProtocolGuid,
- NULL,
- (VOID**) &Hii
- );
- if (EFI_ERROR (Status)) {
- *String = NULL;
- return Status;
- }
- //
- // Get all the Hii handles
- //
- Status = BdsLibGetHiiHandles (Hii, &HandleBufferLength, &HiiHandleBuffer);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Get the Hii Handle that matches the StructureNode->ProducerName
- //
- NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);
- for (Index = 0; Index < NumberOfHiiHandles; Index++) {
- Length = 0;
- Status = ExtractDataFromHiiHandle (
- HiiHandleBuffer[Index],
- &Length,
- NULL,
- &HiiGuid
- );
- if (CompareGuid (ProducerGuid, &HiiGuid)) {
- break;
- }
- }
- //
- // Find the string based on the current language
- //
- StringBufferLength = 0x100;
- *String = AllocateZeroPool (0x100);
- ASSERT (*String != NULL);
-
- Status = Hii->GetString (
- Hii,
- HiiHandleBuffer[Index],
- Token,
- FALSE,
- NULL,
- &StringBufferLength,
- *String
- );
-
- gBS->FreePool (HiiHandleBuffer);
-
- return Status;
-}
-
-BOOLEAN
-TimeCompare (
- IN EFI_TIME *FirstTime,
- IN EFI_TIME *SecondTime
- )
-/*++
-
-Routine Description:
- Compare two EFI_TIME data.
-
-Arguments:
-
- FirstTime - A pointer to the first EFI_TIME data.
- SecondTime - A pointer to the second EFI_TIME data.
-
-Returns:
- TRUE The FirstTime is not later than the SecondTime.
- FALSE The FirstTime is later than the SecondTime.
-
---*/
-{
- if (FirstTime->Year != SecondTime->Year) {
- return (BOOLEAN) (FirstTime->Year < SecondTime->Year);
- } else if (FirstTime->Month != SecondTime->Month) {
- return (BOOLEAN) (FirstTime->Month < SecondTime->Month);
- } else if (FirstTime->Day != SecondTime->Day) {
- return (BOOLEAN) (FirstTime->Day < SecondTime->Day);
- } else if (FirstTime->Hour != SecondTime->Hour) {
- return (BOOLEAN) (FirstTime->Hour < SecondTime->Hour);
- } else if (FirstTime->Minute != SecondTime->Minute) {
- return (BOOLEAN) (FirstTime->Minute < FirstTime->Minute);
- } else if (FirstTime->Second != SecondTime->Second) {
- return (BOOLEAN) (FirstTime->Second < SecondTime->Second);
- }
-
- return (BOOLEAN) (FirstTime->Nanosecond <= SecondTime->Nanosecond);
-}
-
-UINT16 *
-EfiLibStrFromDatahub (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-{
- EFI_STATUS Status;
- UINT16 *Desc;
- EFI_DATA_HUB_PROTOCOL *Datahub;
- UINT64 Count;
- EFI_DATA_RECORD_HEADER *Record;
- EFI_SUBCLASS_TYPE1_HEADER *DataHdr;
- EFI_GUID MiscGuid = EFI_MISC_SUBCLASS_GUID;
- EFI_MISC_ONBOARD_DEVICE_DATA *ob;
- EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *Port;
- EFI_TIME CurTime;
-
- Status = gBS->LocateProtocol (
- &gEfiDataHubProtocolGuid,
- NULL,
- (VOID**) &Datahub
- );
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- Status = gRT->GetTime (&CurTime, NULL);
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- Count = 0;
- do {
- Status = Datahub->GetNextRecord (Datahub, &Count, NULL, &Record);
-
- if (EFI_ERROR (Status)) {
- break;
- }
-
- if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA && CompareGuid (&Record->DataRecordGuid, &MiscGuid)) {
- //
- // This record is what we need
- //
- DataHdr = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);
- if (EFI_MISC_ONBOARD_DEVICE_RECORD_NUMBER == DataHdr->RecordType) {
- ob = (EFI_MISC_ONBOARD_DEVICE_DATA *) (DataHdr + 1);
- if (BdsLibMatchDevicePaths ((EFI_DEVICE_PATH_PROTOCOL *) &ob->OnBoardDevicePath, DevPath)) {
- EfiLibGetStringFromToken (&Record->ProducerName, ob->OnBoardDeviceDescription, &Desc);
- return Desc;
- }
- }
-
- if (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER == DataHdr->RecordType) {
- Port = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) (DataHdr + 1);
- if (BdsLibMatchDevicePaths ((EFI_DEVICE_PATH_PROTOCOL *) &Port->PortPath, DevPath)) {
- EfiLibGetStringFromToken (&Record->ProducerName, Port->PortExternalConnectorDesignator, &Desc);
- return Desc;
- }
- }
- }
-
- } while (TimeCompare (&Record->LogTime, &CurTime) && Count != 0);
-
- return NULL;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmString.uni b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmString.uni
deleted file mode 100644
index f646d8b..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmString.uni
+++ /dev/null
Binary files differ
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.c
deleted file mode 100644
index 0f5087a..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.c
+++ /dev/null
@@ -1,1315 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootMaint.c
-
-Abstract:
-
- Boot Maintainence Main File
-
---*/
-
-#include "Bds.h"
-#include "BootMaint.h"
-#include "FormGuid.h"
-
-//
-// Form binary for Boot Maintenance
-//
-extern UINT8 BmBin[];
-extern UINT8 FEBin[];
-extern EFI_GUID gBdsStringPackGuid;
-extern BOOLEAN gConnectAllHappened;
-
-EFI_GUID EfiLegacyDevOrderGuid = EFI_LEGACY_DEV_ORDER_VARIABLE_GUID;
-
-VOID
-InitAllMenu (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-FreeAllMenu (
- VOID
- );
-
-EFI_STATUS
-CreateMenuStringToken (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN BM_MENU_OPTION *MenuOption
- )
-/*++
-Routine Description:
-
- Create string tokens for a menu from its help strings and display strings
-
-Arguments:
-
- HiiHandle - Hii Handle of the package to be updated.
-
- MenuOption - The Menu whose string tokens need to be created
-
-Returns:
-
- EFI_SUCCESS - string tokens created successfully
-
- others - contain some errors
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINTN Index;
-
- for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- HiiHandle,
- &NewMenuEntry->DisplayStringToken,
- NewMenuEntry->DisplayString
- );
-
- if (NULL == NewMenuEntry->HelpString) {
- NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;
- } else {
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- HiiHandle,
- &NewMenuEntry->HelpStringToken,
- NewMenuEntry->HelpString
- );
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-DriverCallback (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *Data,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-Routine Description:
-
- Callback Function for boot maintenance utility user interface interaction.
-
-Arguments:
-
- This - File explorer callback protocol pointer.
- KeyValue - Key value to identify the type of data to expect.
- Data - A pointer to the data being sent to the original exporting driver.
- Packet - A pointer to a packet of information which a driver passes back to the browser.
-
-Returns:
-
- EFI_SUCCESS - Callback ended successfully.
- Others - Contain some errors.
-
---*/
-{
- BMM_CALLBACK_DATA *Private;
- BM_MENU_ENTRY *NewMenuEntry;
- BMM_FAKE_NV_DATA *CurrentFakeNVMap;
- EFI_STATUS Status;
- UINTN OldValue;
- UINTN NewValue;
- UINTN Number;
- UINTN Pos;
- UINTN Bit;
- UINT16 NewValuePos;
- UINT16 Index2;
- UINT16 Index;
- UINT8 *OldLegacyDev;
- UINT8 *NewLegacyDev;
- UINT8 *Location;
- UINT8 *DisMap;
- FORM_ID FormId;
-
- OldValue = 0;
- NewValue = 0;
- Number = 0;
- OldLegacyDev = NULL;
- NewLegacyDev = NULL;
- NewValuePos = 0;
- DisMap = NULL;
-
- Private = BMM_CALLBACK_DATA_FROM_THIS (This);
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->BmmCallbackHandle;
- CurrentFakeNVMap = (BMM_FAKE_NV_DATA *) Data->NvRamMap;
- Private->BmmFakeNvData = CurrentFakeNVMap;
- Location = (UINT8 *) &UpdateData->Data;
-
- UpdatePageId (Private, KeyValue);
-
- //
- // need to be subtituded.
- //
- // Update Select FD/HD/CD/NET/BEV Order Form
- //
- if (FORM_SET_FD_ORDER_ID == Private->BmmPreviousPageId ||
- FORM_SET_HD_ORDER_ID == Private->BmmPreviousPageId ||
- FORM_SET_CD_ORDER_ID == Private->BmmPreviousPageId ||
- FORM_SET_NET_ORDER_ID == Private->BmmPreviousPageId ||
- FORM_SET_BEV_ORDER_ID == Private->BmmPreviousPageId ||
- ((FORM_BOOT_SETUP_ID == Private->BmmPreviousPageId) &&
- (KeyValue >= LEGACY_FD_QUESTION_ID) &&
- (KeyValue < (LEGACY_BEV_QUESTION_ID + 100)) )
- ) {
-
- DisMap = Private->BmmOldFakeNVData.DisableMap;
-
- FormId = Private->BmmPreviousPageId;
- if (FormId == FORM_BOOT_SETUP_ID) {
- FormId = Private->BmmCurrentPageId;
- }
-
- switch (FormId) {
- case FORM_SET_FD_ORDER_ID:
- Number = (UINT16) LegacyFDMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyFD;
- NewLegacyDev = CurrentFakeNVMap->LegacyFD;
- break;
-
- case FORM_SET_HD_ORDER_ID:
- Number = (UINT16) LegacyHDMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyHD;
- NewLegacyDev = CurrentFakeNVMap->LegacyHD;
- break;
-
- case FORM_SET_CD_ORDER_ID:
- Number = (UINT16) LegacyCDMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyCD;
- NewLegacyDev = CurrentFakeNVMap->LegacyCD;
- break;
-
- case FORM_SET_NET_ORDER_ID:
- Number = (UINT16) LegacyNETMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyNET;
- NewLegacyDev = CurrentFakeNVMap->LegacyNET;
- break;
-
- case FORM_SET_BEV_ORDER_ID:
- Number = (UINT16) LegacyBEVMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyBEV;
- NewLegacyDev = CurrentFakeNVMap->LegacyBEV;
- break;
-
- default:
- break;
- }
- //
- // First, find the different position
- // if there is change, it should be only one
- //
- for (Index = 0; Index < Number; Index++) {
- if (OldLegacyDev[Index] != NewLegacyDev[Index]) {
- OldValue = OldLegacyDev[Index];
- NewValue = NewLegacyDev[Index];
- break;
- }
- }
-
- if (Index != Number) {
- //
- // there is change, now process
- //
- if (0xFF == NewValue) {
- //
- // This item will be disable
- // Just move the items behind this forward to overlap it
- //
- Pos = OldValue / 8;
- Bit = 7 - (OldValue % 8);
- DisMap[Pos] |= (UINT8) (1 << Bit);
- for (Index2 = Index; Index2 < Number - 1; Index2++) {
- NewLegacyDev[Index2] = NewLegacyDev[Index2 + 1];
- }
-
- NewLegacyDev[Index2] = 0xFF;
- } else {
- for (Index2 = 0; Index2 < Number; Index2++) {
- if (Index2 == Index) {
- continue;
- }
-
- if (OldLegacyDev[Index2] == NewValue) {
- //
- // If NewValue is in OldLegacyDev array
- // remember its old position
- //
- NewValuePos = Index2;
- break;
- }
- }
-
- if (Index2 != Number) {
- //
- // We will change current item to an existing item
- // (It's hard to describe here, please read code, it's like a cycle-moving)
- //
- for (Index2 = NewValuePos; Index2 != Index;) {
- if (NewValuePos < Index) {
- NewLegacyDev[Index2] = OldLegacyDev[Index2 + 1];
- Index2++;
- } else {
- NewLegacyDev[Index2] = OldLegacyDev[Index2 - 1];
- Index2--;
- }
- }
- } else {
- //
- // If NewValue is not in OldlegacyDev array, we are changing to a disabled item
- // so we should modify DisMap to reflect the change
- //
- Pos = NewValue / 8;
- Bit = 7 - (NewValue % 8);
- DisMap[Pos] &= ~ (UINT8) (1 << Bit);
- if (0xFF != OldValue) {
- //
- // Because NewValue is a item that was disabled before
- // so after changing the OldValue should be disabled
- // actually we are doing a swap of enable-disable states of two items
- //
- Pos = OldValue / 8;
- Bit = 7 - (OldValue % 8);
- DisMap[Pos] |= (UINT8) (1 << Bit);
- }
- }
- }
- //
- // To prevent DISABLE appears in the middle of the list
- // we should perform a re-ordering
- //
- Index = 0;
- while (Index < Number) {
- if (0xFF != NewLegacyDev[Index]) {
- Index++;
- continue;
- }
-
- Index2 = Index;
- Index2++;
- while (Index2 < Number) {
- if (0xFF != NewLegacyDev[Index2]) {
- break;
- }
-
- Index2++;
- }
-
- if (Index2 < Number) {
- NewLegacyDev[Index] = NewLegacyDev[Index2];
- NewLegacyDev[Index2] = 0xFF;
- }
-
- Index++;
- }
-
- CopyMem (
- OldLegacyDev,
- NewLegacyDev,
- Number
- );
- }
- }
-
- if (KeyValue < FILE_OPTION_OFFSET) {
- if (KeyValue < NORMAL_GOTO_OFFSET) {
- switch (KeyValue) {
- case KEY_VALUE_BOOT_FROM_FILE:
- Private->FeCurrentState = BOOT_FROM_FILE_STATE;
-
- //
- // Exit Bmm main formset to send File Explorer formset.
- //
- CreateCallbackPacket (Packet, EXIT_REQUIRED);
-
- break;
-
- case FORM_BOOT_ADD_ID:
- Private->FeCurrentState = ADD_BOOT_OPTION_STATE;
-
- //
- // Exit Bmm main formset to send File Explorer formset.
- //
- CreateCallbackPacket (Packet, EXIT_REQUIRED);
- break;
-
- case FORM_DRV_ADD_FILE_ID:
- Private->FeCurrentState = ADD_DRIVER_OPTION_STATE;
-
- //
- // Exit Bmm main formset to send File Explorer formset.
- //
- CreateCallbackPacket (Packet, EXIT_REQUIRED);
-
- break;
-
- case FORM_DRV_ADD_HANDLE_ID:
- CleanUpPage (FORM_DRV_ADD_HANDLE_ID, Private);
- UpdateDrvAddHandlePage (Private);
- break;
-
- case FORM_BOOT_DEL_ID:
- CleanUpPage (FORM_BOOT_DEL_ID, Private);
- UpdateBootDelPage (Private);
- break;
-
- case FORM_BOOT_CHG_ID:
- case FORM_DRV_CHG_ID:
- UpdatePageBody (KeyValue, Private);
- break;
-
- case FORM_DRV_DEL_ID:
- CleanUpPage (FORM_DRV_DEL_ID, Private);
- UpdateDrvDelPage (Private);
- break;
-
- case FORM_BOOT_NEXT_ID:
- CleanUpPage (FORM_BOOT_NEXT_ID, Private);
- UpdateBootNextPage (Private);
- break;
-
- case FORM_TIME_OUT_ID:
- CleanUpPage (FORM_TIME_OUT_ID, Private);
- UpdateTimeOutPage (Private);
- break;
-
- case FORM_RESET:
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- return EFI_UNSUPPORTED;
-
- case FORM_CON_IN_ID:
- case FORM_CON_OUT_ID:
- case FORM_CON_ERR_ID:
- UpdatePageBody (KeyValue, Private);
- break;
-
- case FORM_CON_COM_ID:
- CleanUpPage (FORM_CON_COM_ID, Private);
- UpdateConCOMPage (Private);
- break;
-
- case FORM_SET_FD_ORDER_ID:
- case FORM_SET_HD_ORDER_ID:
- case FORM_SET_CD_ORDER_ID:
- case FORM_SET_NET_ORDER_ID:
- case FORM_SET_BEV_ORDER_ID:
- CleanUpPage (KeyValue, Private);
- UpdateSetLegacyDeviceOrderPage (KeyValue, Private);
- break;
-
- case KEY_VALUE_SAVE_AND_EXIT:
- case KEY_VALUE_NO_SAVE_AND_EXIT:
-
- if (KeyValue == KEY_VALUE_SAVE_AND_EXIT) {
- Status = ApplyChangeHandler (Private, CurrentFakeNVMap, Private->BmmPreviousPageId);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- } else if (KeyValue == KEY_VALUE_NO_SAVE_AND_EXIT) {
- DiscardChangeHandler (Private, CurrentFakeNVMap);
- }
- //
- // Tell browser not to ask for confirmation of changes,
- // since we have already applied or discarded.
- //
- CreateCallbackPacket (Packet, NV_NOT_CHANGED);
- break;
-
- default:
- break;
- }
- } else if ((KeyValue >= TERMINAL_OPTION_OFFSET) && (KeyValue < CONSOLE_OPTION_OFFSET)) {
- Index2 = (UINT16) (KeyValue - TERMINAL_OPTION_OFFSET);
- Private->CurrentTerminal = Index2;
-
- CleanUpPage (FORM_CON_COM_SETUP_ID, Private);
- UpdateTerminalPage (Private);
-
- } else if (KeyValue >= HANDLE_OPTION_OFFSET) {
- Index2 = (UINT16) (KeyValue - HANDLE_OPTION_OFFSET);
-
- NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index2);
- Private->HandleContext = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext;
-
- CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private);
-
- Private->MenuEntry = NewMenuEntry;
- Private->LoadContext->FilePathList = Private->HandleContext->DevicePath;
-
- UpdateDriverAddHandleDescPage (Private);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ApplyChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap,
- IN FORM_ID FormId
- )
-/*++
-
-Routine Description:
-
- Function handling request to apply changes for BMM pages.
-
-Arguments:
-
- Private - Pointer to callback data buffer.
- CurrentFakeNVMap - Pointer to buffer holding data of various values used by BMM
- FormId - ID of the form which has sent the request to apply change.
-
-Returns:
-
- EFI_SUCCESS - Change successfully applied.
- Other - Error occurs while trying to apply changes.
-
---*/
-{
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- BM_LOAD_CONTEXT *NewLoadContext;
- BM_MENU_ENTRY *NewMenuEntry;
- EFI_STATUS Status;
- UINT16 Index;
-
- Status = EFI_SUCCESS;
-
- switch (FormId) {
- case FORM_SET_FD_ORDER_ID:
- case FORM_SET_HD_ORDER_ID:
- case FORM_SET_CD_ORDER_ID:
- case FORM_SET_NET_ORDER_ID:
- case FORM_SET_BEV_ORDER_ID:
- Var_UpdateBBSOption (Private);
- break;
-
- case FORM_BOOT_DEL_ID:
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = CurrentFakeNVMap->BootOptionDel[Index];
- }
-
- Var_DelBootOption ();
- break;
-
- case FORM_DRV_DEL_ID:
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = CurrentFakeNVMap->DriverOptionDel[Index];
- }
-
- Var_DelDriverOption ();
- break;
-
- case FORM_BOOT_CHG_ID:
- Status = Var_UpdateBootOrder (Private);
- break;
-
- case FORM_DRV_CHG_ID:
- Status = Var_UpdateDriverOrder (Private);
- break;
-
- case FORM_TIME_OUT_ID:
- Status = gRT->SetVariable (
- L"Timeout",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- sizeof (UINT16),
- &(CurrentFakeNVMap->BootTimeOut)
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- Private->BmmOldFakeNVData.BootTimeOut = CurrentFakeNVMap->BootTimeOut;
- break;
-
- case FORM_BOOT_NEXT_ID:
- Status = Var_UpdateBootNext (Private);
- break;
-
- case FORM_CON_COM_ID:
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Private->CurrentTerminal);
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
-
- NewTerminalContext->BaudRateIndex = CurrentFakeNVMap->COMBaudRate;
- NewTerminalContext->BaudRate = BaudRateList[CurrentFakeNVMap->COMBaudRate].Value;
- NewTerminalContext->DataBitsIndex = CurrentFakeNVMap->COMDataRate;
- NewTerminalContext->DataBits = (UINT8) DataBitsList[CurrentFakeNVMap->COMDataRate].Value;
- NewTerminalContext->StopBitsIndex = CurrentFakeNVMap->COMStopBits;
- NewTerminalContext->StopBits = (UINT8) StopBitsList[CurrentFakeNVMap->COMStopBits].Value;
- NewTerminalContext->ParityIndex = CurrentFakeNVMap->COMParity;
- NewTerminalContext->Parity = (UINT8) ParityList[CurrentFakeNVMap->COMParity].Value;
- NewTerminalContext->TerminalType = CurrentFakeNVMap->COMTerminalType;
-
- ChangeTerminalDevicePath (
- NewTerminalContext->DevicePath,
- FALSE
- );
-
- Var_UpdateConsoleInpOption ();
- Var_UpdateConsoleOutOption ();
- Var_UpdateErrorOutOption ();
- break;
-
- case FORM_CON_IN_ID:
- for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- NewTerminalContext->IsConIn = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleInpMenu.MenuNumber];
- }
-
- Var_UpdateConsoleInpOption ();
- break;
-
- case FORM_CON_OUT_ID:
- for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- NewTerminalContext->IsConOut = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleOutMenu.MenuNumber];
- }
-
- Var_UpdateConsoleOutOption ();
- break;
-
- case FORM_CON_ERR_ID:
- for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- NewTerminalContext->IsStdErr = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleErrMenu.MenuNumber];
- }
-
- Var_UpdateErrorOutOption ();
- break;
-
- case FORM_DRV_ADD_HANDLE_DESC_ID:
- Status = Var_UpdateDriverOption (
- Private,
- Private->BmmHiiHandle,
- CurrentFakeNVMap->DriverAddHandleDesc,
- CurrentFakeNVMap->DriverAddHandleOptionalData,
- CurrentFakeNVMap->DriverAddForceReconnect
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- BOpt_GetDriverOptions (Private);
- CreateMenuStringToken (Private, Private->BmmHiiHandle, &DriverOptionMenu);
- break;
-
- default:
- break;
- }
-
-Error:
- return Status;
-}
-
-VOID
-DiscardChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
- )
-{
- UINT16 Index;
-
- switch (Private->BmmPreviousPageId) {
- case FORM_BOOT_CHG_ID:
- case FORM_DRV_CHG_ID:
- CopyMem (CurrentFakeNVMap->OptionOrder, Private->BmmOldFakeNVData.OptionOrder, 100);
- break;
-
- case FORM_BOOT_DEL_ID:
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- CurrentFakeNVMap->BootOptionDel[Index] = 0x00;
- }
- break;
-
- case FORM_DRV_DEL_ID:
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- CurrentFakeNVMap->DriverOptionDel[Index] = 0x00;
- }
- break;
-
- case FORM_BOOT_NEXT_ID:
- CurrentFakeNVMap->BootNext = Private->BmmOldFakeNVData.BootNext;
- break;
-
- case FORM_TIME_OUT_ID:
- CurrentFakeNVMap->BootTimeOut = Private->BmmOldFakeNVData.BootTimeOut;
- break;
-
- case FORM_DRV_ADD_HANDLE_DESC_ID:
- case FORM_DRV_ADD_FILE_ID:
- case FORM_DRV_ADD_HANDLE_ID:
- CurrentFakeNVMap->DriverAddHandleDesc[0] = 0x0000;
- CurrentFakeNVMap->DriverAddHandleOptionalData[0] = 0x0000;
- break;
-
- default:
- break;
- }
-}
-
-EFI_STATUS
-EFIAPI
-NvWrite (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT UINT32 Attributes OPTIONAL,
- IN OUT UINTN DataSize,
- OUT VOID *Buffer,
- OUT BOOLEAN *ResetRequired
- )
-{
- //
- // Do nothing here. Just to catch the F10, we use "Apply Changes" tag to save.
- //
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InitializeBM (
- VOID
- )
-/*++
-Routine Description:
-
- Initialize the Boot Maintenance Utitliy
-
-Arguments:
-
- ImageHandle - caller provided handle
-
- SystemTable - caller provided system tables
-
-Returns:
-
- EFI_SUCCESS - utility ended successfully
-
- others - contain some errors
-
---*/
-{
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- EFI_HII_PACKAGES *PackageList;
- BMM_CALLBACK_DATA *BmmCallbackInfo;
- EFI_HII_PROTOCOL *Hii;
- EFI_HII_HANDLE HiiHandle;
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- UINT8 *Ptr;
- UINT8 *Location;
-
- Status = EFI_SUCCESS;
- UpdateData = NULL;
- //
- // Initialize EfiUtilityLib and EfiDriverLib
- // Since many functions in UtilityLib must be used and
- // SetupBrowser use DriverLib
- //
- //
- // There should be only one EFI_HII_PROTOCOL Image
- //
- Status = EfiLibLocateProtocol (&gEfiHiiProtocolGuid, (VOID**)&Hii);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Create CallbackData structures for Driver Callback
- //
- BmmCallbackInfo = AllocateZeroPool (sizeof (BMM_CALLBACK_DATA));
- if (!BmmCallbackInfo) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Create LoadOption in BmmCallbackInfo for Driver Callback
- //
- Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));
- if (!Ptr) {
- SafeFreePool (BmmCallbackInfo);
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Initialize Bmm callback data.
- //
- BmmCallbackInfo->LoadContext = (BM_LOAD_CONTEXT *) Ptr;
- Ptr += sizeof (BM_LOAD_CONTEXT);
-
- BmmCallbackInfo->FileContext = (BM_FILE_CONTEXT *) Ptr;
- Ptr += sizeof (BM_FILE_CONTEXT);
-
- BmmCallbackInfo->HandleContext = (BM_HANDLE_CONTEXT *) Ptr;
- Ptr += sizeof (BM_HANDLE_CONTEXT);
-
- BmmCallbackInfo->MenuEntry = (BM_MENU_ENTRY *) Ptr;
-
- BmmCallbackInfo->BmmFakeNvData = &BmmCallbackInfo->BmmOldFakeNVData;
-
- ZeroMem (BmmCallbackInfo->BmmFakeNvData, sizeof (BMM_FAKE_NV_DATA));
-
- BmmCallbackInfo->Signature = BMM_CALLBACK_DATA_SIGNATURE;
- BmmCallbackInfo->Hii = Hii;
- BmmCallbackInfo->BmmDriverCallback.NvRead = NULL;
- BmmCallbackInfo->BmmDriverCallback.NvWrite = NvWrite;
- BmmCallbackInfo->BmmDriverCallback.Callback = DriverCallback;
- BmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID;
- BmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID;
- BmmCallbackInfo->FeDriverCallback.NvRead = NULL;
- BmmCallbackInfo->FeDriverCallback.NvWrite = NvWrite;
- BmmCallbackInfo->FeDriverCallback.Callback = FileExplorerCallback;
- BmmCallbackInfo->FeCurrentState = INACTIVE_STATE;
- BmmCallbackInfo->FeDisplayContext = UNKNOWN_CONTEXT;
-
- //
- // Install bmm callback protocol interface
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &BmmCallbackInfo->BmmDriverCallback
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BmmCallbackInfo->BmmCallbackHandle = Handle;
-
- //
- // Install file explorer callback protocol interface
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &BmmCallbackInfo->FeDriverCallback
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BmmCallbackInfo->FeCallbackHandle = Handle;
-
- //
- // Post our VFR to the HII database.
- //
- PackageList = PreparePackages (1, &gBdsStringPackGuid, BmBin);
- Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
- gBS->FreePool (PackageList);
-
- BmmCallbackInfo->BmmHiiHandle = HiiHandle;
-
- PackageList = PreparePackages (1, &gBdsStringPackGuid, FEBin);
- Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
- gBS->FreePool (PackageList);
-
- BmmCallbackInfo->FeHiiHandle = HiiHandle;
-
- //
- // Allocate space for creation of Buffer
- //
- UpdateData = AllocateZeroPool (UPDATE_DATA_SIZE);
- if (!UpdateData) {
- SafeFreePool (BmmCallbackInfo->LoadContext);
- SafeFreePool (BmmCallbackInfo);
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Initialize UpdateData structure
- //
- RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) BmmCallbackInfo->BmmCallbackHandle, FALSE, 0, 0);
-
- Location = (UINT8 *) &UpdateData->Data;
-
- InitializeStringDepository ();
-
- InitAllMenu (BmmCallbackInfo);
-
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleInpMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleOutMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleErrMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &BootOptionMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &DriverOptionMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &TerminalMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &DriverMenu);
-
- UpdateBootDelPage (BmmCallbackInfo);
- UpdateDrvDelPage (BmmCallbackInfo);
-
- if (TerminalMenu.MenuNumber > 0) {
- BmmCallbackInfo->CurrentTerminal = 0;
- UpdateTerminalPage (BmmCallbackInfo);
- }
-
- Location = (UINT8 *) &UpdateData->Data;
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID**) &LegacyBios);
- if (!EFI_ERROR (Status)) {
- //
- // If LegacyBios Protocol is installed, add 3 tags about legacy boot option
- // in BootOption form: legacy FD/HD/CD/NET/BEV
- //
- UpdateData->DataCount = 5;
- CreateGotoOpCode (
- FORM_SET_FD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_SET_FD_ORDER_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateGotoOpCode (
- FORM_SET_HD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_SET_HD_ORDER_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateGotoOpCode (
- FORM_SET_CD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_SET_CD_ORDER_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateGotoOpCode (
- FORM_SET_NET_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_SET_NET_ORDER_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateGotoOpCode (
- FORM_SET_BEV_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_SET_BEV_ORDER_ID,
- Location
- );
-
- Hii->UpdateForm (
- Hii,
- BmmCallbackInfo->BmmHiiHandle,
- (EFI_FORM_LABEL) FORM_BOOT_LEGACY_DEVICE_ID,
- TRUE,
- UpdateData
- );
- }
- //
- // Dispatch BMM main formset and File Explorer formset.
- //
- FormSetDispatcher (BmmCallbackInfo);
-
- Hii->ResetStrings (Hii, HiiHandle);
-
- CleanUpStringDepository ();
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- FreeAllMenu ();
-
- SafeFreePool (BmmCallbackInfo->LoadContext);
- BmmCallbackInfo->LoadContext = NULL;
- SafeFreePool (BmmCallbackInfo);
- BmmCallbackInfo = NULL;
- SafeFreePool (UpdateData);
- UpdateData = NULL;
-
- return Status;
-}
-
-VOID
-InitAllMenu (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- InitializeListHead (&BootOptionMenu.Head);
- InitializeListHead (&DriverOptionMenu.Head);
- BOpt_GetBootOptions (CallbackData);
- BOpt_GetDriverOptions (CallbackData);
- BOpt_GetLegacyOptions ();
- InitializeListHead (&FsOptionMenu.Head);
- BOpt_FindDrivers ();
- InitializeListHead (&DirectoryMenu.Head);
- InitializeListHead (&ConsoleInpMenu.Head);
- InitializeListHead (&ConsoleOutMenu.Head);
- InitializeListHead (&ConsoleErrMenu.Head);
- InitializeListHead (&TerminalMenu.Head);
- LocateSerialIo ();
- GetAllConsoles ();
-}
-
-VOID
-FreeAllMenu (
- VOID
- )
-{
- BOpt_FreeMenu (&DirectoryMenu);
- BOpt_FreeMenu (&FsOptionMenu);
- BOpt_FreeMenu (&BootOptionMenu);
- BOpt_FreeMenu (&DriverOptionMenu);
- BOpt_FreeMenu (&DriverMenu);
- BOpt_FreeLegacyOptions ();
- FreeAllConsoles ();
-}
-
-VOID
-InitializeStringDepository (
- VOID
- )
-/*++
-Routine Description:
- Intialize all the string depositories.
-
-Arguments:
- None.
-
-Returns:
- None.
---*/
-{
- STRING_DEPOSITORY *StringDepository;
- StringDepository = AllocateZeroPool (sizeof (STRING_DEPOSITORY) * STRING_DEPOSITORY_NUMBER);
- FileOptionStrDepository = StringDepository++;
- ConsoleOptionStrDepository = StringDepository++;
- BootOptionStrDepository = StringDepository++;
- BootOptionHelpStrDepository = StringDepository++;
- DriverOptionStrDepository = StringDepository++;
- DriverOptionHelpStrDepository = StringDepository++;
- TerminalStrDepository = StringDepository;
-}
-
-STRING_REF
-GetStringTokenFromDepository (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN STRING_DEPOSITORY *StringDepository
- )
-/*++
-Routine Description:
- Fetch a usable string node from the string depository and return the string token.
-
-Arguments:
- StringDepository - Pointer of the string depository.
-
-Returns:
- STRING_REF - String token.
---*/
-{
- STRING_LIST_NODE *CurrentListNode;
- STRING_LIST_NODE *NextListNode;
-
- CurrentListNode = StringDepository->CurrentNode;
-
- if ((NULL != CurrentListNode) && (NULL != CurrentListNode->Next)) {
- //
- // Fetch one reclaimed node from the list.
- //
- NextListNode = StringDepository->CurrentNode->Next;
- } else {
- //
- // If there is no usable node in the list, update the list.
- //
- NextListNode = AllocateZeroPool (sizeof (STRING_LIST_NODE));
-
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- CallbackData->BmmHiiHandle,
- &(NextListNode->StringToken),
- L" "
- );
-
- ASSERT (NextListNode->StringToken != 0);
-
- StringDepository->TotalNodeNumber++;
-
- if (NULL == CurrentListNode) {
- StringDepository->ListHead = NextListNode;
- } else {
- CurrentListNode->Next = NextListNode;
- }
- }
-
- StringDepository->CurrentNode = NextListNode;
-
- return StringDepository->CurrentNode->StringToken;
-}
-
-VOID
-ReclaimStringDepository (
- VOID
- )
-/*++
-Routine Description:
- Reclaim string depositories by moving the current node pointer to list head..
-
-Arguments:
- None.
-
-Returns:
- None.
---*/
-{
- UINTN DepositoryIndex;
- STRING_DEPOSITORY *StringDepository;
-
- StringDepository = FileOptionStrDepository;
- for (DepositoryIndex = 0; DepositoryIndex < STRING_DEPOSITORY_NUMBER; DepositoryIndex++) {
- StringDepository->CurrentNode = StringDepository->ListHead;
- StringDepository++;
- }
-}
-
-VOID
-CleanUpStringDepository (
- VOID
- )
-/*++
-Routine Description:
- Release resource for all the string depositories.
-
-Arguments:
- None.
-
-Returns:
- None.
---*/
-{
- UINTN NodeIndex;
- UINTN DepositoryIndex;
- STRING_LIST_NODE *CurrentListNode;
- STRING_LIST_NODE *NextListNode;
- STRING_DEPOSITORY *StringDepository;
-
- //
- // Release string list nodes.
- //
- StringDepository = FileOptionStrDepository;
- for (DepositoryIndex = 0; DepositoryIndex < STRING_DEPOSITORY_NUMBER; DepositoryIndex++) {
- CurrentListNode = StringDepository->ListHead;
- for (NodeIndex = 0; NodeIndex < StringDepository->TotalNodeNumber; NodeIndex++) {
- NextListNode = CurrentListNode->Next;
- SafeFreePool (CurrentListNode);
- CurrentListNode = NextListNode;
- }
-
- StringDepository++;
- }
- //
- // Release string depository.
- //
- SafeFreePool (FileOptionStrDepository);
-}
-
-EFI_STATUS
-BdsStartBootMaint (
- VOID
- )
-/*++
-
-Routine Description:
- Start boot maintenance manager
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY BdsBootOptionList;
-
- InitializeListHead (&BdsBootOptionList);
-
- //
- // Connect all prior to entering the platform setup menu.
- //
- if (!gConnectAllHappened) {
- BdsLibConnectAllDriversToAllControllers ();
- gConnectAllHappened = TRUE;
- }
- //
- // Have chance to enumerate boot device
- //
- BdsLibEnumerateAllBootOption (&BdsBootOptionList);
-
- //
- // Init the BMM
- //
- Status = InitializeBM ();
-
- return Status;
-}
-
-EFI_STATUS
-FormSetDispatcher (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-/*++
-
-Routine Description:
- Dispatch BMM formset and FileExplorer formset.
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_FORM_BROWSER_PROTOCOL *FormConfig;
- UINT8 *Location;
- EFI_STATUS Status;
- UINTN Index;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *NewFileContext;
- BOOLEAN BootMaintMenuResetRequired;
-
- Location = NULL;
- Index = 0;
- NewMenuEntry = NULL;
- NewFileContext = NULL;
-
- //
- // There should only be one Form Configuration protocol
- //
- Status = EfiLibLocateProtocol (&gEfiFormBrowserProtocolGuid, (VOID**) &FormConfig);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- while (1) {
- UpdatePageId (CallbackData, FORM_MAIN_ID);
-
- BootMaintMenuResetRequired = FALSE;
- Status = FormConfig->SendForm (
- FormConfig,
- TRUE,
- &(CallbackData->BmmHiiHandle),
- 1,
- NULL,
- NULL,
- (UINT8 *) CallbackData->BmmFakeNvData,
- NULL,
- &BootMaintMenuResetRequired
- );
-
- if (BootMaintMenuResetRequired) {
- EnableResetRequired ();
- }
-
- ReclaimStringDepository ();
-
- //
- // When this Formset returns, check if we are going to explore files.
- //
- if (INACTIVE_STATE != CallbackData->FeCurrentState) {
- UpdateFileExplorer (CallbackData, 0);
-
- BootMaintMenuResetRequired = FALSE;
- Status = FormConfig->SendForm (
- FormConfig,
- TRUE,
- &(CallbackData->FeHiiHandle),
- 1,
- NULL,
- NULL,
- NULL,
- NULL,
- &BootMaintMenuResetRequired
- );
-
- if (BootMaintMenuResetRequired) {
- EnableResetRequired ();
- }
-
- CallbackData->FeCurrentState = INACTIVE_STATE;
- CallbackData->FeDisplayContext = UNKNOWN_CONTEXT;
- ReclaimStringDepository ();
- } else {
- break;
- }
- }
-
- return Status;
-}
-
-VOID
-CreateCallbackPacket (
- OUT EFI_HII_CALLBACK_PACKET **Packet,
- IN UINT16 Flags
- )
-{
- *Packet = (EFI_HII_CALLBACK_PACKET *) AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + 2);
- ASSERT (*Packet != NULL);
-
- (*Packet)->DataArray.EntryCount = 1;
- (*Packet)->DataArray.NvRamMap = NULL;
- ((EFI_IFR_DATA_ENTRY *) (&((*Packet)->DataArray) + 1))->Flags = Flags;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.h
deleted file mode 100644
index a5c9f0d..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.h
+++ /dev/null
@@ -1,1159 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootMaint.h
-
-Abstract:
-
-Revision History
-
---*/
-
-#ifndef _BOOT_MAINT_H
-#define _BOOT_MAINT_H
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-#include "BootMaint/BBSsupport.h"
-
-//
-// Constants which are variable names used to access variables
-//
-#define VarLegacyDevOrder L"LegacyDevOrder"
-
-//
-// Guid of a NV Variable which store the information about the
-// FD/HD/CD/NET/BEV order
-//
-#define EFI_LEGACY_DEV_ORDER_VARIABLE_GUID \
- { \
- 0xa56074db, 0x65fe, 0x45f7, {0xbd, 0x21, 0x2d, 0x2b, 0xdd, 0x8e, 0x96, 0x52 } \
- }
-
-//
-// String Contant
-//
-#define StrFloppy L"Floppy Drive #%02x"
-#define StrHardDisk L"HardDisk Drive #%02x"
-#define StrCDROM L"ATAPI CDROM Drive #%02x"
-#define StrNET L"NET Drive #%02x"
-#define StrBEV L"BEV Drive #%02x"
-#define StrFloppyHelp L"Select Floppy Drive #%02x"
-#define StrHardDiskHelp L"Select HardDisk Drive #%02x"
-#define StrCDROMHelp L"Select ATAPI CDROM Drive #%02x"
-#define StrNETHelp L"NET Drive #%02x"
-#define StrBEVHelp L"BEV Drive #%02x"
-
-//
-// Constant will be used in display and file system navigation
-//
-#define UPDATE_DATA_SIZE 0x100000
-#define MAX_BBS_OFFSET 0xE000
-#define NET_OPTION_OFFSET 0xD800
-#define BEV_OPTION_OFFSET 0xD000
-#define FD_OPTION_OFFSET 0xC000
-#define HD_OPTION_OFFSET 0xB000
-#define CD_OPTION_OFFSET 0xA000
-#define FILE_OPTION_OFFSET 0x8000
-#define FILE_OPTION_MASK 0x7FFF
-#define HANDLE_OPTION_OFFSET 0x7000
-#define CONSOLE_OPTION_OFFSET 0x0A00
-#define TERMINAL_OPTION_OFFSET 0x0700
-#define NORMAL_GOTO_OFFSET 0x0100
-#define MAX_STRING_TOKEN_COUNT 0x00FF
-//
-// Variable created with this flag will be "Efi:...."
-//
-#define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
-
-//
-// Define Maxmim characters that will be accepted
-//
-#define MAX_CHAR 480
-#define MAX_CHAR_SIZE (MAX_CHAR * 2)
-
-//
-// Check to see if current build support option active feature of
-// some driver option
-//
-#define LOAD_OPTION_ACTIVE 0x00000001
-
-//
-// Check to see if current build support force reconnect feature of
-// some driver option
-//
-#define LOAD_OPTION_FORCE_RECONNECT 0x00000002
-
-//
-// Below are the form ids for display, form id is used as callback key value,
-// some key value definitions are also defined here. By defining this enum type,
-// We can easy know where we are. The int to UINT16 convertion should be ok because
-// there is a MAXIMUM_FORM_ID which in within the range of UINT16.
-//
-typedef enum {
- IplRelative,
- BcvRelative
-} BBS_TYPE;
-
-typedef enum {
- FORM_RESERVED_ID = 0,
- FORM_MAIN_ID, // 0x0001
- FORM_BOOT_ADD_ID, // 0x0002
- FORM_BOOT_DEL_ID, // 0x0003
- FORM_BOOT_CHG_ID, // 0x0004
- FORM_DRV_ADD_ID, // 0x0005
- FORM_DRV_DEL_ID, // 0x0006
- FORM_DRV_CHG_ID, // 0x0007
- FORM_CON_MAIN_ID, // 0x0008
- FORM_CON_IN_ID, // 0x0009
- FORM_CON_OUT_ID, // 0x000A
- FORM_CON_ERR_ID, // 0x000B
- FORM_FILE_SEEK_ID, // 0x000C
- FORM_FILE_NEW_SEEK_ID, // 0x000D
- FORM_DRV_ADD_FILE_ID, // 0x000E
- FORM_DRV_ADD_HANDLE_ID, // 0x000F
- FORM_DRV_ADD_HANDLE_DESC_ID, // 0x0010
- FORM_BOOT_NEXT_ID, // 0x0011
- FORM_TIME_OUT_ID, // 0x0012
- FORM_RESET, // 0x0013
- FORM_BOOT_SETUP_ID, // 0x0014
- FORM_DRIVER_SETUP_ID, // 0x0015
- FORM_BOOT_LEGACY_DEVICE_ID, // 0x0016
- FORM_CON_COM_ID, // 0x0017
- FORM_CON_COM_SETUP_ID, // 0x0018
- FORM_SET_FD_ORDER_ID, // 0x0019
- FORM_SET_HD_ORDER_ID, // 0x001A
- FORM_SET_CD_ORDER_ID, // 0x001B
- FORM_SET_NET_ORDER_ID, // 0x001C
- FORM_SET_BEV_ORDER_ID, // 0x001D
- FORM_FILE_EXPLORER_ID, // 0x001E
- FORM_BOOT_ADD_DESCRIPTION_ID, // 0x001F
- FORM_DRIVER_ADD_FILE_DESCRIPTION_ID, // 0x0020
-} FORM_ID;
-
-#define MAXIMUM_FORM_ID 0x007F
-
-#define KEY_VALUE_COM_SET_BAUD_RATE 0x0080
-#define KEY_VALUE_COM_SET_DATA_BITS 0x0081
-#define KEY_VALUE_COM_SET_STOP_BITS 0x0082
-#define KEY_VALUE_COM_SET_PARITY 0x0083
-#define KEY_VALUE_COM_SET_TERMI_TYPE 0x0084
-#define KEY_VALUE_MAIN_BOOT_NEXT 0x0085
-#define KEY_VALUE_BOOT_ADD_DESC_DATA 0x0086
-#define KEY_VALUE_BOOT_ADD_OPT_DATA 0x0087
-#define KEY_VALUE_DRIVER_ADD_DESC_DATA 0x0088
-#define KEY_VALUE_DRIVER_ADD_OPT_DATA 0x0089
-#define KEY_VALUE_SAVE_AND_EXIT 0x0090
-#define KEY_VALUE_NO_SAVE_AND_EXIT 0x0091
-#define KEY_VALUE_BOOT_FROM_FILE 0x0092
-
-#define MAXIMUM_NORMAL_KEY_VALUE NORMAL_GOTO_OFFSET
-//
-// Below are the number of options in Baudrate, Databits,
-// Parity and Stopbits selection for serial ports.
-//
-#define BM_COM_ATTR_BUADRATE 19
-#define BM_COM_ATTR_DATABITS 4
-#define BM_COM_ATTR_PARITY 5
-#define BM_COM_ATTR_STOPBITS 3
-
-//
-// Callback function helper
-//
-#define BMM_CALLBACK_DATA_SIGNATURE EFI_SIGNATURE_32 ('C', 'b', 'c', 'k')
-#define BMM_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, BmmDriverCallback, BMM_CALLBACK_DATA_SIGNATURE)
-
-#define FE_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, FeDriverCallback, BMM_CALLBACK_DATA_SIGNATURE)
-
-//
-// Enumeration type definition
-//
-typedef enum {
- PC_ANSI = 0,
- VT_100,
- VT_100_PLUS,
- VT_UTF8
-} TYPE_OF_TERMINAL;
-
-typedef enum {
- COM1 = 0,
- COM2,
- UNKNOW_COM
-} TYPE_OF_COM;
-
-typedef enum {
- CONIN = 0,
- CONOUT,
- CONERR,
- UNKNOWN_CON
-} TYPE_OF_CON;
-
-typedef enum {
- BAUDRATE = 0,
- DATABITS,
- PARITY,
- STOPBITS,
- UNKNOW_ATTR
-} TYPE_OF_ATTRIBUTE;
-
-typedef enum {
- MANNER_GOTO = 0,
- MANNER_CHECK,
- MANNER_ONEOF,
- MANNER_USER_DEFINE
-} TYPE_OF_UPATE_MANNER;
-
-typedef enum {
- INACTIVE_STATE = 0,
- BOOT_FROM_FILE_STATE,
- ADD_BOOT_OPTION_STATE,
- ADD_DRIVER_OPTION_STATE,
- UNKNOWN_STATE
-} FILE_EXPLORER_STATE;
-
-typedef enum {
- FILE_SYSTEM,
- DIRECTORY,
- UNKNOWN_CONTEXT
-} FILE_EXPLORER_DISPLAY_CONTEXT;
-
-//
-// All of the signatures that will be used in list structure
-//
-#define BM_MENU_OPTION_SIGNATURE EFI_SIGNATURE_32 ('m', 'e', 'n', 'u')
-#define BM_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('l', 'o', 'a', 'd')
-#define BM_CONSOLE_OPTION_SIGNATURE EFI_SIGNATURE_32 ('c', 'n', 's', 'l')
-#define BM_FILE_OPTION_SIGNATURE EFI_SIGNATURE_32 ('f', 'i', 'l', 'e')
-#define BM_HANDLE_OPTION_SIGNATURE EFI_SIGNATURE_32 ('h', 'n', 'd', 'l')
-#define BM_TERMINAL_OPTION_SIGNATURE EFI_SIGNATURE_32 ('t', 'r', 'm', 'l')
-#define BM_MENU_ENTRY_SIGNATURE EFI_SIGNATURE_32 ('e', 'n', 't', 'r')
-
-#define BM_LOAD_CONTEXT_SELECT 0x0
-#define BM_CONSOLE_CONTEXT_SELECT 0x1
-#define BM_FILE_CONTEXT_SELECT 0x2
-#define BM_HANDLE_CONTEXT_SELECT 0x3
-#define BM_TERMINAL_CONTEXT_SELECT 0x5
-
-#define BM_CONSOLE_IN_CONTEXT_SELECT 0x6
-#define BM_CONSOLE_OUT_CONTEXT_SELECT 0x7
-#define BM_CONSOLE_ERR_CONTEXT_SELECT 0x8
-#define BM_LEGACY_DEV_CONTEXT_SELECT 0x9
-
-//
-// Question Id that will be used to create question
-// all these values are computed from the structure
-// defined below
-//
-#define QUESTION_ID(Field) ((UINTN) &(((BMM_FAKE_NV_DATA *) 0)->Field))
-
-#define BOOT_TIME_OUT_QUESTION_ID QUESTION_ID (BootTimeOut)
-#define BOOT_NEXT_QUESTION_ID QUESTION_ID (BootNext)
-#define COM1_BAUD_RATE_QUESTION_ID QUESTION_ID (COM1BaudRate)
-#define COM1_DATA_RATE_QUESTION_ID QUESTION_ID (COM1DataRate)
-#define COM1_STOP_BITS_QUESTION_ID QUESTION_ID (COM1StopBits)
-#define COM1_PARITY_QUESTION_ID QUESTION_ID (COM1Parity)
-#define COM1_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
-#define COM2_BAUD_RATE_QUESTION_ID QUESTION_ID (COM2BaudRate)
-#define COM2_DATA_RATE_QUESTION_ID QUESTION_ID (COM2DataRate)
-#define COM2_STOP_BITS_QUESTION_ID QUESTION_ID (COM2StopBits)
-#define COM2_PARITY_QUESTION_ID QUESTION_ID (COM2Parity)
-#define COM2_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
-#define DRV_ADD_HANDLE_DESC_QUESTION_ID QUESTION_ID (DriverAddHandleDesc)
-#define DRV_ADD_ACTIVE_QUESTION_ID QUESTION_ID (DriverAddActive)
-#define DRV_ADD_RECON_QUESTION_ID QUESTION_ID (DriverAddForceReconnect)
-#define CON_IN_COM1_QUESTION_ID QUESTION_ID (ConsoleInputCOM1)
-#define CON_IN_COM2_QUESTION_ID QUESTION_ID (ConsoleInputCOM2)
-#define CON_OUT_COM1_QUESTION_ID QUESTION_ID (ConsoleOutputCOM1)
-#define CON_OUT_COM2_QUESTION_ID QUESTION_ID (ConsoleOutputCOM2)
-#define CON_ERR_COM1_QUESTION_ID QUESTION_ID (ConsoleErrorCOM1)
-#define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2)
-#define CON_DEVICE_QUESTION_ID QUESTION_ID (ConsoleCheck)
-#define OPTION_ORDER_QUESTION_ID QUESTION_ID (OptionOrder)
-#define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionToBeDeleted)
-#define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel)
-#define DRIVER_OPTION_DEL_QUESTION_ID QUESTION_ID (DriverOptionDel)
-#define DRIVER_ADD_OPTION_QUESTION_ID QUESTION_ID (DriverAddHandleOptionalData)
-#define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate)
-#define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate)
-#define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)
-#define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)
-#define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)
-#define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
-#define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
-#define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
-#define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
-#define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
-
-#define STRING_DEPOSITORY_NUMBER 8
-
-//
-// #pragma pack(1)
-//
-// Serial Ports attributes, first one is the value for
-// return from callback function, stringtoken is used to
-// display the value properly
-//
-typedef struct {
- UINTN Value;
- UINT16 StringToken;
-} COM_ATTR;
-
-//
-// This is the structure that will be used to store the
-// question's current value. Use it at initialize time to
-// set default value for each question. When using at run
-// time, this map is returned by the callback function,
-// so dynamically changing the question's value will be
-// possible through this mechanism
-//
-typedef struct {
- //
- // Three questions displayed at the main page
- // for Timeout, BootNext Variables respectively
- //
- UINT16 BootTimeOut;
- UINT16 BootNext;
-
- //
- // This is the COM1 Attributes value storage
- //
- UINT8 COM1BaudRate;
- UINT8 COM1DataRate;
- UINT8 COM1StopBits;
- UINT8 COM1Parity;
- UINT8 COM1TerminalType;
-
- //
- // This is the COM2 Attributes value storage
- //
- UINT8 COM2BaudRate;
- UINT8 COM2DataRate;
- UINT8 COM2StopBits;
- UINT8 COM2Parity;
- UINT8 COM2TerminalType;
-
- //
- // Driver Option Add Handle page storage
- //
- UINT16 DriverAddHandleDesc[100];
- UINT16 DriverAddHandleOptionalData[100];
- UINT8 DriverAddActive;
- UINT8 DriverAddForceReconnect;
-
- //
- // Console Input/Output/Errorout using COM port check storage
- //
- UINT8 ConsoleInputCOM1;
- UINT8 ConsoleInputCOM2;
- UINT8 ConsoleOutputCOM1;
- UINT8 ConsoleOutputCOM2;
- UINT8 ConsoleErrorCOM1;
- UINT8 ConsoleErrorCOM2;
-
- //
- // At most 100 input/output/errorout device for console storage
- //
- UINT8 ConsoleCheck[100];
-
- //
- // Boot or Driver Option Order storage
- //
- UINT8 OptionOrder[100];
- UINT8 DriverOptionToBeDeleted[100];
-
- //
- // Boot Option Delete storage
- //
- UINT8 BootOptionDel[100];
- UINT8 DriverOptionDel[100];
-
- //
- // This is the Terminal Attributes value storage
- //
- UINT8 COMBaudRate;
- UINT8 COMDataRate;
- UINT8 COMStopBits;
- UINT8 COMParity;
- UINT8 COMTerminalType;
-
- //
- // Legacy Device Order Selection Storage
- //
- UINT8 LegacyFD[100];
- UINT8 LegacyHD[100];
- UINT8 LegacyCD[100];
- UINT8 LegacyNET[100];
- UINT8 LegacyBEV[100];
-
- //
- // We use DisableMap array to record the enable/disable state of each boot device
- // It should be taken as a bit array, from left to right there are totally 256 bits
- // the most left one stands for BBS table item 0, and the most right one stands for item 256
- // If the bit is 1, it means the boot device has been disabled.
- //
- UINT8 DisableMap[32];
-
- //
- // UINT16 PadArea[10];
- //
-} BMM_FAKE_NV_DATA;
-
-typedef struct {
- UINT16 DescriptionData[75];
- UINT16 OptionalData[127];
- UINT8 Active;
- UINT8 ForceReconnect;
-} FILE_EXPLORER_NV_DATA;
-
-typedef struct {
- BBS_TYPE BbsType;
- //
- // Length = sizeof (UINT16) + SIZEOF (Data)
- //
- UINT16 Length;
- UINT16 *Data;
-} BM_LEGACY_DEV_ORDER_CONTEXT;
-
-typedef struct {
- UINT64 BaudRate;
- UINT8 DataBits;
- UINT8 Parity;
- UINT8 StopBits;
-
- UINT8 BaudRateIndex;
- UINT8 DataBitsIndex;
- UINT8 ParityIndex;
- UINT8 StopBitsIndex;
-
- UINT8 IsConIn;
- UINT8 IsConOut;
- UINT8 IsStdErr;
- UINT8 TerminalType;
-
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} BM_TERMINAL_CONTEXT;
-
-typedef struct {
- BOOLEAN IsBootNext;
- BOOLEAN LoadOptionModified;
- BOOLEAN Deleted;
-
- BOOLEAN IsLegacy;
- BOOLEAN IsActive;
- BOOLEAN ForceReconnect;
- UINTN OptionalDataSize;
-
- UINTN LoadOptionSize;
- UINT8 *LoadOption;
-
- UINT32 Attributes;
- UINT16 FilePathListLength;
- UINT16 *Description;
- EFI_DEVICE_PATH_PROTOCOL *FilePathList;
- UINT8 *OptionalData;
-
- UINT16 BbsIndex;
-} BM_LOAD_CONTEXT;
-
-typedef struct {
- BBS_TABLE *BbsTable;
- UINTN Index;
- UINTN BbsCount;
- UINT16 *Description;
-} BM_LEGACY_DEVICE_CONTEXT;
-
-typedef struct {
-
- BOOLEAN IsActive;
-
- BOOLEAN IsTerminal;
-
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} BM_CONSOLE_CONTEXT;
-
-typedef struct {
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_FILE_HANDLE FHandle;
- UINT16 *FileName;
- EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *Info;
-
- BOOLEAN IsRoot;
- BOOLEAN IsDir;
- BOOLEAN IsRemovableMedia;
- BOOLEAN IsLoadFile;
- BOOLEAN IsBootLegacy;
-} BM_FILE_CONTEXT;
-
-typedef struct {
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} BM_HANDLE_CONTEXT;
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Head;
- UINTN MenuNumber;
-} BM_MENU_OPTION;
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- UINTN OptionNumber;
- UINT16 *DisplayString;
- UINT16 *HelpString;
- STRING_REF DisplayStringToken;
- STRING_REF HelpStringToken;
- UINTN ContextSelection;
- VOID *VariableContext;
-} BM_MENU_ENTRY;
-
-typedef struct {
- //
- // Shared callback data.
- //
- UINTN Signature;
- EFI_HII_PROTOCOL *Hii;
- BM_MENU_ENTRY *MenuEntry;
- BM_HANDLE_CONTEXT *HandleContext;
- BM_FILE_CONTEXT *FileContext;
- BM_LOAD_CONTEXT *LoadContext;
- BM_TERMINAL_CONTEXT *TerminalContext;
- UINTN CurrentTerminal;
- BBS_TYPE BbsType;
-
- //
- // BMM main formset callback data.
- //
- EFI_HII_HANDLE BmmHiiHandle;
- EFI_HANDLE BmmCallbackHandle;
- EFI_FORM_CALLBACK_PROTOCOL BmmDriverCallback;
- FORM_ID BmmCurrentPageId;
- FORM_ID BmmPreviousPageId;
- BOOLEAN BmmAskSaveOrNot;
- BMM_FAKE_NV_DATA *BmmFakeNvData;
- BMM_FAKE_NV_DATA BmmOldFakeNVData;
-
- //
- // File explorer formset callback data.
- //
- EFI_HII_HANDLE FeHiiHandle;
- EFI_HANDLE FeCallbackHandle;
- EFI_FORM_CALLBACK_PROTOCOL FeDriverCallback;
- FILE_EXPLORER_STATE FeCurrentState;
- FILE_EXPLORER_DISPLAY_CONTEXT FeDisplayContext;
-} BMM_CALLBACK_DATA;
-
-typedef struct _STRING_LIST_NODE {
- STRING_REF StringToken;
- struct _STRING_LIST_NODE *Next;
-} STRING_LIST_NODE;
-
-typedef struct _STRING_DEPOSITORY {
- UINTN TotalNodeNumber;
- STRING_LIST_NODE *CurrentNode;
- STRING_LIST_NODE *ListHead;
-} STRING_DEPOSITORY;
-
-//
-// #pragma pack()
-//
-// For initializing File System menu
-//
-EFI_STATUS
-BOpt_FindFileSystem (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-;
-
-//
-// For cleaning up File System menu
-//
-VOID
-BOpt_FreeFileSystem (
- VOID
- )
-;
-
-//
-// For initializing File Navigation menu
-//
-EFI_STATUS
-BOpt_FindFiles (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN BM_MENU_ENTRY *MenuEntry
- )
-;
-
-//
-// For cleaning up File Navigation menu
-//
-VOID
-BOpt_FreeFiles (
- VOID
- )
-;
-
-//
-// For Initializing handle navigation menu
-//
-EFI_STATUS
-BOpt_FindDrivers (
- VOID
- )
-;
-
-//
-// For Cleaning up handle navigation menu
-//
-VOID
-BOpt_FreeDrivers();
-
-//
-// For initializing Boot Option menu
-//
-EFI_STATUS
-BOpt_GetBootOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-//
-// For Initializing Driver option menu
-//
-EFI_STATUS
-BOpt_GetDriverOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-//
-// For Cleaning up boot option menu
-//
-VOID
-BOpt_FreeBootOptions ();
-
-//
-// For cleaning up driver option menu
-//
-VOID
-BOpt_FreeDriverOptions();
-
-//
-// For Initializing HD/FD/CD/NET/BEV option menu
-//
-EFI_STATUS
-BOpt_GetLegacyOptions();
-
-//
-// For cleaning up driver option menu
-//
-VOID
-BOpt_FreeLegacyOptions();
-
-//
-// this function is used to take place of all other free menu actions
-//
-VOID
-BOpt_FreeMenu (
- BM_MENU_OPTION *FreeMenu
- );
-
-
-//
-// Following are the helper functions used
-//
-CHAR16 *
-BOpt_AppendFileName (
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- );
-
-BOOLEAN
-BOpt_IsEfiImageName (
- IN UINT16 *FileName
- );
-
-BOOLEAN
-BOpt_IsEfiApp (
- IN EFI_FILE_HANDLE Dir,
- IN UINT16 *FileName
- );
-
-//
-// Get current unused boot option number
-//
-UINT16
-BOpt_GetBootOptionNumber ();
-
-//
-// Get current unused driver option number
-//
-UINT16
-BOpt_GetDriverOptionNumber ();
-
-BM_MENU_ENTRY *
-BOpt_CreateMenuEntry (
- UINTN MenuType
- );
-
-VOID
-BOpt_DestroyMenuEntry (
- BM_MENU_ENTRY *MenuEntry
- );
-
-BM_MENU_ENTRY *
-BOpt_GetMenuEntry (
- BM_MENU_OPTION *MenuOption,
- UINTN MenuNumber
- );
-
-//
-// a helper function used to free pool type memory
-//
-VOID
-SafeFreePool (
- IN VOID *Buffer
- );
-
-//
-// Locate all serial io devices for console
-//
-EFI_STATUS
-LocateSerialIo ();
-
-//
-// Initializing Console menu
-//
-EFI_STATUS
-GetAllConsoles();
-
-//
-// Cleaning up console menu
-//
-EFI_STATUS
-FreeAllConsoles();
-
-VOID
-ChangeVariableDevicePath (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
-);
-
-EFI_STATUS
-ChangeTerminalDevicePath (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- BOOLEAN ChangeTerminal
-);
-//
-// Variable operation by menu selection
-//
-EFI_STATUS
-Var_UpdateBootOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN FILE_EXPLORER_NV_DATA *NvRamMap
- );
-
-EFI_STATUS
-Var_DelBootOption ();
-
-EFI_STATUS
-Var_ChangeBootOrder ();
-
-EFI_STATUS
-Var_UpdateDriverOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN UINT16 *DescriptionData,
- IN UINT16 *OptionalData,
- IN UINT8 ForceReconnect
- );
-
-EFI_STATUS
-Var_DelDriverOption ();
-
-EFI_STATUS
-Var_ChangeDriverOrder ();
-
-EFI_STATUS
-Var_UpdateConsoleInpOption ();
-
-EFI_STATUS
-Var_UpdateConsoleOutOption ();
-
-EFI_STATUS
-Var_UpdateErrorOutOption ();
-
-VOID
-Var_UpdateAllConsoleOption ();
-
-EFI_STATUS
-Var_UpdateBootNext (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-EFI_STATUS
-Var_UpdateBootOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-EFI_STATUS
-Var_UpdateDriverOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-EFI_STATUS
-Var_UpdateBBSOption (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-//
-// Following are page create and refresh functions
-//
-VOID
-RefreshUpdateData (
- IN BOOLEAN FormSetUpdate,
- IN EFI_PHYSICAL_ADDRESS FormCallbackHandle,
- IN BOOLEAN FormUpdate,
- IN STRING_REF FormTitle,
- IN UINT16 DataCount
- );
-
-VOID
-CleanUpPage (
- IN EFI_FORM_LABEL LabelId,
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-EFI_STATUS
-UpdatePage (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN BM_MENU_OPTION *UpdatingMenu,
- IN UINT16 UpdatingPage,
- IN UINT16 UpdatingManner,
- IN UINT16 QuestionIdStart,
- IN UINT16 GotoForm,
- IN UINT16 GotoAlternateForm,
- IN STRING_REF DisplayTokenStart,
- IN STRING_REF HelpTokenStart,
- IN UINT16 KeyValueStart
- );
-
-VOID
-UpdateBootAddPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateBootDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateDrvAddFilePage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateDrvAddHandlePage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateDrvDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateDriverAddHandleDescPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateBootTimeOut (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateConInPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateConOutPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateStdErrPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdatePageBody (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateCOM1Page (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateCOM2Page (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateBootOrderPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateDriverOrderPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateBootNextPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateTimeOutPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateTerminalPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateConCOMPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateSetLegacyDeviceOrderPage (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
-);
-
-EFI_STATUS
-BootLegacy (
- IN UINT16 BbsType,
- IN UINT16 BbsFlag
-);
-
-BM_MENU_ENTRY *
-GetCurrentTerminal (
- UINTN TerminalNumber
-);
-
-EFI_FILE_HANDLE
-EfiLibOpenRoot (
- IN EFI_HANDLE DeviceHandle
- );
-
-EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *
-EfiLibFileSystemVolumeLabelInfo (
- IN EFI_FILE_HANDLE FHand
- );
-
-EFI_FILE_INFO *
-EfiLibFileInfo (
- IN EFI_FILE_HANDLE FHand
- );
-
-CHAR16 *
-DevicePathToStr (
- EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-EFI_STATUS
-EfiLibLocateProtocol (
- IN EFI_GUID *ProtocolGuid,
- OUT VOID **Interface
- );
-
-VOID *
-EfiReallocatePool (
- IN VOID *OldPool,
- IN UINTN OldSize,
- IN UINTN NewSize
- );
-
-CHAR16 *
-DevicePathToStr (
- EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-VOID *
-BdsLibGetVariableAndSize (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid,
- OUT UINTN *VarSize
- );
-
-EFI_STATUS
-EfiLibDeleteVariable (
- IN CHAR16 *VarName,
- IN EFI_GUID *VarGuid
- );
-
-CHAR16 *
-EfiStrDuplicate (
- IN CHAR16 *Src
- );
-
-BOOLEAN
-EfiLibMatchDevicePaths (
- IN EFI_DEVICE_PATH_PROTOCOL *Multi,
- IN EFI_DEVICE_PATH_PROTOCOL *Single
- );
-
-UINTN
-EfiDevicePathInstanceCount (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
-EFI_STATUS
-CreateMenuStringToken (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN BM_MENU_OPTION *MenuOption
- );
-
-UINT16 *
-EfiLibStrFromDatahub (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-VOID *
-GetLegacyBootOptionVar (
- IN UINTN DeviceType,
- OUT UINTN *OptionIndex,
- OUT UINTN *OptionSize
- );
-
-EFI_STATUS
-InitializeBM (
- VOID
- );
-
-EFI_STATUS
-BdsStartBootMaint (
- VOID
- );
-
-VOID
-InitializeStringDepository ();
-
-STRING_REF
-GetStringTokenFromDepository (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN STRING_DEPOSITORY *StringDepository
- ) ;
-
-VOID
-ReclaimStringDepository (
- VOID
- );
-
-VOID
-CleanUpStringDepository (
- VOID
- );
-
-EFI_STATUS
-ApplyChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap,
- IN FORM_ID FormId
- );
-
-VOID
-DiscardChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
- );
-
-VOID
-UpdatePageId (
- BMM_CALLBACK_DATA *Private,
- UINT16 NewPageId
- );
-
-EFI_STATUS
-BootThisFile (
- IN BM_FILE_CONTEXT *FileContext
- );
-
-BOOLEAN
-UpdateFileExplorer (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN UINT16 KeyValue
- );
-
-EFI_STATUS
-EFIAPI
-FileExplorerCallback (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *Data,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- );
-
-EFI_STATUS
-FormSetDispatcher (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID CreateCallbackPacket (
- OUT EFI_HII_CALLBACK_PACKET **Packet,
- IN UINT16 Flags
- );
-
-//
-// Global variable in this program (defined in data.c)
-//
-extern BM_MENU_OPTION BootOptionMenu;
-extern BM_MENU_OPTION DriverOptionMenu;
-extern BM_MENU_OPTION FsOptionMenu;
-extern BM_MENU_OPTION ConsoleInpMenu;
-extern BM_MENU_OPTION ConsoleOutMenu;
-extern BM_MENU_OPTION ConsoleErrMenu;
-extern BM_MENU_OPTION DirectoryMenu;
-extern BM_MENU_OPTION DriverMenu;
-extern BM_MENU_OPTION TerminalMenu;
-extern BM_MENU_OPTION LegacyFDMenu;
-extern BM_MENU_OPTION LegacyHDMenu;
-extern BM_MENU_OPTION LegacyCDMenu;
-extern BM_MENU_OPTION LegacyNETMenu;
-extern BM_MENU_OPTION LegacyBEVMenu;
-extern UINT16 TerminalType[];
-extern COM_ATTR BaudRateList[19];
-extern COM_ATTR DataBitsList[4];
-extern COM_ATTR ParityList[5];
-extern COM_ATTR StopBitsList[3];
-extern EFI_GUID Guid[4];
-extern EFI_HII_UPDATE_DATA *UpdateData;
-extern STRING_DEPOSITORY *FileOptionStrDepository;
-extern STRING_DEPOSITORY *ConsoleOptionStrDepository;
-extern STRING_DEPOSITORY *BootOptionStrDepository;
-extern STRING_DEPOSITORY *BootOptionHelpStrDepository;
-extern STRING_DEPOSITORY *DriverOptionStrDepository;
-extern STRING_DEPOSITORY *DriverOptionHelpStrDepository;
-extern STRING_DEPOSITORY *TerminalStrDepository;
-extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];
-extern EFI_GUID EfiLegacyDevOrderGuid;
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootOption.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootOption.c
deleted file mode 100644
index 2d67e0b..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootOption.c
+++ /dev/null
@@ -1,1685 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootOption.c
-
-Abstract:
-
- Provide boot option support for Application "BootMaint"
-
- Include file system navigation, system handle selection
-
- Boot option manipulation
-
-Revision History
-
---*/
-
-#include "BootMaint.h"
-#include "BBSsupport.h"
-
-BM_MENU_ENTRY *
-BOpt_CreateMenuEntry (
- UINTN MenuType
- )
-/*++
-
-Routine Description
- Create Menu Entry for future use, make all types together
- in order to reduce code size
-
-Arguments:
- MenuType Use this parameter to identify current
- Menu type
-
-Returns:
- NULL Cannot allocate memory for current menu
- entry
- Others A valid pointer pointing to the allocated
- memory pool for current menu entry
-
---*/
-{
- BM_MENU_ENTRY *MenuEntry;
- UINTN ContextSize;
-
- switch (MenuType) {
- case BM_LOAD_CONTEXT_SELECT:
- ContextSize = sizeof (BM_LOAD_CONTEXT);
- break;
-
- case BM_FILE_CONTEXT_SELECT:
- ContextSize = sizeof (BM_FILE_CONTEXT);
- break;
-
- case BM_CONSOLE_CONTEXT_SELECT:
- ContextSize = sizeof (BM_CONSOLE_CONTEXT);
- break;
-
- case BM_TERMINAL_CONTEXT_SELECT:
- ContextSize = sizeof (BM_TERMINAL_CONTEXT);
- break;
-
- case BM_HANDLE_CONTEXT_SELECT:
- ContextSize = sizeof (BM_HANDLE_CONTEXT);
- break;
-
- case BM_LEGACY_DEV_CONTEXT_SELECT:
- ContextSize = sizeof (BM_LEGACY_DEVICE_CONTEXT);
- break;
-
- default:
- ContextSize = 0;
- break;
-
- }
-
- if (0 == ContextSize) {
- return NULL;
- }
-
- MenuEntry = AllocateZeroPool (sizeof (BM_MENU_ENTRY));
- if (NULL == MenuEntry) {
- return MenuEntry;
- }
-
- MenuEntry->VariableContext = AllocateZeroPool (ContextSize);
- if (NULL == MenuEntry->VariableContext) {
- SafeFreePool (MenuEntry);
- MenuEntry = NULL;
- return MenuEntry;
- }
-
- MenuEntry->Signature = BM_MENU_ENTRY_SIGNATURE;
- MenuEntry->ContextSelection = MenuType;
- return MenuEntry;
-}
-
-VOID
-BOpt_DestroyMenuEntry (
- BM_MENU_ENTRY *MenuEntry
- )
-/*++
- Routine Description :
- Destroy the menu entry passed in
-
- Arguments :
- The menu entry need to be destroyed
-
- Returns :
- None
-
---*/
-{
- BM_LOAD_CONTEXT *LoadContext;
- BM_FILE_CONTEXT *FileContext;
- BM_CONSOLE_CONTEXT *ConsoleContext;
- BM_TERMINAL_CONTEXT *TerminalContext;
- BM_HANDLE_CONTEXT *HandleContext;
- BM_LEGACY_DEVICE_CONTEXT *LegacyDevContext;
-
- //
- // Select by the type in Menu entry for current context type
- //
- switch (MenuEntry->ContextSelection) {
- case BM_LOAD_CONTEXT_SELECT:
- LoadContext = (BM_LOAD_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (LoadContext->FilePathList);
- SafeFreePool (LoadContext->LoadOption);
- SafeFreePool (LoadContext->OptionalData);
- SafeFreePool (LoadContext);
- break;
-
- case BM_FILE_CONTEXT_SELECT:
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
-
- if (!FileContext->IsRoot) {
- SafeFreePool (FileContext->DevicePath);
- } else {
- if (FileContext->FHandle != NULL) {
- FileContext->FHandle->Close (FileContext->FHandle);
- }
- }
-
- SafeFreePool (FileContext->FileName);
- SafeFreePool (FileContext->Info);
- SafeFreePool (FileContext);
- break;
-
- case BM_CONSOLE_CONTEXT_SELECT:
- ConsoleContext = (BM_CONSOLE_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (ConsoleContext->DevicePath);
- SafeFreePool (ConsoleContext);
- break;
-
- case BM_TERMINAL_CONTEXT_SELECT:
- TerminalContext = (BM_TERMINAL_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (TerminalContext->DevicePath);
- SafeFreePool (TerminalContext);
- break;
-
- case BM_HANDLE_CONTEXT_SELECT:
- HandleContext = (BM_HANDLE_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (HandleContext);
- break;
-
- case BM_LEGACY_DEV_CONTEXT_SELECT:
- LegacyDevContext = (BM_LEGACY_DEVICE_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (LegacyDevContext);
-
- default:
- break;
- }
-
- SafeFreePool (MenuEntry->DisplayString);
- if (NULL != MenuEntry->HelpString) {
- SafeFreePool (MenuEntry->HelpString);
- }
-
- SafeFreePool (MenuEntry);
-}
-
-BM_MENU_ENTRY *
-BOpt_GetMenuEntry (
- BM_MENU_OPTION *MenuOption,
- UINTN MenuNumber
- )
-/*++
- Rountine Description :
- Use this routine to get one particular menu entry in specified
- menu
-
- Arguments :
- MenuOption The menu that we will search
-
- MenuNumber The menunubmer that we want
-
- Returns :
- The desired menu entry
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINTN Index;
- LIST_ENTRY *List;
-
- if (MenuNumber >= MenuOption->MenuNumber) {
- return NULL;
- }
-
- List = MenuOption->Head.ForwardLink;
- for (Index = 0; Index < MenuNumber; Index++) {
- List = List->ForwardLink;
- }
-
- NewMenuEntry = CR (List, BM_MENU_ENTRY, Link, BM_MENU_ENTRY_SIGNATURE);
-
- return NewMenuEntry;
-}
-
-EFI_STATUS
-BOpt_FindFileSystem (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-/*++
-
-Routine Description
- Find file systems for current Extensible Firmware
- Including Handles that support Simple File System
- protocol, Load File protocol.
-
- Building up the FileSystem Menu for user selection
- All file system will be stored in FsOptionMenu
- for future use.
-
-Arguments:
- CallbackData - BMM context data
-
-Returns:
- EFI_SUCCESS - Success find the file system
- EFI_OUT_OF_RESOURCES - Can not create menu entry
-
---*/
-{
- UINTN NoSimpleFsHandles;
- UINTN NoLoadFileHandles;
- EFI_HANDLE *SimpleFsHandle;
- EFI_HANDLE *LoadFileHandle;
- UINT16 *VolumeLabel;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
- UINTN Index;
- EFI_STATUS Status;
- BM_MENU_ENTRY *MenuEntry;
- BM_FILE_CONTEXT *FileContext;
- UINT16 *TempStr;
- UINTN OptionNumber;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINT16 DeviceType;
- BBS_BBS_DEVICE_PATH BbsDevicePathNode;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- BOOLEAN RemovableMedia;
-
-
- NoSimpleFsHandles = 0;
- NoLoadFileHandles = 0;
- OptionNumber = 0;
- InitializeListHead (&FsOptionMenu.Head);
-
- //
- // Locate Handles that support Simple File System protocol
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleFileSystemProtocolGuid,
- NULL,
- &NoSimpleFsHandles,
- &SimpleFsHandle
- );
- if (!EFI_ERROR (Status)) {
- //
- // Find all the instances of the File System prototocol
- //
- for (Index = 0; Index < NoSimpleFsHandles; Index++) {
- Status = gBS->HandleProtocol (
- SimpleFsHandle[Index],
- &gEfiBlockIoProtocolGuid,
- (VOID**) &BlkIo
- );
- if (EFI_ERROR (Status)) {
- //
- // If no block IO exists assume it's NOT a removable media
- //
- RemovableMedia = FALSE;
- } else {
- //
- // If block IO exists check to see if it's remobable media
- //
- RemovableMedia = BlkIo->Media->RemovableMedia;
- }
-
- //
- // Allocate pool for this load option
- //
- MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == MenuEntry) {
- SafeFreePool (SimpleFsHandle);
- return EFI_OUT_OF_RESOURCES;
- }
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
-
- FileContext->Handle = SimpleFsHandle[Index];
- MenuEntry->OptionNumber = Index;
- FileContext->FHandle = EfiLibOpenRoot (FileContext->Handle);
- if (!FileContext->FHandle) {
- BOpt_DestroyMenuEntry (MenuEntry);
- continue;
- }
-
- MenuEntry->HelpString = DevicePathToStr (DevicePathFromHandle (FileContext->Handle));
- FileContext->Info = EfiLibFileSystemVolumeLabelInfo (FileContext->FHandle);
- FileContext->FileName = EfiStrDuplicate (L"\\");
- FileContext->DevicePath = FileDevicePath (
- FileContext->Handle,
- FileContext->FileName
- );
- FileContext->IsDir = TRUE;
- FileContext->IsRoot = TRUE;
- FileContext->IsRemovableMedia = FALSE;
- FileContext->IsLoadFile = FALSE;
-
- //
- // Get current file system's Volume Label
- //
- if (FileContext->Info == NULL) {
- VolumeLabel = L"NO FILE SYSTEM INFO";
- } else {
- if (FileContext->Info->VolumeLabel == NULL) {
- VolumeLabel = L"NULL VOLUME LABEL";
- } else {
- VolumeLabel = FileContext->Info->VolumeLabel;
- if (*VolumeLabel == 0x0000) {
- VolumeLabel = L"NO VOLUME LABEL";
- }
- }
- }
-
- TempStr = MenuEntry->HelpString;
- MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);
- ASSERT (MenuEntry->DisplayString != NULL);
- UnicodeSPrint (
- MenuEntry->DisplayString,
- MAX_CHAR,
- L"%s, [%s]",
- VolumeLabel,
- TempStr
- );
- OptionNumber++;
- InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);
- }
- }
-
- if (NoSimpleFsHandles != 0) {
- SafeFreePool (SimpleFsHandle);
- }
- //
- // Searching for handles that support Load File protocol
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiLoadFileProtocolGuid,
- NULL,
- &NoLoadFileHandles,
- &LoadFileHandle
- );
-
- if (!EFI_ERROR (Status)) {
- for (Index = 0; Index < NoLoadFileHandles; Index++) {
- MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == MenuEntry) {
- SafeFreePool (LoadFileHandle);
- return EFI_OUT_OF_RESOURCES;
- }
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
- FileContext->IsRemovableMedia = FALSE;
- FileContext->IsLoadFile = TRUE;
- FileContext->Handle = LoadFileHandle[Index];
- FileContext->IsRoot = TRUE;
-
- FileContext->DevicePath = DevicePathFromHandle (FileContext->Handle);
-
- MenuEntry->HelpString = DevicePathToStr (FileContext->DevicePath);
-
- TempStr = MenuEntry->HelpString;
- MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);
- ASSERT (MenuEntry->DisplayString != NULL);
- UnicodeSPrint (
- MenuEntry->DisplayString,
- MAX_CHAR,
- L"Load File [%s]",
- TempStr
- );
-
- MenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);
- }
- }
-
- if (NoLoadFileHandles != 0) {
- SafeFreePool (LoadFileHandle);
- }
-
- //
- // Add Legacy Boot Option Support Here
- //
- Status = gBS->LocateProtocol (
- &gEfiLegacyBiosProtocolGuid,
- NULL,
- (VOID**) &LegacyBios
- );
- if (!EFI_ERROR (Status)) {
-
- for (Index = BBS_TYPE_FLOPPY; Index <= BBS_TYPE_EMBEDDED_NETWORK; Index++) {
- MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == MenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
-
- FileContext->IsRemovableMedia = FALSE;
- FileContext->IsLoadFile = TRUE;
- FileContext->IsBootLegacy = TRUE;
- DeviceType = (UINT16) Index;
- BbsDevicePathNode.Header.Type = BBS_DEVICE_PATH;
- BbsDevicePathNode.Header.SubType = BBS_BBS_DP;
- SetDevicePathNodeLength (
- &BbsDevicePathNode.Header,
- sizeof (BBS_BBS_DEVICE_PATH)
- );
- BbsDevicePathNode.DeviceType = DeviceType;
- BbsDevicePathNode.StatusFlag = 0;
- BbsDevicePathNode.String[0] = 0;
- DevicePath = AppendDevicePathNode (
- EndDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &BbsDevicePathNode
- );
-
- FileContext->DevicePath = DevicePath;
- MenuEntry->HelpString = DevicePathToStr (FileContext->DevicePath);
-
- TempStr = MenuEntry->HelpString;
- MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);
- ASSERT (MenuEntry->DisplayString != NULL);
- UnicodeSPrint (
- MenuEntry->DisplayString,
- MAX_CHAR,
- L"Boot Legacy [%s]",
- TempStr
- );
- MenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);
- }
- }
- //
- // Remember how many file system options are here
- //
- FsOptionMenu.MenuNumber = OptionNumber;
- return EFI_SUCCESS;
-}
-
-VOID
-BOpt_FreeMenu (
- BM_MENU_OPTION *FreeMenu
- )
-/*++
-
-Routine Description
- Free resources allocated in Allocate Rountine
-
-Arguments:
- FreeMenu Menu to be freed
-
-Returns:
- VOID
-
---*/
-{
- BM_MENU_ENTRY *MenuEntry;
- while (!IsListEmpty (&FreeMenu->Head)) {
- MenuEntry = CR (
- FreeMenu->Head.ForwardLink,
- BM_MENU_ENTRY,
- Link,
- BM_MENU_ENTRY_SIGNATURE
- );
- RemoveEntryList (&MenuEntry->Link);
- BOpt_DestroyMenuEntry (MenuEntry);
- }
-}
-
-EFI_STATUS
-BOpt_FindFiles (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN BM_MENU_ENTRY *MenuEntry
- )
-/*++
-
-Routine Description
- Find files under current directory
- All files and sub-directories in current directory
- will be stored in DirectoryMenu for future use.
-
-Arguments:
- FileOption -- Pointer for Dir to explore
-
-Returns:
- TRUE -- Get files from current dir successfully
- FALSE -- Can't get files from current dir
-
---*/
-{
- EFI_FILE_HANDLE NewDir;
- EFI_FILE_HANDLE Dir;
- EFI_FILE_INFO *DirInfo;
- UINTN BufferSize;
- UINTN DirBufferSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *FileContext;
- BM_FILE_CONTEXT *NewFileContext;
- UINTN Pass;
- EFI_STATUS Status;
- UINTN OptionNumber;
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
- Dir = FileContext->FHandle;
- OptionNumber = 0;
- //
- // Open current directory to get files from it
- //
- Status = Dir->Open (
- Dir,
- &NewDir,
- FileContext->FileName,
- EFI_FILE_READ_ONLY,
- 0
- );
- if (!FileContext->IsRoot) {
- Dir->Close (Dir);
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- DirInfo = EfiLibFileInfo (NewDir);
- if (!DirInfo) {
- return EFI_NOT_FOUND;
- }
-
- if (!(DirInfo->Attribute & EFI_FILE_DIRECTORY)) {
- return EFI_INVALID_PARAMETER;
- }
-
- FileContext->DevicePath = FileDevicePath (
- FileContext->Handle,
- FileContext->FileName
- );
-
- DirBufferSize = sizeof (EFI_FILE_INFO) + 1024;
- DirInfo = AllocateZeroPool (DirBufferSize);
- if (!DirInfo) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Get all files in current directory
- // Pass 1 to get Directories
- // Pass 2 to get files that are EFI images
- //
- for (Pass = 1; Pass <= 2; Pass++) {
- NewDir->SetPosition (NewDir, 0);
- for (;;) {
- BufferSize = DirBufferSize;
- Status = NewDir->Read (NewDir, &BufferSize, DirInfo);
- if (EFI_ERROR (Status) || BufferSize == 0) {
- break;
- }
-
- if ((DirInfo->Attribute & EFI_FILE_DIRECTORY && Pass == 2) ||
- (!(DirInfo->Attribute & EFI_FILE_DIRECTORY) && Pass == 1)
- ) {
- //
- // Pass 1 is for Directories
- // Pass 2 is for file names
- //
- continue;
- }
-
- if (!(BOpt_IsEfiImageName (DirInfo->FileName) || DirInfo->Attribute & EFI_FILE_DIRECTORY)) {
- //
- // Slip file unless it is a directory entry or a .EFI file
- //
- continue;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
- NewFileContext->Handle = FileContext->Handle;
- NewFileContext->FileName = BOpt_AppendFileName (
- FileContext->FileName,
- DirInfo->FileName
- );
- NewFileContext->FHandle = NewDir;
- NewFileContext->DevicePath = FileDevicePath (
- NewFileContext->Handle,
- NewFileContext->FileName
- );
- NewMenuEntry->HelpString = NULL;
-
- MenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- FileOptionStrDepository
- );
-
- NewFileContext->IsDir = (BOOLEAN) ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY);
-
- if (NewFileContext->IsDir) {
- BufferSize = StrLen (DirInfo->FileName) * 2 + 6;
- NewMenuEntry->DisplayString = AllocateZeroPool (BufferSize);
-
- UnicodeSPrint (
- NewMenuEntry->DisplayString,
- BufferSize,
- L"<%s>",
- DirInfo->FileName
- );
-
- } else {
- NewMenuEntry->DisplayString = EfiStrDuplicate (DirInfo->FileName);
- }
-
- NewFileContext->IsRoot = FALSE;
- NewFileContext->IsLoadFile = FALSE;
- NewFileContext->IsRemovableMedia = FALSE;
-
- NewMenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&DirectoryMenu.Head, &NewMenuEntry->Link);
- }
- }
-
- DirectoryMenu.MenuNumber = OptionNumber;
- SafeFreePool (DirInfo);
- return TRUE;
-}
-
-EFI_STATUS
-BOpt_GetLegacyOptions (
- VOID
- )
-/*++
-Routine Description:
-
- Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo().
-
-Arguments:
- None
-
-Returns:
- The device info of legacy device.
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LEGACY_DEVICE_CONTEXT *NewLegacyDevContext;
- EFI_STATUS Status;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINT16 HddCount;
- HDD_INFO *HddInfo;
- UINT16 BbsCount;
- BBS_TABLE *BbsTable;
- UINTN Index;
- CHAR16 DescString[100];
- UINTN FDNum;
- UINTN HDNum;
- UINTN CDNum;
- UINTN NETNum;
- UINTN BEVNum;
-
- NewMenuEntry = NULL;
- HddInfo = NULL;
- BbsTable = NULL;
- BbsCount = 0;
-
- //
- // Initialize Bbs Table Context from BBS info data
- //
- InitializeListHead (&LegacyFDMenu.Head);
- InitializeListHead (&LegacyHDMenu.Head);
- InitializeListHead (&LegacyCDMenu.Head);
- InitializeListHead (&LegacyNETMenu.Head);
- InitializeListHead (&LegacyBEVMenu.Head);
-
- Status = gBS->LocateProtocol (
- &gEfiLegacyBiosProtocolGuid,
- NULL,
- (VOID**) &LegacyBios
- );
- if (!EFI_ERROR (Status)) {
- Status = LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &HddInfo,
- &BbsCount,
- &BbsTable
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- FDNum = 0;
- HDNum = 0;
- CDNum = 0;
- NETNum = 0;
- BEVNum = 0;
-
- for (Index = 0; Index < BbsCount; Index++) {
- if ((BBS_IGNORE_ENTRY == BbsTable[Index].BootPriority) ||
- (BBS_DO_NOT_BOOT_FROM == BbsTable[Index].BootPriority) ||
- (BBS_LOWEST_PRIORITY == BbsTable[Index].BootPriority)
- ) {
- continue;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LEGACY_DEV_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- break;
- }
-
- NewLegacyDevContext = (BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext;
- NewLegacyDevContext->BbsTable = &BbsTable[Index];
- NewLegacyDevContext->Index = Index;
- NewLegacyDevContext->BbsCount = BbsCount;
- BdsBuildLegacyDevNameString (
- &BbsTable[Index],
- Index,
- sizeof (DescString),
- DescString
- );
- NewLegacyDevContext->Description = AllocateZeroPool (StrSize (DescString));
- if (NULL == NewLegacyDevContext->Description) {
- break;
- }
-
- CopyMem (NewLegacyDevContext->Description, DescString, StrSize (DescString));
- NewMenuEntry->DisplayString = NewLegacyDevContext->Description;
- NewMenuEntry->HelpString = NULL;
-
- switch (BbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- InsertTailList (&LegacyFDMenu.Head, &NewMenuEntry->Link);
- FDNum++;
- break;
-
- case BBS_HARDDISK:
- InsertTailList (&LegacyHDMenu.Head, &NewMenuEntry->Link);
- HDNum++;
- break;
-
- case BBS_CDROM:
- InsertTailList (&LegacyCDMenu.Head, &NewMenuEntry->Link);
- CDNum++;
- break;
-
- case BBS_EMBED_NETWORK:
- InsertTailList (&LegacyNETMenu.Head, &NewMenuEntry->Link);
- NETNum++;
- break;
-
- case BBS_BEV_DEVICE:
- InsertTailList (&LegacyBEVMenu.Head, &NewMenuEntry->Link);
- BEVNum++;
- break;
- }
- }
-
- if (Index != BbsCount) {
- BOpt_FreeLegacyOptions ();
- return EFI_OUT_OF_RESOURCES;
- }
-
- LegacyFDMenu.MenuNumber = FDNum;
- LegacyHDMenu.MenuNumber = HDNum;
- LegacyCDMenu.MenuNumber = CDNum;
- LegacyNETMenu.MenuNumber = NETNum;
- LegacyBEVMenu.MenuNumber = BEVNum;
- return EFI_SUCCESS;
-}
-
-VOID
-BOpt_FreeLegacyOptions (
- VOID
- )
-{
- BOpt_FreeMenu (&LegacyFDMenu);
- BOpt_FreeMenu (&LegacyHDMenu);
- BOpt_FreeMenu (&LegacyCDMenu);
- BOpt_FreeMenu (&LegacyNETMenu);
- BOpt_FreeMenu (&LegacyBEVMenu);
-}
-
-EFI_STATUS
-BOpt_GetBootOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-/*++
-
-Routine Description:
-
- Build the BootOptionMenu according to BootOrder Variable.
- This Routine will access the Boot#### to get EFI_LOAD_OPTION
-
-Arguments:
- None
-
-Returns:
- The number of the Var Boot####
-
---*/
-{
- UINTN Index;
- UINT16 BootString[10];
- UINT8 *LoadOptionFromVar;
- UINT8 *LoadOption;
- UINTN BootOptionSize;
- BOOLEAN BootNextFlag;
- UINT16 *BootOrderList;
- UINTN BootOrderListSize;
- UINT16 *BootNext;
- UINTN BootNextSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT8 *LoadOptionPtr;
- UINTN StringSize;
- UINTN OptionalDataSize;
- UINT8 *LoadOptionEnd;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINTN MenuCount;
- UINT8 *Ptr;
-
- MenuCount = 0;
- BootOrderListSize = 0;
- BootNextSize = 0;
- BootOrderList = NULL;
- BootNext = NULL;
- LoadOptionFromVar = NULL;
- BOpt_FreeMenu (&BootOptionMenu);
- InitializeListHead (&BootOptionMenu.Head);
-
- //
- // Get the BootOrder from the Var
- //
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
-
- //
- // Get the BootNext from the Var
- //
- BootNext = BdsLibGetVariableAndSize (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- &BootNextSize
- );
-
- if (BootNext) {
- if (BootNextSize != sizeof (UINT16)) {
- SafeFreePool (BootNext);
- BootNext = NULL;
- }
- }
-
- for (Index = 0; Index < BootOrderListSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", BootOrderList[Index]);
- //
- // Get all loadoptions from the VAR
- //
- LoadOptionFromVar = BdsLibGetVariableAndSize (
- BootString,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (!LoadOptionFromVar) {
- continue;
- }
-
- LoadOption = AllocateZeroPool (BootOptionSize);
- if (!LoadOption) {
- continue;
- }
-
- CopyMem (LoadOption, LoadOptionFromVar, BootOptionSize);
- SafeFreePool (LoadOptionFromVar);
-
- if (BootNext) {
- BootNextFlag = (BOOLEAN) (*BootNext == BootOrderList[Index]);
- } else {
- BootNextFlag = FALSE;
- }
-
- if (0 == (*((UINT32 *) LoadOption) & LOAD_OPTION_ACTIVE)) {
- SafeFreePool (LoadOption);
- continue;
- }
- //
- // BUGBUG: could not return EFI_OUT_OF_RESOURCES here directly.
- // the buffer allocated already should be freed before returning.
- //
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
-
- LoadOptionPtr = LoadOption;
- LoadOptionEnd = LoadOption + BootOptionSize;
-
- NewMenuEntry->OptionNumber = BootOrderList[Index];
- NewLoadContext->LoadOptionModified = FALSE;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->IsBootNext = BootNextFlag;
-
- //
- // Is a Legacy Device?
- //
- Ptr = (UINT8 *) LoadOption;
-
- //
- // Attribute = *(UINT32 *)Ptr;
- //
- Ptr += sizeof (UINT32);
-
- //
- // FilePathSize = *(UINT16 *)Ptr;
- //
- Ptr += sizeof (UINT16);
-
- //
- // Description = (CHAR16 *)Ptr;
- //
- Ptr += StrSize ((CHAR16 *) Ptr);
-
- //
- // Now Ptr point to Device Path
- //
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- if ((BBS_DEVICE_PATH == DevicePath->Type) && (BBS_BBS_DP == DevicePath->SubType)) {
- NewLoadContext->IsLegacy = TRUE;
- } else {
- NewLoadContext->IsLegacy = FALSE;
- }
- //
- // LoadOption is a pointer type of UINT8
- // for easy use with following LOAD_OPTION
- // embedded in this struct
- //
- NewLoadContext->LoadOption = LoadOption;
- NewLoadContext->LoadOptionSize = BootOptionSize;
-
- NewLoadContext->Attributes = *(UINT32 *) LoadOptionPtr;
- NewLoadContext->IsActive = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_ACTIVE);
-
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- LoadOptionPtr += sizeof (UINT32);
-
- NewLoadContext->FilePathListLength = *(UINT16 *) LoadOptionPtr;
- LoadOptionPtr += sizeof (UINT16);
-
- StringSize = StrSize ((UINT16 *) LoadOptionPtr);
- NewLoadContext->Description = AllocateZeroPool (StringSize);
- ASSERT (NewLoadContext->Description != NULL);
- CopyMem (
- NewLoadContext->Description,
- (UINT16 *) LoadOptionPtr,
- StringSize
- );
- NewMenuEntry->DisplayString = NewLoadContext->Description;
-
- LoadOptionPtr += StringSize;
-
- NewLoadContext->FilePathList = AllocateZeroPool (NewLoadContext->FilePathListLength);
- ASSERT (NewLoadContext->FilePathList != NULL);
- CopyMem (
- NewLoadContext->FilePathList,
- (EFI_DEVICE_PATH_PROTOCOL *) LoadOptionPtr,
- NewLoadContext->FilePathListLength
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionStrDepository
- );
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionHelpStrDepository
- );
- LoadOptionPtr += NewLoadContext->FilePathListLength;
-
- if (LoadOptionPtr < LoadOptionEnd) {
- OptionalDataSize = BootOptionSize -
- sizeof (UINT32) -
- sizeof (UINT16) -
- StringSize -
- NewLoadContext->FilePathListLength;
-
- NewLoadContext->OptionalData = AllocateZeroPool (OptionalDataSize);
- ASSERT (NewLoadContext->OptionalData != NULL);
- CopyMem (
- NewLoadContext->OptionalData,
- LoadOptionPtr,
- OptionalDataSize
- );
-
- NewLoadContext->OptionalDataSize = OptionalDataSize;
- }
-
- InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
- MenuCount++;
- }
-
- SafeFreePool (BootNext);
- SafeFreePool (BootOrderList);
- BootOptionMenu.MenuNumber = MenuCount;
- return MenuCount;
-}
-
-CHAR16 *
-BdsStrCpy (
- OUT CHAR16 *Destination,
- IN CONST CHAR16 *Source
- )
-{
- CHAR16 *ReturnValue;
-
- //
- // Destination cannot be NULL
- //
- ASSERT (Destination != NULL);
-
- ReturnValue = Destination;
- while (*Source) {
- *(Destination++) = *(Source++);
- }
- *Destination = 0;
- return ReturnValue;
-}
-
-CHAR16 *
-BOpt_AppendFileName (
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- )
-/*++
-
-Routine Description
- Append file name to existing file name.
-
-Arguments:
- Str1 - existing file name
- Str2 - file name to be appended
-
-Returns:
- Allocate a new string to hold the appended result.
- Caller is responsible to free the returned string.
-
---*/
-{
- UINTN Size1;
- UINTN Size2;
- CHAR16 *Str;
- CHAR16 *Ptr;
- CHAR16 *LastSlash;
-
- Size1 = StrSize (Str1);
- Size2 = StrSize (Str2);
- Str = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));
- ASSERT (Str != NULL);
-
- StrCat (Str, Str1);
- if (!((*Str == '\\') && (*(Str + 1) == 0))) {
- StrCat (Str, L"\\");
- }
-
- StrCat (Str, Str2);
-
- Ptr = Str;
- LastSlash = Str;
- while (*Ptr != 0) {
- if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '.' && *(Ptr + 3) != 0) {
- //
- // Convert "\Name\..\" to "\"
- // DO NOT convert the .. if it is at the end of the string. This will
- // break the .. behavior in changing directories.
- //
- BdsStrCpy (LastSlash, Ptr + 3);
- Ptr = LastSlash;
- } else if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '\\') {
- //
- // Convert a "\.\" to a "\"
- //
- BdsStrCpy (Ptr, Ptr + 2);
- Ptr = LastSlash;
- } else if (*Ptr == '\\') {
- LastSlash = Ptr;
- }
-
- Ptr++;
- }
-
- return Str;
-}
-
-BOOLEAN
-BOpt_IsEfiImageName (
- IN UINT16 *FileName
- )
-/*++
-
-Routine Description
- Check whether current FileName point to a valid
- Efi Image File.
-
-Arguments:
- FileName - File need to be checked.
-
-Returns:
- TRUE - Is Efi Image
- FALSE - Not a valid Efi Image
-
---*/
-{
- //
- // Search for ".efi" extension
- //
- while (*FileName) {
- if (FileName[0] == '.') {
- if (FileName[1] == 'e' || FileName[1] == 'E') {
- if (FileName[2] == 'f' || FileName[2] == 'F') {
- if (FileName[3] == 'i' || FileName[3] == 'I') {
- return TRUE;
- } else if (FileName[3] == 0x0000) {
- return FALSE;
- }
- } else if (FileName[2] == 0x0000) {
- return FALSE;
- }
- } else if (FileName[1] == 0x0000) {
- return FALSE;
- }
- }
-
- FileName += 1;
- }
-
- return FALSE;
-}
-
-
-RETURN_STATUS
-EFIAPI
-IsEfiAppReadFromFile (
- IN VOID *FileHandle,
- IN UINTN FileOffset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EFI_FILE_HANDLE File;
-
- File = (EFI_FILE_HANDLE)FileHandle;
- Status = File->SetPosition (File, FileOffset);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return File->Read (File, ReadSize, Buffer);
-}
-
-
-
-BOOLEAN
-BOpt_IsEfiApp (
- IN EFI_FILE_HANDLE Dir,
- IN UINT16 *FileName
- )
-/*++
-
-Routine Description:
- Check whether current FileName point to a valid Efi Application
-
-Arguments:
- Dir - Pointer to current Directory
- FileName - Pointer to current File name.
-
-Returns:
- TRUE - Is a valid Efi Application
- FALSE - not a valid Efi Application
-
---*/
-{
- EFI_STATUS Status;
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
- EFI_FILE_HANDLE File;
-
- Status = Dir->Open (Dir, &File, FileName, EFI_FILE_MODE_READ, 0);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- ZeroMem (&ImageContext, sizeof (ImageContext));
- ImageContext.Handle = (VOID *)File;
- ImageContext.ImageRead = IsEfiAppReadFromFile;
-
- Status = PeCoffLoaderGetImageInfo (&ImageContext);
- File->Close (File);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- if (ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
- return TRUE;
- } else {
- return FALSE;
- }
- }
-
-
-EFI_STATUS
-BOpt_FindDrivers (
- VOID
- )
-/*++
-
-Routine Description
- Find drivers that will be added as Driver#### variables from handles
- in current system environment
- All valid handles in the system except those consume SimpleFs, LoadFile
- are stored in DriverMenu for future use.
-
-Arguments:
- None
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- UINTN NoDevicePathHandles;
- EFI_HANDLE *DevicePathHandle;
- UINTN Index;
- EFI_STATUS Status;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_HANDLE_CONTEXT *NewHandleContext;
- EFI_HANDLE CurHandle;
- UINTN OptionNumber;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFs;
- EFI_LOAD_FILE_PROTOCOL *LoadFile;
-
- SimpleFs = NULL;
- LoadFile = NULL;
-
- InitializeListHead (&DriverMenu.Head);
-
- //
- // At first, get all handles that support Device Path
- // protocol which is the basic requirement for
- // Driver####
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiDevicePathProtocolGuid,
- NULL,
- &NoDevicePathHandles,
- &DevicePathHandle
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OptionNumber = 0;
- for (Index = 0; Index < NoDevicePathHandles; Index++) {
- CurHandle = DevicePathHandle[Index];
-
- //
- // Check whether this handle support
- // driver binding
- //
- Status = gBS->HandleProtocol (
- CurHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID**) &SimpleFs
- );
- if (Status == EFI_SUCCESS) {
- continue;
- }
-
- Status = gBS->HandleProtocol (
- CurHandle,
- &gEfiLoadFileProtocolGuid,
- (VOID**) &LoadFile
- );
- if (Status == EFI_SUCCESS) {
- continue;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_HANDLE_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewHandleContext = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewHandleContext->Handle = CurHandle;
- NewHandleContext->DevicePath = DevicePathFromHandle (CurHandle);
- NewMenuEntry->DisplayString = DevicePathToStr (NewHandleContext->DevicePath);
- NewMenuEntry->HelpString = NULL;
- NewMenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&DriverMenu.Head, &NewMenuEntry->Link);
-
- }
-
- DriverMenu.MenuNumber = OptionNumber;
- return EFI_SUCCESS;
-}
-
-UINT16
-BOpt_GetBootOptionNumber (
- VOID
- )
-/*++
-
-Routine Description:
- Get the Option Number that does not used
-
-Arguments:
-
-Returns:
- The Option Number
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 *BootOrderList;
- UINTN BootOrderListSize;
- UINT16 Number;
- UINTN Index;
- UINTN Index2;
- BOOLEAN Found;
- CHAR16 StrTemp[100];
- UINT16 *OptionBuffer;
- UINTN OptionSize;
-
- BootOrderListSize = 0;
- BootOrderList = NULL;
-
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
- if (BootOrderList) {
- //
- // already have Boot####
- //
- // AlreadyBootNumbers = BootOrderListSize / sizeof(UINT16);
- //
- for (Index = 0; Index < BootOrderListSize / sizeof (UINT16); Index++) {
- Found = TRUE;
- for (Index2 = 0; Index2 < BootOptionMenu.MenuNumber; Index2++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index2);
- if (Index == NewMenuEntry->OptionNumber) {
- Found = FALSE;
- break;
- }
- }
-
- if (Found) {
- UnicodeSPrint (StrTemp, 100, L"Boot%04x", Index);
- DEBUG((EFI_D_ERROR,"INdex= %s\n", StrTemp));
- OptionBuffer = BdsLibGetVariableAndSize (
- StrTemp,
- &gEfiGlobalVariableGuid,
- &OptionSize
- );
- if (NULL == OptionBuffer)
- break;
- }
- }
- //
- // end for Index
- //
- Number = (UINT16) Index;
- } else {
- //
- // No Boot####
- //
- Number = 0;
- }
-
- return Number;
-}
-
-UINT16
-BOpt_GetDriverOptionNumber (
- VOID
- )
-/*++
-
-Routine Description:
- Get the Option Number that does not used
-
-Arguments:
-
-Returns:
- The Option Number
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 *DriverOrderList;
- UINTN DriverOrderListSize;
- UINT16 Number;
- UINTN Index;
- UINTN Index2;
- BOOLEAN Found;
-
- DriverOrderListSize = 0;
- DriverOrderList = NULL;
-
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
- if (DriverOrderList) {
- //
- // already have Driver####
- //
- // AlreadyDriverNumbers = DriverOrderListSize / sizeof(UINT16);
- //
- for (Index = 0; Index < DriverOrderListSize / sizeof (UINT16); Index++) {
- Found = TRUE;
- for (Index2 = 0; Index2 < DriverOptionMenu.MenuNumber; Index2++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index2);
- if (Index == NewMenuEntry->OptionNumber) {
- Found = FALSE;
- break;
- }
- }
-
- if (Found) {
- break;
- }
- }
- //
- // end for Index
- //
- Number = (UINT16) Index;
- } else {
- //
- // No Driver####
- //
- Number = 0;
- }
-
- return Number;
-}
-
-EFI_STATUS
-BOpt_GetDriverOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-/*++
-
-Routine Description:
- Build up all DriverOptionMenu
-
-Arguments:
-
-Returns:
- The Option Number
-
---*/
-{
- UINTN Index;
- UINT16 DriverString[12];
- UINT8 *LoadOptionFromVar;
- UINT8 *LoadOption;
- UINTN DriverOptionSize;
-
- UINT16 *DriverOrderList;
- UINTN DriverOrderListSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT8 *LoadOptionPtr;
- UINTN StringSize;
- UINTN OptionalDataSize;
- UINT8 *LoadOptionEnd;
-
- DriverOrderListSize = 0;
- DriverOrderList = NULL;
- DriverOptionSize = 0;
- LoadOptionFromVar = NULL;
- BOpt_FreeMenu (&DriverOptionMenu);
- InitializeListHead (&DriverOptionMenu.Head);
- //
- // Get the DriverOrder from the Var
- //
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
-
- for (Index = 0; Index < DriverOrderListSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (
- DriverString,
- sizeof (DriverString),
- L"Driver%04x",
- DriverOrderList[Index]
- );
- //
- // Get all loadoptions from the VAR
- //
- LoadOptionFromVar = BdsLibGetVariableAndSize (
- DriverString,
- &gEfiGlobalVariableGuid,
- &DriverOptionSize
- );
- if (!LoadOptionFromVar) {
- continue;
- }
-
- LoadOption = AllocateZeroPool (DriverOptionSize);
- if (!LoadOption) {
- continue;
- }
-
- CopyMem (LoadOption, LoadOptionFromVar, DriverOptionSize);
- SafeFreePool (LoadOptionFromVar);
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- LoadOptionPtr = LoadOption;
- LoadOptionEnd = LoadOption + DriverOptionSize;
- NewMenuEntry->OptionNumber = DriverOrderList[Index];
- NewLoadContext->LoadOptionModified = FALSE;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->IsLegacy = FALSE;
-
- //
- // LoadOption is a pointer type of UINT8
- // for easy use with following LOAD_OPTION
- // embedded in this struct
- //
- NewLoadContext->LoadOption = LoadOption;
- NewLoadContext->LoadOptionSize = DriverOptionSize;
-
- NewLoadContext->Attributes = *(UINT32 *) LoadOptionPtr;
- NewLoadContext->IsActive = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_ACTIVE);
-
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- LoadOptionPtr += sizeof (UINT32);
-
- NewLoadContext->FilePathListLength = *(UINT16 *) LoadOptionPtr;
- LoadOptionPtr += sizeof (UINT16);
-
- StringSize = StrSize ((UINT16 *) LoadOptionPtr);
- NewLoadContext->Description = AllocateZeroPool (StringSize);
- ASSERT (NewLoadContext->Description != NULL);
- CopyMem (
- NewLoadContext->Description,
- (UINT16 *) LoadOptionPtr,
- StringSize
- );
- NewMenuEntry->DisplayString = NewLoadContext->Description;
-
- LoadOptionPtr += StringSize;
-
- NewLoadContext->FilePathList = AllocateZeroPool (NewLoadContext->FilePathListLength);
- ASSERT (NewLoadContext->FilePathList != NULL);
- CopyMem (
- NewLoadContext->FilePathList,
- (EFI_DEVICE_PATH_PROTOCOL *) LoadOptionPtr,
- NewLoadContext->FilePathListLength
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionStrDepository
- );
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionHelpStrDepository
- );
- LoadOptionPtr += NewLoadContext->FilePathListLength;
-
- if (LoadOptionPtr < LoadOptionEnd) {
- OptionalDataSize = DriverOptionSize -
- sizeof (UINT32) -
- sizeof (UINT16) -
- StringSize -
- NewLoadContext->FilePathListLength;
-
- NewLoadContext->OptionalData = AllocateZeroPool (OptionalDataSize);
- ASSERT (NewLoadContext->OptionalData != NULL);
- CopyMem (
- NewLoadContext->OptionalData,
- LoadOptionPtr,
- OptionalDataSize
- );
-
- NewLoadContext->OptionalDataSize = OptionalDataSize;
- }
-
- InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
-
- }
-
- SafeFreePool (DriverOrderList);
- DriverOptionMenu.MenuNumber = Index;
- return EFI_SUCCESS;
-
-}
-
-VOID
-SafeFreePool (
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
- Wrap original FreePool gBS call
- in order to decrease code length
-
-Arguments:
-
-Returns:
-
---*/
-{
- if (Buffer != NULL) {
- gBS->FreePool (Buffer);
- Buffer = NULL;
- }
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/ConsoleOption.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/ConsoleOption.c
deleted file mode 100644
index 297c2cf..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/ConsoleOption.c
+++ /dev/null
@@ -1,840 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ConsoleOption.c
-
-Abstract:
-
- handles console redirection from boot manager
-
-
-Revision History
-
---*/
-
-#include "BootMaint.h"
-
-EFI_DEVICE_PATH_PROTOCOL *
-DevicePathInstanceDup (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-EFI_STATUS
-UpdateComAttributeFromVariable (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
-EFI_STATUS
-ChangeTerminalDevicePath (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- BOOLEAN ChangeTerminal
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- EFI_DEVICE_PATH_PROTOCOL *Node1;
- ACPI_HID_DEVICE_PATH *Acpi;
- UART_DEVICE_PATH *Uart;
- UART_DEVICE_PATH *Uart1;
- UINTN Com;
- UINT32 Match;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- BM_MENU_ENTRY *NewMenuEntry;
-
- Match = EISA_PNP_ID (0x0501);
- Node = DevicePath;
- Node = NextDevicePathNode (Node);
- Com = 0;
- while (!IsDevicePathEnd (Node)) {
- if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
- }
- }
-
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Com);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- Uart = (UART_DEVICE_PATH *) Node;
- CopyMem (
- &Uart->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
- //
- // Change the device path in the ComPort
- //
- if (ChangeTerminal) {
- Node1 = NewTerminalContext->DevicePath;
- Node1 = NextDevicePathNode (Node1);
- while (!IsDevicePathEnd (Node1)) {
- if ((DevicePathType (Node1) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node1) == MSG_UART_DP)) {
- Uart1 = (UART_DEVICE_PATH *) Node1;
- CopyMem (
- &Uart1->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart1->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart1->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart1->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
- break;
- }
- //
- // end if
- //
- Node1 = NextDevicePathNode (Node1);
- }
- //
- // end while
- //
- break;
- }
- }
-
- Node = NextDevicePathNode (Node);
- }
-
- return EFI_SUCCESS;
-
-}
-
-VOID
-ChangeVariableDevicePath (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- ACPI_HID_DEVICE_PATH *Acpi;
- UART_DEVICE_PATH *Uart;
- UINTN Com;
- UINT32 Match;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- BM_MENU_ENTRY *NewMenuEntry;
-
- Match = EISA_PNP_ID (0x0501);
- Node = DevicePath;
- Node = NextDevicePathNode (Node);
- Com = 0;
- while (!IsDevicePathEnd (Node)) {
- if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
- }
- }
-
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- NewMenuEntry = BOpt_GetMenuEntry (
- &TerminalMenu,
- Com
- );
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- Uart = (UART_DEVICE_PATH *) Node;
- CopyMem (
- &Uart->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
- }
-
- Node = NextDevicePathNode (Node);
- }
-
- return ;
-}
-
-BOOLEAN
-IsTerminalDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT TYPE_OF_TERMINAL *Termi,
- OUT UINTN *Com
- );
-
-EFI_STATUS
-LocateSerialIo (
- VOID
- )
-/*++
-
-Routine Description:
- Build a list containing all serial devices
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINT8 *Ptr;
- UINTN Index;
- UINTN Index2;
- UINTN NoHandles;
- EFI_HANDLE *Handles;
- EFI_STATUS Status;
- ACPI_HID_DEVICE_PATH *Acpi;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINT32 Match;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- EFI_DEVICE_PATH_PROTOCOL *OutDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *InpDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *ErrDevicePath;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- VENDOR_DEVICE_PATH Vendor;
- //
- // Get all handles that have SerialIo protocol installed
- //
- InitializeListHead (&TerminalMenu.Head);
- TerminalMenu.MenuNumber = 0;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSerialIoProtocolGuid,
- NULL,
- &NoHandles,
- &Handles
- );
- if (EFI_ERROR (Status)) {
- //
- // No serial ports present
- //
- return EFI_UNSUPPORTED;
- }
-
- for (Index = 0; Index < NoHandles; Index++) {
- //
- // Check to see whether the handle has DevicePath Protocol installed
- //
- gBS->HandleProtocol (
- Handles[Index],
- &gEfiDevicePathProtocolGuid,
- (VOID**) &DevicePath
- );
- Ptr = (UINT8 *) DevicePath;
- while (*Ptr != END_DEVICE_PATH_TYPE) {
- Ptr++;
- }
-
- Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
- Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
- Match = EISA_PNP_ID (0x0501);
-
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- NewMenuEntry = BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT);
- if (!NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- CopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof (UINT32));
- NewTerminalContext->DevicePath = DevicePathInstanceDup (DevicePath);
- //
- // BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system!
- // coz' the misc data for each platform is not correct, actually it's the device path stored in
- // datahub which is not completed, so a searching for end of device path will enter a
- // dead-loop.
- //
- NewMenuEntry->DisplayString = EfiLibStrFromDatahub (DevicePath);
- if (NULL == NewMenuEntry->DisplayString) {
- NewMenuEntry->DisplayString = DevicePathToStr (DevicePath);
- }
-
- NewMenuEntry->HelpString = NULL;
-
- gBS->HandleProtocol (
- Handles[Index],
- &gEfiSerialIoProtocolGuid,
- (VOID**) &SerialIo
- );
-
- CopyMem (
- &NewTerminalContext->BaudRate,
- &SerialIo->Mode->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &NewTerminalContext->DataBits,
- &SerialIo->Mode->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->Parity,
- &SerialIo->Mode->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->StopBits,
- &SerialIo->Mode->StopBits,
- sizeof (UINT8)
- );
- InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link);
- TerminalMenu.MenuNumber++;
- }
- }
- //
- // Get L"ConOut", L"ConIn" and L"ErrOut" from the Var
- //
- OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);
- InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);
- ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);
- if (OutDevicePath) {
- UpdateComAttributeFromVariable (OutDevicePath);
- }
-
- if (InpDevicePath) {
- UpdateComAttributeFromVariable (InpDevicePath);
- }
-
- if (ErrDevicePath) {
- UpdateComAttributeFromVariable (ErrDevicePath);
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
-
- NewTerminalContext->TerminalType = 0;
- NewTerminalContext->IsConIn = FALSE;
- NewTerminalContext->IsConOut = FALSE;
- NewTerminalContext->IsStdErr = FALSE;
-
- Vendor.Header.Type = MESSAGING_DEVICE_PATH;
- Vendor.Header.SubType = MSG_VENDOR_DP;
-
- for (Index2 = 0; Index2 < 4; Index2++) {
- CopyMem (&Vendor.Guid, &Guid[Index2], sizeof (EFI_GUID));
- SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));
- NewDevicePath = AppendDevicePathNode (
- NewTerminalContext->DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Vendor
- );
- SafeFreePool (NewMenuEntry->HelpString);
- //
- // NewMenuEntry->HelpString = DevicePathToStr (NewDevicePath);
- // NewMenuEntry->DisplayString = NewMenuEntry->HelpString;
- //
- NewMenuEntry->HelpString = NULL;
-
- if (BdsLibMatchDevicePaths (OutDevicePath, NewDevicePath)) {
- NewTerminalContext->IsConOut = TRUE;
- NewTerminalContext->TerminalType = (UINT8) Index2;
- }
-
- if (BdsLibMatchDevicePaths (InpDevicePath, NewDevicePath)) {
- NewTerminalContext->IsConIn = TRUE;
- NewTerminalContext->TerminalType = (UINT8) Index2;
- }
-
- if (BdsLibMatchDevicePaths (ErrDevicePath, NewDevicePath)) {
- NewTerminalContext->IsStdErr = TRUE;
- NewTerminalContext->TerminalType = (UINT8) Index2;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UpdateComAttributeFromVariable (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Update Com Ports attributes from DevicePath
-
-Arguments:
- DevicePath - DevicePath that contains Com ports
-
-Returns:
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- EFI_DEVICE_PATH_PROTOCOL *SerialNode;
- ACPI_HID_DEVICE_PATH *Acpi;
- UART_DEVICE_PATH *Uart;
- UART_DEVICE_PATH *Uart1;
- UINT32 Match;
- UINTN TerminalNumber;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- UINTN Index;
-
- Match = EISA_PNP_ID (0x0501);
- Node = DevicePath;
- Node = NextDevicePathNode (Node);
- TerminalNumber = 0;
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- while (!IsDevicePathEnd (Node)) {
- if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (&TerminalNumber, &Acpi->UID, sizeof (UINT32));
- }
- }
-
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- Uart = (UART_DEVICE_PATH *) Node;
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, TerminalNumber);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- CopyMem (
- &NewTerminalContext->BaudRate,
- &Uart->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &NewTerminalContext->DataBits,
- &Uart->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->Parity,
- &Uart->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->StopBits,
- &Uart->StopBits,
- sizeof (UINT8)
- );
-
- SerialNode = NewTerminalContext->DevicePath;
- SerialNode = NextDevicePathNode (SerialNode);
- while (!IsDevicePathEnd (SerialNode)) {
- if ((DevicePathType (SerialNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (SerialNode) == MSG_UART_DP)) {
- //
- // Update following device paths according to
- // previous acquired uart attributes
- //
- Uart1 = (UART_DEVICE_PATH *) SerialNode;
- CopyMem (
- &Uart1->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart1->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
- CopyMem (
- &Uart1->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
- CopyMem (
- &Uart1->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
-
- break;
- }
-
- SerialNode = NextDevicePathNode (SerialNode);
- }
- //
- // end while
- //
- }
-
- Node = NextDevicePathNode (Node);
- }
- //
- // end while
- //
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-DevicePathInstanceDup (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-/*++
-
-Routine Description:
- Function creates a device path data structure that identically matches the
- device path passed in.
-
-Arguments:
- DevPath - A pointer to a device path data structure.
-
-Returns:
-
- The new copy of DevPath is created to identically match the input.
- Otherwise, NULL is returned.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *NewDevPath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
- EFI_DEVICE_PATH_PROTOCOL *Temp;
- UINT8 *Ptr;
- UINTN Size;
-
- //
- // get the size of an instance from the input
- //
- Temp = DevPath;
- DevicePathInst = GetNextDevicePathInstance (&Temp, &Size);
-
- //
- // Make a copy and set proper end type
- //
- NewDevPath = NULL;
- if (Size) {
- NewDevPath = AllocateZeroPool (Size);
- ASSERT (NewDevPath != NULL);
- }
-
- if (NewDevPath) {
- CopyMem (NewDevPath, DevicePathInst, Size);
- Ptr = (UINT8 *) NewDevPath;
- Ptr += Size - sizeof (EFI_DEVICE_PATH_PROTOCOL);
- Temp = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- SetDevicePathEndNode (Temp);
- }
-
- return NewDevPath;
-}
-
-EFI_STATUS
-GetConsoleMenu (
- IN UINTN ConsoleMenuType
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *AllDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *MultiDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
- UINTN Size;
- UINTN AllCount;
- UINTN Index;
- UINTN Index2;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- TYPE_OF_TERMINAL Terminal;
- BM_MENU_ENTRY *NewTerminalMenuEntry;
- UINTN Com;
- BM_MENU_OPTION *ConsoleMenu;
-
- DevicePath = NULL;
- AllDevicePath = NULL;
- AllCount = 0;
- switch (ConsoleMenuType) {
- case BM_CONSOLE_IN_CONTEXT_SELECT:
- ConsoleMenu = &ConsoleInpMenu;
- DevicePath = EfiLibGetVariable (
- L"ConIn",
- &gEfiGlobalVariableGuid
- );
-
- AllDevicePath = EfiLibGetVariable (
- L"ConInDev",
- &gEfiGlobalVariableGuid
- );
- break;
-
- case BM_CONSOLE_OUT_CONTEXT_SELECT:
- ConsoleMenu = &ConsoleOutMenu;
- DevicePath = EfiLibGetVariable (
- L"ConOut",
- &gEfiGlobalVariableGuid
- );
-
- AllDevicePath = EfiLibGetVariable (
- L"ConOutDev",
- &gEfiGlobalVariableGuid
- );
- break;
-
- case BM_CONSOLE_ERR_CONTEXT_SELECT:
- ConsoleMenu = &ConsoleErrMenu;
- DevicePath = EfiLibGetVariable (
- L"ErrOut",
- &gEfiGlobalVariableGuid
- );
-
- AllDevicePath = EfiLibGetVariable (
- L"ErrOutDev",
- &gEfiGlobalVariableGuid
- );
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
-
- if (NULL == AllDevicePath) {
- return EFI_NOT_FOUND;
- }
-
- InitializeListHead (&ConsoleMenu->Head);
-
- AllCount = EfiDevicePathInstanceCount (AllDevicePath);
- ConsoleMenu->MenuNumber = 0;
- //
- // Following is menu building up for Console Out Devices
- //
- MultiDevicePath = AllDevicePath;
- Index2 = 0;
- for (Index = 0; Index < AllCount; Index++) {
- DevicePathInst = GetNextDevicePathInstance (&MultiDevicePath, &Size);
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_CONSOLE_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewMenuEntry->OptionNumber = Index2;
-
- NewConsoleContext->DevicePath = DevicePathInstanceDup (DevicePathInst);
- NewMenuEntry->DisplayString = EfiLibStrFromDatahub (NewConsoleContext->DevicePath);
- if (NULL == NewMenuEntry->DisplayString) {
- NewMenuEntry->DisplayString = DevicePathToStr (NewConsoleContext->DevicePath);
- }
-
- NewConsoleContext->IsTerminal = IsTerminalDevicePath (
- NewConsoleContext->DevicePath,
- &Terminal,
- &Com
- );
-
- NewConsoleContext->IsActive = BdsLibMatchDevicePaths (
- DevicePath,
- NewConsoleContext->DevicePath
- );
- NewTerminalMenuEntry = NULL;
- NewTerminalContext = NULL;
-
- if (NewConsoleContext->IsTerminal) {
- BOpt_DestroyMenuEntry (NewMenuEntry);
- } else {
- Index2++;
- ConsoleMenu->MenuNumber++;
- InsertTailList (&ConsoleMenu->Head, &NewMenuEntry->Link);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetAllConsoles (
- VOID
- )
-/*++
-
-Routine Description:
- Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
-
-Arguments:
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- GetConsoleMenu (BM_CONSOLE_IN_CONTEXT_SELECT);
- GetConsoleMenu (BM_CONSOLE_OUT_CONTEXT_SELECT);
- GetConsoleMenu (BM_CONSOLE_ERR_CONTEXT_SELECT);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FreeAllConsoles (
- VOID
- )
-/*++
-
-Routine Description:
- Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
-
-Arguments:
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- BOpt_FreeMenu (&ConsoleOutMenu);
- BOpt_FreeMenu (&ConsoleInpMenu);
- BOpt_FreeMenu (&ConsoleErrMenu);
- BOpt_FreeMenu (&TerminalMenu);
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-IsTerminalDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT TYPE_OF_TERMINAL *Termi,
- OUT UINTN *Com
- )
-/*++
-
-Routine Description:
- Test whether DevicePath is a valid Terminal
-
-Arguments:
- DevicePath - DevicePath to be checked
- Termi - If is terminal, give its type
- Com - If is Com Port, give its type
-
-Returns:
- TRUE - If DevicePath point to a Terminal
- FALSE
-
---*/
-{
- UINT8 *Ptr;
- BOOLEAN IsTerminal;
- VENDOR_DEVICE_PATH *Vendor;
- ACPI_HID_DEVICE_PATH *Acpi;
- UINT32 Match;
- EFI_GUID TempGuid;
-
- IsTerminal = FALSE;
-
- //
- // Parse the Device Path, should be change later!!!
- //
- Ptr = (UINT8 *) DevicePath;
- while (*Ptr != END_DEVICE_PATH_TYPE) {
- Ptr++;
- }
-
- Ptr = Ptr - sizeof (VENDOR_DEVICE_PATH);
- Vendor = (VENDOR_DEVICE_PATH *) Ptr;
-
- //
- // There are four kinds of Terminal types
- // check to see whether this devicepath
- // is one of that type
- //
- CopyMem (&TempGuid, &Vendor->Guid, sizeof (EFI_GUID));
-
- if (CompareGuid (&TempGuid, &Guid[0])) {
- *Termi = PC_ANSI;
- IsTerminal = TRUE;
- } else {
- if (CompareGuid (&TempGuid, &Guid[1])) {
- *Termi = VT_100;
- IsTerminal = TRUE;
- } else {
- if (CompareGuid (&TempGuid, &Guid[2])) {
- *Termi = VT_100_PLUS;
- IsTerminal = TRUE;
- } else {
- if (CompareGuid (&TempGuid, &Guid[3])) {
- *Termi = VT_UTF8;
- IsTerminal = TRUE;
- } else {
- IsTerminal = FALSE;
- }
- }
- }
- }
-
- if (!IsTerminal) {
- return FALSE;
- }
-
- Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
- Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
- Match = EISA_PNP_ID (0x0501);
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (Com, &Acpi->UID, sizeof (UINT32));
- } else {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Data.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Data.c
deleted file mode 100644
index 196bbe2..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Data.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Data.c
-
-Abstract:
-
- Define some data used for Boot Maint
-
-Revision History
-
---*/
-
-#include "BootMaint.h"
-
-EFI_HII_UPDATE_DATA *UpdateData;
-STRING_DEPOSITORY *FileOptionStrDepository;
-STRING_DEPOSITORY *ConsoleOptionStrDepository;
-STRING_DEPOSITORY *BootOptionStrDepository;
-STRING_DEPOSITORY *BootOptionHelpStrDepository;
-STRING_DEPOSITORY *DriverOptionStrDepository;
-STRING_DEPOSITORY *DriverOptionHelpStrDepository;
-STRING_DEPOSITORY *TerminalStrDepository;
-
-//
-// Terminal type string token storage
-//
-UINT16 TerminalType[] = {
- STRING_TOKEN(STR_COM_TYPE_0),
- STRING_TOKEN(STR_COM_TYPE_1),
- STRING_TOKEN(STR_COM_TYPE_2),
- STRING_TOKEN(STR_COM_TYPE_3),
-};
-
-//
-// File system selection menu
-//
-BM_MENU_OPTION FsOptionMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Console Input Device Selection Menu
-//
-BM_MENU_OPTION ConsoleInpMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Console Output Device Selection Menu
-//
-BM_MENU_OPTION ConsoleOutMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Error Output Device Selection Menu
-//
-BM_MENU_OPTION ConsoleErrMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Boot Option from variable Menu
-//
-BM_MENU_OPTION BootOptionMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Driver Option from variable menu
-//
-BM_MENU_OPTION DriverOptionMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Legacy FD Info from LegacyBios.GetBbsInfo()
-//
-BM_MENU_OPTION LegacyFDMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Legacy HD Info from LegacyBios.GetBbsInfo()
-//
-BM_MENU_OPTION LegacyHDMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Legacy CD Info from LegacyBios.GetBbsInfo()
-//
-BM_MENU_OPTION LegacyCDMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Legacy NET Info from LegacyBios.GetBbsInfo()
-//
-BM_MENU_OPTION LegacyNETMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Legacy NET Info from LegacyBios.GetBbsInfo()
-//
-BM_MENU_OPTION LegacyBEVMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Files and sub-directories in current directory menu
-//
-BM_MENU_OPTION DirectoryMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Handles in current system selection menu
-//
-BM_MENU_OPTION DriverMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-BM_MENU_OPTION TerminalMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Value and string token correspondency for BaudRate
-//
-COM_ATTR BaudRateList[19] = {
- {
- 115200,
- STRING_TOKEN(STR_COM_BAUD_RATE_0)
- },
- {
- 57600,
- STRING_TOKEN(STR_COM_BAUD_RATE_1)
- },
- {
- 38400,
- STRING_TOKEN(STR_COM_BAUD_RATE_2)
- },
- {
- 19200,
- STRING_TOKEN(STR_COM_BAUD_RATE_3)
- },
- {
- 9600,
- STRING_TOKEN(STR_COM_BAUD_RATE_4)
- },
- {
- 7200,
- STRING_TOKEN(STR_COM_BAUD_RATE_5)
- },
- {
- 4800,
- STRING_TOKEN(STR_COM_BAUD_RATE_6)
- },
- {
- 3600,
- STRING_TOKEN(STR_COM_BAUD_RATE_7)
- },
- {
- 2400,
- STRING_TOKEN(STR_COM_BAUD_RATE_8)
- },
- {
- 2000,
- STRING_TOKEN(STR_COM_BAUD_RATE_9)
- },
- {
- 1800,
- STRING_TOKEN(STR_COM_BAUD_RATE_10)
- },
- {
- 1200,
- STRING_TOKEN(STR_COM_BAUD_RATE_11)
- },
- {
- 600,
- STRING_TOKEN(STR_COM_BAUD_RATE_12)
- },
- {
- 300,
- STRING_TOKEN(STR_COM_BAUD_RATE_13)
- },
- {
- 150,
- STRING_TOKEN(STR_COM_BAUD_RATE_14)
- },
- {
- 134,
- STRING_TOKEN(STR_COM_BAUD_RATE_15)
- },
- {
- 110,
- STRING_TOKEN(STR_COM_BAUD_RATE_16)
- },
- {
- 75,
- STRING_TOKEN(STR_COM_BAUD_RATE_17)
- },
- {
- 50,
- STRING_TOKEN(STR_COM_BAUD_RATE_18)
- }
-};
-
-//
-// Value and string token correspondency for DataBits
-//
-COM_ATTR DataBitsList[4] = {
- {
- 5,
- STRING_TOKEN(STR_COM_DATA_BITS_0)
- },
- {
- 6,
- STRING_TOKEN(STR_COM_DATA_BITS_1)
- },
- {
- 7,
- STRING_TOKEN(STR_COM_DATA_BITS_2)
- },
- {
- 8,
- STRING_TOKEN(STR_COM_DATA_BITS_3)
- }
-};
-
-//
-// Value and string token correspondency for Parity
-//
-COM_ATTR ParityList[5] = {
- {
- NoParity,
- STRING_TOKEN(STR_COM_PAR_0)
- },
- {
- EvenParity,
- STRING_TOKEN(STR_COM_PAR_1)
- },
- {
- OddParity,
- STRING_TOKEN(STR_COM_PAR_2)
- },
- {
- MarkParity,
- STRING_TOKEN(STR_COM_PAR_3)
- },
- {
- SpaceParity,
- STRING_TOKEN(STR_COM_PAR_4)
- }
-};
-
-//
-// Value and string token correspondency for Baudreate
-//
-COM_ATTR StopBitsList[3] = {
- {
- OneStopBit,
- STRING_TOKEN(STR_COM_STOP_BITS_0)
- },
- {
- OneFiveStopBits,
- STRING_TOKEN(STR_COM_STOP_BITS_1)
- },
- {
- TwoStopBits,
- STRING_TOKEN(STR_COM_STOP_BITS_2)
- }
-};
-
-//
-// Guid for messaging path, used in Serial port setting.
-//
-EFI_GUID Guid[4] = {
- DEVICE_PATH_MESSAGING_PC_ANSI,
- DEVICE_PATH_MESSAGING_VT_100,
- DEVICE_PATH_MESSAGING_VT_100_PLUS,
- DEVICE_PATH_MESSAGING_VT_UTF8
-};
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FE.vfr b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FE.vfr
deleted file mode 100644
index b9c5bb3..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FE.vfr
+++ /dev/null
@@ -1,138 +0,0 @@
-// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// FE.vfr
-//
-// Abstract:
-//
-// File Explorer Formset
-//
-// Revision History:
-//
-// --*/
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-#include "FormGuid.h"
-
-#pragma pack(1)
-typedef struct {
- UINT16 DescriptionData[75];
- UINT16 OptionalData[127];
- UINT8 Active;
- UINT8 ForceReconnect;
-} FILE_EXPLORER_NV_DATA;
-#pragma pack()
-
-#define FORM_FILE_EXPLORER_ID 0x001E
-#define FORM_BOOT_ADD_DESCRIPTION_ID 0x001F
-#define FORM_DRIVER_ADD_FILE_DESCRIPTION_ID 0x0020
-#define KEY_VALUE_SAVE_AND_EXIT 0x0090
-#define KEY_VALUE_NO_SAVE_AND_EXIT 0x0091
-
-
-
-formset
- guid = FILE_EXPLORE_FORMSET_GUID,
- title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE),
- help = STRING_TOKEN(STR_NULL_STRING),
- class = 0,
- subclass = 0,
-
- form formid = FORM_FILE_EXPLORER_ID,
- title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE);
-
- label FORM_FILE_EXPLORER_ID;
- endform;
-
- form formid = FORM_BOOT_ADD_DESCRIPTION_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_DESC_TITLE);
-
- label FORM_BOOT_ADD_DESCRIPTION_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- string varid = FILE_EXPLORER_NV_DATA.DescriptionData,
- prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
- help = STRING_TOKEN(STR_NULL_STRING),
- minsize = 6,
- maxsize = 75,
- endstring;
-
- string varid = FILE_EXPLORER_NV_DATA.OptionalData,
- prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
- help = STRING_TOKEN(STR_NULL_STRING),
- minsize = 0,
- maxsize = 120,
- endstring;
-
- text
- help = STRING_TOKEN(STR_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE | NV_ACCESS,
- key = KEY_VALUE_SAVE_AND_EXIT;
-
- text
- help = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE | NV_ACCESS,
- key = KEY_VALUE_NO_SAVE_AND_EXIT;
-
- endform;
-
- form formid = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_DESC_TITLE);
-
- label FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- string varid = FILE_EXPLORER_NV_DATA.DescriptionData,
- prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
- help = STRING_TOKEN(STR_NULL_STRING),
- minsize = 6,
- maxsize = 75,
- endstring;
-
- string varid = FILE_EXPLORER_NV_DATA.OptionalData,
- prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
- help = STRING_TOKEN(STR_NULL_STRING),
- minsize = 0,
- maxsize = 120,
- endstring;
-
- checkbox varid = FILE_EXPLORER_NV_DATA.ForceReconnect,
- prompt = STRING_TOKEN(STR_LOAD_OPTION_FORCE_RECON),
- help = STRING_TOKEN(STR_LOAD_OPTION_FORCE_RECON),
- flags = 1,
- key = 0,
- endcheckbox;
-
- text
- help = STRING_TOKEN(STR_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE | NV_ACCESS,
- key = KEY_VALUE_SAVE_AND_EXIT;
-
- text
- help = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE | NV_ACCESS,
- key = KEY_VALUE_NO_SAVE_AND_EXIT;
-
- endform;
-
-endformset;
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FileExplorer.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FileExplorer.c
deleted file mode 100644
index 2c8ec52..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FileExplorer.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FileExplorer.c
-
-AgBStract:
-
- File explorer related functions.
-
---*/
-
-#include "Bds.h"
-#include "BootMaint.h"
-
-VOID
-UpdateFileExplorePage (
- IN BMM_CALLBACK_DATA *CallbackData,
- BM_MENU_OPTION *MenuOption
- )
-/*++
-Routine Description:
- Update the File Explore page.
-
-Arguments:
- MenuOption - Pointer to menu options to display.
-
-Returns:
- None.
-
---*/
-{
- UINT8 *Location;
- UINTN Index;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *NewFileContext;
- FORM_ID FormId;
-
- NewMenuEntry = NULL;
- NewFileContext = NULL;
- FormId = 0;
-
- //
- // Clean up file explore page.
- //
- RefreshUpdateData (FALSE, 0, FALSE, 0, 0xff);
-
- //
- // Remove all op-codes from dynamic page
- //
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->FeHiiHandle,
- FORM_FILE_EXPLORER_ID,
- FALSE,
- UpdateData
- );
-
- RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->FeCallbackHandle, FALSE, 0, 0);
-
- Location = (UINT8 *) &UpdateData->Data;
-
- for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);
- NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewFileContext->IsBootLegacy) {
- continue;
- }
-
- if ((NewFileContext->IsDir) || (BOOT_FROM_FILE_STATE == CallbackData->FeCurrentState)) {
- //
- // Create Text opcode for directory, also create Text opcode for file in BOOT_FROM_FILE_STATE.
- //
- CreateTextOpCode (
- NewMenuEntry->DisplayStringToken,
- STR_NULL_STRING,
- STR_NULL_STRING,
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) (FILE_OPTION_OFFSET + Index),
- Location
- );
- } else {
- //
- // Create Goto opcode for file in ADD_BOOT_OPTION_STATE or ADD_DRIVER_OPTION_STATE.
- //
- if (ADD_BOOT_OPTION_STATE == CallbackData->FeCurrentState) {
- FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
- } else if (ADD_DRIVER_OPTION_STATE == CallbackData->FeCurrentState) {
- FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
- }
-
- CreateGotoOpCode (
- FormId,
- NewMenuEntry->DisplayStringToken,
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) (FILE_OPTION_OFFSET + Index),
- Location
- );
- }
-
- UpdateData->DataCount++;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- }
-
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->FeHiiHandle,
- FORM_FILE_EXPLORER_ID,
- TRUE,
- UpdateData
- );
-}
-
-BOOLEAN
-UpdateFileExplorer (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN UINT16 KeyValue
- )
-/*++
-
-Routine Description:
- Update the file explower page with the refershed file system.
-
-Arguments:
- CallbackData - BMM context data
- KeyValue - Key value to identify the type of data to expect.
-
-Returns:
- TRUE - Inform the caller to create a callback packet to exit file explorer.
- FALSE - Indicate that there is no need to exit file explorer.
-
---*/
-{
- UINT16 FileOptionMask;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *NewFileContext;
- FORM_ID FormId;
- BOOLEAN ExitFileExplorer;
- EFI_STATUS Status;
-
- NewMenuEntry = NULL;
- NewFileContext = NULL;
- ExitFileExplorer = FALSE;
-
- FileOptionMask = (UINT16) (FILE_OPTION_MASK & KeyValue);
-
- if (UNKNOWN_CONTEXT == CallbackData->FeDisplayContext) {
- //
- // First in, display file system.
- //
- BOpt_FreeMenu (&FsOptionMenu);
- BOpt_FindFileSystem (CallbackData);
- CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &FsOptionMenu);
-
- UpdateFileExplorePage (CallbackData, &FsOptionMenu);
-
- CallbackData->FeDisplayContext = FILE_SYSTEM;
- } else {
- if (FILE_SYSTEM == CallbackData->FeDisplayContext) {
- NewMenuEntry = BOpt_GetMenuEntry (&FsOptionMenu, FileOptionMask);
- } else if (DIRECTORY == CallbackData->FeDisplayContext) {
- NewMenuEntry = BOpt_GetMenuEntry (&DirectoryMenu, FileOptionMask);
- }
-
- CallbackData->FeDisplayContext = DIRECTORY;
-
- NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewFileContext->IsDir ) {
- RemoveEntryList (&NewMenuEntry->Link);
- BOpt_FreeMenu (&DirectoryMenu);
- Status = BOpt_FindFiles (CallbackData, NewMenuEntry);
- if (EFI_ERROR (Status)) {
- ExitFileExplorer = TRUE;
- goto exit;
- }
- CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &DirectoryMenu);
- BOpt_DestroyMenuEntry (NewMenuEntry);
-
- UpdateFileExplorePage (CallbackData, &DirectoryMenu);
-
- } else {
- switch (CallbackData->FeCurrentState) {
- case BOOT_FROM_FILE_STATE:
- //
- // Here boot from file
- //
- BootThisFile (NewFileContext);
- ExitFileExplorer = TRUE;
- break;
-
- case ADD_BOOT_OPTION_STATE:
- case ADD_DRIVER_OPTION_STATE:
- if (ADD_BOOT_OPTION_STATE == CallbackData->FeCurrentState) {
- FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
- } else {
- FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
- }
-
- CallbackData->MenuEntry = NewMenuEntry;
- CallbackData->LoadContext->FilePathList = ((BM_FILE_CONTEXT *) (CallbackData->MenuEntry->VariableContext))->DevicePath;
-
- //
- // Clean up file explore page.
- //
- RefreshUpdateData (FALSE, 0, FALSE, 0, 1);
-
- //
- // Remove the Subtitle op-code.
- //
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->FeHiiHandle,
- FormId,
- FALSE,
- UpdateData
- );
-
- //
- // Create Subtitle op-code for the display string of the option.
- //
- RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->FeCallbackHandle, FALSE, 0, 1);
-
- CreateSubTitleOpCode (
- NewMenuEntry->DisplayStringToken,
- &UpdateData->Data
- );
-
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->FeHiiHandle,
- FormId,
- TRUE,
- UpdateData
- );
- break;
-
- default:
- break;
- }
- }
- }
-exit:
- return ExitFileExplorer;
-}
-
-EFI_STATUS
-EFIAPI
-FileExplorerCallback (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *Data,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-Routine Description:
- Callback Function for file exploration and file interaction.
-
-Arguments:
- This - File explorer callback protocol pointer.
- KeyValue - Key value to identify the type of data to expect.
- Data - A pointer to the data being sent to the original exporting driver.
- Packet - A pointer to a packet of information which a driver passes back to the browser.
-
-Returns:
- EFI_SUCCESS - Callback ended successfully.
- Others - Contain some errors.
-
---*/
-{
- BMM_CALLBACK_DATA *Private;
- FILE_EXPLORER_NV_DATA *NvRamMap;
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
- Private = FE_CALLBACK_DATA_FROM_THIS (This);
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->FeCallbackHandle;
- NvRamMap = (FILE_EXPLORER_NV_DATA *) Data->NvRamMap;
-
- if (KEY_VALUE_SAVE_AND_EXIT == KeyValue) {
- //
- // Apply changes and exit formset.
- //
- if (ADD_BOOT_OPTION_STATE == Private->FeCurrentState) {
- Status = Var_UpdateBootOption (Private, NvRamMap);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BOpt_GetBootOptions (Private);
- CreateMenuStringToken (Private, Private->FeHiiHandle, &BootOptionMenu);
- } else if (ADD_DRIVER_OPTION_STATE == Private->FeCurrentState) {
- Status = Var_UpdateDriverOption (
- Private,
- Private->FeHiiHandle,
- NvRamMap->DescriptionData,
- NvRamMap->OptionalData,
- NvRamMap->ForceReconnect
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BOpt_GetDriverOptions (Private);
- CreateMenuStringToken (Private, Private->FeHiiHandle, &DriverOptionMenu);
- }
-
- CreateCallbackPacket (Packet, EXIT_REQUIRED | NV_NOT_CHANGED);
- } else if (KEY_VALUE_NO_SAVE_AND_EXIT == KeyValue) {
- //
- // Discard changes and exit formset.
- //
- NvRamMap->OptionalData[0] = 0x0000;
- NvRamMap->DescriptionData[0] = 0x0000;
- CreateCallbackPacket (Packet, EXIT_REQUIRED | NV_NOT_CHANGED);
- } else if (KeyValue < FILE_OPTION_OFFSET) {
- //
- // Exit File Explorer formset.
- //
- CreateCallbackPacket (Packet, EXIT_REQUIRED);
- } else {
- if (UpdateFileExplorer (Private, KeyValue)) {
- CreateCallbackPacket (Packet, EXIT_REQUIRED);
- }
- }
-
- return Status;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FormGuid.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FormGuid.h
deleted file mode 100644
index 8b55159..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FormGuid.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// FormGuid.h
-//
-// Abstract:
-//
-// Formset guids for Boot Maintenance Manager
-//
-// Revision History:
-//
-// --*/
-//
-#define MAIN_FORMSET_GUID \
- { \
- 0x642237c7, 0x35d4, 0x472d, { 0x83, 0x65, 0x12, 0xe0, 0xcc, 0xf2, 0x7a, 0x22 } \
- }
-
-#define FILE_EXPLORE_FORMSET_GUID \
- { \
- 0x1f2d63e1, 0xfebd, 0x4dc7, { 0x9c, 0xc5, 0xba, 0x2b, 0x1c, 0xef, 0x9c, 0x5b } \
- }
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/UpdatePage.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/UpdatePage.c
deleted file mode 100644
index 05b912c..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/UpdatePage.c
+++ /dev/null
@@ -1,1267 +0,0 @@
-/**@file
- Dynamically Update the pages.
-
-Copyright (c) 2006 - 2007 Intel Corporation.
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Bds.h"
-#include "BootMaint.h"
-
-EFI_GUID gTerminalDriverGuid = {
- 0x9E863906, 0xA40F, 0x4875, {0x97, 0x7F, 0x5B, 0x93, 0xFF, 0x23, 0x7F, 0xC6}
-};
-
-VOID
-RefreshUpdateData (
- IN BOOLEAN FormSetUpdate,
- IN EFI_PHYSICAL_ADDRESS FormCallbackHandle,
- IN BOOLEAN FormUpdate,
- IN STRING_REF FormTitle,
- IN UINT16 DataCount
- )
-/*++
-Routine Description:
- Refresh the global UpdateData structure.
-
-Arguments:
- FormSetUpdate - If TRUE, next variable is significant
- FormCallbackHandle - If not 0, will update FormSet with this info
- FormUpdate - If TRUE, next variable is significant
- FormTitle - If not 0, will update Form with this info
- DataCount - The number of Data entries in this structure
-
-Returns:
- None.
---*/
-{
- UpdateData->FormSetUpdate = FormSetUpdate;
- if (FormSetUpdate) {
- ASSERT (0 != FormCallbackHandle);
- UpdateData->FormCallbackHandle = FormCallbackHandle;
- }
-
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = FormTitle;
- UpdateData->DataCount = DataCount;
-}
-
-VOID
-UpdatePageStart (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN OUT UINT8 **CurrentLocation
- )
-{
- RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->BmmCallbackHandle, FALSE, 0, 0);
-
- if (!(CallbackData->BmmAskSaveOrNot)) {
- //
- // Add a "Go back to main page" tag in front of the form when there are no
- // "Apply changes" and "Discard changes" tags in the end of the form.
- //
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_FORM_GOTO_MAIN),
- STRING_TOKEN (STR_FORM_GOTO_MAIN),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_MAIN_ID,
- *CurrentLocation
- );
-
- UpdateData->DataCount++;
-
- *CurrentLocation = *CurrentLocation + ((EFI_IFR_OP_HEADER *) (*CurrentLocation))->Length;
- }
-
-}
-
-VOID
-UpdatePageEnd (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN UINT8 *CurrentLocation
- )
-{
- //
- // Create the "Apply changes" and "Discard changes" tags.
- //
- if (CallbackData->BmmAskSaveOrNot) {
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_SAVE_AND_EXIT,
- CurrentLocation
- );
-
- UpdateData->DataCount++;
-
- CurrentLocation = CurrentLocation + ((EFI_IFR_OP_HEADER *) CurrentLocation)->Length;
-
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_NO_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_NO_SAVE_AND_EXIT,
- CurrentLocation
- );
-
- UpdateData->DataCount++;
- }
- //
- // Ensure user can return to the main page.
- //
- if (0 == UpdateData->DataCount) {
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_NO_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_NO_SAVE_AND_EXIT,
- CurrentLocation
- );
-
- UpdateData->DataCount++;
- }
-
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->BmmHiiHandle,
- CallbackData->BmmCurrentPageId,
- TRUE,
- UpdateData
- );
-}
-
-VOID
-CleanUpPage (
- IN EFI_FORM_LABEL LabelId,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- RefreshUpdateData (FALSE, 0, FALSE, 0, 0xff);
-
- //
- // Remove all op-codes from dynamic page
- //
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->BmmHiiHandle,
- LabelId,
- FALSE,
- UpdateData
- );
-}
-
-EFI_STATUS
-BootThisFile (
- IN BM_FILE_CONTEXT *FileContext
- )
-{
- EFI_STATUS Status;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
- BDS_COMMON_OPTION *Option;
-
- Status = gBS->AllocatePool (EfiBootServicesData, sizeof (BDS_COMMON_OPTION), (VOID**) &Option);
- Option->Description = FileContext->FileName;
- Option->DevicePath = FileContext->DevicePath;
- Option->LoadOptionsSize = 0;
- Option->LoadOptions = NULL;
-
- //
- // Since current no boot from removable media directly is allowed */
- //
- gST->ConOut->ClearScreen (gST->ConOut);
-
- ExitDataSize = 0;
-
- Status = BdsLibBootViaBootOption (Option, Option->DevicePath, &ExitDataSize, &ExitData);
-
- return Status;
-
-}
-
-VOID
-UpdateConCOMPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
- UINT8 *Location;
- EFI_STATUS Status;
- VOID *Interface;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = FALSE;
-
- UpdatePageStart (CallbackData, &Location);
-
- Status = EfiLibLocateProtocol (&gTerminalDriverGuid, &Interface);
- if (!EFI_ERROR (Status)) {
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
-
- CreateGotoOpCode (
- FORM_CON_COM_SETUP_ID,
- NewMenuEntry->DisplayStringToken,
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) (TERMINAL_OPTION_OFFSET + Index),
- Location
- );
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- }
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateBootDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT16 Index;
- UINT8 *Location;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);
-
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (NewLoadContext->IsLegacy) {
- continue;
- }
-
- NewLoadContext->Deleted = FALSE;
- CallbackData->BmmFakeNvData->BootOptionDel[Index] = 0x00;
-
- CreateCheckBoxOpCode (
- (UINT16) (BOOT_OPTION_DEL_QUESTION_ID + Index),
- (UINT8) 1,
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) BOOT_OPTION_DEL_QUESTION_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateDrvAddHandlePage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
- UINT8 *Location;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = FALSE;
-
- UpdatePageStart (CallbackData, &Location);
-
- for (Index = 0; Index < DriverMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index);
-
- CreateGotoOpCode (
- FORM_DRV_ADD_HANDLE_DESC_ID,
- NewMenuEntry->DisplayStringToken,
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) (HANDLE_OPTION_OFFSET + Index),
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateDrvDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT16 Index;
- UINT8 *Location;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
-
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &DriverOptionMenu);
-
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = FALSE;
- CallbackData->BmmFakeNvData->DriverOptionDel[Index] = 0x00;
-
- CreateCheckBoxOpCode (
- (UINT16) (DRIVER_OPTION_DEL_QUESTION_ID + Index),
- (UINT8) 1,
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) DRIVER_OPTION_DEL_QUESTION_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateDriverAddHandleDescPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT8 *Location;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmFakeNvData->DriverAddActive = 0x01;
- CallbackData->BmmFakeNvData->DriverAddForceReconnect = 0x00;
- CallbackData->BmmAskSaveOrNot = TRUE;
- NewMenuEntry = CallbackData->MenuEntry;
-
- UpdatePageStart (CallbackData, &Location);
-
- UpdateData->DataCount += (UINT16) 4;
-
- CreateSubTitleOpCode (
- NewMenuEntry->DisplayStringToken,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateStringOpCode (
- DRV_ADD_HANDLE_DESC_QUESTION_ID,
- (UINT8) 150,
- STRING_TOKEN (STR_LOAD_OPTION_DESC),
- STRING_TOKEN (STR_NULL_STRING),
- 6,
- 75,
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_DRIVER_ADD_DESC_DATA,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateCheckBoxOpCode (
- DRV_ADD_RECON_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_LOAD_OPTION_FORCE_RECON),
- STRING_TOKEN (STR_LOAD_OPTION_FORCE_RECON),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- DRV_ADD_RECON_QUESTION_ID,
- Location
- );
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateStringOpCode (
- DRIVER_ADD_OPTION_QUESTION_ID,
- (UINT8) 150,
- STRING_TOKEN (STR_OPTIONAL_DATA),
- STRING_TOKEN (STR_NULL_STRING),
- 6,
- 75,
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_DRIVER_ADD_OPT_DATA,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateConsolePage (
- IN UINT16 UpdatePageId,
- IN BM_MENU_OPTION *ConsoleMenu,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- UINT16 Index;
- UINT16 Index2;
- UINT8 *Location;
- UINT8 CheckFlags;
- EFI_STATUS Status;
- VOID *Interface;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
-
- for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- if (NewConsoleContext->IsActive) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- CallbackData->BmmFakeNvData->ConsoleCheck[Index] = TRUE;
- } else {
- CallbackData->BmmFakeNvData->ConsoleCheck[Index] = FALSE;
- }
-
- CreateCheckBoxOpCode (
- (UINT16) (CON_DEVICE_QUESTION_ID + Index),
- (UINT8) 1,
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- CheckFlags,
- (UINT16) (CONSOLE_OPTION_OFFSET + Index),
- Location
- );
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- }
-
- Status = EfiLibLocateProtocol (&gTerminalDriverGuid, &Interface);
- if (!EFI_ERROR (Status)) {
- for (Index2 = 0; Index2 < TerminalMenu.MenuNumber; Index2++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index2);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
-
- if ((NewTerminalContext->IsConIn && (UpdatePageId == FORM_CON_IN_ID)) ||
- (NewTerminalContext->IsConOut && (UpdatePageId == FORM_CON_OUT_ID)) ||
- (NewTerminalContext->IsStdErr && (UpdatePageId == FORM_CON_ERR_ID))
- ) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- CallbackData->BmmFakeNvData->ConsoleCheck[Index] = TRUE;
- } else {
- CallbackData->BmmFakeNvData->ConsoleCheck[Index] = FALSE;
- }
-
- CreateCheckBoxOpCode (
- (UINT16) (CON_DEVICE_QUESTION_ID + Index),
- (UINT8) 1,
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- CheckFlags,
- (UINT16) (CONSOLE_OPTION_OFFSET + Index),
- Location
- );
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- Index++;
- }
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateOrderPage (
- IN UINT16 UpdatePageId,
- IN BM_MENU_OPTION *OptionMenu,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
- UINT8 *Location;
- IFR_OPTION *IfrOptionList;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
-
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);
-
- ZeroMem (CallbackData->BmmFakeNvData->OptionOrder, 100);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * OptionMenu->MenuNumber);
- if (NULL == IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
- IfrOptionList[Index].StringToken = NewMenuEntry->DisplayStringToken;
- IfrOptionList[Index].Value = (UINT16) (NewMenuEntry->OptionNumber + 1);
- IfrOptionList[Index].OptionString = NULL;
- CallbackData->BmmFakeNvData->OptionOrder[Index] = (UINT8) (IfrOptionList[Index].Value);
- }
-
- if (OptionMenu->MenuNumber > 0) {
- CreateOrderedListOpCode (
- (UINT16) OPTION_ORDER_QUESTION_ID,
- (UINT8) 100,
- STRING_TOKEN (STR_CHANGE_ORDER),
- STRING_TOKEN (STR_CHANGE_ORDER),
- IfrOptionList,
- OptionMenu->MenuNumber,
- Location
- );
-
- for (Index = 0; Index < OptionMenu->MenuNumber + 2; Index++) {
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- }
-
- UpdateData->DataCount = (UINT16) (UpdateData->DataCount + OptionMenu->MenuNumber + 2);
- }
-
- SafeFreePool (IfrOptionList);
-
- UpdatePageEnd (CallbackData, Location);
-
- CopyMem (
- CallbackData->BmmOldFakeNVData.OptionOrder,
- CallbackData->BmmFakeNvData->OptionOrder,
- 100
- );
-}
-
-VOID
-UpdateBootNextPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT8 *Location;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- IFR_OPTION *IfrOptionList;
- UINTN NumberOfOptions;
- UINT16 Index;
-
- Location = (UINT8 *) &UpdateData->Data;
- IfrOptionList = NULL;
- NumberOfOptions = BootOptionMenu.MenuNumber;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);
-
- if (NumberOfOptions > 0) {
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + NumberOfOptions);
- IfrOptionList = AllocateZeroPool ((NumberOfOptions + 1) * sizeof (IFR_OPTION));
-
- ASSERT (IfrOptionList);
-
- CallbackData->BmmFakeNvData->BootNext = (UINT16) (BootOptionMenu.MenuNumber);
-
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (NewLoadContext->IsBootNext) {
- IfrOptionList[Index].Flags = EFI_IFR_FLAG_DEFAULT | EFI_IFR_FLAG_INTERACTIVE;
- CallbackData->BmmFakeNvData->BootNext = Index;
- } else {
- IfrOptionList[Index].Flags = EFI_IFR_FLAG_INTERACTIVE;
- }
-
- IfrOptionList[Index].Key = (UINT16) KEY_VALUE_MAIN_BOOT_NEXT;
- IfrOptionList[Index].Value = Index;
- IfrOptionList[Index].StringToken = NewMenuEntry->DisplayStringToken;
- IfrOptionList[Index].OptionString = NULL;
- }
-
- IfrOptionList[Index].Key = (UINT16) KEY_VALUE_MAIN_BOOT_NEXT;
- IfrOptionList[Index].Value = Index;
- IfrOptionList[Index].StringToken = STRING_TOKEN (STR_NONE);
- IfrOptionList[Index].Flags = EFI_IFR_FLAG_INTERACTIVE;
- if (CallbackData->BmmFakeNvData->BootNext == Index) {
- IfrOptionList[Index].Flags |= EFI_IFR_FLAG_DEFAULT;
- }
-
- IfrOptionList[Index].OptionString = NULL;
-
- CreateOneOfOpCode (
- (UINT16) BOOT_NEXT_QUESTION_ID,
- (UINT8) 2,
- STRING_TOKEN (STR_BOOT_NEXT),
- STRING_TOKEN (STR_BOOT_NEXT_HELP),
- IfrOptionList,
- (UINTN) (NumberOfOptions + 1),
- Location
- );
- Location = Location + (NumberOfOptions + 2) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- UpdateData->DataCount += 3;
- SafeFreePool (IfrOptionList);
- IfrOptionList = NULL;
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateTimeOutPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT8 *Location;
- UINT16 BootTimeOut;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
-
- BootTimeOut = BdsLibGetTimeout ();
-
- CreateNumericOpCode (
- (UINT16) BOOT_TIME_OUT_QUESTION_ID,
- (UINT8) 2,
- STRING_TOKEN (STR_NUM_AUTO_BOOT),
- STRING_TOKEN (STR_HLP_AUTO_BOOT),
- 0,
- 65535,
- 0,
- 10,
- 0,
- 0,
- Location
- );
-
- CallbackData->BmmFakeNvData->BootTimeOut = (UINT16) BootTimeOut;
- UpdateData->DataCount++;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateTerminalPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT16 Index;
- UINT8 *Location;
- UINT8 CheckFlags;
- IFR_OPTION *IfrOptionList;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
-
- ZeroMem (UpdateData, UPDATE_DATA_SIZE);
- Location = (UINT8 *) &UpdateData->Data;
- UpdatePageStart (CallbackData, &Location);
-
- NewMenuEntry = BOpt_GetMenuEntry (
- &TerminalMenu,
- CallbackData->CurrentTerminal
- );
-
- if (!NewMenuEntry) {
- return ;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 19);
- if (!IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < 19; Index++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- if (NewTerminalContext->BaudRate == (UINT64) (BaudRateList[Index].Value)) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- NewTerminalContext->BaudRateIndex = (UINT8) Index;
- CallbackData->BmmFakeNvData->COMBaudRate = NewTerminalContext->BaudRateIndex;
- }
-
- IfrOptionList[Index].Flags = CheckFlags;
- IfrOptionList[Index].Key = KEY_VALUE_COM_SET_BAUD_RATE;
- IfrOptionList[Index].StringToken = BaudRateList[Index].StringToken;
- IfrOptionList[Index].Value = Index;
- }
-
- CreateOneOfOpCode (
- (UINT16) COM_BAUD_RATE_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_COM_BAUD_RATE),
- STRING_TOKEN (STR_COM_BAUD_RATE),
- IfrOptionList,
- 19,
- Location
- );
-
- Location = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);
- UpdateData->DataCount += 2;
-
- SafeFreePool (IfrOptionList);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 4);
- if (!IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < 4; Index++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
-
- if (NewTerminalContext->DataBits == DataBitsList[Index].Value) {
- NewTerminalContext->DataBitsIndex = (UINT8) Index;
- CallbackData->BmmFakeNvData->COMDataRate = NewTerminalContext->DataBitsIndex;
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- }
-
- IfrOptionList[Index].Flags = CheckFlags;
- IfrOptionList[Index].Key = KEY_VALUE_COM_SET_DATA_BITS;
- IfrOptionList[Index].StringToken = DataBitsList[Index].StringToken;
- IfrOptionList[Index].Value = Index;
- }
-
- CreateOneOfOpCode (
- (UINT16) COM_DATA_RATE_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_COM_DATA_BITS),
- STRING_TOKEN (STR_COM_DATA_BITS),
- IfrOptionList,
- 4,
- Location
- );
-
- Location = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);
- UpdateData->DataCount += 2;
-
- SafeFreePool (IfrOptionList);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 5);
- if (!IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < 5; Index++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- if (NewTerminalContext->Parity == ParityList[Index].Value) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- NewTerminalContext->ParityIndex = (UINT8) Index;
- CallbackData->BmmFakeNvData->COMParity = NewTerminalContext->ParityIndex;
- }
-
- IfrOptionList[Index].Flags = CheckFlags;
- IfrOptionList[Index].Key = KEY_VALUE_COM_SET_PARITY;
- IfrOptionList[Index].StringToken = ParityList[Index].StringToken;
- IfrOptionList[Index].Value = Index;
- }
-
- CreateOneOfOpCode (
- (UINT16) COM_PARITY_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_COM_PARITY),
- STRING_TOKEN (STR_COM_PARITY),
- IfrOptionList,
- 5,
- Location
- );
-
- Location = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);
- UpdateData->DataCount += 2;
-
- SafeFreePool (IfrOptionList);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 3);
- if (!IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < 3; Index++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- if (NewTerminalContext->StopBits == StopBitsList[Index].Value) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- NewTerminalContext->StopBitsIndex = (UINT8) Index;
- CallbackData->BmmFakeNvData->COMStopBits = NewTerminalContext->StopBitsIndex;
- }
-
- IfrOptionList[Index].Flags = CheckFlags;
- IfrOptionList[Index].Key = KEY_VALUE_COM_SET_STOP_BITS;
- IfrOptionList[Index].StringToken = StopBitsList[Index].StringToken;
- IfrOptionList[Index].Value = Index;
- }
-
- CreateOneOfOpCode (
- (UINT16) COM_STOP_BITS_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_COM_STOP_BITS),
- STRING_TOKEN (STR_COM_STOP_BITS),
- IfrOptionList,
- 3,
- Location
- );
-
- Location = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);
- UpdateData->DataCount += 2;
-
- SafeFreePool (IfrOptionList);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 4);
- if (!IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < 4; Index++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- if (NewTerminalContext->TerminalType == Index) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- CallbackData->BmmFakeNvData->COMTerminalType = NewTerminalContext->TerminalType;
- }
-
- IfrOptionList[Index].Flags = CheckFlags;
- IfrOptionList[Index].Key = KEY_VALUE_COM_SET_TERMI_TYPE;
- IfrOptionList[Index].StringToken = (STRING_REF) TerminalType[Index];
- IfrOptionList[Index].Value = Index;
- }
-
- CreateOneOfOpCode (
- (UINT16) COM_TERMINAL_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_COM_TERMI_TYPE),
- STRING_TOKEN (STR_COM_TERMI_TYPE),
- IfrOptionList,
- 4,
- Location
- );
-
- Location = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);
- UpdateData->DataCount += 2;
-
- SafeFreePool (IfrOptionList);
-
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_SAVE_AND_EXIT,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
-
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_NO_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_NO_SAVE_AND_EXIT,
- Location
- );
-
- UpdateData->DataCount++;
-
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->BmmHiiHandle,
- (EFI_FORM_LABEL) FORM_CON_COM_SETUP_ID,
- TRUE,
- UpdateData
- );
-
-}
-
-VOID
-UpdatePageBody (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- CleanUpPage (UpdatePageId, CallbackData);
- switch (UpdatePageId) {
- case FORM_CON_IN_ID:
- UpdateConsolePage (UpdatePageId, &ConsoleInpMenu, CallbackData);
- break;
-
- case FORM_CON_OUT_ID:
- UpdateConsolePage (UpdatePageId, &ConsoleOutMenu, CallbackData);
- break;
-
- case FORM_CON_ERR_ID:
- UpdateConsolePage (UpdatePageId, &ConsoleErrMenu, CallbackData);
- break;
-
- case FORM_BOOT_CHG_ID:
- UpdateOrderPage (UpdatePageId, &BootOptionMenu, CallbackData);
- break;
-
- case FORM_DRV_CHG_ID:
- UpdateOrderPage (UpdatePageId, &DriverOptionMenu, CallbackData);
- break;
-
- default:
- break;
- }
-}
-
-VOID *
-GetLegacyBootOptionVar (
- IN UINTN DeviceType,
- OUT UINTN *OptionIndex,
- OUT UINTN *OptionSize
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- VOID *OptionBuffer;
- UINTN OrderSize;
- UINTN Index;
- UINT32 Attribute;
- UINT16 *OrderBuffer;
- CHAR16 StrTemp[100];
- UINT16 FilePathSize;
- CHAR16 *Description;
- UINT8 *Ptr;
- UINT8 *OptionalData;
-
- //
- // Get Boot Option number from the size of BootOrder
- //
- OrderBuffer = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &OrderSize
- );
-
- for (Index = 0; Index < OrderSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (StrTemp, 100, L"Boot%04x", OrderBuffer[Index]);
- OptionBuffer = BdsLibGetVariableAndSize (
- StrTemp,
- &gEfiGlobalVariableGuid,
- OptionSize
- );
- if (NULL == OptionBuffer) {
- continue;
- }
-
- Ptr = (UINT8 *) OptionBuffer;
- Attribute = *(UINT32 *) Ptr;
- Ptr += sizeof (UINT32);
-
- FilePathSize = *(UINT16 *) Ptr;
- Ptr += sizeof (UINT16);
-
- Description = (CHAR16 *) Ptr;
- Ptr += StrSize ((CHAR16 *) Ptr);
-
- //
- // Now Ptr point to Device Path
- //
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- Ptr += FilePathSize;
-
- //
- // Now Ptr point to Optional Data
- //
- OptionalData = Ptr;
-
- if ((DeviceType == ((BBS_TABLE *) OptionalData)->DeviceType) &&
- (BBS_DEVICE_PATH == DevicePath->Type) &&
- (BBS_BBS_DP == DevicePath->SubType)
- ) {
- *OptionIndex = OrderBuffer[Index];
- SafeFreePool (OrderBuffer);
- return OptionBuffer;
- } else {
- SafeFreePool (OptionBuffer);
- }
- }
-
- SafeFreePool (OrderBuffer);
- return NULL;
-}
-
-VOID
-UpdateSetLegacyDeviceOrderPage (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_LEGACY_DEV_ORDER_CONTEXT *DevOrder;
- BM_MENU_OPTION *OptionMenu;
- BM_MENU_ENTRY *NewMenuEntry;
- IFR_OPTION *IfrOptionList;
- STRING_REF StrRef;
- STRING_REF StrRefHelp;
- BBS_TYPE BbsType;
- UINTN VarSize;
- UINTN Pos;
- UINTN Bit;
- UINT16 Index;
- UINT16 Index2;
- UINT16 Key;
- CHAR16 String[100];
- CHAR16 *TypeStr;
- CHAR16 *TypeStrHelp;
- UINT16 VarDevOrder;
- UINT8 *Location;
- UINT8 *VarData;
- UINT8 *OriginalPtr;
- UINT8 *LegacyOrder;
- UINT8 *OldData;
- UINT8 *DisMap;
-
- OptionMenu = NULL;
- Key = 0;
- StrRef = 0;
- StrRefHelp = 0;
- TypeStr = NULL;
- TypeStrHelp = NULL;
- BbsType = BBS_FLOPPY;
- LegacyOrder = NULL;
- OldData = NULL;
- DisMap = NULL;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
-
- DisMap = CallbackData->BmmOldFakeNVData.DisableMap;
-
- SetMem (DisMap, 32, 0);
- //
- // Create oneof option list
- //
- switch (UpdatePageId) {
- case FORM_SET_FD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu;
- Key = LEGACY_FD_QUESTION_ID;
- TypeStr = StrFloppy;
- TypeStrHelp = StrFloppyHelp;
- BbsType = BBS_FLOPPY;
- LegacyOrder = CallbackData->BmmFakeNvData->LegacyFD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyFD;
- break;
-
- case FORM_SET_HD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyHDMenu;
- Key = LEGACY_HD_QUESTION_ID;
- TypeStr = StrHardDisk;
- TypeStrHelp = StrHardDiskHelp;
- BbsType = BBS_HARDDISK;
- LegacyOrder = CallbackData->BmmFakeNvData->LegacyHD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyHD;
- break;
-
- case FORM_SET_CD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyCDMenu;
- Key = LEGACY_CD_QUESTION_ID;
- TypeStr = StrCDROM;
- TypeStrHelp = StrCDROMHelp;
- BbsType = BBS_CDROM;
- LegacyOrder = CallbackData->BmmFakeNvData->LegacyCD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyCD;
- break;
-
- case FORM_SET_NET_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyNETMenu;
- Key = LEGACY_NET_QUESTION_ID;
- TypeStr = StrNET;
- TypeStrHelp = StrNETHelp;
- BbsType = BBS_EMBED_NETWORK;
- LegacyOrder = CallbackData->BmmFakeNvData->LegacyNET;
- OldData = CallbackData->BmmOldFakeNVData.LegacyNET;
- break;
-
- case FORM_SET_BEV_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyBEVMenu;
- Key = LEGACY_BEV_QUESTION_ID;
- TypeStr = StrBEV;
- TypeStrHelp = StrBEVHelp;
- BbsType = BBS_BEV_DEVICE;
- LegacyOrder = CallbackData->BmmFakeNvData->LegacyBEV;
- OldData = CallbackData->BmmOldFakeNVData.LegacyBEV;
- break;
-
- }
-
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * (OptionMenu->MenuNumber + 1));
- if (NULL == IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
- IfrOptionList[Index].Flags = EFI_IFR_FLAG_INTERACTIVE;
- if (0 == Index) {
- IfrOptionList[Index].Flags |= EFI_IFR_FLAG_DEFAULT;
- }
-
- IfrOptionList[Index].Key = Key;
- IfrOptionList[Index].StringToken = NewMenuEntry->DisplayStringToken;
- IfrOptionList[Index].Value = (UINT16) ((BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext)->Index;
- IfrOptionList[Index].OptionString = NULL;
- }
- //
- // for item "Disabled"
- //
- IfrOptionList[Index].Flags = EFI_IFR_FLAG_INTERACTIVE;
- IfrOptionList[Index].Key = Key;
- IfrOptionList[Index].StringToken = STRING_TOKEN (STR_DISABLE_LEGACY_DEVICE);
- IfrOptionList[Index].Value = 0xFF;
- IfrOptionList[Index].OptionString = NULL;
-
- //
- // Get Device Order from variable
- //
- VarData = BdsLibGetVariableAndSize (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- &VarSize
- );
-
- if (NULL != VarData) {
- OriginalPtr = VarData;
- DevOrder = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;
- while (VarData < VarData + VarSize) {
- if (DevOrder->BbsType == BbsType) {
- break;
- }
-
- VarData += sizeof (BBS_TYPE);
- VarData += *(UINT16 *) VarData;
- DevOrder = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;
- }
- //
- // Create oneof tag here for FD/HD/CD #1 #2
- //
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- for (Index2 = 0; Index2 <= OptionMenu->MenuNumber; Index2++) {
- IfrOptionList[Index2].Key = (UINT16) (Key + Index);
- }
- //
- // Create the string for oneof tag
- //
- UnicodeSPrint (String, sizeof (String), TypeStr, Index);
- StrRef = 0;
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- CallbackData->BmmHiiHandle,
- &StrRef,
- String
- );
-
- UnicodeSPrint (String, sizeof (String), TypeStrHelp, Index);
- StrRefHelp = 0;
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- CallbackData->BmmHiiHandle,
- &StrRefHelp,
- String
- );
-
- CreateOneOfOpCode (
- (UINT16) (Key + Index),
- (UINT8) 1,
- StrRef,
- StrRefHelp,
- IfrOptionList,
- OptionMenu->MenuNumber + 1,
- Location
- );
-
- VarDevOrder = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index * sizeof (UINT16));
-
- if (0xFF00 == (VarDevOrder & 0xFF00)) {
- LegacyOrder[Index] = 0xFF;
- Pos = (VarDevOrder & 0xFF) / 8;
- Bit = 7 - ((VarDevOrder & 0xFF) % 8);
- DisMap[Pos] |= (UINT8) (1 << Bit);
- } else {
- LegacyOrder[Index] = (UINT8) (VarDevOrder & 0xFF);
- }
-
- Location = Location + (OptionMenu->MenuNumber + 2) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT16) (UpdateData->DataCount + (OptionMenu->MenuNumber + 3));
- }
- }
-
- CopyMem (
- OldData,
- LegacyOrder,
- 100
- );
-
- if (IfrOptionList != NULL) {
- SafeFreePool (IfrOptionList);
- IfrOptionList = NULL;
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdatePageId (
- BMM_CALLBACK_DATA *Private,
- UINT16 NewPageId
- )
-{
- UINT16 FileOptionMask;
-
- FileOptionMask = (UINT16) (FILE_OPTION_MASK & NewPageId);
-
- if ((NewPageId < FILE_OPTION_OFFSET) && (NewPageId >= HANDLE_OPTION_OFFSET)) {
- //
- // If we select a handle to add driver option, advance to the add handle description page.
- //
- NewPageId = FORM_DRV_ADD_HANDLE_DESC_ID;
- } else if ((NewPageId == KEY_VALUE_SAVE_AND_EXIT) || (NewPageId == KEY_VALUE_NO_SAVE_AND_EXIT)) {
- //
- // Return to main page after "Save Changes" or "Discard Changes".
- //
- NewPageId = FORM_MAIN_ID;
- }
-
- if ((NewPageId > 0) && (NewPageId < MAXIMUM_FORM_ID)) {
- Private->BmmPreviousPageId = Private->BmmCurrentPageId;
- Private->BmmCurrentPageId = NewPageId;
- }
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Variable.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Variable.c
deleted file mode 100644
index c65f841..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Variable.c
+++ /dev/null
@@ -1,1278 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Variable.c
-
-Abstract:
-
- Variable operation that will be used by BootMaint
-
---*/
-
-#include "Bds.h"
-#include "BootMaint.h"
-
-EFI_STATUS
-Var_DelBootOption (
- VOID
- )
-/*++
-
-Routine Description:
- Delete Boot Option that represent a Deleted state in BootOptionMenu.
- After deleting this boot option, call Var_ChangeBootOrder to
- make sure BootOrder is in valid state.
-
-Arguments:
- LoadOption -- Pointer to the boot option that to be deleted
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
-
- UINT16 BootString[10];
- EFI_STATUS Status;
- UINTN Index;
- UINTN Index2;
-
- Status = EFI_SUCCESS;
- Index2 = 0;
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, (Index - Index2));
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (!NewLoadContext->Deleted) {
- continue;
- }
-
- UnicodeSPrint (
- BootString,
- sizeof (BootString),
- L"Boot%04x",
- NewMenuEntry->OptionNumber
- );
-
- EfiLibDeleteVariable (BootString, &gEfiGlobalVariableGuid);
- Index2++;
- //
- // If current Load Option is the same as BootNext,
- // must delete BootNext in order to make sure
- // there will be no panic on next boot
- //
- if (NewLoadContext->IsBootNext) {
- EfiLibDeleteVariable (L"BootNext", &gEfiGlobalVariableGuid);
- }
-
- RemoveEntryList (&NewMenuEntry->Link);
- BOpt_DestroyMenuEntry (NewMenuEntry);
- NewMenuEntry = NULL;
- }
-
- BootOptionMenu.MenuNumber -= Index2;
-
- Status = Var_ChangeBootOrder ();
- return Status;
-}
-
-EFI_STATUS
-Var_ChangeBootOrder (
- VOID
- )
-/*++
-
-Routine Description:
- After any operation on Boot####, there will be a discrepancy in BootOrder.
- Since some are missing but in BootOrder, while some are present but are
- not reflected by BootOrder. Then a function rebuild BootOrder from
- scratch by content from BootOptionMenu is needed.
-
-Arguments:
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
-
- EFI_STATUS Status;
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 *BootOrderList;
- UINT16 *BootOrderListPtr;
- UINTN BootOrderListSize;
- UINTN Index;
-
- BootOrderList = NULL;
- BootOrderListSize = 0;
-
- //
- // First check whether BootOrder is present in current configuration
- //
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
-
- //
- // If exists, delete it to hold new BootOrder
- //
- if (BootOrderList) {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- SafeFreePool (BootOrderList);
- BootOrderList = NULL;
- }
- //
- // Maybe here should be some check method to ensure that
- // no new added boot options will be added
- // but the setup engine now will give only one callback
- // that is to say, user are granted only one chance to
- // decide whether the boot option will be added or not
- // there should be no indictor to show whether this
- // is a "new" boot option
- //
- BootOrderListSize = BootOptionMenu.MenuNumber;
-
- if (BootOrderListSize > 0) {
- BootOrderList = AllocateZeroPool (BootOrderListSize * sizeof (UINT16));
- ASSERT (BootOrderList != NULL);
- BootOrderListPtr = BootOrderList;
-
- //
- // Get all current used Boot#### from BootOptionMenu.
- // OptionNumber in each BM_LOAD_OPTION is really its
- // #### value.
- //
- for (Index = 0; Index < BootOrderListSize; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- *BootOrderList = (UINT16) NewMenuEntry->OptionNumber;
- BootOrderList++;
- }
-
- BootOrderList = BootOrderListPtr;
-
- //
- // After building the BootOrderList, write it back
- //
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BootOrderListSize * sizeof (UINT16),
- BootOrderList
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Var_DelDriverOption (
- VOID
- )
-/*++
-
-Routine Description:
- Delete Load Option that represent a Deleted state in BootOptionMenu.
- After deleting this Driver option, call Var_ChangeDriverOrder to
- make sure DriverOrder is in valid state.
-
-Arguments:
- LoadOption -- Pointer to the Driver option that to be deleted
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
-
- UINT16 DriverString[12];
- EFI_STATUS Status;
- UINTN Index;
- UINTN Index2;
-
- Status = EFI_SUCCESS;
- Index2 = 0;
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, (Index - Index2));
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (!NewLoadContext->Deleted) {
- continue;
- }
-
- UnicodeSPrint (
- DriverString,
- sizeof (DriverString),
- L"Driver%04x",
- NewMenuEntry->OptionNumber
- );
-
- EfiLibDeleteVariable (DriverString, &gEfiGlobalVariableGuid);
- Index2++;
-
- RemoveEntryList (&NewMenuEntry->Link);
- BOpt_DestroyMenuEntry (NewMenuEntry);
- NewMenuEntry = NULL;
- }
-
- DriverOptionMenu.MenuNumber -= Index2;
-
- Status = Var_ChangeDriverOrder ();
- return Status;
-}
-
-EFI_STATUS
-Var_ChangeDriverOrder (
- VOID
- )
-/*++
-
-Routine Description:
- After any operation on Driver####, there will be a discrepancy in
- DriverOrder. Since some are missing but in DriverOrder, while some
- are present but are not reflected by DriverOrder. Then a function
- rebuild DriverOrder from scratch by content from DriverOptionMenu is
- needed.
-
-Arguments:
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- EFI_STATUS Status;
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 *DriverOrderList;
- UINT16 *DriverOrderListPtr;
- UINTN DriverOrderListSize;
- UINTN Index;
-
- DriverOrderList = NULL;
- DriverOrderListSize = 0;
-
- //
- // First check whether DriverOrder is present in current configuration
- //
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
-
- //
- // If exists, delete it to hold new DriverOrder
- //
- if (DriverOrderList) {
- EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
- SafeFreePool (DriverOrderList);
- DriverOrderList = NULL;
- }
-
- DriverOrderListSize = DriverOptionMenu.MenuNumber;
-
- if (DriverOrderListSize > 0) {
- DriverOrderList = AllocateZeroPool (DriverOrderListSize * sizeof (UINT16));
- ASSERT (DriverOrderList != NULL);
- DriverOrderListPtr = DriverOrderList;
-
- //
- // Get all current used Driver#### from DriverOptionMenu.
- // OptionNumber in each BM_LOAD_OPTION is really its
- // #### value.
- //
- for (Index = 0; Index < DriverOrderListSize; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
- *DriverOrderList = (UINT16) NewMenuEntry->OptionNumber;
- DriverOrderList++;
- }
-
- DriverOrderList = DriverOrderListPtr;
-
- //
- // After building the DriverOrderList, write it back
- //
- Status = gRT->SetVariable (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- DriverOrderListSize * sizeof (UINT16),
- DriverOrderList
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- return EFI_SUCCESS;
-}
-
-VOID
-Var_UpdateAllConsoleOption (
- VOID
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *OutDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *InpDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *ErrDevicePath;
- EFI_STATUS Status;
-
- OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);
- InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);
- ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);
- if (OutDevicePath) {
- ChangeVariableDevicePath (OutDevicePath);
- Status = gRT->SetVariable (
- L"ConOut",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- GetDevicePathSize (OutDevicePath),
- OutDevicePath
- );
- ASSERT (!EFI_ERROR (Status));
- }
-
- if (InpDevicePath) {
- ChangeVariableDevicePath (InpDevicePath);
- Status = gRT->SetVariable (
- L"ConIn",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- GetDevicePathSize (InpDevicePath),
- InpDevicePath
- );
- ASSERT (!EFI_ERROR (Status));
- }
-
- if (ErrDevicePath) {
- ChangeVariableDevicePath (ErrDevicePath);
- Status = gRT->SetVariable (
- L"ErrOut",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- GetDevicePathSize (ErrDevicePath),
- ErrDevicePath
- );
- ASSERT (!EFI_ERROR (Status));
- }
-}
-
-EFI_STATUS
-Var_UpdateConsoleOption (
- IN UINT16 *ConsoleName,
- IN BM_MENU_OPTION *ConsoleMenu,
- IN UINT16 UpdatePageId
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *ConDevicePath;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- EFI_STATUS Status;
- VENDOR_DEVICE_PATH Vendor;
- EFI_DEVICE_PATH_PROTOCOL *TerminalDevicePath;
- UINTN Index;
- UINT16 *Temp;
-
- ConDevicePath = EfiLibGetVariable (ConsoleName, &gEfiGlobalVariableGuid);
- if (ConDevicePath != NULL) {
- EfiLibDeleteVariable (ConsoleName, &gEfiGlobalVariableGuid);
- SafeFreePool (ConDevicePath);
- ConDevicePath = NULL;
- };
-
- //
- // First add all console input device to it from console input menu
- //
- for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- if (NewConsoleContext->IsActive) {
- ConDevicePath = AppendDevicePathInstance (
- ConDevicePath,
- NewConsoleContext->DevicePath
- );
- }
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- if ((NewTerminalContext->IsConIn && (UpdatePageId == FORM_CON_IN_ID)) ||
- (NewTerminalContext->IsConOut && (UpdatePageId == FORM_CON_OUT_ID)) ||
- (NewTerminalContext->IsStdErr && (UpdatePageId == FORM_CON_ERR_ID))
- ) {
- Vendor.Header.Type = MESSAGING_DEVICE_PATH;
- Vendor.Header.SubType = MSG_VENDOR_DP;
- CopyMem (
- &Vendor.Guid,
- &Guid[NewTerminalContext->TerminalType],
- sizeof (EFI_GUID)
- );
- SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));
- TerminalDevicePath = AppendDevicePathNode (
- NewTerminalContext->DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Vendor
- );
- ChangeTerminalDevicePath (TerminalDevicePath, TRUE);
- Temp = DevicePathToStr (TerminalDevicePath);
- ConDevicePath = AppendDevicePathInstance (
- ConDevicePath,
- TerminalDevicePath
- );
- }
- }
-
- if (ConDevicePath) {
- Status = gRT->SetVariable (
- ConsoleName,
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- GetDevicePathSize (ConDevicePath),
- ConDevicePath
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-Var_UpdateConsoleInpOption (
- VOID
- )
-{
- return Var_UpdateConsoleOption (L"ConIn", &ConsoleInpMenu, FORM_CON_IN_ID);
-}
-
-EFI_STATUS
-Var_UpdateConsoleOutOption (
- VOID
- )
-{
- return Var_UpdateConsoleOption (L"ConOut", &ConsoleOutMenu, FORM_CON_OUT_ID);
-}
-
-EFI_STATUS
-Var_UpdateErrorOutOption (
- VOID
- )
-{
- return Var_UpdateConsoleOption (L"ErrOut", &ConsoleErrMenu, FORM_CON_ERR_ID);
-}
-
-EFI_STATUS
-Var_UpdateDriverOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN UINT16 *DescriptionData,
- IN UINT16 *OptionalData,
- IN UINT8 ForceReconnect
- )
-{
- UINT16 Index;
- UINT16 *DriverOrderList;
- UINT16 *NewDriverOrderList;
- UINT16 DriverString[12];
- UINTN DriverOrderListSize;
- VOID *Buffer;
- UINTN BufferSize;
- UINT8 *Ptr;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- BOOLEAN OptionalDataExist;
- EFI_STATUS Status;
-
- OptionalDataExist = FALSE;
-
- Index = BOpt_GetDriverOptionNumber ();
- UnicodeSPrint (
- DriverString,
- sizeof (DriverString),
- L"Driver%04x",
- Index
- );
-
- if (*DescriptionData == 0x0000) {
- StrCpy (DescriptionData, DriverString);
- }
-
- BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (DescriptionData) + GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- if (*OptionalData != 0x0000) {
- OptionalDataExist = TRUE;
- BufferSize += StrSize (OptionalData);
- }
-
- Buffer = AllocateZeroPool (BufferSize);
- if (NULL == Buffer) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->LoadOptionSize = BufferSize;
- Ptr = (UINT8 *) Buffer;
- NewLoadContext->LoadOption = Ptr;
- *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE | (ForceReconnect << 1);
- NewLoadContext->Attributes = *((UINT32 *) Ptr);
- NewLoadContext->IsActive = TRUE;
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- Ptr += sizeof (UINT32);
- *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
- NewLoadContext->FilePathListLength = *((UINT16 *) Ptr);
-
- Ptr += sizeof (UINT16);
- CopyMem (
- Ptr,
- DescriptionData,
- StrSize (DescriptionData)
- );
-
- NewLoadContext->Description = AllocateZeroPool (StrSize (DescriptionData));
- ASSERT (NewLoadContext->Description != NULL);
- NewMenuEntry->DisplayString = NewLoadContext->Description;
- CopyMem (
- NewLoadContext->Description,
- (VOID *) Ptr,
- StrSize (DescriptionData)
- );
-
- Ptr += StrSize (DescriptionData);
- CopyMem (
- Ptr,
- CallbackData->LoadContext->FilePathList,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));
- ASSERT (NewLoadContext->FilePathList != NULL);
-
- CopyMem (
- NewLoadContext->FilePathList,
- (VOID *) Ptr,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->OptionNumber = Index;
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionStrDepository
- );
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- HiiHandle,
- &NewMenuEntry->DisplayStringToken,
- NewMenuEntry->DisplayString
- );
-
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionHelpStrDepository
- );
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- HiiHandle,
- &NewMenuEntry->HelpStringToken,
- NewMenuEntry->HelpString
- );
-
- if (OptionalDataExist) {
- Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- CopyMem (
- Ptr,
- OptionalData,
- StrSize (OptionalData)
- );
- }
-
- Status = gRT->SetVariable (
- DriverString,
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BufferSize,
- Buffer
- );
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
- NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));
- ASSERT (NewDriverOrderList != NULL);
- CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
- NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;
- if (DriverOrderList != NULL) {
- EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
- }
-
- Status = gRT->SetVariable (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- DriverOrderListSize + sizeof (UINT16),
- NewDriverOrderList
- );
- SafeFreePool (DriverOrderList);
- DriverOrderList = NULL;
- SafeFreePool (NewDriverOrderList);
- NewDriverOrderList = NULL;
- InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
- DriverOptionMenu.MenuNumber++;
-
- *DescriptionData = 0x0000;
- *OptionalData = 0x0000;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Var_UpdateBootOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN FILE_EXPLORER_NV_DATA *NvRamMap
- )
-{
- UINT16 *BootOrderList;
- UINT16 *NewBootOrderList;
- UINTN BootOrderListSize;
- UINT16 BootString[10];
- VOID *Buffer;
- UINTN BufferSize;
- UINT8 *Ptr;
- UINT16 Index;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- BOOLEAN OptionalDataExist;
- EFI_STATUS Status;
-
- OptionalDataExist = FALSE;
-
- Index = BOpt_GetBootOptionNumber ();
- UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", Index);
-
- if (NvRamMap->DescriptionData[0] == 0x0000) {
- StrCpy (NvRamMap->DescriptionData, BootString);
- }
-
- BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (NvRamMap->DescriptionData) + GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- if (NvRamMap->OptionalData[0] != 0x0000) {
- OptionalDataExist = TRUE;
- BufferSize += StrSize (NvRamMap->OptionalData);
- }
-
- Buffer = AllocateZeroPool (BufferSize);
- if (NULL == Buffer) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->LoadOptionSize = BufferSize;
- Ptr = (UINT8 *) Buffer;
- NewLoadContext->LoadOption = Ptr;
- *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE;
- NewLoadContext->Attributes = *((UINT32 *) Ptr);
- NewLoadContext->IsActive = TRUE;
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- Ptr += sizeof (UINT32);
- *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
- NewLoadContext->FilePathListLength = *((UINT16 *) Ptr);
- Ptr += sizeof (UINT16);
-
- CopyMem (
- Ptr,
- NvRamMap->DescriptionData,
- StrSize (NvRamMap->DescriptionData)
- );
-
- NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->DescriptionData));
- ASSERT (NewLoadContext->Description != NULL);
-
- NewMenuEntry->DisplayString = NewLoadContext->Description;
- CopyMem (
- NewLoadContext->Description,
- (VOID *) Ptr,
- StrSize (NvRamMap->DescriptionData)
- );
-
- Ptr += StrSize (NvRamMap->DescriptionData);
- CopyMem (
- Ptr,
- CallbackData->LoadContext->FilePathList,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));
- ASSERT (NewLoadContext->FilePathList != NULL);
-
- CopyMem (
- NewLoadContext->FilePathList,
- (VOID *) Ptr,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->OptionNumber = Index;
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionStrDepository
- );
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- CallbackData->FeHiiHandle,
- &NewMenuEntry->DisplayStringToken,
- NewMenuEntry->DisplayString
- );
-
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionHelpStrDepository
- );
-
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- CallbackData->FeHiiHandle,
- &NewMenuEntry->HelpStringToken,
- NewMenuEntry->HelpString
- );
-
- if (OptionalDataExist) {
- Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- CopyMem (Ptr, NvRamMap->OptionalData, StrSize (NvRamMap->OptionalData));
- }
-
- Status = gRT->SetVariable (
- BootString,
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BufferSize,
- Buffer
- );
-
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
-
- NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));
- ASSERT (NewBootOrderList != NULL);
- CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);
- NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;
-
- if (BootOrderList != NULL) {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- }
-
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BootOrderListSize + sizeof (UINT16),
- NewBootOrderList
- );
-
- SafeFreePool (BootOrderList);
- BootOrderList = NULL;
- SafeFreePool (NewBootOrderList);
- NewBootOrderList = NULL;
- InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
- BootOptionMenu.MenuNumber++;
-
- NvRamMap->DescriptionData[0] = 0x0000;
- NvRamMap->OptionalData[0] = 0x0000;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Var_UpdateBootNext (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- BMM_FAKE_NV_DATA *CurrentFakeNVMap;
- UINT16 Index;
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
- CurrentFakeNVMap = CallbackData->BmmFakeNvData;
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->IsBootNext = FALSE;
- }
-
- if (CurrentFakeNVMap->BootNext == BootOptionMenu.MenuNumber) {
- EfiLibDeleteVariable (L"BootNext", &gEfiGlobalVariableGuid);
- return EFI_SUCCESS;
- }
-
- NewMenuEntry = BOpt_GetMenuEntry (
- &BootOptionMenu,
- CurrentFakeNVMap->BootNext
- );
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- Status = gRT->SetVariable (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- sizeof (UINT16),
- &NewMenuEntry->OptionNumber
- );
- NewLoadContext->IsBootNext = TRUE;
- CallbackData->BmmOldFakeNVData.BootNext = CurrentFakeNVMap->BootNext;
- return Status;
-}
-
-EFI_STATUS
-Var_UpdateBootOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- EFI_STATUS Status;
- UINT16 Index;
- UINT16 *BootOrderList;
- UINT16 *NewBootOrderList;
- UINTN BootOrderListSize;
- UINT8 *Map;
-
- BootOrderList = NULL;
- BootOrderListSize = 0;
-
- //
- // First check whether BootOrder is present in current configuration
- //
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
-
- NewBootOrderList = AllocateZeroPool (BootOrderListSize);
- if (!NewBootOrderList) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Map = AllocateZeroPool (BootOrderListSize / sizeof (UINT16));
- if (!Map) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // If exists, delete it to hold new BootOrder
- //
- if (BootOrderList) {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- }
-
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewBootOrderList[Index] = CallbackData->BmmFakeNvData->OptionOrder[Index] - 1;
- }
-
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BootOrderListSize,
- NewBootOrderList
- );
- SafeFreePool (BootOrderList);
- SafeFreePool (NewBootOrderList);
- SafeFreePool (Map);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BOpt_FreeMenu (&BootOptionMenu);
- BOpt_GetBootOptions (CallbackData);
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-Var_UpdateDriverOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- EFI_STATUS Status;
- UINT16 Index;
- UINT16 *DriverOrderList;
- UINT16 *NewDriverOrderList;
- UINTN DriverOrderListSize;
-
- DriverOrderList = NULL;
- DriverOrderListSize = 0;
-
- //
- // First check whether DriverOrder is present in current configuration
- //
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
-
- NewDriverOrderList = AllocateZeroPool (DriverOrderListSize);
-
- if (!NewDriverOrderList) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // If exists, delete it to hold new DriverOrder
- //
- if (DriverOrderList) {
- EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
- }
-
- for (Index = 0; Index < DriverOrderListSize; Index++) {
- NewDriverOrderList[Index] = CallbackData->BmmFakeNvData->OptionOrder[Index] - 1;
- }
-
- Status = gRT->SetVariable (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- DriverOrderListSize,
- NewDriverOrderList
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- SafeFreePool (DriverOrderList);
-
- BOpt_FreeMenu (&DriverOptionMenu);
- BOpt_GetDriverOptions (CallbackData);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Var_UpdateBBSOption (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINTN Index;
- UINTN Index2;
- VOID *BootOptionVar;
- CHAR16 VarName[100];
- UINTN OptionSize;
- UINT16 FilePathSize;
- UINT8 *Ptr;
- EFI_STATUS Status;
- CHAR16 DescString[100];
- UINTN NewOptionSize;
- UINT8 *NewOptionPtr;
- UINT8 *TempPtr;
- UINT32 *Attribute;
-
- BM_MENU_OPTION *OptionMenu;
- BM_LEGACY_DEVICE_CONTEXT *LegacyDeviceContext;
- UINT8 *LegacyDev;
- UINT8 *VarData;
- UINTN VarSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LEGACY_DEV_ORDER_CONTEXT *DevOrder;
- UINT8 *OriginalPtr;
- UINT8 *DisMap;
- UINTN Pos;
- UINTN Bit;
- UINT16 *NewOrder;
- UINT16 Tmp;
-
- LegacyDeviceContext = NULL;
- DisMap = NULL;
- NewOrder = NULL;
-
- if (FORM_SET_FD_ORDER_ID == CallbackData->BmmPreviousPageId) {
- OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu;
- LegacyDev = CallbackData->BmmFakeNvData->LegacyFD;
- CallbackData->BbsType = BBS_FLOPPY;
- } else {
- if (FORM_SET_HD_ORDER_ID == CallbackData->BmmPreviousPageId) {
- OptionMenu = (BM_MENU_OPTION *) &LegacyHDMenu;
- LegacyDev = CallbackData->BmmFakeNvData->LegacyHD;
- CallbackData->BbsType = BBS_HARDDISK;
- } else {
- if (FORM_SET_CD_ORDER_ID == CallbackData->BmmPreviousPageId) {
- OptionMenu = (BM_MENU_OPTION *) &LegacyCDMenu;
- LegacyDev = CallbackData->BmmFakeNvData->LegacyCD;
- CallbackData->BbsType = BBS_CDROM;
- } else {
- if (FORM_SET_NET_ORDER_ID == CallbackData->BmmPreviousPageId) {
- OptionMenu = (BM_MENU_OPTION *) &LegacyNETMenu;
- LegacyDev = CallbackData->BmmFakeNvData->LegacyNET;
- CallbackData->BbsType = BBS_EMBED_NETWORK;
- } else {
- OptionMenu = (BM_MENU_OPTION *) &LegacyBEVMenu;
- LegacyDev = CallbackData->BmmFakeNvData->LegacyBEV;
- CallbackData->BbsType = BBS_BEV_DEVICE;
- }
- }
- }
- }
-
- DisMap = CallbackData->BmmOldFakeNVData.DisableMap;
- Status = EFI_SUCCESS;
-
- //
- // Find the first device's context
- // If all devices are disabled( 0xFF == LegacyDev[0]), LegacyDeviceContext can be set to any VariableContext
- // because we just use it to fill the desc string, and user can not see the string in UI
- //
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
- LegacyDeviceContext = (BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext;
- if (0xFF != LegacyDev[0] && LegacyDev[0] == LegacyDeviceContext->Index) {
- DEBUG ((EFI_D_ERROR, "DescStr: %s\n", LegacyDeviceContext->Description));
- break;
- }
- }
- //
- // Update the Variable "LegacyDevOrder"
- //
- VarData = (UINT8 *) BdsLibGetVariableAndSize (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- &VarSize
- );
-
- if (NULL == VarData) {
- return EFI_NOT_FOUND;
- }
-
- OriginalPtr = VarData;
- DevOrder = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;
-
- while (VarData < VarData + VarSize) {
- if (DevOrder->BbsType == CallbackData->BbsType) {
- break;
- }
-
- VarData += sizeof (BBS_TYPE);
- VarData += *(UINT16 *) VarData;
- DevOrder = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;
- }
-
- if (VarData >= VarData + VarSize) {
- SafeFreePool (OriginalPtr);
- return EFI_NOT_FOUND;
- }
-
- NewOrder = (UINT16 *) AllocateZeroPool (DevOrder->Length - sizeof (UINT16));
- if (NULL == NewOrder) {
- SafeFreePool (VarData);
- return EFI_OUT_OF_RESOURCES;
- }
-
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- if (0xFF == LegacyDev[Index]) {
- break;
- }
-
- NewOrder[Index] = LegacyDev[Index];
- }
- //
- // Only the enable/disable state of each boot device with same device type can be changed,
- // so we can count on the index information in DevOrder.
- // DisMap bit array is the only reliable source to check a device's en/dis state,
- // so we use DisMap to set en/dis state of each item in NewOrder array
- //
- for (Index2 = 0; Index2 < OptionMenu->MenuNumber; Index2++) {
- Tmp = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index2 * sizeof (UINT16));
- Tmp &= 0xFF;
- Pos = Tmp / 8;
- Bit = 7 - (Tmp % 8);
- if (DisMap[Pos] & (1 << Bit)) {
- NewOrder[Index] = (UINT16) (0xFF00 | Tmp);
- Index++;
- }
- }
-
- CopyMem (
- (UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16),
- NewOrder,
- DevOrder->Length - sizeof (UINT16)
- );
- SafeFreePool (NewOrder);
-
- Status = gRT->SetVariable (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- VAR_FLAG,
- VarSize,
- OriginalPtr
- );
-
- SafeFreePool (OriginalPtr);
-
- //
- // Update Optional Data of Boot####
- //
- BootOptionVar = GetLegacyBootOptionVar (CallbackData->BbsType, &Index, &OptionSize);
-
- if (NULL != BootOptionVar) {
- CopyMem (
- DescString,
- LegacyDeviceContext->Description,
- StrSize (LegacyDeviceContext->Description)
- );
-
- NewOptionSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (DescString) + sizeof (BBS_TABLE) + sizeof (UINT16);
-
- UnicodeSPrint (VarName, 100, L"Boot%04x", Index);
-
- Ptr = BootOptionVar;
-
- Attribute = (UINT32 *) Ptr;
- *Attribute |= LOAD_OPTION_ACTIVE;
- if (0xFF == LegacyDev[0]) {
- //
- // Disable this legacy boot option
- //
- *Attribute &= ~LOAD_OPTION_ACTIVE;
- }
-
- Ptr += sizeof (UINT32);
-
- FilePathSize = *(UINT16 *) Ptr;
- Ptr += sizeof (UINT16);
-
- NewOptionSize += FilePathSize;
-
- NewOptionPtr = AllocateZeroPool (NewOptionSize);
- if (NULL == NewOptionPtr) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- TempPtr = NewOptionPtr;
-
- //
- // Copy previous option data to new option except the description string
- //
- CopyMem (
- TempPtr,
- BootOptionVar,
- sizeof (UINT32) + sizeof (UINT16)
- );
-
- TempPtr += (sizeof (UINT32) + sizeof (UINT16));
-
- CopyMem (
- TempPtr,
- DescString,
- StrSize (DescString)
- );
-
- TempPtr += StrSize (DescString);
-
- //
- // Description = (CHAR16 *)Ptr;
- //
- Ptr += StrSize ((CHAR16 *) Ptr);
-
- CopyMem (
- TempPtr,
- Ptr,
- FilePathSize
- );
-
- TempPtr += FilePathSize;
-
- //
- // DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)Ptr;
- //
- Ptr += FilePathSize;
-
- //
- // Now Ptr point to optional data, i.e. Bbs Table
- //
- CopyMem (
- TempPtr,
- LegacyDeviceContext->BbsTable,
- sizeof (BBS_TABLE)
- );
-
- TempPtr += sizeof (BBS_TABLE);
- *((UINT16 *) TempPtr) = (UINT16) LegacyDeviceContext->Index;
-
- Status = gRT->SetVariable (
- VarName,
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- NewOptionSize,
- NewOptionPtr
- );
-
- SafeFreePool (NewOptionPtr);
- SafeFreePool (BootOptionVar);
- }
-
- BOpt_GetBootOptions (CallbackData);
- return Status;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.c
deleted file mode 100644
index 4cdad1c..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootManager.c
-
-Abstract:
-
- The platform boot manager reference implement
-
---*/
-#include "BootManager.h"
-
-UINT16 mKeyInput;
-LIST_ENTRY *mBootOptionsList;
-BDS_COMMON_OPTION *gOption;
-EFI_HII_HANDLE gBootManagerHandle;
-EFI_HANDLE BootManagerCallbackHandle;
-EFI_FORM_CALLBACK_PROTOCOL BootManagerCallback;
-EFI_GUID gBmGuid = BOOT_MANAGER_GUID;
-
-extern EFI_FORM_BROWSER_PROTOCOL *gBrowser;
-extern UINT8 BootManagerVfrBin[];
-extern UINT8 EdkGenericPlatformBdsLibStrings[];
-extern BOOLEAN gConnectAllHappened;
-
-EFI_STATUS
-EFIAPI
-BootManagerCallbackRoutine (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *DataArray,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-
-Routine Description:
-
- This is the function that is called to provide results data to the driver. This data
- consists of a unique key which is used to identify what data is either being passed back
- or being asked for.
-
-Arguments:
-
- KeyValue - A unique value which is sent to the original exporting driver so that it
- can identify the type of data to expect. The format of the data tends to
- vary based on the op-code that geerated the callback.
-
- Data - A pointer to the data being sent to the original exporting driver.
-
-Returns:
-
---*/
-{
- BDS_COMMON_OPTION *Option;
- LIST_ENTRY *Link;
- UINT16 KeyCount;
- EFI_HII_CALLBACK_PACKET *DataPacket;
-
- //
- // Initialize the key count
- //
- KeyCount = 0;
-
- for (Link = mBootOptionsList->ForwardLink; Link != mBootOptionsList; Link = Link->ForwardLink) {
- Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
-
- KeyCount++;
-
- gOption = Option;
-
- //
- // Is this device the one chosen?
- //
- if (KeyCount == KeyValue) {
- //
- // Assigning the returned Key to a global allows the original routine to know what was chosen
- //
- mKeyInput = KeyValue;
-
- *Packet = AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + 2);
- ASSERT (*Packet != NULL);
-
- //
- // Assign the buffer address to DataPacket
- //
- DataPacket = *Packet;
-
- DataPacket->DataArray.EntryCount = 1;
- DataPacket->DataArray.NvRamMap = NULL;
- ((EFI_IFR_DATA_ENTRY *) (((EFI_IFR_DATA_ARRAY *)DataPacket) + 1))->Flags = EXIT_REQUIRED | NV_NOT_CHANGED;
- return EFI_SUCCESS;
- } else {
- continue;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-CallBootManager (
- VOID
- )
-/*++
-
-Routine Description:
- Hook to enable UI timeout override behavior.
-
-Arguments:
- BdsDeviceList - Device List that BDS needs to connect.
-
- Entry - Pointer to current Boot Entry.
-
-Returns:
- NONE
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGES *PackageList;
- BDS_COMMON_OPTION *Option;
- LIST_ENTRY *Link;
- EFI_HII_UPDATE_DATA *UpdateData;
- CHAR16 *ExitData;
- UINTN ExitDataSize;
- STRING_REF Token;
- STRING_REF LastToken;
- EFI_INPUT_KEY Key;
- UINT8 *Location;
- EFI_GUID BmGuid;
- LIST_ENTRY BdsBootOptionList;
- BOOLEAN BootMngrMenuResetRequired;
-
- gOption = NULL;
- InitializeListHead (&BdsBootOptionList);
-
- //
- // Connect all prior to entering the platform setup menu.
- //
- if (!gConnectAllHappened) {
- BdsLibConnectAllDriversToAllControllers ();
- gConnectAllHappened = TRUE;
- }
- //
- // BugBug: Here we can not remove the legacy refresh macro, so we need
- // get the boot order every time from "BootOrder" variable.
- // Recreate the boot option list base on the BootOrder variable
- //
- BdsLibEnumerateAllBootOption (&BdsBootOptionList);
-
- //
- // This GUID must be the same as what is defined in BootManagerVfr.vfr
- //
- BmGuid = gBmGuid;
-
- mBootOptionsList = &BdsBootOptionList;
-
- //
- // Post our VFR to the HII database
- //
- PackageList = PreparePackages (2, &BmGuid, BootManagerVfrBin, EdkGenericPlatformBdsLibStrings);
- Status = Hii->NewPack (Hii, PackageList, &gBootManagerHandle);
- gBS->FreePool (PackageList);
-
- //
- // This example does not implement worker functions
- // for the NV accessor functions. Only a callback evaluator
- //
- BootManagerCallback.NvRead = NULL;
- BootManagerCallback.NvWrite = NULL;
- BootManagerCallback.Callback = BootManagerCallbackRoutine;
-
- //
- // Install protocol interface
- //
- BootManagerCallbackHandle = NULL;
- Status = gBS->InstallProtocolInterface (
- &BootManagerCallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &BootManagerCallback
- );
- ASSERT_EFI_ERROR (Status);
-
- LastToken = 0;
- Hii->NewString (Hii, NULL, gBootManagerHandle, &LastToken, L" ");
-
- //
- // Allocate space for creation of UpdateData Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- //
- // Flag update pending in FormSet
- //
- UpdateData->FormSetUpdate = TRUE;
- //
- // Register CallbackHandle data for FormSet
- //
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) BootManagerCallbackHandle;
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = 0;
- UpdateData->DataCount = 1;
-
- //
- // Create blank space. Since when we update the contents of IFR data at a label, it is
- // inserted at the location of the label. So if you want to add a string with an empty
- // space afterwards, you need to add the space first and then the string like below.
- //
- Status = CreateSubTitleOpCode (
- LastToken, // Token Value for the string
- &UpdateData->Data // Buffer containing created op-code
- );
-
- Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);
-
- //
- // Create "Boot Option Menu" title
- //
- Status = CreateSubTitleOpCode (
- STRING_TOKEN (STR_BOOT_OPTION_BANNER), // Token Value for the string
- &UpdateData->Data // Buffer containing created op-code
- );
-
- Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);
-
- Token = LastToken;
- mKeyInput = 0;
-
- UpdateData->DataCount = 0;
- Location = (UINT8 *) &UpdateData->Data;
-
- for (Link = BdsBootOptionList.ForwardLink; Link != &BdsBootOptionList; Link = Link->ForwardLink) {
- Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
-
- //
- // At this stage we are creating a menu entry, thus the Keys are reproduceable
- //
- mKeyInput++;
- Token++;
-
- Status = Hii->NewString (Hii, NULL, gBootManagerHandle, &Token, Option->Description);
-
- //
- // If we got an error it is almost certainly due to the token value being invalid.
- // Therefore we will set the Token to 0 to automatically add a token.
- //
- if (EFI_ERROR (Status)) {
- Token = 0;
- Status = Hii->NewString (Hii, NULL, gBootManagerHandle, &Token, Option->Description);
- }
-
- Status = CreateGotoOpCode (
- 0x1000, // Form ID
- Token, // Token Value for the string
- 0, // Help String (none)
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS, // The Op-Code flags
- mKeyInput, // The Key to get a callback on
- Location // Buffer containing created op-code
- );
-
- UpdateData->DataCount++;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- }
-
- Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0001, TRUE, UpdateData);
-
- UpdateData->DataCount = 1;
-
- //
- // Create "Boot Option Menu" title
- //
- Status = CreateSubTitleOpCode (
- STRING_TOKEN (STR_HELP_FOOTER), // Token Value for the string
- &UpdateData->Data // Buffer containing created op-code
- );
-
- Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);
-
- Status = CreateSubTitleOpCode (
- LastToken, // Token Value for the string
- &UpdateData->Data // Buffer containing created op-code
- );
-
- Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);
-
- gBS->FreePool (UpdateData);
-
- ASSERT (gBrowser);
-
- BootMngrMenuResetRequired = FALSE;
- gBrowser->SendForm (
- gBrowser,
- TRUE,
- &gBootManagerHandle,
- 1,
- NULL,
- NULL,
- NULL,
- NULL,
- &BootMngrMenuResetRequired
- );
-
- if (BootMngrMenuResetRequired) {
- EnableResetRequired ();
- }
-
- Hii->ResetStrings (Hii, gBootManagerHandle);
-
- if (gOption == NULL) {
- return ;
- }
-
- //
- //Will leave browser, check any reset required change is applied? if yes, reset system
- //
- SetupResetReminder ();
-
- //
- // BugBug: This code looks repeated from the BDS. Need to save code space.
- //
-
- //
- // parse the selected option
- //
- Status = BdsLibBootViaBootOption (gOption, gOption->DevicePath, &ExitDataSize, &ExitData);
-
- if (!EFI_ERROR (Status)) {
- PlatformBdsBootSuccess (gOption);
- } else {
- PlatformBdsBootFail (gOption, Status, ExitData, ExitDataSize);
- gST->ConOut->OutputString (
- gST->ConOut,
- GetStringById (STRING_TOKEN (STR_ANY_KEY_CONTINUE))
- );
-
- //
- // BdsLibUiWaitForSingleEvent (gST->ConIn->WaitForKey, 0);
- //
-
- gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- }
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.h
deleted file mode 100644
index f9b6bba..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootManager.h
-
-Abstract:
-
- The platform boot manager reference implement
-
-Revision History
-
---*/
-
-#ifndef _EFI_BOOT_MANAGER_H
-#define _EFI_BOOT_MANAGER_H
-
-#include "Bds.h"
-//#include "EdkGenericPlatformBdsLib.h"
-#include "String.h"
-
-EFI_STATUS
-EFIAPI
-BootManagerCallbackRoutine (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *DataArray,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- );
-
-VOID
-CallBootManager (
- VOID
-);
-
-#define BOOT_MANAGER_GUID \
- { \
- 0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b } \
- }
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerStrings.uni b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerStrings.uni
deleted file mode 100644
index 684ac2f..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerStrings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerVfr.Vfr b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerVfr.Vfr
deleted file mode 100644
index 9daf7b8..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerVfr.Vfr
+++ /dev/null
@@ -1,55 +0,0 @@
-// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// BootManager.vfr
-//
-// Abstract:
-//
-// Browser formset.
-//
-// Revision History:
-//
-// --*/
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-
-#define FORMSET_GUID { 0x847bc3fe, 0xb974, 0x446d, { 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b } }
-
-#define BOOT_MANAGER_HEADER 0x00
-#define BOOT_MANAGER_LABEL 0x01
-#define BOOT_MANAGER_TAIL 0x02
-
-
-#define BOOT_MANAGER_CLASS 0x00
-#define BOOT_MANAGER_SUBCLASS 0x01
-
-formset
- guid = FORMSET_GUID,
- title = STRING_TOKEN(STR_BM_BANNER),
- help = STRING_TOKEN(STR_LAST_STRING),
- class = BOOT_MANAGER_CLASS,
- subclass = BOOT_MANAGER_SUBCLASS,
-
- form formid = 0x1000,
- title = STRING_TOKEN(STR_BM_BANNER);
-
- label BOOT_MANAGER_HEADER;
- label BOOT_MANAGER_LABEL;
- //
- // This is where we will dynamically add choices for the Boot Manager
- //
-
- label BOOT_MANAGER_TAIL;
- endform;
-
-endformset;
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Capsules.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Capsules.c
deleted file mode 100644
index 23b83a3..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Capsules.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Capsules.c
-
-Abstract:
-
- BDS routines to handle capsules.
-
---*/
-
-
-#include <Common/FlashMap.h>
-
-VOID
-BdsLockFv (
- IN EFI_CPU_IO_PROTOCOL *CpuIo,
- IN EFI_FLASH_SUBAREA_ENTRY *FlashEntry
- );
-
-VOID
-BdsLockFv (
- IN EFI_CPU_IO_PROTOCOL *CpuIo,
- IN EFI_FLASH_SUBAREA_ENTRY *FlashEntry
- )
-{
- EFI_FV_BLOCK_MAP_ENTRY *BlockMap;
- EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
- UINT64 BaseAddress;
- UINT8 Data;
- UINT32 BlockLength;
- UINTN Index;
-
- BaseAddress = FlashEntry->Base - 0x400000 + 2;
- FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) (FlashEntry->Base));
- BlockMap = &(FvHeader->FvBlockMap[0]);
-
- while ((BlockMap->NumBlocks != 0) && (BlockMap->BlockLength != 0)) {
- BlockLength = BlockMap->BlockLength;
- for (Index = 0; Index < BlockMap->NumBlocks; Index++) {
- CpuIo->Mem.Read (
- CpuIo,
- EfiCpuIoWidthUint8,
- BaseAddress,
- 1,
- &Data
- );
- Data = (UINT8) (Data | 0x3);
- CpuIo->Mem.Write (
- CpuIo,
- EfiCpuIoWidthUint8,
- BaseAddress,
- 1,
- &Data
- );
- BaseAddress += BlockLength;
- }
-
- BlockMap++;
- }
-}
-
-VOID
-BdsLockNonUpdatableFlash (
- VOID
- )
-{
- EFI_FLASH_MAP_ENTRY_DATA *FlashMapEntryData;
- EFI_PEI_HOB_POINTERS GuidHob;
- EFI_STATUS Status;
- EFI_CPU_IO_PROTOCOL *CpuIo;
-
- Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID**)&CpuIo);
- ASSERT_EFI_ERROR (Status);
-
- GuidHob.Raw = GetHobList ();
- while ((GuidHob.Raw = GetNextGuidHob (&gEfiFlashMapHobGuid, GuidHob.Raw)) != NULL) {
- FlashMapEntryData = (EFI_FLASH_MAP_ENTRY_DATA *) GET_GUID_HOB_DATA (GuidHob.Guid);
-
- //
- // Get the variable store area
- //
- if ((FlashMapEntryData->AreaType == EFI_FLASH_AREA_RECOVERY_BIOS) ||
- (FlashMapEntryData->AreaType == EFI_FLASH_AREA_MAIN_BIOS)
- ) {
- BdsLockFv (CpuIo, &(FlashMapEntryData->Entries[0]));
- }
- GuidHob.Raw = GET_NEXT_HOB (GuidHob);
- }
-
- return ;
-}
-
-EFI_STATUS
-ProcessCapsules (
- EFI_BOOT_MODE BootMode
- )
-/*++
-
-Routine Description:
-
- This routine is called to see if there are any capsules we need to process.
- If the boot mode is not UPDATE, then we do nothing. Otherwise find the
- capsule HOBS and produce firmware volumes for them via the DXE service.
- Then call the dispatcher to dispatch drivers from them. Finally, check
- the status of the updates.
-
-Arguments:
-
- BootMode - the current boot mode
-
-Returns:
-
- EFI_INVALID_PARAMETER - boot mode is not correct for an update
-
-Note:
-
- This function should be called by BDS in case we need to do some
- sort of processing even if there is no capsule to process. We
- need to do this if an earlier update went awry and we need to
- clear the capsule variable so on the next reset PEI does not see it and
- think there is a capsule available.
-
---*/
-{
- EFI_STATUS Status;
- EFI_HOB_CAPSULE_VOLUME *CvHob;
- EFI_PHYSICAL_ADDRESS BaseAddress;
- UINT64 Length;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- EFI_HANDLE FvProtocolHandle;
-
- //
- // We don't do anything else if the boot mode is not flash-update
- //
- if (BootMode != BOOT_ON_FLASH_UPDATE) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Only one capsule HOB allowed.
- //
- CvHob = GetFirstHob (EFI_HOB_TYPE_CV);
- if (CvHob == NULL) {
- //
- // We didn't find a hob, so had no errors.
- //
- BdsLockNonUpdatableFlash ();
- return EFI_SUCCESS;
- }
-
- BaseAddress = CvHob->BaseAddress;
- Length = CvHob->Length;
-
- Status = EFI_SUCCESS;
- //
- // Now walk the capsule and call the core to process each
- // firmware volume in it.
- //
- while (Length != 0) {
- //
- // Point to the next firmware volume header, and then
- // call the DXE service to process it.
- //
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
- if (FwVolHeader->FvLength > Length) {
- //
- // Notes: need to stuff this status somewhere so that the
- // error can be detected at OS runtime
- //
- Status = EFI_VOLUME_CORRUPTED;
- break;
- }
-
- Status = gDS->ProcessFirmwareVolume (
- (VOID *) (UINTN) BaseAddress,
- (UINTN) FwVolHeader->FvLength,
- &FvProtocolHandle
- );
- if (EFI_ERROR (Status)) {
- break;
- }
- //
- // Call the dispatcher to dispatch any drivers from the produced firmware volume
- //
- gDS->Dispatch ();
- //
- // On to the next FV in the capsule
- //
- Length -= FwVolHeader->FvLength;
- BaseAddress = (EFI_PHYSICAL_ADDRESS) ((UINTN) BaseAddress + FwVolHeader->FvLength);
- //
- // Notes: when capsule spec is finalized, if the requirement is made to
- // have each FV in a capsule aligned, then we will need to align the
- // BaseAddress and Length here.
- //
- }
-
-
- BdsLockNonUpdatableFlash ();
-
- return Status;
-}
-
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.c
deleted file mode 100644
index 3de404b..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DeviceManager.c
-
-Abstract:
-
- The platform device manager reference implement
-
---*/
-#include "DeviceManager.h"
-
-STATIC UINT16 mTokenCount;
-EFI_FRONTPAGE_CALLBACK_INFO FPCallbackInfo;
-extern UINTN gCallbackKey;
-extern EFI_FORM_BROWSER_PROTOCOL *gBrowser;
-extern EFI_GUID gBdsStringPackGuid;
-extern BOOLEAN gConnectAllHappened;
-
-STRING_REF gStringTokenTable[] = {
- STR_VIDEO_DEVICE,
- STR_NETWORK_DEVICE,
- STR_INPUT_DEVICE,
- STR_ON_BOARD_DEVICE,
- STR_OTHER_DEVICE,
- STR_EMPTY_STRING,
- 0xFFFF
-};
-
-EFI_STATUS
-EFIAPI
-DeviceManagerCallbackRoutine (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *DataArray,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-
-Routine Description:
-
- This is the function that is called to provide results data to the driver. This data
- consists of a unique key which is used to identify what data is either being passed back
- or being asked for.
-
-Arguments:
-
- KeyValue - A unique value which is sent to the original exporting driver so that it
- can identify the type of data to expect. The format of the data tends to
- vary based on the op-code that geerated the callback.
-
- Data - A pointer to the data being sent to the original exporting driver.
-
-Returns:
-
---*/
-{
- //
- // The KeyValue corresponds in this case to the handle which was requested to be displayed
- //
- EFI_FRONTPAGE_CALLBACK_INFO *CallbackInfo;
-
- CallbackInfo = EFI_FP_CALLBACK_DATA_FROM_THIS (This);
- switch (KeyValue) {
- case 0x2000:
- CallbackInfo->Data.VideoBIOS = (UINT8) (UINTN) (((EFI_IFR_DATA_ENTRY *)(DataArray + 1))->Data);
- gRT->SetVariable (
- L"VBIOS",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof (UINT8),
- &CallbackInfo->Data.VideoBIOS
- );
- break;
-
- default:
- break;
- }
-
- gCallbackKey = KeyValue;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InitializeDeviceManager (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initialize HII information for the FrontPage
-
-Arguments:
- None
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGES *PackageList;
- EFI_HII_UPDATE_DATA *UpdateData;
-
- //
- // Allocate space for creation of UpdateData Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- PackageList = PreparePackages (1, &gBdsStringPackGuid, DeviceManagerVfrBin);
- Status = Hii->NewPack (Hii, PackageList, &FPCallbackInfo.DevMgrHiiHandle);
- gBS->FreePool (PackageList);
-
- //
- // This example does not implement worker functions for the NV accessor functions. Only a callback evaluator
- //
- FPCallbackInfo.Signature = EFI_FP_CALLBACK_DATA_SIGNATURE;
- FPCallbackInfo.DevMgrCallback.NvRead = NULL;
- FPCallbackInfo.DevMgrCallback.NvWrite = NULL;
- FPCallbackInfo.DevMgrCallback.Callback = DeviceManagerCallbackRoutine;
-
- //
- // Install protocol interface
- //
- FPCallbackInfo.CallbackHandle = NULL;
-
- Status = gBS->InstallProtocolInterface (
- &FPCallbackInfo.CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &FPCallbackInfo.DevMgrCallback
- );
-
- ASSERT_EFI_ERROR (Status);
-
- //
- // Flag update pending in FormSet
- //
- UpdateData->FormSetUpdate = TRUE;
- //
- // Register CallbackHandle data for FormSet
- //
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) FPCallbackInfo.CallbackHandle;
- //
- // Simply registering the callback handle
- //
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);
-
- gBS->FreePool (UpdateData);
- return Status;
-}
-
-EFI_STATUS
-CallDeviceManager (
- VOID
- )
-/*++
-
-Routine Description:
-
- Call the browser and display the device manager
-
-Arguments:
-
- None
-
-Returns:
- EFI_SUCCESS - Operation is successful.
- EFI_INVALID_PARAMETER - If the inputs to SendForm function is not valid.
-
---*/
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- UINTN Count;
- EFI_HII_HANDLE Index;
- UINT8 *Buffer;
- EFI_IFR_FORM_SET *FormSetData;
- CHAR16 *String;
- UINTN StringLength;
- EFI_HII_UPDATE_DATA *UpdateData;
- STRING_REF Token;
- STRING_REF TokenHelp;
- IFR_OPTION *IfrOptionList;
- UINT8 *VideoOption;
- UINTN VideoOptionSize;
- EFI_HII_HANDLE *HiiHandles;
- UINT16 HandleBufferLength;
- BOOLEAN BootDeviceMngrMenuResetRequired;
-
- IfrOptionList = NULL;
- VideoOption = NULL;
- HiiHandles = NULL;
- HandleBufferLength = 0;
-
- //
- // Connect all prior to entering the platform setup menu.
- //
- if (!gConnectAllHappened) {
- BdsLibConnectAllDriversToAllControllers ();
- gConnectAllHappened = TRUE;
- }
- //
- // Allocate space for creation of UpdateData Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- Status = EFI_SUCCESS;
- Buffer = NULL;
- FormSetData = NULL;
- gCallbackKey = 0;
- if (mTokenCount == 0) {
- Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &mTokenCount, L" ");
- }
-
- Token = mTokenCount;
- TokenHelp = (UINT16) (Token + 1);
-
- //
- // Reset the menu
- //
- for (Index = 0, Count = 1; Count < 0x10000; Count <<= 1, Index++) {
- //
- // We will strip off all previous menu entries
- //
- UpdateData->DataCount = 0xFF;
-
- //
- // Erase entries on this label
- //
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, FALSE, UpdateData);
-
- //
- // Did we reach the end of the Token Table?
- //
- if (gStringTokenTable[Index] == 0xFFFF) {
- break;
- }
-
- CreateSubTitleOpCode (gStringTokenTable[Index], &UpdateData->Data);
- //
- // Add a single menu item - in this case a subtitle for the device type
- //
- UpdateData->DataCount = 1;
-
- //
- // Add default title for this label
- //
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);
- }
- //
- // Add a space and an exit string. Remember since we add things at the label and push other things beyond the
- // label down, we add this in reverse order
- //
- CreateSubTitleOpCode (STRING_TOKEN (STR_EXIT_STRING), &UpdateData->Data);
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);
- CreateSubTitleOpCode (STR_EMPTY_STRING, &UpdateData->Data);
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);
-
- //
- // Get all the Hii handles
- //
- Status = BdsLibGetHiiHandles (Hii, &HandleBufferLength, &HiiHandles);
- ASSERT_EFI_ERROR (Status);
-
- for (Index = 1, BufferSize = 0; Index < HandleBufferLength; Index++) {
- //
- // Am not initializing Buffer since the first thing checked is the size
- // this way I can get the real buffersize in the smallest code size
- //
- Status = Hii->GetForms (Hii, Index, 0, &BufferSize, Buffer);
-
- if (Status != EFI_NOT_FOUND) {
- //
- // BufferSize should have the real size of the forms now
- //
- Buffer = AllocateZeroPool (BufferSize);
- ASSERT (Buffer != NULL);
-
- //
- // Am not initializing Buffer since the first thing checked is the size
- // this way I can get the real buffersize in the smallest code size
- //
- Status = Hii->GetForms (Hii, Index, 0, &BufferSize, Buffer);
-
- //
- // Skip EFI_HII_PACK_HEADER, advance to EFI_IFR_FORM_SET data.
- //
- FormSetData = (EFI_IFR_FORM_SET *) (Buffer + sizeof (EFI_HII_PACK_HEADER));
-
- //
- // If this formset belongs in the device manager, add it to the menu
- //
- if (FormSetData->Class != EFI_NON_DEVICE_CLASS) {
-
- StringLength = 0x1000;
- String = AllocateZeroPool (StringLength);
- ASSERT (String != NULL);
-
- Status = Hii->GetString (Hii, Index, FormSetData->FormSetTitle, TRUE, NULL, &StringLength, String);
- Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &Token, String);
-
- //
- // If token value exceeded real token value - we need to add a new token values
- //
- if (Status == EFI_INVALID_PARAMETER) {
- Token = 0;
- TokenHelp = 0;
- Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &Token, String);
- }
-
- StringLength = 0x1000;
- if (FormSetData->Help == 0) {
- TokenHelp = 0;
- } else {
- Status = Hii->GetString (Hii, Index, FormSetData->Help, TRUE, NULL, &StringLength, String);
- if (StringLength == 0x02) {
- TokenHelp = 0;
- } else {
- Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &TokenHelp, String);
- if (Status == EFI_INVALID_PARAMETER) {
- TokenHelp = 0;
- Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &TokenHelp, String);
- }
- }
- }
-
- gBS->FreePool (String);
-
- CreateGotoOpCode (
- 0x1000, // Device Manager Page
- Token, // Description String Token
- TokenHelp, // Description Help String Token
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS, // Flag designating callback is active
- (UINT16) Index, // Callback key value
- &UpdateData->Data // Buffer to fill with op-code
- );
-
- //
- // In the off-chance that we have lots of extra tokens allocated to the DeviceManager
- // this ensures we are fairly re-using the tokens instead of constantly growing the token
- // storage for this one handle. If we incremented the token value beyond what it normally
- // would use, we will fall back into the error path which seeds the token value with a 0
- // so that we can correctly add a token value.
- //
- if (TokenHelp == 0) {
- //
- // Since we didn't add help, only advance Token by 1
- //
- Token++;
- } else {
- Token = (UINT16) (Token + 2);
- TokenHelp = (UINT16) (TokenHelp + 2);
- }
- //
- // This for loop basically will take the Class value which is a bitmask and
- // update the form for every active bit. There will be a label at each bit
- // location. So if someone had a device which a class of EFI_DISK_DEVICE_CLASS |
- // EFI_ON_BOARD_DEVICE_CLASS, this routine will unwind that mask and drop the menu entry
- // on each corresponding label.
- //
- for (Count = 1; Count < 0x10000; Count <<= 1) {
- //
- // This is an active bit, so update the form
- //
- if (FormSetData->Class & Count) {
- Hii->UpdateForm (
- Hii,
- FPCallbackInfo.DevMgrHiiHandle,
- (EFI_FORM_LABEL) (FormSetData->Class & Count),
- TRUE,
- UpdateData
- );
- }
- }
- }
-
- BufferSize = 0;
- //
- // Reset Buffer pointer to original location
- //
- gBS->FreePool (Buffer);
- }
- }
- //
- // Add oneof for video BIOS selection
- //
- VideoOption = BdsLibGetVariableAndSize (
- L"VBIOS",
- &gEfiGlobalVariableGuid,
- &VideoOptionSize
- );
- if (NULL == VideoOption) {
- FPCallbackInfo.Data.VideoBIOS = 0;
- } else {
- FPCallbackInfo.Data.VideoBIOS = VideoOption[0];
- gBS->FreePool (VideoOption);
- }
-
- ASSERT (FPCallbackInfo.Data.VideoBIOS <= 1);
-
- Status = gBS->AllocatePool (EfiBootServicesData, 2 * sizeof (IFR_OPTION), (VOID**) &IfrOptionList);
- if (IfrOptionList != NULL) {
- IfrOptionList[0].Flags = EFI_IFR_FLAG_INTERACTIVE;
- IfrOptionList[0].Key = SET_VIDEO_BIOS_TYPE_QUESTION_ID + 0x2000;
- IfrOptionList[0].StringToken = STRING_TOKEN (STR_ONE_OF_PCI);
- IfrOptionList[0].Value = 0;
- IfrOptionList[0].OptionString = NULL;
- IfrOptionList[1].Flags = EFI_IFR_FLAG_INTERACTIVE;
- IfrOptionList[1].Key = SET_VIDEO_BIOS_TYPE_QUESTION_ID + 0x2000;
- IfrOptionList[1].StringToken = STRING_TOKEN (STR_ONE_OF_AGP);
- IfrOptionList[1].Value = 1;
- IfrOptionList[1].OptionString = NULL;
- IfrOptionList[FPCallbackInfo.Data.VideoBIOS].Flags |= EFI_IFR_FLAG_DEFAULT;
-
- CreateOneOfOpCode (
- SET_VIDEO_BIOS_TYPE_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_ONE_OF_VBIOS),
- STRING_TOKEN (STR_ONE_OF_VBIOS_HELP),
- IfrOptionList,
- 2,
- &UpdateData->Data
- );
-
- UpdateData->DataCount = 4;
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) EFI_VBIOS_CLASS, TRUE, UpdateData);
- gBS->FreePool (IfrOptionList);
- }
-
- BootDeviceMngrMenuResetRequired = FALSE;
- Status = gBrowser->SendForm (
- gBrowser,
- TRUE, // Use the database
- &FPCallbackInfo.DevMgrHiiHandle, // The HII Handle
- 1,
- NULL,
- FPCallbackInfo.CallbackHandle,
- (UINT8 *) &FPCallbackInfo.Data,
- NULL,
- &BootDeviceMngrMenuResetRequired
- );
-
- if (BootDeviceMngrMenuResetRequired) {
- EnableResetRequired ();
- }
-
- Hii->ResetStrings (Hii, FPCallbackInfo.DevMgrHiiHandle);
-
- //
- // We will have returned from processing a callback - user either hit ESC to exit, or selected
- // a target to display
- //
- if (gCallbackKey != 0 && gCallbackKey < 0x2000) {
- BootDeviceMngrMenuResetRequired = FALSE;
- Status = gBrowser->SendForm (
- gBrowser,
- TRUE, // Use the database
- (EFI_HII_HANDLE *) &gCallbackKey, // The HII Handle
- 1,
- NULL,
- NULL, // This is the handle that the interface to the callback was installed on
- NULL,
- NULL,
- &BootDeviceMngrMenuResetRequired
- );
-
- if (BootDeviceMngrMenuResetRequired) {
- EnableResetRequired ();
- }
- //
- // Force return to Device Manager
- //
- gCallbackKey = 4;
- }
-
- if (gCallbackKey >= 0x2000) {
- gCallbackKey = 4;
- }
-
- gBS->FreePool (UpdateData);
- gBS->FreePool (HiiHandles);
-
- return Status;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.h
deleted file mode 100644
index 54aeb45..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DeviceManager.c
-
-Abstract:
-
- The platform device manager reference implement
-
-Revision History
-
---*/
-
-#ifndef _DEVICE_MANAGER_H
-#define _DEVICE_MANAGER_H
-
-#include "FrontPage.h"
-
-#define EFI_NON_DEVICE_CLASS 0x00 // Useful when you do not want something in the Device Manager
-#define EFI_DISK_DEVICE_CLASS 0x01
-#define EFI_VIDEO_DEVICE_CLASS 0x02
-#define EFI_NETWORK_DEVICE_CLASS 0x04
-#define EFI_INPUT_DEVICE_CLASS 0x08
-#define EFI_ON_BOARD_DEVICE_CLASS 0x10
-#define EFI_OTHER_DEVICE_CLASS 0x20
-
-EFI_STATUS
-EFIAPI
-DeviceManagerCallbackRoutine (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *DataArray,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-;
-
-EFI_STATUS
-InitializeDeviceManager (
- VOID
- )
-;
-
-EFI_STATUS
-CallDeviceManager (
- VOID
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerStrings.uni b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerStrings.uni
deleted file mode 100644
index f549ff2..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerStrings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerVfr.Vfr b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerVfr.Vfr
deleted file mode 100644
index 3419583..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerVfr.Vfr
+++ /dev/null
@@ -1,75 +0,0 @@
-// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// DeviceManagerVfr.vfr
-//
-// Abstract:
-//
-// Device Manager formset.
-//
-// Revision History:
-//
-// --*/
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-
-#define FORMSET_GUID { 0x3ebfa8e6, 0x511d, 0x4b5b, { 0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27 } }
-
-#define EFI_DISK_DEVICE_CLASS 0x01
-#define EFI_VIDEO_DEVICE_CLASS 0x02
-#define EFI_NETWORK_DEVICE_CLASS 0x04
-#define EFI_INPUT_DEVICE_CLASS 0x08
-#define EFI_ON_BOARD_DEVICE_CLASS 0x10
-#define EFI_OTHER_DEVICE_CLASS 0x20
-#define EFI_VBIOS_CLASS 0x40
-
-#define DEVICE_MANAGER_CLASS 0x0000
-#define FRONT_PAGE_SUBCLASS 0x0003
-
-formset
- guid = FORMSET_GUID,
- title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE),
- help = STRING_TOKEN(STR_EMPTY_STRING),
- class = DEVICE_MANAGER_CLASS,
- subclass = FRONT_PAGE_SUBCLASS,
-
- form formid = 0x1000,
- title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE);
-
- //
- // This is where devices get added to the device manager hierarchy
- //
- subtitle text = STRING_TOKEN(STR_DISK_DEVICE);
- label EFI_DISK_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_VIDEO_DEVICE);
- label EFI_VIDEO_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE);
- label EFI_NETWORK_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_INPUT_DEVICE);
- label EFI_INPUT_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_ON_BOARD_DEVICE);
- label EFI_ON_BOARD_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_OTHER_DEVICE);
- label EFI_OTHER_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
- label EFI_VBIOS_CLASS;
-
- endform;
-endformset;
-
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/EdkGenericPlatformBdsLib.msa b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/EdkGenericPlatformBdsLib.msa
deleted file mode 100644
index 828ab8d..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/EdkGenericPlatformBdsLib.msa
+++ /dev/null
@@ -1,230 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkPlatformGenericBdsLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>f392b762-8985-11db-be87-0040d02b1835</GuidValue>
- <Version>1.0</Version>
- <Abstract>Generic BDS library</Abstract>
- <Description>Do generic action.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkGenericPlatformBdsLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkGraphicsLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DxeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkIfrSupportLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkGenericBdsLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HiiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>EdkGenericPlatformBdsLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeCoffLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Bds.h</Filename>
- <Filename>BdsEntry.c</Filename>
- <Filename>BdsBoot.c</Filename>
- <Filename>FrontPage.h</Filename>
- <Filename>FrontPage.c</Filename>
- <Filename>FrontPageStrings.uni</Filename>
- <Filename>FrontPageVfr.Vfr</Filename>
- <Filename>Language.h</Filename>
- <Filename>Language.c</Filename>
- <Filename>String.h</Filename>
- <Filename>String.c</Filename>
- <Filename>Strings.uni</Filename>
- <Filename>Capsules.c</Filename>
- <Filename>MemoryTest.c</Filename>
- <Filename>BootMaint/BmString.uni</Filename>
- <Filename>BootMaint/Bm.vfr</Filename>
- <Filename>BootMaint/BBSsupport.h</Filename>
- <Filename>BootMaint/BootMaint.h</Filename>
- <Filename>BootMaint/FormGuid.h</Filename>
- <Filename>BootMaint/BmLib.c</Filename>
- <Filename>BootMaint/BootOption.c</Filename>
- <Filename>BootMaint/ConsoleOption.c</Filename>
- <Filename>BootMaint/Data.c</Filename>
- <Filename>BootMaint/Variable.c</Filename>
- <Filename>BootMaint/UpdatePage.c</Filename>
- <Filename>BootMaint/BBSsupport.c</Filename>
- <Filename>BootMaint/BootMaint.c</Filename>
- <Filename>BootMaint/FileExplorer.c</Filename>
- <Filename>BootMaint/FE.vfr</Filename>
- <Filename>BootMngr/BootManager.h</Filename>
- <Filename>BootMngr/BootManager.c</Filename>
- <Filename>BootMngr/BootManagerStrings.uni</Filename>
- <Filename>BootMngr/BootManagerVfr.Vfr</Filename>
- <Filename>DeviceMngr/DeviceManager.h</Filename>
- <Filename>DeviceMngr/DeviceManager.c</Filename>
- <Filename>DeviceMngr/DeviceManagerStrings.uni</Filename>
- <Filename>DeviceMngr/DeviceManagerVfr.Vfr</Filename>
- <!--<Filename>Bds.dxs</Filename>-->
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiBdsArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiLegacyBiosProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiUgaSplashProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiFormCallbackProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiFormBrowserProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiConsoleControlProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiCpuIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiLoadFileProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiGenericMemTestProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiCpuArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiDriverBindingProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <DataHubs>
- <DataHubRecord Usage="SOMETIMES_CONSUMED">
- <DataHubCName>BiosVendor</DataHubCName>
- </DataHubRecord>
- <DataHubRecord Usage="SOMETIMES_CONSUMED">
- <DataHubCName>SystemManufacturer</DataHubCName>
- </DataHubRecord>
- <DataHubRecord Usage="SOMETIMES_CONSUMED">
- <DataHubCName>ProcessorVersion</DataHubCName>
- </DataHubRecord>
- <DataHubRecord Usage="SOMETIMES_CONSUMED">
- <DataHubCName>ProcessorFrequency</DataHubCName>
- </DataHubRecord>
- <DataHubRecord Usage="SOMETIMES_CONSUMED">
- <DataHubCName>MemoryArray</DataHubCName>
- </DataHubRecord>
- <DataHubRecord Usage="SOMETIMES_CONSUMED">
- <DataHubCName>SerialIoDevice</DataHubCName>
- </DataHubRecord>
- <DataHubRecord Usage="SOMETIMES_CONSUMED">
- <DataHubCName>SerialIoPort</DataHubCName>
- </DataHubRecord>
- </DataHubs>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiBootStateGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiGlobalVariableGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiFlashMapHobGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiFileSystemVolumeLabelInfoIdGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiFileInfoGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.c
deleted file mode 100644
index bcbde1a..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.c
+++ /dev/null
@@ -1,901 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FrontPage.c
-
-Abstract:
-
- FrontPage routines to handle the callbacks and browser calls
-
---*/
-
-#include "Bds.h"
-#include "FrontPage.h"
-#include "String.h"
-
-EFI_GUID mProcessorSubClass = EFI_PROCESSOR_SUBCLASS_GUID;
-EFI_GUID mMemorySubClass = EFI_MEMORY_SUBCLASS_GUID;
-EFI_GUID mMiscSubClass = EFI_MISC_SUBCLASS_GUID;
-
-UINT16 mLastSelection;
-EFI_HII_HANDLE gFrontPageHandle;
-EFI_HANDLE FrontPageCallbackHandle;
-EFI_FORM_CALLBACK_PROTOCOL FrontPageCallback;
-EFI_FORM_BROWSER_PROTOCOL *gBrowser;
-UINTN gCallbackKey;
-BOOLEAN gConnectAllHappened = FALSE;
-
-extern EFI_HII_HANDLE gFrontPageHandle;
-extern EFI_GUID gBdsStringPackGuid;
-
-EFI_STATUS
-EFIAPI
-FrontPageCallbackRoutine (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *DataArray,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-
-Routine Description:
-
- This is the function that is called to provide results data to the driver. This data
- consists of a unique key which is used to identify what data is either being passed back
- or being asked for.
-
-Arguments:
-
- KeyValue - A unique value which is sent to the original exporting driver so that it
- can identify the type of data to expect. The format of the data tends to
- vary based on the op-code that geerated the callback.
-
- Data - A pointer to the data being sent to the original exporting driver.
-
-Returns:
-
---*/
-{
- CHAR16 *LanguageString;
- UINTN Count;
- CHAR16 UnicodeLang[3];
- CHAR8 Lang[3];
- EFI_STATUS Status;
- UINTN Index;
- CHAR16 *TmpStr;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
-
- SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
- SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
-
- Count = 0;
-
- //
- // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
- // describe to their customers in documentation how to find their setup information (namely
- // under the device manager and specific buckets)
- //
- switch (KeyValue) {
- case 0x0001:
- //
- // This is the continue - clear the screen and return an error to get out of FrontPage loop
- //
- gCallbackKey = 1;
- break;
-
- case 0x1234:
- //
- // Collect the languages from what our current Language support is based on our VFR
- //
- Hii->GetPrimaryLanguages (Hii, gFrontPageHandle, &LanguageString);
-
- //
- // Based on the DataArray->Data->Data value, we can determine
- // which language was chosen by the user
- //
- for (Index = 0; Count != (UINTN) (((EFI_IFR_DATA_ENTRY *) (DataArray + 1))->Data); Index += 3) {
- Count++;
- }
- //
- // Preserve the choice the user made
- //
- mLastSelection = (UINT16) Count;
-
- //
- // The Language (in Unicode format) the user chose
- //
- CopyMem (UnicodeLang, &LanguageString[Index], 6);
-
- //
- // Convert Unicode to ASCII (Since the ISO standard assumes ASCII equivalent abbreviations
- // we can be safe in converting this Unicode stream to ASCII without any loss in meaning.
- //
- for (Index = 0; Index < 3; Index++) {
- Lang[Index] = (CHAR8) UnicodeLang[Index];
- }
-
- Status = gRT->SetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 3,
- Lang
- );
-
- gBS->FreePool (LanguageString);
- gCallbackKey = 2;
- break;
-
- case 0x1064:
- //
- // Boot Manager
- //
- gCallbackKey = 3;
- break;
-
- case 0x8567:
- //
- // Device Manager
- //
- gCallbackKey = 4;
- break;
-
- case 0x9876:
- //
- // Boot Maintenance Manager
- //
- gCallbackKey = 5;
- break;
-
- case 0xFFFE:
-
- break;
-
- case 0xFFFF:
- //
- // FrontPage TimeOut Callback
- //
- TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION));
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (
- Foreground,
- Background,
- TmpStr,
- Color,
- (UINTN) (((EFI_IFR_DATA_ENTRY *) (DataArray+1))->Data),
- 0
- );
- gBS->FreePool (TmpStr);
- }
- break;
-
- default:
- gCallbackKey = 0;
- break;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InitializeFrontPage (
- BOOLEAN ReInitializeStrings
- )
-/*++
-
-Routine Description:
-
- Initialize HII information for the FrontPage
-
-Arguments:
- None
-
-Returns:
- EFI_SUCCESS - The operation is successful.
- EFI_DEVICE_ERROR - If the dynamic opcode creation failed.
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGES *PackageList;
- EFI_HII_UPDATE_DATA *UpdateData;
- IFR_OPTION *OptionList;
- CHAR16 *LanguageString;
- UINTN OptionCount;
- UINTN Index;
- STRING_REF Token;
- UINT16 Key;
- CHAR8 AsciiLang[4];
- CHAR16 UnicodeLang[4];
- CHAR16 Lang[4];
- CHAR16 *StringBuffer;
- UINTN BufferSize;
- UINT8 *TempBuffer;
-
- UpdateData = NULL;
- OptionList = NULL;
-
- if (ReInitializeStrings) {
- //
- // BugBug: Dont' use a goto
- //
- goto ReInitStrings;
- }
- //
- // Go ahead and initialize the Device Manager
- //
- InitializeDeviceManager ();
-
- //
- // BugBug: if FrontPageVfrBin is generated by a tool, why are we patching it here
- //
- TempBuffer = (UINT8 *) FrontPageVfrBin;
- TempBuffer = TempBuffer + sizeof (EFI_HII_PACK_HEADER);
- TempBuffer = (UINT8 *) &((EFI_IFR_FORM_SET *) TempBuffer)->NvDataSize;
- *TempBuffer = 1;
-
- gCallbackKey = 0;
-
- PackageList = PreparePackages (1, &gBdsStringPackGuid, FrontPageVfrBin);
-
- Status = Hii->NewPack (Hii, PackageList, &gFrontPageHandle);
-
- gBS->FreePool (PackageList);
-
- //
- // There will be only one FormConfig in the system
- // If there is another out there, someone is trying to install us
- // again. Fail that scenario.
- //
- Status = gBS->LocateProtocol (
- &gEfiFormBrowserProtocolGuid,
- NULL,
- (VOID**)&gBrowser
- );
-
- //
- // This example does not implement worker functions
- // for the NV accessor functions. Only a callback evaluator
- //
- FrontPageCallback.NvRead = NULL;
- FrontPageCallback.NvWrite = NULL;
- FrontPageCallback.Callback = FrontPageCallbackRoutine;
-
- //
- // Install protocol interface
- //
- FrontPageCallbackHandle = NULL;
- Status = gBS->InstallProtocolInterface (
- &FrontPageCallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &FrontPageCallback
- );
- ASSERT_EFI_ERROR (Status);
-
-ReInitStrings:
- //
- // BugBug: This logic is in BdsInitLanguage. It should not be in two places!
- //
- BufferSize = 4;
- Status = gRT->GetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &BufferSize,
- AsciiLang
- );
-
- for (Index = 0; Index < 3; Index++) {
- UnicodeLang[Index] = (CHAR16) AsciiLang[Index];
- }
-
- UnicodeLang[3] = 0;
-
- //
- // Allocate space for creation of UpdateData Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- OptionList = AllocateZeroPool (0x1000);
- ASSERT (OptionList != NULL);
-
- //
- // Flag update pending in FormSet
- //
- UpdateData->FormSetUpdate = TRUE;
- //
- // Register CallbackHandle data for FormSet
- //
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) FrontPageCallbackHandle;
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = 0;
- UpdateData->DataCount = 1;
-
- //
- // Collect the languages from what our current Language support is based on our VFR
- //
- Hii->GetPrimaryLanguages (Hii, gFrontPageHandle, &LanguageString);
-
- OptionCount = 0;
-
- //
- // Try for a 512 byte Buffer
- //
- BufferSize = 0x200;
-
- //
- // Allocate memory for our Form binary
- //
- StringBuffer = AllocateZeroPool (BufferSize);
- ASSERT (StringBuffer != NULL);
-
- for (Index = 0; LanguageString[Index] != 0; Index += 3) {
- Token = 0;
- CopyMem (Lang, &LanguageString[Index], 6);
- Lang[3] = 0;
-
- if (!StrCmp (Lang, UnicodeLang)) {
- mLastSelection = (UINT16) OptionCount;
- }
-
- Status = Hii->GetString (Hii, gStringPackHandle, 1, TRUE, Lang, &BufferSize, StringBuffer);
- Hii->NewString (Hii, NULL, gStringPackHandle, &Token, StringBuffer);
- CopyMem (&OptionList[OptionCount].StringToken, &Token, sizeof (UINT16));
- CopyMem (&OptionList[OptionCount].Value, &OptionCount, sizeof (UINT16));
- Key = 0x1234;
- CopyMem (&OptionList[OptionCount].Key, &Key, sizeof (UINT16));
- OptionList[OptionCount].Flags = EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS;
- OptionCount++;
- }
-
- gBS->FreePool (LanguageString);
-
- if (ReInitializeStrings) {
- gBS->FreePool (StringBuffer);
- gBS->FreePool (OptionList);
- return EFI_SUCCESS;
- }
-
- Status = CreateOneOfOpCode (
- FRONT_PAGE_QUESTION_ID, // Question ID
- FRONT_PAGE_DATA_WIDTH, // Data Width
- (STRING_REF) STRING_TOKEN (STR_LANGUAGE_SELECT), // Prompt Token
- (STRING_REF) STRING_TOKEN (STR_LANGUAGE_SELECT_HELP), // Help Token
- OptionList, // List of Options
- OptionCount, // Number of Options
- &UpdateData->Data // Data Buffer
- );
-
- //
- // Assign the number of options and the oneof and endoneof op-codes to count
- //
- UpdateData->DataCount = (UINT8) (OptionCount + 2);
-
- Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);
-
- gBS->FreePool (UpdateData);
- //
- // gBS->FreePool (OptionList);
- //
- gBS->FreePool (StringBuffer);
- return Status;
-}
-
-EFI_STATUS
-CallFrontPage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Call the browser and display the front page
-
-Arguments:
-
- None
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- UINT8 FakeNvRamMap[1];
- BOOLEAN FrontPageMenuResetRequired;
-
- //
- // Begin waiting for USER INPUT
- //
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT)
- );
-
- FakeNvRamMap[0] = (UINT8) mLastSelection;
- FrontPageMenuResetRequired = FALSE;
- Status = gBrowser->SendForm (
- gBrowser,
- TRUE, // Use the database
- &gFrontPageHandle, // The HII Handle
- 1,
- NULL,
- FrontPageCallbackHandle, // This is the handle that the interface to the callback was installed on
- FakeNvRamMap,
- NULL,
- &FrontPageMenuResetRequired
- );
- //
- // Check whether user change any option setting which needs a reset to be effective
- //
- if (FrontPageMenuResetRequired) {
- EnableResetRequired ();
- }
-
- Hii->ResetStrings (Hii, gFrontPageHandle);
-
- return Status;
-}
-
-EFI_STATUS
-GetStringFromToken (
- IN EFI_GUID *ProducerGuid,
- IN STRING_REF Token,
- OUT CHAR16 **String
- )
-/*++
-
-Routine Description:
-
- Acquire the string associated with the ProducerGuid and return it.
-
-Arguments:
-
- ProducerGuid - The Guid to search the HII database for
- Token - The token value of the string to extract
- String - The string that is extracted
-
-Returns:
-
- EFI_SUCCESS - The function returns EFI_SUCCESS always.
-
---*/
-{
- EFI_STATUS Status;
- UINT16 HandleBufferLength;
- EFI_HII_HANDLE *HiiHandleBuffer;
- UINTN StringBufferLength;
- UINTN NumberOfHiiHandles;
- UINTN Index;
- UINT16 Length;
- EFI_GUID HiiGuid;
-
- //
- // Initialize params.
- //
- HandleBufferLength = 0;
- HiiHandleBuffer = NULL;
-
- //
- // Get all the Hii handles
- //
- Status = BdsLibGetHiiHandles (Hii, &HandleBufferLength, &HiiHandleBuffer);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Get the Hii Handle that matches the StructureNode->ProducerName
- //
- NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);
- for (Index = 0; Index < NumberOfHiiHandles; Index++) {
- Length = 0;
- Status = ExtractDataFromHiiHandle (
- HiiHandleBuffer[Index],
- &Length,
- NULL,
- &HiiGuid
- );
- if (CompareGuid (ProducerGuid, &HiiGuid)) {
- break;
- }
- }
- //
- // Find the string based on the current language
- //
- StringBufferLength = 0x100;
- *String = AllocateZeroPool (0x100);
- Status = Hii->GetString (
- Hii,
- HiiHandleBuffer[Index],
- Token,
- FALSE,
- NULL,
- &StringBufferLength,
- *String
- );
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (*String);
- *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
- }
-
- gBS->FreePool (HiiHandleBuffer);
- return EFI_SUCCESS;
-}
-
-VOID
-ConvertProcessorToString (
- IN EFI_PROCESSOR_CORE_FREQUENCY_DATA *ProcessorFrequency,
- OUT CHAR16 **String
- )
-/*++
-
-Routine Description:
-
- Convert Processor Frequency Data to a string
-
-Arguments:
-
- ProcessorFrequency - The frequency data to process
- String - The string that is created
-
-Returns:
-
---*/
-{
- CHAR16 *StringBuffer;
- UINTN Index;
- UINT32 FreqMhz;
-
- if (ProcessorFrequency->Exponent >= 6) {
- FreqMhz = ProcessorFrequency->Value;
- for (Index = 0; Index < (UINTN) (ProcessorFrequency->Exponent - 6); Index++) {
- FreqMhz *= 10;
- }
- } else {
- FreqMhz = 0;
- }
-
- StringBuffer = AllocateZeroPool (0x20);
- ASSERT (StringBuffer != NULL);
- Index = UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 1000, 3);
- StrCat (StringBuffer, L".");
- UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % 1000) / 10, 2);
- StrCat (StringBuffer, L" GHz");
-
- *String = (CHAR16 *) StringBuffer;
-
- return ;
-}
-
-VOID
-ConvertMemorySizeToString (
- IN UINT32 MemorySize,
- OUT CHAR16 **String
- )
-/*++
-
-Routine Description:
-
- Convert Memory Size to a string
-
-Arguments:
-
- MemorySize - The size of the memory to process
- String - The string that is created
-
-Returns:
-
---*/
-{
- CHAR16 *StringBuffer;
-
- StringBuffer = AllocateZeroPool (0x20);
- ASSERT (StringBuffer != NULL);
- UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 6);
- StrCat (StringBuffer, L" MB RAM");
-
- *String = (CHAR16 *) StringBuffer;
-
- return ;
-}
-
-VOID
-UpdateFrontPageStrings (
- VOID
- )
-/*++
-
-Routine Description:
-
- Update the banner information for the Front Page based on DataHub information
-
-Arguments:
-
- None
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- STRING_REF TokenToUpdate;
- CHAR16 *NewString;
- UINT64 MonotonicCount;
- EFI_DATA_HUB_PROTOCOL *DataHub;
- EFI_DATA_RECORD_HEADER *Record;
- EFI_SUBCLASS_TYPE1_HEADER *DataHeader;
- EFI_MISC_BIOS_VENDOR_DATA *BiosVendor;
- EFI_MISC_SYSTEM_MANUFACTURER_DATA *SystemManufacturer;
- EFI_PROCESSOR_VERSION_DATA *ProcessorVersion;
- EFI_PROCESSOR_CORE_FREQUENCY_DATA *ProcessorFrequency;
- EFI_MEMORY_ARRAY_START_ADDRESS_DATA *MemoryArray;
- CHAR8 LangCode[3];
- CHAR16 Lang[3];
- UINTN Size;
- UINTN Index;
- BOOLEAN Find[5];
-
- ZeroMem (Find, sizeof (Find));
-
- //
- // Update Front Page strings
- //
- Status = gBS->LocateProtocol (
- &gEfiDataHubProtocolGuid,
- NULL,
- (VOID**)&DataHub
- );
- ASSERT_EFI_ERROR (Status);
-
- Size = 3;
-
- Status = gRT->GetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &Size,
- LangCode
- );
-
- for (Index = 0; Index < 3; Index++) {
- Lang[Index] = (CHAR16) LangCode[Index];
- }
-
- MonotonicCount = 0;
- Record = NULL;
- do {
- Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);
- if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {
- DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);
- if (CompareGuid (&Record->DataRecordGuid, &mMiscSubClass) &&
- (DataHeader->RecordType == EFI_MISC_BIOS_VENDOR_RECORD_NUMBER)
- ) {
- BiosVendor = (EFI_MISC_BIOS_VENDOR_DATA *) (DataHeader + 1);
- GetStringFromToken (&Record->ProducerName, BiosVendor->BiosVersion, &NewString);
- TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_BIOS_VERSION;
- Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
- gBS->FreePool (NewString);
- Find[0] = TRUE;
- }
-
- if (CompareGuid (&Record->DataRecordGuid, &mMiscSubClass) &&
- (DataHeader->RecordType == EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER)
- ) {
- SystemManufacturer = (EFI_MISC_SYSTEM_MANUFACTURER_DATA *) (DataHeader + 1);
- GetStringFromToken (&Record->ProducerName, SystemManufacturer->SystemProductName, &NewString);
- TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_COMPUTER_MODEL;
- Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
- gBS->FreePool (NewString);
- Find[1] = TRUE;
- }
-
- if (CompareGuid (&Record->DataRecordGuid, &mProcessorSubClass) &&
- (DataHeader->RecordType == ProcessorVersionRecordType)
- ) {
- ProcessorVersion = (EFI_PROCESSOR_VERSION_DATA *) (DataHeader + 1);
- GetStringFromToken (&Record->ProducerName, *ProcessorVersion, &NewString);
- TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_CPU_MODEL;
- Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
- gBS->FreePool (NewString);
- Find[2] = TRUE;
- }
-
- if (CompareGuid (&Record->DataRecordGuid, &mProcessorSubClass) &&
- (DataHeader->RecordType == ProcessorCoreFrequencyRecordType)
- ) {
- ProcessorFrequency = (EFI_PROCESSOR_CORE_FREQUENCY_DATA *) (DataHeader + 1);
- ConvertProcessorToString (ProcessorFrequency, &NewString);
- TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_CPU_SPEED;
- Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
- gBS->FreePool (NewString);
- Find[3] = TRUE;
- }
-
- if (CompareGuid (&Record->DataRecordGuid, &mMemorySubClass) &&
- (DataHeader->RecordType == EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER)
- ) {
- MemoryArray = (EFI_MEMORY_ARRAY_START_ADDRESS_DATA *) (DataHeader + 1);
- ConvertMemorySizeToString((UINT32)(RShiftU64((MemoryArray->MemoryArrayEndAddress -
- MemoryArray->MemoryArrayStartAddress + 1), 20)),
- &NewString);
- TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_MEMORY_SIZE;
- Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
- gBS->FreePool (NewString);
- Find[4] = TRUE;
- }
- }
- } while (!EFI_ERROR (Status) && (MonotonicCount != 0) && !(Find[0] && Find[1] && Find[2] && Find[3] && Find[4]));
-
- return ;
-}
-
-VOID
-PlatformBdsEnterFrontPage (
- IN UINT16 TimeoutDefault,
- IN BOOLEAN ConnectAllHappened
- )
-/*++
-
-Routine Description:
- This function is the main entry of the platform setup entry.
- The function will present the main menu of the system setup,
- this is the platform reference part and can be customize.
-
-Arguments:
- TimeoutDefault - The fault time out value before the system
- continue to boot.
- ConnectAllHappened - The indicater to check if the connect all have
- already happended.
-
-Returns:
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_UPDATE_DATA *UpdateData;
- EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
-
- //
- // Indicate if we need connect all in the platform setup
- //
- if (ConnectAllHappened) {
- gConnectAllHappened = TRUE;
- }
- //
- // Allocate space for creation of Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- UpdateData->FormSetUpdate = FALSE;
- UpdateData->FormCallbackHandle = 0;
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = 0;
- UpdateData->DataCount = 1;
-
- //
- // Remove Banner Op-code if any at this label
- //
- Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0xFFFF, FALSE, UpdateData);
-
- //
- // Create Banner Op-code which reflects correct timeout value
- //
- CreateBannerOpCode (
- STRING_TOKEN (STR_TIME_OUT_PROMPT),
- TimeoutDefault,
- (UINT8) EFI_IFR_BANNER_TIMEOUT,
- &UpdateData->Data
- );
-
- //
- // Add Banner Op-code at this label
- //
- Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0xFFFF, TRUE, UpdateData);
-
- do {
-
- InitializeFrontPage (TRUE);
-
- //
- // Update Front Page strings
- //
- UpdateFrontPageStrings ();
-
- gCallbackKey = 0;
- PERF_START (0, "BdsTimeOut", "BDS", 0);
- Status = CallFrontPage ();
- PERF_END (0, "BdsTimeOut", "BDS", 0);
-
- //
- // If gCallbackKey is greater than 1 and less or equal to 5,
- // it will lauch configuration utilities.
- // 2 = set language
- // 3 = boot manager
- // 4 = device manager
- // 5 = boot maintainenance manager
- //
- if ((gCallbackKey > 0x0001) && (gCallbackKey <= 0x0005)) {
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP)
- );
- }
- //
- // Based on the key that was set, we can determine what to do
- //
- switch (gCallbackKey) {
- //
- // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
- // describe to their customers in documentation how to find their setup information (namely
- // under the device manager and specific buckets)
- //
- // These entries consist of the Continue, Select language, Boot Manager, and Device Manager
- //
- case 0x0001:
- //
- // User hit continue
- //
- break;
-
- case 0x0002:
- //
- // User made a language setting change - display front page again
- //
- break;
-
- case 0x0003:
- //
- // User chose to run the Boot Manager
- //
- CallBootManager ();
- break;
-
- case 0x0004:
- //
- // Display the Device Manager
- //
- do {
- CallDeviceManager();
- } while (gCallbackKey == 4);
- break;
-
- case 0x0005:
- //
- // Display the Boot Maintenance Manager
- //
- BdsStartBootMaint ();
- break;
- }
-
- } while ((Status == EFI_SUCCESS) && (gCallbackKey != 1));
-
- //
- //Will leave browser, check any reset required change is applied? if yes, reset system
- //
- SetupResetReminder ();
-
- //
- // Automatically load current entry
- // Note: The following lines of code only execute when Auto boot
- // takes affect
- //
- Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID**)&ConsoleControl);
- ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.h
deleted file mode 100644
index 2899125..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FrontPage.h
-
-Abstract:
-
- FrontPage routines to handle the callbacks and browser calls
-
-Revision History
-
---*/
-
-#ifndef _FRONT_PAGE_H
-#define _FRONT_PAGE_H
-
-#include "DeviceMngr/DeviceManager.h"
-#include "BootMaint/BootMaint.h"
-#include "BootMngr/BootManager.h"
-
-//
-// This is the VFR compiler generated header file which defines the
-// string identifiers.
-//
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-#define EFI_DISK_DEVICE_CLASS 0x01
-#define EFI_VIDEO_DEVICE_CLASS 0x02
-#define EFI_NETWORK_DEVICE_CLASS 0x04
-#define EFI_INPUT_DEVICE_CLASS 0x08
-#define EFI_ON_BOARD_DEVICE_CLASS 0x10
-#define EFI_OTHER_DEVICE_CLASS 0x20
-#define EFI_VBIOS_CLASS 0x40
-
-#define SET_VIDEO_BIOS_TYPE_QUESTION_ID 0x00
-
-#pragma pack(1)
-typedef struct {
- UINT8 VideoBIOS;
-} MyDevMgrIfrNVData;
-#pragma pack()
-
-#define EFI_FP_CALLBACK_DATA_SIGNATURE EFI_SIGNATURE_32 ('F', 'P', 'C', 'B')
-#define EFI_FP_CALLBACK_DATA_FROM_THIS(a) \
- CR (a, \
- EFI_FRONTPAGE_CALLBACK_INFO, \
- DevMgrCallback, \
- EFI_FP_CALLBACK_DATA_SIGNATURE \
- )
-
-typedef struct {
- UINTN Signature;
- MyDevMgrIfrNVData Data;
- EFI_HII_HANDLE DevMgrHiiHandle;
- EFI_HANDLE CallbackHandle;
- EFI_FORM_CALLBACK_PROTOCOL DevMgrCallback;
-} EFI_FRONTPAGE_CALLBACK_INFO;
-
-//
-// These are the VFR compiler generated data representing our VFR data.
-//
-// BugBug: we should put g in front of these tool generated globals.
-// maybe even gVrf would be a better prefix
-//
-extern UINT8 FrontPageVfrBin[];
-extern UINT8 FrontPageStringsStr[];
-extern UINT8 DeviceManagerVfrBin[];
-extern UINT8 DeviceManagerStringsStr[];
-
-#define FRONT_PAGE_QUESTION_ID 0x0000
-#define FRONT_PAGE_DATA_WIDTH 0x01
-
-EFI_STATUS
-InitializeFrontPage (
- IN BOOLEAN ReInitializeStrings
- );
-
-BOOLEAN
-TimeCompare (
- IN EFI_TIME *FirstTime,
- IN EFI_TIME *SecondTime
- );
-
-#endif // _FRONT_PAGE_H_
-
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageStrings.uni b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageStrings.uni
deleted file mode 100644
index 76dbdcf..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageStrings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageVfr.Vfr b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageVfr.Vfr
deleted file mode 100644
index 8457784..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageVfr.Vfr
+++ /dev/null
@@ -1,159 +0,0 @@
-// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// FrontPageVfr.vfr
-//
-// Abstract:
-//
-// Browser formset.
-//
-// Revision History:
-//
-// --*/
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-
-#define FORMSET_GUID { 0x9e0c30bc, 0x3f06, 0x4ba6, { 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe } }
-
-#define FRONT_PAGE_ITEM_ONE 0x0001
-#define FRONT_PAGE_ITEM_TWO 0x0002
-#define FRONT_PAGE_ITEM_THREE 0x0003
-#define FRONT_PAGE_ITEM_FOUR 0x0004
-#define FRONT_PAGE_ITEM_FIVE 0x0005
-
-#define FRONT_PAGE_TIMEOUT 0xFFFF
-#define FRONT_PAGE_CLASS 0x0000
-#define FRONT_PAGE_SUBCLASS 0x0002
-
-formset
- guid = FORMSET_GUID,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE),
- help = STRING_TOKEN(STR_NULL_STRING),
- class = FRONT_PAGE_CLASS,
- subclass = FRONT_PAGE_SUBCLASS,
-
- form formid = 0x1000,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_COMPUTER_MODEL),
- line 0,
- align left;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_CPU_MODEL),
- line 1,
- align left;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_CPU_SPEED),
- line 1,
- align right;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_BIOS_VERSION),
- line 2,
- align left;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_MEMORY_SIZE),
- line 2,
- align right;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_0_LEFT),
-// line 0,
-// align left;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_0_RIGHT),
-// line 0,
-// align right;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_1_LEFT),
-// line 1,
-// align left;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_1_RIGHT),
-// line 1,
-// align right;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_2_LEFT),
-// line 2,
-// align left;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_3_LEFT),
-// line 3,
-// align left;
-
- goto FRONT_PAGE_ITEM_ONE,
- prompt = STRING_TOKEN(STR_CONTINUE_PROMPT),
- help = STRING_TOKEN(STR_CONTINUE_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = 0x0001;
-
- label FRONT_PAGE_ITEM_TWO;
- //
- // This is where we will dynamically add a OneOf type op-code to select Languages from the
- // currently available choices
- //
-
- goto FRONT_PAGE_ITEM_THREE,
- prompt = STRING_TOKEN(STR_BOOT_MANAGER),
- help = STRING_TOKEN(STR_BOOT_MANAGER_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = 0x1064;
-
- goto FRONT_PAGE_ITEM_FOUR,
- prompt = STRING_TOKEN(STR_DEVICE_MANAGER),
- help = STRING_TOKEN(STR_DEVICE_MANAGER_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = 0x8567;
-
- goto FRONT_PAGE_ITEM_FIVE,
- prompt = STRING_TOKEN(STR_BOOT_MAINT_MANAGER),
- help = STRING_TOKEN(STR_BOOT_MAINT_MANAGER_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = 0x9876;
-
- label FRONT_PAGE_TIMEOUT;
-// If one wanted to hard-code a value one could do it below, but our implementation follows EFI architecture
-// and honors the TimeOut NV variable
-//
-// banner
-// title = STRING_TOKEN(STR_TIME_OUT_PROMPT),
-// timeout = 0x000A;
-
- endform;
-
- form formid = FRONT_PAGE_ITEM_ONE,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
- endform;
-
- form formid = FRONT_PAGE_ITEM_THREE,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
- endform;
-
- form formid = FRONT_PAGE_ITEM_FOUR,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
- endform;
-
- form formid = FRONT_PAGE_ITEM_FIVE,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
- endform;
-
-endformset;
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.c
deleted file mode 100644
index 5091f20..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- language.c
-
-Abstract:
-
- Language settings
-
-Revision History
-
---*/
-
-#include "String.h"
-#include "Language.h"
-
-#define NARROW_GLYPH_NUMBER 8
-#define WIDE_GLYPH_NUMBER 75
-
-//
-// Default language code, currently is English
-//
-CHAR8 *mDefaultLangCode = "eng";
-
-typedef struct {
- EFI_HII_FONT_PACK FixedLength;
- EFI_NARROW_GLYPH NarrowArray[NARROW_GLYPH_NUMBER];
- EFI_WIDE_GLYPH WideArray[WIDE_GLYPH_NUMBER];
-} FONT_PACK;
-
-FONT_PACK mFontPack = {
- {
- {
- sizeof (EFI_HII_FONT_PACK) + (NARROW_GLYPH_NUMBER * sizeof (EFI_NARROW_GLYPH)) + (WIDE_GLYPH_NUMBER * sizeof (EFI_WIDE_GLYPH)),
- EFI_HII_FONT
- },
- NARROW_GLYPH_NUMBER,
- WIDE_GLYPH_NUMBER
- },
- { // Narrow Glyphs
- {
- 0x05d0,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x4E,
- 0x6E,
- 0x62,
- 0x32,
- 0x32,
- 0x3C,
- 0x68,
- 0x4C,
- 0x4C,
- 0x46,
- 0x76,
- 0x72,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d1,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x78,
- 0x7C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x7E,
- 0x7E,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d2,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x78,
- 0x7C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x1C,
- 0x3E,
- 0x66,
- 0x66,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d3,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x7E,
- 0x7E,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d4,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x7C,
- 0x7E,
- 0x06,
- 0x06,
- 0x06,
- 0x06,
- 0x66,
- 0x66,
- 0x66,
- 0x66,
- 0x66,
- 0x66,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d5,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x3C,
- 0x3C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d6,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x38,
- 0x38,
- 0x1E,
- 0x1E,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x0000,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- }
- },
- { // Wide Glyphs
- {
- 0x0020,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- },
- {
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- },
- {
- 0x00,
- 0x00,
- 0x00
- }
- }, //
- }
-};
-
-VOID
-ExportFonts (
- VOID
- )
-/*++
-
-Routine Description:
- Routine to export glyphs to the HII database. This is in addition to whatever is defined in the Graphics Console driver.
-
-Arguments:
- None
-
-Returns:
-
---*/
-{
- EFI_HII_HANDLE HiiHandle;
- EFI_HII_PACKAGES *PackageList;
-
- PackageList = PreparePackages (1, NULL, &mFontPack);
- //
- // Register our Fonts into the global database
- //
- HiiHandle = 0;
- Hii->NewPack (Hii, PackageList, &HiiHandle);
-
- gBS->FreePool (PackageList);
-}
-
-VOID
-InitializeLanguage (
- BOOLEAN LangCodesSettingRequired
- )
-/*++
-
-Routine Description:
- Determine the current language that will be used
- based on language related EFI Variables
-
-Arguments:
- LangCodesSettingRequired - If required to set LangCode variable
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- UINTN Size;
- CHAR8 LangCode[ISO_639_2_ENTRY_SIZE];
- CHAR8 *LangCodes;
- CHAR16 *LanguageString;
-
- LanguageString = NULL;
- LangCodes = NULL;
-
- ExportFonts ();
-
- //
- // Collect the languages from what our current Language support is based on our VFR
- //
- Hii->GetPrimaryLanguages (Hii, gStringPackHandle, &LanguageString);
-
- LangCodes = AllocatePool (StrLen (LanguageString));
- ASSERT (LangCodes);
-
- //
- // Convert LanguageString from Unicode to EFI defined ASCII LangCodes
- //
- for (Index = 0; LanguageString[Index] != 0x0000; Index++) {
- LangCodes[Index] = (CHAR8) LanguageString[Index];
- }
-
- LangCodes[Index] = 0;
-
- if (LangCodesSettingRequired) {
- Status = gRT->SetVariable (
- L"LangCodes",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- AsciiStrLen (LangCodes),
- LangCodes
- );
- }
- //
- // Find current LangCode from Lang NV Variable
- //
- Size = ISO_639_2_ENTRY_SIZE;
- Status = gRT->GetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &Size,
- &LangCode
- );
-
- if (!EFI_ERROR (Status)) {
- Status = EFI_NOT_FOUND;
- for (Index = 0; LangCodes[Index] != 0; Index += ISO_639_2_ENTRY_SIZE) {
- if (CompareMem (&LangCodes[Index], LangCode, ISO_639_2_ENTRY_SIZE) == 0) {
- Status = EFI_SUCCESS;
- break;
- }
- }
- }
- //
- // If we cannot get language code from Lang variable,
- // or LangCode cannot be found from language table,
- // set the mDefaultLangCode to Lang variable.
- //
- if (EFI_ERROR (Status)) {
- Status = gRT->SetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- ISO_639_2_ENTRY_SIZE,
- mDefaultLangCode
- );
- }
-
- if (LangCodes) {
- gBS->FreePool (LangCodes);
- }
-
- if (LanguageString != NULL) {
- gBS->FreePool (LanguageString);
- }
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.h
deleted file mode 100644
index a7c32ec..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Language.h
-
-Abstract:
-
- Language setting
-
-Revision History
-
---*/
-
-#ifndef _LANGUAGE_H
-#define _LANGUAGE_H
-
-#define ISO_639_2_ENTRY_SIZE 3
-
-VOID
-InitializeLanguage (
- BOOLEAN LangCodesSettingRequired
- );
-
-#endif // _LANGUAGE_H_
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/MemoryTest.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/MemoryTest.c
deleted file mode 100644
index f4046b5..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/MemoryTest.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MemoryTest.c
-
-Abstract:
-
- Perform the platform memory test
-
---*/
-
-#include "Bds.h"
-#include "String.h"
-
-//
-// BDS Platform Functions
-//
-EFI_STATUS
-PlatformBdsShowProgress (
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
- IN CHAR16 *Title,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
- IN UINTN Progress,
- IN UINTN PreviousValue
- )
-/*++
-
-Routine Description:
-
- Show progress bar with title above it. It only works in UGA mode.
-
-Arguments:
-
- TitleForeground - Foreground color for Title.
- TitleBackground - Background color for Title.
- Title - Title above progress bar.
- ProgressColor - Progress bar color.
- Progress - Progress (0-100)
-
-Returns:
-
- EFI_STATUS - Success update the progress bar
-
---*/
-{
- EFI_STATUS Status;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UINT32 SizeOfX;
- UINT32 SizeOfY;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
- UINTN BlockHeight;
- UINTN BlockWidth;
- UINTN BlockNum;
- UINTN PosX;
- UINTN PosY;
- UINTN Index;
-
- if (Progress > 100) {
- return EFI_INVALID_PARAMETER;
- }
-
- UgaDraw = NULL;
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID**)&GraphicsOutput
- );
- if (EFI_ERROR (Status)) {
- GraphicsOutput = NULL;
-
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiUgaDrawProtocolGuid,
- (VOID**)&UgaDraw
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- if (GraphicsOutput != NULL) {
- SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
- SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
- } else {
- Status = UgaDraw->GetMode (
- UgaDraw,
- &SizeOfX,
- &SizeOfY,
- &ColorDepth,
- &RefreshRate
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- BlockWidth = SizeOfX / 100;
- BlockHeight = SizeOfY / 50;
-
- BlockNum = Progress;
-
- PosX = 0;
- PosY = SizeOfY * 48 / 50;
-
- if (BlockNum == 0) {
- //
- // Clear progress area
- //
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
-
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &Color,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- PosY - GLYPH_HEIGHT - 1,
- SizeOfX,
- SizeOfY - (PosY - GLYPH_HEIGHT - 1),
- SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) &Color,
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- PosY - GLYPH_HEIGHT - 1,
- SizeOfX,
- SizeOfY - (PosY - GLYPH_HEIGHT - 1),
- SizeOfX * sizeof (EFI_UGA_PIXEL)
- );
- }
- }
- //
- // Show progress by drawing blocks
- //
- for (Index = PreviousValue; Index < BlockNum; Index++) {
- PosX = Index * BlockWidth;
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &ProgressColor,
- EfiBltVideoFill,
- 0,
- 0,
- PosX,
- PosY,
- BlockWidth - 1,
- BlockHeight,
- (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) &ProgressColor,
- EfiUgaVideoFill,
- 0,
- 0,
- PosX,
- PosY,
- BlockWidth - 1,
- BlockHeight,
- (BlockWidth) * sizeof (EFI_UGA_PIXEL)
- );
- }
- }
-
- PrintXY (
- (SizeOfX - StrLen (Title) * GLYPH_WIDTH) / 2,
- PosY - GLYPH_HEIGHT - 1,
- &TitleForeground,
- &TitleBackground,
- Title
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BdsMemoryTest (
- IN EXTENDMEM_COVERAGE_LEVEL Level
- )
-/*++
-
-Routine Description:
-
- Perform the memory test base on the memory test intensive level,
- and update the memory resource.
-
-Arguments:
-
- Level - The memory test intensive level.
-
-Returns:
-
- EFI_STATUS - Success test all the system memory and update
- the memory resource
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS InitStatus;
- EFI_STATUS KeyStatus;
- EFI_STATUS ReturnStatus;
- BOOLEAN RequireSoftECCInit;
- EFI_GENERIC_MEMORY_TEST_PROTOCOL *GenMemoryTest;
- UINT64 TestedMemorySize;
- UINT64 TotalMemorySize;
- UINTN TestPercent;
- UINT64 PreviousValue;
- BOOLEAN ErrorOut;
- BOOLEAN TestAbort;
- EFI_INPUT_KEY Key;
- CHAR16 StrPercent[16];
- CHAR16 *StrTotalMemory;
- CHAR16 *Pos;
- CHAR16 *TmpStr;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
- UINT8 Value;
- UINTN DataSize;
-
- ReturnStatus = EFI_SUCCESS;
- ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
-
- Pos = AllocatePool (128);
-
- if (Pos == NULL) {
- return ReturnStatus;
- }
-
- StrTotalMemory = Pos;
-
- TestedMemorySize = 0;
- TotalMemorySize = 0;
- PreviousValue = 0;
- ErrorOut = FALSE;
- TestAbort = FALSE;
-
- SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
- SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
-
- RequireSoftECCInit = FALSE;
-
- gST->ConOut->ClearScreen (gST->ConOut);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
- gST->ConOut->EnableCursor (gST->ConOut, FALSE);
-
- Status = gBS->LocateProtocol (
- &gEfiGenericMemTestProtocolGuid,
- NULL,
- (VOID**)&GenMemoryTest
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (Pos);
- return EFI_SUCCESS;
- }
-
- InitStatus = GenMemoryTest->MemoryTestInit (
- GenMemoryTest,
- Level,
- &RequireSoftECCInit
- );
- if (InitStatus == EFI_NO_MEDIA) {
- //
- // The PEI codes also have the relevant memory test code to check the memory,
- // it can select to test some range of the memory or all of them. If PEI code
- // checks all the memory, this BDS memory test will has no not-test memory to
- // do the test, and then the status of EFI_NO_MEDIA will be returned by
- // "MemoryTestInit". So it does not need to test memory again, just return.
- //
- gBS->FreePool (Pos);
- return EFI_SUCCESS;
- }
-
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, 2);
- TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));
-
- if (TmpStr != NULL) {
- gST->ConOut->OutputString (gST->ConOut, TmpStr);
- gBS->FreePool (TmpStr);
- }
-
- do {
- Status = GenMemoryTest->PerformMemoryTest (
- GenMemoryTest,
- &TestedMemorySize,
- &TotalMemorySize,
- &ErrorOut,
- TestAbort
- );
- if (ErrorOut && (Status == EFI_DEVICE_ERROR)) {
- TmpStr = GetStringById (STRING_TOKEN (STR_SYSTEM_MEM_ERROR));
- if (TmpStr != NULL) {
- PrintXY (10, 10, NULL, NULL, TmpStr);
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, 4);
- gST->ConOut->OutputString (gST->ConOut, TmpStr);
- gBS->FreePool (TmpStr);
- }
-
- ASSERT (0);
- }
-
- TestPercent = (UINTN) DivU64x32 (
- DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),
- (UINTN)DivU64x32 (TotalMemorySize, 16)
- );
- if (TestPercent != PreviousValue) {
- UnicodeValueToString (StrPercent, 0, TestPercent, 0);
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
- TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));
- if (TmpStr != NULL) {
- BdsLibOutputStrings (gST->ConOut, StrPercent, TmpStr, NULL);
- gBS->FreePool (TmpStr);
- }
-
- TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (
- Foreground,
- Background,
- TmpStr,
- Color,
- TestPercent,
- (UINTN) PreviousValue
- );
- gBS->FreePool (TmpStr);
- }
- }
-
- PreviousValue = TestPercent;
-
- KeyStatus = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (Key.ScanCode == SCAN_ESC) {
- if (!RequireSoftECCInit) {
- TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (
- Foreground,
- Background,
- TmpStr,
- Color,
- 100,
- (UINTN) PreviousValue
- );
- gBS->FreePool (TmpStr);
- }
-
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
- gST->ConOut->OutputString (gST->ConOut, L"100");
- Status = GenMemoryTest->Finished (GenMemoryTest);
- goto Done;
- }
-
- TestAbort = TRUE;
- }
- } while (Status != EFI_NOT_FOUND);
-
- Status = GenMemoryTest->Finished (GenMemoryTest);
-
-Done:
- UnicodeValueToString (StrTotalMemory, COMMA_TYPE, (UINTN) TotalMemorySize, 0);
- if (StrTotalMemory[0] == L',') {
- StrTotalMemory++;
- }
-
- TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));
- if (TmpStr != NULL) {
- StrCat (StrTotalMemory, TmpStr);
- gBS->FreePool (TmpStr);
- }
-
- gST->ConOut->ClearScreen (gST->ConOut);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
- gST->ConOut->EnableCursor (gST->ConOut, FALSE);
- gST->ConOut->OutputString (gST->ConOut, StrTotalMemory);
- PlatformBdsShowProgress (
- Foreground,
- Background,
- StrTotalMemory,
- Color,
- 100,
- (UINTN) PreviousValue
- );
-
- gBS->FreePool (Pos);
-
- DataSize = sizeof (Value);
- Status = gRT->GetVariable (
- L"BootState",
- &gEfiBootStateGuid,
- NULL,
- &DataSize,
- &Value
- );
-
- if (EFI_ERROR (Status)) {
- Value = 1;
- gRT->SetVariable (
- L"BootState",
- &gEfiBootStateGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof (Value),
- &Value
- );
- }
-
- return ReturnStatus;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.c
deleted file mode 100644
index 1b04f02..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- string.c
-
-Abstract:
-
- String support
-
-Revision History
-
---*/
-
-#include "Bds.h"
-#include "String.h"
-#include "Language.h"
-
-extern UINT8 EdkGenericPlatformBdsLibStrings[];
-
-EFI_GUID gBdsStringPackGuid = { 0x7bac95d3, 0xddf, 0x42f3, {0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a} };
-
-EFI_HII_HANDLE gStringPackHandle;
-EFI_HII_PROTOCOL *Hii;
-
-EFI_STATUS
-InitializeStringSupport (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initialize HII global accessor for string support
-
-Arguments:
- None
-
-Returns:
- String from ID.
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGES *PackageList;
- //
- // There should only ever be one HII protocol
- //
- Status = gBS->LocateProtocol (
- &gEfiHiiProtocolGuid,
- NULL,
- (VOID**)&Hii
- );
- if (!EFI_ERROR (Status)) {
- PackageList = PreparePackages (1, &gBdsStringPackGuid, EdkGenericPlatformBdsLibStrings);
- Status = Hii->NewPack (Hii, PackageList, &gStringPackHandle);
- gBS->FreePool (PackageList);
- }
-
- return Status;
-}
-
-CHAR16 *
-GetStringById (
- IN STRING_REF Id
- )
-/*++
-
-Routine Description:
-
- Get string by string id from HII Interface
-
-Arguments:
-
- Id - String ID.
-
-Returns:
-
- CHAR16 * - String from ID.
- NULL - If error occurs.
-
---*/
-{
- CHAR16 *String;
- UINTN StringLength;
- EFI_STATUS Status;
-
- //
- // Set default string size assumption at no more than 256 bytes
- //
- StringLength = 0x100;
-
- String = AllocateZeroPool (StringLength);
- if (String == NULL) {
- //
- // If this happens, we are oh-so-dead, but return a NULL in any case.
- //
- return NULL;
- }
- //
- // Get the current string for the current Language
- //
- Status = Hii->GetString (Hii, gStringPackHandle, Id, FALSE, NULL, &StringLength, String);
- if (EFI_ERROR (Status)) {
- if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // Free the old pool
- //
- gBS->FreePool (String);
-
- //
- // Allocate new pool with correct value
- //
- String = AllocatePool (StringLength);
- ASSERT (String != NULL);
-
- Status = Hii->GetString (Hii, gStringPackHandle, Id, FALSE, NULL, &StringLength, String);
- if (!EFI_ERROR (Status)) {
- return String;
- }
- }
-
- return NULL;
- }
-
- return String;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.h
deleted file mode 100644
index da6a912..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- string.h
-
-Abstract:
-
- String support
-
-Revision History
-
---*/
-
-#ifndef _STRING_H_
-#define _STRING_H_
-
-//
-// This is the VFR compiler generated header file which defines the
-// string identifiers.
-//
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-
-//
-// String Definition Guid for BDS Platform
-//
-#define EFI_BDS_PLATFORM_GUID \
- { \
- 0x7777E939, 0xD57E, 0x4DCB, {0xA0, 0x8E, 0x64, 0xD7, 0x98, 0x57, 0x1E, 0x0F } \
- }
-
-extern EFI_HII_HANDLE gStringPackHandle;
-extern EFI_HII_PROTOCOL *Hii;
-
-CHAR16 *
-GetStringById (
- IN STRING_REF Id
- );
-
-EFI_STATUS
-InitializeStringSupport (
- VOID
- );
-
-EFI_STATUS
-CallFrontPage (
- VOID
- );
-
-#endif // _STRING_H_
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Strings.uni b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Strings.uni
deleted file mode 100644
index 41a6b9a..0000000
--- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Strings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa b/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa
deleted file mode 100644
index 7bab912..0000000
--- a/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkGraphicsLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>08c1a0e4-1208-47f8-a2c5-f42eabee653a</GuidValue>
- <Version>1.0</Version>
- <Abstract>Graphics Library for UEFI drivers</Abstract>
- <Description>This library provides supports for basic graphic functions.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkGraphicsLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkGraphicsLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Graphics.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiOEMBadgingProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiFirmwareVolumeProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiConsoleControlProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c b/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
deleted file mode 100644
index e718ad3..0000000
--- a/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c
+++ /dev/null
@@ -1,865 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Graphics.c
-
-Abstract:
-
- Support for Basic Graphics operations.
-
- BugBug: Currently *.BMP files are supported. This will be replaced
- when Tiano graphics format is supported.
-
---*/
-
-
-EFI_STATUS
-GetGraphicsBitMapFromFV (
- IN EFI_GUID *FileNameGuid,
- OUT VOID **Image,
- OUT UINTN *ImageSize
- )
-/*++
-
-Routine Description:
-
- Return the graphics image file named FileNameGuid into Image and return it's
- size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
- file name.
-
-Arguments:
-
- FileNameGuid - File Name of graphics file in the FV(s).
-
- Image - Pointer to pointer to return graphics image. If NULL, a
- buffer will be allocated.
-
- ImageSize - Size of the graphics Image in bytes. Zero if no image found.
-
-
-Returns:
-
- EFI_SUCCESS - Image and ImageSize are valid.
- EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size
- EFI_NOT_FOUND - FileNameGuid not found
-
---*/
-{
- EFI_STATUS Status;
- UINTN FvProtocolCount;
- EFI_HANDLE *FvHandles;
- EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
- UINTN Index;
- UINT32 AuthenticationStatus;
-
-
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolumeProtocolGuid,
- NULL,
- &FvProtocolCount,
- &FvHandles
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- for (Index = 0; Index < FvProtocolCount; Index++) {
- Status = gBS->HandleProtocol (
- FvHandles[Index],
- &gEfiFirmwareVolumeProtocolGuid,
- (VOID **) &Fv
- );
-
- //
- // Assuming Image and ImageSize are correct on input.
- //
- Status = Fv->ReadSection (
- Fv,
- FileNameGuid,
- EFI_SECTION_RAW,
- 0,
- Image,
- ImageSize,
- &AuthenticationStatus
- );
- if (!EFI_ERROR (Status)) {
- return EFI_SUCCESS;
- } else if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // ImageSize updated to needed size so return
- //
- return EFI_BUFFER_TOO_SMALL;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-STATIC
-EFI_STATUS
-ConvertBmpToGopBlt (
- IN VOID *BmpImage,
- IN UINTN BmpImageSize,
- IN OUT VOID **GopBlt,
- IN OUT UINTN *GopBltSize,
- OUT UINTN *PixelHeight,
- OUT UINTN *PixelWidth
- )
-/*++
-
-Routine Description:
-
- Convert a *.BMP graphics image to a UGA blt buffer. If a NULL UgaBlt buffer
- is passed in a UgaBlt buffer will be allocated by this routine. If a UgaBlt
- buffer is passed in it will be used if it is big enough.
-
-Arguments:
-
- BmpImage - Pointer to BMP file
-
- BmpImageSize - Number of bytes in BmpImage
-
- UgaBlt - Buffer containing UGA version of BmpImage.
-
- UgaBltSize - Size of UgaBlt in bytes.
-
- PixelHeight - Height of UgaBlt/BmpImage in pixels
-
- PixelWidth - Width of UgaBlt/BmpImage in pixels
-
-
-Returns:
-
- EFI_SUCCESS - UgaBlt and UgaBltSize are returned.
- EFI_UNSUPPORTED - BmpImage is not a valid *.BMP image
- EFI_BUFFER_TOO_SMALL - The passed in UgaBlt buffer is not big enough.
- UgaBltSize will contain the required size.
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
---*/
-{
- UINT8 *Image;
- UINT8 *ImageHeader;
- BMP_IMAGE_HEADER *BmpHeader;
- BMP_COLOR_MAP *BmpColorMap;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
- UINTN BltBufferSize;
- UINTN Index;
- UINTN Height;
- UINTN Width;
- UINTN ImageIndex;
- BOOLEAN IsAllocated;
-
- BmpHeader = (BMP_IMAGE_HEADER *) BmpImage;
- if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
- return EFI_UNSUPPORTED;
- }
-
- if (BmpHeader->CompressionType != 0) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Calculate Color Map offset in the image.
- //
- Image = BmpImage;
- BmpColorMap = (BMP_COLOR_MAP *) (Image + sizeof (BMP_IMAGE_HEADER));
-
- //
- // Calculate graphics image data address in the image
- //
- Image = ((UINT8 *) BmpImage) + BmpHeader->ImageOffset;
- ImageHeader = Image;
-
- BltBufferSize = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
- IsAllocated = FALSE;
- if (*GopBlt == NULL) {
- *GopBltSize = BltBufferSize;
- *GopBlt = AllocatePool (*GopBltSize);
- IsAllocated = TRUE;
- if (*GopBlt == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- } else {
- if (*GopBltSize < BltBufferSize) {
- *GopBltSize = BltBufferSize;
- return EFI_BUFFER_TOO_SMALL;
- }
- }
-
- *PixelWidth = BmpHeader->PixelWidth;
- *PixelHeight = BmpHeader->PixelHeight;
-
- //
- // Convert image from BMP to Blt buffer format
- //
- BltBuffer = *GopBlt;
- for (Height = 0; Height < BmpHeader->PixelHeight; Height++) {
- Blt = &BltBuffer[(BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];
- for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {
- switch (BmpHeader->BitPerPixel) {
- case 1:
- //
- // Convert 1bit BMP to 24-bit color
- //
- for (Index = 0; Index < 8 && Width < BmpHeader->PixelWidth; Index++) {
- Blt->Red = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Red;
- Blt->Green = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Green;
- Blt->Blue = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Blue;
- Blt++;
- Width++;
- }
-
- Blt --;
- Width --;
- break;
-
- case 4:
- //
- // Convert BMP Palette to 24-bit color
- //
- Index = (*Image) >> 4;
- Blt->Red = BmpColorMap[Index].Red;
- Blt->Green = BmpColorMap[Index].Green;
- Blt->Blue = BmpColorMap[Index].Blue;
- if (Width < (BmpHeader->PixelWidth - 1)) {
- Blt++;
- Width++;
- Index = (*Image) & 0x0f;
- Blt->Red = BmpColorMap[Index].Red;
- Blt->Green = BmpColorMap[Index].Green;
- Blt->Blue = BmpColorMap[Index].Blue;
- }
- break;
-
- case 8:
- //
- // Convert BMP Palette to 24-bit color
- //
- Blt->Red = BmpColorMap[*Image].Red;
- Blt->Green = BmpColorMap[*Image].Green;
- Blt->Blue = BmpColorMap[*Image].Blue;
- break;
-
- case 24:
- Blt->Blue = *Image++;
- Blt->Green = *Image++;
- Blt->Red = *Image;
- break;
-
- default:
- if (IsAllocated) {
- gBS->FreePool (*GopBlt);
- *GopBlt = NULL;
- }
- return EFI_UNSUPPORTED;
- break;
- };
-
- }
-
- ImageIndex = (UINTN) (Image - ImageHeader);
- if ((ImageIndex % 4) != 0) {
- //
- // Bmp Image starts each row on a 32-bit boundary!
- //
- Image = Image + (4 - (ImageIndex % 4));
- }
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-LockKeyboards (
- IN CHAR16 *Password
- )
-/*++
-
-Routine Description:
- Use Console Control Protocol to lock the Console In Spliter virtual handle.
- This is the ConInHandle and ConIn handle in the EFI system table. All key
- presses will be ignored until the Password is typed in. The only way to
- disable the password is to type it in to a ConIn device.
-
-Arguments:
- Password - Password used to lock ConIn device
-
-
-Returns:
-
- EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
- displayed.
- EFI_UNSUPPORTED - Logo not found
-
---*/
-{
- EFI_STATUS Status;
- EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
-
- Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = ConsoleControl->LockStdIn (ConsoleControl, Password);
- return Status;
-}
-
-
-EFI_STATUS
-EnableQuietBoot (
- IN EFI_GUID *LogoFile
- )
-/*++
-
-Routine Description:
-
- Use Console Control to turn off UGA based Simple Text Out consoles from going
- to the UGA device. Put up LogoFile on every UGA device that is a console
-
-Arguments:
-
- LogoFile - File name of logo to display on the center of the screen.
-
-
-Returns:
-
- EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
- displayed.
- EFI_UNSUPPORTED - Logo not found
-
---*/
-{
- EFI_STATUS Status;
- EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
- EFI_OEM_BADGING_PROTOCOL *Badging;
- UINT32 SizeOfX;
- UINT32 SizeOfY;
- INTN DestX;
- INTN DestY;
- UINT8 *ImageData;
- UINTN ImageSize;
- UINTN BltSize;
- UINT32 Instance;
- EFI_BADGING_FORMAT Format;
- EFI_BADGING_DISPLAY_ATTRIBUTE Attribute;
- UINTN CoordinateX;
- UINTN CoordinateY;
- UINTN Height;
- UINTN Width;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
-
- Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- UgaDraw = NULL;
- //
- // Try to open GOP first
- //
- Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
- if (EFI_ERROR(Status)) {
- GraphicsOutput = NULL;
- //
- // Open GOP failed, try to open UGA
- //
- Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- Badging = NULL;
- Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging);
-
- ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);
-
- if (GraphicsOutput != NULL) {
- SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
- SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
- } else {
- Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- Instance = 0;
- while (1) {
- ImageData = NULL;
- ImageSize = 0;
-
- if (Badging != NULL) {
- Status = Badging->GetImage (
- Badging,
- &Instance,
- &Format,
- &ImageData,
- &ImageSize,
- &Attribute,
- &CoordinateX,
- &CoordinateY
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Currently only support BMP format
- //
- if (Format != EfiBadgingFormatBMP) {
- gBS->FreePool (ImageData);
- continue;
- }
- } else {
- Status = GetGraphicsBitMapFromFV (LogoFile, (VOID **) &ImageData, &ImageSize);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- CoordinateX = 0;
- CoordinateY = 0;
- Attribute = EfiBadgingDisplayAttributeCenter;
- }
-
- Blt = NULL;
- BltSize = 0;
- Status = ConvertBmpToGopBlt (
- ImageData,
- ImageSize,
- (VOID**)&Blt,
- &BltSize,
- &Height,
- &Width
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (ImageData);
- if (Badging == NULL) {
- return Status;
- } else {
- continue;
- }
- }
-
- switch (Attribute) {
- case EfiBadgingDisplayAttributeLeftTop:
- DestX = CoordinateX;
- DestY = CoordinateY;
- break;
-
- case EfiBadgingDisplayAttributeCenterTop:
- DestX = (SizeOfX - Width) / 2;
- DestY = CoordinateY;
- break;
-
- case EfiBadgingDisplayAttributeRightTop:
- DestX = (SizeOfX - Width - CoordinateX);
- DestY = CoordinateY;;
- break;
-
- case EfiBadgingDisplayAttributeCenterRight:
- DestX = (SizeOfX - Width - CoordinateX);
- DestY = (SizeOfY - Height) / 2;
- break;
-
- case EfiBadgingDisplayAttributeRightBottom:
- DestX = (SizeOfX - Width - CoordinateX);
- DestY = (SizeOfY - Height - CoordinateY);
- break;
-
- case EfiBadgingDisplayAttributeCenterBottom:
- DestX = (SizeOfX - Width) / 2;
- DestY = (SizeOfY - Height - CoordinateY);
- break;
-
- case EfiBadgingDisplayAttributeLeftBottom:
- DestX = CoordinateX;
- DestY = (SizeOfY - Height - CoordinateY);
- break;
-
- case EfiBadgingDisplayAttributeCenterLeft:
- DestX = CoordinateX;
- DestY = (SizeOfY - Height) / 2;
- break;
-
- case EfiBadgingDisplayAttributeCenter:
- DestX = (SizeOfX - Width) / 2;
- DestY = (SizeOfY - Height) / 2;
- break;
-
- default:
- DestX = CoordinateX;
- DestY = CoordinateY;
- break;
- }
-
- if ((DestX >= 0) && (DestY >= 0)) {
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- Blt,
- EfiBltBufferToVideo,
- 0,
- 0,
- (UINTN) DestX,
- (UINTN) DestY,
- Width,
- Height,
- Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) Blt,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- (UINTN) DestX,
- (UINTN) DestY,
- Width,
- Height,
- Width * sizeof (EFI_UGA_PIXEL)
- );
- }
- }
-
- gBS->FreePool (ImageData);
- gBS->FreePool (Blt);
-
- if (Badging == NULL) {
- break;
- }
- }
-
- return Status;
-}
-
-
-EFI_STATUS
-DisableQuietBoot (
- VOID
- )
-/*++
-
-Routine Description:
-
- Use Console Control to turn on UGA based Simple Text Out consoles. The UGA
- Simple Text Out screens will now be synced up with all non UGA output devices
-
-Arguments:
-
- NONE
-
-Returns:
-
- EFI_SUCCESS - UGA devices are back in text mode and synced up.
- EFI_UNSUPPORTED - Logo not found
-
---*/
-{
- EFI_STATUS Status;
- EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
-
- Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- return ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
-}
-
-static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
- { 0x00, 0x00, 0x00, 0x00 },
- { 0x98, 0x00, 0x00, 0x00 },
- { 0x00, 0x98, 0x00, 0x00 },
- { 0x98, 0x98, 0x00, 0x00 },
- { 0x00, 0x00, 0x98, 0x00 },
- { 0x98, 0x00, 0x98, 0x00 },
- { 0x00, 0x98, 0x98, 0x00 },
- { 0x98, 0x98, 0x98, 0x00 },
- { 0x10, 0x10, 0x10, 0x00 },
- { 0xff, 0x10, 0x10, 0x00 },
- { 0x10, 0xff, 0x10, 0x00 },
- { 0xff, 0xff, 0x10, 0x00 },
- { 0x10, 0x10, 0xff, 0x00 },
- { 0xf0, 0x10, 0xff, 0x00 },
- { 0x10, 0xff, 0xff, 0x00 },
- { 0xff, 0xff, 0xff, 0x00 }
-};
-
-STATIC
-UINTN
-_IPrint (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
- IN EFI_UGA_DRAW_PROTOCOL *UgaDraw,
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto,
- IN UINTN X,
- IN UINTN Y,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
- IN CHAR16 *fmt,
- IN VA_LIST args
- )
-/*++
-
-Routine Description:
-
- Display string worker for: Print, PrintAt, IPrint, IPrintAt
-
-Arguments:
-
- GraphicsOutput - Graphics output protocol interface
-
- UgaDraw - UGA draw protocol interface
-
- Sto - Simple text out protocol interface
-
- X - X coordinate to start printing
-
- Y - Y coordinate to start printing
-
- Foreground - Foreground color
-
- Background - Background color
-
- fmt - Format string
-
- args - Print arguments
-
-Returns:
-
- EFI_SUCCESS - success
- EFI_OUT_OF_RESOURCES - out of resources
-
---*/
-{
- VOID *Buffer;
- EFI_STATUS Status;
- UINT16 GlyphWidth;
- UINT32 GlyphStatus;
- UINT16 StringIndex;
- UINTN Index;
- CHAR16 *UnicodeWeight;
- EFI_NARROW_GLYPH *Glyph;
- EFI_HII_PROTOCOL *Hii;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- UINTN BufferGlyphWidth;
-
- GlyphStatus = 0;
-
- //
- // For now, allocate an arbitrarily long buffer
- //
- Buffer = AllocateZeroPool (0x10000);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (GraphicsOutput != NULL) {
- HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
- VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
- } else {
- //
- // Get the current mode information from the UGA Draw Protocol
- //
- UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
- }
-
- LineBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_WIDTH * GLYPH_HEIGHT);
- if (LineBuffer == NULL) {
- gBS->FreePool (Buffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, (VOID **) &Hii);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- UnicodeVSPrint (Buffer, 0x10000, fmt, args);
-
- UnicodeWeight = (CHAR16 *) Buffer;
-
- for (Index = 0; UnicodeWeight[Index] != 0; Index++) {
- if (UnicodeWeight[Index] == CHAR_BACKSPACE ||
- UnicodeWeight[Index] == CHAR_LINEFEED ||
- UnicodeWeight[Index] == CHAR_CARRIAGE_RETURN) {
- UnicodeWeight[Index] = 0;
- }
- }
-
- for (Index = 0; Index < StrLen (Buffer); Index++) {
- StringIndex = (UINT16) Index;
- Status = Hii->GetGlyph (Hii, UnicodeWeight, &StringIndex, (UINT8 **) &Glyph, &GlyphWidth, &GlyphStatus);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- if (Foreground == NULL || Background == NULL) {
- Status = Hii->GlyphToBlt (
- Hii,
- (UINT8 *) Glyph,
- mEfiColors[Sto->Mode->Attribute & 0x0f],
- mEfiColors[Sto->Mode->Attribute >> 4],
- StrLen (Buffer),
- GlyphWidth,
- GLYPH_HEIGHT,
- &LineBuffer[Index * GLYPH_WIDTH]
- );
- } else {
- Status = Hii->GlyphToBlt (
- Hii,
- (UINT8 *) Glyph,
- *Foreground,
- *Background,
- StrLen (Buffer),
- GlyphWidth,
- GLYPH_HEIGHT,
- &LineBuffer[Index * GLYPH_WIDTH]
- );
- }
- }
-
- //
- // Blt a character to the screen
- //
- BufferGlyphWidth = GLYPH_WIDTH * StrLen (Buffer);
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- LineBuffer,
- EfiBltBufferToVideo,
- 0,
- 0,
- X,
- Y,
- BufferGlyphWidth,
- GLYPH_HEIGHT,
- BufferGlyphWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) LineBuffer,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- X,
- Y,
- BufferGlyphWidth,
- GLYPH_HEIGHT,
- BufferGlyphWidth * sizeof (EFI_UGA_PIXEL)
- );
- }
-
-Error:
- gBS->FreePool (LineBuffer);
- gBS->FreePool (Buffer);
- return Status;
-}
-
-
-UINTN
-PrintXY (
- IN UINTN X,
- IN UINTN Y,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
- IN CHAR16 *Fmt,
- ...
- )
-/*++
-
-Routine Description:
-
- Prints a formatted unicode string to the default console
-
-Arguments:
-
- X - X coordinate to start printing
-
- Y - Y coordinate to start printing
-
- ForeGround - Foreground color
-
- BackGround - Background color
-
- Fmt - Format string
-
- ... - Print arguments
-
-Returns:
-
- Length of string printed to the console
-
---*/
-{
- EFI_HANDLE Handle;
-
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto;
- EFI_STATUS Status;
- VA_LIST Args;
-
- VA_START (Args, Fmt);
-
- UgaDraw = NULL;
-
- Handle = gST->ConsoleOutHandle;
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **) &GraphicsOutput
- );
-
- if (EFI_ERROR (Status)) {
- GraphicsOutput = NULL;
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &Sto
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return _IPrint (GraphicsOutput, UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args);
-}
diff --git a/EdkModulePkg/Library/EdkIfrSupportLib/EdkIfrSupportLib.msa b/EdkModulePkg/Library/EdkIfrSupportLib/EdkIfrSupportLib.msa
deleted file mode 100644
index 87f4f74..0000000
--- a/EdkModulePkg/Library/EdkIfrSupportLib/EdkIfrSupportLib.msa
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkIfrSupportLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>ea55bada-d488-427b-9d2d-227e0aaa3707</GuidValue>
- <Version>1.0</Version>
- <Abstract>EDK Internal Form Refresentation Support Library Instance.</Abstract>
- <Description>The library instance provides common library routines help in
- IFR creation on-the-fly, HII variable access, HII database access, multi language supports.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkIfrSupportLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkIfrSupportLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>IfrCommon.c</Filename>
- <Filename>IfrOnTheFly.c</Filename>
- <Filename>IfrOpCodeCreation.c</Filename>
- <Filename>IfrVariable.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Variables>
- <Variable Usage="ALWAYS_CONSUMED">
- <VariableName>0x004C 0x0061 0x006E</VariableName>
- <GuidC_Name>gLanGuid</GuidC_Name>
- </Variable>
- </Variables>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiGlobalVariableGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>IfrLibConstruct</Constructor>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkIfrSupportLib/IfrCommon.c b/EdkModulePkg/Library/EdkIfrSupportLib/IfrCommon.c
deleted file mode 100644
index b2c9064..0000000
--- a/EdkModulePkg/Library/EdkIfrSupportLib/IfrCommon.c
+++ /dev/null
@@ -1,1000 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- IfrCommon.c
-
-Abstract:
-
- Common Library Routines to assist in IFR creation on-the-fly
-
-Revision History:
-
---*/
-
-EFI_STATUS
-EFIAPI
-IfrLibConstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetCurrentLanguage (
- OUT CHAR16 *Lang
- )
-/*++
-
-Routine Description:
-
- Determine what is the current language setting
-
-Arguments:
-
- Lang - Pointer of system language
-
-Returns:
-
- Status code
-
---*/
-{
- EFI_STATUS Status;
- UINTN Size;
- UINTN Index;
- CHAR8 Language[4];
-
- //
- // Getting the system language and placing it into our Global Data
- //
- Size = sizeof (Language);
-
- Status = gRT->GetVariable (
- (CHAR16 *) L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &Size,
- Language
- );
-
- if (EFI_ERROR (Status)) {
- AsciiStrCpy (Language, "eng");
- }
-
- for (Index = 0; Index < 3; Index++) {
- //
- // Bitwise AND ascii value with 0xDF yields an uppercase value.
- // Sign extend into a unicode value
- //
- Lang[Index] = (CHAR16) (Language[Index] & 0xDF);
- }
-
- //
- // Null-terminate the value
- //
- Lang[3] = (CHAR16) 0;
-
- return Status;
-}
-
-
-EFI_STATUS
-AddString (
- IN VOID *StringBuffer,
- IN CHAR16 *Language,
- IN CHAR16 *String,
- IN OUT STRING_REF *StringToken
- )
-/*++
-
-Routine Description:
-
- Add a string to the incoming buffer and return the token and offset data
-
-Arguments:
-
- StringBuffer - The incoming buffer
-
- Language - Currrent language
-
- String - The string to be added
-
- StringToken - The index where the string placed
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - String successfully added to the incoming buffer
-
---*/
-{
- EFI_HII_STRING_PACK *StringPack;
- EFI_HII_STRING_PACK *StringPackBuffer;
- VOID *NewBuffer;
- RELOFST *PackSource;
- RELOFST *PackDestination;
- UINT8 *Source;
- UINT8 *Destination;
- UINTN Index;
- BOOLEAN Finished;
- UINTN SizeofLanguage;
- UINTN SizeofString;
-
- StringPack = (EFI_HII_STRING_PACK *) StringBuffer;
- Finished = FALSE;
-
- //
- // Pre-allocate a buffer sufficient for us to work on.
- // We will use it as a destination scratch pad to build data on
- // and when complete shift the data back to the original buffer
- //
- NewBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE);
- if (NewBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- StringPackBuffer = (EFI_HII_STRING_PACK *) NewBuffer;
-
- //
- // StringPack is terminated with a length 0 entry
- //
- for (; StringPack->Header.Length != 0;) {
- //
- // If this stringpack's language is same as CurrentLanguage, use it
- //
- if (CompareMem ((VOID *) ((CHAR8 *) (StringPack) + StringPack->LanguageNameString), Language, 3) == 0) {
- //
- // We have some data in this string pack, copy the string package up to the string data
- //
- CopyMem (&StringPackBuffer->Header, &StringPack->Header, sizeof (StringPack));
-
- //
- // These are references in the structure to tokens, need to increase them by the space occupied by an additional StringPointer
- //
- StringPackBuffer->LanguageNameString = (UINT16) (StringPackBuffer->LanguageNameString + (UINT16) sizeof (RELOFST));
- StringPackBuffer->PrintableLanguageName = (UINT16) (StringPackBuffer->PrintableLanguageName + (UINT16) sizeof (RELOFST));
-
- PackSource = (RELOFST *) (StringPack + 1);
- PackDestination = (RELOFST *) (StringPackBuffer + 1);
- for (Index = 0; PackSource[Index] != 0x0000; Index++) {
- //
- // Copy the stringpointers from old to new buffer
- // remember that we are adding a string, so the string offsets will all go up by sizeof (RELOFST)
- //
- PackDestination[Index] = (UINT16) (PackDestination[Index] + sizeof (RELOFST));
- }
-
- //
- // Add a new stringpointer in the new buffer since we are adding a string. Null terminate it
- //
- PackDestination[Index] = (UINT16)(PackDestination[Index-1] +
- StrSize((CHAR16 *)((CHAR8 *)(StringPack) + PackSource[Index-1])));
- PackDestination[Index + 1] = (UINT16) 0;
-
- //
- // Index is the token value for the new string
- //
- *StringToken = (UINT16) Index;
-
- //
- // Source now points to the beginning of the old buffer strings
- // Destination now points to the beginning of the new buffer strings
- //
- Source = (UINT8 *) &PackSource[Index + 1];
- Destination = (UINT8 *) &PackDestination[Index + 2];
-
- //
- // This should copy all the strings from the old buffer to the new buffer
- //
- for (; Index != 0; Index--) {
- //
- // Copy Source string to destination buffer
- //
- StrCpy ((CHAR16 *) Destination, (CHAR16 *) Source);
-
- //
- // Adjust the source/destination to the next string location
- //
- Destination = Destination + StrSize ((CHAR16 *) Source);
- Source = Source + StrSize ((CHAR16 *) Source);
- }
-
- //
- // This copies the new string to the destination buffer
- //
- StrCpy ((CHAR16 *) Destination, (CHAR16 *) String);
-
- //
- // Adjust the size of the changed string pack by adding the size of the new string
- // along with the size of the additional offset entry for the new string
- //
- StringPackBuffer->Header.Length = (UINT32) ((UINTN) StringPackBuffer->Header.Length + StrSize (String) + sizeof (RELOFST));
-
- //
- // Advance the buffers to point to the next spots.
- //
- StringPackBuffer = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPackBuffer) + StringPackBuffer->Header.Length);
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + StringPack->Header.Length);
- Finished = TRUE;
- continue;
- }
- //
- // This isn't the language of the stringpack we were asked to add a string to
- // so we need to copy it to the new buffer.
- //
- CopyMem (&StringPackBuffer->Header, &StringPack->Header, StringPack->Header.Length);
-
- //
- // Advance the buffers to point to the next spots.
- //
- StringPackBuffer = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPackBuffer) + StringPack->Header.Length);
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + StringPack->Header.Length);
- }
-
- //
- // If we didn't copy the new data to a stringpack yet
- //
- if (!Finished) {
- PackDestination = (RELOFST *) (StringPackBuffer + 1);
- //
- // Pointing to a new string pack location
- //
- SizeofLanguage = StrSize (Language);
- SizeofString = StrSize (String);
- StringPackBuffer->Header.Length = (UINT32)
- (
- sizeof (EFI_HII_STRING_PACK) -
- sizeof (EFI_STRING) +
- sizeof (RELOFST) +
- sizeof (RELOFST) +
- SizeofLanguage +
- SizeofString
- );
- StringPackBuffer->Header.Type = EFI_HII_STRING;
- StringPackBuffer->LanguageNameString = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer);
- StringPackBuffer->PrintableLanguageName = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer);
- StringPackBuffer->Attributes = 0;
- PackDestination[0] = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer);
- PackDestination[1] = (UINT16) (PackDestination[0] + StrSize (Language));
- PackDestination[2] = (UINT16) 0;
-
- //
- // The first string location will be set to destination. The minimum number of strings
- // associated with a stringpack will always be token 0 stored as the languagename (e.g. ENG, SPA, etc)
- // and token 1 as the new string being added and and null entry for the stringpointers
- //
- Destination = (UINT8 *) &PackDestination[3];
-
- //
- // Copy the language name string to the new buffer
- //
- StrCpy ((CHAR16 *) Destination, Language);
-
- //
- // Advance the destination to the new empty spot
- //
- Destination = Destination + StrSize (Language);
-
- //
- // Copy the string to the new buffer
- //
- StrCpy ((CHAR16 *) Destination, String);
-
- //
- // Since we are starting with a new string pack - we know the new string is token 1
- //
- *StringToken = (UINT16) 1;
- }
-
- //
- // Zero out the original buffer and copy the updated data in the new buffer to the old buffer
- //
- ZeroMem (StringBuffer, DEFAULT_STRING_BUFFER_SIZE);
- CopyMem (StringBuffer, NewBuffer, DEFAULT_STRING_BUFFER_SIZE);
-
- //
- // Free the newly created buffer since we don't need it anymore
- //
- gBS->FreePool (NewBuffer);
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-AddOpCode (
- IN VOID *FormBuffer,
- IN OUT VOID *OpCodeData
- )
-/*++
-
-Routine Description:
-
- Add op-code data to the FormBuffer
-
-Arguments:
-
- FormBuffer - Form buffer to be inserted to
-
- OpCodeData - Op-code data to be inserted
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Op-code data successfully inserted
-
---*/
-{
- EFI_HII_PACK_HEADER *NewBuffer;
- UINT8 *Source;
- UINT8 *Destination;
-
- //
- // Pre-allocate a buffer sufficient for us to work on.
- // We will use it as a destination scratch pad to build data on
- // and when complete shift the data back to the original buffer
- //
- NewBuffer = AllocateZeroPool (DEFAULT_FORM_BUFFER_SIZE);
- if (NewBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Source = (UINT8 *) FormBuffer;
- Destination = (UINT8 *) NewBuffer;
-
- //
- // Copy the IFR Package header to the new buffer
- //
- CopyMem (Destination, Source, sizeof (EFI_HII_PACK_HEADER));
-
- //
- // Advance Source and Destination to next op-code
- //
- Source = Source + sizeof (EFI_HII_PACK_HEADER);
- Destination = Destination + sizeof (EFI_HII_PACK_HEADER);
-
- //
- // Copy data to the new buffer until we run into the end_form
- //
- for (; ((EFI_IFR_OP_HEADER *) Source)->OpCode != EFI_IFR_END_FORM_OP;) {
- //
- // If the this opcode is an end_form_set we better be creating and endform
- // Nonetheless, we will add data before the end_form_set. This also provides
- // for interesting behavior in the code we will run, but has no bad side-effects
- // since we will possibly do a 0 byte copy in this particular end-case.
- //
- if (((EFI_IFR_OP_HEADER *) Source)->OpCode == EFI_IFR_END_FORM_SET_OP) {
- break;
- }
-
- //
- // Copy data to new buffer
- //
- CopyMem (Destination, Source, ((EFI_IFR_OP_HEADER *) Source)->Length);
-
- //
- // Adjust Source/Destination to next op-code location
- //
- Destination = Destination + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;
- Source = Source + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;
- }
-
- //
- // Prior to the end_form is where we insert the new op-code data
- //
- CopyMem (Destination, OpCodeData, ((EFI_IFR_OP_HEADER *) OpCodeData)->Length);
- Destination = Destination + (UINTN) ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
-
- NewBuffer->Length = (UINT32) (NewBuffer->Length + (UINT32) (((EFI_IFR_OP_HEADER *) OpCodeData)->Length));
-
- //
- // Copy end-form data to new buffer
- //
- CopyMem (Destination, Source, ((EFI_IFR_OP_HEADER *) Source)->Length);
-
- //
- // Adjust Source/Destination to next op-code location
- //
- Destination = Destination + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;
- Source = Source + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;
-
- //
- // Copy end-formset data to new buffer
- //
- CopyMem (Destination, Source, ((EFI_IFR_OP_HEADER *) Source)->Length);
-
- //
- // Zero out the original buffer and copy the updated data in the new buffer to the old buffer
- //
- ZeroMem (FormBuffer, DEFAULT_FORM_BUFFER_SIZE);
- CopyMem (FormBuffer, NewBuffer, DEFAULT_FORM_BUFFER_SIZE);
-
- //
- // Free the newly created buffer since we don't need it anymore
- //
- gBS->FreePool (NewBuffer);
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-GetHiiInterface (
- OUT EFI_HII_PROTOCOL **Hii
- )
-/*++
-
-Routine Description:
-
- Get the HII protocol interface
-
-Arguments:
-
- Hii - HII protocol interface
-
-Returns:
-
- Status code
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // There should only be one HII protocol
- //
- Status = gBS->LocateProtocol (
- &gEfiHiiProtocolGuid,
- NULL,
- (VOID **) Hii
- );
-
- return Status;;
-}
-
-
-EFI_STATUS
-ExtractDataFromHiiHandle (
- IN EFI_HII_HANDLE HiiHandle,
- IN OUT UINT16 *ImageLength,
- OUT UINT8 *DefaultImage,
- OUT EFI_GUID *Guid
- )
-/*++
-
-Routine Description:
-
- Extract information pertaining to the HiiHandle
-
-Arguments:
-
- HiiHandle - Hii handle
-
- ImageLength - For input, length of DefaultImage;
- For output, length of actually required
-
- DefaultImage - Image buffer prepared by caller
-
- Guid - Guid information about the form
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_BUFFER_TOO_SMALL - DefualtImage has no enough ImageLength
-
- EFI_SUCCESS - Successfully extract data from Hii database.
-
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PROTOCOL *Hii;
- UINTN DataLength;
- UINT8 *RawData;
- UINT8 *OldData;
- UINTN Index;
- UINTN Temp;
- UINTN SizeOfNvStore;
- UINTN CachedStart;
-
- DataLength = DEFAULT_FORM_BUFFER_SIZE;
- SizeOfNvStore = 0;
- CachedStart = 0;
-
- Status = GetHiiInterface (&Hii);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Allocate space for retrieval of IFR data
- //
- RawData = AllocateZeroPool (DataLength);
- if (RawData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Get all the forms associated with this HiiHandle
- //
- Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData);
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (RawData);
-
- //
- // Allocate space for retrieval of IFR data
- //
- RawData = AllocateZeroPool (DataLength);
- if (RawData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Get all the forms associated with this HiiHandle
- //
- Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData);
- }
-
- OldData = RawData;
-
- //
- // Point RawData to the beginning of the form data
- //
- RawData = (UINT8 *) ((UINTN) RawData + sizeof (EFI_HII_PACK_HEADER));
-
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- switch (RawData[Index]) {
- case EFI_IFR_FORM_SET_OP:
- //
- // Copy the GUID information from this handle
- //
- CopyMem (Guid, &((EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));
- break;
-
- case EFI_IFR_ONE_OF_OP:
- case EFI_IFR_CHECKBOX_OP:
- case EFI_IFR_NUMERIC_OP:
- case EFI_IFR_DATE_OP:
- case EFI_IFR_TIME_OP:
- case EFI_IFR_PASSWORD_OP:
- case EFI_IFR_STRING_OP:
- //
- // Remember, multiple op-codes may reference the same item, so let's keep a running
- // marker of what the highest QuestionId that wasn't zero length. This will accurately
- // maintain the Size of the NvStore
- //
- if (((EFI_IFR_ONE_OF *) &RawData[Index])->Width != 0) {
- Temp = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;
- if (SizeOfNvStore < Temp) {
- SizeOfNvStore = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;
- }
- }
- }
-
- Index = RawData[Index + 1] + Index;
- }
-
- //
- // Return an error if buffer is too small
- //
- if (SizeOfNvStore > *ImageLength) {
- gBS->FreePool (OldData);
- *ImageLength = (UINT16) SizeOfNvStore;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- if (DefaultImage != NULL) {
- ZeroMem (DefaultImage, SizeOfNvStore);
- }
-
- //
- // Copy the default image information to the user's buffer
- //
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- switch (RawData[Index]) {
- case EFI_IFR_ONE_OF_OP:
- CachedStart = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId;
- break;
-
- case EFI_IFR_ONE_OF_OPTION_OP:
- if (((EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Flags & EFI_IFR_FLAG_DEFAULT) {
- CopyMem (&DefaultImage[CachedStart], &((EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Value, 2);
- }
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- DefaultImage[((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId] = ((EFI_IFR_CHECKBOX *) &RawData[Index])->Flags;
- break;
-
- case EFI_IFR_NUMERIC_OP:
- CopyMem (
- &DefaultImage[((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId],
- &((EFI_IFR_NUMERIC *) &RawData[Index])->Default,
- 2
- );
- break;
-
- }
-
- Index = RawData[Index + 1] + Index;
- }
-
- *ImageLength = (UINT16) SizeOfNvStore;
-
- //
- // Free our temporary repository of form data
- //
- gBS->FreePool (OldData);
-
- return EFI_SUCCESS;
-}
-
-
-EFI_HII_HANDLE
-FindHiiHandle (
- IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL
- IN EFI_GUID *Guid
- )
-/*++
-
-Routine Description:
- Finds HII handle for given pack GUID previously registered with the HII.
-
-Arguments:
- HiiProtocol - pointer to pointer to HII protocol interface.
- If NULL, the interface will be found but not returned.
- If it points to NULL, the interface will be found and
- written back to the pointer that is pointed to.
- Guid - The GUID of the pack that registered with the HII.
-
-Returns:
- Handle to the HII pack previously registered by the memory driver.
-
---*/
-{
- EFI_STATUS Status;
-
- EFI_HII_HANDLE *HiiHandleBuffer;
- EFI_HII_HANDLE HiiHandle;
- UINT16 HiiHandleBufferLength;
- UINT32 NumberOfHiiHandles;
- EFI_GUID HiiGuid;
- EFI_HII_PROTOCOL *HiiProt;
- UINT32 Index;
- UINT16 Length;
-
- HiiHandle = 0;
- if ((HiiProtocol != NULL) && (*HiiProtocol != NULL)) {
- //
- // The protocol has been passed in
- //
- HiiProt = *HiiProtocol;
- } else {
- gBS->LocateProtocol (
- &gEfiHiiProtocolGuid,
- NULL,
- (VOID **) &HiiProt
- );
- if (HiiProt == NULL) {
- return HiiHandle;
- }
-
- if (HiiProtocol != NULL) {
- //
- // Return back the HII protocol for the caller as promissed
- //
- *HiiProtocol = HiiProt;
- }
- }
- //
- // Allocate buffer
- //
- HiiHandleBufferLength = 10;
- HiiHandleBuffer = AllocatePool (HiiHandleBufferLength);
- ASSERT (HiiHandleBuffer != NULL);
-
- //
- // Get the Handles of the packages that were registered with Hii
- //
- Status = HiiProt->FindHandles (
- HiiProt,
- &HiiHandleBufferLength,
- HiiHandleBuffer
- );
-
- //
- // Get a bigger bugffer if this one is to small, and try again
- //
- if (Status == EFI_BUFFER_TOO_SMALL) {
-
- gBS->FreePool (HiiHandleBuffer);
-
- HiiHandleBuffer = AllocatePool (HiiHandleBufferLength);
- ASSERT (HiiHandleBuffer != NULL);
-
- Status = HiiProt->FindHandles (
- HiiProt,
- &HiiHandleBufferLength,
- HiiHandleBuffer
- );
- }
-
- if (EFI_ERROR (Status)) {
- goto lbl_exit;
- }
-
- NumberOfHiiHandles = HiiHandleBufferLength / sizeof (EFI_HII_HANDLE);
-
- //
- // Iterate Hii handles and look for the one that matches our Guid
- //
- for (Index = 0; Index < NumberOfHiiHandles; Index++) {
-
- Length = 0;
- ExtractDataFromHiiHandle (HiiHandleBuffer[Index], &Length, NULL, &HiiGuid);
-
- if (CompareGuid (&HiiGuid, Guid)) {
-
- HiiHandle = HiiHandleBuffer[Index];
- break;
- }
- }
-
-lbl_exit:
- gBS->FreePool (HiiHandleBuffer);
- return HiiHandle;
-}
-
-
-EFI_STATUS
-ValidateDataFromHiiHandle (
- IN EFI_HII_HANDLE HiiHandle,
- OUT BOOLEAN *Results
- )
-/*++
-
-Routine Description:
-
- Validate that the data associated with the HiiHandle in NVRAM is within
- the reasonable parameters for that FormSet. Values for strings and passwords
- are not verified due to their not having the equivalent of valid range settings.
-
-Arguments:
-
- HiiHandle - Handle of the HII database entry to query
-
- Results - If return Status is EFI_SUCCESS, Results provides valid data
- TRUE = NVRAM Data is within parameters
- FALSE = NVRAM Data is NOT within parameters
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Data successfully validated
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PROTOCOL *Hii;
- EFI_GUID Guid;
- UINT8 *RawData;
- UINT8 *OldData;
- UINTN RawDataLength;
- UINT8 *VariableData;
- UINTN Index;
- UINTN Temp;
- UINTN SizeOfNvStore;
- UINTN CachedStart;
- BOOLEAN GotMatch;
-
- RawDataLength = DEFAULT_FORM_BUFFER_SIZE;
- SizeOfNvStore = 0;
- CachedStart = 0;
- GotMatch = FALSE;
- *Results = TRUE;
-
- Status = GetHiiInterface (&Hii);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Allocate space for retrieval of IFR data
- //
- RawData = AllocateZeroPool (RawDataLength);
- if (RawData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Get all the forms associated with this HiiHandle
- //
- Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData);
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (RawData);
-
- //
- // Allocate space for retrieval of IFR data
- //
- RawData = AllocateZeroPool (RawDataLength);
- if (RawData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Get all the forms associated with this HiiHandle
- //
- Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData);
- }
-
- OldData = RawData;
-
- //
- // Point RawData to the beginning of the form data
- //
- RawData = (UINT8 *) ((UINTN) RawData + sizeof (EFI_HII_PACK_HEADER));
-
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- if (RawData[Index] == EFI_IFR_FORM_SET_OP) {
- CopyMem (&Guid, &((EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));
- break;
- }
-
- Index = RawData[Index + 1] + Index;
- }
-
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- switch (RawData[Index]) {
- case EFI_IFR_FORM_SET_OP:
- break;
-
- case EFI_IFR_ONE_OF_OP:
- case EFI_IFR_CHECKBOX_OP:
- case EFI_IFR_NUMERIC_OP:
- case EFI_IFR_DATE_OP:
- case EFI_IFR_TIME_OP:
- case EFI_IFR_PASSWORD_OP:
- case EFI_IFR_STRING_OP:
- //
- // Remember, multiple op-codes may reference the same item, so let's keep a running
- // marker of what the highest QuestionId that wasn't zero length. This will accurately
- // maintain the Size of the NvStore
- //
- if (((EFI_IFR_ONE_OF *) &RawData[Index])->Width != 0) {
- Temp = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;
- if (SizeOfNvStore < Temp) {
- SizeOfNvStore = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;
- }
- }
- }
-
- Index = RawData[Index + 1] + Index;
- }
-
- //
- // Allocate memory for our File Form Tags
- //
- VariableData = AllocateZeroPool (SizeOfNvStore);
- if (VariableData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gRT->GetVariable (
- (CHAR16 *) L"Setup",
- &Guid,
- NULL,
- &SizeOfNvStore,
- (VOID *) VariableData
- );
-
- if (EFI_ERROR (Status)) {
-
- //
- // If there is a variable that exists already and it is larger than what we calculated the
- // storage needs to be, we must assume the variable size from GetVariable is correct and not
- // allow the truncation of the variable. It is very possible that the user who created the IFR
- // we are cracking is not referring to a variable that was in a previous map, however we cannot
- // allow it's truncation.
- //
- if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // Free the buffer that was allocated that was too small
- //
- gBS->FreePool (VariableData);
-
- VariableData = AllocatePool (SizeOfNvStore);
- if (VariableData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gRT->GetVariable (
- (CHAR16 *) L"Setup",
- &Guid,
- NULL,
- &SizeOfNvStore,
- (VOID *) VariableData
- );
- }
- }
-
- //
- // Walk through the form and see that the variable data it refers to is ok.
- // This allows for the possibility of stale (obsoleted) data in the variable
- // can be overlooked without causing an error
- //
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- switch (RawData[Index]) {
- case EFI_IFR_ONE_OF_OP:
- //
- // A one_of has no data, its the option that does - cache the storage Id
- //
- CachedStart = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId;
- break;
-
- case EFI_IFR_ONE_OF_OPTION_OP:
- //
- // A one_of_option can be any value
- //
- if (VariableData[CachedStart] == ((EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Value) {
- GotMatch = TRUE;
- }
- break;
-
- case EFI_IFR_END_ONE_OF_OP:
- //
- // At this point lets make sure that the data value in the NVRAM matches one of the options
- //
- if (!GotMatch) {
- *Results = FALSE;
- return EFI_SUCCESS;
- }
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- //
- // A checkbox is a boolean, so 0 and 1 are valid
- // Remember, QuestionId corresponds to the offset location of the data in the variable
- //
- if (VariableData[((EFI_IFR_CHECKBOX *) &RawData[Index])->QuestionId] > 1) {
- *Results = FALSE;
- return EFI_SUCCESS;
- }
- break;
-
- case EFI_IFR_NUMERIC_OP:
- if ((VariableData[((EFI_IFR_NUMERIC *)&RawData[Index])->QuestionId] < ((EFI_IFR_NUMERIC *)&RawData[Index])->Minimum) ||
- (VariableData[((EFI_IFR_NUMERIC *)&RawData[Index])->QuestionId] > ((EFI_IFR_NUMERIC *)&RawData[Index])->Maximum)) {
- *Results = FALSE;
- return EFI_SUCCESS;
- }
- break;
-
- }
-
- Index = RawData[Index + 1] + Index;
- }
-
- //
- // Free our temporary repository of form data
- //
- gBS->FreePool (OldData);
- gBS->FreePool (VariableData);
-
- return EFI_SUCCESS;
-}
-
diff --git a/EdkModulePkg/Library/EdkIfrSupportLib/IfrOnTheFly.c b/EdkModulePkg/Library/EdkIfrSupportLib/IfrOnTheFly.c
deleted file mode 100644
index e3d1040..0000000
--- a/EdkModulePkg/Library/EdkIfrSupportLib/IfrOnTheFly.c
+++ /dev/null
@@ -1,972 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- IfrOnTheFly.c
-
-Abstract:
-
- Library Routines to create IFR on-the-fly
-
-Revision History:
-
---*/
-
-EFI_STATUS
-CreateFormSet (
- IN CHAR16 *FormSetTitle,
- IN EFI_GUID *Guid,
- IN UINT8 Class,
- IN UINT8 SubClass,
- IN OUT VOID **FormBuffer,
- IN OUT VOID **StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a formset
-
-Arguments:
-
- FormSetTitle - Title of formset
-
- Guid - Guid of formset
-
- Class - Class of formset
-
- SubClass - Sub class of formset
-
- FormBuffer - Pointer of the formset created
-
- StringBuffer - Pointer of FormSetTitile string created
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Formset successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_IFR_PACK IfrPack;
- EFI_IFR_FORM_SET FormSet;
- EFI_IFR_END_FORM_SET EndFormSet;
- UINT8 *Destination;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Pre-allocate a buffer sufficient for us to work from.
- //
- FormBuffer = AllocateZeroPool (DEFAULT_FORM_BUFFER_SIZE);
- if (FormBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Pre-allocate a buffer sufficient for us to work from.
- //
- StringBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE);
- if (StringBuffer == NULL) {
- gBS->FreePool (FormBuffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add the FormSetTitle to the string buffer and get the StringToken
- //
- Status = AddString (*StringBuffer, CurrentLanguage, FormSetTitle, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Initialize the Ifr Package header data
- //
- IfrPack.Header.Length = sizeof (EFI_HII_PACK_HEADER) + sizeof (EFI_IFR_FORM_SET) + sizeof (EFI_IFR_END_FORM_SET);
- IfrPack.Header.Type = EFI_HII_IFR;
-
- //
- // Initialize FormSet with the appropriate information
- //
- FormSet.Header.OpCode = EFI_IFR_FORM_SET_OP;
- FormSet.Header.Length = sizeof (EFI_IFR_FORM_SET);
- FormSet.FormSetTitle = StringToken;
- FormSet.Class = Class;
- FormSet.SubClass = SubClass;
- CopyMem (&FormSet.Guid, Guid, sizeof (EFI_GUID));
-
- //
- // Initialize the end formset data
- //
- EndFormSet.Header.Length = sizeof (EFI_IFR_END_FORM_SET);
- EndFormSet.Header.OpCode = EFI_IFR_END_FORM_SET_OP;
-
- Destination = (UINT8 *) *FormBuffer;
-
- //
- // Copy the formset/endformset data to the form buffer
- //
- CopyMem (Destination, &IfrPack, sizeof (EFI_HII_PACK_HEADER));
-
- Destination = Destination + sizeof (EFI_HII_PACK_HEADER);
-
- CopyMem (Destination, &FormSet, sizeof (EFI_IFR_FORM_SET));
-
- Destination = Destination + sizeof (EFI_IFR_FORM_SET);
-
- CopyMem (Destination, &EndFormSet, sizeof (EFI_IFR_END_FORM_SET));
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateForm (
- IN CHAR16 *FormTitle,
- IN UINT16 FormId,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a form
-
-Arguments:
-
- FormTitle - Title of the form
-
- FormId - Id of the form
-
- FormBuffer - Pointer of the form created
-
- StringBuffer - Pointer of FormTitil string created
-
-Returns:
-
- EFI_SUCCESS - Form successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_FORM Form;
- EFI_IFR_END_FORM EndForm;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- Status = AddString (StringBuffer, CurrentLanguage, FormTitle, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Form.Header.OpCode = EFI_IFR_FORM_OP;
- Form.Header.Length = sizeof (EFI_IFR_FORM);
- Form.FormId = FormId;
- Form.FormTitle = StringToken;
-
- Status = AddOpCode (FormBuffer, &Form);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- EndForm.Header.OpCode = EFI_IFR_END_FORM_OP;
- EndForm.Header.Length = sizeof (EFI_IFR_END_FORM);
-
- Status = AddOpCode (FormBuffer, &EndForm);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateSubTitle (
- IN CHAR16 *SubTitle,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a SubTitle
-
-Arguments:
-
- SubTitle - Sub title to be created
-
- FormBuffer - Where this subtitle to add to
-
- StringBuffer - String buffer created for subtitle
-
-Returns:
-
- EFI_SUCCESS - Subtitle successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_SUBTITLE Subtitle;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- Status = AddString (StringBuffer, CurrentLanguage, SubTitle, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Subtitle.Header.OpCode = EFI_IFR_SUBTITLE_OP;
- Subtitle.Header.Length = sizeof (EFI_IFR_SUBTITLE);
- Subtitle.SubTitle = StringToken;
-
- Status = AddOpCode (FormBuffer, &Subtitle);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateText (
- IN CHAR16 *String,
- IN CHAR16 *String2,
- IN CHAR16 *String3,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a line of text
-
-Arguments:
-
- String - First string of the text
-
- String2 - Second string of the text
-
- String3 - Help string of the text
-
- Flags - Flag of the text
-
- Key - Key of the text
-
- FormBuffer - The form where this text adds to
-
- StringBuffer - String buffer created for String, String2 and String3
-
-Returns:
-
- EFI_SUCCESS - Text successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_TEXT Text;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, String, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Text.Header.OpCode = EFI_IFR_TEXT_OP;
- Text.Header.Length = sizeof (EFI_IFR_TEXT);
- Text.Text = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, String2, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Text.TextTwo = StringToken;
-
- Text.Flags = (UINT8) (Flags | EFI_IFR_FLAG_CREATED);
- Text.Key = Key;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, String3, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Text.Help = StringToken;
-
- Status = AddOpCode (FormBuffer, &Text);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateGoto (
- IN UINT16 FormId,
- IN CHAR16 *Prompt,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a hyperlink
-
-Arguments:
-
- FormId - Form ID of the hyperlink
-
- Prompt - Prompt of the hyperlink
-
- FormBuffer - The form where this hyperlink adds to
-
- StringBuffer - String buffer created for Prompt
-
-Returns:
-
- EFI_SUCCESS - Hyperlink successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_REF Hyperlink;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Hyperlink.Header.OpCode = EFI_IFR_REF_OP;
- Hyperlink.Header.Length = sizeof (EFI_IFR_REF);
- Hyperlink.FormId = FormId;
- Hyperlink.Prompt = StringToken;
-
- Status = AddOpCode (FormBuffer, &Hyperlink);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateOneOf (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a one-of question with a set of options to choose from. The
- OptionsList is a pointer to a null-terminated list of option descriptions.
-
-Arguments:
-
- QuestionId - Question ID of the one-of box
-
- DataWidth - DataWidth of the one-of box
-
- Prompt - Prompt of the one-of box
-
- Help - Help of the one-of box
-
- OptionsList - Each string in it is an option of the one-of box
-
- OptionCount - Option string count
-
- FormBuffer - The form where this one-of box adds to
-
- StringBuffer - String buffer created for Prompt, Help and Option strings
-
-Returns:
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
- EFI_SUCCESS - One-Of box successfully created.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_IFR_ONE_OF OneOf;
- EFI_IFR_ONE_OF_OPTION OneOfOption;
- EFI_IFR_END_ONE_OF EndOneOf;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // We do not create op-code storage widths for one-of in excess of 16 bits for now
- //
- if (DataWidth > 2) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OneOf.Header.OpCode = EFI_IFR_ONE_OF_OP;
- OneOf.Header.Length = sizeof (EFI_IFR_ONE_OF);
- OneOf.QuestionId = QuestionId;
- OneOf.Width = DataWidth;
- OneOf.Prompt = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OneOf.Help = StringToken;
-
- Status = AddOpCode (FormBuffer, &OneOf);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < OptionCount; Index++) {
- OneOfOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
- OneOfOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
-
- //
- // Add string and get token back
- //
- Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);
-
- OneOfOption.Option = StringToken;
- OneOfOption.Value = OptionsList[Index].Value;
- OneOfOption.Flags = (UINT8) (OptionsList[Index].Flags | EFI_IFR_FLAG_CREATED);
- OneOfOption.Key = OptionsList[Index].Key;
-
- Status = AddOpCode (FormBuffer, &OneOfOption);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- EndOneOf.Header.Length = sizeof (EFI_IFR_END_ONE_OF);
- EndOneOf.Header.OpCode = EFI_IFR_END_ONE_OF_OP;
-
- Status = AddOpCode (FormBuffer, &EndOneOf);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CreateOrderedList (
- IN UINT16 QuestionId,
- IN UINT8 MaxEntries,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a one-of question with a set of options to choose from. The
- OptionsList is a pointer to a null-terminated list of option descriptions.
-
-Arguments:
-
- QuestionId - Question ID of the ordered list
-
- MaxEntries - MaxEntries of the ordered list
-
- Prompt - Prompt of the ordered list
-
- Help - Help of the ordered list
-
- OptionsList - Each string in it is an option of the ordered list
-
- OptionCount - Option string count
-
- FormBuffer - The form where this ordered list adds to
-
- StringBuffer - String buffer created for Prompt, Help and Option strings
-
-Returns:
-
- EFI_SUCCESS - Ordered list successfully created.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_IFR_ORDERED_LIST OrderedList;
- EFI_IFR_ONE_OF_OPTION OrderedListOption;
- EFI_IFR_END_ONE_OF EndOrderedList;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OrderedList.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;
- OrderedList.Header.Length = sizeof (EFI_IFR_ORDERED_LIST);
- OrderedList.QuestionId = QuestionId;
- OrderedList.MaxEntries = MaxEntries;
- OrderedList.Prompt = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OrderedList.Help = StringToken;
-
- Status = AddOpCode (FormBuffer, &OrderedList);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < OptionCount; Index++) {
- OrderedListOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
- OrderedListOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
-
- //
- // Add string and get token back
- //
- Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);
-
- OrderedListOption.Option = StringToken;
- OrderedListOption.Value = OptionsList[Index].Value;
- OrderedListOption.Flags = (UINT8) (OptionsList[Index].Flags | EFI_IFR_FLAG_CREATED);
- OrderedListOption.Key = OptionsList[Index].Key;
-
- Status = AddOpCode (FormBuffer, &OrderedListOption);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- EndOrderedList.Header.Length = sizeof (EFI_IFR_END_ONE_OF);
- EndOrderedList.Header.OpCode = EFI_IFR_END_ONE_OF_OP;
-
- Status = AddOpCode (FormBuffer, &EndOrderedList);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateCheckBox (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN UINT8 Flags,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a checkbox
-
-Arguments:
-
- QuestionId - Question ID of the check box
-
- DataWidth - DataWidth of the check box
-
- Prompt - Prompt of the check box
-
- Help - Help of the check box
-
- Flags - Flags of the check box
-
- FormBuffer - The form where this check box adds to
-
- StringBuffer - String buffer created for Prompt and Help.
-
-Returns:
-
- EFI_DEVICE_ERROR - DataWidth > 1
-
- EFI_SUCCESS - Check box successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_CHECKBOX CheckBox;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // We do not create op-code storage widths for checkbox in excess of 8 bits for now
- //
- if (DataWidth > 1) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- CheckBox.Header.OpCode = EFI_IFR_CHECKBOX_OP;
- CheckBox.Header.Length = sizeof (EFI_IFR_CHECKBOX);
- CheckBox.QuestionId = QuestionId;
- CheckBox.Width = DataWidth;
- CheckBox.Prompt = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- CheckBox.Help = StringToken;
- CheckBox.Flags = (UINT8) (Flags | EFI_IFR_FLAG_CREATED);
-
- Status = AddOpCode (FormBuffer, &CheckBox);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateNumeric (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN UINT16 Minimum,
- IN UINT16 Maximum,
- IN UINT16 Step,
- IN UINT16 Default,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a numeric
-
-Arguments:
-
- QuestionId - Question ID of the numeric
-
- DataWidth - DataWidth of the numeric
-
- Prompt - Prompt of the numeric
-
- Help - Help of the numeric
-
- Minimum - Minumun boundary of the numeric
-
- Maximum - Maximum boundary of the numeric
-
- Step - Step of the numeric
-
- Default - Default value
-
- Flags - Flags of the numeric
-
- Key - Key of the numeric
-
- FormBuffer - The form where this numeric adds to
-
- StringBuffer - String buffer created for Prompt and Help.
-
-Returns:
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
- EFI_SUCCESS - Numeric is successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_NUMERIC Numeric;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // We do not create op-code storage widths for numerics in excess of 16 bits for now
- //
- if (DataWidth > 2) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Numeric.Header.OpCode = EFI_IFR_NUMERIC_OP;
- Numeric.Header.Length = sizeof (EFI_IFR_NUMERIC);
- Numeric.QuestionId = QuestionId;
- Numeric.Width = DataWidth;
- Numeric.Prompt = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Numeric.Help = StringToken;
- Numeric.Minimum = Minimum;
- Numeric.Maximum = Maximum;
- Numeric.Step = Step;
- Numeric.Default = Default;
- Numeric.Flags = (UINT8) (Flags | EFI_IFR_FLAG_CREATED);
- Numeric.Key = Key;
-
- Status = AddOpCode (FormBuffer, &Numeric);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateString (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN UINT8 MinSize,
- IN UINT8 MaxSize,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a string
-
-Arguments:
-
- QuestionId - Question ID of the string
-
- DataWidth - DataWidth of the string
-
- Prompt - Prompt of the string
-
- Help - Help of the string
-
- MinSize - Min size boundary of the string
-
- MaxSize - Max size boundary of the string
-
- Flags - Flags of the string
-
- Key - Key of the string
-
- FormBuffer - The form where this string adds to
-
- StringBuffer - String buffer created for Prompt and Help.
-
-Returns:
-
- EFI_SUCCESS - String successfully created.
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_STRING String;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- String.Header.OpCode = EFI_IFR_STRING_OP;
- String.Header.Length = sizeof (EFI_IFR_STRING);
- String.QuestionId = QuestionId;
- String.Width = DataWidth;
- String.Prompt = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- String.Help = StringToken;
- String.MinSize = MinSize;
- String.MaxSize = MaxSize;
- String.Flags = (UINT8) (Flags | EFI_IFR_FLAG_CREATED);
- String.Key = Key;
-
- Status = AddOpCode (FormBuffer, &String);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Library/EdkIfrSupportLib/IfrOpCodeCreation.c b/EdkModulePkg/Library/EdkIfrSupportLib/IfrOpCodeCreation.c
deleted file mode 100644
index 6fb2be7..0000000
--- a/EdkModulePkg/Library/EdkIfrSupportLib/IfrOpCodeCreation.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- IfrOpCodeCreation.c
-
-Abstract:
-
- Library Routines to create IFR independent of string data - assume tokens already exist
- Primarily to be used for exporting op-codes at a label in pre-defined forms.
-
-Revision History:
-
---*/
-
-EFI_STATUS
-CreateSubTitleOpCode (
- IN STRING_REF StringToken,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a SubTitle opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- StringToken - StringToken of the subtitle
-
- FormBuffer - Output of subtitle as a form
-
-Returns:
-
- EFI_SUCCESS - Subtitle created to be a form
-
---*/
-{
- EFI_IFR_SUBTITLE Subtitle;
-
- Subtitle.Header.OpCode = EFI_IFR_SUBTITLE_OP;
- Subtitle.Header.Length = sizeof (EFI_IFR_SUBTITLE);
- Subtitle.SubTitle = StringToken;
-
- CopyMem (FormBuffer, &Subtitle, sizeof (EFI_IFR_SUBTITLE));
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateTextOpCode (
- IN STRING_REF StringToken,
- IN STRING_REF StringTokenTwo,
- IN STRING_REF StringTokenThree,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a Text opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- StringToken - First string token of the text
-
- StringTokenTwo - Second string token of the text
-
- StringTokenThree - Help string token of the text
-
- Flags - Flag of the text
-
- Key - Key of the text
-
- FormBuffer - Output of text as a form
-
-Returns:
-
- EFI_SUCCESS - Text created to be a form
-
---*/
-{
- EFI_IFR_TEXT Text;
-
- Text.Header.OpCode = EFI_IFR_TEXT_OP;
- Text.Header.Length = sizeof (EFI_IFR_TEXT);
- Text.Text = StringToken;
-
- Text.TextTwo = StringTokenTwo;
- Text.Help = StringTokenThree;
- Text.Flags = Flags;
- Text.Key = Key;
-
- CopyMem (FormBuffer, &Text, sizeof (EFI_IFR_TEXT));
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateGotoOpCode (
- IN UINT16 FormId,
- IN STRING_REF StringToken,
- IN STRING_REF StringTokenTwo,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a hyperlink opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- FormId - Form ID of the hyperlink
-
- StringToken - Prompt string token of the hyperlink
-
- StringTokenTwo - Help string token of the hyperlink
-
- Flags - Flags of the hyperlink
-
- Key - Key of the hyperlink
-
- FormBuffer - Output of hyperlink as a form
-
-Returns:
-
- EFI_SUCCESS - Hyperlink created to be a form
-
---*/
-{
- EFI_IFR_REF Hyperlink;
-
- Hyperlink.Header.OpCode = EFI_IFR_REF_OP;
- Hyperlink.Header.Length = sizeof (EFI_IFR_REF);
- Hyperlink.FormId = FormId;
- Hyperlink.Prompt = StringToken;
- Hyperlink.Help = StringTokenTwo;
- Hyperlink.Key = Key;
- Hyperlink.Flags = Flags;
-
- CopyMem (FormBuffer, &Hyperlink, sizeof (EFI_IFR_REF));
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateOneOfOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a one-of opcode with a set of option op-codes to choose from independent of string creation.
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
- OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken
- has been filled in since this routine will not generate StringToken values.
-
-Arguments:
-
- QuestionId - Question ID of the one-of box
-
- DataWidth - DataWidth of the one-of box
-
- PromptToken - Prompt string token of the one-of box
-
- HelpToken - Help string token of the one-of box
-
- OptionsList - Each string in it is an option of the one-of box
-
- OptionCount - Option string count
-
- FormBuffer - Output of One-Of box as a form
-
-Returns:
-
- EFI_SUCCESS - One-Of box created to be a form
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
---*/
-{
- UINTN Index;
- EFI_IFR_ONE_OF OneOf;
- EFI_IFR_ONE_OF_OPTION OneOfOption;
- EFI_IFR_END_ONE_OF EndOneOf;
- UINT8 *LocalBuffer;
-
- //
- // We do not create op-code storage widths for one-of in excess of 16 bits for now
- //
- if (DataWidth > 2) {
- return EFI_DEVICE_ERROR;
- }
-
- OneOf.Header.OpCode = EFI_IFR_ONE_OF_OP;
- OneOf.Header.Length = sizeof (EFI_IFR_ONE_OF);
- OneOf.QuestionId = QuestionId;
- OneOf.Width = DataWidth;
- OneOf.Prompt = PromptToken;
-
- OneOf.Help = HelpToken;
-
- LocalBuffer = (UINT8 *) FormBuffer;
-
- CopyMem (LocalBuffer, &OneOf, sizeof (EFI_IFR_ONE_OF));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_ONE_OF));
-
- for (Index = 0; Index < OptionCount; Index++) {
- OneOfOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
- OneOfOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
-
- OneOfOption.Option = OptionsList[Index].StringToken;
- OneOfOption.Value = OptionsList[Index].Value;
- OneOfOption.Flags = OptionsList[Index].Flags;
- OneOfOption.Key = OptionsList[Index].Key;
-
- CopyMem (LocalBuffer, &OneOfOption, sizeof (EFI_IFR_ONE_OF_OPTION));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_ONE_OF_OPTION));
- }
-
- EndOneOf.Header.Length = sizeof (EFI_IFR_END_ONE_OF);
- EndOneOf.Header.OpCode = EFI_IFR_END_ONE_OF_OP;
-
- CopyMem (LocalBuffer, &EndOneOf, sizeof (EFI_IFR_END_ONE_OF));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_END_ONE_OF));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CreateOrderedListOpCode (
- IN UINT16 QuestionId,
- IN UINT8 MaxEntries,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a ordered list opcode with a set of option op-codes to choose from independent of string creation.
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
- OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken
- has been filled in since this routine will not generate StringToken values.
-
-Arguments:
-
- QuestionId - Question ID of the ordered list
-
- MaxEntries - MaxEntries of the ordered list
-
- PromptToken - Prompt string token of the ordered list
-
- HelpToken - Help string token of the ordered list
-
- OptionsList - Each string in it is an option of the ordered list
-
- OptionCount - Option string count
-
- FormBuffer - Output of ordered list as a form
-
-Returns:
-
- EFI_SUCCESS - Ordered list created to be a form
-
---*/
-{
- UINTN Index;
- EFI_IFR_ORDERED_LIST OrderedList;
- EFI_IFR_ONE_OF_OPTION OrderedListOption;
- EFI_IFR_END_ONE_OF EndOrderedList;
- UINT8 *LocalBuffer;
-
- OrderedList.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;
- OrderedList.Header.Length = sizeof (EFI_IFR_ORDERED_LIST);
- OrderedList.QuestionId = QuestionId;
- OrderedList.MaxEntries = MaxEntries;
- OrderedList.Prompt = PromptToken;
-
- OrderedList.Help = HelpToken;
-
- LocalBuffer = (UINT8 *) FormBuffer;
-
- CopyMem (LocalBuffer, &OrderedList, sizeof (EFI_IFR_ORDERED_LIST));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_ORDERED_LIST));
-
- for (Index = 0; Index < OptionCount; Index++) {
- OrderedListOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
- OrderedListOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
-
- OrderedListOption.Option = OptionsList[Index].StringToken;
- OrderedListOption.Value = OptionsList[Index].Value;
- OrderedListOption.Flags = OptionsList[Index].Flags;
- OrderedListOption.Key = OptionsList[Index].Key;
-
- CopyMem (LocalBuffer, &OrderedListOption, sizeof (EFI_IFR_ONE_OF_OPTION));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_ONE_OF_OPTION));
- }
-
- EndOrderedList.Header.Length = sizeof (EFI_IFR_END_ONE_OF);
- EndOrderedList.Header.OpCode = EFI_IFR_END_ONE_OF_OP;
-
- CopyMem (LocalBuffer, &EndOrderedList, sizeof (EFI_IFR_END_ONE_OF));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_END_ONE_OF));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CreateCheckBoxOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a checkbox opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- QuestionId - Question ID of the check box
-
- DataWidth - DataWidth of the check box
-
- PromptToken - Prompt string token of the check box
-
- HelpToken - Help string token of the check box
-
- Flags - Flags of the check box
-
- Key - Key of the check box
-
- FormBuffer - Output of the check box as a form
-
-Returns:
-
- EFI_SUCCESS - Checkbox created to be a form
-
- EFI_DEVICE_ERROR - DataWidth > 1
-
---*/
-{
- EFI_IFR_CHECKBOX CheckBox;
-
- //
- // We do not create op-code storage widths for checkbox in excess of 8 bits for now
- //
- if (DataWidth > 1) {
- return EFI_DEVICE_ERROR;
- }
-
- CheckBox.Header.OpCode = EFI_IFR_CHECKBOX_OP;
- CheckBox.Header.Length = sizeof (EFI_IFR_CHECKBOX);
- CheckBox.QuestionId = QuestionId;
- CheckBox.Width = DataWidth;
- CheckBox.Prompt = PromptToken;
-
- CheckBox.Help = HelpToken;
- CheckBox.Flags = Flags;
- CheckBox.Key = Key;
-
- CopyMem (FormBuffer, &CheckBox, sizeof (EFI_IFR_CHECKBOX));
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateNumericOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN UINT16 Minimum,
- IN UINT16 Maximum,
- IN UINT16 Step,
- IN UINT16 Default,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a numeric opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- QuestionId - Question ID of the numeric
-
- DataWidth - DataWidth of the numeric
-
- PromptToken - Prompt string token of the numeric
-
- HelpToken - Help string token of the numeric
-
- Minimum - Minumun boundary of the numeric
-
- Maximum - Maximum boundary of the numeric
-
- Step - Step of the numeric
-
- Default - Default value of the numeric
-
- Flags - Flags of the numeric
-
- Key - Key of the numeric
-
- FormBuffer - Output of the numeric as a form
-
-Returns:
-
- EFI_SUCCESS - The numeric created to be a form.
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
---*/
-{
- EFI_IFR_NUMERIC Numeric;
-
- //
- // We do not create op-code storage widths for numerics in excess of 16 bits for now
- //
- if (DataWidth > 2) {
- return EFI_DEVICE_ERROR;
- }
-
- Numeric.Header.OpCode = EFI_IFR_NUMERIC_OP;
- Numeric.Header.Length = sizeof (EFI_IFR_NUMERIC);
- Numeric.QuestionId = QuestionId;
- Numeric.Width = DataWidth;
- Numeric.Prompt = PromptToken;
-
- Numeric.Help = HelpToken;
- Numeric.Minimum = Minimum;
- Numeric.Maximum = Maximum;
- Numeric.Step = Step;
- Numeric.Default = Default;
- Numeric.Flags = Flags;
- Numeric.Key = Key;
-
- CopyMem (FormBuffer, &Numeric, sizeof (EFI_IFR_NUMERIC));
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateStringOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN UINT8 MinSize,
- IN UINT8 MaxSize,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a numeric opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- QuestionId - Question ID of the string
-
- DataWidth - DataWidth of the string
-
- PromptToken - Prompt token of the string
-
- HelpToken - Help token of the string
-
- MinSize - Min size boundary of the string
-
- MaxSize - Max size boundary of the string
-
- Flags - Flags of the string
-
- Key - Key of the string
-
- FormBuffer - Output of the string as a form
-
-Returns:
-
- EFI_SUCCESS - String created to be a form.
-
---*/
-{
- EFI_IFR_STRING String;
-
- String.Header.OpCode = EFI_IFR_STRING_OP;
- String.Header.Length = sizeof (EFI_IFR_STRING);
- String.QuestionId = QuestionId;
- String.Width = DataWidth;
- String.Prompt = PromptToken;
-
- String.Help = HelpToken;
- String.MinSize = MinSize;
- String.MaxSize = MaxSize;
- String.Flags = Flags;
- String.Key = Key;
-
- CopyMem (FormBuffer, &String, sizeof (EFI_IFR_STRING));
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateBannerOpCode (
- IN UINT16 Title,
- IN UINT16 LineNumber,
- IN UINT8 Alignment,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a banner opcode. This is primarily used by the FrontPage implementation from BDS.
-
-Arguments:
-
- Title - Title of the banner
-
- LineNumber - LineNumber of the banner
-
- Alignment - Alignment of the banner
-
- FormBuffer - Output of banner as a form
-
-Returns:
-
- EFI_SUCCESS - Banner created to be a form.
-
---*/
-{
- EFI_IFR_BANNER Banner;
-
- Banner.Header.OpCode = EFI_IFR_BANNER_OP;
- Banner.Header.Length = sizeof (EFI_IFR_BANNER);
- CopyMem (&Banner.Title, &Title, sizeof (UINT16));
- CopyMem (&Banner.LineNumber, &LineNumber, sizeof (UINT16));
- Banner.Alignment = Alignment;
-
- CopyMem (FormBuffer, &Banner, sizeof (EFI_IFR_BANNER));
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Library/EdkIfrSupportLib/IfrVariable.c b/EdkModulePkg/Library/EdkIfrSupportLib/IfrVariable.c
deleted file mode 100644
index a4aab0f..0000000
--- a/EdkModulePkg/Library/EdkIfrSupportLib/IfrVariable.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- IfrVariable.c
-
-Abstract:
- Variable/Map manipulations routines
-
---*/
-
-VOID
-EfiLibHiiVariablePackGetMap (
- IN EFI_HII_VARIABLE_PACK *Pack,
- OUT CHAR16 **Name, OPTIONAL
- OUT EFI_GUID **Guid, OPTIONAL
- OUT UINT16 *Id, OPTIONAL
- OUT VOID **Var, OPTIONAL
- OUT UINTN *Size OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Extracts a variable form a Pack.
-
-Arguments:
-
- Pack - List of variables
- Name - Name of the variable/map
- Guid - GUID of the variable/map
- Var - Pointer to the variable/map
- Size - Size of the variable/map in bytes
-
-Returns:
-
- VOID
-
---*/
-{
- if (NULL != Name) {
- *Name = (VOID *) (Pack + 1);
- }
-
- if (NULL != Guid) {
- *Guid = (EFI_GUID *)(UINTN)&Pack->VariableGuid;
- }
-
-
- if (NULL != Id) {
- *Id = Pack->VariableId;
- }
-
- if (NULL != Var) {
- *Var = (VOID *) ((CHAR8 *) (Pack + 1) + Pack->VariableNameLength);
- }
-
- if (NULL != Size) {
- *Size = Pack->Header.Length - sizeof (*Pack) - Pack->VariableNameLength;
- }
-}
-
-
-UINTN
-EfiLibHiiVariablePackListGetMapCnt (
- IN EFI_HII_VARIABLE_PACK_LIST *List
- )
-
-/*++
-
-Routine Description:
-
- Finds a count of the variables/maps in the List.
-
-Arguments:
-
- List - List of variables
-
-Returns:
-
- UINTN - The number of map count.
-
---*/
-
-{
- UINTN Cnt = 0;
- while (NULL != List) {
- Cnt++;
- List = List->NextVariablePack;
- }
- return Cnt;
-}
-
-
-VOID
-EfiLibHiiVariablePackListForEachVar (
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback
- )
-/*++
-
-Routine Description:
-
- Will iterate all variable/maps as appearing
- in List and for each, it will call the Callback.
-
-Arguments:
-
- List - List of variables
- Callback - Routine to be called for each iterated variable.
-
-Returns:
-
- VOID
-
---*/
-
-{
- CHAR16 *MapName;
- EFI_GUID *MapGuid;
- UINT16 MapId;
- VOID *Map;
- UINTN MapSize;
-
- while (NULL != List) {
- EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize);
- //
- // call the callback
- //
- Callback (MapName, MapGuid, MapId, Map, MapSize);
- List = List->NextVariablePack;
- }
-}
-
-
-EFI_STATUS
-EfiLibHiiVariablePackListGetMapByIdx (
- IN UINTN Idx,
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- OUT CHAR16 **Name, OPTIONAL
- OUT EFI_GUID **Guid, OPTIONAL
- OUT UINT16 *Id, OPTIONAL
- OUT VOID **Var,
- OUT UINTN *Size
- )
-
-/*++
-
-Routine Description:
-
- Finds a variable form List given
- the order number as appears in the List.
-
-Arguments:
-
- Idx - The index of the variable/map to retrieve
- List - List of variables
- Name - Name of the variable/map
- Guid - GUID of the variable/map
- Var - Pointer to the variable/map
- Size - Size of the variable/map in bytes
-
-Returns:
-
- EFI_SUCCESS - Variable is found, OUT parameters are valid
- EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
-
---*/
-{
- CHAR16 *MapName;
- EFI_GUID *MapGuid;
- UINT16 MapId;
- VOID *Map;
- UINTN MapSize;
-
- while (NULL != List) {
- EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize);
- if (0 == Idx--) {
- *Var = Map;
- *Size = MapSize;
-
- if (NULL != Name) {
- *Name = MapName;
- }
-
- if (NULL != Guid) {
- *Guid = MapGuid;
- }
-
- if (NULL != Id) {
- *Id = MapId;
- }
-
- return EFI_SUCCESS; // Map found
- }
- List = List->NextVariablePack;
- }
- //
- // If here, the map is not found
- //
- return EFI_NOT_FOUND;
-}
-
-
-EFI_STATUS
-EfiLibHiiVariablePackListGetMapById (
- IN UINT16 Id,
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- OUT CHAR16 **Name, OPTIONAL
- OUT EFI_GUID **Guid, OPTIONAL
- OUT VOID **Var,
- OUT UINTN *Size
- )
-
-/*++
-
-Routine Description:
-
- Finds a variable form List given the
- order number as appears in the List.
-
-Arguments:
-
- Id - The ID of the variable/map to retrieve
- List - List of variables
- Name - Name of the variable/map
- Guid - GUID of the variable/map
- Var - Pointer to the variable/map
- Size - Size of the variable/map in bytes
-
-Returns:
-
- EFI_SUCCESS - Variable is found, OUT parameters are valid
- EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
-
---*/
-
-{
- CHAR16 *MapName;
- EFI_GUID *MapGuid;
- UINT16 MapId;
- VOID *Map;
- UINTN MapSize;
-
- while (NULL != List) {
- EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize);
- if (MapId == Id) {
- *Var = Map;
- *Size = MapSize;
- if (NULL != Name) {
- *Name = MapName;
- }
- if (NULL != Guid) {
- *Guid = MapGuid;
- }
- //
- // Map found
- //
- return EFI_SUCCESS;
- }
- List = List->NextVariablePack;
- }
- //
- // If here, the map is not found
- //
- return EFI_NOT_FOUND;
-}
-
-
-EFI_STATUS
-EfiLibHiiVariablePackListGetMap (
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- OUT UINT16 *Id,
- OUT VOID **Var,
- OUT UINTN *Size
- )
-
-/*++
-
-Routine Description:
-
- Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.
-
-Arguments:
-
- List - List of variables
- Name - Name of the variable/map to be found
- Guid - GUID of the variable/map to be found
- Var - Pointer to the variable/map found
- Size - Size of the variable/map in bytes found
-
-Returns:
-
- EFI_SUCCESS - variable is found, OUT parameters are valid
- EFI_NOT_FOUND - variable is not found, OUT parameters are not valid
-
---*/
-
-{
- VOID *Map;
- UINTN MapSize;
- UINT16 MapId;
- CHAR16 *MapName;
- EFI_GUID *MapGuid;
-
- while (NULL != List) {
- EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize);
- if ((0 == StrCmp (Name, MapName)) && CompareGuid (Guid, MapGuid)) {
- *Id = MapId;
- *Var = Map;
- *Size = MapSize;
- return EFI_SUCCESS;
- }
- List = List->NextVariablePack;
- }
- //
- // If here, the map is not found
- //
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-EfiLibHiiVariableRetrieveFromNv (
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN UINTN Size,
- OUT VOID **Var
- )
-/*++
-
-Routine Description:
- Finds out if a variable of specific Name/Guid/Size exists in NV.
- If it does, it will retrieve it into the Var.
-
-Arguments:
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
- Var - Variable will be retrieved into buffer pointed by this pointer.
- If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer.
-Returns:
- EFI_SUCCESS - The variable of exact Name/Guid/Size parameters was retrieved and written to Var.
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
-
---*/
-{
- EFI_STATUS Status;
- UINTN SizeNv;
-
- //
- // Test for existence of the variable.
- //
- SizeNv = 0;
- Status = gRT->GetVariable (Name, Guid, NULL, &SizeNv, NULL);
- if (EFI_BUFFER_TOO_SMALL != Status) {
- ASSERT (EFI_SUCCESS != Status);
- return EFI_NOT_FOUND;
- }
- if (SizeNv != Size) {
- //
- // The variable is considered corrupt, as it has different size from expected.
- //
- return EFI_LOAD_ERROR;
- }
-
- if (NULL == *Var) {
- *Var = AllocatePool (Size);
- ASSERT (NULL != *Var);
- }
- SizeNv = Size;
- //
- // Final read into the Var
- //
- Status = gRT->GetVariable (Name, Guid, NULL, &SizeNv, *Var);
- //
- // No tolerance for random failures. Such behavior is undetermined and not validated.
- //
- ASSERT_EFI_ERROR (Status);
- ASSERT (SizeNv == Size);
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-EfiLibHiiVariableOverrideIfSuffix (
- IN CHAR16 *Suffix,
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN UINTN Size,
- OUT VOID *Var
- )
-/*++
-
-Routine Description:
- Overrrides the variable with NV data if found.
- But it only does it if the Name ends with specified Suffix.
- For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride",
- the Suffix matches the end of Name, so the variable will be loaded from NV
- provided the variable exists and the GUID and Size matches.
-
-Arguments:
- Suffix - Suffix the Name should end with.
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
- Var - Variable will be retrieved into this buffer.
- Caller is responsible for providing storage of exactly Size size in bytes.
-Returns:
- EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.
- EFI_INVALID_PARAMETER - The name of the variable does not end with <Suffix>.
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
-
---*/
-{
- UINTN StrLength;
- UINTN StrLenSuffix;
-
- StrLength = StrLen (Name);
- StrLenSuffix = StrLen (Suffix);
- if ((StrLength <= StrLenSuffix) || (0 != StrCmp (Suffix, &Name[StrLength - StrLenSuffix]))) {
- //
- // Not ending with <Suffix>.
- //
- return EFI_INVALID_PARAMETER;
- }
- return EfiLibHiiVariableRetrieveFromNv (Name, Guid, Size, &Var);
-}
-
-EFI_STATUS
-EfiLibHiiVariableOverrideBySuffix (
- IN CHAR16 *Suffix,
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN UINTN Size,
- OUT VOID *Var
- )
-/*++
-
-Routine Description:
- Overrrides the variable with NV data if found.
- But it only does it if the NV contains the same variable with Name is appended with Suffix.
- For example, if Suffix="MyOverride" and the Name="XyzSetup",
- the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride"
- will be loaded from NV provided the variable exists and the GUID and Size matches.
-
-Arguments:
- Suffix - Suffix the variable will be appended with.
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
- Var - Variable will be retrieved into this buffer.
- Caller is responsible for providing storage of exactly Size size in bytes.
-
-Returns:
- EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
-
---*/
-{
- EFI_STATUS Status;
- CHAR16 *NameSuffixed;
- UINTN NameLength;
- UINTN SuffixLength;
-
- //
- // enough to concatenate both strings.
- //
- NameLength = StrLen (Name);
- SuffixLength = StrLen (Suffix);
- NameSuffixed = AllocateZeroPool ((NameLength + SuffixLength + 1) * sizeof (CHAR16));
-
- StrCpy (NameSuffixed, Name);
- StrCat (NameSuffixed, Suffix);
-
- Status = EfiLibHiiVariableRetrieveFromNv (NameSuffixed, Guid, Size, &Var);
- gBS->FreePool (NameSuffixed);
-
- return Status;
-}
-
diff --git a/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/EdkOemHookStatusCodeLibNull.msa b/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/EdkOemHookStatusCodeLibNull.msa
deleted file mode 100644
index 40e4561..0000000
--- a/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/EdkOemHookStatusCodeLibNull.msa
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkOemHookStatusCodeLibNull</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>54D2878F-25CD-4a2b-8420-EBD18E609C76</GuidValue>
- <Version>1.0</Version>
- <Abstract>Memory Status Code Library for UEFI drivers</Abstract>
- <Description>Lib to provide memory journal status code reporting Routines</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkOemHookStatusCodeLibNull</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>OemHookStatusCodeLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>OemHookStatusCodeLibNull.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/OemHookStatusCodeLibNull.c b/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/OemHookStatusCodeLibNull.c
deleted file mode 100644
index 7816931..0000000
--- a/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/OemHookStatusCodeLibNull.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
- OEM hook status code library functions with no library constructor/destructor
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: OemHookStatusCodeLibNull.c
-
-**/
-
-/**
-
- Initialize OEM status code device .
-
- @return Always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeInitialize (
- VOID
- )
-{
- return EFI_SUCCESS;
-}
-
-/**
- Report status code to OEM device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @return The function always return EFI_UNSUPPORTED.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeReport (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId, OPTIONAL
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- return EFI_UNSUPPORTED;
-}
-
diff --git a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.c b/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.c
deleted file mode 100644
index f6638c1..0000000
--- a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/** @file
- The implementation of PCI incompatible device support libary.
-
-Copyright (c) 2007 Intel Corporation. All rights reserved. <BR>
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-**/
-
-#include "IncompatiblePciDeviceList.h"
-
-/**
- Check whether two PCI devices matched
-
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
- @param Header A pointer to EFI_PCI_DEVICE_INFO.
-
- @retval returns EFI_SUCCESS if two PCI device matched.
-**/
-STATIC
-EFI_STATUS
-DeviceCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN EFI_PCI_DEVICE_INFO *Header
- )
-{
- //
- // See if the Header matches the parameters passed in
- //
- if (Header->VendorID != DEVICE_ID_NOCARE) {
- if (PciDeviceInfo->VendorID != Header->VendorID) {
- return EFI_UNSUPPORTED;
- }
- }
-
- if (Header->DeviceID != DEVICE_ID_NOCARE) {
- if (PciDeviceInfo->DeviceID != Header->DeviceID) {
- return EFI_UNSUPPORTED;
- }
- }
-
- if (Header->RevisionID != DEVICE_ID_NOCARE) {
- if (PciDeviceInfo->RevisionID != Header->RevisionID) {
- return EFI_UNSUPPORTED;
- }
- }
-
- if (Header->SubsystemVendorID != DEVICE_ID_NOCARE) {
- if (PciDeviceInfo->SubsystemVendorID != Header->SubsystemVendorID) {
- return EFI_UNSUPPORTED;
- }
- }
-
- if (Header->SubsystemID != DEVICE_ID_NOCARE) {
- if (PciDeviceInfo->SubsystemID != Header->SubsystemID) {
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Check the incompatible device list for ACPI resource update and return
- the configuration
-
- This function searches the incompatible device list according to request
- information. If the PCI device belongs to the devices list, corresponding
- configuration informtion will be returned, in the meantime return EFI_SUCCESS.
-
- @param PciDeviceInfo A pointer to PCI device information.
- @param Configuration Returned information.
-
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
-**/
-RETURN_STATUS
-EFIAPI
-PciResourceUpdateCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- OUT VOID *Configuration
- )
-{
- UINT64 Tag;
- UINT64 *ListPtr;
- UINT64 *TempListPtr;
- EFI_PCI_DEVICE_INFO *Header;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *AcpiPtr;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *OldAcpiPtr;
- EFI_PCI_RESOUCE_DESCRIPTOR *Dsc;
- EFI_ACPI_END_TAG_DESCRIPTOR *PtrEnd;
- UINTN Index;
-
- ASSERT (PciDeviceInfo != NULL);
-
- //
- // Initialize the return value to NULL
- //
- * (VOID **) Configuration = NULL;
-
- ListPtr = IncompatiblePciDeviceListForResource;
- while (*ListPtr != LIST_END_TAG) {
-
- Tag = *ListPtr;
-
- switch (Tag) {
- case DEVICE_INF_TAG:
- Header = (EFI_PCI_DEVICE_INFO *) (ListPtr + 1);
- ListPtr = ListPtr + 1 + sizeof (EFI_PCI_DEVICE_INFO) / sizeof (UINT64);
-
- if (DeviceCheck (PciDeviceInfo, Header) != EFI_SUCCESS) {
- continue;
- }
-
- //
- // Matched an item, so construct the ACPI descriptor for the resource.
- //
- //
- // Count the resource items so that to allocate space
- //
- for (Index = 0, TempListPtr = ListPtr; *TempListPtr == DEVICE_RES_TAG; Index++) {
- TempListPtr = TempListPtr + 1 + ((sizeof (EFI_PCI_RESOUCE_DESCRIPTOR)) / sizeof (UINT64));
- }
- //
- // If there is at least one type of resource request,
- // allocate a acpi resource node
- //
- if (Index == 0) {
- return EFI_ABORTED;
- }
-
- AcpiPtr = AllocateZeroPool (
- sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * Index + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)
- );
-
- OldAcpiPtr = AcpiPtr;
-
- //
- // Fill the EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR structure
- // according to the EFI_PCI_RESOUCE_DESCRIPTOR structure
- //
- for (; *ListPtr == DEVICE_RES_TAG;) {
-
- Dsc = (EFI_PCI_RESOUCE_DESCRIPTOR *) (ListPtr + 1);
-
- AcpiPtr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
- AcpiPtr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
- AcpiPtr->ResType = (UINT8) Dsc->ResType;
- AcpiPtr->GenFlag = (UINT8) Dsc->GenFlag;
- AcpiPtr->SpecificFlag = (UINT8) Dsc->SpecificFlag;
- AcpiPtr->AddrSpaceGranularity = Dsc->AddrSpaceGranularity;;
- AcpiPtr->AddrRangeMin = Dsc->AddrRangeMin;
- AcpiPtr->AddrRangeMax = Dsc->AddrRangeMax;
- AcpiPtr->AddrTranslationOffset = Dsc->AddrTranslationOffset;
- AcpiPtr->AddrLen = Dsc->AddrLen;
-
- ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_RESOUCE_DESCRIPTOR)) / sizeof (UINT64));
- AcpiPtr++;
- }
- //
- // put the checksum
- //
- PtrEnd = (EFI_ACPI_END_TAG_DESCRIPTOR *) (AcpiPtr);
- PtrEnd->Desc = ACPI_END_TAG_DESCRIPTOR;
- PtrEnd->Checksum = 0;
-
- *(VOID **) Configuration = OldAcpiPtr;
-
- return EFI_SUCCESS;
-
- case DEVICE_RES_TAG:
- //
- // Adjust the pointer to the next PCI resource descriptor item
- //
- ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_RESOUCE_DESCRIPTOR)) / sizeof (UINT64));
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_UNSUPPORTED;
-
-}
-
-/**
- Check the incompatible device list and return configuraton register mask values.
-
- This function searches the incompatible device list according to request
- information. If the PCI device belongs to the devices list, corresponding
- configuration informtion will be returned, in the meantime return EFI_SUCCESS.
-
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
- @param AccessType Access Type, READ or WRITE.
- @param Offset The address within the PCI configuration space.
- @param Configuration Returned information.
-
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
-**/
-RETURN_STATUS
-EFIAPI
-PciRegisterUpdateCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN UINT64 AccessType,
- IN UINT64 Offset,
- OUT VOID *Configuration
- )
-{
- EFI_PCI_DEVICE_INFO *Header;
- UINT64 Tag;
- UINT64 *ListPtr;
- EFI_PCI_REGISTER_VALUE_DATA *RegisterPtr;
- EFI_PCI_REGISTER_VALUE_DATA *Dsc;
-
- ASSERT (PciDeviceInfo != NULL);
-
- ListPtr = IncompatiblePciDeviceListForRegister;
-
- //
- // Initialize the return value to NULL
- //
- * (VOID **) Configuration = NULL;
-
- while (*ListPtr != LIST_END_TAG) {
-
- Tag = *ListPtr;
-
- switch (Tag) {
- case DEVICE_INF_TAG:
- Header = (EFI_PCI_DEVICE_INFO *) (ListPtr + 1);
- ListPtr = ListPtr + 1 + sizeof (EFI_PCI_DEVICE_INFO) / sizeof (UINT64);
-
- //
- // Check whether the PCI device matches the device in the incompatible devices list?
- // If not, ship next
- //
- if (DeviceCheck (PciDeviceInfo, Header) != EFI_SUCCESS) {
- continue;
- }
-
- //
- // Matched an item, check whether access matches?
- //
- for (; *ListPtr == DEVICE_RES_TAG;) {
- ListPtr ++;
- if (((EFI_PCI_REGISTER_VALUE_DESCRIPTOR *)ListPtr)->Offset == (Offset & 0xfc)) {
- if (((EFI_PCI_REGISTER_VALUE_DESCRIPTOR *)ListPtr)->AccessType == AccessType) {
-
- Dsc = (EFI_PCI_REGISTER_VALUE_DATA *) (ListPtr + 2);
- RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_VALUE_DATA));
-
- RegisterPtr->AndValue = Dsc->AndValue;
- RegisterPtr->OrValue = Dsc->OrValue;
-
- *(VOID **) Configuration = RegisterPtr;
-
- return EFI_SUCCESS;
- }
- }
- ListPtr += sizeof (EFI_PCI_REGISTER_VALUE_DESCRIPTOR) / (sizeof (UINT64));
- }
- return EFI_UNSUPPORTED;
-
- case DEVICE_RES_TAG:
- //
- // Adjust the pointer to the next item
- //
- ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_REGISTER_VALUE_DESCRIPTOR)) / sizeof (UINT64));
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Check the incompatible device list for access width incompatibility and
- return the configuration
-
- This function searches the incompatible device list for access width
- incompatibility according to request information. If the PCI device
- belongs to the devices list, corresponding configuration informtion
- will be returned, in the meantime return EFI_SUCCESS.
-
- @param PciDeviceInfo A pointer to PCI device information.
- @param AccessType Access type, READ or WRITE.
- @param Offset The address within the PCI configuration space.
- @param AccessWidth Access width needs to check incompatibility.
- @param Configuration Returned information.
-
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
-**/
-RETURN_STATUS
-EFIAPI
-PciRegisterAccessCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN UINT64 AccessType,
- IN UINT64 Offset,
- IN UINT64 AccessWidth,
- OUT VOID *Configuration
- )
-{
- EFI_PCI_DEVICE_INFO *Header;
- UINT64 Tag;
- UINT64 *ListPtr;
- EFI_PCI_REGISTER_ACCESS_DATA *RegisterPtr;
- EFI_PCI_REGISTER_ACCESS_DATA *Dsc;
-
- ASSERT (PciDeviceInfo != NULL);
-
- ListPtr = DeviceListForAccessWidth;
-
- //
- // Initialize the return value to NULL
- //
- * (VOID **) Configuration = NULL;
-
- while (*ListPtr != LIST_END_TAG) {
-
- Tag = *ListPtr;
-
- switch (Tag) {
- case DEVICE_INF_TAG:
- Header = (EFI_PCI_DEVICE_INFO *) (ListPtr + 1);
- ListPtr = ListPtr + 1 + sizeof (EFI_PCI_DEVICE_INFO) / sizeof (UINT64);
-
- //
- // Check whether the PCI device matches the device in the incompatible devices list?
- // If not, ship next
- //
- if (DeviceCheck (PciDeviceInfo, Header) != EFI_SUCCESS) {
- continue;
- }
-
- //
- // Matched an item, check whether access matches?
- //
- for (; *ListPtr == DEVICE_RES_TAG;) {
- ListPtr ++;
- if (((EFI_PCI_REGISTER_ACCESS_DESCRIPTOR *) ListPtr)->AccessType == AccessType &&
- ((EFI_PCI_REGISTER_ACCESS_DESCRIPTOR *) ListPtr)->AccessWidth == AccessWidth ) {
-
- Dsc = (EFI_PCI_REGISTER_ACCESS_DATA *) (ListPtr + 2);
-
- if((Dsc->StartOffset <= Offset) && (Dsc->EndOffset > Offset)) {
-
- RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_ACCESS_DATA));
-
- RegisterPtr->StartOffset = Dsc->StartOffset;
- RegisterPtr->EndOffset = Dsc->EndOffset;
- RegisterPtr->Width = Dsc->Width;
-
- *(VOID **) Configuration = RegisterPtr;
-
- return EFI_SUCCESS;
- }
- }
- ListPtr += sizeof (EFI_PCI_REGISTER_ACCESS_DESCRIPTOR) / (sizeof (UINT64));
- }
- return EFI_UNSUPPORTED;
-
- case DEVICE_RES_TAG:
- //
- // Adjust the pointer to the next item
- //
- ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_REGISTER_ACCESS_DESCRIPTOR)) / sizeof (UINT64));
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_UNSUPPORTED;
-}
-
diff --git a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa b/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa
deleted file mode 100644
index e7b8529..0000000
--- a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkPciIncompatibleDeviceSuppportLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e</GuidValue>
- <Version>1.0</Version>
- <Abstract>PCI Incompatible device support Library</Abstract>
- <Description>Check PCI incompatible devices and set necessary configuration</Description>
- <Copyright>Copyright (c) 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkPciIncompatibleDeviceSupportLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>PciIncompatibleDeviceSupportLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>EdkPciIncompatibleDeviceSupportLib.c</Filename>
- <Filename>IncompatiblePciDeviceList.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h b/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h
deleted file mode 100644
index a00c614..0000000
--- a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/** @file
- The incompatible PCI device list
-
-Copyright (c) 2007 Intel Corporation. All rights reserved. <BR>
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-**/
-
-#ifndef _EFI_INCOMPATIBLE_PCI_DEVICE_LIST_H
-#define _EFI_INCOMPATIBLE_PCI_DEVICE_LIST_H
-
-#include <IndustryStandard/pci22.h>
-#include <IndustryStandard/Acpi.h>
-
-
-#define PCI_DEVICE_ID(VendorId, DeviceId, Revision, SubVendorId, SubDeviceId) \
- VendorId, DeviceId, Revision, SubVendorId, SubDeviceId
-
-#define PCI_BAR_TYPE_IO ACPI_ADDRESS_SPACE_TYPE_IO
-#define PCI_BAR_TYPE_MEM ACPI_ADDRESS_SPACE_TYPE_MEM
-
-#define DEVICE_INF_TAG 0xFFF2
-#define DEVICE_RES_TAG 0xFFF1
-#define LIST_END_TAG 0x0000
-
-//
-// descriptor for access width of incompatible PCI device
-//
-typedef struct {
- UINT64 AccessType;
- UINT64 AccessWidth;
- EFI_PCI_REGISTER_ACCESS_DATA PciRegisterAccessData;
-} EFI_PCI_REGISTER_ACCESS_DESCRIPTOR;
-
-//
-// descriptor for register value of incompatible PCI device
-//
-typedef struct {
- UINT64 AccessType;
- UINT64 Offset;
- EFI_PCI_REGISTER_VALUE_DATA PciRegisterValueData;
-} EFI_PCI_REGISTER_VALUE_DESCRIPTOR;
-
-
-//
-// the incompatible PCI devices list for ACPI resource
-//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
- //
- // DEVICE_INF_TAG,
- // PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
- // DEVICE_RES_TAG,
- // ResType, GFlag , SFlag, Granularity, RangeMin,
- // RangeMax, Offset, AddrLen
- //
- //
- // Device Adaptec 9004
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device Adaptec 9005
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device QLogic 1007
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device Agilent 103C
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device Agilent 15BC
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // The end of the list
- //
- LIST_END_TAG
-};
-
-//
-// the incompatible PCI devices list for the values of configuration registers
-//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
- //
- // DEVICE_INF_TAG,
- // PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
- // PCI_RES_TAG,
- // PCI_ACCESS_TYPE, PCI_CONFIG_ADDRESS,
- // AND_VALUE, OR_VALUE
-
- //
- // Device Lava 0x1407, DeviceId 0x0110
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x1407, 0x0110, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_REGISTER_READ,
- PCI_CAPBILITY_POINTER_OFFSET,
- 0xffffff00,
- VALUE_NOCARE,
-
- //
- // Device Lava 0x1407, DeviceId 0x0111
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x1407, 0x0111, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_REGISTER_READ,
- PCI_CAPBILITY_POINTER_OFFSET,
- 0xffffff00,
- VALUE_NOCARE,
-
- //
- // The end of the list
- //
- LIST_END_TAG
-};
-
-//
-// the incompatible PCI devices list for the access width of configuration registers
-//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT64 DeviceListForAccessWidth[] = {
- //
- // DEVICE_INF_TAG,
- // PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
- // DEVICE_RES_TAG,
- // PCI_ACCESS_TYPE, PCI_ACCESS_WIDTH,
- // START_ADDRESS, END_ADDRESS,
- // ACTUAL_PCI_ACCESS_WIDTH,
- //
-
- //
- // Sample Device
- //
- //DEVICE_INF_TAG,
- //PCI_DEVICE_ID(0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- //DEVICE_RES_TAG,
- //PCI_REGISTER_READ,
- //EfiPciWidthUint8,
- //0,
- //0xFF,
- //EfiPciWidthUint32,
- //
-
- //
- // The end of the list
- //
- LIST_END_TAG
-};
-
-#endif
diff --git a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c
deleted file mode 100644
index d83d1ad..0000000
--- a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EdkPeCoffLoader.c
-
-Abstract:
-
- Wrap the Base PE/COFF loader with the PE COFF Protocol
-
-
---*/
-
-#include "EdkPeCoffLoaderLibInternals.h"
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibGetImageInfo (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- EFI_STATUS Status;
-
- Status = PeCoffLoaderGetImageInfo (ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- switch (ImageContext->ImageType) {
-
- case EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION:
- ImageContext->ImageCodeMemoryType = EfiLoaderCode;
- ImageContext->ImageDataMemoryType = EfiLoaderData;
- break;
-
- case EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER:
- ImageContext->ImageCodeMemoryType = EfiBootServicesCode;
- ImageContext->ImageDataMemoryType = EfiBootServicesData;
- break;
-
- case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
- case EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER:
- ImageContext->ImageCodeMemoryType = EfiRuntimeServicesCode;
- ImageContext->ImageDataMemoryType = EfiRuntimeServicesData;
- break;
-
- default:
- ImageContext->ImageError = IMAGE_ERROR_INVALID_SUBSYSTEM;
- return RETURN_UNSUPPORTED;
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibLoadImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- return PeCoffLoaderLoadImage (ImageContext);
-}
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibRelocateImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- return PeCoffLoaderRelocateImage (ImageContext);
-}
-
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibUnloadimage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- return EFI_SUCCESS;
-}
-
-
-EFI_PEI_PE_COFF_LOADER_PROTOCOL mPeiEfiPeiPeCoffLoader = {
- TianoPeCoffLoaderLibGetImageInfo,
- TianoPeCoffLoaderLibLoadImage,
- TianoPeCoffLoaderLibRelocateImage,
- TianoPeCoffLoaderLibUnloadimage
-};
-
-EFI_PEI_PE_COFF_LOADER_PROTOCOL *
-EFIAPI
-GetPeCoffLoaderProtocol (
- )
-{
- return &mPeiEfiPeiPeCoffLoader;
-}
-
-
diff --git a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa
deleted file mode 100644
index 53af6f1..0000000
--- a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkPeCoffLoaderLib</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>858bbbc9-474f-4556-a361-0ae52a44ffa5</GuidValue>
- <Version>1.0</Version>
- <Abstract>EdkPeCoffLoaderLib library instance</Abstract>
- <Description>This library provides PeCoffLoader protocol based on PeCoffLib functions.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkPeCoffLoaderLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE PEIM">
- <Keyword>EdkPeCoffLoaderLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeCoffLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>EdkPeCoffLoader.c</Filename>
- <Filename>EdkPeCoffLoaderLibInternals.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLibInternals.h b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLibInternals.h
deleted file mode 100644
index b356724..0000000
--- a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLibInternals.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
- Declaration of internal functions in PE/COFF Lib.
-
- Copyright (c) 2006, Intel Corporation<BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: BasePeCoffLibInternals.h
-
-**/
-
-#ifndef __PECOFF_LOADER_LIB_INTERNALS__
-#define __PECOFF_LOADER_LIB_INTERNALS__
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibGetImageInfo (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibLoadImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibRelocateImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibUnloadimage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-#endif
diff --git a/EdkModulePkg/Library/EdkScsiLib/EdkScsiLib.msa b/EdkModulePkg/Library/EdkScsiLib/EdkScsiLib.msa
deleted file mode 100644
index 1135e4a..0000000
--- a/EdkModulePkg/Library/EdkScsiLib/EdkScsiLib.msa
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkScsiLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>46c9adef-aee6-410c-99e4-240e3af18d8b</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Scsi Dxe Library.</Abstract>
- <Description>this Libarary implements Scsi command.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkScsiLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkScsiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>ScsiLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00010010</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkScsiLib/ScsiLib.c b/EdkModulePkg/Library/EdkScsiLib/ScsiLib.c
deleted file mode 100644
index 55b9503..0000000
--- a/EdkModulePkg/Library/EdkScsiLib/ScsiLib.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ScsiLib.c
-
-Abstract:
-
-
-Revision History
---*/
-
-
-#include <IndustryStandard/scsi.h>
-
-EFI_STATUS
-SubmitTestUnitReadyCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- OUT VOID *SenseData,
- OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus
- )
-/*++
-
-Routine Description:
- Function tests the ready status of SCSI unit.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in InTransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[6];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 6);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = NULL;
- CommandPacket.SenseData = SenseData;
- CommandPacket.TransferLength = 0;
- CommandPacket.Cdb = Cdb;
-
- //
- // Fill Cdb for Test Unit Ready Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_TEST_UNIT_READY;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- CommandPacket.CdbLength = (UINT8) 6;
- CommandPacket.SenseDataLength = *SenseDataLength;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitInquiryCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- IN OUT VOID *InquiryDataBuffer,
- IN OUT UINT32 *InquiryDataLength,
- IN BOOLEAN EnableVitalProductData
- )
-/*++
-
-Routine Description:
- Function to submit SCSI inquiry command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- InquiryDataBuffer - A pointer to inquiry data buffer.
- InquiryDataLength - The length of inquiry data buffer.
- EnableVitalProductData - Boolean to enable Vital Product Data.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[6];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 6);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = InquiryDataBuffer;
- CommandPacket.TransferLength = *InquiryDataLength;
- CommandPacket.SenseData = SenseData;
- CommandPacket.SenseDataLength = *SenseDataLength;
- CommandPacket.Cdb = Cdb;
-
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_INQUIRY;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- if (EnableVitalProductData) {
- Cdb[1] |= 0x01;
- }
-
- if (*InquiryDataLength > 0xff) {
- *InquiryDataLength = 0xff;
- }
-
- Cdb[4] = (UINT8) (*InquiryDataLength);
- CommandPacket.CdbLength = (UINT8) 6;
- CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *InquiryDataLength = CommandPacket.TransferLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitModeSense10Command (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- IN VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN UINT8 DBDField, OPTIONAL
- IN UINT8 PageControl,
- IN UINT8 PageCode
- )
-/*++
-
-Routine Description:
- Function to submit SCSI mode sense 10 command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- DataBuffer - A pointer to input data buffer.
- DataLength - The length of input data buffer.
- DBDField - The DBD Field (Optional).
- PageControl - Page Control.
- PageCode - Page code.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[10];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 10);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.TransferLength = *DataLength;
- CommandPacket.Cdb = Cdb;
- //
- // Fill Cdb for Mode Sense (10) Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_MODE_SEN10;
- Cdb[1] = (UINT8) ((Lun & 0xe0) + ((DBDField << 3) & 0x08));
- Cdb[2] = (UINT8) ((PageControl & 0xc0) | (PageCode & 0x3f));
- Cdb[7] = (UINT8) (*DataLength >> 8);
- Cdb[8] = (UINT8) (*DataLength);
-
- CommandPacket.CdbLength = 10;
- CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
- CommandPacket.SenseDataLength = *SenseDataLength;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.TransferLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitRequestSenseCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus
- )
-/*++
-
-Routine Description:
- Function to submit SCSI request sense command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[6];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 6);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = SenseData;
- CommandPacket.SenseData = NULL;
- CommandPacket.TransferLength = *SenseDataLength;
- CommandPacket.Cdb = Cdb;
- //
- // Fill Cdb for Request Sense Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_REQUEST_SENSE;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- Cdb[4] = (UINT8) (*SenseDataLength);
-
- CommandPacket.CdbLength = (UINT8) 6;
- CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
- CommandPacket.SenseDataLength = 0;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = (UINT8) CommandPacket.TransferLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitReadCapacityCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- OUT VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN BOOLEAN PMI
- )
-/*++
-
-Routine Description:
- Function to submit read capacity command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- DataBuffer - A pointer to a data buffer.
- DataLength - The length of data buffer.
- PMI - Partial medium indicator.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[10];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 10);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.TransferLength = *DataLength;
- CommandPacket.Cdb = Cdb;
- //
- // Fill Cdb for Read Capacity Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_READ_CAPACITY;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- if (!PMI) {
- //
- // Partial medium indicator,if PMI is FALSE, the Cdb.2 ~ Cdb.5 MUST BE ZERO.
- //
- ZeroMem ((Cdb + 2), 4);
- } else {
- Cdb[8] |= 0x01;
- }
-
- CommandPacket.CdbLength = 10;
- CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
- CommandPacket.SenseDataLength = *SenseDataLength;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.TransferLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitRead10Command (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- OUT VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN UINT32 StartLba,
- IN UINT32 SectorSize
- )
-/*++
-
-Routine Description:
- Function to submit read 10 command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- DataBuffer - A pointer to a data buffer.
- DataLength - The length of data buffer.
- StartLba - The start address of LBA.
- SectorSize - The sector size.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[10];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 10);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.TransferLength = *DataLength;
- CommandPacket.Cdb = Cdb;
- //
- // Fill Cdb for Read (10) Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_READ10;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- Cdb[2] = (UINT8) (StartLba >> 24);
- Cdb[3] = (UINT8) (StartLba >> 16);
- Cdb[4] = (UINT8) (StartLba >> 8);
- Cdb[5] = (UINT8) StartLba;
- Cdb[7] = (UINT8) (SectorSize >> 8);
- Cdb[8] = (UINT8) SectorSize;
-
- CommandPacket.CdbLength = 10;
- CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
- CommandPacket.SenseDataLength = *SenseDataLength;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.TransferLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitWrite10Command (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- OUT VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN UINT32 StartLba,
- IN UINT32 SectorSize
- )
-/*++
-
-Routine Description:
- Function to submit SCSI write 10 command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- DataBuffer - A pointer to a data buffer.
- DataLength - The length of data buffer.
- StartLba - The start address of LBA.
- SectorSize - The sector size.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in InTransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[10];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 10);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.TransferLength = *DataLength;
- CommandPacket.Cdb = Cdb;
- //
- // Fill Cdb for Write (10) Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_WRITE10;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- Cdb[2] = (UINT8) (StartLba >> 24);
- Cdb[3] = (UINT8) (StartLba >> 16);
- Cdb[4] = (UINT8) (StartLba >> 8);
- Cdb[5] = (UINT8) StartLba;
- Cdb[7] = (UINT8) (SectorSize >> 8);
- Cdb[8] = (UINT8) SectorSize;
-
- CommandPacket.CdbLength = 10;
- CommandPacket.DataDirection = EFI_SCSI_DATA_OUT;
- CommandPacket.SenseDataLength = *SenseDataLength;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.TransferLength;
-
- return Status;
-}
diff --git a/EdkModulePkg/Library/EdkSerialPortLibNull/EdkSerialPortLibNull.msa b/EdkModulePkg/Library/EdkSerialPortLibNull/EdkSerialPortLibNull.msa
deleted file mode 100644
index 9c992ea..0000000
--- a/EdkModulePkg/Library/EdkSerialPortLibNull/EdkSerialPortLibNull.msa
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkSerialPortLibNull</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>E4541241-8897-411a-91F8-7D7E45837146</GuidValue>
- <Version>1.0</Version>
- <Abstract>Memory Status Code Library for UEFI drivers</Abstract>
- <Description>Lib to provide memory journal status code reporting Routines</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkSerialPortLibNull</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>SerialPortLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>SerialPortLibNull.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkSerialPortLibNull/SerialPortLibNull.c b/EdkModulePkg/Library/EdkSerialPortLibNull/SerialPortLibNull.c
deleted file mode 100644
index 3f2f183..0000000
--- a/EdkModulePkg/Library/EdkSerialPortLibNull/SerialPortLibNull.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
- Serial I/O Port library functions with no library constructor/destructor
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: SerialPortLibNull.c
-
-**/
-
-/*
-
- Programmed hardware of Serial port.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-EFI_STATUS
-EFIAPI
-SerialPortInitialize (
- VOID
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-/**
- Write data to serial device.
-
- @param Buffer Point of data buffer which need to be writed.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Write data failed.
- @retval !0 Actual number of bytes writed to serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
-{
- return 0;
-}
-
-
-/**
- Read data from serial device and save the datas in buffer.
-
- @param Buffer Point of data buffer which need to be writed.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Read data failed.
- @retval !0 Aactual number of bytes read from serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
-{
- return 0;
-}
-
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c
deleted file mode 100644
index 3cb11d8..0000000
--- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/**@file
- Library utility functions for Runtime driver.
-
-Copyright (c) 2006 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <RuntimeLibInternal.h>
-
-///
-/// Driver Lib Module Globals
-///
-
-STATIC EFI_EVENT mEfiVirtualNotifyEvent;
-STATIC BOOLEAN mEfiGoneVirtual = FALSE;
-STATIC BOOLEAN mEfiAtRuntime = FALSE;
-EFI_RUNTIME_SERVICES *mRT;
-
-/**
- Set AtRuntime flag as TRUE after ExitBootServices
-
- @param[in] Event The Event that is being processed
- @param[in] Context Event Context
-**/
-VOID
-EFIAPI
-RuntimeDriverExitBootServices (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- //
- // Clear out BootService globals
- //
- gBS = NULL;
-
- mEfiAtRuntime = TRUE;
-}
-
-/**
- Fixup internal data so that EFI can be call in virtual mode.
- Call the passed in Child Notify event and convert any pointers in
- lib to virtual mode.
-
- @param[in] Event The Event that is being processed
- @param[in] Context Event Context
-**/
-STATIC
-VOID
-EFIAPI
-RuntimeLibVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINTN Index;
- EFI_EVENT_NOTIFY ChildNotifyEventHandler;
-
- for (Index = 0;
- _gDriverSetVirtualAddressMapEvent[Index] != NULL;
- Index++) {
- ChildNotifyEventHandler = _gDriverSetVirtualAddressMapEvent[Index];
- ChildNotifyEventHandler (Event, NULL);
- }
-
- //
- // Update global for Runtime Services Table and IO
- //
- EfiConvertPointer (0, (VOID **) &mRT);
-
- mEfiGoneVirtual = TRUE;
-}
-
-/**
- Intialize runtime Driver Lib if it has not yet been initialized.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @return EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
-**/
-EFI_STATUS
-EFIAPI
-RuntimeDriverLibConstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- ASSERT (SystemTable != NULL);
- mRT = SystemTable->RuntimeServices;
- ASSERT (mRT != NULL);
-
- //
- // Register SetVirtualAddressMap () notify function
- //
- ASSERT (gBS != NULL);
- Status = gBS->CreateEvent (
- EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
- TPL_NOTIFY,
- RuntimeLibVirtualNotifyEvent,
- NULL,
- &mEfiVirtualNotifyEvent
- );
-
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- This routine will free some resources which have been allocated in
- EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
- it must call this routine to free the allocated resource before the exiting.
-
- @retval EFI_SUCCESS Shutdown the Runtime Driver Lib successfully
- @retval EFI_UNSUPPORTED Runtime Driver lib was not initialized at all
-**/
-EFI_STATUS
-EFIAPI
-RuntimeDriverLibDeconstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Close SetVirtualAddressMap () notify function
- //
- ASSERT (gBS != NULL);
- Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- Return TRUE if ExitBootServices () has been called
-
- @retval TRUE If ExitBootServices () has been called
-**/
-BOOLEAN
-EFIAPI
-EfiAtRuntime (
- VOID
- )
-{
- return mEfiAtRuntime;
-}
-
-/**
- Return TRUE if SetVirtualAddressMap () has been called
-
- @retval TRUE If SetVirtualAddressMap () has been called
-**/
-BOOLEAN
-EFIAPI
-EfiGoneVirtual (
- VOID
- )
-{
- return mEfiGoneVirtual;
-}
-
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeService.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeService.c
deleted file mode 100644
index e9a539d..0000000
--- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeService.c
+++ /dev/null
@@ -1,454 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- RuntimeService.c
-
---*/
-
-#include <RuntimeLibInternal.h>
-
-VOID
-EFIAPI
-EfiResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN CHAR16 *ResetData
- )
-/*++
-
-Routine Description:
-
- Resets the entire platform.
-
-Arguments:
-
- ResetType - The type of reset to perform.
- ResetStatus - The status code for the reset.
- DataSize - The size, in bytes, of ResetData.
- ResetData - A data buffer that includes a Null-terminated Unicode string, optionally
- followed by additional binary data.
-
-Returns:
-
- None
-
---*/
-{
- mRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);
-}
-
-//
-// The following functions hide the mRT local global from the call to
-// runtime service in the EFI system table.
-//
-EFI_STATUS
-EFIAPI
-EfiGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities
- )
-/*++
-
-Routine Description:
-
- Returns the current time and date information, and the time-keeping
- capabilities of the hardware platform.
-
-Arguments:
-
- Time - A pointer to storage to receive a snapshot of the current time.
- Capabilities - An optional pointer to a buffer to receive the real time clock device's
- capabilities.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->GetTime (Time, Capabilities);
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetTime (
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Sets the current local time and date information.
-
-Arguments:
-
- Time - A pointer to the current time.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->SetTime (Time);
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Returns the current wakeup alarm clock setting.
-
-Arguments:
-
- Enabled - Indicates if the alarm is currently enabled or disabled.
- Pending - Indicates if the alarm signal is pending and requires acknowledgement.
- Time - The current alarm setting.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->GetWakeupTime (Enabled, Pending, Time);
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetWakeupTime (
- IN BOOLEAN Enable,
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Sets the system wakeup alarm clock time.
-
-Arguments:
-
- Enable - Enable or disable the wakeup alarm.
- Time - If Enable is TRUE, the time to set the wakeup alarm for.
- If Enable is FALSE, then this parameter is optional, and may be NULL.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->SetWakeupTime (Enable, Time);
-}
-
-
-
-
-EFI_STATUS
-EFIAPI
-EfiGetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
- )
-/*++
-
-Routine Description:
-
- Returns the value of a variable.
-
-Arguments:
-
- VariableName - A Null-terminated Unicode string that is the name of the
- vendor's variable.
- VendorGuid - A unique identifier for the vendor.
- Attributes - If not NULL, a pointer to the memory location to return the
- attributes bitmask for the variable.
- DataSize - On input, the size in bytes of the return Data buffer.
- On output the size of data returned in Data.
- Data - The buffer to return the contents of the variable.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid
- )
-/*++
-
-Routine Description:
-
- Enumerates the current variable names.
-
-Arguments:
-
- VariableNameSize - The size of the VariableName buffer.
- VariableName - On input, supplies the last VariableName that was returned
- by GetNextVariableName().
- On output, returns the Nullterminated Unicode string of the
- current variable.
- VendorGuid - On input, supplies the last VendorGuid that was returned by
- GetNextVariableName().
- On output, returns the VendorGuid of the current variable.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->GetNextVariableName (VariableNameSize, VariableName, VendorGuid);
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
- )
-/*++
-
-Routine Description:
-
- Sets the value of a variable.
-
-Arguments:
-
- VariableName - A Null-terminated Unicode string that is the name of the
- vendor's variable.
- VendorGuid - A unique identifier for the vendor.
- Attributes - Attributes bitmask to set for the variable.
- DataSize - The size in bytes of the Data buffer.
- Data - The contents for the variable.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetNextHighMonotonicCount (
- OUT UINT32 *HighCount
- )
-/*++
-
-Routine Description:
-
- Returns the next high 32 bits of the platform's monotonic counter.
-
-Arguments:
-
- HighCount - Pointer to returned value.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->GetNextHighMonotonicCount (HighCount);
-}
-
-EFI_STATUS
-EFIAPI
-EfiConvertPointer (
- IN UINTN DebugDisposition,
- IN OUT VOID **Address
- )
-/*++
-
-Routine Description:
-
- Determines the new virtual address that is to be used on subsequent memory accesses.
-
-Arguments:
-
- DebugDisposition - Supplies type information for the pointer being converted.
- Address - A pointer to a pointer that is to be fixed to be the value needed
- for the new virtual address mappings being applied.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->ConvertPointer (DebugDisposition, Address);
-}
-
-EFI_STATUS
-EFIAPI
-EfiConvertList (
- IN UINTN DebugDisposition,
- IN OUT LIST_ENTRY *ListHead
- )
-/*++
-
-Routine Description:
-
- Conver the standard Lib double linked list to a virtual mapping.
-
-Arguments:
-
- DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)
-
- ListHead - Head of linked list to convert
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- LIST_ENTRY *Link;
- LIST_ENTRY *NextLink;
-
- //
- // Convert all the ForwardLink & BackLink pointers in the list
- //
- Link = ListHead;
- do {
- NextLink = Link->ForwardLink;
-
- EfiConvertPointer (
- Link->ForwardLink == ListHead ? DebugDisposition : 0,
- (VOID **) &Link->ForwardLink
- );
-
- EfiConvertPointer (
- Link->BackLink == ListHead ? DebugDisposition : 0,
- (VOID **) &Link->BackLink
- );
-
- Link = NextLink;
- } while (Link != ListHead);
- return EFI_SUCCESS;
-}
-
-
-/**
- Change the runtime addressing mode of EFI firmware from physical to virtual.
-
- @param MemoryMapSize The size in bytes of VirtualMap.
- @param DescriptorSize The size in bytes of an entry in the VirtualMap.
- @param DescriptorVersion The version of the structure entries in VirtualMap.
- @param VirtualMap An array of memory descriptors which contain new virtual
- address mapping information for all runtime ranges. Type
- EFI_MEMORY_DESCRIPTOR is defined in the
- GetMemoryMap() function description.
-
- @retval EFI_SUCCESS The virtual address map has been applied.
- @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
- virtual address mapped mode.
- @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
- invalid.
- @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
- map that requires a mapping.
- @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
- in the memory map.
-**/
-EFI_STATUS
-EFIAPI
-EfiSetVirtualAddressMap (
- IN UINTN MemoryMapSize,
- IN UINTN DescriptorSize,
- IN UINT32 DescriptorVersion,
- IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap
- )
-{
- return mRT->SetVirtualAddressMap (
- MemoryMapSize,
- DescriptorSize,
- DescriptorVersion,
- (EFI_MEMORY_DESCRIPTOR *) VirtualMap
- );
-}
-
-
-EFI_STATUS
-EFIAPI
-EfiUpdateCapsule (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
- )
-{
- return mRT->UpdateCapsule (
- CapsuleHeaderArray,
- CapsuleCount,
- ScatterGatherList
- );
-}
-
-EFI_STATUS
-EFIAPI
-EfiQueryCapsuleCapabilities (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- OUT UINT64 *MaximumCapsuleSize,
- OUT EFI_RESET_TYPE *ResetType
- )
-{
- return mRT->QueryCapsuleCapabilities (
- CapsuleHeaderArray,
- CapsuleCount,
- MaximumCapsuleSize,
- ResetType
- );
-}
-
-
-EFI_STATUS
-EFIAPI
-EfiQueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize
- )
-{
- return mRT->QueryVariableInfo (
- Attributes,
- MaximumVariableStorageSize,
- RemainingVariableStorageSize,
- MaximumVariableSize
- );
-}
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/EdkUefiRuntimeLib.msa b/EdkModulePkg/Library/EdkUefiRuntimeLib/EdkUefiRuntimeLib.msa
deleted file mode 100644
index 75cd691..0000000
--- a/EdkModulePkg/Library/EdkUefiRuntimeLib/EdkUefiRuntimeLib.msa
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkUefiRuntimeLib</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>b1ee6c28-54aa-4d17-b705-3e28ccb27b2e</GuidValue>
- <Version>1.0</Version>
- <Abstract>Runtime driver library</Abstract>
- <Description>Instance of runtime driver library, Hook VitualAddressChange and
- BooterviceExit event and provide runtime service.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkUefiRuntimeLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_RUNTIME_DRIVER DXE_SAL_DRIVER">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IPF">
- <Keyword>ExtendedSalLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>RuntimeLibInternal.h</Filename>
- <Filename SupArchList="IA32">Common/RuntimeLib.c</Filename>
- <Filename SupArchList="IA32">Common/RuntimeService.c</Filename>
- <Filename SupArchList="X64">Common/RuntimeLib.c</Filename>
- <Filename SupArchList="X64">Common/RuntimeService.c</Filename>
- <Filename SupArchList="EBC">Common/RuntimeLib.c</Filename>
- <Filename SupArchList="EBC">Common/RuntimeService.c</Filename>
- <Filename SupArchList="IPF">Ipf/RuntimeLib.c</Filename>
- <Filename SupArchList="IPF">Ipf/RuntimeService.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" SupArchList="IPF"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>RuntimeDriverLibConstruct</Constructor>
- <Destructor>RuntimeDriverLibDeconstruct</Destructor>
- </Extern>
- <Extern>
- <ExitBootServicesCallBack>RuntimeDriverExitBootServices</ExitBootServicesCallBack>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c
deleted file mode 100644
index 2382d4a..0000000
--- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- RuntimeLib.c
-
---*/
-
-#include <RuntimeLibInternal.h>
-
-//
-// Driver Lib Module Globals
-//
-static EFI_EVENT mEfiVirtualNotifyEvent;
-EFI_RUNTIME_SERVICES *mRT;
-
-VOID
-EFIAPI
-RuntimeDriverExitBootServices (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Set AtRuntime flag as TRUE after ExitBootServices
-
-Arguments:
-
- Event - The Event that is being processed
-
- Context - Event Context
-
-Returns:
-
- None
-
---*/
-{
- if (EfiAtRuntime()) {
- return;
- }
-}
-
-STATIC
-VOID
-EFIAPI
-RuntimeLibVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Fixup internal data so that EFI can be call in virtual mode.
- Call the passed in Child Notify event and convert any pointers in
- lib to virtual mode.
-
-Arguments:
-
- Event - The Event that is being processed
-
- Context - Event Context
-
-Returns:
-
- None
-
---*/
-{
- UINTN Index;
- EFI_EVENT_NOTIFY ChildNotifyEventHandler;
-
- for (Index = 0; _gDriverSetVirtualAddressMapEvent[Index] != NULL; Index++) {
- ChildNotifyEventHandler = _gDriverSetVirtualAddressMapEvent[Index];
- ChildNotifyEventHandler (Event, NULL);
- }
-
- //
- // Update global for Runtime Services Table
- //
- EfiConvertPointer (0, (VOID **) &mRT);
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverLibConstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Intialize runtime Driver Lib if it has not yet been initialized.
-
-Arguments:
-
- ImageHandle - The firmware allocated handle for the EFI image.
-
- SystemTable - A pointer to the EFI System Table.
-
- GoVirtualChildEvent - Caller can register a virtual notification event.
-
-Returns:
-
- EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
-
---*/
-{
- EFI_STATUS Status;
-
- mRT = SystemTable->RuntimeServices;
-
- //
- // Register SetVirtualAddressMap () notify function
- //
- if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {
- Status = gBS->CreateEvent (
- EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
- TPL_NOTIFY,
- RuntimeLibVirtualNotifyEvent,
- NULL,
- &mEfiVirtualNotifyEvent
- );
- ASSERT_EFI_ERROR (Status);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverLibDeconstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- This routine will free some resources which have been allocated in
- EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
- it must call this routine to free the allocated resource before the exiting.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully
- EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Close SetVirtualAddressMap () notify function
- //
- if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {
- Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);
- ASSERT_EFI_ERROR (Status);
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-EFIAPI
-EfiAtRuntime (
- VOID
- )
-/*++
-
-Routine Description:
- Return TRUE if ExitBootService () has been called
-
-Arguments:
- NONE
-
-Returns:
- TRUE - If ExitBootService () has been called
-
---*/
-{
- EFI_GUID Guid;
- SAL_RETURN_REGS ReturnReg;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, IsEfiRuntimeFunctionId, 0, 0, 0, 0, 0, 0, 0);
-
- return (BOOLEAN) (ReturnReg.r9 == 1);
-}
-
-BOOLEAN
-EFIAPI
-EfiGoneVirtual (
- VOID
- )
-/*++
-
-Routine Description:
- Return TRUE if SetVirtualAddressMap () has been called
-
-Arguments:
- NONE
-
-Returns:
- TRUE - If SetVirtualAddressMap () has been called
-
---*/
-{
- EFI_GUID Guid;
- SAL_RETURN_REGS ReturnReg;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, IsVirtualFunctionId, 0, 0, 0, 0, 0, 0, 0);
-
- return (BOOLEAN) (ReturnReg.r9 == 1);
-}
-
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c
deleted file mode 100644
index c6ea0b1..0000000
--- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c
+++ /dev/null
@@ -1,552 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- RuntimeService.c
-
---*/
-
-#include <RuntimeLibInternal.h>
-
-VOID
-EFIAPI
-EfiResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN CHAR16 *ResetData
- )
-/*++
-
-Routine Description:
-
- Resets the entire platform.
-
-Arguments:
-
- ResetType - The type of reset to perform.
- ResetStatus - The status code for the reset.
- DataSize - The size, in bytes, of ResetData.
- ResetData - A data buffer that includes a Null-terminated Unicode string, optionally
- followed by additional binary data.
-
-Returns:
-
- None
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_HI;
-
- EsalCall (
- &Guid,
- ResetSystemFunctionId,
- (UINT64) ResetType,
- (UINT64) ResetStatus,
- (UINT64) DataSize,
- (UINT64) ResetData,
- 0,
- 0,
- 0
- );
-}
-
-
-//
-// The following functions hide the mRT local global from the call to
-// runtime service in the EFI system table.
-//
-EFI_STATUS
-EFIAPI
-EfiGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities
- )
-/*++
-
-Routine Description:
-
- Returns the current time and date information, and the time-keeping
- capabilities of the hardware platform.
-
-Arguments:
-
- Time - A pointer to storage to receive a snapshot of the current time.
- Capabilities - An optional pointer to a buffer to receive the real time clock device's
- capabilities.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, GetTimeFunctionId, (UINT64) Time, (UINT64) Capabilities, 0, 0, 0, 0, 0);
- return ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetTime (
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Sets the current local time and date information.
-
-Arguments:
-
- Time - A pointer to the current time.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, SetTimeFunctionId, (UINT64) Time, 0, 0, 0, 0, 0, 0);
- return ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Returns the current wakeup alarm clock setting.
-
-Arguments:
-
- Enabled - Indicates if the alarm is currently enabled or disabled.
- Pending - Indicates if the alarm signal is pending and requires acknowledgement.
- Time - The current alarm setting.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, GetWakeupTimeFunctionId, (UINT64) Enabled, (UINT64) Pending, (UINT64) Time, 0, 0, 0, 0);
- return ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetWakeupTime (
- IN BOOLEAN Enable,
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Sets the system wakeup alarm clock time.
-
-Arguments:
-
- Enable - Enable or disable the wakeup alarm.
- Time - If Enable is TRUE, the time to set the wakeup alarm for.
- If Enable is FALSE, then this parameter is optional, and may be NULL.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, SetWakeupTimeFunctionId, (UINT64) Enable, (UINT64) Time, 0, 0, 0, 0, 0);
- return ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
- )
-/*++
-
-Routine Description:
-
- Returns the value of a variable.
-
-Arguments:
-
- VariableName - A Null-terminated Unicode string that is the name of the
- vendor's variable.
- VendorGuid - A unique identifier for the vendor.
- Attributes - If not NULL, a pointer to the memory location to return the
- attributes bitmask for the variable.
- DataSize - On input, the size in bytes of the return Data buffer.
- On output the size of data returned in Data.
- Data - The buffer to return the contents of the variable.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (
- &Guid,
- EsalGetVariableFunctionId,
- (UINT64) VariableName,
- (UINT64) VendorGuid,
- (UINT64) Attributes,
- (UINT64) DataSize,
- (UINT64) Data,
- 0,
- 0
- );
- return (EFI_STATUS) ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid
- )
-/*++
-
-Routine Description:
-
- Enumerates the current variable names.
-
-Arguments:
-
- VariableNameSize - The size of the VariableName buffer.
- VariableName - On input, supplies the last VariableName that was returned
- by GetNextVariableName().
- On output, returns the Nullterminated Unicode string of the
- current variable.
- VendorGuid - On input, supplies the last VendorGuid that was returned by
- GetNextVariableName().
- On output, returns the VendorGuid of the current variable.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (
- &Guid,
- EsalGetNextVariableNameFunctionId,
- (UINT64) VariableNameSize,
- (UINT64) VariableName,
- (UINT64) VendorGuid,
- 0,
- 0,
- 0,
- 0
- );
- return (EFI_STATUS) ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
- )
-/*++
-
-Routine Description:
-
- Sets the value of a variable.
-
-Arguments:
-
- VariableName - A Null-terminated Unicode string that is the name of the
- vendor's variable.
- VendorGuid - A unique identifier for the vendor.
- Attributes - Attributes bitmask to set for the variable.
- DataSize - The size in bytes of the Data buffer.
- Data - The contents for the variable.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (
- &Guid,
- EsalSetVariableFunctionId,
- (UINT64) VariableName,
- (UINT64) VendorGuid,
- (UINT64) Attributes,
- (UINT64) DataSize,
- (UINT64) Data,
- 0,
- 0
- );
- return (EFI_STATUS) ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetNextHighMonotonicCount (
- OUT UINT32 *HighCount
- )
-/*++
-
-Routine Description:
-
- Returns the next high 32 bits of the platform's monotonic counter.
-
-Arguments:
-
- HighCount - Pointer to returned value.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, GetNextHighMonotonicCountFunctionId, (UINT64) HighCount, 0, 0, 0, 0, 0, 0);
- return (EFI_STATUS) ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiConvertPointer (
- IN UINTN DebugDisposition,
- IN OUT VOID **Address
- )
-/*++
-
-Routine Description:
-
- Determines the new virtual address that is to be used on subsequent memory accesses.
-
-Arguments:
-
- DebugDisposition - Supplies type information for the pointer being converted.
- Address - A pointer to a pointer that is to be fixed to be the value needed
- for the new virtual address mappings being applied.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->ConvertPointer (DebugDisposition, Address);
-}
-
-EFI_STATUS
-EFIAPI
-EfiConvertList (
- IN UINTN DebugDisposition,
- IN OUT LIST_ENTRY *ListHead
- )
-/*++
-
-Routine Description:
-
- Conver the standard Lib double linked list to a virtual mapping.
-
-Arguments:
-
- DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)
-
- ListHead - Head of linked list to convert
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- LIST_ENTRY *Link;
- LIST_ENTRY *NextLink;
-
- //
- // Convert all the ForwardLink & BackLink pointers in the list
- //
- Link = ListHead;
- do {
- NextLink = Link->ForwardLink;
-
- EfiConvertPointer (
- Link->ForwardLink == ListHead ? DebugDisposition : 0,
- (VOID **) &Link->ForwardLink
- );
-
- EfiConvertPointer (
- Link->BackLink == ListHead ? DebugDisposition : 0,
- (VOID **) &Link->BackLink
- );
-
- Link = NextLink;
- } while (Link != ListHead);
- return EFI_SUCCESS;
-}
-
-
-/**
- Change the runtime addressing mode of EFI firmware from physical to virtual.
-
- @param MemoryMapSize The size in bytes of VirtualMap.
- @param DescriptorSize The size in bytes of an entry in the VirtualMap.
- @param DescriptorVersion The version of the structure entries in VirtualMap.
- @param VirtualMap An array of memory descriptors which contain new virtual
- address mapping information for all runtime ranges. Type
- EFI_MEMORY_DESCRIPTOR is defined in the
- GetMemoryMap() function description.
-
- @retval EFI_SUCCESS The virtual address map has been applied.
- @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
- virtual address mapped mode.
- @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
- invalid.
- @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
- map that requires a mapping.
- @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
- in the memory map.
-**/
-EFI_STATUS
-EFIAPI
-EfiSetVirtualAddressMap (
- IN UINTN MemoryMapSize,
- IN UINTN DescriptorSize,
- IN UINT32 DescriptorVersion,
- IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap
- )
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (
- &Guid,
- SetVirtualAddressFunctionId,
- (UINT64) MemoryMapSize,
- (UINT64) DescriptorSize,
- (UINT64) DescriptorVersion,
- (UINT64) VirtualMap,
- 0,
- 0,
- 0
- );
-
- return ReturnReg.Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-EfiUpdateCapsule (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-EfiQueryCapsuleCapabilities (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- OUT UINT64 *MaximumCapsuleSize,
- OUT EFI_RESET_TYPE *ResetType
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-
-EFI_STATUS
-EFIAPI
-EfiQueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize
- )
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/RuntimeLibInternal.h b/EdkModulePkg/Library/EdkUefiRuntimeLib/RuntimeLibInternal.h
deleted file mode 100644
index 223ad40..0000000
--- a/EdkModulePkg/Library/EdkUefiRuntimeLib/RuntimeLibInternal.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- RuntimeLibInternal.h
-
-Abstract:
-
---*/
-
-#ifndef __RUNTIMELIBINTERNAL_H__
-#define __RUNTIMELIBINTERNAL_H__
-
-extern EFI_RUNTIME_SERVICES *mRT;
-
-#endif //__RUNTIMELIBINTERNAL_H__
diff --git a/EdkModulePkg/Library/EdkUsbLib/EdkUsbLib.msa b/EdkModulePkg/Library/EdkUsbLib/EdkUsbLib.msa
deleted file mode 100644
index 263b608..0000000
--- a/EdkModulePkg/Library/EdkUsbLib/EdkUsbLib.msa
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkUsbLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>87eb5df9-722a-4241-ad7f-370d0b3a56d7</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for UsbDxeLib module</Abstract>
- <Description>This library provides supports for common USB functions.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkUsbLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkUsbLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>UsbDxeLib.c</Filename>
- <Filename>hid.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Library/EdkUsbLib/UsbDxeLib.c b/EdkModulePkg/Library/EdkUsbLib/UsbDxeLib.c
deleted file mode 100644
index 8bbd089..0000000
--- a/EdkModulePkg/Library/EdkUsbLib/UsbDxeLib.c
+++ /dev/null
@@ -1,699 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- UsbDxeLib.c
-
- Abstract:
-
- Common Dxe Libarary for USB
-
- Revision History
-
---*/
-
-//
-// Get Device Descriptor
-//
-EFI_STATUS
-UsbGetDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- OUT VOID *Descriptor,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Get Descriptor
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Value - Device Request Value
- Index - Device Request Index
- DescriptorLength - Descriptor Length
- Descriptor - Descriptor buffer to contain result
- Status - Transfer Status
-Returns:
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_DEV_GET_DESCRIPTOR;
- DevReq.Value = Value;
- DevReq.Index = Index;
- DevReq.Length = DescriptorLength;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- Descriptor,
- DescriptorLength,
- Status
- );
-}
-//
-// Set Device Descriptor
-//
-EFI_STATUS
-UsbSetDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- IN VOID *Descriptor,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Set Descriptor
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Value - Device Request Value
- Index - Device Request Index
- DescriptorLength - Descriptor Length
- Descriptor - Descriptor buffer to set
- Status - Transfer Status
-Returns:
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_SET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_DESCRIPTOR;
- DevReq.Value = Value;
- DevReq.Index = Index;
- DevReq.Length = DescriptorLength;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataOut,
- TIMEOUT_VALUE,
- Descriptor,
- DescriptorLength,
- Status
- );
-}
-
-//
-// Get device Interface
-//
-EFI_STATUS
-UsbGetDeviceInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Index,
- OUT UINT8 *AltSetting,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Get Device Interface
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Index - Interface index value
- AltSetting - Alternate setting
- Status - Trasnsfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE;
- DevReq.Request = USB_DEV_GET_INTERFACE;
- DevReq.Index = Index;
- DevReq.Length = 1;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- AltSetting,
- 1,
- Status
- );
-}
-//
-// Set device interface
-//
-EFI_STATUS
-UsbSetDeviceInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 InterfaceNo,
- IN UINT16 AltSetting,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Set Device Interface
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- InterfaceNo - Interface Number
- AltSetting - Alternate setting
- Status - Trasnsfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_SET_INTERFACE_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_INTERFACE;
- DevReq.Value = AltSetting;
- DevReq.Index = InterfaceNo;
-
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- Status
- );
-}
-//
-// Get device configuration
-//
-EFI_STATUS
-UsbGetDeviceConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- OUT UINT8 *ConfigValue,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Get Device Configuration
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- ConfigValue - Config Value
- Status - Transfer Status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_DEV_GET_CONFIGURATION;
- DevReq.Length = 1;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- ConfigValue,
- 1,
- Status
- );
-}
-//
-// Set device configuration
-//
-EFI_STATUS
-UsbSetDeviceConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Set Device Configuration
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Value - Configuration Value to set
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_CONFIGURATION;
- DevReq.Value = Value;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- Status
- );
-}
-//
-// Set Device Feature
-//
-EFI_STATUS
-UsbSetDeviceFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Set Device Feature
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Recipient - Interface/Device/Endpoint
- Value - Request value
- Target - Request Index
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- switch (Recipient) {
-
- case EfiUsbDevice:
- DevReq.RequestType = 0x00;
- break;
-
- case EfiUsbInterface:
- DevReq.RequestType = 0x01;
- break;
-
- case EfiUsbEndpoint:
- DevReq.RequestType = 0x02;
- break;
- }
- //
- // Fill device request, see USB1.1 spec
- //
- DevReq.Request = USB_DEV_SET_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = Target;
-
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- Status
- );
-}
-//
-// Clear Device Feature
-//
-EFI_STATUS
-UsbClearDeviceFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Clear Device Feature
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Recipient - Interface/Device/Endpoint
- Value - Request value
- Target - Request Index
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- switch (Recipient) {
-
- case EfiUsbDevice:
- DevReq.RequestType = 0x00;
- break;
-
- case EfiUsbInterface:
- DevReq.RequestType = 0x01;
- break;
-
- case EfiUsbEndpoint:
- DevReq.RequestType = 0x02;
- break;
- }
- //
- // Fill device request, see USB1.1 spec
- //
- DevReq.Request = USB_DEV_CLEAR_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = Target;
-
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- Status
- );
-}
-//
-// Get Device Status
-//
-EFI_STATUS
-UsbGetDeviceStatus (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Target,
- OUT UINT16 *DevStatus,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Get Device Status
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Recipient - Interface/Device/Endpoint
- Target - Request index
- DevStatus - Device status
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- switch (Recipient) {
-
- case EfiUsbDevice:
- DevReq.RequestType = 0x80;
- break;
-
- case EfiUsbInterface:
- DevReq.RequestType = 0x81;
- break;
-
- case EfiUsbEndpoint:
- DevReq.RequestType = 0x82;
- break;
- }
- //
- // Fill device request, see USB1.1 spec
- //
- DevReq.Request = USB_DEV_GET_STATUS;
- DevReq.Value = 0;
- DevReq.Index = Target;
- DevReq.Length = 2;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- DevStatus,
- 2,
- Status
- );
-}
-//
-// Usb Get String
-//
-EFI_STATUS
-UsbGetString (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 LangID,
- IN UINT8 Index,
- IN VOID *Buf,
- IN UINTN BufSize,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Get String
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- LangID - Language ID
- Index - Request index
- Buf - Buffer to store string
- BufSize - Buffer size
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- UINT16 Value;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Fill value, see USB1.1 spec
- //
- Value = (UINT16) ((USB_DT_STRING << 8) | Index);
-
- return UsbGetDescriptor (
- UsbIo,
- Value,
- LangID,
- (UINT16) BufSize,
- Buf,
- Status
- );
-}
-
-EFI_STATUS
-UsbClearEndpointHalt (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 EndpointNo,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Clear endpoint stall
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- EndpointNo - Endpoint Number
- Status - Transfer Status
-
-Returns:
-
- EFI_NOT_FOUND - Can't find the Endpoint
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
-
---*/
-{
- EFI_STATUS Result;
- EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
- UINT8 Index;
-
- ZeroMem (&EndpointDescriptor, sizeof (EFI_USB_ENDPOINT_DESCRIPTOR));
- //
- // First seach the endpoint descriptor for that endpoint addr
- //
- Result = UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &InterfaceDescriptor
- );
- if (EFI_ERROR (Result)) {
- return Result;
- }
-
- for (Index = 0; Index < InterfaceDescriptor.NumEndpoints; Index++) {
- Result = UsbIo->UsbGetEndpointDescriptor (
- UsbIo,
- Index,
- &EndpointDescriptor
- );
- if (EFI_ERROR (Result)) {
- continue;
- }
-
- if (EndpointDescriptor.EndpointAddress == EndpointNo) {
- break;
- }
- }
-
- if (Index == InterfaceDescriptor.NumEndpoints) {
- //
- // No such endpoint
- //
- return EFI_NOT_FOUND;
- }
-
- Result = UsbClearDeviceFeature (
- UsbIo,
- EfiUsbEndpoint,
- EfiUsbEndpointHalt,
- EndpointDescriptor.EndpointAddress,
- Status
- );
-
- return Result;
-}
diff --git a/EdkModulePkg/Library/EdkUsbLib/hid.c b/EdkModulePkg/Library/EdkUsbLib/hid.c
deleted file mode 100644
index edf9a94..0000000
--- a/EdkModulePkg/Library/EdkUsbLib/hid.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- hid.c
-
- Abstract:
-
- HID class request
-
- Revision History
-
---*/
-
-//
-// Function to get HID descriptor
-//
-EFI_STATUS
-UsbGetHidDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 InterfaceNum,
- OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
- )
-/*++
-
- Routine Description:
- Get Hid Descriptor
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- InterfaceNum - Hid interface number
- HidDescriptor - Caller allocated buffer to store Usb hid descriptor
- if successfully returned.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- Request.RequestType = 0x81;
- Request.Request = 0x06;
- Request.Value = (UINT16) (0x21 << 8);
- Request.Index = InterfaceNum;
- Request.Length = sizeof (EFI_USB_HID_DESCRIPTOR);
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- HidDescriptor,
- sizeof (EFI_USB_HID_DESCRIPTOR),
- &Status
- );
-
- return Result;
-
-}
-//
-// Function to get Report Class descriptor
-//
-EFI_STATUS
-UsbGetReportDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 InterfaceNum,
- IN UINT16 DescriptorSize,
- OUT UINT8 *DescriptorBuffer
- )
-/*++
-
- Routine Description:
- get Report Class descriptor
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL.
- InterfaceNum - Report interface number.
- DescriptorSize - Length of DescriptorBuffer.
- DescriptorBuffer - Caller allocated buffer to store Usb report descriptor
- if successfully returned.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0x81;
- Request.Request = 0x06;
- Request.Value = (UINT16) (0x22 << 8);
- Request.Index = InterfaceNum;
- Request.Length = DescriptorSize;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- DescriptorBuffer,
- DescriptorSize,
- &Status
- );
-
- return Result;
-
-}
-//
-// Following are HID class request
-//
-EFI_STATUS
-UsbGetProtocolRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 *Protocol
- )
-/*++
-
- Routine Description:
- Get Hid Protocol Request
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to get protocol
- Protocol - Protocol value returned.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0xa1;
- //
- // 10100001b;
- //
- Request.Request = EFI_USB_GET_PROTOCOL_REQUEST;
- Request.Value = 0;
- Request.Index = Interface;
- Request.Length = 1;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- Protocol,
- sizeof (UINT8),
- &Status
- );
-
- return Result;
-}
-
-
-EFI_STATUS
-UsbSetProtocolRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 Protocol
- )
-/*++
-
- Routine Description:
- Set Hid Protocol Request
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set protocol
- Protocol - Protocol value the caller wants to set.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0x21;
- //
- // 00100001b;
- //
- Request.Request = EFI_USB_SET_PROTOCOL_REQUEST;
- Request.Value = Protocol;
- Request.Index = Interface;
- Request.Length = 0;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- &Status
- );
- return Result;
-}
-
-
-EFI_STATUS
-UsbSetIdleRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 Duration
- )
-/*++
-
- Routine Description:
- Set Idel request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set.
- ReportId - Which report the caller wants to set.
- Duration - Idle rate the caller wants to set.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0x21;
- //
- // 00100001b;
- //
- Request.Request = EFI_USB_SET_IDLE_REQUEST;
- Request.Value = (UINT16) ((Duration << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = 0;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- &Status
- );
- return Result;
-}
-
-EFI_STATUS
-UsbGetIdleRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- OUT UINT8 *Duration
- )
-/*++
-
- Routine Description:
- Get Idel request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to get.
- ReportId - Which report the caller wants to get.
- Duration - Idle rate the caller wants to get.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0xa1;
- //
- // 10100001b;
- //
- Request.Request = EFI_USB_GET_IDLE_REQUEST;
- Request.Value = ReportId;
- Request.Index = Interface;
- Request.Length = 1;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- Duration,
- 1,
- &Status
- );
-
- return Result;
-}
-
-
-EFI_STATUS
-UsbSetReportRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 ReportType,
- IN UINT16 ReportLen,
- IN UINT8 *Report
- )
-/*++
-
- Routine Description:
- Hid Set Report request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set.
- ReportId - Which report the caller wants to set.
- ReportType - Type of report.
- ReportLen - Length of report descriptor.
- Report - Report Descriptor buffer.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0x21;
- //
- // 00100001b;
- //
- Request.Request = EFI_USB_SET_REPORT_REQUEST;
- Request.Value = (UINT16) ((ReportType << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = ReportLen;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataOut,
- TIMEOUT_VALUE,
- Report,
- ReportLen,
- &Status
- );
-
- return Result;
-}
-
-EFI_STATUS
-UsbGetReportRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 ReportType,
- IN UINT16 ReportLen,
- IN UINT8 *Report
- )
-/*++
-
- Routine Description:
- Hid Set Report request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set.
- ReportId - Which report the caller wants to set.
- ReportType - Type of report.
- ReportLen - Length of report descriptor.
- Report - Caller allocated buffer to store Report Descriptor.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0xa1;
- //
- // 10100001b;
- //
- Request.Request = EFI_USB_GET_REPORT_REQUEST;
- Request.Value = (UINT16) ((ReportType << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = ReportLen;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- Report,
- ReportLen,
- &Status
- );
-
- return Result;
-}
diff --git a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c b/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
deleted file mode 100644
index c71f1e7..0000000
--- a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PeiPerformanceLib.c
-
-Abstract:
-
- Performance Library
-
---*/
-
-/**
- Gets PEI the GUID HOB for PEI performance.
-
- This internal function searches for the GUID HOB for PEI performance.
- If that GUID HOB is not found, it will build a new one.
- It returns the data area of that GUID HOB to record performance log.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
-
- @retval The index of log entry in the array.
-
-**/
-STATIC
-PEI_PERFORMANCE_LOG_HEADER *
-InternalGetPerformanceHobLog (
- VOID
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
- PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;
- UINTN PeiPerformanceLogSize;
-
- GuidHob = GetFirstGuidHob (&gPeiPerformanceHobGuid);
-
- if (GuidHob != NULL) {
- //
- // PEI Performance HOB was found, then return the existing one.
- //
- PeiPerformanceLog = GET_GUID_HOB_DATA (GuidHob);
- } else {
- //
- // PEI Performance HOB was not found, then build one.
- //
- PeiPerformanceLogSize = sizeof (PEI_PERFORMANCE_LOG_HEADER) +
- sizeof (PEI_PERFORMANCE_LOG_ENTRY) * PcdGet8 (PcdMaxPeiPerformanceLogEntries);
- PeiPerformanceLog = BuildGuidHob (&gPeiPerformanceHobGuid, PeiPerformanceLogSize);
- PeiPerformanceLog = ZeroMem (PeiPerformanceLog, PeiPerformanceLogSize);
- }
-
- return PeiPerformanceLog;
-}
-
-/**
- Searches in the log array with keyword Handle, Token and Module.
-
- This internal function searches for the log entry in the log array.
- If there is an entry that exactly matches the given key word triple
- and its end time stamp is zero, then the index of that log entry is returned;
- otherwise, the the number of log entries in the array is returned.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
-
- @retval The index of log entry in the array.
-
-**/
-STATIC
-UINT32
-InternalSearchForLogEntry (
- IN PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog,
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module OPTIONAL
- )
-{
- UINT32 Index;
- UINT32 NumberOfEntries;
- PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;
-
-
- if (Token == NULL) {
- Token = "";
- }
- if (Module == NULL) {
- Module = "";
- }
- NumberOfEntries = PeiPerformanceLog->NumberOfEntries;
- LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);
-
- for (Index = 0; Index < NumberOfEntries; Index++) {
- if ((LogEntryArray[Index].Handle == (EFI_PHYSICAL_ADDRESS) (UINTN) Handle) &&
- AsciiStrnCmp (LogEntryArray[Index].Token, Token, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&
- AsciiStrnCmp (LogEntryArray[Index].Module, Module, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&
- LogEntryArray[Index].EndTimeStamp == 0
- ) {
- break;
- }
- }
- return Index;
-}
-
-/**
- Creates a record for the beginning of a performance measurement.
-
- Creates a record that contains the Handle, Token, and Module.
- If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
- If TimeStamp is zero, then this function reads the current time stamp
- and adds that time stamp value to the record as the start time.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The start of the measurement was recorded.
- @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-RETURN_STATUS
-EFIAPI
-StartPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;
- PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;
- UINT32 Index;
-
- PeiPerformanceLog = InternalGetPerformanceHobLog ();
-
- if (PeiPerformanceLog->NumberOfEntries >= PcdGet8 (PcdMaxPeiPerformanceLogEntries)) {
- return RETURN_OUT_OF_RESOURCES;
- }
- Index = PeiPerformanceLog->NumberOfEntries++;
- LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);
- LogEntryArray[Index].Handle = (EFI_PHYSICAL_ADDRESS) (UINTN) Handle;
-
- if (Token != NULL) {
- AsciiStrnCpy (LogEntryArray[Index].Token, Token, PEI_PERFORMANCE_STRING_LENGTH);
- }
- if (Module != NULL) {
- AsciiStrnCpy (LogEntryArray[Index].Module, Module, PEI_PERFORMANCE_STRING_LENGTH);
- }
-
- if (TimeStamp == 0) {
- TimeStamp = GetPerformanceCounter ();
- }
- LogEntryArray[Index].StartTimeStamp = TimeStamp;
-
- return RETURN_SUCCESS;
-}
-
-/**
- Fills in the end time of a performance measurement.
-
- Looks up the record that matches Handle, Token, and Module.
- If the record can not be found then return RETURN_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then TimeStamp is added to the record as the end time.
- If the record is found and TimeStamp is zero, then this function reads
- the current time stamp and adds that time stamp value to the record as the end time.
- If this function is called multiple times for the same record, then the end time is overwritten.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The end of the measurement was recorded.
- @retval RETURN_NOT_FOUND The specified measurement record could not be found.
-
-**/
-RETURN_STATUS
-EFIAPI
-EndPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;
- PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;
- UINT32 Index;
-
- if (TimeStamp == 0) {
- TimeStamp = GetPerformanceCounter ();
- }
-
- PeiPerformanceLog = InternalGetPerformanceHobLog ();
- Index = InternalSearchForLogEntry (PeiPerformanceLog, Handle, Token, Module);
- if (Index >= PeiPerformanceLog->NumberOfEntries) {
- return RETURN_NOT_FOUND;
- }
- LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);
- LogEntryArray[Index].EndTimeStamp = TimeStamp;
-
- return RETURN_SUCCESS;
-}
-
-/**
- Attempts to retrieve a performance measurement log entry from the performance measurement log.
-
- Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
- zero on entry, then an attempt is made to retrieve the first entry from the performance log,
- and the key for the second entry in the log is returned. If the performance log is empty,
- then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
- log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
- returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
- retrieved and an implementation specific non-zero key value that specifies the end of the performance
- log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
- is retrieved and zero is returned. In the cases where a performance log entry can be returned,
- the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
- If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
- If Handle is NULL, then ASSERT().
- If Token is NULL, then ASSERT().
- If Module is NULL, then ASSERT().
- If StartTimeStamp is NULL, then ASSERT().
- If EndTimeStamp is NULL, then ASSERT().
-
- @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
- 0, then the first performance measurement log entry is retrieved.
- On exit, the key of the next performance lof entry entry.
- @param Handle Pointer to environment specific context used to identify the component
- being measured.
- @param Token Pointer to a Null-terminated ASCII string that identifies the component
- being measured.
- @param Module Pointer to a Null-terminated ASCII string that identifies the module
- being measured.
- @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was started.
- @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was ended.
-
- @return The key for the next performance log entry (in general case).
-
-**/
-UINTN
-EFIAPI
-GetPerformanceMeasurement (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp
- )
-{
- PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;
- PEI_PERFORMANCE_LOG_ENTRY *CurrentLogEntry;
- PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;
- UINTN NumberOfEntries;
-
- ASSERT (Handle != NULL);
- ASSERT (Token != NULL);
- ASSERT (Module != NULL);
- ASSERT (StartTimeStamp != NULL);
- ASSERT (EndTimeStamp != NULL);
-
- PeiPerformanceLog = InternalGetPerformanceHobLog ();
-
- NumberOfEntries = (UINTN) (PeiPerformanceLog->NumberOfEntries);
- LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);
- //
- // Make sure that LogEntryKey is a valid log entry key.
- //
- ASSERT (LogEntryKey <= NumberOfEntries);
-
- if (LogEntryKey == NumberOfEntries) {
- return 0;
- }
-
- CurrentLogEntry = &(LogEntryArray[LogEntryKey++]);
-
- *Handle = (VOID *) (UINTN) (CurrentLogEntry->Handle);
- *Token = CurrentLogEntry->Token;
- *Module = CurrentLogEntry->Module;
- *StartTimeStamp = CurrentLogEntry->StartTimeStamp;
- *EndTimeStamp = CurrentLogEntry->EndTimeStamp;
-
- return LogEntryKey;
-}
-
-/**
- Returns TRUE if the performance measurement macros are enabled.
-
- This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set.
- @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-PerformanceMeasurementEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
-}
diff --git a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa b/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa
deleted file mode 100644
index 85ce0ad..0000000
--- a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>PeiPerformanceLib</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>F72DE735-B24F-4ef6-897F-70A85D01A047</GuidValue>
- <Version>1.0</Version>
- <Abstract>Memory-only library functions with no library constructor/destructor</Abstract>
- <Description>This module provides the performance measurement interfaces in PEI phase, it is one instance of Performance Libarary.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>PeiPerformanceLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="PEIM PEI_CORE">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>TimerLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>PeiPerformanceLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gPeiPerformanceHobGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The bitmask of flags that specify the enable/disable of
- Performance Measurement.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdMaxPeiPerformanceLogEntries</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>Maximun number of performance log entries during PEI phase.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Logo/Logo.bmp b/EdkModulePkg/Logo/Logo.bmp
deleted file mode 100644
index 3e85229..0000000
--- a/EdkModulePkg/Logo/Logo.bmp
+++ /dev/null
Binary files differ
diff --git a/EdkModulePkg/Logo/Logo.msa b/EdkModulePkg/Logo/Logo.msa
deleted file mode 100644
index 35923df..0000000
--- a/EdkModulePkg/Logo/Logo.msa
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Logo</ModuleName>
- <ModuleType>BASE</ModuleType>
- <GuidValue>7BB28B99-61BB-11D5-9A5D-0090273FC14D</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for creating a Logo file.</Abstract>
- <Description>
- This module provides the default logo bitmap picture
- shown on setup screen, which is correspondig to gEfiDefaultBmpLogoGuid.
- </Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>true</BinaryModule>
- <OutputFileBasename>Logo</OutputFileBasename>
- </ModuleDefinitions>
- <SourceFiles>
- <Filename>Logo.bmp</Filename>
- </SourceFiles>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Universal/Capsule/RuntimeDxe/Capsule.c b/EdkModulePkg/Universal/Capsule/RuntimeDxe/Capsule.c
deleted file mode 100644
index 15736c6..0000000
--- a/EdkModulePkg/Universal/Capsule/RuntimeDxe/Capsule.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Capsule.c
-
-Abstract:
-
- Capsule Runtime Service Initialization
-
---*/
-
-#include "CapsuleService.h"
-
-
-EFI_STATUS
-EFIAPI
-CapsuleServiceInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- This code is capsule runtime service initialization.
-
-Arguments:
-
- ImageHandle The image handle
- SystemTable The system table.
-
-Returns:
-
- EFI STATUS
-
---*/
-{
- EFI_STATUS Status;
- EFI_HANDLE NewHandle;
-
- SystemTable->RuntimeServices->UpdateCapsule = UpdateCapsule;
- SystemTable->RuntimeServices->QueryCapsuleCapabilities = QueryCapsuleCapabilities;
-
- //
- // Now install the Capsule Architectural Protocol on a new handle
- //
- NewHandle = NULL;
-
- Status = gBS->InstallMultipleProtocolInterfaces (
- &NewHandle,
- &gEfiCapsuleArchProtocolGuid,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/Capsule/RuntimeDxe/Capsule.dxs b/EdkModulePkg/Universal/Capsule/RuntimeDxe/Capsule.dxs
deleted file mode 100644
index dcafb56..0000000
--- a/EdkModulePkg/Universal/Capsule/RuntimeDxe/Capsule.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Capsule.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include "DxeDepex.h"
-
-DEPENDENCY_START
- EFI_VARIABLE_ARCH_PROTOCOL_GUID
-DEPENDENCY_END
-
diff --git a/EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleRuntime.msa b/EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleRuntime.msa
deleted file mode 100644
index b7b946e..0000000
--- a/EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleRuntime.msa
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>CapsuleRuntime</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>42857F0A-13F2-4B21-8A23-53D3F714B840</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Capsule module.</Abstract>
- <Description>CapsuleRuntime module provides capsule runtime services</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>CapsuleRuntime</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DxeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Capsule.c</Filename>
- <Filename>CapsuleService.c</Filename>
- <Filename>CapsuleService.h</Filename>
- <Filename>Capsule.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiCapsuleArchProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiCapsuleGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiCapsuleVendorGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>CapsuleServiceInitialize</ModuleEntryPoint>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdSupportUpdateCapsuleRest</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>Indicate whether platform can support update capsule across a system reset</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaxSizePopulateCapsule</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>Indicate the max size the platform can support in case of populated capsules</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdMaxSizeNonPopulateCapsule</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>Indicate the max size the platform can support in case of non-populated capsules</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleService.c b/EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleService.c
deleted file mode 100644
index 2153b20..0000000
--- a/EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleService.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- CapsuleService.c
-
-Abstract:
-
- Capsule Runtime Service.
-
---*/
-
-#include "CapsuleService.h"
-
-EFI_STATUS
-EFIAPI
-UpdateCapsule (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
- )
-/*++
-
-Routine Description:
-
- This code finds whether the capsules need reset to update, if not, update immediately.
-
-Arguments:
-
- CapsuleHeaderArray A array of pointers to capsule headers passed in
- CapsuleCount The number of capsule
- ScatterGatherList Physical address of datablock list points to capsule
-
-Returns:
-
- EFI STATUS
- EFI_SUCCESS Valid capsule was passed.If CAPSULE_FLAG_PERSIT_ACROSS_RESET is
- not set, the capsule has been successfully processed by the firmware.
- If it set, the ScattlerGatherList is successfully to be set.
- EFI_INVALID_PARAMETER CapsuleCount is less than 1,CapsuleGuid is not supported.
- EFI_DEVICE_ERROR Failed to SetVariable or AllocatePool or ProcessFirmwareVolume.
-
---*/
-{
- UINTN CapsuleSize;
- UINTN ArrayNumber;
- VOID *BufferPtr;
- EFI_STATUS Status;
- EFI_HANDLE FvHandle;
- UEFI_CAPSULE_HEADER *CapsuleHeader;
-
- if (CapsuleCount < 1) {
- return EFI_INVALID_PARAMETER;
- }
-
- BufferPtr = NULL;
- CapsuleHeader = NULL;
-
- //
- //Compare GUIDs with EFI_CAPSULE_GUID, if capsule header contains CAPSULE_FLAGS_PERSIST_ACROSS_RESET
- //and CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE flags,whatever the GUID is ,the service supports.
- //
- for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
- CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
- if ((CapsuleHeader->Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)) == CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) {
- return EFI_INVALID_PARAMETER;
- }
- if (!CompareGuid (&CapsuleHeader->CapsuleGuid, &gEfiCapsuleGuid)) {
- if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
- return EFI_UNSUPPORTED;
- }
- }
- }
-
- //
- //Assume that capsules have the same flags on reseting or not.
- //
- CapsuleHeader = CapsuleHeaderArray[0];
-
- if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {
- //
- //Check if the platform supports update capsule across a system reset
- //
- if (!FeaturePcdGet(PcdSupportUpdateCapsuleRest)) {
- return EFI_UNSUPPORTED;
- }
-
- if (ScatterGatherList == 0) {
- return EFI_INVALID_PARAMETER;
- } else {
- Status = EfiSetVariable (
- EFI_CAPSULE_VARIABLE_NAME,
- &gEfiCapsuleVendorGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof (UINTN),
- (VOID *) &ScatterGatherList
- );
- if (Status != EFI_SUCCESS) {
- return EFI_DEVICE_ERROR;
- }
- }
- return EFI_SUCCESS;
- }
-
- //
- //The rest occurs in the condition of non-reset mode
- //
- if (EfiAtRuntime ()) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- //Here should be in the boot-time
- //
- for (ArrayNumber = 0; ArrayNumber < CapsuleCount ; ArrayNumber++) {
- CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
- CapsuleSize = CapsuleHeader->CapsuleImageSize - CapsuleHeader->HeaderSize;
-
- BufferPtr = AllocatePool (CapsuleSize);
- if (BufferPtr == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- CopyMem (BufferPtr, (UINT8*)CapsuleHeader+ CapsuleHeader->HeaderSize, CapsuleSize);
-
- //
- //Call DXE service ProcessFirmwareVolume to process immediatelly
- //
- Status = gDS->ProcessFirmwareVolume (BufferPtr, CapsuleSize, &FvHandle);
- if (Status != EFI_SUCCESS) {
- FreePool (BufferPtr);
- return EFI_DEVICE_ERROR;
- }
- gDS->Dispatch ();
- FreePool (BufferPtr);
- }
-
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-QueryCapsuleCapabilities (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- OUT UINT64 *MaxiumCapsuleSize,
- OUT EFI_RESET_TYPE *ResetType
- )
-/*++
-
-Routine Description:
-
- This code is to query about capsule capability.
-
-Arguments:
-
- CapsuleHeaderArray A array of pointers to capsule headers passed in
- CapsuleCount The number of capsule
- MaxiumCapsuleSize Max capsule size is supported
- ResetType Reset type the capsule indicates, if reset is not needed,return EfiResetCold.
- If reset is needed, return EfiResetWarm.
-
-Returns:
-
- EFI STATUS
- EFI_SUCCESS Valid answer returned
- EFI_INVALID_PARAMETER MaxiumCapsuleSize is NULL,ResetType is NULL.CapsuleCount is less than 1,CapsuleGuid is not supported.
- EFI_UNSUPPORTED The capsule type is not supported.
-
---*/
-{
- UINTN ArrayNumber;
- UEFI_CAPSULE_HEADER *CapsuleHeader;
-
- if (CapsuleCount < 1) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((MaxiumCapsuleSize == NULL) ||(ResetType == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- CapsuleHeader = NULL;
-
- //
- //Compare GUIDs with EFI_CAPSULE_GUID, if capsule header contains CAPSULE_FLAGS_PERSIST_ACROSS_RESET
- //and CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE flags,whatever the GUID is ,the service supports.
- //
- for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
- CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
- if ((CapsuleHeader->Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)) == CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) {
- return EFI_INVALID_PARAMETER;
- }
- if (!CompareGuid (&CapsuleHeader->CapsuleGuid, &gEfiCapsuleGuid)) {
- if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
- return EFI_UNSUPPORTED;
- }
- }
- }
-
- //
- //Assume that capsules have the same flags on reseting or not.
- //
- CapsuleHeader = CapsuleHeaderArray[0];
- if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {
- //
- //Check if the platform supports update capsule across a system reset
- //
- if (!FeaturePcdGet(PcdSupportUpdateCapsuleRest)) {
- return EFI_UNSUPPORTED;
- }
- *ResetType = EfiResetWarm;
- *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizePopulateCapsule);
- } else {
- *ResetType = EfiResetCold;
- *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizeNonPopulateCapsule);
- }
- return EFI_SUCCESS;
-}
-
diff --git a/EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleService.h b/EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleService.h
deleted file mode 100644
index c57fe51..0000000
--- a/EdkModulePkg/Universal/Capsule/RuntimeDxe/CapsuleService.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- CapsuleService.h
-
-Abstract:
-
- Capsule Runtime Service
-
---*/
-
-#ifndef _CAPSULE_RUNTIME_H_
-#define _CAPSULE_RUNTIME_H_
-
-#include <Common/CapsuleName.h>
-
-extern EFI_GUID gEfiCapsuleGuid;
-
-EFI_STATUS
-EFIAPI
-UpdateCapsule(
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
- );
-
-EFI_STATUS
-EFIAPI
-QueryCapsuleCapabilities(
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- OUT UINT64 *MaxiumCapsuleSize,
- OUT EFI_RESET_TYPE *ResetType
- );
-
-#endif
-
diff --git a/EdkModulePkg/Universal/ConPlatform/Dxe/ComponentName.c b/EdkModulePkg/Universal/ConPlatform/Dxe/ComponentName.c
deleted file mode 100644
index f854499..0000000
--- a/EdkModulePkg/Universal/ConPlatform/Dxe/ComponentName.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "ConPlatform.h"
-#include "ComponentName.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName = {
- ConPlatformComponentNameGetDriverName,
- ConPlatformComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mConPlatformDriverNameTable[] = {
- {
- "eng",
- L"Platform Console Management Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-ConPlatformComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gConPlatformComponentName.SupportedLanguages,
- mConPlatformDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-ConPlatformComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Universal/ConPlatform/Dxe/ComponentName.h b/EdkModulePkg/Universal/ConPlatform/Dxe/ComponentName.h
deleted file mode 100644
index 3bada84..0000000
--- a/EdkModulePkg/Universal/ConPlatform/Dxe/ComponentName.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.h
-
-Abstract:
-
---*/
-
-#ifndef CON_MANAGE_COMPONENT_NAME_H_
-#define CON_MANAGE_COMPONENT_NAME_H_
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-ConPlatformComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-ConPlatformComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-#endif
diff --git a/EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.c b/EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.c
deleted file mode 100644
index 1972e0c..0000000
--- a/EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.c
+++ /dev/null
@@ -1,868 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ConPlatform.c
-
-Abstract:
-
---*/
-
-#include "ConPlatform.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding = {
- ConPlatformTextInDriverBindingSupported,
- ConPlatformTextInDriverBindingStart,
- ConPlatformTextInDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding = {
- ConPlatformTextOutDriverBindingSupported,
- ConPlatformTextOutDriverBindingStart,
- ConPlatformTextOutDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextInDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Supported
-
-Arguments:
- (Standard DriverBinding Protocol Supported() function)
-
-Returns:
-
- None
-
---*/
-{
- return ConPlatformDriverBindingSupported (
- This,
- ControllerHandle,
- RemainingDevicePath,
- &gEfiSimpleTextInProtocolGuid
- );
-}
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextOutDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Supported
-
-Arguments:
- (Standard DriverBinding Protocol Supported() function)
-
-Returns:
-
- None
-
---*/
-{
- return ConPlatformDriverBindingSupported (
- This,
- ControllerHandle,
- RemainingDevicePath,
- &gEfiSimpleTextOutProtocolGuid
- );
-}
-
-EFI_STATUS
-ConPlatformDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
- IN EFI_GUID *ProtocolGuid
- )
-/*++
-
-Routine Description:
- Supported
-
-Arguments:
- (Standard DriverBinding Protocol Supported() function)
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- VOID *Interface;
-
- //
- // Test to see if this is a physical device by checking to see if
- // it has a Device Path Protocol
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- NULL,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Test to see if this device supports the Simple Text Output Protocol
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- ProtocolGuid,
- (VOID **) &Interface,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- ControllerHandle,
- ProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextInDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
- (Standard DriverBinding Protocol Start() function)
-
-Returns:
-
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_SIMPLE_TEXT_IN_PROTOCOL *TextIn;
-
- //
- // Get the Device Path Protocol so the environment variables can be updated
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Open the Simple Input Protocol BY_DRIVER
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleTextInProtocolGuid,
- (VOID **) &TextIn,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Check the device handle, if it is a hot plug device,
- // do not put the device path into ConInDev, and install
- // gEfiConsoleInDeviceGuid to the device handle directly.
- // The policy is, make hot plug device plug in and play immediately.
- //
- if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
- gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiConsoleInDeviceGuid,
- NULL,
- NULL
- );
- } else {
- //
- // Append the device path to the ConInDev environment variable
- //
- ConPlatformUpdateDeviceVariable (
- VarConsoleInpDev,
- DevicePath,
- APPEND
- );
-
- //
- // If the device path is an instance in the ConIn environment variable,
- // then install EfiConsoleInDeviceGuid onto ControllerHandle
- //
- Status = ConPlatformUpdateDeviceVariable (
- VarConsoleInp,
- DevicePath,
- CHECK
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiConsoleInDeviceGuid,
- NULL,
- NULL
- );
- } else {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSimpleTextInProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextOutDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
- (Standard DriverBinding Protocol Start() function)
-
-Returns:
-
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
- BOOLEAN NeedClose;
-
- NeedClose = TRUE;
-
- //
- // Get the Device Path Protocol so the environment variables can be updated
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Open the Simple Text Output Protocol BY_DRIVER
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &TextOut,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Check the device handle, if it is a hot plug device,
- // do not put the device path into ConOutDev and StdErrDev,
- // and install gEfiConsoleOutDeviceGuid to the device handle directly.
- // The policy is, make hot plug device plug in and play immediately.
- //
- if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
- gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiConsoleOutDeviceGuid,
- NULL,
- NULL
- );
- } else {
- //
- // Append the device path to the ConOutDev environment variable
- //
- ConPlatformUpdateDeviceVariable (
- VarConsoleOutDev,
- DevicePath,
- APPEND
- );
- //
- // Append the device path to the StdErrDev environment variable
- //
- ConPlatformUpdateDeviceVariable (
- VarErrorOutDev,
- DevicePath,
- APPEND
- );
-
- //
- // If the device path is an instance in the ConOut environment variable,
- // then install EfiConsoleOutDeviceGuid onto ControllerHandle
- //
- Status = ConPlatformUpdateDeviceVariable (
- VarConsoleOut,
- DevicePath,
- CHECK
- );
-
- if (!EFI_ERROR (Status)) {
- NeedClose = FALSE;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiConsoleOutDeviceGuid,
- NULL,
- NULL
- );
- }
- //
- // If the device path is an instance in the StdErr environment variable,
- // then install EfiStandardErrorDeviceGuid onto ControllerHandle
- //
- Status = ConPlatformUpdateDeviceVariable (
- VarErrorOut,
- DevicePath,
- CHECK
- );
- if (!EFI_ERROR (Status)) {
- NeedClose = FALSE;
- gBS->InstallMultipleProtocolInterfaces (
- &ControllerHandle,
- &gEfiStandardErrorDeviceGuid,
- NULL,
- NULL
- );
- }
-
- if (NeedClose) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSimpleTextOutProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextInDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
- (Standard DriverBinding Protocol Stop() function)
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- //
- // hot plug device is not included into the console associated variables,
- // so no need to check variable for those hot plug devices.
- //
- if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
- //
- // Get the Device Path Protocol so the environment variables can be updated
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- //
- // Remove DevicePath from ConInDev
- //
- ConPlatformUpdateDeviceVariable (
- VarConsoleInpDev,
- DevicePath,
- DELETE
- );
- }
- }
- //
- // Uninstall the Console Device GUIDs from Controller Handle
- //
- ConPlatformUnInstallProtocol (
- This,
- ControllerHandle,
- &gEfiConsoleInDeviceGuid
- );
-
- //
- // Close the Simple Input Protocol
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSimpleTextInProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextOutDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
- (Standard DriverBinding Protocol Stop() function)
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- //
- // hot plug device is not included into the console associated variables,
- // so no need to check variable for those hot plug devices.
- //
- if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
- //
- // Get the Device Path Protocol so the environment variables can be updated
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- //
- // Remove DevicePath from ConOutDev, and StdErrDev
- //
- ConPlatformUpdateDeviceVariable (
- VarConsoleOutDev,
- DevicePath,
- DELETE
- );
- ConPlatformUpdateDeviceVariable (
- VarErrorOutDev,
- DevicePath,
- DELETE
- );
- }
- }
- //
- // Uninstall the Console Device GUIDs from Controller Handle
- //
- ConPlatformUnInstallProtocol (
- This,
- ControllerHandle,
- &gEfiConsoleOutDeviceGuid
- );
-
- ConPlatformUnInstallProtocol (
- This,
- ControllerHandle,
- &gEfiStandardErrorDeviceGuid
- );
-
- //
- // Close the Simple Text Output Protocol
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSimpleTextOutProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_SUCCESS;
-}
-
-
-VOID
-ConPlatformUnInstallProtocol (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_GUID *ProtocolGuid
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->OpenProtocol (
- Handle,
- ProtocolGuid,
- NULL,
- This->DriverBindingHandle,
- Handle,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->UninstallMultipleProtocolInterfaces (
- Handle,
- ProtocolGuid,
- NULL,
- NULL
- );
- }
-
- return ;
-}
-
-VOID *
-ConPlatformGetVariable (
- IN CHAR16 *Name
- )
-/*++
-
-Routine Description:
- Read the EFI variable (Name) and return a dynamically allocated
- buffer, and the size of the buffer. On failure return NULL.
-
-Arguments:
- Name - String part of EFI variable name
-
-Returns:
- Dynamically allocated memory that contains a copy of the EFI variable.
- Caller is repsoncible freeing the buffer.
-
- NULL - Variable was not read
-
---*/
-{
- EFI_STATUS Status;
- VOID *Buffer;
- UINTN BufferSize;
-
- BufferSize = 0;
- Buffer = NULL;
-
- //
- // Test to see if the variable exists. If it doesn't reuturn NULL
- //
- Status = gRT->GetVariable (
- Name,
- &gEfiGlobalVariableGuid,
- NULL,
- &BufferSize,
- Buffer
- );
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // Allocate the buffer to return
- //
- Buffer = AllocatePool (BufferSize);
- if (Buffer == NULL) {
- return NULL;
- }
- //
- // Read variable into the allocated buffer.
- //
- Status = gRT->GetVariable (
- Name,
- &gEfiGlobalVariableGuid,
- NULL,
- &BufferSize,
- Buffer
- );
- if (EFI_ERROR (Status)) {
- FreePool (Buffer);
- Buffer = NULL;
- }
- }
-
- return Buffer;
-}
-
-EFI_STATUS
-ConPlatformMatchDevicePaths (
- IN EFI_DEVICE_PATH_PROTOCOL * Multi,
- IN EFI_DEVICE_PATH_PROTOCOL * Single,
- IN EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,
- IN BOOLEAN Delete
- )
-/*++
-
-Routine Description:
- Function compares a device path data structure to that of all the nodes of a
- second device path instance.
-
-Arguments:
- Multi - A pointer to a multi-instance device path data structure.
-
- Single - A pointer to a single-instance device path data structure.
-
- NewDevicePath - If Delete is TRUE, this parameter must not be null, and it
- points to the remaining device path data structure.
- (remaining device path = Multi - Single.)
-
- Delete - If TRUE, means removing Single from Multi.
- If FALSE, the routine just check whether Single matches
- with any instance in Multi.
-
-Returns:
-
- The function returns EFI_SUCCESS if the Single is contained within Multi.
- Otherwise, EFI_NOT_FOUND is returned.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePath1;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePath2;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
- UINTN Size;
-
- //
- // The passed in DevicePath should not be NULL
- //
- if ((!Multi) || (!Single)) {
- return EFI_NOT_FOUND;
- }
- //
- // if performing Delete operation, the NewDevicePath must not be NULL.
- //
- TempDevicePath1 = NULL;
-
- DevicePath = Multi;
- DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
-
- //
- // search for the match of 'Single' in 'Multi'
- //
- while (DevicePathInst) {
- if (CompareMem (Single, DevicePathInst, Size) == 0) {
- if (!Delete) {
- FreePool (DevicePathInst);
- return EFI_SUCCESS;
- }
- } else {
- if (Delete) {
- TempDevicePath2 = AppendDevicePathInstance (
- TempDevicePath1,
- DevicePathInst
- );
- if (TempDevicePath1 != NULL) {
- FreePool (TempDevicePath1);
- }
- TempDevicePath1 = TempDevicePath2;
- }
- }
-
- FreePool (DevicePathInst);
- DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
- }
-
- if (Delete) {
- *NewDevicePath = TempDevicePath1;
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-ConPlatformUpdateDeviceVariable (
- IN CHAR16 *VariableName,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONPLATFORM_VAR_OPERATION Operation
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *VariableDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *NewVariableDevicePath;
-
- VariableDevicePath = NULL;
- NewVariableDevicePath = NULL;
-
- //
- // Get Variable according to variable name.
- // The memory for Variable is allocated within ConPlatformGetVarible(),
- // it is the caller's responsibility to free the memory before return.
- //
- VariableDevicePath = ConPlatformGetVariable (VariableName);
-
- if (Operation != DELETE) {
-
- Status = ConPlatformMatchDevicePaths (
- VariableDevicePath,
- DevicePath,
- NULL,
- FALSE
- );
-
- if ((Operation == CHECK) || (!EFI_ERROR (Status))) {
- //
- // The device path is already in the variable
- //
- if (VariableDevicePath != NULL) {
- FreePool (VariableDevicePath);
- }
-
- return Status;
- }
- //
- // The device path is not in variable. Append DevicePath to the
- // environment variable that is a multi-instance device path.
- //
- Status = EFI_SUCCESS;
- NewVariableDevicePath = AppendDevicePathInstance (
- VariableDevicePath,
- DevicePath
- );
- if (NewVariableDevicePath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- }
-
- } else {
- //
- // Remove DevicePath from the environment variable that
- // is a multi-instance device path.
- //
- Status = ConPlatformMatchDevicePaths (
- VariableDevicePath,
- DevicePath,
- &NewVariableDevicePath,
- TRUE
- );
- }
-
- if (VariableDevicePath != NULL) {
- FreePool (VariableDevicePath);
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gRT->SetVariable (
- VariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- GetDevicePathSize (NewVariableDevicePath),
- NewVariableDevicePath
- );
-
- FreePool (NewVariableDevicePath);
-
- return Status;
-}
-
-BOOLEAN
-IsHotPlugDevice (
- EFI_HANDLE DriverBindingHandle,
- EFI_HANDLE ControllerHandle
- )
-{
- EFI_STATUS Status;
-
- //
- // HotPlugDeviceGuid indicates ControllerHandle stands for a hot plug device.
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiHotPlugDeviceGuid,
- NULL,
- DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.h b/EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.h
deleted file mode 100644
index c14a5ed1..0000000
--- a/EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ConPlatform.h
-
-Abstract:
-
---*/
-
-#ifndef CON_MANAGE_H_
-#define CON_MANAGE_H_
-
-#define VarConsoleInpDev L"ConInDev"
-#define VarConsoleInp L"ConIn"
-#define VarConsoleOutDev L"ConOutDev"
-#define VarConsoleOut L"ConOut"
-#define VarErrorOutDev L"ErrOutDev"
-#define VarErrorOut L"ErrOut"
-
-typedef enum {
- CHECK,
- APPEND,
- DELETE
-} CONPLATFORM_VAR_OPERATION;
-
-EFI_STATUS
-ConPlatformDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
- IN EFI_GUID *ProtocolGuid
- );
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextInDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextOutDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextInDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextOutDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextInDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-EFI_STATUS
-EFIAPI
-ConPlatformTextOutDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-VOID
-ConPlatformUnInstallProtocol (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_GUID *ProtocolGuid
- );
-
-VOID *
-ConPlatformGetVariable (
- IN CHAR16 *Name
- );
-
-EFI_STATUS
-ConPlatformMatchDevicePaths (
- IN EFI_DEVICE_PATH_PROTOCOL * Multi,
- IN EFI_DEVICE_PATH_PROTOCOL * Single,
- IN EFI_DEVICE_PATH_PROTOCOL **NewDevicePath OPTIONAL,
- IN BOOLEAN Delete
- );
-
-EFI_STATUS
-ConPlatformUpdateDeviceVariable (
- IN CHAR16 *VariableName,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONPLATFORM_VAR_OPERATION Operation
- );
-
-BOOLEAN
-IsHotPlugDevice (
- EFI_HANDLE DriverBindingHandle,
- EFI_HANDLE ControllerHandle
- );
-
-#endif
diff --git a/EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.msa b/EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.msa
deleted file mode 100644
index a4300e5..0000000
--- a/EdkModulePkg/Universal/ConPlatform/Dxe/ConPlatform.msa
+++ /dev/null
@@ -1,135 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>ConPlatform</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>51ccf399-4fdf-4e55-a45b-e123f84d456a</GuidValue>
- <Version>1.0</Version>
- <Abstract>Console Platfrom Driver</Abstract>
- <Description>Console Platfrom DXE Driver, install Console protocols</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>ConPlatform</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>ConPlatform.c</Filename>
- <Filename>ConPlatform.h</Filename>
- <Filename>ComponentName.h</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiConsoleInDeviceGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiConsoleOutDeviceGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiStandardErrorDeviceGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiHotPlugDeviceGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Variables>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x0043 0x006F 0x006E 0x0049 0x006E 0x0044 0x0065 0x0076</VariableName>
- <GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
- <HelpText>L"ConInDev" global variable will be updated if the serial device is not a hot plug device.</HelpText>
- </Variable>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x0043 0x006F 0x006E 0x0049 0x006E</VariableName>
- <GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
- <HelpText>L"ConIn" global variable will be updated if the serial device is not a hot plug device.</HelpText>
- </Variable>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x0043 0x006F 0x006E 0x004F 0x0075 0x0074 0x0044 0x0065 0x0076</VariableName>
- <GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
- <HelpText>L"ConOutDev" global variable will be updated if the serial device is not a hot plug device.</HelpText>
- </Variable>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x0043 0x006F 0x006E 0x004F 0x0075 0x0074</VariableName>
- <GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
- <HelpText>L"ConOut" global variable will be updated if the serial device is not a hot plug device.</HelpText>
- </Variable>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x0045 0x0072 0x0072 0x004F 0x0075 0x0074 0x0044 0x0065 0x0076</VariableName>
- <GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
- <HelpText>L"ErrOutDev" global variable will be updated if the serial device is not a hot plug device.</HelpText>
- </Variable>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x0045 0x0072 0x0072 0x004F 0x0075 0x0074</VariableName>
- <GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
- <HelpText>L"ErrOut" global variable will be updated if the serial device is not a hot plug device.</HelpText>
- </Variable>
- </Variables>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiGlobalVariableGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gConPlatformTextInDriverBinding</DriverBinding>
- <ComponentName>gConPlatformComponentName</ComponentName>
- </Extern>
- <Extern>
- <DriverBinding>gConPlatformTextOutDriverBinding</DriverBinding>
- <ComponentName>gConPlatformComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ComponentName.c b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ComponentName.c
deleted file mode 100644
index f82ae55..0000000
--- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ComponentName.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "ConSplitter.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComponentName = {
- ConSplitterComponentNameGetDriverName,
- ConSplitterConInComponentNameGetControllerName,
- "eng"
-};
-
-EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName = {
- ConSplitterComponentNameGetDriverName,
- ConSplitterSimplePointerComponentNameGetControllerName,
- "eng"
-};
-
-EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName = {
- ConSplitterComponentNameGetDriverName,
- ConSplitterConOutComponentNameGetControllerName,
- "eng"
-};
-
-EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName = {
- ConSplitterComponentNameGetDriverName,
- ConSplitterStdErrComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable[] = {
- {
- "eng",
- (CHAR16 *) L"Console Splitter Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-static EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable[] = {
- {
- "eng",
- (CHAR16 *) L"Primary Console Input Device"
- },
- {
- NULL,
- NULL
- }
-};
-
-static EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable[] = {
- {
- "eng",
- (CHAR16 *) L"Primary Simple Pointer Device"
- },
- {
- NULL,
- NULL
- }
-};
-
-static EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable[] = {
- {
- "eng",
- (CHAR16 *) L"Primary Console Output Device"
- },
- {
- NULL,
- NULL
- }
-};
-
-static EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable[] = {
- {
- "eng",
- (CHAR16 *) L"Primary Standard Error Device"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-ConSplitterComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gConSplitterConInComponentName.SupportedLanguages,
- mConSplitterDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterConInComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_IN_PROTOCOL *TextIn;
- //
- // here ChildHandle is not an Optional parameter.
- //
- if (ChildHandle == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleTextInProtocolGuid,
- (VOID **) &TextIn,
- NULL,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- return LookupUnicodeString (
- Language,
- gConSplitterConInComponentName.SupportedLanguages,
- mConSplitterConInControllerNameTable,
- ControllerName
- );
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer;
- //
- // here ChildHandle is not an Optional parameter.
- //
- if (ChildHandle == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimplePointerProtocolGuid,
- (VOID **) &SimplePointer,
- NULL,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- return LookupUnicodeString (
- Language,
- gConSplitterSimplePointerComponentName.SupportedLanguages,
- mConSplitterSimplePointerControllerNameTable,
- ControllerName
- );
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterConOutComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
- //
- // here ChildHandle is not an Optional parameter.
- //
- if (ChildHandle == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &TextOut,
- NULL,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- return LookupUnicodeString (
- Language,
- gConSplitterConOutComponentName.SupportedLanguages,
- mConSplitterConOutControllerNameTable,
- ControllerName
- );
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterStdErrComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *ErrOut;
- //
- // here ChildHandle is not an Optional parameter.
- //
- if (ChildHandle == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &ErrOut,
- NULL,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- return LookupUnicodeString (
- Language,
- gConSplitterStdErrComponentName.SupportedLanguages,
- mConSplitterStdErrControllerNameTable,
- ControllerName
- );
-}
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c
deleted file mode 100644
index 30b9fdc..0000000
--- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c
+++ /dev/null
@@ -1,3386 +0,0 @@
-/**@file
- Console Splitter Driver. Any Handle that attatched
- EFI_CONSOLE_IDENTIFIER_PROTOCOL can be bound by this driver.
-
- So far it works like any other driver by opening a SimpleTextIn and/or
- SimpleTextOut protocol with EFI_OPEN_PROTOCOL_BY_DRIVER attributes. The big
- difference is this driver does not layer a protocol on the passed in
- handle, or construct a child handle like a standard device or bus driver.
- This driver produces three virtual handles as children, one for console input
- splitter, one for console output splitter and one for error output splitter.
- EFI_CONSOLE_SPLIT_PROTOCOL will be attatched onto each virtual handle to
- identify the splitter type.
-
- Each virtual handle, that supports both the EFI_CONSOLE_SPLIT_PROTOCOL
- and Console I/O protocol, will be produced in the driver entry point.
- The virtual handle are added on driver entry and never removed.
- Such design ensures sytem function well during none console device situation.
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "ConSplitter.h"
-
-//
-// Global Variables
-//
-STATIC TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = {
- TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE,
- (EFI_HANDLE) NULL,
- {
- ConSplitterTextInReset,
- ConSplitterTextInReadKeyStroke,
- (EFI_EVENT) NULL
- },
- 0,
- (EFI_SIMPLE_TEXT_IN_PROTOCOL **) NULL,
- 0,
-
- {
- ConSplitterSimplePointerReset,
- ConSplitterSimplePointerGetState,
- (EFI_EVENT) NULL,
- (EFI_SIMPLE_POINTER_MODE *) NULL
- },
- {
- 0x10000,
- 0x10000,
- 0x10000,
- TRUE,
- TRUE
- },
- 0,
- (EFI_SIMPLE_POINTER_PROTOCOL **) NULL,
- 0,
-
- FALSE,
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- },
- 0,
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- },
- (EFI_EVENT) NULL,
-
- FALSE,
- FALSE
-};
-
-STATIC TEXT_OUT_SPLITTER_PRIVATE_DATA mConOut = {
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE,
- (EFI_HANDLE) NULL,
- {
- ConSplitterTextOutReset,
- ConSplitterTextOutOutputString,
- ConSplitterTextOutTestString,
- ConSplitterTextOutQueryMode,
- ConSplitterTextOutSetMode,
- ConSplitterTextOutSetAttribute,
- ConSplitterTextOutClearScreen,
- ConSplitterTextOutSetCursorPosition,
- ConSplitterTextOutEnableCursor,
- (EFI_SIMPLE_TEXT_OUTPUT_MODE *) NULL
- },
- {
- 1,
- 0,
- 0,
- 0,
- 0,
- FALSE,
- },
- {
- ConSpliterGraphicsOutputQueryMode,
- ConSpliterGraphicsOutputSetMode,
- ConSpliterGraphicsOutputBlt,
- NULL
- },
- (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
- (TEXT_OUT_GOP_MODE *) NULL,
- 0,
- TRUE,
- {
- ConSpliterConsoleControlGetMode,
- ConSpliterConsoleControlSetMode,
- ConSpliterConsoleControlLockStdIn
- },
-
- 0,
- (TEXT_OUT_AND_GOP_DATA *) NULL,
- 0,
- (TEXT_OUT_SPLITTER_QUERY_DATA *) NULL,
- 0,
- (INT32 *) NULL,
-
- EfiConsoleControlScreenText,
- 0,
- 0,
- (CHAR16 *) NULL,
- (INT32 *) NULL
-};
-
-STATIC TEXT_OUT_SPLITTER_PRIVATE_DATA mStdErr = {
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE,
- (EFI_HANDLE) NULL,
- {
- ConSplitterTextOutReset,
- ConSplitterTextOutOutputString,
- ConSplitterTextOutTestString,
- ConSplitterTextOutQueryMode,
- ConSplitterTextOutSetMode,
- ConSplitterTextOutSetAttribute,
- ConSplitterTextOutClearScreen,
- ConSplitterTextOutSetCursorPosition,
- ConSplitterTextOutEnableCursor,
- (EFI_SIMPLE_TEXT_OUTPUT_MODE *) NULL
- },
- {
- 1,
- 0,
- 0,
- 0,
- 0,
- FALSE,
- },
- {
- ConSpliterGraphicsOutputQueryMode,
- ConSpliterGraphicsOutputSetMode,
- ConSpliterGraphicsOutputBlt,
- NULL
- },
- (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
- (TEXT_OUT_GOP_MODE *) NULL,
- 0,
- TRUE,
- {
- ConSpliterConsoleControlGetMode,
- ConSpliterConsoleControlSetMode,
- ConSpliterConsoleControlLockStdIn
- },
-
- 0,
- (TEXT_OUT_AND_GOP_DATA *) NULL,
- 0,
- (TEXT_OUT_SPLITTER_QUERY_DATA *) NULL,
- 0,
- (INT32 *) NULL,
-
- EfiConsoleControlScreenText,
- 0,
- 0,
- (CHAR16 *) NULL,
- (INT32 *) NULL
-};
-
-EFI_DRIVER_BINDING_PROTOCOL gConSplitterConInDriverBinding = {
- ConSplitterConInDriverBindingSupported,
- ConSplitterConInDriverBindingStart,
- ConSplitterConInDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_DRIVER_BINDING_PROTOCOL gConSplitterSimplePointerDriverBinding = {
- ConSplitterSimplePointerDriverBindingSupported,
- ConSplitterSimplePointerDriverBindingStart,
- ConSplitterSimplePointerDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_DRIVER_BINDING_PROTOCOL gConSplitterConOutDriverBinding = {
- ConSplitterConOutDriverBindingSupported,
- ConSplitterConOutDriverBindingStart,
- ConSplitterConOutDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_DRIVER_BINDING_PROTOCOL gConSplitterStdErrDriverBinding = {
- ConSplitterStdErrDriverBindingSupported,
- ConSplitterStdErrDriverBindingStart,
- ConSplitterStdErrDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-ConSplitterDriverEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Intialize a virtual console device to act as an agrigator of physical console
- devices.
-
-Arguments:
- ImageHandle - (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
- SystemTable - (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-Returns:
- EFI_SUCCESS
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // The driver creates virtual handles for ConIn, ConOut, and StdErr.
- // The virtual handles will always exist even if no console exist in the
- // system. This is need to support hotplug devices like USB.
- //
- //
- // Create virtual device handle for StdErr Splitter
- //
- Status = ConSplitterTextOutConstructor (&mStdErr);
- if (!EFI_ERROR (Status)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mStdErr.VirtualHandle,
- &gEfiSimpleTextOutProtocolGuid,
- &mStdErr.TextOut,
- &gEfiPrimaryStandardErrorDeviceGuid,
- NULL,
- NULL
- );
- }
- //
- // Create virtual device handle for ConIn Splitter
- //
- Status = ConSplitterTextInConstructor (&mConIn);
- if (!EFI_ERROR (Status)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mConIn.VirtualHandle,
- &gEfiSimpleTextInProtocolGuid,
- &mConIn.TextIn,
- &gEfiSimplePointerProtocolGuid,
- &mConIn.SimplePointer,
- &gEfiPrimaryConsoleInDeviceGuid,
- NULL,
- NULL
- );
- if (!EFI_ERROR (Status)) {
- //
- // Update the EFI System Table with new virtual console
- //
- gST->ConsoleInHandle = mConIn.VirtualHandle;
- gST->ConIn = &mConIn.TextIn;
- }
- }
- //
- // Create virtual device handle for ConOut Splitter
- //
- Status = ConSplitterTextOutConstructor (&mConOut);
- if (!EFI_ERROR (Status)) {
- //
- // In UEFI mode, Graphics Output Protocol is installed on virtual handle.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mConOut.VirtualHandle,
- &gEfiSimpleTextOutProtocolGuid,
- &mConOut.TextOut,
- &gEfiGraphicsOutputProtocolGuid,
- &mConOut.GraphicsOutput,
- &gEfiConsoleControlProtocolGuid,
- &mConOut.ConsoleControl,
- &gEfiPrimaryConsoleOutDeviceGuid,
- NULL,
- NULL
- );
-
- if (!EFI_ERROR (Status)) {
- //
- // Update the EFI System Table with new virtual console
- //
- gST->ConsoleOutHandle = mConOut.VirtualHandle;
- gST->ConOut = &mConOut.TextOut;
- }
-
- }
- //
- // Update the CRC32 in the EFI System Table header
- //
- gST->Hdr.CRC32 = 0;
- gBS->CalculateCrc32 (
- (UINT8 *) &gST->Hdr,
- gST->Hdr.HeaderSize,
- &gST->Hdr.CRC32
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ConSplitterTextInConstructor (
- TEXT_IN_SPLITTER_PRIVATE_DATA *ConInPrivate
- )
-/*++
-
-Routine Description:
-
- Construct the ConSplitter.
-
-Arguments:
-
- ConInPrivate - A pointer to the TEXT_IN_SPLITTER_PRIVATE_DATA structure.
-
-Returns:
- EFI_OUT_OF_RESOURCES - Out of resources.
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Initilize console input splitter's private data.
- //
- Status = ConSplitterGrowBuffer (
- sizeof (EFI_SIMPLE_TEXT_IN_PROTOCOL *),
- &ConInPrivate->TextInListCount,
- (VOID **) &ConInPrivate->TextInList
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Create Event to support locking StdIn Device
- //
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- ConSpliterConsoleControlLockStdInEvent,
- NULL,
- &ConInPrivate->LockEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- ConSplitterTextInWaitForKey,
- ConInPrivate,
- &ConInPrivate->TextIn.WaitForKey
- );
- ASSERT_EFI_ERROR (Status);
-
- ConInPrivate->SimplePointer.Mode = &ConInPrivate->SimplePointerMode;
-
- Status = ConSplitterGrowBuffer (
- sizeof (EFI_SIMPLE_POINTER_PROTOCOL *),
- &ConInPrivate->PointerListCount,
- (VOID **) &ConInPrivate->PointerList
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- ConSplitterSimplePointerWaitForInput,
- ConInPrivate,
- &ConInPrivate->SimplePointer.WaitForInput
- );
-
- return Status;
-}
-
-EFI_STATUS
-ConSplitterTextOutConstructor (
- TEXT_OUT_SPLITTER_PRIVATE_DATA *ConOutPrivate
- )
-{
- EFI_STATUS Status;
-
- //
- // Initilize console output splitter's private data.
- //
- ConOutPrivate->TextOut.Mode = &ConOutPrivate->TextOutMode;
-
- Status = ConSplitterGrowBuffer (
- sizeof (TEXT_OUT_AND_GOP_DATA),
- &ConOutPrivate->TextOutListCount,
- (VOID **) &ConOutPrivate->TextOutList
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = ConSplitterGrowBuffer (
- sizeof (TEXT_OUT_SPLITTER_QUERY_DATA),
- &ConOutPrivate->TextOutQueryDataCount,
- (VOID **) &ConOutPrivate->TextOutQueryData
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Setup the DevNullTextOut console to 80 x 25
- //
- ConOutPrivate->TextOutQueryData[0].Columns = 80;
- ConOutPrivate->TextOutQueryData[0].Rows = 25;
- DevNullTextOutSetMode (ConOutPrivate, 0);
-
- //
- // Setup resource for mode information in Graphics Output Protocol interface
- //
- if ((ConOutPrivate->GraphicsOutput.Mode = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE))) == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- if ((ConOutPrivate->GraphicsOutput.Mode->Info = AllocateZeroPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION))) == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Setup the DevNullGraphicsOutput to 800 x 600 x 32 bits per pixel
- //
- if ((ConOutPrivate->GraphicsOutputModeBuffer = AllocateZeroPool (sizeof (TEXT_OUT_GOP_MODE))) == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- ConOutPrivate->GraphicsOutputModeBuffer[0].HorizontalResolution = 800;
- ConOutPrivate->GraphicsOutputModeBuffer[0].VerticalResolution = 600;
-
- //
- // Initialize the following items, theset items remain unchanged in GraphicsOutput->SetMode()
- // GraphicsOutputMode->Info->Version, GraphicsOutputMode->Info->PixelFormat
- // GraphicsOutputMode->SizeOfInfo, GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize
- //
- ConOutPrivate->GraphicsOutput.Mode->Info->Version = 0;
- ConOutPrivate->GraphicsOutput.Mode->Info->PixelFormat = PixelBltOnly;
- ConOutPrivate->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
- ConOutPrivate->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;
- ConOutPrivate->GraphicsOutput.Mode->FrameBufferSize = 0;
-
- ConOutPrivate->GraphicsOutput.Mode->MaxMode = 1;
- //
- // Initial current mode to unknow state, and then set to mode 0
- //
- ConOutPrivate->GraphicsOutput.Mode->Mode = 0xffff;
- ConOutPrivate->GraphicsOutput.SetMode (&ConOutPrivate->GraphicsOutput, 0);
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-ConSplitterSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_GUID *Guid
- )
-/*++
-
-Routine Description:
- Generic Supported Check
-
-Arguments:
- This - Pointer to protocol.
- ControllerHandle - Controller Handle.
- Guid - Guid.
-
-Returns:
-
- EFI_UNSUPPORTED - unsupported.
- EFI_SUCCESS - operation is OK.
-
---*/
-{
- EFI_STATUS Status;
- VOID *Instance;
-
- //
- // Make sure the Console Splitter does not attempt to attach to itself
- //
- if (ControllerHandle == mConIn.VirtualHandle) {
- return EFI_UNSUPPORTED;
- }
-
- if (ControllerHandle == mConOut.VirtualHandle) {
- return EFI_UNSUPPORTED;
- }
-
- if (ControllerHandle == mStdErr.VirtualHandle) {
- return EFI_UNSUPPORTED;
- }
- //
- // Check to see whether the handle has the ConsoleInDevice GUID on it
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- Guid,
- &Instance,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- ControllerHandle,
- Guid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterConInDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Console In Supported Check
-
-Arguments:
- This - Pointer to protocol.
- ControllerHandle - Controller handle.
- RemainingDevicePath - Remaining device path.
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- return ConSplitterSupported (
- This,
- ControllerHandle,
- &gEfiConsoleInDeviceGuid
- );
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Standard Error Supported Check
-
-Arguments:
- This - Pointer to protocol.
- ControllerHandle - Controller handle.
- RemainingDevicePath - Remaining device path.
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- return ConSplitterSupported (
- This,
- ControllerHandle,
- &gEfiSimplePointerProtocolGuid
- );
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterConOutDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Console Out Supported Check
-
-Arguments:
- This - Pointer to protocol.
- ControllerHandle - Controller handle.
- RemainingDevicePath - Remaining device path.
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- return ConSplitterSupported (
- This,
- ControllerHandle,
- &gEfiConsoleOutDeviceGuid
- );
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterStdErrDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Standard Error Supported Check
-
-Arguments:
- This - Pointer to protocol.
- ControllerHandle - Controller handle.
- RemainingDevicePath - Remaining device path.
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- return ConSplitterSupported (
- This,
- ControllerHandle,
- &gEfiStandardErrorDeviceGuid
- );
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-ConSplitterStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ConSplitterVirtualHandle,
- IN EFI_GUID *DeviceGuid,
- IN EFI_GUID *InterfaceGuid,
- IN VOID **Interface
- )
-/*++
-
-Routine Description:
- Start ConSplitter on ControllerHandle, and create the virtual
- agrogated console device on first call Start for a SimpleTextIn handle.
-
-Arguments:
- (Standard DriverBinding Protocol Start() function)
-
-Returns:
- EFI_ERROR if a SimpleTextIn protocol is not started.
-
---*/
-{
- EFI_STATUS Status;
- VOID *Instance;
-
- //
- // Check to see whether the handle has the ConsoleInDevice GUID on it
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- DeviceGuid,
- &Instance,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- DeviceGuid,
- &Instance,
- This->DriverBindingHandle,
- ConSplitterVirtualHandle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return gBS->OpenProtocol (
- ControllerHandle,
- InterfaceGuid,
- Interface,
- This->DriverBindingHandle,
- ConSplitterVirtualHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterConInDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Start ConSplitter on ControllerHandle, and create the virtual
- agrogated console device on first call Start for a SimpleTextIn handle.
-
-Arguments:
- This - Pointer to protocol.
- ControllerHandle - Controller handle.
- RemainingDevicePath - Remaining device path.
-
-Returns:
-
- EFI_STATUS
- EFI_ERROR if a SimpleTextIn protocol is not started.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_IN_PROTOCOL *TextIn;
-
- //
- // Start ConSplitter on ControllerHandle, and create the virtual
- // agrogated console device on first call Start for a SimpleTextIn handle.
- //
- Status = ConSplitterStart (
- This,
- ControllerHandle,
- mConIn.VirtualHandle,
- &gEfiConsoleInDeviceGuid,
- &gEfiSimpleTextInProtocolGuid,
- (VOID **) &TextIn
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return ConSplitterTextInAddDevice (&mConIn, TextIn);
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Start ConSplitter on ControllerHandle, and create the virtual
- agrogated console device on first call Start for a SimpleTextIn handle.
-
-Arguments:
- This - Pointer to protocol.
- ControllerHandle - Controller handle.
- RemainingDevicePath - Remaining device path.
-
-Returns:
-
- EFI_ERROR if a SimpleTextIn protocol is not started.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer;
-
- Status = ConSplitterStart (
- This,
- ControllerHandle,
- mConIn.VirtualHandle,
- &gEfiSimplePointerProtocolGuid,
- &gEfiSimplePointerProtocolGuid,
- (VOID **) &SimplePointer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return ConSplitterSimplePointerAddDevice (&mConIn, SimplePointer);
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterConOutDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Start ConSplitter on ControllerHandle, and create the virtual
- agrogated console device on first call Start for a SimpleTextIn handle.
-
-Arguments:
- This - Pointer to protocol.
- ControllerHandle - Controller handle.
- RemainingDevicePath - Remaining device path.
-
-Returns:
- EFI_ERROR if a SimpleTextIn protocol is not started.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
-
- Status = ConSplitterStart (
- This,
- ControllerHandle,
- mConOut.VirtualHandle,
- &gEfiConsoleOutDeviceGuid,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &TextOut
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Try to Open Graphics Output protocol
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **) &GraphicsOutput,
- This->DriverBindingHandle,
- mConOut.VirtualHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- GraphicsOutput = NULL;
- }
- //
- // Open UGA_DRAW protocol
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw,
- This->DriverBindingHandle,
- mConOut.VirtualHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- UgaDraw = NULL;
- }
- //
- // If both ConOut and StdErr incorporate the same Text Out device,
- // their MaxMode and QueryData should be the intersection of both.
- //
- Status = ConSplitterTextOutAddDevice (&mConOut, TextOut, GraphicsOutput, UgaDraw);
- ConSplitterTextOutSetAttribute (&mConOut.TextOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterStdErrDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Start ConSplitter on ControllerHandle, and create the virtual
- agrogated console device on first call Start for a SimpleTextIn handle.
-
-Arguments:
- This - Pointer to protocol.
- ControllerHandle - Controller handle.
- RemainingDevicePath - Remaining device path.
-
-Returns:
- EFI_ERROR if a SimpleTextIn protocol is not started.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
-
- Status = ConSplitterStart (
- This,
- ControllerHandle,
- mStdErr.VirtualHandle,
- &gEfiStandardErrorDeviceGuid,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &TextOut
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // If both ConOut and StdErr incorporate the same Text Out device,
- // their MaxMode and QueryData should be the intersection of both.
- //
- Status = ConSplitterTextOutAddDevice (&mStdErr, TextOut, NULL, NULL);
- ConSplitterTextOutSetAttribute (&mStdErr.TextOut, EFI_TEXT_ATTR (EFI_MAGENTA, EFI_BLACK));
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (mStdErr.CurrentNumberOfConsoles == 1) {
- gST->StandardErrorHandle = mStdErr.VirtualHandle;
- gST->StdErr = &mStdErr.TextOut;
- //
- // Update the CRC32 in the EFI System Table header
- //
- gST->Hdr.CRC32 = 0;
- gBS->CalculateCrc32 (
- (UINT8 *) &gST->Hdr,
- gST->Hdr.HeaderSize,
- &gST->Hdr.CRC32
- );
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-ConSplitterStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ConSplitterVirtualHandle,
- IN EFI_GUID *DeviceGuid,
- IN EFI_GUID *InterfaceGuid,
- IN VOID **Interface
- )
-/*++
-
-Routine Description:
-
-Arguments:
- (Standard DriverBinding Protocol Stop() function)
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- InterfaceGuid,
- Interface,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // close the protocol refered.
- //
- gBS->CloseProtocol (
- ControllerHandle,
- DeviceGuid,
- This->DriverBindingHandle,
- ConSplitterVirtualHandle
- );
- gBS->CloseProtocol (
- ControllerHandle,
- DeviceGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterConInDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
- (Standard DriverBinding Protocol Stop() function)
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_IN_PROTOCOL *TextIn;
-
- if (NumberOfChildren == 0) {
- return EFI_SUCCESS;
- }
-
- Status = ConSplitterStop (
- This,
- ControllerHandle,
- mConIn.VirtualHandle,
- &gEfiConsoleInDeviceGuid,
- &gEfiSimpleTextInProtocolGuid,
- (VOID **) &TextIn
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Delete this console input device's data structures.
- //
- return ConSplitterTextInDeleteDevice (&mConIn, TextIn);
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
- (Standard DriverBinding Protocol Stop() function)
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer;
-
- if (NumberOfChildren == 0) {
- return EFI_SUCCESS;
- }
-
- Status = ConSplitterStop (
- This,
- ControllerHandle,
- mConIn.VirtualHandle,
- &gEfiSimplePointerProtocolGuid,
- &gEfiSimplePointerProtocolGuid,
- (VOID **) &SimplePointer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Delete this console input device's data structures.
- //
- return ConSplitterSimplePointerDeleteDevice (&mConIn, SimplePointer);
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterConOutDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
- (Standard DriverBinding Protocol Stop() function)
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
-
- if (NumberOfChildren == 0) {
- return EFI_SUCCESS;
- }
-
- Status = ConSplitterStop (
- This,
- ControllerHandle,
- mConOut.VirtualHandle,
- &gEfiConsoleOutDeviceGuid,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &TextOut
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Delete this console output device's data structures.
- //
- return ConSplitterTextOutDeleteDevice (&mConOut, TextOut);
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterStdErrDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
- (Standard DriverBinding Protocol Stop() function)
-
-Returns:
-
- EFI_SUCCESS - Complete successfully.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
-
- if (NumberOfChildren == 0) {
- return EFI_SUCCESS;
- }
-
- Status = ConSplitterStop (
- This,
- ControllerHandle,
- mStdErr.VirtualHandle,
- &gEfiStandardErrorDeviceGuid,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &TextOut
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Delete this console error out device's data structures.
- //
- Status = ConSplitterTextOutDeleteDevice (&mStdErr, TextOut);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (mStdErr.CurrentNumberOfConsoles == 0) {
- gST->StandardErrorHandle = NULL;
- gST->StdErr = NULL;
- //
- // Update the CRC32 in the EFI System Table header
- //
- gST->Hdr.CRC32 = 0;
- gBS->CalculateCrc32 (
- (UINT8 *) &gST->Hdr,
- gST->Hdr.HeaderSize,
- &gST->Hdr.CRC32
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-ConSplitterGrowBuffer (
- IN UINTN SizeOfCount,
- IN UINTN *Count,
- IN OUT VOID **Buffer
- )
-/*++
-
-Routine Description:
- Take the passed in Buffer of size SizeOfCount and grow the buffer
- by MAX (CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT, MaxGrow) * SizeOfCount
- bytes. Copy the current data in Buffer to the new version of Buffer
- and free the old version of buffer.
-
-
-Arguments:
- SizeOfCount - Size of element in array
- Count - Current number of elements in array
- Buffer - Bigger version of passed in Buffer with all the data
-
-Returns:
- EFI_SUCCESS - Buffer size has grown
- EFI_OUT_OF_RESOURCES - Could not grow the buffer size
-
- None
-
---*/
-{
- UINTN NewSize;
- UINTN OldSize;
- VOID *Ptr;
-
- //
- // grow the buffer to new buffer size,
- // copy the old buffer's content to the new-size buffer,
- // then free the old buffer.
- //
- OldSize = *Count * SizeOfCount;
- *Count += CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT;
- NewSize = *Count * SizeOfCount;
-
- Ptr = AllocateZeroPool (NewSize);
- if (Ptr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- CopyMem (Ptr, *Buffer, OldSize);
-
- if (*Buffer != NULL) {
- FreePool (*Buffer);
- }
-
- *Buffer = Ptr;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ConSplitterTextInAddDevice (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *TextIn
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // If the Text In List is full, enlarge it by calling growbuffer().
- //
- if (Private->CurrentNumberOfConsoles >= Private->TextInListCount) {
- Status = ConSplitterGrowBuffer (
- sizeof (EFI_SIMPLE_TEXT_IN_PROTOCOL *),
- &Private->TextInListCount,
- (VOID **) &Private->TextInList
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
- }
- //
- // Add the new text-in device data structure into the Text In List.
- //
- Private->TextInList[Private->CurrentNumberOfConsoles] = TextIn;
- Private->CurrentNumberOfConsoles++;
-
- //
- // Extra CheckEvent added to reduce the double CheckEvent() in UI.c
- //
- gBS->CheckEvent (TextIn->WaitForKey);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ConSplitterTextInDeleteDevice (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *TextIn
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- EFI_SUCCESS
- EFI_NOT_FOUND
-
---*/
-{
- UINTN Index;
- //
- // Remove the specified text-in device data structure from the Text In List,
- // and rearrange the remaining data structures in the Text In List.
- //
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
- if (Private->TextInList[Index] == TextIn) {
- for (Index = Index; Index < Private->CurrentNumberOfConsoles - 1; Index++) {
- Private->TextInList[Index] = Private->TextInList[Index + 1];
- }
-
- Private->CurrentNumberOfConsoles--;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-ConSplitterSimplePointerAddDevice (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- EFI_OUT_OF_RESOURCES
- EFI_SUCCESS
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // If the Text In List is full, enlarge it by calling growbuffer().
- //
- if (Private->CurrentNumberOfPointers >= Private->PointerListCount) {
- Status = ConSplitterGrowBuffer (
- sizeof (EFI_SIMPLE_POINTER_PROTOCOL *),
- &Private->PointerListCount,
- (VOID **) &Private->PointerList
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
- }
- //
- // Add the new text-in device data structure into the Text In List.
- //
- Private->PointerList[Private->CurrentNumberOfPointers] = SimplePointer;
- Private->CurrentNumberOfPointers++;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ConSplitterSimplePointerDeleteDevice (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- UINTN Index;
- //
- // Remove the specified text-in device data structure from the Text In List,
- // and rearrange the remaining data structures in the Text In List.
- //
- for (Index = 0; Index < Private->CurrentNumberOfPointers; Index++) {
- if (Private->PointerList[Index] == SimplePointer) {
- for (Index = Index; Index < Private->CurrentNumberOfPointers - 1; Index++) {
- Private->PointerList[Index] = Private->PointerList[Index + 1];
- }
-
- Private->CurrentNumberOfPointers--;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-STATIC
-EFI_STATUS
-ConSplitterGrowMapTable (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- UINTN Size;
- UINTN NewSize;
- UINTN TotalSize;
- INT32 *TextOutModeMap;
- INT32 *OldTextOutModeMap;
- INT32 *SrcAddress;
- INT32 Index;
-
- NewSize = Private->TextOutListCount * sizeof (INT32);
- OldTextOutModeMap = Private->TextOutModeMap;
- TotalSize = NewSize * Private->TextOutQueryDataCount;
-
- TextOutModeMap = AllocateZeroPool (TotalSize);
- if (TextOutModeMap == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetMem (TextOutModeMap, TotalSize, 0xFF);
- Private->TextOutModeMap = TextOutModeMap;
-
- //
- // If TextOutList has been enlarged, need to realloc the mode map table
- // The mode map table is regarded as a two dimension array.
- //
- // Old New
- // 0 ---------> TextOutListCount ----> TextOutListCount
- // | -------------------------------------------
- // | | | |
- // | | | |
- // | | | |
- // | | | |
- // | | | |
- // \/ | | |
- // -------------------------------------------
- // QueryDataCount
- //
- if (OldTextOutModeMap != NULL) {
-
- Size = Private->CurrentNumberOfConsoles * sizeof (INT32);
- Index = 0;
- SrcAddress = OldTextOutModeMap;
-
- //
- // Copy the old data to the new one
- //
- while (Index < Private->TextOutMode.MaxMode) {
- CopyMem (TextOutModeMap, SrcAddress, Size);
- TextOutModeMap += NewSize;
- SrcAddress += Size;
- Index++;
- }
- //
- // Free the old buffer
- //
- FreePool (OldTextOutModeMap);
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ConSplitterAddOutputMode (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- INT32 MaxMode;
- INT32 Mode;
- UINTN Index;
-
- MaxMode = TextOut->Mode->MaxMode;
- Private->TextOutMode.MaxMode = MaxMode;
-
- //
- // Grow the buffer if query data buffer is not large enough to
- // hold all the mode supported by the first console.
- //
- while (MaxMode > (INT32) Private->TextOutQueryDataCount) {
- Status = ConSplitterGrowBuffer (
- sizeof (TEXT_OUT_SPLITTER_QUERY_DATA),
- &Private->TextOutQueryDataCount,
- (VOID **) &Private->TextOutQueryData
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
- }
- //
- // Allocate buffer for the output mode map
- //
- Status = ConSplitterGrowMapTable (Private);
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // As the first textout device, directly add the mode in to QueryData
- // and at the same time record the mapping between QueryData and TextOut.
- //
- Mode = 0;
- Index = 0;
- while (Mode < MaxMode) {
- TextOut->QueryMode (
- TextOut,
- Mode,
- &Private->TextOutQueryData[Mode].Columns,
- &Private->TextOutQueryData[Mode].Rows
- );
- Private->TextOutModeMap[Index] = Mode;
- Mode++;
- Index += Private->TextOutListCount;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-VOID
-ConSplitterGetIntersection (
- IN INT32 *TextOutModeMap,
- IN INT32 *NewlyAddedMap,
- IN UINTN MapStepSize,
- IN UINTN NewMapStepSize,
- OUT INT32 *MaxMode,
- OUT INT32 *CurrentMode
- )
-{
- INT32 Index;
- INT32 *CurrentMapEntry;
- INT32 *NextMapEntry;
- INT32 CurrentMaxMode;
- INT32 Mode;
-
- Index = 0;
- CurrentMapEntry = TextOutModeMap;
- NextMapEntry = TextOutModeMap;
- CurrentMaxMode = *MaxMode;
- Mode = *CurrentMode;
-
- while (Index < CurrentMaxMode) {
- if (*NewlyAddedMap == -1) {
- //
- // This mode is not supported any more. Remove it. Special care
- // must be taken as this remove will also affect current mode;
- //
- if (Index == *CurrentMode) {
- Mode = -1;
- } else if (Index < *CurrentMode) {
- Mode--;
- }
- (*MaxMode)--;
- } else {
- if (CurrentMapEntry != NextMapEntry) {
- CopyMem (NextMapEntry, CurrentMapEntry, MapStepSize * sizeof (INT32));
- }
-
- NextMapEntry += MapStepSize;
- }
-
- CurrentMapEntry += MapStepSize;
- NewlyAddedMap += NewMapStepSize;
- Index++;
- }
-
- *CurrentMode = Mode;
-
- return ;
-}
-
-STATIC
-VOID
-ConSplitterSyncOutputMode (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut
- )
-/*++
-
-Routine Description:
-
-Arguments:
- Private - Private data structure.
- TextOut - Text Out Protocol.
-Returns:
-
- None
-
---*/
-{
- INT32 CurrentMaxMode;
- INT32 Mode;
- INT32 Index;
- INT32 *TextOutModeMap;
- INT32 *MapTable;
- TEXT_OUT_SPLITTER_QUERY_DATA *TextOutQueryData;
- UINTN Rows;
- UINTN Columns;
- UINTN StepSize;
-
- //
- // Must make sure that current mode won't change even if mode number changes
- //
- CurrentMaxMode = Private->TextOutMode.MaxMode;
- TextOutModeMap = Private->TextOutModeMap;
- StepSize = Private->TextOutListCount;
- TextOutQueryData = Private->TextOutQueryData;
-
- //
- // Query all the mode that the newly added TextOut supports
- //
- Mode = 0;
- MapTable = TextOutModeMap + Private->CurrentNumberOfConsoles;
- while (Mode < TextOut->Mode->MaxMode) {
- TextOut->QueryMode (TextOut, Mode, &Columns, &Rows);
-
- //
- // Search the QueryData database to see if they intersects
- //
- Index = 0;
- while (Index < CurrentMaxMode) {
- if ((TextOutQueryData[Index].Rows == Rows) && (TextOutQueryData[Index].Columns == Columns)) {
- MapTable[Index * StepSize] = Mode;
- break;
- }
-
- Index++;
- }
-
- Mode++;
- }
- //
- // Now search the TextOutModeMap table to find the intersection of supported
- // mode between ConSplitter and the newly added device.
- //
- ConSplitterGetIntersection (
- TextOutModeMap,
- MapTable,
- StepSize,
- StepSize,
- &Private->TextOutMode.MaxMode,
- &Private->TextOutMode.Mode
- );
-
- return ;
-}
-
-STATIC
-EFI_STATUS
-ConSplitterGetIntersectionBetweenConOutAndStrErr (
- VOID
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- UINTN ConOutNumOfConsoles;
- UINTN StdErrNumOfConsoles;
- TEXT_OUT_AND_GOP_DATA *ConOutTextOutList;
- TEXT_OUT_AND_GOP_DATA *StdErrTextOutList;
- UINTN Indexi;
- UINTN Indexj;
- UINTN Rows;
- UINTN Columns;
- INT32 ConOutMaxMode;
- INT32 StdErrMaxMode;
- INT32 Mode;
- INT32 Index;
- INT32 *ConOutModeMap;
- INT32 *StdErrModeMap;
- INT32 *ConOutMapTable;
- INT32 *StdErrMapTable;
- TEXT_OUT_SPLITTER_QUERY_DATA *ConOutQueryData;
- TEXT_OUT_SPLITTER_QUERY_DATA *StdErrQueryData;
- BOOLEAN FoundTheSameTextOut;
- UINTN ConOutMapTableSize;
- UINTN StdErrMapTableSize;
-
- ConOutNumOfConsoles = mConOut.CurrentNumberOfConsoles;
- StdErrNumOfConsoles = mStdErr.CurrentNumberOfConsoles;
- ConOutTextOutList = mConOut.TextOutList;
- StdErrTextOutList = mStdErr.TextOutList;
-
- Indexi = 0;
- FoundTheSameTextOut = FALSE;
- while ((Indexi < ConOutNumOfConsoles) && (!FoundTheSameTextOut)) {
- Indexj = 0;
- while (Indexj < StdErrNumOfConsoles) {
- if (ConOutTextOutList->TextOut == StdErrTextOutList->TextOut) {
- FoundTheSameTextOut = TRUE;
- break;
- }
-
- Indexj++;
- StdErrTextOutList++;
- }
-
- Indexi++;
- ConOutTextOutList++;
- }
-
- if (!FoundTheSameTextOut) {
- return EFI_SUCCESS;
- }
- //
- // Must make sure that current mode won't change even if mode number changes
- //
- ConOutMaxMode = mConOut.TextOutMode.MaxMode;
- ConOutModeMap = mConOut.TextOutModeMap;
- ConOutQueryData = mConOut.TextOutQueryData;
-
- StdErrMaxMode = mStdErr.TextOutMode.MaxMode;
- StdErrModeMap = mStdErr.TextOutModeMap;
- StdErrQueryData = mStdErr.TextOutQueryData;
-
- //
- // Allocate the map table and set the map table's index to -1.
- //
- ConOutMapTableSize = ConOutMaxMode * sizeof (INT32);
- ConOutMapTable = AllocateZeroPool (ConOutMapTableSize);
- if (ConOutMapTable == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetMem (ConOutMapTable, ConOutMapTableSize, 0xFF);
-
- StdErrMapTableSize = StdErrMaxMode * sizeof (INT32);
- StdErrMapTable = AllocateZeroPool (StdErrMapTableSize);
- if (StdErrMapTable == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetMem (StdErrMapTable, StdErrMapTableSize, 0xFF);
-
- //
- // Find the intersection of the two set of modes. If they actually intersect, the
- // correponding entry in the map table is set to 1.
- //
- Mode = 0;
- while (Mode < ConOutMaxMode) {
- //
- // Search the other's QueryData database to see if they intersect
- //
- Index = 0;
- Rows = ConOutQueryData[Mode].Rows;
- Columns = ConOutQueryData[Mode].Columns;
- while (Index < StdErrMaxMode) {
- if ((StdErrQueryData[Index].Rows == Rows) && (StdErrQueryData[Index].Columns == Columns)) {
- ConOutMapTable[Mode] = 1;
- StdErrMapTable[Index] = 1;
- break;
- }
-
- Index++;
- }
-
- Mode++;
- }
- //
- // Now search the TextOutModeMap table to find the intersection of supported
- // mode between ConSplitter and the newly added device.
- //
- ConSplitterGetIntersection (
- ConOutModeMap,
- ConOutMapTable,
- mConOut.TextOutListCount,
- 1,
- &(mConOut.TextOutMode.MaxMode),
- &(mConOut.TextOutMode.Mode)
- );
- if (mConOut.TextOutMode.Mode < 0) {
- mConOut.TextOut.SetMode (&(mConOut.TextOut), 0);
- }
-
- ConSplitterGetIntersection (
- StdErrModeMap,
- StdErrMapTable,
- mStdErr.TextOutListCount,
- 1,
- &(mStdErr.TextOutMode.MaxMode),
- &(mStdErr.TextOutMode.Mode)
- );
- if (mStdErr.TextOutMode.Mode < 0) {
- mStdErr.TextOut.SetMode (&(mStdErr.TextOut), 0);
- }
-
- FreePool (ConOutMapTable);
- FreePool (StdErrMapTable);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ConSplitterAddGraphicsOutputMode (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
- IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- TEXT_OUT_GOP_MODE *Mode;
- UINTN SizeOfInfo;
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
- EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *CurrentGraphicsOutputMode;
- TEXT_OUT_GOP_MODE *ModeBuffer;
- TEXT_OUT_GOP_MODE *MatchedMode;
- UINTN NumberIndex;
- BOOLEAN Match;
-
- if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {
- return EFI_UNSUPPORTED;
- }
-
- CurrentGraphicsOutputMode = Private->GraphicsOutput.Mode;
-
- if (GraphicsOutput != NULL) {
- if (Private->CurrentNumberOfGraphicsOutput == 0) {
- //
- // This is the first Graphics Output device added
- //
- CurrentGraphicsOutputMode->MaxMode = GraphicsOutput->Mode->MaxMode;
- CurrentGraphicsOutputMode->Mode = GraphicsOutput->Mode->Mode;
- CopyMem (CurrentGraphicsOutputMode->Info, GraphicsOutput->Mode->Info, GraphicsOutput->Mode->SizeOfInfo);
- CurrentGraphicsOutputMode->SizeOfInfo = GraphicsOutput->Mode->SizeOfInfo;
- CurrentGraphicsOutputMode->FrameBufferBase = GraphicsOutput->Mode->FrameBufferBase;
- CurrentGraphicsOutputMode->FrameBufferSize = GraphicsOutput->Mode->FrameBufferSize;
-
- //
- // Allocate resource for the private mode buffer
- //
- ModeBuffer = AllocatePool (sizeof (TEXT_OUT_GOP_MODE) * GraphicsOutput->Mode->MaxMode);
- if (ModeBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- FreePool (Private->GraphicsOutputModeBuffer);
- Private->GraphicsOutputModeBuffer = ModeBuffer;
-
- //
- // Store all supported display modes to the private mode buffer
- //
- Mode = ModeBuffer;
- for (Index = 0; Index < GraphicsOutput->Mode->MaxMode; Index++) {
- Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) Index, &SizeOfInfo, &Info);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Mode->HorizontalResolution = Info->HorizontalResolution;
- Mode->VerticalResolution = Info->VerticalResolution;
- Mode++;
- FreePool (Info);
- }
- } else {
- //
- // Check intersection of display mode
- //
- ModeBuffer = AllocatePool (sizeof (TEXT_OUT_GOP_MODE) * CurrentGraphicsOutputMode->MaxMode);
- if (ModeBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- MatchedMode = ModeBuffer;
- Mode = &Private->GraphicsOutputModeBuffer[0];
- for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {
- Match = FALSE;
-
- for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex++) {
- Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- if ((Info->HorizontalResolution == Mode->HorizontalResolution) &&
- (Info->VerticalResolution == Mode->VerticalResolution)){
- Match = TRUE;
- FreePool (Info);
- break;
- }
- FreePool (Info);
- }
-
- if (Match) {
- CopyMem (MatchedMode, Mode, sizeof (TEXT_OUT_GOP_MODE));
- MatchedMode++;
- }
-
- Mode++;
- }
-
- //
- // Drop the old mode buffer, assign it to a new one
- //
- FreePool (Private->GraphicsOutputModeBuffer);
- Private->GraphicsOutputModeBuffer = ModeBuffer;
-
- //
- // Physical frame buffer is no longer available when there are more than one physical GOP devices
- //
- CurrentGraphicsOutputMode->MaxMode = (UINT32) (((UINTN) MatchedMode - (UINTN) ModeBuffer) / sizeof (TEXT_OUT_GOP_MODE));
- CurrentGraphicsOutputMode->Info->PixelFormat = PixelBltOnly;
- ZeroMem (&CurrentGraphicsOutputMode->Info->PixelInformation, sizeof (EFI_PIXEL_BITMASK));
- CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
- CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;
- CurrentGraphicsOutputMode->FrameBufferSize = 0;
- }
-
- //
- // Select a prefered Display mode 800x600
- //
- for (Index = 0; Index < CurrentGraphicsOutputMode->MaxMode; Index++) {
- Mode = &Private->GraphicsOutputModeBuffer[Index];
- if ((Mode->HorizontalResolution == 800) && (Mode->VerticalResolution == 600)) {
- break;
- }
- }
- //
- // Prefered mode is not found, set to mode 0
- //
- if (Index >= CurrentGraphicsOutputMode->MaxMode) {
- Index = 0;
- }
-
- //
- // Current mode number may need update now, so set it to an invalide mode number
- //
- CurrentGraphicsOutputMode->Mode = 0xffff;
- } else {
- //
- // For UGA device, it's inconvenient to retrieve all the supported display modes.
- // To simplify the implementation, only add one resolution(800x600, 32bit color depth) as defined in UEFI spec
- //
- CurrentGraphicsOutputMode->MaxMode = 1;
- CurrentGraphicsOutputMode->Info->Version = 0;
- CurrentGraphicsOutputMode->Info->HorizontalResolution = 800;
- CurrentGraphicsOutputMode->Info->VerticalResolution = 600;
- CurrentGraphicsOutputMode->Info->PixelFormat = PixelBltOnly;
- CurrentGraphicsOutputMode->Info->PixelsPerScanLine = 800;
- CurrentGraphicsOutputMode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
- CurrentGraphicsOutputMode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) (UINTN) NULL;
- CurrentGraphicsOutputMode->FrameBufferSize = 0;
-
- //
- // Update the private mode buffer
- //
- ModeBuffer = &Private->GraphicsOutputModeBuffer[0];
- ModeBuffer->HorizontalResolution = 800;
- ModeBuffer->VerticalResolution = 600;
-
- //
- // Current mode is unknow now, set it to an invalid mode number 0xffff
- //
- CurrentGraphicsOutputMode->Mode = 0xffff;
- Index = 0;
- }
-
- //
- // Force GraphicsOutput mode to be set,
- // regardless whether the console is in EfiConsoleControlScreenGraphics or EfiConsoleControlScreenText mode
- //
- Private->HardwareNeedsStarting = TRUE;
- Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) Index);
-
- Private->CurrentNumberOfGraphicsOutput++;
-
- return Status;
-}
-
-EFI_STATUS
-ConSplitterTextOutAddDevice (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut,
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
- IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- UINTN CurrentNumOfConsoles;
- INT32 CurrentMode;
- INT32 MaxMode;
- TEXT_OUT_AND_GOP_DATA *TextAndGop;
-
- Status = EFI_SUCCESS;
- CurrentNumOfConsoles = Private->CurrentNumberOfConsoles;
-
- //
- // If the Text Out List is full, enlarge it by calling growbuffer().
- //
- while (CurrentNumOfConsoles >= Private->TextOutListCount) {
- Status = ConSplitterGrowBuffer (
- sizeof (TEXT_OUT_AND_GOP_DATA),
- &Private->TextOutListCount,
- (VOID **) &Private->TextOutList
- );
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Also need to reallocate the TextOutModeMap table
- //
- Status = ConSplitterGrowMapTable (Private);
- if (EFI_ERROR (Status)) {
- return EFI_OUT_OF_RESOURCES;
- }
- }
-
- TextAndGop = &Private->TextOutList[CurrentNumOfConsoles];
-
- TextAndGop->TextOut = TextOut;
- TextAndGop->GraphicsOutput = GraphicsOutput;
- TextAndGop->UgaDraw = UgaDraw;
-
- if ((GraphicsOutput == NULL) && (UgaDraw == NULL)) {
- //
- // If No UGA device then use the ConOut device
- //
- TextAndGop->TextOutEnabled = TRUE;
- } else {
- //
- // If UGA device use ConOut device only used if UGA screen is in Text mode
- //
- TextAndGop->TextOutEnabled = (BOOLEAN) (Private->ConsoleOutputMode == EfiConsoleControlScreenText);
- }
-
- if (CurrentNumOfConsoles == 0) {
- //
- // Add the first device's output mode to console splitter's mode list
- //
- Status = ConSplitterAddOutputMode (Private, TextOut);
- } else {
- ConSplitterSyncOutputMode (Private, TextOut);
- }
-
- Private->CurrentNumberOfConsoles++;
-
- //
- // Scan both TextOutList, for the intersection TextOut device
- // maybe both ConOut and StdErr incorporate the same Text Out
- // device in them, thus the output of both should be synced.
- //
- ConSplitterGetIntersectionBetweenConOutAndStrErr ();
-
- CurrentMode = Private->TextOutMode.Mode;
- MaxMode = Private->TextOutMode.MaxMode;
- ASSERT (MaxMode >= 1);
-
- if ((GraphicsOutput != NULL) || (UgaDraw != NULL)) {
- ConSplitterAddGraphicsOutputMode (Private, GraphicsOutput, UgaDraw);
- }
-
- if (Private->ConsoleOutputMode == EfiConsoleControlScreenGraphics && GraphicsOutput != NULL) {
- //
- // We just added a new UGA device in graphics mode
- //
- DevNullGopSync (Private, GraphicsOutput, UgaDraw);
- } else if ((CurrentMode >= 0) && ((GraphicsOutput != NULL) || (UgaDraw != NULL)) && (CurrentMode < Private->TextOutMode.MaxMode)) {
- //
- // The new console supports the same mode of the current console so sync up
- //
- DevNullSyncGopStdOut (Private);
- } else {
- //
- // If ConOut, then set the mode to Mode #0 which us 80 x 25
- //
- Private->TextOut.SetMode (&Private->TextOut, 0);
- }
-
- return Status;
-}
-
-EFI_STATUS
-ConSplitterTextOutDeleteDevice (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
---*/
-{
- INT32 Index;
- UINTN CurrentNumOfConsoles;
- TEXT_OUT_AND_GOP_DATA *TextOutList;
- EFI_STATUS Status;
-
- //
- // Remove the specified text-out device data structure from the Text out List,
- // and rearrange the remaining data structures in the Text out List.
- //
- CurrentNumOfConsoles = Private->CurrentNumberOfConsoles;
- Index = (INT32) CurrentNumOfConsoles - 1;
- TextOutList = Private->TextOutList;
- while (Index >= 0) {
- if (TextOutList->TextOut == TextOut) {
- CopyMem (TextOutList, TextOutList + 1, sizeof (TEXT_OUT_AND_GOP_DATA) * Index);
- CurrentNumOfConsoles--;
- break;
- }
-
- Index--;
- TextOutList++;
- }
- //
- // The specified TextOut is not managed by the ConSplitter driver
- //
- if (Index < 0) {
- return EFI_NOT_FOUND;
- }
-
- if (CurrentNumOfConsoles == 0) {
- //
- // If the number of consoles is zero clear the Dev NULL device
- //
- Private->CurrentNumberOfConsoles = 0;
- Private->TextOutMode.MaxMode = 1;
- Private->TextOutQueryData[0].Columns = 80;
- Private->TextOutQueryData[0].Rows = 25;
- DevNullTextOutSetMode (Private, 0);
-
- return EFI_SUCCESS;
- }
- //
- // Max Mode is realy an intersection of the QueryMode command to all
- // devices. So we must copy the QueryMode of the first device to
- // QueryData.
- //
- ZeroMem (
- Private->TextOutQueryData,
- Private->TextOutQueryDataCount * sizeof (TEXT_OUT_SPLITTER_QUERY_DATA)
- );
-
- FreePool (Private->TextOutModeMap);
- Private->TextOutModeMap = NULL;
- TextOutList = Private->TextOutList;
-
- //
- // Add the first TextOut to the QueryData array and ModeMap table
- //
- Status = ConSplitterAddOutputMode (Private, TextOutList->TextOut);
-
- //
- // Now add one by one
- //
- Index = 1;
- Private->CurrentNumberOfConsoles = 1;
- TextOutList++;
- while ((UINTN) Index < CurrentNumOfConsoles) {
- ConSplitterSyncOutputMode (Private, TextOutList->TextOut);
- Index++;
- Private->CurrentNumberOfConsoles++;
- TextOutList++;
- }
-
- ConSplitterGetIntersectionBetweenConOutAndStrErr ();
-
- return Status;
-}
-//
-// ConSplitter TextIn member functions
-//
-EFI_STATUS
-EFIAPI
-ConSplitterTextInReset (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset the input device and optionaly run diagnostics
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - Driver may perform diagnostics on reset.
-
- Returns:
- EFI_SUCCESS - The device was reset.
- EFI_DEVICE_ERROR - The device is not functioning properly and could
- not be reset.
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS ReturnStatus;
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
-
- Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- Private->KeyEventSignalState = FALSE;
-
- //
- // return the worst status met
- //
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {
- Status = Private->TextInList[Index]->Reset (
- Private->TextInList[Index],
- ExtendedVerification
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
-
- return ReturnStatus;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextInPrivateReadKeyStroke (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
- Routine Description:
- Reads the next keystroke from the input device. The WaitForKey Event can
- be used to test for existance of a keystroke via WaitForEvent () call.
-
- Arguments:
- This - Protocol instance pointer.
- Key - Driver may perform diagnostics on reset.
-
- Returns:
- EFI_SUCCESS - The keystroke information was returned.
- EFI_NOT_READY - There was no keystroke data availiable.
- EFI_DEVICE_ERROR - The keydtroke information was not returned due to
- hardware errors.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_INPUT_KEY CurrentKey;
-
- Key->UnicodeChar = 0;
- Key->ScanCode = SCAN_NULL;
-
- //
- // if no physical console input device exists, return EFI_NOT_READY;
- // if any physical console input device has key input,
- // return the key and EFI_SUCCESS.
- //
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
- Status = Private->TextInList[Index]->ReadKeyStroke (
- Private->TextInList[Index],
- &CurrentKey
- );
- if (!EFI_ERROR (Status)) {
- *Key = CurrentKey;
- return Status;
- }
- }
-
- return EFI_NOT_READY;
-}
-
-BOOLEAN
-ConSpliterConssoleControlStdInLocked (
- VOID
- )
-/*++
-
-Routine Description:
- Return TRUE if StdIn is locked. The ConIn device on the virtual handle is
- the only device locked.
-
-Arguments:
- NONE
-
-Returns:
- TRUE - StdIn locked
- FALSE - StdIn working normally
-
---*/
-{
- return mConIn.PasswordEnabled;
-}
-
-VOID
-EFIAPI
-ConSpliterConsoleControlLockStdInEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
- This timer event will fire when StdIn is locked. It will check the key
- sequence on StdIn to see if it matches the password. Any error in the
- password will cause the check to reset. As long a mConIn.PasswordEnabled is
- TRUE the StdIn splitter will not report any input.
-
-Arguments:
- (Standard EFI_EVENT_NOTIFY)
-
-Returns:
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- CHAR16 BackSpaceString[2];
- CHAR16 SpaceString[2];
-
- do {
- Status = ConSplitterTextInPrivateReadKeyStroke (&mConIn, &Key);
- if (!EFI_ERROR (Status)) {
- //
- // if it's an ENTER, match password
- //
- if ((Key.UnicodeChar == CHAR_CARRIAGE_RETURN) && (Key.ScanCode == SCAN_NULL)) {
- mConIn.PwdAttempt[mConIn.PwdIndex] = CHAR_NULL;
- if (StrCmp (mConIn.Password, mConIn.PwdAttempt)) {
- //
- // Password not match
- //
- ConSplitterTextOutOutputString (&mConOut.TextOut, (CHAR16 *) L"\n\rPassword not correct\n\r");
- mConIn.PwdIndex = 0;
- } else {
- //
- // Key matches password sequence
- //
- gBS->SetTimer (mConIn.LockEvent, TimerPeriodic, 0);
- mConIn.PasswordEnabled = FALSE;
- Status = EFI_NOT_READY;
- }
- } else if ((Key.UnicodeChar == CHAR_BACKSPACE) && (Key.ScanCode == SCAN_NULL)) {
- //
- // BackSpace met
- //
- if (mConIn.PwdIndex > 0) {
- BackSpaceString[0] = CHAR_BACKSPACE;
- BackSpaceString[1] = 0;
-
- SpaceString[0] = ' ';
- SpaceString[1] = 0;
-
- ConSplitterTextOutOutputString (&mConOut.TextOut, BackSpaceString);
- ConSplitterTextOutOutputString (&mConOut.TextOut, SpaceString);
- ConSplitterTextOutOutputString (&mConOut.TextOut, BackSpaceString);
-
- mConIn.PwdIndex--;
- }
- } else if ((Key.ScanCode == SCAN_NULL) && (Key.UnicodeChar >= 32)) {
- //
- // If it's not an ENTER, neigher a function key, nor a CTRL-X or ALT-X, record the input
- //
- if (mConIn.PwdIndex < (MAX_STD_IN_PASSWORD - 1)) {
- if (mConIn.PwdIndex == 0) {
- ConSplitterTextOutOutputString (&mConOut.TextOut, (CHAR16 *) L"\n\r");
- }
-
- ConSplitterTextOutOutputString (&mConOut.TextOut, (CHAR16 *) L"*");
- mConIn.PwdAttempt[mConIn.PwdIndex] = Key.UnicodeChar;
- mConIn.PwdIndex++;
- }
- }
- }
- } while (!EFI_ERROR (Status));
-}
-
-EFI_STATUS
-EFIAPI
-ConSpliterConsoleControlLockStdIn (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
- IN CHAR16 *Password
- )
-/*++
-
-Routine Description:
- If Password is NULL unlock the password state variable and set the event
- timer. If the Password is too big return an error. If the Password is valid
- Copy the Password and enable state variable and then arm the periodic timer
-
-Arguments:
-
-Returns:
- EFI_SUCCESS - Lock the StdIn device
- EFI_INVALID_PARAMETER - Password is NULL
- EFI_OUT_OF_RESOURCES - Buffer allocation to store the password fails
-
---*/
-{
- if (Password == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (StrLen (Password) >= MAX_STD_IN_PASSWORD) {
- //
- // Currently have a max password size
- //
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Save the password, initialize state variables and arm event timer
- //
- StrCpy (mConIn.Password, Password);
- mConIn.PasswordEnabled = TRUE;
- mConIn.PwdIndex = 0;
- gBS->SetTimer (mConIn.LockEvent, TimerPeriodic, (10000 * 25));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
-
- Routine Description:
- Reads the next keystroke from the input device. The WaitForKey Event can
- be used to test for existance of a keystroke via WaitForEvent () call.
- If the ConIn is password locked make it look like no keystroke is availible
-
- Arguments:
- This - Protocol instance pointer.
- Key - Driver may perform diagnostics on reset.
-
- Returns:
- EFI_SUCCESS - The keystroke information was returned.
- EFI_NOT_READY - There was no keystroke data availiable.
- EFI_DEVICE_ERROR - The keydtroke information was not returned due to
- hardware errors.
-
---*/
-{
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;
-
- Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
- if (Private->PasswordEnabled) {
- //
- // If StdIn Locked return not ready
- //
- return EFI_NOT_READY;
- }
-
- Private->KeyEventSignalState = FALSE;
-
- return ConSplitterTextInPrivateReadKeyStroke (Private, Key);
-}
-
-VOID
-EFIAPI
-ConSplitterTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
- This event agregates all the events of the ConIn devices in the spliter.
- If the ConIn is password locked then return.
- If any events of physical ConIn devices are signaled, signal the ConIn
- spliter event. This will cause the calling code to call
- ConSplitterTextInReadKeyStroke ().
-
-Arguments:
- Event - The Event assoicated with callback.
- Context - Context registered when Event was created.
-
-Returns:
- None
-
---*/
-{
- EFI_STATUS Status;
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
-
- Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context;
- if (Private->PasswordEnabled) {
- //
- // If StdIn Locked return not ready
- //
- return ;
- }
-
- //
- // if KeyEventSignalState is flagged before, and not cleared by Reset() or ReadKeyStroke()
- //
- if (Private->KeyEventSignalState) {
- gBS->SignalEvent (Event);
- return ;
- }
- //
- // if any physical console input device has key input, signal the event.
- //
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
- Status = gBS->CheckEvent (Private->TextInList[Index]->WaitForKey);
- if (!EFI_ERROR (Status)) {
- gBS->SignalEvent (Event);
- Private->KeyEventSignalState = TRUE;
- }
- }
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerReset (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset the input device and optionaly run diagnostics
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - Driver may perform diagnostics on reset.
-
- Returns:
- EFI_SUCCESS - The device was reset.
- EFI_DEVICE_ERROR - The device is not functioning properly and could
- not be reset.
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS ReturnStatus;
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
-
- Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_SIMPLE_POINTER_THIS (This);
-
- Private->InputEventSignalState = FALSE;
-
- if (Private->CurrentNumberOfPointers == 0) {
- return EFI_SUCCESS;
- }
- //
- // return the worst status met
- //
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfPointers; Index++) {
- Status = Private->PointerList[Index]->Reset (
- Private->PointerList[Index],
- ExtendedVerification
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
-
- return ReturnStatus;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerPrivateGetState (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- IN OUT EFI_SIMPLE_POINTER_STATE *State
- )
-/*++
-
- Routine Description:
- Reads the next keystroke from the input device. The WaitForKey Event can
- be used to test for existance of a keystroke via WaitForEvent () call.
-
- Arguments:
- This - Protocol instance pointer.
- State -
-
- Returns:
- EFI_SUCCESS - The keystroke information was returned.
- EFI_NOT_READY - There was no keystroke data availiable.
- EFI_DEVICE_ERROR - The keydtroke information was not returned due to
- hardware errors.
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS ReturnStatus;
- UINTN Index;
- EFI_SIMPLE_POINTER_STATE CurrentState;
-
- State->RelativeMovementX = 0;
- State->RelativeMovementY = 0;
- State->RelativeMovementZ = 0;
- State->LeftButton = FALSE;
- State->RightButton = FALSE;
-
- //
- // if no physical console input device exists, return EFI_NOT_READY;
- // if any physical console input device has key input,
- // return the key and EFI_SUCCESS.
- //
- ReturnStatus = EFI_NOT_READY;
- for (Index = 0; Index < Private->CurrentNumberOfPointers; Index++) {
-
- Status = Private->PointerList[Index]->GetState (
- Private->PointerList[Index],
- &CurrentState
- );
- if (!EFI_ERROR (Status)) {
- if (ReturnStatus == EFI_NOT_READY) {
- ReturnStatus = EFI_SUCCESS;
- }
-
- if (CurrentState.LeftButton) {
- State->LeftButton = TRUE;
- }
-
- if (CurrentState.RightButton) {
- State->RightButton = TRUE;
- }
-
- if (CurrentState.RelativeMovementX != 0 && Private->PointerList[Index]->Mode->ResolutionX != 0) {
- State->RelativeMovementX += (CurrentState.RelativeMovementX * (INT32) Private->SimplePointerMode.ResolutionX) / (INT32) Private->PointerList[Index]->Mode->ResolutionX;
- }
-
- if (CurrentState.RelativeMovementY != 0 && Private->PointerList[Index]->Mode->ResolutionY != 0) {
- State->RelativeMovementY += (CurrentState.RelativeMovementY * (INT32) Private->SimplePointerMode.ResolutionY) / (INT32) Private->PointerList[Index]->Mode->ResolutionY;
- }
-
- if (CurrentState.RelativeMovementZ != 0 && Private->PointerList[Index]->Mode->ResolutionZ != 0) {
- State->RelativeMovementZ += (CurrentState.RelativeMovementZ * (INT32) Private->SimplePointerMode.ResolutionZ) / (INT32) Private->PointerList[Index]->Mode->ResolutionZ;
- }
- } else if (Status == EFI_DEVICE_ERROR) {
- ReturnStatus = EFI_DEVICE_ERROR;
- }
- }
-
- return ReturnStatus;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerGetState (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- IN OUT EFI_SIMPLE_POINTER_STATE *State
- )
-/*++
-
- Routine Description:
- Reads the next keystroke from the input device. The WaitForKey Event can
- be used to test for existance of a keystroke via WaitForEvent () call.
- If the ConIn is password locked make it look like no keystroke is availible
-
- Arguments:
- This - Protocol instance pointer.
- State -
-
- Returns:
- EFI_SUCCESS - The keystroke information was returned.
- EFI_NOT_READY - There was no keystroke data availiable.
- EFI_DEVICE_ERROR - The keydtroke information was not returned due to
- hardware errors.
-
---*/
-{
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;
-
- Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_SIMPLE_POINTER_THIS (This);
- if (Private->PasswordEnabled) {
- //
- // If StdIn Locked return not ready
- //
- return EFI_NOT_READY;
- }
-
- Private->InputEventSignalState = FALSE;
-
- return ConSplitterSimplePointerPrivateGetState (Private, State);
-}
-
-VOID
-EFIAPI
-ConSplitterSimplePointerWaitForInput (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
- This event agregates all the events of the ConIn devices in the spliter.
- If the ConIn is password locked then return.
- If any events of physical ConIn devices are signaled, signal the ConIn
- spliter event. This will cause the calling code to call
- ConSplitterTextInReadKeyStroke ().
-
-Arguments:
- Event - The Event assoicated with callback.
- Context - Context registered when Event was created.
-
-Returns:
- None
-
---*/
-{
- EFI_STATUS Status;
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
-
- Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context;
- if (Private->PasswordEnabled) {
- //
- // If StdIn Locked return not ready
- //
- return ;
- }
-
- //
- // if InputEventSignalState is flagged before, and not cleared by Reset() or ReadKeyStroke()
- //
- if (Private->InputEventSignalState) {
- gBS->SignalEvent (Event);
- return ;
- }
- //
- // if any physical console input device has key input, signal the event.
- //
- for (Index = 0; Index < Private->CurrentNumberOfPointers; Index++) {
- Status = gBS->CheckEvent (Private->PointerList[Index]->WaitForInput);
- if (!EFI_ERROR (Status)) {
- gBS->SignalEvent (Event);
- Private->InputEventSignalState = TRUE;
- }
- }
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutReset (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset the text output device hardware and optionaly run diagnostics
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - Driver may perform more exhaustive verfication
- operation of the device during reset.
-
- Returns:
- EFI_SUCCESS - The text output device was reset.
- EFI_DEVICE_ERROR - The text output device is not functioning correctly and
- could not be reset.
-
---*/
-{
- EFI_STATUS Status;
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- EFI_STATUS ReturnStatus;
-
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // return the worst status met
- //
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {
-
- if (Private->TextOutList[Index].TextOutEnabled) {
-
- Status = Private->TextOutList[Index].TextOut->Reset (
- Private->TextOutList[Index].TextOut,
- ExtendedVerification
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
-
- This->SetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BACKGROUND_BLACK));
-
- Status = DevNullTextOutSetMode (Private, 0);
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
-
- return ReturnStatus;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutOutputString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- )
-/*++
-
- Routine Description:
- Write a Unicode string to the output device.
-
- Arguments:
- This - Protocol instance pointer.
- String - The NULL-terminated Unicode string to be displayed on the output
- device(s). All output devices must also support the Unicode
- drawing defined in this file.
-
- Returns:
- EFI_SUCCESS - The string was output to the device.
- EFI_DEVICE_ERROR - The device reported an error while attempting to output
- the text.
- EFI_UNSUPPORTED - The output device's mode is not currently in a
- defined text mode.
- EFI_WARN_UNKNOWN_GLYPH - This warning code indicates that some of the
- characters in the Unicode string could not be
- rendered and were skipped.
-
---*/
-{
- EFI_STATUS Status;
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- UINTN BackSpaceCount;
- EFI_STATUS ReturnStatus;
- CHAR16 *TargetString;
-
- This->SetAttribute (This, This->Mode->Attribute);
-
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- BackSpaceCount = 0;
- for (TargetString = WString; *TargetString; TargetString++) {
- if (*TargetString == CHAR_BACKSPACE) {
- BackSpaceCount++;
- }
-
- }
-
- if (BackSpaceCount == 0) {
- TargetString = WString;
- } else {
- TargetString = AllocatePool (sizeof (CHAR16) * (StrLen (WString) + BackSpaceCount + 1));
- StrCpy (TargetString, WString);
- }
- //
- // return the worst status met
- //
- Status = DevNullTextOutOutputString (Private, TargetString);
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
-
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {
-
- if (Private->TextOutList[Index].TextOutEnabled) {
- Status = Private->TextOutList[Index].TextOut->OutputString (
- Private->TextOutList[Index].TextOut,
- TargetString
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
-
- if (BackSpaceCount) {
- FreePool (TargetString);
- }
-
- return ReturnStatus;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutTestString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- )
-/*++
-
- Routine Description:
- Verifies that all characters in a Unicode string can be output to the
- target device.
-
- Arguments:
- This - Protocol instance pointer.
- String - The NULL-terminated Unicode string to be examined for the output
- device(s).
-
- Returns:
- EFI_SUCCESS - The device(s) are capable of rendering the output string.
- EFI_UNSUPPORTED - Some of the characters in the Unicode string cannot be
- rendered by one or more of the output devices mapped
- by the EFI handle.
-
---*/
-{
- EFI_STATUS Status;
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- EFI_STATUS ReturnStatus;
-
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // return the worst status met
- //
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {
- if (Private->TextOutList[Index].TextOutEnabled) {
- Status = Private->TextOutList[Index].TextOut->TestString (
- Private->TextOutList[Index].TextOut,
- WString
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
- //
- // There is no DevNullTextOutTestString () since a Unicode buffer would
- // always return EFI_SUCCESS.
- // ReturnStatus will be EFI_SUCCESS if no consoles are present
- //
- return ReturnStatus;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
- )
-/*++
-
- Routine Description:
- Returns information for an available text mode that the output device(s)
- supports.
-
- Arguments:
- This - Protocol instance pointer.
- ModeNumber - The mode number to return information on.
- Columns, Rows - Returns the geometry of the text output device for the
- requested ModeNumber.
-
- Returns:
- EFI_SUCCESS - The requested mode information was returned.
- EFI_DEVICE_ERROR - The device had an error and could not
- complete the request.
- EFI_UNSUPPORTED - The mode number was not valid.
-
---*/
-{
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
-
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Check whether param ModeNumber is valid.
- // ModeNumber should be within range 0 ~ MaxMode - 1.
- //
- if ( (ModeNumber > (UINTN)(((UINT32)-1)>>1)) ) {
- return EFI_UNSUPPORTED;
- }
-
- if ((INT32) ModeNumber >= This->Mode->MaxMode) {
- return EFI_UNSUPPORTED;
- }
-
- *Columns = Private->TextOutQueryData[ModeNumber].Columns;
- *Rows = Private->TextOutQueryData[ModeNumber].Rows;
-
- if (*Columns <= 0 && *Rows <= 0) {
- return EFI_UNSUPPORTED;
-
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutSetMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber
- )
-/*++
-
- Routine Description:
- Sets the output device(s) to a specified mode.
-
- Arguments:
- This - Protocol instance pointer.
- ModeNumber - The mode number to set.
-
- Returns:
- EFI_SUCCESS - The requested text mode was set.
- EFI_DEVICE_ERROR - The device had an error and
- could not complete the request.
- EFI_UNSUPPORTED - The mode number was not valid.
-
---*/
-{
- EFI_STATUS Status;
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- INT32 *TextOutModeMap;
- EFI_STATUS ReturnStatus;
-
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Check whether param ModeNumber is valid.
- // ModeNumber should be within range 0 ~ MaxMode - 1.
- //
- if ( (ModeNumber > (UINTN)(((UINT32)-1)>>1)) ) {
- return EFI_UNSUPPORTED;
- }
-
- if ((INT32) ModeNumber >= This->Mode->MaxMode) {
- return EFI_UNSUPPORTED;
- }
- //
- // If the mode is being set to the curent mode, then just clear the screen and return.
- //
- if (Private->TextOutMode.Mode == (INT32) ModeNumber) {
- return ConSplitterTextOutClearScreen (This);
- }
- //
- // return the worst status met
- //
- TextOutModeMap = Private->TextOutModeMap + Private->TextOutListCount * ModeNumber;
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {
-
- if (Private->TextOutList[Index].TextOutEnabled) {
- Status = Private->TextOutList[Index].TextOut->SetMode (
- Private->TextOutList[Index].TextOut,
- TextOutModeMap[Index]
- );
- //
- // If this console device is based on a UGA device, then sync up the bitmap from
- // the UGA splitter and reclear the text portion of the display in the new mode.
- //
- if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) {
- Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut);
- }
-
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
- //
- // The DevNull Console will support any possible mode as it allocates memory
- //
- Status = DevNullTextOutSetMode (Private, ModeNumber);
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
-
- return ReturnStatus;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Attribute
- )
-/*++
-
- Routine Description:
- Sets the background and foreground colors for the OutputString () and
- ClearScreen () functions.
-
- Arguments:
- This - Protocol instance pointer.
- Attribute - The attribute to set. Bits 0..3 are the foreground color, and
- bits 4..6 are the background color. All other bits are undefined
- and must be zero. The valid Attributes are defined in this file.
-
- Returns:
- EFI_SUCCESS - The attribute was set.
- EFI_DEVICE_ERROR - The device had an error and
- could not complete the request.
- EFI_UNSUPPORTED - The attribute requested is not defined.
-
---*/
-{
- EFI_STATUS Status;
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- EFI_STATUS ReturnStatus;
-
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Check whether param Attribute is valid.
- //
- if ( (Attribute > (UINTN)(((UINT32)-1)>>1)) ) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // return the worst status met
- //
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {
-
- if (Private->TextOutList[Index].TextOutEnabled) {
- Status = Private->TextOutList[Index].TextOut->SetAttribute (
- Private->TextOutList[Index].TextOut,
- Attribute
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
-
- Private->TextOutMode.Attribute = (INT32) Attribute;
-
- return ReturnStatus;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutClearScreen (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Clears the output device(s) display to the currently selected background
- color.
-
- Arguments:
- This - Protocol instance pointer.
-
- Returns:
- EFI_SUCCESS - The operation completed successfully.
- EFI_DEVICE_ERROR - The device had an error and
- could not complete the request.
- EFI_UNSUPPORTED - The output device is not in a valid text mode.
-
---*/
-{
- EFI_STATUS Status;
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- EFI_STATUS ReturnStatus;
-
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // return the worst status met
- //
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {
-
- if (Private->TextOutList[Index].TextOutEnabled) {
- Status = Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut);
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
-
- Status = DevNullTextOutClearScreen (Private);
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
-
- return ReturnStatus;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutSetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
- )
-/*++
-
- Routine Description:
- Sets the current coordinates of the cursor position
-
- Arguments:
- This - Protocol instance pointer.
- Column, Row - the position to set the cursor to. Must be greater than or
- equal to zero and less than the number of columns and rows
- by QueryMode ().
-
- Returns:
- EFI_SUCCESS - The operation completed successfully.
- EFI_DEVICE_ERROR - The device had an error and
- could not complete the request.
- EFI_UNSUPPORTED - The output device is not in a valid text mode, or the
- cursor position is invalid for the current mode.
-
---*/
-{
- EFI_STATUS Status;
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- EFI_STATUS ReturnStatus;
- UINTN MaxColumn;
- UINTN MaxRow;
-
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- MaxColumn = Private->TextOutQueryData[Private->TextOutMode.Mode].Columns;
- MaxRow = Private->TextOutQueryData[Private->TextOutMode.Mode].Rows;
-
- if (Column >= MaxColumn || Row >= MaxRow) {
- return EFI_UNSUPPORTED;
- }
- //
- // return the worst status met
- //
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {
-
- if (Private->TextOutList[Index].TextOutEnabled) {
- Status = Private->TextOutList[Index].TextOut->SetCursorPosition (
- Private->TextOutList[Index].TextOut,
- Column,
- Row
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
-
- DevNullTextOutSetCursorPosition (Private, Column, Row);
-
- return ReturnStatus;
-}
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutEnableCursor (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN Visible
- )
-/*++
-
- Routine Description:
- Makes the cursor visible or invisible
-
- Arguments:
- This - Protocol instance pointer.
- Visible - If TRUE, the cursor is set to be visible. If FALSE, the cursor is
- set to be invisible.
-
- Returns:
- EFI_SUCCESS - The operation completed successfully.
- EFI_DEVICE_ERROR - The device had an error and could not complete the
- request, or the device does not support changing
- the cursor mode.
- EFI_UNSUPPORTED - The output device is not in a valid text mode.
-
---*/
-{
- EFI_STATUS Status;
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- EFI_STATUS ReturnStatus;
-
- Private = TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // return the worst status met
- //
- for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfConsoles; Index++) {
-
- if (Private->TextOutList[Index].TextOutEnabled) {
- Status = Private->TextOutList[Index].TextOut->EnableCursor (
- Private->TextOutList[Index].TextOut,
- Visible
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
-
- DevNullTextOutEnableCursor (Private, Visible);
-
- return ReturnStatus;
-}
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.h b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.h
deleted file mode 100644
index 222e6b4..0000000
--- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.h
+++ /dev/null
@@ -1,662 +0,0 @@
-/**@file
- Private data structures for the Console Splitter driver
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _CON_SPLITTER_H_
-#define _CON_SPLITTER_H_
-
-//
-// Private Data Structures
-//
-#define CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT 32
-#define CONSOLE_SPLITTER_MODES_ALLOC_UNIT 32
-#define MAX_STD_IN_PASSWORD 80
-
-typedef struct {
- UINTN Columns;
- UINTN Rows;
-} TEXT_OUT_SPLITTER_QUERY_DATA;
-
-//
-// Private data for the EFI_SIMPLE_TEXT_INPUT_PROTOCOL splitter
-//
-#define TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('T', 'i', 'S', 'p')
-
-typedef struct {
- UINT64 Signature;
- EFI_HANDLE VirtualHandle;
-
- EFI_SIMPLE_TEXT_IN_PROTOCOL TextIn;
- UINTN CurrentNumberOfConsoles;
- EFI_SIMPLE_TEXT_IN_PROTOCOL **TextInList;
- UINTN TextInListCount;
-
- EFI_SIMPLE_POINTER_PROTOCOL SimplePointer;
- EFI_SIMPLE_POINTER_MODE SimplePointerMode;
- UINTN CurrentNumberOfPointers;
- EFI_SIMPLE_POINTER_PROTOCOL **PointerList;
- UINTN PointerListCount;
-
- BOOLEAN PasswordEnabled;
- CHAR16 Password[MAX_STD_IN_PASSWORD];
- UINTN PwdIndex;
- CHAR16 PwdAttempt[MAX_STD_IN_PASSWORD];
- EFI_EVENT LockEvent;
-
- BOOLEAN KeyEventSignalState;
- BOOLEAN InputEventSignalState;
-} TEXT_IN_SPLITTER_PRIVATE_DATA;
-
-#define TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \
- CR ((a), \
- TEXT_IN_SPLITTER_PRIVATE_DATA, \
- TextIn, \
- TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE \
- )
-
-#define TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_SIMPLE_POINTER_THIS(a) \
- CR ((a), \
- TEXT_IN_SPLITTER_PRIVATE_DATA, \
- SimplePointer, \
- TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE \
- )
-
-//
-// Private data for the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL splitter
-//
-#define TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('T', 'o', 'S', 'p')
-
-typedef struct {
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut;
- BOOLEAN TextOutEnabled;
-} TEXT_OUT_AND_GOP_DATA;
-
-typedef struct {
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
-} TEXT_OUT_GOP_MODE;
-
-typedef struct {
- UINT64 Signature;
- EFI_HANDLE VirtualHandle;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL TextOut;
- EFI_SIMPLE_TEXT_OUTPUT_MODE TextOutMode;
-
- EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GraphicsOutputBlt;
- TEXT_OUT_GOP_MODE *GraphicsOutputModeBuffer;
- UINTN CurrentNumberOfGraphicsOutput;
- BOOLEAN HardwareNeedsStarting;
-
- EFI_CONSOLE_CONTROL_PROTOCOL ConsoleControl;
-
- UINTN CurrentNumberOfConsoles;
- TEXT_OUT_AND_GOP_DATA *TextOutList;
- UINTN TextOutListCount;
- TEXT_OUT_SPLITTER_QUERY_DATA *TextOutQueryData;
- UINTN TextOutQueryDataCount;
- INT32 *TextOutModeMap;
-
- EFI_CONSOLE_CONTROL_SCREEN_MODE ConsoleOutputMode;
-
- UINTN DevNullColumns;
- UINTN DevNullRows;
- CHAR16 *DevNullScreen;
- INT32 *DevNullAttributes;
-
-} TEXT_OUT_SPLITTER_PRIVATE_DATA;
-
-#define TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \
- CR ((a), \
- TEXT_OUT_SPLITTER_PRIVATE_DATA, \
- TextOut, \
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE \
- )
-
-#define GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \
- CR ((a), \
- TEXT_OUT_SPLITTER_PRIVATE_DATA, \
- GraphicsOutput, \
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE \
- )
-
-#define UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \
- CR ((a), \
- TEXT_OUT_SPLITTER_PRIVATE_DATA, \
- UgaDraw, \
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE \
- )
-
-#define CONSOLE_CONTROL_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \
- CR ((a), \
- TEXT_OUT_SPLITTER_PRIVATE_DATA, \
- ConsoleControl, \
- TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE \
- )
-
-//
-// Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-ConSplitterDriverEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-EFI_STATUS
-ConSplitterTextInConstructor (
- TEXT_IN_SPLITTER_PRIVATE_DATA *Private
- )
-;
-
-EFI_STATUS
-ConSplitterTextOutConstructor (
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
- )
-;
-
-//
-// Driver Binding Functions
-//
-EFI_STATUS
-EFIAPI
-ConSplitterConInDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterConOutDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterStdErrDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterConInDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterConOutDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterStdErrDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterConInDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterConOutDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterStdErrDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-ConSplitterConInComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-EFI_STATUS
-EFIAPI
-ConSplitterConOutComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-EFI_STATUS
-EFIAPI
-ConSplitterStdErrComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// TextIn Constructor/Destructor functions
-//
-EFI_STATUS
-ConSplitterTextInAddDevice (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *TextIn
- )
-;
-
-EFI_STATUS
-ConSplitterTextInDeleteDevice (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *TextIn
- )
-;
-
-//
-// SimplePointer Constuctor/Destructor functions
-//
-EFI_STATUS
-ConSplitterSimplePointerAddDevice (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer
- )
-;
-
-EFI_STATUS
-ConSplitterSimplePointerDeleteDevice (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer
- )
-;
-
-//
-// TextOut Constuctor/Destructor functions
-//
-EFI_STATUS
-ConSplitterTextOutAddDevice (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut,
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
- IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
- )
-;
-
-EFI_STATUS
-ConSplitterTextOutDeleteDevice (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *TextOut
- )
-;
-
-//
-// TextIn I/O Functions
-//
-EFI_STATUS
-EFIAPI
-ConSplitterTextInReset (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-;
-
-VOID
-EFIAPI
-ConSplitterTextInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-BOOLEAN
-ConSpliterConssoleControlStdInLocked (
- VOID
- )
-;
-
-VOID
-EFIAPI
-ConSpliterConsoleControlLockStdInEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSpliterConsoleControlLockStdIn (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
- IN CHAR16 *Password
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextInPrivateReadKeyStroke (
- IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
- OUT EFI_INPUT_KEY *Key
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerReset (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterSimplePointerGetState (
- IN EFI_SIMPLE_POINTER_PROTOCOL *This,
- IN OUT EFI_SIMPLE_POINTER_STATE *State
- )
-;
-
-VOID
-EFIAPI
-ConSplitterSimplePointerWaitForInput (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-//
-// TextOut I/O Functions
-//
-VOID
-ConSplitterSynchronizeModeData (
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutReset (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutOutputString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutTestString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutSetMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Attribute
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutClearScreen (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutSetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSplitterTextOutEnableCursor (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN Visible
- )
-;
-
-EFI_STATUS
-ConSplitterGrowBuffer (
- IN UINTN SizeOfCount,
- IN UINTN *Count,
- IN OUT VOID **Buffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSpliterConsoleControlGetMode (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
- OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode,
- OUT BOOLEAN *GopExists,
- OUT BOOLEAN *StdInLocked
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSpliterConsoleControlSetMode (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
- IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSpliterGraphicsOutputQueryMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN UINT32 ModeNumber,
- OUT UINTN *SizeOfInfo,
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSpliterGraphicsOutputSetMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
- IN UINT32 ModeNumber
- )
-;
-
-EFI_STATUS
-EFIAPI
-ConSpliterGraphicsOutputBlt (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL
- )
-;
-
-EFI_STATUS
-DevNullGopSync (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
- IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
- )
-;
-
-
-EFI_STATUS
-DevNullTextOutOutputString (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN CHAR16 *WString
- )
-;
-
-EFI_STATUS
-DevNullTextOutSetMode (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN UINTN ModeNumber
- )
-;
-
-EFI_STATUS
-DevNullTextOutClearScreen (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
- )
-;
-
-EFI_STATUS
-DevNullTextOutSetCursorPosition (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN UINTN Column,
- IN UINTN Row
- )
-;
-
-EFI_STATUS
-DevNullTextOutEnableCursor (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN BOOLEAN Visible
- )
-;
-
-EFI_STATUS
-DevNullSyncGopStdOut (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.msa b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.msa
deleted file mode 100644
index afc3502..0000000
--- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.msa
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>ConSplitter</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>408edcec-cf6d-477c-a5a8-b4844e3de281</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for ConSplitter module.</Abstract>
- <Description>Any Handle that attatched EFI_CONSOLE_IDENTIFIER_PROTOCOL can be bound by this driver.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>ConSplitter</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>ConSplitter.c</Filename>
- <Filename>ConSplitter.h</Filename>
- <Filename>ComponentName.c</Filename>
- <Filename>ConSplitterGraphics.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
- <HelpText>UGA Draw protocol is only installed in EFI mode.</HelpText>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
- <HelpText>Graphics Output Protocol is only installed in UEFI mode.</HelpText>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiSimplePointerProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiConsoleControlProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_PRODUCED">
- <GuidCName>gEfiPrimaryStandardErrorDeviceGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_PRODUCED">
- <GuidCName>gEfiPrimaryConsoleInDeviceGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_PRODUCED">
- <GuidCName>gEfiPrimaryConsoleOutDeviceGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiConsoleOutDeviceGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiStandardErrorDeviceGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiConsoleInDeviceGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>ConSplitterDriverEntry</ModuleEntryPoint>
- </Extern>
- <Extern>
- <DriverBinding>gConSplitterConInDriverBinding</DriverBinding>
- <ComponentName>gConSplitterConInComponentName</ComponentName>
- </Extern>
- <Extern>
- <DriverBinding>gConSplitterSimplePointerDriverBinding</DriverBinding>
- <ComponentName>gConSplitterSimplePointerComponentName</ComponentName>
- </Extern>
- <Extern>
- <DriverBinding>gConSplitterConOutDriverBinding</DriverBinding>
- <ComponentName>gConSplitterConOutComponentName</ComponentName>
- </Extern>
- <Extern>
- <DriverBinding>gConSplitterStdErrDriverBinding</DriverBinding>
- <ComponentName>gConSplitterStdErrComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c
deleted file mode 100644
index e5f7c10..0000000
--- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c
+++ /dev/null
@@ -1,1215 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ConSplitterGraphics.c
-
-Abstract:
-
- Support for ConsoleControl protocol. Support for UGA Draw spliter.
- Support for DevNull Console Out. This console uses memory buffers
- to represnt the console. It allows a console to start very early and
- when a new console is added it is synced up with the current console
-
---*/
-
-
-#include "ConSplitter.h"
-
-static CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };
-
-EFI_STATUS
-EFIAPI
-ConSpliterConsoleControlGetMode (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
- OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode,
- OUT BOOLEAN *GopExists,
- OUT BOOLEAN *StdInLocked
- )
-/*++
-
- Routine Description:
- Return the current video mode information. Also returns info about existence
- of UGA Draw devices in system, and if the Std In device is locked. All the
- arguments are optional and only returned if a non NULL pointer is passed in.
-
- Arguments:
- This - Protocol instance pointer.
- Mode - Are we in text of grahics mode.
- UgaExists - TRUE if UGA Spliter has found a UGA device
- StdInLocked - TRUE if StdIn device is keyboard locked
-
- Returns:
- EFI_SUCCESS - Mode information returned.
- EFI_INVALID_PARAMETER - Invalid parameters.
-
---*/
-{
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
-
- Private = CONSOLE_CONTROL_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- if (Mode == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Mode = Private->ConsoleOutputMode;
-
- if (GopExists != NULL) {
- *GopExists = FALSE;
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
- if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) {
- *GopExists = TRUE;
- break;
- }
- }
- }
-
- if (StdInLocked != NULL) {
- *StdInLocked = ConSpliterConssoleControlStdInLocked ();
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConSpliterConsoleControlSetMode (
- IN EFI_CONSOLE_CONTROL_PROTOCOL *This,
- IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode
- )
-/*++
-
- Routine Description:
- Set the current mode to either text or graphics. Graphics is
- for Quiet Boot.
-
- Arguments:
- This - Protocol instance pointer.
- Mode - Mode to set the
-
- Returns:
- EFI_SUCCESS - Mode information returned.
- EFI_INVALID_PARAMETER - Invalid parameter.
- EFI_UNSUPPORTED - Operation unsupported.
-
---*/
-{
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- TEXT_OUT_AND_GOP_DATA *TextAndGop;
- BOOLEAN Supported;
-
- Private = CONSOLE_CONTROL_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- if (Mode >= EfiConsoleControlScreenMaxValue) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // Judge current mode with wanted mode at first.
- //
- if (Private->ConsoleOutputMode == Mode) {
- return EFI_SUCCESS;
- }
-
- Supported = FALSE;
- TextAndGop = &Private->TextOutList[0];
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++, TextAndGop++) {
- if ((TextAndGop->GraphicsOutput != NULL) || (TextAndGop->UgaDraw != NULL)) {
- Supported = TRUE;
- break;
- }
- }
-
- if ((!Supported) && (Mode == EfiConsoleControlScreenGraphics)) {
- return EFI_UNSUPPORTED;
- }
-
- Private->ConsoleOutputMode = Mode;
-
- TextAndGop = &Private->TextOutList[0];
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++, TextAndGop++) {
-
- TextAndGop->TextOutEnabled = TRUE;
- //
- // If we are going into Graphics mode disable ConOut to any UGA device
- //
- if ((Mode == EfiConsoleControlScreenGraphics) &&((TextAndGop->GraphicsOutput != NULL) || (TextAndGop->UgaDraw != NULL))) {
- TextAndGop->TextOutEnabled = FALSE;
- DevNullGopSync (Private, TextAndGop->GraphicsOutput, TextAndGop->UgaDraw);
- }
- }
-
- if (Mode == EfiConsoleControlScreenText) {
- DevNullSyncGopStdOut (Private);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConSpliterGraphicsOutputQueryMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN UINT32 ModeNumber,
- OUT UINTN *SizeOfInfo,
- OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
- )
-/*++
-
- Routine Description:
- Return the current video mode information.
-
- Arguments:
- This - Protocol instance pointer.
- ModeNumber - The mode number to return information on.
- Info - Caller allocated buffer that returns information about ModeNumber.
- SizeOfInfo - A pointer to the size, in bytes, of the Info buffer.
-
- Returns:
- EFI_SUCCESS - Mode information returned.
- EFI_BUFFER_TOO_SMALL - The Info buffer was too small.
- EFI_DEVICE_ERROR - A hardware error occurred trying to retrieve the video mode.
- EFI_NOT_STARTED - Video display is not initialized. Call SetMode ()
- EFI_INVALID_PARAMETER - One of the input args was NULL.
-
---*/
-{
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- TEXT_OUT_GOP_MODE *Mode;
-
- if (This == NULL || Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // retrieve private data
- //
- Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private->HardwareNeedsStarting) {
- return EFI_NOT_STARTED;
- }
-
- *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
-
- if (*Info == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
-
- CopyMem (*Info, Private->GraphicsOutput.Mode->Info, *SizeOfInfo);
- Mode = &Private->GraphicsOutputModeBuffer[ModeNumber];
- (*Info)->HorizontalResolution = Mode->HorizontalResolution;
- (*Info)->VerticalResolution = Mode->VerticalResolution;
- (*Info)->PixelsPerScanLine = Mode->HorizontalResolution;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConSpliterGraphicsOutputSetMode (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
- IN UINT32 ModeNumber
- )
-/*++
-
-Routine Description:
-
- Graphics output protocol interface to set video mode
-
- Arguments:
- This - Protocol instance pointer.
- ModeNumber - The mode number to be set.
-
- Returns:
- EFI_SUCCESS - Graphics mode was changed.
- EFI_DEVICE_ERROR - The device had an error and could not complete the request.
- EFI_UNSUPPORTED - ModeNumber is not supported by this device.
-
---*/
-{
- EFI_STATUS Status;
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- EFI_STATUS ReturnStatus;
- TEXT_OUT_GOP_MODE *Mode;
- UINTN Size;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- UINTN NumberIndex;
- UINTN SizeOfInfo;
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
-
- if (ModeNumber >= This->Mode->MaxMode) {
- return EFI_UNSUPPORTED;
- }
-
- if (ModeNumber == This->Mode->Mode) {
- return EFI_SUCCESS;
- }
-
- Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // GopDevNullSetMode ()
- //
- ReturnStatus = EFI_SUCCESS;
-
- //
- // Free the old version
- //
- if (Private->GraphicsOutputBlt != NULL) {
- FreePool (Private->GraphicsOutputBlt);
- }
-
- //
- // Allocate the virtual Blt buffer
- //
- Mode = &Private->GraphicsOutputModeBuffer[ModeNumber];
- Size = Mode->HorizontalResolution * Mode->VerticalResolution * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
- Private->GraphicsOutputBlt = AllocateZeroPool (Size);
-
- if (Private->GraphicsOutputBlt == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (!Private->HardwareNeedsStarting) {
- if (Private->ConsoleOutputMode != EfiConsoleControlScreenGraphics) {
- return EFI_UNSUPPORTED;
- }
- }
- //
- // return the worst status met
- //
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
- GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;
- if (GraphicsOutput != NULL) {
- //
- // Find corresponding ModeNumber of this GraphicsOutput instance
- //
- for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {
- Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) {
- FreePool (Info);
- break;
- }
- FreePool (Info);
- }
-
- Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
-
- UgaDraw = Private->TextOutList[Index].UgaDraw;
- if (UgaDraw != NULL) {
- Status = UgaDraw->SetMode (
- UgaDraw,
- Mode->HorizontalResolution,
- Mode->VerticalResolution,
- 32,
- 60
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
-
- This->Mode->Mode = ModeNumber;
-
- Info = This->Mode->Info;
- Info->HorizontalResolution = Mode->HorizontalResolution;
- Info->VerticalResolution = Mode->VerticalResolution;
- Info->PixelsPerScanLine = Mode->HorizontalResolution;
-
- //
- // Information is not enough here, so the following items remain unchanged:
- // GraphicsOutputMode->Info->Version, GraphicsOutputMode->Info->PixelFormat
- // GraphicsOutputMode->SizeOfInfo, GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize
- // These items will be initialized/updated when a new GOP device is added into ConsoleSplitter.
- //
-
- Private->HardwareNeedsStarting = FALSE;
-
- return ReturnStatus;
-}
-
-STATIC
-EFI_STATUS
-DevNullGraphicsOutputBlt (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL
- )
-{
- UINTN SrcY;
- BOOLEAN Forward;
- UINTN Index;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltPtr;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ScreenPtr;
- UINTN HorizontalResolution;
- UINTN VerticalResolution;
-
- if ((BltOperation < EfiBltVideoFill) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Width == 0 || Height == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Delta == 0) {
- Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
- }
-
- HorizontalResolution = Private->GraphicsOutput.Mode->Info->HorizontalResolution;
- VerticalResolution = Private->GraphicsOutput.Mode->Info->VerticalResolution;
-
- //
- // We need to fill the Virtual Screen buffer with the blt data.
- //
- if (BltOperation == EfiBltVideoToBltBuffer) {
- //
- // Video to BltBuffer: Source is Video, destination is BltBuffer
- //
- if ((SourceY + Height) > VerticalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((SourceX + Width) > HorizontalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- BltPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + DestinationY * Delta + DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- ScreenPtr = &Private->GraphicsOutputBlt[SourceY * HorizontalResolution + SourceX];
- while (Height) {
- CopyMem (BltPtr, ScreenPtr, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- BltPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltPtr + Delta);
- ScreenPtr += HorizontalResolution;
- Height--;
- }
- } else {
- //
- // BltBuffer to Video: Source is BltBuffer, destination is Video
- //
- if (DestinationY + Height > VerticalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (DestinationX + Width > HorizontalResolution) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((BltOperation == EfiBltVideoToVideo) && (DestinationY > SourceY)) {
- //
- // Copy backwards, only care the Video to Video Blt
- //
- ScreenPtr = &Private->GraphicsOutputBlt[(DestinationY + Height - 1) * HorizontalResolution + DestinationX];
- SrcY = SourceY + Height - 1;
- Forward = FALSE;
- } else {
- //
- // Copy forwards, for other cases
- //
- ScreenPtr = &Private->GraphicsOutputBlt[DestinationY * HorizontalResolution + DestinationX];
- SrcY = SourceY;
- Forward = TRUE;
- }
-
- while (Height != 0) {
- if (BltOperation == EfiBltVideoFill) {
- for (Index = 0; Index < Width; Index++) {
- ScreenPtr[Index] = *BltBuffer;
- }
- } else {
- if (BltOperation == EfiBltBufferToVideo) {
- BltPtr = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + SrcY * Delta + SourceX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- } else {
- BltPtr = &Private->GraphicsOutputBlt[SrcY * HorizontalResolution + SourceX];
- }
-
- CopyMem (ScreenPtr, BltPtr, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
- }
-
- if (Forward) {
- ScreenPtr += HorizontalResolution;
- SrcY ++;
- } else {
- ScreenPtr -= HorizontalResolution;
- SrcY --;
- }
- Height--;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-ConSpliterGraphicsOutputBlt (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
- IN UINTN SourceX,
- IN UINTN SourceY,
- IN UINTN DestinationX,
- IN UINTN DestinationY,
- IN UINTN Width,
- IN UINTN Height,
- IN UINTN Delta OPTIONAL
- )
-/*++
-
- Routine Description:
- The following table defines actions for BltOperations:
- EfiBltVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY)
- directly to every pixel of the video display rectangle
- (DestinationX, DestinationY)
- (DestinationX + Width, DestinationY + Height).
- Only one pixel will be used from the BltBuffer. Delta is NOT used.
- EfiBltVideoToBltBuffer - Read data from the video display rectangle
- (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
- the BltBuffer rectangle (DestinationX, DestinationY )
- (DestinationX + Width, DestinationY + Height). If DestinationX or
- DestinationY is not zero then Delta must be set to the length in bytes
- of a row in the BltBuffer.
- EfiBltBufferToVideo - Write data from the BltBuffer rectangle
- (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
- video display rectangle (DestinationX, DestinationY)
- (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
- not zero then Delta must be set to the length in bytes of a row in the
- BltBuffer.
- EfiBltVideoToVideo - Copy from the video display rectangle
- (SourceX, SourceY) (SourceX + Width, SourceY + Height) .
- to the video display rectangle (DestinationX, DestinationY)
- (DestinationX + Width, DestinationY + Height).
- The BltBuffer and Delta are not used in this mode.
-
- Arguments:
- This - Protocol instance pointer.
- BltBuffer - Buffer containing data to blit into video buffer. This
- buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- BltOperation - Operation to perform on BlitBuffer and video memory
- SourceX - X coordinate of source for the BltBuffer.
- SourceY - Y coordinate of source for the BltBuffer.
- DestinationX - X coordinate of destination for the BltBuffer.
- DestinationY - Y coordinate of destination for the BltBuffer.
- Width - Width of rectangle in BltBuffer in pixels.
- Height - Hight of rectangle in BltBuffer in pixels.
- Delta -
-
- Returns:
- EFI_SUCCESS - The Blt operation completed.
- EFI_INVALID_PARAMETER - BltOperation is not valid.
- EFI_DEVICE_ERROR - A hardware error occured writting to the video
- buffer.
-
---*/
-{
- EFI_STATUS Status;
- TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- UINTN Index;
- EFI_STATUS ReturnStatus;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
-
- Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
-
- //
- // Sync up DevNull GOP device
- //
- ReturnStatus = DevNullGraphicsOutputBlt (
- Private,
- BltBuffer,
- BltOperation,
- SourceX,
- SourceY,
- DestinationX,
- DestinationY,
- Width,
- Height,
- Delta
- );
-
- if (Private->ConsoleOutputMode != EfiConsoleControlScreenGraphics) {
- return ReturnStatus;
- }
- //
- // return the worst status met
- //
- for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
- GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- BltBuffer,
- BltOperation,
- SourceX,
- SourceY,
- DestinationX,
- DestinationY,
- Width,
- Height,
- Delta
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- } else if (BltOperation == EfiBltVideoToBltBuffer) {
- //
- // Only need to read the data into buffer one time
- //
- return EFI_SUCCESS;
- }
- }
-
- UgaDraw = Private->TextOutList[Index].UgaDraw;
- if (UgaDraw != NULL) {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) BltBuffer,
- (EFI_UGA_BLT_OPERATION) BltOperation,
- SourceX,
- SourceY,
- DestinationX,
- DestinationY,
- Width,
- Height,
- Delta
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- } else if (BltOperation == EfiBltVideoToBltBuffer) {
- //
- // Only need to read the data into buffer one time
- //
- return EFI_SUCCESS;
- }
- }
- }
-
- return ReturnStatus;
-}
-
-EFI_STATUS
-DevNullGopSync (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
- IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
- )
-{
- if (GraphicsOutput != NULL) {
- return GraphicsOutput->Blt (
- GraphicsOutput,
- Private->GraphicsOutputBlt,
- EfiBltBufferToVideo,
- 0,
- 0,
- 0,
- 0,
- Private->GraphicsOutput.Mode->Info->HorizontalResolution,
- Private->GraphicsOutput.Mode->Info->VerticalResolution,
- 0
- );
- } else {
- return UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) Private->GraphicsOutputBlt,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- 0,
- 0,
- Private->GraphicsOutput.Mode->Info->HorizontalResolution,
- Private->GraphicsOutput.Mode->Info->VerticalResolution,
- 0
- );
- }
-}
-
-
-EFI_STATUS
-DevNullTextOutOutputString (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN CHAR16 *WString
- )
-/*++
-
- Routine Description:
- Write a Unicode string to the output device.
-
- Arguments:
- Private - Pointer to the console output splitter's private data. It
- indicates the calling context.
- WString - The NULL-terminated Unicode string to be displayed on the output
- device(s). All output devices must also support the Unicode
- drawing defined in this file.
-
- Returns:
- EFI_SUCCESS - The string was output to the device.
- EFI_DEVICE_ERROR - The device reported an error while attempting to
- output the text.
- EFI_UNSUPPORTED - The output device's mode is not currently in a
- defined text mode.
- EFI_WARN_UNKNOWN_GLYPH - This warning code indicates that some of the
- characters in the Unicode string could not be
- rendered and were skipped.
-
---*/
-{
- UINTN SizeScreen;
- UINTN SizeAttribute;
- UINTN Index;
- EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
- CHAR16 *Screen;
- CHAR16 *NullScreen;
- CHAR16 InsertChar;
- CHAR16 TempChar;
- CHAR16 *PStr;
- INT32 *Attribute;
- INT32 *NullAttributes;
- INT32 CurrentWidth;
- UINTN LastRow;
- UINTN MaxColumn;
-
- Mode = &Private->TextOutMode;
- NullScreen = Private->DevNullScreen;
- NullAttributes = Private->DevNullAttributes;
- LastRow = Private->DevNullRows - 1;
- MaxColumn = Private->DevNullColumns;
-
- if (Mode->Attribute & EFI_WIDE_ATTRIBUTE) {
- CurrentWidth = 2;
- } else {
- CurrentWidth = 1;
- }
-
- while (*WString) {
-
- if (*WString == CHAR_BACKSPACE) {
- //
- // If the cursor is at the left edge of the display, then move the cursor
- // one row up.
- //
- if (Mode->CursorColumn == 0 && Mode->CursorRow > 0) {
- Mode->CursorRow--;
- Mode->CursorColumn = (INT32) MaxColumn;
- }
-
- //
- // If the cursor is not at the left edge of the display,
- // then move the cursor left one column.
- //
- if (Mode->CursorColumn > 0) {
- Mode->CursorColumn--;
- if (Mode->CursorColumn > 0 &&
- NullAttributes[Mode->CursorRow * MaxColumn + Mode->CursorColumn - 1] & EFI_WIDE_ATTRIBUTE
- ) {
- Mode->CursorColumn--;
-
- //
- // Insert an extra backspace
- //
- InsertChar = CHAR_BACKSPACE;
- PStr = WString + 1;
- while (*PStr) {
- TempChar = *PStr;
- *PStr = InsertChar;
- InsertChar = TempChar;
- PStr++;
- }
-
- *PStr = InsertChar;
- *(++PStr) = 0;
-
- WString++;
- }
- }
-
- WString++;
-
- } else if (*WString == CHAR_LINEFEED) {
- //
- // If the cursor is at the bottom of the display,
- // then scroll the display one row, and do not update
- // the cursor position. Otherwise, move the cursor down one row.
- //
- if (Mode->CursorRow == (INT32) (LastRow)) {
- //
- // Scroll Screen Up One Row
- //
- SizeAttribute = LastRow * MaxColumn;
- CopyMem (
- NullAttributes,
- NullAttributes + MaxColumn,
- SizeAttribute * sizeof (INT32)
- );
-
- //
- // Each row has an ending CHAR_NULL. So one more character each line
- // for DevNullScreen than DevNullAttributes
- //
- SizeScreen = SizeAttribute + LastRow;
- CopyMem (
- NullScreen,
- NullScreen + (MaxColumn + 1),
- SizeScreen * sizeof (CHAR16)
- );
-
- //
- // Print Blank Line at last line
- //
- Screen = NullScreen + SizeScreen;
- Attribute = NullAttributes + SizeAttribute;
-
- for (Index = 0; Index < MaxColumn; Index++, Screen++, Attribute++) {
- *Screen = ' ';
- *Attribute = Mode->Attribute;
- }
- } else {
- Mode->CursorRow++;
- }
-
- WString++;
- } else if (*WString == CHAR_CARRIAGE_RETURN) {
- //
- // Move the cursor to the beginning of the current row.
- //
- Mode->CursorColumn = 0;
- WString++;
- } else {
- //
- // Print the character at the current cursor position and
- // move the cursor right one column. If this moves the cursor
- // past the right edge of the display, then the line should wrap to
- // the beginning of the next line. This is equivalent to inserting
- // a CR and an LF. Note that if the cursor is at the bottom of the
- // display, and the line wraps, then the display will be scrolled
- // one line.
- //
- Index = Mode->CursorRow * MaxColumn + Mode->CursorColumn;
-
- while (Mode->CursorColumn < (INT32) MaxColumn) {
- if (*WString == CHAR_NULL) {
- break;
- }
-
- if (*WString == CHAR_BACKSPACE) {
- break;
- }
-
- if (*WString == CHAR_LINEFEED) {
- break;
- }
-
- if (*WString == CHAR_CARRIAGE_RETURN) {
- break;
- }
-
- if (*WString == WIDE_CHAR || *WString == NARROW_CHAR) {
- CurrentWidth = (*WString == WIDE_CHAR) ? 2 : 1;
- WString++;
- continue;
- }
-
- if (Mode->CursorColumn + CurrentWidth > (INT32) MaxColumn) {
- //
- // If a wide char is at the rightmost column, then move the char
- // to the beginning of the next row
- //
- NullScreen[Index + Mode->CursorRow] = L' ';
- NullAttributes[Index] = Mode->Attribute | (UINT32) EFI_WIDE_ATTRIBUTE;
- Index++;
- Mode->CursorColumn++;
- } else {
- NullScreen[Index + Mode->CursorRow] = *WString;
- NullAttributes[Index] = Mode->Attribute;
- if (CurrentWidth == 1) {
- NullAttributes[Index] &= (~ (UINT32) EFI_WIDE_ATTRIBUTE);
- } else {
- NullAttributes[Index] |= (UINT32) EFI_WIDE_ATTRIBUTE;
- NullAttributes[Index + 1] &= (~ (UINT32) EFI_WIDE_ATTRIBUTE);
- }
-
- Index += CurrentWidth;
- WString++;
- Mode->CursorColumn += CurrentWidth;
- }
- }
- //
- // At the end of line, output carriage return and line feed
- //
- if (Mode->CursorColumn >= (INT32) MaxColumn) {
- DevNullTextOutOutputString (Private, mCrLfString);
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DevNullTextOutSetMode (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN UINTN ModeNumber
- )
-/*++
-
- Routine Description:
- Sets the output device(s) to a specified mode.
-
- Arguments:
- Private - Private data structure pointer.
- ModeNumber - The mode number to set.
-
- Returns:
- EFI_SUCCESS - The requested text mode was set.
- EFI_DEVICE_ERROR - The device had an error and
- could not complete the request.
- EFI_UNSUPPORTED - The mode number was not valid.
- EFI_OUT_OF_RESOURCES - Out of resources.
-
---*/
-{
- UINTN Size;
- UINTN Row;
- UINTN Column;
- TEXT_OUT_SPLITTER_QUERY_DATA *Mode;
-
- //
- // No extra check for ModeNumber here, as it has been checked in
- // ConSplitterTextOutSetMode. And mode 0 should always be supported.
- //
- Mode = &(Private->TextOutQueryData[ModeNumber]);
- Row = Mode->Rows;
- Column = Mode->Columns;
-
- if (Row <= 0 && Column <= 0) {
- return EFI_UNSUPPORTED;
- }
-
- if (Private->DevNullColumns != Column || Private->DevNullRows != Row) {
-
- Private->TextOutMode.Mode = (INT32) ModeNumber;
- Private->DevNullColumns = Column;
- Private->DevNullRows = Row;
-
- if (Private->DevNullScreen != NULL) {
- FreePool (Private->DevNullScreen);
- }
-
- Size = (Row * (Column + 1)) * sizeof (CHAR16);
- Private->DevNullScreen = AllocateZeroPool (Size);
- if (Private->DevNullScreen == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (Private->DevNullAttributes != NULL) {
- FreePool (Private->DevNullAttributes);
- }
-
- Size = Row * Column * sizeof (INT32);
- Private->DevNullAttributes = AllocateZeroPool (Size);
- if (Private->DevNullAttributes == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- }
-
- DevNullTextOutClearScreen (Private);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DevNullTextOutClearScreen (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
- )
-/*++
-
- Routine Description:
- Clears the output device(s) display to the currently selected background
- color.
-
- Arguments:
- Private - Protocol instance pointer.
-
- Returns:
- EFI_SUCCESS - The operation completed successfully.
- EFI_DEVICE_ERROR - The device had an error and
- could not complete the request.
- EFI_UNSUPPORTED - The output device is not in a valid text mode.
-
---*/
-{
- UINTN Row;
- UINTN Column;
- CHAR16 *Screen;
- INT32 *Attributes;
- INT32 CurrentAttribute;
-
- //
- // Clear the DevNull Text Out Buffers.
- // The screen is filled with spaces.
- // The attributes are all synced with the current Simple Text Out Attribute
- //
- Screen = Private->DevNullScreen;
- Attributes = Private->DevNullAttributes;
- CurrentAttribute = Private->TextOutMode.Attribute;
-
- for (Row = 0; Row < Private->DevNullRows; Row++) {
- for (Column = 0; Column < Private->DevNullColumns; Column++, Screen++, Attributes++) {
- *Screen = ' ';
- *Attributes = CurrentAttribute;
- }
- //
- // Each line of the screen has a NULL on the end so we must skip over it
- //
- Screen++;
- }
-
- DevNullTextOutSetCursorPosition (Private, 0, 0);
-
- return DevNullTextOutEnableCursor (Private, TRUE);
-}
-
-EFI_STATUS
-DevNullTextOutSetCursorPosition (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN UINTN Column,
- IN UINTN Row
- )
-/*++
-
- Routine Description:
- Sets the current coordinates of the cursor position
-
- Arguments:
- Private - Protocol instance pointer.
- Column, Row - the position to set the cursor to. Must be greater than or
- equal to zero and less than the number of columns and rows
- by QueryMode ().
-
- Returns:
- EFI_SUCCESS - The operation completed successfully.
- EFI_DEVICE_ERROR - The device had an error and
- could not complete the request.
- EFI_UNSUPPORTED - The output device is not in a valid text mode, or the
- cursor position is invalid for the current mode.
-
---*/
-{
- //
- // No need to do extra check here as whether (Column, Row) is valid has
- // been checked in ConSplitterTextOutSetCursorPosition. And (0, 0) should
- // always be supported.
- //
- Private->TextOutMode.CursorColumn = (INT32) Column;
- Private->TextOutMode.CursorRow = (INT32) Row;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DevNullTextOutEnableCursor (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
- IN BOOLEAN Visible
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.EnableCursor().
- In this driver, the cursor cannot be hidden.
-
- Arguments:
-
- Private - Indicates the calling context.
-
- Visible - If TRUE, the cursor is set to be visible, If FALSE, the cursor
- is set to be invisible.
-
- Returns:
-
- EFI_SUCCESS - The request is valid.
-
-
---*/
-{
- Private->TextOutMode.CursorVisible = Visible;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-DevNullSyncGopStdOut (
- IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private
- )
-/*++
- Routine Description:
- Take the DevNull TextOut device and update the Simple Text Out on every
- UGA device.
-
- Arguments:
- Private - Indicates the calling context.
-
- Returns:
- EFI_SUCCESS - The request is valid.
- other - Return status of TextOut->OutputString ()
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS ReturnStatus;
- UINTN Row;
- UINTN Column;
- UINTN List;
- UINTN MaxColumn;
- UINTN CurrentColumn;
- UINTN StartRow;
- UINTN StartColumn;
- INT32 StartAttribute;
- BOOLEAN StartCursorState;
- CHAR16 *Screen;
- CHAR16 *Str;
- CHAR16 *Buffer;
- CHAR16 *BufferTail;
- CHAR16 *ScreenStart;
- INT32 CurrentAttribute;
- INT32 *Attributes;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto;
-
- //
- // Save the devices Attributes, Cursor enable state and location
- //
- StartColumn = Private->TextOutMode.CursorColumn;
- StartRow = Private->TextOutMode.CursorRow;
- StartAttribute = Private->TextOutMode.Attribute;
- StartCursorState = Private->TextOutMode.CursorVisible;
-
- for (List = 0; List < Private->CurrentNumberOfConsoles; List++) {
-
- Sto = Private->TextOutList[List].TextOut;
-
- //
- // Skip non GOP/UGA devices
- //
- if ((Private->TextOutList[List].GraphicsOutput != NULL) || (Private->TextOutList[List].UgaDraw != NULL)) {
- Sto->EnableCursor (Sto, FALSE);
- Sto->ClearScreen (Sto);
- }
- }
-
- ReturnStatus = EFI_SUCCESS;
- Screen = Private->DevNullScreen;
- Attributes = Private->DevNullAttributes;
- MaxColumn = Private->DevNullColumns;
-
- Buffer = AllocateZeroPool ((MaxColumn + 1) * sizeof (CHAR16));
-
- for (Row = 0; Row < Private->DevNullRows; Row++, Screen += (MaxColumn + 1), Attributes += MaxColumn) {
-
- if (Row == (Private->DevNullRows - 1)) {
- //
- // Don't ever sync the last character as it will scroll the screen
- //
- Screen[MaxColumn - 1] = 0x00;
- }
-
- Column = 0;
- while (Column < MaxColumn) {
- if (Screen[Column]) {
- CurrentAttribute = Attributes[Column];
- CurrentColumn = Column;
- ScreenStart = &Screen[Column];
-
- //
- // the line end is alway 0x0. So Column should be less than MaxColumn
- // It should be still in the same row
- //
- for (Str = ScreenStart, BufferTail = Buffer; *Str != 0; Str++, Column++) {
-
- if (Attributes[Column] != CurrentAttribute) {
- Column--;
- break;
- }
-
- *BufferTail = *Str;
- BufferTail++;
- if (Attributes[Column] & EFI_WIDE_ATTRIBUTE) {
- Str++;
- Column++;
- }
- }
-
- *BufferTail = 0;
-
- for (List = 0; List < Private->CurrentNumberOfConsoles; List++) {
-
- Sto = Private->TextOutList[List].TextOut;
-
- //
- // Skip non GOP/UGA devices
- //
- if ((Private->TextOutList[List].GraphicsOutput != NULL) || (Private->TextOutList[List].UgaDraw != NULL)) {
- Sto->SetAttribute (Sto, CurrentAttribute);
- Sto->SetCursorPosition (Sto, CurrentColumn, Row);
- Status = Sto->OutputString (Sto, Buffer);
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
-
- }
-
- Column++;
- }
- }
- //
- // Restore the devices Attributes, Cursor enable state and location
- //
- for (List = 0; List < Private->CurrentNumberOfConsoles; List++) {
- Sto = Private->TextOutList[List].TextOut;
-
- //
- // Skip non GOP/UGA devices
- //
- if ((Private->TextOutList[List].GraphicsOutput != NULL) || (Private->TextOutList[List].UgaDraw != NULL)) {
- Sto->SetAttribute (Sto, StartAttribute);
- Sto->SetCursorPosition (Sto, StartColumn, StartRow);
- Status = Sto->EnableCursor (Sto, StartCursorState);
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
- }
- }
-
- FreePool (Buffer);
-
- return ReturnStatus;
-}
diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/ComponentName.c b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/ComponentName.c
deleted file mode 100644
index 5c615ba..0000000
--- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/ComponentName.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "GraphicsConsole.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName = {
- GraphicsConsoleComponentNameGetDriverName,
- GraphicsConsoleComponentNameGetControllerName,
- "eng"
-};
-
-STATIC EFI_UNICODE_STRING_TABLE mGraphicsConsoleDriverNameTable[] = {
- {
- "eng",
- (CHAR16 *)L"UGA Console Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gGraphicsConsoleComponentName.SupportedLanguages,
- mGraphicsConsoleDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/ComponentName.h b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/ComponentName.h
deleted file mode 100644
index c5999b6..0000000
--- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/ComponentName.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.h
-
-Abstract:
-
-
-Revision History
-
---*/
-
-#ifndef _GRAPHICS_CONSOLE_COMPONENT_NAME_H
-#define _GRAPHICS_CONSOLE_COMPONENT_NAME_H
-
-extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName;
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-GraphicsConsoleComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-;
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c
deleted file mode 100644
index 21cf9db..0000000
--- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c
+++ /dev/null
@@ -1,1821 +0,0 @@
-/**@file
- This is the main routine for initializing the Graphics Console support routines.
-Remaining Tasks
- Add all standard Glyphs from EFI 1.02 Specification
- Implement optimal automatic Mode creation algorithm
- Solve palette issues for mixed graphics and text
- When does this protocol reset the palette?
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "GraphicsConsole.h"
-
-STATIC
-EFI_STATUS
-GetTextColors (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
- OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background
- );
-
-STATIC
-EFI_STATUS
-DrawUnicodeWeightAtCursorN (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *UnicodeWeight,
- IN UINTN Count
- );
-
-STATIC
-EFI_STATUS
-EraseCursor (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
- );
-
-//
-// Globals
-//
-GRAPHICS_CONSOLE_DEV mGraphicsConsoleDevTemplate = {
- GRAPHICS_CONSOLE_DEV_SIGNATURE,
- (EFI_GRAPHICS_OUTPUT_PROTOCOL *) NULL,
- (EFI_UGA_DRAW_PROTOCOL *) NULL,
- {
- GraphicsConsoleConOutReset,
- GraphicsConsoleConOutOutputString,
- GraphicsConsoleConOutTestString,
- GraphicsConsoleConOutQueryMode,
- GraphicsConsoleConOutSetMode,
- GraphicsConsoleConOutSetAttribute,
- GraphicsConsoleConOutClearScreen,
- GraphicsConsoleConOutSetCursorPosition,
- GraphicsConsoleConOutEnableCursor,
- (EFI_SIMPLE_TEXT_OUTPUT_MODE *) NULL
- },
- {
- 0,
- 0,
- EFI_TEXT_ATTR(EFI_LIGHTGRAY, EFI_BLACK),
- 0,
- 0,
- TRUE
- },
- {
- { 80, 25, 0, 0, 0, 0 }, // Mode 0
- { 80, 50, 0, 0, 0, 0 }, // Mode 1
- { 0, 0, 0, 0, 0, 0 } // Mode 2
- },
- (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) NULL,
- (EFI_HII_HANDLE) 0
-};
-
-EFI_HII_PROTOCOL *mHii;
-
-static CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };
-
-static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
- //
- // B G R
- //
- {0x00, 0x00, 0x00, 0x00}, // BLACK
- {0x98, 0x00, 0x00, 0x00}, // BLUE
- {0x00, 0x98, 0x00, 0x00}, // GREEN
- {0x98, 0x98, 0x00, 0x00}, // CYAN
- {0x00, 0x00, 0x98, 0x00}, // RED
- {0x98, 0x00, 0x98, 0x00}, // MAGENTA
- {0x00, 0x98, 0x98, 0x00}, // BROWN
- {0x98, 0x98, 0x98, 0x00}, // LIGHTGRAY
- {0x30, 0x30, 0x30, 0x00}, // DARKGRAY - BRIGHT BLACK
- {0xff, 0x00, 0x00, 0x00}, // LIGHTBLUE - ?
- {0x00, 0xff, 0x00, 0x00}, // LIGHTGREEN - ?
- {0xff, 0xff, 0x00, 0x00}, // LIGHTCYAN
- {0x00, 0x00, 0xff, 0x00}, // LIGHTRED
- {0xff, 0x00, 0xff, 0x00}, // LIGHTMAGENTA
- {0x00, 0xff, 0xff, 0x00}, // LIGHTBROWN
- {0xff, 0xff, 0xff, 0x00} // WHITE
-};
-
-static EFI_NARROW_GLYPH mCursorGlyph = {
- 0x0000,
- 0x00,
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF }
-};
-
-EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding = {
- GraphicsConsoleControllerDriverSupported,
- GraphicsConsoleControllerDriverStart,
- GraphicsConsoleControllerDriverStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleControllerDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- UgaDraw = NULL;
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **) &GraphicsOutput,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- GraphicsOutput = NULL;
- //
- // Open Graphics Output Protocol failed, try to open UGA Draw Protocol
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- //
- // We need to ensure that we do not layer on top of a virtual handle.
- // We need to ensure that the handles produced by the conspliter do not
- // get used.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (!EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- goto Error;
- }
- //
- // Does Hii Exist? If not, we aren't ready to run
- //
- Status = EfiLocateHiiProtocol ();
-
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
-Error:
- if (GraphicsOutput != NULL) {
- gBS->CloseProtocol (
- Controller,
- &gEfiGraphicsOutputProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleControllerDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
-
- Start the controller.
-
- Arguments:
-
- This - A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- Controller - The handle of the controller to start.
- RemainingDevicePath - A pointer to the remaining portion of a devcie path.
-
- Returns:
-
- EFI_SUCCESS - Return successfully.
- EFI_OUT_OF_RESOURCES - Out of resources.
-
---*/
-{
- EFI_STATUS Status;
- GRAPHICS_CONSOLE_DEV *Private;
- EFI_HII_PACKAGES *Package;
- EFI_HII_FONT_PACK *FontPack;
- UINTN NarrowFontSize;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- UINTN MaxMode;
- UINTN Columns;
- UINTN Rows;
- UINT8 *Location;
- UINT32 ModeNumber;
- UINTN SizeOfInfo;
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
-
- ModeNumber = 0;
-
- //
- // Initialize the Graphics Console device instance
- //
- Private = AllocateCopyPool (
- sizeof (GRAPHICS_CONSOLE_DEV),
- &mGraphicsConsoleDevTemplate
- );
- if (Private == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Private->SimpleTextOutput.Mode = &(Private->SimpleTextOutputMode);
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **) &Private->GraphicsOutput,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR(Status)) {
- Private->GraphicsOutput = NULL;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &Private->UgaDraw,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
- }
-
- //
- // Get the HII protocol. If Supported() succeeds, do we really
- // need to get HII protocol again?
- //
- Status = EfiLocateHiiProtocol ();
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- NarrowFontSize = ReturnNarrowFontSize ();
-
- FontPack = AllocateZeroPool (sizeof (EFI_HII_FONT_PACK) + NarrowFontSize);
- ASSERT (FontPack);
-
- FontPack->Header.Length = (UINT32) (sizeof (EFI_HII_FONT_PACK) + NarrowFontSize);
- FontPack->Header.Type = EFI_HII_FONT;
- FontPack->NumberOfNarrowGlyphs = (UINT16) (NarrowFontSize / sizeof (EFI_NARROW_GLYPH));
-
- Location = (UINT8 *) (&FontPack->NumberOfWideGlyphs + sizeof (UINT8));
- CopyMem (Location, UsStdNarrowGlyphData, NarrowFontSize);
-
- //
- // Register our Fonts into the global database
- //
- Package = PreparePackages (1, NULL, FontPack);
- mHii->NewPack (mHii, Package, &(Private->HiiHandle));
- FreePool (Package);
-
- //
- // Free the font database
- //
- FreePool (FontPack);
-
- //
- // If the current mode information can not be retrieved, then attemp to set the default mode
- // of 800x600, 32 bit colot, 60 Hz refresh.
- //
- HorizontalResolution = 800;
- VerticalResolution = 600;
-
- if (Private->GraphicsOutput != NULL) {
- //
- // The console is build on top of Graphics Output Protocol, find the mode number for 800x600
- //
- for (ModeNumber = 0; ModeNumber < Private->GraphicsOutput->Mode->MaxMode; ModeNumber++) {
- Status = Private->GraphicsOutput->QueryMode (
- Private->GraphicsOutput,
- ModeNumber,
- &SizeOfInfo,
- &Info
- );
- if (!EFI_ERROR (Status)) {
- if ((Info->HorizontalResolution == 800) &&
- (Info->VerticalResolution == 600)) {
- Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber);
- if (!EFI_ERROR (Status)) {
- FreePool (Info);
- break;
- }
- }
- FreePool (Info);
- }
- }
-
- if (EFI_ERROR (Status) || (ModeNumber == Private->GraphicsOutput->Mode->MaxMode)) {
- //
- // Set default mode failed or device don't support default mode, then get the current mode information
- //
- HorizontalResolution = Private->GraphicsOutput->Mode->Info->HorizontalResolution;
- VerticalResolution = Private->GraphicsOutput->Mode->Info->VerticalResolution;
- ModeNumber = Private->GraphicsOutput->Mode->Mode;
- }
- } else {
- //
- // The console is build on top of UGA Draw Protocol
- //
- ColorDepth = 32;
- RefreshRate = 60;
- Status = Private->UgaDraw->SetMode (
- Private->UgaDraw,
- HorizontalResolution,
- VerticalResolution,
- ColorDepth,
- RefreshRate
- );
- if (EFI_ERROR (Status)) {
- //
- // Get the current mode information from the UGA Draw Protocol
- //
- Status = Private->UgaDraw->GetMode (
- Private->UgaDraw,
- &HorizontalResolution,
- &VerticalResolution,
- &ColorDepth,
- &RefreshRate
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
- }
- }
-
- //
- // Compute the maximum number of text Rows and Columns that this current graphics mode can support
- //
- Columns = HorizontalResolution / GLYPH_WIDTH;
- Rows = VerticalResolution / GLYPH_HEIGHT;
-
- //
- // See if the mode is too small to support the required 80x25 text mode
- //
- if (Columns < 80 || Rows < 25) {
- goto Error;
- }
- //
- // Add Mode #0 that must be 80x25
- //
- MaxMode = 0;
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;
- Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * GLYPH_WIDTH)) >> 1;
- Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (25 * GLYPH_HEIGHT)) >> 1;
- MaxMode++;
-
- //
- // If it is possible to support Mode #1 - 80x50, than add it as an active mode
- //
- if (Rows >= 50) {
- Private->ModeData[MaxMode].GopWidth = HorizontalResolution;
- Private->ModeData[MaxMode].GopHeight = VerticalResolution;
- Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = (HorizontalResolution - (80 * GLYPH_WIDTH)) >> 1;
- Private->ModeData[MaxMode].DeltaY = (VerticalResolution - (50 * GLYPH_HEIGHT)) >> 1;
- MaxMode++;
- }
- //
- // If the graphics mode is 800x600, than add a text mode that uses the entire display
- //
- if (HorizontalResolution == 800 && VerticalResolution == 600) {
-
- if (MaxMode < 2) {
- Private->ModeData[MaxMode].Columns = 0;
- Private->ModeData[MaxMode].Rows = 0;
- Private->ModeData[MaxMode].GopWidth = 800;
- Private->ModeData[MaxMode].GopHeight = 600;
- Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = 0;
- Private->ModeData[MaxMode].DeltaY = 0;
- MaxMode++;
- }
-
- Private->ModeData[MaxMode].Columns = 800 / GLYPH_WIDTH;
- Private->ModeData[MaxMode].Rows = 600 / GLYPH_HEIGHT;
- Private->ModeData[MaxMode].GopWidth = 800;
- Private->ModeData[MaxMode].GopHeight = 600;
- Private->ModeData[MaxMode].GopModeNumber = ModeNumber;
- Private->ModeData[MaxMode].DeltaX = (800 % GLYPH_WIDTH) >> 1;
- Private->ModeData[MaxMode].DeltaY = (600 % GLYPH_HEIGHT) >> 1;
- MaxMode++;
- }
- //
- // Update the maximum number of modes
- //
- Private->SimpleTextOutputMode.MaxMode = (INT32) MaxMode;
-
- //
- // Determine the number of text modes that this protocol can support
- //
- Status = GraphicsConsoleConOutSetMode (&Private->SimpleTextOutput, 0);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- DEBUG_CODE_BEGIN ();
- GraphicsConsoleConOutOutputString (&Private->SimpleTextOutput, (CHAR16 *)L"Graphics Console Started\n\r");
- DEBUG_CODE_END ();
-
- //
- // Install protocol interfaces for the Graphics Console device.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Controller,
- &gEfiSimpleTextOutProtocolGuid,
- &Private->SimpleTextOutput,
- NULL
- );
-
-Error:
- if (EFI_ERROR (Status)) {
- //
- // Close the GOP or UGA IO Protocol
- //
- if (Private->GraphicsOutput != NULL) {
- gBS->CloseProtocol (
- Controller,
- &gEfiGraphicsOutputProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- //
- // Free private data
- //
- if (Private != NULL) {
- if (Private->LineBuffer != NULL) {
- FreePool (Private->LineBuffer);
- }
- FreePool (Private);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleControllerDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *SimpleTextOutput;
- GRAPHICS_CONSOLE_DEV *Private;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &SimpleTextOutput,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_STARTED;
- }
-
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (SimpleTextOutput);
-
- Status = gBS->UninstallProtocolInterface (
- Controller,
- &gEfiSimpleTextOutProtocolGuid,
- &Private->SimpleTextOutput
- );
-
- if (!EFI_ERROR (Status)) {
- //
- // Close the GOP or UGA IO Protocol
- //
- if (Private->GraphicsOutput != NULL) {
- gBS->CloseProtocol (
- Controller,
- &gEfiGraphicsOutputProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiUgaDrawProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- //
- // Remove the font pack
- //
- mHii->RemovePack (mHii, Private->HiiHandle);
-
- //
- // Free our instance data
- //
- if (Private != NULL) {
- FreePool (Private->LineBuffer);
- FreePool (Private);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EfiLocateHiiProtocol (
- VOID
- )
-/*++
-
- Routine Description:
- Find if the HII protocol is available. If yes, locate the HII protocol
-
- Arguments:
-
- Returns:
-
---*/
-{
- EFI_HANDLE Handle;
- UINTN Size;
- EFI_STATUS Status;
-
- //
- // There should only be one - so buffer size is this
- //
- Size = sizeof (EFI_HANDLE);
-
- Status = gBS->LocateHandle (
- ByProtocol,
- &gEfiHiiProtocolGuid,
- NULL,
- &Size,
- &Handle
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiHiiProtocolGuid,
- (VOID **)&mHii
- );
-
- return Status;
-}
-//
-// Body of the STO functions
-//
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutReset (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.Reset().
- If ExtendeVerification is TRUE, then perform dependent Graphics Console
- device reset, and set display mode to mode 0.
- If ExtendedVerification is FALSE, only set display mode to mode 0.
-
- Arguments:
-
- This - Indicates the calling context.
-
- ExtendedVerification - Indicates that the driver may perform a more exhaustive
- verification operation of the device during reset.
-
- Returns:
-
- EFI_SUCCESS
- The reset operation succeeds.
-
- EFI_DEVICE_ERROR
- The Graphics Console is not functioning correctly
-
---*/
-{
- This->SetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BACKGROUND_BLACK));
- return This->SetMode (This, 0);
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutOutputString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.OutputString().
- The Unicode string will be converted to Glyphs and will be
- sent to the Graphics Console.
-
-
- Arguments:
-
- This - Indicates the calling context.
-
- WString - The Null-terminated Unicode string to be displayed on
- the Graphics Console.
-
- Returns:
-
- EFI_SUCCESS
- The string is output successfully.
-
- EFI_DEVICE_ERROR
- The Graphics Console failed to send the string out.
-
- EFI_WARN_UNKNOWN_GLYPH
- Indicates that some of the characters in the Unicode string could not
- be rendered and are skipped.
-
---*/
-{
- GRAPHICS_CONSOLE_DEV *Private;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- INTN Mode;
- UINTN MaxColumn;
- UINTN MaxRow;
- UINTN Width;
- UINTN Height;
- UINTN Delta;
- EFI_STATUS Status;
- BOOLEAN Warning;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- UINTN DeltaX;
- UINTN DeltaY;
- UINTN Count;
- UINTN Index;
- INT32 OriginAttribute;
- EFI_TPL OldTpl;
- CHAR16 SpaceStr[] = { NARROW_CHAR, ' ', 0 };
-
- Status = EFI_SUCCESS;
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
- //
- // Current mode
- //
- Mode = This->Mode->Mode;
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
- GraphicsOutput = Private->GraphicsOutput;
- UgaDraw = Private->UgaDraw;
-
- MaxColumn = Private->ModeData[Mode].Columns;
- MaxRow = Private->ModeData[Mode].Rows;
- DeltaX = Private->ModeData[Mode].DeltaX;
- DeltaY = Private->ModeData[Mode].DeltaY;
- Width = MaxColumn * GLYPH_WIDTH;
- Height = (MaxRow - 1) * GLYPH_HEIGHT;
- Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
-
- //
- // The Attributes won't change when during the time OutputString is called
- //
- GetTextColors (This, &Foreground, &Background);
-
- EraseCursor (This);
-
- Warning = FALSE;
-
- //
- // Backup attribute
- //
- OriginAttribute = This->Mode->Attribute;
-
- while (*WString) {
-
- if (*WString == CHAR_BACKSPACE) {
- //
- // If the cursor is at the left edge of the display, then move the cursor
- // one row up.
- //
- if (This->Mode->CursorColumn == 0 && This->Mode->CursorRow > 0) {
- This->Mode->CursorRow--;
- This->Mode->CursorColumn = (INT32) (MaxColumn - 1);
- This->OutputString (This, SpaceStr);
- EraseCursor (This);
- This->Mode->CursorRow--;
- This->Mode->CursorColumn = (INT32) (MaxColumn - 1);
- } else if (This->Mode->CursorColumn > 0) {
- //
- // If the cursor is not at the left edge of the display, then move the cursor
- // left one column.
- //
- This->Mode->CursorColumn--;
- This->OutputString (This, SpaceStr);
- EraseCursor (This);
- This->Mode->CursorColumn--;
- }
-
- WString++;
-
- } else if (*WString == CHAR_LINEFEED) {
- //
- // If the cursor is at the bottom of the display, then scroll the display one
- // row, and do not update the cursor position. Otherwise, move the cursor
- // down one row.
- //
- if (This->Mode->CursorRow == (INT32) (MaxRow - 1)) {
- if (GraphicsOutput != NULL) {
- //
- // Scroll Screen Up One Row
- //
- GraphicsOutput->Blt (
- GraphicsOutput,
- NULL,
- EfiBltVideoToVideo,
- DeltaX,
- DeltaY + GLYPH_HEIGHT,
- DeltaX,
- DeltaY,
- Width,
- Height,
- Delta
- );
-
- //
- // Print Blank Line at last line
- //
- GraphicsOutput->Blt (
- GraphicsOutput,
- &Background,
- EfiBltVideoFill,
- 0,
- 0,
- DeltaX,
- DeltaY + Height,
- Width,
- GLYPH_HEIGHT,
- Delta
- );
- } else {
- //
- // Scroll Screen Up One Row
- //
- UgaDraw->Blt (
- UgaDraw,
- NULL,
- EfiUgaVideoToVideo,
- DeltaX,
- DeltaY + GLYPH_HEIGHT,
- DeltaX,
- DeltaY,
- Width,
- Height,
- Delta
- );
-
- //
- // Print Blank Line at last line
- //
- UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) &Background,
- EfiUgaVideoFill,
- 0,
- 0,
- DeltaX,
- DeltaY + Height,
- Width,
- GLYPH_HEIGHT,
- Delta
- );
- }
- } else {
- This->Mode->CursorRow++;
- }
-
- WString++;
-
- } else if (*WString == CHAR_CARRIAGE_RETURN) {
- //
- // Move the cursor to the beginning of the current row.
- //
- This->Mode->CursorColumn = 0;
- WString++;
-
- } else if (*WString == WIDE_CHAR) {
-
- This->Mode->Attribute |= EFI_WIDE_ATTRIBUTE;
- WString++;
-
- } else if (*WString == NARROW_CHAR) {
-
- This->Mode->Attribute &= (~ (UINT32) EFI_WIDE_ATTRIBUTE);
- WString++;
-
- } else {
- //
- // Print the character at the current cursor position and move the cursor
- // right one column. If this moves the cursor past the right edge of the
- // display, then the line should wrap to the beginning of the next line. This
- // is equivalent to inserting a CR and an LF. Note that if the cursor is at the
- // bottom of the display, and the line wraps, then the display will be scrolled
- // one line.
- // If wide char is going to be displayed, need to display one character at a time
- // Or, need to know the display length of a certain string.
- //
- // Index is used to determine how many character width units (wide = 2, narrow = 1)
- // Count is used to determine how many characters are used regardless of their attributes
- //
- for (Count = 0, Index = 0; (This->Mode->CursorColumn + Index) < MaxColumn; Count++, Index++) {
- if (WString[Count] == CHAR_NULL) {
- break;
- }
-
- if (WString[Count] == CHAR_BACKSPACE) {
- break;
- }
-
- if (WString[Count] == CHAR_LINEFEED) {
- break;
- }
-
- if (WString[Count] == CHAR_CARRIAGE_RETURN) {
- break;
- }
-
- if (WString[Count] == WIDE_CHAR) {
- break;
- }
-
- if (WString[Count] == NARROW_CHAR) {
- break;
- }
- //
- // Is the wide attribute on?
- //
- if (This->Mode->Attribute & EFI_WIDE_ATTRIBUTE) {
- //
- // If wide, add one more width unit than normal since we are going to increment at the end of the for loop
- //
- Index++;
- //
- // This is the end-case where if we are at column 79 and about to print a wide character
- // We should prevent this from happening because we will wrap inappropriately. We should
- // not print this character until the next line.
- //
- if ((This->Mode->CursorColumn + Index + 1) > MaxColumn) {
- Index++;
- break;
- }
- }
- }
-
- Status = DrawUnicodeWeightAtCursorN (This, WString, Count);
- if (EFI_ERROR (Status)) {
- Warning = TRUE;
- }
- //
- // At the end of line, output carriage return and line feed
- //
- WString += Count;
- This->Mode->CursorColumn += (INT32) Index;
- if (This->Mode->CursorColumn > (INT32) MaxColumn) {
- This->Mode->CursorColumn -= 2;
- This->OutputString (This, SpaceStr);
- }
-
- if (This->Mode->CursorColumn >= (INT32) MaxColumn) {
- EraseCursor (This);
- This->OutputString (This, mCrLfString);
- EraseCursor (This);
- }
- }
- }
-
- This->Mode->Attribute = OriginAttribute;
-
- EraseCursor (This);
-
- if (Warning) {
- Status = EFI_WARN_UNKNOWN_GLYPH;
- }
-
- gBS->RestoreTPL (OldTpl);
- return Status;
-
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutTestString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.TestString().
- If one of the characters in the *Wstring is
- neither valid valid Unicode drawing characters,
- not ASCII code, then this function will return
- EFI_UNSUPPORTED.
-
-
- Arguments:
-
- This - Indicates the calling context.
-
- WString - The Null-terminated Unicode string to be tested.
-
- Returns:
-
- EFI_SUCCESS
- The Graphics Console is capable of rendering the output string.
-
- EFI_UNSUPPORTED
- Some of the characters in the Unicode string cannot be rendered.
-
---*/
-{
- EFI_STATUS Status;
- UINT16 GlyphWidth;
- UINT32 GlyphStatus;
- UINT16 Count;
- GLYPH_UNION *Glyph;
-
- GlyphStatus = 0;
- Count = 0;
-
- while (WString[Count]) {
- Status = mHii->GetGlyph (
- mHii,
- WString,
- &Count,
- (UINT8 **) &Glyph,
- &GlyphWidth,
- &GlyphStatus
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.QueryMode().
- It returnes information for an available text mode
- that the Graphics Console supports.
- In this driver,we only support text mode 80x25, which is
- defined as mode 0.
-
-
- Arguments:
-
- This - Indicates the calling context.
-
- ModeNumber - The mode number to return information on.
-
- Columns - The returned columns of the requested mode.
-
- Rows - The returned rows of the requested mode.
-
- Returns:
-
- EFI_SUCCESS
- The requested mode information is returned.
-
- EFI_UNSUPPORTED
- The mode number is not valid.
-
---*/
-{
- GRAPHICS_CONSOLE_DEV *Private;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
- return EFI_UNSUPPORTED;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
- Status = EFI_SUCCESS;
-
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
-
- *Columns = Private->ModeData[ModeNumber].Columns;
- *Rows = Private->ModeData[ModeNumber].Rows;
-
- if (*Columns <= 0 && *Rows <= 0) {
- Status = EFI_UNSUPPORTED;
- goto Done;
-
- }
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutSetMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.SetMode().
- Set the Graphics Console to a specified mode.
- In this driver, we only support mode 0.
-
- Arguments:
-
- This - Indicates the calling context.
-
- ModeNumber - The text mode to set.
-
- Returns:
-
- EFI_SUCCESS
- The requested text mode is set.
-
- EFI_DEVICE_ERROR
- The requested text mode cannot be set because of Graphics Console device error.
-
- EFI_UNSUPPORTED
- The text mode number is not valid.
-
---*/
-{
- EFI_STATUS Status;
- GRAPHICS_CONSOLE_DEV *Private;
- GRAPHICS_CONSOLE_MODE_DATA *ModeData;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewLineBuffer;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
- GraphicsOutput = Private->GraphicsOutput;
- UgaDraw = Private->UgaDraw;
- ModeData = &(Private->ModeData[ModeNumber]);
-
- if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- //
- // Make sure the requested mode number is supported
- //
- if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (ModeData->Columns <= 0 && ModeData->Rows <= 0) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
- //
- // Attempt to allocate a line buffer for the requested mode number
- //
- NewLineBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->Columns * GLYPH_WIDTH * GLYPH_HEIGHT);
-
- if (NewLineBuffer == NULL) {
- //
- // The new line buffer could not be allocated, so return an error.
- // No changes to the state of the current console have been made, so the current console is still valid
- //
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
- //
- // If the mode has been set at least one other time, then LineBuffer will not be NULL
- //
- if (Private->LineBuffer != NULL) {
- //
- // Clear the current text window on the current graphics console
- //
- This->ClearScreen (This);
-
- //
- // If the new mode is the same as the old mode, then just return EFI_SUCCESS
- //
- if ((INT32) ModeNumber == This->Mode->Mode) {
- FreePool (NewLineBuffer);
- Status = EFI_SUCCESS;
- goto Done;
- }
- //
- // Otherwise, the size of the text console and/or the UGA mode will be changed,
- // so turn off the cursor, and free the LineBuffer for the current mode
- //
- This->EnableCursor (This, FALSE);
-
- FreePool (Private->LineBuffer);
- }
- //
- // Assign the current line buffer to the newly allocated line buffer
- //
- Private->LineBuffer = NewLineBuffer;
-
- if (GraphicsOutput != NULL) {
- if (ModeData->GopModeNumber != GraphicsOutput->Mode->Mode) {
- //
- // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new grapghics mode
- //
- Status = GraphicsOutput->SetMode (GraphicsOutput, ModeData->GopModeNumber);
- if (EFI_ERROR (Status)) {
- //
- // The mode set operation failed
- //
- goto Done;
- }
- } else {
- //
- // The current graphics mode is correct, so simply clear the entire display
- //
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &mEfiColors[0],
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->GopWidth,
- ModeData->GopHeight,
- 0
- );
- }
- } else {
- //
- // Get the current UGA Draw mode information
- //
- Status = UgaDraw->GetMode (
- UgaDraw,
- &HorizontalResolution,
- &VerticalResolution,
- &ColorDepth,
- &RefreshRate
- );
- if (EFI_ERROR (Status) || HorizontalResolution != ModeData->GopWidth || VerticalResolution != ModeData->GopHeight) {
- //
- // Either no graphics mode is currently set, or it is set to the wrong resolution, so set the new grapghics mode
- //
- Status = UgaDraw->SetMode (
- UgaDraw,
- ModeData->GopWidth,
- ModeData->GopHeight,
- 32,
- 60
- );
- if (EFI_ERROR (Status)) {
- //
- // The mode set operation failed
- //
- goto Done;
- }
- } else {
- //
- // The current graphics mode is correct, so simply clear the entire display
- //
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) &mEfiColors[0],
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->GopWidth,
- ModeData->GopHeight,
- 0
- );
- }
- }
-
- //
- // The new mode is valid, so commit the mode change
- //
- This->Mode->Mode = (INT32) ModeNumber;
-
- //
- // Move the text cursor to the upper left hand corner of the displat and enable it
- //
- This->SetCursorPosition (This, 0, 0);
- This->EnableCursor (This, TRUE);
-
- Status = EFI_SUCCESS;
-
-Done:
- gBS->RestoreTPL (OldTpl);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Attribute
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.SetAttribute().
-
- Arguments:
-
- This - Indicates the calling context.
-
- Attrubute - The attribute to set. Only bit0..6 are valid, all other bits
- are undefined and must be zero.
-
- Returns:
-
- EFI_SUCCESS
- The requested attribute is set.
-
- EFI_DEVICE_ERROR
- The requested attribute cannot be set due to Graphics Console port error.
-
- EFI_UNSUPPORTED
- The attribute requested is not defined by EFI spec.
-
---*/
-{
- EFI_TPL OldTpl;
-
- if ((Attribute | 0xFF) != 0xFF) {
- return EFI_UNSUPPORTED;
- }
-
- if ((INT32) Attribute == This->Mode->Attribute) {
- return EFI_SUCCESS;
- }
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- EraseCursor (This);
-
- This->Mode->Attribute = (INT32) Attribute;
-
- EraseCursor (This);
-
- gBS->RestoreTPL (OldTpl);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutClearScreen (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.ClearScreen().
- It clears the Graphics Console's display to the
- currently selected background color.
-
-
- Arguments:
-
- This - Indicates the calling context.
-
- Returns:
-
- EFI_SUCCESS
- The operation completed successfully.
-
- EFI_DEVICE_ERROR
- The Graphics Console cannot be cleared due to Graphics Console device error.
-
- EFI_UNSUPPORTED
- The Graphics Console is not in a valid text mode.
-
---*/
-{
- EFI_STATUS Status;
- GRAPHICS_CONSOLE_DEV *Private;
- GRAPHICS_CONSOLE_MODE_DATA *ModeData;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
- GraphicsOutput = Private->GraphicsOutput;
- UgaDraw = Private->UgaDraw;
- ModeData = &(Private->ModeData[This->Mode->Mode]);
-
- GetTextColors (This, &Foreground, &Background);
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &Background,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->GopWidth,
- ModeData->GopHeight,
- 0
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) &Background,
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- 0,
- ModeData->GopWidth,
- ModeData->GopHeight,
- 0
- );
- }
-
- This->Mode->CursorColumn = 0;
- This->Mode->CursorRow = 0;
-
- EraseCursor (This);
-
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutSetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.SetCursorPosition().
-
- Arguments:
-
- This - Indicates the calling context.
-
- Column - The row to set cursor to.
-
- Row - The column to set cursor to.
-
- Returns:
-
- EFI_SUCCESS
- The operation completed successfully.
-
- EFI_DEVICE_ERROR
- The request fails due to Graphics Console device error.
-
- EFI_UNSUPPORTED
- The Graphics Console is not in a valid text mode, or the cursor position
- is invalid for current mode.
-
---*/
-{
- GRAPHICS_CONSOLE_DEV *Private;
- GRAPHICS_CONSOLE_MODE_DATA *ModeData;
- EFI_STATUS Status;
- EFI_TPL OldTpl;
-
- Status = EFI_SUCCESS;
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
- ModeData = &(Private->ModeData[This->Mode->Mode]);
-
- if ((Column >= ModeData->Columns) || (Row >= ModeData->Rows)) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (((INT32) Column == This->Mode->CursorColumn) && ((INT32) Row == This->Mode->CursorRow)) {
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- EraseCursor (This);
-
- This->Mode->CursorColumn = (INT32) Column;
- This->Mode->CursorRow = (INT32) Row;
-
- EraseCursor (This);
-
-Done:
- gBS->RestoreTPL (OldTpl);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutEnableCursor (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN Visible
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.EnableCursor().
- In this driver, the cursor cannot be hidden.
-
- Arguments:
-
- This - Indicates the calling context.
-
- Visible - If TRUE, the cursor is set to be visible,
- If FALSE, the cursor is set to be invisible.
-
- Returns:
-
- EFI_SUCCESS
- The request is valid.
-
- EFI_UNSUPPORTED
- The Graphics Console does not support a hidden cursor.
-
---*/
-{
- EFI_TPL OldTpl;
-
- OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
-
- EraseCursor (This);
-
- This->Mode->CursorVisible = Visible;
-
- EraseCursor (This);
-
- gBS->RestoreTPL (OldTpl);
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-GetTextColors (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
- OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background
- )
-{
- INTN Attribute;
-
- Attribute = This->Mode->Attribute & 0x7F;
-
- *Foreground = mEfiColors[Attribute & 0x0f];
- *Background = mEfiColors[Attribute >> 4];
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-DrawUnicodeWeightAtCursorN (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *UnicodeWeight,
- IN UINTN Count
- )
-{
- GRAPHICS_CONSOLE_DEV *Private;
- EFI_STATUS Status;
- EFI_STATUS ReturnStatus;
- GLYPH_UNION *Glyph;
- GLYPH_UNION GlyphData;
- INTN GlyphX;
- INTN GlyphY;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- UINTN Index;
- UINTN ArrayIndex;
- UINTN Counts;
- UINT16 GlyphWidth;
- UINT32 GlyphStatus;
-
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
-
- ReturnStatus = EFI_SUCCESS;
- GlyphStatus = 0;
- GlyphWidth = 0x08;
-
- GetTextColors (This, &Foreground, &Background);
-
- Index = 0;
- ArrayIndex = 0;
- while (Index < Count) {
- if (This->Mode->Attribute & EFI_WIDE_ATTRIBUTE) {
- GlyphStatus = WIDE_CHAR;
- } else {
- GlyphStatus = NARROW_CHAR;
- }
-
- Status = mHii->GetGlyph (
- mHii,
- UnicodeWeight,
- (UINT16 *) &Index,
- (UINT8 **) &Glyph,
- &GlyphWidth,
- &GlyphStatus
- );
- if (EFI_ERROR (Status)) {
- ReturnStatus = Status;
- }
-
- Counts = 0;
-
- CopyMem (&GlyphData, Glyph, sizeof (GLYPH_UNION));
-
- do {
- //
- // We are creating the second half of the wide character's BLT buffer
- //
- if (GlyphWidth == 0x10 && Counts == 1) {
- CopyMem (&GlyphData.NarrowGlyph.GlyphCol1, &Glyph->WideGlyph.GlyphCol2, sizeof (Glyph->WideGlyph.GlyphCol2));
- }
-
- Counts++;
-
- if (GlyphWidth == 0x10) {
- mHii->GlyphToBlt (
- mHii,
- (UINT8 *) &GlyphData,
- Foreground,
- Background,
- Count * 2,
- GLYPH_WIDTH,
- GLYPH_HEIGHT,
- &Private->LineBuffer[ArrayIndex * GLYPH_WIDTH]
- );
- } else {
- mHii->GlyphToBlt (
- mHii,
- (UINT8 *) &GlyphData,
- Foreground,
- Background,
- Count,
- GLYPH_WIDTH,
- GLYPH_HEIGHT,
- &Private->LineBuffer[ArrayIndex * GLYPH_WIDTH]
- );
- }
-
- ArrayIndex++;
-
- } while (Counts < 2 && GlyphWidth == 0x10);
-
- }
- //
- // If we are printing Wide characters, treat the BLT as if it is twice as many characters
- //
- if (GlyphWidth == 0x10) {
- Count = Count * 2;
- }
- //
- // Blt a character to the screen
- //
- GlyphX = This->Mode->CursorColumn * GLYPH_WIDTH;
- GlyphY = This->Mode->CursorRow * GLYPH_HEIGHT;
- GraphicsOutput = Private->GraphicsOutput;
- UgaDraw = Private->UgaDraw;
- if (GraphicsOutput != NULL) {
- GraphicsOutput->Blt (
- GraphicsOutput,
- Private->LineBuffer,
- EfiBltBufferToVideo,
- 0,
- 0,
- GlyphX + Private->ModeData[This->Mode->Mode].DeltaX,
- GlyphY + Private->ModeData[This->Mode->Mode].DeltaY,
- GLYPH_WIDTH * Count,
- GLYPH_HEIGHT,
- GLYPH_WIDTH * Count * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) Private->LineBuffer,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- GlyphX + Private->ModeData[This->Mode->Mode].DeltaX,
- GlyphY + Private->ModeData[This->Mode->Mode].DeltaY,
- GLYPH_WIDTH * Count,
- GLYPH_HEIGHT,
- GLYPH_WIDTH * Count * sizeof (EFI_UGA_PIXEL)
- );
- }
-
- return ReturnStatus;
-}
-
-STATIC
-EFI_STATUS
-EraseCursor (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
- )
-{
- GRAPHICS_CONSOLE_DEV *Private;
- EFI_SIMPLE_TEXT_OUTPUT_MODE *CurrentMode;
- INTN GlyphX;
- INTN GlyphY;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Background;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION BltChar[GLYPH_HEIGHT][GLYPH_WIDTH];
- UINTN X;
- UINTN Y;
-
- CurrentMode = This->Mode;
-
- if (!CurrentMode->CursorVisible) {
- return EFI_SUCCESS;
- }
-
- Private = GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS (This);
- GraphicsOutput = Private->GraphicsOutput;
- UgaDraw = Private->UgaDraw;
-
- //
- // BUGBUG - we need to think about what to do with wide and narrow character deletions.
- //
- //
- // Blt a character to the screen
- //
- GlyphX = (CurrentMode->CursorColumn * GLYPH_WIDTH) + Private->ModeData[CurrentMode->Mode].DeltaX;
- GlyphY = (CurrentMode->CursorRow * GLYPH_HEIGHT) + Private->ModeData[CurrentMode->Mode].DeltaY;
- if (GraphicsOutput != NULL) {
- GraphicsOutput->Blt (
- GraphicsOutput,
- (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltChar,
- EfiBltVideoToBltBuffer,
- GlyphX,
- GlyphY,
- 0,
- 0,
- GLYPH_WIDTH,
- GLYPH_HEIGHT,
- GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) BltChar,
- EfiUgaVideoToBltBuffer,
- GlyphX,
- GlyphY,
- 0,
- 0,
- GLYPH_WIDTH,
- GLYPH_HEIGHT,
- GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)
- );
- }
-
- GetTextColors (This, &Foreground.Pixel, &Background.Pixel);
-
- //
- // Convert Monochrome bitmap of the Glyph to BltBuffer structure
- //
- for (Y = 0; Y < GLYPH_HEIGHT; Y++) {
- for (X = 0; X < GLYPH_WIDTH; X++) {
- if ((mCursorGlyph.GlyphCol1[Y] & (1 << X)) != 0) {
- BltChar[Y][GLYPH_WIDTH - X - 1].Raw ^= Foreground.Raw;
- }
- }
- }
-
- if (GraphicsOutput != NULL) {
- GraphicsOutput->Blt (
- GraphicsOutput,
- (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltChar,
- EfiBltBufferToVideo,
- 0,
- 0,
- GlyphX,
- GlyphY,
- GLYPH_WIDTH,
- GLYPH_HEIGHT,
- GLYPH_WIDTH * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) BltChar,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- GlyphX,
- GlyphY,
- GLYPH_WIDTH,
- GLYPH_HEIGHT,
- GLYPH_WIDTH * sizeof (EFI_UGA_PIXEL)
- );
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.h b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.h
deleted file mode 100644
index bcc1d56..0000000
--- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- GraphicsConsole.h
-
-Abstract:
-
-
-Revision History
-
---*/
-
-#ifndef _GRAPHICS_CONSOLE_H
-#define _GRAPHICS_CONSOLE_H
-
-
-#include "ComponentName.h"
-
-//
-// Glyph database
-//
-#define GLYPH_WIDTH 8
-#define GLYPH_HEIGHT 19
-
-typedef union {
- EFI_NARROW_GLYPH NarrowGlyph;
- EFI_WIDE_GLYPH WideGlyph;
-} GLYPH_UNION;
-
-extern EFI_NARROW_GLYPH UsStdNarrowGlyphData[];
-extern EFI_WIDE_GLYPH UsStdWideGlyphData[];
-
-//
-// Device Structure
-//
-#define GRAPHICS_CONSOLE_DEV_SIGNATURE EFI_SIGNATURE_32 ('g', 's', 't', 'o')
-
-typedef struct {
- UINTN Columns;
- UINTN Rows;
- INTN DeltaX;
- INTN DeltaY;
- UINT32 GopWidth;
- UINT32 GopHeight;
- UINT32 GopModeNumber;
-} GRAPHICS_CONSOLE_MODE_DATA;
-
-#define GRAPHICS_MAX_MODE 3
-
-typedef struct {
- UINTN Signature;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL SimpleTextOutput;
- EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
- GRAPHICS_CONSOLE_MODE_DATA ModeData[GRAPHICS_MAX_MODE];
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
- EFI_HII_HANDLE HiiHandle;
-} GRAPHICS_CONSOLE_DEV;
-
-#define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \
- CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding;
-
-//
-// Prototypes
-//
-UINTN
-ReturnNarrowFontSize (
- VOID
- );
-
-UINTN
-ReturnWideFontSize (
- VOID
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutReset (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutOutputString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutTestString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutSetMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Attribute
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutClearScreen (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutSetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleConOutEnableCursor (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN Visible
- );
-
-EFI_STATUS
-EfiLocateHiiProtocol (
- VOID
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleControllerDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleControllerDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-GraphicsConsoleControllerDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-#endif
diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa
deleted file mode 100644
index 187cc9b..0000000
--- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.msa
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>GraphicsConsole</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>CCCB0C28-4B24-11d5-9A5A-0090273FC14D</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for GraphicsConsole module</Abstract>
- <Description>This is the main routine for initializing the Graphics Console support routines.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>GraphicsConsole</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HiiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>GraphicsConsole.h</Filename>
- <Filename>GraphicsConsole.c</Filename>
- <Filename>LaffStd.c</Filename>
- <Filename>ComponentName.h</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <HiiPackages>
- <HiiPackage Usage="ALWAYS_PRODUCED">
- <HiiCName>FontPack</HiiCName>
- <HelpText>Register UsStdNarrow Fonts into the global database.</HelpText>
- </HiiPackage>
- </HiiPackages>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gGraphicsConsoleDriverBinding</DriverBinding>
- <ComponentName>gGraphicsConsoleComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/LaffStd.c b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/LaffStd.c
deleted file mode 100644
index ac8dd16..0000000
--- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/LaffStd.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- LaffStd.c
-
-Abstract:
-
-
-Revision History
-
---*/
-
-#include "GraphicsConsole.h"
-
-EFI_NARROW_GLYPH UsStdNarrowGlyphData[] = {
- //
- // Unicode glyphs from 0x20 to 0x7e are the same as ASCII characters 0x20 to 0x7e
- //
- { 0x0020, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x0021, 0x00, {0x00,0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00}},
- { 0x0022, 0x00, {0x00,0x00,0x00,0x6C,0x6C,0x6C,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x0023, 0x00, {0x00,0x00,0x00,0x00,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00}},
- { 0x0024, 0x00, {0x00,0x00,0x18,0x18,0x7C,0xC6,0xC6,0x60,0x38,0x0C,0x06,0xC6,0xC6,0x7C,0x18,0x18,0x00,0x00,0x00}},
- { 0x0025, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x60,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x0026, 0x00, {0x00,0x00,0x00,0x78,0xCC,0xCC,0xCC,0x78,0x76,0xDC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x0027, 0x00, {0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x0028, 0x00, {0x00,0x00,0x00,0x06,0x0C,0x0C,0x18,0x18,0x18,0x18,0x18,0x18,0x0C,0x0C,0x06,0x00,0x00,0x00,0x00}},
- { 0x0029, 0x00, {0x00,0x00,0x00,0xC0,0x60,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0x60,0xC0,0x00,0x00,0x00,0x00}},
- { 0x002a, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x38,0xFE,0x38,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x002b, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x002c, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00}},
- { 0x002d, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x002e, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00}},
- { 0x002f, 0x00, {0x00,0x00,0x00,0x06,0x06,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x60,0xC0,0xC0,0x00,0x00,0x00,0x00}},
- { 0x0030, 0x00, {0x00,0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0xD6,0xD6,0xC6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00}},
- { 0x0031, 0x00, {0x00,0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00}},
- { 0x0032, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0x06,0x06,0x06,0x0C,0x18,0x30,0x60,0xC0,0xC2,0xFE,0x00,0x00,0x00,0x00}},
- { 0x0033, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0x06,0x06,0x06,0x3C,0x06,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0034, 0x00, {0x00,0x00,0x00,0x1C,0x1C,0x3C,0x3C,0x6C,0x6C,0xCC,0xFE,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00}},
- { 0x0035, 0x00, {0x00,0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xC0,0xFC,0x06,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0036, 0x00, {0x00,0x00,0x00,0x3C,0x60,0xC0,0xC0,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0037, 0x00, {0x00,0x00,0x00,0xFE,0xC6,0x06,0x06,0x06,0x0C,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00}},
- { 0x0038, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0039, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00}},
- { 0x003a, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00}},
- { 0x003b, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00}},
- { 0x003c, 0x00, {0x00,0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0xC0,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00}},
- { 0x003d, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x003e, 0x00, {0x00,0x00,0x00,0x00,0xC0,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0xC0,0x00,0x00,0x00,0x00}},
- { 0x003f, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0x0C,0x0C,0x18,0x18,0x18,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00}},
- { 0x0040, 0x00, {0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xDE,0xDE,0xDE,0xDC,0xC0,0xC0,0x7E,0x00,0x00,0x00,0x00}},
-
- { 0x0041, 0x00, {0x00,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
-
- { 0x0042, 0x00, {0x00,0x00,0x00,0xFC,0x66,0x66,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00}},
- { 0x0043, 0x00, {0x00,0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x00,0x00,0x00,0x00}},
- { 0x0044, 0x00, {0x00,0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00}},
- { 0x0045, 0x00, {0x00,0x00,0x00,0xFE,0x66,0x62,0x60,0x68,0x78,0x68,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
- { 0x0046, 0x00, {0x00,0x00,0x00,0xFE,0x66,0x62,0x60,0x64,0x7C,0x64,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00}},
- { 0x0047, 0x00, {0x00,0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xDE,0xC6,0xC6,0xC6,0x66,0x3C,0x00,0x00,0x00,0x00}},
- { 0x0048, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x0049, 0x00, {0x00,0x00,0x00,0xFC,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xFC,0x00,0x00,0x00,0x00}},
- { 0x004a, 0x00, {0x00,0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00}},
- { 0x004b, 0x00, {0x00,0x00,0x00,0xE6,0x66,0x6C,0x6C,0x78,0x70,0x78,0x6C,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00}},
- { 0x004c, 0x00, {0x00,0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
- { 0x004d, 0x00, {0x00,0x00,0x00,0xC6,0xEE,0xEE,0xFE,0xFE,0xD6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x004e, 0x00, {0x00,0x00,0x00,0xC6,0xE6,0xF6,0xF6,0xF6,0xDE,0xCE,0xCE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x004f, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0050, 0x00, {0x00,0x00,0x00,0xFC,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00}},
- { 0x0051, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xD6,0x7C,0x1C,0x0E,0x00,0x00}},
- { 0x0052, 0x00, {0x00,0x00,0x00,0xFC,0x66,0x66,0x66,0x66,0x7C,0x78,0x6C,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00}},
- { 0x0053, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x60,0x38,0x0C,0x06,0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0054, 0x00, {0x00,0x00,0x00,0xFC,0xFC,0xB4,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}},
- { 0x0055, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0056, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x6C,0x38,0x10,0x00,0x00,0x00,0x00}},
- { 0x0057, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xD6,0xD6,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00}},
- { 0x0058, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0xC6,0x6C,0x6C,0x38,0x6C,0x6C,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x0059, 0x00, {0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}},
- { 0x005a, 0x00, {0x00,0x00,0x00,0xFE,0xC6,0x86,0x0C,0x0C,0x18,0x30,0x60,0xC0,0xC2,0xC6,0xFE,0x00,0x00,0x00,0x00}},
- { 0x005b, 0x00, {0x00,0x00,0x00,0x1E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1E,0x00,0x00,0x00,0x00}},
- { 0x005c, 0x00, {0x00,0x00,0x00,0xC0,0xC0,0x60,0x60,0x30,0x30,0x18,0x18,0x0C,0x0C,0x06,0x06,0x00,0x00,0x00,0x00}},
- { 0x005d, 0x00, {0x00,0x00,0x00,0xF0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xF0,0x00,0x00,0x00,0x00}},
- { 0x005e, 0x00, {0x00,0x00,0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x005f, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00}},
- { 0x0060, 0x00, {0x00,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x0061, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x0062, 0x00, {0x00,0x00,0x00,0xE0,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0063, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0064, 0x00, {0x00,0x00,0x00,0x1C,0x0C,0x0C,0x0C,0x3C,0x6C,0xCC,0xCC,0xCC,0xCC,0xCC,0x7E,0x00,0x00,0x00,0x00}},
- { 0x0065, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0066, 0x00, {0x00,0x00,0x00,0x1E,0x33,0x30,0x30,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}},
- { 0x0067, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0xCC,0x78,0x00}},
- { 0x0068, 0x00, {0x00,0x00,0x00,0xE0,0x60,0x60,0x60,0x7C,0x76,0x66,0x66,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00}},
- { 0x0069, 0x00, {0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x006a, 0x00, {0x00,0x00,0x00,0x0C,0x0C,0x0C,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x6C,0x38,0x00}},
- { 0x006b, 0x00, {0x00,0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78,0x70,0x78,0x6C,0x6C,0x66,0xE6,0x00,0x00,0x00,0x00}},
- { 0x006c, 0x00, {0x00,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x006d, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0xEE,0xFE,0xD6,0xD6,0xD6,0xD6,0xD6,0x00,0x00,0x00,0x00}},
- { 0x006e, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00}},
- { 0x006f, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0070, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00}},
- { 0x0071, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00}},
- { 0x0072, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x60,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00}},
- { 0x0073, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0x7C,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x0074, 0x00, {0x00,0x00,0x00,0x10,0x30,0x30,0x30,0xFC,0x30,0x30,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00}},
- { 0x0075, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x0076, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x30,0x00,0x00,0x00,0x00}},
- { 0x0077, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xD6,0xD6,0xFE,0xEE,0x6C,0x00,0x00,0x00,0x00}},
- { 0x0078, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x38,0x6C,0x6C,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x0079, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00}},
- { 0x007a, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x86,0x0C,0x18,0x30,0x60,0xC0,0xFE,0x00,0x00,0x00,0x00}},
- { 0x007b, 0x00, {0x00,0x00,0x00,0x0E,0x18,0x18,0x18,0x18,0x30,0x18,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00}},
- { 0x007c, 0x00, {0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00}},
- { 0x007d, 0x00, {0x00,0x00,0x00,0xE0,0x30,0x30,0x30,0x30,0x18,0x30,0x30,0x30,0x30,0x30,0xE0,0x00,0x00,0x00,0x00}},
- { 0x007e, 0x00, {0x00,0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
-
- { 0x00a0, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00a1, 0x00, {0x00,0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x3C,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00}},
- { 0x00a2, 0x00, {0x00,0x00,0x00,0x00,0x18,0x18,0x7C,0xC6,0xC0,0xC0,0xC0,0xC6,0x7C,0x18,0x18,0x00,0x00,0x00,0x00}},
- { 0x00a3, 0x00, {0x00,0x00,0x00,0x38,0x6C,0x64,0x60,0x60,0xF0,0x60,0x60,0x60,0x60,0xE6,0xFC,0x00,0x00,0x00,0x00}},
- { 0x00a4, 0x00, {0x00,0x00,0x18,0x00,0x00,0x00,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0xC6,0x00,0x00,0x00,0x00,0x00}},
- { 0x00a5, 0x00, {0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x18,0x7E,0x18,0x7E,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00}},
- { 0x00a6, 0x00, {0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00}},
- { 0x00a7, 0x00, {0x00,0x00,0x18,0x7C,0xC6,0x60,0x38,0x6C,0xC6,0xC6,0x6C,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00a8, 0x00, {0x00,0x00,0x00,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00a9, 0x00, {0x00,0x00,0x00,0x00,0x7C,0x82,0x9A,0xA2,0xA2,0xA2,0x9A,0x82,0x7C,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00aa, 0x00, {0x00,0x00,0x00,0x00,0x3C,0x6C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00ab, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x6C,0xD8,0x6C,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00ac, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00ad, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00ae, 0x00, {0x00,0x00,0x00,0x00,0x7C,0x82,0xB2,0xAA,0xAA,0xB2,0xAA,0xAA,0x82,0x7C,0x00,0x00,0x00,0x00,0x00}},
- { 0x00af, 0x00, {0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00b0, 0x00, {0x00,0x00,0x00,0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00b1, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00}},
- { 0x00b2, 0x00, {0x00,0x00,0x00,0x3C,0x66,0x0C,0x18,0x32,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00b3, 0x00, {0x00,0x00,0x00,0x7C,0x06,0x3C,0x06,0x06,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00b4, 0x00, {0x00,0x00,0x00,0x0C,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00b5, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xC0,0x00}},
- { 0x00b6, 0x00, {0x00,0x00,0x00,0x7F,0xDB,0xDB,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x00,0x00,0x00,0x00}},
- { 0x00b7, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00b8, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x0C,0x78,0x00,0x00,0x00}},
- { 0x00b9, 0x00, {0x00,0x00,0x00,0x18,0x38,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00ba, 0x00, {0x00,0x00,0x00,0x00,0x38,0x6C,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00bb, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x6C,0x36,0x6C,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00bc, 0x00, {0x00,0x00,0x00,0x60,0xE0,0x62,0x66,0x6C,0x18,0x30,0x66,0xCE,0x9A,0x3F,0x06,0x06,0x00,0x00,0x00}},
- { 0x00bd, 0x00, {0x00,0x00,0x00,0x60,0xE0,0x62,0x66,0x6C,0x18,0x30,0x60,0xDC,0x86,0x0C,0x18,0x3E,0x00,0x00,0x00}},
- { 0x00be, 0x00, {0x00,0x00,0x00,0xE0,0x30,0x62,0x36,0xEC,0x18,0x30,0x66,0xCE,0x9A,0x3F,0x06,0x06,0x00,0x00,0x00}},
- { 0x00bf, 0x00, {0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0x60,0xC0,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00c0, 0x00, {0x60,0x30,0x18,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x00c1, 0x00, {0x18,0x30,0x60,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x00c2, 0x00, {0x10,0x38,0x6C,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x00c3, 0x00, {0x76,0xDC,0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x00c4, 0x00, {0xCC,0xCC,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x00c5, 0x00, {0x38,0x6C,0x38,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x00c6, 0x00, {0x00,0x00,0x00,0x00,0x3E,0x6C,0xCC,0xCC,0xCC,0xFE,0xCC,0xCC,0xCC,0xCC,0xCE,0x00,0x00,0x00,0x00}},
- { 0x00c7, 0x00, {0x00,0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x18,0x70,0x00,0x00}},
- { 0x00c8, 0x00, {0x60,0x30,0x18,0x00,0xFE,0x66,0x62,0x60,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
- { 0x00c9, 0x00, {0x18,0x30,0x60,0x00,0xFE,0x66,0x62,0x60,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
- { 0x00ca, 0x00, {0x10,0x38,0x6C,0x00,0xFE,0x66,0x62,0x60,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
- { 0x00cb, 0x00, {0xCC,0xCC,0x00,0x00,0xFE,0x66,0x62,0x60,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
- { 0x00cc, 0x00, {0x60,0x30,0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x00cd, 0x00, {0x18,0x30,0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x00ce, 0x00, {0x10,0x38,0x6C,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x00cf, 0x00, {0xCC,0xCC,0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x00d0, 0x00, {0x00,0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0xF6,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00}},
- { 0x00d1, 0x00, {0x76,0xDC,0x00,0x00,0xC6,0xE6,0xE6,0xF6,0xF6,0xDE,0xDE,0xCE,0xCE,0xC6,0xC6,0x00,0x00,0x00,0x00}},
- { 0x00d2, 0x00, {0x60,0x30,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00d3, 0x00, {0x18,0x30,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00d4, 0x00, {0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00d5, 0x00, {0x76,0xDC,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00d6, 0x00, {0xCC,0xCC,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00d7, 0x00, {0x10,0x28,0x00,0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x38,0x6C,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00}},
- { 0x00d8, 0x00, {0x00,0x00,0x00,0x7C,0xCE,0xCE,0xDE,0xD6,0xD6,0xD6,0xD6,0xF6,0xE6,0xE6,0x7C,0x40,0x00,0x00,0x00}},
- { 0x00d9, 0x00, {0x60,0x30,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00da, 0x00, {0x18,0x30,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00db, 0x00, {0x10,0x38,0x6C,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00dc, 0x00, {0xCC,0xCC,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00dd, 0x00, {0x18,0x30,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x00de, 0x00, {0x00,0x00,0x10,0x00,0xF0,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x7C,0x60,0xF0,0x00,0x00,0x00,0x00}},
- { 0x00df, 0x00, {0x00,0x00,0x00,0x78,0xCC,0xCC,0xCC,0xCC,0xD8,0xCC,0xC6,0xC6,0xC6,0xC6,0xCC,0x00,0x00,0x00,0x00}},
- { 0x00e0, 0x00, {0x00,0x30,0x30,0x60,0x30,0x18,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x00e1, 0x00, {0x00,0x00,0x00,0x18,0x30,0x60,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x00e2, 0x00, {0x00,0x00,0x00,0x10,0x38,0x6C,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x00e3, 0x00, {0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x00e4, 0x00, {0x00,0x00,0x00,0xCC,0xCC,0x00,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x00e5, 0x00, {0x00,0x00,0x00,0x38,0x6C,0x38,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x00e6, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0x36,0x36,0x7E,0xD8,0xD8,0xD8,0x6E,0x00,0x00,0x00,0x00}},
- { 0x00e7, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC0,0xC6,0x7C,0x18,0x70,0x00,0x00}},
- { 0x00e8, 0x00, {0x00,0x00,0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00e9, 0x00, {0x00,0x00,0x00,0x0C,0x18,0x30,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00ea, 0x00, {0x00,0x00,0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00eb, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00ec, 0x00, {0x00,0x00,0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x00ed, 0x00, {0x00,0x00,0x00,0x0C,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x00ee, 0x00, {0x00,0x00,0x00,0x18,0x3C,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x00ef, 0x00, {0x00,0x00,0x00,0x66,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
- { 0x00f0, 0x00, {0x00,0x00,0x00,0x34,0x18,0x2C,0x0C,0x06,0x3E,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00}},
- { 0x00f1, 0x00, {0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00}},
- { 0x00f2, 0x00, {0x00,0x00,0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00f3, 0x00, {0x00,0x00,0x00,0x18,0x30,0x60,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00f4, 0x00, {0x00,0x00,0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00f5, 0x00, {0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00f6, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00f7, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x7E,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { 0x00f8, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xCE,0xDE,0xD6,0xF6,0xE6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
- { 0x00f9, 0x00, {0x00,0x00,0x00,0x60,0x30,0x18,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x00fa, 0x00, {0x00,0x00,0x00,0x18,0x30,0x60,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x00fb, 0x00, {0x00,0x00,0x00,0x30,0x78,0xCC,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x00fc, 0x00, {0x00,0x00,0x00,0xCC,0xCC,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
- { 0x00fd, 0x00, {0x00,0x00,0x00,0x0C,0x18,0x30,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00}},
- { 0x00fe, 0x00, {0x00,0x00,0x00,0xE0,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00}},
- { 0x00ff, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0x78,0x00}},
-
- { (CHAR16)BOXDRAW_HORIZONTAL, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_VERTICAL, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_DOWN_RIGHT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_DOWN_LEFT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_UP_RIGHT, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_UP_LEFT, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_VERTICAL_RIGHT, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_VERTICAL_LEFT, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_DOWN_HORIZONTAL, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_UP_HORIZONTAL, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_VERTICAL_HORIZONTAL, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_DOUBLE_HORIZONTAL, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_DOUBLE_VERTICAL, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_DOWN_RIGHT_DOUBLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_DOWN_DOUBLE_RIGHT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_DOUBLE_DOWN_RIGHT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_DOWN_LEFT_DOUBLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_DOWN_DOUBLE_LEFT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_DOUBLE_DOWN_LEFT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_UP_RIGHT_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_UP_DOUBLE_RIGHT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_DOUBLE_UP_RIGHT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_UP_LEFT_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_UP_DOUBLE_LEFT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_DOUBLE_UP_LEFT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_VERTICAL_LEFT_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_VERTICAL_DOUBLE_LEFT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_DOUBLE_VERTICAL_LEFT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_UP_HORIZONTAL_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_UP_DOUBLE_HORIZONTAL, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_DOUBLE_UP_HORIZONTAL, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
- { (CHAR16)BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
- { (CHAR16)BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
-
- { (CHAR16)BLOCKELEMENT_FULL_BLOCK, 0x00, {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}},
- { (CHAR16)BLOCKELEMENT_LIGHT_SHADE, 0x00, {0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22}},
-
- { (CHAR16)GEOMETRICSHAPE_RIGHT_TRIANGLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF8,0xFE,0xF8,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)GEOMETRICSHAPE_LEFT_TRIANGLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x06,0x0E,0x1E,0x3E,0xFE,0x3E,0x1E,0x0E,0x06,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)GEOMETRICSHAPE_UP_TRIANGLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7C,0x7C,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)GEOMETRICSHAPE_DOWN_TRIANGLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x7C,0x7C,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00,0x00}},
-
- { (CHAR16)ARROW_UP, 0x00, {0x00,0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)ARROW_DOWN, 0x00, {0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)ARROW_LEFT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x20,0x60,0x60,0xFE,0xFE,0x60,0x60,0x20,0x00,0x00,0x00,0x00,0x00,0x00}},
- { (CHAR16)ARROW_RIGHT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x08,0x0C,0x0C,0xFE,0xFE,0x0C,0x0C,0x08,0x00,0x00,0x00,0x00,0x00,0x00}},
-
- { 0x0000, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} //EOL
-};
-
-UINTN
-ReturnNarrowFontSize (
- VOID
- )
-{
- //
- // I need the size of this outside of this file, so here is a stub function to do that for me
- //
- return sizeof (UsStdNarrowGlyphData);
-}
diff --git a/EdkModulePkg/Universal/Console/Terminal/Dxe/ComponentName.c b/EdkModulePkg/Universal/Console/Terminal/Dxe/ComponentName.c
deleted file mode 100644
index bdc6df4..0000000
--- a/EdkModulePkg/Universal/Console/Terminal/Dxe/ComponentName.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-
-#include "Terminal.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gTerminalComponentName = {
- TerminalComponentNameGetDriverName,
- TerminalComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mTerminalDriverNameTable[] = {
- {
- "eng",
- (CHAR16 *) L"Serial Terminal Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-TerminalComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gTerminalComponentName.SupportedLanguages,
- mTerminalDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-TerminalComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language
- specified by Language from the point of view of the
- driver specified by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
- EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently
- managing the controller specified by
- ControllerHandle and ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *SimpleTextOutput;
- TERMINAL_DEV *TerminalDevice;
-
- //
- // Make sure this driver is currently managing ControllHandle
- //
- Status = EfiTestManagedDevice (
- ControllerHandle,
- gTerminalDriverBinding.DriverBindingHandle,
- &gEfiSerialIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // This is a bus driver, so ChildHandle can not be NULL.
- //
- if (ChildHandle == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- Status = EfiTestChildHandle (
- ControllerHandle,
- ChildHandle,
- &gEfiSerialIoProtocolGuid
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Get our context back
- //
- Status = gBS->OpenProtocol (
- ChildHandle,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &SimpleTextOutput,
- gTerminalDriverBinding.DriverBindingHandle,
- ChildHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (SimpleTextOutput);
-
- return LookupUnicodeString (
- Language,
- gTerminalComponentName.SupportedLanguages,
- TerminalDevice->ControllerNameTable,
- ControllerName
- );
-}
diff --git a/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c b/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c
deleted file mode 100644
index 958516d..0000000
--- a/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c
+++ /dev/null
@@ -1,1187 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Terminal.c
-
-Abstract:
-
-Revision History:
-
---*/
-
-
-#include "Terminal.h"
-
-//
-// Globals
-//
-EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding = {
- TerminalDriverBindingSupported,
- TerminalDriverBindingStart,
- TerminalDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-
-EFI_STATUS
-EFIAPI
-TerminalDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- VENDOR_DEVICE_PATH *Node;
-
- //
- // If remaining device path is not NULL, then make sure it is a
- // device path that describes a terminal communications protocol.
- //
- if (RemainingDevicePath != NULL) {
-
- Node = (VENDOR_DEVICE_PATH *) RemainingDevicePath;
-
- if (Node->Header.Type != MESSAGING_DEVICE_PATH ||
- Node->Header.SubType != MSG_VENDOR_DP ||
- DevicePathNodeLength(&Node->Header) != sizeof(VENDOR_DEVICE_PATH)) {
-
- return EFI_UNSUPPORTED;
-
- }
- //
- // only supports PC ANSI, VT100, VT100+ and VT-UTF8 terminal types
- //
- if (!CompareGuid (&Node->Guid, &gEfiPcAnsiGuid) &&
- !CompareGuid (&Node->Guid, &gEfiVT100Guid) &&
- !CompareGuid (&Node->Guid, &gEfiVT100PlusGuid) &&
- !CompareGuid (&Node->Guid, &gEfiVTUTF8Guid)) {
-
- return EFI_UNSUPPORTED;
- }
- }
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- //
- // The Controller must support the Serial I/O Protocol.
- // This driver is a bus driver with at most 1 child device, so it is
- // ok for it to be already started.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiSerialIoProtocolGuid,
- (VOID **) &SerialIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-TerminalDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
-
- Start the controller.
-
- Arguments:
-
- This - A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- Controller - The handle of the controller to start.
- RemainingDevicePath - A pointer to the remaining portion of a devcie path.
-
- Returns:
-
- EFI_SUCCESS.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- VENDOR_DEVICE_PATH *Node;
- VENDOR_DEVICE_PATH *DefaultNode;
- EFI_SERIAL_IO_MODE *Mode;
- UINTN SerialInTimeOut;
- TERMINAL_DEV *TerminalDevice;
- UINT8 TerminalType;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
- UINTN EntryCount;
- UINTN Index;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- TerminalDevice = NULL;
- DefaultNode = NULL;
- //
- // Get the Device Path Protocol to build the device path of the child device
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
- //
- // Report that the remote terminal is being enabled
- //
- DevicePath = ParentDevicePath;
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_ENABLE,
- DevicePath
- );
-
- //
- // Open the Serial I/O Protocol BY_DRIVER. It might already be started.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiSerialIoProtocolGuid,
- (VOID **) &SerialIo,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- if (Status != EFI_ALREADY_STARTED) {
- //
- // If Serial I/O is not already open by this driver, then tag the handle
- // with the Terminal Driver GUID and update the ConInDev, ConOutDev, and
- // StdErrDev variables with the list of possible terminal types on this
- // serial port.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiCallerIdGuid,
- NULL,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Controller,
- &gEfiCallerIdGuid,
- DuplicateDevicePath (ParentDevicePath),
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
- //
- // if the serial device is a hot plug device, do not update the
- // ConInDev, ConOutDev, and StdErrDev variables.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiHotPlugDeviceGuid,
- NULL,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- TerminalUpdateConsoleDevVariable ((CHAR16 *)VarConsoleInpDev, ParentDevicePath);
- TerminalUpdateConsoleDevVariable ((CHAR16 *)VarConsoleOutDev, ParentDevicePath);
- TerminalUpdateConsoleDevVariable ((CHAR16 *)VarErrorOutDev, ParentDevicePath);
- }
- }
- }
- //
- // Make sure a child handle does not already exist. This driver can only
- // produce one child per serial port.
- //
- Status = gBS->OpenProtocolInformation (
- Controller,
- &gEfiSerialIoProtocolGuid,
- &OpenInfoBuffer,
- &EntryCount
- );
- if (!EFI_ERROR (Status)) {
- Status = EFI_SUCCESS;
- for (Index = 0; Index < EntryCount; Index++) {
- if (OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) {
- Status = EFI_ALREADY_STARTED;
- }
- }
-
- FreePool (OpenInfoBuffer);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- //
- // If RemainingDevicePath is NULL, then create default device path node
- //
- if (RemainingDevicePath == NULL) {
- DefaultNode = AllocatePool (sizeof (VENDOR_DEVICE_PATH));
- if (DefaultNode == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
- }
-
- CopyMem (&DefaultNode->Guid, &gEfiPcAnsiGuid, sizeof (EFI_GUID));
- RemainingDevicePath = (EFI_DEVICE_PATH_PROTOCOL*) DefaultNode;
- }
- //
- // Use the RemainingDevicePath to determine the terminal type
- //
- Node = (VENDOR_DEVICE_PATH *) RemainingDevicePath;
-
- if (CompareGuid (&Node->Guid, &gEfiPcAnsiGuid)) {
-
- TerminalType = PcAnsiType;
-
- } else if (CompareGuid (&Node->Guid, &gEfiVT100Guid)) {
-
- TerminalType = VT100Type;
-
- } else if (CompareGuid (&Node->Guid, &gEfiVT100PlusGuid)) {
-
- TerminalType = VT100PlusType;
-
- } else if (CompareGuid (&Node->Guid, &gEfiVTUTF8Guid)) {
-
- TerminalType = VTUTF8Type;
-
- } else {
- goto Error;
- }
- //
- // Initialize the Terminal Dev
- //
- TerminalDevice = AllocatePool (sizeof (TERMINAL_DEV));
- if (TerminalDevice == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
- }
-
- ZeroMem (TerminalDevice, sizeof (TERMINAL_DEV));
-
- TerminalDevice->Signature = TERMINAL_DEV_SIGNATURE;
-
- TerminalDevice->TerminalType = TerminalType;
-
- TerminalDevice->SerialIo = SerialIo;
-
- //
- // Simple Input Protocol
- //
- TerminalDevice->SimpleInput.Reset = TerminalConInReset;
- TerminalDevice->SimpleInput.ReadKeyStroke = TerminalConInReadKeyStroke;
-
- Status = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- TerminalConInWaitForKey,
- &TerminalDevice->SimpleInput,
- &TerminalDevice->SimpleInput.WaitForKey
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
- //
- // initialize the FIFO buffer used for accommodating
- // the pre-read pending characters
- //
- InitializeRawFiFo (TerminalDevice);
- InitializeUnicodeFiFo (TerminalDevice);
- InitializeEfiKeyFiFo (TerminalDevice);
-
- //
- // Set the timeout value of serial buffer for
- // keystroke response performance issue
- //
- Mode = TerminalDevice->SerialIo->Mode;
-
- SerialInTimeOut = 0;
- if (Mode->BaudRate != 0) {
- SerialInTimeOut = (1 + Mode->DataBits + Mode->StopBits) * 2 * 1000000 / (UINTN) Mode->BaudRate;
- }
-
- Status = TerminalDevice->SerialIo->SetAttributes (
- TerminalDevice->SerialIo,
- Mode->BaudRate,
- Mode->ReceiveFifoDepth,
- (UINT32) SerialInTimeOut,
- (EFI_PARITY_TYPE) (Mode->Parity),
- (UINT8) Mode->DataBits,
- (EFI_STOP_BITS_TYPE) (Mode->StopBits)
- );
- if (EFI_ERROR (Status)) {
- //
- // if set attributes operation fails, invalidate
- // the value of SerialInTimeOut,thus make it
- // inconsistent with the default timeout value
- // of serial buffer. This will invoke the recalculation
- // in the readkeystroke routine.
- //
- TerminalDevice->SerialInTimeOut = 0;
- } else {
- TerminalDevice->SerialInTimeOut = SerialInTimeOut;
- }
- //
- // Build the device path for the child device
- //
- Status = SetTerminalDevicePath (
- TerminalDevice->TerminalType,
- ParentDevicePath,
- &TerminalDevice->DevicePath
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- DevicePath = TerminalDevice->DevicePath;
-
- Status = TerminalDevice->SimpleInput.Reset (
- &TerminalDevice->SimpleInput,
- FALSE
- );
- if (EFI_ERROR (Status)) {
- //
- // Need to report Error Code first
- //
- goto ReportError;
- }
- //
- // Simple Text Output Protocol
- //
- TerminalDevice->SimpleTextOutput.Reset = TerminalConOutReset;
- TerminalDevice->SimpleTextOutput.OutputString = TerminalConOutOutputString;
- TerminalDevice->SimpleTextOutput.TestString = TerminalConOutTestString;
- TerminalDevice->SimpleTextOutput.QueryMode = TerminalConOutQueryMode;
- TerminalDevice->SimpleTextOutput.SetMode = TerminalConOutSetMode;
- TerminalDevice->SimpleTextOutput.SetAttribute = TerminalConOutSetAttribute;
- TerminalDevice->SimpleTextOutput.ClearScreen = TerminalConOutClearScreen;
- TerminalDevice->SimpleTextOutput.SetCursorPosition = TerminalConOutSetCursorPosition;
- TerminalDevice->SimpleTextOutput.EnableCursor = TerminalConOutEnableCursor;
- TerminalDevice->SimpleTextOutput.Mode = &TerminalDevice->SimpleTextOutputMode;
-
- TerminalDevice->SimpleTextOutputMode.MaxMode = 1;
- //
- // For terminal devices, cursor is always visible
- //
- TerminalDevice->SimpleTextOutputMode.CursorVisible = TRUE;
- TerminalDevice->SimpleTextOutputMode.Attribute = EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK);
-
- Status = TerminalDevice->SimpleTextOutput.Reset (
- &TerminalDevice->SimpleTextOutput,
- FALSE
- );
- if (EFI_ERROR (Status)) {
- goto ReportError;
- }
-
- Status = TerminalDevice->SimpleTextOutput.SetMode (
- &TerminalDevice->SimpleTextOutput,
- 0
- );
- if (EFI_ERROR (Status)) {
- goto ReportError;
- }
-
- Status = TerminalDevice->SimpleTextOutput.EnableCursor (
- &TerminalDevice->SimpleTextOutput,
- TRUE
- );
- if (EFI_ERROR (Status)) {
- goto ReportError;
- }
- //
- //
- //
- TerminalDevice->InputState = INPUT_STATE_DEFAULT;
- TerminalDevice->ResetState = RESET_STATE_DEFAULT;
-
- Status = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &TerminalDevice->TwoSecondTimeOut
- );
-
- //
- // Build the component name for the child device
- //
- TerminalDevice->ControllerNameTable = NULL;
- switch (TerminalDevice->TerminalType) {
- case PcAnsiType:
- AddUnicodeString (
- "eng",
- gTerminalComponentName.SupportedLanguages,
- &TerminalDevice->ControllerNameTable,
- (CHAR16 *)L"PC-ANSI Serial Console"
- );
- break;
-
- case VT100Type:
- AddUnicodeString (
- "eng",
- gTerminalComponentName.SupportedLanguages,
- &TerminalDevice->ControllerNameTable,
- (CHAR16 *)L"VT-100 Serial Console"
- );
- break;
-
- case VT100PlusType:
- AddUnicodeString (
- "eng",
- gTerminalComponentName.SupportedLanguages,
- &TerminalDevice->ControllerNameTable,
- (CHAR16 *)L"VT-100+ Serial Console"
- );
- break;
-
- case VTUTF8Type:
- AddUnicodeString (
- "eng",
- gTerminalComponentName.SupportedLanguages,
- &TerminalDevice->ControllerNameTable,
- (CHAR16 *)L"VT-UTF8 Serial Console"
- );
- break;
- }
- //
- // Install protocol interfaces for the serial device.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &TerminalDevice->Handle,
- &gEfiDevicePathProtocolGuid,
- TerminalDevice->DevicePath,
- &gEfiSimpleTextInProtocolGuid,
- &TerminalDevice->SimpleInput,
- &gEfiSimpleTextOutProtocolGuid,
- &TerminalDevice->SimpleTextOutput,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
- //
- // if the serial device is a hot plug device, attaches the HotPlugGuid
- // onto the terminal device handle.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiHotPlugDeviceGuid,
- NULL,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &TerminalDevice->Handle,
- &gEfiHotPlugDeviceGuid,
- NULL,
- NULL
- );
- }
- //
- // Register the Parent-Child relationship via
- // EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiSerialIoProtocolGuid,
- (VOID **) &TerminalDevice->SerialIo,
- This->DriverBindingHandle,
- TerminalDevice->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- if (DefaultNode != NULL) {
- FreePool (DefaultNode);
- }
-
- return EFI_SUCCESS;
-
-ReportError:
- //
- // Report error code before exiting
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_CONTROLLER_ERROR,
- DevicePath
- );
-
-Error:
- //
- // Use the Stop() function to free all resources allocated in Start()
- //
- if (TerminalDevice != NULL) {
-
- if (TerminalDevice->Handle != NULL) {
- This->Stop (This, Controller, 1, &TerminalDevice->Handle);
- } else {
-
- if (TerminalDevice->TwoSecondTimeOut != NULL) {
- gBS->CloseEvent (TerminalDevice->TwoSecondTimeOut);
- }
-
- if (TerminalDevice->SimpleInput.WaitForKey != NULL) {
- gBS->CloseEvent (TerminalDevice->SimpleInput.WaitForKey);
- }
-
- if (TerminalDevice->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (TerminalDevice->ControllerNameTable);
- }
-
- if (TerminalDevice->DevicePath != NULL) {
- FreePool (TerminalDevice->DevicePath);
- }
-
- FreePool (TerminalDevice);
- }
- }
-
- if (DefaultNode != NULL) {
- FreePool (DefaultNode);
- }
-
- This->Stop (This, Controller, 0, NULL);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-TerminalDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
-
- Stop a device controller.
-
- Arguments:
-
- This - A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
- Controller - A handle to the device being stopped.
- NumberOfChildren - The number of child device handles in ChildHandleBuffer.
- ChildHandleBuffer - An array of child handles to be freed.
-
- Returns:
-
- EFI_SUCCESS - Operation successful.
- EFI_DEVICE_ERROR - Devices error.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- BOOLEAN AllChildrenStopped;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *SimpleTextOutput;
- TERMINAL_DEV *TerminalDevice;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- Status = gBS->HandleProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Report that the remote terminal is being disabled
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_DISABLE,
- DevicePath
- );
-
- //
- // Complete all outstanding transactions to Controller.
- // Don't allow any new transaction to Controller to be started.
- //
- if (NumberOfChildren == 0) {
- //
- // Close the bus driver
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiCallerIdGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- //
- // Remove Parent Device Path from
- // the Console Device Environment Variables
- //
- TerminalRemoveConsoleDevVariable ((CHAR16 *)VarConsoleInpDev, ParentDevicePath);
- TerminalRemoveConsoleDevVariable ((CHAR16 *)VarConsoleOutDev, ParentDevicePath);
- TerminalRemoveConsoleDevVariable ((CHAR16 *)VarErrorOutDev, ParentDevicePath);
-
- //
- // Uninstall the Terminal Driver's GUID Tag from the Serial controller
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Controller,
- &gEfiCallerIdGuid,
- ParentDevicePath,
- NULL
- );
-
- //
- // Free the ParentDevicePath that was duplicated in Start()
- //
- if (!EFI_ERROR (Status)) {
- FreePool (ParentDevicePath);
- }
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return EFI_SUCCESS;
- }
-
- AllChildrenStopped = TRUE;
-
- for (Index = 0; Index < NumberOfChildren; Index++) {
-
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &SimpleTextOutput,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index],
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
-
- TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (SimpleTextOutput);
-
- gBS->CloseProtocol (
- Controller,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index]
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ChildHandleBuffer[Index],
- &gEfiSimpleTextInProtocolGuid,
- &TerminalDevice->SimpleInput,
- &gEfiSimpleTextOutProtocolGuid,
- &TerminalDevice->SimpleTextOutput,
- &gEfiDevicePathProtocolGuid,
- TerminalDevice->DevicePath,
- NULL
- );
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- Controller,
- &gEfiSerialIoProtocolGuid,
- (VOID **) &SerialIo,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index],
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
-
- if (TerminalDevice->ControllerNameTable != NULL) {
- FreeUnicodeStringTable (TerminalDevice->ControllerNameTable);
- }
-
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiHotPlugDeviceGuid,
- NULL,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ChildHandleBuffer[Index],
- &gEfiHotPlugDeviceGuid,
- NULL,
- NULL
- );
- } else {
- Status = EFI_SUCCESS;
- }
-
- gBS->CloseEvent (TerminalDevice->TwoSecondTimeOut);
- gBS->CloseEvent (TerminalDevice->SimpleInput.WaitForKey);
- FreePool (TerminalDevice->DevicePath);
- FreePool (TerminalDevice);
- }
- }
-
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-TerminalUpdateConsoleDevVariable (
- IN CHAR16 *VariableName,
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
- )
-{
- EFI_STATUS Status;
- UINTN VariableSize;
- UINT8 TerminalType;
- EFI_DEVICE_PATH_PROTOCOL *Variable;
- EFI_DEVICE_PATH_PROTOCOL *NewVariable;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
-
- Variable = NULL;
-
- //
- // Get global variable and its size according to the name given.
- //
- Variable = TerminalGetVariableAndSize (
- VariableName,
- &gEfiGlobalVariableGuid,
- &VariableSize
- );
- //
- // Append terminal device path onto the variable.
- //
- for (TerminalType = PcAnsiType; TerminalType <= VTUTF8Type; TerminalType++) {
- SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath);
- NewVariable = AppendDevicePathInstance (Variable, TempDevicePath);
- if (Variable != NULL) {
- FreePool (Variable);
- }
-
- if (TempDevicePath != NULL) {
- FreePool (TempDevicePath);
- }
-
- Variable = NewVariable;
- }
-
- VariableSize = GetDevicePathSize (Variable);
-
- Status = gRT->SetVariable (
- VariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- VariableSize,
- Variable
- );
- ASSERT_EFI_ERROR (Status);
- FreePool (Variable);
-
- return ;
-}
-
-VOID
-TerminalRemoveConsoleDevVariable (
- IN CHAR16 *VariableName,
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
- )
-/*++
-
- Routine Description:
-
- Remove console device variable.
-
- Arguments:
-
- VariableName - A pointer to the variable name.
- ParentDevicePath - A pointer to the parent device path.
-
- Returns:
-
---*/
-{
- EFI_STATUS Status;
- BOOLEAN FoundOne;
- BOOLEAN Match;
- UINTN VariableSize;
- UINTN InstanceSize;
- UINT8 TerminalType;
- EFI_DEVICE_PATH_PROTOCOL *Instance;
- EFI_DEVICE_PATH_PROTOCOL *Variable;
- EFI_DEVICE_PATH_PROTOCOL *OriginalVariable;
- EFI_DEVICE_PATH_PROTOCOL *NewVariable;
- EFI_DEVICE_PATH_PROTOCOL *SavedNewVariable;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
-
- Variable = NULL;
- Instance = NULL;
-
- //
- // Get global variable and its size according to the name given.
- //
- Variable = TerminalGetVariableAndSize (
- VariableName,
- &gEfiGlobalVariableGuid,
- &VariableSize
- );
- if (Variable == NULL) {
- return ;
- }
-
- FoundOne = FALSE;
- OriginalVariable = Variable;
- NewVariable = NULL;
-
- //
- // Get first device path instance from Variable
- //
- Instance = GetNextDevicePathInstance (&Variable, &InstanceSize);
- if (Instance == NULL) {
- FreePool (OriginalVariable);
- return ;
- }
- //
- // Loop through all the device path instances of Variable
- //
- do {
- //
- // Loop through all the terminal types that this driver supports
- //
- Match = FALSE;
- for (TerminalType = PcAnsiType; TerminalType <= VTUTF8Type; TerminalType++) {
-
- SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath);
-
- //
- // Compare the genterated device path to the current device path instance
- //
- if (TempDevicePath != NULL) {
- if (CompareMem (Instance, TempDevicePath, InstanceSize) == 0) {
- Match = TRUE;
- FoundOne = TRUE;
- }
-
- FreePool (TempDevicePath);
- }
- }
- //
- // If a match was not found, then keep the current device path instance
- //
- if (!Match) {
- SavedNewVariable = NewVariable;
- NewVariable = AppendDevicePathInstance (NewVariable, Instance);
- if (SavedNewVariable != NULL) {
- FreePool (SavedNewVariable);
- }
- }
- //
- // Get next device path instance from Variable
- //
- FreePool (Instance);
- Instance = GetNextDevicePathInstance (&Variable, &InstanceSize);
- } while (Instance != NULL);
-
- FreePool (OriginalVariable);
-
- if (FoundOne) {
- VariableSize = GetDevicePathSize (NewVariable);
-
- Status = gRT->SetVariable (
- VariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- VariableSize,
- NewVariable
- );
- ASSERT_EFI_ERROR (Status);
- }
-
- if (NewVariable != NULL) {
- FreePool (NewVariable);
- }
-
- return ;
-}
-
-VOID *
-TerminalGetVariableAndSize (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid,
- OUT UINTN *VariableSize
- )
-/*++
-
-Routine Description:
- Read the EFI variable (VendorGuid/Name) and return a dynamically allocated
- buffer, and the size of the buffer. On failure return NULL.
-
-Arguments:
- Name - String part of EFI variable name
-
- VendorGuid - GUID part of EFI variable name
-
- VariableSize - Returns the size of the EFI variable that was read
-
-Returns:
- Dynamically allocated memory that contains a copy of the EFI variable.
- Caller is repsoncible freeing the buffer.
-
- NULL - Variable was not read
-
---*/
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- VOID *Buffer;
-
- Buffer = NULL;
-
- //
- // Pass in a small size buffer to find the actual variable size.
- //
- BufferSize = 1;
- Buffer = AllocatePool (BufferSize);
- if (Buffer == NULL) {
- *VariableSize = 0;
- return NULL;
- }
-
- Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
-
- if (Status == EFI_SUCCESS) {
- *VariableSize = BufferSize;
- return Buffer;
-
- } else if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // Allocate the buffer to return
- //
- FreePool (Buffer);
- Buffer = AllocatePool (BufferSize);
- if (Buffer == NULL) {
- *VariableSize = 0;
- return NULL;
- }
- //
- // Read variable into the allocated buffer.
- //
- Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
- if (EFI_ERROR (Status)) {
- BufferSize = 0;
- FreePool (Buffer);
- Buffer = NULL;
- }
- } else {
- //
- // Variable not found or other errors met.
- //
- BufferSize = 0;
- FreePool (Buffer);
- Buffer = NULL;
- }
-
- *VariableSize = BufferSize;
- return Buffer;
-}
-
-EFI_STATUS
-SetTerminalDevicePath (
- IN UINT8 TerminalType,
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
- OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath
- )
-{
- VENDOR_DEVICE_PATH Node;
-
- *TerminalDevicePath = NULL;
- Node.Header.Type = MESSAGING_DEVICE_PATH;
- Node.Header.SubType = MSG_VENDOR_DP;
-
- //
- // generate terminal device path node according to terminal type.
- //
- switch (TerminalType) {
-
- case PcAnsiType:
- CopyMem (
- &Node.Guid,
- &gEfiPcAnsiGuid,
- sizeof (EFI_GUID)
- );
- break;
-
- case VT100Type:
- CopyMem (
- &Node.Guid,
- &gEfiVT100Guid,
- sizeof (EFI_GUID)
- );
- break;
-
- case VT100PlusType:
- CopyMem (
- &Node.Guid,
- &gEfiVT100PlusGuid,
- sizeof (EFI_GUID)
- );
- break;
-
- case VTUTF8Type:
- CopyMem (
- &Node.Guid,
- &gEfiVTUTF8Guid,
- sizeof (EFI_GUID)
- );
- break;
-
- default:
- return EFI_UNSUPPORTED;
- break;
- }
-
- SetDevicePathNodeLength (
- &Node.Header,
- sizeof (VENDOR_DEVICE_PATH)
- );
- //
- // append the terminal node onto parent device path
- // to generate a complete terminal device path.
- //
- *TerminalDevicePath = AppendDevicePathNode (
- ParentDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Node
- );
- if (*TerminalDevicePath == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-InitializeRawFiFo (
- IN TERMINAL_DEV *TerminalDevice
- )
-{
- //
- // Make the raw fifo empty.
- //
- TerminalDevice->RawFiFo.Head = TerminalDevice->RawFiFo.Tail;
-}
-
-VOID
-InitializeUnicodeFiFo (
- IN TERMINAL_DEV *TerminalDevice
- )
-{
- //
- // Make the unicode fifo empty
- //
- TerminalDevice->UnicodeFiFo.Head = TerminalDevice->UnicodeFiFo.Tail;
-}
-
-VOID
-InitializeEfiKeyFiFo (
- IN TERMINAL_DEV *TerminalDevice
- )
-{
- //
- // Make the efi key fifo empty
- //
- TerminalDevice->EfiKeyFiFo.Head = TerminalDevice->EfiKeyFiFo.Tail;
-}
diff --git a/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.h b/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.h
deleted file mode 100644
index e7ce1dc..0000000
--- a/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.h
+++ /dev/null
@@ -1,549 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- terminal.h
-
-Abstract:
-
-
-Revision History
-
---*/
-
-#ifndef _TERMINAL_H
-#define _TERMINAL_H
-
-#define RAW_FIFO_MAX_NUMBER 256
-#define FIFO_MAX_NUMBER 128
-
-typedef struct {
- UINT8 Head;
- UINT8 Tail;
- UINT8 Data[RAW_FIFO_MAX_NUMBER + 1];
-} RAW_DATA_FIFO;
-
-typedef struct {
- UINT8 Head;
- UINT8 Tail;
- UINT16 Data[FIFO_MAX_NUMBER + 1];
-} UNICODE_FIFO;
-
-typedef struct {
- UINT8 Head;
- UINT8 Tail;
- EFI_INPUT_KEY Data[FIFO_MAX_NUMBER + 1];
-} EFI_KEY_FIFO;
-
-#define TERMINAL_DEV_SIGNATURE EFI_SIGNATURE_32 ('t', 'm', 'n', 'l')
-
-typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle;
- UINT8 TerminalType;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- VENDOR_DEVICE_PATH Node;
- EFI_SIMPLE_TEXT_IN_PROTOCOL SimpleInput;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL SimpleTextOutput;
- EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
- UINTN SerialInTimeOut;
- RAW_DATA_FIFO RawFiFo;
- UNICODE_FIFO UnicodeFiFo;
- EFI_KEY_FIFO EfiKeyFiFo;
- EFI_UNICODE_STRING_TABLE *ControllerNameTable;
- EFI_EVENT TwoSecondTimeOut;
- UINT32 InputState;
- UINT32 ResetState;
-
- //
- // Esc could not be output to the screen by user,
- // but the terminal driver need to output it to
- // the terminal emulation software to send control sequence.
- // This boolean is used by the terminal driver only
- // to indicate whether the Esc could be sent or not.
- //
- BOOLEAN OutputEscChar;
-} TERMINAL_DEV;
-
-#define INPUT_STATE_DEFAULT 0x00
-#define INPUT_STATE_ESC 0x01
-#define INPUT_STATE_CSI 0x02
-#define INPUT_STATE_LEFTOPENBRACKET 0x04
-#define INPUT_STATE_O 0x08
-#define INPUT_STATE_2 0x10
-
-#define RESET_STATE_DEFAULT 0x00
-#define RESET_STATE_ESC_R 0x01
-#define RESET_STATE_ESC_R_ESC_r 0x02
-
-#define TERMINAL_CON_IN_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleInput, TERMINAL_DEV_SIGNATURE)
-#define TERMINAL_CON_OUT_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleTextOutput, TERMINAL_DEV_SIGNATURE)
-
-typedef union {
- UINT8 Utf8_1;
- UINT8 Utf8_2[2];
- UINT8 Utf8_3[3];
-} UTF8_CHAR;
-
-#define PcAnsiType 0
-#define VT100Type 1
-#define VT100PlusType 2
-#define VTUTF8Type 3
-
-#define LEFTOPENBRACKET 0x5b // '['
-#define ACAP 0x41
-#define BCAP 0x42
-#define CCAP 0x43
-#define DCAP 0x44
-
-#define MODE0_COLUMN_COUNT 80
-#define MODE0_ROW_COUNT 25
-
-#define BACKSPACE 8
-#define ESC 27
-#define CSI 0x9B
-#define DEL 127
-#define BRIGHT_CONTROL_OFFSET 2
-#define FOREGROUND_CONTROL_OFFSET 6
-#define BACKGROUND_CONTROL_OFFSET 11
-#define ROW_OFFSET 2
-#define COLUMN_OFFSET 5
-
-typedef struct {
- UINT16 Unicode;
- CHAR8 PcAnsi;
- CHAR8 Ascii;
-} UNICODE_TO_CHAR;
-
-#define VarConsoleInpDev L"ConInDev"
-#define VarConsoleOutDev L"ConOutDev"
-#define VarErrorOutDev L"ErrOutDev"
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gTerminalComponentName;
-
-//
-// Prototypes
-//
-EFI_STATUS
-EFIAPI
-InitializeTerminal (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConInReset (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-;
-
-VOID
-EFIAPI
-TerminalConInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConOutReset (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConOutOutputString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConOutTestString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConOutSetMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Attribute
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConOutClearScreen (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConOutSetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalConOutEnableCursor (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN Visible
- )
-;
-
-EFI_STATUS
-EFIAPI
-TerminalDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-TerminalDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-TerminalDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-EFI_STATUS
-EFIAPI
-TerminalComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-TerminalComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// internal functions
-//
-EFI_STATUS
-TerminalConInCheckForKey (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This
- )
-;
-
-VOID
-TerminalUpdateConsoleDevVariable (
- IN CHAR16 *VariableName,
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
- )
-;
-
-VOID
-TerminalRemoveConsoleDevVariable (
- IN CHAR16 *VariableName,
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
- )
-;
-
-VOID *
-TerminalGetVariableAndSize (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid,
- OUT UINTN *VariableSize
- )
-;
-
-EFI_STATUS
-SetTerminalDevicePath (
- IN UINT8 TerminalType,
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
- OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath
- )
-;
-
-VOID
-InitializeRawFiFo (
- IN TERMINAL_DEV *TerminalDevice
- )
-;
-
-VOID
-InitializeUnicodeFiFo (
- IN TERMINAL_DEV *TerminalDevice
- )
-;
-
-VOID
-InitializeEfiKeyFiFo (
- IN TERMINAL_DEV *TerminalDevice
- )
-;
-
-EFI_STATUS
-GetOneKeyFromSerial (
- EFI_SERIAL_IO_PROTOCOL *SerialIo,
- UINT8 *Input
- )
-;
-
-BOOLEAN
-RawFiFoInsertOneKey (
- TERMINAL_DEV *TerminalDevice,
- UINT8 Input
- )
-;
-
-BOOLEAN
-RawFiFoRemoveOneKey (
- TERMINAL_DEV *TerminalDevice,
- UINT8 *Output
- )
-;
-
-BOOLEAN
-IsRawFiFoEmpty (
- TERMINAL_DEV *TerminalDevice
- )
-;
-
-BOOLEAN
-IsRawFiFoFull (
- TERMINAL_DEV *TerminalDevice
- )
-;
-
-BOOLEAN
-EfiKeyFiFoInsertOneKey (
- TERMINAL_DEV *TerminalDevice,
- EFI_INPUT_KEY Key
- )
-;
-
-BOOLEAN
-EfiKeyFiFoRemoveOneKey (
- TERMINAL_DEV *TerminalDevice,
- EFI_INPUT_KEY *Output
- )
-;
-
-BOOLEAN
-IsEfiKeyFiFoEmpty (
- TERMINAL_DEV *TerminalDevice
- )
-;
-
-BOOLEAN
-IsEfiKeyFiFoFull (
- TERMINAL_DEV *TerminalDevice
- )
-;
-
-BOOLEAN
-UnicodeFiFoInsertOneKey (
- TERMINAL_DEV *TerminalDevice,
- UINT16 Input
- )
-;
-
-BOOLEAN
-UnicodeFiFoRemoveOneKey (
- TERMINAL_DEV *TerminalDevice,
- UINT16 *Output
- )
-;
-
-BOOLEAN
-IsUnicodeFiFoEmpty (
- TERMINAL_DEV *TerminalDevice
- )
-;
-
-BOOLEAN
-IsUnicodeFiFoFull (
- TERMINAL_DEV *TerminalDevice
- )
-;
-
-UINT8
-UnicodeFiFoGetKeyCount (
- TERMINAL_DEV *TerminalDevice
- )
-;
-
-VOID
-TranslateRawDataToEfiKey (
- IN TERMINAL_DEV *TerminalDevice
- )
-;
-
-//
-// internal functions for PC ANSI
-//
-VOID
-AnsiRawDataToUnicode (
- IN TERMINAL_DEV *PcAnsiDevice
- )
-;
-
-VOID
-UnicodeToEfiKey (
- IN TERMINAL_DEV *PcAnsiDevice
- )
-;
-
-EFI_STATUS
-AnsiTestString (
- IN TERMINAL_DEV *TerminalDevice,
- IN CHAR16 *WString
- )
-;
-
-//
-// internal functions for VT100
-//
-EFI_STATUS
-VT100TestString (
- IN TERMINAL_DEV *VT100Device,
- IN CHAR16 *WString
- )
-;
-
-//
-// internal functions for VT100Plus
-//
-EFI_STATUS
-VT100PlusTestString (
- IN TERMINAL_DEV *TerminalDevice,
- IN CHAR16 *WString
- )
-;
-
-//
-// internal functions for VTUTF8
-//
-VOID
-VTUTF8RawDataToUnicode (
- IN TERMINAL_DEV *VtUtf8Device
- )
-;
-
-EFI_STATUS
-VTUTF8TestString (
- IN TERMINAL_DEV *TerminalDevice,
- IN CHAR16 *WString
- )
-;
-
-VOID
-UnicodeToUtf8 (
- IN CHAR16 Unicode,
- OUT UTF8_CHAR *Utf8Char,
- OUT UINT8 *ValidBytes
- )
-;
-
-VOID
-GetOneValidUtf8Char (
- IN TERMINAL_DEV *Utf8Device,
- OUT UTF8_CHAR *Utf8Char,
- OUT UINT8 *ValidBytes
- )
-;
-
-VOID
-Utf8ToUnicode (
- IN UTF8_CHAR Utf8Char,
- IN UINT8 ValidBytes,
- OUT CHAR16 *UnicodeChar
- )
-;
-
-//
-// functions for boxdraw unicode
-//
-BOOLEAN
-TerminalIsValidTextGraphics (
- IN CHAR16 Graphic,
- OUT CHAR8 *PcAnsi, OPTIONAL
- OUT CHAR8 *Ascii OPTIONAL
- )
-;
-
-BOOLEAN
-TerminalIsValidAscii (
- IN CHAR16 Ascii
- )
-;
-
-BOOLEAN
-TerminalIsValidEfiCntlChar (
- IN CHAR16 CharC
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.msa b/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.msa
deleted file mode 100644
index 1c1dc06..0000000
--- a/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.msa
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>Terminal</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>9E863906-A40F-4875-977F-5B93FF237FC6</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Terminal module.</Abstract>
- <Description>This driver installs Simple Text In/Out protocol for terminal devices (serial devices or hotplug devices).</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Terminal</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Terminal.h</Filename>
- <Filename>Terminal.c</Filename>
- <Filename>TerminalConIn.c</Filename>
- <Filename>TerminalConOut.c</Filename>
- <Filename>ansi.c</Filename>
- <Filename>vtutf8.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiHotPlugDeviceGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Variables>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x0043 0x006F 0x006E 0x0049 0x006E 0x0044 0x0065 0x0076</VariableName>
- <GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
- <HelpText>L"ConInDev" global variable will be updated if the serial device is not a hot plug device.</HelpText>
- </Variable>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x0043 0x006F 0x006E 0x004F 0x0075 0x0074 0x0044 0x0065 0x0076</VariableName>
- <GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
- <HelpText>L"ConOutDev" global variable will be updated if the serial device is not a hot plug device.</HelpText>
- </Variable>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x0045 0x0072 0x0072 0x004F 0x0075 0x0074 0x0044 0x0065 0x0076</VariableName>
- <GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
- <HelpText>L"ErrOutDev" global variable will be updated if the serial device is not a hot plug device.</HelpText>
- </Variable>
- </Variables>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiGlobalVariableGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiPcAnsiGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiVT100PlusGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiVT100Guid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiVTUTF8Guid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gTerminalDriverBinding</DriverBinding>
- <ComponentName>gTerminalComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Console/Terminal/Dxe/TerminalConIn.c b/EdkModulePkg/Universal/Console/Terminal/Dxe/TerminalConIn.c
deleted file mode 100644
index 81142af..0000000
--- a/EdkModulePkg/Universal/Console/Terminal/Dxe/TerminalConIn.c
+++ /dev/null
@@ -1,1177 +0,0 @@
-/**@file
- Implementation for EFI_SIMPLE_TEXT_IN_PROTOCOL protocol.
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Terminal.h"
-
-EFI_STATUS
-EFIAPI
-TerminalConInReset (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
- Routine Description:
-
- Implements EFI_SIMPLE_TEXT_IN_PROTOCOL.Reset().
- This driver only perform dependent serial device reset regardless of
- the value of ExtendeVerification
-
- Arguments:
-
- This - Indicates the calling context.
-
- ExtendedVerification - Skip by this driver.
-
- Returns:
-
- EFI_SUCCESS
- The reset operation succeeds.
-
- EFI_DEVICE_ERROR
- The dependent serial port reset fails.
-
---*/
-{
- EFI_STATUS Status;
- TERMINAL_DEV *TerminalDevice;
-
- TerminalDevice = TERMINAL_CON_IN_DEV_FROM_THIS (This);
-
- //
- // Report progress code here
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET,
- TerminalDevice->DevicePath
- );
-
- Status = TerminalDevice->SerialIo->Reset (TerminalDevice->SerialIo);
-
- //
- // clear all the internal buffer for keys
- //
- InitializeRawFiFo (TerminalDevice);
- InitializeUnicodeFiFo (TerminalDevice);
- InitializeEfiKeyFiFo (TerminalDevice);
-
- if (EFI_ERROR (Status)) {
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_CONTROLLER_ERROR,
- TerminalDevice->DevicePath
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-TerminalConInReadKeyStroke (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This,
- OUT EFI_INPUT_KEY *Key
- )
-/*++
- Routine Description:
-
- Implements EFI_SIMPLE_TEXT_IN_PROTOCOL.ReadKeyStroke().
-
- Arguments:
-
- This - Indicates the calling context.
-
- Key - A pointer to a buffer that is filled in with the keystroke
- information for the key that was sent from terminal.
-
- Returns:
-
- EFI_SUCCESS
- The keystroke information is returned successfully.
-
- EFI_NOT_READY
- There is no keystroke data available.
-
- EFI_DEVICE_ERROR
- The dependent serial device encounters error.
-
---*/
-{
- TERMINAL_DEV *TerminalDevice;
- EFI_STATUS Status;
-
- //
- // Initialize *Key to nonsense value.
- //
- Key->ScanCode = SCAN_NULL;
- Key->UnicodeChar = 0;
- //
- // get TERMINAL_DEV from "This" parameter.
- //
- TerminalDevice = TERMINAL_CON_IN_DEV_FROM_THIS (This);
-
- Status = TerminalConInCheckForKey (This);
- if (EFI_ERROR (Status)) {
- return EFI_NOT_READY;
- }
-
- EfiKeyFiFoRemoveOneKey (TerminalDevice, Key);
-
- return EFI_SUCCESS;
-
-}
-
-VOID
-TranslateRawDataToEfiKey (
- IN TERMINAL_DEV *TerminalDevice
- )
-/*++
- Step1: Turn raw data into Unicode (according to different encode).
- Step2: Translate Unicode into key information.
- (according to different terminal standard).
---*/
-{
- switch (TerminalDevice->TerminalType) {
-
- case PcAnsiType:
- case VT100Type:
- case VT100PlusType:
- AnsiRawDataToUnicode (TerminalDevice);
- UnicodeToEfiKey (TerminalDevice);
- break;
-
- case VTUTF8Type:
- //
- // Process all the raw data in the RawFIFO,
- // put the processed key into UnicodeFIFO.
- //
- VTUTF8RawDataToUnicode (TerminalDevice);
-
- //
- // Translate all the Unicode data in the UnicodeFIFO to Efi key,
- // then put into EfiKeyFIFO.
- //
- UnicodeToEfiKey (TerminalDevice);
-
- break;
- }
-}
-
-VOID
-EFIAPI
-TerminalConInWaitForKey (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
- Routine Description:
-
- Event notification function for EFI_SIMPLE_TEXT_IN_PROTOCOL.WaitForKey event
- Signal the event if there is key available
-
- Arguments:
-
- Event - Indicates the event that invoke this function.
-
- Context - Indicates the calling context.
-
- Returns:
-
- N/A
-
---*/
-{
- //
- // Someone is waiting on the keystroke event, if there's
- // a key pending, signal the event
- //
- // Context is the pointer to EFI_SIMPLE_TEXT_IN_PROTOCOL
- //
- if (!EFI_ERROR (TerminalConInCheckForKey (Context))) {
-
- gBS->SignalEvent (Event);
- }
-}
-
-EFI_STATUS
-TerminalConInCheckForKey (
- IN EFI_SIMPLE_TEXT_IN_PROTOCOL *This
- )
-/*++
- Routine Description:
-
- Check for a pending key in the Efi Key FIFO or Serial device buffer.
-
- Arguments:
-
- This - Indicates the calling context.
-
- Returns:
-
- EFI_SUCCESS
- There is key pending.
-
- EFI_NOT_READY
- There is no key pending.
-
- EFI_DEVICE_ERROR
-
---*/
-{
- EFI_STATUS Status;
- TERMINAL_DEV *TerminalDevice;
- UINT32 Control;
- UINT8 Input;
- EFI_SERIAL_IO_MODE *Mode;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- UINTN SerialInTimeOut;
-
- TerminalDevice = TERMINAL_CON_IN_DEV_FROM_THIS (This);
-
- SerialIo = TerminalDevice->SerialIo;
- if (SerialIo == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- // if current timeout value for serial device is not identical with
- // the value saved in TERMINAL_DEV structure, then recalculate the
- // timeout value again and set serial attribute according to this value.
- //
- Mode = SerialIo->Mode;
- if (Mode->Timeout != TerminalDevice->SerialInTimeOut) {
-
- SerialInTimeOut = 0;
- if (Mode->BaudRate != 0) {
- SerialInTimeOut = (1 + Mode->DataBits + Mode->StopBits) * 2 * 1000000 / (UINTN) Mode->BaudRate;
- }
-
- Status = SerialIo->SetAttributes (
- SerialIo,
- Mode->BaudRate,
- Mode->ReceiveFifoDepth,
- (UINT32) SerialInTimeOut,
- (EFI_PARITY_TYPE) (Mode->Parity),
- (UINT8) Mode->DataBits,
- (EFI_STOP_BITS_TYPE) (Mode->StopBits)
- );
-
- if (EFI_ERROR (Status)) {
- TerminalDevice->SerialInTimeOut = 0;
- } else {
- TerminalDevice->SerialInTimeOut = SerialInTimeOut;
- }
- }
- //
- // check whether serial buffer is empty
- //
- Status = SerialIo->GetControl (SerialIo, &Control);
-
- if (Control & EFI_SERIAL_INPUT_BUFFER_EMPTY) {
- //
- // Translate all the raw data in RawFIFO into EFI Key,
- // according to different terminal type supported.
- //
- TranslateRawDataToEfiKey (TerminalDevice);
-
- //
- // if there is pre-fetched Efi Key in EfiKeyFIFO buffer,
- // return directly.
- //
- if (!IsEfiKeyFiFoEmpty (TerminalDevice)) {
- return EFI_SUCCESS;
- } else {
- return EFI_NOT_READY;
- }
- }
- //
- // Fetch all the keys in the serial buffer,
- // and insert the byte stream into RawFIFO.
- //
- do {
-
- Status = GetOneKeyFromSerial (TerminalDevice->SerialIo, &Input);
-
- if (EFI_ERROR (Status)) {
- if (Status == EFI_DEVICE_ERROR) {
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_INPUT_ERROR,
- TerminalDevice->DevicePath
- );
- }
- break;
- }
-
- RawFiFoInsertOneKey (TerminalDevice, Input);
- } while (TRUE);
-
- //
- // Translate all the raw data in RawFIFO into EFI Key,
- // according to different terminal type supported.
- //
- TranslateRawDataToEfiKey (TerminalDevice);
-
- if (IsEfiKeyFiFoEmpty (TerminalDevice)) {
- return EFI_NOT_READY;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetOneKeyFromSerial (
- EFI_SERIAL_IO_PROTOCOL *SerialIo,
- UINT8 *Input
- )
-/*++
- Get one key out of serial buffer.
- If serial buffer is empty, return EFI_NOT_READY;
- if reading serial buffer encounter error, returns EFI_DEVICE_ERROR;
- if reading serial buffer successfully, put the fetched key to
- the parameter "Input", and return EFI_SUCCESS.
---*/
-{
- EFI_STATUS Status;
- UINTN Size;
-
- Size = 1;
- *Input = 0;
-
- Status = SerialIo->Read (SerialIo, &Size, Input);
-
- if (EFI_ERROR (Status)) {
-
- if (Status == EFI_TIMEOUT) {
- return EFI_NOT_READY;
- }
-
- return EFI_DEVICE_ERROR;
-
- }
-
- if (*Input == 0) {
- return EFI_NOT_READY;
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-RawFiFoInsertOneKey (
- TERMINAL_DEV *TerminalDevice,
- UINT8 Input
- )
-/*++
- Insert one byte raw data into the Raw Data FIFO.
- If FIFO is FULL before data insertion,
- return FALSE, and the key is lost.
---*/
-{
- UINT8 Tail;
-
- Tail = TerminalDevice->RawFiFo.Tail;
-
- if (IsRawFiFoFull (TerminalDevice)) {
- //
- // Raw FIFO is full
- //
- return FALSE;
- }
-
- TerminalDevice->RawFiFo.Data[Tail] = Input;
-
- TerminalDevice->RawFiFo.Tail = (UINT8) ((Tail + 1) % (RAW_FIFO_MAX_NUMBER + 1));
-
- return TRUE;
-}
-
-BOOLEAN
-RawFiFoRemoveOneKey (
- TERMINAL_DEV *TerminalDevice,
- UINT8 *Output
- )
-/*++
- Remove one byte raw data out of the Raw Data FIFO.
- If FIFO buffer is empty before remove operation,
- return FALSE.
---*/
-{
- UINT8 Head;
-
- Head = TerminalDevice->RawFiFo.Head;
-
- if (IsRawFiFoEmpty (TerminalDevice)) {
- //
- // FIFO is empty
- //
- *Output = 0;
- return FALSE;
- }
-
- *Output = TerminalDevice->RawFiFo.Data[Head];
-
- TerminalDevice->RawFiFo.Head = (UINT8) ((Head + 1) % (RAW_FIFO_MAX_NUMBER + 1));
-
- return TRUE;
-}
-
-BOOLEAN
-IsRawFiFoEmpty (
- TERMINAL_DEV *TerminalDevice
- )
-/*++
- Clarify whether FIFO buffer is empty.
---*/
-{
- if (TerminalDevice->RawFiFo.Head == TerminalDevice->RawFiFo.Tail) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsRawFiFoFull (
- TERMINAL_DEV *TerminalDevice
- )
-/*++
- Clarify whether FIFO buffer is full.
---*/
-{
- UINT8 Tail;
- UINT8 Head;
-
- Tail = TerminalDevice->RawFiFo.Tail;
- Head = TerminalDevice->RawFiFo.Head;
-
- if (((Tail + 1) % (RAW_FIFO_MAX_NUMBER + 1)) == Head) {
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOLEAN
-EfiKeyFiFoInsertOneKey (
- TERMINAL_DEV *TerminalDevice,
- EFI_INPUT_KEY Key
- )
-/*++
- Insert one pre-fetched key into the FIFO buffer.
- If FIFO buffer is FULL before key insertion,
- return FALSE, and the key is lost.
---*/
-{
- UINT8 Tail;
-
- Tail = TerminalDevice->EfiKeyFiFo.Tail;
-
- if (IsEfiKeyFiFoFull (TerminalDevice)) {
- //
- // Efi Key FIFO is full
- //
- return FALSE;
- }
-
- TerminalDevice->EfiKeyFiFo.Data[Tail] = Key;
-
- TerminalDevice->EfiKeyFiFo.Tail = (UINT8) ((Tail + 1) % (FIFO_MAX_NUMBER + 1));
-
- return TRUE;
-}
-
-BOOLEAN
-EfiKeyFiFoRemoveOneKey (
- TERMINAL_DEV *TerminalDevice,
- EFI_INPUT_KEY *Output
- )
-/*++
- Remove one pre-fetched key out of the FIFO buffer.
- If FIFO buffer is empty before remove operation,
- return FALSE.
---*/
-{
- UINT8 Head;
-
- Head = TerminalDevice->EfiKeyFiFo.Head;
-
- if (IsEfiKeyFiFoEmpty (TerminalDevice)) {
- //
- // FIFO is empty
- //
- Output->ScanCode = SCAN_NULL;
- Output->UnicodeChar = 0;
- return FALSE;
- }
-
- *Output = TerminalDevice->EfiKeyFiFo.Data[Head];
-
- TerminalDevice->EfiKeyFiFo.Head = (UINT8) ((Head + 1) % (FIFO_MAX_NUMBER + 1));
-
- return TRUE;
-}
-
-BOOLEAN
-IsEfiKeyFiFoEmpty (
- TERMINAL_DEV *TerminalDevice
- )
-/*++
- Clarify whether FIFO buffer is empty.
---*/
-{
- if (TerminalDevice->EfiKeyFiFo.Head == TerminalDevice->EfiKeyFiFo.Tail) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsEfiKeyFiFoFull (
- TERMINAL_DEV *TerminalDevice
- )
-/*++
- Clarify whether FIFO buffer is full.
---*/
-{
- UINT8 Tail;
- UINT8 Head;
-
- Tail = TerminalDevice->EfiKeyFiFo.Tail;
- Head = TerminalDevice->EfiKeyFiFo.Head;
-
- if (((Tail + 1) % (FIFO_MAX_NUMBER + 1)) == Head) {
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOLEAN
-UnicodeFiFoInsertOneKey (
- TERMINAL_DEV *TerminalDevice,
- UINT16 Input
- )
-/*++
- Insert one pre-fetched key into the FIFO buffer.
- If FIFO buffer is FULL before key insertion,
- return FALSE, and the key is lost.
---*/
-{
- UINT8 Tail;
-
- Tail = TerminalDevice->UnicodeFiFo.Tail;
-
- if (IsUnicodeFiFoFull (TerminalDevice)) {
- //
- // Unicode FIFO is full
- //
- return FALSE;
- }
-
- TerminalDevice->UnicodeFiFo.Data[Tail] = Input;
-
- TerminalDevice->UnicodeFiFo.Tail = (UINT8) ((Tail + 1) % (FIFO_MAX_NUMBER + 1));
-
- return TRUE;
-}
-
-BOOLEAN
-UnicodeFiFoRemoveOneKey (
- TERMINAL_DEV *TerminalDevice,
- UINT16 *Output
- )
-/*++
- Remove one pre-fetched key out of the FIFO buffer.
- If FIFO buffer is empty before remove operation,
- return FALSE.
---*/
-{
- UINT8 Head;
-
- Head = TerminalDevice->UnicodeFiFo.Head;
-
- if (IsUnicodeFiFoEmpty (TerminalDevice)) {
- //
- // FIFO is empty
- //
- Output = NULL;
- return FALSE;
- }
-
- *Output = TerminalDevice->UnicodeFiFo.Data[Head];
-
- TerminalDevice->UnicodeFiFo.Head = (UINT8) ((Head + 1) % (FIFO_MAX_NUMBER + 1));
-
- return TRUE;
-}
-
-BOOLEAN
-IsUnicodeFiFoEmpty (
- TERMINAL_DEV *TerminalDevice
- )
-/*++
- Clarify whether FIFO buffer is empty.
---*/
-{
- if (TerminalDevice->UnicodeFiFo.Head == TerminalDevice->UnicodeFiFo.Tail) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-BOOLEAN
-IsUnicodeFiFoFull (
- TERMINAL_DEV *TerminalDevice
- )
-/*++
- Clarify whether FIFO buffer is full.
---*/
-{
- UINT8 Tail;
- UINT8 Head;
-
- Tail = TerminalDevice->UnicodeFiFo.Tail;
- Head = TerminalDevice->UnicodeFiFo.Head;
-
- if (((Tail + 1) % (FIFO_MAX_NUMBER + 1)) == Head) {
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-UINT8
-UnicodeFiFoGetKeyCount (
- TERMINAL_DEV *TerminalDevice
- )
-{
- UINT8 Tail;
- UINT8 Head;
-
- Tail = TerminalDevice->UnicodeFiFo.Tail;
- Head = TerminalDevice->UnicodeFiFo.Head;
-
- if (Tail >= Head) {
- return (UINT8) (Tail - Head);
- } else {
- return (UINT8) (Tail + FIFO_MAX_NUMBER + 1 - Head);
- }
-}
-
-STATIC
-VOID
-UnicodeToEfiKeyFlushState (
- IN TERMINAL_DEV *TerminalDevice
- )
-{
- EFI_INPUT_KEY Key;
-
- if (TerminalDevice->InputState & INPUT_STATE_ESC) {
- Key.ScanCode = SCAN_ESC;
- Key.UnicodeChar = 0;
- EfiKeyFiFoInsertOneKey (TerminalDevice, Key);
- }
-
- if (TerminalDevice->InputState & INPUT_STATE_CSI) {
- Key.ScanCode = SCAN_NULL;
- Key.UnicodeChar = CSI;
- EfiKeyFiFoInsertOneKey (TerminalDevice, Key);
- }
-
- if (TerminalDevice->InputState & INPUT_STATE_LEFTOPENBRACKET) {
- Key.ScanCode = SCAN_NULL;
- Key.UnicodeChar = LEFTOPENBRACKET;
- EfiKeyFiFoInsertOneKey (TerminalDevice, Key);
- }
-
- if (TerminalDevice->InputState & INPUT_STATE_O) {
- Key.ScanCode = SCAN_NULL;
- Key.UnicodeChar = 'O';
- EfiKeyFiFoInsertOneKey (TerminalDevice, Key);
- }
-
- if (TerminalDevice->InputState & INPUT_STATE_2) {
- Key.ScanCode = SCAN_NULL;
- Key.UnicodeChar = '2';
- EfiKeyFiFoInsertOneKey (TerminalDevice, Key);
- }
-
- gBS->SetTimer (
- TerminalDevice->TwoSecondTimeOut,
- TimerCancel,
- 0
- );
-
- TerminalDevice->InputState = INPUT_STATE_DEFAULT;
-}
-
-VOID
-UnicodeToEfiKey (
- IN TERMINAL_DEV *TerminalDevice
- )
-/*++
- Routine Description:
-
- Converts a stream of Unicode characters from a terminal input device into EFI Keys that
- can be read through the Simple Input Protocol. The table below shows the keyboard
- input mappings that this function supports. If the ESC sequence listed in one of the
- columns is presented, then it is translated into the coorespoding EFI Scan Code. If a
- matching sequence is not found, then the raw key strokes are converted into EFI Keys.
-
- 2 seconds are allowed for an ESC sequence to be completed. If the ESC sequence is not
- completed in 2 seconds, then the raw key strokes of the partial ESC sequence are
- converted into EFI Keys.
-
- There is one special input sequence that will force the system to reset.
- This is ESC R ESC r ESC R.
-
- Arguments:
-
- TerminaDevice : The terminal device to use to translate raw input into EFI Keys
-
- Returns:
-
- None
-
-Symbols used in table below
-===========================
- ESC = 0x1B
- CSI = 0x9B
- DEL = 0x7f
- ^ = CTRL
-
-+=========+======+===========+==========+==========+
-| | EFI | EFI 1.10 | | |
-| | Scan | | VT100+ | |
-| KEY | Code | PC ANSI | VTUTF8 | VT100 |
-+=========+======+===========+==========+==========+
-| NULL | 0x00 | | | |
-| UP | 0x01 | ESC [ A | ESC [ A | ESC [ A |
-| DOWN | 0x02 | ESC [ B | ESC [ B | ESC [ B |
-| RIGHT | 0x03 | ESC [ C | ESC [ C | ESC [ C |
-| LEFT | 0x04 | ESC [ D | ESC [ D | ESC [ D |
-| HOME | 0x05 | ESC [ H | ESC h | ESC [ H |
-| END | 0x06 | ESC [ F | ESC k | ESC [ K |
-| INSERT | 0x07 | ESC [ @ | ESC + | ESC [ @ |
-| | | ESC [ L | | ESC [ L |
-| DELETE | 0x08 | ESC [ X | ESC - | ESC [ P |
-| PG UP | 0x09 | ESC [ I | ESC ? | ESC [ V |
-| | | | | ESC [ ? |
-| PG DOWN | 0x0A | ESC [ G | ESC / | ESC [ U |
-| | | | | ESC [ / |
-| F1 | 0x0B | ESC [ M | ESC 1 | ESC O P |
-| F2 | 0x0C | ESC [ N | ESC 2 | ESC O Q |
-| F3 | 0x0D | ESC [ O | ESC 3 | ESC O w |
-| F4 | 0x0E | ESC [ P | ESC 4 | ESC O x |
-| F5 | 0x0F | ESC [ Q | ESC 5 | ESC O t |
-| F6 | 0x10 | ESC [ R | ESC 6 | ESC O u |
-| F7 | 0x11 | ESC [ S | ESC 7 | ESC O q |
-| F8 | 0x12 | ESC [ T | ESC 8 | ESC O r |
-| F9 | 0x13 | ESC [ U | ESC 9 | ESC O p |
-| F10 | 0x14 | ESC [ V | ESC 0 | ESC O M |
-| Escape | 0x17 | ESC | ESC | ESC |
-+=========+======+===========+==========+=========+
-
-Special Mappings
-================
-ESC R ESC r ESC R = Reset System
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS TimerStatus;
- UINT16 UnicodeChar;
- EFI_INPUT_KEY Key;
- BOOLEAN SetDefaultResetState;
-
- TimerStatus = gBS->CheckEvent (TerminalDevice->TwoSecondTimeOut);
-
- if (!EFI_ERROR (TimerStatus)) {
- UnicodeToEfiKeyFlushState (TerminalDevice);
- TerminalDevice->ResetState = RESET_STATE_DEFAULT;
- }
-
- while (!IsUnicodeFiFoEmpty(TerminalDevice)) {
-
- if (TerminalDevice->InputState != INPUT_STATE_DEFAULT) {
- //
- // Check to see if the 2 second timer has expired
- //
- TimerStatus = gBS->CheckEvent (TerminalDevice->TwoSecondTimeOut);
- if (!EFI_ERROR (TimerStatus)) {
- UnicodeToEfiKeyFlushState (TerminalDevice);
- TerminalDevice->ResetState = RESET_STATE_DEFAULT;
- }
- }
-
- //
- // Fetch one Unicode character from the Unicode FIFO
- //
- UnicodeFiFoRemoveOneKey (TerminalDevice,&UnicodeChar);
-
- SetDefaultResetState = TRUE;
-
- switch (TerminalDevice->InputState) {
- case INPUT_STATE_DEFAULT:
-
- break;
-
- case INPUT_STATE_ESC:
-
- if (UnicodeChar == LEFTOPENBRACKET) {
- TerminalDevice->InputState |= INPUT_STATE_LEFTOPENBRACKET;
- TerminalDevice->ResetState = RESET_STATE_DEFAULT;
- continue;
- }
-
- if (UnicodeChar == 'O' && TerminalDevice->TerminalType == VT100Type) {
- TerminalDevice->InputState |= INPUT_STATE_O;
- TerminalDevice->ResetState = RESET_STATE_DEFAULT;
- continue;
- }
-
- Key.ScanCode = SCAN_NULL;
-
- if (TerminalDevice->TerminalType == VT100PlusType ||
- TerminalDevice->TerminalType == VTUTF8Type) {
- switch (UnicodeChar) {
- case '1':
- Key.ScanCode = SCAN_F1;
- break;
- case '2':
- Key.ScanCode = SCAN_F2;
- break;
- case '3':
- Key.ScanCode = SCAN_F3;
- break;
- case '4':
- Key.ScanCode = SCAN_F4;
- break;
- case '5':
- Key.ScanCode = SCAN_F5;
- break;
- case '6':
- Key.ScanCode = SCAN_F6;
- break;
- case '7':
- Key.ScanCode = SCAN_F7;
- break;
- case '8':
- Key.ScanCode = SCAN_F8;
- break;
- case '9':
- Key.ScanCode = SCAN_F9;
- break;
- case '0':
- Key.ScanCode = SCAN_F10;
- break;
- case 'h':
- Key.ScanCode = SCAN_HOME;
- break;
- case 'k':
- Key.ScanCode = SCAN_END;
- break;
- case '+':
- Key.ScanCode = SCAN_INSERT;
- break;
- case '-':
- Key.ScanCode = SCAN_DELETE;
- break;
- case '/':
- Key.ScanCode = SCAN_PAGE_DOWN;
- break;
- case '?':
- Key.ScanCode = SCAN_PAGE_UP;
- break;
- default :
- break;
- }
- }
-
- switch (UnicodeChar) {
- case 'R':
- if (TerminalDevice->ResetState == RESET_STATE_DEFAULT) {
- TerminalDevice->ResetState = RESET_STATE_ESC_R;
- SetDefaultResetState = FALSE;
- } else if (TerminalDevice->ResetState == RESET_STATE_ESC_R_ESC_r) {
- gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
- }
- Key.ScanCode = SCAN_NULL;
- break;
- case 'r':
- if (TerminalDevice->ResetState == RESET_STATE_ESC_R) {
- TerminalDevice->ResetState = RESET_STATE_ESC_R_ESC_r;
- SetDefaultResetState = FALSE;
- }
- Key.ScanCode = SCAN_NULL;
- break;
- default :
- break;
- }
-
- if (SetDefaultResetState) {
- TerminalDevice->ResetState = RESET_STATE_DEFAULT;
- }
-
- if (Key.ScanCode != SCAN_NULL) {
- Key.UnicodeChar = 0;
- EfiKeyFiFoInsertOneKey (TerminalDevice,Key);
- TerminalDevice->InputState = INPUT_STATE_DEFAULT;
- UnicodeToEfiKeyFlushState (TerminalDevice);
- continue;
- }
-
- UnicodeToEfiKeyFlushState (TerminalDevice);
-
- break;
-
- case INPUT_STATE_ESC | INPUT_STATE_O:
-
- TerminalDevice->ResetState = RESET_STATE_DEFAULT;
-
- Key.ScanCode = SCAN_NULL;
-
- if (TerminalDevice->TerminalType == VT100Type) {
- switch (UnicodeChar) {
- case 'P':
- Key.ScanCode = SCAN_F1;
- break;
- case 'Q':
- Key.ScanCode = SCAN_F2;
- break;
- case 'w':
- Key.ScanCode = SCAN_F3;
- break;
- case 'x':
- Key.ScanCode = SCAN_F4;
- break;
- case 't':
- Key.ScanCode = SCAN_F5;
- break;
- case 'u':
- Key.ScanCode = SCAN_F6;
- break;
- case 'q':
- Key.ScanCode = SCAN_F7;
- break;
- case 'r':
- Key.ScanCode = SCAN_F8;
- break;
- case 'p':
- Key.ScanCode = SCAN_F9;
- break;
- case 'M':
- Key.ScanCode = SCAN_F10;
- break;
- default :
- break;
- }
- }
-
- if (Key.ScanCode != SCAN_NULL) {
- Key.UnicodeChar = 0;
- EfiKeyFiFoInsertOneKey (TerminalDevice,Key);
- TerminalDevice->InputState = INPUT_STATE_DEFAULT;
- UnicodeToEfiKeyFlushState (TerminalDevice);
- continue;
- }
-
- UnicodeToEfiKeyFlushState (TerminalDevice);
-
- break;
-
- case INPUT_STATE_ESC | INPUT_STATE_LEFTOPENBRACKET:
-
- TerminalDevice->ResetState = RESET_STATE_DEFAULT;
-
- Key.ScanCode = SCAN_NULL;
-
- if (TerminalDevice->TerminalType == PcAnsiType ||
- TerminalDevice->TerminalType == VT100Type ||
- TerminalDevice->TerminalType == VT100PlusType ||
- TerminalDevice->TerminalType == VTUTF8Type) {
- switch (UnicodeChar) {
- case 'A':
- Key.ScanCode = SCAN_UP;
- break;
- case 'B':
- Key.ScanCode = SCAN_DOWN;
- break;
- case 'C':
- Key.ScanCode = SCAN_RIGHT;
- break;
- case 'D':
- Key.ScanCode = SCAN_LEFT;
- break;
- case 'H':
- if (TerminalDevice->TerminalType == PcAnsiType ||
- TerminalDevice->TerminalType == VT100Type) {
- Key.ScanCode = SCAN_HOME;
- }
- break;
- case 'F':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_END;
- }
- break;
- case 'K':
- if (TerminalDevice->TerminalType == VT100Type) {
- Key.ScanCode = SCAN_END;
- }
- break;
- case 'L':
- case '@':
- if (TerminalDevice->TerminalType == PcAnsiType ||
- TerminalDevice->TerminalType == VT100Type) {
- Key.ScanCode = SCAN_INSERT;
- }
- break;
- case 'X':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_DELETE;
- }
- break;
- case 'P':
- if (TerminalDevice->TerminalType == VT100Type) {
- Key.ScanCode = SCAN_DELETE;
- } else if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_F4;
- }
- break;
- case 'I':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_PAGE_UP;
- }
- break;
- case 'V':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_F10;
- }
- case '?':
- if (TerminalDevice->TerminalType == VT100Type) {
- Key.ScanCode = SCAN_PAGE_UP;
- }
- break;
- case 'G':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_PAGE_DOWN;
- }
- break;
- case 'U':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_F9;
- }
- case '/':
- if (TerminalDevice->TerminalType == VT100Type) {
- Key.ScanCode = SCAN_PAGE_DOWN;
- }
- break;
- case 'M':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_F1;
- }
- break;
- case 'N':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_F2;
- }
- break;
- case 'O':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_F3;
- }
- break;
- case 'Q':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_F5;
- }
- break;
- case 'R':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_F6;
- }
- break;
- case 'S':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_F7;
- }
- break;
- case 'T':
- if (TerminalDevice->TerminalType == PcAnsiType) {
- Key.ScanCode = SCAN_F8;
- }
- break;
- default :
- break;
- }
- }
-
- if (Key.ScanCode != SCAN_NULL) {
- Key.UnicodeChar = 0;
- EfiKeyFiFoInsertOneKey (TerminalDevice,Key);
- TerminalDevice->InputState = INPUT_STATE_DEFAULT;
- UnicodeToEfiKeyFlushState (TerminalDevice);
- continue;
- }
-
- UnicodeToEfiKeyFlushState (TerminalDevice);
-
- break;
-
-
- default:
- //
- // Invalid state. This should never happen.
- //
- ASSERT (FALSE);
-
- UnicodeToEfiKeyFlushState (TerminalDevice);
-
- break;
- }
-
- if (UnicodeChar == ESC) {
- TerminalDevice->InputState = INPUT_STATE_ESC;
- }
-
- if (TerminalDevice->InputState != INPUT_STATE_DEFAULT) {
- Status = gBS->SetTimer(
- TerminalDevice->TwoSecondTimeOut,
- TimerRelative,
- (UINT64)20000000
- );
- ASSERT_EFI_ERROR (Status);
- continue;
- }
-
- if (SetDefaultResetState) {
- TerminalDevice->ResetState = RESET_STATE_DEFAULT;
- }
-
- if (UnicodeChar == DEL) {
- Key.ScanCode = SCAN_DELETE;
- Key.UnicodeChar = 0;
- } else {
- Key.ScanCode = SCAN_NULL;
- Key.UnicodeChar = UnicodeChar;
- }
-
- EfiKeyFiFoInsertOneKey (TerminalDevice,Key);
- }
-}
diff --git a/EdkModulePkg/Universal/Console/Terminal/Dxe/TerminalConOut.c b/EdkModulePkg/Universal/Console/Terminal/Dxe/TerminalConOut.c
deleted file mode 100644
index c26585f..0000000
--- a/EdkModulePkg/Universal/Console/Terminal/Dxe/TerminalConOut.c
+++ /dev/null
@@ -1,995 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- TerminalConOut.c
-
-Abstract:
-
-
-Revision History
---*/
-
-#include "Terminal.h"
-
-//
-// This list is used to define the valid extend chars.
-// It also provides a mapping from Unicode to PCANSI or
-// ASCII. The ASCII mapping we just made up.
-//
-//
-STATIC UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] = {
- { BOXDRAW_HORIZONTAL, 0xc4, L'-' },
- { BOXDRAW_VERTICAL, 0xb3, L'|' },
- { BOXDRAW_DOWN_RIGHT, 0xda, L'/' },
- { BOXDRAW_DOWN_LEFT, 0xbf, L'\\' },
- { BOXDRAW_UP_RIGHT, 0xc0, L'\\' },
- { BOXDRAW_UP_LEFT, 0xd9, L'/' },
- { BOXDRAW_VERTICAL_RIGHT, 0xc3, L'|' },
- { BOXDRAW_VERTICAL_LEFT, 0xb4, L'|' },
- { BOXDRAW_DOWN_HORIZONTAL, 0xc2, L'+' },
- { BOXDRAW_UP_HORIZONTAL, 0xc1, L'+' },
- { BOXDRAW_VERTICAL_HORIZONTAL, 0xc5, L'+' },
- { BOXDRAW_DOUBLE_HORIZONTAL, 0xcd, L'-' },
- { BOXDRAW_DOUBLE_VERTICAL, 0xba, L'|' },
- { BOXDRAW_DOWN_RIGHT_DOUBLE, 0xd5, L'/' },
- { BOXDRAW_DOWN_DOUBLE_RIGHT, 0xd6, L'/' },
- { BOXDRAW_DOUBLE_DOWN_RIGHT, 0xc9, L'/' },
- { BOXDRAW_DOWN_LEFT_DOUBLE, 0xb8, L'\\' },
- { BOXDRAW_DOWN_DOUBLE_LEFT, 0xb7, L'\\' },
- { BOXDRAW_DOUBLE_DOWN_LEFT, 0xbb, L'\\' },
- { BOXDRAW_UP_RIGHT_DOUBLE, 0xd4, L'\\' },
- { BOXDRAW_UP_DOUBLE_RIGHT, 0xd3, L'\\' },
- { BOXDRAW_DOUBLE_UP_RIGHT, 0xc8, L'\\' },
- { BOXDRAW_UP_LEFT_DOUBLE, 0xbe, L'/' },
- { BOXDRAW_UP_DOUBLE_LEFT, 0xbd, L'/' },
- { BOXDRAW_DOUBLE_UP_LEFT, 0xbc, L'/' },
- { BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0xc6, L'|' },
- { BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0xc7, L'|' },
- { BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0xcc, L'|' },
- { BOXDRAW_VERTICAL_LEFT_DOUBLE, 0xb5, L'|' },
- { BOXDRAW_VERTICAL_DOUBLE_LEFT, 0xb6, L'|' },
- { BOXDRAW_DOUBLE_VERTICAL_LEFT, 0xb9, L'|' },
- { BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0xd1, L'+' },
- { BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0xd2, L'+' },
- { BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0xcb, L'+' },
- { BOXDRAW_UP_HORIZONTAL_DOUBLE, 0xcf, L'+' },
- { BOXDRAW_UP_DOUBLE_HORIZONTAL, 0xd0, L'+' },
- { BOXDRAW_DOUBLE_UP_HORIZONTAL, 0xca, L'+' },
- { BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0xd8, L'+' },
- { BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0xd7, L'+' },
- { BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0xce, L'+' },
-
- { BLOCKELEMENT_FULL_BLOCK, 0xdb, L'*' },
- { BLOCKELEMENT_LIGHT_SHADE, 0xb0, L'+' },
-
- { GEOMETRICSHAPE_UP_TRIANGLE, 0x1e, L'^' },
- { GEOMETRICSHAPE_RIGHT_TRIANGLE, 0x10, L'>' },
- { GEOMETRICSHAPE_DOWN_TRIANGLE, 0x1f, L'v' },
- { GEOMETRICSHAPE_LEFT_TRIANGLE, 0x11, L'<' },
-
- { ARROW_LEFT, 0x3c, L'<' },
- { ARROW_UP, 0x18, L'^' },
- { ARROW_RIGHT, 0x3e, L'>' },
- { ARROW_DOWN, 0x19, L'v' },
-
- { 0x0000, 0x00, L'\0' }
-};
-
-CHAR16 mSetModeString[] = { ESC, '[', '=', '3', 'h', 0 };
-CHAR16 mSetAttributeString[] = { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 };
-CHAR16 mClearScreenString[] = { ESC, '[', '2', 'J', 0 };
-CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0 };
-
-//
-// Body of the ConOut functions
-//
-EFI_STATUS
-EFIAPI
-TerminalConOutReset (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
- Routine Description:
-
- Implements EFI_SIMPLE_TEXT_OUT_PROTOCOL.Reset().
- If ExtendeVerification is TRUE, then perform dependent serial device reset,
- and set display mode to mode 0.
- If ExtendedVerification is FALSE, only set display mode to mode 0.
-
- Arguments:
-
- This - Indicates the calling context.
-
- ExtendedVerification - Indicates that the driver may perform a more exhaustive
- verification operation of the device during reset.
-
- Returns:
-
- EFI_SUCCESS
- The reset operation succeeds.
-
- EFI_DEVICE_ERROR
- The terminal is not functioning correctly or the serial port reset fails.
-
---*/
-{
- EFI_STATUS Status;
- TERMINAL_DEV *TerminalDevice;
-
- TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
-
- //
- // Perform a more exhaustive reset by resetting the serial port.
- //
- if (ExtendedVerification) {
- //
- // Report progress code here
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET,
- TerminalDevice->DevicePath
- );
-
- Status = TerminalDevice->SerialIo->Reset (TerminalDevice->SerialIo);
- if (EFI_ERROR (Status)) {
- //
- // Report error code here
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_CONTROLLER_ERROR,
- TerminalDevice->DevicePath
- );
-
- return Status;
- }
- }
-
- This->SetAttribute (This, EFI_TEXT_ATTR (This->Mode->Attribute & 0x0F, EFI_BACKGROUND_BLACK));
-
- Status = This->SetMode (This, 0);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-TerminalConOutOutputString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- )
-/*++
- Routine Description:
-
- Implements EFI_SIMPLE_TEXT_OUT_PROTOCOL.OutputString().
- The Unicode string will be converted to terminal expressible data stream
- and send to terminal via serial port.
-
-
- Arguments:
-
- This - Indicates the calling context.
-
- WString - The Null-terminated Unicode string to be displayed on
- the terminal screen.
-
- Returns:
-
- EFI_SUCCESS
- The string is output successfully.
-
- EFI_DEVICE_ERROR
- The serial port fails to send the string out.
-
- EFI_WARN_UNKNOWN_GLYPH
- Indicates that some of the characters in the Unicode string could not
- be rendered and are skipped.
-
- EFI_UNSUPPORTED
-
---*/
-{
- TERMINAL_DEV *TerminalDevice;
- EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
- UINTN MaxColumn;
- UINTN MaxRow;
- UINTN Length;
- UTF8_CHAR Utf8Char;
- CHAR8 GraphicChar;
- CHAR8 AsciiChar;
- EFI_STATUS Status;
- UINT8 ValidBytes;
- //
- // flag used to indicate whether condition happens which will cause
- // return EFI_WARN_UNKNOWN_GLYPH
- //
- BOOLEAN Warning;
-
- ValidBytes = 0;
- Warning = FALSE;
-
- //
- // get Terminal device data structure pointer.
- //
- TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
-
- //
- // get current display mode
- // Terminal driver only support mode 0
- //
- Mode = This->Mode;
- if (Mode->Mode != 0) {
- return EFI_UNSUPPORTED;
- }
-
- This->QueryMode (
- This,
- Mode->Mode,
- &MaxColumn,
- &MaxRow
- );
-
- for (; *WString != CHAR_NULL; WString++) {
-
- switch (TerminalDevice->TerminalType) {
-
- case PcAnsiType:
- case VT100Type:
- case VT100PlusType:
-
- if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar)) {
- //
- // If it's not a graphic character convert Unicode to ASCII.
- //
- GraphicChar = (CHAR8) *WString;
-
- if (!(TerminalIsValidAscii (GraphicChar) || TerminalIsValidEfiCntlChar (GraphicChar))) {
- //
- // when this driver use the OutputString to output control string,
- // TerminalDevice->OutputEscChar is set to let the Esc char
- // to be output to the terminal emulation software.
- //
- if ((GraphicChar == 27) && TerminalDevice->OutputEscChar) {
- GraphicChar = 27;
- } else {
- GraphicChar = '?';
- Warning = TRUE;
- }
- }
-
- AsciiChar = GraphicChar;
-
- }
-
- if (TerminalDevice->TerminalType != PcAnsiType) {
- GraphicChar = AsciiChar;
- }
-
- Length = 1;
-
- Status = TerminalDevice->SerialIo->Write (
- TerminalDevice->SerialIo,
- &Length,
- &GraphicChar
- );
-
- if (EFI_ERROR (Status)) {
- goto OutputError;
- }
-
- break;
-
- case VTUTF8Type:
- UnicodeToUtf8 (*WString, &Utf8Char, &ValidBytes);
- Length = ValidBytes;
- Status = TerminalDevice->SerialIo->Write (
- TerminalDevice->SerialIo,
- &Length,
- (UINT8 *) &Utf8Char
- );
- if (EFI_ERROR (Status)) {
- goto OutputError;
- }
- break;
- }
- //
- // Update cursor position.
- //
- switch (*WString) {
-
- case CHAR_BACKSPACE:
- if (Mode->CursorColumn > 0) {
- Mode->CursorColumn--;
- }
- break;
-
- case CHAR_LINEFEED:
- if (Mode->CursorRow < (INT32) (MaxRow - 1)) {
- Mode->CursorRow++;
- }
- break;
-
- case CHAR_CARRIAGE_RETURN:
- Mode->CursorColumn = 0;
- break;
-
- default:
- if (Mode->CursorColumn < (INT32) (MaxColumn - 1)) {
-
- Mode->CursorColumn++;
-
- } else {
-
- Mode->CursorColumn = 0;
- if (Mode->CursorRow < (INT32) (MaxRow - 1)) {
- Mode->CursorRow++;
- }
-
- }
- break;
-
- };
-
- }
-
- if (Warning) {
- return EFI_WARN_UNKNOWN_GLYPH;
- }
-
- return EFI_SUCCESS;
-
-OutputError:
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_OUTPUT_ERROR,
- TerminalDevice->DevicePath
- );
-
- return EFI_DEVICE_ERROR;
-}
-
-EFI_STATUS
-EFIAPI
-TerminalConOutTestString (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN CHAR16 *WString
- )
-/*++
- Routine Description:
-
- Implements EFI_SIMPLE_TEXT_OUT_PROTOCOL.TestString().
- If one of the characters in the *Wstring is
- neither valid Unicode drawing characters,
- not ASCII code, then this function will return
- EFI_UNSUPPORTED.
-
-
- Arguments:
-
- This - Indicates the calling context.
-
- WString - The Null-terminated Unicode string to be tested.
-
- Returns:
-
- EFI_SUCCESS
- The terminal is capable of rendering the output string.
-
- EFI_UNSUPPORTED
- Some of the characters in the Unicode string cannot be rendered.
-
---*/
-{
- TERMINAL_DEV *TerminalDevice;
- EFI_STATUS Status;
-
- //
- // get Terminal device data structure pointer.
- //
- TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
-
- switch (TerminalDevice->TerminalType) {
-
- case PcAnsiType:
- case VT100Type:
- case VT100PlusType:
- Status = AnsiTestString (TerminalDevice, WString);
- break;
-
- case VTUTF8Type:
- Status = VTUTF8TestString (TerminalDevice, WString);
- break;
-
- default:
- Status = EFI_UNSUPPORTED;
- break;
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-TerminalConOutQueryMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber,
- OUT UINTN *Columns,
- OUT UINTN *Rows
- )
-/*++
- Routine Description:
-
- Implements EFI_SIMPLE_TEXT_OUT_PROTOCOL.QueryMode().
- It returns information for an available text mode
- that the terminal supports.
- In this driver, we only support text mode 80x25, which is
- defined as mode 0.
-
-
- Arguments:
-
- *This
- Indicates the calling context.
-
- ModeNumber
- The mode number to return information on.
-
- Columns
- The returned columns of the requested mode.
-
- Rows
- The returned rows of the requested mode.
-
- Returns:
-
- EFI_SUCCESS
- The requested mode information is returned.
-
- EFI_UNSUPPORTED
- The mode number is not valid.
-
- EFI_DEVICE_ERROR
-
---*/
-{
- if (This->Mode->MaxMode > 1) {
- return EFI_DEVICE_ERROR;
- }
-
- if (ModeNumber == 0) {
-
- *Columns = MODE0_COLUMN_COUNT;
- *Rows = MODE0_ROW_COUNT;
-
- return EFI_SUCCESS;
- }
-
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-TerminalConOutSetMode (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN ModeNumber
- )
-/*++
- Routine Description:
-
- Implements EFI_SIMPLE_TEXT_OUT.SetMode().
- Set the terminal to a specified display mode.
- In this driver, we only support mode 0.
-
- Arguments:
-
- This
- Indicates the calling context.
-
- ModeNumber
- The text mode to set.
-
- Returns:
-
- EFI_SUCCESS
- The requested text mode is set.
-
- EFI_DEVICE_ERROR
- The requested text mode cannot be set because of serial device error.
-
- EFI_UNSUPPORTED
- The text mode number is not valid.
-
---*/
-{
- EFI_STATUS Status;
- TERMINAL_DEV *TerminalDevice;
-
- //
- // get Terminal device data structure pointer.
- //
- TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
-
- if (ModeNumber != 0) {
- return EFI_UNSUPPORTED;
- }
-
- This->Mode->Mode = 0;
-
- This->ClearScreen (This);
-
- TerminalDevice->OutputEscChar = TRUE;
- Status = This->OutputString (This, mSetModeString);
- TerminalDevice->OutputEscChar = FALSE;
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- This->Mode->Mode = 0;
-
- Status = This->ClearScreen (This);
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-EFIAPI
-TerminalConOutSetAttribute (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Attribute
- )
-/*++
- Routine Description:
-
- Implements EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetAttribute().
-
- Arguments:
-
- This
- Indicates the calling context.
-
- Attribute
- The attribute to set. Only bit0..6 are valid, all other bits
- are undefined and must be zero.
-
- Returns:
-
- EFI_SUCCESS
- The requested attribute is set.
-
- EFI_DEVICE_ERROR
- The requested attribute cannot be set due to serial port error.
-
- EFI_UNSUPPORTED
- The attribute requested is not defined by EFI spec.
-
---*/
-{
- UINT8 ForegroundControl;
- UINT8 BackgroundControl;
- UINT8 BrightControl;
- INT32 SavedColumn;
- INT32 SavedRow;
- EFI_STATUS Status;
- TERMINAL_DEV *TerminalDevice;
-
- SavedColumn = 0;
- SavedRow = 0;
-
- //
- // get Terminal device data structure pointer.
- //
- TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
-
- //
- // only the bit0..6 of the Attribute is valid
- //
- if ((Attribute | 0x7f) != 0x7f) {
- return EFI_UNSUPPORTED;
- }
- //
- // convert Attribute value to terminal emulator
- // understandable foreground color
- //
- switch (Attribute & 0x07) {
-
- case EFI_BLACK:
- ForegroundControl = 30;
- break;
-
- case EFI_BLUE:
- ForegroundControl = 34;
- break;
-
- case EFI_GREEN:
- ForegroundControl = 32;
- break;
-
- case EFI_CYAN:
- ForegroundControl = 36;
- break;
-
- case EFI_RED:
- ForegroundControl = 31;
- break;
-
- case EFI_MAGENTA:
- ForegroundControl = 35;
- break;
-
- case EFI_BROWN:
- ForegroundControl = 33;
- break;
-
- default:
-
- case EFI_LIGHTGRAY:
- ForegroundControl = 37;
- break;
-
- }
- //
- // bit4 of the Attribute indicates bright control
- // of terminal emulator.
- //
- BrightControl = (UINT8) ((Attribute >> 3) & 1);
-
- //
- // convert Attribute value to terminal emulator
- // understandable background color.
- //
- switch ((Attribute >> 4) & 0x07) {
-
- case EFI_BLACK:
- BackgroundControl = 40;
- break;
-
- case EFI_BLUE:
- BackgroundControl = 44;
- break;
-
- case EFI_GREEN:
- BackgroundControl = 42;
- break;
-
- case EFI_CYAN:
- BackgroundControl = 46;
- break;
-
- case EFI_RED:
- BackgroundControl = 41;
- break;
-
- case EFI_MAGENTA:
- BackgroundControl = 45;
- break;
-
- case EFI_BROWN:
- BackgroundControl = 43;
- break;
-
- default:
-
- case EFI_LIGHTGRAY:
- BackgroundControl = 47;
- break;
- }
- //
- // terminal emulator's control sequence to set attributes
- //
- mSetAttributeString[BRIGHT_CONTROL_OFFSET] = (CHAR16) ('0' + BrightControl);
- mSetAttributeString[FOREGROUND_CONTROL_OFFSET + 0] = (CHAR16) ('0' + (ForegroundControl / 10));
- mSetAttributeString[FOREGROUND_CONTROL_OFFSET + 1] = (CHAR16) ('0' + (ForegroundControl % 10));
- mSetAttributeString[BACKGROUND_CONTROL_OFFSET + 0] = (CHAR16) ('0' + (BackgroundControl / 10));
- mSetAttributeString[BACKGROUND_CONTROL_OFFSET + 1] = (CHAR16) ('0' + (BackgroundControl % 10));
-
- //
- // save current column and row
- // for future scrolling back use.
- //
- SavedColumn = This->Mode->CursorColumn;
- SavedRow = This->Mode->CursorRow;
-
- TerminalDevice->OutputEscChar = TRUE;
- Status = This->OutputString (This, mSetAttributeString);
- TerminalDevice->OutputEscChar = FALSE;
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // scroll back to saved cursor position.
- //
- This->Mode->CursorColumn = SavedColumn;
- This->Mode->CursorRow = SavedRow;
-
- This->Mode->Attribute = (INT32) Attribute;
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-EFIAPI
-TerminalConOutClearScreen (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This
- )
-/*++
- Routine Description:
-
- Implements EFI_SIMPLE_TEXT_OUT_PROTOCOL.ClearScreen().
- It clears the ANSI terminal's display to the
- currently selected background color.
-
-
- Arguments:
-
- This
- Indicates the calling context.
-
- Returns:
-
- EFI_SUCCESS
- The operation completed successfully.
-
- EFI_DEVICE_ERROR
- The terminal screen cannot be cleared due to serial port error.
-
- EFI_UNSUPPORTED
- The terminal is not in a valid display mode.
-
---*/
-{
- EFI_STATUS Status;
- TERMINAL_DEV *TerminalDevice;
-
- TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
-
- //
- // control sequence for clear screen request
- //
- TerminalDevice->OutputEscChar = TRUE;
- Status = This->OutputString (This, mClearScreenString);
- TerminalDevice->OutputEscChar = FALSE;
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- Status = This->SetCursorPosition (This, 0, 0);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-TerminalConOutSetCursorPosition (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN UINTN Column,
- IN UINTN Row
- )
-/*++
- Routine Description:
-
- Implements EFI_SIMPLE_TEXT_OUT_PROTOCOL.SetCursorPosition().
-
- Arguments:
-
- This
- Indicates the calling context.
-
- Column
- The row to set cursor to.
-
- Row
- The column to set cursor to.
-
- Returns:
-
- EFI_SUCCESS
- The operation completed successfully.
-
- EFI_DEVICE_ERROR
- The request fails due to serial port error.
-
- EFI_UNSUPPORTED
- The terminal is not in a valid text mode, or the cursor position
- is invalid for current mode.
-
---*/
-{
- EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
- UINTN MaxColumn;
- UINTN MaxRow;
- EFI_STATUS Status;
- TERMINAL_DEV *TerminalDevice;
-
- TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
-
- //
- // get current mode
- //
- Mode = This->Mode;
-
- //
- // get geometry of current mode
- //
- Status = This->QueryMode (
- This,
- Mode->Mode,
- &MaxColumn,
- &MaxRow
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- if (Column >= MaxColumn || Row >= MaxRow) {
- return EFI_UNSUPPORTED;
- }
- //
- // control sequence to move the cursor
- //
- mSetCursorPositionString[ROW_OFFSET + 0] = (CHAR16) ('0' + ((Row + 1) / 10));
- mSetCursorPositionString[ROW_OFFSET + 1] = (CHAR16) ('0' + ((Row + 1) % 10));
- mSetCursorPositionString[COLUMN_OFFSET + 0] = (CHAR16) ('0' + ((Column + 1) / 10));
- mSetCursorPositionString[COLUMN_OFFSET + 1] = (CHAR16) ('0' + ((Column + 1) % 10));
-
- TerminalDevice->OutputEscChar = TRUE;
- Status = This->OutputString (This, mSetCursorPositionString);
- TerminalDevice->OutputEscChar = FALSE;
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // update current cursor position
- // in the Mode data structure.
- //
- Mode->CursorColumn = (INT32) Column;
- Mode->CursorRow = (INT32) Row;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-TerminalConOutEnableCursor (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *This,
- IN BOOLEAN Visible
- )
-/*++
- Routine Description:
-
- Implements SIMPLE_TEXT_OUTPUT.EnableCursor().
- In this driver, the cursor cannot be hidden.
-
- Arguments:
-
- This
- Indicates the calling context.
-
- Visible
- If TRUE, the cursor is set to be visible,
- If FALSE, the cursor is set to be invisible.
-
- Returns:
-
- EFI_SUCCESS
- The request is valid.
-
- EFI_UNSUPPORTED
- The terminal does not support cursor hidden.
-
---*/
-{
- if (!Visible) {
- return EFI_UNSUPPORTED;
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-TerminalIsValidTextGraphics (
- IN CHAR16 Graphic,
- OUT CHAR8 *PcAnsi, OPTIONAL
- OUT CHAR8 *Ascii OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Detects if a Unicode char is for Box Drawing text graphics.
-
-Arguments:
-
- Graphic - Unicode char to test.
-
- PcAnsi - Optional pointer to return PCANSI equivalent of Graphic.
-
- Ascii - Optional pointer to return ASCII equivalent of Graphic.
-
-Returns:
-
- TRUE if Graphic is a supported Unicode Box Drawing character.
-
---*/
-{
- UNICODE_TO_CHAR *Table;
-
- if ((((Graphic & 0xff00) != 0x2500) && ((Graphic & 0xff00) != 0x2100))) {
- //
- // Unicode drawing code charts are all in the 0x25xx range,
- // arrows are 0x21xx
- //
- return FALSE;
- }
-
- for (Table = UnicodeToPcAnsiOrAscii; Table->Unicode != 0x0000; Table++) {
- if (Graphic == Table->Unicode) {
- if (PcAnsi != NULL) {
- *PcAnsi = Table->PcAnsi;
- }
-
- if (Ascii != NULL) {
- *Ascii = Table->Ascii;
- }
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-BOOLEAN
-TerminalIsValidAscii (
- IN CHAR16 Ascii
- )
-{
- //
- // valid ascii code lies in the extent of 0x20 ~ 0x7f
- //
- if ((Ascii >= 0x20) && (Ascii <= 0x7f)) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOLEAN
-TerminalIsValidEfiCntlChar (
- IN CHAR16 CharC
- )
-{
- //
- // only support four control characters.
- //
- if (CharC == CHAR_NULL ||
- CharC == CHAR_BACKSPACE ||
- CharC == CHAR_LINEFEED ||
- CharC == CHAR_CARRIAGE_RETURN ||
- CharC == CHAR_TAB
- ) {
- return TRUE;
- }
-
- return FALSE;
-}
diff --git a/EdkModulePkg/Universal/Console/Terminal/Dxe/ansi.c b/EdkModulePkg/Universal/Console/Terminal/Dxe/ansi.c
deleted file mode 100644
index babc4bb..0000000
--- a/EdkModulePkg/Universal/Console/Terminal/Dxe/ansi.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ansi.c
-
-Abstract:
-
-
-Revision History
---*/
-
-
-#include "Terminal.h"
-
-VOID
-AnsiRawDataToUnicode (
- IN TERMINAL_DEV *TerminalDevice
- )
-{
- UINT8 RawData;
-
- //
- // pop the raw data out from the raw fifo,
- // and translate it into unicode, then push
- // the unicode into unicode fifo, until the raw fifo is empty.
- //
- while (!IsRawFiFoEmpty (TerminalDevice)) {
-
- RawFiFoRemoveOneKey (TerminalDevice, &RawData);
-
- UnicodeFiFoInsertOneKey (TerminalDevice, (UINT16) RawData);
- }
-}
-
-EFI_STATUS
-AnsiTestString (
- IN TERMINAL_DEV *TerminalDevice,
- IN CHAR16 *WString
- )
-{
- CHAR8 GraphicChar;
-
- //
- // support three kind of character:
- // valid ascii, valid efi control char, valid text graphics.
- //
- for (; *WString != CHAR_NULL; WString++) {
-
- if ( !(TerminalIsValidAscii (*WString) ||
- TerminalIsValidEfiCntlChar (*WString) ||
- TerminalIsValidTextGraphics (*WString, &GraphicChar, NULL) )) {
-
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/Console/Terminal/Dxe/vtutf8.c b/EdkModulePkg/Universal/Console/Terminal/Dxe/vtutf8.c
deleted file mode 100644
index 062d0d4..0000000
--- a/EdkModulePkg/Universal/Console/Terminal/Dxe/vtutf8.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- vtutf8.c
-
-Abstract:
-
-
-Revision History
---*/
-
-
-#include "Terminal.h"
-
-VOID
-VTUTF8RawDataToUnicode (
- IN TERMINAL_DEV *TerminalDevice
- )
-{
- UTF8_CHAR Utf8Char;
- UINT8 ValidBytes;
- UINT16 UnicodeChar;
-
- ValidBytes = 0;
- //
- // pop the raw data out from the raw fifo,
- // and translate it into unicode, then push
- // the unicode into unicode fifo, until the raw fifo is empty.
- //
- while (!IsRawFiFoEmpty (TerminalDevice)) {
-
- GetOneValidUtf8Char (TerminalDevice, &Utf8Char, &ValidBytes);
-
- if (ValidBytes < 1 || ValidBytes > 3) {
- continue;
- }
-
- Utf8ToUnicode (Utf8Char, ValidBytes, (CHAR16 *) &UnicodeChar);
-
- UnicodeFiFoInsertOneKey (TerminalDevice, UnicodeChar);
- }
-}
-
-VOID
-GetOneValidUtf8Char (
- IN TERMINAL_DEV *Utf8Device,
- OUT UTF8_CHAR *Utf8Char,
- OUT UINT8 *ValidBytes
- )
-{
- UINT8 Temp;
- UINT8 Index;
- BOOLEAN FetchFlag;
-
- Temp = 0;
- Index = 0;
- FetchFlag = TRUE;
-
- //
- // if no valid Utf8 char is found in the RawFiFo,
- // then *ValidBytes will be zero.
- //
- *ValidBytes = 0;
-
- while (!IsRawFiFoEmpty (Utf8Device)) {
-
- RawFiFoRemoveOneKey (Utf8Device, &Temp);
-
- switch (*ValidBytes) {
-
- case 0:
- if ((Temp & 0x80) == 0) {
- //
- // one-byte utf8 char
- //
- *ValidBytes = 1;
-
- Utf8Char->Utf8_1 = Temp;
-
- FetchFlag = FALSE;
-
- } else if ((Temp & 0xe0) == 0xc0) {
- //
- // two-byte utf8 char
- //
- *ValidBytes = 2;
-
- Utf8Char->Utf8_2[1] = Temp;
-
- } else if ((Temp & 0xf0) == 0xe0) {
- //
- // three-byte utf8 char
- //
- *ValidBytes = 3;
-
- Utf8Char->Utf8_3[2] = Temp;
-
- Index++;
-
- } else {
- //
- // reset *ValidBytes to zero, let valid utf8 char search restart
- //
- *ValidBytes = 0;
- }
-
- break;
-
- case 2:
- if ((Temp & 0xc0) == 0x80) {
-
- Utf8Char->Utf8_2[0] = Temp;
-
- FetchFlag = FALSE;
-
- } else {
-
- *ValidBytes = 0;
- }
- break;
-
- case 3:
- if ((Temp & 0xc0) == 0x80) {
-
- Utf8Char->Utf8_3[2 - Index] = Temp;
- Index++;
- if (Index == 3) {
- FetchFlag = FALSE;
- }
- } else {
-
- *ValidBytes = 0;
- Index = 0;
- }
- break;
-
- default:
- break;
- }
-
- if (!FetchFlag) {
- break;
- }
- }
-
- return ;
-}
-
-VOID
-Utf8ToUnicode (
- IN UTF8_CHAR Utf8Char,
- IN UINT8 ValidBytes,
- OUT CHAR16 *UnicodeChar
- )
-{
- UINT8 UnicodeByte0;
- UINT8 UnicodeByte1;
- UINT8 Byte0;
- UINT8 Byte1;
- UINT8 Byte2;
-
- *UnicodeChar = 0;
-
- //
- // translate utf8 code to unicode, in terminal standard,
- // up to 3 bytes utf8 code is supported.
- //
- switch (ValidBytes) {
- case 1:
- //
- // one-byte utf8 code
- //
- *UnicodeChar = (UINT16) Utf8Char.Utf8_1;
- break;
-
- case 2:
- //
- // two-byte utf8 code
- //
- Byte0 = Utf8Char.Utf8_2[0];
- Byte1 = Utf8Char.Utf8_2[1];
-
- UnicodeByte0 = (UINT8) ((Byte1 << 6) | (Byte0 & 0x3f));
- UnicodeByte1 = (UINT8) ((Byte1 >> 2) & 0x07);
- *UnicodeChar = (UINT16) (UnicodeByte0 | (UnicodeByte1 << 8));
- break;
-
- case 3:
- //
- // three-byte utf8 code
- //
- Byte0 = Utf8Char.Utf8_3[0];
- Byte1 = Utf8Char.Utf8_3[1];
- Byte2 = Utf8Char.Utf8_3[2];
-
- UnicodeByte0 = (UINT8) ((Byte1 << 6) | (Byte0 & 0x3f));
- UnicodeByte1 = (UINT8) ((Byte2 << 4) | ((Byte1 >> 2) & 0x0f));
- *UnicodeChar = (UINT16) (UnicodeByte0 | (UnicodeByte1 << 8));
-
- default:
- break;
- }
-
- return ;
-}
-
-VOID
-UnicodeToUtf8 (
- IN CHAR16 Unicode,
- OUT UTF8_CHAR *Utf8Char,
- OUT UINT8 *ValidBytes
- )
-{
- UINT8 UnicodeByte0;
- UINT8 UnicodeByte1;
- //
- // translate unicode to utf8 code
- //
- UnicodeByte0 = (UINT8) Unicode;
- UnicodeByte1 = (UINT8) (Unicode >> 8);
-
- if (Unicode < 0x0080) {
-
- Utf8Char->Utf8_1 = (UINT8) (UnicodeByte0 & 0x7f);
- *ValidBytes = 1;
-
- } else if (Unicode < 0x0800) {
- //
- // byte sequence: high -> low
- // Utf8_2[0], Utf8_2[1]
- //
- Utf8Char->Utf8_2[1] = (UINT8) ((UnicodeByte0 & 0x3f) + 0x80);
- Utf8Char->Utf8_2[0] = (UINT8) ((((UnicodeByte1 << 2) + (UnicodeByte0 >> 6)) & 0x1f) + 0xc0);
-
- *ValidBytes = 2;
-
- } else {
- //
- // byte sequence: high -> low
- // Utf8_3[0], Utf8_3[1], Utf8_3[2]
- //
- Utf8Char->Utf8_3[2] = (UINT8) ((UnicodeByte0 & 0x3f) + 0x80);
- Utf8Char->Utf8_3[1] = (UINT8) ((((UnicodeByte1 << 2) + (UnicodeByte0 >> 6)) & 0x3f) + 0x80);
- Utf8Char->Utf8_3[0] = (UINT8) (((UnicodeByte1 >> 4) & 0x0f) + 0xe0);
-
- *ValidBytes = 3;
- }
-}
-
-EFI_STATUS
-VTUTF8TestString (
- IN TERMINAL_DEV *TerminalDevice,
- IN CHAR16 *WString
- )
-{
- //
- // to utf8, all kind of characters are supported.
- //
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.c b/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.c
deleted file mode 100644
index aa0cced..0000000
--- a/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.c
+++ /dev/null
@@ -1,660 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DataHub.c
-
-Abstract:
-
- This code produces the Data Hub protocol. It preloads the data hub
- with status information copied in from PEI HOBs.
-
- Only code that implements the Data Hub protocol should go in this file!
-
- The Term MTC stands for MonoTonicCounter.
-
- For more information please look at DataHub.doc
-
- NOTE: For extra security of the log GetNextDataRecord () could return a copy
- of the data record.
---*/
-
-#include "DataHub.h"
-
-CONST EFI_GUID gZeroGuid = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 } };
-
-//
-// Worker functions private to this file
-//
-STATIC
-DATA_HUB_FILTER_DRIVER *
-FindFilterDriverByEvent (
- IN LIST_ENTRY *Head,
- IN EFI_EVENT Event
- );
-
-STATIC
-EFI_DATA_RECORD_HEADER *
-GetNextDataRecord (
- IN LIST_ENTRY *Head,
- IN UINT64 ClassFilter,
- IN OUT UINT64 *PtrCurrentMTC
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-DataHubLogData (
- IN EFI_DATA_HUB_PROTOCOL *This,
- IN EFI_GUID *DataRecordGuid,
- IN EFI_GUID *ProducerName,
- IN UINT64 DataRecordClass,
- IN VOID *RawData,
- IN UINT32 RawDataSize
- )
-/*++
-
-Routine Description:
-
- Log data record into the data logging hub
-
-Arguments:
-
- This - Protocol instance structure
-
- DataRecordGuid - GUID that defines record contents
-
- ProducerName - GUID that defines the name of the producer of the data
-
- DataRecordClass - Class that defines generic record type
-
- RawData - Data Log record as defined by DataRecordGuid
-
- RawDataSize - Size of Data Log data in bytes
-
-Returns:
-
- EFI_SUCCESS - If data was logged
-
- EFI_OUT_OF_RESOURCES - If data was not logged due to lack of system
- resources.
---*/
-{
- EFI_STATUS Status;
- DATA_HUB_INSTANCE *Private;
- EFI_DATA_ENTRY *LogEntry;
- UINT32 TotalSize;
- UINT32 RecordSize;
- EFI_DATA_RECORD_HEADER *Record;
- VOID *Raw;
- DATA_HUB_FILTER_DRIVER *FilterEntry;
- LIST_ENTRY *Link;
- LIST_ENTRY *Head;
-
- Private = DATA_HUB_INSTANCE_FROM_THIS (This);
-
- //
- // Combine the storage for the internal structs and a copy of the log record.
- // Record follows PrivateLogEntry. The consumer will be returned a pointer
- // to Record so we don't what it to be the thing that was allocated from
- // pool, so the consumer can't free an data record by mistake.
- //
- RecordSize = sizeof (EFI_DATA_RECORD_HEADER) + RawDataSize;
- TotalSize = sizeof (EFI_DATA_ENTRY) + RecordSize;
-
- //
- // The Logging action is the critical section, so it is locked.
- // The MTC asignment & update, time, and logging must be an
- // atomic operation, so use the lock.
- //
- Status = EfiAcquireLockOrFail (&Private->DataLock);
- if (EFI_ERROR (Status)) {
- //
- // Reentrancy detected so exit!
- //
- return Status;
- }
-
- LogEntry = AllocatePool (TotalSize);
-
- if (LogEntry == NULL) {
- EfiReleaseLock (&Private->DataLock);
- return EFI_OUT_OF_RESOURCES;
- }
-
- ZeroMem (LogEntry, TotalSize);
-
- Record = (EFI_DATA_RECORD_HEADER *) (LogEntry + 1);
- Raw = (VOID *) (Record + 1);
-
- //
- // Build Standard Log Header
- //
- Record->Version = EFI_DATA_RECORD_HEADER_VERSION;
- Record->HeaderSize = sizeof (EFI_DATA_RECORD_HEADER);
- Record->RecordSize = RecordSize;
- CopyMem (&Record->DataRecordGuid, DataRecordGuid, sizeof (EFI_GUID));
- CopyMem (&Record->ProducerName, ProducerName, sizeof (EFI_GUID));
- Record->DataRecordClass = DataRecordClass;
-
- Record->LogMonotonicCount = Private->GlobalMonotonicCount++;
-
- gRT->GetTime (&Record->LogTime, NULL);
-
- //
- // Insert log into the internal linked list.
- //
- LogEntry->Signature = EFI_DATA_ENTRY_SIGNATURE;
- LogEntry->Record = Record;
- LogEntry->RecordSize = sizeof (EFI_DATA_ENTRY) + RawDataSize;
- InsertTailList (&Private->DataListHead, &LogEntry->Link);
-
- CopyMem (Raw, RawData, RawDataSize);
-
- EfiReleaseLock (&Private->DataLock);
-
- //
- // Send Signal to all the filter drivers which are interested
- // in the record's class and guid.
- //
- Head = &Private->FilterDriverListHead;
- for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
- FilterEntry = FILTER_ENTRY_FROM_LINK (Link);
- if (((FilterEntry->ClassFilter & DataRecordClass) != 0) &&
- (CompareGuid (&FilterEntry->FilterDataRecordGuid, &gZeroGuid) ||
- CompareGuid (&FilterEntry->FilterDataRecordGuid, DataRecordGuid))) {
- gBS->SignalEvent (FilterEntry->Event);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-DataHubGetNextRecord (
- IN EFI_DATA_HUB_PROTOCOL *This,
- IN OUT UINT64 *MonotonicCount,
- IN EFI_EVENT *FilterDriverEvent, OPTIONAL
- OUT EFI_DATA_RECORD_HEADER **Record
- )
-/*++
-
-Routine Description:
-
- Get a previously logged data record and the MonotonicCount for the next
- availible Record. This allows all records or all records later
- than a give MonotonicCount to be returned. If an optional FilterDriverEvent
- is passed in with a MonotonicCout of zero return the first record
- not yet read by the filter driver. If FilterDriverEvent is NULL and
- MonotonicCount is zero return the first data record.
-
-Arguments:
-
- This - The EFI_DATA_HUB_PROTOCOL instance.
- MonotonicCount - Specifies the Record to return. On input, zero means
- return the first record. On output, contains the next
- record to availible. Zero indicates no more records.
- FilterDriverEvent - If FilterDriverEvent is not passed in a MonotonicCount
- of zero, it means to return the first data record.
- If FilterDriverEvent is passed in, then a MonotonicCount
- of zero means to return the first data not yet read by
- FilterDriverEvent.
- Record - Returns a dynamically allocated memory buffer with a data
- record that matches MonotonicCount.
-
-Returns:
-
- EFI_SUCCESS - Data was returned in Record.
- EFI_INVALID_PARAMETER - FilterDriverEvent was passed in but does not exist.
- EFI_NOT_FOUND - MonotonicCount does not match any data record in the
- system. If a MonotonicCount of zero was passed in, then
- no data records exist in the system.
- EFI_OUT_OF_RESOURCES - Record was not returned due to lack of system resources.
-
---*/
-{
- DATA_HUB_INSTANCE *Private;
- DATA_HUB_FILTER_DRIVER *FilterDriver;
- UINT64 ClassFilter;
- UINT64 FilterMonotonicCount;
-
- Private = DATA_HUB_INSTANCE_FROM_THIS (This);
-
- FilterDriver = NULL;
- FilterMonotonicCount = 0;
- ClassFilter = EFI_DATA_RECORD_CLASS_DEBUG |
- EFI_DATA_RECORD_CLASS_ERROR |
- EFI_DATA_RECORD_CLASS_DATA |
- EFI_DATA_RECORD_CLASS_PROGRESS_CODE;
-
- if (FilterDriverEvent != NULL) {
- //
- // For events the beginning is the last unread record. This info is
- // stored in the instance structure, so we must look up the event
- // to get the data.
- //
- FilterDriver = FindFilterDriverByEvent (
- &Private->FilterDriverListHead,
- *FilterDriverEvent
- );
- if (FilterDriver == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Use the Class filter the event was created with.
- //
- ClassFilter = FilterDriver->ClassFilter;
-
- if (*MonotonicCount == 0) {
- //
- // Use the MTC from the Filter Driver.
- //
- FilterMonotonicCount = FilterDriver->GetNextMonotonicCount;
- if (FilterMonotonicCount != 0) {
- //
- // The GetNextMonotonicCount field remembers the last value from the previous time.
- // But we already processed this vaule, so we need to find the next one. So if
- // It is not the first time get the new record entry.
- //
- *Record = GetNextDataRecord (&Private->DataListHead, ClassFilter, &FilterMonotonicCount);
- *MonotonicCount = FilterMonotonicCount;
- if (FilterMonotonicCount == 0) {
- //
- // If there is no new record to get exit now.
- //
- return EFI_NOT_FOUND;
- }
- }
- }
- }
- //
- // Return the record
- //
- *Record = GetNextDataRecord (&Private->DataListHead, ClassFilter, MonotonicCount);
- if (*Record == NULL) {
- return EFI_NOT_FOUND;
- }
-
- if (FilterDriver != NULL) {
- //
- // If we have a filter driver update the records that have been read.
- // If MonotonicCount is zero No more reacords left.
- //
- if (*MonotonicCount == 0) {
- if (FilterMonotonicCount != 0) {
- //
- // Return the result of our extra GetNextDataRecord.
- //
- FilterDriver->GetNextMonotonicCount = FilterMonotonicCount;
- }
- } else {
- //
- // Point to next undread record
- //
- FilterDriver->GetNextMonotonicCount = *MonotonicCount;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-DataHubRegisterFilterDriver (
- IN EFI_DATA_HUB_PROTOCOL * This,
- IN EFI_EVENT FilterEvent,
- IN EFI_TPL FilterTpl,
- IN UINT64 FilterClass,
- IN EFI_GUID * FilterDataRecordGuid OPTIONAL
- )
-/*++
-
-Routine Description:
-
- This function registers the data hub filter driver that is represented
- by FilterEvent. Only one instance of each FilterEvent can be registered.
- After the FilterEvent is registered, it will be signaled so it can sync
- with data records that have been recorded prior to the FilterEvent being
- registered.
-
-Arguments:
-
- This - The EFI_DATA_HUB_PROTOCOL instance.
- FilterEvent - The EFI_EVENT to signal whenever data that matches
- FilterClass is logged in the system.
- FilterTpl - The maximum EFI_TPL at which FilterEvent can be
- signaled. It is strongly recommended that you use the
- lowest EFI_TPL possible.
- FilterClass - FilterEvent will be signaled whenever a bit in
- EFI_DATA_RECORD_HEADER.DataRecordClass is also set in
- FilterClass. If FilterClass is zero, no class-based
- filtering will be performed.
- FilterDataRecordGuid - FilterEvent will be signaled whenever FilterDataRecordGuid
- matches EFI_DATA_RECORD_HEADER.DataRecordGuid. If
- FilterDataRecordGuid is NULL, then no GUID-based filtering
- will be performed.
-Returns:
-
- EFI_SUCCESS - The filter driver event was registered.
- EFI_ALREADY_STARTED - FilterEvent was previously registered and cannot be
- registered again.
- EFI_OUT_OF_RESOURCES - The filter driver event was not registered due to lack of
- system resources.
-
---*/
-{
- DATA_HUB_INSTANCE *Private;
- DATA_HUB_FILTER_DRIVER *FilterDriver;
-
- Private = DATA_HUB_INSTANCE_FROM_THIS (This);
-
- FilterDriver = (DATA_HUB_FILTER_DRIVER *) AllocateZeroPool (sizeof (DATA_HUB_FILTER_DRIVER));
- if (FilterDriver == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Initialize filter driver info
- //
- FilterDriver->Signature = EFI_DATA_HUB_FILTER_DRIVER_SIGNATURE;
- FilterDriver->Event = FilterEvent;
- FilterDriver->Tpl = FilterTpl;
- FilterDriver->GetNextMonotonicCount = 0;
- if (FilterClass == 0) {
- FilterDriver->ClassFilter = EFI_DATA_RECORD_CLASS_DEBUG |
- EFI_DATA_RECORD_CLASS_ERROR |
- EFI_DATA_RECORD_CLASS_DATA |
- EFI_DATA_RECORD_CLASS_PROGRESS_CODE;
- } else {
- FilterDriver->ClassFilter = FilterClass;
- }
-
- if (FilterDataRecordGuid != NULL) {
- CopyMem (&FilterDriver->FilterDataRecordGuid, FilterDataRecordGuid, sizeof (EFI_GUID));
- }
- //
- // Search for duplicate entries
- //
- if (FindFilterDriverByEvent (&Private->FilterDriverListHead, FilterEvent) != NULL) {
- FreePool (FilterDriver);
- return EFI_ALREADY_STARTED;
- }
- //
- // Make insertion an atomic operation with the lock.
- //
- EfiAcquireLock (&Private->DataLock);
- InsertTailList (&Private->FilterDriverListHead, &FilterDriver->Link);
- EfiReleaseLock (&Private->DataLock);
-
- //
- // Signal the Filter driver we just loaded so they will recieve all the
- // previous history. If we did not signal here we would have to wait until
- // the next data was logged to get the history. In a case where no next
- // data was logged we would never get synced up.
- //
- gBS->SignalEvent (FilterEvent);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-DataHubUnregisterFilterDriver (
- IN EFI_DATA_HUB_PROTOCOL *This,
- IN EFI_EVENT FilterEvent
- )
-/*++
-
-Routine Description:
-
- Remove a Filter Driver, so it no longer gets called when data
- information is logged.
-
-Arguments:
-
- This - Protocol instance structure
-
- FilterEvent - Event that represents a filter driver that is to be
- Unregistered.
-
-Returns:
-
- EFI_SUCCESS - If FilterEvent was unregistered
-
- EFI_NOT_FOUND - If FilterEvent does not exist
-
---*/
-{
- DATA_HUB_INSTANCE *Private;
- DATA_HUB_FILTER_DRIVER *FilterDriver;
-
- Private = DATA_HUB_INSTANCE_FROM_THIS (This);
-
- //
- // Search for duplicate entries
- //
- FilterDriver = FindFilterDriverByEvent (
- &Private->FilterDriverListHead,
- FilterEvent
- );
- if (FilterDriver == NULL) {
- return EFI_NOT_FOUND;
- }
- //
- // Make removal an atomic operation with the lock
- //
- EfiAcquireLock (&Private->DataLock);
- RemoveEntryList (&FilterDriver->Link);
- EfiReleaseLock (&Private->DataLock);
-
- return EFI_SUCCESS;
-}
-//
-// STATIC Worker fucntions follow
-//
-STATIC
-DATA_HUB_FILTER_DRIVER *
-FindFilterDriverByEvent (
- IN LIST_ENTRY *Head,
- IN EFI_EVENT Event
- )
-/*++
-
-Routine Description:
- Search the Head list for a EFI_DATA_HUB_FILTER_DRIVER member that
- represents Event and return it.
-
-Arguments:
-
- Head - Head of dual linked list of EFI_DATA_HUB_FILTER_DRIVER
- structures.
-
- Event - Event to be search for in the Head list.
-
-Returns:
-
- EFI_DATA_HUB_FILTER_DRIVER - Returned if Event stored in the
- Head doubly linked list.
-
- NULL - If Event is not in the list
-
---*/
-{
- DATA_HUB_FILTER_DRIVER *FilterEntry;
- LIST_ENTRY *Link;
-
- for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
- FilterEntry = FILTER_ENTRY_FROM_LINK (Link);
- if (FilterEntry->Event == Event) {
- return FilterEntry;
- }
- }
-
- return NULL;
-}
-
-STATIC
-EFI_DATA_RECORD_HEADER *
-GetNextDataRecord (
- IN LIST_ENTRY *Head,
- IN UINT64 ClassFilter,
- IN OUT UINT64 *PtrCurrentMTC
- )
-/*++
-
-Routine Description:
- Search the Head doubly linked list for the passed in MTC. Return the
- matching element in Head and the MTC on the next entry.
-
-Arguments:
-
- Head - Head of Data Log linked list.
-
- ClassFilter - Only match the MTC if it is in the same Class as the
- ClassFilter.
-
- PtrCurrentMTC - On IN contians MTC to search for. On OUT contians next
- MTC in the data log list or zero if at end of the list.
-
-Returns:
-
- EFI_DATA_LOG_ENTRY - Return pointer to data log data from Head list.
-
- NULL - If no data record exists.
-
---*/
-{
- EFI_DATA_ENTRY *LogEntry;
- LIST_ENTRY *Link;
- BOOLEAN ReturnFirstEntry;
- EFI_DATA_RECORD_HEADER *Record;
- EFI_DATA_ENTRY *NextLogEntry;
-
- //
- // If MonotonicCount == 0 just return the first one
- //
- ReturnFirstEntry = (BOOLEAN) (*PtrCurrentMTC == 0);
-
- Record = NULL;
- for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
- LogEntry = DATA_ENTRY_FROM_LINK (Link);
- if ((LogEntry->Record->DataRecordClass & ClassFilter) == 0) {
- //
- // Skip any entry that does not have the correct ClassFilter
- //
- continue;
- }
-
- if ((LogEntry->Record->LogMonotonicCount == *PtrCurrentMTC) || ReturnFirstEntry) {
- //
- // Return record to the user
- //
- Record = LogEntry->Record;
-
- //
- // Calculate the next MTC value. If there is no next entry set
- // MTC to zero.
- //
- *PtrCurrentMTC = 0;
- for (Link = Link->ForwardLink; Link != Head; Link = Link->ForwardLink) {
- NextLogEntry = DATA_ENTRY_FROM_LINK (Link);
- if ((NextLogEntry->Record->DataRecordClass & ClassFilter) != 0) {
- //
- // Return the MTC of the next thing to search for if found
- //
- *PtrCurrentMTC = NextLogEntry->Record->LogMonotonicCount;
- break;
- }
- }
- //
- // Record found exit loop and return
- //
- break;
- }
- }
-
- return Record;
-}
-//
-// Module Global:
-// Since this driver will only ever produce one instance of the Logging Hub
-// protocol you are not required to dynamically allocate the PrivateData.
-//
-DATA_HUB_INSTANCE mPrivateData;
-
-EFI_STATUS
-EFIAPI
-DataHubInstall (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Install Driver to produce Data Hub protocol.
-
-Arguments:
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-Returns:
-
- EFI_SUCCESS - Logging Hub protocol installed
-
- Other - No protocol installed, unload driver.
-
---*/
-{
- EFI_STATUS Status;
- UINT32 HighMontonicCount;
-
- mPrivateData.Signature = DATA_HUB_INSTANCE_SIGNATURE;
- mPrivateData.DataHub.LogData = DataHubLogData;
- mPrivateData.DataHub.GetNextRecord = DataHubGetNextRecord;
- mPrivateData.DataHub.RegisterFilterDriver = DataHubRegisterFilterDriver;
- mPrivateData.DataHub.UnregisterFilterDriver = DataHubUnregisterFilterDriver;
-
- //
- // Initialize Private Data in CORE_LOGGING_HUB_INSTANCE that is
- // required by this protocol
- //
- InitializeListHead (&mPrivateData.DataListHead);
- InitializeListHead (&mPrivateData.FilterDriverListHead);
-
- EfiInitializeLock (&mPrivateData.DataLock, TPL_NOTIFY);
-
- //
- // Make sure we get a bigger MTC number on every boot!
- //
- Status = gRT->GetNextHighMonotonicCount (&HighMontonicCount);
- if (EFI_ERROR (Status)) {
- //
- // if system service fails pick a sane value.
- //
- mPrivateData.GlobalMonotonicCount = 0;
- } else {
- mPrivateData.GlobalMonotonicCount = LShiftU64 ((UINT64) HighMontonicCount, 32);
- }
- //
- // Make a new handle and install the protocol
- //
- mPrivateData.Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &mPrivateData.Handle,
- &gEfiDataHubProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mPrivateData.DataHub
- );
- return Status;
-}
diff --git a/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.dxs b/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.dxs
deleted file mode 100644
index 226acc5..0000000
--- a/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.dxs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DataHub.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.h b/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.h
deleted file mode 100644
index fb364a3..0000000
--- a/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DataHub.h
-
-Abstract:
- This code supports a the private implementation
- of the Data Hub protocol
-
---*/
-
-#ifndef _DATA_HUB_H_
-#define _DATA_HUB_H_
-
-
-#define DATA_HUB_INSTANCE_SIGNATURE EFI_SIGNATURE_32 ('D', 'H', 'u', 'b')
-typedef struct {
- UINT32 Signature;
-
- EFI_HANDLE Handle;
-
- //
- // Produced protocol(s)
- //
- EFI_DATA_HUB_PROTOCOL DataHub;
-
- //
- // Private Data
- //
- //
- // Updates to GlobalMonotonicCount, LogListHead, and FilterDriverListHead
- // must be locked.
- //
- EFI_LOCK DataLock;
-
- //
- // Runing Monotonic Count to use for each error record.
- // Increment AFTER use in an error record.
- //
- UINT64 GlobalMonotonicCount;
-
- //
- // List of EFI_DATA_ENTRY structures. This is the data log! The list
- // must be in assending order of LogMonotonicCount.
- //
- LIST_ENTRY DataListHead;
-
- //
- // List of EFI_DATA_HUB_FILTER_DRIVER structures. Represents all
- // the registered filter drivers.
- //
- LIST_ENTRY FilterDriverListHead;
-
-} DATA_HUB_INSTANCE;
-
-#define DATA_HUB_INSTANCE_FROM_THIS(this) CR (this, DATA_HUB_INSTANCE, DataHub, DATA_HUB_INSTANCE_SIGNATURE)
-
-//
-// Private data structure to contain the data log. One record per
-// structure. Head pointer to the list is the Log member of
-// EFI_DATA_ENTRY. Record is a copy of the data passed in.
-//
-#define EFI_DATA_ENTRY_SIGNATURE EFI_SIGNATURE_32 ('D', 'r', 'e', 'c')
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
-
- EFI_DATA_RECORD_HEADER *Record;
-
- UINTN RecordSize;
-
-} EFI_DATA_ENTRY;
-
-#define DATA_ENTRY_FROM_LINK(link) CR (link, EFI_DATA_ENTRY, Link, EFI_DATA_ENTRY_SIGNATURE)
-
-//
-// Private data to contain the filter driver Event and it's
-// associated EFI_TPL.
-//
-#define EFI_DATA_HUB_FILTER_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('D', 'h', 'F', 'd')
-
-typedef struct {
- UINT32 Signature;
- LIST_ENTRY Link;
-
- //
- // Store Filter Driver Event and Tpl level it can be Signaled at.
- //
- EFI_EVENT Event;
- EFI_TPL Tpl;
-
- //
- // Monotonic count on the get next operation for Event.
- // Zero indicates get next has not been called for this event yet.
- //
- UINT64 GetNextMonotonicCount;
-
- //
- // Filter driver will register what class filter should be used.
- //
- UINT64 ClassFilter;
-
- //
- // Filter driver will register what record guid filter should be used.
- //
- EFI_GUID FilterDataRecordGuid;
-
-} DATA_HUB_FILTER_DRIVER;
-
-#define FILTER_ENTRY_FROM_LINK(link) CR (link, DATA_HUB_FILTER_DRIVER, Link, EFI_DATA_HUB_FILTER_DRIVER_SIGNATURE)
-
-#endif
diff --git a/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.msa b/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.msa
deleted file mode 100644
index 043cd1d..0000000
--- a/EdkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.msa
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DataHub</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>53BCC14F-C24F-434C-B294-8ED2D4CC1860</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for DataHub module.</Abstract>
- <Description>This driver initializes and installs the Data Hub protocol.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DataHub</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DataHub.c</Filename>
- <Filename>DataHub.h</Filename>
- <Filename>DataHub.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>DataHubInstall</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.c b/EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.c
deleted file mode 100644
index ac703fd..0000000
--- a/EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DataHubStdErr.c
-
-Abstract:
-
- Data Hub filter driver that takes DEBUG () info from Data Hub and writes it
- to StdErr if it exists.
-
---*/
-
-
-
-EFI_DATA_HUB_PROTOCOL *mDataHub = NULL;
-
-EFI_EVENT mDataHubStdErrEvent;
-
-STATIC
-VOID
-EFIAPI
-DataHubStdErrEventHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
- Event handler registered with the Data Hub to parse EFI_DEBUG_CODE. This
- handler reads the Data Hub and sends any DEBUG info to StdErr.
-
-Arguments:
- Event - The event that occured, not used
- Context - DataHub Protocol Pointer
-
-Returns:
- None.
-
---*/
-{
- EFI_STATUS Status;
- EFI_DATA_HUB_PROTOCOL *DataHub;
- EFI_DATA_RECORD_HEADER *Record;
- DATA_HUB_STATUS_CODE_DATA_RECORD *DataRecord;
- UINT64 Mtc;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto;
- INT32 OldAttribute;
-
- DataHub = (EFI_DATA_HUB_PROTOCOL *) Context;
-
- //
- // If StdErr is not yet initialized just return a DEBUG print in the BDS
- // after consoles are connect will make sure data gets flushed properly
- // when StdErr is availible.
- //
- if (gST == NULL) {
- return ;
- }
-
- if (gST->StdErr == NULL) {
- return ;
- }
- //
- // Mtc of zero means return the next record that has not been read by the
- // event handler.
- //
- Mtc = 0;
- do {
- Status = DataHub->GetNextRecord (DataHub, &Mtc, &mDataHubStdErrEvent, &Record);
- if (!EFI_ERROR (Status)) {
- if (CompareGuid (&Record->DataRecordGuid, &gEfiStatusCodeGuid)) {
- DataRecord = (DATA_HUB_STATUS_CODE_DATA_RECORD *) (((CHAR8 *) Record) + Record->HeaderSize);
-
- if (DataRecord->Data.HeaderSize > 0) {
- if (CompareGuid (&DataRecord->Data.Type, &gEfiStatusCodeDataTypeDebugGuid)) {
- //
- // If the Data record is from a DEBUG () then send it to Standard Error
- //
- Sto = gST->StdErr;
- OldAttribute = Sto->Mode->Attribute;
- Sto->SetAttribute (Sto, EFI_TEXT_ATTR (EFI_MAGENTA, EFI_BLACK));
- Sto->OutputString (Sto, (CHAR16 *) (DataRecord + 1));
- Sto->SetAttribute (Sto, OldAttribute);
- }
- }
- }
- }
- } while ((Mtc != 0) && !EFI_ERROR (Status));
-}
-
-EFI_STATUS
-EFIAPI
-DataHubStdErrInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Register an event handler with the Data Hub to parse EFI_DEBUG_CODE. This
- handler reads the Data Hub and sends any DEBUG info to StdErr.
-
-Arguments:
-
- ImageHandle - Image handle of this driver.
- SystemTable - Pointer to EFI system table.
-
-Returns:
-
- EFI_SUCCESS - The event handler was registered.
- EFI_OUT_OF_RESOURCES - The event hadler was not registered due to lack of
- system resources.
-
---*/
-{
- EFI_STATUS Status;
- UINT64 DataClass;
-
- gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID **) &mDataHub);
- //
- // Should never fail due to Depex grammer.
- //
- ASSERT (mDataHub != NULL);
-
- //
- // Create an event and register it with the filter driver
- //
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- DataHubStdErrEventHandler,
- mDataHub,
- &mDataHubStdErrEvent
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- DataClass = EFI_DATA_RECORD_CLASS_DEBUG | EFI_DATA_RECORD_CLASS_ERROR;
- Status = mDataHub->RegisterFilterDriver (
- mDataHub,
- mDataHubStdErrEvent,
- TPL_CALLBACK,
- DataClass,
- NULL
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (mDataHubStdErrEvent);
- }
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.dxs b/EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.dxs
deleted file mode 100644
index 9603a3e..0000000
--- a/EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DataHubStdErr.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-
-DEPENDENCY_START
- EFI_DATA_HUB_PROTOCOL_GUID
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.msa b/EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.msa
deleted file mode 100644
index 1c934c6..0000000
--- a/EdkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.msa
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DataHubStdErr</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>CA515306-00CE-4032-874E-11B755FF6866</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Data Hub filter driver.</Abstract>
- <Description>This driver takes DEBUG () info from Data Hub and writes it to StdErr if it exists.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DataHubStdErr</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DataHubStdErr.c</Filename>
- <Filename>DataHubStdErr.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <DataHubs>
- <DataHubRecord Usage="SOMETIMES_CONSUMED">
- <DataHubCName>DATA_HUB_STATUS_CODE_DATA_RECORD</DataHubCName>
- <HelpText>DEBUG() data that is recorded in status code data hub will be sent to Standard Error.</HelpText>
- </DataHubRecord>
- </DataHubs>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiStatusCodeGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiStatusCodeDataTypeDebugGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>DataHubStdErrInitialize</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c
deleted file mode 100644
index a0ec6c5..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DebugSupport.c
-
-Abstract:
-
- Top level C file for debug support driver. Contains initialization function.
-
-Revision History
-
---*/
-
-//
-// private header files
-//
-#include "plDebugSupport.h"
-
-//
-// This is a global that is the actual interface
-//
-EFI_DEBUG_SUPPORT_PROTOCOL gDebugSupportProtocolInterface = {
- EFI_ISA,
- GetMaximumProcessorIndex,
- RegisterPeriodicCallback,
- RegisterExceptionCallback,
- InvalidateInstructionCache
-};
-
-//
-// Driver Entry Point
-//
-EFI_STATUS
-InitializeDebugSupportDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Driver entry point. Checks to see there's not already a DebugSupport protocol
- installed for the selected processor before installing protocol.
-
-Arguments:
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
-
-Returns:
-
- EFI_STATUS
-
---*/
-// TODO: ImageHandle - add argument and description to function comment
-// TODO: SystemTable - add argument and description to function comment
-{
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImageProtocolPtr;
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EFI_HANDLE *HandlePtr;
- UINTN NumHandles;
- EFI_DEBUG_SUPPORT_PROTOCOL *DebugSupportProtocolPtr;
-
- //
- // Install Protocol Interface...
- //
- // First check to see that the debug support protocol for this processor
- // type is not already installed
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiDebugSupportProtocolGuid,
- NULL,
- &NumHandles,
- &HandlePtr
- );
-
- if (Status != EFI_NOT_FOUND) {
- do {
- NumHandles--;
- Status = gBS->OpenProtocol (
- HandlePtr[NumHandles],
- &gEfiDebugSupportProtocolGuid,
- (VOID **) &DebugSupportProtocolPtr,
- ImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (Status == EFI_SUCCESS && DebugSupportProtocolPtr->Isa == EFI_ISA) {
- FreePool (HandlePtr);
- Status = EFI_ALREADY_STARTED;
- goto ErrExit;
- }
- } while (NumHandles > 0);
- FreePool (HandlePtr);
- }
-
- //
- // Get our image information and install platform specific unload handler
- //
- Status = gBS->OpenProtocol (
- ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **) &LoadedImageProtocolPtr,
- ImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- ASSERT (!EFI_ERROR (Status));
- if (Status != EFI_SUCCESS) {
- goto ErrExit;
- }
-
- LoadedImageProtocolPtr->Unload = plUnloadDebugSupportDriver;
-
- //
- // Call hook for platform specific initialization
- //
- Status = plInitializeDebugSupportDriver ();
- ASSERT (!EFI_ERROR (Status));
- if (Status != EFI_SUCCESS) {
- goto ErrExit;
- }
-
- //
- // Install DebugSupport protocol to new handle
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiDebugSupportProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &gDebugSupportProtocolInterface
- );
- ASSERT (!EFI_ERROR (Status));
- if (Status != EFI_SUCCESS) {
- goto ErrExit;
- }
-
-ErrExit:
- return Status;
-}
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.dxs b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.dxs
deleted file mode 100644
index 2061cf2..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.dxs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DebugSupport.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa
deleted file mode 100644
index 6d1be75..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DebugSupport</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>911D584C-35F7-4955-BEF9-B452769DDC3A</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for DebugSupport module.</Abstract>
- <Description>This driver installs DebugSupport protocol for the selected processor.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DebugSupport</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a">
- <Keyword>BaseMemoryLib</Keyword>
- <HelpText>Recommended libary Instance is DxeMemoryLib instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="4674739d-3195-4fb2-8094-ac1d22d00194">
- <Keyword>MemoryAllocationLib</Keyword>
- <HelpText>Recommended libary Instance is DxeMemoryAllocationLib instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DebugSupport.c</Filename>
- <Filename>DebugSupport.dxs</Filename>
- <Filename ToolChainFamily="MSFT" SupArchList="IA32">Ia32/AsmFuncs.asm</Filename>
- <Filename ToolChainFamily="GCC" SupArchList="IA32">Ia32/AsmFuncs.S</Filename>
- <Filename SupArchList="IA32">Ia32/plDebugSupport.h</Filename>
- <Filename SupArchList="IA32">Ia32/plDebugSupport.c</Filename>
- <Filename SupArchList="IPF">ipf/AsmFuncs.s</Filename>
- <Filename SupArchList="IPF">ipf/common.i</Filename>
- <Filename SupArchList="IPF">ipf/Ds64Macros.i</Filename>
- <Filename SupArchList="IPF">ipf/plDebugSupport.c</Filename>
- <Filename SupArchList="IPF">ipf/plDebugSupport.h</Filename>
- <Filename ToolChainFamily="MSFT" SupArchList="X64">x64/AsmFuncs.asm</Filename>
- <Filename ToolChainFamily="GCC" SupArchList="X64">x64/AsmFuncs.S</Filename>
- <Filename SupArchList="X64">x64/plDebugSupport.h</Filename>
- <Filename SupArchList="X64">x64/plDebugSupport.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="SOMETIMES_PRODUCED">
- <ProtocolCName>gEfiDebugSupportProtocolGuid</ProtocolCName>
- <HelpText>If the debug support protocol for this processor type is not
- already installed, this protocol will be installed. Otherwise, it will
- be not installed again.</HelpText>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>InitializeDebugSupportDriver</ModuleEntryPoint>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdNtEmulatorEnable</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>If this PCD is set as TRUE, NT emulator will be endabled.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/AsmFuncs.S b/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/AsmFuncs.S
deleted file mode 100644
index 3063e82..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/AsmFuncs.S
+++ /dev/null
@@ -1,270 +0,0 @@
-#******************************************************************************
-#*
-#* Copyright (c) 2006, Intel Corporation
-#* All rights reserved. This program and the accompanying materials
-#* are licensed and made available under the terms and conditions of the BSD License
-#* which accompanies this distribution. The full text of the license may be found at
-#* http://opensource.org/licenses/bsd-license.php
-#*
-#* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#*
-#******************************************************************************
-
-.globl ASM_PFX(OrigVector)
-.globl ASM_PFX(InterruptEntryStub)
-.globl ASM_PFX(StubSize)
-.globl ASM_PFX(CommonIdtEntry)
-.globl ASM_PFX(FxStorSupport)
-
-ASM_PFX(AppEsp): .long 0x11111111 # ?
-ASM_PFX(DebugEsp): .long 0x22222222 # ?
-ASM_PFX(ExtraPush): .long 0x33333333 # ?
-ASM_PFX(ExceptData): .long 0x44444444 # ?
-ASM_PFX(Eflags): .long 0x55555555 # ?
-ASM_PFX(OrigVector): .long 0x66666666 # ?
-ASM_PFX(StubSize): .long ASM_PFX(InterruptEntryStubEnd) - ASM_PFX(InterruptEntryStub)
-
-.globl ASM_PFX(FxStorSupport)
-ASM_PFX(FxStorSupport):
- push %ebx
- mov $0x1,%eax
- cpuid
- mov %edx,%eax
- and $0x1000000,%eax
- shr $0x18,%eax
- pop %ebx
- ret
-
-.globl ASM_PFX(GetIdtr)
-ASM_PFX(GetIdtr):
- push %ebp
- mov %esp,%ebp
- add $0xfffffff8,%esp
- sidtl 0xfffffffa(%ebp)
- mov 0xfffffffc(%ebp),%eax
- leave
- ret
-
-.globl ASM_PFX(WriteInterruptFlag)
-ASM_PFX(WriteInterruptFlag):
- push %ebp
- mov %esp,%ebp
- pushf
- pop %eax
- and $0x200,%eax
- shr $0x9,%eax
- mov 0x8(%ebp),%ecx
- or %cl,%cl
- jne ASM_PFX(WriteInterruptFlag+0x17)
- cli
- jmp ASM_PFX(WriteInterruptFlag+0x18)
- sti
- leave
- ret
-
-.globl ASM_PFX(Vect2Desc)
-ASM_PFX(Vect2Desc):
- push %ebp
- mov %esp,%ebp
- mov 0xc(%ebp),%eax
- mov 0x8(%ebp),%ecx
- mov %ax,(%ecx)
- movw $0x20,0x2(%ecx)
- movw $0x8e00,0x4(%ecx)
- shr $0x10,%eax
- mov %ax,0x6(%ecx)
- leave
- ret
-
-.globl ASM_PFX(InterruptEntryStub)
-ASM_PFX(InterruptEntryStub):
- mov %esp,0x0
- mov $0x0,%esp
- push $0x0
- jmp ASM_PFX(CommonIdtEntry)
-.globl ASM_PFX(InterruptEntryStubEnd)
-ASM_PFX(InterruptEntryStubEnd):
-
-.globl ASM_PFX(CommonIdtEntry)
-ASM_PFX(CommonIdtEntry):
- pusha
- pushf
- pop %eax
- mov %eax,0x0
- cmpl $0x8,0x0
- jne ASM_PFX(CommonIdtEntry+0x20)
- movl $0x1,0x0
- jmp ASM_PFX(CommonIdtEntry+0xa8)
- cmpl $0xa,0x0
- jne ASM_PFX(CommonIdtEntry+0x35)
- movl $0x1,0x0
- jmp ASM_PFX(CommonIdtEntry+0xa8)
- cmpl $0xb,0x0
- jne ASM_PFX(CommonIdtEntry+0x4a)
- movl $0x1,0x0
- jmp ASM_PFX(CommonIdtEntry+0xa8)
- cmpl $0xc,0x0
- jne ASM_PFX(CommonIdtEntry+0x5f)
- movl $0x1,0x0
- jmp ASM_PFX(CommonIdtEntry+0xa8)
- cmpl $0xd,0x0
- jne ASM_PFX(CommonIdtEntry+0x74)
- movl $0x1,0x0
- jmp ASM_PFX(CommonIdtEntry+0xa8)
- cmpl $0xe,0x0
- jne ASM_PFX(CommonIdtEntry+0x89)
- movl $0x1,0x0
- jmp ASM_PFX(CommonIdtEntry+0xa8)
- cmpl $0x11,0x0
- jne ASM_PFX(CommonIdtEntry+0x9e)
- movl $0x1,0x0
- jmp ASM_PFX(CommonIdtEntry+0xa8)
- movl $0x0,0x0
- cmpl $0x1,0x0
- jne ASM_PFX(CommonIdtEntry+0xc8)
- mov 0x0,%eax
- mov (%eax),%ebx
- mov %ebx,0x0
- add $0x4,%eax
- mov %eax,0x0
- jmp ASM_PFX(CommonIdtEntry+0xd2)
- movl $0x0,0x0
- mov 0xc(%esp),%eax
- mov %eax,0x0
- mov 0x0,%eax
- add $0xc,%eax
- mov %eax,0xc(%esp)
- mov %ss,%eax
- push %eax
- mov 0x0,%eax
- movzwl 0x4(%eax),%eax
- push %eax
- mov %ds,%eax
- push %eax
- mov %es,%eax
- push %eax
- mov %fs,%eax
- push %eax
- mov %gs,%eax
- push %eax
- mov 0x0,%eax
- pushl (%eax)
- push $0x0
- push $0x0
- sidtl (%esp)
- push $0x0
- push $0x0
- sgdtl (%esp)
- xor %eax,%eax
- str %eax
- push %eax
- sldt %eax
- push %eax
- mov 0x0,%eax
- pushl 0x8(%eax)
- mov %cr4,%eax
- or $0x208,%eax
- mov %eax,%cr4
- push %eax
- mov %cr3,%eax
- push %eax
- mov %cr2,%eax
- push %eax
- push $0x0
- mov %cr0,%eax
- push %eax
- mov %db7,%eax
- push %eax
- xor %eax,%eax
- mov %eax,%db7
- mov %db6,%eax
- push %eax
- xor %eax,%eax
- mov %eax,%db6
- mov %db3,%eax
- push %eax
- mov %db2,%eax
- push %eax
- mov %db1,%eax
- push %eax
- mov %db0,%eax
- push %eax
- sub $0x200,%esp
- mov %esp,%edi
- fxsave (%edi)
- mov 0x0,%eax
- push %eax
- mov %esp,%eax
- push %eax
- mov 0x0,%eax
- push %eax
- call ASM_PFX(CommonIdtEntry+0x184)
- add $0x8,%esp
- add $0x4,%esp
- mov %esp,%esi
- fxrstor (%esi)
- add $0x200,%esp
- pop %eax
- mov %eax,%db0
- pop %eax
- mov %eax,%db1
- pop %eax
- mov %eax,%db2
- pop %eax
- mov %eax,%db3
- add $0x4,%esp
- pop %eax
- mov %eax,%db7
- pop %eax
- mov %eax,%cr0
- add $0x4,%esp
- pop %eax
- mov %eax,%cr2
- pop %eax
- mov %eax,%cr3
- pop %eax
- mov %eax,%cr4
- mov 0x0,%eax
- popl 0x8(%eax)
- add $0x18,%esp
- popl (%eax)
- pop %gs
- pop %fs
- pop %es
- pop %ds
- popl 0x4(%eax)
- pop %ss
- mov 0xc(%esp),%ebx
- mov 0x0,%eax
- add $0xc,%eax
- cmp %eax,%ebx
- je ASM_PFX(CommonIdtEntry+0x202)
- mov 0x0,%eax
- mov (%eax),%ecx
- mov %ecx,(%ebx)
- mov 0x4(%eax),%ecx
- mov %ecx,0x4(%ebx)
- mov 0x8(%eax),%ecx
- mov %ecx,0x8(%ebx)
- mov %ebx,%eax
- mov %eax,0x0
- mov 0x0,%eax
- mov %eax,0xc(%esp)
- cmpl $0x68,0x0
- jne PhonyIretd+0xd
- mov 0x0,%eax
- mov 0x8(%eax),%ebx
- and $0xfffffcff,%ebx
- push %ebx
- push %cs
- push $0x0
- iret
-
-PhonyIretd:
- popa
- mov 0x0,%esp
- jmp *0x0
- popa
- mov 0x0,%esp
- iret
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/AsmFuncs.asm b/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/AsmFuncs.asm
deleted file mode 100644
index 28a43cf..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/AsmFuncs.asm
+++ /dev/null
@@ -1,548 +0,0 @@
-;******************************************************************************
-;*
-;* Copyright (c) 2006, Intel Corporation
-;* All rights reserved. This program and the accompanying materials
-;* are licensed and made available under the terms and conditions of the BSD License
-;* which accompanies this distribution. The full text of the license may be found at
-;* http://opensource.org/licenses/bsd-license.php
-;*
-;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;*
-;******************************************************************************
-
-.586p
-.MODEL FLAT, C
-
-EXCPT32_DIVIDE_ERROR EQU 0
-EXCPT32_DEBUG EQU 1
-EXCPT32_NMI EQU 2
-EXCPT32_BREAKPOINT EQU 3
-EXCPT32_OVERFLOW EQU 4
-EXCPT32_BOUND EQU 5
-EXCPT32_INVALID_OPCODE EQU 6
-EXCPT32_DOUBLE_FAULT EQU 8
-EXCPT32_INVALID_TSS EQU 10
-EXCPT32_SEG_NOT_PRESENT EQU 11
-EXCPT32_STACK_FAULT EQU 12
-EXCPT32_GP_FAULT EQU 13
-EXCPT32_PAGE_FAULT EQU 14
-EXCPT32_FP_ERROR EQU 16
-EXCPT32_ALIGNMENT_CHECK EQU 17
-EXCPT32_MACHINE_CHECK EQU 18
-EXCPT32_SIMD EQU 19
-
-FXSTOR_FLAG EQU 01000000h ; bit cpuid 24 of feature flags
-
-;; The FXSTOR and FXRSTOR commands are used for saving and restoring the x87,
-;; MMX, SSE, SSE2, etc registers. The initialization of the debugsupport driver
-;; MUST check the CPUID feature flags to see that these instructions are available
-;; and fail to init if they are not.
-
-;; fxstor [edi]
-FXSTOR_EDI MACRO
- db 0fh, 0aeh, 00000111y ; mod = 00, reg/op = 000, r/m = 111 = [edi]
-ENDM
-
-;; fxrstor [esi]
-FXRSTOR_ESI MACRO
- db 0fh, 0aeh, 00001110y ; mod = 00, reg/op = 001, r/m = 110 = [esi]
-ENDM
-.DATA
-
-public OrigVector, InterruptEntryStub, StubSize, CommonIdtEntry, FxStorSupport
-
-StubSize dd InterruptEntryStubEnd - InterruptEntryStub
-AppEsp dd 11111111h ; ?
-DebugEsp dd 22222222h ; ?
-ExtraPush dd 33333333h ; ?
-ExceptData dd 44444444h ; ?
-Eflags dd 55555555h ; ?
-OrigVector dd 66666666h ; ?
-
-;; The declarations below define the memory region that will be used for the debug stack.
-;; The context record will be built by pushing register values onto this stack.
-;; It is imparitive that alignment be carefully managed, since the FXSTOR and
-;; FXRSTOR instructions will GP fault if their memory operand is not 16 byte aligned.
-;;
-;; The stub will switch stacks from the application stack to the debuger stack
-;; and pushes the exception number.
-;;
-;; Then we building the context record on the stack. Since the stack grows down,
-;; we push the fields of the context record from the back to the front. There
-;; are 132 bytes of stack used prior allocating the 512 bytes of stack to be
-;; used as the memory buffer for the fxstor instruction. Therefore address of
-;; the buffer used for the FXSTOR instruction is &Eax - 132 - 512, which
-;; must be 16 byte aligned.
-;;
-;; We carefully locate the stack to make this happen.
-;;
-;; For reference, the context structure looks like this:
-;; struct {
-;; UINT32 ExceptionData;
-;; FX_SAVE_STATE_IA32 FxSaveState; // 512 bytes, must be 16 byte aligned
-;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
-;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
-;; UINT32 EFlags;
-;; UINT32 Ldtr, Tr;
-;; UINT32 Gdtr[2], Idtr[2];
-;; UINT32 Eip;
-;; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
-;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
-;; } SYSTEM_CONTEXT_IA32; // 32 bit system context record
-
-
-align 16
-DebugStackEnd db "DbgStkEnd >>>>>>" ;; 16 byte long string - must be 16 bytes to preserve alignment
- dd 1ffdh dup (000000000h) ;; 32K should be enough stack
- ;; This allocation is coocked to insure
- ;; that the the buffer for the FXSTORE instruction
- ;; will be 16 byte aligned also.
- ;;
-ExceptionNumber dd ? ;; first entry will be the vector number pushed by the stub
-
-DebugStackBegin db "<<<< DbgStkBegin" ;; initial debug ESP == DebugStackBegin, set in stub
-
-.CODE
-
-externdef InterruptDistrubutionHub:near
-
-;------------------------------------------------------------------------------
-; BOOLEAN
-; FxStorSupport (
-; void
-; )
-;
-; Abstract: Returns TRUE if FxStor instructions are supported
-;
-FxStorSupport PROC C PUBLIC
-
-;
-; cpuid corrupts ebx which must be preserved per the C calling convention
-;
- push ebx
- mov eax, 1
- cpuid
- mov eax, edx
- and eax, FXSTOR_FLAG
- shr eax, 24
- pop ebx
- ret
-FxStorSupport ENDP
-
-
-;------------------------------------------------------------------------------
-; DESCRIPTOR *
-; GetIdtr (
-; void
-; )
-;
-; Abstract: Returns physical address of IDTR
-;
-GetIdtr PROC C PUBLIC
- LOCAL IdtrBuf:FWORD
-
- sidt IdtrBuf
- mov eax, DWORD PTR IdtrBuf + 2
- ret
-GetIdtr ENDP
-
-
-;------------------------------------------------------------------------------
-; BOOLEAN
-; WriteInterruptFlag (
-; BOOLEAN NewState
-; )
-;
-; Abstract: Programs interrupt flag to the requested state and returns previous
-; state.
-;
-WriteInterruptFlag PROC C PUBLIC State:DWORD
-
- pushfd
- pop eax
- and eax, 200h
- shr eax, 9
- mov ecx, State
- .IF cl == 0
- cli
- .ELSE
- sti
- .ENDIF
- ret
-
-WriteInterruptFlag ENDP
-
-
-
-;------------------------------------------------------------------------------
-; void
-; Vect2Desc (
-; DESCRIPTOR * DestDesc,
-; void (*Vector) (void)
-; )
-;
-; Abstract: Encodes an IDT descriptor with the given physical address
-;
-Vect2Desc PROC C PUBLIC DestPtr:DWORD, Vector:DWORD
-
- mov eax, Vector
- mov ecx, DestPtr
- mov word ptr [ecx], ax ; write bits 15..0 of offset
- mov dx, cs
- mov word ptr [ecx+2], dx ; SYS_CODE_SEL from GDT
- mov word ptr [ecx+4], 0e00h OR 8000h ; type = 386 interrupt gate, present
- shr eax, 16
- mov word ptr [ecx+6], ax ; write bits 31..16 of offset
-
- ret
-
-Vect2Desc ENDP
-
-
-
-;------------------------------------------------------------------------------
-; InterruptEntryStub
-;
-; Abstract: This code is not a function, but is a small piece of code that is
-; copied and fixed up once for each IDT entry that is hooked.
-;
-InterruptEntryStub::
- mov AppEsp, esp ; save stack top
- mov esp, offset DebugStackBegin ; switch to debugger stack
- push 0 ; push vector number - will be modified before installed
- db 0e9h ; jump rel32
- dd 0 ; fixed up to relative address of CommonIdtEntry
-InterruptEntryStubEnd:
-
-
-
-;------------------------------------------------------------------------------
-; CommonIdtEntry
-;
-; Abstract: This code is not a function, but is the common part for all IDT
-; vectors.
-;
-CommonIdtEntry::
-;;
-;; At this point, the stub has saved the current application stack esp into AppEsp
-;; and switched stacks to the debug stack, where it pushed the vector number
-;;
-;; The application stack looks like this:
-;;
-;; ...
-;; (last application stack entry)
-;; eflags from interrupted task
-;; CS from interrupted task
-;; EIP from interrupted task
-;; Error code <-------------------- Only present for some exeption types
-;;
-;;
-
-
-;; The stub switched us to the debug stack and pushed the interrupt number.
-;;
-;; Next, construct the context record. It will be build on the debug stack by
-;; pushing the registers in the correct order so as to create the context structure
-;; on the debug stack. The context record must be built from the end back to the
-;; beginning because the stack grows down...
-;
-;; For reference, the context record looks like this:
-;;
-;; typedef
-;; struct {
-;; UINT32 ExceptionData;
-;; FX_SAVE_STATE_IA32 FxSaveState;
-;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
-;; UINT32 Cr0, Cr2, Cr3, Cr4;
-;; UINT32 EFlags;
-;; UINT32 Ldtr, Tr;
-;; UINT32 Gdtr[2], Idtr[2];
-;; UINT32 Eip;
-;; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
-;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
-;; } SYSTEM_CONTEXT_IA32; // 32 bit system context record
-
-;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
- pushad
-
-;; Save interrupt state eflags register...
- pushfd
- pop eax
- mov dword ptr Eflags, eax
-
-;; We need to determine if any extra data was pushed by the exception, and if so, save it
-;; To do this, we check the exception number pushed by the stub, and cache the
-;; result in a variable since we'll need this again.
- .IF ExceptionNumber == EXCPT32_DOUBLE_FAULT
- mov ExtraPush, 1
- .ELSEIF ExceptionNumber == EXCPT32_INVALID_TSS
- mov ExtraPush, 1
- .ELSEIF ExceptionNumber == EXCPT32_SEG_NOT_PRESENT
- mov ExtraPush, 1
- .ELSEIF ExceptionNumber == EXCPT32_STACK_FAULT
- mov ExtraPush, 1
- .ELSEIF ExceptionNumber == EXCPT32_GP_FAULT
- mov ExtraPush, 1
- .ELSEIF ExceptionNumber == EXCPT32_PAGE_FAULT
- mov ExtraPush, 1
- .ELSEIF ExceptionNumber == EXCPT32_ALIGNMENT_CHECK
- mov ExtraPush, 1
- .ELSE
- mov ExtraPush, 0
- .ENDIF
-
-;; If there's some extra data, save it also, and modify the saved AppEsp to effectively
-;; pop this value off the application's stack.
- .IF ExtraPush == 1
- mov eax, AppEsp
- mov ebx, [eax]
- mov ExceptData, ebx
- add eax, 4
- mov AppEsp, eax
- .ELSE
- mov ExceptData, 0
- .ENDIF
-
-;; The "pushad" above pushed the debug stack esp. Since what we're actually doing
-;; is building the context record on the debug stack, we need to save the pushed
-;; debug ESP, and replace it with the application's last stack entry...
- mov eax, [esp + 12]
- mov DebugEsp, eax
- mov eax, AppEsp
- add eax, 12
- ; application stack has eflags, cs, & eip, so
- ; last actual application stack entry is
- ; 12 bytes into the application stack.
- mov [esp + 12], eax
-
-;; continue building context record
-;; UINT32 Gs, Fs, Es, Ds, Cs, Ss; insure high 16 bits of each is zero
- mov eax, ss
- push eax
-
- ; CS from application is one entry back in application stack
- mov eax, AppEsp
- movzx eax, word ptr [eax + 4]
- push eax
-
- mov eax, ds
- push eax
- mov eax, es
- push eax
- mov eax, fs
- push eax
- mov eax, gs
- push eax
-
-;; UINT32 Eip;
- ; Eip from application is on top of application stack
- mov eax, AppEsp
- push dword ptr [eax]
-
-;; UINT32 Gdtr[2], Idtr[2];
- push 0
- push 0
- sidt fword ptr [esp]
- push 0
- push 0
- sgdt fword ptr [esp]
-
-;; UINT32 Ldtr, Tr;
- xor eax, eax
- str ax
- push eax
- sldt ax
- push eax
-
-;; UINT32 EFlags;
-;; Eflags from application is two entries back in application stack
- mov eax, AppEsp
- push dword ptr [eax + 8]
-
-;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
-;; insure FXSAVE/FXRSTOR is enabled in CR4...
-;; ... while we're at it, make sure DE is also enabled...
- mov eax, cr4
- or eax, 208h
- mov cr4, eax
- push eax
- mov eax, cr3
- push eax
- mov eax, cr2
- push eax
- push 0
- mov eax, cr0
- push eax
-
-;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
- mov eax, dr7
- push eax
-;; clear Dr7 while executing debugger itself
- xor eax, eax
- mov dr7, eax
-
- mov eax, dr6
- push eax
-;; insure all status bits in dr6 are clear...
- xor eax, eax
- mov dr6, eax
-
- mov eax, dr3
- push eax
- mov eax, dr2
- push eax
- mov eax, dr1
- push eax
- mov eax, dr0
- push eax
-
-;; FX_SAVE_STATE_IA32 FxSaveState;
- sub esp, 512
- mov edi, esp
- ; IMPORTANT!! The debug stack has been carefully constructed to
- ; insure that esp and edi are 16 byte aligned when we get here.
- ; They MUST be. If they are not, a GP fault will occur.
- FXSTOR_EDI
-
-;; UINT32 ExceptionData;
- mov eax, ExceptData
- push eax
-
-; call to C code which will in turn call registered handler
-; pass in the vector number
- mov eax, esp
- push eax
- mov eax, ExceptionNumber
- push eax
- call InterruptDistrubutionHub
- add esp, 8
-
-; restore context...
-;; UINT32 ExceptionData;
- add esp, 4
-
-;; FX_SAVE_STATE_IA32 FxSaveState;
- mov esi, esp
- FXRSTOR_ESI
- add esp, 512
-
-;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
- pop eax
- mov dr0, eax
- pop eax
- mov dr1, eax
- pop eax
- mov dr2, eax
- pop eax
- mov dr3, eax
-;; skip restore of dr6. We cleared dr6 during the context save.
- add esp, 4
- pop eax
- mov dr7, eax
-
-;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
- pop eax
- mov cr0, eax
- add esp, 4
- pop eax
- mov cr2, eax
- pop eax
- mov cr3, eax
- pop eax
- mov cr4, eax
-
-;; UINT32 EFlags;
- mov eax, AppEsp
- pop dword ptr [eax + 8]
-
-;; UINT32 Ldtr, Tr;
-;; UINT32 Gdtr[2], Idtr[2];
-;; Best not let anyone mess with these particular registers...
- add esp, 24
-
-;; UINT32 Eip;
- pop dword ptr [eax]
-
-;; UINT32 SegGs, SegFs, SegEs, SegDs, SegCs, SegSs;
-;; NOTE - modified segment registers could hang the debugger... We
-;; could attempt to insulate ourselves against this possibility,
-;; but that poses risks as well.
-;;
-
- pop gs
- pop fs
- pop es
- pop ds
- pop [eax + 4]
- pop ss
-
-;; The next stuff to restore is the general purpose registers that were pushed
-;; using the "pushad" instruction.
-;;
-;; The value of ESP as stored in the context record is the application ESP
-;; including the 3 entries on the application stack caused by the exception
-;; itself. It may have been modified by the debug agent, so we need to
-;; determine if we need to relocate the application stack.
-
- mov ebx, [esp + 12] ; move the potentially modified AppEsp into ebx
- mov eax, AppEsp
- add eax, 12
- cmp ebx, eax
- je NoAppStackMove
-
- mov eax, AppEsp
- mov ecx, [eax] ; EIP
- mov [ebx], ecx
-
- mov ecx, [eax + 4] ; CS
- mov [ebx + 4], ecx
-
- mov ecx, [eax + 8] ; EFLAGS
- mov [ebx + 8], ecx
-
- mov eax, ebx ; modify the saved AppEsp to the new AppEsp
- mov AppEsp, eax
-NoAppStackMove:
- mov eax, DebugEsp ; restore the DebugEsp on the debug stack
- ; so our "popad" will not cause a stack switch
- mov [esp + 12], eax
-
- cmp ExceptionNumber, 068h
- jne NoChain
-
-Chain:
-
-;; Restore eflags so when we chain, the flags will be exactly as if we were never here.
-;; We gin up the stack to do an iretd so we can get ALL the flags.
- mov eax, AppEsp
- mov ebx, [eax + 8]
- and ebx, NOT 300h ; special handling for IF and TF
- push ebx
- push cs
- push PhonyIretd
- iretd
-PhonyIretd:
-
-;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
- popad
-
-;; Switch back to application stack
- mov esp, AppEsp
-
-;; Jump to original handler
- jmp OrigVector
-
-NoChain:
-;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
- popad
-
-;; Switch back to application stack
- mov esp, AppEsp
-
-;; We're outa here...
- iretd
-END
-
-
-
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c
deleted file mode 100644
index 1eaa5ec..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/**@file
- IA32 specific debug support functions
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-//
-// private header files
-//
-#include "plDebugSupport.h"
-
-//
-// This the global main table to keep track of the interrupts
-//
-IDT_ENTRY *IdtEntryTable = NULL;
-DESCRIPTOR NullDesc = 0;
-
-STATIC
-EFI_STATUS
-CreateEntryStub (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- OUT VOID **Stub
- )
-/*++
-
-Routine Description: Allocate pool for a new IDT entry stub. Copy the generic
- stub into the new buffer and fixup the vector number and jump target address.
-
-Arguments:
- ExceptionType - This is the exception type that the new stub will be created
- for.
- Stub - On successful exit, *Stub contains the newly allocated entry stub.
-Returns:
- Typically EFI_SUCCESS
- other possibilities are passed through from AllocatePool
-
---*/
-{
- UINT8 *StubCopy;
-
- StubCopy = *Stub;
-
- //
- // Fixup the stub code for this vector
- //
-
- // The stub code looks like this:
- //
- // 00000000 89 25 00000004 R mov AppEsp, esp ; save stack top
- // 00000006 BC 00008014 R mov esp, offset DbgStkBot ; switch to debugger stack
- // 0000000B 6A 00 push 0 ; push vector number - will be modified before installed
- // 0000000D E9 db 0e9h ; jump rel32
- // 0000000E 00000000 dd 0 ; fixed up to relative address of CommonIdtEntry
- //
-
- //
- // poke in the exception type so the second push pushes the exception type
- //
- StubCopy[0x0c] = (UINT8) ExceptionType;
-
- //
- // fixup the jump target to point to the common entry
- //
- *(UINT32 *) &StubCopy[0x0e] = (UINT32) CommonIdtEntry - (UINT32) &StubCopy[StubSize];
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-HookEntry (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN VOID (*NewCallback) ()
- )
-/*++
-
-Routine Description:
- Creates a nes entry stub. Then saves the current IDT entry and replaces it
- with an interrupt gate for the new entry point. The IdtEntryTable is updated
- with the new registered function.
-
- This code executes in boot services context. The stub entry executes in interrupt
- context.
-
-Arguments:
- ExceptionType - specifies which vector to hook.
- NewCallback - a pointer to the new function to be registered.
-
-Returns:
- EFI_SUCCESS
- Other possibilities are passed through by CreateEntryStub
-
---*/
-{
- BOOLEAN OldIntFlagState;
- EFI_STATUS Status;
-
- Status = CreateEntryStub (ExceptionType, (VOID **) &IdtEntryTable[ExceptionType].StubEntry);
- if (Status == EFI_SUCCESS) {
- OldIntFlagState = WriteInterruptFlag (0);
- ReadIdt (ExceptionType, &(IdtEntryTable[ExceptionType].OrigDesc));
-
- ((UINT16 *) &IdtEntryTable[ExceptionType].OrigVector)[0] = ((UINT16 *) &IdtEntryTable[ExceptionType].OrigDesc)[0];
- ((UINT16 *) &IdtEntryTable[ExceptionType].OrigVector)[1] = ((UINT16 *) &IdtEntryTable[ExceptionType].OrigDesc)[3];
-
- Vect2Desc (&IdtEntryTable[ExceptionType].NewDesc, IdtEntryTable[ExceptionType].StubEntry);
- IdtEntryTable[ExceptionType].RegisteredCallback = NewCallback;
- WriteIdt (ExceptionType, &(IdtEntryTable[ExceptionType].NewDesc));
- WriteInterruptFlag (OldIntFlagState);
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-UnhookEntry (
- IN EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- Undoes HookEntry. This code executes in boot services context.
-
-Arguments:
- ExceptionType - specifies which entry to unhook
-
-Returns:
- EFI_SUCCESS
-
---*/
-{
- BOOLEAN OldIntFlagState;
-
- OldIntFlagState = WriteInterruptFlag (0);
- WriteIdt (ExceptionType, &(IdtEntryTable[ExceptionType].OrigDesc));
- WriteInterruptFlag (OldIntFlagState);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ManageIdtEntryTable (
- VOID (*NewCallback)(),
- EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- This is the main worker function that manages the state of the interrupt
- handlers. It both installs and uninstalls interrupt handlers based on the
- value of NewCallback. If NewCallback is NULL, then uninstall is indicated.
- If NewCallback is non-NULL, then install is indicated.
-
-Arguments:
- NewCallback - If non-NULL, NewCallback specifies the new handler to register.
- If NULL, specifies that the previously registered handler should
- be uninstalled.
- ExceptionType - Indicates which entry to manage
-
-Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
- no handler registered for it
- EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
-
- Other possible return values are passed through from UnHookEntry and HookEntry.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (FeaturePcdGet (PcdNtEmulatorEnable)) {
- if (CompareDescriptor (&IdtEntryTable[ExceptionType].NewDesc, &NullDesc)) {
- //
- // we've already installed to this vector
- //
- if (NewCallback != NULL) {
- //
- // if the input handler is non-null, error
- //
- Status = EFI_ALREADY_STARTED;
- } else {
- Status = UnhookEntry (ExceptionType);
- }
- } else {
- //
- // no user handler installed on this vector
- //
- if (NewCallback == NULL) {
- //
- // if the input handler is null, error
- //
- Status = EFI_INVALID_PARAMETER;
- } else {
- Status = HookEntry (ExceptionType, NewCallback);
- }
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-GetMaximumProcessorIndex (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- OUT UINTN *MaxProcessorIndex
- )
-/*++
-
-Routine Description: This is a DebugSupport protocol member function.
-
-Arguments:
- This - The DebugSupport instance
- MaxProcessorIndex - The maximuim supported processor index
-
-Returns:
- Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
-
---*/
-{
- *MaxProcessorIndex = 0;
- return (EFI_SUCCESS);
-}
-
-EFI_STATUS
-EFIAPI
-RegisterPeriodicCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_PERIODIC_CALLBACK PeriodicCallback
- )
-/*++
-
-Routine Description: This is a DebugSupport protocol member function.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- PeriodicCallback - Callback function
-
-Returns:
-
- EFI_SUCCESS
- EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
- no handler registered for it
- EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
-
- Other possible return values are passed through from UnHookEntry and HookEntry.
-
---*/
-{
- return ManageIdtEntryTable (PeriodicCallback, SYSTEM_TIMER_VECTOR);
-}
-
-EFI_STATUS
-EFIAPI
-RegisterExceptionCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_EXCEPTION_CALLBACK NewCallback,
- IN EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- This is a DebugSupport protocol member function.
-
- This code executes in boot services context.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- NewCallback - Callback function
- ExceptionType - Which exception to hook
-
-Returns:
-
- EFI_SUCCESS
- EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
- no handler registered for it
- EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
-
- Other possible return values are passed through from UnHookEntry and HookEntry.
-
---*/
-{
- return ManageIdtEntryTable (NewCallback, ExceptionType);
-}
-
-EFI_STATUS
-EFIAPI
-InvalidateInstructionCache (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN VOID *Start,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
- This is a DebugSupport protocol member function.
- Calls assembly routine to flush cache.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- Start - Physical base of the memory range to be invalidated
- Length - mininum number of bytes in instruction cache to invalidate
-
-Returns:
-
- EFI_SUCCESS - always return success
-
---*/
-{
- AsmWbinvd ();
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-plInitializeDebugSupportDriver (
- VOID
- )
-/*++
-
-Routine Description:
- Initializes driver's handler registration database.
-
- This code executes in boot services context.
-
-Arguments:
- None
-
-Returns:
- EFI_SUCCESS
- EFI_UNSUPPORTED - if IA32 processor does not support FXSTOR/FXRSTOR instructions,
- the context save will fail, so these processor's are not supported.
- EFI_OUT_OF_RESOURCES - not resource to finish initialization
-
---*/
-{
- EFI_EXCEPTION_TYPE ExceptionType;
-
- if (!FxStorSupport ()) {
- return EFI_UNSUPPORTED;
- }
-
- IdtEntryTable = AllocateZeroPool (sizeof (IDT_ENTRY) * NUM_IDT_ENTRIES);
- if (IdtEntryTable == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType++) {
- IdtEntryTable[ExceptionType].StubEntry = (DEBUG_PROC) (UINTN) AllocatePool (StubSize);
- if (IdtEntryTable[ExceptionType].StubEntry == NULL) {
- goto ErrorCleanup;
- }
-
- CopyMem ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry, InterruptEntryStub, StubSize);
- }
- return EFI_SUCCESS;
-
-ErrorCleanup:
-
- for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType++) {
- if (IdtEntryTable[ExceptionType].StubEntry != NULL) {
- FreePool ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry);
- }
- }
- FreePool (IdtEntryTable);
-
- return EFI_OUT_OF_RESOURCES;
-}
-
-EFI_STATUS
-EFIAPI
-plUnloadDebugSupportDriver (
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
- This is the callback that is written to the LoadedImage protocol instance
- on the image handle. It uninstalls all registered handlers and frees all entry
- stub memory.
-
- This code executes in boot services context.
-
-Arguments:
- ImageHandle - The image handle of the unload handler
-
-Returns:
-
- EFI_SUCCESS - always return success
-
---*/
-{
- EFI_EXCEPTION_TYPE ExceptionType;
-
- for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType++) {
- ManageIdtEntryTable (NULL, ExceptionType);
- }
-
- FreePool (IdtEntryTable);
- return EFI_SUCCESS;
-}
-
-VOID
-InterruptDistrubutionHub (
- EFI_EXCEPTION_TYPE ExceptionType,
- EFI_SYSTEM_CONTEXT_IA32 *ContextRecord
- )
-/*++
-
-Routine Description: Common piece of code that invokes the registered handlers.
-
- This code executes in exception context so no efi calls are allowed.
-
-Arguments:
- ExceptionType - exception type
- ContextRecord - system context
-
-Returns:
-
- None
-
---*/
-{
- if (IdtEntryTable[ExceptionType].RegisteredCallback != NULL) {
- if (ExceptionType != SYSTEM_TIMER_VECTOR) {
- IdtEntryTable[ExceptionType].RegisteredCallback (ExceptionType, ContextRecord);
- } else {
- OrigVector = IdtEntryTable[ExceptionType].OrigVector;
- IdtEntryTable[ExceptionType].RegisteredCallback (ContextRecord);
- }
- }
-}
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.h b/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.h
deleted file mode 100644
index ce8a3fe..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/**@file
- IA32 specific debug support macros, typedefs and prototypes.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _PLDEBUG_SUPPORT_H
-#define _PLDEBUG_SUPPORT_H
-
-#define NUM_IDT_ENTRIES 0x78
-#define SYSTEM_TIMER_VECTOR 0x68
-#define VECTOR_ENTRY_PAGES 1
-#define CopyDescriptor(Dest, Src) CopyMem ((Dest), (Src), sizeof (DESCRIPTOR))
-#define ZeroDescriptor(Dest) CopyDescriptor ((Dest), &NullDesc)
-#define ReadIdt(Vector, Dest) CopyDescriptor ((Dest), &((GetIdtr ())[(Vector)]))
-#define WriteIdt(Vector, Src) CopyDescriptor (&((GetIdtr ())[(Vector)]), (Src))
-#define CompareDescriptor(Desc1, Desc2) CompareMem ((Desc1), (Desc2), sizeof (DESCRIPTOR))
-#define EFI_ISA IsaIa32
-#define FF_FXSR (1 << 24)
-
-typedef UINT64 DESCRIPTOR;
-
-typedef
-VOID
-(*DEBUG_PROC) (
- VOID
- )
-;
-
-typedef struct {
- DESCRIPTOR OrigDesc;
- DEBUG_PROC OrigVector;
- DESCRIPTOR NewDesc;
- DEBUG_PROC StubEntry;
- VOID (*RegisteredCallback) ();
-} IDT_ENTRY;
-
-extern EFI_SYSTEM_CONTEXT SystemContext;
-extern UINT8 InterruptEntryStub[];
-extern UINT32 StubSize;
-extern VOID (*OrigVector) (VOID);
-
-VOID
-CommonIdtEntry (
- VOID
- )
-/*++
-
-Routine Description:
-
- Generic IDT entry
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-
-BOOLEAN
-FxStorSupport (
- VOID
- )
-/*++
-
-Routine Description:
-
- Check whether FXSTOR is supported
-
-Arguments:
-
- None
-
-Returns:
-
- TRUE - supported
- FALSE - not supported
-
---*/
-;
-
-DESCRIPTOR *
-GetIdtr (
- VOID
- )
-/*++
-
-Routine Description:
-
- Return the physical address of IDTR
-
-Arguments:
-
- None
-
-Returns:
-
- The physical address of IDTR
-
---*/
-;
-
-VOID
-Vect2Desc (
- DESCRIPTOR * DestDesc,
- VOID (*Vector) (VOID)
- )
-/*++
-
-Routine Description:
-
- Encodes an IDT descriptor with the given physical address
-
-Arguments:
-
- DestDesc - The IDT descriptor address
- Vector - The interrupt vector entry
-
-Returns:
-
- None
-
---*/
-;
-
-BOOLEAN
-WriteInterruptFlag (
- BOOLEAN NewState
- )
-/*++
-
-Routine Description:
-
- Programs interrupt flag to the requested state and returns previous
- state.
-
-Arguments:
-
- NewState - New interrupt status
-
-Returns:
-
- Old interrupt status
-
---*/
-;
-
-EFI_STATUS
-plInitializeDebugSupportDriver (
- VOID
- )
-/*++
-
-Routine Description:
- Initializes driver's handler registration database.
-
- This code executes in boot services context.
-
-Arguments:
- None
-
-Returns:
- EFI_SUCCESS
- EFI_UNSUPPORTED - if IA32 processor does not support FXSTOR/FXRSTOR instructions,
- the context save will fail, so these processor's are not supported.
- EFI_OUT_OF_RESOURCES - not resource to finish initialization
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-plUnloadDebugSupportDriver (
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
- This is the callback that is written to the LoadedImage protocol instance
- on the image handle. It uninstalls all registered handlers and frees all entry
- stub memory.
-
- This code executes in boot services context.
-
-Arguments:
- ImageHandle - The image handle of the unload handler
-
-Returns:
-
- EFI_SUCCESS - always return success
-
---*/
-;
-
-//
-// DebugSupport protocol member functions
-//
-EFI_STATUS
-EFIAPI
-GetMaximumProcessorIndex (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- OUT UINTN *MaxProcessorIndex
- )
-/*++
-
-Routine Description: This is a DebugSupport protocol member function.
-
-Arguments:
- This - The DebugSupport instance
- MaxProcessorIndex - The maximuim supported processor index
-
-Returns:
- Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-RegisterPeriodicCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_PERIODIC_CALLBACK PeriodicCallback
- )
-/*++
-
-Routine Description: This is a DebugSupport protocol member function.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- PeriodicCallback - Callback function
-
-Returns:
-
- EFI_SUCCESS
- EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
- no handler registered for it
- EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
-
- Other possible return values are passed through from UnHookEntry and HookEntry.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-RegisterExceptionCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_EXCEPTION_CALLBACK NewCallback,
- IN EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- This is a DebugSupport protocol member function.
-
- This code executes in boot services context.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- NewCallback - Callback function
- ExceptionType - Which exception to hook
-
-Returns:
-
- EFI_SUCCESS
- EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
- no handler registered for it
- EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
-
- Other possible return values are passed through from UnHookEntry and HookEntry.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-InvalidateInstructionCache (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN VOID *Start,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
- This is a DebugSupport protocol member function.
- Calls assembly routine to flush cache.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- Start - Physical base of the memory range to be invalidated
- Length - mininum number of bytes in instruction cache to invalidate
-
-Returns:
-
- EFI_SUCCESS - always return success
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/AsmFuncs.s b/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/AsmFuncs.s
deleted file mode 100644
index 866e5db..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/AsmFuncs.s
+++ /dev/null
@@ -1,1389 +0,0 @@
-//++
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// AsmFuncs.s
-//
-// Abstract:
-//
-// Low level IPF routines used by the debug support driver
-//
-// Revision History:
-//
-//--
-
-
-#include "common.i"
-#include "Ds64Macros.i"
-
-.globl PatchSaveBuffer
-.globl IpfContextBuf
-.globl CommonHandler
-.globl ExternalInterruptCount
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// InstructionCacheFlush
-//
-// Description:
-// Flushes instruction cache for specified number of bytes
-//
- .globl InstructionCacheFlush
- .proc InstructionCacheFlush
- .align 32
-InstructionCacheFlush::
- { .mii
- alloc r3=2, 0, 0, 0
- cmp4.leu p0,p6=32, r33;;
- (p6) mov r33=32;;
- }
- { .mii
- nop.m 0
- zxt4 r29=r33;;
- dep.z r30=r29, 0, 5;;
- }
- { .mii
- cmp4.eq p0,p7=r0, r30
- shr.u r28=r29, 5;;
- (p7) adds r28=1, r28;;
- }
- { .mii
- nop.m 0
- shl r27=r28, 5;;
- zxt4 r26=r27;;
- }
- { .mfb
- add r31=r26, r32
- nop.f 0
- nop.b 0
- }
-LoopBack: // $L143:
- { .mii
- fc r32
- adds r32=32, r32;;
- cmp.ltu p14,p15=r32, r31
- }
- { .mfb
- nop.m 0
- nop.f 0
- //(p14) br.cond.dptk.few $L143#;;
- (p14) br.cond.dptk.few LoopBack;;
- }
- { .mmi
- sync.i;;
- srlz.i
- nop.i 0;;
- }
- { .mfb
- nop.m 0
- nop.f 0
- br.ret.sptk.few b0;;
- }
- .endp InstructionCacheFlush
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// ChainHandler
-//
-// Description:
-// Chains an interrupt handler
-//
-// The purpose of this function is to enable chaining of the external interrupt.
-// Since there's no clean SAL abstraction for doing this, we must do it
-// surreptitiously.
-//
-// The reserved IVT entry at offset 0x3400 is coopted for use by this handler.
-// According to Itanium architecture, it is reserved. Strictly speaking, this is
-// not safe, as we're cheating and violating the Itanium architecture. However,
-// as long as we're the only ones cheating, we should be OK. Without hooks in
-// the SAL to enable IVT management, there aren't many good options.
-//
-// The strategy is to replace the first bundle of the external interrupt handler
-// with our own that will branch into a piece of code we've supplied and located
-// in the reserved IVT entry. Only the first bundle of the external interrupt
-// IVT entry is modified.
-//
-// The original bundle is moved and relocated to space
-// allocated within the reserved IVT entry. The next bundle following is
-// is generated to go a hard coded branch back to the second bundle of the
-// external interrupt IVT entry just in case the first bundle had no branch.
-//
-// Our new code will execute our handler, and then fall through to the
-// original bundle after restoring all context appropriately.
-//
-// The following is a representation of what the IVT memory map looks like with
-// our chained handler installed:
-//
-//
-//
-//
-//
-// This IVT entry is Failsafe bundle
-// reserved by the
-// Itanium architecture Original bundle 0
-// and is used for
-// for locating our
-// handler and the
-// original bundle Patch code...
-// zero of the ext
-// interrupt handler
-//
-// RSVD (3400) Unused
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-//
-// EXT_INT (3000) Bundle 0 Bundle zero - This one is
-// modified, all other bundles
-// in the EXT_INT entry are
-// untouched.
-//
-//
-// Arguments:
-//
-// Returns:
-//
-// Notes:
-//
-//
- .globl ChainHandler
- .proc ChainHandler
-ChainHandler:
-
- NESTED_SETUP( 0,2+3,3,0 )
-
- mov r8=1 // r8 = success
- mov r2=cr.iva;;
-//
-// NOTE: There's a potential hazard here in that we're simply stealing a bunch of
-// bundles (memory) from the IVT and assuming there's no catastrophic side effect.
-//
-// First, save IVT area we're taking over with the patch so we can restore it later
-//
- addl out0=PATCH_ENTRY_OFFSET, r2 // out0 = source buffer
- movl out1=PatchSaveBuffer // out1 = destination buffer
- mov out2=0x40;; // out2 = number of bundles to copy... save entire IDT entry
- br.call.sptk.few b0 = CopyBundles
-
-// Next, copy the patch code into the IVT
- movl out0=PatchCode // out0 = source buffer of patch code
- addl out1=PATCH_OFFSET, r2 // out1 = destination buffer - in IVT
- mov out2=NUM_PATCH_BUNDLES;; // out2 = number of bundles to copy
- br.call.sptk.few b0 = CopyBundles
-
-
-// copy original bundle 0 from the external interrupt handler to the
-// appropriate place in the reserved IVT interrupt slot
- addl out0=EXT_INT_ENTRY_OFFSET, r2 // out0 = source buffer
- addl out1=RELOCATED_EXT_INT, r2 // out1 = destination buffer - in reserved IVT
- mov out2=1;; // out2 = copy 1 bundle
- br.call.sptk.few b0 = CopyBundles
-
-// Now relocate it there because it very likely had a branch instruction that
-// that must now be fixed up.
- addl out0=RELOCATED_EXT_INT, r2 // out0 = new runtime address of bundle - in reserved IVT
- addl out1=EXT_INT_ENTRY_OFFSET, r2;;// out1 = IP address of previous location
- mov out2=out0;; // out2 = IP address of new location
- br.call.sptk.few b0 = RelocateBundle
-
-// Now copy into the failsafe branch into the next bundle just in case
-// the original ext int bundle 0 bundle did not contain a branch instruction
- movl out0=FailsafeBranch // out0 = source buffer
- addl out1=FAILSAFE_BRANCH_OFFSET, r2 // out1 = destination buffer - in reserved IVT
- mov out2=1;; // out2 = copy 1 bundle
- br.call.sptk.few b0 = CopyBundles
-
-// Last, copy in our replacement for the external interrupt IVT entry bundle 0
- movl out0=PatchCodeNewBun0 // out0 = source buffer - our replacement bundle 0
- addl out1=EXT_INT_ENTRY_OFFSET, r2 // out1 = destination buffer - bundle 0 of External interrupt entry
- mov out2=1;; // out2 = copy 1 bundle
- br.call.sptk.few b0 = CopyBundles
-
-ChainHandlerDone:
- NESTED_RETURN
-
- .endp ChainHandler
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// UnchainHandler
-//
-// Description:
-// Unchains an interrupt handler
-//
-// Arguments:
-//
-// Returns:
-//
-// Notes:
-//
-//
- .globl UnchainHandler
- .proc UnchainHandler
-
-UnchainHandler:
-
- NESTED_SETUP( 0,2+3,3,0 )
-
- mov r8=1 // r8 = success
- mov r2=cr.iva;; // r2 = interrupt vector address
-
-// First copy original Ext Int bundle 0 back to it's proper home...
- addl out0=RELOCATED_EXT_INT, r2 // out0 = source - in reserved IVT
- addl out1=EXT_INT_ENTRY_OFFSET, r2 // out1 = destination buffer - first bundle of Ext Int entry
- mov out2=1;; // out2 = copy 1 bundle
- br.call.sptk.few b0 = CopyBundles
-
-// Now, relocate it again...
- addl out0=EXT_INT_ENTRY_OFFSET, r2 // out1 = New runtime address
- addl out1=RELOCATED_EXT_INT, r2;; // out0 = IP address of previous location
- mov out2=out0;; // out2 = IP address of new location
- br.call.sptk.few b0 = RelocateBundle
-
-// Last, restore the patch area
- movl out0=PatchSaveBuffer // out0 = source buffer
- addl out1=PATCH_ENTRY_OFFSET, r2 // out1 = destination buffer
- mov out2=0x40;; // out2 = number of bundles to copy... save entire IDT entry
- br.call.sptk.few b0 = CopyBundles
-
-UnchainHandlerDone:
- NESTED_RETURN
-
- .endp UnchainHandler
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// CopyBundles
-//
-// Description:
-// Copies instruction bundles - flushes icache as necessary
-//
-// Arguments:
-// in0 - Bundle source
-// in1 - Bundle destination
-// in2 - Bundle count
-//
-// Returns:
-//
-// Notes:
-// This procedure is a leaf routine
-//
- .proc CopyBundles
-
-CopyBundles:
-
- NESTED_SETUP(3,2+1,0,0)
-
- shl in2=in2, 1;; // in2 = count of 8 byte blocks to copy
-
-CopyBundlesLoop:
-
- cmp.eq p14, p15 = 0, in2;; // Check if done
-(p14) br.sptk.few CopyBundlesDone;;
-
- ld8 loc2=[in0], 0x8;; // loc2 = source bytes
- st8 [in1]=loc2;; // [in1] = destination bytes
- fc in1;; // Flush instruction cache
- sync.i;; // Ensure local and remote data/inst caches in sync
- srlz.i;; // Ensure sync has been observed
- add in1=0x8, in1;; // in1 = next destination
- add in2=-1, in2;; // in2 = decrement 8 bytes blocks to copy
- br.sptk.few CopyBundlesLoop;;
-
-CopyBundlesDone:
- NESTED_RETURN
-
- .endp CopyBundles
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// RelocateBundle
-//
-// Description:
-// Relocates an instruction bundle by updating any ip-relative branch instructions.
-//
-// Arguments:
-// in0 - Runtime address of bundle
-// in1 - IP address of previous location of bundle
-// in2 - IP address of new location of bundle
-//
-// Returns:
-// in0 - 1 if successful or 0 if unsuccessful
-//
-// Notes:
-// This routine examines all slots in the given bundle that are destined for the
-// branch execution unit. If any of these slots contain an IP-relative branch
-// namely instructions B1, B2, B3, or B6, the slot is fixed-up with a new relative
-// address. Errors can occur if a branch cannot be reached.
-//
- .proc RelocateBundle
-
-RelocateBundle:
-
- NESTED_SETUP(3,2+4,3,0)
-
- mov loc2=SLOT0 // loc2 = slot index
- mov loc5=in0;; // loc5 = runtime address of bundle
- mov in0=1;; // in0 = success
-
-RelocateBundleNextSlot:
-
- cmp.ge p14, p15 = SLOT2, loc2;; // Check if maximum slot
-(p15) br.sptk.few RelocateBundleDone
-
- mov out0=loc5;; // out0 = runtime address of bundle
- br.call.sptk.few b0 = GetTemplate
- mov loc3=out0;; // loc3 = instruction template
- mov out0=loc5 // out0 = runtime address of bundle
- mov out1=loc2;; // out1 = instruction slot number
- br.call.sptk.few b0 = GetSlot
- mov loc4=out0;; // loc4 = instruction encoding
- mov out0=loc4 // out0 = instuction encoding
- mov out1=loc2 // out1 = instruction slot number
- mov out2=loc3;; // out2 = instruction template
- br.call.sptk.few b0 = IsSlotBranch
- cmp.eq p14, p15 = 1, out0;; // Check if branch slot
-(p15) add loc2=1,loc2 // Increment slot
-(p15) br.sptk.few RelocateBundleNextSlot
- mov out0=loc4 // out0 = instuction encoding
- mov out1=in1 // out1 = IP address of previous location
- mov out2=in2;; // out2 = IP address of new location
- br.call.sptk.few b0 = RelocateSlot
- cmp.eq p14, p15 = 1, out1;; // Check if relocated slot
-(p15) mov in0=0 // in0 = failure
-(p15) br.sptk.few RelocateBundleDone
- mov out2=out0;; // out2 = instruction encoding
- mov out0=loc5 // out0 = runtime address of bundle
- mov out1=loc2;; // out1 = instruction slot number
- br.call.sptk.few b0 = SetSlot
- add loc2=1,loc2;; // Increment slot
- br.sptk.few RelocateBundleNextSlot
-
-RelocateBundleDone:
- NESTED_RETURN
-
- .endp RelocateBundle
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// RelocateSlot
-//
-// Description:
-// Relocates an instruction bundle by updating any ip-relative branch instructions.
-//
-// Arguments:
-// in0 - Instruction encoding (41-bits, right justified)
-// in1 - IP address of previous location of bundle
-// in2 - IP address of new location of bundle
-//
-// Returns:
-// in0 - Instruction encoding (41-bits, right justified)
-// in1 - 1 if successful otherwise 0
-//
-// Notes:
-// This procedure is a leaf routine
-//
- .proc RelocateSlot
-
-RelocateSlot:
- NESTED_SETUP(3,2+5,0,0)
- extr.u loc2=in0, 37, 4;; // loc2 = instruction opcode
- cmp.eq p14, p15 = 4, loc2;; // IP-relative branch (B1) or
- // IP-relative counted branch (B2)
-(p15) cmp.eq p14, p15 = 5, loc2;; // IP-relative call (B3)
-(p15) cmp.eq p14, p15 = 7, loc2;; // IP-relative predict (B6)
-(p15) mov in1=1 // Instruction did not need to be reencoded
-(p15) br.sptk.few RelocateSlotDone
- tbit.nz p14, p15 = in0, 36;; // put relative offset sign bit in p14
- extr.u loc2=in0, 13, 20;; // loc2 = relative offset in instruction
-(p14) movl loc3=0xfffffffffff00000;; // extend sign
-(p14) or loc2=loc2, loc3;;
- shl loc2=loc2,4;; // convert to byte offset instead of bundle offset
- add loc3=loc2, in1;; // loc3 = physical address of branch target
-(p14) sub loc2=r0,loc2;; // flip sign in loc2 if offset is negative
- sub loc4=loc3,in2;; // loc4 = relative offset from new ip to branch target
- cmp.lt p15, p14 = 0, loc4;; // get new sign bit
-(p14) sub loc5=r0,loc4 // get absolute value of offset
-(p15) mov loc5=loc4;;
- movl loc6=0x0FFFFFF;; // maximum offset in bytes for ip-rel branch
- cmp.gt p14, p15 = loc5, loc6;; // check to see we're not out of range for an ip-relative branch
-(p14) br.sptk.few RelocateSlotError
- cmp.lt p15, p14 = 0, loc4;; // store sign in p14 again
-(p14) dep in0=1,in0,36,1 // store sign bit in instruction
-(p15) dep in0=0,in0,36,1
- shr loc4=loc4, 4;; // convert back to bundle offset
- dep in0=loc4,in0,13,16;; // put first 16 bits of new offset into instruction
- shr loc4=loc4,16;;
- dep in0=loc4,in0,13+16,4 // put last 4 bits of new offset into instruction
- mov in1=1;; // in1 = success
- br.sptk.few RelocateSlotDone;;
-
-RelocateSlotError:
- mov in1=0;; // in1 = failure
-
-RelocateSlotDone:
- NESTED_RETURN
-
- .endp RelocateSlot
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// IsSlotBranch
-//
-// Description:
-// Determines if the given instruction is a branch instruction.
-//
-// Arguments:
-// in0 - Instruction encoding (41-bits, right justified)
-// in1 - Instruction slot number
-// in2 - Bundle template
-//
-// Returns:
-// in0 - 1 if branch or 0 if not branch
-//
-// Notes:
-// This procedure is a leaf routine
-//
-// IsSlotBranch recognizes all branch instructions by looking at the provided template.
-// The instruction encoding is only passed to this routine for future expansion.
-//
- .proc IsSlotBranch
-
-IsSlotBranch:
-
- NESTED_SETUP (3,2+0,0,0)
-
- mov in0=1;; // in0 = 1 which destroys the instruction
- andcm in2=in2,in0;; // in2 = even template to reduce compares
- mov in0=0;; // in0 = not a branch
- cmp.eq p14, p15 = 0x16, in2;; // Template 0x16 is BBB
-(p14) br.sptk.few IsSlotBranchTrue
- cmp.eq p14, p15 = SLOT0, in1;; // Slot 0 has no other possiblities
-(p14) br.sptk.few IsSlotBranchDone
- cmp.eq p14, p15 = 0x12, in2;; // Template 0x12 is MBB
-(p14) br.sptk.few IsSlotBranchTrue
- cmp.eq p14, p15 = SLOT1, in1;; // Slot 1 has no other possiblities
-(p14) br.sptk.few IsSlotBranchDone
- cmp.eq p14, p15 = 0x10, in2;; // Template 0x10 is MIB
-(p14) br.sptk.few IsSlotBranchTrue
- cmp.eq p14, p15 = 0x18, in2;; // Template 0x18 is MMB
-(p14) br.sptk.few IsSlotBranchTrue
- cmp.eq p14, p15 = 0x1C, in2;; // Template 0x1C is MFB
-(p14) br.sptk.few IsSlotBranchTrue
- br.sptk.few IsSlotBranchDone
-
-IsSlotBranchTrue:
- mov in0=1;; // in0 = branch
-
-IsSlotBranchDone:
- NESTED_RETURN
-
- .endp IsSlotBranch
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// GetTemplate
-//
-// Description:
-// Retrieves the instruction template for an instruction bundle
-//
-// Arguments:
-// in0 - Runtime address of bundle
-//
-// Returns:
-// in0 - Instruction template (5-bits, right-justified)
-//
-// Notes:
-// This procedure is a leaf routine
-//
- .proc GetTemplate
-
-GetTemplate:
-
- NESTED_SETUP (1,2+2,0,0)
-
- ld8 loc2=[in0], 0x8 // loc2 = first 8 bytes of branch bundle
- movl loc3=MASK_0_4;; // loc3 = template mask
- and loc2=loc2,loc3;; // loc2 = template, right justified
- mov in0=loc2;; // in0 = template, right justified
-
- NESTED_RETURN
-
- .endp GetTemplate
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// GetSlot
-//
-// Description:
-// Gets the instruction encoding for an instruction slot and bundle
-//
-// Arguments:
-// in0 - Runtime address of bundle
-// in1 - Instruction slot (either 0, 1, or 2)
-//
-// Returns:
-// in0 - Instruction encoding (41-bits, right justified)
-//
-// Notes:
-// This procedure is a leaf routine
-//
-// Slot0 - [in0 + 0x8] Bits 45-5
-// Slot1 - [in0 + 0x8] Bits 63-46 and [in0] Bits 22-0
-// Slot2 - [in0] Bits 63-23
-//
- .proc GetSlot
-
-GetSlot:
- NESTED_SETUP (2,2+3,0,0)
-
- ld8 loc2=[in0], 0x8;; // loc2 = first 8 bytes of branch bundle
- ld8 loc3=[in0];; // loc3 = second 8 bytes of branch bundle
- cmp.eq p14, p15 = 2, in1;; // check if slot 2 specified
- (p14) br.cond.sptk.few GetSlot2;; // get slot 2
- cmp.eq p14, p15 = 1, in1;; // check if slot 1 specified
- (p14) br.cond.sptk.few GetSlot1;; // get slot 1
-
-GetSlot0:
- extr.u in0=loc2, 5, 45 // in0 = extracted slot 0
- br.sptk.few GetSlotDone;;
-
-GetSlot1:
- extr.u in0=loc2, 46, 18 // in0 = bits 63-46 of loc2 right-justified
- extr.u loc4=loc3, 0, 23;; // loc4 = bits 22-0 of loc3 right-justified
- dep in0=loc4, in0, 18, 15;;
- shr.u loc4=loc4,15;;
- dep in0=loc4, in0, 33, 8;; // in0 = extracted slot 1
- br.sptk.few GetSlotDone;;
-
-GetSlot2:
- extr.u in0=loc3, 23, 41;; // in0 = extracted slot 2
-
-GetSlotDone:
- NESTED_RETURN
-
- .endp GetSlot
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// SetSlot
-//
-// Description:
-// Sets the instruction encoding for an instruction slot and bundle
-//
-// Arguments:
-// in0 - Runtime address of bundle
-// in1 - Instruction slot (either 0, 1, or 2)
-// in2 - Instruction encoding (41-bits, right justified)
-//
-// Returns:
-//
-// Notes:
-// This procedure is a leaf routine
-//
- .proc SetSlot
-
-SetSlot:
- NESTED_SETUP (3,2+3,0,0)
-
- ld8 loc2=[in0], 0x8;; // loc2 = first 8 bytes of bundle
- ld8 loc3=[in0];; // loc3 = second 8 bytes of bundle
- cmp.eq p14, p15 = 2, in1;; // check if slot 2 specified
- (p14) br.cond.sptk.few SetSlot2;; // set slot 2
- cmp.eq p14, p15 = 1, in1;; // check if slot 1 specified
- (p14) br.cond.sptk.few SetSlot1;; // set slot 1
-
-SetSlot0:
- dep loc2=0, loc2, 5, 41;; // remove old instruction from slot 0
- shl loc4=in2, 5;; // loc4 = new instruction ready to be inserted
- or loc2=loc2, loc4;; // loc2 = updated first 8 bytes of bundle
- add loc4=0x8,in0;; // loc4 = address to store first 8 bytes of bundle
- st8 [loc4]=loc2 // [loc4] = updated bundle
- br.sptk.few SetSlotDone;;
- ;;
-
-SetSlot1:
- dep loc2=0, loc2, 46, 18 // remove old instruction from slot 1
- dep loc3=0, loc3, 0, 23;;
- shl loc4=in2, 46;; // loc4 = partial instruction ready to be inserted
- or loc2=loc2, loc4;; // loc2 = updated first 8 bytes of bundle
- add loc4=0x8,in0;; // loc4 = address to store first 8 bytes of bundle
- st8 [loc4]=loc2;; // [loc4] = updated bundle
- shr.u loc4=in2, 18;; // loc4 = partial instruction ready to be inserted
- or loc3=loc3, loc4;; // loc3 = updated second 8 bytes of bundle
- st8 [in0]=loc3;; // [in0] = updated bundle
- br.sptk.few SetSlotDone;;
-
-SetSlot2:
- dep loc3=0, loc3, 23, 41;; // remove old instruction from slot 2
- shl loc4=in2, 23;; // loc4 = instruction ready to be inserted
- or loc3=loc3, loc4;; // loc3 = updated second 8 bytes of bundle
- st8 [in0]=loc3;; // [in0] = updated bundle
-
-SetSlotDone:
-
- NESTED_RETURN
- .endp SetSlot
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// GetIva
-//
-// Description:
-// C callable function to obtain the current value of IVA
-//
-// Returns:
-// Current value if IVA
-
- .globl GetIva
- .proc GetIva
-GetIva:
- mov r8=cr2;;
- br.ret.sptk.many b0
-
- .endp GetIva
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// ProgramInterruptFlags
-//
-// Description:
-// C callable function to enable/disable interrupts
-//
-// Returns:
-// Previous state of psr.ic
-//
- .globl ProgramInterruptFlags
- .proc ProgramInterruptFlags
-ProgramInterruptFlags:
- alloc loc0=1,2,0,0;;
- mov loc0=psr
- mov loc1=0x6000;;
- and r8=loc0, loc1 // obtain current psr.ic and psr.i state
- and in0=in0, loc1 // insure no extra bits set in input
- andcm loc0=loc0,loc1;; // clear original psr.i and psr.ic
- or loc0=loc0,in0;; // OR in new psr.ic value
- mov psr.l=loc0;; // write new psr
- srlz.d
- br.ret.sptk.many b0 // return
-
- .endp ProgramInterruptFlags
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// SpillContext
-//
-// Description:
-// Saves system context to context record.
-//
-// Arguments:
-// in0 = 512 byte aligned context record address
-// in1 = original B0
-// in2 = original ar.bsp
-// in3 = original ar.bspstore
-// in4 = original ar.rnat
-// in5 = original ar.pfs
-//
-// Notes:
-// loc0 - scratch
-// loc1 - scratch
-// loc2 - temporary application unat storage
-// loc3 - temporary exception handler unat storage
-
- .proc SpillContext
-
-SpillContext:
- alloc loc0=6,4,0,0;; // alloc 6 input, 4 locals, 0 outs
- mov loc2=ar.unat;; // save application context unat (spilled later)
- mov ar.unat=r0;; // set UNAT=0
- st8.spill [in0]=r0,8;;
- st8.spill [in0]=r1,8;; // save R1 - R31
- st8.spill [in0]=r2,8;;
- st8.spill [in0]=r3,8;;
- st8.spill [in0]=r4,8;;
- st8.spill [in0]=r5,8;;
- st8.spill [in0]=r6,8;;
- st8.spill [in0]=r7,8;;
- st8.spill [in0]=r8,8;;
- st8.spill [in0]=r9,8;;
- st8.spill [in0]=r10,8;;
- st8.spill [in0]=r11,8;;
- st8.spill [in0]=r12,8;;
- st8.spill [in0]=r13,8;;
- st8.spill [in0]=r14,8;;
- st8.spill [in0]=r15,8;;
- st8.spill [in0]=r16,8;;
- st8.spill [in0]=r17,8;;
- st8.spill [in0]=r18,8;;
- st8.spill [in0]=r19,8;;
- st8.spill [in0]=r20,8;;
- st8.spill [in0]=r21,8;;
- st8.spill [in0]=r22,8;;
- st8.spill [in0]=r23,8;;
- st8.spill [in0]=r24,8;;
- st8.spill [in0]=r25,8;;
- st8.spill [in0]=r26,8;;
- st8.spill [in0]=r27,8;;
- st8.spill [in0]=r28,8;;
- st8.spill [in0]=r29,8;;
- st8.spill [in0]=r30,8;;
- st8.spill [in0]=r31,8;;
- mov loc3=ar.unat;; // save debugger context unat (spilled later)
- stf.spill [in0]=f2,16;; // save f2 - f31
- stf.spill [in0]=f3,16;;
- stf.spill [in0]=f4,16;;
- stf.spill [in0]=f5,16;;
- stf.spill [in0]=f6,16;;
- stf.spill [in0]=f7,16;;
- stf.spill [in0]=f8,16;;
- stf.spill [in0]=f9,16;;
- stf.spill [in0]=f10,16;;
- stf.spill [in0]=f11,16;;
- stf.spill [in0]=f12,16;;
- stf.spill [in0]=f13,16;;
- stf.spill [in0]=f14,16;;
- stf.spill [in0]=f15,16;;
- stf.spill [in0]=f16,16;;
- stf.spill [in0]=f17,16;;
- stf.spill [in0]=f18,16;;
- stf.spill [in0]=f19,16;;
- stf.spill [in0]=f20,16;;
- stf.spill [in0]=f21,16;;
- stf.spill [in0]=f22,16;;
- stf.spill [in0]=f23,16;;
- stf.spill [in0]=f24,16;;
- stf.spill [in0]=f25,16;;
- stf.spill [in0]=f26,16;;
- stf.spill [in0]=f27,16;;
- stf.spill [in0]=f28,16;;
- stf.spill [in0]=f29,16;;
- stf.spill [in0]=f30,16;;
- stf.spill [in0]=f31,16;;
- mov loc0=pr;; // save predicates
- st8.spill [in0]=loc0,8;;
- st8.spill [in0]=in1,8;; // save b0 - b7... in1 already equals saved b0
- mov loc0=b1;;
- st8.spill [in0]=loc0,8;;
- mov loc0=b2;;
- st8.spill [in0]=loc0,8;;
- mov loc0=b3;;
- st8.spill [in0]=loc0,8;;
- mov loc0=b4;;
- st8.spill [in0]=loc0,8;;
- mov loc0=b5;;
- st8.spill [in0]=loc0,8;;
- mov loc0=b6;;
- st8.spill [in0]=loc0,8;;
- mov loc0=b7;;
- st8.spill [in0]=loc0,8;;
- mov loc0=ar.rsc;; // save ar.rsc
- st8.spill [in0]=loc0,8;;
- st8.spill [in0]=in2,8;; // save ar.bsp (in2)
- st8.spill [in0]=in3,8;; // save ar.bspstore (in3)
- st8.spill [in0]=in4,8;; // save ar.rnat (in4)
- mov loc0=ar.fcr;; // save ar.fcr (ar21 - IA32 floating-point control register)
- st8.spill [in0]=loc0,8;;
- mov loc0=ar.eflag;; // save ar.eflag (ar24)
- st8.spill [in0]=loc0,8;;
- mov loc0=ar.csd;; // save ar.csd (ar25 - ia32 CS descriptor)
- st8.spill [in0]=loc0,8;;
- mov loc0=ar.ssd;; // save ar.ssd (ar26 - ia32 ss descriptor)
- st8.spill [in0]=loc0,8;;
- mov loc0=ar.cflg;; // save ar.cflg (ar27 - ia32 cr0 and cr4)
- st8.spill [in0]=loc0,8;;
- mov loc0=ar.fsr;; // save ar.fsr (ar28 - ia32 floating-point status register)
- st8.spill [in0]=loc0,8;;
- mov loc0=ar.fir;; // save ar.fir (ar29 - ia32 floating-point instruction register)
- st8.spill [in0]=loc0,8;;
- mov loc0=ar.fdr;; // save ar.fdr (ar30 - ia32 floating-point data register)
- st8.spill [in0]=loc0,8;;
- mov loc0=ar.ccv;; // save ar.ccv
- st8.spill [in0]=loc0,8;;
- st8.spill [in0]=loc2,8;; // save ar.unat (saved to loc2 earlier)
- mov loc0=ar.fpsr;; // save floating point status register
- st8.spill [in0]=loc0,8;;
- st8.spill [in0]=in5,8;; // save ar.pfs
- mov loc0=ar.lc;; // save ar.lc
- st8.spill [in0]=loc0,8;;
- mov loc0=ar.ec;; // save ar.ec
- st8.spill [in0]=loc0,8;;
-
- // save control registers
- mov loc0=cr.dcr;; // save dcr
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.itm;; // save itm
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.iva;; // save iva
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.pta;; // save pta
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.ipsr;; // save ipsr
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.isr;; // save isr
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.iip;; // save iip
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.ifa;; // save ifa
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.itir;; // save itir
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.iipa;; // save iipa
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.ifs;; // save ifs
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.iim;; // save iim
- st8.spill [in0]=loc0,8;;
- mov loc0=cr.iha;; // save iha
- st8.spill [in0]=loc0,8;;
-
- // save debug registers
- mov loc0=dbr[r0];; // save dbr0 - dbr7
- st8.spill [in0]=loc0,8;;
- movl loc1=1;;
- mov loc0=dbr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=2;;
- mov loc0=dbr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=3;;
- mov loc0=dbr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=4;;
- mov loc0=dbr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=5;;
- mov loc0=dbr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=6;;
- mov loc0=dbr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=7;;
- mov loc0=dbr[loc1];;
- st8.spill [in0]=loc0,8;;
- mov loc0=ibr[r0];; // save ibr0 - ibr7
- st8.spill [in0]=loc0,8;;
- movl loc1=1;;
- mov loc0=ibr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=2;;
- mov loc0=ibr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=3;;
- mov loc0=ibr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=4;;
- mov loc0=ibr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=5;;
- mov loc0=ibr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=6;;
- mov loc0=ibr[loc1];;
- st8.spill [in0]=loc0,8;;
- movl loc1=7;;
- mov loc0=ibr[loc1];;
- st8.spill [in0]=loc0,8;;
- st8.spill [in0]=loc3;;
-
- br.ret.sptk.few b0
-
- .endp SpillContext
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// FillContext
-//
-// Description:
-// Restores register context from context record.
-//
-// Arguments:
-// in0 = address of last element 512 byte aligned context record address
-// in1 = modified B0
-// in2 = modified ar.bsp
-// in3 = modified ar.bspstore
-// in4 = modified ar.rnat
-// in5 = modified ar.pfs
-//
-// Notes:
-// loc0 - scratch
-// loc1 - scratch
-// loc2 - temporary application unat storage
-// loc3 - temporary exception handler unat storage
-
- .proc FillContext
-FillContext:
- alloc loc0=6,4,0,0;; // alloc 6 inputs, 4 locals, 0 outs
- ld8.fill loc3=[in0],-8;; // int_nat (nat bits for R1-31)
- movl loc1=7;; // ibr7
- ld8.fill loc0=[in0],-8;;
- mov ibr[loc1]=loc0;;
- movl loc1=6;; // ibr6
- ld8.fill loc0=[in0],-8;;
- mov ibr[loc1]=loc0;;
- movl loc1=5;; // ibr5
- ld8.fill loc0=[in0],-8;;
- mov ibr[loc1]=loc0;;
- movl loc1=4;; // ibr4
- ld8.fill loc0=[in0],-8;;
- mov ibr[loc1]=loc0;;
- movl loc1=3;; // ibr3
- ld8.fill loc0=[in0],-8;;
- mov ibr[loc1]=loc0;;
- movl loc1=2;; // ibr2
- ld8.fill loc0=[in0],-8;;
- mov ibr[loc1]=loc0;;
- movl loc1=1;; // ibr1
- ld8.fill loc0=[in0],-8;;
- mov ibr[loc1]=loc0;;
- ld8.fill loc0=[in0],-8;; // ibr0
- mov ibr[r0]=loc0;;
- movl loc1=7;; // dbr7
- ld8.fill loc0=[in0],-8;;
- mov dbr[loc1]=loc0;;
- movl loc1=6;; // dbr6
- ld8.fill loc0=[in0],-8;;
- mov dbr[loc1]=loc0;;
- movl loc1=5;; // dbr5
- ld8.fill loc0=[in0],-8;;
- mov dbr[loc1]=loc0;;
- movl loc1=4;; // dbr4
- ld8.fill loc0=[in0],-8;;
- mov dbr[loc1]=loc0;;
- movl loc1=3;; // dbr3
- ld8.fill loc0=[in0],-8;;
- mov dbr[loc1]=loc0;;
- movl loc1=2;; // dbr2
- ld8.fill loc0=[in0],-8;;
- mov dbr[loc1]=loc0;;
- movl loc1=1;; // dbr1
- ld8.fill loc0=[in0],-8;;
- mov dbr[loc1]=loc0;;
- ld8.fill loc0=[in0],-8;; // dbr0
- mov dbr[r0]=loc0;;
- ld8.fill loc0=[in0],-8;; // iha
- mov cr.iha=loc0;;
- ld8.fill loc0=[in0],-8;; // iim
- mov cr.iim=loc0;;
- ld8.fill loc0=[in0],-8;; // ifs
- mov cr.ifs=loc0;;
- ld8.fill loc0=[in0],-8;; // iipa
- mov cr.iipa=loc0;;
- ld8.fill loc0=[in0],-8;; // itir
- mov cr.itir=loc0;;
- ld8.fill loc0=[in0],-8;; // ifa
- mov cr.ifa=loc0;;
- ld8.fill loc0=[in0],-8;; // iip
- mov cr.iip=loc0;;
- ld8.fill loc0=[in0],-8;; // isr
- mov cr.isr=loc0;;
- ld8.fill loc0=[in0],-8;; // ipsr
- mov cr.ipsr=loc0;;
- ld8.fill loc0=[in0],-8;; // pta
- mov cr.pta=loc0;;
- ld8.fill loc0=[in0],-8;; // iva
- mov cr.iva=loc0;;
- ld8.fill loc0=[in0],-8;; // itm
- mov cr.itm=loc0;;
- ld8.fill loc0=[in0],-8;; // dcr
- mov cr.dcr=loc0;;
- ld8.fill loc0=[in0],-8;; // ec
- mov ar.ec=loc0;;
- ld8.fill loc0=[in0],-8;; // lc
- mov ar.lc=loc0;;
- ld8.fill in5=[in0],-8;; // ar.pfs
- ld8.fill loc0=[in0],-8;; // ar.fpsr
- mov ar.fpsr=loc0;;
- ld8.fill loc2=[in0],-8;; // ar.unat - restored later...
- ld8.fill loc0=[in0],-8;; // ar.ccv
- mov ar.ccv=loc0;;
- ld8.fill loc0=[in0],-8;; // ar.fdr
- mov ar.fdr=loc0;;
- ld8.fill loc0=[in0],-8;; // ar.fir
- mov ar.fir=loc0;;
- ld8.fill loc0=[in0],-8;; // ar.fsr
- mov ar.fsr=loc0;;
- ld8.fill loc0=[in0],-8;; // ar.cflg
- mov ar.cflg=loc0;;
- ld8.fill loc0=[in0],-8;; // ar.ssd
- mov ar.ssd=loc0;;
- ld8.fill loc0=[in0],-8;; // ar.csd
- mov ar.csd=loc0;;
- ld8.fill loc0=[in0],-8;; // ar.eflag
- mov ar.eflag=loc0;;
- ld8.fill loc0=[in0],-8;; // ar.fcr
- mov ar.fcr=loc0;;
- ld8.fill in4=[in0],-8;; // ar.rnat
- ld8.fill in3=[in0],-8;; // bspstore
- ld8.fill in2=[in0],-8;; // bsp
- ld8.fill loc0=[in0],-8;; // ar.rsc
- mov ar.rsc=loc0;;
- ld8.fill loc0=[in0],-8;; // B7 - B0
- mov b7=loc0;;
- ld8.fill loc0=[in0],-8;;
- mov b6=loc0;;
- ld8.fill loc0=[in0],-8;;
- mov b5=loc0;;
- ld8.fill loc0=[in0],-8;;
- mov b4=loc0;;
- ld8.fill loc0=[in0],-8;;
- mov b3=loc0;;
- ld8.fill loc0=[in0],-8;;
- mov b2=loc0;;
- ld8.fill loc0=[in0],-8;;
- mov b1=loc0;;
- ld8.fill in1=[in0],-8;; // b0 is temporarily stored in in1
- ld8.fill loc0=[in0],-16;; // predicates
- mov pr=loc0;;
- ldf.fill f31=[in0],-16;;
- ldf.fill f30=[in0],-16;;
- ldf.fill f29=[in0],-16;;
- ldf.fill f28=[in0],-16;;
- ldf.fill f27=[in0],-16;;
- ldf.fill f26=[in0],-16;;
- ldf.fill f25=[in0],-16;;
- ldf.fill f24=[in0],-16;;
- ldf.fill f23=[in0],-16;;
- ldf.fill f22=[in0],-16;;
- ldf.fill f21=[in0],-16;;
- ldf.fill f20=[in0],-16;;
- ldf.fill f19=[in0],-16;;
- ldf.fill f18=[in0],-16;;
- ldf.fill f17=[in0],-16;;
- ldf.fill f16=[in0],-16;;
- ldf.fill f15=[in0],-16;;
- ldf.fill f14=[in0],-16;;
- ldf.fill f13=[in0],-16;;
- ldf.fill f12=[in0],-16;;
- ldf.fill f11=[in0],-16;;
- ldf.fill f10=[in0],-16;;
- ldf.fill f9=[in0],-16;;
- ldf.fill f8=[in0],-16;;
- ldf.fill f7=[in0],-16;;
- ldf.fill f6=[in0],-16;;
- ldf.fill f5=[in0],-16;;
- ldf.fill f4=[in0],-16;;
- ldf.fill f3=[in0],-16;;
- ldf.fill f2=[in0],-8;;
- mov ar.unat=loc3;; // restore unat (int_nat) before fill of general registers
- ld8.fill r31=[in0],-8;;
- ld8.fill r30=[in0],-8;;
- ld8.fill r29=[in0],-8;;
- ld8.fill r28=[in0],-8;;
- ld8.fill r27=[in0],-8;;
- ld8.fill r26=[in0],-8;;
- ld8.fill r25=[in0],-8;;
- ld8.fill r24=[in0],-8;;
- ld8.fill r23=[in0],-8;;
- ld8.fill r22=[in0],-8;;
- ld8.fill r21=[in0],-8;;
- ld8.fill r20=[in0],-8;;
- ld8.fill r19=[in0],-8;;
- ld8.fill r18=[in0],-8;;
- ld8.fill r17=[in0],-8;;
- ld8.fill r16=[in0],-8;;
- ld8.fill r15=[in0],-8;;
- ld8.fill r14=[in0],-8;;
- ld8.fill r13=[in0],-8;;
- ld8.fill r12=[in0],-8;;
- ld8.fill r11=[in0],-8;;
- ld8.fill r10=[in0],-8;;
- ld8.fill r9=[in0],-8;;
- ld8.fill r8=[in0],-8;;
- ld8.fill r7=[in0],-8;;
- ld8.fill r6=[in0],-8;;
- ld8.fill r5=[in0],-8;;
- ld8.fill r4=[in0],-8;;
- ld8.fill r3=[in0],-8;;
- ld8.fill r2=[in0],-8;;
- ld8.fill r1=[in0],-8;;
- mov ar.unat=loc2;; // restore application context unat
-
- br.ret.sptk.many b0
-
- .endp FillContext
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// HookHandler
-//
-// Description:
-// Common branch target from hooked IVT entries. Runs in interrupt context.
-// Responsible for saving and restoring context and calling common C
-// handler. Banked registers running on bank 0 at entry.
-//
-// Arguments:
-// All arguments are passed in banked registers:
-// B0_REG = Original B0
-// SCRATCH_REG1 = IVT entry index
-//
-// Returns:
-// Returns via rfi
-//
-// Notes:
-// loc0 - scratch
-// loc1 - scratch
-// loc2 - vector number / mask
-// loc3 - 16 byte aligned context record address
-// loc4 - temporary storage of last address in context record
-
-HookHandler:
- flushrs;; // Synch RSE with backing store
- mov SCRATCH_REG2=ar.bsp // save interrupted context bsp
- mov SCRATCH_REG3=ar.bspstore // save interrupted context bspstore
- mov SCRATCH_REG4=ar.rnat // save interrupted context rnat
- mov SCRATCH_REG6=cr.ifs;; // save IFS in case we need to chain...
- cover;; // creates new frame, moves old
- // CFM to IFS.
- alloc SCRATCH_REG5=0,5,6,0 // alloc 5 locals, 6 outs
- ;;
- // save banked registers to locals
- mov out1=B0_REG // out1 = Original B0
- mov out2=SCRATCH_REG2 // out2 = original ar.bsp
- mov out3=SCRATCH_REG3 // out3 = original ar.bspstore
- mov out4=SCRATCH_REG4 // out4 = original ar.rnat
- mov out5=SCRATCH_REG5 // out5 = original ar.pfs
- mov loc2=SCRATCH_REG1;; // loc2 = vector number + chain flag
- bsw.1;; // switch banked registers to bank 1
- srlz.d // explicit serialize required
- // now fill in context record structure
- movl loc3=IpfContextBuf // Insure context record is aligned
- add loc0=-0x200,r0;; // mask the lower 9 bits (align on 512 byte boundary)
- and loc3=loc3,loc0;;
- add loc3=0x200,loc3;; // move to next 512 byte boundary
- // loc3 now contains the 512 byte aligned context record
- // spill register context into context record
- mov out0=loc3;; // Context record base in out0
- // original B0 in out1 already
- // original ar.bsp in out2 already
- // original ar.bspstore in out3 already
- br.call.sptk.few b0=SpillContext;; // spill context
- mov loc4=out0 // save modified address
-
- // At this point, the context has been saved to the context record and we're
- // ready to call the C part of the handler...
-
- movl loc0=CommonHandler;; // obtain address of plabel
- ld8 loc1=[loc0];; // get entry point of CommonHandler
- mov b6=loc1;; // put it in a branch register
- adds loc1= 8, loc0;; // index to GP in plabel
- ld8 r1=[loc1];; // set up gp for C call
- mov loc1=0xfffff;; // mask off so only vector bits are present
- and out0=loc2,loc1;; // pass vector number (exception type)
- mov out1=loc3;; // pass context record address
- br.call.sptk.few b0=b6;; // call C handler
-
- // We've returned from the C call, so restore the context and either rfi
- // back to interrupted thread, or chain into the SAL if this was an external interrupt
- mov out0=loc4;; // pass address of last element in context record
- br.call.sptk.few b0=FillContext;; // Fill context
- mov b0=out1 // fill in b0
- mov ar.rnat=out4
- mov ar.pfs=out5
-
- // Loadrs is necessary because the debugger may have changed some values in
- // the backing store. The processor, however may not be aware that the
- // stacked registers need to be reloaded from the backing store. Therefore,
- // we explicitly cause the RSE to refresh the stacked register's contents
- // from the backing store.
- mov loc0=ar.rsc // get RSC value
- mov loc1=ar.rsc // save it so we can restore it
- movl loc3=0xffffffffc000ffff;; // create mask for clearing RSC.loadrs
- and loc0=loc0,loc3;; // create value for RSC with RSC.loadrs==0
- mov ar.rsc=loc0;; // modify RSC
- loadrs;; // invalidate register stack
- mov ar.rsc=loc1;; // restore original RSC
-
- bsw.0;; // switch banked registers back to bank 0
- srlz.d;; // explicit serialize required
- mov PR_REG=pr // save predicates - to be restored after chaining decision
- mov B0_REG=b0 // save b0 - required by chain code
- mov loc2=EXCPT_EXTERNAL_INTERRUPT;;
- cmp.eq p7,p0=SCRATCH_REG1,loc2;; // check to see if this is the timer tick
- (p7) br.cond.dpnt.few DO_CHAIN;;
-
-NO_CHAIN:
- mov pr=PR_REG;;
- rfi;; // we're outa here.
-
-DO_CHAIN:
- mov pr=PR_REG
- mov SCRATCH_REG1=cr.iva
- mov SCRATCH_REG2=PATCH_RETURN_OFFSET;;
- add SCRATCH_REG1=SCRATCH_REG1, SCRATCH_REG2;;
- mov b0=SCRATCH_REG1;;
- br.cond.sptk.few b0;;
-
-EndHookHandler:
-
-
-/////////////////////////////////////////////
-//
-// Name:
-// HookStub
-//
-// Description:
-// HookStub will be copied from it's loaded location into the IVT when
-// an IVT entry is hooked. The IVT entry does an indirect jump via B0 to
-// HookHandler, which in turn calls into the default C handler, which calls
-// the user-installed C handler. The calls return and HookHandler executes
-// an rfi.
-//
-// Notes:
-// Saves B0 to B0_REG
-// Saves IVT index to SCRATCH_REG1 (immediate value is fixed up when code is copied
-// to the IVT entry.
-
- .globl HookStub
- .proc HookStub
-HookStub:
-
- mov B0_REG=b0
- movl SCRATCH_REG1=HookHandler;;
- mov b0=SCRATCH_REG1;;
- mov SCRATCH_REG1=0;;// immediate value is fixed up during install of handler to be the vector number
- br.cond.sptk.few b0
-
- .endp HookStub
-
-
-/////////////////////////////////////////////
-// The following code is moved into IVT entry 14 (offset 3400) which is reserved
-// in the Itanium architecture. The patch code is located at the end of the
-// IVT entry.
-
-PatchCode:
- mov SCRATCH_REG0=psr
- mov SCRATCH_REG6=cr.ipsr
- mov PR_REG=pr
- mov B0_REG=b0;;
-
- // turn off any virtual translations
- movl SCRATCH_REG1 = ~( MASK(PSR_DT,1) | MASK(PSR_RT,1));;
- and SCRATCH_REG1 = SCRATCH_REG0, SCRATCH_REG1;;
- mov psr.l = SCRATCH_REG1;;
- srlz.d
- tbit.z p14, p15 = SCRATCH_REG6, PSR_IS;; // Check to see if we were
- // interrupted from IA32
- // context. If so, bail out
- // and chain to SAL immediately
- (p15) br.cond.sptk.few Stub_IVT_Passthru;;
- // we only want to take 1 out of 32 external interrupts to minimize the
- // impact to system performance. Check our interrupt count and bail
- // out if we're not up to 32
- movl SCRATCH_REG1=ExternalInterruptCount;;
- ld8 SCRATCH_REG2=[SCRATCH_REG1];; // ExternalInterruptCount
- tbit.z p14, p15 = SCRATCH_REG2, 5;; // bit 5 set?
- (p14) add SCRATCH_REG2=1, SCRATCH_REG2;; // No? Then increment
- // ExternalInterruptCount
- // and Chain to SAL
- // immediately
- (p14) st8 [SCRATCH_REG1]=SCRATCH_REG2;;
- (p14) br.cond.sptk.few Stub_IVT_Passthru;;
- (p15) mov SCRATCH_REG2=0;; // Yes? Then reset
- // ExternalInterruptCount
- // and branch to
- // HookHandler
- (p15) st8 [SCRATCH_REG1]=SCRATCH_REG2;;
- mov pr=PR_REG
- movl SCRATCH_REG1=HookHandler;; // SCRATCH_REG1 = entrypoint of HookHandler
- mov b0=SCRATCH_REG1;; // b0 = entrypoint of HookHandler
- mov SCRATCH_REG1=EXCPT_EXTERNAL_INTERRUPT;;
- br.sptk.few b0;; // branch to HookHandler
-
-PatchCodeRet:
- // fake-up an rfi to get RSE back to being coherent and insure psr has
- // original contents when interrupt occured, then exit to SAL
- // at this point:
- // cr.ifs has been modified by previous "cover"
- // SCRATCH_REG6 has original cr.ifs
-
- mov SCRATCH_REG5=cr.ipsr
- mov SCRATCH_REG4=cr.iip;;
- mov cr.ipsr=SCRATCH_REG0
- mov SCRATCH_REG1=ip;;
- add SCRATCH_REG1=0x30, SCRATCH_REG1;;
- mov cr.iip=SCRATCH_REG1;;
- rfi;; // rfi to next instruction
-
-Stub_RfiTarget:
- mov cr.ifs=SCRATCH_REG6
- mov cr.ipsr=SCRATCH_REG5
- mov cr.iip=SCRATCH_REG4;;
-
-Stub_IVT_Passthru:
- mov pr=PR_REG // pr = saved predicate registers
- mov b0=B0_REG;; // b0 = saved b0
-EndPatchCode:
-
-
-/////////////////////////////////////////////
-// The following bundle is moved into IVT entry 14 (offset 0x3400) which is reserved
-// in the Itanium architecture. This bundle will be the last bundle and will
-// be located at offset 0x37F0 in the IVT.
-
-FailsafeBranch:
-{
- .mib
- nop.m 0
- nop.i 0
- br.sptk.few -(FAILSAFE_BRANCH_OFFSET - EXT_INT_ENTRY_OFFSET - 0x10)
-}
-
-
-/////////////////////////////////////////////
-// The following bundle is moved into IVT entry 13 (offset 0x3000) which is the
-// external interrupt. It branches to the patch code.
-
-PatchCodeNewBun0:
-{
- .mib
- nop.m 0
- nop.i 0
- br.cond.sptk.few PATCH_BRANCH
-}
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/Ds64Macros.i b/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/Ds64Macros.i
deleted file mode 100644
index 6088ce7..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/Ds64Macros.i
+++ /dev/null
@@ -1,85 +0,0 @@
-//++
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// Ds64Macros.i
-//
-// Abstract:
-//
-// This is set of macros used in calculating offsets in the IVT
-//
-// Revision History:
-//
-//--
-
-#define EXCPT_EXTERNAL_INTERRUPT 12
-#define MASK_0_4 0x000000000000001F // mask bits 0 through 4
-#define SLOT0 0
-#define SLOT1 1
-#define SLOT2 2
-
-#define PSR_DT 17
-#define PSR_TB 26
-#define PSR_RT 27
-#define PSR_IS 34
-#define PSR_IT 36
-#define PSR_IC 13
-#define PSR_I 14
-#define PSR_SS 40
-#define PSR_BN 44
-#define PSR_RI_MASK 0x60000000000
-
-#define EXCPT_EXTERNAL_INTERRUPT 12
-
-#define SCRATCH_REG0 r23
-#define SCRATCH_REG1 r24
-#define SCRATCH_REG2 r25
-#define SCRATCH_REG3 r26
-#define SCRATCH_REG4 r27
-#define SCRATCH_REG5 r28
-#define SCRATCH_REG6 r29
-#define PR_REG r30
-#define B0_REG r31
-
-
-// EXT_INT_OFFSET is the offset of the external interrupt entry in the IVT
-#define EXT_INT_ENTRY_OFFSET 0x03000
-
-// PATCH_ENTRY_OFFSET is the offset into the IVT of the entry that is coopted (stolen)
-// for use by the handler. The entire entry is restored when the handler is
-// unloaded.
-#define PATCH_ENTRY_OFFSET 0x03400
-
-// PATCH_BUNDLES is the number of bundles actually in the patch
-#define NUM_PATCH_BUNDLES ((EndPatchCode - PatchCode) / 0x10)
-
-// A hard coded branch back into the external interrupt IVT entry's second bundle
-// is put here, just in case the original bundle zero did not have a branch
-// This is the last bundle in the reserved IVT entry
-#define FAILSAFE_BRANCH_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - 0x10)
-
-// the original external interrupt IVT entry bundle zero is copied and relocated
-// here... also in the reserved IVT entry
-// This is the second-to-last bundle in the reserved IVT entry
-#define RELOCATED_EXT_INT (PATCH_ENTRY_OFFSET + 0x400 - 0x20)
-
-// The patch is actually stored at the end of IVT:PATCH_ENTRY. The PATCH_OFFSET
-// is the offset into IVT where the patch is actually stored. It is carefully
-// located so that when we run out of patch code, the next bundle is the
-// relocated bundle 0 from the original external interrupt handler
-#define PATCH_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - ( EndPatchCode - PatchCode ) - 0x20)
-
-#define PATCH_RETURN_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - ( EndPatchCode - PatchCodeRet ) - 0x20)
-
-// PATCH_BRANCH is used only in the new bundle that is placed at the beginning
-// of the external interrupt IVT entry.
-#define PATCH_BRANCH (PATCH_OFFSET - EXT_INT_ENTRY_OFFSET)
-
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/common.i b/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/common.i
deleted file mode 100644
index a7b571b..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/common.i
+++ /dev/null
@@ -1,34 +0,0 @@
-//++
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// Common.i
-//
-// Abstract:
-//
-// This is set of useful macros
-//
-// Revision History:
-//
-//--
-
-#define NESTED_SETUP(i,l,o,r) \
- alloc loc1=ar##.##pfs,i,l,o,r ; \
- mov loc0=b0 ;;
-
-
-#define NESTED_RETURN \
- mov b0=loc0 ; \
- mov ar##.##pfs=loc1 ;; \
- br##.##ret##.##dpnt b0 ;;
-
-#define MASK(bp,value) (value << bp)
-
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c
deleted file mode 100644
index 33233d6..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c
+++ /dev/null
@@ -1,586 +0,0 @@
-/**@file
- IPF specific debug support functions
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-//
-// private header files
-//
-#include "plDebugSupport.h"
-
-typedef struct {
- UINT64 low;
- UINT64 high;
-} BUNDLE;
-
-//
-// number of bundles to swap in ivt
-//
-#define NUM_BUNDLES_IN_STUB 5
-#define NUM_IVT_ENTRIES 64
-
-typedef struct {
- BUNDLE OrigBundles[NUM_BUNDLES_IN_STUB];
- VOID (*RegisteredCallback) ();
-} IVT_ENTRY;
-
-STATIC
-EFI_STATUS
-ManageIvtEntryTable (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN BUNDLE NewBundles[4],
- IN VOID (*NewCallback) ()
- );
-
-STATIC
-VOID
-HookEntry (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN BUNDLE NewBundles[4],
- IN VOID (*NewCallback) ()
- );
-
-STATIC
-VOID
-UnhookEntry (
- IN EFI_EXCEPTION_TYPE ExceptionType
- );
-
-STATIC
-VOID
-ChainExternalInterrupt (
- IN VOID (*NewCallback) ()
- );
-
-STATIC
-VOID
-UnchainExternalInterrupt (
- VOID
- );
-
-STATIC
-VOID
-GetHandlerEntryPoint (
- UINTN HandlerIndex,
- VOID **EntryPoint
- );
-
-IVT_ENTRY IvtEntryTable[NUM_IVT_ENTRIES];
-
-//
-// IPF context record is overallocated by 512 bytes to guarantee a 512 byte alignment exists
-// within the buffer and still have a large enough buffer to hold a whole IPF context record.
-//
-UINT8 IpfContextBuf[sizeof (EFI_SYSTEM_CONTEXT_IPF) + 512];
-
-//
-// The PatchSaveBuffer is used to store the original bundles from the IVT where it is patched
-// with the common handler.
-//
-UINT8 PatchSaveBuffer[0x400];
-UINTN ExternalInterruptCount;
-
-EFI_STATUS
-plInitializeDebugSupportDriver (
- VOID
- )
-/*++
-
-Routine Description:
- IPF specific DebugSupport driver initialization. Must be public because it's
- referenced from DebugSupport.c
-
-Arguments:
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- SetMem (IvtEntryTable, sizeof (IvtEntryTable), 0);
- ExternalInterruptCount = 0;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-plUnloadDebugSupportDriver (
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
- Unload handler that is called during UnloadImage() - deallocates pool memory
- used by the driver. Must be public because it's referenced from DebugSuport.c
-
-Arguments:
- ImageHandle - Image handle
-
-Returns:
-
- EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.
-
---*/
-{
- EFI_EXCEPTION_TYPE ExceptionType;
-
- for (ExceptionType = 0; ExceptionType < NUM_IVT_ENTRIES; ExceptionType++) {
- ManageIvtEntryTable (ExceptionType, NULL, NULL);
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-CommonHandler (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN EFI_SYSTEM_CONTEXT Context
- )
-/*++
-
-Routine Description:
- C routine that is called for all registered exceptions. This is the main
- exception dispatcher. Must be public because it's referenced from AsmFuncs.s.
-
-Arguments:
- ExceptionType - Exception Type
- Context - System Context
-
-Returns:
-
- Nothing
-
---*/
-{
- static BOOLEAN InHandler = FALSE;
-
- DEBUG_CODE_BEGIN ();
- if (InHandler) {
- DEBUG ((EFI_D_INFO, "ERROR: Re-entered debugger!\n"
- " ExceptionType == %X\n"
- " Context == %X\n"
- " Context.SystemContextIpf->CrIip == %X\n"
- " Context.SystemContextIpf->CrIpsr == %X\n"
- " InHandler == %X\n",
- ExceptionType,
- Context,
- Context.SystemContextIpf->CrIip,
- Context.SystemContextIpf->CrIpsr,
- InHandler));
- }
- DEBUG_CODE_END ();
-
- ASSERT (!InHandler);
- InHandler = TRUE;
- if (IvtEntryTable[ExceptionType].RegisteredCallback != NULL) {
- if (ExceptionType != EXCEPT_IPF_EXTERNAL_INTERRUPT) {
- IvtEntryTable[ExceptionType].RegisteredCallback (ExceptionType, Context.SystemContextIpf);
- } else {
- IvtEntryTable[ExceptionType].RegisteredCallback (Context.SystemContextIpf);
- }
- } else {
- ASSERT (0);
- }
-
- InHandler = FALSE;
-}
-
-STATIC
-VOID
-GetHandlerEntryPoint (
- UINTN HandlerIndex,
- VOID **EntryPoint
- )
-/*++
-
-Routine Description:
- Given an integer number, return the physical address of the entry point in the IFT
-
-Arguments:
- HandlerIndex - Index of the Handler
- EntryPoint - IFT Entrypoint
-
-Returns:
-
- Nothing
-
---*/
-{
- UINT8 *TempPtr;
-
- //
- // get base address of IVT
- //
- TempPtr = GetIva ();
-
- if (HandlerIndex < 20) {
- //
- // first 20 provide 64 bundles per vector
- //
- TempPtr += 0x400 * HandlerIndex;
- } else {
- //
- // the rest provide 16 bundles per vector
- //
- TempPtr += 0x5000 + 0x100 * (HandlerIndex - 20);
- }
-
- *EntryPoint = (VOID *) TempPtr;
-}
-
-STATIC
-EFI_STATUS
-ManageIvtEntryTable (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN BUNDLE NewBundles[NUM_BUNDLES_IN_STUB],
- IN VOID (*NewCallback) ()
- )
-/*++
-
-Routine Description:
- This is the worker function that installs and removes all handlers
-
-Arguments:
- ExceptionType - Exception Type
- NewBundles - New Boundles
- NewCallback - New Callback
-
-Returns:
-
- EFI_STATUS - any return other than EFI_SUCCESS indicates the request was not
- satisfied.
- EFI_ALEADY_STARTED - Ivt already hooked.
-
---*/
-{
- BUNDLE *B0Ptr;
- UINT64 InterruptFlags;
- EFI_TPL OldTpl;
-
- //
- // Get address of bundle 0
- //
- GetHandlerEntryPoint (ExceptionType, (VOID **) &B0Ptr);
-
- if (IvtEntryTable[ExceptionType].RegisteredCallback != NULL) {
- //
- // we've already installed to this vector
- //
- if (NewCallback != NULL) {
- //
- // if the input handler is non-null, error
- //
- return EFI_ALREADY_STARTED;
- } else {
- //
- // else remove the previously installed handler
- //
- OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
- InterruptFlags = ProgramInterruptFlags (DISABLE_INTERRUPTS);
- if (ExceptionType == EXCEPT_IPF_EXTERNAL_INTERRUPT) {
- UnchainExternalInterrupt ();
- } else {
- UnhookEntry (ExceptionType);
- }
-
- ProgramInterruptFlags (InterruptFlags);
- gBS->RestoreTPL (OldTpl);
- //
- // re-init IvtEntryTable
- //
- SetMem (&IvtEntryTable[ExceptionType], sizeof (IVT_ENTRY), 0);
- }
- } else {
- //
- // no user handler installed on this vector
- //
- if (NewCallback != NULL) {
- OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
- InterruptFlags = ProgramInterruptFlags (DISABLE_INTERRUPTS);
- if (ExceptionType == EXCEPT_IPF_EXTERNAL_INTERRUPT) {
- ChainExternalInterrupt (NewCallback);
- } else {
- HookEntry (ExceptionType, NewBundles, NewCallback);
- }
-
- ProgramInterruptFlags (InterruptFlags);
- gBS->RestoreTPL (OldTpl);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-VOID
-HookEntry (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN BUNDLE NewBundles[4],
- IN VOID (*NewCallback) ()
- )
-/*++
-
-Routine Description:
- Saves original IVT contents and inserts a few new bundles which are fixed up
- to store the ExceptionType and then call the common handler.
-
-Arguments:
- ExceptionType - Exception Type
- NewBundles - New Boundles
- NewCallback - New Callback
-
-Returns:
-
- Nothing
-
---*/
-{
- BUNDLE *FixupBundle;
- BUNDLE *B0Ptr;
-
- //
- // Get address of bundle 0
- //
- GetHandlerEntryPoint (ExceptionType, (VOID **) &B0Ptr);
-
- //
- // copy original bundles from IVT to IvtEntryTable so we can restore them later
- //
- CopyMem (
- IvtEntryTable[ExceptionType].OrigBundles,
- B0Ptr,
- sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB
- );
- //
- // insert new B0
- //
- CopyMem (B0Ptr, NewBundles, sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB);
-
- //
- // fixup IVT entry so it stores its index and whether or not to chain...
- //
- FixupBundle = B0Ptr + 2;
- FixupBundle->high |= ExceptionType << 36;
-
- InstructionCacheFlush (B0Ptr, 5);
- IvtEntryTable[ExceptionType].RegisteredCallback = NewCallback;
-}
-
-STATIC
-VOID
-UnhookEntry (
- IN EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- Restores original IVT contents when unregistering a callback function
-
-Arguments:
- ExceptionType - Exception Type
- NewBundles - New Boundles
- NewCallback - New Callback
-
-Returns:
-
- Nothing
-
---*/
-{
- BUNDLE *B0Ptr;
-
- //
- // Get address of bundle 0
- //
- GetHandlerEntryPoint (ExceptionType, (VOID **) &B0Ptr);
- //
- // restore original bundles in IVT
- //
- CopyMem (
- B0Ptr,
- IvtEntryTable[ExceptionType].OrigBundles,
- sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB
- );
- InstructionCacheFlush (B0Ptr, 5);
-}
-
-STATIC
-VOID
-ChainExternalInterrupt (
- IN VOID (*NewCallback) ()
- )
-/*++
-
-Routine Description:
- Sets up cache flush and calls assembly function to chain external interrupt.
- Records new callback in IvtEntryTable.
-
-Arguments:
- NewCallback - New Callback
-
-Returns:
-
- Nothing
-
---*/
-{
- VOID *Start;
-
- Start = (VOID *) ((UINT8 *) GetIva () + 0x400 * EXCEPT_IPF_EXTERNAL_INTERRUPT + 0x400);
- IvtEntryTable[EXCEPT_IPF_EXTERNAL_INTERRUPT].RegisteredCallback = NewCallback;
- ChainHandler ();
- InstructionCacheFlush (Start, 0x400);
-}
-
-STATIC
-VOID
-UnchainExternalInterrupt (
- VOID
- )
-/*++
-
-Routine Description:
- Sets up cache flush and calls assembly function to restore external interrupt.
- Removes registered callback from IvtEntryTable.
-
-Arguments:
- Nothing
-
-Returns:
-
- Nothing
-
---*/
-{
- VOID *Start;
-
- Start = (VOID *) ((UINT8 *) GetIva () + 0x400 * EXCEPT_IPF_EXTERNAL_INTERRUPT + 0x400);
- UnchainHandler ();
- InstructionCacheFlush (Start, 0x400);
- IvtEntryTable[EXCEPT_IPF_EXTERNAL_INTERRUPT].RegisteredCallback = NULL;
-}
-
-//
-// The rest of the functions in this file are all member functions for the
-// DebugSupport protocol
-//
-
-EFI_STATUS
-EFIAPI
-GetMaximumProcessorIndex (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- OUT UINTN *MaxProcessorIndex
- )
-/*++
-
-Routine Description: This is a DebugSupport protocol member function. Hard
- coded to support only 1 processor for now.
-
-Arguments:
- This - The DebugSupport instance
- MaxProcessorIndex - The maximuim supported processor index
-
-Returns:
- Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
-
---*/
-{
- *MaxProcessorIndex = 0;
- return (EFI_SUCCESS);
-}
-
-EFI_STATUS
-EFIAPI
-RegisterPeriodicCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_PERIODIC_CALLBACK NewPeriodicCallback
- )
-/*++
-
-Routine Description:
- DebugSupport protocol member function
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- PeriodicCallback - Callback function
-
-Returns:
-
- EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.
-
---*/
-{
- return ManageIvtEntryTable (EXCEPT_IPF_EXTERNAL_INTERRUPT, NULL, NewPeriodicCallback);
-}
-
-EFI_STATUS
-EFIAPI
-RegisterExceptionCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_EXCEPTION_CALLBACK NewCallback,
- IN EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- DebugSupport protocol member function
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- NewCallback - Callback function
- ExceptionType - Which exception to hook
-
-Returns:
-
- EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.
-
---*/
-{
- return ManageIvtEntryTable (
- ExceptionType,
- (BUNDLE *) ((EFI_PLABEL *) HookStub)->EntryPoint,
- NewCallback
- );
-}
-
-EFI_STATUS
-EFIAPI
-InvalidateInstructionCache (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN VOID *Start,
- IN UINTN Length
- )
-/*++
-
-Routine Description:
- DebugSupport protocol member function. Calls assembly routine to flush cache.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- Start - Physical base of the memory range to be invalidated
- Length - mininum number of bytes in instruction cache to invalidate
-
-Returns:
- EFI_SUCCESS
-
---*/
-{
- InstructionCacheFlush (Start, Length);
- return (EFI_SUCCESS);
-}
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.h b/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.h
deleted file mode 100644
index 71c9578..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/**@file
- IPF specific debugsupport types, macros, and definitions.
-
-Copyright (c) 2004 - 2006 Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _PLDEBUG_SUPPORT_H
-#define _PLDEBUG_SUPPORT_H
-
-
-#define DISABLE_INTERRUPTS 0UL
-
-//
-// The remaining definitions comprise the protocol members.
-//
-#define EFI_ISA IsaIpf
-
-//
-// processor specific functions that must be public
-//
-EFI_STATUS
-plInitializeDebugSupportDriver (
- VOID
- )
-/*++
-
-Routine Description:
- IPF specific DebugSupport driver initialization. Must be public because it's
- referenced from DebugSupport.c
-
-Arguments:
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-plUnloadDebugSupportDriver (
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
- Unload handler that is called during UnloadImage() - deallocates pool memory
- used by the driver. Must be public because it's referenced from DebugSuport.c
-
-Arguments:
- ImageHandle - Image handle
-
-Returns:
-
- EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.
-
---*/
-;
-
-//
-// Assembly worker functions and data referenced from plDebugSupport.c
-//
-VOID *
-GetIva (
- VOID
- )
-/*++
-
-Routine Description:
-
- C callable function to obtain the current value of IVA
-
-Arguments:
-
- None
-
-Returns:
-
- Current value if IVA
-
---*/
-;
-
-VOID
-HookStub (
- VOID
- )
-/*++
-
-Routine Description:
-
- HookStub will be copied from it's loaded location into the IVT when
- an IVT entry is hooked.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-VOID
-ChainHandler (
- VOID
- )
-/*++
-
-Routine Description:
-
- Chains an interrupt handler
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-VOID
-UnchainHandler (
- VOID
- )
-/*++
-
-Routine Description:
-
- Unchains an interrupt handler
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-UINT64
-ProgramInterruptFlags (
- IN UINT64 NewInterruptState
- )
-/*++
-
-Routine Description:
-
- C callable function to enable/disable interrupts
-
-Arguments:
-
- NewInterruptState - New Interrupt State
-
-Returns:
-
- Previous state of psr.ic
-
---*/
-;
-
-VOID
-InstructionCacheFlush (
- IN VOID *StartAddress,
- IN UINTN SizeInBytes
- )
-/*++
-
-Routine Description:
-
- Flushes instruction cache for specified number of bytes
-
-Arguments:
-
- StartAddress - Cache Start Address
- SizeInBytes - Cache Size
-
-Returns:
-
- None
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-GetMaximumProcessorIndex (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- OUT UINTN *MaxProcessorIndex
- )
-/*++
-
-Routine Description: This is a DebugSupport protocol member function. Hard
- coded to support only 1 processor for now.
-
-Arguments:
- This - The DebugSupport instance
- MaxProcessorIndex - The maximuim supported processor index
-
-Returns:
- Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-RegisterPeriodicCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_PERIODIC_CALLBACK PeriodicCallback
- )
-/*++
-
-Routine Description:
- DebugSupport protocol member function
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- PeriodicCallback - Callback function
-
-Returns:
-
- EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-RegisterExceptionCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_EXCEPTION_CALLBACK NewHandler,
- IN EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- DebugSupport protocol member function
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- NewCallback - Callback function
- ExceptionType - Which exception to hook
-
-Returns:
-
- EFI_STATUS - anything other than EFI_SUCCESS indicates the callback was not registered.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-InvalidateInstructionCache (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN VOID *Start,
- IN UINTN Length
- )
-/*++
-
-Routine Description:
- DebugSupport protocol member function. Calls assembly routine to flush cache.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- Start - Physical base of the memory range to be invalidated
- Length - mininum number of bytes in instruction cache to invalidate
-
-Returns:
- EFI_SUCCESS
-
---*/
-;
-
-VOID
-CommonHandler (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN EFI_SYSTEM_CONTEXT Context
- )
-/*++
-
-Routine Description:
- C routine that is called for all registered exceptions. This is the main
- exception dispatcher. Must be public because it's referenced from AsmFuncs.s.
-
-Arguments:
- ExceptionType - Exception Type
- Context - System Context
-
-Returns:
-
- Nothing
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/AsmFuncs.S b/EdkModulePkg/Universal/DebugSupport/Dxe/x64/AsmFuncs.S
deleted file mode 100644
index f59a5b3..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/AsmFuncs.S
+++ /dev/null
@@ -1,57 +0,0 @@
-#******************************************************************************
-#*
-#* Copyright (c) 2007, Intel Corporation
-#* All rights reserved. This program and the accompanying materials
-#* are licensed and made available under the terms and conditions of the BSD License
-#* which accompanies this distribution. The full text of the license may be found at
-#* http://opensource.org/licenses/bsd-license.php
-#*
-#* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#*
-#******************************************************************************
-
-.globl _OrigVector
-.globl _InterruptEntryStub
-.globl _StubSize
-.globl _CommonIdtEntry
-.globl _FxStorSupport
-
-_AppEsp: .long 0x11111111 # ?
-_DebugEsp: .long 0x22222222 # ?
-_ExtraPush: .long 0x33333333 # ?
-_ExceptData: .long 0x44444444 # ?
-_Eflags: .long 0x55555555 # ?
-_OrigVector: .long 0x66666666 # ?
-_StubSize: .long _InterruptEntryStubEnd - _InterruptEntryStub
-
-.globl _FxStorSupport
-_FxStorSupport:
- ret
-
-.globl _GetIdtr
-_GetIdtr:
- ret
-
-.globl _WriteInterruptFlag
-_WriteInterruptFlag:
- ret
-
-.globl _Vect2Desc
-_Vect2Desc:
- ret
-
-.globl _InterruptEntryStub
-_InterruptEntryStub:
- ret
-
-.globl _InterruptEntryStubEnd
-_InterruptEntryStubEnd:
- ret
-
-.globl _CommonIdtEntry
-_CommonIdtEntry:
- ret
-
-PhonyIretd:
- iret
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/AsmFuncs.asm b/EdkModulePkg/Universal/DebugSupport/Dxe/x64/AsmFuncs.asm
deleted file mode 100644
index 810de90..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/AsmFuncs.asm
+++ /dev/null
@@ -1,654 +0,0 @@
-;******************************************************************************
-;*
-;* Copyright (c) 2006, Intel Corporation
-;* All rights reserved. This program and the accompanying materials
-;* are licensed and made available under the terms and conditions of the BSD License
-;* which accompanies this distribution. The full text of the license may be found at
-;* http://opensource.org/licenses/bsd-license.php
-;*
-;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;*
-;******************************************************************************
-
-EXCPT64_DIVIDE_ERROR EQU 0
-EXCPT64_DEBUG EQU 1
-EXCPT64_NMI EQU 2
-EXCPT64_BREAKPOINT EQU 3
-EXCPT64_OVERFLOW EQU 4
-EXCPT64_BOUND EQU 5
-EXCPT64_INVALID_OPCODE EQU 6
-EXCPT64_DOUBLE_FAULT EQU 8
-EXCPT64_INVALID_TSS EQU 10
-EXCPT64_SEG_NOT_PRESENT EQU 11
-EXCPT64_STACK_FAULT EQU 12
-EXCPT64_GP_FAULT EQU 13
-EXCPT64_PAGE_FAULT EQU 14
-EXCPT64_FP_ERROR EQU 16
-EXCPT64_ALIGNMENT_CHECK EQU 17
-EXCPT64_MACHINE_CHECK EQU 18
-EXCPT64_SIMD EQU 19
-
-FXSTOR_FLAG EQU 01000000h ; bit cpuid 24 of feature flags
-
-;; The FXSTOR and FXRSTOR commands are used for saving and restoring the x87,
-;; MMX, SSE, SSE2, etc registers. The initialization of the debugsupport driver
-;; MUST check the CPUID feature flags to see that these instructions are available
-;; and fail to init if they are not.
-
-;; fxstor [rdi]
-FXSTOR_RDI MACRO
- db 0fh, 0aeh, 00000111y ; mod = 00, reg/op = 000, r/m = 111 = [rdi]
-ENDM
-
-;; fxrstor [rsi]
-FXRSTOR_RSI MACRO
- db 0fh, 0aeh, 00001110y ; mod = 00, reg/op = 001, r/m = 110 = [rsi]
-ENDM
-
-data SEGMENT
-
-public OrigVector, InterruptEntryStub, StubSize, CommonIdtEntry, FxStorSupport
-
-StubSize dd InterruptEntryStubEnd - InterruptEntryStub
-AppRsp dq 1111111111111111h ; ?
-DebugRsp dq 2222222222222222h ; ?
-ExtraPush dq 3333333333333333h ; ?
-ExceptData dq 4444444444444444h ; ?
-Rflags dq 5555555555555555h ; ?
-OrigVector dq 6666666666666666h ; ?
-
-;; The declarations below define the memory region that will be used for the debug stack.
-;; The context record will be built by pushing register values onto this stack.
-;; It is imparitive that alignment be carefully managed, since the FXSTOR and
-;; FXRSTOR instructions will GP fault if their memory operand is not 16 byte aligned.
-;;
-;; The stub will switch stacks from the application stack to the debuger stack
-;; and pushes the exception number.
-;;
-;; Then we building the context record on the stack. Since the stack grows down,
-;; we push the fields of the context record from the back to the front. There
-;; are 336 bytes of stack used prior allocating the 512 bytes of stack to be
-;; used as the memory buffer for the fxstor instruction. Therefore address of
-;; the buffer used for the FXSTOR instruction is &Eax - 336 - 512, which
-;; must be 16 byte aligned.
-;;
-;; We carefully locate the stack to make this happen.
-;;
-;; For reference, the context structure looks like this:
-;; struct {
-;; UINT64 ExceptionData;
-;; FX_SAVE_STATE_X64 FxSaveState; // 512 bytes, must be 16 byte aligned
-;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
-;; UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;
-;; UINT64 RFlags;
-;; UINT64 Ldtr, Tr;
-;; UINT64 Gdtr[2], Idtr[2];
-;; UINT64 Rip;
-;; UINT64 Gs, Fs, Es, Ds, Cs, Ss;
-;; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
-;; UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
-;; } SYSTEM_CONTEXT_X64; // 64 bit system context record
-
-align 16
-DebugStackEnd db "DbgStkEnd >>>>>>" ;; 16 byte long string - must be 16 bytes to preserve alignment
- dd 1ffch dup (000000000h) ;; 32K should be enough stack
- ;; This allocation is coocked to insure
- ;; that the the buffer for the FXSTORE instruction
- ;; will be 16 byte aligned also.
- ;;
-ExceptionNumber dq ? ;; first entry will be the vector number pushed by the stub
-
-DebugStackBegin db "<<<< DbgStkBegin" ;; initial debug ESP == DebugStackBegin, set in stub
-
-data ENDS
-
-text SEGMENT
-
-externdef InterruptDistrubutionHub:near
-
-;------------------------------------------------------------------------------
-; VOID
-; EfiWbinvd (
-; VOID
-; )
-;
-; Abstract: Writeback and invalidate cache
-;
-EfiWbinvd PROC PUBLIC
- wbinvd
- ret
-EfiWbinvd ENDP
-
-;------------------------------------------------------------------------------
-; BOOLEAN
-; FxStorSupport (
-; void
-; )
-;
-; Abstract: Returns TRUE if FxStor instructions are supported
-;
-FxStorSupport PROC PUBLIC
-
-;
-; cpuid corrupts rbx which must be preserved per the C calling convention
-;
- push rbx
- mov rax, 1
- cpuid
- mov eax, edx
- and rax, FXSTOR_FLAG
- shr rax, 24
- pop rbx
- ret
-FxStorSupport ENDP
-
-
-;------------------------------------------------------------------------------
-; DESCRIPTOR *
-; GetIdtr (
-; void
-; )
-;
-; Abstract: Returns physical address of IDTR
-;
-GetIdtr PROC PUBLIC
- push rbp
- mov rbp, rsp
-
- sidt QWORD PTR [rbp - 0ah]
- mov rax, QWORD PTR [rbp - 8h]
-
- mov rsp, rbp
- pop rbp
- ret
-GetIdtr ENDP
-
-
-;------------------------------------------------------------------------------
-; BOOLEAN
-; WriteInterruptFlag (
-; BOOLEAN NewState // rcx
-; )
-;
-; Abstract: Programs interrupt flag to the requested state and returns previous
-; state.
-;
-WriteInterruptFlag PROC PUBLIC
-
- pushfq
- pop rax
- and rax, 200h
- shr rax, 9
- cmp rcx, 0
- jnz EnableIF
- cli
- ret
-EnableIF:
- sti
- ret
-
-WriteInterruptFlag ENDP
-
-
-
-;------------------------------------------------------------------------------
-; void
-; Vect2Desc (
-; DESCRIPTOR * DestDesc, // rcx
-; void (*Vector) (void) // rdx
-; )
-;
-; Abstract: Encodes an IDT descriptor with the given physical address
-;
-Vect2Desc PROC PUBLIC
-
- mov rax, rdx
- mov word ptr [rcx], ax ; write bits 15..0 of offset
- mov dx, cs
- mov word ptr [rcx+2], dx ; SYS_CODE_SEL from GDT
- mov word ptr [rcx+4], 0e00h OR 8000h ; type = 386 interrupt gate, present
- shr rax, 16
- mov word ptr [rcx+6], ax ; write bits 31..16 of offset
- shr rax, 16
- mov dword ptr [rcx+8], eax ; write bits 63..32 of offset
-
- ret
-
-Vect2Desc ENDP
-
-
-
-;------------------------------------------------------------------------------
-; InterruptEntryStub
-;
-; Abstract: This code is not a function, but is a small piece of code that is
-; copied and fixed up once for each IDT entry that is hooked.
-;
-InterruptEntryStub::
- push 0 ; push vector number - will be modified before installed
- db 0e9h ; jump rel32
- dd 0 ; fixed up to relative address of CommonIdtEntry
-InterruptEntryStubEnd:
-
-
-
-;------------------------------------------------------------------------------
-; CommonIdtEntry
-;
-; Abstract: This code is not a function, but is the common part for all IDT
-; vectors.
-;
-CommonIdtEntry::
-;;
-;; At this point, the stub has saved the current application stack esp into AppRsp
-;; and switched stacks to the debug stack, where it pushed the vector number
-;;
-;; The application stack looks like this:
-;;
-;; ...
-;; (last application stack entry)
-;; [16 bytes alignment, do not care it]
-;; SS from interrupted task
-;; RSP from interrupted task
-;; rflags from interrupted task
-;; CS from interrupted task
-;; RIP from interrupted task
-;; Error code <-------------------- Only present for some exeption types
-;;
-;; Vector Number <----------------- pushed in our IDT Entry
-;;
-
-
-;; The stub switched us to the debug stack and pushed the interrupt number.
-;;
-;; Next, construct the context record. It will be build on the debug stack by
-;; pushing the registers in the correct order so as to create the context structure
-;; on the debug stack. The context record must be built from the end back to the
-;; beginning because the stack grows down...
-;
-;; For reference, the context record looks like this:
-;;
-;; typedef
-;; struct {
-;; UINT64 ExceptionData;
-;; FX_SAVE_STATE_X64 FxSaveState;
-;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
-;; UINT64 Cr0, Cr2, Cr3, Cr4, Cr8;
-;; UINT64 RFlags;
-;; UINT64 Ldtr, Tr;
-;; UINT64 Gdtr[2], Idtr[2];
-;; UINT64 Rip;
-;; UINT64 Gs, Fs, Es, Ds, Cs, Ss;
-;; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
-;; UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
-;; } SYSTEM_CONTEXT_X64; // 64 bit system context record
-
-;; NOTE: we save rsp here to prevent compiler put rip reference cause error AppRsp
- push rax
- mov rax, qword ptr [rsp][8] ; save vector number
- mov ExceptionNumber, rax ; save vector number
- pop rax
- add rsp, 8 ; pop vector number
- mov AppRsp, rsp ; save stack top
- mov rsp, offset DebugStackBegin ; switch to debugger stack
- sub rsp, 8 ; leave space for vector number
-
-;; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
-;; UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
- push r15
- push r14
- push r13
- push r12
- push r11
- push r10
- push r9
- push r8
- push rax
- push rcx
- push rdx
- push rbx
- push rsp
- push rbp
- push rsi
- push rdi
-
-;; Save interrupt state rflags register...
- pushfq
- pop rax
- mov qword ptr Rflags, rax
-
-;; We need to determine if any extra data was pushed by the exception, and if so, save it
-;; To do this, we check the exception number pushed by the stub, and cache the
-;; result in a variable since we'll need this again.
- cmp ExceptionNumber, EXCPT64_DOUBLE_FAULT
- jz ExtraPushOne
- cmp ExceptionNumber, EXCPT64_INVALID_TSS
- jz ExtraPushOne
- cmp ExceptionNumber, EXCPT64_SEG_NOT_PRESENT
- jz ExtraPushOne
- cmp ExceptionNumber, EXCPT64_STACK_FAULT
- jz ExtraPushOne
- cmp ExceptionNumber, EXCPT64_GP_FAULT
- jz ExtraPushOne
- cmp ExceptionNumber, EXCPT64_PAGE_FAULT
- jz ExtraPushOne
- cmp ExceptionNumber, EXCPT64_ALIGNMENT_CHECK
- jz ExtraPushOne
- mov ExtraPush, 0
- mov ExceptData, 0
- jmp ExtraPushDone
-ExtraPushOne:
- mov ExtraPush, 1
-
-;; If there's some extra data, save it also, and modify the saved AppRsp to effectively
-;; pop this value off the application's stack.
- mov rax, AppRsp
- mov rbx, [rax]
- mov ExceptData, rbx
- add rax, 8
- mov AppRsp, rax
-
-ExtraPushDone:
-
-;; The "push" above pushed the debug stack rsp. Since what we're actually doing
-;; is building the context record on the debug stack, we need to save the pushed
-;; debug RSP, and replace it with the application's last stack entry...
- mov rax, [rsp + 24]
- mov DebugRsp, rax
- mov rax, AppRsp
- add rax, 40
- ; application stack has ss, rsp, rflags, cs, & rip, so
- ; last actual application stack entry is
- ; 40 bytes into the application stack.
- mov [rsp + 24], rax
-
-;; continue building context record
-;; UINT64 Gs, Fs, Es, Ds, Cs, Ss; insure high 16 bits of each is zero
- mov rax, ss
- push rax
-
- ; CS from application is one entry back in application stack
- mov rax, AppRsp
- movzx rax, word ptr [rax + 8]
- push rax
-
- mov rax, ds
- push rax
- mov rax, es
- push rax
- mov rax, fs
- push rax
- mov rax, gs
- push rax
-
-;; UINT64 Rip;
- ; Rip from application is on top of application stack
- mov rax, AppRsp
- push qword ptr [rax]
-
-;; UINT64 Gdtr[2], Idtr[2];
- push 0
- push 0
- sidt fword ptr [rsp]
- push 0
- push 0
- sgdt fword ptr [rsp]
-
-;; UINT64 Ldtr, Tr;
- xor rax, rax
- str ax
- push rax
- sldt ax
- push rax
-
-;; UINT64 RFlags;
-;; Rflags from application is two entries back in application stack
- mov rax, AppRsp
- push qword ptr [rax + 16]
-
-;; UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;
-;; insure FXSAVE/FXRSTOR is enabled in CR4...
-;; ... while we're at it, make sure DE is also enabled...
- mov rax, cr8
- push rax
- mov rax, cr4
- or rax, 208h
- mov cr4, rax
- push rax
- mov rax, cr3
- push rax
- mov rax, cr2
- push rax
- push 0
- mov rax, cr0
- push rax
-
-;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
- mov rax, dr7
- push rax
-;; clear Dr7 while executing debugger itself
- xor rax, rax
- mov dr7, rax
-
- mov rax, dr6
- push rax
-;; insure all status bits in dr6 are clear...
- xor rax, rax
- mov dr6, rax
-
- mov rax, dr3
- push rax
- mov rax, dr2
- push rax
- mov rax, dr1
- push rax
- mov rax, dr0
- push rax
-
-;; FX_SAVE_STATE_X64 FxSaveState;
- sub rsp, 512
- mov rdi, rsp
- ; IMPORTANT!! The debug stack has been carefully constructed to
- ; insure that rsp and rdi are 16 byte aligned when we get here.
- ; They MUST be. If they are not, a GP fault will occur.
- FXSTOR_RDI
-
-;; UINT64 ExceptionData;
- mov rax, ExceptData
- push rax
-
-; call to C code which will in turn call registered handler
-; pass in the vector number
- mov rdx, rsp
- mov rcx, ExceptionNumber
- sub rsp, 40
- call InterruptDistrubutionHub
- add rsp, 40
-
-; restore context...
-;; UINT64 ExceptionData;
- add rsp, 8
-
-;; FX_SAVE_STATE_X64 FxSaveState;
- mov rsi, rsp
- FXRSTOR_RSI
- add rsp, 512
-
-;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
- pop rax
- mov dr0, rax
- pop rax
- mov dr1, rax
- pop rax
- mov dr2, rax
- pop rax
- mov dr3, rax
-;; skip restore of dr6. We cleared dr6 during the context save.
- add rsp, 8
- pop rax
- mov dr7, rax
-
-;; UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;
- pop rax
- mov cr0, rax
- add rsp, 8
- pop rax
- mov cr2, rax
- pop rax
- mov cr3, rax
- pop rax
- mov cr4, rax
- pop rax
- mov cr8, rax
-
-;; UINT64 RFlags;
- mov rax, AppRsp
- pop qword ptr [rax + 16]
-
-;; UINT64 Ldtr, Tr;
-;; UINT64 Gdtr[2], Idtr[2];
-;; Best not let anyone mess with these particular registers...
- add rsp, 48
-
-;; UINT64 Rip;
- pop qword ptr [rax]
-
-;; UINT64 Gs, Fs, Es, Ds, Cs, Ss;
-;; NOTE - modified segment registers could hang the debugger... We
-;; could attempt to insulate ourselves against this possibility,
-;; but that poses risks as well.
-;;
-
- pop rax
- ; mov gs, rax
- pop rax
- ; mov fs, rax
- pop rax
- mov es, rax
- pop rax
- mov ds, rax
- mov rax, AppRsp
- pop qword ptr [rax + 8]
- pop rax
- mov ss, rax
-
-;; The next stuff to restore is the general purpose registers that were pushed
-;; using the "push" instruction.
-;;
-;; The value of RSP as stored in the context record is the application RSP
-;; including the 5 entries on the application stack caused by the exception
-;; itself. It may have been modified by the debug agent, so we need to
-;; determine if we need to relocate the application stack.
-
- mov rbx, [rsp + 24] ; move the potentially modified AppRsp into rbx
- mov rax, AppRsp
- add rax, 40
- cmp rbx, rax
- je NoAppStackMove
-
- mov rax, AppRsp
- mov rcx, [rax] ; RIP
- mov [rbx], rcx
-
- mov rcx, [rax + 8] ; CS
- mov [rbx + 8], rcx
-
- mov rcx, [rax + 16] ; RFLAGS
- mov [rbx + 16], rcx
-
- mov rcx, [rax + 24] ; RSP
- mov [rbx + 24], rcx
-
- mov rcx, [rax + 32] ; SS
- mov [rbx + 32], rcx
-
- mov rax, rbx ; modify the saved AppRsp to the new AppRsp
- mov AppRsp, rax
-NoAppStackMove:
- mov rax, DebugRsp ; restore the DebugRsp on the debug stack
- ; so our "pop" will not cause a stack switch
- mov [rsp + 24], rax
-
- cmp ExceptionNumber, 068h
- jne NoChain
-
-Chain:
-
-;; Restore rflags so when we chain, the flags will be exactly as if we were never here.
-;; We gin up the stack to do an iretq so we can get ALL the flags.
- mov rax, AppRsp
- mov rbx, [rax + 40]
- push rbx
- mov rax, ss
- push rax
- mov rax, rsp
- add rax, 16
- push rax
- mov rax, AppRsp
- mov rbx, [rax + 16]
- and rbx, NOT 300h ; special handling for IF and TF
- push rbx
- mov rax, cs
- push rax
- mov rax, offset PhonyIretq
- push rax
- iretq
-PhonyIretq:
-
-;; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
-;; UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
- pop rdi
- pop rsi
- pop rbp
- pop rsp
- pop rbx
- pop rdx
- pop rcx
- pop rax
- pop r8
- pop r9
- pop r10
- pop r11
- pop r12
- pop r13
- pop r14
- pop r15
-
-;; Switch back to application stack
- mov rsp, AppRsp
-
-;; Jump to original handler
- jmp OrigVector
-
-NoChain:
-;; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
-;; UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
- pop rdi
- pop rsi
- pop rbp
- pop rsp
- pop rbx
- pop rdx
- pop rcx
- pop rax
- pop r8
- pop r9
- pop r10
- pop r11
- pop r12
- pop r13
- pop r14
- pop r15
-
-;; Switch back to application stack
- mov rsp, AppRsp
-
-;; We're outa here...
- iretq
-text ENDS
-
-END
-
-
-
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c
deleted file mode 100644
index 8b907ee..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/**@file
- X64 specific debug support functions
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-//
-// private header files
-//
-#include "plDebugSupport.h"
-
-//
-// This the global main table to keep track of the interrupts
-//
-IDT_ENTRY *IdtEntryTable = NULL;
-DESCRIPTOR NullDesc = {0, 0};
-
-STATIC
-EFI_STATUS
-CreateEntryStub (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- OUT VOID **Stub
- )
-/*++
-
-Routine Description: Allocate pool for a new IDT entry stub. Copy the generic
- stub into the new buffer and fixup the vector number and jump target address.
-
-Arguments:
- ExceptionType - This is the exception type that the new stub will be created
- for.
- Stub - On successful exit, *Stub contains the newly allocated entry stub.
-Returns:
- Typically EFI_SUCCESS
- other possibilities are passed through from AllocatePool
-
---*/
-{
- UINT8 *StubCopy;
-
- StubCopy = *Stub;
-
- //
- // Fixup the stub code for this vector
- //
-
- // The stub code looks like this:
- //
- // 00000000 6A 00 push 0 ; push vector number - will be modified before installed
- // 00000002 E9 db 0e9h ; jump rel32
- // 00000003 00000000 dd 0 ; fixed up to relative address of CommonIdtEntry
- //
-
- //
- // poke in the exception type so the second push pushes the exception type
- //
- StubCopy[0x1] = (UINT8) ExceptionType;
-
- //
- // fixup the jump target to point to the common entry
- //
- *(UINT32 *) &StubCopy[0x3] = (UINT32)((UINTN) CommonIdtEntry - (UINTN) &StubCopy[StubSize]);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-HookEntry (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN VOID (*NewCallback) ()
- )
-/*++
-
-Routine Description:
- Creates a nes entry stub. Then saves the current IDT entry and replaces it
- with an interrupt gate for the new entry point. The IdtEntryTable is updated
- with the new registered function.
-
- This code executes in boot services context. The stub entry executes in interrupt
- context.
-
-Arguments:
- ExceptionType - specifies which vector to hook.
- NewCallback - a pointer to the new function to be registered.
-
-Returns:
- EFI_SUCCESS
- Other possibilities are passed through by CreateEntryStub
-
---*/
-{
- BOOLEAN OldIntFlagState;
- EFI_STATUS Status;
-
- Status = CreateEntryStub (ExceptionType, (VOID **) &IdtEntryTable[ExceptionType].StubEntry);
- if (Status == EFI_SUCCESS) {
- OldIntFlagState = WriteInterruptFlag (0);
- ReadIdt (ExceptionType, &(IdtEntryTable[ExceptionType].OrigDesc));
-
- ((UINT16 *) &IdtEntryTable[ExceptionType].OrigVector)[0] = ((UINT16 *) &IdtEntryTable[ExceptionType].OrigDesc.Low)[0];
- ((UINT16 *) &IdtEntryTable[ExceptionType].OrigVector)[1] = ((UINT16 *) &IdtEntryTable[ExceptionType].OrigDesc.Low)[3];
- ((UINT32 *) &IdtEntryTable[ExceptionType].OrigVector)[1] = ((UINT32 *) &IdtEntryTable[ExceptionType].OrigDesc.High)[0];
-
- Vect2Desc (&IdtEntryTable[ExceptionType].NewDesc, IdtEntryTable[ExceptionType].StubEntry);
- IdtEntryTable[ExceptionType].RegisteredCallback = NewCallback;
- WriteIdt (ExceptionType, &(IdtEntryTable[ExceptionType].NewDesc));
- WriteInterruptFlag (OldIntFlagState);
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-UnhookEntry (
- IN EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- Undoes HookEntry. This code executes in boot services context.
-
-Arguments:
- ExceptionType - specifies which entry to unhook
-
-Returns:
- EFI_SUCCESS
-
---*/
-{
- BOOLEAN OldIntFlagState;
-
- OldIntFlagState = WriteInterruptFlag (0);
- WriteIdt (ExceptionType, &(IdtEntryTable[ExceptionType].OrigDesc));
- WriteInterruptFlag (OldIntFlagState);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ManageIdtEntryTable (
- VOID (*NewCallback)(),
- EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- This is the main worker function that manages the state of the interrupt
- handlers. It both installs and uninstalls interrupt handlers based on the
- value of NewCallback. If NewCallback is NULL, then uninstall is indicated.
- If NewCallback is non-NULL, then install is indicated.
-
-Arguments:
- NewCallback - If non-NULL, NewCallback specifies the new handler to register.
- If NULL, specifies that the previously registered handler should
- be uninstalled.
- ExceptionType - Indicates which entry to manage
-
-Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
- no handler registered for it
- EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
-
- Other possible return values are passed through from UnHookEntry and HookEntry.
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
-
- if (CompareDescriptor (&IdtEntryTable[ExceptionType].NewDesc, &NullDesc)) {
- //
- // we've already installed to this vector
- //
- if (NewCallback != NULL) {
- //
- // if the input handler is non-null, error
- //
- Status = EFI_ALREADY_STARTED;
- } else {
- Status = UnhookEntry (ExceptionType);
- }
- } else {
- //
- // no user handler installed on this vector
- //
- if (NewCallback == NULL) {
- //
- // if the input handler is null, error
- //
- Status = EFI_INVALID_PARAMETER;
- } else {
- Status = HookEntry (ExceptionType, NewCallback);
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-GetMaximumProcessorIndex (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- OUT UINTN *MaxProcessorIndex
- )
-/*++
-
-Routine Description: This is a DebugSupport protocol member function.
-
-Arguments:
- This - The DebugSupport instance
- MaxProcessorIndex - The maximuim supported processor index
-
-Returns:
- Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
-
---*/
-{
- *MaxProcessorIndex = 0;
- return (EFI_SUCCESS);
-}
-
-EFI_STATUS
-EFIAPI
-RegisterPeriodicCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_PERIODIC_CALLBACK PeriodicCallback
- )
-/*++
-
-Routine Description: This is a DebugSupport protocol member function.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- PeriodicCallback - Callback function
-
-Returns:
-
- EFI_SUCCESS
- EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
- no handler registered for it
- EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
-
- Other possible return values are passed through from UnHookEntry and HookEntry.
-
---*/
-{
- return ManageIdtEntryTable (PeriodicCallback, SYSTEM_TIMER_VECTOR);
-}
-
-EFI_STATUS
-EFIAPI
-RegisterExceptionCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_EXCEPTION_CALLBACK NewCallback,
- IN EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- This is a DebugSupport protocol member function.
-
- This code executes in boot services context.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- NewCallback - Callback function
- ExceptionType - Which exception to hook
-
-Returns:
-
- EFI_SUCCESS
- EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
- no handler registered for it
- EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
-
- Other possible return values are passed through from UnHookEntry and HookEntry.
-
---*/
-{
- return ManageIdtEntryTable (NewCallback, ExceptionType);
-}
-
-EFI_STATUS
-EFIAPI
-InvalidateInstructionCache (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN VOID *Start,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
- This is a DebugSupport protocol member function.
- Calls assembly routine to flush cache.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- Start - Physical base of the memory range to be invalidated
- Length - mininum number of bytes in instruction cache to invalidate
-
-Returns:
-
- EFI_SUCCESS - always return success
-
---*/
-{
- AsmWbinvd ();
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-plInitializeDebugSupportDriver (
- VOID
- )
-/*++
-
-Routine Description:
- Initializes driver's handler registration database.
-
- This code executes in boot services context.
-
-Arguments:
- None
-
-Returns:
- EFI_SUCCESS
- EFI_UNSUPPORTED - if X64 processor does not support FXSTOR/FXRSTOR instructions,
- the context save will fail, so these processor's are not supported.
- EFI_OUT_OF_RESOURCES - not resource to finish initialization
-
---*/
-{
- EFI_EXCEPTION_TYPE ExceptionType;
-
- if (!FxStorSupport ()) {
- return EFI_UNSUPPORTED;
- }
-
- IdtEntryTable = AllocateZeroPool (sizeof (IDT_ENTRY) * NUM_IDT_ENTRIES);
- if (IdtEntryTable == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType++) {
- IdtEntryTable[ExceptionType].StubEntry = (DEBUG_PROC) (UINTN) AllocatePool (StubSize);
- if (IdtEntryTable[ExceptionType].StubEntry == NULL) {
- goto ErrorCleanup;
- }
-
- CopyMem ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry, InterruptEntryStub, StubSize);
- }
- return EFI_SUCCESS;
-
-ErrorCleanup:
-
- for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType++) {
- if (IdtEntryTable[ExceptionType].StubEntry != NULL) {
- FreePool ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry);
- }
- }
- FreePool (IdtEntryTable);
-
- return EFI_OUT_OF_RESOURCES;
-}
-
-EFI_STATUS
-EFIAPI
-plUnloadDebugSupportDriver (
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
- This is the callback that is written to the LoadedImage protocol instance
- on the image handle. It uninstalls all registered handlers and frees all entry
- stub memory.
-
- This code executes in boot services context.
-
-Arguments:
- ImageHandle - The image handle of the unload handler
-
-Returns:
-
- EFI_SUCCESS - always return success
-
---*/
-{
- EFI_EXCEPTION_TYPE ExceptionType;
-
- for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType++) {
- ManageIdtEntryTable (NULL, ExceptionType);
- }
-
- FreePool (IdtEntryTable);
- return EFI_SUCCESS;
-}
-
-VOID
-InterruptDistrubutionHub (
- EFI_EXCEPTION_TYPE ExceptionType,
- EFI_SYSTEM_CONTEXT_IA32 *ContextRecord
- )
-/*++
-
-Routine Description: Common piece of code that invokes the registered handlers.
-
- This code executes in exception context so no efi calls are allowed.
-
-Arguments:
- ExceptionType - exception type
- ContextRecord - system context
-
-Returns:
-
- None
-
---*/
-{
- if (IdtEntryTable[ExceptionType].RegisteredCallback != NULL) {
- if (ExceptionType != SYSTEM_TIMER_VECTOR) {
- IdtEntryTable[ExceptionType].RegisteredCallback (ExceptionType, ContextRecord);
- } else {
- OrigVector = IdtEntryTable[ExceptionType].OrigVector;
- IdtEntryTable[ExceptionType].RegisteredCallback (ContextRecord);
- }
- }
-}
diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.h b/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.h
deleted file mode 100644
index 42c849e..0000000
--- a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.h
+++ /dev/null
@@ -1,322 +0,0 @@
-/**@file
- X64 specific debug support macros, typedefs and prototypes.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _PLDEBUG_SUPPORT_H
-#define _PLDEBUG_SUPPORT_H
-
-#define NUM_IDT_ENTRIES 0x78
-#define SYSTEM_TIMER_VECTOR 0x68
-#define VECTOR_ENTRY_PAGES 1
-#define CopyDescriptor(Dest, Src) CopyMem ((Dest), (Src), sizeof (DESCRIPTOR))
-#define ZeroDescriptor(Dest) CopyDescriptor ((Dest), &NullDesc)
-#define ReadIdt(Vector, Dest) CopyDescriptor ((Dest), &((GetIdtr ())[(Vector)]))
-#define WriteIdt(Vector, Src) CopyDescriptor (&((GetIdtr ())[(Vector)]), (Src))
-#define CompareDescriptor(Desc1, Desc2) CompareMem ((Desc1), (Desc2), sizeof (DESCRIPTOR))
-#define EFI_ISA IsaX64
-#define FF_FXSR (1 << 24)
-
-typedef struct {
- UINT64 Low;
- UINT64 High;
-} DESCRIPTOR;
-
-typedef
-VOID
-(*DEBUG_PROC) (
- VOID
- )
-;
-
-typedef struct {
- DESCRIPTOR OrigDesc;
- DEBUG_PROC OrigVector;
- DESCRIPTOR NewDesc;
- DEBUG_PROC StubEntry;
- VOID (*RegisteredCallback) ();
-} IDT_ENTRY;
-
-extern EFI_SYSTEM_CONTEXT SystemContext;
-extern UINT8 InterruptEntryStub[];
-extern UINT32 StubSize;
-extern VOID (*OrigVector) (VOID);
-
-VOID
-CommonIdtEntry (
- VOID
- )
-/*++
-
-Routine Description:
-
- Generic IDT entry
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-;
-
-
-BOOLEAN
-FxStorSupport (
- VOID
- )
-/*++
-
-Routine Description:
-
- Check whether FXSTOR is supported
-
-Arguments:
-
- None
-
-Returns:
-
- TRUE - supported
- FALSE - not supported
-
---*/
-;
-
-DESCRIPTOR *
-GetIdtr (
- VOID
- )
-/*++
-
-Routine Description:
-
- Return the physical address of IDTR
-
-Arguments:
-
- None
-
-Returns:
-
- The physical address of IDTR
-
---*/
-;
-
-VOID
-Vect2Desc (
- DESCRIPTOR * DestDesc,
- VOID (*Vector) (VOID)
- )
-/*++
-
-Routine Description:
-
- Encodes an IDT descriptor with the given physical address
-
-Arguments:
-
- DestDesc - The IDT descriptor address
- Vector - The interrupt vector entry
-
-Returns:
-
- None
-
---*/
-;
-
-BOOLEAN
-WriteInterruptFlag (
- BOOLEAN NewState
- )
-/*++
-
-Routine Description:
-
- Programs interrupt flag to the requested state and returns previous
- state.
-
-Arguments:
-
- NewState - New interrupt status
-
-Returns:
-
- Old interrupt status
-
---*/
-;
-
-EFI_STATUS
-plInitializeDebugSupportDriver (
- VOID
- )
-/*++
-
-Routine Description:
- Initializes driver's handler registration database.
-
- This code executes in boot services context.
-
-Arguments:
- None
-
-Returns:
- EFI_SUCCESS
- EFI_UNSUPPORTED - if X64 processor does not support FXSTOR/FXRSTOR instructions,
- the context save will fail, so these processor's are not supported.
- EFI_OUT_OF_RESOURCES - not resource to finish initialization
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-plUnloadDebugSupportDriver (
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
- This is the callback that is written to the LoadedImage protocol instance
- on the image handle. It uninstalls all registered handlers and frees all entry
- stub memory.
-
- This code executes in boot services context.
-
-Arguments:
- ImageHandle - The image handle of the unload handler
-
-Returns:
-
- EFI_SUCCESS - always return success
-
---*/
-;
-
-//
-// DebugSupport protocol member functions
-//
-EFI_STATUS
-EFIAPI
-GetMaximumProcessorIndex (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- OUT UINTN *MaxProcessorIndex
- )
-/*++
-
-Routine Description: This is a DebugSupport protocol member function.
-
-Arguments:
- This - The DebugSupport instance
- MaxProcessorIndex - The maximuim supported processor index
-
-Returns:
- Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-RegisterPeriodicCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_PERIODIC_CALLBACK PeriodicCallback
- )
-/*++
-
-Routine Description: This is a DebugSupport protocol member function.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- PeriodicCallback - Callback function
-
-Returns:
-
- EFI_SUCCESS
- EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
- no handler registered for it
- EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
-
- Other possible return values are passed through from UnHookEntry and HookEntry.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-RegisterExceptionCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_EXCEPTION_CALLBACK NewCallback,
- IN EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
- This is a DebugSupport protocol member function.
-
- This code executes in boot services context.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- NewCallback - Callback function
- ExceptionType - Which exception to hook
-
-Returns:
-
- EFI_SUCCESS
- EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
- no handler registered for it
- EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
-
- Other possible return values are passed through from UnHookEntry and HookEntry.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-InvalidateInstructionCache (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN VOID *Start,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
- This is a DebugSupport protocol member function.
- Calls assembly routine to flush cache.
-
-Arguments:
- This - The DebugSupport instance
- ProcessorIndex - Which processor the callback applies to.
- Start - Physical base of the memory range to be invalidated
- Length - mininum number of bytes in instruction cache to invalidate
-
-Returns:
-
- EFI_SUCCESS - always return success
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/ComponentName.c b/EdkModulePkg/Universal/Debugger/Debugport/Dxe/ComponentName.c
deleted file mode 100644
index 078bdab..0000000
--- a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/ComponentName.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- ComponentName.c
-
-Abstract:
- Component name protocol member functions for DebugPort...
-
---*/
-
-#include "DebugPort.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName = {
- DebugPortComponentNameGetDriverName,
- DebugPortComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mDebugPortDriverNameTable[] = {
- {
- "eng",
- (CHAR16 *) L"DebugPort Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-DebugPortComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gDebugPortComponentName.SupportedLanguages,
- mDebugPortDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-DebugPortComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- The debug port driver does not support GetControllerName, so this function
- is just stubbed and returns EFI_UNSUPPORTED.
-
- Arguments:
- Per EFI 1.10 driver model
-
- Returns:
- EFI_UNSUPPORTED
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.c b/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.c
deleted file mode 100644
index a15ec1c..0000000
--- a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.c
+++ /dev/null
@@ -1,812 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DebugPort.c
-
-Abstract:
-
- Top level C file for debugport driver. Contains initialization function.
- This driver layers on top of SerialIo.
-
- ALL CODE IN THE SERIALIO STACK MUST BE RE-ENTRANT AND CALLABLE FROM
- INTERRUPT CONTEXT.
-
-Revision History
-
---*/
-
-
-#include "DebugPort.h"
-
-//
-// Misc. functions local to this module..
-//
-STATIC
-VOID
-GetDebugPortVariable (
- DEBUGPORT_DEVICE *DebugPortDevice
- )
-/*++
-
-Routine Description:
- Local worker function to obtain device path information from DebugPort variable.
- Records requested settings in DebugPort device structure.
-
-Arguments:
- DEBUGPORT_DEVICE *DebugPortDevice,
-
-Returns:
-
- Nothing
-
---*/
-{
- UINTN DataSize;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_STATUS Status;
-
- DataSize = 0;
-
- Status = gRT->GetVariable (
- (CHAR16 *) EFI_DEBUGPORT_VARIABLE_NAME,
- &gEfiDebugPortVariableGuid,
- NULL,
- &DataSize,
- DebugPortDevice->DebugPortVariable
- );
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- if (gDebugPortDevice->DebugPortVariable != NULL) {
- FreePool (gDebugPortDevice->DebugPortVariable);
- }
-
- DebugPortDevice->DebugPortVariable = AllocatePool (DataSize);
- if (DebugPortDevice->DebugPortVariable != NULL) {
- gRT->GetVariable (
- (CHAR16 *) EFI_DEBUGPORT_VARIABLE_NAME,
- &gEfiDebugPortVariableGuid,
- NULL,
- &DataSize,
- DebugPortDevice->DebugPortVariable
- );
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) DebugPortDevice->DebugPortVariable;
- while (!EfiIsDevicePathEnd (DevicePath) && !EfiIsUartDevicePath (DevicePath)) {
- DevicePath = EfiNextDevicePathNode (DevicePath);
- }
-
- if (EfiIsDevicePathEnd (DevicePath)) {
- FreePool (gDebugPortDevice->DebugPortVariable);
- DebugPortDevice->DebugPortVariable = NULL;
- } else {
- CopyMem (
- &DebugPortDevice->BaudRate,
- &((UART_DEVICE_PATH *) DevicePath)->BaudRate,
- sizeof (((UART_DEVICE_PATH *) DevicePath)->BaudRate)
- );
- DebugPortDevice->ReceiveFifoDepth = DEBUGPORT_UART_DEFAULT_FIFO_DEPTH;
- DebugPortDevice->Timeout = DEBUGPORT_UART_DEFAULT_TIMEOUT;
- CopyMem (
- &DebugPortDevice->Parity,
- &((UART_DEVICE_PATH *) DevicePath)->Parity,
- sizeof (((UART_DEVICE_PATH *) DevicePath)->Parity)
- );
- CopyMem (
- &DebugPortDevice->DataBits,
- &((UART_DEVICE_PATH *) DevicePath)->DataBits,
- sizeof (((UART_DEVICE_PATH *) DevicePath)->DataBits)
- );
- CopyMem (
- &DebugPortDevice->StopBits,
- &((UART_DEVICE_PATH *) DevicePath)->StopBits,
- sizeof (((UART_DEVICE_PATH *) DevicePath)->StopBits)
- );
- }
- }
- }
-}
-
-//
-// Globals
-//
-
-EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding = {
- DebugPortSupported,
- DebugPortStart,
- DebugPortStop,
- DEBUGPORT_DRIVER_VERSION,
- NULL,
- NULL
-};
-
-DEBUGPORT_DEVICE *gDebugPortDevice;
-
-//
-// implementation code
-//
-
-EFI_STATUS
-EFIAPI
-InitializeDebugPortDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Driver entry point. Reads DebugPort variable to determine what device and settings
- to use as the debug port. Binds exclusively to SerialIo. Reverts to defaults \
- if no variable is found.
-
- Creates debugport and devicepath protocols on new handle.
-
-Arguments:
- ImageHandle,
- SystemTable
-
-Returns:
-
- EFI_UNSUPPORTED
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- //
- // Allocate and Initialize dev structure
- //
- gDebugPortDevice = AllocateZeroPool (sizeof (DEBUGPORT_DEVICE));
- if (gDebugPortDevice == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Fill in static and default pieces of device structure first.
- //
- gDebugPortDevice->Signature = DEBUGPORT_DEVICE_SIGNATURE;
-
- gDebugPortDevice->DebugPortInterface.Reset = DebugPortReset;
- gDebugPortDevice->DebugPortInterface.Read = DebugPortRead;
- gDebugPortDevice->DebugPortInterface.Write = DebugPortWrite;
- gDebugPortDevice->DebugPortInterface.Poll = DebugPortPoll;
-
- gDebugPortDevice->BaudRate = DEBUGPORT_UART_DEFAULT_BAUDRATE;
- gDebugPortDevice->ReceiveFifoDepth = DEBUGPORT_UART_DEFAULT_FIFO_DEPTH;
- gDebugPortDevice->Timeout = DEBUGPORT_UART_DEFAULT_TIMEOUT;
- gDebugPortDevice->Parity = (EFI_PARITY_TYPE) DEBUGPORT_UART_DEFAULT_PARITY;
- gDebugPortDevice->DataBits = DEBUGPORT_UART_DEFAULT_DATA_BITS;
- gDebugPortDevice->StopBits = (EFI_STOP_BITS_TYPE) DEBUGPORT_UART_DEFAULT_STOP_BITS;
-
- return EFI_SUCCESS;
-}
-//
-// DebugPort driver binding member functions...
-//
-EFI_STATUS
-EFIAPI
-DebugPortSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Checks to see that there's not already a DebugPort interface somewhere. If so,
- fail.
-
- If there's a DEBUGPORT variable, the device path must match exactly. If there's
- no DEBUGPORT variable, then device path is not checked and does not matter.
-
- Checks to see that there's a serial io interface on the controller handle
- that can be bound BY_DRIVER | EXCLUSIVE.
-
- If all these tests succeed, then we return EFI_SUCCESS, else, EFI_UNSUPPORTED
- or other error returned by OpenProtocol.
-
-Arguments:
- This
- ControllerHandle
- RemainingDevicePath
-
-Returns:
- EFI_UNSUPPORTED
- EFI_OUT_OF_RESOURCES
- EFI_SUCCESS
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *Dp1;
- EFI_DEVICE_PATH_PROTOCOL *Dp2;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- EFI_DEBUGPORT_PROTOCOL *DebugPortInterface;
- EFI_HANDLE TempHandle;
-
- //
- // Check to see that there's not a debugport protocol already published
- //
- if (gBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **) &DebugPortInterface) != EFI_NOT_FOUND) {
- return EFI_UNSUPPORTED;
- }
- //
- // Read DebugPort variable to determine debug port selection and parameters
- //
- GetDebugPortVariable (gDebugPortDevice);
-
- if (gDebugPortDevice->DebugPortVariable != NULL) {
- //
- // There's a DEBUGPORT variable, so do LocateDevicePath and check to see if
- // the closest matching handle matches the controller handle, and if it does,
- // check to see that the remaining device path has the DebugPort GUIDed messaging
- // device path only. Otherwise, it's a mismatch and EFI_UNSUPPORTED is returned.
- //
- Dp1 = DuplicateDevicePath ((EFI_DEVICE_PATH_PROTOCOL *) gDebugPortDevice->DebugPortVariable);
- if (Dp1 == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Dp2 = Dp1;
-
- Status = gBS->LocateDevicePath (
- &gEfiSerialIoProtocolGuid,
- &Dp2,
- &TempHandle
- );
-
- if (Status == EFI_SUCCESS && TempHandle != ControllerHandle) {
- Status = EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_SUCCESS && (Dp2->Type != 3 || Dp2->SubType != 10 || *((UINT16 *) Dp2->Length) != 20)) {
- Status = EFI_UNSUPPORTED;
- }
-
- if (Status == EFI_SUCCESS && CompareMem (&gEfiDebugPortDevicePathGuid, Dp2 + 1, sizeof (EFI_GUID))) {
- Status = EFI_UNSUPPORTED;
- }
-
- FreePool (Dp1);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- (VOID **) &SerialIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-DebugPortStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- Binds exclusively to serial io on the controller handle. Produces DebugPort
- protocol and DevicePath on new handle.
-
-Arguments:
- This
- ControllerHandle
- RemainingDevicePath
-
-Returns:
- EFI_OUT_OF_RESOURCES
- EFI_SUCCESS
---*/
-{
- EFI_STATUS Status;
- DEBUGPORT_DEVICE_PATH DebugPortDP;
- EFI_DEVICE_PATH_PROTOCOL EndDP;
- EFI_DEVICE_PATH_PROTOCOL *Dp1;
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- (VOID **) &gDebugPortDevice->SerialIoBinding,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gDebugPortDevice->SerialIoDeviceHandle = ControllerHandle;
-
- //
- // Initialize the Serial Io interface...
- //
- Status = gDebugPortDevice->SerialIoBinding->SetAttributes (
- gDebugPortDevice->SerialIoBinding,
- gDebugPortDevice->BaudRate,
- gDebugPortDevice->ReceiveFifoDepth,
- gDebugPortDevice->Timeout,
- gDebugPortDevice->Parity,
- gDebugPortDevice->DataBits,
- gDebugPortDevice->StopBits
- );
- if (EFI_ERROR (Status)) {
- gDebugPortDevice->BaudRate = 0;
- gDebugPortDevice->Parity = DefaultParity;
- gDebugPortDevice->DataBits = 0;
- gDebugPortDevice->StopBits = DefaultStopBits;
- gDebugPortDevice->ReceiveFifoDepth = 0;
- Status = gDebugPortDevice->SerialIoBinding->SetAttributes (
- gDebugPortDevice->SerialIoBinding,
- gDebugPortDevice->BaudRate,
- gDebugPortDevice->ReceiveFifoDepth,
- gDebugPortDevice->Timeout,
- gDebugPortDevice->Parity,
- gDebugPortDevice->DataBits,
- gDebugPortDevice->StopBits
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
- }
- }
-
- gDebugPortDevice->SerialIoBinding->Reset (gDebugPortDevice->SerialIoBinding);
-
- //
- // Create device path instance for DebugPort
- //
- DebugPortDP.Header.Type = MESSAGING_DEVICE_PATH;
- DebugPortDP.Header.SubType = MSG_VENDOR_DP;
- SetDevicePathNodeLength (&(DebugPortDP.Header), sizeof (DebugPortDP));
- CopyMem (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid, sizeof (EFI_GUID));
-
- Dp1 = DevicePathFromHandle (ControllerHandle);
- if (Dp1 == NULL) {
- Dp1 = &EndDP;
- SetDevicePathEndNode (Dp1);
- }
-
- gDebugPortDevice->DebugPortDevicePath = AppendDevicePathNode (Dp1, (EFI_DEVICE_PATH_PROTOCOL *) &DebugPortDP);
- if (gDebugPortDevice->DebugPortDevicePath == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Publish DebugPort and Device Path protocols
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &gDebugPortDevice->DebugPortDeviceHandle,
- &gEfiDevicePathProtocolGuid,
- gDebugPortDevice->DebugPortDevicePath,
- &gEfiDebugPortProtocolGuid,
- &gDebugPortDevice->DebugPortInterface,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
- }
- //
- // Connect debugport child to serial io
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- (VOID **) &gDebugPortDevice->SerialIoBinding,
- This->DriverBindingHandle,
- gDebugPortDevice->DebugPortDeviceHandle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG_CODE_BEGIN ();
- UINTN BufferSize;
-
- BufferSize = 48;
- DebugPortWrite (
- &gDebugPortDevice->DebugPortInterface,
- 0,
- &BufferSize,
- "DebugPort driver failed to open child controller\n\n"
- );
- DEBUG_CODE_END ();
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
- }
-
- DEBUG_CODE_BEGIN ();
- UINTN BufferSize;
-
- BufferSize = 38;
- DebugPortWrite (
- &gDebugPortDevice->DebugPortInterface,
- 0,
- &BufferSize,
- "Hello World from the DebugPort driver\n\n"
- );
- DEBUG_CODE_END ();
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-DebugPortStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
- We're never intending to be stopped via the driver model so this just returns
- EFI_UNSUPPORTED
-
-Arguments:
- Per EFI 1.10 driver model
-
-Returns:
- EFI_UNSUPPORTED
- EFI_SUCCESS
-
---*/
-{
- EFI_STATUS Status;
-
- if (NumberOfChildren == 0) {
- //
- // Close the bus driver
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- gDebugPortDevice->SerialIoBinding = NULL;
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- FreePool (gDebugPortDevice->DebugPortDevicePath);
-
- return EFI_SUCCESS;
- } else {
- //
- // Disconnect SerialIo child handle
- //
- Status = gBS->CloseProtocol (
- gDebugPortDevice->SerialIoDeviceHandle,
- &gEfiSerialIoProtocolGuid,
- This->DriverBindingHandle,
- gDebugPortDevice->DebugPortDeviceHandle
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Unpublish our protocols (DevicePath, DebugPort)
- //
- Status = gBS->UninstallMultipleProtocolInterfaces (
- gDebugPortDevice->DebugPortDeviceHandle,
- &gEfiDevicePathProtocolGuid,
- gDebugPortDevice->DebugPortDevicePath,
- &gEfiDebugPortProtocolGuid,
- &gDebugPortDevice->DebugPortInterface,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- ControllerHandle,
- &gEfiSerialIoProtocolGuid,
- (VOID **) &gDebugPortDevice->SerialIoBinding,
- This->DriverBindingHandle,
- gDebugPortDevice->DebugPortDeviceHandle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- gDebugPortDevice->DebugPortDeviceHandle = NULL;
- }
- }
-
- return Status;
-}
-//
-// Debugport protocol member functions
-//
-EFI_STATUS
-EFIAPI
-DebugPortReset (
- IN EFI_DEBUGPORT_PROTOCOL *This
- )
-/*++
-
-Routine Description:
- DebugPort protocol member function. Calls SerialIo:GetControl to flush buffer.
- We cannot call SerialIo:SetAttributes because it uses pool services, which use
- locks, which affect TPL, so it's not interrupt context safe or re-entrant.
- SerialIo:Reset() calls SetAttributes, so it can't be used either.
-
- The port itself should be fine since it was set up during initialization.
-
-Arguments:
- This
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- UINTN BufferSize;
- UINTN BitBucket;
-
- while (This->Poll (This) == EFI_SUCCESS) {
- BufferSize = 1;
- This->Read (This, 0, &BufferSize, &BitBucket);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-DebugPortRead (
- IN EFI_DEBUGPORT_PROTOCOL *This,
- IN UINT32 Timeout,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
- DebugPort protocol member function. Calls SerialIo:Read() after setting
- if it's different than the last SerialIo access.
-
-Arguments:
- IN EFI_DEBUGPORT_PROTOCOL *This
- IN UINT32 Timeout,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- DEBUGPORT_DEVICE *DebugPortDevice;
- UINTN LocalBufferSize;
- EFI_STATUS Status;
- UINT8 *BufferPtr;
-
- DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This);
- BufferPtr = Buffer;
- LocalBufferSize = *BufferSize;
- do {
- Status = DebugPortDevice->SerialIoBinding->Read (
- DebugPortDevice->SerialIoBinding,
- &LocalBufferSize,
- BufferPtr
- );
- if (Status == EFI_TIMEOUT) {
- if (Timeout > DEBUGPORT_UART_DEFAULT_TIMEOUT) {
- Timeout -= DEBUGPORT_UART_DEFAULT_TIMEOUT;
- } else {
- Timeout = 0;
- }
- } else if (EFI_ERROR (Status)) {
- break;
- }
-
- BufferPtr += LocalBufferSize;
- LocalBufferSize = *BufferSize - (BufferPtr - (UINT8 *) Buffer);
- } while (LocalBufferSize != 0 && Timeout > 0);
-
- *BufferSize = (UINTN) (BufferPtr - (UINT8 *) Buffer);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-DebugPortWrite (
- IN EFI_DEBUGPORT_PROTOCOL *This,
- IN UINT32 Timeout,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
- DebugPort protocol member function. Calls SerialIo:Write() Writes 8 bytes at
- a time and does a GetControl between 8 byte writes to help insure reads are
- interspersed This is poor-man's flow control..
-
-Arguments:
- This - Pointer to DebugPort protocol
- Timeout - Timeout value
- BufferSize - On input, the size of Buffer.
- On output, the amount of data actually written.
- Buffer - Pointer to buffer to write
-
-Returns:
- EFI_SUCCESS - The data was written.
- EFI_DEVICE_ERROR - The device reported an error.
- EFI_TIMEOUT - The data write was stopped due to a timeout.
-
---*/
-{
- DEBUGPORT_DEVICE *DebugPortDevice;
- UINTN Position;
- UINTN WriteSize;
- EFI_STATUS Status;
- UINT32 SerialControl;
-
- Status = EFI_SUCCESS;
- DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This);
-
- WriteSize = 8;
- for (Position = 0; Position < *BufferSize && !EFI_ERROR (Status); Position += WriteSize) {
- DebugPortDevice->SerialIoBinding->GetControl (
- DebugPortDevice->SerialIoBinding,
- &SerialControl
- );
- if (*BufferSize - Position < 8) {
- WriteSize = *BufferSize - Position;
- }
-
- Status = DebugPortDevice->SerialIoBinding->Write (
- DebugPortDevice->SerialIoBinding,
- &WriteSize,
- &((UINT8 *) Buffer)[Position]
- );
- }
-
- *BufferSize = Position;
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-DebugPortPoll (
- IN EFI_DEBUGPORT_PROTOCOL *This
- )
-/*++
-
-Routine Description:
- DebugPort protocol member function. Calls SerialIo:Write() after setting
- if it's different than the last SerialIo access.
-
-Arguments:
- IN EFI_DEBUGPORT_PROTOCOL *This
-
-Returns:
- EFI_SUCCESS - At least 1 character is ready to be read from the DebugPort interface
- EFI_NOT_READY - There are no characters ready to read from the DebugPort interface
- EFI_DEVICE_ERROR - A hardware failure occured... (from SerialIo)
-
---*/
-{
- EFI_STATUS Status;
- UINT32 SerialControl;
- DEBUGPORT_DEVICE *DebugPortDevice;
-
- DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This);
-
- Status = DebugPortDevice->SerialIoBinding->GetControl (
- DebugPortDevice->SerialIoBinding,
- &SerialControl
- );
-
- if (!EFI_ERROR (Status)) {
- if (SerialControl & EFI_SERIAL_INPUT_BUFFER_EMPTY) {
- Status = EFI_NOT_READY;
- } else {
- Status = EFI_SUCCESS;
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-ImageUnloadHandler (
- EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
- Unload function that is registered in the LoadImage protocol. It un-installs
- protocols produced and deallocates pool used by the driver. Called by the core
- when unloading the driver.
-
-Arguments:
- EFI_HANDLE ImageHandle
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- EFI_STATUS Status;
-
- if (gDebugPortDevice->SerialIoBinding != NULL) {
- return EFI_ABORTED;
- }
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ImageHandle,
- &gEfiDriverBindingProtocolGuid,
- &gDebugPortDevice->DriverBindingInterface,
- &gEfiComponentNameProtocolGuid,
- &gDebugPortDevice->ComponentNameInterface,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Clean up allocations
- //
- if (gDebugPortDevice->DebugPortVariable != NULL) {
- FreePool (gDebugPortDevice->DebugPortVariable);
- }
-
- FreePool (gDebugPortDevice);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.dxs b/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.dxs
deleted file mode 100644
index 06ed25e..0000000
--- a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.dxs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DebugPort.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.h b/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.h
deleted file mode 100644
index bb486c3..0000000
--- a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- DebugPort.h
-
-Abstract:
- Definitions and prototypes for DebugPort driver
-
---*/
-
-#ifndef __DEBUGPORT_H__
-#define __DEBUGPORT_H__
-
-
-//
-// local type definitions
-//
-#define DEBUGPORT_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('D', 'B', 'G', 'P')
-
-//
-// Device structure used by driver
-//
-typedef struct {
- UINT32 Signature;
- EFI_HANDLE DriverBindingHandle;
- EFI_HANDLE DebugPortDeviceHandle;
- VOID *DebugPortVariable;
-
- EFI_DRIVER_BINDING_PROTOCOL DriverBindingInterface;
- EFI_COMPONENT_NAME_PROTOCOL ComponentNameInterface;
- EFI_DEVICE_PATH_PROTOCOL *DebugPortDevicePath;
- EFI_DEBUGPORT_PROTOCOL DebugPortInterface;
-
- EFI_HANDLE SerialIoDeviceHandle;
- EFI_SERIAL_IO_PROTOCOL *SerialIoBinding;
- UINT64 BaudRate;
- UINT32 ReceiveFifoDepth;
- UINT32 Timeout;
- EFI_PARITY_TYPE Parity;
- UINT8 DataBits;
- EFI_STOP_BITS_TYPE StopBits;
-} DEBUGPORT_DEVICE;
-
-#define DEBUGPORT_DEVICE_FROM_THIS(a) CR (a, DEBUGPORT_DEVICE, DebugPortInterface, DEBUGPORT_DEVICE_SIGNATURE)
-
-#define EFI_ACPI_PC_COMPORT_HID EISA_PNP_ID (0x0500)
-#define EFI_ACPI_16550UART_HID EISA_PNP_ID (0x0501)
-
-#define DEBUGPORT_UART_DEFAULT_BAUDRATE 115200
-#define DEBUGPORT_UART_DEFAULT_PARITY 0
-#define DEBUGPORT_UART_DEFAULT_FIFO_DEPTH 16
-#define DEBUGPORT_UART_DEFAULT_TIMEOUT 50000 // 5 ms
-#define DEBUGPORT_UART_DEFAULT_DATA_BITS 8
-#define DEBUGPORT_UART_DEFAULT_STOP_BITS 1
-
-#define DEBUGPORT_DRIVER_VERSION 1
-
-#define EfiIsUartDevicePath(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP)
-
-//
-// globals
-//
-extern DEBUGPORT_DEVICE *gDebugPortDevice;
-
-//
-// Driver binding interface functions...
-//
-EFI_STATUS
-DebugPortEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-EFI_STATUS
-EFIAPI
-DebugPortSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-EFI_STATUS
-EFIAPI
-DebugPortStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-;
-
-EFI_STATUS
-EFIAPI
-DebugPortStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-;
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-DebugPortComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-;
-
-EFI_STATUS
-EFIAPI
-DebugPortComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-;
-
-//
-// DebugPort member functions
-//
-EFI_STATUS
-EFIAPI
-DebugPortReset (
- IN EFI_DEBUGPORT_PROTOCOL *This
- )
-;
-
-EFI_STATUS
-EFIAPI
-DebugPortRead (
- IN EFI_DEBUGPORT_PROTOCOL *This,
- IN UINT32 Timeout,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-DebugPortWrite (
- IN EFI_DEBUGPORT_PROTOCOL *This,
- IN UINT32 Timeout,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-DebugPortPoll (
- IN EFI_DEBUGPORT_PROTOCOL *This
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.msa b/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.msa
deleted file mode 100644
index 1aaeb64..0000000
--- a/EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.msa
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DebugPort</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>73E9457A-CEA1-4917-9A9C-9F1F0F0FD322</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for DebugPort module.</Abstract>
- <Description>This driver binds exclusively to serial io on the controller handle,
- and initializes serial Io interface, publishs DebugPort and device path Protocol.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DebugPort</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DebugPort.h</Filename>
- <Filename>DebugPort.c</Filename>
- <Filename>ComponentName.c</Filename>
- <Filename>DebugPort.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiDebugPortProtocolGuid</ProtocolCName>
- <HelpText>gEfiDebugPortVariableGuid, gEfiDebugPortDevicePathGuid are
- both the alias of gEfiDebugPortProtocolGuid. They are not separate guid variables,
- which are not required to be described in the followin Guids section.</HelpText>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiComponentNameProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDriverBindingProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Variables>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x0044 0x0045 0x0042 0x0055 0x0047 0x0050 0x004F 0x0052 0x0054</VariableName>
- <GuidC_Name>gEfiDebugPortProtocolGuid</GuidC_Name>
- <HelpText>L"DEBUGPORT" variable is specified. gEfiDebugPortVariableGuid is
- one virtual guid, which can't be described in this section.
- So gEfiDebugPortProtocolGuid name is instead of it.</HelpText>
- </Variable>
- </Variables>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>InitializeDebugPortDriver</ModuleEntryPoint>
- </Extern>
- <Extern>
- <ModuleUnloadImage>ImageUnloadHandler</ModuleUnloadImage>
- </Extern>
- <Extern>
- <DriverBinding>gDebugPortDriverBinding</DriverBinding>
- <ComponentName>gDebugPortComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c
deleted file mode 100644
index 8aff74d..0000000
--- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DevicePathDriver.c
-
-Abstract:
-
- Device Path Driver to produce DevPathUtilities Protocol, DevPathFromText Protocol
- and DevPathToText Protocol.
-
---*/
-
-#include "DevicePath.h"
-
-EFI_HANDLE mDevicePathHandle = NULL;
-
-GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {
- GetDevicePathSizeProtocolInterface,
- DuplicateDevicePathProtocolInterface,
- AppendDevicePathProtocolInterface,
- AppendDeviceNodeProtocolInterface,
- AppendDevicePathInstanceProtocolInterface,
- GetNextDevicePathInstanceProtocolInterface,
- IsDevicePathMultiInstanceProtocolInterface,
- CreateDeviceNodeProtocolInterface
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {
- ConvertDeviceNodeToText,
- ConvertDevicePathToText
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {
- ConvertTextToDeviceNode,
- ConvertTextToDevicePath
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL;
-GLOBAL_REMOVE_IF_UNREFERENCED const EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS;
-
-EFI_STATUS
-EFIAPI
-DevicePathEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
- Routine Description:
- Entry point for EFI drivers.
-
- Arguments:
- ImageHandle - EFI_HANDLE
- SystemTable - EFI_SYSTEM_TABLE
-
- Returns:
- EFI_SUCCESS
- others
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EFI_UNSUPPORTED;
- if (FeaturePcdGet (PcdDevicePathSupportDevicePathToText)) {
- if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mDevicePathHandle,
- &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
- &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
- &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mDevicePathHandle,
- &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
- &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
- NULL
- );
- }
- } else {
- if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mDevicePathHandle,
- &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
- &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
- NULL
- );
- } else {
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mDevicePathHandle,
- &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
- NULL
- );
- }
- }
- return Status;
-}
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h
deleted file mode 100644
index d7311aa..0000000
--- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h
+++ /dev/null
@@ -1,407 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DevicePath.h
-
-Abstract:
- Definition for Device Path Utilities driver
-
---*/
-
-#ifndef _DEVICE_PATH_DRIVER_H
-#define _DEVICE_PATH_DRIVER_H
-
-extern const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;
-extern const EFI_GUID mEfiDevicePathMessagingSASGuid;
-
-#define MAX_CHAR 480
-
-#define MIN_ALIGNMENT_SIZE sizeof(UINTN)
-#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
-
-#define IS_COMMA(a) ((a) == L',')
-#define IS_HYPHEN(a) ((a) == L'-')
-#define IS_DOT(a) ((a) == L'.')
-#define IS_LEFT_PARENTH(a) ((a) == L'(')
-#define IS_RIGHT_PARENTH(a) ((a) == L')')
-#define IS_SLASH(a) ((a) == L'/')
-#define IS_NULL(a) ((a) == L'\0')
-
-#define DEVICE_NODE_END 1
-#define DEVICE_PATH_INSTANCE_END 2
-#define DEVICE_PATH_END 3
-
-#define SetDevicePathInstanceEndNode(a) { \
- (a)->Type = END_DEVICE_PATH_TYPE; \
- (a)->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; \
- (a)->Length[0] = sizeof (EFI_DEVICE_PATH_PROTOCOL); \
- (a)->Length[1] = 0; \
- }
-
-//
-// Private Data structure
-//
-typedef struct {
- CHAR16 *Str;
- UINTN Len;
- UINTN MaxLen;
-} POOL_PRINT;
-
-typedef struct {
- UINT8 Type;
- UINT8 SubType;
- VOID (*Function) (POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);
-} DEVICE_PATH_TO_TEXT_TABLE;
-
-typedef struct {
- CHAR16 *DevicePathNodeText;
- EFI_DEVICE_PATH_PROTOCOL * (*Function) (CHAR16 *);
-} DEVICE_PATH_FROM_TEXT_TABLE;
-
-typedef struct {
- BOOLEAN ClassExist;
- UINT8 Class;
- BOOLEAN SubClassExist;
- UINT8 SubClass;
-} USB_CLASS_TEXT;
-
-#define USB_CLASS_AUDIO 1
-#define USB_CLASS_CDCCONTROL 2
-#define USB_CLASS_HID 3
-#define USB_CLASS_IMAGE 6
-#define USB_CLASS_PRINTER 7
-#define USB_CLASS_MASS_STORAGE 8
-#define USB_CLASS_HUB 9
-#define USB_CLASS_CDCDATA 10
-#define USB_CLASS_SMART_CARD 11
-#define USB_CLASS_VIDEO 14
-#define USB_CLASS_DIAGNOSTIC 220
-#define USB_CLASS_WIRELESS 224
-
-#define USB_CLASS_RESERVE 254
-#define USB_SUBCLASS_FW_UPDATE 1
-#define USB_SUBCLASS_IRDA_BRIDGE 2
-#define USB_SUBCLASS_TEST 3
-
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
- UINT8 VendorDefinedData[1];
-} VENDOR_DEFINED_HARDWARE_DEVICE_PATH;
-
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
- UINT8 VendorDefinedData[1];
-} VENDOR_DEFINED_MESSAGING_DEVICE_PATH;
-
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
- UINT8 VendorDefinedData[1];
-} VENDOR_DEFINED_MEDIA_DEVICE_PATH;
-
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT32 HID;
- UINT32 UID;
- UINT32 CID;
- CHAR8 HidUidCidStr[3];
-} ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR;
-
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- UINT16 NetworkProtocol;
- UINT16 LoginOption;
- UINT16 Reserved;
- UINT16 TargetPortalGroupTag;
- UINT64 Lun;
- CHAR16 iSCSITargetName[1];
-} ISCSI_DEVICE_PATH_WITH_NAME;
-
-typedef struct {
- EFI_DEVICE_PATH_PROTOCOL Header;
- EFI_GUID Guid;
- UINT8 VendorDefinedData[1];
-} VENDOR_DEVICE_PATH_WITH_DATA;
-
-CHAR16 *
-ConvertDeviceNodeToText (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-/*++
-
- Routine Description:
- Convert a device node to its text representation.
-
- Arguments:
- DeviceNode - Points to the device node to be converted.
- DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
- of the display node is used, where applicable. If DisplayOnly
- is FALSE, then the longer text representation of the display node
- is used.
- AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
- representation for a device node can be used, where applicable.
-
- Returns:
- A pointer - a pointer to the allocated text representation of the device node.
- NULL - if DeviceNode is NULL or there was insufficient memory.
-
---*/
-;
-
-CHAR16 *
-ConvertDevicePathToText (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-/*++
-
- Routine Description:
- Convert a device path to its text representation.
-
- Arguments:
- DeviceNode - Points to the device path to be converted.
- DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
- of the display node is used, where applicable. If DisplayOnly
- is FALSE, then the longer text representation of the display node
- is used.
- AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
- representation for a device node can be used, where applicable.
-
- Returns:
- A pointer - a pointer to the allocated text representation of the device path.
- NULL - if DeviceNode is NULL or there was insufficient memory.
-
---*/
-;
-
-EFI_DEVICE_PATH_PROTOCOL *
-ConvertTextToDeviceNode (
- IN CONST CHAR16 *TextDeviceNode
- )
-/*++
-
- Routine Description:
- Convert text to the binary representation of a device node.
-
- Arguments:
- TextDeviceNode - TextDeviceNode points to the text representation of a device
- node. Conversion starts with the first character and continues
- until the first non-device node character.
-
- Returns:
- A pointer - Pointer to the EFI device node.
- NULL - if TextDeviceNode is NULL or there was insufficient memory.
-
---*/
-;
-
-EFI_DEVICE_PATH_PROTOCOL *
-ConvertTextToDevicePath (
- IN CONST CHAR16 *TextDevicePath
- )
-/*++
-
- Routine Description:
- Convert text to the binary representation of a device path.
-
- Arguments:
- TextDevicePath - TextDevicePath points to the text representation of a device
- path. Conversion starts with the first character and continues
- until the first non-device node character.
-
- Returns:
- A pointer - Pointer to the allocated device path.
- NULL - if TextDeviceNode is NULL or there was insufficient memory.
-
---*/
-;
-
-UINTN
-GetDevicePathSizeProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
- Routine Description:
- Returns the size of the device path, in bytes.
-
- Arguments:
- DevicePath - Points to the start of the EFI device path.
-
- Returns:
- Size - Size of the specified device path, in bytes, including the end-of-path tag.
-
---*/
-;
-
-EFI_DEVICE_PATH_PROTOCOL *
-DuplicateDevicePathProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
- Routine Description:
- Create a duplicate of the specified path.
-
- Arguments:
- DevicePath - Points to the source EFI device path.
-
- Returns:
- Pointer - A pointer to the duplicate device path.
- NULL - Insufficient memory.
-
---*/
-;
-
-EFI_DEVICE_PATH_PROTOCOL *
-AppendDevicePathProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2
- )
-/*++
-
- Routine Description:
- Create a new path by appending the second device path to the first.
-
- Arguments:
- Src1 - Points to the first device path. If NULL, then it is ignored.
- Src2 - Points to the second device path. If NULL, then it is ignored.
-
- Returns:
- Pointer - A pointer to the newly created device path.
- NULL - Memory could not be allocated
- or either DevicePath or DeviceNode is NULL.
-
---*/
-;
-
-EFI_DEVICE_PATH_PROTOCOL *
-AppendDeviceNodeProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
- )
-/*++
-
- Routine Description:
- Creates a new path by appending the device node to the device path.
-
- Arguments:
- DevicePath - Points to the device path.
- DeviceNode - Points to the device node.
-
- Returns:
- Pointer - A pointer to the allocated device node.
- NULL - Memory could not be allocated
- or either DevicePath or DeviceNode is NULL.
-
---*/
-;
-
-EFI_DEVICE_PATH_PROTOCOL *
-AppendDevicePathInstanceProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
- )
-/*++
-
- Routine Description:
- Creates a new path by appending the specified device path instance to the specified device path.
-
- Arguments:
- DevicePath - Points to the device path. If NULL, then ignored.
- DevicePathInstance - Points to the device path instance.
-
- Returns:
- Pointer - A pointer to the newly created device path
- NULL - Memory could not be allocated or DevicePathInstance is NULL.
-
---*/
-;
-
-EFI_DEVICE_PATH_PROTOCOL *
-GetNextDevicePathInstanceProtocolInterface (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
- OUT UINTN *DevicePathInstanceSize
- )
-/*++
-
- Routine Description:
- Creates a copy of the current device path instance and returns a pointer to the next device path instance.
-
- Arguments:
- DevicePathInstance - On input, this holds the pointer to the current device path
- instance. On output, this holds the pointer to the next
- device path instance or NULL if there are no more device
- path instances in the device path.
- DevicePathInstanceSize - On output, this holds the size of the device path instance,
- in bytes or zero, if DevicePathInstance is zero.
-
- Returns:
- Pointer - A pointer to the copy of the current device path instance.
- NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
-
---*/
-;
-
-BOOLEAN
-IsDevicePathMultiInstanceProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
- Routine Description:
- Returns whether a device path is multi-instance.
-
- Arguments:
- DevicePath - Points to the device path. If NULL, then ignored.
-
- Returns:
- TRUE - The device path has more than one instance
- FALSE - The device path is empty or contains only a single instance.
-
---*/
-;
-
-EFI_DEVICE_PATH_PROTOCOL *
-CreateDeviceNodeProtocolInterface (
- IN UINT8 NodeType,
- IN UINT8 NodeSubType,
- IN UINT16 NodeLength
- )
-/*++
-
- Routine Description:
- Creates a device node
-
- Arguments:
- NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
- the new device node.
- NodeSubType - NodeSubType is the device node sub-type
- EFI_DEVICE_PATH.SubType) for the new device node.
- NodeLength - NodeLength is the length of the device node
- (EFI_DEVICE_PATH.Length) for the new device node.
-
- Returns:
- Pointer - A pointer to the newly created device node.
- NULL - NodeLength is less than
- the size of the header or there was insufficient memory.
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa
deleted file mode 100644
index bd08280..0000000
--- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DevicePath</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>9B680FCE-AD6B-4F3A-B60B-F59899003443</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Device Path Driver.</Abstract>
- <Description>This driver implement these three UEFI deveice path protocols (
- DevicePathUtilities, DevicePahtToText and DevicePathFromText) and install them.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DevicePath</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3">
- <Keyword>PrintLib</Keyword>
- <HelpText>Recommended libary Instance is BasePrintLib instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0">
- <Keyword>DevicePathLib</Keyword>
- <HelpText>Recommended libary Instance is UefiDevicePathLib instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DevicePath.c</Filename>
- <Filename>DevicePath.h</Filename>
- <Filename>DevicePathFromText.c</Filename>
- <Filename>DevicePathToText.c</Filename>
- <Filename>DevicePathUtilities.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDebugPortProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiDevicePathUtilitiesProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiDevicePathFromTextProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiDevicePathToTextProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiPcAnsiGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiVT100PlusGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiVT100Guid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiVTUTF8Guid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00090000</Specification>
- <Extern>
- <ModuleEntryPoint>DevicePathEntryPoint</ModuleEntryPoint>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_PRODUCED">
- <C_Name>PcdDevicePathSupportDevicePathToText</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>If TRUE, then the Device Path To Text Protocol should be produced by the platform</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_PRODUCED">
- <C_Name>PcdDevicePathSupportDevicePathFromText</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>If TRUE, then the Device Path From Text Protocol should be produced by the platform</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c
deleted file mode 100644
index 94a4a2b..0000000
--- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c
+++ /dev/null
@@ -1,2370 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DevicePathFromText.c
-
-Abstract:
-
- DevicePathFromText protocol as defined in the UEFI 2.0 specification.
-
---*/
-
-#include "DevicePath.h"
-
-STATIC
-CHAR16 *
-StrDuplicate (
- IN CONST CHAR16 *Src
- )
-/*++
-
- Routine Description:
- Duplicate a string
-
- Arguments:
- Src - Source string
-
- Returns:
- Duplicated string
-
---*/
-{
- UINTN Length;
- CHAR16 *ReturnStr;
-
- Length = StrLen ((CHAR16 *) Src);
-
- ReturnStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), (VOID *) Src);
-
- return ReturnStr;
-}
-
-STATIC
-CHAR16 *
-GetParamByNodeName (
- IN CHAR16 *Str,
- IN CHAR16 *NodeName
- )
-/*++
-
- Routine Description:
- Get parameter in a pair of parentheses follow the given node name.
- For example, given the "Pci(0,1)" and NodeName "Pci", it returns "0,1".
-
- Arguments:
- Str - Device Path Text
- NodeName - Name of the node
-
- Returns:
- Parameter text for the node
-
---*/
-{
- CHAR16 *ParamStr;
- CHAR16 *StrPointer;
- UINTN NodeNameLength;
- UINTN ParameterLength;
-
- //
- // Check whether the node name matchs
- //
- NodeNameLength = StrLen (NodeName);
- if (CompareMem (Str, NodeName, NodeNameLength * sizeof (CHAR16)) != 0) {
- return NULL;
- }
-
- ParamStr = Str + NodeNameLength;
- if (!IS_LEFT_PARENTH (*ParamStr)) {
- return NULL;
- }
-
- //
- // Skip the found '(' and find first occurrence of ')'
- //
- ParamStr++;
- ParameterLength = 0;
- StrPointer = ParamStr;
- while (!IS_NULL (*StrPointer)) {
- if (IS_RIGHT_PARENTH (*StrPointer)) {
- break;
- }
- StrPointer++;
- ParameterLength++;
- }
- if (IS_NULL (*StrPointer)) {
- //
- // ')' not found
- //
- return NULL;
- }
-
- ParamStr = AllocateCopyPool ((ParameterLength + 1) * sizeof (CHAR16), ParamStr);
- if (ParamStr == NULL) {
- return NULL;
- }
- //
- // Terminate the parameter string
- //
- ParamStr[ParameterLength] = L'\0';
-
- return ParamStr;
-}
-
-STATIC
-CHAR16 *
-SplitStr (
- IN OUT CHAR16 **List,
- IN CHAR16 Separator
- )
-/*++
-
- Routine Description:
- Get current sub-string from a string list, before return
- the list header is moved to next sub-string. The sub-string is separated
- by the specified character. For example, the separator is ',', the string
- list is "2,0,3", it returns "2", the remain list move to "2,3"
-
- Arguments:
- List - A string list separated by the specified separator
- Separator - The separator character
-
- Returns:
- pointer - The current sub-string
-
---*/
-{
- CHAR16 *Str;
- CHAR16 *ReturnStr;
-
- Str = *List;
- ReturnStr = Str;
-
- if (IS_NULL (*Str)) {
- return ReturnStr;
- }
-
- //
- // Find first occurrence of the separator
- //
- while (!IS_NULL (*Str)) {
- if (*Str == Separator) {
- break;
- }
- Str++;
- }
-
- if (*Str == Separator) {
- //
- // Find a sub-string, terminate it
- //
- *Str = L'\0';
- Str++;
- }
-
- //
- // Move to next sub-string
- //
- *List = Str;
-
- return ReturnStr;
-}
-
-STATIC
-CHAR16 *
-GetNextParamStr (
- IN OUT CHAR16 **List
- )
-{
- //
- // The separator is comma
- //
- return SplitStr (List, L',');
-}
-
-STATIC
-CHAR16 *
-GetNextDeviceNodeStr (
- IN OUT CHAR16 **DevicePath,
- OUT BOOLEAN *IsInstanceEnd
- )
-/*++
-
- Routine Description:
- Get one device node from entire device path text.
-
- Arguments:
- Str - The entire device path text string
- IsInstanceEnd - This node is the end of a device path instance
-
- Returns:
- a pointer - A device node text
- NULL - No more device node available
-
---*/
-{
- CHAR16 *Str;
- CHAR16 *ReturnStr;
- UINTN ParenthesesStack;
-
- Str = *DevicePath;
- if (IS_NULL (*Str)) {
- return NULL;
- }
-
- //
- // Skip the leading '/', '(', ')' and ','
- //
- while (!IS_NULL (*Str)) {
- if (!IS_SLASH (*Str) &&
- !IS_COMMA (*Str) &&
- !IS_LEFT_PARENTH (*Str) &&
- !IS_RIGHT_PARENTH (*Str)) {
- break;
- }
- Str++;
- }
-
- ReturnStr = Str;
-
- //
- // Scan for the separator of this device node, '/' or ','
- //
- ParenthesesStack = 0;
- while (!IS_NULL (*Str)) {
- if ((IS_COMMA (*Str) || IS_SLASH (*Str)) && (ParenthesesStack == 0)) {
- break;
- }
-
- if (IS_LEFT_PARENTH (*Str)) {
- ParenthesesStack++;
- } else if (IS_RIGHT_PARENTH (*Str)) {
- ParenthesesStack--;
- }
-
- Str++;
- }
-
- if (ParenthesesStack != 0) {
- //
- // The '(' doesn't pair with ')', invalid device path text
- //
- return NULL;
- }
-
- if (IS_COMMA (*Str)) {
- *IsInstanceEnd = TRUE;
- *Str = L'\0';
- Str++;
- } else {
- *IsInstanceEnd = FALSE;
- if (!IS_NULL (*Str)) {
- *Str = L'\0';
- Str++;
- }
- }
-
- *DevicePath = Str;
-
- return ReturnStr;
-}
-
-STATIC
-BOOLEAN
-IsHexDigit (
- OUT UINT8 *Digit,
- IN CHAR16 Char
- )
-/*++
-
- Routine Description:
- Determines if a Unicode character is a hexadecimal digit.
- The test is case insensitive.
-
- Arguments:
- Digit - Pointer to byte that receives the value of the hex character.
- Char - Unicode character to test.
-
- Returns:
- TRUE - If the character is a hexadecimal digit.
- FALSE - Otherwise.
-
---*/
-{
- if ((Char >= L'0') && (Char <= L'9')) {
- *Digit = (UINT8) (Char - L'0');
- return TRUE;
- }
-
- if ((Char >= L'A') && (Char <= L'F')) {
- *Digit = (UINT8) (Char - L'A' + 0x0A);
- return TRUE;
- }
-
- if ((Char >= L'a') && (Char <= L'f')) {
- *Digit = (UINT8) (Char - L'a' + 0x0A);
- return TRUE;
- }
-
- return FALSE;
-}
-
-STATIC
-EFI_STATUS
-HexStringToBuf (
- IN OUT UINT8 *Buf,
- IN OUT UINTN *Len,
- IN CHAR16 *Str,
- OUT UINTN *ConvertedStrLen OPTIONAL
- )
-/*++
-
- Routine Description:
- Converts Unicode string to binary buffer.
- The conversion may be partial.
- The first character in the string that is not hex digit stops the conversion.
- At a minimum, any blob of data could be represented as a hex string.
-
- Arguments:
- Buf - Pointer to buffer that receives the data.
- Len - Length in bytes of the buffer to hold converted data.
- If routine return with EFI_SUCCESS, containing length of converted data.
- If routine return with EFI_BUFFER_TOO_SMALL, containg length of buffer desired.
- Str - String to be converted from.
- ConvertedStrLen - Length of the Hex String consumed.
-
- Returns:
- EFI_SUCCESS: Routine Success.
- EFI_BUFFER_TOO_SMALL: The buffer is too small to hold converted data.
- EFI_
-
---*/
-{
- UINTN HexCnt;
- UINTN Idx;
- UINTN BufferLength;
- UINT8 Digit;
- UINT8 Byte;
-
- //
- // Find out how many hex characters the string has.
- //
- for (Idx = 0, HexCnt = 0; IsHexDigit (&Digit, Str[Idx]); Idx++, HexCnt++);
-
- if (HexCnt == 0) {
- *Len = 0;
- return EFI_SUCCESS;
- }
- //
- // Two Unicode characters make up 1 buffer byte. Round up.
- //
- BufferLength = (HexCnt + 1) / 2;
-
- //
- // Test if buffer is passed enough.
- //
- if (BufferLength > (*Len)) {
- *Len = BufferLength;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- *Len = BufferLength;
-
- for (Idx = 0; Idx < HexCnt; Idx++) {
-
- IsHexDigit (&Digit, Str[HexCnt - 1 - Idx]);
-
- //
- // For odd charaters, write the lower nibble for each buffer byte,
- // and for even characters, the upper nibble.
- //
- if ((Idx & 1) == 0) {
- Byte = Digit;
- } else {
- Byte = Buf[Idx / 2];
- Byte &= 0x0F;
- Byte = (UINT8) (Byte | Digit << 4);
- }
-
- Buf[Idx / 2] = Byte;
- }
-
- if (ConvertedStrLen != NULL) {
- *ConvertedStrLen = HexCnt;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-CHAR16 *
-TrimHexStr (
- IN CHAR16 *Str
- )
-/*++
-
- Routine Description:
- Skip the leading white space and '0x' or '0X' of a hex string
-
- Arguments:
- Str - The hex string
-
- Returns:
-
---*/
-{
- //
- // skip preceeding white space
- //
- while (*Str && *Str == ' ') {
- Str += 1;
- }
- //
- // skip preceeding zeros
- //
- while (*Str && *Str == '0') {
- Str += 1;
- }
- //
- // skip preceeding character 'x' or 'X'
- //
- if (*Str && (*Str == 'x' || *Str == 'X')) {
- Str += 1;
- }
-
- return Str;
-}
-
-STATIC
-UINTN
-Xtoi (
- IN CHAR16 *Str
- )
-/*++
-
-Routine Description:
-
- Convert hex string to uint
-
-Arguments:
-
- Str - The string
-
-Returns:
-
---*/
-{
- UINTN Rvalue;
- UINTN Length;
-
- ASSERT (Str != NULL);
-
- //
- // convert hex digits
- //
- Rvalue = 0;
- Length = sizeof (UINTN);
- HexStringToBuf ((UINT8 *) &Rvalue, &Length, TrimHexStr (Str), NULL);
-
- return Rvalue;
-}
-
-STATIC
-VOID
-Xtoi64 (
- IN CHAR16 *Str,
- IN UINT64 *Data
- )
-/*++
-
-Routine Description:
-
- Convert hex string to 64 bit data.
-
-Arguments:
-
- Str - The string
-
-Returns:
-
---*/
-{
- UINTN Length;
-
- *Data = 0;
- Length = sizeof (UINT64);
- HexStringToBuf ((UINT8 *) Data, &Length, TrimHexStr (Str), NULL);
-}
-
-STATIC
-UINTN
-Atoi (
- IN CHAR16 *str
- )
-/*++
-
-Routine Description:
-
- Convert decimal string to uint
-
-Arguments:
-
- Str - The string
-
-Returns:
-
---*/
-{
- UINTN Rvalue;
- CHAR16 Char;
- UINTN High;
- UINTN Low;
-
- ASSERT (str != NULL);
-
- High = (UINTN) -1 / 10;
- Low = (UINTN) -1 % 10;
- //
- // skip preceeding white space
- //
- while (*str && *str == ' ') {
- str += 1;
- }
- //
- // convert digits
- //
- Rvalue = 0;
- Char = *(str++);
- while (Char) {
- if (Char >= '0' && Char <= '9') {
- if ((Rvalue > High || Rvalue == High) && (Char - '0' > (INTN) Low)) {
- return (UINTN) -1;
- }
-
- Rvalue = (Rvalue * 10) + Char - '0';
- } else {
- break;
- }
-
- Char = *(str++);
- }
-
- return Rvalue;
-}
-
-STATIC
-EFI_STATUS
-StrToBuf (
- OUT UINT8 *Buf,
- IN UINTN BufferLength,
- IN CHAR16 *Str
- )
-{
- UINTN Index;
- UINTN StrLength;
- UINT8 Digit;
- UINT8 Byte;
-
- //
- // Two hex char make up one byte
- //
- StrLength = BufferLength * sizeof (CHAR16);
-
- for(Index = 0; Index < StrLength; Index++, Str++) {
-
- IsHexDigit (&Digit, *Str);
-
- //
- // For odd charaters, write the upper nibble for each buffer byte,
- // and for even characters, the lower nibble.
- //
- if ((Index & 1) == 0) {
- Byte = (UINT8) (Digit << 4);
- } else {
- Byte = Buf[Index / 2];
- Byte &= 0xF0;
- Byte = (UINT8) (Byte | Digit);
- }
-
- Buf[Index / 2] = Byte;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-StrToGuid (
- IN CHAR16 *Str,
- OUT EFI_GUID *Guid
- )
-{
- UINTN BufferLength;
- UINTN ConvertedStrLen;
- EFI_STATUS Status;
-
- BufferLength = sizeof (Guid->Data1);
- Status = HexStringToBuf ((UINT8 *) &Guid->Data1, &BufferLength, Str, &ConvertedStrLen);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Str += ConvertedStrLen;
- if (IS_HYPHEN (*Str)) {
- Str++;
- } else {
- return EFI_UNSUPPORTED;
- }
-
- BufferLength = sizeof (Guid->Data2);
- Status = HexStringToBuf ((UINT8 *) &Guid->Data2, &BufferLength, Str, &ConvertedStrLen);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Str += ConvertedStrLen;
- if (IS_HYPHEN (*Str)) {
- Str++;
- } else {
- return EFI_UNSUPPORTED;
- }
-
- BufferLength = sizeof (Guid->Data3);
- Status = HexStringToBuf ((UINT8 *) &Guid->Data3, &BufferLength, Str, &ConvertedStrLen);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Str += ConvertedStrLen;
- if (IS_HYPHEN (*Str)) {
- Str++;
- } else {
- return EFI_UNSUPPORTED;
- }
-
- StrToBuf (&Guid->Data4[0], 2, Str);
- //
- // Skip 2 byte hex chars
- //
- Str += 2 * 2;
-
- if (IS_HYPHEN (*Str)) {
- Str++;
- } else {
- return EFI_UNSUPPORTED;
- }
- StrToBuf (&Guid->Data4[2], 6, Str);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-VOID
-StrToIPv4Addr (
- IN OUT CHAR16 **Str,
- OUT EFI_IPv4_ADDRESS *IPv4Addr
- )
-{
- UINTN Index;
-
- for (Index = 0; Index < 4; Index++) {
- IPv4Addr->Addr[Index] = (UINT8) Atoi (SplitStr (Str, L'.'));
- }
-}
-
-STATIC
-VOID
-StrToIPv6Addr (
- IN OUT CHAR16 **Str,
- OUT EFI_IPv6_ADDRESS *IPv6Addr
- )
-{
- UINTN Index;
- UINT16 Data;
-
- for (Index = 0; Index < 8; Index++) {
- Data = (UINT16) Xtoi (SplitStr (Str, L':'));
- IPv6Addr->Addr[Index * 2] = (UINT8) (Data >> 8);
- IPv6Addr->Addr[Index * 2 + 1] = (UINT8) (Data & 0xff);
- }
-}
-
-STATIC
-VOID
-StrToAscii (
- IN CHAR16 *Str,
- IN OUT CHAR8 **AsciiStr
- )
-{
- CHAR8 *Dest;
-
- Dest = *AsciiStr;
- while (!IS_NULL (*Str)) {
- *(Dest++) = (CHAR8) *(Str++);
- }
- *Dest = 0;
-
- //
- // Return the string next to it
- //
- *AsciiStr = Dest + 1;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextPci (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *FunctionStr;
- CHAR16 *DeviceStr;
- PCI_DEVICE_PATH *Pci;
-
- FunctionStr = GetNextParamStr (&TextDeviceNode);
- DeviceStr = GetNextParamStr (&TextDeviceNode);
- Pci = (PCI_DEVICE_PATH *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_PCI_DP,
- sizeof (PCI_DEVICE_PATH)
- );
-
- Pci->Function = (UINT8) Xtoi (FunctionStr);
- Pci->Device = (UINT8) Xtoi (DeviceStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Pci;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextPcCard (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *FunctionNumberStr;
- PCCARD_DEVICE_PATH *Pccard;
-
- FunctionNumberStr = GetNextParamStr (&TextDeviceNode);
- Pccard = (PCCARD_DEVICE_PATH *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_PCCARD_DP,
- sizeof (PCCARD_DEVICE_PATH)
- );
-
- Pccard->FunctionNumber = (UINT8) Xtoi (FunctionNumberStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Pccard;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextMemoryMapped (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *StartingAddressStr;
- CHAR16 *EndingAddressStr;
- MEMMAP_DEVICE_PATH *MemMap;
-
- StartingAddressStr = GetNextParamStr (&TextDeviceNode);
- EndingAddressStr = GetNextParamStr (&TextDeviceNode);
- MemMap = (MEMMAP_DEVICE_PATH *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_MEMMAP_DP,
- sizeof (MEMMAP_DEVICE_PATH)
- );
-
- MemMap->MemoryType = 0;
-
- Xtoi64 (StartingAddressStr, &MemMap->StartingAddress);
- Xtoi64 (EndingAddressStr, &MemMap->EndingAddress);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) MemMap;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-ConvertFromTextVendor (
- IN CHAR16 *TextDeviceNode,
- IN UINT8 Type,
- IN UINT8 SubType
- )
-{
- CHAR16 *GuidStr;
- CHAR16 *DataStr;
- UINTN Length;
- VENDOR_DEVICE_PATH *Vendor;
-
- GuidStr = GetNextParamStr (&TextDeviceNode);
-
- DataStr = GetNextParamStr (&TextDeviceNode);
- Length = StrLen (DataStr);
- //
- // Two hex characters make up 1 buffer byte
- //
- Length = (Length + 1) / 2;
-
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- Type,
- SubType,
- sizeof (VENDOR_DEVICE_PATH) + (UINT16) Length
- );
-
- StrToGuid (GuidStr, &Vendor->Guid);
- StrToBuf (((UINT8 *) Vendor) + sizeof (VENDOR_DEVICE_PATH), Length, DataStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextVenHw (
- IN CHAR16 *TextDeviceNode
- )
-{
- return ConvertFromTextVendor (
- TextDeviceNode,
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP
- );
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextCtrl (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *ControllerStr;
- CONTROLLER_DEVICE_PATH *Controller;
-
- ControllerStr = GetNextParamStr (&TextDeviceNode);
- Controller = (CONTROLLER_DEVICE_PATH *) CreateDeviceNode (
- HARDWARE_DEVICE_PATH,
- HW_CONTROLLER_DP,
- sizeof (CONTROLLER_DEVICE_PATH)
- );
- Controller->ControllerNumber = (UINT32) Xtoi (ControllerStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Controller;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextAcpi (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *HIDStr;
- CHAR16 *UIDStr;
- ACPI_HID_DEVICE_PATH *Acpi;
-
- HIDStr = GetNextParamStr (&TextDeviceNode);
- UIDStr = GetNextParamStr (&TextDeviceNode);
- Acpi = (ACPI_HID_DEVICE_PATH *) CreateDeviceNode (
- ACPI_DEVICE_PATH,
- ACPI_DP,
- sizeof (ACPI_HID_DEVICE_PATH)
- );
-
- if ((HIDStr[0] == L'P') && (HIDStr[1] == L'N') && (HIDStr[2] == L'P')) {
- HIDStr += 3;
- }
-
- Acpi->HID = EISA_PNP_ID (Xtoi (HIDStr));
- Acpi->UID = (UINT32) Xtoi (UIDStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-ConvertFromTextAcpi (
- IN CHAR16 *TextDeviceNode,
- IN UINT32 Hid
- )
-{
- CHAR16 *UIDStr;
- ACPI_HID_DEVICE_PATH *Acpi;
-
- UIDStr = GetNextParamStr (&TextDeviceNode);
- Acpi = (ACPI_HID_DEVICE_PATH *) CreateDeviceNode (
- ACPI_DEVICE_PATH,
- ACPI_DP,
- sizeof (ACPI_HID_DEVICE_PATH)
- );
-
- Acpi->HID = Hid;
- Acpi->UID = (UINT32) Xtoi (UIDStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Acpi;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextPciRoot (
- IN CHAR16 *TextDeviceNode
- )
-{
- return ConvertFromTextAcpi (TextDeviceNode, 0x0a0341d0);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextFloppy (
- IN CHAR16 *TextDeviceNode
- )
-{
- return ConvertFromTextAcpi (TextDeviceNode, 0x060441d0);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextKeyboard (
- IN CHAR16 *TextDeviceNode
- )
-{
- return ConvertFromTextAcpi (TextDeviceNode, 0x030141d0);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextSerial (
- IN CHAR16 *TextDeviceNode
- )
-{
- return ConvertFromTextAcpi (TextDeviceNode, 0x050141d0);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextParallelPort (
- IN CHAR16 *TextDeviceNode
- )
-{
- return ConvertFromTextAcpi (TextDeviceNode, 0x040141d0);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextAcpiEx (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *HIDStr;
- CHAR16 *CIDStr;
- CHAR16 *UIDStr;
- CHAR16 *HIDSTRStr;
- CHAR16 *CIDSTRStr;
- CHAR16 *UIDSTRStr;
- CHAR8 *AsciiStr;
- UINT16 Length;
- ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *AcpiExt;
-
- HIDStr = GetNextParamStr (&TextDeviceNode);
- CIDStr = GetNextParamStr (&TextDeviceNode);
- UIDStr = GetNextParamStr (&TextDeviceNode);
- HIDSTRStr = GetNextParamStr (&TextDeviceNode);
- CIDSTRStr = GetNextParamStr (&TextDeviceNode);
- UIDSTRStr = GetNextParamStr (&TextDeviceNode);
-
- Length = (UINT16) (sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + StrLen (HIDSTRStr) + 1);
- Length = (UINT16) (Length + StrLen (UIDSTRStr) + 1);
- Length = (UINT16) (Length + StrLen (CIDSTRStr) + 1);
- AcpiExt = (ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *) CreateDeviceNode (
- ACPI_DEVICE_PATH,
- ACPI_EXTENDED_DP,
- Length
- );
-
- if ((HIDStr[0] == L'P') && (HIDStr[1] == L'N') && (HIDStr[2] == L'P')) {
- HIDStr += 3;
- AcpiExt->HID = EISA_PNP_ID (Xtoi (HIDStr));
- } else {
- AcpiExt->HID = (UINT32) Xtoi (HIDStr);
- }
-
- AcpiExt->UID = (UINT32) Xtoi (UIDStr);
- AcpiExt->CID = (UINT32) Xtoi (CIDStr);
-
- AsciiStr = AcpiExt->HidUidCidStr;
- StrToAscii (HIDSTRStr, &AsciiStr);
- StrToAscii (UIDSTRStr, &AsciiStr);
- StrToAscii (CIDSTRStr, &AsciiStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) AcpiExt;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextAcpiExp (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *HIDStr;
- CHAR16 *CIDStr;
- CHAR16 *UIDSTRStr;
- CHAR8 *AsciiStr;
- UINT16 Length;
- ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *AcpiExt;
-
- HIDStr = GetNextParamStr (&TextDeviceNode);
- CIDStr = GetNextParamStr (&TextDeviceNode);
- UIDSTRStr = GetNextParamStr (&TextDeviceNode);
- Length = sizeof (ACPI_EXTENDED_HID_DEVICE_PATH) + (UINT16) StrLen (UIDSTRStr) + 3;
- AcpiExt = (ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *) CreateDeviceNode (
- ACPI_DEVICE_PATH,
- ACPI_EXTENDED_DP,
- Length
- );
-
- if ((HIDStr[0] == L'P') && (HIDStr[1] == L'N') && (HIDStr[2] == L'P')) {
- HIDStr += 3;
- AcpiExt->HID = EISA_PNP_ID (Xtoi (HIDStr));
- } else {
- AcpiExt->HID = (UINT32) Xtoi (HIDStr);
- }
-
- AcpiExt->UID = 0;
- AcpiExt->CID = (UINT32) Xtoi (CIDStr);
-
- AsciiStr = AcpiExt->HidUidCidStr;
- //
- // HID string is NULL
- //
- *AsciiStr = 0;
- //
- // Convert UID string
- //
- AsciiStr++;
- StrToAscii (UIDSTRStr, &AsciiStr);
- //
- // CID string is NULL
- //
- *AsciiStr = 0;
-
- return (EFI_DEVICE_PATH_PROTOCOL *) AcpiExt;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextAta (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *PrimarySecondaryStr;
- CHAR16 *SlaveMasterStr;
- CHAR16 *LunStr;
- ATAPI_DEVICE_PATH *Atapi;
-
- Atapi = (ATAPI_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_ATAPI_DP,
- sizeof (ATAPI_DEVICE_PATH)
- );
-
- PrimarySecondaryStr = GetNextParamStr (&TextDeviceNode);
- SlaveMasterStr = GetNextParamStr (&TextDeviceNode);
- LunStr = GetNextParamStr (&TextDeviceNode);
-
- Atapi->PrimarySecondary = (UINT8) ((StrCmp (PrimarySecondaryStr, L"Primary") == 0) ? 0 : 1);
- Atapi->SlaveMaster = (UINT8) ((StrCmp (SlaveMasterStr, L"Master") == 0) ? 0 : 1);
- Atapi->Lun = (UINT16) Xtoi (LunStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Atapi;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextScsi (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *PunStr;
- CHAR16 *LunStr;
- SCSI_DEVICE_PATH *Scsi;
-
- PunStr = GetNextParamStr (&TextDeviceNode);
- LunStr = GetNextParamStr (&TextDeviceNode);
- Scsi = (SCSI_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_SCSI_DP,
- sizeof (SCSI_DEVICE_PATH)
- );
-
- Scsi->Pun = (UINT16) Xtoi (PunStr);
- Scsi->Lun = (UINT16) Xtoi (LunStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Scsi;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextFibre (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *WWNStr;
- CHAR16 *LunStr;
- FIBRECHANNEL_DEVICE_PATH *Fibre;
-
- WWNStr = GetNextParamStr (&TextDeviceNode);
- LunStr = GetNextParamStr (&TextDeviceNode);
- Fibre = (FIBRECHANNEL_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_FIBRECHANNEL_DP,
- sizeof (FIBRECHANNEL_DEVICE_PATH)
- );
-
- Fibre->Reserved = 0;
- Xtoi64 (WWNStr, &Fibre->WWN);
- Xtoi64 (LunStr, &Fibre->Lun);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Fibre;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromText1394 (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *GuidStr;
- F1394_DEVICE_PATH *F1394;
-
- GuidStr = GetNextParamStr (&TextDeviceNode);
- F1394 = (F1394_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_1394_DP,
- sizeof (F1394_DEVICE_PATH)
- );
-
- F1394->Reserved = 0;
- Xtoi64 (GuidStr, &F1394->Guid);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) F1394;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsb (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *PortStr;
- CHAR16 *InterfaceStr;
- USB_DEVICE_PATH *Usb;
-
- PortStr = GetNextParamStr (&TextDeviceNode);
- InterfaceStr = GetNextParamStr (&TextDeviceNode);
- Usb = (USB_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_USB_DP,
- sizeof (USB_DEVICE_PATH)
- );
-
- Usb->ParentPortNumber = (UINT8) Xtoi (PortStr);
- Usb->InterfaceNumber = (UINT8) Xtoi (InterfaceStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Usb;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextI2O (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *TIDStr;
- I2O_DEVICE_PATH *I2O;
-
- TIDStr = GetNextParamStr (&TextDeviceNode);
- I2O = (I2O_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_I2O_DP,
- sizeof (I2O_DEVICE_PATH)
- );
-
- I2O->Tid = (UINT32) Xtoi (TIDStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) I2O;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextInfiniband (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *FlagsStr;
- CHAR16 *GuidStr;
- CHAR16 *SidStr;
- CHAR16 *TidStr;
- CHAR16 *DidStr;
- EFI_GUID PortGid;
- INFINIBAND_DEVICE_PATH *InfiniBand;
-
- FlagsStr = GetNextParamStr (&TextDeviceNode);
- GuidStr = GetNextParamStr (&TextDeviceNode);
- SidStr = GetNextParamStr (&TextDeviceNode);
- TidStr = GetNextParamStr (&TextDeviceNode);
- DidStr = GetNextParamStr (&TextDeviceNode);
- InfiniBand = (INFINIBAND_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_INFINIBAND_DP,
- sizeof (INFINIBAND_DEVICE_PATH)
- );
-
- InfiniBand->ResourceFlags = (UINT32) Xtoi (FlagsStr);
- StrToGuid (GuidStr, &PortGid);
- CopyMem (InfiniBand->PortGid, &PortGid, sizeof (EFI_GUID));
- Xtoi64 (SidStr, &InfiniBand->ServiceId);
- Xtoi64 (TidStr, &InfiniBand->TargetPortId);
- Xtoi64 (DidStr, &InfiniBand->DeviceId);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) InfiniBand;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextVenMsg (
- IN CHAR16 *TextDeviceNode
- )
-{
- return ConvertFromTextVendor (
- TextDeviceNode,
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP
- );
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextVenPcAnsi (
- IN CHAR16 *TextDeviceNode
- )
-{
- VENDOR_DEVICE_PATH *Vendor;
-
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- sizeof (VENDOR_DEVICE_PATH));
- CopyGuid (&Vendor->Guid, &gEfiPcAnsiGuid);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextVenVt100 (
- IN CHAR16 *TextDeviceNode
- )
-{
- VENDOR_DEVICE_PATH *Vendor;
-
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- sizeof (VENDOR_DEVICE_PATH));
- CopyGuid (&Vendor->Guid, &gEfiVT100Guid);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextVenVt100Plus (
- IN CHAR16 *TextDeviceNode
- )
-{
- VENDOR_DEVICE_PATH *Vendor;
-
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- sizeof (VENDOR_DEVICE_PATH));
- CopyGuid (&Vendor->Guid, &gEfiVT100PlusGuid);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextVenUtf8 (
- IN CHAR16 *TextDeviceNode
- )
-{
- VENDOR_DEVICE_PATH *Vendor;
-
- Vendor = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- sizeof (VENDOR_DEVICE_PATH));
- CopyGuid (&Vendor->Guid, &gEfiVTUTF8Guid);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Vendor;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUartFlowCtrl (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *ValueStr;
- UART_FLOW_CONTROL_DEVICE_PATH *UartFlowControl;
-
- ValueStr = GetNextParamStr (&TextDeviceNode);
- UartFlowControl = (UART_FLOW_CONTROL_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- sizeof (UART_FLOW_CONTROL_DEVICE_PATH)
- );
-
- CopyGuid (&UartFlowControl->Guid, &mEfiDevicePathMessagingUartFlowControlGuid);
- if (StrCmp (ValueStr, L"XonXoff") == 0) {
- UartFlowControl->FlowControlMap = 2;
- } else if (StrCmp (ValueStr, L"Hardware") == 0) {
- UartFlowControl->FlowControlMap = 1;
- } else {
- UartFlowControl->FlowControlMap = 0;
- }
-
- return (EFI_DEVICE_PATH_PROTOCOL *) UartFlowControl;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextSAS (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *AddressStr;
- CHAR16 *LunStr;
- CHAR16 *RTPStr;
- CHAR16 *SASSATAStr;
- CHAR16 *LocationStr;
- CHAR16 *ConnectStr;
- CHAR16 *DriveBayStr;
- CHAR16 *ReservedStr;
- UINT16 Info;
- SAS_DEVICE_PATH *Sas;
-
- AddressStr = GetNextParamStr (&TextDeviceNode);
- LunStr = GetNextParamStr (&TextDeviceNode);
- RTPStr = GetNextParamStr (&TextDeviceNode);
- SASSATAStr = GetNextParamStr (&TextDeviceNode);
- LocationStr = GetNextParamStr (&TextDeviceNode);
- ConnectStr = GetNextParamStr (&TextDeviceNode);
- DriveBayStr = GetNextParamStr (&TextDeviceNode);
- ReservedStr = GetNextParamStr (&TextDeviceNode);
- Info = 0x0000;
- Sas = (SAS_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- sizeof (SAS_DEVICE_PATH)
- );
-
- CopyGuid (&Sas->Guid, &mEfiDevicePathMessagingSASGuid);
- Xtoi64 (AddressStr, &Sas->SasAddress);
- Xtoi64 (LunStr, &Sas->Lun);
- Sas->RelativeTargetPort = (UINT16) Xtoi (RTPStr);
- if (StrCmp (SASSATAStr, L"NoTopology") == 0)
- ;
- else {
- if (StrCmp (DriveBayStr, L"0") == 0) {
- Info |= 0x0001;
- } else {
- Info |= 0x0002;
- Info |= (Xtoi (DriveBayStr) << 8);
- }
-
- if (StrCmp (SASSATAStr, L"SATA") == 0) {
- Info |= 0x0010;
- }
-
- if (StrCmp (LocationStr, L"External") == 0) {
- Info |= 0x0020;
- }
-
- if (StrCmp (ConnectStr, L"Expanded") == 0) {
- Info |= 0x0040;
- }
- }
-
- Sas->DeviceTopology = Info;
- Sas->Reserved = (UINT32) Xtoi (ReservedStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Sas;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextDebugPort (
- IN CHAR16 *TextDeviceNode
- )
-{
- VENDOR_DEFINED_MESSAGING_DEVICE_PATH *Vend;
-
- Vend = (VENDOR_DEFINED_MESSAGING_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- sizeof (VENDOR_DEFINED_MESSAGING_DEVICE_PATH)
- );
-
- CopyGuid (&Vend->Guid, &gEfiDebugPortProtocolGuid);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Vend;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextMAC (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *AddressStr;
- CHAR16 *IfTypeStr;
- UINTN Length;
- MAC_ADDR_DEVICE_PATH *MAC;
-
- AddressStr = GetNextParamStr (&TextDeviceNode);
- IfTypeStr = GetNextParamStr (&TextDeviceNode);
- MAC = (MAC_ADDR_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_MAC_ADDR_DP,
- sizeof (MAC_ADDR_DEVICE_PATH)
- );
-
- MAC->IfType = (UINT8) Xtoi (IfTypeStr);
-
- Length = sizeof (EFI_MAC_ADDRESS);
- StrToBuf (&MAC->MacAddress.Addr[0], Length, AddressStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) MAC;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextIPv4 (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *RemoteIPStr;
- CHAR16 *ProtocolStr;
- CHAR16 *TypeStr;
- CHAR16 *LocalIPStr;
- IPv4_DEVICE_PATH *IPv4;
-
- RemoteIPStr = GetNextParamStr (&TextDeviceNode);
- ProtocolStr = GetNextParamStr (&TextDeviceNode);
- TypeStr = GetNextParamStr (&TextDeviceNode);
- LocalIPStr = GetNextParamStr (&TextDeviceNode);
- IPv4 = (IPv4_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_IPv4_DP,
- sizeof (IPv4_DEVICE_PATH)
- );
-
- StrToIPv4Addr (&RemoteIPStr, &IPv4->RemoteIpAddress);
- IPv4->Protocol = (UINT16) ((StrCmp (ProtocolStr, L"UDP") == 0) ? 0 : 1);
- if (StrCmp (TypeStr, L"Static") == 0) {
- IPv4->StaticIpAddress = TRUE;
- } else {
- IPv4->StaticIpAddress = FALSE;
- }
-
- StrToIPv4Addr (&LocalIPStr, &IPv4->LocalIpAddress);
-
- IPv4->LocalPort = 0;
- IPv4->RemotePort = 0;
-
- return (EFI_DEVICE_PATH_PROTOCOL *) IPv4;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextIPv6 (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *RemoteIPStr;
- CHAR16 *ProtocolStr;
- CHAR16 *TypeStr;
- CHAR16 *LocalIPStr;
- IPv6_DEVICE_PATH *IPv6;
-
- RemoteIPStr = GetNextParamStr (&TextDeviceNode);
- ProtocolStr = GetNextParamStr (&TextDeviceNode);
- TypeStr = GetNextParamStr (&TextDeviceNode);
- LocalIPStr = GetNextParamStr (&TextDeviceNode);
- IPv6 = (IPv6_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_IPv6_DP,
- sizeof (IPv6_DEVICE_PATH)
- );
-
- StrToIPv6Addr (&RemoteIPStr, &IPv6->RemoteIpAddress);
- IPv6->Protocol = (UINT16) ((StrCmp (ProtocolStr, L"UDP") == 0) ? 0 : 1);
- if (StrCmp (TypeStr, L"Static") == 0) {
- IPv6->StaticIpAddress = TRUE;
- } else {
- IPv6->StaticIpAddress = FALSE;
- }
-
- StrToIPv6Addr (&LocalIPStr, &IPv6->LocalIpAddress);
-
- IPv6->LocalPort = 0;
- IPv6->RemotePort = 0;
-
- return (EFI_DEVICE_PATH_PROTOCOL *) IPv6;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUart (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *BaudStr;
- CHAR16 *DataBitsStr;
- CHAR16 *ParityStr;
- CHAR16 *StopBitsStr;
- UART_DEVICE_PATH *Uart;
-
- BaudStr = GetNextParamStr (&TextDeviceNode);
- DataBitsStr = GetNextParamStr (&TextDeviceNode);
- ParityStr = GetNextParamStr (&TextDeviceNode);
- StopBitsStr = GetNextParamStr (&TextDeviceNode);
- Uart = (UART_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_UART_DP,
- sizeof (UART_DEVICE_PATH)
- );
-
- Uart->BaudRate = (StrCmp (BaudStr, L"DEFAULT") == 0) ? 115200 : Atoi (BaudStr);
- Uart->DataBits = (UINT8) ((StrCmp (DataBitsStr, L"DEFAULT") == 0) ? 8 : Atoi (DataBitsStr));
- switch (*ParityStr) {
- case L'D':
- Uart->Parity = 0;
- break;
-
- case L'N':
- Uart->Parity = 1;
- break;
-
- case L'E':
- Uart->Parity = 2;
- break;
-
- case L'O':
- Uart->Parity = 3;
- break;
-
- case L'M':
- Uart->Parity = 4;
- break;
-
- case L'S':
- Uart->Parity = 5;
-
- default:
- Uart->Parity = 0xff;
- }
-
- if (StrCmp (StopBitsStr, L"D") == 0) {
- Uart->StopBits = (UINT8) 0;
- } else if (StrCmp (StopBitsStr, L"1") == 0) {
- Uart->StopBits = (UINT8) 1;
- } else if (StrCmp (StopBitsStr, L"1.5") == 0) {
- Uart->StopBits = (UINT8) 2;
- } else if (StrCmp (StopBitsStr, L"2") == 0) {
- Uart->StopBits = (UINT8) 3;
- } else {
- Uart->StopBits = 0xff;
- }
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Uart;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-ConvertFromTextUsbClass (
- IN CHAR16 *TextDeviceNode,
- IN USB_CLASS_TEXT *UsbClassText
- )
-{
- CHAR16 *VIDStr;
- CHAR16 *PIDStr;
- CHAR16 *ClassStr;
- CHAR16 *SubClassStr;
- CHAR16 *ProtocolStr;
- USB_CLASS_DEVICE_PATH *UsbClass;
-
- UsbClass = (USB_CLASS_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_USB_CLASS_DP,
- sizeof (USB_CLASS_DEVICE_PATH)
- );
-
- VIDStr = GetNextParamStr (&TextDeviceNode);
- PIDStr = GetNextParamStr (&TextDeviceNode);
- if (UsbClassText->ClassExist) {
- ClassStr = GetNextParamStr (&TextDeviceNode);
- UsbClass->DeviceClass = (UINT8) Xtoi (ClassStr);
- } else {
- UsbClass->DeviceClass = UsbClassText->Class;
- }
- if (UsbClassText->SubClassExist) {
- SubClassStr = GetNextParamStr (&TextDeviceNode);
- UsbClass->DeviceSubClass = (UINT8) Xtoi (SubClassStr);
- } else {
- UsbClass->DeviceSubClass = UsbClassText->SubClass;
- }
-
- ProtocolStr = GetNextParamStr (&TextDeviceNode);
-
- UsbClass->VendorId = (UINT16) Xtoi (VIDStr);
- UsbClass->ProductId = (UINT16) Xtoi (PIDStr);
- UsbClass->DeviceProtocol = (UINT8) Xtoi (ProtocolStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) UsbClass;
-}
-
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbClass (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = TRUE;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbAudio (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_AUDIO;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbCDCControl (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_CDCCONTROL;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbHID (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_HID;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbImage (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_IMAGE;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbPrinter (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_PRINTER;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbMassStorage (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_MASS_STORAGE;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbHub (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_HUB;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbCDCData (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_CDCDATA;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbSmartCard (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_SMART_CARD;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbVideo (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_VIDEO;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbDiagnostic (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_DIAGNOSTIC;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbWireless (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_WIRELESS;
- UsbClassText.SubClassExist = TRUE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbDeviceFirmwareUpdate (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_RESERVE;
- UsbClassText.SubClassExist = FALSE;
- UsbClassText.SubClass = USB_SUBCLASS_FW_UPDATE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbIrdaBridge (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_RESERVE;
- UsbClassText.SubClassExist = FALSE;
- UsbClassText.SubClass = USB_SUBCLASS_IRDA_BRIDGE;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbTestAndMeasurement (
- IN CHAR16 *TextDeviceNode
- )
-{
- USB_CLASS_TEXT UsbClassText;
-
- UsbClassText.ClassExist = FALSE;
- UsbClassText.Class = USB_CLASS_RESERVE;
- UsbClassText.SubClassExist = FALSE;
- UsbClassText.SubClass = USB_SUBCLASS_TEST;
-
- return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUsbWwid (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *VIDStr;
- CHAR16 *PIDStr;
- CHAR16 *InterfaceNumStr;
- USB_WWID_DEVICE_PATH *UsbWwid;
-
- VIDStr = GetNextParamStr (&TextDeviceNode);
- PIDStr = GetNextParamStr (&TextDeviceNode);
- InterfaceNumStr = GetNextParamStr (&TextDeviceNode);
- UsbWwid = (USB_WWID_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_USB_WWID_DP,
- sizeof (USB_WWID_DEVICE_PATH)
- );
-
- UsbWwid->VendorId = (UINT16) Xtoi (VIDStr);
- UsbWwid->ProductId = (UINT16) Xtoi (PIDStr);
- UsbWwid->InterfaceNumber = (UINT16) Xtoi (InterfaceNumStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) UsbWwid;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextUnit (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *LunStr;
- DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;
-
- LunStr = GetNextParamStr (&TextDeviceNode);
- LogicalUnit = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_DEVICE_LOGICAL_UNIT_DP,
- sizeof (DEVICE_LOGICAL_UNIT_DEVICE_PATH)
- );
-
- LogicalUnit->Lun = (UINT8) Xtoi (LunStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) LogicalUnit;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextiSCSI (
- IN CHAR16 *TextDeviceNode
- )
-{
- UINT16 Options;
- CHAR16 *NameStr;
- CHAR16 *PortalGroupStr;
- CHAR16 *LunStr;
- CHAR16 *HeaderDigestStr;
- CHAR16 *DataDigestStr;
- CHAR16 *AuthenticationStr;
- CHAR16 *ProtocolStr;
- ISCSI_DEVICE_PATH_WITH_NAME *iSCSI;
-
- NameStr = GetNextParamStr (&TextDeviceNode);
- PortalGroupStr = GetNextParamStr (&TextDeviceNode);
- LunStr = GetNextParamStr (&TextDeviceNode);
- HeaderDigestStr = GetNextParamStr (&TextDeviceNode);
- DataDigestStr = GetNextParamStr (&TextDeviceNode);
- AuthenticationStr = GetNextParamStr (&TextDeviceNode);
- ProtocolStr = GetNextParamStr (&TextDeviceNode);
- iSCSI = (ISCSI_DEVICE_PATH_WITH_NAME *) CreateDeviceNode (
- MESSAGING_DEVICE_PATH,
- MSG_ISCSI_DP,
- sizeof (ISCSI_DEVICE_PATH_WITH_NAME) + (UINT16) (StrLen (NameStr) * 2)
- );
-
- StrCpy (iSCSI->iSCSITargetName, NameStr);
- iSCSI->TargetPortalGroupTag = (UINT16) Xtoi (PortalGroupStr);
- Xtoi64 (LunStr, &iSCSI->Lun);
-
- Options = 0x0000;
- if (StrCmp (HeaderDigestStr, L"CRC32C") == 0) {
- Options |= 0x0002;
- }
-
- if (StrCmp (DataDigestStr, L"CRC32C") == 0) {
- Options |= 0x0008;
- }
-
- if (StrCmp (AuthenticationStr, L"None") == 0) {
- Options |= 0x0800;
- }
-
- if (StrCmp (AuthenticationStr, L"CHAP_UNI") == 0) {
- Options |= 0x1000;
- }
-
- iSCSI->LoginOption = (UINT16) Options;
-
- iSCSI->NetworkProtocol = (UINT16) StrCmp (ProtocolStr, L"TCP");
- iSCSI->Reserved = (UINT16) 0;
-
- return (EFI_DEVICE_PATH_PROTOCOL *) iSCSI;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextHD (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *PartitionStr;
- CHAR16 *TypeStr;
- CHAR16 *SignatureStr;
- CHAR16 *StartStr;
- CHAR16 *SizeStr;
- UINT32 Signature32;
- EFI_GUID SignatureGuid;
- HARDDRIVE_DEVICE_PATH *Hd;
-
- PartitionStr = GetNextParamStr (&TextDeviceNode);
- TypeStr = GetNextParamStr (&TextDeviceNode);
- SignatureStr = GetNextParamStr (&TextDeviceNode);
- StartStr = GetNextParamStr (&TextDeviceNode);
- SizeStr = GetNextParamStr (&TextDeviceNode);
- Hd = (HARDDRIVE_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_HARDDRIVE_DP,
- sizeof (HARDDRIVE_DEVICE_PATH)
- );
-
- Hd->PartitionNumber = (UINT32) Atoi (PartitionStr);
-
- ZeroMem (Hd->Signature, 16);
- Hd->MBRType = (UINT8) 0;
-
- if (StrCmp (TypeStr, L"None") == 0) {
- Hd->SignatureType = (UINT8) 0;
- } else if (StrCmp (TypeStr, L"MBR") == 0) {
- Hd->SignatureType = SIGNATURE_TYPE_MBR;
- Hd->MBRType = 0x01;
-
- Signature32 = (UINT32) Xtoi (SignatureStr);
- CopyMem (Hd->Signature, &Signature32, sizeof (UINT32));
- } else if (StrCmp (TypeStr, L"GUID") == 0) {
- Hd->SignatureType = SIGNATURE_TYPE_GUID;
- Hd->MBRType = 0x02;
-
- StrToGuid (SignatureStr, &SignatureGuid);
- CopyMem (Hd->Signature, &SignatureGuid, sizeof (EFI_GUID));
- } else {
- Hd->SignatureType = 0xff;
-
- }
-
- Xtoi64 (StartStr, &Hd->PartitionStart);
- Xtoi64 (SizeStr, &Hd->PartitionSize);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Hd;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextCDROM (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *EntryStr;
- CHAR16 *StartStr;
- CHAR16 *SizeStr;
- CDROM_DEVICE_PATH *CDROM;
-
- EntryStr = GetNextParamStr (&TextDeviceNode);
- StartStr = GetNextParamStr (&TextDeviceNode);
- SizeStr = GetNextParamStr (&TextDeviceNode);
- CDROM = (CDROM_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_CDROM_DP,
- sizeof (CDROM_DEVICE_PATH)
- );
-
- CDROM->BootEntry = (UINT32) Xtoi (EntryStr);
- Xtoi64 (StartStr, &CDROM->PartitionStart);
- Xtoi64 (SizeStr, &CDROM->PartitionSize);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) CDROM;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextVenMEDIA (
- IN CHAR16 *TextDeviceNode
- )
-{
- return ConvertFromTextVendor (
- TextDeviceNode,
- MEDIA_DEVICE_PATH,
- MEDIA_VENDOR_DP
- );
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextFilePath (
- IN CHAR16 *TextDeviceNode
- )
-{
- FILEPATH_DEVICE_PATH *File;
-
- File = (FILEPATH_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_FILEPATH_DP,
- sizeof (FILEPATH_DEVICE_PATH) + (UINT16) (StrLen (TextDeviceNode) * 2)
- );
-
- StrCpy (File->PathName, TextDeviceNode);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) File;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextMedia (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *GuidStr;
- MEDIA_PROTOCOL_DEVICE_PATH *Media;
-
- GuidStr = GetNextParamStr (&TextDeviceNode);
- Media = (MEDIA_PROTOCOL_DEVICE_PATH *) CreateDeviceNode (
- MEDIA_DEVICE_PATH,
- MEDIA_PROTOCOL_DP,
- sizeof (MEDIA_PROTOCOL_DEVICE_PATH)
- );
-
- StrToGuid (GuidStr, &Media->Protocol);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Media;
-}
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-DevPathFromTextBBS (
- IN CHAR16 *TextDeviceNode
- )
-{
- CHAR16 *TypeStr;
- CHAR16 *IdStr;
- CHAR16 *FlagsStr;
- UINT8 *AsciiStr;
- BBS_BBS_DEVICE_PATH *Bbs;
-
- TypeStr = GetNextParamStr (&TextDeviceNode);
- IdStr = GetNextParamStr (&TextDeviceNode);
- FlagsStr = GetNextParamStr (&TextDeviceNode);
- Bbs = (BBS_BBS_DEVICE_PATH *) CreateDeviceNode (
- BBS_DEVICE_PATH,
- BBS_BBS_DP,
- sizeof (BBS_BBS_DEVICE_PATH) + (UINT16) (StrLen (IdStr))
- );
-
- if (StrCmp (TypeStr, L"Floppy") == 0) {
- Bbs->DeviceType = BBS_TYPE_FLOPPY;
- } else if (StrCmp (TypeStr, L"HD") == 0) {
- Bbs->DeviceType = BBS_TYPE_HARDDRIVE;
- } else if (StrCmp (TypeStr, L"CDROM") == 0) {
- Bbs->DeviceType = BBS_TYPE_CDROM;
- } else if (StrCmp (TypeStr, L"PCMCIA") == 0) {
- Bbs->DeviceType = BBS_TYPE_PCMCIA;
- } else if (StrCmp (TypeStr, L"USB") == 0) {
- Bbs->DeviceType = BBS_TYPE_USB;
- } else if (StrCmp (TypeStr, L"Network") == 0) {
- Bbs->DeviceType = BBS_TYPE_EMBEDDED_NETWORK;
- } else {
- Bbs->DeviceType = BBS_TYPE_UNKNOWN;
- }
-
- AsciiStr = (UINT8 *) Bbs->String;
- StrToAscii (IdStr, (CHAR8 **) &AsciiStr);
-
- Bbs->StatusFlag = (UINT16) Xtoi (FlagsStr);
-
- return (EFI_DEVICE_PATH_PROTOCOL *) Bbs;
-}
-
-GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable[] = {
- {L"Pci", DevPathFromTextPci},
- {L"PcCard", DevPathFromTextPcCard},
- {L"MemoryMapped", DevPathFromTextMemoryMapped},
- {L"VenHw", DevPathFromTextVenHw},
- {L"Ctrl", DevPathFromTextCtrl},
- {L"Acpi", DevPathFromTextAcpi},
- {L"PciRoot", DevPathFromTextPciRoot},
- {L"Floppy", DevPathFromTextFloppy},
- {L"Keyboard", DevPathFromTextKeyboard},
- {L"Serial", DevPathFromTextSerial},
- {L"ParallelPort", DevPathFromTextParallelPort},
- {L"AcpiEx", DevPathFromTextAcpiEx},
- {L"AcpiExp", DevPathFromTextAcpiExp},
- {L"Ata", DevPathFromTextAta},
- {L"Scsi", DevPathFromTextScsi},
- {L"Fibre", DevPathFromTextFibre},
- {L"I1394", DevPathFromText1394},
- {L"USB", DevPathFromTextUsb},
- {L"I2O", DevPathFromTextI2O},
- {L"Infiniband", DevPathFromTextInfiniband},
- {L"VenMsg", DevPathFromTextVenMsg},
- {L"VenPcAnsi", DevPathFromTextVenPcAnsi},
- {L"VenVt100", DevPathFromTextVenVt100},
- {L"VenVt100Plus", DevPathFromTextVenVt100Plus},
- {L"VenUtf8", DevPathFromTextVenUtf8},
- {L"UartFlowCtrl", DevPathFromTextUartFlowCtrl},
- {L"SAS", DevPathFromTextSAS},
- {L"DebugPort", DevPathFromTextDebugPort},
- {L"MAC", DevPathFromTextMAC},
- {L"IPv4", DevPathFromTextIPv4},
- {L"IPv6", DevPathFromTextIPv6},
- {L"Uart", DevPathFromTextUart},
- {L"UsbClass", DevPathFromTextUsbClass},
- {L"UsbAudio", DevPathFromTextUsbAudio},
- {L"UsbCDCControl", DevPathFromTextUsbCDCControl},
- {L"UsbHID", DevPathFromTextUsbHID},
- {L"UsbImage", DevPathFromTextUsbImage},
- {L"UsbPrinter", DevPathFromTextUsbPrinter},
- {L"UsbMassStorage", DevPathFromTextUsbMassStorage},
- {L"UsbHub", DevPathFromTextUsbHub},
- {L"UsbCDCData", DevPathFromTextUsbCDCData},
- {L"UsbSmartCard", DevPathFromTextUsbSmartCard},
- {L"UsbVideo", DevPathFromTextUsbVideo},
- {L"UsbDiagnostic", DevPathFromTextUsbDiagnostic},
- {L"UsbWireless", DevPathFromTextUsbWireless},
- {L"UsbDeviceFirmwareUpdate", DevPathFromTextUsbDeviceFirmwareUpdate},
- {L"UsbIrdaBridge", DevPathFromTextUsbIrdaBridge},
- {L"UsbTestAndMeasurement", DevPathFromTextUsbTestAndMeasurement},
- {L"UsbWwid", DevPathFromTextUsbWwid},
- {L"Unit", DevPathFromTextUnit},
- {L"iSCSI", DevPathFromTextiSCSI},
- {L"HD", DevPathFromTextHD},
- {L"CDROM", DevPathFromTextCDROM},
- {L"VenMEDIA", DevPathFromTextVenMEDIA},
- {L"Media", DevPathFromTextMedia},
- {L"BBS", DevPathFromTextBBS},
- {NULL, NULL}
-};
-
-EFI_DEVICE_PATH_PROTOCOL *
-ConvertTextToDeviceNode (
- IN CONST CHAR16 *TextDeviceNode
- )
-/*++
-
- Routine Description:
- Convert text to the binary representation of a device node.
-
- Arguments:
- TextDeviceNode - TextDeviceNode points to the text representation of a device
- node. Conversion starts with the first character and continues
- until the first non-device node character.
-
- Returns:
- A pointer - Pointer to the EFI device node.
- NULL - If TextDeviceNode is NULL or there was insufficient memory or text unsupported.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL * (*DumpNode) (CHAR16 *);
- CHAR16 *ParamStr;
- EFI_DEVICE_PATH_PROTOCOL *DeviceNode;
- CHAR16 *DeviceNodeStr;
- UINTN Index;
-
- if ((TextDeviceNode == NULL) || (IS_NULL (*TextDeviceNode))) {
- return NULL;
- }
-
- ParamStr = NULL;
- DumpNode = NULL;
- DeviceNodeStr = StrDuplicate (TextDeviceNode);
-
- for (Index = 0; DevPathFromTextTable[Index].Function; Index++) {
- ParamStr = GetParamByNodeName (DeviceNodeStr, DevPathFromTextTable[Index].DevicePathNodeText);
- if (ParamStr != NULL) {
- DumpNode = DevPathFromTextTable[Index].Function;
- break;
- }
- }
-
- if (DumpNode == NULL) {
- //
- // A file path
- //
- DumpNode = DevPathFromTextFilePath;
- DeviceNode = DumpNode (DeviceNodeStr);
- } else {
- DeviceNode = DumpNode (ParamStr);
- FreePool (ParamStr);
- }
-
- FreePool (DeviceNodeStr);
-
- return DeviceNode;
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-ConvertTextToDevicePath (
- IN CONST CHAR16 *TextDevicePath
- )
-/*++
-
- Routine Description:
- Convert text to the binary representation of a device path.
-
- Arguments:
- TextDevicePath - TextDevicePath points to the text representation of a device
- path. Conversion starts with the first character and continues
- until the first non-device node character.
-
- Returns:
- A pointer - Pointer to the allocated device path.
- NULL - If TextDeviceNode is NULL or there was insufficient memory.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL * (*DumpNode) (CHAR16 *);
- CHAR16 *ParamStr;
- EFI_DEVICE_PATH_PROTOCOL *DeviceNode;
- UINTN Index;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- CHAR16 *DevicePathStr;
- CHAR16 *Str;
- CHAR16 *DeviceNodeStr;
- UINT8 IsInstanceEnd;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- if ((TextDevicePath == NULL) || (IS_NULL (*TextDevicePath))) {
- return NULL;
- }
-
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
- SetDevicePathEndNode (DevicePath);
-
- ParamStr = NULL;
- DeviceNodeStr = NULL;
- DevicePathStr = StrDuplicate (TextDevicePath);
-
- Str = DevicePathStr;
- while ((DeviceNodeStr = GetNextDeviceNodeStr (&Str, &IsInstanceEnd)) != NULL) {
- DumpNode = NULL;
- for (Index = 0; DevPathFromTextTable[Index].Function; Index++) {
- ParamStr = GetParamByNodeName (DeviceNodeStr, DevPathFromTextTable[Index].DevicePathNodeText);
- if (ParamStr != NULL) {
- DumpNode = DevPathFromTextTable[Index].Function;
- break;
- }
- }
-
- if (DumpNode == NULL) {
- //
- // A file path
- //
- DumpNode = DevPathFromTextFilePath;
- DeviceNode = DumpNode (DeviceNodeStr);
- } else {
- DeviceNode = DumpNode (ParamStr);
- FreePool (ParamStr);
- }
-
- NewDevicePath = AppendDeviceNodeProtocolInterface (DevicePath, DeviceNode);
- FreePool (DevicePath);
- FreePool (DeviceNode);
- DevicePath = NewDevicePath;
-
- if (IsInstanceEnd) {
- DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
- SetDevicePathInstanceEndNode (DeviceNode);
-
- NewDevicePath = AppendDeviceNodeProtocolInterface (DevicePath, DeviceNode);
- FreePool (DevicePath);
- FreePool (DeviceNode);
- DevicePath = NewDevicePath;
- }
- }
-
- FreePool (DevicePathStr);
- return DevicePath;
-}
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c
deleted file mode 100644
index f1365ba..0000000
--- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c
+++ /dev/null
@@ -1,1498 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DevicePathToText.c
-
-Abstract:
-
- DevicePathToText protocol as defined in the UEFI 2.0 specification.
-
---*/
-
-#include "DevicePath.h"
-
-STATIC
-EFI_DEVICE_PATH_PROTOCOL *
-UnpackDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-/*++
-
- Routine Description:
- Function unpacks a device path data structure so that all the nodes of a device path
- are naturally aligned.
-
- Arguments:
- DevPath - A pointer to a device path data structure
-
- Returns:
- If the memory for the device path is successfully allocated, then a pointer to the
- new device path is returned. Otherwise, NULL is returned.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *Src;
- EFI_DEVICE_PATH_PROTOCOL *Dest;
- EFI_DEVICE_PATH_PROTOCOL *NewPath;
- UINTN Size;
-
- if (DevPath == NULL) {
- return NULL;
- }
- //
- // Walk device path and round sizes to valid boundries
- //
- Src = DevPath;
- Size = 0;
- for (;;) {
- Size += DevicePathNodeLength (Src);
- Size += ALIGN_SIZE (Size);
-
- if (IsDevicePathEnd (Src)) {
- break;
- }
-
- Src = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (Src);
- }
- //
- // Allocate space for the unpacked path
- //
- NewPath = AllocateZeroPool (Size);
- if (NewPath != NULL) {
-
- ASSERT (((UINTN) NewPath) % MIN_ALIGNMENT_SIZE == 0);
-
- //
- // Copy each node
- //
- Src = DevPath;
- Dest = NewPath;
- for (;;) {
- Size = DevicePathNodeLength (Src);
- CopyMem (Dest, Src, Size);
- Size += ALIGN_SIZE (Size);
- SetDevicePathNodeLength (Dest, Size);
- Dest->Type |= EFI_DP_TYPE_UNPACKED;
- Dest = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) Dest) + Size);
-
- if (IsDevicePathEnd (Src)) {
- break;
- }
-
- Src = (EFI_DEVICE_PATH_PROTOCOL *) NextDevicePathNode (Src);
- }
- }
-
- return NewPath;
-}
-
-STATIC
-VOID *
-ReallocatePool (
- IN VOID *OldPool,
- IN UINTN OldSize,
- IN UINTN NewSize
- )
-/*++
-
- Routine Description:
- Adjusts the size of a previously allocated buffer.
-
- Arguments:
- OldPool - A pointer to the buffer whose size is being adjusted.
- OldSize - The size of the current buffer.
- NewSize - The size of the new buffer.
-
- Returns:
- EFI_SUCEESS - The requested number of bytes were allocated.
- EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.
- EFI_INVALID_PARAMETER - The buffer was invalid.
-
---*/
-{
- VOID *NewPool;
-
- NewPool = NULL;
- if (NewSize) {
- NewPool = AllocateZeroPool (NewSize);
- }
-
- if (OldPool) {
- if (NewPool) {
- CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
- }
-
- FreePool (OldPool);
- }
-
- return NewPool;
-}
-
-STATIC
-CHAR16 *
-CatPrint (
- IN OUT POOL_PRINT *Str,
- IN CHAR16 *Fmt,
- ...
- )
-/*++
-
- Routine Description:
- Concatenates a formatted unicode string to allocated pool.
- The caller must free the resulting buffer.
-
- Arguments:
- Str - Tracks the allocated pool, size in use, and
- amount of pool allocated.
- Fmt - The format string
-
- Returns:
- Allocated buffer with the formatted string printed in it.
- The caller must free the allocated buffer. The buffer
- allocation is not packed.
-
---*/
-{
- UINT16 *AppendStr;
- VA_LIST Args;
- UINTN Size;
-
- AppendStr = AllocateZeroPool (0x1000);
- if (AppendStr == NULL) {
- return Str->Str;
- }
-
- VA_START (Args, Fmt);
- UnicodeVSPrint (AppendStr, 0x1000, Fmt, Args);
- VA_END (Args);
- if (NULL == Str->Str) {
- Size = StrSize (AppendStr);
- Str->Str = AllocateZeroPool (Size);
- ASSERT (Str->Str != NULL);
- } else {
- Size = StrSize (AppendStr) - sizeof (UINT16);
- Size = Size + StrSize (Str->Str);
- Str->Str = ReallocatePool (
- Str->Str,
- StrSize (Str->Str),
- Size
- );
- ASSERT (Str->Str != NULL);
- }
-
- Str->MaxLen = MAX_CHAR * sizeof (UINT16);
- if (Size < Str->MaxLen) {
- StrCat (Str->Str, AppendStr);
- Str->Len = Size - sizeof (UINT16);
- }
-
- FreePool (AppendStr);
- return Str->Str;
-}
-
-STATIC
-VOID
-DevPathToTextPci (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- PCI_DEVICE_PATH *Pci;
-
- Pci = DevPath;
- CatPrint (Str, L"Pci(%x,%x)", Pci->Function, Pci->Device);
-}
-
-STATIC
-VOID
-DevPathToTextPccard (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- PCCARD_DEVICE_PATH *Pccard;
-
- Pccard = DevPath;
- CatPrint (Str, L"PcCard(%x)", Pccard->FunctionNumber);
-}
-
-STATIC
-VOID
-DevPathToTextMemMap (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- MEMMAP_DEVICE_PATH *MemMap;
-
- MemMap = DevPath;
- CatPrint (
- Str,
- L"MemoryMapped(%lx,%lx)",
- MemMap->StartingAddress,
- MemMap->EndingAddress
- );
-}
-
-STATIC
-VOID
-DevPathToTextVendor (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- VENDOR_DEVICE_PATH *Vendor;
- CHAR16 *Type;
- UINTN Index;
- UINT32 FlowControlMap;
- UINT16 Info;
-
- Vendor = (VENDOR_DEVICE_PATH *) DevPath;
- switch (DevicePathType (&Vendor->Header)) {
- case HARDWARE_DEVICE_PATH:
- Type = L"Hw";
- break;
-
- case MESSAGING_DEVICE_PATH:
- Type = L"Msg";
- if (AllowShortcuts) {
- if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) {
- CatPrint (Str, L"VenPcAnsi()");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) {
- CatPrint (Str, L"VenVt100()");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) {
- CatPrint (Str, L"VenVt100Plus()");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {
- CatPrint (Str, L"VenUft8()");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingUartFlowControlGuid)) {
- FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);
- switch (FlowControlMap & 0x00000003) {
- case 0:
- CatPrint (Str, L"UartFlowCtrl(%s)", L"None");
- break;
-
- case 1:
- CatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware");
- break;
-
- case 2:
- CatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff");
- break;
-
- default:
- break;
- }
-
- return ;
- } else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingSASGuid)) {
- CatPrint (
- Str,
- L"SAS(%lx,%lx,%x,",
- ((SAS_DEVICE_PATH *) Vendor)->SasAddress,
- ((SAS_DEVICE_PATH *) Vendor)->Lun,
- ((SAS_DEVICE_PATH *) Vendor)->RelativeTargetPort
- );
- Info = (((SAS_DEVICE_PATH *) Vendor)->DeviceTopology);
- if ((Info & 0x0f) == 0) {
- CatPrint (Str, L"NoTopology,0,0,0,");
- } else if (((Info & 0x0f) == 1) || ((Info & 0x0f) == 2)) {
- CatPrint (
- Str,
- L"%s,%s,%s,",
- (Info & (0x1 << 4)) ? L"SATA" : L"SAS",
- (Info & (0x1 << 5)) ? L"External" : L"Internal",
- (Info & (0x1 << 6)) ? L"Expanded" : L"Direct"
- );
- if ((Info & 0x0f) == 1) {
- CatPrint (Str, L"0,");
- } else {
- CatPrint (Str, L"%x,", (Info >> 8) & 0xff);
- }
- } else {
- CatPrint (Str, L"0,0,0,0,");
- }
-
- CatPrint (Str, L"%x)", ((SAS_DEVICE_PATH *) Vendor)->Reserved);
- return ;
- } else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {
- CatPrint (Str, L"DebugPort()");
- return ;
- } else {
- return ;
- //
- // reserved
- //
- }
- }
- break;
-
- case MEDIA_DEVICE_PATH:
- Type = L"Media";
- break;
-
- default:
- Type = L"?";
- break;
- }
-
- CatPrint (Str, L"Ven%s(%g,", Type, &Vendor->Guid);
- for (Index = 0; Index < DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH); Index++) {
- CatPrint (Str, L"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);
- }
-
- CatPrint (Str, L")");
-}
-
-STATIC
-VOID
-DevPathToTextController (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- CONTROLLER_DEVICE_PATH *Controller;
-
- Controller = DevPath;
- CatPrint (
- Str,
- L"Ctrl(%x)",
- Controller->ControllerNumber
- );
-}
-
-STATIC
-VOID
-DevPathToTextAcpi (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- ACPI_HID_DEVICE_PATH *Acpi;
-
- Acpi = DevPath;
- if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
- if (AllowShortcuts) {
- switch (EISA_ID_TO_NUM (Acpi->HID)) {
- case 0x0a03:
- CatPrint (Str, L"PciRoot(%x)", Acpi->UID);
- break;
-
- case 0x0604:
- CatPrint (Str, L"Floppy(%x)", Acpi->UID);
- break;
-
- case 0x0301:
- CatPrint (Str, L"Keyboard(%x)", Acpi->UID);
- break;
-
- case 0x0501:
- CatPrint (Str, L"Serial(%x)", Acpi->UID);
- break;
-
- case 0x0401:
- CatPrint (Str, L"ParallelPort(%x)", Acpi->UID);
- break;
-
- default:
- break;
- }
-
- return ;
- }
-
- CatPrint (Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
- } else {
- CatPrint (Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);
- }
-}
-
-#define NextStrA(a) ((UINT8 *) (((UINT8 *) (a)) + AsciiStrLen ((CHAR8 *) (a)) + 1))
-
-STATIC
-VOID
-DevPathToTextExtAcpi (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR *AcpiExt;
- UINT8 *NextString;
-
- AcpiExt = DevPath;
-
- if (AllowShortcuts) {
- NextString = NextStrA (AcpiExt->HidUidCidStr);
- if ((*(AcpiExt->HidUidCidStr) == '\0') &&
- (*(NextStrA (NextString)) == '\0') &&
- (AcpiExt->UID == 0)
- ) {
- if ((AcpiExt->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
- CatPrint (
- Str,
- L"AcpiExp(PNP%04x,%x,%a)",
- EISA_ID_TO_NUM (AcpiExt->HID),
- AcpiExt->CID,
- NextStrA (AcpiExt->HidUidCidStr)
- );
- } else {
- CatPrint (
- Str,
- L"AcpiExp(%08x,%x,%a)",
- AcpiExt->HID,
- AcpiExt->CID,
- NextStrA (AcpiExt->HidUidCidStr)
- );
- }
- }
- return ;
- }
-
- NextString = NextStrA (AcpiExt->HidUidCidStr);
- NextString = NextStrA (NextString);
- if ((AcpiExt->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
- CatPrint (
- Str,
- L"AcpiEx(PNP%04x,%x,%x,%a,%a,%a)",
- EISA_ID_TO_NUM (AcpiExt->HID),
- AcpiExt->CID,
- AcpiExt->UID,
- AcpiExt->HidUidCidStr,
- NextString,
- NextStrA (AcpiExt->HidUidCidStr)
- );
- } else {
- CatPrint (
- Str,
- L"AcpiEx(%08x,%x,%x,%a,%a,%a)",
- AcpiExt->HID,
- AcpiExt->CID,
- AcpiExt->UID,
- AcpiExt->HidUidCidStr,
- NextString,
- NextStrA (AcpiExt->HidUidCidStr)
- );
- }
-}
-
-STATIC
-VOID
-DevPathToTextAtapi (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- ATAPI_DEVICE_PATH *Atapi;
-
- Atapi = DevPath;
-
- if (DisplayOnly) {
- CatPrint (Str, L"Ata(%x)", Atapi->Lun);
- } else {
- CatPrint (
- Str,
- L"Ata(%s,%s,%x)",
- Atapi->PrimarySecondary ? L"Secondary" : L"Primary",
- Atapi->SlaveMaster ? L"Slave" : L"Master",
- Atapi->Lun
- );
- }
-}
-
-STATIC
-VOID
-DevPathToTextScsi (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- SCSI_DEVICE_PATH *Scsi;
-
- Scsi = DevPath;
- CatPrint (Str, L"Scsi(%x,%x)", Scsi->Pun, Scsi->Lun);
-}
-
-STATIC
-VOID
-DevPathToTextFibre (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- FIBRECHANNEL_DEVICE_PATH *Fibre;
-
- Fibre = DevPath;
- CatPrint (Str, L"Fibre(%lx,%lx)", Fibre->WWN, Fibre->Lun);
-}
-
-STATIC
-VOID
-DevPathToText1394 (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- F1394_DEVICE_PATH *F1394;
-
- F1394 = DevPath;
- CatPrint (Str, L"I1394(%lx)", F1394->Guid);
-}
-
-STATIC
-VOID
-DevPathToTextUsb (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- USB_DEVICE_PATH *Usb;
-
- Usb = DevPath;
- CatPrint (Str, L"USB(%x,%x)", Usb->ParentPortNumber, Usb->InterfaceNumber);
-}
-
-STATIC
-VOID
-DevPathToTextUsbWWID (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- USB_WWID_DEVICE_PATH *UsbWWId;
-
- UsbWWId = DevPath;
- CatPrint (
- Str,
- L"UsbWwid(%x,%x,%x,\"WWID\")",
- UsbWWId->VendorId,
- UsbWWId->ProductId,
- UsbWWId->InterfaceNumber
- );
-}
-
-STATIC
-VOID
-DevPathToTextLogicalUnit (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;
-
- LogicalUnit = DevPath;
- CatPrint (Str, L"Unit(%x)", LogicalUnit->Lun);
-}
-
-STATIC
-VOID
-DevPathToTextUsbClass (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- USB_CLASS_DEVICE_PATH *UsbClass;
-
- UsbClass = DevPath;
-
- if (AllowShortcuts == TRUE) {
- switch (UsbClass->DeviceClass) {
- case 1:
- CatPrint (
- Str,
- L"UsbAudio(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 2:
- CatPrint (
- Str,
- L"UsbCDCControl(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 3:
- CatPrint (
- Str,
- L"UsbHID(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 6:
- CatPrint (
- Str,
- L"UsbImage(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 7:
- CatPrint (
- Str,
- L"UsbPrinter(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 8:
- CatPrint (
- Str,
- L"UsbMassStorage(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 9:
- CatPrint (
- Str,
- L"UsbHub(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 10:
- CatPrint (
- Str,
- L"UsbCDCData(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 11:
- CatPrint (
- Str,
- L"UsbSmartCard(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 14:
- CatPrint (
- Str,
- L"UsbVideo(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 220:
- CatPrint (
- Str,
- L"UsbDiagnostic(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 224:
- CatPrint (
- Str,
- L"UsbWireless(%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
- break;
-
- case 254:
- if (UsbClass->DeviceSubClass == 1) {
- CatPrint (
- Str,
- L"UsbDeviceFirmwareUpdate(%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceProtocol
- );
- } else if (UsbClass->DeviceSubClass == 2) {
- CatPrint (
- Str,
- L"UsbIrdaBridge(%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceProtocol
- );
- } else if (UsbClass->DeviceSubClass == 3) {
- CatPrint (
- Str,
- L"UsbTestAndMeasurement(%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceProtocol
- );
- }
- break;
-
- default:
- break;
- }
-
- return ;
- }
-
- CatPrint (
- Str,
- L"UsbClass(%x,%x,%x,%x,%x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceClass,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
-}
-
-STATIC
-VOID
-DevPathToTextI2O (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- I2O_DEVICE_PATH *I2O;
-
- I2O = DevPath;
- CatPrint (Str, L"I2O(%x)", I2O->Tid);
-}
-
-STATIC
-VOID
-DevPathToTextMacAddr (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- MAC_ADDR_DEVICE_PATH *MAC;
- UINTN HwAddressSize;
- UINTN Index;
-
- MAC = DevPath;
-
- HwAddressSize = sizeof (EFI_MAC_ADDRESS);
- if (MAC->IfType == 0x01 || MAC->IfType == 0x00) {
- HwAddressSize = 6;
- }
-
- CatPrint (Str, L"MAC(");
-
- for (Index = 0; Index < HwAddressSize; Index++) {
- CatPrint (Str, L"%02x", MAC->MacAddress.Addr[Index]);
- }
-
- CatPrint (Str, L",%x)", MAC->IfType);
-}
-
-STATIC
-VOID
-DevPathToTextIPv4 (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- IPv4_DEVICE_PATH *IP;
-
- IP = DevPath;
- if (DisplayOnly == TRUE) {
- CatPrint (
- Str,
- L"IPv4(%d.%d.%d.%d)",
- IP->RemoteIpAddress.Addr[0],
- IP->RemoteIpAddress.Addr[1],
- IP->RemoteIpAddress.Addr[2],
- IP->RemoteIpAddress.Addr[3]
- );
- return ;
- }
-
- CatPrint (
- Str,
- L"IPv4(%d.%d.%d.%d,%s,%s,%d.%d.%d.%d)",
- IP->RemoteIpAddress.Addr[0],
- IP->RemoteIpAddress.Addr[1],
- IP->RemoteIpAddress.Addr[2],
- IP->RemoteIpAddress.Addr[3],
- IP->Protocol ? L"TCP" : L"UDP",
- (IP->StaticIpAddress == TRUE) ? L"Static" : L"DHCP",
- IP->LocalIpAddress.Addr[0],
- IP->LocalIpAddress.Addr[1],
- IP->LocalIpAddress.Addr[2],
- IP->LocalIpAddress.Addr[3]
- );
-}
-
-STATIC
-VOID
-DevPathToTextIPv6 (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- IPv6_DEVICE_PATH *IP;
-
- IP = DevPath;
- if (DisplayOnly == TRUE) {
- CatPrint (
- Str,
- L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
- IP->RemoteIpAddress.Addr[0],
- IP->RemoteIpAddress.Addr[1],
- IP->RemoteIpAddress.Addr[2],
- IP->RemoteIpAddress.Addr[3],
- IP->RemoteIpAddress.Addr[4],
- IP->RemoteIpAddress.Addr[5],
- IP->RemoteIpAddress.Addr[6],
- IP->RemoteIpAddress.Addr[7],
- IP->RemoteIpAddress.Addr[8],
- IP->RemoteIpAddress.Addr[9],
- IP->RemoteIpAddress.Addr[10],
- IP->RemoteIpAddress.Addr[11],
- IP->RemoteIpAddress.Addr[12],
- IP->RemoteIpAddress.Addr[13],
- IP->RemoteIpAddress.Addr[14],
- IP->RemoteIpAddress.Addr[15]
- );
- return ;
- }
-
- CatPrint (
- Str,
- L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x,%s,%s,%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",
- IP->RemoteIpAddress.Addr[0],
- IP->RemoteIpAddress.Addr[1],
- IP->RemoteIpAddress.Addr[2],
- IP->RemoteIpAddress.Addr[3],
- IP->RemoteIpAddress.Addr[4],
- IP->RemoteIpAddress.Addr[5],
- IP->RemoteIpAddress.Addr[6],
- IP->RemoteIpAddress.Addr[7],
- IP->RemoteIpAddress.Addr[8],
- IP->RemoteIpAddress.Addr[9],
- IP->RemoteIpAddress.Addr[10],
- IP->RemoteIpAddress.Addr[11],
- IP->RemoteIpAddress.Addr[12],
- IP->RemoteIpAddress.Addr[13],
- IP->RemoteIpAddress.Addr[14],
- IP->RemoteIpAddress.Addr[15],
- IP->Protocol ? L"TCP" : L"UDP",
- (IP->StaticIpAddress == TRUE) ? L"Static" : L"DHCP",
- IP->LocalIpAddress.Addr[0],
- IP->LocalIpAddress.Addr[1],
- IP->LocalIpAddress.Addr[2],
- IP->LocalIpAddress.Addr[3],
- IP->LocalIpAddress.Addr[4],
- IP->LocalIpAddress.Addr[5],
- IP->LocalIpAddress.Addr[6],
- IP->LocalIpAddress.Addr[7],
- IP->LocalIpAddress.Addr[8],
- IP->LocalIpAddress.Addr[9],
- IP->LocalIpAddress.Addr[10],
- IP->LocalIpAddress.Addr[11],
- IP->LocalIpAddress.Addr[12],
- IP->LocalIpAddress.Addr[13],
- IP->LocalIpAddress.Addr[14],
- IP->LocalIpAddress.Addr[15]
- );
-}
-
-STATIC
-VOID
-DevPathToTextInfiniBand (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- INFINIBAND_DEVICE_PATH *InfiniBand;
-
- InfiniBand = DevPath;
- CatPrint (
- Str,
- L"Infiniband(%x,%g,%lx,%lx,%lx)",
- InfiniBand->ResourceFlags,
- InfiniBand->PortGid,
- InfiniBand->ServiceId,
- InfiniBand->TargetPortId,
- InfiniBand->DeviceId
- );
-}
-
-STATIC
-VOID
-DevPathToTextUart (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- UART_DEVICE_PATH *Uart;
- CHAR8 Parity;
-
- Uart = DevPath;
- switch (Uart->Parity) {
- case 0:
- Parity = 'D';
- break;
-
- case 1:
- Parity = 'N';
- break;
-
- case 2:
- Parity = 'E';
- break;
-
- case 3:
- Parity = 'O';
- break;
-
- case 4:
- Parity = 'M';
- break;
-
- case 5:
- Parity = 'S';
- break;
-
- default:
- Parity = 'x';
- break;
- }
-
- if (Uart->BaudRate == 0) {
- CatPrint (Str, L"Uart(DEFAULT,");
- } else {
- CatPrint (Str, L"Uart(%ld,", Uart->BaudRate);
- }
-
- if (Uart->DataBits == 0) {
- CatPrint (Str, L"DEFAULT,");
- } else {
- CatPrint (Str, L"%d,", Uart->DataBits);
- }
-
- CatPrint (Str, L"%c,", Parity);
-
- switch (Uart->StopBits) {
- case 0:
- CatPrint (Str, L"D)");
- break;
-
- case 1:
- CatPrint (Str, L"1)");
- break;
-
- case 2:
- CatPrint (Str, L"1.5)");
- break;
-
- case 3:
- CatPrint (Str, L"2)");
- break;
-
- default:
- CatPrint (Str, L"x)");
- break;
- }
-}
-
-STATIC
-VOID
-DevPathToTextiSCSI (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- ISCSI_DEVICE_PATH_WITH_NAME *iSCSI;
- UINT16 Options;
-
- iSCSI = DevPath;
- CatPrint (
- Str,
- L"iSCSI(%s,%x,%lx,",
- iSCSI->iSCSITargetName,
- iSCSI->TargetPortalGroupTag,
- iSCSI->Lun
- );
-
- Options = iSCSI->LoginOption;
- CatPrint (Str, L"%s,", ((Options >> 1) & 0x0001) ? L"CRC32C" : L"None");
- CatPrint (Str, L"%s,", ((Options >> 3) & 0x0001) ? L"CRC32C" : L"None");
- if ((Options >> 11) & 0x0001) {
- CatPrint (Str, L"%s,", L"None");
- } else if ((Options >> 12) & 0x0001) {
- CatPrint (Str, L"%s,", L"CHAP_UNI");
- } else {
- CatPrint (Str, L"%s,", L"CHAP_BI");
-
- }
-
- CatPrint (Str, L"%s)", (iSCSI->NetworkProtocol == 0) ? L"TCP" : L"reserved");
-}
-
-STATIC
-VOID
-DevPathToTextHardDrive (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- HARDDRIVE_DEVICE_PATH *Hd;
-
- Hd = DevPath;
- switch (Hd->SignatureType) {
- case 0:
- CatPrint (
- Str,
- L"HD(%d,%s,0,",
- Hd->PartitionNumber,
- L"None"
- );
- break;
-
- case SIGNATURE_TYPE_MBR:
- CatPrint (
- Str,
- L"HD(%d,%s,%08x,",
- Hd->PartitionNumber,
- L"MBR",
- *((UINT32 *) (&(Hd->Signature[0])))
- );
- break;
-
- case SIGNATURE_TYPE_GUID:
- CatPrint (
- Str,
- L"HD(%d,%s,%g,",
- Hd->PartitionNumber,
- L"GUID",
- (EFI_GUID *) &(Hd->Signature[0])
- );
- break;
-
- default:
- break;
- }
-
- CatPrint (Str, L"%lx,%lx)", Hd->PartitionStart, Hd->PartitionSize);
-}
-
-STATIC
-VOID
-DevPathToTextCDROM (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- CDROM_DEVICE_PATH *Cd;
-
- Cd = DevPath;
- if (DisplayOnly == TRUE) {
- CatPrint (Str, L"CDROM(%x)", Cd->BootEntry);
- return ;
- }
-
- CatPrint (Str, L"CDROM(%x,%lx,%lx)", Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize);
-}
-
-STATIC
-VOID
-DevPathToTextFilePath (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- FILEPATH_DEVICE_PATH *Fp;
-
- Fp = DevPath;
- CatPrint (Str, L"%s", Fp->PathName);
-}
-
-STATIC
-VOID
-DevPathToTextMediaProtocol (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- MEDIA_PROTOCOL_DEVICE_PATH *MediaProt;
-
- MediaProt = DevPath;
- CatPrint (Str, L"Media(%g)", &MediaProt->Protocol);
-}
-
-STATIC
-VOID
-DevPathToTextBBS (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- BBS_BBS_DEVICE_PATH *Bbs;
- CHAR16 *Type;
-
- Bbs = DevPath;
- switch (Bbs->DeviceType) {
- case BBS_TYPE_FLOPPY:
- Type = L"Floppy";
- break;
-
- case BBS_TYPE_HARDDRIVE:
- Type = L"HD";
- break;
-
- case BBS_TYPE_CDROM:
- Type = L"CDROM";
- break;
-
- case BBS_TYPE_PCMCIA:
- Type = L"PCMCIA";
- break;
-
- case BBS_TYPE_USB:
- Type = L"USB";
- break;
-
- case BBS_TYPE_EMBEDDED_NETWORK:
- Type = L"Network";
- break;
-
- default:
- Type = L"?";
- break;
- }
-
- CatPrint (Str, L"BBS(%s,%a", Type, Bbs->String);
-
- if (DisplayOnly == TRUE) {
- CatPrint (Str, L")");
- return ;
- }
-
- CatPrint (Str, L",%x)", Bbs->StatusFlag);
-}
-
-STATIC
-VOID
-DevPathToTextEndInstance (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- CatPrint (Str, L",");
-}
-
-STATIC
-VOID
-DevPathToTextNodeUnknown (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-{
- CatPrint (Str, L"?");
-}
-
-GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable[] = {
- {HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci},
- {HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard},
- {HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap},
- {HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor},
- {HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController},
- {ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi},
- {ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextExtAcpi},
- {MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi},
- {MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi},
- {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre},
- {MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394},
- {MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb},
- {MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID},
- {MESSAGING_DEVICE_PATH, MSG_DEVICE_LOGICAL_UNIT_DP, DevPathToTextLogicalUnit},
- {MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, DevPathToTextUsbClass},
- {MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O},
- {MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr},
- {MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4},
- {MESSAGING_DEVICE_PATH, MSG_IPv6_DP, DevPathToTextIPv6},
- {MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, DevPathToTextInfiniBand},
- {MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart},
- {MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor},
- {MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI},
- {MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive},
- {MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM},
- {MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor},
- {MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},
- {MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol},
- {MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},
- {BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS},
- {END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance},
- {0, 0, NULL}
-};
-
-CHAR16 *
-ConvertDeviceNodeToText (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-/*++
-
- Routine Description:
- Convert a device node to its text representation.
-
- Arguments:
- DeviceNode - Points to the device node to be converted.
- DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
- of the display node is used, where applicable. If DisplayOnly
- is FALSE, then the longer text representation of the display node
- is used.
- AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
- representation for a device node can be used, where applicable.
-
- Returns:
- A pointer - a pointer to the allocated text representation of the device node.
- NULL - if DeviceNode is NULL or there was insufficient memory.
-
---*/
-{
- POOL_PRINT Str;
- UINTN Index;
- UINTN NewSize;
- VOID (*DumpNode)(POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);
-
- if (DeviceNode == NULL) {
- return NULL;
- }
-
- ZeroMem (&Str, sizeof (Str));
-
- //
- // Process the device path node
- //
- DumpNode = NULL;
- for (Index = 0; DevPathToTextTable[Index].Function != NULL; Index++) {
- if (DevicePathType (DeviceNode) == DevPathToTextTable[Index].Type &&
- DevicePathSubType (DeviceNode) == DevPathToTextTable[Index].SubType
- ) {
- DumpNode = DevPathToTextTable[Index].Function;
- break;
- }
- }
- //
- // If not found, use a generic function
- //
- if (DumpNode == NULL) {
- DumpNode = DevPathToTextNodeUnknown;
- }
-
- //
- // Print this node
- //
- DumpNode (&Str, (VOID *) DeviceNode, DisplayOnly, AllowShortcuts);
-
- //
- // Shrink pool used for string allocation
- //
- NewSize = (Str.Len + 1) * sizeof (CHAR16);
- Str.Str = ReallocatePool (Str.Str, NewSize, NewSize);
- ASSERT (Str.Str != NULL);
- Str.Str[Str.Len] = 0;
- return Str.Str;
-}
-
-CHAR16 *
-ConvertDevicePathToText (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN BOOLEAN DisplayOnly,
- IN BOOLEAN AllowShortcuts
- )
-/*++
-
- Routine Description:
- Convert a device path to its text representation.
-
- Arguments:
- DeviceNode - Points to the device path to be converted.
- DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
- of the display node is used, where applicable. If DisplayOnly
- is FALSE, then the longer text representation of the display node
- is used.
- AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
- representation for a device node can be used, where applicable.
-
- Returns:
- A pointer - a pointer to the allocated text representation of the device path.
- NULL - if DeviceNode is NULL or there was insufficient memory.
-
---*/
-{
- POOL_PRINT Str;
- EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
- EFI_DEVICE_PATH_PROTOCOL *UnpackDevPath;
- UINTN Index;
- UINTN NewSize;
- VOID (*DumpNode) (POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);
-
- if (DevicePath == NULL) {
- return NULL;
- }
-
- ZeroMem (&Str, sizeof (Str));
-
- //
- // Unpacked the device path
- //
- UnpackDevPath = UnpackDevicePath ((EFI_DEVICE_PATH_PROTOCOL *) DevicePath);
- ASSERT (UnpackDevPath != NULL);
-
- //
- // Process each device path node
- //
- DevPathNode = UnpackDevPath;
- while (!IsDevicePathEnd (DevPathNode)) {
- //
- // Find the handler to dump this device path node
- //
- DumpNode = NULL;
- for (Index = 0; DevPathToTextTable[Index].Function; Index += 1) {
-
- if (DevicePathType (DevPathNode) == DevPathToTextTable[Index].Type &&
- DevicePathSubType (DevPathNode) == DevPathToTextTable[Index].SubType
- ) {
- DumpNode = DevPathToTextTable[Index].Function;
- break;
- }
- }
- //
- // If not found, use a generic function
- //
- if (!DumpNode) {
- DumpNode = DevPathToTextNodeUnknown;
- }
- //
- // Put a path seperator in if needed
- //
- if (Str.Len && DumpNode != DevPathToTextEndInstance) {
- if (*(Str.Str + Str.Len / sizeof (CHAR16) - 1) != L',') {
- CatPrint (&Str, L"/");
- }
- }
- //
- // Print this node of the device path
- //
- DumpNode (&Str, DevPathNode, DisplayOnly, AllowShortcuts);
-
- //
- // Next device path node
- //
- DevPathNode = NextDevicePathNode (DevPathNode);
- }
- //
- // Shrink pool used for string allocation
- //
- FreePool (UnpackDevPath);
-
- NewSize = (Str.Len + 1) * sizeof (CHAR16);
- Str.Str = ReallocatePool (Str.Str, NewSize, NewSize);
- ASSERT (Str.Str != NULL);
- Str.Str[Str.Len] = 0;
- return Str.Str;
-}
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathUtilities.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathUtilities.c
deleted file mode 100644
index 548a534..0000000
--- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathUtilities.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DevicePathUtilities.c
-
-Abstract:
-
- Implementation file for Device Path Utilities Protocol
-
---*/
-
-#include "DevicePath.h"
-
-UINTN
-GetDevicePathSizeProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
- Routine Description:
- Returns the size of the device path, in bytes.
-
- Arguments:
- DevicePath - Points to the start of the EFI device path.
-
- Returns:
- Size - Size of the specified device path, in bytes, including the end-of-path tag.
-
---*/
-{
- return GetDevicePathSize (DevicePath);
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-DuplicateDevicePathProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
- Routine Description:
- Create a duplicate of the specified path.
-
- Arguments:
- DevicePath - Points to the source EFI device path.
-
- Returns:
- Pointer - A pointer to the duplicate device path.
- NULL - Insufficient memory.
-
---*/
-{
- return DuplicateDevicePath (DevicePath);
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-AppendDevicePathProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2
- )
-/*++
-
- Routine Description:
- Create a new path by appending the second device path to the first.
-
- Arguments:
- Src1 - Points to the first device path. If NULL, then it is ignored.
- Src2 - Points to the second device path. If NULL, then it is ignored.
-
- Returns:
- Pointer - A pointer to the newly created device path.
- NULL - Memory could not be allocated
- or either DevicePath or DeviceNode is NULL.
-
---*/
-{
- return AppendDevicePath (Src1, Src2);
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-AppendDeviceNodeProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
- )
-/*++
-
- Routine Description:
- Creates a new path by appending the device node to the device path.
-
- Arguments:
- DevicePath - Points to the device path.
- DeviceNode - Points to the device node.
-
- Returns:
- Pointer - A pointer to the allocated device node.
- NULL - Memory could not be allocated
- or either DevicePath or DeviceNode is NULL.
-
---*/
-{
- return AppendDevicePathNode (DevicePath, DeviceNode);
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-AppendDevicePathInstanceProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
- )
-/*++
-
- Routine Description:
- Creates a new path by appending the specified device path instance to the specified device path.
-
- Arguments:
- DevicePath - Points to the device path. If NULL, then ignored.
- DevicePathInstance - Points to the device path instance.
-
- Returns:
- Pointer - A pointer to the newly created device path
- NULL - Memory could not be allocated or DevicePathInstance is NULL.
-
---*/
-{
- return AppendDevicePathInstance (DevicePath, DevicePathInstance);
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-GetNextDevicePathInstanceProtocolInterface (
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
- OUT UINTN *DevicePathInstanceSize
- )
-/*++
-
- Routine Description:
- Creates a copy of the current device path instance and returns a pointer to the next device path instance.
-
- Arguments:
- DevicePathInstance - On input, this holds the pointer to the current device path
- instance. On output, this holds the pointer to the next
- device path instance or NULL if there are no more device
- path instances in the device path.
- DevicePathInstanceSize - On output, this holds the size of the device path instance,
- in bytes or zero, if DevicePathInstance is zero.
-
- Returns:
- Pointer - A pointer to the copy of the current device path instance.
- NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
-
---*/
-{
- return GetNextDevicePathInstance (DevicePathInstance, DevicePathInstanceSize);
-}
-
-BOOLEAN
-IsDevicePathMultiInstanceProtocolInterface (
- IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
- Routine Description:
- Returns whether a device path is multi-instance.
-
- Arguments:
- DevicePath - Points to the device path. If NULL, then ignored.
-
- Returns:
- TRUE - The device path has more than one instance
- FALSE - The device path is empty or contains only a single instance.
-
---*/
-{
- return IsDevicePathMultiInstance (DevicePath);
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-CreateDeviceNodeProtocolInterface (
- IN UINT8 NodeType,
- IN UINT8 NodeSubType,
- IN UINT16 NodeLength
- )
-/*++
-
- Routine Description:
- Creates a device node
-
- Arguments:
- NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
- the new device node.
- NodeSubType - NodeSubType is the device node sub-type
- EFI_DEVICE_PATH.SubType) for the new device node.
- NodeLength - NodeLength is the length of the device node
- (EFI_DEVICE_PATH.Length) for the new device node.
-
- Returns:
- Pointer - A pointer to the newly created device node.
- NULL - NodeLength is less than
- the size of the header or there was insufficient memory.
-
---*/
-{
- return CreateDeviceNode (NodeType, NodeSubType, NodeLength);
-}
diff --git a/EdkModulePkg/Universal/Disk/DiskIo/Dxe/ComponentName.c b/EdkModulePkg/Universal/Disk/DiskIo/Dxe/ComponentName.c
deleted file mode 100644
index 86ed5f2..0000000
--- a/EdkModulePkg/Universal/Disk/DiskIo/Dxe/ComponentName.c
+++ /dev/null
@@ -1,139 +0,0 @@
- /*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "DiskIo.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gDiskIoComponentName = {
- DiskIoComponentNameGetDriverName,
- DiskIoComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mDiskIoDriverNameTable[] = {
- {
- "eng",
- (CHAR16 *)L"Generic Disk I/O Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-DiskIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gDiskIoComponentName.SupportedLanguages,
- mDiskIoDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-DiskIoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Universal/Disk/DiskIo/Dxe/DiskIo.h b/EdkModulePkg/Universal/Disk/DiskIo/Dxe/DiskIo.h
deleted file mode 100644
index cdb6739..0000000
--- a/EdkModulePkg/Universal/Disk/DiskIo/Dxe/DiskIo.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DiskIo.h
-
-Abstract:
- Private Data definition for Disk IO driver
-
---*/
-
-#ifndef _DISK_IO_H
-#define _DISK_IO_H
-
-
-
-#define DISK_IO_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('d', 's', 'k', 'I')
-
-#define DATA_BUFFER_BLOCK_NUM (64)
-
-typedef struct {
- UINTN Signature;
- EFI_DISK_IO_PROTOCOL DiskIo;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
-} DISK_IO_PRIVATE_DATA;
-
-#define DISK_IO_PRIVATE_DATA_FROM_THIS(a) CR (a, DISK_IO_PRIVATE_DATA, DiskIo, DISK_IO_PRIVATE_DATA_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gDiskIoComponentName;
-
-//
-// Prototypes
-// Driver model protocol interface
-//
-EFI_STATUS
-EFIAPI
-DiskIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-DiskIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-DiskIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// Disk I/O Protocol Interface
-//
-EFI_STATUS
-EFIAPI
-DiskIoReadDisk (
- IN EFI_DISK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Offset,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- );
-
-EFI_STATUS
-EFIAPI
-DiskIoWriteDisk (
- IN EFI_DISK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Offset,
- IN UINTN BufferSize,
- IN VOID *Buffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-DiskIoComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-DiskIoComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-#endif
diff --git a/EdkModulePkg/Universal/Disk/DiskIo/Dxe/DiskIo.msa b/EdkModulePkg/Universal/Disk/DiskIo/Dxe/DiskIo.msa
deleted file mode 100644
index f5b93c8..0000000
--- a/EdkModulePkg/Universal/Disk/DiskIo/Dxe/DiskIo.msa
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>DiskIo</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>6B38F7B4-AD98-40e9-9093-ACA2B5A253C4</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for DiskIo module.</Abstract>
- <Description>DiskIo driver that layers it's self on every Block IO protocol in the system.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DiskIo</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>diskio.c</Filename>
- <Filename>DiskIo.h</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiDiskIoProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gDiskIoDriverBinding</DriverBinding>
- <ComponentName>gDiskIoComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Universal/Disk/DiskIo/Dxe/diskio.c b/EdkModulePkg/Universal/Disk/DiskIo/Dxe/diskio.c
deleted file mode 100644
index d71e0aa..0000000
--- a/EdkModulePkg/Universal/Disk/DiskIo/Dxe/diskio.c
+++ /dev/null
@@ -1,729 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DiskIo.c
-
-Abstract:
-
- DiskIo driver that layers it's self on every Block IO protocol in the system.
- DiskIo converts a block oriented device to a byte oriented device.
-
- ReadDisk may have to do reads that are not aligned on sector boundaries.
- There are three cases:
-
- UnderRun - The first byte is not on a sector boundary or the read request is
- less than a sector in length.
-
- Aligned - A read of N contiguous sectors.
-
- OverRun - The last byte is not on a sector boundary.
-
---*/
-
-#include "DiskIo.h"
-
-EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {
- DiskIoDriverBindingSupported,
- DiskIoDriverBindingStart,
- DiskIoDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-DISK_IO_PRIVATE_DATA gDiskIoPrivateDataTemplate = {
- DISK_IO_PRIVATE_DATA_SIGNATURE,
- {
- EFI_DISK_IO_PROTOCOL_REVISION,
- DiskIoReadDisk,
- DiskIoWriteDisk
- },
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-DiskIoDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- than contains a BlockIo protocol can be supported.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to test.
- RemainingDevicePath - Not used.
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_ALREADY_STARTED - This driver is already running on this device.
- other - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test.
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlockIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Close the I/O Abstraction(s) used to perform the supported test.
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-DiskIoDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
- )
-/*++
-
- Routine Description:
- Start this driver on ControllerHandle by opening a Block IO protocol and
- installing a Disk IO protocol on ControllerHandle.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to bind driver to.
- RemainingDevicePath - Not used, always produce all possible children.
-
- Returns:
- EFI_SUCCESS - This driver is added to ControllerHandle.
- EFI_ALREADY_STARTED - This driver is already running on ControllerHandle.
- other - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- DISK_IO_PRIVATE_DATA *Private;
-
- Private = NULL;
-
- //
- // Connect to the Block IO interface on ControllerHandle.
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &gDiskIoPrivateDataTemplate.BlockIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Initialize the Disk IO device instance.
- //
- Private = AllocateCopyPool (sizeof (DISK_IO_PRIVATE_DATA), &gDiskIoPrivateDataTemplate);
- if (Private == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrorExit;
- }
- //
- // Install protocol interfaces for the Disk IO device.
- //
- Status = gBS->InstallProtocolInterface (
- &ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &Private->DiskIo
- );
-
-ErrorExit:
- if (EFI_ERROR (Status)) {
-
- if (Private != NULL) {
- FreePool (Private);
- }
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-DiskIoDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop this driver on ControllerHandle by removing Disk IO protocol and closing
- the Block IO protocol on ControllerHandle.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to stop driver on.
- NumberOfChildren - Not used.
- ChildHandleBuffer - Not used.
-
- Returns:
- EFI_SUCCESS - This driver is removed ControllerHandle.
- other - This driver was not removed from this device.
- EFI_UNSUPPORTED
-
---*/
-{
- EFI_STATUS Status;
- EFI_DISK_IO_PROTOCOL *DiskIo;
- DISK_IO_PRIVATE_DATA *Private;
-
- //
- // Get our context back.
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- (VOID **) &DiskIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = DISK_IO_PRIVATE_DATA_FROM_THIS (DiskIo);
-
- Status = gBS->UninstallProtocolInterface (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- &Private->DiskIo
- );
- if (!EFI_ERROR (Status)) {
-
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
-
- if (!EFI_ERROR (Status)) {
- FreePool (Private);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-DiskIoReadDisk (
- IN EFI_DISK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Offset,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
- Routine Description:
- Read BufferSize bytes from Offset into Buffer.
-
- Reads may support reads that are not aligned on
- sector boundaries. There are three cases:
-
- UnderRun - The first byte is not on a sector boundary or the read request is
- less than a sector in length.
-
- Aligned - A read of N contiguous sectors.
-
- OverRun - The last byte is not on a sector boundary.
-
-
- Arguments:
- This - Protocol instance pointer.
- MediaId - Id of the media, changes every time the media is replaced.
- Offset - The starting byte offset to read from.
- BufferSize - Size of Buffer.
- Buffer - Buffer containing read data.
-
- Returns:
- EFI_SUCCESS - The data was read correctly from the device.
- EFI_DEVICE_ERROR - The device reported an error while performing the read.
- EFI_NO_MEDIA - There is no media in the device.
- EFI_MEDIA_CHNAGED - The MediaId does not matched the current device.
- EFI_INVALID_PARAMETER - The read request contains device addresses that are not
- valid for the device.
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- EFI_STATUS Status;
- DISK_IO_PRIVATE_DATA *Private;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_BLOCK_IO_MEDIA *Media;
- UINT32 BlockSize;
- UINT64 Lba;
- UINT64 OverRunLba;
- UINT32 UnderRun;
- UINT32 OverRun;
- BOOLEAN TransactionComplete;
- UINTN WorkingBufferSize;
- UINT8 *WorkingBuffer;
- UINTN Length;
- UINT8 *Data;
- UINT8 *PreData;
- UINTN IsBufferAligned;
- UINTN DataBufferSize;
- BOOLEAN LastRead;
-
- Private = DISK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- BlockIo = Private->BlockIo;
- Media = BlockIo->Media;
- BlockSize = Media->BlockSize;
-
- if (Media->MediaId != MediaId) {
- return EFI_MEDIA_CHANGED;
- }
-
- WorkingBuffer = Buffer;
- WorkingBufferSize = BufferSize;
-
- //
- // Allocate a temporary buffer for operation
- //
- DataBufferSize = BlockSize * DATA_BUFFER_BLOCK_NUM;
-
- if (Media->IoAlign > 1) {
- PreData = AllocatePool (DataBufferSize + Media->IoAlign);
- Data = PreData - ((UINTN) PreData & (Media->IoAlign - 1)) + Media->IoAlign;
- } else {
- PreData = AllocatePool (DataBufferSize);
- Data = PreData;
- }
-
- if (PreData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Lba = DivU64x32Remainder (Offset, BlockSize, &UnderRun);
-
- Length = BlockSize - UnderRun;
- TransactionComplete = FALSE;
-
- Status = EFI_SUCCESS;
- if (UnderRun != 0) {
- //
- // Offset starts in the middle of an Lba, so read the entire block.
- //
- Status = BlockIo->ReadBlocks (
- BlockIo,
- MediaId,
- Lba,
- BlockSize,
- Data
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- if (Length > BufferSize) {
- Length = BufferSize;
- TransactionComplete = TRUE;
- }
-
- CopyMem (WorkingBuffer, Data + UnderRun, Length);
-
- WorkingBuffer += Length;
-
- WorkingBufferSize -= Length;
- if (WorkingBufferSize == 0) {
- goto Done;
- }
-
- Lba += 1;
- }
-
- OverRunLba = Lba + DivU64x32Remainder (WorkingBufferSize, BlockSize, &OverRun);
-
- if (!TransactionComplete && WorkingBufferSize >= BlockSize) {
- //
- // If the DiskIo maps directly to a BlockIo device do the read.
- //
- if (OverRun != 0) {
- WorkingBufferSize -= OverRun;
- }
- //
- // Check buffer alignment
- //
- IsBufferAligned = (UINTN) WorkingBuffer & (UINTN) (Media->IoAlign - 1);
-
- if (Media->IoAlign <= 1 || IsBufferAligned == 0) {
- //
- // Alignment is satisfied, so read them together
- //
- Status = BlockIo->ReadBlocks (
- BlockIo,
- MediaId,
- Lba,
- WorkingBufferSize,
- WorkingBuffer
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- WorkingBuffer += WorkingBufferSize;
-
- } else {
- //
- // Use the allocated buffer instead of the original buffer
- // to avoid alignment issue.
- // Here, the allocated buffer (8-byte align) can satisfy the alignment
- //
- LastRead = FALSE;
- do {
- if (WorkingBufferSize <= DataBufferSize) {
- //
- // It is the last calling to readblocks in this loop
- //
- DataBufferSize = WorkingBufferSize;
- LastRead = TRUE;
- }
-
- Status = BlockIo->ReadBlocks (
- BlockIo,
- MediaId,
- Lba,
- DataBufferSize,
- Data
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- CopyMem (WorkingBuffer, Data, DataBufferSize);
- WorkingBufferSize -= DataBufferSize;
- WorkingBuffer += DataBufferSize;
- Lba += DATA_BUFFER_BLOCK_NUM;
- } while (!LastRead);
- }
- }
-
- if (!TransactionComplete && OverRun != 0) {
- //
- // Last read is not a complete block.
- //
- Status = BlockIo->ReadBlocks (
- BlockIo,
- MediaId,
- OverRunLba,
- BlockSize,
- Data
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- CopyMem (WorkingBuffer, Data, OverRun);
- }
-
-Done:
- if (PreData != NULL) {
- FreePool (PreData);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-DiskIoWriteDisk (
- IN EFI_DISK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN UINT64 Offset,
- IN UINTN BufferSize,
- IN VOID *Buffer
- )
-/*++
-
- Routine Description:
- Read BufferSize bytes from Offset into Buffer.
-
- Writes may require a read modify write to support writes that are not
- aligned on sector boundaries. There are three cases:
-
- UnderRun - The first byte is not on a sector boundary or the write request
- is less than a sector in length. Read modify write is required.
-
- Aligned - A write of N contiguous sectors.
-
- OverRun - The last byte is not on a sector boundary. Read modified write
- required.
-
- Arguments:
- This - Protocol instance pointer.
- MediaId - Id of the media, changes every time the media is replaced.
- Offset - The starting byte offset to read from.
- BufferSize - Size of Buffer.
- Buffer - Buffer containing read data.
-
- Returns:
- EFI_SUCCESS - The data was written correctly to the device.
- EFI_WRITE_PROTECTED - The device can not be written to.
- EFI_DEVICE_ERROR - The device reported an error while performing the write.
- EFI_NO_MEDIA - There is no media in the device.
- EFI_MEDIA_CHNAGED - The MediaId does not matched the current device.
- EFI_INVALID_PARAMETER - The write request contains device addresses that are not
- valid for the device.
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- EFI_STATUS Status;
- DISK_IO_PRIVATE_DATA *Private;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_BLOCK_IO_MEDIA *Media;
- UINT32 BlockSize;
- UINT64 Lba;
- UINT64 OverRunLba;
- UINT32 UnderRun;
- UINT32 OverRun;
- BOOLEAN TransactionComplete;
- UINTN WorkingBufferSize;
- UINT8 *WorkingBuffer;
- UINTN Length;
- UINT8 *Data;
- UINT8 *PreData;
- UINTN IsBufferAligned;
- UINTN DataBufferSize;
- BOOLEAN LastWrite;
-
- Private = DISK_IO_PRIVATE_DATA_FROM_THIS (This);
-
- BlockIo = Private->BlockIo;
- Media = BlockIo->Media;
- BlockSize = Media->BlockSize;
-
- if (Media->ReadOnly) {
- return EFI_WRITE_PROTECTED;
- }
-
- if (Media->MediaId != MediaId) {
- return EFI_MEDIA_CHANGED;
- }
-
- DataBufferSize = BlockSize * DATA_BUFFER_BLOCK_NUM;
-
- if (Media->IoAlign > 1) {
- PreData = AllocatePool (DataBufferSize + Media->IoAlign);
- Data = PreData - ((UINTN) PreData & (Media->IoAlign - 1)) + Media->IoAlign;
- } else {
- PreData = AllocatePool (DataBufferSize);
- Data = PreData;
- }
-
- if (PreData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- WorkingBuffer = Buffer;
- WorkingBufferSize = BufferSize;
-
- Lba = DivU64x32Remainder (Offset, BlockSize, &UnderRun);
-
- Length = BlockSize - UnderRun;
- TransactionComplete = FALSE;
-
- Status = EFI_SUCCESS;
- if (UnderRun != 0) {
- //
- // Offset starts in the middle of an Lba, so do read modify write.
- //
- Status = BlockIo->ReadBlocks (
- BlockIo,
- MediaId,
- Lba,
- BlockSize,
- Data
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- if (Length > BufferSize) {
- Length = BufferSize;
- TransactionComplete = TRUE;
- }
-
- CopyMem (Data + UnderRun, WorkingBuffer, Length);
-
- Status = BlockIo->WriteBlocks (
- BlockIo,
- MediaId,
- Lba,
- BlockSize,
- Data
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- WorkingBuffer += Length;
- WorkingBufferSize -= Length;
- if (WorkingBufferSize == 0) {
- goto Done;
- }
-
- Lba += 1;
- }
-
- OverRunLba = Lba + DivU64x32Remainder (WorkingBufferSize, BlockSize, &OverRun);
-
- if (!TransactionComplete && WorkingBufferSize >= BlockSize) {
- //
- // If the DiskIo maps directly to a BlockIo device do the write.
- //
- if (OverRun != 0) {
- WorkingBufferSize -= OverRun;
- }
- //
- // Check buffer alignment
- //
- IsBufferAligned = (UINTN) WorkingBuffer & (UINTN) (Media->IoAlign - 1);
-
- if (Media->IoAlign <= 1 || IsBufferAligned == 0) {
- //
- // Alignment is satisfied, so write them together
- //
- Status = BlockIo->WriteBlocks (
- BlockIo,
- MediaId,
- Lba,
- WorkingBufferSize,
- WorkingBuffer
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- WorkingBuffer += WorkingBufferSize;
-
- } else {
- //
- // The buffer parameter is not aligned with the request
- // So use the allocated instead.
- // It can fit almost all the cases.
- //
- LastWrite = FALSE;
- do {
- if (WorkingBufferSize <= DataBufferSize) {
- //
- // It is the last calling to writeblocks in this loop
- //
- DataBufferSize = WorkingBufferSize;
- LastWrite = TRUE;
- }
-
- CopyMem (Data, WorkingBuffer, DataBufferSize);
- Status = BlockIo->WriteBlocks (
- BlockIo,
- MediaId,
- Lba,
- DataBufferSize,
- Data
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- WorkingBufferSize -= DataBufferSize;
- WorkingBuffer += DataBufferSize;
- Lba += DATA_BUFFER_BLOCK_NUM;
- } while (!LastWrite);
- }
- }
-
- if (!TransactionComplete && OverRun != 0) {
- //
- // Last bit is not a complete block, so do a read modify write.
- //
- Status = BlockIo->ReadBlocks (
- BlockIo,
- MediaId,
- OverRunLba,
- BlockSize,
- Data
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- CopyMem (Data, WorkingBuffer, OverRun);
-
- Status = BlockIo->WriteBlocks (
- BlockIo,
- MediaId,
- OverRunLba,
- BlockSize,
- Data
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- }
-
-Done:
- if (PreData != NULL) {
- FreePool (PreData);
- }
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/ComponentName.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/ComponentName.c
deleted file mode 100644
index 96ff648..0000000
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/ComponentName.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "Partition.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName = {
- PartitionComponentNameGetDriverName,
- PartitionComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mPartitionDriverNameTable[] = {
- {
- "eng",
- (CHAR16 *)L"Partition Driver(MBR/GPT/El Torito)"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-PartitionComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gPartitionComponentName.SupportedLanguages,
- mPartitionDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-PartitionComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c
deleted file mode 100644
index 5d2a07e..0000000
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ElTorito.c
-
-Abstract:
-
- Decode an El Torito formatted CD-ROM
-
-Revision History
-
---*/
-
-#include "Partition.h"
-
-EFI_STATUS
-PartitionInstallElToritoChildHandles (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Install child handles if the Handle supports El Torito format.
-
-Arguments:
- This - Calling context.
- Handle - Parent Handle
- DiskIo - Parent DiskIo interface
- BlockIo - Parent BlockIo interface
- DevicePath - Parent Device Path
-
-Returns:
- EFI_SUCCESS - some child handle(s) was added
- EFI_MEDIA_CHANGED - Media changed Detected
- !EFI_SUCCESS - no child handle was added
-
---*/
-{
- EFI_STATUS Status;
- UINT32 VolDescriptorLba;
- UINT32 Lba;
- EFI_BLOCK_IO_MEDIA *Media;
- CDROM_VOLUME_DESCRIPTOR *VolDescriptor;
- ELTORITO_CATALOG *Catalog;
- UINTN Check;
- UINTN Index;
- UINTN BootEntry;
- UINTN MaxIndex;
- UINT16 *CheckBuffer;
- CDROM_DEVICE_PATH CdDev;
- UINT32 SubBlockSize;
- UINT32 SectorCount;
- EFI_STATUS Found;
- UINT32 VolSpaceSize;
-
- Found = EFI_NOT_FOUND;
- Media = BlockIo->Media;
- VolSpaceSize = 0;
-
- //
- // CD_ROM has the fixed block size as 2048 bytes
- //
- if (Media->BlockSize != 2048) {
- return EFI_NOT_FOUND;
- }
-
- VolDescriptor = AllocatePool ((UINTN) Media->BlockSize);
-
- if (VolDescriptor == NULL) {
- return EFI_NOT_FOUND;
- }
-
- Catalog = (ELTORITO_CATALOG *) VolDescriptor;
-
- //
- // the ISO-9660 volume descriptor starts at 32k on the media
- // and CD_ROM has the fixed block size as 2048 bytes, so...
- //
- //
- // ((16*2048) / Media->BlockSize) - 1;
- //
- VolDescriptorLba = 15;
- //
- // Loop: handle one volume descriptor per time
- //
- while (TRUE) {
-
- VolDescriptorLba += 1;
- if (VolDescriptorLba > Media->LastBlock) {
- //
- // We are pointing past the end of the device so exit
- //
- break;
- }
-
- Status = BlockIo->ReadBlocks (
- BlockIo,
- Media->MediaId,
- VolDescriptorLba,
- Media->BlockSize,
- VolDescriptor
- );
- if (EFI_ERROR (Status)) {
- Found = Status;
- break;
- }
- //
- // Check for valid volume descriptor signature
- //
- if (VolDescriptor->Type == CDVOL_TYPE_END ||
- CompareMem (VolDescriptor->Id, CDVOL_ID, sizeof (VolDescriptor->Id)) != 0
- ) {
- //
- // end of Volume descriptor list
- //
- break;
- }
- //
- // Read the Volume Space Size from Primary Volume Descriptor 81-88 byte,
- // the 32-bit numerical values is stored in Both-byte orders
- //
- if (VolDescriptor->Type == CDVOL_TYPE_CODED) {
- VolSpaceSize = VolDescriptor->VolSpaceSize[0];
- }
- //
- // Is it an El Torito volume descriptor?
- //
- if (CompareMem (VolDescriptor->SystemId, CDVOL_ELTORITO_ID, sizeof (CDVOL_ELTORITO_ID) - 1) != 0) {
- continue;
- }
- //
- // Read in the boot El Torito boot catalog
- //
- Lba = UNPACK_INT32 (VolDescriptor->EltCatalog);
- if (Lba > Media->LastBlock) {
- continue;
- }
-
- Status = BlockIo->ReadBlocks (
- BlockIo,
- Media->MediaId,
- Lba,
- Media->BlockSize,
- Catalog
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "EltCheckDevice: error reading catalog %r\n", Status));
- continue;
- }
- //
- // We don't care too much about the Catalog header's contents, but we do want
- // to make sure it looks like a Catalog header
- //
- if (Catalog->Catalog.Indicator != ELTORITO_ID_CATALOG || Catalog->Catalog.Id55AA != 0xAA55) {
- DEBUG ((EFI_D_ERROR, "EltCheckBootCatalog: El Torito boot catalog header IDs not correct\n"));
- continue;
- }
-
- Check = 0;
- CheckBuffer = (UINT16 *) Catalog;
- for (Index = 0; Index < sizeof (ELTORITO_CATALOG) / sizeof (UINT16); Index += 1) {
- Check += CheckBuffer[Index];
- }
-
- if (Check & 0xFFFF) {
- DEBUG ((EFI_D_ERROR, "EltCheckBootCatalog: El Torito boot catalog header checksum failed\n"));
- continue;
- }
-
- MaxIndex = Media->BlockSize / sizeof (ELTORITO_CATALOG);
- for (Index = 1, BootEntry = 1; Index < MaxIndex; Index += 1) {
- //
- // Next entry
- //
- Catalog += 1;
-
- //
- // Check this entry
- //
- if (Catalog->Boot.Indicator != ELTORITO_ID_SECTION_BOOTABLE || Catalog->Boot.Lba == 0) {
- continue;
- }
-
- SubBlockSize = 512;
- SectorCount = Catalog->Boot.SectorCount;
-
- switch (Catalog->Boot.MediaType) {
-
- case ELTORITO_NO_EMULATION:
- SubBlockSize = Media->BlockSize;
- break;
-
- case ELTORITO_HARD_DISK:
- break;
-
- case ELTORITO_12_DISKETTE:
- SectorCount = 0x50 * 0x02 * 0x0F;
- break;
-
- case ELTORITO_14_DISKETTE:
- SectorCount = 0x50 * 0x02 * 0x12;
- break;
-
- case ELTORITO_28_DISKETTE:
- SectorCount = 0x50 * 0x02 * 0x24;
- break;
-
- default:
- DEBUG ((EFI_D_INIT, "EltCheckDevice: unsupported El Torito boot media type %x\n", Catalog->Boot.MediaType));
- SectorCount = 0;
- SubBlockSize = Media->BlockSize;
- break;
- }
- //
- // Create child device handle
- //
- CdDev.Header.Type = MEDIA_DEVICE_PATH;
- CdDev.Header.SubType = MEDIA_CDROM_DP;
- SetDevicePathNodeLength (&CdDev.Header, sizeof (CdDev));
-
- if (Index == 1) {
- //
- // This is the initial/default entry
- //
- BootEntry = 0;
- }
-
- CdDev.BootEntry = (UINT32) BootEntry;
- BootEntry++;
- CdDev.PartitionStart = Catalog->Boot.Lba;
- if (SectorCount < 2) {
- //
- // When the SectorCount < 2, set the Partition as the whole CD.
- //
- if (VolSpaceSize > (Media->LastBlock + 1)) {
- CdDev.PartitionSize = (UINT32)(Media->LastBlock - Catalog->Boot.Lba + 1);
- } else {
- CdDev.PartitionSize = (UINT32)(VolSpaceSize - Catalog->Boot.Lba);
- }
- } else {
- CdDev.PartitionSize = DivU64x32 (
- MultU64x32 (
- SectorCount,
- SubBlockSize
- ) + Media->BlockSize - 1,
- Media->BlockSize
- );
- }
-
- Status = PartitionInstallChildHandle (
- This,
- Handle,
- DiskIo,
- BlockIo,
- DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &CdDev,
- Catalog->Boot.Lba,
- Catalog->Boot.Lba + CdDev.PartitionSize - 1,
- SubBlockSize,
- FALSE
- );
- if (!EFI_ERROR (Status)) {
- Found = EFI_SUCCESS;
- }
- }
- }
-
- FreePool (VolDescriptor);
-
- return Found;
-}
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c
deleted file mode 100644
index 61a4ec5..0000000
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c
+++ /dev/null
@@ -1,785 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Gpt.c
-
-Abstract:
-
- Decode a hard disk partitioned with the GPT scheme in the EFI 1.0
- specification.
-
---*/
-
-#include "Partition.h"
-
-STATIC
-BOOLEAN
-PartitionValidGptTable (
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_LBA Lba,
- OUT EFI_PARTITION_TABLE_HEADER *PartHeader
- );
-
-STATIC
-BOOLEAN
-PartitionCheckGptEntryArrayCRC (
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_PARTITION_TABLE_HEADER *PartHeader
- );
-
-STATIC
-BOOLEAN
-PartitionRestoreGptTable (
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_PARTITION_TABLE_HEADER *PartHeader
- );
-
-STATIC
-VOID
-PartitionCheckGptEntry (
- IN EFI_PARTITION_TABLE_HEADER *PartHeader,
- IN EFI_PARTITION_ENTRY *PartEntry,
- OUT EFI_PARTITION_ENTRY_STATUS *PEntryStatus
- );
-
-STATIC
-BOOLEAN
-PartitionCheckCrcAltSize (
- IN UINTN MaxSize,
- IN UINTN Size,
- IN OUT EFI_TABLE_HEADER *Hdr
- );
-
-STATIC
-BOOLEAN
-PartitionCheckCrc (
- IN UINTN MaxSize,
- IN OUT EFI_TABLE_HEADER *Hdr
- );
-
-STATIC
-VOID
-PartitionSetCrcAltSize (
- IN UINTN Size,
- IN OUT EFI_TABLE_HEADER *Hdr
- );
-
-STATIC
-VOID
-PartitionSetCrc (
- IN OUT EFI_TABLE_HEADER *Hdr
- );
-
-EFI_STATUS
-PartitionInstallGptChildHandles (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Install child handles if the Handle supports GPT partition structure.
-
-Arguments:
- This - Calling context.
- Handle - Parent Handle
- DiskIo - Parent DiskIo interface
- BlockIo - Parent BlockIo interface
- DevicePath - Parent Device Path
-
-Returns:
- EFI_SUCCESS - Valid GPT disk
- EFI_MEDIA_CHANGED - Media changed Detected
- !EFI_SUCCESS - Not a valid GPT disk
-
---*/
-{
- EFI_STATUS Status;
- UINT32 BlockSize;
- EFI_LBA LastBlock;
- MASTER_BOOT_RECORD *ProtectiveMbr;
- EFI_PARTITION_TABLE_HEADER *PrimaryHeader;
- EFI_PARTITION_TABLE_HEADER *BackupHeader;
- EFI_PARTITION_ENTRY *PartEntry;
- EFI_PARTITION_ENTRY_STATUS *PEntryStatus;
- UINTN Index;
- EFI_STATUS GptValid;
- HARDDRIVE_DEVICE_PATH HdDev;
-
- ProtectiveMbr = NULL;
- PrimaryHeader = NULL;
- BackupHeader = NULL;
- PartEntry = NULL;
- PEntryStatus = NULL;
-
- BlockSize = BlockIo->Media->BlockSize;
- LastBlock = BlockIo->Media->LastBlock;
-
- DEBUG ((EFI_D_INFO, " BlockSize : %d \n", BlockSize));
- DEBUG ((EFI_D_INFO, " LastBlock : %x \n", LastBlock));
-
- GptValid = EFI_NOT_FOUND;
-
- //
- // Allocate a buffer for the Protective MBR
- //
- ProtectiveMbr = AllocatePool (BlockSize);
- if (ProtectiveMbr == NULL) {
- return EFI_NOT_FOUND;
- }
-
- //
- // Read the Protective MBR from LBA #0
- //
- Status = BlockIo->ReadBlocks (
- BlockIo,
- BlockIo->Media->MediaId,
- 0,
- BlockIo->Media->BlockSize,
- ProtectiveMbr
- );
- if (EFI_ERROR (Status)) {
- GptValid = Status;
- goto Done;
- }
- //
- // Verify that the Protective MBR is valid
- //
- if (ProtectiveMbr->Partition[0].BootIndicator != 0x00 ||
- ProtectiveMbr->Partition[0].OSIndicator != PMBR_GPT_PARTITION ||
- UNPACK_UINT32 (ProtectiveMbr->Partition[0].StartingLBA) != 1
- ) {
- goto Done;
- }
-
- //
- // Allocate the GPT structures
- //
- PrimaryHeader = AllocateZeroPool (sizeof (EFI_PARTITION_TABLE_HEADER));
- if (PrimaryHeader == NULL) {
- goto Done;
- }
-
- BackupHeader = AllocateZeroPool (sizeof (EFI_PARTITION_TABLE_HEADER));
-
- if (BackupHeader == NULL) {
- goto Done;
- }
-
- //
- // Check primary and backup partition tables
- //
- if (!PartitionValidGptTable (BlockIo, DiskIo, PRIMARY_PART_HEADER_LBA, PrimaryHeader)) {
- DEBUG ((EFI_D_INFO, " Not Valid primary partition table\n"));
-
- if (!PartitionValidGptTable (BlockIo, DiskIo, LastBlock, BackupHeader)) {
- DEBUG ((EFI_D_INFO, " Not Valid backup partition table\n"));
- goto Done;
- } else {
- DEBUG ((EFI_D_INFO, " Valid backup partition table\n"));
- DEBUG ((EFI_D_INFO, " Restore primary partition table by the backup\n"));
- if (!PartitionRestoreGptTable (BlockIo, DiskIo, BackupHeader)) {
- DEBUG ((EFI_D_INFO, " Restore primary partition table error\n"));
- }
-
- if (PartitionValidGptTable (BlockIo, DiskIo, BackupHeader->AlternateLBA, PrimaryHeader)) {
- DEBUG ((EFI_D_INFO, " Restore backup partition table success\n"));
- }
- }
- } else if (!PartitionValidGptTable (BlockIo, DiskIo, PrimaryHeader->AlternateLBA, BackupHeader)) {
- DEBUG ((EFI_D_INFO, " Valid primary and !Valid backup partition table\n"));
- DEBUG ((EFI_D_INFO, " Restore backup partition table by the primary\n"));
- if (!PartitionRestoreGptTable (BlockIo, DiskIo, PrimaryHeader)) {
- DEBUG ((EFI_D_INFO, " Restore backup partition table error\n"));
- }
-
- if (PartitionValidGptTable (BlockIo, DiskIo, PrimaryHeader->AlternateLBA, BackupHeader)) {
- DEBUG ((EFI_D_INFO, " Restore backup partition table success\n"));
- }
-
- }
-
- DEBUG ((EFI_D_INFO, " Valid primary and Valid backup partition table\n"));
-
- //
- // Read the EFI Partition Entries
- //
- PartEntry = AllocatePool (PrimaryHeader->NumberOfPartitionEntries * sizeof (EFI_PARTITION_ENTRY));
- if (PartEntry == NULL) {
- DEBUG ((EFI_D_ERROR, "Allocate pool error\n"));
- goto Done;
- }
-
- Status = DiskIo->ReadDisk (
- DiskIo,
- BlockIo->Media->MediaId,
- MultU64x32(PrimaryHeader->PartitionEntryLBA, BlockSize),
- PrimaryHeader->NumberOfPartitionEntries * (PrimaryHeader->SizeOfPartitionEntry),
- PartEntry
- );
- if (EFI_ERROR (Status)) {
- GptValid = Status;
- DEBUG ((EFI_D_INFO, " Partition Entry ReadBlocks error\n"));
- goto Done;
- }
-
- DEBUG ((EFI_D_INFO, " Partition entries read block success\n"));
-
- DEBUG ((EFI_D_INFO, " Number of partition entries: %d\n", PrimaryHeader->NumberOfPartitionEntries));
-
- PEntryStatus = AllocateZeroPool (PrimaryHeader->NumberOfPartitionEntries * sizeof (EFI_PARTITION_ENTRY_STATUS));
- if (PEntryStatus == NULL) {
- DEBUG ((EFI_D_ERROR, "Allocate pool error\n"));
- goto Done;
- }
-
- //
- // Check the integrity of partition entries
- //
- PartitionCheckGptEntry (PrimaryHeader, PartEntry, PEntryStatus);
-
- //
- // If we got this far the GPT layout of the disk is valid and we should return true
- //
- GptValid = EFI_SUCCESS;
-
- //
- // Create child device handles
- //
- for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) {
- if (CompareGuid (&PartEntry[Index].PartitionTypeGUID, &gEfiPartTypeUnusedGuid) ||
- PEntryStatus[Index].OutOfRange ||
- PEntryStatus[Index].Overlap
- ) {
- //
- // Don't use null EFI Partition Entries or Invalid Partition Entries
- //
- continue;
- }
-
- ZeroMem (&HdDev, sizeof (HdDev));
- HdDev.Header.Type = MEDIA_DEVICE_PATH;
- HdDev.Header.SubType = MEDIA_HARDDRIVE_DP;
- SetDevicePathNodeLength (&HdDev.Header, sizeof (HdDev));
-
- HdDev.PartitionNumber = (UINT32) Index + 1;
- HdDev.MBRType = MBR_TYPE_EFI_PARTITION_TABLE_HEADER;
- HdDev.SignatureType = SIGNATURE_TYPE_GUID;
- HdDev.PartitionStart = PartEntry[Index].StartingLBA;
- HdDev.PartitionSize = PartEntry[Index].EndingLBA - PartEntry[Index].StartingLBA + 1;
- CopyMem (HdDev.Signature, &PartEntry[Index].UniquePartitionGUID, sizeof (EFI_GUID));
-
- DEBUG ((EFI_D_INFO, " Index : %d\n", Index));
- DEBUG ((EFI_D_INFO, " Start LBA : %x\n", HdDev.PartitionStart));
- DEBUG ((EFI_D_INFO, " End LBA : %x\n", PartEntry[Index].EndingLBA));
- DEBUG ((EFI_D_INFO, " Partition size: %x\n", HdDev.PartitionSize));
- DEBUG ((EFI_D_INFO, " Start : %x", MultU64x32 (PartEntry[Index].StartingLBA, BlockSize)));
- DEBUG ((EFI_D_INFO, " End : %x\n", MultU64x32 (PartEntry[Index].EndingLBA, BlockSize)));
-
- Status = PartitionInstallChildHandle (
- This,
- Handle,
- DiskIo,
- BlockIo,
- DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &HdDev,
- PartEntry[Index].StartingLBA,
- PartEntry[Index].EndingLBA,
- BlockSize,
- CompareGuid(&PartEntry[Index].PartitionTypeGUID, &gEfiPartTypeSystemPartGuid)
- );
- }
-
- DEBUG ((EFI_D_INFO, "Prepare to Free Pool\n"));
-
-Done:
- if (ProtectiveMbr != NULL) {
- FreePool (ProtectiveMbr);
- }
- if (PrimaryHeader != NULL) {
- FreePool (PrimaryHeader);
- }
- if (BackupHeader != NULL) {
- FreePool (BackupHeader);
- }
- if (PartEntry != NULL) {
- FreePool (PartEntry);
- }
- if (PEntryStatus != NULL) {
- FreePool (PEntryStatus);
- }
-
- return GptValid;
-}
-
-STATIC
-BOOLEAN
-PartitionValidGptTable (
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_LBA Lba,
- OUT EFI_PARTITION_TABLE_HEADER *PartHeader
- )
-/*++
-
-Routine Description:
- Check if the GPT partition table is valid
-
-Arguments:
- BlockIo - Parent BlockIo interface
- DiskIo - Disk Io protocol.
- Lba - The starting Lba of the Partition Table
- PartHeader - Stores the partition table that is read
-
-Returns:
- TRUE - The partition table is valid
- FALSE - The partition table is not valid
-
---*/
-{
- EFI_STATUS Status;
- UINT32 BlockSize;
- EFI_PARTITION_TABLE_HEADER *PartHdr;
-
- BlockSize = BlockIo->Media->BlockSize;
-
- PartHdr = AllocateZeroPool (BlockSize);
-
- if (PartHdr == NULL) {
- DEBUG ((EFI_D_ERROR, "Allocate pool error\n"));
- return FALSE;
- }
- //
- // Read the EFI Partition Table Header
- //
- Status = BlockIo->ReadBlocks (
- BlockIo,
- BlockIo->Media->MediaId,
- Lba,
- BlockSize,
- PartHdr
- );
- if (EFI_ERROR (Status)) {
- FreePool (PartHdr);
- return FALSE;
- }
-
- if (CompareMem (&PartHdr->Header.Signature, EFI_PTAB_HEADER_ID, sizeof (UINT64)) != 0 ||
- !PartitionCheckCrc (BlockSize, &PartHdr->Header) ||
- PartHdr->MyLBA != Lba
- ) {
- DEBUG ((EFI_D_INFO, " !Valid efi partition table header\n"));
- FreePool (PartHdr);
- return FALSE;
- }
-
- CopyMem (PartHeader, PartHdr, sizeof (EFI_PARTITION_TABLE_HEADER));
- if (!PartitionCheckGptEntryArrayCRC (BlockIo, DiskIo, PartHeader)) {
- FreePool (PartHdr);
- return FALSE;
- }
-
- DEBUG ((EFI_D_INFO, " Valid efi partition table header\n"));
- FreePool (PartHdr);
- return TRUE;
-}
-
-STATIC
-BOOLEAN
-PartitionCheckGptEntryArrayCRC (
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_PARTITION_TABLE_HEADER *PartHeader
- )
-/*++
-
-Routine Description:
-
- Check if the CRC field in the Partition table header is valid
- for Partition entry array
-
-Arguments:
-
- BlockIo - parent BlockIo interface
- DiskIo - Disk Io Protocol.
- PartHeader - Partition table header structure
-
-Returns:
-
- TRUE - the CRC is valid
- FALSE - the CRC is invalid
-
---*/
-{
- EFI_STATUS Status;
- UINT8 *Ptr;
- UINT32 Crc;
- UINTN Size;
-
- //
- // Read the EFI Partition Entries
- //
- Ptr = AllocatePool (PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry);
- if (Ptr == NULL) {
- DEBUG ((EFI_D_ERROR, " Allocate pool error\n"));
- return FALSE;
- }
-
- Status = DiskIo->ReadDisk (
- DiskIo,
- BlockIo->Media->MediaId,
- MultU64x32(PartHeader->PartitionEntryLBA, BlockIo->Media->BlockSize),
- PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (Ptr);
- return FALSE;
- }
-
- Size = PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry;
-
- Status = gBS->CalculateCrc32 (Ptr, Size, &Crc);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "CheckPEntryArrayCRC: Crc calculation failed\n"));
- FreePool (Ptr);
- return FALSE;
- }
-
- FreePool (Ptr);
-
- return (BOOLEAN) (PartHeader->PartitionEntryArrayCRC32 == Crc);
-}
-
-STATIC
-BOOLEAN
-PartitionRestoreGptTable (
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_PARTITION_TABLE_HEADER *PartHeader
- )
-/*++
-
-Routine Description:
-
- Restore Partition Table to its alternate place
- (Primary -> Backup or Backup -> Primary)
-
-Arguments:
-
- BlockIo - parent BlockIo interface
- DiskIo - Disk Io Protocol.
- PartHeader - the source Partition table header structure
-
-Returns:
-
- TRUE - Restoring succeeds
- FALSE - Restoring failed
-
---*/
-{
- EFI_STATUS Status;
- UINTN BlockSize;
- EFI_PARTITION_TABLE_HEADER *PartHdr;
- EFI_LBA PEntryLBA;
- UINT8 *Ptr;
-
- PartHdr = NULL;
- Ptr = NULL;
-
- BlockSize = BlockIo->Media->BlockSize;
-
- PartHdr = AllocateZeroPool (BlockSize);
-
- if (PartHdr == NULL) {
- DEBUG ((EFI_D_ERROR, "Allocate pool error\n"));
- return FALSE;
- }
-
- PEntryLBA = (PartHeader->MyLBA == PRIMARY_PART_HEADER_LBA) ? \
- (PartHeader->LastUsableLBA + 1) : \
- (PRIMARY_PART_HEADER_LBA + 1);
-
- CopyMem (PartHdr, PartHeader, sizeof (EFI_PARTITION_TABLE_HEADER));
-
- PartHdr->MyLBA = PartHeader->AlternateLBA;
- PartHdr->AlternateLBA = PartHeader->MyLBA;
- PartHdr->PartitionEntryLBA = PEntryLBA;
- PartitionSetCrc ((EFI_TABLE_HEADER *) PartHdr);
-
- Status = BlockIo->WriteBlocks (BlockIo, BlockIo->Media->MediaId, PartHdr->MyLBA, BlockSize, PartHdr);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Ptr = AllocatePool (PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry);
- if (Ptr == NULL) {
- DEBUG ((EFI_D_ERROR, " Allocate pool effor\n"));
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- Status = DiskIo->ReadDisk (
- DiskIo,
- BlockIo->Media->MediaId,
- MultU64x32(PartHeader->PartitionEntryLBA, BlockIo->Media->BlockSize),
- PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Status = DiskIo->WriteDisk (
- DiskIo,
- BlockIo->Media->MediaId,
- MultU64x32(PEntryLBA, BlockIo->Media->BlockSize),
- PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry,
- Ptr
- );
-
-Done:
- FreePool (PartHdr);
- FreePool (Ptr);
-
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-STATIC
-VOID
-PartitionCheckGptEntry (
- IN EFI_PARTITION_TABLE_HEADER *PartHeader,
- IN EFI_PARTITION_ENTRY *PartEntry,
- OUT EFI_PARTITION_ENTRY_STATUS *PEntryStatus
- )
-/*++
-
-Routine Description:
-
- Check each partition entry for its range
-
-Arguments:
-
- PartHeader - the partition table header
- PartEntry - the partition entry array
- PEntryStatus - the partition entry status array recording the status of
- each partition
-
-Returns:
- VOID
-
---*/
-{
- EFI_LBA StartingLBA;
- EFI_LBA EndingLBA;
- UINTN Index1;
- UINTN Index2;
-
- DEBUG ((EFI_D_INFO, " start check partition entries\n"));
- for (Index1 = 0; Index1 < PartHeader->NumberOfPartitionEntries; Index1++) {
- if (CompareGuid (&PartEntry[Index1].PartitionTypeGUID, &gEfiPartTypeUnusedGuid)) {
- continue;
- }
-
- StartingLBA = PartEntry[Index1].StartingLBA;
- EndingLBA = PartEntry[Index1].EndingLBA;
- if (StartingLBA > EndingLBA ||
- StartingLBA < PartHeader->FirstUsableLBA ||
- StartingLBA > PartHeader->LastUsableLBA ||
- EndingLBA < PartHeader->FirstUsableLBA ||
- EndingLBA > PartHeader->LastUsableLBA
- ) {
- PEntryStatus[Index1].OutOfRange = TRUE;
- continue;
- }
-
- for (Index2 = Index1 + 1; Index2 < PartHeader->NumberOfPartitionEntries; Index2++) {
-
- if (CompareGuid (&PartEntry[Index2].PartitionTypeGUID, &gEfiPartTypeUnusedGuid)) {
- continue;
- }
-
- if (PartEntry[Index2].EndingLBA >= StartingLBA && PartEntry[Index2].StartingLBA <= EndingLBA) {
- //
- // This region overlaps with the Index1'th region
- //
- PEntryStatus[Index1].Overlap = TRUE;
- PEntryStatus[Index2].Overlap = TRUE;
- continue;
-
- }
- }
- }
-
- DEBUG ((EFI_D_INFO, " End check partition entries\n"));
-}
-
-STATIC
-VOID
-PartitionSetCrc (
- IN OUT EFI_TABLE_HEADER *Hdr
- )
-/*++
-
-Routine Description:
-
- Updates the CRC32 value in the table header
-
-Arguments:
-
- Hdr - The table to update
-
-Returns:
-
- None
-
---*/
-{
- PartitionSetCrcAltSize (Hdr->HeaderSize, Hdr);
-}
-
-STATIC
-VOID
-PartitionSetCrcAltSize (
- IN UINTN Size,
- IN OUT EFI_TABLE_HEADER *Hdr
- )
-/*++
-
-Routine Description:
-
- Updates the CRC32 value in the table header
-
-Arguments:
-
- Size - The size of the table
- Hdr - The table to update
-
-Returns:
-
- None
-
---*/
-{
- UINT32 Crc;
-
- Hdr->CRC32 = 0;
- gBS->CalculateCrc32 ((UINT8 *) Hdr, Size, &Crc);
- Hdr->CRC32 = Crc;
-}
-
-STATIC
-BOOLEAN
-PartitionCheckCrc (
- IN UINTN MaxSize,
- IN OUT EFI_TABLE_HEADER *Hdr
- )
-/*++
-
-Routine Description:
-
- Checks the CRC32 value in the table header
-
-Arguments:
-
- MaxSize - Max Size limit
- Hdr - The table to check
-
-Returns:
-
- TRUE if the CRC is OK in the table
-
---*/
-{
- return PartitionCheckCrcAltSize (MaxSize, Hdr->HeaderSize, Hdr);
-}
-
-STATIC
-BOOLEAN
-PartitionCheckCrcAltSize (
- IN UINTN MaxSize,
- IN UINTN Size,
- IN OUT EFI_TABLE_HEADER *Hdr
- )
-/*++
-
-Routine Description:
-
- Checks the CRC32 value in the table header
-
-Arguments:
-
- MaxSize - Max Size Limit
- Size - The size of the table
- Hdr - The table to check
-
-Returns:
-
- TRUE if the CRC is OK in the table
-
---*/
-{
- UINT32 Crc;
- UINT32 OrgCrc;
- EFI_STATUS Status;
-
- Crc = 0;
-
- if (Size == 0) {
- //
- // If header size is 0 CRC will pass so return FALSE here
- //
- return FALSE;
- }
-
- if (MaxSize && Size > MaxSize) {
- DEBUG ((EFI_D_ERROR, "CheckCrc32: Size > MaxSize\n"));
- return FALSE;
- }
- //
- // clear old crc from header
- //
- OrgCrc = Hdr->CRC32;
- Hdr->CRC32 = 0;
-
- Status = gBS->CalculateCrc32 ((UINT8 *) Hdr, Size, &Crc);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "CheckCrc32: Crc calculation failed\n"));
- return FALSE;
- }
- //
- // set results
- //
- Hdr->CRC32 = Crc;
-
- //
- // return status
- //
- DEBUG_CODE_BEGIN ();
- if (OrgCrc != Crc) {
- DEBUG ((EFI_D_ERROR, "CheckCrc32: Crc check failed\n"));
- }
- DEBUG_CODE_END ();
-
- return (BOOLEAN) (OrgCrc == Crc);
-}
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c
deleted file mode 100644
index d71698c..0000000
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Mbr.c
-
-Abstract:
-
- Decode a hard disk partitioned with the legacy MBR found on most PC's
-
- MBR - Master Boot Record is in the first sector of a partitioned hard disk.
- The MBR supports four partitions per disk. The MBR also contains legacy
- code that is not run on an EFI system. The legacy code reads the
- first sector of the active partition into memory and
-
- BPB - Boot(?) Parameter Block is in the first sector of a FAT file system.
- The BPB contains information about the FAT file system. The BPB is
- always on the first sector of a media. The first sector also contains
- the legacy boot strap code.
-
---*/
-
-#include "Partition.h"
-
-STATIC
-BOOLEAN
-PartitionValidMbr (
- IN MASTER_BOOT_RECORD *Mbr,
- IN EFI_LBA LastLba
- )
-/*++
-
-Routine Description:
- Test to see if the Mbr buffer is a valid MBR
-
-Arguments:
- Mbr - Parent Handle
- LastLba - Last Lba address on the device.
-
-Returns:
- TRUE - Mbr is a Valid MBR
- FALSE - Mbr is not a Valid MBR
-
---*/
-{
- UINT32 StartingLBA;
- UINT32 EndingLBA;
- UINT32 NewEndingLBA;
- INTN Index1;
- INTN Index2;
- BOOLEAN MbrValid;
-
- if (Mbr->Signature != MBR_SIGNATURE) {
- return FALSE;
- }
- //
- // The BPB also has this signature, so it can not be used alone.
- //
- MbrValid = FALSE;
- for (Index1 = 0; Index1 < MAX_MBR_PARTITIONS; Index1++) {
- if (Mbr->Partition[Index1].OSIndicator == 0x00 || UNPACK_UINT32 (Mbr->Partition[Index1].SizeInLBA) == 0) {
- continue;
- }
-
- MbrValid = TRUE;
- StartingLBA = UNPACK_UINT32 (Mbr->Partition[Index1].StartingLBA);
- EndingLBA = StartingLBA + UNPACK_UINT32 (Mbr->Partition[Index1].SizeInLBA) - 1;
- if (EndingLBA > LastLba) {
- //
- // Compatibility Errata:
- // Some systems try to hide drive space with their INT 13h driver
- // This does not hide space from the OS driver. This means the MBR
- // that gets created from DOS is smaller than the MBR created from
- // a real OS (NT & Win98). This leads to BlockIo->LastBlock being
- // wrong on some systems FDISKed by the OS.
- //
- // return FALSE since no block devices on a system are implemented
- // with INT 13h
- //
- return FALSE;
- }
-
- for (Index2 = Index1 + 1; Index2 < MAX_MBR_PARTITIONS; Index2++) {
- if (Mbr->Partition[Index2].OSIndicator == 0x00 || UNPACK_UINT32 (Mbr->Partition[Index2].SizeInLBA) == 0) {
- continue;
- }
-
- NewEndingLBA = UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA) + UNPACK_UINT32 (Mbr->Partition[Index2].SizeInLBA) - 1;
- if (NewEndingLBA >= StartingLBA && UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA) <= EndingLBA) {
- //
- // This region overlaps with the Index1'th region
- //
- return FALSE;
- }
- }
- }
- //
- // Non of the regions overlapped so MBR is O.K.
- //
- return MbrValid;
-}
-
-EFI_STATUS
-PartitionInstallMbrChildHandles (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Install child handles if the Handle supports MBR format.
-
-Arguments:
- This - Calling context.
- Handle - Parent Handle
- DiskIo - Parent DiskIo interface
- BlockIo - Parent BlockIo interface
- DevicePath - Parent Device Path
-
-Returns:
- EFI_SUCCESS - If a child handle was added
- EFI_MEDIA_CHANGED - Media changed Detected
- !EFI_SUCCESS - Not found MBR partition.
-
---*/
-{
- EFI_STATUS Status;
- MASTER_BOOT_RECORD *Mbr;
- UINT32 ExtMbrStartingLba;
- UINTN Index;
- HARDDRIVE_DEVICE_PATH HdDev;
- HARDDRIVE_DEVICE_PATH ParentHdDev;
- EFI_STATUS Found;
- UINT32 PartitionNumber;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
- EFI_DEVICE_PATH_PROTOCOL *LastDevicePathNode;
-
- Mbr = NULL;
- Found = EFI_NOT_FOUND;
-
- Mbr = AllocatePool (BlockIo->Media->BlockSize);
- if (Mbr == NULL) {
- goto Done;
- }
-
- Status = BlockIo->ReadBlocks (
- BlockIo,
- BlockIo->Media->MediaId,
- 0,
- BlockIo->Media->BlockSize,
- Mbr
- );
- if (EFI_ERROR (Status)) {
- Found = Status;
- goto Done;
- }
- if (!PartitionValidMbr (Mbr, BlockIo->Media->LastBlock)) {
- goto Done;
- }
- //
- // We have a valid mbr - add each partition
- //
- //
- // Get starting and ending LBA of the parent block device.
- //
- LastDevicePathNode = NULL;
- ZeroMem (&ParentHdDev, sizeof (ParentHdDev));
- DevicePathNode = DevicePath;
- while (!EfiIsDevicePathEnd (DevicePathNode)) {
- LastDevicePathNode = DevicePathNode;
- DevicePathNode = EfiNextDevicePathNode (DevicePathNode);
- }
-
- if (LastDevicePathNode != NULL) {
- if (DevicePathType (LastDevicePathNode) == MEDIA_DEVICE_PATH &&
- DevicePathSubType (LastDevicePathNode) == MEDIA_HARDDRIVE_DP
- ) {
- CopyMem (&ParentHdDev, LastDevicePathNode, sizeof (ParentHdDev));
- } else {
- LastDevicePathNode = NULL;
- }
- }
-
- PartitionNumber = 1;
-
- ZeroMem (&HdDev, sizeof (HdDev));
- HdDev.Header.Type = MEDIA_DEVICE_PATH;
- HdDev.Header.SubType = MEDIA_HARDDRIVE_DP;
- SetDevicePathNodeLength (&HdDev.Header, sizeof (HdDev));
- HdDev.MBRType = MBR_TYPE_PCAT;
- HdDev.SignatureType = SIGNATURE_TYPE_MBR;
-
- if (LastDevicePathNode == NULL) {
- //
- // This is a MBR, add each partition
- //
- for (Index = 0; Index < MAX_MBR_PARTITIONS; Index++) {
- if (Mbr->Partition[Index].OSIndicator == 0x00 || UNPACK_UINT32 (Mbr->Partition[Index].SizeInLBA) == 0) {
- //
- // Don't use null MBR entries
- //
- continue;
- }
-
- if (Mbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION) {
- //
- // This is the guard MBR for the GPT. If you ever see a GPT disk with zero partitions you can get here.
- // We can not produce an MBR BlockIo for this device as the MBR spans the GPT headers. So formating
- // this BlockIo would corrupt the GPT structures and require a recovery that would corrupt the format
- // that corrupted the GPT partition.
- //
- continue;
- }
-
- HdDev.PartitionNumber = PartitionNumber ++;
- HdDev.PartitionStart = UNPACK_UINT32 (Mbr->Partition[Index].StartingLBA);
- HdDev.PartitionSize = UNPACK_UINT32 (Mbr->Partition[Index].SizeInLBA);
- CopyMem (HdDev.Signature, &(Mbr->UniqueMbrSignature[0]), sizeof (UINT32));
-
- Status = PartitionInstallChildHandle (
- This,
- Handle,
- DiskIo,
- BlockIo,
- DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &HdDev,
- HdDev.PartitionStart,
- HdDev.PartitionStart + HdDev.PartitionSize - 1,
- MBR_SIZE,
- (BOOLEAN) (Mbr->Partition[Index].OSIndicator == EFI_PARTITION)
- );
-
- if (!EFI_ERROR (Status)) {
- Found = EFI_SUCCESS;
- }
- }
- } else {
- //
- // It's an extended partition. Follow the extended partition
- // chain to get all the logical drives
- //
- ExtMbrStartingLba = 0;
-
- do {
-
- Status = BlockIo->ReadBlocks (
- BlockIo,
- BlockIo->Media->MediaId,
- ExtMbrStartingLba,
- BlockIo->Media->BlockSize,
- Mbr
- );
- if (EFI_ERROR (Status)) {
- Found = Status;
- goto Done;
- }
-
- if (Mbr->Partition[0].OSIndicator == 0) {
- break;
- }
-
- if ((Mbr->Partition[0].OSIndicator == EXTENDED_DOS_PARTITION) ||
- (Mbr->Partition[0].OSIndicator == EXTENDED_WINDOWS_PARTITION)) {
- ExtMbrStartingLba = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA);
- continue;
- }
- HdDev.PartitionNumber = PartitionNumber ++;
- HdDev.PartitionStart = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA) + ExtMbrStartingLba + ParentHdDev.PartitionStart;
- HdDev.PartitionSize = UNPACK_UINT32 (Mbr->Partition[0].SizeInLBA);
- if ((HdDev.PartitionStart + HdDev.PartitionSize - 1 >= ParentHdDev.PartitionStart + ParentHdDev.PartitionSize) ||
- (HdDev.PartitionStart <= ParentHdDev.PartitionStart)) {
- break;
- }
-
- //
- // The signature in EBR(Extended Boot Record) should always be 0.
- //
- *((UINT32 *) &HdDev.Signature[0]) = 0;
-
- Status = PartitionInstallChildHandle (
- This,
- Handle,
- DiskIo,
- BlockIo,
- DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &HdDev,
- HdDev.PartitionStart - ParentHdDev.PartitionStart,
- HdDev.PartitionStart - ParentHdDev.PartitionStart + HdDev.PartitionSize - 1,
- MBR_SIZE,
- (BOOLEAN) (Mbr->Partition[0].OSIndicator == EFI_PARTITION)
- );
- if (!EFI_ERROR (Status)) {
- Found = EFI_SUCCESS;
- }
-
- if ((Mbr->Partition[1].OSIndicator != EXTENDED_DOS_PARTITION) &&
- (Mbr->Partition[1].OSIndicator != EXTENDED_WINDOWS_PARTITION)
- ) {
- break;
- }
-
- ExtMbrStartingLba = UNPACK_UINT32 (Mbr->Partition[1].StartingLBA);
- //
- // Don't allow partition to be self referencing
- //
- if (ExtMbrStartingLba == 0) {
- break;
- }
- } while (ExtMbrStartingLba < ParentHdDev.PartitionSize);
- }
-
-Done:
- FreePool (Mbr);
-
- return Found;
-}
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.c
deleted file mode 100644
index 86d1cfe..0000000
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.c
+++ /dev/null
@@ -1,701 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Partition.c
-
-Abstract:
-
- Partition driver that produces logical BlockIo devices from a physical
- BlockIo device. The logical BlockIo devices are based on the format
- of the raw block devices media. Currently "El Torito CD-ROM", Legacy
- MBR, and GPT partition schemes are supported.
-
---*/
-
-#include "Partition.h"
-
-//
-// Partition Driver Global Variables
-//
-EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
- PartitionDriverBindingSupported,
- PartitionDriverBindingStart,
- PartitionDriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-STATIC
-PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {
- PartitionInstallGptChildHandles,
- PartitionInstallElToritoChildHandles,
- PartitionInstallMbrChildHandles,
- NULL
-};
-
-
-EFI_STATUS
-EFIAPI
-PartitionDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports ControllerHandle. Any ControllerHandle
- than contains a BlockIo and DiskIo protocol can be supported.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to test
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device
- EFI_ALREADY_STARTED - This driver is already running on this device
- EFI_UNSUPPORTED - This driver does not support this device
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_DISK_IO_PROTOCOL *DiskIo;
- EFI_DEV_PATH *Node;
-
- if (RemainingDevicePath != NULL) {
- Node = (EFI_DEV_PATH *) RemainingDevicePath;
- if (Node->DevPath.Type != MEDIA_DEVICE_PATH ||
- Node->DevPath.SubType != MEDIA_HARDDRIVE_DP ||
- DevicePathNodeLength (&Node->DevPath) != sizeof (HARDDRIVE_DEVICE_PATH)
- ) {
- return EFI_UNSUPPORTED;
- }
- }
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- (VOID **) &DiskIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Close the I/O Abstraction(s) used to perform the supported test
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- NULL,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PartitionDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Start this driver on ControllerHandle by opening a Block IO and Disk IO
- protocol, reading Device Path, and creating a child handle with a
- Disk IO and device path protocol.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to bind driver to
- RemainingDevicePath - Not used
-
- Returns:
- EFI_SUCCESS - This driver is added to DeviceHandle
- EFI_ALREADY_STARTED - This driver is already running on DeviceHandle
- other - This driver does not support this device
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS OpenStatus;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- EFI_DISK_IO_PROTOCOL *DiskIo;
- EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- PARTITION_DETECT_ROUTINE *Routine;
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlockIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the Device Path Protocol on ControllerHandle's handle
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ParentDevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- (VOID **) &DiskIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- return Status;
- }
-
- OpenStatus = Status;
-
- //
- // If no media is present, do nothing here.
- //
- Status = EFI_UNSUPPORTED;
- if (BlockIo->Media->MediaPresent) {
- //
- // Try for GPT, then El Torito, and then legacy MBR partition types. If the
- // media supports a given partition type install child handles to represent
- // the partitions described by the media.
- //
- Routine = &mPartitionDetectRoutineTable[0];
- while (*Routine != NULL) {
- Status = (*Routine) (
- This,
- ControllerHandle,
- DiskIo,
- BlockIo,
- ParentDevicePath
- );
- if (!EFI_ERROR (Status) || Status == EFI_MEDIA_CHANGED) {
- break;
- }
- Routine++;
- }
- }
- //
- // In the case that the driver is already started (OpenStatus == EFI_ALREADY_STARTED),
- // the DevicePathProtocol and the DiskIoProtocol are not actually opened by the
- // driver. So don't try to close them. Otherwise, we will break the dependency
- // between the controller and the driver set up before.
- //
- if (EFI_ERROR (Status) && !EFI_ERROR (OpenStatus) && Status != EFI_MEDIA_CHANGED) {
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PartitionDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop this driver on ControllerHandle. Support stoping any child handles
- created by this driver.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to stop driver on
- NumberOfChildren - Number of Children in the ChildHandleBuffer
- ChildHandleBuffer - List of handles for the children we need to stop.
-
- Returns:
- EFI_SUCCESS - This driver is removed DeviceHandle
- EFI_DEVICE_ERROR - This driver was not removed from this device
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_BLOCK_IO_PROTOCOL *BlockIo;
- BOOLEAN AllChildrenStopped;
- PARTITION_PRIVATE_DATA *Private;
- EFI_DISK_IO_PROTOCOL *DiskIo;
-
- if (NumberOfChildren == 0) {
- //
- // Close the bus driver
- //
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return EFI_SUCCESS;
- }
-
- AllChildrenStopped = TRUE;
- for (Index = 0; Index < NumberOfChildren; Index++) {
- Status = gBS->OpenProtocol (
- ChildHandleBuffer[Index],
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlockIo,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
-
- Private = PARTITION_DEVICE_FROM_BLOCK_IO_THIS (BlockIo);
-
- //
- // All Software protocols have be freed from the handle so remove it.
- //
- BlockIo->FlushBlocks (BlockIo);
-
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index]
- );
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- ChildHandleBuffer[Index],
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- &gEfiBlockIoProtocolGuid,
- &Private->BlockIo,
- Private->EspGuid,
- NULL,
- NULL
- );
- if (EFI_ERROR (Status)) {
- gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDiskIoProtocolGuid,
- (VOID **) &DiskIo,
- This->DriverBindingHandle,
- ChildHandleBuffer[Index],
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- FreePool (Private->DevicePath);
- FreePool (Private);
- }
-
- }
-
- if (EFI_ERROR (Status)) {
- AllChildrenStopped = FALSE;
- }
- }
-
- if (!AllChildrenStopped) {
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-PartitionReset (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
- Routine Description:
- Reset the parent Block Device.
-
- Arguments:
- This - Protocol instance pointer.
- ExtendedVerification - Driver may perform diagnostics on reset.
-
- Returns:
- EFI_SUCCESS - The device was reset.
- EFI_DEVICE_ERROR - The device is not functioning properly and could
- not be reset.
-
---*/
-{
- PARTITION_PRIVATE_DATA *Private;
-
- Private = PARTITION_DEVICE_FROM_BLOCK_IO_THIS (This);
-
- return Private->ParentBlockIo->Reset (
- Private->ParentBlockIo,
- ExtendedVerification
- );
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-PartitionReadBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
- Routine Description:
- Read by using the Disk IO protocol on the parent device. Lba addresses
- must be converted to byte offsets.
-
- Arguments:
- This - Protocol instance pointer.
- MediaId - Id of the media, changes every time the media is replaced.
- Lba - The starting Logical Block Address to read from
- BufferSize - Size of Buffer, must be a multiple of device block size.
- Buffer - Buffer containing read data
-
- Returns:
- EFI_SUCCESS - The data was read correctly from the device.
- EFI_DEVICE_ERROR - The device reported an error while performing the read.
- EFI_NO_MEDIA - There is no media in the device.
- EFI_MEDIA_CHANGED - The MediaId does not matched the current device.
- EFI_BAD_BUFFER_SIZE - The Buffer was not a multiple of the block size of the
- device.
- EFI_INVALID_PARAMETER - The read request contains device addresses that are not
- valid for the device.
-
---*/
-{
- PARTITION_PRIVATE_DATA *Private;
- UINT64 Offset;
-
- Private = PARTITION_DEVICE_FROM_BLOCK_IO_THIS (This);
-
- if (BufferSize % Private->BlockSize != 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- Offset = MultU64x32 (Lba, Private->BlockSize) + Private->Start;
- if (Offset + BufferSize > Private->End) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Because some kinds of partition have different block size from their parent
- // device, we call the Disk IO protocol on the parent device, not the Block IO
- // protocol
- //
- return Private->DiskIo->ReadDisk (Private->DiskIo, MediaId, Offset, BufferSize, Buffer);
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-PartitionWriteBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This,
- IN UINT32 MediaId,
- IN EFI_LBA Lba,
- IN UINTN BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
- Routine Description:
- Write by using the Disk IO protocol on the parent device. Lba addresses
- must be converted to byte offsets.
-
- Arguments:
- This - Protocol instance pointer.
- MediaId - Id of the media, changes every time the media is replaced.
- Lba - The starting Logical Block Address to read from
- BufferSize - Size of Buffer, must be a multiple of device block size.
- Buffer - Buffer containing read data
-
- Returns:
- EFI_SUCCESS - The data was written correctly to the device.
- EFI_WRITE_PROTECTED - The device can not be written to.
- EFI_DEVICE_ERROR - The device reported an error while performing the write.
- EFI_NO_MEDIA - There is no media in the device.
- EFI_MEDIA_CHNAGED - The MediaId does not matched the current device.
- EFI_BAD_BUFFER_SIZE - The Buffer was not a multiple of the block size of the
- device.
- EFI_INVALID_PARAMETER - The write request contains a LBA that is not
- valid for the device.
-
---*/
-{
- PARTITION_PRIVATE_DATA *Private;
- UINT64 Offset;
-
- Private = PARTITION_DEVICE_FROM_BLOCK_IO_THIS (This);
-
- if (BufferSize % Private->BlockSize != 0) {
- return EFI_BAD_BUFFER_SIZE;
- }
-
- Offset = MultU64x32 (Lba, Private->BlockSize) + Private->Start;
- if (Offset + BufferSize > Private->End) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Because some kinds of partition have different block size from their parent
- // device, we call the Disk IO protocol on the parent device, not the Block IO
- // protocol
- //
- return Private->DiskIo->WriteDisk (Private->DiskIo, MediaId, Offset, BufferSize, Buffer);
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-PartitionFlushBlocks (
- IN EFI_BLOCK_IO_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Flush the parent Block Device.
-
- Arguments:
- This - Protocol instance pointer.
-
- Returns:
- EFI_SUCCESS - All outstanding data was written to the device
- EFI_DEVICE_ERROR - The device reported an error while writing back the data
- EFI_NO_MEDIA - There is no media in the device.
-
---*/
-{
- PARTITION_PRIVATE_DATA *Private;
-
- Private = PARTITION_DEVICE_FROM_BLOCK_IO_THIS (This);
-
- return Private->ParentBlockIo->FlushBlocks (Private->ParentBlockIo);
-}
-
-EFI_STATUS
-PartitionInstallChildHandle (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ParentHandle,
- IN EFI_DISK_IO_PROTOCOL *ParentDiskIo,
- IN EFI_BLOCK_IO_PROTOCOL *ParentBlockIo,
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN EFI_LBA Start,
- IN EFI_LBA End,
- IN UINT32 BlockSize,
- IN BOOLEAN InstallEspGuid
- )
-/*++
-
-Routine Description:
- Create a child handle for a logical block device that represents the
- bytes Start to End of the Parent Block IO device.
-
-Arguments:
- This - Calling context.
- ParentHandle - Parent Handle for new child
- ParentDiskIo - Parent DiskIo interface
- ParentBlockIo - Parent BlockIo interface
- ParentDevicePath - Parent Device Path
- DevicePathNode - Child Device Path node
- Start - Start Block
- End - End Block
- BlockSize - Child block size
- InstallEspGuid - Flag to install EFI System Partition GUID on handle
-
-Returns:
- EFI_SUCCESS - If a child handle was added
- EFI_OUT_OF_RESOURCES - A child handle was not added
-
---*/
-{
- EFI_STATUS Status;
- PARTITION_PRIVATE_DATA *Private;
-
- Private = AllocateZeroPool (sizeof (PARTITION_PRIVATE_DATA));
- if (Private == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Private->Signature = PARTITION_PRIVATE_DATA_SIGNATURE;
-
- Private->Start = MultU64x32 (Start, ParentBlockIo->Media->BlockSize);
- Private->End = MultU64x32 (End + 1, ParentBlockIo->Media->BlockSize);
-
- Private->BlockSize = BlockSize;
- Private->ParentBlockIo = ParentBlockIo;
- Private->DiskIo = ParentDiskIo;
-
- Private->BlockIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION;
-
- Private->BlockIo.Media = &Private->Media;
- CopyMem (Private->BlockIo.Media, ParentBlockIo->Media, sizeof (EFI_BLOCK_IO_MEDIA));
- Private->Media.LogicalPartition = TRUE;
- Private->Media.LastBlock = DivU64x32 (
- MultU64x32 (
- End - Start + 1,
- ParentBlockIo->Media->BlockSize
- ),
- BlockSize
- ) - 1;
-
- Private->Media.BlockSize = (UINT32) BlockSize;
-
- Private->BlockIo.Reset = PartitionReset;
- Private->BlockIo.ReadBlocks = PartitionReadBlocks;
- Private->BlockIo.WriteBlocks = PartitionWriteBlocks;
- Private->BlockIo.FlushBlocks = PartitionFlushBlocks;
-
- Private->DevicePath = AppendDevicePathNode (ParentDevicePath, DevicePathNode);
-
- if (Private->DevicePath == NULL) {
- FreePool (Private);
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (InstallEspGuid) {
- Private->EspGuid = &gEfiPartTypeSystemPartGuid;
- } else {
- //
- // If NULL InstallMultipleProtocolInterfaces will ignore it.
- //
- Private->EspGuid = NULL;
- }
- //
- // Create the new handle
- //
- Private->Handle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Private->Handle,
- &gEfiDevicePathProtocolGuid,
- Private->DevicePath,
- &gEfiBlockIoProtocolGuid,
- &Private->BlockIo,
- Private->EspGuid,
- NULL,
- NULL
- );
-
- if (!EFI_ERROR (Status)) {
- //
- // Open the Parent Handle for the child
- //
- Status = gBS->OpenProtocol (
- ParentHandle,
- &gEfiDiskIoProtocolGuid,
- (VOID **) &ParentDiskIo,
- This->DriverBindingHandle,
- Private->Handle,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- );
- } else {
- FreePool (Private->DevicePath);
- FreePool (Private);
- }
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.h b/EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.h
deleted file mode 100644
index a52b8f5..0000000
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Partition.h
-
-Abstract:
-
- Partition driver that produces logical BlockIo devices from a physical
- BlockIo device. The logical BlockIo devices are based on the format
- of the raw block devices media. Currently "El Torito CD-ROM", Legacy
- MBR, and GPT partition schemes are supported.
-
-Revision History
-
---*/
-
-#ifndef __PARTITION_H__
-#define __PARTITION_H__
-
-#include <IndustryStandard/Mbr.h>
-#include <IndustryStandard/ElTorito.h>
-#include <IndustryStandard/EfiGpt.h>
-
-//
-// Partition private data
-//
-#define PARTITION_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('P', 'a', 'r', 't')
-typedef struct {
- UINT64 Signature;
-
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_BLOCK_IO_PROTOCOL BlockIo;
- EFI_BLOCK_IO_MEDIA Media;
-
- EFI_DISK_IO_PROTOCOL *DiskIo;
- EFI_BLOCK_IO_PROTOCOL *ParentBlockIo;
- UINT64 Start;
- UINT64 End;
- UINT32 BlockSize;
-
- EFI_GUID *EspGuid;
-
-} PARTITION_PRIVATE_DATA;
-
-#define PARTITION_DEVICE_FROM_BLOCK_IO_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo, PARTITION_PRIVATE_DATA_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName;
-
-//
-// Extract INT32 from char array
-//
-#define UNPACK_INT32(a) (INT32)( (((UINT8 *) a)[0] << 0) | \
- (((UINT8 *) a)[1] << 8) | \
- (((UINT8 *) a)[2] << 16) | \
- (((UINT8 *) a)[3] << 24) )
-
-//
-// Extract UINT32 from char array
-//
-#define UNPACK_UINT32(a) (UINT32)( (((UINT8 *) a)[0] << 0) | \
- (((UINT8 *) a)[1] << 8) | \
- (((UINT8 *) a)[2] << 16) | \
- (((UINT8 *) a)[3] << 24) )
-
-//
-// Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-PartitionDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PartitionDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PartitionDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-PartitionComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-PartitionComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-EFI_STATUS
-PartitionInstallChildHandle (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ParentHandle,
- IN EFI_DISK_IO_PROTOCOL *ParentDiskIo,
- IN EFI_BLOCK_IO_PROTOCOL *ParentBlockIo,
- IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
- IN UINT64 Start,
- IN UINT64 End,
- IN UINT32 BlockSize,
- IN BOOLEAN InstallEspGuid
- )
-;
-
-EFI_STATUS
-PartitionInstallGptChildHandles (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-;
-
-EFI_STATUS
-PartitionInstallElToritoChildHandles (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-;
-
-EFI_STATUS
-PartitionInstallMbrChildHandles (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-;
-
-typedef
-EFI_STATUS
-(*PARTITION_DETECT_ROUTINE) (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Handle,
- IN EFI_DISK_IO_PROTOCOL *DiskIo,
- IN EFI_BLOCK_IO_PROTOCOL *BlockIo,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
-#endif
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.msa b/EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.msa
deleted file mode 100644
index 3ed7fef..0000000
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Partition.msa
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>Partition</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>1FA1F39E-FEFF-4aae-BD7B-38A070A3B609</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Partition module.</Abstract>
- <Description>Partition driver produces the logical BlockIo device
- that represents the bytes Start to End of the Parent Block IO
- device (one partition of physical BlockIo device,
- which can be one of GPT, MBR, ElTorito partition).</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Partition</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Partition.h</Filename>
- <Filename>Partition.c</Filename>
- <Filename>ElTorito.c</Filename>
- <Filename>Gpt.c</Filename>
- <Filename>Mbr.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDiskIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiPartTypeSystemPartGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiPartTypeUnusedGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gPartitionDriverBinding</DriverBinding>
- <ComponentName>gPartitionComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/English.msa b/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/English.msa
deleted file mode 100644
index 3a72998..0000000
--- a/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/English.msa
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>English</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>CD3BAFB6-50FB-4fe8-8E4E-AB74D2C1A600</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for English module for unicode collation.</Abstract>
- <Description>This driver installs UEFI EFI_UNICODE_COLLATION_PROTOCOL protocol to provide Unicode strings function.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>English</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>UnicodeCollationEng.h</Filename>
- <Filename>UnicodeCollationEng.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiUnicodeCollationProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>InitializeUnicodeCollationEng</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.c b/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.c
deleted file mode 100644
index f043f37..0000000
--- a/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnicodeCollationEng.c
-
-Abstract:
-
- Unicode Collation Protocol (English)
-
-Revision History
-
---*/
-
-#include "UnicodeCollationEng.h"
-
-CHAR8 mEngUpperMap[0x100];
-CHAR8 mEngLowerMap[0x100];
-CHAR8 mEngInfoMap[0x100];
-
-CHAR8 mOtherChars[] = {
- '0',
- '1',
- '2',
- '3',
- '4',
- '5',
- '6',
- '7',
- '8',
- '9',
- '\\',
- '.',
- '_',
- '^',
- '$',
- '~',
- '!',
- '#',
- '%',
- '&',
- '-',
- '{',
- '}',
- '(',
- ')',
- '@',
- '`',
- '\'',
- '\0'
-};
-
-EFI_HANDLE mHandle = NULL;
-
-EFI_UNICODE_COLLATION_PROTOCOL UnicodeEng = {
- EngStriColl,
- EngMetaiMatch,
- EngStrLwr,
- EngStrUpr,
- EngFatToStr,
- EngStrToFat,
- "eng"
-};
-
-//
-//
-//
-EFI_STATUS
-InitializeUnicodeCollationEng (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Initializes the Unicode Collation Driver
-
-Arguments:
-
- ImageHandle -
-
- SystemTable -
-
-Returns:
-
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
-
---*/
-{
- UINTN Index;
- UINTN Index2;
-
- //
- // Initialize mapping tables for the supported languages
- //
- for (Index = 0; Index < 0x100; Index++) {
- mEngUpperMap[Index] = (CHAR8) Index;
- mEngLowerMap[Index] = (CHAR8) Index;
- mEngInfoMap[Index] = 0;
-
- if ((Index >= 'a' && Index <= 'z') || (Index >= 0xe0 && Index <= 0xf6) || (Index >= 0xf8 && Index <= 0xfe)) {
-
- Index2 = Index - 0x20;
- mEngUpperMap[Index] = (CHAR8) Index2;
- mEngLowerMap[Index2] = (CHAR8) Index;
-
- mEngInfoMap[Index] |= CHAR_FAT_VALID;
- mEngInfoMap[Index2] |= CHAR_FAT_VALID;
- }
- }
-
- for (Index = 0; mOtherChars[Index]; Index++) {
- Index2 = mOtherChars[Index];
- mEngInfoMap[Index2] |= CHAR_FAT_VALID;
- }
- //
- // Create a handle for the device
- //
- return gBS->InstallProtocolInterface (
- &mHandle,
- &gEfiUnicodeCollationProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &UnicodeEng
- );
-}
-
-INTN
-EFIAPI
-EngStriColl (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *s1,
- IN CHAR16 *s2
- )
-/*++
-
-Routine Description:
-
- Performs a case-insensitive comparison of two Null-terminated Unicode strings.
-
-Arguments:
-
- This
- s1
- s2
-
-Returns:
-
---*/
-{
- while (*s1) {
- if (ToUpper (*s1) != ToUpper (*s2)) {
- break;
- }
-
- s1 += 1;
- s2 += 1;
- }
-
- return ToUpper (*s1) - ToUpper (*s2);
-}
-
-VOID
-EFIAPI
-EngStrLwr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- )
-/*++
-
-Routine Description:
-
- Converts all the Unicode characters in a Null-terminated Unicode string
- to lower case Unicode characters.
-
-Arguments:
-
- This - A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.
- Str1 - A pointer to a Null-terminated Unicode string.
- Str2 - A pointer to a Null-terminated Unicode string.
-
-Returns:
-
- 0 - s1 is equivalent to s2.
- > 0 - s1 is lexically greater than s2.
- < 0 - s1 is lexically less than s2.
-
---*/
-{
- while (*Str) {
- *Str = ToLower (*Str);
- Str += 1;
- }
-}
-
-VOID
-EFIAPI
-EngStrUpr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- )
-/*++
-
-Routine Description:
-
- Converts all the Unicode characters in a Null-terminated
- Unicode string to upper case Unicode characters.
-
-Arguments:
- This
- Str
-
-Returns:
- None
-
---*/
-{
- while (*Str) {
- *Str = ToUpper (*Str);
- Str += 1;
- }
-}
-
-BOOLEAN
-EFIAPI
-EngMetaiMatch (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN CHAR16 *Pattern
- )
-/*++
-
-Routine Description:
-
- Performs a case-insensitive comparison between a Null-terminated
- Unicode pattern string and a Null-terminated Unicode string.
-
- The pattern string can use the '?' wildcard to match any character,
- and the '*' wildcard to match any sub-string.
-
-Arguments:
-
- This - A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.
- String - A pointer to a Null-terminated Unicode string.
- Pattern - A pointer to a Null-terminated Unicode pattern string.
-
-Returns:
-
- TRUE - Pattern was found in String.
- FALSE - Pattern was not found in String.
-
---*/
-{
- CHAR16 CharC;
- CHAR16 CharP;
- CHAR16 Index3;
-
- for (;;) {
- CharP = *Pattern;
- Pattern += 1;
-
- switch (CharP) {
- case 0:
- //
- // End of pattern. If end of string, TRUE match
- //
- if (*String) {
- return FALSE;
- } else {
- return TRUE;
- }
-
- case '*':
- //
- // Match zero or more chars
- //
- while (*String) {
- if (EngMetaiMatch (This, String, Pattern)) {
- return TRUE;
- }
-
- String += 1;
- }
-
- return EngMetaiMatch (This, String, Pattern);
-
- case '?':
- //
- // Match any one char
- //
- if (!*String) {
- return FALSE;
- }
-
- String += 1;
- break;
-
- case '[':
- //
- // Match char set
- //
- CharC = *String;
- if (!CharC) {
- //
- // syntax problem
- //
- return FALSE;
- }
-
- Index3 = 0;
- CharP = *Pattern++;
- while (CharP) {
- if (CharP == ']') {
- return FALSE;
- }
-
- if (CharP == '-') {
- //
- // if range of chars, get high range
- //
- CharP = *Pattern;
- if (CharP == 0 || CharP == ']') {
- //
- // syntax problem
- //
- return FALSE;
- }
-
- if (ToUpper (CharC) >= ToUpper (Index3) && ToUpper (CharC) <= ToUpper (CharP)) {
- //
- // if in range, it's a match
- //
- break;
- }
- }
-
- Index3 = CharP;
- if (ToUpper (CharC) == ToUpper (CharP)) {
- //
- // if char matches
- //
- break;
- }
-
- CharP = *Pattern++;
- }
- //
- // skip to end of match char set
- //
- while (CharP && CharP != ']') {
- CharP = *Pattern;
- Pattern += 1;
- }
-
- String += 1;
- break;
-
- default:
- CharC = *String;
- if (ToUpper (CharC) != ToUpper (CharP)) {
- return FALSE;
- }
-
- String += 1;
- break;
- }
- }
-}
-
-VOID
-EFIAPI
-EngFatToStr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN UINTN FatSize,
- IN CHAR8 *Fat,
- OUT CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- Converts an 8.3 FAT file name using an OEM character set
- to a Null-terminated Unicode string.
-
- BUGBUG: Function has to expand DBCS FAT chars, currently not.
-
-Arguments:
- This
- FatSize
- Fat
- String
-
-Returns:
-
---*/
-{
- //
- // No DBCS issues, just expand and add null terminate to end of string
- //
- while (*Fat && FatSize) {
- *String = *Fat;
- String += 1;
- Fat += 1;
- FatSize -= 1;
- }
-
- *String = 0;
-}
-
-BOOLEAN
-EFIAPI
-EngStrToFat (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN UINTN FatSize,
- OUT CHAR8 *Fat
- )
-/*++
-
-Routine Description:
-
- Converts a Null-terminated Unicode string to legal characters
- in a FAT filename using an OEM character set.
-
- Functions has to crunch string to a fat string. Replacing
- any chars that can't be represented in the fat name.
-
-Arguments:
- This
- String
- FatSize
- Fat
-
-Returns:
- TRUE
- FALSE
---*/
-{
- BOOLEAN SpecialCharExist;
-
- SpecialCharExist = FALSE;
- while (*String && FatSize) {
- //
- // Skip '.' or ' ' when making a fat name
- //
- if (*String != '.' && *String != ' ') {
- //
- // If this is a valid fat char, move it.
- // Otherwise, move a '_' and flag the fact that the name needs an Lfn
- //
- if (*String < 0x100 && (mEngInfoMap[*String] & CHAR_FAT_VALID)) {
- *Fat = mEngUpperMap[*String];
- } else {
- *Fat = '_';
- SpecialCharExist = TRUE;
- }
-
- Fat += 1;
- FatSize -= 1;
- }
-
- String += 1;
- }
- //
- // Do not terminate that fat string
- //
- return SpecialCharExist;
-}
diff --git a/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.h b/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.h
deleted file mode 100644
index 6bd5479..0000000
--- a/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- UnicodeCollationEng.h
-
-Abstract:
-
- Head file for Unicode Collation Protocol (English)
-
-Revision History
-
---*/
-
-#ifndef _UNICODE_COLLATION_ENG_H
-#define _UNICODE_COLLATION_ENG_H
-
-
-
-//
-// Defines
-//
-#define CHAR_FAT_VALID 0x01
-
-#define ToUpper(a) (CHAR16) (a <= 0xFF ? mEngUpperMap[a] : a)
-#define ToLower(a) (CHAR16) (a <= 0xFF ? mEngLowerMap[a] : a)
-
-//
-// Prototypes
-//
-INTN
-EFIAPI
-EngStriColl (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *s1,
- IN CHAR16 *s2
- )
-;
-
-BOOLEAN
-EFIAPI
-EngMetaiMatch (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN CHAR16 *Pattern
- )
-;
-
-VOID
-EFIAPI
-EngStrLwr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- )
-;
-
-VOID
-EFIAPI
-EngStrUpr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN OUT CHAR16 *Str
- )
-;
-
-VOID
-EFIAPI
-EngFatToStr (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN UINTN FatSize,
- IN CHAR8 *Fat,
- OUT CHAR16 *String
- )
-;
-
-BOOLEAN
-EFIAPI
-EngStrToFat (
- IN EFI_UNICODE_COLLATION_PROTOCOL *This,
- IN CHAR16 *String,
- IN UINTN FatSize,
- OUT CHAR8 *Fat
- )
-;
-
-EFI_STATUS
-EFIAPI
-InitializeUnicodeCollationEng (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/Ebc.dxs b/EdkModulePkg/Universal/Ebc/Dxe/Ebc.dxs
deleted file mode 100644
index 4b083dd..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/Ebc.dxs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ebc.dxs
-
-Abstract:
-
- Dependency expression file for EBC VM.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/Ebc.msa b/EdkModulePkg/Universal/Ebc/Dxe/Ebc.msa
deleted file mode 100644
index 6b43afa..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/Ebc.msa
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>Ebc</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>13AC6DD0-73D0-11D4-B06B-00AA00BD6DE7</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Ebc module.</Abstract>
- <Description>This module for the EBC virtual machine implementation produces
- EBC and EBC debug support protocols.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Ebc</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a">
- <Keyword>BaseMemoryLib</Keyword>
- <HelpText>Recommended libary Instance is DxeMemoryLib instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>EbcInt.c</Filename>
- <Filename>EbcInt.h</Filename>
- <Filename>EbcExecute.c</Filename>
- <Filename>EbcExecute.h</Filename>
- <Filename>Ebc.dxs</Filename>
- <Filename SupArchList="IA32" ToolChainFamily="MSFT">Ia32/EbcLowLevel.asm</Filename>
- <Filename SupArchList="IA32" ToolChainFamily="GCC">Ia32/EbcLowLevel.S</Filename>
- <Filename SupArchList="IA32">Ia32/EbcSupport.c</Filename>
- <Filename SupArchList="X64" ToolChainFamily="MSFT">x64/EbcLowLevel.asm</Filename>
- <Filename SupArchList="X64" ToolChainFamily="GCC">x64/EbcLowLevel.S</Filename>
- <Filename SupArchList="X64">x64/EbcSupport.c</Filename>
- <Filename SupArchList="IPF">Ipf/EbcLowLevel.s</Filename>
- <Filename SupArchList="IPF">Ipf/EbcSupport.c</Filename>
- <Filename SupArchList="IPF">Ipf/EbcSupport.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiEbcProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiDebugSupportProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>InitializeEbcDriver</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.c b/EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.c
deleted file mode 100644
index 174e774..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.c
+++ /dev/null
@@ -1,4564 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EbcExecute.c
-
-Abstract:
-
- Contains code that implements the virtual machine.
-
---*/
-
-#include "EbcInt.h"
-#include "EbcExecute.h"
-
-
-//
-// Define some useful data size constants to allow switch statements based on
-// size of operands or data.
-//
-#define DATA_SIZE_INVALID 0
-#define DATA_SIZE_8 1
-#define DATA_SIZE_16 2
-#define DATA_SIZE_32 4
-#define DATA_SIZE_64 8
-#define DATA_SIZE_N 48 // 4 or 8
-//
-// Structure we'll use to dispatch opcodes to execute functions.
-//
-typedef struct {
- EFI_STATUS (*ExecuteFunction) (IN VM_CONTEXT * VmPtr);
-}
-VM_TABLE_ENTRY;
-
-typedef
-UINT64
-(*DATA_MANIP_EXEC_FUNCTION) (
- IN VM_CONTEXT * VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-INT16
-VmReadIndex16 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 CodeOffset
- );
-
-STATIC
-INT32
-VmReadIndex32 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 CodeOffset
- );
-
-STATIC
-INT64
-VmReadIndex64 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 CodeOffset
- );
-
-STATIC
-UINT8
-VmReadMem8 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- );
-
-STATIC
-UINT16
-VmReadMem16 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- );
-
-STATIC
-UINT32
-VmReadMem32 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- );
-
-STATIC
-UINT64
-VmReadMem64 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- );
-
-STATIC
-UINTN
-VmReadMemN (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- );
-
-STATIC
-EFI_STATUS
-VmWriteMem8 (
- IN VM_CONTEXT *VmPtr,
- UINTN Addr,
- IN UINT8 Data
- );
-
-STATIC
-EFI_STATUS
-VmWriteMem16 (
- IN VM_CONTEXT *VmPtr,
- UINTN Addr,
- IN UINT16 Data
- );
-
-STATIC
-EFI_STATUS
-VmWriteMem32 (
- IN VM_CONTEXT *VmPtr,
- UINTN Addr,
- IN UINT32 Data
- );
-
-STATIC
-UINT16
-VmReadCode16 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- );
-
-STATIC
-UINT32
-VmReadCode32 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- );
-
-STATIC
-UINT64
-VmReadCode64 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- );
-
-STATIC
-INT8
-VmReadImmed8 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- );
-
-STATIC
-INT16
-VmReadImmed16 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- );
-
-STATIC
-INT32
-VmReadImmed32 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- );
-
-STATIC
-INT64
-VmReadImmed64 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- );
-
-STATIC
-UINTN
-ConvertStackAddr (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- );
-
-STATIC
-EFI_STATUS
-ExecuteDataManip (
- IN VM_CONTEXT *VmPtr,
- IN BOOLEAN IsSignedOperation
- );
-
-//
-// Functions that execute VM opcodes
-//
-STATIC
-EFI_STATUS
-ExecuteBREAK (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteJMP (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteJMP8 (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteCALL (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteRET (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteCMP (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteCMPI (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteMOVxx (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteMOVI (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteMOVIn (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteMOVREL (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecutePUSHn (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecutePUSH (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecutePOPn (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecutePOP (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteSignedDataManip (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteUnsignedDataManip (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteLOADSP (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteSTORESP (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteMOVsnd (
- IN VM_CONTEXT *VmPtr
- );
-
-STATIC
-EFI_STATUS
-ExecuteMOVsnw (
- IN VM_CONTEXT *VmPtr
- );
-
-//
-// Data manipulation subfunctions
-//
-STATIC
-UINT64
-ExecuteNOT (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteNEG (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteADD (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteSUB (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteMUL (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteMULU (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteDIV (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteDIVU (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteMOD (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteMODU (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteAND (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteOR (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteXOR (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteSHL (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteSHR (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteASHR (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteEXTNDB (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteEXTNDW (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-STATIC
-UINT64
-ExecuteEXTNDD (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- );
-
-//
-// Once we retrieve the operands for the data manipulation instructions,
-// call these functions to perform the operation.
-//
-static CONST DATA_MANIP_EXEC_FUNCTION mDataManipDispatchTable[] = {
- ExecuteNOT,
- ExecuteNEG,
- ExecuteADD,
- ExecuteSUB,
- ExecuteMUL,
- ExecuteMULU,
- ExecuteDIV,
- ExecuteDIVU,
- ExecuteMOD,
- ExecuteMODU,
- ExecuteAND,
- ExecuteOR,
- ExecuteXOR,
- ExecuteSHL,
- ExecuteSHR,
- ExecuteASHR,
- ExecuteEXTNDB,
- ExecuteEXTNDW,
- ExecuteEXTNDD,
-};
-
-static CONST VM_TABLE_ENTRY mVmOpcodeTable[] = {
- { ExecuteBREAK }, // opcode 0x00
- { ExecuteJMP }, // opcode 0x01
- { ExecuteJMP8 }, // opcode 0x02
- { ExecuteCALL }, // opcode 0x03
- { ExecuteRET }, // opcode 0x04
- { ExecuteCMP }, // opcode 0x05 CMPeq
- { ExecuteCMP }, // opcode 0x06 CMPlte
- { ExecuteCMP }, // opcode 0x07 CMPgte
- { ExecuteCMP }, // opcode 0x08 CMPulte
- { ExecuteCMP }, // opcode 0x09 CMPugte
- { ExecuteUnsignedDataManip }, // opcode 0x0A NOT
- { ExecuteSignedDataManip }, // opcode 0x0B NEG
- { ExecuteSignedDataManip }, // opcode 0x0C ADD
- { ExecuteSignedDataManip }, // opcode 0x0D SUB
- { ExecuteSignedDataManip }, // opcode 0x0E MUL
- { ExecuteUnsignedDataManip }, // opcode 0x0F MULU
- { ExecuteSignedDataManip }, // opcode 0x10 DIV
- { ExecuteUnsignedDataManip }, // opcode 0x11 DIVU
- { ExecuteSignedDataManip }, // opcode 0x12 MOD
- { ExecuteUnsignedDataManip }, // opcode 0x13 MODU
- { ExecuteUnsignedDataManip }, // opcode 0x14 AND
- { ExecuteUnsignedDataManip }, // opcode 0x15 OR
- { ExecuteUnsignedDataManip }, // opcode 0x16 XOR
- { ExecuteUnsignedDataManip }, // opcode 0x17 SHL
- { ExecuteUnsignedDataManip }, // opcode 0x18 SHR
- { ExecuteSignedDataManip }, // opcode 0x19 ASHR
- { ExecuteUnsignedDataManip }, // opcode 0x1A EXTNDB
- { ExecuteUnsignedDataManip }, // opcode 0x1B EXTNDW
- { ExecuteUnsignedDataManip }, // opcode 0x1C EXTNDD
- { ExecuteMOVxx }, // opcode 0x1D MOVBW
- { ExecuteMOVxx }, // opcode 0x1E MOVWW
- { ExecuteMOVxx }, // opcode 0x1F MOVDW
- { ExecuteMOVxx }, // opcode 0x20 MOVQW
- { ExecuteMOVxx }, // opcode 0x21 MOVBD
- { ExecuteMOVxx }, // opcode 0x22 MOVWD
- { ExecuteMOVxx }, // opcode 0x23 MOVDD
- { ExecuteMOVxx }, // opcode 0x24 MOVQD
- { ExecuteMOVsnw }, // opcode 0x25 MOVsnw
- { ExecuteMOVsnd }, // opcode 0x26 MOVsnd
- { NULL }, // opcode 0x27
- { ExecuteMOVxx }, // opcode 0x28 MOVqq
- { ExecuteLOADSP }, // opcode 0x29 LOADSP SP1, R2
- { ExecuteSTORESP }, // opcode 0x2A STORESP R1, SP2
- { ExecutePUSH }, // opcode 0x2B PUSH {@}R1 [imm16]
- { ExecutePOP }, // opcode 0x2C POP {@}R1 [imm16]
- { ExecuteCMPI }, // opcode 0x2D CMPIEQ
- { ExecuteCMPI }, // opcode 0x2E CMPILTE
- { ExecuteCMPI }, // opcode 0x2F CMPIGTE
- { ExecuteCMPI }, // opcode 0x30 CMPIULTE
- { ExecuteCMPI }, // opcode 0x31 CMPIUGTE
- { ExecuteMOVxx }, // opcode 0x32 MOVN
- { ExecuteMOVxx }, // opcode 0x33 MOVND
- { NULL }, // opcode 0x34
- { ExecutePUSHn }, // opcode 0x35
- { ExecutePOPn }, // opcode 0x36
- { ExecuteMOVI }, // opcode 0x37 - mov immediate data
- { ExecuteMOVIn }, // opcode 0x38 - mov immediate natural
- { ExecuteMOVREL } // opcode 0x39 - move data relative to PC
-};
-
-//
-// Length of JMP instructions, depending on upper two bits of opcode.
-//
-static CONST UINT8 mJMPLen[] = { 2, 2, 6, 10 };
-
-//
-// Simple Debugger Protocol GUID
-//
-EFI_GUID mEbcSimpleDebuggerProtocolGuid = EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL_GUID;
-
-EFI_STATUS
-EbcExecuteInstructions (
- IN EFI_EBC_VM_TEST_PROTOCOL *This,
- IN VM_CONTEXT *VmPtr,
- IN OUT UINTN *InstructionCount
- )
-/*++
-
-Routine Description:
-
- Given a pointer to a new VM context, execute one or more instructions. This
- function is only used for test purposes via the EBC VM test protocol.
-
-Arguments:
-
- This - pointer to protocol interface
- VmPtr - pointer to a VM context
- InstructionCount - how many instructions to execute. 0 if don't count.
-
-Returns:
-
- EFI_UNSUPPORTED
- EFI_SUCCESS
-
---*/
-{
- UINTN ExecFunc;
- EFI_STATUS Status;
- UINTN InstructionsLeft;
- UINTN SavedInstructionCount;
-
- Status = EFI_SUCCESS;
-
- if (*InstructionCount == 0) {
- InstructionsLeft = 1;
- } else {
- InstructionsLeft = *InstructionCount;
- }
-
- SavedInstructionCount = *InstructionCount;
- *InstructionCount = 0;
-
- //
- // Index into the opcode table using the opcode byte for this instruction.
- // This gives you the execute function, which we first test for null, then
- // call it if it's not null.
- //
- while (InstructionsLeft != 0) {
- ExecFunc = (UINTN) mVmOpcodeTable[(*VmPtr->Ip & 0x3F)].ExecuteFunction;
- if (ExecFunc == (UINTN) NULL) {
- EbcDebugSignalException (EXCEPT_EBC_INVALID_OPCODE, EXCEPTION_FLAG_FATAL, VmPtr);
- return EFI_UNSUPPORTED;
- } else {
- mVmOpcodeTable[(*VmPtr->Ip & 0x3F)].ExecuteFunction (VmPtr);
- *InstructionCount = *InstructionCount + 1;
- }
-
- //
- // Decrement counter if applicable
- //
- if (SavedInstructionCount != 0) {
- InstructionsLeft--;
- }
- }
-
- return Status;
-}
-
-EFI_STATUS
-EbcExecute (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
-
- Execute an EBC image from an entry point or from a published protocol.
-
-Arguments:
-
- VmPtr - pointer to prepared VM context.
-
-Returns:
-
- Standard EBC status.
-
---*/
-{
- UINTN ExecFunc;
- UINT8 StackCorrupted;
- EFI_STATUS Status;
- EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL *EbcSimpleDebugger;
-
- mVmPtr = VmPtr;
- EbcSimpleDebugger = NULL;
- Status = EFI_SUCCESS;
- StackCorrupted = 0;
-
- //
- // Make sure the magic value has been put on the stack before we got here.
- //
- if (*VmPtr->StackMagicPtr != (UINTN) VM_STACK_KEY_VALUE) {
- StackCorrupted = 1;
- }
-
- VmPtr->FramePtr = (VOID *) ((UINT8 *) (UINTN) VmPtr->R[0] + 8);
-
- //
- // Try to get the debug support for EBC
- //
- DEBUG_CODE_BEGIN ();
- Status = gBS->LocateProtocol (
- &mEbcSimpleDebuggerProtocolGuid,
- NULL,
- (VOID **) &EbcSimpleDebugger
- );
- if (EFI_ERROR (Status)) {
- EbcSimpleDebugger = NULL;
- }
- DEBUG_CODE_END ();
-
- //
- // Save the start IP for debug. For example, if we take an exception we
- // can print out the location of the exception relative to the entry point,
- // which could then be used in a disassembly listing to find the problem.
- //
- VmPtr->EntryPoint = (VOID *) VmPtr->Ip;
-
- //
- // We'll wait for this flag to know when we're done. The RET
- // instruction sets it if it runs out of stack.
- //
- VmPtr->StopFlags = 0;
- while (!(VmPtr->StopFlags & STOPFLAG_APP_DONE)) {
- //
- // If we've found a simple debugger protocol, call it
- //
- DEBUG_CODE_BEGIN ();
- if (EbcSimpleDebugger != NULL) {
- EbcSimpleDebugger->Debugger (EbcSimpleDebugger, VmPtr);
- }
- DEBUG_CODE_END ();
-
- //
- // Verify the opcode is in range. Otherwise generate an exception.
- //
- if ((*VmPtr->Ip & OPCODE_M_OPCODE) >= (sizeof (mVmOpcodeTable) / sizeof (mVmOpcodeTable[0]))) {
- EbcDebugSignalException (EXCEPT_EBC_INVALID_OPCODE, EXCEPTION_FLAG_FATAL, VmPtr);
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
- //
- // Use the opcode bits to index into the opcode dispatch table. If the
- // function pointer is null then generate an exception.
- //
- ExecFunc = (UINTN) mVmOpcodeTable[(*VmPtr->Ip & OPCODE_M_OPCODE)].ExecuteFunction;
- if (ExecFunc == (UINTN) NULL) {
- EbcDebugSignalException (EXCEPT_EBC_INVALID_OPCODE, EXCEPTION_FLAG_FATAL, VmPtr);
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
- //
- // The EBC VM is a strongly ordered processor, so perform a fence operation before
- // and after each instruction is executed.
- //
- MemoryFence ();
-
- mVmOpcodeTable[(*VmPtr->Ip & OPCODE_M_OPCODE)].ExecuteFunction (VmPtr);
-
- MemoryFence ();
-
- //
- // If the step flag is set, signal an exception and continue. We don't
- // clear it here. Assuming the debugger is responsible for clearing it.
- //
- if (VMFLAG_ISSET (VmPtr, VMFLAGS_STEP)) {
- EbcDebugSignalException (EXCEPT_EBC_STEP, EXCEPTION_FLAG_NONE, VmPtr);
- }
- //
- // Make sure stack has not been corrupted. Only report it once though.
- //
- if (!StackCorrupted && (*VmPtr->StackMagicPtr != (UINTN) VM_STACK_KEY_VALUE)) {
- EbcDebugSignalException (EXCEPT_EBC_STACK_FAULT, EXCEPTION_FLAG_FATAL, VmPtr);
- StackCorrupted = 1;
- }
- if (!StackCorrupted && ((UINT64)VmPtr->R[0] <= (UINT64)(UINTN) VmPtr->StackTop)) {
- EbcDebugSignalException (EXCEPT_EBC_STACK_FAULT, EXCEPTION_FLAG_FATAL, VmPtr);
- StackCorrupted = 1;
- }
- }
-
-Done:
- mVmPtr = NULL;
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-ExecuteMOVxx (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
-
- Execute the MOVxx instructions.
-
-Arguments:
-
- VmPtr - pointer to a VM context.
-
-Returns:
-
- EFI_UNSUPPORTED
- EFI_SUCCESS
-
-Instruction format:
-
- MOV[b|w|d|q|n]{w|d} {@}R1 {Index16|32}, {@}R2 {Index16|32}
- MOVqq {@}R1 {Index64}, {@}R2 {Index64}
-
- Copies contents of [R2] -> [R1], zero extending where required.
-
- First character indicates the size of the move.
- Second character indicates the size of the index(s).
-
- Invalid to have R1 direct with index.
-
---*/
-{
- UINT8 Opcode;
- UINT8 OpcMasked;
- UINT8 Operands;
- UINT8 Size;
- UINT8 MoveSize;
- INT16 Index16;
- INT32 Index32;
- INT64 Index64Op1;
- INT64 Index64Op2;
- UINT64 Data64;
- UINT64 DataMask;
- UINTN Source;
-
- Opcode = GETOPCODE (VmPtr);
- OpcMasked = (UINT8) (Opcode & OPCODE_M_OPCODE);
-
- //
- // Get the operands byte so we can get R1 and R2
- //
- Operands = GETOPERANDS (VmPtr);
-
- //
- // Assume no indexes
- //
- Index64Op1 = 0;
- Index64Op2 = 0;
- Data64 = 0;
-
- //
- // Determine if we have an index/immediate data. Base instruction size
- // is 2 (opcode + operands). Add to this size each index specified.
- //
- Size = 2;
- if (Opcode & (OPCODE_M_IMMED_OP1 | OPCODE_M_IMMED_OP2)) {
- //
- // Determine size of the index from the opcode. Then get it.
- //
- if ((OpcMasked <= OPCODE_MOVQW) || (OpcMasked == OPCODE_MOVNW)) {
- //
- // MOVBW, MOVWW, MOVDW, MOVQW, and MOVNW have 16-bit immediate index.
- // Get one or both index values.
- //
- if (Opcode & OPCODE_M_IMMED_OP1) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- Index64Op1 = (INT64) Index16;
- Size += sizeof (UINT16);
- }
-
- if (Opcode & OPCODE_M_IMMED_OP2) {
- Index16 = VmReadIndex16 (VmPtr, Size);
- Index64Op2 = (INT64) Index16;
- Size += sizeof (UINT16);
- }
- } else if ((OpcMasked <= OPCODE_MOVQD) || (OpcMasked == OPCODE_MOVND)) {
- //
- // MOVBD, MOVWD, MOVDD, MOVQD, and MOVND have 32-bit immediate index
- //
- if (Opcode & OPCODE_M_IMMED_OP1) {
- Index32 = VmReadIndex32 (VmPtr, 2);
- Index64Op1 = (INT64) Index32;
- Size += sizeof (UINT32);
- }
-
- if (Opcode & OPCODE_M_IMMED_OP2) {
- Index32 = VmReadIndex32 (VmPtr, Size);
- Index64Op2 = (INT64) Index32;
- Size += sizeof (UINT32);
- }
- } else if (OpcMasked == OPCODE_MOVQQ) {
- //
- // MOVqq -- only form with a 64-bit index
- //
- if (Opcode & OPCODE_M_IMMED_OP1) {
- Index64Op1 = VmReadIndex64 (VmPtr, 2);
- Size += sizeof (UINT64);
- }
-
- if (Opcode & OPCODE_M_IMMED_OP2) {
- Index64Op2 = VmReadIndex64 (VmPtr, Size);
- Size += sizeof (UINT64);
- }
- } else {
- //
- // Obsolete MOVBQ, MOVWQ, MOVDQ, and MOVNQ have 64-bit immediate index
- //
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
- }
- //
- // Determine the size of the move, and create a mask for it so we can
- // clear unused bits.
- //
- if ((OpcMasked == OPCODE_MOVBW) || (OpcMasked == OPCODE_MOVBD)) {
- MoveSize = DATA_SIZE_8;
- DataMask = 0xFF;
- } else if ((OpcMasked == OPCODE_MOVWW) || (OpcMasked == OPCODE_MOVWD)) {
- MoveSize = DATA_SIZE_16;
- DataMask = 0xFFFF;
- } else if ((OpcMasked == OPCODE_MOVDW) || (OpcMasked == OPCODE_MOVDD)) {
- MoveSize = DATA_SIZE_32;
- DataMask = 0xFFFFFFFF;
- } else if ((OpcMasked == OPCODE_MOVQW) || (OpcMasked == OPCODE_MOVQD) || (OpcMasked == OPCODE_MOVQQ)) {
- MoveSize = DATA_SIZE_64;
- DataMask = (UINT64)~0;
- } else if ((OpcMasked == OPCODE_MOVNW) || (OpcMasked == OPCODE_MOVND)) {
- MoveSize = DATA_SIZE_N;
- DataMask = (UINT64)~0 >> (64 - 8 * sizeof (UINTN));
- } else {
- //
- // We were dispatched to this function and we don't recognize the opcode
- //
- EbcDebugSignalException (EXCEPT_EBC_UNDEFINED, EXCEPTION_FLAG_FATAL, VmPtr);
- return EFI_UNSUPPORTED;
- }
- //
- // Now get the source address
- //
- if (OPERAND2_INDIRECT (Operands)) {
- //
- // Indirect form @R2. Compute address of operand2
- //
- Source = (UINTN) (VmPtr->R[OPERAND2_REGNUM (Operands)] + Index64Op2);
- //
- // Now get the data from the source. Always 0-extend and let the compiler
- // sign-extend where required.
- //
- switch (MoveSize) {
- case DATA_SIZE_8:
- Data64 = (UINT64) (UINT8) VmReadMem8 (VmPtr, Source);
- break;
-
- case DATA_SIZE_16:
- Data64 = (UINT64) (UINT16) VmReadMem16 (VmPtr, Source);
- break;
-
- case DATA_SIZE_32:
- Data64 = (UINT64) (UINT32) VmReadMem32 (VmPtr, Source);
- break;
-
- case DATA_SIZE_64:
- Data64 = (UINT64) VmReadMem64 (VmPtr, Source);
- break;
-
- case DATA_SIZE_N:
- Data64 = (UINT64) (UINTN) VmReadMemN (VmPtr, Source);
- break;
-
- default:
- //
- // not reached
- //
- break;
- }
- } else {
- //
- // Not indirect source: MOVxx {@}Rx, Ry [Index]
- //
- Data64 = VmPtr->R[OPERAND2_REGNUM (Operands)] + Index64Op2;
- //
- // Did Operand2 have an index? If so, treat as two signed values since
- // indexes are signed values.
- //
- if (Opcode & OPCODE_M_IMMED_OP2) {
- //
- // NOTE: need to find a way to fix this, most likely by changing the VM
- // implementation to remove the stack gap. To do that, we'd need to
- // allocate stack space for the VM and actually set the system
- // stack pointer to the allocated buffer when the VM starts.
- //
- // Special case -- if someone took the address of a function parameter
- // then we need to make sure it's not in the stack gap. We can identify
- // this situation if (Operand2 register == 0) && (Operand2 is direct)
- // && (Index applies to Operand2) && (Index > 0) && (Operand1 register != 0)
- // Situations that to be aware of:
- // * stack adjustments at beginning and end of functions R0 = R0 += stacksize
- //
- if ((OPERAND2_REGNUM (Operands) == 0) &&
- (!OPERAND2_INDIRECT (Operands)) &&
- (Index64Op2 > 0) &&
- (OPERAND1_REGNUM (Operands) == 0) &&
- (OPERAND1_INDIRECT (Operands))
- ) {
- Data64 = (UINT64) ConvertStackAddr (VmPtr, (UINTN) (INT64) Data64);
- }
- }
- }
- //
- // Now write it back
- //
- if (OPERAND1_INDIRECT (Operands)) {
- //
- // Reuse the Source variable to now be dest.
- //
- Source = (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index64Op1);
- //
- // Do the write based on the size
- //
- switch (MoveSize) {
- case DATA_SIZE_8:
- VmWriteMem8 (VmPtr, Source, (UINT8) Data64);
- break;
-
- case DATA_SIZE_16:
- VmWriteMem16 (VmPtr, Source, (UINT16) Data64);
- break;
-
- case DATA_SIZE_32:
- VmWriteMem32 (VmPtr, Source, (UINT32) Data64);
- break;
-
- case DATA_SIZE_64:
- VmWriteMem64 (VmPtr, Source, Data64);
- break;
-
- case DATA_SIZE_N:
- VmWriteMemN (VmPtr, Source, (UINTN) Data64);
- break;
-
- default:
- //
- // not reached
- //
- break;
- }
- } else {
- //
- // Operand1 direct.
- // Make sure we didn't have an index on operand1.
- //
- if (Opcode & OPCODE_M_IMMED_OP1) {
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
- //
- // Direct storage in register. Clear unused bits and store back to
- // register.
- //
- VmPtr->R[OPERAND1_REGNUM (Operands)] = Data64 & DataMask;
- }
- //
- // Advance the instruction pointer
- //
- VmPtr->Ip += Size;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteBREAK (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
-
- Execute the EBC BREAK instruction
-
-Arguments:
-
- VmPtr - pointer to current VM context
-
-Returns:
-
- EFI_UNSUPPORTED
- EFI_SUCCESS
-
---*/
-{
- UINT8 Operands;
- VOID *EbcEntryPoint;
- VOID *Thunk;
- UINT64 U64EbcEntryPoint;
- INT32 Offset;
-
- Operands = GETOPERANDS (VmPtr);
- switch (Operands) {
- //
- // Runaway program break. Generate an exception and terminate
- //
- case 0:
- EbcDebugSignalException (EXCEPT_EBC_BAD_BREAK, EXCEPTION_FLAG_FATAL, VmPtr);
- break;
-
- //
- // Get VM version -- return VM revision number in R7
- //
- case 1:
- //
- // Bits:
- // 63-17 = 0
- // 16-8 = Major version
- // 7-0 = Minor version
- //
- VmPtr->R[7] = GetVmVersion ();
- break;
-
- //
- // Debugger breakpoint
- //
- case 3:
- VmPtr->StopFlags |= STOPFLAG_BREAKPOINT;
- //
- // See if someone has registered a handler
- //
- EbcDebugSignalException (
- EXCEPT_EBC_BREAKPOINT,
- EXCEPTION_FLAG_NONE,
- VmPtr
- );
- break;
-
- //
- // System call, which there are none, so NOP it.
- //
- case 4:
- break;
-
- //
- // Create a thunk for EBC code. R7 points to a 32-bit (in a 64-bit slot)
- // "offset from self" pointer to the EBC entry point.
- // After we're done, *(UINT64 *)R7 will be the address of the new thunk.
- //
- case 5:
- Offset = (INT32) VmReadMem32 (VmPtr, (UINTN) VmPtr->R[7]);
- U64EbcEntryPoint = (UINT64) (VmPtr->R[7] + Offset + 4);
- EbcEntryPoint = (VOID *) (UINTN) U64EbcEntryPoint;
-
- //
- // Now create a new thunk
- //
- EbcCreateThunks (VmPtr->ImageHandle, EbcEntryPoint, &Thunk, 0);
-
- //
- // Finally replace the EBC entry point memory with the thunk address
- //
- VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[7], (UINT64) (UINTN) Thunk);
- break;
-
- //
- // Compiler setting version per value in R7
- //
- case 6:
- VmPtr->CompilerVersion = (UINT32) VmPtr->R[7];
- //
- // Check compiler version against VM version?
- //
- break;
-
- //
- // Unhandled break code. Signal exception.
- //
- default:
- EbcDebugSignalException (EXCEPT_EBC_BAD_BREAK, EXCEPTION_FLAG_FATAL, VmPtr);
- break;
- }
- //
- // Advance IP
- //
- VmPtr->Ip += 2;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteJMP (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the JMP instruction
-
-Arguments:
- VmPtr - pointer to VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- JMP64{cs|cc} Immed64
- JMP32{cs|cc} {@}R1 {Immed32|Index32}
-
-Encoding:
- b0.7 - immediate data present
- b0.6 - 1 = 64 bit immediate data
- 0 = 32 bit immediate data
- b1.7 - 1 = conditional
- b1.6 1 = CS (condition set)
- 0 = CC (condition clear)
- b1.4 1 = relative address
- 0 = absolute address
- b1.3 1 = operand1 indirect
- b1.2-0 operand 1
-
---*/
-{
- UINT8 Opcode;
- UINT8 CompareSet;
- UINT8 ConditionFlag;
- UINT8 Size;
- UINT8 Operand;
- UINT64 Data64;
- INT32 Index32;
- UINTN Addr;
-
- Operand = GETOPERANDS (VmPtr);
- Opcode = GETOPCODE (VmPtr);
-
- //
- // Get instruction length from the opcode. The upper two bits are used here
- // to index into the length array.
- //
- Size = mJMPLen[(Opcode >> 6) & 0x03];
-
- //
- // Decode instruction conditions
- // If we haven't met the condition, then simply advance the IP and return.
- //
- CompareSet = (UINT8) ((Operand & JMP_M_CS) ? 1 : 0);
- ConditionFlag = (UINT8) VMFLAG_ISSET (VmPtr, VMFLAGS_CC);
- if (Operand & CONDITION_M_CONDITIONAL) {
- if (CompareSet != ConditionFlag) {
- VmPtr->Ip += Size;
- return EFI_SUCCESS;
- }
- }
- //
- // Check for 64-bit form and do it right away since it's the most
- // straight-forward form.
- //
- if (Opcode & OPCODE_M_IMMDATA64) {
- //
- // Double check for immediate-data, which is required. If not there,
- // then signal an exception
- //
- if (!(Opcode & OPCODE_M_IMMDATA)) {
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_ERROR,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
- //
- // 64-bit immediate data is full address. Read the immediate data,
- // check for alignment, and jump absolute.
- //
- Data64 = VmReadImmed64 (VmPtr, 2);
- if (!IS_ALIGNED ((UINTN) Data64, sizeof (UINT16))) {
- EbcDebugSignalException (
- EXCEPT_EBC_ALIGNMENT_CHECK,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
-
- return EFI_UNSUPPORTED;
- }
-
- //
- // Take jump -- relative or absolute
- //
- if (Operand & JMP_M_RELATIVE) {
- VmPtr->Ip += (UINTN) Data64 + Size;
- } else {
- VmPtr->Ip = (VMIP) (UINTN) Data64;
- }
-
- return EFI_SUCCESS;
- }
- //
- // 32-bit forms:
- // Get the index if there is one. May be either an index, or an immediate
- // offset depending on indirect operand.
- // JMP32 @R1 Index32 -- immediate data is an index
- // JMP32 R1 Immed32 -- immedate data is an offset
- //
- if (Opcode & OPCODE_M_IMMDATA) {
- if (OPERAND1_INDIRECT (Operand)) {
- Index32 = VmReadIndex32 (VmPtr, 2);
- } else {
- Index32 = VmReadImmed32 (VmPtr, 2);
- }
- } else {
- Index32 = 0;
- }
- //
- // Get the register data. If R == 0, then special case where it's ignored.
- //
- if (OPERAND1_REGNUM (Operand) == 0) {
- Data64 = 0;
- } else {
- Data64 = OPERAND1_REGDATA (VmPtr, Operand);
- }
- //
- // Decode the forms
- //
- if (OPERAND1_INDIRECT (Operand)) {
- //
- // Form: JMP32 @Rx {Index32}
- //
- Addr = VmReadMemN (VmPtr, (UINTN) Data64 + Index32);
- if (!IS_ALIGNED ((UINTN) Addr, sizeof (UINT16))) {
- EbcDebugSignalException (
- EXCEPT_EBC_ALIGNMENT_CHECK,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Operand & JMP_M_RELATIVE) {
- VmPtr->Ip += (UINTN) Addr + Size;
- } else {
- VmPtr->Ip = (VMIP) Addr;
- }
- } else {
- //
- // Form: JMP32 Rx {Immed32}
- //
- Addr = (UINTN) (Data64 + Index32);
- if (!IS_ALIGNED ((UINTN) Addr, sizeof (UINT16))) {
- EbcDebugSignalException (
- EXCEPT_EBC_ALIGNMENT_CHECK,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
-
- return EFI_UNSUPPORTED;
- }
-
- if (Operand & JMP_M_RELATIVE) {
- VmPtr->Ip += (UINTN) Addr + Size;
- } else {
- VmPtr->Ip = (VMIP) Addr;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteJMP8 (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the EBC JMP8 instruction
-
-Arguments:
- VmPtr - pointer to a VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- JMP8{cs|cc} Offset/2
-
---*/
-{
- UINT8 Opcode;
- UINT8 ConditionFlag;
- UINT8 CompareSet;
- INT8 Offset;
-
- //
- // Decode instruction.
- //
- Opcode = GETOPCODE (VmPtr);
- CompareSet = (UINT8) ((Opcode & JMP_M_CS) ? 1 : 0);
- ConditionFlag = (UINT8) VMFLAG_ISSET (VmPtr, VMFLAGS_CC);
-
- //
- // If we haven't met the condition, then simply advance the IP and return
- //
- if (Opcode & CONDITION_M_CONDITIONAL) {
- if (CompareSet != ConditionFlag) {
- VmPtr->Ip += 2;
- return EFI_SUCCESS;
- }
- }
- //
- // Get the offset from the instruction stream. It's relative to the
- // following instruction, and divided by 2.
- //
- Offset = VmReadImmed8 (VmPtr, 1);
- //
- // Want to check for offset == -2 and then raise an exception?
- //
- VmPtr->Ip += (Offset * 2) + 2;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteMOVI (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
-
- Execute the EBC MOVI
-
-Arguments:
-
- VmPtr - pointer to a VM context
-
-Returns:
-
- Standard EFI_STATUS
-
-Instruction syntax:
-
- MOVI[b|w|d|q][w|d|q] {@}R1 {Index16}, ImmData16|32|64
-
- First variable character specifies the move size
- Second variable character specifies size of the immediate data
-
- Sign-extend the immediate data to the size of the operation, and zero-extend
- if storing to a register.
-
- Operand1 direct with index/immed is invalid.
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- UINT8 Size;
- INT16 Index16;
- INT64 ImmData64;
- UINT64 Op1;
- UINT64 Mask64;
-
- //
- // Get the opcode and operands byte so we can get R1 and R2
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
-
- //
- // Get the index (16-bit) if present
- //
- if (Operands & MOVI_M_IMMDATA) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- Size = 4;
- } else {
- Index16 = 0;
- Size = 2;
- }
- //
- // Extract the immediate data. Sign-extend always.
- //
- if ((Opcode & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH16) {
- ImmData64 = (INT64) (INT16) VmReadImmed16 (VmPtr, Size);
- Size += 2;
- } else if ((Opcode & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH32) {
- ImmData64 = (INT64) (INT32) VmReadImmed32 (VmPtr, Size);
- Size += 4;
- } else if ((Opcode & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH64) {
- ImmData64 = (INT64) VmReadImmed64 (VmPtr, Size);
- Size += 8;
- } else {
- //
- // Invalid encoding
- //
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
- //
- // Now write back the result
- //
- if (!OPERAND1_INDIRECT (Operands)) {
- //
- // Operand1 direct. Make sure it didn't have an index.
- //
- if (Operands & MOVI_M_IMMDATA) {
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
- //
- // Writing directly to a register. Clear unused bits.
- //
- if ((Operands & MOVI_M_MOVEWIDTH) == MOVI_MOVEWIDTH8) {
- Mask64 = 0x000000FF;
- } else if ((Operands & MOVI_M_MOVEWIDTH) == MOVI_MOVEWIDTH16) {
- Mask64 = 0x0000FFFF;
- } else if ((Operands & MOVI_M_MOVEWIDTH) == MOVI_MOVEWIDTH32) {
- Mask64 = 0x00000000FFFFFFFF;
- } else {
- Mask64 = (UINT64)~0;
- }
-
- VmPtr->R[OPERAND1_REGNUM (Operands)] = ImmData64 & Mask64;
- } else {
- //
- // Get the address then write back based on size of the move
- //
- Op1 = (UINT64) VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16;
- if ((Operands & MOVI_M_MOVEWIDTH) == MOVI_MOVEWIDTH8) {
- VmWriteMem8 (VmPtr, (UINTN) Op1, (UINT8) ImmData64);
- } else if ((Operands & MOVI_M_MOVEWIDTH) == MOVI_MOVEWIDTH16) {
- VmWriteMem16 (VmPtr, (UINTN) Op1, (UINT16) ImmData64);
- } else if ((Operands & MOVI_M_MOVEWIDTH) == MOVI_MOVEWIDTH32) {
- VmWriteMem32 (VmPtr, (UINTN) Op1, (UINT32) ImmData64);
- } else {
- VmWriteMem64 (VmPtr, (UINTN) Op1, ImmData64);
- }
- }
- //
- // Advance the instruction pointer
- //
- VmPtr->Ip += Size;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteMOVIn (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
-
- Execute the EBC MOV immediate natural. This instruction moves an immediate
- index value into a register or memory location.
-
-Arguments:
-
- VmPtr - pointer to a VM context
-
-Returns:
-
- Standard EFI_STATUS
-
-Instruction syntax:
-
- MOVIn[w|d|q] {@}R1 {Index16}, Index16|32|64
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- UINT8 Size;
- INT16 Index16;
- INT16 ImmedIndex16;
- INT32 ImmedIndex32;
- INT64 ImmedIndex64;
- UINT64 Op1;
-
- //
- // Get the opcode and operands byte so we can get R1 and R2
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
-
- //
- // Get the operand1 index (16-bit) if present
- //
- if (Operands & MOVI_M_IMMDATA) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- Size = 4;
- } else {
- Index16 = 0;
- Size = 2;
- }
- //
- // Extract the immediate data and convert to a 64-bit index.
- //
- if ((Opcode & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH16) {
- ImmedIndex16 = VmReadIndex16 (VmPtr, Size);
- ImmedIndex64 = (INT64) ImmedIndex16;
- Size += 2;
- } else if ((Opcode & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH32) {
- ImmedIndex32 = VmReadIndex32 (VmPtr, Size);
- ImmedIndex64 = (INT64) ImmedIndex32;
- Size += 4;
- } else if ((Opcode & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH64) {
- ImmedIndex64 = VmReadIndex64 (VmPtr, Size);
- Size += 8;
- } else {
- //
- // Invalid encoding
- //
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
- //
- // Now write back the result
- //
- if (!OPERAND1_INDIRECT (Operands)) {
- //
- // Check for MOVIn R1 Index16, Immed (not indirect, with index), which
- // is illegal
- //
- if (Operands & MOVI_M_IMMDATA) {
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
-
- VmPtr->R[OPERAND1_REGNUM (Operands)] = ImmedIndex64;
- } else {
- //
- // Get the address
- //
- Op1 = (UINT64) VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16;
- VmWriteMemN (VmPtr, (UINTN) Op1, (INTN) ImmedIndex64);
- }
- //
- // Advance the instruction pointer
- //
- VmPtr->Ip += Size;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteMOVREL (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
-
- Execute the EBC MOVREL instruction.
- Dest <- Ip + ImmData
-
-Arguments:
-
- VmPtr - pointer to a VM context
-
-Returns:
-
- Standard EFI_STATUS
-
-Instruction syntax:
-
- MOVREL[w|d|q] {@}R1 {Index16}, ImmData16|32|64
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- UINT8 Size;
- INT16 Index16;
- INT64 ImmData64;
- UINT64 Op1;
- UINT64 Op2;
-
- //
- // Get the opcode and operands byte so we can get R1 and R2
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
-
- //
- // Get the Operand 1 index (16-bit) if present
- //
- if (Operands & MOVI_M_IMMDATA) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- Size = 4;
- } else {
- Index16 = 0;
- Size = 2;
- }
- //
- // Get the immediate data.
- //
- if ((Opcode & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH16) {
- ImmData64 = (INT64) VmReadImmed16 (VmPtr, Size);
- Size += 2;
- } else if ((Opcode & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH32) {
- ImmData64 = (INT64) VmReadImmed32 (VmPtr, Size);
- Size += 4;
- } else if ((Opcode & MOVI_M_DATAWIDTH) == MOVI_DATAWIDTH64) {
- ImmData64 = VmReadImmed64 (VmPtr, Size);
- Size += 8;
- } else {
- //
- // Invalid encoding
- //
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
- //
- // Compute the value and write back the result
- //
- Op2 = (UINT64) ((INT64) ((UINT64) (UINTN) VmPtr->Ip) + (INT64) ImmData64 + Size);
- if (!OPERAND1_INDIRECT (Operands)) {
- //
- // Check for illegal combination of operand1 direct with immediate data
- //
- if (Operands & MOVI_M_IMMDATA) {
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
-
- VmPtr->R[OPERAND1_REGNUM (Operands)] = (VM_REGISTER) Op2;
- } else {
- //
- // Get the address = [Rx] + Index16
- // Write back the result. Always a natural size write, since
- // we're talking addresses here.
- //
- Op1 = (UINT64) VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16;
- VmWriteMemN (VmPtr, (UINTN) Op1, (UINTN) Op2);
- }
- //
- // Advance the instruction pointer
- //
- VmPtr->Ip += Size;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteMOVsnw (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
-
- Execute the EBC MOVsnw instruction. This instruction loads a signed
- natural value from memory or register to another memory or register. On
- 32-bit machines, the value gets sign-extended to 64 bits if the destination
- is a register.
-
-Arguments:
-
- VmPtr - pointer to a VM context
-
-Returns:
-
- Standard EFI_STATUS
-
-Instruction syntax:
-
- MOVsnw {@}R1 {Index16}, {@}R2 {Index16|Immed16}
-
- 0:7 1=>operand1 index present
- 0:6 1=>operand2 index present
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- UINT8 Size;
- INT16 Op1Index;
- INT16 Op2Index;
- UINT64 Op2;
-
- //
- // Get the opcode and operand bytes
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
-
- Op1Index = Op2Index = 0;
-
- //
- // Get the indexes if present.
- //
- Size = 2;
- if (Opcode & OPCODE_M_IMMED_OP1) {
- if (OPERAND1_INDIRECT (Operands)) {
- Op1Index = VmReadIndex16 (VmPtr, 2);
- } else {
- //
- // Illegal form operand1 direct with index: MOVsnw R1 Index16, {@}R2
- //
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
-
- Size += sizeof (UINT16);
- }
-
- if (Opcode & OPCODE_M_IMMED_OP2) {
- if (OPERAND2_INDIRECT (Operands)) {
- Op2Index = VmReadIndex16 (VmPtr, Size);
- } else {
- Op2Index = VmReadImmed16 (VmPtr, Size);
- }
-
- Size += sizeof (UINT16);
- }
- //
- // Get the data from the source.
- //
- Op2 = (INT64) ((INTN) (VmPtr->R[OPERAND2_REGNUM (Operands)] + Op2Index));
- if (OPERAND2_INDIRECT (Operands)) {
- Op2 = (INT64) (INTN) VmReadMemN (VmPtr, (UINTN) Op2);
- }
- //
- // Now write back the result.
- //
- if (!OPERAND1_INDIRECT (Operands)) {
- VmPtr->R[OPERAND1_REGNUM (Operands)] = Op2;
- } else {
- VmWriteMemN (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Op1Index), (UINTN) Op2);
- }
- //
- // Advance the instruction pointer
- //
- VmPtr->Ip += Size;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteMOVsnd (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
-
- Execute the EBC MOVsnw instruction. This instruction loads a signed
- natural value from memory or register to another memory or register. On
- 32-bit machines, the value gets sign-extended to 64 bits if the destination
- is a register.
-
-Arguments:
-
- VmPtr - pointer to a VM context
-
-Returns:
-
- Standard EFI_STATUS
-
-Instruction syntax:
-
- MOVsnd {@}R1 {Indx32}, {@}R2 {Index32|Immed32}
-
- 0:7 1=>operand1 index present
- 0:6 1=>operand2 index present
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- UINT8 Size;
- INT32 Op1Index;
- INT32 Op2Index;
- UINT64 Op2;
-
- //
- // Get the opcode and operand bytes
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
-
- Op1Index = Op2Index = 0;
-
- //
- // Get the indexes if present.
- //
- Size = 2;
- if (Opcode & OPCODE_M_IMMED_OP1) {
- if (OPERAND1_INDIRECT (Operands)) {
- Op1Index = VmReadIndex32 (VmPtr, 2);
- } else {
- //
- // Illegal form operand1 direct with index: MOVsnd R1 Index16,..
- //
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return EFI_UNSUPPORTED;
- }
-
- Size += sizeof (UINT32);
- }
-
- if (Opcode & OPCODE_M_IMMED_OP2) {
- if (OPERAND2_INDIRECT (Operands)) {
- Op2Index = VmReadIndex32 (VmPtr, Size);
- } else {
- Op2Index = VmReadImmed32 (VmPtr, Size);
- }
-
- Size += sizeof (UINT32);
- }
- //
- // Get the data from the source.
- //
- Op2 = (INT64) ((INTN) (VmPtr->R[OPERAND2_REGNUM (Operands)] + Op2Index));
- if (OPERAND2_INDIRECT (Operands)) {
- Op2 = (INT64) (INTN) VmReadMemN (VmPtr, (UINTN) Op2);
- }
- //
- // Now write back the result.
- //
- if (!OPERAND1_INDIRECT (Operands)) {
- VmPtr->R[OPERAND1_REGNUM (Operands)] = Op2;
- } else {
- VmWriteMemN (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Op1Index), (UINTN) Op2);
- }
- //
- // Advance the instruction pointer
- //
- VmPtr->Ip += Size;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecutePUSHn (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the EBC PUSHn instruction
-
-Arguments:
- VmPtr - pointer to a VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- PUSHn {@}R1 {Index16|Immed16}
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- INT16 Index16;
- UINTN DataN;
-
- //
- // Get opcode and operands
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
-
- //
- // Get index if present
- //
- if (Opcode & PUSHPOP_M_IMMDATA) {
- if (OPERAND1_INDIRECT (Operands)) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- } else {
- Index16 = VmReadImmed16 (VmPtr, 2);
- }
-
- VmPtr->Ip += 4;
- } else {
- Index16 = 0;
- VmPtr->Ip += 2;
- }
- //
- // Get the data to push
- //
- if (OPERAND1_INDIRECT (Operands)) {
- DataN = VmReadMemN (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16));
- } else {
- DataN = (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16);
- }
- //
- // Adjust the stack down.
- //
- VmPtr->R[0] -= sizeof (UINTN);
- VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], DataN);
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecutePUSH (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the EBC PUSH instruction
-
-Arguments:
- VmPtr - pointer to a VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- PUSH[32|64] {@}R1 {Index16|Immed16}
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- UINT32 Data32;
- UINT64 Data64;
- INT16 Index16;
-
- //
- // Get opcode and operands
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
- //
- // Get immediate index if present, then advance the IP.
- //
- if (Opcode & PUSHPOP_M_IMMDATA) {
- if (OPERAND1_INDIRECT (Operands)) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- } else {
- Index16 = VmReadImmed16 (VmPtr, 2);
- }
-
- VmPtr->Ip += 4;
- } else {
- Index16 = 0;
- VmPtr->Ip += 2;
- }
- //
- // Get the data to push
- //
- if (Opcode & PUSHPOP_M_64) {
- if (OPERAND1_INDIRECT (Operands)) {
- Data64 = VmReadMem64 (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16));
- } else {
- Data64 = (UINT64) VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16;
- }
- //
- // Adjust the stack down, then write back the data
- //
- VmPtr->R[0] -= sizeof (UINT64);
- VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], Data64);
- } else {
- //
- // 32-bit data
- //
- if (OPERAND1_INDIRECT (Operands)) {
- Data32 = VmReadMem32 (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16));
- } else {
- Data32 = (UINT32) VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16;
- }
- //
- // Adjust the stack down and write the data
- //
- VmPtr->R[0] -= sizeof (UINT32);
- VmWriteMem32 (VmPtr, (UINTN) VmPtr->R[0], Data32);
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecutePOPn (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the EBC POPn instruction
-
-Arguments:
- VmPtr - pointer to a VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- POPn {@}R1 {Index16|Immed16}
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- INT16 Index16;
- UINTN DataN;
-
- //
- // Get opcode and operands
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
- //
- // Get immediate data if present, and advance the IP
- //
- if (Opcode & PUSHPOP_M_IMMDATA) {
- if (OPERAND1_INDIRECT (Operands)) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- } else {
- Index16 = VmReadImmed16 (VmPtr, 2);
- }
-
- VmPtr->Ip += 4;
- } else {
- Index16 = 0;
- VmPtr->Ip += 2;
- }
- //
- // Read the data off the stack, then adjust the stack pointer
- //
- DataN = VmReadMemN (VmPtr, (UINTN) VmPtr->R[0]);
- VmPtr->R[0] += sizeof (UINTN);
- //
- // Do the write-back
- //
- if (OPERAND1_INDIRECT (Operands)) {
- VmWriteMemN (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16), DataN);
- } else {
- VmPtr->R[OPERAND1_REGNUM (Operands)] = (INT64) (UINT64) ((UINTN) DataN + Index16);
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecutePOP (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the EBC POP instruction
-
-Arguments:
- VmPtr - pointer to a VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- POP {@}R1 {Index16|Immed16}
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- INT16 Index16;
- INT32 Data32;
- UINT64 Data64;
-
- //
- // Get opcode and operands
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
- //
- // Get immediate data if present, and advance the IP.
- //
- if (Opcode & PUSHPOP_M_IMMDATA) {
- if (OPERAND1_INDIRECT (Operands)) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- } else {
- Index16 = VmReadImmed16 (VmPtr, 2);
- }
-
- VmPtr->Ip += 4;
- } else {
- Index16 = 0;
- VmPtr->Ip += 2;
- }
- //
- // Get the data off the stack, then write it to the appropriate location
- //
- if (Opcode & PUSHPOP_M_64) {
- //
- // Read the data off the stack, then adjust the stack pointer
- //
- Data64 = VmReadMem64 (VmPtr, (UINTN) VmPtr->R[0]);
- VmPtr->R[0] += sizeof (UINT64);
- //
- // Do the write-back
- //
- if (OPERAND1_INDIRECT (Operands)) {
- VmWriteMem64 (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16), Data64);
- } else {
- VmPtr->R[OPERAND1_REGNUM (Operands)] = Data64 + Index16;
- }
- } else {
- //
- // 32-bit pop. Read it off the stack and adjust the stack pointer
- //
- Data32 = (INT32) VmReadMem32 (VmPtr, (UINTN) VmPtr->R[0]);
- VmPtr->R[0] += sizeof (UINT32);
- //
- // Do the write-back
- //
- if (OPERAND1_INDIRECT (Operands)) {
- VmWriteMem32 (VmPtr, (UINTN) (VmPtr->R[OPERAND1_REGNUM (Operands)] + Index16), Data32);
- } else {
- VmPtr->R[OPERAND1_REGNUM (Operands)] = (INT64) Data32 + Index16;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteCALL (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Implements the EBC CALL instruction.
-
- Instruction format:
-
- CALL64 Immed64
- CALL32 {@}R1 {Immed32|Index32}
- CALLEX64 Immed64
- CALLEX16 {@}R1 {Immed32}
-
- If Rx == R0, then it's a PC relative call to PC = PC + imm32.
-
-Arguments:
- VmPtr - pointer to a VM context.
-
-Returns:
- Standard EFI_STATUS
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- INT32 Immed32;
- UINT8 Size;
- INT64 Immed64;
- VOID *FramePtr;
-
- //
- // Get opcode and operands
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
- //
- // Assign these as well to avoid compiler warnings
- //
- Immed64 = 0;
- Immed32 = 0;
-
- FramePtr = VmPtr->FramePtr;
- //
- // Determine the instruction size, and get immediate data if present
- //
- if (Opcode & OPCODE_M_IMMDATA) {
- if (Opcode & OPCODE_M_IMMDATA64) {
- Immed64 = VmReadImmed64 (VmPtr, 2);
- Size = 10;
- } else {
- //
- // If register operand is indirect, then the immediate data is an index
- //
- if (OPERAND1_INDIRECT (Operands)) {
- Immed32 = VmReadIndex32 (VmPtr, 2);
- } else {
- Immed32 = VmReadImmed32 (VmPtr, 2);
- }
-
- Size = 6;
- }
- } else {
- Size = 2;
- }
- //
- // If it's a call to EBC, adjust the stack pointer down 16 bytes and
- // put our return address and frame pointer on the VM stack.
- //
- if ((Operands & OPERAND_M_NATIVE_CALL) == 0) {
- VmPtr->R[0] -= 8;
- VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], (UINTN) FramePtr);
- VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->R[0];
- VmPtr->R[0] -= 8;
- VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], (UINT64) (UINTN) (VmPtr->Ip + Size));
- }
- //
- // If 64-bit data, then absolute jump only
- //
- if (Opcode & OPCODE_M_IMMDATA64) {
- //
- // Native or EBC call?
- //
- if ((Operands & OPERAND_M_NATIVE_CALL) == 0) {
- VmPtr->Ip = (VMIP) (UINTN) Immed64;
- } else {
- //
- // Call external function, get the return value, and advance the IP
- //
- EbcLLCALLEX (VmPtr, (UINTN) Immed64, (UINTN) VmPtr->R[0], FramePtr, Size);
- }
- } else {
- //
- // Get the register data. If operand1 == 0, then ignore register and
- // take immediate data as relative or absolute address.
- // Compiler should take care of upper bits if 32-bit machine.
- //
- if (OPERAND1_REGNUM (Operands) != 0) {
- Immed64 = (UINT64) (UINTN) VmPtr->R[OPERAND1_REGNUM (Operands)];
- }
- //
- // Get final address
- //
- if (OPERAND1_INDIRECT (Operands)) {
- Immed64 = (INT64) (UINT64) (UINTN) VmReadMemN (VmPtr, (UINTN) (Immed64 + Immed32));
- } else {
- Immed64 += Immed32;
- }
- //
- // Now determine if external call, and then if relative or absolute
- //
- if ((Operands & OPERAND_M_NATIVE_CALL) == 0) {
- //
- // EBC call. Relative or absolute? If relative, then it's relative to the
- // start of the next instruction.
- //
- if (Operands & OPERAND_M_RELATIVE_ADDR) {
- VmPtr->Ip += Immed64 + Size;
- } else {
- VmPtr->Ip = (VMIP) (UINTN) Immed64;
- }
- } else {
- //
- // Native call. Relative or absolute?
- //
- if (Operands & OPERAND_M_RELATIVE_ADDR) {
- EbcLLCALLEX (VmPtr, (UINTN) (Immed64 + VmPtr->Ip + Size), (UINTN) VmPtr->R[0], FramePtr, Size);
- } else {
- if (VmPtr->StopFlags & STOPFLAG_BREAK_ON_CALLEX) {
- CpuBreakpoint ();
- }
-
- EbcLLCALLEX (VmPtr, (UINTN) Immed64, (UINTN) VmPtr->R[0], FramePtr, Size);
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteRET (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the EBC RET instruction
-
-Arguments:
- VmPtr - pointer to a VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- RET
-
---*/
-{
- //
- // If we're at the top of the stack, then simply set the done
- // flag and return
- //
- if (VmPtr->StackRetAddr == (UINT64) VmPtr->R[0]) {
- VmPtr->StopFlags |= STOPFLAG_APP_DONE;
- } else {
- //
- // Pull the return address off the VM app's stack and set the IP
- // to it
- //
- if (!IS_ALIGNED ((UINTN) VmPtr->R[0], sizeof (UINT16))) {
- EbcDebugSignalException (
- EXCEPT_EBC_ALIGNMENT_CHECK,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- }
- //
- // Restore the IP and frame pointer from the stack
- //
- VmPtr->Ip = (VMIP) (UINTN) VmReadMem64 (VmPtr, (UINTN) VmPtr->R[0]);
- VmPtr->R[0] += 8;
- VmPtr->FramePtr = (VOID *) VmReadMemN (VmPtr, (UINTN) VmPtr->R[0]);
- VmPtr->R[0] += 8;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteCMP (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the EBC CMP instruction
-
-Arguments:
- VmPtr - pointer to a VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- CMP[32|64][eq|lte|gte|ulte|ugte] R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- UINT8 Size;
- INT16 Index16;
- UINT32 Flag;
- INT64 Op2;
- INT64 Op1;
-
- //
- // Get opcode and operands
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
- //
- // Get the register data we're going to compare to
- //
- Op1 = VmPtr->R[OPERAND1_REGNUM (Operands)];
- //
- // Get immediate data
- //
- if (Opcode & OPCODE_M_IMMDATA) {
- if (OPERAND2_INDIRECT (Operands)) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- } else {
- Index16 = VmReadImmed16 (VmPtr, 2);
- }
-
- Size = 4;
- } else {
- Index16 = 0;
- Size = 2;
- }
- //
- // Now get Op2
- //
- if (OPERAND2_INDIRECT (Operands)) {
- if (Opcode & OPCODE_M_64BIT) {
- Op2 = (INT64) VmReadMem64 (VmPtr, (UINTN) (VmPtr->R[OPERAND2_REGNUM (Operands)] + Index16));
- } else {
- //
- // 32-bit operations. 0-extend the values for all cases.
- //
- Op2 = (INT64) (UINT64) ((UINT32) VmReadMem32 (VmPtr, (UINTN) (VmPtr->R[OPERAND2_REGNUM (Operands)] + Index16)));
- }
- } else {
- Op2 = VmPtr->R[OPERAND2_REGNUM (Operands)] + Index16;
- }
- //
- // Now do the compare
- //
- Flag = 0;
- if (Opcode & OPCODE_M_64BIT) {
- //
- // 64-bit compares
- //
- switch (Opcode & OPCODE_M_OPCODE) {
- case OPCODE_CMPEQ:
- if (Op1 == Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPLTE:
- if (Op1 <= Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPGTE:
- if (Op1 >= Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPULTE:
- if ((UINT64) Op1 <= (UINT64) Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPUGTE:
- if ((UINT64) Op1 >= (UINT64) Op2) {
- Flag = 1;
- }
- break;
-
- default:
- ASSERT (0);
- }
- } else {
- //
- // 32-bit compares
- //
- switch (Opcode & OPCODE_M_OPCODE) {
- case OPCODE_CMPEQ:
- if ((INT32) Op1 == (INT32) Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPLTE:
- if ((INT32) Op1 <= (INT32) Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPGTE:
- if ((INT32) Op1 >= (INT32) Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPULTE:
- if ((UINT32) Op1 <= (UINT32) Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPUGTE:
- if ((UINT32) Op1 >= (UINT32) Op2) {
- Flag = 1;
- }
- break;
-
- default:
- ASSERT (0);
- }
- }
- //
- // Now set the flag accordingly for the comparison
- //
- if (Flag) {
- VMFLAG_SET (VmPtr, VMFLAGS_CC);
- } else {
- VMFLAG_CLEAR (VmPtr, VMFLAGS_CC);
- }
- //
- // Advance the IP
- //
- VmPtr->Ip += Size;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteCMPI (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the EBC CMPI instruction
-
-Arguments:
- VmPtr - pointer to a VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- CMPI[32|64]{w|d}[eq|lte|gte|ulte|ugte] {@}Rx {Index16}, Immed16|Immed32
-
---*/
-{
- UINT8 Opcode;
- UINT8 Operands;
- UINT8 Size;
- INT64 Op1;
- INT64 Op2;
- INT16 Index16;
- UINT32 Flag;
-
- //
- // Get opcode and operands
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
-
- //
- // Get operand1 index if present
- //
- Size = 2;
- if (Operands & OPERAND_M_CMPI_INDEX) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- Size += 2;
- } else {
- Index16 = 0;
- }
- //
- // Get operand1 data we're going to compare to
- //
- Op1 = (INT64) VmPtr->R[OPERAND1_REGNUM (Operands)];
- if (OPERAND1_INDIRECT (Operands)) {
- //
- // Indirect operand1. Fetch 32 or 64-bit value based on compare size.
- //
- if (Opcode & OPCODE_M_CMPI64) {
- Op1 = (INT64) VmReadMem64 (VmPtr, (UINTN) Op1 + Index16);
- } else {
- Op1 = (INT64) VmReadMem32 (VmPtr, (UINTN) Op1 + Index16);
- }
- } else {
- //
- // Better not have been an index with direct. That is, CMPI R1 Index,...
- // is illegal.
- //
- if (Operands & OPERAND_M_CMPI_INDEX) {
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_ERROR,
- VmPtr
- );
- VmPtr->Ip += Size;
- return EFI_UNSUPPORTED;
- }
- }
- //
- // Get immediate data -- 16- or 32-bit sign extended
- //
- if (Opcode & OPCODE_M_CMPI32_DATA) {
- Op2 = (INT64) VmReadImmed32 (VmPtr, Size);
- Size += 4;
- } else {
- //
- // 16-bit immediate data. Sign extend always.
- //
- Op2 = (INT64) ((INT16) VmReadImmed16 (VmPtr, Size));
- Size += 2;
- }
- //
- // Now do the compare
- //
- Flag = 0;
- if (Opcode & OPCODE_M_CMPI64) {
- //
- // 64 bit comparison
- //
- switch (Opcode & OPCODE_M_OPCODE) {
- case OPCODE_CMPIEQ:
- if (Op1 == (INT64) Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPILTE:
- if (Op1 <= (INT64) Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPIGTE:
- if (Op1 >= (INT64) Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPIULTE:
- if ((UINT64) Op1 <= (UINT64) ((UINT32) Op2)) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPIUGTE:
- if ((UINT64) Op1 >= (UINT64) ((UINT32) Op2)) {
- Flag = 1;
- }
- break;
-
- default:
- ASSERT (0);
- }
- } else {
- //
- // 32-bit comparisons
- //
- switch (Opcode & OPCODE_M_OPCODE) {
- case OPCODE_CMPIEQ:
- if ((INT32) Op1 == Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPILTE:
- if ((INT32) Op1 <= Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPIGTE:
- if ((INT32) Op1 >= Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPIULTE:
- if ((UINT32) Op1 <= (UINT32) Op2) {
- Flag = 1;
- }
- break;
-
- case OPCODE_CMPIUGTE:
- if ((UINT32) Op1 >= (UINT32) Op2) {
- Flag = 1;
- }
- break;
-
- default:
- ASSERT (0);
- }
- }
- //
- // Now set the flag accordingly for the comparison
- //
- if (Flag) {
- VMFLAG_SET (VmPtr, VMFLAGS_CC);
- } else {
- VMFLAG_CLEAR (VmPtr, VMFLAGS_CC);
- }
- //
- // Advance the IP
- //
- VmPtr->Ip += Size;
- return EFI_SUCCESS;
-}
-
-STATIC
-UINT64
-ExecuteNOT (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC NOT instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- ~Op2
-
-Instruction syntax:
- NOT[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- return ~Op2;
-}
-
-STATIC
-UINT64
-ExecuteNEG (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC NEG instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op2 * -1
-
-Instruction syntax:
- NEG[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- return ~Op2 + 1;
-}
-
-STATIC
-UINT64
-ExecuteADD (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
-
- Execute the EBC ADD instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 + Op2
-
-Instruction syntax:
- ADD[32|64] {@}R1, {@}R2 {Index16}
-
---*/
-{
- return Op1 + Op2;
-}
-
-STATIC
-UINT64
-ExecuteSUB (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC SUB instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 - Op2
- Standard EFI_STATUS
-
-Instruction syntax:
- SUB[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- if (*VmPtr->Ip & DATAMANIP_M_64) {
- return (UINT64) ((INT64) ((INT64) Op1 - (INT64) Op2));
- } else {
- return (UINT64) ((INT64) ((INT32) Op1 - (INT32) Op2));
- }
-}
-
-STATIC
-UINT64
-ExecuteMUL (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
-
- Execute the EBC MUL instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 * Op2
-
-Instruction syntax:
- MUL[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- if (*VmPtr->Ip & DATAMANIP_M_64) {
- return MultS64x64 ((INT64)Op1, (INT64)Op2);
- } else {
- return (UINT64) ((INT64) ((INT32) Op1 * (INT32) Op2));
- }
-}
-
-STATIC
-UINT64
-ExecuteMULU (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC MULU instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- (unsigned)Op1 * (unsigned)Op2
-
-Instruction syntax:
- MULU[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- if (*VmPtr->Ip & DATAMANIP_M_64) {
- return MultU64x64 (Op1, Op2);
- } else {
- return (UINT64) ((UINT32) Op1 * (UINT32) Op2);
- }
-}
-
-STATIC
-UINT64
-ExecuteDIV (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
-
- Execute the EBC DIV instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1/Op2
-
-Instruction syntax:
- DIV[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- INT64 Remainder;
-
- //
- // Check for divide-by-0
- //
- if (Op2 == 0) {
- EbcDebugSignalException (
- EXCEPT_EBC_DIVIDE_ERROR,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
-
- return 0;
- } else {
- if (*VmPtr->Ip & DATAMANIP_M_64) {
- return (UINT64) (DivS64x64Remainder (Op1, Op2, &Remainder));
- } else {
- return (UINT64) ((INT64) ((INT32) Op1 / (INT32) Op2));
- }
- }
-}
-
-STATIC
-UINT64
-ExecuteDIVU (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC DIVU instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- (unsigned)Op1 / (unsigned)Op2
-
-Instruction syntax:
- DIVU[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- UINT64 Remainder;
-
- //
- // Check for divide-by-0
- //
- if (Op2 == 0) {
- EbcDebugSignalException (
- EXCEPT_EBC_DIVIDE_ERROR,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return 0;
- } else {
- //
- // Get the destination register
- //
- if (*VmPtr->Ip & DATAMANIP_M_64) {
- return (UINT64) (DivU64x64Remainder ((INT64)Op1, (INT64)Op2, &Remainder));
- } else {
- return (UINT64) ((UINT32) Op1 / (UINT32) Op2);
- }
- }
-}
-
-STATIC
-UINT64
-ExecuteMOD (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC MOD instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 MODULUS Op2
-
-Instruction syntax:
- MOD[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- INT64 Remainder;
-
- //
- // Check for divide-by-0
- //
- if (Op2 == 0) {
- EbcDebugSignalException (
- EXCEPT_EBC_DIVIDE_ERROR,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return 0;
- } else {
- DivS64x64Remainder ((INT64)Op1, (INT64)Op2, &Remainder);
- return Remainder;
- }
-}
-
-STATIC
-UINT64
-ExecuteMODU (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC MODU instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 UNSIGNED_MODULUS Op2
-
-Instruction syntax:
- MODU[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- UINT64 Remainder;
-
- //
- // Check for divide-by-0
- //
- if (Op2 == 0) {
- EbcDebugSignalException (
- EXCEPT_EBC_DIVIDE_ERROR,
- EXCEPTION_FLAG_FATAL,
- VmPtr
- );
- return 0;
- } else {
- DivU64x64Remainder (Op1, Op2, &Remainder);
- return Remainder;
- }
-}
-
-STATIC
-UINT64
-ExecuteAND (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC AND instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 AND Op2
-
-Instruction syntax:
- AND[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- return Op1 & Op2;
-}
-
-STATIC
-UINT64
-ExecuteOR (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC OR instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 OR Op2
-
-Instruction syntax:
- OR[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- return Op1 | Op2;
-}
-
-STATIC
-UINT64
-ExecuteXOR (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC XOR instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 XOR Op2
-
-Instruction syntax:
- XOR[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- return Op1 ^ Op2;
-}
-
-STATIC
-UINT64
-ExecuteSHL (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
-
- Execute the EBC SHL shift left instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 << Op2
-
-Instruction syntax:
- SHL[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- if (*VmPtr->Ip & DATAMANIP_M_64) {
- return LShiftU64 (Op1, (UINTN)Op2);
- } else {
- return (UINT64) ((UINT32) ((UINT32) Op1 << (UINT32) Op2));
- }
-}
-
-STATIC
-UINT64
-ExecuteSHR (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC SHR instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 >> Op2 (unsigned operands)
-
-Instruction syntax:
- SHR[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- if (*VmPtr->Ip & DATAMANIP_M_64) {
- return RShiftU64 (Op1, (UINTN)Op2);
- } else {
- return (UINT64) ((UINT32) Op1 >> (UINT32) Op2);
- }
-}
-
-STATIC
-UINT64
-ExecuteASHR (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC ASHR instruction
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- Op1 >> Op2 (signed)
-
-Instruction syntax:
- ASHR[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
---*/
-{
- if (*VmPtr->Ip & DATAMANIP_M_64) {
- return ARShiftU64 (Op1, (UINTN)Op2);
- } else {
- return (UINT64) ((INT64) ((INT32) Op1 >> (UINT32) Op2));
- }
-}
-
-STATIC
-UINT64
-ExecuteEXTNDB (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC EXTNDB instruction to sign-extend a byte value.
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- (INT64)(INT8)Op2
-
-Instruction syntax:
- EXTNDB[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
-
---*/
-{
- INT8 Data8;
- INT64 Data64;
- //
- // Convert to byte, then return as 64-bit signed value to let compiler
- // sign-extend the value
- //
- Data8 = (INT8) Op2;
- Data64 = (INT64) Data8;
-
- return (UINT64) Data64;
-}
-
-STATIC
-UINT64
-ExecuteEXTNDW (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC EXTNDW instruction to sign-extend a 16-bit value.
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- (INT64)(INT16)Op2
-
-Instruction syntax:
- EXTNDW[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
-
---*/
-{
- INT16 Data16;
- INT64 Data64;
- //
- // Convert to word, then return as 64-bit signed value to let compiler
- // sign-extend the value
- //
- Data16 = (INT16) Op2;
- Data64 = (INT64) Data16;
-
- return (UINT64) Data64;
-}
-//
-// Execute the EBC EXTNDD instruction.
-//
-// Format: EXTNDD {@}Rx, {@}Ry [Index16|Immed16]
-// EXTNDD Dest, Source
-//
-// Operation: Dest <- SignExtended((DWORD)Source))
-//
-STATIC
-UINT64
-ExecuteEXTNDD (
- IN VM_CONTEXT *VmPtr,
- IN UINT64 Op1,
- IN UINT64 Op2
- )
-/*++
-
-Routine Description:
- Execute the EBC EXTNDD instruction to sign-extend a 32-bit value.
-
-Arguments:
- VmPtr - pointer to a VM context
- Op1 - Operand 1 from the instruction
- Op2 - Operand 2 from the instruction
-
-Returns:
- (INT64)(INT32)Op2
-
-Instruction syntax:
- EXTNDD[32|64] {@}R1, {@}R2 {Index16|Immed16}
-
-
---*/
-{
- INT32 Data32;
- INT64 Data64;
- //
- // Convert to 32-bit value, then return as 64-bit signed value to let compiler
- // sign-extend the value
- //
- Data32 = (INT32) Op2;
- Data64 = (INT64) Data32;
-
- return (UINT64) Data64;
-}
-
-STATIC
-EFI_STATUS
-ExecuteSignedDataManip (
- IN VM_CONTEXT *VmPtr
- )
-{
- //
- // Just call the data manipulation function with a flag indicating this
- // is a signed operation.
- //
- return ExecuteDataManip (VmPtr, TRUE);
-}
-
-STATIC
-EFI_STATUS
-ExecuteUnsignedDataManip (
- IN VM_CONTEXT *VmPtr
- )
-{
- //
- // Just call the data manipulation function with a flag indicating this
- // is not a signed operation.
- //
- return ExecuteDataManip (VmPtr, FALSE);
-}
-
-STATIC
-EFI_STATUS
-ExecuteDataManip (
- IN VM_CONTEXT *VmPtr,
- IN BOOLEAN IsSignedOp
- )
-/*++
-
-Routine Description:
- Execute all the EBC data manipulation instructions.
- Since the EBC data manipulation instructions all have the same basic form,
- they can share the code that does the fetch of operands and the write-back
- of the result. This function performs the fetch of the operands (even if
- both are not needed to be fetched, like NOT instruction), dispatches to the
- appropriate subfunction, then writes back the returned result.
-
-Arguments:
- VmPtr - pointer to VM context
-
-Returns:
- Standard EBC status
-
-Format:
- INSTRUCITON[32|64] {@}R1, {@}R2 {Immed16|Index16}
-
---*/
-{
- UINT8 Opcode;
- INT16 Index16;
- UINT8 Operands;
- UINT8 Size;
- UINT64 Op1;
- UINT64 Op2;
-
- //
- // Get opcode and operands
- //
- Opcode = GETOPCODE (VmPtr);
- Operands = GETOPERANDS (VmPtr);
-
- //
- // Determine if we have immediate data by the opcode
- //
- if (Opcode & DATAMANIP_M_IMMDATA) {
- //
- // Index16 if Ry is indirect, or Immed16 if Ry direct.
- //
- if (OPERAND2_INDIRECT (Operands)) {
- Index16 = VmReadIndex16 (VmPtr, 2);
- } else {
- Index16 = VmReadImmed16 (VmPtr, 2);
- }
-
- Size = 4;
- } else {
- Index16 = 0;
- Size = 2;
- }
- //
- // Now get operand2 (source). It's of format {@}R2 {Index16|Immed16}
- //
- Op2 = (UINT64) VmPtr->R[OPERAND2_REGNUM (Operands)] + Index16;
- if (OPERAND2_INDIRECT (Operands)) {
- //
- // Indirect form: @R2 Index16. Fetch as 32- or 64-bit data
- //
- if (Opcode & DATAMANIP_M_64) {
- Op2 = VmReadMem64 (VmPtr, (UINTN) Op2);
- } else {
- //
- // Read as signed value where appropriate.
- //
- if (IsSignedOp) {
- Op2 = (UINT64) (INT64) ((INT32) VmReadMem32 (VmPtr, (UINTN) Op2));
- } else {
- Op2 = (UINT64) VmReadMem32 (VmPtr, (UINTN) Op2);
- }
- }
- } else {
- if ((Opcode & DATAMANIP_M_64) == 0) {
- if (IsSignedOp) {
- Op2 = (UINT64) (INT64) ((INT32) Op2);
- } else {
- Op2 = (UINT64) ((UINT32) Op2);
- }
- }
- }
- //
- // Get operand1 (destination and sometimes also an actual operand)
- // of form {@}R1
- //
- Op1 = VmPtr->R[OPERAND1_REGNUM (Operands)];
- if (OPERAND1_INDIRECT (Operands)) {
- if (Opcode & DATAMANIP_M_64) {
- Op1 = VmReadMem64 (VmPtr, (UINTN) Op1);
- } else {
- if (IsSignedOp) {
- Op1 = (UINT64) (INT64) ((INT32) VmReadMem32 (VmPtr, (UINTN) Op1));
- } else {
- Op1 = (UINT64) VmReadMem32 (VmPtr, (UINTN) Op1);
- }
- }
- } else {
- if ((Opcode & DATAMANIP_M_64) == 0) {
- if (IsSignedOp) {
- Op1 = (UINT64) (INT64) ((INT32) Op1);
- } else {
- Op1 = (UINT64) ((UINT32) Op1);
- }
- }
- }
- //
- // Dispatch to the computation function
- //
- if (((Opcode & OPCODE_M_OPCODE) - OPCODE_NOT) >=
- (sizeof (mDataManipDispatchTable) / sizeof (mDataManipDispatchTable[0]))
- ) {
- EbcDebugSignalException (
- EXCEPT_EBC_INVALID_OPCODE,
- EXCEPTION_FLAG_ERROR,
- VmPtr
- );
- //
- // Advance and return
- //
- VmPtr->Ip += Size;
- return EFI_UNSUPPORTED;
- } else {
- Op2 = mDataManipDispatchTable[(Opcode & OPCODE_M_OPCODE) - OPCODE_NOT](VmPtr, Op1, Op2);
- }
- //
- // Write back the result.
- //
- if (OPERAND1_INDIRECT (Operands)) {
- Op1 = VmPtr->R[OPERAND1_REGNUM (Operands)];
- if (Opcode & DATAMANIP_M_64) {
- VmWriteMem64 (VmPtr, (UINTN) Op1, Op2);
- } else {
- VmWriteMem32 (VmPtr, (UINTN) Op1, (UINT32) Op2);
- }
- } else {
- //
- // Storage back to a register. Write back, clearing upper bits (as per
- // the specification) if 32-bit operation.
- //
- VmPtr->R[OPERAND1_REGNUM (Operands)] = Op2;
- if ((Opcode & DATAMANIP_M_64) == 0) {
- VmPtr->R[OPERAND1_REGNUM (Operands)] &= 0xFFFFFFFF;
- }
- }
- //
- // Advance the instruction pointer
- //
- VmPtr->Ip += Size;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteLOADSP (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the EBC LOADSP instruction
-
-Arguments:
- VmPtr - pointer to a VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- LOADSP SP1, R2
-
---*/
-{
- UINT8 Operands;
-
- //
- // Get the operands
- //
- Operands = GETOPERANDS (VmPtr);
-
- //
- // Do the operation
- //
- switch (OPERAND1_REGNUM (Operands)) {
- //
- // Set flags
- //
- case 0:
- //
- // Spec states that this instruction will not modify reserved bits in
- // the flags register.
- //
- VmPtr->Flags = (VmPtr->Flags &~VMFLAGS_ALL_VALID) | (VmPtr->R[OPERAND2_REGNUM (Operands)] & VMFLAGS_ALL_VALID);
- break;
-
- default:
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_WARNING,
- VmPtr
- );
- VmPtr->Ip += 2;
- return EFI_UNSUPPORTED;
- }
-
- VmPtr->Ip += 2;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-ExecuteSTORESP (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
- Execute the EBC STORESP instruction
-
-Arguments:
- VmPtr - pointer to a VM context
-
-Returns:
- Standard EFI_STATUS
-
-Instruction syntax:
- STORESP Rx, FLAGS|IP
-
---*/
-{
- UINT8 Operands;
-
- //
- // Get the operands
- //
- Operands = GETOPERANDS (VmPtr);
-
- //
- // Do the operation
- //
- switch (OPERAND2_REGNUM (Operands)) {
- //
- // Get flags
- //
- case 0:
- //
- // Retrieve the value in the flags register, then clear reserved bits
- //
- VmPtr->R[OPERAND1_REGNUM (Operands)] = (UINT64) (VmPtr->Flags & VMFLAGS_ALL_VALID);
- break;
-
- //
- // Get IP -- address of following instruction
- //
- case 1:
- VmPtr->R[OPERAND1_REGNUM (Operands)] = (UINT64) (UINTN) VmPtr->Ip + 2;
- break;
-
- default:
- EbcDebugSignalException (
- EXCEPT_EBC_INSTRUCTION_ENCODING,
- EXCEPTION_FLAG_WARNING,
- VmPtr
- );
- VmPtr->Ip += 2;
- return EFI_UNSUPPORTED;
- break;
- }
-
- VmPtr->Ip += 2;
- return EFI_SUCCESS;
-}
-
-STATIC
-INT16
-VmReadIndex16 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 CodeOffset
- )
-/*++
-
-Routine Description:
- Decode a 16-bit index to determine the offset. Given an index value:
-
- b15 - sign bit
- b14:12 - number of bits in this index assigned to natural units (=a)
- ba:11 - constant units = C
- b0:a - natural units = N
-
- Given this info, the offset can be computed by:
- offset = sign_bit * (C + N * sizeof(UINTN))
-
- Max offset is achieved with index = 0x7FFF giving an offset of
- 0x27B (32-bit machine) or 0x477 (64-bit machine).
- Min offset is achieved with index =
-
-Arguments:
- VmPtr - pointer to VM context
- CodeOffset - offset from IP of the location of the 16-bit index to decode
-
-Returns:
- The decoded offset.
-
---*/
-{
- UINT16 Index;
- INT16 Offset;
- INT16 C;
- INT16 N;
- INT16 NBits;
- INT16 Mask;
-
- //
- // First read the index from the code stream
- //
- Index = VmReadCode16 (VmPtr, CodeOffset);
-
- //
- // Get the mask for N. First get the number of bits from the index.
- //
- NBits = (INT16) ((Index & 0x7000) >> 12);
-
- //
- // Scale it for 16-bit indexes
- //
- NBits *= 2;
-
- //
- // Now using the number of bits, create a mask.
- //
- Mask = (INT16) ((INT16)~0 << NBits);
-
- //
- // Now using the mask, extract N from the lower bits of the index.
- //
- N = (INT16) (Index &~Mask);
-
- //
- // Now compute C
- //
- C = (INT16) (((Index &~0xF000) & Mask) >> NBits);
-
- Offset = (INT16) (N * sizeof (UINTN) + C);
-
- //
- // Now set the sign
- //
- if (Index & 0x8000) {
- //
- // Do it the hard way to work around a bogus compiler warning
- //
- // Offset = -1 * Offset;
- //
- Offset = (INT16) ((INT32) Offset * -1);
- }
-
- return Offset;
-}
-
-STATIC
-INT32
-VmReadIndex32 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 CodeOffset
- )
-/*++
-
-Routine Description:
- Decode a 32-bit index to determine the offset.
-
-Arguments:
- VmPtr - pointer to VM context
- CodeOffset - offset from IP of the location of the 32-bit index to decode
-
-Returns:
- Converted index per EBC VM specification
-
---*/
-{
- UINT32 Index;
- INT32 Offset;
- INT32 C;
- INT32 N;
- INT32 NBits;
- INT32 Mask;
-
- Index = VmReadImmed32 (VmPtr, CodeOffset);
-
- //
- // Get the mask for N. First get the number of bits from the index.
- //
- NBits = (Index & 0x70000000) >> 28;
-
- //
- // Scale it for 32-bit indexes
- //
- NBits *= 4;
-
- //
- // Now using the number of bits, create a mask.
- //
- Mask = (INT32)~0 << NBits;
-
- //
- // Now using the mask, extract N from the lower bits of the index.
- //
- N = Index &~Mask;
-
- //
- // Now compute C
- //
- C = ((Index &~0xF0000000) & Mask) >> NBits;
-
- Offset = N * sizeof (UINTN) + C;
-
- //
- // Now set the sign
- //
- if (Index & 0x80000000) {
- Offset = Offset * -1;
- }
-
- return Offset;
-}
-
-STATIC
-INT64
-VmReadIndex64 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 CodeOffset
- )
-/*++
-
-Routine Description:
- Decode a 64-bit index to determine the offset.
-
-Arguments:
- VmPtr - pointer to VM context
- CodeOffset - offset from IP of the location of the 64-bit index to decode
-
-Returns:
- Converted index per EBC VM specification
-
---*/
-{
- UINT64 Index;
- INT64 Offset;
- INT64 C;
- INT64 N;
- INT64 NBits;
- INT64 Mask;
-
- Index = VmReadCode64 (VmPtr, CodeOffset);
-
- //
- // Get the mask for N. First get the number of bits from the index.
- //
- NBits = RShiftU64 ((Index & 0x7000000000000000ULL), 60);
-
- //
- // Scale it for 64-bit indexes (multiply by 8 by shifting left 3)
- //
- NBits = LShiftU64 ((UINT64)NBits, 3);
-
- //
- // Now using the number of bits, create a mask.
- //
- Mask = (LShiftU64 ((UINT64)~0, (UINTN)NBits));
-
- //
- // Now using the mask, extract N from the lower bits of the index.
- //
- N = Index &~Mask;
-
- //
- // Now compute C
- //
- C = ARShiftU64 (((Index &~0xF000000000000000ULL) & Mask), (UINTN)NBits);
-
- Offset = MultU64x64 (N, sizeof (UINTN)) + C;
-
- //
- // Now set the sign
- //
- if (Index & 0x8000000000000000ULL) {
- Offset = MultS64x64 (Offset, -1);
- }
-
- return Offset;
-}
-
-STATIC
-EFI_STATUS
-VmWriteMem8 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr,
- IN UINT8 Data
- )
-/*++
-
-Routine Description:
- The following VmWriteMem? routines are called by the EBC data
- movement instructions that write to memory. Since these writes
- may be to the stack, which looks like (high address on top) this,
-
- [EBC entry point arguments]
- [VM stack]
- [EBC stack]
-
- we need to detect all attempts to write to the EBC entry point argument
- stack area and adjust the address (which will initially point into the
- VM stack) to point into the EBC entry point arguments.
-
-Arguments:
- VmPtr - pointer to a VM context
- Addr - adddress to write to
- Data - value to write to Addr
-
-Returns:
- Standard EFI_STATUS
-
---*/
-{
- //
- // Convert the address if it's in the stack gap
- //
- Addr = ConvertStackAddr (VmPtr, Addr);
- *(UINT8 *) Addr = Data;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-VmWriteMem16 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr,
- IN UINT16 Data
- )
-{
- EFI_STATUS Status;
-
- //
- // Convert the address if it's in the stack gap
- //
- Addr = ConvertStackAddr (VmPtr, Addr);
-
- //
- // Do a simple write if aligned
- //
- if (IS_ALIGNED (Addr, sizeof (UINT16))) {
- *(UINT16 *) Addr = Data;
- } else {
- //
- // Write as two bytes
- //
- MemoryFence ();
- if ((Status = VmWriteMem8 (VmPtr, Addr, (UINT8) Data)) != EFI_SUCCESS) {
- return Status;
- }
-
- MemoryFence ();
- if ((Status = VmWriteMem8 (VmPtr, Addr + 1, (UINT8) (Data >> 8))) != EFI_SUCCESS) {
- return Status;
- }
-
- MemoryFence ();
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-VmWriteMem32 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr,
- IN UINT32 Data
- )
-{
- EFI_STATUS Status;
-
- //
- // Convert the address if it's in the stack gap
- //
- Addr = ConvertStackAddr (VmPtr, Addr);
-
- //
- // Do a simple write if aligned
- //
- if (IS_ALIGNED (Addr, sizeof (UINT32))) {
- *(UINT32 *) Addr = Data;
- } else {
- //
- // Write as two words
- //
- MemoryFence ();
- if ((Status = VmWriteMem16 (VmPtr, Addr, (UINT16) Data)) != EFI_SUCCESS) {
- return Status;
- }
-
- MemoryFence ();
- if ((Status = VmWriteMem16 (VmPtr, Addr + sizeof (UINT16), (UINT16) (Data >> 16))) != EFI_SUCCESS) {
- return Status;
- }
-
- MemoryFence ();
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-VmWriteMem64 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr,
- IN UINT64 Data
- )
-{
- EFI_STATUS Status;
- UINT32 Data32;
-
- //
- // Convert the address if it's in the stack gap
- //
- Addr = ConvertStackAddr (VmPtr, Addr);
-
- //
- // Do a simple write if aligned
- //
- if (IS_ALIGNED (Addr, sizeof (UINT64))) {
- *(UINT64 *) Addr = Data;
- } else {
- //
- // Write as two 32-bit words
- //
- MemoryFence ();
- if ((Status = VmWriteMem32 (VmPtr, Addr, (UINT32) Data)) != EFI_SUCCESS) {
- return Status;
- }
-
- MemoryFence ();
- Data32 = (UINT32) (((UINT32 *) &Data)[1]);
- if ((Status = VmWriteMem32 (VmPtr, Addr + sizeof (UINT32), Data32)) != EFI_SUCCESS) {
- return Status;
- }
-
- MemoryFence ();
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-VmWriteMemN (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr,
- IN UINTN Data
- )
-{
- EFI_STATUS Status;
- UINTN Index;
-
- Status = EFI_SUCCESS;
-
- //
- // Convert the address if it's in the stack gap
- //
- Addr = ConvertStackAddr (VmPtr, Addr);
-
- //
- // Do a simple write if aligned
- //
- if (IS_ALIGNED (Addr, sizeof (UINTN))) {
- *(UINTN *) Addr = Data;
- } else {
- for (Index = 0; Index < sizeof (UINTN) / sizeof (UINT32); Index++) {
- MemoryFence ();
- Status = VmWriteMem32 (VmPtr, Addr + Index * sizeof (UINT32), (UINT32) Data);
- MemoryFence ();
- Data = (UINTN)RShiftU64 ((UINT64)Data, 32);
- }
- }
-
- return Status;
-}
-
-STATIC
-INT8
-VmReadImmed8 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- )
-/*++
-
-Routine Description:
-
- The following VmReadImmed routines are called by the EBC execute
- functions to read EBC immediate values from the code stream.
- Since we can't assume alignment, each tries to read in the biggest
- chunks size available, but will revert to smaller reads if necessary.
-
-Arguments:
- VmPtr - pointer to a VM context
- Offset - offset from IP of the code bytes to read.
-
-Returns:
- Signed data of the requested size from the specified address.
-
---*/
-{
- //
- // Simply return the data in flat memory space
- //
- return * (INT8 *) (VmPtr->Ip + Offset);
-}
-
-STATIC
-INT16
-VmReadImmed16 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- )
-{
- //
- // Read direct if aligned
- //
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (INT16))) {
- return * (INT16 *) (VmPtr->Ip + Offset);
- } else {
- //
- // All code word reads should be aligned
- //
- EbcDebugSignalException (
- EXCEPT_EBC_ALIGNMENT_CHECK,
- EXCEPTION_FLAG_WARNING,
- VmPtr
- );
- }
- //
- // Return unaligned data
- //
- return (INT16) (*(UINT8 *) (VmPtr->Ip + Offset) + (*(UINT8 *) (VmPtr->Ip + Offset + 1) << 8));
-}
-
-STATIC
-INT32
-VmReadImmed32 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- )
-{
- UINT32 Data;
-
- //
- // Read direct if aligned
- //
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT32))) {
- return * (INT32 *) (VmPtr->Ip + Offset);
- }
- //
- // Return unaligned data
- //
- Data = (UINT32) VmReadCode16 (VmPtr, Offset);
- Data |= (UINT32) (VmReadCode16 (VmPtr, Offset + 2) << 16);
- return Data;
-}
-
-STATIC
-INT64
-VmReadImmed64 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- )
-{
- UINT64 Data64;
- UINT32 Data32;
- UINT8 *Ptr;
-
- //
- // Read direct if aligned
- //
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT64))) {
- return * (UINT64 *) (VmPtr->Ip + Offset);
- }
- //
- // Return unaligned data.
- //
- Ptr = (UINT8 *) &Data64;
- Data32 = VmReadCode32 (VmPtr, Offset);
- *(UINT32 *) Ptr = Data32;
- Ptr += sizeof (Data32);
- Data32 = VmReadCode32 (VmPtr, Offset + sizeof (UINT32));
- *(UINT32 *) Ptr = Data32;
- return Data64;
-}
-
-STATIC
-UINT16
-VmReadCode16 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- )
-/*++
-
-Routine Description:
- The following VmReadCode() routines provide the ability to read raw
- unsigned data from the code stream.
-
-Arguments:
- VmPtr - pointer to VM context
- Offset - offset from current IP to the raw data to read.
-
-Returns:
- The raw unsigned 16-bit value from the code stream.
-
---*/
-{
- //
- // Read direct if aligned
- //
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT16))) {
- return * (UINT16 *) (VmPtr->Ip + Offset);
- } else {
- //
- // All code word reads should be aligned
- //
- EbcDebugSignalException (
- EXCEPT_EBC_ALIGNMENT_CHECK,
- EXCEPTION_FLAG_WARNING,
- VmPtr
- );
- }
- //
- // Return unaligned data
- //
- return (UINT16) (*(UINT8 *) (VmPtr->Ip + Offset) + (*(UINT8 *) (VmPtr->Ip + Offset + 1) << 8));
-}
-
-STATIC
-UINT32
-VmReadCode32 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- )
-{
- UINT32 Data;
- //
- // Read direct if aligned
- //
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT32))) {
- return * (UINT32 *) (VmPtr->Ip + Offset);
- }
- //
- // Return unaligned data
- //
- Data = (UINT32) VmReadCode16 (VmPtr, Offset);
- Data |= (VmReadCode16 (VmPtr, Offset + 2) << 16);
- return Data;
-}
-
-STATIC
-UINT64
-VmReadCode64 (
- IN VM_CONTEXT *VmPtr,
- IN UINT32 Offset
- )
-{
- UINT64 Data64;
- UINT32 Data32;
- UINT8 *Ptr;
-
- //
- // Read direct if aligned
- //
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT64))) {
- return * (UINT64 *) (VmPtr->Ip + Offset);
- }
- //
- // Return unaligned data.
- //
- Ptr = (UINT8 *) &Data64;
- Data32 = VmReadCode32 (VmPtr, Offset);
- *(UINT32 *) Ptr = Data32;
- Ptr += sizeof (Data32);
- Data32 = VmReadCode32 (VmPtr, Offset + sizeof (UINT32));
- *(UINT32 *) Ptr = Data32;
- return Data64;
-}
-
-STATIC
-UINT8
-VmReadMem8 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- )
-{
- //
- // Convert the address if it's in the stack gap
- //
- Addr = ConvertStackAddr (VmPtr, Addr);
- //
- // Simply return the data in flat memory space
- //
- return * (UINT8 *) Addr;
-}
-
-STATIC
-UINT16
-VmReadMem16 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- )
-{
- //
- // Convert the address if it's in the stack gap
- //
- Addr = ConvertStackAddr (VmPtr, Addr);
- //
- // Read direct if aligned
- //
- if (IS_ALIGNED (Addr, sizeof (UINT16))) {
- return * (UINT16 *) Addr;
- }
- //
- // Return unaligned data
- //
- return (UINT16) (*(UINT8 *) Addr + (*(UINT8 *) (Addr + 1) << 8));
-}
-
-STATIC
-UINT32
-VmReadMem32 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- )
-{
- UINT32 Data;
-
- //
- // Convert the address if it's in the stack gap
- //
- Addr = ConvertStackAddr (VmPtr, Addr);
- //
- // Read direct if aligned
- //
- if (IS_ALIGNED (Addr, sizeof (UINT32))) {
- return * (UINT32 *) Addr;
- }
- //
- // Return unaligned data
- //
- Data = (UINT32) VmReadMem16 (VmPtr, Addr);
- Data |= (VmReadMem16 (VmPtr, Addr + 2) << 16);
- return Data;
-}
-
-STATIC
-UINT64
-VmReadMem64 (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- )
-{
- UINT64 Data;
- UINT32 Data32;
-
- //
- // Convert the address if it's in the stack gap
- //
- Addr = ConvertStackAddr (VmPtr, Addr);
-
- //
- // Read direct if aligned
- //
- if (IS_ALIGNED (Addr, sizeof (UINT64))) {
- return * (UINT64 *) Addr;
- }
- //
- // Return unaligned data. Assume little endian.
- //
- Data = (UINT64) VmReadMem32 (VmPtr, Addr);
- Data32 = VmReadMem32 (VmPtr, Addr + sizeof (UINT32));
- *(UINT32 *) ((UINT32 *) &Data + 1) = Data32;
- return Data;
-}
-
-STATIC
-UINTN
-ConvertStackAddr (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- )
-/*++
-
-Routine Description:
-
- Given an address that EBC is going to read from or write to, return
- an appropriate address that accounts for a gap in the stack.
-
- The stack for this application looks like this (high addr on top)
- [EBC entry point arguments]
- [VM stack]
- [EBC stack]
-
- The EBC assumes that its arguments are at the top of its stack, which
- is where the VM stack is really. Therefore if the EBC does memory
- accesses into the VM stack area, then we need to convert the address
- to point to the EBC entry point arguments area. Do this here.
-
-Arguments:
-
- VmPtr - pointer to VM context
- Addr - address of interest
-
-Returns:
-
- The unchanged address if it's not in the VM stack region. Otherwise,
- adjust for the stack gap and return the modified address.
-
---*/
-{
- ASSERT(((Addr < VmPtr->LowStackTop) || (Addr > VmPtr->HighStackBottom)));
- return Addr;
-}
-
-STATIC
-UINTN
-VmReadMemN (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr
- )
-/*++
-
-Routine Description:
- Read a natural value from memory. May or may not be aligned.
-
-Arguments:
- VmPtr - current VM context
- Addr - the address to read from
-
-Returns:
- The natural value at address Addr.
-
---*/
-{
- UINTN Data;
- volatile UINT32 Size;
- UINT8 *FromPtr;
- UINT8 *ToPtr;
- //
- // Convert the address if it's in the stack gap
- //
- Addr = ConvertStackAddr (VmPtr, Addr);
- //
- // Read direct if aligned
- //
- if (IS_ALIGNED (Addr, sizeof (UINTN))) {
- return * (UINTN *) Addr;
- }
- //
- // Return unaligned data
- //
- Data = 0;
- FromPtr = (UINT8 *) Addr;
- ToPtr = (UINT8 *) &Data;
-
- for (Size = 0; Size < sizeof (Data); Size++) {
- *ToPtr = *FromPtr;
- ToPtr++;
- FromPtr++;
- }
-
- return Data;
-}
-
-UINT64
-GetVmVersion (
- VOID
- )
-{
- return (UINT64) (((VM_MAJOR_VERSION & 0xFFFF) << 16) | ((VM_MINOR_VERSION & 0xFFFF)));
-}
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.h b/EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.h
deleted file mode 100644
index b1926ee..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/EbcExecute.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EbcExecute.h
-
-Abstract:
-
- Header file for Virtual Machine support. Contains EBC defines that can
- be of use to a disassembler for the most part. Also provides function
- prototypes for VM functions.
-
---*/
-
-#ifndef _EBC_EXECUTE_H_
-#define _EBC_EXECUTE_H_
-
-//
-// VM major/minor version
-//
-#define VM_MAJOR_VERSION 1
-#define VM_MINOR_VERSION 0
-
-//
-// Macros to check and set alignment
-//
-#define ASSERT_ALIGNED(addr, size) ASSERT (!((UINT32) (addr) & (size - 1)))
-#define IS_ALIGNED(addr, size) !((UINT32) (addr) & (size - 1))
-
-//
-// Define a macro to get the operand. Then we can change it to be either a
-// direct read or have it call a function to read memory.
-//
-#define GETOPERANDS(pVM) (UINT8) (*(UINT8 *) (pVM->Ip + 1))
-#define GETOPCODE(pVM) (UINT8) (*(UINT8 *) pVM->Ip)
-
-//
-// Bit masks for opcode encodings
-//
-#define OPCODE_M_OPCODE 0x3F // bits of interest for first level decode
-#define OPCODE_M_IMMDATA 0x80
-#define OPCODE_M_IMMDATA64 0x40
-#define OPCODE_M_64BIT 0x40 // for CMP
-#define OPCODE_M_RELADDR 0x10 // for CALL instruction
-#define OPCODE_M_CMPI32_DATA 0x80 // for CMPI
-#define OPCODE_M_CMPI64 0x40 // for CMPI 32 or 64 bit comparison
-#define OPERAND_M_MOVIN_N 0x80
-#define OPERAND_M_CMPI_INDEX 0x10
-
-//
-// Masks for instructions that encode presence of indexes for operand1 and/or
-// operand2.
-//
-#define OPCODE_M_IMMED_OP1 0x80
-#define OPCODE_M_IMMED_OP2 0x40
-
-//
-// Bit masks for operand encodings
-//
-#define OPERAND_M_INDIRECT1 0x08
-#define OPERAND_M_INDIRECT2 0x80
-#define OPERAND_M_OP1 0x07
-#define OPERAND_M_OP2 0x70
-
-//
-// Masks for data manipulation instructions
-//
-#define DATAMANIP_M_64 0x40 // 64-bit width operation
-#define DATAMANIP_M_IMMDATA 0x80
-
-//
-// For MOV instructions, need a mask for the opcode when immediate
-// data applies to R2.
-//
-#define OPCODE_M_IMMED_OP2 0x40
-
-//
-// The MOVI/MOVIn instructions use bit 6 of operands byte to indicate
-// if an index is present. Then bits 4 and 5 are used to indicate the width
-// of the move.
-//
-#define MOVI_M_IMMDATA 0x40
-#define MOVI_M_DATAWIDTH 0xC0
-#define MOVI_DATAWIDTH16 0x40
-#define MOVI_DATAWIDTH32 0x80
-#define MOVI_DATAWIDTH64 0xC0
-#define MOVI_M_MOVEWIDTH 0x30
-#define MOVI_MOVEWIDTH8 0x00
-#define MOVI_MOVEWIDTH16 0x10
-#define MOVI_MOVEWIDTH32 0x20
-#define MOVI_MOVEWIDTH64 0x30
-
-//
-// Masks for CALL instruction encodings
-//
-#define OPERAND_M_RELATIVE_ADDR 0x10
-#define OPERAND_M_NATIVE_CALL 0x20
-
-//
-// Masks for decoding push/pop instructions
-//
-#define PUSHPOP_M_IMMDATA 0x80 // opcode bit indicating immediate data
-#define PUSHPOP_M_64 0x40 // opcode bit indicating 64-bit operation
-//
-// Mask for operand of JMP instruction
-//
-#define JMP_M_RELATIVE 0x10
-#define JMP_M_CONDITIONAL 0x80
-#define JMP_M_CS 0x40
-
-//
-// Macros to determine if a given operand is indirect
-//
-#define OPERAND1_INDIRECT(op) ((op) & OPERAND_M_INDIRECT1)
-#define OPERAND2_INDIRECT(op) ((op) & OPERAND_M_INDIRECT2)
-
-//
-// Macros to extract the operands from second byte of instructions
-//
-#define OPERAND1_REGNUM(op) ((op) & OPERAND_M_OP1)
-#define OPERAND2_REGNUM(op) (((op) & OPERAND_M_OP2) >> 4)
-
-#define OPERAND1_CHAR(op) ('0' + OPERAND1_REGNUM (op))
-#define OPERAND2_CHAR(op) ('0' + OPERAND2_REGNUM (op))
-
-#define OPERAND1_REGDATA(pvm, op) pvm->R[OPERAND1_REGNUM (op)]
-#define OPERAND2_REGDATA(pvm, op) pvm->R[OPERAND2_REGNUM (op)]
-
-//
-// Condition masks usually for byte 1 encodings of code
-//
-#define CONDITION_M_CONDITIONAL 0x80
-#define CONDITION_M_CS 0x40
-
-//
-// Bits in the VM->StopFlags field
-//
-#define STOPFLAG_APP_DONE 0x0001
-#define STOPFLAG_BREAKPOINT 0x0002
-#define STOPFLAG_INVALID_BREAK 0x0004
-#define STOPFLAG_BREAK_ON_CALLEX 0x0008
-
-//
-// Masks for working with the VM flags register
-//
-#define VMFLAGS_CC 0x0001 // condition flag
-#define VMFLAGS_STEP 0x0002 // step instruction mode
-#define VMFLAGS_ALL_VALID (VMFLAGS_CC | VMFLAGS_STEP)
-
-//
-// Macros for operating on the VM flags register
-//
-#define VMFLAG_SET(pVM, Flag) (pVM->Flags |= (Flag))
-#define VMFLAG_ISSET(pVM, Flag) ((pVM->Flags & (Flag)) ? 1 : 0)
-#define VMFLAG_CLEAR(pVM, Flag) (pVM->Flags &= ~(Flag))
-
-//
-// Debug macro
-//
-#define EBCMSG(s) gST->ConOut->OutputString (gST->ConOut, s)
-
-//
-// Define OPCODES
-//
-#define OPCODE_BREAK 0x00
-#define OPCODE_JMP 0x01
-#define OPCODE_JMP8 0x02
-#define OPCODE_CALL 0x03
-#define OPCODE_RET 0x04
-#define OPCODE_CMPEQ 0x05
-#define OPCODE_CMPLTE 0x06
-#define OPCODE_CMPGTE 0x07
-#define OPCODE_CMPULTE 0x08
-#define OPCODE_CMPUGTE 0x09
-#define OPCODE_NOT 0x0A
-#define OPCODE_NEG 0x0B
-#define OPCODE_ADD 0x0C
-#define OPCODE_SUB 0x0D
-#define OPCODE_MUL 0x0E
-#define OPCODE_MULU 0x0F
-#define OPCODE_DIV 0x10
-#define OPCODE_DIVU 0x11
-#define OPCODE_MOD 0x12
-#define OPCODE_MODU 0x13
-#define OPCODE_AND 0x14
-#define OPCODE_OR 0x15
-#define OPCODE_XOR 0x16
-#define OPCODE_SHL 0x17
-#define OPCODE_SHR 0x18
-#define OPCODE_ASHR 0x19
-#define OPCODE_EXTNDB 0x1A
-#define OPCODE_EXTNDW 0x1B
-#define OPCODE_EXTNDD 0x1C
-#define OPCODE_MOVBW 0x1D
-#define OPCODE_MOVWW 0x1E
-#define OPCODE_MOVDW 0x1F
-#define OPCODE_MOVQW 0x20
-#define OPCODE_MOVBD 0x21
-#define OPCODE_MOVWD 0x22
-#define OPCODE_MOVDD 0x23
-#define OPCODE_MOVQD 0x24
-#define OPCODE_MOVSNW 0x25 // Move signed natural with word index
-#define OPCODE_MOVSND 0x26 // Move signed natural with dword index
-//
-// #define OPCODE_27 0x27
-//
-#define OPCODE_MOVQQ 0x28 // Does this go away?
-#define OPCODE_LOADSP 0x29
-#define OPCODE_STORESP 0x2A
-#define OPCODE_PUSH 0x2B
-#define OPCODE_POP 0x2C
-#define OPCODE_CMPIEQ 0x2D
-#define OPCODE_CMPILTE 0x2E
-#define OPCODE_CMPIGTE 0x2F
-#define OPCODE_CMPIULTE 0x30
-#define OPCODE_CMPIUGTE 0x31
-#define OPCODE_MOVNW 0x32
-#define OPCODE_MOVND 0x33
-//
-// #define OPCODE_34 0x34
-//
-#define OPCODE_PUSHN 0x35
-#define OPCODE_POPN 0x36
-#define OPCODE_MOVI 0x37
-#define OPCODE_MOVIN 0x38
-#define OPCODE_MOVREL 0x39
-
-EFI_STATUS
-EbcExecute (
- IN VM_CONTEXT *VmPtr
- )
-;
-
-
-
-UINT64
-GetVmVersion (
- VOID
- )
-;
-
-EFI_STATUS
-VmWriteMemN (
- IN VM_CONTEXT *VmPtr,
- IN UINTN Addr,
- IN UINTN Data
- )
-;
-
-EFI_STATUS
-VmWriteMem64 (
- IN VM_CONTEXT *VmPtr,
- UINTN Addr,
- IN UINT64 Data
- )
-;
-
-//
-// Define a protocol for an EBC VM test interface.
-//
-#define EFI_EBC_VM_TEST_PROTOCOL_GUID \
- { \
- 0xAAEACCFDL, 0xF27B, 0x4C17, { 0xB6, 0x10, 0x75, 0xCA, 0x1F, 0x2D, 0xFB, 0x52 } \
- }
-
-//
-// Define for forward reference.
-//
-typedef struct _EFI_EBC_VM_TEST_PROTOCOL EFI_EBC_VM_TEST_PROTOCOL;
-
-typedef
-EFI_STATUS
-(*EBC_VM_TEST_EXECUTE) (
- IN EFI_EBC_VM_TEST_PROTOCOL * This,
- IN VM_CONTEXT * VmPtr,
- IN OUT UINTN *InstructionCount
- );
-
-typedef
-EFI_STATUS
-(*EBC_VM_TEST_ASM) (
- IN EFI_EBC_VM_TEST_PROTOCOL * This,
- IN CHAR16 *AsmText,
- IN OUT INT8 *Buffer,
- IN OUT UINTN *BufferLen
- );
-
-typedef
-EFI_STATUS
-(*EBC_VM_TEST_DASM) (
- IN EFI_EBC_VM_TEST_PROTOCOL * This,
- IN OUT CHAR16 *AsmText,
- IN OUT INT8 *Buffer,
- IN OUT UINTN *Len
- );
-
-//
-// Prototype for the actual EBC test protocol interface
-//
-struct _EFI_EBC_VM_TEST_PROTOCOL {
- EBC_VM_TEST_EXECUTE Execute;
- EBC_VM_TEST_ASM Assemble;
- EBC_VM_TEST_DASM Disassemble;
-};
-
-EFI_STATUS
-EbcExecuteInstructions (
- IN EFI_EBC_VM_TEST_PROTOCOL *This,
- IN VM_CONTEXT *VmPtr,
- IN OUT UINTN *InstructionCount
- )
-;
-
-#endif // ifndef _EBC_EXECUTE_H_
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/EbcInt.c b/EdkModulePkg/Universal/Ebc/Dxe/EbcInt.c
deleted file mode 100644
index 2b647d9..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/EbcInt.c
+++ /dev/null
@@ -1,1172 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EbcInt.c
-
-Abstract:
-
- Top level module for the EBC virtual machine implementation.
- Provides auxilliary support routines for the VM. That is, routines
- that are not particularly related to VM execution of EBC instructions.
-
---*/
-
-#include "EbcInt.h"
-#include "EbcExecute.h"
-
-//
-// We'll keep track of all thunks we create in a linked list. Each
-// thunk is tied to an image handle, so we have a linked list of
-// image handles, with each having a linked list of thunks allocated
-// to that image handle.
-//
-typedef struct _EBC_THUNK_LIST {
- VOID *ThunkBuffer;
- struct _EBC_THUNK_LIST *Next;
-} EBC_THUNK_LIST;
-
-typedef struct _EBC_IMAGE_LIST {
- struct _EBC_IMAGE_LIST *Next;
- EFI_HANDLE ImageHandle;
- EBC_THUNK_LIST *ThunkList;
-} EBC_IMAGE_LIST;
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcUnloadImage (
- IN EFI_EBC_PROTOCOL *This,
- IN EFI_HANDLE ImageHandle
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcCreateThunk (
- IN EFI_EBC_PROTOCOL *This,
- IN EFI_HANDLE ImageHandle,
- IN VOID *EbcEntryPoint,
- OUT VOID **Thunk
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcGetVersion (
- IN EFI_EBC_PROTOCOL *This,
- IN OUT UINT64 *Version
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-InitializeEbcCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This
- );
-
-STATIC
-VOID
-EFIAPI
-CommonEbcExceptionHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_SYSTEM_CONTEXT SystemContext
- );
-
-STATIC
-VOID
-EFIAPI
-EbcPeriodicNotifyFunction (
- IN EFI_EVENT Event,
- IN VOID *Context
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcDebugPeriodic (
- IN VM_CONTEXT *VmPtr
- );
-
-//
-// These two functions and the GUID are used to produce an EBC test protocol.
-// This functionality is definitely not required for execution.
-//
-STATIC
-EFI_STATUS
-InitEbcVmTestProtocol (
- IN EFI_HANDLE *Handle
- );
-
-STATIC
-EFI_STATUS
-EbcVmTestUnsupported (
- VOID
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcRegisterICacheFlush (
- IN EFI_EBC_PROTOCOL *This,
- IN EBC_ICACHE_FLUSH Flush
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcDebugGetMaximumProcessorIndex (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- OUT UINTN *MaxProcessorIndex
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcDebugRegisterPeriodicCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_PERIODIC_CALLBACK PeriodicCallback
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcDebugRegisterExceptionCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_EXCEPTION_CALLBACK ExceptionCallback,
- IN EFI_EXCEPTION_TYPE ExceptionType
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcDebugInvalidateInstructionCache (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN VOID *Start,
- IN UINT64 Length
- );
-
-//
-// We have one linked list of image handles for the whole world. Since
-// there should only be one interpreter, make them global. They must
-// also be global since the execution of an EBC image does not provide
-// a This pointer.
-//
-static EBC_IMAGE_LIST *mEbcImageList = NULL;
-
-//
-// Callback function to flush the icache after thunk creation
-//
-static EBC_ICACHE_FLUSH mEbcICacheFlush;
-
-//
-// These get set via calls by the debug agent
-//
-static EFI_PERIODIC_CALLBACK mDebugPeriodicCallback = NULL;
-static EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION + 1] = {NULL};
-static EFI_GUID mEfiEbcVmTestProtocolGuid = EFI_EBC_VM_TEST_PROTOCOL_GUID;
-
-static VOID* mStackBuffer[MAX_STACK_NUM];
-static EFI_HANDLE mStackBufferIndex[MAX_STACK_NUM];
-static UINTN mStackNum = 0;
-
-//
-// Event for Periodic callback
-//
-static EFI_EVENT mEbcPeriodicEvent;
-VM_CONTEXT *mVmPtr = NULL;
-
-EFI_STATUS
-EFIAPI
-InitializeEbcDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Initializes the VM EFI interface. Allocates memory for the VM interface
- and registers the VM protocol.
-
-Arguments:
-
- ImageHandle - EFI image handle.
- SystemTable - Pointer to the EFI system table.
-
-Returns:
- Standard EFI status code.
-
---*/
-{
- EFI_EBC_PROTOCOL *EbcProtocol;
- EFI_EBC_PROTOCOL *OldEbcProtocol;
- EFI_STATUS Status;
- EFI_DEBUG_SUPPORT_PROTOCOL *EbcDebugProtocol;
- EFI_HANDLE *HandleBuffer;
- UINTN NumHandles;
- UINTN Index;
- BOOLEAN Installed;
-
- EbcProtocol = NULL;
- EbcDebugProtocol = NULL;
-
- //
- // Allocate memory for our protocol. Then fill in the blanks.
- //
- EbcProtocol = AllocatePool (sizeof (EFI_EBC_PROTOCOL));
-
- if (EbcProtocol == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- EbcProtocol->CreateThunk = EbcCreateThunk;
- EbcProtocol->UnloadImage = EbcUnloadImage;
- EbcProtocol->RegisterICacheFlush = EbcRegisterICacheFlush;
- EbcProtocol->GetVersion = EbcGetVersion;
- mEbcICacheFlush = NULL;
-
- //
- // Find any already-installed EBC protocols and uninstall them
- //
- Installed = FALSE;
- HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiEbcProtocolGuid,
- NULL,
- &NumHandles,
- &HandleBuffer
- );
- if (Status == EFI_SUCCESS) {
- //
- // Loop through the handles
- //
- for (Index = 0; Index < NumHandles; Index++) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiEbcProtocolGuid,
- (VOID **) &OldEbcProtocol
- );
- if (Status == EFI_SUCCESS) {
- if (gBS->ReinstallProtocolInterface (
- HandleBuffer[Index],
- &gEfiEbcProtocolGuid,
- OldEbcProtocol,
- EbcProtocol
- ) == EFI_SUCCESS) {
- Installed = TRUE;
- }
- }
- }
- }
-
- if (HandleBuffer != NULL) {
- FreePool (HandleBuffer);
- HandleBuffer = NULL;
- }
- //
- // Add the protocol so someone can locate us if we haven't already.
- //
- if (!Installed) {
- Status = gBS->InstallProtocolInterface (
- &ImageHandle,
- &gEfiEbcProtocolGuid,
- EFI_NATIVE_INTERFACE,
- EbcProtocol
- );
- if (EFI_ERROR (Status)) {
- FreePool (EbcProtocol);
- return Status;
- }
- }
-
- Status = InitEBCStack();
- if (EFI_ERROR(Status)) {
- goto ErrorExit;
- }
-
- //
- // Allocate memory for our debug protocol. Then fill in the blanks.
- //
- EbcDebugProtocol = AllocatePool (sizeof (EFI_DEBUG_SUPPORT_PROTOCOL));
-
- if (EbcDebugProtocol == NULL) {
- goto ErrorExit;
- }
-
- EbcDebugProtocol->Isa = IsaEbc;
- EbcDebugProtocol->GetMaximumProcessorIndex = EbcDebugGetMaximumProcessorIndex;
- EbcDebugProtocol->RegisterPeriodicCallback = EbcDebugRegisterPeriodicCallback;
- EbcDebugProtocol->RegisterExceptionCallback = EbcDebugRegisterExceptionCallback;
- EbcDebugProtocol->InvalidateInstructionCache = EbcDebugInvalidateInstructionCache;
-
- //
- // Add the protocol so the debug agent can find us
- //
- Status = gBS->InstallProtocolInterface (
- &ImageHandle,
- &gEfiDebugSupportProtocolGuid,
- EFI_NATIVE_INTERFACE,
- EbcDebugProtocol
- );
- //
- // This is recoverable, so free the memory and continue.
- //
- if (EFI_ERROR (Status)) {
- FreePool (EbcDebugProtocol);
- goto ErrorExit;
- }
- //
- // Install EbcDebugSupport Protocol Successfully
- // Now we need to initialize the Ebc default Callback
- //
- Status = InitializeEbcCallback (EbcDebugProtocol);
-
- //
- // Produce a VM test interface protocol. Not required for execution.
- //
- DEBUG_CODE_BEGIN ();
- InitEbcVmTestProtocol (&ImageHandle);
- DEBUG_CODE_END ();
-
- return EFI_SUCCESS;
-
-ErrorExit:
- FreeEBCStack();
- HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiEbcProtocolGuid,
- NULL,
- &NumHandles,
- &HandleBuffer
- );
- if (Status == EFI_SUCCESS) {
- //
- // Loop through the handles
- //
- for (Index = 0; Index < NumHandles; Index++) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiEbcProtocolGuid,
- (VOID **) &OldEbcProtocol
- );
- if (Status == EFI_SUCCESS) {
- gBS->UninstallProtocolInterface (
- HandleBuffer[Index],
- &gEfiEbcProtocolGuid,
- OldEbcProtocol
- );
- }
- }
- }
-
- if (HandleBuffer != NULL) {
- FreePool (HandleBuffer);
- HandleBuffer = NULL;
- }
-
- FreePool (EbcProtocol);
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcCreateThunk (
- IN EFI_EBC_PROTOCOL *This,
- IN EFI_HANDLE ImageHandle,
- IN VOID *EbcEntryPoint,
- OUT VOID **Thunk
- )
-/*++
-
-Routine Description:
-
- This is the top-level routine plugged into the EBC protocol. Since thunks
- are very processor-specific, from here we dispatch directly to the very
- processor-specific routine EbcCreateThunks().
-
-Arguments:
-
- This - protocol instance pointer
- ImageHandle - handle to the image. The EBC interpreter may use this to keep
- track of any resource allocations performed in loading and
- executing the image.
- EbcEntryPoint - the entry point for the image (as defined in the file header)
- Thunk - pointer to thunk pointer where the address of the created
- thunk is returned.
-
-Returns:
-
- EFI_STATUS
-
---*/
-{
- EFI_STATUS Status;
-
- Status = EbcCreateThunks (
- ImageHandle,
- EbcEntryPoint,
- Thunk,
- FLAG_THUNK_ENTRY_POINT
- );
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcDebugGetMaximumProcessorIndex (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- OUT UINTN *MaxProcessorIndex
- )
-/*++
-
-Routine Description:
-
- This EBC debugger protocol service is called by the debug agent
-
-Arguments:
-
- This - pointer to the caller's debug support protocol interface
- MaxProcessorIndex - pointer to a caller allocated UINTN in which the maximum
- processor index is returned.
-
-Returns:
-
- Standard EFI_STATUS
-
---*/
-{
- *MaxProcessorIndex = 0;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcDebugRegisterPeriodicCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_PERIODIC_CALLBACK PeriodicCallback
- )
-/*++
-
-Routine Description:
-
- This protocol service is called by the debug agent to register a function
- for us to call on a periodic basis.
-
-
-Arguments:
-
- This - pointer to the caller's debug support protocol interface
- PeriodicCallback - pointer to the function to call periodically
-
-Returns:
-
- Always EFI_SUCCESS
-
---*/
-{
- if ((mDebugPeriodicCallback == NULL) && (PeriodicCallback == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
- if ((mDebugPeriodicCallback != NULL) && (PeriodicCallback != NULL)) {
- return EFI_ALREADY_STARTED;
- }
-
- mDebugPeriodicCallback = PeriodicCallback;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcDebugRegisterExceptionCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN EFI_EXCEPTION_CALLBACK ExceptionCallback,
- IN EFI_EXCEPTION_TYPE ExceptionType
- )
-/*++
-
-Routine Description:
-
- This protocol service is called by the debug agent to register a function
- for us to call when we detect an exception.
-
-
-Arguments:
-
- This - pointer to the caller's debug support protocol interface
- ExceptionCallback - pointer to the function to the exception
-
-Returns:
-
- Always EFI_SUCCESS
-
---*/
-{
- if ((ExceptionType < 0) || (ExceptionType > MAX_EBC_EXCEPTION)) {
- return EFI_INVALID_PARAMETER;
- }
- if ((mDebugExceptionCallback[ExceptionType] == NULL) && (ExceptionCallback == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
- if ((mDebugExceptionCallback[ExceptionType] != NULL) && (ExceptionCallback != NULL)) {
- return EFI_ALREADY_STARTED;
- }
- mDebugExceptionCallback[ExceptionType] = ExceptionCallback;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcDebugInvalidateInstructionCache (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
- IN UINTN ProcessorIndex,
- IN VOID *Start,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
- This EBC debugger protocol service is called by the debug agent. Required
- for DebugSupport compliance but is only stubbed out for EBC.
-
-Arguments:
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EbcDebugSignalException (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN EXCEPTION_FLAGS ExceptionFlags,
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
-
- The VM interpreter calls this function when an exception is detected.
-
-Arguments:
-
- VmPtr - pointer to a VM context for passing info to the EFI debugger.
-
-Returns:
-
- EFI_SUCCESS if it returns at all
-
---*/
-{
- EFI_SYSTEM_CONTEXT_EBC EbcContext;
- EFI_SYSTEM_CONTEXT SystemContext;
-
- ASSERT ((ExceptionType >= 0) && (ExceptionType <= MAX_EBC_EXCEPTION));
- //
- // Save the exception in the context passed in
- //
- VmPtr->ExceptionFlags |= ExceptionFlags;
- VmPtr->LastException = ExceptionType;
- //
- // If it's a fatal exception, then flag it in the VM context in case an
- // attached debugger tries to return from it.
- //
- if (ExceptionFlags & EXCEPTION_FLAG_FATAL) {
- VmPtr->StopFlags |= STOPFLAG_APP_DONE;
- }
-
- //
- // If someone's registered for exception callbacks, then call them.
- //
- // EBC driver will register default exception callback to report the
- // status code via the status code API
- //
- if (mDebugExceptionCallback[ExceptionType] != NULL) {
-
- //
- // Initialize the context structure
- //
- EbcContext.R0 = VmPtr->R[0];
- EbcContext.R1 = VmPtr->R[1];
- EbcContext.R2 = VmPtr->R[2];
- EbcContext.R3 = VmPtr->R[3];
- EbcContext.R4 = VmPtr->R[4];
- EbcContext.R5 = VmPtr->R[5];
- EbcContext.R6 = VmPtr->R[6];
- EbcContext.R7 = VmPtr->R[7];
- EbcContext.Ip = (UINT64)(UINTN)VmPtr->Ip;
- EbcContext.Flags = VmPtr->Flags;
- EbcContext.ControlFlags = 0;
- SystemContext.SystemContextEbc = &EbcContext;
-
- mDebugExceptionCallback[ExceptionType] (ExceptionType, SystemContext);
- //
- // Restore the context structure and continue to execute
- //
- VmPtr->R[0] = EbcContext.R0;
- VmPtr->R[1] = EbcContext.R1;
- VmPtr->R[2] = EbcContext.R2;
- VmPtr->R[3] = EbcContext.R3;
- VmPtr->R[4] = EbcContext.R4;
- VmPtr->R[5] = EbcContext.R5;
- VmPtr->R[6] = EbcContext.R6;
- VmPtr->R[7] = EbcContext.R7;
- VmPtr->Ip = (VMIP)(UINTN)EbcContext.Ip;
- VmPtr->Flags = EbcContext.Flags;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-InitializeEbcCallback (
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- To install default Callback function for the VM interpreter.
-
-Arguments:
-
- This - pointer to the instance of DebugSupport protocol
-
-Returns:
-
- None
-
---*/
-{
- INTN Index;
- EFI_STATUS Status;
-
- //
- // For ExceptionCallback
- //
- for (Index = 0; Index <= MAX_EBC_EXCEPTION; Index++) {
- EbcDebugRegisterExceptionCallback (
- This,
- 0,
- CommonEbcExceptionHandler,
- Index
- );
- }
-
- //
- // For PeriodicCallback
- //
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- EbcPeriodicNotifyFunction,
- &mVmPtr,
- &mEbcPeriodicEvent
- );
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- Status = gBS->SetTimer (
- mEbcPeriodicEvent,
- TimerPeriodic,
- EBC_VM_PERIODIC_CALLBACK_RATE
- );
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-VOID
-CommonEbcExceptionHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_SYSTEM_CONTEXT SystemContext
- )
-/*++
-
-Routine Description:
-
- The default Exception Callback for the VM interpreter.
- In this function, we report status code, and print debug information
- about EBC_CONTEXT, then dead loop.
-
-Arguments:
-
- InterruptType - Interrupt type.
- SystemContext - EBC system context.
-
-Returns:
-
- None
-
---*/
-{
- //
- // We deadloop here to make it easy to debug this issue.
- //
- ASSERT (FALSE);
-
- return ;
-}
-
-STATIC
-VOID
-EFIAPI
-EbcPeriodicNotifyFunction (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- The periodic callback function for EBC VM interpreter, which is used
- to support the EFI debug support protocol.
-
-Arguments:
-
- Event - The Periodic Callback Event.
- Context - It should be the address of VM_CONTEXT pointer.
-
-Returns:
-
- None.
-
---*/
-{
- VM_CONTEXT *VmPtr;
-
- VmPtr = *(VM_CONTEXT **)Context;
-
- if (VmPtr != NULL) {
- EbcDebugPeriodic (VmPtr);
- }
-
- return ;
-}
-
-STATIC
-EFI_STATUS
-EbcDebugPeriodic (
- IN VM_CONTEXT *VmPtr
- )
-/*++
-
-Routine Description:
-
- The VM interpreter calls this function on a periodic basis to support
- the EFI debug support protocol.
-
-Arguments:
-
- VmPtr - pointer to a VM context for passing info to the debugger.
-
-Returns:
-
- Standard EFI status.
-
---*/
-{
- EFI_SYSTEM_CONTEXT_EBC EbcContext;
- EFI_SYSTEM_CONTEXT SystemContext;
-
- //
- // If someone's registered for periodic callbacks, then call them.
- //
- if (mDebugPeriodicCallback != NULL) {
-
- //
- // Initialize the context structure
- //
- EbcContext.R0 = VmPtr->R[0];
- EbcContext.R1 = VmPtr->R[1];
- EbcContext.R2 = VmPtr->R[2];
- EbcContext.R3 = VmPtr->R[3];
- EbcContext.R4 = VmPtr->R[4];
- EbcContext.R5 = VmPtr->R[5];
- EbcContext.R6 = VmPtr->R[6];
- EbcContext.R7 = VmPtr->R[7];
- EbcContext.Ip = (UINT64)(UINTN)VmPtr->Ip;
- EbcContext.Flags = VmPtr->Flags;
- EbcContext.ControlFlags = 0;
- SystemContext.SystemContextEbc = &EbcContext;
-
- mDebugPeriodicCallback (SystemContext);
-
- //
- // Restore the context structure and continue to execute
- //
- VmPtr->R[0] = EbcContext.R0;
- VmPtr->R[1] = EbcContext.R1;
- VmPtr->R[2] = EbcContext.R2;
- VmPtr->R[3] = EbcContext.R3;
- VmPtr->R[4] = EbcContext.R4;
- VmPtr->R[5] = EbcContext.R5;
- VmPtr->R[6] = EbcContext.R6;
- VmPtr->R[7] = EbcContext.R7;
- VmPtr->Ip = (VMIP)(UINTN)EbcContext.Ip;
- VmPtr->Flags = EbcContext.Flags;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcUnloadImage (
- IN EFI_EBC_PROTOCOL *This,
- IN EFI_HANDLE ImageHandle
- )
-/*++
-
-Routine Description:
-
- This routine is called by the core when an image is being unloaded from
- memory. Basically we now have the opportunity to do any necessary cleanup.
- Typically this will include freeing any memory allocated for thunk-creation.
-
-Arguments:
-
- This - protocol instance pointer
- ImageHandle - handle to the image being unloaded.
-
-Returns:
-
- EFI_INVALID_PARAMETER - the ImageHandle passed in was not found in
- the internal list of EBC image handles.
- EFI_STATUS - completed successfully
-
---*/
-{
- EBC_THUNK_LIST *ThunkList;
- EBC_THUNK_LIST *NextThunkList;
- EBC_IMAGE_LIST *ImageList;
- EBC_IMAGE_LIST *PrevImageList;
- //
- // First go through our list of known image handles and see if we've already
- // created an image list element for this image handle.
- //
- ReturnEBCStackByHandle(ImageHandle);
- PrevImageList = NULL;
- for (ImageList = mEbcImageList; ImageList != NULL; ImageList = ImageList->Next) {
- if (ImageList->ImageHandle == ImageHandle) {
- break;
- }
- //
- // Save the previous so we can connect the lists when we remove this one
- //
- PrevImageList = ImageList;
- }
-
- if (ImageList == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Free up all the thunk buffers and thunks list elements for this image
- // handle.
- //
- ThunkList = ImageList->ThunkList;
- while (ThunkList != NULL) {
- NextThunkList = ThunkList->Next;
- FreePool (ThunkList->ThunkBuffer);
- FreePool (ThunkList);
- ThunkList = NextThunkList;
- }
- //
- // Now remove this image list element from the chain
- //
- if (PrevImageList == NULL) {
- //
- // Remove from head
- //
- mEbcImageList = ImageList->Next;
- } else {
- PrevImageList->Next = ImageList->Next;
- }
- //
- // Now free up the image list element
- //
- FreePool (ImageList);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EbcAddImageThunk (
- IN EFI_HANDLE ImageHandle,
- IN VOID *ThunkBuffer,
- IN UINT32 ThunkSize
- )
-/*++
-
-Routine Description:
-
- Add a thunk to our list of thunks for a given image handle.
- Also flush the instruction cache since we've written thunk code
- to memory that will be executed eventually.
-
-Arguments:
-
- ImageHandle - the image handle to which the thunk is tied
- ThunkBuffer - the buffer we've created/allocated
- ThunkSize - the size of the thunk memory allocated
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - memory allocation failed
- EFI_SUCCESS - successful completion
-
---*/
-{
- EBC_THUNK_LIST *ThunkList;
- EBC_IMAGE_LIST *ImageList;
- EFI_STATUS Status;
-
- //
- // It so far so good, then flush the instruction cache
- //
- if (mEbcICacheFlush != NULL) {
- Status = mEbcICacheFlush ((EFI_PHYSICAL_ADDRESS) (UINTN) ThunkBuffer, ThunkSize);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- //
- // Go through our list of known image handles and see if we've already
- // created a image list element for this image handle.
- //
- for (ImageList = mEbcImageList; ImageList != NULL; ImageList = ImageList->Next) {
- if (ImageList->ImageHandle == ImageHandle) {
- break;
- }
- }
-
- if (ImageList == NULL) {
- //
- // Allocate a new one
- //
- ImageList = AllocatePool (sizeof (EBC_IMAGE_LIST));
-
- if (ImageList == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- ImageList->ThunkList = NULL;
- ImageList->ImageHandle = ImageHandle;
- ImageList->Next = mEbcImageList;
- mEbcImageList = ImageList;
- }
- //
- // Ok, now create a new thunk element to add to the list
- //
- ThunkList = AllocatePool (sizeof (EBC_THUNK_LIST));
-
- if (ThunkList == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Add it to the head of the list
- //
- ThunkList->Next = ImageList->ThunkList;
- ThunkList->ThunkBuffer = ThunkBuffer;
- ImageList->ThunkList = ThunkList;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcRegisterICacheFlush (
- IN EFI_EBC_PROTOCOL *This,
- IN EBC_ICACHE_FLUSH Flush
- )
-{
- mEbcICacheFlush = Flush;
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-EbcGetVersion (
- IN EFI_EBC_PROTOCOL *This,
- IN OUT UINT64 *Version
- )
-{
- if (Version == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Version = GetVmVersion ();
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetEBCStack(
- EFI_HANDLE Handle,
- VOID **StackBuffer,
- UINTN *BufferIndex
- )
-{
- UINTN Index;
- EFI_TPL OldTpl;
- OldTpl = gBS->RaiseTPL(TPL_HIGH_LEVEL);
- for (Index = 0; Index < mStackNum; Index ++) {
- if (mStackBufferIndex[Index] == NULL) {
- mStackBufferIndex[Index] = Handle;
- break;
- }
- }
- gBS->RestoreTPL(OldTpl);
- if (Index == mStackNum) {
- return EFI_OUT_OF_RESOURCES;
- }
- *BufferIndex = Index;
- *StackBuffer = mStackBuffer[Index];
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ReturnEBCStack(
- UINTN Index
- )
-{
- mStackBufferIndex[Index] =NULL;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ReturnEBCStackByHandle(
- EFI_HANDLE Handle
- )
-{
- UINTN Index;
- for (Index = 0; Index < mStackNum; Index ++) {
- if (mStackBufferIndex[Index] == Handle) {
- break;
- }
- }
- if (Index == mStackNum) {
- return EFI_NOT_FOUND;
- }
- mStackBufferIndex[Index] = NULL;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InitEBCStack (
- VOID
- )
-{
- for (mStackNum = 0; mStackNum < MAX_STACK_NUM; mStackNum ++) {
- mStackBuffer[mStackNum] = AllocatePool(STACK_POOL_SIZE);
- mStackBufferIndex[mStackNum] = NULL;
- if (mStackBuffer[mStackNum] == NULL) {
- break;
- }
- }
- if (mStackNum == 0) {
- return EFI_OUT_OF_RESOURCES;
- }
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FreeEBCStack(
- VOID
- )
-{
- UINTN Index;
- for (Index = 0; Index < mStackNum; Index ++) {
- FreePool(mStackBuffer[Index]);
- }
- return EFI_SUCCESS;
-}
-STATIC
-EFI_STATUS
-InitEbcVmTestProtocol (
- IN EFI_HANDLE *IHandle
- )
-/*++
-
-Routine Description:
-
- Produce an EBC VM test protocol that can be used for regression tests.
-
-Arguments:
-
- IHandle - handle on which to install the protocol.
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - memory allocation failed
- EFI_SUCCESS - successful completion
-
---*/
-{
- EFI_HANDLE Handle;
- EFI_STATUS Status;
- EFI_EBC_VM_TEST_PROTOCOL *EbcVmTestProtocol;
-
- //
- // Allocate memory for the protocol, then fill in the fields
- //
- EbcVmTestProtocol = AllocatePool (sizeof (EFI_EBC_VM_TEST_PROTOCOL));
- if (EbcVmTestProtocol == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- EbcVmTestProtocol->Execute = (EBC_VM_TEST_EXECUTE) EbcExecuteInstructions;
-
- DEBUG_CODE_BEGIN ();
- EbcVmTestProtocol->Assemble = (EBC_VM_TEST_ASM) EbcVmTestUnsupported;
- EbcVmTestProtocol->Disassemble = (EBC_VM_TEST_DASM) EbcVmTestUnsupported;
- DEBUG_CODE_END ();
-
- //
- // Publish the protocol
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (&Handle, &mEfiEbcVmTestProtocolGuid, EFI_NATIVE_INTERFACE, EbcVmTestProtocol);
- if (EFI_ERROR (Status)) {
- FreePool (EbcVmTestProtocol);
- }
- return Status;
-}
-STATIC
-EFI_STATUS
-EbcVmTestUnsupported ()
-{
- return EFI_UNSUPPORTED;
-}
-
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/EbcInt.h b/EdkModulePkg/Universal/Ebc/Dxe/EbcInt.h
deleted file mode 100644
index 6926a90..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/EbcInt.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EbcInt.h
-
-Abstract:
-
- Main routines for the EBC interpreter. Includes the initialization and
- main interpreter routines.
-
---*/
-
-#ifndef _EBC_INT_H_
-#define _EBC_INT_H_
-
-typedef INT64 VM_REGISTER;
-typedef UINT8 *VMIP; // instruction pointer for the VM
-typedef UINT32 EXCEPTION_FLAGS;
-
-typedef struct {
- VM_REGISTER R[8]; // General purpose registers.
- UINT64 Flags; // Flags register:
- // 0 Set to 1 if the result of the last compare was true
- // 1 Set to 1 if stepping
- // 2..63 Reserved.
- VMIP Ip; // Instruction pointer.
- UINTN LastException; //
- EXCEPTION_FLAGS ExceptionFlags; // to keep track of exceptions
- UINT32 StopFlags;
- UINT32 CompilerVersion; // via break(6)
- UINTN HighStackBottom; // bottom of the upper stack
- UINTN LowStackTop; // top of the lower stack
- UINT64 StackRetAddr; // location of final return address on stack
- UINTN *StackMagicPtr; // pointer to magic value on stack to detect corruption
- EFI_HANDLE ImageHandle; // for this EBC driver
- EFI_SYSTEM_TABLE *SystemTable; // for debugging only
- UINTN LastAddrConverted; // for debug
- UINTN LastAddrConvertedValue; // for debug
- VOID *FramePtr;
- VOID *EntryPoint; // entry point of EBC image
- UINTN ImageBase;
- VOID *StackPool;
- VOID *StackTop;
-} VM_CONTEXT;
-
-extern VM_CONTEXT *mVmPtr;
-
-//
-// Bits of exception flags field of VM context
-//
-#define EXCEPTION_FLAG_FATAL 0x80000000 // can't continue
-#define EXCEPTION_FLAG_ERROR 0x40000000 // bad, but try to continue
-#define EXCEPTION_FLAG_WARNING 0x20000000 // harmless problem
-#define EXCEPTION_FLAG_NONE 0x00000000 // for normal return
-//
-// Flags passed to the internal create-thunks function.
-//
-#define FLAG_THUNK_ENTRY_POINT 0x01 // thunk for an image entry point
-#define FLAG_THUNK_PROTOCOL 0x00 // thunk for an EBC protocol service
-//
-// Put this value at the bottom of the VM's stack gap so we can check it on
-// occasion to make sure the stack has not been corrupted.
-//
-#define VM_STACK_KEY_VALUE 0xDEADBEEF
-
-EFI_STATUS
-EbcCreateThunks (
- IN EFI_HANDLE ImageHandle,
- IN VOID *EbcEntryPoint,
- OUT VOID **Thunk,
- IN UINT32 Flags
- )
-;
-
-EFI_STATUS
-EbcAddImageThunk (
- IN EFI_HANDLE ImageHandle,
- IN VOID *ThunkBuffer,
- IN UINT32 ThunkSize
- )
-;
-
-//
-// The interpreter calls these when an exception is detected,
-// or as a periodic callback.
-//
-EFI_STATUS
-EbcDebugSignalException (
- IN EFI_EXCEPTION_TYPE ExceptionType,
- IN EXCEPTION_FLAGS ExceptionFlags,
- IN VM_CONTEXT *VmPtr
- )
-;
-
-//
-// Define a constant of how often to call the debugger periodic callback
-// function.
-//
-#define EFI_TIMER_UNIT_1MS (1000 * 10)
-#define EBC_VM_PERIODIC_CALLBACK_RATE (1000 * EFI_TIMER_UNIT_1MS)
-#define STACK_POOL_SIZE (1024 * 1020)
-#define MAX_STACK_NUM 4
-
-EFI_STATUS
-EbcDebugSignalPeriodic (
- IN VM_CONTEXT *VmPtr
- )
-;
-
-//
-// External low level functions that are native-processor dependent
-//
-UINTN
-EbcLLGetEbcEntryPoint (
- VOID
- )
-;
-
-UINTN
-EbcLLGetStackPointer (
- VOID
- )
-;
-
-VOID
-EbcLLCALLEXNative (
- IN UINTN CallAddr,
- IN UINTN EbcSp,
- IN VOID *FramePtr
- )
-;
-
-VOID
-EbcLLCALLEX (
- IN VM_CONTEXT *VmPtr,
- IN UINTN CallAddr,
- IN UINTN EbcSp,
- IN VOID *FramePtr,
- IN UINT8 Size
- )
-;
-
-INT64
-EbcLLGetReturnValue (
- VOID
- )
-;
-
-EFI_STATUS
-GetEBCStack(
- EFI_HANDLE Handle,
- VOID **StackBuffer,
- UINTN *BufferIndex
- );
-
-EFI_STATUS
-ReturnEBCStack(
- UINTN Index
- );
-
-EFI_STATUS
-InitEBCStack (
- VOID
- );
-
-EFI_STATUS
-FreeEBCStack(
- VOID
- );
-
-EFI_STATUS
-ReturnEBCStackByHandle(
- EFI_HANDLE Handle
- );
-//
-// Defines for a simple EBC debugger interface
-//
-typedef struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL;
-
-#define EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL_GUID \
- { \
- 0x2a72d11e, 0x7376, 0x40f6, { 0x9c, 0x68, 0x23, 0xfa, 0x2f, 0xe3, 0x63, 0xf1 } \
- }
-
-typedef
-EFI_STATUS
-(*EBC_DEBUGGER_SIGNAL_EXCEPTION) (
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,
- IN VM_CONTEXT * VmPtr,
- IN EFI_EXCEPTION_TYPE ExceptionType
- );
-
-typedef
-VOID
-(*EBC_DEBUGGER_DEBUG) (
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,
- IN VM_CONTEXT * VmPtr
- );
-
-typedef
-UINT32
-(*EBC_DEBUGGER_DASM) (
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,
- IN VM_CONTEXT * VmPtr,
- IN UINT16 *DasmString OPTIONAL,
- IN UINT32 DasmStringSize
- );
-
-//
-// This interface allows you to configure the EBC debug support
-// driver. For example, turn on or off saving and printing of
-// delta VM even if called. Or to even disable the entire interface,
-// in which case all functions become no-ops.
-//
-typedef
-EFI_STATUS
-(*EBC_DEBUGGER_CONFIGURE) (
- IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL * This,
- IN UINT32 ConfigId,
- IN UINTN ConfigValue
- );
-
-//
-// Prototype for the actual EBC debug support protocol interface
-//
-struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL {
- EBC_DEBUGGER_DEBUG Debugger;
- EBC_DEBUGGER_SIGNAL_EXCEPTION SignalException;
- EBC_DEBUGGER_DASM Dasm;
- EBC_DEBUGGER_CONFIGURE Configure;
-};
-
-typedef struct {
- EFI_EBC_PROTOCOL *This;
- VOID *EntryPoint;
- EFI_HANDLE ImageHandle;
- VM_CONTEXT VmContext;
-} EFI_EBC_THUNK_DATA;
-
-#define EBC_PROTOCOL_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('e', 'b', 'c', 'p')
-
-struct _EBC_PROTOCOL_PRIVATE_DATA {
- UINT32 Signature;
- EFI_EBC_PROTOCOL EbcProtocol;
- UINTN StackBase;
- UINTN StackTop;
- UINTN StackSize;
-} ;
-
-#define EBC_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \
- CR(a, EBC_PROTOCOL_PRIVATE_DATA, EbcProtocol, EBC_PROTOCOL_PRIVATE_DATA_SIGNATURE)
-
-
-#endif // #ifndef _EBC_INT_H_
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcLowLevel.S b/EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcLowLevel.S
deleted file mode 100644
index 2df0f0c..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcLowLevel.S
+++ /dev/null
@@ -1,54 +0,0 @@
-#****************************************************************************
-#*
-#* Copyright (c) 2006, Intel Corporation
-#* All rights reserved. This program and the accompanying materials
-#* are licensed and made available under the terms and conditions of the BSD License
-#* which accompanies this distribution. The full text of the license may be found at
-#* http://opensource.org/licenses/bsd-license.php
-#*
-#* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#*
-#****************************************************************************
-.globl ASM_PFX(CopyMem)
-
-.globl ASM_PFX(EbcLLCALLEXNative)
-ASM_PFX(EbcLLCALLEXNative):
- push %ebp
- push %ebx
- mov %esp,%ebp
- mov 0xc(%esp),%ecx
- mov 0x14(%esp),%eax
- mov 0x10(%esp),%edx
- sub %edx,%eax
- sub %eax,%esp
- mov %esp,%ebx
- push %ecx
- push %eax
- push %edx
- push %ebx
- call ASM_PFX(CopyMem)
- pop %eax
- pop %eax
- pop %eax
- pop %ecx
- call *%ecx
- mov %ebp,%esp
- mov %ebp,%esp
- pop %ebx
- pop %ebp
- ret
-
-.globl ASM_PFX(EbcLLGetEbcEntryPoint)
-ASM_PFX(EbcLLGetEbcEntryPoint):
- ret
-
-.globl ASM_PFX(EbcLLGetStackPointer)
-ASM_PFX(EbcLLGetStackPointer):
- mov %esp,%eax
- add $0x4,%eax
- ret
-
-.globl ASM_PFX(EbcLLGetReturnValue)
-ASM_PFX(EbcLLGetReturnValue):
- ret
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcLowLevel.asm b/EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcLowLevel.asm
deleted file mode 100644
index 4249241..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcLowLevel.asm
+++ /dev/null
@@ -1,163 +0,0 @@
- page ,132
- title VM ASSEMBLY LANGUAGE ROUTINES
-;****************************************************************************
-;*
-;* Copyright (c) 2006 - 2007, Intel Corporation
-;* All rights reserved. This program and the accompanying materials
-;* are licensed and made available under the terms and conditions of the BSD License
-;* which accompanies this distribution. The full text of the license may be found at
-;* http://opensource.org/licenses/bsd-license.php
-;*
-;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;*
-;****************************************************************************
-;****************************************************************************
-; REV 1.0
-;****************************************************************************
-;
-; Rev Date Description
-; --- -------- ------------------------------------------------------------
-; 1.0 03/14/01 Initial creation of file.
-;
-;****************************************************************************
-
-;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-; This code provides low level routines that support the Virtual Machine
-; for option ROMs.
-;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
-;---------------------------------------------------------------------------
-; Equate files needed.
-;---------------------------------------------------------------------------
-
-.XLIST
-
-.LIST
-
-;---------------------------------------------------------------------------
-; Assembler options
-;---------------------------------------------------------------------------
-
-.686p
-.model flat
-.code
-;---------------------------------------------------------------------------
-;;GenericPostSegment SEGMENT USE16
-;---------------------------------------------------------------------------
-CopyMem PROTO C Destination:PTR DWORD, Source:PTR DWORD, Count:DWORD
-
-;****************************************************************************
-; EbcLLCALLEXNative
-;
-; This function is called to execute an EBC CALLEX instruction
-; to native code.
-; This instruction requires that we thunk out to external native
-; code. For IA32, we simply switch stacks and jump to the
-; specified function. On return, we restore the stack pointer
-; to its original location.
-;
-; Destroys no working registers.
-;****************************************************************************
-; VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
-_EbcLLCALLEXNative PROC NEAR PUBLIC
- push ebp
- push ebx
- mov ebp, esp ; standard function prolog
-
- ; Get function address in a register
- ; mov ecx, FuncAddr => mov ecx, dword ptr [FuncAddr]
- mov ecx, dword ptr [esp]+0Ch
-
- ; Set stack pointer to new value
- ; mov eax, NewStackPointer => mov eax, dword ptr [NewSp]
- mov eax, dword ptr [esp] + 14h
- mov edx, dword ptr [esp] + 10h
- sub eax, edx
- sub esp, eax
- mov ebx, esp
- push ecx
- push eax
- push edx
- push ebx
- call CopyMem
- pop eax
- pop eax
- pop eax
- pop ecx
-
- ; Now call the external routine
- call ecx
-
- ; ebp is preserved by the callee. In this function it
- ; equals the original esp, so set them equal
- mov esp, ebp
-
- ; Standard function epilog
- mov esp, ebp
- pop ebx
- pop ebp
- ret
-_EbcLLCALLEXNative ENDP
-
-
-; UINTN EbcLLGetEbcEntryPoint(VOID);
-; Routine Description:
-; The VM thunk code stuffs an EBC entry point into a processor
-; register. Since we can't use inline assembly to get it from
-; the interpreter C code, stuff it into the return value
-; register and return.
-;
-; Arguments:
-; None.
-;
-; Returns:
-; The contents of the register in which the entry point is passed.
-;
-_EbcLLGetEbcEntryPoint PROC NEAR PUBLIC
- ret
-_EbcLLGetEbcEntryPoint ENDP
-
-;/*++
-;
-;Routine Description:
-;
-; Return the caller's value of the stack pointer.
-;
-;Arguments:
-;
-; None.
-;
-;Returns:
-;
-; The current value of the stack pointer for the caller. We
-; adjust it by 4 here because when they called us, the return address
-; is put on the stack, thereby lowering it by 4 bytes.
-;
-;--*/
-
-; UINTN EbcLLGetStackPointer()
-_EbcLLGetStackPointer PROC NEAR PUBLIC
- mov eax, esp ; get current stack pointer
- add eax, 4 ; stack adjusted by this much when we were called
- ret
-_EbcLLGetStackPointer ENDP
-
-; UINT64 EbcLLGetReturnValue(VOID);
-; Routine Description:
-; When EBC calls native, on return the VM has to stuff the return
-; value into a VM register. It's assumed here that the value is still
-; in the register, so simply return and the caller should get the
-; return result properly.
-;
-; Arguments:
-; None.
-;
-; Returns:
-; The unmodified value returned by the native code.
-;
-_EbcLLGetReturnValue PROC NEAR PUBLIC
- ret
-_EbcLLGetReturnValue ENDP
-
-END
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcSupport.c b/EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcSupport.c
deleted file mode 100644
index a534e00..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/Ia32/EbcSupport.c
+++ /dev/null
@@ -1,545 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EbcSupport.c
-
-Abstract:
-
- This module contains EBC support routines that are customized based on
- the target processor.
-
---*/
-
-#include "EbcInt.h"
-#include "EbcExecute.h"
-
-//
-// NOTE: This is the stack size allocated for the interpreter
-// when it executes an EBC image. The requirements can change
-// based on whether or not a debugger is present, and other
-// platform-specific configurations.
-//
-#define VM_STACK_SIZE (1024 * 4)
-#define EBC_THUNK_SIZE 32
-
-#define STACK_REMAIN_SIZE (1024 * 4)
-VOID
-EbcLLCALLEX (
- IN VM_CONTEXT *VmPtr,
- IN UINTN FuncAddr,
- IN UINTN NewStackPointer,
- IN VOID *FramePtr,
- IN UINT8 Size
- )
-/*++
-
-Routine Description:
-
- This function is called to execute an EBC CALLEX instruction.
- The function check the callee's content to see whether it is common native
- code or a thunk to another piece of EBC code.
- If the callee is common native code, use EbcLLCAllEXASM to manipulate,
- otherwise, set the VM->IP to target EBC code directly to avoid another VM
- be startup which cost time and stack space.
-
-Arguments:
-
- VmPtr - Pointer to a VM context.
- FuncAddr - Callee's address
- NewStackPointer - New stack pointer after the call
- FramePtr - New frame pointer after the call
- Size - The size of call instruction
-
-Returns:
-
- None.
-
---*/
-{
- UINTN IsThunk;
- UINTN TargetEbcAddr;
-
- IsThunk = 1;
- TargetEbcAddr = 0;
-
- //
- // Processor specific code to check whether the callee is a thunk to EBC.
- //
- if (*((UINT8 *)FuncAddr) != 0xB8) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 1) != 0xBC) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 2) != 0x2E) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 3) != 0x11) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 4) != 0xCA) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 5) != 0xB8) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 10) != 0xB9) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 15) != 0xFF) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 16) != 0xE1) {
- IsThunk = 0;
- goto Action;
- }
-
- TargetEbcAddr = ((UINTN)(*((UINT8 *)FuncAddr + 9)) << 24) + ((UINTN)(*((UINT8 *)FuncAddr + 8)) << 16) +
- ((UINTN)(*((UINT8 *)FuncAddr + 7)) << 8) + ((UINTN)(*((UINT8 *)FuncAddr + 6)));
-
-Action:
- if (IsThunk == 1){
- //
- // The callee is a thunk to EBC, adjust the stack pointer down 16 bytes and
- // put our return address and frame pointer on the VM stack.
- // Then set the VM's IP to new EBC code.
- //
- VmPtr->R[0] -= 8;
- VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], (UINTN) FramePtr);
- VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->R[0];
- VmPtr->R[0] -= 8;
- VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], (UINT64) (UINTN) (VmPtr->Ip + Size));
-
- VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
- } else {
- //
- // The callee is not a thunk to EBC, call native code.
- //
- EbcLLCALLEXNative (FuncAddr, NewStackPointer, FramePtr);
-
- //
- // Get return value and advance the IP.
- //
- VmPtr->R[7] = EbcLLGetReturnValue ();
- VmPtr->Ip += Size;
- }
-}
-
-STATIC
-UINT64
-EbcInterpret (
- IN OUT UINTN Arg1,
- IN OUT UINTN Arg2,
- IN OUT UINTN Arg3,
- IN OUT UINTN Arg4,
- IN OUT UINTN Arg5,
- IN OUT UINTN Arg6,
- IN OUT UINTN Arg7,
- IN OUT UINTN Arg8,
- IN OUT UINTN Arg9,
- IN OUT UINTN Arg10,
- IN OUT UINTN Arg11,
- IN OUT UINTN Arg12,
- IN OUT UINTN Arg13,
- IN OUT UINTN Arg14,
- IN OUT UINTN Arg15,
- IN OUT UINTN Arg16
- )
-/*++
-
-Routine Description:
-
- Begin executing an EBC image. The address of the entry point is passed
- in via a processor register, so we'll need to make a call to get the
- value.
-
-Arguments:
-
- None. Since we're called from a fixed up thunk (which we want to keep
- small), our only so-called argument is the EBC entry point passed in
- to us in a processor register.
-
-Returns:
-
- The value returned by the EBC application we're going to run.
-
---*/
-{
- //
- // Create a new VM context on the stack
- //
- VM_CONTEXT VmContext;
- UINTN Addr;
- EFI_STATUS Status;
- UINTN StackIndex;
-
- //
- // Get the EBC entry point from the processor register.
- //
- Addr = EbcLLGetEbcEntryPoint ();
-
- //
- // Now clear out our context
- //
- ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
-
- //
- // Set the VM instruction pointer to the correct location in memory.
- //
- VmContext.Ip = (VMIP) Addr;
- //
- // Initialize the stack pointer for the EBC. Get the current system stack
- // pointer and adjust it down by the max needed for the interpreter.
- //
-
- //
- // Align the stack on a natural boundary
- //
-
- //
- // Allocate stack pool
- //
- Status = GetEBCStack((EFI_HANDLE)-1, &VmContext.StackPool, &StackIndex);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
- VmContext.R[0] = (UINT64)(UINTN) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
- VmContext.HighStackBottom = (UINTN)VmContext.R[0];
- VmContext.R[0] &= ~(sizeof (UINTN) - 1);
- VmContext.R[0] -= sizeof (UINTN);
-
- //
- // Put a magic value in the stack gap, then adjust down again
- //
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) VM_STACK_KEY_VALUE;
- VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];
- VmContext.LowStackTop = (UINTN) VmContext.R[0];
-
- //
- // For IA32, this is where we say our return address is
- //
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg16;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg15;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg14;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg13;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg12;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg11;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg10;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg9;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg8;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg7;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg6;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg5;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg4;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg3;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg2;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) Arg1;
- VmContext.R[0] -= 16;
- VmContext.StackRetAddr = (UINT64) VmContext.R[0];
-
- //
- // We need to keep track of where the EBC stack starts. This way, if the EBC
- // accesses any stack variables above its initial stack setting, then we know
- // it's accessing variables passed into it, which means the data is on the
- // VM's stack.
- // When we're called, on the stack (high to low) we have the parameters, the
- // return address, then the saved ebp. Save the pointer to the return address.
- // EBC code knows that's there, so should look above it for function parameters.
- // The offset is the size of locals (VMContext + Addr + saved ebp).
- // Note that the interpreter assumes there is a 16 bytes of return address on
- // the stack too, so adjust accordingly.
- // VmContext.HighStackBottom = (UINTN)(Addr + sizeof (VmContext) + sizeof (Addr));
- //
-
- //
- // Begin executing the EBC code
- //
- EbcExecute (&VmContext);
-
- //
- // Return the value in R[7] unless there was an error
- //
- ReturnEBCStack(StackIndex);
- return (UINT64) VmContext.R[7];
-}
-
-STATIC
-UINT64
-ExecuteEbcImageEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Begin executing an EBC image. The address of the entry point is passed
- in via a processor register, so we'll need to make a call to get the
- value.
-
-Arguments:
-
- ImageHandle - image handle for the EBC application we're executing
- SystemTable - standard system table passed into an driver's entry point
-
-Returns:
-
- The value returned by the EBC application we're going to run.
-
---*/
-{
- //
- // Create a new VM context on the stack
- //
- VM_CONTEXT VmContext;
- UINTN Addr;
- EFI_STATUS Status;
- UINTN StackIndex;
-
- //
- // Get the EBC entry point from the processor register. Make sure you don't
- // call any functions before this or you could mess up the register the
- // entry point is passed in.
- //
- Addr = EbcLLGetEbcEntryPoint ();
-
- //
- // Print(L"*** Thunked into EBC entry point - ImageHandle = 0x%X\n", (UINTN)ImageHandle);
- // Print(L"EBC entry point is 0x%X\n", (UINT32)(UINTN)Addr);
- //
- // Now clear out our context
- //
- ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
-
- //
- // Save the image handle so we can track the thunks created for this image
- //
- VmContext.ImageHandle = ImageHandle;
- VmContext.SystemTable = SystemTable;
-
- //
- // Set the VM instruction pointer to the correct location in memory.
- //
- VmContext.Ip = (VMIP) Addr;
-
- //
- // Initialize the stack pointer for the EBC. Get the current system stack
- // pointer and adjust it down by the max needed for the interpreter.
- //
-
- //
- // Allocate stack pool
- //
- Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
- VmContext.R[0] = (UINT64)(UINTN) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
- VmContext.HighStackBottom = (UINTN)VmContext.R[0];
- VmContext.R[0] -= sizeof (UINTN);
-
- //
- // Put a magic value in the stack gap, then adjust down again
- //
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) VM_STACK_KEY_VALUE;
- VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];
-
- //
- // Align the stack on a natural boundary
- // VmContext.R[0] &= ~(sizeof(UINTN) - 1);
- //
- VmContext.LowStackTop = (UINTN) VmContext.R[0];
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) SystemTable;
- VmContext.R[0] -= sizeof (UINTN);
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) ImageHandle;
-
- VmContext.R[0] -= 16;
- VmContext.StackRetAddr = (UINT64) VmContext.R[0];
- //
- // VM pushes 16-bytes for return address. Simulate that here.
- //
-
- //
- // Begin executing the EBC code
- //
- EbcExecute (&VmContext);
-
- //
- // Return the value in R[7] unless there was an error
- //
- return (UINT64) VmContext.R[7];
-}
-
-EFI_STATUS
-EbcCreateThunks (
- IN EFI_HANDLE ImageHandle,
- IN VOID *EbcEntryPoint,
- OUT VOID **Thunk,
- IN UINT32 Flags
- )
-/*++
-
-Routine Description:
-
- Create an IA32 thunk for the given EBC entry point.
-
-Arguments:
-
- ImageHandle - Handle of image for which this thunk is being created
- EbcEntryPoint - Address of the EBC code that the thunk is to call
- Thunk - Returned thunk we create here
-
-Returns:
-
- Standard EFI status.
-
---*/
-{
- UINT8 *Ptr;
- UINT8 *ThunkBase;
- UINT32 I;
- UINT32 Addr;
- INT32 Size;
- INT32 ThunkSize;
-
- //
- // Check alignment of pointer to EBC code
- //
- if ((UINT32) (UINTN) EbcEntryPoint & 0x01) {
- return EFI_INVALID_PARAMETER;
- }
-
- Size = EBC_THUNK_SIZE;
- ThunkSize = Size;
-
- Ptr = AllocatePool (Size);
-
- if (Ptr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Print(L"Allocate TH: 0x%X\n", (UINT32)Ptr);
- //
- // Save the start address so we can add a pointer to it to a list later.
- //
- ThunkBase = Ptr;
-
- //
- // Give them the address of our buffer we're going to fix up
- //
- *Thunk = (VOID *) Ptr;
-
- //
- // Add a magic code here to help the VM recognize the thunk..
- // mov eax, 0xca112ebc => B8 BC 2E 11 CA
- //
- *Ptr = 0xB8;
- Ptr++;
- Size--;
- Addr = (UINT32) 0xCA112EBC;
- for (I = 0; I < sizeof (Addr); I++) {
- *Ptr = (UINT8) (UINTN) Addr;
- Addr >>= 8;
- Ptr++;
- Size--;
- }
-
- //
- // Add code bytes to load up a processor register with the EBC entry point.
- // mov eax, 0xaa55aa55 => B8 55 AA 55 AA
- // The first 8 bytes of the thunk entry is the address of the EBC
- // entry point.
- //
- *Ptr = 0xB8;
- Ptr++;
- Size--;
- Addr = (UINT32) EbcEntryPoint;
- for (I = 0; I < sizeof (Addr); I++) {
- *Ptr = (UINT8) (UINTN) Addr;
- Addr >>= 8;
- Ptr++;
- Size--;
- }
- //
- // Stick in a load of ecx with the address of appropriate VM function.
- // mov ecx 12345678h => 0xB9 0x78 0x56 0x34 0x12
- //
- if (Flags & FLAG_THUNK_ENTRY_POINT) {
- Addr = (UINT32) (UINTN) ExecuteEbcImageEntryPoint;
- } else {
- Addr = (UINT32) (UINTN) EbcInterpret;
- }
-
- //
- // MOV ecx
- //
- *Ptr = 0xB9;
- Ptr++;
- Size--;
- for (I = 0; I < sizeof (Addr); I++) {
- *Ptr = (UINT8) Addr;
- Addr >>= 8;
- Ptr++;
- Size--;
- }
- //
- // Stick in jump opcode bytes for jmp ecx => 0xFF 0xE1
- //
- *Ptr = 0xFF;
- Ptr++;
- Size--;
- *Ptr = 0xE1;
- Size--;
-
- //
- // Double check that our defined size is ok (application error)
- //
- if (Size < 0) {
- ASSERT (FALSE);
- return EFI_BUFFER_TOO_SMALL;
- }
- //
- // Add the thunk to the list for this image. Do this last since the add
- // function flushes the cache for us.
- //
- EbcAddImageThunk (ImageHandle, (VOID *) ThunkBase, ThunkSize);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcLowLevel.s b/EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcLowLevel.s
deleted file mode 100644
index e329b68..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcLowLevel.s
+++ /dev/null
@@ -1,197 +0,0 @@
-//++
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// EbcLowLevel.s
-//
-// Abstract:
-//
-// Contains low level routines for the Virtual Machine implementation
-// on an Itanium-based platform.
-//
-//
-//--
-
-.file "EbcLowLevel.s"
-
-#define PROCEDURE_ENTRY(name) .##text; \
- .##type name, @function; \
- .##proc name; \
-name::
-
-#define PROCEDURE_EXIT(name) .##endp name
-
-// Note: use of NESTED_SETUP requires number of locals (l) >= 3
-
-#define NESTED_SETUP(i,l,o,r) \
- alloc loc1=ar##.##pfs,i,l,o,r ;\
- mov loc0=b0
-
-#define NESTED_RETURN \
- mov b0=loc0 ;\
- mov ar##.##pfs=loc1 ;;\
- br##.##ret##.##dpnt b0;;
-
-.type CopyMem, @function;
-
-//-----------------------------------------------------------------------------
-//++
-// EbcAsmLLCALLEX
-//
-// Implements the low level EBC CALLEX instruction. Sets up the
-// stack pointer, does the spill of function arguments, and
-// calls the native function. On return it restores the original
-// stack pointer and returns to the caller.
-//
-// Arguments :
-//
-// On Entry :
-// in0 = Address of native code to call
-// in1 = New stack pointer
-//
-// Return Value:
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-;// void EbcAsmLLCALLEX (UINTN FunctionAddr, UINTN EbcStackPointer)
-PROCEDURE_ENTRY(EbcAsmLLCALLEX)
- NESTED_SETUP (2,6,8,0)
-
- // NESTED_SETUP uses loc0 and loc1 for context save
-
- //
- // Save a copy of the EBC VM stack pointer
- //
- mov r8 = in1;;
-
- //
- // Copy stack arguments from EBC stack into registers.
- // Assume worst case and copy 8.
- //
- ld8 out0 = [r8], 8;;
- ld8 out1 = [r8], 8;;
- ld8 out2 = [r8], 8;;
- ld8 out3 = [r8], 8;;
- ld8 out4 = [r8], 8;;
- ld8 out5 = [r8], 8;;
- ld8 out6 = [r8], 8;;
- ld8 out7 = [r8], 8;;
-
- //
- // Save the original stack pointer
- //
- mov loc2 = r12;
-
- //
- // Save the gp
- //
- or loc3 = r1, r0
-
- //
- // Set the new aligned stack pointer. Reserve space for the required
- // 16-bytes of scratch area as well.
- //
- add r12 = 48, in1
-
- //
- // Now call the function. Load up the function address from the descriptor
- // pointed to by in0. Then get the gp from the descriptor at the following
- // address in the descriptor.
- //
- ld8 r31 = [in0], 8;;
- ld8 r30 = [in0];;
- mov b1 = r31
- mov r1 = r30
- (p0) br.call.dptk.many b0 = b1;;
-
- //
- // Restore the original stack pointer and gp
- //
- mov r12 = loc2
- or r1 = loc3, r0
-
- //
- // Now return
- //
- NESTED_RETURN
-
-PROCEDURE_EXIT(EbcAsmLLCALLEX)
-
-PROCEDURE_ENTRY(EbcLLCALLEXNative)
- NESTED_SETUP (3,6,3,0)
-
- mov loc2 = in2;;
- mov loc3 = in1;;
- sub loc2 = loc2, loc3
- mov loc4 = r12;;
- or loc5 = r1, r0
-
- sub r12 = r12, loc2
- mov out2 = loc2;;
-
- and r12 = -0x10, r12
- mov out1 = in1;;
- mov out0 = r12;;
- adds r12 = -0x8, r12
- (p0) br.call.dptk.many b0 = CopyMem;;
- adds r12 = 0x8, r12
-
- mov out0 = in0;;
- mov out1 = r12;;
- (p0) br.call.dptk.many b0 = EbcAsmLLCALLEX;;
- mov r12 = loc4;;
- or r1 = loc5, r0
-
- NESTED_RETURN
-PROCEDURE_EXIT(EbcLLCALLEXNative)
-
-
-//
-// UINTN EbcLLGetEbcEntryPoint(VOID)
-//
-// Description:
-// Simply return, so that the caller retrieves the return register
-// contents (R8). That's where the thunk-to-ebc code stuffed the
-// EBC entry point.
-//
-PROCEDURE_ENTRY(EbcLLGetEbcEntryPoint)
- br.ret.sptk b0 ;;
-PROCEDURE_EXIT(EbcLLGetEbcEntryPoint)
-
-//
-// INT64 EbcLLGetReturnValue(VOID)
-//
-// Description:
-// This function is called to get the value returned by native code
-// to EBC. It simply returns because the return value should still
-// be in the register, so the caller just gets the unmodified value.
-//
-PROCEDURE_ENTRY(EbcLLGetReturnValue)
- br.ret.sptk b0 ;;
-PROCEDURE_EXIT(EbcLLGetReturnValue)
-
-//
-// UINTN EbcLLGetStackPointer(VOID)
-//
-PROCEDURE_ENTRY(EbcLLGetStackPointer)
- mov r8 = r12 ;;
- br.ret.sptk b0 ;;
- br.sptk.few b6
-PROCEDURE_EXIT(EbcLLGetStackPointer)
-
-
-
-
-
-
-
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcSupport.c b/EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcSupport.c
deleted file mode 100644
index 3647a12..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcSupport.c
+++ /dev/null
@@ -1,869 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EbcSupport.c
-
-Abstract:
-
- This module contains EBC support routines that are customized based on
- the target processor.
-
---*/
-
-#include "EbcInt.h"
-#include "EbcExecute.h"
-#include "EbcSupport.h"
-
-STATIC
-EFI_STATUS
-WriteBundle (
- IN VOID *MemPtr,
- IN UINT8 Template,
- IN UINT64 Slot0,
- IN UINT64 Slot1,
- IN UINT64 Slot2
- );
-
-STATIC
-VOID
-PushU64 (
- VM_CONTEXT *VmPtr,
- UINT64 Arg
- )
-{
- //
- // Advance the VM stack down, and then copy the argument to the stack.
- // Hope it's aligned.
- //
- VmPtr->R[0] -= sizeof (UINT64);
- *(UINT64 *) VmPtr->R[0] = Arg;
-}
-
-STATIC
-UINT64
-EbcInterpret (
- UINT64 Arg1,
- ...
- )
-{
- //
- // Create a new VM context on the stack
- //
- VM_CONTEXT VmContext;
- UINTN Addr;
- EFI_STATUS Status;
- UINTN StackIndex;
- VA_LIST List;
- UINT64 Arg2;
- UINT64 Arg3;
- UINT64 Arg4;
- UINT64 Arg5;
- UINT64 Arg6;
- UINT64 Arg7;
- UINT64 Arg8;
- UINT64 Arg9;
- UINT64 Arg10;
- UINT64 Arg11;
- UINT64 Arg12;
- UINT64 Arg13;
- UINT64 Arg14;
- UINT64 Arg15;
- UINT64 Arg16;
- //
- // Get the EBC entry point from the processor register. Make sure you don't
- // call any functions before this or you could mess up the register the
- // entry point is passed in.
- //
- Addr = EbcLLGetEbcEntryPoint ();
- //
- // Need the args off the stack.
- //
- VA_START (List, Arg1);
- Arg2 = VA_ARG (List, UINT64);
- Arg3 = VA_ARG (List, UINT64);
- Arg4 = VA_ARG (List, UINT64);
- Arg5 = VA_ARG (List, UINT64);
- Arg6 = VA_ARG (List, UINT64);
- Arg7 = VA_ARG (List, UINT64);
- Arg8 = VA_ARG (List, UINT64);
- Arg9 = VA_ARG (List, UINT64);
- Arg10 = VA_ARG (List, UINT64);
- Arg11 = VA_ARG (List, UINT64);
- Arg12 = VA_ARG (List, UINT64);
- Arg13 = VA_ARG (List, UINT64);
- Arg14 = VA_ARG (List, UINT64);
- Arg15 = VA_ARG (List, UINT64);
- Arg16 = VA_ARG (List, UINT64);
- //
- // Now clear out our context
- //
- ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
- //
- // Set the VM instruction pointer to the correct location in memory.
- //
- VmContext.Ip = (VMIP) Addr;
- //
- // Initialize the stack pointer for the EBC. Get the current system stack
- // pointer and adjust it down by the max needed for the interpreter.
- //
- //
- // NOTE: Eventually we should have the interpreter allocate memory
- // for stack space which it will use during its execution. This
- // would likely improve performance because the interpreter would
- // no longer be required to test each memory access and adjust
- // those reading from the stack gap.
- //
- // For IPF, the stack looks like (assuming 10 args passed)
- // arg10
- // arg9 (Bottom of high stack)
- // [ stack gap for interpreter execution ]
- // [ magic value for detection of stack corruption ]
- // arg8 (Top of low stack)
- // arg7....
- // arg1
- // [ 64-bit return address ]
- // [ ebc stack ]
- // If the EBC accesses memory in the stack gap, then we assume that it's
- // actually trying to access args9 and greater. Therefore we need to
- // adjust memory accesses in this region to point above the stack gap.
- //
- //
- // Now adjust the EBC stack pointer down to leave a gap for interpreter
- // execution. Then stuff a magic value there.
- //
-
- Status = GetEBCStack((EFI_HANDLE)(UINTN)-1, &VmContext.StackPool, &StackIndex);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
- VmContext.R[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
- VmContext.HighStackBottom = (UINTN) VmContext.R[0];
- VmContext.R[0] -= sizeof (UINTN);
-
-
- PushU64 (&VmContext, (UINT64) VM_STACK_KEY_VALUE);
- VmContext.StackMagicPtr = (UINTN *) VmContext.R[0];
- VmContext.LowStackTop = (UINTN) VmContext.R[0];
- //
- // Push the EBC arguments on the stack. Does not matter that they may not
- // all be valid.
- //
- PushU64 (&VmContext, Arg16);
- PushU64 (&VmContext, Arg15);
- PushU64 (&VmContext, Arg14);
- PushU64 (&VmContext, Arg13);
- PushU64 (&VmContext, Arg12);
- PushU64 (&VmContext, Arg11);
- PushU64 (&VmContext, Arg10);
- PushU64 (&VmContext, Arg9);
- PushU64 (&VmContext, Arg8);
- PushU64 (&VmContext, Arg7);
- PushU64 (&VmContext, Arg6);
- PushU64 (&VmContext, Arg5);
- PushU64 (&VmContext, Arg4);
- PushU64 (&VmContext, Arg3);
- PushU64 (&VmContext, Arg2);
- PushU64 (&VmContext, Arg1);
- //
- // Push a bogus return address on the EBC stack because the
- // interpreter expects one there. For stack alignment purposes on IPF,
- // EBC return addresses are always 16 bytes. Push a bogus value as well.
- //
- PushU64 (&VmContext, 0);
- PushU64 (&VmContext, 0xDEADBEEFDEADBEEF);
- VmContext.StackRetAddr = (UINT64) VmContext.R[0];
- //
- // Begin executing the EBC code
- //
- EbcExecute (&VmContext);
- //
- // Return the value in R[7] unless there was an error
- //
- ReturnEBCStack(StackIndex);
- return (UINT64) VmContext.R[7];
-}
-
-STATIC
-UINT64
-ExecuteEbcImageEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- IPF implementation.
-
- Begin executing an EBC image. The address of the entry point is passed
- in via a processor register, so we'll need to make a call to get the
- value.
-
-Arguments:
-
- ImageHandle - image handle for the EBC application we're executing
- SystemTable - standard system table passed into an driver's entry point
-
-Returns:
-
- The value returned by the EBC application we're going to run.
-
---*/
-{
- //
- // Create a new VM context on the stack
- //
- VM_CONTEXT VmContext;
- UINTN Addr;
- EFI_STATUS Status;
- UINTN StackIndex;
-
- //
- // Get the EBC entry point from the processor register. Make sure you don't
- // call any functions before this or you could mess up the register the
- // entry point is passed in.
- //
- Addr = EbcLLGetEbcEntryPoint ();
-
- //
- // Now clear out our context
- //
- ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
-
- //
- // Save the image handle so we can track the thunks created for this image
- //
- VmContext.ImageHandle = ImageHandle;
- VmContext.SystemTable = SystemTable;
-
- //
- // Set the VM instruction pointer to the correct location in memory.
- //
- VmContext.Ip = (VMIP) Addr;
-
- //
- // Get the stack pointer. This is the bottom of the upper stack.
- //
- Addr = EbcLLGetStackPointer ();
-
- Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
- VmContext.R[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
- VmContext.HighStackBottom = (UINTN) VmContext.R[0];
- VmContext.R[0] -= sizeof (UINTN);
-
-
- //
- // Allocate stack space for the interpreter. Then put a magic value
- // at the bottom so we can detect stack corruption.
- //
- PushU64 (&VmContext, (UINT64) VM_STACK_KEY_VALUE);
- VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];
-
- //
- // When we thunk to external native code, we copy the last 8 qwords from
- // the EBC stack into the processor registers, and adjust the stack pointer
- // up. If the caller is not passing 8 parameters, then we've moved the
- // stack pointer up into the stack gap. If this happens, then the caller
- // can mess up the stack gap contents (in particular our magic value).
- // Therefore, leave another gap below the magic value. Pick 10 qwords down,
- // just as a starting point.
- //
- VmContext.R[0] -= 10 * sizeof (UINT64);
-
- //
- // Align the stack pointer such that after pushing the system table,
- // image handle, and return address on the stack, it's aligned on a 16-byte
- // boundary as required for IPF.
- //
- VmContext.R[0] &= (INT64)~0x0f;
- VmContext.LowStackTop = (UINTN) VmContext.R[0];
- //
- // Simply copy the image handle and system table onto the EBC stack.
- // Greatly simplifies things by not having to spill the args
- //
- PushU64 (&VmContext, (UINT64) SystemTable);
- PushU64 (&VmContext, (UINT64) ImageHandle);
-
- //
- // Interpreter assumes 64-bit return address is pushed on the stack.
- // IPF does not do this so pad the stack accordingly. Also, a
- // "return address" is 16 bytes as required for IPF stack alignments.
- //
- PushU64 (&VmContext, (UINT64) 0);
- PushU64 (&VmContext, (UINT64) 0x1234567887654321);
- VmContext.StackRetAddr = (UINT64) VmContext.R[0];
-
- //
- // Begin executing the EBC code
- //
- EbcExecute (&VmContext);
-
- //
- // Return the value in R[7] unless there was an error
- //
- ReturnEBCStack(StackIndex);
- return (UINT64) VmContext.R[7];
-}
-
-EFI_STATUS
-EbcCreateThunks (
- IN EFI_HANDLE ImageHandle,
- IN VOID *EbcEntryPoint,
- OUT VOID **Thunk,
- IN UINT32 Flags
- )
-/*++
-
-Routine Description:
-
- Create thunks for an EBC image entry point, or an EBC protocol service.
-
-Arguments:
-
- ImageHandle - Image handle for the EBC image. If not null, then we're
- creating a thunk for an image entry point.
- EbcEntryPoint - Address of the EBC code that the thunk is to call
- Thunk - Returned thunk we create here
- Flags - Flags indicating options for creating the thunk
-
-Returns:
-
- Standard EFI status.
-
---*/
-{
- UINT8 *Ptr;
- UINT8 *ThunkBase;
- UINT64 Addr;
- UINT64 Code[3]; // Code in a bundle
- UINT64 RegNum; // register number for MOVL
- UINT64 I; // bits of MOVL immediate data
- UINT64 Ic; // bits of MOVL immediate data
- UINT64 Imm5c; // bits of MOVL immediate data
- UINT64 Imm9d; // bits of MOVL immediate data
- UINT64 Imm7b; // bits of MOVL immediate data
- UINT64 Br; // branch register for loading and jumping
- UINT64 *Data64Ptr;
- UINT32 ThunkSize;
- UINT32 Size;
-
- //
- // Check alignment of pointer to EBC code, which must always be aligned
- // on a 2-byte boundary.
- //
- if ((UINT32) (UINTN) EbcEntryPoint & 0x01) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Allocate memory for the thunk. Make the (most likely incorrect) assumption
- // that the returned buffer is not aligned, so round up to the next
- // alignment size.
- //
- Size = EBC_THUNK_SIZE + EBC_THUNK_ALIGNMENT - 1;
- ThunkSize = Size;
- Ptr = AllocatePool (Size);
-
- if (Ptr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Save the start address of the buffer.
- //
- ThunkBase = Ptr;
-
- //
- // Make sure it's aligned for code execution. If not, then
- // round up.
- //
- if ((UINT32) (UINTN) Ptr & (EBC_THUNK_ALIGNMENT - 1)) {
- Ptr = (UINT8 *) (((UINTN) Ptr + (EBC_THUNK_ALIGNMENT - 1)) &~ (UINT64) (EBC_THUNK_ALIGNMENT - 1));
- }
- //
- // Return the pointer to the thunk to the caller to user as the
- // image entry point.
- //
- *Thunk = (VOID *) Ptr;
-
- //
- // Clear out the thunk entry
- // ZeroMem(Ptr, Size);
- //
- // For IPF, when you do a call via a function pointer, the function pointer
- // actually points to a function descriptor which consists of a 64-bit
- // address of the function, followed by a 64-bit gp for the function being
- // called. See the the Software Conventions and Runtime Architecture Guide
- // for details.
- // So first off in our thunk, create a descriptor for our actual thunk code.
- // This means we need to create a pointer to the thunk code (which follows
- // the descriptor we're going to create), followed by the gp of the Vm
- // interpret function we're going to eventually execute.
- //
- Data64Ptr = (UINT64 *) Ptr;
-
- //
- // Write the function's entry point (which is our thunk code that follows
- // this descriptor we're creating).
- //
- *Data64Ptr = (UINT64) (Data64Ptr + 2);
- //
- // Get the gp from the descriptor for EbcInterpret and stuff it in our thunk
- // descriptor.
- //
- *(Data64Ptr + 1) = *(UINT64 *) ((UINT64 *) (UINTN) EbcInterpret + 1);
- //
- // Advance our thunk data pointer past the descriptor. Since the
- // descriptor consists of 16 bytes, the pointer is still aligned for
- // IPF code execution (on 16-byte boundary).
- //
- Ptr += sizeof (UINT64) * 2;
-
- //
- // *************************** MAGIC BUNDLE ********************************
- //
- // Write magic code bundle for: movl r8 = 0xca112ebcca112ebc to help the VM
- // to recognize it is a thunk.
- //
- Addr = (UINT64) 0xCA112EBCCA112EBC;
-
- //
- // Now generate the code bytes. First is nop.m 0x0
- //
- Code[0] = OPCODE_NOP;
-
- //
- // Next is simply Addr[62:22] (41 bits) of the address
- //
- Code[1] = RShiftU64 (Addr, 22) & 0x1ffffffffff;
-
- //
- // Extract bits from the address for insertion into the instruction
- // i = Addr[63:63]
- //
- I = RShiftU64 (Addr, 63) & 0x01;
- //
- // ic = Addr[21:21]
- //
- Ic = RShiftU64 (Addr, 21) & 0x01;
- //
- // imm5c = Addr[20:16] for 5 bits
- //
- Imm5c = RShiftU64 (Addr, 16) & 0x1F;
- //
- // imm9d = Addr[15:7] for 9 bits
- //
- Imm9d = RShiftU64 (Addr, 7) & 0x1FF;
- //
- // imm7b = Addr[6:0] for 7 bits
- //
- Imm7b = Addr & 0x7F;
-
- //
- // The EBC entry point will be put into r8, so r8 can be used here
- // temporary. R8 is general register and is auto-serialized.
- //
- RegNum = 8;
-
- //
- // Next is jumbled data, including opcode and rest of address
- //
- Code[2] = LShiftU64 (Imm7b, 13);
- Code[2] = Code[2] | LShiftU64 (0x00, 20); // vc
- Code[2] = Code[2] | LShiftU64 (Ic, 21);
- Code[2] = Code[2] | LShiftU64 (Imm5c, 22);
- Code[2] = Code[2] | LShiftU64 (Imm9d, 27);
- Code[2] = Code[2] | LShiftU64 (I, 36);
- Code[2] = Code[2] | LShiftU64 ((UINT64)MOVL_OPCODE, 37);
- Code[2] = Code[2] | LShiftU64 ((RegNum & 0x7F), 6);
-
- WriteBundle ((VOID *) Ptr, 0x05, Code[0], Code[1], Code[2]);
-
- //
- // *************************** FIRST BUNDLE ********************************
- //
- // Write code bundle for: movl r8 = EBC_ENTRY_POINT so we pass
- // the ebc entry point in to the interpreter function via a processor
- // register.
- // Note -- we could easily change this to pass in a pointer to a structure
- // that contained, among other things, the EBC image's entry point. But
- // for now pass it directly.
- //
- Ptr += 16;
- Addr = (UINT64) EbcEntryPoint;
-
- //
- // Now generate the code bytes. First is nop.m 0x0
- //
- Code[0] = OPCODE_NOP;
-
- //
- // Next is simply Addr[62:22] (41 bits) of the address
- //
- Code[1] = RShiftU64 (Addr, 22) & 0x1ffffffffff;
-
- //
- // Extract bits from the address for insertion into the instruction
- // i = Addr[63:63]
- //
- I = RShiftU64 (Addr, 63) & 0x01;
- //
- // ic = Addr[21:21]
- //
- Ic = RShiftU64 (Addr, 21) & 0x01;
- //
- // imm5c = Addr[20:16] for 5 bits
- //
- Imm5c = RShiftU64 (Addr, 16) & 0x1F;
- //
- // imm9d = Addr[15:7] for 9 bits
- //
- Imm9d = RShiftU64 (Addr, 7) & 0x1FF;
- //
- // imm7b = Addr[6:0] for 7 bits
- //
- Imm7b = Addr & 0x7F;
-
- //
- // Put the EBC entry point in r8, which is the location of the return value
- // for functions.
- //
- RegNum = 8;
-
- //
- // Next is jumbled data, including opcode and rest of address
- //
- Code[2] = LShiftU64 (Imm7b, 13);
- Code[2] = Code[2] | LShiftU64 (0x00, 20); // vc
- Code[2] = Code[2] | LShiftU64 (Ic, 21);
- Code[2] = Code[2] | LShiftU64 (Imm5c, 22);
- Code[2] = Code[2] | LShiftU64 (Imm9d, 27);
- Code[2] = Code[2] | LShiftU64 (I, 36);
- Code[2] = Code[2] | LShiftU64 ((UINT64)MOVL_OPCODE, 37);
- Code[2] = Code[2] | LShiftU64 ((RegNum & 0x7F), 6);
-
- WriteBundle ((VOID *) Ptr, 0x05, Code[0], Code[1], Code[2]);
-
- //
- // *************************** NEXT BUNDLE *********************************
- //
- // Write code bundle for:
- // movl rx = offset_of(EbcInterpret|ExecuteEbcImageEntryPoint)
- //
- // Advance pointer to next bundle, then compute the offset from this bundle
- // to the address of the entry point of the interpreter.
- //
- Ptr += 16;
- if (Flags & FLAG_THUNK_ENTRY_POINT) {
- Addr = (UINT64) ExecuteEbcImageEntryPoint;
- } else {
- Addr = (UINT64) EbcInterpret;
- }
- //
- // Indirection on Itanium-based systems
- //
- Addr = *(UINT64 *) Addr;
-
- //
- // Now write the code to load the offset into a register
- //
- Code[0] = OPCODE_NOP;
-
- //
- // Next is simply Addr[62:22] (41 bits) of the address
- //
- Code[1] = RShiftU64 (Addr, 22) & 0x1ffffffffff;
-
- //
- // Extract bits from the address for insertion into the instruction
- // i = Addr[63:63]
- //
- I = RShiftU64 (Addr, 63) & 0x01;
- //
- // ic = Addr[21:21]
- //
- Ic = RShiftU64 (Addr, 21) & 0x01;
- //
- // imm5c = Addr[20:16] for 5 bits
- //
- Imm5c = RShiftU64 (Addr, 16) & 0x1F;
- //
- // imm9d = Addr[15:7] for 9 bits
- //
- Imm9d = RShiftU64 (Addr, 7) & 0x1FF;
- //
- // imm7b = Addr[6:0] for 7 bits
- //
- Imm7b = Addr & 0x7F;
-
- //
- // Put it in r31, a scratch register
- //
- RegNum = 31;
-
- //
- // Next is jumbled data, including opcode and rest of address
- //
- Code[2] = LShiftU64(Imm7b, 13);
- Code[2] = Code[2] | LShiftU64 (0x00, 20); // vc
- Code[2] = Code[2] | LShiftU64 (Ic, 21);
- Code[2] = Code[2] | LShiftU64 (Imm5c, 22);
- Code[2] = Code[2] | LShiftU64 (Imm9d, 27);
- Code[2] = Code[2] | LShiftU64 (I, 36);
- Code[2] = Code[2] | LShiftU64 ((UINT64)MOVL_OPCODE, 37);
- Code[2] = Code[2] | LShiftU64 ((RegNum & 0x7F), 6);
-
- WriteBundle ((VOID *) Ptr, 0x05, Code[0], Code[1], Code[2]);
-
- //
- // *************************** NEXT BUNDLE *********************************
- //
- // Load branch register with EbcInterpret() function offset from the bundle
- // address: mov b6 = RegNum
- //
- // See volume 3 page 4-29 of the Arch. Software Developer's Manual.
- //
- // Advance pointer to next bundle
- //
- Ptr += 16;
- Code[0] = OPCODE_NOP;
- Code[1] = OPCODE_NOP;
- Code[2] = OPCODE_MOV_BX_RX;
-
- //
- // Pick a branch register to use. Then fill in the bits for the branch
- // register and user register (same user register as previous bundle).
- //
- Br = 6;
- Code[2] |= LShiftU64 (Br, 6);
- Code[2] |= LShiftU64 (RegNum, 13);
- WriteBundle ((VOID *) Ptr, 0x0d, Code[0], Code[1], Code[2]);
-
- //
- // *************************** NEXT BUNDLE *********************************
- //
- // Now do the branch: (p0) br.cond.sptk.few b6
- //
- // Advance pointer to next bundle.
- // Fill in the bits for the branch register (same reg as previous bundle)
- //
- Ptr += 16;
- Code[0] = OPCODE_NOP;
- Code[1] = OPCODE_NOP;
- Code[2] = OPCODE_BR_COND_SPTK_FEW;
- Code[2] |= LShiftU64 (Br, 13);
- WriteBundle ((VOID *) Ptr, 0x1d, Code[0], Code[1], Code[2]);
-
- //
- // Add the thunk to our list of allocated thunks so we can do some cleanup
- // when the image is unloaded. Do this last since the Add function flushes
- // the instruction cache for us.
- //
- EbcAddImageThunk (ImageHandle, (VOID *) ThunkBase, ThunkSize);
-
- //
- // Done
- //
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-WriteBundle (
- IN VOID *MemPtr,
- IN UINT8 Template,
- IN UINT64 Slot0,
- IN UINT64 Slot1,
- IN UINT64 Slot2
- )
-/*++
-
-Routine Description:
-
- Given raw bytes of Itanium based code, format them into a bundle and
- write them out.
-
-Arguments:
-
- MemPtr - pointer to memory location to write the bundles to
- Template - 5-bit template
- Slot0-2 - instruction slot data for the bundle
-
-Returns:
-
- EFI_INVALID_PARAMETER - Pointer is not aligned
- - No more than 5 bits in template
- - More than 41 bits used in code
- EFI_SUCCESS - All data is written.
-
---*/
-{
- UINT8 *BPtr;
- UINT32 Index;
- UINT64 Low64;
- UINT64 High64;
-
- //
- // Verify pointer is aligned
- //
- if ((UINT64) MemPtr & 0xF) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Verify no more than 5 bits in template
- //
- if (Template &~0x1F) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Verify max of 41 bits used in code
- //
- if ((Slot0 | Slot1 | Slot2) &~0x1ffffffffff) {
- return EFI_INVALID_PARAMETER;
- }
-
- Low64 = LShiftU64 (Slot1, 46);
- Low64 = Low64 | LShiftU64 (Slot0, 5) | Template;
-
- High64 = RShiftU64 (Slot1, 18);
- High64 = High64 | LShiftU64 (Slot2, 23);
-
- //
- // Now write it all out
- //
- BPtr = (UINT8 *) MemPtr;
- for (Index = 0; Index < 8; Index++) {
- *BPtr = (UINT8) Low64;
- Low64 = RShiftU64 (Low64, 8);
- BPtr++;
- }
-
- for (Index = 0; Index < 8; Index++) {
- *BPtr = (UINT8) High64;
- High64 = RShiftU64 (High64, 8);
- BPtr++;
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-EbcLLCALLEX (
- IN VM_CONTEXT *VmPtr,
- IN UINTN FuncAddr,
- IN UINTN NewStackPointer,
- IN VOID *FramePtr,
- IN UINT8 Size
- )
-/*++
-
-Routine Description:
-
- This function is called to execute an EBC CALLEX instruction.
- The function check the callee's content to see whether it is common native
- code or a thunk to another piece of EBC code.
- If the callee is common native code, use EbcLLCAllEXASM to manipulate,
- otherwise, set the VM->IP to target EBC code directly to avoid another VM
- be startup which cost time and stack space.
-
-Arguments:
-
- VmPtr - Pointer to a VM context.
- FuncAddr - Callee's address
- NewStackPointer - New stack pointer after the call
- FramePtr - New frame pointer after the call
- Size - The size of call instruction
-
-Returns:
-
- None.
-
---*/
-{
- UINTN IsThunk;
- UINTN TargetEbcAddr;
- UINTN CodeOne18;
- UINTN CodeOne23;
- UINTN CodeTwoI;
- UINTN CodeTwoIc;
- UINTN CodeTwo7b;
- UINTN CodeTwo5c;
- UINTN CodeTwo9d;
- UINTN CalleeAddr;
-
- IsThunk = 1;
- TargetEbcAddr = 0;
-
- //
- // FuncAddr points to the descriptor of the target instructions.
- //
- CalleeAddr = *((UINT64 *)FuncAddr);
-
- //
- // Processor specific code to check whether the callee is a thunk to EBC.
- //
- if (*((UINT64 *)CalleeAddr) != 0xBCCA000100000005) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT64 *)CalleeAddr + 1) != 0x697623C1004A112E) {
- IsThunk = 0;
- goto Action;
- }
-
- CodeOne18 = RShiftU64 (*((UINT64 *)CalleeAddr + 2), 46) & 0x3FFFF;
- CodeOne23 = (*((UINT64 *)CalleeAddr + 3)) & 0x7FFFFF;
- CodeTwoI = RShiftU64 (*((UINT64 *)CalleeAddr + 3), 59) & 0x1;
- CodeTwoIc = RShiftU64 (*((UINT64 *)CalleeAddr + 3), 44) & 0x1;
- CodeTwo7b = RShiftU64 (*((UINT64 *)CalleeAddr + 3), 36) & 0x7F;
- CodeTwo5c = RShiftU64 (*((UINT64 *)CalleeAddr + 3), 45) & 0x1F;
- CodeTwo9d = RShiftU64 (*((UINT64 *)CalleeAddr + 3), 50) & 0x1FF;
-
- TargetEbcAddr = CodeTwo7b;
- TargetEbcAddr = TargetEbcAddr | LShiftU64 (CodeTwo9d, 7);
- TargetEbcAddr = TargetEbcAddr | LShiftU64 (CodeTwo5c, 16);
- TargetEbcAddr = TargetEbcAddr | LShiftU64 (CodeTwoIc, 21);
- TargetEbcAddr = TargetEbcAddr | LShiftU64 (CodeOne18, 22);
- TargetEbcAddr = TargetEbcAddr | LShiftU64 (CodeOne23, 40);
- TargetEbcAddr = TargetEbcAddr | LShiftU64 (CodeTwoI, 63);
-
-Action:
- if (IsThunk == 1){
- //
- // The callee is a thunk to EBC, adjust the stack pointer down 16 bytes and
- // put our return address and frame pointer on the VM stack.
- // Then set the VM's IP to new EBC code.
- //
- VmPtr->R[0] -= 8;
- VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], (UINTN) FramePtr);
- VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->R[0];
- VmPtr->R[0] -= 8;
- VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], (UINT64) (VmPtr->Ip + Size));
-
- VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
- } else {
- //
- // The callee is not a thunk to EBC, call native code.
- //
- EbcLLCALLEXNative (FuncAddr, NewStackPointer, FramePtr);
-
- //
- // Get return value and advance the IP.
- //
- VmPtr->R[7] = EbcLLGetReturnValue ();
- VmPtr->Ip += Size;
- }
-}
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcSupport.h b/EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcSupport.h
deleted file mode 100644
index f6c929b..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/Ipf/EbcSupport.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EbcSupport.h
-
-Abstract:
-
- Definition of EBC Support function
-
-Revision History
-
---*/
-
-#ifndef _IPF_EBC_SUPPORT_H_
-#define _IPF_EBC_SUPPORT_H_
-
-#define VM_STACK_SIZE (1024 * 32)
-
-#define EBC_THUNK_SIZE 128
-#define STACK_REMAIN_SIZE (1024 * 4)
-
-//
-// For code execution, thunks must be aligned on 16-byte boundary
-//
-#define EBC_THUNK_ALIGNMENT 16
-
-//
-// Opcodes for IPF instructions. We'll need to hand-create thunk code (stuffing
-// bits) to insert a jump to the interpreter.
-//
-#define OPCODE_NOP (UINT64) 0x00008000000
-#define OPCODE_BR_COND_SPTK_FEW (UINT64) 0x00100000000
-#define OPCODE_MOV_BX_RX (UINT64) 0x00E00100000
-
-//
-// Opcode for MOVL instruction
-//
-#define MOVL_OPCODE 0x06
-
-VOID
-EbcAsmLLCALLEX (
- IN UINTN CallAddr,
- IN UINTN EbcSp
- );
-
-#endif
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/x64/EbcLowLevel.S b/EdkModulePkg/Universal/Ebc/Dxe/x64/EbcLowLevel.S
deleted file mode 100644
index d9f6386..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/x64/EbcLowLevel.S
+++ /dev/null
@@ -1,144 +0,0 @@
-#****************************************************************************
-#*
-#* Copyright (c) 2006, Intel Corporation
-#* All rights reserved. This program and the accompanying materials
-#* are licensed and made available under the terms and conditions of the BSD License
-#* which accompanies this distribution. The full text of the license may be found at
-#* http://opensource.org/licenses/bsd-license.php
-#*
-#* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#*
-#****************************************************************************
-#****************************************************************************
-# REV 1.0
-#****************************************************************************
-#
-# Rev Date Description
-# --- -------- ------------------------------------------------------------
-# 1.0 05/09/12 Initial creation of file.
-#
-#****************************************************************************
-
-#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-# This code provides low level routines that support the Virtual Machine
-# for option ROMs.
-#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
-#---------------------------------------------------------------------------
-# Equate files needed.
-#---------------------------------------------------------------------------
-
-#---------------------------------------------------------------------------
-##GenericPostSegment SEGMENT USE16
-#---------------------------------------------------------------------------
-
-#****************************************************************************
-# EbcLLCALLEX
-#
-# This function is called to execute an EBC CALLEX instruction.
-# This instruction requires that we thunk out to external native
-# code. For x64, we switch stacks, copy the arguments to the stack
-# and jump to the specified function.
-# On return, we restore the stack pointer to its original location.
-#
-# Destroys no working registers.
-#****************************************************************************
-.global _CopyMem;
-
-# VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
-.global _EbcLLCALLEXNative;
-_EbcLLCALLEXNative:
- push %rbp
- push %rbx
- mov %rsp, %rbp
- # Function prolog
-
- # Copy FuncAddr to a preserved register.
- mov %rcx, %rbx
-
- # Set stack pointer to new value
- sub %r8, %rdx
- sub %rsp, %r8
- mov %rsp, %rcx
- sub %rsp, 0x20
- call _CopyMem
- add %rsp, 0x20
-
- # Considering the worst case, load 4 potiential arguments
- # into registers.
- mov (%rsp), %rcx
- mov 8(%rsp), %rdx
- mov 10(%rsp), %r8
- mov 18(%rsp), %r9
-
- # Now call the external routine
- call *%rbx
-
- # Function epilog
- mov %rbp, %rsp
- pop %rbx
- pop %rbp
- ret
-
-
-# UINTN EbcLLGetEbcEntryPoint(VOID);
-# Routine Description:
-# The VM thunk code stuffs an EBC entry point into a processor
-# register. Since we can't use inline assembly to get it from
-# the interpreter C code, stuff it into the return value
-# register and return.
-#
-# Arguments:
-# None.
-#
-# Returns:
-# The contents of the register in which the entry point is passed.
-#
-.global _EbcLLGetEbcEntryPoint;
-_EbcLLGetEbcEntryPoint:
- ret
-
-#/*++
-#
-#Routine Description:
-#
-# Return the caller's value of the stack pointer.
-#
-#Arguments:
-#
-# None.
-#
-#Returns:
-#
-# The current value of the stack pointer for the caller. We
-# adjust it by 4 here because when they called us, the return address
-# is put on the stack, thereby lowering it by 4 bytes.
-#
-#--*/
-
-# UINTN EbcLLGetStackPointer()
-.global _EbcLLGetStackPointer;
-_EbcLLGetStackPointer:
- mov %rsp, %rax
- # Stack adjusted by this much when we were called,
- # For this function, it's 4.
- add $4, %rax
- ret
-
-.global _EbcLLGetReturnValue;
-_EbcLLGetReturnValue:
-# UINT64 EbcLLGetReturnValue(VOID);
-# Routine Description:
-# When EBC calls native, on return the VM has to stuff the return
-# value into a VM register. It's assumed here that the value is still
-# in the register, so simply return and the caller should get the
-# return result properly.
-#
-# Arguments:
-# None.
-#
-# Returns:
-# The unmodified value returned by the native code.
-#
- ret
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/x64/EbcLowLevel.asm b/EdkModulePkg/Universal/Ebc/Dxe/x64/EbcLowLevel.asm
deleted file mode 100644
index 7b59e93..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/x64/EbcLowLevel.asm
+++ /dev/null
@@ -1,154 +0,0 @@
- page ,132
- title VM ASSEMBLY LANGUAGE ROUTINES
-;****************************************************************************
-;*
-;* Copyright (c) 2006, Intel Corporation
-;* All rights reserved. This program and the accompanying materials
-;* are licensed and made available under the terms and conditions of the BSD License
-;* which accompanies this distribution. The full text of the license may be found at
-;* http://opensource.org/licenses/bsd-license.php
-;*
-;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;*
-;****************************************************************************
-;****************************************************************************
-; REV 1.0
-;****************************************************************************
-;
-; Rev Date Description
-; --- -------- ------------------------------------------------------------
-; 1.0 05/09/12 Initial creation of file.
-;
-;****************************************************************************
-
-;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-; This code provides low level routines that support the Virtual Machine
-; for option ROMs.
-;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
-;---------------------------------------------------------------------------
-; Equate files needed.
-;---------------------------------------------------------------------------
-
-text SEGMENT
-
-;---------------------------------------------------------------------------
-;;GenericPostSegment SEGMENT USE16
-;---------------------------------------------------------------------------
-
-;****************************************************************************
-; EbcLLCALLEX
-;
-; This function is called to execute an EBC CALLEX instruction.
-; This instruction requires that we thunk out to external native
-; code. For x64, we switch stacks, copy the arguments to the stack
-; and jump to the specified function.
-; On return, we restore the stack pointer to its original location.
-;
-; Destroys no working registers.
-;****************************************************************************
-; VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
-
-CopyMem PROTO Destination:PTR DWORD, Source:PTR DWORD, Count:DWORD
-
-
-EbcLLCALLEXNative PROC NEAR PUBLIC
- push rbp
- push rbx
- mov rbp, rsp
- ; Function prolog
-
- ; Copy FuncAddr to a preserved register.
- mov rbx, rcx
-
- ; Set stack pointer to new value
- sub r8, rdx
- sub rsp, r8
- mov rcx, rsp
- sub rsp, 20h
- call CopyMem
- add rsp, 20h
-
- ; Considering the worst case, load 4 potiential arguments
- ; into registers.
- mov rcx, qword ptr [rsp]
- mov rdx, qword ptr [rsp+8h]
- mov r8, qword ptr [rsp+10h]
- mov r9, qword ptr [rsp+18h]
-
- ; Now call the external routine
- call rbx
-
- ; Function epilog
- mov rsp, rbp
- pop rbx
- pop rbp
- ret
-EbcLLCALLEXNative ENDP
-
-
-; UINTN EbcLLGetEbcEntryPoint(VOID);
-; Routine Description:
-; The VM thunk code stuffs an EBC entry point into a processor
-; register. Since we can't use inline assembly to get it from
-; the interpreter C code, stuff it into the return value
-; register and return.
-;
-; Arguments:
-; None.
-;
-; Returns:
-; The contents of the register in which the entry point is passed.
-;
-EbcLLGetEbcEntryPoint PROC NEAR PUBLIC
- ret
-EbcLLGetEbcEntryPoint ENDP
-
-;/*++
-;
-;Routine Description:
-;
-; Return the caller's value of the stack pointer.
-;
-;Arguments:
-;
-; None.
-;
-;Returns:
-;
-; The current value of the stack pointer for the caller. We
-; adjust it by 4 here because when they called us, the return address
-; is put on the stack, thereby lowering it by 4 bytes.
-;
-;--*/
-
-; UINTN EbcLLGetStackPointer()
-EbcLLGetStackPointer PROC NEAR PUBLIC
- mov rax, rsp ; get current stack pointer
- ; Stack adjusted by this much when we were called,
- ; For this function, it's 4.
- add rax, 4
- ret
-EbcLLGetStackPointer ENDP
-
-; UINT64 EbcLLGetReturnValue(VOID);
-; Routine Description:
-; When EBC calls native, on return the VM has to stuff the return
-; value into a VM register. It's assumed here that the value is still
-; in the register, so simply return and the caller should get the
-; return result properly.
-;
-; Arguments:
-; None.
-;
-; Returns:
-; The unmodified value returned by the native code.
-;
-EbcLLGetReturnValue PROC NEAR PUBLIC
- ret
-EbcLLGetReturnValue ENDP
-
-text ENDS
-END
-
diff --git a/EdkModulePkg/Universal/Ebc/Dxe/x64/EbcSupport.c b/EdkModulePkg/Universal/Ebc/Dxe/x64/EbcSupport.c
deleted file mode 100644
index bec82d6..0000000
--- a/EdkModulePkg/Universal/Ebc/Dxe/x64/EbcSupport.c
+++ /dev/null
@@ -1,619 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EbcSupport.c
-
-Abstract:
-
- This module contains EBC support routines that are customized based on
- the target x64 processor.
-
---*/
-
-#include "EbcInt.h"
-#include "EbcExecute.h"
-
-//
-// NOTE: This is the stack size allocated for the interpreter
-// when it executes an EBC image. The requirements can change
-// based on whether or not a debugger is present, and other
-// platform-specific configurations.
-//
-#define VM_STACK_SIZE (1024 * 8)
-#define EBC_THUNK_SIZE 64
-
-#define STACK_REMAIN_SIZE (1024 * 4)
-
-STATIC
-VOID
-PushU64 (
- VM_CONTEXT *VmPtr,
- UINT64 Arg
- )
-/*++
-
-Routine Description:
-
- Push a 64 bit unsigned value to the VM stack.
-
-Arguments:
-
- VmPtr - The pointer to current VM context.
- Arg - The value to be pushed
-
-Returns:
-
- VOID
-
---*/
-{
- //
- // Advance the VM stack down, and then copy the argument to the stack.
- // Hope it's aligned.
- //
- VmPtr->R[0] -= sizeof (UINT64);
- *(UINT64 *) VmPtr->R[0] = Arg;
- return;
-}
-
-STATIC
-UINT64
-EbcInterpret (
- UINTN Arg1,
- UINTN Arg2,
- UINTN Arg3,
- UINTN Arg4,
- UINTN Arg5,
- UINTN Arg6,
- UINTN Arg7,
- UINTN Arg8,
- UINTN Arg9,
- UINTN Arg10,
- UINTN Arg11,
- UINTN Arg12,
- UINTN Arg13,
- UINTN Arg14,
- UINTN Arg15,
- UINTN Arg16
- )
-/*++
-
-Routine Description:
-
- Begin executing an EBC image. The address of the entry point is passed
- in via a processor register, so we'll need to make a call to get the
- value.
-
-Arguments:
-
- This is a thunk function. Microsoft x64 compiler only provide fast_call
- calling convention, so the first four arguments are passed by rcx, rdx,
- r8, and r9, while other arguments are passed in stack.
-
-Returns:
-
- The value returned by the EBC application we're going to run.
-
---*/
-{
- //
- // Create a new VM context on the stack
- //
- VM_CONTEXT VmContext;
- UINTN Addr;
- EFI_STATUS Status;
- UINTN StackIndex;
-
- //
- // Get the EBC entry point from the processor register.
- // Don't call any function before getting the EBC entry
- // point because this will collab the return register.
- //
- Addr = EbcLLGetEbcEntryPoint ();
-
- //
- // Now clear out our context
- //
- ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
-
- //
- // Set the VM instruction pointer to the correct location in memory.
- //
- VmContext.Ip = (VMIP) Addr;
-
- //
- // Initialize the stack pointer for the EBC. Get the current system stack
- // pointer and adjust it down by the max needed for the interpreter.
- //
- Addr = EbcLLGetStackPointer ();
-
- //
- // Adjust the VM's stack pointer down.
- //
-
- Status = GetEBCStack((EFI_HANDLE)(UINTN)-1, &VmContext.StackPool, &StackIndex);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
- VmContext.R[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
- VmContext.HighStackBottom = (UINTN) VmContext.R[0];
- VmContext.R[0] -= sizeof (UINTN);
-
- //
- // Align the stack on a natural boundary.
- //
- VmContext.R[0] &= ~(sizeof (UINTN) - 1);
-
- //
- // Put a magic value in the stack gap, then adjust down again.
- //
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) VM_STACK_KEY_VALUE;
- VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];
-
- //
- // The stack upper to LowStackTop is belong to the VM.
- //
- VmContext.LowStackTop = (UINTN) VmContext.R[0];
-
- //
- // For the worst case, assume there are 4 arguments passed in registers, store
- // them to VM's stack.
- //
- PushU64 (&VmContext, (UINT64) Arg16);
- PushU64 (&VmContext, (UINT64) Arg15);
- PushU64 (&VmContext, (UINT64) Arg14);
- PushU64 (&VmContext, (UINT64) Arg13);
- PushU64 (&VmContext, (UINT64) Arg12);
- PushU64 (&VmContext, (UINT64) Arg11);
- PushU64 (&VmContext, (UINT64) Arg10);
- PushU64 (&VmContext, (UINT64) Arg9);
- PushU64 (&VmContext, (UINT64) Arg8);
- PushU64 (&VmContext, (UINT64) Arg7);
- PushU64 (&VmContext, (UINT64) Arg6);
- PushU64 (&VmContext, (UINT64) Arg5);
- PushU64 (&VmContext, (UINT64) Arg4);
- PushU64 (&VmContext, (UINT64) Arg3);
- PushU64 (&VmContext, (UINT64) Arg2);
- PushU64 (&VmContext, (UINT64) Arg1);
-
- //
- // Interpreter assumes 64-bit return address is pushed on the stack.
- // The x64 does not do this so pad the stack accordingly.
- //
- PushU64 (&VmContext, (UINT64) 0);
- PushU64 (&VmContext, (UINT64) 0x1234567887654321ULL);
-
- //
- // For x64, this is where we say our return address is
- //
- VmContext.StackRetAddr = (UINT64) VmContext.R[0];
-
- //
- // We need to keep track of where the EBC stack starts. This way, if the EBC
- // accesses any stack variables above its initial stack setting, then we know
- // it's accessing variables passed into it, which means the data is on the
- // VM's stack.
- // When we're called, on the stack (high to low) we have the parameters, the
- // return address, then the saved ebp. Save the pointer to the return address.
- // EBC code knows that's there, so should look above it for function parameters.
- // The offset is the size of locals (VMContext + Addr + saved ebp).
- // Note that the interpreter assumes there is a 16 bytes of return address on
- // the stack too, so adjust accordingly.
- // VmContext.HighStackBottom = (UINTN)(Addr + sizeof (VmContext) + sizeof (Addr));
- //
-
- //
- // Begin executing the EBC code
- //
- EbcExecute (&VmContext);
-
- //
- // Return the value in R[7] unless there was an error
- //
- ReturnEBCStack(StackIndex);
- return (UINT64) VmContext.R[7];
-}
-
-STATIC
-UINT64
-ExecuteEbcImageEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Begin executing an EBC image. The address of the entry point is passed
- in via a processor register, so we'll need to make a call to get the
- value.
-
-Arguments:
-
- ImageHandle - image handle for the EBC application we're executing
- SystemTable - standard system table passed into an driver's entry point
-
-Returns:
-
- The value returned by the EBC application we're going to run.
-
---*/
-{
- //
- // Create a new VM context on the stack
- //
- VM_CONTEXT VmContext;
- UINTN Addr;
- EFI_STATUS Status;
- UINTN StackIndex;
-
- //
- // Get the EBC entry point from the processor register. Make sure you don't
- // call any functions before this or you could mess up the register the
- // entry point is passed in.
- //
- Addr = EbcLLGetEbcEntryPoint ();
-
- //
- // Now clear out our context
- //
- ZeroMem ((VOID *) &VmContext, sizeof (VM_CONTEXT));
-
- //
- // Save the image handle so we can track the thunks created for this image
- //
- VmContext.ImageHandle = ImageHandle;
- VmContext.SystemTable = SystemTable;
-
- //
- // Set the VM instruction pointer to the correct location in memory.
- //
- VmContext.Ip = (VMIP) Addr;
-
- //
- // Initialize the stack pointer for the EBC. Get the current system stack
- // pointer and adjust it down by the max needed for the interpreter.
- //
- Addr = EbcLLGetStackPointer ();
-
- Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
- VmContext.R[0] = (UINT64) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
- VmContext.HighStackBottom = (UINTN) VmContext.R[0];
- VmContext.R[0] -= sizeof (UINTN);
-
-
- //
- // Put a magic value in the stack gap, then adjust down again
- //
- *(UINTN *) (UINTN) (VmContext.R[0]) = (UINTN) VM_STACK_KEY_VALUE;
- VmContext.StackMagicPtr = (UINTN *) (UINTN) VmContext.R[0];
-
- //
- // Align the stack on a natural boundary
- VmContext.R[0] &= ~(sizeof(UINTN) - 1);
- //
- VmContext.LowStackTop = (UINTN) VmContext.R[0];
-
- //
- // Simply copy the image handle and system table onto the EBC stack.
- // Greatly simplifies things by not having to spill the args.
- //
- PushU64 (&VmContext, (UINT64) SystemTable);
- PushU64 (&VmContext, (UINT64) ImageHandle);
-
- //
- // VM pushes 16-bytes for return address. Simulate that here.
- //
- PushU64 (&VmContext, (UINT64) 0);
- PushU64 (&VmContext, (UINT64) 0x1234567887654321ULL);
-
- //
- // For x64, this is where we say our return address is
- //
- VmContext.StackRetAddr = (UINT64) VmContext.R[0];
-
- //
- // Entry function needn't access high stack context, simply
- // put the stack pointer here.
- //
-
- //
- // Begin executing the EBC code
- //
- EbcExecute (&VmContext);
-
- //
- // Return the value in R[7] unless there was an error
- //
- ReturnEBCStack(StackIndex);
- return (UINT64) VmContext.R[7];
-}
-
-EFI_STATUS
-EbcCreateThunks (
- IN EFI_HANDLE ImageHandle,
- IN VOID *EbcEntryPoint,
- OUT VOID **Thunk,
- IN UINT32 Flags
- )
-/*++
-
-Routine Description:
-
- Create an IA32 thunk for the given EBC entry point.
-
-Arguments:
-
- ImageHandle - Handle of image for which this thunk is being created
- EbcEntryPoint - Address of the EBC code that the thunk is to call
- Thunk - Returned thunk we create here
-
-Returns:
-
- Standard EFI status.
-
---*/
-{
- UINT8 *Ptr;
- UINT8 *ThunkBase;
- UINT32 I;
- UINT64 Addr;
- INT32 Size;
- INT32 ThunkSize;
-
- //
- // Check alignment of pointer to EBC code
- //
- if ((UINT32) (UINTN) EbcEntryPoint & 0x01) {
- return EFI_INVALID_PARAMETER;
- }
-
- Size = EBC_THUNK_SIZE;
- ThunkSize = Size;
-
- Ptr = AllocatePool (Size);
-
- if (Ptr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Print(L"Allocate TH: 0x%X\n", (UINT32)Ptr);
- //
- // Save the start address so we can add a pointer to it to a list later.
- //
- ThunkBase = Ptr;
-
- //
- // Give them the address of our buffer we're going to fix up
- //
- *Thunk = (VOID *) Ptr;
-
- //
- // Add a magic code here to help the VM recognize the thunk..
- // mov rax, ca112ebccall2ebch => 48 B8 BC 2E 11 CA BC 2E 11 CA
- //
- *Ptr = 0x48;
- Ptr++;
- Size--;
- *Ptr = 0xB8;
- Ptr++;
- Size--;
- Addr = (UINT64) 0xCA112EBCCA112EBCULL;
- for (I = 0; I < sizeof (Addr); I++) {
- *Ptr = (UINT8) (UINTN) Addr;
- Addr >>= 8;
- Ptr++;
- Size--;
- }
-
- //
- // Add code bytes to load up a processor register with the EBC entry point.
- // mov rax, 123456789abcdef0h => 48 B8 F0 DE BC 9A 78 56 34 12
- // The first 8 bytes of the thunk entry is the address of the EBC
- // entry point.
- //
- *Ptr = 0x48;
- Ptr++;
- Size--;
- *Ptr = 0xB8;
- Ptr++;
- Size--;
- Addr = (UINT64) EbcEntryPoint;
- for (I = 0; I < sizeof (Addr); I++) {
- *Ptr = (UINT8) (UINTN) Addr;
- Addr >>= 8;
- Ptr++;
- Size--;
- }
-
- //
- // Stick in a load of ecx with the address of appropriate VM function.
- // Using r11 because it's a volatile register and won't be used in this
- // point.
- // mov r11 123456789abcdef0h => 49 BB F0 DE BC 9A 78 56 34 12
- //
- if (Flags & FLAG_THUNK_ENTRY_POINT) {
- Addr = (UINTN) ExecuteEbcImageEntryPoint;
- } else {
- Addr = (UINTN) EbcInterpret;
- }
-
- //
- // mov r11 Addr => 0x49 0xBB
- //
- *Ptr = 0x49;
- Ptr++;
- Size--;
- *Ptr = 0xBB;
- Ptr++;
- Size--;
- for (I = 0; I < sizeof (Addr); I++) {
- *Ptr = (UINT8) Addr;
- Addr >>= 8;
- Ptr++;
- Size--;
- }
- //
- // Stick in jump opcode bytes for jmp r11 => 0x41 0xFF 0xE3
- //
- *Ptr = 0x41;
- Ptr++;
- Size--;
- *Ptr = 0xFF;
- Ptr++;
- Size--;
- *Ptr = 0xE3;
- Size--;
-
- //
- // Double check that our defined size is ok (application error)
- //
- if (Size < 0) {
- ASSERT (FALSE);
- return EFI_BUFFER_TOO_SMALL;
- }
- //
- // Add the thunk to the list for this image. Do this last since the add
- // function flushes the cache for us.
- //
- EbcAddImageThunk (ImageHandle, (VOID *) ThunkBase, ThunkSize);
-
- return EFI_SUCCESS;
-}
-
-VOID
-EbcLLCALLEX (
- IN VM_CONTEXT *VmPtr,
- IN UINTN FuncAddr,
- IN UINTN NewStackPointer,
- IN VOID *FramePtr,
- IN UINT8 Size
- )
-/*++
-
-Routine Description:
-
- This function is called to execute an EBC CALLEX instruction.
- The function check the callee's content to see whether it is common native
- code or a thunk to another piece of EBC code.
- If the callee is common native code, use EbcLLCAllEXASM to manipulate,
- otherwise, set the VM->IP to target EBC code directly to avoid another VM
- be startup which cost time and stack space.
-
-Arguments:
-
- VmPtr - Pointer to a VM context.
- FuncAddr - Callee's address
- NewStackPointer - New stack pointer after the call
- FramePtr - New frame pointer after the call
- Size - The size of call instruction
-
-Returns:
-
- None.
-
---*/
-{
- UINTN IsThunk;
- UINTN TargetEbcAddr;
-
- IsThunk = 1;
- TargetEbcAddr = 0;
-
- //
- // Processor specific code to check whether the callee is a thunk to EBC.
- //
- if (*((UINT8 *)FuncAddr) != 0x48) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 1) != 0xB8) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 2) != 0xBC) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 3) != 0x2E) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 4) != 0x11) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 5) != 0xCA) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 6) != 0xBC) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 7) != 0x2E) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 8) != 0x11) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 9) != 0xCA) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 10) != 0x48) {
- IsThunk = 0;
- goto Action;
- }
- if (*((UINT8 *)FuncAddr + 11) != 0xB8) {
- IsThunk = 0;
- goto Action;
- }
-
- CopyMem (&TargetEbcAddr, (UINT8 *)FuncAddr + 12, 8);
-
-Action:
- if (IsThunk == 1){
- //
- // The callee is a thunk to EBC, adjust the stack pointer down 16 bytes and
- // put our return address and frame pointer on the VM stack.
- // Then set the VM's IP to new EBC code.
- //
- VmPtr->R[0] -= 8;
- VmWriteMemN (VmPtr, (UINTN) VmPtr->R[0], (UINTN) FramePtr);
- VmPtr->FramePtr = (VOID *) (UINTN) VmPtr->R[0];
- VmPtr->R[0] -= 8;
- VmWriteMem64 (VmPtr, (UINTN) VmPtr->R[0], (UINT64) (VmPtr->Ip + Size));
-
- VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
- } else {
- //
- // The callee is not a thunk to EBC, call native code.
- //
- EbcLLCALLEXNative (FuncAddr, NewStackPointer, FramePtr);
-
- //
- // Get return value and advance the IP.
- //
- VmPtr->R[7] = EbcLLGetReturnValue ();
- VmPtr->Ip += Size;
- }
-}
-
diff --git a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.c b/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.c
deleted file mode 100644
index f56cf04..0000000
--- a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.c
+++ /dev/null
@@ -1,849 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EmuVariable.c
-
-Abstract:
-
-Revision History
-
---*/
-
-#include "Variable.h"
-
-//
-// Don't use module globals after the SetVirtualAddress map is signaled
-//
-ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;
-
-//
-// This is a temperary function which will be removed
-// when EfiAcquireLock in UefiLib can handle the
-// the call in UEFI Runtimer driver in RT phase.
-//
-STATIC
-VOID
-AcquireLockOnlyAtBootTime (
- IN EFI_LOCK *Lock
- )
-{
- if (!EfiAtRuntime ()) {
- EfiAcquireLock (Lock);
- }
-}
-
-//
-// This is a temperary function which will be removed
-// when EfiAcquireLock in UefiLib can handle the
-// the call in UEFI Runtimer driver in RT phase.
-//
-STATIC
-VOID
-ReleaseLockOnlyAtBootTime (
- IN EFI_LOCK *Lock
- )
-{
- if (!EfiAtRuntime ()) {
- EfiReleaseLock (Lock);
- }
-}
-
-STATIC
-UINT8 *
-EFIAPI
-GetVariableDataPtr (
- IN VARIABLE_HEADER *Variable
- )
-/*++
-
-Routine Description:
-
- This code gets the pointer to the variable data.
-
-Arguments:
-
- Variable Pointer to the Variable Header.
-
-Returns:
-
- UINT8* Pointer to Variable Data
-
---*/
-{
- if (Variable->StartId != VARIABLE_DATA) {
- return NULL;
- }
- //
- // Be careful about pad size for alignment
- //
- return (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (Variable) + Variable->NameSize + GET_PAD_SIZE (Variable->NameSize));
-}
-
-STATIC
-VARIABLE_HEADER *
-EFIAPI
-GetNextVariablePtr (
- IN VARIABLE_HEADER *Variable
- )
-/*++
-
-Routine Description:
-
- This code gets the pointer to the next variable header.
-
-Arguments:
-
- Variable Pointer to the Variable Header.
-
-Returns:
-
- VARIABLE_HEADER* Pointer to next variable header.
-
---*/
-{
- VARIABLE_HEADER *VarHeader;
-
- if (Variable->StartId != VARIABLE_DATA) {
- return NULL;
- }
- //
- // Be careful about pad size for alignment
- //
- VarHeader = (VARIABLE_HEADER *) (GetVariableDataPtr (Variable) + Variable->DataSize + GET_PAD_SIZE (Variable->DataSize));
-
- if (VarHeader->StartId != VARIABLE_DATA ||
- (sizeof (VARIABLE_HEADER) + VarHeader->DataSize + VarHeader->NameSize) > MAX_VARIABLE_SIZE
- ) {
- return NULL;
- }
-
- return VarHeader;
-}
-
-STATIC
-VARIABLE_HEADER *
-EFIAPI
-GetEndPointer (
- IN VARIABLE_STORE_HEADER *VolHeader
- )
-/*++
-
-Routine Description:
-
- This code gets the pointer to the last variable memory pointer byte
-
-Arguments:
-
- Variable Pointer to the Variable Header.
-
-Returns:
-
- VARIABLE_HEADER* Pointer to last unavailable Variable Header
-
---*/
-{
- //
- // The end of variable store
- //
- return (VARIABLE_HEADER *) ((UINTN) VolHeader + VolHeader->Size);
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-FindVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT VARIABLE_POINTER_TRACK *PtrTrack,
- IN VARIABLE_GLOBAL *Global
- )
-/*++
-
-Routine Description:
-
- This code finds variable in storage blocks (Volatile or Non-Volatile)
-
-Arguments:
-
- VariableName Name of the variable to be found
- VendorGuid Vendor GUID to be found.
- PtrTrack Variable Track Pointer structure that contains
- Variable Information.
- Contains the pointer of Variable header.
- Global VARIABLE_GLOBAL pointer
-
-Returns:
-
- EFI STATUS
-
---*/
-{
- VARIABLE_HEADER *Variable[2];
- VARIABLE_STORE_HEADER *VariableStoreHeader[2];
- UINTN Index;
-
- //
- // We aquire the lock at the entry of FindVariable as GetVariable, GetNextVariableName
- // SetVariable all call FindVariable at entry point. Please move "Aquire Lock" to
- // the correct places if this assumption does not hold TRUE anymore.
- //
- AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
-
- //
- // 0: Non-Volatile, 1: Volatile
- //
- VariableStoreHeader[0] = (VARIABLE_STORE_HEADER *) ((UINTN) Global->NonVolatileVariableBase);
- VariableStoreHeader[1] = (VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase);
-
- //
- // Start Pointers for the variable.
- // Actual Data Pointer where data can be written.
- //
- Variable[0] = (VARIABLE_HEADER *) (VariableStoreHeader[0] + 1);
- Variable[1] = (VARIABLE_HEADER *) (VariableStoreHeader[1] + 1);
-
- if (VariableName[0] != 0 && VendorGuid == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Find the variable by walk through non-volatile and volatile variable store
- //
- for (Index = 0; Index < 2; Index++) {
- PtrTrack->StartPtr = (VARIABLE_HEADER *) (VariableStoreHeader[Index] + 1);
- PtrTrack->EndPtr = GetEndPointer (VariableStoreHeader[Index]);
-
- while ((Variable[Index] != NULL) && (Variable[Index] <= GetEndPointer (VariableStoreHeader[Index]))) {
- if (Variable[Index]->StartId == VARIABLE_DATA && Variable[Index]->State == VAR_ADDED) {
- if (!(EfiAtRuntime () && !(Variable[Index]->Attributes & EFI_VARIABLE_RUNTIME_ACCESS))) {
- if (VariableName[0] == 0) {
- PtrTrack->CurrPtr = Variable[Index];
- PtrTrack->Volatile = (BOOLEAN) Index;
- return EFI_SUCCESS;
- } else {
- if (CompareGuid (VendorGuid, &Variable[Index]->VendorGuid)) {
- if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable[Index]), Variable[Index]->NameSize)) {
- PtrTrack->CurrPtr = Variable[Index];
- PtrTrack->Volatile = (BOOLEAN) Index;
- return EFI_SUCCESS;
- }
- }
- }
- }
- }
-
- Variable[Index] = GetNextVariablePtr (Variable[Index]);
- }
- }
- PtrTrack->CurrPtr = NULL;
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-EFIAPI
-GetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data,
- IN VARIABLE_GLOBAL * Global,
- IN UINT32 Instance
- )
-/*++
-
-Routine Description:
-
- This code finds variable in storage blocks (Volatile or Non-Volatile)
-
-Arguments:
-
- VariableName Name of Variable to be found
- VendorGuid Variable vendor GUID
- Attributes OPTIONAL Attribute value of the variable found
- DataSize Size of Data found. If size is less than the
- data, this value contains the required size.
- Data Data pointer
- Global Pointer to VARIABLE_GLOBAL structure
- Instance Instance of the Firmware Volume.
-
-Returns:
-
- EFI STATUS
-
---*/
-{
- VARIABLE_POINTER_TRACK Variable;
- UINTN VarDataSize;
- EFI_STATUS Status;
-
- if (VariableName == NULL || VendorGuid == NULL || DataSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Find existing variable
- //
- Status = FindVariable (VariableName, VendorGuid, &Variable, Global);
-
- if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Get data size
- //
- VarDataSize = Variable.CurrPtr->DataSize;
- if (*DataSize >= VarDataSize) {
- if (Data == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr), VarDataSize);
- if (Attributes != NULL) {
- *Attributes = Variable.CurrPtr->Attributes;
- }
-
- *DataSize = VarDataSize;
- Status = EFI_SUCCESS;
- goto Done;
- } else {
- *DataSize = VarDataSize;
- Status = EFI_BUFFER_TOO_SMALL;
- goto Done;
- }
-
-Done:
- ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-GetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid,
- IN VARIABLE_GLOBAL *Global,
- IN UINT32 Instance
- )
-/*++
-
-Routine Description:
-
- This code Finds the Next available variable
-
-Arguments:
-
- VariableNameSize Size of the variable
- VariableName Pointer to variable name
- VendorGuid Variable Vendor Guid
- Global VARIABLE_GLOBAL structure pointer.
- Instance FV instance
-
-Returns:
-
- EFI STATUS
-
---*/
-{
- VARIABLE_POINTER_TRACK Variable;
- UINTN VarNameSize;
- EFI_STATUS Status;
-
- if (VariableNameSize == NULL || VariableName == NULL || VendorGuid == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = FindVariable (VariableName, VendorGuid, &Variable, Global);
-
- if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) {
- goto Done;
- }
-
- while (TRUE) {
- if (VariableName[0] != 0) {
- //
- // If variable name is not NULL, get next variable
- //
- Variable.CurrPtr = GetNextVariablePtr (Variable.CurrPtr);
- }
- //
- // If both volatile and non-volatile variable store are parsed,
- // return not found
- //
- if (Variable.CurrPtr >= Variable.EndPtr || Variable.CurrPtr == NULL) {
- Variable.Volatile = (BOOLEAN) (Variable.Volatile ^ ((BOOLEAN) 0x1));
- if (Variable.Volatile) {
- Variable.StartPtr = (VARIABLE_HEADER *) ((UINTN) (Global->VolatileVariableBase + sizeof (VARIABLE_STORE_HEADER)));
- Variable.EndPtr = (VARIABLE_HEADER *) GetEndPointer ((VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase));
- } else {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- Variable.CurrPtr = Variable.StartPtr;
- if (Variable.CurrPtr->StartId != VARIABLE_DATA) {
- continue;
- }
- }
- //
- // Variable is found
- //
- if (Variable.CurrPtr->StartId == VARIABLE_DATA && Variable.CurrPtr->State == VAR_ADDED) {
- if (!(EfiAtRuntime () && !(Variable.CurrPtr->Attributes & EFI_VARIABLE_RUNTIME_ACCESS))) {
- VarNameSize = Variable.CurrPtr->NameSize;
- if (VarNameSize <= *VariableNameSize) {
- CopyMem (
- VariableName,
- GET_VARIABLE_NAME_PTR (Variable.CurrPtr),
- VarNameSize
- );
- CopyMem (
- VendorGuid,
- &Variable.CurrPtr->VendorGuid,
- sizeof (EFI_GUID)
- );
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_BUFFER_TOO_SMALL;
- }
-
- *VariableNameSize = VarNameSize;
- goto Done;
- }
- }
- }
-
-Done:
- ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock);
- return Status;
-
-}
-
-EFI_STATUS
-EFIAPI
-SetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data,
- IN VARIABLE_GLOBAL *Global,
- IN UINTN *VolatileOffset,
- IN UINTN *NonVolatileOffset,
- IN UINT32 Instance
- )
-/*++
-
-Routine Description:
-
- This code sets variable in storage blocks (Volatile or Non-Volatile)
-
-Arguments:
-
- VariableName Name of Variable to be found
- VendorGuid Variable vendor GUID
- Attributes Attribute value of the variable found
- DataSize Size of Data found. If size is less than the
- data, this value contains the required size.
- Data Data pointer
- Global Pointer to VARIABLE_GLOBAL structure
- VolatileOffset The offset of last volatile variable
- NonVolatileOffset The offset of last non-volatile variable
- Instance Instance of the Firmware Volume.
-
-Returns:
-
- EFI STATUS
-
---*/
-{
- VARIABLE_POINTER_TRACK Variable;
- EFI_STATUS Status;
- VARIABLE_HEADER *NextVariable;
- UINTN VarNameSize;
- UINTN VarNameOffset;
- UINTN VarDataOffset;
- UINTN VarSize;
-
- if (VariableName == NULL || VariableName[0] == 0 || VendorGuid == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = FindVariable (VariableName, VendorGuid, &Variable, Global);
-
- if (Status == EFI_INVALID_PARAMETER) {
- goto Done;
- } else if (!EFI_ERROR (Status) && Variable.Volatile && EfiAtRuntime()) {
- //
- // If EfiAtRuntime and the variable is Volatile and Runtime Access,
- // the volatile is ReadOnly, and SetVariable should be aborted and
- // return EFI_WRITE_PROTECTED.
- //
- Status = EFI_WRITE_PROTECTED;
- goto Done;
- } else if (sizeof (VARIABLE_HEADER) + (StrSize (VariableName) + DataSize) > MAX_VARIABLE_SIZE) {
- //
- // The size of the VariableName, including the Unicode Null in bytes plus
- // the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.
- //
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- } else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS
- ) {
- //
- // Make sure if runtime bit is set, boot service bit is set also
- //
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- } else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {
- //
- // Runtime but Attribute is not Runtime
- //
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- } else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_NON_VOLATILE)) {
- //
- // Cannot set volatile variable in Runtime
- //
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- } else if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) {
- //
- // Setting a data variable with no access, or zero DataSize attributes
- // specified causes it to be deleted.
- //
- if (!EFI_ERROR (Status)) {
- Variable.CurrPtr->State &= VAR_DELETED;
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- Status = EFI_NOT_FOUND;
- goto Done;
- } else {
- if (!EFI_ERROR (Status)) {
- //
- // If the variable is marked valid and the same data has been passed in
- // then return to the caller immediately.
- //
- if (Variable.CurrPtr->DataSize == DataSize &&
- !CompareMem (Data, GetVariableDataPtr (Variable.CurrPtr), DataSize)
- ) {
- Status = EFI_SUCCESS;
- goto Done;
- } else if (Variable.CurrPtr->State == VAR_ADDED) {
- //
- // Mark the old variable as in delete transition
- //
- Variable.CurrPtr->State &= VAR_IN_DELETED_TRANSITION;
- }
- }
- //
- // Create a new variable and copy the data.
- //
- VarNameOffset = sizeof (VARIABLE_HEADER);
- VarNameSize = StrSize (VariableName);
- VarDataOffset = VarNameOffset + VarNameSize + GET_PAD_SIZE (VarNameSize);
- VarSize = VarDataOffset + DataSize + GET_PAD_SIZE (DataSize);
-
- if (Attributes & EFI_VARIABLE_NON_VOLATILE) {
- if ((UINT32) (VarSize +*NonVolatileOffset) >
- ((VARIABLE_STORE_HEADER *) ((UINTN) (Global->NonVolatileVariableBase)))->Size
- ) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- NextVariable = (VARIABLE_HEADER *) (UINT8 *) (*NonVolatileOffset + (UINTN) Global->NonVolatileVariableBase);
- *NonVolatileOffset = *NonVolatileOffset + VarSize;
- } else {
- if (EfiAtRuntime ()) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if ((UINT32) (VarSize +*VolatileOffset) >
- ((VARIABLE_STORE_HEADER *) ((UINTN) (Global->VolatileVariableBase)))->Size
- ) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- NextVariable = (VARIABLE_HEADER *) (UINT8 *) (*VolatileOffset + (UINTN) Global->VolatileVariableBase);
- *VolatileOffset = *VolatileOffset + VarSize;
- }
-
- NextVariable->StartId = VARIABLE_DATA;
- NextVariable->Attributes = Attributes;
- NextVariable->State = VAR_ADDED;
- NextVariable->Reserved = 0;
-
- //
- // There will be pad bytes after Data, the NextVariable->NameSize and
- // NextVariable->NameSize should not include pad size so that variable
- // service can get actual size in GetVariable
- //
- NextVariable->NameSize = (UINT32)VarNameSize;
- NextVariable->DataSize = (UINT32)DataSize;
-
- CopyMem (&NextVariable->VendorGuid, VendorGuid, sizeof (EFI_GUID));
- CopyMem (
- (UINT8 *) ((UINTN) NextVariable + VarNameOffset),
- VariableName,
- VarNameSize
- );
- CopyMem (
- (UINT8 *) ((UINTN) NextVariable + VarDataOffset),
- Data,
- DataSize
- );
-
- //
- // Mark the old variable as deleted
- //
- if (!EFI_ERROR (Status)) {
- Variable.CurrPtr->State &= VAR_DELETED;
- }
- }
-
- Status = EFI_SUCCESS;
-Done:
- ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-QueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize,
- IN VARIABLE_GLOBAL *Global,
- IN UINT32 Instance
- )
-/*++
-
-Routine Description:
-
- This code returns information about the EFI variables.
-
-Arguments:
-
- Attributes Attributes bitmask to specify the type of variables
- on which to return information.
- MaximumVariableStorageSize Pointer to the maximum size of the storage space available
- for the EFI variables associated with the attributes specified.
- RemainingVariableStorageSize Pointer to the remaining size of the storage space available
- for the EFI variables associated with the attributes specified.
- MaximumVariableSize Pointer to the maximum size of the individual EFI variables
- associated with the attributes specified.
- Global Pointer to VARIABLE_GLOBAL structure.
- Instance Instance of the Firmware Volume.
-
-Returns:
-
- EFI STATUS
- EFI_INVALID_PARAMETER - An invalid combination of attribute bits was supplied.
- EFI_SUCCESS - Query successfully.
- EFI_UNSUPPORTED - The attribute is not supported on this platform.
-
---*/
-{
- VARIABLE_HEADER *Variable;
- VARIABLE_HEADER *NextVariable;
- UINT64 VariableSize;
- VARIABLE_STORE_HEADER *VariableStoreHeader;
-
- if(MaximumVariableStorageSize == NULL || RemainingVariableStorageSize == NULL || MaximumVariableSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if((Attributes & (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)) == 0) {
- //
- // Make sure the Attributes combination is supported by the platform.
- //
- return EFI_UNSUPPORTED;
- } else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) {
- //
- // Make sure if runtime bit is set, boot service bit is set also.
- //
- return EFI_INVALID_PARAMETER;
- } else if (EfiAtRuntime () && !(Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {
- //
- // Make sure RT Attribute is set if we are in Runtime phase.
- //
- return EFI_INVALID_PARAMETER;
- } else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_NON_VOLATILE)) {
- //
- // Cannot Query volatile variable in Runtime
- //
- return EFI_INVALID_PARAMETER;
- }
-
- AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
-
- if((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {
- //
- // Query is Volatile related.
- //
- VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase);
- } else {
- //
- // Query is Non-Volatile related.
- //
- VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) Global->NonVolatileVariableBase);
- }
-
- //
- // Now let's fill *MaximumVariableStorageSize *RemainingVariableStorageSize
- // with the storage size (excluding the storage header size)
- //
- *MaximumVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
- *RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
-
- //
- // Let *MaximumVariableSize be MAX_VARIABLE_SIZE
- //
- *MaximumVariableSize = MAX_VARIABLE_SIZE;
-
- //
- // Point to the starting address of the variables.
- //
- Variable = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
-
- //
- // Now walk through the related variable store.
- //
- while (Variable < GetEndPointer (VariableStoreHeader)) {
- if (Variable->StartId != VARIABLE_DATA) {
- break;
- }
-
- NextVariable = (VARIABLE_HEADER *) (GetVariableDataPtr (Variable) + Variable->DataSize + GET_PAD_SIZE (Variable->DataSize));
- VariableSize = (UINT64) (UINTN) NextVariable - (UINT64) (UINTN) Variable;
-
- if (Variable->State == VAR_ADDED) {
- *RemainingVariableStorageSize -= VariableSize;
- }
-
- //
- // Go to the next one.
- //
- Variable = NextVariable;
- }
-
- ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock);
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-InitializeVariableStore (
- OUT EFI_PHYSICAL_ADDRESS *VariableBase,
- OUT UINTN *LastVariableOffset
- )
-/*++
-
-Routine Description:
- This function initializes variable store
-
-Arguments:
-
-Returns:
-
---*/
-{
- VARIABLE_STORE_HEADER *VariableStore;
-
- //
- // Allocate memory for volatile variable store
- //
- VariableStore = (VARIABLE_STORE_HEADER *) AllocateRuntimePool (
- VARIABLE_STORE_SIZE
- );
- if (NULL == VariableStore) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetMem (VariableStore, VARIABLE_STORE_SIZE, 0xff);
-
- //
- // Variable Specific Data
- //
- *VariableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) VariableStore;
- *LastVariableOffset = sizeof (VARIABLE_STORE_HEADER);
-
- VariableStore->Signature = VARIABLE_STORE_SIGNATURE;
- VariableStore->Size = VARIABLE_STORE_SIZE;
- VariableStore->Format = VARIABLE_STORE_FORMATTED;
- VariableStore->State = VARIABLE_STORE_HEALTHY;
- VariableStore->Reserved = 0;
- VariableStore->Reserved1 = 0;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-VariableCommonInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This function does common initialization for variable services
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Allocate memory for mVariableModuleGlobal
- //
- mVariableModuleGlobal = (ESAL_VARIABLE_GLOBAL *) AllocateRuntimePool (
- sizeof (ESAL_VARIABLE_GLOBAL)
- );
- if (NULL == mVariableModuleGlobal) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- EfiInitializeLock(&mVariableModuleGlobal->VariableGlobal[Physical].VariableServicesLock, TPL_NOTIFY);
-
- //
- // Intialize volatile variable store
- //
- Status = InitializeVariableStore (
- &mVariableModuleGlobal->VariableGlobal[Physical].VolatileVariableBase,
- &mVariableModuleGlobal->VolatileLastVariableOffset
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Intialize non volatile variable store
- //
- Status = InitializeVariableStore (
- &mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase,
- &mVariableModuleGlobal->NonVolatileLastVariableOffset
- );
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.dxs b/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.dxs
deleted file mode 100644
index 8660ae0..0000000
--- a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.dxs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EmuVariable.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include "DxeDepex.h"
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.msa b/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.msa
deleted file mode 100644
index 6e769aa..0000000
--- a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariable.msa
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EmuVariable</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>CBD2E4D5-7068-4FF5-B866-9822B4AD8D61</GuidValue>
- <Version>1.0</Version>
- <Abstract>Emulation Variable for EFI_RUNTIME_SERVICES.</Abstract>
- <Description>This module provides three EFI_RUNTIME_SERVICES: SetVariable, GetVariable, GetNextVariableName</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EmuVariable</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Variable.h</Filename>
- <Filename>EmuVariable.c</Filename>
- <Filename>EmuVariable.dxs</Filename>
- <Filename>InitVariable.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED" SupArchList="IA32 X64">
- <ProtocolCName>gEfiVariableWriteArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED" SupArchList="IA32 X64">
- <ProtocolCName>gEfiVariableArchProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>VariableServiceInitialize</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariableIpf.msa b/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariableIpf.msa
deleted file mode 100644
index d4102d2..0000000
--- a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/EmuVariableIpf.msa
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EmuVariableIpf</ModuleName>
- <ModuleType>DXE_SAL_DRIVER</ModuleType>
- <GuidValue>A46320E8-0514-489a-BC4E-481624D9CE33</GuidValue>
- <Version>1.0</Version>
- <Abstract>Emulation Variable for EFI_RUNTIME_SERVICES.</Abstract>
- <Description>This module provides three EFI_RUNTIME_SERVICES: SetVariable, GetVariable, GetNextVariableName</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EmuVariableIpf</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ExtendedSalLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Variable.h</Filename>
- <Filename>EmuVariable.c</Filename>
- <Filename>EmuVariable.dxs</Filename>
- <Filename>Ipf/InitVariable.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiExtendedSalVariableServicesProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>VariableServiceInitialize</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/InitVariable.c b/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/InitVariable.c
deleted file mode 100644
index efff41c..0000000
--- a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/InitVariable.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- InitVariable.c
-
-Abstract:
-
-Revision History
-
---*/
-
-#include "Variable.h"
-
-//
-// Don't use module globals after the SetVirtualAddress map is signaled
-//
-extern ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;
-
-EFI_STATUS
-EFIAPI
-RuntimeServiceGetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- return GetVariable (
- VariableName,
- VendorGuid,
- Attributes OPTIONAL,
- DataSize,
- Data,
- &mVariableModuleGlobal->VariableGlobal[Physical],
- mVariableModuleGlobal->FvbInstance
- );
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeServiceGetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- return GetNextVariableName (
- VariableNameSize,
- VariableName,
- VendorGuid,
- &mVariableModuleGlobal->VariableGlobal[Physical],
- mVariableModuleGlobal->FvbInstance
- );
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeServiceSetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- return SetVariable (
- VariableName,
- VendorGuid,
- Attributes,
- DataSize,
- Data,
- &mVariableModuleGlobal->VariableGlobal[Physical],
- &mVariableModuleGlobal->VolatileLastVariableOffset,
- &mVariableModuleGlobal->NonVolatileLastVariableOffset,
- mVariableModuleGlobal->FvbInstance
- );
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeServiceQueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- return QueryVariableInfo (
- Attributes,
- MaximumVariableStorageSize,
- RemainingVariableStorageSize,
- MaximumVariableSize,
- &mVariableModuleGlobal->VariableGlobal[Physical],
- mVariableModuleGlobal->FvbInstance
- );
-}
-
-VOID
-EFIAPI
-VariableClassAddressChangeEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EfiConvertPointer (
- 0x0,
- (VOID **) &mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase
- );
- EfiConvertPointer (
- 0x0,
- (VOID **) &mVariableModuleGlobal->VariableGlobal[Physical].VolatileVariableBase
- );
- EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal);
-}
-
-EFI_STATUS
-EFIAPI
-VariableServiceInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HANDLE NewHandle;
- EFI_STATUS Status;
-
- Status = VariableCommonInitialize (ImageHandle, SystemTable);
- ASSERT_EFI_ERROR (Status);
-
- SystemTable->RuntimeServices->GetVariable = RuntimeServiceGetVariable;
- SystemTable->RuntimeServices->GetNextVariableName = RuntimeServiceGetNextVariableName;
- SystemTable->RuntimeServices->SetVariable = RuntimeServiceSetVariable;
- SystemTable->RuntimeServices->QueryVariableInfo = RuntimeServiceQueryVariableInfo;
-
- //
- // Now install the Variable Runtime Architectural Protocol on a new handle
- //
- NewHandle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &NewHandle,
- &gEfiVariableArchProtocolGuid,
- NULL,
- &gEfiVariableWriteArchProtocolGuid,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/Ipf/InitVariable.c b/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/Ipf/InitVariable.c
deleted file mode 100644
index 0ad67d5..0000000
--- a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/Ipf/InitVariable.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- IpfVariable.c
-
-Abstract:
-
-Revision History
-
---*/
-
-#include "Variable.h"
-
-//
-// Don't use module globals after the SetVirtualAddress map is signaled
-//
-
-STATIC
-SAL_RETURN_REGS
-EsalVariableCommonEntry (
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8,
- IN SAL_EXTENDED_SAL_PROC ExtendedSalProc,
- IN BOOLEAN VirtualMode,
- IN ESAL_VARIABLE_GLOBAL *Global
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- SAL_RETURN_REGS ReturnVal;
-
- switch (FunctionId) {
- case EsalGetVariableFunctionId:
- ReturnVal.Status = GetVariable (
- (CHAR16 *) Arg2,
- (EFI_GUID *) Arg3,
- (UINT32 *) Arg4,
- (UINTN *) Arg5,
- (VOID *) Arg6,
- &Global->VariableGlobal[VirtualMode],
- Global->FvbInstance
- );
- return ReturnVal;
-
- case EsalGetNextVariableNameFunctionId:
- ReturnVal.Status = GetNextVariableName (
- (UINTN *) Arg2,
- (CHAR16 *) Arg3,
- (EFI_GUID *) Arg4,
- &Global->VariableGlobal[VirtualMode],
- Global->FvbInstance
- );
- return ReturnVal;
-
- case EsalSetVariableFunctionId:
- ReturnVal.Status = SetVariable (
- (CHAR16 *) Arg2,
- (EFI_GUID *) Arg3,
- (UINT32) Arg4,
- (UINTN) Arg5,
- (VOID *) Arg6,
- &Global->VariableGlobal[VirtualMode],
- (UINTN *) &Global->VolatileLastVariableOffset,
- (UINTN *) &Global->NonVolatileLastVariableOffset,
- Global->FvbInstance
- );
- return ReturnVal;
-
- case EsalQueryVariableInfoFunctionId:
- ReturnVal.Status = QueryVariableInfo (
- (UINT32) Arg2,
- (UINT64 *) Arg3,
- (UINT64 *) Arg4,
- (UINT64 *) Arg5,
- &Global->VariableGlobal[VirtualMode],
- Global->FvbInstance
- );
- return ReturnVal;
-
- default:
- ReturnVal.Status = EFI_SAL_INVALID_ARGUMENT;
- return ReturnVal;
- }
-}
-
-
-VOID
-VariableClassAddressChangeEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- CopyMem (
- &mVariableModuleGlobal->VariableGlobal[Virtual],
- &mVariableModuleGlobal->VariableGlobal[Physical],
- sizeof (VARIABLE_GLOBAL)
- );
-
- EfiConvertPointer (
- 0x0,
- (VOID **) &mVariableModuleGlobal->VariableGlobal[Virtual].NonVolatileVariableBase
- );
- EfiConvertPointer (
- 0x0,
- (VOID **) &mVariableModuleGlobal->VariableGlobal[Virtual].VolatileVariableBase
- );
- EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal);
-}
-
-EFI_STATUS
-VariableServiceInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
-
- Status = VariableCommonInitialize (ImageHandle, SystemTable);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Register All the Functions with Extended Sal.
- //
- RegisterEsalClass (
- &gEfiExtendedSalVariableServicesProtocolGuid,
- mVariableModuleGlobal,
- EsalVariableCommonEntry,
- EsalGetVariableFunctionId,
- EsalVariableCommonEntry,
- EsalGetNextVariableNameFunctionId,
- EsalVariableCommonEntry,
- EsalSetVariableFunctionId,
- EsalVariableCommonEntry,
- EsalQueryVariableInfoFunctionId,
- NULL
- );
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/Variable.h b/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/Variable.h
deleted file mode 100644
index f6d7a64..0000000
--- a/EdkModulePkg/Universal/EmuVariable/RuntimeDxe/Variable.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Variable.h
-
-Abstract:
-
---*/
-
-#ifndef _VARIABLE_H
-#define _VARIABLE_H
-
-//
-// Statements that include other header files
-//
-
-//
-// BugBug: We need relcate the head file.
-//
-#include <Common/Variable.h>
-
-#define VARIABLE_STORE_SIZE (64 * 1024)
-#define SCRATCH_SIZE (4 * 1024)
-
-//
-// Define GET_PAD_SIZE to optimize compiler
-//
-#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
-#define GET_PAD_SIZE(a) (0)
-#else
-#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
-#endif
-
-#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
-
-typedef enum {
- Physical,
- Virtual
-} VARIABLE_POINTER_TYPE;
-
-typedef struct {
- VARIABLE_HEADER *CurrPtr;
- VARIABLE_HEADER *EndPtr;
- VARIABLE_HEADER *StartPtr;
- BOOLEAN Volatile;
-} VARIABLE_POINTER_TRACK;
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS VolatileVariableBase;
- EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;
- EFI_LOCK VariableServicesLock;
-} VARIABLE_GLOBAL;
-
-typedef struct {
- VARIABLE_GLOBAL VariableGlobal[2];
- UINTN VolatileLastVariableOffset;
- UINTN NonVolatileLastVariableOffset;
- UINT32 FvbInstance;
-} ESAL_VARIABLE_GLOBAL;
-
-extern ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;
-
-//
-// Functions
-//
-EFI_STATUS
-EFIAPI
-VariableCommonInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-EFI_STATUS
-EFIAPI
-VariableServiceInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-VOID
-EFIAPI
-VariableClassAddressChangeEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-EFI_STATUS
-EFIAPI
-GetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data,
- IN VARIABLE_GLOBAL * Global,
- IN UINT32 Instance
- )
-;
-
-EFI_STATUS
-EFIAPI
-GetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid,
- IN VARIABLE_GLOBAL *Global,
- IN UINT32 Instance
- )
-;
-
-EFI_STATUS
-EFIAPI
-SetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data,
- IN VARIABLE_GLOBAL *Global,
- IN UINTN *VolatileOffset,
- IN UINTN *NonVolatileOffset,
- IN UINT32 Instance
- )
-;
-
-EFI_STATUS
-EFIAPI
-QueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize,
- IN VARIABLE_GLOBAL *Global,
- IN UINT32 Instance
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c
deleted file mode 100644
index a120c7f..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c
+++ /dev/null
@@ -1,931 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name:
-
- FtwLite.c
-
-Abstract:
-
- This is a simple fault tolerant write driver, based on PlatformFd library.
- And it only supports write BufferSize <= SpareAreaLength.
-
- This boot service only protocol provides fault tolerant write capability for
- block devices. The protocol has internal non-volatile intermediate storage
- of the data and private information. It should be able to recover
- automatically from a critical fault, such as power failure.
-
-Notes:
-
- The implementation uses an FTW Lite (Fault Tolerant Write) Work Space.
- This work space is a memory copy of the work space on the Woring Block,
- the size of the work space is the FTW_WORK_SPACE_SIZE bytes.
-
---*/
-
-#include <FtwLite.h>
-
-//
-// In write function, we should check the target range to prevent the user
-// from writing Spare block and Working space directly.
-//
-//
-// Fault Tolerant Write Protocol API
-//
-EFI_STATUS
-EFIAPI
-FtwLiteWrite (
- IN EFI_FTW_LITE_PROTOCOL *This,
- IN EFI_HANDLE FvbHandle,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
- Starts a target block update. This function will record data about write
- in fault tolerant storage and will complete the write in a recoverable
- manner, ensuring at all times that either the original contents or
- the modified contents are available.
-
-Arguments:
- This - Calling context
- FvbHandle - The handle of FVB protocol that provides services for
- reading, writing, and erasing the target block.
- Lba - The logical block address of the target block.
- Offset - The offset within the target block to place the data.
- NumBytes - The number of bytes to write to the target block.
- Buffer - The data to write.
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_BAD_BUFFER_SIZE - The write would span a target block, which is not
- a valid action.
- EFI_ACCESS_DENIED - No writes have been allocated.
- EFI_NOT_FOUND - Cannot find FVB by handle.
- EFI_OUT_OF_RESOURCES - Cannot allocate memory.
- EFI_ABORTED - The function could not complete successfully.
-
---*/
-{
- EFI_STATUS Status;
- EFI_FTW_LITE_DEVICE *FtwLiteDevice;
- EFI_FTW_LITE_RECORD *Record;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_PHYSICAL_ADDRESS FvbPhysicalAddress;
- UINTN MyLength;
- UINTN MyOffset;
- UINTN MyBufferSize;
- UINT8 *MyBuffer;
- UINTN SpareBufferSize;
- UINT8 *SpareBuffer;
- UINTN Index;
- UINT8 *Ptr;
- EFI_DEV_PATH_PTR DevPtr;
-
- //
- // Refresh work space and get last record
- //
- FtwLiteDevice = FTW_LITE_CONTEXT_FROM_THIS (This);
- Status = WorkSpaceRefresh (FtwLiteDevice);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- Record = FtwLiteDevice->FtwLastRecord;
-
- //
- // Check the flags of last write record
- //
- if ((Record->WriteAllocated == FTW_VALID_STATE) || (Record->SpareCompleted == FTW_VALID_STATE)) {
- return EFI_ACCESS_DENIED;
- }
- //
- // IF former record has completed, THEN use next record
- //
- if (Record->WriteCompleted == FTW_VALID_STATE) {
- Record++;
- FtwLiteDevice->FtwLastRecord = Record;
- }
-
- MyOffset = (UINT8 *) Record - FtwLiteDevice->FtwWorkSpace;
-
- //
- // Check if the input data can fit within the target block
- //
- if ((Offset +*NumBytes) > FtwLiteDevice->SpareAreaLength) {
- return EFI_BAD_BUFFER_SIZE;
- }
- //
- // Check if there is enough free space for allocate a record
- //
- if ((MyOffset + WRITE_TOTAL_SIZE) > FtwLiteDevice->FtwWorkSpaceSize) {
- Status = FtwReclaimWorkSpace (FtwLiteDevice);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "FtwLite: Reclaim work space - %r", Status));
- return EFI_ABORTED;
- }
- }
- //
- // Get the FVB protocol by handle
- //
- Status = FtwGetFvbByHandle (FvbHandle, &Fvb);
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- //
- // Allocate a write record in workspace.
- // Update Header->WriteAllocated as VALID
- //
- Status = FtwUpdateFvState (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkSpaceLba,
- FtwLiteDevice->FtwWorkSpaceBase + MyOffset,
- WRITE_ALLOCATED
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Allocate record - %r\n", Status));
- return EFI_ABORTED;
- }
-
- Record->WriteAllocated = FTW_VALID_STATE;
-
- //
- // Prepare data of write record, filling DevPath with memory mapped address.
- //
- DevPtr.MemMap = (MEMMAP_DEVICE_PATH *) &Record->DevPath;
- DevPtr.MemMap->Header.Type = HARDWARE_DEVICE_PATH;
- DevPtr.MemMap->Header.SubType = HW_MEMMAP_DP;
- SetDevicePathNodeLength (&DevPtr.MemMap->Header, sizeof (MEMMAP_DEVICE_PATH));
-
- Status = Fvb->GetPhysicalAddress (Fvb, &FvbPhysicalAddress);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Get FVB physical address - %r\n", Status));
- return EFI_ABORTED;
- }
-
- DevPtr.MemMap->MemoryType = EfiMemoryMappedIO;
- DevPtr.MemMap->StartingAddress = FvbPhysicalAddress;
- DevPtr.MemMap->EndingAddress = FvbPhysicalAddress +*NumBytes;
- //
- // ignored!
- //
- Record->Lba = Lba;
- Record->Offset = Offset;
- Record->NumBytes = *NumBytes;
-
- //
- // Write the record to the work space.
- //
- MyOffset = (UINT8 *) Record - FtwLiteDevice->FtwWorkSpace;
- MyLength = FTW_LITE_RECORD_SIZE;
-
- Status = FtwLiteDevice->FtwFvBlock->Write (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkSpaceLba,
- FtwLiteDevice->FtwWorkSpaceBase + MyOffset,
- &MyLength,
- (UINT8 *) Record
- );
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- //
- // Record has been written to working block, then write data.
- //
- //
- // Allocate a memory buffer
- //
- MyBufferSize = FtwLiteDevice->SpareAreaLength;
- MyBuffer = AllocatePool (MyBufferSize);
- if (MyBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Starting at Lba, if the number of the rest blocks on Fvb is less
- // than NumberOfSpareBlock.
- //
- //
- // Read all original data from target block to memory buffer
- //
- if (IsInWorkingBlock (FtwLiteDevice, Fvb, Lba)) {
- //
- // If target block falls into working block, we must follow the process of
- // updating working block.
- //
- Ptr = MyBuffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- MyLength = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwFvBlock->Read (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkBlockLba + Index,
- 0,
- &MyLength,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (MyBuffer);
- return EFI_ABORTED;
- }
-
- Ptr += MyLength;
- }
- //
- // Update Offset by adding the offset from the start LBA of working block to
- // the target LBA. The target block can not span working block!
- //
- Offset = (((UINTN) (Lba - FtwLiteDevice->FtwWorkBlockLba)) * FtwLiteDevice->SizeOfSpareBlock + Offset);
- ASSERT ((Offset +*NumBytes) <= FtwLiteDevice->SpareAreaLength);
-
- } else {
-
- Ptr = MyBuffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- MyLength = FtwLiteDevice->SizeOfSpareBlock;
- Status = Fvb->Read (Fvb, Lba + Index, 0, &MyLength, Ptr);
- if (EFI_ERROR (Status)) {
- FreePool (MyBuffer);
- return EFI_ABORTED;
- }
-
- Ptr += MyLength;
- }
- }
- //
- // Overwrite the updating range data with
- // the input buffer content
- //
- CopyMem (MyBuffer + Offset, Buffer, *NumBytes);
-
- //
- // Try to keep the content of spare block
- // Save spare block into a spare backup memory buffer (Sparebuffer)
- //
- SpareBufferSize = FtwLiteDevice->SpareAreaLength;
- SpareBuffer = AllocatePool (SpareBufferSize);
- if (SpareBuffer == NULL) {
- FreePool (MyBuffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Ptr = SpareBuffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- MyLength = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwBackupFvb->Read (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + Index,
- 0,
- &MyLength,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (MyBuffer);
- FreePool (SpareBuffer);
- return EFI_ABORTED;
- }
-
- Ptr += MyLength;
- }
- //
- // Write the memory buffer to spare block
- // Don't forget to erase Flash first.
- //
- Status = FtwEraseSpareBlock (FtwLiteDevice);
- Ptr = MyBuffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- MyLength = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwBackupFvb->Write (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + Index,
- 0,
- &MyLength,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (MyBuffer);
- FreePool (SpareBuffer);
- return EFI_ABORTED;
- }
-
- Ptr += MyLength;
- }
- //
- // Free MyBuffer
- //
- FreePool (MyBuffer);
-
- //
- // Set the SpareCompleteD in the FTW record,
- //
- MyOffset = (UINT8 *) Record - FtwLiteDevice->FtwWorkSpace;
- Status = FtwUpdateFvState (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkSpaceLba,
- FtwLiteDevice->FtwWorkSpaceBase + MyOffset,
- SPARE_COMPLETED
- );
- if (EFI_ERROR (Status)) {
- FreePool (SpareBuffer);
- return EFI_ABORTED;
- }
-
- Record->SpareCompleted = FTW_VALID_STATE;
-
- //
- // Since the content has already backuped in spare block, the write is
- // guaranteed to be completed with fault tolerant manner.
- //
- Status = FtwWriteRecord (FtwLiteDevice, Fvb);
- if (EFI_ERROR (Status)) {
- FreePool (SpareBuffer);
- return EFI_ABORTED;
- }
-
- Record++;
- FtwLiteDevice->FtwLastRecord = Record;
-
- //
- // Restore spare backup buffer into spare block , if no failure happened during FtwWrite.
- //
- Status = FtwEraseSpareBlock (FtwLiteDevice);
- Ptr = SpareBuffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- MyLength = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwBackupFvb->Write (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + Index,
- 0,
- &MyLength,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (SpareBuffer);
- return EFI_ABORTED;
- }
-
- Ptr += MyLength;
- }
- //
- // All success.
- //
- FreePool (SpareBuffer);
-
- DEBUG (
- (EFI_D_FTW_LITE,
- "FtwLite: Write() success, (Lba:Offset)=(%lx:0x%x), NumBytes: 0x%x\n",
- Lba,
- Offset,
- *NumBytes)
- );
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-FtwWriteRecord (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb
- )
-/*++
-
-Routine Description:
- Write a record with fault tolerant mannaer.
- Since the content has already backuped in spare block, the write is
- guaranteed to be completed with fault tolerant manner.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
- Fvb - The FVB protocol that provides services for
- reading, writing, and erasing the target block.
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully
-
---*/
-{
- EFI_STATUS Status;
- EFI_FTW_LITE_RECORD *Record;
- EFI_LBA WorkSpaceLbaOffset;
- UINTN Offset;
-
- //
- // Spare Complete but Destination not complete,
- // Recover the targt block with the spare block.
- //
- Record = FtwLiteDevice->FtwLastRecord;
-
- //
- // IF target block is working block, THEN Flush Spare Block To Working Block;
- // ELSE IF target block is boot block, THEN Flush Spare Block To boot Block;
- // ELSE flush spare block to normal target block.ENDIF
- //
- if (IsInWorkingBlock (FtwLiteDevice, Fvb, Record->Lba)) {
- //
- // If target block is working block, Attention:
- // it's required to set SPARE_COMPLETED to spare block.
- //
- WorkSpaceLbaOffset = FtwLiteDevice->FtwWorkSpaceLba - FtwLiteDevice->FtwWorkBlockLba;
- Offset = (UINT8 *) Record - FtwLiteDevice->FtwWorkSpace;
- Status = FtwUpdateFvState (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + WorkSpaceLbaOffset,
- FtwLiteDevice->FtwWorkSpaceBase + Offset,
- SPARE_COMPLETED
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = FlushSpareBlockToWorkingBlock (FtwLiteDevice);
- } else if (IsBootBlock (FtwLiteDevice, Fvb, Record->Lba)) {
- //
- // Update boot block
- //
- Status = FlushSpareBlockToBootBlock (FtwLiteDevice);
- } else {
- //
- // Update blocks other than working block or boot block
- //
- Status = FlushSpareBlockToTargetBlock (FtwLiteDevice, Fvb, Record->Lba);
- }
-
- ASSERT_EFI_ERROR (Status);
-
- //
- // Set WriteCompleted flag in record
- //
- Offset = (UINT8 *) Record - FtwLiteDevice->FtwWorkSpace;
- Status = FtwUpdateFvState (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkSpaceLba,
- FtwLiteDevice->FtwWorkSpaceBase + Offset,
- WRITE_COMPLETED
- );
- ASSERT_EFI_ERROR (Status);
-
- Record->WriteCompleted = FTW_VALID_STATE;
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-FtwRestart (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Restarts a previously interrupted write. The caller must provide the
- block protocol needed to complete the interrupted write.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
- FvbHandle - The handle of FVB protocol that provides services for
- reading, writing, and erasing the target block.
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ACCESS_DENIED - No pending writes exist
- EFI_NOT_FOUND - FVB protocol not found by the handle
- EFI_ABORTED - The function could not complete successfully
-
---*/
-{
- EFI_STATUS Status;
- EFI_FTW_LITE_RECORD *Record;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_DEV_PATH_PTR DevPathPtr;
-
- //
- // Spare Completed but Destination not complete,
- // Recover the targt block with the spare block.
- //
- Record = FtwLiteDevice->FtwLastRecord;
-
- //
- // Only support memory mapped FVB device path by now.
- //
- DevPathPtr.MemMap = (MEMMAP_DEVICE_PATH *) &Record->DevPath;
- if (!((DevPathPtr.MemMap->Header.Type == HARDWARE_DEVICE_PATH) && (DevPathPtr.MemMap->Header.SubType == HW_MEMMAP_DP))
- ) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: FVB Device Path is not memory mapped\n"));
- return EFI_ABORTED;
- }
-
- Status = GetFvbByAddress (DevPathPtr.MemMap->StartingAddress, &Fvb);
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- //
- // Since the content has already backuped in spare block, the write is
- // guaranteed to be completed with fault tolerant manner.
- //
- Status = FtwWriteRecord (FtwLiteDevice, Fvb);
- DEBUG ((EFI_D_FTW_INFO, "FtwLite: Restart() - %r\n", Status));
-
- Record++;
- FtwLiteDevice->FtwLastRecord = Record;
-
- //
- // Erase Spare block
- // This is restart, no need to keep spareblock content.
- //
- FtwEraseSpareBlock (FtwLiteDevice);
-
- return Status;
-}
-
-
-EFI_STATUS
-FtwAbort (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Aborts all previous allocated writes.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully.
- EFI_NOT_FOUND - No allocated writes exist.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Offset;
-
- if (FtwLiteDevice->FtwLastRecord->WriteCompleted == FTW_VALID_STATE) {
- return EFI_NOT_FOUND;
- }
- //
- // Update the complete state of the header as VALID and abort.
- //
- Offset = (UINT8 *) FtwLiteDevice->FtwLastRecord - FtwLiteDevice->FtwWorkSpace;
- Status = FtwUpdateFvState (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkSpaceLba,
- FtwLiteDevice->FtwWorkSpaceBase + Offset,
- WRITE_COMPLETED
- );
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- FtwLiteDevice->FtwLastRecord->WriteCompleted = FTW_VALID_STATE;
-
- Status = FtwGetLastRecord (FtwLiteDevice, &FtwLiteDevice->FtwLastRecord);
-
- //
- // Erase the spare block
- //
- Status = FtwEraseSpareBlock (FtwLiteDevice);
-
- DEBUG ((EFI_D_FTW_INFO, "FtwLite: Abort() success \n"));
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-InitializeFtwLite (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
- Routine Description:
- This function is the entry point of the Fault Tolerant Write driver.
-
- Arguments:
- ImageHandle - EFI_HANDLE: A handle for the image that is initializing
- this driver
- SystemTable - EFI_SYSTEM_TABLE: A pointer to the EFI system table
-
- Returns:
- EFI_SUCCESS - FTW has finished the initialization
- EFI_ABORTED - FTW initialization error
-
---*/
-{
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- UINTN Index;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- EFI_PHYSICAL_ADDRESS BaseAddress;
- EFI_FTW_LITE_DEVICE *FtwLiteDevice;
- EFI_FTW_LITE_RECORD *Record;
- UINTN Length;
- EFI_STATUS Status;
- UINTN Offset;
- EFI_FV_BLOCK_MAP_ENTRY *FvbMapEntry;
- UINT32 LbaIndex;
-
- //
- // Allocate Private data of this driver,
- // INCLUDING THE FtwWorkSpace[FTW_WORK_SPACE_SIZE].
- //
- FtwLiteDevice = NULL;
- FtwLiteDevice = AllocatePool (sizeof (EFI_FTW_LITE_DEVICE) + FTW_WORK_SPACE_SIZE);
- if (FtwLiteDevice != NULL) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_OUT_OF_RESOURCES;
- }
-
- ASSERT_EFI_ERROR (Status);
-
- ZeroMem (FtwLiteDevice, sizeof (EFI_FTW_LITE_DEVICE));
- FtwLiteDevice->Signature = FTW_LITE_DEVICE_SIGNATURE;
-
- //
- // Initialize other parameters, and set WorkSpace as FTW_ERASED_BYTE.
- //
- FtwLiteDevice->FtwWorkSpace = (UINT8 *) (FtwLiteDevice + 1);
- FtwLiteDevice->FtwWorkSpaceSize = FTW_WORK_SPACE_SIZE;
- SetMem (
- FtwLiteDevice->FtwWorkSpace,
- FtwLiteDevice->FtwWorkSpaceSize,
- FTW_ERASED_BYTE
- );
- FtwLiteDevice->FtwWorkSpaceHeader = (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *) FtwLiteDevice->FtwWorkSpace;
-
- FtwLiteDevice->FtwLastRecord = NULL;
-
- FtwLiteDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwWorkingBase);
- FtwLiteDevice->WorkSpaceLength = (UINTN) PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
-
- FtwLiteDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwSpareBase);
- FtwLiteDevice->SpareAreaLength = (UINTN) PcdGet32 (PcdFlashNvStorageFtwSpareSize);
-
- ASSERT ((FtwLiteDevice->WorkSpaceLength != 0) && (FtwLiteDevice->SpareAreaLength != 0));
-
- //
- // Locate FVB protocol
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- ASSERT_EFI_ERROR (Status);
-
- ASSERT (HandleCount > 0);
-
- FtwLiteDevice->FtwFvBlock = NULL;
- FtwLiteDevice->FtwBackupFvb = NULL;
- FtwLiteDevice->FtwWorkSpaceLba = (EFI_LBA) (-1);
- FtwLiteDevice->FtwSpareLba = (EFI_LBA) (-1);
- for (Index = 0; Index < HandleCount; Index += 1) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID **) &Fvb
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = Fvb->GetPhysicalAddress (Fvb, &BaseAddress);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) BaseAddress);
-
- if ((FtwLiteDevice->WorkSpaceAddress >= BaseAddress) &&
- (FtwLiteDevice->WorkSpaceAddress <= (BaseAddress + FwVolHeader->FvLength))
- ) {
- FtwLiteDevice->FtwFvBlock = Fvb;
- //
- // To get the LBA of work space
- //
- if ((FwVolHeader->FvLength) > (FwVolHeader->HeaderLength)) {
- //
- // FV may have multiple types of BlockLength
- //
- FvbMapEntry = &FwVolHeader->FvBlockMap[0];
- while (!((FvbMapEntry->NumBlocks == 0) && (FvbMapEntry->BlockLength == 0))) {
- for (LbaIndex = 1; LbaIndex <= FvbMapEntry->NumBlocks; LbaIndex += 1) {
- if (FtwLiteDevice->WorkSpaceAddress < (BaseAddress + FvbMapEntry->BlockLength * LbaIndex)) {
- FtwLiteDevice->FtwWorkSpaceLba = LbaIndex - 1;
- //
- // Get the Work space size and Base(Offset)
- //
- FtwLiteDevice->FtwWorkSpaceSize = FtwLiteDevice->WorkSpaceLength;
- FtwLiteDevice->FtwWorkSpaceBase = (UINTN) (FtwLiteDevice->WorkSpaceAddress - (BaseAddress + FvbMapEntry->BlockLength * (LbaIndex - 1)));
- break;
- }
- }
- //
- // end for
- //
- FvbMapEntry++;
- }
- //
- // end while
- //
- }
- }
-
- if ((FtwLiteDevice->SpareAreaAddress >= BaseAddress) &&
- (FtwLiteDevice->SpareAreaAddress <= (BaseAddress + FwVolHeader->FvLength))
- ) {
- FtwLiteDevice->FtwBackupFvb = Fvb;
- //
- // To get the LBA of spare
- //
- if ((FwVolHeader->FvLength) > (FwVolHeader->HeaderLength)) {
- //
- // FV may have multiple types of BlockLength
- //
- FvbMapEntry = &FwVolHeader->FvBlockMap[0];
- while (!((FvbMapEntry->NumBlocks == 0) && (FvbMapEntry->BlockLength == 0))) {
- for (LbaIndex = 1; LbaIndex <= FvbMapEntry->NumBlocks; LbaIndex += 1) {
- if (FtwLiteDevice->SpareAreaAddress < (BaseAddress + FvbMapEntry->BlockLength * LbaIndex)) {
- //
- // Get the NumberOfSpareBlock and SizeOfSpareBlock
- //
- FtwLiteDevice->FtwSpareLba = LbaIndex - 1;
- FtwLiteDevice->SizeOfSpareBlock = FvbMapEntry->BlockLength;
- FtwLiteDevice->NumberOfSpareBlock = FtwLiteDevice->SpareAreaLength / FtwLiteDevice->SizeOfSpareBlock;
- //
- // Check the range of spare area to make sure that it's in FV range
- //
- ASSERT ((FtwLiteDevice->FtwSpareLba + FtwLiteDevice->NumberOfSpareBlock) <= FvbMapEntry->NumBlocks);
- break;
- }
- }
-
- FvbMapEntry++;
- }
- //
- // end while
- //
- }
- }
- }
- //
- // Calculate the start LBA of working block. Working block is an area which
- // contains working space in its last block and has the same size as spare
- // block, unless there are not enough blocks before the block that contains
- // working space.
- //
- FtwLiteDevice->FtwWorkBlockLba = FtwLiteDevice->FtwWorkSpaceLba - FtwLiteDevice->NumberOfSpareBlock + 1;
- if ((INT64) (FtwLiteDevice->FtwWorkBlockLba) < 0) {
- FtwLiteDevice->FtwWorkBlockLba = 0;
- }
-
- if ((FtwLiteDevice->FtwFvBlock == NULL) ||
- (FtwLiteDevice->FtwBackupFvb == NULL) ||
- (FtwLiteDevice->FtwWorkSpaceLba == (EFI_LBA) (-1)) ||
- (FtwLiteDevice->FtwSpareLba == (EFI_LBA) (-1))
- ) {
- DEBUG ((EFI_D_ERROR, "FtwLite: Working or spare FVB not ready\n"));
- ASSERT_EFI_ERROR (Status);
- }
- //
- // Refresh workspace data from working block
- //
- Status = WorkSpaceRefresh (FtwLiteDevice);
- ASSERT_EFI_ERROR (Status);
-
- //
- // If the working block workspace is not valid, try the spare block
- //
- if (!IsValidWorkSpace (FtwLiteDevice->FtwWorkSpaceHeader)) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Workspace invalid, read from backup\n"));
- //
- // Read from spare block
- //
- Length = FtwLiteDevice->FtwWorkSpaceSize;
- Status = FtwLiteDevice->FtwBackupFvb->Read (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba,
- FtwLiteDevice->FtwWorkSpaceBase,
- &Length,
- FtwLiteDevice->FtwWorkSpace
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // If spare block is valid, then replace working block content.
- //
- if (IsValidWorkSpace (FtwLiteDevice->FtwWorkSpaceHeader)) {
- Status = FlushSpareBlockToWorkingBlock (FtwLiteDevice);
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Restart working block in Init() - %r\n", Status));
- ASSERT_EFI_ERROR (Status);
-
- FtwAbort (FtwLiteDevice);
- //
- // Refresh work space.
- //
- Status = WorkSpaceRefresh (FtwLiteDevice);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- } else {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Both are invalid, init workspace\n"));
- //
- // If both are invalid, then initialize work space.
- //
- SetMem (
- FtwLiteDevice->FtwWorkSpace,
- FtwLiteDevice->FtwWorkSpaceSize,
- FTW_ERASED_BYTE
- );
- InitWorkSpaceHeader (FtwLiteDevice->FtwWorkSpaceHeader);
- //
- // Write to work space on the working block
- //
- Length = FtwLiteDevice->FtwWorkSpaceSize;
- Status = FtwLiteDevice->FtwFvBlock->Write (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkSpaceLba,
- FtwLiteDevice->FtwWorkSpaceBase,
- &Length,
- FtwLiteDevice->FtwWorkSpace
- );
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- }
- }
- //
- // Hook the protocol API
- //
- FtwLiteDevice->FtwLiteInstance.Write = FtwLiteWrite;
-
- //
- // Install protocol interface
- //
- Status = gBS->InstallProtocolInterface (
- &FtwLiteDevice->Handle,
- &gEfiFaultTolerantWriteLiteProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &FtwLiteDevice->FtwLiteInstance
- );
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- //
- // If (!SpareCompleted) THEN Abort to rollback.
- //
- if ((FtwLiteDevice->FtwLastRecord->WriteAllocated == FTW_VALID_STATE) &&
- (FtwLiteDevice->FtwLastRecord->SpareCompleted != FTW_VALID_STATE)
- ) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Init.. record not SpareCompleted, abort()\n"));
- FtwAbort (FtwLiteDevice);
- }
- //
- // if (SpareCompleted) THEN Restart to fault tolerant write.
- //
- if ((FtwLiteDevice->FtwLastRecord->SpareCompleted == FTW_VALID_STATE) &&
- (FtwLiteDevice->FtwLastRecord->WriteCompleted != FTW_VALID_STATE)
- ) {
-
- Status = FtwRestart (FtwLiteDevice);
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Restart last write - %r\n", Status));
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- //
- // To check the workspace buffer behind last records is EMPTY or not.
- // If it's not EMPTY, FTW_LITE also need to call reclaim().
- //
- Record = FtwLiteDevice->FtwLastRecord;
- Offset = (UINT8 *) Record - FtwLiteDevice->FtwWorkSpace;
- if (FtwLiteDevice->FtwWorkSpace[Offset] != FTW_ERASED_BYTE) {
- Offset += WRITE_TOTAL_SIZE;
- }
-
- if (!IsErasedFlashBuffer (
- FTW_ERASE_POLARITY,
- FtwLiteDevice->FtwWorkSpace + Offset,
- FtwLiteDevice->FtwWorkSpaceSize - Offset
- )) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Workspace is dirty, call reclaim...\n"));
- Status = FtwReclaimWorkSpace (FtwLiteDevice);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Workspace reclaim - %r\n", Status));
- return EFI_ABORTED;
- }
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.dxs b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.dxs
deleted file mode 100644
index 93aa216..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.dxs
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name:
-
- FtwLite.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-
-DEPENDENCY_START
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID AND EFI_ALTERNATE_FV_BLOCK_GUID
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h
deleted file mode 100644
index 8754827..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h
+++ /dev/null
@@ -1,675 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name:
-
- FtwLite.h
-
-Abstract:
-
- This is a simple fault tolerant write driver, based on PlatformFd library.
- And it only supports write BufferSize <= SpareAreaLength.
-
- This boot service only protocol provides fault tolerant write capability for
- block devices. The protocol has internal non-volatile intermediate storage
- of the data and private information. It should be able to recover
- automatically from a critical fault, such as power failure.
-
---*/
-
-#ifndef _EFI_FAULT_TOLERANT_WRITE_LITE_H_
-#define _EFI_FAULT_TOLERANT_WRITE_LITE_H_
-
-#include <Common/FlashMap.h>
-#include <Common/WorkingBlockHeader.h>
-
-#define EFI_D_FTW_LITE EFI_D_ERROR
-#define EFI_D_FTW_INFO EFI_D_INFO
-
-//
-// Flash erase polarity is 1
-//
-#define FTW_ERASE_POLARITY 1
-
-#define FTW_VALID_STATE 0
-#define FTW_INVALID_STATE 1
-
-#define FTW_ERASED_BYTE ((UINT8) (255))
-#define FTW_POLARITY_REVERT ((UINT8) (255))
-
-typedef struct {
- UINT8 WriteAllocated : 1;
- UINT8 SpareCompleted : 1;
- UINT8 WriteCompleted : 1;
- UINT8 Reserved : 5;
-#define WRITE_ALLOCATED 0x1
-#define SPARE_COMPLETED 0x2
-#define WRITE_COMPLETED 0x4
-
- EFI_DEV_PATH DevPath;
- EFI_LBA Lba;
- UINTN Offset;
- UINTN NumBytes;
- //
- // UINTN SpareAreaOffset;
- //
-} EFI_FTW_LITE_RECORD;
-
-#define FTW_LITE_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('F', 'T', 'W', 'L')
-
-//
-// MACRO for Block size.
-// Flash Erasing will do in block granularity.
-//
-#ifdef FV_BLOCK_SIZE
-#define FTW_BLOCK_SIZE FV_BLOCK_SIZE
-#else
-#define FV_BLOCK_SIZE 0x10000
-#define FTW_BLOCK_SIZE FV_BLOCK_SIZE
-#endif
-//
-// MACRO for FTW WORK SPACE Base & Size
-//
-#ifdef EFI_FTW_WORKING_OFFSET
-#define FTW_WORK_SPACE_BASE EFI_FTW_WORKING_OFFSET
-#else
-#define FTW_WORK_SPACE_BASE 0x00E000
-#endif
-
-#ifdef EFI_FTW_WORKING_LENGTH
-#define FTW_WORK_SPACE_SIZE EFI_FTW_WORKING_LENGTH
-#else
-#define FTW_WORK_SPACE_SIZE 0x002000
-#endif
-//
-// MACRO for FTW header and record
-//
-#define FTW_WORKING_QUEUE_SIZE (FTW_WORK_SPACE_SIZE - sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER))
-#define FTW_LITE_RECORD_SIZE (sizeof (EFI_FTW_LITE_RECORD))
-#define WRITE_TOTAL_SIZE FTW_LITE_RECORD_SIZE
-
-//
-// EFI Fault tolerant protocol private data structure
-//
-typedef struct {
- UINTN Signature;
- EFI_HANDLE Handle;
- EFI_FTW_LITE_PROTOCOL FtwLiteInstance;
- EFI_PHYSICAL_ADDRESS WorkSpaceAddress;
- UINTN WorkSpaceLength;
- EFI_PHYSICAL_ADDRESS SpareAreaAddress;
- UINTN SpareAreaLength;
- UINTN NumberOfSpareBlock; // Number of the blocks in spare block
- UINTN SizeOfSpareBlock; // Block size in bytes of the blocks in spare block
- EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *FtwWorkSpaceHeader;
- EFI_FTW_LITE_RECORD *FtwLastRecord;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FtwFvBlock; // FVB of working block
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FtwBackupFvb; // FVB of spare block
- EFI_LBA FtwSpareLba;
- EFI_LBA FtwWorkBlockLba; // Start LBA of working block
- EFI_LBA FtwWorkSpaceLba; // Start LBA of working space
- UINTN FtwWorkSpaceBase; // Offset from LBA start addr
- UINTN FtwWorkSpaceSize;
- UINT8 *FtwWorkSpace;
- //
- // Following a buffer of FtwWorkSpace[FTW_WORK_SPACE_SIZE],
- // Allocated with EFI_FTW_LITE_DEVICE.
- //
-} EFI_FTW_LITE_DEVICE;
-
-#define FTW_LITE_CONTEXT_FROM_THIS(a) CR (a, EFI_FTW_LITE_DEVICE, FtwLiteInstance, FTW_LITE_DEVICE_SIGNATURE)
-
-//
-// Driver entry point
-//
-EFI_STATUS
-EFIAPI
-InitializeFtwLite (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This function is the entry point of the Fault Tolerant Write driver.
-
-Arguments:
- ImageHandle - EFI_HANDLE: A handle for the image that is initializing
- this driver
- SystemTable - EFI_SYSTEM_TABLE: A pointer to the EFI system table
-
-Returns:
- EFI_SUCCESS - FTW has finished the initialization
- EFI_ABORTED - FTW initialization error
-
---*/
-;
-
-//
-// Fault Tolerant Write Protocol API
-//
-EFI_STATUS
-EFIAPI
-FtwLiteWrite (
- IN EFI_FTW_LITE_PROTOCOL *This,
- IN EFI_HANDLE FvbHandle,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN UINTN *NumBytes,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
- Starts a target block update. This function will record data about write
- in fault tolerant storage and will complete the write in a recoverable
- manner, ensuring at all times that either the original contents or
- the modified contents are available.
-
-Arguments:
- This - Calling context
- FvbHandle - The handle of FVB protocol that provides services for
- reading, writing, and erasing the target block.
- Lba - The logical block address of the target block.
- Offset - The offset within the target block to place the data.
- NumBytes - The number of bytes to write to the target block.
- Buffer - The data to write.
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_BAD_BUFFER_SIZE - The write would span a target block, which is not
- a valid action.
- EFI_ACCESS_DENIED - No writes have been allocated.
- EFI_NOT_FOUND - Cannot find FVB by handle.
- EFI_OUT_OF_RESOURCES - Cannot allocate memory.
- EFI_ABORTED - The function could not complete successfully.
-
---*/
-;
-
-//
-// Internal functions
-//
-EFI_STATUS
-FtwRestart (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Restarts a previously interrupted write. The caller must provide the
- block protocol needed to complete the interrupted write.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
- FvbHandle - The handle of FVB protocol that provides services for
- reading, writing, and erasing the target block.
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ACCESS_DENIED - No pending writes exist
- EFI_NOT_FOUND - FVB protocol not found by the handle
- EFI_ABORTED - The function could not complete successfully
-
---*/
-;
-
-EFI_STATUS
-FtwAbort (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Aborts all previous allocated writes.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully.
- EFI_NOT_FOUND - No allocated writes exist.
-
---*/
-;
-
-
-EFI_STATUS
-FtwWriteRecord (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb
- )
-/*++
-
-Routine Description:
- Write a record with fault tolerant mannaer.
- Since the content has already backuped in spare block, the write is
- guaranteed to be completed with fault tolerant manner.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
- Fvb - The FVB protocol that provides services for
- reading, writing, and erasing the target block.
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully
-
---*/
-;
-
-EFI_STATUS
-FtwEraseBlock (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- EFI_LBA Lba
- )
-/*++
-
-Routine Description:
- To Erase one block. The size is FTW_BLOCK_SIZE
-
-Arguments:
- FtwLiteDevice - Calling context
- FvBlock - FVB Protocol interface
- Lba - Lba of the firmware block
-
-Returns:
- EFI_SUCCESS - Block LBA is Erased successfully
- Others - Error occurs
-
---*/
-;
-
-EFI_STATUS
-FtwEraseSpareBlock (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
-
- Erase spare block.
-
-Arguments:
-
- FtwLiteDevice - Calling context
-
-Returns:
-
- Status code
-
---*/
-;
-
-EFI_STATUS
-FtwGetFvbByHandle (
- IN EFI_HANDLE FvBlockHandle,
- OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock
- )
-/*++
-
-Routine Description:
- Retrive the proper FVB protocol interface by HANDLE.
-
-Arguments:
- FvBlockHandle - The handle of FVB protocol that provides services for
- reading, writing, and erasing the target block.
- FvBlock - The interface of FVB protocol
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully
---*/
-;
-
-EFI_STATUS
-GetFvbByAddress (
- IN EFI_PHYSICAL_ADDRESS Address,
- OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock
- )
-/*++
-
-Routine Description:
-
- Get firmware block by address.
-
-Arguments:
-
- Address - Address specified the block
- FvBlock - The block caller wanted
-
-Returns:
-
- Status code
-
- EFI_NOT_FOUND - Block not found
-
---*/
-;
-
-BOOLEAN
-IsInWorkingBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- EFI_LBA Lba
- )
-/*++
-
-Routine Description:
-
- Is it in working block?
-
-Arguments:
-
- FtwLiteDevice - Calling context
- FvBlock - Fvb protocol instance
- Lba - The block specified
-
-Returns:
-
- In working block or not
-
---*/
-;
-
-BOOLEAN
-IsBootBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- EFI_LBA Lba
- )
-/*++
-
-Routine Description:
-
- Check whether the block is a boot block.
-
-Arguments:
-
- FtwLiteDevice - Calling context
- FvBlock - Fvb protocol instance
- Lba - Lba value
-
-Returns:
-
- Is a boot block or not
-
---*/
-;
-
-EFI_STATUS
-FlushSpareBlockToTargetBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- EFI_LBA Lba
- )
-/*++
-
-Routine Description:
- Copy the content of spare block to a target block. Size is FTW_BLOCK_SIZE.
- Spare block is accessed by FTW backup FVB protocol interface. LBA is
- FtwLiteDevice->FtwSpareLba.
- Target block is accessed by FvBlock protocol interface. LBA is Lba.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
- FvBlock - FVB Protocol interface to access target block
- Lba - Lba of the target block
-
-Returns:
- EFI_SUCCESS - Spare block content is copied to target block
- EFI_INVALID_PARAMETER - Input parameter error
- EFI_OUT_OF_RESOURCES - Allocate memory error
- EFI_ABORTED - The function could not complete successfully
-
---*/
-;
-
-EFI_STATUS
-FlushSpareBlockToWorkingBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Copy the content of spare block to working block. Size is FTW_BLOCK_SIZE.
- Spare block is accessed by FTW backup FVB protocol interface. LBA is
- FtwLiteDevice->FtwSpareLba.
- Working block is accessed by FTW working FVB protocol interface. LBA is
- FtwLiteDevice->FtwWorkBlockLba.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
-
-Returns:
- EFI_SUCCESS - Spare block content is copied to target block
- EFI_OUT_OF_RESOURCES - Allocate memory error
- EFI_ABORTED - The function could not complete successfully
-
-Notes:
- Since the working block header is important when FTW initializes, the
- state of the operation should be handled carefully. The Crc value is
- calculated without STATE element.
-
---*/
-;
-
-EFI_STATUS
-FlushSpareBlockToBootBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.
- Spare block is accessed by FTW backup FVB protocol interface. LBA is
- FtwLiteDevice->FtwSpareLba.
- Boot block is accessed by BootFvb protocol interface. LBA is 0.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
-
-Returns:
- EFI_SUCCESS - Spare block content is copied to boot block
- EFI_INVALID_PARAMETER - Input parameter error
- EFI_OUT_OF_RESOURCES - Allocate memory error
- EFI_ABORTED - The function could not complete successfully
-
-Notes:
-
---*/
-;
-
-EFI_STATUS
-FtwUpdateFvState (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN UINT8 NewBit
- )
-/*++
-
-Routine Description:
- Update a bit of state on a block device. The location of the bit is
- calculated by the (Lba, Offset, bit). Here bit is determined by the
- the name of a certain bit.
-
-Arguments:
- FvBlock - FVB Protocol interface to access SrcBlock and DestBlock
- Lba - Lba of a block
- Offset - Offset on the Lba
- NewBit - New value that will override the old value if it can be change
-
-Returns:
- EFI_SUCCESS - A state bit has been updated successfully
- Others - Access block device error.
-
-Notes:
- Assume all bits of State are inside the same BYTE.
-
- EFI_ABORTED - Read block fail
---*/
-;
-
-EFI_STATUS
-FtwGetLastRecord (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- OUT EFI_FTW_LITE_RECORD **FtwLastRecord
- )
-/*++
-
-Routine Description:
- Get the last Write record pointer.
- The last record is the record whose 'complete' state hasn't been set.
- After all, this header may be a EMPTY header entry for next Allocate.
-
-Arguments:
- FtwLiteDevice - Private data of this driver
- FtwLastRecord - Pointer to retrieve the last write record
-
-Returns:
- EFI_SUCCESS - Get the last write record successfully
- EFI_ABORTED - The FTW work space is damaged
-
---*/
-;
-
-BOOLEAN
-IsErasedFlashBuffer (
- IN BOOLEAN Polarity,
- IN UINT8 *Buffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
-
- Check whether a flash buffer is erased.
-
-Arguments:
-
- Polarity - All 1 or all 0
- Buffer - Buffer to check
- BufferSize - Size of the buffer
-
-Returns:
-
- Erased or not.
-
---*/
-;
-
-EFI_STATUS
-InitWorkSpaceHeader (
- IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader
- )
-/*++
-
-Routine Description:
- Initialize a work space when there is no work space.
-
-Arguments:
- WorkingHeader - Pointer of working block header
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully.
-
---*/
-;
-
-EFI_STATUS
-WorkSpaceRefresh (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Read from working block to refresh the work space in memory.
-
-Arguments:
- FtwLiteDevice - Point to private data of FTW driver
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully.
-
---*/
-;
-
-BOOLEAN
-IsValidWorkSpace (
- IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader
- )
-/*++
-
-Routine Description:
- Check to see if it is a valid work space.
-
-Arguments:
- WorkingHeader - Pointer of working block header
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully.
-
---*/
-;
-
-EFI_STATUS
-CleanupWorkSpace (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- IN OUT UINT8 *BlockBuffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
- Reclaim the work space. Get rid of all the completed write records
- and write records in the Fault Tolerant work space.
-
-Arguments:
- FtwLiteDevice - Point to private data of FTW driver
- FtwSpaceBuffer - Buffer to contain the reclaimed clean data
- BufferSize - Size of the FtwSpaceBuffer
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_BUFFER_TOO_SMALL - The FtwSpaceBuffer is too small
- EFI_ABORTED - The function could not complete successfully.
-
---*/
-;
-
-EFI_STATUS
-FtwReclaimWorkSpace (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Reclaim the work space on the working block.
-
-Arguments:
- FtwLiteDevice - Point to private data of FTW driver
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_OUT_OF_RESOURCES - Allocate memory error
- EFI_ABORTED - The function could not complete successfully
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.msa b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.msa
deleted file mode 100644
index e2419a4..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.msa
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>FtwLite</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>4C862FC6-0E54-4e36-8C8F-FF6F3167951F</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for FtwLite module.</Abstract>
- <Description>This driver provides fault tolerant write capability for block devices.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>FtwLite</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>FtwLite.h</Filename>
- <Filename>FtwLite.c</Filename>
- <Filename>FtwMisc.c</Filename>
- <Filename>FtwWorkSpace.c</Filename>
- <Filename>FtwLite.dxs</Filename>
- <Filename SupArchList="IA32">Ia32/Ia32FtwMisc.c</Filename>
- <Filename SupArchList="X64">x64/x64FtwMisc.c</Filename>
- <Filename SupArchList="IPF">Ipf/IpfFtwMisc.c</Filename>
- <Filename SupArchList="EBC">Ia32/Ia32FtwMisc.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiFaultTolerantWriteLiteProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED" SupArchList="IA32 EBC">
- <ProtocolCName>gEfiPciRootBridgeIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiSystemNvDataFvGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>InitializeFtwLite</ModuleEntryPoint>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>To get base address of the FTW spare block section in NV firmware volume.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>To get size of the FTW spare block section in NV firmware volume.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>To get base address of the FTW working block section in NV firmware volume.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>To get size of the FTW working block section in NV firmware volume.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwMisc.c b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwMisc.c
deleted file mode 100644
index eb334ea..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwMisc.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FtwMisc.c
-
-Abstract:
-
- Internal functions to support fault tolerant write.
-
-Revision History
-
---*/
-
-#include <FtwLite.h>
-
-BOOLEAN
-IsErasedFlashBuffer (
- IN BOOLEAN Polarity,
- IN UINT8 *Buffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
-
- Check whether a flash buffer is erased.
-
-Arguments:
-
- Polarity - All 1 or all 0
- Buffer - Buffer to check
- BufferSize - Size of the buffer
-
-Returns:
-
- Erased or not.
-
---*/
-{
- UINT8 ErasedValue;
- UINT8 *Ptr;
-
- if (Polarity) {
- ErasedValue = 0xFF;
- } else {
- ErasedValue = 0;
- }
-
- Ptr = Buffer;
- while (BufferSize--) {
- if (*Ptr++ != ErasedValue) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-EFI_STATUS
-FtwEraseBlock (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- EFI_LBA Lba
- )
-/*++
-
-Routine Description:
- To Erase one block. The size is FTW_BLOCK_SIZE
-
-Arguments:
- FtwLiteDevice - Calling context
- FvBlock - FVB Protocol interface
- Lba - Lba of the firmware block
-
-Returns:
- EFI_SUCCESS - Block LBA is Erased successfully
- Others - Error occurs
-
---*/
-{
- return FvBlock->EraseBlocks (
- FvBlock,
- Lba,
- FtwLiteDevice->NumberOfSpareBlock,
- EFI_LBA_LIST_TERMINATOR
- );
-}
-
-EFI_STATUS
-FtwEraseSpareBlock (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
-
- Erase spare block.
-
-Arguments:
-
- FtwLiteDevice - Calling context
-
-Returns:
-
- Status code
-
---*/
-{
- return FtwLiteDevice->FtwBackupFvb->EraseBlocks (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba,
- FtwLiteDevice->NumberOfSpareBlock,
- EFI_LBA_LIST_TERMINATOR
- );
-}
-
-EFI_STATUS
-FtwGetFvbByHandle (
- IN EFI_HANDLE FvBlockHandle,
- OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock
- )
-/*++
-
-Routine Description:
- Retrive the proper FVB protocol interface by HANDLE.
-
-Arguments:
- FvBlockHandle - The handle of FVB protocol that provides services for
- reading, writing, and erasing the target block.
- FvBlock - The interface of FVB protocol
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully
---*/
-{
- //
- // To get the FVB protocol interface on the handle
- //
- return gBS->HandleProtocol (
- FvBlockHandle,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID **) FvBlock
- );
-}
-
-EFI_STATUS
-GetFvbByAddress (
- IN EFI_PHYSICAL_ADDRESS Address,
- OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock
- )
-/*++
-
-Routine Description:
-
- Get firmware block by address.
-
-Arguments:
-
- Address - Address specified the block
- FvBlock - The block caller wanted
-
-Returns:
-
- Status code
-
- EFI_NOT_FOUND - Block not found
-
---*/
-{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- UINTN Index;
- EFI_PHYSICAL_ADDRESS FvbBaseAddress;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
-
- *FvBlock = NULL;
- //
- // Locate all handles of Fvb protocol
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- //
- // Search all FVB until find the right one
- //
- for (Index = 0; Index < HandleCount; Index += 1) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID **) &Fvb
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_NOT_FOUND;
- break;
- }
- //
- // Compare the address and select the right one
- //
- Status = Fvb->GetPhysicalAddress (Fvb, &FvbBaseAddress);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) FvbBaseAddress);
- if ((Address >= FvbBaseAddress) && (Address <= (FvbBaseAddress + (FwVolHeader->FvLength - 1)))) {
- *FvBlock = Fvb;
- Status = EFI_SUCCESS;
- break;
- }
- }
-
- FreePool (HandleBuffer);
- return Status;
-}
-
-BOOLEAN
-IsInWorkingBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- EFI_LBA Lba
- )
-/*++
-
-Routine Description:
-
- Is it in working block?
-
-Arguments:
-
- FtwLiteDevice - Calling context
- FvBlock - Fvb protocol instance
- Lba - The block specified
-
-Returns:
-
- In working block or not
-
---*/
-{
- //
- // If matching the following condition, the target block is in working block.
- // 1. Target block is on the FV of working block (Using the same FVB protocol instance).
- // 2. Lba falls into the range of working block.
- //
- return (BOOLEAN)
- (
- (FvBlock == FtwLiteDevice->FtwFvBlock) &&
- (Lba >= FtwLiteDevice->FtwWorkBlockLba) &&
- (Lba <= FtwLiteDevice->FtwWorkSpaceLba)
- );
-}
-
-EFI_STATUS
-FlushSpareBlockToTargetBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- EFI_LBA Lba
- )
-/*++
-
-Routine Description:
- Copy the content of spare block to a target block. Size is FTW_BLOCK_SIZE.
- Spare block is accessed by FTW backup FVB protocol interface. LBA is
- FtwLiteDevice->FtwSpareLba.
- Target block is accessed by FvBlock protocol interface. LBA is Lba.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
- FvBlock - FVB Protocol interface to access target block
- Lba - Lba of the target block
-
-Returns:
- EFI_SUCCESS - Spare block content is copied to target block
- EFI_INVALID_PARAMETER - Input parameter error
- EFI_OUT_OF_RESOURCES - Allocate memory error
- EFI_ABORTED - The function could not complete successfully
-
---*/
-{
- EFI_STATUS Status;
- UINTN Length;
- UINT8 *Buffer;
- UINTN Count;
- UINT8 *Ptr;
- UINTN Index;
-
- if ((FtwLiteDevice == NULL) || (FvBlock == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Allocate a memory buffer
- //
- Length = FtwLiteDevice->SpareAreaLength;
- Buffer = AllocatePool (Length);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Read all content of spare block to memory buffer
- //
- Ptr = Buffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Count = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwBackupFvb->Read (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + Index,
- 0,
- &Count,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (Buffer);
- return Status;
- }
-
- Ptr += Count;
- }
- //
- // Erase the target block
- //
- Status = FtwEraseBlock (FtwLiteDevice, FvBlock, Lba);
- if (EFI_ERROR (Status)) {
- FreePool (Buffer);
- return EFI_ABORTED;
- }
- //
- // Write memory buffer to block, using the FvbBlock protocol interface
- //
- Ptr = Buffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Count = FtwLiteDevice->SizeOfSpareBlock;
- Status = FvBlock->Write (FvBlock, Lba + Index, 0, &Count, Ptr);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: FVB Write block - %r\n", Status));
- FreePool (Buffer);
- return Status;
- }
-
- Ptr += Count;
- }
-
- FreePool (Buffer);
-
- return Status;
-}
-
-EFI_STATUS
-FlushSpareBlockToWorkingBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Copy the content of spare block to working block. Size is FTW_BLOCK_SIZE.
- Spare block is accessed by FTW backup FVB protocol interface. LBA is
- FtwLiteDevice->FtwSpareLba.
- Working block is accessed by FTW working FVB protocol interface. LBA is
- FtwLiteDevice->FtwWorkBlockLba.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
-
-Returns:
- EFI_SUCCESS - Spare block content is copied to target block
- EFI_OUT_OF_RESOURCES - Allocate memory error
- EFI_ABORTED - The function could not complete successfully
-
-Notes:
- Since the working block header is important when FTW initializes, the
- state of the operation should be handled carefully. The Crc value is
- calculated without STATE element.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Length;
- UINT8 *Buffer;
- EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingBlockHeader;
- EFI_LBA WorkSpaceLbaOffset;
- UINTN Count;
- UINT8 *Ptr;
- UINTN Index;
-
- //
- // Allocate a memory buffer
- //
- Length = FtwLiteDevice->SpareAreaLength;
- Buffer = AllocatePool (Length);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // To guarantee that the WorkingBlockValid is set on spare block
- //
- WorkSpaceLbaOffset = FtwLiteDevice->FtwWorkSpaceLba - FtwLiteDevice->FtwWorkBlockLba;
- FtwUpdateFvState (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + WorkSpaceLbaOffset,
- FtwLiteDevice->FtwWorkSpaceBase + sizeof (EFI_GUID) + sizeof (UINT32),
- WORKING_BLOCK_VALID
- );
- //
- // Read from spare block to memory buffer
- //
- Ptr = Buffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Count = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwBackupFvb->Read (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + Index,
- 0,
- &Count,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (Buffer);
- return Status;
- }
-
- Ptr += Count;
- }
- //
- // Clear the CRC and STATE, copy data from spare to working block.
- //
- WorkingBlockHeader = (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *) (Buffer + (UINTN) WorkSpaceLbaOffset * FtwLiteDevice->SizeOfSpareBlock + FtwLiteDevice->FtwWorkSpaceBase);
- InitWorkSpaceHeader (WorkingBlockHeader);
- WorkingBlockHeader->WorkingBlockValid = FTW_ERASE_POLARITY;
- WorkingBlockHeader->WorkingBlockInvalid = FTW_ERASE_POLARITY;
-
- //
- // target block is working block, then
- // Set WorkingBlockInvalid in EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER
- // before erase the working block.
- //
- // Offset = EFI_FIELD_OFFSET(EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER,
- // WorkingBlockInvalid);
- // To skip Signature and Crc: sizeof(EFI_GUID)+sizeof(UINT32).
- //
- Status = FtwUpdateFvState (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkSpaceLba,
- FtwLiteDevice->FtwWorkSpaceBase + sizeof (EFI_GUID) + sizeof (UINT32),
- WORKING_BLOCK_INVALID
- );
- if (EFI_ERROR (Status)) {
- FreePool (Buffer);
- return EFI_ABORTED;
- }
-
- FtwLiteDevice->FtwWorkSpaceHeader->WorkingBlockInvalid = FTW_VALID_STATE;
-
- //
- // Erase the working block
- //
- Status = FtwEraseBlock (
- FtwLiteDevice,
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkBlockLba
- );
- if (EFI_ERROR (Status)) {
- FreePool (Buffer);
- return EFI_ABORTED;
- }
- //
- // Write memory buffer to working block, using the FvbBlock protocol interface
- //
- Ptr = Buffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Count = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwFvBlock->Write (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkBlockLba + Index,
- 0,
- &Count,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: FVB Write block - %r\n", Status));
- FreePool (Buffer);
- return Status;
- }
-
- Ptr += Count;
- }
- //
- // Since the memory buffer will not be used, free memory Buffer.
- //
- FreePool (Buffer);
-
- //
- // Update the VALID of the working block
- //
- // Offset = EFI_FIELD_OFFSET(EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER,
- // WorkingBlockValid);
- // Hardcode offset sizeof(EFI_GUID)+sizeof(UINT32), to skip Signature and Crc
- //
- Status = FtwUpdateFvState (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkSpaceLba,
- FtwLiteDevice->FtwWorkSpaceBase + sizeof (EFI_GUID) + sizeof (UINT32),
- WORKING_BLOCK_VALID
- );
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- FtwLiteDevice->FtwWorkSpaceHeader->WorkingBlockValid = FTW_VALID_STATE;
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwWorkSpace.c b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwWorkSpace.c
deleted file mode 100644
index 00d7d8e..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwWorkSpace.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FtwWorkSpace.c
-
-Abstract:
-
-Revision History
-
---*/
-
-
-#include <FtwLite.h>
-
-BOOLEAN
-IsValidWorkSpace (
- IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader
- )
-/*++
-
-Routine Description:
- Check to see if it is a valid work space.
-
-Arguments:
- WorkingHeader - Pointer of working block header
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully.
-
---*/
-{
- EFI_STATUS Status;
- EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER WorkingBlockHeader;
-
- ASSERT (WorkingHeader != NULL);
- if (WorkingHeader->WorkingBlockValid != FTW_VALID_STATE) {
- return FALSE;
- }
- //
- // Check signature with gEfiSystemNvDataFvGuid
- //
- if (!CompareGuid (&gEfiSystemNvDataFvGuid, &WorkingHeader->Signature)) {
- return FALSE;
- }
- //
- // Check the CRC of header
- //
- CopyMem (
- &WorkingBlockHeader,
- WorkingHeader,
- sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER)
- );
-
- //
- // Filter out the Crc and State fields
- //
- SetMem (
- &WorkingBlockHeader.Crc,
- sizeof (UINT32),
- FTW_ERASED_BYTE
- );
- WorkingBlockHeader.WorkingBlockValid = FTW_ERASE_POLARITY;
- WorkingBlockHeader.WorkingBlockInvalid = FTW_ERASE_POLARITY;
-
- //
- // Calculate the Crc of woking block header
- //
- Status = gBS->CalculateCrc32 (
- (UINT8 *) &WorkingBlockHeader,
- sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER),
- &WorkingBlockHeader.Crc
- );
- ASSERT_EFI_ERROR (Status);
-
- if (WorkingBlockHeader.Crc != WorkingHeader->Crc) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Work block header CRC check error\n"));
- return FALSE;
- }
-
- return TRUE;
-}
-
-EFI_STATUS
-InitWorkSpaceHeader (
- IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader
- )
-/*++
-
-Routine Description:
- Initialize a work space when there is no work space.
-
-Arguments:
- WorkingHeader - Pointer of working block header
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully.
-
---*/
-{
- EFI_STATUS Status;
-
- ASSERT (WorkingHeader != NULL);
-
- //
- // Here using gEfiSystemNvDataFvGuid as the signature.
- //
- CopyMem (
- &WorkingHeader->Signature,
- &gEfiSystemNvDataFvGuid,
- sizeof (EFI_GUID)
- );
- WorkingHeader->WriteQueueSize = FTW_WORKING_QUEUE_SIZE;
-
- //
- // Crc is calculated with all the fields except Crc and STATE
- //
- WorkingHeader->WorkingBlockValid = FTW_ERASE_POLARITY;
- WorkingHeader->WorkingBlockInvalid = FTW_ERASE_POLARITY;
- SetMem (&WorkingHeader->Crc, sizeof (UINT32), FTW_ERASED_BYTE);
-
- //
- // Calculate the CRC value
- //
- Status = gBS->CalculateCrc32 (
- (UINT8 *) WorkingHeader,
- sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER),
- &WorkingHeader->Crc
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Restore the WorkingBlockValid flag to VALID state
- //
- WorkingHeader->WorkingBlockValid = FTW_VALID_STATE;
- WorkingHeader->WorkingBlockInvalid = FTW_INVALID_STATE;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FtwUpdateFvState (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN UINT8 NewBit
- )
-/*++
-
-Routine Description:
- Update a bit of state on a block device. The location of the bit is
- calculated by the (Lba, Offset, bit). Here bit is determined by the
- the name of a certain bit.
-
-Arguments:
- FvBlock - FVB Protocol interface to access SrcBlock and DestBlock
- Lba - Lba of a block
- Offset - Offset on the Lba
- NewBit - New value that will override the old value if it can be change
-
-Returns:
- EFI_SUCCESS - A state bit has been updated successfully
- Others - Access block device error.
-
-Notes:
- Assume all bits of State are inside the same BYTE.
-
- EFI_ABORTED - Read block fail
---*/
-{
- EFI_STATUS Status;
- UINT8 State;
- UINTN Length;
-
- //
- // Read state from device, assume State is only one byte.
- //
- Length = sizeof (UINT8);
- Status = FvBlock->Read (FvBlock, Lba, Offset, &Length, &State);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
-
- State ^= FTW_POLARITY_REVERT;
- State = (UINT8) (State | NewBit);
- State ^= FTW_POLARITY_REVERT;
-
- //
- // Write state back to device
- //
- Length = sizeof (UINT8);
- Status = FvBlock->Write (FvBlock, Lba, Offset, &Length, &State);
-
- return Status;
-}
-
-EFI_STATUS
-FtwGetLastRecord (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- OUT EFI_FTW_LITE_RECORD **FtwLastRecord
- )
-/*++
-
-Routine Description:
- Get the last Write record pointer.
- The last record is the record whose 'complete' state hasn't been set.
- After all, this header may be a EMPTY header entry for next Allocate.
-
-Arguments:
- FtwLiteDevice - Private data of this driver
- FtwLastRecord - Pointer to retrieve the last write record
-
-Returns:
- EFI_SUCCESS - Get the last write record successfully
- EFI_ABORTED - The FTW work space is damaged
-
---*/
-{
- EFI_FTW_LITE_RECORD *Record;
-
- Record = (EFI_FTW_LITE_RECORD *) (FtwLiteDevice->FtwWorkSpaceHeader + 1);
- while (Record->WriteCompleted == FTW_VALID_STATE) {
- //
- // If Offset exceed the FTW work space boudary, return error.
- //
- if ((UINTN) ((UINT8 *) Record - FtwLiteDevice->FtwWorkSpace) > FtwLiteDevice->FtwWorkSpaceSize) {
- return EFI_ABORTED;
- }
-
- Record++;
- }
- //
- // Last write record is found
- //
- *FtwLastRecord = Record;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-WorkSpaceRefresh (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Read from working block to refresh the work space in memory.
-
-Arguments:
- FtwLiteDevice - Point to private data of FTW driver
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Length;
- UINTN Offset;
- EFI_FTW_LITE_RECORD *Record;
-
- //
- // Initialize WorkSpace as FTW_ERASED_BYTE
- //
- SetMem (
- FtwLiteDevice->FtwWorkSpace,
- FtwLiteDevice->FtwWorkSpaceSize,
- FTW_ERASED_BYTE
- );
-
- //
- // Read from working block
- //
- Length = FtwLiteDevice->FtwWorkSpaceSize;
- Status = FtwLiteDevice->FtwFvBlock->Read (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkSpaceLba,
- FtwLiteDevice->FtwWorkSpaceBase,
- &Length,
- FtwLiteDevice->FtwWorkSpace
- );
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- //
- // Refresh the FtwLastRecord
- //
- Status = FtwGetLastRecord (FtwLiteDevice, &FtwLiteDevice->FtwLastRecord);
-
- Record = FtwLiteDevice->FtwLastRecord;
- Offset = (UINTN) (UINT8 *) Record - (UINTN) FtwLiteDevice->FtwWorkSpace;
-
- //
- // IF work space has error or Record is out of the workspace limit, THEN
- // call reclaim.
- //
- if (EFI_ERROR (Status) || (Offset + WRITE_TOTAL_SIZE >= FtwLiteDevice->FtwWorkSpaceSize)) {
- //
- // reclaim work space in working block.
- //
- Status = FtwReclaimWorkSpace (FtwLiteDevice);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: Reclaim workspace - %r\n", Status));
- return EFI_ABORTED;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CleanupWorkSpace (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- IN OUT UINT8 *FtwSpaceBuffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
- Reclaim the work space. Get rid of all the completed write records
- and write records in the Fault Tolerant work space.
-
-Arguments:
- FtwLiteDevice - Point to private data of FTW driver
- FtwSpaceBuffer - Buffer to contain the reclaimed clean data
- BufferSize - Size of the FtwSpaceBuffer
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_BUFFER_TOO_SMALL - The FtwSpaceBuffer is too small
- EFI_ABORTED - The function could not complete successfully.
-
---*/
-{
- UINTN Length;
- EFI_FTW_LITE_RECORD *Record;
-
- //
- // To check if the buffer is large enough
- //
- Length = FtwLiteDevice->FtwWorkSpaceSize;
- if (BufferSize < Length) {
- return EFI_BUFFER_TOO_SMALL;
- }
- //
- // Clear the content of buffer that will save the new work space data
- //
- SetMem (FtwSpaceBuffer, Length, FTW_ERASED_BYTE);
-
- //
- // Copy EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER to buffer
- //
- CopyMem (
- FtwSpaceBuffer,
- FtwLiteDevice->FtwWorkSpaceHeader,
- sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER)
- );
-
- //
- // Get the last record
- //
- Record = FtwLiteDevice->FtwLastRecord;
- if ((Record != NULL) && (Record->WriteAllocated == FTW_VALID_STATE) && (Record->WriteCompleted != FTW_VALID_STATE)) {
- CopyMem (
- (UINT8 *) FtwSpaceBuffer + sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER),
- Record,
- WRITE_TOTAL_SIZE
- );
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FtwReclaimWorkSpace (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Reclaim the work space on the working block.
-
-Arguments:
- FtwLiteDevice - Point to private data of FTW driver
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_OUT_OF_RESOURCES - Allocate memory error
- EFI_ABORTED - The function could not complete successfully
-
---*/
-{
- EFI_STATUS Status;
- UINT8 *TempBuffer;
- UINTN TempBufferSize;
- UINT8 *Ptr;
- UINTN Length;
- UINTN Index;
- UINTN SpareBufferSize;
- UINT8 *SpareBuffer;
- EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingBlockHeader;
-
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: start to reclaim work space\n"));
-
- //
- // Read all original data from working block to a memory buffer
- //
- TempBufferSize = FtwLiteDevice->SpareAreaLength;
- TempBuffer = AllocateZeroPool (TempBufferSize);
- if (TempBuffer != NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Ptr = TempBuffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Length = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwFvBlock->Read (
- FtwLiteDevice->FtwFvBlock,
- FtwLiteDevice->FtwWorkBlockLba + Index,
- 0,
- &Length,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (TempBuffer);
- return EFI_ABORTED;
- }
-
- Ptr += Length;
- }
- //
- // Clean up the workspace, remove all the completed records.
- //
- Ptr = TempBuffer +
- ((UINTN) (FtwLiteDevice->FtwWorkSpaceLba - FtwLiteDevice->FtwWorkBlockLba)) *
- FtwLiteDevice->SizeOfSpareBlock + FtwLiteDevice->FtwWorkSpaceBase;
-
- Status = CleanupWorkSpace (
- FtwLiteDevice,
- Ptr,
- FtwLiteDevice->FtwWorkSpaceSize
- );
-
- CopyMem (
- FtwLiteDevice->FtwWorkSpace,
- Ptr,
- FtwLiteDevice->FtwWorkSpaceSize
- );
-
- Status = FtwGetLastRecord (FtwLiteDevice, &FtwLiteDevice->FtwLastRecord);
-
- //
- // Set the WorkingBlockValid and WorkingBlockInvalid as INVALID
- //
- WorkingBlockHeader = (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *) Ptr;
- WorkingBlockHeader->WorkingBlockValid = FTW_INVALID_STATE;
- WorkingBlockHeader->WorkingBlockInvalid = FTW_INVALID_STATE;
-
- //
- // Try to keep the content of spare block
- // Save spare block into a spare backup memory buffer (Sparebuffer)
- //
- SpareBufferSize = FtwLiteDevice->SpareAreaLength;
- SpareBuffer = AllocatePool (SpareBufferSize);
- if (SpareBuffer == NULL) {
- FreePool (TempBuffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Ptr = SpareBuffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Length = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwBackupFvb->Read (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + Index,
- 0,
- &Length,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (TempBuffer);
- FreePool (SpareBuffer);
- return EFI_ABORTED;
- }
-
- Ptr += Length;
- }
- //
- // Write the memory buffer to spare block
- //
- Status = FtwEraseSpareBlock (FtwLiteDevice);
- Ptr = TempBuffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Length = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwBackupFvb->Write (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + Index,
- 0,
- &Length,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (TempBuffer);
- FreePool (SpareBuffer);
- return EFI_ABORTED;
- }
-
- Ptr += Length;
- }
- //
- // Free TempBuffer
- //
- FreePool (TempBuffer);
-
- //
- // Write the spare block to working block
- //
- Status = FlushSpareBlockToWorkingBlock (FtwLiteDevice);
- if (EFI_ERROR (Status)) {
- FreePool (SpareBuffer);
- return Status;
- }
- //
- // Restore spare backup buffer into spare block , if no failure happened during FtwWrite.
- //
- Status = FtwEraseSpareBlock (FtwLiteDevice);
- Ptr = SpareBuffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Length = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwBackupFvb->Write (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + Index,
- 0,
- &Length,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (SpareBuffer);
- return EFI_ABORTED;
- }
-
- Ptr += Length;
- }
-
- FreePool (SpareBuffer);
-
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: reclaim work space success\n"));
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/Ia32/Ia32FtwMisc.c b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/Ia32/Ia32FtwMisc.c
deleted file mode 100644
index 6425f29..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/Ia32/Ia32FtwMisc.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ia32FtwMisc.c
-
-Abstract:
-
- Ia32 platform related code to support FtwLite..
-
-Revision History
-
---*/
-
-
-#include <FtwLite.h>
-
-//
-// MACROs for boot block update
-//
-#define BOOT_BLOCK_BASE 0xFFFF0000
-
-//
-// (LPC -- D31:F0)
-//
-#define LPC_BUS_NUMBER 0x00
-#define LPC_DEVICE_NUMBER 0x1F
-#define LPC_IF 0xF0
-//
-// Top swap
-//
-#define GEN_STATUS 0xD4
-#define TOP_SWAP_BIT (1 << 13)
-
-STATIC
-UINT32
-ReadPciRegister (
- IN UINT32 Offset
- )
-/*++
-
-Routine Description:
-
- Read PCI register value.
-
-Arguments:
-
- Offset - Offset of the register
-
-Returns:
-
- The value.
-
---*/
-{
- EFI_STATUS Status;
- UINT32 Value;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
-
- Value = 0;
- Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID **) &PciRootBridgeIo);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "FtwLite: Locate PCI root bridge io protocol - %r", Status));
- return 0;
- }
-
- Status = PciRootBridgeIo->Pci.Read (
- PciRootBridgeIo,
- EfiPciWidthUint32,
- EFI_PCI_ADDRESS (
- LPC_BUS_NUMBER,
- LPC_DEVICE_NUMBER,
- LPC_IF,
- Offset
- ),
- 1,
- &Value
- );
- ASSERT_EFI_ERROR (Status);
-
- return Value;
-}
-
-STATIC
-EFI_STATUS
-GetSwapState (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- OUT BOOLEAN *SwapState
- )
-/*++
-
-Routine Description:
-
- Get swap state
-
-Arguments:
-
- FtwLiteDevice - Calling context
- SwapState - Swap state
-
-Returns:
-
- EFI_SUCCESS - State successfully got
-
---*/
-{
- //
- // Top swap status is 13 bit
- //
- *SwapState = (BOOLEAN) ((ReadPciRegister (GEN_STATUS) & TOP_SWAP_BIT) != 0);
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-SetSwapState (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- IN BOOLEAN TopSwap
- )
-/*++
-
-Routine Description:
- Set swap state.
-
-Arguments:
- FtwLiteDevice - Indicates a pointer to the calling context.
- TopSwap - New swap state
-
-Returns:
- EFI_SUCCESS - The function completed successfully
-
-Note:
- the Top-Swap bit (bit 13, D31: F0, Offset D4h). Note that
- software will not be able to clear the Top-Swap bit until the system is
- rebooted without GNT[A]# being pulled down.
-
---*/
-{
- UINT32 GenStatus;
- EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
- EFI_STATUS Status;
-
- //
- // Top-Swap bit (bit 13, D31: F0, Offset D4h)
- //
- GenStatus = ReadPciRegister (GEN_STATUS);
-
- //
- // Set 13 bit, according to input NewSwapState
- //
- if (TopSwap) {
- GenStatus |= TOP_SWAP_BIT;
- } else {
- GenStatus &= ~TOP_SWAP_BIT;
- }
-
- Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID **) &PciRootBridgeIo);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "FtwLite: Locate PCI root bridge io protocol - %r", Status));
- return Status;
- }
- //
- // Write back the GenStatus register
- //
- Status = PciRootBridgeIo->Pci.Write (
- PciRootBridgeIo,
- EfiPciWidthUint32,
- EFI_PCI_ADDRESS (
- LPC_BUS_NUMBER,
- LPC_DEVICE_NUMBER,
- LPC_IF,
- GEN_STATUS
- ),
- 1,
- &GenStatus
- );
-
- DEBUG_CODE_BEGIN ();
- if (TopSwap) {
- DEBUG ((EFI_D_ERROR, "SAR: Set top swap\n"));
- } else {
- DEBUG ((EFI_D_ERROR, "SAR: Clear top swap\n"));
- }
- DEBUG_CODE_END ();
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-IsBootBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- EFI_LBA Lba
- )
-/*++
-
-Routine Description:
-
- Check whether the block is a boot block.
-
-Arguments:
-
- FtwLiteDevice - Calling context
- FvBlock - Fvb protocol instance
- Lba - Lba value
-
-Returns:
-
- Is a boot block or not
-
---*/
-{
- EFI_STATUS Status;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *BootFvb;
-
- Status = GetFvbByAddress (BOOT_BLOCK_BASE, &BootFvb);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
- //
- // Compare the Fvb
- //
- return (BOOLEAN) (FvBlock == BootFvb);
-}
-
-EFI_STATUS
-FlushSpareBlockToBootBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.
- Spare block is accessed by FTW backup FVB protocol interface. LBA is
- FtwLiteDevice->FtwSpareLba.
- Boot block is accessed by BootFvb protocol interface. LBA is 0.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
-
-Returns:
- EFI_SUCCESS - Spare block content is copied to boot block
- EFI_INVALID_PARAMETER - Input parameter error
- EFI_OUT_OF_RESOURCES - Allocate memory error
- EFI_ABORTED - The function could not complete successfully
-
-Notes:
- FTW will do extra work on boot block update.
- FTW should depend on a protocol of EFI_ADDRESS_RANGE_SWAP_PROTOCOL,
- which is produced by a chipset driver.
-
- FTW updating boot block steps:
- 1. Erase top swap block (0xFFFE-0xFFFEFFFF) and write data to it ready
- 2. Read data from top swap block to memory buffer
- 3. SetSwapState(EFI_SWAPPED)
- 4. Erasing boot block (0xFFFF-0xFFFFFFFF)
- 5. Programming boot block until the boot block is ok.
- 6. SetSwapState(UNSWAPPED)
-
- Notes:
- 1. Since the SwapState bit is saved in CMOS, FTW can restore and continue
- even in the scenario of power failure.
- 2. FTW shall not allow to update boot block when battery state is error.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Length;
- UINT8 *Buffer;
- UINTN Count;
- UINT8 *Ptr;
- UINTN Index;
- BOOLEAN TopSwap;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *BootFvb;
- EFI_LBA BootLba;
-
- //
- // Allocate a memory buffer
- //
- Length = FtwLiteDevice->SpareAreaLength;
- Buffer = AllocatePool (Length);
- if (Buffer == NULL) {
- }
- //
- // Get TopSwap bit state
- //
- Status = GetSwapState (FtwLiteDevice, &TopSwap);
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "FtwLite: Get Top Swapped status - %r\n", Status));
- FreePool (Buffer);
- return EFI_ABORTED;
- }
-
- if (TopSwap) {
- //
- // Get FVB of current boot block
- //
- Status = GetFvbByAddress (FtwLiteDevice->SpareAreaAddress + FTW_BLOCK_SIZE, &BootFvb);
- if (EFI_ERROR (Status)) {
- FreePool (Buffer);
- return Status;
- }
- //
- // Read data from current boot block
- //
- BootLba = 0;
- Ptr = Buffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Count = FtwLiteDevice->SizeOfSpareBlock;
- Status = BootFvb->Read (
- BootFvb,
- BootLba + Index,
- 0,
- &Count,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (Buffer);
- return Status;
- }
-
- Ptr += Count;
- }
-
- } else {
- //
- // Read data from spare block
- //
- Ptr = Buffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Count = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwBackupFvb->Read (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + Index,
- 0,
- &Count,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- FreePool (Buffer);
- return Status;
- }
-
- Ptr += Count;
- }
- //
- // Set TopSwap bit
- //
- Status = SetSwapState (FtwLiteDevice, TRUE);
- DEBUG ((EFI_D_ERROR, "FtwLite: Set Swap State - %r\n", Status));
- ASSERT_EFI_ERROR (Status);
- }
- //
- // Erase boot block. After setting TopSwap bit, it's spare block now!
- //
- Status = FtwEraseSpareBlock (FtwLiteDevice);
- if (EFI_ERROR (Status)) {
- FreePool (Buffer);
- return EFI_ABORTED;
- }
- //
- // Write memory buffer to currenet spare block
- //
- Ptr = Buffer;
- for (Index = 0; Index < FtwLiteDevice->NumberOfSpareBlock; Index += 1) {
- Count = FtwLiteDevice->SizeOfSpareBlock;
- Status = FtwLiteDevice->FtwBackupFvb->Write (
- FtwLiteDevice->FtwBackupFvb,
- FtwLiteDevice->FtwSpareLba + Index,
- 0,
- &Count,
- Ptr
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_FTW_LITE, "FtwLite: FVB Write boot block - %r\n", Status));
- FreePool (Buffer);
- return Status;
- }
-
- Ptr += Count;
- }
-
- FreePool (Buffer);
-
- //
- // Clear TopSwap bit
- //
- Status = SetSwapState (FtwLiteDevice, FALSE);
- DEBUG ((EFI_D_ERROR, "FtwLite: Clear Swap State - %r\n", Status));
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/Ipf/IpfFtwMisc.c b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/Ipf/IpfFtwMisc.c
deleted file mode 100644
index d31883b..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/Ipf/IpfFtwMisc.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- IpfFtwMisc.c
-
-Abstract:
-
- Ipf platform related code to support FtwLite..
-
-Revision History
-
---*/
-
-
-#include <FtwLite.h>
-
-//
-// MACROs for boot block update
-//
-#define BOOT_BLOCK_BASE
-
-STATIC
-EFI_STATUS
-GetSwapState (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- OUT BOOLEAN *SwapState
- )
-/*++
-
-Routine Description:
-
- Get swap state
-
-Arguments:
-
- FtwLiteDevice - Calling context
- SwapState - Swap state
-
-Returns:
-
- EFI_SUCCESS - State successfully got
-
---*/
-{
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-SetSwapState (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- IN BOOLEAN TopSwap
- )
-/*++
-
-Routine Description:
- Set swap state.
-
-Arguments:
- FtwLiteDevice - Indicates a pointer to the calling context.
- TopSwap - New swap state
-
-Returns:
- EFI_SUCCESS - The function completed successfully
-
-Note:
- the Top-Swap bit (bit 13, D31: F0, Offset D4h). Note that
- software will not be able to clear the Top-Swap bit until the system is
- rebooted without GNT[A]# being pulled down.
-
---*/
-{
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-IsBootBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- EFI_LBA Lba
- )
-/*++
-
-Routine Description:
-
- Check whether the block is a boot block.
-
-Arguments:
-
- FtwLiteDevice - Calling context
- FvBlock - Fvb protocol instance
- Lba - Lba value
-
-Returns:
-
- Is a boot block or not
-
---*/
-{
- //
- // IPF doesn't support safe bootblock update
- // so treat bootblock as normal block
- //
- return FALSE;
-}
-
-EFI_STATUS
-FlushSpareBlockToBootBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.
- Spare block is accessed by FTW backup FVB protocol interface. LBA is
- FtwLiteDevice->FtwSpareLba.
- Boot block is accessed by BootFvb protocol interface. LBA is 0.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
-
-Returns:
- EFI_SUCCESS - Spare block content is copied to boot block
- EFI_INVALID_PARAMETER - Input parameter error
- EFI_OUT_OF_RESOURCES - Allocate memory error
- EFI_ABORTED - The function could not complete successfully
-
-Notes:
-
---*/
-{
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/x64/x64FtwMisc.c b/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/x64/x64FtwMisc.c
deleted file mode 100644
index d8e3a03..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/x64/x64FtwMisc.c
+++ /dev/null
@@ -1,140 +0,0 @@
-
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- x64FtwMisc.c
-
-Abstract:
-
- X64 platform related code to support FtwLite..
-
-Revision History
-
---*/
-
-
-#include <FtwLite.h>
-
-//
-// MACROs for boot block update
-//
-#define BOOT_BLOCK_BASE
-
-// STATIC
-EFI_STATUS
-GetSwapState (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- OUT BOOLEAN *SwapState
- )
-/*++
-
-Routine Description:
-
- Get swap state
-
-Arguments:
-
- FtwLiteDevice - Calling context
- SwapState - Swap state
-
-Returns:
-
- EFI_SUCCESS - State successfully got
-
---*/
-{
- return EFI_SUCCESS;
-}
-
-// STATIC
-EFI_STATUS
-SetSwapState (
- IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- IN BOOLEAN TopSwap
- )
-/*++
-
-Routine Description:
- Set swap state.
-
-Arguments:
- FtwLiteDevice - Indicates a pointer to the calling context.
- TopSwap - New swap state
-
-Returns:
- EFI_SUCCESS - The function completed successfully
-
-Note:
- the Top-Swap bit (bit 13, D31: F0, Offset D4h). Note that
- software will not be able to clear the Top-Swap bit until the system is
- rebooted without GNT[A]# being pulled down.
-
---*/
-{
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-IsBootBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice,
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,
- EFI_LBA Lba
- )
-/*++
-
-Routine Description:
-
- Check whether the block is a boot block.
-
-Arguments:
-
- FtwLiteDevice - Calling context
- FvBlock - Fvb protocol instance
- Lba - Lba value
-
-Returns:
-
- Is a boot block or not
-
---*/
-{
- return FALSE;
-}
-
-EFI_STATUS
-FlushSpareBlockToBootBlock (
- EFI_FTW_LITE_DEVICE *FtwLiteDevice
- )
-/*++
-
-Routine Description:
- Copy the content of spare block to a boot block. Size is FTW_BLOCK_SIZE.
- Spare block is accessed by FTW backup FVB protocol interface. LBA is
- FtwLiteDevice->FtwSpareLba.
- Boot block is accessed by BootFvb protocol interface. LBA is 0.
-
-Arguments:
- FtwLiteDevice - The private data of FTW_LITE driver
-
-Returns:
- EFI_SUCCESS - Spare block content is copied to boot block
- EFI_INVALID_PARAMETER - Input parameter error
- EFI_OUT_OF_RESOURCES - Allocate memory error
- EFI_ABORTED - The function could not complete successfully
-
-Notes:
-
---*/
-{
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.c b/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.c
deleted file mode 100644
index de9ba83..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Crc32SectionExtract.c
-
-Abstract:
-
- Implements GUIDed section extraction protocol interface with
- a specific GUID: CRC32.
-
- Please refer to the Framewokr Firmware Volume Specification 0.9.
-
---*/
-
-
-#include <GuidedSection.h>
-#include <Crc32SectionExtract.h>
-
-EFI_STATUS
-EFIAPI
-InitializeCrc32GuidedSectionExtractionProtocol (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Entry point of the CRC32 GUIDed section extraction protocol.
- Creates and initializes an instance of the GUIDed section
- extraction protocol with CRC32 GUID.
-
-Arguments:
-
- ImageHandle EFI_HANDLE: A handle for the image that is initializing
- this driver
- SystemTable EFI_SYSTEM_TABLE: A pointer to the EFI system table
-
-Returns:
-
- EFI_SUCCESS: Driver initialized successfully
- EFI_LOAD_ERROR: Failed to Initialize or has been loaded
- EFI_OUT_OF_RESOURCES: Could not allocate needed resources
-
---*/
-{
- EFI_STATUS Status;
- EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *Crc32GuidedSep;
- EFI_HANDLE Handle;
-
- //
- // Call all constructors per produced protocols
- //
- Status = GuidedSectionExtractionProtocolConstructor (
- &Crc32GuidedSep,
- (EFI_EXTRACT_GUIDED_SECTION) Crc32ExtractSection
- );
- if (EFI_ERROR (Status)) {
- if (Crc32GuidedSep != NULL) {
- FreePool (Crc32GuidedSep);
- }
-
- return Status;
- }
- //
- // Pass in a NULL to install to a new handle
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiCrc32GuidedSectionExtractionProtocolGuid,
- EFI_NATIVE_INTERFACE,
- Crc32GuidedSep
- );
- if (EFI_ERROR (Status)) {
- FreePool (Crc32GuidedSep);
- return EFI_LOAD_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-UINT32
-EFIAPI
-GetSectionLength (
- IN EFI_COMMON_SECTION_HEADER *CommonHeader
- )
-/*++
-
- Routine Description:
- Get a length of section.
-
- Parameters:
- CommonHeader - Pointer to the common section header.
-
- Return Value:
- The length of the section, including the section header.
-
---*/
-// TODO: function comment is missing 'Arguments:'
-// TODO: function comment is missing 'Returns:'
-// TODO: CommonHeader - add argument and description to function comment
-{
- UINT32 Size;
-
- Size = *(UINT32 *) CommonHeader->Size & 0x00FFFFFF;
-
- return Size;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-Crc32ExtractSection (
- IN EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,
- IN VOID *InputSection,
- OUT VOID **OutputBuffer,
- OUT UINTN *OutputSize,
- OUT UINT32 *AuthenticationStatus
- )
-/*++
-
- Routine Description:
- This function reads and extracts contents of a section from an
- encapsulating section.
-
- Parameters:
- This - Indicates the calling context.
- InputSection - Buffer containing the input GUIDed section
- to be processed.
- OutputBuffer - *OutputBuffer is allocated from boot services
- pool memory and containing the new section
- stream. The caller is responsible for freeing
- this buffer.
- AuthenticationStatus - Pointer to a caller allocated UINT32 that
- indicates the authentication status of the
- output buffer
-
- Return Value:
- EFI_SUCCESS
- EFI_OUT_OF_RESOURCES
- EFI_INVALID_PARAMETER
- EFI_NOT_AVAILABLE_YET
-
---*/
-// TODO: function comment is missing 'Arguments:'
-// TODO: function comment is missing 'Returns:'
-// TODO: This - add argument and description to function comment
-// TODO: InputSection - add argument and description to function comment
-// TODO: OutputBuffer - add argument and description to function comment
-// TODO: OutputSize - add argument and description to function comment
-// TODO: AuthenticationStatus - add argument and description to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_INVALID_PARAMETER - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-{
- EFI_STATUS Status;
- CRC32_SECTION_HEADER *Crc32SectionHeader;
- EFI_GUID_DEFINED_SECTION *GuidedSectionHeader;
- UINT8 *Image;
- UINT32 Crc32Checksum;
- VOID *DummyInterface;
-
- if (OutputBuffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *OutputBuffer = NULL;
-
- //
- // Points to the section header
- //
- Crc32SectionHeader = (CRC32_SECTION_HEADER *) InputSection;
- GuidedSectionHeader = (EFI_GUID_DEFINED_SECTION *) InputSection;
-
- //
- // Check if the GUID is a CRC32 section GUID
- //
- if (!CompareGuid (
- &(GuidedSectionHeader->SectionDefinitionGuid),
- &gEfiCrc32GuidedSectionExtractionProtocolGuid
- )) {
- return EFI_INVALID_PARAMETER;
- }
-
- Image = (UINT8 *) InputSection + (UINT32) (GuidedSectionHeader->DataOffset);
- *OutputSize = GetSectionLength ((EFI_COMMON_SECTION_HEADER *) InputSection) - (UINT32) GuidedSectionHeader->DataOffset;
-
- *OutputBuffer = AllocatePool (*OutputSize);
- if (*OutputBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Implictly CRC32 GUIDed section should have STATUS_VALID bit set
- //
- ASSERT (GuidedSectionHeader->Attributes & EFI_GUIDED_SECTION_AUTH_STATUS_VALID);
- *AuthenticationStatus = EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED | EFI_AGGREGATE_AUTH_STATUS_IMAGE_SIGNED;
-
- //
- // Check whether there exists EFI_SECURITY_POLICY_PROTOCOL_GUID.
- //
- Status = gBS->LocateProtocol (&gEfiSecurityPolicyProtocolGuid, NULL, &DummyInterface);
- if (!EFI_ERROR (Status)) {
- *AuthenticationStatus |= EFI_LOCAL_AUTH_STATUS_PLATFORM_OVERRIDE | EFI_AGGREGATE_AUTH_STATUS_PLATFORM_OVERRIDE;
- } else {
- //
- // Calculate CRC32 Checksum of Image
- //
- gBS->CalculateCrc32 (Image, *OutputSize, &Crc32Checksum);
- if (Crc32Checksum != Crc32SectionHeader->CRC32Checksum) {
- *AuthenticationStatus |= EFI_LOCAL_AUTH_STATUS_TEST_FAILED | EFI_AGGREGATE_AUTH_STATUS_TEST_FAILED;
- }
- }
-
- CopyMem (*OutputBuffer, Image, *OutputSize);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.dxs b/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.dxs
deleted file mode 100644
index d42975a..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Crc32SectionExtraction.dxs
-
-Abstract:
-
- Dependency expression file.
-
---*/
-#include "DxeDepex.h"
-
-DEPENDENCY_START
- EFI_RUNTIME_ARCH_PROTOCOL_GUID
-DEPENDENCY_END
-
diff --git a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.h b/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.h
deleted file mode 100644
index 979c41d..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Crc32SectionExtract.h
-
-Abstract:
-
- Header file for Crc32SectionExtract.c
- Please refer to the Framewokr Firmware Volume Specification 0.9.
-
---*/
-
-#ifndef _CRC32_GUIDED_SECTION_EXTRACTION_H
-#define _CRC32_GUIDED_SECTION_EXTRACTION_H
-
-typedef struct {
- EFI_GUID_DEFINED_SECTION GuidedSectionHeader;
- UINT32 CRC32Checksum;
-} CRC32_SECTION_HEADER;
-
-//
-// Function prototype declarations
-//
-STATIC
-EFI_STATUS
-EFIAPI
-Crc32ExtractSection (
- IN EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL *This,
- IN VOID *InputSection,
- OUT VOID **OutputBuffer,
- OUT UINTN *OutputSize,
- OUT UINT32 *AuthenticationStatus
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- This - TODO: add argument description
- InputSection - TODO: add argument description
- OutputBuffer - TODO: add argument description
- OutputSize - TODO: add argument description
- AuthenticationStatus - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-InitializeCrc32GuidedSectionExtractionProtocol (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Entry point of the CRC32 GUIDed section extraction protocol.
- Creates and initializes an instance of the GUIDed section
- extraction protocol with CRC32 GUID.
-
-Arguments:
-
- ImageHandle EFI_HANDLE: A handle for the image that is initializing
- this driver
- SystemTable EFI_SYSTEM_TABLE: A pointer to the EFI system table
-
-Returns:
-
- EFI_SUCCESS: Driver initialized successfully
- EFI_LOAD_ERROR: Failed to Initialize or has been loaded
- EFI_OUT_OF_RESOURCES: Could not allocate needed resources
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.msa b/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.msa
deleted file mode 100644
index c12474f..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.msa
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>Crc32SectionExtract</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>51C9F40C-5243-4473-B265-B3C8FFAFF9FA</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Crc32SectionExtract module.</Abstract>
- <Description>This driver implements CRC32 GUIDed section extraction protocol interface.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Crc32SectionExtract</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Crc32SectionExtract.c</Filename>
- <Filename>Crc32SectionExtract.h</Filename>
- <Filename>GuidedSection.c</Filename>
- <Filename>GuidedSection.h</Filename>
- <Filename>Crc32SectionExtract.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiSecurityPolicyProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiCrc32GuidedSectionExtractionProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>InitializeCrc32GuidedSectionExtractionProtocol</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/GuidedSection.c b/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/GuidedSection.c
deleted file mode 100644
index 87605cc..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/GuidedSection.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- GuidedSection.c
-
-Abstract:
-
- GUIDed section extraction protocol implementation.
- This contains the common constructor of GUIDed section
- extraction protocol. GUID specific implementation of each
- GUIDed section extraction protocol can be found in other
- files under the same directory.
-
---*/
-
-#include "GuidedSection.h"
-
-EFI_STATUS
-GuidedSectionExtractionProtocolConstructor (
- OUT EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL **GuidedSep,
- IN EFI_EXTRACT_GUIDED_SECTION ExtractSection
- )
-/*++
-
-Routine Description:
-
- Constructor for the GUIDed section extraction protocol. Initializes
- instance data.
-
-Arguments:
-
- This Instance to construct
-
-Returns:
-
- EFI_SUCCESS: Instance initialized.
-
---*/
-// TODO: GuidedSep - add argument and description to function comment
-// TODO: ExtractSection - add argument and description to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-{
- *GuidedSep = AllocatePool (sizeof (EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL));
- if (*GuidedSep == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- (*GuidedSep)->ExtractSection = ExtractSection;
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/GuidedSection.h b/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/GuidedSection.h
deleted file mode 100644
index 885b05a..0000000
--- a/EdkModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/GuidedSection.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- GuidedSection.h
-
-Abstract:
-
- Header file for GuidedSection.c
- Please refer to the Framewokr Firmware Volume Specification 0.9.
-
---*/
-
-#ifndef _GUIDED_SECTION_EXTRACTION_H
-#define _GUIDED_SECTION_EXTRACTION_H
-
-//
-// Function prototype declarations
-//
-EFI_STATUS
-GuidedSectionExtractionProtocolConstructor (
- OUT EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL **GuidedSep,
- IN EFI_EXTRACT_GUIDED_SECTION ExtractSection
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- GuidedSep - TODO: add argument description
- ExtractSection - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/GenericMemoryTest/Dxe/Common.h b/EdkModulePkg/Universal/GenericMemoryTest/Dxe/Common.h
deleted file mode 100644
index 7a1ab78..0000000
--- a/EdkModulePkg/Universal/GenericMemoryTest/Dxe/Common.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Common.h
-
-Abstract:
- The generic memory test driver definition
-
---*/
-
-#ifndef _COMMON_H
-#define _COMMON_H
-
-//
-// Some global define
-//
-#define GENERIC_CACHELINE_SIZE 0x40
-
-//
-// The SPARSE_SPAN_SIZE size can not small then the MonoTestSize
-//
-#define TEST_BLOCK_SIZE 0x2000000
-#define QUICK_SPAN_SIZE (TEST_BLOCK_SIZE >> 2)
-#define SPARSE_SPAN_SIZE (TEST_BLOCK_SIZE >> 4)
-
-//
-// This structure records every nontested memory range parsed through GCD
-// service.
-//
-#define EFI_NONTESTED_MEMORY_RANGE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'M', 'E')
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- EFI_PHYSICAL_ADDRESS StartAddress;
- UINT64 Length;
- UINT64 Capabilities;
- BOOLEAN Above4G;
- BOOLEAN AlreadyMapped;
-} NONTESTED_MEMORY_RANGE;
-
-#define NONTESTED_MEMORY_RANGE_FROM_LINK(link) \
- CR(link, NONTESTED_MEMORY_RANGE, Link, EFI_NONTESTED_MEMORY_RANGE_SIGNATURE)
-
-//
-// This is the memory test driver's structure definition
-//
-#define EFI_GENERIC_MEMORY_TEST_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('G', 'E', 'M', 'T')
-
-#endif
diff --git a/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.c b/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.c
deleted file mode 100644
index 7a20a41..0000000
--- a/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- NullMemoryTest.c
-
-Abstract:
-
---*/
-
-
-#include "NullMemoryTest.h"
-
-//
-// Module global members
-//
-UINT64 mTestedSystemMemory = 0;
-UINT64 mTotalSystemMemory = 0;
-EFI_HANDLE mGenericMemoryTestHandle;
-
-//
-// Driver entry here
-//
-EFI_GENERIC_MEMORY_TEST_PROTOCOL mGenericMemoryTest = {
- InitializeMemoryTest,
- GenPerformMemoryTest,
- GenMemoryTestFinished,
- GenCompatibleRangeTest
-};
-
-EFI_STATUS
-EFIAPI
-GenericMemoryTestEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- The generic memory test driver's entry point, it can initialize private data
- to default value
-
-Arguments:
-
- ImageHandle of the loaded driver
- Pointer to the System Table
-
-Returns:
-
- Status
-
- EFI_SUCCESS - Protocol successfully installed
- EFI_OUT_OF_RESOURCES - Can not allocate protocol data structure in base
- memory
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Install the protocol
- //
- Status = gBS->InstallProtocolInterface (
- &mGenericMemoryTestHandle,
- &gEfiGenericMemTestProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mGenericMemoryTest
- );
-
- return Status;
-}
-//
-// EFI_GENERIC_MEMORY_TEST_PROTOCOL implementation
-//
-EFI_STATUS
-EFIAPI
-InitializeMemoryTest (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- IN EXTENDMEM_COVERAGE_LEVEL Level,
- OUT BOOLEAN *RequireSoftECCInit
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINTN NumberOfDescriptors;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
- UINTN Index;
-
- gDS->GetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMap);
- for (Index = 0; Index < NumberOfDescriptors; Index++) {
- if (MemorySpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeReserved &&
- (MemorySpaceMap[Index].Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) ==
- (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED)
- ) {
- gDS->RemoveMemorySpace (
- MemorySpaceMap[Index].BaseAddress,
- MemorySpaceMap[Index].Length
- );
-
- gDS->AddMemorySpace (
- EfiGcdMemoryTypeSystemMemory,
- MemorySpaceMap[Index].BaseAddress,
- MemorySpaceMap[Index].Length,
- MemorySpaceMap[Index].Capabilities &~
- (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)
- );
-
- mTestedSystemMemory += MemorySpaceMap[Index].Length;
- mTotalSystemMemory += MemorySpaceMap[Index].Length;
- } else if (MemorySpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeSystemMemory) {
- mTotalSystemMemory += MemorySpaceMap[Index].Length;
- }
- }
-
- FreePool (MemorySpaceMap);
-
- *RequireSoftECCInit = FALSE;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-GenPerformMemoryTest (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- IN OUT UINT64 *TestedMemorySize,
- OUT UINT64 *TotalMemorySize,
- OUT BOOLEAN *ErrorOut,
- IN BOOLEAN TestAbort
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- *ErrorOut = FALSE;
- *TestedMemorySize = mTestedSystemMemory;
- *TotalMemorySize = mTotalSystemMemory;
-
- return EFI_NOT_FOUND;
-
-}
-
-EFI_STATUS
-EFIAPI
-GenMemoryTestFinished (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-GenCompatibleRangeTest (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS StartAddress,
- IN UINT64 Length
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR descriptor;
-
- gDS->GetMemorySpaceDescriptor (StartAddress, &descriptor);
-
- gDS->RemoveMemorySpace (StartAddress, Length);
-
- gDS->AddMemorySpace (
- EfiGcdMemoryTypeSystemMemory,
- StartAddress,
- Length,
- descriptor.Capabilities &~(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)
- );
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.dxs b/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.dxs
deleted file mode 100644
index a1ac031..0000000
--- a/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.dxs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- NullMemoryTest.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.h b/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.h
deleted file mode 100644
index b4a0720..0000000
--- a/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- NullMemoryTest.h
-
-Abstract:
- The generic memory test driver definition
-
---*/
-
-#ifndef _NULL_MEMORY_TEST_H
-#define _NULL_MEMORY_TEST_H
-
-#include "Common.h"
-
-//
-// Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-InitializeMemoryTest (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- IN EXTENDMEM_COVERAGE_LEVEL Level,
- OUT BOOLEAN *RequireSoftECCInit
- )
-;
-
-EFI_STATUS
-EFIAPI
-GenPerformMemoryTest (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- IN OUT UINT64 *TestedMemorySize,
- OUT UINT64 *TotalMemorySize,
- OUT BOOLEAN *ErrorOut,
- IN BOOLEAN TestAbort
- )
-;
-
-EFI_STATUS
-EFIAPI
-GenMemoryTestFinished (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This
- )
-;
-
-EFI_STATUS
-EFIAPI
-GenCompatibleRangeTest (
- IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
- IN EFI_PHYSICAL_ADDRESS StartAddress,
- IN UINT64 Length
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.msa b/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.msa
deleted file mode 100644
index 29fb2bb..0000000
--- a/EdkModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.msa
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>NullMemoryTest</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>96B5C032-DF4C-4b6e-8232-438DCF448D0E</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for NullMemoryTest module.</Abstract>
- <Description>This driver installs EFI_GENERIC_MEMORY_TEST_PROTOCOL to
- provide simple generic memory test functions.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>NullMemoryTest</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DxeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Common.h</Filename>
- <Filename>NullMemoryTest.c</Filename>
- <Filename>NullMemoryTest.h</Filename>
- <Filename>NullMemoryTest.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiGenericMemTestProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>GenericMemoryTestEntryPoint</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.c b/EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.c
deleted file mode 100644
index 4cf51f4..0000000
--- a/EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BaseMemoryTest.c
-
-Abstract:
-
- The PEI memory test support
-
---*/
-
-#include <BaseMemoryTest.h>
-
-static PEI_BASE_MEMORY_TEST_PPI mPeiBaseMemoryTestPpi = { BaseMemoryTest };
-
-static EFI_PEI_PPI_DESCRIPTOR PpiListPeiBaseMemoryTest = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gPeiBaseMemoryTestPpiGuid,
- &mPeiBaseMemoryTestPpi
-};
-
-EFI_STATUS
-EFIAPI
-PeiBaseMemoryTestInit (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- )
-/*++
-Description:
-
- Entry point function of BaseMemoryTestInit Peim.
-
-Arguments:
-
- PeiServices - General purpose services available to every PEIM.
- FfsHeader - Ffs header pointer
-
-Returns:
-
- Status - Result of InstallPpi
-
---*/
-{
- EFI_STATUS Status;
-
- Status = (**PeiServices).InstallPpi (PeiServices, &PpiListPeiBaseMemoryTest);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-BaseMemoryTest (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_BASE_MEMORY_TEST_PPI *This,
- IN EFI_PHYSICAL_ADDRESS BeginAddress,
- IN UINT64 MemoryLength,
- IN PEI_MEMORY_TEST_OP Operation,
- OUT EFI_PHYSICAL_ADDRESS *ErrorAddress
- )
-/*++
-Description:
-
- Test base memory.
-
-Arguments:
-
- PeiServices - General purpose services available to every PEIM.
- This - Pei memory test PPI pointer.
- BeginAddress - Beginning of the memory address to be checked.
- MemoryLength - Bytes of memory range to be checked.
- Operation - Type of memory check operation to be performed.
- ErrorAddress - Return the address of the error memory address.
- ErrorAddress - Address which has error when checked.
-
-Returns:
-
- Status - Result of InstallPpi
-
---*/
-{
- UINT32 TestPattern;
- EFI_PHYSICAL_ADDRESS TempAddress;
- UINT32 SpanSize;
-
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- EFI_COMPUTING_UNIT_MEMORY + EFI_CU_MEMORY_PC_TEST
- );
-
- TestPattern = TEST_PATTERN;
- SpanSize = 0;
-
- //
- // Make sure we don't try and test anything above the max physical address range
- //
- ASSERT (BeginAddress + MemoryLength < EFI_MAX_ADDRESS);
-
- switch (Operation) {
- case Extensive:
- SpanSize = 0x4;
- break;
-
- case Sparse:
- case Quick:
- SpanSize = COVER_SPAN;
- break;
-
- case Ignore:
- goto Done;
- break;
- }
- //
- // Write the test pattern into memory range
- //
- TempAddress = BeginAddress;
- while (TempAddress < BeginAddress + MemoryLength) {
- (*(UINT32 *) (UINTN) TempAddress) = TestPattern;
- TempAddress += SpanSize;
- }
- //
- // Read pattern from memory and compare it
- //
- TempAddress = BeginAddress;
- while (TempAddress < BeginAddress + MemoryLength) {
- if ((*(UINT32 *) (UINTN) TempAddress) != TestPattern) {
- *ErrorAddress = TempAddress;
- REPORT_STATUS_CODE (
- EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED,
- EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UNCORRECTABLE
- );
-
- return EFI_DEVICE_ERROR;
- }
-
- TempAddress += SpanSize;
- }
-
-Done:
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.h b/EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.h
deleted file mode 100644
index 791a66c..0000000
--- a/EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BaseMemoryTest.h
-
-Abstract:
-
- Tiano PEIM to provide a PEI memory test service.
-
---*/
-
-#ifndef _PEI_BASE_MEMORY_TEST_H_
-#define _PEI_BASE_MEMORY_TEST_H_
-
-//
-// Some global define
-//
-#define COVER_SPAN 0x40000
-#define TEST_PATTERN 0x5A5A5A5A
-
-EFI_STATUS
-EFIAPI
-PeiBaseMemoryTestInit (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- FfsHeader - TODO: add argument description
- PeiServices - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-BaseMemoryTest (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_BASE_MEMORY_TEST_PPI *This,
- IN EFI_PHYSICAL_ADDRESS BeginAddress,
- IN UINT64 MemoryLength,
- IN PEI_MEMORY_TEST_OP Operation,
- OUT EFI_PHYSICAL_ADDRESS *ErrorAddress
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PeiServices - TODO: add argument description
- This - TODO: add argument description
- BeginAddress - TODO: add argument description
- MemoryLength - TODO: add argument description
- Operation - TODO: add argument description
- ErrorAddress - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.msa b/EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.msa
deleted file mode 100644
index 95c5c27..0000000
--- a/EdkModulePkg/Universal/GenericMemoryTest/Pei/BaseMemoryTest.msa
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>PeiBaseMemoryTestInit</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>736EB068-8C01-47c5-964B-1C57BD5D4D64</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for PeiBaseMemoryTestInit module.</Abstract>
- <Description>This driver provides memory test ppi for memory test in Pei Phase.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>PeiBaseMemoryTestInit</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeimEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>BaseMemoryTest.h</Filename>
- <Filename>BaseMemoryTest.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <PPIs>
- <Ppi Usage="ALWAYS_PRODUCED">
- <PpiCName>gPeiBaseMemoryTestPpiGuid</PpiCName>
- </Ppi>
- </PPIs>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>PeiBaseMemoryTestInit</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.c b/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.c
deleted file mode 100644
index 31efab3..0000000
--- a/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MonotonicCounter.c
-
-Abstract:
-
- Produced the Monotonic Counter Services as defined in the DXE CIS
-
-Revision History:
-
---*/
-
-#include "MonotonicCounter.h"
-
-//
-// The Monotonic Counter Handle
-//
-EFI_HANDLE mMonotonicCounterHandle = NULL;
-
-//
-// The current Monotonic count value
-//
-UINT64 mEfiMtc;
-
-//
-// Event to use to update the Mtc's high part when wrapping
-//
-EFI_EVENT mEfiMtcEvent;
-
-//
-// EfiMtcName - Variable name of the MTC value
-//
-CHAR16 *mEfiMtcName = (CHAR16 *) L"MTC";
-
-//
-// EfiMtcGuid - Guid of the MTC value
-//
-EFI_GUID mEfiMtcGuid = { 0xeb704011, 0x1402, 0x11d3, { 0x8e, 0x77, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } };
-
-//
-// Worker functions
-//
-STATIC
-EFI_STATUS
-EFIAPI
-MonotonicCounterDriverGetNextMonotonicCount (
- OUT UINT64 *Count
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_TPL OldTpl;
-
- //
- // Can not be called after ExitBootServices()
- //
- if (EfiAtRuntime ()) {
- return EFI_UNSUPPORTED;
- }
- //
- // Check input parameters
- //
- if (Count == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Update the monotonic counter with a lock
- //
- OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
- *Count = mEfiMtc;
- mEfiMtc++;
- gBS->RestoreTPL (OldTpl);
-
- //
- // If the MSB bit of the low part toggled, then signal that the high
- // part needs updated now
- //
- if ((((UINT32) mEfiMtc) ^ ((UINT32) *Count)) & 0x80000000) {
- gBS->SignalEvent (mEfiMtcEvent);
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Returns the next high 32 bits of the platform's monotonic counter.
-
- The GetNextHighMonotonicCount() function returns the next high 32 bits
- of the platform's monotonic counter. The platform's monotonic counter is
- comprised of two 32 bit quantities: the high 32 bits and the low 32 bits.
- During boot service time the low 32 bit value is volatile: it is reset to
- zero on every system reset and is increased by 1 on every call to GetNextMonotonicCount().
- The high 32 bit value is non-volatile and is increased by 1 whenever the system resets
- or whenever the low 32 bit count [returned by GetNextMonoticCount()] overflows.
- The GetNextMonotonicCount() function is only available at boot services time.
- If the operating system wishes to extend the platform monotonic counter to runtime,
- it may do so by utilizing GetNextHighMonotonicCount(). To do this, before calling
- ExitBootServices() the operating system would call GetNextMonotonicCount() to obtain
- the current platform monotonic count. The operating system would then provide an
- interface that returns the next count by:
- Adding 1 to the last count.
- Before the lower 32 bits of the count overflows, call GetNextHighMonotonicCount().
- This will increase the high 32 bits of the platform's non-volatile portion of the monotonic
- count by 1.
-
- This function may only be called at Runtime.
-
- @param[out] HighCount Pointer to returned value.
-
- @retval EFI_INVALID_PARAMETER If HighCount is NULL.
- @retval EFI_SUCCESS Operation is successful.
- @retval EFI_OUT_OF_RESOURCES If variable service reports that not enough storage
- is available to hold the variable and its data.
- @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-MonotonicCounterDriverGetNextHighMonotonicCount (
- OUT UINT32 *HighCount
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_TPL OldTpl;
-
- //
- // Check input parameters
- //
- if (HighCount == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!EfiAtRuntime ()) {
- //
- // Use a lock if called before ExitBootServices()
- //
- OldTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
- *HighCount = (UINT32) RShiftU64 (mEfiMtc, 32) + 1;
- mEfiMtc = LShiftU64 (*HighCount, 32);
- gBS->RestoreTPL (OldTpl);
- } else {
- *HighCount = (UINT32) RShiftU64 (mEfiMtc, 32) + 1;
- mEfiMtc = LShiftU64 (*HighCount, 32);
- }
- //
- // Update the NvRam store to match the new high part
- //
- return EfiSetVariable (
- mEfiMtcName,
- &mEfiMtcGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof (UINT32),
- HighCount
- );
-
-}
-
-STATIC
-VOID
-EFIAPI
-EfiMtcEventHandler (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Monotonic count event handler. This handler updates the high monotonic count.
-
-Arguments:
-
- Event The event to handle
- Context The event context
-
-Returns:
-
- EFI_SUCCESS The event has been handled properly
- EFI_NOT_FOUND An error occurred updating the variable.
-
---*/
-{
- UINT32 HighCount;
-
- MonotonicCounterDriverGetNextHighMonotonicCount (&HighCount);
-}
-
-EFI_STATUS
-EFIAPI
-MonotonicCounterDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- UINT32 HighCount;
- UINTN BufferSize;
-
- //
- // Make sure the Monotonic Counter Architectural Protocol is not already installed in the system
- //
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiMonotonicCounterArchProtocolGuid);
-
- //
- // Initialize event to handle overflows
- //
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- EfiMtcEventHandler,
- NULL,
- &mEfiMtcEvent
- );
-
- ASSERT_EFI_ERROR (Status);
-
- //
- // Read the last high part
- //
- BufferSize = sizeof (UINT32);
- Status = EfiGetVariable (
- mEfiMtcName,
- &mEfiMtcGuid,
- NULL,
- &BufferSize,
- &HighCount
- );
- if (EFI_ERROR (Status)) {
- HighCount = 0;
- }
- //
- // Set the current value
- //
- mEfiMtc = LShiftU64 (HighCount, 32);
-
- //
- // Increment the upper 32 bits for this boot
- // Continue even if it fails. It will only fail if the variable services are
- // not functional.
- //
- Status = MonotonicCounterDriverGetNextHighMonotonicCount (&HighCount);
-
- //
- // Fill in the EFI Boot Services and EFI Runtime Services Monotonic Counter Fields
- //
- gBS->GetNextMonotonicCount = MonotonicCounterDriverGetNextMonotonicCount;
- gRT->GetNextHighMonotonicCount = MonotonicCounterDriverGetNextHighMonotonicCount;
-
- //
- // Install the Monotonic Counter Architctural Protocol onto a new handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mMonotonicCounterHandle,
- &gEfiMonotonicCounterArchProtocolGuid,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.dxs b/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.dxs
deleted file mode 100644
index a9892a3..0000000
--- a/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MonotonicCounter.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- EFI_VARIABLE_ARCH_PROTOCOL_GUID AND
- EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.h b/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.h
deleted file mode 100644
index c86b15d..0000000
--- a/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MonotonicCounter.h
-
-Abstract:
-
- Produces the Monotonic Counter services as defined in the DXE CIS
-
---*/
-
-#ifndef _MONOTONIC_COUNTER_DRIVER_H_
-#define _MONOTONIC_COUNTER_DRIVER_H_
-
-//
-// Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-MonotonicCounterDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.msa b/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.msa
deleted file mode 100644
index 291f2ea..0000000
--- a/EdkModulePkg/Universal/MonotonicCounter/RuntimeDxe/MonotonicCounter.msa
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>MonotonicCounter</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>AD608272-D07F-4964-801E-7BD3B7888652</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for MonotonicCounter module.</Abstract>
- <Description>This module produces UEFI Monotonic Counter Boot and Runtime Services.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>MonotonicCounter</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>MonotonicCounter.c</Filename>
- <Filename>MonotonicCounter.h</Filename>
- <Filename>MonotonicCounter.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiMonotonicCounterArchProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>MonotonicCounterDriverInitialize</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/BC.msa b/EdkModulePkg/Universal/Network/PxeBc/Dxe/BC.msa
deleted file mode 100644
index 2b38f75..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/BC.msa
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>BC</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>A3f436EA-A127-4EF8-957C-8048606FF670</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for BC module.</Abstract>
- <Description>This module provides PXE basic network capability and start EfiPxeBaseCodeProtocol.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>BC</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3">
- <Keyword>PrintLib</Keyword>
- <HelpText>Recommended libary Instance is BasePrintLib instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>bc.c</Filename>
- <Filename>pxe_bc_arp.c</Filename>
- <Filename>pxe_bc_dhcp.c</Filename>
- <Filename>pxe_bc_igmp.c</Filename>
- <Filename>pxe_bc_ip.c</Filename>
- <Filename>pxe_bc_mtftp.c</Filename>
- <Filename>pxe_bc_udp.c</Filename>
- <Filename>pxe_loadfile.c</Filename>
- <Filename>hton.h</Filename>
- <Filename>tftp.h</Filename>
- <Filename>dhcp.h</Filename>
- <Filename>Bc.h</Filename>
- <Filename>ip.h</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiPxeBaseCodeProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiLoadFileProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiBisProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiSimpleNetworkProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiNetworkInterfaceIdentifierProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiNetworkInterfaceIdentifierProtocolGuid_31</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_PRODUCED">
- <ProtocolCName>gEfiPxeBaseCodeCallbackProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <SystemTables>
- <SystemTableCNames Usage="SOMETIMES_CONSUMED">
- <SystemTableCName>gEfiSmbiosTableGuid</SystemTableCName>
- </SystemTableCNames>
- </SystemTables>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>InitializeBCDriver</ModuleEntryPoint>
- </Extern>
- <Extern>
- <DriverBinding>gPxeBcDriverBinding</DriverBinding>
- <ComponentName>gPxeBcComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/Bc.h b/EdkModulePkg/Universal/Network/PxeBc/Dxe/Bc.h
deleted file mode 100644
index 2689e2a..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/Bc.h
+++ /dev/null
@@ -1,547 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- bc.h
-
-Abstract:
-
---*/
-
-#ifndef _BC_H
-#define _BC_H
-
-#ifndef EFI_MIN
-#define EFI_MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b))
-#endif
-
-#define CALLBACK_INTERVAL 100 // ten times a second
-#define FILTER_BITS (EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP | \
- EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST | \
- EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS | \
- EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST \
- )
-
-#define WAIT_TX_TIMEOUT 1000
-
-#define SUPPORT_IPV6 0
-
-#define PXE_BASECODE_DEVICE_SIGNATURE EFI_SIGNATURE_32('p','x','e','d')
-
-//
-// Determine the classes of IPv4 address
-//
-#define IS_CLASSA_IPADDR(x) ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0x80) == 0x00)
-#define IS_CLASSB_IPADDR(x) ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0xc0) == 0x80)
-#define IS_CLASSC_IPADDR(x) ((((EFI_IP_ADDRESS*)x)->v4.Addr[0] & 0xe0) == 0xc0)
-#define IS_INADDR_UNICAST(x) ((IS_CLASSA_IPADDR(x) || IS_CLASSB_IPADDR(x) || IS_CLASSC_IPADDR(x)) && (((EFI_IP_ADDRESS*)x)->Addr[0] != 0) )
-
-//
-// Definitions for internet group management protocol version 2 message
-// structure
-// Per RFC 2236, November 1997
-//
-#pragma pack(1)
-
-typedef struct {
- UINT8 Type;
- UINT8 MaxRespTime; // in tenths of a second
- UINT16 Checksum; // ones complement of ones complement sum of
- // 16 bit words of message
- UINT32 GroupAddress; // for general query, all systems group,
- // for group specific, the group
-} IGMPV2_MESSAGE;
-
-#define IGMP_TYPE_QUERY 0x11
-#define IGMP_TYPE_REPORT 0x16
-#define IGMP_TYPE_V1REPORT 0x12
-#define IGMP_TYPE_LEAVE_GROUP 0x17
-
-#define IGMP_DEFAULT_MAX_RESPONSE_TIME 10 // 10 second default
-#pragma pack()
-
-#define MAX_MCAST_GROUPS 8 // most we allow ourselves to join at once
-#define MAX_OFFERS 16
-
-typedef struct {
- UINTN Signature;
- EFI_LOCK Lock;
- BOOLEAN ShowErrorMessages;
- EFI_PXE_BASE_CODE_PROTOCOL EfiBc;
- EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *CallbackProtocolPtr;
- EFI_HANDLE Handle;
-
- EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NiiPtr;
- EFI_SIMPLE_NETWORK_PROTOCOL *SimpleNetwork;
- UINT8 *TransmitBufferPtr;
- UINT8 *ReceiveBufferPtr;
- EFI_PXE_BASE_CODE_FUNCTION Function;
-
- UINTN OldestArpEntry;
- UINTN MCastGroupCount;
- EFI_EVENT Igmpv1TimeoutEvent;
- BOOLEAN UseIgmpv1Reporting;
- EFI_EVENT IgmpGroupEvent[MAX_MCAST_GROUPS];
- UINT16 RandomPort;
-
- UINT32 MCastGroup[MAX_MCAST_GROUPS];
- BOOLEAN GoodStationIp;
- BOOLEAN DidTransmit;
- UINTN IpLength;
- VOID *DhcpPacketBuffer;
- UINTN FileSize;
- VOID *BootServerReceiveBuffer;
- EFI_IP_ADDRESS ServerIp;
-
- //
- // work area
- // for dhcp
- //
- VOID *ReceiveBuffers;
- VOID *TransmitBuffer;
- UINTN NumOffersReceived;
- UINT16 TotalSeconds;
-
- //
- // arrays for different types of offers
- //
- UINT8 ServerCount[4];
- UINT8 OfferCount[4][MAX_OFFERS];
- UINT8 GotBootp;
- UINT8 GotProxy[4];
- UINT8 BinlProxies[MAX_OFFERS];
-
- UINT8 *ArpBuffer;
- UINT8 *TftpAckBuffer;
- UINT8 *TftpErrorBuffer;
- IGMPV2_MESSAGE IgmpMessage;
- BOOLEAN BigBlkNumFlag;
- UINT8 Timeout;
- UINT16 RandomSeed;
-} PXE_BASECODE_DEVICE;
-
-//
-// type index
-//
-#define DHCP_ONLY_IX 0
-#define PXE10_IX 1
-#define WfM11a_IX 2
-#define BINL_IX 3
-
-#define PXE_RND_PORT_LOW 2070
-
-#define PXE_MAX_PRINT_BUFFER 128
-
-//
-//
-//
-#define LOADFILE_DEVICE_SIGNATURE EFI_SIGNATURE_32('p','x','e','l')
-
-typedef struct {
- UINTN Signature;
- EFI_LOCK Lock;
- EFI_LOAD_FILE_PROTOCOL LoadFile;
- PXE_BASECODE_DEVICE *Private;
-} LOADFILE_DEVICE;
-
-#define EFI_BASE_CODE_DEV_FROM_THIS(a) CR (a, PXE_BASECODE_DEVICE, efi_bc, PXE_BASECODE_DEVICE_SIGNATURE);
-
-#define EFI_LOAD_FILE_DEV_FROM_THIS(a) CR (a, LOADFILE_DEVICE, LoadFile, LOADFILE_DEVICE_SIGNATURE)
-
-EFI_STATUS
-EFIAPI
-PxeBcDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PxeBcDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PxeBcDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-PxeBcComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-PxeBcComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-EFI_BIS_PROTOCOL *
-PxebcBisStart (
- PXE_BASECODE_DEVICE *Private,
- BIS_APPLICATION_HANDLE *BisAppHandle,
- EFI_BIS_DATA **BisDataSigInfo
- )
-;
-
-VOID
-PxebcBisStop (
- EFI_BIS_PROTOCOL *Bis,
- BIS_APPLICATION_HANDLE BisAppHandle,
- EFI_BIS_DATA *BisDataSigInfo
- )
-;
-
-BOOLEAN
-PxebcBisVerify (
- PXE_BASECODE_DEVICE *Private,
- VOID *FileBuffer,
- UINTN FileBufferLength,
- VOID *CredentialBuffer,
- UINTN CredentialBufferLength
- )
-;
-
-BOOLEAN
-PxebcBisDetect (
- PXE_BASECODE_DEVICE *Private
- )
-;
-
-//
-// Global Variables
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gPxeBcDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName;
-
-//
-// //////////////////////////////////////////////////////////
-//
-// prototypes
-//
-EFI_STATUS
-EFIAPI
-InitializeBCDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcStart (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN BOOLEAN UseIpv6
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcStop (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcDhcp (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN BOOLEAN SortOffers
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcDiscover (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN UINT16 Type,
- IN UINT16 *Layer,
- IN BOOLEAN UseBis,
- IN EFI_PXE_BASE_CODE_DISCOVER_INFO * Info OPTIONAL
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcMtftp (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
- IN OUT VOID *BufferPtr,
- IN BOOLEAN Overwrite,
- IN OUT UINT64 *BufferSize,
- IN UINTN *BlockSize OPTIONAL,
- IN EFI_IP_ADDRESS * ServerIp,
- IN UINT8 *Filename,
- IN EFI_PXE_BASE_CODE_MTFTP_INFO * Info OPTIONAL,
- IN BOOLEAN DontUseBuffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcUdpWrite (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN UINT16 OpFlags,
- IN EFI_IP_ADDRESS *DestIp,
- IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort,
- IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL
- IN EFI_IP_ADDRESS *SrcIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
- IN UINTN *HeaderSize, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN UINTN *BufferSize,
- IN VOID *BufferPtr
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcUdpRead (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN UINT16 OpFlags,
- IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL
- IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
- IN UINTN *HeaderSize, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN OUT UINTN *BufferSize,
- IN VOID *BufferPtr
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcArp (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN EFI_IP_ADDRESS * IpAddr,
- IN EFI_MAC_ADDRESS * MacAddr OPTIONAL
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcIpFilter (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcSetParameters (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN BOOLEAN *NewAutoArp, OPTIONAL
- IN BOOLEAN *NewSendGUID, OPTIONAL
- IN UINT8 *NewTTL, OPTIONAL
- IN UINT8 *NewToS, OPTIONAL
- IN BOOLEAN *NewMakeCallback OPTIONAL
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcSetStationIP (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN EFI_IP_ADDRESS * NewStationIp, OPTIONAL
- IN EFI_IP_ADDRESS * NewSubnetMask OPTIONAL
- )
-;
-
-EFI_STATUS
-EFIAPI
-BcSetPackets (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- BOOLEAN *NewDhcpDiscoverValid, OPTIONAL
- BOOLEAN *NewDhcpAckReceived, OPTIONAL
- BOOLEAN *NewProxyOfferReceived, OPTIONAL
- BOOLEAN *NewPxeDiscoverValid, OPTIONAL
- BOOLEAN *NewPxeReplyReceived, OPTIONAL
- BOOLEAN *NewPxeBisReplyReceived, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewDhcpDiscover, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewDhcpAck, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewProxyOffer, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewPxeDiscover, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewPxeReply, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewPxeBisReply OPTIONAL
- )
-;
-
-EFI_STATUS
-EFIAPI
-LoadFile (
- IN EFI_LOAD_FILE_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN BOOLEAN BootPolicy,
- IN OUT UINTN *BufferSize,
- IN VOID *Buffer
- )
-;
-
-EFI_STATUS
-PxeBcLibGetSmbiosSystemGuidAndSerialNumber (
- IN EFI_GUID *SystemGuid,
- OUT CHAR8 **SystemSerialNumber
- )
-;
-
-//
-// Define SMBIOS tables.
-//
-#pragma pack(1)
-typedef struct {
- UINT8 AnchorString[4];
- UINT8 EntryPointStructureChecksum;
- UINT8 EntryPointLength;
- UINT8 MajorVersion;
- UINT8 MinorVersion;
- UINT16 MaxStructureSize;
- UINT8 EntryPointRevision;
- UINT8 FormattedArea[5];
- UINT8 IntermediateAnchorString[5];
- UINT8 IntermediateChecksum;
- UINT16 TableLength;
- UINT32 TableAddress;
- UINT16 NumberOfSmbiosStructures;
- UINT8 SmbiosBcdRevision;
-} SMBIOS_STRUCTURE_TABLE;
-
-//
-// Please note that SMBIOS structures can be odd byte aligned since the
-// unformated section of each record is a set of arbitrary size strings.
-//
-typedef struct {
- UINT8 Type;
- UINT8 Length;
- UINT8 Handle[2];
-} SMBIOS_HEADER;
-
-typedef UINT8 SMBIOS_STRING;
-
-typedef struct {
- SMBIOS_HEADER Hdr;
- SMBIOS_STRING Vendor;
- SMBIOS_STRING BiosVersion;
- UINT8 BiosSegment[2];
- SMBIOS_STRING BiosReleaseDate;
- UINT8 BiosSize;
- UINT8 BiosCharacteristics[8];
-} SMBIOS_TYPE0;
-
-typedef struct {
- SMBIOS_HEADER Hdr;
- SMBIOS_STRING Manufacturer;
- SMBIOS_STRING ProductName;
- SMBIOS_STRING Version;
- SMBIOS_STRING SerialNumber;
-
- //
- // always byte copy this data to prevent alignment faults!
- //
- EFI_GUID Uuid;
-
- UINT8 WakeUpType;
-} SMBIOS_TYPE1;
-
-typedef struct {
- SMBIOS_HEADER Hdr;
- SMBIOS_STRING Manufacturer;
- SMBIOS_STRING ProductName;
- SMBIOS_STRING Version;
- SMBIOS_STRING SerialNumber;
-} SMBIOS_TYPE2;
-
-typedef struct {
- SMBIOS_HEADER Hdr;
- SMBIOS_STRING Manufacturer;
- UINT8 Type;
- SMBIOS_STRING Version;
- SMBIOS_STRING SerialNumber;
- SMBIOS_STRING AssetTag;
- UINT8 BootupState;
- UINT8 PowerSupplyState;
- UINT8 ThermalState;
- UINT8 SecurityStatus;
- UINT8 OemDefined[4];
-} SMBIOS_TYPE3;
-
-typedef struct {
- SMBIOS_HEADER Hdr;
- UINT8 Socket;
- UINT8 ProcessorType;
- UINT8 ProcessorFamily;
- SMBIOS_STRING ProcessorManufacture;
- UINT8 ProcessorId[8];
- SMBIOS_STRING ProcessorVersion;
- UINT8 Voltage;
- UINT8 ExternalClock[2];
- UINT8 MaxSpeed[2];
- UINT8 CurrentSpeed[2];
- UINT8 Status;
- UINT8 ProcessorUpgrade;
- UINT8 L1CacheHandle[2];
- UINT8 L2CacheHandle[2];
- UINT8 L3CacheHandle[2];
-} SMBIOS_TYPE4;
-
-typedef union {
- SMBIOS_HEADER *Hdr;
- SMBIOS_TYPE0 *Type0;
- SMBIOS_TYPE1 *Type1;
- SMBIOS_TYPE2 *Type2;
- SMBIOS_TYPE3 *Type3;
- SMBIOS_TYPE4 *Type4;
- UINT8 *Raw;
-} SMBIOS_STRUCTURE_POINTER;
-#pragma pack()
-
-#include "ip.h"
-#include "dhcp.h"
-#include "tftp.h"
-
-VOID
-InitArpHeader (
- VOID
- )
-/*++
-Routine description:
- Initialize ARP packet header.
-
-Parameters:
- none
-
-Returns:
- none
-
---*/
-;
-
-#endif /* _BC_H */
-
-/* EOF - bc.h */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/ComponentName.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/ComponentName.c
deleted file mode 100644
index 4c6ebef..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/ComponentName.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- ComponentName.c
-
-Abstract:
-
---*/
-
-
-#include "Bc.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gPxeBcComponentName = {
- PxeBcComponentNameGetDriverName,
- PxeBcComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mPxeBcDriverNameTable[] = {
- {
- "eng",
- (CHAR16 *) L"PXE Base Code Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-PxeBcComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gPxeBcComponentName.SupportedLanguages,
- mPxeBcDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-PxeBcComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/bc.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/bc.c
deleted file mode 100644
index 0eceddf..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/bc.c
+++ /dev/null
@@ -1,2403 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- bc.c
-
-Abstract:
-
---*/
-
-#include "Bc.h"
-
-//
-// helper routines
-//
-VOID
-CvtNum (
- IN UINTN Number,
- IN UINT8 *Buffer,
- IN INTN Length
- )
-/*++
-
- Routine Description:
- Convert number to ASCII value
-
- Arguments:
- Number - Numeric value to convert to decimal ASCII value.
- Buffer - Buffer to place ASCII version of the Number
- Length - Length of Buffer.
-
- Returns:
- none - none
-
---*/
-{
- UINTN Remainder;
-
- while (Length--) {
- Remainder = Number % 10;
- Number /= 10;
- Buffer[Length] = (UINT8) ('0' + Remainder);
- }
-}
-
-VOID
-UtoA10 (
- IN UINTN Number,
- IN UINT8 *Buffer
- )
-/*++
-
- Routine Description:
- Convert number to decimal ASCII value at Buffer location
-
- Arguments:
- Number - Numeric value to convert to decimal ASCII value.
- Buffer - Buffer to place ASCII version of the Number
-
- Returns:
- none - none
-
---*/
-{
- INTN Index;
- UINT8 BuffArray[31];
-
- BuffArray[30] = 0;
- CvtNum (Number, BuffArray, 30);
-
- for (Index = 0; Index < 30; ++Index) {
- if (BuffArray[Index] != '0') {
- break;
- }
- }
-
- CopyMem (Buffer, BuffArray + Index, 31 - Index);
-}
-
-UINTN
-AtoU (
- IN UINT8 *Buffer
- )
-/*++
-
- Routine Description:
- Convert ASCII numeric string to a UINTN value
-
- Arguments:
- Number - Numeric value to convert to decimal ASCII value.
- Buffer - Buffer to place ASCII version of the Number
-
- Returns:
- Value - UINTN value of the ASCII string.
-
---*/
-{
- UINTN Value;
- INT8 Character;
-
- Value = 0;
- Character = *Buffer++;
- do {
- Value = Value * 10 + Character - '0';
- Character = *Buffer++;
- } while (Character);
-
- return Value;
-}
-
-UINT64
-AtoU64 (
- IN UINT8 *Buffer
- )
-/*++
-
- Routine Description:
- Convert ASCII numeric string to a UINTN value
-
- Arguments:
- Number - Numeric value to convert to decimal ASCII value.
- Buffer - Buffer to place ASCII version of the Number
-
- Returns:
- Value - UINTN value of the ASCII string.
-
---*/
-{
- UINT64 Value;
- UINT8 Character;
-
- Value = 0;
- while ((Character = *Buffer++) != '\0') {
- Value = MultU64x32 (Value, 10) + (Character - '0');
- }
-
- return Value;
-}
-//
-// random number generator
-//
-#define RANDOM_MULTIPLIER 2053
-#define RANDOM_ADD_IN_VALUE 19
-
-VOID
-SeedRandom (
- IN PXE_BASECODE_DEVICE *Private,
- IN UINT16 InitialSeed
- )
-/*++
-
- Routine Description:
- Initialize the Seed for the random number generator
-
- Arguments:
-
- Returns:
- none -
-
---*/
-{
- if (Private != NULL) {
- Private->RandomSeed = InitialSeed;
- }
-}
-
-UINT16
-Random (
- IN PXE_BASECODE_DEVICE *Private
- )
-/*++
-
- Routine Description:
- Generate and return a pseudo-random number
-
- Arguments:
-
- Returns:
- Number - UINT16 random number
-
---*/
-{
- UINTN Number;
-
- if (Private != NULL) {
- Number = -(INTN) Private->RandomSeed * RANDOM_MULTIPLIER + RANDOM_ADD_IN_VALUE;
-
- return Private->RandomSeed = (UINT16) Number;
- } else {
- return 0;
- }
-}
-//
-// calculate the internet checksum (RFC 1071)
-// return 16 bit ones complement of ones complement sum of 16 bit words
-//
-UINT16
-IpChecksum (
- IN UINT16 *Packet,
- IN UINTN Length
- )
-/*++
-
- Routine Description:
- Calculate the internet checksum (see RFC 1071)
-
- Arguments:
- Packet - Buffer which contains the data to be checksummed
- Length - Length to be checksummed
-
- Returns:
- Checksum - Returns the 16 bit ones complement of
- ones complement sum of 16 bit words
-
---*/
-{
- UINT32 Sum;
- UINT8 Odd;
-
- Sum = 0;
- Odd = (UINT8) (Length & 1);
- Length >>= 1;
- while (Length--) {
- Sum += *Packet++;
- }
-
- if (Odd) {
- Sum += *(UINT8 *) Packet;
- }
-
- Sum = (Sum & 0xffff) + (Sum >> 16);
- //
- // in case above carried
- //
- Sum += Sum >> 16;
-
- return (UINT16) (~ (UINT16) Sum);
-}
-
-UINT16
-IpChecksum2 (
- IN UINT16 *Header,
- IN UINTN HeaderLen,
- IN UINT16 *Message,
- IN UINTN MessageLen
- )
-/*++
-
- Routine Description:
- Calculate the internet checksum (see RFC 1071)
- on a non contiguous header and data
-
- Arguments:
- Header - Buffer which contains the data to be checksummed
- HeaderLen - Length to be checksummed
- Message - Buffer which contains the data to be checksummed
- MessageLen - Length to be checksummed
-
- Returns:
- Checksum - Returns the 16 bit ones complement of
- ones complement sum of 16 bit words
-
---*/
-{
- UINT32 Sum;
-
- Sum = (UINT16)~IpChecksum (Header, HeaderLen);
- Sum = Sum + (UINT16)~IpChecksum (Message, MessageLen);
- //
- // in case above carried
- //
- Sum += Sum >> 16;
-
- return (UINT16) (~ (UINT16) Sum);
-}
-
-UINT16
-UpdateChecksum (
- IN UINT16 OldChksum,
- IN UINT16 OldWord,
- IN UINT16 NewWord
- )
-/*++
-
- Routine Description:
- Adjust the internet checksum (see RFC 1071) on a single word update.
-
- Arguments:
- OldChkSum - Checksum previously calculated
- OldWord - Value
- NewWord - New Value
-
- Returns:
- Checksum - Returns the 16 bit ones complement of
- ones complement sum of 16 bit words
-
---*/
-{
- UINT32 sum;
-
- sum = ~OldChksum + NewWord - OldWord;
- //
- // in case above carried
- //
- sum += sum >> 16;
- return (UINT16) (~ (UINT16) sum);
-}
-
-STATIC
-BOOLEAN
-SetMakeCallback (
- IN PXE_BASECODE_DEVICE *Private
- )
-/*++
-
- Routine Description:
- See if a callback is in play
-
- Arguments:
- Private - Pointer to Pxe BaseCode Protocol
-
- Returns:
- 0 - Callbacks are active on the handle
- 1 - Callbacks are not active on the handle
-
---*/
-{
- Private->EfiBc.Mode->MakeCallbacks = (BOOLEAN) (gBS->HandleProtocol (
- Private->Handle,
- &gEfiPxeBaseCodeCallbackProtocolGuid,
- (VOID *) &Private->CallbackProtocolPtr
- ) == EFI_SUCCESS);
-
- DEBUG (
- (EFI_D_INFO,
- "\nMode->MakeCallbacks == %d ",
- Private->EfiBc.Mode->MakeCallbacks)
- );
-
- DEBUG (
- (EFI_D_INFO,
- "\nPrivate->CallbackProtocolPtr == %xh ",
- Private->CallbackProtocolPtr)
- );
-
- if (Private->CallbackProtocolPtr != NULL) {
- DEBUG (
- (EFI_D_INFO,
- "\nCallbackProtocolPtr->Revision = %xh ",
- Private->CallbackProtocolPtr->Revision)
- );
-
- DEBUG (
- (EFI_D_INFO,
- "\nCallbackProtocolPtr->Callback = %xh ",
- Private->CallbackProtocolPtr->Callback)
- );
- }
-
- return Private->EfiBc.Mode->MakeCallbacks;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-WaitForReceive (
- IN PXE_BASECODE_DEVICE *Private,
- IN EFI_PXE_BASE_CODE_FUNCTION Function,
- IN EFI_EVENT TimeoutEvent,
- IN OUT UINTN *HeaderSizePtr,
- IN OUT UINTN *BufferSizePtr,
- IN OUT UINT16 *ProtocolPtr
- )
-/*++
-
- Routine Description:
- Routine which does an SNP->Receive over a timeout period and doing callbacks
-
- Arguments:
- Private - Pointer to Pxe BaseCode Protocol
- Function - What PXE function to callback
- TimeoutEvent - Timer event that will trigger when we have waited too
- long for an incoming packet
- HeaderSizePtr - Pointer to the size of the Header size
- BufferSizePtr - Pointer to the size of the Buffer size
- ProtocolPtr - The protocol to sniff for (namely, UDP/etc)
-
- Returns:
- 0 - Something was returned
- !0 - Like there was nothing to receive (EFI_TIMEOUT/NOT_READY)
-
---*/
-{
- EFI_SIMPLE_NETWORK_PROTOCOL *SnpPtr;
- EFI_PXE_CALLBACK CallbackPtr;
- EFI_STATUS StatCode;
- EFI_EVENT CallbackEvent;
-
- //
- // Initialize pointer to SNP interface
- //
- SnpPtr = Private->SimpleNetwork;
-
- //
- // Initialize pointer to PxeBc callback routine - if any
- //
- CallbackPtr = (Private->EfiBc.Mode->MakeCallbacks) ? Private->CallbackProtocolPtr->Callback : NULL;
-
- //
- // Create callback event and set timer
- //
- StatCode = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &CallbackEvent
- );
-
- if (EFI_ERROR (StatCode)) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // every 100 milliseconds
- //
- StatCode = gBS->SetTimer (
- CallbackEvent,
- TimerPeriodic,
- 1000000
- );
-
- if (EFI_ERROR (StatCode)) {
- gBS->CloseEvent (CallbackEvent);
- return EFI_DEVICE_ERROR;
- }
- //
- // Loop until a packet is received or a receive error is detected or
- // a callback abort is detected or a timeout event occurs.
- //
- for (;;)
- {
- //
- // Poll for received packet.
- //
- *BufferSizePtr = BUFFER_ALLOCATE_SIZE;
-
- StatCode = SnpPtr->Receive (
- SnpPtr,
- HeaderSizePtr,
- BufferSizePtr,
- Private->ReceiveBufferPtr,
- 0,
- 0,
- ProtocolPtr
- );
-
- if (!EFI_ERROR (StatCode)) {
- //
- // Packet was received. Make received callback then return.
- //
- if (CallbackPtr != NULL) {
- StatCode = CallbackPtr (
- Private->CallbackProtocolPtr,
- Function,
- TRUE,
- (UINT32) *BufferSizePtr,
- (EFI_PXE_BASE_CODE_PACKET *) Private->ReceiveBufferPtr
- );
-
- if (StatCode != EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE) {
- StatCode = EFI_ABORTED;
- } else {
- StatCode = EFI_SUCCESS;
- }
- }
-
- break;
- }
-
- if (StatCode != EFI_NOT_READY) {
- break;
- }
-
- //
- // Check for callback event.
- //
- if (!EFI_ERROR (gBS->CheckEvent (CallbackEvent))) {
- //
- // Make periodic callback if callback pointer is initialized.
- //
- if (CallbackPtr != NULL) {
- StatCode = CallbackPtr (
- Private->CallbackProtocolPtr,
- Function,
- FALSE,
- 0,
- NULL
- );
-
- //
- // Abort if directed to by callback routine.
- //
- if (StatCode != EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE) {
- StatCode = EFI_ABORTED;
- break;
- }
- }
- }
- //
- // Check for timeout event.
- //
- if (TimeoutEvent == 0) {
- StatCode = EFI_TIMEOUT;
- break;
- }
-
- if (!EFI_ERROR (gBS->CheckEvent (TimeoutEvent))) {
- StatCode = EFI_TIMEOUT;
- break;
- }
- //
- // Check IGMP timer events.
- //
- IgmpCheckTimers (Private);
- }
-
- gBS->CloseEvent (CallbackEvent);
-
- return StatCode;
-}
-
-EFI_STATUS
-SendPacket (
- PXE_BASECODE_DEVICE *Private,
- VOID *HeaderPtr,
- VOID *PacketPtr,
- INTN PacketLen,
- VOID *HardwareAddr,
- UINT16 MediaProtocol,
- IN EFI_PXE_BASE_CODE_FUNCTION Function
- )
-/*++
-
- Routine Description:
- Routine which does an SNP->Transmit of a buffer
-
- Arguments:
- Private - Pointer to Pxe BaseCode Protocol
- HeaderPtr - Pointer to the buffer
- PacketPtr - Pointer to the packet to send
- PacketLen - The length of the entire packet to send
- HardwareAddr - Pointer to the MAC address of the destination
- MediaProtocol - What type of frame to create (RFC 1700) - IE. Ethernet
- Function - What PXE function to callback
-
- Returns:
- 0 - Something was sent
- !0 - An error was encountered during sending of a packet
-
---*/
-{
- EFI_SIMPLE_NETWORK_PROTOCOL *SnpPtr;
- EFI_SIMPLE_NETWORK_MODE *SnpModePtr;
- EFI_PXE_CALLBACK CallbackPtr;
- EFI_STATUS StatCode;
- EFI_EVENT TimeoutEvent;
- UINT32 IntStatus;
- VOID *TxBuf;
-
- //
- //
- //
- CallbackPtr = Private->EfiBc.Mode->MakeCallbacks ? Private->CallbackProtocolPtr->Callback : 0;
-
- SnpPtr = Private->SimpleNetwork;
- SnpModePtr = SnpPtr->Mode;
-
- //
- // clear prior interrupt status
- //
- StatCode = SnpPtr->GetStatus (SnpPtr, &IntStatus, 0);
-
- if (EFI_ERROR (StatCode)) {
- DEBUG (
- (EFI_D_WARN,
- "\nSendPacket() Exit #1 %xh (%r)",
- StatCode,
- StatCode)
- );
- return StatCode;
- }
-
- Private->DidTransmit = FALSE;
-
- if (CallbackPtr != NULL) {
- if (CallbackPtr (
- Private->CallbackProtocolPtr,
- Function,
- FALSE,
- (UINT32) PacketLen,
- PacketPtr
- ) != EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE) {
- DEBUG (
- (EFI_D_WARN,
- "\nSendPacket() Exit #2 %xh (%r)",
- EFI_ABORTED,
- EFI_ABORTED)
- );
- return EFI_ABORTED;
- }
- }
- //
- // put packet in transmit queue
- // headersize should be zero if not filled in
- //
- StatCode = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &TimeoutEvent
- );
-
- if (EFI_ERROR (StatCode)) {
- DEBUG (
- (EFI_D_ERROR,
- "Could not create transmit timeout event. %r\n",
- StatCode)
- );
- return EFI_DEVICE_ERROR;
- }
-
- //
- // 5 milliseconds
- //
- StatCode = gBS->SetTimer (
- TimeoutEvent,
- TimerRelative,
- 50000
- );
-
- if (EFI_ERROR (StatCode)) {
- DEBUG (
- (EFI_D_ERROR,
- "Could not set transmit timeout event timer. %r\n",
- StatCode)
- );
- gBS->CloseEvent (TimeoutEvent);
- return EFI_DEVICE_ERROR;
- }
-
- for (;;) {
- StatCode = SnpPtr->Transmit (
- SnpPtr,
- (UINTN) SnpPtr->Mode->MediaHeaderSize,
- (UINTN) (PacketLen + SnpPtr->Mode->MediaHeaderSize),
- HeaderPtr,
- &SnpModePtr->CurrentAddress,
- (EFI_MAC_ADDRESS *) HardwareAddr,
- &MediaProtocol
- );
-
- if (StatCode != EFI_NOT_READY) {
- break;
- }
-
- if (!EFI_ERROR (gBS->CheckEvent (TimeoutEvent))) {
- StatCode = EFI_TIMEOUT;
- break;
- }
- }
-
- gBS->CloseEvent (TimeoutEvent);
-
- if (EFI_ERROR (StatCode)) {
- DEBUG (
- (EFI_D_WARN,
- "\nSendPacket() Exit #3 %xh (%r)",
- StatCode,
- StatCode)
- );
- return StatCode;
- }
- //
- // remove transmit buffer from snp's unused queue
- // done this way in case someday things are buffered and we don't get it back
- // immediately
- //
- StatCode = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &TimeoutEvent
- );
-
- if (EFI_ERROR (StatCode)) {
- DEBUG (
- (EFI_D_ERROR,
- "Could not create transmit status timeout event. %r\n",
- StatCode)
- );
- return EFI_DEVICE_ERROR;
- }
-
- //
- // 5 milliseconds
- //
- StatCode = gBS->SetTimer (
- TimeoutEvent,
- TimerRelative,
- 50000
- );
-
- if (EFI_ERROR (StatCode)) {
- DEBUG (
- (EFI_D_ERROR,
- "Could not set transmit status timeout event timer. %r\n",
- StatCode)
- );
- gBS->CloseEvent (TimeoutEvent);
- return EFI_DEVICE_ERROR;
- }
-
- for (;;) {
- StatCode = SnpPtr->GetStatus (SnpPtr, &IntStatus, &TxBuf);
-
- if (EFI_ERROR (StatCode)) {
- DEBUG (
- (EFI_D_WARN,
- "\nSendPacket() Exit #4 %xh (%r)",
- StatCode,
- StatCode)
- );
- break;
- }
-
- if (IntStatus & EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT) {
- Private->DidTransmit = TRUE;
- }
-
- if (TxBuf != NULL) {
- break;
- }
-
- if (!EFI_ERROR (gBS->CheckEvent (TimeoutEvent))) {
- StatCode = EFI_TIMEOUT;
- break;
- }
- }
-
- gBS->CloseEvent (TimeoutEvent);
-
- return StatCode;
-}
-//
-//
-//
-EFI_BIS_PROTOCOL *
-PxebcBisStart (
- IN PXE_BASECODE_DEVICE *Private,
- OUT BIS_APPLICATION_HANDLE *BisAppHandle,
- OUT OPTIONAL EFI_BIS_DATA **BisDataSigInfo
- )
-/*++
-Routine description:
- Locate BIS interface and if found, try to start it.
-
-Parameters:
- Private := Pointer to PxeBc protocol
- BisAppHandle := Pointer to BIS application handle storage
- BisDataSigInfo := Pointer to BIS signature information storage
-Returns:
---*/
-{
- EFI_STATUS EfiStatus;
- EFI_HANDLE BisHandleBuffer;
- UINTN BisHandleCount;
- EFI_BIS_PROTOCOL *BisPtr;
- EFI_BIS_VERSION BisInterfaceVersion;
- BOOLEAN BisCheckFlag;
-
- BisHandleCount = sizeof (EFI_HANDLE);
- BisCheckFlag = FALSE;
-
- //
- // Locate BIS protocol handle (if present).
- // If BIS protocol handle is not found, return NULL.
- //
- DEBUG ((EFI_D_INFO, "\ngBS->LocateHandle() "));
-
- EfiStatus = gBS->LocateHandle (
- ByProtocol,
- &gEfiBisProtocolGuid,
- NULL,
- &BisHandleCount,
- &BisHandleBuffer
- );
-
- if (EFI_ERROR (EfiStatus)) {
- //
- // Any error means that there is no BIS.
- // Note - It could mean that there are more than
- // one BIS protocols installed, but that scenario
- // is not yet supported.
- //
- DEBUG (
- (EFI_D_WARN,
- "\nPxebcBisStart()""\n gBS->LocateHandle() %r (%xh)\n",
- EfiStatus,
- EfiStatus)
- );
-
- return NULL;
- }
-
- if (BisHandleCount != sizeof (BisHandleBuffer)) {
- //
- // This really should never happen, but I am paranoid.
- //
- DEBUG (
- (EFI_D_NET,
- "\nPxebcBisStart() BisHandleCount != %d\n",
- sizeof BisHandleBuffer)
- );
-
- return NULL;
- }
-
- DEBUG ((EFI_D_INFO, "BIS handle found."));
-
- //
- // Locate BIS protocol interface.
- // If the BIS protocol interface cannot be found, return NULL.
- //
- DEBUG ((EFI_D_INFO, "\ngBS->HandleProtocol() "));
-
- EfiStatus = gBS->HandleProtocol (
- BisHandleBuffer,
- &gEfiBisProtocolGuid,
- (VOID **) &BisPtr
- );
-
- if (EFI_ERROR (EfiStatus)) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxebcBisStart()""\n gBS->HandleProtocol() %r (%xh)\n",
- EfiStatus,
- EfiStatus)
- );
-
- return NULL;
- }
-
- if (BisPtr == NULL) {
- //
- // This really should never happen.
- //
- DEBUG (
- (EFI_D_NET,
- "\nPxebcBisStart()""\n gBS->HandleProtocoL() ""BIS protocol interface pointer is NULL!\n")
- );
-
- return NULL;
- }
-
- DEBUG ((EFI_D_INFO, "BIS protocol interface found."));
-
- //
- // Check that all of the BIS API function pointers are not NULL.
- //
- if (BisPtr->Initialize == NULL ||
- BisPtr->Shutdown == NULL ||
- BisPtr->Free == NULL ||
- BisPtr->GetBootObjectAuthorizationCertificate == NULL ||
- BisPtr->GetBootObjectAuthorizationCheckFlag == NULL ||
- BisPtr->GetBootObjectAuthorizationUpdateToken == NULL ||
- BisPtr->GetSignatureInfo == NULL ||
- BisPtr->UpdateBootObjectAuthorization == NULL ||
- BisPtr->VerifyBootObject == NULL ||
- BisPtr->VerifyObjectWithCredential == NULL
- ) {
- DEBUG (
- (
- EFI_D_NET,
- "\nPxebcBisStart()""\n BIS protocol interface is invalid."
- "\n At least one BIS protocol function pointer is NULL.\n"
- )
- );
-
- return NULL;
- }
- //
- // Initialize BIS.
- // If BIS does not initialize, return NULL.
- //
- DEBUG ((EFI_D_INFO, "\nBisPtr->Initialize() "));
-
- BisInterfaceVersion.Major = BIS_VERSION_1;
-
- EfiStatus = BisPtr->Initialize (
- BisPtr,
- BisAppHandle,
- &BisInterfaceVersion,
- NULL
- );
-
- if (EFI_ERROR (EfiStatus)) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxebcBisStart()""\n BisPtr->Initialize() %r (%xh)\n",
- EfiStatus,
- EfiStatus)
- );
-
- return NULL;
- }
-
- DEBUG (
- (EFI_D_INFO,
- " BIS version: %d.%d",
- BisInterfaceVersion.Major,
- BisInterfaceVersion.Minor)
- );
-
- //
- // If the requested BIS API version is not supported,
- // shutdown BIS and return NULL.
- //
- if (BisInterfaceVersion.Major != BIS_VERSION_1) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxebcBisStart()""\n BIS version %d.%d not supported by PXE BaseCode.\n",
- BisInterfaceVersion.Major,
- BisInterfaceVersion.Minor)
- );
-
- BisPtr->Shutdown (*BisAppHandle);
- return NULL;
- }
- //
- // Get BIS check flag.
- // If the BIS check flag cannot be read, shutdown BIS and return NULL.
- //
- DEBUG ((EFI_D_INFO, "\nBisPtr->GetBootObjectAuthorizationCheckFlag() "));
-
- EfiStatus = BisPtr->GetBootObjectAuthorizationCheckFlag (*BisAppHandle, &BisCheckFlag);
-
- if (EFI_ERROR (EfiStatus)) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxebcBisStart()""\n BisPtr->GetBootObjectAuthorizationCheckFlag() %r (%xh)\n",
- EfiStatus,
- EfiStatus)
- );
-
- BisPtr->Shutdown (*BisAppHandle);
- return NULL;
- }
- //
- // If the BIS check flag is FALSE, shutdown BIS and return NULL.
- //
- if (!BisCheckFlag) {
- DEBUG ((EFI_D_INFO, "\nBIS check flag is FALSE.\n"));
- BisPtr->Shutdown (*BisAppHandle);
- return NULL;
- } else {
- DEBUG ((EFI_D_INFO, "\nBIS check flag is TRUE."));
- }
- //
- // Early out if caller does not want signature information.
- //
- if (BisDataSigInfo == NULL) {
- return BisPtr;
- }
- //
- // Get BIS signature information.
- // If the signature information cannot be read or is invalid,
- // shutdown BIS and return NULL.
- //
- DEBUG ((EFI_D_INFO, "\nBisPtr->GetSignatureInfo() "));
-
- EfiStatus = BisPtr->GetSignatureInfo (*BisAppHandle, BisDataSigInfo);
-
- if (EFI_ERROR (EfiStatus)) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxebcBisStart()""\n BisPtr_GetSignatureInfo() %r (%xh)\n",
- EfiStatus,
- EfiStatus)
- );
-
- BisPtr->Shutdown (*BisAppHandle);
- return NULL;
- }
-
- if (*BisDataSigInfo == NULL) {
- //
- // This should never happen.
- //
- DEBUG (
- (EFI_D_NET,
- "\nPxebcBisStart()""\n BisPtr->GetSignatureInfo() Data pointer is NULL!\n")
- );
-
- BisPtr->Shutdown (*BisAppHandle);
- return NULL;
- }
-
- if ((*BisDataSigInfo)->Length < sizeof (EFI_BIS_SIGNATURE_INFO) ||
- (*BisDataSigInfo)->Length % sizeof (EFI_BIS_SIGNATURE_INFO) ||
- (*BisDataSigInfo)->Length > sizeof (EFI_BIS_SIGNATURE_INFO) * 63
- ) {
- //
- // This should never happen.
- //
- DEBUG (
- (EFI_D_NET,
- "\nPxebcBisStart()""\n BisPtr->GetSignatureInfo() Invalid BIS siginfo length.\n")
- );
-
- BisPtr->Free (*BisAppHandle, *BisDataSigInfo);
- BisPtr->Shutdown (*BisAppHandle);
- return NULL;
- }
-
- return BisPtr;
-}
-
-VOID
-PxebcBisStop (
- EFI_BIS_PROTOCOL *BisPtr,
- BIS_APPLICATION_HANDLE BisAppHandle,
- EFI_BIS_DATA *BisDataSigInfo
- )
-/*++
-Routine description:
- Stop the BIS interface and release allocations.
-
-Parameters:
- BisPtr := Pointer to BIS interface
- BisAppHandle := BIS application handle
- BisDataSigInfo := Pointer to BIS signature information data
-
-Returns:
-
---*/
-{
- if (BisPtr == NULL) {
- return ;
- }
- //
- // Free BIS allocated resources and shutdown BIS.
- // Return TRUE - BIS support is officially detected.
- //
- if (BisDataSigInfo != NULL) {
- BisPtr->Free (BisAppHandle, BisDataSigInfo);
- }
-
- BisPtr->Shutdown (BisAppHandle);
-}
-
-BOOLEAN
-PxebcBisVerify (
- PXE_BASECODE_DEVICE *Private,
- VOID *FileBuffer,
- UINTN FileLength,
- VOID *CredentialBuffer,
- UINTN CredentialLength
- )
-/*++
-Routine description:
- Verify image and credential file.
-
-Parameters:
- Private := Pointer to PxeBc interface
- FileBuffer := Pointer to image buffer
- FileLength := Image length in bytes
- CredentialBuffer := Pointer to credential buffer
- CredentialLength := Credential length in bytes
-
-Returns:
- TRUE := verified
- FALSE := not verified
---*/
-{
- EFI_BIS_PROTOCOL *BisPtr;
- BIS_APPLICATION_HANDLE BisAppHandle;
- EFI_BIS_DATA FileData;
- EFI_BIS_DATA CredentialData;
- EFI_STATUS EfiStatus;
- BOOLEAN IsVerified;
-
- if (Private == NULL || FileBuffer == NULL || FileLength == 0 || CredentialBuffer == NULL || CredentialLength == 0) {
- return FALSE;
- }
-
- BisPtr = PxebcBisStart (Private, &BisAppHandle, NULL);
-
- if (BisPtr == NULL) {
- return FALSE;
- }
-
- FileData.Length = (UINT32) FileLength;
- FileData.Data = FileBuffer;
- CredentialData.Length = (UINT32) CredentialLength;
- CredentialData.Data = CredentialBuffer;
-
- EfiStatus = BisPtr->VerifyBootObject (
- BisAppHandle,
- &CredentialData,
- &FileData,
- &IsVerified
- );
-
- PxebcBisStop (BisPtr, BisAppHandle, NULL);
-
- return (BOOLEAN) ((EFI_ERROR (EfiStatus)) ? FALSE : (IsVerified ? TRUE : FALSE));
-}
-
-BOOLEAN
-PxebcBisDetect (
- PXE_BASECODE_DEVICE *Private
- )
-/*++
-Routine description:
- Check for BIS interface presence.
-
-Parameters:
- Private := Pointer to PxeBc interface
-
-Returns:
- TRUE := BIS present
- FALSE := BIS not present
---*/
-{
- EFI_BIS_PROTOCOL *BisPtr;
- BIS_APPLICATION_HANDLE BisAppHandle;
- EFI_BIS_DATA *BisDataSigInfo;
-
- BisPtr = PxebcBisStart (Private, &BisAppHandle, &BisDataSigInfo);
-
- if (BisPtr == NULL) {
- return FALSE;
- }
-
- PxebcBisStop (BisPtr, BisAppHandle, BisDataSigInfo);
-
- return TRUE;
-}
-
-VOID *BCNotifyReg;
-
-EFI_STATUS
-EFIAPI
-BcStart (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN BOOLEAN UseIPv6
- )
-/*++
-
- Routine Description:
- Start and initialize the BaseCode protocol, Simple Network protocol and UNDI.
-
- Arguments:
- Private - Pointer to Pxe BaseCode Protocol
- UseIPv6 - Do we want to support IPv6?
-
- Returns:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_UNSUPPORTED
- EFI_ALREADY_STARTED
- EFI_OUT_OF_RESOURCES
- Status is also returned from SNP.Start() and SNP.Initialize().
-
---*/
-{
- EFI_SIMPLE_NETWORK_PROTOCOL *SnpPtr;
- EFI_SIMPLE_NETWORK_MODE *SnpModePtr;
- EFI_STATUS StatCode;
- PXE_BASECODE_DEVICE *Private;
-
- //
- // Lock the instance data
- //
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- //
- // Make sure BaseCode is not already started.
- //
- if (This->Mode->Started) {
- DEBUG ((EFI_D_WARN, "\nBcStart() BC is already started.\n"));
- EfiReleaseLock (&Private->Lock);
- return EFI_ALREADY_STARTED;
- }
-
- //
- // Fail if IPv6 is requested and not supported.
- //
- if (UseIPv6) {
- DEBUG ((EFI_D_WARN, "\nBcStart() IPv6 is not supported.\n"));
- EfiReleaseLock (&Private->Lock);
- return EFI_UNSUPPORTED;
- }
-
- //
- // Setup shortcuts to SNP protocol and data structure.
- //
- SnpPtr = Private->SimpleNetwork;
- SnpModePtr = SnpPtr->Mode;
-
- //
- // Start and initialize SNP.
- //
- if (SnpModePtr->State == EfiSimpleNetworkStopped) {
- StatCode = (*SnpPtr->Start) (SnpPtr);
-
- if (SnpModePtr->State != EfiSimpleNetworkStarted) {
- DEBUG ((EFI_D_WARN, "\nBcStart() Could not start SNP.\n"));
- EfiReleaseLock (&Private->Lock);
- return StatCode;
- }
- }
- //
- // acquire memory for mode and transmit/receive buffers
- //
- if (SnpModePtr->State == EfiSimpleNetworkStarted) {
- StatCode = (*SnpPtr->Initialize) (SnpPtr, 0, 0);
-
- if (SnpModePtr->State != EfiSimpleNetworkInitialized) {
- DEBUG ((EFI_D_WARN, "\nBcStart() Could not initialize SNP."));
- EfiReleaseLock (&Private->Lock);
- return StatCode;
- }
- }
- //
- // Dump debug info.
- //
- DEBUG ((EFI_D_INFO, "\nBC Start()"));
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->State %Xh",
- SnpModePtr->State)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->HwAddressSize %Xh",
- SnpModePtr->HwAddressSize)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->MediaHeaderSize %Xh",
- SnpModePtr->MediaHeaderSize)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->MaxPacketSize %Xh",
- SnpModePtr->MaxPacketSize)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->MacAddressChangeable %Xh",
- SnpModePtr->MacAddressChangeable)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->MultipleTxSupported %Xh",
- SnpModePtr->MultipleTxSupported)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->CurrentAddress %Xh",
- *((UINTN *)&SnpModePtr->CurrentAddress))
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->BroadcastAddress %Xh",
- *((UINTN *)&SnpModePtr->BroadcastAddress))
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->PermanentAddress %Xh",
- *((UINTN *)&SnpModePtr->PermanentAddress))
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->NvRamSize %Xh",
- SnpModePtr->NvRamSize)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->NvRamAccessSize %Xh",
- SnpModePtr->NvRamAccessSize)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->ReceiveFilterMask %Xh",
- SnpModePtr->ReceiveFilterMask)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->ReceiveFilterSetting %Xh",
- SnpModePtr->ReceiveFilterSetting)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->MCastFilterCount %Xh",
- SnpModePtr->MCastFilterCount)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->MCastFilter %Xh",
- SnpModePtr->MCastFilter)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->IfType %Xh",
- SnpModePtr->IfType)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->MediaPresentSupported %Xh",
- SnpModePtr->MediaPresentSupported)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nSnpModePtr->MediaPresent %Xh",
- SnpModePtr->MediaPresent)
- );
-
- //
- // If media check is supported and there is no media,
- // return error to caller.
- //
- if (SnpModePtr->MediaPresentSupported && !SnpModePtr->MediaPresent) {
- DEBUG ((EFI_D_WARN, "\nBcStart() Media not present.\n"));
- EfiReleaseLock (&Private->Lock);
- return EFI_NO_MEDIA;
- }
- //
- // Allocate Tx/Rx buffers
- //
- Private->TransmitBufferPtr = AllocateZeroPool (BUFFER_ALLOCATE_SIZE);
- if (Private->TransmitBufferPtr == NULL) {
- DEBUG ((EFI_D_NET, "\nBcStart() Could not alloc TxBuf.\n"));
- EfiReleaseLock (&Private->Lock);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Private->ReceiveBufferPtr = AllocateZeroPool (BUFFER_ALLOCATE_SIZE);
- if (Private->ReceiveBufferPtr == NULL) {
- DEBUG ((EFI_D_NET, "\nBcStart() Could not alloc RxBuf.\n"));
- FreePool (Private->TransmitBufferPtr);
- EfiReleaseLock (&Private->Lock);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Private->TftpErrorBuffer = AllocatePool (256);
- if (Private->TftpErrorBuffer == NULL) {
- FreePool (Private->ReceiveBufferPtr);
- FreePool (Private->TransmitBufferPtr);
- EfiReleaseLock (&Private->Lock);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Private->TftpAckBuffer = AllocatePool (256);
- if (Private->TftpAckBuffer == NULL) {
- FreePool (Private->TftpErrorBuffer);
- FreePool (Private->ReceiveBufferPtr);
- FreePool (Private->TransmitBufferPtr);
- EfiReleaseLock (&Private->Lock);
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Initialize private BaseCode instance data
- //
- do {
- Private->RandomPort = (UINT16) (Private->RandomPort + PXE_RND_PORT_LOW + Random (Private));
- } while (Private->RandomPort < PXE_RND_PORT_LOW);
-
- Private->Igmpv1TimeoutEvent = NULL;
- Private->UseIgmpv1Reporting = TRUE;
- Private->IpLength = IP_ADDRESS_LENGTH (Private->EfiBc.Mode);
-
- //
- // Initialize Mode structure
- //
- //
- // check for callback protocol and set boolean
- //
- SetMakeCallback (Private);
- Private->EfiBc.Mode->Started = TRUE;
- Private->EfiBc.Mode->TTL = DEFAULT_TTL;
- Private->EfiBc.Mode->ToS = DEFAULT_ToS;
- Private->EfiBc.Mode->UsingIpv6 = UseIPv6;
- Private->EfiBc.Mode->DhcpDiscoverValid = FALSE;
- Private->EfiBc.Mode->DhcpAckReceived = FALSE;
- Private->EfiBc.Mode->ProxyOfferReceived = FALSE;
- Private->EfiBc.Mode->PxeDiscoverValid = FALSE;
- Private->EfiBc.Mode->PxeReplyReceived = FALSE;
- Private->EfiBc.Mode->PxeBisReplyReceived = FALSE;
- Private->EfiBc.Mode->IcmpErrorReceived = FALSE;
- Private->EfiBc.Mode->TftpErrorReceived = FALSE;
- ZeroMem (&Private->EfiBc.Mode->StationIp, sizeof (EFI_IP_ADDRESS));
- ZeroMem (&Private->EfiBc.Mode->SubnetMask, sizeof (EFI_IP_ADDRESS));
- Private->EfiBc.Mode->IpFilter.Filters = 0;
- Private->EfiBc.Mode->IpFilter.IpCnt = 0;
- Private->EfiBc.Mode->ArpCacheEntries = 0;
- Private->EfiBc.Mode->RouteTableEntries = 0;
- ZeroMem (&Private->EfiBc.Mode->IcmpError, sizeof (EFI_PXE_BASE_CODE_ICMP_ERROR));
- ZeroMem (&Private->EfiBc.Mode->TftpError, sizeof (EFI_PXE_BASE_CODE_TFTP_ERROR));
-
- //
- // Set to PXE_TRUE by the BC constructor if this BC implementation
- // supports IPv6.
- //
- Private->EfiBc.Mode->Ipv6Supported = SUPPORT_IPV6;
- Private->EfiBc.Mode->Ipv6Available = FALSE;
-
- //
- // Set to TRUE by the BC constructor if this BC implementation
- // supports BIS.
- //
- Private->EfiBc.Mode->BisSupported = TRUE;
- Private->EfiBc.Mode->BisDetected = PxebcBisDetect (Private);
-
- //
- // This field is set to PXE_TRUE by the BC Start() function. When this
- // field is PXE_TRUE, ARP packets are sent as needed to get IP and MAC
- // addresses. This can cause unexpected delays in the DHCP(), Discover()
- // and MTFTP() functions. Setting this to PXE_FALSE will cause these
- // functions to fail if the required IP/MAC information is not in the
- // ARP cache. The value of this field can be changed by an application
- // at any time.
- //
- Private->EfiBc.Mode->AutoArp = TRUE;
-
- //
- // Unlock the instance data
- //
- EfiReleaseLock (&Private->Lock);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-BcStop (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This
- )
-/*++
-
- Routine Description:
- Stop the BaseCode protocol, Simple Network protocol and UNDI.
-
- Arguments:
- Private - Pointer to Pxe BaseCode Protocol
-
- Returns:
-
- 0 - Successfully stopped
- !0 - Failed
---*/
-{
- //
- // Lock the instance data
- //
- EFI_SIMPLE_NETWORK_PROTOCOL *SnpPtr;
- EFI_SIMPLE_NETWORK_MODE *SnpModePtr;
- EFI_STATUS StatCode;
- PXE_BASECODE_DEVICE *Private;
-
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE poiner == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- SnpPtr = Private->SimpleNetwork;
- SnpModePtr = SnpPtr->Mode;
-
- //
- // Issue BC command
- //
- StatCode = EFI_NOT_STARTED;
-
- if (SnpModePtr->State == EfiSimpleNetworkInitialized) {
- StatCode = (*SnpPtr->Shutdown) (SnpPtr);
- }
-
- if (SnpModePtr->State == EfiSimpleNetworkStarted) {
- StatCode = (*SnpPtr->Stop) (SnpPtr);
- }
-
- if (Private->TransmitBufferPtr != NULL) {
- FreePool (Private->TransmitBufferPtr);
- Private->TransmitBufferPtr = NULL;
- }
-
- if (Private->ReceiveBufferPtr != NULL) {
- FreePool (Private->ReceiveBufferPtr);
- Private->ReceiveBufferPtr = NULL;
- }
-
- if (Private->ArpBuffer != NULL) {
- FreePool (Private->ArpBuffer);
- Private->ArpBuffer = NULL;
- }
-
- if (Private->TftpErrorBuffer != NULL) {
- FreePool (Private->TftpErrorBuffer);
- Private->TftpErrorBuffer = NULL;
- }
-
- if (Private->TftpAckBuffer != NULL) {
- FreePool (Private->TftpAckBuffer);
- Private->TftpAckBuffer = NULL;
- }
-
- if (Private->Igmpv1TimeoutEvent != NULL) {
- gBS->CloseEvent (Private->Igmpv1TimeoutEvent);
- Private->Igmpv1TimeoutEvent = NULL;
- }
-
- Private->FileSize = 0;
- Private->EfiBc.Mode->Started = FALSE;
-
- //
- // Unlock the instance data
- //
- EfiReleaseLock (&Private->Lock);
- return StatCode;
-}
-
-const IPV4_ADDR AllSystemsGroup = { { 224, 0, 0, 1 } };
-
-EFI_STATUS
-IpFilter (
- IN PXE_BASECODE_DEVICE *Private,
- IN EFI_PXE_BASE_CODE_IP_FILTER *Filter
- )
-/*++
-
- Routine Description:
- Set up the IP filter
-
- Arguments:
- Private - Pointer to Pxe BaseCode Protocol
- Filter - Pointer to the filter
-
- Returns:
-
- 0 - Successfully set the filter
- !0 - Failed
---*/
-{
- EFI_STATUS StatCode;
- EFI_MAC_ADDRESS MACadds[PXE_IP_FILTER_SIZE];
- EFI_PXE_BASE_CODE_MODE *PxebcMode;
- EFI_SIMPLE_NETWORK_PROTOCOL *SnpPtr;
- EFI_SIMPLE_NETWORK_MODE *SnpModePtr;
- UINT32 Enable;
- UINT32 Disable;
- UINTN Index;
- UINTN Index2;
-
- PxebcMode = Private->EfiBc.Mode;
- SnpPtr = Private->SimpleNetwork;
- SnpModePtr = SnpPtr->Mode;
-
- //
- // validate input parameters
- // must have a filter
- // must not have any extra filter bits set
- //
- if (Filter == NULL ||
- (Filter->Filters &~FILTER_BITS)
- //
- // must not have a count which is too large or with no IP list
- //
- ||
- (Filter->IpCnt && (!Filter->IpList || Filter->IpCnt > PXE_IP_FILTER_SIZE))
- //
- // must not have incompatible filters - promiscuous incompatible with anything else
- //
- ||
- (
- (Filter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS) &&
- ((Filter->Filters &~EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS) || Filter->IpCnt)
- )
- ) {
- DEBUG ((EFI_D_INFO, "\nIpFilter() Exit #1"));
- return EFI_INVALID_PARAMETER;
- }
- //
- // promiscuous multicast incompatible with multicast in IP list
- //
- if (Filter->IpCnt && (Filter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST)) {
- for (Index = 0; Index < Filter->IpCnt; ++Index) {
- if (IS_MULTICAST (&Filter->IpList[Index])) {
- DEBUG ((EFI_D_INFO, "\nIpFilter() Exit #2"));
- return EFI_INVALID_PARAMETER;
- }
- }
- }
- //
- // leave groups for all those multicast which are no longer enabled
- //
- for (Index = 0; Index < PxebcMode->IpFilter.IpCnt; ++Index) {
- if (!IS_MULTICAST (&PxebcMode->IpFilter.IpList[Index])) {
- continue;
- }
-
- for (Index2 = 0; Index2 < Filter->IpCnt; ++Index2) {
- if (!CompareMem (&PxebcMode->IpFilter.IpList[Index], &Filter->IpList[Index2], IP_ADDRESS_LENGTH (PxebcMode))) {
- //
- // still enabled
- //
- break;
- }
- }
- //
- // if we didn't find it, remove from group
- //
- if (Index2 == Filter->IpCnt) {
- IgmpLeaveGroup (Private, &PxebcMode->IpFilter.IpList[Index]);
- }
- }
- //
- // set enable bits, convert multicast ip adds, join groups
- // allways leave receive broadcast enabled at hardware layer
- //
- Index2 = 0;
-
- if (Filter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS) {
- Enable = EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS;
- } else {
- if (Filter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) {
- Enable = EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
- } else {
- Enable = EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST;
-
- for (Index = 0; Index < Filter->IpCnt; ++Index) {
- CopyMem (&(PxebcMode->IpFilter.IpList[Index]), &(Filter->IpList[Index]), sizeof (EFI_IP_ADDRESS));
-
- if (IS_MULTICAST (&Filter->IpList[Index])) {
- EFI_IP_ADDRESS *TmpIp;
-
- Enable |= EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST;
-
- //
- // if this is the first group, add the all systems group to mcast list
- //
- if (!Index2)
- {
- TmpIp = (EFI_IP_ADDRESS *) &AllSystemsGroup;
- --Index;
- } else {
- TmpIp = (EFI_IP_ADDRESS *) &Filter->IpList[Index];
- }
- //
- // get MAC address of IP
- //
- StatCode = (*SnpPtr->MCastIpToMac) (SnpPtr, PxebcMode->UsingIpv6, TmpIp, &MACadds[Index2++]);
-
- if (EFI_ERROR (StatCode)) {
- DEBUG (
- (EFI_D_INFO,
- "\nIpFilter() Exit #2 %Xh (%r)",
- StatCode,
- StatCode)
- );
- return StatCode;
- }
- } else {
- Enable |= EFI_SIMPLE_NETWORK_RECEIVE_UNICAST;
- }
- }
- }
-
- if (Filter->Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) {
- Enable |= EFI_SIMPLE_NETWORK_RECEIVE_UNICAST;
- }
- }
- //
- // if nothing changed, just return
- //
- DEBUG (
- (EFI_D_INFO,
- "\nsnp->ReceiveFilterSetting == %Xh Filter->IpCnt == %Xh",
- SnpModePtr->ReceiveFilterSetting,
- Filter->IpCnt)
- );
-
- if (SnpModePtr->ReceiveFilterSetting == Enable && !Filter->IpCnt) {
- DEBUG ((EFI_D_INFO, "\nIpFilter() Exit #4"));
- return EFI_SUCCESS;
- }
- //
- // disable those currently set but not set in new filter
- //
- Disable = SnpModePtr->ReceiveFilterSetting &~Enable;
-
- StatCode = SnpPtr->ReceiveFilters (SnpPtr, Enable, Disable, FALSE, Index2, MACadds);
-
- PxebcMode->IpFilter.IpCnt = Filter->IpCnt;
-
- //
- // join groups for all multicast in list
- //
- for (Index = 0; Index < Filter->IpCnt; ++Index) {
- if (IS_MULTICAST (&Filter->IpList[Index])) {
- IgmpJoinGroup (Private, &Filter->IpList[Index]);
- }
- }
-
- DEBUG ((EFI_D_INFO, "\nIpFilter() Exit #5 %Xh (%r)", StatCode, StatCode));
-
- return StatCode;
-}
-
-EFI_STATUS
-EFIAPI
-BcIpFilter (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN EFI_PXE_BASE_CODE_IP_FILTER *Filter
- )
-/*++
-
- Routine Description:
- Call the IP filter
-
- Arguments:
- Private - Pointer to Pxe BaseCode Protocol
- Filter - Pointer to the filter
-
- Returns:
-
- 0 - Successfully set the filter
- !0 - Failed
---*/
-{
- EFI_STATUS StatCode;
- PXE_BASECODE_DEVICE *Private;
-
- //
- // Lock the instance data and make sure started
- //
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE poiner == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- if (This->Mode == NULL || !This->Mode->Started) {
- DEBUG ((EFI_D_ERROR, "BC was not started."));
- EfiReleaseLock (&Private->Lock);
- return EFI_NOT_STARTED;
- }
-
- if (Filter == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Issue BC command
- //
- StatCode = IpFilter (Private, Filter);
-
- //
- // Unlock the instance data
- //
- EfiReleaseLock (&Private->Lock);
- return StatCode;
-}
-
-EFI_STATUS
-EFIAPI
-BcSetParameters (
- EFI_PXE_BASE_CODE_PROTOCOL *This,
- BOOLEAN *AutoArpPtr,
- BOOLEAN *SendGuidPtr,
- UINT8 *TimeToLivePtr,
- UINT8 *TypeOfServicePtr,
- BOOLEAN *MakeCallbackPtr
- )
-/*++
-
- Routine Description:
- Set the Base Code behavior parameters
-
- Arguments:
- This - Pointer to Pxe BaseCode Protocol
- AutoArpPtr - Boolean to do ARP stuff
- SendGuidPtr - Boolean whether or not to send GUID info
- TimeToLivePtr - Value for Total time to live
- TypeOfServicePtr - Value for Type of Service
- MakeCallbackPtr - Boolean to determine if we make callbacks
-
- Returns:
-
- 0 - Successfully set the parameters
- !0 - Failed
---*/
-{
- EFI_PXE_BASE_CODE_MODE *PxebcMode;
- EFI_GUID TmpGuid;
- CHAR8 *SerialNumberPtr;
- EFI_STATUS StatCode;
- PXE_BASECODE_DEVICE *Private;
-
- //
- // Lock the instance data and make sure started
- //
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE poiner == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- if (This->Mode == NULL || !This->Mode->Started) {
- DEBUG ((EFI_D_ERROR, "BC was not started."));
- EfiReleaseLock (&Private->Lock);
- return EFI_NOT_STARTED;
- }
-
- DEBUG ((EFI_D_INFO, "\nSetParameters() Entry. "));
-
- PxebcMode = Private->EfiBc.Mode;
- StatCode = EFI_SUCCESS;
-
- if (SendGuidPtr != NULL) {
- if (*SendGuidPtr) {
- if (PxeBcLibGetSmbiosSystemGuidAndSerialNumber (&TmpGuid, &SerialNumberPtr) != EFI_SUCCESS) {
- return EFI_INVALID_PARAMETER;
- }
- }
- }
-
- if (MakeCallbackPtr != NULL) {
- if (*MakeCallbackPtr) {
- if (!SetMakeCallback (Private)) {
- return EFI_INVALID_PARAMETER;
- }
- }
-
- PxebcMode->MakeCallbacks = *MakeCallbackPtr;
- }
-
- if (AutoArpPtr != NULL) {
- PxebcMode->AutoArp = *AutoArpPtr;
- }
-
- if (SendGuidPtr != NULL) {
- PxebcMode->SendGUID = *SendGuidPtr;
- }
-
- if (TimeToLivePtr != NULL) {
- PxebcMode->TTL = *TimeToLivePtr;
- }
-
- if (TypeOfServicePtr != NULL) {
- PxebcMode->ToS = *TypeOfServicePtr;
- }
- //
- // Unlock the instance data
- //
- DEBUG ((EFI_D_INFO, "\nSetparameters() Exit = %xh ", StatCode));
-
- EfiReleaseLock (&Private->Lock);
- return StatCode;
-}
-//
-// //////////////////////////////////////////////////////////
-//
-// BC Set Station IP Routine
-//
-EFI_STATUS
-EFIAPI
-BcSetStationIP (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN EFI_IP_ADDRESS *StationIpPtr,
- IN EFI_IP_ADDRESS *SubnetMaskPtr
- )
-/*++
-
- Routine Description:
- Set the station IP address
-
- Arguments:
- This - Pointer to Pxe BaseCode Protocol
- StationIpPtr - Pointer to the requested IP address to set in base code
- SubnetMaskPtr - Pointer to the requested subnet mask for the base code
-
- Returns:
-
- EFI_SUCCESS - Successfully set the parameters
- EFI_NOT_STARTED - BC has not started
---*/
-{
- EFI_PXE_BASE_CODE_MODE *PxebcMode;
- EFI_STATUS StatCode;
- PXE_BASECODE_DEVICE *Private;
- UINT32 SubnetMask;
-
- //
- // Lock the instance data and make sure started
- //
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE poiner == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- if (This->Mode == NULL || !This->Mode->Started) {
- DEBUG ((EFI_D_ERROR, "BC was not started."));
- StatCode = EFI_NOT_STARTED;
- goto RELEASE_LOCK;
- }
-
- PxebcMode = Private->EfiBc.Mode;
-
- if (!Private->GoodStationIp && ((StationIpPtr == NULL) || (SubnetMaskPtr == NULL))) {
- //
- // It's not allowed to only set one of the two addresses while there isn't a previous
- // GOOD address configuration.
- //
- StatCode = EFI_INVALID_PARAMETER;
- goto RELEASE_LOCK;
- }
-
- if (SubnetMaskPtr != NULL) {
- SubnetMask = SubnetMaskPtr->Addr[0];
-
- if (SubnetMask & (SubnetMask + 1)) {
- //
- // the subnet mask is valid if it's with leading continuous 1 bits.
- //
- StatCode = EFI_INVALID_PARAMETER;
- goto RELEASE_LOCK;
- }
- } else {
- SubnetMaskPtr = &PxebcMode->SubnetMask;
- SubnetMask = SubnetMaskPtr->Addr[0];
- }
-
- if (StationIpPtr == NULL) {
- StationIpPtr = &PxebcMode->StationIp;
- }
-
- if (!IS_INADDR_UNICAST (StationIpPtr) ||
- ((StationIpPtr->Addr[0] | SubnetMask) == BROADCAST_IPv4)) {
- //
- // The station IP is not a unicast address.
- //
- StatCode = EFI_INVALID_PARAMETER;
- goto RELEASE_LOCK;
- }
-
- CopyMem (&PxebcMode->StationIp, StationIpPtr, sizeof (EFI_IP_ADDRESS));
- CopyMem (&PxebcMode->SubnetMask, SubnetMaskPtr, sizeof (EFI_IP_ADDRESS));
-
- Private->GoodStationIp = TRUE;
-
-RELEASE_LOCK:
- //
- // Unlock the instance data
- //
- EfiReleaseLock (&Private->Lock);
-
- return StatCode;
-}
-
-EFI_DRIVER_BINDING_PROTOCOL gPxeBcDriverBinding = {
- PxeBcDriverSupported,
- PxeBcDriverStart,
- PxeBcDriverStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-EFIAPI
-PxeBcDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports Controller. Any Controller
- than contains a Snp protocol can be supported.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test.
- RemainingDevicePath - Not used.
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_ALREADY_STARTED - This driver is already running on this device.
- other - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_NETWORK_PROTOCOL *SnpPtr;
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- NULL,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiSimpleNetworkProtocolGuid,
- (VOID **) &SnpPtr,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiSimpleNetworkProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PxeBcDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Start the Base code driver.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test.
- RemainingDevicePath - Not used.
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_ALREADY_STARTED - This driver is already running on this device.
- other - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- PXE_BASECODE_DEVICE *Private;
- LOADFILE_DEVICE *pLF;
-
- //
- // Allocate structures needed by BaseCode and LoadFile protocols.
- //
- Private = AllocateZeroPool (sizeof (PXE_BASECODE_DEVICE));
-
- if (Private == NULL ) {
- DEBUG ((EFI_D_NET, "\nBcNotifySnp() Could not alloc PXE_BASECODE_DEVICE structure.\n"));
- return EFI_OUT_OF_RESOURCES;
- }
-
- pLF = AllocateZeroPool (sizeof (LOADFILE_DEVICE));
- if (pLF == NULL) {
- DEBUG ((EFI_D_NET, "\nBcNotifySnp() Could not alloc LOADFILE_DEVICE structure.\n"));
- FreePool (Private);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Private->EfiBc.Mode = AllocateZeroPool (sizeof (EFI_PXE_BASE_CODE_MODE));
- if (Private->EfiBc.Mode == NULL) {
- DEBUG ((EFI_D_NET, "\nBcNotifySnp() Could not alloc Mode structure.\n"));
- FreePool (Private);
- FreePool (pLF);
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Lock access, just in case
- //
- EfiInitializeLock (&Private->Lock, TPL_CALLBACK);
- EfiAcquireLock (&Private->Lock);
-
- EfiInitializeLock (&pLF->Lock, TPL_CALLBACK);
- EfiAcquireLock (&pLF->Lock);
-
- //
- // Initialize PXE structure
- //
- //
- // First initialize the internal 'private' data that the application
- // does not see.
- //
- Private->Signature = PXE_BASECODE_DEVICE_SIGNATURE;
- Private->Handle = Controller;
-
- //
- // Get the NII interface
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
- (VOID **) &Private->NiiPtr,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid,
- (VOID **) &Private->NiiPtr,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- goto PxeBcError;
- }
- }
- //
- // Get the Snp interface
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiSimpleNetworkProtocolGuid,
- (VOID **) &Private->SimpleNetwork,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- goto PxeBcError;
- }
-
- //
- // Next, initialize the external 'public' data that
- // the application does see.
- //
- Private->EfiBc.Revision = EFI_PXE_BASE_CODE_INTERFACE_REVISION;
- Private->EfiBc.Start = BcStart;
- Private->EfiBc.Stop = BcStop;
- Private->EfiBc.Dhcp = BcDhcp;
- Private->EfiBc.Discover = BcDiscover;
- Private->EfiBc.Mtftp = BcMtftp;
- Private->EfiBc.UdpWrite = BcUdpWrite;
- Private->EfiBc.UdpRead = BcUdpRead;
- Private->EfiBc.Arp = BcArp;
- Private->EfiBc.SetIpFilter = BcIpFilter;
- Private->EfiBc.SetParameters = BcSetParameters;
- Private->EfiBc.SetStationIp = BcSetStationIP;
- Private->EfiBc.SetPackets = BcSetPackets;
-
- //
- // Initialize BaseCode Mode structure
- //
- Private->EfiBc.Mode->Started = FALSE;
- Private->EfiBc.Mode->TTL = DEFAULT_TTL;
- Private->EfiBc.Mode->ToS = DEFAULT_ToS;
- Private->EfiBc.Mode->UsingIpv6 = FALSE;
- Private->EfiBc.Mode->AutoArp = TRUE;
-
- //
- // Set to PXE_TRUE by the BC constructor if this BC
- // implementation supports IPv6.
- //
- Private->EfiBc.Mode->Ipv6Supported = SUPPORT_IPV6;
- Private->EfiBc.Mode->Ipv6Available = FALSE;
-
- //
- // Set to TRUE by the BC constructor if this BC
- // implementation supports BIS.
- //
- Private->EfiBc.Mode->BisSupported = TRUE;
- Private->EfiBc.Mode->BisDetected = PxebcBisDetect (Private);
-
- //
- // Initialize LoadFile structure.
- //
- pLF->Signature = LOADFILE_DEVICE_SIGNATURE;
- pLF->LoadFile.LoadFile = LoadFile;
- pLF->Private = Private;
-
- //
- // Install protocol interfaces.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Controller,
- &gEfiPxeBaseCodeProtocolGuid,
- &Private->EfiBc,
- &gEfiLoadFileProtocolGuid,
- &pLF->LoadFile,
- NULL
- );
-
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiSimpleNetworkProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- goto PxeBcError;
- }
- //
- // Release locks.
- //
- EfiReleaseLock (&pLF->Lock);
- EfiReleaseLock (&Private->Lock);
- return Status;
-
-PxeBcError: ;
- FreePool (Private->EfiBc.Mode);
- FreePool (Private);
- FreePool (pLF);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-PxeBcDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop the Base code driver.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test.
- NumberOfChildren - Not used
- ChildHandleBuffer - Not used
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_ALREADY_STARTED - This driver is already running on this device.
- other - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_LOAD_FILE_PROTOCOL *LfProtocol;
- LOADFILE_DEVICE *LoadDevice;
-
- //
- // Get our context back.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiLoadFileProtocolGuid,
- (VOID **) &LfProtocol,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- LoadDevice = EFI_LOAD_FILE_DEV_FROM_THIS (LfProtocol);
-
- Status = gBS->UninstallMultipleProtocolInterfaces (
- Controller,
- &gEfiLoadFileProtocolGuid,
- &LoadDevice->LoadFile,
- &gEfiPxeBaseCodeProtocolGuid,
- &LoadDevice->Private->EfiBc,
- NULL
- );
-
- if (!EFI_ERROR (Status)) {
-
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiSimpleNetworkProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- FreePool (LoadDevice->Private->EfiBc.Mode);
- FreePool (LoadDevice->Private);
- FreePool (LoadDevice);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-InitializeBCDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
- Routine Description:
- Initialize the base code drivers and install the driver binding
-
- Arguments:
- Standard EFI Image Entry
-
- Returns:
- EFI_SUCCESS - This driver was successfully bound
-
---*/
-{
- InitArpHeader ();
- OptionsStrucInit ();
-
- return EFI_SUCCESS;
-}
-
-/* eof - bc.c */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/dhcp.h b/EdkModulePkg/Universal/Network/PxeBc/Dxe/dhcp.h
deleted file mode 100644
index 102d30b..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/dhcp.h
+++ /dev/null
@@ -1,632 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
---*/
-
-#ifndef _DHCP_H
-#define _DHCP_H
-
-//
-// Definitions for DHCP version 4 UDP packet.
-// The field names in this structure are defined and described in RFC 2131.
-//
-#pragma pack(1)
-
-typedef struct {
- UINT8 op;
-#define BOOTP_REQUEST 1
-#define BOOTP_REPLY 2
-
- UINT8 htype;
- UINT8 hlen;
- UINT8 hops;
- UINT32 xid;
- UINT16 secs;
- UINT16 flags;
-#define DHCP_BROADCAST_FLAG 0x8000
-
- UINT32 ciaddr;
- UINT32 yiaddr;
- UINT32 siaddr;
- UINT32 giaddr;
- UINT8 chaddr[16];
- UINT8 sname[64];
- UINT8 file[128];
- UINT8 options[312];
-#define OP_PAD 0
-#define OP_END 255
-#define OP_SUBNET_MASK 1
-#define OP_TIME_OFFSET 2
-#define OP_ROUTER_LIST 3
-#define OP_TIME_SERVERS 4
-#define OP_NAME_SERVERS 5
-#define OP_DNS_SERVERS 6
-#define OP_LOG_SERVERS 7
-#define OP_COOKIE_SERVERS 8
-#define OP_LPR_SREVERS 9
-#define OP_IMPRESS_SERVERS 10
-#define OP_RES_LOC_SERVERS 11
-#define OP_HOST_NAME 12
-#define OP_BOOT_FILE_SZ 13
-#define OP_DUMP_FILE 14
-#define OP_DOMAIN_NAME 15
-#define OP_SWAP_SERVER 16
-#define OP_ROOT_PATH 17
-#define OP_EXTENSION_PATH 18
-#define OP_IP_FORWARDING 19
-#define OP_NON_LOCAL_SRC_RTE 20
-#define OP_POLICY_FILTER 21
-#define OP_MAX_DATAGRAM_SZ 22
-#define OP_DEFAULT_TTL 23
-#define OP_MTU_AGING_TIMEOUT 24
-#define OP_MTU_SIZES 25
-#define OP_MTU_TO_USE 26
-#define OP_ALL_SUBNETS_LOCAL 27
-#define OP_BROADCAST_ADD 28
-#define OP_PERFORM_MASK_DISCOVERY 29
-#define OP_RESPOND_TO_MASK_REQ 30
-#define OP_PERFORM_ROUTER_DISCOVERY 31
-#define OP_ROUTER_SOLICIT_ADDRESS 32
-#define OP_STATIC_ROUTER_LIST 33
-#define OP_USE_ARP_TRAILERS 34
-#define OP_ARP_CACHE_TIMEOUT 35
-#define OP_ETHERNET_ENCAPSULATION 36
-#define OP_TCP_DEFAULT_TTL 37
-#define OP_TCP_KEEP_ALIVE_INT 38
-#define OP_KEEP_ALIVE_GARBAGE 39
-#define OP_NIS_DOMAIN_NAME 40
-#define OP_NIS_SERVERS 41
-#define OP_NTP_SERVERS 42
-#define OP_VENDOR_SPECIFIC 43
-#define VEND_PXE_MTFTP_IP 1
-#define VEND_PXE_MTFTP_CPORT 2
-#define VEND_PXE_MTFTP_SPORT 3
-#define VEND_PXE_MTFTP_TMOUT 4
-#define VEND_PXE_MTFTP_DELAY 5
-#define VEND_PXE_DISCOVERY_CONTROL 6
-#define VEND_PXE_DISCOVERY_MCAST_ADDR 7
-#define VEND_PXE_BOOT_SERVERS 8
-#define VEND_PXE_BOOT_MENU 9
-#define VEND_PXE_BOOT_PROMPT 10
-#define VEND_PXE_MCAST_ADDRS_ALLOC 11
-#define VEND_PXE_CREDENTIAL_TYPES 12
-#define VEND_PXE_BOOT_ITEM 71
-#define OP_NBNS_SERVERS 44
-#define OP_NBDD_SERVERS 45
-#define OP_NETBIOS_NODE_TYPE 46
-#define OP_NETBIOS_SCOPE 47
-#define OP_XWINDOW_SYSTEM_FONT_SERVERS 48
-#define OP_XWINDOW_SYSTEM_DISPLAY_MANAGERS 49
-#define OP_DHCP_REQ_IP_ADD 50
-#define OP_DHCP_LEASE_TIME 51
-#define OP_DHCP_OPTION_OVERLOAD 52
-#define OVLD_FILE 1
-#define OVLD_SRVR_NAME 2
-#define OP_DHCP_MESSAGE_TYPE 53
-#define DHCPDISCOVER 1
-#define DHCPOFFER 2
-#define DHCPREQUEST 3
-#define DHCPDECLINE 4
-#define DHCPACK 5
-#define DHCPNAK 6
-#define DHCPRELEASE 7
-#define DHCPINFORM 8
-#define OP_DHCP_SERVER_IP 54
-#define OP_DHCP_PARM_REQ_LIST 55
-#define OP_DHCP_ERROR_MESSAGE 56
-#define OP_DHCP_MAX_MESSAGE_SZ 57
-#define OP_DHCP_RENEWAL_TIME 58
-#define OP_DHCP_REBINDING_TIME 59
-#define OP_DHCP_CLASS_IDENTIFIER 60
-#define OP_DHCP_CLIENT_IDENTIFIER 61
-#define OP_NISPLUS_DOMAIN_NAME 64
-#define OP_NISPLUS_SERVERS 65
-#define OP_DHCP_TFTP_SERVER_NAME 66
-#define OP_DHCP_BOOTFILE 67
-#define OP_MOBILE_IP_HOME_AGENTS 68
-#define OP_SMPT_SERVERS 69
-#define OP_POP3_SERVERS 70
-#define OP_NNTP_SERVERS 71
-#define OP_WWW_SERVERS 72
-#define OP_FINGER_SERVERS 73
-#define OP_IRC_SERVERS 74
-#define OP_STREET_TALK_SERVERS 75
-#define OP_STREET_TALK_DIR_ASSIST_SERVERS 76
-#define OP_NDS_SERVERS 85
-#define OP_NDS_TREE_NAME 86
-#define OP_NDS_CONTEXT 87
-#define OP_DHCP_SYSTEM_ARCH 93
-#define OP_DHCP_NETWORK_ARCH 94
-#define OP_DHCP_PLATFORM_ID 97
-} DHCPV4_STRUCT;
-
-//
-// DHCPv4 option header
-//
-typedef struct {
- UINT8 OpCode;
- UINT8 Length;
- //
- // followed by Data[]
- //
-} DHCPV4_OP_HEADER;
-
-//
-// Generic DHCPv4 option (header followed by data)
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Data[1];
-} DHCPV4_OP_STRUCT;
-
-//
-// Maximum DHCP packet size on ethernet
-//
-#define MAX_DHCP_MSG_SZ (MAX_ENET_DATA_SIZE - sizeof (IPV4_HEADER) - sizeof (UDPV4_HEADER))
-
-//
-// Macros used in pxe_bc_dhcp.c and pxe_loadfile.c
-//
-#define DHCPV4_TRANSMIT_BUFFER (*(DHCPV4_STRUCT *) (Private->TransmitBuffer))
-#define DHCPV4_OPTIONS_BUFFER (*(struct optionsstr *) DHCPV4_TRANSMIT_BUFFER.options)
-
-#define DHCPV4_ACK_INDEX 0
-#define PXE_BINL_INDEX 1
-#define PXE_OFFER_INDEX 1
-#define PXE_ACK_INDEX 2
-#define PXE_BIS_INDEX 3
-
-#define DHCPV4_ACK_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[DHCPV4_ACK_INDEX]
-#define PXE_BINL_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_BINL_INDEX]
-#define PXE_OFFER_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_OFFER_INDEX]
-#define PXE_ACK_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_ACK_INDEX]
-#define PXE_BIS_BUFFER ((struct DhcpReceiveBufferStruct *) Private->DhcpPacketBuffer)[PXE_BIS_INDEX]
-
-#define DHCPV4_ACK_PACKET DHCPV4_ACK_BUFFER.u.Dhcpv4
-#define PXE_BINL_PACKET PXE_BINL_BUFFER.u.Dhcpv4
-#define PXE_OFFER_PACKET PXE_OFFER_BUFFER.u.Dhcpv4
-#define PXE_ACK_PACKET PXE_ACK_BUFFER.u.Dhcpv4
-#define PXE_BIS_PACKET PXE_BIS_BUFFER.u.Dhcpv4
-
-//
-// network structure definitions
-//
-//
-// some option definitions
-//
-#define DHCPV4_OPTION_LENGTH(type) (sizeof (type) - sizeof (DHCPV4_OP_HEADER))
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Type;
-} DHCPV4_OP_MESSAGE_TYPE;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Overload;
-} DHCPV4_OP_OVERLOAD;
-
-//
-// boot server list structure
-// one or more contained in a pxe boot servers structure
-//
-typedef struct {
- UINT8 IpCount;
- EFI_IPv4_ADDRESS IpList[1]; // IP count of IPs
-} PXEV4_SERVER_LIST;
-
-typedef struct {
- UINT8 IpCount;
- EFI_IPv6_ADDRESS IpList[1]; // IP count of IPs
-} PXEV6_SERVER_LIST;
-
-typedef union {
- PXEV4_SERVER_LIST Ipv4List;
- PXEV6_SERVER_LIST Ipv6List;
-} PXE_SERVER_LISTS;
-
-typedef struct {
- UINT16 Type;
- PXE_SERVER_LISTS u;
-} PXE_SERVER_LIST;
-
-//
-// pxe boot servers structure
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- PXE_SERVER_LIST ServerList[1]; // one or more
-} PXE_OP_SERVER_LIST;
-
-//
-// pxe boot item structure
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT16 Type;
- UINT16 Layer;
-} PXE_OP_BOOT_ITEM;
-
-//
-// pxe boot menu item structure
-//
-typedef struct {
- UINT16 Type;
- UINT8 DataLen;
- UINT8 Data[1];
-} PXE_BOOT_MENU_ENTRY;
-
-//
-// pxe boot menu structure
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- PXE_BOOT_MENU_ENTRY MenuItem[1];
-} PXE_OP_BOOT_MENU;
-
-//
-// pxe boot prompt structure
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Timeout;
- UINT8 Prompt[1];
-} PXE_OP_BOOT_PROMPT;
-
-#define PXE_BOOT_PROMPT_AUTO_SELECT 0
-#define PXE_BOOT_PROMPT_NO_TIMEOUT 255
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Class[1];
-} DHCPV4_OP_CLASS;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 File[1];
-} DHCPV4_OP_BOOTFILE;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 VendorOptions[1];
-} DHCPV4_OP_VENDOR_OPTIONS;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 MaxSize[2];
-} DHCPV4_OP_MAX_MESSAGE_SIZE;
-
-typedef struct {
- UINT8 _OP_SUBNET_MASK; /* 1 */
- UINT8 _OP_TIME_OFFSET; /* 2 */
- UINT8 _OP_ROUTER_LIST; /* 3 */
- UINT8 _OP_TIME_SERVERS; /* 4 */
- UINT8 _OP_NAME_SERVERS; /* 5 */
- UINT8 _OP_DNS_SERVERS; /* 6 */
- UINT8 _OP_HOST_NAME; /* 12 */
- UINT8 _OP_BOOT_FILE_SZ; /* 13 */
- UINT8 _OP_DOMAIN_NAME; /* 15 */
- UINT8 _OP_ROOT_PATH; /* 17 */
- UINT8 _OP_EXTENSION_PATH; /* 18 */
- UINT8 _OP_MAX_DATAGRAM_SZ; /* 22 */
- UINT8 _OP_DEFAULT_TTL; /* 23 */
- UINT8 _OP_BROADCAST_ADD; /* 28 */
- UINT8 _OP_NIS_DOMAIN_NAME; /* 40 */
- UINT8 _OP_NIS_SERVERS; /* 41 */
- UINT8 _OP_NTP_SERVERS; /* 42 */
- UINT8 _OP_VENDOR_SPECIFIC; /* 43 */
- UINT8 _OP_DHCP_REQ_IP_ADD; /* 50 */
- UINT8 _OP_DHCP_LEASE_TIME; /* 51 */
- UINT8 _OP_DHCP_SERVER_IP; /* 54 */
- UINT8 _OP_DHCP_RENEWAL_TIME; /* 58 */
- UINT8 _OP_DHCP_REBINDING_TIME; /* 59 */
- UINT8 _OP_DHCP_CLASS_IDENTIFIER; /* 60 */
- UINT8 _OP_DHCP_TFTP_SERVER_NAME; /* 66 */
- UINT8 _OP_DHCP_BOOTFILE; /* 67 */
- UINT8 _OP_DHCP_PLATFORM_ID; /* 97 */
- UINT8 VendorOption128; // vendor option 128
- UINT8 VendorOption129; // vendor option 129
- UINT8 VendorOption130; // vendor option 130
- UINT8 VendorOption131; // vendor option 131
- UINT8 VendorOption132; // vendor option 132
- UINT8 VendorOption133; // vendor option 133
- UINT8 VendorOption134; // vendor option 134
- UINT8 VendorOption135; // vendor option 135
-} DHCPV4_REQUESTED_OPTIONS_DATA;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- DHCPV4_REQUESTED_OPTIONS_DATA Data;
-} DHCPV4_OP_REQUESTED_OPTIONS;
-
-typedef struct opipstr {
- DHCPV4_OP_HEADER Header;
- EFI_IPv4_ADDRESS Ip;
-} DHCPV4_OP_IP_ADDRESS;
-
-//
-// ip list structure - e.g. router list
-//
-typedef struct {
- DHCPV4_OP_HEADER Header;
- EFI_IPv4_ADDRESS IpList[1];
-} DHCPV4_OP_IP_LIST;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Type;
- UINT8 Guid[sizeof (EFI_GUID)];
-} DHCPV4_OP_CLIENT_ID;
-
-//
-// special options start - someday obsolete ???
-//
-#define DHCPV4_OP_PLATFORM_ID DHCPV4_OP_CLIENT_ID
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT8 Type; // SNP = 2
- UINT8 MajorVersion;
- UINT8 MinorVersion;
-} DHCPV4_OP_NETWORK_INTERFACE;
-
-#define UNDI_TYPE 1
-#define SNP_TYPE 2
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- UINT16 Type;
-} DHCPV4_OP_ARCHITECTURE_TYPE;
-//
-// special options end - someday obsolete ???
-//
-typedef struct {
- UINT8 ClassIdentifier[10]; // PXEClient:
- UINT8 Lit2[5]; // Arch:
- UINT8 ArchitectureType[5]; // 00000 - 65536
- UINT8 Lit3[1]; // :
- UINT8 InterfaceName[4]; // e.g. UNDI
- UINT8 Lit4[1]; // :
- UINT8 UndiMajor[3]; // 000 - 255
- UINT8 UndiMinor[3]; // 000 - 255
-} DHCPV4_CLASS_ID_DATA;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- DHCPV4_CLASS_ID_DATA Data;
-} DHCPV4_OP_CLASS_ID;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- EFI_IPv4_ADDRESS Ip;
-} DHCPV4_OP_REQUESTED_IP;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- EFI_IPv4_ADDRESS Ip;
-} DHCPV4_OP_SERVER_IP;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- EFI_IPv4_ADDRESS Ip;
-} DHCPV4_OP_SUBNET_MASK;
-
-typedef struct { // oppxedisctlstr {
- DHCPV4_OP_HEADER Header;
- UINT8 ControlBits;
-} PXE_OP_DISCOVERY_CONTROL;
-
-#define DISABLE_BCAST (1 << 0)
-#define DISABLE_MCAST (1 << 1)
-#define USE_ACCEPT_LIST (1 << 2)
-#define USE_BOOTFILE (1 << 3)
-
-#pragma pack()
-//
-// definitions of indices to populate option interest array
-//
-#define VEND_PXE_MTFTP_IP_IX 1 // multicast IP address of bootfile for MTFTP listen
-#define VEND_PXE_MTFTP_CPORT_IX 2 // UDP Port to monitor for MTFTP responses - Intel order
-#define VEND_PXE_MTFTP_SPORT_IX 3 // Server UDP Port for MTFTP open - Intel order
-#define VEND_PXE_MTFTP_TMOUT_IX 4 // Listen timeout - secs
-#define VEND_PXE_MTFTP_DELAY_IX 5 // Transmission timeout - secs
-#define VEND_PXE_DISCOVERY_CONTROL_IX 6 // bit field
-#define VEND_PXE_DISCOVERY_MCAST_ADDR_IX 7 // boot server discovery multicast address
-#define VEND_PXE_BOOT_SERVERS_IX 8 // list of boot servers of form tp(2) cnt(1) ips[cnt]
-#define VEND_PXE_BOOT_MENU_IX 9
-#define VEND_PXE_BOOT_PROMPT_IX 10
-#define VEND_PXE_MCAST_ADDRS_ALLOC_IX 0 // not used by PXE client
-#define VEND_PXE_CREDENTIAL_TYPES_IX 11
-#define VEND_13_IX 0 // not used by PXE client
-#define VEND_14_IX 0 // not used by PXE client
-#define VEND_15_IX 0 // not used by PXE client
-#define VEND_16_IX 0 // not used by PXE client
-#define VEND_17_IX 0 // not used by PXE client
-#define VEND_18_IX 0 // not used by PXE client
-#define VEND_19_IX 0 // not used by PXE client
-#define VEND_20_IX 0 // not used by PXE client
-#define VEND_21_IX 0 // not used by PXE client
-#define VEND_22_IX 0 // not used by PXE client
-#define VEND_23_IX 0 // not used by PXE client
-#define VEND_24_IX 0 // not used by PXE client
-#define VEND_25_IX 0 // not used by PXE client
-#define VEND_26_IX 0 // not used by PXE client
-#define VEND_27_IX 0 // not used by PXE client
-#define VEND_28_IX 0 // not used by PXE client
-#define VEND_29_IX 0 // not used by PXE client
-#define VEND_30_IX 0 // not used by PXE client
-#define VEND_31_IX 0 // not used by PXE client
-#define VEND_32_IX 0 // not used by PXE client
-#define VEND_33_IX 0 // not used by PXE client
-#define VEND_34_IX 0 // not used by PXE client
-#define VEND_35_IX 0 // not used by PXE client
-#define VEND_36_IX 0 // not used by PXE client
-#define VEND_37_IX 0 // not used by PXE client
-#define VEND_38_IX 0 // not used by PXE client
-#define VEND_39_IX 0 // not used by PXE client
-#define VEND_40_IX 0 // not used by PXE client
-#define VEND_41_IX 0 // not used by PXE client
-#define VEND_42_IX 0 // not used by PXE client
-#define VEND_43_IX 0 // not used by PXE client
-#define VEND_44_IX 0 // not used by PXE client
-#define VEND_45_IX 0 // not used by PXE client
-#define VEND_46_IX 0 // not used by PXE client
-#define VEND_47_IX 0 // not used by PXE client
-#define VEND_48_IX 0 // not used by PXE client
-#define VEND_49_IX 0 // not used by PXE client
-#define VEND_50_IX 0 // not used by PXE client
-#define VEND_51_IX 0 // not used by PXE client
-#define VEND_52_IX 0 // not used by PXE client
-#define VEND_53_IX 0 // not used by PXE client
-#define VEND_54_IX 0 // not used by PXE client
-#define VEND_55_IX 0 // not used by PXE client
-#define VEND_56_IX 0 // not used by PXE client
-#define VEND_57_IX 0 // not used by PXE client
-#define VEND_58_IX 0 // not used by PXE client
-#define VEND_59_IX 0 // not used by PXE client
-#define VEND_60_IX 0 // not used by PXE client
-#define VEND_61_IX 0 // not used by PXE client
-#define VEND_62_IX 0 // not used by PXE client
-#define VEND_63_IX 0 // not used by PXE client
-#define VEND_64_IX 0 // not used by PXE client
-#define VEND_65_IX 0 // not used by PXE client
-#define VEND_66_IX 0 // not used by PXE client
-#define VEND_67_IX 0 // not used by PXE client
-#define VEND_68_IX 0 // not used by PXE client
-#define VEND_69_IX 0 // not used by PXE client
-#define VEND_70_IX 0 // not used by PXE client
-#define VEND_PXE_BOOT_ITEM_IX 12
-
-#define MAX_OUR_PXE_OPT VEND_PXE_BOOT_ITEM // largest PXE option in which we are interested
-#define MAX_OUR_PXE_IX VEND_PXE_BOOT_ITEM_IX // largest PXE option index
-//
-// define various types by options that are sent
-//
-#define WfM11a_OPTS ((1<<VEND_PXE_MTFTP_IP_IX) | \
- (1<<VEND_PXE_MTFTP_CPORT_IX) | \
- (1<<VEND_PXE_MTFTP_SPORT_IX) | \
- (1<<VEND_PXE_MTFTP_TMOUT_IX) | \
- (1<<VEND_PXE_MTFTP_DELAY_IX))
-
-#define DISCOVER_OPTS ((1<<VEND_PXE_DISCOVERY_CONTROL_IX) | \
- (1<<VEND_PXE_DISCOVERY_MCAST_ADDR_IX) | \
- (1<<VEND_PXE_BOOT_SERVERS_IX) | \
- (1<<VEND_PXE_BOOT_MENU_IX) | \
- (1<<VEND_PXE_BOOT_PROMPT_IX) | \
- (1<<VEND_PXE_BOOT_ITEM_IX))
-
-#define CREDENTIALS_OPT (1 << VEND_PXE_CREDENTIAL_TYPES_IX)
-
-//
-// definitions of indices to populate option interest array
-//
-#define OP_SUBNET_MASK_IX 1
-#define OP_TIME_OFFSET_IX 0 // not used by PXE client
-#define OP_ROUTER_LIST_IX 2
-#define OP_TIME_SERVERS_IX 0 // not used by PXE client
-#define OP_NAME_SERVERS_IX 0 // not used by PXE client
-#define OP_DNS_SERVERS_IX 0 // not used by PXE client
-#define OP_LOG_SERVERS_IX 0 // not used by PXE client
-#define OP_COOKIE_SERVERS_IX 0 // not used by PXE client
-#define OP_LPR_SREVERS_IX 0 // not used by PXE client
-#define OP_IMPRESS_SERVERS_IX 0 // not used by PXE client
-#define OP_RES_LOC_SERVERS_IX 0 // not used by PXE client
-#define OP_HOST_NAME_IX 0 // not used by PXE client
-#define OP_BOOT_FILE_SZ_IX 9
-#define OP_DUMP_FILE_IX 0 // not used by PXE client
-#define OP_DOMAIN_NAME_IX 0 // not used by PXE client
-#define OP_SWAP_SERVER_IX 0 // not used by PXE client
-#define OP_ROOT_PATH_IX 0 // not used by PXE client
-#define OP_EXTENSION_PATH_IX 0 // not used by PXE client
-#define OP_IP_FORWARDING_IX 0 // not used by PXE client
-#define OP_NON_LOCAL_SRC_RTE_IX 0 // not used by PXE client
-#define OP_POLICY_FILTER_IX 0 // not used by PXE client
-#define OP_MAX_DATAGRAM_SZ_IX 0 // not used by PXE client
-#define OP_DEFAULT_TTL_IX 0 // not used by PXE client
-#define OP_MTU_AGING_TIMEOUT_IX 0 // not used by PXE client
-#define OP_MTU_SIZES_IX 0 // not used by PXE client
-#define OP_MTU_TO_USE_IX 0 // not used by PXE client
-#define OP_ALL_SUBNETS_LOCAL_IX 0 // not used by PXE client
-#define OP_BROADCAST_ADD_IX 0 // not used by PXE client
-#define OP_PERFORM_MASK_DISCOVERY_IX 0 // not used by PXE client
-#define OP_RESPOND_TO_MASK_REQ_IX 0 // not used by PXE client
-#define OP_PERFORM_ROUTER_DISCOVERY_IX 0 // not used by PXE client
-#define OP_ROUTER_SOLICIT_ADDRESS_IX 0 // not used by PXE client
-#define OP_STATIC_ROUTER_LIST_IX 0 // not used by PXE client
-#define OP_USE_ARP_TRAILERS_IX 0 // not used by PXE client
-#define OP_ARP_CACHE_TIMEOUT_IX 0 // not used by PXE client
-#define OP_ETHERNET_ENCAPSULATION_IX 0 // not used by PXE client
-#define OP_TCP_DEFAULT_TTL_IX 0 // not used by PXE client
-#define OP_TCP_KEEP_ALIVE_INT_IX 0 // not used by PXE client
-#define OP_KEEP_ALIVE_GARBAGE_IX 0 // not used by PXE client
-#define OP_NIS_DOMAIN_NAME_IX 0 // not used by PXE client
-#define OP_NIS_SERVERS_IX 0 // not used by PXE client
-#define OP_NTP_SERVERS_IX 0 // not used by PXE client
-#define OP_VENDOR_SPECIFIC_IX 3
-#define OP_NBNS_SERVERS_IX 0 // not used by PXE client
-#define OP_NBDD_SERVERS_IX 0 // not used by PXE client
-#define OP_NETBIOS_NODE_TYPE_IX 0 // not used by PXE client
-#define OP_NETBIOS_SCOPE_IX 0 // not used by PXE client
-#define OP_XWINDOW_SYSTEM_FONT_SERVERS_IX 0 // not used by PXE client
-#define OP_XWINDOW_SYSTEM_DISPLAY_MANAGERS_IX 0 // not used by PXE client
-// DHCP option indices
-//
-#define OP_DHCP_REQ_IP_ADD_IX 0 // not used by PXE client
-#define OP_DHCP_LEASE_TIME_IX 0 // not used by PXE client
-#define OP_DHCP_OPTION_OVERLOAD_IX 4
-#define OP_DHCP_MESSAGE_TYPE_IX 5
-#define OP_DHCP_SERVER_IP_IX 6
-#define OP_DHCP_PARM_REQ_LIST_IX 0 // not used by PXE client
-#define OP_DHCP_ERROR_MESSAGE_IX 0 // not used by PXE client
-#define OP_DHCP_MAX_MESSAGE_SZ_IX 0 // not used by PXE client
-#define OP_DHCP_RENEWAL_TIME_IX 0 // not used by PXE client
-#define OP_DHCP_REBINDING_TIME_IX 0 // not used by PXE client
-#define OP_DHCP_CLASS_IDENTIFIER_IX 7
-#define OP_DHCP_CLIENT_IDENTIFIER_IX 0 // not used by PXE client
-#define OP_RESERVED62_IX 0 // not used by PXE client
-#define OP_RESERVED63_IX 0 // not used by PXE client
-#define OP_NISPLUS_DOMAIN_NAME_IX 0 // not used by PXE client
-#define OP_NISPLUS_SERVERS_IX 0 // not used by PXE client
-#define OP_DHCP_TFTP_SERVER_NAME_IX 0 // not used by PXE client
-#define OP_DHCP_BOOTFILE_IX 8
-
-#define MAX_OUR_OPT OP_DHCP_BOOTFILE // largest option in which we are interested
-#define MAX_OUR_IX OP_BOOT_FILE_SZ_IX
-
-typedef struct {
- DHCPV4_OP_STRUCT *PktOptAdds[MAX_OUR_IX];
- DHCPV4_OP_STRUCT *PxeOptAdds[MAX_OUR_PXE_IX];
- UINT8 Status;
-} OPTION_POINTERS;
-
-typedef struct DhcpReceiveBufferStruct {
- union {
- UINT8 ReceiveBuffer[MAX_DHCP_MSG_SZ];
- DHCPV4_STRUCT Dhcpv4;
- } u;
-
- OPTION_POINTERS OpAdds;
-} DHCP_RECEIVE_BUFFER;
-
-#define PXE_TYPE (1 << 0)
-#define WfM11a_TYPE (1 << 1)
-#define DISCOVER_TYPE (1 << 2)
-#define CREDENTIALS_TYPE (1 << 3)
-#define USE_THREE_BYTE (1 << 4)
-
-VOID
-OptionsStrucInit (
- VOID
- );
-
-#endif // _DHCP_H
-
-/* EOF - dhcp.h */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/hton.h b/EdkModulePkg/Universal/Network/PxeBc/Dxe/hton.h
deleted file mode 100644
index b9000c1..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/hton.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- hton.h
-
-Abstract:
- Byte swapping macros.
-
---*/
-
-#ifndef _HTON_H_
-#define _HTON_H_
-
-//
-// Only Intel order functions are defined at this time.
-//
-#define HTONS(v) (UINT16) ((((v) << 8) & 0xff00) + (((v) >> 8) & 0x00ff))
-
-#define HTONL(v) \
- (UINT32) ((((v) << 24) & 0xff000000) + (((v) << 8) & 0x00ff0000) + (((v) >> 8) & 0x0000ff00) + (((v) >> 24) & 0x000000ff))
-
-#define HTONLL(v) swap64 (v)
-
-#define U8PTR(na) ((UINT8 *) &(na))
-
-#define NTOHS(ns) ((UINT16) (((*U8PTR (ns)) << 8) +*(U8PTR (ns) + 1)))
-
-#define NTOHL(ns) \
- ((UINT32) (((*U8PTR (ns)) << 24) + ((*(U8PTR (ns) + 1)) << 16) + ((*(U8PTR (ns) + 2)) << 8) +*(U8PTR (ns) + 3)))
-
-#endif /* _HTON_H_ */
-
-/* EOF - hton.h */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/ip.h b/EdkModulePkg/Universal/Network/PxeBc/Dxe/ip.h
deleted file mode 100644
index 5cabf2e..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/ip.h
+++ /dev/null
@@ -1,742 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
---*/
-
-#ifndef _IP_H_
-#define _IP_H_
-
-#include "hton.h"
-
-//
-// Client architecture types
-//
-#if defined MDE_CPU_IA32
-#define SYS_ARCH 0x6
-#elif defined MDE_CPU_X64
-#define SYS_ARCH 0x7
-#elif defined MDE_CPU_IPF
-#define SYS_ARCH 0x2
-#else
-#error Unsupported Client Processor Type
-#endif
-
-
-//
-// portability macros
-//
-#define UDP_FILTER_MASK (EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP | \
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT | \
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP | \
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT | \
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER \
- )
-
-#define PXE_BOOT_LAYER_MASK 0x7FFF
-#define PXE_BOOT_LAYER_INITIAL 0x0000
-#define PXE_BOOT_LAYER_CREDENTIAL_FLAG 0x8000
-#define MAX_BOOT_SERVERS 32
-
-//
-// macro to evaluate IP address as TRUE if it is a multicast IP address
-//
-#define IS_MULTICAST(ptr) ((*((UINT8 *) ptr) & 0xf0) == 0xe0)
-
-//
-// length macros
-//
-#define IP_ADDRESS_LENGTH(qp) (((qp)->UsingIpv6) ? sizeof (EFI_IPv6_ADDRESS) : sizeof (EFI_IPv4_ADDRESS))
-
-#define MAX_FRAME_DATA_SIZE 1488
-#define ALLOCATE_SIZE(X) (((X) + 7) & 0xfff8)
-#define MODE_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_MODE))
-#define BUFFER_ALLOCATE_SIZE (8192 + 512)
-#define ROUTER_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_PXE_BASE_CODE_ROUTE_ENTRY) * PXE_ROUTER_TABLE_SIZE))
-#define ARP_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_PXE_BASE_CODE_ARP_ENTRY) * PXE_ARP_CACHE_SIZE))
-#define FILTER_ALLOCATE_SIZE ALLOCATE_SIZE ((sizeof (EFI_IP_ADDRESS) * PXE_IP_FILTER_SIZE))
-#define PXE_ARP_CACHE_SIZE 8
-#define PXE_ROUTER_TABLE_SIZE 8
-#define PXE_IP_FILTER_SIZE 8
-#define ICMP_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_ICMP_ERROR))
-#define TFTP_ERR_ALLOCATE_SIZE ALLOCATE_SIZE (sizeof (EFI_PXE_BASE_CODE_TFTP_ERROR))
-
-//
-// DHCP discover/request packets are sent to this UDP port. ProxyDHCP
-// servers listen on this port for DHCP discover packets that have a
-// class identifier (option 60) with 'PXEClient' in the first 9 bytes.
-// Bootservers also listen on this port for PXE broadcast discover
-// requests from PXE clients.
-//
-#define DHCP_SERVER_PORT 67
-
-//
-// When DHCP, proxyDHCP and Bootservers respond to DHCP and PXE broadcast
-// discover requests by broadcasting the reply packet, the packet is
-// broadcast to this port.
-//
-#define DHCP_CLIENT_PORT 68
-
-//
-// TFTP servers listen for TFTP open requests on this port.
-//
-#define TFTP_OPEN_PORT 69
-
-//
-// proxyDHCP and Bootservers listen on this port for a PXE unicast and/or
-// multicast discover requests from PXE clients. A PXE discover request
-// looks like a DHCP discover or DHCP request packet.
-//
-#define PXE_DISCOVERY_PORT 4011
-
-//
-// This port is used by the PXE client/server protocol tests.
-//
-#define PXE_PORT_PXETEST_PORT 0x8080
-
-//
-// Definitions for Ethertype protocol numbers and interface types
-// Per RFC 1700,
-//
-#define PXE_PROTOCOL_ETHERNET_IP 0x0800
-#define PXE_PROTOCOL_ETHERNET_ARP 0x0806
-#define PXE_PROTOCOL_ETHERNET_RARP 0x8035
-
-#define PXE_IFTYPE_ETHERNET 0x01
-#define PXE_IFTYPE_TOKENRING 0x04
-#define PXE_IFTYPE_FIBRE_CHANNEL 0x12
-
-//
-// Definitions for internet protocol version 4 header
-// Per RFC 791, September 1981.
-//
-#define IPVER4 4
-
-#pragma pack(1) // make network structures packed byte alignment
-typedef union {
- UINT8 B[4];
- UINT32 L;
-} IPV4_ADDR;
-
-#define IPV4_HEADER_LENGTH(IpHeaderPtr) (((IpHeaderPtr)->VersionIhl & 0xf) << 2)
-
-#define SET_IPV4_VER_HDL(IpHeaderPtr, IpHeaderLen) { \
- (IpHeaderPtr)->VersionIhl = (UINT8) ((IPVER4 << 4) | ((IpHeaderLen) >> 2)); \
- }
-
-typedef struct {
- UINT8 VersionIhl;
- UINT8 TypeOfService;
- UINT16 TotalLength;
- UINT16 Id;
- UINT16 FragmentFields;
- UINT8 TimeToLive;
- UINT8 Protocol;
- UINT16 HeaderChecksum;
- IPV4_ADDR SrcAddr;
- IPV4_ADDR DestAddr;
- //
- // options are not implemented
- //
-} IPV4_HEADER;
-
-#define IP_FRAG_RSVD 0x8000 // reserved bit - must be zero
-#define IP_NO_FRAG 0x4000 // do not fragment bit
-#define IP_MORE_FRAG 0x2000 // not last fragment
-#define IP_FRAG_OFF_MSK 0x1fff // fragment offset in 8 byte chunks
-#define DEFAULT_RFC_TTL 64
-
-#define PROT_ICMP 1
-#define PROT_IGMP 2
-#define PROT_TCP 6
-#define PROT_UDP 17
-
-/*
- * Definitions for internet control message protocol version 4 message
- * structure. Per RFC 792, September 1981.
- */
-
-//
-// icmp header for all icmp messages
-//
-typedef struct {
- UINT8 Type; // message type
- UINT8 Code; // type specific - 0 for types we implement
- UINT16 Checksum; // ones complement of ones complement sum of 16 bit words of message
-} ICMPV4_HEADER;
-
-#define ICMP_DEST_UNREACHABLE 3
-#define ICMP_SOURCE_QUENCH 4
-#define ICMP_REDIRECT 5
-#define ICMP_ECHO 8
-#define ICMP_ECHO_REPLY 0
-#define ICMP_ROUTER_ADV 9
-#define ICMP_ROUTER_SOLICIT 10
-#define ICMP_TIME_EXCEEDED 11
-#define ICMP_PARAMETER_PROBLEM 12
-#define ICMP_TIMESTAMP 13
-#define ICMP_TIMESTAMP_REPLY 14
-#define ICMP_INFO_REQ 15
-#define ICMP_INFO_REQ_REPLY 16
-#define ICMP_SUBNET_MASK_REQ 17
-#define ICMP_SUBNET_MASK_REPLY 18
-//
-// other ICMP message types ignored in this implementation
-//
-// icmp general messages
-//
-typedef struct {
- ICMPV4_HEADER Header;
- //
- // generally unused except byte [0] for
- // parameter problem message
- //
- UINT8 GenerallyUnused[4];
- //
- // original message ip header of plus 64
- // bits of data
- //
- IPV4_HEADER IpHeader;
-} ICMPV4_GENERAL_MESSAGE;
-
-//
-// icmp req/rply message header
-//
-typedef struct {
- ICMPV4_HEADER Header;
- UINT16 Id;
- UINT16 SequenceNumber;
-} ICMPV4_REQUEST_REPLY_HEADER;
-
-//
-// icmp echo message
-//
-typedef struct {
- ICMPV4_REQUEST_REPLY_HEADER Header;
- UINT8 EchoData[1]; // variable length data to be echoed
-} ICMPV4_ECHO_MESSAGE;
-
-//
-// icmp timestamp message - times are milliseconds since midnight UT -
-// if non std, set high order bit
-//
-typedef struct {
- ICMPV4_REQUEST_REPLY_HEADER Header;
- UINT32 OriginalTime; // originating timestamp
- UINT32 ReceiveTime; // receiving timestamp
- UINT32 TransmitTime; // transmitting timestamp
-} ICMPV4_TIMESTAMP_MESSAGE;
-
-//
-// icmp info request structure - fill in source and dest net ip address on reply
-//
-typedef struct {
- ICMPV4_REQUEST_REPLY_HEADER Header;
-} ICMPV4_INFO_MESSAGE;
-
-//
-// Definitions for internet control message protocol version 4 message structure
-// Router discovery
-// Per RFC 1256, September 1991.
-//
-//
-// icmp router advertisement message
-//
-typedef struct {
- ICMPV4_HEADER Header;
- UINT8 NumberEntries; // number of address entries
- UINT8 EntrySize; // number of 32 bit words per address entry
- UINT16 Lifetime; // seconds to consider info valid
- UINT32 RouterIp;
- UINT32 Preferance;
-} ICMPV4_ROUTER_ADVERTISE_MESSAGE;
-
-//
-// icmp router solicitation message
-//
-typedef struct {
- ICMPV4_HEADER Header;
- UINT32 Reserved;
-} ICMPV4_ROUTER_SOLICIT_MESSAGE;
-
-#define MAX_SOLICITATION_DELAY 1 // 1 second
-#define SOLICITATION_INTERVAL 3 // 3 seconds
-#define MAX_SOLICITATIONS 3 // 3 transmissions
-#define V1ROUTER_PRESENT_TIMEOUT 400 // 400 second timeout until v2 reports can be sent
-#define UNSOLICITED_REPORT_INTERVAL 10 // 10 seconds between unsolicited reports
-#define BROADCAST_IPv4 0xffffffff
-
-//
-// Definitions for address resolution protocol message structure
-// Per RFC 826, November 1982
-//
-typedef struct {
- UINT16 HwType; // hardware type - e.g. ethernet (1)
- UINT16 ProtType; // protocol type - for ethernet, 0x800 for IP
- UINT8 HwAddLen; // byte length of a hardware address (e.g. 6 for ethernet)
- UINT8 ProtAddLen; // byte length of a protocol address (e.g. 4 for ipv4)
- UINT16 OpCode;
- //
- // source and dest hw and prot addresses follow - see example below
- //
-} ARP_HEADER;
-
-#define ETHERNET_ADD_SPC 1
-
-#define ETHER_TYPE_IP 0x800
-
-#define ARP_REQUEST 1
-#define ARP_REPLY 2
-
-//
-// generic ARP packet
-//
-typedef struct {
- ARP_HEADER ArpHeader;
- EFI_MAC_ADDRESS SrcHardwareAddr;
- EFI_IP_ADDRESS SrcProtocolAddr;
- EFI_MAC_ADDRESS DestHardwareAddr;
- EFI_IP_ADDRESS DestProtocolAddr;
-} ARP_PACKET;
-
-#define ENET_HWADDLEN 6
-#define IPV4_PROTADDLEN 4
-
-//
-// Definitions for user datagram protocol version 4 pseudo header & header
-// Per RFC 768, 28 August 1980
-//
-typedef struct {
- IPV4_ADDR SrcAddr; // source ip address
- IPV4_ADDR DestAddr; // dest ip address
- UINT8 Zero; // 0
- UINT8 Protocol; // protocol
- UINT16 TotalLength; // UDP length - sizeof udpv4hdr + data length
-} UDPV4_PSEUDO_HEADER;
-
-typedef struct {
- UINT16 SrcPort; // source port identifier
- UINT16 DestPort; // destination port identifier
- UINT16 TotalLength; // total length header plus data
- //
- // ones complement of ones complement sum of 16 bit
- // words of pseudo header, UDP header, and data
- // zero checksum is transmitted as -0 (ones comp)
- // zero transmitted means checksum not computed
- // data follows
- //
- UINT16 Checksum;
-} UDPV4_HEADER;
-
-typedef struct {
- UDPV4_PSEUDO_HEADER Udpv4PseudoHeader;
- UDPV4_HEADER Udpv4Header;
-} UDPV4_HEADERS;
-
-//
-// Definitions for transmission control protocol header
-// Per RFC 793, September, 1981
-//
-typedef struct {
- IPV4_ADDR SrcAddr; // source ip address
- IPV4_ADDR DestAddr; // dest ip address
- UINT8 Zero; // 0
- UINT8 Protocol; // protocol
- UINT16 TotalLength; // TCP length - TCP header length + data length
-} TCPV4_PSEUDO_HEADER;
-
-typedef struct {
- UINT16 SrcPort; // source port identifier
- UINT16 DestPort; // destination port identifier
- UINT32 SeqNumber; // Sequence number
- UINT32 AckNumber; // Acknowledgement Number
- //
- // Nibble of HLEN (length of header in 32-bit multiples)
- // 6bits of RESERVED
- // Nibble of Code Bits
- //
- UINT16 HlenResCode;
- UINT16 Window; // Software buffer size (sliding window size) in network-standard byte order
- //
- // ones complement of ones complement sum of 16 bit words of
- // pseudo header, TCP header, and data
- // zero checksum is transmitted as -0 (ones comp)
- // zero transmitted means checksum not computed
- //
- UINT16 Checksum;
- UINT16 UrgentPointer; // pointer to urgent data (allows sender to specify urgent data)
-} TCPV4_HEADER;
-
-typedef struct {
- TCPV4_PSEUDO_HEADER Tcpv4PseudoHeader;
- TCPV4_HEADER Tcpv4Header;
-} TCPV4_HEADERS;
-
-typedef struct {
- UINT8 Kind; // one of the following:
- UINT8 Length; // total option length including Kind and Lth
- UINT8 Data[1]; // length = Lth - 2
-} TCPV4_OPTION;
-
-#define TCP_OP_END 0 // only used to pad to end of TCP header
-#define TCP_NOP 1 // optional - may be used to pad between options to get alignment
-#define TCP_MAX_SEG 2 // maximum receive segment size - only send at initial connection request
-#define MAX_MEDIA_HDR_SIZE 64
-#define MIN_ENET_DATA_SIZE 64
-#define MAX_ENET_DATA_SIZE 1500 // temp def - make a network based var
-#define MAX_IPV4_PKT_SIZE 65535 // maximum IP packet size
-#define MAX_IPV4_DATA_SIZE (MAX_IPV4_PKT_SIZE - sizeof (IPV4_HEADER))
-#define MAX_IPV4_FRAME_DATA_SIZE (MAX_FRAME_DATA_SIZE - sizeof (IPV4_HEADER))
-#define REAS_IPV4_PKT_SIZE 576 // minimum IP packet size all IP host can handle
-#define REAS_IPV4_DATA_SIZE (REAS_IPV4_PKT_SIZE - sizeof (IPV4_HEADER))
-
-//
-//
-//
-typedef union {
- UINT8 Data[MAX_ENET_DATA_SIZE];
- ICMPV4_HEADER IcmpHeader;
- IGMPV2_MESSAGE IgmpMessage;
- struct {
- UDPV4_HEADER UdpHeader;
- UINT8 Data[1];
- } Udp;
- struct {
- TCPV4_HEADER TcpHeader;
- UINT8 Data[1];
- } Tcp;
-} PROTOCOL_UNION;
-
-//
-// out buffer structure
-//
-typedef struct {
- UINT8 MediaHeader[MAX_MEDIA_HDR_SIZE];
- IPV4_HEADER IpHeader;
- //
- // following union placement only valid if no option IP header
- //
- PROTOCOL_UNION u;
-} IPV4_BUFFER;
-
-typedef struct {
- IPV4_HEADER IpHeader;
- //
- // following union placement only valid if no option IP header
- //
- PROTOCOL_UNION u;
-} IPV4_STRUCT;
-
-#pragma pack() // reset to default
-
- ////////////////////////////////////////////////////////////
-//
-// BC IP Filter Routine
-//
-EFI_STATUS
-IpFilter (
- PXE_BASECODE_DEVICE *Private,
- IN EFI_PXE_BASE_CODE_IP_FILTER *Filter
- )
-;
-
-//
-// //////////////////////////////////////////////////////////////////////
-//
-// Udp Write Routine - called by base code - e.g. TFTP - already locked
-//
-EFI_STATUS
-UdpWrite (
- IN PXE_BASECODE_DEVICE *Private,
- IN UINT16 OpFlags,
- IN EFI_IP_ADDRESS *DestIpPtr,
- IN EFI_PXE_BASE_CODE_UDP_PORT *DestPortptr,
- IN EFI_IP_ADDRESS *GatewayIpPtr, OPTIONAL
- IN EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
- IN UINTN *HeaderSizePtr, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN UINTN *BufferSizePtr,
- IN VOID *BufferPtr
- )
-;
-
-//
-// /////////////////////////////////////////////////////////////////////
-//
-// Udp Read Routine - called by base code - e.g. TFTP - already locked
-//
-EFI_STATUS
-UdpRead (
- IN PXE_BASECODE_DEVICE *Private,
- IN UINT16 OpFlags,
- IN OUT EFI_IP_ADDRESS *DestIpPtr, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPorPtrt, OPTIONAL
- IN OUT EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
- IN UINTN *HeaderSizePtr, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN OUT UINTN *BufferSizePtr,
- IN VOID *BufferPtr,
- IN EFI_EVENT TimeoutEvent
- )
-;
-
-VOID
-IgmpLeaveGroup (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *
- )
-;
-
-VOID
-IgmpJoinGroup (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *
- )
-;
-
-//
-// convert number to zero filled ascii value of length lth
-//
-VOID
-CvtNum (
- UINTN Number,
- UINT8 *BufferPtr,
- INTN BufferLen
- )
-;
-
-//
-// convert number to ascii string at ptr
-//
-VOID
-UtoA10 (
- UINTN Number,
- UINT8 *BufferPtr
- )
-;
-
-//
-// convert ascii numeric string to UINTN
-//
-UINTN
-AtoU (
- UINT8 *BufferPtr
- )
-;
-
-UINT64
-AtoU64 (
- UINT8 *BufferPtr
- )
-;
-
-//
-// calculate the internet checksum (RFC 1071)
-// return 16 bit ones complement of ones complement sum of 16 bit words
-//
-UINT16
-IpChecksum (
- UINT16 *MessagePtr,
- UINTN ByteLength
- )
-;
-
-//
-// do checksum on non contiguous header and data
-//
-UINT16
-IpChecksum2 (
- UINT16 *Header,
- UINTN HeaderLength,
- UINT16 *Message,
- UINTN MessageLength
- )
-;
-
-//
-// update checksum when only a single word changes
-//
-UINT16
-UpdateChecksum (
- UINT16 OldChecksum,
- UINT16 OldWord,
- UINT16 NewWord
- )
-;
-
-VOID
-SeedRandom (
- IN PXE_BASECODE_DEVICE *Private,
- IN UINT16 InitialSeed
- )
-;
-
-UINT16
-Random (
- IN PXE_BASECODE_DEVICE *Private
- )
-;
-
-EFI_STATUS
-SendPacket (
- PXE_BASECODE_DEVICE *Private,
- VOID *HeaderPtr,
- VOID *PacketPtr,
- INTN PacketLength,
- VOID *HardwareAddress,
- UINT16 MediaProtocol,
- IN EFI_PXE_BASE_CODE_FUNCTION Function
- )
-;
-
-VOID
-HandleArpReceive (
- PXE_BASECODE_DEVICE *Private,
- ARP_PACKET *ArpPacketPtr,
- VOID *HeaderPtr
- )
-;
-
-VOID
-HandleIgmp (
- PXE_BASECODE_DEVICE *Private,
- IGMPV2_MESSAGE *IgmpMessageptr,
- UINTN IgmpMessageLen
- )
-;
-
-VOID
-IgmpCheckTimers (
- PXE_BASECODE_DEVICE *Private
- )
-; // poll when doing a receive
-// return hw add of IP and TRUE if available, otherwise FALSE
-//
-BOOLEAN
-GetHwAddr (
- IN PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *ProtocolAddressPtr,
- EFI_MAC_ADDRESS *HardwareAddressPtr
- )
-;
-
-EFI_STATUS
-DoArp (
- IN PXE_BASECODE_DEVICE *Private,
- IN EFI_IP_ADDRESS *ProtocolAddressPtr,
- OUT EFI_MAC_ADDRESS *HardwareAddressptr
- )
-;
-
-BOOLEAN
-OnSameSubnet (
- UINTN IpAddressLen,
- EFI_IP_ADDRESS *Ip1,
- EFI_IP_ADDRESS *Ip2,
- EFI_IP_ADDRESS *SubnetMask
- )
-;
-
-VOID
-IpAddRouter (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *RouterIp
- )
-;
-
-#define Ip4AddRouter(Private, Ipv4Ptr) IpAddRouter (Private, (EFI_IP_ADDRESS *) Ipv4Ptr)
-
-//
-// routine to send ipv4 packet
-// ipv4 + upper protocol header for length TotHdrLth in xmtbuf, ipv4 header length IpHdrLth
-// routine fills in ipv4hdr Ver_Hdl, TotLth, and Checksum, moves in Data, and gets dest MAC address
-//
-EFI_STATUS
-Ipv4Xmt (
- PXE_BASECODE_DEVICE *Private,
- UINT32 GatewayIP,
- UINTN IpHeaderLen,
- UINTN TotalHeaderLen,
- VOID *Data,
- UINTN DataLen,
- EFI_PXE_BASE_CODE_FUNCTION Function
- )
-;
-
-//
-// send ipv4 packet with ipv4 option
-//
-EFI_STATUS
-Ipv4SendWOp (
- PXE_BASECODE_DEVICE *Private,
- UINT32 GatewayIP,
- UINT8 *MessagePtr,
- UINTN MessageLth,
- UINT8 Protocol,
- UINT8 *Option,
- UINTN OptionLen,
- UINT32 DestIp,
- EFI_PXE_BASE_CODE_FUNCTION Function
- )
-;
-
-//
-// send MsgLth message at MsgPtr - higher level protocol header already in xmtbuf, length HdrSize
-//
-EFI_STATUS
-Ip4Send (
- IN PXE_BASECODE_DEVICE *Private, // pointer to instance data
- IN UINTN MayFragment, //
- IN UINT8 Protocol, // protocol
- IN UINT32 SrcIp, // Source IP address
- IN UINT32 DestIp, // Destination IP address
- IN UINT32 GatewayIp, // used if not NULL and needed
- IN UINTN HeaderSize, // protocol header byte length
- IN UINT8 *MsgPtr, // pointer to data
- IN UINTN MsgLength
- )
-; // data byte length
-// receive up to MsgLth message into MsgPtr for protocol Prot
-// return message length, src/dest ips if select any, and pointer to protocol header
-//
-EFI_STATUS
-IpReceive (
- IN PXE_BASECODE_DEVICE *Private, // pointer to instance data
- UINT16 OpFlags, // Flags to determine if filtering on IP addresses
- EFI_IP_ADDRESS *SrcIpPtr, // if filtering, O if accept any
- EFI_IP_ADDRESS *DstIpPtr, // if filtering, O if accept any
- UINT8 Protocol, // protocol
- VOID *HeaderPtr, // address of where to put protocol header
- UINTN HeaderSize, // protocol header byte length
- UINT8 *MsgPtr, // pointer to data buffer
- UINTN *MsgLenPtr, // pointer to data buffer length/ O - returned data length
- IN EFI_EVENT TimeoutEvent
- )
-;
-
-//
-// routine to cycle waiting for a receive or timeout
-//
-EFI_STATUS
-WaitForReceive (
- IN PXE_BASECODE_DEVICE *Private,
- IN EFI_PXE_BASE_CODE_FUNCTION Function,
- IN EFI_EVENT TimeoutEvent,
- IN OUT UINTN *HeaderSizePtr,
- IN OUT UINTN *BufferSizePtr,
- IN OUT UINT16 *ProtocolPtr
- )
-;
-
-#endif /* _IP_H_ */
-
-/* EOF - ip.h */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_arp.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_arp.c
deleted file mode 100644
index 747d243..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_arp.c
+++ /dev/null
@@ -1,611 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- pxe_bc_arp.c
-
-Abstract:
-
---*/
-
-
-#include "Bc.h"
-
-//
-// Definitions for ARP
-// Per RFC 826
-//
-STATIC ARP_HEADER ArpHeader;
-
-#pragma pack(1)
-STATIC struct {
- UINT8 MediaHeader[14];
- ARP_HEADER ArpHeader;
- UINT8 ArpData[64];
-} ArpReplyPacket;
-#pragma pack()
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-InitArpHeader (
- VOID
- )
-/*++
-Routine description:
- Initialize ARP packet header.
-
-Parameters:
- none
-
-Returns:
- none
-
---*/
-{
- ArpHeader.HwType = HTONS (ETHERNET_ADD_SPC);
- ArpHeader.ProtType = HTONS (ETHER_TYPE_IP);
- ArpHeader.HwAddLen = ENET_HWADDLEN;
- ArpHeader.ProtAddLen = IPV4_PROTADDLEN;
- ArpHeader.OpCode = HTONS (ARP_REQUEST);
-
- CopyMem (&ArpReplyPacket.ArpHeader, &ArpHeader, sizeof (ARP_HEADER));
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-HandleArpReceive (
- IN PXE_BASECODE_DEVICE *Private,
- IN ARP_PACKET *ArpPacketPtr,
- IN VOID *MediaHeader
- )
-/*++
-Routine description:
- Process ARP packet.
-
-Parameters:
- Private := Pointer to PxeBc interface
- ArpPacketPtr := Pointer to ARP packet
- MediaHeader := Pointer to media header.
-Returns:
---*/
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- EFI_SIMPLE_NETWORK_MODE *SnpMode;
- EFI_MAC_ADDRESS TmpMacAddr;
- UINTN Index;
- UINT8 *SrcHwAddr;
- UINT8 *SrcPrAddr;
- UINT8 *DstHwAddr;
- UINT8 *DstPrAddr;
- UINT8 *TmpPtr;
-
- //
- //
- //
- PxeBcMode = Private->EfiBc.Mode;
- SnpMode = Private->SimpleNetwork->Mode;
-
- //
- // For now only ethernet addresses are supported.
- // This will need to be updated when other media
- // layers are supported by PxeBc, Snp and UNDI.
- //
- if (ArpPacketPtr->ArpHeader.HwType != HTONS (ETHERNET_ADD_SPC)) {
- return ;
- }
- //
- // For now only IP protocol addresses are supported.
- // This will need to be updated when other protocol
- // types are supported by PxeBc, Snp and UNDI.
- //
- if (ArpPacketPtr->ArpHeader.ProtType != HTONS (ETHER_TYPE_IP)) {
- return ;
- }
- //
- // For now only SNP hardware address sizes are supported.
- //
- if (ArpPacketPtr->ArpHeader.HwAddLen != SnpMode->HwAddressSize) {
- return ;
- }
- //
- // For now only PxeBc protocol address sizes are supported.
- //
- if (ArpPacketPtr->ArpHeader.ProtAddLen != Private->IpLength) {
- return ;
- }
- //
- // Ignore out of range opcodes
- //
- switch (ArpPacketPtr->ArpHeader.OpCode) {
- case HTONS (ARP_REPLY):
- case HTONS (ARP_REQUEST):
- break;
-
- default:
- return ;
- }
- //
- // update entry in our ARP cache if we have it
- //
- SrcHwAddr = (UINT8 *) &ArpPacketPtr->SrcHardwareAddr;
- SrcPrAddr = SrcHwAddr + SnpMode->HwAddressSize;
-
- for (Index = 0; Index < PxeBcMode->ArpCacheEntries; ++Index) {
- if (CompareMem (
- &PxeBcMode->ArpCache[Index].IpAddr,
- SrcPrAddr,
- Private->IpLength
- )) {
- continue;
- }
-
- CopyMem (
- &PxeBcMode->ArpCache[Index].MacAddr,
- SrcHwAddr,
- SnpMode->HwAddressSize
- );
-
- break;
- }
- //
- // Done if ARP packet was not for us.
- //
- DstHwAddr = SrcPrAddr + Private->IpLength;
- DstPrAddr = DstHwAddr + SnpMode->HwAddressSize;
-
- if (CompareMem (DstPrAddr, &PxeBcMode->StationIp, Private->IpLength)) {
- return ;
- //
- // not for us
- //
- }
- //
- // for us - if we did not update entry, add it
- //
- if (Index == PxeBcMode->ArpCacheEntries) {
- //
- // if we have a full table, get rid of oldest
- //
- if (Index == PXE_ARP_CACHE_SIZE) {
- Index = Private->OldestArpEntry;
-
- if (++Private->OldestArpEntry == PXE_ARP_CACHE_SIZE) {
- Private->OldestArpEntry = 0;
- }
- } else {
- ++PxeBcMode->ArpCacheEntries;
- }
-
- CopyMem (
- &PxeBcMode->ArpCache[Index].MacAddr,
- SrcHwAddr,
- SnpMode->HwAddressSize
- );
-
- CopyMem (
- &PxeBcMode->ArpCache[Index].IpAddr,
- SrcPrAddr,
- Private->IpLength
- );
- }
- //
- // if this is not a request or we don't yet have an IP, finished
- //
- if (ArpPacketPtr->ArpHeader.OpCode != HTONS (ARP_REQUEST) || !Private->GoodStationIp) {
- return ;
- }
- //
- // Assemble ARP reply.
- //
- //
- // Create media header. [ dest mac | src mac | prot ]
- //
- CopyMem (
- &ArpReplyPacket.MediaHeader[0],
- SrcHwAddr,
- SnpMode->HwAddressSize
- );
-
- CopyMem (
- &ArpReplyPacket.MediaHeader[SnpMode->HwAddressSize],
- &SnpMode->CurrentAddress,
- SnpMode->HwAddressSize
- );
-
- CopyMem (
- &ArpReplyPacket.MediaHeader[2 * SnpMode->HwAddressSize],
- &((UINT8 *) MediaHeader)[2 * SnpMode->HwAddressSize],
- sizeof (UINT16)
- );
-
- //
- // ARP reply header is almost filled in,
- // just insert the correct opcode.
- //
- ArpReplyPacket.ArpHeader.OpCode = HTONS (ARP_REPLY);
-
- //
- // Now fill in ARP data. [ src mac | src prot | dest mac | dest prot ]
- //
- TmpPtr = ArpReplyPacket.ArpData;
- CopyMem (TmpPtr, &SnpMode->CurrentAddress, SnpMode->HwAddressSize);
-
- TmpPtr += SnpMode->HwAddressSize;
- CopyMem (TmpPtr, &PxeBcMode->StationIp, Private->IpLength);
-
- TmpPtr += Private->IpLength;
- CopyMem (TmpPtr, SrcHwAddr, SnpMode->HwAddressSize);
-
- TmpPtr += SnpMode->HwAddressSize;
- CopyMem (TmpPtr, SrcPrAddr, Private->IpLength);
-
- //
- // Now send out the ARP reply.
- //
- CopyMem (&TmpMacAddr, SrcHwAddr, sizeof (EFI_MAC_ADDRESS));
-
- SendPacket (
- Private,
- &ArpReplyPacket.MediaHeader,
- &ArpReplyPacket.ArpHeader,
- sizeof (ARP_HEADER) + 2 * (Private->IpLength + SnpMode->HwAddressSize),
- &TmpMacAddr,
- PXE_PROTOCOL_ETHERNET_ARP,
- EFI_PXE_BASE_CODE_FUNCTION_ARP
- );
-
- //
- // Give time (100 microseconds) for ARP reply to get onto wire.
- //
- gBS->Stall (1000);
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-BOOLEAN
-GetHwAddr (
- IN PXE_BASECODE_DEVICE *Private,
- IN EFI_IP_ADDRESS *ProtocolAddrPtr,
- OUT EFI_MAC_ADDRESS *HardwareAddrPtr
- )
-/*++
-Routine description:
- Locate IP address in ARP cache and return MAC address.
-
-Parameters:
- Private := Pointer to PxeBc interface
- ProtocolAddrPtr := Pointer to IP address
- HardwareAddrPtr := Pointer to MAC address storage
-
-Returns:
- TRUE := If IP address was found and MAC address was stored
- FALSE := If IP address was not found
---*/
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- UINTN HardwareAddrLength;
- UINTN Index;
-
- PxeBcMode = Private->EfiBc.Mode;
- HardwareAddrLength = Private->SimpleNetwork->Mode->HwAddressSize;
-
- for (Index = 0; Index < PxeBcMode->ArpCacheEntries; ++Index) {
- if (!CompareMem (
- ProtocolAddrPtr,
- &PxeBcMode->ArpCache[Index].IpAddr,
- Private->IpLength
- )) {
- CopyMem (
- HardwareAddrPtr,
- &PxeBcMode->ArpCache[Index].MacAddr,
- HardwareAddrLength
- );
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-SendRequest (
- IN PXE_BASECODE_DEVICE *Private,
- IN EFI_IP_ADDRESS *ProtocolAddrPtr,
- IN EFI_MAC_ADDRESS *HardwareAddrPtr
- )
-/*++
-Routine description:
- Transmit ARP request packet
-
-Parameters:
- Private := Pointer to PxeBc interface
- ProtocolAddrPtr := Pointer IP address to find
- HardwareAddrPtr := Pointer to MAC address to find
-
-Returns:
- EFI_SUCCESS := ARP request sent
- other := ARP request could not be sent
---*/
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- EFI_SIMPLE_NETWORK_MODE *SnpMode;
- ARP_PACKET *ArpPacket;
- UINTN HardwareAddrLength;
- UINT8 *SrcProtocolAddrPtr;
- UINT8 *DestHardwareAddrptr;
- UINT8 *DestProtocolAddrPtr;
-
- //
- //
- //
- PxeBcMode = Private->EfiBc.Mode;
- SnpMode = Private->SimpleNetwork->Mode;
- HardwareAddrLength = SnpMode->HwAddressSize;
-
- //
- // Allocate ARP buffer
- //
- if (Private->ArpBuffer == NULL) {
- Private->ArpBuffer = AllocatePool (SnpMode->MediaHeaderSize + sizeof (ARP_PACKET));
- if (Private->ArpBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- }
-
- ArpPacket = (VOID *) (Private->ArpBuffer + SnpMode->MediaHeaderSize);
-
- //
- // for now, only handle one kind of hw and pr address
- //
- ArpPacket->ArpHeader = ArpHeader;
- ArpPacket->ArpHeader.HwAddLen = (UINT8) HardwareAddrLength;
- ArpPacket->ArpHeader.ProtAddLen = (UINT8) Private->IpLength;
-
- //
- // rest more generic
- //
- SrcProtocolAddrPtr = (UINT8 *) (&ArpPacket->SrcHardwareAddr) + HardwareAddrLength;
- DestHardwareAddrptr = SrcProtocolAddrPtr + Private->IpLength;
- DestProtocolAddrPtr = DestHardwareAddrptr + HardwareAddrLength;
-
- CopyMem (DestProtocolAddrPtr, ProtocolAddrPtr, Private->IpLength);
- CopyMem (DestHardwareAddrptr, HardwareAddrPtr, HardwareAddrLength);
- CopyMem (SrcProtocolAddrPtr, &PxeBcMode->StationIp, Private->IpLength);
- CopyMem (
- &ArpPacket->SrcHardwareAddr,
- &SnpMode->CurrentAddress,
- HardwareAddrLength
- );
-
- return SendPacket (
- Private,
- Private->ArpBuffer,
- ArpPacket,
- sizeof (ARP_HEADER) + ((Private->IpLength + HardwareAddrLength) << 1),
- &SnpMode->BroadcastAddress,
- PXE_PROTOCOL_ETHERNET_ARP,
- EFI_PXE_BASE_CODE_FUNCTION_ARP
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// check for address - if not there, send ARP request, wait and check again
-// not how it would be done in a full system
-//
-#define ARP_REQUEST_TIMEOUT_MS 500 // try for half a second
-
- ////////////////////////////////////////////////////////////
-//
-// BC Arp Routine
-//
-EFI_STATUS
-EFIAPI
-BcArp (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN EFI_IP_ADDRESS * ProtocolAddrPtr,
- OUT EFI_MAC_ADDRESS * HardwareAddrPtr OPTIONAL
- )
-/*++
-Routine description:
- PxeBc ARP API.
-
-Parameters:
- This := Pointer to PxeBc interface
- ProtocolAddrPtr := Pointer to IP address to find
- HardwareAddrPtr := Pointer to MAC address found.
-
-Returns:
---*/
-{
- EFI_MAC_ADDRESS Mac;
- EFI_STATUS StatCode;
- PXE_BASECODE_DEVICE *Private;
-
- //
- // Lock the instance data and make sure started
- //
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE poiner == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- if (This->Mode == NULL || !This->Mode->Started) {
- DEBUG ((EFI_D_ERROR, "BC was not started."));
- EfiReleaseLock (&Private->Lock);
- return EFI_NOT_STARTED;
- }
-
- DEBUG ((EFI_D_INFO, "\nBcArp()"));
-
- //
- // Issue BC command
- //
- if (ProtocolAddrPtr == NULL) {
- DEBUG (
- (EFI_D_INFO,
- "\nBcArp() Exit #1 %Xh (%r)",
- EFI_INVALID_PARAMETER,
- EFI_INVALID_PARAMETER)
- );
-
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
-
- if (HardwareAddrPtr == NULL) {
- HardwareAddrPtr = &Mac;
- }
-
- ZeroMem (HardwareAddrPtr, Private->SimpleNetwork->Mode->HwAddressSize);
-
- if (GetHwAddr (Private, ProtocolAddrPtr, HardwareAddrPtr)) {
- DEBUG (
- (EFI_D_INFO,
- "\nBcArp() Exit #2 %Xh (%r)",
- EFI_SUCCESS,
- EFI_SUCCESS)
- );
-
- EfiReleaseLock (&Private->Lock);
- return EFI_SUCCESS;
- }
-
- StatCode = DoArp (Private, ProtocolAddrPtr, HardwareAddrPtr);
-
- DEBUG ((EFI_D_INFO, "\nBcArp() Exit #3 %Xh (%r)", StatCode, StatCode));
-
- EfiReleaseLock (&Private->Lock);
- return StatCode;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-DoArp (
- IN PXE_BASECODE_DEVICE *Private,
- IN EFI_IP_ADDRESS *ProtocolAddrPtr,
- OUT EFI_MAC_ADDRESS *HardwareAddrPtr
- )
-/*++
-Routine description:
- Internal ARP implementation.
-
-Parameters:
- Private := Pointer to PxeBc interface
- ProtocolAddrPtr := Pointer to IP address to find
- HardwareAddrPtr := Pointer to MAC address found
-
-Returns:
- EFI_SUCCESS := MAC address found
- other := MAC address could not be found
---*/
-{
- EFI_STATUS StatCode;
- EFI_EVENT TimeoutEvent;
- UINTN HeaderSize;
- UINTN BufferSize;
- UINT16 Protocol;
-
- DEBUG ((EFI_D_INFO, "\nDoArp()"));
-
- //
- //
- //
- StatCode = SendRequest (Private, ProtocolAddrPtr, HardwareAddrPtr);
-
- if (EFI_ERROR (StatCode)) {
- DEBUG ((EFI_D_INFO, "\nDoArp() Exit #1 %Xh (%r)", StatCode, StatCode));
- return StatCode;
- }
- //
- //
- //
- StatCode = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &TimeoutEvent
- );
-
- if (EFI_ERROR (StatCode)) {
- return StatCode;
- }
-
- StatCode = gBS->SetTimer (
- TimeoutEvent,
- TimerRelative,
- ARP_REQUEST_TIMEOUT_MS * 10000
- );
-
- if (EFI_ERROR (StatCode)) {
- gBS->CloseEvent (TimeoutEvent);
- return StatCode;
- }
- //
- //
- //
- for (;;) {
- StatCode = WaitForReceive (
- Private,
- EFI_PXE_BASE_CODE_FUNCTION_ARP,
- TimeoutEvent,
- &HeaderSize,
- &BufferSize,
- &Protocol
- );
-
- if (EFI_ERROR (StatCode)) {
- break;
- }
-
- if (Protocol != PXE_PROTOCOL_ETHERNET_ARP) {
- continue;
- }
-
- HandleArpReceive (
- Private,
- (ARP_PACKET *) (Private->ReceiveBufferPtr + HeaderSize),
- Private->ReceiveBufferPtr
- );
-
- if (GetHwAddr (Private, ProtocolAddrPtr, HardwareAddrPtr)) {
- break;
- }
- }
-
- DEBUG (
- (EFI_D_INFO,
- "\nDoArp() Exit #2 %Xh, (%r)",
- StatCode,
- StatCode)
- );
-
- gBS->CloseEvent (TimeoutEvent);
-
- return StatCode;
-}
-
-/* eof - pxe_bc_arp.c */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_dhcp.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_dhcp.c
deleted file mode 100644
index b557f4c..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_dhcp.c
+++ /dev/null
@@ -1,3308 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- pxe_bc_dhcp.c
-
-Abstract:
- DHCP and PXE discovery protocol implementations.
-
---*/
-
-
-#include "Bc.h"
-
-STATIC EFI_PXE_BASE_CODE_UDP_PORT DhcpServerPort = DHCP_SERVER_PORT;
-STATIC EFI_PXE_BASE_CODE_UDP_PORT DHCPClientPort = DHCP_CLIENT_PORT;
-STATIC EFI_PXE_BASE_CODE_UDP_PORT PseudoDhcpServerPort = PXE_DISCOVERY_PORT;
-#define PSEUDO_DHCP_CLIENT_PORT PseudoDhcpServerPort
-STATIC EFI_IP_ADDRESS BroadcastIP = { { 0xffffffff } };
-STATIC EFI_IP_ADDRESS DefaultSubnetMask = { { 0xffffff00 } };
-
-typedef union {
- DHCPV4_OP_STRUCT *OpPtr;
- PXE_OP_SERVER_LIST *BootServersStr;
- PXE_SERVER_LIST *BootServerList;
- PXE_BOOT_MENU_ENTRY *BootMenuItem;
- PXE_OP_DISCOVERY_CONTROL *DiscoveryControl;
- PXE_OP_BOOT_MENU *BootMenu;
- PXE_OP_BOOT_ITEM *BootItem;
- DHCPV4_OP_VENDOR_OPTIONS *VendorOptions;
- DHCPV4_OP_OVERLOAD *Overload;
- DHCPV4_OP_CLASS *PxeClassStr;
- DHCPV4_OP_SUBNET_MASK *SubnetMaskStr;
- DHCPV4_OP_MESSAGE_TYPE *MessageType;
- UINT8 *BytePtr;
-} UNION_PTR;
-
-#pragma pack(1)
-//
-// option structure for DHCPREQUEST at end of DISCOVER options
-// and for DHCPDECLINE
-//
-STATIC const struct requestopendstr {
- DHCPV4_OP_REQUESTED_IP OpReqIP;
- DHCPV4_OP_SERVER_IP DhcServerIpPtr;
- UINT8 End[1];
-}
-RequestOpEndStr = {
- {
- {
- OP_DHCP_REQ_IP_ADD,
- DHCPV4_OPTION_LENGTH(DHCPV4_OP_REQUESTED_IP)
- }
- },
- {
- {
- OP_DHCP_SERVER_IP,
- DHCPV4_OPTION_LENGTH(DHCPV4_OP_SERVER_IP)
- }
- },
- {
- OP_END
- }
-};
-
-#define DHCP_REQ_OPTIONS (*(struct requestopendstr *) DHCPV4_OPTIONS_BUFFER.End)
-
-PXE_OP_BOOT_ITEM DefaultBootItem = {
- {
- VEND_PXE_BOOT_ITEM,
- DHCPV4_OPTION_LENGTH(PXE_OP_BOOT_ITEM)
- },
- 0, 0,
-};
-
-//
-// PXE discovery control default structure
-//
-STATIC PXE_OP_DISCOVERY_CONTROL DefaultDisCtl = {
- { VEND_PXE_DISCOVERY_CONTROL, DHCPV4_OPTION_LENGTH(PXE_OP_DISCOVERY_CONTROL) },
- 0
-};
-
-//
-// PXE credentials option structure
-//
-typedef struct {
- UINT8 c[4];
-} PXE_CREDENTIAL;
-
-typedef struct {
- DHCPV4_OP_HEADER Header;
- PXE_CREDENTIAL Credentials[1];
-} PXE_OP_CREDENTIAL_TYPES;
-
-//
-// option structure for PXE discover (without credentials)
-//
-typedef struct { // discoveropendstr {
- DHCPV4_OP_HEADER Header; // vendor options
- PXE_OP_BOOT_ITEM BootItem;
- UINT8 End[1]; // if credentials option, it starts here
-} PXE_DISCOVER_OPTIONS;
-
-#define DISCOVERoptions (*(PXE_DISCOVER_OPTIONS *) DHCPV4_OPTIONS_BUFFER.End)
-#define DISCREDoptions (*(PXE_OP_CREDENTIAL_TYPES *) DISCOVERoptions.End)
-
-//
-// common option beginning for all our DHCP messages except
-// DHCPDECLINE and DHCPRELEASE
-//
-STATIC struct optionsstr {
- UINT8 DhcpCookie[4];
- DHCPV4_OP_MESSAGE_TYPE DhcpMessageType;
- DHCPV4_OP_MAX_MESSAGE_SIZE DhcpMaxMessageSize;
- DHCPV4_OP_REQUESTED_OPTIONS DhcpRequestedOptions;
- DHCPV4_OP_PLATFORM_ID DhcpPlatformId;
- DHCPV4_OP_NETWORK_INTERFACE DhcpNetworkInterface;
- DHCPV4_OP_ARCHITECTURE_TYPE DhcpClientArchitecture;
- DHCPV4_OP_CLASS_ID DhcpClassIdentifier;
- UINT8 End[1];
-} DHCPOpStart;
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-OptionsStrucInit (
- VOID
- )
-{
- DHCPOpStart.DhcpCookie[0] = 99;
- DHCPOpStart.DhcpCookie[1] = 130;
- DHCPOpStart.DhcpCookie[2] = 83;
- DHCPOpStart.DhcpCookie[3] = 99;
- DHCPOpStart.DhcpMessageType.Header.OpCode = OP_DHCP_MESSAGE_TYPE;
- DHCPOpStart.DhcpMessageType.Header.Length = 1;
- DHCPOpStart.DhcpMessageType.Type = DHCPDISCOVER;
- DHCPOpStart.DhcpMaxMessageSize.Header.OpCode = OP_DHCP_MAX_MESSAGE_SZ;
- DHCPOpStart.DhcpMaxMessageSize.Header.Length = 2;
- DHCPOpStart.DhcpMaxMessageSize.MaxSize[0] = MAX_DHCP_MSG_SZ >> 8;
- DHCPOpStart.DhcpMaxMessageSize.MaxSize[1] = MAX_DHCP_MSG_SZ & 0xff;
- DHCPOpStart.DhcpRequestedOptions.Header.OpCode = OP_DHCP_PARM_REQ_LIST;
- DHCPOpStart.DhcpRequestedOptions.Header.Length = sizeof (DHCPV4_REQUESTED_OPTIONS_DATA);
- DHCPOpStart.DhcpRequestedOptions.Data._OP_SUBNET_MASK = OP_SUBNET_MASK; /* 1 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_TIME_OFFSET = OP_TIME_OFFSET; /* 2 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_ROUTER_LIST = OP_ROUTER_LIST; /* 3 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_TIME_SERVERS = OP_TIME_SERVERS; /* 4 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_NAME_SERVERS = OP_NAME_SERVERS; /* 5 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DNS_SERVERS = OP_DNS_SERVERS; /* 6 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_HOST_NAME = OP_HOST_NAME; /* 12 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_BOOT_FILE_SZ = OP_BOOT_FILE_SZ; /* 13 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DOMAIN_NAME = OP_DOMAIN_NAME; /* 15 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_ROOT_PATH = OP_ROOT_PATH; /* 17 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_EXTENSION_PATH = OP_EXTENSION_PATH; /* 18 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_MAX_DATAGRAM_SZ = OP_MAX_DATAGRAM_SZ; /* 22 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DEFAULT_TTL = OP_DEFAULT_TTL; /* 23 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_BROADCAST_ADD = OP_BROADCAST_ADD; /* 28 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_NIS_DOMAIN_NAME = OP_NIS_DOMAIN_NAME; /* 40 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_NIS_SERVERS = OP_NIS_SERVERS; /* 41 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_NTP_SERVERS = OP_NTP_SERVERS; /* 42 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_VENDOR_SPECIFIC = OP_VENDOR_SPECIFIC; /* 43 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DHCP_REQ_IP_ADD = OP_DHCP_REQ_IP_ADD; /* 50 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DHCP_LEASE_TIME = OP_DHCP_LEASE_TIME; /* 51 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DHCP_SERVER_IP = OP_DHCP_SERVER_IP; /* 54 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DHCP_RENEWAL_TIME = OP_DHCP_RENEWAL_TIME; /* 58 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DHCP_REBINDING_TIME = OP_DHCP_REBINDING_TIME; /* 59 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DHCP_CLASS_IDENTIFIER = OP_DHCP_CLASS_IDENTIFIER; /* 60 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DHCP_TFTP_SERVER_NAME = OP_DHCP_TFTP_SERVER_NAME; /* 66 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DHCP_BOOTFILE = OP_DHCP_BOOTFILE; /* 67 */
- DHCPOpStart.DhcpRequestedOptions.Data._OP_DHCP_PLATFORM_ID = OP_DHCP_PLATFORM_ID; /* 97 */
- DHCPOpStart.DhcpRequestedOptions.Data.VendorOption128 = 128;
- DHCPOpStart.DhcpRequestedOptions.Data.VendorOption129 = 129;
- DHCPOpStart.DhcpRequestedOptions.Data.VendorOption130 = 130;
- DHCPOpStart.DhcpRequestedOptions.Data.VendorOption131 = 131;
- DHCPOpStart.DhcpRequestedOptions.Data.VendorOption132 = 132;
- DHCPOpStart.DhcpRequestedOptions.Data.VendorOption133 = 133, DHCPOpStart.DhcpRequestedOptions.Data.VendorOption134 = 134;
- DHCPOpStart.DhcpRequestedOptions.Data.VendorOption135 = 135;
- DHCPOpStart.DhcpPlatformId.Header.OpCode = OP_DHCP_PLATFORM_ID;
- DHCPOpStart.DhcpPlatformId.Header.Length = DHCPV4_OPTION_LENGTH (DHCPV4_OP_PLATFORM_ID);
- DHCPOpStart.DhcpNetworkInterface.Header.OpCode = OP_DHCP_NETWORK_ARCH;
- DHCPOpStart.DhcpNetworkInterface.Header.Length = DHCPV4_OPTION_LENGTH (DHCPV4_OP_NETWORK_INTERFACE);
- DHCPOpStart.DhcpNetworkInterface.Type = 0;
- DHCPOpStart.DhcpNetworkInterface.MajorVersion = 0;
- DHCPOpStart.DhcpNetworkInterface.MinorVersion = 0;
- DHCPOpStart.DhcpClientArchitecture.Header.OpCode = OP_DHCP_SYSTEM_ARCH;
- DHCPOpStart.DhcpClientArchitecture.Header.Length = DHCPV4_OPTION_LENGTH (DHCPV4_OP_ARCHITECTURE_TYPE);
- DHCPOpStart.DhcpClientArchitecture.Type = HTONS (SYS_ARCH);
- DHCPOpStart.DhcpClassIdentifier.Header.OpCode = OP_DHCP_CLASS_IDENTIFIER;
- DHCPOpStart.DhcpClassIdentifier.Header.Length = sizeof (DHCPV4_CLASS_ID_DATA);
- CopyMem (
- DHCPOpStart.DhcpClassIdentifier.Data.ClassIdentifier,
- "PXEClient:",
- sizeof ("PXEClient:")
- );
- CopyMem (DHCPOpStart.DhcpClassIdentifier.Data.Lit2, "Arch:", sizeof ("Arch:"));
- CopyMem (
- DHCPOpStart.DhcpClassIdentifier.Data.ArchitectureType,
- "xxxxx",
- sizeof ("xxxxx")
- );
- CopyMem (DHCPOpStart.DhcpClassIdentifier.Data.Lit3, ":", sizeof (":"));
- CopyMem (DHCPOpStart.DhcpClassIdentifier.Data.InterfaceName, "XXXX", sizeof ("XXXX"));
- CopyMem (DHCPOpStart.DhcpClassIdentifier.Data.Lit4, ":", sizeof (":"));
- CopyMem (DHCPOpStart.DhcpClassIdentifier.Data.UndiMajor, "yyy", sizeof ("yyy"));
- CopyMem (DHCPOpStart.DhcpClassIdentifier.Data.UndiMinor, "xxx", sizeof ("xxx"));
- DHCPOpStart.End[0] = OP_END;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// DHCPDECLINE option structure
-//
-struct opdeclinestr {
- UINT8 DhcpCookie[4];
- DHCPV4_OP_MESSAGE_TYPE DhcpMessageType;
- struct requestopendstr OpDeclineEnd;
-};
-
-#define DHCPDECLINEoptions (*(struct opdeclinestr *) DHCPV4_TRANSMIT_BUFFER.options)
-
-//
-// DHCPRELEASE option structure
-//
-struct opreleasestr {
- UINT8 DhcpCookie[4];
- DHCPV4_OP_MESSAGE_TYPE DhcpMessageType;
- DHCPV4_OP_SERVER_IP DhcServerIpPtr;
- UINT8 End[1];
-};
-
-#define DHCPRELEASEoptions (*(struct opreleasestr *) DHCPV4_TRANSMIT_BUFFER.options)
-
-//
-// array of PXE vendor options in which we are interested
-// value 0 -> not of interest, else value is index into PXE OPTION array
-// option values from 1 to MAX_OUR_PXE_OPT
-//
-STATIC UINT8 ourPXEopts[MAX_OUR_PXE_OPT] = {
- VEND_PXE_MTFTP_IP_IX, // multicast IP address of bootfile for MTFTP listen
- VEND_PXE_MTFTP_CPORT_IX, // UDP Port to monitor for MTFTP responses - Intel order
- VEND_PXE_MTFTP_SPORT_IX, // Server UDP Port for MTFTP open - Intel order
- VEND_PXE_MTFTP_TMOUT_IX, // Listen timeout - secs
- VEND_PXE_MTFTP_DELAY_IX, // Transmission timeout - secs
- VEND_PXE_DISCOVERY_CONTROL_IX, // bit field
- VEND_PXE_DISCOVERY_MCAST_ADDR_IX, // boot server discovery multicast address
- VEND_PXE_BOOT_SERVERS_IX, // list of boot servers of form tp(2) cnt(1) ips[cnt]
- VEND_PXE_BOOT_MENU_IX,
- VEND_PXE_BOOT_PROMPT_IX,
- VEND_PXE_MCAST_ADDRS_ALLOC_IX, // not used by client
- VEND_PXE_CREDENTIAL_TYPES_IX,
- VEND_13_IX, // not used by client
- VEND_14_IX, // not used by client
- VEND_15_IX, // not used by client
- VEND_16_IX, // not used by client
- VEND_17_IX, // not used by client
- VEND_18_IX, // not used by client
- VEND_19_IX, // not used by client
- VEND_20_IX, // not used by client
- VEND_21_IX, // not used by client
- VEND_22_IX, // not used by client
- VEND_23_IX, // not used by client
- VEND_24_IX, // not used by client
- VEND_25_IX, // not used by client
- VEND_26_IX, // not used by client
- VEND_27_IX, // not used by client
- VEND_28_IX, // not used by client
- VEND_29_IX, // not used by client
- VEND_30_IX, // not used by client
- VEND_31_IX, // not used by client
- VEND_32_IX, // not used by client
- VEND_33_IX, // not used by client
- VEND_34_IX, // not used by client
- VEND_35_IX, // not used by client
- VEND_36_IX, // not used by client
- VEND_37_IX, // not used by client
- VEND_38_IX, // not used by client
- VEND_39_IX, // not used by client
- VEND_40_IX, // not used by client
- VEND_41_IX, // not used by client
- VEND_42_IX, // not used by client
- VEND_43_IX, // not used by client
- VEND_44_IX, // not used by client
- VEND_45_IX, // not used by client
- VEND_46_IX, // not used by client
- VEND_47_IX, // not used by client
- VEND_48_IX, // not used by client
- VEND_49_IX, // not used by client
- VEND_50_IX, // not used by client
- VEND_51_IX, // not used by client
- VEND_52_IX, // not used by client
- VEND_53_IX, // not used by client
- VEND_54_IX, // not used by client
- VEND_55_IX, // not used by client
- VEND_56_IX, // not used by client
- VEND_57_IX, // not used by client
- VEND_58_IX, // not used by client
- VEND_59_IX, // not used by client
- VEND_60_IX, // not used by client
- VEND_61_IX, // not used by client
- VEND_62_IX, // not used by client
- VEND_63_IX, // not used by client
- VEND_64_IX, // not used by client
- VEND_65_IX, // not used by client
- VEND_66_IX, // not used by client
- VEND_67_IX, // not used by client
- VEND_68_IX, // not used by client
- VEND_69_IX, // not used by client
- VEND_70_IX, // not used by client
- VEND_PXE_BOOT_ITEM_IX
-};
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// array of options in which we are interested
-// value 0 -> not of interest, else value is index into OPTION array
-// option values from 1 to MAX_OUR_OPT
-//
-STATIC UINT8 OurDhcpOptions[MAX_OUR_OPT] = {
- OP_SUBNET_MASK_IX, // OP_SUBNET_MASK 1 // data is the subnet mask
- OP_TIME_OFFSET_IX, // OP_TIME_OFFSET 2 // data is the time offset of subnet to UTC in seconds
- OP_ROUTER_LIST_IX, // OP_ROUTER_LIST 3 // list of routers on subnet
- OP_TIME_SERVERS_IX, // OP_TIME_SERVERS 4 // list of time servers available
- OP_NAME_SERVERS_IX, // OP_NAME_SERVERS 5 // list of name servers available
- OP_DNS_SERVERS_IX, // OP_DNS_SERVERS 6 // list of DNS servers available
- OP_LOG_SERVERS_IX, // OP_LOG_SERVERS 7
- OP_COOKIE_SERVERS_IX, // OP_COOKIE_SERVERS 8
- OP_LPR_SREVERS_IX, // OP_LPR_SREVERS 9
- OP_IMPRESS_SERVERS_IX, // OP_IMPRESS_SERVERS 10
- OP_RES_LOC_SERVERS_IX, // OP_RES_LOC_SERVERS 11
- OP_HOST_NAME_IX, // OP_HOST_NAME 12 // client name
- OP_BOOT_FILE_SZ_IX, // OP_BOOT_FILE_SZ 13 // number of 512 blocks of boot file
- OP_DUMP_FILE_IX, // OP_DUMP_FILE 14 // path name of dump file if client crashes
- OP_DOMAIN_NAME_IX, // OP_DOMAIN_NAME 15 // domain name to use
- OP_SWAP_SERVER_IX, // OP_SWAP_SERVER 16
- OP_ROOT_PATH_IX, // OP_ROOT_PATH 17 // path name containing root disk
- OP_EXTENSION_PATH_IX, // OP_EXTENSION_PATH 18 // name of TFTP downloadable file of form of OP
- OP_IP_FORWARDING_IX, // OP_IP_FORWARDING 19 // enable/disable IP packet forwarding
- OP_NON_LOCAL_SRC_RTE_IX, // OP_NON_LOCAL_SRC_RTE 20 // enable/disable non local source routing
- OP_POLICY_FILTER_IX, // OP_POLICY_FILTER 21 // policy filters for non local source routing
- OP_MAX_DATAGRAM_SZ_IX, // OP_MAX_DATAGRAM_SZ 22 // maximum datagram reassembly size
- OP_DEFAULT_TTL_IX, // OP_DEFAULT_TTL 23 // default IP time to live
- OP_MTU_AGING_TIMEOUT_IX, // OP_MTU_AGING_TIMEOUT 24
- OP_MTU_SIZES_IX, // OP_MTU_SIZES 25
- OP_MTU_TO_USE_IX, // OP_MTU_TO_USE 26
- OP_ALL_SUBNETS_LOCAL_IX, // OP_ALL_SUBNETS_LOCAL 27
- OP_BROADCAST_ADD_IX, // OP_BROADCAST_ADD 28 // broadcast address used on subnet
- OP_PERFORM_MASK_DISCOVERY_IX, // OP_PERFORM_MASK_DISCOVERY 29 // perform mask discovery using ICMP
- OP_RESPOND_TO_MASK_REQ_IX, // OP_RESPOND_TO_MASK_REQ 30 // respond to subnet mask requests using ICMP
- OP_PERFORM_ROUTER_DISCOVERY_IX, // OP_PERFORM_ROUTER_DISCOVERY 31
- OP_ROUTER_SOLICIT_ADDRESS_IX, // OP_ROUTER_SOLICIT_ADDRESS 32
- OP_STATIC_ROUTER_LIST_IX, // OP_STATIC_ROUTER_LIST 33 // list of dest/route pairs
- OP_USE_ARP_TRAILERS_IX, // OP_USE_ARP_TRAILERS 34
- OP_ARP_CACHE_TIMEOUT_IX, // OP_ARP_CACHE_TIMEOUT 35
- OP_ETHERNET_ENCAPSULATION_IX, // OP_ETHERNET_ENCAPSULATION 36 // 0 -> RFC 894, 1 -> IEEE 802.3 (RFC 1042)
- OP_TCP_DEFAULT_TTL_IX, // OP_TCP_DEFAULT_TTL 37 // default time to live when sending TCP segments
- OP_TCP_KEEP_ALIVE_INT_IX, // OP_TCP_KEEP_ALIVE_INT 38 // keep alive interval in seconds
- OP_KEEP_ALIVE_GARBAGE_IX, // OP_KEEP_ALIVE_GARBAGE 39
- OP_NIS_DOMAIN_NAME_IX, // OP_NIS_DOMAIN_NAME 40
- OP_NIS_SERVERS_IX, // OP_NIS_SERVERS 41
- OP_NTP_SERVERS_IX, // OP_NTP_SERVERS 42
- OP_VENDOR_SPECIFIC_IX, // OP_VENDOR_SPECIFIC 43
- OP_NBNS_SERVERS_IX, // OP_NBNS_SERVERS 44
- OP_NBDD_SERVERS_IX, // OP_NBDD_SERVERS 45
- OP_NETBIOS_NODE_TYPE_IX, // OP_NETBIOS_NODE_TYPE 46
- OP_NETBIOS_SCOPE_IX, // OP_NETBIOS_SCOPE 47
- OP_XWINDOW_SYSTEM_FONT_SERVERS_IX, // OP_XWINDOW_SYSTEM_FONT_SERVERS 48
- OP_XWINDOW_SYSTEM_DISPLAY_MANAGERS_IX, // OP_XWINDOW_SYSTEM_DISPLAY_MANAGERS 49
- OP_DHCP_REQ_IP_ADD_IX, // OP_DHCP_REQ_IP_ADD 50 // requested IP address - in DHCPDISCOVER
- OP_DHCP_LEASE_TIME_IX, // OP_DHCP_LEASE_TIME 51 // lease time requested/granted
- OP_DHCP_OPTION_OVERLOAD_IX, // OP_DHCP_OPTION_OVERLOAD 52 // file/server name/both used to hold options
- OP_DHCP_MESSAGE_TYPE_IX, // OP_DHCP_MESSAGE_TYPE 53 // message type
- OP_DHCP_SERVER_IP_IX, // OP_DHCP_SERVER_IP 54 // IP of server
- OP_DHCP_PARM_REQ_LIST_IX, // OP_DHCP_PARM_REQ_LIST 55 // list of requested parameters
- OP_DHCP_ERROR_MESSAGE_IX, // OP_DHCP_ERROR_MESSAGE 56 // in DHCPNAK or DECLINE messages
- OP_DHCP_MAX_MESSAGE_SZ_IX, // OP_DHCP_MAX_MESSAGE_SZ 57 // maximum DHCP message size client will accept
- OP_DHCP_RENEWAL_TIME_IX, // OP_DHCP_RENEWAL_TIME 58 // time in seconds before transitioning to RENEWING state
- OP_DHCP_REBINDING_TIME_IX, // OP_DHCP_REBINDING_TIME 59 // time in seconds before transitioning to REBINDING state
- OP_DHCP_CLASS_IDENTIFIER_IX, // OP_DHCP_CLASS_IDENTIFIER 60
- OP_DHCP_CLIENT_IDENTIFIER_IX, // OP_DHCP_CLIENT_IDENTIFIER 61
- OP_RESERVED62_IX, // OP_RESERVED62
- OP_RESERVED63_IX, // OP_RESERVED63
- OP_NISPLUS_DOMAIN_NAME_IX, // OP_NISPLUS_DOMAIN_NAME 64
- OP_NISPLUS_SERVERS_IX, // OP_NISPLUS_SERVERS 65
- OP_DHCP_TFTP_SERVER_NAME_IX, // OP_DHCP_TFTP_SERVER_NAME 66
- OP_DHCP_BOOTFILE_IX // OP_DHCP_BOOTFILE 67
-};
-
-#define RxBuf ((DHCP_RECEIVE_BUFFER *) (Private->ReceiveBuffers))
-
-#pragma pack()
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-CHAR8 *
-PxeBcLibGetSmbiosString (
- IN SMBIOS_STRUCTURE_POINTER *Smbios,
- IN UINT16 StringNumber
- )
-/*++
-Routine description:
- Return SMBIOS string given the string number.
-
-Arguments:
- Smbios - Pointer to SMBIOS structure
- StringNumber - String number to return. 0 is used to skip all strings and
- point to the next SMBIOS structure.
-
-Returns:
- Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == 0
---*/
-{
- UINT16 Index;
- CHAR8 *String;
-
- //
- // Skip over formatted section
- //
- String = (CHAR8 *) (Smbios->Raw + Smbios->Hdr->Length);
-
- //
- // Look through unformated section
- //
- for (Index = 1; Index <= StringNumber || StringNumber == 0; Index++) {
- if (StringNumber == Index) {
- return String;
- }
- //
- // Skip string
- //
- for (; *String != 0; String++)
- ;
- String++;
-
- if (*String == 0) {
- //
- // If double NULL then we are done.
- // Return pointer to next structure in Smbios.
- // if you pass in a 0 you will always get here
- //
- Smbios->Raw = (UINT8 *)++String;
- return NULL;
- }
- }
-
- return NULL;
-}
-
-EFI_STATUS
-PxeBcLibGetSmbiosSystemGuidAndSerialNumber (
- IN EFI_GUID *SystemGuid,
- OUT CHAR8 **SystemSerialNumber
- )
-/*++
-
-Routine Description:
- This function gets system guid and serial number from the smbios table
-
-Arguments:
- SystemGuid - The pointer of returned system guid
- SystemSerialNumber - The pointer of returned system serial number
-
-Returns:
- EFI_SUCCESS - Successfully get the system guid and system serial number
- EFI_NOT_FOUND - Not find the SMBIOS table
---*/
-{
- EFI_STATUS Status;
- SMBIOS_STRUCTURE_TABLE *SmbiosTable;
- SMBIOS_STRUCTURE_POINTER Smbios;
- SMBIOS_STRUCTURE_POINTER SmbiosEnd;
- UINT16 Index;
-
- Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &SmbiosTable);
-
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- Smbios.Hdr = (SMBIOS_HEADER *) (UINTN) SmbiosTable->TableAddress;
- SmbiosEnd.Raw = (UINT8 *) (UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength);
-
- for (Index = 0; Index < SmbiosTable->TableLength; Index++) {
- if (Smbios.Hdr->Type == 1) {
- if (Smbios.Hdr->Length < 0x19) {
- //
- // Older version did not support Guid and Serial number
- //
- continue;
- }
- //
- // SMBIOS tables are byte packed so we need to do a byte copy to
- // prevend alignment faults on Itanium-based platform.
- //
- CopyMem (SystemGuid, &Smbios.Type1->Uuid, sizeof (EFI_GUID));
- *SystemSerialNumber = PxeBcLibGetSmbiosString (&Smbios, Smbios.Type1->SerialNumber);
-
- return EFI_SUCCESS;
- }
- //
- // Make Smbios point to the next record
- //
- PxeBcLibGetSmbiosString (&Smbios, 0);
-
- if (Smbios.Raw >= SmbiosEnd.Raw) {
- //
- // SMBIOS 2.1 incorrectly stated the length of SmbiosTable as 0x1e.
- // given this we must double check against the lenght of
- // the structure.
- //
- return EFI_SUCCESS;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// add router list to list
-//
-STATIC
-VOID
-Ip4AddRouterList (
- PXE_BASECODE_DEVICE *Private,
- DHCPV4_OP_IP_LIST *IpListPtr
- )
-{
- EFI_IP_ADDRESS TmpIp;
- INTN Index;
- INTN num;
-
- if (IpListPtr == NULL) {
- return ;
- }
-
- for (Index = 0, num = IpListPtr->Header.Length >> 2; Index < num; ++Index) {
- CopyMem (&TmpIp, &IpListPtr->IpList[Index], 4);
- Ip4AddRouter (Private, &TmpIp);
- }
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// send ARP for our IP - fail if someone has it
-//
-STATIC
-BOOLEAN
-SetStationIP (
- PXE_BASECODE_DEVICE *Private
- )
-{
- EFI_MAC_ADDRESS DestMac;
- EFI_STATUS EfiStatus;
-
- ZeroMem (&DestMac, sizeof DestMac);
-
- if (GetHwAddr(Private, (EFI_IP_ADDRESS *)&DHCP_REQ_OPTIONS.OpReqIP.Ip, (EFI_MAC_ADDRESS *)&DestMac)
- || DoArp(Private, (EFI_IP_ADDRESS *)&DHCP_REQ_OPTIONS.OpReqIP.Ip, (EFI_MAC_ADDRESS *)&DestMac) == EFI_SUCCESS) {
- return FALSE; // somebody else has this IP
- }
-
- CopyMem (
- (EFI_IPv4_ADDRESS *) &Private->EfiBc.Mode->StationIp,
- &DHCP_REQ_OPTIONS.OpReqIP.Ip,
- sizeof (EFI_IPv4_ADDRESS)
- );
-
- Private->GoodStationIp = TRUE;
-
- if (!Private->UseIgmpv1Reporting) {
- return TRUE;
- }
-
- if (Private->Igmpv1TimeoutEvent != NULL) {
- return TRUE;
- }
-
- EfiStatus = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &Private->Igmpv1TimeoutEvent
- );
-
- if (EFI_ERROR (EfiStatus)) {
- Private->Igmpv1TimeoutEvent = NULL;
- return TRUE;
- }
-
- EfiStatus = gBS->SetTimer (
- Private->Igmpv1TimeoutEvent,
- TimerRelative,
- (UINT64) V1ROUTER_PRESENT_TIMEOUT * 10000000
- ); /* 400 seconds */
-
- if (EFI_ERROR (EfiStatus)) {
- gBS->CloseEvent (Private->Igmpv1TimeoutEvent);
- Private->Igmpv1TimeoutEvent = NULL;
- }
-
- return TRUE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-AddRouters (
- PXE_BASECODE_DEVICE *Private,
- DHCP_RECEIVE_BUFFER *RxBufPtr
- )
-{
- Ip4AddRouterList (
- Private,
- (DHCPV4_OP_IP_LIST *) RxBufPtr->OpAdds.PktOptAdds[OP_ROUTER_LIST_IX - 1]
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-DoUdpWrite (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *ServerIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ServerPortPtr,
- EFI_IP_ADDRESS *ClientIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ClientPortPtr
- )
-{
- UINTN Len;
-
- Len = sizeof DHCPV4_TRANSMIT_BUFFER;
-
- return UdpWrite (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT,
- ServerIpPtr,
- ServerPortPtr,
- 0,
- ClientIpPtr,
- ClientPortPtr,
- 0,
- 0,
- &Len,
- Private->TransmitBuffer
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// initialize the DHCP structure
-//
-typedef struct {
- UINT8 x[4];
-} C4Str;
-
-STATIC
-VOID
-InitDhcpv4TxBuf (
- PXE_BASECODE_DEVICE *Private
- )
-{
- UINTN HwAddrLen;
- UINT8 *String;
- CHAR8 *SystemSerialNumber;
- EFI_PXE_BASE_CODE_MODE *PxebcMode;
-
- PxebcMode = Private->EfiBc.Mode;
-
- ZeroMem (&DHCPV4_TRANSMIT_BUFFER, sizeof (DHCPV4_STRUCT));
- DHCPV4_TRANSMIT_BUFFER.op = BOOTP_REQUEST;
- DHCPV4_TRANSMIT_BUFFER.htype = Private->SimpleNetwork->Mode->IfType;
- DHCPV4_TRANSMIT_BUFFER.flags = HTONS (DHCP_BROADCAST_FLAG);
- CopyMem (&DHCPV4_OPTIONS_BUFFER, (VOID *) &DHCPOpStart, sizeof (DHCPOpStart));
-
- //
- // default to hardware address
- //
- HwAddrLen = Private->SimpleNetwork->Mode->HwAddressSize;
-
- if (HwAddrLen > sizeof DHCPV4_TRANSMIT_BUFFER.chaddr) {
- HwAddrLen = sizeof DHCPV4_TRANSMIT_BUFFER.chaddr;
- }
-
- String = (UINT8 *) &Private->SimpleNetwork->Mode->CurrentAddress;
-
- if (PxeBcLibGetSmbiosSystemGuidAndSerialNumber (
- (EFI_GUID *) DHCPV4_OPTIONS_BUFFER.DhcpPlatformId.Guid,
- &SystemSerialNumber
- ) == EFI_SUCCESS) {
- if (PxebcMode->SendGUID) {
- HwAddrLen = sizeof (EFI_GUID);
- String = (UINT8 *) DHCPV4_OPTIONS_BUFFER.DhcpPlatformId.Guid;
- }
- } else {
- //
- // GUID not yet set - send all 0xff's to show programable (via SetVariable)
- // SetMem(DHCPV4_OPTIONS_BUFFER.DhcpPlatformId.Guid, sizeof(EFI_GUID), 0xff);
- // GUID not yet set - send all 0's to show not programable
- //
- ZeroMem (DHCPV4_OPTIONS_BUFFER.DhcpPlatformId.Guid, sizeof (EFI_GUID));
- }
-
- DHCPV4_TRANSMIT_BUFFER.hlen = (UINT8) HwAddrLen;
- CopyMem (DHCPV4_TRANSMIT_BUFFER.chaddr, String, HwAddrLen);
-
- CvtNum (
- SYS_ARCH,
- (UINT8 *) DHCPV4_OPTIONS_BUFFER.DhcpClassIdentifier.Data.ArchitectureType,
- sizeof DHCPV4_OPTIONS_BUFFER.DhcpClassIdentifier.Data.ArchitectureType
- );
-
- DHCPV4_OPTIONS_BUFFER.DhcpNetworkInterface.Type = Private->NiiPtr->Type;
- DHCPV4_OPTIONS_BUFFER.DhcpNetworkInterface.MajorVersion = Private->NiiPtr->MajorVer;
- DHCPV4_OPTIONS_BUFFER.DhcpNetworkInterface.MinorVersion = Private->NiiPtr->MinorVer;
-
- *(C4Str *) DHCPV4_OPTIONS_BUFFER.DhcpClassIdentifier.Data.InterfaceName = *(C4Str *) Private->NiiPtr->StringId;
-
- CvtNum (
- DHCPV4_OPTIONS_BUFFER.DhcpNetworkInterface.MajorVersion,
- (UINT8 *) DHCPV4_OPTIONS_BUFFER.DhcpClassIdentifier.Data.UndiMajor,
- sizeof DHCPV4_OPTIONS_BUFFER.DhcpClassIdentifier.Data.UndiMajor
- );
-
- CvtNum (
- DHCPV4_OPTIONS_BUFFER.DhcpNetworkInterface.MinorVersion,
- (UINT8 *) DHCPV4_OPTIONS_BUFFER.DhcpClassIdentifier.Data.UndiMinor,
- sizeof DHCPV4_OPTIONS_BUFFER.DhcpClassIdentifier.Data.UndiMinor
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-UINT32
-DecodePxeOptions (
- DHCP_RECEIVE_BUFFER *RxBufPtr,
- UINT8 *ptr,
- INTN Len
- )
-{
- UINT8 Op;
- UINT8 *EndPtr;
- INTN Index;
- UNION_PTR LocalPtr;
- UINT32 status;
-
- status = 0;
-
- for (EndPtr = ptr + Len; ptr < EndPtr; ptr += Len + 2) {
- Op = ptr[0];
- Len = ptr[1];
-
- switch (Op) {
- case OP_PAD:
- Len = -1;
- break;
-
- case OP_END:
- return status;
-
- default:
- LocalPtr.BytePtr = ptr;
- if (Op <= MAX_OUR_PXE_OPT) {
- Index = ourPXEopts[Op - 1];
- if (Index) {
- RxBufPtr->OpAdds.PxeOptAdds[Index - 1] = LocalPtr.OpPtr;
- status |= 1 << Index;
- if (Index == VEND_PXE_BOOT_ITEM && LocalPtr.BootItem->Header.Length == 3) {
- RxBufPtr->OpAdds.Status |= USE_THREE_BYTE;
- }
- }
- }
- break;
- }
- }
-
- return status;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-DecodeOptions (
- DHCP_RECEIVE_BUFFER *RxBufPtr,
- UINT8 *ptr,
- INTN Len
- )
-{
- UINT8 Op;
- UINT8 *EndPtr;
- INTN Index;
- UNION_PTR LocalPtr;
-
- for (EndPtr = ptr + Len; ptr < EndPtr; ptr += Len + 2) {
- Op = ptr[0];
- Len = ptr[1];
-
- switch (Op) {
- case OP_PAD:
- Len = -1;
- break;
-
- case OP_END:
- return ;
-
- default:
- LocalPtr.BytePtr = ptr;
- if (Op <= MAX_OUR_OPT) {
- Index = OurDhcpOptions[Op - 1];
- if (Index) {
- RxBufPtr->OpAdds.PktOptAdds[Index - 1] = LocalPtr.OpPtr;
- if (Index == OP_VENDOR_SPECIFIC_IX) {
- UINT32 status;
- status = DecodePxeOptions (
- RxBufPtr,
- (UINT8 *) LocalPtr.VendorOptions->VendorOptions,
- LocalPtr.VendorOptions->Header.Length
- );
- if (status) {
- RxBufPtr->OpAdds.Status |= PXE_TYPE;
- //
- // check for all the MTFTP info options present - any missing is a nogo
- //
- if ((status & WfM11a_OPTS) == WfM11a_OPTS) {
- RxBufPtr->OpAdds.Status |= WfM11a_TYPE;
- }
-
- if (status & DISCOVER_OPTS) {
- RxBufPtr->OpAdds.Status |= DISCOVER_TYPE;
- }
-
- if (status & CREDENTIALS_OPT) {
- RxBufPtr->OpAdds.Status |= CREDENTIALS_TYPE;
- }
- }
- }
- }
- }
- break;
- }
- }
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-Parse (
- DHCP_RECEIVE_BUFFER *RxBufPtr,
- INTN Len
- )
-{
- UNION_PTR LocalPtr;
-
- //
- // initialize
- //
- SetMem (&RxBufPtr->OpAdds, sizeof RxBufPtr->OpAdds, 0);
-
- DecodeOptions (
- RxBufPtr,
- RxBufPtr->u.Dhcpv4.options + 4,
- Len - (sizeof RxBufPtr->u.Dhcpv4 - sizeof RxBufPtr->u.Dhcpv4.options + 4)
- );
-
- LocalPtr.OpPtr = RxBufPtr->OpAdds.PktOptAdds[OP_DHCP_OPTION_OVERLOAD_IX - 1];
-
- if ((LocalPtr.OpPtr) && (LocalPtr.Overload->Overload & OVLD_SRVR_NAME)) {
- DecodeOptions (RxBufPtr, RxBufPtr->u.Dhcpv4.sname, sizeof RxBufPtr->u.Dhcpv4.sname);
- }
-
- if (LocalPtr.OpPtr && (LocalPtr.Overload->Overload & OVLD_FILE)) {
- DecodeOptions (RxBufPtr, RxBufPtr->u.Dhcpv4.file, sizeof RxBufPtr->u.Dhcpv4.file);
- } else if (!RxBufPtr->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1] && RxBufPtr->u.Dhcpv4.file[0]) {
- RxBufPtr->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1] = (DHCPV4_OP_STRUCT *) (RxBufPtr->u.Dhcpv4.file - sizeof (DHCPV4_OP_HEADER));
-
- RxBufPtr->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]->Header.Length = (UINT8) AsciiStrLen ((CHAR8 *)RxBufPtr->u.Dhcpv4.file);
- }
-
- LocalPtr.OpPtr = RxBufPtr->OpAdds.PktOptAdds[OP_DHCP_CLASS_IDENTIFIER_IX - 1];
-
- if ((LocalPtr.OpPtr) &&
- LocalPtr.PxeClassStr->Header.Length >= 9 &&
- !CompareMem (LocalPtr.PxeClassStr->Class, "PXEClient", 9)
- ) {
- RxBufPtr->OpAdds.Status |= PXE_TYPE;
- }
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-CopyParseRxBuf (
- PXE_BASECODE_DEVICE *Private,
- INTN RxBufIndex,
- INTN PacketIndex
- )
-{
- DHCP_RECEIVE_BUFFER *RxBufPtr;
-
- RxBufPtr = &((DHCP_RECEIVE_BUFFER *) Private->DhcpPacketBuffer)[PacketIndex];
-
- CopyMem (
- &RxBufPtr->u.Dhcpv4,
- &RxBuf[RxBufIndex].u.Dhcpv4,
- sizeof (RxBuf[RxBufIndex].u.Dhcpv4)
- );
-
- Parse (RxBufPtr, sizeof RxBufPtr->u.ReceiveBuffer);
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-CopyProxyRxBuf (
- PXE_BASECODE_DEVICE *Private,
- INTN RxBufIndex
- )
-{
- Private->EfiBc.Mode->ProxyOfferReceived = TRUE;
- CopyParseRxBuf (Private, RxBufIndex, PXE_OFFER_INDEX);
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-CopyParse (
- PXE_BASECODE_DEVICE *Private,
- EFI_PXE_BASE_CODE_PACKET *PacketPtr,
- EFI_PXE_BASE_CODE_PACKET *NewPacketPtr,
- INTN Index
- )
-{
- DHCP_RECEIVE_BUFFER *DhcpRxBuf;
-
- DhcpRxBuf = &((DHCP_RECEIVE_BUFFER *) Private->DhcpPacketBuffer)[Index];
-
- CopyMem (
- (EFI_PXE_BASE_CODE_PACKET *) &DhcpRxBuf->u.Dhcpv4,
- NewPacketPtr,
- sizeof (*NewPacketPtr)
- );
-
- CopyMem (&*PacketPtr, &*NewPacketPtr, sizeof (*NewPacketPtr));
-
- Parse (DhcpRxBuf, sizeof DhcpRxBuf->u.ReceiveBuffer);
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-BOOLEAN
-AckEdit (
- DHCP_RECEIVE_BUFFER *DhcpRxBuf
- )
-{
- UNION_PTR LocalPtr;
-
- LocalPtr.OpPtr = DhcpRxBuf->OpAdds.PktOptAdds[OP_DHCP_MESSAGE_TYPE_IX - 1];
-
- //
- // check that an ACK
- // if a DHCP type, must be DHCPOFFER and must have server id
- //
- return (BOOLEAN)
- (
- (LocalPtr.OpPtr) &&
- (LocalPtr.MessageType->Type == DHCPACK) &&
- DhcpRxBuf->OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1]
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// if a discover type packet, make sure all required fields are present
-//
-STATIC
-BOOLEAN
-DHCPOfferAckEdit (
- DHCP_RECEIVE_BUFFER *DhcpRxBuf
- )
-{
- PXE_OP_SERVER_LIST *BootServerOpPtr;
- UNION_PTR LocalPtr;
-
- if ((DhcpRxBuf->OpAdds.Status & DISCOVER_TYPE) == 0) {
- return TRUE;
- }
-
- LocalPtr.OpPtr = DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_DISCOVERY_CONTROL_IX - 1];
-
- if (LocalPtr.OpPtr == NULL) {
- LocalPtr.OpPtr = (DHCPV4_OP_STRUCT *) &DefaultDisCtl;
- DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_DISCOVERY_CONTROL_IX - 1] = (DHCPV4_OP_STRUCT *) &DefaultDisCtl;
- }
- //
- // make sure all required fields are here
- // if mucticast enabled, need multicast address
- //
- if (!(LocalPtr.DiscoveryControl->ControlBits & DISABLE_MCAST) &&
- (!DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_DISCOVERY_MCAST_ADDR_IX - 1] || !IS_MULTICAST (((DHCPV4_OP_STRUCT *) DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_DISCOVERY_MCAST_ADDR_IX - 1])->Data))
- ) {
- return FALSE;
- //
- // missing required field
- //
- }
- //
- // if a list, it better be good
- //
- BootServerOpPtr = (PXE_OP_SERVER_LIST *) DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_BOOT_SERVERS_IX - 1];
-
- if (BootServerOpPtr != NULL) {
- PXE_SERVER_LIST *BootServerListPtr;
- INTN ServerListLen;
- INTN ServerEntryLen;
-
- BootServerListPtr = BootServerOpPtr->ServerList;
- ServerListLen = BootServerOpPtr->Header.Length;
-
- do {
- EFI_IPv4_ADDRESS *IpListPtr;
- INTN IpCnt;
-
- IpCnt = BootServerListPtr->u.Ipv4List.IpCount;
-
- ServerEntryLen = sizeof (PXEV4_SERVER_LIST) + 2 + (IpCnt - 1) * sizeof (EFI_IPv4_ADDRESS);
-
- if (ServerListLen < ServerEntryLen) {
- //
- // missing required field
- //
- return FALSE;
- }
-
- IpListPtr = BootServerListPtr->u.Ipv4List.IpList;
-
- while (IpCnt--) {
- if (IS_MULTICAST (IpListPtr)) {
- //
- // missing required field
- //
- return FALSE;
- } else {
- ++IpListPtr;
- }
- }
-
- BootServerListPtr = (PXE_SERVER_LIST *) IpListPtr;
- } while (ServerListLen -= ServerEntryLen);
- }
- //
- // else there must be a list if use list enabled or multicast and
- // broadcast disabled
- //
- else if ((LocalPtr.DiscoveryControl->ControlBits & USE_ACCEPT_LIST) ||
- ((LocalPtr.DiscoveryControl->ControlBits & (DISABLE_MCAST | DISABLE_BCAST)) == (DISABLE_MCAST | DISABLE_BCAST))
- ) {
- //
- // missing required field
- //
- return FALSE;
- }
- //
- // if not USE_BOOTFILE or no bootfile given, must have menu stuff
- //
- if (!(LocalPtr.DiscoveryControl->ControlBits & USE_BOOTFILE) ||
- !DhcpRxBuf->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]
- ) {
- INTN MenuLth;
-
- LocalPtr.OpPtr = DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_BOOT_MENU_IX - 1];
-
- if (LocalPtr.OpPtr == NULL || !DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_BOOT_PROMPT_IX - 1]) {
- //
- // missing required field
- //
- return FALSE;
- }
- //
- // make sure menu valid
- //
- MenuLth = LocalPtr.BootMenu->Header.Length;
- LocalPtr.BootMenuItem = LocalPtr.BootMenu->MenuItem;
-
- do {
- INTN MenuItemLen;
-
- MenuItemLen = LocalPtr.BootMenuItem->DataLen;
-
- if (MenuItemLen == 0) {
- //
- // missing required field
- //
- return FALSE;
- }
-
- MenuItemLen += sizeof (*LocalPtr.BootMenuItem) - sizeof (LocalPtr.BootMenuItem->Data);
-
- MenuLth -= MenuItemLen;
- LocalPtr.BytePtr += MenuItemLen;
- } while (MenuLth > 0);
-
- if (MenuLth != 0) {
- //
- // missing required field
- //
- return FALSE;
- }
- }
-
- if (!DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_BOOT_ITEM_IX - 1]) {
- DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_BOOT_ITEM_IX - 1] = (DHCPV4_OP_STRUCT *) &DefaultBootItem;
- }
-
- return TRUE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-BOOLEAN
-DHCPAckEdit (
- DHCP_RECEIVE_BUFFER *RxBufPtr
- )
-{
- return (BOOLEAN) (DHCPOfferAckEdit (RxBufPtr) ? AckEdit (RxBufPtr) : FALSE);
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// get an offer/ack
-//
-STATIC
-EFI_STATUS
-GetOfferAck (
- PXE_BASECODE_DEVICE *Private,
- BOOLEAN (*ExtraEdit)(DHCP_RECEIVE_BUFFER *DhcpRxBuf),
- UINT16 OpFlags, // for Udp read
- EFI_IP_ADDRESS *ServerIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ServerPortPtr,
- EFI_IP_ADDRESS *ClientIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ClientPortPtr,
- DHCP_RECEIVE_BUFFER *DhcpRxBuf,
- EFI_EVENT TimeoutEvent
- )
-/*++
-Routine description:
- Wait for an OFFER/ACK packet.
-
-Parameters:
- Private := Pointer to PxeBc interface
- ExtraEdit := Pointer to extra option checking function
- OpFlags := UdpRead() option flags
- ServerIpPtr :=
- ServerPortPtr :=
- ClientIpPtr :=
- ClientPortPtr :=
- DhcpRxBuf :=
- TimeoutEvent :=
-
-Returns:
---*/
-{
- EFI_IP_ADDRESS ServerIp;
- EFI_STATUS StatCode;
- INTN RxBufLen;
-
- for (;;) {
- //
- // Wait until we get a UDP packet.
- //
- ZeroMem (&ServerIp, sizeof (EFI_IP_ADDRESS));
- RxBufLen = sizeof RxBuf[0].u.ReceiveBuffer;
-
- if ((StatCode = UdpRead (
- Private,
- OpFlags,
- ClientIpPtr,
- ClientPortPtr,
- ServerIpPtr,
- ServerPortPtr,
- 0,
- 0,
- (UINTN *) &RxBufLen,
- &DhcpRxBuf->u.Dhcpv4,
- TimeoutEvent
- )) != EFI_SUCCESS) {
- if (StatCode == EFI_TIMEOUT) {
- StatCode = EFI_NO_RESPONSE;
- }
-
- break;
- }
- //
- // got a packet - see if a good offer
- //
- if (DhcpRxBuf->u.Dhcpv4.op != BOOTP_REPLY) {
- continue;
- }
-
- if (DhcpRxBuf->u.Dhcpv4.xid != DHCPV4_TRANSMIT_BUFFER.xid) {
- continue;
- }
-
- if (*(UINT32 *) DHCPV4_TRANSMIT_BUFFER.options != * (UINT32 *) DhcpRxBuf->u.Dhcpv4.options) {
- continue;
- }
-
- if (*(UINT8 *) &DhcpRxBuf->u.Dhcpv4.yiaddr > 223) {
- continue;
- }
-
- if (CompareMem (
- DhcpRxBuf->u.Dhcpv4.chaddr,
- DHCPV4_TRANSMIT_BUFFER.chaddr,
- sizeof DhcpRxBuf->u.Dhcpv4.chaddr
- )) {
- //
- // no good
- //
- continue;
- }
-
- Parse (DhcpRxBuf, RxBufLen);
-
- if (!(*ExtraEdit) (DhcpRxBuf)) {
- continue;
- }
- //
- // Good DHCP packet.
- //
- StatCode = EFI_SUCCESS;
- break;
- }
-
- return StatCode;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// get DHCPOFFER's
-//
-STATIC
-EFI_STATUS
-GetOffers (
- PXE_BASECODE_DEVICE *Private
- )
-{
- EFI_IP_ADDRESS ClientIp;
- EFI_IP_ADDRESS ServerIp;
- EFI_STATUS StatCode;
- EFI_EVENT TimeoutEvent;
- INTN NumOffers;
- INTN Index;
-
- //
- //
- //
- ZeroMem (&ServerIp, sizeof (EFI_IP_ADDRESS));
- NumOffers = 0;
-
- for (Index = 0; Index < (sizeof Private->ServerCount) / sizeof Private->ServerCount[0]; ++Index) {
- Private->ServerCount[Index] = 0;
- Private->GotProxy[Index] = 0;
- }
-
- Private->GotBootp = 0;
- //
- // these we throw away
- //
- Private->GotProxy[DHCP_ONLY_IX] = 1;
- StatCode = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &TimeoutEvent
- );
-
- if (EFI_ERROR (StatCode)) {
- return StatCode;
- }
-
- StatCode = gBS->SetTimer (
- TimeoutEvent,
- TimerRelative,
- Private->Timeout * 10000000 + 1000000
- );
-
- if (EFI_ERROR (StatCode)) {
- gBS->CloseEvent (TimeoutEvent);
- return StatCode;
- }
- //
- // get offers
- //
- for (;;) {
- DHCP_RECEIVE_BUFFER *DhcpRxBuf;
- UNION_PTR LocalPtr;
-
- DhcpRxBuf = &RxBuf[NumOffers];
-
- if ((
- StatCode = GetOfferAck (
- Private,
- DHCPOfferAckEdit,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP |
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP |
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT,
- &ServerIp,
- &DhcpServerPort,
- &ClientIp,
- &DHCPClientPort,
- DhcpRxBuf,
- TimeoutEvent
- )
-) != EFI_SUCCESS
- ) {
- break;
- }
-
- LocalPtr.OpPtr = DhcpRxBuf->OpAdds.PktOptAdds[OP_DHCP_MESSAGE_TYPE_IX - 1];
-
- //
- // check type of offer
- //
- if (LocalPtr.OpPtr == NULL) {
- //
- // bootp - we only need one and make sure has bootfile
- //
- if (Private->GotBootp || !DhcpRxBuf->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]) {
- continue;
- }
-
- Private->GotBootp = (UINT8) (NumOffers + 1);
- }
- //
- // if a DHCP type, must be DHCPOFFER and must have server id
- //
- else if (LocalPtr.MessageType->Type != DHCPOFFER || !DhcpRxBuf->OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1]) {
- continue;
- } else {
- INTN TypeIx;
-
- //
- // get type - PXE10, WfM11a, or BINL
- //
- if (DhcpRxBuf->OpAdds.Status & DISCOVER_TYPE) {
- TypeIx = PXE10_IX;
- } else if (DhcpRxBuf->OpAdds.Status & WfM11a_TYPE) {
- //
- // WfM - make sure it has a bootfile
- //
- if (!DhcpRxBuf->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]) {
- continue;
- }
-
- TypeIx = WfM11a_IX;
- } else {
- TypeIx = (DhcpRxBuf->OpAdds.Status & PXE_TYPE) ? BINL_IX : DHCP_ONLY_IX;
- }
- //
- // check DHCP or proxy
- //
- if (DhcpRxBuf->u.Dhcpv4.yiaddr == 0) {
- //
- // proxy - only need one of each type if not BINL
- // and must have at least PXE_TYPE
- //
- if (TypeIx == BINL_IX) {
- Private->BinlProxies[Private->GotProxy[BINL_IX]++] = (UINT8) NumOffers;
- } else if (Private->GotProxy[TypeIx]) {
- continue;
- } else {
- Private->GotProxy[TypeIx] = (UINT8) (NumOffers + 1);
- }
- } else {
- Private->OfferCount[TypeIx][Private->ServerCount[TypeIx]++] = (UINT8) NumOffers;
- }
- }
-
- if (++NumOffers == MAX_OFFERS) {
- break;
- }
- }
-
- gBS->CloseEvent (TimeoutEvent);
- Private->NumOffersReceived = NumOffers;
-
- return (Private->NumOffersReceived) ? EFI_SUCCESS : EFI_NO_RESPONSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// send DHCPDECLINE
-//
-STATIC
-VOID
-DeclineOffer (
- PXE_BASECODE_DEVICE *Private
- )
-{
- EFI_PXE_BASE_CODE_MODE *PxebcMode;
- UINT16 SaveSecs;
-
- PxebcMode = Private->EfiBc.Mode;
- SaveSecs = DHCPV4_TRANSMIT_BUFFER.secs;
-
- DHCPV4_TRANSMIT_BUFFER.secs = 0;
- DHCPV4_TRANSMIT_BUFFER.flags = 0;
- SetMem (
- DHCPV4_TRANSMIT_BUFFER.options + sizeof (struct opdeclinestr),
- sizeof (DHCPOpStart) - sizeof (struct opdeclinestr),
- OP_PAD
- );
- DHCPDECLINEoptions.DhcpMessageType.Type = DHCPDECLINE;
- CopyMem (&DHCPDECLINEoptions.OpDeclineEnd, &DHCP_REQ_OPTIONS, sizeof (struct requestopendstr));
- // DHCPDECLINEoptions.OpDeclineEnd = DHCP_REQ_OPTIONS;
-
- {
- EFI_IP_ADDRESS TmpIp;
-
- CopyMem (&TmpIp, &DHCP_REQ_OPTIONS.DhcServerIpPtr.Ip, sizeof TmpIp);
-
- DoUdpWrite (
- Private,
- &TmpIp,
- &DhcpServerPort,
- &PxebcMode->StationIp,
- &DHCPClientPort
- );
- }
-
- InitDhcpv4TxBuf (Private);
- DHCPV4_TRANSMIT_BUFFER.secs = SaveSecs;
- Private->GoodStationIp = FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// send DHCPRELEASE
-//
-STATIC
-BOOLEAN
-Release (
- PXE_BASECODE_DEVICE *Private
- )
-{
- EFI_PXE_BASE_CODE_MODE *PxebcMode;
- UINT16 SaveSecs;
- DHCPV4_OP_SERVER_IP *Point;
-
- PxebcMode = Private->EfiBc.Mode;
- SaveSecs = DHCPV4_TRANSMIT_BUFFER.secs;
- DHCPV4_TRANSMIT_BUFFER.secs = 0;
-
- SetMem (
- DHCPV4_TRANSMIT_BUFFER.options + sizeof (struct opreleasestr),
- sizeof (DHCPOpStart) - sizeof (struct opreleasestr),
- OP_PAD
- );
-
- DHCPRELEASEoptions.DhcpMessageType.Type = DHCPRELEASE;
- Point = (DHCPV4_OP_SERVER_IP *) DHCPV4_ACK_BUFFER.OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1];
- CopyMem (
- &DHCPRELEASEoptions.DhcServerIpPtr,
- &Point,
- sizeof DHCPRELEASEoptions.DhcServerIpPtr
- );
-
- DHCPRELEASEoptions.End[0] = OP_END;
-
- {
- EFI_IP_ADDRESS TmpIp;
-
- CopyMem (&TmpIp, &DHCPRELEASEoptions.DhcServerIpPtr.Ip, sizeof TmpIp);
-
- DoUdpWrite (
- Private,
- &TmpIp,
- &DhcpServerPort,
- &PxebcMode->StationIp,
- &DHCPClientPort
- );
- }
-
- InitDhcpv4TxBuf (Private);
-
- DHCPV4_TRANSMIT_BUFFER.secs = SaveSecs;
- Private->GoodStationIp = FALSE;
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-BOOLEAN
-GetBINLAck (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *ServerIpPtr
- )
-{
- DHCP_RECEIVE_BUFFER *DhcpRxBuf;
- EFI_STATUS StatCode;
- EFI_EVENT TimeoutEvent;
-
- //
- //
- //
- StatCode = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &TimeoutEvent
- );
-
- if (EFI_ERROR (StatCode)) {
- return FALSE;
- }
-
- StatCode = gBS->SetTimer (
- TimeoutEvent,
- TimerRelative,
- Private->Timeout * 10000000 + 1000000
- );
-
- if (EFI_ERROR (StatCode)) {
- gBS->CloseEvent (TimeoutEvent);
- return FALSE;
- }
- //
- //
- //
- DhcpRxBuf = &PXE_BINL_BUFFER;
-
- for (;;) {
- EFI_PXE_BASE_CODE_UDP_PORT BINLSrvPort;
-
- BINLSrvPort = 0;
-
- if (GetOfferAck (
- Private,
- AckEdit,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT,
- ServerIpPtr,
- &BINLSrvPort,
- &Private->EfiBc.Mode->StationIp,
- &PSEUDO_DHCP_CLIENT_PORT,
- DhcpRxBuf,
- TimeoutEvent
- ) != EFI_SUCCESS) {
- break;
- }
- //
- // make sure from whom we wanted
- //
- if (!DhcpRxBuf->u.Dhcpv4.yiaddr && !CompareMem (
- &ServerIpPtr->v4,
- &((DHCPV4_OP_SERVER_IP *) DhcpRxBuf->OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1])->Ip,
- sizeof (ServerIpPtr->v4)
- )) {
- gBS->CloseEvent (TimeoutEvent);
- //
- // got an ACK from server
- //
- return TRUE;
- }
- }
-
- gBS->CloseEvent (TimeoutEvent);
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// make sure we can get BINL
-// send DHCPREQUEST to PXE server
-//
-STATIC
-BOOLEAN
-TryBINL (
- PXE_BASECODE_DEVICE *Private,
- INTN OfferIx
- )
-{
- DHCP_RECEIVE_BUFFER *DhcpRxBuf;
- EFI_IP_ADDRESS ServerIp;
- UINT16 SaveSecs;
- INTN Index;
-
- DhcpRxBuf = &RxBuf[OfferIx];
-
- //
- // use next server address first.
- //
- ServerIp.Addr[0] = DhcpRxBuf->u.Dhcpv4.siaddr;
- if (ServerIp.Addr[0] == 0) {
- //
- // next server address is NULL, use option 54.
- //
- CopyMem (
- ((EFI_IPv4_ADDRESS *) &ServerIp),
- &((DHCPV4_OP_SERVER_IP *) DhcpRxBuf->OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1])->Ip,
- sizeof (EFI_IPv4_ADDRESS)
- );
- }
-
- //
- // client IP address - filled in by client if it knows it
- //
- CopyMem (
- ((EFI_IPv4_ADDRESS *) &DHCPV4_TRANSMIT_BUFFER.ciaddr),
- &DHCP_REQ_OPTIONS.OpReqIP.Ip,
- sizeof (EFI_IPv4_ADDRESS)
- );
-
- SetMem (&DHCP_REQ_OPTIONS, sizeof DHCP_REQ_OPTIONS, OP_PAD);
- DHCPV4_TRANSMIT_BUFFER.flags = 0;
- DHCPV4_OPTIONS_BUFFER.End[0] = OP_END;
- AddRouters (Private, DhcpRxBuf);
- SaveSecs = DHCPV4_TRANSMIT_BUFFER.secs;
-
- for (Index = 0; Index < 3; Private->TotalSeconds = (UINT16) (Private->TotalSeconds + Private->Timeout), ++Index) {
- DHCPV4_TRANSMIT_BUFFER.secs = HTONS (Private->TotalSeconds);
-
- //
- // unicast DHCPREQUEST to PXE server
- //
- if (DoUdpWrite (
- Private,
- &ServerIp,
- &PseudoDhcpServerPort,
- (EFI_IP_ADDRESS *) &DHCPV4_TRANSMIT_BUFFER.ciaddr,
- &PSEUDO_DHCP_CLIENT_PORT
- ) != EFI_SUCCESS) {
- break;
- }
-
- if (!GetBINLAck (Private, &ServerIp)) {
- continue;
- }
- //
- // early exit failures
- // make sure a good ACK
- //
- if (!DHCPOfferAckEdit (&PXE_BINL_BUFFER) || (
- !(PXE_BINL_BUFFER.OpAdds.Status & DISCOVER_TYPE) && !PXE_BINL_BUFFER.OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]
- )
- ) {
- break;
- }
-
- Private->EfiBc.Mode->ProxyOfferReceived = TRUE;
- return TRUE;
- }
- //
- // failed - reset seconds field, etc.
- //
- Private->EfiBc.Mode->RouteTableEntries = 0;
- //
- // reset
- //
- DHCPV4_TRANSMIT_BUFFER.secs = SaveSecs;
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-BOOLEAN
-TryFinishBINL (
- PXE_BASECODE_DEVICE *Private,
- INTN OfferIx
- )
-{
- if (TryBINL (Private, OfferIx)) {
- return TRUE;
- }
-
- return Release (Private);
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-BOOLEAN
-TryFinishProxyBINL (
- PXE_BASECODE_DEVICE *Private
- )
-{
- INTN Index;
-
- for (Index = 0; Index < Private->GotProxy[BINL_IX]; ++Index) {
- if (TryBINL (Private, Private->BinlProxies[Index])) {
- return TRUE;
- }
- }
-
- return Release (Private);
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// try to finish DORA - send DHCP request, wait for ACK, check with ARP
-//
-STATIC
-BOOLEAN
-TryFinishDORA (
- PXE_BASECODE_DEVICE *Private,
- INTN OfferIx
- )
-{
- DHCP_RECEIVE_BUFFER *DhcpRxBuf;
- EFI_IP_ADDRESS ClientIp;
- EFI_IP_ADDRESS ServerIp;
- EFI_STATUS StatCode;
- UNION_PTR LocalPtr;
- EFI_EVENT TimeoutEvent;
-
- //
- // send DHCP request
- // if fail return false
- //
- DhcpRxBuf = &DHCPV4_ACK_BUFFER;
- DHCPV4_OPTIONS_BUFFER.DhcpMessageType.Type = DHCPREQUEST;
- CopyMem (&DHCP_REQ_OPTIONS, &RequestOpEndStr, sizeof (RequestOpEndStr));
-// DHCP_REQ_OPTIONS = RequestOpEndStr;
- DHCP_REQ_OPTIONS.OpReqIP.Ip = *(EFI_IPv4_ADDRESS *) &RxBuf[OfferIx].u.Dhcpv4.yiaddr;
-
- CopyMem (
- &DHCP_REQ_OPTIONS.DhcServerIpPtr.Ip,
- &((DHCPV4_OP_SERVER_IP *) RxBuf[OfferIx].OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1])->Ip,
- sizeof DHCP_REQ_OPTIONS.DhcServerIpPtr.Ip
- );
-
- CopyMem (
- Private->EfiBc.Mode->SubnetMask.Addr,
- &DefaultSubnetMask,
- 4
- );
-
- //
- // broadcast DHCPREQUEST
- //
- if (DoUdpWrite (
- Private,
- &BroadcastIP,
- &DhcpServerPort,
- (EFI_IP_ADDRESS *) &DHCPV4_TRANSMIT_BUFFER.ciaddr,
- &DHCPClientPort
- ) != EFI_SUCCESS) {
- return FALSE;
- }
- //
- //
- //
- StatCode = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &TimeoutEvent
- );
-
- if (EFI_ERROR (StatCode)) {
- return FALSE;
- }
-
- StatCode = gBS->SetTimer (
- TimeoutEvent,
- TimerPeriodic,
- Private->Timeout * 10000000 + 1000000
- );
-
- if (EFI_ERROR (StatCode)) {
- gBS->CloseEvent (TimeoutEvent);
- return FALSE;
- }
- //
- // wait for ACK
- //
- for (;;) {
- if (GetOfferAck (
- Private,
- DHCPAckEdit,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP | EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP,
- &ServerIp,
- &DhcpServerPort,
- &ClientIp,
- &DHCPClientPort,
- DhcpRxBuf,
- TimeoutEvent
- ) != EFI_SUCCESS) {
- break;
- }
- //
- // check type of response - need DHCPACK
- //
- if (CompareMem (
- &DHCP_REQ_OPTIONS.OpReqIP.Ip,
- &DhcpRxBuf->u.Dhcpv4.yiaddr,
- sizeof (EFI_IPv4_ADDRESS)
- ) || CompareMem (
- &DHCP_REQ_OPTIONS.DhcServerIpPtr.Ip,
- &((DHCPV4_OP_SERVER_IP *) DhcpRxBuf->OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1])->Ip,
- sizeof (EFI_IPv4_ADDRESS)
- )) {
- continue;
- }
- //
- // got ACK
- // check with ARP that IP unused - good return true
- //
- if (!SetStationIP (Private)) {
- //
- // fail - send DHCPDECLINE and return false
- //
- DeclineOffer (Private);
- break;
- }
-
- LocalPtr.OpPtr = DHCPV4_ACK_BUFFER.OpAdds.PktOptAdds[OP_SUBNET_MASK_IX - 1];
-
- if (LocalPtr.OpPtr != NULL) {
- CopyMem (
- (EFI_IPv4_ADDRESS *) &Private->EfiBc.Mode->SubnetMask,
- &LocalPtr.SubnetMaskStr->Ip,
- sizeof (EFI_IPv4_ADDRESS)
- );
- }
-
- AddRouters (Private, DhcpRxBuf);
- gBS->CloseEvent (TimeoutEvent);
- return TRUE;
- }
-
- gBS->CloseEvent (TimeoutEvent);
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// try a DHCP server of appropriate type
-//
-STATIC
-BOOLEAN
-TryDHCPFinishDORA (
- PXE_BASECODE_DEVICE *Private,
- INTN TypeIx
- )
-{
- INTN Index;
-
- //
- // go through the DHCP servers of the requested type
- //
- for (Index = 0; Index < Private->ServerCount[TypeIx]; ++Index) {
- if (TryFinishDORA (Private, Index = Private->OfferCount[TypeIx][Index])) {
- if (TypeIx == BINL_IX && !TryFinishBINL (Private, Index)) {
- continue;
- }
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// try a DHCP only server and a proxy of appropriate type
-//
-STATIC
-BOOLEAN
-TryProxyFinishDORA (
- PXE_BASECODE_DEVICE *Private,
- INTN TypeIx
- )
-{
- INTN Index;
-
- if (!Private->GotProxy[TypeIx]) {
- //
- // no proxies of the type wanted
- //
- return FALSE;
- }
- //
- // go through the DHCP only servers
- //
- for (Index = 0; Index < Private->ServerCount[DHCP_ONLY_IX]; ++Index) {
- if (TryFinishDORA (Private, Private->OfferCount[DHCP_ONLY_IX][Index])) {
- if (TypeIx != BINL_IX) {
- CopyProxyRxBuf (Private, Private->GotProxy[TypeIx] - 1);
- } else if (!TryFinishProxyBINL (Private)) {
- //
- // if didn't work with this DHCP, won't work with any
- //
- return FALSE;
- }
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// getting to the bottom of the barrel
-//
-STATIC
-BOOLEAN
-TryAnyWithBootfileFinishDORA (
- PXE_BASECODE_DEVICE *Private
- )
-{
- //
- // try a DHCP only server who has a bootfile
- //
- UNION_PTR LocalPtr;
- INTN Index;
-
- for (Index = 0; Index < Private->ServerCount[DHCP_ONLY_IX]; ++Index) {
- INTN offer;
-
- offer = Private->OfferCount[DHCP_ONLY_IX][Index];
-
- if (RxBuf[offer].OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1] && TryFinishDORA (Private, offer)) {
- return TRUE;
- }
- }
- //
- // really at bottom - see if be have any bootps
- //
- if (!Private->GotBootp) {
- return FALSE;
- }
-
- DHCP_REQ_OPTIONS.OpReqIP.Ip = *(EFI_IPv4_ADDRESS *) &RxBuf[Private->GotBootp - 1].u.Dhcpv4.yiaddr;
-
- if (!SetStationIP (Private)) {
- return FALSE;
- }
- //
- // treat BOOTP response as DHCP ACK packet
- //
- CopyParseRxBuf (Private, Private->GotBootp - 1, DHCPV4_ACK_INDEX);
-
- LocalPtr.OpPtr = RxBuf[Private->GotBootp - 1].OpAdds.PktOptAdds[OP_SUBNET_MASK_IX - 1];
-
- if (LocalPtr.OpPtr != NULL) {
- *(EFI_IPv4_ADDRESS *) &Private->EfiBc.Mode->SubnetMask = LocalPtr.SubnetMaskStr->Ip;
- }
-
- return TRUE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-/* DoDhcpDora()
- */
-STATIC
-EFI_STATUS
-DoDhcpDora (
- PXE_BASECODE_DEVICE *Private,
- BOOLEAN SortOffers
- )
-{
- EFI_PXE_BASE_CODE_IP_FILTER Filter;
- EFI_STATUS StatCode;
- INTN NumOffers;
-
- Filter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP | EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST;
-
- Filter.IpCnt = 0;
- Filter.reserved = 0;
-
- //
- // set filter unicast or broadcast
- //
- if ((StatCode = IpFilter (Private, &Filter)) != EFI_SUCCESS) {
- return StatCode;
- }
- //
- // seed random number with hardware address
- //
- SeedRandom (Private, *(UINT16 *) &Private->SimpleNetwork->Mode->CurrentAddress);
-
- for (Private->Timeout = 1;
- Private->Timeout < 17;
- Private->TotalSeconds = (UINT16) (Private->TotalSeconds + Private->Timeout), Private->Timeout <<= 1
- ) {
- INTN Index;
-
- InitDhcpv4TxBuf (Private);
- DHCPV4_TRANSMIT_BUFFER.xid = Random (Private);
- DHCPV4_TRANSMIT_BUFFER.secs = HTONS (Private->TotalSeconds);
-
- //
- // broadcast DHCPDISCOVER
- //
- StatCode = DoUdpWrite (
- Private,
- &BroadcastIP,
- &DhcpServerPort,
- (EFI_IP_ADDRESS *) &DHCPV4_TRANSMIT_BUFFER.ciaddr,
- &DHCPClientPort
- );
-
- if (StatCode != EFI_SUCCESS) {
- return StatCode;
- }
-
- CopyMem (
- &Private->EfiBc.Mode->DhcpDiscover,
- (EFI_PXE_BASE_CODE_PACKET *) &DHCPV4_TRANSMIT_BUFFER,
- sizeof (EFI_PXE_BASE_CODE_PACKET)
- );
-
- //
- // get DHCPOFFER's
- //
- if ((StatCode = GetOffers (Private)) != EFI_SUCCESS) {
- if (StatCode != EFI_NO_RESPONSE) {
- return StatCode;
- }
-
- continue;
- }
- //
- // select offer and reply DHCPREQUEST
- //
- if (SortOffers) {
- if (TryDHCPFinishDORA(Private, PXE10_IX) || // try DHCP with PXE10
- TryDHCPFinishDORA(Private, WfM11a_IX) || // no - try with WfM
- TryProxyFinishDORA(Private, PXE10_IX) || // no - try DHCP only and proxy with PXE10
- TryProxyFinishDORA(Private, WfM11a_IX) || // no - try DHCP only and proxy with WfM
- TryDHCPFinishDORA(Private, BINL_IX) || // no - try with WfM
- TryProxyFinishDORA(Private, BINL_IX) || // no - try DHCP only and proxy with PXE10
- TryAnyWithBootfileFinishDORA(Private))
- {
- return EFI_SUCCESS;
- }
-
- continue;
- }
- //
- // FIFO order
- //
- NumOffers = Private->NumOffersReceived;
-
- for (Index = 0; Index < NumOffers; ++Index) {
- //
- // ignore proxies
- //
- if (!RxBuf[Index].u.Dhcpv4.yiaddr) {
- continue;
- }
- //
- // check if a bootp server
- //
- if (!RxBuf[Index].OpAdds.PktOptAdds[OP_DHCP_MESSAGE_TYPE_IX - 1]) {
- //
- // it is - just check ARP
- //
- if (!SetStationIP (Private)) {
- continue;
- }
- }
- //
- // else check if a DHCP only server
- //
- else if (!(RxBuf[Index].OpAdds.Status & (DISCOVER_TYPE | WfM11a_TYPE | PXE_TYPE))) {
- //
- // it is a normal DHCP offer (without any PXE options), just finish the D.O.R.A by sending DHCP request.
- //
- if (!TryFinishDORA (Private, Index)) {
- continue;
- }
- } else if (TryFinishDORA (Private, Index)) {
- if (!(RxBuf[Index].OpAdds.Status & (DISCOVER_TYPE | WfM11a_TYPE)) && !TryFinishBINL (Private, Index)) {
- continue;
- }
- }
-
- DEBUG ((EFI_D_WARN, "\nDoDhcpDora() Got packets. "));
- return EFI_SUCCESS;
- }
- //
- // now look for DHCP onlys and a Proxy
- //
- for (Index = 0; Index < NumOffers; ++Index) {
- UINT8 Index2;
-
- //
- // ignore proxies, bootps, non DHCP onlys, and bootable DHCPS
- //
- if (!RxBuf[Index].u.Dhcpv4.yiaddr ||
- !RxBuf[Index].OpAdds.PktOptAdds[OP_DHCP_MESSAGE_TYPE_IX - 1] ||
- RxBuf[Index].OpAdds.Status & (DISCOVER_TYPE | WfM11a_TYPE | PXE_TYPE) ||
- RxBuf[Index].OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]
- ) {
- continue;
- }
- //
- // found non bootable DHCP only - try to find a proxy
- //
- for (Index2 = 0; Index2 < NumOffers; ++Index2) {
- if (!RxBuf[Index2].u.Dhcpv4.yiaddr) {
- if (!TryFinishDORA (Private, Index)) {
- //
- // DHCP no ACK
- //
- break;
- }
-
- if (RxBuf[Index2].OpAdds.Status & (DISCOVER_TYPE | WfM11a_TYPE)) {
- CopyProxyRxBuf (Private, Index2);
- } else if (!TryFinishBINL (Private, Index2)) {
- continue;
- }
-
- DEBUG ((EFI_D_WARN, "\nDoDhcpDora() Got packets. "));
- return EFI_SUCCESS;
- }
- }
- }
- }
-
- return EFI_NO_RESPONSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// determine if the server ip is in the ip list
-//
-STATIC
-BOOLEAN
-InServerList (
- EFI_IP_ADDRESS *ServerIpPtr,
- PXE_SERVER_LISTS *ServerListPtr
- )
-{
- UINTN Index;
-
- if (!ServerListPtr || !ServerListPtr->Ipv4List.IpCount) {
- return TRUE;
- }
-
- for (Index = 0; Index < ServerListPtr->Ipv4List.IpCount; ++Index) {
- if (!CompareMem (
- ServerIpPtr,
- &ServerListPtr->Ipv4List.IpList[Index],
- sizeof (EFI_IPv4_ADDRESS)
- )) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-BOOLEAN
-ExtractBootServerList (
- UINT16 Type,
- DHCPV4_OP_STRUCT *ptr,
- PXE_SERVER_LISTS **ServerListPtr
- )
-{
- UNION_PTR LocalPtr;
- INTN ServerListLen;
-
- LocalPtr.OpPtr = ptr;
- ServerListLen = LocalPtr.BootServersStr->Header.Length;
-
- //
- // find type
- //
- LocalPtr.BootServerList = LocalPtr.BootServersStr->ServerList;
-
- while (ServerListLen) {
- INTN ServerEntryLen;
-
- ServerEntryLen = sizeof (PXEV4_SERVER_LIST) + 2 + (LocalPtr.BootServerList->u.Ipv4List.IpCount - 1) *
- sizeof (EFI_IPv4_ADDRESS);
-
- if (NTOHS (LocalPtr.BootServerList->Type) == Type) {
- *ServerListPtr = &LocalPtr.BootServerList->u;
- return TRUE;
- }
-
- (LocalPtr.BytePtr) += ServerEntryLen;
- ServerListLen -= ServerEntryLen;
- }
-
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-FreeMem (
- PXE_BASECODE_DEVICE *Private
- )
-{
- if (Private->TransmitBuffer != NULL) {
- FreePool (Private->TransmitBuffer);
- Private->TransmitBuffer = NULL;
- }
-
- if (Private->ReceiveBuffers != NULL) {
- FreePool (Private->ReceiveBuffers);
- Private->ReceiveBuffers = NULL;
- }
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-BOOLEAN
-GetMem (
- PXE_BASECODE_DEVICE *Private
- )
-{
-
- if (Private->DhcpPacketBuffer == NULL) {
- Private->DhcpPacketBuffer = AllocatePool (sizeof (DHCP_RECEIVE_BUFFER) * (PXE_BIS_INDEX + 1));
- if (Private->DhcpPacketBuffer == NULL) {
- FreeMem (Private);
- return FALSE;
- }
- }
-
- Private->TransmitBuffer = AllocatePool (sizeof (EFI_PXE_BASE_CODE_PACKET));
- if (Private->TransmitBuffer == NULL) {
- FreePool (Private->DhcpPacketBuffer);
- Private->DhcpPacketBuffer = NULL;
- FreeMem (Private);
- return FALSE;
- }
-
- Private->ReceiveBuffers = AllocatePool (sizeof (DHCP_RECEIVE_BUFFER) * (MAX_OFFERS));
- if (Private->ReceiveBuffers == NULL) {
- FreePool (Private->TransmitBuffer);
- FreePool (Private->DhcpPacketBuffer);
- Private->DhcpPacketBuffer = NULL;
- Private->TransmitBuffer = NULL;
- FreeMem (Private);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-BcDhcp (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN BOOLEAN SortOffers
- )
-/*++
-Routine description:
- standard DHCP Discover/Offer/Request/Ack session
- broadcast DHCPDISCOVER
- receive DHCPOFFER's
- broadcast DHCPREQUEST
- receive DHCPACK
- check (ARP) good IP
-
-Parameters:
- This := Pointer to PxeBc interface
- SortOffers :=
-
-Returns:
---*/
-{
- EFI_PXE_BASE_CODE_IP_FILTER Filter;
- EFI_PXE_BASE_CODE_MODE *PxebcMode;
- PXE_BASECODE_DEVICE *Private;
- EFI_STATUS StatCode;
-
- //
- // Lock the instance data and make sure started
- //
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- if (This->Mode == NULL || !This->Mode->Started) {
- DEBUG ((EFI_D_ERROR, "BC was not started."));
- EfiReleaseLock (&Private->Lock);
- return EFI_NOT_STARTED;
- }
-
- Filter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP;
- Filter.IpCnt = 0;
- Filter.reserved = 0;
-
- DEBUG ((EFI_D_INFO, "\nBcDhcp() Enter. "));
-
- PxebcMode = Private->EfiBc.Mode;
-
- if (!GetMem (Private)) {
- DEBUG ((EFI_D_ERROR, "\nBcDhcp() GetMem() failed.\n"));
- EfiReleaseLock (&Private->Lock);
- return EFI_OUT_OF_RESOURCES;
- }
-
- PxebcMode->DhcpDiscoverValid = FALSE;
- PxebcMode->DhcpAckReceived = FALSE;
- PxebcMode->ProxyOfferReceived = FALSE;
-
- Private->Function = EFI_PXE_BASE_CODE_FUNCTION_DHCP;
-
- //
- // Issue BC command
- //
- if (Private->TotalSeconds == 0) {
- //
- // put in seconds field of DHCP send packets
- //
- Private->TotalSeconds = 4;
- }
-
- if ((StatCode = DoDhcpDora (Private, SortOffers)) == EFI_SUCCESS) {
- //
- // success - copy packets
- //
- PxebcMode->DhcpDiscoverValid = PxebcMode->DhcpAckReceived = TRUE;
-
- CopyMem (
- &PxebcMode->DhcpAck,
- (EFI_PXE_BASE_CODE_PACKET *) &DHCPV4_ACK_PACKET,
- sizeof (EFI_PXE_BASE_CODE_PACKET)
- );
-
- if (PxebcMode->ProxyOfferReceived) {
- CopyMem (
- &PxebcMode->ProxyOffer,
- (EFI_PXE_BASE_CODE_PACKET *) &PXE_OFFER_PACKET,
- sizeof (EFI_PXE_BASE_CODE_PACKET)
- );
- }
- }
- //
- // set filter back to unicast
- //
- IpFilter (Private, &Filter);
-
- FreeMem (Private);
-
- //
- // Unlock the instance data
- //
- DEBUG ((EFI_D_WARN, "\nBcDhcp() Exit = %xh ", StatCode));
-
- EfiReleaseLock (&Private->Lock);
- return StatCode;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-BOOLEAN
-VerifyCredentialOption (
- UINT8 *tx,
- UINT8 *rx
- )
-{
- UINTN n;
-
- //
- // Fail verification if either pointer is NULL.
- //
- if (tx == NULL || rx == NULL) {
- return FALSE;
- }
- //
- // Fail verification if tx[0] is not a credential type option
- // or if the length is zero or not a multiple of four.
- //
- if (tx[0] != VEND_PXE_CREDENTIAL_TYPES || tx[1] == 0 || tx[1] % 4 != 0) {
- return FALSE;
- }
- //
- // Fail verification if rx[0] is not a credential type option
- // or if the length is not equal to four.
- //
- if (rx[0] != VEND_PXE_CREDENTIAL_TYPES || rx[1] != 4) {
- return FALSE;
- }
- //
- // Look through transmitted credential types for a copy
- // of the received credential type.
- //
- for (n = 0; n < tx[1]; n += 4) {
- if (!CompareMem (&tx[n + 2], &rx[2], 4)) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-DoDiscover (
- PXE_BASECODE_DEVICE *Private,
- UINT16 OpFlags,
- IN UINT16 Type,
- IN UINT16 *LayerPtr,
- IN BOOLEAN UseBis,
- EFI_IP_ADDRESS *DestPtr,
- PXE_SERVER_LISTS *ServerListPtr
- )
-/*++
-Routine description:
- This function tries to complete the PXE Bootserver and/or boot image
- discovery sequence. When this command completes successfully, the
- PXEdiscover and PXEreply fields in the BC instance data structure are
- updated. If the Info pointer is set to NULL, the discovery information
- in the DHCPack and ProxyOffer packets must be valid and will be used.
- If Info is not set to NULL, the discovery methods in the Info field
- must be set and will be used. When discovering any layer number other
- than zero (the credential flag does not count), only unicast discovery
- is used.
-
-Parameters:
- Private := Pointer to PxeBc interface
- OpFlags :=
- Type :=
- LayerPtr :=
- UseBis :=
- DestPtr :=
- ServerListPtr :=
-
-Returns:
---*/
-{
- EFI_PXE_BASE_CODE_UDP_PORT ClientPort;
- EFI_PXE_BASE_CODE_UDP_PORT ServerPort;
- EFI_PXE_BASE_CODE_MODE *PxebcMode;
- EFI_STATUS StatCode;
- EFI_EVENT TimeoutEvent;
- UINT8 OpLen;
-
- PxebcMode = Private->EfiBc.Mode;
-
- if (DestPtr->Addr[0] == 0) {
- DEBUG ((EFI_D_WARN, "\nDoDiscover() !DestPtr->Addr[0]"));
- return EFI_INVALID_PARAMETER;
- }
- //
- // seed random number with hardware address
- //
- SeedRandom (Private, *(UINT16 *) &Private->SimpleNetwork->Mode->CurrentAddress);
-
- if (DestPtr->Addr[0] == BroadcastIP.Addr[0]) {
- ClientPort = DHCPClientPort;
- ServerPort = DhcpServerPort;
- } else {
- ClientPort = PSEUDO_DHCP_CLIENT_PORT;
- ServerPort = PseudoDhcpServerPort;
- }
-
- if (UseBis) {
- *LayerPtr |= PXE_BOOT_LAYER_CREDENTIAL_FLAG;
- } else {
- *LayerPtr &= PXE_BOOT_LAYER_MASK;
- }
-
- for (Private->Timeout = 1;
- Private->Timeout < 5;
- Private->TotalSeconds = (UINT16) (Private->TotalSeconds + Private->Timeout), ++Private->Timeout
- ) {
- InitDhcpv4TxBuf (Private);
- //
- // initialize DHCP message structure
- //
- DHCPV4_TRANSMIT_BUFFER.xid = Random (Private);
- DHCPV4_TRANSMIT_BUFFER.secs = HTONS (Private->TotalSeconds);
- CopyMem (
- &DHCPV4_TRANSMIT_BUFFER.ciaddr,
- &PxebcMode->StationIp,
- sizeof DHCPV4_TRANSMIT_BUFFER.ciaddr
- );
-
- DHCPV4_OPTIONS_BUFFER.DhcpMessageType.Type = DHCPREQUEST;
- DISCOVERoptions.Header.OpCode = OP_VENDOR_SPECIFIC;
- DISCOVERoptions.BootItem.Header.OpCode = VEND_PXE_BOOT_ITEM;
- DISCOVERoptions.BootItem.Header.Length = DHCPV4_OPTION_LENGTH (PXE_OP_BOOT_ITEM);
- DISCOVERoptions.BootItem.Type = HTONS (Type);
- DISCOVERoptions.BootItem.Layer = HTONS (*LayerPtr);
-
- if (UseBis) {
- EFI_BIS_PROTOCOL *BisPtr;
- BIS_APPLICATION_HANDLE BisAppHandle;
- EFI_BIS_DATA *BisDataSigInfo;
- EFI_BIS_SIGNATURE_INFO *BisSigInfo;
- UINTN Index;
- UINTN Index2;
-
- BisPtr = PxebcBisStart (
- Private,
- &BisAppHandle,
- &BisDataSigInfo
- );
-
- if (BisPtr == NULL) {
- //
- // %%TBD - In order to get here, BIS must have
- // been present when PXEBC.Start() was called.
- // BIS had to be shutdown/removed/damaged
- // before PXEBC.Discover() was called.
- // Do we need to document a specific error
- // for this case?
- //
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Compute number of credential types.
- //
- Index2 = BisDataSigInfo->Length / sizeof (EFI_BIS_SIGNATURE_INFO);
-
- DISCREDoptions.Header.OpCode = VEND_PXE_CREDENTIAL_TYPES;
-
- DISCREDoptions.Header.Length = (UINT8) (Index2 * sizeof (PXE_CREDENTIAL));
-
- OpLen = (UINT8) (DHCPV4_OPTION_LENGTH (PXE_DISCOVER_OPTIONS) + sizeof (DHCPV4_OP_HEADER) + DISCREDoptions.Header.Length);
-
- BisSigInfo = (EFI_BIS_SIGNATURE_INFO *) BisDataSigInfo->Data;
-
- for (Index = 0; Index < Index2; ++Index) {
- UINT32 x;
-
- CopyMem (&x, &BisSigInfo[Index], sizeof x);
- x = HTONL (x);
- CopyMem (&DISCREDoptions.Credentials[Index], &x, sizeof x);
- }
-
- PxebcBisStop (BisPtr, BisAppHandle, BisDataSigInfo);
- } else {
- OpLen = DHCPV4_OPTION_LENGTH (PXE_DISCOVER_OPTIONS);
- }
-
- DISCOVERoptions.Header.Length = OpLen;
-
- ((UINT8 *) &DISCOVERoptions)[sizeof (DHCPV4_OP_HEADER) + OpLen - 1] = OP_END;
- ((UINT8 *) &DISCOVERoptions)[sizeof (DHCPV4_OP_HEADER) + OpLen] = OP_END;
-
- StatCode = DoUdpWrite (
- Private,
- DestPtr,
- &ServerPort,
- (EFI_IP_ADDRESS *) &DHCPV4_TRANSMIT_BUFFER.ciaddr,
- &ClientPort
- );
-
- if (StatCode != EFI_SUCCESS) {
- return StatCode;
- }
- //
- //
- //
- StatCode = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &TimeoutEvent
- );
-
- if (EFI_ERROR (StatCode)) {
- return StatCode;
- }
-
- StatCode = gBS->SetTimer (
- TimeoutEvent,
- TimerRelative,
- Private->Timeout * 10000000 + 1000000
- );
-
- if (EFI_ERROR (StatCode)) {
- gBS->CloseEvent (TimeoutEvent);
- return StatCode;
- }
- //
- // wait for ACK
- //
- for (;;) {
- DHCP_RECEIVE_BUFFER *RxBufPtr;
- UINT16 TmpType;
- UINT16 TmpLayer;
-
- RxBufPtr = UseBis ? &PXE_BIS_BUFFER : &PXE_ACK_BUFFER;
- ZeroMem (&Private->ServerIp, sizeof (EFI_IP_ADDRESS));
-
- if (GetOfferAck (
- Private,
- AckEdit,
- OpFlags,
- (EFI_IP_ADDRESS *) &Private->ServerIp,
- 0,
- (EFI_IP_ADDRESS *) &DHCPV4_TRANSMIT_BUFFER.ciaddr,
- &ClientPort,
- RxBufPtr,
- TimeoutEvent
- ) != EFI_SUCCESS) {
- break;
- }
- //
- // check type of response - need PXEClient DHCPACK of proper type with bootfile
- //
- if (!(RxBufPtr->OpAdds.Status & PXE_TYPE) ||
- (UseBis && (RxBufPtr->OpAdds.Status & USE_THREE_BYTE)) ||
- !RxBufPtr->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1] ||
- !RxBufPtr->OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1] ||
- !InServerList((EFI_IP_ADDRESS *)&((DHCPV4_OP_SERVER_IP *)RxBufPtr->OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX-1])->Ip, ServerListPtr)) {
-
- continue;
- }
-
- TmpType = TmpLayer = 0;
-
- if (RxBufPtr->OpAdds.PxeOptAdds[VEND_PXE_BOOT_ITEM_IX - 1]) {
- TmpType = NTOHS (((PXE_OP_BOOT_ITEM *) RxBufPtr->OpAdds.PxeOptAdds[VEND_PXE_BOOT_ITEM_IX - 1])->Type);
-
- if (RxBufPtr->OpAdds.Status & USE_THREE_BYTE) {
- TmpLayer = (UINT16) (((PXE_OP_BOOT_ITEM *) RxBufPtr->OpAdds.PxeOptAdds[VEND_PXE_BOOT_ITEM_IX - 1])->Layer >> 8);
- } else {
- TmpLayer = NTOHS (((PXE_OP_BOOT_ITEM *) RxBufPtr->OpAdds.PxeOptAdds[VEND_PXE_BOOT_ITEM_IX - 1])->Layer);
- }
- }
-
- if (TmpType != Type) {
- continue;
- }
-
- if (UseBis) {
- if (!RxBufPtr->OpAdds.PxeOptAdds[VEND_PXE_CREDENTIAL_TYPES_IX - 1]) {
- continue;
- }
-
- if (!VerifyCredentialOption (
- (UINT8 *) &DISCREDoptions.Header,
- (UINT8 *) RxBufPtr->OpAdds.PxeOptAdds[VEND_PXE_CREDENTIAL_TYPES_IX - 1]
- )) {
- continue;
- }
- }
-
- *LayerPtr = TmpLayer;
-
- if (UseBis) {
- CopyMem (
- &PxebcMode->PxeBisReply,
- &RxBufPtr->u.Dhcpv4,
- sizeof (EFI_PXE_BASE_CODE_PACKET)
- );
-
- PxebcMode->PxeBisReplyReceived = TRUE;
-
- StatCode = DoDiscover (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT,
- Type,
- LayerPtr,
- FALSE,
- &Private->ServerIp,
- 0
- );
-
- gBS->CloseEvent (TimeoutEvent);
- return StatCode;
- }
-
- PxebcMode->PxeDiscoverValid = PxebcMode->PxeReplyReceived = TRUE;
-
- CopyMem (
- &PxebcMode->PxeDiscover,
- &*(EFI_PXE_BASE_CODE_PACKET *) &DHCPV4_TRANSMIT_BUFFER,
- sizeof (*(EFI_PXE_BASE_CODE_PACKET *) &DHCPV4_TRANSMIT_BUFFER)
- );
-
- CopyMem (
- &PxebcMode->PxeReply,
- &*(EFI_PXE_BASE_CODE_PACKET *) &RxBufPtr->u.Dhcpv4,
- sizeof (*(EFI_PXE_BASE_CODE_PACKET *) &RxBufPtr->u.Dhcpv4)
- );
-
- AddRouters (Private, RxBufPtr);
-
- gBS->CloseEvent (TimeoutEvent);
- return EFI_SUCCESS;
- }
-
- gBS->CloseEvent (TimeoutEvent);
- }
- //
- // end for loop
- //
- return EFI_TIMEOUT;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-Discover (
- PXE_BASECODE_DEVICE *Private,
- IN UINT16 Type,
- IN UINT16 *LayerPtr,
- IN BOOLEAN UseBis,
- IN EFI_PXE_BASE_CODE_DISCOVER_INFO *DiscoverInfoPtr,
- PXE_SERVER_LISTS *McastServerListPtr,
- PXE_SERVER_LISTS *ServerListPtr
- )
-/*++
-Routine Description:
-
-Parameters:
- Private := Pointer to PxeBc interface
- Type :=
- LayerPtr :=
- UseBis :=
- DiscoverInfoPtr :=
- McastServerListPtr :=
- ServerListPtr :=
-
-Returns:
---*/
-{
- EFI_IP_ADDRESS DestIp;
- EFI_STATUS StatCode;
-
- DEBUG ((EFI_D_INFO, "\nDiscover() Type=%d Layer=%d ", Type, *LayerPtr));
-
- if (UseBis) {
- DEBUG ((EFI_D_INFO, "BIS "));
- }
- //
- // get dest IP addr - mcast, bcast, or unicast
- //
- if (DiscoverInfoPtr->UseMCast) {
- DestIp.v4 = DiscoverInfoPtr->ServerMCastIp.v4;
-
- DEBUG (
- (EFI_D_INFO,
- "\nDiscover() MCast %d.%d.%d.%d ",
- DestIp.v4.Addr[0],
- DestIp.v4.Addr[1],
- DestIp.v4.Addr[2],
- DestIp.v4.Addr[3])
- );
-
- if ((StatCode = DoDiscover (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP | EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT,
- Type,
- LayerPtr,
- UseBis,
- &DestIp,
- McastServerListPtr
- )) != EFI_TIMEOUT) {
- DEBUG (
- (EFI_D_WARN,
- "\nDiscover() status == %r (%Xh)",
- StatCode,
- StatCode)
- );
-
- return StatCode;
- }
- }
-
- if (DiscoverInfoPtr->UseBCast) {
- DEBUG ((EFI_D_INFO, "\nDiscver() BCast "));
-
- if ((StatCode = DoDiscover (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP | EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT,
- Type,
- LayerPtr,
- UseBis,
- &BroadcastIP,
- McastServerListPtr
- )) != EFI_TIMEOUT) {
-
- DEBUG ((EFI_D_WARN, "\nDiscover() status == %r (%Xh)", StatCode, StatCode));
-
- return StatCode;
- }
- }
-
- if (DiscoverInfoPtr->UseUCast) {
- UINTN Index;
-
- DEBUG (
- (EFI_D_INFO,
- "\nDiscover() UCast IP#=%d ",
- ServerListPtr->Ipv4List.IpCount)
- );
-
- for (Index = 0; Index < ServerListPtr->Ipv4List.IpCount; ++Index) {
- CopyMem (&DestIp, &ServerListPtr->Ipv4List.IpList[Index], 4);
-
- DEBUG (
- (EFI_D_INFO,
- "\nDiscover() UCast %d.%d.%d.%d ",
- DestIp.v4.Addr[0],
- DestIp.v4.Addr[1],
- DestIp.v4.Addr[2],
- DestIp.v4.Addr[3])
- );
-
- if ((StatCode = DoDiscover (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP | EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT,
- Type,
- LayerPtr,
- UseBis,
- &DestIp,
- 0
- )) != EFI_TIMEOUT) {
- DEBUG (
- (EFI_D_WARN,
- "\nDiscover() status == %r (%Xh)",
- StatCode,
- StatCode)
- );
-
- return StatCode;
- }
- }
- }
-
- DEBUG ((EFI_D_WARN, "\nDiscover() TIMEOUT"));
-
- return EFI_TIMEOUT;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-/* BcDiscover()
- */
-EFI_STATUS
-EFIAPI
-BcDiscover (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN UINT16 Type,
- IN UINT16 *LayerPtr,
- IN BOOLEAN UseBis,
- IN EFI_PXE_BASE_CODE_DISCOVER_INFO * DiscoverInfoPtr OPTIONAL
- )
-/*++
-Routine description:
-
-Parameters:
- This :=
- Type :=
- LayerPtr :=
- UseBis :=
- DiscoverInfoPtr :=
-
-Returns:
---*/
-{
- EFI_PXE_BASE_CODE_DISCOVER_INFO DefaultInfo;
- EFI_PXE_BASE_CODE_MODE *PxebcMode;
- DHCP_RECEIVE_BUFFER *DhcpRxBuf;
- PXE_SERVER_LISTS DefaultSrvList;
- PXE_SERVER_LISTS *ServerListPtr;
- PXE_SERVER_LISTS *McastServerListPtr;
- UNION_PTR LocalPtr;
- UINTN Index;
- UINTN Index2;
- BOOLEAN AcquiredSrvList;
- EFI_STATUS StatCode;
- PXE_BASECODE_DEVICE *Private;
-
- //
- // Lock the instance data and make sure started
- //
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE poiner == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- if (This->Mode == NULL || !This->Mode->Started) {
- DEBUG ((EFI_D_ERROR, "BC was not started."));
- EfiReleaseLock (&Private->Lock);
- return EFI_NOT_STARTED;
- }
-
- ServerListPtr = NULL;
- McastServerListPtr = NULL;
- AcquiredSrvList = FALSE;
-
- PxebcMode = Private->EfiBc.Mode;
-
- if (!GetMem (Private)) {
- EfiReleaseLock (&Private->Lock);
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (UseBis) {
- if (!PxebcMode->BisSupported) {
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
- }
-
- Private->Function = EFI_PXE_BASE_CODE_FUNCTION_DISCOVER;
-
- if (Private->TotalSeconds == 0) {
- //
- // put in seconds field of DHCP send packets
- //
- Private->TotalSeconds = 4;
- }
-
- ZeroMem (&DefaultInfo, sizeof (EFI_PXE_BASE_CODE_DISCOVER_INFO));
-
- //
- // if layer number not zero, use previous discover
- //
- if (*LayerPtr != 0) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() layer != 0"));
-
- if (DiscoverInfoPtr != NULL) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() layer != 0 && DiscoverInfoPtr != NULL\n"));
-
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
-
- if (!PxebcMode->PxeDiscoverValid) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() layer != 0 && PxeDiscoverValid == 0\n"));
-
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
-
- if (!PxebcMode->PxeReplyReceived) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() layer != 0 && PxeReplyReceived == 0\n"));
-
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
-
- if (UseBis && !PxebcMode->PxeBisReplyReceived) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() layer != 0 && PxeBisReplyReceived == 0\n"));
-
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
-
- DefaultInfo.UseUCast = TRUE;
- DiscoverInfoPtr = &DefaultInfo;
-
- DefaultSrvList.Ipv4List.IpCount = 1;
- CopyMem (&DefaultSrvList.Ipv4List.IpList[0], &Private->ServerIp, 4);
-
- ServerListPtr = &DefaultSrvList;
- }
- //
- // layer is zero - see if info is supplied or if we need to use info from a cached offer
- //
- else if (!DiscoverInfoPtr) {
- //
- // not supplied - generate it
- // make sure that there is cached, appropriate information
- // if neither DhcpAck packet nor ProxyOffer packet has pxe info, fail
- //
- DhcpRxBuf = (PxebcMode->ProxyOfferReceived) ? &PXE_OFFER_BUFFER : &DHCPV4_ACK_BUFFER;
-
- if (!PxebcMode->DhcpAckReceived || !(DhcpRxBuf->OpAdds.Status & DISCOVER_TYPE)) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() !ack && !proxy"));
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
-
- DiscoverInfoPtr = &DefaultInfo;
-
- LocalPtr.OpPtr = DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_DISCOVERY_CONTROL_IX - 1];
-
- //
- // if multicast enabled, need multicast address
- //
- if (!(LocalPtr.DiscoveryControl->ControlBits & DISABLE_MCAST)) {
- DefaultInfo.UseMCast = TRUE;
-
- CopyMem (
- ((EFI_IPv4_ADDRESS *) &DefaultInfo.ServerMCastIp),
- &((DHCPV4_OP_IP_ADDRESS *) DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_DISCOVERY_MCAST_ADDR_IX - 1])->Ip,
- sizeof (EFI_IPv4_ADDRESS)
- );
- }
-
- DefaultInfo.UseBCast = (BOOLEAN) ((LocalPtr.DiscoveryControl->ControlBits & DISABLE_BCAST) == 0);
-
- DefaultInfo.MustUseList = (BOOLEAN) ((LocalPtr.DiscoveryControl->ControlBits & USE_ACCEPT_LIST) != 0);
-
- DefaultInfo.UseUCast = (BOOLEAN)
- (
- (DefaultInfo.MustUseList) ||
- ((LocalPtr.DiscoveryControl->ControlBits & (DISABLE_MCAST | DISABLE_BCAST)) == (DISABLE_MCAST | DISABLE_BCAST))
- );
-
- if ((DefaultInfo.UseUCast | DefaultInfo.MustUseList) && !ExtractBootServerList (
- Type,
- DhcpRxBuf->OpAdds.PxeOptAdds[VEND_PXE_BOOT_SERVERS_IX - 1],
- &ServerListPtr
- )) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() type not in list"));
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // Info supplied - make SrvList if required
- // if we use ucast discovery or must use list, there better be one
- //
- else if (DiscoverInfoPtr->UseUCast || DiscoverInfoPtr->MustUseList) {
- //
- // there better be a list
- //
- if (DiscoverInfoPtr->IpCnt == 0) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() no bootserver list"));
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
- //
- // get its size
- //
- for (Index = Index2 = 0; Index < DiscoverInfoPtr->IpCnt; ++Index) {
- if (DiscoverInfoPtr->SrvList[Index].Type == Type) {
- if (DiscoverInfoPtr->SrvList[Index].AcceptAnyResponse) {
- if (Index2 != 0) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() accept any?"));
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- } else {
- Index2 = 1;
- DefaultSrvList.Ipv4List.IpCount = 0;
- ServerListPtr = &DefaultSrvList;
- break;
- }
- } else {
- ++Index2;
- }
- }
- }
-
- if (Index2 == 0) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() !Index2?"));
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
-
- if (ServerListPtr == NULL) {
- ServerListPtr = AllocatePool (
- sizeof (PXEV4_SERVER_LIST) + (Index2 - 1) * sizeof (EFI_IPv4_ADDRESS)
- );
-
- if (ServerListPtr == NULL) {
- EfiReleaseLock (&Private->Lock);
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // build an array of IP addresses from the server list
- //
- AcquiredSrvList = TRUE;
- ServerListPtr->Ipv4List.IpCount = (UINT8) Index2;
-
- for (Index = Index2 = 0; Index < DiscoverInfoPtr->IpCnt; ++Index) {
- if (DiscoverInfoPtr->SrvList[Index].Type == Type) {
- CopyMem (
- &ServerListPtr->Ipv4List.IpList[Index2++],
- &DiscoverInfoPtr->SrvList[Index].IpAddr.v4,
- sizeof ServerListPtr->Ipv4List.IpList[0]
- );
- }
- }
- }
- }
-
- if (DiscoverInfoPtr->MustUseList) {
- McastServerListPtr = ServerListPtr;
- }
-
- if (!(DiscoverInfoPtr->UseMCast || DiscoverInfoPtr->UseBCast || DiscoverInfoPtr->UseUCast)) {
- DEBUG ((EFI_D_WARN, "\nBcDiscover() Nothing to use!\n"));
-
- EfiReleaseLock (&Private->Lock);
- return EFI_INVALID_PARAMETER;
- }
-
- PxebcMode->PxeDiscoverValid = PxebcMode->PxeReplyReceived = PxebcMode->PxeBisReplyReceived = FALSE;
-
- StatCode = Discover (
- Private,
- Type,
- LayerPtr,
- UseBis,
- DiscoverInfoPtr,
- McastServerListPtr,
- ServerListPtr
- );
-
- if (AcquiredSrvList) {
- FreePool (ServerListPtr);
- }
-
- FreeMem (Private);
-
- //
- // Unlock the instance data
- //
- DEBUG (
- (EFI_D_INFO,
- "\nBcDiscover() status == %r (%Xh)\n",
- StatCode,
- StatCode)
- );
-
- EfiReleaseLock (&Private->Lock);
- return StatCode;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-BcSetPackets (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- BOOLEAN *NewDhcpDiscoverValid, OPTIONAL
- BOOLEAN *NewDhcpAckReceived, OPTIONAL
- BOOLEAN *NewProxyOfferReceived, OPTIONAL
- BOOLEAN *NewPxeDiscoverValid, OPTIONAL
- BOOLEAN *NewPxeReplyReceived, OPTIONAL
- BOOLEAN *NewPxeBisReplyReceived, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewDhcpDiscover, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewDhcpAck, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewProxyOffer, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewPxeDiscover, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewPxeReply, OPTIONAL
- IN EFI_PXE_BASE_CODE_PACKET * NewPxeBisReply OPTIONAL
- )
-/*++
-Routine description:
-
-Parameters:
-
-Returns:
---*/
-{
- EFI_PXE_BASE_CODE_MODE *PxebcMode;
- PXE_BASECODE_DEVICE *Private;
-
- //
- // Lock the instance data and make sure started
- //
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE poiner == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- if (This->Mode == NULL || !This->Mode->Started) {
- DEBUG ((EFI_D_ERROR, "BC was not started."));
- EfiReleaseLock (&Private->Lock);
- return EFI_NOT_STARTED;
- }
-
- PxebcMode = Private->EfiBc.Mode;
-
- if (Private->DhcpPacketBuffer == NULL) {
- Private->DhcpPacketBuffer = AllocatePool (sizeof (DHCP_RECEIVE_BUFFER) * (PXE_BIS_INDEX + 1));
- if (Private->DhcpPacketBuffer == NULL) {
- EfiReleaseLock (&Private->Lock);
- return EFI_OUT_OF_RESOURCES;
- }
- }
- //
- // Issue BC command
- //
- //
- // reset
- //
- Private->FileSize = 0;
- if (NewDhcpDiscoverValid != NULL) {
- PxebcMode->DhcpDiscoverValid = *NewDhcpDiscoverValid;
- }
-
- if (NewDhcpAckReceived != NULL) {
- PxebcMode->DhcpAckReceived = *NewDhcpAckReceived;
- }
-
- if (NewProxyOfferReceived != NULL) {
- PxebcMode->ProxyOfferReceived = *NewProxyOfferReceived;
- }
-
- if (NewPxeDiscoverValid != NULL) {
- PxebcMode->PxeDiscoverValid = *NewPxeDiscoverValid;
- }
-
- if (NewPxeReplyReceived != NULL) {
- PxebcMode->PxeReplyReceived = *NewPxeReplyReceived;
- }
-
- if (NewPxeBisReplyReceived != NULL) {
- PxebcMode->PxeBisReplyReceived = *NewPxeBisReplyReceived;
- }
-
- if (NewDhcpDiscover != NULL) {
- CopyMem (
- &PxebcMode->DhcpDiscover,
- NewDhcpDiscover,
- sizeof *NewDhcpDiscover
- );
- }
-
- if (NewDhcpAck != NULL) {
- CopyParse (Private, &PxebcMode->DhcpAck, NewDhcpAck, DHCPV4_ACK_INDEX);
- }
-
- if (NewProxyOffer != NULL) {
- CopyParse (Private, &PxebcMode->ProxyOffer, NewProxyOffer, PXE_OFFER_INDEX);
- }
-
- if (NewPxeDiscover != NULL) {
- CopyMem (
- &PxebcMode->PxeDiscover,
- NewPxeDiscover,
- sizeof *NewPxeDiscover
- );
- }
-
- if (NewPxeReply != NULL) {
- CopyParse (Private, &PxebcMode->PxeReply, NewPxeReply, PXE_ACK_INDEX);
- }
-
- if (NewPxeBisReply != NULL) {
- CopyParse (Private, &PxebcMode->PxeBisReply, NewPxeBisReply, PXE_BIS_INDEX);
- }
- //
- // Unlock the instance data
- //
- EfiReleaseLock (&Private->Lock);
- return EFI_SUCCESS;
-}
-
-/* eof - pxe_bc_dhcp.c */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_igmp.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_igmp.c
deleted file mode 100644
index 22dcf25..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_igmp.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
---*/
-
-
-
-
-#define RAND_MAX 0x10000
-#include "Bc.h"
-
-//
-// Definitions for internet group management protocol version 2 message
-// structure Per RFC 2236, November 1997
-//
-STATIC UINT8 RouterAlertOption[4] = { 0x80 | 20, 4, 0, 0 };
-STATIC IPV4_ADDR AllRoutersGroup = { { 224, 0, 0, 2 } };
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-ClearGroupTimer (
- PXE_BASECODE_DEVICE *Private,
- UINTN TimerId
- )
-{
- if (Private == NULL) {
- return ;
- }
-
- if (TimerId >= Private->MCastGroupCount) {
- return ;
- }
-
- if (Private->IgmpGroupEvent[TimerId] == NULL) {
- return ;
- }
-
- gBS->CloseEvent (Private->IgmpGroupEvent[TimerId]);
- Private->IgmpGroupEvent[TimerId] = NULL;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-SetGroupTimer (
- PXE_BASECODE_DEVICE *Private,
- UINTN TimerId,
- UINTN MaxRespTime
- )
-/*++
-Routine description:
- Set IGMP response timeout value.
-
-Parameters:
- Private := Pointer to PxeBc interface
- TimerId := Timer ID#
- MaxRespTime := Base response timeout value in tenths of seconds
-
-Returns:
---*/
-{
- EFI_STATUS EfiStatus;
-
- if (Private == NULL) {
- return ;
- }
-
- if (TimerId >= Private->MCastGroupCount) {
- return ;
- }
-
- if (Private->IgmpGroupEvent[TimerId] != NULL) {
- gBS->CloseEvent (Private->IgmpGroupEvent[TimerId]);
- }
-
- EfiStatus = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &Private->IgmpGroupEvent[TimerId]
- );
-
- if (EFI_ERROR (EfiStatus)) {
- Private->IgmpGroupEvent[TimerId] = NULL;
- return ;
- }
-
- EfiStatus = gBS->SetTimer (
- Private->IgmpGroupEvent[TimerId],
- TimerRelative,
- MaxRespTime * 1000000 + Random (Private) % RAND_MAX
- );
-
- if (EFI_ERROR (EfiStatus)) {
- gBS->CloseEvent (Private->IgmpGroupEvent[TimerId]);
- Private->IgmpGroupEvent[TimerId] = NULL;
- }
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-SendIgmpMessage (
- PXE_BASECODE_DEVICE *Private,
- UINT8 Type,
- INTN GroupId
- )
-/*++
-Routine description:
- Send an IGMP message
-
-Parameters:
- Private := Pointer to PxeBc interface
- Type := Message type opcode
- GroupId := Group ID#
-
-Returns:
---*/
-{
- Private->IgmpMessage.Type = Type;
- Private->IgmpMessage.MaxRespTime = 0;
- Private->IgmpMessage.Checksum = 0;
- Private->IgmpMessage.GroupAddress = Private->MCastGroup[GroupId];
- Private->IgmpMessage.Checksum = IpChecksum (
- (UINT16 *) &Private->IgmpMessage,
- sizeof Private->IgmpMessage
- );
-
- Ipv4SendWOp (
- Private,
- 0,
- (UINT8 *) &Private->IgmpMessage,
- sizeof Private->IgmpMessage,
- PROT_IGMP,
- RouterAlertOption,
- sizeof RouterAlertOption,
- ((Type == IGMP_TYPE_LEAVE_GROUP) ? AllRoutersGroup.L : Private->IgmpMessage.GroupAddress),
- EFI_PXE_BASE_CODE_FUNCTION_IGMP
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-ReportIgmp (
- PXE_BASECODE_DEVICE *Private,
- INTN GroupId
- )
-/*++
-Routine description:
- Send an IGMP report message.
-
-Parameters:
- Private := Pointer to PxeBc interface
- GroupId := Group ID#
-
-Returns:
---*/
-{
- //
- // if version 1 querier, send v1 report
- //
- UINT8 Type;
-
- if (Private->Igmpv1TimeoutEvent != NULL) {
- if (!EFI_ERROR (gBS->CheckEvent (Private->Igmpv1TimeoutEvent))) {
- gBS->CloseEvent (Private->Igmpv1TimeoutEvent);
- Private->Igmpv1TimeoutEvent = NULL;
- Private->UseIgmpv1Reporting = TRUE;
- }
- }
-
- Type = (UINT8) (Private->UseIgmpv1Reporting ? IGMP_TYPE_V1REPORT : IGMP_TYPE_REPORT);
-
- SendIgmpMessage (Private, Type, GroupId);
- ClearGroupTimer (Private, GroupId);
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-IgmpCheckTimers (
- PXE_BASECODE_DEVICE *Private
- )
-/*++
-Routine description:
- Check IGMP timers and send reports for all groups that have expired.
-Parameters:
- Private := Pointer to PxeBc interface
-
-Returns:
---*/
-{
- UINTN GroupId;
-
- if (Private == NULL) {
- return ;
- }
-
- for (GroupId = 0; GroupId < Private->MCastGroupCount; ++GroupId) {
- if (Private->IgmpGroupEvent[GroupId] == NULL) {
- continue;
- }
-
- if (!EFI_ERROR (gBS->CheckEvent (Private->IgmpGroupEvent[GroupId]))) {
- //
- // send a report
- //
- ReportIgmp (Private, GroupId);
- }
- }
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-INTN
-FindMulticastGroup (
- PXE_BASECODE_DEVICE *Private,
- UINT32 GroupAddress
- )
-/*++
-Routine description:
- Fund group ID# (index).
-
-Parameters:
- Private := Pointer to PxeBc interface
- GroupAddress := Group multicast address
-
-Returns:
- 0 := Group not found
- other := Group ID#
---*/
-{
- UINTN GroupId;
-
- for (GroupId = 0; GroupId < Private->MCastGroupCount; ++GroupId) {
- if (Private->MCastGroup[GroupId] == GroupAddress) {
- return GroupId + 1;
- }
- }
-
- return 0;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-IgmpJoinGroup (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *GroupPtr
- )
-/*++
-Routine description:
- Join multicast group.
-
-Parameters:
- Private := Pointer to PxeBc interface
- GroupPtr := Pointer to group mutlicast IP address.
-
-Returns:
---*/
-{
- UINT32 Grp;
-
- Grp = *(UINT32 *) GroupPtr;
-
- //
- // see if we already have it or if we can't take anymore
- //
- if (FindMulticastGroup (Private, Grp) || Private->MCastGroupCount == MAX_MCAST_GROUPS) {
- return ;
- }
- //
- // add the group
- //
- Private->MCastGroup[Private->MCastGroupCount] = Grp;
-
- ReportIgmp (Private, Private->MCastGroupCount);
- //
- // send a report
- // so it will get sent again per RFC 2236
- //
- SetGroupTimer (
- Private,
- Private->MCastGroupCount++,
- UNSOLICITED_REPORT_INTERVAL * 10
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-IgmpLeaveGroup (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *GroupPtr
- )
-/*++
-Routine description:
- Leave multicast group.
-
-Parameters:
- Private := Pointer to PxeBc interface
- GroupPtr := Mutlicast group IP address.
-
-Returns:
---*/
-{
- UINT32 Grp;
- UINTN GroupId;
-
- Grp = *(UINT32 *) GroupPtr;
-
- //
- // if not in group, ignore
- //
- GroupId = FindMulticastGroup (Private, Grp);
-
- if (GroupId == 0) {
- return ;
- }
- //
- // if not v1 querrier, send leave group IGMP message
- //
- if (Private->Igmpv1TimeoutEvent != NULL) {
- if (!EFI_ERROR (gBS->CheckEvent (Private->Igmpv1TimeoutEvent))) {
- gBS->CloseEvent (Private->Igmpv1TimeoutEvent);
- Private->Igmpv1TimeoutEvent = NULL;
- Private->UseIgmpv1Reporting = TRUE;
- } else {
- SendIgmpMessage (Private, IGMP_TYPE_LEAVE_GROUP, GroupId - 1);
- }
- }
-
- while (GroupId < Private->MCastGroupCount) {
- Private->MCastGroup[GroupId - 1] = Private->MCastGroup[GroupId];
- Private->IgmpGroupEvent[GroupId - 1] = Private->IgmpGroupEvent[GroupId];
- ++GroupId;
- }
-
- --Private->MCastGroupCount;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-HandleIgmp (
- PXE_BASECODE_DEVICE *Private,
- IGMPV2_MESSAGE *IgmpMessagePtr,
- UINTN IgmpLength
- )
-/*++
-Routine description:
- Handle received IGMP packet
-
-Parameters:
- Private := Pointer to PxeBc interface
- IgmpMessagePtr := Pointer to IGMP packet
- IgmpLength := packet length in bytes
-
-Returns:
---*/
-{
- EFI_STATUS EfiStatus;
- UINTN GroupId;
- INTN MaxRespTime;
-
- if (Private == NULL) {
- return ;
- }
-
- if (Private->MCastGroupCount == 0) {
- //
- // if we don't belong to any multicast groups, ignore
- //
- return ;
- }
- //
- // verify checksum
- //
- if (IpChecksum ((UINT16 *) IgmpMessagePtr, IgmpLength)) {
- //
- // bad checksum - ignore packet
- //
- return ;
- }
-
- switch (IgmpMessagePtr->Type) {
- case IGMP_TYPE_QUERY:
- //
- // if a version 1 querier, note the fact and set max resp time
- //
- MaxRespTime = IgmpMessagePtr->MaxRespTime;
-
- if (MaxRespTime == 0) {
- Private->UseIgmpv1Reporting = TRUE;
-
- if (Private->Igmpv1TimeoutEvent != NULL) {
- gBS->CloseEvent (Private->Igmpv1TimeoutEvent);
- }
-
- EfiStatus = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &Private->Igmpv1TimeoutEvent
- );
-
- if (EFI_ERROR (EfiStatus)) {
- Private->Igmpv1TimeoutEvent = NULL;
- } else {
- EfiStatus = gBS->SetTimer (
- Private->Igmpv1TimeoutEvent,
- TimerRelative,
- (UINT64) V1ROUTER_PRESENT_TIMEOUT * 10000000
- );
- }
-
- MaxRespTime = IGMP_DEFAULT_MAX_RESPONSE_TIME * 10;
- }
- //
- // if a general query (!GroupAddress), set all our group timers
- //
- if (!IgmpMessagePtr->GroupAddress) {
- for (GroupId = 0; GroupId < Private->MCastGroupCount; ++GroupId) {
- SetGroupTimer (Private, GroupId, MaxRespTime);
- }
- } else {
- //
- // specific query - set only specific group
- //
- GroupId = FindMulticastGroup (Private, IgmpMessagePtr->GroupAddress);
-
- if (GroupId != 0) {
- SetGroupTimer (Private, GroupId - 1, MaxRespTime);
- }
- }
-
- break;
-
- //
- // if we have a timer running for this group, clear it
- //
- case IGMP_TYPE_V1REPORT:
- case IGMP_TYPE_REPORT:
- GroupId = FindMulticastGroup (Private, IgmpMessagePtr->GroupAddress);
-
- if (GroupId != 0) {
- ClearGroupTimer (Private, GroupId - 1);
- }
-
- break;
- }
-}
-
-/* EOF - pxe_bc_igmp.c */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_ip.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_ip.c
deleted file mode 100644
index bf60d51..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_ip.c
+++ /dev/null
@@ -1,853 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- pxe_bc_ip.c
-
-Abstract:
-
---*/
-
-
-#include "Bc.h"
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-BOOLEAN
-OnSameSubnet (
- IN UINTN IpLength,
- IN EFI_IP_ADDRESS *Ip1,
- IN EFI_IP_ADDRESS *Ip2,
- IN EFI_IP_ADDRESS *SubnetMask
- )
-/*++
-
- Routine Description:
- Check if two IP addresses are on the same subnet.
-
- Arguments:
- IpLength - Length of IP address in bytes.
- Ip1 - IP address to check.
- Ip2 - IP address to check.
- SubnetMask - Subnet mask to check with.
-
- Returns:
- TRUE - IP addresses are on the same subnet.
- FALSE - IP addresses are on different subnets.
-
---*/
-{
- if (IpLength == 0 || Ip1 == NULL || Ip2 == NULL || SubnetMask == NULL) {
- return FALSE;
- }
-
- while (IpLength-- != 0) {
- if ((Ip1->v6.Addr[IpLength] ^ Ip2->v6.Addr[IpLength]) & SubnetMask->v6.Addr[IpLength]) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-IpAddRouter (
- IN PXE_BASECODE_DEVICE *Private,
- IN EFI_IP_ADDRESS *RouterIpPtr
- )
-/*++
-
- Routine Description:
- Add router to router table.
-
- Arguments:
- Private - Pointer PxeBc instance data.
- RouterIpPtr - Pointer to router IP address.
-
- Returns:
- Nothing
-
---*/
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- UINTN Index;
-
- if (Private == NULL || RouterIpPtr == NULL) {
- return ;
- }
-
- PxeBcMode = Private->EfiBc.Mode;
-
- //
- // if we are filled up or this is not on the same subnet, forget it
- //
- if ((PxeBcMode->RouteTableEntries == PXE_ROUTER_TABLE_SIZE) ||
- !OnSameSubnet(Private->IpLength, &PxeBcMode->StationIp, RouterIpPtr, &PxeBcMode->SubnetMask)) {
- return ;
- }
- //
- // make sure we don't already have it
- //
- for (Index = 0; Index < PxeBcMode->RouteTableEntries; ++Index) {
- if (!CompareMem (
- &PxeBcMode->RouteTable[Index].GwAddr,
- RouterIpPtr,
- Private->IpLength
- )) {
- return ;
- }
- }
- //
- // keep it
- //
- ZeroMem (
- &PxeBcMode->RouteTable[PxeBcMode->RouteTableEntries],
- sizeof (EFI_PXE_BASE_CODE_ROUTE_ENTRY)
- );
-
- CopyMem (
- &PxeBcMode->RouteTable[PxeBcMode->RouteTableEntries++].GwAddr,
- RouterIpPtr,
- Private->IpLength
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// return router ip to use for DestIp (0 if none)
-//
-STATIC
-EFI_IP_ADDRESS *
-GetRouterIp (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *DestIpPtr
- )
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- UINTN Index;
-
- if (Private == NULL || DestIpPtr == NULL) {
- return NULL;
- }
-
- PxeBcMode = Private->EfiBc.Mode;
-
- for (Index = 0; Index < PxeBcMode->RouteTableEntries; ++Index) {
- if (OnSameSubnet (
- Private->IpLength,
- &PxeBcMode->RouteTable[Index].IpAddr,
- DestIpPtr,
- &PxeBcMode->RouteTable[Index].SubnetMask
- )) {
- return &PxeBcMode->RouteTable[Index].GwAddr;
- }
- }
-
- return NULL;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// routine to send ipv4 packet
-// ipv4 header of length HdrLth in TransmitBufferPtr
-// routine fills in ipv4hdr Ver_Hdl, TotalLength, and Checksum, moves in Data
-// and gets dest MAC address
-//
-#define IP_TX_BUFFER ((IPV4_BUFFER *) Private->TransmitBufferPtr)
-#define IP_TX_HEADER IP_TX_BUFFER->IpHeader
-
-EFI_STATUS
-Ipv4Xmt (
- PXE_BASECODE_DEVICE *Private,
- UINT32 GatewayIp,
- UINTN IpHeaderLength,
- UINTN TotalHeaderLength,
- VOID *Data,
- UINTN DataLength,
- EFI_PXE_BASE_CODE_FUNCTION Function
- )
-{
- EFI_MAC_ADDRESS DestMac;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- EFI_STATUS StatCode;
- UINTN PacketLength;
-
- Snp = Private->SimpleNetwork;
- PxeBcMode = Private->EfiBc.Mode;
- StatCode = EFI_SUCCESS;
- PacketLength = TotalHeaderLength + DataLength;
-
- //
- // get dest MAC address
- // multicast - convert to hw equiv
- // unicast on same net, use arp
- // on different net, arp for router
- //
- if (IP_TX_HEADER.DestAddr.L == BROADCAST_IPv4) {
- CopyMem (&DestMac, &Snp->Mode->BroadcastAddress, sizeof (DestMac));
- } else if (IS_MULTICAST (&IP_TX_HEADER.DestAddr)) {
- StatCode = (*Snp->MCastIpToMac) (Snp, PxeBcMode->UsingIpv6, (EFI_IP_ADDRESS *) &IP_TX_HEADER.DestAddr, &DestMac);
- } else {
- UINT32 Ip;
-
- if (OnSameSubnet (
- Private->IpLength,
- &PxeBcMode->StationIp,
- (EFI_IP_ADDRESS *) &IP_TX_HEADER.DestAddr,
- &PxeBcMode->SubnetMask
- )) {
- Ip = IP_TX_HEADER.DestAddr.L;
- } else if (GatewayIp != 0) {
- Ip = GatewayIp;
- } else {
- EFI_IP_ADDRESS *TmpIp;
-
- TmpIp = GetRouterIp (Private, (EFI_IP_ADDRESS *) &IP_TX_HEADER.DestAddr);
-
- if (TmpIp == NULL) {
- DEBUG (
- (EFI_D_WARN,
- "\nIpv4Xmit() Exit #1 %xh (%r)",
- EFI_NO_RESPONSE,
- EFI_NO_RESPONSE)
- );
-
- return EFI_NO_RESPONSE;
- //
- // no router
- //
- }
-
- Ip = TmpIp->Addr[0];
- }
-
- if (!GetHwAddr (
- Private,
- (EFI_IP_ADDRESS *) &Ip,
- (EFI_MAC_ADDRESS *) &DestMac
- )) {
- if (!PxeBcMode->AutoArp) {
- DEBUG (
- (EFI_D_WARN,
- "\nIpv4Xmit() Exit #2 %xh (%r)",
- EFI_DEVICE_ERROR,
- EFI_DEVICE_ERROR)
- );
-
- return EFI_DEVICE_ERROR;
- } else {
- StatCode = DoArp (
- Private,
- (EFI_IP_ADDRESS *) &Ip,
- (EFI_MAC_ADDRESS *) &DestMac
- );
- }
- }
- }
-
- if (EFI_ERROR (StatCode)) {
- DEBUG ((EFI_D_WARN, "\nIpv4Xmit() Exit #3 %xh (%r)", StatCode, StatCode));
- return StatCode;
- }
- //
- // fill in packet info
- //
- SET_IPV4_VER_HDL (&IP_TX_HEADER, IpHeaderLength);
- IP_TX_HEADER.TotalLength = HTONS (PacketLength);
- IP_TX_HEADER.HeaderChecksum = IpChecksum ((UINT16 *) &IP_TX_HEADER, IpHeaderLength);
- CopyMem (((UINT8 *) &IP_TX_HEADER) + TotalHeaderLength, Data, DataLength);
-
- //
- // send it
- //
- return SendPacket (
- Private,
- (UINT8 *) &IP_TX_HEADER - Snp->Mode->MediaHeaderSize,
- &IP_TX_HEADER,
- PacketLength,
- &DestMac,
- PXE_PROTOCOL_ETHERNET_IP,
- Function
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// send ipv4 packet with option
-//
-EFI_STATUS
-Ipv4SendWOp (
- PXE_BASECODE_DEVICE *Private,
- UINT32 GatewayIp,
- UINT8 *Msg,
- UINTN MessageLength,
- UINT8 Prot,
- UINT8 *Option,
- UINTN OptionLength,
- UINT32 DestIp,
- EFI_PXE_BASE_CODE_FUNCTION Function
- )
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- UINTN HdrLth;
-
- PxeBcMode = Private->EfiBc.Mode;
- HdrLth = sizeof (IPV4_HEADER) + OptionLength;
-
- ZeroMem ((VOID *) &IP_TX_HEADER, sizeof (IPV4_HEADER));
- IP_TX_HEADER.TimeToLive = PxeBcMode->TTL;
- IP_TX_HEADER.TypeOfService = PxeBcMode->ToS;
- IP_TX_HEADER.Protocol = Prot;
- IP_TX_HEADER.SrcAddr.L = *(UINT32 *) &PxeBcMode->StationIp;
- IP_TX_HEADER.DestAddr.L = DestIp;
- IP_TX_HEADER.Id = Random (Private);
- CopyMem (IP_TX_BUFFER->u.Data, Option, OptionLength);
- return Ipv4Xmt (
- Private,
- GatewayIp,
- HdrLth,
- HdrLth,
- Msg,
- MessageLength,
- Function
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// send MessageLength message at MessagePtr - higher level protocol header already in TransmitBufferPtr, length HdrSize
-//
-EFI_STATUS
-Ip4Send (
- PXE_BASECODE_DEVICE *Private, // pointer to instance data
- UINTN MayFrag, //
- UINT8 Prot, // protocol
- UINT32 SrcIp, // Source IP address
- UINT32 DestIp, // Destination IP address
- UINT32 GatewayIp, // used if not NULL and needed
- UINTN HdrSize, // protocol header byte length
- UINT8 *MessagePtr, // pointer to data
- UINTN MessageLength // data byte length
- )
-{
- EFI_STATUS StatCode;
- UINTN TotDataLength;
-
- TotDataLength = HdrSize + MessageLength;
-
- if (TotDataLength > MAX_IPV4_DATA_SIZE) {
- DEBUG (
- (EFI_D_WARN,
- "\nIp4Send() Exit #1 %xh (%r)",
- EFI_BAD_BUFFER_SIZE,
- EFI_BAD_BUFFER_SIZE)
- );
-
- return EFI_BAD_BUFFER_SIZE;
- }
-
- ZeroMem ((VOID *) &IP_TX_HEADER, sizeof (IPV4_HEADER));
- IP_TX_HEADER.TimeToLive = DEFAULT_TTL;
- IP_TX_HEADER.Protocol = Prot;
- IP_TX_HEADER.SrcAddr.L = SrcIp;
- IP_TX_HEADER.DestAddr.L = DestIp;
- IP_TX_HEADER.Id = Random (Private);
-
- if (!MayFrag) {
- *(UINT8 *) (&IP_TX_HEADER.FragmentFields) = IP_NO_FRAG >> 8;
- }
- //
- // check for need to fragment
- //
- if (TotDataLength > MAX_IPV4_FRAME_DATA_SIZE) {
- UINTN DataLengthSent;
- UINT16 FragmentOffset;
-
- FragmentOffset = IP_MORE_FRAG;
- //
- // frag offset field
- //
- if (!MayFrag) {
- DEBUG (
- (EFI_D_WARN,
- "\nIp4Send() Exit #2 %xh (%r)",
- EFI_BAD_BUFFER_SIZE,
- EFI_BAD_BUFFER_SIZE)
- );
-
- return EFI_BAD_BUFFER_SIZE;
- }
- //
- // send out in fragments - first includes upper level header
- // all are max and include more frag bit except last
- //
- * (UINT8 *) (&IP_TX_HEADER.FragmentFields) = IP_MORE_FRAG >> 8;
-
-#define IPV4_FRAG_SIZE (MAX_IPV4_FRAME_DATA_SIZE & 0xfff8)
-#define IPV4_FRAG_OFF_INC (IPV4_FRAG_SIZE >> 3)
-
- DataLengthSent = IPV4_FRAG_SIZE - HdrSize;
-
- StatCode = Ipv4Xmt (
- Private,
- GatewayIp,
- sizeof (IPV4_HEADER),
- sizeof (IPV4_HEADER) + HdrSize,
- MessagePtr,
- DataLengthSent,
- Private->Function
- );
-
- if (EFI_ERROR (StatCode)) {
- DEBUG (
- (EFI_D_WARN,
- "\nIp4Send() Exit #3 %xh (%r)",
- StatCode,
- StatCode)
- );
-
- return StatCode;
- }
-
- MessagePtr += DataLengthSent;
- MessageLength -= DataLengthSent;
- FragmentOffset += IPV4_FRAG_OFF_INC;
- IP_TX_HEADER.FragmentFields = HTONS (FragmentOffset);
-
- while (MessageLength > IPV4_FRAG_SIZE) {
- StatCode = Ipv4Xmt (
- Private,
- GatewayIp,
- sizeof (IPV4_HEADER),
- sizeof (IPV4_HEADER),
- MessagePtr,
- IPV4_FRAG_SIZE,
- Private->Function
- );
-
- if (EFI_ERROR (StatCode)) {
- DEBUG (
- (EFI_D_WARN,
- "\nIp4Send() Exit #3 %xh (%r)",
- StatCode,
- StatCode)
- );
-
- return StatCode;
- }
-
- MessagePtr += IPV4_FRAG_SIZE;
- MessageLength -= IPV4_FRAG_SIZE;
- FragmentOffset += IPV4_FRAG_OFF_INC;
- IP_TX_HEADER.FragmentFields = HTONS (FragmentOffset);
- }
-
- * (UINT8 *) (&IP_TX_HEADER.FragmentFields) &= ~(IP_MORE_FRAG >> 8);
- HdrSize = 0;
- }
- //
- // transmit
- //
- return Ipv4Xmt (
- Private,
- GatewayIp,
- sizeof (IPV4_HEADER),
- sizeof (IPV4_HEADER) + HdrSize,
- MessagePtr,
- MessageLength,
- Private->Function
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// return true if dst IP in receive header matched with what's enabled
-//
-STATIC
-BOOLEAN
-IPgood (
- PXE_BASECODE_DEVICE *Private,
- IPV4_HEADER *IpHeader
- )
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- UINTN Index;
-
- PxeBcMode = Private->EfiBc.Mode;
-
- if (PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS) {
- return TRUE;
- }
-
- if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST) &&
- IS_MULTICAST (&IpHeader->DestAddr)
- ) {
- return TRUE;
- }
-
- if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP) &&
- PxeBcMode->StationIp.Addr[0] == IpHeader->DestAddr.L
- ) {
- return TRUE;
- }
-
- if ((PxeBcMode->IpFilter.Filters & EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST) && IpHeader->DestAddr.L == BROADCAST_IPv4) {
- return TRUE;
- }
-
- for (Index = 0; Index < PxeBcMode->IpFilter.IpCnt; ++Index) {
- if (IpHeader->DestAddr.L == PxeBcMode->IpFilter.IpList[Index].Addr[0]) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// receive up to MessageLength message into MessagePtr for protocol Prot
-// return message length, src/dest ips if select any, and pointer to protocol
-// header routine will filter based on source and/or dest ip if OpFlags set.
-//
-EFI_STATUS
-IpReceive (
- PXE_BASECODE_DEVICE *Private,
- PXE_OPFLAGS OpFlags,
- EFI_IP_ADDRESS *SrcIpPtr,
- EFI_IP_ADDRESS *DestIpPtr,
- UINT8 Prot,
- VOID *HeaderPtr,
- UINTN HdrSize,
- UINT8 *MessagePtr,
- UINTN *MessageLengthPtr,
- EFI_EVENT TimeoutEvent
- )
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- EFI_STATUS StatCode;
- UINTN ByteCount;
- UINTN FragmentCount;
- UINTN ExpectedPacketLength;
- UINTN Id;
- BOOLEAN GotFirstFragment;
- BOOLEAN GotLastFragment;
-
- DEBUG (
- (EFI_D_NET,
- "\nIpReceive() Hdr=%Xh HdrSz=%d Data=%Xh DataSz=%d",
- HeaderPtr,
- HdrSize,
- MessagePtr,
- *MessageLengthPtr)
- );
-
- PxeBcMode = Private->EfiBc.Mode;
- PxeBcMode->IcmpErrorReceived = FALSE;
-
- ExpectedPacketLength = 0;
- GotFirstFragment = FALSE;
- GotLastFragment = FALSE;
- FragmentCount = 0;
- ByteCount = 0;
- Id = 0;
-
- for (;;) {
- IPV4_HEADER IpHdr;
- UINTN FFlds;
- UINTN TotalLength;
- UINTN FragmentOffset;
- UINTN HeaderSize;
- UINTN BufferSize;
- UINTN IpHeaderLength;
- UINTN DataLength;
- UINT16 Protocol;
- UINT8 *NextHdrPtr;
- UINT8 *PacketPtr;
-
- StatCode = WaitForReceive (
- Private,
- Private->Function,
- TimeoutEvent,
- &HeaderSize,
- &BufferSize,
- &Protocol
- );
-
- if (EFI_ERROR (StatCode)) {
- return StatCode;
- }
-
- PacketPtr = Private->ReceiveBufferPtr + HeaderSize;
-
- if (Protocol == PXE_PROTOCOL_ETHERNET_ARP) {
- HandleArpReceive (
- Private,
- (ARP_PACKET *) PacketPtr,
- Private->ReceiveBufferPtr
- );
-
- continue;
- }
-
- if (Protocol != PXE_PROTOCOL_ETHERNET_IP) {
- continue;
- }
-
-#define IpRxHeader ((IPV4_HEADER *) PacketPtr)
-
- //
- // filter for version & check sum
- //
- IpHeaderLength = IPV4_HEADER_LENGTH (IpRxHeader);
-
- if ((IpRxHeader->VersionIhl >> 4) != IPVER4) {
- continue;
- }
-
- if (IpChecksum ((UINT16 *) IpRxHeader, IpHeaderLength)) {
- continue;
- }
-
- CopyMem (&IpHdr, IpRxHeader, sizeof (IpHdr));
- //IpHdr = *IpRxHeader;
- TotalLength = NTOHS (IpHdr.TotalLength);
-
- if (IpHdr.Protocol == PROT_TCP) {
- //
- // The NextHdrPtr is used to seed the header buffer we are passing back.
- // That being the case, we want to see everything in pPkt which contains
- // everything but the ethernet (or whatever) frame. IP + TCP in this case.
- //
- DataLength = TotalLength;
- NextHdrPtr = PacketPtr;
- } else {
- DataLength = TotalLength - IpHeaderLength;
- NextHdrPtr = PacketPtr + IpHeaderLength;
- }
- //
- // If this is an ICMP, it might not be for us.
- // Double check the state of the IP stack and the
- // packet fields before assuming it is an ICMP
- // error. ICMP requests are not supported by the
- // PxeBc IP stack and should be ignored.
- //
- if (IpHdr.Protocol == PROT_ICMP) {
- ICMPV4_HEADER *Icmpv4;
-
- Icmpv4 = (ICMPV4_HEADER *) NextHdrPtr;
-
- //
- // For now only obvious ICMP error replies will be accepted by
- // this stack. This still makes us vulnerable to DoS attacks.
- // But at least we will not be killed by DHCP daemons.
- //
- switch (Icmpv4->Type) {
- case ICMP_REDIRECT:
- case ICMP_ECHO:
- case ICMP_ROUTER_ADV:
- case ICMP_ROUTER_SOLICIT:
- case ICMP_TIMESTAMP:
- case ICMP_TIMESTAMP_REPLY:
- case ICMP_INFO_REQ:
- case ICMP_INFO_REQ_REPLY:
- case ICMP_SUBNET_MASK_REQ:
- case ICMP_SUBNET_MASK_REPLY:
- default:
- continue;
-
- //
- // %%TBD - This should be implemented.
- //
- case ICMP_ECHO_REPLY:
- continue;
-
- case ICMP_DEST_UNREACHABLE:
- case ICMP_TIME_EXCEEDED:
- case ICMP_PARAMETER_PROBLEM:
- case ICMP_SOURCE_QUENCH:
- PxeBcMode->IcmpErrorReceived = TRUE;
-
- CopyMem (
- &PxeBcMode->IcmpError,
- NextHdrPtr,
- sizeof (EFI_PXE_BASE_CODE_ICMP_ERROR)
- );
-
- DEBUG (
- (EFI_D_NET,
- "\nIpReceive() Exit #1 %Xh (%r)",
- EFI_ICMP_ERROR,
- EFI_ICMP_ERROR)
- );
- }
-
- return EFI_ICMP_ERROR;
- }
-
- if (IpHdr.Protocol == PROT_IGMP) {
- HandleIgmp (Private, (IGMPV2_MESSAGE *) NextHdrPtr, DataLength);
-
- DEBUG ((EFI_D_NET, "\n IGMP"));
- continue;
- }
- //
- // check for protocol
- //
- if (IpHdr.Protocol != Prot) {
- continue;
- }
- //
- // do filtering
- //
- if (!(OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP) && SrcIpPtr && SrcIpPtr->Addr[0] != IpHdr.SrcAddr.L) {
- DEBUG ((EFI_D_NET, "\n Not expected source IP address."));
- continue;
- }
-
- if (OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER) {
- if (!IPgood (Private, &IpHdr)) {
- continue;
- }
- } else if (!(OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP)) {
- if (DestIpPtr == NULL) {
- if (PxeBcMode->StationIp.Addr[0] != IpHdr.DestAddr.L) {
- continue;
- }
- } else if (DestIpPtr->Addr[0] != IpHdr.DestAddr.L) {
- continue;
- }
- }
- //
- // get some data we need
- //
- FFlds = NTOHS (IpHdr.FragmentFields);
- FragmentOffset = ((FFlds & IP_FRAG_OFF_MSK) << 3);
-
- /* Keep count of fragments that belong to this session.
- * If we get packets with a different IP ID number,
- * ignore them. Ignored packets should be handled
- * by the upper level protocol.
- */
- if (FragmentCount == 0) {
- Id = IpHdr.Id;
-
- if (DestIpPtr != NULL) {
- DestIpPtr->Addr[0] = IpHdr.DestAddr.L;
- }
-
- if (SrcIpPtr != NULL) {
- SrcIpPtr->Addr[0] = IpHdr.SrcAddr.L;
- }
- } else {
- if (IpHdr.Id != Id) {
- continue;
- }
- }
-
- ++FragmentCount;
-
- /* Fragment management.
- */
- if (FragmentOffset == 0) {
- /* This is the first fragment (may also be the
- * only fragment).
- */
- GotFirstFragment = TRUE;
-
- /* If there is a separate protocol header buffer,
- * copy the header, adjust the data pointer and
- * the data length.
- */
- if (HdrSize != 0) {
- CopyMem (HeaderPtr, NextHdrPtr, HdrSize);
-
- NextHdrPtr += HdrSize;
- DataLength -= HdrSize;
- }
- } else {
- /* If there is a separate protocol header buffer,
- * adjust the fragment offset.
- */
- FragmentOffset -= HdrSize;
- }
-
- /* See if this is the last fragment.
- */
- if (!(FFlds & IP_MORE_FRAG)) {
- //
- // This is the last fragment (may also be the only fragment).
- //
- GotLastFragment = TRUE;
-
- /* Compute the expected length of the assembled
- * packet. This will be used to decide if we
- * have gotten all of the fragments.
- */
- ExpectedPacketLength = FragmentOffset + DataLength;
- }
-
- DEBUG (
- (EFI_D_NET,
- "\n ID = %Xh Off = %d Len = %d",
- Id,
- FragmentOffset,
- DataLength)
- );
-
- /* Check for receive buffer overflow.
- */
- if (FragmentOffset + DataLength > *MessageLengthPtr) {
- /* There is not enough space in the receive
- * buffer for the fragment.
- */
- DEBUG (
- (EFI_D_NET,
- "\nIpReceive() Exit #3 %Xh (%r)",
- EFI_BUFFER_TOO_SMALL,
- EFI_BUFFER_TOO_SMALL)
- );
-
- return EFI_BUFFER_TOO_SMALL;
- }
-
- /* Copy data into receive buffer.
- */
- if (DataLength != 0) {
- DEBUG ((EFI_D_NET, " To = %Xh", MessagePtr + FragmentOffset));
-
- CopyMem (MessagePtr + FragmentOffset, NextHdrPtr, DataLength);
- ByteCount += DataLength;
- }
-
- /* If we have seen the first and last fragments and
- * the receive byte count is at least as large as the
- * expected byte count, return SUCCESS.
- *
- * We could be tricked by receiving a fragment twice
- * but the upper level protocol should figure this
- * out.
- */
- if (GotFirstFragment && GotLastFragment && ByteCount >= ExpectedPacketLength) {
- *MessageLengthPtr = ExpectedPacketLength;
- return EFI_SUCCESS;
- }
- }
-}
-
-/* eof - pxe_bc_ip.c */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_mtftp.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_mtftp.c
deleted file mode 100644
index e2afbff..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_mtftp.c
+++ /dev/null
@@ -1,2379 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- pxe_bc_mtftp.c
-
-Abstract:
- TFTP and MTFTP (multicast TFTP) implementation.
-
-Revision History
-
---*/
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// The following #define is used to create a version that does not wait to
-// open after a listen. This is just for a special regression test of MTFTP
-// server to make sure multiple opens are handled correctly. Normally this
-// next line should be a comment.
-// #define SpecialNowaitVersion // comment out for normal operation
-//
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
-#include "Bc.h"
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-UINT64
-Swap64 (
- UINT64 n
- )
-{
- union {
- UINT64 n;
- UINT8 b[8];
- } u;
-
- UINT8 t;
-
- u.n = n;
-
- t = u.b[0];
- u.b[0] = u.b[7];
- u.b[7] = t;
-
- t = u.b[1];
- u.b[1] = u.b[6];
- u.b[6] = t;
-
- t = u.b[2];
- u.b[2] = u.b[5];
- u.b[5] = t;
-
- t = u.b[3];
- u.b[3] = u.b[4];
- u.b[4] = t;
-
- return u.n;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-TftpUdpRead (
- PXE_BASECODE_DEVICE *Private,
- UINT16 Operation,
- VOID *HeaderPtr,
- UINTN *BufferSizePtr,
- VOID *BufferPtr,
- EFI_IP_ADDRESS *ServerIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ServerPortPtr,
- EFI_IP_ADDRESS *OurIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *OurPortPtr,
- UINT16 Timeout
- )
-/*++
-Routine description:
- Read TFTP packet. If TFTP ERROR packet is read, fill in TFTP error
- information in Mode structure and return TFTP_ERROR status.
-
-Parameters:
- Private :=
- Operation :=
- HeaderPtr :=
- BufferSizePtr :=
- BufferPtr :=
- ServerIpPtr :=
- ServerPortPtr :=
- OurIpPtr :=
- OurPortPtr :=
- Timeout :=
-
-Returns:
- EFI_SUCCESS :=
- EFI_TFTP_ERROR :=
- other :=
---*/
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- EFI_STATUS Status;
- EFI_EVENT TimeoutEvent;
- UINTN HeaderSize;
-
- //
- //
- //
- Status = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &TimeoutEvent
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->SetTimer (
- TimeoutEvent,
- TimerRelative,
- Timeout * 10000000 + 1000000
- );
-
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (TimeoutEvent);
- return Status;
- }
- //
- //
- //
- HeaderSize = Private->BigBlkNumFlag ? sizeof (struct Tftpv4Ack8) : sizeof (struct Tftpv4Ack);
-
-#define ERROR_MESSAGE_PTR ((struct Tftpv4Error *) HeaderPtr)
-
- Status = UdpRead (
- Private,
- Operation,
- OurIpPtr,
- OurPortPtr,
- ServerIpPtr,
- ServerPortPtr,
- &HeaderSize,
- HeaderPtr,
- BufferSizePtr,
- BufferPtr,
- TimeoutEvent
- );
-
- if (Status != EFI_SUCCESS || ERROR_MESSAGE_PTR->OpCode != HTONS (TFTP_ERROR)) {
- gBS->CloseEvent (TimeoutEvent);
- return Status;
- }
- //
- // got an error packet
- // write one byte error code followed by error message
- //
- PxeBcMode = Private->EfiBc.Mode;
- PxeBcMode->TftpErrorReceived = TRUE;
- PxeBcMode->TftpError.ErrorCode = (UINT8) NTOHS (ERROR_MESSAGE_PTR->ErrCode);
- HeaderSize = EFI_MIN (*BufferSizePtr, sizeof PxeBcMode->TftpError.ErrorString);
- CopyMem (PxeBcMode->TftpError.ErrorString, BufferPtr, HeaderSize);
-
- gBS->CloseEvent (TimeoutEvent);
- return EFI_TFTP_ERROR;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-VOID
-SendError (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *ServerIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ServerPortPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *OurPortPtr
- )
-/*++
-Routine description:
- Send TFTP ERROR message to TFTP server
-
-Parameters:
- Private :=
- ServerIpPtr :=
- ServerPortPtr :=
- OurPortPtr :=
-
-Returns:
---*/
-{
- struct Tftpv4Error *ErrStr;
- UINTN Len;
-
- ErrStr = (VOID *) Private->TftpErrorBuffer;
- Len = sizeof *ErrStr;
-
- ErrStr->OpCode = HTONS (TFTP_ERROR);
- ErrStr->ErrCode = HTONS (TFTP_ERR_OPTION);
- ErrStr->ErrMsg[0] = 0;
-
- UdpWrite (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT,
- ServerIpPtr,
- ServerPortPtr,
- 0,
- 0,
- OurPortPtr,
- 0,
- 0,
- &Len,
- ErrStr
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-SendAckAndGetData (
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *ServerIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ServerPortPtr,
- EFI_IP_ADDRESS *ReplyIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *OurPortPtr,
- UINT16 Timeout,
- UINTN *ReplyLenPtr,
- UINT8 *PxeBcMode,
- UINT64 *BlockNumPtr,
- BOOLEAN AckOnly
- )
-/*++
-Routine description:
- Send TFTP ACK packet to server and read next DATA packet.
-
-Parameters:
- Private := Pointer to PxeBc interface
- ServerIpPtr := Pointer to TFTP server IP address
- ServerPortPtr := Pointer to TFTP server UDP port
- ReplyIpPtr := Pointer to TFTP DATA packet destination IP address
- OurPortPtr := Pointer to TFTP client UDP port
- Timeout :=
- ReplyLenPtr := Pointer to packet length
- PxeBcMode := Pointer to packet buffer
- BlockNumPtr := Pointer to block number
- AckOnly := TRUE == Send last ack - do not wait for reply
-
-Returns:
---*/
-{
- struct Tftpv4Data DataBuffer;
- struct Tftpv4Ack *Ack2Ptr;
- struct Tftpv4Ack8 *Ack8Ptr;
- EFI_STATUS Status;
- UINTN Len;
-
- Ack2Ptr = (VOID *) Private->TftpAckBuffer;
- Ack8Ptr = (VOID *) Private->TftpAckBuffer;
-
- if (Private->BigBlkNumFlag) {
- Len = sizeof (struct Tftpv4Ack8);
-
- Ack8Ptr->OpCode = HTONS (TFTP_ACK8);
- Ack8Ptr->BlockNum = Swap64 (*BlockNumPtr);
-
- Status = UdpWrite (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT,
- ServerIpPtr,
- ServerPortPtr,
- 0,
- 0,
- OurPortPtr,
- 0,
- 0,
- &Len,
- Ack8Ptr
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- } else {
- Len = sizeof (struct Tftpv4Ack);
-
- Ack2Ptr->OpCode = HTONS (TFTP_ACK);
- Ack2Ptr->BlockNum = HTONS ((UINT16) *BlockNumPtr);
-
- Status = UdpWrite (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT,
- ServerIpPtr,
- ServerPortPtr,
- 0,
- 0,
- OurPortPtr,
- 0,
- 0,
- &Len,
- Ack2Ptr
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- if (AckOnly) {
- //
- // ACK of last packet. This is just a courtesy.
- // Do not wait for response.
- //
- return EFI_SUCCESS;
- }
- //
- // read reply
- //
- Status = TftpUdpRead (
- Private,
- 0,
- &DataBuffer,
- ReplyLenPtr,
- PxeBcMode,
- ServerIpPtr,
- ServerPortPtr,
- ReplyIpPtr,
- OurPortPtr,
- Timeout
- );
-
- if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
- return Status;
- }
- //
- // got a good reply (so far)
- // check for next data packet
- //
- if (!Private->BigBlkNumFlag && DataBuffer.Header.OpCode == HTONS (TFTP_DATA)) {
- if (Status == EFI_BUFFER_TOO_SMALL) {
- SendError (Private, ServerIpPtr, ServerPortPtr, OurPortPtr);
- }
-
- *BlockNumPtr = NTOHS (DataBuffer.Header.BlockNum);
- return Status;
- }
-
- if (Private->BigBlkNumFlag && DataBuffer.Header.OpCode == HTONS (TFTP_DATA8)) {
- if (Status == EFI_BUFFER_TOO_SMALL) {
- SendError (Private, ServerIpPtr, ServerPortPtr, OurPortPtr);
- }
-
- *BlockNumPtr = Swap64 (*(UINT64 *) &DataBuffer.Header.BlockNum);
- return Status;
- }
-
- return EFI_PROTOCOL_ERROR;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-LockStepReceive (
- PXE_BASECODE_DEVICE *Private,
- UINTN PacketSize,
- UINT64 *BufferSizePtr,
- UINT64 Offset,
- UINT8 *BufferPtr,
- EFI_IP_ADDRESS *ServerIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ServerPortPtr,
- EFI_IP_ADDRESS *ReplyIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *OurPortPtr,
- UINT64 LastBlock,
- UINT16 Timeout,
- IN BOOLEAN DontUseBuffer
- )
-/*++
-Routine description:
- Read rest of file after successfull M/TFTP request.
-
-Parameters:
- Private := Pointer to PxeBc interface
- PacketSize := Pointer to packet size
- BufferSizePtr := Pointer to buffer (file) size
- Offset := Offset into buffer of next packet
- BufferPtr := Pointer to receive buffer
- ServerIpPtr := Pointer to TFTP server IP address
- ServerPortPtr := Pointer to TFTP server UDP port
- ReplyIpPtr := Pointer to TFTP DATA packet destination IP address
- OurPortPtr := Pointer to TFTP client UDP port
- LastBlock := Last block number received
- Timeout :=
- DontUseBuffer := TRUE == throw away data, just count # of bytes
-
-Returns:
---*/
-{
- EFI_STATUS Status;
- UINT64 BlockNum;
- UINT64 BufferSize;
- UINTN Retries;
- UINTN SaveLen;
- UINTN ReplyLen;
-
- ReplyLen = PacketSize;
- BlockNum = LastBlock;
-
- DEBUG ((EFI_D_INFO, "\nLockStepReceive() PacketSize = %d", PacketSize));
-
- if (DontUseBuffer) {
- BufferSize = PacketSize;
- } else {
- BufferSize = *BufferSizePtr - Offset;
- BufferPtr += Offset;
- }
-
- while (ReplyLen >= 512 && ReplyLen == PacketSize) {
- if (BufferSize < PacketSize) {
- ReplyLen = (UINTN) ((BufferSize > 0) ? BufferSize : 0);
- }
-
- SaveLen = ReplyLen;
-
- //
- // write an ack packet and get data - retry up to NUM_ACK_RETRIES on timeout
- //
- Retries = NUM_ACK_RETRIES;
-
- do {
- ReplyLen = SaveLen;
-
- Status = SendAckAndGetData (
- Private,
- ServerIpPtr,
- ServerPortPtr,
- ReplyIpPtr,
- OurPortPtr,
- Timeout,
- (UINTN *) &ReplyLen,
- BufferPtr,
- &BlockNum,
- FALSE
- );
-
- if (!EFI_ERROR (Status) || Status == EFI_BUFFER_TOO_SMALL) {
- if (BlockNum == LastBlock) {
- DEBUG ((EFI_D_NET, "\nresend"));
- //
- // a resend - continue
- //
- Status = EFI_TIMEOUT;
- } else if (Private->BigBlkNumFlag) {
- if (BlockNum != ++LastBlock) {
- DEBUG ((EFI_D_NET, "\nLockStepReceive() Exit #1a"));
- //
- // not correct blocknum - error
- //
- return EFI_PROTOCOL_ERROR;
- }
- } else {
- LastBlock = (LastBlock + 1) & 0xFFFF;
- if (BlockNum != LastBlock) {
- DEBUG ((EFI_D_NET, "\nLockStepReceive() Exit #1b"));
- return EFI_PROTOCOL_ERROR;
- //
- // not correct blocknum - error
- //
- }
- }
- }
- } while (Status == EFI_TIMEOUT && --Retries);
-
- if (EFI_ERROR (Status)) {
- if (Status != EFI_BUFFER_TOO_SMALL) {
- SendError (Private, ServerIpPtr, ServerPortPtr, OurPortPtr);
- }
-
- return Status;
- }
-
- if (DontUseBuffer) {
- BufferSize += ReplyLen;
- } else {
- BufferPtr += ReplyLen;
- BufferSize -= ReplyLen;
- }
- }
- //
- // while (ReplyLen == PacketSize);
- //
- if (DontUseBuffer) {
- if (BufferSizePtr != NULL) {
- *BufferSizePtr = (BufferSize - PacketSize);
- }
- } else {
- *BufferSizePtr -= BufferSize;
- }
-
- /* Send ACK of last packet. */
- ReplyLen = 0;
-
- SendAckAndGetData (
- Private,
- ServerIpPtr,
- ServerPortPtr,
- ReplyIpPtr,
- OurPortPtr,
- Timeout,
- (UINTN *) &ReplyLen,
- BufferPtr,
- &BlockNum,
- TRUE
- );
-
- return EFI_SUCCESS;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// some literals
-//
-STATIC UINT8 Mode[] = MODE_BINARY;
-STATIC UINT8 BlockSizeOp[] = OP_BLKSIZE;
-STATIC UINT8 TsizeOp[] = OP_TFRSIZE;
-STATIC UINT8 OverwriteOp[] = OP_OVERWRITE;
-STATIC UINT8 BigBlkNumOp[] = OP_BIGBLKNUM;
-STATIC EFI_PXE_BASE_CODE_UDP_PORT TftpRequestPort = TFTP_OPEN_PORT;
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-UINT8 *
-FindOption (
- UINT8 *OptionPtr,
- INTN OpLen,
- UINT8 *OackPtr,
- INTN OackSize
- )
-/*++
-Routine description:
- Check TFTP OACK packet for option.
-
-Parameters:
- OptionPtr := Pointer to option string to find
- OpLen := Length of option string
- OackPtr := Pointer to OACK data
- OackSize := Length of OACK data
-
-Returns:
- Pointer to value field if option found or NULL if not found.
---*/
-{
- if ((OackSize -= OpLen) <= 0) {
- return NULL;
- }
-
- do {
- if (!CompareMem (OackPtr, OptionPtr, OpLen)) {
- return OackPtr + OpLen;
- }
-
- ++OackPtr;
- } while (--OackSize);
-
- return NULL;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-#define BKSZOP 1 // block size
-#define TSIZEOP 2 // transfer size
-#define OVERWRITEOP 4 // overwrite
-#define BIGBLKNUMOP 8 // big block numbers
-STATIC
-EFI_STATUS
-TftpRwReq (
- UINT16 Req,
- UINT16 Options,
- PXE_BASECODE_DEVICE *Private,
- EFI_IP_ADDRESS *ServerIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ServerPortPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *OurPortPtr,
- UINT8 *FilenamePtr,
- UINTN *PacketSizePtr,
- VOID *Buffer
- )
-/*++
-Routine description:
- Send TFTP RRQ/WRQ packet.
-
-Parameters:
- Req := Type of request to send
- Options := One or more of the #define values above
- Private := Pointer to PxeBc interface
- ServerIpPtr := Pointer to TFTP server IP address
- ServerPortPtr := Pointer to TFTP server UDP port
- OurPortPtr := Pointer to TFTP client UDP port
- FilenamePtr := Pointer to TFTP file or directory name
- PacketSizePtr := Pointer to block size
- Buffer :=
-
-Returns:
---*/
-{
- union {
- UINT8 Data[514];
- struct Tftpv4Req ReqStr;
- } *u;
-
- UINT16 OpFlags;
- INTN Len;
- INTN TotalLen;
- UINT8 *Ptr;
-
- if (*OurPortPtr == 0) {
- OpFlags = EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT | EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT;
- } else {
- OpFlags = EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT;
- }
- //
- // build the basic request - opcode, filename, mode
- //
- u = Buffer;
- u->ReqStr.OpCode = HTONS (Req);
- TotalLen = sizeof (Mode) + sizeof (u->ReqStr.OpCode) + (Len = 1 + AsciiStrLen ((CHAR8 *)FilenamePtr));
-
- CopyMem (u->ReqStr.FileName, FilenamePtr, Len);
- Ptr = (UINT8 *) (u->ReqStr.FileName + Len);
-
- CopyMem (Ptr, Mode, sizeof (Mode));
- Ptr += sizeof (Mode);
-
- if (Options & BKSZOP) {
- CopyMem (Ptr, BlockSizeOp, sizeof (BlockSizeOp));
- UtoA10 (*PacketSizePtr, Ptr + sizeof (BlockSizeOp));
-
- TotalLen += (Len = 1 + AsciiStrLen ((CHAR8 *)Ptr + sizeof (BlockSizeOp)) + sizeof (BlockSizeOp));
-
- Ptr += Len;
- }
-
- if (Options & TSIZEOP) {
- CopyMem (Ptr, TsizeOp, sizeof (TsizeOp));
- CopyMem (Ptr + sizeof (TsizeOp), "0", 2);
- TotalLen += sizeof (TsizeOp) + 2;
- Ptr += sizeof (TsizeOp) + 2;
- }
-
- if (Options & OVERWRITEOP) {
- CopyMem (Ptr, OverwriteOp, sizeof (OverwriteOp));
- CopyMem (Ptr + sizeof (OverwriteOp), "1", 2);
- TotalLen += sizeof (OverwriteOp) + 2;
- Ptr += sizeof (OverwriteOp) + 2;
- }
-
- if (Options & BIGBLKNUMOP) {
- CopyMem (Ptr, BigBlkNumOp, sizeof (BigBlkNumOp));
- CopyMem (Ptr + sizeof (BigBlkNumOp), "8", 2);
- TotalLen += sizeof (BigBlkNumOp) + 2;
- Ptr += sizeof (BigBlkNumOp) + 2;
- }
- //
- // send it
- //
- return UdpWrite (
- Private,
- OpFlags,
- ServerIpPtr,
- ServerPortPtr,
- 0,
- 0,
- OurPortPtr,
- 0,
- 0,
- (UINTN *) &TotalLen,
- u
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-TftpRwReqwResp (
- UINT16 Req,
- UINT16 Options,
- PXE_BASECODE_DEVICE *Private,
- VOID *HeaderPtr,
- UINTN *PacketSizePtr,
- UINTN *ReplyLenPtr,
- VOID *BufferPtr,
- EFI_IP_ADDRESS *ServerIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ServerPortPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *ServerReplyPortPtr,
- EFI_PXE_BASE_CODE_UDP_PORT *OurPortPtr,
- UINT8 *FilenamePtr,
- UINT16 Timeout
- )
-/*++
-Routine description:
- Start TFTP session. Issue request and wait for response.
- Retry three times on error. If failed using options,
- retry three times w/o options on error.
-
-Parameters:
- Req := TFTP request type
- Options := TFTP option bits
- Private := Pointer to PxeBc interface
- HeaderPtr :=
- PacketSizePtr := Pointer to block size
- ReplyLenPtr :=
- BufferPtr :=
- ServerIpPtr := Pointer to TFTP server IP address
- ServerPortPtr := Pointer to TFTP server UDP port
- ServerReplyPortPtr :=
- OurPortPtr := Pointer to TFTP client UDP Port
- FilenamePtr := Pointer to file or directory name
- Timeout :=
-
-Returns:
---*/
-{
- EFI_STATUS Status;
- UINTN SaveReplyLen;
- INTN Retries;
- UINT8 Buffer[514];
-
- SaveReplyLen = *ReplyLenPtr;
- Retries = 3;
- Private->BigBlkNumFlag = FALSE;
- *OurPortPtr = 0;
- //
- // generate random
- //
- do {
- if (*OurPortPtr != 0) {
- if (++ *OurPortPtr == 0) {
- *OurPortPtr = PXE_RND_PORT_LOW;
- }
- }
- //
- // send request from our Ip = StationIp
- //
- if ((Status = TftpRwReq (
- Req,
- Options,
- Private,
- ServerIpPtr,
- ServerPortPtr,
- OurPortPtr,
- FilenamePtr,
- PacketSizePtr,
- Buffer
- )) != EFI_SUCCESS) {
- DEBUG (
- (EFI_D_WARN,
- "\nTftpRwReqwResp() Exit #1 %xh (%r)",
- Status,
- Status)
- );
-
- return Status;
- }
- //
- // read reply to our Ip = StationIp
- //
- *ReplyLenPtr = SaveReplyLen;
-
- Status = TftpUdpRead (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT,
- HeaderPtr,
- ReplyLenPtr,
- BufferPtr,
- ServerIpPtr,
- ServerReplyPortPtr,
- 0,
- OurPortPtr,
- Timeout
- );
- } while (Status == EFI_TIMEOUT && --Retries);
-
- if (!Options || Status != EFI_TFTP_ERROR) {
- DEBUG (
- (EFI_D_WARN,
- "\nTftpRwReqwResp() Exit #2 %xh (%r)",
- Status,
- Status)
- );
- return Status;
- }
-
- Status = TftpRwReqwResp (
- Req,
- 0,
- Private,
- HeaderPtr,
- PacketSizePtr,
- ReplyLenPtr,
- BufferPtr,
- ServerIpPtr,
- ServerPortPtr,
- ServerReplyPortPtr,
- OurPortPtr,
- FilenamePtr,
- Timeout
- );
-
- DEBUG ((EFI_D_WARN, "\nTftpRwReqwResp() Exit #3 %xh (%r)", Status, Status));
-
- return Status;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// mtftp listen
-// read on mcast ip, cport, from sport, for data packet
-// returns success if gets multicast last packet or all up to last block
-// if not missing, then finished
-//
-STATIC
-EFI_STATUS
-MtftpListen (
- PXE_BASECODE_DEVICE *Private,
- UINT64 *BufferSizePtr,
- UINT8 *BufferPtr,
- EFI_IP_ADDRESS *ServerIpPtr,
- EFI_PXE_BASE_CODE_MTFTP_INFO *MtftpInfoPtr,
- UINT64 *StartBlockPtr,
- UINTN *NumMissedPtr,
- UINT16 TransTimeout,
- UINT16 ListenTimeout,
- UINT64 FinalBlock,
- IN BOOLEAN DontUseBuffer
- )
-/*++
-Routine description:
- Listen for MTFTP traffic and save desired packets.
-
-Parameters:
- Private := Pointer to PxeBc interface
- BufferSizePtr :=
- BufferPtr :=
- ServerIpPtr := Pointer to TFTP server IP address
- MtftpInfoPtr := Pointer to MTFTP session information
- StartBlockPtr := IN=first block we are looking for OUT=first block received
- NumMissedPtr := Number of blocks missed
- TransTimeout :=
- ListenTimeout :=
- FinalBlock :=
- DontUseBuffer := TRUE == throw packets away, just count bytes
-
-Returns:
---*/
-{
- EFI_STATUS Status;
- struct Tftpv4Ack Header;
- UINT64 Offset;
- UINT64 BlockNum;
- UINT64 LastBlockNum;
- UINT64 BufferSize;
- UINTN NumMissed;
- UINTN PacketSize;
- UINTN SaveReplyLen;
- UINTN ReplyLen;
- UINT16 Timeout;
-
- LastBlockNum = *StartBlockPtr;
- Timeout = ListenTimeout;
- *NumMissedPtr = 0;
- PacketSize = 0;
- BufferSize = *BufferSizePtr;
- ReplyLen = MAX_TFTP_PKT_SIZE;;
-
- //
- // receive
- //
- do {
- if ((SaveReplyLen = ReplyLen) > BufferSize) {
- SaveReplyLen = (UINTN) BufferSize;
- }
-
- /* %%TBD - add big block number support */
-
- //
- // get data - loop on resends
- //
- do {
- ReplyLen = SaveReplyLen;
-
- if ((Status = TftpUdpRead (
- Private,
- 0,
- &Header,
- &ReplyLen,
- BufferPtr,
- ServerIpPtr,
- &MtftpInfoPtr->SPort,
- &MtftpInfoPtr->MCastIp,
- &MtftpInfoPtr->CPort,
- Timeout
- )) != EFI_SUCCESS) {
- return Status;
- }
- //
- // make sure a data packet
- //
- if (Header.OpCode != HTONS (TFTP_DATA)) {
- return EFI_PROTOCOL_ERROR;
- }
- } while ((BlockNum = NTOHS (Header.BlockNum)) == LastBlockNum);
-
- //
- // make sure still going up
- //
- if (LastBlockNum > BlockNum) {
- return EFI_PROTOCOL_ERROR;
- }
-
- if (BlockNum - LastBlockNum > 0xFFFFFFFF) {
- return EFI_PROTOCOL_ERROR;
- } else {
- NumMissed = (UINTN) (BlockNum - LastBlockNum - 1);
- }
-
- LastBlockNum = BlockNum;
-
- //
- // if first time through, some reinitialization
- //
- if (!PacketSize) {
- *StartBlockPtr = BlockNum;
- PacketSize = ReplyLen;
- Timeout = TransTimeout;
- } else {
- *NumMissedPtr = (UINT16) (*NumMissedPtr + NumMissed);
- }
- //
- // if missed packets, update start block,
- // etc. and move packet to proper place in buffer
- //
- if (NumMissed) {
- *StartBlockPtr = BlockNum;
- if (!DontUseBuffer) {
- Offset = NumMissed * PacketSize;
- CopyMem (BufferPtr + Offset, BufferPtr, ReplyLen);
- BufferPtr += Offset;
- BufferSize -= Offset;
- }
- }
-
- if (!DontUseBuffer) {
- BufferPtr += ReplyLen;
- BufferSize -= ReplyLen;
- }
- } while (ReplyLen == PacketSize && BlockNum != FinalBlock);
-
- *BufferSizePtr = BufferSize;
-
- return EFI_SUCCESS;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-MtftpOpen (
- PXE_BASECODE_DEVICE * Private,
- UINT64 *BufferSizePtr,
- UINT8 *BufferPtr,
- UINTN *PacketSizePtr,
- EFI_IP_ADDRESS * ServerIpPtr,
- UINT8 *FilenamePtr,
- EFI_PXE_BASE_CODE_MTFTP_INFO * MtftpInfoPtr,
- UINT8 *CompletionStatusPtr,
-#define GOTUNI 1
-#define GOTMULTI 2
- IN BOOLEAN DontUseBuffer
- )
-/*++
-Routine description:
- Open MTFTP session.
-
-Parameters:
- Private := Pointer to PxeBc interface
- BufferSizePtr := IN=buffer size OUT=transfer size
- BufferPtr :=
- PacketSizePtr :=
- ServerIpPtr :=
- FilenamePtr :=
- MtftpInfoPtr :=
- CompletionStatusPtr :=
- DontUseBuffer :=
-
-Returns:
-// mtftp open session
-// return code EFI_SUCCESS
-// and *CompletionStatusPtr = GOTUNI | GOTMULTI means done
-// and *CompletionStatusPtr = GOTMULTI means got first two multicast packets, use listen for rest
-// and *CompletionStatusPtr = 0 means did not get first two multicast packets, use listen for all
-// (do not get = GOTUNI - returns NO_DATA go will go to TFTP session)
---*/
-{
- EFI_STATUS Status;
- EFI_IP_ADDRESS OurReplyIp;
- struct Tftpv4Ack Header;
- INTN ReplyLen;
- INTN Retries;
- UINT8 *BufferPtr2;
- UINT8 TmpBuf[514];
-
- Retries = NUM_MTFTP_OPEN_RETRIES;
- BufferPtr2 = BufferPtr;
- *PacketSizePtr = (UINTN) (EFI_MIN (*BufferSizePtr, MAX_TFTP_PKT_SIZE));
-
- do {
- //
- // send a read request
- //
- *CompletionStatusPtr = 0;
-
- if ((Status = TftpRwReq (
- TFTP_RRQ,
- 0,
- Private,
- ServerIpPtr,
- &MtftpInfoPtr->SPort,
- &MtftpInfoPtr->CPort,
- FilenamePtr,
- PacketSizePtr,
- TmpBuf
- )) != EFI_SUCCESS) {
- return Status;
- }
-
- for (;;) {
- //
- // read reply
- //
- ZeroMem (&OurReplyIp, Private->IpLength);
- ReplyLen = *PacketSizePtr;
-
- if ((Status = TftpUdpRead (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER,
- &Header,
- (UINTN *) &ReplyLen,
- BufferPtr2,
- ServerIpPtr,
- &MtftpInfoPtr->SPort,
- &OurReplyIp,
- &MtftpInfoPtr->CPort,
- MtftpInfoPtr->TransmitTimeout
- )) == EFI_SUCCESS) {
- //
- // check for first data packet
- //
- if (Header.OpCode != HTONS (TFTP_DATA)) {
- return EFI_PROTOCOL_ERROR;
- }
- //
- // check block num
- //
- if (Header.BlockNum != HTONS (1)) {
- //
- // it's not first
- // if we are not the primary client,
- // we probably got first and now second
- // multicast but no unicast, so
- // *CompletionStatusPtr = GOTMULTI - if this is
- // the second, can just go on to listen
- // starting with 2 as the last block
- // received
- //
- if (Header.BlockNum != HTONS (2)) {
- //
- // not second
- //
- *CompletionStatusPtr = 0;
- }
-
- return Status;
- }
-
- //
- // now actual
- //
- *PacketSizePtr = ReplyLen;
- //
- // see if a unicast data packet
- //
- if (!CompareMem (
- &OurReplyIp,
- &Private->EfiBc.Mode->StationIp,
- Private->IpLength
- )) {
- *CompletionStatusPtr |= GOTUNI;
- //
- // it is
- // if already got multicast packet,
- // got em both
- //
- if (*CompletionStatusPtr & GOTMULTI) {
- break;
- }
- } else if (!CompareMem (
- &OurReplyIp,
- &MtftpInfoPtr->MCastIp,
- Private->IpLength
- )) {
- //
- // otherwise see if a multicast data packet
- //
- *CompletionStatusPtr |= GOTMULTI;
- //
- // it is
- // got first - bump pointer so that if
- // second multi comes along, we're OK
- //
- if (!DontUseBuffer) {
- BufferPtr2 = (UINT8 *) BufferPtr + ReplyLen;
- }
- //
- // if already got unicast packet,
- // got em both
- //
- if (*CompletionStatusPtr & GOTUNI) {
- break;
- }
- } else {
- //
- // else protocol error
- //
- return EFI_PROTOCOL_ERROR;
- }
- } else if (Status == EFI_TIMEOUT) {
- //
- // bad return code - if timed out, retry
- //
- break;
- } else {
- //
- // else just bad - failed MTFTP open
- //
- return Status;
- }
- }
- } while (Status == EFI_TIMEOUT && --Retries);
-
- if (Status != EFI_SUCCESS) {
- //
- // open failed
- //
- return Status;
- }
- //
- // got em both - go into receive mode
- // routine to read rest of file after a successful open (TFTP or MTFTP)
- // sends ACK and gets next data packet until short packet arrives,
- // then sends ACK and (hopefully) times out
- //
- return LockStepReceive (
- Private,
- (UINT16) ReplyLen,
- BufferSizePtr,
- ReplyLen,
- BufferPtr,
- ServerIpPtr,
- &MtftpInfoPtr->SPort,
- &MtftpInfoPtr->MCastIp,
- &MtftpInfoPtr->CPort,
- 1,
- MtftpInfoPtr->TransmitTimeout,
- DontUseBuffer
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-MtftpDownload (
- PXE_BASECODE_DEVICE *Private,
- UINT64 *BufferSizePtr,
- UINT8 *BufferPtr,
- EFI_IP_ADDRESS *ServerIpPtr,
- UINT8 *FilenamePtr,
- EFI_PXE_BASE_CODE_MTFTP_INFO *MtftpInfoPtr,
- IN BOOLEAN DontUseBuffer
- )
-/*++
-Routine description:
-// mtftp
-// loop
-// listen
-// if did not get any packets, try MTFTP open
-// if got all packets, return
-// compute listen timeout and loop
-
-Parameters:
- Private := Pointer to PxeBc interface
- BufferSizePtr :=
- BufferPtr :=
- ServerIpPtr :=
- FilenamePtr :=
- MtftpInfoPtr :=
- DontUseBuffer :=
-
-Returns:
---*/
-{
- EFI_PXE_BASE_CODE_IP_FILTER Filter;
- EFI_STATUS Status;
- UINT64 StartBlock;
- UINT64 LastBlock;
- UINT64 LastStartBlock;
- UINT64 BufferSize;
- UINTN Offset;
- UINTN NumMissed;
- UINT16 TransTimeout;
- UINT16 ListenTimeout;
- UINT8 *BufferPtrLocal;
-
- TransTimeout = MtftpInfoPtr->TransmitTimeout;
- ListenTimeout = MtftpInfoPtr->ListenTimeout;
- LastBlock = 0;
- LastStartBlock = 0;
- Offset = 0;
-
- Filter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST;
- Filter.IpCnt = 2;
- CopyMem (&Filter.IpList[0], &Private->EfiBc.Mode->StationIp, sizeof (EFI_IP_ADDRESS));
- CopyMem (&Filter.IpList[1], &MtftpInfoPtr->MCastIp, sizeof (EFI_IP_ADDRESS));
-
- if ((Status = IpFilter (Private, &Filter)) != EFI_SUCCESS) {
- return Status;
- }
-
- for (;;) {
- StartBlock = LastStartBlock;
- BufferSize = *BufferSizePtr - Offset;
-
- if (DontUseBuffer) {
- //
- // overwrie the temp buf
- //
- BufferPtrLocal = BufferPtr;
- } else {
- BufferPtrLocal = BufferPtr + Offset;
-
- }
-
- if (((Status = MtftpListen (
- Private,
- &BufferSize,
- BufferPtrLocal,
- ServerIpPtr,
- MtftpInfoPtr,
- &StartBlock,
- &NumMissed,
- TransTimeout,
- ListenTimeout,
- LastBlock,
- DontUseBuffer
- )) != EFI_SUCCESS) && (Status != EFI_TIMEOUT)) {
- return Status;
- //
- // failed
- //
- }
- //
- // if none were received, start block is not reset
- //
- if (StartBlock == LastStartBlock) {
- UINT8 CompStat;
-
- //
- // timed out with none received - try MTFTP open
- //
- if ((Status = MtftpOpen (
- Private,
- BufferSizePtr,
- BufferPtr,
- &Offset,
- ServerIpPtr,
- FilenamePtr,
- MtftpInfoPtr,
- &CompStat,
- DontUseBuffer
- )) != EFI_SUCCESS) {
- //
- // open failure - try TFTP
- //
- return Status;
- }
- //
- // return code EFI_SUCCESS
- // and *CompletionStatusPtr = GOTUNI | GOTMULTI means done
- // and *CompletionStatusPtr = GOTMULTI means got first two multicast packets, use listen for rest
- // and *CompletionStatusPtr = 0 means did not get first two multicast packets, use listen for all
- // (do not get = GOTUNI - returns NO_DATA go will go to TFTP session)
- //
- if (CompStat == (GOTUNI | GOTMULTI)) {
- //
- // finished - got it all
- //
- return Status;
- }
-
- if (CompStat) {
- //
- // offset is two packet lengths
- //
- Offset <<= 1;
- //
- // last block received
- //
- LastStartBlock = 2;
- } else {
- Offset = 0;
- LastStartBlock = 0;
- }
-
- ListenTimeout = TransTimeout;
- continue;
- }
- //
- // did we get the last block
- //
- if (Status == EFI_SUCCESS) {
- //
- // yes - set the file size if this was first time
- //
- if (!LastBlock) {
- *BufferSizePtr -= BufferSize;
- }
- //
- // if buffer was too small, finished
- //
- if (!DontUseBuffer) {
- return EFI_BUFFER_TOO_SMALL;
- }
- //
- // if we got them all, finished
- //
- if (!NumMissed && StartBlock == LastStartBlock + 1) {
- return Status;
- }
- //
- // did not get them all - set last block
- //
- LastBlock = (UINT16) (StartBlock - 1);
- }
- //
- // compute listen timeout
- //
- ListenTimeout = (UINT16) ((NumMissed > MtftpInfoPtr->ListenTimeout) ? 0 : (MtftpInfoPtr->ListenTimeout - NumMissed));
-
- //
- // reset
- //
- Offset = 0;
- LastStartBlock = 0;
- }
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-TftpInfo (
- PXE_BASECODE_DEVICE *Private,
- UINT64 *BufferSizePtr,
- EFI_IP_ADDRESS *ServerIpPtr,
- EFI_PXE_BASE_CODE_UDP_PORT SrvPort,
- UINT8 *FilenamePtr,
- UINTN *PacketSizePtr
- )
-/*++
-Routine description:
-// TFTP info request routine
-// send read request with block size and transfer size options
-// get reply
-// send error to terminate session
-// if OACK received, set info
-
-Parameters:
- Private :=
- BufferSizePtr :=
- ServerIpPtr :=
- SrvPort :=
- FilenamePtr :=
- PacketSizePtr :=
-
-Returns:
---*/
-{
- EFI_PXE_BASE_CODE_UDP_PORT OurPort;
- EFI_PXE_BASE_CODE_UDP_PORT ServerReplyPort;
- EFI_STATUS Status;
- UINT64 BlockNum;
- UINTN Offset;
- UINTN ReplyLen;
- UINT8 *Ptr;
-
- union {
- struct Tftpv4Oack OAck2Ptr;
- struct Tftpv4Ack Ack2Ptr;
- struct Tftpv4Data Datastr;
- } u;
-
- OurPort = 0;
- ServerReplyPort = 0;
- ReplyLen = sizeof (u.Datastr.Data);
-
- //
- // send a write request with the blocksize option -
- // sets our IP and port - and receive reply - sets his port
- // will retry operation up to 3 times if no response,
- // and will retry without options on an error reply
- //
- if ((Status = TftpRwReqwResp (
- TFTP_RRQ,
- /* BIGBLKNUMOP | */BKSZOP | TSIZEOP,
- Private,
- &u,
- PacketSizePtr,
- &ReplyLen,
- u.Datastr.Data,
- ServerIpPtr,
- &SrvPort,
- &ServerReplyPort,
- &OurPort,
- FilenamePtr,
- REQ_RESP_TIMEOUT
- )) != EFI_SUCCESS) {
- DEBUG ((EFI_D_WARN, "\nTftpInfo() Exit #1"));
- return Status;
- }
- //
- // check for good OACK
- //
- if (u.OAck2Ptr.OpCode == HTONS (TFTP_OACK)) {
- //
- // now parse it for options
- // bigblk#
- //
- Ptr = FindOption (
- BigBlkNumOp,
- sizeof (BigBlkNumOp),
- u.OAck2Ptr.OpAck[0].Option,
- ReplyLen + sizeof (u.Ack2Ptr.BlockNum)
- );
-
- if (Ptr != NULL) {
- if (AtoU (Ptr) == 8) {
- Private->BigBlkNumFlag = TRUE;
- } else {
- return EFI_PROTOCOL_ERROR;
- }
- }
- //
- // blksize
- //
- Ptr = FindOption (
- BlockSizeOp,
- sizeof (BlockSizeOp),
- u.OAck2Ptr.OpAck[0].Option,
- ReplyLen += sizeof (u.Ack2Ptr.BlockNum)
- );
-
- *PacketSizePtr = (Ptr) ? AtoU (Ptr) : 512;
-
- //
- // tsize
- //
- Ptr = FindOption (
- TsizeOp,
- sizeof (TsizeOp),
- u.OAck2Ptr.OpAck[0].Option,
- ReplyLen
- );
-
- if (Ptr != NULL) {
- *BufferSizePtr = AtoU64 (Ptr);
-
- //
- // teminate session with error
- //
- SendError (Private, ServerIpPtr, &ServerReplyPort, &OurPort);
-
- return EFI_SUCCESS;
- }
-
- Offset = 0;
- BlockNum = 0;
- } else {
- //
- // if MTFTP get filesize, return unsupported
- //
- if (SrvPort != TftpRequestPort) {
- SendError (Private, ServerIpPtr, &ServerReplyPort, &OurPort);
- DEBUG ((EFI_D_WARN, "\nTftpInfo() Exit #3"));
- return EFI_UNSUPPORTED;
- }
-
- Offset = ReplyLen;
- //
- // last block received
- //
- BlockNum = 1;
- }
- //
- // does not support the option - do a download with no buffer
- //
- *BufferSizePtr = 0;
-
- Status = LockStepReceive (
- Private,
- (UINT16) ReplyLen,
- BufferSizePtr,
- Offset,
- (UINT8 *) &u,
- ServerIpPtr,
- &ServerReplyPort,
- &Private->EfiBc.Mode->StationIp,
- &OurPort,
- BlockNum,
- ACK_TIMEOUT,
- TRUE
- );
-
- if (Status != EFI_SUCCESS) {
- DEBUG ((EFI_D_WARN, "\nTftpInfo() LockStepReceive() == %Xh", Status));
- }
-
- if (Status != EFI_BUFFER_TOO_SMALL) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-TftpDownload (
- PXE_BASECODE_DEVICE *Private,
- UINT64 *BufferSizePtr,
- UINT8 *BufferPtr,
- EFI_IP_ADDRESS *ServerIpPtr,
- UINT8 *FilenamePtr,
- UINTN *PacketSizePtr,
- EFI_PXE_BASE_CODE_UDP_PORT SrvPort,
- UINT16 Req,
- IN BOOLEAN DontUseBuffer
- )
-/*++
-Routine description:
-// tftp read session
-// send read request
-// [get OACK
-// send ACK]
-// loop
-// get data
-// send ACK
-// while data size is max
-
-Parameters:
- Private :=
- BufferSizePtr :=
- BufferPtr :=
- ServerIpPtr :=
- FilenamePtr :=
- PacketSizePtr :=
- SrvPort :=
- Req :=
- DontUseBuffer :=
-
-Returns:
---*/
-{
- EFI_PXE_BASE_CODE_UDP_PORT OurPort;
- EFI_PXE_BASE_CODE_UDP_PORT ServerReplyPort;
- EFI_STATUS Status;
- UINT64 Offset;
- UINT64 BlockNum;
- UINTN ReplyLen;
- UINT8 *Ptr;
-
- union {
- struct Tftpv4Ack Ack2Ptr;
- struct Tftpv4Oack OAck2Ptr;
- struct Tftpv4Data Data;
- struct Tftpv4Ack8 Ack8Ptr;
- struct Tftpv4Data8 Data8;
- } U;
-
- OurPort = 0;
- ServerReplyPort = 0;
- ReplyLen = (UINTN) ((*BufferSizePtr > 0xFFFF) ? 0xFFFF : *BufferSizePtr);
-
- //
- // send a read request with the blocksize option - sets our IP and port
- // - and receive reply - sets his port will retry operation up to 3
- // times if no response, and will retry without options on an error
- // reply
- //
- if ((Status = TftpRwReqwResp (
- Req,
- /* BIGBLKNUMOP | */BKSZOP,
- Private,
- &U,
- PacketSizePtr,
- &ReplyLen,
- BufferPtr,
- ServerIpPtr,
- &SrvPort,
- &ServerReplyPort,
- &OurPort,
- FilenamePtr,
- REQ_RESP_TIMEOUT
- )) != EFI_SUCCESS) {
- DEBUG ((EFI_D_WARN, "\nTftpDownload() Exit #1 %xh (%r)", Status, Status));
- return Status;
- }
- //
- // check for OACK
- //
- if (U.OAck2Ptr.OpCode == HTONS (TFTP_OACK)) {
- //
- // get the OACK
- //
- CopyMem (U.Data.Data, BufferPtr, ReplyLen);
-
- Ptr = FindOption (
- BigBlkNumOp,
- sizeof (BigBlkNumOp),
- U.OAck2Ptr.OpAck[0].Option,
- ReplyLen + sizeof (U.Ack2Ptr.BlockNum)
- );
-
- if (Ptr != NULL) {
- if (AtoU (Ptr) == 8) {
- Private->BigBlkNumFlag = TRUE;
- } else {
- return EFI_PROTOCOL_ERROR;
- }
- }
- //
- // now parse it for blocksize option
- //
- Ptr = FindOption (
- BlockSizeOp,
- sizeof (BlockSizeOp),
- U.OAck2Ptr.OpAck[0].Option,
- ReplyLen += sizeof (U.Ack2Ptr.BlockNum)
- );
-
- ReplyLen = (Ptr != NULL) ? AtoU (Ptr) : 512;
-
- Offset = 0;
- //
- // last block received
- //
- BlockNum = 0;
- } else if (U.Ack2Ptr.OpCode != HTONS (TFTP_DATA) || U.Ack2Ptr.BlockNum != HTONS (1)) {
- //
- // or data
- //
- DEBUG ((EFI_D_WARN, "\nTftpDownload() Exit #2 %xh (%r)", Status, Status));
-
- return EFI_PROTOCOL_ERROR;
- } else {
- //
- // got good data packet
- //
- Offset = ReplyLen;
- //
- // last block received
- //
- BlockNum = 1;
- }
-
- if (PacketSizePtr != NULL) {
- *PacketSizePtr = ReplyLen;
- }
- //
- // routine to read rest of file after a successful open (TFTP or MTFTP)
- // sends ACK and gets next data packet until short packet arrives, then sends
- // ACK and (hopefully) times out
- // if first packet has been read, BufferPtr and BufferSize must reflect fact
- //
- Status = LockStepReceive (
- Private,
- ReplyLen,
- BufferSizePtr,
- Offset,
- BufferPtr,
- ServerIpPtr,
- &ServerReplyPort,
- &Private->EfiBc.Mode->StationIp,
- &OurPort,
- BlockNum,
- ACK_TIMEOUT,
- DontUseBuffer
- );
-
- if (Status != EFI_SUCCESS) {
- DEBUG ((EFI_D_WARN, "\nTftpDownload() Exit #3 %xh (%r)", Status, Status));
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- Status = TftpInfo (
- Private,
- BufferSizePtr,
- ServerIpPtr,
- SrvPort,
- FilenamePtr,
- PacketSizePtr
- );
-
- if (!EFI_ERROR (Status)) {
- Status = EFI_BUFFER_TOO_SMALL;
- }
- }
- }
-
- return Status;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-TftpUpload (
- PXE_BASECODE_DEVICE *Private,
- UINT64 *BufferSizePtr,
- VOID *BufferPtr,
- EFI_IP_ADDRESS *ServerIpPtr,
- UINT8 *FilenamePtr,
- UINTN *PacketSizePtr,
- BOOLEAN Overwrite
- )
-/*++
-Routine description:
-// tftp write session
-// send write request
-// get OACK or ACK
-// loop
-// send min (rest of data, max data packet)
-// get ACK
-// while data size is max
-
-Parameters:
- Private :=
- BufferSizePtr :=
- BufferPtr :=
- ServerIpPtr :=
- FilenamePtr :=
- PacketSizePtr :=
- Overwrite :=
-
-Returns:
---*/
-{
- struct Tftpv4Ack Header;
- EFI_PXE_BASE_CODE_UDP_PORT OurPort;
- EFI_PXE_BASE_CODE_UDP_PORT ServerReplyPort;
- EFI_STATUS Status;
- UINT64 BlockNum;
- UINT64 TransferSize;
- UINTN ReplyLen;
- UINTN TransferLen;
- UINT16 Options;
- UINT8 *Ptr;
-
- union {
- struct Tftpv4Oack OAck2Ptr;
- struct Tftpv4Ack Ack2Ptr;
- struct Tftpv4Data Datastr;
- } u;
-
- OurPort = 0;
- ServerReplyPort = 0;
- TransferSize = *BufferSizePtr;
- ReplyLen = sizeof (u.Datastr.Data);
- Options = (UINT16) ((Overwrite) ? OVERWRITEOP | BKSZOP : BKSZOP);
-
- //
- // send a write request with the blocksize option - sets our IP and port -
- // and receive reply - sets his port
- // will retry operation up to 3 times if no response, and will retry without
- // options on an error reply
- //
- if ((Status = TftpRwReqwResp (
- TFTP_WRQ,
- Options,
- Private,
- &u,
- PacketSizePtr,
- &ReplyLen,
- u.Datastr.Data,
- ServerIpPtr,
- &TftpRequestPort,
- &ServerReplyPort,
- &OurPort,
- FilenamePtr,
- REQ_RESP_TIMEOUT
- )) != EFI_SUCCESS) {
- return Status;
- }
- //
- // check for OACK
- //
- if (u.OAck2Ptr.OpCode == HTONS (TFTP_OACK)) {
- //
- // parse it for blocksize option
- //
- Ptr = FindOption (
- BlockSizeOp,
- sizeof (BlockSizeOp),
- u.OAck2Ptr.OpAck[0].Option,
- ReplyLen += sizeof (u.Ack2Ptr.BlockNum)
- );
- *PacketSizePtr = (Ptr) ? AtoU (Ptr) : 512;
- }
- //
- // or ACK
- //
- else if (u.Ack2Ptr.OpCode == HTONS (TFTP_ACK)) {
- //
- // option was not supported
- //
- *PacketSizePtr = 512;
- } else {
- return EFI_PROTOCOL_ERROR;
- }
- //
- // loop
- //
- Header.OpCode = HTONS (TFTP_DATA);
- BlockNum = 1;
- Header.BlockNum = HTONS (1);
-
- do {
- UINTN HeaderSize;
- INTN Retries;
-
- Retries = NUM_ACK_RETRIES;
- HeaderSize = sizeof (Header);
- TransferLen = (UINTN) (EFI_MIN (*PacketSizePtr, TransferSize));
-
- //
- // write a data packet and get an ack
- //
- do {
- //
- // write
- //
- if ((Status = UdpWrite (
- Private,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT,
- ServerIpPtr,
- &ServerReplyPort,
- 0,
- 0,
- &OurPort,
- &HeaderSize,
- &Header,
- &TransferLen,
- BufferPtr
- )) != EFI_SUCCESS) {
- return Status;
- }
- //
- // read reply
- //
- ReplyLen = sizeof (u.Datastr.Data);
-
- if ((Status = TftpUdpRead (
- Private,
- 0,
- &u,
- &ReplyLen,
- u.Datastr.Data,
- ServerIpPtr,
- &ServerReplyPort,
- 0,
- &OurPort,
- ACK_TIMEOUT
- )) == EFI_SUCCESS) {
- //
- // check for ACK for this data packet
- //
- if (u.Ack2Ptr.OpCode != HTONS (TFTP_ACK)) {
- return EFI_PROTOCOL_ERROR;
- }
-
- if (u.Ack2Ptr.BlockNum != Header.BlockNum) {
- //
- // not for this packet - continue
- //
- Status = EFI_TIMEOUT;
- }
- }
- } while (Status == EFI_TIMEOUT && --Retries);
-
- if (Status != EFI_SUCCESS) {
- return Status;
- }
-
- BufferPtr = (VOID *) ((UINT8 *) (BufferPtr) + TransferLen);
- TransferSize -= TransferLen;
- ++BlockNum;
- Header.BlockNum = HTONS ((UINT16) BlockNum);
- } while (TransferLen == *PacketSizePtr);
-
- return EFI_SUCCESS;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-PxeBcMtftp (
- PXE_BASECODE_DEVICE *Private,
- IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
- UINT64 *BufferSizePtr,
- VOID *BufferPtr,
- EFI_IP_ADDRESS *ServerIpPtr,
- UINT8 *FilenamePtr,
- UINTN *PacketSizePtr,
- IN EFI_PXE_BASE_CODE_MTFTP_INFO *MtftpInfoPtr, OPTIONAL
- IN BOOLEAN Overwrite,
- IN BOOLEAN DontUseBuffer
- )
-/*++
-Routine description:
- MTFTP API entry point
-
-Parameters:
- Private :=
- Operation :=
- BufferSizePtr :=
- BufferPtr :=
- ServerIpPtr :=
- FilenamePtr :=
- PacketSizePtr :=
- MtftpInfoPtr :=
- Overwrite :=
- DontUseBuffer :=
-
-Returns:
- * EFI_INVALID_PARAMETER
- * EFI_OUT_OF_RESOURCES
- * EFI_BAD_BUFFER_SIZE
- * Status is also returned from IpFilter(), TftpInfo(), MtftpDownload(),
- * TftpDownload() and TftpUpload().
---*/
-{
- EFI_PXE_BASE_CODE_IP_FILTER Filter;
- EFI_STATUS StatCode;
- UINT64 BufferSizeLocal;
- UINTN PacketSize;
- UINT8 *BufferPtrLocal;
-
- Filter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP;
- Filter.IpCnt = 0;
- Filter.reserved = 0;
-
- /* No error has occurred, yet. */
- Private->EfiBc.Mode->TftpErrorReceived = FALSE;
-
- /* We must at least have an MTFTP server IP address and
- * a pointer to the buffer size.
- */
- if (!ServerIpPtr || !BufferSizePtr) {
- DEBUG ((EFI_D_WARN, "\nPxeBcMtftp() Exit #1"));
-
- return EFI_INVALID_PARAMETER;
- }
-
- Private->Function = EFI_PXE_BASE_CODE_FUNCTION_MTFTP;
-
- //
- // make sure filter set to unicast at start
- //
- if ((StatCode = IpFilter (Private, &Filter)) != EFI_SUCCESS) {
- DEBUG (
- (EFI_D_NET,
- "\nPxeBcMtftp() Exit IpFilter() == %Xh",
- StatCode)
- );
-
- return StatCode;
- }
- //
- // set unset parms to default values
- //
- if (!PacketSizePtr) {
- *(PacketSizePtr = &PacketSize) = MAX_TFTP_PKT_SIZE;
- }
-
- if (*PacketSizePtr > *BufferSizePtr) {
- *PacketSizePtr = (UINTN) *BufferSizePtr;
- }
-
- if (*PacketSizePtr < MIN_TFTP_PKT_SIZE) {
- *PacketSizePtr = MIN_TFTP_PKT_SIZE;
- }
-
- if (*PacketSizePtr > BUFFER_ALLOCATE_SIZE) {
- *PacketSizePtr = BUFFER_ALLOCATE_SIZE;
- }
-
- if (*PacketSizePtr > MAX_TFTP_PKT_SIZE) {
- *PacketSizePtr = MAX_TFTP_PKT_SIZE;
- }
-
- if (Operation == EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE) {
- StatCode = TftpInfo (
- Private,
- BufferSizePtr,
- ServerIpPtr,
- TftpRequestPort,
- FilenamePtr,
- PacketSizePtr
- );
-
- if (StatCode != EFI_SUCCESS) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxeBcMtftp() Exit TftpInfo() == %Xh",
- StatCode)
- );
- }
-
- return StatCode;
- }
-
- if (Operation == EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE) {
- if (!MtftpInfoPtr || !MtftpInfoPtr->SPort) {
- DEBUG ((EFI_D_WARN, "\nPxeBcMtftp() Exit #2"));
- return EFI_INVALID_PARAMETER;
- } else {
- StatCode = TftpInfo (
- Private,
- BufferSizePtr,
- ServerIpPtr,
- MtftpInfoPtr->SPort,
- FilenamePtr,
- PacketSizePtr
- );
-
- gBS->Stall (10000);
-
- if (StatCode != EFI_SUCCESS) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxeBcMtftp() Exit TftpInfo() == %Xh",
- StatCode)
- );
- }
-
- return StatCode;
- }
- }
-
- if (!BufferPtr && !DontUseBuffer) {
- //
- // if dontusebuffer is false and no buffer???
- //
- DEBUG ((EFI_D_WARN, "\nPxeBcMtftp() Exit #3"));
- //
- // DontUseBuffer can be true only for read_file operation
- //
- return EFI_INVALID_PARAMETER;
- }
-
- if (DontUseBuffer) {
- BufferPtrLocal = AllocatePool (BUFFER_ALLOCATE_SIZE);
- if (BufferPtrLocal == NULL) {
- DEBUG ((EFI_D_NET, "\nPxeBcMtftp() Exit #4"));
- return EFI_OUT_OF_RESOURCES;
- }
-
- BufferSizeLocal = BUFFER_ALLOCATE_SIZE;
- } else {
- if (!*BufferSizePtr && Operation != EFI_PXE_BASE_CODE_TFTP_WRITE_FILE) {
- DEBUG ((EFI_D_WARN, "\nPxeBcMtftp() Exit #5"));
- return EFI_BAD_BUFFER_SIZE;
- }
-
- BufferPtrLocal = BufferPtr;
- BufferSizeLocal = *BufferSizePtr;
- }
-
- switch (Operation) {
- case EFI_PXE_BASE_CODE_MTFTP_READ_FILE:
- if (FilenamePtr == NULL ||
- MtftpInfoPtr == NULL ||
- MtftpInfoPtr->MCastIp.Addr[0] == 0 ||
- MtftpInfoPtr->SPort == 0 ||
- MtftpInfoPtr->CPort == 0 ||
- MtftpInfoPtr->ListenTimeout == 0 ||
- MtftpInfoPtr->TransmitTimeout == 0
- ) {
- StatCode = EFI_INVALID_PARAMETER;
- break;
- }
- //
- // try MTFTP - if fails, drop into TFTP read
- //
- if ((StatCode = MtftpDownload (
- Private,
- &BufferSizeLocal,
- BufferPtrLocal,
- ServerIpPtr,
- FilenamePtr,
- MtftpInfoPtr,
- DontUseBuffer
- )) == EFI_SUCCESS || StatCode == EFI_BUFFER_TOO_SMALL) {
- if (BufferSizePtr /* %% !DontUseBuffer */ ) {
- *BufferSizePtr = BufferSizeLocal;
- }
-
- break;
- }
- //
- // go back to unicast
- //
- if ((StatCode = IpFilter (Private, &Filter)) != EFI_SUCCESS) {
- break;
- }
-
- /* fall thru */
- case EFI_PXE_BASE_CODE_TFTP_READ_FILE:
- if (FilenamePtr == NULL) {
- StatCode = EFI_INVALID_PARAMETER;
- break;
- }
-
- StatCode = TftpDownload (
- Private,
- &BufferSizeLocal,
- BufferPtrLocal,
- ServerIpPtr,
- FilenamePtr,
- PacketSizePtr,
- TftpRequestPort,
- TFTP_RRQ,
- DontUseBuffer
- );
-
- if (StatCode == EFI_SUCCESS || StatCode == EFI_BUFFER_TOO_SMALL) {
- if (BufferSizePtr /* !DontUseBuffer */ ) {
- *BufferSizePtr = BufferSizeLocal;
- }
- }
-
- break;
-
- case EFI_PXE_BASE_CODE_TFTP_WRITE_FILE:
- if (FilenamePtr == NULL || DontUseBuffer) {
- //
- // not a valid option
- //
- StatCode = EFI_INVALID_PARAMETER;
- break;
- }
-
- StatCode = TftpUpload (
- Private,
- BufferSizePtr,
- BufferPtr,
- ServerIpPtr,
- FilenamePtr,
- PacketSizePtr,
- Overwrite
- );
-
- if (StatCode != EFI_SUCCESS) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxeBcMtftp() Exit #6 %xh (%r)",
- StatCode,
- StatCode)
- );
- }
-
- return StatCode;
-
- case EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY:
- if (FilenamePtr == NULL || DontUseBuffer) {
- //
- // not a valid option
- //
- StatCode = EFI_INVALID_PARAMETER;
- break;
- }
-
- StatCode = TftpDownload (
- Private,
- BufferSizePtr,
- BufferPtr,
- ServerIpPtr,
- FilenamePtr,
- PacketSizePtr,
- TftpRequestPort,
- TFTP_DIR,
- DontUseBuffer
- );
-
- if (StatCode != EFI_SUCCESS) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxeBcMtftp() Exit #7 %xh (%r)",
- StatCode,
- StatCode)
- );
- }
-
- return StatCode;
-
- case EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY:
- if (DontUseBuffer) {
- StatCode = EFI_INVALID_PARAMETER;
- break;
- }
-
- if (MtftpInfoPtr == NULL || !MtftpInfoPtr->SPort) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxeBcMtftp() Exit #9 %xh (%r)",
- EFI_INVALID_PARAMETER,
- EFI_INVALID_PARAMETER)
- );
-
- return EFI_INVALID_PARAMETER;
- }
-
- StatCode = TftpDownload (
- Private,
- BufferSizePtr,
- BufferPtr,
- ServerIpPtr,
- (UINT8 *) "/",
- PacketSizePtr,
- MtftpInfoPtr->SPort,
- TFTP_DIR,
- DontUseBuffer
- );
-
- break;
-
- default:
- StatCode = EFI_INVALID_PARAMETER;
- }
-
- if (DontUseBuffer) {
- FreePool (BufferPtrLocal);
- }
-
- if (StatCode != EFI_SUCCESS) {
- DEBUG (
- (EFI_D_WARN,
- "\nPxeBcMtftp() Exit #8 %xh (%r)",
- StatCode,
- StatCode)
- );
- }
-
- gBS->Stall (10000);
-
- return StatCode;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-BcMtftp (
- IN EFI_PXE_BASE_CODE_PROTOCOL * This,
- IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation,
- IN OUT VOID *BufferPtr,
- IN BOOLEAN Overwrite,
- IN OUT UINT64 *BufferSizePtr,
- IN UINTN *BlockSizePtr OPTIONAL,
- IN EFI_IP_ADDRESS * ServerIpPtr,
- IN UINT8 *FilenamePtr,
- IN EFI_PXE_BASE_CODE_MTFTP_INFO * MtftpInfoPtr OPTIONAL,
- IN BOOLEAN DontUseBuffer
- )
-/*++
-Routine description:
- MTFTP API entry point.
-
-Parameters:
- This :=
- Operation :=
- BufferPtr :=
- Overwrite :=
- BufferSizePtr :=
- BlockSizePtr :=
- ServerIpPtr :=
- FilenamePtr :=
- MtftpInfoPtr :=
- DontUseBuffer :=
-
-Returns:
- * EFI_INVALID_PARAMETER
- * Status is also returned from PxeBcMtftp();
---*/
-{
- EFI_PXE_BASE_CODE_IP_FILTER Filter;
- EFI_STATUS StatCode;
- PXE_BASECODE_DEVICE *Private;
-
- //
- // Lock the instance data and make sure started
- //
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE poiner == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- if (This->Mode == NULL || !This->Mode->Started) {
- DEBUG ((EFI_D_ERROR, "BC was not started."));
- EfiReleaseLock (&Private->Lock);
- return EFI_NOT_STARTED;
- }
- //
- // Issue BC command
- //
- Filter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP;
- Filter.IpCnt = 0;
- Filter.reserved = 0;
-
- DEBUG ((EFI_D_WARN, "\nBcMtftp() Op=%d Buf=%Xh", Operation, BufferPtr));
-
- StatCode = PxeBcMtftp (
- Private,
- Operation,
- BufferSizePtr,
- BufferPtr,
- ServerIpPtr,
- FilenamePtr,
- BlockSizePtr,
- MtftpInfoPtr,
- Overwrite,
- DontUseBuffer
- );
-
- //
- // restore to unicast
- //
- IpFilter (Private, &Filter);
-
- //
- // Unlock the instance data
- //
- EfiReleaseLock (&Private->Lock);
- return StatCode;
-}
-
-/* eof - PxeBcMtftp.c */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_udp.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_udp.c
deleted file mode 100644
index a8b9ed0..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_bc_udp.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- pxe_bc_udp.c
-
-Abstract:
-
---*/
-
-
-#include "Bc.h"
-
-//
-// //////////////////////////////////////////////////////////////////////
-//
-// Udp Write Routine - called by base code - e.g. TFTP - already locked
-//
-EFI_STATUS
-UdpWrite (
- IN PXE_BASECODE_DEVICE *Private,
- IN UINT16 OpFlags,
- IN EFI_IP_ADDRESS *DestIpPtr,
- IN EFI_PXE_BASE_CODE_UDP_PORT *DestPortPtr,
- IN EFI_IP_ADDRESS *GatewayIpPtr, OPTIONAL
- IN EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
- IN UINTN *HeaderSizePtr, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN UINTN *BufferSizeptr,
- IN VOID *BufferPtr
- )
-/*++
-Routine description:
- UDP write packet.
-
-Parameters:
- Private := Pointer to PxeBc interface
- OpFlags :=
- DestIpPtr :=
- DestPortPtr :=
- GatewayIpPtr :=
- SrcIpPtr :=
- SrcPortPtr :=
- HeaderSizePtr :=
- HeaderPtr :=
- BufferSizeptr :=
- BufferPtr :=
-
-Returns:
- EFI_SUCCESS :=
- EFI_INVALID_PARAMETER :=
- other :=
---*/
-{
- UINTN TotalLength;
- UINTN HeaderSize;
- EFI_PXE_BASE_CODE_UDP_PORT DefaultSrcPort;
-
- //
- //
- //
- HeaderSize = (HeaderSizePtr != NULL) ? *HeaderSizePtr : 0;
- DefaultSrcPort = 0;
-
- //
- // check parameters
- //
- if (BufferSizeptr == NULL ||
- BufferPtr == NULL ||
- DestIpPtr == NULL ||
- DestPortPtr == NULL ||
- (HeaderSizePtr != NULL && *HeaderSizePtr == 0) ||
- (HeaderSize != 0 && HeaderPtr == NULL) ||
- (GatewayIpPtr != NULL && !IS_INADDR_UNICAST(GatewayIpPtr)) ||
- (OpFlags &~(EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT | EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT))
- ) {
- DEBUG (
- (EFI_D_WARN,
- "\nUdpWrite() Exit #1 %xh (%r)",
- EFI_INVALID_PARAMETER,
- EFI_INVALID_PARAMETER)
- );
-
- return EFI_INVALID_PARAMETER;
- }
-
- TotalLength = *BufferSizeptr + HeaderSize + sizeof (UDPV4_HEADER);
-
- if (TotalLength > 0x0000ffff) {
- DEBUG (
- (EFI_D_WARN,
- "\nUdpWrite() Exit #2 %xh (%r)",
- EFI_BAD_BUFFER_SIZE,
- EFI_BAD_BUFFER_SIZE)
- );
-
- return EFI_BAD_BUFFER_SIZE;
- }
-
- if (SrcIpPtr == NULL) {
- SrcIpPtr = &Private->EfiBc.Mode->StationIp;
- }
-
- if (SrcPortPtr == NULL) {
- SrcPortPtr = &DefaultSrcPort;
- OpFlags |= EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT;
- }
-
- if (OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT) {
- *SrcPortPtr = Private->RandomPort;
-
- if (++Private->RandomPort == 0) {
- Private->RandomPort = PXE_RND_PORT_LOW;
- }
- }
-
-#define IpTxBuffer ((IPV4_BUFFER *) Private->TransmitBufferPtr)
- //
- // build pseudo header and udp header in transmit buffer
- //
-#define Udpv4Base ((UDPV4_HEADERS *) (IpTxBuffer->u.Data - sizeof (UDPV4_PSEUDO_HEADER)))
-
- Udpv4Base->Udpv4PseudoHeader.SrcAddr.L = SrcIpPtr->Addr[0];
- Udpv4Base->Udpv4PseudoHeader.DestAddr.L = DestIpPtr->Addr[0];
- Udpv4Base->Udpv4PseudoHeader.Zero = 0;
- Udpv4Base->Udpv4PseudoHeader.Protocol = PROT_UDP;
- Udpv4Base->Udpv4PseudoHeader.TotalLength = HTONS (TotalLength);
- Udpv4Base->Udpv4Header.SrcPort = HTONS (*SrcPortPtr);
- Udpv4Base->Udpv4Header.DestPort = HTONS (*DestPortPtr);
- Udpv4Base->Udpv4Header.TotalLength = Udpv4Base->Udpv4PseudoHeader.TotalLength;
- Udpv4Base->Udpv4Header.Checksum = 0;
-
- if (HeaderSize != 0) {
- CopyMem (IpTxBuffer->u.Udp.Data, HeaderPtr, HeaderSize);
- }
-
- HeaderSize += sizeof (UDPV4_HEADER);
-
- Udpv4Base->Udpv4Header.Checksum = IpChecksum2 (
- (UINT16 *) Udpv4Base,
- HeaderSize + sizeof (UDPV4_PSEUDO_HEADER),
- (UINT16 *) BufferPtr,
- (UINT16) *BufferSizeptr
- );
-
- if (Udpv4Base->Udpv4Header.Checksum == 0) {
- Udpv4Base->Udpv4Header.Checksum = 0xffff;
- //
- // transmit zero checksum as ones complement
- //
- }
-
- return Ip4Send (
- Private,
- OpFlags,
- PROT_UDP,
- Udpv4Base->Udpv4PseudoHeader.SrcAddr.L,
- Udpv4Base->Udpv4PseudoHeader.DestAddr.L,
- (GatewayIpPtr) ? GatewayIpPtr->Addr[0] : 0,
- HeaderSize,
- BufferPtr,
- *BufferSizeptr
- );
-}
-//
-// //////////////////////////////////////////////////////////
-//
-// BC Udp Write Routine
-//
-EFI_STATUS
-EFIAPI
-BcUdpWrite (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN UINT16 OpFlags,
- IN EFI_IP_ADDRESS *DestIpPtr,
- IN EFI_PXE_BASE_CODE_UDP_PORT *DestPortPtr,
- IN EFI_IP_ADDRESS *GatewayIpPtr, OPTIONAL
- IN EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
- IN UINTN *HeaderSizePtr, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN UINTN *BufferSizeptr,
- IN VOID *BufferPtr
- )
-/*++
-Routine description:
- UDP write API entry point.
-
-Parameters:
- This := Pointer to PxeBc interface.
- OpFlags :=
- DestIpPtr :=
- DestPortPtr :=
- GatewayIpPtr :=
- SrcIpPtr :=
- SrcPortPtr :=
- HeaderSizePtr :=
- HeaderPtr :=
- BufferSizeptr :=
- BufferPtr :=
-
-Returns:
- EFI_SUCCESS :=
- other :=
---*/
-{
- EFI_STATUS StatCode;
- PXE_BASECODE_DEVICE *Private;
-
- //
- // Lock the instance data and make sure started
- //
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE poiner == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- if (This->Mode == NULL || !This->Mode->Started) {
- DEBUG ((EFI_D_ERROR, "BC was not started."));
- EfiReleaseLock (&Private->Lock);
- return EFI_NOT_STARTED;
- }
-
- Private->Function = EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE;
-
- //
- // Issue BC command
- //
- StatCode = UdpWrite (
- Private,
- OpFlags,
- DestIpPtr,
- DestPortPtr,
- GatewayIpPtr,
- SrcIpPtr,
- SrcPortPtr,
- HeaderSizePtr,
- HeaderPtr,
- BufferSizeptr,
- BufferPtr
- );
-
- //
- // Unlock the instance data
- //
- EfiReleaseLock (&Private->Lock);
- return StatCode;
-}
-//
-// /////////////////////////////////////////////////////////////////////
-//
-// Udp Read Routine - called by base code - e.g. TFTP - already locked
-//
-EFI_STATUS
-UdpRead (
- IN PXE_BASECODE_DEVICE *Private,
- IN UINT16 OpFlags,
- IN OUT EFI_IP_ADDRESS *DestIpPtr, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPortPtr, OPTIONAL
- IN OUT EFI_IP_ADDRESS *SrcIpPtr, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPortPtr, OPTIONAL
- IN UINTN *HeaderSizePtr, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN OUT UINTN *BufferSizeptr,
- IN VOID *BufferPtr,
- EFI_EVENT TimeoutEvent
- )
-/*++
-Routine description:
- UDP read packet.
-
-Parameters:
- Private := Pointer to PxeBc interface
- OpFlags :=
- DestIpPtr :=
- DestPortPtr :=
- SrcIpPtr :=
- SrcPortPtr :=
- HeaderSizePtr :=
- HeaderPtr :=
- BufferSizeptr :=
- BufferPtr :=
- TimeoutEvent :=
-
-Returns:
- EFI_SUCCESS :=
- EFI_INVALID_PARAMETER :=
- other :=
---*/
-{
- EFI_STATUS StatCode;
- EFI_IP_ADDRESS TmpSrcIp;
- EFI_IP_ADDRESS TmpDestIp;
- UINTN BufferSize;
- UINTN HeaderSize;
-
- //
- // combination structure of pseudo header/udp header
- //
-#pragma pack (1)
- struct {
- UDPV4_PSEUDO_HEADER Udpv4PseudoHeader;
- UDPV4_HEADER Udpv4Header;
- UINT8 ProtHdr[64];
- } Hdrs;
-#pragma pack ()
-
- HeaderSize = (HeaderSizePtr != NULL) ? *HeaderSizePtr : 0;
- //
- // read [with filtering]
- // check parameters
- //
- if (BufferSizeptr == NULL ||
- BufferPtr == NULL ||
- (HeaderSize != 0 && HeaderPtr == NULL) ||
- (OpFlags &~UDP_FILTER_MASK)
- //
- // if filtering on a particular IP/Port, need it
- //
- ||
- (!(OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP) && SrcIpPtr == NULL) ||
- (!(OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT) && SrcPortPtr == NULL) ||
- (!(OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT) && DestPortPtr == NULL)
- ) {
- DEBUG ((EFI_D_INFO, "\nUdpRead() Exit #1 Invalid Parameter"));
- return EFI_INVALID_PARAMETER;
- }
-
- //
- // in case we loop
- //
- BufferSize = *BufferSizeptr;
- //
- // we need source and dest IPs for pseudo header
- //
- if (SrcIpPtr == NULL) {
- SrcIpPtr = &TmpSrcIp;
- }
-
- if (DestIpPtr == NULL) {
- DestIpPtr = &TmpDestIp;
- CopyMem (&TmpDestIp, &Private->EfiBc.Mode->StationIp, sizeof (TmpDestIp));
- }
-
- for (;;) {
- *BufferSizeptr = BufferSize;
-
- StatCode = IpReceive (
- Private,
- OpFlags,
- SrcIpPtr,
- DestIpPtr,
- PROT_UDP,
- &Hdrs.Udpv4Header,
- HeaderSize + sizeof Hdrs.Udpv4Header,
- BufferPtr,
- BufferSizeptr,
- TimeoutEvent
- );
-
- if (StatCode == EFI_SUCCESS || StatCode == EFI_BUFFER_TOO_SMALL) {
- UINT16 SPort;
- UINT16 DPort;
-
- SPort = NTOHS (Hdrs.Udpv4Header.SrcPort);
- DPort = NTOHS (Hdrs.Udpv4Header.DestPort);
-
- //
- // do filtering
- //
- if (!(OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT) && *SrcPortPtr != SPort) {
- continue;
- }
-
- if (!(OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT) && *DestPortPtr != DPort) {
- continue;
- }
- //
- // check checksum
- //
- if (StatCode == EFI_SUCCESS && Hdrs.Udpv4Header.Checksum) {
- Hdrs.Udpv4PseudoHeader.SrcAddr.L = SrcIpPtr->Addr[0];
- Hdrs.Udpv4PseudoHeader.DestAddr.L = DestIpPtr->Addr[0];
- Hdrs.Udpv4PseudoHeader.Zero = 0;
- Hdrs.Udpv4PseudoHeader.Protocol = PROT_UDP;
- Hdrs.Udpv4PseudoHeader.TotalLength = Hdrs.Udpv4Header.TotalLength;
-
- if (Hdrs.Udpv4Header.Checksum == 0xffff) {
- Hdrs.Udpv4Header.Checksum = 0;
- }
-
- if (IpChecksum2 (
- (UINT16 *) &Hdrs.Udpv4PseudoHeader,
- HeaderSize + sizeof (Hdrs.Udpv4PseudoHeader) + sizeof (Hdrs.Udpv4Header),
- (UINT16 *) BufferPtr,
- *BufferSizeptr
- )) {
- DEBUG (
- (EFI_D_INFO,
- "\nUdpRead() Hdrs.Udpv4PseudoHeader == %Xh",
- &Hdrs.Udpv4PseudoHeader)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nUdpRead() Header size == %d",
- HeaderSize + sizeof (Hdrs.Udpv4PseudoHeader))
- );
- DEBUG (
- (EFI_D_INFO,
- "\nUdpRead() BufferPtr == %Xh",
- BufferPtr)
- );
- DEBUG (
- (EFI_D_INFO,
- "\nUdpRead() Buffer size == %d",
- *BufferSizeptr)
- );
- DEBUG ((EFI_D_INFO, "\nUdpRead() Exit #2 Device Error"));
- return EFI_DEVICE_ERROR;
- }
- }
- //
- // all passed
- //
- if (SrcPortPtr != NULL) {
- *SrcPortPtr = SPort;
- }
-
- if (DestPortPtr != NULL) {
- *DestPortPtr = DPort;
- }
-
- if (HeaderSize != 0) {
- CopyMem (HeaderPtr, Hdrs.ProtHdr, HeaderSize);
- }
- }
-
- if ((StatCode != EFI_SUCCESS) && (StatCode != EFI_TIMEOUT)) {
- DEBUG (
- (EFI_D_INFO,
- "\nUdpRead() Exit #3 %Xh %r",
- StatCode,
- StatCode)
- );
- }
-
- return StatCode;
- }
-}
-//
-// //////////////////////////////////////////////////////////
-//
-// BC Udp Read Routine
-//
-EFI_STATUS
-EFIAPI
-BcUdpRead (
- IN EFI_PXE_BASE_CODE_PROTOCOL *This,
- IN UINT16 OpFlags,
- IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL
- IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL
- IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL
- IN UINTN *HeaderSize, OPTIONAL
- IN VOID *HeaderPtr, OPTIONAL
- IN OUT UINTN *BufferSize,
- IN VOID *BufferPtr
- )
-/*++
-Routine description:
- UDP read API entry point.
-
-Parameters:
- This := Pointer to PxeBc interface.
- OpFlags :=
- DestIpPtr :=
- DestPortPtr :=
- SrcIpPtr :=
- SrcPortPtr :=
- HeaderSizePtr :=
- HeaderPtr :=
- BufferSizeptr :=
- BufferPtr :=
-
-Returns:
- EFI_SUCCESS :=
- other :=
---*/
-{
- EFI_STATUS StatCode;
- PXE_BASECODE_DEVICE *Private;
-
- //
- // Lock the instance data and make sure started
- //
- StatCode = EFI_SUCCESS;
-
- if (This == NULL) {
- DEBUG ((EFI_D_ERROR, "BC *This pointer == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- Private = CR (This, PXE_BASECODE_DEVICE, EfiBc, PXE_BASECODE_DEVICE_SIGNATURE);
-
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "PXE_BASECODE_DEVICE poiner == NULL"));
- return EFI_INVALID_PARAMETER;
- }
-
- EfiAcquireLock (&Private->Lock);
-
- if (This->Mode == NULL || !This->Mode->Started) {
- DEBUG ((EFI_D_ERROR, "BC was not started."));
- EfiReleaseLock (&Private->Lock);
- return EFI_NOT_STARTED;
- }
-
- Private->Function = EFI_PXE_BASE_CODE_FUNCTION_UDP_READ;
-
- //
- // Issue BC command
- //
- StatCode = UdpRead (
- Private,
- OpFlags,
- DestIp,
- DestPort,
- SrcIp,
- SrcPort,
- HeaderSize,
- HeaderPtr,
- BufferSize,
- BufferPtr,
- 0
- );
-
- //
- // Unlock the instance data and return
- //
- EfiReleaseLock (&Private->Lock);
- return StatCode;
-}
-
-/* eof - pxe_bc_udp.c */
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_loadfile.c b/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_loadfile.c
deleted file mode 100644
index 20ae95d..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/pxe_loadfile.c
+++ /dev/null
@@ -1,1657 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- pxe_loadfile.c
-
-Abstract:
- An implementation of the load file protocol for network devices.
-
---*/
-
-
-#include "Bc.h"
-
-#define DO_MENU (EFI_SUCCESS)
-#define NO_MENU (DO_MENU + 1)
-#define LOCAL_BOOT (EFI_ABORTED)
-#define AUTO_SELECT (NO_MENU)
-
-#define NUMBER_ROWS 25 // we set to mode 0
-#define MAX_MENULIST 23
-
-#define Ctl(x) (0x1F & (x))
-
-typedef union {
- DHCPV4_OP_STRUCT *OpPtr;
- PXE_BOOT_MENU_ENTRY *CurrentMenuItemPtr;
- PXE_OP_DISCOVERY_CONTROL *DiscCtlOpStr;
- PXE_OP_BOOT_MENU *MenuPtr;
- UINT8 *BytePtr;
-} UNION_PTR;
-
-
-STATIC
-EFI_PXE_BASE_CODE_CALLBACK_STATUS
-EFIAPI
-bc_callback (
- IN EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL * This,
- IN EFI_PXE_BASE_CODE_FUNCTION Function,
- IN BOOLEAN Received,
- IN UINT32 PacketLength,
- IN EFI_PXE_BASE_CODE_PACKET * PacketPtr OPTIONAL
- )
-/*++
-
-Routine Description:
-
- PxeBc callback routine for status updates and aborts.
-
-Arguments:
-
- This - Pointer to PxeBcCallback interface
- Function - PxeBc function ID#
- Received - Receive/transmit flag
- PacketLength - Length of received packet (0 == idle callback)
- PacketPtr - Pointer to received packet (NULL == idle callback)
-
-Returns:
-
- EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE -
- EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT -
-
---*/
-{
- STATIC UINTN Propeller;
-
- EFI_INPUT_KEY Key;
- UINTN Row;
- UINTN Col;
-
- Propeller = 0;
- //
- // Resolve Warning 4 unreferenced parameter problem
- //
- This = This;
-
- //
- // Check for user abort.
- //
- if (gST->ConIn->ReadKeyStroke (gST->ConIn, &Key) == EFI_SUCCESS) {
- if (!Key.ScanCode) {
- if (Key.UnicodeChar == Ctl ('c')) {
- return EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT;
- }
- } else if (Key.ScanCode == SCAN_ESC) {
- return EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT;
- }
- }
- //
- // Do nothing if this is a receive.
- //
- if (Received) {
- return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE;
- }
- //
- // The display code is only for these functions.
- //
- switch (Function) {
- case EFI_PXE_BASE_CODE_FUNCTION_MTFTP:
- //
- // If this is a transmit and not a M/TFTP open request,
- // return now. Do not print a dot for each M/TFTP packet
- // that is sent, only for the open packets.
- //
- if (PacketLength != 0 && PacketPtr != NULL) {
- if (PacketPtr->Raw[0x1C] != 0x00 || PacketPtr->Raw[0x1D] != 0x01) {
- return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE;
- }
- }
-
- break;
-
- case EFI_PXE_BASE_CODE_FUNCTION_DHCP:
- case EFI_PXE_BASE_CODE_FUNCTION_DISCOVER:
- break;
-
- default:
- return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE;
- }
- //
- // Display routines
- //
- if (PacketLength != 0 && PacketPtr != NULL) {
- //
- // Display a '.' when a packet is transmitted.
- //
- AsciiPrint (".");
- } else if (PacketLength == 0 && PacketPtr == NULL) {
- //
- // Display a propeller when waiting for packets if at
- // least 200 ms have passed.
- //
- Row = gST->ConOut->Mode->CursorRow;
- Col = gST->ConOut->Mode->CursorColumn;
-
- AsciiPrint ("%c", "/-\\|"[Propeller]);
- gST->ConOut->SetCursorPosition (gST->ConOut, Col, Row);
-
- Propeller = (Propeller + 1) & 3;
- }
-
- return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE;
-}
-
-STATIC EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL _bc_callback = {
- EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION,
- &bc_callback
-};
-
-STATIC
-VOID
-PrintIpv4 (
- UINT8 *Ptr
- )
-/*++
-
-Routine Description:
-
- Display an IPv4 address in dot notation.
-
-Arguments:
-
- Ptr - Pointer to IPv4 address.
-
-Returns:
-
- None
-
---*/
-{
- if (Ptr != NULL) {
- AsciiPrint ("%d.%d.%d.%d", Ptr[0], Ptr[1], Ptr[2], Ptr[3]);
- }
-}
-
-STATIC
-VOID
-ShowMyInfo (
- IN PXE_BASECODE_DEVICE *Private
- )
-/*++
-
-Routine Description:
-
- Display client and server IP information.
-
-Arguments:
-
- Private - Pointer to PxeBc interface
-
-Returns:
-
- None
-
---*/
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- UINTN Index;
-
- //
- // Do nothing if a NULL pointer is passed in.
- //
- if (Private == NULL) {
- return ;
- }
- //
- // Get pointer to PXE BaseCode mode structure
- //
- PxeBcMode = Private->EfiBc.Mode;
-
- //
- // Display client IP address
- //
- AsciiPrint ("\rCLIENT IP: ");
- PrintIpv4 (PxeBcMode->StationIp.v4.Addr);
-
- //
- // Display subnet mask
- //
- AsciiPrint (" MASK: ");
- PrintIpv4 (PxeBcMode->SubnetMask.v4.Addr);
-
- //
- // Display DHCP and proxyDHCP IP addresses
- //
- if (PxeBcMode->ProxyOfferReceived) {
- AsciiPrint ("\nDHCP IP: ");
- PrintIpv4 (((DHCPV4_OP_SERVER_IP *) DHCPV4_ACK_BUFFER.OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1])->Ip.Addr);
-
- AsciiPrint (" PROXY IP: ");
- PrintIpv4 (((DHCPV4_OP_SERVER_IP *) PXE_OFFER_BUFFER.OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1])->Ip.Addr);
- } else {
- AsciiPrint (" DHCP IP: ");
- PrintIpv4 (((DHCPV4_OP_SERVER_IP *) DHCPV4_ACK_BUFFER.OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1])->Ip.Addr);
- }
- //
- // Display gateway IP addresses
- //
- for (Index = 0; Index < PxeBcMode->RouteTableEntries; ++Index) {
- if ((Index % 3) == 0) {
- AsciiPrint ("\r\nGATEWAY IP:");
- }
-
- AsciiPrint (" ");
- PrintIpv4 (PxeBcMode->RouteTable[Index].GwAddr.v4.Addr);
- AsciiPrint (" ");
- }
-
- AsciiPrint ("\n");
-}
-
-STATIC
-EFI_STATUS
-DoPrompt (
- PXE_BASECODE_DEVICE *Private,
- PXE_OP_BOOT_PROMPT *BootPromptPtr
- )
-/*++
-
-Routine Description:
-
- Display prompt and wait for input.
-
-Arguments:
-
- Private - Pointer to PxeBc interface
- BootPromptPtr - Pointer to PXE boot prompt option
-
-Returns:
-
- AUTO_SELECT -
- DO_MENU -
- NO_MENU -
- LOCAL_BOOT -
-
---*/
-{
- EFI_STATUS Status;
- EFI_EVENT TimeoutEvent;
- EFI_EVENT SecondsEvent;
- INT32 SecColumn;
- INT32 SecRow;
- UINT8 SaveChar;
- UINT8 SecsLeft;
-
- //
- // if auto select, just get right to it
- //
- if (BootPromptPtr->Timeout == PXE_BOOT_PROMPT_AUTO_SELECT) {
- return AUTO_SELECT;
- }
- //
- // if no timeout, go directly to display of menu
- //
- if (BootPromptPtr->Timeout == PXE_BOOT_PROMPT_NO_TIMEOUT) {
- return DO_MENU;
- }
- //
- //
- //
- Status = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &TimeoutEvent
- );
-
- if (EFI_ERROR (Status)) {
- return DO_MENU;
- }
-
- Status = gBS->SetTimer (
- TimeoutEvent,
- TimerRelative,
- BootPromptPtr->Timeout * 10000000 + 100000
- );
-
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (TimeoutEvent);
- return DO_MENU;
- }
- //
- //
- //
- Status = gBS->CreateEvent (
- EVT_TIMER,
- TPL_CALLBACK,
- NULL,
- NULL,
- &SecondsEvent
- );
-
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (TimeoutEvent);
- return DO_MENU;
- }
-
- Status = gBS->SetTimer (
- SecondsEvent,
- TimerPeriodic,
- 10000000
- ); /* 1 second */
-
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (SecondsEvent);
- gBS->CloseEvent (TimeoutEvent);
- return DO_MENU;
- }
- //
- // display the prompt
- // IMPORTANT! This prompt is an ASCII character string that may
- // not be terminated with a NULL byte.
- //
- SaveChar = BootPromptPtr->Prompt[BootPromptPtr->Header.Length - 1];
- BootPromptPtr->Prompt[BootPromptPtr->Header.Length - 1] = 0;
-
- AsciiPrint ("%a ", BootPromptPtr->Prompt);
- BootPromptPtr->Prompt[BootPromptPtr->Header.Length - 1] = SaveChar;
-
- //
- // wait until time expires or selection made - menu or local
- //
- SecColumn = gST->ConOut->Mode->CursorColumn;
- SecRow = gST->ConOut->Mode->CursorRow;
- SecsLeft = BootPromptPtr->Timeout;
-
- gST->ConOut->SetCursorPosition (gST->ConOut, SecColumn, SecRow);
- AsciiPrint ("(%d) ", SecsLeft);
-
- //
- // set the default action to be AUTO_SELECT
- //
- Status = AUTO_SELECT;
-
- while (EFI_ERROR (gBS->CheckEvent (TimeoutEvent))) {
- EFI_INPUT_KEY Key;
-
- if (!EFI_ERROR (gBS->CheckEvent (SecondsEvent))) {
- --SecsLeft;
- gST->ConOut->SetCursorPosition (gST->ConOut, SecColumn, SecRow);
- AsciiPrint ("(%d) ", SecsLeft);
- }
-
- if (gST->ConIn->ReadKeyStroke (gST->ConIn, &Key) == EFI_NOT_READY) {
- UINT8 Buffer[512];
- UINTN BufferSize;
-
- BufferSize = sizeof Buffer;
-
- Private->EfiBc.UdpRead (
- &Private->EfiBc,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP |
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT |
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT,
- NULL, /* dest ip */
- NULL, /* dest port */
- NULL, /* src ip */
- NULL, /* src port */
- NULL, /* hdr size */
- NULL, /* hdr ptr */
- &BufferSize,
- Buffer
- );
-
- continue;
- }
-
- if (Key.ScanCode == 0) {
- switch (Key.UnicodeChar) {
- case Ctl ('c'):
- Status = LOCAL_BOOT;
- break;
-
- case Ctl ('m'):
- case 'm':
- case 'M':
- Status = DO_MENU;
- break;
-
- default:
- continue;
- }
- } else {
- switch (Key.ScanCode) {
- case SCAN_F8:
- Status = DO_MENU;
- break;
-
- case SCAN_ESC:
- Status = LOCAL_BOOT;
- break;
-
- default:
- continue;
- }
- }
-
- break;
- }
-
- gBS->CloseEvent (SecondsEvent);
- gBS->CloseEvent (TimeoutEvent);
-
- gST->ConOut->SetCursorPosition (gST->ConOut, SecColumn, SecRow);
- AsciiPrint (" ");
-
- return Status;
-}
-
-STATIC
-VOID
-PrintMenuItem (
- PXE_BOOT_MENU_ENTRY *MenuItemPtr
- )
-/*++
-
-Routine Description:
-
- Display one menu item.
-
-Arguments:
-
- MenuItemPtr - Pointer to PXE menu item option.
-
-Returns:
-
- None
-
---*/
-{
- UINT8 Length;
- UINT8 SaveChar;
-
- Length = (UINT8) EFI_MIN (70, MenuItemPtr->DataLen);
- SaveChar = MenuItemPtr->Data[Length];
-
- MenuItemPtr->Data[Length] = 0;
- AsciiPrint (" %a\n", MenuItemPtr->Data);
- MenuItemPtr->Data[Length] = SaveChar;
-}
-
-STATIC
-EFI_STATUS
-DoMenu (
- PXE_BASECODE_DEVICE *Private,
- DHCP_RECEIVE_BUFFER *RxBufferPtr
- )
-/*++
-
-Routine Description:
-
- Display and process menu.
-
-Arguments:
-
- Private - Pointer to PxeBc interface
- RxBufferPtr - Pointer to receive buffer
-
-Returns:
-
- NO_MENU -
- LOCAL_BOOT -
-
---*/
-{
- PXE_OP_DISCOVERY_CONTROL *DiscoveryControlPtr;
- PXE_BOOT_MENU_ENTRY *MenuItemPtrs[MAX_MENULIST];
- EFI_STATUS Status;
- UNION_PTR Ptr;
- UINTN SaveNumRte;
- UINTN TopRow;
- UINTN MenuLth;
- UINTN NumMenuItems;
- UINTN Index;
- UINTN Longest;
- UINTN Selected;
- UINT16 Type;
- UINT16 Layer;
- BOOLEAN Done;
-
- Selected = 0;
- Layer = 0;
-
- DEBUG ((EFI_D_WARN, "\nDoMenu() Enter."));
-
- /* see if we have a menu/prompt */
- if (!(RxBufferPtr->OpAdds.Status & DISCOVER_TYPE)) {
- DEBUG (
- (EFI_D_WARN,
- "\nDoMenu() No menu/prompt info. OpAdds.Status == %xh ",
- RxBufferPtr->OpAdds.Status)
- );
-
- return NO_MENU;
- }
-
- DiscoveryControlPtr = (PXE_OP_DISCOVERY_CONTROL *) RxBufferPtr->OpAdds.PxeOptAdds[VEND_PXE_DISCOVERY_CONTROL_IX - 1];
-
- //
- // if not USE_BOOTFILE or no bootfile given, must have menu stuff
- //
- if ((DiscoveryControlPtr->ControlBits & USE_BOOTFILE) && RxBufferPtr->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]) {
- DEBUG ((EFI_D_WARN, "\nDoMenu() DHCP w/ bootfile. "));
- return NO_MENU;
- }
- //
- // do prompt & menu if necessary
- //
- Status = DoPrompt (Private, (PXE_OP_BOOT_PROMPT *) RxBufferPtr->OpAdds.PxeOptAdds[VEND_PXE_BOOT_PROMPT_IX - 1]);
-
- if (Status == LOCAL_BOOT) {
- DEBUG ((EFI_D_WARN, "\nDoMenu() DoPrompt() returned LOCAL_BOOT. "));
-
- return Status;
- }
-
- Ptr.BytePtr = (UINT8 *) RxBufferPtr->OpAdds.PxeOptAdds[VEND_PXE_BOOT_MENU_IX - 1];
-
- MenuLth = Ptr.MenuPtr->Header.Length;
- Ptr.CurrentMenuItemPtr = Ptr.MenuPtr->MenuItem;
-
- //
- // build menu items array
- //
- for (Longest = NumMenuItems = Index = 0; Index < MenuLth && NumMenuItems < MAX_MENULIST;) {
- UINTN lth;
-
- lth = Ptr.CurrentMenuItemPtr->DataLen + sizeof (*Ptr.CurrentMenuItemPtr) - sizeof (Ptr.CurrentMenuItemPtr->Data);
-
- MenuItemPtrs[NumMenuItems++] = Ptr.CurrentMenuItemPtr;
-
- if (lth > Longest) {
- //
- // check if too long
- //
- if ((Longest = lth) > 70 + (sizeof (*Ptr.CurrentMenuItemPtr) - sizeof (Ptr.CurrentMenuItemPtr->Data))) {
- Longest = 70 + (sizeof (*Ptr.CurrentMenuItemPtr) - sizeof (Ptr.CurrentMenuItemPtr->Data));
- }
- }
-
- Index += lth;
- Ptr.BytePtr += lth;
- }
-
- if (Status != AUTO_SELECT) {
- UINT8 BlankBuf[75];
-
- SetMem (BlankBuf, sizeof BlankBuf, ' ');
- BlankBuf[Longest + 5 - (sizeof (*Ptr.CurrentMenuItemPtr) - sizeof (Ptr.CurrentMenuItemPtr->Data))] = 0;
- AsciiPrint ("\n");
-
- //
- // now put up menu
- //
- for (Index = 0; Index < NumMenuItems; ++Index) {
- PrintMenuItem (MenuItemPtrs[Index]);
- }
-
- TopRow = gST->ConOut->Mode->CursorRow - NumMenuItems;
-
- //
- // now wait for a selection
- //
- Done = FALSE;
- do {
- //
- // highlight selection
- //
- EFI_INPUT_KEY Key;
- UINTN NewSelected;
-
- NewSelected = Selected;
-
- //
- // highlight selected row
- //
- gST->ConOut->SetAttribute (
- gST->ConOut,
- EFI_TEXT_ATTR (EFI_BLACK, EFI_LIGHTGRAY)
- );
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, TopRow + Selected);
-
- AsciiPrint (" --->%a\r", BlankBuf);
-
- PrintMenuItem (MenuItemPtrs[Selected]);
- gST->ConOut->SetAttribute (
- gST->ConOut,
- EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK)
- );
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, TopRow + NumMenuItems);
-
- //
- // wait for a keystroke
- //
- while (gST->ConIn->ReadKeyStroke (gST->ConIn, &Key) == EFI_NOT_READY) {
- UINT8 TmpBuf[512];
- UINTN TmpBufLen;
-
- TmpBufLen = sizeof TmpBuf;
-
- Private->EfiBc.UdpRead (
- &Private->EfiBc,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP |
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT |
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT,
- NULL, /* dest ip */
- NULL, /* dest port */
- NULL, /* src ip */
- NULL, /* src port */
- NULL, /* hdr size */
- NULL, /* hdr ptr */
- &TmpBufLen,
- TmpBuf
- );
- }
-
- if (!Key.ScanCode) {
- switch (Key.UnicodeChar) {
- case Ctl ('c'):
- Key.ScanCode = SCAN_ESC;
- break;
-
- case Ctl ('j'): /* linefeed */
- case Ctl ('m'): /* return */
- Done = TRUE;
- break;
-
- case Ctl ('i'): /* tab */
- case ' ':
- case 'd':
- case 'D':
- Key.ScanCode = SCAN_DOWN;
- break;
-
- case Ctl ('h'): /* backspace */
- case 'u':
- case 'U':
- Key.ScanCode = SCAN_UP;
- break;
-
- default:
- Key.ScanCode = 0;
- }
- }
-
- switch (Key.ScanCode) {
- case SCAN_LEFT:
- case SCAN_UP:
- if (NewSelected) {
- --NewSelected;
- }
-
- break;
-
- case SCAN_DOWN:
- case SCAN_RIGHT:
- if (++NewSelected == NumMenuItems) {
- --NewSelected;
- }
-
- break;
-
- case SCAN_PAGE_UP:
- case SCAN_HOME:
- NewSelected = 0;
- break;
-
- case SCAN_PAGE_DOWN:
- case SCAN_END:
- NewSelected = NumMenuItems - 1;
- break;
-
- case SCAN_ESC:
- return LOCAL_BOOT;
- }
-
- /* unhighlight last selected row */
- gST->ConOut->SetCursorPosition (gST->ConOut, 5, TopRow + Selected);
-
- AsciiPrint ("%a\r", BlankBuf);
-
- PrintMenuItem (MenuItemPtrs[Selected]);
-
- Selected = NewSelected;
- } while (!Done);
- }
-
- SaveNumRte = Private->EfiBc.Mode->RouteTableEntries;
-
- Type = NTOHS (MenuItemPtrs[Selected]->Type);
-
- if (Type == 0) {
- DEBUG ((EFI_D_WARN, "\nDoMenu() Local boot selected. "));
- return LOCAL_BOOT;
- }
-
- AsciiPrint ("Discover");
-
- Status = Private->EfiBc.Discover (
- &Private->EfiBc,
- Type,
- &Layer,
- (BOOLEAN) (Private->EfiBc.Mode->BisSupported && Private->EfiBc.Mode->BisDetected),
- 0
- );
-
- if (EFI_ERROR (Status)) {
- AsciiPrint ("\r \r");
-
- DEBUG (
- (EFI_D_WARN,
- "\nDoMenu() Return w/ %xh (%r).",
- Status,
- Status)
- );
-
- return Status;
- }
-
- AsciiPrint ("\rBOOT_SERVER_IP: ");
- PrintIpv4 ((UINT8 *) &Private->ServerIp);
-
- for (Index = SaveNumRte; Index < Private->EfiBc.Mode->RouteTableEntries; ++Index) {
- if ((Index % 3) == 0) {
- AsciiPrint ("\r\nGATEWAY IP:");
- }
-
- AsciiPrint (" ");
- PrintIpv4 ((UINT8 *) &Private->EfiBc.Mode->RouteTable[Index].GwAddr);
- AsciiPrint (" ");
- }
-
- AsciiPrint ("\n");
-
- DEBUG ((EFI_D_WARN, "\nDoMenu() Return w/ EFI_SUCCESS. "));
-
- return EFI_SUCCESS;
-}
-
-STATIC
-UINT16
-GetValue (
- DHCPV4_OP_STRUCT *OpPtr
- )
-/*++
-
-Routine Description:
-
- Get value 8- or 16-bit value from DHCP option.
-
-Arguments:
-
- OpPtr - Pointer to DHCP option
-
-Returns:
-
- Value from DHCP option
-
---*/
-{
- if (OpPtr->Header.Length == 1) {
- return OpPtr->Data[0];
- } else {
- return NTOHS (OpPtr->Data);
- }
-}
-
-STATIC
-UINT8 *
-_PxeBcFindOpt (
- UINT8 *BufferPtr,
- UINTN BufferLen,
- UINT8 OpCode
- )
-/*++
-
-Routine Description:
-
- Locate opcode in buffer.
-
-Arguments:
-
- BufferPtr - Pointer to buffer
- BufferLen - Length of buffer
- OpCode - Option number
-
-Returns:
-
- Pointer to opcode, may be NULL
-
---*/
-{
- if (BufferPtr == NULL) {
- return NULL;
- }
-
- while (BufferLen != 0) {
- if (*BufferPtr == OpCode) {
- return BufferPtr;
- }
-
- switch (*BufferPtr) {
- case OP_END:
- return NULL;
-
- case OP_PAD:
- ++BufferPtr;
- --BufferLen;
- continue;
- }
-
- if ((UINTN) BufferLen <= (UINTN) 2 + BufferPtr[1]) {
- return NULL;
- }
-
- BufferLen -= 2 + BufferPtr[1];
- BufferPtr += 2 + BufferPtr[1];
- }
-
- return NULL;
-}
-
-STATIC
-UINT8 *
-PxeBcFindDhcpOpt (
- EFI_PXE_BASE_CODE_PACKET *PacketPtr,
- UINT8 OpCode
- )
-/*++
-
-Routine Description:
-
- Find option in packet
-
-Arguments:
-
- PacketPtr - Pointer to packet
- OpCode - option number
-
-Returns:
-
- Pointer to option in packet
-
---*/
-{
- UINTN PacketLen;
- UINT8 Overload;
- UINT8 *OptionBufferPtr;
-
- //
- //
- //
- PacketLen = 380;
- Overload = 0;
-
- //
- // Figure size of DHCP option space.
- //
- OptionBufferPtr = _PxeBcFindOpt (
- PacketPtr->Dhcpv4.DhcpOptions,
- 380,
- OP_DHCP_MAX_MESSAGE_SZ
- );
-
- if (OptionBufferPtr != NULL) {
- if (OptionBufferPtr[1] == 2) {
- UINT16 n;
-
- CopyMem (&n, &OptionBufferPtr[2], 2);
- PacketLen = HTONS (n);
-
- if (PacketLen < sizeof (EFI_PXE_BASE_CODE_DHCPV4_PACKET)) {
- PacketLen = 380;
- } else {
- PacketLen -= (PacketPtr->Dhcpv4.DhcpOptions - &PacketPtr->Dhcpv4.BootpOpcode) + 28;
- }
- }
- }
- //
- // Look for option overloading.
- //
- OptionBufferPtr = _PxeBcFindOpt (
- PacketPtr->Dhcpv4.DhcpOptions,
- PacketLen,
- OP_DHCP_OPTION_OVERLOAD
- );
-
- if (OptionBufferPtr != NULL) {
- if (OptionBufferPtr[1] == 1) {
- Overload = OptionBufferPtr[2];
- }
- }
- //
- // Look for caller's option.
- //
- OptionBufferPtr = _PxeBcFindOpt (
- PacketPtr->Dhcpv4.DhcpOptions,
- PacketLen,
- OpCode
- );
-
- if (OptionBufferPtr != NULL) {
- return OptionBufferPtr;
- }
-
- if (Overload & OVLD_FILE) {
- OptionBufferPtr = _PxeBcFindOpt (PacketPtr->Dhcpv4.BootpBootFile, 128, OpCode);
-
- if (OptionBufferPtr != NULL) {
- return OptionBufferPtr;
- }
- }
-
- if (Overload & OVLD_SRVR_NAME) {
- OptionBufferPtr = _PxeBcFindOpt (PacketPtr->Dhcpv4.BootpSrvName, 64, OpCode);
-
- if (OptionBufferPtr != NULL) {
- return OptionBufferPtr;
- }
- }
-
- return NULL;
-}
-
-STATIC
-EFI_STATUS
-DownloadFile (
- IN PXE_BASECODE_DEVICE *Private,
- IN OUT UINT64 *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Download file into buffer
-
-Arguments:
-
- Private - Pointer to PxeBc interface
- BufferSize - pointer to size of download buffer
- Buffer - Pointer to buffer
-
-Returns:
-
- EFI_BUFFER_TOO_SMALL -
- EFI_NOT_FOUND -
- EFI_PROTOCOL_ERROR -
-
---*/
-{
- EFI_PXE_BASE_CODE_MTFTP_INFO MtftpInfo;
- EFI_PXE_BASE_CODE_TFTP_OPCODE OpCode;
- DHCP_RECEIVE_BUFFER *RxBuf;
- EFI_STATUS Status;
- UINTN BlockSize;
-
- RxBuf = (DHCP_RECEIVE_BUFFER *) Private->BootServerReceiveBuffer;
- BlockSize = 0x8000;
-
- DEBUG ((EFI_D_WARN, "\nDownloadFile() Enter."));
-
- if (Buffer == NULL || *BufferSize == 0 || *BufferSize < Private->FileSize) {
- if (Private->FileSize != 0) {
- *BufferSize = Private->FileSize;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- AsciiPrint ("\nTSize");
-
- OpCode = EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE;
- } else if (RxBuf->OpAdds.Status & WfM11a_TYPE) {
- OpCode = EFI_PXE_BASE_CODE_MTFTP_READ_FILE;
-
- ZeroMem (&MtftpInfo, sizeof MtftpInfo);
-
- *(IPV4_ADDR *) &MtftpInfo.MCastIp = *(IPV4_ADDR *) RxBuf->OpAdds.PxeOptAdds[VEND_PXE_MTFTP_IP - 1]->Data;
-
- CopyMem (
- &MtftpInfo.CPort,
- RxBuf->OpAdds.PxeOptAdds[VEND_PXE_MTFTP_CPORT - 1]->Data,
- sizeof MtftpInfo.CPort
- );
-
- CopyMem (
- &MtftpInfo.SPort,
- RxBuf->OpAdds.PxeOptAdds[VEND_PXE_MTFTP_SPORT - 1]->Data,
- sizeof MtftpInfo.SPort
- );
-
- MtftpInfo.ListenTimeout = GetValue (RxBuf->OpAdds.PxeOptAdds[VEND_PXE_MTFTP_TMOUT - 1]);
-
- MtftpInfo.TransmitTimeout = GetValue (RxBuf->OpAdds.PxeOptAdds[VEND_PXE_MTFTP_DELAY - 1]);
-
- AsciiPrint ("\nMTFTP");
- } else {
- AsciiPrint ("\nTFTP");
-
- OpCode = EFI_PXE_BASE_CODE_TFTP_READ_FILE;
- }
-
- Private->FileSize = 0;
-
- RxBuf->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]->Data[RxBuf->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]->Header.Length] = 0;
-
- Status = Private->EfiBc.Mtftp (
- &Private->EfiBc,
- OpCode,
- Buffer,
- FALSE,
- BufferSize,
- &BlockSize,
- &Private->ServerIp,
- (UINT8 *) RxBuf->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]->Data,
- &MtftpInfo,
- FALSE
- );
-
- if (Status != EFI_SUCCESS && Status != EFI_BUFFER_TOO_SMALL) {
- DEBUG ((EFI_D_WARN, "\nDownloadFile() Exit #1 %Xh", Status));
- return Status;
- }
-
- if (sizeof (UINTN) < sizeof (UINT64) && *BufferSize > 0xFFFFFFFF) {
- Private->FileSize = 0xFFFFFFFF;
- } else {
- Private->FileSize = (UINTN) *BufferSize;
- }
-
- if (OpCode == EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE) {
- DEBUG ((EFI_D_WARN, "\nDownloadFile() Exit #2"));
- return EFI_BUFFER_TOO_SMALL;
- }
-
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_WARN, "\nDownloadFile() Exit #3 %Xh", Status));
- return Status;
- }
-
- if (Private->EfiBc.Mode->BisSupported && Private->EfiBc.Mode->BisDetected && Private->EfiBc.Mode->PxeBisReplyReceived) {
- UINT64 CredentialLen;
- UINT8 CredentialFilename[256];
- UINT8 *op;
- VOID *CredentialBuffer;
-
- //
- // Get name of credential file. It may be in the BOOTP
- // bootfile field or a DHCP option.
- //
- ZeroMem (CredentialFilename, sizeof CredentialFilename);
-
- op = PxeBcFindDhcpOpt (&Private->EfiBc.Mode->PxeBisReply, OP_DHCP_BOOTFILE);
-
- if (op != NULL) {
- if (op[1] == 0) {
- /* No credential filename */
- return EFI_NOT_FOUND;
- }
-
- CopyMem (CredentialFilename, &op[2], op[1]);
- } else {
- if (Private->EfiBc.Mode->PxeBisReply.Dhcpv4.BootpBootFile[0] == 0) {
- /* No credential filename */
- return EFI_NOT_FOUND;
- }
-
- CopyMem (CredentialFilename, &op[2], 128);
- }
- //
- // Get size of credential file. It may be available as a
- // DHCP option. If not, use the TFTP get file size.
- //
- CredentialLen = 0;
-
- op = PxeBcFindDhcpOpt (&Private->EfiBc.Mode->PxeBisReply, OP_BOOT_FILE_SZ);
-
- if (op != NULL) {
- /*
- * This is actually the size of the credential file
- * buffer. The actual credential file size will be
- * returned when we download the file.
- */
- if (op[1] == 2) {
- UINT16 n;
-
- CopyMem (&n, &op[2], 2);
- CredentialLen = HTONS (n) * 512;
- }
- }
-
- if (CredentialLen == 0) {
- BlockSize = 8192;
-
- Status = Private->EfiBc.Mtftp (
- &Private->EfiBc,
- EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
- NULL,
- FALSE,
- &CredentialLen,
- &BlockSize,
- &Private->ServerIp,
- CredentialFilename,
- NULL,
- FALSE
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (CredentialLen == 0) {
- //
- // %%TBD -- EFI error for invalid credential
- // file.
- //
- return EFI_PROTOCOL_ERROR;
- }
- }
- //
- // Allocate credential file buffer.
- //
- CredentialBuffer = AllocatePool ((UINTN) CredentialLen);
- if (CredentialBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Download credential file.
- //
- BlockSize = 8192;
-
- Status = Private->EfiBc.Mtftp (
- &Private->EfiBc,
- EFI_PXE_BASE_CODE_TFTP_READ_FILE,
- CredentialBuffer,
- FALSE,
- &CredentialLen,
- &BlockSize,
- &Private->ServerIp,
- CredentialFilename,
- NULL,
- FALSE
- );
-
- if (EFI_ERROR (Status)) {
- FreePool (CredentialBuffer);
- return Status;
- }
- //
- // Verify credentials.
- //
- if (PxebcBisVerify (Private, Buffer, Private->FileSize, CredentialBuffer, (UINTN) CredentialLen)) {
- Status = EFI_SUCCESS;
- } else {
- //
- // %%TBD -- An EFI error code for failing credential verification.
- //
- Status = EFI_PROTOCOL_ERROR;
- }
-
- FreePool (CredentialBuffer);
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-LoadfileStart (
- IN PXE_BASECODE_DEVICE *Private,
- IN OUT UINT64 *BufferSize,
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Start PXE DHCP. Get DHCP and proxyDHCP information.
- Display remote boot menu and prompt. Select item from menu.
-
-Arguments:
-
- Private - Pointer to PxeBc interface
- BufferSize - Pointer to download buffer size
- Buffer - Pointer to download buffer
-
-Returns:
-
- EFI_SUCCESS -
- EFI_NOT_READY -
-
---*/
-{
- EFI_PXE_BASE_CODE_MODE *PxeBcMode;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
- EFI_SIMPLE_NETWORK_MODE *SnpMode;
- EFI_STATUS Status;
- VOID *RxBuf;
-
- DEBUG ((EFI_D_WARN, "\nLoadfileStart() Enter."));
-
- //
- // Try to start BaseCode, for now only IPv4 is supported
- // so don't try to start using IPv6.
- //
- Status = Private->EfiBc.Start (&Private->EfiBc, FALSE);
-
- if (EFI_ERROR (Status)) {
- if (Status != EFI_ALREADY_STARTED) {
- DEBUG ((EFI_D_NET, "\nLoadfileStart() Exit BC.Start() == %xh", Status));
- return Status;
- }
- }
- //
- // Get pointers to PXE mode structure, SNP protocol structure
- // and SNP mode structure.
- //
- PxeBcMode = Private->EfiBc.Mode;
- Snp = Private->SimpleNetwork;
- SnpMode = Snp->Mode;
-
- //
- // Display client MAC address, like 16-bit PXE ROMs
- //
- AsciiPrint ("\nCLIENT MAC ADDR: ");
-
- {
- UINTN Index;
- UINTN hlen;
-
- hlen = SnpMode->HwAddressSize;
-
- for (Index = 0; Index < hlen; ++Index) {
- AsciiPrint ("%02x ", SnpMode->CurrentAddress.Addr[Index]);
- }
- }
-
- AsciiPrint ("\nDHCP");
-
- Status = Private->EfiBc.Dhcp (&Private->EfiBc, TRUE);
-
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_WARN, "\nLoadfileStart() Exit BC.Dhcp() == %Xh", Status));
- AsciiPrint ("\r \r");
- return Status;
- }
-
- ShowMyInfo (Private);
-
- RxBuf = PxeBcMode->ProxyOfferReceived ? &PXE_OFFER_BUFFER : &DHCPV4_ACK_BUFFER;
-#define RxBufferPtr ((DHCP_RECEIVE_BUFFER *) RxBuf)
-
- Status = DoMenu (Private, RxBufferPtr);
-
- if (Status == EFI_SUCCESS) {
- //
- // did a discovery - take info from discovery packet
- //
- RxBuf = &PXE_ACK_BUFFER;
- } else if (Status == NO_MENU) {
- //
- // did not do a discovery - take info from rxbuf
- //
- Private->ServerIp.Addr[0] = RxBufferPtr->u.Dhcpv4.siaddr;
-
- if (!(Private->ServerIp.Addr[0])) {
- *(IPV4_ADDR *) &Private->ServerIp = *(IPV4_ADDR *) RxBufferPtr->OpAdds.PktOptAdds[OP_DHCP_SERVER_IP_IX - 1]->Data;
- }
- } else {
- DEBUG ((EFI_D_WARN, "\nLoadfileStart() Exit DoMenu() == %Xh", Status));
- return Status;
- }
-
- if (!RxBufferPtr->OpAdds.PktOptAdds[OP_DHCP_BOOTFILE_IX - 1]) {
- DEBUG ((EFI_D_WARN, "\nLoadfileStart() Exit Not ready?"));
- return EFI_NOT_READY;
- }
- //
- // check for file size option sent
- //
- if (RxBufferPtr->OpAdds.PktOptAdds[OP_BOOT_FILE_SZ_IX - 1]) {
- Private->FileSize = 512 * NTOHS (RxBufferPtr->OpAdds.PktOptAdds[OP_BOOT_FILE_SZ_IX - 1]->Data);
- }
-
- Private->BootServerReceiveBuffer = RxBufferPtr;
-
- Status = DownloadFile (Private, BufferSize, Buffer);
-
- DEBUG (
- (EFI_D_WARN,
- "\nLoadfileStart() Exit. DownloadFile() = %Xh",
- Status)
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-LoadFile (
- IN EFI_LOAD_FILE_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
- IN BOOLEAN BootPolicy,
- IN OUT UINTN *BufferSize,
- IN OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Loadfile interface for PxeBc interface
-
-Arguments:
-
- This - Pointer to Loadfile interface
- FilePath - Not used and not checked
- BootPolicy - Must be TRUE
- BufferSize - Pointer to buffer size
- Buffer - Pointer to download buffer or NULL
-
-Returns:
-
- EFI_INVALID_PARAMETER -
- EFI_UNSUPPORTED -
- EFI_SUCCESS -
- EFI_BUFFER_TOO_SMALL -
-
---*/
-{
- LOADFILE_DEVICE *LoadfilePtr;
- UINT64 TmpBufSz;
- INT32 OrigMode;
- INT32 OrigAttribute;
- BOOLEAN RemoveCallback;
- BOOLEAN NewMakeCallback;
- EFI_STATUS Status;
- EFI_STATUS TempStatus;
- //
- //
- //
- OrigMode = gST->ConOut->Mode->Mode;
- OrigAttribute = gST->ConOut->Mode->Attribute;
- RemoveCallback = FALSE;
-
- AsciiPrint ("Running LoadFile()\n");
-
- //
- // If either if these parameters are NULL, we cannot continue.
- //
- if (This == NULL || BufferSize == NULL) {
- DEBUG ((EFI_D_WARN, "\nLoadFile() This or BufferSize == NULL"));
- return EFI_INVALID_PARAMETER;
- }
- //
- // We only support BootPolicy == TRUE
- //
- if (!BootPolicy) {
- DEBUG ((EFI_D_WARN, "\nLoadFile() BootPolicy == FALSE"));
- return EFI_UNSUPPORTED;
- }
- //
- // Get pointer to LoadFile protocol structure.
- //
- LoadfilePtr = CR (This, LOADFILE_DEVICE, LoadFile, LOADFILE_DEVICE_SIGNATURE);
-
- if (LoadfilePtr == NULL) {
- DEBUG (
- (EFI_D_NET,
- "\nLoadFile() Could not get pointer to LoadFile structure")
- );
- return EFI_INVALID_PARAMETER;
- }
- //
- // Lock interface
- //
- EfiAcquireLock (&LoadfilePtr->Lock);
-
- //
- // Set console output mode and display attribute
- //
- if (OrigMode != 0) {
- gST->ConOut->SetMode (gST->ConOut, 0);
- }
-
- gST->ConOut->SetAttribute (
- gST->ConOut,
- EFI_TEXT_ATTR (EFI_LIGHTGRAY,EFI_BLACK)
- );
-
- //
- // See if BaseCode already has a Callback protocol attached.
- // If there is none, attach our own Callback protocol.
- //
- Status = gBS->HandleProtocol (
- LoadfilePtr->Private->Handle,
- &gEfiPxeBaseCodeCallbackProtocolGuid,
- (VOID *) &LoadfilePtr->Private->CallbackProtocolPtr
- );
-
- if (Status == EFI_SUCCESS) {
- //
- // There is already a callback routine. Do nothing.
- //
- DEBUG ((EFI_D_WARN, "\nLoadFile() BC callback exists."));
- } else if (Status == EFI_UNSUPPORTED) {
- //
- // No BaseCode Callback protocol found. Add our own.
- //
- Status = gBS->InstallProtocolInterface (
- &LoadfilePtr->Private->Handle,
- &gEfiPxeBaseCodeCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &_bc_callback
- );
-
- DEBUG ((EFI_D_WARN, "\nLoadFile() Callback install status == %xh", Status));
-
- RemoveCallback = (BOOLEAN) (Status == EFI_SUCCESS);
-
- if (LoadfilePtr->Private->EfiBc.Mode != NULL && LoadfilePtr->Private->EfiBc.Mode->Started) {
- NewMakeCallback = TRUE;
- LoadfilePtr->Private->EfiBc.SetParameters (
- &LoadfilePtr->Private->EfiBc,
- NULL,
- NULL,
- NULL,
- NULL,
- &NewMakeCallback
- );
- }
- } else {
- DEBUG ((EFI_D_WARN, "\nLoadFile() Callback check status == %xh", Status));
- }
- //
- // Check for starting or for continuing after already getting
- // the file size.
- //
- if (LoadfilePtr->Private->FileSize == 0) {
- TmpBufSz = 0;
- Status = LoadfileStart (LoadfilePtr->Private, &TmpBufSz, Buffer);
-
- if (sizeof (UINTN) < sizeof (UINT64) && TmpBufSz > 0xFFFFFFFF) {
- *BufferSize = 0xFFFFFFFF;
- } else {
- *BufferSize = (UINTN) TmpBufSz;
- }
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // This is done so loadfile will work even if the boot manager
- // did not make the first call with Buffer == NULL.
- //
- Buffer = NULL;
- }
- } else if (Buffer == NULL) {
- DEBUG ((EFI_D_WARN, "\nLoadfile() Get buffer size"));
-
- //
- // Continuing from previous LoadFile request. Make sure there
- // is a buffer and that it is big enough.
- //
- *BufferSize = LoadfilePtr->Private->FileSize;
- Status = EFI_BUFFER_TOO_SMALL;
- } else {
- DEBUG ((EFI_D_WARN, "\nLoadFile() Download file"));
-
- //
- // Everything looks good, try to download the file.
- //
- TmpBufSz = *BufferSize;
- Status = DownloadFile (LoadfilePtr->Private, &TmpBufSz, Buffer);
-
- //
- // Next call to loadfile will start DHCP process again.
- //
- LoadfilePtr->Private->FileSize = 0;
- }
- //
- // If we added a callback protocol, now is the time to remove it.
- //
- if (RemoveCallback) {
- NewMakeCallback = FALSE;
- TempStatus = LoadfilePtr->Private->EfiBc.SetParameters (
- &LoadfilePtr->Private->EfiBc,
- NULL,
- NULL,
- NULL,
- NULL,
- &NewMakeCallback
- );
-
- if (TempStatus == EFI_SUCCESS) {
- gBS->UninstallProtocolInterface (
- LoadfilePtr->Private->Handle,
- &gEfiPxeBaseCodeCallbackProtocolGuid,
- &_bc_callback
- );
- }
- }
- //
- // Restore display mode and attribute
- //
- if (OrigMode != 0) {
- gST->ConOut->SetMode (gST->ConOut, OrigMode);
- }
-
- gST->ConOut->SetAttribute (gST->ConOut, OrigAttribute);
-
- //
- // Unlock interface
- //
- EfiReleaseLock (&LoadfilePtr->Lock);
-
- DEBUG ((EFI_D_WARN, "\nBC.Loadfile() Status == %xh\n", Status));
-
- if (Status == EFI_SUCCESS) {
- /* 0 */
- return EFI_SUCCESS;
- } else if (Status == EFI_BUFFER_TOO_SMALL) {
- /* 5 */
- //
- // Error is only displayed when we are actually trying to
- // download the boot image.
- //
- if (Buffer == NULL) {
- return EFI_BUFFER_TOO_SMALL;
- }
- AsciiPrint ("\nPXE-E05: Download buffer is smaller than requested file.\n");
- } else if (Status == EFI_DEVICE_ERROR) {
- /* 7 */
- AsciiPrint ("\nPXE-E07: Network device error. Check network connection.\n");
- } else if (Status == EFI_OUT_OF_RESOURCES) {
- /* 9 */
- AsciiPrint ("\nPXE-E09: Could not allocate I/O buffers.\n");
- } else if (Status == EFI_NO_MEDIA) {
- /* 12 */
- AsciiPrint ("\nPXE-E12: Could not detect network connection. Check cable.\n");
- } else if (Status == EFI_NO_RESPONSE) {
- /* 16 */
- AsciiPrint ("\nPXE-E16: Valid PXE offer not received.\n");
- } else if (Status == EFI_TIMEOUT) {
- /* 18 */
- AsciiPrint ("\nPXE-E18: Timeout. Server did not respond.\n");
- } else if (Status == EFI_ABORTED) {
- /* 21 */
- AsciiPrint ("\nPXE-E21: Remote boot cancelled.\n");
- } else if (Status == EFI_ICMP_ERROR) {
- /* 22 */
- AsciiPrint ("\nPXE-E22: Client received ICMP error from server.\n");
-
- if ((LoadfilePtr->Private->EfiBc.Mode != NULL) && LoadfilePtr->Private->EfiBc.Mode->IcmpErrorReceived) {
- AsciiPrint (
- "PXE-E98: Type: %xh Code: %xh ",
- LoadfilePtr->Private->EfiBc.Mode->IcmpError.Type,
- LoadfilePtr->Private->EfiBc.Mode->IcmpError.Code
- );
-
- switch (LoadfilePtr->Private->EfiBc.Mode->IcmpError.Type) {
- case 0x03:
- switch (LoadfilePtr->Private->EfiBc.Mode->IcmpError.Code) {
- case 0x00: /* net unreachable */
- AsciiPrint ("Net unreachable");
- break;
-
- case 0x01: /* host unreachable */
- AsciiPrint ("Host unreachable");
- break;
-
- case 0x02: /* protocol unreachable */
- AsciiPrint ("Protocol unreachable");
- break;
-
- case 0x03: /* port unreachable */
- AsciiPrint ("Port unreachable");
- break;
-
- case 0x04: /* Fragmentation needed */
- AsciiPrint ("Fragmentation needed");
- break;
-
- case 0x05: /* Source route failed */
- AsciiPrint ("Source route failed");
- break;
- }
-
- break;
- }
-
- AsciiPrint ("\n");
- }
- } else if (Status == EFI_TFTP_ERROR) {
- /* 23 */
- AsciiPrint ("\nPXE-E23: Client received TFTP error from server.\n");
-
- if ((LoadfilePtr->Private->EfiBc.Mode != NULL) && (LoadfilePtr->Private->EfiBc.Mode->TftpErrorReceived)) {
- AsciiPrint (
- "PXE-E98: Code: %xh %a\n",
- LoadfilePtr->Private->EfiBc.Mode->TftpError.ErrorCode,
- LoadfilePtr->Private->EfiBc.Mode->TftpError.ErrorString
- );
- }
- } else {
- AsciiPrint ("\nPXE-E99: Unexpected network error: %xh\n", Status);
- }
-
- LoadfilePtr->Private->EfiBc.Stop (&LoadfilePtr->Private->EfiBc);
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/Network/PxeBc/Dxe/tftp.h b/EdkModulePkg/Universal/Network/PxeBc/Dxe/tftp.h
deleted file mode 100644
index 3cc0724..0000000
--- a/EdkModulePkg/Universal/Network/PxeBc/Dxe/tftp.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- tftp.h
-
-Abstract:
-
---*/
-
-#ifndef __TFTP_H__
-#define __TFTP_H__
-
-//
-// Definitions for trivial file transfer protocol functionality with IP v4
-// Per RFC 1350, July 1992 and RFC 2347, 8, and 9, May 1998
-//
-#pragma pack(1)
-//
-// max and min packet sizes
-// (all data packets in transmission except last)
-//
-#define MAX_TFTP_PKT_SIZE (BUFFER_ALLOCATE_SIZE - 512)
-#define MIN_TFTP_PKT_SIZE 512
-
-//
-// TFTPv4 OpCodes
-//
-#define TFTP_RRQ 1 // read request
-#define TFTP_WRQ 2 // write request
-#define TFTP_DATA 3 // data
-#define TFTP_ACK 4 // acknowledgement
-#define TFTP_ERROR 5 // error packet
-#define TFTP_OACK 6 // option acknowledge
-#define TFTP_DIR 7 // read directory request
-#define TFTP_DATA8 8
-#define TFTP_ACK8 9
-
-//
-// request packet (read or write)
-// Fields shown (except file name) are not to be referenced directly,
-// since their placement is variable within a request packet.
-// All are null terminated case insensitive ascii strings.
-//
-struct Tftpv4Req {
- UINT16 OpCode; // TFTP Op code
- UINT8 FileName[2]; // file name
- UINT8 Mode[2]; // "netascii" or "octet"
- struct { // optionally, one or more option requests
- UINT8 Option[2]; // option name
- UINT8 Value[2]; // value requested
- } OpReq[1];
-};
-
-//
-// modes
-//
-#define MODE_ASCII "netascii"
-#define MODE_BINARY "octet"
-
-//
-// option strings
-//
-#define OP_BLKSIZE "blksize" // block size option
-#define OP_TIMEOUT "timeout" // time to wait before retransmitting
-#define OP_TFRSIZE "tsize" // total transfer size option
-#define OP_OVERWRITE "overwrite" // overwrite file option
-#define OP_BIGBLKNUM "bigblk#" // big block number
-// See RFC 2347, 8, and 9 for more information on TFTP options
-// option acknowledge packet (optional)
-// options not acknowledged are rejected
-//
-struct Tftpv4Oack {
- UINT16 OpCode; // TFTP Op code
- struct { // optionally, one or more option acknowledgements
- UINT8 Option[2]; // option name (of those requested)
- UINT8 Value[2]; // value acknowledged
- } OpAck[1];
-};
-
-//
-// acknowledge packet
-//
-struct Tftpv4Ack {
- UINT16 OpCode; // TFTP Op code
- UINT16 BlockNum;
-};
-
-//
-// data packet
-//
-struct Tftpv4Data {
- struct Tftpv4Ack Header;
- UINT8 Data[512];
-};
-
-//
-// big block number ack packet
-//
-struct Tftpv4Ack8 {
- UINT16 OpCode;
- UINT64 BlockNum;
-};
-
-//
-// big block number data packet
-//
-struct Tftpv4Data8 {
- struct Tftpv4Ack8 Header;
- UINT8 Data[506];
-};
-
-//
-// error packet
-//
-struct Tftpv4Error {
- UINT16 OpCode; // TFTP Op code
- UINT16 ErrCode; // error code
- UINT8 ErrMsg[1]; // error message (nul terminated)
-};
-
-#pragma pack()
-//
-// error codes
-//
-#define TFTP_ERR_UNDEF 0 // Not defined, see error message (if any).
-#define TFTP_ERR_NOT_FOUND 1 // File not found.
-#define TFTP_ERR_ACCESS 2 // Access violation.
-#define TFTP_ERR_FULL 3 // Disk full or allocation exceeded.
-#define TFTP_ERR_ILLEGAL 4 // Illegal TFTP operation.
-#define TFTP_ERR_BAD_ID 5 // Unknown transfer ID.
-#define TFTP_ERR_EXISTS 6 // File already exists.
-#define TFTP_ERR_NO_USER 7 // No such user.
-#define TFTP_ERR_OPTION 8 // Option negotiation termination
-//
-// some defines
-//
-#define REQ_RESP_TIMEOUT 5 // Wait five seconds for request response.
-#define ACK_TIMEOUT 4 // Wait four seconds for ack response.
-#define NUM_ACK_RETRIES 3
-#define NUM_MTFTP_OPEN_RETRIES 3
-
-#endif /* __TFTP_H__ */
-
-/* EOF - tftp.h */
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/ComponentName.c b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/ComponentName.c
deleted file mode 100644
index 12cc0b0..0000000
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/ComponentName.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- ComponentName.c
-
-Abstract:
- PxeDhcp4 component name protocol declarations
-
---*/
-
-
-#include "PxeDhcp4.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName = {
- PxeDhcp4ComponentNameGetDriverName,
- PxeDhcp4ComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mPxeDhcp4DriverNameTable[] = {
- {
- "eng",
- (CHAR16 *) L"PXE DHCPv4 Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4ComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gPxeDhcp4ComponentName.SupportedLanguages,
- mPxeDhcp4DriverNameTable,
- DriverName
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4ComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
-
-/* EOF - ComponentName.c */
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/Dhcp4.msa b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/Dhcp4.msa
deleted file mode 100644
index bc8d22b..0000000
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/Dhcp4.msa
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>Dhcp4</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>a46c3330-be36-4977-9d24-a7cf92eef0fe</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Dhcp4 module.</Abstract>
- <Description>This module can produce PxeDhcp4 protocol on ControllerHandle.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Dhcp4</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>ComponentName.c</Filename>
- <Filename>PxeDhcp4.c</Filename>
- <Filename>PxeDhcp4.h</Filename>
- <Filename>PxeDhcp4InitSelect.c</Filename>
- <Filename>PxeDhcp4Release.c</Filename>
- <Filename>PxeDhcp4RenewRebind.c</Filename>
- <Filename>PxeDhcp4Run.c</Filename>
- <Filename>PxeDhcp4Setup.c</Filename>
- <Filename>support.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiPxeDhcp4ProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPxeBaseCodeProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiSimpleNetworkProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiPxeDhcp4CallbackProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>gPxeDhcp4DriverBinding</DriverBinding>
- <ComponentName>gPxeDhcp4ComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4.c b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4.c
deleted file mode 100644
index 565a507..0000000
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- PxeDhcp4.c
-
-Abstract:
-
---*/
-
-
-#include "PxeDhcp4.h"
-
-//
-// PXE DHCP Protocol Interface
-//
-EFI_DRIVER_BINDING_PROTOCOL gPxeDhcp4DriverBinding = {
- PxeDhcp4DriverBindingSupported,
- PxeDhcp4DriverBindingStart,
- PxeDhcp4DriverBindingStop,
- 0xa,
- NULL,
- NULL
-};
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4DriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL * This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports ControllerHandle. Any
- ControllerHandle that contains a PxeBaseCode protocol can be
- supported.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to test.
- RemainingDevicePath - Not used.
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_ALREADY_STARTED - This driver is already running on this
- device.
- other - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
-
- //
- // Open the IO Abstraction(s) needed to perform the supported test.
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiPxeBaseCodeProtocolGuid,
- (VOID **) &PxeBc,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Close the I/O Abstraction(s) used to perform the supported test.
- //
- return gBS->CloseProtocol (
- ControllerHandle,
- &gEfiPxeBaseCodeProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4DriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL * This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL
- )
-/*++
-
- Routine Description:
- Start this driver on ControllerHandle by opening a PxeBaseCode
- protocol and installing a PxeDhcp4 protocol on ControllerHandle.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to bind driver to.
- RemainingDevicePath - Not used, always produce all possible
- children.
-
- Returns:
- EFI_SUCCESS - This driver is added to ControllerHandle.
- EFI_ALREADY_STARTED - This driver is already running on
- ControllerHandle.
- other - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
- PXE_DHCP4_PRIVATE_DATA *Private;
-
- //
- // Connect to the PxeBaseCode interface on ControllerHandle.
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiPxeBaseCodeProtocolGuid,
- (VOID **) &PxeBc,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // BaseCode has already grabbed the SimpleNetwork interface
- // so just do a HandleProtocol() to get it.
- //
- Status = gBS->HandleProtocol (
- ControllerHandle,
- &gEfiSimpleNetworkProtocolGuid,
- (VOID **) &Snp
- );
-
- if (EFI_ERROR (Status)) {
- goto error_exit;
- }
-
- ASSERT (Snp);
-
- //
- // Initialize the PXE DHCP device instance.
- //
- Private = AllocateZeroPool (sizeof (PXE_DHCP4_PRIVATE_DATA));
- if (Private == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto error_exit;
- }
-
- Private->Signature = PXE_DHCP4_PRIVATE_DATA_SIGNATURE;
- Private->PxeBc = PxeBc;
- Private->Snp = Snp;
- Private->Handle = ControllerHandle;
- Private->PxeDhcp4.Revision = EFI_PXE_DHCP4_PROTOCOL_REVISION;
- Private->PxeDhcp4.Run = PxeDhcp4Run;
- Private->PxeDhcp4.Setup = PxeDhcp4Setup;
- Private->PxeDhcp4.Init = PxeDhcp4Init;
- Private->PxeDhcp4.Select = PxeDhcp4Select;
- Private->PxeDhcp4.Renew = PxeDhcp4Renew;
- Private->PxeDhcp4.Rebind = PxeDhcp4Rebind;
- Private->PxeDhcp4.Release = PxeDhcp4Release;
- Private->PxeDhcp4.Data = NULL;
-
- //
- // Install protocol interfaces for the PXE DHCP device.
- //
- Status = gBS->InstallProtocolInterface (
- &ControllerHandle,
- &gEfiPxeDhcp4ProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &Private->PxeDhcp4
- );
-
- if (!EFI_ERROR (Status)) {
- return Status;
- }
-
-error_exit: ;
- gBS->CloseProtocol (
- ControllerHandle,
- &gEfiPxeBaseCodeProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- return Status;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4DriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
- Routine Description:
- Stop this driver on ControllerHandle by removing PXE DHCP
- protocol and closing the PXE Base Code protocol on
- ControllerHandle.
-
- Arguments:
- This - Protocol instance pointer.
- ControllerHandle - Handle of device to stop driver on.
- NumberOfChildren - Not used.
- ChildHandleBuffer - Not used.
-
- Returns:
- EFI_SUCCESS - This driver is removed ControllerHandle.
- other - This driver was not removed from this
- device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_PXE_DHCP4_PROTOCOL *PxeDhcp4;
- PXE_DHCP4_PRIVATE_DATA *Private;
-
- //
- // Get our context back.
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiPxeDhcp4ProtocolGuid,
- (VOID **) &PxeDhcp4,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Private = PXE_DHCP4_PRIVATE_DATA_FROM_THIS (PxeDhcp4);
-
- //
- // Release allocated resources
- //
- if (Private->PxeDhcp4.Data) {
- FreePool (Private->PxeDhcp4.Data);
- Private->PxeDhcp4.Data = NULL;
- }
- //
- // Uninstall our protocol
- //
- Status = gBS->UninstallProtocolInterface (
- ControllerHandle,
- &gEfiPxeDhcp4ProtocolGuid,
- &Private->PxeDhcp4
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Close any consumed protocols
- //
- Status = gBS->CloseProtocol (
- ControllerHandle,
- &gEfiPxeBaseCodeProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Release our private data
- //
- FreePool (Private);
-
- return Status;
-}
-
-/* EOF - PxeDhcp4.c */
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4.h b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4.h
deleted file mode 100644
index a49f169..0000000
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4.h
+++ /dev/null
@@ -1,357 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- PxeDhcp4.h
-
-Abstract:
- Common header for PxeDhcp4 protocol driver
-
---*/
-#ifndef _PXEDHCP4_H
-#define _PXEDHCP4_H
-
-//
-// PxeDhcp4 protocol instance data
-//
-typedef struct {
- //
- // Signature field used to locate beginning of containment record.
- //
- UINTN Signature;
-
-#define PXE_DHCP4_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('p', 'x', 'D', '4')
- //
- // Device handle the protocol is bound to.
- //
- EFI_HANDLE Handle;
-
- //
- // Public PxeDhcp4 protocol interface.
- //
- EFI_PXE_DHCP4_PROTOCOL PxeDhcp4;
-
- //
- // Consumed PxeBc, Snp and PxeDhcp4Callback protocol interfaces.
- //
- EFI_PXE_BASE_CODE_PROTOCOL *PxeBc;
- EFI_SIMPLE_NETWORK_PROTOCOL *Snp;
- EFI_PXE_DHCP4_CALLBACK_PROTOCOL *callback;
-
- //
- // PxeDhcp4 called function for PxeDhcp4Callback.
- //
- EFI_PXE_DHCP4_FUNCTION function;
-
- //
- // Timeout event and flag for PxeDhcp4Callback.
- //
- EFI_EVENT TimeoutEvent;
- BOOLEAN TimeoutOccurred;
-
- //
- // Periodic event and flag for PxeDhcp4Callback.
- //
- EFI_EVENT PeriodicEvent;
- BOOLEAN PeriodicOccurred;
-
- //
- // DHCP server IP address.
- //
- UINT32 ServerIp;
-
- //
- // DHCP renewal and rebinding times, in seconds.
- //
- UINT32 RenewTime;
- UINT32 RebindTime;
- UINT32 LeaseTime;
-
- //
- // Number of offers received & allocated offer list.
- //
- UINTN offers;
- DHCP4_PACKET *offer_list;
-
- //
- //
- //
- BOOLEAN StopPxeBc;
-
-} PXE_DHCP4_PRIVATE_DATA;
-
-#define PXE_DHCP4_PRIVATE_DATA_FROM_THIS(a) CR (a, PXE_DHCP4_PRIVATE_DATA, PxeDhcp4, PXE_DHCP4_PRIVATE_DATA_SIGNATURE)
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// Protocol function prototypes.
-//
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Run (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN OPTIONAL UINTN OpLen,
- IN OPTIONAL VOID *OpList
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Setup (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN EFI_PXE_DHCP4_DATA *Data
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Init (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN seconds_timeout,
- OUT UINTN *offer_list_entries,
- OUT DHCP4_PACKET **offer_list
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Select (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN seconds_timeout,
- IN DHCP4_PACKET *offer_list
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Renew (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- UINTN seconds_timeout
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Rebind (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- UINTN seconds_timeout
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-PxeDhcp4Release (
- IN EFI_PXE_DHCP4_PROTOCOL *This
- )
-;
-
-//
-// Prototypes
-// Driver model protocol interface
-//
-EFI_STATUS
-EFIAPI
-PxeDhcp4DriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PxeDhcp4DriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- );
-
-EFI_STATUS
-EFIAPI
-PxeDhcp4DriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- );
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-PxeDhcp4ComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-PxeDhcp4ComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// Support function prototypes.
-//
-extern
-UINT16
-htons (
- UINTN n
- )
-;
-
-extern
-UINT32
-htonl (
- UINTN n
- )
-;
-
-extern
-VOID
-EFIAPI
-timeout_notify (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-extern
-VOID
-EFIAPI
-periodic_notify (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-extern
-EFI_STATUS
-find_opt (
- IN DHCP4_PACKET *Packet,
- IN UINT8 OpCode,
- IN UINTN Skip,
- OUT DHCP4_OP **OpPtr
- )
-;
-
-extern
-EFI_STATUS
-add_opt (
- IN DHCP4_PACKET *Packet,
- IN DHCP4_OP *OpPtr
- )
-;
-
-extern
-EFI_STATUS
-start_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN OPTIONAL EFI_IP_ADDRESS *station_ip,
- IN OPTIONAL EFI_IP_ADDRESS *subnet_mask
- )
-;
-
-extern
-VOID
-stop_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private
- )
-;
-
-extern
-EFI_STATUS
-start_receive_events (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN UINTN seconds_timeout
- )
-;
-
-extern
-VOID
-stop_receive_events (
- IN PXE_DHCP4_PRIVATE_DATA *Private
- )
-;
-
-extern
-EFI_STATUS
-tx_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN EFI_IP_ADDRESS *dest_ip,
- IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
- IN EFI_IP_ADDRESS *src_ip,
- IN VOID *buffer,
- IN UINTN BufferSize
- )
-;
-
-extern
-EFI_STATUS
-rx_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- OUT VOID *buffer,
- OUT UINTN *BufferSize,
- IN OUT EFI_IP_ADDRESS *dest_ip,
- IN OUT EFI_IP_ADDRESS *src_ip,
- IN UINT16 op_flags
- )
-;
-
-extern
-EFI_STATUS
-tx_rx_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN OUT EFI_IP_ADDRESS *ServerIp,
- IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
- IN OPTIONAL EFI_IP_ADDRESS *client_ip,
- IN OPTIONAL EFI_IP_ADDRESS *subnet_mask,
- IN DHCP4_PACKET *tx_pkt,
- OUT DHCP4_PACKET *rx_pkt,
- IN INTN
- (
- *rx_vfy)
- (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN DHCP4_PACKET *tx_pkt,
- IN DHCP4_PACKET *rx_pkt,
- IN UINTN rx_pkt_size
- ),
- IN UINTN seconds_timeout
- )
-;
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-//
-// Global variable definitions.
-//
-extern EFI_DRIVER_BINDING_PROTOCOL gPxeDhcp4DriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gPxeDhcp4ComponentName;
-
-#endif /* _PXEDHCP4_H */
-
-/* EOF - PxeDhcp4.h */
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4InitSelect.c b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4InitSelect.c
deleted file mode 100644
index a94f253..0000000
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4InitSelect.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- PxeDhcp4InitSelect.c
-
-Abstract:
-
---*/
-
-
-#include "PxeDhcp4.h"
-
-STATIC
-INTN
-offer_verify (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN DHCP4_PACKET *tx_pkt,
- IN DHCP4_PACKET *rx_pkt,
- IN UINTN rx_pkt_size
- )
-/*++
- -2 = ignore, stop waiting
- -1 = ignore, keep waiting
- 0 = accept, keep waiting
- 1 = accept, stop waiting
---*/
-{
- EFI_STATUS EfiStatus;
- DHCP4_PACKET *tmp;
- DHCP4_OP *msg_type_op;
- DHCP4_OP *srvid_op;
- UINT32 magik;
-
- //
- // Verify parameters. Touch unused parameters to keep
- // compiler happy.
- //
- ASSERT (Private);
- ASSERT (rx_pkt);
-
- if (Private == NULL || rx_pkt == NULL) {
- return -2;
- }
-
- tx_pkt = tx_pkt;
- rx_pkt_size = rx_pkt_size;
-
- //
- // This may be a BOOTP Reply or DHCP Offer packet.
- // If there is no DHCP magik number, assume that
- // this is a BOOTP Reply packet.
- //
- magik = htonl (DHCP4_MAGIK_NUMBER);
-
- while (!CompareMem (&rx_pkt->dhcp4.magik, &magik, 4)) {
- //
- // If there is no DHCP message type option, assume
- // this is a BOOTP reply packet and cache it.
- //
- EfiStatus = find_opt (rx_pkt, DHCP4_MESSAGE_TYPE, 0, &msg_type_op);
-
- if (EFI_ERROR (EfiStatus)) {
- break;
- }
- //
- // If there is a DHCP message type option, it must be a
- // DHCP offer packet
- //
- if (msg_type_op->len != 1) {
- return -1;
- }
-
- if (msg_type_op->data[0] != DHCP4_MESSAGE_TYPE_OFFER) {
- return -1;
- }
- //
- // There must be a server identifier option.
- //
- EfiStatus = find_opt (
- rx_pkt,
- DHCP4_SERVER_IDENTIFIER,
- 0,
- &srvid_op
- );
-
- if (EFI_ERROR (EfiStatus)) {
- return -1;
- }
-
- if (srvid_op->len != 4) {
- return -1;
- }
- //
- // Good DHCP offer packet.
- //
- break;
- }
- //
- // Good DHCP (or BOOTP) packet. Cache it!
- //
- tmp = AllocatePool ((Private->offers + 1) * sizeof (DHCP4_PACKET));
- if (tmp == NULL) {
- return -2;
- }
-
- ASSERT (tmp);
-
- if (Private->offers != 0) {
- CopyMem (
- tmp,
- Private->offer_list,
- Private->offers * sizeof (DHCP4_PACKET)
- );
-
- FreePool (Private->offer_list);
- }
-
- CopyMem (&tmp[Private->offers++], rx_pkt, sizeof (DHCP4_PACKET));
-
- Private->offer_list = tmp;
-
- return 0;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-INTN
-acknak_verify (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN DHCP4_PACKET *tx_pkt,
- IN DHCP4_PACKET *rx_pkt,
- IN UINTN rx_pkt_size
- )
-/*++
- -2 = ignore, stop waiting
- -1 = ignore, keep waiting
- 0 = accept, keep waiting
- 1 = accept, stop waiting
---*/
-{
- EFI_STATUS EfiStatus;
- DHCP4_OP *msg_type_op;
- DHCP4_OP *srvid_op;
- DHCP4_OP *renew_op;
- DHCP4_OP *rebind_op;
- DHCP4_OP *lease_time_op;
- UINT32 magik;
-
- //
- // Verify parameters. Touch unused parameters to
- // keep compiler happy.
- //
- ASSERT (Private);
- ASSERT (rx_pkt);
-
- if (Private == NULL || rx_pkt == NULL) {
- return -2;
- }
-
- tx_pkt = tx_pkt;
- rx_pkt_size = rx_pkt_size;
-
- //
- // This must be a DHCP Ack message.
- //
- magik = htonl (DHCP4_MAGIK_NUMBER);
-
- if (CompareMem (&rx_pkt->dhcp4.magik, &magik, 4)) {
- return -1;
- }
-
- EfiStatus = find_opt (rx_pkt, DHCP4_MESSAGE_TYPE, 0, &msg_type_op);
-
- if (EFI_ERROR (EfiStatus)) {
- return -1;
- }
-
- if (msg_type_op->len != 1) {
- return -1;
- }
-
- if (msg_type_op->data[0] != DHCP4_MESSAGE_TYPE_ACK) {
- return -1;
- }
- //
- // There must be a server identifier.
- //
- EfiStatus = find_opt (rx_pkt, DHCP4_SERVER_IDENTIFIER, 0, &srvid_op);
-
- if (EFI_ERROR (EfiStatus)) {
- return -1;
- }
-
- if (srvid_op->len != 4) {
- return -1;
- }
- //
- // There should be a renewal time.
- // If there is not, we will default to the 7/8 of the rebinding time.
- //
- EfiStatus = find_opt (rx_pkt, DHCP4_RENEWAL_TIME, 0, &renew_op);
-
- if (EFI_ERROR (EfiStatus)) {
- renew_op = NULL;
- } else if (renew_op->len != 4) {
- renew_op = NULL;
- }
- //
- // There should be a rebinding time.
- // If there is not, we will default to 7/8 of the lease time.
- //
- EfiStatus = find_opt (rx_pkt, DHCP4_REBINDING_TIME, 0, &rebind_op);
-
- if (EFI_ERROR (EfiStatus)) {
- rebind_op = NULL;
- } else if (rebind_op->len != 4) {
- rebind_op = NULL;
- }
- //
- // There should be a lease time.
- // If there is not, we will default to one week.
- //
- EfiStatus = find_opt (rx_pkt, DHCP4_LEASE_TIME, 0, &lease_time_op);
-
- if (EFI_ERROR (EfiStatus)) {
- lease_time_op = NULL;
- } else if (lease_time_op->len != 4) {
- lease_time_op = NULL;
- }
- //
- // Packet looks good. Double check the renew, rebind and lease times.
- //
- CopyMem (&Private->ServerIp, srvid_op->data, 4);
-
- if (renew_op != NULL) {
- CopyMem (&Private->RenewTime, renew_op->data, 4);
- Private->RenewTime = htonl (Private->RenewTime);
- } else {
- Private->RenewTime = 0;
- }
-
- if (rebind_op != NULL) {
- CopyMem (&Private->RebindTime, rebind_op->data, 4);
- Private->RebindTime = htonl (Private->RebindTime);
- } else {
- Private->RebindTime = 0;
- }
-
- if (lease_time_op != NULL) {
- CopyMem (&Private->LeaseTime, lease_time_op->data, 4);
- Private->LeaseTime = htonl (Private->LeaseTime);
- } else {
- Private->LeaseTime = 0;
- }
-
- if (Private->LeaseTime < 60) {
- Private->LeaseTime = 7 * 86400;
- }
-
- if (Private->RebindTime < 52 || Private->RebindTime >= Private->LeaseTime) {
- Private->RebindTime = Private->LeaseTime / 2 + Private->LeaseTime / 4 + Private->LeaseTime / 8;
- }
-
- if (Private->RenewTime < 45 || Private->RenewTime >= Private->RebindTime) {
- Private->RenewTime = Private->RebindTime / 2 + Private->RebindTime / 4 + Private->RebindTime / 8;
- }
-
- return 1;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4Init (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN seconds_timeout,
- OUT UINTN *Offers,
- OUT DHCP4_PACKET **OfferList
- )
-{
- PXE_DHCP4_PRIVATE_DATA *Private;
- DHCP4_PACKET offer;
- EFI_IP_ADDRESS bcast_ip;
- EFI_STATUS EfiStatus;
-
- //
- // Verify parameters and protocol state.
- //
- if (This == NULL ||
- seconds_timeout < DHCP4_MIN_SECONDS ||
- seconds_timeout > DHCP4_MAX_SECONDS ||
- Offers == NULL ||
- OfferList == NULL
- ) {
- //
- // Return parameters are not initialized when
- // parameters are invalid!
- //
- return EFI_INVALID_PARAMETER;
- }
-
- *Offers = 0;
- *OfferList = NULL;
-
- //
- // Check protocol state.
- //
- if (This->Data == NULL) {
- return EFI_NOT_STARTED;
- }
-
- if (!This->Data->SetupCompleted) {
- return EFI_NOT_READY;
- }
-
- //
- // Get pointer to our instance data.
- //
- Private = PXE_DHCP4_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Private->PxeBc == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Setup variables...
- //
- Private->offers = 0;
- Private->offer_list = NULL;
-
- EfiStatus = gBS->HandleProtocol (
- Private->Handle,
- &gEfiPxeDhcp4CallbackProtocolGuid,
- (VOID *) &Private->callback
- );
-
- if (EFI_ERROR (EfiStatus)) {
- Private->callback = NULL;
- }
-
- Private->function = EFI_PXE_DHCP4_FUNCTION_INIT;
-
- //
- // Increment the transaction ID.
- //
- {
- UINT32 xid;
-
- CopyMem (&xid, &This->Data->Discover.dhcp4.xid, sizeof (UINT32));
-
- xid = htonl (htonl (xid) + 1);
-
- CopyMem (&This->Data->Discover.dhcp4.xid, &xid, sizeof (UINT32));
- }
- //
- // Transmit discover and wait for offers...
- //
- SetMem (&bcast_ip, sizeof (EFI_IP_ADDRESS), 0xFF);
-
- EfiStatus = tx_rx_udp (
- Private,
- &bcast_ip,
- NULL,
- NULL,
- NULL,
- &This->Data->Discover,
- &offer,
- &offer_verify,
- seconds_timeout
- );
-
- if (EFI_ERROR (EfiStatus)) {
- if (Private->offer_list) {
- FreePool (Private->offer_list);
- }
-
- Private->offers = 0;
- Private->offer_list = NULL;
- Private->callback = NULL;
-
- DEBUG ((EFI_D_ERROR, "%r\n", EfiStatus));
- return EfiStatus;
- }
-
- *Offers = Private->offers;
- *OfferList = Private->offer_list;
-
- Private->offers = 0;
- Private->offer_list = NULL;
- Private->callback = NULL;
-
- This->Data->InitCompleted = TRUE;
- This->Data->SelectCompleted = FALSE;
- This->Data->IsBootp = FALSE;
- This->Data->IsAck = FALSE;
-
- return EFI_SUCCESS;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4Select (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN seconds_timeout,
- IN DHCP4_PACKET *Offer
- )
-{
- PXE_DHCP4_PRIVATE_DATA *Private;
- EFI_STATUS EfiStatus;
- DHCP4_PACKET request;
- DHCP4_PACKET acknak;
- EFI_IP_ADDRESS bcast_ip;
- EFI_IP_ADDRESS zero_ip;
- EFI_IP_ADDRESS local_ip;
- DHCP4_OP *srvid;
- DHCP4_OP *op;
- UINT32 dhcp4_magik;
- UINT8 buf[16];
- BOOLEAN is_bootp;
-
- //
- // Verify parameters.
- //
- if (This == NULL || seconds_timeout < DHCP4_MIN_SECONDS || seconds_timeout > DHCP4_MAX_SECONDS || Offer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Check protocol state.
- //
- if (This->Data == NULL) {
- return EFI_NOT_STARTED;
- }
-
- if (!This->Data->SetupCompleted) {
- return EFI_NOT_READY;
- }
- //
- // Get pointer to instance data.
- //
- Private = PXE_DHCP4_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Private->PxeBc == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Setup useful variables...
- //
- SetMem (&bcast_ip, sizeof (EFI_IP_ADDRESS), 0xFF);
-
- ZeroMem (&zero_ip, sizeof (EFI_IP_ADDRESS));
-
- ZeroMem (&local_ip, sizeof (EFI_IP_ADDRESS));
- local_ip.v4.Addr[0] = 127;
- local_ip.v4.Addr[3] = 1;
-
- This->Data->SelectCompleted = FALSE;
- This->Data->IsBootp = FALSE;
- This->Data->IsAck = FALSE;
-
- EfiStatus = gBS->HandleProtocol (
- Private->Handle,
- &gEfiPxeDhcp4CallbackProtocolGuid,
- (VOID *) &Private->callback
- );
-
- if (EFI_ERROR (EfiStatus)) {
- Private->callback = NULL;
- }
-
- Private->function = EFI_PXE_DHCP4_FUNCTION_SELECT;
-
- //
- // Verify offer packet fields.
- //
- if (Offer->dhcp4.op != BOOTP_REPLY) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- if (Offer->dhcp4.htype != This->Data->Discover.dhcp4.htype) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- if (Offer->dhcp4.hlen != This->Data->Discover.dhcp4.hlen) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- if (CompareMem (&Offer->dhcp4.xid, &This->Data->Discover.dhcp4.xid, 4)) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- if (!CompareMem (&Offer->dhcp4.yiaddr, &bcast_ip, 4)) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- if (!CompareMem (&Offer->dhcp4.yiaddr, &zero_ip, 4)) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- if (!CompareMem (&Offer->dhcp4.yiaddr, &local_ip, 4)) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- if (CompareMem (
- &Offer->dhcp4.chaddr,
- &This->Data->Discover.dhcp4.chaddr,
- 16
- )) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
- //
- // DHCP option checks
- //
- dhcp4_magik = htonl (DHCP4_MAGIK_NUMBER);
- is_bootp = TRUE;
-
- if (!CompareMem (&Offer->dhcp4.magik, &dhcp4_magik, 4)) {
- //
- // If present, DHCP message type must be offer.
- //
- EfiStatus = find_opt (Offer, DHCP4_MESSAGE_TYPE, 0, &op);
-
- if (!EFI_ERROR (EfiStatus)) {
- if (op->len != 1 || op->data[0] != DHCP4_MESSAGE_TYPE_OFFER) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- is_bootp = FALSE;
- }
- //
- // If present, DHCP max message size must be valid.
- //
- EfiStatus = find_opt (Offer, DHCP4_MAX_MESSAGE_SIZE, 0, &op);
-
- if (!EFI_ERROR (EfiStatus)) {
- if (op->len != 2 || ((op->data[0] << 8) | op->data[1]) < DHCP4_DEFAULT_MAX_MESSAGE_SIZE) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // If present, DHCP server identifier must be valid.
- //
- EfiStatus = find_opt (Offer, DHCP4_SERVER_IDENTIFIER, 0, &op);
-
- if (!EFI_ERROR (EfiStatus)) {
- if (op->len != 4 || !CompareMem (op->data, &bcast_ip, 4) || !CompareMem (op->data, &zero_ip, 4)) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // If present, DHCP subnet mask must be valid.
- //
- EfiStatus = find_opt (
- Offer,
- DHCP4_SUBNET_MASK,
- 0,
- &op
- );
-
- if (!EFI_ERROR (EfiStatus)) {
- if (op->len != 4) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
- }
- }
- //
- // Early out for BOOTP.
- //
- This->Data->IsBootp = is_bootp;
- if (is_bootp) {
- //
- // Copy offer packet to instance data.
- //
- CopyMem (&This->Data->Offer, Offer, sizeof (DHCP4_PACKET));
-
- //
- // Copy discover to request and offer to acknak.
- //
- CopyMem (
- &This->Data->Request,
- &This->Data->Discover,
- sizeof (DHCP4_PACKET)
- );
-
- CopyMem (
- &This->Data->AckNak,
- &This->Data->Offer,
- sizeof (DHCP4_PACKET)
- );
-
- //
- // Set state flags.
- //
- This->Data->SelectCompleted = TRUE;
- This->Data->IsAck = TRUE;
-
- Private->callback = NULL;
- return EFI_SUCCESS;
- }
- //
- // Copy discover packet contents to request packet.
- //
- CopyMem (&request, &This->Data->Discover, sizeof (DHCP4_PACKET));
-
- This->Data->IsAck = FALSE;
-
- //
- // Change DHCP message type from discover to request.
- //
- EfiStatus = find_opt (&request, DHCP4_MESSAGE_TYPE, 0, &op);
-
- if (EFI_ERROR (EfiStatus) && EfiStatus != EFI_NOT_FOUND) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiStatus == EFI_NOT_FOUND) {
- EfiStatus = find_opt (&request, DHCP4_END, 0, &op);
-
- if (EFI_ERROR (EfiStatus)) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- op->op = DHCP4_MESSAGE_TYPE;
- op->len = 1;
-
- op->data[1] = DHCP4_END;
- }
-
- op->data[0] = DHCP4_MESSAGE_TYPE_REQUEST;
-
- //
- // Copy server identifier option from offer to request.
- //
- EfiStatus = find_opt (Offer, DHCP4_SERVER_IDENTIFIER, 0, &srvid);
-
- if (EFI_ERROR (EfiStatus)) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- if (srvid->len != 4) {
- Private->callback = NULL;
- return EFI_INVALID_PARAMETER;
- }
-
- EfiStatus = add_opt (&request, srvid);
-
- if (EFI_ERROR (EfiStatus)) {
- DEBUG ((EFI_D_ERROR, "%r\n", EfiStatus));
- Private->callback = NULL;
- return EfiStatus;
- }
- //
- // Add requested IP address option to request packet.
- //
- op = (DHCP4_OP *) buf;
- op->op = DHCP4_REQUESTED_IP_ADDRESS;
- op->len = 4;
- CopyMem (op->data, &Offer->dhcp4.yiaddr, 4);
-
- EfiStatus = add_opt (&request, op);
-
- if (EFI_ERROR (EfiStatus)) {
- DEBUG ((EFI_D_ERROR, "%r\n", EfiStatus));
- Private->callback = NULL;
- return EfiStatus;
- }
- //
- // Transimit DHCP request and wait for DHCP ack...
- //
- SetMem (&bcast_ip, sizeof (EFI_IP_ADDRESS), 0xFF);
-
- EfiStatus = tx_rx_udp (
- Private,
- &bcast_ip,
- NULL,
- NULL,
- NULL,
- &request,
- &acknak,
- &acknak_verify,
- seconds_timeout
- );
-
- if (EFI_ERROR (EfiStatus)) {
- DEBUG ((EFI_D_ERROR, "%r\n", EfiStatus));
- Private->callback = NULL;
- return EfiStatus;
- }
- //
- // Set Data->IsAck and return.
- //
- EfiStatus = find_opt (&acknak, DHCP4_MESSAGE_TYPE, 0, &op);
-
- if (EFI_ERROR (EfiStatus)) {
- Private->callback = NULL;
- return EFI_DEVICE_ERROR;
- }
-
- if (op->len != 1) {
- Private->callback = NULL;
- return EFI_DEVICE_ERROR;
- }
-
- switch (op->data[0]) {
- case DHCP4_MESSAGE_TYPE_ACK:
- This->Data->IsAck = TRUE;
- break;
-
- case DHCP4_MESSAGE_TYPE_NAK:
- This->Data->IsAck = FALSE;
- break;
-
- default:
- Private->callback = NULL;
- return EFI_DEVICE_ERROR;
- }
- //
- // Copy packets into instance data...
- //
- CopyMem (&This->Data->Offer, Offer, sizeof (DHCP4_PACKET));
- CopyMem (&This->Data->Request, &request, sizeof (DHCP4_PACKET));
- CopyMem (&This->Data->AckNak, &acknak, sizeof (DHCP4_PACKET));
-
- This->Data->SelectCompleted = TRUE;
-
- Private->callback = NULL;
- return EFI_SUCCESS;
-}
-
-/* eof - PxeDhcp4InitSelect.c */
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Release.c b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Release.c
deleted file mode 100644
index 4bbc8a8..0000000
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Release.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- PxeDhcp4Release.c
-
-Abstract:
- Transmit release packet, free allocations and shutdown PxeDhcp4.
-
---*/
-
-
-#include "PxeDhcp4.h"
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4Release (
- IN EFI_PXE_DHCP4_PROTOCOL *This
- )
-{
- PXE_DHCP4_PRIVATE_DATA *Private;
- EFI_IP_ADDRESS ServerIp;
- EFI_IP_ADDRESS client_ip;
- EFI_IP_ADDRESS gateway_ip;
- EFI_IP_ADDRESS subnet_mask;
- EFI_STATUS efi_status;
- DHCP4_OP *op;
- UINT8 op_list[20];
-
- //
- // Check for invalid parameters.
- //
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Release does nothing if the protocol has never been setup.
- //
- if (This->Data == NULL) {
- return EFI_NOT_STARTED;
- }
- //
- // Fail if we do not have valid instance data.
- //
- Private = PXE_DHCP4_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Private->PxeBc == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- // If this is a BOOTP session and there is not a DHCP Ack
- // packet, just release storage and return.
- //
- if (This->Data->IsBootp || !This->Data->IsAck) {
- FreePool (This->Data);
- This->Data = NULL;
-
- if (Private->StopPxeBc) {
- Private->PxeBc->Stop (Private->PxeBc);
- }
-
- return EFI_SUCCESS;
- }
- //
- // Build option list for DHCP Release packet.
- // If any errors occur, just release storage and return.
- //
- //
- // Message type is first.
- //
- op_list[0] = DHCP4_MESSAGE_TYPE;
- op_list[1] = 1;
- op_list[2] = DHCP4_MESSAGE_TYPE_RELEASE;
-
- //
- // Followed by server identifier.
- //
- efi_status = find_opt (
- &This->Data->Request,
- DHCP4_SERVER_IDENTIFIER,
- 0,
- &op
- );
-
- if (EFI_ERROR (efi_status)) {
- FreePool (This->Data);
- This->Data = NULL;
-
- if (Private->StopPxeBc) {
- Private->PxeBc->Stop (Private->PxeBc);
- }
-
- return EFI_SUCCESS;
- }
-
- if (op->len != 4) {
- FreePool (This->Data);
- This->Data = NULL;
-
- if (Private->StopPxeBc) {
- Private->PxeBc->Stop (Private->PxeBc);
- }
-
- return EFI_SUCCESS;
- }
-
- CopyMem (&ServerIp, op->data, 4);
-
- op_list[3] = DHCP4_SERVER_IDENTIFIER;
- op_list[4] = 4;
- CopyMem (&op_list[5], &ServerIp, 4);
-
- //
- // Followed by end.
- //
- op_list[9] = DHCP4_END;
-
- //
- // We need a subnet mask for IP stack operation.
- //
- efi_status = find_opt (
- &This->Data->AckNak,
- DHCP4_SUBNET_MASK,
- 0,
- &op
- );
-
- if (EFI_ERROR (efi_status)) {
- FreePool (This->Data);
- This->Data = NULL;
-
- if (Private->StopPxeBc) {
- Private->PxeBc->Stop (Private->PxeBc);
- }
-
- return EFI_SUCCESS;
- }
-
- if (op->len != 4) {
- FreePool (This->Data);
- This->Data = NULL;
-
- if (Private->StopPxeBc) {
- Private->PxeBc->Stop (Private->PxeBc);
- }
-
- return EFI_SUCCESS;
- }
-
- ZeroMem (&subnet_mask, sizeof (EFI_IP_ADDRESS));
- CopyMem (&subnet_mask, op->data, 4);
-
- //
- // Gateway IP address may be needed.
- //
- ZeroMem (&gateway_ip, sizeof (EFI_IP_ADDRESS));
- CopyMem (&gateway_ip, &This->Data->AckNak.dhcp4.giaddr, 4);
-
- //
- // Client IP address needed for IP stack operation.
- //
- ZeroMem (&client_ip, sizeof (EFI_IP_ADDRESS));
- CopyMem (&client_ip, &This->Data->AckNak.dhcp4.yiaddr, 4);
-
- //
- // Enable UDP...
- //
- efi_status = start_udp (Private, &client_ip, &subnet_mask);
-
- if (EFI_ERROR (efi_status)) {
- FreePool (This->Data);
- This->Data = NULL;
-
- if (Private->StopPxeBc) {
- Private->PxeBc->Stop (Private->PxeBc);
- }
-
- return efi_status;
- }
- //
- // Gather information out of DHCP request packet needed for
- // DHCP release packet.
- //
- //
- // Setup DHCP Release packet.
- //
- CopyMem (&This->Data->Request.dhcp4.ciaddr, &client_ip, 4);
-
- ZeroMem (&This->Data->Request.dhcp4.yiaddr, 12);
-
- ZeroMem (&This->Data->Request.dhcp4.sname, 64 + 128);
-
- This->Data->Request.dhcp4.hops = 0;
- This->Data->Request.dhcp4.secs = 0;
- This->Data->Request.dhcp4.flags = 0;
-
- ZeroMem (
- &This->Data->Request.dhcp4.options,
- sizeof This->Data->Request.dhcp4.options
- );
-
- CopyMem (&This->Data->Request.dhcp4.options, op_list, 10);
-
- //
- // Transmit DHCP Release packet.
- //
- tx_udp (
- Private,
- &ServerIp,
- &gateway_ip,
- &client_ip,
- &This->Data->Request,
- DHCP4_MAX_PACKET_SIZE - (DHCP4_UDP_HEADER_SIZE + DHCP4_IP_HEADER_SIZE)
- );
-
- gBS->Stall (1000000); /* 1/10th second */
-
- //
- // Shutdown PXE BaseCode and release local storage.
- //
- stop_udp (Private);
-
- FreePool (This->Data);
- This->Data = NULL;
-
- if (Private->StopPxeBc) {
- Private->PxeBc->Stop (Private->PxeBc);
- }
-
- return EFI_SUCCESS;
-}
-
-/* eof - PxeDhcp4Release.c */
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4RenewRebind.c b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4RenewRebind.c
deleted file mode 100644
index 2905255..0000000
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4RenewRebind.c
+++ /dev/null
@@ -1,408 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- PxeDhcp4RenewRebind.c
-
-Abstract:
-
---*/
-
-
-#include "PxeDhcp4.h"
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-INTN
-acknak_verify (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN DHCP4_PACKET *tx_pkt,
- IN DHCP4_PACKET *rx_pkt,
- IN UINTN rx_pkt_size
- )
-/*++
-Routine Description:
-
-Parameters:
-
-Returns:
- -2 = ignore, stop waiting
- -1 = ignore, keep waiting
- 0 = accept, keep waiting
- 1 = accept, stop waiting
---*/
-{
- EFI_STATUS efi_status;
- DHCP4_OP *msg_type_op;
- DHCP4_OP *srvid_op;
- DHCP4_OP *renew_op;
- DHCP4_OP *rebind_op;
- DHCP4_OP *lease_time_op;
- UINT32 magik;
-
- //
- // Verify parameters. Unused parameters are also touched
- // to make the compiler happy.
- //
- ASSERT (Private);
- ASSERT (rx_pkt);
-
- if (Private == NULL || rx_pkt == NULL) {
- return -2;
- }
-
- tx_pkt = tx_pkt;
- rx_pkt_size = rx_pkt_size;
-
- //
- // This must be a DHCP Ack message.
- //
- magik = htonl (DHCP4_MAGIK_NUMBER);
-
- if (CompareMem (&rx_pkt->dhcp4.magik, &magik, 4)) {
- return -1;
- }
-
- efi_status = find_opt (rx_pkt, DHCP4_MESSAGE_TYPE, 0, &msg_type_op);
-
- if (EFI_ERROR (efi_status)) {
- return -1;
- }
-
- if (msg_type_op->len != 1) {
- return -1;
- }
-
- if (msg_type_op->data[0] != DHCP4_MESSAGE_TYPE_ACK) {
- return -1;
- }
- //
- // There must be a server identifier.
- //
- efi_status = find_opt (rx_pkt, DHCP4_SERVER_IDENTIFIER, 0, &srvid_op);
-
- if (EFI_ERROR (efi_status)) {
- return -1;
- }
-
- if (srvid_op->len != 4) {
- return -1;
- }
- //
- // There should be a renewal time.
- // If there is not, we will default to the 7/8 of the rebinding time.
- //
- efi_status = find_opt (rx_pkt, DHCP4_RENEWAL_TIME, 0, &renew_op);
-
- if (EFI_ERROR (efi_status)) {
- renew_op = NULL;
- } else if (renew_op->len != 4) {
- renew_op = NULL;
- }
- //
- // There should be a rebinding time.
- // If there is not, we will default to 7/8 of the lease time.
- //
- efi_status = find_opt (rx_pkt, DHCP4_REBINDING_TIME, 0, &rebind_op);
-
- if (EFI_ERROR (efi_status)) {
- rebind_op = NULL;
- } else if (rebind_op->len != 4) {
- rebind_op = NULL;
- }
- //
- // There should be a lease time.
- // If there is not, we will default to one week.
- //
- efi_status = find_opt (rx_pkt, DHCP4_LEASE_TIME, 0, &lease_time_op);
-
- if (EFI_ERROR (efi_status)) {
- lease_time_op = NULL;
- } else if (lease_time_op->len != 4) {
- lease_time_op = NULL;
- }
- //
- // Packet looks good. Double check the renew, rebind and lease times.
- //
- CopyMem (&Private->ServerIp, srvid_op->data, 4);
-
- if (renew_op != NULL) {
- CopyMem (&Private->RenewTime, renew_op->data, 4);
- Private->RenewTime = htonl (Private->RenewTime);
- } else {
- Private->RenewTime = 0;
- }
-
- if (rebind_op != NULL) {
- CopyMem (&Private->RebindTime, rebind_op->data, 4);
- Private->RebindTime = htonl (Private->RebindTime);
- } else {
- Private->RebindTime = 0;
- }
-
- if (lease_time_op != NULL) {
- CopyMem (&Private->LeaseTime, lease_time_op->data, 4);
- Private->LeaseTime = htonl (Private->LeaseTime);
- } else {
- Private->LeaseTime = 0;
- }
-
- if (Private->LeaseTime < 60) {
- Private->LeaseTime = 7 * 86400;
- }
-
- if (Private->RebindTime < 52 || Private->RebindTime >= Private->LeaseTime) {
- Private->RebindTime = Private->LeaseTime / 2 + Private->LeaseTime / 4 + Private->LeaseTime / 8;
- }
-
- if (Private->RenewTime < 45 || Private->RenewTime >= Private->RebindTime) {
- Private->RenewTime = Private->RebindTime / 2 + Private->RebindTime / 4 + Private->RebindTime / 8;
- }
-
- return 1;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-STATIC
-EFI_STATUS
-EFIAPI
-renew_rebind (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN seconds_timeout,
- IN BOOLEAN renew
- )
-{
- PXE_DHCP4_PRIVATE_DATA *Private;
- EFI_IP_ADDRESS ServerIp;
- EFI_IP_ADDRESS client_ip;
- EFI_IP_ADDRESS subnet_mask;
- EFI_IP_ADDRESS gateway_ip;
- DHCP4_PACKET Request;
- DHCP4_PACKET AckNak;
- DHCP4_OP *op;
- EFI_STATUS efi_status;
-
- //
- // Check for invalid parameters.
- //
- if (This == NULL || seconds_timeout < DHCP4_MIN_SECONDS || seconds_timeout > DHCP4_MAX_SECONDS) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Check for proper protocol state.
- //
- if (This->Data == NULL) {
- return EFI_NOT_STARTED;
- }
-
- if (!This->Data->SelectCompleted) {
- return EFI_NOT_READY;
- }
-
- if (This->Data->IsBootp) {
- return EFI_SUCCESS;
- }
-
- if (!This->Data->IsAck) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Get pointer to instance data.
- //
- Private = PXE_DHCP4_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Private->PxeBc == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Copy Discover packet to temporary request packet
- // to be used for Renew/Rebind operation.
- //
- CopyMem (&Request, &This->Data->Discover, sizeof (DHCP4_PACKET));
-
- CopyMem (&Request.dhcp4.ciaddr, &This->Data->AckNak.dhcp4.yiaddr, 4);
-
- Request.dhcp4.flags = 0; /* Reply does not need to be broadcast. */
-
- //
- // Change message type from discover to request.
- //
- efi_status = find_opt (&Request, DHCP4_MESSAGE_TYPE, 0, &op);
-
- if (EFI_ERROR (efi_status)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (op->len != 1) {
- return EFI_INVALID_PARAMETER;
- }
-
- op->data[0] = DHCP4_MESSAGE_TYPE_REQUEST;
-
- //
- // Need a subnet mask.
- //
- efi_status = find_opt (
- &This->Data->AckNak,
- DHCP4_SUBNET_MASK,
- 0,
- &op
- );
-
- if (EFI_ERROR (efi_status)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (op->len != 4) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&subnet_mask, sizeof (EFI_IP_ADDRESS));
- CopyMem (&subnet_mask, op->data, 4);
-
- //
- // Need a server IP address (renew) or a broadcast
- // IP address (rebind).
- //
- ZeroMem (&gateway_ip, sizeof (EFI_IP_ADDRESS));
-
- if (renew) {
- efi_status = find_opt (
- &This->Data->AckNak,
- DHCP4_SERVER_IDENTIFIER,
- 0,
- &op
- );
-
- if (EFI_ERROR (efi_status)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (op->len != 4) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&ServerIp, sizeof (EFI_IP_ADDRESS));
- CopyMem (&ServerIp, op->data, 4);
-
- //
- //
- //
- if (CompareMem (&This->Data->AckNak.dhcp4.giaddr, &gateway_ip, 4)) {
- CopyMem (&gateway_ip, &This->Data->AckNak.dhcp4.giaddr, 4);
- }
- } else {
- SetMem (&ServerIp, sizeof (EFI_IP_ADDRESS), 0xFF);
- }
- //
- // Need a client IP address.
- //
- ZeroMem (&client_ip, sizeof (EFI_IP_ADDRESS));
- CopyMem (&client_ip, &Request.dhcp4.ciaddr, 4);
-
- //
- //
- //
- efi_status = gBS->HandleProtocol (
- Private->Handle,
- &gEfiPxeDhcp4CallbackProtocolGuid,
- (VOID *) &Private->callback
- );
-
- if (EFI_ERROR (efi_status)) {
- Private->callback = NULL;
- }
-
- Private->function = renew ? EFI_PXE_DHCP4_FUNCTION_RENEW : EFI_PXE_DHCP4_FUNCTION_REBIND;
-
- //
- // Transimit DHCP request and wait for DHCP ack...
- //
- efi_status = tx_rx_udp (
- Private,
- &ServerIp,
- &gateway_ip,
- &client_ip,
- &subnet_mask,
- &Request,
- &AckNak,
- &acknak_verify,
- seconds_timeout
- );
-
- if (EFI_ERROR (efi_status)) {
- Private->callback = NULL;
- return efi_status;
- }
- //
- // Copy server identifier, renewal time and rebinding time
- // from temporary ack/nak packet into cached ack/nak packet.
- //
- efi_status = find_opt (
- &This->Data->AckNak,
- DHCP4_SERVER_IDENTIFIER,
- 0,
- &op
- );
-
- if (!EFI_ERROR (efi_status)) {
- if (op->len == 4) {
- CopyMem (op->data, &Private->ServerIp, 4);
- }
- }
-
- efi_status = find_opt (&This->Data->AckNak, DHCP4_RENEWAL_TIME, 0, &op);
-
- if (!EFI_ERROR (efi_status)) {
- if (op->len == 4) {
- CopyMem (op->data, &Private->RenewTime, 4);
- }
- }
-
- efi_status = find_opt (&This->Data->AckNak, DHCP4_REBINDING_TIME, 0, &op);
-
- if (!EFI_ERROR (efi_status)) {
- if (op->len == 4) {
- CopyMem (op->data, &Private->RebindTime, 4);
- }
- }
-
- Private->callback = NULL;
- return efi_status;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4Renew (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN seconds_timeout
- )
-{
- return renew_rebind (This, seconds_timeout, TRUE);
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4Rebind (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN UINTN seconds_timeout
- )
-{
- return renew_rebind (This, seconds_timeout, FALSE);
-}
-
-/* eof - PxeDhcp4RenewRebind.c */
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Run.c b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Run.c
deleted file mode 100644
index 4f7ce44..0000000
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Run.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- PxeDhcp4Run.c
-
-Abstract:
- Simplified entry point for starting basic PxeDhcp4 client operation.
-
---*/
-
-
-#include "PxeDhcp4.h"
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4Run (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN OPTIONAL UINTN OpLen,
- IN OPTIONAL VOID *OpList
- )
-{
- PXE_DHCP4_PRIVATE_DATA *Private;
- DHCP4_PACKET *offer_list;
- EFI_STATUS efi_status;
- EFI_IP_ADDRESS zero_ip;
- UINTN offers;
- UINTN timeout;
- UINTN n;
- UINT16 seconds;
-
- //
- // Validate parameters.
- //
- if (This == NULL || (OpLen != 0 && OpList == NULL) || (OpLen == 0 && OpList != NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- for (n = 0; n < OpLen;) {
- switch (((UINT8 *) OpList)[n]) {
- case DHCP4_PAD:
- ++n;
- continue;
-
- case DHCP4_END:
- ++n;
- break;
-
- default:
- n += 2 + ((UINT8 *) OpList)[n + 1];
- continue;
- }
-
- break;
- }
-
- if (n != OpLen) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Get pointer to instance data.
- //
- Private = PXE_DHCP4_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Private->PxeBc == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Initialize DHCP discover packet.
- //
- efi_status = PxeDhcp4Setup (This, NULL);
-
- if (EFI_ERROR (efi_status)) {
- return efi_status;
- }
-
- for (n = 0; n < OpLen;) {
- switch (((UINT8 *) OpList)[n]) {
- case DHCP4_PAD:
- ++n;
- continue;
-
- case DHCP4_END:
- ++n;
- break;
-
- default:
- efi_status = add_opt (
- &This->Data->Discover,
- (DHCP4_OP *) &(((UINT8 *) OpList)[n])
- );
-
- if (EFI_ERROR (efi_status)) {
- return efi_status;
- }
-
- n += 2 + ((UINT8 *) OpList)[n + 1];
- continue;
- }
-
- break;
- }
- //
- // Basic DHCP D.O.R.A.
- // 1, 2, 4, 8, 16 & 32 second timeouts.
- // Callback routine can be used to break out earlier.
- //
- ZeroMem (&zero_ip, sizeof (EFI_IP_ADDRESS));
-
- for (timeout = 1;;) {
- //
- // Broadcast DHCP discover and wait for DHCP offers.
- //
- efi_status = PxeDhcp4Init (This, timeout, &offers, &offer_list);
-
- if ((efi_status != EFI_NO_RESPONSE) &&
- (efi_status != EFI_TIMEOUT) &&
- (efi_status != EFI_SUCCESS)) {
- return efi_status;
- }
- //
- // Try to select from each DHCP or BOOTP offer.
- //
- for (n = 0; n < offers; ++n) {
- //
- // Ignore proxyDHCP offers.
- //
- if (!CompareMem (&offer_list[n].dhcp4.yiaddr, &zero_ip, 4)) {
- continue;
- }
- //
- // Issue DHCP Request and wait for DHCP Ack/Nak.
- //
- efi_status = PxeDhcp4Select (
- This,
- timeout,
- &offer_list[n]
- );
-
- if (EFI_ERROR (efi_status)) {
- continue;
- }
- //
- // Exit when we have got our DHCP Ack.
- //
- if (This->Data->IsAck) {
- return EFI_SUCCESS;
- }
- }
- //
- // No DHCP Acks. Release DHCP Offer list storage.
- //
- if (offer_list != NULL) {
- FreePool (offer_list);
- offer_list = NULL;
- }
- //
- // Try again until we have used up >= DHCP4_MAX_SECONDS.
- //
- if ((timeout <<= 1) > DHCP4_MAX_SECONDS) {
- if (!EFI_ERROR (efi_status)) {
- efi_status = EFI_TIMEOUT;
- }
-
- return efi_status;
- }
- //
- // Next timeout value.
- //
- CopyMem (&seconds, &This->Data->Discover.dhcp4.secs, 2);
-
- seconds = htons (htons (seconds) + timeout);
-
- CopyMem (&This->Data->Discover.dhcp4.secs, &seconds, 2);
- }
-}
-
-/* eof - PxeDhcp4Run.c */
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Setup.c b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Setup.c
deleted file mode 100644
index 88a66d5..0000000
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/PxeDhcp4Setup.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- PxeDhcp4Setup.c
-
-Abstract:
-
---*/
-
-
-#include "PxeDhcp4.h"
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-EFIAPI
-PxeDhcp4Setup (
- IN EFI_PXE_DHCP4_PROTOCOL *This,
- IN EFI_PXE_DHCP4_DATA *Data
- )
-{
- PXE_DHCP4_PRIVATE_DATA *Private;
- DHCP4_HEADER *Packet;
- EFI_STATUS EfiStatus;
- UINT8 *OpLen;
- UINT8 *OpPtr;
-
- //
- // Return error if parameters are invalid.
- //
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private = PXE_DHCP4_PRIVATE_DATA_FROM_THIS (This);
-
- if (Private == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (This->Data != NULL) {
- return EFI_ALREADY_STARTED;
- }
-
- if (Private->PxeBc == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Check contents of provided Data structure.
- //
- if (Data != NULL) {
- //
- // Do protocol state checks first.
- //
- if (Data->SelectCompleted) {
- if (!Data->InitCompleted || !Data->SetupCompleted) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Data->IsBootp && !Data->IsAck) {
- return EFI_INVALID_PARAMETER;
- }
- } else if (Data->InitCompleted) {
- if (!Data->SetupCompleted || Data->IsBootp || Data->IsAck) {
- return EFI_INVALID_PARAMETER;
- }
- } else if (Data->SetupCompleted) {
- if (Data->IsBootp || Data->IsAck) {
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // Do packet content checks.
- //
- if (Data->SetupCompleted) {
- //
- // %%TBD - check discover packet
- //
- }
-
- if (Data->SelectCompleted) {
- if (Data->IsBootp) {
- //
- // %%TBD - check offer packet
- //
- if (CompareMem (
- &Data->Discover,
- &Data->Request,
- sizeof (DHCP4_PACKET)
- )) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (CompareMem (
- &Data->Offer,
- &Data->AckNak,
- sizeof (DHCP4_PACKET)
- )) {
- return EFI_INVALID_PARAMETER;
- }
- } else {
- //
- // %%TBD - check offer, request & acknak packets
- //
- }
- }
- }
- //
- // Allocate data structure. Return error
- // if there is not enough available memory.
- //
- This->Data = AllocatePool (sizeof (EFI_PXE_DHCP4_DATA));
- if (This->Data == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Start PxeBc because we want to use its UdpWrite, UdpRead and
- // SetFilter calls.
- //
- EfiStatus = Private->PxeBc->Start (Private->PxeBc, FALSE);
-
- if (EFI_ERROR (EfiStatus)) {
- if (EfiStatus != EFI_ALREADY_STARTED) {
- FreePool (This->Data);
- This->Data = NULL;
- Private->PxeBc->Stop (Private->PxeBc);
- return EfiStatus;
- }
-
- Private->StopPxeBc = FALSE;
- } else {
- Private->StopPxeBc = TRUE;
- }
- //
- // Use new data.
- //
- if (Data != NULL) {
- CopyMem (This->Data, Data, sizeof (EFI_PXE_DHCP4_DATA));
- return EFI_SUCCESS;
- }
- //
- // Initialize new public data structure.
- //
- ZeroMem (This->Data, sizeof (EFI_PXE_DHCP4_DATA));
-
- //
- // Fill in default DHCP discover packet.
- // Check for MAC addresses of strange lengths, just in case.
- //
- Packet = &This->Data->Discover.dhcp4;
-
- Packet->op = BOOTP_REQUEST;
-
- Packet->htype = Private->Snp->Mode->IfType;
-
- if (Private->Snp->Mode->HwAddressSize > 16) {
- Packet->hlen = 16;
- } else {
- Packet->hlen = (UINT8) Private->Snp->Mode->HwAddressSize;
- }
-
- Packet->hops = 0; /* Set to zero per RFC 2131. */
-
- if (Packet->hlen < sizeof Packet->xid) {
- if (Packet->hlen != 0) {
- CopyMem (
- &Packet->xid,
- &Private->Snp->Mode->CurrentAddress,
- Packet->hlen
- );
- }
- } else {
- CopyMem (
- &Packet->xid,
- &Private->Snp->Mode->CurrentAddress.Addr[Packet->hlen - sizeof Packet->xid],
- sizeof Packet->xid
- );
- }
- //
- // %%TBD - xid should be randomized
- //
- Packet->secs = htons (DHCP4_INITIAL_SECONDS);
-
- Packet->flags = htons (DHCP4_BROADCAST_FLAG);
-
- if (Packet->hlen != 0) {
- CopyMem (Packet->chaddr, &Private->Snp->Mode->CurrentAddress, Packet->hlen);
- }
-
- Packet->magik = htonl (DHCP4_MAGIK_NUMBER);
-
- OpPtr = Packet->options;
-
- *OpPtr++ = DHCP4_MESSAGE_TYPE;
- *OpPtr++ = 1;
- *OpPtr++ = DHCP4_MESSAGE_TYPE_DISCOVER;
-
- *OpPtr++ = DHCP4_MAX_MESSAGE_SIZE;
- *OpPtr++ = 2;
- *OpPtr++ = (UINT8) ((DHCP4_DEFAULT_MAX_MESSAGE_SIZE >> 8) & 0xFF);
- *OpPtr++ = (UINT8) (DHCP4_DEFAULT_MAX_MESSAGE_SIZE & 0xFF);
-
- *OpPtr++ = DHCP4_PARAMETER_REQUEST_LIST;
- OpLen = OpPtr;
- *OpPtr++ = 0;
- *OpPtr++ = DHCP4_SUBNET_MASK;
- *OpPtr++ = DHCP4_TIME_OFFSET;
- *OpPtr++ = DHCP4_ROUTER_LIST;
- *OpPtr++ = DHCP4_TIME_SERVERS;
- *OpPtr++ = DHCP4_NAME_SERVERS;
- *OpPtr++ = DHCP4_DNS_SERVERS;
- *OpPtr++ = DHCP4_HOST_NAME;
- *OpPtr++ = DHCP4_BOOT_FILE_SIZE;
- *OpPtr++ = DHCP4_MESSAGE_TYPE;
- *OpPtr++ = DHCP4_DOMAIN_NAME;
- *OpPtr++ = DHCP4_ROOT_PATH;
- *OpPtr++ = DHCP4_EXTENSION_PATH;
- *OpPtr++ = DHCP4_MAX_DATAGRAM_SIZE;
- *OpPtr++ = DHCP4_DEFAULT_TTL;
- *OpPtr++ = DHCP4_BROADCAST_ADDRESS;
- *OpPtr++ = DHCP4_NIS_DOMAIN_NAME;
- *OpPtr++ = DHCP4_NIS_SERVERS;
- *OpPtr++ = DHCP4_NTP_SERVERS;
- *OpPtr++ = DHCP4_VENDOR_SPECIFIC;
- *OpPtr++ = DHCP4_REQUESTED_IP_ADDRESS;
- *OpPtr++ = DHCP4_LEASE_TIME;
- *OpPtr++ = DHCP4_SERVER_IDENTIFIER;
- *OpPtr++ = DHCP4_RENEWAL_TIME;
- *OpPtr++ = DHCP4_REBINDING_TIME;
- *OpPtr++ = DHCP4_CLASS_IDENTIFIER;
- *OpPtr++ = DHCP4_TFTP_SERVER_NAME;
- *OpPtr++ = DHCP4_BOOTFILE;
- *OpPtr++ = 128;
- *OpPtr++ = 129;
- *OpPtr++ = 130;
- *OpPtr++ = 131;
- *OpPtr++ = 132;
- *OpPtr++ = 133;
- *OpPtr++ = 134;
- *OpPtr++ = 135;
- *OpLen = (UINT8) ((OpPtr - OpLen) - 1);
-
- *OpPtr++ = DHCP4_END;
-
- This->Data->SetupCompleted = TRUE;
-
- return EFI_SUCCESS;
-}
-
-/* eof - PxeDhcp4Setup.c */
diff --git a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/support.c b/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/support.c
deleted file mode 100644
index b6667ca..0000000
--- a/EdkModulePkg/Universal/Network/PxeDhcp4/Dxe/support.c
+++ /dev/null
@@ -1,1101 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- support.c
-
-Abstract:
- Miscellaneous support routines for PxeDhcp4 protocol.
-
---*/
-
-
-#include "PxeDhcp4.h"
-
-#define DebugPrint(x)
-//
-// #define DebugPrint(x) Aprint x
-//
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-UINT16
-htons (
- UINTN n
- )
-{
- return (UINT16) ((n >> 8) | (n << 8));
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-UINT32
-htonl (
- UINTN n
- )
-{
- return (UINT32) ((n >> 24) | ((n >> 8) & 0xFF00) | ((n & 0xFF00) << 8) | (n << 24));
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-EFIAPI
-timeout_notify (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- ASSERT (Context);
-
- if (Context != NULL) {
- ((PXE_DHCP4_PRIVATE_DATA *) Context)->TimeoutOccurred = TRUE;
- }
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-EFIAPI
-periodic_notify (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- ASSERT (Context);
-
- if (Context != NULL) {
- ((PXE_DHCP4_PRIVATE_DATA *) Context)->PeriodicOccurred = TRUE;
- }
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-find_opt (
- IN DHCP4_PACKET *Packet,
- IN UINT8 OpCode,
- IN UINTN Skip,
- OUT DHCP4_OP **OpPtr
- )
-/*++
-Routine description:
- Locate option inside DHCP packet.
-
-Parameters:
- Packet := Pointer to DHCP packet structure.
- OpCode := Option op-code to find.
- Skip := Number of found op-codes to skip.
- OpPtr := Pointer to found op-code pointer.
-
-Returns:
- EFI_SUCCESS := Option was found
- EFI_INVALID_PARAMETER := Packet == NULL || OpPtr == NULL
- EFI_INVALID_PARAMETER := OpCode == DHCP4_PAD
- EFI_INVALID_PARAMETER := OpCode == DHCP4_END && Skip != 0
- EFI_INVALID_PARAMETER := DHCP magik number in Packet is not valid
- EFI_NOT_FOUND := op-code was not found in packet
- EFI_INVALID_PARAMETER := If present, DHCP_MAX_MESSAGE_SIZE option
- does not have a valid value.
---*/
-{
- UINTN msg_size;
- UINTN buf_len;
- UINTN n;
- UINT8 *buf;
- UINT8 *end_ptr;
- UINT8 overload;
-
- //
- // Verify parameters.
- //
- if (Packet == NULL || OpPtr == NULL || OpCode == DHCP4_PAD || (OpCode == DHCP4_END && Skip != 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Packet->dhcp4.magik != htonl (DHCP4_MAGIK_NUMBER)) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Initialize search variables.
- //
- *OpPtr = NULL;
-
- msg_size = DHCP4_MAX_PACKET_SIZE - (DHCP4_UDP_HEADER_SIZE + DHCP4_IP_HEADER_SIZE);
-
- overload = 0;
- end_ptr = NULL;
-
- buf = Packet->dhcp4.options;
- buf_len = msg_size - (Packet->dhcp4.options - Packet->raw);
-
- //
- // Start searching for requested option.
- //
- for (n = 0;;) {
- //
- // If match is found, decrement skip count and return
- // when desired match is found.
- //
- if (buf[n] == OpCode) {
- *OpPtr = (DHCP4_OP *) &buf[n];
-
- if (Skip-- == 0) {
- return EFI_SUCCESS;
- }
- }
- //
- // Skip past current option. Check for option overload
- // and message size options since these will affect the
- // amount of data to be searched.
- //
- switch (buf[n]) {
- case DHCP4_PAD:
- //
- // Remember the first pad byte of a group. This
- // could be the end of a badly formed packet.
- //
- if (end_ptr == NULL) {
- end_ptr = &buf[n];
- }
-
- ++n;
- break;
-
- case DHCP4_END:
- //
- // If we reach the end we are done.
- //
- end_ptr = NULL;
- return EFI_NOT_FOUND;
-
- case DHCP4_OPTION_OVERLOAD:
- //
- // Remember the option overload value since it
- // could cause the search to continue into
- // the fname and sname fields.
- //
- end_ptr = NULL;
-
- if (buf[n + 1] == 1) {
- overload = buf[n + 2];
- }
-
- n += 2 + buf[n + 1];
- break;
-
- case DHCP4_MAX_MESSAGE_SIZE:
- //
- // Remember the message size value since it could
- // change the amount of option buffer to search.
- //
- end_ptr = NULL;
-
- if (buf[n + 1] == 2 && buf == Packet->dhcp4.options) {
- msg_size = ((buf[n + 2] << 8) | buf[n + 3]) - (DHCP4_UDP_HEADER_SIZE + DHCP4_IP_HEADER_SIZE);
-
- if (msg_size < 328) {
- return EFI_INVALID_PARAMETER;
- }
-
- buf_len = msg_size - (Packet->dhcp4.options - Packet->raw);
-
- if (n + 2 + buf[n + 1] > buf_len) {
- return EFI_INVALID_PARAMETER;
- }
- }
-
- /* fall thru */
- default:
- end_ptr = NULL;
-
- n += 2 + buf[n + 1];
- }
- //
- // Keep searching until the end of the buffer is reached.
- //
- if (n < buf_len) {
- continue;
- }
- //
- // Reached end of current buffer. Check if we are supposed
- // to search the fname and sname buffers.
- //
- if (buf == Packet->dhcp4.options &&
- (overload == DHCP4_OVERLOAD_FNAME || overload == DHCP4_OVERLOAD_FNAME_AND_SNAME)
- ) {
- buf = Packet->dhcp4.fname;
- buf_len = 128;
- n = 0;
- continue;
- }
-
- if (buf != Packet->dhcp4.sname && (overload == DHCP4_OVERLOAD_SNAME || overload == DHCP4_OVERLOAD_FNAME_AND_SNAME)) {
- buf = Packet->dhcp4.sname;
- buf_len = 64;
- n = 0;
- continue;
- }
- //
- // End of last buffer reached. If this was a search
- // for the end of the options, go back to the start
- // of the current pad block.
- //
- if (OpCode == DHCP4_END && end_ptr != NULL) {
- *OpPtr = (DHCP4_OP *) end_ptr;
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
- }
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-add_opt (
- IN DHCP4_PACKET *Packet,
- IN DHCP4_OP *OpPtr
- )
-/*++
-Routine description:
- Add option to DHCP packet.
-
-Parameters:
- Packet := Pointer to DHCP packet structure.
- OpPtr := Pointer to DHCP option.
-
-Returns:
- EFI_INVALID_PARAMETER := Packet == NULL || OpPtr == NULL
- EFI_INVALID_PARAMETER := OpPtr->op == DHCP4_PAD || OpPtr->op == DHCP4_END
- EFI_INVALID_PARAMETER := DHCP magik number in DHCP packet is not valid
- EFI_INVALID_PARAMETER := If DHCP_MAX_MESSAGE_SIZE option is present and
- is not valid
- EFI_INVALID_PARAMETER := If DHCP_OPTION_OVERLOAD option is present and
- is not valid
- EFI_DEVICE_ERROR := Cannot determine end of packet
- EFI_BUFFER_TOO_SMALL := Not enough room in packet to add option
- EFI_SUCCESS := Option added to DHCP packet
---*/
-{
- EFI_STATUS efi_status;
- DHCP4_OP *msg_size_op;
- DHCP4_OP *overload_op;
- DHCP4_OP *op;
- UINTN msg_size;
- UINTN buf_len;
- UINT32 magik;
- UINT8 *buf;
-
- //
- // Verify parameters.
- //
- ASSERT (Packet);
- ASSERT (OpPtr);
-
- if (Packet == NULL || OpPtr == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (OpPtr->op) {
- case DHCP4_PAD:
- case DHCP4_END:
- //
- // No adding PAD or END.
- //
- return EFI_INVALID_PARAMETER;
- }
- //
- // Check the DHCP magik number.
- //
- CopyMem (&magik, &Packet->dhcp4.magik, 4);
-
- if (magik != htonl (DHCP4_MAGIK_NUMBER)) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Find the DHCP message size option.
- //
- msg_size = DHCP4_DEFAULT_MAX_MESSAGE_SIZE;
-
- efi_status = find_opt (
- Packet,
- DHCP4_MAX_MESSAGE_SIZE,
- 0,
- &msg_size_op
- );
-
- if (EFI_ERROR (efi_status)) {
- if (efi_status != EFI_NOT_FOUND) {
- DebugPrint (
- ("%s:%d:%r\n",
- __FILE__,
- __LINE__,
- efi_status)
- );
- return efi_status;
- }
-
- msg_size_op = NULL;
- } else {
- CopyMem (&msg_size, msg_size_op->data, 2);
- msg_size = htons (msg_size);
-
- if (msg_size < DHCP4_DEFAULT_MAX_MESSAGE_SIZE) {
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // Find the DHCP option overload option.
- //
- efi_status = find_opt (
- Packet,
- DHCP4_OPTION_OVERLOAD,
- 0,
- &overload_op
- );
-
- if (EFI_ERROR (efi_status)) {
- if (efi_status != EFI_NOT_FOUND) {
- DebugPrint (
- ("%s:%d:%r\n",
- __FILE__,
- __LINE__,
- efi_status)
- );
- return efi_status;
- }
-
- overload_op = NULL;
- } else {
- if (overload_op->len != 1) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (overload_op->data[0]) {
- case 1:
- case 2:
- case 3:
- break;
-
- default:
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // Find the end of the packet.
- //
- efi_status = find_opt (Packet, DHCP4_END, 0, &op);
-
- if (EFI_ERROR (efi_status)) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Find which buffer the end is in.
- //
- if ((UINTN) op >= (UINTN) (buf = Packet->dhcp4.options)) {
- buf_len = (msg_size - ((UINT8 *) &Packet->dhcp4.options - (UINT8 *) &Packet->raw)) - (DHCP4_UDP_HEADER_SIZE + DHCP4_IP_HEADER_SIZE);
- } else if ((UINTN) op >= (UINTN) (buf = Packet->dhcp4.fname)) {
- buf_len = 128;
- } else if ((UINTN) op >= (UINTN) (buf = Packet->dhcp4.sname)) {
- buf_len = 64;
- } else {
- return EFI_DEVICE_ERROR;
- }
- //
- // Add option to current buffer if there is no overlow.
- //
- if ((UINTN) ((&op->op - buf) + 3 + op->len) < buf_len) {
- CopyMem (op, OpPtr, OpPtr->len + 2);
-
- op->data[op->len] = DHCP4_END;
-
- return EFI_SUCCESS;
- }
- //
- // Error if there is no space for option.
- //
- return EFI_BUFFER_TOO_SMALL;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-start_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN OPTIONAL EFI_IP_ADDRESS *StationIp,
- IN OPTIONAL EFI_IP_ADDRESS *SubnetMask
- )
-/*++
-Routine description:
- Setup PXE BaseCode UDP stack.
-
-Parameters:
- Private := Pointer to PxeDhcp4 private data.
- StationIp := Pointer to IP address or NULL if not known.
- SubnetMask := Pointer to subnet mask or NULL if not known.
-
-Returns:
- EFI_INVALID_PARAMETER := Private == NULL || Private->PxeBc == NULL
- EFI_INVALID_PARAMETER := Only one of StationIp and SubnetMask is given
- EFI_SUCCESS := UDP stack is ready
- other := Error from PxeBc->SetIpFilter() or PxeBc->SetStationIp()
---*/
-{
- EFI_PXE_BASE_CODE_IP_FILTER bcast_filter;
- EFI_STATUS efi_status;
-
- //
- //
- //
- ASSERT (Private);
- ASSERT (Private->PxeBc);
-
- if (Private == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (Private->PxeBc == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (StationIp != NULL && SubnetMask == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (StationIp == NULL && SubnetMask != NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Setup broadcast receive filter...
- //
- ZeroMem (&bcast_filter, sizeof (EFI_PXE_BASE_CODE_IP_FILTER));
-
- bcast_filter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST;
- bcast_filter.IpCnt = 0;
-
- efi_status = Private->PxeBc->SetIpFilter (
- Private->PxeBc,
- &bcast_filter
- );
-
- if (EFI_ERROR (efi_status)) {
- DebugPrint (("%s:%d:%r\n", __FILE__, __LINE__, efi_status));
- return efi_status;
- }
- //
- // Configure station IP address and subnet mask...
- //
- efi_status = Private->PxeBc->SetStationIp (
- Private->PxeBc,
- StationIp,
- SubnetMask
- );
-
- if (EFI_ERROR (efi_status)) {
- DebugPrint (("%s:%d:%r\n", __FILE__, __LINE__, efi_status));
- }
-
- return efi_status;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-stop_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private
- )
-{
- //
- //
- //
- ASSERT (Private);
- ASSERT (Private->PxeBc);
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-start_receive_events (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN UINTN SecondsTimeout
- )
-/*++
-Routine description:
- Create periodic and timeout receive events.
-
-Parameters:
- Private := Pointer to PxeDhcp4 private data.
- SecondsTimeout := Number of seconds to wait before timeout.
-
-Returns:
---*/
-{
- EFI_STATUS efi_status;
- UINTN random;
-
- //
- //
- //
- ASSERT (Private);
- ASSERT (SecondsTimeout);
-
- if (Private == NULL || SecondsTimeout == 0) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Need a bettern randomizer...
- // For now adjust the timeout value by the least significant
- // digit in the MAC address.
- //
- random = 0;
-
- if (Private->PxeDhcp4.Data != NULL) {
- if (Private->PxeDhcp4.Data->Discover.dhcp4.hlen != 0 && Private->PxeDhcp4.Data->Discover.dhcp4.hlen <= 16) {
- random = 0xFFF & Private->PxeDhcp4.Data->Discover.dhcp4.chaddr[Private->PxeDhcp4.Data->Discover.dhcp4.hlen - 1];
- }
- }
- //
- // Setup timeout event and start timer.
- //
- efi_status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- &timeout_notify,
- Private,
- &Private->TimeoutEvent
- );
-
- if (EFI_ERROR (efi_status)) {
- DebugPrint (("%s:%d:%r\n", __FILE__, __LINE__, efi_status));
- return efi_status;
- }
-
- efi_status = gBS->SetTimer (
- Private->TimeoutEvent,
- TimerRelative,
- SecondsTimeout * 10000000 + random
- );
-
- if (EFI_ERROR (efi_status)) {
- DebugPrint (("%s:%d:%r\n", __FILE__, __LINE__, efi_status));
- gBS->CloseEvent (Private->TimeoutEvent);
- return efi_status;
- }
-
- Private->TimeoutOccurred = FALSE;
-
- //
- // Setup periodic event for callbacks
- //
- efi_status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- &periodic_notify,
- Private,
- &Private->PeriodicEvent
- );
-
- if (EFI_ERROR (efi_status)) {
- DebugPrint (("%s:%d:%r\n", __FILE__, __LINE__, efi_status));
- gBS->CloseEvent (Private->TimeoutEvent);
- return efi_status;
- }
-
- efi_status = gBS->SetTimer (
- Private->PeriodicEvent,
- TimerPeriodic,
- 1000000
- ); /* 1/10th second */
-
- if (EFI_ERROR (efi_status)) {
- DebugPrint (("%s:%d:%r\n", __FILE__, __LINE__, efi_status));
- gBS->CloseEvent (Private->TimeoutEvent);
- gBS->CloseEvent (Private->PeriodicEvent);
- return efi_status;
- }
-
- Private->PeriodicOccurred = FALSE;
-
- return EFI_SUCCESS;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-VOID
-stop_receive_events (
- IN PXE_DHCP4_PRIVATE_DATA *Private
- )
-{
- //
- //
- //
- ASSERT (Private);
-
- if (Private == NULL) {
- return ;
- }
- //
- //
- //
- gBS->CloseEvent (Private->TimeoutEvent);
- Private->TimeoutOccurred = FALSE;
-
- //
- //
- //
- gBS->CloseEvent (Private->PeriodicEvent);
- Private->PeriodicOccurred = FALSE;
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-tx_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN EFI_IP_ADDRESS *dest_ip,
- IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
- IN EFI_IP_ADDRESS *src_ip,
- IN VOID *buffer,
- IN UINTN BufferSize
- )
-/*++
-Routine description:
- Transmit DHCP packet.
-
-Parameters:
- Private := Pointer to PxeDhcp4 private data
- dest_ip := Pointer to destination IP address
- gateway_ip := Pointer to gateway IP address or NULL
- src_ip := Pointer to source IP address or NULL
- buffer := Pointer to buffer to transmit
- BufferSize := Size of buffer in bytes
-
-Returns:
- EFI_INVALID_PARAMETER := Private == NULL || dest_ip == NULL ||
- buffer == NULL || BufferSize < 300 || Private->PxeBc == NULL
- EFI_SUCCESS := Buffer was transmitted
- other := Return from PxeBc->UdpWrite()
---*/
-{
- EFI_PXE_BASE_CODE_UDP_PORT dest_port;
- EFI_PXE_BASE_CODE_UDP_PORT src_port;
- EFI_IP_ADDRESS zero_ip;
-
- //
- //
- //
- ASSERT (Private);
- ASSERT (dest_ip);
- ASSERT (buffer);
- ASSERT (BufferSize >= 300);
-
- if (Private == NULL || dest_ip == NULL || buffer == NULL || BufferSize < 300) {
- return EFI_INVALID_PARAMETER;
- }
-
- ASSERT (Private->PxeBc);
-
- if (Private->PxeBc == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Transmit DHCP discover packet...
- //
- ZeroMem (&zero_ip, sizeof (EFI_IP_ADDRESS));
-
- if (src_ip == NULL) {
- src_ip = &zero_ip;
- }
-
- dest_port = DHCP4_SERVER_PORT;
- src_port = DHCP4_CLIENT_PORT;
-
- return Private->PxeBc->UdpWrite (
- Private->PxeBc,
- EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT,
- dest_ip,
- &dest_port,
- gateway_ip,
- src_ip,
- &src_port,
- NULL,
- NULL,
- &BufferSize,
- buffer
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-rx_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- OUT VOID *buffer,
- IN OUT UINTN *BufferSize,
- IN OUT EFI_IP_ADDRESS *dest_ip,
- IN OUT EFI_IP_ADDRESS *src_ip,
- IN UINT16 op_flags
- )
-/*++
-Routine description:
- Receive DHCP packet.
-
-Parameters:
- Private := Pointer to PxeDhcp4 private data
- buffer := Pointer to buffer to receive DHCP packet
- BufferSize := Pointer to buffer size in bytes
- dest_ip := Pointer to destination IP address
- src_ip := Pointer to source IP address
- op_flags := UDP receive operation flags
-
-Returns:
- EFI_INVALID_PARAMETER :=
- EFI_SUCCESS := Packet received
- other := Return from PxeBc->UdpRead()
---*/
-{
- EFI_PXE_BASE_CODE_UDP_PORT dest_port;
- EFI_PXE_BASE_CODE_UDP_PORT src_port;
-
- //
- //
- //
- ASSERT (Private);
- ASSERT (buffer);
- ASSERT (dest_ip);
- ASSERT (src_ip);
-
- if (Private == NULL || buffer == NULL || dest_ip == NULL || src_ip == NULL || BufferSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ASSERT (Private->PxeBc);
-
- if (Private->PxeBc == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Check for packet
- //
- *BufferSize = sizeof (DHCP4_PACKET);
-
- dest_port = DHCP4_CLIENT_PORT;
- src_port = DHCP4_SERVER_PORT;
-
- return Private->PxeBc->UdpRead (
- Private->PxeBc,
- op_flags,
- dest_ip,
- &dest_port,
- src_ip,
- &src_port,
- NULL,
- NULL,
- BufferSize,
- buffer
- );
-}
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-EFI_STATUS
-tx_rx_udp (
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN OUT EFI_IP_ADDRESS *ServerIp,
- IN OPTIONAL EFI_IP_ADDRESS *gateway_ip,
- IN OPTIONAL EFI_IP_ADDRESS *client_ip,
- IN OPTIONAL EFI_IP_ADDRESS *SubnetMask,
- IN DHCP4_PACKET *tx_pkt,
- OUT DHCP4_PACKET *rx_pkt,
- IN INTN (*rx_vfy)(
- IN PXE_DHCP4_PRIVATE_DATA *Private,
- IN DHCP4_PACKET *tx_pkt,
- IN DHCP4_PACKET *rx_pkt,
- IN UINTN rx_pkt_size
- ),
- IN UINTN SecondsTimeout
- )
-/*++
-Routine description:
- Transmit DHCP packet and wait for replies.
-
-Parameters:
- Private := Pointer to PxeDhcp4 private data
- ServerIp := Pointer to server IP address
- gateway_ip := Pointer to gateway IP address or NULL
- client_ip := Pointer to client IP address or NULL
- SubnetMask := Pointer to subnet mask or NULL
- tx_pkt := Pointer to DHCP packet to transmit
- rx_pkt := Pointer to DHCP packet receive buffer
- rx_vfy := Pointer to DHCP packet receive verification routine
- SecondsTimeout := Number of seconds until timeout
-
-Returns:
- EFI_INVALID_PARAMETER := Private == NULL || ServerIp == NULL ||
- tx_pkt == NULL || rx_pkt == NULL || rx_vfy == NULL || Private->PxeBc == NULL
- EFI_ABORTED := Receive aborted
- EFI_TIMEOUT := No packets received
- EFI_SUCCESS := Packet(s) received
- other := Returns from other PxeDhcp4 support routines
---*/
-{
- EFI_PXE_DHCP4_CALLBACK_STATUS CallbackStatus;
- EFI_IP_ADDRESS dest_ip;
- EFI_IP_ADDRESS src_ip;
- EFI_STATUS efi_status;
- DHCP4_OP *msg_size_op;
- UINTN pkt_size;
- UINTN n;
- UINT16 msg_size;
- UINT16 op_flags;
- BOOLEAN done_flag;
- BOOLEAN got_packet;
-
- //
- // Bad programmer check...
- //
- ASSERT (Private);
- ASSERT (ServerIp);
- ASSERT (tx_pkt);
- ASSERT (rx_pkt);
- ASSERT (rx_vfy);
-
- if (Private == NULL || ServerIp == NULL || tx_pkt == NULL || rx_pkt == NULL || rx_vfy == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ASSERT (Private->PxeBc);
-
- if (Private->PxeBc == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Enable UDP...
- //
- efi_status = start_udp (Private, client_ip, SubnetMask);
-
- if (EFI_ERROR (efi_status)) {
- DebugPrint (("%s:%d:%r\n", __FILE__, __LINE__, efi_status));
- return efi_status;
- }
- //
- // Get length of transmit packet...
- //
- msg_size = DHCP4_DEFAULT_MAX_MESSAGE_SIZE;
-
- efi_status = find_opt (
- tx_pkt,
- DHCP4_MAX_MESSAGE_SIZE,
- 0,
- &msg_size_op
- );
-
- if (!EFI_ERROR (efi_status)) {
- CopyMem (&msg_size, msg_size_op->data, 2);
-
- if ((msg_size = htons (msg_size)) < 328) {
- msg_size = 328;
- }
- }
- //
- // Transmit packet...
- //
- efi_status = tx_udp (
- Private,
- ServerIp,
- gateway_ip,
- client_ip,
- tx_pkt,
- msg_size - (DHCP4_UDP_HEADER_SIZE + DHCP4_IP_HEADER_SIZE)
- );
-
- if (EFI_ERROR (efi_status)) {
- DebugPrint (("%s:%d:%r\n", __FILE__, __LINE__, efi_status));
- stop_udp (Private);
- return efi_status;
- }
- //
- // Enable periodic and timeout events...
- //
- efi_status = start_receive_events (Private, SecondsTimeout);
-
- if (EFI_ERROR (efi_status)) {
- DebugPrint (("%s:%d:%r\n", __FILE__, __LINE__, efi_status));
- stop_udp (Private);
- return efi_status;
- }
- //
- // Wait for packet(s)...
- //
-
- done_flag = FALSE;
- got_packet = FALSE;
-
- while (!done_flag) {
- //
- // Check for timeout event...
- //
- if (Private->TimeoutOccurred) {
- efi_status = EFI_SUCCESS;
- break;
- }
- //
- // Check for periodic event...
- //
- if (Private->PeriodicOccurred && Private->callback != NULL) {
- CallbackStatus = EFI_PXE_DHCP4_CALLBACK_STATUS_CONTINUE;
-
- if (Private->callback->Callback != NULL) {
- CallbackStatus = (Private->callback->Callback) (&Private->PxeDhcp4, Private->function, 0, NULL);
- }
-
- switch (CallbackStatus) {
- case EFI_PXE_DHCP4_CALLBACK_STATUS_CONTINUE:
- break;
-
- case EFI_PXE_DHCP4_CALLBACK_STATUS_ABORT:
- default:
- stop_receive_events (Private);
- stop_udp (Private);
- return EFI_ABORTED;
- }
-
- Private->PeriodicOccurred = FALSE;
- }
- //
- // Check for packet...
- //
- if (client_ip == NULL) {
- SetMem (&dest_ip, sizeof (EFI_IP_ADDRESS), 0xFF);
- } else {
- CopyMem (&dest_ip, client_ip, sizeof (EFI_IP_ADDRESS));
- }
-
- SetMem (&src_ip, sizeof (EFI_IP_ADDRESS), 0xFF);
-
- if (CompareMem (&src_ip, &ServerIp, sizeof (EFI_IP_ADDRESS))) {
- ZeroMem (&src_ip, sizeof (EFI_IP_ADDRESS));
- op_flags = EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP;
- } else {
- op_flags = 0;
- }
-
- efi_status = rx_udp (
- Private,
- rx_pkt,
- &pkt_size,
- &dest_ip,
- &src_ip,
- op_flags
- );
-
- if (efi_status == EFI_TIMEOUT) {
- efi_status = EFI_SUCCESS;
- continue;
- }
-
- if (EFI_ERROR (efi_status)) {
- break;
- }
- //
- // Some basic packet sanity checks..
- //
- if (pkt_size < 300) {
- continue;
- }
-
- if (rx_pkt->dhcp4.op != BOOTP_REPLY) {
- continue;
- }
-
- if (tx_pkt->dhcp4.htype != rx_pkt->dhcp4.htype) {
- continue;
- }
-
- if ((n = tx_pkt->dhcp4.hlen) != rx_pkt->dhcp4.hlen) {
- continue;
- }
-
- if (CompareMem (&tx_pkt->dhcp4.xid, &rx_pkt->dhcp4.xid, 4)) {
- continue;
- }
-
- if (n != 0) {
- if (n >= 16) {
- n = 16;
- }
-
- if (CompareMem (tx_pkt->dhcp4.chaddr, rx_pkt->dhcp4.chaddr, n)) {
- continue;
- }
- }
- //
- // Internal callback packet verification...
- //
- switch ((*rx_vfy) (Private, tx_pkt, rx_pkt, pkt_size)) {
- case -2: /* ignore and stop */
- stop_receive_events (Private);
- stop_udp (Private);
- return EFI_ABORTED;
-
- case -1: /* ignore and wait */
- continue;
-
- case 0: /* accept and wait */
- break;
-
- case 1: /* accept and stop */
- done_flag = TRUE;
- break;
-
- default:
- ASSERT (0);
- }
- //
- // External callback packet verification...
- //
- CallbackStatus = EFI_PXE_DHCP4_CALLBACK_STATUS_KEEP_CONTINUE;
-
- if (Private->callback != NULL) {
- if (Private->callback->Callback != NULL) {
- CallbackStatus = (Private->callback->Callback) (&Private->PxeDhcp4, Private->function, (UINT32) pkt_size, rx_pkt);
- }
- }
-
- switch (CallbackStatus) {
- case EFI_PXE_DHCP4_CALLBACK_STATUS_IGNORE_CONTINUE:
- continue;
-
- case EFI_PXE_DHCP4_CALLBACK_STATUS_KEEP_ABORT:
- done_flag = TRUE;
- break;
-
- case EFI_PXE_DHCP4_CALLBACK_STATUS_IGNORE_ABORT:
- stop_receive_events (Private);
- stop_udp (Private);
- return EFI_ABORTED;
-
- case EFI_PXE_DHCP4_CALLBACK_STATUS_KEEP_CONTINUE:
- default:
- break;
- }
- //
- // We did! We did get a packet!
- //
- got_packet = TRUE;
- }
- //
- //
- //
- stop_receive_events (Private);
- stop_udp (Private);
-
- if (EFI_ERROR (efi_status)) {
- DebugPrint (("%s:%d:%r\n", __FILE__, __LINE__, efi_status));
- return efi_status;
- }
-
- if (got_packet) {
- return EFI_SUCCESS;
- } else {
- return EFI_TIMEOUT;
- }
-}
-
-/* eof - support.c */
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/ComponentName.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/ComponentName.c
deleted file mode 100644
index 7ccfcc1..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/ComponentName.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ComponentName.c
-
-Abstract:
-
---*/
-
-#include "Snp.h"
-
-//
-// EFI Component Name Protocol
-//
-EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName = {
- SimpleNetworkComponentNameGetDriverName,
- SimpleNetworkComponentNameGetControllerName,
- "eng"
-};
-
-static EFI_UNICODE_STRING_TABLE mSimpleNetworkDriverNameTable[] = {
- {
- "eng",
- (CHAR16 *) L"Simple Network Protocol Driver"
- },
- {
- NULL,
- NULL
- }
-};
-
-EFI_STATUS
-EFIAPI
-SimpleNetworkComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- Language - A pointer to a three character ISO 639-2 language identifier.
- This is the language of the driver name that that the caller
- is requesting, and it must match one of the languages specified
- in SupportedLanguages. The number of languages supported by a
- driver is up to the driver writer.
- DriverName - A pointer to the Unicode string to return. This Unicode string
- is the name of the driver specified by This in the language
- specified by Language.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the Driver specified by This
- and the language specified by Language was returned
- in DriverName.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - DriverName is NULL.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return LookupUnicodeString (
- Language,
- gSimpleNetworkComponentName.SupportedLanguages,
- mSimpleNetworkDriverNameTable,
- DriverName
- );
-}
-
-EFI_STATUS
-EFIAPI
-SimpleNetworkComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- )
-/*++
-
- Routine Description:
- Retrieves a Unicode string that is the user readable name of the controller
- that is being managed by an EFI Driver.
-
- Arguments:
- This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
- ControllerHandle - The handle of a controller that the driver specified by
- This is managing. This handle specifies the controller
- whose name is to be returned.
- ChildHandle - The handle of the child controller to retrieve the name
- of. This is an optional parameter that may be NULL. It
- will be NULL for device drivers. It will also be NULL
- for a bus drivers that wish to retrieve the name of the
- bus controller. It will not be NULL for a bus driver
- that wishes to retrieve the name of a child controller.
- Language - A pointer to a three character ISO 639-2 language
- identifier. This is the language of the controller name
- that that the caller is requesting, and it must match one
- of the languages specified in SupportedLanguages. The
- number of languages supported by a driver is up to the
- driver writer.
- ControllerName - A pointer to the Unicode string to return. This Unicode
- string is the name of the controller specified by
- ControllerHandle and ChildHandle in the language specified
- by Language from the point of view of the driver specified
- by This.
-
- Returns:
- EFI_SUCCESS - The Unicode string for the user readable name in the
- language specified by Language for the driver
- specified by This was returned in DriverName.
- EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
- EFI_INVALID_PARAMETER - Language is NULL.
- EFI_INVALID_PARAMETER - ControllerName is NULL.
- EFI_UNSUPPORTED - The driver specified by This is not currently managing
- the controller specified by ControllerHandle and
- ChildHandle.
- EFI_UNSUPPORTED - The driver specified by This does not support the
- language specified by Language.
-
---*/
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/SNP.msa b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/SNP.msa
deleted file mode 100644
index c3ec204..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/SNP.msa
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>SNP</ModuleName>
- <ModuleType>UEFI_DRIVER</ModuleType>
- <GuidValue>A2f436EA-A127-4EF8-957C-8048606FF670</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for SNP module.</Abstract>
- <Description>This module attachs the SNP interface to UNDI layer that it finds on the given handle!</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>SNP</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverModelLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>callback.c</Filename>
- <Filename>get_status.c</Filename>
- <Filename>initialize.c</Filename>
- <Filename>mcast_ip_to_mac.c</Filename>
- <Filename>nvdata.c</Filename>
- <Filename>receive.c</Filename>
- <Filename>receive_filters.c</Filename>
- <Filename>reset.c</Filename>
- <Filename>shutdown.c</Filename>
- <Filename>snp.c</Filename>
- <Filename>Snp.h</Filename>
- <Filename>start.c</Filename>
- <Filename>station_address.c</Filename>
- <Filename>statistics.c</Filename>
- <Filename>stop.c</Filename>
- <Filename>transmit.c</Filename>
- <Filename>WaitForPacket.c</Filename>
- <Filename>ComponentName.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="BY_START">
- <ProtocolCName>gEfiSimpleNetworkProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiNetworkInterfaceIdentifierProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="TO_START">
- <ProtocolCName>gEfiNetworkInterfaceIdentifierProtocolGuid_31</ProtocolCName>
- <HelpText>This module first look for 3.1 undi, if it is not there then look for 3.0 undi.</HelpText>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <DriverBinding>mSimpleNetworkDriverBinding</DriverBinding>
- <ComponentName>gSimpleNetworkComponentName</ComponentName>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/Snp.h b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/Snp.h
deleted file mode 100644
index 038c2e6..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/Snp.h
+++ /dev/null
@@ -1,449 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- snp.h
-
-Abstract:
-
-Revision history:
- 2000-Feb-03 M(f)J Genesis.
---*/
-#ifndef _SNP_H
-#define _SNP_H
-
-
-#include "IndustryStandard/pci22.h"
-
-#define FOUR_GIGABYTES (UINT64) 0x100000000ULL
-
-#define SNP_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('s', 'n', 'd', 's')
-#define MAX_MAP_LENGTH 100
-
-#define PCI_BAR_IO_MASK 0x00000003
-#define PCI_BAR_IO_MODE 0x00000001
-
-#define PCI_BAR_MEM_MASK 0x0000000F
-#define PCI_BAR_MEM_MODE 0x00000000
-#define PCI_BAR_MEM_64BIT 0x00000004
-
-typedef struct {
- UINT32 Signature;
- EFI_LOCK lock;
-
- EFI_SIMPLE_NETWORK_PROTOCOL snp;
- EFI_SIMPLE_NETWORK_MODE mode;
-
- EFI_HANDLE device_handle;
- EFI_DEVICE_PATH_PROTOCOL *device_path;
-
- //
- // Local instance data needed by SNP driver
- //
- // Pointer to S/W UNDI API entry point
- // This will be NULL for H/W UNDI
- //
- EFI_STATUS (*issue_undi32_command) (UINT64 cdb);
-
- BOOLEAN is_swundi;
-
- //
- // undi interface number, if one undi manages more nics
- //
- PXE_IFNUM if_num;
-
- //
- // Allocated tx/rx buffer that was passed to UNDI Initialize.
- //
- UINT32 tx_rx_bufsize;
- VOID *tx_rx_buffer;
- //
- // mappable buffers for receive and fill header for undi3.0
- // these will be used if the user buffers are above 4GB limit (instead of
- // mapping the user buffers)
- //
- UINT8 *receive_buf;
- VOID *ReceiveBufUnmap;
- UINT8 *fill_hdr_buf;
- VOID *FillHdrBufUnmap;
-
- EFI_PCI_IO_PROTOCOL *IoFncs;
- UINT8 IoBarIndex;
- UINT8 MemoryBarIndex;
- BOOLEAN IsOldUndi; // true for EFI1.0 UNDI (3.0) drivers
- //
- // Buffers for command descriptor block, command parameter block
- // and data block.
- //
- PXE_CDB cdb;
- VOID *cpb;
- VOID *CpbUnmap;
- VOID *db;
-
- //
- // UNDI structure, we need to remember the init info for a long time!
- //
- PXE_DB_GET_INIT_INFO init_info;
-
- VOID *SnpDriverUnmap;
- //
- // when ever we map an address, we must remember it's address and the un-map
- // cookie so that we can unmap later
- //
- struct s_map_list {
- EFI_PHYSICAL_ADDRESS virt;
- VOID *map_cookie;
- } map_list[MAX_MAP_LENGTH];
-}
-SNP_DRIVER;
-
-#define EFI_SIMPLE_NETWORK_DEV_FROM_THIS(a) CR (a, SNP_DRIVER, snp, SNP_DRIVER_SIGNATURE)
-
-//
-// Global Variables
-//
-extern EFI_COMPONENT_NAME_PROTOCOL gSimpleNetworkComponentName;
-extern EFI_DRIVER_BINDING_PROTOCOL gSimpleNetworkDriverBinding;
-
-extern EFI_PCI_IO_PROTOCOL *mPciIoFncs;
-
-//
-// EFI Component Name Functions
-//
-EFI_STATUS
-EFIAPI
-SimpleNetworkComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
- );
-
-EFI_STATUS
-EFIAPI
-SimpleNetworkComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
- );
-
-//
-// Virtual to physical mapping for all UNDI 3.0s.
-//
-extern struct s_v2p {
- struct s_v2p *next;
- VOID *vaddr;
- UINTN bsize;
- EFI_PHYSICAL_ADDRESS paddr;
- VOID *unmap;
-}
-*_v2p;
-
-EFI_STATUS
-add_v2p (
- struct s_v2p **v2p,
- EFI_PCI_IO_PROTOCOL_OPERATION type,
- VOID *vaddr,
- UINTN bsize
- )
-;
-
-EFI_STATUS
-find_v2p (
- struct s_v2p **v2p,
- VOID *vaddr
- )
-;
-
-EFI_STATUS
-del_v2p (
- VOID *vaddr
- )
-;
-
-extern
-VOID
-snp_undi32_callback_block_30 (
- IN UINT32 Enable
- )
-;
-
-extern
-VOID
-snp_undi32_callback_delay_30 (
- IN UINT64 MicroSeconds
- )
-;
-
-extern
-VOID
-snp_undi32_callback_memio_30 (
- IN UINT8 ReadOrWrite,
- IN UINT8 NumBytes,
- IN UINT64 MemOrPortAddress,
- IN OUT UINT64 BufferPtr
- )
-;
-
-extern
-VOID
-snp_undi32_callback_v2p_30 (
- IN UINT64 CpuAddr,
- IN OUT UINT64 DeviceAddrPtr
- )
-;
-
-extern
-VOID
-snp_undi32_callback_block (
- IN UINT64 UniqueId,
- IN UINT32 Enable
- )
-;
-
-extern
-VOID
-snp_undi32_callback_delay (
- IN UINT64 UniqueId,
- IN UINT64 MicroSeconds
- )
-;
-
-extern
-VOID
-snp_undi32_callback_memio (
- IN UINT64 UniqueId,
- IN UINT8 ReadOrWrite,
- IN UINT8 NumBytes,
- IN UINT64 MemOrPortAddr,
- IN OUT UINT64 BufferPtr
- )
-;
-
-extern
-VOID
-snp_undi32_callback_map (
- IN UINT64 UniqueId,
- IN UINT64 CpuAddr,
- IN UINT32 NumBytes,
- IN UINT32 Direction,
- IN OUT UINT64 DeviceAddrPtr
- )
-;
-
-extern
-VOID
-snp_undi32_callback_unmap (
- IN UINT64 UniqueId,
- IN UINT64 CpuAddr,
- IN UINT32 NumBytes,
- IN UINT32 Direction,
- IN UINT64 DeviceAddr // not a pointer to device address
- )
-;
-
-extern
-VOID
-snp_undi32_callback_sync (
- IN UINT64 UniqueId,
- IN UINT64 CpuAddr,
- IN UINT32 NumBytes,
- IN UINT32 Direction,
- IN UINT64 DeviceAddr // not a pointer to device address
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_start (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_stop (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_initialize (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN UINTN extra_rx_buffer_size OPTIONAL,
- IN UINTN extra_tx_buffer_size OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_reset (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN BOOLEAN ExtendedVerification
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_shutdown (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_receive_filters (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN UINT32 enable,
- IN UINT32 disable,
- IN BOOLEAN reset_mcast_filter,
- IN UINTN mcast_filter_count OPTIONAL,
- IN EFI_MAC_ADDRESS * mcast_filter OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_station_address (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN BOOLEAN reset,
- IN EFI_MAC_ADDRESS *new OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_statistics (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN BOOLEAN reset,
- IN OUT UINTN *statistics_size OPTIONAL,
- IN OUT EFI_NETWORK_STATISTICS * statistics_table OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_mcast_ip_to_mac (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN BOOLEAN IPv6,
- IN EFI_IP_ADDRESS *IP,
- OUT EFI_MAC_ADDRESS *MAC
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_nvdata (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN BOOLEAN read_write,
- IN UINTN offset,
- IN UINTN buffer_size,
- IN OUT VOID *buffer
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_get_status (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- OUT UINT32 *interrupt_status OPTIONAL,
- OUT VOID **tx_buffer OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_transmit (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN UINTN header_size,
- IN UINTN buffer_size,
- IN VOID *buffer,
- IN EFI_MAC_ADDRESS * src_addr OPTIONAL,
- IN EFI_MAC_ADDRESS * dest_addr OPTIONAL,
- IN UINT16 *protocol OPTIONAL
- )
-;
-
-extern
-EFI_STATUS
-EFIAPI
-snp_undi32_receive (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- OUT UINTN *header_size OPTIONAL,
- IN OUT UINTN *buffer_size,
- OUT VOID *buffer,
- OUT EFI_MAC_ADDRESS * src_addr OPTIONAL,
- OUT EFI_MAC_ADDRESS * dest_addr OPTIONAL,
- OUT UINT16 *protocol OPTIONAL
- )
-;
-
-VOID
-EFIAPI
-SnpWaitForPacketNotify (
- IN EFI_EVENT Event,
- IN VOID *SnpPtr
- );
-
-EFI_STATUS
-pxe_start (
- SNP_DRIVER *snp
- );
-
-EFI_STATUS
-pxe_stop (
- SNP_DRIVER *snp
- );
-
-EFI_STATUS
-pxe_init (
- SNP_DRIVER *snp,
- UINT16 OpFlags
- );
-
-EFI_STATUS
-pxe_shutdown (
- SNP_DRIVER *snp
- );
-
-EFI_STATUS
-pxe_get_stn_addr (
- SNP_DRIVER *snp
- );
-
-typedef
-EFI_STATUS
-(*issue_undi32_command) (
- UINT64 cdb
- );
-
-typedef
-VOID
-(*ptr) (
- VOID
- );
-
-#define SNP_MEM_PAGES(x) (((x) - 1) / 4096 + 1)
-
-#endif /* _SNP_H */
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/WaitForPacket.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/WaitForPacket.c
deleted file mode 100644
index 51a3bb8..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/WaitForPacket.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- WaitForPacket.c
-
-Abstract:
- Event handler to check for available packet.
-
---*/
-
-
-#include "Snp.h"
-
-VOID
-EFIAPI
-SnpWaitForPacketNotify (
- EFI_EVENT Event,
- VOID *SnpPtr
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- PXE_DB_GET_STATUS PxeDbGetStatus;
-
- //
- // Do nothing if either parameter is a NULL pointer.
- //
- if (Event == NULL || SnpPtr == NULL) {
- return ;
- }
- //
- // Do nothing if the SNP interface is not initialized.
- //
- switch (((SNP_DRIVER *) SnpPtr)->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- case EfiSimpleNetworkStarted:
- default:
- return ;
- }
- //
- // Fill in CDB for UNDI GetStatus().
- //
- ((SNP_DRIVER *) SnpPtr)->cdb.OpCode = PXE_OPCODE_GET_STATUS;
- ((SNP_DRIVER *) SnpPtr)->cdb.OpFlags = 0;
- ((SNP_DRIVER *) SnpPtr)->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- ((SNP_DRIVER *) SnpPtr)->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- ((SNP_DRIVER *) SnpPtr)->cdb.DBsize = sizeof (UINT32) * 2;
- ((SNP_DRIVER *) SnpPtr)->cdb.DBaddr = (UINT64) (UINTN) (((SNP_DRIVER *) SnpPtr)->db);
- ((SNP_DRIVER *) SnpPtr)->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- ((SNP_DRIVER *) SnpPtr)->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- ((SNP_DRIVER *) SnpPtr)->cdb.IFnum = ((SNP_DRIVER *) SnpPtr)->if_num;
- ((SNP_DRIVER *) SnpPtr)->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Clear contents of DB buffer.
- //
- ZeroMem (((SNP_DRIVER *) SnpPtr)->db, sizeof (UINT32) * 2);
-
- //
- // Issue UNDI command and check result.
- //
- (*((SNP_DRIVER *) SnpPtr)->issue_undi32_command) ((UINT64) (UINTN) &((SNP_DRIVER *) SnpPtr)->cdb);
-
- if (((SNP_DRIVER *) SnpPtr)->cdb.StatCode != EFI_SUCCESS) {
- return ;
- }
- //
- // We might have a packet. Check the receive length and signal
- // the event if the length is not zero.
- //
- CopyMem (
- &PxeDbGetStatus,
- ((SNP_DRIVER *) SnpPtr)->db,
- sizeof (UINT32) * 2
- );
-
- if (PxeDbGetStatus.RxFrameLen != 0) {
- gBS->SignalEvent (Event);
- }
-}
-
-/* eof - WaitForPacket.c */
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/callback.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/callback.c
deleted file mode 100644
index 6f6ac81..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/callback.c
+++ /dev/null
@@ -1,610 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- callback.c
-
-Abstract:
- This file contains two sets of callback routines for undi3.0 and undi3.1.
- the callback routines for Undi3.1 have an extra parameter UniqueId which
- stores the interface context for the NIC that snp is trying to talk..
-
---*/
-
-
-#include "Snp.h"
-
-//
-// Global variables
-// these 2 global variables are used only for 3.0 undi. we could not place
-// them in the snp structure because we will not know which snp structure
-// in the callback context!
-//
-STATIC BOOLEAN mInitializeLock = TRUE;
-STATIC EFI_LOCK mLock;
-
-//
-// End Global variables
-//
-
-VOID
-snp_undi32_callback_v2p_30 (
- IN UINT64 CpuAddr,
- IN OUT UINT64 DeviceAddrPtr
- )
-/*++
-
-Routine Description:
- This is a callback routine supplied to UNDI at undi_start time.
- UNDI call this routine with a virtual or CPU address that SNP provided
- to convert it to a physical or device address. Since EFI uses the identical
- mapping, this routine returns the physical address same as the virtual address
- for most of the addresses. an address above 4GB cannot generally be used as a
- device address, it needs to be mapped to a lower physical address. This routine
- does not call the map routine itself, but it assumes that the mapping was done
- at the time of providing the address to UNDI. This routine just looks up the
- address in a map table (which is the v2p structure chain)
-
-Arguments:
- CpuAddr - virtual address of a buffer
- DeviceAddrPtr - pointer to the physical address
-
-Returns:
- void - The DeviceAddrPtr will contain 0 in case of any error
-
---*/
-{
- struct s_v2p *v2p;
- //
- // Do nothing if virtual address is zero or physical pointer is NULL.
- // No need to map if the virtual address is within 4GB limit since
- // EFI uses identical mapping
- //
- if ((CpuAddr == 0) || (DeviceAddrPtr == 0)) {
- DEBUG ((EFI_D_ERROR, "\nv2p: Null virtual address or physical pointer.\n"));
- return ;
- }
-
- if (CpuAddr < FOUR_GIGABYTES) {
- *(UINT64 *) (UINTN) DeviceAddrPtr = CpuAddr;
- return ;
- }
- //
- // SNP creates a vaddr tp paddr mapping at the time of calling undi with any
- // big address, this callback routine just looks up in the v2p list and
- // returns the physical address for any given virtual address.
- //
- if (find_v2p (&v2p, (VOID *) (UINTN) CpuAddr) != EFI_SUCCESS) {
- *(UINT64 *) (UINTN) DeviceAddrPtr = CpuAddr;
- } else {
- *(UINT64 *) (UINTN) DeviceAddrPtr = v2p->paddr;
- }
-}
-
-VOID
-snp_undi32_callback_block_30 (
- IN UINT32 Enable
- )
-/*++
-
-Routine Description:
- This is a callback routine supplied to UNDI at undi_start time.
- UNDI call this routine when it wants to have exclusive access to a critical
- section of the code/data
-
-Arguments:
- Enable - non-zero indicates acquire
- zero indicates release
-
-Returns:
- void
---*/
-{
- //
- // tcpip was calling snp at tpl_notify and if we acquire a lock that was
- // created at a lower level (TPL_CALLBACK) it gives an assert!
- //
- if (mInitializeLock) {
- EfiInitializeLock (&mLock, TPL_NOTIFY);
- mInitializeLock = FALSE;
- }
-
- if (Enable != 0) {
- EfiAcquireLock (&mLock);
- } else {
- EfiReleaseLock (&mLock);
- }
-}
-
-VOID
-snp_undi32_callback_delay_30 (
- IN UINT64 MicroSeconds
- )
-/*++
-
-Routine Description:
- This is a callback routine supplied to UNDI at undi_start time.
- UNDI call this routine with the number of micro seconds when it wants to
- pause.
-
-Arguments:
- MicroSeconds - number of micro seconds to pause, ususlly multiple of 10
-
-Returns:
- void
---*/
-{
- if (MicroSeconds != 0) {
- gBS->Stall ((UINTN) MicroSeconds);
- }
-}
-
-VOID
-snp_undi32_callback_memio_30 (
- IN UINT8 ReadOrWrite,
- IN UINT8 NumBytes,
- IN UINT64 Address,
- IN OUT UINT64 BufferAddr
- )
-/*++
-
-Routine Description:
- This is a callback routine supplied to UNDI at undi_start time.
- This is the IO routine for UNDI. This is not currently being used by UNDI3.0
- because Undi3.0 uses io/mem offsets relative to the beginning of the device
- io/mem address and so it needs to use the PCI_IO_FUNCTION that abstracts the
- start of the device's io/mem addresses. Since SNP cannot retrive the context
- of the undi3.0 interface it cannot use the PCI_IO_FUNCTION that specific for
- that NIC and uses one global IO functions structure, this does not work.
- This however works fine for EFI1.0 Undis because they use absolute addresses
- for io/mem access.
-
-Arguments:
- ReadOrWrite - indicates read or write, IO or Memory
- NumBytes - number of bytes to read or write
- Address - IO or memory address to read from or write to
- BufferAddr - memory location to read into or that contains the bytes
- to write
-
-Returns:
-
---*/
-{
- EFI_PCI_IO_PROTOCOL_WIDTH Width;
-
- switch (NumBytes) {
- case 2:
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 1;
- break;
-
- case 4:
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 2;
- break;
-
- case 8:
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 3;
- break;
-
- default:
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 0;
- }
-
- switch (ReadOrWrite) {
- case PXE_IO_READ:
- mPciIoFncs->Io.Read (
- mPciIoFncs,
- Width,
- 1, // BAR 1, IO base address
- Address,
- 1, // count
- (VOID *) (UINTN) BufferAddr
- );
- break;
-
- case PXE_IO_WRITE:
- mPciIoFncs->Io.Write (
- mPciIoFncs,
- Width,
- 1, // BAR 1, IO base address
- Address,
- 1, // count
- (VOID *) (UINTN) BufferAddr
- );
- break;
-
- case PXE_MEM_READ:
- mPciIoFncs->Mem.Read (
- mPciIoFncs,
- Width,
- 0, // BAR 0, Memory base address
- Address,
- 1, // count
- (VOID *) (UINTN) BufferAddr
- );
- break;
-
- case PXE_MEM_WRITE:
- mPciIoFncs->Mem.Write (
- mPciIoFncs,
- Width,
- 0, // BAR 0, Memory base address
- Address,
- 1, // count
- (VOID *) (UINTN) BufferAddr
- );
- break;
- }
-
- return ;
-}
-//
-// New callbacks for 3.1:
-// there won't be a virtual2physical callback for UNDI 3.1 because undi3.1 uses
-// the MemMap call to map the required address by itself!
-//
-VOID
-snp_undi32_callback_block (
- IN UINT64 UniqueId,
- IN UINT32 Enable
- )
-/*++
-
-Routine Description:
- This is a callback routine supplied to UNDI3.1 at undi_start time.
- UNDI call this routine when it wants to have exclusive access to a critical
- section of the code/data
-
-Arguments:
- UniqueId - This was supplied to UNDI at Undi_Start, SNP uses this to store
- Undi interface context (Undi does not read or write this variable)
- Enable - non-zero indicates acquire
- zero indicates release
-
-Returns:
- void
-
---*/
-{
- SNP_DRIVER *snp;
-
- snp = (SNP_DRIVER *) (UINTN) UniqueId;
- //
- // tcpip was calling snp at tpl_notify and when we acquire a lock that was
- // created at a lower level (TPL_CALLBACK) it gives an assert!
- //
- if (Enable != 0) {
- EfiAcquireLock (&snp->lock);
- } else {
- EfiReleaseLock (&snp->lock);
- }
-}
-
-VOID
-snp_undi32_callback_delay (
- IN UINT64 UniqueId,
- IN UINT64 MicroSeconds
- )
-/*++
-
-Routine Description:
- This is a callback routine supplied to UNDI at undi_start time.
- UNDI call this routine with the number of micro seconds when it wants to
- pause.
-
-Arguments:
- MicroSeconds - number of micro seconds to pause, ususlly multiple of 10
-
-Returns:
- void
---*/
-{
- if (MicroSeconds != 0) {
- gBS->Stall ((UINTN) MicroSeconds);
- }
-}
-
-/*
- * IO routine for UNDI start CPB.
- */
-VOID
-snp_undi32_callback_memio (
- UINT64 UniqueId,
- UINT8 ReadOrWrite,
- UINT8 NumBytes,
- UINT64 Address,
- UINT64 BufferAddr
- )
-/*++
-
-Routine Description:
- This is a callback routine supplied to UNDI at undi_start time.
- This is the IO routine for UNDI3.1.
-
-Arguments:
- ReadOrWrite - indicates read or write, IO or Memory
- NumBytes - number of bytes to read or write
- Address - IO or memory address to read from or write to
- BufferAddr - memory location to read into or that contains the bytes
- to write
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
- EFI_PCI_IO_PROTOCOL_WIDTH Width;
-
- snp = (SNP_DRIVER *) (UINTN) UniqueId;
-
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 0;
- switch (NumBytes) {
- case 2:
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 1;
- break;
-
- case 4:
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 2;
- break;
-
- case 8:
- Width = (EFI_PCI_IO_PROTOCOL_WIDTH) 3;
- break;
- }
-
- switch (ReadOrWrite) {
- case PXE_IO_READ:
- snp->IoFncs->Io.Read (
- snp->IoFncs,
- Width,
- snp->IoBarIndex, // BAR 1 (for 32bit regs), IO base address
- Address,
- 1, // count
- (VOID *) (UINTN) BufferAddr
- );
- break;
-
- case PXE_IO_WRITE:
- snp->IoFncs->Io.Write (
- snp->IoFncs,
- Width,
- snp->IoBarIndex, // BAR 1 (for 32bit regs), IO base address
- Address,
- 1, // count
- (VOID *) (UINTN) BufferAddr
- );
- break;
-
- case PXE_MEM_READ:
- snp->IoFncs->Mem.Read (
- snp->IoFncs,
- Width,
- snp->MemoryBarIndex, // BAR 0, Memory base address
- Address,
- 1, // count
- (VOID *) (UINTN) BufferAddr
- );
- break;
-
- case PXE_MEM_WRITE:
- snp->IoFncs->Mem.Write (
- snp->IoFncs,
- Width,
- snp->MemoryBarIndex, // BAR 0, Memory base address
- Address,
- 1, // count
- (VOID *) (UINTN) BufferAddr
- );
- break;
- }
-
- return ;
-}
-
-VOID
-snp_undi32_callback_map (
- IN UINT64 UniqueId,
- IN UINT64 CpuAddr,
- IN UINT32 NumBytes,
- IN UINT32 Direction,
- IN OUT UINT64 DeviceAddrPtr
- )
-/*++
-
-Routine Description:
- This is a callback routine supplied to UNDI at undi_start time.
- UNDI call this routine when it has to map a CPU address to a device
- address.
-
-Arguments:
- UniqueId - This was supplied to UNDI at Undi_Start, SNP uses this to store
- Undi interface context (Undi does not read or write this variable)
- CpuAddr - Virtual address to be mapped!
- NumBytes - size of memory to be mapped
- Direction - direction of data flow for this memory's usage:
- cpu->device, device->cpu or both ways
- DeviceAddrPtr - pointer to return the mapped device address
-
-Returns:
- None
-
---*/
-{
- EFI_PHYSICAL_ADDRESS *DevAddrPtr;
- EFI_PCI_IO_PROTOCOL_OPERATION DirectionFlag;
- UINTN BuffSize;
- SNP_DRIVER *snp;
- UINTN Index;
- EFI_STATUS Status;
-
- BuffSize = (UINTN) NumBytes;
- snp = (SNP_DRIVER *) (UINTN) UniqueId;
- DevAddrPtr = (EFI_PHYSICAL_ADDRESS *) (UINTN) DeviceAddrPtr;
-
- if (CpuAddr == 0) {
- *DevAddrPtr = 0;
- return ;
- }
-
- switch (Direction) {
- case TO_AND_FROM_DEVICE:
- DirectionFlag = EfiPciIoOperationBusMasterCommonBuffer;
- break;
-
- case FROM_DEVICE:
- DirectionFlag = EfiPciIoOperationBusMasterWrite;
- break;
-
- case TO_DEVICE:
- DirectionFlag = EfiPciIoOperationBusMasterRead;
- break;
-
- default:
- *DevAddrPtr = 0;
- //
- // any non zero indicates error!
- //
- return ;
- }
- //
- // find an unused map_list entry
- //
- for (Index = 0; Index < MAX_MAP_LENGTH; Index++) {
- if (snp->map_list[Index].virt == 0) {
- break;
- }
- }
-
- if (Index >= MAX_MAP_LENGTH) {
- DEBUG ((EFI_D_INFO, "SNP maplist is FULL\n"));
- *DevAddrPtr = 0;
- return ;
- }
-
- snp->map_list[Index].virt = (EFI_PHYSICAL_ADDRESS) CpuAddr;
-
- Status = snp->IoFncs->Map (
- snp->IoFncs,
- DirectionFlag,
- (VOID *) (UINTN) CpuAddr,
- &BuffSize,
- DevAddrPtr,
- &(snp->map_list[Index].map_cookie)
- );
- if (Status != EFI_SUCCESS) {
- *DevAddrPtr = 0;
- snp->map_list[Index].virt = 0;
- }
-
- return ;
-}
-
-VOID
-snp_undi32_callback_unmap (
- IN UINT64 UniqueId,
- IN UINT64 CpuAddr,
- IN UINT32 NumBytes,
- IN UINT32 Direction,
- IN UINT64 DeviceAddr
- )
-/*++
-
-Routine Description:
- This is a callback routine supplied to UNDI at undi_start time.
- UNDI call this routine when it wants to unmap an address that was previously
- mapped using map callback
-
-Arguments:
- UniqueId - This was supplied to UNDI at Undi_Start, SNP uses this to store
- Undi interface context (Undi does not read or write this variable)
- CpuAddr - Virtual address that was mapped!
- NumBytes - size of memory mapped
- Direction- direction of data flow for this memory's usage:
- cpu->device, device->cpu or both ways
- DeviceAddr - the mapped device address
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
- UINT16 Index;
-
- snp = (SNP_DRIVER *) (UINTN) UniqueId;
-
- for (Index = 0; Index < MAX_MAP_LENGTH; Index++) {
- if (snp->map_list[Index].virt == CpuAddr) {
- break;
- }
- }
-
- if (Index >= MAX_MAP_LENGTH)
- {
- DEBUG ((EFI_D_ERROR, "SNP could not find a mapping, failed to unmap.\n"));
- return ;
- }
-
- snp->IoFncs->Unmap (snp->IoFncs, snp->map_list[Index].map_cookie);
- snp->map_list[Index].virt = 0;
- snp->map_list[Index].map_cookie = NULL;
- return ;
-}
-
-VOID
-snp_undi32_callback_sync (
- UINT64 UniqueId,
- UINT64 CpuAddr,
- UINT32 NumBytes,
- UINT32 Direction,
- UINT64 DeviceAddr
- )
-/*++
-
-Routine Description:
- This is a callback routine supplied to UNDI at undi_start time.
- UNDI call this routine when it wants synchronize the virtual buffer contents
- with the mapped buffer contents. The virtual and mapped buffers need not
- correspond to the same physical memory (especially if the virtual address is
- > 4GB). Depending on the direction for which the buffer is mapped, undi will
- need to synchronize their contents whenever it writes to/reads from the buffer
- using either the cpu address or the device address.
-
- EFI does not provide a sync call, since virt=physical, we sould just do
- the synchronization ourself here!
-
-Arguments:
- UniqueId - This was supplied to UNDI at Undi_Start, SNP uses this to store
- Undi interface context (Undi does not read or write this variable)
- CpuAddr - Virtual address that was mapped!
- NumBytes - size of memory mapped
- Direction- direction of data flow for this memory's usage:
- cpu->device, device->cpu or both ways
- DeviceAddr - the mapped device address
-
-Returns:
-
---*/
-{
- if ((CpuAddr == 0) || (DeviceAddr == 0) || (NumBytes == 0)) {
- return ;
-
- }
-
- switch (Direction) {
- case FROM_DEVICE:
- CopyMem ((UINT8 *) (UINTN) CpuAddr, (UINT8 *) (UINTN) DeviceAddr, NumBytes);
- break;
-
- case TO_DEVICE:
- CopyMem ((UINT8 *) (UINTN) DeviceAddr, (UINT8 *) (UINTN) CpuAddr, NumBytes);
- break;
- }
-
- return ;
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/get_status.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/get_status.c
deleted file mode 100644
index c301b92..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/get_status.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- get_status.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-03 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-STATIC
-EFI_STATUS
-pxe_getstatus (
- SNP_DRIVER *snp,
- UINT32 *InterruptStatusPtr,
- VOID **TransmitBufferListPtr
- )
-/*++
-
-Routine Description:
- this routine calls undi to get the status of the interrupts, get the list of
- transmit buffers that completed transmitting!
-
-Arguments:
- snp - pointer to snp driver structure
- InterruptStatusPtr - a non null pointer gets the interrupt status
- TransmitBufferListPtrs - a non null ointer gets the list of pointers of previously
- transmitted buffers whose transmission was completed
- asynchrnously.
-
-Returns:
-
---*/
-{
- PXE_DB_GET_STATUS *db;
- UINT16 InterruptFlags;
- UINT64 TempData;
-
- db = snp->db;
- snp->cdb.OpCode = PXE_OPCODE_GET_STATUS;
-
- snp->cdb.OpFlags = 0;
-
- if (TransmitBufferListPtr != NULL) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS;
- }
-
- if (InterruptStatusPtr != NULL) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_GET_INTERRUPT_STATUS;
- }
-
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
-
- //
- // size DB for return of one buffer
- //
- snp->cdb.DBsize = (UINT16) (((UINT16) (sizeof (PXE_DB_GET_STATUS)) - (UINT16) (sizeof db->TxBuffer)) + (UINT16) (sizeof db->TxBuffer[0]));
-
- snp->cdb.DBaddr = (UINT64) (UINTN) db;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.get_status() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != EFI_SUCCESS) {
- DEBUG (
- (EFI_D_NET,
- "\nsnp->undi.get_status() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatFlags)
- );
-
- return EFI_DEVICE_ERROR;
- }
- //
- // report the values back..
- //
- if (InterruptStatusPtr != NULL) {
- InterruptFlags = (UINT16) (snp->cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_INTERRUPT_MASK);
-
- *InterruptStatusPtr = 0;
-
- if (InterruptFlags & PXE_STATFLAGS_GET_STATUS_RECEIVE) {
- *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT;
- }
-
- if (InterruptFlags & PXE_STATFLAGS_GET_STATUS_TRANSMIT) {
- *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;
- }
-
- if (InterruptFlags & PXE_STATFLAGS_GET_STATUS_COMMAND) {
- *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT;
- }
-
- if (InterruptFlags & PXE_STATFLAGS_GET_STATUS_SOFTWARE) {
- *InterruptStatusPtr |= EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT;
- }
-
- }
-
- if (TransmitBufferListPtr != NULL) {
- *TransmitBufferListPtr =
- (
- (snp->cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_NO_TXBUFS_WRITTEN) ||
- (snp->cdb.StatFlags & PXE_STATFLAGS_GET_STATUS_TXBUF_QUEUE_EMPTY)
- ) ? 0 : (VOID *) (UINTN) db->TxBuffer[0];
-
- TempData = (UINT64) (UINTN) (*TransmitBufferListPtr);
- if (snp->IsOldUndi && (TempData >= FOUR_GIGABYTES)) {
- del_v2p ((VOID *) (UINTN) (db->TxBuffer[0]));
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_get_status (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- OUT UINT32 *InterruptStatusPtr OPTIONAL,
- OUT VOID **TransmitBufferListPtr OPTIONAL
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for getting the status
- This routine basically retrieves snp structure, checks the SNP state and
- calls the pxe_getstatus routine to actually get the undi status
-
-Arguments:
- this - context pointer
- InterruptStatusPtr - a non null pointer gets the interrupt status
- TransmitBufferListPtrs - a non null ointer gets the list of pointers of previously
- transmitted buffers whose transmission was completed
- asynchrnously.
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
-
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (snp->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkStarted:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
-
- if (InterruptStatusPtr == NULL && TransmitBufferListPtr == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- return pxe_getstatus (snp, InterruptStatusPtr, TransmitBufferListPtr);
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/initialize.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/initialize.c
deleted file mode 100644
index 9e0ecca..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/initialize.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- initialize.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-09 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-EFI_STATUS
-pxe_init (
- SNP_DRIVER *snp,
- UINT16 CableDetectFlag
- )
-/*++
-
-Routine Description:
- this routine calls undi to initialize the interface.
-
-Arguments:
- snp - pointer to snp driver structure
- CableDetectFlag - Do/don't detect the cable (depending on what undi supports)
-
-Returns:
-
---*/
-{
- PXE_CPB_INITIALIZE *cpb;
- VOID *addr;
- EFI_STATUS Status;
-
- cpb = snp->cpb;
- if (snp->tx_rx_bufsize != 0) {
- Status = snp->IoFncs->AllocateBuffer (
- snp->IoFncs,
- AllocateAnyPages,
- EfiBootServicesData,
- SNP_MEM_PAGES (snp->tx_rx_bufsize),
- &addr,
- 0
- );
-
- if (Status != EFI_SUCCESS) {
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->pxe_init() AllocateBuffer %xh (%r)\n",
- Status,
- Status)
- );
-
- return Status;
- }
-
- ASSERT (addr);
-
- snp->tx_rx_buffer = addr;
- }
-
- cpb->MemoryAddr = (UINT64) (UINTN) snp->tx_rx_buffer;
-
- cpb->MemoryLength = snp->tx_rx_bufsize;
-
- //
- // let UNDI decide/detect these values
- //
- cpb->LinkSpeed = 0;
- cpb->TxBufCnt = 0;
- cpb->TxBufSize = 0;
- cpb->RxBufCnt = 0;
- cpb->RxBufSize = 0;
-
- cpb->DuplexMode = PXE_DUPLEX_DEFAULT;
-
- cpb->LoopBackMode = LOOPBACK_NORMAL;
-
- snp->cdb.OpCode = PXE_OPCODE_INITIALIZE;
- snp->cdb.OpFlags = CableDetectFlag;
-
- snp->cdb.CPBsize = sizeof (PXE_CPB_INITIALIZE);
- snp->cdb.DBsize = sizeof (PXE_DB_INITIALIZE);
-
- snp->cdb.CPBaddr = (UINT64) (UINTN) snp->cpb;
- snp->cdb.DBaddr = (UINT64) (UINTN) snp->db;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- DEBUG ((EFI_D_NET, "\nsnp->undi.initialize() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode == PXE_STATCODE_SUCCESS) {
- snp->mode.State = EfiSimpleNetworkInitialized;
-
- Status = EFI_SUCCESS;
- } else {
- DEBUG (
- (EFI_D_WARN,
- "\nsnp->undi.initialize() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- if (snp->tx_rx_buffer != NULL) {
- snp->IoFncs->FreeBuffer (
- snp->IoFncs,
- SNP_MEM_PAGES (snp->tx_rx_bufsize),
- (VOID *) snp->tx_rx_buffer
- );
- }
-
- snp->tx_rx_buffer = NULL;
-
- Status = EFI_DEVICE_ERROR;
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_initialize (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN UINTN extra_rx_buffer_size OPTIONAL,
- IN UINTN extra_tx_buffer_size OPTIONAL
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for initializing the interface
- This routine basically retrieves snp structure, checks the SNP state and
- calls the pxe_initialize routine to actually do the undi initialization
-
-Arguments:
- this - context pointer
- extra_rx_buffer_size - optional parameter, indicates extra space for rx_buffers
- extra_tx_buffer_size - optional parameter, indicates extra space for tx_buffers
-
-Returns:
-
---*/
-{
- EFI_STATUS EfiStatus;
- SNP_DRIVER *snp;
-
- //
- //
- //
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- //
- //
- switch (snp->mode.State) {
- case EfiSimpleNetworkStarted:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkInitialized:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
- //
- //
- //
- EfiStatus = gBS->CreateEvent (
- EVT_NOTIFY_WAIT,
- TPL_NOTIFY,
- &SnpWaitForPacketNotify,
- snp,
- &snp->snp.WaitForPacket
- );
-
- if (EFI_ERROR (EfiStatus)) {
- snp->snp.WaitForPacket = NULL;
- return EFI_DEVICE_ERROR;
- }
- //
- //
- //
- snp->mode.MCastFilterCount = 0;
- snp->mode.ReceiveFilterSetting = 0;
- ZeroMem (snp->mode.MCastFilter, sizeof snp->mode.MCastFilter);
- CopyMem (
- &snp->mode.CurrentAddress,
- &snp->mode.PermanentAddress,
- sizeof (EFI_MAC_ADDRESS)
- );
-
- //
- // Compute tx/rx buffer sizes based on UNDI init info and parameters.
- //
- snp->tx_rx_bufsize = (UINT32) (snp->init_info.MemoryRequired + extra_rx_buffer_size + extra_tx_buffer_size);
-
- if (snp->mode.MediaPresentSupported) {
- if (pxe_init (snp, PXE_OPFLAGS_INITIALIZE_DETECT_CABLE) == EFI_SUCCESS) {
- snp->mode.MediaPresent = TRUE;
- return EFI_SUCCESS;
- }
- }
-
- snp->mode.MediaPresent = FALSE;
-
- EfiStatus = pxe_init (snp, PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE);
-
- if (EFI_ERROR (EfiStatus)) {
- gBS->CloseEvent (snp->snp.WaitForPacket);
- }
-
- return EfiStatus;
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/mcast_ip_to_mac.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/mcast_ip_to_mac.c
deleted file mode 100644
index e768b85..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/mcast_ip_to_mac.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- mcast_ip_to_mac.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-17 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-STATIC
-EFI_STATUS
-pxe_ip2mac (
- IN SNP_DRIVER *snp,
- IN BOOLEAN IPv6,
- IN EFI_IP_ADDRESS *IP,
- IN OUT EFI_MAC_ADDRESS *MAC
- )
-/*++
-
-Routine Description:
- this routine calls undi to convert an multicast IP address to a MAC address
-
-Arguments:
- snp - pointer to snp driver structure
- IPv6 - flag to indicate if this is an ipv6 address
- IP - multicast IP address
- MAC - pointer to hold the return MAC address
-
-Returns:
-
---*/
-{
- PXE_CPB_MCAST_IP_TO_MAC *cpb;
- PXE_DB_MCAST_IP_TO_MAC *db;
-
- cpb = snp->cpb;
- db = snp->db;
- snp->cdb.OpCode = PXE_OPCODE_MCAST_IP_TO_MAC;
- snp->cdb.OpFlags = (UINT16) (IPv6 ? PXE_OPFLAGS_MCAST_IPV6_TO_MAC : PXE_OPFLAGS_MCAST_IPV4_TO_MAC);
- snp->cdb.CPBsize = sizeof (PXE_CPB_MCAST_IP_TO_MAC);
- snp->cdb.DBsize = sizeof (PXE_DB_MCAST_IP_TO_MAC);
-
- snp->cdb.CPBaddr = (UINT64) (UINTN) cpb;
- snp->cdb.DBaddr = (UINT64) (UINTN) db;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- CopyMem (&cpb->IP, IP, sizeof (PXE_IP_ADDR));
-
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.mcast_ip_to_mac() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- switch (snp->cdb.StatCode) {
- case PXE_STATCODE_SUCCESS:
- break;
-
- case PXE_STATCODE_INVALID_CPB:
- return EFI_INVALID_PARAMETER;
-
- case PXE_STATCODE_UNSUPPORTED:
- DEBUG (
- (EFI_D_NET,
- "\nsnp->undi.mcast_ip_to_mac() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
- return EFI_UNSUPPORTED;
-
- default:
- //
- // UNDI command failed. Return EFI_DEVICE_ERROR
- // to caller.
- //
- DEBUG (
- (EFI_D_NET,
- "\nsnp->undi.mcast_ip_to_mac() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_DEVICE_ERROR;
- }
-
- CopyMem (MAC, &db->MAC, sizeof (PXE_MAC_ADDR));
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_mcast_ip_to_mac (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN BOOLEAN IPv6,
- IN EFI_IP_ADDRESS *IP,
- OUT EFI_MAC_ADDRESS *MAC
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for converting a multicast IP address to
- a MAC address.
- This routine basically retrieves snp structure, checks the SNP state and
- calls the pxe_ip2mac routine to actually do the conversion
-
-Arguments:
- this - context pointer
- IPv6 - flag to indicate if this is an ipv6 address
- IP - multicast IP address
- MAC - pointer to hold the return MAC address
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
-
- //
- // Get pointer to SNP driver instance for *this.
- //
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (snp->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkStarted:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
-
- if (IP == NULL || MAC == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- return pxe_ip2mac (snp, IPv6, IP, MAC);
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/nvdata.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/nvdata.c
deleted file mode 100644
index ada3069..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/nvdata.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- nvdata.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-03 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-STATIC
-EFI_STATUS
-pxe_nvdata_read (
- IN SNP_DRIVER *snp,
- IN UINTN RegOffset,
- IN UINTN NumBytes,
- IN OUT VOID *BufferPtr
- )
-/*++
-
-Routine Description:
- This routine calls Undi to read the desired number of eeprom bytes.
-
-Arguments:
- snp - pointer to the snp driver structure
- RegOffset - eeprom register value relative to the base address
- NumBytes - number of bytes to read
- BufferPtr - pointer where to read into
-
-Returns:
-
---*/
-{
- PXE_DB_NVDATA *db;
-
- db = snp->db;
- snp->cdb.OpCode = PXE_OPCODE_NVDATA;
-
- snp->cdb.OpFlags = PXE_OPFLAGS_NVDATA_READ;
-
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
-
- snp->cdb.DBsize = sizeof (PXE_DB_NVDATA);
- snp->cdb.DBaddr = (UINT64) (UINTN) db;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.nvdata () "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- switch (snp->cdb.StatCode) {
- case PXE_STATCODE_SUCCESS:
- break;
-
- case PXE_STATCODE_UNSUPPORTED:
- DEBUG (
- (EFI_D_NET,
- "\nsnp->undi.nvdata() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_UNSUPPORTED;
-
- default:
- DEBUG (
- (EFI_D_NET,
- "\nsnp->undi.nvdata() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_DEVICE_ERROR;
- }
-
- CopyMem (BufferPtr, db->Data.Byte + RegOffset, NumBytes);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_nvdata (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN BOOLEAN ReadOrWrite,
- IN UINTN RegOffset,
- IN UINTN NumBytes,
- IN OUT VOID *BufferPtr
- )
-/*++
-
-Routine Description:
- This is an interface call provided by SNP.
- It does the basic checking on the input parameters and retrieves snp structure
- and then calls the read_nvdata() call which does the actual reading
-
-Arguments:
- this - context pointer
- ReadOrWrite - true for reading and false for writing
- RegOffset - eeprom register relative to the base
- NumBytes - how many bytes to read
- BufferPtr - address of memory to read into
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
-
- //
- // Get pointer to SNP driver instance for *this.
- //
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Return error if the SNP is not initialized.
- //
- switch (snp->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkStarted:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
- //
- // Return error if non-volatile memory variables are not valid.
- //
- if (snp->mode.NvRamSize == 0 || snp->mode.NvRamAccessSize == 0) {
- return EFI_UNSUPPORTED;
- }
- //
- // Check for invalid parameter combinations.
- //
- if ((NumBytes == 0) ||
- (BufferPtr == NULL) ||
- (RegOffset >= snp->mode.NvRamSize) ||
- (RegOffset + NumBytes > snp->mode.NvRamSize) ||
- (NumBytes % snp->mode.NvRamAccessSize != 0) ||
- (RegOffset % snp->mode.NvRamAccessSize != 0)
- ) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // check the implementation flags of undi if we can write the nvdata!
- //
- if (!ReadOrWrite) {
- return EFI_UNSUPPORTED;
- } else {
- return pxe_nvdata_read (snp, RegOffset, NumBytes, BufferPtr);
- }
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive.c
deleted file mode 100644
index 7c9cf5e..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- receive.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-03 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-STATIC
-EFI_STATUS
-pxe_receive (
- SNP_DRIVER *snp,
- VOID *BufferPtr,
- UINTN *BuffSizePtr,
- UINTN *HeaderSizePtr,
- EFI_MAC_ADDRESS *SourceAddrPtr,
- EFI_MAC_ADDRESS *DestinationAddrPtr,
- UINT16 *ProtocolPtr
- )
-/*++
-
-Routine Description:
- this routine calls undi to receive a packet and fills in the data in the
- input pointers!
-
-Arguments:
- snp - pointer to snp driver structure
- BufferPtr - pointer to the memory for the received data
- BuffSizePtr - is a pointer to the length of the buffer on entry and contains
- the length of the received data on return
- HeaderSizePtr - pointer to the header portion of the data received.
- SourceAddrPtr - optional parameter, is a pointer to contain the source
- ethernet address on return
- DestinationAddrPtr - optional parameter, is a pointer to contain the destination
- ethernet address on return
- ProtocolPtr - optional parameter, is a pointer to contain the protocol type
- from the ethernet header on return
-
-
-Returns:
-
---*/
-{
- PXE_CPB_RECEIVE *cpb;
- PXE_DB_RECEIVE *db;
- UINTN buf_size;
- UINT64 TempData;
-
- cpb = snp->cpb;
- db = snp->db;
- buf_size = *BuffSizePtr;
- //
- // IMPORTANT NOTE:
- // In case of the older 3.0 UNDI, if the input buffer address is beyond 4GB,
- // DO NOT call the map function on the given buffer, instead use
- // a global buffer. The reason is that UNDI3.0 has some unnecessary check of
- // making sure that all the addresses (whether or not they will be given
- // to the NIC ) supplied to it are below 4GB. It may or may not use
- // the mapped address after all (like in case of CPB and DB)!
- // Instead of using the global buffer whose address is allocated within the
- // 2GB limit if I start mapping the given buffer we lose the data, here is
- // why!!!
- // if our address is > 4GB, the map call creates another buffer below 2GB and
- // copies data to/from the original buffer to the mapped buffer either at
- // map time or unmap time depending on the map direction.
- // UNDI will not complain since we already mapped the buffer to be
- // within the 2GB limit but will not use (I know undi) the mapped address
- // since it does not give the user buffers to the NIC's receive unit,
- // It just copies the received packet into the user buffer using the virtual
- // (CPU) address rather than the mapped (device or physical) address.
- // When the UNDI call returns, if we then unmap the buffer, we will lose
- // the contents because unmap copies the contents of the mapped buffer into
- // the original buffer (since the direction is FROM_DEVICE) !!!
- //
- // this is not a problem in Undi 3.1 because this undi uses it's map callback
- // routine to map a cpu address to device address and it does it only if
- // it is giving the address to the device and unmaps it before using the cpu
- // address!
- //
- TempData = (UINT64) (UINTN) BufferPtr;
- if (snp->IsOldUndi && (TempData >= FOUR_GIGABYTES)) {
- cpb->BufferAddr = (UINT64) (UINTN) snp->receive_buf;
- cpb->BufferLen = (UINT32) (snp->init_info.MediaHeaderLen + snp->init_info.FrameDataLen);
- } else {
- cpb->BufferAddr = (UINT64) (UINTN) BufferPtr;
- cpb->BufferLen = (UINT32) *BuffSizePtr;
- }
-
- cpb->reserved = 0;
-
- snp->cdb.OpCode = PXE_OPCODE_RECEIVE;
- snp->cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
-
- snp->cdb.CPBsize = sizeof (PXE_CPB_RECEIVE);
- snp->cdb.CPBaddr = (UINT64) (UINTN) cpb;
-
- snp->cdb.DBsize = sizeof (PXE_DB_RECEIVE);
- snp->cdb.DBaddr = (UINT64) (UINTN) db;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_INFO, "\nsnp->undi.receive () "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- switch (snp->cdb.StatCode) {
- case PXE_STATCODE_SUCCESS:
- break;
-
- case PXE_STATCODE_NO_DATA:
- DEBUG (
- (EFI_D_INFO,
- "\nsnp->undi.receive () %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_NOT_READY;
-
- default:
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.receive() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_DEVICE_ERROR;
- }
-
- *BuffSizePtr = db->FrameLen;
-
- if (HeaderSizePtr != NULL) {
- *HeaderSizePtr = db->MediaHeaderLen;
- }
-
- if (SourceAddrPtr != NULL) {
- CopyMem (SourceAddrPtr, &db->SrcAddr, snp->mode.HwAddressSize);
- }
-
- if (DestinationAddrPtr != NULL) {
- CopyMem (DestinationAddrPtr, &db->DestAddr, snp->mode.HwAddressSize);
- }
-
- if (ProtocolPtr != NULL) {
- *ProtocolPtr = (UINT16) PXE_SWAP_UINT16 (db->Protocol); /* we need to do the byte swapping */
- }
-
- TempData = (UINT64) (UINTN) BufferPtr;
- if (snp->IsOldUndi && (TempData >= FOUR_GIGABYTES)) {
- CopyMem (BufferPtr, snp->receive_buf, snp->init_info.MediaHeaderLen + snp->init_info.FrameDataLen);
- }
-
- return (*BuffSizePtr <= buf_size) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_receive (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- OUT UINTN *HeaderSizePtr OPTIONAL,
- IN OUT UINTN *BuffSizePtr,
- OUT VOID *BufferPtr,
- OUT EFI_MAC_ADDRESS * SourceAddrPtr OPTIONAL,
- OUT EFI_MAC_ADDRESS * DestinationAddrPtr OPTIONAL,
- OUT UINT16 *ProtocolPtr OPTIONAL
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for receiving network data.
- This routine basically retrieves snp structure, checks the SNP state and
- calls the pxe_receive routine to actually do the receive!
-
-Arguments:
- this - context pointer
- HeaderSizePtr - optional parameter and is a pointer to the header portion of
- the data received.
- BuffSizePtr - is a pointer to the length of the buffer on entry and contains
- the length of the received data on return
- BufferPtr - pointer to the memory for the received data
- SourceAddrPtr - optional parameter, is a pointer to contain the source
- ethernet address on return
- DestinationAddrPtr - optional parameter, is a pointer to contain the destination
- ethernet address on return
- ProtocolPtr - optional parameter, is a pointer to contain the protocol type
- from the ethernet header on return
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
-
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (snp->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkStarted:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
-
- if ((BuffSizePtr == NULL) || (BufferPtr == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!snp->mode.ReceiveFilterSetting) {
- return EFI_DEVICE_ERROR;
- }
-
- return pxe_receive (
- snp,
- BufferPtr,
- BuffSizePtr,
- HeaderSizePtr,
- SourceAddrPtr,
- DestinationAddrPtr,
- ProtocolPtr
- );
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive_filters.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive_filters.c
deleted file mode 100644
index 258c4a9..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/receive_filters.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- receive_filters.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-17 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-STATIC
-EFI_STATUS
-pxe_rcvfilter_enable (
- SNP_DRIVER *snp,
- UINT32 EnableFlags,
- UINTN MCastAddressCount,
- EFI_MAC_ADDRESS *MCastAddressList
- )
-/*++
-
-Routine Description:
- this routine calls undi to enable the receive filters.
-
-Arguments:
- snp - pointer to snp driver structure
- EnableFlags - bit mask for enabling the receive filters
- MCastAddressCount - multicast address count for a new multicast address list
- MCastAddressList - list of new multicast addresses
-
-Returns:
-
---*/
-{
- snp->cdb.OpCode = PXE_OPCODE_RECEIVE_FILTERS;
- snp->cdb.OpFlags = PXE_OPFLAGS_RECEIVE_FILTER_ENABLE;
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_UNICAST) != 0) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_UNICAST;
- }
-
- if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST) != 0) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST;
- }
-
- if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS) != 0) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS;
- }
-
- if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST) != 0) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST;
- }
-
- if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST;
- }
-
- if (MCastAddressCount != 0) {
- snp->cdb.CPBsize = (UINT16) (MCastAddressCount * sizeof (EFI_MAC_ADDRESS));
- snp->cdb.CPBaddr = (UINT64) (UINTN) snp->cpb;
- CopyMem (snp->cpb, MCastAddressList, snp->cdb.CPBsize);
- }
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.receive_filters() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != EFI_SUCCESS) {
- //
- // UNDI command failed. Return UNDI status to caller.
- //
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.receive_filters() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- switch (snp->cdb.StatCode) {
- case PXE_STATCODE_INVALID_CDB:
- case PXE_STATCODE_INVALID_CPB:
- case PXE_STATCODE_INVALID_PARAMETER:
- return EFI_INVALID_PARAMETER;
-
- case PXE_STATCODE_UNSUPPORTED:
- return EFI_UNSUPPORTED;
- }
-
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-pxe_rcvfilter_disable (
- SNP_DRIVER *snp,
- UINT32 DisableFlags,
- BOOLEAN ResetMCastList
- )
-/*++
-
-Routine Description:
- this routine calls undi to disable the receive filters.
-
-Arguments:
- snp - pointer to snp driver structure
- DisableFlags - bit mask for disabling the receive filters
- ResetMCastList - boolean flag to reset/delete the multicast filter list
-
-Returns:
-
---*/
-{
- snp->cdb.OpCode = PXE_OPCODE_RECEIVE_FILTERS;
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- snp->cdb.OpFlags = (UINT16) (DisableFlags ? PXE_OPFLAGS_RECEIVE_FILTER_DISABLE : PXE_OPFLAGS_NOT_USED);
-
- if (ResetMCastList) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST;
- }
-
- if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_UNICAST) != 0) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_UNICAST;
- }
-
- if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST) != 0) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST;
- }
-
- if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS) != 0) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS;
- }
-
- if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST) != 0) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST;
- }
-
- if ((DisableFlags & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0) {
- snp->cdb.OpFlags |= PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST;
- }
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.receive_filters() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != EFI_SUCCESS) {
- //
- // UNDI command failed. Return UNDI status to caller.
- //
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.receive_filters() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-pxe_rcvfilter_read (
- SNP_DRIVER *snp
- )
-/*++
-
-Routine Description:
- this routine calls undi to read the receive filters.
-
-Arguments:
- snp - pointer to snp driver structure
-
-Returns:
-
---*/
-{
- snp->cdb.OpCode = PXE_OPCODE_RECEIVE_FILTERS;
- snp->cdb.OpFlags = PXE_OPFLAGS_RECEIVE_FILTER_READ;
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.DBsize = (UINT16) (snp->mode.MaxMCastFilterCount * sizeof (EFI_MAC_ADDRESS));
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- if (snp->cdb.DBsize == 0) {
- snp->cdb.DBaddr = (UINT64) NULL;
- } else {
- snp->cdb.DBaddr = (UINT64) (UINTN) snp->db;
- ZeroMem (snp->db, snp->cdb.DBsize);
- }
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- DEBUG ((EFI_D_NET, "\nsnp->undi.receive_filters() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != EFI_SUCCESS) {
- //
- // UNDI command failed. Return UNDI status to caller.
- //
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.receive_filters() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_DEVICE_ERROR;
- }
- //
- // Convert UNDI32 StatFlags to EFI SNP filter flags.
- //
- snp->mode.ReceiveFilterSetting = 0;
-
- if ((snp->cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_UNICAST) != 0) {
- snp->mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_UNICAST;
- }
-
- if ((snp->cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_BROADCAST) != 0) {
- snp->mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST;
- }
-
- if ((snp->cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_PROMISCUOUS) != 0) {
- snp->mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS;
- }
-
- if ((snp->cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_ALL_MULTICAST) != 0) {
- snp->mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
- }
-
- if ((snp->cdb.StatFlags & PXE_STATFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST) != 0) {
- snp->mode.ReceiveFilterSetting |= EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST;
- }
-
- CopyMem (snp->mode.MCastFilter, snp->db, snp->cdb.DBsize);
-
- //
- // Count number of active entries in multicast filter list.
- //
- {
- EFI_MAC_ADDRESS ZeroMacAddr;
-
- SetMem (&ZeroMacAddr, sizeof ZeroMacAddr, 0);
-
- for (snp->mode.MCastFilterCount = 0;
- snp->mode.MCastFilterCount < snp->mode.MaxMCastFilterCount;
- snp->mode.MCastFilterCount++
- ) {
- if (CompareMem (
- &snp->mode.MCastFilter[snp->mode.MCastFilterCount],
- &ZeroMacAddr,
- sizeof ZeroMacAddr
- ) == 0) {
- break;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_receive_filters (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN UINT32 EnableFlags,
- IN UINT32 DisableFlags,
- IN BOOLEAN ResetMCastList,
- IN UINTN MCastAddressCount OPTIONAL,
- IN EFI_MAC_ADDRESS * MCastAddressList OPTIONAL
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for reading/enabling/disabling the
- receive filters.
- This routine basically retrieves snp structure, checks the SNP state and
- checks the parameter validity, calls one of the above routines to actually
- do the work
-
-Arguments:
- this - context pointer
- EnableFlags - bit mask for enabling the receive filters
- DisableFlags - bit mask for disabling the receive filters
- ResetMCastList - boolean flag to reset/delete the multicast filter list
- MCastAddressCount - multicast address count for a new multicast address list
- MCastAddressList - list of new multicast addresses
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
- EFI_STATUS Status;
-
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (snp->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkStarted:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
- //
- // check if we are asked to enable or disable something that the UNDI
- // does not even support!
- //
- if ((EnableFlags &~snp->mode.ReceiveFilterMask) != 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((DisableFlags &~snp->mode.ReceiveFilterMask) != 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (ResetMCastList) {
- DisableFlags |= EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST & snp->mode.ReceiveFilterMask;
- MCastAddressCount = 0;
- MCastAddressList = NULL;
- } else {
- if (MCastAddressCount != 0) {
- if (MCastAddressCount > snp->mode.MaxMCastFilterCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (MCastAddressList == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- }
- }
-
- if (EnableFlags == 0 && DisableFlags == 0 && !ResetMCastList && MCastAddressCount == 0) {
- return EFI_SUCCESS;
- }
-
- if ((EnableFlags & EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST) != 0 && MCastAddressCount == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- if ((EnableFlags != 0) || (MCastAddressCount != 0)) {
- Status = pxe_rcvfilter_enable (
- snp,
- EnableFlags,
- MCastAddressCount,
- MCastAddressList
- );
-
- if (Status != EFI_SUCCESS) {
- return Status;
- }
- }
-
- if ((DisableFlags != 0) || ResetMCastList) {
- Status = pxe_rcvfilter_disable (snp, DisableFlags, ResetMCastList);
-
- if (Status != EFI_SUCCESS) {
- return Status;
- }
- }
-
- return pxe_rcvfilter_read (snp);
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/reset.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/reset.c
deleted file mode 100644
index 757e8e0..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/reset.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- reset.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-09 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-STATIC
-EFI_STATUS
-pxe_reset (
- SNP_DRIVER *snp
- )
-/*++
-
-Routine Description:
- This routine calls undi to reset the nic.
-
-Arguments:
- snp - pointer to the snp driver structure
-
-Returns:
- EFI_SUCCESSFUL for a successful completion
- other for failed calls
-
---*/
-{
- snp->cdb.OpCode = PXE_OPCODE_RESET;
- snp->cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.reset() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
- DEBUG (
- (EFI_D_WARN,
- "\nsnp->undi32.reset() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- //
- // UNDI could not be reset. Return UNDI error.
- //
- return EFI_DEVICE_ERROR;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_reset (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
- IN BOOLEAN ExtendedVerification
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for resetting the NIC
- This routine basically retrieves snp structure, checks the SNP state and
- calls the pxe_reset routine to actually do the reset!
-
-Arguments:
- this - context pointer
- ExtendedVerification - not implemented
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
-
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (snp->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkStarted:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
-
- return pxe_reset (snp);
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/shutdown.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/shutdown.c
deleted file mode 100644
index 5d7a4b2..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/shutdown.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- shutdown.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-14 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-EFI_STATUS
-pxe_shutdown (
- IN SNP_DRIVER *snp
- )
-/*++
-
-Routine Description:
- this routine calls undi to shut down the interface.
-
-Arguments:
- snp - pointer to snp driver structure
-
-Returns:
-
---*/
-{
- snp->cdb.OpCode = PXE_OPCODE_SHUTDOWN;
- snp->cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.shutdown() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
- //
- // UNDI could not be shutdown. Return UNDI error.
- //
- DEBUG ((EFI_D_WARN, "\nsnp->undi.shutdown() %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode));
-
- return EFI_DEVICE_ERROR;
- }
- //
- // Free allocated memory.
- //
- if (snp->tx_rx_buffer != NULL) {
- snp->IoFncs->FreeBuffer (
- snp->IoFncs,
- SNP_MEM_PAGES (snp->tx_rx_bufsize),
- (VOID *) snp->tx_rx_buffer
- );
- }
-
- snp->tx_rx_buffer = NULL;
- snp->tx_rx_bufsize = 0;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_shutdown (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for shutting down the interface
- This routine basically retrieves snp structure, checks the SNP state and
- calls the pxe_shutdown routine to actually do the undi shutdown
-
-Arguments:
- this - context pointer
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
- EFI_STATUS status;
-
- //
- //
- //
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- //
- //
- switch (snp->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkStarted:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
- //
- //
- //
- status = pxe_shutdown (snp);
-
- snp->mode.State = EfiSimpleNetworkStarted;
- snp->mode.ReceiveFilterSetting = 0;
-
- snp->mode.MCastFilterCount = 0;
- snp->mode.ReceiveFilterSetting = 0;
- ZeroMem (snp->mode.MCastFilter, sizeof snp->mode.MCastFilter);
- CopyMem (
- &snp->mode.CurrentAddress,
- &snp->mode.PermanentAddress,
- sizeof (EFI_MAC_ADDRESS)
- );
-
- gBS->CloseEvent (snp->snp.WaitForPacket);
-
- return status;
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/snp.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/snp.c
deleted file mode 100644
index 4b8d6f8..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/snp.c
+++ /dev/null
@@ -1,1209 +0,0 @@
-/*++
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- snp.c
-
-Abstract:
-
---*/
-
-
-#include "Snp.h"
-
-//
-// Module global variables needed to support undi 3.0 interface
-//
-EFI_PCI_IO_PROTOCOL *mPciIoFncs;
-struct s_v2p *_v2p = NULL; // undi3.0 map_list head
-// End Global variables
-//
-
-STATIC
-EFI_STATUS
-issue_hwundi_command (
- UINT64 cdb
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- DEBUG ((EFI_D_ERROR, "\nissue_hwundi_command() - This should not be called!"));
-
- if (cdb == 0) {
- return EFI_INVALID_PARAMETER;
-
- }
- //
- // %%TBD - For now, nothing is done.
- //
- return EFI_UNSUPPORTED;
-}
-
-STATIC
-UINT8
-calc_8bit_cksum (
- VOID *ptr,
- UINTN len
- )
-/*++
-
-Routine Description:
- Compute 8-bit checksum of a buffer.
-
-Arguments:
- ptr - Pointer to buffer.
- len - Length of buffer in bytes.
-
-Returns:
- 8-bit checksum of all bytes in buffer.
- If ptr is NULL or len is zero, zero is returned.
-
---*/
-{
- UINT8 *bptr;
- UINT8 cksum;
-
- bptr = ptr;
- cksum = 0;
-
- if (ptr == NULL || len == 0) {
- return 0;
- }
-
- while (len--) {
- cksum = (UINT8) (cksum +*bptr++);
- }
-
- return cksum;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-SimpleNetworkDriverSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
- Routine Description:
- Test to see if this driver supports Controller. Any Controller
- that contains a Nii protocol can be supported.
-
- Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to test.
- RemainingDevicePath - Not used.
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- EFI_ALREADY_STARTED - This driver is already running on this device.
- other - This driver does not support this device.
-
---*/
-{
- EFI_STATUS Status;
- EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *NiiProtocol;
- PXE_UNDI *pxe;
- BOOLEAN IsUndi31;
-
- IsUndi31 = FALSE;
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- NULL,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
- (VOID **) &NiiProtocol,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED)
- {
- DEBUG ((EFI_D_INFO, "Support(): Already Started. on handle %x\n", Controller));
- return EFI_ALREADY_STARTED;
- }
-
- if (!EFI_ERROR (Status))
- {
- DEBUG ((EFI_D_INFO, "Support(): UNDI3.1 found on handle %x\n", Controller));
- IsUndi31 = TRUE;
- } else {
- //
- // try the older 3.0 driver
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid,
- (VOID **) &NiiProtocol,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- DEBUG ((EFI_D_INFO, "Support(): UNDI3.0 found on handle %x\n", Controller));
- }
- //
- // check the version, we don't want to connect to the undi16
- //
- if (NiiProtocol->Type != EfiNetworkInterfaceUndi) {
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
- //
- // Check to see if !PXE structure is valid. Paragraph alignment of !PXE structure is required.
- //
- if (NiiProtocol->ID & 0x0F) {
- DEBUG ((EFI_D_NET, "\n!PXE structure is not paragraph aligned.\n"));
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- pxe = (PXE_UNDI *) (UINTN) (NiiProtocol->ID);
-
- //
- // Verify !PXE revisions.
- //
- if (pxe->hw.Signature != PXE_ROMID_SIGNATURE) {
- DEBUG ((EFI_D_NET, "\n!PXE signature is not valid.\n"));
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (pxe->hw.Rev < PXE_ROMID_REV) {
- DEBUG ((EFI_D_NET, "\n!PXE.Rev is not supported.\n"));
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (pxe->hw.MajorVer < PXE_ROMID_MAJORVER) {
-
- DEBUG ((EFI_D_NET, "\n!PXE.MajorVer is not supported.\n"));
- Status = EFI_UNSUPPORTED;
- goto Done;
-
- } else if (pxe->hw.MajorVer == PXE_ROMID_MAJORVER && pxe->hw.MinorVer < PXE_ROMID_MINORVER) {
- DEBUG ((EFI_D_NET, "\n!PXE.MinorVer is not supported."));
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
- //
- // Do S/W UNDI specific checks.
- //
- if ((pxe->hw.Implementation & PXE_ROMID_IMP_HW_UNDI) == 0) {
- if (pxe->sw.EntryPoint < pxe->sw.Len) {
- DEBUG ((EFI_D_NET, "\n!PXE S/W entry point is not valid."));
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
-
- if (pxe->sw.BusCnt == 0) {
- DEBUG ((EFI_D_NET, "\n!PXE.BusCnt is zero."));
- Status = EFI_UNSUPPORTED;
- goto Done;
- }
- }
-
- Status = EFI_SUCCESS;
- DEBUG ((EFI_D_INFO, "Support(): supported on %x\n", Controller));
-
-Done:
- if (IsUndi31) {
- gBS->CloseProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
- This->DriverBindingHandle,
- Controller
- );
-
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-SimpleNetworkDriverStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
- )
-/*++
-
-Routine Description:
- called for any handle that we said "supported" in the above call!
-
-Arguments:
- This - Protocol instance pointer.
- Controller - Handle of device to start
- RemainingDevicePath - Not used.
-
- Returns:
- EFI_SUCCESS - This driver supports this device.
- other - This driver failed to start this device.
-
---*/
-{
- EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *Nii;
- EFI_DEVICE_PATH_PROTOCOL *NiiDevicePath;
- EFI_STATUS Status;
- PXE_UNDI *pxe;
- SNP_DRIVER *snp;
- VOID *addr;
- VOID *addrUnmap;
- EFI_PHYSICAL_ADDRESS paddr;
- EFI_HANDLE Handle;
- UINTN Size;
- BOOLEAN UndiNew;
- PXE_PCI_CONFIG_INFO ConfigInfo;
- PCI_TYPE00 *ConfigHeader;
- UINT32 *TempBar;
- UINT8 BarIndex;
- PXE_STATFLAGS InitStatFlags;
-
- DEBUG ((EFI_D_NET, "\nSnpNotifyNetworkInterfaceIdentifier() "));
-
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &NiiDevicePath,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->LocateDevicePath (
- &gEfiPciIoProtocolGuid,
- &NiiDevicePath,
- &Handle
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiPciIoProtocolGuid,
- (VOID **) &mPciIoFncs,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the NII interface. look for 3.1 undi first, if it is not there
- // then look for 3.0, validate the interface.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
- (VOID **) &Nii,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- return Status;
- }
-
- if (!EFI_ERROR (Status)) {
- //
- // probably not a 3.1 UNDI
- //
- UndiNew = TRUE;
- DEBUG ((EFI_D_INFO, "Start(): UNDI3.1 found\n"));
-
- } else {
- UndiNew = FALSE;
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid,
- (VOID **) &Nii,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
- }
-
- DEBUG ((EFI_D_INFO, "Start(): UNDI3.0 found\n"));
- }
-
- pxe = (PXE_UNDI *) (UINTN) (Nii->ID);
-
- if (calc_8bit_cksum (pxe, pxe->hw.Len) != 0) {
- DEBUG ((EFI_D_NET, "\n!PXE checksum is not correct.\n"));
- goto NiiError;
- }
-
- if ((pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED) != 0) {
- //
- // We can get any packets.
- //
- } else if ((pxe->hw.Implementation & PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED) != 0) {
- //
- // We need to be able to get broadcast packets for DHCP.
- // If we do not have promiscuous support, we must at least have
- // broadcast support or we cannot do DHCP!
- //
- } else {
- DEBUG ((EFI_D_NET, "\nUNDI does not have promiscuous or broadcast support."));
- goto NiiError;
- }
- //
- // OK, we like this UNDI, and we know snp is not already there on this handle
- // Allocate and initialize a new simple network protocol structure.
- //
- Status = mPciIoFncs->AllocateBuffer (
- mPciIoFncs,
- AllocateAnyPages,
- EfiBootServicesData,
- SNP_MEM_PAGES (sizeof (SNP_DRIVER)),
- &addr,
- 0
- );
-
- if (Status != EFI_SUCCESS) {
- DEBUG ((EFI_D_NET, "\nCould not allocate SNP_DRIVER structure.\n"));
- goto NiiError;
- }
-
- snp = (SNP_DRIVER *) (UINTN) addr;
-
- if (!UndiNew) {
- Size = SNP_MEM_PAGES (sizeof (SNP_DRIVER));
-
- Status = mPciIoFncs->Map (
- mPciIoFncs,
- EfiPciIoOperationBusMasterCommonBuffer,
- addr,
- &Size,
- &paddr,
- &addrUnmap
- );
-
- ASSERT (paddr);
-
- DEBUG ((EFI_D_NET, "\nSNP_DRIVER @ %Xh, sizeof(SNP_DRIVER) == %d", addr, sizeof (SNP_DRIVER)));
- snp = (SNP_DRIVER *) (UINTN) paddr;
- snp->SnpDriverUnmap = addrUnmap;
- }
-
- ZeroMem (snp, sizeof (SNP_DRIVER));
-
- snp->IoFncs = mPciIoFncs;
- snp->IsOldUndi = (BOOLEAN) (!UndiNew);
-
- snp->Signature = SNP_DRIVER_SIGNATURE;
-
- EfiInitializeLock (&snp->lock, TPL_NOTIFY);
-
- snp->snp.Revision = EFI_SIMPLE_NETWORK_PROTOCOL_REVISION;
- snp->snp.Start = snp_undi32_start;
- snp->snp.Stop = snp_undi32_stop;
- snp->snp.Initialize = snp_undi32_initialize;
- snp->snp.Reset = snp_undi32_reset;
- snp->snp.Shutdown = snp_undi32_shutdown;
- snp->snp.ReceiveFilters = snp_undi32_receive_filters;
- snp->snp.StationAddress = snp_undi32_station_address;
- snp->snp.Statistics = snp_undi32_statistics;
- snp->snp.MCastIpToMac = snp_undi32_mcast_ip_to_mac;
- snp->snp.NvData = snp_undi32_nvdata;
- snp->snp.GetStatus = snp_undi32_get_status;
- snp->snp.Transmit = snp_undi32_transmit;
- snp->snp.Receive = snp_undi32_receive;
- snp->snp.WaitForPacket = NULL;
-
- snp->snp.Mode = &snp->mode;
-
- snp->tx_rx_bufsize = 0;
- snp->tx_rx_buffer = NULL;
-
- snp->if_num = Nii->IfNum;
-
- if ((pxe->hw.Implementation & PXE_ROMID_IMP_HW_UNDI) != 0) {
- snp->is_swundi = FALSE;
- snp->issue_undi32_command = &issue_hwundi_command;
- } else {
- snp->is_swundi = TRUE;
-
- if ((pxe->sw.Implementation & PXE_ROMID_IMP_SW_VIRT_ADDR) != 0) {
- snp->issue_undi32_command = (issue_undi32_command) (UINTN) pxe->sw.EntryPoint;
- } else {
- snp->issue_undi32_command = (issue_undi32_command) (UINTN) ((UINT8) (UINTN) pxe + pxe->sw.EntryPoint);
- }
- }
- //
- // Allocate a global CPB and DB buffer for this UNDI interface.
- // we do this because:
- //
- // -UNDI 3.0 wants all the addresses passed to it (even the cpb and db) to be
- // within 2GB limit, create them here and map them so that when undi calls
- // v2p callback to check if the physical address is < 2gb, we will pass.
- //
- // -This is not a requirement for 3.1 or later UNDIs but the code looks
- // simpler if we use the same cpb, db variables for both old and new undi
- // interfaces from all the SNP interface calls (we don't map the buffers
- // for the newer undi interfaces though)
- // .
- // -it is OK to allocate one global set of CPB, DB pair for each UNDI
- // interface as EFI does not multi-task and so SNP will not be re-entered!
- //
- Status = mPciIoFncs->AllocateBuffer (
- mPciIoFncs,
- AllocateAnyPages,
- EfiBootServicesData,
- SNP_MEM_PAGES (4096),
- &addr,
- 0
- );
-
- if (Status != EFI_SUCCESS) {
- DEBUG ((EFI_D_NET, "\nCould not allocate CPB and DB structures.\n"));
- goto Error_DeleteSNP;
- }
-
- if (snp->IsOldUndi) {
- Size = SNP_MEM_PAGES (4096);
-
- Status = mPciIoFncs->Map (
- mPciIoFncs,
- EfiPciIoOperationBusMasterCommonBuffer,
- addr,
- &Size,
- &paddr,
- &snp->CpbUnmap
- );
-
- ASSERT (paddr);
-
- snp->cpb = (VOID *) (UINTN) paddr;
- snp->db = (VOID *) ((UINTN) paddr + 2048);
- } else {
- snp->cpb = (VOID *) (UINTN) addr;
- snp->db = (VOID *) ((UINTN) addr + 2048);
- }
- //
- // pxe_start call is going to give the callback functions to UNDI, these callback
- // functions use the BarIndex values from the snp structure, so these must be initialized
- // with default values before doing a pxe_start. The correct values can be obtained after
- // getting the config information from UNDI
- //
- snp->MemoryBarIndex = 0;
- snp->IoBarIndex = 1;
-
- //
- // we need the undi init information many times in this snp code, just get it
- // once here and store it in the snp driver structure. to get Init Info
- // from UNDI we have to start undi first.
- //
- Status = pxe_start (snp);
-
- if (Status != EFI_SUCCESS) {
- goto Error_DeleteCPBDB;
- }
-
- snp->cdb.OpCode = PXE_OPCODE_GET_INIT_INFO;
- snp->cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
-
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_DBADDR_NOT_USED;
-
- snp->cdb.DBsize = sizeof snp->init_info;
- snp->cdb.DBaddr = (UINT64) (UINTN) &snp->init_info;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
-
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- DEBUG ((EFI_D_NET, "\nsnp->undi.get_init_info() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- //
- // Save the INIT Stat Code...
- //
- InitStatFlags = snp->cdb.StatFlags;
-
- if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
- DEBUG ((EFI_D_NET, "\nsnp->undi.init_info() %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode));
- pxe_stop (snp);
- goto Error_DeleteCPBDB;
- }
-
- snp->cdb.OpCode = PXE_OPCODE_GET_CONFIG_INFO;
- snp->cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
-
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_DBADDR_NOT_USED;
-
- snp->cdb.DBsize = sizeof ConfigInfo;
- snp->cdb.DBaddr = (UINT64) (UINTN) &ConfigInfo;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
-
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- DEBUG ((EFI_D_NET, "\nsnp->undi.get_config_info() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
- DEBUG ((EFI_D_NET, "\nsnp->undi.config_info() %xh:%xh\n", snp->cdb.StatFlags, snp->cdb.StatCode));
- pxe_stop (snp);
- goto Error_DeleteCPBDB;
- }
- //
- // Find the correct BAR to do IO.
- //
- //
- // Enumerate through the PCI BARs for the device to determine which one is
- // the IO BAR. Save the index of the BAR into the adapter info structure.
- // for regular 32bit BARs, 0 is memory mapped, 1 is io mapped
- //
- ConfigHeader = (PCI_TYPE00 *) &ConfigInfo.Config.Byte[0];
- TempBar = (UINT32 *) &ConfigHeader->Device.Bar[0];
- for (BarIndex = 0; BarIndex <= 5; BarIndex++) {
- if ((*TempBar & PCI_BAR_MEM_MASK) == PCI_BAR_MEM_64BIT) {
- //
- // This is a 64-bit memory bar, skip this and the
- // next bar as well.
- //
- TempBar++;
- }
-
- if ((*TempBar & PCI_BAR_IO_MASK) == PCI_BAR_IO_MODE) {
- snp->IoBarIndex = BarIndex;
- break;
- }
-
- TempBar++;
- }
-
- //
- // We allocate 2 more global buffers for undi 3.0 interface. We use these
- // buffers to pass to undi when the user buffers are beyond 4GB.
- // UNDI 3.0 wants all the addresses passed to it to be
- // within 2GB limit, create them here and map them so that when undi calls
- // v2p callback to check if the physical address is < 2gb, we will pass.
- //
- // For 3.1 and later UNDIs, we do not do this because undi is
- // going to call the map() callback if and only if it wants to use the
- // device address for any address it receives.
- //
- if (snp->IsOldUndi) {
- //
- // buffer for receive
- //
- Size = SNP_MEM_PAGES (snp->init_info.MediaHeaderLen + snp->init_info.FrameDataLen);
- Status = mPciIoFncs->AllocateBuffer (
- mPciIoFncs,
- AllocateAnyPages,
- EfiBootServicesData,
- Size,
- &addr,
- 0
- );
-
- if (Status != EFI_SUCCESS) {
- DEBUG ((EFI_D_ERROR, "\nCould not allocate receive buffer.\n"));
- goto Error_DeleteCPBDB;
- }
-
- Status = mPciIoFncs->Map (
- mPciIoFncs,
- EfiPciIoOperationBusMasterCommonBuffer,
- addr,
- &Size,
- &paddr,
- &snp->ReceiveBufUnmap
- );
-
- ASSERT (paddr);
-
- snp->receive_buf = (UINT8 *) (UINTN) paddr;
-
- //
- // buffer for fill_header
- //
- Size = SNP_MEM_PAGES (snp->init_info.MediaHeaderLen);
- Status = mPciIoFncs->AllocateBuffer (
- mPciIoFncs,
- AllocateAnyPages,
- EfiBootServicesData,
- Size,
- &addr,
- 0
- );
-
- if (Status != EFI_SUCCESS) {
- DEBUG ((EFI_D_ERROR, "\nCould not allocate fill_header buffer.\n"));
- goto Error_DeleteRCVBuf;
- }
-
- Status = mPciIoFncs->Map (
- mPciIoFncs,
- EfiPciIoOperationBusMasterCommonBuffer,
- addr,
- &Size,
- &paddr,
- &snp->FillHdrBufUnmap
- );
-
- ASSERT (paddr);
- snp->fill_hdr_buf = (UINT8 *) (UINTN) paddr;
- }
- //
- // Initialize simple network protocol mode structure
- //
- snp->mode.State = EfiSimpleNetworkStopped;
- snp->mode.HwAddressSize = snp->init_info.HWaddrLen;
- snp->mode.MediaHeaderSize = snp->init_info.MediaHeaderLen;
- snp->mode.MaxPacketSize = snp->init_info.FrameDataLen;
- snp->mode.NvRamAccessSize = snp->init_info.NvWidth;
- snp->mode.NvRamSize = snp->init_info.NvCount * snp->mode.NvRamAccessSize;
- snp->mode.IfType = snp->init_info.IFtype;
- snp->mode.MaxMCastFilterCount = snp->init_info.MCastFilterCnt;
- snp->mode.MCastFilterCount = 0;
-
- switch (InitStatFlags & PXE_STATFLAGS_CABLE_DETECT_MASK) {
- case PXE_STATFLAGS_CABLE_DETECT_SUPPORTED:
- snp->mode.MediaPresentSupported = TRUE;
- break;
-
- case PXE_STATFLAGS_CABLE_DETECT_NOT_SUPPORTED:
- default:
- snp->mode.MediaPresentSupported = FALSE;
- }
-
- if ((pxe->hw.Implementation & PXE_ROMID_IMP_STATION_ADDR_SETTABLE) != 0) {
- snp->mode.MacAddressChangeable = TRUE;
- } else {
- snp->mode.MacAddressChangeable = FALSE;
- }
-
- if ((pxe->hw.Implementation & PXE_ROMID_IMP_MULTI_FRAME_SUPPORTED) != 0) {
- snp->mode.MultipleTxSupported = TRUE;
- } else {
- snp->mode.MultipleTxSupported = FALSE;
- }
-
- snp->mode.ReceiveFilterMask = EFI_SIMPLE_NETWORK_RECEIVE_UNICAST;
-
- if ((pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) != 0) {
- snp->mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
-
- }
-
- if ((pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_RX_SUPPORTED) != 0) {
- snp->mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS;
-
- }
-
- if ((pxe->hw.Implementation & PXE_ROMID_IMP_BROADCAST_RX_SUPPORTED) != 0) {
- snp->mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST;
-
- }
-
- if ((pxe->hw.Implementation & PXE_ROMID_IMP_FILTERED_MULTICAST_RX_SUPPORTED) != 0) {
- snp->mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST;
-
- }
-
- if (pxe->hw.Implementation & PXE_ROMID_IMP_PROMISCUOUS_MULTICAST_RX_SUPPORTED) {
- snp->mode.ReceiveFilterMask |= EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST;
-
- }
-
- snp->mode.ReceiveFilterSetting = 0;
-
- //
- // need to get the station address to save in the mode structure. we need to
- // initialize the UNDI first for this.
- //
- snp->tx_rx_bufsize = snp->init_info.MemoryRequired;
- Status = pxe_init (snp, PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE);
-
- if (Status) {
- pxe_stop (snp);
- goto Error_DeleteHdrBuf;
- }
-
- Status = pxe_get_stn_addr (snp);
-
- if (Status != EFI_SUCCESS) {
- DEBUG ((EFI_D_ERROR, "\nsnp->undi.get_station_addr() failed.\n"));
- pxe_shutdown (snp);
- pxe_stop (snp);
- goto Error_DeleteHdrBuf;
- }
-
- snp->mode.MediaPresent = FALSE;
-
- //
- // We should not leave UNDI started and initialized here. this DriverStart()
- // routine must only find and attach the SNP interface to UNDI layer that it
- // finds on the given handle!
- // The UNDI layer will be started when upper layers call snp->start.
- // How ever, this DriverStart() must fill up the snp mode structure which
- // contains the MAC address of the NIC. For this reason we started and
- // initialized UNDI here, now we are done, do a shutdown and stop of the
- // UNDI interface!
- //
- pxe_shutdown (snp);
- pxe_stop (snp);
-
- //
- // add SNP to the undi handle
- //
- Status = gBS->InstallProtocolInterface (
- &Controller,
- &gEfiSimpleNetworkProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &(snp->snp)
- );
-
- if (!EFI_ERROR (Status)) {
- return Status;
- }
-
-Error_DeleteHdrBuf:
- if (snp->IsOldUndi) {
- Status = mPciIoFncs->Unmap (
- mPciIoFncs,
- snp->FillHdrBufUnmap
- );
- Size = SNP_MEM_PAGES (snp->init_info.MediaHeaderLen);
- mPciIoFncs->FreeBuffer (
- mPciIoFncs,
- Size,
- snp->fill_hdr_buf
- );
- }
-
-Error_DeleteRCVBuf:
- if (snp->IsOldUndi) {
- Status = mPciIoFncs->Unmap (
- mPciIoFncs,
- snp->ReceiveBufUnmap
- );
- Size = SNP_MEM_PAGES (snp->init_info.MediaHeaderLen + snp->init_info.FrameDataLen);
- mPciIoFncs->FreeBuffer (
- mPciIoFncs,
- Size,
- snp->receive_buf
- );
-
- }
-
-Error_DeleteCPBDB:
- if (snp->IsOldUndi) {
- Status = mPciIoFncs->Unmap (
- mPciIoFncs,
- snp->CpbUnmap
- );
- }
-
- Status = mPciIoFncs->FreeBuffer (
- mPciIoFncs,
- SNP_MEM_PAGES (4096),
- snp->cpb
- );
-
-Error_DeleteSNP:
- if (snp->IsOldUndi) {
- Status = mPciIoFncs->Unmap (
- mPciIoFncs,
- snp->SnpDriverUnmap
- );
- }
-
- mPciIoFncs->FreeBuffer (
- mPciIoFncs,
- SNP_MEM_PAGES (sizeof (SNP_DRIVER)),
- snp
- );
-NiiError:
- if (!UndiNew) {
- gBS->CloseProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- gBS->CloseProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-SimpleNetworkDriverStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_NETWORK_PROTOCOL *SnpProtocol;
- SNP_DRIVER *Snp;
-
- //
- // Get our context back.
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiSimpleNetworkProtocolGuid,
- (VOID **) &SnpProtocol,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (SnpProtocol);
-
- Status = gBS->UninstallProtocolInterface (
- Controller,
- &gEfiSimpleNetworkProtocolGuid,
- &Snp->snp
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- if (!Snp->IsOldUndi) {
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid_31,
- This->DriverBindingHandle,
- Controller
- );
- } else {
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiNetworkInterfaceIdentifierProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
- }
-
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
- pxe_shutdown (Snp);
- pxe_stop (Snp);
-
- if (Snp->IsOldUndi) {
- Status = mPciIoFncs->Unmap (
- mPciIoFncs,
- Snp->FillHdrBufUnmap
- );
-
- mPciIoFncs->FreeBuffer (
- mPciIoFncs,
- SNP_MEM_PAGES (Snp->init_info.MediaHeaderLen),
- Snp->fill_hdr_buf
- );
- Status = mPciIoFncs->Unmap (
- mPciIoFncs,
- Snp->ReceiveBufUnmap
- );
-
- mPciIoFncs->FreeBuffer (
- mPciIoFncs,
- SNP_MEM_PAGES (Snp->init_info.MediaHeaderLen + Snp->init_info.FrameDataLen),
- Snp->receive_buf
- );
-
- Status = mPciIoFncs->Unmap (
- mPciIoFncs,
- Snp->CpbUnmap
- );
- Status = mPciIoFncs->Unmap (
- mPciIoFncs,
- Snp->SnpDriverUnmap
- );
- }
-
- mPciIoFncs->FreeBuffer (
- mPciIoFncs,
- SNP_MEM_PAGES (4096),
- Snp->cpb
- );
-
- mPciIoFncs->FreeBuffer (
- mPciIoFncs,
- SNP_MEM_PAGES (sizeof (SNP_DRIVER)),
- Snp
- );
-
- return Status;
-}
-
-//
-// Simple Network Protocol Driver Global Variables
-//
-EFI_DRIVER_BINDING_PROTOCOL mSimpleNetworkDriverBinding = {
- SimpleNetworkDriverSupported,
- SimpleNetworkDriverStart,
- SimpleNetworkDriverStop,
- 0xa,
- NULL,
- NULL
-};
-
-EFI_STATUS
-add_v2p (
- IN OUT struct s_v2p **v2p,
- EFI_PCI_IO_PROTOCOL_OPERATION type,
- VOID *vaddr,
- UINTN bsize
- )
-/*++
-
-Routine Description:
- This routine maps the given CPU address to a Device address. It creates a
- an entry in the map list with the virtual and physical addresses and the
- un map cookie.
-
-Arguments:
- v2p - pointer to return a map list node pointer.
- type - the direction in which the data flows from the given virtual address
- device->cpu or cpu->device or both ways.
- vaddr - virtual address (or CPU address) to be mapped
- bsize - size of the buffer to be mapped.
-
-Returns:
-
- EFI_SUCEESS - routine has completed the mapping
- other - error as indicated.
-
---*/
-{
- EFI_STATUS Status;
-
- if ((v2p == NULL) || (vaddr == NULL) || (bsize == 0)) {
- return EFI_INVALID_PARAMETER;
- }
-
- *v2p = AllocatePool (sizeof (struct s_v2p));
- if (*v2p != NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = mPciIoFncs->Map (
- mPciIoFncs,
- type,
- vaddr,
- &bsize,
- &(*v2p)->paddr,
- &(*v2p)->unmap
- );
- if (Status != EFI_SUCCESS) {
- FreePool (*v2p);
- return Status;
- }
- (*v2p)->vaddr = vaddr;
- (*v2p)->bsize = bsize;
- (*v2p)->next = _v2p;
- _v2p = *v2p;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-find_v2p (
- struct s_v2p **v2p,
- VOID *vaddr
- )
-/*++
-
-Routine Description:
- This routine searches the linked list of mapped address nodes (for undi3.0
- interface) to find the node that corresponds to the given virtual address and
- returns a pointer to that node.
-
-Arguments:
- v2p - pointer to return a map list node pointer.
- vaddr - virtual address (or CPU address) to be searched in the map list
-
-Returns:
-
- EFI_SUCEESS - if a match found!
- Other - match not found
-
---*/
-{
- struct s_v2p *v;
-
- if (v2p == NULL || vaddr == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- for (v = _v2p; v != NULL; v = v->next) {
- if (v->vaddr == vaddr) {
- *v2p = v;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-del_v2p (
- VOID *vaddr
- )
-/*++
-
-Routine Description:
- This routine unmaps the given virtual address and frees the memory allocated
- for the map list node corresponding to that address.
-
-Arguments:
- vaddr - virtual address (or CPU address) to be unmapped
-
-Returns:
- EFI_SUCEESS - if successfully unmapped
- Other - as indicated by the error
-
-
---*/
-{
- struct s_v2p *v;
- struct s_v2p *t;
- EFI_STATUS Status;
-
- if (vaddr == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (_v2p == NULL) {
- return EFI_NOT_FOUND;
- }
- //
- // Is our node at the head of the list??
- //
- if ((v = _v2p)->vaddr == vaddr) {
- _v2p = _v2p->next;
-
- Status = mPciIoFncs->Unmap (mPciIoFncs, v->unmap);
-
- FreePool (v);
-
- if (Status) {
- DEBUG ((EFI_D_ERROR, "Unmap failed with status = %x\n", Status));
- }
- return Status;
- }
-
- for (; v->next != NULL; v = t) {
- if ((t = v->next)->vaddr == vaddr) {
- v->next = t->next;
- Status = mPciIoFncs->Unmap (mPciIoFncs, t->unmap);
- FreePool (t);
-
- if (Status) {
- DEBUG ((EFI_D_ERROR, "Unmap failed with status = %x\n", Status));
- }
- return Status;
- }
- }
-
- return EFI_NOT_FOUND;
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/start.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/start.c
deleted file mode 100644
index b21d8cb..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/start.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- start.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-07 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-EFI_STATUS
-pxe_start (
- SNP_DRIVER *snp
- )
-/*++
-
-Routine Description:
- this routine calls undi to start the interface and changes the snp state!
-
-Arguments:
- snp - pointer to snp driver structure
-
-Returns:
-
---*/
-{
- PXE_CPB_START_30 *cpb;
- PXE_CPB_START_31 *cpb_31;
-
- cpb = snp->cpb;
- cpb_31 = snp->cpb;
- //
- // Initialize UNDI Start CDB for H/W UNDI
- //
- snp->cdb.OpCode = PXE_OPCODE_START;
- snp->cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Make changes to H/W UNDI Start CDB if this is
- // a S/W UNDI.
- //
- if (snp->is_swundi) {
- if (snp->IsOldUndi) {
- snp->cdb.CPBsize = sizeof (PXE_CPB_START_30);
- snp->cdb.CPBaddr = (UINT64) (UINTN) cpb;
-
- cpb->Delay = (UINT64) &snp_undi32_callback_delay_30;
- cpb->Block = (UINT64) &snp_undi32_callback_block_30;
-
- //
- // Virtual == Physical. This can be set to zero.
- //
- cpb->Virt2Phys = (UINT64) &snp_undi32_callback_v2p_30;
- cpb->Mem_IO = (UINT64) &snp_undi32_callback_memio_30;
- } else {
- snp->cdb.CPBsize = sizeof (PXE_CPB_START_31);
- snp->cdb.CPBaddr = (UINT64) (UINTN) cpb_31;
-
- cpb_31->Delay = (UINT64) &snp_undi32_callback_delay;
- cpb_31->Block = (UINT64) &snp_undi32_callback_block;
-
- //
- // Virtual == Physical. This can be set to zero.
- //
- cpb_31->Virt2Phys = (UINT64) 0;
- cpb_31->Mem_IO = (UINT64) &snp_undi32_callback_memio;
-
- cpb_31->Map_Mem = (UINT64) &snp_undi32_callback_map;
- cpb_31->UnMap_Mem = (UINT64) &snp_undi32_callback_unmap;
- cpb_31->Sync_Mem = (UINT64) &snp_undi32_callback_sync;
-
- cpb_31->Unique_ID = (UINT64) (UINTN) snp;
- }
- }
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.start() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
- //
- // UNDI could not be started. Return UNDI error.
- //
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.start() %xh:%xh\n",
- snp->cdb.StatCode,
- snp->cdb.StatFlags)
- );
-
- return EFI_DEVICE_ERROR;
- }
- //
- // Set simple network state to Started and return success.
- //
- snp->mode.State = EfiSimpleNetworkStarted;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_start (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *This
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for starting the interface
- This routine basically retrieves snp structure, checks the SNP state and
- calls the pxe_start routine to actually do start undi interface
-
-Arguments:
- This - context pointer
-
-Returns:
- EFI_INVALID_PARAMETER - "This" is Null
- - No SNP driver can be extracted from "This"
- EFI_ALREADY_STARTED - The state of SNP is EfiSimpleNetworkStarted
- or EfiSimpleNetworkInitialized
- EFI_DEVICE_ERROR - The state of SNP is other than EfiSimpleNetworkStarted,
- EfiSimpleNetworkInitialized, and EfiSimpleNetworkStopped
- EFI_SUCCESS - UNDI interface is succesfully started
- Other - Error occurs while calling pxe_start function.
-
---*/
-{
- SNP_DRIVER *Snp;
- EFI_STATUS Status;
- UINTN Index;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);
-
- if (Snp == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- switch (Snp->mode.State) {
- case EfiSimpleNetworkStopped:
- break;
-
- case EfiSimpleNetworkStarted:
- case EfiSimpleNetworkInitialized:
- return EFI_ALREADY_STARTED;
-
- default:
- return EFI_DEVICE_ERROR;
- }
-
- Status = pxe_start (Snp);
- if (Status != EFI_SUCCESS) {
- return Status;
- }
- //
- // clear the map_list in SNP structure
- //
- for (Index = 0; Index < MAX_MAP_LENGTH; Index++) {
- Snp->map_list[Index].virt = 0;
- Snp->map_list[Index].map_cookie = 0;
- }
-
- Snp->mode.MCastFilterCount = 0;
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/station_address.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/station_address.c
deleted file mode 100644
index a55a644..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/station_address.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- station_address.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-17 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-EFI_STATUS
-pxe_get_stn_addr (
- SNP_DRIVER *snp
- )
-/*++
-
-Routine Description:
- this routine calls undi to read the MAC address of the NIC and updates the
- mode structure with the address.
-
-Arguments:
- snp - pointer to snp driver structure
-
-Returns:
-
---*/
-{
- PXE_DB_STATION_ADDRESS *db;
-
- db = snp->db;
- snp->cdb.OpCode = PXE_OPCODE_STATION_ADDRESS;
- snp->cdb.OpFlags = PXE_OPFLAGS_STATION_ADDRESS_READ;
-
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
-
- snp->cdb.DBsize = sizeof (PXE_DB_STATION_ADDRESS);
- snp->cdb.DBaddr = (UINT64) (UINTN) db;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.station_addr() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.station_addr() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_DEVICE_ERROR;
- }
- //
- // Set new station address in SNP->Mode structure and return success.
- //
- CopyMem (
- &(snp->mode.CurrentAddress),
- &db->StationAddr,
- snp->mode.HwAddressSize
- );
-
- CopyMem (
- &snp->mode.BroadcastAddress,
- &db->BroadcastAddr,
- snp->mode.HwAddressSize
- );
-
- CopyMem (
- &snp->mode.PermanentAddress,
- &db->PermanentAddr,
- snp->mode.HwAddressSize
- );
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-pxe_set_stn_addr (
- SNP_DRIVER *snp,
- EFI_MAC_ADDRESS *NewMacAddr
- )
-/*++
-
-Routine Description:
- this routine calls undi to set a new MAC address for the NIC,
-
-Arguments:
- snp - pointer to snp driver structure
- NewMacAddr - pointer to a mac address to be set for the nic, if this is NULL
- then this routine resets the mac address to the NIC's original
- address.
-
-Returns:
-
---*/
-{
- PXE_CPB_STATION_ADDRESS *cpb;
- PXE_DB_STATION_ADDRESS *db;
-
- cpb = snp->cpb;
- db = snp->db;
- snp->cdb.OpCode = PXE_OPCODE_STATION_ADDRESS;
-
- if (NewMacAddr == NULL) {
- snp->cdb.OpFlags = PXE_OPFLAGS_STATION_ADDRESS_RESET;
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- } else {
- snp->cdb.OpFlags = PXE_OPFLAGS_STATION_ADDRESS_READ;
- //
- // even though the OPFLAGS are set to READ, supplying a new address
- // in the CPB will make undi change the mac address to the new one.
- //
- CopyMem (&cpb->StationAddr, NewMacAddr, snp->mode.HwAddressSize);
-
- snp->cdb.CPBsize = sizeof (PXE_CPB_STATION_ADDRESS);
- snp->cdb.CPBaddr = (UINT64) (UINTN) cpb;
- }
-
- snp->cdb.DBsize = sizeof (PXE_DB_STATION_ADDRESS);
- snp->cdb.DBaddr = (UINT64) (UINTN) db;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.station_addr() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.station_addr() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- //
- // UNDI command failed. Return UNDI status to caller.
- //
- return EFI_DEVICE_ERROR;
- }
- //
- // read the changed address and save it in SNP->Mode structure
- //
- pxe_get_stn_addr (snp);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_station_address (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN BOOLEAN ResetFlag,
- IN EFI_MAC_ADDRESS * NewMacAddr OPTIONAL
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for changing the NIC's mac address.
- This routine basically retrieves snp structure, checks the SNP state and
- calls the above routines to actually do the work
-
-Arguments:
- this - context pointer
- NewMacAddr - pointer to a mac address to be set for the nic, if this is NULL
- then this routine resets the mac address to the NIC's original
- address.
- ResetFlag - If true, the mac address will change to NIC's original address
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
- EFI_STATUS Status;
-
- //
- // Get pointer to SNP driver instance for *this.
- //
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Return error if the SNP is not initialized.
- //
- switch (snp->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkStarted:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
- //
- // Check for invalid parameter combinations.
- //
- if (!ResetFlag && NewMacAddr == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (ResetFlag) {
- Status = pxe_set_stn_addr (snp, NULL);
- } else {
- Status = pxe_set_stn_addr (snp, NewMacAddr);
-
- }
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/statistics.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/statistics.c
deleted file mode 100644
index 1c148a7..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/statistics.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- statistics.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-17 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-EFI_STATUS
-EFIAPI
-snp_undi32_statistics (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN BOOLEAN ResetFlag,
- IN OUT UINTN *StatTableSizePtr OPTIONAL,
- IN OUT EFI_NETWORK_STATISTICS * StatTablePtr OPTIONAL
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for getting the NIC's statistics.
- This routine basically retrieves snp structure, checks the SNP state and
- calls the pxe_ routine to actually do the
-
-Arguments:
- this - context pointer
- ResetFlag - true to reset the NIC's statistics counters to zero.
- StatTableSizePtr - pointer to the statistics table size
- StatTablePtr - pointer to the statistics table
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
- PXE_DB_STATISTICS *db;
- UINT64 *stp;
- UINT64 mask;
- UINTN size;
- UINTN n;
-
- //
- // Get pointer to SNP driver instance for *this.
- //
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Return error if the SNP is not initialized.
- //
- switch (snp->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkStarted:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
- //
- // if we are not resetting the counters, we have to have a valid stat table
- // with >0 size. if no reset, no table and no size, return success.
- //
- if (!ResetFlag && StatTableSizePtr == NULL) {
- return StatTablePtr ? EFI_INVALID_PARAMETER : EFI_SUCCESS;
- }
- //
- // Initialize UNDI Statistics CDB
- //
- snp->cdb.OpCode = PXE_OPCODE_STATISTICS;
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- if (ResetFlag) {
- snp->cdb.OpFlags = PXE_OPFLAGS_STATISTICS_RESET;
- snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;
- snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;
- db = snp->db;
- } else {
- snp->cdb.OpFlags = PXE_OPFLAGS_STATISTICS_READ;
- snp->cdb.DBsize = sizeof (PXE_DB_STATISTICS);
- snp->cdb.DBaddr = (UINT64) (UINTN) (db = snp->db);
- }
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.statistics() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- switch (snp->cdb.StatCode) {
- case PXE_STATCODE_SUCCESS:
- break;
-
- case PXE_STATCODE_UNSUPPORTED:
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.statistics() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_UNSUPPORTED;
-
- default:
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.statistics() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_DEVICE_ERROR;
- }
-
- if (ResetFlag) {
- return EFI_SUCCESS;
- }
-
- if (StatTablePtr == NULL) {
- *StatTableSizePtr = sizeof (EFI_NETWORK_STATISTICS);
- return EFI_BUFFER_TOO_SMALL;
- }
- //
- // Convert the UNDI statistics information to SNP statistics
- // information.
- //
- ZeroMem (StatTablePtr, *StatTableSizePtr);
- stp = (UINT64 *) StatTablePtr;
- size = 0;
-
- for (n = 0, mask = 1; n < 64; n++, mask = LShiftU64 (mask, 1), stp++) {
- //
- // There must be room for a full UINT64. Partial
- // numbers will not be stored.
- //
- if ((n + 1) * sizeof (UINT64) > *StatTableSizePtr) {
- break;
- }
-
- if (db->Supported & mask) {
- *stp = db->Data[n];
- size = n + 1;
- } else {
- SetMem (stp, sizeof (UINT64), 0xFF);
- }
- }
- //
- // Compute size up to last supported statistic.
- //
- while (++n < 64) {
- if (db->Supported & (mask = LShiftU64 (mask, 1))) {
- size = n;
- }
- }
-
- size *= sizeof (UINT64);
-
- if (*StatTableSizePtr >= size) {
- *StatTableSizePtr = size;
- return EFI_SUCCESS;
- } else {
- *StatTableSizePtr = size;
- return EFI_BUFFER_TOO_SMALL;
- }
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/stop.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/stop.c
deleted file mode 100644
index 6abd07e..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/stop.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
- stop.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-09 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-EFI_STATUS
-pxe_stop (
- SNP_DRIVER *snp
- )
-/*++
-
-Routine Description:
- this routine calls undi to stop the interface and changes the snp state
-
-Arguments:
- snp - pointer to snp driver structure
-
-Returns:
-
---*/
-{
- snp->cdb.OpCode = PXE_OPCODE_STOP;
- snp->cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
- snp->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
- snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;
- snp->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
- snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Issue UNDI command
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.stop() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->cdb.StatCode != PXE_STATCODE_SUCCESS) {
- DEBUG (
- (EFI_D_WARN,
- "\nsnp->undi.stop() %xh:%xh\n",
- snp->cdb.StatCode,
- snp->cdb.StatFlags)
- );
-
- return EFI_DEVICE_ERROR;
- }
- //
- // Set simple network state to Started and return success.
- //
- snp->mode.State = EfiSimpleNetworkStopped;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_stop (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this
- )
-/*++
-
-Routine Description:
- This is the SNP interface routine for stopping the interface.
- This routine basically retrieves snp structure, checks the SNP state and
- calls the pxe_stop routine to actually stop the undi interface
-
-Arguments:
- this - context pointer
-
-Returns:
-
---*/
-{
- SNP_DRIVER *snp;
-
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (snp->mode.State) {
- case EfiSimpleNetworkStarted:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkInitialized:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
-
- return pxe_stop (snp);
-}
diff --git a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/transmit.c b/EdkModulePkg/Universal/Network/Snp32_64/Dxe/transmit.c
deleted file mode 100644
index 3c722c9..0000000
--- a/EdkModulePkg/Universal/Network/Snp32_64/Dxe/transmit.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module name:
-
- transmit.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-03 M(f)J Genesis.
---*/
-
-
-#include "Snp.h"
-
-STATIC
-EFI_STATUS
-pxe_fillheader (
- SNP_DRIVER *snp,
- VOID *MacHeaderPtr,
- UINTN MacHeaderSize,
- VOID *BufferPtr,
- UINTN BufferLength,
- EFI_MAC_ADDRESS *DestinationAddrPtr,
- EFI_MAC_ADDRESS *SourceAddrPtr,
- UINT16 *ProtocolPtr
- )
-/*++
-
-Routine Description:
- This routine calls undi to create the meadia header for the given data buffer.
-
-Arguments:
- snp - pointer to SNP driver structure
- MacHeaderPtr - address where the media header will be filled in.
- MacHeaderSize - size of the memory at MacHeaderPtr
- BufferPtr - data buffer pointer
- BufferLength - Size of data in the BufferPtr
- DestinationAddrPtr - address of the destination mac address buffer
- SourceAddrPtr - address of the source mac address buffer
- ProtocolPtr - address of the protocol type
-
-Returns:
- EFI_SUCCESS - if successfully completed the undi call
- Other - error return from undi call.
-
---*/
-{
- PXE_CPB_FILL_HEADER_FRAGMENTED *cpb;
- EFI_STATUS Status;
- struct s_v2p *pkt_v2p;
- UINT64 TempData;
-
- cpb = snp->cpb;
- if (SourceAddrPtr) {
- CopyMem (
- (VOID *) cpb->SrcAddr,
- (VOID *) SourceAddrPtr,
- snp->mode.HwAddressSize
- );
- } else {
- CopyMem (
- (VOID *) cpb->SrcAddr,
- (VOID *) &(snp->mode.CurrentAddress),
- snp->mode.HwAddressSize
- );
- }
-
- CopyMem (
- (VOID *) cpb->DestAddr,
- (VOID *) DestinationAddrPtr,
- snp->mode.HwAddressSize
- );
-
- //
- // we need to do the byte swapping
- //
- cpb->Protocol = (UINT16) PXE_SWAP_UINT16 (*ProtocolPtr);
-
- cpb->PacketLen = (UINT32) (BufferLength);
- cpb->MediaHeaderLen = (UINT16) MacHeaderSize;
-
- cpb->FragCnt = 2;
- cpb->reserved = 0;
-
- cpb->FragDesc[0].FragAddr = (UINT64) (UINTN) MacHeaderPtr;
- cpb->FragDesc[0].FragLen = (UINT32) MacHeaderSize;
- cpb->FragDesc[1].FragAddr = (UINT64) (UINTN) BufferPtr;
- cpb->FragDesc[1].FragLen = (UINT32) BufferLength;
-
- cpb->FragDesc[0].reserved = cpb->FragDesc[1].reserved = 0;
-
- if (snp->IsOldUndi) {
- TempData = (UINT64) (UINTN) MacHeaderPtr;
- if (TempData >= FOUR_GIGABYTES) {
- cpb->FragDesc[0].FragAddr = (UINT64) (UINTN) snp->fill_hdr_buf;
- cpb->FragDesc[0].FragLen = (UINT32) snp->init_info.MediaHeaderLen;
- }
-
- TempData = (UINT64) (UINTN) (BufferPtr);
- if (TempData >= FOUR_GIGABYTES) {
- //
- // Let the device just read this buffer
- //
- Status = add_v2p (
- &pkt_v2p,
- EfiPciIoOperationBusMasterRead,
- BufferPtr,
- BufferLength
- );
- if (Status != EFI_SUCCESS) {
- return Status;
- }
- //
- // give the virtual address to UNDI and it will call back on Virt2Phys
- // to get the mapped address, if it needs it
- //
- cpb->FragDesc[1].FragLen = (UINT32) pkt_v2p->bsize;
- }
- }
-
- snp->cdb.OpCode = PXE_OPCODE_FILL_HEADER;
- snp->cdb.OpFlags = PXE_OPFLAGS_FILL_HEADER_FRAGMENTED;
-
- snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;
- snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;
-
- snp->cdb.CPBsize = sizeof (PXE_CPB_FILL_HEADER_FRAGMENTED);
- snp->cdb.CPBaddr = (UINT64) (UINTN) cpb;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.fill_header() "));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- if (snp->IsOldUndi) {
- TempData = (UINT64) (UINTN) (BufferPtr);
- if (TempData >= FOUR_GIGABYTES) {
- del_v2p (BufferPtr);
- }
- //
- // if we used the global buffer for header, copy the contents
- //
- TempData = (UINT64) (UINTN) MacHeaderPtr;
- if (TempData >= FOUR_GIGABYTES) {
- CopyMem (
- MacHeaderPtr,
- snp->fill_hdr_buf,
- snp->init_info.MediaHeaderLen
- );
- }
- }
-
- switch (snp->cdb.StatCode) {
- case PXE_STATCODE_SUCCESS:
- return EFI_SUCCESS;
-
- case PXE_STATCODE_INVALID_PARAMETER:
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.fill_header() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_INVALID_PARAMETER;
-
- default:
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.fill_header() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return EFI_DEVICE_ERROR;
- }
-}
-
-STATIC
-EFI_STATUS
-pxe_transmit (
- SNP_DRIVER *snp,
- VOID *BufferPtr,
- UINTN BufferLength
- )
-/*++
-
-Routine Description:
- This routine calls undi to transmit the given data buffer
-
-Arguments:
- snp - pointer to SNP driver structure
- BufferPtr - data buffer pointer
- BufferLength - Size of data in the BufferPtr
-
-Returns:
- EFI_SUCCESS - if successfully completed the undi call
- Other - error return from undi call.
-
---*/
-{
- PXE_CPB_TRANSMIT *cpb;
- EFI_STATUS Status;
- struct s_v2p *v2p;
- UINT64 TempData;
-
- cpb = snp->cpb;
- cpb->FrameAddr = (UINT64) (UINTN) BufferPtr;
- cpb->DataLen = (UINT32) BufferLength;
-
- TempData = (UINT64) (UINTN) BufferPtr;
- if (snp->IsOldUndi && (TempData >= FOUR_GIGABYTES)) {
- //
- // we need to create a mapping now and give it to the undi when it calls
- // the Virt2Phys on this address.
- // this is a transmit, just map it for the device to READ
- //
- Status = add_v2p (
- &v2p,
- EfiPciIoOperationBusMasterRead,
- BufferPtr,
- BufferLength
- );
- if (Status != EFI_SUCCESS) {
- return Status;
- }
-
- cpb->DataLen = (UINT32) v2p->bsize;
- }
-
- cpb->MediaheaderLen = 0;
- cpb->reserved = 0;
-
- snp->cdb.OpFlags = PXE_OPFLAGS_TRANSMIT_WHOLE;
-
- snp->cdb.CPBsize = sizeof (PXE_CPB_TRANSMIT);
- snp->cdb.CPBaddr = (UINT64) (UINTN) cpb;
-
- snp->cdb.OpCode = PXE_OPCODE_TRANSMIT;
- snp->cdb.DBsize = PXE_DBSIZE_NOT_USED;
- snp->cdb.DBaddr = PXE_DBADDR_NOT_USED;
-
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
-
- //
- // Issue UNDI command and check result.
- //
- DEBUG ((EFI_D_NET, "\nsnp->undi.transmit() "));
- DEBUG ((EFI_D_NET, "\nsnp->cdb.OpCode == %x", snp->cdb.OpCode));
- DEBUG ((EFI_D_NET, "\nsnp->cdb.CPBaddr == %X", snp->cdb.CPBaddr));
- DEBUG ((EFI_D_NET, "\nsnp->cdb.DBaddr == %X", snp->cdb.DBaddr));
- DEBUG ((EFI_D_NET, "\ncpb->FrameAddr == %X\n", cpb->FrameAddr));
-
- (*snp->issue_undi32_command) ((UINT64) (UINTN) &snp->cdb);
-
- DEBUG ((EFI_D_NET, "\nexit snp->undi.transmit() "));
- DEBUG ((EFI_D_NET, "\nsnp->cdb.StatCode == %r", snp->cdb.StatCode));
-
- //
- // we will unmap the buffers in get_status call, not here
- //
- switch (snp->cdb.StatCode) {
- case PXE_STATCODE_SUCCESS:
- return EFI_SUCCESS;
-
- case PXE_STATCODE_QUEUE_FULL:
- case PXE_STATCODE_BUSY:
- Status = EFI_NOT_READY;
- break;
-
- default:
- Status = EFI_DEVICE_ERROR;
- }
-
- DEBUG (
- (EFI_D_ERROR,
- "\nsnp->undi.transmit() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
- );
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-snp_undi32_transmit (
- IN EFI_SIMPLE_NETWORK_PROTOCOL * this,
- IN UINTN MacHeaderSize,
- IN UINTN BufferLength,
- IN VOID *BufferPtr,
- IN EFI_MAC_ADDRESS * SourceAddrPtr OPTIONAL,
- IN EFI_MAC_ADDRESS * DestinationAddrPtr OPTIONAL,
- IN UINT16 *ProtocolPtr OPTIONAL
- )
-/*++
-
-Routine Description:
- This is the snp interface routine for transmitting a packet. this routine
- basically retrieves the snp structure, checks the snp state and calls
- pxe_fill_header and pxe_transmit calls to complete the transmission.
-
-Arguments:
- this - pointer to SNP driver context
- MacHeaderSize - size of the memory at MacHeaderPtr
- BufferLength - Size of data in the BufferPtr
- BufferPtr - data buffer pointer
- SourceAddrPtr - address of the source mac address buffer
- DestinationAddrPtr - address of the destination mac address buffer
- ProtocolPtr - address of the protocol type
-
-Returns:
- EFI_SUCCESS - if successfully completed the undi call
- Other - error return from undi call.
-
---*/
-{
- SNP_DRIVER *snp;
- EFI_STATUS Status;
-
- if (this == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
-
- if (snp == NULL) {
- return EFI_DEVICE_ERROR;
- }
-
- switch (snp->mode.State) {
- case EfiSimpleNetworkInitialized:
- break;
-
- case EfiSimpleNetworkStopped:
- return EFI_NOT_STARTED;
-
- case EfiSimpleNetworkStarted:
- return EFI_DEVICE_ERROR;
-
- default:
- return EFI_DEVICE_ERROR;
- }
-
- if (BufferPtr == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (BufferLength < snp->mode.MediaHeaderSize) {
- return EFI_BUFFER_TOO_SMALL;
- }
-
- //
- // if the MacHeaderSize is non-zero, we need to fill up the header and for that
- // we need the destination address and the protocol
- //
- if (MacHeaderSize != 0) {
- if (MacHeaderSize != snp->mode.MediaHeaderSize || DestinationAddrPtr == 0 || ProtocolPtr == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = pxe_fillheader (
- snp,
- BufferPtr,
- MacHeaderSize,
- (UINT8 *) BufferPtr + MacHeaderSize,
- BufferLength - MacHeaderSize,
- DestinationAddrPtr,
- SourceAddrPtr,
- ProtocolPtr
- );
-
- if (Status != EFI_SUCCESS) {
- return Status;
- }
- }
-
- return pxe_transmit (snp, BufferPtr, BufferLength);
-}
diff --git a/EdkModulePkg/Universal/PCD/Dxe/Pcd.c b/EdkModulePkg/Universal/PCD/Dxe/Pcd.c
deleted file mode 100644
index 01a26bb..0000000
--- a/EdkModulePkg/Universal/PCD/Dxe/Pcd.c
+++ /dev/null
@@ -1,732 +0,0 @@
-/** @file
-PCD DXE driver
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name: Pcd.c
-
-**/
-
-#include "Service.h"
-
-EFI_LOCK mPcdDatabaseLock = EFI_INITIALIZE_LOCK_VARIABLE(TPL_CALLBACK);
-
-PCD_PROTOCOL mPcdInstance = {
- DxePcdSetSku,
-
- DxePcdGet8,
- DxePcdGet16,
- DxePcdGet32,
- DxePcdGet64,
- DxePcdGetPtr,
- DxePcdGetBool,
- DxePcdGetSize,
-
- DxePcdGet8Ex,
- DxePcdGet16Ex,
- DxePcdGet32Ex,
- DxePcdGet64Ex,
- DxePcdGetPtrEx,
- DxePcdGetBoolEx,
- DxePcdGetSizeEx,
-
- DxePcdSet8,
- DxePcdSet16,
- DxePcdSet32,
- DxePcdSet64,
- DxePcdSetPtr,
- DxePcdSetBool,
-
- DxePcdSet8Ex,
- DxePcdSet16Ex,
- DxePcdSet32Ex,
- DxePcdSet64Ex,
- DxePcdSetPtrEx,
- DxePcdSetBoolEx,
-
- DxeRegisterCallBackOnSet,
- DxeUnRegisterCallBackOnSet,
- DxePcdGetNextToken,
- DxePcdGetNextTokenSpace
-};
-
-
-//
-// Static global to reduce the code size
-//
-static EFI_HANDLE mNewHandle = NULL;
-
-EFI_STATUS
-EFIAPI
-PcdDxeInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Make sure the Pcd Protocol is not already installed in the system
- //
-
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gPcdProtocolGuid);
-
- BuildPcdDxeDataBase ();
-
- Status = gBS->InstallProtocolInterface (
- &mNewHandle,
- &gPcdProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mPcdInstance
- );
-
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-
-}
-
-
-VOID
-EFIAPI
-DxePcdSetSku (
- IN UINTN SkuId
- )
-{
- mPcdDatabase->PeiDb.Init.SystemSkuId = (SKU_ID) SkuId;
-
- return;
-}
-
-
-
-UINT8
-EFIAPI
-DxePcdGet8 (
- IN UINTN TokenNumber
- )
-{
- return *((UINT8 *) GetWorker (TokenNumber, sizeof (UINT8)));
-}
-
-
-
-UINT16
-EFIAPI
-DxePcdGet16 (
- IN UINTN TokenNumber
- )
-{
- return ReadUnaligned16 (GetWorker (TokenNumber, sizeof (UINT16)));
-}
-
-
-
-UINT32
-EFIAPI
-DxePcdGet32 (
- IN UINTN TokenNumber
- )
-{
- return ReadUnaligned32 (GetWorker (TokenNumber, sizeof (UINT32)));
-}
-
-
-
-UINT64
-EFIAPI
-DxePcdGet64 (
- IN UINTN TokenNumber
- )
-{
- return ReadUnaligned64(GetWorker (TokenNumber, sizeof (UINT64)));
-}
-
-
-
-VOID *
-EFIAPI
-DxePcdGetPtr (
- IN UINTN TokenNumber
- )
-{
- return GetWorker (TokenNumber, 0);
-}
-
-
-
-BOOLEAN
-EFIAPI
-DxePcdGetBool (
- IN UINTN TokenNumber
- )
-{
- return *((BOOLEAN *) GetWorker (TokenNumber, sizeof (BOOLEAN)));
-}
-
-
-
-UINTN
-EFIAPI
-DxePcdGetSize (
- IN UINTN TokenNumber
- )
-{
- UINTN Size;
- UINT32 *LocalTokenNumberTable;
- BOOLEAN IsPeiDb;
- UINTN MaxSize;
- UINTN TmpTokenNumber;
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
-
- //
- // Backup the TokenNumber passed in as GetPtrTypeSize need the original TokenNumber
- //
- TmpTokenNumber = TokenNumber;
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- IsPeiDb = (BOOLEAN) (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
-
- TokenNumber = IsPeiDb ? TokenNumber :
- (TokenNumber - PEI_LOCAL_TOKEN_NUMBER);
-
- LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable
- : mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
-
- Size = (LocalTokenNumberTable[TokenNumber] & PCD_DATUM_TYPE_ALL_SET) >> PCD_DATUM_TYPE_SHIFT;
-
- if (Size == 0) {
- //
- // For pointer type, we need to scan the SIZE_TABLE to get the current size.
- //
- return GetPtrTypeSize (TmpTokenNumber, &MaxSize);
- } else {
- return Size;
- }
-
-}
-
-
-
-UINT8
-EFIAPI
-DxePcdGet8Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return *((UINT8 *) ExGetWorker (Guid, ExTokenNumber, sizeof(UINT8)));
-}
-
-
-
-UINT16
-EFIAPI
-DxePcdGet16Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return ReadUnaligned16 (ExGetWorker (Guid, ExTokenNumber, sizeof(UINT16)));
-}
-
-
-
-UINT32
-EFIAPI
-DxePcdGet32Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return ReadUnaligned32 (ExGetWorker (Guid, ExTokenNumber, sizeof(UINT32)));
-}
-
-
-
-UINT64
-EFIAPI
-DxePcdGet64Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return ReadUnaligned64 (ExGetWorker (Guid, ExTokenNumber, sizeof(UINT64)));
-}
-
-
-
-VOID *
-EFIAPI
-DxePcdGetPtrEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return ExGetWorker (Guid, ExTokenNumber, 0);
-}
-
-
-
-BOOLEAN
-EFIAPI
-DxePcdGetBoolEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return *((BOOLEAN *) ExGetWorker (Guid, ExTokenNumber, sizeof(BOOLEAN)));
-}
-
-
-
-UINTN
-EFIAPI
-DxePcdGetSizeEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return DxePcdGetSize(GetExPcdTokenNumber (Guid, (UINT32) ExTokenNumber));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet8 (
- IN UINTN TokenNumber,
- IN UINT8 Value
- )
-{
- return SetValueWorker (TokenNumber, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet16 (
- IN UINTN TokenNumber,
- IN UINT16 Value
- )
-{
- return SetValueWorker (TokenNumber, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet32 (
- IN UINTN TokenNumber,
- IN UINT32 Value
- )
-{
- return SetValueWorker (TokenNumber, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet64 (
- IN UINTN TokenNumber,
- IN UINT64 Value
- )
-{
- return SetValueWorker (TokenNumber, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSetPtr (
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN VOID *Buffer
- )
-{
- return SetWorker (TokenNumber, Buffer, SizeOfBuffer, TRUE);
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSetBool (
- IN UINTN TokenNumber,
- IN BOOLEAN Value
- )
-{
- return SetValueWorker (TokenNumber, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet8Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINT8 Value
- )
-{
- return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet16Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINT16 Value
- )
-{
- return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet32Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINT32 Value
- )
-{
- return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet64Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINT64 Value
- )
-{
- return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSetPtrEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN VOID *Buffer
- )
-{
- return ExSetWorker(ExTokenNumber, Guid, Buffer, SizeOfBuffer, TRUE);
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSetBoolEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN BOOLEAN Value
- )
-{
- return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));
-}
-
-
-
-
-EFI_STATUS
-EFIAPI
-DxeRegisterCallBackOnSet (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN UINTN TokenNumber,
- IN PCD_PROTOCOL_CALLBACK CallBackFunction
- )
-{
- EFI_STATUS Status;
-
- ASSERT (CallBackFunction != NULL);
-
- //
- // Aquire lock to prevent reentrance from TPL_CALLBACK level
- //
- EfiAcquireLock (&mPcdDatabaseLock);
-
- Status = DxeRegisterCallBackWorker (TokenNumber, Guid, CallBackFunction);
-
- EfiReleaseLock (&mPcdDatabaseLock);
-
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxeUnRegisterCallBackOnSet (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN UINTN TokenNumber,
- IN PCD_PROTOCOL_CALLBACK CallBackFunction
- )
-{
- EFI_STATUS Status;
-
- ASSERT (CallBackFunction != NULL);
-
- //
- // Aquire lock to prevent reentrance from TPL_CALLBACK level
- //
- EfiAcquireLock (&mPcdDatabaseLock);
-
- Status = DxeUnRegisterCallBackWorker (TokenNumber, Guid, CallBackFunction);
-
- EfiReleaseLock (&mPcdDatabaseLock);
-
- return Status;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdGetNextToken (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN OUT UINTN *TokenNumber
- )
-{
- EFI_STATUS Status;
- BOOLEAN PeiExMapTableEmpty;
- BOOLEAN DxeExMapTableEmpty;
-
- if (!FeaturePcdGet (PcdDxePcdDatabaseTraverseEnabled)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = EFI_NOT_FOUND;
- PeiExMapTableEmpty = PEI_EXMAP_TABLE_EMPTY;
- DxeExMapTableEmpty = DXE_EXMAP_TABLE_EMPTY;
-
- //
- // Scan the local token space
- //
- if (Guid == NULL) {
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- if (((*TokenNumber + 1 > PEI_NEX_TOKEN_NUMBER + 1) && (*TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1)) ||
- ((*TokenNumber + 1 > (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER + 1)))) {
- return EFI_NOT_FOUND;
- }
-
- (*TokenNumber)++;
- if ((*TokenNumber + 1 > PEI_NEX_TOKEN_NUMBER + 1) &&
- (*TokenNumber <= PEI_LOCAL_TOKEN_NUMBER)) {
- //
- // The first Non-Ex type Token Number for DXE PCD
- // database is PEI_LOCAL_TOKEN_NUMBER
- //
- *TokenNumber = PEI_LOCAL_TOKEN_NUMBER;
- } else if (*TokenNumber + 1 > DXE_NEX_TOKEN_NUMBER + PEI_LOCAL_TOKEN_NUMBER + 1) {
- *TokenNumber = PCD_INVALID_TOKEN_NUMBER;
- }
- return EFI_SUCCESS;
- }
-
- if (PeiExMapTableEmpty && DxeExMapTableEmpty) {
- *TokenNumber = PCD_INVALID_TOKEN_NUMBER;
- return EFI_NOT_FOUND;
- }
-
- if (!PeiExMapTableEmpty) {
- Status = ExGetNextTokeNumber (
- Guid,
- TokenNumber,
- mPcdDatabase->PeiDb.Init.GuidTable,
- sizeof(mPcdDatabase->PeiDb.Init.GuidTable),
- mPcdDatabase->PeiDb.Init.ExMapTable,
- sizeof(mPcdDatabase->PeiDb.Init.ExMapTable)
- );
- }
-
- if (Status == EFI_SUCCESS) {
- return Status;
- }
-
- if (!DxeExMapTableEmpty) {
- Status = ExGetNextTokeNumber (
- Guid,
- TokenNumber,
- mPcdDatabase->DxeDb.Init.GuidTable,
- sizeof(mPcdDatabase->DxeDb.Init.GuidTable),
- mPcdDatabase->DxeDb.Init.ExMapTable,
- sizeof(mPcdDatabase->DxeDb.Init.ExMapTable)
- );
- }
-
- return Status;
-}
-
-STATIC
-EFI_GUID **
-GetDistinctTokenSpace (
- IN OUT UINTN *ExMapTableSize,
- IN DYNAMICEX_MAPPING *ExMapTable,
- IN EFI_GUID *GuidTable
- )
-{
- EFI_GUID **DistinctTokenSpace;
- UINTN OldGuidIndex;
- UINTN TsIdx;
- UINTN Idx;
-
-
- DistinctTokenSpace = AllocateZeroPool (*ExMapTableSize * sizeof (EFI_GUID *));
- ASSERT (DistinctTokenSpace != NULL);
-
- TsIdx = 0;
- OldGuidIndex = ExMapTable[0].ExGuidIndex;
- DistinctTokenSpace[TsIdx] = &GuidTable[OldGuidIndex];
- for (Idx = 1; Idx < *ExMapTableSize; Idx++) {
- if (ExMapTable[Idx].ExGuidIndex != OldGuidIndex) {
- OldGuidIndex = ExMapTable[Idx].ExGuidIndex;
- DistinctTokenSpace[++TsIdx] = &GuidTable[OldGuidIndex];
- }
- }
-
- //
- // The total number of Distinct Token Space
- // is TsIdx + 1 because we use TsIdx as a index
- // to the DistinctTokenSpace[]
- //
- *ExMapTableSize = TsIdx + 1;
- return DistinctTokenSpace;
-
-}
-
-//
-// Just pre-allocate a memory buffer that is big enough to
-// host all distinct TokenSpace guid in both
-// PEI ExMap and DXE ExMap.
-//
-STATIC EFI_GUID *TmpTokenSpaceBuffer[PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE] = { 0 };
-
-EFI_STATUS
-EFIAPI
-DxePcdGetNextTokenSpace (
- IN OUT CONST EFI_GUID **Guid
- )
-{
- UINTN Idx;
- UINTN Idx2;
- UINTN Idx3;
- UINTN PeiTokenSpaceTableSize;
- UINTN DxeTokenSpaceTableSize;
- EFI_GUID **PeiTokenSpaceTable;
- EFI_GUID **DxeTokenSpaceTable;
- BOOLEAN Match;
- BOOLEAN PeiExMapTableEmpty;
- BOOLEAN DxeExMapTableEmpty;
-
- if (!FeaturePcdGet (PcdDxePcdDatabaseTraverseEnabled)) {
- return EFI_UNSUPPORTED;
- }
-
- ASSERT (Guid != NULL);
-
- PeiExMapTableEmpty = PEI_EXMAP_TABLE_EMPTY;
- DxeExMapTableEmpty = DXE_EXMAP_TABLE_EMPTY;
-
- if (PeiExMapTableEmpty && DxeExMapTableEmpty) {
- if (*Guid != NULL) {
- return EFI_NOT_FOUND;
- } else {
- return EFI_SUCCESS;
- }
- }
-
-
- if (TmpTokenSpaceBuffer[0] == NULL) {
- PeiTokenSpaceTableSize = 0;
-
- if (!PeiExMapTableEmpty) {
- PeiTokenSpaceTableSize = PEI_EXMAPPING_TABLE_SIZE;
- PeiTokenSpaceTable = GetDistinctTokenSpace (&PeiTokenSpaceTableSize,
- mPcdDatabase->PeiDb.Init.ExMapTable,
- mPcdDatabase->PeiDb.Init.GuidTable
- );
- CopyMem (TmpTokenSpaceBuffer, PeiTokenSpaceTable, sizeof (EFI_GUID*) * PeiTokenSpaceTableSize);
- }
-
- if (!DxeExMapTableEmpty) {
- DxeTokenSpaceTableSize = DXE_EXMAPPING_TABLE_SIZE;
- DxeTokenSpaceTable = GetDistinctTokenSpace (&DxeTokenSpaceTableSize,
- mPcdDatabase->DxeDb.Init.ExMapTable,
- mPcdDatabase->DxeDb.Init.GuidTable
- );
-
- //
- // Make sure EFI_GUID in DxeTokenSpaceTable does not exist in PeiTokenSpaceTable
- //
- for (Idx2 = 0, Idx3 = PeiTokenSpaceTableSize; Idx2 < DxeTokenSpaceTableSize; Idx2++) {
- Match = FALSE;
- for (Idx = 0; Idx < PeiTokenSpaceTableSize; Idx++) {
- if (CompareGuid (TmpTokenSpaceBuffer[Idx], DxeTokenSpaceTable[Idx2])) {
- Match = TRUE;
- break;
- }
- }
- if (!Match) {
- TmpTokenSpaceBuffer[Idx3++] = DxeTokenSpaceTable[Idx2];
- }
- }
- }
- }
-
- if (*Guid == NULL) {
- *Guid = TmpTokenSpaceBuffer[0];
- return EFI_SUCCESS;
- }
-
- for (Idx = 0; Idx < (PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE); Idx++) {
- if(CompareGuid (*Guid, TmpTokenSpaceBuffer[Idx])) {
- Idx++;
- *Guid = TmpTokenSpaceBuffer[Idx];
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-
-}
-
-
diff --git a/EdkModulePkg/Universal/PCD/Dxe/Pcd.dxs b/EdkModulePkg/Universal/PCD/Dxe/Pcd.dxs
deleted file mode 100644
index 8601537..0000000
--- a/EdkModulePkg/Universal/PCD/Dxe/Pcd.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Pcd.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/PCD/Dxe/Pcd.msa b/EdkModulePkg/Universal/PCD/Dxe/Pcd.msa
deleted file mode 100644
index d920f68..0000000
--- a/EdkModulePkg/Universal/PCD/Dxe/Pcd.msa
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>PcdDxe</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>80CF7257-87AB-47f9-A3FE-D50B76D89541</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for PCD service DXE driver.</Abstract>
- <Description>This DXE driver implement and produce the PCD protocol.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>PcdDxe</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Service.h</Filename>
- <Filename>Service.c</Filename>
- <Filename>Pcd.c</Filename>
- <Filename>Pcd.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gPcdProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Hobs>
- <HobTypes Usage="ALWAYS_CONSUMED" HobGuidCName="gPcdDataBaseHobGuid">
- <HobType>GUID_EXTENSION</HobType>
- </HobTypes>
- </Hobs>
- <Externs>
- <PcdIsDriver>DXE_PCD_DRIVER</PcdIsDriver>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>PcdDxeInit</ModuleEntryPoint>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdVpdBaseAddress</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The base address of the VPD (Vital Product Data) region. It is
- normally a region reserved on flash.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdDxePcdDatabaseTraverseEnabled</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This feature flag can be used to enable or disable the Pcd DXE database
- traverse capability. Disable it can reduce the size of final image generated.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/PCD/Dxe/Service.c b/EdkModulePkg/Universal/PCD/Dxe/Service.c
deleted file mode 100644
index 8ff45d3..0000000
--- a/EdkModulePkg/Universal/PCD/Dxe/Service.c
+++ /dev/null
@@ -1,1153 +0,0 @@
-/** @file
-Private functions used by PCD DXE driver.
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name: Service.c
-
-**/
-#include "Service.h"
-
-
-PCD_DATABASE * mPcdDatabase;
-
-LIST_ENTRY *mCallbackFnTable;
-
-VOID *
-GetWorker (
- UINTN TokenNumber,
- UINTN GetSize
- )
-{
- UINT32 *LocalTokenNumberTable;
- EFI_GUID *GuidTable;
- UINT16 *StringTable;
- EFI_GUID *Guid;
- UINT16 *Name;
- VARIABLE_HEAD *VariableHead;
- UINT8 *VaraiableDefaultBuffer;
- UINT8 *Data;
- VPD_HEAD *VpdHead;
- UINT8 *PcdDb;
- VOID *RetPtr;
- UINTN MaxSize;
- UINTN TmpTokenNumber;
- UINTN DataSize;
- EFI_STATUS Status;
- UINT32 LocalTokenNumber;
- UINT32 Offset;
- UINT16 StringTableIdx;
- BOOLEAN IsPeiDb;
-
- //
- // Aquire lock to prevent reentrance from TPL_CALLBACK level
- //
- EfiAcquireLock (&mPcdDatabaseLock);
-
- RetPtr = NULL;
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
-
- TmpTokenNumber = TokenNumber;
-
- //
- // PCD_TOTAL_TOKEN_NUMBER is a auto-generated constant.
- // It could be zero. EBC compiler is very choosy. It may
- // report warning. So we add 1 in each size of the
- // comparison.
- //
- ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);
-
- ASSERT ((GetSize == DxePcdGetSize (TokenNumber + 1)) || (GetSize == 0));
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- IsPeiDb = (BOOLEAN) ((TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1) ? TRUE : FALSE);
-
- LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
- mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
-
- TokenNumber = IsPeiDb ? TokenNumber :
- TokenNumber - PEI_LOCAL_TOKEN_NUMBER;
-
- LocalTokenNumber = LocalTokenNumberTable[TokenNumber];
-
- if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
- if (GetSize == 0) {
- GetPtrTypeSize (TmpTokenNumber, &MaxSize);
- } else {
- MaxSize = GetSize;
- }
- LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, MaxSize, IsPeiDb);
- }
-
- PcdDb = IsPeiDb ? ((UINT8 *) &mPcdDatabase->PeiDb) : ((UINT8 *) &mPcdDatabase->DxeDb);
- StringTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.StringTable :
- mPcdDatabase->DxeDb.Init.StringTable;
-
- Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
-
- switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
- case PCD_TYPE_VPD:
- VpdHead = (VPD_HEAD *) ((UINT8 *) PcdDb + Offset);
- RetPtr = (VOID *) (UINTN) (FixedPcdGet32(PcdVpdBaseAddress) + VpdHead->Offset);
- break;
-
- case PCD_TYPE_HII:
- GuidTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.GuidTable :
- mPcdDatabase->DxeDb.Init.GuidTable;
-
- VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
-
- Guid = &(GuidTable[VariableHead->GuidTableIndex]);
- Name = &(StringTable[VariableHead->StringIndex]);
- VaraiableDefaultBuffer = (UINT8 *) PcdDb + VariableHead->DefaultValueOffset;
-
- Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
- if (Status == EFI_SUCCESS) {
- if (GetSize == 0) {
- //
- // It is a pointer type. So get the MaxSize reserved for
- // this PCD entry.
- //
- GetPtrTypeSize (TmpTokenNumber, &GetSize);
- }
- CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize);
- FreePool (Data);
- }
- //
- // If the operation is successful, we copy the data
- // to the default value buffer in the PCD Database.
- // So that we can free the Data allocated in GetHiiVariable.
- //
- //
- // If the operation is not successful,
- // Return 1) either the default value specified by Platform Integrator
- // 2) Or the value Set by a PCD set operation.
- //
- RetPtr = (VOID *) VaraiableDefaultBuffer;
- break;
-
- case PCD_TYPE_STRING:
- StringTableIdx = (UINT16) *((UINT8 *) PcdDb + Offset);
- RetPtr = (VOID *) &StringTable[StringTableIdx];
- break;
-
- case PCD_TYPE_DATA:
- RetPtr = (VOID *) ((UINT8 *) PcdDb + Offset);
- break;
-
- default:
- ASSERT (FALSE);
- break;
-
- }
-
- EfiReleaseLock (&mPcdDatabaseLock);
-
- return RetPtr;
-
-}
-
-
-
-EFI_STATUS
-DxeRegisterCallBackWorker (
- IN UINTN TokenNumber,
- IN CONST GUID *Guid, OPTIONAL
- IN PCD_PROTOCOL_CALLBACK CallBackFunction
-)
-{
- CALLBACK_FN_ENTRY *FnTableEntry;
- LIST_ENTRY *ListHead;
- LIST_ENTRY *ListNode;
-
- if (Guid != NULL) {
- TokenNumber = GetExPcdTokenNumber (Guid, (UINT32) TokenNumber);
- }
-
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
-
- ListHead = &mCallbackFnTable[TokenNumber];
- ListNode = GetFirstNode (ListHead);
-
- while (ListNode != ListHead) {
- FnTableEntry = CR_FNENTRY_FROM_LISTNODE(ListNode, CALLBACK_FN_ENTRY, Node);
-
- if (FnTableEntry->CallbackFn == CallBackFunction) {
- //
- // We only allow a Callback function to be register once
- // for a TokenNumber. So just return EFI_SUCCESS
- //
- return EFI_SUCCESS;
- }
- ListNode = GetNextNode (ListHead, ListNode);
- }
-
- FnTableEntry = AllocatePool (sizeof(CALLBACK_FN_ENTRY));
- ASSERT (FnTableEntry != NULL);
-
- FnTableEntry->CallbackFn = CallBackFunction;
- InsertTailList (ListHead, &FnTableEntry->Node);
-
- return EFI_SUCCESS;
-}
-
-
-
-
-EFI_STATUS
-DxeUnRegisterCallBackWorker (
- IN UINTN TokenNumber,
- IN CONST GUID *Guid, OPTIONAL
- IN PCD_PROTOCOL_CALLBACK CallBackFunction
-)
-{
- CALLBACK_FN_ENTRY *FnTableEntry;
- LIST_ENTRY *ListHead;
- LIST_ENTRY *ListNode;
-
- if (Guid != NULL) {
- TokenNumber = GetExPcdTokenNumber (Guid, (UINT32) TokenNumber);
- }
-
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
-
- ListHead = &mCallbackFnTable[TokenNumber];
- ListNode = GetFirstNode (ListHead);
-
- while (ListNode != ListHead) {
- FnTableEntry = CR_FNENTRY_FROM_LISTNODE(ListNode, CALLBACK_FN_ENTRY, Node);
-
- if (FnTableEntry->CallbackFn == CallBackFunction) {
- //
- // We only allow a Callback function to be register once
- // for a TokenNumber. So we can safely remove the Node from
- // the Link List and return EFI_SUCCESS.
- //
- RemoveEntryList (ListNode);
- FreePool (FnTableEntry);
-
- return EFI_SUCCESS;
- }
- ListNode = GetNextNode (ListHead, ListNode);
- }
-
- return EFI_INVALID_PARAMETER;
-}
-
-
-
-EFI_STATUS
-ExGetNextTokeNumber (
- IN CONST EFI_GUID *Guid,
- IN OUT UINTN *TokenNumber,
- IN EFI_GUID *GuidTable,
- IN UINTN SizeOfGuidTable,
- IN DYNAMICEX_MAPPING *ExMapTable,
- IN UINTN SizeOfExMapTable
- )
-{
- EFI_GUID *MatchGuid;
- UINTN Idx;
- UINTN GuidTableIdx;
- BOOLEAN Found;
-
- MatchGuid = ScanGuid (GuidTable, SizeOfGuidTable, Guid);
- if (MatchGuid == NULL) {
- return EFI_NOT_FOUND;
- }
-
- Found = FALSE;
- GuidTableIdx = MatchGuid - GuidTable;
- for (Idx = 0; Idx < SizeOfExMapTable; Idx++) {
- if (ExMapTable[Idx].ExGuidIndex == GuidTableIdx) {
- Found = TRUE;
- break;
- }
- }
-
- if (Found) {
- if (*TokenNumber == PCD_INVALID_TOKEN_NUMBER) {
- *TokenNumber = ExMapTable[Idx].ExTokenNumber;
- return EFI_SUCCESS;
- }
-
- for ( ; Idx < SizeOfExMapTable; Idx++) {
- if (ExMapTable[Idx].ExTokenNumber == *TokenNumber) {
- Idx++;
- if (Idx == SizeOfExMapTable) {
- //
- // Exceed the length of ExMap Table
- //
- *TokenNumber = PCD_INVALID_TOKEN_NUMBER;
- return EFI_SUCCESS;
- } else if (ExMapTable[Idx].ExGuidIndex == GuidTableIdx) {
- //
- // Found the next match
- //
- *TokenNumber = ExMapTable[Idx].ExTokenNumber;
- return EFI_SUCCESS;
- } else {
- //
- // Guid has been changed. It is the next Token Space Guid.
- // We should flag no more TokenNumber.
- //
- *TokenNumber = PCD_INVALID_TOKEN_NUMBER;
- return EFI_SUCCESS;
- }
- }
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-
-
-
-VOID
-BuildPcdDxeDataBase (
- VOID
- )
-{
- PEI_PCD_DATABASE *PeiDatabase;
- EFI_HOB_GUID_TYPE *GuidHob;
- UINTN Idx;
-
- mPcdDatabase = AllocateZeroPool (sizeof(PCD_DATABASE));
- ASSERT (mPcdDatabase != NULL);
-
- GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);
- if (GuidHob != NULL) {
-
- //
- // We will copy over the PEI phase's PCD Database.
- //
- // If no PEIMs use dynamic Pcd Entry, the Pcd Service PEIM
- // should not be included at all. So the GuidHob could
- // be NULL. If it is NULL, we just copy over the DXE Default
- // Value to PCD Database.
- //
-
- PeiDatabase = (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob);
- //
- // Copy PCD Entries refereneced in PEI phase to PCD DATABASE
- //
- CopyMem (&mPcdDatabase->PeiDb, PeiDatabase, sizeof (PEI_PCD_DATABASE));
- }
-
- //
- // Copy PCD Entries with default value to PCD DATABASE
- //
- CopyMem (&mPcdDatabase->DxeDb.Init, &gDXEPcdDbInit, sizeof(DXE_PCD_DATABASE_INIT));
-
-
- //
- // Initialized the Callback Function Table
- //
-
- mCallbackFnTable = AllocateZeroPool (PCD_TOTAL_TOKEN_NUMBER * sizeof (LIST_ENTRY));
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- for (Idx = 0; Idx + 1 < PCD_TOTAL_TOKEN_NUMBER + 1; Idx++) {
- InitializeListHead (&mCallbackFnTable[Idx]);
- }
-
- return;
-}
-
-
-
-EFI_STATUS
-GetHiiVariable (
- IN EFI_GUID *VariableGuid,
- IN UINT16 *VariableName,
- OUT UINT8 **VariableData,
- OUT UINTN *VariableSize
- )
-{
- UINTN Size;
- EFI_STATUS Status;
- UINT8 *Buffer;
-
- Size = 0;
- Buffer = NULL;
-
- Status = gRT->GetVariable (
- (UINT16 *)VariableName,
- VariableGuid,
- NULL,
- &Size,
- Buffer
- );
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- Buffer = (UINT8 *) AllocatePool (Size);
-
- ASSERT (Buffer != NULL);
-
- Status = gRT->GetVariable (
- VariableName,
- VariableGuid,
- NULL,
- &Size,
- Buffer
- );
-
- ASSERT (Status == EFI_SUCCESS);
- *VariableData = Buffer;
- *VariableSize = Size;
- }
-
- return Status;
-}
-
-
-UINT32
-GetSkuEnabledTokenNumber (
- UINT32 LocalTokenNumber,
- UINTN Size,
- BOOLEAN IsPeiDb
- )
-{
- SKU_HEAD *SkuHead;
- SKU_ID *SkuIdTable;
- INTN i;
- UINT8 *Value;
- SKU_ID *PhaseSkuIdTable;
- UINT8 *PcdDb;
-
- ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0);
-
- PcdDb = IsPeiDb ? (UINT8 *) &mPcdDatabase->PeiDb : (UINT8 *) &mPcdDatabase->DxeDb;
-
- SkuHead = (SKU_HEAD *) (PcdDb + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));
- Value = (UINT8 *) (PcdDb + SkuHead->SkuDataStartOffset);
-
- PhaseSkuIdTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.SkuIdTable :
- mPcdDatabase->DxeDb.Init.SkuIdTable;
-
- SkuIdTable = &PhaseSkuIdTable[SkuHead->SkuIdTableOffset];
-
- for (i = 0; i < SkuIdTable[0]; i++) {
- if (mPcdDatabase->PeiDb.Init.SystemSkuId == SkuIdTable[i + 1]) {
- break;
- }
- }
- ASSERT (i < SkuIdTable[0]);
-
- switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
- case PCD_TYPE_VPD:
- Value = (UINT8 *) &(((VPD_HEAD *) Value)[i]);
- return (UINT32) ((Value - PcdDb) | PCD_TYPE_VPD);
-
- case PCD_TYPE_HII:
- Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[i]);
- return (UINT32) ((Value - PcdDb) | PCD_TYPE_HII);
-
- case PCD_TYPE_STRING:
- Value = (UINT8 *) &(((STRING_HEAD *) Value)[i]);
- return (UINT32) ((Value - PcdDb) | PCD_TYPE_STRING);
-
- case PCD_TYPE_DATA:
- Value += Size * i;
- return (UINT32) (Value - PcdDb);
-
- default:
- ASSERT (FALSE);
- }
-
- ASSERT (FALSE);
-
- return 0;
-
-}
-
-
-
-
-STATIC
-VOID
-InvokeCallbackOnSet (
- UINT32 ExTokenNumber,
- CONST EFI_GUID *Guid, OPTIONAL
- UINTN TokenNumber,
- VOID *Data,
- UINTN Size
- )
-{
- CALLBACK_FN_ENTRY *FnTableEntry;
- LIST_ENTRY *ListHead;
- LIST_ENTRY *ListNode;
-
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
-
- ListHead = &mCallbackFnTable[TokenNumber];
- ListNode = GetFirstNode (ListHead);
-
- while (ListNode != ListHead) {
- FnTableEntry = CR_FNENTRY_FROM_LISTNODE(ListNode, CALLBACK_FN_ENTRY, Node);
-
- FnTableEntry->CallbackFn(Guid,
- (Guid == NULL) ? TokenNumber : ExTokenNumber,
- Data,
- Size);
-
- ListNode = GetNextNode (ListHead, ListNode);
- }
-
- return;
-}
-
-
-EFI_STATUS
-SetValueWorker (
- IN UINTN TokenNumber,
- IN VOID *Data,
- IN UINTN Size
- )
-{
- return SetWorker (TokenNumber, Data, &Size, FALSE);
-}
-
-
-EFI_STATUS
-SetWorker (
- IN UINTN TokenNumber,
- IN VOID *Data,
- IN OUT UINTN *Size,
- IN BOOLEAN PtrType
- )
-{
- UINT32 *LocalTokenNumberTable;
- BOOLEAN IsPeiDb;
- UINT32 LocalTokenNumber;
- EFI_GUID *GuidTable;
- UINT16 *StringTable;
- EFI_GUID *Guid;
- UINT16 *Name;
- UINTN VariableOffset;
- VOID *InternalData;
- VARIABLE_HEAD *VariableHead;
- UINTN Offset;
- UINT8 *PcdDb;
- EFI_STATUS Status;
- UINTN MaxSize;
- UINTN TmpTokenNumber;
-
- //
- // Aquire lock to prevent reentrance from TPL_CALLBACK level
- //
- EfiAcquireLock (&mPcdDatabaseLock);
-
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
-
- TmpTokenNumber = TokenNumber;
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
-
- ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);
-
- if (!PtrType) {
- ASSERT (*Size == DxePcdGetSize (TokenNumber + 1));
- }
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- IsPeiDb = (BOOLEAN) ((TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1) ? TRUE : FALSE);
-
- LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
- mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- if ((TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1) ||
- (TokenNumber + 1 >= PEI_LOCAL_TOKEN_NUMBER + 1 || TokenNumber + 1 < (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER + 1))) {
- InvokeCallbackOnSet (0, NULL, TokenNumber + 1, Data, *Size);
- }
-
- TokenNumber = IsPeiDb ? TokenNumber
- : TokenNumber - PEI_LOCAL_TOKEN_NUMBER;
-
- LocalTokenNumber = LocalTokenNumberTable[TokenNumber];
-
- if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
- if (PtrType) {
- GetPtrTypeSize (TmpTokenNumber, &MaxSize);
- } else {
- MaxSize = *Size;
- }
- LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, MaxSize, IsPeiDb);
- }
-
- Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
-
- PcdDb = IsPeiDb ? ((UINT8 *) &mPcdDatabase->PeiDb) : ((UINT8 *) &mPcdDatabase->DxeDb);
-
- StringTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.StringTable :
- mPcdDatabase->DxeDb.Init.StringTable;
-
- InternalData = PcdDb + Offset;
-
- switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
- case PCD_TYPE_VPD:
- ASSERT (FALSE);
- Status = EFI_INVALID_PARAMETER;
- break;
-
- case PCD_TYPE_STRING:
- if (SetPtrTypeSize (TmpTokenNumber, Size)) {
- CopyMem (&StringTable[*((UINT16 *)InternalData)], Data, *Size);
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_INVALID_PARAMETER;
- }
- break;
-
- case PCD_TYPE_HII:
- if (PtrType) {
- if (!SetPtrTypeSize (TmpTokenNumber, Size)) {
- Status = EFI_INVALID_PARAMETER;
- break;
- }
- }
-
- GuidTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.GuidTable :
- mPcdDatabase->DxeDb.Init.GuidTable;
-
- VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
-
- Guid = &(GuidTable[VariableHead->GuidTableIndex]);
- Name = &(StringTable[VariableHead->StringIndex]);
- VariableOffset = VariableHead->Offset;
-
- Status = SetHiiVariable (Guid, Name, Data, *Size, VariableOffset);
-
- if (EFI_NOT_FOUND == Status) {
- CopyMem (PcdDb + VariableHead->DefaultValueOffset, Data, *Size);
- Status = EFI_SUCCESS;
- }
- break;
-
- case PCD_TYPE_DATA:
- if (PtrType) {
- if (SetPtrTypeSize (TmpTokenNumber, Size)) {
- CopyMem (InternalData, Data, *Size);
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_INVALID_PARAMETER;
- }
- break;
- }
-
- Status = EFI_SUCCESS;
- switch (*Size) {
- case sizeof(UINT8):
- *((UINT8 *) InternalData) = *((UINT8 *) Data);
- break;
-
- case sizeof(UINT16):
- *((UINT16 *) InternalData) = *((UINT16 *) Data);
- break;
-
- case sizeof(UINT32):
- *((UINT32 *) InternalData) = *((UINT32 *) Data);
- break;
-
- case sizeof(UINT64):
- *((UINT64 *) InternalData) = *((UINT64 *) Data);
- break;
-
- default:
- ASSERT (FALSE);
- Status = EFI_NOT_FOUND;
- break;
- }
- break;
-
- default:
- ASSERT (FALSE);
- Status = EFI_NOT_FOUND;
- break;
- }
-
- EfiReleaseLock (&mPcdDatabaseLock);
-
- return Status;
-}
-
-
-
-
-
-VOID *
-ExGetWorker (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINTN GetSize
- )
-{
- return GetWorker(GetExPcdTokenNumber (Guid, (UINT32) ExTokenNumber), GetSize);
-}
-
-
-
-
-EFI_STATUS
-ExSetValueWorker (
- IN UINTN ExTokenNumber,
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN UINTN SetSize
- )
-{
- return ExSetWorker (ExTokenNumber, Guid, Data, &SetSize, FALSE);
-}
-
-
-EFI_STATUS
-ExSetWorker (
- IN UINTN ExTokenNumber,
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN OUT UINTN *SetSize,
- IN BOOLEAN PtrType
- )
-{
- UINTN TokenNumber;
-
- TokenNumber = GetExPcdTokenNumber (Guid, (UINT32) ExTokenNumber);
-
- InvokeCallbackOnSet ((UINT32) ExTokenNumber, Guid, TokenNumber, Data, *SetSize);
-
- return SetWorker (TokenNumber, Data, SetSize, PtrType);
-
-}
-
-
-
-
-EFI_STATUS
-SetHiiVariable (
- IN EFI_GUID *VariableGuid,
- IN UINT16 *VariableName,
- IN CONST VOID *Data,
- IN UINTN DataSize,
- IN UINTN Offset
- )
-{
- UINTN Size;
- VOID *Buffer;
- EFI_STATUS Status;
- UINT32 Attribute;
-
- Size = 0;
-
- Status = gRT->GetVariable (
- (UINT16 *)VariableName,
- VariableGuid,
- NULL,
- &Size,
- NULL
- );
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
-
- Buffer = AllocatePool (Size);
-
- ASSERT (Buffer != NULL);
-
- Status = gRT->GetVariable (
- VariableName,
- VariableGuid,
- &Attribute,
- &Size,
- Buffer
- );
-
- ASSERT_EFI_ERROR (Status);
-
- CopyMem ((UINT8 *)Buffer + Offset, Data, DataSize);
-
- Status = gRT->SetVariable (
- VariableName,
- VariableGuid,
- Attribute,
- Size,
- Buffer
- );
-
- FreePool (Buffer);
- return Status;
-
- }
-
- //
- // If we drop to here, we don't have a Variable entry in
- // the variable service yet. So, we will save the data
- // in the PCD Database's volatile area.
- //
- return Status;
-}
-
-
-
-
-
-UINTN
-GetExPcdTokenNumber (
- IN CONST EFI_GUID *Guid,
- IN UINT32 ExTokenNumber
- )
-{
- UINT32 i;
- DYNAMICEX_MAPPING *ExMap;
- EFI_GUID *GuidTable;
- EFI_GUID *MatchGuid;
- UINTN MatchGuidIdx;
-
- if (!PEI_DATABASE_EMPTY) {
- ExMap = mPcdDatabase->PeiDb.Init.ExMapTable;
- GuidTable = mPcdDatabase->PeiDb.Init.GuidTable;
-
- MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->PeiDb.Init.GuidTable), Guid);
-
- if (MatchGuid != NULL) {
-
- MatchGuidIdx = MatchGuid - GuidTable;
-
- for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {
- if ((ExTokenNumber == ExMap[i].ExTokenNumber) &&
- (MatchGuidIdx == ExMap[i].ExGuidIndex)) {
- return ExMap[i].LocalTokenNumber;
-
- }
- }
- }
- }
-
- ExMap = mPcdDatabase->DxeDb.Init.ExMapTable;
- GuidTable = mPcdDatabase->DxeDb.Init.GuidTable;
-
- MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->DxeDb.Init.GuidTable), Guid);
- //
- // We need to ASSERT here. If GUID can't be found in GuidTable, this is a
- // error in the BUILD system.
- //
- ASSERT (MatchGuid != NULL);
-
- MatchGuidIdx = MatchGuid - GuidTable;
-
- for (i = 0; i < DXE_EXMAPPING_TABLE_SIZE; i++) {
- if ((ExTokenNumber == ExMap[i].ExTokenNumber) &&
- (MatchGuidIdx == ExMap[i].ExGuidIndex)) {
- return ExMap[i].LocalTokenNumber;
- }
- }
-
- ASSERT (FALSE);
-
- return 0;
-}
-
-
-STATIC
-SKU_ID *
-GetSkuIdArray (
- IN UINTN LocalTokenNumberTableIdx,
- IN BOOLEAN IsPeiPcd
- )
-{
- SKU_HEAD *SkuHead;
- UINTN LocalTokenNumber;
- UINT8 *Database;
-
- if (IsPeiPcd) {
- LocalTokenNumber = mPcdDatabase->PeiDb.Init.LocalTokenNumberTable[LocalTokenNumberTableIdx];
- Database = (UINT8 *) &mPcdDatabase->PeiDb;
- } else {
- LocalTokenNumber = mPcdDatabase->DxeDb.Init.LocalTokenNumberTable[LocalTokenNumberTableIdx - PEI_LOCAL_TOKEN_NUMBER];
- Database = (UINT8 *) &mPcdDatabase->DxeDb;
- }
-
- ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) != 0);
-
- SkuHead = (SKU_HEAD *) ((UINT8 *)Database + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));
-
- return (SKU_ID *) (Database + SkuHead->SkuIdTableOffset);
-
-}
-
-
-STATIC
-UINTN
-GetSizeTableIndexA (
- IN UINTN LocalTokenNumberTableIdx,
- IN UINT32 *LocalTokenNumberTable,
- IN BOOLEAN IsPeiDb
- )
-{
- UINTN i;
- UINTN SizeTableIdx;
- UINTN LocalTokenNumber;
- SKU_ID *SkuIdTable;
-
- SizeTableIdx = 0;
-
- for (i=0; i<LocalTokenNumberTableIdx; i++) {
- LocalTokenNumber = LocalTokenNumberTable[i];
-
- if ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER) {
- //
- // SizeTable only contain record for PCD_DATUM_TYPE_POINTER type
- // PCD entry.
- //
- if (LocalTokenNumber & PCD_TYPE_VPD) {
- //
- // We have only one entry for VPD enabled PCD entry:
- // 1) MAX Size.
- // We consider current size is equal to MAX size.
- //
- SizeTableIdx++;
- } else {
- if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
- //
- // We have only two entry for Non-Sku enabled PCD entry:
- // 1) MAX SIZE
- // 2) Current Size
- //
- SizeTableIdx += 2;
- } else {
- //
- // We have these entry for SKU enabled PCD entry
- // 1) MAX SIZE
- // 2) Current Size for each SKU_ID (It is equal to MaxSku).
- //
- SkuIdTable = GetSkuIdArray (i, IsPeiDb);
- SizeTableIdx += (UINTN)*SkuIdTable + 1;
- }
- }
- }
-
- }
-
- return SizeTableIdx;
-}
-
-
-
-STATIC
-UINTN
-GetSizeTableIndex (
- IN UINTN LocalTokenNumberTableIdx,
- IN BOOLEAN IsPeiDb
- )
-{
- UINT32 *LocalTokenNumberTable;
-
- if (IsPeiDb) {
- LocalTokenNumberTable = mPcdDatabase->PeiDb.Init.LocalTokenNumberTable;
- } else {
- LocalTokenNumberTable = mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
- }
- return GetSizeTableIndexA (LocalTokenNumberTableIdx,
- LocalTokenNumberTable,
- IsPeiDb);
-}
-
-
-
-UINTN
-GetPtrTypeSize (
- IN UINTN LocalTokenNumberTableIdx,
- OUT UINTN *MaxSize
- )
-{
- INTN SizeTableIdx;
- UINTN LocalTokenNumber;
- SKU_ID *SkuIdTable;
- SIZE_INFO *SizeTable;
- UINTN i;
- BOOLEAN IsPeiDb;
- UINT32 *LocalTokenNumberTable;
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
-
-
- if (IsPeiDb) {
- LocalTokenNumberTable = mPcdDatabase->PeiDb.Init.LocalTokenNumberTable;
- SizeTable = mPcdDatabase->PeiDb.Init.SizeTable;
- } else {
- LocalTokenNumberTableIdx -= PEI_LOCAL_TOKEN_NUMBER;
- LocalTokenNumberTable = mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
- SizeTable = mPcdDatabase->DxeDb.Init.SizeTable;
- }
-
- LocalTokenNumber = LocalTokenNumberTable[LocalTokenNumberTableIdx];
-
- ASSERT ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER);
-
- SizeTableIdx = GetSizeTableIndex (LocalTokenNumberTableIdx, IsPeiDb);
-
- *MaxSize = SizeTable[SizeTableIdx];
- //
- // SizeTable only contain record for PCD_DATUM_TYPE_POINTER type
- // PCD entry.
- //
- if (LocalTokenNumber & PCD_TYPE_VPD) {
- //
- // We have only one entry for VPD enabled PCD entry:
- // 1) MAX Size.
- // We consider current size is equal to MAX size.
- //
- return *MaxSize;
- } else {
- if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
- //
- // We have only two entry for Non-Sku enabled PCD entry:
- // 1) MAX SIZE
- // 2) Current Size
- //
- return SizeTable[SizeTableIdx + 1];
- } else {
- //
- // We have these entry for SKU enabled PCD entry
- // 1) MAX SIZE
- // 2) Current Size for each SKU_ID (It is equal to MaxSku).
- //
- SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, IsPeiDb);
- for (i = 0; i < SkuIdTable[0]; i++) {
- if (SkuIdTable[1 + i] == mPcdDatabase->PeiDb.Init.SystemSkuId) {
- return SizeTable[SizeTableIdx + 1 + i];
- }
- }
- return SizeTable[SizeTableIdx + 1];
- }
- }
-}
-
-
-
-BOOLEAN
-SetPtrTypeSize (
- IN UINTN LocalTokenNumberTableIdx,
- IN OUT UINTN *CurrentSize
- )
-{
- INTN SizeTableIdx;
- UINTN LocalTokenNumber;
- SKU_ID *SkuIdTable;
- SIZE_INFO *SizeTable;
- UINTN i;
- UINTN MaxSize;
- BOOLEAN IsPeiDb;
- UINT32 *LocalTokenNumberTable;
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
-
- if (IsPeiDb) {
- LocalTokenNumberTable = mPcdDatabase->PeiDb.Init.LocalTokenNumberTable;
- SizeTable = mPcdDatabase->PeiDb.Init.SizeTable;
- } else {
- LocalTokenNumberTableIdx -= PEI_LOCAL_TOKEN_NUMBER;
- LocalTokenNumberTable = mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
- SizeTable = mPcdDatabase->DxeDb.Init.SizeTable;
- }
-
- LocalTokenNumber = LocalTokenNumberTable[LocalTokenNumberTableIdx];
-
- ASSERT ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER);
-
- SizeTableIdx = GetSizeTableIndex (LocalTokenNumberTableIdx, IsPeiDb);
-
- MaxSize = SizeTable[SizeTableIdx];
- //
- // SizeTable only contain record for PCD_DATUM_TYPE_POINTER type
- // PCD entry.
- //
- if (LocalTokenNumber & PCD_TYPE_VPD) {
- //
- // We shouldn't come here as we don't support SET for VPD
- //
- ASSERT (FALSE);
- return FALSE;
- } else {
- if ((*CurrentSize > MaxSize) ||
- (*CurrentSize == MAX_ADDRESS)) {
- *CurrentSize = MaxSize;
- return FALSE;
- }
-
- if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
- //
- // We have only two entry for Non-Sku enabled PCD entry:
- // 1) MAX SIZE
- // 2) Current Size
- //
- SizeTable[SizeTableIdx + 1] = (SIZE_INFO) *CurrentSize;
- return TRUE;
- } else {
- //
- // We have these entry for SKU enabled PCD entry
- // 1) MAX SIZE
- // 2) Current Size for each SKU_ID (It is equal to MaxSku).
- //
- SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, IsPeiDb);
- for (i = 0; i < SkuIdTable[0]; i++) {
- if (SkuIdTable[1 + i] == mPcdDatabase->PeiDb.Init.SystemSkuId) {
- SizeTable[SizeTableIdx + 1 + i] = (SIZE_INFO) *CurrentSize;
- return TRUE;
- }
- }
- SizeTable[SizeTableIdx + 1] = (SIZE_INFO) *CurrentSize;
- return TRUE;
- }
- }
-}
-
diff --git a/EdkModulePkg/Universal/PCD/Dxe/Service.h b/EdkModulePkg/Universal/PCD/Dxe/Service.h
deleted file mode 100644
index 8796aff..0000000
--- a/EdkModulePkg/Universal/PCD/Dxe/Service.h
+++ /dev/null
@@ -1,480 +0,0 @@
-/** @file
-Private functions used by PCD DXE driver.
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name: Service.h
-
-**/
-
-#ifndef _SERVICE_H
-#define _SERVICE_H
-
-//
-// Please make sure the PCD Serivce PEIM Version is consistent with
-// the version of PCD Database generation tool
-//
-#define PCD_SERVICE_DXE_DRIVER_VERSION 2
-
-//
-// PCD_DXE_DATABASE_GENTOOL_VERSION is defined in Autogen.h
-// and generated by PCD Database generation tool.
-//
-#if (PCD_SERVICE_DXE_DRIVER_VERSION != PCD_DXE_SERVICE_DRIVER_AUTOGEN_VERSION)
- #error "Please make sure the version of PCD Service DXE Driver and PCD DXE Database Generation Tool matches"
-#endif
-
-//
-// Protocol Interface function declaration.
-//
-VOID
-EFIAPI
-DxePcdSetSku (
- IN UINTN SkuId
- )
-;
-
-
-UINT8
-EFIAPI
-DxePcdGet8 (
- IN UINTN TokenNumber
- )
-;
-
-
-UINT16
-EFIAPI
-DxePcdGet16 (
- IN UINTN TokenNumber
- )
-;
-
-
-UINT32
-EFIAPI
-DxePcdGet32 (
- IN UINTN TokenNumber
- )
-;
-
-
-UINT64
-EFIAPI
-DxePcdGet64 (
- IN UINTN TokenNumber
- )
-;
-
-
-VOID *
-EFIAPI
-DxePcdGetPtr (
- IN UINTN TokenNumber
- )
-;
-
-
-BOOLEAN
-EFIAPI
-DxePcdGetBool (
- IN UINTN TokenNumber
- )
-;
-
-
-UINTN
-EFIAPI
-DxePcdGetSize (
- IN UINTN TokenNumber
- )
-;
-
-
-UINT8
-EFIAPI
-DxePcdGet8Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-UINT16
-EFIAPI
-DxePcdGet16Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-UINT32
-EFIAPI
-DxePcdGet32Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-
-UINT64
-EFIAPI
-DxePcdGet64Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-
-VOID *
-EFIAPI
-DxePcdGetPtrEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-BOOLEAN
-EFIAPI
-DxePcdGetBoolEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-UINTN
-EFIAPI
-DxePcdGetSizeEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet8 (
- IN UINTN TokenNumber,
- IN UINT8 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet16 (
- IN UINTN TokenNumber,
- IN UINT16 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet32 (
- IN UINTN TokenNumber,
- IN UINT32 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet64 (
- IN UINTN TokenNumber,
- IN UINT64 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSetPtr (
- IN UINTN TokenNumber,
- IN UINTN *SizeOfBuffer,
- IN VOID *Buffer
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSetBool (
- IN UINTN TokenNumber,
- IN BOOLEAN Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet8Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT8 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet16Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT16 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet32Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT32 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSet64Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT64 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSetPtrEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN VOID *Buffer
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdSetBoolEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN BOOLEAN Value
- )
-;
-
-
-
-EFI_STATUS
-EFIAPI
-DxeRegisterCallBackOnSet (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN UINTN TokenNumber,
- IN PCD_PROTOCOL_CALLBACK CallBackFunction
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxeUnRegisterCallBackOnSet (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN UINTN TokenNumber,
- IN PCD_PROTOCOL_CALLBACK CallBackFunction
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-DxePcdGetNextToken (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN OUT UINTN *TokenNumber
- )
-;
-
-
-
-EFI_STATUS
-EFIAPI
-DxePcdGetNextTokenSpace (
- IN OUT CONST EFI_GUID **Guid
- )
-;
-
-
-typedef struct {
- LIST_ENTRY Node;
- PCD_PROTOCOL_CALLBACK CallbackFn;
-} CALLBACK_FN_ENTRY;
-
-#define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) _CR(Record, Type, Field)
-
-//
-// Internal Functions
-//
-
-EFI_STATUS
-SetValueWorker (
- IN UINTN TokenNumber,
- IN VOID *Data,
- IN UINTN Size
- )
-;
-
-EFI_STATUS
-SetWorker (
- IN UINTN TokenNumber,
- IN VOID *Data,
- IN OUT UINTN *Size,
- IN BOOLEAN PtrType
- )
-;
-
-
-EFI_STATUS
-ExSetValueWorker (
- IN UINTN ExTokenNumber,
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN UINTN SetSize
- )
-;
-
-
-
-EFI_STATUS
-ExSetWorker (
- IN UINTN ExTokenNumber,
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN OUT UINTN *Size,
- IN BOOLEAN PtrType
- )
-;
-
-
-VOID *
-GetWorker (
- IN UINTN TokenNumber,
- IN UINTN GetSize
- )
-;
-
-VOID *
-ExGetWorker (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINTN GetSize
- )
-;
-
-UINT32
-GetSkuEnabledTokenNumber (
- UINT32 LocalTokenNumber,
- UINTN Size,
- BOOLEAN IsPeiDb
- )
-;
-
-EFI_STATUS
-GetHiiVariable (
- IN EFI_GUID *VariableGuid,
- IN UINT16 *VariableName,
- OUT UINT8 **VariableData,
- OUT UINTN *VariableSize
- )
-;
-
-EFI_STATUS
-SetHiiVariable (
- IN EFI_GUID *VariableGuid,
- IN UINT16 *VariableName,
- IN CONST VOID *Data,
- IN UINTN DataSize,
- IN UINTN Offset
- )
-;
-
-EFI_STATUS
-DxeRegisterCallBackWorker (
- IN UINTN TokenNumber,
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN PCD_PROTOCOL_CALLBACK CallBackFunction
-);
-
-EFI_STATUS
-DxeUnRegisterCallBackWorker (
- IN UINTN TokenNumber,
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN PCD_PROTOCOL_CALLBACK CallBackFunction
-);
-
-VOID
-BuildPcdDxeDataBase (
- VOID
-);
-
-
-UINTN
-GetExPcdTokenNumber (
- IN CONST EFI_GUID *Guid,
- IN UINT32 ExTokenNumber
- )
-;
-
-
-
-EFI_STATUS
-ExGetNextTokeNumber (
- IN CONST EFI_GUID *Guid,
- IN OUT UINTN *TokenNumber,
- IN EFI_GUID *GuidTable,
- IN UINTN SizeOfGuidTable,
- IN DYNAMICEX_MAPPING *ExMapTable,
- IN UINTN SizeOfExMapTable
- )
-;
-
-
-UINTN
-GetPtrTypeSize (
- IN UINTN LocalTokenNumberTableIdx,
- OUT UINTN *MaxSize
- )
-;
-
-
-
-BOOLEAN
-SetPtrTypeSize (
- IN UINTN LocalTokenNumberTableIdx,
- IN OUT UINTN *CurrentSize
- )
-;
-
-extern EFI_GUID gPcdDataBaseHobGuid;
-
-extern PCD_DATABASE * mPcdDatabase;
-
-extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit;
-
-extern EFI_LOCK mPcdDatabaseLock;
-
-#endif
diff --git a/EdkModulePkg/Universal/PCD/Pei/Pcd.c b/EdkModulePkg/Universal/PCD/Pei/Pcd.c
deleted file mode 100644
index daaba4b..0000000
--- a/EdkModulePkg/Universal/PCD/Pei/Pcd.c
+++ /dev/null
@@ -1,796 +0,0 @@
-/** @file PCD PEIM
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name: Pcd.c
-
-**/
-
-#include "Service.h"
-
-
-PCD_PPI mPcdPpiInstance = {
- PeiPcdSetSku,
-
- PeiPcdGet8,
- PeiPcdGet16,
- PeiPcdGet32,
- PeiPcdGet64,
- PeiPcdGetPtr,
- PeiPcdGetBool,
- PeiPcdGetSize,
-
- PeiPcdGet8Ex,
- PeiPcdGet16Ex,
- PeiPcdGet32Ex,
- PeiPcdGet64Ex,
- PeiPcdGetPtrEx,
- PeiPcdGetBoolEx,
- PeiPcdGetSizeEx,
-
- PeiPcdSet8,
- PeiPcdSet16,
- PeiPcdSet32,
- PeiPcdSet64,
- PeiPcdSetPtr,
- PeiPcdSetBool,
-
- PeiPcdSet8Ex,
- PeiPcdSet16Ex,
- PeiPcdSet32Ex,
- PeiPcdSet64Ex,
- PeiPcdSetPtrEx,
- PeiPcdSetBoolEx,
-
- PeiRegisterCallBackOnSet,
- PcdUnRegisterCallBackOnSet,
- PeiPcdGetNextToken,
- PeiPcdGetNextTokenSpace
-};
-
-
-
-STATIC EFI_PEI_PPI_DESCRIPTOR mPpiPCD = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gPcdPpiGuid,
- &mPcdPpiInstance
-};
-
-
-
-EFI_STATUS
-EFIAPI
-PcdPeimInit (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
-
- BuildPcdDatabase ();
-
- Status = PeiServicesInstallPpi (&mPpiPCD);
-
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
-VOID
-EFIAPI
-PeiPcdSetSku (
- IN UINTN SkuId
- )
-{
-
- GetPcdDatabase()->Init.SystemSkuId = (SKU_ID) SkuId;
-
- return;
-}
-
-
-
-UINT8
-EFIAPI
-PeiPcdGet8 (
- IN UINTN TokenNumber
- )
-{
- return *((UINT8 *) GetWorker (TokenNumber, sizeof (UINT8)));
-}
-
-
-
-UINT16
-EFIAPI
-PeiPcdGet16 (
- IN UINTN TokenNumber
- )
-{
- return ReadUnaligned16 (GetWorker (TokenNumber, sizeof (UINT16)));
-}
-
-
-
-UINT32
-EFIAPI
-PeiPcdGet32 (
- IN UINTN TokenNumber
- )
-{
- return ReadUnaligned32 (GetWorker (TokenNumber, sizeof (UINT32)));
-}
-
-
-
-UINT64
-EFIAPI
-PeiPcdGet64 (
- IN UINTN TokenNumber
- )
-{
- return ReadUnaligned64 (GetWorker (TokenNumber, sizeof (UINT64)));
-}
-
-
-
-VOID *
-EFIAPI
-PeiPcdGetPtr (
- IN UINTN TokenNumber
- )
-{
- return GetWorker (TokenNumber, 0);
-}
-
-
-
-BOOLEAN
-EFIAPI
-PeiPcdGetBool (
- IN UINTN TokenNumber
- )
-{
- return *((BOOLEAN *) GetWorker (TokenNumber, sizeof (BOOLEAN)));
-}
-
-
-
-UINTN
-EFIAPI
-PeiPcdGetSize (
- IN UINTN TokenNumber
- )
-{
- PEI_PCD_DATABASE *PeiPcdDb;
- UINTN Size;
- UINTN MaxSize;
-
- //
- // If DebugAssertEnabled is TRUE, we still need to provide the GET size
- // function as GetWorker and SetWoker need this function to do ASSERT.
- //
- if ((!FeaturePcdGet(PcdPeiPcdDatabaseGetSizeEnabled)) &&
- (!DebugAssertEnabled ())) {
- return 0;
- }
-
- PeiPcdDb = GetPcdDatabase ();
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
-
- Size = (PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber] & PCD_DATUM_TYPE_ALL_SET) >> PCD_DATUM_TYPE_SHIFT;
-
- if (Size == 0) {
- //
- // For pointer type, we need to scan the SIZE_TABLE to get the current size.
- //
- return GetPtrTypeSize (TokenNumber, &MaxSize, PeiPcdDb);
- } else {
- return Size;
- }
-
-}
-
-
-
-UINT8
-EFIAPI
-PeiPcdGet8Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return *((UINT8 *) ExGetWorker (Guid, ExTokenNumber, sizeof (UINT8)));
-}
-
-
-
-UINT16
-EFIAPI
-PeiPcdGet16Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return ReadUnaligned16 (ExGetWorker (Guid, ExTokenNumber, sizeof (UINT16)));
-}
-
-
-
-UINT32
-EFIAPI
-PeiPcdGet32Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return ReadUnaligned32 (ExGetWorker (Guid, ExTokenNumber, sizeof (UINT32)));
-}
-
-
-
-UINT64
-EFIAPI
-PeiPcdGet64Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return ReadUnaligned64 (ExGetWorker (Guid, ExTokenNumber, sizeof (UINT64)));
-}
-
-
-
-VOID *
-EFIAPI
-PeiPcdGetPtrEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return ExGetWorker (Guid, ExTokenNumber, 0);
-}
-
-
-
-BOOLEAN
-EFIAPI
-PeiPcdGetBoolEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- return *((BOOLEAN *) ExGetWorker (Guid, ExTokenNumber, sizeof (BOOLEAN)));
-}
-
-
-
-UINTN
-EFIAPI
-PeiPcdGetSizeEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- if ((!FeaturePcdGet (PcdPeiPcdDatabaseGetSizeEnabled)) || !FeaturePcdGet (PcdPeiPcdDatabaseExEnabled)) {
- return 0;
- }
-
- return PeiPcdGetSize (GetExPcdTokenNumber (Guid, ExTokenNumber));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet8 (
- IN UINTN TokenNumber,
- IN UINT8 Value
- )
-{
- return SetValueWorker (TokenNumber, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet16 (
- IN UINTN TokenNumber,
- IN UINT16 Value
- )
-{
- return SetValueWorker (TokenNumber, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet32 (
- IN UINTN TokenNumber,
- IN UINT32 Value
- )
-{
- return SetValueWorker (TokenNumber, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet64 (
- IN UINTN TokenNumber,
- IN UINT64 Value
- )
-{
- return SetValueWorker (TokenNumber, &Value, sizeof (Value));
-}
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSetPtr (
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN VOID *Buffer
- )
-{
- return SetWorker (TokenNumber, Buffer, SizeOfBuffer, TRUE);
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSetBool (
- IN UINTN TokenNumber,
- IN BOOLEAN Value
- )
-{
- return SetValueWorker (TokenNumber, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet8Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINT8 Value
- )
-{
- return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet16Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINT16 Value
- )
-{
- return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet32Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINT32 Value
- )
-{
- return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet64Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINT64 Value
- )
-{
- return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSetPtrEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINTN *SizeOfBuffer,
- IN VOID *Value
- )
-{
- return ExSetWorker (ExTokenNumber, Guid, Value, SizeOfBuffer, TRUE);
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSetBoolEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN BOOLEAN Value
- )
-{
- return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value));
-}
-
-
-
-
-EFI_STATUS
-EFIAPI
-PeiRegisterCallBackOnSet (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN UINTN ExTokenNumber,
- IN PCD_PPI_CALLBACK CallBackFunction
- )
-{
- if (!FeaturePcdGet(PcdPeiPcdDatabaseCallbackOnSetEnabled)) {
- return EFI_UNSUPPORTED;
- }
-
- ASSERT (CallBackFunction != NULL);
-
- return PeiRegisterCallBackWorker (ExTokenNumber, Guid, CallBackFunction, TRUE);
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PcdUnRegisterCallBackOnSet (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN UINTN ExTokenNumber,
- IN PCD_PPI_CALLBACK CallBackFunction
- )
-{
- if (!FeaturePcdGet(PcdPeiPcdDatabaseCallbackOnSetEnabled)) {
- return EFI_UNSUPPORTED;
- }
-
- ASSERT (CallBackFunction != NULL);
-
- return PeiRegisterCallBackWorker (ExTokenNumber, Guid, CallBackFunction, FALSE);
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdGetNextToken (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN OUT UINTN *TokenNumber
- )
-{
- UINTN GuidTableIdx;
- PEI_PCD_DATABASE *PeiPcdDb;
- EFI_GUID *MatchGuid;
- DYNAMICEX_MAPPING *ExMapTable;
- UINTN i;
- BOOLEAN Found;
- BOOLEAN PeiExMapTableEmpty;
-
- if (!FeaturePcdGet (PcdPeiPcdDatabaseTraverseEnabled)) {
- return EFI_UNSUPPORTED;
- }
-
- PeiExMapTableEmpty = PEI_EXMAP_TABLE_EMPTY;
-
- if (Guid == NULL) {
- if (*TokenNumber > PEI_NEX_TOKEN_NUMBER) {
- return EFI_NOT_FOUND;
- }
- (*TokenNumber)++;
- if (*TokenNumber > PEI_NEX_TOKEN_NUMBER) {
- *TokenNumber = PCD_INVALID_TOKEN_NUMBER;
- }
- return EFI_SUCCESS;
- } else {
- if (PeiExMapTableEmpty) {
- *TokenNumber = PCD_INVALID_TOKEN_NUMBER;
- return EFI_SUCCESS;
- }
-
- //
- // Assume PCD Database AutoGen tool is sorting the ExMap based on the following order
- // 1) ExGuid
- // 2) ExTokenNumber
- //
- PeiPcdDb = GetPcdDatabase ();
-
- MatchGuid = ScanGuid (PeiPcdDb->Init.GuidTable, sizeof(PeiPcdDb->Init.GuidTable), Guid);
-
- if (MatchGuid == NULL) {
- *TokenNumber = PCD_INVALID_TOKEN_NUMBER;
- return EFI_NOT_FOUND;
- }
-
- GuidTableIdx = MatchGuid - PeiPcdDb->Init.GuidTable;
-
- ExMapTable = PeiPcdDb->Init.ExMapTable;
-
- Found = FALSE;
- //
- // Locate the GUID in ExMapTable first.
- //
- for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {
- if (ExMapTable[i].ExGuidIndex == GuidTableIdx) {
- Found = TRUE;
- break;
- }
- }
-
- if (Found) {
- if (*TokenNumber == PCD_INVALID_TOKEN_NUMBER) {
- *TokenNumber = ExMapTable[i].ExTokenNumber;
- return EFI_SUCCESS;
- }
-
- for ( ; i < PEI_EXMAPPING_TABLE_SIZE; i++) {
- if (ExMapTable[i].ExTokenNumber == *TokenNumber) {
- i++;
- if (i == PEI_EXMAPPING_TABLE_SIZE) {
- //
- // Exceed the length of ExMap Table
- //
- *TokenNumber = PCD_INVALID_TOKEN_NUMBER;
- return EFI_SUCCESS;
- }
- if (ExMapTable[i].ExGuidIndex == GuidTableIdx) {
- *TokenNumber = ExMapTable[i].ExTokenNumber;
- return EFI_SUCCESS;
- } else {
- *TokenNumber = PCD_INVALID_TOKEN_NUMBER;
- return EFI_SUCCESS;
- }
- }
- }
- return EFI_NOT_FOUND;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdGetNextTokenSpace (
- IN OUT CONST EFI_GUID **Guid
- )
-{
- UINTN GuidTableIdx;
- EFI_GUID *MatchGuid;
- PEI_PCD_DATABASE *PeiPcdDb;
- DYNAMICEX_MAPPING *ExMapTable;
- UINTN i;
- BOOLEAN Found;
- BOOLEAN PeiExMapTableEmpty;
-
- if (!FeaturePcdGet (PcdPeiPcdDatabaseTraverseEnabled)) {
- return EFI_UNSUPPORTED;
- }
-
- ASSERT (Guid != NULL);
-
- PeiExMapTableEmpty = PEI_EXMAP_TABLE_EMPTY;
-
- if (PeiExMapTableEmpty) {
- if (*Guid != NULL) {
- return EFI_NOT_FOUND;
- } else {
- return EFI_SUCCESS;
- }
- }
-
- //
- // Assume PCD Database AutoGen tool is sorting the ExMap based on the following order
- // 1) ExGuid
- // 2) ExTokenNumber
- //
- PeiPcdDb = GetPcdDatabase ();
-
- ExMapTable = PeiPcdDb->Init.ExMapTable;
-
- if (*Guid == NULL) {
- //
- // return the first Token Space Guid.
- //
- *Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[0].ExGuidIndex];
- return EFI_SUCCESS;
- }
-
- MatchGuid = ScanGuid (PeiPcdDb->Init.GuidTable, sizeof(PeiPcdDb->Init.GuidTable), *Guid);
-
- if (MatchGuid == NULL) {
- return EFI_NOT_FOUND;
- }
-
- GuidTableIdx = MatchGuid - PeiPcdDb->Init.GuidTable;
-
- Found = FALSE;
- for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {
- if (ExMapTable[i].ExGuidIndex == GuidTableIdx) {
- Found = TRUE;
- break;
- }
- }
-
- if (Found) {
- i++;
- for ( ; i < PEI_EXMAPPING_TABLE_SIZE; i++ ) {
- if (ExMapTable[i].ExGuidIndex != GuidTableIdx ) {
- *Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[i].ExGuidIndex];
- return EFI_SUCCESS;
- }
- }
- *Guid = NULL;
- return EFI_SUCCESS;
- }
-
- return EFI_NOT_FOUND;
-
-}
-
-UINTN
-GetPtrTypeSize (
- IN UINTN LocalTokenNumberTableIdx,
- OUT UINTN *MaxSize,
- IN PEI_PCD_DATABASE *Database
- )
-{
- INTN SizeTableIdx;
- UINTN LocalTokenNumber;
- SKU_ID *SkuIdTable;
- SIZE_INFO *SizeTable;
- UINTN i;
-
- SizeTableIdx = GetSizeTableIndex (LocalTokenNumberTableIdx, Database);
-
- LocalTokenNumber = Database->Init.LocalTokenNumberTable[LocalTokenNumberTableIdx];
-
- ASSERT ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER);
-
- SizeTable = Database->Init.SizeTable;
-
- *MaxSize = SizeTable[SizeTableIdx];
- //
- // SizeTable only contain record for PCD_DATUM_TYPE_POINTER type
- // PCD entry.
- //
- if (LocalTokenNumber & PCD_TYPE_VPD) {
- //
- // We have only one entry for VPD enabled PCD entry:
- // 1) MAX Size.
- // We consider current size is equal to MAX size.
- //
- return *MaxSize;
- } else {
- if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
- //
- // We have only two entry for Non-Sku enabled PCD entry:
- // 1) MAX SIZE
- // 2) Current Size
- //
- return SizeTable[SizeTableIdx + 1];
- } else {
- //
- // We have these entry for SKU enabled PCD entry
- // 1) MAX SIZE
- // 2) Current Size for each SKU_ID (It is equal to MaxSku).
- //
- SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, Database);
- for (i = 0; i < SkuIdTable[0]; i++) {
- if (SkuIdTable[1 + i] == Database->Init.SystemSkuId) {
- return SizeTable[SizeTableIdx + 1 + i];
- }
- }
- return SizeTable[SizeTableIdx + 1];
- }
- }
-}
-
-
-
-BOOLEAN
-SetPtrTypeSize (
- IN UINTN LocalTokenNumberTableIdx,
- IN OUT UINTN *CurrentSize,
- IN PEI_PCD_DATABASE *Database
- )
-{
- INTN SizeTableIdx;
- UINTN LocalTokenNumber;
- SKU_ID *SkuIdTable;
- SIZE_INFO *SizeTable;
- UINTN i;
- UINTN MaxSize;
-
- SizeTableIdx = GetSizeTableIndex (LocalTokenNumberTableIdx, Database);
-
- LocalTokenNumber = Database->Init.LocalTokenNumberTable[LocalTokenNumberTableIdx];
-
- ASSERT ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER);
-
- SizeTable = Database->Init.SizeTable;
-
- MaxSize = SizeTable[SizeTableIdx];
- //
- // SizeTable only contain record for PCD_DATUM_TYPE_POINTER type
- // PCD entry.
- //
- if (LocalTokenNumber & PCD_TYPE_VPD) {
- //
- // We shouldn't come here as we don't support SET for VPD
- //
- ASSERT (FALSE);
- return FALSE;
- } else {
- if ((*CurrentSize > MaxSize) ||
- (*CurrentSize == MAX_ADDRESS)) {
- *CurrentSize = MaxSize;
- return FALSE;
- }
-
- if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
- //
- // We have only two entry for Non-Sku enabled PCD entry:
- // 1) MAX SIZE
- // 2) Current Size
- //
- SizeTable[SizeTableIdx + 1] = (SIZE_INFO) *CurrentSize;
- return TRUE;
- } else {
- //
- // We have these entry for SKU enabled PCD entry
- // 1) MAX SIZE
- // 2) Current Size for each SKU_ID (It is equal to MaxSku).
- //
- SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, Database);
- for (i = 0; i < SkuIdTable[0]; i++) {
- if (SkuIdTable[1 + i] == Database->Init.SystemSkuId) {
- SizeTable[SizeTableIdx + 1 + i] = (SIZE_INFO) *CurrentSize;
- return TRUE;
- }
- }
- SizeTable[SizeTableIdx + 1] = (SIZE_INFO) *CurrentSize;
- return TRUE;
- }
- }
-
-}
diff --git a/EdkModulePkg/Universal/PCD/Pei/Pcd.dxs b/EdkModulePkg/Universal/PCD/Pei/Pcd.dxs
deleted file mode 100644
index 3bad561..0000000
--- a/EdkModulePkg/Universal/PCD/Pei/Pcd.dxs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Pcd.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/PCD/Pei/Pcd.msa b/EdkModulePkg/Universal/PCD/Pei/Pcd.msa
deleted file mode 100644
index 155a576..0000000
--- a/EdkModulePkg/Universal/PCD/Pei/Pcd.msa
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>PcdPeim</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Pcd Database PEIM module</Abstract>
- <Description>This PEIM driver implement and produce PCD PPI.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>PcdPeim</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeimEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeiServicesLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeiServicesTablePointerLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Pcd.dxs</Filename>
- <Filename>Pcd.c</Filename>
- <Filename>Service.h</Filename>
- <Filename>Service.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Hobs>
- <HobTypes Usage="ALWAYS_PRODUCED" HobGuidCName="gPcdDataBaseHobGuid">
- <HobType>GUID_EXTENSION</HobType>
- </HobTypes>
- <HobTypes Usage="ALWAYS_PRODUCED" HobGuidCName="gPcdPeiCallbackFnTableHobGuid">
- <HobType>GUID_EXTENSION</HobType>
- </HobTypes>
- </Hobs>
- <PPIs>
- <Ppi Usage="ALWAYS_PRODUCED">
- <PpiCName>gPcdPpiGuid</PpiCName>
- </Ppi>
- <Ppi Usage="ALWAYS_CONSUMED">
- <PpiCName>gEfiPeiReadOnlyVariablePpiGuid</PpiCName>
- </Ppi>
- </PPIs>
- <Externs>
- <PcdIsDriver>PEI_PCD_DRIVER</PcdIsDriver>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>PcdPeimInit</ModuleEntryPoint>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdMaxPeiPcdCallBackNumberPerPcdEntry</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The maximum number of callback function, which will be triggered when
- a PCD entry is been set, can be registered for a single PCD entry in PEI phase.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdVpdBaseAddress</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The base address of the VPD (Vital Product Data) region. It is
- normally a region reserved on flash.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdPeiPcdDatabaseTraverseEnabled</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>This feature flag can be used to enable or disable the Pcd PEIM database
- traverse capability. Disable it can reduce the size of final image generated.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdPeiPcdDatabaseCallbackOnSetEnabled</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable the Callback On SET capability of PCD service PEIM. If a platform does not register any callback on set in PEI phase. This flag can be set to DISABLE to save size.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdPeiPcdDatabaseExEnabled</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable the PCD service PEIM to handle DynamicEX PCD. If a platform has no module to use DynamicEX in PEI phase. This flag can be set to DISABLE to save size.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdPeiPcdDatabaseGetSizeEnabled</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable the GET size capability of PCD service PEIM. If a platform does not do PCD get size operation in PEI phase. This flag can be set to DISABLE to save size.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">
- <C_Name>PcdPeiPcdDatabaseSetEnabled</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <DefaultValue>FALSE</DefaultValue>
- <HelpText>This feature flag can be used to enable or disable the SET capability of PCD service PEIM. If a platform does not do PCD SET operation in PEI phase. This flag can be set to DISABLE to save size.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/PCD/Pei/Service.c b/EdkModulePkg/Universal/PCD/Pei/Service.c
deleted file mode 100644
index e705c28..0000000
--- a/EdkModulePkg/Universal/PCD/Pei/Service.c
+++ /dev/null
@@ -1,728 +0,0 @@
-/** @file
-Private functions used by PCD PEIM.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name: Service.c
-
-**/
-#include "Service.h"
-
-/**
- The function registers the CallBackOnSet fucntion
- according to TokenNumber and EFI_GUID space.
-
- @param TokenNumber The token number.
- @param Guid The GUID space.
- @param CallBackFunction The Callback function to be registered.
- @param Register To register or unregister the callback function.
-
- @retval EFI_SUCCESS If the Callback function is registered.
- @retval EFI_NOT_FOUND If the PCD Entry is not found according to Token Number and GUID space.
- @retval EFI_OUT_OF_RESOURCES If the callback function can't be registered because there is not free
- slot left in the CallbackFnTable.
---*/
-EFI_STATUS
-PeiRegisterCallBackWorker (
- IN UINTN ExTokenNumber,
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN PCD_PPI_CALLBACK CallBackFunction,
- IN BOOLEAN Register
-)
-{
- EFI_HOB_GUID_TYPE *GuidHob;
- PCD_PPI_CALLBACK *CallbackTable;
- PCD_PPI_CALLBACK Compare;
- PCD_PPI_CALLBACK Assign;
- UINT32 LocalTokenNumber;
- UINTN TokenNumber;
- UINTN Idx;
-
- if (Guid == NULL) {
- TokenNumber = ExTokenNumber;
-
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
- ASSERT (TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1);
- } else {
- TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
-
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
- }
-
-
- LocalTokenNumber = GetPcdDatabase()->Init.LocalTokenNumberTable[TokenNumber];
-
- //
- // We don't support SET for HII and VPD type PCD entry in PEI phase.
- // So we will assert if any register callback for such PCD entry.
- //
- ASSERT ((LocalTokenNumber & PCD_TYPE_HII) == 0);
- ASSERT ((LocalTokenNumber & PCD_TYPE_VPD) == 0);
-
- GuidHob = GetFirstGuidHob (&gPcdPeiCallbackFnTableHobGuid);
- ASSERT (GuidHob != NULL);
-
- CallbackTable = GET_GUID_HOB_DATA (GuidHob);
- CallbackTable = CallbackTable + (TokenNumber * FixedPcdGet32(PcdMaxPeiPcdCallBackNumberPerPcdEntry));
-
- Compare = Register? NULL: CallBackFunction;
- Assign = Register? CallBackFunction: NULL;
-
-
- for (Idx = 0; Idx < FixedPcdGet32(PcdMaxPeiPcdCallBackNumberPerPcdEntry); Idx++) {
- if (CallbackTable[Idx] == Compare) {
- CallbackTable[Idx] = Assign;
- return EFI_SUCCESS;
- }
- }
-
- return Register? EFI_OUT_OF_RESOURCES : EFI_NOT_FOUND;
-
-}
-
-
-
-
-/**
- The function builds the PCD database.
-
- @param VOID
-
- @retval VOID
---*/
-VOID
-BuildPcdDatabase (
- VOID
- )
-{
- PEI_PCD_DATABASE *Database;
- VOID *CallbackFnTable;
- UINTN SizeOfCallbackFnTable;
-
- Database = BuildGuidHob (&gPcdDataBaseHobGuid, sizeof (PEI_PCD_DATABASE));
-
- ZeroMem (Database, sizeof (PEI_PCD_DATABASE));
-
- //
- // gPEIPcdDbInit is smaller than PEI_PCD_DATABASE
- //
-
- CopyMem (&Database->Init, &gPEIPcdDbInit, sizeof (gPEIPcdDbInit));
-
- SizeOfCallbackFnTable = PEI_LOCAL_TOKEN_NUMBER * sizeof (PCD_PPI_CALLBACK) * FixedPcdGet32(PcdMaxPeiPcdCallBackNumberPerPcdEntry);
-
- CallbackFnTable = BuildGuidHob (&gPcdPeiCallbackFnTableHobGuid, SizeOfCallbackFnTable);
-
- ZeroMem (CallbackFnTable, SizeOfCallbackFnTable);
-
- return;
-}
-
-
-
-/**
- The function is provided by PCD PEIM and PCD DXE driver to
- do the work of reading a HII variable from variable service.
-
- @param VariableGuid The Variable GUID.
- @param VariableName The Variable Name.
- @param VariableData The output data.
- @param VariableSize The size of the variable.
-
- @retval EFI_SUCCESS Operation successful.
- @retval EFI_NOT_FOUND Variablel not found.
---*/
-STATIC
-EFI_STATUS
-GetHiiVariable (
- IN CONST EFI_GUID *VariableGuid,
- IN UINT16 *VariableName,
- OUT VOID **VariableData,
- OUT UINTN *VariableSize
- )
-{
- UINTN Size;
- EFI_STATUS Status;
- VOID *Buffer;
- EFI_PEI_READ_ONLY_VARIABLE_PPI *VariablePpi;
-
- Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariablePpiGuid, 0, NULL, (VOID **) &VariablePpi);
- ASSERT_EFI_ERROR (Status);
-
- Size = 0;
- Status = VariablePpi->PeiGetVariable (
- GetPeiServicesTablePointer (),
- VariableName,
- (EFI_GUID *) VariableGuid,
- NULL,
- &Size,
- NULL
- );
- if (Status == EFI_BUFFER_TOO_SMALL) {
-
-
- Status = PeiServicesAllocatePool (Size, &Buffer);
- ASSERT_EFI_ERROR (Status);
-
- Status = VariablePpi->PeiGetVariable (
- GetPeiServicesTablePointer (),
- (UINT16 *) VariableName,
- (EFI_GUID *) VariableGuid,
- NULL,
- &Size,
- Buffer
- );
- ASSERT_EFI_ERROR (Status);
-
- *VariableSize = Size;
- *VariableData = Buffer;
-
- return EFI_SUCCESS;
- } else {
- return EFI_NOT_FOUND;
- }
-
-}
-
-STATIC
-UINT32
-GetSkuEnabledTokenNumber (
- UINT32 LocalTokenNumber,
- UINTN Size
- )
-{
- PEI_PCD_DATABASE *PeiPcdDb;
- SKU_HEAD *SkuHead;
- SKU_ID *SkuIdTable;
- INTN i;
- UINT8 *Value;
-
- PeiPcdDb = GetPcdDatabase ();
-
- ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0);
-
- SkuHead = (SKU_HEAD *) ((UINT8 *)PeiPcdDb + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));
- Value = (UINT8 *) ((UINT8 *)PeiPcdDb + (SkuHead->SkuDataStartOffset));
- SkuIdTable = (SKU_ID *) ((UINT8 *)PeiPcdDb + (SkuHead->SkuIdTableOffset));
-
- for (i = 0; i < SkuIdTable[0]; i++) {
- if (PeiPcdDb->Init.SystemSkuId == SkuIdTable[i + 1]) {
- break;
- }
- }
-
- switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
- case PCD_TYPE_VPD:
- Value = (UINT8 *) &(((VPD_HEAD *) Value)[i]);
- return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_VPD);
-
- case PCD_TYPE_HII:
- Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[i]);
- return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_HII);
-
- case PCD_TYPE_STRING:
- Value = (UINT8 *) &(((STRING_HEAD *) Value)[i]);
- return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_STRING);
-
- case PCD_TYPE_DATA:
- Value += Size * i;
- return (UINT32) (Value - (UINT8 *) PeiPcdDb);
-
- default:
- ASSERT (FALSE);
- }
-
- ASSERT (FALSE);
-
- return 0;
-
-}
-
-
-
-STATIC
-VOID
-InvokeCallbackOnSet (
- UINTN ExTokenNumber,
- CONST EFI_GUID *Guid, OPTIONAL
- UINTN TokenNumber,
- VOID *Data,
- UINTN Size
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
- PCD_PPI_CALLBACK *CallbackTable;
- UINTN Idx;
-
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
-
- if (Guid == NULL) {
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
- }
-
- GuidHob = GetFirstGuidHob (&gPcdPeiCallbackFnTableHobGuid);
- ASSERT (GuidHob != NULL);
-
- CallbackTable = GET_GUID_HOB_DATA (GuidHob);
-
- CallbackTable += (TokenNumber * FixedPcdGet32(PcdMaxPeiPcdCallBackNumberPerPcdEntry));
-
- for (Idx = 0; Idx < FixedPcdGet32(PcdMaxPeiPcdCallBackNumberPerPcdEntry); Idx++) {
- if (CallbackTable[Idx] != NULL) {
- CallbackTable[Idx] (Guid,
- (Guid == NULL)? TokenNumber: ExTokenNumber,
- Data,
- Size
- );
- }
- }
-
-}
-
-
-
-EFI_STATUS
-SetValueWorker (
- IN UINTN TokenNumber,
- IN VOID *Data,
- IN UINTN Size
- )
-{
- return SetWorker (TokenNumber, Data, &Size, FALSE);
-}
-
-
-
-EFI_STATUS
-SetWorker (
- IN UINTN TokenNumber,
- IN OUT VOID *Data,
- IN OUT UINTN *Size,
- IN BOOLEAN PtrType
- )
-{
- UINT32 LocalTokenNumber;
- PEI_PCD_DATABASE *PeiPcdDb;
- UINT16 StringTableIdx;
- UINTN Offset;
- VOID *InternalData;
- UINTN MaxSize;
-
- if (!FeaturePcdGet(PcdPeiPcdDatabaseSetEnabled)) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
-
- PeiPcdDb = GetPcdDatabase ();
-
- LocalTokenNumber = PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber];
-
- if (!PtrType) {
- ASSERT (PeiPcdGetSize(TokenNumber + 1) == *Size);
- }
-
- //
- // We only invoke the callback function for Dynamic Type PCD Entry.
- // For Dynamic EX PCD entry, we have invoked the callback function for Dynamic EX
- // type PCD entry in ExSetWorker.
- //
- if (TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1) {
- InvokeCallbackOnSet (0, NULL, TokenNumber + 1, Data, *Size);
- }
-
- if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
- if (PtrType) {
- MaxSize = GetPtrTypeSize (TokenNumber, &MaxSize, PeiPcdDb);
- } else {
- MaxSize = *Size;
- }
- LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, MaxSize);
- }
-
- Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
- InternalData = (VOID *) ((UINT8 *) PeiPcdDb + Offset);
-
- switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
- case PCD_TYPE_VPD:
- case PCD_TYPE_HII:
- {
- ASSERT (FALSE);
- return EFI_INVALID_PARAMETER;
- }
-
- case PCD_TYPE_STRING:
- if (SetPtrTypeSize (TokenNumber, Size, PeiPcdDb)) {
- StringTableIdx = *((UINT16 *)InternalData);
- CopyMem (&PeiPcdDb->Init.StringTable[StringTableIdx], Data, *Size);
- return EFI_SUCCESS;
- } else {
- return EFI_INVALID_PARAMETER;
- }
-
- case PCD_TYPE_DATA:
- {
- if (PtrType) {
- if (SetPtrTypeSize (TokenNumber, Size, PeiPcdDb)) {
- CopyMem (InternalData, Data, *Size);
- return EFI_SUCCESS;
- } else {
- return EFI_INVALID_PARAMETER;
- }
- }
-
- switch (*Size) {
- case sizeof(UINT8):
- *((UINT8 *) InternalData) = *((UINT8 *) Data);
- return EFI_SUCCESS;
-
- case sizeof(UINT16):
- *((UINT16 *) InternalData) = *((UINT16 *) Data);
- return EFI_SUCCESS;
-
- case sizeof(UINT32):
- *((UINT32 *) InternalData) = *((UINT32 *) Data);
- return EFI_SUCCESS;
-
- case sizeof(UINT64):
- *((UINT64 *) InternalData) = *((UINT64 *) Data);
- return EFI_SUCCESS;
-
- default:
- ASSERT (FALSE);
- return EFI_NOT_FOUND;
- }
- }
-
- }
-
- ASSERT (FALSE);
- return EFI_NOT_FOUND;
-
-}
-
-
-
-EFI_STATUS
-ExSetValueWorker (
- IN UINTN ExTokenNumber,
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN UINTN Size
- )
-{
- return ExSetWorker (ExTokenNumber, Guid, Data, &Size, FALSE);
-}
-
-
-
-EFI_STATUS
-ExSetWorker (
- IN UINTN ExTokenNumber,
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN OUT UINTN *Size,
- IN BOOLEAN PtrType
- )
-{
- UINTN TokenNumber;
-
- if (!FeaturePcdGet(PcdPeiPcdDatabaseSetEnabled)) {
- return EFI_UNSUPPORTED;
- }
-
- TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
-
- InvokeCallbackOnSet (ExTokenNumber, Guid, TokenNumber, Data, *Size);
-
- return SetWorker (TokenNumber, Data, Size, PtrType);
-
-}
-
-
-
-
-VOID *
-ExGetWorker (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINTN GetSize
- )
-{
- if (!FeaturePcdGet (PcdPeiPcdDatabaseExEnabled)) {
- ASSERT (FALSE);
- return 0;
- }
-
- return GetWorker (GetExPcdTokenNumber (Guid, ExTokenNumber), GetSize);
-}
-
-
-
-
-VOID *
-GetWorker (
- UINTN TokenNumber,
- UINTN GetSize
- )
-{
- UINT32 Offset;
- EFI_GUID *Guid;
- UINT16 *Name;
- VARIABLE_HEAD *VariableHead;
- EFI_STATUS Status;
- UINTN DataSize;
- VOID *Data;
- UINT16 *StringTable;
- UINT16 StringTableIdx;
- PEI_PCD_DATABASE *PeiPcdDb;
- UINT32 LocalTokenNumber;
- UINTN MaxSize;
-
- //
- // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
- // We have to decrement TokenNumber by 1 to make it usable
- // as the array index.
- //
- TokenNumber--;
-
- // EBC compiler is very choosy. It may report warning about comparison
- // between UINTN and 0 . So we add 1 in each size of the
- // comparison.
- ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
-
- ASSERT ((GetSize == PeiPcdGetSize(TokenNumber + 1)) || (GetSize == 0));
-
- PeiPcdDb = GetPcdDatabase ();
-
- LocalTokenNumber = PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber];
-
- if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
- if (GetSize == 0) {
- MaxSize = GetPtrTypeSize (TokenNumber, &MaxSize, PeiPcdDb);
- } else {
- MaxSize = GetSize;
- }
- LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, MaxSize);
- }
-
- Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
- StringTable = PeiPcdDb->Init.StringTable;
-
- switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
- case PCD_TYPE_VPD:
- {
- VPD_HEAD *VpdHead;
- VpdHead = (VPD_HEAD *) ((UINT8 *)PeiPcdDb + Offset);
- return (VOID *) (UINTN) (FixedPcdGet32(PcdVpdBaseAddress) + VpdHead->Offset);
- }
-
- case PCD_TYPE_HII:
- {
- VariableHead = (VARIABLE_HEAD *) ((UINT8 *)PeiPcdDb + Offset);
-
- Guid = &(PeiPcdDb->Init.GuidTable[VariableHead->GuidTableIndex]);
- Name = &StringTable[VariableHead->StringIndex];
-
- Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
-
- if (Status == EFI_SUCCESS) {
- return (VOID *) ((UINT8 *) Data + VariableHead->Offset);
- } else {
- //
- // Return the default value specified by Platform Integrator
- //
- return (VOID *) ((UINT8 *) PeiPcdDb + VariableHead->DefaultValueOffset);
- }
- }
-
- case PCD_TYPE_DATA:
- return (VOID *) ((UINT8 *)PeiPcdDb + Offset);
-
- case PCD_TYPE_STRING:
- StringTableIdx = (UINT16) *((UINT8 *) PeiPcdDb + Offset);
- return (VOID *) (&StringTable[StringTableIdx]);
-
- default:
- ASSERT (FALSE);
- break;
-
- }
-
- ASSERT (FALSE);
-
- return NULL;
-
-}
-
-
-
-UINTN
-GetExPcdTokenNumber (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-{
- UINT32 i;
- DYNAMICEX_MAPPING *ExMap;
- EFI_GUID *GuidTable;
- EFI_GUID *MatchGuid;
- UINTN MatchGuidIdx;
- PEI_PCD_DATABASE *PeiPcdDb;
-
- PeiPcdDb = GetPcdDatabase();
-
- ExMap = PeiPcdDb->Init.ExMapTable;
- GuidTable = PeiPcdDb->Init.GuidTable;
-
- MatchGuid = ScanGuid (GuidTable, sizeof(PeiPcdDb->Init.GuidTable), Guid);
- //
- // We need to ASSERT here. If GUID can't be found in GuidTable, this is a
- // error in the BUILD system.
- //
- ASSERT (MatchGuid != NULL);
-
- MatchGuidIdx = MatchGuid - GuidTable;
-
- for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {
- if ((ExTokenNumber == ExMap[i].ExTokenNumber) &&
- (MatchGuidIdx == ExMap[i].ExGuidIndex)) {
- return ExMap[i].LocalTokenNumber;
- }
- }
-
- ASSERT (FALSE);
-
- return 0;
-}
-
-
-
-PEI_PCD_DATABASE *
-GetPcdDatabase (
- VOID
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);
- ASSERT (GuidHob != NULL);
-
- return (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob);
-}
-
-
-
-SKU_ID *
-GetSkuIdArray (
- IN UINTN LocalTokenNumberTableIdx,
- IN PEI_PCD_DATABASE *Database
- )
-{
- SKU_HEAD *SkuHead;
- UINTN LocalTokenNumber;
-
- LocalTokenNumber = Database->Init.LocalTokenNumberTable[LocalTokenNumberTableIdx];
-
- ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) != 0);
-
- SkuHead = (SKU_HEAD *) ((UINT8 *)Database + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));
-
- return (SKU_ID *) ((UINT8 *)Database + SkuHead->SkuIdTableOffset);
-
-}
-
-
-
-UINTN
-GetSizeTableIndex (
- IN UINTN LocalTokenNumberTableIdx,
- IN PEI_PCD_DATABASE *Database
- )
-{
- UINTN i;
- UINTN SizeTableIdx;
- UINTN LocalTokenNumber;
- SKU_ID *SkuIdTable;
-
- SizeTableIdx = 0;
-
- for (i=0; i<LocalTokenNumberTableIdx; i++) {
- LocalTokenNumber = Database->Init.LocalTokenNumberTable[i];
-
- if ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER) {
- //
- // SizeTable only contain record for PCD_DATUM_TYPE_POINTER type
- // PCD entry.
- //
- if (LocalTokenNumber & PCD_TYPE_VPD) {
- //
- // We have only one entry for VPD enabled PCD entry:
- // 1) MAX Size.
- // We consider current size is equal to MAX size.
- //
- SizeTableIdx++;
- } else {
- if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
- //
- // We have only two entry for Non-Sku enabled PCD entry:
- // 1) MAX SIZE
- // 2) Current Size
- //
- SizeTableIdx += 2;
- } else {
- //
- // We have these entry for SKU enabled PCD entry
- // 1) MAX SIZE
- // 2) Current Size for each SKU_ID (It is equal to MaxSku).
- //
- SkuIdTable = GetSkuIdArray (i, Database);
- SizeTableIdx += (UINTN)*SkuIdTable + 1;
- }
- }
- }
-
- }
-
- return SizeTableIdx;
-}
diff --git a/EdkModulePkg/Universal/PCD/Pei/Service.h b/EdkModulePkg/Universal/PCD/Pei/Service.h
deleted file mode 100644
index 093c371..0000000
--- a/EdkModulePkg/Universal/PCD/Pei/Service.h
+++ /dev/null
@@ -1,457 +0,0 @@
-/** @file
-Private functions used by PCD PEIM.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-
-Module Name: Service.h
-
-**/
-
-#ifndef _SERVICE_H
-#define _SERVICE_H
-
-//
-// Please make sure the PCD Serivce PEIM Version is consistent with
-// the version of PCD Database generation tool
-//
-#define PCD_SERVICE_PEIM_VERSION 2
-
-//
-// PCD_PEI_DATABASE_GENTOOL_VERSION is defined in Autogen.h
-// and generated by PCD Database generation tool.
-//
-#if (PCD_SERVICE_PEIM_VERSION != PCD_PEI_SERVICE_DRIVER_AUTOGEN_VERSION )
- #error "Please make sure the version of PCD Service PEIM and PCD PEI Database Generation Tool matches"
-#endif
-
-//
-// PPI Interface Implementation Declaration.
-//
-VOID
-EFIAPI
-PeiPcdSetSku (
- IN UINTN SkuId
- )
-;
-
-
-UINT8
-EFIAPI
-PeiPcdGet8 (
- IN UINTN TokenNumber
- )
-;
-
-
-UINT16
-EFIAPI
-PeiPcdGet16 (
- IN UINTN TokenNumber
- )
-;
-
-
-UINT32
-EFIAPI
-PeiPcdGet32 (
- IN UINTN TokenNumber
- )
-;
-
-
-UINT64
-EFIAPI
-PeiPcdGet64 (
- IN UINTN TokenNumber
- )
-;
-
-
-VOID *
-EFIAPI
-PeiPcdGetPtr (
- IN UINTN TokenNumber
- )
-;
-
-
-BOOLEAN
-EFIAPI
-PeiPcdGetBool (
- IN UINTN TokenNumber
- )
-;
-
-
-UINTN
-EFIAPI
-PeiPcdGetSize (
- IN UINTN TokenNumber
- )
-;
-
-
-UINT8
-EFIAPI
-PeiPcdGet8Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-UINT16
-EFIAPI
-PeiPcdGet16Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-UINT32
-EFIAPI
-PeiPcdGet32Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-UINT64
-EFIAPI
-PeiPcdGet64Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-VOID *
-EFIAPI
-PeiPcdGetPtrEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-BOOLEAN
-EFIAPI
-PeiPcdGetBoolEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-UINTN
-EFIAPI
-PeiPcdGetSizeEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet8 (
- IN UINTN TokenNumber,
- IN UINT8 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet16 (
- IN UINTN TokenNumber,
- IN UINT16 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet32 (
- IN UINTN TokenNumber,
- IN UINT32 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet64 (
- IN UINTN TokenNumber,
- IN UINT64 Value
- )
-;
-
-EFI_STATUS
-EFIAPI
-PeiPcdSetPtr (
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN VOID *Buffer
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSetBool (
- IN UINTN TokenNumber,
- IN BOOLEAN Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet8Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT8 Value
- )
-;
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet16Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT16 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet32Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT32 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSet64Ex (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN UINT64 Value
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSetPtrEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN OUT UINTN *SizeOfBuffer,
- IN VOID *Buffer
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdSetBoolEx (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN BOOLEAN Value
- )
-;
-
-
-
-EFI_STATUS
-EFIAPI
-PeiRegisterCallBackOnSet (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN UINTN TokenNumber,
- IN PCD_PPI_CALLBACK CallBackFunction
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PcdUnRegisterCallBackOnSet (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN UINTN TokenNumber,
- IN PCD_PPI_CALLBACK CallBackFunction
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdGetNextToken (
- IN CONST EFI_GUID *Guid, OPTIONAL
- IN OUT UINTN *TokenNumber
- )
-;
-
-
-EFI_STATUS
-EFIAPI
-PeiPcdGetNextTokenSpace (
- IN CONST EFI_GUID **Guid
- )
-;
-
-
-/* Internal Function definitions */
-
-PEI_PCD_DATABASE *
-GetPcdDatabase (
- VOID
- )
-;
-
-
-EFI_STATUS
-SetValueWorker (
- IN UINTN TokenNumber,
- IN VOID *Data,
- IN UINTN Size
- )
-;
-
-
-EFI_STATUS
-SetWorker (
- IN UINTN TokenNumber,
- IN VOID *Data,
- IN OUT UINTN *Size,
- IN BOOLEAN PtrType
- )
-;
-
-
-EFI_STATUS
-ExSetValueWorker (
- IN UINTN ExTokenNumber,
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN UINTN Size
- )
-;
-
-
-
-EFI_STATUS
-ExSetWorker (
- IN UINTN ExTokenNumber,
- IN CONST EFI_GUID *Guid,
- IN VOID *Data,
- IN OUT UINTN *Size,
- IN BOOLEAN PtrType
- )
-;
-
-
-
-VOID *
-GetWorker (
- IN UINTN TokenNumber,
- IN UINTN GetSize
- )
-;
-
-
-
-VOID *
-ExGetWorker (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber,
- IN UINTN GetSize
- )
-;
-
-typedef struct {
- UINTN TokenNumber;
- UINTN Size;
- UINT32 LocalTokenNumberAlias;
-} EX_PCD_ENTRY_ATTRIBUTE;
-
-
-UINTN
-GetExPcdTokenNumber (
- IN CONST EFI_GUID *Guid,
- IN UINTN ExTokenNumber
- )
-;
-
-
-
-
-EFI_STATUS
-PeiRegisterCallBackWorker (
- IN UINTN TokenNumber,
- IN CONST GUID *Guid, OPTIONAL
- IN PCD_PPI_CALLBACK CallBackFunction,
- IN BOOLEAN Register
-);
-
-
-
-
-VOID
-BuildPcdDatabase (
- VOID
- )
-;
-
-SKU_ID *
-GetSkuIdArray (
- IN UINTN LocalTokenNumberTableIdx,
- IN PEI_PCD_DATABASE *Database
- )
-;
-
-UINTN
-GetSizeTableIndex (
- IN UINTN LocalTokenNumberTableIdx,
- IN PEI_PCD_DATABASE *Database
- )
-;
-
-UINTN
-GetPtrTypeSize (
- IN UINTN LocalTokenNumberTableIdx,
- OUT UINTN *MaxSize,
- IN PEI_PCD_DATABASE *Database
- )
-;
-
-
-
-BOOLEAN
-SetPtrTypeSize (
- IN UINTN LocalTokenNumberTableIdx,
- IN OUT UINTN *CurrentSize,
- IN PEI_PCD_DATABASE *Database
- )
-;
-
-
-extern EFI_GUID gPcdDataBaseHobGuid;
-
-extern EFI_GUID gPcdPeiCallbackFnTableHobGuid;
-
-extern PEI_PCD_DATABASE_INIT gPEIPcdDbInit;
-
-#endif
diff --git a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Crc32.c b/EdkModulePkg/Universal/Runtime/RuntimeDxe/Crc32.c
deleted file mode 100644
index dc22fa0..0000000
--- a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Crc32.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Crc32.c
-
-Abstract:
-
- CalculateCrc32 Boot Services as defined in DXE CIS.
-
- This Boot Services is in the Runtime Driver because this service is
- also required by SetVirtualAddressMap() when the EFI System Table and
- EFI Runtime Services Table are converted from physical address to
- virtual addresses. This requires that the 32-bit CRC be recomputed.
-
-Revision History:
-
---*/
-
-#include "Runtime.h"
-
-UINT32 mCrcTable[256];
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverCalculateCrc32 (
- IN VOID *Data,
- IN UINTN DataSize,
- OUT UINT32 *CrcOut
- )
-/*++
-
-Routine Description:
-
- Calculate CRC32 for target data
-
-Arguments:
-
- Data - The target data.
- DataSize - The target data size.
- CrcOut - The CRC32 for target data.
-
-Returns:
-
- EFI_SUCCESS - The CRC32 for target data is calculated successfully.
- EFI_INVALID_PARAMETER - Some parameter is not valid, so the CRC32 is not
- calculated.
-
---*/
-{
- UINT32 Crc;
- UINTN Index;
- UINT8 *Ptr;
-
- if (Data == NULL || DataSize == 0 || CrcOut == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Crc = 0xffffffff;
- for (Index = 0, Ptr = Data; Index < DataSize; Index++, Ptr++) {
- Crc = (Crc >> 8) ^ mCrcTable[(UINT8) Crc ^ *Ptr];
- }
-
- *CrcOut = Crc ^ 0xffffffff;
- return EFI_SUCCESS;
-}
-
-STATIC
-UINT32
-ReverseBits (
- UINT32 Value
- )
-/*++
-
-Routine Description:
-
- Reverse bits for 32bit data.
-
-Arguments:
-
- Value - the data to be reversed.
-
-Returns:
-
- UINT32 data reversed.
-
---*/
-{
- UINTN Index;
- UINT32 NewValue;
-
- NewValue = 0;
- for (Index = 0; Index < 32; Index++) {
- if (Value & (1 << Index)) {
- NewValue = NewValue | (1 << (31 - Index));
- }
- }
-
- return NewValue;
-}
-
-VOID
-RuntimeDriverInitializeCrc32Table (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initialize CRC32 table.
-
-Arguments:
-
- None.
-
-Returns:
-
- None.
-
---*/
-{
- UINTN TableEntry;
- UINTN Index;
- UINT32 Value;
-
- for (TableEntry = 0; TableEntry < 256; TableEntry++) {
- Value = ReverseBits ((UINT32) TableEntry);
- for (Index = 0; Index < 8; Index++) {
- if (Value & 0x80000000) {
- Value = (Value << 1) ^ 0x04c11db7;
- } else {
- Value = Value << 1;
- }
- }
-
- mCrcTable[TableEntry] = ReverseBits (Value);
- }
-}
diff --git a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.c b/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.c
deleted file mode 100644
index f8c4cb0..0000000
--- a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Runtime.c
-
-Abstract:
-
- Runtime Architectural Protocol as defined in the DXE CIS
-
- This code is used to produce the EFI runtime virtual switch over
-
- THIS IS VERY DANGEROUS CODE BE VERY CAREFUL IF YOU CHANGE IT
-
- The transition for calling EFI Runtime functions in physical mode to calling
- them in virtual mode is very very complex. Every pointer in needs to be
- converted from physical mode to virtual mode. Be very careful walking linked
- lists! Then to make it really hard the code it's self needs be relocated into
- the new virtual address space.
-
- So here is the concept. The code in this module will never ever be called in
- virtual mode. This is the code that collects the information needed to convert
- to virtual mode (DXE core registers runtime stuff with this code). Since this
- code is used to fixup all runtime images, it CAN NOT fix it's self up. So some
- code has to stay behind and that is us.
-
- Also you need to be careful about when you allocate memory, as once we are in
- runtime (including our EVT_SIGNAL_EXIT_BOOT_SERVICES event) you can no longer
- allocate memory.
-
- Any runtime driver that gets loaded before us will not be callable in virtual
- mode. This is due to the fact that the DXE core can not register the info
- needed with us. This is good, since it keeps the code in this file from
- getting registered.
-
-
-Revision History:
-
- - Move the CalculateCrc32 function from Runtime Arch Protocol to Boot Service.
- Runtime Arch Protocol definition no longer contains CalculateCrc32. Boot Service
- Table now contains an item named CalculateCrc32.
-
---*/
-
-
-#include "Runtime.h"
-
-//
-// Global Variables
-//
-EFI_MEMORY_DESCRIPTOR *mVirtualMap = NULL;
-UINTN mVirtualMapDescriptorSize;
-UINTN mVirtualMapMaxIndex;
-VOID *mMyImageBase;
-
-//
-// The handle onto which the Runtime Architectural Protocol instance is installed
-//
-EFI_HANDLE mRuntimeHandle = NULL;
-
-//
-// The Runtime Architectural Protocol instance produced by this driver
-//
-EFI_RUNTIME_ARCH_PROTOCOL mRuntime = {
- INITIALIZE_LIST_HEAD_VARIABLE (mRuntime.ImageHead),
- INITIALIZE_LIST_HEAD_VARIABLE (mRuntime.EventHead),
-
- //
- // Make sure Size != sizeof (EFI_MEMORY_DESCRIPTOR). This will
- // prevent people from having pointer math bugs in their code.
- // now you have to use *DescriptorSize to make things work.
- //
- sizeof (EFI_MEMORY_DESCRIPTOR) + sizeof (UINT64) - (sizeof (EFI_MEMORY_DESCRIPTOR) % sizeof (UINT64)),
- EFI_MEMORY_DESCRIPTOR_VERSION,
- 0,
- NULL,
- NULL,
- FALSE,
- FALSE
-};
-
-//
-// Worker Functions
-//
-STATIC
-VOID
-RuntimeDriverCalculateEfiHdrCrc (
- IN OUT EFI_TABLE_HEADER *Hdr
- )
-/*++
-
-Routine Description:
-
- Calcualte the 32-bit CRC in a EFI table using the Runtime Drivers
- internal function. The EFI Boot Services Table can not be used because
- the EFI Boot Services Table was destroyed at ExitBootServices()
-
-Arguments:
-
- Hdr - Pointer to an EFI standard header
-
-Returns:
-
- None
-
---*/
-{
- UINT32 Crc;
-
- Hdr->CRC32 = 0;
-
- Crc = 0;
- RuntimeDriverCalculateCrc32 ((UINT8 *) Hdr, Hdr->HeaderSize, &Crc);
- Hdr->CRC32 = Crc;
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverConvertPointer (
- IN UINTN DebugDisposition,
- IN OUT VOID **ConvertAddress
- )
-/*++
-
-Routine Description:
-
- Determines the new virtual address that is to be used on subsequent memory accesses.
-
-Arguments:
-
- DebugDisposition - Supplies type information for the pointer being converted.
- ConvertAddress - A pointer to a pointer that is to be fixed to be the value needed
- for the new virtual address mappings being applied.
-
-Returns:
-
- EFI_SUCCESS - The pointer pointed to by Address was modified.
- EFI_NOT_FOUND - The pointer pointed to by Address was not found to be part
- of the current memory map. This is normally fatal.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
-
---*/
-{
- UINTN Address;
- VOID *PlabelConvertAddress;
- UINT64 VirtEndOfRange;
- EFI_MEMORY_DESCRIPTOR *VirtEntry;
- UINTN Index;
-
- //
- // Make sure ConvertAddress is a valid pointer
- //
- if (ConvertAddress == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Get the address to convert
- //
- Address = (UINTN) *ConvertAddress;
-
- //
- // If this is a null pointer, return if it's allowed
- //
- if (Address == 0) {
- if (DebugDisposition & EFI_OPTIONAL_POINTER) {
- return EFI_SUCCESS;
- }
-
- return EFI_INVALID_PARAMETER;
- }
-
- PlabelConvertAddress = NULL;
- VirtEntry = mVirtualMap;
- for (Index = 0; Index < mVirtualMapMaxIndex; Index++) {
- //
- // To prevent the inclusion of 64-bit math functions a UINTN was placed in
- // front of VirtEntry->NumberOfPages to cast it to a 32-bit thing on IA-32
- // platforms. If you get this ASSERT remove the UINTN and do a 64-bit
- // multiply.
- //
- ASSERT (((UINTN) VirtEntry->NumberOfPages < 0xffffffff) || (sizeof (UINTN) > 4));
-
- if ((VirtEntry->Attribute & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) {
- if (Address >= VirtEntry->PhysicalStart) {
- VirtEndOfRange = VirtEntry->PhysicalStart + (((UINTN) VirtEntry->NumberOfPages) * EFI_PAGE_SIZE);
- if (Address < VirtEndOfRange) {
- //
- // Compute new address
- //
- *ConvertAddress = (VOID *) (Address - (UINTN) VirtEntry->PhysicalStart + (UINTN) VirtEntry->VirtualStart);
- return EFI_SUCCESS;
- } else if (Address < (VirtEndOfRange + 0x200000)) {
- //
- // On Itanium GP defines a window +/- 2 MB inside an image.
- // The compiler may asign a GP value outside of the image. Thus
- // it could fall out side of any of our valid regions
- //
- PlabelConvertAddress = (VOID *) (Address - (UINTN) VirtEntry->PhysicalStart + (UINTN) VirtEntry->VirtualStart);
- }
- }
- }
-
- VirtEntry = NextMemoryDescriptor (VirtEntry, mVirtualMapDescriptorSize);
- }
-
- if (DebugDisposition & EFI_IPF_GP_POINTER) {
- //
- // If it's an IPF GP and the GP was outside the image handle that case.
- //
- if (PlabelConvertAddress != NULL) {
- *ConvertAddress = PlabelConvertAddress;
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-STATIC
-EFI_STATUS
-RuntimeDriverConvertInternalPointer (
- IN OUT VOID **ConvertAddress
- )
-/*++
-
-Routine Description:
-
- Determines the new virtual address that is to be used on subsequent memory accesses
- for internal pointers.
-
-Arguments:
-
- ConvertAddress - A pointer to a pointer that is to be fixed to be the value needed
- for the new virtual address mappings being applied.
-
-Returns:
-
- EFI_SUCCESS - The pointer pointed to by Address was modified.
- EFI_NOT_FOUND - The pointer pointed to by Address was not found to be part
- of the current memory map. This is normally fatal.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
-
---*/
-{
- return RuntimeDriverConvertPointer (0x0, ConvertAddress);
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverSetVirtualAddressMap (
- IN UINTN MemoryMapSize,
- IN UINTN DescriptorSize,
- IN UINT32 DescriptorVersion,
- IN EFI_MEMORY_DESCRIPTOR *VirtualMap
- )
-/*++
-
-Routine Description:
-
- Changes the runtime addressing mode of EFI firmware from physical to virtual.
-
-Arguments:
-
- MemoryMapSize - The size in bytes of VirtualMap.
- DescriptorSize - The size in bytes of an entry in the VirtualMap.
- DescriptorVersion - The version of the structure entries in VirtualMap.
- VirtualMap - An array of memory descriptors which contain new virtual
- address mapping information for all runtime ranges.
-
-Returns:
-
- EFI_SUCCESS - The virtual address map has been applied.
- EFI_UNSUPPORTED - EFI firmware is not at runtime, or the EFI firmware is already in
- virtual address mapped mode.
- EFI_INVALID_PARAMETER - DescriptorSize or DescriptorVersion is invalid.
- EFI_NO_MAPPING - A virtual address was not supplied for a range in the memory
- map that requires a mapping.
- EFI_NOT_FOUND - A virtual address was supplied for an address that is not found
- in the memory map.
-
---*/
-{
- EFI_STATUS Status;
- EFI_RUNTIME_EVENT_ENTRY *RuntimeEvent;
- EFI_RUNTIME_IMAGE_ENTRY *RuntimeImage;
- LIST_ENTRY *Link;
- UINTN Index;
- UINTN Index1;
- EFI_DRIVER_OS_HANDOFF_HEADER *DriverOsHandoffHeader;
- EFI_DRIVER_OS_HANDOFF *DriverOsHandoff;
- EFI_PHYSICAL_ADDRESS VirtImageBase;
- EFI_CAPSULE_TABLE *CapsuleTable;
-
- //
- // Can only switch to virtual addresses once the memory map is locked down,
- // and can only set it once
- //
- if (!mRuntime.AtRuntime || mRuntime.VirtualMode) {
- return EFI_UNSUPPORTED;
- }
- //
- // Only understand the original descriptor format
- //
- if (DescriptorVersion != EFI_MEMORY_DESCRIPTOR_VERSION || DescriptorSize < sizeof (EFI_MEMORY_DESCRIPTOR)) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // We are now committed to go to virtual mode, so lets get to it!
- //
- mRuntime.VirtualMode = TRUE;
-
- //
- // ConvertPointer() needs this mVirtualMap to do the conversion. So set up
- // globals we need to parse the virtual address map.
- //
- mVirtualMapDescriptorSize = DescriptorSize;
- mVirtualMapMaxIndex = MemoryMapSize / DescriptorSize;
- mVirtualMap = VirtualMap;
-
- //
- // Currently the bug in StatusCode/RuntimeLib has been fixed, it will
- // check whether in Runtime or not (this is judged by looking at
- // mEfiAtRuntime global So this ReportStatusCode will work
- //
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP)
- );
-
- //
- // Signal all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE events.
- // All runtime events are stored in a list in Runtime AP.
- //
- for (Link = mRuntime.EventHead.ForwardLink; Link != &mRuntime.EventHead; Link = Link->ForwardLink) {
- RuntimeEvent = _CR (Link, EFI_RUNTIME_EVENT_ENTRY, Link);
- if ((RuntimeEvent->Type & EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {
- RuntimeEvent->NotifyFunction (
- RuntimeEvent->Event,
- RuntimeEvent->NotifyContext
- );
- }
- }
-
- //
- // Relocate runtime images. All runtime images are stored in a list in Runtime AP.
- //
- for (Link = mRuntime.ImageHead.ForwardLink; Link != &mRuntime.ImageHead; Link = Link->ForwardLink) {
- RuntimeImage = _CR (Link, EFI_RUNTIME_IMAGE_ENTRY, Link);
- //
- // We don't want to relocate our selves, as we only run in physical mode.
- //
- if (mMyImageBase != RuntimeImage->ImageBase) {
-
- VirtImageBase = (EFI_PHYSICAL_ADDRESS) (UINTN) RuntimeImage->ImageBase;
- Status = RuntimeDriverConvertPointer (0, (VOID **) &VirtImageBase);
- ASSERT_EFI_ERROR (Status);
-
- PeCoffLoaderRelocateImageForRuntime (
- (EFI_PHYSICAL_ADDRESS) (UINTN) RuntimeImage->ImageBase,
- VirtImageBase,
- (UINTN) RuntimeImage->ImageSize,
- RuntimeImage->RelocationData
- );
-
- InvalidateInstructionCacheRange (RuntimeImage->ImageBase, (UINTN)RuntimeImage->ImageSize);
- }
- }
-
- //
- // Convert all the Runtime Services except ConvertPointer() and SetVirtualAddressMap()
- // and recompute the CRC-32
- //
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetTime);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetTime);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetWakeupTime);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetWakeupTime);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->ResetSystem);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetNextHighMonotonicCount);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetVariable);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetVariable);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetNextVariableName);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->QueryVariableInfo);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->UpdateCapsule);
- RuntimeDriverConvertInternalPointer ((VOID **) &gRT->QueryCapsuleCapabilities);
- RuntimeDriverCalculateEfiHdrCrc (&gRT->Hdr);
-
- //
- // Convert the UGA OS Handoff Table if it is present in the Configuration Table
- //
- for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
- if (CompareGuid (&gEfiUgaIoProtocolGuid, &(gST->ConfigurationTable[Index].VendorGuid))) {
- DriverOsHandoffHeader = gST->ConfigurationTable[Index].VendorTable;
- for (Index1 = 0; Index1 < DriverOsHandoffHeader->NumberOfEntries; Index1++) {
- DriverOsHandoff = (EFI_DRIVER_OS_HANDOFF *)
- (
- (UINTN) DriverOsHandoffHeader +
- DriverOsHandoffHeader->HeaderSize +
- Index1 *
- DriverOsHandoffHeader->SizeOfEntries
- );
- RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &DriverOsHandoff->DevicePath);
- RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &DriverOsHandoff->PciRomImage);
- }
-
- RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &(gST->ConfigurationTable[Index].VendorTable));
- }
-
- if (CompareGuid (&gEfiCapsuleGuid, &(gST->ConfigurationTable[Index].VendorGuid))) {
- CapsuleTable = gST->ConfigurationTable[Index].VendorTable;
- for (Index1 = 0; Index1 < CapsuleTable->CapsuleArrayNumber; Index1++) {
- RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &CapsuleTable->CapsulePtr[Index1]);
- }
- RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &(gST->ConfigurationTable[Index].VendorTable));
- }
- }
- //
- // Convert the runtime fields of the EFI System Table and recompute the CRC-32
- //
- RuntimeDriverConvertInternalPointer ((VOID **) &gST->FirmwareVendor);
- RuntimeDriverConvertInternalPointer ((VOID **) &gST->ConfigurationTable);
- RuntimeDriverConvertInternalPointer ((VOID **) &gST->RuntimeServices);
- RuntimeDriverCalculateEfiHdrCrc (&gST->Hdr);
-
- //
- // At this point, gRT and gST are physical pointers, but the contents of these tables
- // have been converted to runtime.
- //
- //
- // mVirtualMap is only valid during SetVirtualAddressMap() call
- //
- mVirtualMap = NULL;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Install Runtime AP. This code includes the EfiDriverLib, but it functions at
- RT in physical mode. The only Lib services are gBS, gRT, and the DEBUG and
- ASSERT macros (they do ReportStatusCode).
-
-Arguments:
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-Returns:
-
- EFI_SUCEESS - Runtime Driver Architectural Protocol Installed
-
- Other - Return value from gBS->InstallMultipleProtocolInterfaces
-
---*/
-{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *MyLoadedImage;
-
- //
- // This image needs to be exclued from relocation for virtual mode, so cache
- // a copy of the Loaded Image protocol to test later.
- //
- Status = gBS->HandleProtocol (
- ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID**)&MyLoadedImage
- );
- ASSERT_EFI_ERROR (Status);
- mMyImageBase = MyLoadedImage->ImageBase;
-
- //
- // Initialize the table used to compute 32-bit CRCs
- //
- RuntimeDriverInitializeCrc32Table ();
-
- //
- // Fill in the entries of the EFI Boot Services and EFI Runtime Services Tables
- //
- gBS->CalculateCrc32 = RuntimeDriverCalculateCrc32;
- gRT->SetVirtualAddressMap = RuntimeDriverSetVirtualAddressMap;
- gRT->ConvertPointer = RuntimeDriverConvertPointer;
-
- //
- // Install the Runtime Architectural Protocol onto a new handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mRuntimeHandle,
- &gEfiRuntimeArchProtocolGuid,
- &mRuntime,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.dxs b/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.dxs
deleted file mode 100644
index 5ff298f..0000000
--- a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.dxs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Runtime.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.h b/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.h
deleted file mode 100644
index c2e4b39..0000000
--- a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Runtime.h
-
-Abstract:
-
- Runtime Architectural Protocol as defined in the DXE CIS
-
- This code is used to produce the EFI runtime architectural protocol.
-
---*/
-
-#ifndef _RUNTIME_H_
-#define _RUNTIME_H_
-
-//
-// Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-RuntimeDriverCalculateCrc32 (
- IN VOID *Data,
- IN UINTN DataSize,
- OUT UINT32 *CrcOut
- )
-/*++
-
-Routine Description:
-
- Calculate CRC32 for target data
-
-Arguments:
-
- Data - The target data.
- DataSize - The target data size.
- CrcOut - The CRC32 for target data.
-
-Returns:
-
- EFI_SUCCESS - The CRC32 for target data is calculated successfully.
- EFI_INVALID_PARAMETER - Some parameter is not valid, so the CRC32 is not
- calculated.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverConvertPointer (
- IN UINTN DebugDisposition,
- IN OUT VOID **ConvertAddress
- )
-/*++
-
-Routine Description:
-
- Determines the new virtual address that is to be used on subsequent memory accesses.
-
-Arguments:
-
- DebugDisposition - Supplies type information for the pointer being converted.
- ConvertAddress - A pointer to a pointer that is to be fixed to be the value needed
- for the new virtual address mappings being applied.
-
-Returns:
-
- EFI_SUCCESS - The pointer pointed to by Address was modified.
- EFI_NOT_FOUND - The pointer pointed to by Address was not found to be part
- of the current memory map. This is normally fatal.
- EFI_INVALID_PARAMETER - One of the parameters has an invalid value.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverSetVirtualAddressMap (
- IN UINTN MemoryMapSize,
- IN UINTN DescriptorSize,
- IN UINT32 DescriptorVersion,
- IN EFI_MEMORY_DESCRIPTOR *VirtualMap
- )
-/*++
-
-Routine Description:
-
- Changes the runtime addressing mode of EFI firmware from physical to virtual.
-
-Arguments:
-
- MemoryMapSize - The size in bytes of VirtualMap.
- DescriptorSize - The size in bytes of an entry in the VirtualMap.
- DescriptorVersion - The version of the structure entries in VirtualMap.
- VirtualMap - An array of memory descriptors which contain new virtual
- address mapping information for all runtime ranges.
-
-Returns:
-
- EFI_SUCCESS - The virtual address map has been applied.
- EFI_UNSUPPORTED - EFI firmware is not at runtime, or the EFI firmware is already in
- virtual address mapped mode.
- EFI_INVALID_PARAMETER - DescriptorSize or DescriptorVersion is invalid.
- EFI_NO_MAPPING - A virtual address was not supplied for a range in the memory
- map that requires a mapping.
- EFI_NOT_FOUND - A virtual address was supplied for an address that is not found
- in the memory map.
-
---*/
-;
-
-VOID
-RuntimeDriverInitializeCrc32Table (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initialize CRC32 table.
-
-Arguments:
-
- None.
-
-Returns:
-
- None.
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Install Runtime AP. This code includes the EfiRuntimeLib, but it only
- functions at RT in physical mode.
-
-Arguments:
-
- ImageHandle - Image handle of this driver.
- SystemTable - Pointer to the EFI System Table.
-
-Returns:
-
- EFI_SUCEESS - Runtime Driver Architectural Protocol installed.
-
---*/
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.msa b/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.msa
deleted file mode 100644
index 207b44c..0000000
--- a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.msa
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>Runtime</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>B601F8C4-43B7-4784-95B1-F4226CB40CEE</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Runtime module.</Abstract>
- <Description>This module is used to produce the EFI runtime virtual switch over services.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Runtime</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>CacheMaintenanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeCoffLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Runtime.dxs</Filename>
- <Filename>Runtime.c</Filename>
- <Filename>Runtime.h</Filename>
- <Filename>Crc32.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiRuntimeArchProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <SystemTables>
- <SystemTableCNames Usage="SOMETIMES_CONSUMED">
- <SystemTableCName>gEfiUgaIoProtocolGuid</SystemTableCName>
- </SystemTableCNames>
- <SystemTableCNames Usage="SOMETIMES_CONSUMED">
- <SystemTableCName>gEfiCapsuleGuid</SystemTableCName>
- </SystemTableCNames>
- </SystemTables>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>RuntimeDriverInitialize</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.c b/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.c
deleted file mode 100644
index 4b4581d..0000000
--- a/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- SecurityStub.c
-
-Abstract:
-
- This driver supports platform security service
-
---*/
-
-#include "SecurityStub.h"
-
-//
-// Handle for the Security Architectural Protocol instance produced by this driver
-//
-EFI_HANDLE mSecurityArchProtocolHandle = NULL;
-
-//
-// Security Architectural Protocol instance produced by this driver
-//
-EFI_SECURITY_ARCH_PROTOCOL mSecurityStub = {
- SecurityStubAuthenticateState
-};
-
-//
-// Worker functions
-//
-EFI_STATUS
-EFIAPI
-SecurityStubAuthenticateState (
- IN EFI_SECURITY_ARCH_PROTOCOL *This,
- IN UINT32 AuthenticationStatus,
- IN EFI_DEVICE_PATH_PROTOCOL *File
- )
-/*++
-
-Routine Description:
-
- The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific
- policy from the DXE core response to an attempt to use a file that returns a
- given status for the authentication check from the section extraction protocol.
-
- The possible responses in a given SAP implementation may include locking
- flash upon failure to authenticate, attestation logging for all signed drivers,
- and other exception operations. The File parameter allows for possible logging
- within the SAP of the driver.
-
- If File is NULL, then EFI_INVALID_PARAMETER is returned.
-
- If the file specified by File with an authentication status specified by
- AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.
-
- If the file specified by File with an authentication status specified by
- AuthenticationStatus is not safe for the DXE Core to use under any circumstances,
- then EFI_ACCESS_DENIED is returned.
-
- If the file specified by File with an authentication status specified by
- AuthenticationStatus is not safe for the DXE Core to use right now, but it
- might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is
- returned.
-
-Arguments:
-
- This - The EFI_SECURITY_ARCH_PROTOCOL instance.
-
- AuthenticationStatus - This is the authentication type returned from the Section
- Extraction protocol. See the Section Extraction Protocol
- Specification for details on this type.
-
- File - This is a pointer to the device path of the file that is
- being dispatched. This will optionally be used for logging.
-
-Returns:
-
- EFI_SUCCESS - The file specified by File did authenticate, and the
- platform policy dictates that the DXE Core may use File.
-
- EFI_INVALID_PARAMETER - File is NULL.
-
- EFI_SECURITY_VIOLATION - The file specified by File did not authenticate, and
- the platform policy dictates that File should be placed
- in the untrusted state. A file may be promoted from
- the untrusted to the trusted state at a future time
- with a call to the Trust() DXE Service.
-
- EFI_ACCESS_DENIED - The file specified by File did not authenticate, and
- the platform policy dictates that File should not be
- used for any purpose.
-
---*/
-{
- if (File == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-SecurityStubInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Initialize the state information for the Security Architectural Protocol
-
-Arguments:
-
- ImageHandle of the loaded driver
- Pointer to the System Table
-
-Returns:
-
- Status
-
- EFI_SUCCESS - successful installation of the service
- EFI_OUT_OF_RESOURCES - cannot allocate protocol data structure
- EFI_DEVICE_ERROR - cannot create the timer service
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Make sure the Security Architectural Protocol is not already installed in the system
- //
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiSecurityArchProtocolGuid);
-
- //
- // Install the Security Architectural Protocol onto a new handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mSecurityArchProtocolHandle,
- &gEfiSecurityArchProtocolGuid,
- &mSecurityStub,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.dxs b/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.dxs
deleted file mode 100644
index 97eca3d..0000000
--- a/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- SecurityStub.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.h b/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.h
deleted file mode 100644
index 420afd1..0000000
--- a/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- SecurityStub.h
-
-Abstract:
-
- Some definitions for Security Architectural Protocol stub driver
-
---*/
-
-#ifndef _SECURITY_STUB_ARCH_PROTOCOL_H
-#define _SECURITY_STUB_ARCH_PROTOCOL_H
-
-
-
-//
-// Function prototypes
-//
-EFI_STATUS
-EFIAPI
-SecurityStubAuthenticateState (
- IN EFI_SECURITY_ARCH_PROTOCOL *This,
- IN UINT32 AuthenticationStatus,
- IN EFI_DEVICE_PATH_PROTOCOL *File
- )
-;
-
-EFI_STATUS
-EFIAPI
-SecurityStubInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.msa b/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.msa
deleted file mode 100644
index 7bf5d22..0000000
--- a/EdkModulePkg/Universal/Security/SecurityStub/Dxe/SecurityStub.msa
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>SecurityStub</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>F80697E9-7FD6-4665-8646-88E33EF71DFC</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for SecurityStub module</Abstract>
- <Description>This driver supports platform security service.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>SecurityStub</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>SecurityStub.dxs</Filename>
- <Filename>SecurityStub.h</Filename>
- <Filename>SecurityStub.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiSecurityArchProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>SecurityStubInitialize</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/StatusCode/Dxe/Common/DxeStatusCodeCommon.c b/EdkModulePkg/Universal/StatusCode/Dxe/Common/DxeStatusCodeCommon.c
deleted file mode 100644
index 43fe3fd..0000000
--- a/EdkModulePkg/Universal/StatusCode/Dxe/Common/DxeStatusCodeCommon.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/** @file
- Status code driver for IA32/X64/EBC architecture.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: DxeStatusCodeCommon.c
-
-**/
-#include "DxeStatusCode.h"
-
-
-/**
- Report status code to all supported device.
- Calls into the workers which dispatches the platform specific
- listeners.
-
- @param Type Indicates the type of status code being reported.
- The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
- @param Value Describes the current status of a hardware or software entity.
- This includes information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance
- information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- @param Data This optional parameter may be used to pass additional data.
- Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
- The contents of this data type may have additional GUID-specific data. The standard GUIDs and
- their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
-
- @return Always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-ReportDispatcher (
- IN EFI_STATUS_CODE_TYPE Type,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-//
-// Declaration of status code protocol.
-//
-STATIC
-EFI_STATUS_CODE_PROTOCOL mEfiStatusCodeProtocol = {
- ReportDispatcher
-};
-
-//
-// Delaration of DXE status code controller
-//
-DXE_STATUS_CODE_CONTROLLER gDxeStatusCode = {
- //
- // Initialize nest status as non nested.
- //
- 0,
- {NULL, NULL}
-};
-
-/**
-
- Install the ReportStatusCode runtime service.
-
- @param ImageHandle Image handle of the loaded driver
- @param SystemTable Pointer to the System Table
-
- @return The function always returns success.
-
-**/
-EFI_STATUS
-DxeStatusCodeDriverEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_HANDLE Handle = NULL;
- EFI_STATUS Status;
-
- //
- // Dispatch initialization request to supported devices
- //
- InitializationDispatcherWorker ();
-
- //
- // Install Status Code Architectural Protocol implementation as defined in Tiano
- // Architecture Specification.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiStatusCodeRuntimeProtocolGuid,
- &mEfiStatusCodeProtocol,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- Report status code to all supported device.
- Calls into the workers which dispatches the platform specific
- listeners.
-
- @param CodeType Indicates the type of status code being reported.
- The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
- @param Value Describes the current status of a hardware or software entity.
- This includes information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance
- information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- @param Data This optional parameter may be used to pass additional data.
- Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
- The contents of this data type may have additional GUID-specific data. The standard GUIDs and
- their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
-
- @return Always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-ReportDispatcher (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- //
- // Use atom operation to avoid the reentant of report.
- // If current status is not zero, then the function is reentrancy.
- //
- if (1 == InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 0, 1)) {
- return EFI_DEVICE_ERROR;
- }
-
- if (FeaturePcdGet (PcdStatusCodeUseEfiSerial) || FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
- SerialStatusCodeReportWorker (
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
- RtMemoryStatusCodeReportWorker (
- gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],
- CodeType,
- Value,
- Instance
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
- DataHubStatusCodeReportWorker (
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
- OemHookStatusCodeReport (
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
- }
-
- //
- // Restore the nest status of report
- //
- InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 1, 0);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Virtual address change notification call back. It converts global pointer
- to virtual address.
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to the notification function's context, which is
- always zero in current implementation.
-
-**/
-VOID
-EFIAPI
-VirtualAddressChangeCallBack (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- //
- // Convert memory status code table to virtual address;
- //
- EfiConvertPointer (
- 0,
- (VOID **) &gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE]
- );
-}
-
diff --git a/EdkModulePkg/Universal/StatusCode/Dxe/Common/StatusCode.dxs b/EdkModulePkg/Universal/StatusCode/Dxe/Common/StatusCode.dxs
deleted file mode 100644
index 37074f5..0000000
--- a/EdkModulePkg/Universal/StatusCode/Dxe/Common/StatusCode.dxs
+++ /dev/null
@@ -1,25 +0,0 @@
-#/*++
-#
-# Copyright (c) 2006, Intel Corporation
-# All rights reserved. This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# StatusCode.dxs
-#
-# Abstract:
-#
-# Dependency expression source file.
-#
-#--*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- EFI_DATA_HUB_PROTOCOL_GUID AND EFI_CPU_IO_PROTOCOL_GUID
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c b/EdkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c
deleted file mode 100644
index 737bc8a..0000000
--- a/EdkModulePkg/Universal/StatusCode/Dxe/DataHubStatusCodeWorker.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/** @file
- Data Hub status code worker in DXE.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: DataHubStatusCodeWorker.c
-
-**/
-
-#include <Common/StatusCode.h>
-#include "DxeStatusCode.h"
-
-//
-// Initialize FIFO to cache records.
-//
-STATIC
-LIST_ENTRY mRecordsFifo = INITIALIZE_LIST_HEAD_VARIABLE (mRecordsFifo);
-STATIC
-LIST_ENTRY mRecordsBuffer = INITIALIZE_LIST_HEAD_VARIABLE (mRecordsBuffer);
-STATIC
-EFI_EVENT mLogDataHubEvent;
-//
-// Cache data hub protocol.
-//
-STATIC
-EFI_DATA_HUB_PROTOCOL *mDataHubProtocol;
-
-
-/**
- Return one DATAHUB_STATUSCODE_RECORD space.
- The size of free record pool would be extend, if the pool is empty.
-
-
- @retval NULL Can not allocate free memeory for record.
- @retval !NULL Point to buffer of record.
-
-**/
-STATIC
-DATA_HUB_STATUS_CODE_DATA_RECORD *
-AcquireRecordBuffer (
- VOID
- )
-{
- DATAHUB_STATUSCODE_RECORD *Record;
- EFI_TPL CurrentTpl;
- LIST_ENTRY *Node;
- UINT32 Index;
-
- CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-
- if (!IsListEmpty (&mRecordsBuffer)) {
- Node = GetFirstNode (&mRecordsBuffer);
- RemoveEntryList (Node);
-
- Record = _CR (Node, DATAHUB_STATUSCODE_RECORD, Node);
- } else {
- if (CurrentTpl > TPL_NOTIFY) {
- gBS->RestoreTPL (CurrentTpl);
- return NULL;
- }
-
- gBS->RestoreTPL (CurrentTpl);
- Record = (DATAHUB_STATUSCODE_RECORD *) AllocateZeroPool (sizeof (DATAHUB_STATUSCODE_RECORD) * 16);
- if (NULL == Record) {
- return NULL;
- }
-
- CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
- for (Index = 1; Index < 16; Index++) {
- InsertTailList (&mRecordsBuffer, &Record[Index].Node);
- }
- }
-
- Record->Signature = DATAHUB_STATUS_CODE_SIGNATURE;
- InsertTailList (&mRecordsFifo, &Record->Node);
-
- gBS->RestoreTPL (CurrentTpl);
-
- return (DATA_HUB_STATUS_CODE_DATA_RECORD *) (Record->Data);
-}
-
-
-/**
- Retrieve one record from Records FIFO. The record would be removed from FIFO and
- release to free record buffer.
-
- @return !NULL Point to record, which is ready to be logged.
- @return NULL the FIFO of record is empty.
-
-**/
-STATIC
-DATA_HUB_STATUS_CODE_DATA_RECORD *
-RetrieveRecord (
- VOID
- )
-{
- DATA_HUB_STATUS_CODE_DATA_RECORD *RecordData = NULL;
- DATAHUB_STATUSCODE_RECORD *Record;
- LIST_ENTRY *Node;
- EFI_TPL CurrentTpl;
-
- CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-
- if (!IsListEmpty (&mRecordsFifo)) {
- Node = GetFirstNode (&mRecordsFifo);
- Record = CR (Node, DATAHUB_STATUSCODE_RECORD, Node, DATAHUB_STATUS_CODE_SIGNATURE);
-
- RemoveEntryList (&Record->Node);
- InsertTailList (&mRecordsBuffer, &Record->Node);
- Record->Signature = 0;
- RecordData = (DATA_HUB_STATUS_CODE_DATA_RECORD *) Record->Data;
- }
-
- gBS->RestoreTPL (CurrentTpl);
-
- return RecordData;
-}
-
-
-/**
- Report status code into DataHub.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.
- @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
- @retval EFI_SUCCESS Success to cache status code and signal log data event.
-
-**/
-EFI_STATUS
-DataHubStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- DATA_HUB_STATUS_CODE_DATA_RECORD *Record;
- UINT32 ErrorLevel;
- VA_LIST Marker;
- CHAR8 *Format;
- UINTN CharCount;
-
- //
- // See whether in runtime phase or not.
- //
- if (EfiAtRuntime ()) {
- return EFI_DEVICE_ERROR;
- }
-
- Record = AcquireRecordBuffer ();
- if (Record == NULL) {
- //
- // There are no empty record buffer in private buffers
- //
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Construct Data Hub Extended Data
- //
- Record->CodeType = CodeType;
- Record->Value = Value;
- Record->Instance = Instance;
-
- if (CallerId != NULL) {
- CopyMem (&Record->CallerId, CallerId, sizeof (EFI_GUID));
- }
-
- if (Data != NULL) {
- if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
- CharCount = UnicodeVSPrintAsciiFormat (
- (CHAR16 *) (Record + 1),
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- Format,
- Marker
- );
- //
- // Change record data type from DebugType to String Type.
- //
- CopyGuid (&Record->Data.Type, &gEfiStatusCodeDataTypeDebugGuid);
- Record->Data.HeaderSize = Data->HeaderSize;
- Record->Data.Size = (UINT16) ((CharCount + 1) * sizeof (CHAR16));
- } else {
- //
- // Copy status code data header
- //
- CopyMem (&Record->Data, Data, sizeof (EFI_STATUS_CODE_DATA));
-
- if (Data->Size > EFI_STATUS_CODE_DATA_MAX_SIZE) {
- Record->Data.Size = EFI_STATUS_CODE_DATA_MAX_SIZE;
- }
- CopyMem ((VOID *) (Record + 1), Data + 1, Record->Data.Size);
- }
- }
-
- gBS->SignalEvent (mLogDataHubEvent);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- The Event handler which will be notified to log data in Data Hub.
-
- @param Event Instance of the EFI_EVENT to signal whenever data is
- available to be logged in the system.
- @param Context Context of the event.
-
-**/
-STATIC
-VOID
-EFIAPI
-LogDataHubEventCallBack (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- DATA_HUB_STATUS_CODE_DATA_RECORD *Record;
- UINT32 Size;
- UINT64 DataRecordClass;
-
- //
- // Log DataRecord in Data Hub.
- // Journal records fifo to find all record entry.
- //
- while (1) {
- Record = RetrieveRecord ();
- if (Record == NULL) {
- break;
- }
- //
- // Add in the size of the header we added.
- //
- Size = sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD) + (UINT32) Record->Data.Size;
-
- if ((Record->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
- DataRecordClass = EFI_DATA_RECORD_CLASS_PROGRESS_CODE;
- } else if ((Record->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
- DataRecordClass = EFI_DATA_RECORD_CLASS_ERROR;
- } else if ((Record->CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {
- DataRecordClass = EFI_DATA_RECORD_CLASS_DEBUG;
- } else {
- //
- // Should never get here.
- //
- DataRecordClass = EFI_DATA_RECORD_CLASS_DEBUG |
- EFI_DATA_RECORD_CLASS_ERROR |
- EFI_DATA_RECORD_CLASS_DATA |
- EFI_DATA_RECORD_CLASS_PROGRESS_CODE;
- }
-
- //
- // Log DataRecord in Data Hub
- //
-
- mDataHubProtocol->LogData (
- mDataHubProtocol,
- &gEfiStatusCodeGuid,
- &gEfiStatusCodeRuntimeProtocolGuid,
- DataRecordClass,
- Record,
- Size
- );
-
- }
-}
-
-
-/**
- Initialize data hubstatus code.
- Create a data hub listener.
-
- @return The function always return EFI_SUCCESS
-
-**/
-EFI_STATUS
-DataHubStatusCodeInitializeWorker (
- VOID
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (
- &gEfiDataHubProtocolGuid,
- NULL,
- (VOID **) &mDataHubProtocol
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Create a Notify Event to log data in Data Hub
- //
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- LogDataHubEventCallBack,
- NULL,
- &mLogDataHubEvent
- );
-
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
-
diff --git a/EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c b/EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c
deleted file mode 100644
index 27ea8dc..0000000
--- a/EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/** @file
- Status Code Architectural Protocol implementation as defined in Tiano
- Architecture Specification.
-
- This driver has limited functionality at runtime and will not log to Data Hub
- at runtime.
-
- Notes:
- This driver assumes the following ReportStatusCode strategy:
- PEI -> uses PeiReportStatusCode
- DXE IPL -> uses PeiReportStatusCode
- early DXE -> uses PeiReportStatusCode via HOB
- DXE -> This driver
- RT -> This driver
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: DxeStatusCode.c
-
-**/
-
-#include "DxeStatusCode.h"
-
-/**
-
- Dispatch initialization request to sub status code devices based on
- customized feature flags.
-
-**/
-VOID
-InitializationDispatcherWorker (
- VOID
- )
-{
- EFI_PEI_HOB_POINTERS Hob;
- EFI_STATUS Status;
- MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
- MEMORY_STATUSCODE_RECORD *Record;
- UINTN ExpectedPacketIndex = 0;
- UINTN Index;
- VOID *HobStart;
-
- //
- // If enable UseSerial, then initialize serial port.
- // if enable UseRuntimeMemory, then initialize runtime memory status code worker.
- // if enable UseDataHub, then initialize data hub status code worker.
- //
- if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
- Status = EfiSerialStatusCodeInitializeWorker ();
- ASSERT_EFI_ERROR (Status);
- }
- if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
- Status = SerialPortInitialize ();
- ASSERT_EFI_ERROR (Status);
- }
- if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
- Status = RtMemoryStatusCodeInitializeWorker ();
- ASSERT_EFI_ERROR (Status);
- }
- if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
- Status = DataHubStatusCodeInitializeWorker ();
- ASSERT_EFI_ERROR (Status);
- }
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
- Status = OemHookStatusCodeInitialize ();
- ASSERT_EFI_ERROR (Status);
- }
-
- //
- // Replay Status code which saved in GUID'ed HOB to all supported device.
- //
-
- //
- // Journal GUID'ed HOBs to find all record entry, if found,
- // then output record to support replay device.
- //
- Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
- HobStart = Hob.Raw;
- while (Hob.Raw != NULL) {
- PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *) GET_GUID_HOB_DATA (Hob.Guid);
- if (PacketHeader->PacketIndex == ExpectedPacketIndex) {
- Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);
- for (Index = 0; Index < PacketHeader->RecordIndex; Index++) {
- //
- // Dispatch records to devices based on feature flag.
- //
- if (FeaturePcdGet (PcdStatusCodeReplayInSerial) &&
- (FeaturePcdGet (PcdStatusCodeUseHardSerial) ||
- FeaturePcdGet (PcdStatusCodeUseEfiSerial))) {
- SerialStatusCodeReportWorker (
- Record[Index].CodeType,
- Record[Index].Value,
- Record[Index].Instance,
- NULL,
- NULL
- );
- }
- if (FeaturePcdGet (PcdStatusCodeReplayInRuntimeMemory) &&
- FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
- RtMemoryStatusCodeReportWorker (
- gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],
- Record[Index].CodeType,
- Record[Index].Value,
- Record[Index].Instance
- );
- }
- if (FeaturePcdGet (PcdStatusCodeReplayInDataHub) &&
- FeaturePcdGet (PcdStatusCodeUseDataHub)) {
- DataHubStatusCodeReportWorker (
- Record[Index].CodeType,
- Record[Index].Value,
- Record[Index].Instance,
- NULL,
- NULL
- );
- }
- if (FeaturePcdGet (PcdStatusCodeReplayInOEM) &&
- FeaturePcdGet (PcdStatusCodeUseOEM)) {
- OemHookStatusCodeReport (
- Record[Index].CodeType,
- Record[Index].Value,
- Record[Index].Instance,
- NULL,
- NULL
- );
- }
- }
- ExpectedPacketIndex++;
-
- //
- // See whether there is gap of packet or not
- //
- if (NULL != HobStart) {
- HobStart = NULL;
- Hob.Raw = HobStart;
- continue;
- }
- } else if (HobStart != NULL) {
- //
- // Cache the found packet for improve the performance
- //
- HobStart = Hob.Raw;
- }
-
- Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);
- }
-}
-
diff --git a/EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h b/EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h
deleted file mode 100644
index 5f8cee0..0000000
--- a/EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*++
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeStatusCode.h
-
-Abstract:
-
- Header file of EFI DXE/RT Status Code.
-
---*/
-
-#ifndef __DXE_STATUS_CODE_H__
-#define __DXE_STATUS_CODE_H__
-
-#include <Common/StatusCode.h>
-
-//
-// Data hub worker definition
-//
-#define MAX_NUMBER_DATAHUB_RECORDS 1000
-#define DATAHUB_BYTES_PER_RECORD EFI_STATUS_CODE_DATA_MAX_SIZE
-#define EMPTY_RECORD_TAG 0xFF
-#define DATAHUB_STATUS_CODE_SIGNATURE EFI_SIGNATURE_32 ('B', 'D', 'H', 'S')
-
-//
-// Address type of pointer.
-// The point type always equal to PHYSICAL_MODE on IA32/X64/EBC architecture
-// Otherwise, VIRTUAL_MODE/PHYSICAL_MODE would be used on Ipf architecture,
-//
-typedef enum {
- PHYSICAL_MODE,
- VIRTUAL_MODE
-} PROCESSOR_MODE;
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Node;
-
- UINT8 Data[sizeof (DATA_HUB_STATUS_CODE_DATA_RECORD) + EFI_STATUS_CODE_DATA_MAX_SIZE];
-} DATAHUB_STATUSCODE_RECORD;
-
-
-//
-// Runtime memory status code worker definition
-//
-typedef struct {
- UINT32 RecordIndex;
- UINT32 NumberOfRecords;
- UINT32 MaxRecordsNumber;
-} RUNTIME_MEMORY_STATUSCODE_HEADER;
-
-
-typedef struct {
- //
- // Report operation nest status.
- // If it is set, then the report operation has nested.
- //
- UINT32 StatusCodeNestStatus;
- //
- // Runtime status code management header, the records buffer is following it.
- //
- RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable[2];
-} DXE_STATUS_CODE_CONTROLLER;
-
-
-/**
-
- Dispatch initialization request to sub status code devices based on
- customized feature flags.
-
-**/
-VOID
-InitializationDispatcherWorker (
- VOID
- );
-
-
-/**
- Initialize serial status code worker.
-
- @return The function always return EFI_SUCCESS
-
-**/
-EFI_STATUS
-EfiSerialStatusCodeInitializeWorker (
- VOID
- );
-
-
-/**
- Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @retval EFI_SUCCESS Success to report status code to serial I/O.
- @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
-
-**/
-EFI_STATUS
-SerialStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-/**
- Initialize runtime memory status code.
-
- @return The function always return EFI_SUCCESS
-
-**/
-EFI_STATUS
-RtMemoryStatusCodeInitializeWorker (
- VOID
- );
-
-/**
- Report status code into runtime memory. If the runtime pool is full, roll back to the
- first record and overwrite it.
-
- @param RtMemoryStatusCodeTable
- Point to Runtime memory table header.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-RtMemoryStatusCodeReportWorker (
- RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance
- );
-
-/**
- Initialize data hubstatus code.
- Create a data hub listener.
-
- @return The function always return EFI_SUCCESS
-
-**/
-EFI_STATUS
-DataHubStatusCodeInitializeWorker (
- VOID
- );
-
-
-/**
- Report status code into DataHub.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @retval EFI_OUT_OF_RESOURCES Can not acquire record buffer.
- @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
- @retval EFI_SUCCESS Success to cache status code and signal log data event.
-
-**/
-EFI_STATUS
-DataHubStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-//
-// declaration of DXE status code controller.
-//
-extern DXE_STATUS_CODE_CONTROLLER gDxeStatusCode;
-
-#endif
diff --git a/EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.msa b/EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.msa
deleted file mode 100644
index 915dfb5..0000000
--- a/EdkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.msa
+++ /dev/null
@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd" xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeStatusCode</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>FEDE0A1B-BCA2-4A9F-BB2B-D9FD7DEC2E9F</GuidValue>
- <Version>1.0</Version>
- <Abstract>DXE status code driver.</Abstract>
- <Description>Status Code Architectural Protocol implementation as defined in Tiano
- Architecture Specification. This driver has limited functionality
- at runtime and will not log to Data Hub at runtime.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeStatusCode</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>SerialPortLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>OemHookStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IPF">
- <Keyword>ExtendedSalLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeStatusCode.h</Filename>
- <Filename>DxeStatusCode.c</Filename>
- <Filename>DataHubStatusCodeWorker.c</Filename>
- <Filename>RtMemoryStatusCodeWorker.c</Filename>
- <Filename>SerialStatusCodeWorker.c</Filename>
- <Filename SupArchList="IA32">Common/DxeStatusCodeCommon.c</Filename>
- <Filename SupArchList="IA32">Common/StatusCode.dxs</Filename>
- <Filename SupArchList="X64">Common/DxeStatusCodeCommon.c</Filename>
- <Filename SupArchList="X64">Common/StatusCode.dxs</Filename>
- <Filename SupArchList="EBC">Common/DxeStatusCodeCommon.c</Filename>
- <Filename SupArchList="EBC">Common/StatusCode.dxs</Filename>
- <Filename SupArchList="IPF">Ipf/DxeStatusCodeIpf.c</Filename>
- <Filename SupArchList="IPF">Ipf/StatusCode.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5E0E9358-46B6-4AE2-8218-4AB8B9BBDCEC"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiExtendedSalStatusCodeServicesProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiStatusCodeRuntimeProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gMemoryStatusCodeRecordGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiStatusCodeDataTypeDebugGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiStatusCodeGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>DxeStatusCodeDriverEntry</ModuleEntryPoint>
- </Extern>
- <Extern>
- <SetVirtualAddressMapCallBack>VirtualAddressChangeCallBack</SetVirtualAddressMapCallBack>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseHardSerial</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseEfiSerial</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseRuntimeMemory</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseDataHub</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInSerial</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInDataHub</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInRuntimeMemory</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeReplayInOEM</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdStatusCodeRuntimeMemorySize</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/StatusCode/Dxe/Ipf/DxeStatusCodeIpf.c b/EdkModulePkg/Universal/StatusCode/Dxe/Ipf/DxeStatusCodeIpf.c
deleted file mode 100644
index 4163121..0000000
--- a/EdkModulePkg/Universal/StatusCode/Dxe/Ipf/DxeStatusCodeIpf.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/** @file
-* Status code driver for IPF architecture.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: DxeStatusCodeIpf.c
-
-**/
-
-#include "DxeStatusCode.h"
-
-
-/**
- Report status code to all supported device.
- Calls into the workers which dispatches the platform specific
- listeners.
-
- @param Type Indicates the type of status code being reported.
- The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
- @param Value Describes the current status of a hardware or software entity.
- This includes information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance
- information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- @param Data This optional parameter may be used to pass additional data.
- Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
- The contents of this data type may have additional GUID-specific data. The standard GUIDs and
- their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
-
- @return Always return EFI_SUCCESS.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-ReportDispatcher (
- IN EFI_STATUS_CODE_TYPE Type,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-//
-// Declaration of status code protocol.
-//
-STATIC
-EFI_STATUS_CODE_PROTOCOL mEfiStatusCodeProtocol = {
- ReportDispatcher
-};
-
-//
-// Delaration of DXE status code controller
-//
-DXE_STATUS_CODE_CONTROLLER gDxeStatusCode = {
- //
- // Initialize nest status as non nested.
- //
- 0,
- {NULL, NULL}
-};
-
-/**
- Report status code to all supported device.
- Calls into the workers which dispatches the platform specific
- listeners.
-
- @param CodeType Indicates the type of status code being reported.
- The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
- @param Value Describes the current status of a hardware or software entity.
- This includes information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance
- information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- @param Data This optional parameter may be used to pass additional data.
- Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
- The contents of this data type may have additional GUID-specific data. The standard GUIDs and
- their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
-
- @return Always return EFI_SUCCESS.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-ReportDispatcher (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- //
- // Use atom operation to avoid the reentant of report.
- // If current status is not zero, then the function is reentrancy.
- //
- if (1 == InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 0, 1)) {
- return EFI_DEVICE_ERROR;
- }
-
- if (FeaturePcdGet (PcdStatusCodeUseEfiSerial) || FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
- SerialStatusCodeReportWorker (
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
- RtMemoryStatusCodeReportWorker (
- gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],
- CodeType,
- Value,
- Instance
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
- DataHubStatusCodeReportWorker (
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
- OemHookStatusCodeReport (
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
- }
-
- //
- // Restore the nest status of report
- //
- InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 1, 0);
-
- return EFI_SUCCESS;
-}
-
-
-/**
-
- Main entry for Extended SAL ReportStatusCode Services
-
- @param FunctionId Function Id which needed to be called
- @param Arg2 Efi status code type
- @param Arg3 Efi status code value
- @param Arg4 Instance number
- @param Arg5 Caller Id
- @param Arg6 Efi status code data
- @param Arg7 Not used
- @param Arg8 Not used
- @param ExtendedSalProc Esal Proc pointer
- @param VirtualMode If this function is called in virtual mode
- @param Global This module's global variable pointer
-
- @return Value returned in SAL_RETURN_REGS
-
---*/
-STATIC
-SAL_RETURN_REGS
-EFIAPI
-ReportEsalServiceEntry (
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8,
- IN SAL_EXTENDED_SAL_PROC ExtendedSalProc,
- IN BOOLEAN VirtualMode,
- IN VOID *Global
- )
-{
- SAL_RETURN_REGS ReturnVal;
- DXE_STATUS_CODE_CONTROLLER *DxeStatusCode;
-
- switch (FunctionId) {
-
- case ReportStatusCodeServiceFunctionId:
-
- DxeStatusCode = (DXE_STATUS_CODE_CONTROLLER *) Global;
-
- //
- // Use atom operation to avoid the reentant of report.
- // If current status is not zero, then the function is reentrancy.
- //
- if (1 == InterlockedCompareExchange32 (&DxeStatusCode->StatusCodeNestStatus, 0, 1)) {
- ReturnVal.Status = EFI_DEVICE_ERROR;
- return ReturnVal;
- }
-
- if (FeaturePcdGet (PcdStatusCodeUseEfiSerial) || FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
- SerialStatusCodeReportWorker (
- (EFI_STATUS_CODE_TYPE) Arg2,
- (EFI_STATUS_CODE_VALUE) Arg3,
- (UINT32) Arg4,
- (EFI_GUID *) Arg5,
- (EFI_STATUS_CODE_DATA *) Arg6
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {
- RtMemoryStatusCodeReportWorker (
- DxeStatusCode->RtMemoryStatusCodeTable[VirtualMode],
- (EFI_STATUS_CODE_TYPE) Arg2,
- (EFI_STATUS_CODE_VALUE) Arg3,
- (UINT32) Arg4
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {
- DataHubStatusCodeReportWorker (
- (EFI_STATUS_CODE_TYPE) Arg2,
- (EFI_STATUS_CODE_VALUE) Arg3,
- (UINT32) Arg4,
- (EFI_GUID *) Arg5,
- (EFI_STATUS_CODE_DATA *) Arg6
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
- OemHookStatusCodeReport (
- (EFI_STATUS_CODE_TYPE) Arg2,
- (EFI_STATUS_CODE_VALUE) Arg3,
- (UINT32) Arg4,
- (EFI_GUID *) Arg5,
- (EFI_STATUS_CODE_DATA *) Arg6
- );
- }
-
- //
- // Restore the nest status of report
- //
- InterlockedCompareExchange32 (&DxeStatusCode->StatusCodeNestStatus, 1, 0);
-
- ReturnVal.Status = EFI_SUCCESS;
-
- break;
-
- default:
- ReturnVal.Status = EFI_SAL_INVALID_ARGUMENT;
- break;
- }
-
- return ReturnVal;
-}
-
-/**
-
- Install the ReportStatusCode runtime service.
-
- @param ImageHandle Image handle of the loaded driver
- @param SystemTable Pointer to the System Table
-
- @return The function always returns success.
-
-**/
-EFI_STATUS
-DxeStatusCodeDriverEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle = NULL;
-
- //
- // Dispatch initialization request to supported devices
- //
- InitializationDispatcherWorker ();
-
- //
- // Install Status Code Architectural Protocol implementation as defined in Tiano
- // Architecture Specification.
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &Handle,
- &gEfiStatusCodeRuntimeProtocolGuid,
- &mEfiStatusCodeProtocol,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Initialize ESAL capabilities.
- //
- Status = RegisterEsalClass (
- &gEfiExtendedSalStatusCodeServicesProtocolGuid,
- &gDxeStatusCode,
- ReportEsalServiceEntry,
- StatusCodeFunctionId,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Virtual address change notification call back. It converts physical mode global pointer to
- virtual mode.
-
- @param Event Event whose notification function is being invoked.
- @param Context Pointer to the notification function's context, which is
- always zero in current implementation.
-
-**/
-VOID
-EFIAPI
-VirtualAddressChangeCallBack (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- gDxeStatusCode.RtMemoryStatusCodeTable[VIRTUAL_MODE] =
- gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE];
-
- //
- // Convert the physical mode pointer to virtual mode point.
- //
- EfiConvertPointer (
- 0,
- (VOID **) &gDxeStatusCode.RtMemoryStatusCodeTable[VIRTUAL_MODE]
- );
-}
-
diff --git a/EdkModulePkg/Universal/StatusCode/Dxe/Ipf/StatusCode.dxs b/EdkModulePkg/Universal/StatusCode/Dxe/Ipf/StatusCode.dxs
deleted file mode 100644
index 04e6e2f..0000000
--- a/EdkModulePkg/Universal/StatusCode/Dxe/Ipf/StatusCode.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-#/*++
-#
-# Copyright (c) 2006, Intel Corporation
-# All rights reserved. This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# StatusCode.dxs
-#
-# Abstract:
-#
-# Dependency expression source file.
-#
-#--*/
-
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- EFI_DATA_HUB_PROTOCOL_GUID AND EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/StatusCode/Dxe/RtMemoryStatusCodeWorker.c b/EdkModulePkg/Universal/StatusCode/Dxe/RtMemoryStatusCodeWorker.c
deleted file mode 100644
index 532ea81..0000000
--- a/EdkModulePkg/Universal/StatusCode/Dxe/RtMemoryStatusCodeWorker.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/** @file
- Runtime memory status code worker in DXE.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: RtMemoryStatusCodeWorker.c
-
-**/
-
-#include "DxeStatusCode.h"
-
-/**
- Initialize runtime memory status code.
-
- @return The function always return EFI_SUCCESS
-
-**/
-EFI_STATUS
-RtMemoryStatusCodeInitializeWorker (
- VOID
- )
-{
- RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable;
-
- //
- // Allocate runtime memory status code pool.
- //
- RtMemoryStatusCodeTable =
- (RUNTIME_MEMORY_STATUSCODE_HEADER *) AllocatePool (
- sizeof (RUNTIME_MEMORY_STATUSCODE_HEADER) +
- PcdGet16 (PcdStatusCodeRuntimeMemorySize) *
- 1024
- );
-
- ASSERT (NULL != RtMemoryStatusCodeTable);
-
- RtMemoryStatusCodeTable->RecordIndex = 0;
- RtMemoryStatusCodeTable->NumberOfRecords = 0;
- RtMemoryStatusCodeTable->MaxRecordsNumber =
- (PcdGet16 (PcdStatusCodeRuntimeMemorySize) * 1024) / sizeof (MEMORY_STATUSCODE_RECORD);
-
- gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE] = RtMemoryStatusCodeTable;
- return EFI_SUCCESS;
-}
-
-
-/**
- Report status code into runtime memory. If the runtime pool is full, roll back to the
- first record and overwrite it.
-
- @param RtMemoryStatusCodeTable
- Point to Runtime memory table header.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-RtMemoryStatusCodeReportWorker (
- RUNTIME_MEMORY_STATUSCODE_HEADER *RtMemoryStatusCodeTable,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance
- )
-{
- MEMORY_STATUSCODE_RECORD *Record;
-
- ASSERT (NULL != RtMemoryStatusCodeTable);
-
- //
- // Locate current record buffer.
- //
- Record = (MEMORY_STATUSCODE_RECORD *) (RtMemoryStatusCodeTable + 1);
- Record = &Record[RtMemoryStatusCodeTable->RecordIndex++];
-
- //
- // Save status code.
- //
- Record->CodeType = CodeType;
- Record->Value = Value;
- Record->Instance = Instance;
-
- //
- // Record total number of records, we compare the number with max records number,
- // if it is bigger than the max number, then the roll back had happened, the record index points to
- // the first record. if it is less then max number, then the zero index is the first record.
- //
- RtMemoryStatusCodeTable->NumberOfRecords++;
- if (RtMemoryStatusCodeTable->RecordIndex == RtMemoryStatusCodeTable->MaxRecordsNumber) {
- //
- // Roll back record index.
- //
- RtMemoryStatusCodeTable->RecordIndex = 0;
- }
-
- return EFI_SUCCESS;
-}
-
-
-
diff --git a/EdkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c b/EdkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c
deleted file mode 100644
index ed9fd59..0000000
--- a/EdkModulePkg/Universal/StatusCode/Dxe/SerialStatusCodeWorker.c
+++ /dev/null
@@ -1,223 +0,0 @@
-
-/** @file
- Serial I/O status code reporting worker.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: SerialStatusCodeWorker.c
-
-**/
-
-#include "DxeStatusCode.h"
-
-STATIC
-EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;
-
-/**
- Initialize serial status code worker.
-
- @return The function always return EFI_SUCCESS
-
-**/
-EFI_STATUS
-EfiSerialStatusCodeInitializeWorker (
- VOID
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (
- &gEfiSerialIoProtocolGuid,
- NULL,
- (VOID **) &mSerialIoProtocol
- );
-
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @retval EFI_SUCCESS Success to report status code to serial I/O.
- @retval EFI_DEVICE_ERROR EFI serial device can not work after ExitBootService() is called .
-
-**/
-EFI_STATUS
-SerialStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- CHAR8 *Filename;
- CHAR8 *Description;
- CHAR8 *Format;
- CHAR8 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
- UINT32 ErrorLevel;
- UINT32 LineNumber;
- UINTN CharCount;
- VA_LIST Marker;
- EFI_DEBUG_INFO *DebugInfo;
- EFI_TPL CurrentTpl;
-
-
- if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
- if (EfiAtRuntime ()) {
- return EFI_DEVICE_ERROR;
- }
- CurrentTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
- gBS->RestoreTPL (CurrentTpl);
-
- if (CurrentTpl > TPL_CALLBACK ) {
- return EFI_DEVICE_ERROR;
- }
- }
-
- Buffer[0] = '\0';
-
- if (Data != NULL &&
- ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {
- //
- // Print ASSERT() information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "\n\rDXE_ASSERT!: %a (%d): %a\n\r",
- Filename,
- LineNumber,
- Description
- );
- } else if (Data != NULL &&
- ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
- //
- // Print DEBUG() information into output buffer.
- //
- CharCount = AsciiVSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- Format,
- Marker
- );
- } else if (Data != NULL &&
- CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&
- (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {
- //
- // Print specific data into output buffer.
- //
- DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);
- Marker = (VA_LIST) (DebugInfo + 1);
- Format = (CHAR8 *) (((UINT64 *) Marker) + 12);
-
- CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
- //
- // Print ERROR information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "ERROR: C%x:V%x I%x",
- CodeType,
- Value,
- Instance
- );
-
- //
- // Make sure we don't try to print values that weren't
- // intended to be printed, especially NULL GUID pointers.
- //
-
- if (CallerId != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
- " %g",
- CallerId
- );
- }
-
- if (Data != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
- " %x",
- Data
- );
- }
-
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
- "\n\r"
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "PROGRESS CODE: V%x I%x\n\r",
- Value,
- Instance
- );
- } else {
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "Undefined: C%x:V%x I%x\n\r",
- CodeType,
- Value,
- Instance
- );
- }
-
-
- if (FeaturePcdGet (PcdStatusCodeUseHardSerial)) {
- //
- // Callout to SerialPort Lib function to do print.
- //
- SerialPortWrite ((UINT8 *) Buffer, CharCount);
- }
- if (FeaturePcdGet (PcdStatusCodeUseEfiSerial)) {
- mSerialIoProtocol->Write (
- mSerialIoProtocol,
- &CharCount,
- Buffer
- );
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c b/EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c
deleted file mode 100644
index c49750b..0000000
--- a/EdkModulePkg/Universal/StatusCode/Pei/MemoryStausCodeWorker.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/** @file
- Memory status code worker in PEI.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: MemoryStatusCodeWorker.c
-
-**/
-
-#include "PeiStatusCode.h"
-
-/**
- Create one memory status code GUID'ed HOB, use PacketIndex
- to identify the packet.
-
- @param PacketIndex Index of records packet.
-
- @return Always return pointer of memory status code packet.
-
-**/
-STATIC
-MEMORY_STATUSCODE_PACKET_HEADER *
-CreateMemoryStatusCodePacket (
- UINT16 PacketIndex
- )
-{
- MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
-
- //
- // Build GUID'ed HOB with PCD defined size.
- //
- PacketHeader =
- (MEMORY_STATUSCODE_PACKET_HEADER *) BuildGuidHob (
- &gMemoryStatusCodeRecordGuid,
- PcdGet16 (PcdStatusCodeMemorySize) *
- 1024 +
- sizeof (MEMORY_STATUSCODE_PACKET_HEADER)
- );
- ASSERT (PacketHeader != NULL);
-
- PacketHeader->MaxRecordsNumber = (PcdGet16 (PcdStatusCodeMemorySize) * 1024)/ sizeof (MEMORY_STATUSCODE_RECORD);
- PacketHeader->PacketIndex = PacketIndex;
- PacketHeader->RecordIndex = 0;
-
- return PacketHeader;
-}
-
-
-
-/**
- Initialize memory status code.
- Create one GUID'ed HOB with PCD defined size. If create required size
- GUID'ed HOB failed, then ASSERT().
-
- @return The function always return EFI_SUCCESS
-
-**/
-EFI_STATUS
-MemoryStatusCodeInitializeWorker (
- VOID
- )
-{
- //
- // Create first memory status code GUID'ed HOB.
- //
- CreateMemoryStatusCodePacket (0);
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Report status code into GUID'ed HOB..
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-MemoryStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance
- )
-{
-
- EFI_PEI_HOB_POINTERS Hob;
- MEMORY_STATUSCODE_PACKET_HEADER *PacketHeader;
- MEMORY_STATUSCODE_RECORD *Record = NULL;
- UINT16 PacketIndex = 0;;
-
- //
- // Journal GUID'ed HOBs to find empty record entry, if found, then save status code in it.
- // otherwise, create a new GUID'ed HOB.
- //
- Hob.Raw = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);
- while (Hob.Raw != NULL) {
- PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *) GET_GUID_HOB_DATA (Hob.Guid);
-
- //
- // Check whether pccket is full or not.
- //
- if (PacketHeader->RecordIndex < PacketHeader->MaxRecordsNumber) {
- Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);
- Record = &Record[PacketHeader->RecordIndex++];
- break;
- }
- //
- // Cache number of found packet in PacketIndex.
- //
- PacketIndex++;
-
- Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);
- }
-
- if (NULL == Record) {
- //
- // In order to save status code , create new packet.
- //
- PacketHeader = CreateMemoryStatusCodePacket (PacketIndex);
-
- Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);
- Record = &Record[PacketHeader->RecordIndex++];
- }
-
- Record->CodeType = CodeType;
- Record->Instance = Instance;
- Record->Value = Value;
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c b/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c
deleted file mode 100644
index d47be70..0000000
--- a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.c
+++ /dev/null
@@ -1,146 +0,0 @@
-
-/** @file
- Generic PeiStatusCode Module.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: PeiStatusCode.c
-
-**/
-
-#include "PeiStatusCode.h"
-
-STATIC
-EFI_PEI_PROGRESS_CODE_PPI mStatusCodePpi = {
- ReportDispatcher
- };
-
-STATIC
-EFI_PEI_PPI_DESCRIPTOR mStatusCodePpiDescriptor = {
- EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
- &gEfiPeiStatusCodePpiGuid,
- &mStatusCodePpi
- };
-
-/**
- Report status code to all supported device.
-
-
- @param PeiServices
-
- @param CodeType Indicates the type of status code being reported.
- The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
- @param Value Describes the current status of a hardware or software entity.
- This includes information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance
- information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- @param Data This optional parameter may be used to pass additional data.
- Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
- The contents of this data type may have additional GUID-specific data. The standard GUIDs and
- their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
-
- @return Always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-ReportDispatcher (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
- SerialStatusCodeReportWorker (
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
- MemoryStatusCodeReportWorker (
- CodeType,
- Value,
- Instance
- );
- }
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
- OemHookStatusCodeReport (
- CodeType,
- Value,
- Instance,
- CallerId,
- Data
- );
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Initialize PEI status codes and publish the status code
- PPI.
-
- @param FfsHeader FV this PEIM was loaded from.
- @param PeiServices General purpose services available to every PEIM.
-
- @return The function always returns success.
-
-**/
-EFI_STATUS
-PeiStatusCodeDriverEntry (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- )
-{
- EFI_STATUS Status;
-
- //
- // Dispatch initialization request to sub-statuscode-devices.
- // If enable UseSerial, then initialize serial port.
- // if enable UseMemory, then initialize memory status code worker.
- // if enable UseOEM, then initialize Oem status code.
- //
- if (FeaturePcdGet (PcdStatusCodeUseSerial)) {
- Status = SerialPortInitialize();
- ASSERT_EFI_ERROR (Status);
- }
- if (FeaturePcdGet (PcdStatusCodeUseMemory)) {
- Status = MemoryStatusCodeInitializeWorker ();
- ASSERT_EFI_ERROR (Status);
- }
- if (FeaturePcdGet (PcdStatusCodeUseOEM)) {
- Status = OemHookStatusCodeInitialize ();
- ASSERT_EFI_ERROR (Status);
- }
-
- //
- // Install PeiStatusCodePpi.
- // PeiServices use this Ppi to output status code.
- // use library
- Status = PeiServicesInstallPpi (&mStatusCodePpiDescriptor);
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
-
diff --git a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.h b/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.h
deleted file mode 100644
index 2a8e0dd..0000000
--- a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.h
+++ /dev/null
@@ -1,139 +0,0 @@
-
-/** @file
- Heade file of status code PEIM
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: PeiStatusCode.h
-
-**/
-
-#ifndef __PEI_STATUS_CODE_H__
-#define __PEI_STATUS_CODE_H__
-
-
-/**
- Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-SerialStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-
-/**
- Initialize memory status code.
- Create one GUID'ed HOB with PCD defined size. If create required size
- GUID'ed HOB failed, then ASSERT().
-
- @return The function always return EFI_SUCCESS
-
-**/
-EFI_STATUS
-MemoryStatusCodeInitializeWorker (
- VOID
- );
-
-/**
- Report status code into GUID'ed HOB.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-MemoryStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance
- );
-
-/**
- Report status code to all supported device.
-
-
- @param PeiServices
-
- @param Type Indicates the type of status code being reported.
- The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
- @param Value Describes the current status of a hardware or software entity.
- This includes information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance
- information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- @param Data This optional parameter may be used to pass additional data.
- Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below.
- The contents of this data type may have additional GUID-specific data. The standard GUIDs and
- their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.
-
- @return Always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-ReportDispatcher (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_STATUS_CODE_TYPE Type,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId OPTIONAL,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- );
-
-#endif
diff --git a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa b/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa
deleted file mode 100644
index d0cd00d..0000000
--- a/EdkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.msa
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd" xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>PeiStatusCode</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>1EC0F53A-FDE0-4576-8F25-7A1A410F58EB</GuidValue>
- <Version>1.0</Version>
- <Abstract>Generic Status code Pei driver</Abstract>
- <Description>Customized output devices based on feature flags.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>PeiStatusCode</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>SerialPortLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeiServicesLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>OemHookStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeimEntryPoint</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>PeiStatusCode.h</Filename>
- <Filename>SerialStatusCodeWorker.c</Filename>
- <Filename>MemoryStausCodeWorker.c</Filename>
- <Filename>PeiStatusCode.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <PPIs>
- <Ppi Usage="ALWAYS_CONSUMED">
- <PpiCName>gEfiPeiStatusCodePpiGuid</PpiCName>
- </Ppi>
- </PPIs>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gMemoryStatusCodeRecordGuid</GuidCName>
- </GuidCNames>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>PeiStatusCodeDriverEntry</ModuleEntryPoint>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseSerial</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseMemory</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="FEATURE_FLAG">
- <C_Name>PcdStatusCodeUseOEM</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdStatusCodeMemorySize</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText/>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c b/EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c
deleted file mode 100644
index 0e3f47e..0000000
--- a/EdkModulePkg/Universal/StatusCode/Pei/SerialStatusCodeWorker.c
+++ /dev/null
@@ -1,169 +0,0 @@
-
-/** @file
- Serial I/O status code reporting worker.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: SerialStatusCodeWorker.c
-
-**/
-
-#include "PeiStatusCode.h"
-
-/**
- Convert status code value and extended data to readable ASCII string, send string to serial I/O device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @return The function always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-SerialStatusCodeReportWorker (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- CHAR8 *Filename;
- CHAR8 *Description;
- CHAR8 *Format;
- CHAR8 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];
- UINT32 ErrorLevel;
- UINT32 LineNumber;
- UINTN CharCount;
- VA_LIST Marker;
- EFI_DEBUG_INFO *DebugInfo;
-
- Buffer[0] = '\0';
-
- if (Data != NULL &&
- ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {
- //
- // Print ASSERT() information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "\n\rPEI_ASSERT!: %a (%d): %a\n\r",
- Filename,
- LineNumber,
- Description
- );
- } else if (Data != NULL &&
- ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
- //
- // Print DEBUG() information into output buffer.
- //
- CharCount = AsciiVSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- Format,
- Marker
- );
- } else if (Data != NULL &&
- CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&
- (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {
- //
- // Print specific data into output buffer.
- //
- DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);
- Marker = (VA_LIST) (DebugInfo + 1);
- Format = (CHAR8 *) (((UINT64 *) Marker) + 12);
-
- CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {
- //
- // Print ERROR information into output buffer.
- //
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "ERROR: C%x:V%x I%x",
- CodeType,
- Value,
- Instance
- );
-
- //
- // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.
- //
-
- if (CallerId != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
- " %g",
- CallerId
- );
- }
-
- if (Data != NULL) {
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
- " %x",
- Data
- );
- }
-
- CharCount += AsciiSPrint (
- &Buffer[CharCount - 1],
- (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),
- "\n\r"
- );
- } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "PROGRESS CODE: V%x I%x\n\r",
- Value,
- Instance
- );
- } else {
- CharCount = AsciiSPrint (
- Buffer,
- EFI_STATUS_CODE_DATA_MAX_SIZE,
- "Undefined: C%x:V%x I%x\n\r",
- CodeType,
- Value,
- Instance
- );
- }
-
- //
- // Callout to SerialPort Lib function to do print.
- //
- SerialPortWrite ((UINT8 *) Buffer, CharCount);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.c b/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.c
deleted file mode 100644
index 0de1fca..0000000
--- a/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.c
+++ /dev/null
@@ -1,593 +0,0 @@
-/*++
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- DriverSample.c
-
-Abstract:
-
- This is an example of how a driver might export data to the HII protocol to be
- later utilized by the Setup Protocol
-
---*/
-
-#include "DriverSample.h"
-
-#define DISPLAY_ONLY_MY_ITEM 0x0001
-
-#define STRING_PACK_GUID \
- { \
- 0x8160a85f, 0x934d, 0x468b, { 0xa2, 0x35, 0x72, 0x89, 0x59, 0x14, 0xf6, 0xfc } \
- }
-
-EFI_GUID mFormSetGuid = FORMSET_GUID;
-EFI_GUID mStringPackGuid = STRING_PACK_GUID;
-
-STATIC
-EFI_STATUS
-EFIAPI
-DriverCallback (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *Data,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-
-Routine Description:
-
- This is the function that is called to provide results data to the driver. This data
- consists of a unique key which is used to identify what data is either being passed back
- or being asked for.
-
-Arguments:
-
- KeyValue - A unique value which is sent to the original exporting driver so that it
- can identify the type of data to expect. The format of the data tends to
- vary based on the op-code that geerated the callback.
-
- Data - A pointer to the data being sent to the original exporting driver.
-
-Returns:
-
---*/
-{
- EFI_CALLBACK_INFO *Private;
- EFI_HII_UPDATE_DATA *UpdateData;
- UINT8 *Location;
- EFI_HII_CALLBACK_PACKET *DataPacket;
- UINT16 Value;
- CHAR16 VariableName[40];
- STATIC UINT16 QuestionId = 0;
- IFR_OPTION *OptionList;
- UINTN Index;
- MyIfrNVData NVStruc;
-
- Private = EFI_CALLBACK_INFO_FROM_THIS (This);
-
- //
- // This should tell me the first offset AFTER the end of the compiled NV map
- // If op-code results are not going to be saved to NV locations ensure the QuestionId
- // is beyond the end of the NVRAM mapping.
- //
- if (QuestionId == 0) {
- QuestionId = sizeof (MyIfrNVData);
- }
-
- ZeroMem (VariableName, (sizeof (CHAR16) * 40));
-
- switch (KeyValue) {
- case 0x0001:
- //
- // Create a small boot order list
- //
- QuestionId = (UINT16) ((UINTN) (&NVStruc.BootOrder) - (UINTN) (&NVStruc));
-
- //
- // Need some memory for OptionList. Allow for up to 8 options.
- //
- OptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 8);
- ASSERT (OptionList != NULL);
-
- //
- // Allocate space for creation of Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- //
- // Remove all the op-codes starting with Label 0x2222 to next Label (second label is for convenience
- // so we don't have to keep track of how many op-codes we added or subtracted. The rules for removal
- // of op-codes are simply that the removal will always stop as soon as a label or the end of a form is
- // encountered. Therefore, giving a large obnoxious count such as below takes care of other complexities.
- //
- UpdateData->DataCount = 0xFF;
-
- //
- // Delete set of op-codes
- //
- Private->Hii->UpdateForm (
- Private->Hii,
- Private->RegisteredHandle,
- (EFI_FORM_LABEL) 0x2222,
- FALSE, // If we aren't adding, we are deleting
- UpdateData
- );
-
- //
- // Create 3 options
- //
- for (Index = 0; Index < 3; Index++) {
- OptionList[Index].StringToken = (UINT16) (STR_BOOT_OPTION1 + Index);
- OptionList[Index].Value = (UINT16) (Index + 1);
- OptionList[Index].Flags = RESET_REQUIRED;
- }
-
- CreateOrderedListOpCode (
- QuestionId, // Question ID
- 8, // Max Entries
- (UINT16) STRING_TOKEN (STR_BOOT_OPTIONS), // Token value for the Prompt
- (UINT16) STRING_TOKEN (STR_NULL_STRING), // Token value for the Help
- OptionList,
- 3,
- &UpdateData->Data // Buffer location to place op-codes
- );
-
- //
- // For one-of/ordered lists commands, they really consist of 2 op-codes (a header and a footer)
- // Each option within a one-of/ordered list is also an op-code
- // So this example has 5 op-codes it is adding since we have a one-of header + 3 options + one-of footer
- //
- UpdateData->DataCount = 0x5;
-
- //
- // Add one op-code
- //
- Private->Hii->UpdateForm (
- Private->Hii,
- Private->RegisteredHandle,
- (EFI_FORM_LABEL) 0x2222,
- TRUE,
- UpdateData
- );
-
- FreePool (UpdateData);
- FreePool (OptionList);
- break;
-
- case 0x0002:
- //
- // Create a large boot order list
- //
- QuestionId = (UINT16) ((UINTN) (&NVStruc.BootOrder) - (UINTN) (&NVStruc));
-
- //
- // Need some memory for OptionList. Allow for up to 8 options.
- //
- OptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 8);
- ASSERT (OptionList != NULL);
-
- //
- // Allocate space for creation of Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- //
- // Remove all the op-codes starting with Label 0x2222 to next Label (second label is for convenience
- // so we don't have to keep track of how many op-codes we added or subtracted
- //
- UpdateData->DataCount = 0xFF;
-
- //
- // Delete one op-code
- //
- Private->Hii->UpdateForm (
- Private->Hii,
- Private->RegisteredHandle,
- (EFI_FORM_LABEL) 0x2222,
- FALSE,
- UpdateData
- );
-
- //
- // Create 4 options
- //
- for (Index = 0; Index < 4; Index++) {
- OptionList[Index].StringToken = (UINT16) (STR_BOOT_OPTION1 + Index);
- OptionList[Index].Value = (UINT16) (Index + 1);
- OptionList[Index].Flags = RESET_REQUIRED;
- }
-
- CreateOrderedListOpCode (
- QuestionId, // Question ID
- 8, // Max Entries
- (UINT16) STRING_TOKEN (STR_BOOT_OPTIONS), // Token value for the Prompt
- (UINT16) STRING_TOKEN (STR_NULL_STRING), // Token value for the Help
- OptionList,
- 4,
- &UpdateData->Data // Buffer location to place op-codes
- );
-
- //
- // For one-of commands, they really consist of 2 op-codes (a header and a footer)
- // Each option within a one-of is also an op-code
- // So this example has 6 op-codes it is adding since we have a one-of header + 4 options + one-of footer
- //
- UpdateData->DataCount = 0x6;
-
- //
- // Add one op-code
- //
- Private->Hii->UpdateForm (
- Private->Hii,
- Private->RegisteredHandle,
- (EFI_FORM_LABEL) 0x2222,
- TRUE,
- UpdateData
- );
-
- FreePool (UpdateData);
- FreePool (OptionList);
- break;
-
- case 0x1234:
- //
- // Allocate space for creation of Buffer
- //
- QuestionId = (UINT16) ((UINTN) (&NVStruc.DynamicCheck) - (UINTN) (&NVStruc));
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- Location = (UINT8 *) &UpdateData->Data;
-
- UpdateData->FormSetUpdate = TRUE;
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->CallbackHandle;
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = 0;
- UpdateData->DataCount = 2;
-
- CreateGotoOpCode (
- 1,
- STR_GOTO_FORM1, // Token value for the Prompt
- 0, // Goto Help
- 0, // Flags
- 0, // Key
- &UpdateData->Data // Buffer location to place op-codes
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) &UpdateData->Data)->Length;
-
- CreateCheckBoxOpCode (
- QuestionId, // Question ID
- 1, // Data width (BOOLEAN = 1)
- (UINT16) STRING_TOKEN (STR_CHECK_DYNAMIC_PROMPT), // Token value for the Prompt
- (UINT16) STRING_TOKEN (STR_CHECK_DYNAMIC_HELP), // Token value for the Help
- EFI_IFR_FLAG_INTERACTIVE, // Flags
- 0x1236, // Key
- Location // Buffer location to place op-codes
- );
-
- Private->Hii->UpdateForm (
- Private->Hii,
- Private->RegisteredHandle,
- (EFI_FORM_LABEL) 0x1234,
- TRUE,
- UpdateData
- );
-
- FreePool (UpdateData);
- QuestionId++;
- break;
-
- case 0x1235:
- //
- // Allocate space for creation of Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- //
- // Initialize DataPacket with information intended to remove all
- // previously created op-codes in the dynamic page
- //
- UpdateData->FormSetUpdate = FALSE;
- UpdateData->FormCallbackHandle = 0;
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = 0;
- //
- // Unlikely to be more than 0xff op-codes in the dynamic page to remove
- //
- UpdateData->DataCount = 0xff;
- UpdateData->Data = NULL;
-
- //
- // Remove all op-codes from dynamic page
- //
- Private->Hii->UpdateForm (
- Private->Hii,
- Private->RegisteredHandle,
- (EFI_FORM_LABEL) 0x1234, // Label 0x1234
- FALSE, // Remove Op-codes (will never remove form/endform)
- UpdateData // Significant value is UpdateData->DataCount
- );
-
- UpdateData->FormSetUpdate = FALSE;
- UpdateData->FormCallbackHandle = 0;
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = 0;
- UpdateData->DataCount = 1;
-
- CreateGotoOpCode (
- 1,
- STR_GOTO_FORM1, // Token value for the Prompt
- 0, // Goto Help
- 0, // Flags
- 0, // Key
- &UpdateData->Data // Buffer location to place op-codes
- );
-
- Private->Hii->UpdateForm (
- Private->Hii,
- Private->RegisteredHandle,
- (EFI_FORM_LABEL) 0x1234,
- TRUE,
- UpdateData
- );
-
- FreePool (UpdateData);
- break;
-
- case 0x1236:
- //
- // If I hit the checkbox, I enter this case statement...
- //
- //
- // Since I am returning an error (for test purposes) I need to pass in the string for the error
- // I will allocate space for the return value. If an error occurs (which is the case) I can simply return
- // an error and fill in the string parameter, otherwise, I will return information in the DataArray structure.
- // The browser will free this packet structure
- //
- *Packet = AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + sizeof (SAMPLE_STRING) + 2);
- ASSERT (*Packet != NULL);
-
- //
- // Assign the buffer address to DataPacket
- //
- DataPacket = *Packet;
-
- StrCpy (DataPacket->String, (CHAR16 *) SAMPLE_STRING);
- return EFI_DEVICE_ERROR;
-
- case 0x1237:
-
- *Packet = AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + 2);
- ASSERT (*Packet != NULL);
-
- //
- // Assign the buffer address to DataPacket
- //
- DataPacket = *Packet;
-
- DataPacket->DataArray.EntryCount = 1;
- DataPacket->DataArray.NvRamMap = NULL;
- ((EFI_IFR_DATA_ENTRY *) (&DataPacket->DataArray + 1))->Flags = EXIT_REQUIRED;
- break;
-
- case 0x1555:
- Value = 0x0001;
- UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);
-
- gRT->SetVariable (
- VariableName,
- &mFormSetGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 2,
- (VOID *) &Value
- );
- break;
-
- case 0x1556:
- Value = 0x1000;
- UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);
-
- gRT->SetVariable (
- VariableName,
- &mFormSetGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 2,
- (VOID *) &Value
- );
- break;
-
- case 0x1557:
- Value = 0x0000;
- UnicodeSPrint (VariableName, 0x80, (CHAR16 *) L"%d", VAR_EQ_TEST_NAME);
-
- gRT->SetVariable (
- VariableName,
- &mFormSetGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 2,
- (VOID *) &Value
- );
- break;
-
- default:
- break;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-DriverSampleInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
- EFI_HII_PROTOCOL *Hii;
- //
- // EFI_FORM_BROWSER_PROTOCOL *FormConfig;
- //
- EFI_HII_PACKAGES *PackageList;
- EFI_HII_HANDLE HiiHandle;
- STRING_REF TokenToUpdate;
- STRING_REF TokenToUpdate2;
- STRING_REF TokenToUpdate3;
- CHAR16 *NewString;
- EFI_HII_UPDATE_DATA *UpdateData;
- EFI_CALLBACK_INFO *CallbackInfo;
- EFI_HANDLE Handle;
- EFI_SCREEN_DESCRIPTOR Screen;
-
- ZeroMem (&Screen, sizeof (EFI_SCREEN_DESCRIPTOR));
-
- gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &Screen.RightColumn, &Screen.BottomRow);
-
- //
- // Remove 3 characters from top and bottom
- //
- Screen.TopRow = 3;
- Screen.BottomRow = Screen.BottomRow - 3;
-
- //
- // There should only be one HII protocol
- //
- Status = gBS->LocateProtocol (
- &gEfiHiiProtocolGuid,
- NULL,
- (VOID **) &Hii
- );
- if (EFI_ERROR (Status)) {
- return Status;;
- }
-
- CallbackInfo = AllocatePool (sizeof (EFI_CALLBACK_INFO));
- if (CallbackInfo == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- CallbackInfo->Signature = EFI_CALLBACK_INFO_SIGNATURE;
- CallbackInfo->Hii = Hii;
-
- //
- // This example does not implement worker functions for the NV accessor functions. Only a callback evaluator
- //
- CallbackInfo->DriverCallback.NvRead = NULL;
- CallbackInfo->DriverCallback.NvWrite = NULL;
- CallbackInfo->DriverCallback.Callback = DriverCallback;
-
- //
- // Install protocol interface
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &CallbackInfo->DriverCallback
- );
-
- ASSERT_EFI_ERROR (Status);
-
- CallbackInfo->CallbackHandle = Handle;
-
- PackageList = PreparePackages (1, &mStringPackGuid, DriverSampleStrings);
- Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
- FreePool (PackageList);
-
- PackageList = PreparePackages (1, &mStringPackGuid, InventoryBin);
- Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
- FreePool (PackageList);
-
- PackageList = PreparePackages (1, &mStringPackGuid, VfrBin);
- Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
- FreePool (PackageList);
-
- CallbackInfo->RegisteredHandle = HiiHandle;
-
- //
- // Very simple example of how one would update a string that is already
- // in the HII database
- //
- TokenToUpdate = (STRING_REF) STR_CPU_STRING2;
- NewString = (CHAR16 *) L"700 Mhz";
-
- Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate, NewString);
-
- //
- // Add a string - if 0 will be updated with new Token number
- //
- TokenToUpdate = (STRING_REF) 0;
-
- //
- // Add a string - if 0 will be updated with new Token number
- //
- TokenToUpdate2 = (STRING_REF) 0;
-
- //
- // Add a string - if 0 will be updated with new Token number
- //
- TokenToUpdate3 = (STRING_REF) 0;
-
- Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate, (CHAR16 *) L"Desired Speed");
- Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate2, (CHAR16 *) L"5 Thz");
- Hii->NewString (Hii, NULL, HiiHandle, &TokenToUpdate3, (CHAR16 *) L"This is next year's desired speed - right?");
-
- //
- // Allocate space for creation of Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- //
- // Flag update pending in FormSet
- //
- UpdateData->FormSetUpdate = TRUE;
- //
- // Register CallbackHandle data for FormSet
- //
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackInfo->CallbackHandle;
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = 0;
- UpdateData->DataCount = 1;
-
- CreateTextOpCode (TokenToUpdate, TokenToUpdate2, TokenToUpdate3, 0, 0, &UpdateData->Data);
-
- Hii->UpdateForm (Hii, HiiHandle, (EFI_FORM_LABEL) 100, TRUE, UpdateData);
-
- FreePool (UpdateData);
-
- //
- // Example of how to display only the item we sent to HII
- //
- if (DISPLAY_ONLY_MY_ITEM == 0x0001) {
- //
- // Have the browser pull out our copy of the data, and only display our data
- //
- // Status = FormConfig->SendForm (FormConfig, TRUE, HiiHandle, NULL, NULL, NULL, &Screen, NULL);
- //
- } else {
- //
- // Have the browser pull out all the data in the HII Database and display it.
- //
- // Status = FormConfig->SendForm (FormConfig, TRUE, 0, NULL, NULL, NULL, NULL, NULL);
- //
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.dxs b/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.dxs
deleted file mode 100644
index ae2a1c0..0000000
--- a/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++
-
-Copyright (c) 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DriverSample.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.h b/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.h
deleted file mode 100644
index b1534e8..0000000
--- a/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DriverSample.h
-
-Abstract:
-
-
-Revision History
-
---*/
-
-#ifndef _DRIVER_SAMPLE_H
-#define _DRIVER_SAMPLE_H
-
-
-#include "NVDataStruc.h"
-
-//
-// This is the generated header file which includes whatever needs to be exported (strings + IFR)
-//
-#include "DriverSampleStrDefs.h"
-
-extern UINT8 VfrBin[];
-//
-// extern UINT8 VfrStringsStr[];
-//
-extern UINT8 InventoryBin[];
-//
-// extern UINT8 InventoryStringsStr[];
-//
-extern UINT8 DriverSampleStrings[];
-
-#define SAMPLE_STRING L"This is an error!"
-
-#define EFI_CALLBACK_INFO_SIGNATURE EFI_SIGNATURE_32 ('C', 'l', 'b', 'k')
-
-typedef struct {
- UINTN Signature;
- EFI_HANDLE CallbackHandle;
- EFI_FORM_CALLBACK_PROTOCOL DriverCallback;
- UINT16 *KeyList;
- VOID *FormBuffer;
- EFI_HII_HANDLE RegisteredHandle;
- EFI_HII_PROTOCOL *Hii;
-} EFI_CALLBACK_INFO;
-
-#define EFI_CALLBACK_INFO_FROM_THIS(a) CR (a, EFI_CALLBACK_INFO, DriverCallback, EFI_CALLBACK_INFO_SIGNATURE)
-
-#endif
diff --git a/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.msa b/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.msa
deleted file mode 100644
index 4c96b5e..0000000
--- a/EdkModulePkg/Universal/UserInterface/DriverSample/DriverSample.msa
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>DriverSample</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>FE3542FE-C1D3-4EF8-657C-8048606FF670</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for DriverSample module.</Abstract>
- <Description>This is an example driver to introduce how to export data to the HII protocol to be later utilized by the Setup Protocol. </Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DriverSample</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3">
- <Keyword>PrintLib</Keyword>
- <HelpText>Recommended libary Instance is BasePrintLib instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkIfrSupportLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HiiLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>InventoryStrings.uni</Filename>
- <Filename>Inventory.vfr</Filename>
- <Filename>VfrStrings.uni</Filename>
- <Filename>Vfr.vfr</Filename>
- <Filename>DriverSample.c</Filename>
- <Filename>NVDataStruc.h</Filename>
- <Filename>DriverSample.h</Filename>
- <Filename>DriverSample.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiFormCallbackProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <HiiPackages>
- <HiiPackage Usage="ALWAYS_PRODUCED">
- <HiiCName>DriverSampleStrings</HiiCName>
- <HelpText>EFI_HII_STRING type string package from UNI file.</HelpText>
- </HiiPackage>
- <HiiPackage Usage="ALWAYS_PRODUCED">
- <HiiCName>InventoryBin</HiiCName>
- <HelpText>EFI_HII_IFR type form package from VFR file.</HelpText>
- </HiiPackage>
- <HiiPackage Usage="ALWAYS_PRODUCED">
- <HiiCName>VfrBin</HiiCName>
- <HelpText>EFI_HII_IFR type form package from VFR file.</HelpText>
- </HiiPackage>
- </HiiPackages>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>DriverSampleInit</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/UserInterface/DriverSample/Inventory.vfr b/EdkModulePkg/Universal/UserInterface/DriverSample/Inventory.vfr
deleted file mode 100644
index ff8a6aa..0000000
--- a/EdkModulePkg/Universal/UserInterface/DriverSample/Inventory.vfr
+++ /dev/null
@@ -1,123 +0,0 @@
-// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// Inventory.vfr
-//
-// Abstract:
-//
-// Sample Inventory Data.
-//
-// Revision History:
-//
-// --*/
-
-#include "DriverSampleStrDefs.h"
-
-#define INVENTORY_GUID { 0xb3f56470, 0x6141, 0x4621, { 0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8 } }
-
-formset
- guid = INVENTORY_GUID,
- title = STRING_TOKEN(STR_INV_FORM_SET_TITLE),
- help = STRING_TOKEN(STR_INV_FORM_SET_HELP),
- class = 0x04,
- subclass = 0x03,
-
- form formid = 1,
- title = STRING_TOKEN(STR_INV_FORM1_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
-
- text
- help = STRING_TOKEN(STR_INV_VERSION_HELP),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- text
- help = STRING_TOKEN(STR_INV_EMPTY_STRING),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT2),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- text
- help = STRING_TOKEN(STR_INV_EMPTY_STRING),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT3),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- text
- help = STRING_TOKEN(STR_INV_EMPTY_STRING),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT4),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- subtitle text = STRING_TOKEN(STR_INV_EMPTY_STRING);
-
- text
- help = STRING_TOKEN(STR_INV_EMPTY_STRING),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT5),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- text
- help = STRING_TOKEN(STR_INV_EMPTY_STRING),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT6),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- text
- help = STRING_TOKEN(STR_INV_EMPTY_STRING),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT7),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- text
- help = STRING_TOKEN(STR_INV_EMPTY_STRING),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT8),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- text
- help = STRING_TOKEN(STR_INV_EMPTY_STRING),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT9),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- text
- help = STRING_TOKEN(STR_INV_EMPTY_STRING),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT10),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- text
- help = STRING_TOKEN(STR_INV_EMPTY_STRING),
- text = STRING_TOKEN(STR_INV_VERSION_TEXT11),
- text = STRING_TOKEN(STR_INV_EMPTY_STRING),
- flags = 0,
- key = 0;
-
- subtitle text = STRING_TOKEN(STR_INV_EMPTY_STRING);
-
- subtitle text = STRING_TOKEN(STR_INV_VERSION_TEXT12);
-
- endform;
-
-endformset;
diff --git a/EdkModulePkg/Universal/UserInterface/DriverSample/InventoryStrings.uni b/EdkModulePkg/Universal/UserInterface/DriverSample/InventoryStrings.uni
deleted file mode 100644
index 4946b4a..0000000
--- a/EdkModulePkg/Universal/UserInterface/DriverSample/InventoryStrings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkModulePkg/Universal/UserInterface/DriverSample/NVDataStruc.h b/EdkModulePkg/Universal/UserInterface/DriverSample/NVDataStruc.h
deleted file mode 100644
index 01369eb..0000000
--- a/EdkModulePkg/Universal/UserInterface/DriverSample/NVDataStruc.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- NVDataStruc.h
-
-Abstract:
-
- NVData structure used by the sample driver
-
-Revision History:
-
---*/
-
-#ifndef _NVDATASTRUC_H
-#define _NVDATASTRUC_H
-
-#define FORMSET_GUID \
- { \
- 0xA04A27f4, 0xDF00, 0x4D42, { 0xB5, 0x52, 0x39, 0x51, 0x13, 0x02, 0x11, 0x3D } \
- }
-
-#define INVENTORY_GUID \
- { \
- 0xb3f56470, 0x6141, 0x4621, { 0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8 } \
- }
-
-#define VAR_EQ_TEST_NAME 0x100
-
-#pragma pack(1)
-typedef struct {
- UINT16 WhatIsThePassword[20];
- UINT16 WhatIsThePassword2[20];
- UINT16 MyStringData[20];
- UINT16 SomethingHiddenForHtml;
- UINT8 HowOldAreYouInYearsManual;
- UINT16 HowTallAreYouManual;
- UINT8 HowOldAreYouInYears;
- UINT16 HowTallAreYou;
- UINT8 MyFavoriteNumber;
- UINT8 TestLateCheck;
- UINT8 TestLateCheck2;
- UINT8 QuestionAboutTreeHugging;
- UINT8 ChooseToActivateNuclearWeaponry;
- UINT8 SuppressGrayOutSomething;
- UINT8 OrderedList[8];
- UINT8 BootOrder[8];
- UINT8 BootOrderLarge;
- UINT8 DynamicCheck;
-} MyIfrNVData;
-#pragma pack()
-
-#endif
diff --git a/EdkModulePkg/Universal/UserInterface/DriverSample/Vfr.vfr b/EdkModulePkg/Universal/UserInterface/DriverSample/Vfr.vfr
deleted file mode 100644
index 6509a66..0000000
--- a/EdkModulePkg/Universal/UserInterface/DriverSample/Vfr.vfr
+++ /dev/null
@@ -1,622 +0,0 @@
-// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// Vfr.vfr
-//
-// Abstract:
-//
-// Sample Setup formset
-//
-// Revision History:
-//
-// --*/
-
-
-#include "DriverSampleStrDefs.h"
-
-#include "NVDataStruc.h"
-
-
-typedef struct {
- UINT8 Field8;
- UINT16 Field16;
- UINT8 OrderedList[3];
-} MyIfrNVData2;
-
-typedef struct {
- UINT8 Field8;
- UINT16 Field16;
- UINT8 OrderedList[3];
-} MyIfrNVData3;
-
-#define MY_TEXT_KEY 0x100
-
-#define LABEL_1_VALUE 0x01
-#define LABEL_2_VALUE 0x1000
-#define LABEL_UPDATE_BBS 0x2222
-#define LABEL_END_UPDATE_BBS 0x2223
-
-formset
- guid = FORMSET_GUID,
- title = STRING_TOKEN(STR_FORM_SET_TITLE),
- help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
- class = 0x10,
- subclass = 0,
-
- varstore MyIfrNVData2, key = 0x1234, name = MY_DATA2, guid = FORMSET_GUID;
-
-
- varstore MyIfrNVData3, key = 0x4321, name = MY_DATA3, guid = FORMSET_GUID;
-
- form formid = 1,
- title = STRING_TOKEN(STR_FORM1_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
-
- subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
-
- subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
-
- banner
- title = STRING_TOKEN(STR_BANNER_TITLE),
- line 1,
- align center;
-
- banner
- title = STRING_TOKEN(STR_BANNER_TITLE),
- line 2,
- align left;
-
- banner
- title = STRING_TOKEN(STR_BANNER_TITLE),
- line 2,
- align right;
-
- text
- help = STRING_TOKEN(STR_TEXT_HELP),
- text = STRING_TOKEN(STR_CPU_STRING),
- text = STRING_TOKEN(STR_CPU_STRING2),
- flags = 0,
- key = 0;
-
- text
- help = STRING_TOKEN(STR_EXIT_TEXT),
- text = STRING_TOKEN(STR_EXIT_TEXT),
- text = STRING_TOKEN(STR_EXIT_TEXT),
- flags = INTERACTIVE,
- key = 0x1237;
-
- oneof varid = MyIfrNVData.SuppressGrayOutSomething,
- prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
- help = STRING_TOKEN(STR_ONE_OF_HELP),
- option text = STRING_TOKEN(STR_ONE_OF_TEXT4), value = 0x0, flags = 0;
- option text = STRING_TOKEN(STR_ONE_OF_TEXT5), value = 0x1, flags = 0;
- option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
- endoneof;
-
- oneof varid = MyIfrNVData.BootOrderLarge,
- prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
- help = STRING_TOKEN(STR_ONE_OF_HELP),
- option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = INTERACTIVE, key = 1;
- option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = INTERACTIVE | DEFAULT, key = 2;
- endoneof;
-
- grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
- suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
- label 0;
- checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
- prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
- help = STRING_TOKEN(STR_CHECK_BOX_HELP),
- flags = 1, // Flags behavior for checkbox is overloaded so that it equals a DEFAULT value. 1 = ON, 0 = off
- key = 0,
- endcheckbox;
- endif;
-
-
- //
- // Ordered list:
- // sizeof(MyIfrNVData) storage must be UINT8 array, and
- // size written for the variable must be size of the entire
- // variable.
- //
- //
- suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
- label LABEL_UPDATE_BBS;
- orderedlist
- varid = MyIfrNVData.BootOrder,
- prompt = STRING_TOKEN(STR_BOOT_OPTIONS),
- help = STRING_TOKEN(STR_NULL_STRING),
- option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = RESET_REQUIRED;
- option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED;
- option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED;
- option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = RESET_REQUIRED;
- endlist;
- label LABEL_END_UPDATE_BBS;
- endif;
-
- suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
- orderedlist
- varid = MyIfrNVData.OrderedList,
- prompt = STRING_TOKEN(STR_TEST_OPCODE),
- help = STRING_TOKEN(STR_TEXT_HELP),
- option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 4, flags = RESET_REQUIRED;
- option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 3, flags = RESET_REQUIRED;
- option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 2, flags = RESET_REQUIRED;
- option text = STRING_TOKEN(STR_TEXT_HELP), value = 1, flags = RESET_REQUIRED;
- endlist;
- endif;
-
- label 100;
-
- goto 0x1234,
- prompt = STRING_TOKEN(STR_GOTO_DYNAMIC),
- help = STRING_TOKEN(STR_GOTO_HELP),
- flags = INTERACTIVE,
- key = 0x1234;
-
- goto 0x1234,
- prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
- help = STRING_TOKEN(STR_GOTO_HELP),
- flags = INTERACTIVE,
- key = 0x1235;
-
- //
- // VARSTORE tests
- //
- // Till now, been using variable NvData (must be reserved)
- // now we do a varselect for variable NvData3
- inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
- ideqid MyIfrNVData3.Field16 == MyIfrNVData3.Field16
- endif;
- // now we do a varselect_pair for variable NvData2 and NvData3
- inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
- ideqid MyIfrNVData2.Field16 == MyIfrNVData3.Field16
- endif;
-
-
- // now we do a varselect_pair for variable NvData and NvData2
-// inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
-// ideqid MyIfrNVData2.Field16 == MyIfrNVData.TestLateCheck
-// endif;
-
- inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
- ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
- endif;
-
- oneof varid = MyIfrNVData.TestLateCheck,
- prompt = STRING_TOKEN(STR_TEST_OPCODE),
- help = STRING_TOKEN(STR_ONE_OF_HELP),
- option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = LATE_CHECK | RESET_REQUIRED;
- option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = LATE_CHECK | DEFAULT | RESET_REQUIRED;
- endoneof;
-
- oneof varid = MyIfrNVData.TestLateCheck2,
- prompt = STRING_TOKEN(STR_TEST_OPCODE2),
- help = STRING_TOKEN(STR_ONE_OF_HELP),
- option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = LATE_CHECK | DEFAULT | RESET_REQUIRED;
- option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = LATE_CHECK | RESET_REQUIRED;
-
- endoneof;
-
- oneof varid = MyIfrNVData.QuestionAboutTreeHugging,
- prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
- help = STRING_TOKEN(STR_ONE_OF_HELP),
- option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
- option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
- option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 0x03, flags = RESET_REQUIRED;
-
- endoneof;
-
- string varid = MyIfrNVData.MyStringData,
- prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
- help = STRING_TOKEN(STR_MY_STRING_HELP2),
- flags = INTERACTIVE,
- key = 0x1234,
- minsize = 6,
- maxsize = 0x14,
- endstring;
-
- text
- help = STRING_TOKEN(STR_GRAYOUT_TEST),
- text = STRING_TOKEN(STR_GRAYOUT_TEST),
- text = STRING_TOKEN(STR_GRAYOUT_TEST),
- flags = INTERACTIVE,
- key = 0x1555;
-
- text
- help = STRING_TOKEN(STR_SUPPRESS_TEST),
- text = STRING_TOKEN(STR_SUPPRESS_TEST),
- text = STRING_TOKEN(STR_SUPPRESS_TEST),
- flags = INTERACTIVE,
- key = 0x1556;
-
- text
- help = STRING_TOKEN(STR_CLEAR_TEST),
- text = STRING_TOKEN(STR_CLEAR_TEST),
- text = STRING_TOKEN(STR_CLEAR_TEST),
- flags = INTERACTIVE,
- key = 0x1557;
-
- grayoutif vareqval var(VAR_EQ_TEST_NAME) == 0x1;
- suppressif vareqval var(VAR_EQ_TEST_NAME) == 0x1000;
- label 30;
- checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
- prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
- help = STRING_TOKEN(STR_CHECK_BOX_HELP),
- flags = 1,
- key = 0,
- endcheckbox;
- endif;
-
-
- numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
- prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
- help = STRING_TOKEN(STR_NUMERIC_HELP0),
- minimum = 0,
- maximum = 0xf0, // 0xf0 = 240 in decimal
- step = 0, // Stepping of 0 equates to a manual entering
- // of a value, otherwise it will auto-increment
- // with a left/right arrow
- default = 21,
-
- endnumeric;
-
- numeric varid = MyIfrNVData.HowTallAreYouManual,
- prompt = STRING_TOKEN(STR_TALL_MANUAL_PROMPT),
- help = STRING_TOKEN(STR_NUMERIC_HELP1),
- minimum = 0,
- maximum = 300,
- step = 0, // Stepping of 0 equates to a manual entering
- // of a value, otherwise it will auto-increment
- // with a left/right arrow
- default = 175,
-
- endnumeric;
-
- inventory
- help = STRING_TOKEN(STR_INVENTORY_HELP),
- text = STRING_TOKEN(STR_INVENTORY_TEXT1),
- text = STRING_TOKEN(STR_INVENTORY_TEXT2);
-
-
- restore defaults,
- formid = 4,
- prompt = STRING_TOKEN(STR_RESTORE_DEFAULTS_PROMPT),
- help = STRING_TOKEN(STR_RESTORE_DEFAULTS_HELP),
- flags = 0,
- key = 0;
-
- save defaults,
- formid = 4,
- prompt = STRING_TOKEN(STR_SAVE_DEFAULTS_PROMPT),
- help = STRING_TOKEN(STR_SAVE_DEFAULTS_HELP),
- flags = 0,
- key = 0;
-
- //
- // Case with no flags or key
- //
- save defaults,
- formid = 4,
- prompt = STRING_TOKEN(STR_SAVE_DEFAULTS_PROMPT),
- help = STRING_TOKEN(STR_SAVE_DEFAULTS_HELP);
- //
- // Case with no key
- //
- save defaults,
- formid = 4,
- prompt = STRING_TOKEN(STR_SAVE_DEFAULTS_PROMPT),
- help = STRING_TOKEN(STR_SAVE_DEFAULTS_HELP),
- flags = 0;
- //
- // Case with no flags
- //
- save defaults,
- formid = 4,
- prompt = STRING_TOKEN(STR_SAVE_DEFAULTS_PROMPT),
- help = STRING_TOKEN(STR_SAVE_DEFAULTS_HELP),
- key = 0;
-
- label LABEL_2_VALUE;
-
- grayoutif ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
- numeric varid = MyIfrNVData.HowOldAreYouInYears,
- prompt = STRING_TOKEN(STR_NUMERIC_PROMPT),
- help = STRING_TOKEN(STR_NUMERIC_HELP2),
- minimum = 0,
- maximum = 243,
- step = 3,
- default = 18,
-
- endnumeric;
-
- label LABEL_1_VALUE;
-
- //
- // Numeric with no step or default specified
- //
- numeric varid = MyIfrNVData.HowTallAreYou,
- prompt = STRING_TOKEN(STR_NUMERIC_PROMPT1),
- help = STRING_TOKEN(STR_NUMERIC_HELP3),
- minimum = 0,
- maximum = 190,
- // step = 1, // Stepping of 1 if not specified
- // default = minimum; // if not specified
- endnumeric;
- endif;
-
- string varid = MyIfrNVData.MyStringData,
- prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
- help = STRING_TOKEN(STR_MY_STRING_HELP),
- minsize = 6,
- maxsize = 0x14,
- endstring;
-
- password varid = MyIfrNVData.WhatIsThePassword,
- prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
- help = STRING_TOKEN(STR_PASSWORD_HELP),
- minsize = 6,
- maxsize = 20, // new opcode
- encoding = 1,
- endpassword;
- password varid = MyIfrNVData.WhatIsThePassword2,
- prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
- help = STRING_TOKEN(STR_PASSWORD_HELP),
- minsize = 6,
- maxsize = 20, // new opcode
- encoding = 1,
- endpassword;
- //
- // Test with flags and key fields
- //
- password varid = MyIfrNVData.WhatIsThePassword,
- prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
- help = STRING_TOKEN(STR_PASSWORD_HELP),
- flags = INTERACTIVE,
- key = 0x2000,
- minsize = 6,
- maxsize = 20, // new opcode
- encoding = 1,
- endpassword;
-
- goto 2,
- prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
- help = STRING_TOKEN(STR_GOTO_HELP);
-
- goto 3,
- prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage // this too has no end-op and basically it's a jump to a form ONLY
- help = STRING_TOKEN(STR_GOTO_HELP);
-
- endform;
-
- form formid = 2, // SecondSetupPage,
- title = STRING_TOKEN(STR_FORM2_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
-
-
- date year varid = Date.Year, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_DATE_PROMPT),
- help = STRING_TOKEN(STR_DATE_YEAR_HELP),
- minimum = 1998,
- maximum = 2099,
- step = 1,
- default = 2004,
-
- month varid = Date.Month, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_DATE_PROMPT),
- help = STRING_TOKEN(STR_DATE_MONTH_HELP),
- minimum = 1,
- maximum = 12,
- step = 1,
- default = 1,
-
- day varid = Date.Day, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_DATE_PROMPT),
- help = STRING_TOKEN(STR_DATE_DAY_HELP),
- minimum = 1,
- maximum = 31,
- step = 0x1,
- default = 1,
-
- enddate;
-
- time hour varid = Time.Hours, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_TIME_PROMPT),
- help = STRING_TOKEN(STR_TIME_HOUR_HELP),
- minimum = 0,
- maximum = 23,
- step = 1,
- default = 0,
-
- minute varid = Time.Minutes, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_TIME_PROMPT),
- help = STRING_TOKEN(STR_TIME_MINUTE_HELP),
- minimum = 0,
- maximum = 59,
- step = 1,
- default = 0,
-
- second varid = Time.Seconds, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_TIME_PROMPT),
- help = STRING_TOKEN(STR_TIME_SECOND_HELP),
- minimum = 0,
- maximum = 59,
- step = 1,
- default = 0,
-
- endtime;
-
- date year varid = Date.Year, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_DATE_PROMPT),
- help = STRING_TOKEN(STR_DATE_YEAR_HELP),
- minimum = 1939,
- maximum = 2101,
- step = 1,
- default = 1964,
-
- month varid = Date.Month, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_DATE_PROMPT),
- help = STRING_TOKEN(STR_DATE_MONTH_HELP),
- minimum = 1,
- maximum = 12,
- step = 1,
- default = 1,
-
- day varid = Date.Day, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_DATE_PROMPT),
- help = STRING_TOKEN(STR_DATE_DAY_HELP),
- minimum = 1,
- maximum = 31,
- step = 0x1,
- default = 1,
-
- enddate;
-
- time hour varid = Time.Hours, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_TIME_PROMPT),
- help = STRING_TOKEN(STR_TIME_HOUR_HELP),
- minimum = 0,
- maximum = 23,
- step = 1,
- default = 0,
-
- minute varid = Time.Minutes, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_TIME_PROMPT),
- help = STRING_TOKEN(STR_TIME_MINUTE_HELP),
- minimum = 0,
- maximum = 59,
- step = 1,
- default = 0,
-
- second varid = Time.Seconds, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
- prompt = STRING_TOKEN(STR_TIME_PROMPT),
- help = STRING_TOKEN(STR_TIME_SECOND_HELP),
- minimum = 0,
- maximum = 59,
- step = 1,
- default = 0,
-
- endtime;
-
- grayoutif
- ideqval Date.Day == 21
- AND
- ideqval Date.Month == 8;
-
- hidden value = 32, key = 0x7777;
-
- endif; // grayoutif
-
- suppressif
- ideqval Date.Day == 8
- AND
- ideqval Date.Month == 21;
-
- hidden value = 32, key = 0x7777;
-
- endif; // suppressif
-
-
- hidden value = 32, key = 0x1234;
-
- inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
- ideqval MyIfrNVData.HowOldAreYouInYearsManual == 4
- endif;
-
- inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
- ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 2 3 4
- endif;
-
- inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
- ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyIfrNVData.MyFavoriteNumber
- endif;
-
-// grayoutif
-//
-// If the day is 31 AND months is any of the following 2, 4, 6, 9, 11
-//
- inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
- ideqval Date.Day == 31
- AND
- ideqvallist Date.Month == 2 4 6 9 11
- endif;
-
-//
-// If the day is 30 AND month is 2
-//
- inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
- ideqval Date.Day == 30
- AND
- ideqval Date.Month == 2
- endif;
-
-//
-// If the day is 29 AND month is 2 AND it year is NOT a leapyear
-//
- inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
- ideqval Date.Day == 0x1D
- AND
- ideqval Date.Month == 2
- AND
- NOT
- ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
- endif;
-
- checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
- prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
- help = STRING_TOKEN(STR_CHECK_BOX_HELP),
- flags = 1,
- key = 0,
- endcheckbox;
-
- text
- help = STRING_TOKEN(STR_TEXT_HELP),
- text = STRING_TOKEN(STR_TEXT_TEXT_1);
-
- text
- help = STRING_TOKEN(STR_TEXT_HELP),
- text = STRING_TOKEN(STR_TEXT_TEXT_1),
- text = STRING_TOKEN(STR_TEXT_TEXT_2),
- flags = 0,
- key = MY_TEXT_KEY;
-
- goto 1,
- prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage // this too has no end-op and basically it's a jump to a form ONLY
- help = STRING_TOKEN(STR_GOTO_HELP);
-
- endform;
-
- form formid = 3, title = STRING_TOKEN(STR_FORM3_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
-
- grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
- text
- help = STRING_TOKEN(STR_TEXT_HELP),
- text = STRING_TOKEN(STR_TEXT_TEXT_1);
-
- endif; //end grayoutif
-
- text
- help = STRING_TOKEN(STR_TEXT_HELP),
- text = STRING_TOKEN(STR_TEXT_TEXT_1);
-
- endform;
-
- form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE);
-
- endform;
-
- form formid = 0x1234, // Dynamically created page,
- title = STRING_TOKEN(STR_DYNAMIC_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
-
- label 0x1234;
-
- endform;
-
-endformset;
diff --git a/EdkModulePkg/Universal/UserInterface/DriverSample/VfrStrings.uni b/EdkModulePkg/Universal/UserInterface/DriverSample/VfrStrings.uni
deleted file mode 100644
index 9e9dbf5..0000000
--- a/EdkModulePkg/Universal/UserInterface/DriverSample/VfrStrings.uni
+++ /dev/null
Binary files differ
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Fonts.c b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Fonts.c
deleted file mode 100644
index ebab3bc..0000000
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Fonts.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Fonts.c
-
-Abstract:
-
- This file contains the Glyph/Font processing code to the HII database.
-
---*/
-
-
-#include "HiiDatabase.h"
-
-//
-// We only need to define a wide glyph, since we will seed the narrow glyph with EFI_NARROW_GLYPH size of
-// this data structure
-//
-UINT8 mUnknownGlyph[38] = {
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xAA,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xaa,
- 0x55,
- 0xAA
-};
-
-EFI_STATUS
-EFIAPI
-HiiGetGlyph (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *Source,
- IN OUT UINT16 *Index,
- OUT UINT8 **GlyphBuffer,
- OUT UINT16 *BitWidth,
- IN OUT UINT32 *InternalStatus
- )
-/*++
-
-Routine Description:
- Translates a Unicode character into the corresponding font glyph.
- If the Source was pointing to a non-spacing character, the next Source[*Index]
- character will be parsed and OR'd to the GlyphBuffer until a spacing character
- is found in the Source. Since non-spacing characters are considered to be the
- same pixel width as a regular character their BitWidth will be reflected correctly
- however due to their special attribute, they are considered to be zero advancing width.
- This basically means that the cursor would not advance, thus the character that follows
- it would overlay the non-spacing character. The Index is modified to reflect both the
- incoming array entry into the Source string but also the outgoing array entry after having
- parsed the equivalent of a single Glyph's worth of data.
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HII_GLOBAL_DATA *GlobalData;
- EFI_HII_DATA *HiiData;
- UINTN Count;
- BOOLEAN Narrow;
- UINTN Location;
- UINTN SearchLocation;
- UINTN Value;
- CHAR16 Character;
- UINTN Attributes;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- GlobalData = HiiData->GlobalData;
- Count = sizeof (GlobalData->NarrowGlyphs->GlyphCol1);
-
- Location = *Index;
- SearchLocation = *Index;
- Narrow = TRUE;
-
- if (Source[Location] == NARROW_CHAR || Source[Location] == WIDE_CHAR) {
- *InternalStatus = 0;
- }
- //
- // We don't know what glyph database to look in - let's figure it out
- //
- if (*InternalStatus == 0) {
- //
- // Determine if we are looking for narrow or wide glyph data
- //
- do {
- if (Source[SearchLocation] == NARROW_CHAR || Source[SearchLocation] == WIDE_CHAR) {
- //
- // We found something that identifies what glyph database to look in
- //
- if (Source[SearchLocation] == WIDE_CHAR) {
- Narrow = FALSE;
- *BitWidth = WIDE_WIDTH;
- *InternalStatus = WIDE_CHAR;
- Location++;
- break;
- } else {
- Narrow = TRUE;
- *BitWidth = NARROW_WIDTH;
- *InternalStatus = NARROW_CHAR;
- Location++;
- break;
- }
- }
- } while (SearchLocation-- > 0);
- }
-
- if (*InternalStatus == NARROW_CHAR) {
- Narrow = TRUE;
- *BitWidth = NARROW_WIDTH;
- } else if (*InternalStatus == WIDE_CHAR) {
- Narrow = FALSE;
- *BitWidth = WIDE_WIDTH;
- } else {
- //
- // Without otherwise knowing what the width is narrow (e.g. someone passed in a string with index of 0
- // we wouldn't be able to determine the width of the data.)
- // BUGBUG - do we go to wide database and if exist, ignore narrow? Check Unicode spec....
- //
- Narrow = TRUE;
- *BitWidth = NARROW_WIDTH;
- }
-
- Character = Source[Location];
-
- if (Narrow) {
- if (GlobalData->NarrowGlyphs[Character].UnicodeWeight != 0x0000) {
- *GlyphBuffer = (UINT8 *) (&GlobalData->NarrowGlyphs[Character]);
- Attributes = GlobalData->NarrowGlyphs[Character].Attributes & EFI_GLYPH_NON_SPACING;
- } else {
- //
- // Glyph is uninitialized - return an error, but hand back the glyph
- //
- *GlyphBuffer = (UINT8 *) (&GlobalData->NarrowGlyphs[Character]);
- *Index = (UINT16) (Location + 1);
- return EFI_NOT_FOUND;
- }
- } else {
- //
- // Wide character
- //
- if (GlobalData->WideGlyphs[Character].UnicodeWeight != 0x0000) {
- *GlyphBuffer = (UINT8 *) (&GlobalData->WideGlyphs[Character]);
- Attributes = GlobalData->WideGlyphs[Character].Attributes & EFI_GLYPH_NON_SPACING;
- } else {
- //
- // Glyph is uninitialized - return an error, but hand back the glyph
- //
- *GlyphBuffer = (UINT8 *) (&GlobalData->WideGlyphs[Character]);
- *Index = (UINT16) (Location + 1);
- return EFI_NOT_FOUND;
- }
- }
- //
- // This is a non-spacing character. It will be followed by either more non-spacing
- // characters or a regular character. We need to OR together the data associated with each.
- //
- for (; Attributes != 0; Location++) {
- //
- // Character is the Unicode value which is the index into the Glyph array.
- //
- Character = Source[Location];
-
- if (Narrow) {
- for (Value = 0; Value != Count; Value++) {
- *GlyphBuffer[Location + Value] = (UINT8) (*GlyphBuffer[Location + Value] |
- GlobalData->NarrowGlyphs[Character].GlyphCol1[Value]);
- }
-
- Attributes = GlobalData->NarrowGlyphs[Character].Attributes & EFI_GLYPH_NON_SPACING;
- } else {
- for (Value = 0; Value != Count; Value++) {
- *GlyphBuffer[Location + Value] = (UINT8) (*GlyphBuffer[Location + Value] |
- GlobalData->WideGlyphs[Character].GlyphCol1[Value]);
- *GlyphBuffer[Location + Value + Count] = (UINT8) (*GlyphBuffer[Location + Value + Count] |
- GlobalData->WideGlyphs[Character].GlyphCol2[Value]);
- }
-
- Attributes = GlobalData->WideGlyphs[Character].Attributes & EFI_GLYPH_NON_SPACING;
- }
- }
- //
- // Source[*Index] should point to the next character to process
- //
- *Index = (UINT16) (Location + 1);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-HiiGlyphToBlt (
- IN EFI_HII_PROTOCOL *This,
- IN UINT8 *GlyphBuffer,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
- IN UINTN Count,
- IN UINTN Width,
- IN UINTN Height,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
- )
-{
- UINTN X;
- UINTN Y;
-
- //
- // Convert Monochrome bitmap of the Glyph to BltBuffer structure
- //
- for (Y = 0; Y < Height; Y++) {
- for (X = 0; X < Width; X++) {
- if ((((EFI_NARROW_GLYPH *) GlyphBuffer)->GlyphCol1[Y] & (1 << X)) != 0) {
- BltBuffer[Y * Width * Count + (Width - X - 1)] = Foreground;
- } else {
- BltBuffer[Y * Width * Count + (Width - X - 1)] = Background;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Forms.c b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Forms.c
deleted file mode 100644
index c0c08f3..0000000
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Forms.c
+++ /dev/null
@@ -1,1577 +0,0 @@
-/**@file
- This file contains the form processing code to the HII database.
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-
-#include "HiiDatabase.h"
-
-STATIC
-CHAR16*
-Ascii2Unicode (
- OUT CHAR16 *UnicodeStr,
- IN CHAR8 *AsciiStr
- )
-/*++
-
- Routine Description:
-
- This function converts ASCII string to Unicode string.
-
- Arguments:
-
- UnicodeStr - NULL terminated Unicode output string.
- AsciieStr - NULL terminated ASCII input string.
-
- Returns:
-
- Start of the Unicode ouput string.
-
---*/
-
-{
- CHAR16 *Str = UnicodeStr;
- while (TRUE) {
- *(UnicodeStr++) = (CHAR16) *AsciiStr;
- if (*(AsciiStr++) == '\0') {
- return Str;
- }
- }
-}
-
-STATIC
-CHAR8*
-Unicode2Ascii (
- OUT CHAR8 *AsciiStr,
- IN CHAR16 *UnicodeStr
- )
-/*++
-
- Routine Description:
-
- This function converts Unicode string to ASCII string.
-
- Arguments:
-
- AsciieStr - NULL terminated ASCII output string.
- UnicodeStr - NULL terminated Unicode input string.
-
- Returns:
-
- Start of the ASCII ouput string.
-
---*/
-
-{
- CHAR8 *Str = AsciiStr;
- while (TRUE) {
- *(AsciiStr++) = (CHAR8) *UnicodeStr;
- if (*(UnicodeStr++) == '\0') {
- return Str;
- }
- }
-}
-
-STATIC
-VOID
-ExtractDevicePathData (
- IN EFI_HII_DATA_TABLE *DataTable,
- IN UINT8 *IfrData,
- IN OUT UINT8 **ExportBufferPtr
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINT8 *ExportBuffer;
-
- ExportBuffer = *ExportBufferPtr;
-
- //
- // BUGBUG - don't have devicepath data yet, setting dummy value
- //
- DataTable++;
- ExportBuffer = (UINT8 *) DataTable;
- ((EFI_HII_DEVICE_PATH_PACK *) ExportBuffer)->Header.Type = EFI_HII_DEVICE_PATH;
- ((EFI_HII_DEVICE_PATH_PACK *) ExportBuffer)->Header.Length = (UINT32) (sizeof (EFI_HII_DEVICE_PATH_PACK) + sizeof (EFI_DEVICE_PATH_PROTOCOL));
-
- //
- // BUGBUG - part of hack - skip the Device Path Pack.....place some data
- //
- ExportBuffer = ExportBuffer + sizeof (EFI_HII_DEVICE_PATH_PACK);
-
- ((EFI_DEVICE_PATH_PROTOCOL *) ExportBuffer)->Type = EFI_END_ENTIRE_DEVICE_PATH;
- ((EFI_DEVICE_PATH_PROTOCOL *) ExportBuffer)->SubType = EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
-
- //
- // BUGBUG - still part of hack....
- //
- ExportBuffer = ExportBuffer + sizeof (EFI_DEVICE_PATH_PROTOCOL);
- *ExportBufferPtr = ExportBuffer;
-}
-
-STATIC
-VOID
-ExtractVariableData (
- IN OUT EFI_HII_DATA_TABLE *DataTable,
- IN UINT8 *IfrData,
- IN OUT UINT8 **ExportBufferPtr
- )
-/*++
-
-Routine Description:
-
- This function extract the EFI_HII_VARIABLE_PACK portion from the
- each of the EFI_HII_PACKAGE_INSTANCE in HII handle database.
-
-Arguments:
-
- DataTable - On input, this parameter point to the EFI_HII_DATA_TABLE structure
- of the final data buffer for the EFI_HII_EXPORT interface. This function
- update the NumberOfVariableData attribute.
- IfrData - It points to a staring address of a EFI_HII_IFR_PACK structure.
- ExportBufferPtr - On input, it points the starting address of the data buffer to
- host the variable pack. On output, it is the starting address
- of data buffer for the next extraction operation.
-Returns:
-
- VOID
-
---*/
-{
- EFI_HII_VARIABLE_PACK *VariableContents;
- UINT8 *ExportBuffer;
- UINTN Index;
- UINTN Index2;
- UINTN TempValue;
- UINTN TempValue2;
- EFI_FORM_CALLBACK_PROTOCOL *FormCallback;
- EFI_PHYSICAL_ADDRESS CallbackHandle;
- EFI_STATUS Status;
- CHAR16 *String;
-
- FormCallback = NULL;
- CallbackHandle = 0;
- ExportBuffer = *ExportBufferPtr;
-
- for (Index = 0; IfrData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- VariableContents = (EFI_HII_VARIABLE_PACK *) ExportBuffer;
-
- switch (IfrData[Index]) {
- case EFI_IFR_FORM_SET_OP:
- TempValue = EFI_HII_VARIABLE;
- CopyMem (&VariableContents->Header.Type, &TempValue, sizeof (UINT16));
- CopyMem (&TempValue, &((EFI_IFR_FORM_SET *) &IfrData[Index])->NvDataSize, sizeof (UINT16));
-
- //
- // If the variable has 0 size, do not process it
- //
- if (TempValue == 0) {
- break;
- }
- //
- // Add the size of the variable pack overhead. Later, will also add the size of the
- // name of the variable.
- //
- TempValue = TempValue + sizeof (EFI_HII_VARIABLE_PACK);
-
- CopyMem (&VariableContents->Header.Length, &TempValue, sizeof (UINT32));
- CopyMem (
- &CallbackHandle,
- &((EFI_IFR_FORM_SET *) &IfrData[Index])->CallbackHandle,
- sizeof (EFI_PHYSICAL_ADDRESS)
- );
- if (CallbackHandle != 0) {
- Status = gBS->HandleProtocol (
- (EFI_HANDLE) (UINTN) CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- (VOID *) &FormCallback
- );
- ASSERT_EFI_ERROR (Status);
- }
- //
- // Since we have a "Setup" variable that wasn't specified by a variable op-code
- // it will have a VariableId of 0. All other variable op-codes will have a designation
- // of VariableId 1+
- //
- TempValue = 0;
- CopyMem (&VariableContents->VariableId, &TempValue, sizeof (UINT16));
- CopyMem (&VariableContents->VariableGuid, &((EFI_IFR_FORM_SET *) &IfrData[Index])->Guid, sizeof (EFI_GUID));
- TempValue = sizeof (SETUP_MAP_NAME);
- CopyMem (&VariableContents->VariableNameLength, &TempValue, sizeof (UINT32));
-
- //
- // Add the size of the name to the Header Length
- //
- TempValue2 = 0;
- CopyMem (&TempValue2, &VariableContents->Header.Length, sizeof (UINT32));
- TempValue2 = TempValue + TempValue2;
- CopyMem (&VariableContents->Header.Length, &TempValue2, sizeof (UINT32));
-
- ExportBuffer = ExportBuffer + sizeof (EFI_HII_VARIABLE_PACK);
- CopyMem (ExportBuffer, SETUP_MAP_NAME, sizeof (SETUP_MAP_NAME));
- ExportBuffer = ExportBuffer + sizeof (SETUP_MAP_NAME);
-
- CopyMem (&TempValue, &((EFI_IFR_FORM_SET *) &IfrData[Index])->NvDataSize, sizeof (UINT16));
-
- if ((FormCallback != NULL) && (FormCallback->NvRead != NULL)) {
- Status = FormCallback->NvRead (
- FormCallback,
- (CHAR16 *) SETUP_MAP_NAME,
- (EFI_GUID *)(UINTN)&VariableContents->VariableGuid,
- NULL,
- &TempValue,
- ExportBuffer
- );
- ASSERT_EFI_ERROR (Status);
- } else {
- Status = gRT->GetVariable (
- (CHAR16 *) SETUP_MAP_NAME,
- (EFI_GUID *)(UINTN)&VariableContents->VariableGuid,
- NULL,
- &TempValue,
- ExportBuffer
- );
- ASSERT_EFI_ERROR (Status);
- }
-
- ExportBuffer = (UINT8 *) (UINTN) (((UINTN) ExportBuffer) + TempValue);
- DataTable->NumberOfVariableData++;
- break;
-
- case EFI_IFR_VARSTORE_OP:
- TempValue = EFI_HII_VARIABLE;
- CopyMem (&VariableContents->Header.Type, &TempValue, sizeof (UINT16));
- CopyMem (&TempValue, &((EFI_IFR_VARSTORE *) &IfrData[Index])->Size, sizeof (UINT16));
-
- //
- // If the variable has 0 size, do not process it
- //
- if (TempValue == 0) {
- break;
- }
- //
- // Add the size of the variable pack overhead. Later, will also add the size of the
- // name of the variable.
- //
- TempValue = TempValue + sizeof (EFI_HII_VARIABLE_PACK);
-
- CopyMem (&VariableContents->Header.Length, &TempValue, sizeof (UINT32));
- CopyMem (&VariableContents->VariableId, &((EFI_IFR_VARSTORE *) &IfrData[Index])->VarId, sizeof (UINT16));
- CopyMem (&VariableContents->VariableGuid, &((EFI_IFR_VARSTORE *) &IfrData[Index])->Guid, sizeof (EFI_GUID));
- TempValue = (UINTN) ((EFI_IFR_VARSTORE *) &IfrData[Index])->Header.Length - sizeof (EFI_IFR_VARSTORE);
- TempValue = TempValue * 2;
- CopyMem (&VariableContents->VariableNameLength, &TempValue, sizeof (UINT32));
-
- //
- // Add the size of the name to the Header Length
- //
- TempValue2 = 0;
- CopyMem (&TempValue2, &VariableContents->Header.Length, sizeof (UINT32));
- TempValue2 = TempValue + TempValue2;
- CopyMem (&VariableContents->Header.Length, &TempValue2, sizeof (UINT32));
-
- ExportBuffer = ExportBuffer + sizeof (EFI_HII_VARIABLE_PACK);
- String = (CHAR16 *) ExportBuffer;
- for (Index2 = 0; Index2 < TempValue / 2; Index2++) {
- ExportBuffer[Index2 * 2] = IfrData[Index + sizeof (EFI_IFR_VARSTORE) + Index2];
- ExportBuffer[Index2 * 2 + 1] = 0;
- }
-
- ExportBuffer = ExportBuffer + TempValue;
-
- CopyMem (&TempValue, &((EFI_IFR_VARSTORE *) &IfrData[Index])->Size, sizeof (UINT16));
-
- if ((FormCallback != NULL) && (FormCallback->NvRead != NULL)) {
- Status = FormCallback->NvRead (
- FormCallback,
- String,
- (EFI_GUID *)(UINTN)&VariableContents->VariableGuid,
- NULL,
- &TempValue,
- ExportBuffer
- );
- ASSERT_EFI_ERROR (Status);
- } else {
- Status = gRT->GetVariable (
- String,
- (EFI_GUID *)(UINTN)&VariableContents->VariableGuid,
- NULL,
- &TempValue,
- ExportBuffer
- );
- ASSERT_EFI_ERROR (Status);
- }
-
- ExportBuffer = (UINT8 *) (UINTN) (((UINTN) ExportBuffer) + TempValue);
- DataTable->NumberOfVariableData++;
- break;
- }
-
- Index = IfrData[Index + 1] + Index;
- }
- //
- // If we have added a variable pack, add a dummy empty one to signify the end
- //
- if (ExportBuffer != *ExportBufferPtr) {
- VariableContents = (EFI_HII_VARIABLE_PACK *) ExportBuffer;
- TempValue = EFI_HII_VARIABLE;
- CopyMem (&VariableContents->Header.Type, &TempValue, sizeof (UINT16));
- TempValue = sizeof (EFI_HII_VARIABLE_PACK);
- CopyMem (&VariableContents->Header.Length, &TempValue, sizeof (UINT32));
- ExportBuffer = ExportBuffer + sizeof (EFI_HII_VARIABLE_PACK);
- }
-
- *ExportBufferPtr = ExportBuffer;
-}
-
-EFI_STATUS
-EFIAPI
-HiiExportDatabase (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- This function allows a program to extract a form or form package that has
- previously been registered with the EFI HII database.
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_HII_DATA *HiiData;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_IFR_PACK *FormPack;
- UINT8 *RawData;
- UINT8 *ExportBuffer;
- EFI_HII_EXPORT_TABLE *ExportTable;
- EFI_HII_DATA_TABLE *DataTable;
- BOOLEAN VariableExist;
- UINT16 NumberOfHiiDataTables;
- UINTN SizeNeeded;
- UINTN Index;
- UINTN VariableSize;
- UINTN TempValue;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- HandleDatabase = HiiData->DatabaseHead;
-
- FormPack = NULL;
- RawData = NULL;
- PackageInstance = NULL;
- NumberOfHiiDataTables = 0;
- VariableSize = 0;
- TempValue = 0;
- SizeNeeded = sizeof (EFI_HII_EXPORT_TABLE);
-
- //
- // How many total tables are there?
- //
- for (; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
- if ((Handle != 0) && (Handle != HandleDatabase->Handle)) {
- continue;
- }
-
- VariableExist = FALSE;
- NumberOfHiiDataTables++;
- PackageInstance = HandleDatabase->Buffer;
- if (PackageInstance == NULL) {
- continue;
- }
- //
- // Extract Size of Export Package
- //
- SizeNeeded = SizeNeeded + PackageInstance->IfrSize
- + PackageInstance->StringSize
- + sizeof (EFI_HII_DATA_TABLE)
- + sizeof (EFI_HII_DEVICE_PATH_PACK);
-
- //
- // BUGBUG We aren't inserting Device path data yet
- //
- SizeNeeded = SizeNeeded + sizeof (EFI_DEVICE_PATH_PROTOCOL);
-
- //
- // Extract Size of Variable Data
- //
- if (PackageInstance->IfrSize > 0) {
- FormPack = (EFI_HII_IFR_PACK *) ((CHAR8 *) (&PackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER));
- } else {
- //
- // No IFR? No variable information
- //
- continue;
- }
-
- RawData = (UINT8 *) FormPack;
-
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- switch (RawData[Index]) {
- case EFI_IFR_FORM_SET_OP:
- CopyMem (&VariableSize, &((EFI_IFR_FORM_SET *) &RawData[Index])->NvDataSize, sizeof (UINT16));
- SizeNeeded = SizeNeeded + VariableSize + sizeof (SETUP_MAP_NAME) + sizeof (EFI_HII_VARIABLE_PACK);
- VariableExist = TRUE;
- break;
-
- case EFI_IFR_VARSTORE_OP:
- CopyMem (&VariableSize, &((EFI_IFR_VARSTORE *) &RawData[Index])->Size, sizeof (UINT16));
- SizeNeeded = SizeNeeded + VariableSize + sizeof (EFI_HII_VARIABLE_PACK);
- //
- // We will be expanding the stored ASCII name to a Unicode string. This will cause some memory overhead
- // Since the VARSTORE size already takes in consideration the ASCII size, we need to size it and add another
- // instance of it. Essentially, 2 ASCII strings == 1 Unicode string in size.
- //
- TempValue = (UINTN) ((EFI_IFR_VARSTORE *) &RawData[Index])->Header.Length - sizeof (EFI_IFR_VARSTORE);
- SizeNeeded = SizeNeeded + TempValue * 2;
- VariableExist = TRUE;
- break;
- }
-
- Index = RawData[Index + 1] + Index;
- }
- //
- // If a variable exists for this handle, add an additional variable pack overhead to
- // indicate that we will have an extra null Variable Pack to signify the end of the Variable Packs
- //
- if (VariableExist) {
- SizeNeeded = SizeNeeded + sizeof (EFI_HII_VARIABLE_PACK);
- }
- }
-
- if (SizeNeeded > *BufferSize) {
- *BufferSize = SizeNeeded;
- return EFI_BUFFER_TOO_SMALL;
- }
- //
- // Zero out the incoming buffer
- //
- ZeroMem (Buffer, *BufferSize);
-
- //
- // Cast the Buffer to EFI_HII_EXPORT_TABLE
- //
- ExportTable = (EFI_HII_EXPORT_TABLE *) Buffer;
-
- //
- // Set the Revision for the Export Table
- //
- CopyMem (&ExportTable->Revision, &gEfiHiiProtocolGuid, sizeof (EFI_GUID));
-
- ExportBuffer = (UINT8 *) (UINTN) (((UINT8 *) ExportTable) + sizeof (EFI_HII_EXPORT_TABLE));
- HandleDatabase = HiiData->DatabaseHead;
-
- //
- // Check numeric value against the head of the database
- //
- for (; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
- DataTable = (EFI_HII_DATA_TABLE *) ExportBuffer;
- PackageInstance = HandleDatabase->Buffer;
- //
- // If not asking for a specific handle, export the entire database
- //
- if (Handle == 0) {
- ExportTable->NumberOfHiiDataTables = NumberOfHiiDataTables;
- CopyMem (&DataTable->PackageGuid, &PackageInstance->Guid, sizeof (EFI_GUID));
- DataTable->HiiHandle = PackageInstance->Handle;
- DataTable->DevicePathOffset = (UINT32) (sizeof (EFI_HII_DATA_TABLE));
-
- //
- // Start Dumping DevicePath
- //
- ExtractDevicePathData (DataTable, RawData, &ExportBuffer);
-
- if (((UINTN) ExportBuffer) == ((UINTN) DataTable)) {
- //
- // If there is no DevicePath information - set offset to 0 to signify the absence of data to parse
- //
- DataTable->DevicePathOffset = 0;
- }
-
- DataTable->VariableDataOffset = (UINT32) (((UINTN) ExportBuffer) - ((UINTN) DataTable));
-
- if (PackageInstance->IfrSize > 0) {
- FormPack = (EFI_HII_IFR_PACK *) ((CHAR8 *) (&PackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER));
-
- RawData = (UINT8 *) FormPack;
- TempValue = 0;
-
- //
- // Start dumping the Variable Data
- //
- ExtractVariableData (DataTable, RawData, &ExportBuffer);
- DataTable->IfrDataOffset = (UINT32) (((UINTN) ExportBuffer) - ((UINTN) DataTable));
-
- if (DataTable->VariableDataOffset == DataTable->IfrDataOffset) {
- DataTable->VariableDataOffset = 0;
- }
- //
- // Start dumping the IFR data (Note: It is in an IFR PACK)
- //
- CopyMem (ExportBuffer, &PackageInstance->IfrData, PackageInstance->IfrSize);
- ExportBuffer = (UINT8 *) (UINTN) (((UINTN) ExportBuffer) + PackageInstance->IfrSize);
- DataTable->StringDataOffset = (UINT32) (((UINTN) ExportBuffer) - ((UINTN) DataTable));
-
- //
- // Start dumping the String data (Note: It is in a String PACK)
- //
- if (PackageInstance->StringSize > 0) {
- RawData = (UINT8 *) (((UINTN) &PackageInstance->IfrData) + PackageInstance->IfrSize);
- CopyMem (ExportBuffer, RawData, PackageInstance->StringSize);
- DataTable->DataTableSize = (UINT32) (DataTable->StringDataOffset + PackageInstance->StringSize);
-
- CopyMem (&TempValue, &((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length, sizeof (UINT32));
- for (; TempValue != 0;) {
- DataTable->NumberOfLanguages++;
- ExportBuffer = ExportBuffer + ((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length;
- CopyMem (&TempValue, &((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length, sizeof (UINT32));
- }
-
- ExportBuffer = ExportBuffer + sizeof (EFI_HII_STRING_PACK);
- } else {
- DataTable->StringDataOffset = 0;
- }
- } else {
- //
- // No IFR? No variable information. If Offset is 0, means there is none. (Hmm - this might be prunable - no strings to export if no IFR - we always have a stub)
- //
- DataTable->VariableDataOffset = 0;
- DataTable->IfrDataOffset = 0;
- DataTable->StringDataOffset = (UINT32) (((UINTN) ExportBuffer) - ((UINTN) DataTable));
-
- //
- // Start dumping the String data - NOTE: It is in String Pack form
- //
- if (PackageInstance->StringSize > 0) {
- RawData = (UINT8 *) (((UINTN) &PackageInstance->IfrData) + PackageInstance->IfrSize);
- CopyMem (ExportBuffer, RawData, PackageInstance->StringSize);
- DataTable->DataTableSize = (UINT32) (DataTable->StringDataOffset + PackageInstance->StringSize);
-
- CopyMem (&TempValue, &((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length, sizeof (UINT32));
- for (; TempValue != 0;) {
- DataTable->NumberOfLanguages++;
- ExportBuffer = ExportBuffer + ((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length;
- CopyMem (&TempValue, &((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length, sizeof (UINT32));
- }
-
- ExportBuffer = ExportBuffer + sizeof (EFI_HII_STRING_PACK);
- } else {
- DataTable->StringDataOffset = 0;
- }
- }
- } else {
- //
- // Match the numeric value with the database entry - if matched, extract PackageInstance
- //
- if (Handle == HandleDatabase->Handle) {
- PackageInstance = HandleDatabase->Buffer;
- ExportTable->NumberOfHiiDataTables = NumberOfHiiDataTables;
- DataTable->HiiHandle = PackageInstance->Handle;
- CopyMem (&DataTable->PackageGuid, &PackageInstance->Guid, sizeof (EFI_GUID));
-
- //
- // Start Dumping DevicePath
- //
- ExtractDevicePathData (DataTable, RawData, &ExportBuffer);
- DataTable->VariableDataOffset = (UINT32) (((UINTN) ExportBuffer) - ((UINTN) DataTable));
-
- if (PackageInstance->IfrSize > 0) {
- FormPack = (EFI_HII_IFR_PACK *) ((CHAR8 *) (&PackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER));
-
- RawData = (UINT8 *) FormPack;
- TempValue = 0;
-
- //
- // Start dumping the Variable Data
- //
- ExtractVariableData (DataTable, RawData, &ExportBuffer);
- DataTable->IfrDataOffset = (UINT32) (((UINTN) ExportBuffer) - ((UINTN) DataTable));
-
- if (DataTable->VariableDataOffset == DataTable->IfrDataOffset) {
- DataTable->VariableDataOffset = 0;
- }
- //
- // Start dumping the IFR data
- //
- CopyMem (ExportBuffer, &PackageInstance->IfrData, PackageInstance->IfrSize);
- ExportBuffer = (UINT8 *) (UINTN) (((UINTN) ExportBuffer) + PackageInstance->IfrSize);
- DataTable->StringDataOffset = (UINT32) (((UINTN) ExportBuffer) - ((UINTN) DataTable));
-
- //
- // Start dumping the String data - NOTE: It is in String Pack form
- //
- if (PackageInstance->StringSize > 0) {
- RawData = (UINT8 *) (((UINTN) &PackageInstance->IfrData) + PackageInstance->IfrSize);
- CopyMem (ExportBuffer, RawData, PackageInstance->StringSize);
- DataTable->DataTableSize = (UINT32) (DataTable->StringDataOffset + PackageInstance->StringSize);
-
- CopyMem (&TempValue, &((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length, sizeof (UINT32));
- for (; TempValue != 0;) {
- DataTable->NumberOfLanguages++;
- ExportBuffer = ExportBuffer + ((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length;
- CopyMem (&TempValue, &((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length, sizeof (UINT32));
- }
-
- ExportBuffer = ExportBuffer + sizeof (EFI_HII_STRING_PACK);
- } else {
- DataTable->StringDataOffset = 0;
- }
- } else {
- //
- // No IFR? No variable information. If Offset is 0, means there is none.
- //
- DataTable->VariableDataOffset = 0;
- DataTable->IfrDataOffset = 0;
- DataTable->StringDataOffset = (UINT32) (((UINTN) ExportBuffer) - ((UINTN) DataTable));
-
- //
- // Start dumping the String data - Note: It is in String Pack form
- //
- if (PackageInstance->StringSize > 0) {
- RawData = (UINT8 *) (((UINTN) &PackageInstance->IfrData) + PackageInstance->IfrSize);
- CopyMem (ExportBuffer, RawData, PackageInstance->StringSize);
- DataTable->DataTableSize = (UINT32) (DataTable->StringDataOffset + PackageInstance->StringSize);
-
- CopyMem (&TempValue, &((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length, sizeof (UINT32));
- for (; TempValue != 0;) {
- DataTable->NumberOfLanguages++;
- ExportBuffer = ExportBuffer + ((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length;
- CopyMem (&TempValue, &((EFI_HII_STRING_PACK *) ExportBuffer)->Header.Length, sizeof (UINT32));
- }
-
- ExportBuffer = ExportBuffer + sizeof (EFI_HII_STRING_PACK);
- } else {
- DataTable->StringDataOffset = 0;
- }
- }
- break;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-HiiGetForms (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN EFI_FORM_ID FormId,
- IN OUT UINTN *BufferLengthTemp,
- OUT UINT8 *Buffer
- )
-/*++
-
-Routine Description:
-
- This function allows a program to extract a form or form package that has
- previously been registered with the EFI HII database.
-
-Arguments:
- This - A pointer to the EFI_HII_PROTOCOL instance.
-
- Handle - Handle on which the form resides. Type EFI_HII_HANDLE is defined in
- EFI_HII_PROTOCOL.NewPack() in the Packages section.
-
- FormId - The ID of the form to return. If the ID is zero, the entire form package is returned.
- Type EFI_FORM_ID is defined in "Related Definitions" below.
-
- BufferLength - On input, the length of the Buffer. On output, the length of the returned buffer, if
- the length was sufficient and, if it was not, the length that is required to fit the
- requested form(s).
-
- Buffer - The buffer designed to receive the form(s).
-
-Returns:
-
- EFI_SUCCESS - Buffer filled with the requested forms. BufferLength
- was updated.
-
- EFI_INVALID_PARAMETER - The handle is unknown.
-
- EFI_NOT_FOUND - A form on the requested handle cannot be found with the
- requested FormId.
-
- EFI_BUFFER_TOO_SMALL - The buffer provided was not large enough to allow the form to be stored.
-
---*/
-{
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_HII_DATA *HiiData;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_IFR_PACK *FormPack;
- EFI_IFR_FORM *Form;
- EFI_IFR_OP_HEADER *Location;
- UINT16 *BufferLength = (UINT16 *) BufferLengthTemp;
- UINTN FormLength;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- HandleDatabase = HiiData->DatabaseHead;
-
- PackageInstance = NULL;
-
- FormLength = 0;
-
- //
- // Check numeric value against the head of the database
- //
- for (; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
- //
- // Match the numeric value with the database entry - if matched, extract PackageInstance
- //
- if (Handle == HandleDatabase->Handle) {
- PackageInstance = HandleDatabase->Buffer;
- break;
- }
- }
- //
- // No handle was found - error condition
- //
- if (PackageInstance == NULL) {
- return EFI_NOT_FOUND;
- }
- //
- // Based on if there is IFR data in this package instance, determine
- // what the location is of the beginning of the string data.
- //
- if (PackageInstance->IfrSize > 0) {
- FormPack = (EFI_HII_IFR_PACK *) (&PackageInstance->IfrData);
- } else {
- //
- // If there is no IFR data return an error
- //
- return EFI_NOT_FOUND;
- }
- //
- // If requesting the entire Form Package
- //
- if (FormId == 0) {
- //
- // Return an error if buffer is too small
- //
- if (PackageInstance->IfrSize > *BufferLength || Buffer == NULL) {
- *BufferLength = (UINT16) PackageInstance->IfrSize;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- CopyMem (Buffer, FormPack, PackageInstance->IfrSize);
- return EFI_SUCCESS;
- } else {
- FormPack = (EFI_HII_IFR_PACK *) ((CHAR8 *) (&PackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER));
- Location = (EFI_IFR_OP_HEADER *) FormPack;
-
- //
- // Look for the FormId requested
- //
- for (; Location->OpCode != EFI_IFR_END_FORM_SET_OP;) {
- switch (Location->OpCode) {
- case EFI_IFR_FORM_OP:
- Form = (EFI_IFR_FORM *) Location;
-
- //
- // If we found a Form Op-code and it is of the correct Id, copy it and return
- //
- if (Form->FormId == FormId) {
- //
- // Calculate the total size of form
- //
- for (FormLength = 0; Location->OpCode != EFI_IFR_END_FORM_OP; ) {
- FormLength += Location->Length;
- Location = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (Location) + Location->Length);
- }
- FormLength += Location->Length;
- Location = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (Location) + Location->Length);
-
- if ((Buffer == NULL) || (FormLength > *BufferLength)) {
- *BufferLengthTemp = FormLength;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- //
- // Rewind to start offset of the found Form
- //
- Location = (EFI_IFR_OP_HEADER *) ((CHAR8 *)Location - FormLength);
- CopyMem (Buffer, Location, FormLength);
- return EFI_SUCCESS;
- }
-
- default:
- break;
- }
- //
- // Go to the next Op-Code
- //
- Location = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (Location) + Location->Length);
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-//
-// Helper functions to HiiGetDefaultImage()
-//
-
-STATIC
-UINT8*
-HiiGetDefaultImageInitPack (
- IN OUT EFI_HII_VARIABLE_PACK_LIST *VariablePackItem,
- IN EFI_IFR_VARSTORE *VarStore
- )
-/*++
-
- Routine Description:
-
- Initialize the EFI_HII_VARIABLE_PACK_LIST structure and
- prepare it ready to be used by HiiGetDefaultImagePopulateMap ().
-
- Arguments:
-
- VariablePackItem - Variable Package List.
- VarStore - IFR variable storage.
-
- Returns:
-
- Return the pointer to the Map space.
-
---*/
-{
- CHAR16 *Name16;
- CHAR8 *Name8;
- CHAR8 *Map;
- EFI_HII_VARIABLE_PACK *VariablePack;
-
- //
- // Set pointer the pack right after the node
- //
- VariablePackItem->VariablePack = (EFI_HII_VARIABLE_PACK *) (VariablePackItem + 1);
- VariablePack = VariablePackItem->VariablePack;
-
- //
- // Copy the var name to VariablePackItem from VarStore
- // Needs ASCII->Unicode conversion.
- //
- ASSERT (VarStore->Header.Length > sizeof (*VarStore));
- Name8 = (CHAR8 *) (VarStore + 1);
- Name16 = (CHAR16 *) (VariablePack + 1);
- Ascii2Unicode (Name16, Name8);
-
- //
- // Compute the other fields of the VariablePackItem
- //
- VariablePack->VariableId = VarStore->VarId;
- CopyMem (&VariablePack->VariableGuid, &VarStore->Guid, sizeof (EFI_GUID));
- VariablePack->VariableNameLength = (UINT32) ((StrLen (Name16) + 1) * 2);
- VariablePack->Header.Length = sizeof (*VariablePack)
- + VariablePack->VariableNameLength
- + VarStore->Size;
- //
- // Return the pointer to the Map space.
- //
- Map = (CHAR8 *) Name16 + VariablePack->VariableNameLength;
-
- return (UINT8 *)Map;
-}
-
-STATIC
-VOID
-HiiGetDefaultImagePopulateMap (
- IN OUT UINT8 *Map,
- IN EFI_IFR_OP_HEADER *FormSet,
- IN EFI_IFR_VARSTORE *VarStore,
- IN UINTN DefaultMask
- )
-/*++
-
- Routine Description:
-
- Fill the Map with all the default values either from NV or Hii database.
-
- Arguments:
-
- Map - Memory pointer to hold the default values.
- FormSet - The starting EFI_IFR_OP_HEADER to begin retriving default values.
- VarStore - IFR variable storage.
- DefaultMask - The mask used to get the default variable.
-
- Returns:
-
- VOID
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_OP_HEADER *IfrItem;
- UINT16 VarId;
- EFI_IFR_VARSTORE_SELECT *VarSelect;
- EFI_IFR_ONE_OF_OPTION *OneOfOpt;
- EFI_IFR_CHECKBOX *CheckBox;
- EFI_IFR_NUMERIC *Numeric;
- UINTN Size;
- UINTN SizeTmp;
- EFI_IFR_NV_DATA *IfrNvData;
- EFI_GUID Guid;
- CHAR16 *Name16;
- CHAR8 *Name8;
- EFI_HANDLE CallbackHandle;
- EFI_FORM_CALLBACK_PROTOCOL *FormCallbackProt;
-
- //
- // Get the Map's Name/Guid/Szie from the Varstore.
- // VARSTORE contains the Name in ASCII format (@#$^&!), must convert it to Unicode.
- //
- ASSERT (VarStore->Header.Length >= sizeof (*VarStore));
- Name8 = (CHAR8 *) (VarStore + 1);
- Name16 = AllocateZeroPool ((VarStore->Header.Length - sizeof (*VarStore)) * sizeof (CHAR16));
- Ascii2Unicode (Name16, Name8);
- CopyMem (&Guid, &VarStore->Guid, sizeof(EFI_GUID));
- Size = VarStore->Size;
-
- //
- // First, check if the map exists in the NV. If so, get it from NV and exit.
- //
- if (DefaultMask == EFI_IFR_FLAG_MANUFACTURING) {
- //
- // Check if Manufaturing Defaults exist in the NV.
- //
- Status = EfiLibHiiVariableOverrideBySuffix (
- HII_VARIABLE_SUFFIX_MANUFACTURING_OVERRIDE,
- Name16,
- &Guid,
- Size,
- Map
- );
- } else {
- //
- // All other cases default to Defaults. Check if Defaults exist in the NV.
- //
- Status = EfiLibHiiVariableOverrideBySuffix (
- HII_VARIABLE_SUFFIX_DEFAULT_OVERRIDE,
- Name16,
- &Guid,
- Size,
- Map
- );
- }
- if (!EFI_ERROR (Status)) {
- //
- // Either Defaults/Manufacturing variable exists and appears to be valid.
- // The map is read, exit w/ success now.
- //
- FreePool (Name16);
- return;
- }
-
- //
- // First, prime the map with what already is in the NV.
- // This is needed to cover a situation where the IFR does not contain all the
- // defaults; either deliberately not having appropriate IFR, or in case of IFR_STRING, there is no default.
- // Ignore status. Either it gets read or not.
- //
- FormCallbackProt = NULL;
- CopyMem (&CallbackHandle, &((EFI_IFR_FORM_SET*) FormSet)->CallbackHandle, sizeof (CallbackHandle));
- if (CallbackHandle != NULL) {
- Status = gBS->HandleProtocol (
- (EFI_HANDLE) (UINTN) CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- (VOID *) &FormCallbackProt
- );
- }
- if ((NULL != FormCallbackProt) && (NULL != FormCallbackProt->NvRead)) {
- //
- // Attempt to read using NvRead() callback. Probe first for existence and correct variable size.
- //
- SizeTmp = 0;
- Status = FormCallbackProt->NvRead (
- FormCallbackProt,
- Name16,
- &Guid,
- 0,
- &SizeTmp,
- NULL
- );
- if ((EFI_BUFFER_TOO_SMALL == Status) && (SizeTmp == Size)) {
- Status = FormCallbackProt->NvRead (
- FormCallbackProt,
- Name16,
- &Guid,
- 0,
- &SizeTmp,
- Map
- );
- ASSERT_EFI_ERROR (Status);
- ASSERT (SizeTmp == Size);
- }
- } else {
- //
- // No callback available for this formset, read straight from NV. Deliberately ignore the Status.
- // The buffer will only be written if variable exists nd has correct size.
- //
- Status = EfiLibHiiVariableRetrieveFromNv (
- Name16,
- &Guid,
- Size,
- (VOID **) &Map
- );
- }
-
- //
- // Iterate all IFR statements and for applicable, retrieve the default into the Map.
- //
- for (IfrItem = FormSet, VarId = 0;
- IfrItem->OpCode != EFI_IFR_END_FORM_SET_OP;
- IfrItem = (EFI_IFR_OP_HEADER *) ((UINT8*) IfrItem + IfrItem->Length)
- ) {
-
- //
- // Observe VarStore switch.
- //
- if (EFI_IFR_VARSTORE_SELECT_OP == IfrItem->OpCode) {
- VarSelect = (EFI_IFR_VARSTORE_SELECT *) IfrItem;
- VarId = VarSelect->VarId;
- continue;
- }
-
-
- //
- // Skip opcodes that reference other VarStore than that specific to current map.
- //
- if (VarId != VarStore->VarId) {
- continue;
- }
-
- //
- // Extract the default value from this opcode if applicable, and apply it to the map.
- //
- IfrNvData = (EFI_IFR_NV_DATA *) IfrItem;
- switch (IfrItem->OpCode) {
-
- case EFI_IFR_ONE_OF_OP:
- ASSERT (IfrNvData->QuestionId + IfrNvData->StorageWidth <= VarStore->Size);
- //
- // Get to the first EFI_IFR_ONE_OF_OPTION_OP
- //
- IfrItem = (EFI_IFR_OP_HEADER *) ((UINT8*) IfrItem + IfrItem->Length);
- ASSERT (EFI_IFR_ONE_OF_OPTION_OP == IfrItem->OpCode);
-
- OneOfOpt = (EFI_IFR_ONE_OF_OPTION *)IfrItem;
- //
- // In the worst case, the first will be the default.
- //
- CopyMem (Map + IfrNvData->QuestionId, &OneOfOpt->Value, IfrNvData->StorageWidth);
-
- while (EFI_IFR_ONE_OF_OPTION_OP == IfrItem->OpCode) {
-
- OneOfOpt = (EFI_IFR_ONE_OF_OPTION *)IfrItem;
- if (DefaultMask == EFI_IFR_FLAG_MANUFACTURING) {
- if (0 != (OneOfOpt->Flags & EFI_IFR_FLAG_MANUFACTURING)) {
- //
- // In the worst case, the first will be the default.
- //
- CopyMem (Map + IfrNvData->QuestionId, &OneOfOpt->Value, IfrNvData->StorageWidth);
- break;
- }
- } else {
- if (OneOfOpt->Flags & EFI_IFR_FLAG_DEFAULT) {
- //
- // In the worst case, the first will be the default.
- //
- CopyMem (Map + IfrNvData->QuestionId, &OneOfOpt->Value, IfrNvData->StorageWidth);
- break;
- }
- }
-
- IfrItem = (EFI_IFR_OP_HEADER *)((UINT8*)IfrItem + IfrItem->Length);
- }
- continue;
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- ASSERT (IfrNvData->QuestionId + IfrNvData->StorageWidth <= VarStore->Size);
- CheckBox = (EFI_IFR_CHECK_BOX *)IfrItem;
- if (DefaultMask == EFI_IFR_FLAG_MANUFACTURING) {
- if (0 != (CheckBox->Flags & EFI_IFR_FLAG_MANUFACTURING)) {
- *(UINT8 *) (Map + IfrNvData->QuestionId) = TRUE;
- }
- } else {
- if (CheckBox->Flags & EFI_IFR_FLAG_DEFAULT) {
- *(UINT8 *) (Map + IfrNvData->QuestionId) = TRUE;
- }
- }
- break;
-
- case EFI_IFR_NUMERIC_OP:
- ASSERT (IfrNvData->QuestionId + IfrNvData->StorageWidth <= VarStore->Size);
- Numeric = (EFI_IFR_NUMERIC *) IfrItem;
- CopyMem (Map + IfrNvData->QuestionId, &Numeric->Default, IfrNvData->StorageWidth);
- break;
-
- case EFI_IFR_ORDERED_LIST_OP:
- case EFI_IFR_PASSWORD_OP:
- case EFI_IFR_STRING_OP:
- //
- // No support for default value for these opcodes.
- //
- break;
- }
- }
-
- FreePool (Name16);
-
-}
-
-
-EFI_STATUS
-EFIAPI
-HiiGetDefaultImage (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN UINTN DefaultMask,
- OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
- )
-/*++
-
- Routine Description:
-
- This function allows a program to extract the NV Image
- that represents the default storage image
-
- Arguments:
- This - A pointer to the EFI_HII_PROTOCOL instance.
- Handle - The HII handle from which will have default data retrieved.
- UINTN - Mask used to retrieve the default image.
- VariablePackList - Callee allocated, tightly-packed, link list data
- structure that contain all default varaible packs
- from the Hii Database.
-
- Returns:
- EFI_NOT_FOUND - If Hii database does not contain any default images.
- EFI_INVALID_PARAMETER - Invalid input parameter.
- EFI_SUCCESS - Operation successful.
-
---*/
-{
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_IFR_OP_HEADER *FormSet;
- EFI_IFR_OP_HEADER *IfrItem;
- EFI_IFR_VARSTORE *VarStore;
- EFI_IFR_VARSTORE *VarStoreDefault;
- UINTN SetupMapNameSize;
- UINTN SizeOfMaps;
- EFI_HII_VARIABLE_PACK_LIST *PackList;
- EFI_HII_VARIABLE_PACK_LIST *PackListNext;
- EFI_HII_VARIABLE_PACK_LIST *PackListLast;
- UINT8 *Map;
-
-
- //
- // Find the IFR pack from the handle. Then get the formset from the pack.
- //
- PackageInstance = NULL;
- HandleDatabase = (EFI_HII_DATA_FROM_THIS (This))->DatabaseHead;
- for ( ; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
- if (Handle == HandleDatabase->Handle) {
- PackageInstance = HandleDatabase->Buffer;
- break;
- }
- }
- if (PackageInstance == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- FormSet = (EFI_IFR_OP_HEADER *) ((UINT8 *) &PackageInstance->IfrData + sizeof (EFI_HII_IFR_PACK));
-
- //
- // Get the sizes of all the VARSTOREs in this VFR.
- // Then allocate enough space for all of them plus all maps
- //
- SizeOfMaps = 0;
- IfrItem = FormSet;
- while (EFI_IFR_END_FORM_SET_OP != IfrItem->OpCode) {
-
- if (EFI_IFR_VARSTORE_OP == IfrItem->OpCode) {
- VarStore = (EFI_IFR_VARSTORE *) IfrItem;
- //
- // Size of the map
- //
- SizeOfMaps += VarStore->Size;
- //
- // add the size of the string, in Unicode
- //
- SizeOfMaps += (VarStore->Header.Length - sizeof (*VarStore)) * 2;
- //
- // Space for node
- //
- SizeOfMaps += sizeof (EFI_HII_VARIABLE_PACK);
- //
- // Space for linked list node
- //
- SizeOfMaps += sizeof (EFI_HII_VARIABLE_PACK_LIST);
- }
-
- IfrItem = (EFI_IFR_OP_HEADER *) ((UINT8 *) IfrItem + IfrItem->Length);
- }
-
- //
- // If the FormSet OpCode has a non-zero NvDataSize. There is a default
- // NvMap with ID=0, GUID that of the formset itself and "Setup" as name.
- //
- SetupMapNameSize = StrLen (SETUP_MAP_NAME) + 1;
- VarStoreDefault = AllocateZeroPool (sizeof (*VarStoreDefault) + SetupMapNameSize);
-
- if (0 != ((EFI_IFR_FORM_SET*)FormSet)->NvDataSize) {
-
- VarStoreDefault->Header.OpCode = EFI_IFR_VARSTORE_OP;
- VarStoreDefault->Header.Length = (UINT8) (sizeof (*VarStoreDefault) + SetupMapNameSize);
- Unicode2Ascii ((CHAR8 *) (VarStoreDefault + 1), SETUP_MAP_NAME);
- CopyMem (&VarStoreDefault->Guid, &((EFI_IFR_FORM_SET*) FormSet)->Guid, sizeof (EFI_GUID));
- VarStoreDefault->VarId = 0;
- VarStoreDefault->Size = ((EFI_IFR_FORM_SET*) FormSet)->NvDataSize;
-
- //
- // Size of the map
- //
- SizeOfMaps += VarStoreDefault->Size;
- //
- // add the size of the string
- //
- SizeOfMaps += sizeof (SETUP_MAP_NAME);
- //
- // Space for node
- //
- SizeOfMaps += sizeof (EFI_HII_VARIABLE_PACK);
- //
- // Space for linked list node
- //
- SizeOfMaps += sizeof (EFI_HII_VARIABLE_PACK_LIST);
- }
-
- if (0 == SizeOfMaps) {
- //
- // The IFR does not have any explicit or default map(s).
- //
- return EFI_NOT_FOUND;
- }
-
- //
- // Allocate the return buffer
- //
- PackList = AllocateZeroPool (SizeOfMaps);
- ASSERT (NULL != PackList);
-
- PackListNext = PackList;
- PackListLast = PackList;
-
- //
- // Handle the default map first, if any.
- //
- if (0 != VarStoreDefault->Size) {
-
- Map = HiiGetDefaultImageInitPack (PackListNext, VarStoreDefault);
-
- HiiGetDefaultImagePopulateMap (Map, FormSet, VarStoreDefault, DefaultMask);
-
- PackListNext->NextVariablePack = (EFI_HII_VARIABLE_PACK_LIST *) ((UINT8 *) PackListNext->VariablePack + PackListNext->VariablePack->Header.Length);
- PackListLast = PackListNext;
- PackListNext = PackListNext->NextVariablePack;
- }
-
-
- //
- // Handle the explicit varstore(s)
- //
- IfrItem = FormSet;
- while (EFI_IFR_END_FORM_SET_OP != IfrItem->OpCode) {
-
- if (EFI_IFR_VARSTORE_OP == IfrItem->OpCode) {
-
- Map = HiiGetDefaultImageInitPack (PackListNext, (EFI_IFR_VARSTORE *) IfrItem);
-
- HiiGetDefaultImagePopulateMap (Map, FormSet, (EFI_IFR_VARSTORE *) IfrItem, DefaultMask);
-
- PackListNext->NextVariablePack = (EFI_HII_VARIABLE_PACK_LIST *) ((UINT8 *) PackListNext->VariablePack + PackListNext->VariablePack->Header.Length);
- PackListLast = PackListNext;
- PackListNext = PackListNext->NextVariablePack;
- }
-
- IfrItem = (EFI_IFR_OP_HEADER *) ((UINT8 *) IfrItem + IfrItem->Length);
- }
-
- PackListLast->NextVariablePack = NULL;
- *VariablePackList = PackList;
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-EFIAPI
-HiiUpdateForm (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN EFI_FORM_LABEL Label,
- IN BOOLEAN AddData,
- IN EFI_HII_UPDATE_DATA *Data
- )
-/*++
-
-Routine Description:
- This function allows the caller to update a form that has
- previously been registered with the EFI HII database.
-
-Arguments:
- Handle - Hii Handle associated with the Formset to modify
- Label - Update information starting immediately after this label in the IFR
- AddData - If TRUE, add data. If FALSE, remove data
- Data - If adding data, this is the pointer to the data to add
-
-Returns:
- EFI_SUCCESS - Update success.
- Other - Update fail.
-
---*/
-{
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_HII_DATA *HiiData;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_IFR_PACK *FormPack;
- EFI_IFR_OP_HEADER *Location;
- EFI_IFR_OP_HEADER *DataLocation;
- UINT8 *OtherBuffer;
- UINT8 *TempBuffer;
- UINT8 *OrigTempBuffer;
- UINTN TempBufferSize;
- UINTN Index;
-
- OtherBuffer = NULL;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- HandleDatabase = HiiData->DatabaseHead;
-
- PackageInstance = NULL;
-
- //
- // Check numeric value against the head of the database
- //
- for (; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
- //
- // Match the numeric value with the database entry - if matched, extract PackageInstance
- //
- if (Handle == HandleDatabase->Handle) {
- PackageInstance = HandleDatabase->Buffer;
- break;
- }
- }
- //
- // No handle was found - error condition
- //
- if (PackageInstance == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Calculate and allocate space for retrieval of IFR data
- //
- DataLocation = (EFI_IFR_OP_HEADER *) &Data->Data;
- TempBufferSize = (CHAR8 *) (&PackageInstance->IfrData) - (CHAR8 *) (PackageInstance);
-
- for (Index = 0; Index < Data->DataCount; Index++) {
- TempBufferSize += DataLocation->Length;
- DataLocation = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (DataLocation) + DataLocation->Length);
- }
-
- TempBufferSize += PackageInstance->IfrSize + PackageInstance->StringSize;
-
- TempBuffer = AllocateZeroPool (TempBufferSize);
- ASSERT (TempBuffer != NULL);
-
- OrigTempBuffer = TempBuffer;
-
- //
- // We update only packages with IFR information in it
- //
- if (PackageInstance->IfrSize == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- CopyMem (
- TempBuffer,
- PackageInstance,
- ((CHAR8 *) (&PackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER) - (CHAR8 *) (PackageInstance))
- );
-
- TempBuffer = TempBuffer + ((CHAR8 *) (&PackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER) - (CHAR8 *) (PackageInstance));
-
- //
- // Based on if there is IFR data in this package instance, determine
- // what the location is of the beginning of the string data.
- //
- FormPack = (EFI_HII_IFR_PACK *) ((CHAR8 *) (&PackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER));
- Location = (EFI_IFR_OP_HEADER *) FormPack;
-
- //
- // Look for the FormId requested
- //
- for (; Location->OpCode != EFI_IFR_END_FORM_SET_OP;) {
- switch (Location->OpCode) {
- case EFI_IFR_FORM_SET_OP:
- //
- // If the FormSet has an update pending, pay attention.
- //
- if (Data->FormSetUpdate) {
- ((EFI_IFR_FORM_SET *) Location)->CallbackHandle = Data->FormCallbackHandle;
- }
-
- CopyMem (TempBuffer, Location, Location->Length);
- TempBuffer = TempBuffer + Location->Length;
- break;
-
- case EFI_IFR_FORM_OP:
- //
- // If the Form has an update pending, pay attention.
- //
- if (Data->FormUpdate) {
- ((EFI_IFR_FORM *) Location)->FormTitle = Data->FormTitle;
- }
-
- CopyMem (TempBuffer, Location, Location->Length);
- TempBuffer = TempBuffer + Location->Length;
- break;
-
- case EFI_IFR_LABEL_OP:
- //
- // If the label does not match the requested update point, ignore it
- //
- if (((EFI_IFR_LABEL *) Location)->LabelId != Label) {
- //
- // Copy the label
- //
- CopyMem (TempBuffer, Location, Location->Length);
- TempBuffer = TempBuffer + Location->Length;
-
- //
- // Go to the next Op-Code
- //
- Location = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (Location) + Location->Length);
- continue;
- }
-
- if (AddData) {
- //
- // Copy the label
- //
- CopyMem (TempBuffer, Location, Location->Length);
- TempBuffer = TempBuffer + Location->Length;
-
- //
- // Add the DataCount amount of opcodes to TempBuffer
- //
- DataLocation = (EFI_IFR_OP_HEADER *) &Data->Data;
- for (Index = 0; Index < Data->DataCount; Index++) {
- CopyMem (TempBuffer, DataLocation, DataLocation->Length);
- ((EFI_HII_PACKAGE_INSTANCE *) OrigTempBuffer)->IfrSize += DataLocation->Length;
- OtherBuffer = ((UINT8 *) &((EFI_HII_PACKAGE_INSTANCE *) OrigTempBuffer)->StringSize + sizeof (UINTN));
- CopyMem (OtherBuffer, &((EFI_HII_PACKAGE_INSTANCE *) OrigTempBuffer)->IfrSize, 2);
- TempBuffer = TempBuffer + DataLocation->Length;
- DataLocation = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (DataLocation) + DataLocation->Length);
- }
- //
- // Go to the next Op-Code
- //
- Location = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (Location) + Location->Length);
- continue;
- } else {
- //
- // Copy the label
- //
- CopyMem (TempBuffer, Location, Location->Length);
- TempBuffer = TempBuffer + Location->Length;
- Location = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (Location) + Location->Length);
-
- //
- // Remove the DataCount amount of opcodes unless we run into an end of form or a label
- //
- for (Index = 0; Index < Data->DataCount; Index++) {
- //
- // If we are about to skip an end form - bail out, since that is illegal
- //
- if ((Location->OpCode == EFI_IFR_END_FORM_OP) || (Location->OpCode == EFI_IFR_LABEL_OP)) {
- break;
- }
- //
- // By skipping Location entries, we are in effect not copying what was previously there
- //
- ((EFI_HII_PACKAGE_INSTANCE *) OrigTempBuffer)->IfrSize -= Location->Length;
- OtherBuffer = ((UINT8 *) &((EFI_HII_PACKAGE_INSTANCE *) OrigTempBuffer)->StringSize + sizeof (UINTN));
- CopyMem (OtherBuffer, &((EFI_HII_PACKAGE_INSTANCE *) OrigTempBuffer)->IfrSize, 2);
- Location = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (Location) + Location->Length);
- }
- }
-
- default:
- CopyMem (TempBuffer, Location, Location->Length);
- TempBuffer = TempBuffer + Location->Length;
- break;
- }
- //
- // Go to the next Op-Code
- //
- Location = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (Location) + Location->Length);
- }
- //
- // Copy the last op-code left behind from the for loop
- //
- CopyMem (TempBuffer, Location, Location->Length);
-
- //
- // Advance to beginning of strings and copy them
- //
- TempBuffer = TempBuffer + Location->Length;
- Location = (EFI_IFR_OP_HEADER *) ((CHAR8 *) (Location) + Location->Length);
- CopyMem (TempBuffer, Location, PackageInstance->StringSize);
-
- //
- // Free the old buffer, and assign into our database the latest buffer
- //
- FreePool (HandleDatabase->Buffer);
- HandleDatabase->Buffer = OrigTempBuffer;
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.c b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.c
deleted file mode 100644
index 1889d70..0000000
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- HiiDatabase.c
-
-Abstract:
-
- This file contains the entry code to the HII database.
-
---*/
-
-#include "HiiDatabase.h"
-
-EFI_STATUS
-EFIAPI
-InitializeHiiDatabase (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Initialize HII Database
-
-Arguments:
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-Returns:
- EFI_SUCCESS - Setup loaded.
- other - Setup Error
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_DATA *HiiData;
- EFI_HII_GLOBAL_DATA *GlobalData;
- EFI_HANDLE *HandleBuffer;
- EFI_HANDLE Handle;
- UINTN HandleCount;
- UINTN Index;
-
- //
- // There will be only one HII Database in the system
- // If there is another out there, someone is trying to install us
- // again. Fail that scenario.
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiHiiProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
-
- //
- // If there was no error, assume there is an installation and fail to load
- //
- if (!EFI_ERROR (Status)) {
- if (HandleBuffer != NULL) {
- FreePool (HandleBuffer);
- }
-
- return EFI_DEVICE_ERROR;
- }
-
- HiiData = AllocatePool (sizeof (EFI_HII_DATA));
-
- ASSERT (HiiData);
-
- GlobalData = AllocateZeroPool (sizeof (EFI_HII_GLOBAL_DATA));
-
- ASSERT (GlobalData);
-
- //
- // Seed the Font Database with a known non-character glyph
- //
- for (Index = 0; Index <= MAX_GLYPH_COUNT; Index++) {
- //
- // Seeding the UnicodeWeight with 0 signifies that it is uninitialized
- //
- GlobalData->NarrowGlyphs[Index].UnicodeWeight = 0;
- GlobalData->WideGlyphs[Index].UnicodeWeight = 0;
- GlobalData->NarrowGlyphs[Index].Attributes = 0;
- GlobalData->WideGlyphs[Index].Attributes = 0;
- CopyMem (GlobalData->NarrowGlyphs[Index].GlyphCol1, &mUnknownGlyph, NARROW_GLYPH_ARRAY_SIZE);
- CopyMem (GlobalData->WideGlyphs[Index].GlyphCol1, &mUnknownGlyph, WIDE_GLYPH_ARRAY_SIZE);
- }
- //
- // Fill in HII data
- //
- HiiData->Signature = EFI_HII_DATA_SIGNATURE;
- HiiData->GlobalData = GlobalData;
- HiiData->GlobalData->SystemKeyboardUpdate = FALSE;
- HiiData->DatabaseHead = NULL;
- HiiData->Hii.NewPack = HiiNewPack;
- HiiData->Hii.RemovePack = HiiRemovePack;
- HiiData->Hii.FindHandles = HiiFindHandles;
- HiiData->Hii.ExportDatabase = HiiExportDatabase;
- HiiData->Hii.GetGlyph = HiiGetGlyph;
- HiiData->Hii.GetPrimaryLanguages = HiiGetPrimaryLanguages;
- HiiData->Hii.GetSecondaryLanguages = HiiGetSecondaryLanguages;
- HiiData->Hii.NewString = HiiNewString;
- HiiData->Hii.GetString = HiiGetString;
- HiiData->Hii.ResetStrings = HiiResetStrings;
- HiiData->Hii.TestString = HiiTestString;
- HiiData->Hii.GetLine = HiiGetLine;
- HiiData->Hii.GetForms = HiiGetForms;
- HiiData->Hii.GetDefaultImage = HiiGetDefaultImage;
- HiiData->Hii.UpdateForm = HiiUpdateForm;
- HiiData->Hii.GetKeyboardLayout = HiiGetKeyboardLayout;
- HiiData->Hii.GlyphToBlt = HiiGlyphToBlt;
-
- //
- // Install protocol interface
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiHiiProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &HiiData->Hii
- );
-
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-HiiFindHandles (
- IN EFI_HII_PROTOCOL *This,
- IN OUT UINT16 *HandleBufferLength,
- OUT EFI_HII_HANDLE Handle[1]
- )
-/*++
-
-Routine Description:
- Determines the handles that are currently active in the database.
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HII_HANDLE_DATABASE *Database;
- EFI_HII_DATA *HiiData;
- UINTN HandleCount;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- Database = HiiData->DatabaseHead;
-
- if (Database == NULL) {
- *HandleBufferLength = 0;
- return EFI_NOT_FOUND;
- }
-
- for (HandleCount = 0; Database != NULL; HandleCount++) {
- Database = Database->NextHandleDatabase;
- }
- //
- // Is there a sufficient buffer for the data being passed back?
- //
- if (*HandleBufferLength >= (sizeof (EFI_HII_HANDLE) * HandleCount)) {
- Database = HiiData->DatabaseHead;
-
- //
- // Copy the Head information
- //
- if (Database->Handle != 0) {
- CopyMem (&Handle[0], &Database->Handle, sizeof (EFI_HII_HANDLE));
- Database = Database->NextHandleDatabase;
- }
- //
- // Copy more data if appropriate
- //
- for (HandleCount = 1; Database != NULL; HandleCount++) {
- CopyMem (&Handle[HandleCount], &Database->Handle, sizeof (EFI_HII_HANDLE));
- Database = Database->NextHandleDatabase;
- }
-
- *HandleBufferLength = (UINT16) (sizeof (EFI_HII_HANDLE) * HandleCount);
- return EFI_SUCCESS;
- } else {
- //
- // Insufficient buffer length
- //
- *HandleBufferLength = (UINT16) (sizeof (EFI_HII_HANDLE) * HandleCount);
- return EFI_BUFFER_TOO_SMALL;
- }
-}
-
-EFI_STATUS
-EFIAPI
-HiiGetPrimaryLanguages (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- OUT EFI_STRING *LanguageString
- )
-/*++
-
-Routine Description:
-
- This function allows a program to determine what the primary languages that are supported on a given handle.
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINTN Count;
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_HII_PACKAGE_INSTANCE *StringPackageInstance;
- EFI_HII_DATA *HiiData;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_STRING_PACK *StringPack;
- EFI_HII_STRING_PACK *Location;
- UINT32 Length;
- RELOFST Token;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- PackageInstance = NULL;
- //
- // Find matching handle in the handle database. Then get the package instance.
- //
- for (HandleDatabase = HiiData->DatabaseHead;
- HandleDatabase != NULL;
- HandleDatabase = HandleDatabase->NextHandleDatabase
- ) {
- if (Handle == HandleDatabase->Handle) {
- PackageInstance = HandleDatabase->Buffer;
- }
- }
- //
- // No handle was found - error condition
- //
- if (PackageInstance == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ValidatePack (This, PackageInstance, &StringPackageInstance, NULL);
-
- //
- // Based on if there is IFR data in this package instance, determine
- // what the location is of the beginning of the string data.
- //
- if (StringPackageInstance->IfrSize > 0) {
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (&StringPackageInstance->IfrData) + StringPackageInstance->IfrSize);
- } else {
- StringPack = (EFI_HII_STRING_PACK *) (&StringPackageInstance->IfrData);
- }
-
- Location = StringPack;
- //
- // Remember that the string packages are formed into contiguous blocks of language data.
- //
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- for (Count = 0; Length != 0; Count = Count + 3) {
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + Length);
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- }
-
- *LanguageString = AllocateZeroPool (2 * (Count + 1));
-
- ASSERT (*LanguageString);
-
- StringPack = (EFI_HII_STRING_PACK *) Location;
-
- //
- // Copy the 6 bytes to LanguageString - keep concatenating it. Shouldn't we just store uint8's since the ISO
- // standard defines the lettering as all US English characters anyway? Save a few bytes.
- //
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- for (Count = 0; Length != 0; Count = Count + 3) {
- CopyMem (&Token, &StringPack->LanguageNameString, sizeof (RELOFST));
- CopyMem (*LanguageString + Count, (VOID *) ((CHAR8 *) (StringPack) + Token), 6);
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + Length);
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-HiiGetSecondaryLanguages (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN CHAR16 *PrimaryLanguage,
- OUT EFI_STRING *LanguageString
- )
-/*++
-
-Routine Description:
-
- This function allows a program to determine which secondary languages are supported
- on a given handle for a given primary language.
-
- Arguments:
-
-Returns:
-
---*/
-{
- UINTN Count;
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_HII_PACKAGE_INSTANCE *StringPackageInstance;
- EFI_HII_DATA *HiiData;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_STRING_PACK *StringPack;
- RELOFST Token;
- UINT32 Length;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
- //
- // Check numeric value against the head of the database
- //
- PackageInstance = NULL;
- for (HandleDatabase = HiiData->DatabaseHead;
- HandleDatabase != NULL;
- HandleDatabase = HandleDatabase->NextHandleDatabase
- ) {
- //
- // Match the numeric value with the database entry - if matched, extract PackageInstance
- //
- if (Handle == HandleDatabase->Handle) {
- PackageInstance = HandleDatabase->Buffer;
- }
- }
- //
- // No handle was found - error condition
- //
- if (PackageInstance == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ValidatePack (This, PackageInstance, &StringPackageInstance, NULL);
-
- //
- // Based on if there is IFR data in this package instance, determine
- // what the location is of the beginning of the string data.
- //
- if (StringPackageInstance->IfrSize > 0) {
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (&StringPackageInstance->IfrData) + StringPackageInstance->IfrSize);
- } else {
- StringPack = (EFI_HII_STRING_PACK *) (&StringPackageInstance->IfrData);
- }
-
- //
- // Remember that the string packages are formed into contiguous blocks of language data.
- //
- for (; StringPack->Header.Length != 0;) {
- //
- // Find the PrimaryLanguage being requested
- //
- Token = StringPack->LanguageNameString;
- if (CompareMem ((VOID *) ((CHAR8 *) (StringPack) + Token), PrimaryLanguage, 3) == 0) {
- //
- // Now that we found the primary, the secondary languages will follow immediately
- // or the next character is a NULL if there are no secondary languages. We determine
- // the number by getting the stringsize based on the StringPack origination + the LanguageNameString
- // offset + 6 (which is the size of the first 3 letter ISO primary language name). If we get 2, there
- // are no secondary languages (2 = null-terminator).
- //
- Count = StrSize ((VOID *) ((CHAR8 *) (StringPack) + Token + 6));
-
- *LanguageString = AllocateZeroPool (2 * (Count + 1));
-
- ASSERT (*LanguageString);
-
- CopyMem (*LanguageString, (VOID *) ((CHAR8 *) (StringPack) + Token + 6), Count);
- break;
- }
-
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + Length);
- }
-
- return EFI_SUCCESS;
-}
-
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.dxs b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.dxs
deleted file mode 100644
index d9b9b57..0000000
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.dxs
+++ /dev/null
@@ -1,25 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- HiiDatabase.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.h b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.h
deleted file mode 100644
index 9283ef0..0000000
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- HiiDatabase.h
-
-Abstract:
-
- This file contains global defines and prototype definitions
- for the HII database.
-
---*/
-
-#ifndef _HIIDATABASE_H
-#define _HIIDATABASE_H
-
-//
-// HII Database Global data
-//
-#define EFI_HII_DATA_SIGNATURE EFI_SIGNATURE_32 ('H', 'i', 'i', 'P')
-
-#define MAX_GLYPH_COUNT 65535
-#define NARROW_GLYPH_ARRAY_SIZE 19
-#define WIDE_GLYPH_ARRAY_SIZE 38
-
-#define SETUP_MAP_NAME L"Setup"
-#define HII_VARIABLE_SUFFIX_USER_DATA L"UserSavedData"
-#define HII_VARIABLE_SUFFIX_DEFAULT_OVERRIDE L"DefaultOverride"
-#define HII_VARIABLE_SUFFIX_MANUFACTURING_OVERRIDE L"ManufacturingOverride"
-
-typedef struct _EFI_HII_HANDLE_DATABASE {
- VOID *Buffer; // Actual buffer pointer
- EFI_HII_HANDLE Handle; // Monotonically increasing value to signify the value returned to caller
- UINT32 NumberOfTokens; // The initial number of tokens when first registered
- struct _EFI_HII_HANDLE_DATABASE *NextHandleDatabase;
-} EFI_HII_HANDLE_DATABASE;
-
-typedef struct {
- EFI_NARROW_GLYPH NarrowGlyphs[MAX_GLYPH_COUNT];
- EFI_WIDE_GLYPH WideGlyphs[MAX_GLYPH_COUNT];
- EFI_KEY_DESCRIPTOR SystemKeyboardLayout[106];
- EFI_KEY_DESCRIPTOR OverrideKeyboardLayout[106];
- BOOLEAN SystemKeyboardUpdate; // Has the SystemKeyboard been updated?
-} EFI_HII_GLOBAL_DATA;
-
-typedef struct {
- UINTN Signature;
-
- EFI_HII_GLOBAL_DATA *GlobalData;
- EFI_HII_HANDLE_DATABASE *DatabaseHead; // Head of the Null-terminated singly-linked list of handles.
- EFI_HII_PROTOCOL Hii;
-} EFI_HII_DATA;
-
-typedef struct {
- EFI_HII_HANDLE Handle;
- EFI_GUID Guid;
- EFI_HII_HANDLE_PACK HandlePack;
- UINTN IfrSize;
- UINTN StringSize;
- EFI_HII_IFR_PACK *IfrData; // All the IFR data stored here
- EFI_HII_STRING_PACK *StringData; // All the String data stored at &IfrData + IfrSize (StringData is just a label - never referenced)
-} EFI_HII_PACKAGE_INSTANCE;
-
-typedef struct {
- EFI_HII_PACK_HEADER Header;
- EFI_IFR_FORM_SET FormSet;
- EFI_IFR_END_FORM_SET EndFormSet;
-} EFI_FORM_SET_STUB;
-
-#define EFI_HII_DATA_FROM_THIS(a) CR (a, EFI_HII_DATA, Hii, EFI_HII_DATA_SIGNATURE)
-
-#define NARROW_WIDTH 8
-#define WIDE_WIDTH 16
-
-extern UINT8 mUnknownGlyph[38];
-
-//
-// Prototypes
-//
-EFI_STATUS
-GetPackSize (
- IN VOID *Pack,
- OUT UINTN *PackSize,
- OUT UINT32 *NumberOfTokens
- )
-;
-
-EFI_STATUS
-ValidatePack (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_PACKAGE_INSTANCE *PackageInstance,
- OUT EFI_HII_PACKAGE_INSTANCE **StringPackageInstance,
- OUT UINT32 *TotalStringCount
- )
-;
-
-//
-// Public Interface Prototypes
-//
-EFI_STATUS
-EFIAPI
-InitializeHiiDatabase (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiNewPack (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_PACKAGES *PackageList,
- OUT EFI_HII_HANDLE *Handle
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiRemovePack (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiFindHandles (
- IN EFI_HII_PROTOCOL *This,
- IN OUT UINT16 *HandleBufferLength,
- OUT EFI_HII_HANDLE *Handle
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiExportDatabase (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN OUT UINTN *BufferSize,
- OUT VOID *Buffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiGetGlyph (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *Source,
- IN OUT UINT16 *Index,
- OUT UINT8 **GlyphBuffer,
- OUT UINT16 *BitWidth,
- IN OUT UINT32 *InternalStatus
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiGlyphToBlt (
- IN EFI_HII_PROTOCOL *This,
- IN UINT8 *GlyphBuffer,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
- IN UINTN Count,
- IN UINTN Width,
- IN UINTN Height,
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiNewString (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *Language,
- IN EFI_HII_HANDLE Handle,
- IN OUT STRING_REF *Reference,
- IN CHAR16 *NewString
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiGetString (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN STRING_REF Token,
- IN BOOLEAN Raw,
- IN CHAR16 *LanguageString,
- IN OUT UINTN *BufferLength,
- OUT EFI_STRING StringBuffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiResetStrings (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiTestString (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *StringToTest,
- IN OUT UINT32 *FirstMissing,
- OUT UINT32 *GlyphBufferSize
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiGetPrimaryLanguages (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- OUT EFI_STRING *LanguageString
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiGetSecondaryLanguages (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN CHAR16 *PrimaryLanguage,
- OUT EFI_STRING *LanguageString
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiGetLine (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN STRING_REF Token,
- IN OUT UINT16 *Index,
- IN UINT16 LineWidth,
- IN CHAR16 *LanguageString,
- IN OUT UINT16 *BufferLength,
- OUT EFI_STRING StringBuffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiGetForms (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN EFI_FORM_ID FormId,
- IN OUT UINTN *BufferLength,
- OUT UINT8 *Buffer
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiGetDefaultImage (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN UINTN DefaultMask,
- OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiUpdateForm (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN EFI_FORM_LABEL Label,
- IN BOOLEAN AddData,
- IN EFI_HII_UPDATE_DATA *Data
- )
-;
-
-EFI_STATUS
-EFIAPI
-HiiGetKeyboardLayout (
- IN EFI_HII_PROTOCOL *This,
- OUT UINT16 *DescriptorCount,
- OUT EFI_KEY_DESCRIPTOR *Descriptor
- )
-;
-
-EFI_STATUS
-HiiCompareLanguage (
- IN CHAR16 *LanguageStringLocation,
- IN CHAR16 *Language
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.msa b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.msa
deleted file mode 100644
index f91338d..0000000
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/HiiDatabase.msa
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>HiiDatabase</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>FCD337AB-B1D3-4EF8-957C-8048606FF670</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for HiiDatabase module.</Abstract>
- <Description>This module inits HII database and installs HII protocol.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>HiiDatabase</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">
- <Keyword>DebugLib</Keyword>
- <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkIfrSupportLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>HiiDatabase.c</Filename>
- <Filename>HiiDatabase.h</Filename>
- <Filename>Forms.c</Filename>
- <Filename>Strings.c</Filename>
- <Filename>Package.c</Filename>
- <Filename>Fonts.c</Filename>
- <Filename>Keyboard.c</Filename>
- <Filename>HiiDatabase.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiFormCallbackProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Variables>
- <Variable Usage="SOMETIMES_CONSUMED">
- <VariableName>0x004C 0x0061 0x006E 0x0067</VariableName>
- <GuidC_Name>gEfiGlobalVariableGuid</GuidC_Name>
- <HelpText>L"Lang" global variable is used as system default language.</HelpText>
- </Variable>
- </Variables>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>InitializeHiiDatabase</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Keyboard.c b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Keyboard.c
deleted file mode 100644
index 8e9417f..0000000
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Keyboard.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Keyboard.c
-
-Abstract:
-
- This file contains the keyboard processing code to the HII database.
-
---*/
-
-
-#include "HiiDatabase.h"
-
-EFI_STATUS
-EFIAPI
-HiiGetKeyboardLayout (
- IN EFI_HII_PROTOCOL *This,
- OUT UINT16 *DescriptorCount,
- OUT EFI_KEY_DESCRIPTOR *Descriptor
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Package.c b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Package.c
deleted file mode 100644
index f4696e7..0000000
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Package.c
+++ /dev/null
@@ -1,673 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Package.c
-
-Abstract:
-
- This file contains the package processing code to the HII database.
-
---*/
-
-
-#include "HiiDatabase.h"
-
-EFI_STATUS
-GetPackSize (
- IN VOID *Pack,
- OUT UINTN *PackSize,
- OUT UINT32 *NumberOfTokens
- )
-/*++
-
-Routine Description:
- Determines the passed in Pack's size and returns the value.
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HII_STRING_PACK *StringPack;
- UINT16 Type;
- UINT32 Length;
-
- *PackSize = 0;
-
- Type = EFI_HII_IFR;
- if (!CompareMem (&((EFI_HII_PACK_HEADER *) Pack)->Type, &Type, sizeof (UINT16))) {
- //
- // The header contains the full IFR length
- //
- CopyMem (&Length, &((EFI_HII_PACK_HEADER *) Pack)->Length, sizeof (Length));
- *PackSize = (UINTN) Length;
- return EFI_SUCCESS;
- }
-
- Type = EFI_HII_STRING;
- if (!CompareMem (&((EFI_HII_PACK_HEADER *) Pack)->Type, &Type, sizeof (UINT16))) {
- //
- // The header contains the STRING package length
- // The assumption is that the strings for all languages
- // are a contiguous block of data and there is a series of
- // these package instances which will terminate with a NULL package
- // instance.
- //
- StringPack = (EFI_HII_STRING_PACK *) Pack;
-
- //
- // There may be multiple instances packed together of strings
- // so we must walk the self describing structures until we encounter
- // the NULL structure to determine the full size.
- //
- CopyMem (&Length, &StringPack->Header.Length, sizeof (Length));
- if (NumberOfTokens != NULL) {
- CopyMem (NumberOfTokens, &StringPack->NumStringPointers, sizeof (UINT32));
- }
-
- while (Length != 0) {
- *PackSize = *PackSize + Length;
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) StringPack + Length);
- CopyMem (&Length, &StringPack->Header.Length, sizeof (Length));
- }
- //
- // Encountered a length of 0, so let's add the space for the NULL terminator
- // pack's length and call it done.
- //
- *PackSize = *PackSize + sizeof (EFI_HII_STRING_PACK);
- return EFI_SUCCESS;
- }
- //
- // We only determine the size of the non-global Package types.
- // If neither IFR or STRING data were found, return an error
- //
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-ValidatePack (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_PACKAGE_INSTANCE *PackageInstance,
- OUT EFI_HII_PACKAGE_INSTANCE **StringPackageInstance,
- OUT UINT32 *TotalStringCount
- )
-/*++
-
-Routine Description:
- Verifies that the package instance is using the correct handle for string operations.
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HII_DATA *HiiData;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_PACKAGE_INSTANCE *HandlePackageInstance;
- UINT8 *RawData;
- EFI_GUID Guid;
- EFI_HII_IFR_PACK *FormPack;
- UINTN Index;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- HandleDatabase = HiiData->DatabaseHead;
- ZeroMem (&Guid, sizeof (EFI_GUID));
-
- *StringPackageInstance = PackageInstance;
-
- //
- // Based on if there is IFR data in this package instance, determine
- // what the location is of the beginning of the string data.
- //
- if (PackageInstance->IfrSize > 0) {
- FormPack = (EFI_HII_IFR_PACK *) ((CHAR8 *) (&PackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER));
- } else {
- //
- // If there is no IFR data assume the caller knows what they are doing.
- //
- return EFI_SUCCESS;
- }
-
- RawData = (UINT8 *) FormPack;
-
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- if (RawData[Index] == EFI_IFR_FORM_SET_OP) {
- //
- // Cache the guid for this formset
- //
- CopyMem (&Guid, &((EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));
- break;
- }
-
- Index = RawData[Index + 1] + Index;
- }
- //
- // If there is no string package, and the PackageInstance->IfrPack.Guid and PackageInstance->Guid are
- // different, we should return the correct handle for the caller to use for strings.
- //
- if ((PackageInstance->StringSize == 0) && (!CompareGuid (&Guid, &PackageInstance->Guid))) {
- //
- // Search the database for a handle that matches the PackageInstance->Guid
- //
- for (; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
- //
- // Get Ifrdata and extract the Guid for it
- //
- HandlePackageInstance = HandleDatabase->Buffer;
-
- ASSERT (HandlePackageInstance->IfrSize != 0);
-
- FormPack = (EFI_HII_IFR_PACK *) ((CHAR8 *) (&HandlePackageInstance->IfrData) + sizeof (EFI_HII_PACK_HEADER));
- RawData = (UINT8 *) FormPack;
-
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- if (RawData[Index] == EFI_IFR_FORM_SET_OP) {
- //
- // Cache the guid for this formset
- //
- CopyMem (&Guid, &((EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));
- break;
- }
-
- Index = RawData[Index + 1] + Index;
- }
- //
- // If the Guid from the new handle matches the original Guid referenced in the original package data
- // return the appropriate package instance data to use.
- //
- if (CompareGuid (&Guid, &PackageInstance->Guid)) {
- if (TotalStringCount != NULL) {
- *TotalStringCount = HandleDatabase->NumberOfTokens;
- }
-
- *StringPackageInstance = HandlePackageInstance;
- }
- }
- //
- // end for
- //
- } else {
- return EFI_SUCCESS;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-HiiNewPack (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_PACKAGES *Packages,
- OUT EFI_HII_HANDLE *Handle
- )
-/*++
-
-Routine Description:
-
- Extracts the various packs from a package list.
-
-Arguments:
-
- This - Pointer of HII protocol.
- Packages - Pointer of HII packages.
- Handle - Handle value to be returned.
-
-Returns:
-
- EFI_SUCCESS - Pacakges has added to HII database successfully.
- EFI_INVALID_PARAMETER - Invalid parameter.
-
---*/
-{
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_HII_DATA *HiiData;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_HANDLE_DATABASE *Database;
- EFI_HII_PACK_HEADER *PackageHeader;
- EFI_HII_GLOBAL_DATA *GlobalData;
- EFI_HII_IFR_PACK *IfrPack;
- EFI_HII_STRING_PACK *StringPack;
- EFI_HII_FONT_PACK *FontPack;
- EFI_HII_KEYBOARD_PACK *KeyboardPack;
- EFI_STATUS Status;
- UINTN IfrSize;
- UINTN StringSize;
- UINTN TotalStringSize;
- UINTN InstanceSize;
- UINTN Count;
- UINTN Index;
- UINT16 Member;
- EFI_GUID Guid;
- EFI_FORM_SET_STUB FormSetStub;
- UINT8 *Location;
- UINT16 Unicode;
- UINT16 NumWideGlyphs;
- UINT16 NumNarrowGlyphs;
- UINT32 NumberOfTokens;
- UINT32 TotalTokenNumber;
- UINT8 *Local;
- EFI_NARROW_GLYPH *NarrowGlyph;
-
- if (Packages->NumberOfPackages == 0 || This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- GlobalData = HiiData->GlobalData;
-
- Database = HiiData->DatabaseHead;
-
- PackageInstance = NULL;
- IfrPack = NULL;
- StringPack = NULL;
- InstanceSize = 0;
- IfrSize = 0;
- StringSize = 0;
- TotalStringSize = 0;
- NumberOfTokens = 0;
- TotalTokenNumber = 0;
-
- //
- // Search through the passed in Packages for the IfrPack and any StringPack.
- //
- for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
-
- PackageHeader = *(EFI_HII_PACK_HEADER **) (((UINT8 *) Packages) + sizeof (EFI_HII_PACKAGES) + Index * sizeof (VOID *));
-
- switch (PackageHeader->Type) {
- case EFI_HII_IFR:
- //
- // There shoule be only one Ifr package.
- //
- ASSERT (IfrPack == NULL);
- IfrPack = (EFI_HII_IFR_PACK *) PackageHeader;
- break;
-
- case EFI_HII_STRING:
- StringPack = (EFI_HII_STRING_PACK *) PackageHeader;
- //
- // Sending me a String Package. Get its size.
- //
- Status = GetPackSize ((VOID *) StringPack, &StringSize, &NumberOfTokens);
- ASSERT (!EFI_ERROR (Status));
-
- //
- // The size which GetPackSize() returns include the null terminator. So if multiple
- // string packages are passed in, merge all these packages, and only pad one null terminator.
- //
- if (TotalStringSize > 0) {
- TotalStringSize -= sizeof (EFI_HII_STRING_PACK);
- }
-
- TotalStringSize += StringSize;
- TotalTokenNumber += NumberOfTokens;
- break;
- }
- }
- //
- // If sending a StringPack without an IfrPack, you must include a GuidId
- //
- if ((StringPack != NULL) && (IfrPack == NULL)) {
- if (Packages->GuidId == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // If passing in an IfrPack and a GuidId is provided, ensure they are the same value.
- //
- if ((IfrPack != NULL) && (Packages->GuidId != NULL)) {
- Location = ((UINT8 *) IfrPack);
- Location = (UINT8 *) (((UINTN) Location) + sizeof (EFI_HII_PACK_HEADER));
-
- //
- // Advance to the Form Set Op-code
- //
- for (Count = 0; ((EFI_IFR_OP_HEADER *) &Location[Count])->OpCode != EFI_IFR_FORM_SET_OP;) {
- Count = Count + ((EFI_IFR_OP_HEADER *) &Location[Count])->Length;
- }
- //
- // Copy to local variable
- //
- CopyMem (&Guid, &((EFI_IFR_FORM_SET *) &Location[Count])->Guid, sizeof (EFI_GUID));
-
- //
- // Check to see if IfrPack->Guid != GuidId
- //
- if (!CompareGuid (&Guid, Packages->GuidId)) {
- //
- // If a string package is present, the GUIDs should have agreed. Return an error
- //
- if (StringPack != NULL) {
- return EFI_INVALID_PARAMETER;
- }
- }
- }
- //
- // If someone is passing in a string only, create a dummy IfrPack with a Guid
- // to enable future searching of this data.
- //
- if ((IfrPack == NULL) && (StringPack != NULL)) {
- ZeroMem (&FormSetStub, sizeof (FormSetStub));
-
- FormSetStub.Header.Type = EFI_HII_IFR;
- FormSetStub.Header.Length = sizeof (EFI_FORM_SET_STUB);
-
- FormSetStub.FormSet.Header.OpCode = EFI_IFR_FORM_SET_OP;
- FormSetStub.FormSet.Header.Length = (UINT8) sizeof (EFI_IFR_FORM_SET);
- //
- // Dummy string
- //
- FormSetStub.FormSet.FormSetTitle = 0x02;
- CopyMem (&FormSetStub.FormSet.Guid, Packages->GuidId, sizeof (EFI_GUID));
-
- FormSetStub.EndFormSet.Header.OpCode = EFI_IFR_END_FORM_SET_OP;
- FormSetStub.EndFormSet.Header.Length = (UINT8) sizeof (EFI_IFR_END_FORM_SET);
- IfrPack = (EFI_HII_IFR_PACK *) &FormSetStub;
- }
-
- if (IfrPack != NULL) {
- //
- // Sending me an IFR Package. Get its size.
- //
- Status = GetPackSize ((VOID *) IfrPack, &IfrSize, NULL);
- ASSERT (!EFI_ERROR (Status));
- }
- //
- // Prepare the internal package instace buffer to store package data.
- //
- InstanceSize = IfrSize + TotalStringSize;
-
- if (InstanceSize != 0) {
- PackageInstance = AllocateZeroPool (InstanceSize + sizeof (EFI_HII_PACKAGE_INSTANCE));
-
- ASSERT (PackageInstance);
-
- //
- // If there is no DatabaseHead allocated - allocate one
- //
- if (HiiData->DatabaseHead == NULL) {
- HiiData->DatabaseHead = AllocateZeroPool (sizeof (EFI_HII_HANDLE_DATABASE));
- ASSERT (HiiData->DatabaseHead);
- }
- //
- // If the head is being used (Handle is non-zero), allocate next Database and
- // add it to the linked-list
- //
- if (HiiData->DatabaseHead->Handle != 0) {
- HandleDatabase = AllocateZeroPool (sizeof (EFI_HII_HANDLE_DATABASE));
-
- ASSERT (HandleDatabase);
-
- for (; Database->NextHandleDatabase != NULL; Database = Database->NextHandleDatabase)
- ;
-
- //
- // We are sitting on the Database entry which contains the null Next pointer. Fix it.
- //
- Database->NextHandleDatabase = HandleDatabase;
-
- }
-
- Database = HiiData->DatabaseHead;
-
- //
- // Initialize this instance data
- //
- for (*Handle = 1; Database->NextHandleDatabase != NULL; Database = Database->NextHandleDatabase) {
- //
- // Since the first Database instance will have a passed back handle of 1, we will continue
- // down the linked list of entries until we encounter the end of the linked list. Each time
- // we go down one level deeper, increment the handle value that will be passed back.
- //
- if (Database->Handle >= *Handle) {
- *Handle = (EFI_HII_HANDLE) (Database->Handle + 1);
- }
- }
-
- PackageInstance->Handle = *Handle;
- PackageInstance->IfrSize = IfrSize;
- PackageInstance->StringSize = TotalStringSize;
- if (Packages->GuidId != NULL) {
- CopyMem (&PackageInstance->Guid, Packages->GuidId, sizeof (EFI_GUID));
- }
-
- Database->Buffer = PackageInstance;
- Database->Handle = PackageInstance->Handle;
- Database->NumberOfTokens = TotalTokenNumber;
- Database->NextHandleDatabase = NULL;
- }
- //
- // Copy the Ifr package data into package instance.
- //
- if (IfrSize > 0) {
- CopyMem (&PackageInstance->IfrData, IfrPack, IfrSize);
- }
- //
- // Main loop to store package data into HII database.
- //
- StringSize = 0;
- TotalStringSize = 0;
-
- for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
-
- PackageHeader = *(EFI_HII_PACK_HEADER **) (((UINT8 *) Packages) + sizeof (EFI_HII_PACKAGES) + Index * sizeof (VOID *));
-
- switch (PackageHeader->Type) {
- case EFI_HII_STRING:
- StringPack = (EFI_HII_STRING_PACK *) PackageHeader;
- //
- // The size which GetPackSize() returns include the null terminator. So if multiple
- // string packages are passed in, merge all these packages, and only pad one null terminator.
- //
- if (TotalStringSize > 0) {
- TotalStringSize -= sizeof (EFI_HII_STRING_PACK);
- }
-
- GetPackSize ((VOID *) StringPack, &StringSize, &NumberOfTokens);
- CopyMem ((CHAR8 *) (&PackageInstance->IfrData) + IfrSize + TotalStringSize, StringPack, StringSize);
-
- TotalStringSize += StringSize;
- break;
-
- case EFI_HII_HANDLES:
- CopyMem (&PackageInstance->HandlePack, PackageHeader, sizeof (EFI_HII_HANDLE_PACK));
- break;
-
- case EFI_HII_FONT:
- FontPack = (EFI_HII_FONT_PACK *) PackageHeader;
- //
- // Add whatever narrow glyphs were passed to us if undefined
- //
- CopyMem (&NumNarrowGlyphs, &FontPack->NumberOfNarrowGlyphs, sizeof (UINT16));
- for (Count = 0; Count <= NumNarrowGlyphs; Count++) {
- Local = (UINT8 *) (&FontPack->NumberOfWideGlyphs + sizeof (UINT8)) + (sizeof (EFI_NARROW_GLYPH)) * Count;
- NarrowGlyph = (EFI_NARROW_GLYPH *) Local;
- CopyMem (&Member, &NarrowGlyph->UnicodeWeight, sizeof (UINT16));
- //
- // If the glyph is already defined, do not overwrite it. It is what it is.
- //
- CopyMem (&Unicode, &GlobalData->NarrowGlyphs[Member].UnicodeWeight, sizeof (UINT16));
- if (Unicode == 0) {
- CopyMem (&GlobalData->NarrowGlyphs[Member], Local, sizeof (EFI_NARROW_GLYPH));
- }
- }
- //
- // Add whatever wide glyphs were passed to us if undefined
- //
- CopyMem (&NumWideGlyphs, &FontPack->NumberOfWideGlyphs, sizeof (UINT16));
- for (Count = 0; Count <= NumWideGlyphs; Count++) {
- Local = (UINT8 *) (&FontPack->NumberOfWideGlyphs + sizeof (UINT8)) +
- (sizeof (EFI_NARROW_GLYPH)) *
- NumNarrowGlyphs;
- CopyMem (
- &Member,
- (UINTN *) (Local + sizeof (EFI_WIDE_GLYPH) * Count),
- sizeof (UINT16)
- );
- //
- // If the glyph is already defined, do not overwrite it. It is what it is.
- //
- CopyMem (&Unicode, &GlobalData->WideGlyphs[Member].UnicodeWeight, sizeof (UINT16));
- if (Unicode == 0) {
- Local = (UINT8*)(&FontPack->NumberOfWideGlyphs + sizeof(UINT8)) + (sizeof(EFI_NARROW_GLYPH)) * NumNarrowGlyphs;
- CopyMem (
- &GlobalData->WideGlyphs[Member],
- (UINTN *) (Local + sizeof (EFI_WIDE_GLYPH) * Count),
- sizeof (EFI_WIDE_GLYPH)
- );
- }
- }
- break;
-
- case EFI_HII_KEYBOARD:
- KeyboardPack = (EFI_HII_KEYBOARD_PACK *) PackageHeader;
- //
- // Sending me a Keyboard Package
- //
- if (KeyboardPack->DescriptorCount > 105) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // If someone updates the Descriptors with a count of 0, blow aware the overrides.
- //
- if (KeyboardPack->DescriptorCount == 0) {
- ZeroMem (GlobalData->OverrideKeyboardLayout, sizeof (EFI_KEY_DESCRIPTOR) * 106);
- }
-
- if (KeyboardPack->DescriptorCount < 106 && KeyboardPack->DescriptorCount > 0) {
- //
- // If SystemKeyboard was updated already, then steer changes to the override database
- //
- if (GlobalData->SystemKeyboardUpdate) {
- ZeroMem (GlobalData->OverrideKeyboardLayout, sizeof (EFI_KEY_DESCRIPTOR) * 106);
- for (Count = 0; Count < KeyboardPack->DescriptorCount; Count++) {
- CopyMem (&Member, &KeyboardPack->Descriptor[Count].Key, sizeof (UINT16));
- CopyMem (
- &GlobalData->OverrideKeyboardLayout[Member],
- &KeyboardPack->Descriptor[Count],
- sizeof (EFI_KEY_DESCRIPTOR)
- );
- }
- } else {
- //
- // SystemKeyboard was never updated, so this is likely the keyboard driver setting the System database.
- //
- ZeroMem (GlobalData->SystemKeyboardLayout, sizeof (EFI_KEY_DESCRIPTOR) * 106);
- for (Count = 0; Count < KeyboardPack->DescriptorCount; Count++) {
- CopyMem (&Member, &KeyboardPack->Descriptor->Key, sizeof (UINT16));
- CopyMem (
- &GlobalData->SystemKeyboardLayout[Member],
- &KeyboardPack->Descriptor[Count],
- sizeof (EFI_KEY_DESCRIPTOR)
- );
- }
- //
- // Just updated the system keyboard database, reflect that in the global flag.
- //
- GlobalData->SystemKeyboardUpdate = TRUE;
- }
- }
- break;
-
- default:
- break;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-HiiRemovePack (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle
- )
-/*++
-
-Routine Description:
- Removes the various packs from a Handle
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_HII_DATA *HiiData;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_HANDLE_DATABASE *PreviousHandleDatabase;
-
- if (This == NULL || Handle == 0) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- HandleDatabase = HiiData->DatabaseHead;
- PackageInstance = NULL;
-
- //
- // Initialize the Previous with the Head of the Database
- //
- PreviousHandleDatabase = HandleDatabase;
-
- for (; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
- //
- // Match the numeric value with the database entry - if matched,
- // free the package instance and apply fix-up to database linked list
- //
- if (Handle == HandleDatabase->Handle) {
- PackageInstance = HandleDatabase->Buffer;
-
- //
- // Free the Package Instance
- //
- FreePool (PackageInstance);
-
- //
- // If this was the only Handle in the database
- //
- if (HiiData->DatabaseHead == HandleDatabase) {
- HiiData->DatabaseHead = NULL;
- }
- //
- // Make the parent->Next point to the current->Next
- //
- PreviousHandleDatabase->NextHandleDatabase = HandleDatabase->NextHandleDatabase;
- FreePool (HandleDatabase);
- return EFI_SUCCESS;
- }
- //
- // If this was not the HandleDatabase entry we were looking for, cache it just in case the next one is
- //
- PreviousHandleDatabase = HandleDatabase;
- }
- //
- // No handle was found - error condition
- //
- if (PackageInstance == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Strings.c b/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Strings.c
deleted file mode 100644
index 4c56ab0..0000000
--- a/EdkModulePkg/Universal/UserInterface/HiiDataBase/Dxe/Strings.c
+++ /dev/null
@@ -1,1271 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Strings.c
-
-Abstract:
-
- This file contains the string processing code to the HII database.
-
---*/
-
-
-#include "HiiDatabase.h"
-
-STATIC
-VOID
-AsciiToUnicode (
- IN UINT8 *Lang,
- IN UINT16 *Language
- )
-{
- UINT8 Count;
-
- //
- // Convert the ASCII Lang variable to a Unicode Language variable
- //
- for (Count = 0; Count < 3; Count++) {
- Language[Count] = (CHAR16) Lang[Count];
- }
-}
-
-EFI_STATUS
-EFIAPI
-HiiTestString (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *StringToTest,
- IN OUT UINT32 *FirstMissing,
- OUT UINT32 *GlyphBufferSize
- )
-/*++
-
-Routine Description:
- Test if all of the characters in a string have corresponding font characters.
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HII_GLOBAL_DATA *GlobalData;
- EFI_HII_DATA *HiiData;
- BOOLEAN WideChar;
- INT32 Location;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
- GlobalData = HiiData->GlobalData;
-
-
- //
- // Rewind through the string looking for a glyph width identifier
- // If no width identifier exists, we assume string has narrow width identifier
- //
- for (WideChar = FALSE, Location = (INT32) *FirstMissing; Location >= 0; Location--) {
- if ((StringToTest[Location] == NARROW_CHAR) || (StringToTest[Location] == WIDE_CHAR)) {
- //
- // We found something that identifies what glyph database to look in
- //
- WideChar = (BOOLEAN) (StringToTest[Location] == WIDE_CHAR);
- break;
- }
- }
-
- //
- // Walk through the string until you hit the null terminator
- //
- for (*GlyphBufferSize = 0; StringToTest[*FirstMissing] != CHAR_NULL; (*FirstMissing)++) {
- //
- // We found something that identifies what glyph database to look in
- //
- if ((StringToTest[*FirstMissing] == NARROW_CHAR) || (StringToTest[*FirstMissing] == WIDE_CHAR)) {
- WideChar = (BOOLEAN) (StringToTest[*FirstMissing] == WIDE_CHAR);
- continue;
- }
-
- if (!WideChar) {
- if (CompareMem (
- GlobalData->NarrowGlyphs[StringToTest[*FirstMissing]].GlyphCol1,
- &mUnknownGlyph,
- NARROW_GLYPH_ARRAY_SIZE
- ) == 0
- ) {
- //
- // Break since this glyph isn't defined
- //
- return EFI_NOT_FOUND;
- }
- } else {
- //
- // Can compare wide glyph against only GlyphCol1 since GlyphCol1 and GlyphCol2 are contiguous - just give correct size
- //
- if (CompareMem (
- GlobalData->WideGlyphs[StringToTest[*FirstMissing]].GlyphCol1,
- &mUnknownGlyph,
- WIDE_GLYPH_ARRAY_SIZE
- ) == 0
- ) {
- //
- // Break since this glyph isn't defined
- //
- return EFI_NOT_FOUND;
- }
- }
-
- *GlyphBufferSize += (WideChar ? sizeof (EFI_WIDE_GLYPH) : sizeof (EFI_NARROW_GLYPH));
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-HiiNewString2 (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *Language,
- IN EFI_HII_HANDLE Handle,
- IN OUT STRING_REF *Reference,
- IN CHAR16 *NewString,
- IN BOOLEAN ResetStrings
- )
-/*++
-
-Routine Description:
-
- This function allows a new String to be added to an already existing String Package.
- We will make a buffer the size of the package + EfiStrSize of the new string. We will
- copy the string package that first gets changed and the following language packages until
- we encounter the NULL string package. All this time we will ensure that the offsets have
- been adjusted.
-
-Arguments:
-
- This - Pointer to the HII protocol.
- Language - Pointer to buffer which contains the language code of this NewString.
- Handle - Handle of the package instance to be processed.
- Reference - The token number for the string. If 0, new string token to be returned through this parameter.
- NewString - Buffer pointer for the new string.
- ResetStrings - Indicate if we are resetting a string.
-
-Returns:
-
- EFI_SUCCESS - The string has been added or reset to Hii database.
- EFI_INVALID_PARAMETER - Some parameter passed in is invalid.
-
---*/
-{
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_HII_PACKAGE_INSTANCE *StringPackageInstance;
- EFI_HII_DATA *HiiData;
- EFI_HII_STRING_PACK *StringPack;
- EFI_HII_STRING_PACK *NewStringPack;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_PACKAGE_INSTANCE *NewBuffer;
- UINT8 *Location;
- UINT8 *StringLocation;
- RELOFST *StringPointer;
- UINTN Count;
- UINTN Size;
- UINTN Index;
- UINTN SecondIndex;
- BOOLEAN AddString;
- EFI_STATUS Status;
- UINTN Increment;
- UINTN StringCount;
- UINT32 TotalStringCount;
- UINT32 OriginalStringCount;
- RELOFST StringSize;
- UINT32 Length;
- RELOFST Offset;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- HandleDatabase = HiiData->DatabaseHead;
- PackageInstance = NULL;
- AddString = FALSE;
- Increment = 0;
- StringCount = 0;
- TotalStringCount = 0;
- OriginalStringCount = 0;
-
- //
- // Check numeric value against the head of the database
- //
- for (; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
- //
- // Match the numeric value with the database entry - if matched, extract PackageInstance
- //
- if (Handle == HandleDatabase->Handle) {
- PackageInstance = HandleDatabase->Buffer;
- if (ResetStrings) {
- TotalStringCount = HandleDatabase->NumberOfTokens;
- }
- break;
- }
- }
- //
- // No handle was found - error condition
- //
- if (PackageInstance == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = ValidatePack (This, PackageInstance, &StringPackageInstance, &TotalStringCount);
-
- //
- // This sets Count to 0 or the size of the IfrData. We intend to use Count as an offset value
- //
- Count = StringPackageInstance->IfrSize;
-
- //
- // This is the size of the complete series of string packs
- //
- Size = StringPackageInstance->StringSize;
-
- //
- // Based on if there is IFR data in this package instance, determine
- // what the location is of the beginning of the string data.
- //
- if (StringPackageInstance->IfrSize > 0) {
- Location = (UINT8 *) (&StringPackageInstance->IfrData) + StringPackageInstance->IfrSize;
- } else {
- Location = (UINT8 *) (&StringPackageInstance->IfrData);
- }
- //
- // We allocate a buffer which is big enough for both adding and resetting string.
- // The size is slightly larger than the real size of the packages when we are resetting a string.
- //
- NewBuffer = AllocateZeroPool (
- sizeof (EFI_HII_PACKAGE_INSTANCE) -
- 2 * sizeof (VOID *) +
- StringPackageInstance->IfrSize +
- StringPackageInstance->StringSize +
- sizeof (RELOFST) +
- StrSize (NewString)
- );
- ASSERT (NewBuffer);
-
- //
- // Copy data to new buffer
- //
- NewBuffer->Handle = StringPackageInstance->Handle;
- NewBuffer->IfrSize = StringPackageInstance->IfrSize;
-
- //
- // The worst case scenario for sizing is that we are adding a new string (not replacing one) and there was not a string
- // package to begin with.
- //
- NewBuffer->StringSize = StringPackageInstance->StringSize + StrSize (NewString) + sizeof (EFI_HII_STRING_PACK);
-
- if (StringPackageInstance->IfrSize > 0) {
- CopyMem (&NewBuffer->IfrData, &StringPackageInstance->IfrData, StringPackageInstance->IfrSize);
- }
-
- StringPack = (EFI_HII_STRING_PACK *) Location;
-
- //
- // There may be multiple instances packed together of strings
- // so we must walk the self describing structures until we encounter
- // what we are looking for. In the meantime, copy everything we encounter
- // to the new buffer.
- //
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- for (; Length != 0;) {
- //
- // If passed in Language ISO value is in this string pack's language string
- // then we are dealing with the strings we want.
- //
- CopyMem (&Offset, &StringPack->LanguageNameString, sizeof (RELOFST));
- Status = HiiCompareLanguage ((CHAR16 *) ((CHAR8 *) (StringPack) + Offset), Language);
-
- if (!EFI_ERROR (Status)) {
- break;
- }
-
- CopyMem (((CHAR8 *) (&NewBuffer->IfrData) + Count), StringPack, Length);
-
- Count = Count + Length;
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + Length);
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- }
- //
- // Found the language pack to update on a particular handle
- // We need to Copy the Contents of this pack and adjust the offset values associated
- // with adding/changing a string. This is a particular piece of code that screams for
- // it being prone to programming error.
- //
- //
- // Copy the string package up to the string data
- //
- StringPointer = (RELOFST *) (StringPack + 1);
- CopyMem (
- ((CHAR8 *) (&NewBuffer->IfrData) + Count),
- StringPack,
- (UINTN) ((UINTN) (StringPointer) - (UINTN) (StringPack))
- );
-
- //
- // Determine the number of StringPointers
- //
- if (!ResetStrings) {
- CopyMem (&TotalStringCount, &StringPack->NumStringPointers, sizeof (RELOFST));
- } else {
- //
- // If we are resetting the strings, use the original value when exported
- //
- CopyMem (&OriginalStringCount, &StringPack->NumStringPointers, sizeof (RELOFST));
- ((EFI_HII_STRING_PACK *) ((CHAR8 *) (&NewBuffer->IfrData) + Count))->LanguageNameString -=
- (
- (RELOFST) (OriginalStringCount - TotalStringCount) *
- sizeof (RELOFST)
- );
- ((EFI_HII_STRING_PACK *) ((CHAR8 *) (&NewBuffer->IfrData) + Count))->PrintableLanguageName -=
- (
- (RELOFST) (OriginalStringCount - TotalStringCount) *
- sizeof (RELOFST)
- );
- ((EFI_HII_STRING_PACK *) ((CHAR8 *) (&NewBuffer->IfrData) + Count))->NumStringPointers = TotalStringCount;
- *Reference = (STRING_REF) (TotalStringCount);
- }
- //
- // If the token value is not valid, error out
- //
- if ((*Reference >= TotalStringCount) && !ResetStrings) {
- FreePool (NewBuffer);
- return EFI_INVALID_PARAMETER;
- }
- //
- // If Reference is 0, update it with what the new token reference will be and turn the AddString flag on
- //
- if (*Reference == 0) {
- *Reference = (STRING_REF) (TotalStringCount);
- AddString = TRUE;
- }
-
- if (AddString) {
- ((EFI_HII_STRING_PACK *) ((CHAR8 *) (&NewBuffer->IfrData) + Count))->LanguageNameString += sizeof (RELOFST);
- ((EFI_HII_STRING_PACK *) ((CHAR8 *) (&NewBuffer->IfrData) + Count))->PrintableLanguageName += sizeof (RELOFST);
- ((EFI_HII_STRING_PACK *) ((CHAR8 *) (&NewBuffer->IfrData) + Count))->NumStringPointers++;
- }
- //
- // Increment offset by amount of copied data
- //
- Count = Count + ((UINTN) (StringPointer) - (UINTN) StringPack);
-
- for (Index = 0; Index < TotalStringCount; Index++) {
- //
- // If we are pointing to the size of the changing string value
- // then cache the old string value so you know what the difference is
- //
- if (Index == *Reference) {
- CopyMem (&Offset, &StringPointer[Index], sizeof (RELOFST));
-
- StringLocation = ((UINT8 *) (StringPack) + Offset);
- for (SecondIndex = 0;
- (StringLocation[SecondIndex] != 0) || (StringLocation[SecondIndex + 1] != 0);
- SecondIndex = SecondIndex + 2
- )
- ;
- SecondIndex = SecondIndex + 2;
-
- Size = SecondIndex;
-
- //
- // NewString is a passed in local string which is assumed to be aligned
- //
- Size = StrSize (NewString) - Size;
- }
- //
- // If we are about to copy the offset of the string that follows the changed string make
- // sure that the offsets are adjusted accordingly
- //
- if ((Index > *Reference) && !ResetStrings) {
- CopyMem (&Offset, &StringPointer[Index], sizeof (RELOFST));
- Offset = (RELOFST) (Offset + Size);
- CopyMem (&StringPointer[Index], &Offset, sizeof (RELOFST));
- }
- //
- // If we are adding a string that means we will have an extra string pointer that will affect all string offsets
- //
- if (AddString) {
- CopyMem (&Offset, &StringPointer[Index], sizeof (RELOFST));
- Offset = (UINT32) (Offset + sizeof (RELOFST));
- CopyMem (&StringPointer[Index], &Offset, sizeof (RELOFST));
- }
- //
- // If resetting the strings, we need to reduce the offset by the difference in the strings
- //
- if (ResetStrings) {
- CopyMem (&Length, &StringPointer[Index], sizeof (RELOFST));
- Length = Length - ((RELOFST) (OriginalStringCount - TotalStringCount) * sizeof (RELOFST));
- CopyMem (&StringPointer[Index], &Length, sizeof (RELOFST));
- }
- //
- // Notice that if the string was being added as a new token, we don't have to worry about the
- // offsets changing in the other indexes
- //
- CopyMem (((CHAR8 *) (&NewBuffer->IfrData) + Count), &StringPointer[Index], sizeof (RELOFST));
- Count = Count + sizeof (RELOFST);
- StringCount++;
- }
- //
- // If we are adding a new string the above for loop did not copy the offset for us
- //
- if (AddString) {
- //
- // Since the Index is pointing to the beginning of the first string, we need to gather the size of the previous
- // offset's string and create an offset to our new string.
- //
- CopyMem (&Offset, &StringPointer[Index - 1], sizeof (RELOFST));
- StringLocation = (UINT8 *) StringPack;
- StringLocation = StringLocation + Offset - sizeof (RELOFST);
-
- //
- // Since StringPack is a packed structure, we need to size it carefully (byte-wise) to avoid alignment issues
- //
- for (Length = 0;
- (StringLocation[Length] != 0) || (StringLocation[Length + 1] != 0);
- Length = (RELOFST) (Length + 2)
- )
- ;
- Length = (RELOFST) (Length + 2);
-
- StringSize = (RELOFST) (Offset + Length);
-
- //
- // Copy the new string offset
- //
- CopyMem (((CHAR8 *) (&NewBuffer->IfrData) + Count), &StringSize, sizeof (RELOFST));
- Count = Count + sizeof (RELOFST);
-
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- Length = Length + sizeof (RELOFST);
- CopyMem (&StringPack->Header.Length, &Length, sizeof (UINT32));
- }
- //
- // Set Location to the First String
- //
- if (ResetStrings) {
- Index = OriginalStringCount;
- }
- //
- // Set Location to the First String
- //
- Location = (UINT8 *) &StringPointer[Index];
- Index = 0;
-
- //
- // Keep copying strings until you run into two CHAR16's in a row that are NULL
- //
- do {
- if ((*Reference == Increment) && !AddString) {
- StringLocation = ((UINT8 *) (&NewBuffer->IfrData) + Count);
- CopyMem (StringLocation, NewString, StrSize (NewString));
-
- //
- // Advance the destination location by Count number of bytes
- //
- Count = Count + StrSize (NewString);
-
- //
- // Add the difference between the new string and the old string to the length
- //
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
-
- //
- // Since StringPack is a packed structure, we need to size it carefully (byte-wise) to avoid alignment issues
- //
- StringLocation = (UINT8 *) &Location[Index];
- for (Offset = 0;
- (StringLocation[Offset] != 0) || (StringLocation[Offset + 1] != 0);
- Offset = (RELOFST) (Offset + 2)
- )
- ;
- Offset = (RELOFST) (Offset + 2);
-
- Length = Length + (UINT32) StrSize (NewString) - Offset;
-
- CopyMem (&StringPack->Header.Length, &Length, sizeof (UINT32));
- } else {
- StringLocation = (UINT8 *) &Location[Index];
- for (Offset = 0;
- (StringLocation[Offset] != 0) || (StringLocation[Offset + 1] != 0);
- Offset = (RELOFST) (Offset + 2)
- )
- ;
- Offset = (RELOFST) (Offset + 2);
-
- CopyMem (((CHAR8 *) (&NewBuffer->IfrData) + Count), StringLocation, Offset);
-
- //
- // Advance the destination location by Count number of bytes
- //
- Count = Count + Offset;
- }
- //
- // Retrieve the number of characters to advance the index - should land at beginning of next string
- //
- Index = Index + Offset;
- Increment++;
- StringCount--;
- Offset = 0;
- } while (StringCount > 0);
-
- //
- // If we are adding a new string, then the above do/while will not suffice
- //
- if (AddString) {
- Offset = (RELOFST) StrSize (NewString);
- CopyMem (((CHAR8 *) (&NewBuffer->IfrData) + Count), NewString, Offset);
-
- Count = Count + StrSize (NewString);
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- Length = Length + (UINT32) StrSize (NewString);
- CopyMem (&StringPack->Header.Length, &Length, sizeof (UINT32));
- }
-
- if (ResetStrings) {
- //
- // Skip the remainder of strings in the string package
- //
- StringCount = OriginalStringCount - TotalStringCount;
-
- while (StringCount > 0) {
- StringLocation = (UINT8 *) &Location[Index];
- for (Offset = 0;
- (StringLocation[Offset] != 0) || (StringLocation[Offset + 1] != 0);
- Offset = (RELOFST) (Offset + 2)
- )
- ;
- Offset = (RELOFST) (Offset + 2);
- Index = Index + Offset;
- StringCount--;
-
- //
- // Adjust the size of the string pack by the string size we just skipped.
- // Also reduce the length by the size of a RelativeOffset value since we
- // obviously would have skipped that as well.
- //
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- Length = Length - Offset - sizeof (RELOFST);
- CopyMem (&StringPack->Header.Length, &Length, sizeof (UINT32));
- }
- }
-
- StringPack = (EFI_HII_STRING_PACK *) &Location[Index];
-
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- for (; Length != 0;) {
-
- CopyMem (((CHAR8 *) (&NewBuffer->IfrData) + Count), StringPack, Length);
-
- Count = Count + Length;
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + Length);
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- }
- //
- // Copy the null terminator to the new buffer
- //
- CopyMem (((CHAR8 *) (&NewBuffer->IfrData) + Count), StringPack, sizeof (EFI_HII_STRING_PACK));
-
- //
- // Based on if there is IFR data in this package instance, determine
- // what the location is of the beginning of the string data.
- //
- if (StringPackageInstance->IfrSize > 0) {
- Location = (UINT8 *) (&StringPackageInstance->IfrData) + StringPackageInstance->IfrSize;
- StringPack = (EFI_HII_STRING_PACK *) Location;
- Location = (UINT8 *) (&NewBuffer->IfrData) + NewBuffer->IfrSize;
- NewStringPack = (EFI_HII_STRING_PACK *) Location;
- } else {
- StringPack = (EFI_HII_STRING_PACK *) (&StringPackageInstance->IfrData);
- NewStringPack = (EFI_HII_STRING_PACK *) (&NewBuffer->IfrData);
- }
-
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- for (; Length != 0;) {
- //
- // Since we updated the old version of the string data as we moved things over
- // And we had a chicken-egg problem with the data we copied, let's post-fix the new
- // buffer with accurate length data.
- //
- CopyMem (&Count, &NewStringPack->Header.Length, sizeof (UINT32));
- CopyMem (&NewStringPack->Header.Length, &StringPack->Header.Length, sizeof (UINT32));
- CopyMem (&StringPack->Header.Length, &Count, sizeof (UINT32));
-
- CopyMem (&Count, &NewStringPack->Header.Length, sizeof (UINT32));
- NewStringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (NewStringPack) + Count);
- CopyMem (&Count, &StringPack->Header.Length, sizeof (UINT32));
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + Count);
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- }
-
- GetPackSize ((VOID *) ((CHAR8 *) (&NewBuffer->IfrData) + NewBuffer->IfrSize), &NewBuffer->StringSize, NULL);
-
- //
- // Search through the handles until the requested handle is found.
- //
- for (HandleDatabase = HiiData->DatabaseHead;
- HandleDatabase->Handle != 0;
- HandleDatabase = HandleDatabase->NextHandleDatabase
- ) {
- if (HandleDatabase->Handle == StringPackageInstance->Handle) {
- //
- // Free the previous buffer associated with this handle, and assign the new buffer to the handle
- //
- FreePool (HandleDatabase->Buffer);
- HandleDatabase->Buffer = NewBuffer;
- break;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-HiiNewString (
- IN EFI_HII_PROTOCOL *This,
- IN CHAR16 *Language,
- IN EFI_HII_HANDLE Handle,
- IN OUT STRING_REF *Reference,
- IN CHAR16 *NewString
- )
-/*++
-
-Routine Description:
- This function allows a new String to be added to an already existing String Package.
- We will make a buffer the size of the package + StrSize of the new string. We will
- copy the string package that first gets changed and the following language packages until
- we encounter the NULL string package. All this time we will ensure that the offsets have
- been adjusted.
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINTN Index;
- CHAR16 *LangCodes;
- CHAR16 Lang[4];
- STRING_REF OriginalValue;
- EFI_STATUS Status;
-
- //
- // To avoid a warning 4 uninitialized variable warning
- //
- Status = EFI_SUCCESS;
-
- Status = HiiGetPrimaryLanguages (
- This,
- Handle,
- &LangCodes
- );
-
- if (!EFI_ERROR (Status)) {
- OriginalValue = *Reference;
-
- if (Language == NULL) {
- for (Index = 0; LangCodes[Index] != 0; Index += 3) {
- *Reference = OriginalValue;
- CopyMem (Lang, &LangCodes[Index], 6);
- Lang[3] = 0;
- Status = HiiNewString2 (
- This,
- Lang,
- Handle,
- Reference,
- NewString,
- FALSE
- );
-
- }
- } else {
- Status = HiiNewString2 (
- This,
- Language,
- Handle,
- Reference,
- NewString,
- FALSE
- );
- }
-
- FreePool (LangCodes);
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-HiiResetStrings (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle
- )
-/*++
-
-Routine Description:
-
- This function removes any new strings that were added after the initial string export for this handle.
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINTN Index;
- CHAR16 *LangCodes;
- CHAR16 Lang[4];
- STRING_REF Reference;
- CHAR16 NewString;
- EFI_STATUS Status;
-
- Reference = 1;
- NewString = 0;
-
- HiiGetPrimaryLanguages (
- This,
- Handle,
- &LangCodes
- );
-
- for (Index = 0; LangCodes[Index] != 0; Index += 3) {
- CopyMem (Lang, &LangCodes[Index], 6);
- Lang[3] = 0;
- Status = HiiNewString2 (
- This,
- Lang,
- Handle,
- &Reference,
- &NewString,
- TRUE
- );
- ASSERT_EFI_ERROR (Status);
- }
-
- FreePool (LangCodes);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-HiiGetString (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN STRING_REF Token,
- IN BOOLEAN Raw,
- IN CHAR16 *LanguageString,
- IN OUT UINTN *BufferLengthTemp,
- OUT EFI_STRING StringBuffer
- )
-/*++
-
-Routine Description:
-
- This function extracts a string from a package already registered with the EFI HII database.
-
-Arguments:
- This - A pointer to the EFI_HII_PROTOCOL instance.
- Handle - The HII handle on which the string resides.
- Token - The string token assigned to the string.
- Raw - If TRUE, the string is returned unedited in the internal storage format described
- above. If false, the string returned is edited by replacing <cr> with <space>
- and by removing special characters such as the <wide> prefix.
- LanguageString - Pointer to a NULL-terminated string containing a single ISO 639-2 language
- identifier, indicating the language to print. If the LanguageString is empty (starts
- with a NULL), the default system language will be used to determine the language.
- BufferLength - Length of the StringBuffer. If the status reports that the buffer width is too
- small, this parameter is filled with the length of the buffer needed.
- StringBuffer - The buffer designed to receive the characters in the string. Type EFI_STRING is
- defined in String.
-
-Returns:
- EFI_INVALID_PARAMETER - If input parameter is invalid.
- EFI_BUFFER_TOO_SMALL - If the *BufferLength is too small.
- EFI_SUCCESS - Operation is successful.
-
---*/
-{
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_HII_PACKAGE_INSTANCE *StringPackageInstance;
- EFI_HII_DATA *HiiData;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_STRING_PACK *StringPack;
- RELOFST *StringPointer;
- EFI_STATUS Status;
- UINTN DataSize;
- CHAR8 Lang[3];
- CHAR16 Language[3];
- UINT32 Length;
- UINTN Count;
- RELOFST Offset;
- UINT16 *Local;
- UINT16 Zero;
- UINT16 Narrow;
- UINT16 Wide;
- UINT16 NoBreak;
- BOOLEAN LangFound;
- UINT16 *BufferLength = (UINT16 *) BufferLengthTemp;
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- LangFound = TRUE;
-
- DataSize = sizeof (Lang);
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- PackageInstance = NULL;
- Zero = 0;
- Narrow = NARROW_CHAR;
- Wide = WIDE_CHAR;
- NoBreak = NON_BREAKING_CHAR;
-
- //
- // Check numeric value against the head of the database
- //
- for (HandleDatabase = HiiData->DatabaseHead;
- HandleDatabase != NULL;
- HandleDatabase = HandleDatabase->NextHandleDatabase
- ) {
- //
- // Match the numeric value with the database entry - if matched, extract PackageInstance
- //
- if (Handle == HandleDatabase->Handle) {
- PackageInstance = HandleDatabase->Buffer;
- break;
- }
- }
- //
- // No handle was found - error condition
- //
- if (PackageInstance == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = ValidatePack (This, PackageInstance, &StringPackageInstance, NULL);
-
- //
- // If there is no specified language, assume the system default language
- //
- if (LanguageString == NULL) {
- //
- // Get system default language
- //
- Status = gRT->GetVariable (
- (CHAR16 *) L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &DataSize,
- Lang
- );
-
- if (EFI_ERROR (Status)) {
- //
- // If Lang doesn't exist, just use the first language you find
- //
- LangFound = FALSE;
- goto LangNotFound;
- }
- //
- // Convert the ASCII Lang variable to a Unicode Language variable
- //
- AsciiToUnicode ((UINT8 *)Lang, Language);
- } else {
- //
- // Copy input ISO value to Language variable
- //
- CopyMem (Language, LanguageString, 6);
- }
- //
- // Based on if there is IFR data in this package instance, determine
- // what the location is of the beginning of the string data.
- //
-LangNotFound:
- if (StringPackageInstance->IfrSize > 0) {
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (&StringPackageInstance->IfrData) + StringPackageInstance->IfrSize);
- } else {
- StringPack = (EFI_HII_STRING_PACK *) (&StringPackageInstance->IfrData);
- }
- //
- // If Token is 0, extract entire string package
- //
- if (Token == 0) {
- //
- // Compute the entire string pack length, including all languages' and the terminating pack's.
- //
- Length = 0;
- while (0 != StringPack->Header.Length) {
- Length += StringPack->Header.Length;
- StringPack = (VOID*)(((UINT8*)StringPack) + StringPack->Header.Length);
- }
- //
- // Back to the start of package.
- //
- StringPack = (VOID*)(((UINT8*)StringPack) - Length);
- //
- // Terminating zero sub-pack.
- //
- Length += sizeof (EFI_HII_STRING_PACK);
-
- //
- // If trying to get the entire string package and have insufficient space. Return error.
- //
- if (Length > *BufferLength || StringBuffer == NULL) {
- *BufferLength = (UINT16)Length;
- return EFI_BUFFER_TOO_SMALL;
- }
- //
- // Copy the Pack to the caller's buffer.
- //
- *BufferLength = (UINT16)Length;
- CopyMem (StringBuffer, StringPack, Length);
-
- return EFI_SUCCESS;
- }
- //
- // There may be multiple instances packed together of strings
- // so we must walk the self describing structures until we encounter
- // what we are looking for, and then extract the string we are looking for
- //
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- for (; Length != 0;) {
- //
- // If passed in Language ISO value is in this string pack's language string
- // then we are dealing with the strings we want.
- //
- CopyMem (&Offset, &StringPack->LanguageNameString, sizeof (RELOFST));
- Status = HiiCompareLanguage ((CHAR16 *) ((CHAR8 *) (StringPack) + Offset), Language);
-
- //
- // If we cannot find the lang variable, we skip this check and use the first language available
- //
- if (LangFound) {
- if (EFI_ERROR (Status)) {
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + Length);
- CopyMem (&Length, &StringPack->Header.Length, sizeof (UINT32));
- continue;
- }
- }
-
- StringPointer = (RELOFST *) (StringPack + 1);
-
- //
- // We have the right string package - size it, and copy it to the StringBuffer
- //
- if (Token >= StringPack->NumStringPointers) {
- return EFI_INVALID_PARAMETER;
- } else {
- CopyMem (&Offset, &StringPointer[Token], sizeof (RELOFST));
- }
- //
- // Since StringPack is a packed structure, we need to determine the string's
- // size safely, thus byte-wise. Post-increment the size to include the null-terminator
- //
- Local = (UINT16 *) ((CHAR8 *) (StringPack) + Offset);
- for (Count = 0; CompareMem (&Local[Count], &Zero, 2); Count++)
- ;
- Count++;
-
- Count = Count * sizeof (CHAR16);;
-
- if (*BufferLength >= Count && StringBuffer != NULL) {
- //
- // Copy the string to the user's buffer
- //
- if (Raw) {
- CopyMem (StringBuffer, Local, Count);
- } else {
- for (Count = 0; CompareMem (Local, &Zero, 2); Local++) {
- //
- // Skip "Narraw, Wide, NoBreak"
- //
- if (CompareMem (Local, &Narrow, 2) &&
- CompareMem (Local, &Wide, 2) &&
- CompareMem (Local, &NoBreak, 2)) {
- CopyMem (&StringBuffer[Count++], Local, 2);
- }
- }
- //
- // Add "NULL" at the end.
- //
- CopyMem (&StringBuffer[Count], &Zero, 2);
- Count++;
- Count *= sizeof (CHAR16);
- }
-
- *BufferLength = (UINT16) Count;
- return EFI_SUCCESS;
- } else {
- *BufferLength = (UINT16) Count;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- }
-
- LangFound = FALSE;
- goto LangNotFound;
-}
-
-EFI_STATUS
-EFIAPI
-HiiGetLine (
- IN EFI_HII_PROTOCOL *This,
- IN EFI_HII_HANDLE Handle,
- IN STRING_REF Token,
- IN OUT UINT16 *Index,
- IN UINT16 LineWidth,
- IN CHAR16 *LanguageString,
- IN OUT UINT16 *BufferLength,
- OUT EFI_STRING StringBuffer
- )
-/*++
-
-Routine Description:
-
- This function allows a program to extract a part of a string of not more than a given width.
- With repeated calls, this allows a calling program to extract "lines" of text that fit inside
- columns. The effort of measuring the fit of strings inside columns is localized to this call.
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINTN Count;
- EFI_HII_PACKAGE_INSTANCE *PackageInstance;
- EFI_HII_PACKAGE_INSTANCE *StringPackageInstance;
- EFI_HII_DATA *HiiData;
- EFI_HII_HANDLE_DATABASE *HandleDatabase;
- EFI_HII_STRING_PACK *StringPack;
- RELOFST *StringPointer;
- CHAR16 *Location;
- EFI_STATUS Status;
- UINTN DataSize;
- CHAR8 Lang[3];
- CHAR16 Language[3];
-
- if (This == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- HiiData = EFI_HII_DATA_FROM_THIS (This);
-
- HandleDatabase = HiiData->DatabaseHead;
-
- PackageInstance = NULL;
- DataSize = 4;
-
- //
- // Check numeric value against the head of the database
- //
- for (; HandleDatabase != NULL; HandleDatabase = HandleDatabase->NextHandleDatabase) {
- //
- // Match the numeric value with the database entry - if matched, extract PackageInstance
- //
- if (Handle == HandleDatabase->Handle) {
- PackageInstance = HandleDatabase->Buffer;
- }
- }
- //
- // No handle was found - error condition
- //
- if (PackageInstance == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = ValidatePack (This, PackageInstance, &StringPackageInstance, NULL);
-
- //
- // If there is no specified language, assume the system default language
- //
- if (LanguageString == NULL) {
- //
- // Get system default language
- //
- Status = gRT->GetVariable (
- (CHAR16 *) L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &DataSize,
- Lang
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Convert the ASCII Lang variable to a Unicode Language variable
- //
- AsciiToUnicode ((UINT8 *)Lang, Language);
- } else {
- //
- // Copy input ISO value to Language variable
- //
- CopyMem (Language, LanguageString, 6);
- }
- //
- // Based on if there is IFR data in this package instance, determine
- // what the location is of the beginning of the string data.
- //
- if (StringPackageInstance->IfrSize > 0) {
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (&StringPackageInstance->IfrData) + StringPackageInstance->IfrSize);
- } else {
- StringPack = (EFI_HII_STRING_PACK *) (&StringPackageInstance->IfrData);
- }
-
- StringPointer = (RELOFST *) (StringPack + 1);
-
- //
- // There may be multiple instances packed together of strings
- // so we must walk the self describing structures until we encounter
- // what we are looking for, and then extract the string we are looking for
- //
- for (; StringPack->Header.Length != 0;) {
- //
- // If passed in Language ISO value is in this string pack's language string
- // then we are dealing with the strings we want.
- //
- Status = HiiCompareLanguage ((CHAR16 *) ((CHAR8 *) (StringPack) + StringPack->LanguageNameString), Language);
-
- if (EFI_ERROR (Status)) {
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + StringPack->Header.Length);
- continue;
- }
-
- Location = (CHAR16 *) ((CHAR8 *) (StringPack) + StringPointer[Token] +*Index * 2);
-
- //
- // If the size of the remaining string is less than the LineWidth
- // then copy the entire thing
- //
- if (StrSize (Location) <= LineWidth) {
- if (*BufferLength >= StrSize (Location)) {
- StrCpy (StringBuffer, Location);
- return EFI_SUCCESS;
- } else {
- *BufferLength = (UINT16) StrSize (Location);
- return EFI_BUFFER_TOO_SMALL;
- }
- } else {
- //
- // Rewind the string from the maximum size until we see a space the break the line
- //
- for (Count = LineWidth; Location[Count] != 0x0020; Count--)
- ;
-
- //
- // Put the index at the next character
- //
- *Index = (UINT16) (Count + 1);
-
- if (*BufferLength >= Count) {
- StrnCpy (StringBuffer, Location, Count);
- return EFI_SUCCESS;
- } else {
- *BufferLength = (UINT16) Count;
- return EFI_BUFFER_TOO_SMALL;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-HiiCompareLanguage (
- IN CHAR16 *LanguageStringLocation,
- IN CHAR16 *Language
- )
-{
- UINT8 *Local;
- UINTN Index;
- CHAR16 *InputString;
- CHAR16 *OriginalInputString;
-
- //
- // Allocate a temporary buffer for InputString
- //
- InputString = AllocateZeroPool (0x100);
-
- ASSERT (InputString);
-
- OriginalInputString = InputString;
-
- Local = (UINT8 *) LanguageStringLocation;
-
- //
- // Determine the size of this packed string safely (e.g. access by byte), post-increment
- // to include the null-terminator
- //
- for (Index = 0; Local[Index] != 0; Index = Index + 2)
- ;
- //
- // MARMAR Index = Index + 2;
- //
- // This is a packed structure that this location comes from, so let's make sure
- // the value is aligned by copying it to a local variable and working on it.
- //
- CopyMem (InputString, LanguageStringLocation, Index);
-
- for (Index = 0; Index < 3; Index++) {
- InputString[Index] = (CHAR16) (InputString[Index] | 0x20);
- Language[Index] = (CHAR16) (Language[Index] | 0x20);
- }
- //
- // If the Language is the same return success
- //
- if (CompareMem (LanguageStringLocation, Language, 6) == 0) {
- FreePool (InputString);
- return EFI_SUCCESS;
- }
- //
- // Skip the first three letters that comprised the primary language,
- // see if what is being compared against is a secondary language
- //
- InputString = InputString + 3;
-
- //
- // If the Language is not the same as the Primary language, see if there are any
- // secondary languages, and if there are see if we have a match. If not, return an error.
- //
- for (Index = 0; InputString[Index] != 0; Index = Index + 3) {
- //
- // Getting in here means we have a secondary language
- //
- if (CompareMem (&InputString[Index], Language, 6) == 0) {
- FreePool (InputString);
- return EFI_SUCCESS;
- }
- }
- //
- // If nothing was found, return the error
- //
- FreePool (OriginalInputString);
- return EFI_NOT_FOUND;
-
-}
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Boolean.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Boolean.c
deleted file mode 100644
index 138725d..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Boolean.c
+++ /dev/null
@@ -1,1367 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Boolean.c
-
-Abstract:
-
- This routine will evaluate the IFR inconsistency data to determine if
- something is a valid entry for a particular expression
-
---*/
-
-#include "Setup.h"
-#include "Ui.h"
-
-//
-// Global stack used to evaluate boolean expresions
-//
-BOOLEAN *mBooleanEvaluationStack = (BOOLEAN) 0;
-BOOLEAN *mBooleanEvaluationStackEnd = (BOOLEAN) 0;
-
-STATIC
-VOID
-GrowBooleanStack (
- IN OUT BOOLEAN **Stack,
- IN UINTN StackSizeInBoolean
- )
-/*++
-
-Routine Description:
-
- Grow size of the boolean stack
-
-Arguments:
-
- Stack - Old stack on the way in and new stack on the way out
-
- StackSizeInBoolean - New size of the stack
-
-Returns:
-
- NONE
-
---*/
-{
- BOOLEAN *NewStack;
-
- NewStack = AllocatePool (StackSizeInBoolean * sizeof (BOOLEAN));
- ASSERT (NewStack != NULL);
-
- if (*Stack != NULL) {
- //
- // Copy to Old Stack to the New Stack
- //
- CopyMem (
- NewStack,
- mBooleanEvaluationStack,
- (mBooleanEvaluationStackEnd - mBooleanEvaluationStack) * sizeof (BOOLEAN)
- );
-
- //
- // Make the Stack pointer point to the old data in the new stack
- //
- *Stack = NewStack + (*Stack - mBooleanEvaluationStack);
-
- //
- // Free The Old Stack
- //
- FreePool (mBooleanEvaluationStack);
- }
-
- mBooleanEvaluationStack = NewStack;
- mBooleanEvaluationStackEnd = NewStack + StackSizeInBoolean;
-}
-
-STATIC
-VOID
-InitializeBooleanEvaluator (
- VOID
- )
-/*++
-
-Routine Description:
-
- Allocate a global stack for boolean processing.
-
-Arguments:
-
- NONE
-
-Returns:
-
- NONE
-
---*/
-{
- BOOLEAN *NullStack;
-
- NullStack = NULL;
- GrowBooleanStack (&NullStack, 0x1000);
-}
-
-STATIC
-VOID
-PushBool (
- IN OUT BOOLEAN **Stack,
- IN BOOLEAN BoolResult
- )
-/*++
-
-Routine Description:
-
- Push an element onto the Boolean Stack
-
-Arguments:
-
- Stack - Current stack location.
- BoolResult - BOOLEAN to push.
-
-Returns:
-
- None.
-
---*/
-{
- CopyMem (*Stack, &BoolResult, sizeof (BOOLEAN));
- *Stack += 1;
-
- if (*Stack >= mBooleanEvaluationStackEnd) {
- //
- // If we run out of stack space make a new one that is 2X as big. Copy
- // the old data into the new stack and update Stack to point to the old
- // data in the new stack.
- //
- GrowBooleanStack (
- Stack,
- (mBooleanEvaluationStackEnd - mBooleanEvaluationStack) * sizeof (BOOLEAN) * 2
- );
- }
-}
-
-STATIC
-BOOLEAN
-PopBool (
- IN OUT BOOLEAN **Stack
- )
-/*++
-
-Routine Description:
-
- Pop an element from the Boolean stack.
-
-Arguments:
-
- Stack - Current stack location
-
-Returns:
-
- Top of the BOOLEAN stack.
-
---*/
-{
- BOOLEAN ReturnValue;
-
- *Stack -= 1;
- CopyMem (&ReturnValue, *Stack, sizeof (BOOLEAN));
- return ReturnValue;
-}
-
-STATIC
-EFI_STATUS
-GrowBooleanExpression (
- IN EFI_INCONSISTENCY_DATA *InconsistentTags,
- OUT VOID **BooleanExpression,
- IN OUT UINTN *BooleanExpressionLength
- )
-{
- UINT8 *NewExpression;
-
- NewExpression = AllocatePool (*BooleanExpressionLength + sizeof (EFI_INCONSISTENCY_DATA));
- ASSERT (NewExpression != NULL);
-
- if (*BooleanExpression != NULL) {
- //
- // Copy Old buffer to the New buffer
- //
- CopyMem (NewExpression, *BooleanExpression, *BooleanExpressionLength);
-
- CopyMem (&NewExpression[*BooleanExpressionLength], InconsistentTags, sizeof (EFI_INCONSISTENCY_DATA));
-
- //
- // Free The Old buffer
- //
- FreePool (*BooleanExpression);
- } else {
- //
- // Copy data into new buffer
- //
- CopyMem (NewExpression, InconsistentTags, sizeof (EFI_INCONSISTENCY_DATA));
- }
-
- *BooleanExpressionLength = *BooleanExpressionLength + sizeof (EFI_INCONSISTENCY_DATA);
- *BooleanExpression = (VOID *) NewExpression;
- return EFI_SUCCESS;
-}
-
-STATIC
-VOID
-CreateBooleanExpression (
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UINT16 Value,
- IN UINT16 Id,
- IN BOOLEAN Complex,
- OUT VOID **BooleanExpression,
- OUT UINTN *BooleanExpressionLength
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINTN Count;
- EFI_INCONSISTENCY_DATA *InconsistentTags;
- EFI_INCONSISTENCY_DATA FakeInconsistentTags;
-
- InconsistentTags = FileFormTags->InconsistentTags;
-
- //
- // Did we run into a question that contains the Id we are looking for?
- //
- for (Count = 0; InconsistentTags->Operand != 0xFF; Count++) {
-
- //
- // Reserve INVALID_OFFSET_VALUE - 1 for TURE and FALSE, because we need to treat them as well
- // as ideqid etc. but they have no coresponding id, so we reserve this value.
- //
- if (InconsistentTags->QuestionId1 == Id ||
- InconsistentTags->QuestionId1 == INVALID_OFFSET_VALUE - 1) {
- //
- // If !Complex - means evaluate a single if/endif expression
- //
- if (!Complex) {
- //
- // If the ConsistencyId does not match the expression we are looking for
- // skip to the next consistency database entry
- //
- if (InconsistentTags->ConsistencyId != Value) {
- goto NextEntry;
- }
- }
- //
- // We need to rewind to the beginning of the Inconsistent expression
- //
- for (;
- (InconsistentTags->Operand != EFI_IFR_INCONSISTENT_IF_OP) &&
- (InconsistentTags->Operand != EFI_IFR_GRAYOUT_IF_OP) &&
- (InconsistentTags->Operand != EFI_IFR_SUPPRESS_IF_OP);
- ) {
- InconsistentTags = InconsistentTags->Previous;
- }
- //
- // Store the consistency check expression, ensure the next for loop starts at the op-code afterwards
- //
- GrowBooleanExpression (InconsistentTags, BooleanExpression, BooleanExpressionLength);
- InconsistentTags = InconsistentTags->Next;
-
- //
- // Keep growing until we hit the End expression op-code or we hit the beginning of another
- // consistency check like grayout/suppress
- //
- for (;
- InconsistentTags->Operand != EFI_IFR_END_IF_OP &&
- InconsistentTags->Operand != EFI_IFR_GRAYOUT_IF_OP &&
- InconsistentTags->Operand != EFI_IFR_SUPPRESS_IF_OP;
- ) {
- GrowBooleanExpression (InconsistentTags, BooleanExpression, BooleanExpressionLength);
- InconsistentTags = InconsistentTags->Next;
- }
- //
- // Store the EndExpression Op-code
- //
- GrowBooleanExpression (InconsistentTags, BooleanExpression, BooleanExpressionLength);
- }
-
-NextEntry:
- if (InconsistentTags->Next != NULL) {
- //
- // Skip to next entry
- //
- InconsistentTags = InconsistentTags->Next;
- }
- }
-
- FakeInconsistentTags.Operand = 0;
-
- //
- // Add one last expression which will signify we have definitely hit the end
- //
- GrowBooleanExpression (&FakeInconsistentTags, BooleanExpression, BooleanExpressionLength);
-}
-
-STATIC
-EFI_STATUS
-BooleanVariableWorker (
- IN CHAR16 *VariableName,
- IN EFI_VARIABLE_DEFINITION *VariableDefinition,
- IN BOOLEAN *StackPtr,
- IN OUT UINTN *SizeOfVariable,
- IN OUT VOID **VariableData
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
-
- Status = gRT->GetVariable (
- VariableName,
- &VariableDefinition->Guid,
- NULL,
- SizeOfVariable,
- *VariableData
- );
-
- if (EFI_ERROR (Status)) {
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- *VariableData = AllocatePool (*SizeOfVariable);
- ASSERT (*VariableData != NULL);
-
- Status = gRT->GetVariable (
- VariableName,
- &VariableDefinition->Guid,
- NULL,
- SizeOfVariable,
- *VariableData
- );
- }
-
- if (Status == EFI_NOT_FOUND) {
- //
- // This is a serious flaw, we must have some standard result if a variable
- // is not found. Our default behavior must either be return a TRUE or FALSE
- // since there is nothing else we can really do. Therefore, my crystal ball
- // says I will return a FALSE
- //
- PushBool (&StackPtr, FALSE);
- }
- }
-
- return Status;
-}
-
-STATIC
-UINT8
-PredicateIfrType (
- IN EFI_INCONSISTENCY_DATA *Iterator
- )
-/*++
-
-Routine Description:
- This routine is for the purpose of predicate whether the Ifr is generated by a VfrCompiler greater than or equal to 1.88 or
- less than 1.88 which is legacy.
-
-Arguments:
- Iterator - The pointer to inconsistency tags
-
-Returns:
-
- 0x2 - If IFR is not legacy
-
- 0x1 - If IFR is legacy
-
---*/
-{
- //
- // legacy Ifr cover the states:
- // Not ...
- // Operand Opcode Operand
- //
- // while Operand means ideqval, TRUE, or other what can be evaluated to True or False,
- // and Opcode means AND or OR.
- //
- if (Iterator->Operand == EFI_IFR_NOT_OP ||
- Iterator->Operand == 0) {
- return 0x1;
- } else if (Iterator->Operand == EFI_IFR_EQ_VAR_VAL_OP ||
- Iterator->Operand == EFI_IFR_EQ_ID_VAL_OP ||
- Iterator->Operand == EFI_IFR_EQ_ID_ID_OP ||
- Iterator->Operand == EFI_IFR_EQ_ID_LIST_OP) {
- Iterator++;
- if (Iterator->Operand == EFI_IFR_AND_OP ||
- Iterator->Operand == EFI_IFR_OR_OP) {
- Iterator--;
- return 0x1;
- }
- Iterator--;
- }
- return 0x2;
-}
-
-STATIC
-VOID
-PostOrderEvaluate (
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UINT16 Width,
- IN OUT EFI_INCONSISTENCY_DATA **PIterator,
- IN OUT BOOLEAN **StackPtr
- )
-/*++
-
-Routine Description:
- PostOrderEvaluate is used for Ifr generated by VfrCompiler greater than or equal to 1.88,
- which generate Operand Operand Opcode type Ifr.
- PostOrderEvaluete only evaluate boolean expression part, not suppressif/grayoutif. TRUE,
- FALSE, >=, >, (, ) are supported.
-
-Arguments:
-
- FileFormTags - The pointer to the tags of the form
-
- Width - Width of Operand, recognized every iteration
-
- PIterator - The pointer to inconsistency tags
-
- StackPtr - The pointer to the evaluation stack
-
-Returns:
-
- TRUE - If value is valid
-
- FALSE - If value is not valid
-
---*/
-{
- BOOLEAN Operator;
- BOOLEAN Operator2;
- UINT16 *MapBuffer;
- UINT16 *MapBuffer2;
- UINT16 MapValue;
- UINT16 MapValue2;
- UINTN SizeOfVariable;
- CHAR16 VariableName[MAXIMUM_VALUE_CHARACTERS];
- VOID *VariableData;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
- EFI_STATUS Status;
- UINTN Index;
- BOOLEAN PushValue;
-
- Operator = FALSE;
- Operator2 = FALSE;
- MapBuffer = NULL;
- MapBuffer2 = NULL;
- MapValue = 0;
- MapValue2 = 0;
- VariableData = NULL;
-
- while (TRUE) {
- if ((*PIterator)->Operand == 0) {
- return;
- }
-
- Width = (*PIterator)->Width;
-
- //
- // Because INVALID_OFFSET_VALUE - 1 is reserved for TRUE or FALSE, omit them.
- //
- if ((*PIterator)->QuestionId1 != INVALID_OFFSET_VALUE &&
- (*PIterator)->QuestionId1 != INVALID_OFFSET_VALUE - 1) {
- ExtractNvValue (FileFormTags, (*PIterator)->VariableNumber, Width, (*PIterator)->QuestionId1, (VOID **) &MapBuffer);
- ExtractNvValue (FileFormTags, (*PIterator)->VariableNumber2, Width, (*PIterator)->QuestionId2, (VOID **) &MapBuffer2);
- if (MapBuffer != NULL) {
- if (Width == 2) {
- MapValue = *MapBuffer;
- } else {
- MapValue = (UINT8) *MapBuffer;
- }
-
- FreePool (MapBuffer);
- }
-
- if (MapBuffer2 != NULL) {
- if (Width == 2) {
- MapValue2 = *MapBuffer2;
- } else {
- MapValue2 = (UINT8) *MapBuffer2;
- }
-
- FreePool (MapBuffer2);
- }
- }
-
- switch ((*PIterator)->Operand) {
- case EFI_IFR_EQ_VAR_VAL_OP:
- UnicodeValueToString (
- VariableName,
- FALSE,
- (UINTN) (*PIterator)->QuestionId1,
- (sizeof (VariableName) / sizeof (VariableName[0])) - 1
- );
-
- SizeOfVariable = 0;
-
- ExtractRequestedNvMap (FileFormTags, (*PIterator)->VariableNumber, &VariableDefinition);
-
- Status = BooleanVariableWorker (
- VariableName,
- VariableDefinition,
- *StackPtr,
- &SizeOfVariable,
- &VariableData
- );
-
- if (!EFI_ERROR (Status)) {
- if (SizeOfVariable == 1) {
- CopyMem (&MapValue, VariableData, 1);
- } else {
- CopyMem (&MapValue, VariableData, 2);
- }
-
- //
- // Do operation after knowing the compare operator.
- //
- MapValue2 = (*PIterator)->Value;
- (*PIterator)++;
- if ((*PIterator)->Operand == EFI_IFR_GT_OP) {
- PushValue = (BOOLEAN) (MapValue > MapValue2);
- } else if ((*PIterator)->Operand == EFI_IFR_GE_OP) {
- PushValue = (BOOLEAN) (MapValue >= MapValue2);
- } else {
- (*PIterator)--;
- PushValue = (BOOLEAN) (MapValue == MapValue2);
- }
- PushBool (StackPtr, PushValue);
- }
-
- break;
-
- case EFI_IFR_EQ_ID_VAL_OP:
- //
- // Do operation after knowing the compare operator.
- //
- MapValue2 = (*PIterator)->Value;
- (*PIterator)++;
- if ((*PIterator)->Operand == EFI_IFR_GT_OP) {
- PushValue = (BOOLEAN) (MapValue > MapValue2);
- } else if ((*PIterator)->Operand == EFI_IFR_GE_OP) {
- PushValue = (BOOLEAN) (MapValue >= MapValue2);
- } else {
- (*PIterator)--;
- PushValue = (BOOLEAN) (MapValue == MapValue2);
- }
- PushBool (StackPtr, PushValue);
- break;
-
- case EFI_IFR_EQ_ID_ID_OP:
- //
- // Do operation after knowing the compare operator.
- //
- (*PIterator)++;
- if ((*PIterator)->Operand == EFI_IFR_GT_OP) {
- PushValue = (BOOLEAN) (MapValue > MapValue2);
- } else if ((*PIterator)->Operand == EFI_IFR_GE_OP) {
- PushValue = (BOOLEAN) (MapValue >= MapValue2);
- } else {
- (*PIterator)--;
- PushValue = (BOOLEAN) (MapValue == MapValue2);
- }
- PushBool (StackPtr, PushValue);
- break;
-
- case EFI_IFR_EQ_ID_LIST_OP:
- for (Index = 0; Index < (*PIterator)->ListLength; Index++) {
- Operator = (BOOLEAN) (MapValue == (*PIterator)->ValueList[Index]);
- if (Operator) {
- break;
- }
- }
-
- PushBool (StackPtr, Operator);
- break;
-
- case EFI_IFR_TRUE_OP:
- PushBool (StackPtr, TRUE);
- break;
-
- case EFI_IFR_FALSE_OP:
- PushBool (StackPtr, FALSE);
- break;
-
- case EFI_IFR_AND_OP:
- Operator = PopBool (StackPtr);
- Operator2 = PopBool (StackPtr);
- PushBool (StackPtr, (BOOLEAN) (Operator && Operator2));
- break;
- case EFI_IFR_OR_OP:
- Operator = PopBool (StackPtr);
- Operator2 = PopBool (StackPtr);
- PushBool (StackPtr, (BOOLEAN) (Operator || Operator2));
- break;
- case EFI_IFR_NOT_OP:
- Operator = PopBool (StackPtr);
- PushBool (StackPtr, (BOOLEAN) (!Operator));
- break;
-
- case EFI_IFR_SUPPRESS_IF_OP:
- case EFI_IFR_GRAYOUT_IF_OP:
- case EFI_IFR_INCONSISTENT_IF_OP:
- default:
- //
- // Return to the previous tag if runs out of boolean expression.
- //
- (*PIterator)--;
- return;
- }
- (*PIterator)++;
- }
-}
-
-BOOLEAN
-ValueIsNotValid (
- IN BOOLEAN Complex,
- IN UINT16 Value,
- IN EFI_TAG *Tag,
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN STRING_REF *PopUp
- )
-/*++
-
-Routine Description:
-
-
-Arguments:
-
-Returns:
-
- TRUE - If value is valid
-
- FALSE - If value is not valid
-
---*/
-{
- BOOLEAN *StackPtr;
- EFI_INCONSISTENCY_DATA *Iterator;
- BOOLEAN Operator;
- BOOLEAN Operator2;
- UINTN Index;
- VOID *BooleanExpression;
- UINTN BooleanExpressionLength;
- BOOLEAN NotOperator;
- BOOLEAN OrOperator;
- BOOLEAN AndOperator;
- BOOLEAN ArtificialEnd;
- UINT16 *MapBuffer;
- UINT16 *MapBuffer2;
- UINT16 MapValue;
- UINT16 MapValue2;
- UINTN SizeOfVariable;
- CHAR16 VariableName[MAXIMUM_VALUE_CHARACTERS];
- VOID *VariableData;
- EFI_STATUS Status;
- UINT16 Id;
- UINT16 Width;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
- BOOLEAN CosmeticConsistency;
- UINT8 IsLegacy;
-
- VariableData = NULL;
- BooleanExpressionLength = 0;
- BooleanExpression = NULL;
- Operator = FALSE;
- ArtificialEnd = FALSE;
- CosmeticConsistency = TRUE;
- IsLegacy = 0;
-
- Id = Tag->Id;
- if (Tag->StorageWidth == 1) {
- Width = 1;
- } else {
- Width = 2;
- }
- CreateBooleanExpression (FileFormTags, Value, Id, Complex, &BooleanExpression, &BooleanExpressionLength);
-
- if (mBooleanEvaluationStack == 0) {
- InitializeBooleanEvaluator ();
- }
-
- if (BooleanExpression == NULL) {
- return FALSE;
- }
-
- StackPtr = mBooleanEvaluationStack;
- Iterator = BooleanExpression;
- MapBuffer = NULL;
- MapBuffer2 = NULL;
- MapValue = 0;
- MapValue2 = 0;
-
- while (TRUE) {
- NotOperator = FALSE;
- OrOperator = FALSE;
- AndOperator = FALSE;
-
- if (Iterator->Operand == 0) {
- return Operator;
- }
-
- //
- // Because INVALID_OFFSET_VALUE - 1 is reserved for TRUE or FALSE, omit them.
- //
- if (Iterator->QuestionId1 != INVALID_OFFSET_VALUE &&
- Iterator->QuestionId1 != INVALID_OFFSET_VALUE-1) {
- ExtractNvValue (FileFormTags, Iterator->VariableNumber, Width, Iterator->QuestionId1, (VOID **) &MapBuffer);
- ExtractNvValue (FileFormTags, Iterator->VariableNumber2, Width, Iterator->QuestionId2, (VOID **) &MapBuffer2);
- if (MapBuffer != NULL) {
- if (Width == 2) {
- MapValue = *MapBuffer;
- } else {
- MapValue = (UINT8) *MapBuffer;
- }
-
- FreePool (MapBuffer);
- }
-
- if (MapBuffer2 != NULL) {
- if (Width == 2) {
- MapValue2 = *MapBuffer2;
- } else {
- MapValue2 = (UINT8) *MapBuffer2;
- }
-
- FreePool (MapBuffer2);
- }
- }
-
- switch (Iterator->Operand) {
- case EFI_IFR_SUPPRESS_IF_OP:
- //
- // Must have hit a suppress followed by a grayout or vice-versa
- //
- if (ArtificialEnd) {
- ArtificialEnd = FALSE;
- Operator = PopBool (&StackPtr);
- if (Operator) {
- Tag->Suppress = TRUE;
- }
-
- return Operator;
- }
-
- ArtificialEnd = TRUE;
- *PopUp = Iterator->Popup;
- break;
-
- case EFI_IFR_GRAYOUT_IF_OP:
- //
- // Must have hit a suppress followed by a grayout or vice-versa
- //
- if (ArtificialEnd) {
- ArtificialEnd = FALSE;
- Operator = PopBool (&StackPtr);
- if (Operator) {
- Tag->GrayOut = TRUE;
- }
-
- return Operator;
- }
-
- ArtificialEnd = TRUE;
- *PopUp = Iterator->Popup;
- break;
-
- case EFI_IFR_INCONSISTENT_IF_OP:
- CosmeticConsistency = FALSE;
- *PopUp = Iterator->Popup;
- break;
-
- //
- // In the case of external variable values, we must read the variable which is
- // named by the human readable version of the OpCode->VariableId and the guid of the formset
- //
- case EFI_IFR_EQ_VAR_VAL_OP:
- //
- // To check whether Ifr is legacy. Once every boolean expression.
- //
- if (IsLegacy == 0) {
- IsLegacy = PredicateIfrType (Iterator);
- }
- if (IsLegacy == 0x2) {
- PostOrderEvaluate (FileFormTags, Width, &Iterator, &StackPtr);
- break;
- }
-
- UnicodeValueToString (
- VariableName,
- FALSE,
- (UINTN) Iterator->QuestionId1,
- (sizeof (VariableName) / sizeof (VariableName[0])) - 1
- );
-
- SizeOfVariable = 0;
-
- ExtractRequestedNvMap (FileFormTags, Iterator->VariableNumber, &VariableDefinition);
-
- Status = BooleanVariableWorker (
- VariableName,
- VariableDefinition,
- StackPtr,
- &SizeOfVariable,
- &VariableData
- );
-
- if (!EFI_ERROR (Status)) {
- if (SizeOfVariable == 1) {
- CopyMem (&MapValue, VariableData, 1);
- } else {
- CopyMem (&MapValue, VariableData, 2);
- }
-
- PushBool (&StackPtr, (BOOLEAN) (MapValue == Iterator->Value));
- }
-
- break;
-
- case EFI_IFR_EQ_ID_VAL_OP:
- //
- // To check whether Ifr is legacy. Once every boolean expression.
- //
- if (IsLegacy == 0) {
- IsLegacy = PredicateIfrType (Iterator);
- }
- if (IsLegacy == 0x2) {
- PostOrderEvaluate (FileFormTags, Width, &Iterator, &StackPtr);
- break;
- }
-
- PushBool (&StackPtr, (BOOLEAN) (MapValue == Iterator->Value));
- break;
-
- case EFI_IFR_EQ_ID_ID_OP:
- //
- // To check whether Ifr is legacy. Once every boolean expression.
- //
- if (IsLegacy == 0) {
- IsLegacy = PredicateIfrType (Iterator);
- }
- if (IsLegacy == 0x2) {
- PostOrderEvaluate (FileFormTags, Width, &Iterator, &StackPtr);
- break;
- }
-
- PushBool (&StackPtr, (BOOLEAN) (MapValue == MapValue2));
- break;
-
- case EFI_IFR_EQ_ID_LIST_OP:
- //
- // To check whether Ifr is legacy. Once every boolean expression.
- //
- if (IsLegacy == 0) {
- IsLegacy = PredicateIfrType (Iterator);
- }
- if (IsLegacy == 0x2) {
- PostOrderEvaluate (FileFormTags, Width, &Iterator, &StackPtr);
- break;
- }
-
- for (Index = 0; Index < Iterator->ListLength; Index++) {
- Operator = (BOOLEAN) (MapValue == Iterator->ValueList[Index]);
- if (Operator) {
- break;
- }
- }
-
- PushBool (&StackPtr, Operator);
- break;
-
- case EFI_IFR_AND_OP:
- Iterator++;
- if (Iterator->Operand == EFI_IFR_NOT_OP) {
- NotOperator = TRUE;
- Iterator++;
- }
-
- if (Iterator->QuestionId1 != INVALID_OFFSET_VALUE) {
- ExtractNvValue (FileFormTags, Iterator->VariableNumber, Width, Iterator->QuestionId1, (VOID **) &MapBuffer);
- ExtractNvValue (FileFormTags, Iterator->VariableNumber2, Width, Iterator->QuestionId2, (VOID **) &MapBuffer2);
- if (MapBuffer != NULL) {
- if (Width == 2) {
- MapValue = *MapBuffer;
- } else {
- MapValue = (UINT8) *MapBuffer;
- }
-
- FreePool (MapBuffer);
- }
-
- if (MapBuffer2 != NULL) {
- if (Width == 2) {
- MapValue2 = *MapBuffer2;
- } else {
- MapValue2 = (UINT8) *MapBuffer2;
- }
-
- FreePool (MapBuffer2);
- }
- }
-
- switch (Iterator->Operand) {
- case EFI_IFR_EQ_ID_VAL_OP:
- //
- // If Not - flip the results
- //
- if (NotOperator) {
- Operator = (BOOLEAN)!(MapValue == Iterator->Value);
- } else {
- Operator = (BOOLEAN) (MapValue == Iterator->Value);
- }
-
- PushBool (&StackPtr, Operator);
- break;
-
- //
- // In the case of external variable values, we must read the variable which is
- // named by the human readable version of the OpCode->VariableId and the guid of the formset
- //
- case EFI_IFR_EQ_VAR_VAL_OP:
- UnicodeValueToString (
- VariableName,
- FALSE,
- (UINTN) Iterator->QuestionId1,
- (sizeof (VariableName) / sizeof (VariableName[0])) - 1
- );
-
- SizeOfVariable = 0;
-
- ExtractRequestedNvMap (FileFormTags, Iterator->VariableNumber, &VariableDefinition);
-
- Status = BooleanVariableWorker (
- VariableName,
- VariableDefinition,
- StackPtr,
- &SizeOfVariable,
- &VariableData
- );
-
- if (!EFI_ERROR (Status)) {
- if (SizeOfVariable == 1) {
- CopyMem (&MapValue, VariableData, 1);
- } else {
- CopyMem (&MapValue, VariableData, 2);
- }
- //
- // If Not - flip the results
- //
- if (NotOperator) {
- PushBool (&StackPtr, (BOOLEAN)!(MapValue == Iterator->Value));
- } else {
- PushBool (&StackPtr, (BOOLEAN) (MapValue == Iterator->Value));
- }
- }
- break;
-
- case EFI_IFR_EQ_ID_ID_OP:
- //
- // If Not - flip the results
- //
- if (NotOperator) {
- Operator = (BOOLEAN)!(MapValue == MapValue2);
- } else {
- Operator = (BOOLEAN) (MapValue == MapValue2);
- }
-
- PushBool (&StackPtr, Operator);
- break;
-
- case EFI_IFR_EQ_ID_LIST_OP:
- for (Index = 0; Index < Iterator->ListLength; Index++) {
- //
- // If Not - flip the results
- //
- if (NotOperator) {
- Operator = (BOOLEAN)!(MapValue == Iterator->ValueList[Index]);
- } else {
- Operator = (BOOLEAN) (MapValue == Iterator->ValueList[Index]);
- }
- //
- // If We are trying to make sure that MapValue != Item[x], keep looking through
- // the list to make sure we don't equal any other items
- //
- if (Operator && NotOperator) {
- continue;
- }
- //
- // If MapValue == Item, then we have succeeded (first found is good enough)
- //
- if (Operator) {
- break;
- }
- }
-
- PushBool (&StackPtr, Operator);
- break;
-
- default:
- return FALSE;
- }
-
- Operator = PopBool (&StackPtr);
- Operator2 = PopBool (&StackPtr);
- PushBool (&StackPtr, (BOOLEAN) (Operator && Operator2));
- break;
-
- case EFI_IFR_OR_OP:
- Iterator++;
- if (Iterator->Operand == EFI_IFR_NOT_OP) {
- NotOperator = TRUE;
- Iterator++;
- }
-
- if (Iterator->QuestionId1 != INVALID_OFFSET_VALUE) {
- ExtractNvValue (FileFormTags, Iterator->VariableNumber, Width, Iterator->QuestionId1, (VOID **) &MapBuffer);
- ExtractNvValue (FileFormTags, Iterator->VariableNumber2, Width, Iterator->QuestionId2, (VOID **) &MapBuffer2);
- if (MapBuffer != NULL) {
- if (Width == 2) {
- MapValue = *MapBuffer;
- } else {
- MapValue = (UINT8) *MapBuffer;
- }
-
- FreePool (MapBuffer);
- }
-
- if (MapBuffer2 != NULL) {
- if (Width == 2) {
- MapValue2 = *MapBuffer2;
- } else {
- MapValue2 = (UINT8) *MapBuffer2;
- }
-
- FreePool (MapBuffer2);
- }
- }
-
- switch (Iterator->Operand) {
- case EFI_IFR_EQ_ID_VAL_OP:
- //
- // If Not - flip the results
- //
- if (NotOperator) {
- Operator = (BOOLEAN)!(MapValue == Iterator->Value);
- } else {
- Operator = (BOOLEAN) (MapValue == Iterator->Value);
- }
-
- PushBool (&StackPtr, Operator);
- break;
-
- //
- // In the case of external variable values, we must read the variable which is
- // named by the human readable version of the OpCode->VariableId and the guid of the formset
- //
- case EFI_IFR_EQ_VAR_VAL_OP:
- UnicodeValueToString (
- VariableName,
- FALSE,
- (UINTN) Iterator->QuestionId1,
- (sizeof (VariableName) / sizeof (VariableName[0])) - 1
- );
-
- SizeOfVariable = 0;
-
- ExtractRequestedNvMap (FileFormTags, Iterator->VariableNumber, &VariableDefinition);
-
- Status = BooleanVariableWorker (
- VariableName,
- VariableDefinition,
- StackPtr,
- &SizeOfVariable,
- &VariableData
- );
-
- if (!EFI_ERROR (Status)) {
- if (SizeOfVariable == 1) {
- CopyMem (&MapValue, VariableData, 1);
- } else {
- CopyMem (&MapValue, VariableData, 2);
- }
- //
- // If Not - flip the results
- //
- if (NotOperator) {
- PushBool (&StackPtr, (BOOLEAN)!(MapValue == Iterator->Value));
- } else {
- PushBool (&StackPtr, (BOOLEAN) (MapValue == Iterator->Value));
- }
- }
- break;
-
- case EFI_IFR_EQ_ID_ID_OP:
- //
- // If Not - flip the results
- //
- if (NotOperator) {
- Operator = (BOOLEAN)!(MapValue == MapValue2);
- } else {
- Operator = (BOOLEAN) (MapValue == MapValue2);
- }
-
- PushBool (&StackPtr, Operator);
- break;
-
- case EFI_IFR_EQ_ID_LIST_OP:
- for (Index = 0; Index < Iterator->ListLength; Index++) {
- //
- // If Not - flip the results
- //
- if (NotOperator) {
- Operator = (BOOLEAN)!(MapValue == Iterator->ValueList[Index]);
- } else {
- Operator = (BOOLEAN) (MapValue == Iterator->ValueList[Index]);
- }
- //
- // If We are trying to make sure that MapValue != Item[x], keep looking through
- // the list to make sure we don't equal any other items
- //
- if (Operator && NotOperator) {
- continue;
- }
- //
- // If MapValue == Item, then we have succeeded (first found is good enough)
- //
- if (Operator) {
- break;
- }
- }
-
- PushBool (&StackPtr, Operator);
- break;
-
- default:
- return FALSE;
- }
-
- Operator = PopBool (&StackPtr);
- Operator2 = PopBool (&StackPtr);
- PushBool (&StackPtr, (BOOLEAN) (Operator || Operator2));
- break;
-
- case EFI_IFR_NOT_OP:
- //
- // To check whether Ifr is legacy. Once every boolean expression.
- //
- if (IsLegacy == 0) {
- IsLegacy = PredicateIfrType (Iterator);
- }
- if (IsLegacy == 0x2) {
- PostOrderEvaluate (FileFormTags, Width, &Iterator, &StackPtr);
- break;
- }
-
- //
- // I don't need to set the NotOperator (I know that I have to NOT this in this case
- //
- Iterator++;
-
- if (Iterator->Operand == EFI_IFR_OR_OP) {
- OrOperator = TRUE;
- Iterator++;
- }
-
- if (Iterator->Operand == EFI_IFR_AND_OP) {
- AndOperator = TRUE;
- Iterator++;
- }
-
- if (Iterator->QuestionId1 != INVALID_OFFSET_VALUE) {
- ExtractNvValue (FileFormTags, Iterator->VariableNumber, Width, Iterator->QuestionId1, (VOID **) &MapBuffer);
- ExtractNvValue (FileFormTags, Iterator->VariableNumber2, Width, Iterator->QuestionId2, (VOID **) &MapBuffer2);
- if (MapBuffer != NULL) {
- if (Width == 2) {
- MapValue = *MapBuffer;
- } else {
- MapValue = (UINT8) *MapBuffer;
- }
-
- FreePool (MapBuffer);
- }
-
- if (MapBuffer2 != NULL) {
- if (Width == 2) {
- MapValue2 = *MapBuffer2;
- } else {
- MapValue2 = (UINT8) *MapBuffer2;
- }
-
- FreePool (MapBuffer2);
- }
- }
-
- switch (Iterator->Operand) {
- case EFI_IFR_EQ_ID_VAL_OP:
- Operator = (BOOLEAN)!(MapValue == Iterator->Value);
- PushBool (&StackPtr, Operator);
- break;
-
- //
- // In the case of external variable values, we must read the variable which is
- // named by the human readable version of the OpCode->VariableId and the guid of the formset
- //
- case EFI_IFR_EQ_VAR_VAL_OP:
- UnicodeValueToString (
- VariableName,
- FALSE,
- (UINTN) Iterator->QuestionId1,
- (sizeof (VariableName) / sizeof (VariableName[0])) - 1
- );
-
- SizeOfVariable = 0;
-
- ExtractRequestedNvMap (FileFormTags, Iterator->VariableNumber, &VariableDefinition);
-
- Status = BooleanVariableWorker (
- VariableName,
- VariableDefinition,
- StackPtr,
- &SizeOfVariable,
- &VariableData
- );
-
- if (!EFI_ERROR (Status)) {
- if (SizeOfVariable == 1) {
- CopyMem (&MapValue, VariableData, 1);
- } else {
- CopyMem (&MapValue, VariableData, 2);
- }
-
- PushBool (&StackPtr, (BOOLEAN)!(MapValue == Iterator->Value));
- }
- break;
-
- case EFI_IFR_EQ_ID_ID_OP:
- Operator = (BOOLEAN)!(MapValue == MapValue2);
- PushBool (&StackPtr, Operator);
- break;
-
- case EFI_IFR_EQ_ID_LIST_OP:
- for (Index = 0; Index < Iterator->ListLength; Index++) {
- Operator = (BOOLEAN)!(MapValue == Iterator->ValueList[Index]);
- if (Operator) {
- continue;
- }
- }
-
- PushBool (&StackPtr, Operator);
- break;
-
- default:
- return FALSE;
- }
-
- Operator = PopBool (&StackPtr);
- Operator2 = PopBool (&StackPtr);
-
- if (OrOperator) {
- PushBool (&StackPtr, (BOOLEAN) (Operator || Operator2));
- }
-
- if (AndOperator) {
- PushBool (&StackPtr, (BOOLEAN) (Operator && Operator2));
- }
-
- if (!OrOperator && !AndOperator) {
- PushBool (&StackPtr, Operator);
- }
- break;
-
- case EFI_IFR_TRUE_OP:
- //
- // To check whether Ifr is legacy. Once every boolean expression.
- //
- if (IsLegacy == 0) {
- IsLegacy = PredicateIfrType (Iterator);
- }
- if (IsLegacy == 0x2) {
- PostOrderEvaluate (FileFormTags, Width, &Iterator, &StackPtr);
- break;
- }
- break;
-
- case EFI_IFR_FALSE_OP:
- //
- // To check whether Ifr is legacy. Once every boolean expression.
- //
- if (IsLegacy == 0) {
- IsLegacy = PredicateIfrType (Iterator);
- }
- if (IsLegacy == 0x2) {
- PostOrderEvaluate (FileFormTags, Width, &Iterator, &StackPtr);
- break;
- }
- break;
-
- case EFI_IFR_END_IF_OP:
- Operator = PopBool (&StackPtr);
- //
- // If there is an error, return, otherwise keep looking - there might
- // be another test that causes an error
- //
- if (Operator) {
- if (Complex && CosmeticConsistency) {
- return EFI_SUCCESS;
- } else {
- return Operator;
- }
- } else {
- //
- // If not doing a global consistency check, the endif is the REAL terminator of this operation
- // This is used for grayout/suppress operations. InconsistentIf is a global operation so the EndIf is
- // not the end-all be-all of terminators.
- //
- if (!Complex) {
- return Operator;
- }
- break;
- }
-
- default:
- //
- // Must have hit a non-consistency related op-code after a suppress/grayout
- //
- if (ArtificialEnd) {
- ArtificialEnd = FALSE;
- Operator = PopBool (&StackPtr);
- return Operator;
- }
-
- goto Done;
- }
-
- Iterator++;
- }
-
-Done:
- return FALSE;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Colors.h b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Colors.h
deleted file mode 100644
index c1f5441..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Colors.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Colors.h
-
-Abstract:
-
-
-Revision History
-
---*/
-
-#ifndef _COLORS_H
-#define _COLORS_H
-
-//
-// Screen Color Settings
-//
-#define PICKLIST_HIGHLIGHT_TEXT EFI_WHITE
-#define PICKLIST_HIGHLIGHT_BACKGROUND EFI_BACKGROUND_CYAN
-#define TITLE_TEXT EFI_WHITE
-#define TITLE_BACKGROUND EFI_BACKGROUND_BLUE
-#define KEYHELP_TEXT EFI_LIGHTGRAY
-#define KEYHELP_BACKGROUND EFI_BACKGROUND_BLACK
-#define SUBTITLE_TEXT EFI_BLUE
-#define SUBTITLE_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
-#define BANNER_TEXT EFI_BLUE
-#define BANNER_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
-#define FIELD_TEXT EFI_BLACK
-#define FIELD_TEXT_GRAYED EFI_DARKGRAY
-#define FIELD_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
-#define FIELD_TEXT_HIGHLIGHT EFI_LIGHTGRAY
-#define FIELD_BACKGROUND_HIGHLIGHT EFI_BACKGROUND_BLACK
-#define POPUP_TEXT EFI_LIGHTGRAY
-#define POPUP_BACKGROUND EFI_BACKGROUND_BLUE
-#define POPUP_INVERSE_TEXT EFI_LIGHTGRAY
-#define POPUP_INVERSE_BACKGROUND EFI_BACKGROUND_BLACK
-#define HELP_TEXT EFI_BLUE
-#define ERROR_TEXT EFI_RED | EFI_BRIGHT
-#define INFO_TEXT EFI_YELLOW | EFI_BRIGHT
-#define ARROW_TEXT EFI_RED | EFI_BRIGHT
-#define ARROW_BACKGROUND EFI_BACKGROUND_LIGHTGRAY
-
-#endif
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/InputHandler.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/InputHandler.c
deleted file mode 100644
index 85e1a0c..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/InputHandler.c
+++ /dev/null
@@ -1,1570 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- InputHandler.C
-
-Abstract:
-
- Implementation for handling user input from the User Interface
-
-Revision History
-
---*/
-
-#include "Setup.h"
-#include "Ui.h"
-#include "Colors.h"
-
-#define EFI_MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b))
-
-EFI_STATUS
-ReadString(
- IN UI_MENU_OPTION *MenuOption,
- OUT CHAR16 *StringPtr
- )
-{
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- CHAR16 NullCharacter;
- UINTN ScreenSize;
- EFI_TAG *Tag;
- CHAR16 Space[2];
- CHAR16 KeyPad[2];
- BOOLEAN SelectionComplete;
- CHAR16 *TempString;
- CHAR16 *BufferedString;
- UINTN Index;
- UINTN Count;
- UINTN Start;
- UINTN Top;
- CHAR16 *PromptForDataString;
- UINTN DimensionsWidth;
- UINTN DimensionsHeight;
- BOOLEAN CursorVisible;
-
- DimensionsWidth = gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn;
- DimensionsHeight = gScreenDimensions.BottomRow - gScreenDimensions.TopRow;
-
- PromptForDataString = GetToken (STRING_TOKEN (PROMPT_FOR_DATA), gHiiHandle);
-
- NullCharacter = CHAR_NULL;
- ScreenSize = GetStringWidth (PromptForDataString) / 2;
- Tag = MenuOption->ThisTag;
- Space[0] = L' ';
- Space[1] = CHAR_NULL;
- SelectionComplete = FALSE;
-
- TempString = AllocateZeroPool (MenuOption->ThisTag->Maximum * 2);
- ASSERT (TempString);
-
- if (ScreenSize < (Tag->Maximum / (UINTN) 2)) {
- ScreenSize = Tag->Maximum / 2;
- }
-
- if ((ScreenSize + 2) > DimensionsWidth) {
- ScreenSize = DimensionsWidth - 2;
- }
-
- BufferedString = AllocateZeroPool (ScreenSize * 2);
- ASSERT (BufferedString);
-
- Start = (DimensionsWidth - ScreenSize - 2) / 2 + gScreenDimensions.LeftColumn + 1;
- Top = ((DimensionsHeight - 6) / 2) + gScreenDimensions.TopRow - 1;
-
- //
- // Display prompt for string
- //
- CreatePopUp (ScreenSize, 4, &NullCharacter, PromptForDataString, Space, &NullCharacter);
-
- FreePool (PromptForDataString);
-
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_BLACK, EFI_LIGHTGRAY));
-
- CursorVisible = gST->ConOut->Mode->CursorVisible;
- gST->ConOut->EnableCursor (gST->ConOut, TRUE);
-
- do {
- Status = WaitForKeyStroke (&Key);
-
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_BLACK, EFI_LIGHTGRAY));
- switch (Key.UnicodeChar) {
- case CHAR_NULL:
- switch (Key.ScanCode) {
- case SCAN_LEFT:
- break;
-
- case SCAN_RIGHT:
- break;
-
- case SCAN_ESC:
- FreePool (TempString);
- FreePool (BufferedString);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
- return EFI_DEVICE_ERROR;
-
- default:
- break;
- }
-
- break;
-
- case CHAR_CARRIAGE_RETURN:
- if (GetStringWidth (StringPtr) >= MenuOption->ThisTag->Minimum) {
- SelectionComplete = TRUE;
- FreePool (TempString);
- FreePool (BufferedString);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
- return EFI_SUCCESS;
- } else {
- ScreenSize = GetStringWidth (gMiniString) / 2;
- CreatePopUp (ScreenSize, 4, &NullCharacter, gMiniString, gPressEnter, &NullCharacter);
- //
- // Simply create a popup to tell the user that they had typed in too few characters.
- // To save code space, we can then treat this as an error and return back to the menu.
- //
- do {
- Status = WaitForKeyStroke (&Key);
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- FreePool (TempString);
- FreePool (BufferedString);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
- return EFI_DEVICE_ERROR;
- }
-
- break;
-
- case CHAR_BACKSPACE:
- if (StringPtr[0] != CHAR_NULL) {
- for (Index = 0; StringPtr[Index] != CHAR_NULL; Index++) {
- TempString[Index] = StringPtr[Index];
- }
- //
- // Effectively truncate string by 1 character
- //
- TempString[Index - 1] = CHAR_NULL;
- StrCpy (StringPtr, TempString);
- }
-
- default:
- //
- // If it is the beginning of the string, don't worry about checking maximum limits
- //
- if ((StringPtr[0] == CHAR_NULL) && (Key.UnicodeChar != CHAR_BACKSPACE)) {
- StrnCpy (StringPtr, &Key.UnicodeChar, 1);
- StrnCpy (TempString, &Key.UnicodeChar, 1);
- } else if ((GetStringWidth (StringPtr) < MenuOption->ThisTag->Maximum) && (Key.UnicodeChar != CHAR_BACKSPACE)) {
- KeyPad[0] = Key.UnicodeChar;
- KeyPad[1] = CHAR_NULL;
- StrCat (StringPtr, KeyPad);
- StrCat (TempString, KeyPad);
- }
- //
- // If the width of the input string is now larger than the screen, we nee to
- // adjust the index to start printing portions of the string
- //
- SetUnicodeMem (BufferedString, ScreenSize - 1, L' ');
-
- PrintStringAt (Start + 1, Top + 3, BufferedString);
-
- if ((GetStringWidth (StringPtr) / 2) > (DimensionsWidth - 2)) {
- Index = (GetStringWidth (StringPtr) / 2) - DimensionsWidth + 2;
- } else {
- Index = 0;
- }
-
- for (Count = 0; Index + 1 < GetStringWidth (StringPtr) / 2; Index++, Count++) {
- BufferedString[Count] = StringPtr[Index];
- }
-
- PrintStringAt (Start + 1, Top + 3, BufferedString);
- break;
- }
-
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- gST->ConOut->SetCursorPosition (gST->ConOut, Start + GetStringWidth (StringPtr) / 2, Top + 3);
- } while (!SelectionComplete);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
- return Status;
-}
-
-EFI_STATUS
-ReadPassword (
- IN UI_MENU_OPTION *MenuOption,
- IN BOOLEAN PromptForPassword,
- IN EFI_TAG *Tag,
- IN EFI_IFR_DATA_ARRAY *PageData,
- IN BOOLEAN SecondEntry,
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- OUT CHAR16 *StringPtr
- )
-{
- EFI_STATUS Status;
- UINTN ScreenSize;
- CHAR16 NullCharacter;
- CHAR16 Space[2];
- EFI_INPUT_KEY Key;
- CHAR16 KeyPad[2];
- UINTN Index;
- UINTN Start;
- UINTN Top;
- CHAR16 *TempString;
- CHAR16 *TempString2;
- BOOLEAN Confirmation;
- BOOLEAN ConfirmationComplete;
- EFI_HII_CALLBACK_PACKET *Packet;
- EFI_FORM_CALLBACK_PROTOCOL *FormCallback;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
- UINTN DimensionsWidth;
- UINTN DimensionsHeight;
- EFI_IFR_DATA_ENTRY *DataEntry;
- UINTN WidthOfString;
-
- DimensionsWidth = gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn;
- DimensionsHeight = gScreenDimensions.BottomRow - gScreenDimensions.TopRow;
-
- VariableDefinition = NULL;
- NullCharacter = CHAR_NULL;
- Space[0] = L' ';
- Space[1] = CHAR_NULL;
- Confirmation = FALSE;
- ConfirmationComplete = FALSE;
- Status = EFI_SUCCESS;
- FormCallback = NULL;
- Packet = NULL;
-
- //
- // Remember that dynamic pages in an environment where all pages are not
- // dynamic require us to call back to the user to give them an opportunity
- // to register fresh information in the HII database so that we can extract it.
- //
- Status = gBS->HandleProtocol (
- (VOID *) (UINTN) MenuOption->Tags[0].CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- (VOID **) &FormCallback
- );
-
- TempString = AllocateZeroPool (MenuOption->ThisTag->Maximum * 2);
- TempString2 = AllocateZeroPool (MenuOption->ThisTag->Maximum * 2);
-
- ASSERT (TempString);
- ASSERT (TempString2);
-
- if (Tag->Flags & EFI_IFR_FLAG_INTERACTIVE) {
- //
- // Password requires a callback to determine if a password exists
- //
- DataEntry = (EFI_IFR_DATA_ENTRY *) (PageData + 1);
- DataEntry->OpCode = EFI_IFR_PASSWORD_OP;
- DataEntry->Length = 3;
-
- ExtractRequestedNvMap (FileFormTags, Tag->VariableNumber, &VariableDefinition);
-
- //
- // The user is about to be prompted with a password field, Data = 0 (Return Status determines the type of prompt)
- //
- DataEntry->Data = (VOID *) (UINTN) (UINT8) (0 + SecondEntry * 2);
- PageData->NvRamMap = VariableDefinition->NvRamMap;
-
- if ((FormCallback != NULL) && (FormCallback->Callback != NULL)) {
- Status = FormCallback->Callback (
- FormCallback,
- Tag->Key,
- PageData,
- &Packet
- );
- }
- //
- // If error on return, continue with the reading of a typed in password to verify user knows password
- // If no error, there is no password set, so prompt for new password
- // if the previous callback was to verify the user knew password, and user typed it correctly - should return no error
- //
- if (!EFI_ERROR (Status)) {
- PromptForPassword = FALSE;
-
- //
- // Simulate this as the second entry into this routine for an interactive behavior
- //
- SecondEntry = TRUE;
- } else if (Status == EFI_NOT_READY) {
-Error:
- if (Packet != NULL) {
- //
- // Upon error, we will likely receive a string to print out
- // Display error popup
- //
- WidthOfString = GetStringWidth (Packet->String);
- ScreenSize = EFI_MAX(WidthOfString, GetStringWidth (gPressEnter)) / 2;
- CreatePopUp (ScreenSize, 4, &NullCharacter, Packet->String, gPressEnter, &NullCharacter);
- FreePool (Packet);
-
- do {
- Status = WaitForKeyStroke (&Key);
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- }
-
- Status = EFI_NOT_READY;
- goto Done;
- }
- }
-
- do {
- //
- // Display PopUp Screen
- //
- ScreenSize = GetStringWidth (gPromptForNewPassword) / 2;
- if (GetStringWidth (gConfirmPassword) / 2 > ScreenSize) {
- ScreenSize = GetStringWidth (gConfirmPassword) / 2;
- }
-
- Start = (DimensionsWidth - ScreenSize - 4) / 2 + gScreenDimensions.LeftColumn + 2;
- Top = ((DimensionsHeight - 6) / 2) + gScreenDimensions.TopRow - 1;
-
- if (!Confirmation) {
- if (PromptForPassword) {
- CreatePopUp (ScreenSize, 4, &NullCharacter, gPromptForPassword, Space, &NullCharacter);
- } else {
- CreatePopUp (ScreenSize, 4, &NullCharacter, gPromptForNewPassword, Space, &NullCharacter);
- }
- } else {
- CreatePopUp (ScreenSize, 4, &NullCharacter, gConfirmPassword, Space, &NullCharacter);
- StringPtr[0] = CHAR_NULL;
- }
-
- do {
- Status = WaitForKeyStroke (&Key);
-
- switch (Key.UnicodeChar) {
- case CHAR_NULL:
- if (Key.ScanCode == SCAN_ESC) {
- return EFI_NOT_READY;
- }
-
- ConfirmationComplete = FALSE;
- break;
-
- case CHAR_CARRIAGE_RETURN:
- if (Tag->Flags & EFI_IFR_FLAG_INTERACTIVE) {
- //
- // User just typed a string in
- //
- DataEntry = (EFI_IFR_DATA_ENTRY *) (PageData + 1);
- DataEntry->OpCode = EFI_IFR_PASSWORD_OP;
-
- //
- // If the user just typed in a password, Data = 1
- // If the user just typed in a password to confirm the previous password, Data = 2
- //
- if (!Confirmation) {
- DataEntry->Length = 3;
- DataEntry->Data = (VOID *) (UINTN) (UINT8) (1 + SecondEntry * 2);
-
- if ((FormCallback != NULL) && (FormCallback->Callback != NULL)) {
- Status = FormCallback->Callback (
- FormCallback,
- Tag->Key,
- PageData,
- &Packet
- );
- }
-
- DataEntry->Length = sizeof (EFI_IFR_DATA_ENTRY);
- DataEntry->Data = (VOID *) TempString;
- } else {
- DataEntry->Length = 3;
- DataEntry->Data = (VOID *) (UINTN) (UINT8) (2 + SecondEntry * 2);
-
- if ((FormCallback != NULL) && (FormCallback->Callback != NULL)) {
- Status = FormCallback->Callback (
- FormCallback,
- Tag->Key,
- PageData,
- &Packet
- );
- }
-
- DataEntry->Length = sizeof (EFI_IFR_DATA_ENTRY);
- DataEntry->Data = (VOID *) TempString2;
- }
-
- if ((FormCallback != NULL) && (FormCallback->Callback != NULL)) {
- Status = FormCallback->Callback (
- FormCallback,
- Tag->Key,
- PageData,
- &Packet
- );
- }
- //
- // If this was the confirmation round of callbacks
- // and an error comes back, display an error
- //
- if (Confirmation) {
- if (EFI_ERROR (Status)) {
- if (Packet->String == NULL) {
- WidthOfString = GetStringWidth (gConfirmError);
- ScreenSize = EFI_MAX (WidthOfString, GetStringWidth (gPressEnter)) / 2;
- CreatePopUp (ScreenSize, 4, &NullCharacter, gConfirmError, gPressEnter, &NullCharacter);
- } else {
- WidthOfString = GetStringWidth (Packet->String);
- ScreenSize = EFI_MAX (WidthOfString, GetStringWidth (gPressEnter)) / 2;
- CreatePopUp (ScreenSize, 4, &NullCharacter, Packet->String, gPressEnter, &NullCharacter);
- FreePool (Packet);
- }
-
- StringPtr[0] = CHAR_NULL;
- do {
- Status = WaitForKeyStroke (&Key);
-
- if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
- Status = EFI_NOT_READY;
- goto Done;
- }
- } while (1);
- } else {
- Status = EFI_NOT_READY;
- goto Done;
- }
- } else {
- //
- // User typed a string in and it wasn't valid somehow from the callback
- // For instance, callback may have said that some invalid characters were contained in the string
- //
- if (Status == EFI_NOT_READY) {
- goto Error;
- }
-
- if (PromptForPassword && EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
- }
- }
-
- if (Confirmation) {
- //
- // Compare tempstring and tempstring2, if the same, return with StringPtr success
- // Otherwise, kick and error box, and return an error
- //
- if (StrCmp (TempString, TempString2) == 0) {
- Status = EFI_SUCCESS;
- goto Done;
- } else {
- WidthOfString = GetStringWidth (gConfirmError);
- ScreenSize = EFI_MAX (WidthOfString, GetStringWidth (gPressEnter)) / 2;
- CreatePopUp (ScreenSize, 4, &NullCharacter, gConfirmError, gPressEnter, &NullCharacter);
- StringPtr[0] = CHAR_NULL;
- do {
- Status = WaitForKeyStroke (&Key);
- if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) {
- Status = EFI_DEVICE_ERROR;
- goto Done;
- }
- } while (1);
- }
- }
-
- if (PromptForPassword) {
- //
- // I was asked for a password, return it back in StringPtr
- //
- Status = EFI_SUCCESS;
- goto Done;
- } else {
- //
- // If the two passwords were not the same kick an error popup
- //
- Confirmation = TRUE;
- ConfirmationComplete = TRUE;
- break;
- }
-
- case CHAR_BACKSPACE:
- if (StringPtr[0] != CHAR_NULL) {
- if (!Confirmation) {
- for (Index = 0; StringPtr[Index] != CHAR_NULL; Index++) {
- TempString[Index] = StringPtr[Index];
- }
- //
- // Effectively truncate string by 1 character
- //
- TempString[Index - 1] = CHAR_NULL;
- StrCpy (StringPtr, TempString);
- } else {
- for (Index = 0; StringPtr[Index] != CHAR_NULL; Index++) {
- TempString2[Index] = StringPtr[Index];
- }
- //
- // Effectively truncate string by 1 character
- //
- TempString2[Index - 1] = CHAR_NULL;
- StrCpy (StringPtr, TempString2);
- }
-
- ConfirmationComplete = FALSE;
- } else {
- ConfirmationComplete = FALSE;
- }
-
- //
- // Must be a character we are interested in!
- //
- default:
- if ((StringPtr[0] == CHAR_NULL) && (Key.UnicodeChar != CHAR_BACKSPACE)) {
- if (!Confirmation) {
- StrnCpy (StringPtr, &Key.UnicodeChar, 1);
- StrnCpy (TempString, &Key.UnicodeChar, 1);
- } else {
- StrnCpy (StringPtr, &Key.UnicodeChar, 1);
- StrnCpy (TempString2, &Key.UnicodeChar, 1);
- ConfirmationComplete = FALSE;
- }
- } else if ((GetStringWidth (StringPtr) / 2 <= (UINTN) (MenuOption->ThisTag->Maximum - 1) / 2) &&
- (Key.UnicodeChar != CHAR_BACKSPACE)
- ) {
- KeyPad[0] = Key.UnicodeChar;
- KeyPad[1] = CHAR_NULL;
- if (!Confirmation) {
- StrCat (StringPtr, KeyPad);
- StrCat (TempString, KeyPad);
- } else {
- StrCat (StringPtr, KeyPad);
- StrCat (TempString2, KeyPad);
- }
- }
-
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_BLACK, EFI_LIGHTGRAY));
- for (Index = 1; Index < ScreenSize; Index++) {
- PrintCharAt (Start + Index, Top + 3, L' ');
- }
-
- gST->ConOut->SetCursorPosition (
- gST->ConOut,
- (DimensionsWidth - GetStringWidth (StringPtr) / 2) / 2 + gScreenDimensions.LeftColumn,
- Top + 3
- );
- for (Index = 0; Index + 1 < GetStringWidth (StringPtr) / 2; Index++) {
- PrintChar (L'*');
- }
-
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- break;
- }
- //
- // end switch
- //
- } while (!ConfirmationComplete);
-
- } while (1);
-
-Done:
- FreePool (TempString);
- FreePool (TempString2);
- return Status;
-}
-
-VOID
-EncodePassword (
- IN CHAR16 *Password,
- IN UINT8 MaxSize
- )
-{
- UINTN Index;
- UINTN Loop;
- CHAR16 *Buffer;
- CHAR16 *Key;
-
- Key = (CHAR16 *) L"MAR10648567";
- Buffer = AllocateZeroPool (MaxSize);
-
- ASSERT (Buffer);
-
- for (Index = 0; Key[Index] != 0; Index++) {
- for (Loop = 0; Loop < (UINT8) (MaxSize / 2); Loop++) {
- Buffer[Loop] = (CHAR16) (Password[Loop] ^ Key[Index]);
- }
- }
-
- CopyMem (Password, Buffer, MaxSize);
-
- FreePool (Buffer);
- return ;
-}
-
-EFI_STATUS
-GetNumericInput (
- IN UI_MENU_OPTION *MenuOption,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN BOOLEAN ManualInput,
- IN EFI_TAG *Tag,
- IN UINTN NumericType,
- OUT UINT16 *Value
- )
-/*++
-
-Routine Description:
-
- This routine reads a numeric value from the user input.
-
-Arguments:
-
- MenuOption - Pointer to the current input menu.
-
- FileFormTagsHead - Pointer to the root of formset.
-
- ManualInput - If the input is manual or not.
-
- Tag - Pointer to all the attributes and values associated with a tag.
-
- Value - Pointer to the numeric value that is going to be read.
-
-Returns:
-
- EFI_SUCCESS - If numerical input is read successfully
- EFI_DEVICE_ERROR - If operation fails
-
---*/
-{
- EFI_INPUT_KEY Key;
- BOOLEAN SelectionComplete;
- UINTN Column;
- UINTN Row;
- CHAR16 FormattedNumber[6];
- UINTN PreviousNumber[6];
- INTN Number;
- UINTN Count;
- UINT16 BackupValue;
- STRING_REF PopUp;
- CHAR16 NullCharacter;
- CHAR16 *StringPtr;
- EFI_FILE_FORM_TAGS *FileFormTags;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
- UINTN Loop;
-
- NullCharacter = CHAR_NULL;
- StringPtr = NULL;
- Column = MenuOption->OptCol;
- Row = MenuOption->Row;
- Number = 0;
- PreviousNumber[0] = 0;
- Count = 0;
- SelectionComplete = FALSE;
- BackupValue = Tag->Value;
- FileFormTags = FileFormTagsHead;
-
- if (ManualInput) {
- PrintAt (Column, Row, (CHAR16 *) L"[ ]");
- Column++;
- if (Tag->Operand != EFI_IFR_TIME_OP) {
- *Value = BackupValue;
- }
- }
- //
- // First time we enter this handler, we need to check to see if
- // we were passed an increment or decrement directive
- //
- do {
- Key.UnicodeChar = CHAR_NULL;
- if (gDirection != 0) {
- Key.ScanCode = gDirection;
- gDirection = 0;
- goto TheKey2;
- }
-
- WaitForKeyStroke (&Key);
-
-TheKey2:
- switch (Key.UnicodeChar) {
- case '+':
- case '-':
- if ((Tag->Operand == EFI_IFR_DATE_OP) || (Tag->Operand == EFI_IFR_TIME_OP)) {
- Key.UnicodeChar = CHAR_NULL;
- if (Key.UnicodeChar == '+') {
- Key.ScanCode = SCAN_RIGHT;
- } else {
- Key.ScanCode = SCAN_LEFT;
- }
-
- goto TheKey2;
- }
- break;
-
- case CHAR_NULL:
- switch (Key.ScanCode) {
- case SCAN_LEFT:
- case SCAN_RIGHT:
- if ((Tag->Operand == EFI_IFR_DATE_OP) || (Tag->Operand == EFI_IFR_TIME_OP)) {
- //
- // By setting this value, we will return back to the caller.
- // We need to do this since an auto-refresh will destroy the adjustment
- // based on what the real-time-clock is showing. So we always commit
- // upon changing the value.
- //
- gDirection = SCAN_DOWN;
- }
-
- if (!ManualInput) {
- Tag->Value = *Value;
- if (Key.ScanCode == SCAN_LEFT) {
- Number = *Value - Tag->Step;
- if (Number < Tag->Minimum) {
- Number = Tag->Minimum;
- }
- } else if (Key.ScanCode == SCAN_RIGHT) {
- Number = *Value + Tag->Step;
- if (Number > Tag->Maximum) {
- Number = Tag->Maximum;
- }
- }
-
- Tag->Value = (UINT16) Number;
- *Value = (UINT16) Number;
- UnicodeValueToString (
- FormattedNumber,
- FALSE,
- (UINTN) Number,
- (sizeof (FormattedNumber) / sizeof (FormattedNumber[0]))
- );
- Number = (UINT16) GetStringWidth (FormattedNumber);
-
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);
- if ((Tag->Operand == EFI_IFR_DATE_OP) || (Tag->Operand == EFI_IFR_TIME_OP)) {
- for (Loop = 0; Loop < (UINTN) ((Number >= 8) ? 4 : 2); Loop++) {
- PrintAt (MenuOption->OptCol + Loop, MenuOption->Row, (CHAR16 *) L" ");
- }
- } else {
- for (Loop = 0; Loop < gOptionBlockWidth; Loop++) {
- PrintAt (MenuOption->OptCol + Loop, MenuOption->Row, (CHAR16 *) L" ");
- }
- }
-
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT_HIGHLIGHT | FIELD_BACKGROUND_HIGHLIGHT);
-
- if ((MenuOption->Col + gPromptBlockWidth + 1) == MenuOption->OptCol) {
- PrintCharAt (MenuOption->OptCol, Row, LEFT_NUMERIC_DELIMITER);
- Column = MenuOption->OptCol + 1;
- }
- //
- // If Number looks like "3", convert it to "03/"
- //
- if (Number == 4 && (NumericType == DATE_NUMERIC)) {
- FormattedNumber[3] = FormattedNumber[1];
- FormattedNumber[2] = DATE_SEPARATOR;
- FormattedNumber[1] = FormattedNumber[0];
- FormattedNumber[0] = L'0';
- Number = 8;
- }
- //
- // If Number looks like "13", convert it to "13/"
- //
- if (Number == 6 && (NumericType == DATE_NUMERIC)) {
- FormattedNumber[3] = FormattedNumber[2];
- FormattedNumber[2] = DATE_SEPARATOR;
- Number = 8;
- }
-
- if (Number == 4 &&
- (NumericType == TIME_NUMERIC) &&
- (MenuOption->Col + gPromptBlockWidth + 8) != MenuOption->OptCol
- ) {
- FormattedNumber[3] = FormattedNumber[1];
- FormattedNumber[2] = TIME_SEPARATOR;
- FormattedNumber[1] = FormattedNumber[0];
- FormattedNumber[0] = L'0';
- Number = 8;
- }
-
- if (Number == 4 &&
- (NumericType == TIME_NUMERIC) &&
- (MenuOption->Col + gPromptBlockWidth + 8) == MenuOption->OptCol
- ) {
- FormattedNumber[3] = FormattedNumber[1];
- FormattedNumber[2] = RIGHT_NUMERIC_DELIMITER;
- FormattedNumber[1] = FormattedNumber[0];
- FormattedNumber[0] = L'0';
- Number = 8;
- }
-
- PrintStringAt (Column, Row, FormattedNumber);
- if (Number == 10 && (NumericType == DATE_NUMERIC)) {
- PrintChar (RIGHT_NUMERIC_DELIMITER);
- }
-
- if (NumericType == REGULAR_NUMERIC) {
- PrintChar (RIGHT_NUMERIC_DELIMITER);
- }
- }
- break;
-
- case SCAN_UP:
- case SCAN_DOWN:
- goto EnterCarriageReturn;
-
- case SCAN_ESC:
- return EFI_DEVICE_ERROR;
-
- default:
- break;
- }
-
- break;
-
-EnterCarriageReturn:
-
- case CHAR_CARRIAGE_RETURN:
- //
- // Check to see if the Value is something reasonable against consistency limitations.
- // If not, let's kick the error specified.
- //
- //
- // This gives us visibility to the FileFormTags->NvRamMap to check things
- // ActiveIfr is a global maintained by the menuing code to ensure that we
- // are pointing to the correct formset's file data.
- //
- for (Count = 0; Count < gActiveIfr; Count++) {
- FileFormTags = FileFormTags->NextFile;
- }
-
- ExtractRequestedNvMap (FileFormTags, Tag->VariableNumber, &VariableDefinition);
-
- CopyMem (&VariableDefinition->NvRamMap[Tag->StorageStart], &Tag->Value, Tag->StorageWidth);
-
- //
- // Data associated with a NULL device (in the fake NV storage)
- //
- if (Tag->StorageWidth == (UINT16) 0) {
- CopyMem (&VariableDefinition->FakeNvRamMap[Tag->StorageStart], &Tag->Value, 2);
- }
- //
- // If a late check is required save off the information. This is used when consistency checks
- // are required, but certain values might be bound by an impossible consistency check such as
- // if two questions are bound by consistency checks and each only has two possible choices, there
- // would be no way for a user to switch the values. Thus we require late checking.
- //
- if (Tag->Flags & EFI_IFR_FLAG_LATE_CHECK) {
- CopyMem (&Tag->OldValue, &BackupValue, Tag->StorageWidth);
- } else {
- //
- // In theory, passing the value and the Id are sufficient to determine what needs
- // to be done. The Id is the key to look for the entry needed in the Inconsistency
- // database. That will yields operand and ID data - and since the ID's correspond
- // to the NV storage, we can determine the values for other IDs there.
- //
- if (ValueIsNotValid (TRUE, 0, Tag, FileFormTags, &PopUp)) {
- if (PopUp == 0x0000) {
- SelectionComplete = TRUE;
- break;
- }
-
- StringPtr = GetToken (PopUp, MenuOption->Handle);
-
- CreatePopUp (GetStringWidth (StringPtr) / 2, 3, &NullCharacter, StringPtr, &NullCharacter);
-
- do {
- WaitForKeyStroke (&Key);
-
- switch (Key.UnicodeChar) {
-
- case CHAR_CARRIAGE_RETURN:
- SelectionComplete = TRUE;
- FreePool (StringPtr);
- break;
-
- default:
- break;
- }
- } while (!SelectionComplete);
-
- Tag->Value = BackupValue;
- *Value = BackupValue;
-
- CopyMem (&VariableDefinition->NvRamMap[Tag->StorageStart], &Tag->Value, Tag->StorageWidth);
-
- //
- // Data associated with a NULL device (in the fake NV storage)
- //
- if (Tag->StorageWidth == (UINT16) 0) {
- CopyMem (&VariableDefinition->FakeNvRamMap[Tag->StorageStart], &Tag->Value, 2);
- }
-
- return EFI_DEVICE_ERROR;
- }
- }
-
- return EFI_SUCCESS;
- break;
-
- case CHAR_BACKSPACE:
- if (ManualInput) {
- if (Count == 0) {
- break;
- }
- //
- // Remove a character
- //
- Number = PreviousNumber[Count - 1];
- *Value = (UINT16) Number;
- UpdateStatusBar (INPUT_ERROR, Tag->Flags, FALSE);
- Count--;
- Column--;
- PrintAt (Column, Row, (CHAR16 *) L" ");
- }
- break;
-
- default:
- if (ManualInput) {
- if (Key.UnicodeChar > L'9' || Key.UnicodeChar < L'0') {
- UpdateStatusBar (INPUT_ERROR, Tag->Flags, TRUE);
- break;
- }
- //
- // If Count 0-4 is complete, there is no way more is valid
- //
- if (Count > 4) {
- break;
- }
- //
- // Someone typed something valid!
- //
- if (Count != 0) {
- Number = Number * 10 + (Key.UnicodeChar - L'0');
- } else {
- Number = Key.UnicodeChar - L'0';
- }
-
- if (Number > Tag->Maximum) {
- UpdateStatusBar (INPUT_ERROR, Tag->Flags, TRUE);
- Number = PreviousNumber[Count];
- break;
- } else {
- UpdateStatusBar (INPUT_ERROR, Tag->Flags, FALSE);
- }
-
- Count++;
-
- PreviousNumber[Count] = Number;
- *Value = (UINT16) Number;
- Tag->Value = (UINT16) Number;
-
- PrintCharAt (Column, Row, Key.UnicodeChar);
- Column++;
- }
- break;
- }
- } while (!SelectionComplete);
- return EFI_SUCCESS;
-}
-//
-// Notice that this is at least needed for the ordered list manipulation.
-// Left/Right doesn't make sense for this op-code
-//
-EFI_STATUS
-GetSelectionInputPopUp (
- IN UI_MENU_OPTION *MenuOption,
- IN EFI_TAG *Tag,
- IN UINTN ValueCount,
- OUT UINT16 *Value,
- OUT UINT16 *KeyValue
- )
-{
- EFI_INPUT_KEY Key;
- UINTN Index;
- UINTN TempIndex;
- CHAR16 *StringPtr;
- CHAR16 *TempStringPtr;
- UINT16 Token;
- UINTN Index2;
- UINTN TopOptionIndex;
- UINTN HighlightPosition;
- UINTN Start;
- UINTN End;
- UINTN Top;
- UINTN Bottom;
- UINT16 TempValue;
- UINTN Count;
- UINTN PopUpMenuLines;
- UINTN MenuLinesInView;
- UINTN PopUpWidth;
- CHAR16 Character;
- BOOLEAN FirstOptionFoundFlag;
- INT32 SavedAttribute;
- EFI_TAG TagBackup;
- UINT8 *ValueArray;
- UINT8 *ValueArrayBackup;
- UINT8 ValueBackup;
- BOOLEAN Initialized;
- BOOLEAN KeyInitialized;
- BOOLEAN ShowDownArrow;
- BOOLEAN ShowUpArrow;
- UINTN DimensionsWidth;
-
- DimensionsWidth = gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn;
-
- TempValue = 0;
- TempIndex = 0;
- ValueArray = (UINT8 *) Value;
- ValueArrayBackup = NULL;
- Initialized = FALSE;
- KeyInitialized = FALSE;
- ShowDownArrow = FALSE;
- ShowUpArrow = FALSE;
-
- if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {
- ValueArrayBackup = AllocateZeroPool (Tag->StorageWidth);
- ASSERT (ValueArrayBackup != NULL);
- CopyMem (ValueArrayBackup, ValueArray, ValueCount);
- TempValue = *(UINT8 *) (ValueArray);
- if (ValueArray[0] != 0x00) {
- Initialized = TRUE;
- }
-
- for (Index = 0; ValueArray[Index] != 0x00; Index++)
- ;
- ValueCount = Index;
- } else {
- TempValue = *Value;
- }
-
- Count = 0;
- PopUpWidth = 0;
-
- FirstOptionFoundFlag = FALSE;
-
- StringPtr = AllocateZeroPool ((gOptionBlockWidth + 1) * 2);
- ASSERT (StringPtr);
-
- //
- // Initialization for "One of" pop-up menu
- //
- //
- // Get the number of one of options present and its size
- //
- for (Index = MenuOption->TagIndex; MenuOption->Tags[Index].Operand != EFI_IFR_END_ONE_OF_OP; Index++) {
- if (MenuOption->Tags[Index].Operand == EFI_IFR_ONE_OF_OPTION_OP &&
- !MenuOption->Tags[Index].Suppress) {
- if (!FirstOptionFoundFlag) {
- FirstOptionFoundFlag = TRUE;
- }
-
- Count++;
- Token = MenuOption->Tags[Index].Text;
-
- //
- // If this is an ordered list that is initialized
- //
- if (Initialized) {
- for (ValueBackup = (UINT8) MenuOption->TagIndex;
- MenuOption->Tags[ValueBackup].Operand != EFI_IFR_END_OP;
- ValueBackup++
- ) {
- if (MenuOption->Tags[ValueBackup].Value == ((UINT8 *) ValueArrayBackup)[Index - MenuOption->TagIndex - 1]) {
- StringPtr = GetToken (MenuOption->Tags[ValueBackup].Text, MenuOption->Handle);
- break;
- }
- }
- } else {
- StringPtr = GetToken (Token, MenuOption->Handle);
- }
-
- if (StrLen (StringPtr) > PopUpWidth) {
- PopUpWidth = StrLen (StringPtr);
- }
-
- FreePool (StringPtr);
- }
- }
- //
- // Perform popup menu initialization.
- //
- PopUpMenuLines = Count;
- PopUpWidth = PopUpWidth + POPUP_PAD_SPACE_COUNT;
-
- SavedAttribute = gST->ConOut->Mode->Attribute;
- gST->ConOut->SetAttribute (gST->ConOut, POPUP_TEXT | POPUP_BACKGROUND);
-
- if ((PopUpWidth + POPUP_FRAME_WIDTH) > DimensionsWidth) {
- PopUpWidth = DimensionsWidth - POPUP_FRAME_WIDTH;
- }
-
- Start = (DimensionsWidth - PopUpWidth - POPUP_FRAME_WIDTH) / 2 + gScreenDimensions.LeftColumn;
- End = Start + PopUpWidth + POPUP_FRAME_WIDTH;
- Top = gScreenDimensions.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT;
- Bottom = gScreenDimensions.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT;
-
- MenuLinesInView = Bottom - Top - 1;
- if (MenuLinesInView >= PopUpMenuLines) {
- Top = Top + (MenuLinesInView - PopUpMenuLines) / 2;
- Bottom = Top + PopUpMenuLines + 1;
- } else {
- TempValue = MenuOption->Tags[MenuOption->TagIndex + 1].Value;
- ShowDownArrow = TRUE;
- }
-
- TopOptionIndex = 1;
- HighlightPosition = 0;
- do {
- if (Initialized) {
- for (Index = MenuOption->TagIndex, Index2 = 0; Index2 < ValueCount; Index++, Index2++) {
- //
- // Set the value for the item we are looking for
- //
- Count = ValueArrayBackup[Index2];
-
- //
- // If we hit the end of the Array, we are complete
- //
- if (Count == 0) {
- break;
- }
-
- if (MenuOption->Tags[Index].Operand == EFI_IFR_ONE_OF_OPTION_OP) {
- for (ValueBackup = (UINT8) MenuOption->TagIndex;
- MenuOption->Tags[ValueBackup].Operand != EFI_IFR_END_ONE_OF_OP;
- ValueBackup++
- ) {
- //
- // We just found what we are looking for
- //
- if (MenuOption->Tags[ValueBackup].Value == Count) {
- //
- // As long as the two indexes aren't the same, we have
- // two different op-codes we need to swap internally
- //
- if (Index != ValueBackup) {
- //
- // Backup destination tag, then copy source to destination, then copy backup to source location
- //
- CopyMem (&TagBackup, &MenuOption->Tags[Index], sizeof (EFI_TAG));
- CopyMem (&MenuOption->Tags[Index], &MenuOption->Tags[ValueBackup], sizeof (EFI_TAG));
- CopyMem (&MenuOption->Tags[ValueBackup], &TagBackup, sizeof (EFI_TAG));
- } else {
- //
- // If the indexes are the same, then the op-code is where he belongs
- //
- }
- }
- }
- } else {
- //
- // Since this wasn't an option op-code (likely the ordered list op-code) decerement Index2
- //
- Index2--;
- }
- }
- }
- //
- // Clear that portion of the screen
- //
- ClearLines (Start, End, Top, Bottom, POPUP_TEXT | POPUP_BACKGROUND);
-
- //
- // Draw "One of" pop-up menu
- //
- Character = (CHAR16) BOXDRAW_DOWN_RIGHT;
- PrintCharAt (Start, Top, Character);
- for (Index = Start; Index + 2 < End; Index++) {
- if ((ShowUpArrow) && ((Index + 1) == (Start + End) / 2)) {
- Character = (CHAR16) GEOMETRICSHAPE_UP_TRIANGLE;
- } else {
- Character = (CHAR16) BOXDRAW_HORIZONTAL;
- }
-
- PrintChar (Character);
- }
-
- Character = (CHAR16) BOXDRAW_DOWN_LEFT;
- PrintChar (Character);
- Character = (CHAR16) BOXDRAW_VERTICAL;
- for (Index = Top + 1; Index < Bottom; Index++) {
- PrintCharAt (Start, Index, Character);
- PrintCharAt (End - 1, Index, Character);
- }
- //
- // Display the One of options
- //
- Index2 = Top + 1;
- for (Index = MenuOption->TagIndex + TopOptionIndex;
- (MenuOption->Tags[Index].Operand != EFI_IFR_END_ONE_OF_OP) && (Index2 < Bottom);
- Index++
- ) {
- if (MenuOption->Tags[Index].Operand == EFI_IFR_ONE_OF_OPTION_OP) {
- Token = MenuOption->Tags[Index].Text;
- if (Initialized) {
- for (ValueBackup = (UINT8) MenuOption->TagIndex;
- MenuOption->Tags[ValueBackup].Operand != EFI_IFR_END_ONE_OF_OP;
- ValueBackup++
- ) {
- if (MenuOption->Tags[ValueBackup].Value == ((UINT8 *) ValueArrayBackup)[Index - MenuOption->TagIndex - 1]) {
- StringPtr = GetToken (MenuOption->Tags[ValueBackup].Text, MenuOption->Handle);
- break;
- }
- }
- } else {
- ValueBackup = (UINT8) Index;
- StringPtr = GetToken (Token, MenuOption->Handle);
- }
- //
- // If the string occupies multiple lines, truncate it to fit in one line,
- // and append a "..." for indication.
- //
- if (StrLen (StringPtr) > (PopUpWidth - 1)) {
- TempStringPtr = AllocateZeroPool (sizeof (CHAR16) * (PopUpWidth - 1));
- ASSERT (TempStringPtr != NULL);
- CopyMem (TempStringPtr, StringPtr, (sizeof (CHAR16) * (PopUpWidth - 5)));
- FreePool (StringPtr);
- StringPtr = TempStringPtr;
- StrCat (StringPtr, (CHAR16 *) L"...");
- }
- //
- // Code to display the text should go here. Follwed by the [*]
- //
- if (MenuOption->Tags[ValueBackup].Suppress == TRUE) {
- //
- // Don't show the one, so decrease the Index2 for balance
- //
- Index2--;
- } else if (MenuOption->Tags[ValueBackup].GrayOut == TRUE) {
- //
- // Gray Out the one
- //
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT_GRAYED | POPUP_BACKGROUND);
- PrintStringAt (Start + 2, Index2, StringPtr);
- gST->ConOut->SetAttribute (gST->ConOut, POPUP_TEXT | POPUP_BACKGROUND);
- } else if (MenuOption->Tags[ValueBackup].Value == TempValue) {
- //
- // Highlight the selected one
- //
- gST->ConOut->SetAttribute (gST->ConOut, PICKLIST_HIGHLIGHT_TEXT | PICKLIST_HIGHLIGHT_BACKGROUND);
- PrintStringAt (Start + 2, Index2, StringPtr);
- gST->ConOut->SetAttribute (gST->ConOut, POPUP_TEXT | POPUP_BACKGROUND);
- HighlightPosition = Index2;
- } else {
- gST->ConOut->SetAttribute (gST->ConOut, POPUP_TEXT | POPUP_BACKGROUND);
- PrintStringAt (Start + 2, Index2, StringPtr);
- }
-
- FreePool (StringPtr);
- Index2 = Index2 + 1;
- }
- }
-
- Character = (CHAR16) BOXDRAW_UP_RIGHT;
- PrintCharAt (Start, Bottom, Character);
- for (Index = Start; Index + 2 < End; Index++) {
- if ((ShowDownArrow) && ((Index + 1) == (Start + End) / 2)) {
- Character = (CHAR16) GEOMETRICSHAPE_DOWN_TRIANGLE;
- } else {
- Character = (CHAR16) BOXDRAW_HORIZONTAL;
- }
-
- PrintChar (Character);
- }
-
- Character = (CHAR16) BOXDRAW_UP_LEFT;
- PrintChar (Character);
- //
- // Get User selection and change TempValue if necessary
- //
- //
- // Stop: One of pop-up menu
- //
- Key.UnicodeChar = CHAR_NULL;
- if ((gDirection == SCAN_UP) || (gDirection == SCAN_DOWN)) {
- Key.ScanCode = gDirection;
- gDirection = 0;
- goto TheKey;
- }
-
- if (!KeyInitialized) {
- if (MenuOption->ThisTag->Operand == EFI_IFR_ONE_OF_OP) {
- *KeyValue = MenuOption->Tags[MenuOption->TagIndex + 1].Key;
- } else {
- *KeyValue = MenuOption->ThisTag->Key;
- }
-
- KeyInitialized = TRUE;
- }
-
- WaitForKeyStroke (&Key);
-
-TheKey:
- switch (Key.UnicodeChar) {
- case '+':
- case '-':
- //
- // If an ordered list op-code, we will allow for a popup of +/- keys
- // to create an ordered list of items
- //
- if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {
- if (Key.UnicodeChar == '+') {
- if ((TopOptionIndex > 1) && (HighlightPosition == (Top + 1))) {
- //
- // Highlight reaches the top of the popup window, scroll one menu item.
- //
- TopOptionIndex--;
- ShowDownArrow = TRUE;
- }
-
- if (TopOptionIndex == 1) {
- ShowUpArrow = FALSE;
- }
- } else {
- if (((TopOptionIndex + MenuLinesInView) <= PopUpMenuLines) && (HighlightPosition == (Bottom - 1))) {
- //
- // Highlight reaches the bottom of the popup window, scroll one menu item.
- //
- TopOptionIndex++;
- ShowUpArrow = TRUE;
- }
-
- if ((TopOptionIndex + MenuLinesInView) == (PopUpMenuLines + 1)) {
- ShowDownArrow = FALSE;
- }
- }
-
- for (Index = MenuOption->TagIndex + TopOptionIndex;
- MenuOption->Tags[Index].Operand != EFI_IFR_END_ONE_OF_OP;
- Index++
- ) {
- if (MenuOption->Tags[Index].Operand == EFI_IFR_ORDERED_LIST_OP) {
- continue;
- }
-
- if (Key.UnicodeChar == '+') {
- TempIndex = Index - 1;
- } else {
- TempIndex = Index + 1;
- }
- //
- // Is this the current tag we are on?
- //
- if (MenuOption->Tags[Index].Value == TempValue) {
- //
- // Is this prior tag a valid choice? If not, bail out
- //
- if (MenuOption->Tags[TempIndex].Operand == EFI_IFR_ONE_OF_OPTION_OP) {
- //
- // Copy the destination tag to the local variable
- //
- CopyMem (&TagBackup, &MenuOption->Tags[TempIndex], sizeof (EFI_TAG));
- //
- // Copy the current tag to the tag location before us
- //
- CopyMem (&MenuOption->Tags[TempIndex], &MenuOption->Tags[Index], sizeof (EFI_TAG));
- //
- // Copy the backed up tag to the current location
- //
- CopyMem (&MenuOption->Tags[Index], &TagBackup, sizeof (EFI_TAG));
-
- //
- // Adjust the array of values
- //
- for (Index = 0; Index < ValueCount; Index++) {
- if (ValueArrayBackup[Index] == (UINT8) TempValue) {
- if (Key.UnicodeChar == '+') {
- if (Index == 0) {
- //
- // It is the top of the array already
- //
- break;
- }
-
- TempIndex = Index - 1;
- } else {
- if ((Index + 1) == ValueCount) {
- //
- // It is the bottom of the array already
- //
- break;
- }
-
- TempIndex = Index + 1;
- }
-
- ValueBackup = ValueArrayBackup[TempIndex];
- ValueArrayBackup[TempIndex] = ValueArrayBackup[Index];
- ValueArrayBackup[Index] = ValueBackup;
- Initialized = TRUE;
- break;
- }
- }
- break;
- } else {
- break;
- }
- }
- }
- }
- break;
-
- case CHAR_NULL:
- switch (Key.ScanCode) {
- case SCAN_UP:
- case SCAN_DOWN:
- if (Key.ScanCode == SCAN_UP) {
- if ((TopOptionIndex > 1) && (HighlightPosition == (Top + 1))) {
- //
- // Highlight reaches the top of the popup window, scroll one menu item.
- //
- TopOptionIndex--;
- ShowDownArrow = TRUE;
- }
-
- if (TopOptionIndex == 1) {
- ShowUpArrow = FALSE;
- }
- } else {
- if (((TopOptionIndex + MenuLinesInView) <= PopUpMenuLines) && (HighlightPosition == (Bottom - 1))) {
- //
- // Highlight reaches the bottom of the popup window, scroll one menu item.
- //
- TopOptionIndex++;
- ShowUpArrow = TRUE;
- }
-
- if ((TopOptionIndex + MenuLinesInView) == (PopUpMenuLines + 1)) {
- ShowDownArrow = FALSE;
- }
- }
-
- for (Index = MenuOption->TagIndex + TopOptionIndex;
- MenuOption->Tags[Index].Operand != EFI_IFR_END_ONE_OF_OP;
- Index++
- ) {
- if (MenuOption->Tags[Index].Operand == EFI_IFR_ONE_OF_OPTION_OP) {
- if (Initialized) {
- for (Index = 0; (ValueArrayBackup[Index] != TempValue) && (Index < ValueCount); Index++)
- ;
-
- //
- // Did we hit the end of the array? Either get the first TempValue or the next one
- //
- if (Key.ScanCode == SCAN_UP) {
- if (Index == 0) {
- TempValue = ValueArrayBackup[0];
- } else {
- TempValue = ValueArrayBackup[Index - 1];
- }
- } else {
- if ((Index + 1) == ValueCount) {
- TempValue = ValueArrayBackup[Index];
- } else {
- TempValue = ValueArrayBackup[Index + 1];
- }
- }
- break;
- } else {
- if (Key.ScanCode == SCAN_UP) {
- TempIndex = Index - 1;
-
- //
- // Keep going until meets meaningful tag.
- //
- while ((MenuOption->Tags[TempIndex].Operand != EFI_IFR_ONE_OF_OPTION_OP &&
- MenuOption->Tags[TempIndex].Operand != EFI_IFR_ONE_OF_OP &&
- MenuOption->Tags[TempIndex].Operand != EFI_IFR_END_ONE_OF_OP)
- ||
- (MenuOption->Tags[TempIndex].Operand == EFI_IFR_ONE_OF_OPTION_OP &&
- (MenuOption->Tags[TempIndex].Suppress || MenuOption->Tags[TempIndex].GrayOut))) {
- TempIndex--;
- }
- } else {
- TempIndex = Index + 1;
-
- //
- // Keep going until meets meaningful tag.
- //
- while ((MenuOption->Tags[TempIndex].Operand != EFI_IFR_ONE_OF_OPTION_OP &&
- MenuOption->Tags[TempIndex].Operand != EFI_IFR_ONE_OF_OP &&
- MenuOption->Tags[TempIndex].Operand != EFI_IFR_END_ONE_OF_OP)
- ||
- (MenuOption->Tags[TempIndex].Operand == EFI_IFR_ONE_OF_OPTION_OP &&
- (MenuOption->Tags[TempIndex].Suppress || MenuOption->Tags[TempIndex].GrayOut))) {
- TempIndex++;
- }
- }
- //
- // The option value is the same as what is stored in NV store. This is where we take action
- //
- if (MenuOption->Tags[Index].Value == TempValue) {
- //
- // Only if the previous op-code is an option can we select it, otherwise we are at the left-most option
- //
- if (MenuOption->Tags[TempIndex].Operand == EFI_IFR_ONE_OF_OPTION_OP) {
- TempValue = MenuOption->Tags[TempIndex].Value;
- *KeyValue = MenuOption->Tags[TempIndex].Key;
- } else {
- TempValue = MenuOption->Tags[Index].Value;
- *KeyValue = MenuOption->Tags[Index].Key;
- }
- break;
- }
- }
- }
- }
- break;
-
- case SCAN_ESC:
- gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);
- if (ValueArrayBackup != NULL) {
- FreePool (ValueArrayBackup);
- }
-
- return EFI_DEVICE_ERROR;
-
- default:
- break;
- }
-
- break;
-
- case CHAR_CARRIAGE_RETURN:
- //
- // return the current selection
- //
- if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {
- CopyMem (ValueArray, ValueArrayBackup, ValueCount);
- FreePool (ValueArrayBackup);
- } else {
- *Value = TempValue;
- }
-
- goto Done;
-
- default:
- break;
- }
- } while (1);
-
-Done:
- gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-WaitForKeyStroke (
- OUT EFI_INPUT_KEY *Key
- )
-{
- EFI_STATUS Status;
-
- do {
- UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0);
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
- } while (EFI_ERROR(Status));
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Presentation.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Presentation.c
deleted file mode 100644
index 6bbe810..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Presentation.c
+++ /dev/null
@@ -1,1485 +0,0 @@
-/*++
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- Presentation.c
-
-Abstract:
-
- Some presentation routines.
-
-Revision History:
-
---*/
-
-#include "Setup.h"
-#include "Ui.h"
-#include "Colors.h"
-
-VOID
-ClearLines (
- UINTN LeftColumn,
- UINTN RightColumn,
- UINTN TopRow,
- UINTN BottomRow,
- UINTN TextAttribute
- )
-{
- CHAR16 *Buffer;
- UINTN Row;
-
- //
- // For now, allocate an arbitrarily long buffer
- //
- Buffer = AllocateZeroPool (0x10000);
- ASSERT (Buffer != NULL);
-
- //
- // Set foreground and background as defined
- //
- gST->ConOut->SetAttribute (gST->ConOut, TextAttribute);
-
- //
- // Much faster to buffer the long string instead of print it a character at a time
- //
- SetUnicodeMem (Buffer, RightColumn - LeftColumn, L' ');
-
- //
- // Clear the desired area with the appropriate foreground/background
- //
- for (Row = TopRow; Row <= BottomRow; Row++) {
- PrintStringAt (LeftColumn, Row, Buffer);
- }
-
- gST->ConOut->SetCursorPosition (gST->ConOut, LeftColumn, TopRow);
-
- FreePool (Buffer);
- return ;
-}
-
-VOID
-NewStrCat (
- CHAR16 *Destination,
- CHAR16 *Source
- )
-{
- UINTN Length;
-
- for (Length = 0; Destination[Length] != 0; Length++)
- ;
-
- //
- // We now have the length of the original string
- // We can safely assume for now that we are concatenating a narrow value to this string.
- // For instance, the string is "XYZ" and cat'ing ">"
- // If this assumption changes, we need to make this routine a bit more complex
- //
- Destination[Length] = (CHAR16) NARROW_CHAR;
- Length++;
-
- StrCpy (Destination + Length, Source);
-}
-
-UINTN
-GetStringWidth (
- CHAR16 *String
- )
-{
- UINTN Index;
- UINTN Count;
- UINTN IncrementValue;
-
- Index = 0;
- Count = 0;
- IncrementValue = 1;
-
- do {
- //
- // Advance to the null-terminator or to the first width directive
- //
- for (;
- (String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0);
- Index++, Count = Count + IncrementValue
- )
- ;
-
- //
- // We hit the null-terminator, we now have a count
- //
- if (String[Index] == 0) {
- break;
- }
- //
- // We encountered a narrow directive - strip it from the size calculation since it doesn't get printed
- // and also set the flag that determines what we increment by.(if narrow, increment by 1, if wide increment by 2)
- //
- if (String[Index] == NARROW_CHAR) {
- //
- // Skip to the next character
- //
- Index++;
- IncrementValue = 1;
- } else {
- //
- // Skip to the next character
- //
- Index++;
- IncrementValue = 2;
- }
- } while (String[Index] != 0);
-
- //
- // Increment by one to include the null-terminator in the size
- //
- Count++;
-
- return Count * sizeof (CHAR16);
-}
-
-VOID
-DisplayPageFrame (
- VOID
- )
-{
- UINTN Index;
- UINT8 Line;
- UINT8 Alignment;
- CHAR16 Character;
- CHAR16 *Buffer;
- CHAR16 *StrFrontPageBanner;
- EFI_SCREEN_DESCRIPTOR LocalScreen;
- UINTN Row;
-
- ZeroMem (&LocalScreen, sizeof (EFI_SCREEN_DESCRIPTOR));
- gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &LocalScreen.RightColumn, &LocalScreen.BottomRow);
- ClearLines (0, LocalScreen.RightColumn, 0, LocalScreen.BottomRow, KEYHELP_BACKGROUND);
-
- CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
-
- //
- // For now, allocate an arbitrarily long buffer
- //
- Buffer = AllocateZeroPool (0x10000);
- ASSERT (Buffer != NULL);
-
- Character = (CHAR16) BOXDRAW_HORIZONTAL;
-
- for (Index = 0; Index + 2 < (LocalScreen.RightColumn - LocalScreen.LeftColumn); Index++) {
- Buffer[Index] = Character;
- }
-
- if (gClassOfVfr == EFI_FRONT_PAGE_SUBCLASS) {
- //
- // ClearLines(0, LocalScreen.RightColumn, 0, BANNER_HEIGHT-1, BANNER_TEXT | BANNER_BACKGROUND);
- //
- ClearLines (
- LocalScreen.LeftColumn,
- LocalScreen.RightColumn,
- LocalScreen.TopRow,
- FRONT_PAGE_HEADER_HEIGHT - 1 + LocalScreen.TopRow,
- BANNER_TEXT | BANNER_BACKGROUND
- );
- //
- // for (Line = 0; Line < BANNER_HEIGHT; Line++) {
- //
- for (Line = (UINT8) LocalScreen.TopRow; Line < BANNER_HEIGHT + (UINT8) LocalScreen.TopRow; Line++) {
- //
- // for (Alignment = 0; Alignment < BANNER_COLUMNS; Alignment++) {
- //
- for (Alignment = (UINT8) LocalScreen.LeftColumn;
- Alignment < BANNER_COLUMNS + (UINT8) LocalScreen.LeftColumn;
- Alignment++
- ) {
- if (BannerData->Banner[Line - (UINT8) LocalScreen.TopRow][Alignment - (UINT8) LocalScreen.LeftColumn] != 0x0000) {
- StrFrontPageBanner = GetToken (
- BannerData->Banner[Line - (UINT8) LocalScreen.TopRow][Alignment - (UINT8) LocalScreen.LeftColumn],
- FrontPageHandle
- );
- } else {
- continue;
- }
-
- switch (Alignment - LocalScreen.LeftColumn) {
- case 0:
- //
- // Handle left column
- //
- PrintStringAt (LocalScreen.LeftColumn, Line, StrFrontPageBanner);
- break;
-
- case 1:
- //
- // Handle center column
- //
- PrintStringAt (
- LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3,
- Line,
- StrFrontPageBanner
- );
- break;
-
- case 2:
- //
- // Handle right column
- //
- PrintStringAt (
- LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) * 2 / 3,
- Line,
- StrFrontPageBanner
- );
- break;
- }
-
- FreePool (StrFrontPageBanner);
- }
- }
- }
-
- ClearLines (
- LocalScreen.LeftColumn,
- LocalScreen.RightColumn,
- LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT,
- LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 1,
- KEYHELP_TEXT | KEYHELP_BACKGROUND
- );
-
- if (gClassOfVfr != EFI_FRONT_PAGE_SUBCLASS) {
- ClearLines (
- LocalScreen.LeftColumn,
- LocalScreen.RightColumn,
- LocalScreen.TopRow,
- LocalScreen.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT - 1,
- TITLE_TEXT | TITLE_BACKGROUND
- );
- //
- // Print Top border line
- // +------------------------------------------------------------------------------+
- // ? ?
- // +------------------------------------------------------------------------------+
- //
- Character = (CHAR16) BOXDRAW_DOWN_RIGHT;
-
- PrintChar (Character);
- PrintString (Buffer);
-
- Character = (CHAR16) BOXDRAW_DOWN_LEFT;
- PrintChar (Character);
-
- Character = (CHAR16) BOXDRAW_VERTICAL;
- for (Row = LocalScreen.TopRow + 1; Row <= LocalScreen.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT - 2; Row++) {
- PrintCharAt (LocalScreen.LeftColumn, Row, Character);
- PrintCharAt (LocalScreen.RightColumn - 1, Row, Character);
- }
-
- Character = (CHAR16) BOXDRAW_UP_RIGHT;
- PrintCharAt (LocalScreen.LeftColumn, LocalScreen.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT - 1, Character);
- PrintString (Buffer);
-
- Character = (CHAR16) BOXDRAW_UP_LEFT;
- PrintChar (Character);
-
- if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
- //
- // Print Bottom border line
- // +------------------------------------------------------------------------------+
- // ? ?
- // +------------------------------------------------------------------------------+
- //
- Character = (CHAR16) BOXDRAW_DOWN_RIGHT;
- PrintCharAt (LocalScreen.LeftColumn, LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT, Character);
-
- PrintString (Buffer);
-
- Character = (CHAR16) BOXDRAW_DOWN_LEFT;
- PrintChar (Character);
- Character = (CHAR16) BOXDRAW_VERTICAL;
- for (Row = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT + 1;
- Row <= LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 2;
- Row++
- ) {
- PrintCharAt (LocalScreen.LeftColumn, Row, Character);
- PrintCharAt (LocalScreen.RightColumn - 1, Row, Character);
- }
-
- Character = (CHAR16) BOXDRAW_UP_RIGHT;
- PrintCharAt (LocalScreen.LeftColumn, LocalScreen.BottomRow - STATUS_BAR_HEIGHT - 1, Character);
-
- PrintString (Buffer);
-
- Character = (CHAR16) BOXDRAW_UP_LEFT;
- PrintChar (Character);
- }
- }
-
- FreePool (Buffer);
-
-}
-
-/*
-+------------------------------------------------------------------------------+
-?F2=Previous Page Setup Page ?
-+------------------------------------------------------------------------------+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-+------------------------------------------------------------------------------+
-?F1=Scroll Help F9=Reset to Defaults F10=Save and Exit ?
-| ^"=Move Highlight <Spacebar> Toggles Checkbox Esc=Discard Changes |
-+------------------------------------------------------------------------------+
-*/
-STATIC
-UI_MENU_OPTION *
-DisplayForm (
- OUT UI_MENU_OPTION *Selection,
- IN UINT16 FormHandle,
- IN UINT16 TitleToken,
- IN EFI_FORM_TAGS FormTags,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN UINT8 *CallbackData
- )
-{
- CHAR16 *StringPtr;
- UINTN Index;
- UINTN Count;
- UINT16 MenuItemCount;
- EFI_HII_HANDLE Handle;
- UINT16 FormId;
- STRING_REF String;
- EFI_FILE_FORM_TAGS *FileFormTags;
- BOOLEAN SuppressIf;
- BOOLEAN Suppress;
- BOOLEAN GrayOut;
- BOOLEAN Conditional;
- EFI_SCREEN_DESCRIPTOR LocalScreen;
- UINT16 Width;
- UINTN ArrayEntry;
- CHAR16 *OutputString;
-
- Handle = Selection->Handle;
- FormId = 0;
- String = 0;
- MenuItemCount = 0;
- ArrayEntry = 0;
- OutputString = NULL;
-
- CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
-
- //
- // If we hit a F2 (previous) we already nuked the menu and are simply carrying around what information we need
- //
- if (Selection->Previous) {
- Selection->Previous = FALSE;
- } else {
- UiFreeMenu ();
- UiInitMenu ();
- }
-
- StringPtr = GetToken (TitleToken, Handle);
-
- if (gClassOfVfr != EFI_FRONT_PAGE_SUBCLASS) {
- gST->ConOut->SetAttribute (gST->ConOut, TITLE_TEXT | TITLE_BACKGROUND);
- PrintStringAt (
- (LocalScreen.RightColumn + LocalScreen.LeftColumn - GetStringWidth (StringPtr) / 2) / 2,
- LocalScreen.TopRow + 1,
- StringPtr
- );
- }
-
- if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
- gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_TEXT | KEYHELP_BACKGROUND);
-
- //
- // Display the infrastructure strings
- //
- if (!IsListEmpty (&gMenuList)) {
- PrintStringAt (LocalScreen.LeftColumn + 2, LocalScreen.TopRow + 1, gFunctionTwoString);
- }
-
- PrintStringAt (LocalScreen.LeftColumn + 2, LocalScreen.BottomRow - 4, gFunctionOneString);
- PrintStringAt (
- LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3,
- LocalScreen.BottomRow - 4,
- gFunctionNineString
- );
- PrintStringAt (
- LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) * 2 / 3,
- LocalScreen.BottomRow - 4,
- gFunctionTenString
- );
- PrintAt (LocalScreen.LeftColumn + 2, LocalScreen.BottomRow - 3, (CHAR16 *) L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
- PrintStringAt (
- LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3,
- LocalScreen.BottomRow - 3,
- gEscapeString
- );
- }
- //
- // Remove Buffer allocated for StringPtr after it has been used.
- //
- FreePool (StringPtr);
-
- for (Index = 0; FormTags.Tags[Index].Operand != EFI_IFR_END_FORM_OP; Index++) {
- GrayOut = FALSE;
- Suppress = FALSE;
- SuppressIf = FALSE;
- Conditional = FALSE;
- FileFormTags = FileFormTagsHead;
-
- if (FormTags.Tags[Index].Operand == EFI_IFR_FORM_OP) {
- FormId = FormTags.Tags[Index].Id;
- }
- //
- // This gives us visibility to the FileFormTags->NvRamMap to check things
- // ActiveIfr is a global maintained by the menuing code to ensure that we
- // are pointing to the correct formset's file data.
- //
- for (Count = 0; Count < gActiveIfr; Count++) {
- FileFormTags = FileFormTags->NextFile;
- }
- //
- // GrayoutIf [SuppressIf]
- // <BOOLEANS>
- // OpCode(s)
- // EndIf
- //
- // SuppressIf [GrayoutIf]
- // <BOOLEANS>
- // OpCode(s)
- // EndIf
- //
- Count = 0;
-
- do {
- switch (FormTags.Tags[Index].Operand) {
- case EFI_IFR_SUPPRESS_IF_OP:
- SuppressIf = TRUE;
-
- case EFI_IFR_GRAYOUT_IF_OP:
-
- Conditional = TRUE;
-
- //
- // Advance to the next op-code
- //
- Index++;
-
- //
- // We are now pointing to the beginning of the consistency checking. Let's fast forward
- // through the AND/OR/NOT data to come up with some meaningful ID data.
- //
- for (;
- FormTags.Tags[Index].Operand == EFI_IFR_AND_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_OR_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_GT_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_GE_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_NOT_OP;
- Index++
- )
- ;
-
- //
- // We need to walk through the consistency checks until we hit the end of the consistency
- // FALSE means evaluate this single expression
- // The ConsistencyId refers to which expression in the Consistency database to use
- //
- if (SuppressIf) {
- Suppress = ValueIsNotValid (
- FALSE,
- FormTags.Tags[Index].ConsistencyId,
- &FormTags.Tags[Index],
- FileFormTags,
- &String
- );
- SuppressIf = FALSE;
- } else {
- GrayOut = ValueIsNotValid (
- FALSE,
- FormTags.Tags[Index].ConsistencyId,
- &FormTags.Tags[Index],
- FileFormTags,
- &String
- );
- }
- //
- // Advance to the end of the expression (Will land us at a grayoutif/suppressif or the op-code being affected)
- //
- for (;
- FormTags.Tags[Index].Operand == EFI_IFR_EQ_ID_VAL_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_EQ_VAR_VAL_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_EQ_ID_ID_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_EQ_ID_LIST_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_NOT_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_AND_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_OR_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_TRUE_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_FALSE_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_GT_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_GE_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_LABEL_OP;
- Index++
- )
- ;
- break;
-
- default:
- goto GetOut;
- }
- //
- // Do this two times (at most will see a suppress and grayout combination
- //
- Count++;
- } while (Count < 2);
-
-GetOut:
- do {
- if (GrayOut) {
- FormTags.Tags[Index].GrayOut = TRUE;
- } else {
- FormTags.Tags[Index].GrayOut = FALSE;
- }
- if (Suppress && FormTags.Tags[Index].Operand == EFI_IFR_ONE_OF_OPTION_OP) {
- //
- // Only need .Suppress field when the tag is a one_of_option. For other cases, omit them directly.
- //
- FormTags.Tags[Index].Suppress = TRUE;
- } else {
- FormTags.Tags[Index].Suppress = FALSE;
- }
-
- if ((
- FormTags.Tags[Index].NumberOfLines > 0 ||
- FormTags.Tags[Index].Operand == EFI_IFR_DATE_OP ||
- FormTags.Tags[Index].Operand == EFI_IFR_TIME_OP
- ) &&
- !Suppress
- ) {
-
- StringPtr = GetToken (FormTags.Tags[Index].Text, Handle);
-
- Width = GetWidth (&FormTags.Tags[Index], Handle);
-
- //
- // This data can be retrieved over and over again. Therefore, reset to original values
- // before processing otherwise things will start growing linearly
- //
- if (FormTags.Tags[Index].NumberOfLines > 1) {
- FormTags.Tags[Index].NumberOfLines = 1;
- }
-
- for (Count = 0; GetLineByWidth (StringPtr, Width, &ArrayEntry, &OutputString) != 0x0000;) {
- //
- // If there is more string to process print on the next row and increment the Skip value
- //
- if (StrLen (&StringPtr[ArrayEntry])) {
- FormTags.Tags[Index].NumberOfLines++;
- }
-
- FreePool (OutputString);
- }
-
- ArrayEntry = 0;
-
- //
- // We are NOT!! removing this StringPtr buffer via FreePool since it is being used in the menuoptions, we will do
- // it in UiFreeMenu.
- //
- UiAddSubMenuOption (StringPtr, Handle, FormTags.Tags, Index, FormId, MenuItemCount);
- MenuItemCount++;
- }
- //
- // Keep processing menu entries based on the resultant suppress/grayout results until we hit an end-if
- //
- Index++;
- } while (FormTags.Tags[Index].Operand != EFI_IFR_END_IF_OP && Conditional);
-
- //
- // We advanced the index for the above conditional, rewind it to keep harmony with the for loop logic
- //
- Index--;
- }
-
- Selection = UiDisplayMenu (TRUE, FileFormTagsHead, (EFI_IFR_DATA_ARRAY *) CallbackData);
-
- return Selection;
-}
-
-VOID
-InitializeBrowserStrings (
- VOID
- )
-{
- gFunctionOneString = GetToken (STRING_TOKEN (FUNCTION_ONE_STRING), gHiiHandle);
- gFunctionTwoString = GetToken (STRING_TOKEN (FUNCTION_TWO_STRING), gHiiHandle);
- gFunctionNineString = GetToken (STRING_TOKEN (FUNCTION_NINE_STRING), gHiiHandle);
- gFunctionTenString = GetToken (STRING_TOKEN (FUNCTION_TEN_STRING), gHiiHandle);
- gEnterString = GetToken (STRING_TOKEN (ENTER_STRING), gHiiHandle);
- gEnterCommitString = GetToken (STRING_TOKEN (ENTER_COMMIT_STRING), gHiiHandle);
- gEscapeString = GetToken (STRING_TOKEN (ESCAPE_STRING), gHiiHandle);
- gMoveHighlight = GetToken (STRING_TOKEN (MOVE_HIGHLIGHT), gHiiHandle);
- gMakeSelection = GetToken (STRING_TOKEN (MAKE_SELECTION), gHiiHandle);
- gNumericInput = GetToken (STRING_TOKEN (NUMERIC_INPUT), gHiiHandle);
- gToggleCheckBox = GetToken (STRING_TOKEN (TOGGLE_CHECK_BOX), gHiiHandle);
- gPromptForPassword = GetToken (STRING_TOKEN (PROMPT_FOR_PASSWORD), gHiiHandle);
- gPromptForNewPassword = GetToken (STRING_TOKEN (PROMPT_FOR_NEW_PASSWORD), gHiiHandle);
- gConfirmPassword = GetToken (STRING_TOKEN (CONFIRM_PASSWORD), gHiiHandle);
- gConfirmError = GetToken (STRING_TOKEN (CONFIRM_ERROR), gHiiHandle);
- gPressEnter = GetToken (STRING_TOKEN (PRESS_ENTER), gHiiHandle);
- gEmptyString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
- gAreYouSure = GetToken (STRING_TOKEN (ARE_YOU_SURE), gHiiHandle);
- gYesResponse = GetToken (STRING_TOKEN (ARE_YOU_SURE_YES), gHiiHandle);
- gNoResponse = GetToken (STRING_TOKEN (ARE_YOU_SURE_NO), gHiiHandle);
- gMiniString = GetToken (STRING_TOKEN (MINI_STRING), gHiiHandle);
- gPlusString = GetToken (STRING_TOKEN (PLUS_STRING), gHiiHandle);
- gMinusString = GetToken (STRING_TOKEN (MINUS_STRING), gHiiHandle);
- gAdjustNumber = GetToken (STRING_TOKEN (ADJUST_NUMBER), gHiiHandle);
- return ;
-}
-
-VOID
-UpdateKeyHelp (
- IN UI_MENU_OPTION *Selection,
- IN BOOLEAN Selected
- )
-/*++
-Routine Description:
- Update key's help imformation
-
-Arguments:
- Selection C The form that current display
- Selected C Whether or not a tag be selected
-
-Returns:
- None
---*/
-{
- UINTN SecCol;
- UINTN ThdCol;
- UINTN LeftColumnOfHelp;
- UINTN RightColumnOfHelp;
- UINTN TopRowOfHelp;
- UINTN BottomRowOfHelp;
- UINTN StartColumnOfHelp;
- EFI_SCREEN_DESCRIPTOR LocalScreen;
-
- CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
-
- SecCol = LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) / 3;
- ThdCol = LocalScreen.LeftColumn + (LocalScreen.RightColumn - LocalScreen.LeftColumn) * 2 / 3;
-
- StartColumnOfHelp = LocalScreen.LeftColumn + 2;
- LeftColumnOfHelp = LocalScreen.LeftColumn + 1;
- RightColumnOfHelp = LocalScreen.RightColumn - 2;
- TopRowOfHelp = LocalScreen.BottomRow - 4;
- BottomRowOfHelp = LocalScreen.BottomRow - 3;
-
- if (gClassOfVfr == EFI_GENERAL_APPLICATION_SUBCLASS) {
- return ;
- }
-
- gST->ConOut->SetAttribute (gST->ConOut, KEYHELP_TEXT | KEYHELP_BACKGROUND);
-
- switch (Selection->ThisTag->Operand) {
- case EFI_IFR_ORDERED_LIST_OP:
- case EFI_IFR_ONE_OF_OP:
- case EFI_IFR_NUMERIC_OP:
- case EFI_IFR_TIME_OP:
- case EFI_IFR_DATE_OP:
- ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
-
- if (!Selected) {
- if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
- PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
- PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
- PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
- PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
-
- }
-
- if ((Selection->ThisTag->Operand == EFI_IFR_DATE_OP) || (Selection->ThisTag->Operand == EFI_IFR_TIME_OP)) {
- PrintAt (
- StartColumnOfHelp,
- BottomRowOfHelp,
- (CHAR16 *) L"%c%c%c%c%s",
- ARROW_UP,
- ARROW_DOWN,
- ARROW_RIGHT,
- ARROW_LEFT,
- gMoveHighlight
- );
- PrintStringAt (SecCol, BottomRowOfHelp, gAdjustNumber);
- } else {
- PrintAt (StartColumnOfHelp, BottomRowOfHelp, (CHAR16 *) L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
- PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
- }
- } else {
- PrintStringAt (SecCol, BottomRowOfHelp, gEnterCommitString);
-
- //
- // If it is a selected numeric with manual input, display different message
- //
- if ((Selection->ThisTag->Operand == EFI_IFR_NUMERIC_OP) && (Selection->ThisTag->Step == 0)) {
- PrintStringAt (SecCol, TopRowOfHelp, gNumericInput);
- } else if (Selection->ThisTag->Operand != EFI_IFR_ORDERED_LIST_OP) {
- PrintAt (StartColumnOfHelp, BottomRowOfHelp, L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
- }
-
- if (Selection->ThisTag->Operand == EFI_IFR_ORDERED_LIST_OP) {
- PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gPlusString);
- PrintStringAt (ThdCol, TopRowOfHelp, gMinusString);
- }
-
- PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
- }
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
-
- if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
- PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
- PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
- PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
- PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
- }
-
- PrintAt (StartColumnOfHelp, BottomRowOfHelp, (CHAR16 *) L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
- PrintStringAt (SecCol, BottomRowOfHelp, gToggleCheckBox);
- break;
-
- case EFI_IFR_REF_OP:
- case EFI_IFR_PASSWORD_OP:
- case EFI_IFR_STRING_OP:
- ClearLines (LeftColumnOfHelp, RightColumnOfHelp, TopRowOfHelp, BottomRowOfHelp, KEYHELP_TEXT | KEYHELP_BACKGROUND);
-
- if (!Selected) {
- if (gClassOfVfr == EFI_SETUP_APPLICATION_SUBCLASS) {
- PrintStringAt (StartColumnOfHelp, TopRowOfHelp, gFunctionOneString);
- PrintStringAt (SecCol, TopRowOfHelp, gFunctionNineString);
- PrintStringAt (ThdCol, TopRowOfHelp, gFunctionTenString);
- PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
- }
-
- PrintAt (StartColumnOfHelp, BottomRowOfHelp, (CHAR16 *) L"%c%c%s", ARROW_UP, ARROW_DOWN, gMoveHighlight);
- PrintStringAt (SecCol, BottomRowOfHelp, gEnterString);
- } else {
- if (Selection->ThisTag->Operand != EFI_IFR_REF_OP) {
- PrintStringAt (
- (LocalScreen.RightColumn - GetStringWidth (gEnterCommitString) / 2) / 2,
- BottomRowOfHelp,
- gEnterCommitString
- );
- PrintStringAt (ThdCol, BottomRowOfHelp, gEscapeString);
- }
- }
- break;
- }
-
-}
-
-STATIC
-VOID
-ExtractFormHandle (
- IN UI_MENU_OPTION *Selection,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN UINTN IdValue,
- OUT UINT16 *FormHandle,
- OUT UINT16 *TitleToken,
- OUT EFI_FORM_TAGS *FormTags
- )
-{
- UINTN Index;
- EFI_FILE_FORM_TAGS *FileFormTags;
- EFI_FORM_TAGS LocalTags;
-
- FileFormTags = FileFormTagsHead;
-
- //
- // Advance FileFormTags to the correct file's tag information.
- // For instance, if Selection->IfrNumber is 3, that means the 4th
- // file (0-based) in the FileFormTags linked-list contains the tag
- // information.
- //
- for (Index = 0; Index < Selection->IfrNumber; Index++) {
- FileFormTags = FileFormTags->NextFile;
- }
-
- LocalTags = FileFormTags->FormTags;
-
- if (IdValue == 0) {
- //
- // Advance Index to the first FormOp tag information
- //
- for (Index = 0; FileFormTags->FormTags.Tags[Index].Operand != EFI_IFR_FORM_OP; Index++)
- ;
- } else {
- //
- // Advance Index to the FormOp with the correct ID value
- //
- for (; LocalTags.Next != NULL; LocalTags = *LocalTags.Next) {
- for (Index = 0; LocalTags.Tags[Index].Operand != EFI_IFR_FORM_OP; Index++)
- ;
- if (LocalTags.Tags[Index].Id == IdValue) {
- break;
- }
- }
- }
- //
- // return the Form Id, Text, and the File's FormTags structure
- //
- *FormHandle = LocalTags.Tags[Index].Id;
- *TitleToken = LocalTags.Tags[Index].Text;
- *FormTags = LocalTags;
- return ;
-}
-
-STATIC
-EFI_STATUS
-UpdateNewTagData (
- IN UINT8 *FormData,
- IN UINT16 ConsistencyId,
- IN UINT16 CurrentVariable,
- IN EFI_FORM_TAGS *FormTags,
- OUT EFI_FILE_FORM_TAGS *FileFormTags
- )
-{
- EFI_STATUS Status;
- UINT16 Index;
- UINT16 QuestionIndex;
- UINT16 NumberOfTags;
- INT16 CurrTag;
- UINT8 TagLength;
- UINTN Count;
- BOOLEAN Finished;
-
- //
- // Initialize some Index variable and Status
- //
- Count = 0;
- QuestionIndex = 0;
- NumberOfTags = 1;
- Index = 0;
- Status = EFI_SUCCESS;
- Finished = FALSE;
-
- //
- // Determine the number of tags for the first form
- //
- GetTagCount (&FormData[Index], &NumberOfTags);
-
- //
- // Allocate memory for our tags on the first form
- //
- FormTags->Tags = AllocateZeroPool (NumberOfTags * sizeof (EFI_TAG));
- ASSERT (FormTags->Tags != NULL);
-
- for (CurrTag = 0; FormData[Index] != EFI_IFR_END_FORM_SET_OP; CurrTag++) {
- //
- // Operand = IFR OpCode
- //
- FormTags->Tags[CurrTag].Operand = FormData[Index];
-
- //
- // Assume for now 0 lines occupied by this OpCode
- //
- FormTags->Tags[CurrTag].NumberOfLines = 0;
-
- //
- // Determine the length of the Tag so we can later skip to the next tag in the form
- //
- //
- // get the length
- //
- TagLength = FormData[Index + 1];
- //
- // Operate on the Found OpCode
- //
- switch (FormData[Index]) {
-
- case EFI_IFR_FORM_OP:
- case EFI_IFR_SUBTITLE_OP:
- case EFI_IFR_TEXT_OP:
- case EFI_IFR_REF_OP:
- IfrToFormTag (FormData[Index], &FormTags->Tags[CurrTag], (VOID *) &FormData[Index], NULL);
- break;
-
- case EFI_IFR_VARSTORE_SELECT_OP:
- IfrToFormTag (FormData[Index], &FormTags->Tags[CurrTag], (VOID *) &FormData[Index], NULL);
- CopyMem (&CurrentVariable, &((EFI_IFR_VARSTORE_SELECT *) &FormData[Index])->VarId, sizeof (UINT16));
- break;
-
- case EFI_IFR_END_FORM_OP:
- FormTags->Tags[CurrTag].Operand = FormData[Index];
- FormTags->Tags[CurrTag].NumberOfLines = 0;
-
- Finished = TRUE;
- break;
-
- case EFI_IFR_ORDERED_LIST_OP:
- case EFI_IFR_ONE_OF_OP:
- GetQuestionHeader (&FormTags->Tags[CurrTag], FormData, Index, FileFormTags, CurrentVariable);
-
- //
- // Store away the CurrTag since what follows will be the answer that we
- // need to place into the appropriate location in the tag array
- //
- //
- // record for setting default later
- //
- QuestionIndex = (UINT16) CurrTag;
- break;
-
- case EFI_IFR_ONE_OF_OPTION_OP:
- IfrToFormTag (FormData[Index], &FormTags->Tags[CurrTag], (VOID *) &FormData[Index], NULL);
- FormTags->Tags[QuestionIndex].Key = ((EFI_IFR_ONE_OF_OPTION *) &FormData[Index])->Key;
- FormTags->Tags[QuestionIndex].ResetRequired = (BOOLEAN) (FormTags->Tags[QuestionIndex].Flags & EFI_IFR_FLAG_RESET_REQUIRED);
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- GetQuestionHeader (&FormTags->Tags[CurrTag], FormData, Index, FileFormTags, CurrentVariable);
- IfrToFormTag (FormData[Index], &FormTags->Tags[CurrTag], (VOID *) &FormData[Index], NULL);
- break;
-
- case EFI_IFR_NUMERIC_OP:
- GetNumericHeader (&FormTags->Tags[CurrTag], FormData, Index, (UINT16) 1, FileFormTags, CurrentVariable);
- IfrToFormTag (FormData[Index], &FormTags->Tags[CurrTag], (VOID *) &FormData[Index], NULL);
- break;
-
- case EFI_IFR_DATE_OP:
- //
- // Date elements come in as a Year, Month, Day. We need to process them as a country-based
- // Order. It is much easier to do it here than anywhere else.
- //
- // For US standards - we want Month/Day/Year, thus we advance "i" +1, +2, +0 while CurrTag is +0, +1, +2
- //
- GetNumericHeader (
- &FormTags->Tags[CurrTag],
- FormData,
- (UINT16) (Index + TagLength),
- (UINT16) 0,
- FileFormTags,
- CurrentVariable
- );
-
- //
- // The current language selected + the Date operand
- //
- FormTags->Tags[CurrTag + 1].Operand = FormData[Index];
- GetNumericHeader (
- &FormTags->Tags[CurrTag + 1],
- FormData,
- (UINT16) (Index + TagLength + FormData[Index + TagLength + 1]),
- (UINT16) 0,
- FileFormTags,
- CurrentVariable
- );
-
- //
- // The current language selected + the Date operand
- //
- FormTags->Tags[CurrTag + 2].Operand = FormData[Index];
- GetNumericHeader (&FormTags->Tags[CurrTag + 2], FormData, Index, (UINT16) 1, FileFormTags, CurrentVariable);
-
- CurrTag = (INT16) (CurrTag + 2);
-
- Index = (UINT16) (Index + TagLength);
- //
- // get the length
- //
- TagLength = FormData[Index + 1];
- Index = (UINT16) (Index + TagLength);
- //
- // get the length
- //
- TagLength = FormData[Index + 1];
- break;
-
- case EFI_IFR_TIME_OP:
- GetNumericHeader (&FormTags->Tags[CurrTag], FormData, Index, (UINT16) 0, FileFormTags, CurrentVariable);
-
- if (Count == 2) {
- //
- // Override the GetQuestionHeader information - date/time are treated very differently
- //
- FormTags->Tags[CurrTag].NumberOfLines = 1;
- Count = 0;
- } else {
- //
- // The premise is that every date/time op-code have 3 elements, the first 2 have 0 lines
- // associated with them, and the third has 1 line to allow to space beyond the choice.
- //
- Count++;
- }
- break;
-
- case EFI_IFR_PASSWORD_OP:
- case EFI_IFR_STRING_OP:
- GetQuestionHeader (&FormTags->Tags[CurrTag], FormData, Index, FileFormTags, CurrentVariable);
- IfrToFormTag (FormData[Index], &FormTags->Tags[CurrTag], (VOID *) &FormData[Index], NULL);
- break;
-
- case EFI_IFR_INCONSISTENT_IF_OP:
- case EFI_IFR_SUPPRESS_IF_OP:
- case EFI_IFR_GRAYOUT_IF_OP:
- ConsistencyId++;
- break;
-
- case EFI_IFR_EQ_ID_VAL_OP:
- IfrToFormTag (FormData[Index], &FormTags->Tags[CurrTag], (VOID *) &FormData[Index], NULL);
- FormTags->Tags[CurrTag].ConsistencyId = ConsistencyId;
- break;
-
- case EFI_IFR_EQ_VAR_VAL_OP:
- IfrToFormTag (FormData[Index], &FormTags->Tags[CurrTag], (VOID *) &FormData[Index], NULL);
- FormTags->Tags[CurrTag].ConsistencyId = ConsistencyId;
- break;
-
- case EFI_IFR_EQ_ID_ID_OP:
- IfrToFormTag (FormData[Index], &FormTags->Tags[CurrTag], (VOID *) &FormData[Index], NULL);
- FormTags->Tags[CurrTag].ConsistencyId = ConsistencyId;
- break;
-
- case EFI_IFR_AND_OP:
- case EFI_IFR_OR_OP:
- case EFI_IFR_NOT_OP:
- case EFI_IFR_TRUE_OP:
- case EFI_IFR_FALSE_OP:
- case EFI_IFR_GT_OP:
- case EFI_IFR_GE_OP:
- FormTags->Tags[CurrTag].ConsistencyId = ConsistencyId;
- break;
-
- case EFI_IFR_EQ_ID_LIST_OP:
- IfrToFormTag (FormData[Index], &FormTags->Tags[CurrTag], (VOID *) &FormData[Index], NULL);
-
- FormTags->Tags[CurrTag].ConsistencyId = ConsistencyId;
- break;
-
- default:
- break;
- }
- //
- // End of switch
- //
- if (Finished) {
- break;
- }
- //
- // Per spec., we ignore ops that we don't know how to deal with. Skip to next tag
- //
- Index = (UINT16) (Index + TagLength);
- }
- //
- // End of Index
- //
- return Status;
-}
-
-STATIC
-VOID
-ExtractDynamicFormHandle (
- IN UI_MENU_OPTION *Selection,
- IN UINT8 *CallbackData,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN UINTN IdValue,
- OUT UINT16 *FormHandle,
- OUT UINT16 *TitleToken,
- OUT EFI_FORM_TAGS *FormTags
- )
-/*++
-
-Routine Description:
-
- The function does the most of the works when the EFI_TAG that
- user selects on is EFI_IFR_FLAG_INTERACTIVE or EFI_IFR_PASSWORD_OP:
- invoke CallBack, update the new form data.
-
-Arguments:
-
- Selection - The current selection of the form.
- CallbackData - The pointer to host the data passed back by the callback function.
- FileFormTagsHead - Prompt string token of the one-of box
- IdValue - The current page number.
- FormHandle - Output the the handle of the form.
- TitleToken - Output the TitleToken of the new page.
- FormTags - Output the FormFags of the new page.
-
-Returns:
- VOID
-
---*/
-{
- UINTN Index;
- UINTN BackupIndex;
- EFI_FILE_FORM_TAGS *FileFormTags;
- EFI_FORM_TAGS *LocalTags;
- EFI_FORM_CALLBACK_PROTOCOL *FormCallback;
- EFI_STATUS Status;
- UINTN Length;
- UINT8 *Buffer;
- EFI_PHYSICAL_ADDRESS CallbackHandle;
- EFI_GUID TagGuid;
- UINT16 TargetPage;
- EFI_HII_CALLBACK_PACKET *Packet;
- UINTN ScreenSize;
- CHAR16 NullCharacter;
- EFI_INPUT_KEY Key;
- UINT16 ConsistencyId;
- UINT16 CurrentVariable;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
- EFI_IFR_DATA_ENTRY *DataEntry;
-
- VariableDefinition = NULL;
- NullCharacter = CHAR_NULL;
-
- CurrentVariable = 0;
- FileFormTags = FileFormTagsHead;
- Length = 0;
- CallbackHandle = 0;
- TargetPage = (UINT16) IdValue;
- Packet = NULL;
- ConsistencyId = 0;
-
- //
- // Advance FileFormTags to the correct file's tag information.
- // For instance, if Selection->IfrNumber is 3, that means the 4th
- // file (0-based) in the FileFormTags linked-list contains the tag
- // information.
- //
- for (Index = 0; Index < Selection->IfrNumber; Index++) {
- FileFormTags = FileFormTags->NextFile;
- }
-
- LocalTags = &FileFormTags->FormTags;
-
- //
- // Advance Index to the FormOp with the correct ID value
- //
- for (; LocalTags->Next != NULL; LocalTags = LocalTags->Next) {
- if ((LocalTags->Tags[0].CallbackHandle != 0) && (CallbackHandle == 0)) {
- CallbackHandle = LocalTags->Tags[0].CallbackHandle;
- CopyMem (&TagGuid, &LocalTags->Tags[0].GuidValue, sizeof (EFI_GUID));
- }
-
- for (Index = 0; LocalTags->Tags[Index].Operand != EFI_IFR_FORM_OP; Index++)
- ;
- if (LocalTags->Tags[Index].Id == IdValue) {
- break;
- }
- }
- //
- // If we are going to callback on a non-goto opcode, make sure we don't change pages
- //
- if (Selection->ThisTag->Operand != EFI_IFR_REF_OP) {
- TargetPage = Selection->FormId;
- }
- //
- // The first tag below should be the form op-code. We need to store away the
- // current variable setting to ensure if we have to reload the page, that we
- // can correctly restore the values for the active variable
- //
- CurrentVariable = Selection->Tags[0].VariableNumber;
-
- //
- // Remember that dynamic pages in an environment where all pages are not
- // dynamic require us to call back to the user to give them an opportunity
- // to register fresh information in the HII database so that we can extract it.
- //
- Status = gBS->HandleProtocol (
- (VOID *) (UINTN) CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- (VOID **) &FormCallback
- );
-
- if (EFI_ERROR (Status)) {
- FreePool (LocalTags->Tags);
- return ;
- }
-
- ExtractRequestedNvMap (FileFormTags, CurrentVariable, &VariableDefinition);
-
- if (Selection->ThisTag->Flags & (EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS)) {
- ((EFI_IFR_DATA_ARRAY *) CallbackData)->NvRamMap = VariableDefinition->NvRamMap;
- } else {
- ((EFI_IFR_DATA_ARRAY *) CallbackData)->NvRamMap = NULL;
- }
-
- if ((FormCallback != NULL) && (FormCallback->Callback != NULL)) {
- Status = FormCallback->Callback (
- FormCallback,
- Selection->ThisTag->Key,
- (EFI_IFR_DATA_ARRAY *) CallbackData,
- &Packet
- );
- }
-
- if (EFI_ERROR (Status)) {
- //
- // Restore Previous Value
- //
- CopyMem (
- &VariableDefinition->NvRamMap[Selection->ThisTag->StorageStart],
- gPreviousValue,
- Selection->ThisTag->StorageWidth
- );
-
- if (Packet != NULL) {
- //
- // Upon error, we will likely receive a string to print out
- //
- ScreenSize = GetStringWidth (Packet->String) / 2;
-
- //
- // Display error popup
- //
- CreatePopUp (ScreenSize, 3, &NullCharacter, Packet->String, &NullCharacter);
-
- do {
- Status = WaitForKeyStroke (&Key);
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- } else {
- UpdateStatusBar (INPUT_ERROR, (UINT8) 0, TRUE);
- }
-
- } else {
- if (Packet != NULL) {
- //
- // We need to on a non-error, look in the outbound Packet for information and update the NVRAM
- // location associated with the op-code specified there. This is used on single op-code instances
- // and not for when a hyperlink sent us a whole page of data.
- //
- DataEntry = (EFI_IFR_DATA_ENTRY *) (&Packet->DataArray + 1);
- if (Packet->DataArray.EntryCount == 1) {
- switch (DataEntry->OpCode) {
- case EFI_IFR_STRING_OP:
- case EFI_IFR_NUMERIC_OP:
- case EFI_IFR_ORDERED_LIST_OP:
- case EFI_IFR_ONE_OF_OP:
- case EFI_IFR_CHECKBOX_OP:
- CopyMem (
- &VariableDefinition->NvRamMap[Selection->ThisTag->StorageStart],
- &DataEntry->Data,
- Selection->ThisTag->StorageWidth
- );
- break;
-
- case EFI_IFR_NV_ACCESS_COMMAND:
- CopyMem (
- &VariableDefinition->NvRamMap[((EFI_IFR_NV_DATA *) Packet)->QuestionId],
- ((EFI_IFR_NV_DATA *) Packet) + 1,
- ((EFI_IFR_NV_DATA *) Packet)->StorageWidth
- );
- break;
-
- }
-
- if (DataEntry->Flags & RESET_REQUIRED) {
- gResetRequired = TRUE;
- }
-
- if (DataEntry->Flags & EXIT_REQUIRED) {
- gExitRequired = TRUE;
- }
-
- if (DataEntry->Flags & SAVE_REQUIRED) {
- gSaveRequired = TRUE;
- }
-
- if (DataEntry->Flags & NV_CHANGED) {
- gNvUpdateRequired = TRUE;
- }
-
- if (DataEntry->Flags & NV_NOT_CHANGED) {
- gNvUpdateRequired = FALSE;
- }
- }
- }
- }
-
- if (Packet != NULL) {
- FreePool (Packet);
- }
-
- for (BackupIndex = 0; LocalTags->Tags[BackupIndex].Operand != EFI_IFR_END_FORM_OP; BackupIndex++) {
- switch (LocalTags->Tags[BackupIndex].Operand) {
- case EFI_IFR_EQ_VAR_VAL_OP:
- case EFI_IFR_EQ_ID_VAL_OP:
- case EFI_IFR_EQ_ID_ID_OP:
- case EFI_IFR_AND_OP:
- case EFI_IFR_OR_OP:
- case EFI_IFR_NOT_OP:
- case EFI_IFR_TRUE_OP:
- case EFI_IFR_FALSE_OP:
- case EFI_IFR_GT_OP:
- case EFI_IFR_GE_OP:
- case EFI_IFR_EQ_ID_LIST_OP:
- //
- // If we encountered a ConsistencyId value, on this page they will be incremental
- // So register the first value we encounter. We will pass this in when we re-create this page
- //
- if ((LocalTags->Tags[BackupIndex].ConsistencyId != 0) && (ConsistencyId == 0)) {
- ConsistencyId = (UINT16) (LocalTags->Tags[BackupIndex].ConsistencyId - 1);
- }
- break;
- }
- }
- //
- // Delete the buffer associated with previous dynamic page
- // We will re-allocate a buffer....
- //
- FreePool (LocalTags->Tags);
-
- Length = 0xF000;
- Buffer = AllocateZeroPool (Length);
- ASSERT (Buffer != NULL);
-
- //
- // Get the form that was updated by the callback
- //
- Hii->GetForms (
- Hii,
- Selection->Handle,
- TargetPage,
- &Length,
- Buffer
- );
-
- //
- // Ok, we have the new page.....now we must purge the old page and re-allocate
- // the tag page with the new data
- //
- UpdateNewTagData (
- Buffer,
- ConsistencyId,
- CurrentVariable,
- LocalTags,
- FileFormTags
- );
-
- //
- // return the Form Id, Text, and the File's FormTags structure
- //
- *FormHandle = LocalTags->Tags[0].Id;
- *TitleToken = LocalTags->Tags[0].Text;
- *FormTags = *LocalTags;
-
- FormTags->Tags[0].CallbackHandle = CallbackHandle;
- CopyMem (&FormTags->Tags[0].GuidValue, &TagGuid, sizeof (EFI_GUID));
-
- return ;
-}
-
-UI_MENU_OPTION *
-SetupBrowser (
- IN UI_MENU_OPTION *Selection,
- IN BOOLEAN Callback,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN UINT8 *CallbackData
- )
-{
- UINT16 FormHandle;
- UINT16 TitleToken;
- EFI_FORM_TAGS FormTags;
-
- gEntryNumber = -1;
- gLastOpr = FALSE;
- //
- // Displays the Header and Footer borders
- //
- DisplayPageFrame ();
-
- //
- // Id of 0 yields the getting of the top form whatever the ID is. Usually the first form in the IFR
- //
- ExtractFormHandle (Selection, FileFormTagsHead, 0, &FormHandle, &TitleToken, &FormTags);
-
- Selection = DisplayForm (Selection, FormHandle, TitleToken, FormTags, FileFormTagsHead, CallbackData);
-
- //
- // If selection is null use the former selection
- //
- if (Selection == NULL) {
- return Selection;
- }
-
- if (Callback) {
- return Selection;
- }
-
- while (Selection->Tags != NULL) {
- if (Selection->Previous) {
- ExtractFormHandle (Selection, FileFormTagsHead, Selection->FormId, &FormHandle, &TitleToken, &FormTags);
- } else {
- //
- // True if a hyperlink/jump is selected
- //
- if (Selection->ThisTag->Operand == EFI_IFR_REF_OP && Selection->ThisTag->Id != 0x0000) {
- if (Selection->ThisTag->Flags & EFI_IFR_FLAG_INTERACTIVE) {
- ExtractDynamicFormHandle (
- Selection,
- CallbackData,
- FileFormTagsHead,
- Selection->ThisTag->Id,
- &FormHandle,
- &TitleToken,
- &FormTags
- );
- goto DisplayPage;
- } else {
- ExtractFormHandle (Selection, FileFormTagsHead, Selection->ThisTag->Id, &FormHandle, &TitleToken, &FormTags);
- goto DisplayPage;
- }
- }
-
- if ((Selection->ThisTag->Flags & EFI_IFR_FLAG_INTERACTIVE) &&
- (Selection->ThisTag->Operand != EFI_IFR_PASSWORD_OP)
- ) {
- ExtractDynamicFormHandle (
- Selection,
- CallbackData,
- FileFormTagsHead,
- Selection->FormId,
- &FormHandle,
- &TitleToken,
- &FormTags
- );
- } else {
- ExtractFormHandle (Selection, FileFormTagsHead, Selection->FormId, &FormHandle, &TitleToken, &FormTags);
- }
- }
-
-DisplayPage:
- //
- // Displays the Header and Footer borders
- //
- DisplayPageFrame ();
-
- Selection = DisplayForm (Selection, FormHandle, TitleToken, FormTags, FileFormTagsHead, CallbackData);
-
- if (Selection == NULL) {
- break;
- }
- };
-
- return Selection;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Print.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Print.c
deleted file mode 100644
index a751727..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Print.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Print.c
-
-Abstract:
-
- Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
- simple implemenation of SPrint() and Print() to support debug.
-
- You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
- time. This makes the implementation very simple.
-
- VSPrint, Print, SPrint format specification has the follwoing form
-
- %type
-
- type:
- 'S','s' - argument is an Unicode string
- 'c' - argument is an ascii character
- '%' - Print a %
-
---*/
-
-#include "Print.h"
-
-STATIC
-UINTN
-_IPrint (
- IN UINTN Column,
- IN UINTN Row,
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *Out,
- IN CHAR16 *fmt,
- IN VA_LIST args
- )
-//
-// Display string worker for: Print, PrintAt, IPrint, IPrintAt
-//
-{
- CHAR16 *Buffer;
- CHAR16 *BackupBuffer;
- UINTN Index;
- UINTN PreviousIndex;
-
- //
- // For now, allocate an arbitrarily long buffer
- //
- Buffer = AllocateZeroPool (0x10000);
- BackupBuffer = AllocateZeroPool (0x10000);
- ASSERT (Buffer);
- ASSERT (BackupBuffer);
-
- if (Column != (UINTN) -1) {
- Out->SetCursorPosition (Out, Column, Row);
- }
-
- UnicodeVSPrint (Buffer, 0x10000, fmt, args);
-
- Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
-
- Out->SetAttribute (Out, Out->Mode->Attribute);
-
- Index = 0;
- PreviousIndex = 0;
-
- do {
- for (; (Buffer[Index] != NARROW_CHAR) && (Buffer[Index] != WIDE_CHAR) && (Buffer[Index] != 0); Index++) {
- BackupBuffer[Index] = Buffer[Index];
- }
-
- if (Buffer[Index] == 0) {
- break;
- }
- //
- // Null-terminate the temporary string
- //
- BackupBuffer[Index] = 0;
-
- //
- // Print this out, we are about to switch widths
- //
- Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
-
- //
- // Preserve the current index + 1, since this is where we will start printing from next
- //
- PreviousIndex = Index + 1;
-
- //
- // We are at a narrow or wide character directive. Set attributes and strip it and print it
- //
- if (Buffer[Index] == NARROW_CHAR) {
- //
- // Preserve bits 0 - 6 and zero out the rest
- //
- Out->Mode->Attribute = Out->Mode->Attribute & 0x7f;
- Out->SetAttribute (Out, Out->Mode->Attribute);
- } else {
- //
- // Must be wide, set bit 7 ON
- //
- Out->Mode->Attribute = Out->Mode->Attribute | EFI_WIDE_ATTRIBUTE;
- Out->SetAttribute (Out, Out->Mode->Attribute);
- }
-
- Index++;
-
- } while (Buffer[Index] != 0);
-
- //
- // We hit the end of the string - print it
- //
- Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
-
- FreePool (Buffer);
- FreePool (BackupBuffer);
- return EFI_SUCCESS;
-}
-
-UINTN
-Print (
- IN CHAR16 *fmt,
- ...
- )
-/*++
-
-Routine Description:
-
- Prints a formatted unicode string to the default console
-
-Arguments:
-
- fmt - Format string
-
-Returns:
-
- Length of string printed to the console
-
---*/
-{
- VA_LIST args;
-
- VA_START (args, fmt);
- return _IPrint ((UINTN) -1, (UINTN) -1, gST->ConOut, fmt, args);
-}
-
-UINTN
-PrintString (
- CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- Prints a unicode string to the default console,
- using L"%s" format.
-
-Arguments:
-
- String - String pointer.
-
-Returns:
-
- Length of string printed to the console
-
---*/
-{
- return Print ((CHAR16 *) L"%s", String);
-}
-
-UINTN
-PrintChar (
- CHAR16 Character
- )
-/*++
-
-Routine Description:
-
- Prints a chracter to the default console,
- using L"%c" format.
-
-Arguments:
-
- Character - Character to print.
-
-Returns:
-
- Length of string printed to the console.
-
---*/
-{
- return Print ((CHAR16 *) L"%c", Character);
-}
-
-UINTN
-PrintAt (
- IN UINTN Column,
- IN UINTN Row,
- IN CHAR16 *fmt,
- ...
- )
-/*++
-
-Routine Description:
-
- Prints a formatted unicode string to the default console, at
- the supplied cursor position
-
-Arguments:
-
- Column, Row - The cursor position to print the string at
-
- fmt - Format string
-
-Returns:
-
- Length of string printed to the console
-
---*/
-{
- VA_LIST args;
-
- VA_START (args, fmt);
- return _IPrint (Column, Row, gST->ConOut, fmt, args);
-}
-
-UINTN
-PrintStringAt (
- IN UINTN Column,
- IN UINTN Row,
- CHAR16 *String
- )
-/*++
-
-Routine Description:
-
- Prints a unicode string to the default console, at
- the supplied cursor position, using L"%s" format.
-
-Arguments:
-
- Column, Row - The cursor position to print the string at
-
- String - String pointer.
-
-Returns:
-
- Length of string printed to the console
-
---*/
-{
- return PrintAt (Column, Row, (CHAR16 *) L"%s", String);
-}
-
-UINTN
-PrintCharAt (
- IN UINTN Column,
- IN UINTN Row,
- CHAR16 Character
- )
-/*++
-
-Routine Description:
-
- Prints a chracter to the default console, at
- the supplied cursor position, using L"%c" format.
-
-Arguments:
-
- Column, Row - The cursor position to print the string at
-
- Character - Character to print.
-
-Returns:
-
- Length of string printed to the console.
-
---*/
-{
- return PrintAt (Column, Row, (CHAR16 *) L"%c", Character);
-}
-
-
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Print.h b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Print.h
deleted file mode 100644
index d055513..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Print.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Print.h
-
-Abstract:
-
- Private data for Print.c
-
---*/
-
-#ifndef _PRINT_H_
-#define _PRINT_H_
-
-#include "Setup.h"
-
-#define LEFT_JUSTIFY 0x01
-#define PREFIX_SIGN 0x02
-#define PREFIX_BLANK 0x04
-#define COMMA_TYPE 0x08
-#define LONG_TYPE 0x10
-#define PREFIX_ZERO 0x20
-
-//
-// Largest number of characters that can be printed out.
-//
-#define EFI_DRIVER_LIB_MAX_PRINT_BUFFER (80 * 4)
-
-#endif
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/ProcessOptions.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/ProcessOptions.c
deleted file mode 100644
index a2dc808..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/ProcessOptions.c
+++ /dev/null
@@ -1,1687 +0,0 @@
-/**@file
- Implementation for handling the User Interface option processing.
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Setup.h"
-#include "Ui.h"
-
-EFI_STATUS
-ExtractRequestedNvMap (
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UINT16 VariableId,
- OUT EFI_VARIABLE_DEFINITION **VariableDefinition
- )
-{
- *VariableDefinition = FileFormTags->VariableDefinitions;
-
- //
- // Extract the data from the NV variable - consumer will free the buffer.
- //
- for (; *VariableDefinition != NULL; *VariableDefinition = (*VariableDefinition)->Next) {
- //
- // If there is a variable with this ID return with EFI_SUCCESS
- //
- if (!CompareMem (&(*VariableDefinition)->VariableId, &VariableId, sizeof (UINT16))) {
- return EFI_SUCCESS;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-ExtractNvValue (
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UINT16 VariableId,
- IN UINT16 VariableSize,
- IN UINT16 OffsetValue,
- OUT VOID **Buffer
- )
-{
- EFI_STATUS Status;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
-
- Status = ExtractRequestedNvMap (FileFormTags, VariableId, &VariableDefinition);
-
- if (!EFI_ERROR (Status)) {
- //
- // Allocate sufficient space for the data and copy it into the outgoing buffer
- //
- if (VariableSize != 0) {
- *Buffer = AllocateZeroPool (VariableSize);
- ASSERT (*Buffer != NULL);
- CopyMem (*Buffer, &VariableDefinition->NvRamMap[OffsetValue], VariableSize);
- }
- return EFI_SUCCESS;
- }
-
- return Status;
-}
-
-STATIC
-VOID
-AdjustNvMap (
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UI_MENU_OPTION *MenuOption
- )
-{
- CHAR8 *NvRamMap;
- UINTN SizeRequired;
- UINTN Index;
- UINTN CachedStart;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
-
- CachedStart = 0;
-
- SizeRequired = MenuOption->ThisTag->StorageStart + MenuOption->ThisTag->StorageWidth;
-
- ExtractRequestedNvMap (FileFormTags, MenuOption->Tags->VariableNumber, &VariableDefinition);
-
- //
- // We arrived here because the current NvRamMap is too small for the new op-code to store things and
- // we need to adjust the buffer to support this.
- //
- NvRamMap = AllocateZeroPool (SizeRequired + 1);
- ASSERT (NvRamMap != NULL);
-
- //
- // Copy current NvRamMap to the new NvRamMap
- //
- CopyMem (NvRamMap, VariableDefinition->NvRamMap, VariableDefinition->VariableFakeSize);
-
- //
- // Remember, the only time we come here is because we are in the NVPlus section of the NvRamMap
- //
- for (Index = MenuOption->TagIndex;
- (MenuOption->Tags[Index].Operand != EFI_IFR_END_FORM_OP) && (MenuOption->Tags[Index].Operand != EFI_IFR_END_ONE_OF_OP);
- Index++
- ) {
-
- switch (MenuOption->Tags[Index].Operand) {
- case EFI_IFR_ORDERED_LIST_OP:
- case EFI_IFR_ONE_OF_OP:
- CachedStart = MenuOption->Tags[Index].StorageStart;
- break;
-
- case EFI_IFR_ONE_OF_OPTION_OP:
- if (MenuOption->Tags[Index].Flags & EFI_IFR_FLAG_DEFAULT) {
- CopyMem (&NvRamMap[CachedStart], &MenuOption->Tags[Index].Value, 2);
- }
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- CopyMem (&NvRamMap[MenuOption->Tags[Index].StorageStart], &MenuOption->Tags[Index].Flags, 1);
- break;
-
- case EFI_IFR_NUMERIC_OP:
- case EFI_IFR_DATE_OP:
- case EFI_IFR_TIME_OP:
- case EFI_IFR_STRING_OP:
- case EFI_IFR_PASSWORD_OP:
- CopyMem (
- &NvRamMap[MenuOption->Tags[Index].StorageStart],
- &MenuOption->Tags[Index].Value,
- MenuOption->Tags[Index].StorageWidth
- );
- break;
-
- }
- }
-
- FreePool (VariableDefinition->NvRamMap);
- VariableDefinition->NvRamMap = NvRamMap;
- VariableDefinition->VariableFakeSize = (UINT16) SizeRequired;
-}
-
-EFI_STATUS
-ProcessOptions (
- IN UI_MENU_OPTION *MenuOption,
- IN BOOLEAN Selected,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN EFI_IFR_DATA_ARRAY *PageData,
- OUT CHAR16 **OptionString
- )
-{
- EFI_STATUS Status;
- CHAR16 *StringPtr;
- UINTN Index;
- UINTN CachedIndex;
- EFI_FILE_FORM_TAGS *FileFormTags;
- EFI_TAG *Tag;
- CHAR16 FormattedNumber[6];
- UINT16 Number;
- UINT16 Value;
- UINT16 *ValueArray;
- UINT16 *NvRamMap;
- CHAR8 *TmpNvRamMap;
- UINTN Default;
- UINTN StringCount;
- CHAR16 Character[2];
- UINTN Count;
- EFI_TIME Time;
- EFI_FORM_CALLBACK_PROTOCOL *FormCallback;
- STRING_REF PopUp;
- CHAR16 NullCharacter;
- EFI_INPUT_KEY Key;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
- BOOLEAN OrderedList;
- BOOLEAN Initialized;
- UINT16 KeyValue;
- BOOLEAN Skip;
-
- FileFormTags = FileFormTagsHead;
-
- for (Index = 0; Index < MenuOption->IfrNumber; Index++) {
- FileFormTags = FileFormTags->NextFile;
- }
-
- OrderedList = FALSE;
- Initialized = FALSE;
- ValueArray = NULL;
- VariableDefinition = NULL;
- Skip = FALSE;
-
- ZeroMem (&Time, sizeof (EFI_TIME));
-
- StringPtr = (CHAR16 *) L"\0";
- Tag = MenuOption->ThisTag;
- ExtractRequestedNvMap (FileFormTags, Tag->VariableNumber, &VariableDefinition);
-
- if (Tag->StorageStart > VariableDefinition->VariableSize) {
- NvRamMap = (UINT16 *) &VariableDefinition->FakeNvRamMap[Tag->StorageStart];
- } else {
- NvRamMap = (UINT16 *) &VariableDefinition->NvRamMap[Tag->StorageStart];
- }
-
- StringCount = 0;
- Character[1] = 0;
- Count = 0;
- Default = 0;
- NullCharacter = CHAR_NULL;
- FormCallback = NULL;
-
- if (MenuOption->ThisTag->Operand == EFI_IFR_ORDERED_LIST_OP) {
- OrderedList = TRUE;
- if (((UINT8 *) NvRamMap)[0] != 0x00) {
- Initialized = TRUE;
- }
- }
-
- ZeroMem (FormattedNumber, 12);
-
- Status = gBS->HandleProtocol (
- (VOID *) (UINTN) FileFormTags->FormTags.Tags[0].CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- (VOID **) &FormCallback
- );
-
- if (*OptionString != NULL) {
- FreePool (*OptionString);
- *OptionString = NULL;
- }
-
- switch (Tag->Operand) {
-
- case EFI_IFR_ORDERED_LIST_OP:
- case EFI_IFR_ONE_OF_OP:
- //
- // If the op-code we are looking at is larger than the latest created NvMap - we likely encountered a dynamically
- // created entry which has an expanded NvMap requirement. We won't save this information - but we need to adjust
- // the NvMap so that we can properly display the information
- //
- if ((UINTN) (Tag->StorageStart + Tag->StorageWidth) > VariableDefinition->VariableFakeSize) {
- AdjustNvMap (FileFormTags, MenuOption);
- NvRamMap = (UINT16 *) &VariableDefinition->NvRamMap[Tag->StorageStart];
- }
-
- CachedIndex = MenuOption->TagIndex;
-
- //
- // search for EFI_IFR_ONE_OF_OPTION_OP until you hit the EFI_IFR_END_ONE_OF_OP,
- // each of the .Text in the options are going to be what gets displayed. Break each into 26 char chunks
- // when hit right/left arrow allows for selection - then repopulate Tag[TagIndex] with the choice
- //
- for (Index = MenuOption->TagIndex; MenuOption->Tags[Index].Operand != EFI_IFR_END_ONE_OF_OP; Index++) {
- //
- // We found an option - which assumedly has a string. We will eventually have to support
- // wrapping of strings. For now, let's pretend they don't wrap and code that up.
- //
- // Count how many strings there are
- //
- if (MenuOption->Tags[Index].Operand == EFI_IFR_ONE_OF_OPTION_OP) {
- //
- // If one of the options for the one-of has an interactive flag, back-define the oneof to have one too
- //
- if (MenuOption->Tags[Index].Flags & EFI_IFR_FLAG_INTERACTIVE) {
- MenuOption->Tags[CachedIndex].Flags = (UINT8) (MenuOption->Tags[CachedIndex].Flags | EFI_IFR_FLAG_INTERACTIVE);
- }
-
- StringCount++;
- }
- }
- //
- // We now know how many strings we will have, so we can allocate the
- // space required for the array or strings.
- //
- *OptionString = AllocateZeroPool (StringCount * (gOptionBlockWidth + 1) * 2 * gScreenDimensions.BottomRow);
- ASSERT (*OptionString);
-
- //
- // Add left delimeter to string
- //
- *OptionString[0] = LEFT_ONEOF_DELIMITER;
-
- //
- // Retrieve the current OneOf value
- //
- if (Selected) {
- //
- // Auto selection from list
- //
- Value = 0;
- //
- // Copy current setting to the seed Value
- //
- if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {
- ValueArray = AllocateZeroPool (MenuOption->ThisTag->StorageWidth);
- ASSERT (ValueArray != NULL);
- CopyMem (ValueArray, NvRamMap, MenuOption->ThisTag->StorageWidth);
- } else {
- CopyMem (&Value, NvRamMap, MenuOption->ThisTag->StorageWidth);
- CopyMem (gPreviousValue, NvRamMap, MenuOption->ThisTag->StorageWidth);
- }
-
- Number = Value;
- if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {
- Status = GetSelectionInputPopUp (MenuOption, Tag, MenuOption->ThisTag->StorageWidth, ValueArray, &KeyValue);
- } else {
- Status = GetSelectionInputPopUp (MenuOption, Tag, 1, &Value, &KeyValue);
- }
-
- if (!EFI_ERROR (Status)) {
- if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {
- CopyMem (NvRamMap, ValueArray, MenuOption->ThisTag->StorageWidth);
- FreePool (ValueArray);
- } else {
- //
- // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth
- //
- CopyMem (NvRamMap, &Value, Tag->StorageWidth);
- MenuOption->ThisTag->Key = KeyValue;
- }
- //
- // If a late check is required save off the information. This is used when consistency checks
- // are required, but certain values might be bound by an impossible consistency check such as
- // if two questions are bound by consistency checks and each only has two possible choices, there
- // would be no way for a user to switch the values. Thus we require late checking.
- //
- if (Tag->Flags & EFI_IFR_FLAG_LATE_CHECK) {
- CopyMem (&Tag->OldValue, &Value, Tag->StorageWidth);
- } else {
- //
- // In theory, passing the value and the Id are sufficient to determine what needs
- // to be done. The Id is the key to look for the entry needed in the Inconsistency
- // database. That will yields operand and ID data - and since the ID's correspond
- // to the NV storage, we can determine the values for other IDs there.
- //
- if (ValueIsNotValid (TRUE, 0, Tag, FileFormTags, &PopUp)) {
- if (PopUp == 0x0000) {
- //
- // Restore Old Value
- //
- if (!Tag->Suppress && !Tag->GrayOut) {
- CopyMem (NvRamMap, &Number, MenuOption->ThisTag->StorageWidth);
- }
- break;
- }
-
- StringPtr = GetToken (PopUp, MenuOption->Handle);
-
- CreatePopUp (GetStringWidth (StringPtr) / 2, 3, &NullCharacter, StringPtr, &NullCharacter);
-
- do {
- Status = WaitForKeyStroke (&Key);
-
- switch (Key.UnicodeChar) {
-
- case CHAR_CARRIAGE_RETURN:
- //
- // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth
- //
- CopyMem (NvRamMap, &Number, MenuOption->ThisTag->StorageWidth);
- FreePool (StringPtr);
- break;
-
- default:
- break;
- }
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- }
- }
-
- UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE);
- } else {
- if (Tag->Operand == EFI_IFR_ORDERED_LIST_OP) {
- FreePool (ValueArray);
- }
-
- return EFI_SUCCESS;
- }
- } else {
- for (Index = MenuOption->TagIndex; MenuOption->Tags[Index].Operand != EFI_IFR_END_ONE_OF_OP; Index++) {
- //
- // We found an option - which assumedly has a string. We will eventually have to support
- // wrapping of strings. For now, let's pretend they don't wrap and code that up.
- //
- if (MenuOption->Tags[Index].Operand == EFI_IFR_ONE_OF_OPTION_OP) {
- if (OrderedList) {
- if (!Initialized) {
- //
- // If the first entry is invalid, then the "default" settings are based on what is reflected
- // in the order of the op-codes
- //
- ((UINT8 *) NvRamMap)[Index - MenuOption->TagIndex - 1] = (UINT8) MenuOption->Tags[Index].Value;
- }
- //
- // Only display 3 lines of stuff at most
- //
- if ((Index - MenuOption->TagIndex) > ORDERED_LIST_SIZE) {
- break;
- }
-
- if (((Index - MenuOption->TagIndex) != 1) && !Skip) {
- Character[0] = LEFT_ONEOF_DELIMITER;
- NewStrCat (OptionString[0], Character);
- }
-
- MenuOption->ThisTag->NumberOfLines = (UINT16) (Index - MenuOption->TagIndex);
- if (!Initialized) {
- StringPtr = GetToken (MenuOption->Tags[Index].Text, MenuOption->Handle);
- } else {
- for (Value = (UINT16) (MenuOption->TagIndex + 1);
- MenuOption->Tags[Value].Operand != EFI_IFR_END_ONE_OF_OP;
- Value++
- ) {
- if (MenuOption->Tags[Value].Value == ((UINT8 *) NvRamMap)[Index - MenuOption->TagIndex - 1]) {
- StringPtr = GetToken (MenuOption->Tags[Value].Text, MenuOption->Handle);
- break;
- }
- }
-
- if (MenuOption->Tags[Value].Operand == EFI_IFR_END_ONE_OF_OP) {
- Skip = TRUE;
- continue;
- }
- }
-
- Skip = FALSE;
- NewStrCat (OptionString[0], StringPtr);
- Character[0] = RIGHT_ONEOF_DELIMITER;
- NewStrCat (OptionString[0], Character);
- Character[0] = CHAR_CARRIAGE_RETURN;
- NewStrCat (OptionString[0], Character);
-
- //
- // Remove Buffer allocated for StringPtr after it has been used.
- //
- FreePool (StringPtr);
- } else {
- //
- // The option value is the same as what is stored in NV store. Print this.
- //
- if (!CompareMem (&(MenuOption->Tags[Index].Value), NvRamMap, MenuOption->ThisTag->StorageWidth)) {
- StringPtr = GetToken (MenuOption->Tags[Index].Text, MenuOption->Handle);
- NewStrCat (OptionString[0], StringPtr);
- Character[0] = RIGHT_ONEOF_DELIMITER;
- NewStrCat (OptionString[0], Character);
- //
- // Remove Buffer allocated for StringPtr after it has been used.
- //
- FreePool (StringPtr);
- Default = 0;
- break;
- }
-
- if ((MenuOption->Tags[Index].Flags & EFI_IFR_FLAG_DEFAULT) == 1) {
- Default = MenuOption->Tags[Index].Text;
- Value = MenuOption->Tags[Index].Value;
- };
- }
- }
- }
- //
- // We didn't find a value that matched a setting in the NVRAM Map - display default - set default
- //
- if (Default != 0) {
- //
- // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth
- //
- CopyMem (NvRamMap, &Value, MenuOption->ThisTag->StorageWidth);
-
- StringPtr = GetToken ((UINT16) Default, MenuOption->Handle);
- NewStrCat (OptionString[0], StringPtr);
- Character[0] = RIGHT_ONEOF_DELIMITER;
- NewStrCat (OptionString[0], Character);
- //
- // Remove Buffer allocated for StringPtr after it has been used.
- //
- FreePool (StringPtr);
- }
- }
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- //
- // If the op-code we are looking at is larger than the latest created NvMap - we likely encountered a dynamically
- // created entry which has an expanded NvMap requirement. We won't save this information - but we need to adjust
- // the NvMap so that we can properly display the information
- //
- if ((UINTN) (Tag->StorageStart + Tag->StorageWidth) > VariableDefinition->VariableFakeSize) {
- AdjustNvMap (FileFormTags, MenuOption);
- NvRamMap = (UINT16 *) &VariableDefinition->NvRamMap[Tag->StorageStart];
- }
-
- Default = Tag->Flags & 1;
- //
- // If hit spacebar, set or unset Tag[TagIndex].Flags based on it's previous value - BOOLEAN
- //
- *OptionString = AllocateZeroPool ((gOptionBlockWidth + 1) * 2 * gScreenDimensions.BottomRow);
- ASSERT (*OptionString);
-
- //
- // Since Checkboxes are BOOLEAN values, bit 0 of the Flags bit defines the default option, therefore, if
- // the default option (only one option for checkboxes) is on, then the default value is on. Tag.Default is not
- // an active field for Checkboxes.
- //
- StrnCpy (OptionString[0], (CHAR16 *) LEFT_CHECKBOX_DELIMITER, 1);
-
- //
- // Since this is a BOOLEAN operation, flip bit 0 upon selection
- //
- if (Selected) {
- Tag->Value = (UINT16) (Tag->Value ^ 1);
- *(UINT8 *) NvRamMap = (UINT8) (Tag->Value & 1);
- UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE);
- }
-
- if ((*(UINT8 *) NvRamMap & 1) == 0x01) {
- NewStrCat (OptionString[0], (CHAR16 *) CHECK_ON);
- //
- // If someone reset default variables - we may need to reload from our NvMapping....
- //
- Tag->Value = *(UINT8 *) NvRamMap;
- } else {
- //
- // If someone reset default variables - we may need to reload from our NvMapping....
- //
- NewStrCat (OptionString[0], (CHAR16 *) CHECK_OFF);
- Tag->Value = *(UINT8 *) NvRamMap;
- }
-
- NewStrCat (OptionString[0], (CHAR16 *) RIGHT_CHECKBOX_DELIMITER);
- NewStrCat (OptionString[0], StringPtr);
- break;
-
- case EFI_IFR_NUMERIC_OP:
- //
- // If the op-code we are looking at is larger than the latest created NvMap - we likely encountered a dynamically
- // created entry which has an expanded NvMap requirement. We won't save this information - but we need to adjust
- // the NvMap so that we can properly display the information
- //
- if ((UINTN) (Tag->StorageStart + Tag->StorageWidth) > VariableDefinition->VariableFakeSize) {
- AdjustNvMap (FileFormTags, MenuOption);
- NvRamMap = (UINT16 *) &VariableDefinition->NvRamMap[Tag->StorageStart];
- }
-
- *OptionString = AllocateZeroPool ((gOptionBlockWidth + 1) * 2 * gScreenDimensions.BottomRow);
- ASSERT (*OptionString);
-
- //
- // Add left delimeter to string
- //
- *OptionString[0] = LEFT_NUMERIC_DELIMITER;
-
- //
- // Retrieve the current numeric value
- //
- if (Selected) {
- //
- // Go ask for input
- //
- if (Tag->Step == 0) {
- //
- // Manual Input
- //
- Status = GetNumericInput (MenuOption, FileFormTagsHead, TRUE, Tag, REGULAR_NUMERIC, &Number);
- if (!EFI_ERROR (Status)) {
- CopyMem (gPreviousValue, NvRamMap, MenuOption->ThisTag->StorageWidth);
- UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE);
-
- //
- // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth
- //
- CopyMem (NvRamMap, &Number, MenuOption->ThisTag->StorageWidth);
- } else {
- return EFI_SUCCESS;
- }
- } else {
- //
- // Auto selection from list
- //
- if ((((Tag->StorageWidth == 1) && (UINT8) (*NvRamMap) > Tag->Maximum) || ((UINT8) (*NvRamMap) < Tag->Minimum)) ||
- (((Tag->StorageWidth == 2) && *NvRamMap > Tag->Maximum) || (*NvRamMap < Tag->Minimum))
- ) {
- //
- // Seed Number with valid value if currently invalid
- //
- Number = Tag->Default;
- } else {
- if (Tag->StorageWidth == 1) {
- Number = (UINT8) (*NvRamMap);
- } else {
- Number = *NvRamMap;
- }
- }
-
- Status = GetNumericInput (MenuOption, FileFormTagsHead, FALSE, Tag, REGULAR_NUMERIC, &Number);
- if (!EFI_ERROR (Status)) {
- CopyMem (gPreviousValue, NvRamMap, MenuOption->ThisTag->StorageWidth);
- UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE);
-
- //
- // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth
- //
- CopyMem (NvRamMap, &Number, MenuOption->ThisTag->StorageWidth);
- } else {
- return EFI_SUCCESS;
- }
- }
- } else {
- if (((Tag->StorageWidth == 1) && (UINT8) (*NvRamMap) <= Tag->Maximum && (UINT8) (*NvRamMap) >= Tag->Minimum) ||
- ((Tag->StorageWidth == 2) && *NvRamMap <= Tag->Maximum && *NvRamMap >= Tag->Minimum)
- ) {
- if (Tag->StorageWidth == 1) {
- Number = (UINT8) (*NvRamMap);
- } else {
- Number = *NvRamMap;
- }
- UnicodeValueToString (
- FormattedNumber,
- FALSE,
- (UINTN) Number,
- (sizeof (FormattedNumber) / sizeof (FormattedNumber[0]))
- );
- Number = (UINT16) GetStringWidth (FormattedNumber);
- StrnCpy (OptionString[0] + 1, FormattedNumber, Number);
- } else {
- //
- // If *NvRamMap isn't within parameters, set it to within parameters
- //
- //
- // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth
- //
- CopyMem (NvRamMap, &Tag->Default, MenuOption->ThisTag->StorageWidth);
- Number = Tag->Default;
-
- UnicodeValueToString (
- FormattedNumber,
- FALSE,
- (UINTN) Number,
- (sizeof (FormattedNumber) / sizeof (FormattedNumber[0]))
- );
- Number = (UINT16) GetStringWidth (FormattedNumber);
- StrnCpy (OptionString[0] + 1, FormattedNumber, Number);
- }
-
- *(OptionString[0] + Number / 2) = RIGHT_NUMERIC_DELIMITER;
- NewStrCat (OptionString[0] + (Number / 2) + 1, StringPtr);
- }
- break;
-
- case EFI_IFR_DATE_OP:
- //
- // If the op-code we are looking at is larger than the latest created NvMap - we likely encountered a dynamically
- // created entry which has an expanded NvMap requirement. We won't save this information - but we need to adjust
- // the NvMap so that we can properly display the information
- //
- if ((UINTN) (Tag->StorageStart + Tag->StorageWidth) > VariableDefinition->VariableFakeSize) {
- AdjustNvMap (FileFormTags, MenuOption);
- NvRamMap = (UINT16 *) &VariableDefinition->NvRamMap[Tag->StorageStart];
- }
-
- Status = gRT->GetTime (&Time, NULL);
- if (EFI_ERROR (Status)) {
- return EFI_SUCCESS;
- }
- //
- // This for loop advances Index till it points immediately after a date entry. We can then
- // subtract MenuOption->TagIndex from Index and find out relative to the start of the Date
- // structure which field we were in. For instance, if TagIndex was 52, and we advanced Index
- // to 53 and found it to no longer point to a date operand, we were pointing to the last of 3
- // date operands.
- //
- //
- // This has BUGBUG potential....fix this - if someone wants to ask two DATE questions in a row.....code
- // against such silliness.
- //
- // Also, we want to internationalize the order of the date information. We need to code for it as well.
- //
- for (Index = MenuOption->TagIndex; MenuOption->Tags[Index].Operand == EFI_IFR_DATE_OP; Index++)
- ;
-
- //
- // Count 0 = We entered on the first Date operand
- // Count 1 = We entered on the second Date operand
- // Count 2 = We entered on the third Date operand
- //
- Count = 3 - (Index - MenuOption->TagIndex);
- if (Count > 2) {
- return EFI_SUCCESS;
- }
- //
- // This is similar to numerics, except for the following:
- // We will under normal circumstances get 3 consecutive calls
- // to process this opcodes data.
- //
- *OptionString = AllocateZeroPool ((gOptionBlockWidth + 1) * 2 * gScreenDimensions.BottomRow);
- ASSERT (*OptionString);
-
- switch (Count) {
- case 0:
- if (Selected) {
- Number = (UINT16) Time.Month;
-
- if (Tag->Step == 0) {
- MenuOption->OptCol++;
- Status = GetNumericInput (MenuOption, FileFormTagsHead, TRUE, Tag, DATE_NUMERIC, &Number);
- } else {
- //
- // Seed value with current setting
- //
- Tag->Value = (UINT16) Time.Month;
- Status = GetNumericInput (MenuOption, FileFormTagsHead, FALSE, Tag, DATE_NUMERIC, &Number);
- }
-
- if (!EFI_ERROR (Status)) {
- Time.Month = (UINT8) Number;
- gRT->SetTime (&Time);
- }
- }
-
- VariableDefinition->FakeNvRamMap[Tag->Id] = Time.Month;
- *OptionString[0] = LEFT_NUMERIC_DELIMITER;
-
- UnicodeValueToString (
- FormattedNumber,
- FALSE,
- (UINTN) Time.Month,
- (sizeof (FormattedNumber) / sizeof (FormattedNumber[0]))
- );
- Number = (UINT16) GetStringWidth (FormattedNumber);
-
- if (Number == 4) {
- FormattedNumber[2] = FormattedNumber[1];
- FormattedNumber[1] = FormattedNumber[0];
- FormattedNumber[0] = L'0';
- Number = 6;
- }
-
- StrnCpy (OptionString[0] + 1, FormattedNumber, Number);
- *(OptionString[0] + Number / 2) = DATE_SEPARATOR;
- StrCat (OptionString[0] + (Number / 2) + 1, StringPtr);
- break;
-
- case 1:
- if (Selected) {
- Number = (UINT16) Time.Day;
-
- if (Tag->Step == 0) {
- Status = GetNumericInput (MenuOption, FileFormTagsHead, TRUE, Tag, DATE_NUMERIC, &Number);
- } else {
- //
- // Seed value with current setting
- //
- Tag->Value = (UINT16) Time.Day;
- Status = GetNumericInput (MenuOption, FileFormTagsHead, FALSE, Tag, DATE_NUMERIC, &Number);
- }
-
- if (!EFI_ERROR (Status)) {
- Time.Day = (UINT8) Number;
- gRT->SetTime (&Time);
- }
- }
-
- VariableDefinition->FakeNvRamMap[Tag->Id] = Time.Day;
- SetUnicodeMem (OptionString[0], 4, L' ');
-
- UnicodeValueToString (
- FormattedNumber,
- FALSE,
- (UINTN) Time.Day,
- (sizeof (FormattedNumber) / sizeof (FormattedNumber[0]))
- );
- Number = (UINT16) GetStringWidth (FormattedNumber);
- if (Number == 4) {
- FormattedNumber[2] = FormattedNumber[1];
- FormattedNumber[1] = FormattedNumber[0];
- FormattedNumber[0] = L'0';
- Number = 6;
- }
-
- StrnCpy (OptionString[0] + 4, FormattedNumber, Number);
- *(OptionString[0] + Number / 2 + 3) = DATE_SEPARATOR;
- StrCat (OptionString[0] + (Number / 2) + 4, StringPtr);
- break;
-
- case 2:
- if (Selected) {
- Number = (UINT16) Time.Year;
-
- if (Tag->Step == 0) {
- Status = GetNumericInput (MenuOption, FileFormTagsHead, TRUE, Tag, DATE_NUMERIC, &Number);
- } else {
- //
- // Seed value with current setting
- //
- Status = GetNumericInput (MenuOption, FileFormTagsHead, FALSE, Tag, DATE_NUMERIC, &Number);
- }
-
- if (!EFI_ERROR (Status)) {
- Time.Year = (UINT16) Number;
- gRT->SetTime (&Time);
- }
- }
-
- Tag->Value = (UINT16) Time.Year;
- VariableDefinition->FakeNvRamMap[Tag->Id] = (UINT8) Tag->Value;
- VariableDefinition->FakeNvRamMap[Tag->Id + 1] = (UINT8) (Tag->Value >> 8);
- SetUnicodeMem (OptionString[0], 7, L' ');
- UnicodeValueToString (
- FormattedNumber,
- FALSE,
- (UINTN) Time.Year,
- (sizeof (FormattedNumber) / sizeof (FormattedNumber[0]))
- );
- Number = (UINT16) GetStringWidth (FormattedNumber);
- StrnCpy (OptionString[0] + 7, FormattedNumber, Number);
- *(OptionString[0] + Number / 2 + 6) = RIGHT_NUMERIC_DELIMITER;
- StrCat (OptionString[0] + (Number / 2) + 7, StringPtr);
- break;
- }
-
- break;
-
- //
- // BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG
- // We need to add code to support the NVRam storage version of Date - this is the 1% case where someone
- // might want to set an alarm and actually preserve the data in NVRam so a driver can pick up the instruction
- // BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG
- //
- case EFI_IFR_TIME_OP:
- //
- // If the op-code we are looking at is larger than the latest created NvMap - we likely encountered a dynamically
- // created entry which has an expanded NvMap requirement. We won't save this information - but we need to adjust
- // the NvMap so that we can properly display the information
- //
- if ((UINTN) (Tag->StorageStart + Tag->StorageWidth) > VariableDefinition->VariableFakeSize) {
- AdjustNvMap (FileFormTags, MenuOption);
- NvRamMap = (UINT16 *) &VariableDefinition->NvRamMap[Tag->StorageStart];
- }
-
- Status = gRT->GetTime (&Time, NULL);
- if (EFI_ERROR (Status)) {
- return EFI_SUCCESS;
- }
- //
- // This is similar to numerics, except for the following:
- // We will under normal circumstances get 3 consecutive calls
- // to process this opcodes data.
- //
- *OptionString = AllocateZeroPool ((gOptionBlockWidth + 1) * 2 * gScreenDimensions.BottomRow);
- ASSERT (*OptionString);
-
- //
- // This for loop advances Index till it points immediately after a date entry. We can then
- // subtract MenuOption->TagIndex from Index and find out relative to the start of the Date
- // structure which field we were in. For instance, if TagIndex was 52, and we advanced Index
- // to 53 and found it to no longer point to a date operand, we were pointing to the last of 3
- // date operands.
- //
- for (Index = MenuOption->TagIndex; MenuOption->Tags[Index].Operand == EFI_IFR_TIME_OP; Index++)
- ;
- //
- // Count 0 = We entered on the first Date operand
- // Count 1 = We entered on the second Date operand
- // Count 2 = We entered on the third Date operand
- //
- Count = 3 - (Index - MenuOption->TagIndex);
- if (Count > 2) {
- return EFI_SUCCESS;
- }
-
- switch (Count) {
- case 0:
- Number = Time.Hour;
- break;
-
- case 1:
- Number = Time.Minute;
- break;
-
- case 2:
- Number = Time.Second;
- }
- //
- // Retrieve the current numeric value
- //
- if (Selected) {
- //
- // Go ask for input
- //
- if (Tag->Step == 0) {
- //
- // Manual Input
- //
- Status = GetNumericInput (MenuOption, FileFormTagsHead, TRUE, Tag, TIME_NUMERIC, &Number);
- if (!EFI_ERROR (Status)) {
- *NvRamMap = Number;
- Time.Nanosecond = 0;
- gRT->SetTime (&Time);
- } else {
- return EFI_SUCCESS;
- }
- } else {
- //
- // Auto selection from list
- //
- Status = GetNumericInput (MenuOption, FileFormTagsHead, FALSE, Tag, TIME_NUMERIC, &Number);
- if (!EFI_ERROR (Status)) {
- *NvRamMap = Number;
- } else {
- return EFI_SUCCESS;
- }
- }
-
- switch (Count) {
- case 0:
- Time.Hour = (UINT8) Number;
- break;
-
- case 1:
- Time.Minute = (UINT8) Number;
- break;
-
- case 2:
- Time.Second = (UINT8) Number;
- }
-
- Time.Nanosecond = 0;
- gRT->SetTime (&Time);
- } else {
- switch (Count) {
- case 0:
- *OptionString[0] = LEFT_NUMERIC_DELIMITER;
- UnicodeValueToString (
- FormattedNumber,
- FALSE,
- (UINTN) Time.Hour,
- (sizeof (FormattedNumber) / sizeof (FormattedNumber[0]))
- );
- Number = (UINT16) GetStringWidth (FormattedNumber);
- if (Number == 4) {
- FormattedNumber[2] = FormattedNumber[1];
- FormattedNumber[1] = FormattedNumber[0];
- FormattedNumber[0] = L'0';
- Number = 6;
- }
-
- StrnCpy (OptionString[0] + 1, FormattedNumber, Number);
- *(OptionString[0] + Number / 2) = TIME_SEPARATOR;
- StrCat (OptionString[0] + (Number / 2) + 1, StringPtr);
- break;
-
- case 1:
- SetUnicodeMem (OptionString[0], 4, L' ');
- UnicodeValueToString (
- FormattedNumber,
- FALSE,
- (UINTN) Time.Minute,
- (sizeof (FormattedNumber) / sizeof (FormattedNumber[0]))
- );
- Number = (UINT16) GetStringWidth (FormattedNumber);
- if (Number == 4) {
- FormattedNumber[2] = FormattedNumber[1];
- FormattedNumber[1] = FormattedNumber[0];
- FormattedNumber[0] = L'0';
- Number = 6;
- }
-
- StrnCpy (OptionString[0] + 4, FormattedNumber, Number);
- *(OptionString[0] + Number / 2 + 3) = TIME_SEPARATOR;
- StrCat (OptionString[0] + (Number / 2) + 4, StringPtr);
- break;
-
- case 2:
- SetUnicodeMem (OptionString[0], 7, L' ');
- UnicodeValueToString (
- FormattedNumber,
- FALSE,
- (UINTN) Time.Second,
- (sizeof (FormattedNumber) / sizeof (FormattedNumber[0]))
- );
- Number = (UINT16) GetStringWidth (FormattedNumber);
- if (Number == 4) {
- FormattedNumber[2] = FormattedNumber[1];
- FormattedNumber[1] = FormattedNumber[0];
- FormattedNumber[0] = L'0';
- Number = 6;
- }
-
- StrnCpy (OptionString[0] + 7, FormattedNumber, Number);
- *(OptionString[0] + Number / 2 + 6) = RIGHT_NUMERIC_DELIMITER;
- StrCat (OptionString[0] + (Number / 2) + 7, StringPtr);
- break;
- }
- //
- // BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG
- // We need to add code to support the NVRam storage version of Date - this is the 1% case where someone
- // might want to set an alarm and actually preserve the data in NVRam so a driver can pick up the instruction
- // BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG BUGBUG
- //
- }
- break;
-
- case EFI_IFR_STRING_OP:
- //
- // If the op-code we are looking at is larger than the latest created NvMap - we likely encountered a dynamically
- // created entry which has an expanded NvMap requirement. We won't save this information - but we need to adjust
- // the NvMap so that we can properly display the information
- //
- if ((UINTN) (Tag->StorageStart + Tag->StorageWidth) > VariableDefinition->VariableFakeSize) {
- AdjustNvMap (FileFormTags, MenuOption);
- NvRamMap = (UINT16 *) &VariableDefinition->NvRamMap[Tag->StorageStart];
- }
-
- *OptionString = AllocateZeroPool ((gOptionBlockWidth + 1) * 2 * gScreenDimensions.BottomRow);
- ASSERT (*OptionString);
-
- if (Selected) {
- StringPtr = AllocateZeroPool (Tag->Maximum);
- ASSERT (StringPtr);
-
- Status = ReadString (MenuOption, StringPtr);
-
- if (!EFI_ERROR (Status)) {
- CopyMem (gPreviousValue, NvRamMap, MenuOption->ThisTag->StorageWidth);
- CopyMem (&VariableDefinition->NvRamMap[Tag->StorageStart], StringPtr, Tag->StorageWidth);
-
- UpdateStatusBar (NV_UPDATE_REQUIRED, Tag->Flags, TRUE);
- }
-
- FreePool (StringPtr);
- return Status;
- } else {
- for (Index = 0; Index < gOptionBlockWidth; Index++) {
- if (VariableDefinition->NvRamMap[Tag->StorageStart + (Index * 2)] != 0x0000) {
- CopyMem (OptionString[0] + Index, &VariableDefinition->NvRamMap[Tag->StorageStart + (Index * 2)], 2);
- } else {
- if (Index == 0) {
- *(OptionString[0] + Index) = '_';
- *(OptionString[0] + 1 + Index) = 0;
- }
- break;
- }
- }
-
- return Status;
- }
-
- case EFI_IFR_PASSWORD_OP:
- //
- // If the op-code we are looking at is larger than the latest created NvMap - we likely encountered a dynamically
- // created entry which has an expanded NvMap requirement. We won't save this information - but we need to adjust
- // the NvMap so that we can properly display the information
- //
- if ((UINTN) (Tag->StorageStart + Tag->StorageWidth) > VariableDefinition->VariableFakeSize) {
- AdjustNvMap (FileFormTags, MenuOption);
- NvRamMap = (UINT16 *) &VariableDefinition->NvRamMap[Tag->StorageStart];
- }
-
- if (Selected) {
- StringPtr = AllocateZeroPool (Tag->Maximum);
- ASSERT (StringPtr);
-
- //
- // If interactive, read the password and do the appropriate callbacks in that routine.
- // Since interactive passwords assume to handle the password data in a separate variable
- // storage, we don't need to do more than what is below for password callbacks
- //
- if (Tag->Flags & EFI_IFR_FLAG_INTERACTIVE) {
- MenuOption->Tags[0].CallbackHandle = FileFormTags->FormTags.Tags[0].CallbackHandle;
- Status = ReadPassword (MenuOption, TRUE, Tag, PageData, FALSE, FileFormTags, StringPtr);
- ZeroMem (StringPtr, Tag->Maximum);
-
- if (EFI_ERROR (Status)) {
- if (Status == EFI_NOT_READY) {
- FreePool (StringPtr);
- return EFI_SUCCESS;
- }
- }
-
- Status = ReadPassword (MenuOption, TRUE, Tag, PageData, TRUE, FileFormTags, StringPtr);
- FreePool (StringPtr);
- return EFI_SUCCESS;
- }
-
- for (Index = 0; Index < Tag->Maximum; Index++) {
- if (VariableDefinition->NvRamMap[Tag->StorageStart + Index] != 0x00) {
- //
- // There is something there! Prompt for password
- //
- Status = ReadPassword (MenuOption, TRUE, Tag, PageData, FALSE, FileFormTags, StringPtr);
- if (EFI_ERROR (Status)) {
- FreePool (StringPtr);
- return EFI_SUCCESS;
- }
-
- if (Tag->Encoding == 1) {
- EncodePassword (StringPtr, (UINT8) Tag->Maximum);
- Status = CompareMem (StringPtr, &VariableDefinition->NvRamMap[Tag->StorageStart], Tag->Maximum);
- } else {
- Status = CompareMem (StringPtr, &VariableDefinition->NvRamMap[Tag->StorageStart], Tag->Maximum);
- }
-
- if (Status != 0) {
- FreePool (StringPtr);
- return EFI_SUCCESS;
- } else {
- break;
- }
- }
- }
- //
- // Clean the string
- //
- ZeroMem (StringPtr, Tag->Maximum);
-
- //
- // No password set! Go ahead and prompt the user for a password.
- //
- Status = ReadPassword (MenuOption, FALSE, Tag, PageData, FALSE, FileFormTags, StringPtr);
-
- if (EFI_ERROR (Status)) {
- //
- // User couldn't figure out how to type two identical passwords
- //
- FreePool (StringPtr);
- return EFI_SUCCESS;
- }
- //
- // Very simple example of how one MIGHT do password encoding
- //
- if (Tag->Encoding == 1) {
- EncodePassword (StringPtr, (UINT8) Tag->Maximum);
- }
-
- TmpNvRamMap = AllocatePool (VariableDefinition->VariableSize);
- ASSERT (TmpNvRamMap != NULL);
-
- Count = VariableDefinition->VariableSize;
-
- if ((FormCallback != NULL) && (FormCallback->NvRead != NULL)) {
- Status = FormCallback->NvRead (
- FormCallback,
- VariableDefinition->VariableName,
- &VariableDefinition->Guid,
- NULL,
- &Count,
- (VOID *) TmpNvRamMap
- );
- } else {
- Status = gRT->GetVariable (
- VariableDefinition->VariableName,
- &VariableDefinition->Guid,
- NULL,
- &Count,
- (VOID *) TmpNvRamMap
- );
- }
-
- CopyMem (&VariableDefinition->NvRamMap[Tag->StorageStart], StringPtr, Tag->StorageWidth);
- CopyMem (&TmpNvRamMap[Tag->StorageStart], StringPtr, Tag->StorageWidth);
-
- if ((FormCallback != NULL) && (FormCallback->NvWrite != NULL)) {
- Status = FormCallback->NvWrite (
- FormCallback,
- VariableDefinition->VariableName,
- &VariableDefinition->Guid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- VariableDefinition->VariableSize,
- (VOID *) TmpNvRamMap,
- &gResetRequired
- );
- } else {
- Status = gRT->SetVariable (
- VariableDefinition->VariableName,
- &VariableDefinition->Guid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- VariableDefinition->VariableSize,
- (VOID *) TmpNvRamMap
- );
- }
-
- FreePool (TmpNvRamMap);
- FreePool (StringPtr);
- break;
- }
-
- default:
- break;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- Split StringPtr to several lines of strings stored in FormattedString and the glyph width of
- each line cannot exceed gHelpBlockWidth.
-
- @param StringPtr The pointer of string
- @param FormattedString The pointer of format string
- @param RowCount The count of row
-
-**/
-VOID
-ProcessHelpString (
- IN CHAR16 *StringPtr,
- OUT CHAR16 **FormattedString,
- IN UINTN RowCount
- )
-{
- CONST UINTN BlockWidth = (UINTN) gHelpBlockWidth - 1;
- UINTN AllocateSize;
- //
- // [PrevCurrIndex, CurrIndex) forms a range of a screen-line
- //
- UINTN CurrIndex;
- UINTN PrevCurrIndex;
- UINTN LineCount;
- UINTN VirtualLineCount;
- //
- // GlyphOffset stores glyph width of current screen-line
- //
- UINTN GlyphOffset;
- //
- // GlyphWidth equals to 2 if we meet width directive
- //
- UINTN GlyphWidth;
- //
- // during scanning, we remember the position of last space character
- // in case that if next word cannot put in current line, we could restore back to the position
- // of last space character
- // while we should also remmeber the glyph width of the last space character for restoring
- //
- UINTN LastSpaceIndex;
- UINTN LastSpaceGlyphWidth;
- //
- // every time we begin to form a new screen-line, we should remember glyph width of single character
- // of last line
- //
- UINTN LineStartGlyphWidth;
- UINTN *IndexArray;
- UINTN *OldIndexArray;
-
- //
- // every three elements of IndexArray form a screen-line of string:[ IndexArray[i*3], IndexArray[i*3+1] )
- // IndexArray[i*3+2] stores the initial glyph width of single character. to save this is because we want
- // to bring the width directive of the last line to current screen-line.
- // e.g.: "\wideabcde ... fghi", if "fghi" also has width directive but is splitted to the next screen-line
- // different from that of "\wideabcde", we should remember the width directive.
- //
- AllocateSize = 0x20;
- IndexArray = AllocatePool (AllocateSize * sizeof (UINTN) * 3);
-
- if (*FormattedString != NULL) {
- FreePool (*FormattedString);
- *FormattedString = NULL;
- }
-
- for (PrevCurrIndex = 0, CurrIndex = 0, LineCount = 0, LastSpaceIndex = 0,
- IndexArray[0] = 0, GlyphWidth = 1, GlyphOffset = 0, LastSpaceGlyphWidth = 1, LineStartGlyphWidth = 1;
- (StringPtr[CurrIndex] != CHAR_NULL);
- CurrIndex ++) {
-
- if (LineCount == AllocateSize) {
- AllocateSize += 0x10;
- OldIndexArray = IndexArray;
- IndexArray = AllocatePool (AllocateSize * sizeof (UINTN) * 3);
- CopyMem (IndexArray, OldIndexArray, LineCount * sizeof (UINTN) * 3);
- if (OldIndexArray != NULL) {
- FreePool (OldIndexArray);
- }
- }
-
- switch (StringPtr[CurrIndex]) {
-
- case NARROW_CHAR:
- case WIDE_CHAR:
- GlyphWidth = ((StringPtr[CurrIndex] == WIDE_CHAR) ? 2 : 1);
- if (CurrIndex == 0) {
- LineStartGlyphWidth = GlyphWidth;
- }
- break;
-
- //
- // char is '\n'
- // "\r\n" isn't handled here, handled by case CHAR_CARRIAGE_RETURN
- //
- case CHAR_LINEFEED:
- //
- // Store a range of string as a line
- //
- IndexArray[LineCount*3] = PrevCurrIndex;
- IndexArray[LineCount*3+1] = CurrIndex;
- IndexArray[LineCount*3+2] = LineStartGlyphWidth;
- LineCount ++;
- //
- // Reset offset and save begin position of line
- //
- GlyphOffset = 0;
- LineStartGlyphWidth = GlyphWidth;
- PrevCurrIndex = CurrIndex + 1;
- break;
-
- //
- // char is '\r'
- // "\r\n" and "\r" both are handled here
- //
- case CHAR_CARRIAGE_RETURN:
- if (StringPtr[CurrIndex + 1] == CHAR_LINEFEED) {
- //
- // next char is '\n'
- //
- IndexArray[LineCount*3] = PrevCurrIndex;
- IndexArray[LineCount*3+1] = CurrIndex;
- IndexArray[LineCount*3+2] = LineStartGlyphWidth;
- LineCount ++;
- CurrIndex ++;
- }
- GlyphOffset = 0;
- LineStartGlyphWidth = GlyphWidth;
- PrevCurrIndex = CurrIndex + 1;
- break;
-
- //
- // char is space or other char
- //
- default:
- GlyphOffset += GlyphWidth;
- if (GlyphOffset >= BlockWidth) {
- if (LastSpaceIndex > PrevCurrIndex) {
- //
- // LastSpaceIndex points to space inside current screen-line,
- // restore to LastSpaceIndex
- // (Otherwise the word is too long to fit one screen-line, just cut it)
- //
- CurrIndex = LastSpaceIndex;
- GlyphWidth = LastSpaceGlyphWidth;
- } else if (GlyphOffset > BlockWidth) {
- //
- // the word is too long to fit one screen-line and we don't get the chance
- // of GlyphOffset == BlockWidth because GlyphWidth = 2
- //
- CurrIndex --;
- }
-
- IndexArray[LineCount*3] = PrevCurrIndex;
- IndexArray[LineCount*3+1] = CurrIndex + 1;
- IndexArray[LineCount*3+2] = LineStartGlyphWidth;
- LineStartGlyphWidth = GlyphWidth;
- LineCount ++;
- //
- // Reset offset and save begin position of line
- //
- GlyphOffset = 0;
- PrevCurrIndex = CurrIndex + 1;
- }
-
- //
- // LastSpaceIndex: remember position of last space
- //
- if (StringPtr[CurrIndex] == CHAR_SPACE) {
- LastSpaceIndex = CurrIndex;
- LastSpaceGlyphWidth = GlyphWidth;
- }
- break;
- }
- }
-
- if (GlyphOffset > 0) {
- IndexArray[LineCount*3] = PrevCurrIndex;
- IndexArray[LineCount*3+1] = CurrIndex;
- IndexArray[LineCount*3+2] = GlyphWidth;
- LineCount ++;
- }
-
- if (LineCount == 0) {
- //
- // in case we meet null string
- //
- IndexArray[0] = 0;
- IndexArray[1] = 1;
- //
- // we assume null string's glyph width is 1
- //
- IndexArray[1] = 1;
- LineCount ++;
- }
-
- VirtualLineCount = RowCount * (LineCount / RowCount + (LineCount % RowCount > 0));
- *FormattedString = AllocateZeroPool (VirtualLineCount * (BlockWidth + 1) * sizeof (CHAR16) * 2);
-
- for (CurrIndex = 0; CurrIndex < LineCount; CurrIndex ++) {
- *(*FormattedString + CurrIndex * 2 * (BlockWidth + 1)) = (CHAR16)((IndexArray[CurrIndex*3+2] == 2) ? WIDE_CHAR : NARROW_CHAR);
- StrnCpy (
- *FormattedString + CurrIndex * 2 * (BlockWidth + 1) + 1,
- StringPtr + IndexArray[CurrIndex*3],
- IndexArray[CurrIndex*3+1]-IndexArray[CurrIndex*3]
- );
- }
-
- if (IndexArray != NULL) {
- FreePool (IndexArray);
- }
-}
-
-VOID
-IfrToFormTag (
- IN UINT8 OpCode,
- IN EFI_TAG *TargetTag,
- IN VOID *FormData,
- EFI_VARIABLE_DEFINITION *VariableDefinitionsHead
- )
-{
- UINT16 TempValue;
- CHAR16 *VariableName;
- CHAR8 *AsciiString;
- EFI_VARIABLE_DEFINITION *VariableDefinitions;
- EFI_VARIABLE_DEFINITION *PreviousVariableDefinitions;
- STATIC UINT16 VariableSize;
- EFI_GUID Guid;
- STATIC UINT16 CurrentVariable;
- STATIC UINT16 CurrentVariable2;
- UINTN Index;
-
- switch (OpCode) {
- case EFI_IFR_FORM_OP:
- CopyMem (&TargetTag->Id, &((EFI_IFR_FORM *) FormData)->FormId, sizeof (UINT16));
- CopyMem (&TargetTag->Text, &((EFI_IFR_FORM *) FormData)->FormTitle, sizeof (UINT16));
- TargetTag->VariableNumber = CurrentVariable;
- if (VariableDefinitionsHead != NULL) {
- VariableName = AllocateZeroPool (12);
- ASSERT (VariableName != NULL);
- CopyMem (VariableName, L"Setup", 12);
- VariableDefinitionsHead->VariableName = VariableName;
- VariableDefinitionsHead->VariableSize = VariableSize;
- CopyMem (&VariableDefinitionsHead->Guid, &Guid, sizeof (EFI_GUID));
- }
- break;
-
- case EFI_IFR_SUBTITLE_OP:
- TargetTag->NumberOfLines = 1;
- CopyMem (&TargetTag->Text, &((EFI_IFR_SUBTITLE *) FormData)->SubTitle, sizeof (UINT16));
- TargetTag->VariableNumber = CurrentVariable;
- break;
-
- case EFI_IFR_TEXT_OP:
- TargetTag->NumberOfLines = 1;
- CopyMem (&TargetTag->Text, &((EFI_IFR_TEXT *) FormData)->Text, sizeof (UINT16));
- CopyMem (&TargetTag->Help, &((EFI_IFR_TEXT *) FormData)->Help, sizeof (UINT16));
- TargetTag->VariableNumber = CurrentVariable;
-
- //
- // To optimize the encoding size, certain opcodes have optional fields such as those
- // inside the if() statement. If the encoded length is the complete size, then we
- // know we have valid data encoded that we want to integrate
- //
- if (((EFI_IFR_TEXT *) FormData)->Header.Length == sizeof (EFI_IFR_TEXT)) {
- //
- // Text has no help associated with it, but in case there is a second entry due to
- // dynamic/interactive flags being active, bring this data over.
- //
- CopyMem (&TargetTag->TextTwo, &((EFI_IFR_TEXT *) FormData)->TextTwo, sizeof (UINT16));
- TargetTag->Flags = ((EFI_IFR_TEXT *) FormData)->Flags;
- CopyMem (&TargetTag->Key, &((EFI_IFR_TEXT *) FormData)->Key, sizeof (UINT16));
- }
- break;
-
- case EFI_IFR_ONE_OF_OPTION_OP:
- CopyMem (&TargetTag->Text, &((EFI_IFR_ONE_OF_OPTION *) FormData)->Option, sizeof (UINT16));
- CopyMem (&TargetTag->Value, &((EFI_IFR_ONE_OF_OPTION *) FormData)->Value, sizeof (UINT16));
- TargetTag->Flags = ((EFI_IFR_ONE_OF_OPTION *) FormData)->Flags;
- CopyMem (&TargetTag->Key, &((EFI_IFR_ONE_OF_OPTION *) FormData)->Key, sizeof (UINT16));
- TargetTag->VariableNumber = CurrentVariable;
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- TargetTag->Flags = ((EFI_IFR_CHECKBOX *) FormData)->Flags;
- TargetTag->ResetRequired = (BOOLEAN) (TargetTag->Flags & EFI_IFR_FLAG_RESET_REQUIRED);
- CopyMem (&TargetTag->Key, &((EFI_IFR_CHECKBOX *) FormData)->Key, sizeof (UINT16));
- TargetTag->VariableNumber = CurrentVariable;
- break;
-
- case EFI_IFR_NUMERIC_OP:
- TargetTag->Flags = ((EFI_IFR_NUMERIC *) FormData)->Flags;
- CopyMem (&TargetTag->Key, &((EFI_IFR_NUMERIC *) FormData)->Key, sizeof (UINT16));
- TargetTag->VariableNumber = CurrentVariable;
- break;
-
- case EFI_IFR_STRING_OP:
- //
- // Convert EFI_IFR_STRING.MinSize and EFI_IFR_STRING.MaxSize to actual minimum and maximum bytes
- // and store to EFI_TAG.Minimum and EFI_TAG.Maximum
- //
- TempValue = 0;
- CopyMem (&TempValue, &((EFI_IFR_STRING *) FormData)->MinSize, sizeof (UINT8));
- TempValue = (UINT16) (TempValue * 2);
- CopyMem (&TargetTag->Minimum, &TempValue, sizeof (UINT16));
-
- TempValue = 0;
- CopyMem (&TempValue, &((EFI_IFR_STRING *) FormData)->MaxSize, sizeof (UINT8));
- TempValue = (UINT16) (TempValue * 2);
- CopyMem (&TargetTag->Maximum, &TempValue, sizeof (UINT16));
- CopyMem (&TargetTag->StorageWidth, &TempValue, sizeof (UINT16));
- TargetTag->Flags = (UINT8) (((EFI_IFR_STRING *) FormData)->Flags);
- TargetTag->ResetRequired = (BOOLEAN) (TargetTag->Flags & EFI_IFR_FLAG_RESET_REQUIRED);
- CopyMem (&TargetTag->Key, &((EFI_IFR_STRING *) FormData)->Key, sizeof (UINT16));
- TargetTag->VariableNumber = CurrentVariable;
- break;
-
- case EFI_IFR_PASSWORD_OP:
- TempValue = 0;
- CopyMem (&TempValue, &((EFI_IFR_PASSWORD *) FormData)->MinSize, sizeof (UINT8));
- TempValue = (UINT16) (TempValue * 2);
- CopyMem (&TargetTag->Minimum, &TempValue, sizeof (UINT16));
-
- TempValue = 0;
- CopyMem (&TempValue, &((EFI_IFR_PASSWORD *) FormData)->MaxSize, sizeof (UINT8));
- TempValue = (UINT16) (TempValue * 2);
- CopyMem (&TargetTag->Maximum, &TempValue, sizeof (UINT16));
- CopyMem (&TargetTag->StorageWidth, &TempValue, sizeof (UINT16));
- TargetTag->Flags = ((EFI_IFR_PASSWORD *) FormData)->Flags;
- TargetTag->ResetRequired = (BOOLEAN) (TargetTag->Flags & EFI_IFR_FLAG_RESET_REQUIRED);
- CopyMem (&TargetTag->Key, &((EFI_IFR_PASSWORD *) FormData)->Key, sizeof (UINT16));
- CopyMem (&TargetTag->Encoding, &((EFI_IFR_PASSWORD *) FormData)->Encoding, sizeof (UINT16));
- TargetTag->VariableNumber = CurrentVariable;
- break;
-
- case EFI_IFR_VARSTORE_OP:
- //
- // It should NEVER be NULL
- //
- if (VariableDefinitionsHead == NULL) {
- break;
- }
-
- VariableDefinitions = VariableDefinitionsHead;
-
- //
- // Advance VariableDefinitions to the last entry
- //
- for (; VariableDefinitions != NULL; VariableDefinitions = VariableDefinitions->Next) {
- PreviousVariableDefinitions = VariableDefinitions;
- //
- // If there is a variable with this GUID and ID already, we need to bail out
- //
- if (!CompareMem (&VariableDefinitions->Guid, &((EFI_IFR_VARSTORE *) FormData)->Guid, sizeof (EFI_GUID)) &&
- !CompareMem (&VariableDefinitions->VariableId, &((EFI_IFR_VARSTORE *) FormData)->VarId, sizeof (UINT16))
- ) {
- return ;
- }
-
- if (VariableDefinitions->Next == NULL) {
- break;
- }
- }
- //
- // If the last entry has a variable in it already, allocate a new entry and use it
- //
- if (VariableDefinitions->VariableName != NULL) {
- VariableDefinitions->Next = AllocateZeroPool (sizeof (EFI_VARIABLE_DEFINITION));
- ASSERT (VariableDefinitions->Next != NULL);
- PreviousVariableDefinitions = VariableDefinitions;
- VariableDefinitions = VariableDefinitions->Next;
- VariableDefinitions->Previous = PreviousVariableDefinitions;
- }
- //
- // Copy the Variable data to our linked list
- //
- CopyMem (&VariableDefinitions->VariableId, &((EFI_IFR_VARSTORE *) FormData)->VarId, sizeof (UINT16));
- CopyMem (&VariableDefinitions->VariableSize, &((EFI_IFR_VARSTORE *) FormData)->Size, sizeof (UINT16));
- CopyMem (&VariableDefinitions->Guid, &((EFI_IFR_VARSTORE *) FormData)->Guid, sizeof (EFI_GUID));
-
- //
- // The ASCII String which is immediately past the EFI_IFR_VARSTORE is inferred by the structure definition
- // due to it being variable sized. There are rules preventing it from being > 40 characters long and should
- // be enforced by the compiler.
- //
- AsciiString = (CHAR8 *) (&((EFI_IFR_VARSTORE *) FormData)->Size);
- AsciiString = AsciiString + 2;
- VariableDefinitions->VariableName = AllocateZeroPool ((AsciiStrLen (AsciiString) + 1) * 2);
- ASSERT (VariableDefinitions->VariableName != NULL);
- for (Index = 0; AsciiString[Index] != 0; Index++) {
- VariableDefinitions->VariableName[Index] = (CHAR16) AsciiString[Index];
- }
-
- VariableDefinitions->VariableName[Index] = 0;
-
- //
- // Propogate the tag information for this op-code
- //
- CopyMem (&TargetTag->VariableNumber, &((EFI_IFR_VARSTORE *) FormData)->VarId, sizeof (UINT16));
- CopyMem (&TargetTag->GuidValue, &((EFI_IFR_VARSTORE *) FormData)->Guid, sizeof (EFI_GUID));
- CopyMem (&TargetTag->StorageWidth, &((EFI_IFR_VARSTORE *) FormData)->Size, sizeof (UINT16));
- CopyMem (&TargetTag->Maximum, &((EFI_IFR_VARSTORE *) FormData)->Size, sizeof (UINT16));
- break;
-
- case EFI_IFR_VARSTORE_SELECT_OP:
- CopyMem (&TargetTag->VariableNumber, &((EFI_IFR_VARSTORE_SELECT *) FormData)->VarId, sizeof (UINT16));
- CopyMem (&CurrentVariable, &((EFI_IFR_VARSTORE_SELECT *) FormData)->VarId, sizeof (UINT16));
- CurrentVariable2 = CurrentVariable;
- break;
-
- case EFI_IFR_VARSTORE_SELECT_PAIR_OP:
- CopyMem (&TargetTag->VariableNumber, &((EFI_IFR_VARSTORE_SELECT_PAIR *) FormData)->VarId, sizeof (UINT16));
- CopyMem (
- &TargetTag->VariableNumber2,
- &((EFI_IFR_VARSTORE_SELECT_PAIR *) FormData)->SecondaryVarId,
- sizeof (UINT16)
- );
- CopyMem (&CurrentVariable, &((EFI_IFR_VARSTORE_SELECT_PAIR *) FormData)->VarId, sizeof (UINT16));
- CopyMem (&CurrentVariable2, &((EFI_IFR_VARSTORE_SELECT_PAIR *) FormData)->SecondaryVarId, sizeof (UINT16));
- break;
-
- case EFI_IFR_REF_OP:
- TargetTag->NumberOfLines = 1;
- CopyMem (&TargetTag->Id, &((EFI_IFR_REF *) FormData)->FormId, sizeof (UINT16));
- CopyMem (&TargetTag->Key, &((EFI_IFR_REF *) FormData)->Key, sizeof (UINT16));
- CopyMem (&TargetTag->Text, &((EFI_IFR_REF *) FormData)->Prompt, sizeof (UINT16));
- CopyMem (&TargetTag->Help, &((EFI_IFR_REF *) FormData)->Help, sizeof (UINT16));
- TargetTag->Flags = ((EFI_IFR_REF *) FormData)->Flags;
- TargetTag->VariableNumber = CurrentVariable;
- break;
-
- case EFI_IFR_EQ_ID_VAL_OP:
- CopyMem (&TargetTag->Value, &((EFI_IFR_EQ_ID_VAL *) FormData)->Value, sizeof (UINT16));
- CopyMem (&TargetTag->Id, &((EFI_IFR_EQ_ID_VAL *) FormData)->QuestionId, sizeof (UINT16));
- TargetTag->StorageWidth = ((EFI_IFR_EQ_ID_VAL *) FormData)->Width;
- TargetTag->VariableNumber = CurrentVariable;
- break;
-
- case EFI_IFR_EQ_VAR_VAL_OP:
- CopyMem (&TargetTag->Value, &((EFI_IFR_EQ_VAR_VAL *) FormData)->Value, sizeof (UINT16));
- CopyMem (&TargetTag->Id, &((EFI_IFR_EQ_VAR_VAL *) FormData)->VariableId, sizeof (UINT16));
- TargetTag->VariableNumber = CurrentVariable;
- break;
-
- case EFI_IFR_EQ_ID_ID_OP:
- CopyMem (&TargetTag->Id, &((EFI_IFR_EQ_ID_ID *) FormData)->QuestionId1, sizeof (UINT16));
- CopyMem (&TargetTag->Id2, &((EFI_IFR_EQ_ID_ID *) FormData)->QuestionId2, sizeof (UINT16));
- TargetTag->StorageWidth = ((EFI_IFR_EQ_ID_ID *) FormData)->Width;
- TargetTag->VariableNumber = CurrentVariable;
- TargetTag->VariableNumber = CurrentVariable2;
- break;
-
- case EFI_IFR_EQ_ID_LIST_OP:
- CopyMem (&TargetTag->Id, &((EFI_IFR_EQ_ID_LIST *) FormData)->QuestionId, sizeof (UINT16));
- CopyMem (&TargetTag->Id2, &((EFI_IFR_EQ_ID_LIST *) FormData)->ListLength, sizeof (UINT16));
- TargetTag->StorageWidth = ((EFI_IFR_EQ_ID_LIST *) FormData)->Width;
-
- TargetTag->IntList = AllocateZeroPool (TargetTag->Id2 * sizeof (UINT16));
- ASSERT (TargetTag->IntList);
-
- for (TempValue = 0; TempValue < TargetTag->Id2; TempValue++) {
- CopyMem (
- &TargetTag->IntList[TempValue],
- &((EFI_IFR_EQ_ID_LIST *) FormData)->ValueList[TempValue],
- sizeof (UINT16)
- );
- }
-
- TargetTag->VariableNumber = CurrentVariable;
- break;
-
- case EFI_IFR_FORM_SET_OP:
- CopyMem (&VariableSize, &((EFI_IFR_FORM_SET *) FormData)->NvDataSize, sizeof (UINT16));
- CopyMem (&Guid, &((EFI_IFR_FORM_SET *) FormData)->Guid, sizeof (EFI_GUID));
- //
- // If there is a size specified in the formste, we will establish a "default" variable
- //
- if (VariableDefinitionsHead != NULL) {
- VariableName = AllocateZeroPool (12);
- ASSERT (VariableName != NULL);
- CopyMem (VariableName, L"Setup", 12);
- VariableDefinitionsHead->VariableName = VariableName;
- VariableDefinitionsHead->VariableSize = VariableSize;
- CopyMem (&VariableDefinitionsHead->Guid, &Guid, sizeof (EFI_GUID));
- }
- break;
-
- case EFI_IFR_END_FORM_SET_OP:
- CurrentVariable = 0;
- CurrentVariable2 = 0;
- break;
- }
-
- return ;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Setup.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Setup.c
deleted file mode 100644
index a0a7f1b..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Setup.c
+++ /dev/null
@@ -1,2219 +0,0 @@
-/**@file
- Entry and initialization module for the browser.
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Setup.h"
-#include "Ui.h"
-
-FUNCTIION_KEY_SETTING gFunctionKeySettingTable[] = {
- //
- // Boot Manager
- //
- {
- {
- 0x847bc3fe,
- 0xb974,
- 0x446d,
- {
- 0x94,
- 0x49,
- 0x5a,
- 0xd5,
- 0x41,
- 0x2e,
- 0x99,
- 0x3b
- }
- },
- NONE_FUNCTION_KEY_SETTING
- },
- //
- // Device Manager
- //
- {
- {
- 0x3ebfa8e6,
- 0x511d,
- 0x4b5b,
- {
- 0xa9,
- 0x5f,
- 0xfb,
- 0x38,
- 0x26,
- 0xf,
- 0x1c,
- 0x27
- }
- },
- NONE_FUNCTION_KEY_SETTING
- },
- //
- // BMM Formset.
- //
- {
- {
- 0x642237c7,
- 0x35d4,
- 0x472d,
- {
- 0x83,
- 0x65,
- 0x12,
- 0xe0,
- 0xcc,
- 0xf2,
- 0x7a,
- 0x22
- }
- },
- NONE_FUNCTION_KEY_SETTING
- },
- //
- // BMM File Explorer Formset.
- //
- {
- {
- 0x1f2d63e1,
- 0xfebd,
- 0x4dc7,
- {
- 0x9c,
- 0xc5,
- 0xba,
- 0x2b,
- 0x1c,
- 0xef,
- 0x9c,
- 0x5b
- }
- },
- NONE_FUNCTION_KEY_SETTING
- },
-};
-
-STATIC
-EFI_STATUS
-InitializeBinaryStructures (
- IN EFI_HII_HANDLE *Handle,
- IN BOOLEAN UseDatabase,
- IN EFI_IFR_PACKET *Packet,
- IN UINT8 *NvMapOverride,
- IN UINTN NumberOfIfrImages,
- EFI_FILE_FORM_TAGS **FileFormTagsHead
- );
-
-STATIC
-EFI_STATUS
-InitializeTagStructures (
- IN EFI_IFR_BINARY *BinaryData,
- OUT EFI_FILE_FORM_TAGS *FileFormTags
- );
-
-STATIC
-UI_MENU_OPTION *
-DisplayHomePage (
- IN UINTN NumberOfIfrImages,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN UINT8 *CallbackData
- );
-
-STATIC
-EFI_STATUS
-GetIfrBinaryData (
- IN EFI_HII_PROTOCOL *Hii,
- IN EFI_HII_HANDLE HiiHandle,
- IN EFI_IFR_PACKET *Packet,
- IN EFI_IFR_BINARY *BinaryData
- );
-
-STATIC
-EFI_STATUS
-InstallPrint (
- VOID
- );
-
-STATIC
-EFI_STATUS
-EFIAPI
-SendForm (
- IN EFI_FORM_BROWSER_PROTOCOL * This,
- IN BOOLEAN UseDatabase,
- IN EFI_HII_HANDLE * Handle,
- IN UINTN HandleCount,
- IN EFI_IFR_PACKET * Packet,
- IN EFI_HANDLE CallbackHandle,
- IN UINT8 *NvMapOverride,
- IN EFI_SCREEN_DESCRIPTOR *ScreenDimensions, OPTIONAL
- OUT BOOLEAN *ResetRequired OPTIONAL
- )
-/*++
-
-Routine Description:
-
- This is the routine which an external caller uses to direct the browser
- where to obtain it's information.
-
-Arguments:
-
- UseDatabase - If set to TRUE, then all information is retrieved from the HII database handle specified
- If set to FALSE, then the passed in Packet and CallbackHandle is used and Handle is ignored
-
- Handle - A pointer to an array of Handles. If HandleCount > 1 we display a list of the formsets for the handles specified
-
- HandleCount - The number of Handles specified in Handle.
-
- Packet - Valid only if UseDatabase is FALSE. Packet defines the pages being passed into
- the browser. This is composed of IFR data as well as String information.
-
- CallbackHandle - The handle which contains the calling driver's EFI_FORM_CALLBACK_PROTOCOL interface.
-
- ScreenDimenions - This allows the browser to be called so that it occupies a portion of the physical screen instead of
- dynamically determining the screen dimensions.
-
- NvMapOverride - This buffer is used only when there is no NV variable to define the current settings and the caller
- needs to provide to the browser the current settings for the "fake" NV variable. If used, no saving
- of an NV variable will be possible. This parameter is also ignored if HandleCount > 1.
-
-Returns:
-
---*/
-{
- EFI_FORM_CALLBACK_PROTOCOL *FormCallback;
- EFI_FILE_FORM_TAGS *FileFormTagsHead;
- UI_MENU_OPTION *Selection;
- UI_MENU_OPTION *AltSelection;
- EFI_STATUS Status;
- BOOLEAN Callback;
- VOID *CallbackData;
- EFI_HII_HANDLE BackupHandle;
-
- ZeroMem (&gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
-
- gPreviousValue = AllocatePool (0x1000);
- CallbackData = AllocatePool (0x10000);
- ASSERT (gPreviousValue != NULL);
- ASSERT (CallbackData != NULL);
-
- do {
- //
- // Seed the dimensions in the global
- //
- gST->ConOut->QueryMode (
- gST->ConOut,
- gST->ConOut->Mode->Mode,
- &gScreenDimensions.RightColumn,
- &gScreenDimensions.BottomRow
- );
-
- if (ScreenDimensions != NULL) {
- //
- // Check local dimension vs. global dimension.
- //
- if ((gScreenDimensions.RightColumn < ScreenDimensions->RightColumn) ||
- (gScreenDimensions.BottomRow < ScreenDimensions->BottomRow)
- ) {
- return EFI_INVALID_PARAMETER;
- } else {
- //
- // Local dimension validation.
- //
- if ((ScreenDimensions->RightColumn > ScreenDimensions->LeftColumn) &&
- (ScreenDimensions->BottomRow > ScreenDimensions->TopRow) &&
- ((ScreenDimensions->RightColumn - ScreenDimensions->LeftColumn) > 2) &&
- (
- (ScreenDimensions->BottomRow - ScreenDimensions->TopRow) > STATUS_BAR_HEIGHT +
- SCROLL_ARROW_HEIGHT *
- 2 +
- FRONT_PAGE_HEADER_HEIGHT +
- FOOTER_HEIGHT +
- 1
- )
- ) {
- CopyMem (&gScreenDimensions, ScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
- } else {
- return EFI_INVALID_PARAMETER;
- }
- }
- }
-
- gOptionBlockWidth = (CHAR16) ((gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn) / 3);
- gHelpBlockWidth = gOptionBlockWidth;
- gPromptBlockWidth = gOptionBlockWidth;
-
- //
- // Initialize the strings for the browser, upon exit of the browser, the strings will be freed
- //
- InitializeBrowserStrings ();
-
- gFunctionKeySetting = DEFAULT_FUNCTION_KEY_SETTING;
- gClassOfVfr = EFI_SETUP_APPLICATION_SUBCLASS;
- gResetRequired = FALSE;
- gExitRequired = FALSE;
- gSaveRequired = FALSE;
- gNvUpdateRequired = FALSE;
- gActiveIfr = 0;
- gConsistencyId = 0;
- gPriorMenuEntry = 0;
- BackupHandle = *Handle;
- gMenuRefreshHead = NULL;
- ASSERT (CallbackData);
- ZeroMem (CallbackData, 0x10000);
-
- //
- // We can recurse through this and might need to re-allocate this particular buffer
- //
- if (gPreviousValue == NULL) {
- gPreviousValue = AllocatePool (0x1000);
- ASSERT (gPreviousValue != NULL);
- }
-
- Callback = FALSE;
- FormCallback = NULL;
-
- if (CallbackHandle != NULL) {
- //
- // Retrieve the Callback protocol interface
- //
- Status = gBS->HandleProtocol (
- CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- (VOID **) &FormCallback
- );
-
- if (EFI_ERROR (Status)) {
- FreePool (CallbackData);
- return Status;;
- }
-
- Callback = TRUE;
- }
- //
- // Initializes all the internal state structures for all IFR images in system
- //
- Status = InitializeBinaryStructures (Handle, UseDatabase, Packet, NvMapOverride, HandleCount, &FileFormTagsHead);
-
- if (EFI_ERROR (Status)) {
- FreePool (CallbackData);
- return Status;
- }
- //
- // Beginning of the Presentation of the Data
- //
- if (UseDatabase && (HandleCount > 1)) {
- Selection = DisplayHomePage (HandleCount, FileFormTagsHead, CallbackData);
- } else {
- //
- // If passing something specific, we know there is only one Ifr
- //
- Selection = AllocateZeroPool (sizeof (UI_MENU_OPTION));
- ASSERT (Selection != NULL);
- Selection->IfrNumber = 0;
- Selection->Handle = Handle[0];
- UiInitMenu ();
- }
-
- UiInitMenuList ();
-
- if (UseDatabase && (HandleCount > 1)) {
- if (Selection == NULL) {
- FreePool (CallbackData);
- return EFI_SUCCESS;
- }
- }
- //
- // Launch the setup browser with the user's selection information
- //
- AltSelection = SetupBrowser (Selection, Callback, FileFormTagsHead, CallbackData);
-
- //
- // If the caller cares about Reset status, we can return to the caller if something happened that required a reset
- //
- if (ResetRequired != NULL) {
- *ResetRequired = gResetRequired;
- }
-
- if (Callback && (AltSelection != NULL)) {
- if ((FormCallback != NULL) && (FormCallback->Callback != NULL)) {
- Status = FormCallback->Callback (
- FormCallback,
- AltSelection->ThisTag->Key,
- CallbackData,
- (EFI_HII_CALLBACK_PACKET **) &Packet
- );
- }
- }
-
- *Handle = BackupHandle;
-
- if (EFI_ERROR (Status)) {
- FreePool (CallbackData);
- return Status;
- }
-
- if (Callback && (AltSelection == NULL)) {
- FreePool (CallbackData);
- return Status;
- }
-
- if (UseDatabase && (HandleCount > 1)) {
- } else {
-
- if (gBinaryDataHead->UnRegisterOnExit) {
- Hii->RemovePack (Hii, Handle[0]);
- }
-
- if (Callback &&
- ((AltSelection->ThisTag->SubClass == EFI_FRONT_PAGE_SUBCLASS) ||
- (AltSelection->ThisTag->SubClass == EFI_SINGLE_USE_SUBCLASS))) {
- //
- // If this is the FrontPage, return after every selection
- //
- FreePool (Selection);
- UiFreeMenu ();
-
- //
- // Clean up the allocated data buffers
- //
- FreeData (FileFormTagsHead, NULL, NULL);
-
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- gST->ConOut->ClearScreen (gST->ConOut);
-
- FreePool (CallbackData);
- return EFI_SUCCESS;
- }
-
- FreePool (Selection);
- UiFreeMenu ();
-
- //
- // Clean up the allocated data buffers
- //
- FreeData (FileFormTagsHead, NULL, NULL);
-
- gST->ConOut->ClearScreen (gST->ConOut);
-
- if (!Callback) {
- FreePool (CallbackData);
- return EFI_SUCCESS;
- }
- }
-
- } while (!EFI_ERROR (Status));
-
- FreePool (CallbackData);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-InitializeSetup (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Initialize Setup
-
-Arguments:
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-Returns:
- EFI_SUCCESS - Setup loaded.
- other - Setup Error
-
---*/
-{
- EFI_STATUS Status;
- EFI_FORM_CONFIGURATION_DATA *FormData;
- EFI_FORM_BROWSER_PROTOCOL *FormBrowser;
- EFI_HANDLE Handle;
- EFI_HII_PACKAGES *PackageList;
-
- //
- // There will be only one FormConfig in the system
- // If there is another out there, someone is trying to install us
- // again. Fail that scenario.
- //
- Status = gBS->LocateProtocol (
- &gEfiFormBrowserProtocolGuid,
- NULL,
- (VOID **) &FormBrowser
- );
-
- gFirstIn = TRUE;
-
- //
- // If there was no error, assume there is an installation and fail to load
- //
- if (!EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
-
- FormData = AllocatePool (sizeof (EFI_FORM_CONFIGURATION_DATA));
-
- if (FormData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Fill in HII data
- //
- FormData->Signature = EFI_FORM_DATA_SIGNATURE;
- FormData->FormConfig.SendForm = SendForm;
- FormData->FormConfig.CreatePopUp = CreateDialog;
-
- //
- // There should only be one HII image
- //
- Status = gBS->LocateProtocol (
- &gEfiHiiProtocolGuid,
- NULL,
- (VOID **) &FormData->Hii
- );
-
- ASSERT_EFI_ERROR (Status);
-
- Hii = FormData->Hii;
-
- PackageList = PreparePackages (1, &gEfiFormBrowserProtocolGuid, SetupBrowserStrings);
-
- Status = Hii->NewPack (Hii, PackageList, &gHiiHandle);
-
- FreePool (PackageList);
-
- //
- // Install protocol interface
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiFormBrowserProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &FormData->FormConfig
- );
-
- ASSERT_EFI_ERROR (Status);
-
- BannerData = AllocateZeroPool (sizeof (BANNER_DATA));
- ASSERT (BannerData != NULL);
-
- Status = InstallPrint ();
- return Status;
-}
-
-VOID
-GetQuestionHeader (
- IN EFI_TAG *Tag,
- IN UINT8 *RawFormSet,
- IN UINT16 Index,
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UINT16 CurrentVariable
- )
-/*++
-
-Routine Description:
- Initialize question tag's members.
-
-Arguments:
- Tag - Pointer of the current EFI_TAG structure.
- RawFormSet - Pointer of the formset raw data.
- Index - Offset of the current opcode in the Ifr raw data.
- FileFormTags - Pointer of current EFI_FILE_FORM_TAGS structure.
- CurrentVariable - Current variable number.
-
-Returns:
- None.
---*/
-{
- EFI_VARIABLE_DEFINITION *VariableDefinition;
-
- Tag->NumberOfLines = 1;
- Tag->VariableNumber = CurrentVariable;
- CopyMem (&Tag->Id, &((EFI_IFR_ONE_OF *) &RawFormSet[Index])->QuestionId, sizeof (UINT16));
- CopyMem (&Tag->StorageStart, &((EFI_IFR_ONE_OF *) &RawFormSet[Index])->QuestionId, sizeof (UINT16));
- CopyMem (&Tag->StorageWidth, &((EFI_IFR_ONE_OF *) &RawFormSet[Index])->Width, sizeof (UINT8));
- CopyMem (&Tag->Text, &((EFI_IFR_ONE_OF *) &RawFormSet[Index])->Prompt, sizeof (UINT16));
- CopyMem (&Tag->Help, &((EFI_IFR_ONE_OF *) &RawFormSet[Index])->Help, sizeof (UINT16));
-
- VariableDefinition = FileFormTags->VariableDefinitions;
-
- for (; VariableDefinition != NULL; VariableDefinition = VariableDefinition->Next) {
- //
- // Have we found the correct variable for the request?
- //
- if (CurrentVariable == VariableDefinition->VariableId) {
- if (VariableDefinition->VariableSize < (UINTN) (Tag->StorageStart + Tag->StorageWidth)) {
- VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize + Tag->StorageWidth);
- }
-
- if (VariableDefinition->NvRamMap != NULL) {
- //
- // If it is an 8bit or 16bit width, then move it to Tag->Value, otherwise
- // we will never be looking for the data in Tag->Value (e.g. strings, password, etc)
- //
- if (Tag->StorageWidth == (UINT16) 1) {
- CopyMem (&Tag->Value, &VariableDefinition->NvRamMap[Tag->StorageStart], sizeof (UINT16));
- }
-
- if (Tag->StorageWidth == (UINT16) 2) {
- Index = (UINT16)
- (
- VariableDefinition->NvRamMap[Tag->StorageStart] +
- (VariableDefinition->NvRamMap[Tag->StorageStart + 1] * 0x100)
- );
- CopyMem (&Tag->Value, &Index, sizeof (UINT16));
- }
- } else {
- Index = 0;
- CopyMem (&Tag->Value, &Index, sizeof (UINT16));
- }
- break;
- }
- }
-}
-
-VOID
-GetNumericHeader (
- IN EFI_TAG *Tag,
- IN UINT8 *RawFormSet,
- IN UINT16 Index,
- IN UINT16 NumberOfLines,
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UINT16 CurrentVariable
- )
-/*++
-
-Routine Description:
- Initialize numeric tag's members.
-
-Arguments:
- Tag - Pointer of the current EFI_TAG structure.
- RawFormSet - Pointer of the formset raw data.
- Index - Offset of the current opcode in the Ifr raw data.
- NumberOfLines - Number of lines this opcode occupied.
- FileFormTags - Pointer of current EFI_FILE_FORM_TAGS structure.
- CurrentVariable - Current variable number.
-
-Returns:
- None.
---*/
-{
- EFI_VARIABLE_DEFINITION *VariableDefinition;
-
- Tag->NumberOfLines = NumberOfLines;
- Tag->VariableNumber = CurrentVariable;
- CopyMem (&Tag->Id, &((EFI_IFR_ONE_OF *) &RawFormSet[Index])->QuestionId, sizeof (UINT16));
- CopyMem (&Tag->StorageStart, &((EFI_IFR_ONE_OF *) &RawFormSet[Index])->QuestionId, sizeof (UINT16));
- CopyMem (&Tag->StorageWidth, &((EFI_IFR_ONE_OF *) &RawFormSet[Index])->Width, sizeof (UINT8));
- CopyMem (&Tag->Text, &((EFI_IFR_ONE_OF *) &RawFormSet[Index])->Prompt, sizeof (UINT16));
- CopyMem (&Tag->Help, &((EFI_IFR_ONE_OF *) &RawFormSet[Index])->Help, sizeof (UINT16));
- CopyMem (&Tag->Minimum, &((EFI_IFR_NUMERIC *) &RawFormSet[Index])->Minimum, sizeof (UINT16));
- CopyMem (&Tag->Maximum, &((EFI_IFR_NUMERIC *) &RawFormSet[Index])->Maximum, sizeof (UINT16));
- CopyMem (&Tag->Step, &((EFI_IFR_NUMERIC *) &RawFormSet[Index])->Step, sizeof (UINT16));
- CopyMem (&Tag->Default, &((EFI_IFR_NUMERIC *) &RawFormSet[Index])->Default, sizeof (UINT16));
- Tag->ResetRequired = (BOOLEAN) (((EFI_IFR_NUMERIC *) &RawFormSet[Index])->Flags & EFI_IFR_FLAG_RESET_REQUIRED);
-
- VariableDefinition = FileFormTags->VariableDefinitions;
-
- for (; VariableDefinition != NULL; VariableDefinition = VariableDefinition->Next) {
- //
- // Have we found the correct variable for the request?
- //
- if (CurrentVariable == VariableDefinition->VariableId) {
- if (VariableDefinition->VariableSize <= (UINTN) (Tag->StorageStart + Tag->StorageWidth)) {
- if (Tag->StorageWidth == 0) {
- VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize + 2);
- } else {
- VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize + Tag->StorageWidth);
- }
- }
-
- if (VariableDefinition->NvRamMap != NULL) {
- //
- // If it is an 8bit or 16bit width, then move it to Tag->Value, otherwise
- // we will never be looking for the data in Tag->Value (e.g. strings, password, etc)
- //
- if (Tag->StorageWidth == (UINT16) 1) {
- CopyMem (&Tag->Value, &VariableDefinition->NvRamMap[Tag->StorageStart], sizeof (UINT16));
- }
-
- if (Tag->StorageWidth == (UINT16) 2) {
- Index = (UINT16)
- (
- VariableDefinition->NvRamMap[Tag->StorageStart] +
- (VariableDefinition->NvRamMap[Tag->StorageStart + 1] * 0x100)
- );
- CopyMem (&Tag->Value, &Index, sizeof (UINT16));
- }
- } else {
- CopyMem (&Tag->Value, &Tag->Default, sizeof (UINT16));
- }
- break;
- }
- }
-}
-
-VOID
-GetTagCount (
- IN UINT8 *RawFormSet,
- IN OUT UINT16 *NumberOfTags
- )
-{
- UINT16 Index;
-
- //
- // Assume on entry we are pointing to an OpCode - reasonably this should
- // be a FormOp since the purpose is to count the tags in a particular Form.
- //
- for (Index = 0; RawFormSet[Index] != EFI_IFR_END_FORM_OP;) {
- //
- // If we encounter the end of a form set, bail out
- //
- if (RawFormSet[Index] == EFI_IFR_END_FORM_SET_OP) {
- break;
- }
- //
- // We treat date/time internally as three op-codes
- //
- if (RawFormSet[Index] == EFI_IFR_DATE_OP || RawFormSet[Index] == EFI_IFR_TIME_OP) {
- *NumberOfTags = (UINT16) (*NumberOfTags + 3);
- } else {
- //
- // Assume that we could have no more tags than op-codes
- //
- (*NumberOfTags)++;
- }
-
- Index = (UINT16) (Index + RawFormSet[Index + 1]);
- }
- //
- // Increase the tag count by one so it is inclusive of the end_form_op
- //
- (*NumberOfTags)++;
-}
-
-STATIC
-VOID
-AddNextInconsistentTag (
- IN OUT EFI_INCONSISTENCY_DATA **InconsistentTagsPtr
- )
-/*++
-
-Routine Description:
- Initialize the next inconsistent tag data and add it to the inconsistent tag list.
-
-Arguments:
- InconsistentTagsPtr - Pointer of the inconsistent tag's pointer.
-
-Returns:
- None.
-
---*/
-{
- EFI_INCONSISTENCY_DATA *PreviousInconsistentTags;
- EFI_INCONSISTENCY_DATA *InconsistentTags;
-
- InconsistentTags = *InconsistentTagsPtr;
- //
- // We just hit the end of an inconsistent expression. Let's allocate the ->Next structure
- //
- InconsistentTags->Next = AllocatePool (sizeof (EFI_INCONSISTENCY_DATA));
- ASSERT (InconsistentTags->Next != NULL);
-
- //
- // Preserve current Tag entry
- //
- PreviousInconsistentTags = InconsistentTags;
-
- InconsistentTags = InconsistentTags->Next;
-
- //
- // This will zero on the entry including the ->Next so I don't have to do it
- //
- ZeroMem (InconsistentTags, sizeof (EFI_INCONSISTENCY_DATA));
-
- //
- // Point our Previous field to the previous entry
- //
- InconsistentTags->Previous = PreviousInconsistentTags;
-
- *InconsistentTagsPtr = InconsistentTags;
-
- return ;
-}
-
-STATIC
-EFI_STATUS
-InitializeTagStructures (
- IN EFI_IFR_BINARY *BinaryData,
- OUT EFI_FILE_FORM_TAGS *FileFormTags
- )
-{
- EFI_STATUS Status;
- UINT8 *RawFormSet;
- UINT16 Index;
- UINT16 QuestionIndex;
- UINT16 NumberOfTags;
- INT16 CurrTag;
- UINT8 TagLength;
- EFI_FORM_TAGS *FormTags;
- EFI_FORM_TAGS *SavedFormTags;
- EFI_INCONSISTENCY_DATA *InconsistentTags;
- EFI_VARIABLE_DEFINITION *VariableDefinitions;
- UINTN Count;
- UINT16 Class;
- UINT16 SubClass;
- UINT16 TempValue;
- UINT16 CurrentVariable;
- UINT16 CurrentVariable2;
-
- //
- // Initialize some Index variable and Status
- //
- Count = 0;
- Class = 0;
- SubClass = 0;
- CurrentVariable = 0;
- CurrentVariable2 = 0;
- QuestionIndex = 0;
- NumberOfTags = 1;
- Status = EFI_SUCCESS;
- FormTags = &FileFormTags->FormTags;
- FormTags->Next = NULL;
- if (FileFormTags->InconsistentTags == NULL) {
- InconsistentTags = NULL;
- } else {
- InconsistentTags = FileFormTags->InconsistentTags;
- }
-
- if (FileFormTags->VariableDefinitions == NULL) {
- VariableDefinitions = NULL;
- } else {
- VariableDefinitions = FileFormTags->VariableDefinitions;
- }
- //
- // RawFormSet now points to the beginning of the forms portion of
- // the specific IFR Binary.
- //
- RawFormSet = (UINT8 *) BinaryData->FormBinary;
-
- //
- // Determine the number of tags for the first form
- //
- GetTagCount (&RawFormSet[0], &NumberOfTags);
-
- SavedFormTags = FormTags;
-
- if (FormTags->Tags != NULL) {
- do {
- //
- // Advance FormTags to the last entry
- //
- for (; FormTags->Next != NULL; FormTags = FormTags->Next)
- ;
-
- //
- // Walk through each of the tags and free the IntList allocation
- //
- for (Index = 0; Index < NumberOfTags; Index++) {
- if (FormTags->Tags[Index].IntList != NULL) {
- FreePool (FormTags->Tags[Index].IntList);
- }
- }
-
- FreePool (FormTags->Tags);
-
- ASSERT (FormTags->Next == NULL);
-
- FormTags->Tags = NULL;
-
- FormTags = SavedFormTags;
-
- } while (FormTags->Next != NULL);
- }
-
- Index = 0;
-
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (FormTags->Tags == NULL) {
- //
- // Allocate memory for our tags on the first form
- //
- FormTags->Tags = AllocateZeroPool (NumberOfTags * sizeof (EFI_TAG));
- ASSERT (FormTags->Tags);
- }
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (InconsistentTags == NULL) {
- //
- // We just hit the end of an inconsistent expression. Let's allocate the ->Next structure
- //
- InconsistentTags = AllocateZeroPool (sizeof (EFI_INCONSISTENCY_DATA));
- ASSERT (InconsistentTags != NULL);
-
- FileFormTags->InconsistentTags = InconsistentTags;
- }
-
- ZeroMem (FormTags->Tags, NumberOfTags * sizeof (EFI_TAG));
-
- for (CurrTag = 0; RawFormSet[Index] != EFI_IFR_END_FORM_SET_OP; CurrTag++) {
- //
- // Operand = IFR OpCode
- //
- FormTags->Tags[CurrTag].Operand = RawFormSet[Index];
-
- //
- // Assume for now 0 lines occupied by this OpCode
- //
- FormTags->Tags[CurrTag].NumberOfLines = 0;
-
- FormTags->Tags[CurrTag].Class = Class;
- FormTags->Tags[CurrTag].SubClass = SubClass;
-
- //
- // Determine the length of the Tag so we can later skip to the next tag in the form
- //
- TagLength = RawFormSet[Index + 1];
- //
- // get the length
- //
- // Operate on the Found OpCode
- //
- switch (RawFormSet[Index]) {
-
- case EFI_IFR_FORM_OP:
- //
- // If there was no variable op-code defined, create a dummy entry for one
- //
- if (FileFormTags->VariableDefinitions == NULL) {
- FileFormTags->VariableDefinitions = AllocateZeroPool (sizeof (EFI_VARIABLE_DEFINITION));
- ASSERT (FileFormTags->VariableDefinitions != NULL);
- IfrToFormTag (
- RawFormSet[Index],
- &FormTags->Tags[CurrTag],
- (VOID *) &RawFormSet[Index],
- FileFormTags->VariableDefinitions
- );
- } else {
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
- }
- break;
-
- case EFI_IFR_SUBTITLE_OP:
- case EFI_IFR_TEXT_OP:
- case EFI_IFR_REF_OP:
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
- break;
-
- case EFI_IFR_VARSTORE_OP:
- if (FileFormTags->VariableDefinitions == NULL) {
- VariableDefinitions = AllocateZeroPool (sizeof (EFI_VARIABLE_DEFINITION));
- ASSERT (VariableDefinitions != NULL);
- FileFormTags->VariableDefinitions = VariableDefinitions;
- }
-
- IfrToFormTag (
- RawFormSet[Index],
- &FormTags->Tags[CurrTag],
- (VOID *) &RawFormSet[Index],
- FileFormTags->VariableDefinitions
- );
- break;
-
- case EFI_IFR_VARSTORE_SELECT_OP:
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
- CopyMem (&CurrentVariable, &((EFI_IFR_VARSTORE_SELECT *) &RawFormSet[Index])->VarId, sizeof (UINT16));
- CurrentVariable2 = CurrentVariable;
- break;
-
- case EFI_IFR_VARSTORE_SELECT_PAIR_OP:
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
- CopyMem(&CurrentVariable, &((EFI_IFR_VARSTORE_SELECT_PAIR *)&RawFormSet[Index])->VarId, sizeof (UINT16));
- CopyMem (
- &CurrentVariable2,
- &((EFI_IFR_VARSTORE_SELECT_PAIR *) &RawFormSet[Index])->SecondaryVarId,
- sizeof (UINT16)
- );
- break;
-
- case EFI_IFR_END_FORM_OP:
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (FormTags->Next == NULL) {
- //
- // We just hit the end of a form. Let's allocate the ->Next structure
- //
- FormTags->Next = AllocatePool (sizeof (EFI_FORM_TAGS));
- ASSERT (FormTags->Next);
- }
-
- FormTags = FormTags->Next;
- ZeroMem (FormTags, sizeof (EFI_FORM_TAGS));
-
- //
- // Reset the tag count to one
- //
- NumberOfTags = 1;
-
- //
- // Reset the CurrTag value (it will be incremented, after this case statement
- // so set to a negative one so that we get the desired effect.) Fish can beat me later.
- //
- CurrTag = -1;
-
- //
- // Determine the number of tags after this form. If this is the last
- // form, then we will count the endformset and preserve that information
- // in the tag structure.
- //
- GetTagCount (&RawFormSet[Index + TagLength], &NumberOfTags);
-
- //
- // Allocate memory for our tags
- //
- FormTags->Tags = AllocateZeroPool (NumberOfTags * sizeof (EFI_TAG));
- ASSERT (FormTags->Tags);
- break;
-
- //
- // Two types of tags constitute the One Of question: a one-of header and
- // several one-of options.
- //
- case EFI_IFR_ONE_OF_OP:
- case EFI_IFR_ORDERED_LIST_OP:
- GetQuestionHeader (&FormTags->Tags[CurrTag], RawFormSet, Index, FileFormTags, CurrentVariable);
-
- //
- // Store away the CurrTag since what follows will be the answer that we
- // need to place into the appropriate location in the tag array
- //
- //
- // record for setting default later
- //
- QuestionIndex = (UINT16) CurrTag;
- break;
-
- case EFI_IFR_ONE_OF_OPTION_OP:
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
- FormTags->Tags[QuestionIndex].Flags = ((EFI_IFR_ONE_OF_OPTION *) &RawFormSet[Index])->Flags;
- CopyMem (
- &FormTags->Tags[QuestionIndex].Key,
- &((EFI_IFR_ONE_OF_OPTION *) &RawFormSet[Index])->Key,
- sizeof (UINT16)
- );
- FormTags->Tags[QuestionIndex].ResetRequired = (BOOLEAN) (FormTags->Tags[QuestionIndex].Flags & EFI_IFR_FLAG_RESET_REQUIRED);
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- GetQuestionHeader (&FormTags->Tags[CurrTag], RawFormSet, Index, FileFormTags, CurrentVariable);
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
- break;
-
- case EFI_IFR_NUMERIC_OP:
- GetNumericHeader (&FormTags->Tags[CurrTag], RawFormSet, Index, (UINT16) 1, FileFormTags, CurrentVariable);
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
- break;
-
- case EFI_IFR_DATE_OP:
- //
- // Date elements come in as a Year, Month, Day. We need to process them as a country-based
- // Order. It is much easier to do it here than anywhere else.
- //
- // For US standards - we want Month/Day/Year, thus we advance "Index" +1, +2, +0 while CurrTag is +0, +1, +2
- //
- GetNumericHeader (
- &FormTags->Tags[CurrTag],
- RawFormSet,
- (UINT16) (Index + TagLength),
- (UINT16) 0,
- FileFormTags,
- CurrentVariable
- );
-
- //
- // The current language selected + the Date operand
- //
- FormTags->Tags[CurrTag + 1].Operand = RawFormSet[Index];
- GetNumericHeader (
- &FormTags->Tags[CurrTag + 1],
- RawFormSet,
- (UINT16) (Index + TagLength + RawFormSet[Index + TagLength + 1]),
- (UINT16) 0,
- FileFormTags,
- CurrentVariable
- );
-
- //
- // The current language selected + the Date operand
- //
- FormTags->Tags[CurrTag + 2].Operand = RawFormSet[Index];
- GetNumericHeader (&FormTags->Tags[CurrTag + 2], RawFormSet, Index, (UINT16) 1, FileFormTags, CurrentVariable);
-
- CurrTag = (INT16) (CurrTag + 2);
-
- Index = (UINT16) (Index + TagLength);
- //
- // get the length
- //
- TagLength = RawFormSet[Index + 1];
- Index = (UINT16) (Index + TagLength);
- //
- // get the length
- //
- TagLength = RawFormSet[Index + 1];
- break;
-
- case EFI_IFR_TIME_OP:
- GetNumericHeader (&FormTags->Tags[CurrTag], RawFormSet, Index, (UINT16) 0, FileFormTags, CurrentVariable);
-
- if (Count == 2) {
- //
- // Override the GetQuestionHeader information - date/time are treated very differently
- //
- FormTags->Tags[CurrTag].NumberOfLines = 1;
- Count = 0;
- } else {
- //
- // The premise is that every date/time op-code have 3 elements, the first 2 have 0 lines
- // associated with them, and the third has 1 line to allow to space beyond the choice.
- //
- Count++;
- }
- break;
-
- case EFI_IFR_PASSWORD_OP:
- case EFI_IFR_STRING_OP:
- GetQuestionHeader (&FormTags->Tags[CurrTag], RawFormSet, Index, FileFormTags, CurrentVariable);
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
- break;
-
- case EFI_IFR_SUPPRESS_IF_OP:
- case EFI_IFR_GRAYOUT_IF_OP:
- InconsistentTags->Operand = ((EFI_IFR_INCONSISTENT *) &RawFormSet[Index])->Header.OpCode;
- gConsistencyId++;
-
- //
- // Since this op-code doesn't use the next field(s), initialize them with something invalid.
- // Unfortunately 0 is a valid offset value for a QuestionId
- //
- InconsistentTags->QuestionId1 = INVALID_OFFSET_VALUE;
- InconsistentTags->QuestionId2 = INVALID_OFFSET_VALUE;
-
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (InconsistentTags->Next == NULL) {
- AddNextInconsistentTag (&InconsistentTags);
- break;
- }
-
- InconsistentTags = InconsistentTags->Next;
- break;
-
- case EFI_IFR_FORM_SET_OP:
- CopyMem (
- &FormTags->Tags[CurrTag].GuidValue,
- &((EFI_IFR_FORM_SET *) &RawFormSet[Index])->Guid,
- sizeof (EFI_GUID)
- );
- CopyMem (
- &FormTags->Tags[CurrTag].CallbackHandle,
- &((EFI_IFR_FORM_SET *) &RawFormSet[Index])->CallbackHandle,
- sizeof (EFI_PHYSICAL_ADDRESS)
- );
- CopyMem (&FormTags->Tags[CurrTag].Class, &((EFI_IFR_FORM_SET *) &RawFormSet[Index])->Class, sizeof (UINT8));
- CopyMem (
- &FormTags->Tags[CurrTag].SubClass,
- &((EFI_IFR_FORM_SET *) &RawFormSet[Index])->SubClass,
- sizeof (UINT8)
- );
- CopyMem (
- &FormTags->Tags[CurrTag].NvDataSize,
- &((EFI_IFR_FORM_SET *) &RawFormSet[Index])->NvDataSize,
- sizeof (UINT16)
- );
- Class = ((EFI_IFR_FORM_SET *) &RawFormSet[Index])->Class;
- SubClass = ((EFI_IFR_FORM_SET *) &RawFormSet[Index])->SubClass;
- //
- // If the formset has a size value, that means someone must be using this, so create a variable
- // We also shall reserve the formid of 0 for this specific purpose.
- //
- if ((FileFormTags->VariableDefinitions == NULL) && (FormTags->Tags[CurrTag].NvDataSize > 0)) {
- FileFormTags->VariableDefinitions = AllocateZeroPool (sizeof (EFI_VARIABLE_DEFINITION));
- ASSERT (FileFormTags->VariableDefinitions != NULL);
- IfrToFormTag (
- RawFormSet[Index],
- &FormTags->Tags[CurrTag],
- (VOID *) &RawFormSet[Index],
- FileFormTags->VariableDefinitions
- );
- } else {
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
- }
- break;
-
- case EFI_IFR_BANNER_OP:
- if (gClassOfVfr == EFI_FRONT_PAGE_SUBCLASS) {
- TempValue = 0;
- CopyMem (&TempValue, &((EFI_IFR_BANNER *) &RawFormSet[Index])->Alignment, sizeof (UINT8));
- //
- // If this is the special timeout value, we will dynamically figure out where to put it
- // Also the least significant byte refers to the TimeOut desired.
- //
- if (TempValue == EFI_IFR_BANNER_TIMEOUT) {
- CopyMem (&FrontPageTimeOutTitle, &((EFI_IFR_BANNER *) &RawFormSet[Index])->Title, sizeof (UINT16));
- if (FrontPageTimeOutValue != (INT16) -1) {
- CopyMem (&FrontPageTimeOutValue, &((EFI_IFR_BANNER *) &RawFormSet[Index])->LineNumber, sizeof (UINT16));
- }
- break;
- }
-
- CopyMem (
- &BannerData->Banner[((EFI_IFR_BANNER *) &RawFormSet[Index])->LineNumber][
- ((EFI_IFR_BANNER *) &RawFormSet[Index])->Alignment],
- &((EFI_IFR_BANNER *) &RawFormSet[Index])->Title,
- sizeof (STRING_REF)
- );
- }
- break;
-
- case EFI_IFR_INCONSISTENT_IF_OP:
- CopyMem (
- &FormTags->Tags[CurrTag].Text,
- &((EFI_IFR_INCONSISTENT *) &RawFormSet[Index])->Popup,
- sizeof (UINT16)
- );
- gConsistencyId++;
-
- InconsistentTags->Operand = ((EFI_IFR_INCONSISTENT *) &RawFormSet[Index])->Header.OpCode;
- CopyMem (&InconsistentTags->Popup, &((EFI_IFR_INCONSISTENT *) &RawFormSet[Index])->Popup, sizeof (UINT16));
-
- //
- // Since this op-code doesn't use the next field(s), initialize them with something invalid.
- // Unfortunately 0 is a valid offset value for a QuestionId
- //
- InconsistentTags->QuestionId1 = INVALID_OFFSET_VALUE;
- InconsistentTags->QuestionId2 = INVALID_OFFSET_VALUE;
-
- InconsistentTags->VariableNumber = CurrentVariable;
-
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (InconsistentTags->Next == NULL) {
- AddNextInconsistentTag (&InconsistentTags);
- break;
- }
-
- InconsistentTags = InconsistentTags->Next;
- break;
-
- case EFI_IFR_EQ_ID_VAL_OP:
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
-
- InconsistentTags->Operand = ((EFI_IFR_EQ_ID_VAL *) &RawFormSet[Index])->Header.OpCode;
- CopyMem (&InconsistentTags->Value, &((EFI_IFR_EQ_ID_VAL *) &RawFormSet[Index])->Value, sizeof (UINT16));
- CopyMem (
- &InconsistentTags->QuestionId1,
- &((EFI_IFR_EQ_ID_VAL *) &RawFormSet[Index])->QuestionId,
- sizeof (UINT16)
- );
-
- //
- // Since this op-code doesn't use the next field(s), initialize them with something invalid.
- // Unfortunately 0 is a valid offset value for a QuestionId
- //
- InconsistentTags->Width = FormTags->Tags[CurrTag].StorageWidth;
- InconsistentTags->QuestionId2 = INVALID_OFFSET_VALUE;
- InconsistentTags->ConsistencyId = gConsistencyId;
- FormTags->Tags[CurrTag].ConsistencyId = gConsistencyId;
-
- InconsistentTags->VariableNumber = CurrentVariable;
-
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (InconsistentTags->Next == NULL) {
- AddNextInconsistentTag (&InconsistentTags);
- break;
- }
-
- InconsistentTags = InconsistentTags->Next;
- break;
-
- case EFI_IFR_EQ_VAR_VAL_OP:
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
-
- InconsistentTags->Operand = ((EFI_IFR_EQ_VAR_VAL *) &RawFormSet[Index])->Header.OpCode;
- CopyMem (&InconsistentTags->Value, &((EFI_IFR_EQ_VAR_VAL *) &RawFormSet[Index])->Value, sizeof (UINT16));
- CopyMem (
- &InconsistentTags->QuestionId1,
- &((EFI_IFR_EQ_VAR_VAL *) &RawFormSet[Index])->VariableId,
- sizeof (UINT16)
- );
-
- //
- // Since this op-code doesn't use the next field(s), initialize them with something invalid.
- // Unfortunately 0 is a valid offset value for a QuestionId
- //
- InconsistentTags->QuestionId2 = INVALID_OFFSET_VALUE;
- InconsistentTags->ConsistencyId = gConsistencyId;
- FormTags->Tags[CurrTag].ConsistencyId = gConsistencyId;
-
- InconsistentTags->VariableNumber = CurrentVariable;
-
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (InconsistentTags->Next == NULL) {
- AddNextInconsistentTag (&InconsistentTags);
- break;
- }
-
- InconsistentTags = InconsistentTags->Next;
- break;
-
- case EFI_IFR_EQ_ID_ID_OP:
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
-
- InconsistentTags->Operand = ((EFI_IFR_EQ_ID_ID *) &RawFormSet[Index])->Header.OpCode;
- CopyMem (
- &InconsistentTags->QuestionId1,
- &((EFI_IFR_EQ_ID_ID *) &RawFormSet[Index])->QuestionId1,
- sizeof (UINT16)
- );
- CopyMem (
- &InconsistentTags->QuestionId2,
- &((EFI_IFR_EQ_ID_ID *) &RawFormSet[Index])->QuestionId2,
- sizeof (UINT16)
- );
-
- InconsistentTags->Width = FormTags->Tags[CurrTag].StorageWidth;
- InconsistentTags->ConsistencyId = gConsistencyId;
- FormTags->Tags[CurrTag].ConsistencyId = gConsistencyId;
-
- InconsistentTags->VariableNumber = CurrentVariable;
- InconsistentTags->VariableNumber2 = CurrentVariable2;
-
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (InconsistentTags->Next == NULL) {
- AddNextInconsistentTag (&InconsistentTags);
- break;
- }
-
- InconsistentTags = InconsistentTags->Next;
- break;
-
- case EFI_IFR_AND_OP:
- case EFI_IFR_OR_OP:
- case EFI_IFR_NOT_OP:
- case EFI_IFR_GT_OP:
- case EFI_IFR_GE_OP:
- case EFI_IFR_TRUE_OP:
- case EFI_IFR_FALSE_OP:
- InconsistentTags->Operand = ((EFI_IFR_NOT *) &RawFormSet[Index])->Header.OpCode;
-
- //
- // Since this op-code doesn't use the next field(s), initialize them with something invalid.
- // Unfortunately 0 is a valid offset value for a QuestionId
- //
-
- //
- // Reserve INVALID_OFFSET_VALUE - 1 for TRUE or FALSE because they are inconsistency tags also, but
- // have no coresponding id. The examination of id is needed by evaluating boolean expression.
- //
- if (RawFormSet[Index] == EFI_IFR_TRUE_OP ||
- RawFormSet[Index] == EFI_IFR_FALSE_OP) {
- InconsistentTags->QuestionId1 = INVALID_OFFSET_VALUE - 1;
- } else {
- InconsistentTags->QuestionId1 = INVALID_OFFSET_VALUE;
- }
- InconsistentTags->QuestionId2 = INVALID_OFFSET_VALUE;
- InconsistentTags->ConsistencyId = gConsistencyId;
- FormTags->Tags[CurrTag].ConsistencyId = gConsistencyId;
-
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (InconsistentTags->Next == NULL) {
- AddNextInconsistentTag (&InconsistentTags);
- break;
- }
-
- InconsistentTags = InconsistentTags->Next;
- break;
-
- case EFI_IFR_EQ_ID_LIST_OP:
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
-
- InconsistentTags->Operand = ((EFI_IFR_EQ_ID_LIST *) &RawFormSet[Index])->Header.OpCode;
- CopyMem (
- &InconsistentTags->QuestionId1,
- &((EFI_IFR_EQ_ID_LIST *) &RawFormSet[Index])->QuestionId,
- sizeof (UINT16)
- );
- CopyMem (
- &InconsistentTags->ListLength,
- &((EFI_IFR_EQ_ID_LIST *) &RawFormSet[Index])->ListLength,
- sizeof (UINT16)
- );
- InconsistentTags->ValueList = FormTags->Tags[CurrTag].IntList;
-
- //
- // Since this op-code doesn't use the next field(s), initialize them with something invalid.
- // Unfortunately 0 is a valid offset value for a QuestionId
- //
- InconsistentTags->Width = FormTags->Tags[CurrTag].StorageWidth;
- InconsistentTags->QuestionId2 = INVALID_OFFSET_VALUE;
- InconsistentTags->ConsistencyId = gConsistencyId;
- FormTags->Tags[CurrTag].ConsistencyId = gConsistencyId;
-
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (InconsistentTags->Next == NULL) {
- AddNextInconsistentTag (&InconsistentTags);
- break;
- }
-
- InconsistentTags = InconsistentTags->Next;
- break;
-
- case EFI_IFR_END_IF_OP:
- InconsistentTags->Operand = ((EFI_IFR_END_EXPR *) &RawFormSet[Index])->Header.OpCode;
-
- //
- // Since this op-code doesn't use the next field(s), initialize them with something invalid.
- // Unfortunately 0 is a valid offset value for a QuestionId
- //
- InconsistentTags->QuestionId1 = INVALID_OFFSET_VALUE;
- InconsistentTags->QuestionId2 = INVALID_OFFSET_VALUE;
-
- //
- // Test for an allocated buffer. If already allocated this is due to having called this routine
- // once for sizing of the NV storage. We then loaded the NV variable and can correctly initialize
- // the tag structure with current values from the NV
- //
- if (InconsistentTags->Next == NULL) {
- AddNextInconsistentTag (&InconsistentTags);
- break;
- }
-
- InconsistentTags = InconsistentTags->Next;
- break;
-
- case EFI_IFR_END_ONE_OF_OP:
- break;
-
- default:
- break;
- }
- //
- // End of switch
- //
- // Per spec., we ignore ops that we don't know how to deal with. Skip to next tag
- //
- Index = (UINT16) (Index + TagLength);
- }
- //
- // End of Index
- //
- // When we eventually exit, make sure we mark the last tag with an op-code
- //
- FormTags->Tags[CurrTag].Operand = RawFormSet[Index];
-
- IfrToFormTag (RawFormSet[Index], &FormTags->Tags[CurrTag], (VOID *) &RawFormSet[Index], NULL);
-
- //
- // Place this as an end of the database marker
- //
- InconsistentTags->Operand = 0xFF;
-
- //
- // This is the Head of the linked list of pages. Each page is an array of tags
- //
- FormTags = &FileFormTags->FormTags;
- InconsistentTags = FileFormTags->InconsistentTags;
-
- for (; InconsistentTags->Operand != 0xFF;) {
- if (InconsistentTags->QuestionId1 != INVALID_OFFSET_VALUE) {
- //
- // Search the tags for the tag which corresponds to this ID
- //
- for (CurrTag = 0; FormTags->Tags[0].Operand != EFI_IFR_END_FORM_SET_OP; CurrTag++) {
- //
- // If we hit the end of a form, go to the next set of Tags.
- // Remember - EndFormSet op-codes sit on their own page after an end form.
- //
- if (FormTags->Tags[CurrTag].Operand == EFI_IFR_END_FORM_OP) {
- //
- // Reset the CurrTag value (it will be incremented, after this case statement
- // so set to a negative one so that we get the desired effect.) Fish can beat me later.
- //
- CurrTag = -1;
- FormTags = FormTags->Next;
- continue;
- }
-
- if (FormTags->Tags[CurrTag].Id == InconsistentTags->QuestionId1) {
- FormTags->Tags[CurrTag].Consistency++;
- }
- }
- }
-
- FormTags = &FileFormTags->FormTags;
-
- if (InconsistentTags->QuestionId2 != INVALID_OFFSET_VALUE) {
- //
- // Search the tags for the tag which corresponds to this ID
- //
- for (CurrTag = 0; FormTags->Tags[CurrTag].Operand != EFI_IFR_END_FORM_SET_OP; CurrTag++) {
- //
- // If we hit the end of a form, go to the next set of Tags.
- // Remember - EndFormSet op-codes sit on their own page after an end form.
- //
- if (FormTags->Tags[CurrTag].Operand == EFI_IFR_END_FORM_OP) {
- //
- // Reset the CurrTag value (it will be incremented, after this case statement
- // so set to a negative one so that we get the desired effect.) Fish can beat me later.
- //
- CurrTag = -1;
- FormTags = FormTags->Next;
- continue;
- }
-
- if (FormTags->Tags[CurrTag].Id == InconsistentTags->QuestionId2) {
- FormTags->Tags[CurrTag].Consistency++;
- }
- }
- }
-
- InconsistentTags = InconsistentTags->Next;
- }
-
- return Status;
-}
-
-VOID
-InitPage (
- VOID
- )
-{
- CHAR16 *HomePageString;
- CHAR16 *HomeEscapeString;
-
- //
- // Displays the Header and Footer borders
- //
- DisplayPageFrame ();
-
- HomePageString = GetToken (STRING_TOKEN (HOME_PAGE_TITLE), gHiiHandle);
- HomeEscapeString = GetToken (STRING_TOKEN (HOME_ESCAPE_STRING), gHiiHandle);
-
- gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
- //
- // PrintStringAt ((gScreenDimensions.RightColumn - GetStringWidth(HomePageString)/2)/2, 1, HomePageString);
- //
- PrintStringAt (
- (gScreenDimensions.RightColumn + gScreenDimensions.LeftColumn - GetStringWidth (HomePageString) / 2) / 2,
- 1,
- HomePageString
- );
- PrintAt (
- gScreenDimensions.LeftColumn + 2,
- gScreenDimensions.BottomRow - 3,
- (CHAR16 *) L"%c%c%s",
- ARROW_UP,
- ARROW_DOWN,
- gMoveHighlight
- );
- PrintAt (
- gScreenDimensions.RightColumn - (GetStringWidth (HomeEscapeString) / 2) - 2,
- gScreenDimensions.BottomRow - 3,
- (CHAR16 *) L" %s",
- HomeEscapeString
- );
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- FreePool (HomeEscapeString);
- FreePool (HomePageString);
-
- return ;
-}
-
-CHAR16 *
-GetToken (
- IN STRING_REF Token,
- IN EFI_HII_HANDLE HiiHandle
- )
-/*++
-
-Routine Description:
-
- Get the string based on the TokenID and HII Handle.
-
-Arguments:
-
- Token - The Token ID.
- HiiHandle - Handle of Ifr to be fetched.
-
-Returns:
-
- The output string.
-
---*/
-{
- CHAR16 *Buffer;
- UINTN BufferLength;
- EFI_STATUS Status;
-
- //
- // Set default string size assumption at no more than 256 bytes
- //
- BufferLength = 0x100;
-
- Buffer = AllocateZeroPool (BufferLength);
- ASSERT (Buffer != NULL);
-
- Status = Hii->GetString (Hii, HiiHandle, Token, TRUE, NULL, &BufferLength, Buffer);
-
- if (EFI_ERROR (Status)) {
- if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // Free the old pool
- //
- FreePool (Buffer);
-
- //
- // Allocate new pool with correct value
- //
- Buffer = AllocatePool (BufferLength);
- ASSERT (Buffer != NULL);
-
- Status = Hii->GetString (Hii, HiiHandle, Token, TRUE, NULL, &BufferLength, Buffer);
-
- if (!EFI_ERROR (Status)) {
- return Buffer;
- }
- }
-
- ASSERT_EFI_ERROR (Status);
- }
-
- return Buffer;
-}
-
-STATIC
-EFI_STATUS
-PopulateHomePage (
- IN UINTN NumberOfIfrImages,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead
- )
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_IFR_BINARY *IfrBinary;
- CHAR16 *StringPtr;
- EFI_FILE_FORM_TAGS *FileFormTags;
- EFI_FORM_TAGS LocalTags;
-
- FileFormTags = FileFormTagsHead;
-
- UiInitMenu ();
-
- Status = EFI_SUCCESS;
-
- //
- // If there are no images
- //
- if (NumberOfIfrImages == 0) {
- Status = EFI_NO_MEDIA;
- return Status;
- }
- //
- // IfrBinary points to the beginning of the Binary data linked-list
- //
- IfrBinary = gBinaryDataHead;
-
- //
- // Print the entries which were in the default language.
- //
- for (Index = 0; Index < NumberOfIfrImages; Index++) {
- LocalTags = FileFormTags->FormTags;
-
- //
- // Populate the Menu
- //
- StringPtr = GetToken (IfrBinary->TitleToken, IfrBinary->Handle);
-
- //
- // If the default language doesn't exist, don't add a menu option yet
- //
- if (StringPtr[0] != CHAR_NULL) {
- //
- // We are NOT!! removing this StringPtr buffer via FreePool since it is being used in the menuoptions, we will do
- // it in UiFreeMenu.
- //
- UiAddMenuOption (StringPtr, IfrBinary->Handle, LocalTags.Tags, IfrBinary->FormBinary, Index);
- }
- //
- // Advance to the next HII handle
- //
- IfrBinary = IfrBinary->Next;
- FileFormTags = FileFormTags->NextFile;
- }
-
- return Status;
-}
-
-STATIC
-UI_MENU_OPTION *
-DisplayHomePage (
- IN UINTN NumberOfIfrImages,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN UINT8 *CallbackData
- )
-{
- EFI_STATUS Status;
- UI_MENU_OPTION *Selection;
-
- //
- // This prints the basic home page template which the user sees
- //
- InitPage ();
-
- Status = PopulateHomePage (NumberOfIfrImages, FileFormTagsHead);
-
- if (EFI_ERROR (Status)) {
- Selection = NULL;
- return Selection;
- }
-
- Selection = UiDisplayMenu (FALSE, FileFormTagsHead, (EFI_IFR_DATA_ARRAY *) CallbackData);
-
- return Selection;
-}
-
-STATIC
-EFI_STATUS
-InitializeBinaryStructures (
- IN EFI_HII_HANDLE *Handle,
- IN BOOLEAN UseDatabase,
- IN EFI_IFR_PACKET *Packet,
- IN UINT8 *NvMapOverride,
- IN UINTN NumberOfIfrImages,
- OUT EFI_FILE_FORM_TAGS **FileFormTagsHead
- )
-{
- UINTN HandleIndex;
- EFI_STATUS Status;
- EFI_IFR_BINARY *BinaryData;
- EFI_FILE_FORM_TAGS *FileFormTags;
- UINTN SizeOfNvStore;
- EFI_FORM_CALLBACK_PROTOCOL *FormCallback;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
- EFI_VARIABLE_DEFINITION *OverrideDefinition;
- VOID *NvMap;
- UINTN NvMapSize;
- EFI_HII_VARIABLE_PACK_LIST *NvMapListHead;
- EFI_HII_VARIABLE_PACK_LIST *NvMapListNode;
-
- //
- // Initialize some variables to avoid warnings
- //
- BinaryData = NULL;
- *FileFormTagsHead = NULL;
- FileFormTags = NULL;
- gBinaryDataHead = NULL;
- Status = EFI_SUCCESS;
- FormCallback = NULL;
- NvMap = NULL;
- NvMapSize = 0;
-
- if (NumberOfIfrImages > 1) {
- NvMapOverride = NULL;
- }
-
- for (HandleIndex = 0; HandleIndex < NumberOfIfrImages; HandleIndex += 1) {
- //
- // If the buffers are uninitialized, allocate them, otherwise work on the ->Next members
- //
- if ((BinaryData == NULL) || (FileFormTags == NULL)) {
- //
- // Allocate memory for our Binary Data
- //
- BinaryData = AllocateZeroPool (sizeof (EFI_IFR_BINARY));
- ASSERT (BinaryData);
-
- //
- // Preserve the Head of what will be a linked-list.
- //
- gBinaryDataHead = BinaryData;
- gBinaryDataHead->Next = NULL;
-
- if (UseDatabase) {
- Status = GetIfrBinaryData (Hii, Handle[HandleIndex], NULL, BinaryData);
- } else {
- Status = GetIfrBinaryData (Hii, Handle[HandleIndex], Packet, BinaryData);
- }
- //
- // Allocate memory for our File Form Tags
- //
- FileFormTags = AllocateZeroPool (sizeof (EFI_FILE_FORM_TAGS));
- ASSERT (FileFormTags);
-
- //
- // Preserve the Head of what will be a linked-list.
- //
- *FileFormTagsHead = FileFormTags;
- (*FileFormTagsHead)->NextFile = NULL;
-
- } else {
- //
- // Allocate memory for our Binary Data linked-list
- // Each handle represents a Binary and we will store that data away.
- //
- BinaryData->Next = AllocateZeroPool (sizeof (EFI_IFR_BINARY));
- ASSERT (BinaryData->Next);
-
- BinaryData = BinaryData->Next;
- BinaryData->Next = NULL;
-
- if (UseDatabase) {
- Status = GetIfrBinaryData (Hii, Handle[HandleIndex], NULL, BinaryData);
- } else {
- Status = GetIfrBinaryData (Hii, Handle[HandleIndex], Packet, BinaryData);
- }
-
- if (EFI_ERROR (Status)) {
- return EFI_DEVICE_ERROR;
- }
- //
- // Allocate memory for our FileFormTags linked-list
- // Each allocation reserves handle represents a Binary and we will store that data away.
- //
- FileFormTags->NextFile = AllocateZeroPool (sizeof (EFI_FILE_FORM_TAGS));
- ASSERT (FileFormTags->NextFile);
-
- FileFormTags = FileFormTags->NextFile;
- }
- //
- // endif
- //
- // Tag Structure Initialization
- //
- Status = InitializeTagStructures (BinaryData, FileFormTags);
-
- VariableDefinition = FileFormTags->VariableDefinitions;
-
- //
- // Allocate memory for our NVRAM Maps for all of our variables
- //
- for (; VariableDefinition != NULL; VariableDefinition = VariableDefinition->Next) {
- //
- // Pad the fake variable size accordingly - this value should reflect the size of information that is not accounted by
- // the mainstream NVRAM variable such as DATE/TIME information that the browser needs to track but is saved to an RTC
- //
- VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableSize + VariableDefinition->VariableFakeSize);
-
- //
- // In the case where a file has no "real" NV data, we should pad the buffer accordingly
- //
- if (VariableDefinition->VariableSize == 0) {
- if (VariableDefinition->VariableFakeSize != 0) {
- VariableDefinition->NvRamMap = AllocateZeroPool (VariableDefinition->VariableFakeSize);
- ASSERT (VariableDefinition->NvRamMap != NULL);
- }
- } else {
- VariableDefinition->NvRamMap = AllocateZeroPool (VariableDefinition->VariableSize);
- ASSERT (VariableDefinition->NvRamMap != NULL);
- }
-
- if (VariableDefinition->VariableFakeSize != 0) {
- VariableDefinition->FakeNvRamMap = AllocateZeroPool (VariableDefinition->VariableFakeSize);
- ASSERT (VariableDefinition->FakeNvRamMap != NULL);
- }
- }
-
- Status = gBS->HandleProtocol (
- (VOID *) (UINTN) FileFormTags->FormTags.Tags[0].CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- (VOID **) &FormCallback
- );
-
- //
- // Since we might have multiple variables, if there is an NvMapOverride we need to use the EFI_VARIABLE_DEFINITION
- // information as the information that we pass back and forth. NOTE that callbacks that are initiated will only have the
- // NVRAM data refreshed based on the op-code that initiated the callback. In other words, we will pass to the caller a single
- // NVRAM map for a single variable based on the op-code that the user selected.
- //
- if (NvMapOverride != NULL) {
- VariableDefinition = FileFormTags->VariableDefinitions;
- OverrideDefinition = ((EFI_VARIABLE_DEFINITION *) NvMapOverride);
-
- //
- // Search through the variable definitions. There should be sufficient passed in settings for the variable op-codes specified
- //
- for (; VariableDefinition != NULL; VariableDefinition = VariableDefinition->Next) {
- if ((!CompareMem (VariableDefinition->VariableName, L"Setup", 10)) && (VariableDefinition->Next == NULL)) {
- if (VariableDefinition->VariableSize != 0) {
- CopyMem (VariableDefinition->NvRamMap, NvMapOverride, VariableDefinition->VariableSize);
- } else {
- CopyMem (VariableDefinition->NvRamMap, NvMapOverride, VariableDefinition->VariableFakeSize);
- }
- break;
- } else {
- VariableDefinition->NvRamMap = OverrideDefinition->NvRamMap;
- }
- //
- // There should NEVER be a ->Next for VariableDefinition and a NULL ->Next for the OverrideDefinition
- //
- ASSERT (OverrideDefinition->Next);
- OverrideDefinition = OverrideDefinition->Next;
- }
- } else {
- VariableDefinition = FileFormTags->VariableDefinitions;
-
- //
- // Search through the variable definitions. There should be sufficient passed in settings for the variable op-codes specified
- //
- for (; VariableDefinition != NULL; VariableDefinition = VariableDefinition->Next) {
- SizeOfNvStore = VariableDefinition->VariableSize;
-
- //
- // Getting the NvStore and placing it into our Global Data
- //
- if ((FormCallback != NULL) && (FormCallback->NvRead != NULL)) {
- Status = FormCallback->NvRead (
- FormCallback,
- VariableDefinition->VariableName,
- &VariableDefinition->Guid,
- NULL,
- &SizeOfNvStore,
- (VOID *) VariableDefinition->NvRamMap
- );
- } else {
- Status = gRT->GetVariable (
- VariableDefinition->VariableName,
- &VariableDefinition->Guid,
- NULL,
- &SizeOfNvStore,
- (VOID *) VariableDefinition->NvRamMap
- );
- }
-
- if (EFI_ERROR (Status)) {
- //
- // If there is a variable that exists already and it is larger than what we calculated the
- // storage needs to be, we must assume the variable size from GetVariable is correct and not
- // allow the truncation of the variable. It is very possible that the user who created the IFR
- // we are cracking is not referring to a variable that was in a previous map, however we cannot
- // allow it's truncation.
- //
- if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // If the buffer was too small, we should have the expanded size requirement in SizeOfNvStore now.
- //
- VariableDefinition->VariableSize = (UINT16) SizeOfNvStore;
-
- //
- // Free the buffer that was allocated that was too small
- //
- FreePool (VariableDefinition->NvRamMap);
- FreePool (VariableDefinition->FakeNvRamMap);
-
- VariableDefinition->NvRamMap = AllocateZeroPool (SizeOfNvStore);
- VariableDefinition->FakeNvRamMap = AllocateZeroPool (SizeOfNvStore + VariableDefinition->VariableFakeSize);
- ASSERT (VariableDefinition->NvRamMap);
- ASSERT (VariableDefinition->FakeNvRamMap);
-
- if ((FormCallback != NULL) && (FormCallback->NvRead != NULL)) {
- Status = FormCallback->NvRead (
- FormCallback,
- VariableDefinition->VariableName,
- &VariableDefinition->Guid,
- NULL,
- &SizeOfNvStore,
- (VOID *) VariableDefinition->NvRamMap
- );
- } else {
- Status = gRT->GetVariable (
- VariableDefinition->VariableName,
- &VariableDefinition->Guid,
- NULL,
- &SizeOfNvStore,
- (VOID *) VariableDefinition->NvRamMap
- );
- }
- }
- //
- // if the variable was not found, we will retrieve default values
- //
- if (Status == EFI_NOT_FOUND) {
-
- if (0 == CompareMem (VariableDefinition->VariableName, L"Setup", 10)) {
-
- NvMapListHead = NULL;
-
- Status = Hii->GetDefaultImage (Hii, Handle[HandleIndex], EFI_IFR_FLAG_DEFAULT, &NvMapListHead);
-
- if (!EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (NULL != NvMapListHead);
-
- NvMapListNode = NvMapListHead;
-
- while (NULL != NvMapListNode) {
- if (VariableDefinition->VariableId == NvMapListNode->VariablePack->VariableId) {
- NvMap = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength);
- NvMapSize = NvMapListNode->VariablePack->Header.Length - sizeof (EFI_HII_VARIABLE_PACK) - NvMapListNode->VariablePack->VariableNameLength;
- break;
- }
- NvMapListNode = NvMapListNode->NextVariablePack;
- }
-
- //
- // Free the buffer that was allocated.
- //
- FreePool (VariableDefinition->NvRamMap);
- FreePool (VariableDefinition->FakeNvRamMap);
-
- //
- // Allocate, copy the NvRamMap.
- //
- VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize - VariableDefinition->VariableSize);
- VariableDefinition->VariableSize = (UINT16) NvMapSize;
- VariableDefinition->VariableFakeSize = (UINT16) (VariableDefinition->VariableFakeSize + VariableDefinition->VariableSize);
-
- VariableDefinition->NvRamMap = AllocateZeroPool (VariableDefinition->VariableSize);
- VariableDefinition->FakeNvRamMap = AllocateZeroPool (NvMapSize + VariableDefinition->VariableFakeSize);
-
- CopyMem (VariableDefinition->NvRamMap, NvMap, NvMapSize);
- FreePool (NvMapListHead);
- }
-
- }
- Status = EFI_SUCCESS;
- }
- }
- }
- }
-
- InitializeTagStructures (BinaryData, FileFormTags);
- }
- //
- // endfor
- //
- return Status;
-}
-
-STATIC
-EFI_STATUS
-GetIfrBinaryData (
- IN EFI_HII_PROTOCOL *Hii,
- IN EFI_HII_HANDLE HiiHandle,
- IN EFI_IFR_PACKET *Packet,
- IN OUT EFI_IFR_BINARY *BinaryData
- )
-/*++
-
-Routine Description:
- Fetch the Ifr binary data.
-
-Arguments:
- Hii - Point to HII protocol.
- HiiHandle - Handle of Ifr to be fetched.
- Packet - Pointer to IFR packet.
- BinaryData - Buffer to copy the string into
-
-Returns:
- Returns the number of CHAR16 characters that were copied into the OutputString buffer.
-
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGES *PackageList;
- UINTN BufferSize;
- VOID *Buffer;
- UINT8 *RawFormBinary;
- EFI_IFR_FORM_SET *FormOp;
- UINT16 Index;
- UINT16 Index2;
- UINT16 TitleToken;
-
- //
- // Initialize the TitleToken to 0 just in case not found
- //
- TitleToken = 0;
-
- //
- // Try for a 32K Buffer
- //
- BufferSize = 0x8000;
-
- //
- // Allocate memory for our Form binary
- //
- Buffer = AllocateZeroPool (BufferSize);
- ASSERT (Buffer);
-
- if (Packet == NULL) {
- Status = Hii->GetForms (Hii, HiiHandle, 0, &BufferSize, Buffer);
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
-
- FreePool (Buffer);
-
- //
- // Allocate memory for our Form binary
- //
- Buffer = AllocatePool (BufferSize);
- ASSERT (Buffer);
-
- Status = Hii->GetForms (Hii, HiiHandle, 0, &BufferSize, Buffer);
- }
- } else {
- //
- // Copies the data to local usable buffer
- //
- CopyMem (Buffer, Packet->IfrData, Packet->IfrData->Header.Length);
-
- //
- // Register the string data with HII
- //
- PackageList = PreparePackages (2, NULL, Packet->IfrData, Packet->StringData);
-
- Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
-
- FreePool (PackageList);
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // We now have the IFR binary in our Buffer
- //
- BinaryData->IfrPackage = Buffer;
- RawFormBinary = (UINT8 *) ((CHAR8 *) (Buffer) + sizeof (EFI_HII_PACK_HEADER));
- BinaryData->FormBinary = (UINT8 *) ((CHAR8 *) (Buffer) + sizeof (EFI_HII_PACK_HEADER));
- BinaryData->Handle = HiiHandle;
-
- //
- // If a packet was passed in, remove the string data when exiting.
- //
- if (Packet != NULL) {
- BinaryData->UnRegisterOnExit = TRUE;
- } else {
- BinaryData->UnRegisterOnExit = FALSE;
- }
- //
- // Walk through the FormSet Opcodes looking for the FormSet opcode
- // If we hit EFI_IFR_END_SET_OP we know we hit the end of the FormSet.
- //
- for (Index = 0; RawFormBinary[Index] != EFI_IFR_END_FORM_SET_OP;) {
- FormOp = (EFI_IFR_FORM_SET *) &RawFormBinary[Index];
- Index = (UINT16) (Index + FormOp->Header.Length);
-
- if (FormOp->Header.OpCode == EFI_IFR_FORM_SET_OP) {
- TitleToken = FormOp->FormSetTitle;
- //
- // If displaying FrontPage - set the flag signifying it
- //
- switch (FormOp->SubClass) {
- case EFI_FRONT_PAGE_SUBCLASS:
- FrontPageHandle = HiiHandle;
-
- default:
- gClassOfVfr = FormOp->SubClass;
- }
- //
- // Match GUID to find out the function key setting. If match fail, use the default setting.
- //
- for (Index2 = 0; Index2 < sizeof (gFunctionKeySettingTable) / sizeof (FUNCTIION_KEY_SETTING); Index2++) {
- if (CompareGuid ((EFI_GUID *)(UINTN)&FormOp->Guid, &(gFunctionKeySettingTable[Index2].FormSetGuid))) {
- //
- // Update the function key setting.
- //
- gFunctionKeySetting = gFunctionKeySettingTable[Index2].KeySetting;
- //
- // Function key prompt can not be displayed if the function key has been disabled.
- //
- if ((gFunctionKeySetting & FUNCTION_ONE) != FUNCTION_ONE) {
- gFunctionOneString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
- }
-
- if ((gFunctionKeySetting & FUNCTION_TWO) != FUNCTION_TWO) {
- gFunctionTwoString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
- }
-
- if ((gFunctionKeySetting & FUNCTION_NINE) != FUNCTION_NINE) {
- gFunctionNineString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
- }
-
- if ((gFunctionKeySetting & FUNCTION_TEN) != FUNCTION_TEN) {
- gFunctionTenString = GetToken (STRING_TOKEN (EMPTY_STRING), gHiiHandle);
- }
- }
- }
- }
- }
-
- BinaryData->TitleToken = TitleToken;
-
- return Status;
-}
-
-EFI_HANDLE PrintHandle = NULL;
-EFI_PRINT_PROTOCOL mPrintProtocol = { UnicodeVSPrint };
-
-STATIC
-EFI_STATUS
-InstallPrint (
- VOID
- )
-{
- return gBS->InstallProtocolInterface (
- &PrintHandle,
- &gEfiPrintProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mPrintProtocol
- );
-}
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Setup.h b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Setup.h
deleted file mode 100644
index 6089d76..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Setup.h
+++ /dev/null
@@ -1,504 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Setup.h
-
-Abstract:
-
-
-Revision History
-
---*/
-
-#ifndef _SETUP_H
-#define _SETUP_H
-
-//
-// This is the generated header file which includes whatever needs to be exported (strings + IFR)
-//
-#include "SetupBrowserStrDefs.h"
-extern UINT8 SetupBrowserStrings[];
-
-//
-// Screen definitions
-//
-#define BANNER_HEIGHT 4
-#define BANNER_COLUMNS 3
-
-#define FRONT_PAGE_HEADER_HEIGHT 4
-#define NONE_FRONT_PAGE_HEADER_HEIGHT 3
-#define LEFT_SKIPPED_COLUMNS 4
-#define FOOTER_HEIGHT 4
-#define STATUS_BAR_HEIGHT 1
-#define SCROLL_ARROW_HEIGHT 1
-#define POPUP_PAD_SPACE_COUNT 5
-#define POPUP_FRAME_WIDTH 2
-
-
-#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
-#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
-#define EFI_FRONT_PAGE_SUBCLASS 0x02
-#define EFI_SINGLE_USE_SUBCLASS 0x03 // Used to display a single entity and then exit
-//
-// Definition for function key setting
-//
-#define NONE_FUNCTION_KEY_SETTING 0
-#define DEFAULT_FUNCTION_KEY_SETTING (FUNCTION_ONE | FUNCTION_TWO | FUNCTION_NINE | FUNCTION_TEN)
-
-#define FUNCTION_ONE (1 << 0)
-#define FUNCTION_TWO (1 << 1)
-#define FUNCTION_NINE (1 << 2)
-#define FUNCTION_TEN (1 << 3)
-
-typedef struct {
- EFI_GUID FormSetGuid;
- UINTN KeySetting;
-} FUNCTIION_KEY_SETTING;
-
-//
-// Character definitions
-//
-#define CHAR_SPACE 0x0020
-#define UPPER_LOWER_CASE_OFFSET 0x20
-
-//
-// Time definitions
-//
-#define ONE_SECOND 10000000
-
-//
-// Display definitions
-//
-#define LEFT_HYPER_DELIMITER L'<'
-#define RIGHT_HYPER_DELIMITER L'>'
-
-#define LEFT_ONEOF_DELIMITER L'<'
-#define RIGHT_ONEOF_DELIMITER L'>'
-
-#define LEFT_NUMERIC_DELIMITER L'['
-#define RIGHT_NUMERIC_DELIMITER L']'
-
-#define LEFT_CHECKBOX_DELIMITER L"["
-#define RIGHT_CHECKBOX_DELIMITER L"]"
-
-#define CHECK_ON L"X"
-#define CHECK_OFF L" "
-
-#define TIME_SEPARATOR L':'
-#define DATE_SEPARATOR L'/'
-
-#define YES_ANSWER L'Y'
-#define NO_ANSWER L'N'
-
-//
-// Up to how many lines does the ordered list display
-//
-#define ORDERED_LIST_SIZE 4
-
-//
-// This is the Input Error Message
-//
-#define INPUT_ERROR 1
-
-//
-// This is the NV RAM update required Message
-//
-#define NV_UPDATE_REQUIRED 2
-
-//
-// Refresh the Status Bar with flags
-//
-#define REFRESH_STATUS_BAR 0xff
-
-//
-// This width is basically the sum of the prompt and option widths
-//
-#define QUESTION_BLOCK_WIDTH 50
-
-//
-// Width of the Language Description (Using ISO-639-2 3 ASCII letter standard)
-//
-#define LANG_DESC_WIDTH 3
-
-//
-// Maximum Number of Binaries we can see
-//
-#define MAX_BINARIES 255
-
-//
-// Invalid Handle
-//
-#define EFI_HII_INVALID_HANDLE 0xFFFF
-
-//
-// Invalid Offset Value
-//
-#define INVALID_OFFSET_VALUE 0xFFFF
-
-struct StringPart {
- struct StringPart *Next;
- CHAR8 String[QUESTION_BLOCK_WIDTH + 2];
-};
-
-//
-// The tag definition defines the data associated with a tag (an operation
-// in the IFR lingo). The tag is thus a modified union of all the data
-// required for tags. The user should be careful to only rely upon information
-// relevant to that tag as the contents of other fields is undefined.
-//
-// The intent here is for this to be all of the data associated with a particular tag.
-// Some of this data is extracted from the IFR and left alone. Other data will be derived
-// when the page is selected (since that's the first time we really know what language the
-// page is to be displayed in) and still other data will vary based on the selection.
-// If you'd like to consider alternatives, let me know. This structure has grown somewhat organically.
-// It gets a new item stuffed in it when a new item is needed. When I finally decided I needed the
-// StringPart structure, items got added here, for example.
-//
-typedef struct {
- UINT8 Operand; // The operand (first byte) of the variable length tag.
- EFI_GUID GuidValue; // Primarily for FormSet data
- EFI_PHYSICAL_ADDRESS CallbackHandle;
- UINT16 Class;
- UINT16 SubClass;
- UINT16 NumberOfLines; // The number of lines the tag takes up on the page. Adjusted when we display the page as it can change from language to language.
- UINT16 PageLine;
- UINT16 PageColumn;
- UINT16 OptionWidth; // The option can be wider than the column usually associated with options. This is the width on the last option line
- STRING_REF Text; // Used for title, subtitle, prompt, etc. This is the string token associated with the string. This token is language independent.
- STRING_REF TextTwo; // Used for title, subtitle, prompt, etc. This is the string token associated with the string. This token is language independent.
- STRING_REF Help; // Null means no help Same as above but for languages.
- UINT16 Consistency; // Do we need to check this opcode against consistency? If > 0, yes.
- UINT16 Id;
- UINT16 Id2; // The questions (mainly) have identifiers associated with them. These are filled in from the IFR tags and used by e.g. the RPN calculations. (com1 is set to, versus com2 is set to)
- //
- // These are the three values that are created to determine where in the variable the data is stored. This should, in general,
- // be allocated by the build tool. The one major issue is, once storage is allocated for something, it can't be reallocated or we will get a mess.
- //
- UINT16 StorageStart;
- //
- // These are the three values that are created to determine where in the variable the data is stored. This should, in general,
- // be allocated by the build tool. The one major issue is, once storage is allocated for something, it can't be reallocated or we will get a mess.
- //
- UINT8 StorageWidth;
- //
- // These are the three values that are created to determine where in the variable the data is stored. This should, in general,
- // be allocated by the build tool. The one major issue is, once storage is allocated for something, it can't be reallocated or we will get a mess.
- //
- UINT16 Value;
- //
- // (Default or current)
- //
- UINT8 Flags;
- UINT16 Key;
- //
- // Used to preserve a value during late consistency checking
- //
- UINT16 OldValue;
- UINT16 Minimum;
- UINT16 Maximum;
- UINT16 Step;
- UINT16 Default;
- UINT16 NvDataSize;
- UINT16 ConsistencyId;
- BOOLEAN GrayOut;
- BOOLEAN Suppress;
- UINT16 Encoding; // Data from the tags. The first three are used by the numeric input. Encoding is used by the password stuff (a placeholder today - may go away).
- UINT16 *IntList; // List of the values possible for a list question
- //
- // The string is obtained from the string list and formatted into lines and the lines are held in this linked list.
- // If we have more than a screen's worth of items, we will end up with cases where we have to display the last couple
- // lines of a tag's string above the currently selected one, or, display a few lines of a tag at the bottom of a screen.
- //
- struct StringPart *StringList;
- BOOLEAN ResetRequired; // Primarily used to determine if a reset is required by changing this op-code.
- UINT16 VariableNumber; // Used to define which variable the StorageStart will be pertinent for (0-based) For single variable VFR this will always be 0.
- //
- // Used to define which variable the StorageStart will be pertinent for (0-based) This is used for boolean check of ID versus ID
- // so that a user can compare the value of one variable.field content versus another variable.field content.
- //
- UINT16 VariableNumber2;
-} EFI_TAG;
-
-#define EFI_FORM_DATA_SIGNATURE EFI_SIGNATURE_32 ('F', 'o', 'r', 'm')
-
-typedef struct {
- UINTN Signature;
-
- EFI_HII_PROTOCOL *Hii;
- EFI_FORM_BROWSER_PROTOCOL FormConfig;
-} EFI_FORM_CONFIGURATION_DATA;
-
-#define EFI_FORM_DATA_FROM_THIS(a) CR (a, EFI_FORM_CONFIGURATION_DATA, FormConfig, EFI_FORM_DATA_SIGNATURE)
-
-typedef struct _EFI_VARIABLE_DEFINITION {
- CHAR8 *NvRamMap;
- CHAR8 *FakeNvRamMap; // This is where the storage for NULL devices go (e.g. RTC)
- EFI_GUID Guid;
- UINT16 VariableId;
- UINT16 VariableSize;
- UINT16 VariableFakeSize; // For dynamically created and NULL device options, this is the latest size
- CHAR16 *VariableName;
- struct _EFI_VARIABLE_DEFINITION *Next;
- struct _EFI_VARIABLE_DEFINITION *Previous;
-} EFI_VARIABLE_DEFINITION;
-
-typedef struct {
- UINT32 Length; // Length in bytes between beginning of struc and end of Strings
- CHAR8 LanguageCode[4]; // ISO-639-2 language code with a null-terminator
- RELOFST PrintableLanguageName; // Translated name of the Language, "English"/"Espanol" etc
- UINT32 Attributes; // If on, the language is intended to be printed right to left. The default (off) is to print left to right.
- RELOFST StringsPointers[1]; // Pointing to string offset from beginning of String Binary
- EFI_STRING Strings[1]; // Array of String Entries. Note the number of entries for Strings and StringsPointers will be the same
-} EFI_LANGUAGE_SET;
-
-//
-// This encapsulates all the pointers associated with found IFR binaries
-//
-typedef struct _EFI_IFR_BINARY {
- struct _EFI_IFR_BINARY *Next;
- VOID *IfrPackage; // Handy for use in freeing the data later since this is the header of the buffer
- VOID *FormBinary;
- EFI_HII_HANDLE Handle;
- STRING_REF TitleToken;
- BOOLEAN UnRegisterOnExit;
-} EFI_IFR_BINARY;
-
-//
-// This encapsulates all the questions (tags) for a particular Form Set
-//
-typedef struct _EFI_FORM_TAGS {
- struct _EFI_FORM_TAGS *Next;
- EFI_TAG *Tags;
-} EFI_FORM_TAGS;
-
-//
-// This is the database of all inconsistency data. Each op-code associated
-// with inconsistency will be tracked here. This optimizes the search requirement
-// since we will back mark the main tag structure with the op-codes that have reference
-// to inconsistency data. This way when parsing the main tag structure and encountering
-// the inconsistency mark - we can search this database to know what the inconsistency
-// parameters are for that entry.
-//
-typedef struct _EFI_INCONSISTENCY_DATA {
- struct _EFI_INCONSISTENCY_DATA *Next;
- struct _EFI_INCONSISTENCY_DATA *Previous;
- UINT8 Operand;
- STRING_REF Popup;
- UINT16 QuestionId1;
- UINT16 QuestionId2;
- UINT16 Value;
- UINT16 ListLength;
- UINT16 ConsistencyId;
- UINT16 *ValueList;
- UINT16 VariableNumber;
- UINT16 VariableNumber2;
- UINT8 Width;
-} EFI_INCONSISTENCY_DATA;
-
-//
-// Encapsulating all found Tag information from all sources
-// Each encapsulation also contains the NvRamMap buffer and the Size of the NV store
-//
-typedef struct _EFI_FILE_FORM_TAGS {
- struct _EFI_FILE_FORM_TAGS *NextFile;
- EFI_INCONSISTENCY_DATA *InconsistentTags;
- EFI_VARIABLE_DEFINITION *VariableDefinitions;
- EFI_FORM_TAGS FormTags;
-} EFI_FILE_FORM_TAGS;
-
-typedef struct {
- STRING_REF Banner[BANNER_HEIGHT][BANNER_COLUMNS];
-} BANNER_DATA;
-
-//
-// Head of the Binary structures
-//
-EFI_IFR_BINARY *gBinaryDataHead;
-
-//
-// The IFR binary that the user chose to run
-//
-UINTN gActiveIfr;
-
-EFI_HII_PROTOCOL *Hii;
-
-VOID *CachedNVEntry;
-BANNER_DATA *BannerData;
-EFI_HII_HANDLE FrontPageHandle;
-STRING_REF FrontPageTimeOutTitle;
-INT16 FrontPageTimeOutValue;
-UINTN gClassOfVfr;
-UINTN gFunctionKeySetting;
-BOOLEAN gResetRequired;
-BOOLEAN gExitRequired;
-BOOLEAN gSaveRequired;
-BOOLEAN gNvUpdateRequired;
-UINT16 gConsistencyId;
-UINTN gPriorMenuEntry;
-EFI_HII_HANDLE gHiiHandle;
-BOOLEAN gFirstIn;
-VOID *gPreviousValue;
-UINT16 gDirection;
-EFI_SCREEN_DESCRIPTOR gScreenDimensions;
-BOOLEAN gUpArrow;
-BOOLEAN gDownArrow;
-BOOLEAN gTimeOnScreen;
-BOOLEAN gDateOnScreen;
-
-//
-// Browser Global Strings
-//
-CHAR16 *gFunctionOneString;
-CHAR16 *gFunctionTwoString;
-CHAR16 *gFunctionNineString;
-CHAR16 *gFunctionTenString;
-CHAR16 *gEnterString;
-CHAR16 *gEnterCommitString;
-CHAR16 *gEscapeString;
-CHAR16 *gMoveHighlight;
-CHAR16 *gMakeSelection;
-CHAR16 *gNumericInput;
-CHAR16 *gToggleCheckBox;
-CHAR16 *gPromptForPassword;
-CHAR16 *gPromptForNewPassword;
-CHAR16 *gConfirmPassword;
-CHAR16 *gConfirmError;
-CHAR16 *gPressEnter;
-CHAR16 *gEmptyString;
-CHAR16 *gAreYouSure;
-CHAR16 *gYesResponse;
-CHAR16 *gNoResponse;
-CHAR16 *gMiniString;
-CHAR16 *gPlusString;
-CHAR16 *gMinusString;
-CHAR16 *gAdjustNumber;
-
-CHAR16 gPromptBlockWidth;
-CHAR16 gOptionBlockWidth;
-CHAR16 gHelpBlockWidth;
-
-//
-// Global Procedure Defines
-//
-VOID
-InitializeBrowserStrings (
- VOID
- )
-;
-
-UINTN
-Print (
- IN CHAR16 *fmt,
- ...
- )
-;
-
-UINTN
-PrintString (
- CHAR16 *String
- )
-;
-
-UINTN
-PrintChar (
- CHAR16 Character
- )
-;
-
-UINTN
-PrintAt (
- IN UINTN Column,
- IN UINTN Row,
- IN CHAR16 *fmt,
- ...
- )
-;
-
-UINTN
-PrintStringAt (
- IN UINTN Column,
- IN UINTN Row,
- CHAR16 *String
- )
-;
-
-UINTN
-PrintCharAt (
- IN UINTN Column,
- IN UINTN Row,
- CHAR16 Character
- )
-;
-
-VOID
-DisplayPageFrame (
- VOID
- )
-;
-
-CHAR16 *
-GetToken (
- IN STRING_REF IfrBinaryTitle,
- IN EFI_HII_HANDLE HiiHandle
- )
-;
-
-VOID
-GetTagCount (
- IN UINT8 *RawFormSet,
- IN OUT UINT16 *NumberOfTags
- )
-;
-
-VOID
-GetNumericHeader (
- IN EFI_TAG *Tag,
- IN UINT8 *RawFormSet,
- IN UINT16 Index,
- IN UINT16 NumberOfLines,
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UINT16 CurrentVariable
- )
-;
-
-VOID
-GetQuestionHeader (
- IN EFI_TAG *Tag,
- IN UINT8 *RawFormSet,
- IN UINT16 Index,
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UINT16 CurrentVariable
- )
-;
-
-VOID
-CreateSharedPopUp (
- IN UINTN RequestedWidth,
- IN UINTN NumberOfLines,
- IN CHAR16 **ArrayOfStrings
- )
-;
-
-EFI_STATUS
-CreateDialog (
- IN UINTN NumberOfLines,
- IN BOOLEAN HotKey,
- IN UINTN MaximumStringSize,
- OUT CHAR16 *StringBuffer,
- OUT EFI_INPUT_KEY *KeyValue,
- IN CHAR16 *String,
- ...
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/SetupBrowser.msa b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/SetupBrowser.msa
deleted file mode 100644
index d3a0bd3..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/SetupBrowser.msa
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>SetupBrowser</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>EBf342FE-B1D3-4EF8-957C-8048606FF670</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for SetupBrowser module.</Abstract>
- <Description>This driver initializes Setup for the brower and installs FormBrowser protocol.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>SetupBrowser</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HiiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkGraphicsLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>SetupBrowserStr.uni</Filename>
- <Filename>Setup.c</Filename>
- <Filename>Setup.h</Filename>
- <Filename>Boolean.c</Filename>
- <Filename>InputHandler.c</Filename>
- <Filename>Print.c</Filename>
- <Filename>Print.h</Filename>
- <Filename>Presentation.c</Filename>
- <Filename>ProcessOptions.c</Filename>
- <Filename>Ui.c</Filename>
- <Filename>Ui.h</Filename>
- <Filename>Colors.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiFormCallbackProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiFormBrowserProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiPrintProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Events>
- <CreateEvents>
- <EventTypes EventGuidCName="EFI_EVENT_TIMER" Usage="ALWAYS_CONSUMED">
- <EventType>EVENT_GROUP_GUID</EventType>
- </EventTypes>
- </CreateEvents>
- </Events>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>InitializeSetup</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/SetupBrowserStr.uni b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/SetupBrowserStr.uni
deleted file mode 100644
index 1dfd924..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/SetupBrowserStr.uni
+++ /dev/null
Binary files differ
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c
deleted file mode 100644
index 3d30c1b..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c
+++ /dev/null
@@ -1,3150 +0,0 @@
-/**@file
- Implementation for UI.
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Setup.h"
-#include "Ui.h"
-#include "Colors.h"
-
-//
-// Implementation
-//
-VOID
-SetUnicodeMem (
- IN VOID *Buffer,
- IN UINTN Size,
- IN CHAR16 Value
- )
-/*++
-
-Routine Description:
-
- Set Buffer to Value for Size bytes.
-
-Arguments:
-
- Buffer - Memory to set.
-
- Size - Number of bytes to set
-
- Value - Value of the set operation.
-
-Returns:
-
- None
-
---*/
-{
- CHAR16 *Ptr;
-
- Ptr = Buffer;
- while (Size--) {
- *(Ptr++) = Value;
- }
-}
-
-VOID
-UiInitMenu (
- VOID
- )
-/*++
-
-Routine Description:
- Initialize Menu option list.
-
-Arguments:
-
-Returns:
-
---*/
-{
- InitializeListHead (&Menu);
-}
-
-VOID
-UiInitMenuList (
- VOID
- )
-/*++
-
-Routine Description:
- Initialize Menu option list.
-
-Arguments:
-
-Returns:
-
---*/
-{
- InitializeListHead (&gMenuList);
-}
-
-VOID
-UiRemoveMenuListEntry (
- IN UI_MENU_OPTION *Selection,
- OUT UI_MENU_OPTION **PreviousSelection
- )
-/*++
-
-Routine Description:
- Remove Menu option list.
-
-Arguments:
-
-Returns:
-
---*/
-{
- UI_MENU_LIST *UiMenuList;
-
- *PreviousSelection = AllocateZeroPool (sizeof (UI_MENU_OPTION));
- ASSERT (*PreviousSelection != NULL);
-
- if (!IsListEmpty (&gMenuList)) {
- UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE);
- (*PreviousSelection)->IfrNumber = UiMenuList->Selection.IfrNumber;
- (*PreviousSelection)->FormId = UiMenuList->Selection.FormId;
- (*PreviousSelection)->Tags = UiMenuList->Selection.Tags;
- (*PreviousSelection)->ThisTag = UiMenuList->Selection.ThisTag;
- (*PreviousSelection)->Handle = UiMenuList->Selection.Handle;
- gEntryNumber = UiMenuList->FormerEntryNumber;
- RemoveEntryList (&UiMenuList->MenuLink);
- FreePool (UiMenuList);
- }
-}
-
-VOID
-UiFreeMenuList (
- VOID
- )
-/*++
-
-Routine Description:
- Free Menu option linked list.
-
-Arguments:
-
-Returns:
-
---*/
-{
- UI_MENU_LIST *UiMenuList;
-
- while (!IsListEmpty (&gMenuList)) {
- UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE);
- RemoveEntryList (&UiMenuList->MenuLink);
- FreePool (UiMenuList);
- }
-}
-
-VOID
-UiAddMenuListEntry (
- IN UI_MENU_OPTION *Selection
- )
-/*++
-
-Routine Description:
- Add one menu entry to the linked lst
-
-Arguments:
-
-Returns:
-
---*/
-{
- UI_MENU_LIST *UiMenuList;
-
- UiMenuList = AllocateZeroPool (sizeof (UI_MENU_LIST));
- ASSERT (UiMenuList != NULL);
-
- UiMenuList->Signature = UI_MENU_LIST_SIGNATURE;
- CopyMem (&UiMenuList->Selection, Selection, sizeof (UI_MENU_OPTION));
-
- InsertHeadList (&gMenuList, &UiMenuList->MenuLink);
-}
-
-VOID
-UiFreeMenu (
- VOID
- )
-/*++
-
-Routine Description:
- Free Menu option linked list.
-
-Arguments:
-
-Returns:
-
---*/
-{
- UI_MENU_OPTION *MenuOption;
-
- while (!IsListEmpty (&Menu)) {
- MenuOption = CR (Menu.ForwardLink, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- RemoveEntryList (&MenuOption->Link);
-
- //
- // We allocated space for this description when we did a GetToken, free it here
- //
- FreePool (MenuOption->Description);
- FreePool (MenuOption);
- }
-}
-
-STATIC
-VOID
-UpdateDateAndTime (
- VOID
- )
-/*++
-
-Routine Description:
- Refresh screen with current date and/or time based on screen context
-
-Arguments:
-
-Returns:
-
---*/
-{
- CHAR16 *OptionString;
- MENU_REFRESH_ENTRY *MenuRefreshEntry;
- UINTN Index;
- UINTN Loop;
-
- OptionString = NULL;
-
- if (gMenuRefreshHead != NULL) {
-
- MenuRefreshEntry = gMenuRefreshHead;
-
- do {
- gST->ConOut->SetAttribute (gST->ConOut, MenuRefreshEntry->CurrentAttribute);
- ProcessOptions (MenuRefreshEntry->MenuOption, FALSE, MenuRefreshEntry->FileFormTagsHead, NULL, &OptionString);
-
- if (OptionString != NULL) {
- //
- // If leading spaces on OptionString - remove the spaces
- //
- for (Index = 0; OptionString[Index] == L' '; Index++)
- ;
-
- for (Loop = 0; OptionString[Index] != CHAR_NULL; Index++) {
- OptionString[Loop] = OptionString[Index];
- Loop++;
- }
-
- OptionString[Loop] = CHAR_NULL;
-
- PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, OptionString);
- }
-
- MenuRefreshEntry = MenuRefreshEntry->Next;
-
- } while (MenuRefreshEntry != NULL);
- }
-
- if (OptionString != NULL) {
- FreePool (OptionString);
- }
-}
-
-EFI_STATUS
-UiWaitForSingleEvent (
- IN EFI_EVENT Event,
- IN UINT64 Timeout OPTIONAL
- )
-/*++
-
-Routine Description:
- Wait for a given event to fire, or for an optional timeout to expire.
-
-Arguments:
- Event - The event to wait for
-
- Timeout - An optional timeout value in 100 ns units.
-
-Returns:
-
- EFI_SUCCESS - Event fired before Timeout expired.
- EFI_TIME_OUT - Timout expired before Event fired.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_EVENT TimerEvent;
- EFI_EVENT WaitList[2];
-
- if (Timeout) {
- //
- // Create a timer event
- //
- Status = gBS->CreateEvent (EVT_TIMER, 0, NULL, NULL, &TimerEvent);
- if (!EFI_ERROR (Status)) {
- //
- // Set the timer event
- //
- gBS->SetTimer (
- TimerEvent,
- TimerRelative,
- Timeout
- );
-
- //
- // Wait for the original event or the timer
- //
- WaitList[0] = Event;
- WaitList[1] = TimerEvent;
- Status = gBS->WaitForEvent (2, WaitList, &Index);
- gBS->CloseEvent (TimerEvent);
-
- //
- // If the timer expired, change the return to timed out
- //
- if (!EFI_ERROR (Status) && Index == 1) {
- Status = EFI_TIMEOUT;
- }
- }
- } else {
- //
- // Update screen every second
- //
- Timeout = ONE_SECOND;
-
- do {
- Status = gBS->CreateEvent (EVT_TIMER, 0, NULL, NULL, &TimerEvent);
-
- //
- // Set the timer event
- //
- gBS->SetTimer (
- TimerEvent,
- TimerRelative,
- Timeout
- );
-
- //
- // Wait for the original event or the timer
- //
- WaitList[0] = Event;
- WaitList[1] = TimerEvent;
- Status = gBS->WaitForEvent (2, WaitList, &Index);
-
- //
- // If the timer expired, update anything that needs a refresh and keep waiting
- //
- if (!EFI_ERROR (Status) && Index == 1) {
- Status = EFI_TIMEOUT;
- UpdateDateAndTime ();
- }
-
- gBS->CloseEvent (TimerEvent);
- } while (Status == EFI_TIMEOUT);
- }
-
- return Status;
-}
-
-VOID
-UiAddMenuOption (
- IN CHAR16 *String,
- IN EFI_HII_HANDLE Handle,
- IN EFI_TAG *Tags,
- IN VOID *FormBinary,
- IN UINTN IfrNumber
- )
-/*++
-
-Routine Description:
- Add one menu option by specified description and context.
-
-Arguments:
- String - String description for this option.
- Context - Context data for entry.
-
-Returns:
-
---*/
-{
- UI_MENU_OPTION *MenuOption;
-
- MenuOption = AllocateZeroPool (sizeof (UI_MENU_OPTION));
- ASSERT (MenuOption);
-
- MenuOption->Signature = UI_MENU_OPTION_SIGNATURE;
- MenuOption->Description = String;
- MenuOption->Handle = Handle;
- MenuOption->FormBinary = FormBinary;
- MenuOption->IfrNumber = IfrNumber;
- MenuOption->Skip = 1;
- MenuOption->Tags = Tags;
- MenuOption->TagIndex = 0;
- MenuOption->ThisTag = &(MenuOption->Tags[MenuOption->TagIndex]);
- MenuOption->EntryNumber = (UINT16) IfrNumber;
-
- InsertTailList (&Menu, &MenuOption->Link);
-}
-
-VOID
-UiAddSubMenuOption (
- IN CHAR16 *String,
- IN EFI_HII_HANDLE Handle,
- IN EFI_TAG *Tags,
- IN UINTN TagIndex,
- IN UINT16 FormId,
- IN UINT16 MenuItemCount
- )
-/*++
-
-Routine Description:
- Add one menu option by specified description and context.
-
-Arguments:
- String - String description for this option.
- Context - Context data for entry.
-
-Returns:
-
---*/
-{
- UI_MENU_OPTION *MenuOption;
-
- MenuOption = AllocateZeroPool (sizeof (UI_MENU_OPTION));
- ASSERT (MenuOption);
-
- MenuOption->Signature = UI_MENU_OPTION_SIGNATURE;
- MenuOption->Description = String;
- MenuOption->Handle = Handle;
- MenuOption->Skip = Tags[TagIndex].NumberOfLines;
- MenuOption->IfrNumber = gActiveIfr;
- MenuOption->Tags = Tags;
- MenuOption->TagIndex = TagIndex;
- MenuOption->ThisTag = &(MenuOption->Tags[MenuOption->TagIndex]);
- MenuOption->Consistency = Tags[TagIndex].Consistency;
- MenuOption->FormId = FormId;
- MenuOption->GrayOut = Tags[TagIndex].GrayOut;
- MenuOption->EntryNumber = MenuItemCount;
-
- InsertTailList (&Menu, &MenuOption->Link);
-}
-
-EFI_STATUS
-CreateDialog (
- IN UINTN NumberOfLines,
- IN BOOLEAN HotKey,
- IN UINTN MaximumStringSize,
- OUT CHAR16 *StringBuffer,
- OUT EFI_INPUT_KEY *KeyValue,
- IN CHAR16 *String,
- ...
- )
-/*++
-
-Routine Description:
- Routine used to abstract a generic dialog interface and return the selected key or string
-
-Arguments:
- NumberOfLines - The number of lines for the dialog box
- HotKey - Defines whether a single character is parsed (TRUE) and returned in KeyValue
- or a string is returned in StringBuffer. Two special characters are considered when entering a string, a SCAN_ESC and
- an CHAR_CARRIAGE_RETURN. SCAN_ESC terminates string input and returns
- MaximumStringSize - The maximum size in bytes of a typed in string (each character is a CHAR16) and the minimum string returned is two bytes
- StringBuffer - The passed in pointer to the buffer which will hold the typed in string if HotKey is FALSE
- KeyValue - The EFI_KEY value returned if HotKey is TRUE..
- String - Pointer to the first string in the list
- ... - A series of (quantity == NumberOfLines) text strings which will be used to construct the dialog box
-
-Returns:
- EFI_SUCCESS - Displayed dialog and received user interaction
- EFI_INVALID_PARAMETER - One of the parameters was invalid (e.g. (StringBuffer == NULL) && (HotKey == FALSE))
- EFI_DEVICE_ERROR - User typed in an ESC character to exit the routine
-
---*/
-{
- VA_LIST Marker;
- UINTN Count;
- EFI_INPUT_KEY Key;
- UINTN LargestString;
- CHAR16 *TempString;
- CHAR16 *BufferedString;
- CHAR16 *StackString;
- CHAR16 KeyPad[2];
- UINTN Start;
- UINTN Top;
- UINTN Index;
- BOOLEAN SelectionComplete;
- UINTN InputOffset;
- UINTN CurrentAttribute;
- UINTN DimensionsWidth;
- UINTN DimensionsHeight;
-
- DimensionsWidth = gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn;
- DimensionsHeight = gScreenDimensions.BottomRow - gScreenDimensions.TopRow;
-
- SelectionComplete = FALSE;
- InputOffset = 0;
- TempString = AllocateZeroPool (MaximumStringSize * 2);
- BufferedString = AllocateZeroPool (MaximumStringSize * 2);
- CurrentAttribute = gST->ConOut->Mode->Attribute;
-
- ASSERT (TempString);
- ASSERT (BufferedString);
-
- VA_START (Marker, String);
-
- //
- // Zero the outgoing buffer
- //
- ZeroMem (StringBuffer, MaximumStringSize);
-
- if (HotKey) {
- if (KeyValue == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- } else {
- if (StringBuffer == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // Disable cursor
- //
- gST->ConOut->EnableCursor (gST->ConOut, FALSE);
-
- LargestString = (GetStringWidth (String) / 2);
-
- if (LargestString == L' ') {
- InputOffset = 1;
- }
- //
- // Determine the largest string in the dialog box
- // Notice we are starting with 1 since String is the first string
- //
- for (Count = 1; Count < NumberOfLines; Count++) {
- StackString = VA_ARG (Marker, CHAR16 *);
-
- if (StackString[0] == L' ') {
- InputOffset = Count + 1;
- }
-
- if ((GetStringWidth (StackString) / 2) > LargestString) {
- //
- // Size of the string visually and subtract the width by one for the null-terminator
- //
- LargestString = (GetStringWidth (StackString) / 2);
- }
- }
-
- Start = (DimensionsWidth - LargestString - 2) / 2 + gScreenDimensions.LeftColumn + 1;
- Top = ((DimensionsHeight - NumberOfLines - 2) / 2) + gScreenDimensions.TopRow - 1;
-
- Count = 0;
-
- //
- // Display the Popup
- //
- CreateSharedPopUp (LargestString, NumberOfLines, &String);
-
- //
- // Take the first key typed and report it back?
- //
- if (HotKey) {
- WaitForKeyStroke (&Key);
- CopyMem (KeyValue, &Key, sizeof (EFI_INPUT_KEY));
-
- } else {
- do {
- WaitForKeyStroke (&Key);
-
- switch (Key.UnicodeChar) {
- case CHAR_NULL:
- switch (Key.ScanCode) {
- case SCAN_ESC:
- FreePool (TempString);
- FreePool (BufferedString);
- gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);
- gST->ConOut->EnableCursor (gST->ConOut, TRUE);
- return EFI_DEVICE_ERROR;
-
- default:
- break;
- }
-
- break;
-
- case CHAR_CARRIAGE_RETURN:
- SelectionComplete = TRUE;
- FreePool (TempString);
- FreePool (BufferedString);
- gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);
- gST->ConOut->EnableCursor (gST->ConOut, TRUE);
- return EFI_SUCCESS;
- break;
-
- case CHAR_BACKSPACE:
- if (StringBuffer[0] != CHAR_NULL) {
- for (Index = 0; StringBuffer[Index] != CHAR_NULL; Index++) {
- TempString[Index] = StringBuffer[Index];
- }
- //
- // Effectively truncate string by 1 character
- //
- TempString[Index - 1] = CHAR_NULL;
- StrCpy (StringBuffer, TempString);
- }
-
- default:
- //
- // If it is the beginning of the string, don't worry about checking maximum limits
- //
- if ((StringBuffer[0] == CHAR_NULL) && (Key.UnicodeChar != CHAR_BACKSPACE)) {
- StrnCpy (StringBuffer, &Key.UnicodeChar, 1);
- StrnCpy (TempString, &Key.UnicodeChar, 1);
- } else if ((GetStringWidth (StringBuffer) < MaximumStringSize) && (Key.UnicodeChar != CHAR_BACKSPACE)) {
- KeyPad[0] = Key.UnicodeChar;
- KeyPad[1] = CHAR_NULL;
- StrCat (StringBuffer, KeyPad);
- StrCat (TempString, KeyPad);
- }
- //
- // If the width of the input string is now larger than the screen, we nee to
- // adjust the index to start printing portions of the string
- //
- SetUnicodeMem (BufferedString, LargestString, L' ');
-
- PrintStringAt (Start + 1, Top + InputOffset, BufferedString);
-
- if ((GetStringWidth (StringBuffer) / 2) > (DimensionsWidth - 2)) {
- Index = (GetStringWidth (StringBuffer) / 2) - DimensionsWidth + 2;
- } else {
- Index = 0;
- }
-
- for (Count = 0; Index + 1 < GetStringWidth (StringBuffer) / 2; Index++, Count++) {
- BufferedString[Count] = StringBuffer[Index];
- }
-
- PrintStringAt (Start + 1, Top + InputOffset, BufferedString);
- break;
- }
- } while (!SelectionComplete);
- }
-
- gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);
- gST->ConOut->EnableCursor (gST->ConOut, TRUE);
- return EFI_SUCCESS;
-}
-
-VOID
-CreateSharedPopUp (
- IN UINTN RequestedWidth,
- IN UINTN NumberOfLines,
- IN CHAR16 **ArrayOfStrings
- )
-{
- UINTN Index;
- UINTN Count;
- CHAR16 Character;
- UINTN Start;
- UINTN End;
- UINTN Top;
- UINTN Bottom;
- CHAR16 *String;
-
- UINTN DimensionsWidth;
- UINTN DimensionsHeight;
-
- DimensionsWidth = gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn;
- DimensionsHeight = gScreenDimensions.BottomRow - gScreenDimensions.TopRow;
-
- Count = 0;
-
- gST->ConOut->SetAttribute (gST->ConOut, POPUP_TEXT | POPUP_BACKGROUND);
-
- if ((RequestedWidth + 2) > DimensionsWidth) {
- RequestedWidth = DimensionsWidth - 2;
- }
- //
- // Subtract the PopUp width from total Columns, allow for one space extra on
- // each end plus a border.
- //
- Start = (DimensionsWidth - RequestedWidth - 2) / 2 + gScreenDimensions.LeftColumn + 1;
- End = Start + RequestedWidth + 1;
-
- Top = ((DimensionsHeight - NumberOfLines - 2) / 2) + gScreenDimensions.TopRow - 1;
- Bottom = Top + NumberOfLines + 2;
-
- Character = (CHAR16) BOXDRAW_DOWN_RIGHT;
- PrintCharAt (Start, Top, Character);
- Character = (CHAR16) BOXDRAW_HORIZONTAL;
- for (Index = Start; Index + 2 < End; Index++) {
- PrintChar (Character);
- }
-
- Character = (CHAR16) BOXDRAW_DOWN_LEFT;
- PrintChar (Character);
- Character = (CHAR16) BOXDRAW_VERTICAL;
- for (Index = Top; Index + 2 < Bottom; Index++) {
- String = ArrayOfStrings[Count];
- Count++;
-
- //
- // This will clear the background of the line - we never know who might have been
- // here before us. This differs from the next clear in that it used the non-reverse
- // video for normal printing.
- //
- if (GetStringWidth (String) / 2 > 1) {
- ClearLines (Start, End, Index + 1, Index + 1, POPUP_TEXT | POPUP_BACKGROUND);
- }
- //
- // Passing in a space results in the assumption that this is where typing will occur
- //
- if (String[0] == L' ') {
- ClearLines (Start + 1, End - 1, Index + 1, Index + 1, POPUP_INVERSE_TEXT | POPUP_INVERSE_BACKGROUND);
- }
- //
- // Passing in a NULL results in a blank space
- //
- if (String[0] == CHAR_NULL) {
- ClearLines (Start, End, Index + 1, Index + 1, POPUP_TEXT | POPUP_BACKGROUND);
- }
-
- PrintStringAt (
- ((DimensionsWidth - GetStringWidth (String) / 2) / 2) + gScreenDimensions.LeftColumn + 1,
- Index + 1,
- String
- );
- gST->ConOut->SetAttribute (gST->ConOut, POPUP_TEXT | POPUP_BACKGROUND);
- PrintCharAt (Start, Index + 1, Character);
- PrintCharAt (End - 1, Index + 1, Character);
- }
-
- Character = (CHAR16) BOXDRAW_UP_RIGHT;
- PrintCharAt (Start, Bottom - 1, Character);
- Character = (CHAR16) BOXDRAW_HORIZONTAL;
- for (Index = Start; Index + 2 < End; Index++) {
- PrintChar (Character);
- }
-
- Character = (CHAR16) BOXDRAW_UP_LEFT;
- PrintChar (Character);
-}
-
-VOID
-CreatePopUp (
- IN UINTN RequestedWidth,
- IN UINTN NumberOfLines,
- IN CHAR16 *ArrayOfStrings,
- ...
- )
-{
- CreateSharedPopUp (RequestedWidth, NumberOfLines, &ArrayOfStrings);
-}
-
-VOID
-UpdateStatusBar (
- IN UINTN MessageType,
- IN UINT8 Flags,
- IN BOOLEAN State
- )
-{
- UINTN Index;
- STATIC BOOLEAN InputError;
- CHAR16 *NvUpdateMessage;
- CHAR16 *InputErrorMessage;
-
- NvUpdateMessage = GetToken (STRING_TOKEN (NV_UPDATE_MESSAGE), gHiiHandle);
- InputErrorMessage = GetToken (STRING_TOKEN (INPUT_ERROR_MESSAGE), gHiiHandle);
-
- switch (MessageType) {
- case INPUT_ERROR:
- if (State) {
- gST->ConOut->SetAttribute (gST->ConOut, ERROR_TEXT);
- PrintStringAt (
- gScreenDimensions.LeftColumn + gPromptBlockWidth,
- gScreenDimensions.BottomRow - 1,
- InputErrorMessage
- );
- InputError = TRUE;
- } else {
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT_HIGHLIGHT);
- for (Index = 0; Index < (GetStringWidth (InputErrorMessage) - 2) / 2; Index++) {
- PrintAt (gScreenDimensions.LeftColumn + gPromptBlockWidth + Index, gScreenDimensions.BottomRow - 1, (CHAR16 *) L" ");
- }
-
- InputError = FALSE;
- }
- break;
-
- case NV_UPDATE_REQUIRED:
- if (gClassOfVfr != EFI_FRONT_PAGE_SUBCLASS) {
- if (State) {
- gST->ConOut->SetAttribute (gST->ConOut, INFO_TEXT);
- PrintStringAt (
- gScreenDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth,
- gScreenDimensions.BottomRow - 1,
- NvUpdateMessage
- );
- gResetRequired = (BOOLEAN) (gResetRequired | ((Flags & EFI_IFR_FLAG_RESET_REQUIRED) == EFI_IFR_FLAG_RESET_REQUIRED));
-
- gNvUpdateRequired = TRUE;
- } else {
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT_HIGHLIGHT);
- for (Index = 0; Index < (GetStringWidth (NvUpdateMessage) - 2) / 2; Index++) {
- PrintAt (
- (gScreenDimensions.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + Index),
- gScreenDimensions.BottomRow - 1,
- (CHAR16 *) L" "
- );
- }
-
- gNvUpdateRequired = FALSE;
- }
- }
- break;
-
- case REFRESH_STATUS_BAR:
- if (InputError) {
- UpdateStatusBar (INPUT_ERROR, Flags, TRUE);
- }
-
- if (gNvUpdateRequired) {
- UpdateStatusBar (NV_UPDATE_REQUIRED, Flags, TRUE);
- }
- break;
-
- default:
- break;
- }
-
- FreePool (InputErrorMessage);
- FreePool (NvUpdateMessage);
- return ;
-}
-
-VOID
-FreeData (
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN CHAR16 *FormattedString,
- IN CHAR16 *OptionString
- )
-/*++
-
-Routine Description:
-
- Used to remove the allocated data instances
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_FILE_FORM_TAGS *FileForm;
- EFI_FILE_FORM_TAGS *PreviousFileForm;
- EFI_FORM_TAGS *FormTags;
- EFI_FORM_TAGS *PreviousFormTags;
- EFI_IFR_BINARY *IfrBinary;
- EFI_IFR_BINARY *PreviousIfrBinary;
- EFI_INCONSISTENCY_DATA *Inconsistent;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
- EFI_VARIABLE_DEFINITION *PreviousVariableDefinition;
- VOID *Buffer;
- UINTN Index;
-
- FileForm = FileFormTagsHead;
-
- if (FormattedString != NULL) {
- FreePool (FormattedString);
- }
-
- if (OptionString != NULL) {
- FreePool (OptionString);
- }
-
- for (; FileForm != NULL;) {
- PreviousFileForm = NULL;
-
- //
- // Advance FileForm to the last entry
- //
- for (; FileForm->NextFile != NULL; FileForm = FileForm->NextFile) {
- PreviousFileForm = FileForm;
- }
-
- FormTags = &FileForm->FormTags;
-
- for (; FormTags != NULL;) {
- FormTags = &FileForm->FormTags;
- PreviousFormTags = NULL;
-
- //
- // Advance FormTags to the last entry
- //
- for (; FormTags->Next != NULL; FormTags = FormTags->Next) {
- PreviousFormTags = FormTags;
- }
- //
- // Walk through each of the tags and free the IntList allocation
- //
- for (Index = 0; FormTags->Tags[Index].Operand != EFI_IFR_END_FORM_OP; Index++) {
- //
- // It is more than likely that the very last page will contain an end formset
- //
- if (FormTags->Tags[Index].Operand == EFI_IFR_END_FORM_SET_OP) {
- break;
- }
-
- if (FormTags->Tags[Index].IntList != NULL) {
- FreePool (FormTags->Tags[Index].IntList);
- }
- }
-
- if (PreviousFormTags != NULL) {
- FreePool (FormTags->Tags);
- FormTags = PreviousFormTags;
- FreePool (FormTags->Next);
- FormTags->Next = NULL;
- } else {
- FreePool (FormTags->Tags);
- FormTags = NULL;
- }
- }
- //
- // Last FileForm entry's Inconsistent database
- //
- Inconsistent = FileForm->InconsistentTags;
-
- //
- // Advance Inconsistent to the last entry
- //
- for (; Inconsistent->Next != NULL; Inconsistent = Inconsistent->Next)
- ;
-
- for (; Inconsistent != NULL;) {
- //
- // Preserve the Previous pointer
- //
- Buffer = (VOID *) Inconsistent->Previous;
-
- //
- // Free the current entry
- //
- FreePool (Inconsistent);
-
- //
- // Restore the Previous pointer
- //
- Inconsistent = (EFI_INCONSISTENCY_DATA *) Buffer;
- }
-
- VariableDefinition = FileForm->VariableDefinitions;
-
- for (; VariableDefinition != NULL;) {
- VariableDefinition = FileForm->VariableDefinitions;
- PreviousVariableDefinition = NULL;
-
- //
- // Advance VariableDefinitions to the last entry
- //
- for (; VariableDefinition->Next != NULL; VariableDefinition = VariableDefinition->Next) {
- PreviousVariableDefinition = VariableDefinition;
- }
-
- FreePool (VariableDefinition->VariableName);
-
- if (VariableDefinition->NvRamMap != NULL) {
- FreePool (VariableDefinition->NvRamMap);
- }
-
- if (VariableDefinition->FakeNvRamMap != NULL) {
- FreePool (VariableDefinition->FakeNvRamMap);
- }
-
- if (PreviousVariableDefinition != NULL) {
- VariableDefinition = PreviousVariableDefinition;
- FreePool (VariableDefinition->Next);
- VariableDefinition->Next = NULL;
- } else {
- FreePool (VariableDefinition);
- VariableDefinition = NULL;
- }
- }
-
- if (PreviousFileForm != NULL) {
- FileForm = PreviousFileForm;
- FreePool (FileForm->NextFile);
- FileForm->NextFile = NULL;
- } else {
- FreePool (FileForm);
- FileForm = NULL;
- }
- }
-
- IfrBinary = gBinaryDataHead;
-
- for (; IfrBinary != NULL;) {
- IfrBinary = gBinaryDataHead;
- PreviousIfrBinary = NULL;
-
- //
- // Advance IfrBinary to the last entry
- //
- for (; IfrBinary->Next != NULL; IfrBinary = IfrBinary->Next) {
- PreviousIfrBinary = IfrBinary;
- }
-
- FreePool (IfrBinary->IfrPackage);
-
- if (PreviousIfrBinary != NULL) {
- IfrBinary = PreviousIfrBinary;
- FreePool (IfrBinary->Next);
- IfrBinary->Next = NULL;
- } else {
- FreePool (IfrBinary);
- IfrBinary = NULL;
- }
- }
-
- FreePool (gPreviousValue);
- gPreviousValue = NULL;
-
- //
- // Free Browser Strings
- //
- FreePool (gPressEnter);
- FreePool (gConfirmError);
- FreePool (gConfirmPassword);
- FreePool (gPromptForNewPassword);
- FreePool (gPromptForPassword);
- FreePool (gToggleCheckBox);
- FreePool (gNumericInput);
- FreePool (gMakeSelection);
- FreePool (gMoveHighlight);
- FreePool (gEscapeString);
- FreePool (gEnterCommitString);
- FreePool (gEnterString);
- FreePool (gFunctionOneString);
- FreePool (gFunctionTwoString);
- FreePool (gFunctionNineString);
- FreePool (gFunctionTenString);
- return ;
-}
-
-STATIC
-BOOLEAN
-SelectionsAreValid (
- IN UI_MENU_OPTION *MenuOption,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead
- )
-/*++
-
-Routine Description:
- Initiate late consistency checks against the current page.
-
-Arguments:
- None
-
-Returns:
-
---*/
-{
- LIST_ENTRY *Link;
- EFI_TAG *Tag;
- EFI_FILE_FORM_TAGS *FileFormTags;
- CHAR16 *StringPtr;
- CHAR16 NullCharacter;
- UINTN Index;
- UINT16 *NvRamMap;
- STRING_REF PopUp;
- EFI_INPUT_KEY Key;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
-
- StringPtr = (CHAR16 *) L"\0";
- NullCharacter = CHAR_NULL;
-
- FileFormTags = FileFormTagsHead;
-
- for (Index = 0; Index < MenuOption->IfrNumber; Index++) {
- FileFormTags = FileFormTags->NextFile;
- }
-
- for (Link = Menu.ForwardLink; Link != &Menu; Link = Link->ForwardLink) {
- MenuOption = CR (Link, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
-
- Tag = MenuOption->ThisTag;
-
- ExtractRequestedNvMap (FileFormTags, Tag->VariableNumber, &VariableDefinition);
- NvRamMap = (UINT16 *) &VariableDefinition->NvRamMap[Tag->StorageStart];
-
- //
- // If the op-code has a late check, ensure consistency checks are now applied
- //
- if (Tag->Flags & EFI_IFR_FLAG_LATE_CHECK) {
- if (ValueIsNotValid (TRUE, 0, Tag, FileFormTags, &PopUp)) {
- if (PopUp != 0x0000) {
- StringPtr = GetToken (PopUp, MenuOption->Handle);
-
- CreatePopUp (GetStringWidth (StringPtr) / 2, 3, &NullCharacter, StringPtr, &NullCharacter);
-
- do {
- WaitForKeyStroke (&Key);
-
- switch (Key.UnicodeChar) {
-
- case CHAR_CARRIAGE_RETURN:
- //
- // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth
- //
- CopyMem (NvRamMap, &Tag->OldValue, Tag->StorageWidth);
- FreePool (StringPtr);
- break;
-
- default:
- break;
- }
- } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- }
-
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-UINT16
-GetWidth (
- IN EFI_TAG *Tag,
- IN EFI_HII_HANDLE Handle
- )
-/*++
-
-Routine Description:
- Get the supported width for a particular op-code
-
-Arguments:
- Tag - The Tag structure passed in.
- Handle - The handle in the HII database being used
-
-Returns:
- Returns the number of CHAR16 characters that is support.
-
-
---*/
-{
- CHAR16 *String;
- UINTN Size;
-
- Size = 0x00;
-
- //
- // See if the second text parameter is really NULL
- //
- if ((Tag->Operand == EFI_IFR_TEXT_OP) && (Tag->TextTwo != 0)) {
- String = GetToken (Tag->TextTwo, Handle);
- Size = StrLen (String);
- FreePool (String);
- }
-
- if ((Tag->Operand == EFI_IFR_SUBTITLE_OP) ||
- (Tag->Operand == EFI_IFR_REF_OP) ||
- (Tag->Operand == EFI_IFR_PASSWORD_OP) ||
- (Tag->Operand == EFI_IFR_STRING_OP) ||
- (Tag->Operand == EFI_IFR_INVENTORY_OP) ||
- //
- // Allow a wide display if text op-code and no secondary text op-code
- //
- ((Tag->Operand == EFI_IFR_TEXT_OP) && (Size == 0x0000))
- ) {
- return (UINT16) (gPromptBlockWidth + gOptionBlockWidth);
- } else {
- return (UINT16) gPromptBlockWidth;
- }
-}
-
-UINT16
-GetLineByWidth (
- IN CHAR16 *InputString,
- IN UINT16 LineWidth,
- IN OUT UINTN *Index,
- OUT CHAR16 **OutputString
- )
-/*++
-
-Routine Description:
- Will copy LineWidth amount of a string in the OutputString buffer and return the
- number of CHAR16 characters that were copied into the OutputString buffer.
-
-Arguments:
- InputString - String description for this option.
- LineWidth - Width of the desired string to extract in CHAR16 characters
- Index - Where in InputString to start the copy process
- OutputString - Buffer to copy the string into
-
-Returns:
- Returns the number of CHAR16 characters that were copied into the OutputString buffer.
-
-
---*/
-{
- static BOOLEAN Finished;
- UINT16 Count;
- UINT16 Count2;
-
- if (Finished) {
- Finished = FALSE;
- return (UINT16) 0;
- }
-
- Count = LineWidth;
- Count2 = 0;
-
- *OutputString = AllocateZeroPool (((UINTN) (LineWidth + 1) * 2));
-
- //
- // Ensure we have got a valid buffer
- //
- if (*OutputString != NULL) {
-
- //
- //NARROW_CHAR can not be printed in screen, so if a line only contain the two CHARs: 'NARROW_CHAR + CHAR_CARRIAGE_RETURN' , it is a empty line in Screen.
- //To avoid displaying this empty line in screen, just skip the two CHARs here.
- //
- if ((InputString[*Index] == NARROW_CHAR) && (InputString[*Index + 1] == CHAR_CARRIAGE_RETURN)) {
- *Index = *Index + 2;
- }
-
- //
- // Fast-forward the string and see if there is a carriage-return in the string
- //
- for (; (InputString[*Index + Count2] != CHAR_CARRIAGE_RETURN) && (Count2 != LineWidth); Count2++)
- ;
-
- //
- // Copy the desired LineWidth of data to the output buffer.
- // Also make sure that we don't copy more than the string.
- // Also make sure that if there are linefeeds, we account for them.
- //
- if ((StrSize (&InputString[*Index]) <= ((UINTN) (LineWidth + 1) * 2)) &&
- (StrSize (&InputString[*Index]) <= ((UINTN) (Count2 + 1) * 2))
- ) {
- //
- // Convert to CHAR16 value and show that we are done with this operation
- //
- LineWidth = (UINT16) ((StrSize (&InputString[*Index]) - 2) / 2);
- if (LineWidth != 0) {
- Finished = TRUE;
- }
- } else {
- if (Count2 == LineWidth) {
- //
- // Rewind the string from the maximum size until we see a space to break the line
- //
- for (; (InputString[*Index + LineWidth] != CHAR_SPACE) && (LineWidth != 0); LineWidth--)
- ;
- if (LineWidth == 0) {
- LineWidth = Count;
- }
- } else {
- LineWidth = Count2;
- }
- }
-
- CopyMem (*OutputString, &InputString[*Index], LineWidth * 2);
-
- //
- // If currently pointing to a space, increment the index to the first non-space character
- //
- for (;
- (InputString[*Index + LineWidth] == CHAR_SPACE) || (InputString[*Index + LineWidth] == CHAR_CARRIAGE_RETURN);
- (*Index)++
- )
- ;
- *Index = (UINT16) (*Index + LineWidth);
- return LineWidth;
- } else {
- return (UINT16) 0;
- }
-}
-
-STATIC
-VOID
-UpdateOptionSkipLines (
- IN EFI_IFR_DATA_ARRAY *PageData,
- IN UI_MENU_OPTION *MenuOption,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN CHAR16 **OptionalString,
- IN UINTN SkipValue
- )
-{
- UINTN Index;
- UINT16 Width;
- UINTN Row;
- UINTN OriginalRow;
- CHAR16 *OutputString;
- CHAR16 *OptionString;
-
- Row = 0;
- OptionString = *OptionalString;
- OutputString = NULL;
-
- ProcessOptions (MenuOption, FALSE, FileFormTagsHead, PageData, &OptionString);
-
- if (OptionString != NULL) {
- Width = (UINT16) gOptionBlockWidth;
-
- OriginalRow = Row;
-
- for (Index = 0; GetLineByWidth (OptionString, Width, &Index, &OutputString) != 0x0000;) {
- //
- // If there is more string to process print on the next row and increment the Skip value
- //
- if (StrLen (&OptionString[Index])) {
- if (SkipValue == 0) {
- Row++;
- //
- // Since the Number of lines for this menu entry may or may not be reflected accurately
- // since the prompt might be 1 lines and option might be many, and vice versa, we need to do
- // some testing to ensure we are keeping this in-sync.
- //
- // If the difference in rows is greater than or equal to the skip value, increase the skip value
- //
- if ((Row - OriginalRow) >= MenuOption->Skip) {
- MenuOption->Skip++;
- }
- }
- }
-
- FreePool (OutputString);
- if (SkipValue != 0) {
- SkipValue--;
- }
- }
-
- Row = OriginalRow;
- }
-
- *OptionalString = OptionString;
-}
-//
-// Search table for UiDisplayMenu()
-//
-SCAN_CODE_TO_SCREEN_OPERATION gScanCodeToOperation[] = {
- { SCAN_UP, UiUp },
- { SCAN_DOWN, UiDown },
- { SCAN_PAGE_UP, UiPageUp },
- { SCAN_PAGE_DOWN, UiPageDown},
- { SCAN_ESC, UiReset},
- { SCAN_F2, UiPrevious},
- { SCAN_LEFT, UiLeft },
- { SCAN_RIGHT, UiRight },
- { SCAN_F9, UiDefault},
- { SCAN_F10, UiSave }
-};
-
-SCREEN_OPERATION_T0_CONTROL_FLAG gScreenOperationToControlFlag[] = {
- { UiNoOperation, CfUiNoOperation },
- { UiDefault, CfUiDefault },
- { UiSelect, CfUiSelect },
- { UiUp, CfUiUp},
- { UiDown, CfUiDown },
- { UiLeft, CfUiLeft },
- { UiRight, CfUiRight },
- { UiReset, CfUiReset },
- { UiSave, CfUiSave },
- { UiPrevious, CfUiPrevious },
- { UiPageUp, CfUiPageUp },
- { UiPageDown, CfUiPageDown }
-};
-
-UI_MENU_OPTION *
-UiDisplayMenu (
- IN BOOLEAN SubMenu,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- OUT EFI_IFR_DATA_ARRAY *PageData
- )
-/*++
-
-Routine Description:
- Display menu and wait for user to select one menu option, then return it.
- If AutoBoot is enabled, then if user doesn't select any option,
- after period of time, it will automatically return the first menu option.
-
-Arguments:
- SubMenu - Indicate is sub menu.
- FileFormTagsHead - A pointer to the EFI_FILE_FORM_TAGS structure.
- PageData - A pointer to the EFI_IFR_DATA_ARRAY.
-
-Returns:
- Return the pointer of the menu which selected,
- otherwise return NULL.
-
---*/
-{
- INTN SkipValue;
- INTN Difference;
- INTN OldSkipValue;
- UINTN Row;
- UINTN Col;
- UINTN Temp;
- UINTN Temp2;
- UINTN TopRow;
- UINTN BottomRow;
- UINTN OriginalRow;
- UINTN Index;
- UINTN DataAndTimeLineNumberPad;
- UINT32 Count;
- INT16 OriginalTimeOut;
- UINT8 *Location;
- UINT16 Width;
- CHAR16 *StringPtr;
- CHAR16 *OptionString;
- CHAR16 *OutputString;
- CHAR16 *FormattedString;
- CHAR16 YesResponse;
- CHAR16 NoResponse;
- BOOLEAN NewLine;
- BOOLEAN Repaint;
- BOOLEAN SavedValue;
- EFI_STATUS Status;
- UI_MENU_LIST *UiMenuList;
- EFI_INPUT_KEY Key;
- LIST_ENTRY *Link;
- LIST_ENTRY *NewPos;
- LIST_ENTRY *TopOfScreen;
- LIST_ENTRY *SavedListEntry;
- UI_MENU_OPTION *Selection;
- UI_MENU_OPTION *MenuOption;
- UI_MENU_OPTION *NextMenuOption;
- UI_MENU_OPTION *SavedMenuOption;
- UI_MENU_OPTION *PreviousMenuOption;
- EFI_IFR_BINARY *IfrBinary;
- UI_CONTROL_FLAG ControlFlag;
- EFI_SCREEN_DESCRIPTOR LocalScreen;
- EFI_FILE_FORM_TAGS *FileFormTags;
- MENU_REFRESH_ENTRY *MenuRefreshEntry;
- MENU_REFRESH_ENTRY *OldMenuRefreshEntry;
- UI_SCREEN_OPERATION ScreenOperation;
- EFI_VARIABLE_DEFINITION *VariableDefinition;
- EFI_FORM_CALLBACK_PROTOCOL *FormCallback;
- EFI_HII_VARIABLE_PACK_LIST *NvMapListHead;
- EFI_HII_VARIABLE_PACK_LIST *NvMapListNode;
- VOID *NvMap;
- UINTN NvMapSize;
-
- CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));
-
- VariableDefinition = NULL;
- Status = EFI_SUCCESS;
- FormattedString = NULL;
- OptionString = NULL;
- ScreenOperation = UiNoOperation;
- NewLine = TRUE;
- FormCallback = NULL;
- FileFormTags = NULL;
- OutputString = NULL;
- gUpArrow = FALSE;
- gDownArrow = FALSE;
- SkipValue = 0;
- OldSkipValue = 0;
- MenuRefreshEntry = gMenuRefreshHead;
- OldMenuRefreshEntry = gMenuRefreshHead;
- NextMenuOption = NULL;
- PreviousMenuOption = NULL;
- SavedMenuOption = NULL;
- IfrBinary = NULL;
- NvMap = NULL;
- NvMapSize = 0;
-
- ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
-
- if (gClassOfVfr == EFI_FRONT_PAGE_SUBCLASS) {
- TopRow = LocalScreen.TopRow + FRONT_PAGE_HEADER_HEIGHT + SCROLL_ARROW_HEIGHT;
- Row = LocalScreen.TopRow + FRONT_PAGE_HEADER_HEIGHT + SCROLL_ARROW_HEIGHT;
- } else {
- TopRow = LocalScreen.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT + SCROLL_ARROW_HEIGHT;
- Row = LocalScreen.TopRow + NONE_FRONT_PAGE_HEADER_HEIGHT + SCROLL_ARROW_HEIGHT;
- }
-
- if (SubMenu) {
- Col = LocalScreen.LeftColumn;
- } else {
- Col = LocalScreen.LeftColumn + LEFT_SKIPPED_COLUMNS;
- }
-
- BottomRow = LocalScreen.BottomRow - STATUS_BAR_HEIGHT - FOOTER_HEIGHT - SCROLL_ARROW_HEIGHT - 1;
-
- TopOfScreen = Menu.ForwardLink;
- Repaint = TRUE;
- MenuOption = NULL;
-
- //
- // Get user's selection
- //
- Selection = NULL;
- NewPos = Menu.ForwardLink;
- gST->ConOut->EnableCursor (gST->ConOut, FALSE);
-
- UpdateStatusBar (REFRESH_STATUS_BAR, (UINT8) 0, TRUE);
-
- ControlFlag = CfInitialization;
-
- while (TRUE) {
- switch (ControlFlag) {
- case CfInitialization:
- ControlFlag = CfCheckSelection;
- if (gExitRequired) {
- ScreenOperation = UiReset;
- ControlFlag = CfScreenOperation;
- } else if (gSaveRequired) {
- ScreenOperation = UiSave;
- ControlFlag = CfScreenOperation;
- } else if (IsListEmpty (&Menu)) {
- ControlFlag = CfReadKey;
- }
- break;
-
- case CfCheckSelection:
- if (Selection != NULL) {
- ControlFlag = CfExit;
- } else {
- ControlFlag = CfRepaint;
- }
-
- FileFormTags = FileFormTagsHead;
- break;
-
- case CfRepaint:
- ControlFlag = CfRefreshHighLight;
-
- if (Repaint) {
- //
- // Display menu
- //
- SavedMenuOption = MenuOption;
- gDownArrow = FALSE;
- gUpArrow = FALSE;
- Row = TopRow;
-
- Temp = SkipValue;
- Temp2 = SkipValue;
-
- ClearLines (
- LocalScreen.LeftColumn,
- LocalScreen.RightColumn,
- TopRow - SCROLL_ARROW_HEIGHT,
- BottomRow + SCROLL_ARROW_HEIGHT,
- FIELD_TEXT | FIELD_BACKGROUND
- );
-
- while (gMenuRefreshHead != NULL) {
- OldMenuRefreshEntry = gMenuRefreshHead->Next;
-
- FreePool (gMenuRefreshHead);
-
- gMenuRefreshHead = OldMenuRefreshEntry;
- }
-
- for (Link = TopOfScreen; Link != &Menu; Link = Link->ForwardLink) {
- MenuOption = CR (Link, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- MenuOption->Row = Row;
- OriginalRow = Row;
- MenuOption->Col = Col;
- MenuOption->OptCol = gPromptBlockWidth + 1 + LocalScreen.LeftColumn;
-
- if (SubMenu) {
- if (MenuOption->ThisTag->GrayOut) {
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT_GRAYED | FIELD_BACKGROUND);
- } else {
- if (MenuOption->ThisTag->Operand == EFI_IFR_SUBTITLE_OP) {
- gST->ConOut->SetAttribute (gST->ConOut, SUBTITLE_TEXT | FIELD_BACKGROUND);
- }
- }
-
- Width = GetWidth (MenuOption->ThisTag, MenuOption->Handle);
-
- OriginalRow = Row;
-
- for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &Index, &OutputString) != 0x0000;) {
- if ((Temp == 0) && (Row <= BottomRow)) {
- PrintStringAt (Col, Row, OutputString);
- }
- //
- // If there is more string to process print on the next row and increment the Skip value
- //
- if (StrLen (&MenuOption->Description[Index])) {
- if (Temp == 0) {
- Row++;
- }
- }
-
- FreePool (OutputString);
- if (Temp != 0) {
- Temp--;
- }
- }
-
- Temp = 0;
-
- Row = OriginalRow;
-
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);
- ProcessOptions (MenuOption, FALSE, FileFormTagsHead, PageData, &OptionString);
-
- if (OptionString != NULL) {
- if (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP ||
- MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP
- ) {
- //
- // If leading spaces on OptionString - remove the spaces
- //
- for (Index = 0; OptionString[Index] == L' '; Index++) {
- MenuOption->OptCol++;
- }
-
- for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {
- OptionString[Count] = OptionString[Index];
- Count++;
- }
-
- OptionString[Count] = CHAR_NULL;
- }
-
- //
- // If this is a date or time op-code and is used to reflect an RTC, register the op-code
- //
- if ((MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP ||
- MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP) &&
- (MenuOption->ThisTag->StorageStart >= FileFormTags->FormTags.Tags[0].NvDataSize)) {
-
- if (gMenuRefreshHead == NULL) {
- MenuRefreshEntry = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
- ASSERT (MenuRefreshEntry != NULL);
- MenuRefreshEntry->MenuOption = MenuOption;
- MenuRefreshEntry->FileFormTagsHead = FileFormTagsHead;
- MenuRefreshEntry->CurrentColumn = MenuOption->OptCol;
- MenuRefreshEntry->CurrentRow = MenuOption->Row;
- MenuRefreshEntry->CurrentAttribute = FIELD_TEXT | FIELD_BACKGROUND;
- gMenuRefreshHead = MenuRefreshEntry;
- } else {
- //
- // Advance to the last entry
- //
- for (MenuRefreshEntry = gMenuRefreshHead;
- MenuRefreshEntry->Next != NULL;
- MenuRefreshEntry = MenuRefreshEntry->Next
- )
- ;
- MenuRefreshEntry->Next = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
- ASSERT (MenuRefreshEntry->Next != NULL);
- MenuRefreshEntry = MenuRefreshEntry->Next;
- MenuRefreshEntry->MenuOption = MenuOption;
- MenuRefreshEntry->FileFormTagsHead = FileFormTagsHead;
- MenuRefreshEntry->CurrentColumn = MenuOption->OptCol;
- MenuRefreshEntry->CurrentRow = MenuOption->Row;
- MenuRefreshEntry->CurrentAttribute = FIELD_TEXT | FIELD_BACKGROUND;
- }
- }
-
- Width = (UINT16) gOptionBlockWidth;
-
- OriginalRow = Row;
-
- for (Index = 0; GetLineByWidth (OptionString, Width, &Index, &OutputString) != 0x0000;) {
- if ((Temp2 == 0) && (Row <= BottomRow)) {
- PrintStringAt (MenuOption->OptCol, Row, OutputString);
- }
- //
- // If there is more string to process print on the next row and increment the Skip value
- //
- if (StrLen (&OptionString[Index])) {
- if (Temp2 == 0) {
- Row++;
- //
- // Since the Number of lines for this menu entry may or may not be reflected accurately
- // since the prompt might be 1 lines and option might be many, and vice versa, we need to do
- // some testing to ensure we are keeping this in-sync.
- //
- // If the difference in rows is greater than or equal to the skip value, increase the skip value
- //
- if ((Row - OriginalRow) >= MenuOption->Skip) {
- MenuOption->Skip++;
- }
- }
- }
-
- FreePool (OutputString);
- if (Temp2 != 0) {
- Temp2--;
- }
- }
-
- Temp2 = 0;
- Row = OriginalRow;
- }
- //
- // If this is a text op with secondary text information
- //
- if ((MenuOption->ThisTag->Operand == EFI_IFR_TEXT_OP) && (MenuOption->ThisTag->TextTwo != 0)) {
- StringPtr = GetToken (MenuOption->ThisTag->TextTwo, MenuOption->Handle);
-
- Width = (UINT16) gOptionBlockWidth;
-
- OriginalRow = Row;
-
- for (Index = 0; GetLineByWidth (StringPtr, Width, &Index, &OutputString) != 0x0000;) {
- if ((Temp == 0) && (Row <= BottomRow)) {
- PrintStringAt (MenuOption->OptCol, Row, OutputString);
- }
- //
- // If there is more string to process print on the next row and increment the Skip value
- //
- if (StrLen (&StringPtr[Index])) {
- if (Temp2 == 0) {
- Row++;
- //
- // Since the Number of lines for this menu entry may or may not be reflected accurately
- // since the prompt might be 1 lines and option might be many, and vice versa, we need to do
- // some testing to ensure we are keeping this in-sync.
- //
- // If the difference in rows is greater than or equal to the skip value, increase the skip value
- //
- if ((Row - OriginalRow) >= MenuOption->Skip) {
- MenuOption->Skip++;
- }
- }
- }
-
- FreePool (OutputString);
- if (Temp2 != 0) {
- Temp2--;
- }
- }
-
- Row = OriginalRow;
- FreePool (StringPtr);
- }
- } else {
- //
- // For now, assume left-justified 72 width max setup entries
- //
- PrintStringAt (Col, Row, MenuOption->Description);
- }
- //
- // Tracker 6210 - need to handle the bottom of the display
- //
- if (MenuOption->Skip > 1) {
- Row += MenuOption->Skip - SkipValue;
- SkipValue = 0;
- } else {
- Row += MenuOption->Skip;
- }
-
- if (Row > BottomRow) {
- if (!ValueIsScroll (FALSE, Link)) {
- gDownArrow = TRUE;
- }
-
- Row = BottomRow + 1;
- break;
- }
- }
-
- if (!ValueIsScroll (TRUE, TopOfScreen)) {
- gUpArrow = TRUE;
- }
-
- if (gUpArrow) {
- gST->ConOut->SetAttribute (gST->ConOut, ARROW_TEXT | ARROW_BACKGROUND);
- PrintAt (
- LocalScreen.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + 1,
- TopRow - SCROLL_ARROW_HEIGHT,
- (CHAR16 *) L"%c",
- ARROW_UP
- );
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);
- }
-
- if (gDownArrow) {
- gST->ConOut->SetAttribute (gST->ConOut, ARROW_TEXT | ARROW_BACKGROUND);
- PrintAt (
- LocalScreen.LeftColumn + gPromptBlockWidth + gOptionBlockWidth + 1,
- BottomRow + SCROLL_ARROW_HEIGHT,
- (CHAR16 *) L"%c",
- ARROW_DOWN
- );
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);
- }
-
- if (SavedMenuOption != NULL) {
- MenuOption = SavedMenuOption;
- }
- }
- break;
-
- case CfRefreshHighLight:
- ControlFlag = CfUpdateHelpString;
- //
- // Repaint flag is normally reset when finish processing CfUpdateHelpString. Temporarily
- // reset Repaint flag because we may break halfway and skip CfUpdateHelpString processing.
- //
- SavedValue = Repaint;
- Repaint = FALSE;
-
- if (NewPos != NULL) {
- gST->ConOut->SetCursorPosition (gST->ConOut, MenuOption->Col, MenuOption->Row);
- if (SubMenu) {
- if (gLastOpr && (gEntryNumber != -1)) {
- MenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- if (gEntryNumber != MenuOption->EntryNumber) {
- ScreenOperation = UiDown;
- ControlFlag = CfScreenOperation;
- break;
- } else {
- gLastOpr = FALSE;
- }
- }
-
- ProcessOptions (MenuOption, FALSE, FileFormTagsHead, PageData, &OptionString);
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);
- if (OptionString != NULL) {
- if (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP ||
- MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP
- ) {
- //
- // If leading spaces on OptionString - remove the spaces
- //
- for (Index = 0; OptionString[Index] == L' '; Index++)
- ;
-
- for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {
- OptionString[Count] = OptionString[Index];
- Count++;
- }
-
- OptionString[Count] = CHAR_NULL;
- }
-
- Width = (UINT16) gOptionBlockWidth;
-
- OriginalRow = MenuOption->Row;
-
- for (Index = 0; GetLineByWidth (OptionString, Width, &Index, &OutputString) != 0x0000;) {
- if (MenuOption->Row >= TopRow && MenuOption->Row <= BottomRow) {
- PrintStringAt (MenuOption->OptCol, MenuOption->Row, OutputString);
- }
- //
- // If there is more string to process print on the next row and increment the Skip value
- //
- if (StrLen (&OptionString[Index])) {
- MenuOption->Row++;
- }
-
- FreePool (OutputString);
- }
-
- MenuOption->Row = OriginalRow;
- } else {
- if (NewLine) {
- if (MenuOption->ThisTag->GrayOut) {
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT_GRAYED | FIELD_BACKGROUND);
- } else {
- if (MenuOption->ThisTag->Operand == EFI_IFR_SUBTITLE_OP) {
- gST->ConOut->SetAttribute (gST->ConOut, SUBTITLE_TEXT | FIELD_BACKGROUND);
- }
- }
-
- OriginalRow = MenuOption->Row;
- Width = GetWidth (MenuOption->ThisTag, MenuOption->Handle);
-
- for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &Index, &OutputString) != 0x0000;) {
- if (MenuOption->Row >= TopRow && MenuOption->Row <= BottomRow) {
- PrintStringAt (Col, MenuOption->Row, OutputString);
- }
- //
- // If there is more string to process print on the next row and increment the Skip value
- //
- if (StrLen (&MenuOption->Description[Index])) {
- MenuOption->Row++;
- }
-
- FreePool (OutputString);
- }
-
- MenuOption->Row = OriginalRow;
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);
- }
- }
- } else {
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);
- gST->ConOut->OutputString (gST->ConOut, MenuOption->Description);
- }
-
- MenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
-
- if ((gPriorMenuEntry != 0) && (MenuOption->EntryNumber != gPriorMenuEntry) && (NewPos->ForwardLink != &Menu)) {
- ScreenOperation = UiDown;
- ControlFlag = CfScreenOperation;
- break;
- } else {
- gPriorMenuEntry = 0;
- }
- //
- // This is only possible if we entered this page and the first menu option is
- // a "non-menu" item. In that case, force it UiDown
- //
- if (MenuOption->ThisTag->Operand == EFI_IFR_SUBTITLE_OP || MenuOption->ThisTag->GrayOut) {
- //
- // If we previously hit an UP command and we are still sitting on a text operation
- // we must continue going up
- //
- if (ScreenOperation == UiUp) {
- ControlFlag = CfScreenOperation;
- break;
- } else {
- ScreenOperation = UiDown;
- ControlFlag = CfScreenOperation;
- break;
- }
- }
- //
- // Set reverse attribute
- //
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT_HIGHLIGHT | FIELD_BACKGROUND_HIGHLIGHT);
- gST->ConOut->SetCursorPosition (gST->ConOut, MenuOption->Col, MenuOption->Row);
-
- //
- // Assuming that we have a refresh linked-list created, lets annotate the
- // appropriate entry that we are highlighting with its new attribute. Just prior to this
- // lets reset all of the entries' attribute so we do not get multiple highlights in he refresh
- //
- if (gMenuRefreshHead != NULL) {
- for (MenuRefreshEntry = gMenuRefreshHead; MenuRefreshEntry != NULL; MenuRefreshEntry = MenuRefreshEntry->Next) {
- MenuRefreshEntry->CurrentAttribute = FIELD_TEXT | FIELD_BACKGROUND;
- if (MenuRefreshEntry->MenuOption == MenuOption) {
- MenuRefreshEntry->CurrentAttribute = FIELD_TEXT_HIGHLIGHT | FIELD_BACKGROUND_HIGHLIGHT;
- }
- }
- }
-
- if (SubMenu) {
- ProcessOptions (MenuOption, FALSE, FileFormTagsHead, PageData, &OptionString);
- if (OptionString != NULL) {
- if (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP ||
- MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP
- ) {
- //
- // If leading spaces on OptionString - remove the spaces
- //
- for (Index = 0; OptionString[Index] == L' '; Index++)
- ;
-
- for (Count = 0; OptionString[Index] != CHAR_NULL; Index++) {
- OptionString[Count] = OptionString[Index];
- Count++;
- }
-
- OptionString[Count] = CHAR_NULL;
- }
- Width = (UINT16) gOptionBlockWidth;
-
- OriginalRow = MenuOption->Row;
-
- for (Index = 0; GetLineByWidth (OptionString, Width, &Index, &OutputString) != 0x0000;) {
- if (MenuOption->Row >= TopRow && MenuOption->Row <= BottomRow) {
- PrintStringAt (MenuOption->OptCol, MenuOption->Row, OutputString);
- }
- //
- // If there is more string to process print on the next row and increment the Skip value
- //
- if (StrLen (&OptionString[Index])) {
- MenuOption->Row++;
- }
-
- FreePool (OutputString);
- }
-
- MenuOption->Row = OriginalRow;
- } else {
- if (NewLine) {
- OriginalRow = MenuOption->Row;
-
- Width = GetWidth (MenuOption->ThisTag, MenuOption->Handle);
-
- for (Index = 0; GetLineByWidth (MenuOption->Description, Width, &Index, &OutputString) != 0x0000;) {
- if (MenuOption->Row >= TopRow && MenuOption->Row <= BottomRow) {
- PrintStringAt (Col, MenuOption->Row, OutputString);
- }
- //
- // If there is more string to process print on the next row and increment the Skip value
- //
- if (StrLen (&MenuOption->Description[Index])) {
- MenuOption->Row++;
- }
-
- FreePool (OutputString);
- }
-
- MenuOption->Row = OriginalRow;
-
- }
- }
-
- if (((NewPos->ForwardLink != &Menu) && (ScreenOperation == UiDown)) ||
- ((NewPos->BackLink != &Menu) && (ScreenOperation == UiUp)) ||
- (ScreenOperation == UiNoOperation)
- ) {
- UpdateKeyHelp (MenuOption, FALSE);
- }
- } else {
- gST->ConOut->OutputString (gST->ConOut, MenuOption->Description);
- }
- //
- // Clear reverse attribute
- //
- gST->ConOut->SetAttribute (gST->ConOut, FIELD_TEXT | FIELD_BACKGROUND);
- }
- //
- // Repaint flag will be used when process CfUpdateHelpString, so restore its value
- // if we didn't break halfway when process CfRefreshHighLight.
- //
- Repaint = SavedValue;
- break;
-
- case CfUpdateHelpString:
- ControlFlag = CfPrepareToReadKey;
-
- if (SubMenu &&
- (Repaint || NewLine ||
- (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) ||
- (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) &&
- !(gClassOfVfr == EFI_GENERAL_APPLICATION_SUBCLASS)) {
- //
- // Don't print anything if it is a NULL help token
- //
- if (MenuOption->ThisTag->Help == 0x00000000) {
- StringPtr = (CHAR16 *) L"\0";
- } else {
- StringPtr = GetToken (MenuOption->ThisTag->Help, MenuOption->Handle);
- }
-
- ProcessHelpString (StringPtr, &FormattedString, BottomRow - TopRow);
-
- gST->ConOut->SetAttribute (gST->ConOut, HELP_TEXT | FIELD_BACKGROUND);
-
- for (Index = 0; Index < BottomRow - TopRow; Index++) {
- //
- // Pad String with spaces to simulate a clearing of the previous line
- //
- for (; GetStringWidth (&FormattedString[Index * gHelpBlockWidth * 2]) / 2 < gHelpBlockWidth;) {
- StrCat (&FormattedString[Index * gHelpBlockWidth * 2], (CHAR16 *) L" ");
- }
-
- PrintStringAt (
- LocalScreen.RightColumn - gHelpBlockWidth,
- Index + TopRow,
- &FormattedString[Index * gHelpBlockWidth * 2]
- );
- }
- }
- //
- // Reset this flag every time we finish using it.
- //
- Repaint = FALSE;
- NewLine = FALSE;
- break;
-
- case CfPrepareToReadKey:
- ControlFlag = CfReadKey;
-
- for (Index = 0; Index < MenuOption->IfrNumber; Index++) {
- FileFormTags = FileFormTags->NextFile;
- }
-
- ScreenOperation = UiNoOperation;
-
- Status = gBS->HandleProtocol (
- (VOID *) (UINTN) FileFormTags->FormTags.Tags[0].CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- (VOID **) &FormCallback
- );
-
- break;
-
- case CfReadKey:
- ControlFlag = CfScreenOperation;
-
- OriginalTimeOut = FrontPageTimeOutValue;
- do {
- if (FrontPageTimeOutValue >= 0 && (gClassOfVfr == EFI_FRONT_PAGE_SUBCLASS) && FrontPageTimeOutValue != (INT16) -1) {
- //
- // Remember that if set to 0, must immediately boot an option
- //
- if (FrontPageTimeOutValue == 0) {
- FrontPageTimeOutValue = 0xFFFF;
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (EFI_ERROR (Status)) {
- Status = EFI_TIMEOUT;
- }
- break;
- }
-
- Status = UiWaitForSingleEvent (gST->ConIn->WaitForKey, ONE_SECOND);
- if (Status == EFI_TIMEOUT) {
- EFI_IFR_DATA_ENTRY *DataEntry;
-
- DataEntry = (EFI_IFR_DATA_ENTRY *) (PageData + 1);
-
- PageData->EntryCount = 1;
- Count = (UINT32) ((OriginalTimeOut - FrontPageTimeOutValue) * 100 / OriginalTimeOut);
- CopyMem (&DataEntry->Data, &Count, sizeof (UINT32));
-
- if ((FormCallback != NULL) && (FormCallback->Callback != NULL)) {
- FormCallback->Callback (
- FormCallback,
- 0xFFFF,
- (EFI_IFR_DATA_ARRAY *) PageData,
- NULL
- );
- }
- //
- // Count down 1 second
- //
- FrontPageTimeOutValue--;
-
- } else {
- ASSERT (!EFI_ERROR (Status));
- PageData->EntryCount = 0;
- if ((FormCallback != NULL) && (FormCallback->Callback != NULL)) {
- FormCallback->Callback (
- FormCallback,
- 0xFFFE,
- (EFI_IFR_DATA_ARRAY *) PageData,
- NULL
- );
- }
-
- FrontPageTimeOutValue = 0xFFFF;
- }
- } else {
- //
- // Wait for user's selection, no auto boot
- //
- Status = UiWaitForSingleEvent (gST->ConIn->WaitForKey, 0);
- }
- } while (Status == EFI_TIMEOUT);
-
- if (gFirstIn) {
- gFirstIn = FALSE;
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- DisableQuietBoot ();
- }
-
- if (Status == EFI_TIMEOUT) {
- Key.UnicodeChar = CHAR_CARRIAGE_RETURN;
- } else {
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- //
- // if we encounter error, continue to read another key in.
- //
- if (EFI_ERROR (Status)) {
- ControlFlag = CfReadKey;
- continue;
- }
- }
-
- switch (Key.UnicodeChar) {
- case CHAR_CARRIAGE_RETURN:
- Selection = MenuOption;
- ScreenOperation = UiSelect;
- gDirection = 0;
- break;
-
- //
- // We will push the adjustment of these numeric values directly to the input handler
- //
- case '+':
- case '-':
- if ((MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) {
-
- if (Key.UnicodeChar == '+') {
- gDirection = SCAN_RIGHT;
- } else {
- gDirection = SCAN_LEFT;
- }
-
- Status = ProcessOptions (MenuOption, TRUE, FileFormTagsHead, NULL, &OptionString);
- }
- break;
-
- case '^':
- ScreenOperation = UiUp;
- break;
-
- case 'V':
- case 'v':
- ScreenOperation = UiDown;
- break;
-
- case ' ':
- if (gClassOfVfr != EFI_FRONT_PAGE_SUBCLASS) {
- if (SubMenu) {
- if (MenuOption->ThisTag->Operand == EFI_IFR_CHECKBOX_OP && !(MenuOption->ThisTag->GrayOut)) {
- gST->ConOut->SetCursorPosition (gST->ConOut, MenuOption->Col, MenuOption->Row);
- gST->ConOut->OutputString (gST->ConOut, MenuOption->Description);
- Selection = MenuOption;
- ScreenOperation = UiSelect;
- }
- }
- }
- break;
-
- case CHAR_NULL:
- if (((Key.ScanCode == SCAN_F1) && ((gFunctionKeySetting & FUNCTION_ONE) != FUNCTION_ONE)) ||
- ((Key.ScanCode == SCAN_F2) && ((gFunctionKeySetting & FUNCTION_TWO) != FUNCTION_TWO)) ||
- ((Key.ScanCode == SCAN_F9) && ((gFunctionKeySetting & FUNCTION_NINE) != FUNCTION_NINE)) ||
- ((Key.ScanCode == SCAN_F10) && ((gFunctionKeySetting & FUNCTION_TEN) != FUNCTION_TEN))
- ) {
- //
- // If the function key has been disabled, just ignore the key.
- //
- } else {
- for (Index = 0; Index < sizeof (gScanCodeToOperation) / sizeof (gScanCodeToOperation[0]); Index++) {
- if (Key.ScanCode == gScanCodeToOperation[Index].ScanCode) {
- if ((Key.ScanCode == SCAN_F9) || (Key.ScanCode == SCAN_F10)) {
- if (SubMenu) {
- ScreenOperation = gScanCodeToOperation[Index].ScreenOperation;
- }
- } else {
- ScreenOperation = gScanCodeToOperation[Index].ScreenOperation;
- }
- }
- }
- }
- break;
- }
- break;
-
- case CfScreenOperation:
- IfrBinary = gBinaryDataHead;
-
- //
- // Advance to the Ifr we are using
- //
- for (Index = 0; Index < gActiveIfr; Index++) {
- IfrBinary = IfrBinary->Next;
- }
-
- if (ScreenOperation != UiPrevious && ScreenOperation != UiReset) {
- //
- // If the screen has no menu items, and the user didn't select UiPrevious, or UiReset
- // ignore the selection and go back to reading keys.
- //
- if (IsListEmpty (&Menu)) {
- ControlFlag = CfReadKey;
- break;
- }
- //
- // if there is nothing logical to place a cursor on, just move on to wait for a key.
- //
- for (Link = Menu.ForwardLink; Link != &Menu; Link = Link->ForwardLink) {
- NextMenuOption = CR (Link, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- if (!(NextMenuOption->ThisTag->GrayOut) && (NextMenuOption->ThisTag->Operand != EFI_IFR_SUBTITLE_OP)) {
- break;
- }
- }
-
- if (Link == &Menu) {
- ControlFlag = CfPrepareToReadKey;
- break;
- }
- }
-
- for (Index = 0;
- Index < sizeof (gScreenOperationToControlFlag) / sizeof (gScreenOperationToControlFlag[0]);
- Index++
- ) {
- if (ScreenOperation == gScreenOperationToControlFlag[Index].ScreenOperation) {
- ControlFlag = gScreenOperationToControlFlag[Index].ControlFlag;
- }
- }
-
- break;
-
- case CfUiPrevious:
- ControlFlag = CfCheckSelection;
- //
- // Check for tags that might have LATE_CHECK enabled. If they do, we can't switch pages or save NV data.
- //
- if (MenuOption != NULL) {
- if (!SelectionsAreValid (MenuOption, FileFormTagsHead)) {
- Selection = NULL;
- Repaint = TRUE;
- break;
- }
- }
-
- if (IsListEmpty (&gMenuList)) {
- Selection = NULL;
- if (IsListEmpty (&Menu)) {
- ControlFlag = CfReadKey;
- }
- break;
- }
-
- gLastOpr = TRUE;
-
- while (gMenuRefreshHead != NULL) {
- OldMenuRefreshEntry = gMenuRefreshHead->Next;
-
- FreePool (gMenuRefreshHead);
-
- gMenuRefreshHead = OldMenuRefreshEntry;
- }
- //
- // Remove the Cached page entry, free and init the menus, flag Selection as jumping to previous page and a valid Tag
- //
- if (SubMenu) {
- UiRemoveMenuListEntry (MenuOption, &Selection);
- Selection->Previous = TRUE;
- UiFreeMenu ();
- UiInitMenu ();
- }
-
- gActiveIfr = Selection->IfrNumber;
- return Selection;
-
- case CfUiSelect:
- ControlFlag = CfCheckSelection;
-
- ExtractRequestedNvMap (FileFormTags, MenuOption->ThisTag->VariableNumber, &VariableDefinition);
-
- if (SubMenu) {
- if ((MenuOption->ThisTag->Operand == EFI_IFR_TEXT_OP &&
- !(MenuOption->ThisTag->Flags & EFI_IFR_FLAG_INTERACTIVE)) ||
- (MenuOption->ThisTag->GrayOut) ||
- (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) ||
- (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) {
- Selection = NULL;
- break;
- }
-
- NewLine = TRUE;
- UpdateKeyHelp (MenuOption, TRUE);
- Status = ProcessOptions (MenuOption, TRUE, FileFormTagsHead, PageData, &OptionString);
-
- if (EFI_ERROR (Status)) {
- Selection = NULL;
- Repaint = TRUE;
- break;
- }
-
- if (OptionString != NULL) {
- PrintStringAt (LocalScreen.LeftColumn + gPromptBlockWidth + 1, MenuOption->Row, OptionString);
- }
-
- if (MenuOption->ThisTag->Flags & EFI_IFR_FLAG_INTERACTIVE) {
- Selection = MenuOption;
- }
-
- if (Selection == NULL) {
- break;
- }
-
- Location = (UINT8 *) &PageData->EntryCount;
-
- //
- // If not a goto, dump single piece of data, otherwise dump everything
- //
- if (Selection->ThisTag->Operand == EFI_IFR_REF_OP) {
- //
- // Check for tags that might have LATE_CHECK enabled. If they do, we can't switch pages or save NV data.
- //
- if (!SelectionsAreValid (MenuOption, FileFormTagsHead)) {
- Selection = NULL;
- Repaint = TRUE;
- break;
- }
-
- UiAddMenuListEntry (Selection);
- gPriorMenuEntry = 0;
-
- //
- // Now that we added a menu entry specific to a goto, we can always go back when someone hits the UiPrevious
- //
- UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE);
- UiMenuList->FormerEntryNumber = MenuOption->EntryNumber;
-
- gLastOpr = FALSE;
-
- //
- // Rewind to the beginning of the menu
- //
- for (; NewPos->BackLink != &Menu; NewPos = NewPos->BackLink)
- ;
-
- //
- // Get Total Count of Menu entries
- //
- for (Count = 1; NewPos->ForwardLink != &Menu; NewPos = NewPos->ForwardLink) {
- Count++;
- }
- //
- // Rewind to the beginning of the menu
- //
- for (; NewPos->BackLink != &Menu; NewPos = NewPos->BackLink)
- ;
-
- //
- // Copy the number of entries being described to the PageData location
- //
- CopyMem (&Location[0], &Count, sizeof (UINT32));
-
- for (Index = 4; NewPos->ForwardLink != &Menu; Index = Index + MenuOption->ThisTag->StorageWidth + 2) {
-
- MenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- Location[Index] = MenuOption->ThisTag->Operand;
- Location[Index + 1] = (UINT8) (MenuOption->ThisTag->StorageWidth + 4);
- CopyMem (
- &Location[Index + 4],
- &VariableDefinition->NvRamMap[MenuOption->ThisTag->StorageStart],
- MenuOption->ThisTag->StorageWidth
- );
- NewPos = NewPos->ForwardLink;
- }
- } else {
-
- gPriorMenuEntry = MenuOption->EntryNumber;
-
- Count = 1;
-
- //
- // Copy the number of entries being described to the PageData location
- //
- CopyMem (&Location[0], &Count, sizeof (UINT32));
-
- //
- // Start at PageData[4] since the EntryCount is a UINT32
- //
- Index = 4;
-
- //
- // Copy data to destination
- //
- Location[Index] = MenuOption->ThisTag->Operand;
- Location[Index + 1] = (UINT8) (MenuOption->ThisTag->StorageWidth + 4);
- CopyMem (
- &Location[Index + 4],
- &VariableDefinition->NvRamMap[MenuOption->ThisTag->StorageStart],
- MenuOption->ThisTag->StorageWidth
- );
- }
- }
- break;
-
- case CfUiReset:
- ControlFlag = CfCheckSelection;
- gLastOpr = FALSE;
- if (gClassOfVfr == EFI_FRONT_PAGE_SUBCLASS) {
- break;
- }
- //
- // If NV flag is up, prompt user
- //
- if (gNvUpdateRequired) {
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
-
- YesResponse = gYesResponse[0];
- NoResponse = gNoResponse[0];
-
- do {
- CreateDialog (3, TRUE, 0, NULL, &Key, gEmptyString, gAreYouSure, gEmptyString);
- } while
- (
- (Key.ScanCode != SCAN_ESC) &&
- ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (NoResponse | UPPER_LOWER_CASE_OFFSET)) &&
- ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) != (YesResponse | UPPER_LOWER_CASE_OFFSET))
- );
-
- //
- // If the user hits the YesResponse key
- //
- if ((Key.UnicodeChar | UPPER_LOWER_CASE_OFFSET) == (YesResponse | UPPER_LOWER_CASE_OFFSET)) {
- } else {
- Repaint = TRUE;
- NewLine = TRUE;
- break;
- }
- }
- //
- // Check for tags that might have LATE_CHECK enabled. If they do, we can't switch pages or save NV data.
- //
- if (MenuOption != NULL) {
- if (!SelectionsAreValid (MenuOption, FileFormTagsHead)) {
- Selection = NULL;
- Repaint = TRUE;
- NewLine = TRUE;
- break;
- }
- }
-
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
- gST->ConOut->EnableCursor (gST->ConOut, TRUE);
-
- if (SubMenu) {
- UiFreeMenuList ();
- gST->ConOut->ClearScreen (gST->ConOut);
- return NULL;
- }
-
- UpdateStatusBar (INPUT_ERROR, MenuOption->ThisTag->Flags, FALSE);
- UpdateStatusBar (NV_UPDATE_REQUIRED, MenuOption->ThisTag->Flags, FALSE);
-
- if (IfrBinary->UnRegisterOnExit) {
- Hii->RemovePack (Hii, MenuOption->Handle);
- }
-
- UiFreeMenu ();
-
- //
- // Clean up the allocated data buffers
- //
- FreeData (FileFormTagsHead, FormattedString, OptionString);
-
- gST->ConOut->ClearScreen (gST->ConOut);
- return NULL;
-
- case CfUiLeft:
- ControlFlag = CfCheckSelection;
- if ((MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) {
- if (MenuOption->Skip == 1) {
- //
- // In the tail of the Date/Time op-code set, go left.
- //
- NewPos = NewPos->BackLink;
- } else {
- //
- // In the middle of the Data/Time op-code set, go left.
- //
- NextMenuOption = CR (NewPos->ForwardLink, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- if (NextMenuOption->Skip == 1) {
- NewPos = NewPos->BackLink;
- }
- }
- }
- break;
-
- case CfUiRight:
- ControlFlag = CfCheckSelection;
- if ((MenuOption->Skip == 0) &&
- ((MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP))
- ) {
- //
- // We are in the head or middle of the Date/Time op-code set, advance right.
- //
- NewPos = NewPos->ForwardLink;
- }
- break;
-
- case CfUiUp:
- ControlFlag = CfCheckSelection;
-
- if (NewPos->BackLink != &Menu) {
- NewLine = TRUE;
- //
- // Adjust Date/Time position before we advance forward.
- //
- AdjustDateAndTimePosition (TRUE, &NewPos);
-
- //
- // Caution that we have already rewind to the top, don't go backward in this situation.
- //
- if (NewPos->BackLink != &Menu) {
- NewPos = NewPos->BackLink;
- }
-
- PreviousMenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
-
- //
- // Since the behavior of hitting the up arrow on a Date/Time op-code is intended
- // to be one that back to the previous set of op-codes, we need to advance to the sencond
- // Date/Time op-code and leave the remaining logic in UiDown intact so the appropriate
- // checking can be done.
- //
- DataAndTimeLineNumberPad = AdjustDateAndTimePosition (TRUE, &NewPos);
-
- if (SubMenu) {
- //
- // If the previous MenuOption contains a display-only op-code, skip to the next one
- //
- if (PreviousMenuOption->ThisTag->Operand == EFI_IFR_SUBTITLE_OP || PreviousMenuOption->ThisTag->GrayOut) {
- //
- // This is ok as long as not at the end of the list
- //
- if (NewPos->BackLink == &Menu) {
- //
- // If we are at the start of the list, then this list must start with a display only
- // piece of data, so do not allow the backward motion
- //
- ScreenOperation = UiDown;
-
- if (PreviousMenuOption->Row <= TopRow) {
- if (TopOfScreen->BackLink != &Menu) {
- TopOfScreen = TopOfScreen->BackLink;
- Repaint = TRUE;
- }
- }
-
- UpdateStatusBar (INPUT_ERROR, PreviousMenuOption->ThisTag->Flags, FALSE);
- break;
- }
- }
- }
- //
- // Check the previous menu entry to see if it was a zero-length advance. If it was,
- // don't worry about a redraw.
- //
- if ((MenuOption->Row - PreviousMenuOption->Skip - DataAndTimeLineNumberPad < TopRow) ||
- (PreviousMenuOption->Skip > MenuOption->Row)
- ) {
- do {
- if (TopOfScreen->BackLink == &Menu) {
- break;
- }
-
- Repaint = TRUE;
-
- //
- // Is the current top of screen a zero-advance op-code?
- // If so, keep moving forward till we hit a >0 advance op-code
- //
- SavedMenuOption = CR (TopOfScreen->BackLink, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- TopOfScreen = TopOfScreen->BackLink;
- } while (SavedMenuOption->Skip == 0);
- //
- // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
- //
- AdjustDateAndTimePosition (TRUE, &TopOfScreen);
- }
-
- UpdateStatusBar (INPUT_ERROR, MenuOption->ThisTag->Flags, FALSE);
- } else {
- if (SubMenu) {
- SavedMenuOption = MenuOption;
- MenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- if (MenuOption->ThisTag->Operand == EFI_IFR_SUBTITLE_OP || MenuOption->ThisTag->GrayOut) {
- //
- // If we are at the end of the list and sitting on a text op, we need to more forward
- //
- ScreenOperation = UiDown;
- ControlFlag = CfScreenOperation;
- break;
- }
-
- MenuOption = SavedMenuOption;
- }
- }
- break;
-
- case CfUiPageUp:
- ControlFlag = CfCheckSelection;
-
- SavedListEntry = NewPos;
- Link = TopOfScreen;
- for (Index = BottomRow; Index >= TopRow + 1; Index -= MenuOption->Skip) {
- if (Link->BackLink == &Menu) {
- TopOfScreen = Link;
- Link = SavedListEntry;
- MenuOption = CR (Link, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- break;
- }
-
- NewLine = TRUE;
- Repaint = TRUE;
- Link = Link->BackLink;
- MenuOption = CR (Link, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- TopOfScreen = Link;
- SavedListEntry = Link;
- }
-
- NewPos = Link;
-
- //
- // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
- // Don't do this when we are already in the first page.
- //
- if (Repaint) {
- AdjustDateAndTimePosition (TRUE, &TopOfScreen);
- AdjustDateAndTimePosition (TRUE, &NewPos);
- MenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- }
- break;
-
- case CfUiPageDown:
- ControlFlag = CfCheckSelection;
-
- SavedListEntry = NewPos;
- Link = TopOfScreen;
- NewPos = TopOfScreen;
- for (Index = TopRow; Index <= BottomRow - 1; Index += MenuOption->Skip) {
- if (NewPos->ForwardLink == &Menu) {
- NewPos = SavedListEntry;
- MenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- Link = TopOfScreen;
- NewLine = FALSE;
- Repaint = FALSE;
- break;
- }
-
- NewLine = TRUE;
- Repaint = TRUE;
- MenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- NewPos = NewPos->ForwardLink;
- Link = NewPos;
- }
-
- TopOfScreen = Link;
-
- //
- // If we encounter a Date/Time op-code set, rewind to the first op-code of the set.
- // Don't do this when we are already in the last page.
- //
- if (Repaint) {
- AdjustDateAndTimePosition (TRUE, &TopOfScreen);
- AdjustDateAndTimePosition (TRUE, &NewPos);
- MenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- }
- break;
-
- case CfUiDown:
- ControlFlag = CfCheckSelection;
- //
- // Since the behavior of hitting the down arrow on a Date/Time op-code is intended
- // to be one that progresses to the next set of op-codes, we need to advance to the last
- // Date/Time op-code and leave the remaining logic in UiDown intact so the appropriate
- // checking can be done. The only other logic we need to introduce is that if a Date/Time
- // op-code is the last entry in the menu, we need to rewind back to the first op-code of
- // the Date/Time op-code.
- //
- DataAndTimeLineNumberPad = AdjustDateAndTimePosition (FALSE, &NewPos);
-
- if (NewPos->ForwardLink != &Menu) {
- NewLine = TRUE;
- NewPos = NewPos->ForwardLink;
- NextMenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
-
- if (SubMenu) {
- //
- // If the next MenuOption contains a display-only op-code, skip to the next one
- // Also if the next MenuOption is date or time,
- //
- if (NextMenuOption->ThisTag->Operand == EFI_IFR_SUBTITLE_OP || NextMenuOption->ThisTag->GrayOut) {
- //
- // This is ok as long as not at the end of the list
- //
- if (NewPos == &Menu) {
- //
- // If we are at the end of the list, then this list must end with a display only
- // piece of data, so do not allow the forward motion
- //
- UpdateStatusBar (INPUT_ERROR, NextMenuOption->ThisTag->Flags, FALSE);
- NewPos = NewPos->BackLink;
- ScreenOperation = UiUp;
- break;
- }
- }
- }
- //
- // An option might be multi-line, so we need to reflect that data in the overall skip value
- //
- UpdateOptionSkipLines (PageData, NextMenuOption, FileFormTagsHead, &OptionString, SkipValue);
-
- if (NextMenuOption->Skip > 1) {
- Temp = MenuOption->Row + MenuOption->Skip + NextMenuOption->Skip - 1;
- } else {
- Temp = MenuOption->Row + MenuOption->Skip + DataAndTimeLineNumberPad;
- }
- //
- // If we are going to scroll
- //
- if (Temp > BottomRow) {
- do {
- //
- // Is the current top of screen a zero-advance op-code?
- // If so, keep moving forward till we hit a >0 advance op-code
- //
- SavedMenuOption = CR (TopOfScreen, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
-
- //
- // If bottom op-code is more than one line or top op-code is more than one line
- //
- if ((NextMenuOption->Skip > 1) || (MenuOption->Skip > 1)) {
- //
- // Is the bottom op-code greater than or equal in size to the top op-code?
- //
- if ((Temp - BottomRow) >= (SavedMenuOption->Skip - OldSkipValue)) {
- //
- // Skip the top op-code
- //
- TopOfScreen = TopOfScreen->ForwardLink;
- Difference = (Temp - BottomRow) - (SavedMenuOption->Skip - OldSkipValue);
-
- OldSkipValue = Difference;
-
- SavedMenuOption = CR (TopOfScreen, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
-
- //
- // If we have a remainder, skip that many more op-codes until we drain the remainder
- //
- for (;
- Difference >= (INTN) SavedMenuOption->Skip;
- Difference = Difference - (INTN) SavedMenuOption->Skip
- ) {
- //
- // Since the Difference is greater than or equal to this op-code's skip value, skip it
- //
- TopOfScreen = TopOfScreen->ForwardLink;
- SavedMenuOption = CR (TopOfScreen, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- if (Difference < (INTN) SavedMenuOption->Skip) {
- Difference = SavedMenuOption->Skip - Difference - 1;
- break;
- } else {
- if (Difference == (INTN) SavedMenuOption->Skip) {
- TopOfScreen = TopOfScreen->ForwardLink;
- SavedMenuOption = CR (TopOfScreen, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- Difference = SavedMenuOption->Skip - Difference;
- break;
- }
- }
- }
- //
- // Since we will act on this op-code in the next routine, and increment the
- // SkipValue, set the skips to one less than what is required.
- //
- SkipValue = Difference - 1;
-
- } else {
- //
- // Since we will act on this op-code in the next routine, and increment the
- // SkipValue, set the skips to one less than what is required.
- //
- SkipValue = OldSkipValue + (Temp - BottomRow) - 1;
- }
- } else {
- if ((OldSkipValue + 1) == (INTN) SavedMenuOption->Skip) {
- TopOfScreen = TopOfScreen->ForwardLink;
- break;
- } else {
- SkipValue = OldSkipValue;
- }
- }
- //
- // If the op-code at the top of the screen is more than one line, let's not skip it yet
- // Let's set a skip flag to smoothly scroll the top of the screen.
- //
- if (SavedMenuOption->Skip > 1) {
- if (SavedMenuOption == NextMenuOption) {
- SkipValue = 0;
- } else {
- SkipValue++;
- }
- } else {
- SkipValue = 0;
- TopOfScreen = TopOfScreen->ForwardLink;
- }
- } while (SavedMenuOption->Skip == 0);
-
- Repaint = TRUE;
- OldSkipValue = SkipValue;
- }
-
- UpdateStatusBar (INPUT_ERROR, MenuOption->ThisTag->Flags, FALSE);
-
- } else {
- if (SubMenu) {
- SavedMenuOption = MenuOption;
- MenuOption = CR (NewPos, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- if (MenuOption->ThisTag->Operand == EFI_IFR_SUBTITLE_OP || MenuOption->ThisTag->GrayOut) {
- //
- // If we are at the end of the list and sitting on a text op, we need to more forward
- //
- ScreenOperation = UiUp;
- ControlFlag = CfScreenOperation;
- break;
- }
-
- MenuOption = SavedMenuOption;
- //
- // If we are at the end of the list and sitting on a Date/Time op, rewind to the head.
- //
- AdjustDateAndTimePosition (TRUE, &NewPos);
- }
- }
- break;
-
- case CfUiSave:
- ControlFlag = CfCheckSelection;
- //
- // Check for tags that might have LATE_CHECK enabled. If they do, we can't switch pages or save NV data.
- //
- if (MenuOption != NULL) {
- if (!SelectionsAreValid (MenuOption, FileFormTagsHead)) {
- Selection = NULL;
- Repaint = TRUE;
- break;
- }
- }
- //
- // If callbacks are active, and the callback has a Write method, try to use it
- //
- if (FileFormTags->VariableDefinitions->VariableName == NULL) {
- if ((FormCallback != NULL) && (FormCallback->NvWrite != NULL)) {
- Status = FormCallback->NvWrite (
- FormCallback,
- (CHAR16 *) L"Setup",
- &FileFormTags->FormTags.Tags[0].GuidValue,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- VariableDefinition->VariableSize,
- (VOID *) VariableDefinition->NvRamMap,
- &gResetRequired
- );
-
- } else {
- Status = gRT->SetVariable (
- (CHAR16 *) L"Setup",
- &FileFormTags->FormTags.Tags[0].GuidValue,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- VariableDefinition->VariableSize,
- (VOID *) VariableDefinition->NvRamMap
- );
- }
- } else {
- VariableDefinition = FileFormTags->VariableDefinitions;
-
- for (; VariableDefinition != NULL; VariableDefinition = VariableDefinition->Next) {
- if ((FormCallback != NULL) && (FormCallback->NvWrite != NULL)) {
- Status = FormCallback->NvWrite (
- FormCallback,
- VariableDefinition->VariableName,
- &VariableDefinition->Guid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- VariableDefinition->VariableSize,
- (VOID *) VariableDefinition->NvRamMap,
- &gResetRequired
- );
-
- } else {
- Status = gRT->SetVariable (
- VariableDefinition->VariableName,
- &VariableDefinition->Guid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- VariableDefinition->VariableSize,
- (VOID *) VariableDefinition->NvRamMap
- );
- }
- }
- }
-
- UpdateStatusBar (INPUT_ERROR, MenuOption->ThisTag->Flags, FALSE);
- UpdateStatusBar (NV_UPDATE_REQUIRED, MenuOption->ThisTag->Flags, FALSE);
- break;
-
- case CfUiDefault:
- ControlFlag = CfCheckSelection;
-
- NvMapListHead = NULL;
-
- Status = Hii->GetDefaultImage (Hii, MenuOption->Handle, EFI_IFR_FLAG_DEFAULT, &NvMapListHead);
-
- if (!EFI_ERROR (Status)) {
- ASSERT_EFI_ERROR (NULL != NvMapListHead);
-
- NvMapListNode = NvMapListHead;
-
- while (NULL != NvMapListNode) {
- if (FileFormTags->VariableDefinitions->VariableId == NvMapListNode->VariablePack->VariableId) {
- NvMap = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength);
- NvMapSize = NvMapListNode->VariablePack->Header.Length - sizeof (EFI_HII_VARIABLE_PACK) - NvMapListNode->VariablePack->VariableNameLength;
- break;
- }
- NvMapListNode = NvMapListNode->NextVariablePack;
- }
-
- //
- // Free the buffer that was allocated.
- //
- FreePool (FileFormTags->VariableDefinitions->NvRamMap);
- FreePool (FileFormTags->VariableDefinitions->FakeNvRamMap);
-
- //
- // Allocate, copy the NvRamMap.
- //
- FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize - FileFormTags->VariableDefinitions->VariableSize);
- FileFormTags->VariableDefinitions->VariableSize = (UINT16) NvMapSize;
- FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize + FileFormTags->VariableDefinitions->VariableSize);
-
- FileFormTags->VariableDefinitions->NvRamMap = AllocateZeroPool (FileFormTags->VariableDefinitions->VariableSize);
- ASSERT (FileFormTags->VariableDefinitions->NvRamMap != NULL);
-
- FileFormTags->VariableDefinitions->FakeNvRamMap = AllocateZeroPool (NvMapSize + FileFormTags->VariableDefinitions->VariableFakeSize);
- ASSERT (FileFormTags->VariableDefinitions->FakeNvRamMap != NULL);
-
- CopyMem (FileFormTags->VariableDefinitions->NvRamMap, NvMap, NvMapSize);
- FreePool (NvMapListHead);
- }
-
- UpdateStatusBar (NV_UPDATE_REQUIRED, MenuOption->ThisTag->Flags, TRUE);
- Repaint = TRUE;
- //
- // After the repaint operation, we should refresh the highlight.
- //
- NewLine = TRUE;
- break;
-
- case CfUiNoOperation:
- ControlFlag = CfCheckSelection;
- break;
-
- case CfExit:
- while (gMenuRefreshHead != NULL) {
- OldMenuRefreshEntry = gMenuRefreshHead->Next;
-
- FreePool (gMenuRefreshHead);
-
- gMenuRefreshHead = OldMenuRefreshEntry;
- }
-
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, Row + 4);
- gST->ConOut->EnableCursor (gST->ConOut, TRUE);
- gST->ConOut->OutputString (gST->ConOut, (CHAR16 *) L"\n");
-
- gActiveIfr = MenuOption->IfrNumber;
- return Selection;
-
- default:
- break;
- }
- }
-}
-
-BOOLEAN
-ValueIsScroll (
- IN BOOLEAN Direction,
- IN LIST_ENTRY *CurrentPos
- )
-/*++
-
-Routine Description:
- Determine if the menu is the last menu that can be selected.
-
-Arguments:
- Direction - the scroll direction. False is down. True is up.
-
-Returns:
- FALSE -- the menu isn't the last menu that can be selected.
- TRUE -- the menu is the last menu that can be selected.
---*/
-{
- LIST_ENTRY *Temp;
- UI_MENU_OPTION *MenuOption;
- MenuOption = NULL;
-
- Temp = Direction ? CurrentPos->BackLink : CurrentPos->ForwardLink;
-
- if (Temp == &Menu) {
- return TRUE;
- }
-
- for (; Temp != &Menu; Temp = Direction ? Temp->BackLink : Temp->ForwardLink) {
- MenuOption = CR (Temp, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- if (!(MenuOption->ThisTag->Operand == EFI_IFR_SUBTITLE_OP || MenuOption->ThisTag->GrayOut)) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-UINTN
-AdjustDateAndTimePosition (
- IN BOOLEAN DirectionUp,
- IN LIST_ENTRY **CurrentPosition
- )
-/*++
-Routine Description:
- Adjust Data and Time tag position accordingly.
- Data format : [01/02/2004] [11:22:33]
- Line number : 0 0 1 0 0 1
-
-Arguments:
- Direction - the up or down direction. False is down. True is up.
- CurrentPos - Current position.
-
-Returns:
- Return line number to pad. It is possible that we stand on a zero-advance
- data or time opcode, so pad one line when we judge if we are going to scroll outside.
---*/
-{
- UINTN Count;
- LIST_ENTRY *NewPosition;
- UI_MENU_OPTION *MenuOption;
- UINTN PadLineNumber;
-
- PadLineNumber = 0;
- NewPosition = *CurrentPosition;
- MenuOption = CR (NewPosition, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
-
- if ((MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) || (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) {
- //
- // Calculate the distance from current position to the last Date/Time op-code.
- //
- Count = 0;
- while (MenuOption->ThisTag->NumberOfLines == 0) {
- Count++;
- NewPosition = NewPosition->ForwardLink;
- MenuOption = CR (NewPosition, UI_MENU_OPTION, Link, UI_MENU_OPTION_SIGNATURE);
- PadLineNumber = 1;
- }
-
- NewPosition = *CurrentPosition;
- if (DirectionUp) {
- //
- // Since the behavior of hitting the up arrow on a Date/Time op-code is intended
- // to be one that back to the previous set of op-codes, we need to advance to the first
- // Date/Time op-code and leave the remaining logic in CfUiUp intact so the appropriate
- // checking can be done.
- //
- while (Count++ < 2) {
- NewPosition = NewPosition->BackLink;
- }
- } else {
- //
- // Since the behavior of hitting the down arrow on a Date/Time op-code is intended
- // to be one that progresses to the next set of op-codes, we need to advance to the last
- // Date/Time op-code and leave the remaining logic in CfUiDown intact so the appropriate
- // checking can be done.
- //
- while (Count-- > 0) {
- NewPosition = NewPosition->ForwardLink;
- }
- }
-
- *CurrentPosition = NewPosition;
- }
-
- return PadLineNumber;
-}
diff --git a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.h b/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.h
deleted file mode 100644
index 522f4ce..0000000
--- a/EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.h
+++ /dev/null
@@ -1,435 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ui.h
-
-Abstract:
-
- Head file UI
-
-Revision History
-
---*/
-
-#ifndef _UI_H
-#define _UI_H
-
-//
-// Globals
-//
-#define REGULAR_NUMERIC 0
-#define TIME_NUMERIC 1
-#define DATE_NUMERIC 2
-
-typedef enum {
- UiNoOperation,
- UiDefault,
- UiSelect,
- UiUp,
- UiDown,
- UiLeft,
- UiRight,
- UiReset,
- UiSave,
- UiPrevious,
- UiPageUp,
- UiPageDown,
- UiMaxOperation
-} UI_SCREEN_OPERATION;
-
-typedef enum {
- CfInitialization,
- CfCheckSelection,
- CfRepaint,
- CfRefreshHighLight,
- CfUpdateHelpString,
- CfPrepareToReadKey,
- CfReadKey,
- CfScreenOperation,
- CfUiPrevious,
- CfUiSelect,
- CfUiReset,
- CfUiLeft,
- CfUiRight,
- CfUiUp,
- CfUiPageUp,
- CfUiPageDown,
- CfUiDown,
- CfUiSave,
- CfUiDefault,
- CfUiNoOperation,
- CfExit,
- CfMaxControlFlag
-} UI_CONTROL_FLAG;
-
-#define UI_MENU_OPTION_SIGNATURE EFI_SIGNATURE_32 ('u', 'i', 'm', 'm')
-#define UI_MENU_LIST_SIGNATURE EFI_SIGNATURE_32 ('u', 'i', 'm', 'l')
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
-
- UINTN Row;
- UINTN Col;
- UINTN OptCol;
- CHAR16 *Description;
- UINTN Skip;
-
- UINTN IfrNumber;
- VOID *FormBinary;
- EFI_HII_HANDLE Handle;
- EFI_TAG *Tags;
- UINTN TagIndex;
- EFI_TAG *ThisTag;
- UINT16 FormId;
- BOOLEAN Previous;
- UINT16 EntryNumber;
- UINT16 Consistency;
- BOOLEAN GrayOut;
-} UI_MENU_OPTION;
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY MenuLink;
-
- UI_MENU_OPTION Selection;
- UINTN FormerEntryNumber;
-} UI_MENU_LIST;
-
-typedef struct _MENU_REFRESH_ENTRY {
- struct _MENU_REFRESH_ENTRY *Next;
- EFI_FILE_FORM_TAGS *FileFormTagsHead;
- UINTN CurrentColumn;
- UINTN CurrentRow;
- UINTN CurrentAttribute;
- UI_MENU_OPTION *MenuOption; // Describes the entry needing an update
-} MENU_REFRESH_ENTRY;
-
-typedef struct {
- UINT16 ScanCode;
- UI_SCREEN_OPERATION ScreenOperation;
-} SCAN_CODE_TO_SCREEN_OPERATION;
-
-typedef struct {
- UI_SCREEN_OPERATION ScreenOperation;
- UI_CONTROL_FLAG ControlFlag;
-} SCREEN_OPERATION_T0_CONTROL_FLAG;
-
-LIST_ENTRY Menu;
-LIST_ENTRY gMenuList;
-MENU_REFRESH_ENTRY *gMenuRefreshHead;
-
-INTN gEntryNumber;
-BOOLEAN gLastOpr;
-//
-// Global Functions
-//
-VOID
-UiInitMenu (
- VOID
- )
-;
-
-VOID
-UiInitMenuList (
- VOID
- )
-;
-
-VOID
-UiRemoveMenuListEntry (
- IN UI_MENU_OPTION *Selection,
- OUT UI_MENU_OPTION **PreviousSelection
- )
-;
-
-VOID
-UiFreeMenuList (
- VOID
- )
-;
-
-VOID
-UiAddMenuListEntry (
- IN UI_MENU_OPTION *Selection
- )
-;
-
-VOID
-UiFreeMenu (
- VOID
- )
-;
-
-VOID
-UiAddMenuOption (
- IN CHAR16 *String,
- IN EFI_HII_HANDLE Handle,
- IN EFI_TAG *Tag,
- IN VOID *FormBinary,
- IN UINTN IfrNumber
- )
-;
-
-VOID
-UiAddSubMenuOption (
- IN CHAR16 *String,
- IN EFI_HII_HANDLE Handle,
- IN EFI_TAG *Tag,
- IN UINTN TagIndex,
- IN UINT16 FormId,
- IN UINT16 MenuItemCount
- )
-;
-
-UI_MENU_OPTION *
-UiDisplayMenu (
- IN BOOLEAN SubMenu,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- OUT EFI_IFR_DATA_ARRAY *PageData
- )
-;
-
-VOID
-InitPage (
- VOID
- )
-;
-
-UI_MENU_OPTION *
-SetupBrowser (
- IN UI_MENU_OPTION *Selection,
- IN BOOLEAN Callback,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN UINT8 *CallbackData
- )
-;
-
-
-VOID
-SetUnicodeMem (
- IN VOID *Buffer,
- IN UINTN Size,
- IN CHAR16 Value
- )
-;
-
-EFI_STATUS
-UiWaitForSingleEvent (
- IN EFI_EVENT Event,
- IN UINT64 Timeout OPTIONAL
- )
-;
-
-VOID
-CreatePopUp (
- IN UINTN ScreenWidth,
- IN UINTN NumberOfLines,
- IN CHAR16 *ArrayOfStrings,
- ...
- )
-;
-
-EFI_STATUS
-ReadString (
- IN UI_MENU_OPTION *MenuOption,
- OUT CHAR16 *StringPtr
- )
-;
-
-EFI_STATUS
-ReadPassword (
- IN UI_MENU_OPTION *MenuOption,
- IN BOOLEAN PromptForPassword,
- IN EFI_TAG *Tag,
- IN EFI_IFR_DATA_ARRAY *PageData,
- IN BOOLEAN SecondEntry,
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- OUT CHAR16 *StringPtr
- )
-;
-
-VOID
-EncodePassword (
- IN CHAR16 *Password,
- IN UINT8 MaxSize
- )
-;
-
-EFI_STATUS
-GetSelectionInputPopUp (
- IN UI_MENU_OPTION *MenuOption,
- IN EFI_TAG *Tag,
- IN UINTN ValueCount,
- OUT UINT16 *Value,
- OUT UINT16 *KeyValue
- )
-;
-
-EFI_STATUS
-GetSelectionInputLeftRight (
- IN UI_MENU_OPTION *MenuOption,
- IN EFI_TAG *Tag,
- IN UINTN ValueCount,
- OUT UINT16 *Value
- )
-;
-
-EFI_STATUS
-GetNumericInput (
- IN UI_MENU_OPTION *MenuOption,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN BOOLEAN ManualInput,
- IN EFI_TAG *Tag,
- IN UINTN NumericType,
- OUT UINT16 *Value
- )
-;
-
-VOID
-UpdateStatusBar (
- IN UINTN MessageType,
- IN UINT8 Flags,
- IN BOOLEAN State
- )
-;
-
-EFI_STATUS
-ProcessOptions (
- IN UI_MENU_OPTION *MenuOption,
- IN BOOLEAN Selected,
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN EFI_IFR_DATA_ARRAY *PageData,
- OUT CHAR16 **OptionString
- )
-;
-
-VOID
-ProcessHelpString (
- IN CHAR16 *StringPtr,
- OUT CHAR16 **FormattedString,
- IN UINTN RowCount
- )
-;
-
-VOID
-UpdateKeyHelp (
- IN UI_MENU_OPTION *Selection,
- IN BOOLEAN Selected
- )
-;
-
-BOOLEAN
-ValueIsNotValid (
- IN BOOLEAN Complex,
- IN UINT16 Value,
- IN EFI_TAG *Tag,
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN STRING_REF *PopUp
- )
-;
-
-VOID
-FreeData (
- IN EFI_FILE_FORM_TAGS *FileFormTagsHead,
- IN CHAR16 *FormattedString,
- IN CHAR16 *OptionString
- )
-;
-
-VOID
-ClearLines (
- UINTN LeftColumn,
- UINTN RightColumn,
- UINTN TopRow,
- UINTN BottomRow,
- UINTN TextAttribute
- )
-;
-
-UINTN
-GetStringWidth (
- CHAR16 *String
- )
-;
-
-UINT16
-GetLineByWidth (
- IN CHAR16 *InputString,
- IN UINT16 LineWidth,
- IN OUT UINTN *Index,
- OUT CHAR16 **OutputString
- )
-;
-
-UINT16
-GetWidth (
- IN EFI_TAG *Tag,
- IN EFI_HII_HANDLE Handle
- )
-;
-
-VOID
-NewStrCat (
- CHAR16 *Destination,
- CHAR16 *Source
- )
-;
-
-VOID
-IfrToFormTag (
- IN UINT8 OpCode,
- IN EFI_TAG *TargetTag,
- IN VOID *FormData,
- EFI_VARIABLE_DEFINITION *VariableDefinitionsHead
- )
-;
-
-EFI_STATUS
-ExtractNvValue (
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UINT16 VariableId,
- IN UINT16 VariableSize,
- IN UINT16 OffsetValue,
- OUT VOID **Buffer
- )
-;
-
-EFI_STATUS
-ExtractRequestedNvMap (
- IN EFI_FILE_FORM_TAGS *FileFormTags,
- IN UINT16 VariableId,
- OUT EFI_VARIABLE_DEFINITION **VariableDefinition
- )
-;
-
-BOOLEAN
-ValueIsScroll (
- IN BOOLEAN Direction,
- IN LIST_ENTRY *CurrentPos
- )
-;
-
-UINTN
-AdjustDateAndTimePosition (
- IN BOOLEAN DirectionUp,
- IN LIST_ENTRY **CurrentPosition
- )
-;
-
-EFI_STATUS
-WaitForKeyStroke (
- OUT EFI_INPUT_KEY *Key
- )
-;
-#endif // _UI_H
diff --git a/EdkModulePkg/Universal/Variable/Pei/Ebc/VarMachine.h b/EdkModulePkg/Universal/Variable/Pei/Ebc/VarMachine.h
deleted file mode 100644
index b83b8f6..0000000
--- a/EdkModulePkg/Universal/Variable/Pei/Ebc/VarMachine.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/**@file
- Variable Machine Type
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _VAR_MACHINE_H
-#define _VAR_MACHINE_H
-
-
-#endif
diff --git a/EdkModulePkg/Universal/Variable/Pei/Ia32/VarMachine.h b/EdkModulePkg/Universal/Variable/Pei/Ia32/VarMachine.h
deleted file mode 100644
index 7a79ab6..0000000
--- a/EdkModulePkg/Universal/Variable/Pei/Ia32/VarMachine.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/**@file
- Variable Machine Type
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _VAR_MACHINE_H
-#define _VAR_MACHINE_H
-
-
-#endif
diff --git a/EdkModulePkg/Universal/Variable/Pei/Ipf/VarMachine.h b/EdkModulePkg/Universal/Variable/Pei/Ipf/VarMachine.h
deleted file mode 100644
index 166c07f..0000000
--- a/EdkModulePkg/Universal/Variable/Pei/Ipf/VarMachine.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/**@file
- Variable Machine Type
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _VAR_MACHINE_H
-#define _VAR_MACHINE_H
-
-
-
-#endif
diff --git a/EdkModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c b/EdkModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c
deleted file mode 100644
index 0a4ee95..0000000
--- a/EdkModulePkg/Universal/Variable/Pei/Ipf/VariableWorker.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file
- Variable worker functions.
-
- Copyright (c) 2006, Intel Corporation<BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <Variable.h>
-
-
-/**
- Get one variable by the index count.
-
- @param IndexTable The pointer to variable index table.
- @param Count The index count of variable in index table.
-
- @return The pointer to variable header indexed by count.
-
-**/
-VARIABLE_HEADER *
-GetVariableByIndex (
- IN VARIABLE_INDEX_TABLE *IndexTable,
- IN UINT32 Count
- )
-{
- return (VARIABLE_HEADER *) (UINTN) ((((UINT32)IndexTable->Index[Count]) << 2) + ((UINT32)(UINTN)IndexTable->StartPtr & 0xFFFC0000) );
-}
-
-/**
- Record Variable in VariableIndex HOB.
-
- Record Variable in VariableIndex HOB and update the length of variable index table.
-
- @param IndexTable The pointer to variable index table.
- @param Variable The pointer to the variable that will be recorded.
-
- @retval VOID
-
-**/
-VOID
-VariableIndexTableUpdate (
- IN OUT VARIABLE_INDEX_TABLE *IndexTable,
- IN VARIABLE_HEADER *Variable
- )
-{
- IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);
-
- return;
-}
-
diff --git a/EdkModulePkg/Universal/Variable/Pei/Variable.c b/EdkModulePkg/Universal/Variable/Pei/Variable.c
deleted file mode 100644
index a2ea1d6..0000000
--- a/EdkModulePkg/Universal/Variable/Pei/Variable.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-Module Name:
-
- Variable.c
-
-Abstract:
-
- Framework PEIM to provide the Variable functionality
-
---*/
-
-#include <Variable.h>
-
-//
-// Module globals
-//
-static EFI_PEI_READ_ONLY_VARIABLE_PPI mVariablePpi = {
- PeiGetVariable,
- PeiGetNextVariableName
-};
-
-static EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEfiPeiReadOnlyVariablePpiGuid,
- &mVariablePpi
-};
-
-EFI_GUID mEfiVariableIndexTableGuid = EFI_VARIABLE_INDEX_TABLE_GUID;
-
-EFI_STATUS
-EFIAPI
-PeimInitializeVariableServices (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- Provide the functionality of the variable services.
-
-Arguments:
-
- FfsHeadher - The FFS file header
- PeiServices - General purpose services available to every PEIM.
-
-Returns:
-
- Status - EFI_SUCCESS if the interface could be successfully
- installed
-
---*/
-{
- //
- // Publish the variable capability to other modules
- //
- return (**PeiServices).InstallPpi (PeiServices, &mPpiListVariable);
-
-}
-
-STATIC
-VARIABLE_HEADER *
-GetNextVariablePtr (
- IN VARIABLE_HEADER *Variable
- )
-/*++
-
-Routine Description:
-
- This code checks if variable header is valid or not.
-
-Arguments:
- Variable Pointer to the Variable Header.
-
-Returns:
- TRUE Variable header is valid.
- FALSE Variable header is not valid.
-
---*/
-{
- return (VARIABLE_HEADER *) ((UINTN) GET_VARIABLE_DATA_PTR (Variable) + Variable->DataSize + GET_PAD_SIZE (Variable->DataSize));
-}
-
-STATIC
-BOOLEAN
-EFIAPI
-IsValidVariableHeader (
- IN VARIABLE_HEADER *Variable
- )
-/*++
-
-Routine Description:
-
- This code checks if variable header is valid or not.
-
-Arguments:
- Variable Pointer to the Variable Header.
-
-Returns:
- TRUE Variable header is valid.
- FALSE Variable header is not valid.
-
---*/
-{
- if (Variable == NULL ||
- Variable->StartId != VARIABLE_DATA ||
- (sizeof (VARIABLE_HEADER) + Variable->DataSize + Variable->NameSize) > MAX_VARIABLE_SIZE
- ) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-STATIC
-VARIABLE_STORE_STATUS
-EFIAPI
-GetVariableStoreStatus (
- IN VARIABLE_STORE_HEADER *VarStoreHeader
- )
-/*++
-
-Routine Description:
-
- This code gets the pointer to the variable name.
-
-Arguments:
-
- VarStoreHeader Pointer to the Variable Store Header.
-
-Returns:
-
- EfiRaw Variable store is raw
- EfiValid Variable store is valid
- EfiInvalid Variable store is invalid
-
---*/
-{
- if (VarStoreHeader->Signature == VARIABLE_STORE_SIGNATURE &&
- VarStoreHeader->Format == VARIABLE_STORE_FORMATTED &&
- VarStoreHeader->State == VARIABLE_STORE_HEALTHY
- ) {
-
- return EfiValid;
- }
-
- if (VarStoreHeader->Signature == 0xffffffff &&
- VarStoreHeader->Size == 0xffffffff &&
- VarStoreHeader->Format == 0xff &&
- VarStoreHeader->State == 0xff
- ) {
-
- return EfiRaw;
- } else {
- return EfiInvalid;
- }
-}
-
-STATIC
-EFI_STATUS
-CompareWithValidVariable (
- IN VARIABLE_HEADER *Variable,
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT VARIABLE_POINTER_TRACK *PtrTrack
- )
-/*++
-
-Routine Description:
-
- This function compares a variable with variable entries in database
-
-Arguments:
-
- Variable - Pointer to the variable in our database
- VariableName - Name of the variable to compare to 'Variable'
- VendorGuid - GUID of the variable to compare to 'Variable'
- PtrTrack - Variable Track Pointer structure that contains
- Variable Information.
-
-Returns:
-
- EFI_SUCCESS - Found match variable
- EFI_NOT_FOUND - Variable not found
-
---*/
-{
- if (VariableName[0] == 0) {
- PtrTrack->CurrPtr = Variable;
- return EFI_SUCCESS;
- } else {
- //
- // Don't use CompareGuid function here for performance reasons.
- // Instead we compare the GUID a UINT32 at a time and branch
- // on the first failed comparison.
- //
- if ((((INT32 *) VendorGuid)[0] == ((INT32 *) &Variable->VendorGuid)[0]) &&
- (((INT32 *) VendorGuid)[1] == ((INT32 *) &Variable->VendorGuid)[1]) &&
- (((INT32 *) VendorGuid)[2] == ((INT32 *) &Variable->VendorGuid)[2]) &&
- (((INT32 *) VendorGuid)[3] == ((INT32 *) &Variable->VendorGuid)[3])
- ) {
- if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable), Variable->NameSize)) {
- PtrTrack->CurrPtr = Variable;
- return EFI_SUCCESS;
- }
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-FindVariable (
- IN EFI_PEI_SERVICES **PeiServices,
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT VARIABLE_POINTER_TRACK *PtrTrack
- )
-/*++
-
-Routine Description:
-
- This code finds variable in storage blocks (Non-Volatile)
-
-Arguments:
-
- PeiServices - General purpose services available to every PEIM.
- VariableName - Name of the variable to be found
- VendorGuid - Vendor GUID to be found.
- PtrTrack - Variable Track Pointer structure that contains
- Variable Information.
-
-Returns:
-
- EFI_SUCCESS - Variable found successfully
- EFI_NOT_FOUND - Variable not found
- EFI_INVALID_PARAMETER - Invalid variable name
-
---*/
-{
- EFI_HOB_GUID_TYPE *GuidHob;
- VARIABLE_STORE_HEADER *VariableStoreHeader;
- VARIABLE_HEADER *Variable;
- VARIABLE_HEADER *MaxIndex;
- VARIABLE_INDEX_TABLE *IndexTable;
- UINT32 Count;
- UINT8 *VariableBase;
-
- if (VariableName != 0 && VendorGuid == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // No Variable Address equals zero, so 0 as initial value is safe.
- //
- MaxIndex = 0;
-
- GuidHob = GetFirstGuidHob (&mEfiVariableIndexTableGuid);
- if (GuidHob == NULL) {
- IndexTable = BuildGuidHob (&mEfiVariableIndexTableGuid, sizeof (VARIABLE_INDEX_TABLE));
- IndexTable->Length = 0;
- IndexTable->StartPtr = NULL;
- IndexTable->EndPtr = NULL;
- IndexTable->GoneThrough = 0;
- } else {
- IndexTable = GET_GUID_HOB_DATA (GuidHob);
- for (Count = 0; Count < IndexTable->Length; Count++)
- {
- MaxIndex = GetVariableByIndex (IndexTable, Count);
-
- if (CompareWithValidVariable (MaxIndex, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {
- PtrTrack->StartPtr = IndexTable->StartPtr;
- PtrTrack->EndPtr = IndexTable->EndPtr;
-
- return EFI_SUCCESS;
- }
- }
-
- if (IndexTable->GoneThrough) {
- return EFI_NOT_FOUND;
- }
- }
- //
- // If not found in HOB, then let's start from the MaxIndex we've found.
- //
- if (MaxIndex != NULL) {
- Variable = GetNextVariablePtr (MaxIndex);
- } else {
- if (IndexTable->StartPtr || IndexTable->EndPtr) {
- Variable = IndexTable->StartPtr;
- } else {
- VariableBase = (UINT8 *) (UINTN) PcdGet32 (PcdFlashNvStorageVariableBase);
- VariableStoreHeader = (VARIABLE_STORE_HEADER *) (VariableBase + \
- ((EFI_FIRMWARE_VOLUME_HEADER *) (VariableBase)) -> HeaderLength);
-
- if (GetVariableStoreStatus (VariableStoreHeader) != EfiValid) {
- return EFI_UNSUPPORTED;
- }
-
- if (~VariableStoreHeader->Size == 0) {
- return EFI_NOT_FOUND;
- }
- //
- // Find the variable by walk through non-volatile variable store
- //
- IndexTable->StartPtr = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
- IndexTable->EndPtr = (VARIABLE_HEADER *) ((UINTN) VariableStoreHeader + VariableStoreHeader->Size);
-
- //
- // Start Pointers for the variable.
- // Actual Data Pointer where data can be written.
- //
- Variable = IndexTable->StartPtr;
- }
- }
- //
- // Find the variable by walk through non-volatile variable store
- //
- PtrTrack->StartPtr = IndexTable->StartPtr;
- PtrTrack->EndPtr = IndexTable->EndPtr;
-
- while (IsValidVariableHeader (Variable) && (Variable <= IndexTable->EndPtr)) {
- if (Variable->State == VAR_ADDED) {
- //
- // Record Variable in VariableIndex HOB
- //
- if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME)
- {
- VariableIndexTableUpdate (IndexTable, Variable);
- }
-
- if (CompareWithValidVariable (Variable, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {
- return EFI_SUCCESS;
- }
- }
-
- Variable = GetNextVariablePtr (Variable);
- }
- //
- // If gone through the VariableStore, that means we never find in Firmware any more.
- //
- if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME) {
- IndexTable->GoneThrough = 1;
- }
-
- PtrTrack->CurrPtr = NULL;
-
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-EFIAPI
-PeiGetVariable (
- IN EFI_PEI_SERVICES **PeiServices,
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
- )
-/*++
-
-Routine Description:
-
- Provide the read variable functionality of the variable services.
-
-Arguments:
-
- PeiServices - General purpose services available to every PEIM.
-
- VariableName - The variable name
-
- VendorGuid - The vendor's GUID
-
- Attributes - Pointer to the attribute
-
- DataSize - Size of data
-
- Data - Pointer to data
-
-Returns:
-
- EFI_SUCCESS - The interface could be successfully installed
-
- EFI_NOT_FOUND - The variable could not be discovered
-
- EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough
-
---*/
-{
- VARIABLE_POINTER_TRACK Variable;
- UINTN VarDataSize;
- EFI_STATUS Status;
-
- if (VariableName == NULL || VendorGuid == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Find existing variable
- //
- Status = FindVariable (PeiServices, VariableName, VendorGuid, &Variable);
-
- if (Variable.CurrPtr == NULL || Status != EFI_SUCCESS) {
- return Status;
- }
- //
- // Get data size
- //
- VarDataSize = Variable.CurrPtr->DataSize;
- if (*DataSize >= VarDataSize) {
- (*PeiServices)->CopyMem (Data, GET_VARIABLE_DATA_PTR (Variable.CurrPtr), VarDataSize);
-
- if (Attributes != NULL) {
- *Attributes = Variable.CurrPtr->Attributes;
- }
-
- *DataSize = VarDataSize;
- return EFI_SUCCESS;
- } else {
- *DataSize = VarDataSize;
- return EFI_BUFFER_TOO_SMALL;
- }
-}
-
-EFI_STATUS
-EFIAPI
-PeiGetNextVariableName (
- IN EFI_PEI_SERVICES **PeiServices,
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid
- )
-/*++
-
-Routine Description:
-
- Provide the get next variable functionality of the variable services.
-
-Arguments:
-
- PeiServices - General purpose services available to every PEIM.
- VariabvleNameSize - The variable name's size.
- VariableName - A pointer to the variable's name.
- VendorGuid - A pointer to the EFI_GUID structure.
-
- VariableNameSize - Size of the variable name
-
- VariableName - The variable name
-
- VendorGuid - The vendor's GUID
-
-Returns:
-
- EFI_SUCCESS - The interface could be successfully installed
-
- EFI_NOT_FOUND - The variable could not be discovered
-
---*/
-{
- VARIABLE_POINTER_TRACK Variable;
- UINTN VarNameSize;
- EFI_STATUS Status;
-
- if (VariableName == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = FindVariable (PeiServices, VariableName, VendorGuid, &Variable);
-
- if (Variable.CurrPtr == NULL || Status != EFI_SUCCESS) {
- return Status;
- }
-
- if (VariableName[0] != 0) {
- //
- // If variable name is not NULL, get next variable
- //
- Variable.CurrPtr = GetNextVariablePtr (Variable.CurrPtr);
- }
-
- while (!(Variable.CurrPtr >= Variable.EndPtr || Variable.CurrPtr == NULL)) {
- if (IsValidVariableHeader (Variable.CurrPtr)) {
- if (Variable.CurrPtr->State == VAR_ADDED) {
- VarNameSize = (UINTN) Variable.CurrPtr->NameSize;
- if (VarNameSize <= *VariableNameSize) {
- (*PeiServices)->CopyMem (VariableName, GET_VARIABLE_NAME_PTR (Variable.CurrPtr), VarNameSize);
-
- (*PeiServices)->CopyMem (VendorGuid, &Variable.CurrPtr->VendorGuid, sizeof (EFI_GUID));
-
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_BUFFER_TOO_SMALL;
- }
-
- *VariableNameSize = VarNameSize;
- return Status;
- //
- // Variable is found
- //
- } else {
- Variable.CurrPtr = GetNextVariablePtr (Variable.CurrPtr);
- }
- } else {
- break;
- }
- }
-
- return EFI_NOT_FOUND;
-}
diff --git a/EdkModulePkg/Universal/Variable/Pei/Variable.dxs b/EdkModulePkg/Universal/Variable/Pei/Variable.dxs
deleted file mode 100644
index 9b7803a..0000000
--- a/EdkModulePkg/Universal/Variable/Pei/Variable.dxs
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Variable.dxs
-
-Abstract:
-
- Dependency expression file for Variable PEIM.
-
---*/
-#include <PeimDepex.h>
-
-DEPENDENCY_START
- TRUE
-DEPENDENCY_END
-
-
diff --git a/EdkModulePkg/Universal/Variable/Pei/Variable.h b/EdkModulePkg/Universal/Variable/Pei/Variable.h
deleted file mode 100644
index 5cebff8..0000000
--- a/EdkModulePkg/Universal/Variable/Pei/Variable.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Variable.h
-
-Abstract:
-
- Tiano PEIM to provide the variable functionality
-
---*/
-
-#ifndef _PEI_VARIABLE_H
-#define _PEI_VARIABLE_H
-
-//
-// BugBug: We need relcate the head file.
-//
-#include <Common/Variable.h>
-#include <VarMachine.h>
-
-//
-// Define GET_PAD_SIZE to optimize compiler
-//
-#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
-#define GET_PAD_SIZE(a) (0)
-#else
-#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
-#endif
-
-#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
-
-#define GET_VARIABLE_DATA_PTR(a) \
- (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (a) + (a)->NameSize + GET_PAD_SIZE ((a)->NameSize))
-
-typedef struct {
- VARIABLE_HEADER *CurrPtr;
- VARIABLE_HEADER *EndPtr;
- VARIABLE_HEADER *StartPtr;
-} VARIABLE_POINTER_TRACK;
-
-#define VARIABLE_INDEX_TABLE_VOLUME 122
-
-#define EFI_VARIABLE_INDEX_TABLE_GUID \
- { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }
-
-typedef struct {
- UINT16 Length;
- UINT16 GoneThrough;
- VARIABLE_HEADER *EndPtr;
- VARIABLE_HEADER *StartPtr;
- UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME];
-} VARIABLE_INDEX_TABLE;
-
-
-//
-// Functions
-//
-EFI_STATUS
-EFIAPI
-PeimInitializeVariableServices (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- FfsHeader - TODO: add argument description
- PeiServices - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiGetVariable (
- IN EFI_PEI_SERVICES **PeiServices,
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PeiServices - TODO: add argument description
- VariableName - TODO: add argument description
- VendorGuid - TODO: add argument description
- Attributes - TODO: add argument description
- DataSize - TODO: add argument description
- Data - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-EFI_STATUS
-EFIAPI
-PeiGetNextVariableName (
- IN EFI_PEI_SERVICES **PeiServices,
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PeiServices - TODO: add argument description
- VariableNameSize - TODO: add argument description
- VariableName - TODO: add argument description
- VendorGuid - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
-
-/**
- Get one variable by the index count.
-
- @param IndexTable The pointer to variable index table.
- @param Count The index count of variable in index table.
-
- @return The pointer to variable header indexed by count.
-
-**/
-VARIABLE_HEADER *
-GetVariableByIndex (
- IN VARIABLE_INDEX_TABLE *IndexTable,
- IN UINT32 Count
- );
-
-/**
- Record Variable in VariableIndex HOB.
-
- Record Variable in VariableIndex HOB and update the length of variable index table.
-
- @param IndexTable The pointer to variable index table.
- @param Variable The pointer to the variable that will be recorded.
-
- @retval VOID
-
-**/
-VOID
-VariableIndexTableUpdate (
- IN OUT VARIABLE_INDEX_TABLE *IndexTable,
- IN VARIABLE_HEADER *Variable
- );
-
-#endif // _PEI_VARIABLE_H
diff --git a/EdkModulePkg/Universal/Variable/Pei/Variable.msa b/EdkModulePkg/Universal/Variable/Pei/Variable.msa
deleted file mode 100644
index 565ae31..0000000
--- a/EdkModulePkg/Universal/Variable/Pei/Variable.msa
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>PeiVariable</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>34C8C28F-B61C-45a2-8F2E-89E46BECC63B</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for PeiVariable module.</Abstract>
- <Description>Framework PEIM to provide the Variable functionality.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>PeiVariable</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeimEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Variable.h</Filename>
- <Filename>Variable.c</Filename>
- <Filename>Variable.dxs</Filename>
- <Filename SupArchList="IA32 X64 EBC">VariableWorker.c</Filename>
- <Filename SupArchList="IPF">Ipf/VariableWorker.c</Filename>
- <Filename SupArchList="IA32">Ia32/VarMachine.h</Filename>
- <Filename SupArchList="EBC">Ebc/VarMachine.h</Filename>
- <Filename SupArchList="X64">x64/VarMachine.h</Filename>
- <Filename SupArchList="IPF">Ipf/VarMachine.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <PPIs>
- <Ppi Usage="ALWAYS_CONSUMED">
- <PpiCName>gEfiPeiReadOnlyVariablePpiGuid</PpiCName>
- </Ppi>
- </PPIs>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>PeimInitializeVariableServices</ModuleEntryPoint>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The driver gets the Variable store base address from this PCD. This base address point to
- an EFI_FIRMWARE_VOLUMN_HEADER struct.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Variable/Pei/VariableWorker.c b/EdkModulePkg/Universal/Variable/Pei/VariableWorker.c
deleted file mode 100644
index 1a49ee8..0000000
--- a/EdkModulePkg/Universal/Variable/Pei/VariableWorker.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*++
-
-Copyright (c) 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- VariableWorker.c
-
-Abstract:
-
- Framework PEIM to provide the Variable functionality
-
---*/
-
-#include <Variable.h>
-
-/**
- Get one variable by the index count.
-
- @param IndexTable The pointer to variable index table.
- @param Count The index count of variable in index table.
-
- @return The pointer to variable header indexed by count.
-
-**/
-VARIABLE_HEADER *
-GetVariableByIndex (
- IN VARIABLE_INDEX_TABLE *IndexTable,
- IN UINT32 Count
- )
-{
- return (VARIABLE_HEADER *) (UINTN) (IndexTable->Index[Count] + ((UINTN) IndexTable->StartPtr & 0xFFFF0000));
-}
-
-/**
- Record Variable in VariableIndex HOB.
-
- Record Variable in VariableIndex HOB and update the length of variable index table.
-
- @param IndexTable The pointer to variable index table.
- @param Variable The pointer to the variable that will be recorded.
-
- @retval VOID
-
-**/
-VOID
-VariableIndexTableUpdate (
- IN OUT VARIABLE_INDEX_TABLE *IndexTable,
- IN VARIABLE_HEADER *Variable
- )
-{
- IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;
-
- return;
-}
-
diff --git a/EdkModulePkg/Universal/Variable/Pei/x64/VarMachine.h b/EdkModulePkg/Universal/Variable/Pei/x64/VarMachine.h
deleted file mode 100644
index dc1c7b4..0000000
--- a/EdkModulePkg/Universal/Variable/Pei/x64/VarMachine.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/**@file
- Variable Machine Type
-
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef _VAR_MACHINE_H
-#define _VAR_MACHINE_H
-
-#endif
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/InitVariable.c b/EdkModulePkg/Universal/Variable/RuntimeDxe/InitVariable.c
deleted file mode 100644
index efff41c..0000000
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/InitVariable.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- InitVariable.c
-
-Abstract:
-
-Revision History
-
---*/
-
-#include "Variable.h"
-
-//
-// Don't use module globals after the SetVirtualAddress map is signaled
-//
-extern ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;
-
-EFI_STATUS
-EFIAPI
-RuntimeServiceGetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- return GetVariable (
- VariableName,
- VendorGuid,
- Attributes OPTIONAL,
- DataSize,
- Data,
- &mVariableModuleGlobal->VariableGlobal[Physical],
- mVariableModuleGlobal->FvbInstance
- );
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeServiceGetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- return GetNextVariableName (
- VariableNameSize,
- VariableName,
- VendorGuid,
- &mVariableModuleGlobal->VariableGlobal[Physical],
- mVariableModuleGlobal->FvbInstance
- );
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeServiceSetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- return SetVariable (
- VariableName,
- VendorGuid,
- Attributes,
- DataSize,
- Data,
- &mVariableModuleGlobal->VariableGlobal[Physical],
- &mVariableModuleGlobal->VolatileLastVariableOffset,
- &mVariableModuleGlobal->NonVolatileLastVariableOffset,
- mVariableModuleGlobal->FvbInstance
- );
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeServiceQueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- return QueryVariableInfo (
- Attributes,
- MaximumVariableStorageSize,
- RemainingVariableStorageSize,
- MaximumVariableSize,
- &mVariableModuleGlobal->VariableGlobal[Physical],
- mVariableModuleGlobal->FvbInstance
- );
-}
-
-VOID
-EFIAPI
-VariableClassAddressChangeEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EfiConvertPointer (
- 0x0,
- (VOID **) &mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase
- );
- EfiConvertPointer (
- 0x0,
- (VOID **) &mVariableModuleGlobal->VariableGlobal[Physical].VolatileVariableBase
- );
- EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal);
-}
-
-EFI_STATUS
-EFIAPI
-VariableServiceInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HANDLE NewHandle;
- EFI_STATUS Status;
-
- Status = VariableCommonInitialize (ImageHandle, SystemTable);
- ASSERT_EFI_ERROR (Status);
-
- SystemTable->RuntimeServices->GetVariable = RuntimeServiceGetVariable;
- SystemTable->RuntimeServices->GetNextVariableName = RuntimeServiceGetNextVariableName;
- SystemTable->RuntimeServices->SetVariable = RuntimeServiceSetVariable;
- SystemTable->RuntimeServices->QueryVariableInfo = RuntimeServiceQueryVariableInfo;
-
- //
- // Now install the Variable Runtime Architectural Protocol on a new handle
- //
- NewHandle = NULL;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &NewHandle,
- &gEfiVariableArchProtocolGuid,
- NULL,
- &gEfiVariableWriteArchProtocolGuid,
- NULL,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/Ipf/InitVariable.c b/EdkModulePkg/Universal/Variable/RuntimeDxe/Ipf/InitVariable.c
deleted file mode 100644
index 0ad67d5..0000000
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/Ipf/InitVariable.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- IpfVariable.c
-
-Abstract:
-
-Revision History
-
---*/
-
-#include "Variable.h"
-
-//
-// Don't use module globals after the SetVirtualAddress map is signaled
-//
-
-STATIC
-SAL_RETURN_REGS
-EsalVariableCommonEntry (
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8,
- IN SAL_EXTENDED_SAL_PROC ExtendedSalProc,
- IN BOOLEAN VirtualMode,
- IN ESAL_VARIABLE_GLOBAL *Global
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- SAL_RETURN_REGS ReturnVal;
-
- switch (FunctionId) {
- case EsalGetVariableFunctionId:
- ReturnVal.Status = GetVariable (
- (CHAR16 *) Arg2,
- (EFI_GUID *) Arg3,
- (UINT32 *) Arg4,
- (UINTN *) Arg5,
- (VOID *) Arg6,
- &Global->VariableGlobal[VirtualMode],
- Global->FvbInstance
- );
- return ReturnVal;
-
- case EsalGetNextVariableNameFunctionId:
- ReturnVal.Status = GetNextVariableName (
- (UINTN *) Arg2,
- (CHAR16 *) Arg3,
- (EFI_GUID *) Arg4,
- &Global->VariableGlobal[VirtualMode],
- Global->FvbInstance
- );
- return ReturnVal;
-
- case EsalSetVariableFunctionId:
- ReturnVal.Status = SetVariable (
- (CHAR16 *) Arg2,
- (EFI_GUID *) Arg3,
- (UINT32) Arg4,
- (UINTN) Arg5,
- (VOID *) Arg6,
- &Global->VariableGlobal[VirtualMode],
- (UINTN *) &Global->VolatileLastVariableOffset,
- (UINTN *) &Global->NonVolatileLastVariableOffset,
- Global->FvbInstance
- );
- return ReturnVal;
-
- case EsalQueryVariableInfoFunctionId:
- ReturnVal.Status = QueryVariableInfo (
- (UINT32) Arg2,
- (UINT64 *) Arg3,
- (UINT64 *) Arg4,
- (UINT64 *) Arg5,
- &Global->VariableGlobal[VirtualMode],
- Global->FvbInstance
- );
- return ReturnVal;
-
- default:
- ReturnVal.Status = EFI_SAL_INVALID_ARGUMENT;
- return ReturnVal;
- }
-}
-
-
-VOID
-VariableClassAddressChangeEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- CopyMem (
- &mVariableModuleGlobal->VariableGlobal[Virtual],
- &mVariableModuleGlobal->VariableGlobal[Physical],
- sizeof (VARIABLE_GLOBAL)
- );
-
- EfiConvertPointer (
- 0x0,
- (VOID **) &mVariableModuleGlobal->VariableGlobal[Virtual].NonVolatileVariableBase
- );
- EfiConvertPointer (
- 0x0,
- (VOID **) &mVariableModuleGlobal->VariableGlobal[Virtual].VolatileVariableBase
- );
- EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal);
-}
-
-EFI_STATUS
-VariableServiceInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
-
- Status = VariableCommonInitialize (ImageHandle, SystemTable);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Register All the Functions with Extended Sal.
- //
- RegisterEsalClass (
- &gEfiExtendedSalVariableServicesProtocolGuid,
- mVariableModuleGlobal,
- EsalVariableCommonEntry,
- EsalGetVariableFunctionId,
- EsalVariableCommonEntry,
- EsalGetNextVariableNameFunctionId,
- EsalVariableCommonEntry,
- EsalSetVariableFunctionId,
- EsalVariableCommonEntry,
- EsalQueryVariableInfoFunctionId,
- NULL
- );
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/IpfVariable.dxs b/EdkModulePkg/Universal/Variable/RuntimeDxe/IpfVariable.dxs
deleted file mode 100644
index 6b726d9..0000000
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/IpfVariable.dxs
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- IpfVariable.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- EXTENDED_SAL_BOOT_SERVICE_PROTOCOL_GUID AND
- EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID AND
- EFI_FTW_LITE_PROTOCOL_GUID
-DEPENDENCY_END \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
deleted file mode 100644
index 79c23ce..0000000
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ /dev/null
@@ -1,1476 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Variable.c
-
-Abstract:
-
-Revision History
-
---*/
-
-#include "Variable.h"
-#include "reclaim.h"
-
-//
-// Don't use module globals after the SetVirtualAddress map is signaled
-//
-ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;
-
-//
-// This is a temperary function which will be removed
-// when EfiAcquireLock in UefiLib can handle the
-// the call in UEFI Runtimer driver in RT phase.
-//
-STATIC
-VOID
-AcquireLockOnlyAtBootTime (
- IN EFI_LOCK *Lock
- )
-{
- if (!EfiAtRuntime ()) {
- EfiAcquireLock (Lock);
- }
-}
-
-//
-// This is a temperary function which will be removed
-// when EfiAcquireLock in UefiLib can handle the
-// the call in UEFI Runtimer driver in RT phase.
-//
-STATIC
-VOID
-ReleaseLockOnlyAtBootTime (
- IN EFI_LOCK *Lock
- )
-{
- if (!EfiAtRuntime ()) {
- EfiReleaseLock (Lock);
- }
-}
-
-STATIC
-BOOLEAN
-EFIAPI
-IsValidVariableHeader (
- IN VARIABLE_HEADER *Variable
- )
-/*++
-
-Routine Description:
-
- This code checks if variable header is valid or not.
-
-Arguments:
- Variable Pointer to the Variable Header.
-
-Returns:
- TRUE Variable header is valid.
- FALSE Variable header is not valid.
-
---*/
-{
- if (Variable == NULL ||
- Variable->StartId != VARIABLE_DATA ||
- (sizeof (VARIABLE_HEADER) + Variable->NameSize + Variable->DataSize) > MAX_VARIABLE_SIZE
- ) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-UpdateVariableStore (
- IN VARIABLE_GLOBAL *Global,
- IN BOOLEAN Volatile,
- IN BOOLEAN SetByIndex,
- IN UINTN Instance,
- IN UINTN DataPtrIndex,
- IN UINT32 DataSize,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
-
- This function writes data to the FWH at the correct LBA even if the LBAs
- are fragmented.
-
-Arguments:
-
- Global Pointer to VARAIBLE_GLOBAL structure
- Volatile If the Variable is Volatile or Non-Volatile
- SetByIndex TRUE: Target pointer is given as index
- FALSE: Target pointer is absolute
- Instance Instance of FV Block services
- DataPtrIndex Pointer to the Data from the end of VARIABLE_STORE_HEADER
- structure
- DataSize Size of data to be written.
- Buffer Pointer to the buffer from which data is written
-
-Returns:
-
- EFI STATUS
-
---*/
-{
- EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;
- UINTN BlockIndex2;
- UINTN LinearOffset;
- UINTN CurrWriteSize;
- UINTN CurrWritePtr;
- UINT8 *CurrBuffer;
- EFI_LBA LbaNumber;
- UINTN Size;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- VARIABLE_STORE_HEADER *VolatileBase;
- EFI_PHYSICAL_ADDRESS FvVolHdr;
- EFI_PHYSICAL_ADDRESS DataPtr;
- EFI_STATUS Status;
-
- FwVolHeader = NULL;
- DataPtr = DataPtrIndex;
-
- //
- // Check if the Data is Volatile
- //
- if (!Volatile) {
- EfiFvbGetPhysicalAddress (Instance, &FvVolHdr);
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) FvVolHdr);
- //
- // Data Pointer should point to the actual Address where data is to be
- // written
- //
- if (SetByIndex) {
- DataPtr += Global->NonVolatileVariableBase;
- }
-
- if ((DataPtr + DataSize) >= ((EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) FwVolHeader + FwVolHeader->FvLength))) {
- return EFI_INVALID_PARAMETER;
- }
- } else {
- //
- // Data Pointer should point to the actual Address where data is to be
- // written
- //
- VolatileBase = (VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase);
- if (SetByIndex) {
- DataPtr += Global->VolatileVariableBase;
- }
-
- if ((DataPtr + DataSize) >= ((UINTN) ((UINT8 *) VolatileBase + VolatileBase->Size))) {
- return EFI_INVALID_PARAMETER;
- }
- }
- //
- // If Volatile Variable just do a simple mem copy.
- //
- if (Volatile) {
- CopyMem ((UINT8 *) ((UINTN) DataPtr), Buffer, DataSize);
- return EFI_SUCCESS;
- }
- //
- // If we are here we are dealing with Non-Volatile Variables
- //
- LinearOffset = (UINTN) FwVolHeader;
- CurrWritePtr = (UINTN) DataPtr;
- CurrWriteSize = DataSize;
- CurrBuffer = Buffer;
- LbaNumber = 0;
-
- if (CurrWritePtr < LinearOffset) {
- return EFI_INVALID_PARAMETER;
- }
-
- for (PtrBlockMapEntry = FwVolHeader->FvBlockMap; PtrBlockMapEntry->NumBlocks != 0; PtrBlockMapEntry++) {
- for (BlockIndex2 = 0; BlockIndex2 < PtrBlockMapEntry->NumBlocks; BlockIndex2++) {
- //
- // Check to see if the Variable Writes are spanning through multiple
- // blocks.
- //
- if ((CurrWritePtr >= LinearOffset) && (CurrWritePtr < LinearOffset + PtrBlockMapEntry->BlockLength)) {
- if ((CurrWritePtr + CurrWriteSize) <= (LinearOffset + PtrBlockMapEntry->BlockLength)) {
- Status = EfiFvbWriteBlock (
- Instance,
- LbaNumber,
- (UINTN) (CurrWritePtr - LinearOffset),
- &CurrWriteSize,
- CurrBuffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- } else {
- Size = (UINT32) (LinearOffset + PtrBlockMapEntry->BlockLength - CurrWritePtr);
- Status = EfiFvbWriteBlock (
- Instance,
- LbaNumber,
- (UINTN) (CurrWritePtr - LinearOffset),
- &Size,
- CurrBuffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- CurrWritePtr = LinearOffset + PtrBlockMapEntry->BlockLength;
- CurrBuffer = CurrBuffer + Size;
- CurrWriteSize = CurrWriteSize - Size;
- }
- }
-
- LinearOffset += PtrBlockMapEntry->BlockLength;
- LbaNumber++;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-STATIC
-VARIABLE_STORE_STATUS
-EFIAPI
-GetVariableStoreStatus (
- IN VARIABLE_STORE_HEADER *VarStoreHeader
- )
-/*++
-
-Routine Description:
-
- This code gets the current status of Variable Store.
-
-Arguments:
-
- VarStoreHeader Pointer to the Variable Store Header.
-
-Returns:
-
- EfiRaw Variable store status is raw
- EfiValid Variable store status is valid
- EfiInvalid Variable store status is invalid
-
---*/
-{
- if (VarStoreHeader->Signature == VARIABLE_STORE_SIGNATURE &&
- VarStoreHeader->Format == VARIABLE_STORE_FORMATTED &&
- VarStoreHeader->State == VARIABLE_STORE_HEALTHY
- ) {
-
- return EfiValid;
- } else if (VarStoreHeader->Signature == 0xffffffff &&
- VarStoreHeader->Size == 0xffffffff &&
- VarStoreHeader->Format == 0xff &&
- VarStoreHeader->State == 0xff
- ) {
-
- return EfiRaw;
- } else {
- return EfiInvalid;
- }
-}
-
-STATIC
-UINT8 *
-EFIAPI
-GetVariableDataPtr (
- IN VARIABLE_HEADER *Variable
- )
-/*++
-
-Routine Description:
-
- This code gets the pointer to the variable data.
-
-Arguments:
-
- Variable Pointer to the Variable Header.
-
-Returns:
-
- UINT8* Pointer to Variable Data
-
---*/
-{
- //
- // Be careful about pad size for alignment
- //
- return (UINT8 *) ((UINTN) GET_VARIABLE_NAME_PTR (Variable) + Variable->NameSize + GET_PAD_SIZE (Variable->NameSize));
-}
-
-STATIC
-VARIABLE_HEADER *
-EFIAPI
-GetNextVariablePtr (
- IN VARIABLE_HEADER *Variable
- )
-/*++
-
-Routine Description:
-
- This code gets the pointer to the next variable header.
-
-Arguments:
-
- Variable Pointer to the Variable Header.
-
-Returns:
-
- VARIABLE_HEADER* Pointer to next variable header.
-
---*/
-{
- if (!IsValidVariableHeader (Variable)) {
- return NULL;
- }
- //
- // Be careful about pad size for alignment
- //
- return (VARIABLE_HEADER *) ((UINTN) GetVariableDataPtr (Variable) + Variable->DataSize + GET_PAD_SIZE (Variable->DataSize));
-}
-
-STATIC
-VARIABLE_HEADER *
-EFIAPI
-GetEndPointer (
- IN VARIABLE_STORE_HEADER *VarStoreHeader
- )
-/*++
-
-Routine Description:
-
- This code gets the pointer to the last variable memory pointer byte
-
-Arguments:
-
- VarStoreHeader Pointer to the Variable Store Header.
-
-Returns:
-
- VARIABLE_HEADER* Pointer to last unavailable Variable Header
-
---*/
-{
- //
- // The end of variable store
- //
- return (VARIABLE_HEADER *) ((UINTN) VarStoreHeader + VarStoreHeader->Size);
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-Reclaim (
- IN EFI_PHYSICAL_ADDRESS VariableBase,
- OUT UINTN *LastVariableOffset,
- IN BOOLEAN IsVolatile
- )
-/*++
-
-Routine Description:
-
- Variable store garbage collection and reclaim operation
-
-Arguments:
-
- VariableBase Base address of variable store
- LastVariableOffset Offset of last variable
- IsVolatile The variable store is volatile or not,
- if it is non-volatile, need FTW
-
-Returns:
-
- EFI STATUS
-
---*/
-{
- VARIABLE_HEADER *Variable;
- VARIABLE_HEADER *NextVariable;
- VARIABLE_STORE_HEADER *VariableStoreHeader;
- UINT8 *ValidBuffer;
- UINTN ValidBufferSize;
- UINTN VariableSize;
- UINT8 *CurrPtr;
- EFI_STATUS Status;
-
- VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) VariableBase);
-
- //
- // Start Pointers for the variable.
- //
- Variable = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
-
- ValidBufferSize = sizeof (VARIABLE_STORE_HEADER);
-
- while (IsValidVariableHeader (Variable)) {
- NextVariable = GetNextVariablePtr (Variable);
- if (Variable->State == VAR_ADDED) {
- VariableSize = (UINTN) NextVariable - (UINTN) Variable;
- ValidBufferSize += VariableSize;
- }
-
- Variable = NextVariable;
- }
-
- ValidBuffer = AllocatePool (ValidBufferSize);
- if (ValidBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetMem (ValidBuffer, ValidBufferSize, 0xff);
-
- CurrPtr = ValidBuffer;
-
- //
- // Copy variable store header
- //
- CopyMem (CurrPtr, VariableStoreHeader, sizeof (VARIABLE_STORE_HEADER));
- CurrPtr += sizeof (VARIABLE_STORE_HEADER);
-
- //
- // Start Pointers for the variable.
- //
- Variable = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
-
- while (IsValidVariableHeader (Variable)) {
- NextVariable = GetNextVariablePtr (Variable);
- if (Variable->State == VAR_ADDED) {
- VariableSize = (UINTN) NextVariable - (UINTN) Variable;
- CopyMem (CurrPtr, (UINT8 *) Variable, VariableSize);
- CurrPtr += VariableSize;
- }
-
- Variable = NextVariable;
- }
-
- if (IsVolatile) {
- //
- // If volatile variable store, just copy valid buffer
- //
- SetMem ((UINT8 *) (UINTN) VariableBase, VariableStoreHeader->Size, 0xff);
- CopyMem ((UINT8 *) (UINTN) VariableBase, ValidBuffer, ValidBufferSize);
- *LastVariableOffset = ValidBufferSize;
- Status = EFI_SUCCESS;
- } else {
- //
- // If non-volatile variable store, perform FTW here.
- //
- Status = FtwVariableSpace (
- VariableBase,
- ValidBuffer,
- ValidBufferSize
- );
- if (!EFI_ERROR (Status)) {
- *LastVariableOffset = ValidBufferSize;
- }
- }
-
- FreePool (ValidBuffer);
-
- if (EFI_ERROR (Status)) {
- *LastVariableOffset = 0;
- }
-
- return Status;
-}
-
-STATIC
-EFI_STATUS
-EFIAPI
-FindVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT VARIABLE_POINTER_TRACK *PtrTrack,
- IN VARIABLE_GLOBAL *Global
- )
-/*++
-
-Routine Description:
-
- This code finds variable in storage blocks (Volatile or Non-Volatile)
-
-Arguments:
-
- VariableName Name of the variable to be found
- VendorGuid Vendor GUID to be found.
- PtrTrack Variable Track Pointer structure that contains
- Variable Information.
- Contains the pointer of Variable header.
- Global VARIABLE_GLOBAL pointer
-
-Returns:
-
- EFI STATUS
-
---*/
-{
- VARIABLE_HEADER *Variable[2];
- VARIABLE_STORE_HEADER *VariableStoreHeader[2];
- UINTN Index;
-
- //
- // We aquire the lock at the entry of FindVariable as GetVariable, GetNextVariableName
- // SetVariable all call FindVariable at entry point. Please move "Aquire Lock" to
- // the correct places if this assumption does not hold TRUE anymore.
- //
- AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
-
- //
- // 0: Non-Volatile, 1: Volatile
- //
- VariableStoreHeader[0] = (VARIABLE_STORE_HEADER *) ((UINTN) Global->NonVolatileVariableBase);
- VariableStoreHeader[1] = (VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase);
-
- //
- // Start Pointers for the variable.
- // Actual Data Pointer where data can be written.
- //
- Variable[0] = (VARIABLE_HEADER *) (VariableStoreHeader[0] + 1);
- Variable[1] = (VARIABLE_HEADER *) (VariableStoreHeader[1] + 1);
-
- if (VariableName[0] != 0 && VendorGuid == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Find the variable by walk through non-volatile and volatile variable store
- //
- for (Index = 0; Index < 2; Index++) {
- PtrTrack->StartPtr = (VARIABLE_HEADER *) (VariableStoreHeader[Index] + 1);
- PtrTrack->EndPtr = GetEndPointer (VariableStoreHeader[Index]);
-
- while (IsValidVariableHeader (Variable[Index]) && (Variable[Index] <= GetEndPointer (VariableStoreHeader[Index]))) {
- if (Variable[Index]->State == VAR_ADDED) {
- if (!(EfiAtRuntime () && !(Variable[Index]->Attributes & EFI_VARIABLE_RUNTIME_ACCESS))) {
- if (VariableName[0] == 0) {
- PtrTrack->CurrPtr = Variable[Index];
- PtrTrack->Volatile = (BOOLEAN) Index;
- return EFI_SUCCESS;
- } else {
- if (CompareGuid (VendorGuid, &Variable[Index]->VendorGuid)) {
- if (!CompareMem (VariableName, GET_VARIABLE_NAME_PTR (Variable[Index]), Variable[Index]->NameSize)) {
- PtrTrack->CurrPtr = Variable[Index];
- PtrTrack->Volatile = (BOOLEAN) Index;
- return EFI_SUCCESS;
- }
- }
- }
- }
- }
-
- Variable[Index] = GetNextVariablePtr (Variable[Index]);
- }
- //
- // While (...)
- //
- }
- //
- // for (...)
- //
- PtrTrack->CurrPtr = NULL;
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-EFIAPI
-GetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data,
- IN VARIABLE_GLOBAL * Global,
- IN UINT32 Instance
- )
-/*++
-
-Routine Description:
-
- This code finds variable in storage blocks (Volatile or Non-Volatile)
-
-Arguments:
-
- VariableName Name of Variable to be found
- VendorGuid Variable vendor GUID
- Attributes OPTIONAL Attribute value of the variable found
- DataSize Size of Data found. If size is less than the
- data, this value contains the required size.
- Data Data pointer
- Global Pointer to VARIABLE_GLOBAL structure
- Instance Instance of the Firmware Volume.
-
-Returns:
-
- EFI STATUS
-
---*/
-{
- VARIABLE_POINTER_TRACK Variable;
- UINTN VarDataSize;
- EFI_STATUS Status;
-
- if (VariableName == NULL || VendorGuid == NULL || DataSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Find existing variable
- //
- Status = FindVariable (VariableName, VendorGuid, &Variable, Global);
-
- if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Get data size
- //
- VarDataSize = Variable.CurrPtr->DataSize;
- if (*DataSize >= VarDataSize) {
- if (Data == NULL) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr), VarDataSize);
- if (Attributes != NULL) {
- *Attributes = Variable.CurrPtr->Attributes;
- }
-
- *DataSize = VarDataSize;
- Status = EFI_SUCCESS;
- goto Done;
- } else {
- *DataSize = VarDataSize;
- Status = EFI_BUFFER_TOO_SMALL;
- goto Done;
- }
-
-Done:
- ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-GetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid,
- IN VARIABLE_GLOBAL *Global,
- IN UINT32 Instance
- )
-/*++
-
-Routine Description:
-
- This code Finds the Next available variable
-
-Arguments:
-
- VariableNameSize Size of the variable
- VariableName Pointer to variable name
- VendorGuid Variable Vendor Guid
- Global VARIABLE_GLOBAL structure pointer.
- Instance FV instance
-
-Returns:
-
- EFI STATUS
-
---*/
-{
- VARIABLE_POINTER_TRACK Variable;
- UINTN VarNameSize;
- EFI_STATUS Status;
-
- if (VariableNameSize == NULL || VariableName == NULL || VendorGuid == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = FindVariable (VariableName, VendorGuid, &Variable, Global);
-
- if (Variable.CurrPtr == NULL || EFI_ERROR (Status)) {
- goto Done;
- }
-
- if (VariableName[0] != 0) {
- //
- // If variable name is not NULL, get next variable
- //
- Variable.CurrPtr = GetNextVariablePtr (Variable.CurrPtr);
- }
-
- while (TRUE) {
- //
- // If both volatile and non-volatile variable store are parsed,
- // return not found
- //
- if (Variable.CurrPtr >= Variable.EndPtr || Variable.CurrPtr == NULL) {
- Variable.Volatile = (BOOLEAN) (Variable.Volatile ^ ((BOOLEAN) 0x1));
- if (Variable.Volatile) {
- Variable.StartPtr = (VARIABLE_HEADER *) ((UINTN) (Global->VolatileVariableBase + sizeof (VARIABLE_STORE_HEADER)));
- Variable.EndPtr = (VARIABLE_HEADER *) GetEndPointer ((VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase));
- } else {
- Status = EFI_NOT_FOUND;
- goto Done;
- }
-
- Variable.CurrPtr = Variable.StartPtr;
- if (!IsValidVariableHeader (Variable.CurrPtr)) {
- continue;
- }
- }
- //
- // Variable is found
- //
- if (IsValidVariableHeader (Variable.CurrPtr) && Variable.CurrPtr->State == VAR_ADDED) {
- if (!(EfiAtRuntime () && !(Variable.CurrPtr->Attributes & EFI_VARIABLE_RUNTIME_ACCESS))) {
- VarNameSize = Variable.CurrPtr->NameSize;
- if (VarNameSize <= *VariableNameSize) {
- CopyMem (
- VariableName,
- GET_VARIABLE_NAME_PTR (Variable.CurrPtr),
- VarNameSize
- );
- CopyMem (
- VendorGuid,
- &Variable.CurrPtr->VendorGuid,
- sizeof (EFI_GUID)
- );
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_BUFFER_TOO_SMALL;
- }
-
- *VariableNameSize = VarNameSize;
- goto Done;
- }
- }
-
- Variable.CurrPtr = GetNextVariablePtr (Variable.CurrPtr);
- }
-
-Done:
- ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-SetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data,
- IN VARIABLE_GLOBAL *Global,
- IN UINTN *VolatileOffset,
- IN UINTN *NonVolatileOffset,
- IN UINT32 Instance
- )
-/*++
-
-Routine Description:
-
- This code sets variable in storage blocks (Volatile or Non-Volatile)
-
-Arguments:
-
- VariableName Name of Variable to be found
- VendorGuid Variable vendor GUID
- Attributes Attribute value of the variable found
- DataSize Size of Data found. If size is less than the
- data, this value contains the required size.
- Data Data pointer
- Global Pointer to VARIABLE_GLOBAL structure
- VolatileOffset The offset of last volatile variable
- NonVolatileOffset The offset of last non-volatile variable
- Instance Instance of the Firmware Volume.
-
-Returns:
-
- EFI STATUS
- EFI_INVALID_PARAMETER - Invalid parameter
- EFI_SUCCESS - Set successfully
- EFI_OUT_OF_RESOURCES - Resource not enough to set variable
- EFI_NOT_FOUND - Not found
-
---*/
-{
- VARIABLE_POINTER_TRACK Variable;
- EFI_STATUS Status;
- VARIABLE_HEADER *NextVariable;
- UINTN VarNameSize;
- UINTN VarNameOffset;
- UINTN VarDataOffset;
- UINTN VarSize;
- UINT8 State;
- BOOLEAN Reclaimed;
-
- Reclaimed = FALSE;
-
- if (VariableName == NULL || VariableName[0] == 0 || VendorGuid == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- Status = FindVariable (VariableName, VendorGuid, &Variable, Global);
-
- if (Status == EFI_INVALID_PARAMETER) {
- goto Done;
- } else if (!EFI_ERROR (Status) && Variable.Volatile && EfiAtRuntime()) {
- //
- // If EfiAtRuntime and the variable is Volatile and Runtime Access,
- // the volatile is ReadOnly, and SetVariable should be aborted and
- // return EFI_WRITE_PROTECTED.
- //
- Status = EFI_WRITE_PROTECTED;
- goto Done;
- } else if (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE) {
- //
- // The size of the VariableName, including the Unicode Null in bytes plus
- // the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.
- //
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- } else if (Attributes == EFI_VARIABLE_NON_VOLATILE) {
- //
- // Make sure not only EFI_VARIABLE_NON_VOLATILE is set
- //
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- } else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) ==
- EFI_VARIABLE_RUNTIME_ACCESS) {
- //
- // Make sure if runtime bit is set, boot service bit is set also
- //
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- } else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {
- //
- // Runtime but Attribute is not Runtime
- //
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- } else if (EfiAtRuntime () && Attributes && !(Attributes & EFI_VARIABLE_NON_VOLATILE)) {
- //
- // Cannot set volatile variable in Runtime
- //
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- } else if (DataSize == 0 || (Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == 0) {
- //
- // Setting a data variable with no access, or zero DataSize attributes
- // specified causes it to be deleted.
- //
- if (!EFI_ERROR (Status)) {
- State = Variable.CurrPtr->State;
- State &= VAR_DELETED;
-
- Status = UpdateVariableStore (
- Global,
- Variable.Volatile,
- FALSE,
- Instance,
- (UINTN) &Variable.CurrPtr->State,
- sizeof (UINT8),
- &State
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- Status = EFI_SUCCESS;
- goto Done;
- }
-
- Status = EFI_NOT_FOUND;
- goto Done;
- } else {
- if (!EFI_ERROR (Status)) {
- //
- // If the variable is marked valid and the same data has been passed in
- // then return to the caller immediately.
- //
- if (Variable.CurrPtr->DataSize == DataSize &&
- !CompareMem (Data, GetVariableDataPtr (Variable.CurrPtr), DataSize)
- ) {
- Status = EFI_SUCCESS;
- goto Done;
- } else if (Variable.CurrPtr->State == VAR_ADDED) {
- //
- // Mark the old variable as in delete transition
- //
- State = Variable.CurrPtr->State;
- State &= VAR_IN_DELETED_TRANSITION;
-
- Status = UpdateVariableStore (
- Global,
- Variable.Volatile,
- FALSE,
- Instance,
- (UINTN) &Variable.CurrPtr->State,
- sizeof (UINT8),
- &State
- );
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- }
- }
- //
- // Create a new variable and copy the data.
- //
- // Tricky part: Use scratch data area at the end of volatile variable store
- // as a temporary storage.
- //
- NextVariable = GetEndPointer ((VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase));
-
- SetMem (NextVariable, SCRATCH_SIZE, 0xff);
-
- NextVariable->StartId = VARIABLE_DATA;
- NextVariable->Attributes = Attributes;
- //
- // NextVariable->State = VAR_ADDED;
- //
- NextVariable->Reserved = 0;
- VarNameOffset = sizeof (VARIABLE_HEADER);
- VarNameSize = StrSize (VariableName);
- CopyMem (
- (UINT8 *) ((UINTN) NextVariable + VarNameOffset),
- VariableName,
- VarNameSize
- );
- VarDataOffset = VarNameOffset + VarNameSize + GET_PAD_SIZE (VarNameSize);
- CopyMem (
- (UINT8 *) ((UINTN) NextVariable + VarDataOffset),
- Data,
- DataSize
- );
- CopyMem (&NextVariable->VendorGuid, VendorGuid, sizeof (EFI_GUID));
- //
- // There will be pad bytes after Data, the NextVariable->NameSize and
- // NextVariable->DataSize should not include pad size so that variable
- // service can get actual size in GetVariable
- //
- NextVariable->NameSize = (UINT32)VarNameSize;
- NextVariable->DataSize = (UINT32)DataSize;
-
- //
- // The actual size of the variable that stores in storage should
- // include pad size.
- //
- VarSize = VarDataOffset + DataSize + GET_PAD_SIZE (DataSize);
- if (Attributes & EFI_VARIABLE_NON_VOLATILE) {
- if ((UINT32) (VarSize +*NonVolatileOffset) >
- ((VARIABLE_STORE_HEADER *) ((UINTN) (Global->NonVolatileVariableBase)))->Size
- ) {
- if (EfiAtRuntime ()) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
- //
- // Perform garbage collection & reclaim operation
- //
- Status = Reclaim (Global->NonVolatileVariableBase, NonVolatileOffset, FALSE);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // If still no enough space, return out of resources
- //
- if ((UINT32) (VarSize +*NonVolatileOffset) >
- ((VARIABLE_STORE_HEADER *) ((UINTN) (Global->NonVolatileVariableBase)))->Size
- ) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- Reclaimed = TRUE;
- }
- //
- // Three steps
- // 1. Write variable header
- // 2. Write variable data
- // 3. Set variable state to valid
- //
- //
- // Step 1:
- //
- Status = UpdateVariableStore (
- Global,
- FALSE,
- TRUE,
- Instance,
- *NonVolatileOffset,
- sizeof (VARIABLE_HEADER),
- (UINT8 *) NextVariable
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Step 2:
- //
- Status = UpdateVariableStore (
- Global,
- FALSE,
- TRUE,
- Instance,
- *NonVolatileOffset + sizeof (VARIABLE_HEADER),
- (UINT32) VarSize - sizeof (VARIABLE_HEADER),
- (UINT8 *) NextVariable + sizeof (VARIABLE_HEADER)
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // Step 3:
- //
- NextVariable->State = VAR_ADDED;
- Status = UpdateVariableStore (
- Global,
- FALSE,
- TRUE,
- Instance,
- *NonVolatileOffset,
- sizeof (VARIABLE_HEADER),
- (UINT8 *) NextVariable
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- *NonVolatileOffset = *NonVolatileOffset + VarSize;
-
- } else {
- if (EfiAtRuntime ()) {
- Status = EFI_INVALID_PARAMETER;
- goto Done;
- }
-
- if ((UINT32) (VarSize +*VolatileOffset) >
- ((VARIABLE_STORE_HEADER *) ((UINTN) (Global->VolatileVariableBase)))->Size
- ) {
- //
- // Perform garbage collection & reclaim operation
- //
- Status = Reclaim (Global->VolatileVariableBase, VolatileOffset, TRUE);
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- //
- // If still no enough space, return out of resources
- //
- if ((UINT32) (VarSize +*VolatileOffset) >
- ((VARIABLE_STORE_HEADER *) ((UINTN) (Global->VolatileVariableBase)))->Size
- ) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Done;
- }
-
- Reclaimed = TRUE;
- }
-
- NextVariable->State = VAR_ADDED;
- Status = UpdateVariableStore (
- Global,
- TRUE,
- TRUE,
- Instance,
- *VolatileOffset,
- (UINT32) VarSize,
- (UINT8 *) NextVariable
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
-
- *VolatileOffset = *VolatileOffset + VarSize;
- }
- //
- // Mark the old variable as deleted
- //
- if (!Reclaimed && !EFI_ERROR (Status) && Variable.CurrPtr != NULL) {
- State = Variable.CurrPtr->State;
- State &= VAR_DELETED;
-
- Status = UpdateVariableStore (
- Global,
- Variable.Volatile,
- FALSE,
- Instance,
- (UINTN) &Variable.CurrPtr->State,
- sizeof (UINT8),
- &State
- );
-
- if (EFI_ERROR (Status)) {
- goto Done;
- }
- }
- }
-
- Status = EFI_SUCCESS;
-Done:
- ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock);
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-QueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize,
- IN VARIABLE_GLOBAL *Global,
- IN UINT32 Instance
- )
-/*++
-
-Routine Description:
-
- This code returns information about the EFI variables.
-
-Arguments:
-
- Attributes Attributes bitmask to specify the type of variables
- on which to return information.
- MaximumVariableStorageSize Pointer to the maximum size of the storage space available
- for the EFI variables associated with the attributes specified.
- RemainingVariableStorageSize Pointer to the remaining size of the storage space available
- for the EFI variables associated with the attributes specified.
- MaximumVariableSize Pointer to the maximum size of the individual EFI variables
- associated with the attributes specified.
- Global Pointer to VARIABLE_GLOBAL structure.
- Instance Instance of the Firmware Volume.
-
-Returns:
-
- EFI STATUS
- EFI_INVALID_PARAMETER - An invalid combination of attribute bits was supplied.
- EFI_SUCCESS - Query successfully.
- EFI_UNSUPPORTED - The attribute is not supported on this platform.
-
---*/
-{
- VARIABLE_HEADER *Variable;
- VARIABLE_HEADER *NextVariable;
- UINT64 VariableSize;
- VARIABLE_STORE_HEADER *VariableStoreHeader;
-
- if(MaximumVariableStorageSize == NULL || RemainingVariableStorageSize == NULL || MaximumVariableSize == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if((Attributes & (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS)) == 0) {
- //
- // Make sure the Attributes combination is supported by the platform.
- //
- return EFI_UNSUPPORTED;
- } else if ((Attributes & (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == EFI_VARIABLE_RUNTIME_ACCESS) {
- //
- // Make sure if runtime bit is set, boot service bit is set also.
- //
- return EFI_INVALID_PARAMETER;
- } else if (EfiAtRuntime () && !(Attributes & EFI_VARIABLE_RUNTIME_ACCESS)) {
- //
- // Make sure RT Attribute is set if we are in Runtime phase.
- //
- return EFI_INVALID_PARAMETER;
- }
-
- AcquireLockOnlyAtBootTime(&Global->VariableServicesLock);
-
- if((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {
- //
- // Query is Volatile related.
- //
- VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) Global->VolatileVariableBase);
- } else {
- //
- // Query is Non-Volatile related.
- //
- VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINTN) Global->NonVolatileVariableBase);
- }
-
- //
- // Now let's fill *MaximumVariableStorageSize *RemainingVariableStorageSize
- // with the storage size (excluding the storage header size).
- //
- *MaximumVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
- *RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
-
- //
- // Let *MaximumVariableSize be MAX_VARIABLE_SIZE.
- //
- *MaximumVariableSize = MAX_VARIABLE_SIZE;
-
- //
- // Point to the starting address of the variables.
- //
- Variable = (VARIABLE_HEADER *) (VariableStoreHeader + 1);
-
- //
- // Now walk through the related variable store.
- //
- while (IsValidVariableHeader (Variable) && (Variable < GetEndPointer (VariableStoreHeader))) {
- NextVariable = GetNextVariablePtr (Variable);
- VariableSize = (UINT64) (UINTN) NextVariable - (UINT64) (UINTN) Variable;
-
- if (EfiAtRuntime ()) {
- //
- // we don't take the state of the variables in mind
- // when calculating RemainingVariableStorageSize,
- // since the space occupied by variables not marked with
- // VAR_ADDED is not allowed to be reclaimed in Runtime.
- //
- *RemainingVariableStorageSize -= VariableSize;
- } else {
- //
- // Only care about Variables with State VAR_ADDED,because
- // the space not marked as VAR_ADDED is reclaimable now.
- //
- if (Variable->State == VAR_ADDED) {
- *RemainingVariableStorageSize -= VariableSize;
- }
- }
-
- //
- // Go to the next one
- //
- Variable = NextVariable;
- }
-
- ReleaseLockOnlyAtBootTime (&Global->VariableServicesLock);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-VariableCommonInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- This function does common initialization for variable services
-
-Arguments:
-
- ImageHandle - The firmware allocated handle for the EFI image.
- SystemTable - A pointer to the EFI System Table.
-
-Returns:
-
- Status code.
-
- EFI_NOT_FOUND - Variable store area not found.
- EFI_UNSUPPORTED - Currently only one non-volatile variable store is supported.
- EFI_SUCCESS - Variable services successfully initialized.
-
---*/
-{
- EFI_STATUS Status;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- CHAR8 *CurrPtr;
- VARIABLE_STORE_HEADER *VolatileVariableStore;
- VARIABLE_STORE_HEADER *VariableStoreHeader;
- VARIABLE_HEADER *NextVariable;
- UINT32 Instance;
- EFI_PHYSICAL_ADDRESS FvVolHdr;
-
- UINT64 TempVariableStoreHeader;
-
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;
- EFI_FLASH_SUBAREA_ENTRY VariableStoreEntry;
- UINT64 BaseAddress;
- UINT64 Length;
- UINTN Index;
- UINT8 Data;
-
- mVariableModuleGlobal = AllocateRuntimePool (sizeof (ESAL_VARIABLE_GLOBAL));
- if (mVariableModuleGlobal == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- EfiInitializeLock(&mVariableModuleGlobal->VariableGlobal[Physical].VariableServicesLock, TPL_NOTIFY);
-
- //
- // Allocate memory for volatile variable store
- //
- VolatileVariableStore = AllocateRuntimePool (VARIABLE_STORE_SIZE + SCRATCH_SIZE);
- if (VolatileVariableStore == NULL) {
- FreePool (mVariableModuleGlobal);
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetMem (VolatileVariableStore, VARIABLE_STORE_SIZE + SCRATCH_SIZE, 0xff);
-
- //
- // Variable Specific Data
- //
- mVariableModuleGlobal->VariableGlobal[Physical].VolatileVariableBase = (EFI_PHYSICAL_ADDRESS) (UINTN) VolatileVariableStore;
- mVariableModuleGlobal->VolatileLastVariableOffset = sizeof (VARIABLE_STORE_HEADER);
-
- VolatileVariableStore->Signature = VARIABLE_STORE_SIGNATURE;
- VolatileVariableStore->Size = VARIABLE_STORE_SIZE;
- VolatileVariableStore->Format = VARIABLE_STORE_FORMATTED;
- VolatileVariableStore->State = VARIABLE_STORE_HEALTHY;
- VolatileVariableStore->Reserved = 0;
- VolatileVariableStore->Reserved1 = 0;
-
- //
- // Get non volatile varaible store
- //
-
- TempVariableStoreHeader = (UINT64) PcdGet32 (PcdFlashNvStorageVariableBase);
- VariableStoreEntry.Base = TempVariableStoreHeader + \
- (((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength);
- VariableStoreEntry.Length = (UINT64) PcdGet32 (PcdFlashNvStorageVariableSize) - \
- (((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength);
- //
- // Mark the variable storage region of the FLASH as RUNTIME
- //
- BaseAddress = VariableStoreEntry.Base & (~EFI_PAGE_MASK);
- Length = VariableStoreEntry.Length + (VariableStoreEntry.Base - BaseAddress);
- Length = (Length + EFI_PAGE_SIZE - 1) & (~EFI_PAGE_MASK);
-
- Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdDescriptor);
- if (EFI_ERROR (Status)) {
- FreePool (mVariableModuleGlobal);
- FreePool (VolatileVariableStore);
- return EFI_UNSUPPORTED;
- }
-
- Status = gDS->SetMemorySpaceAttributes (
- BaseAddress,
- Length,
- GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME
- );
- if (EFI_ERROR (Status)) {
- FreePool (mVariableModuleGlobal);
- FreePool (VolatileVariableStore);
- return EFI_UNSUPPORTED;
- }
- //
- // Get address of non volatile variable store base
- //
- mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase = VariableStoreEntry.Base;
-
- //
- // Check Integrity
- //
- //
- // Find the Correct Instance of the FV Block Service.
- //
- Instance = 0;
- CurrPtr = (CHAR8 *) ((UINTN) mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase);
- while (EfiFvbGetPhysicalAddress (Instance, &FvVolHdr) == EFI_SUCCESS) {
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) FvVolHdr);
- if (CurrPtr >= (CHAR8 *) FwVolHeader && CurrPtr < (((CHAR8 *) FwVolHeader) + FwVolHeader->FvLength)) {
- mVariableModuleGlobal->FvbInstance = Instance;
- break;
- }
-
- Instance++;
- }
-
- VariableStoreHeader = (VARIABLE_STORE_HEADER *) CurrPtr;
- if (GetVariableStoreStatus (VariableStoreHeader) == EfiValid) {
- if (~VariableStoreHeader->Size == 0) {
- Status = UpdateVariableStore (
- &mVariableModuleGlobal->VariableGlobal[Physical],
- FALSE,
- FALSE,
- mVariableModuleGlobal->FvbInstance,
- (UINTN) &VariableStoreHeader->Size,
- sizeof (UINT32),
- (UINT8 *) &VariableStoreEntry.Length
- );
- //
- // As Variables are stored in NV storage, which are slow devices,such as flash.
- // Variable operation may skip checking variable program result to improve performance,
- // We can assume Variable program is OK through some check point.
- // Variable Store Size Setting should be the first Variable write operation,
- // We can assume all Read/Write is OK if we can set Variable store size successfully.
- // If write fail, we will assert here
- //
- ASSERT(VariableStoreHeader->Size == VariableStoreEntry.Length);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase = (EFI_PHYSICAL_ADDRESS) ((UINTN) CurrPtr);
- //
- // Parse non-volatile variable data and get last variable offset
- //
- NextVariable = (VARIABLE_HEADER *) (CurrPtr + sizeof (VARIABLE_STORE_HEADER));
- Status = EFI_SUCCESS;
-
- while (IsValidVariableHeader (NextVariable)) {
- NextVariable = GetNextVariablePtr (NextVariable);
- }
-
- mVariableModuleGlobal->NonVolatileLastVariableOffset = (UINTN) NextVariable - (UINTN) CurrPtr;
-
- //
- // Check if the free area is blow a threshold
- //
- if ((((VARIABLE_STORE_HEADER *)((UINTN) CurrPtr))->Size - mVariableModuleGlobal->NonVolatileLastVariableOffset) < VARIABLE_RECLAIM_THRESHOLD) {
- Status = Reclaim (
- mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase,
- &mVariableModuleGlobal->NonVolatileLastVariableOffset,
- FALSE
- );
- }
-
- if (EFI_ERROR (Status)) {
- FreePool (mVariableModuleGlobal);
- FreePool (VolatileVariableStore);
- return Status;
- }
-
- //
- // Check if the free area is really free.
- //
- for (Index = mVariableModuleGlobal->NonVolatileLastVariableOffset; Index < VariableStoreHeader->Size; Index++) {
- Data = ((UINT8 *) (UINTN) mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase)[Index];
- if (Data != 0xff) {
- //
- // There must be something wrong in variable store, do reclaim operation.
- //
- Status = Reclaim (
- mVariableModuleGlobal->VariableGlobal[Physical].NonVolatileVariableBase,
- &mVariableModuleGlobal->NonVolatileLastVariableOffset,
- FALSE
- );
- break;
- }
- }
- }
-
- if (EFI_ERROR (Status)) {
- FreePool (mVariableModuleGlobal);
- FreePool (VolatileVariableStore);
- }
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.dxs b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.dxs
deleted file mode 100644
index 95f4bc3..0000000
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.dxs
+++ /dev/null
@@ -1,27 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Ia32Variable.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID AND
- EFI_ALTERNATE_FV_BLOCK_GUID AND
- EFI_FTW_LITE_PROTOCOL_GUID
-DEPENDENCY_END
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.h b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.h
deleted file mode 100644
index 51090ab..0000000
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Variable.h
-
-Abstract:
-
---*/
-
-#ifndef _VARIABLE_H
-#define _VARIABLE_H
-
-//
-// Statements that include other header files
-//
-
-//
-// BugBug: We need relcate the head file.
-//
-#include <Common/Variable.h>
-
-#define VARIABLE_RECLAIM_THRESHOLD (1024)
-
-#define VARIABLE_STORE_SIZE (64 * 1024)
-#define SCRATCH_SIZE (4 * 1024)
-
-//
-// Define GET_PAD_SIZE to optimize compiler
-//
-#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
-#define GET_PAD_SIZE(a) (0)
-#else
-#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
-#endif
-
-#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
-
-typedef enum {
- Physical,
- Virtual
-} VARIABLE_POINTER_TYPE;
-
-typedef struct {
- VARIABLE_HEADER *CurrPtr;
- VARIABLE_HEADER *EndPtr;
- VARIABLE_HEADER *StartPtr;
- BOOLEAN Volatile;
-} VARIABLE_POINTER_TRACK;
-
-typedef struct {
- EFI_PHYSICAL_ADDRESS VolatileVariableBase;
- EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;
- EFI_LOCK VariableServicesLock;
-} VARIABLE_GLOBAL;
-
-typedef struct {
- VARIABLE_GLOBAL VariableGlobal[2];
- UINTN VolatileLastVariableOffset;
- UINTN NonVolatileLastVariableOffset;
- UINT32 FvbInstance;
-} ESAL_VARIABLE_GLOBAL;
-
-extern ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;
-
-//
-// Functions
-//
-EFI_STATUS
-EFIAPI
-VariableCommonInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-EFI_STATUS
-EFIAPI
-VariableServiceInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-VOID
-EFIAPI
-VariableClassAddressChangeEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-;
-
-EFI_STATUS
-EFIAPI
-GetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data,
- IN VARIABLE_GLOBAL * Global,
- IN UINT32 Instance
- )
-;
-
-EFI_STATUS
-EFIAPI
-GetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid,
- IN VARIABLE_GLOBAL *Global,
- IN UINT32 Instance
- )
-;
-
-EFI_STATUS
-EFIAPI
-SetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data,
- IN VARIABLE_GLOBAL *Global,
- IN UINTN *VolatileOffset,
- IN UINTN *NonVolatileOffset,
- IN UINT32 Instance
- )
-;
-
-EFI_STATUS
-EFIAPI
-QueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize,
- IN VARIABLE_GLOBAL *Global,
- IN UINT32 Instance
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.msa b/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.msa
deleted file mode 100644
index 56f19b0..0000000
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/Variable.msa
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>Variable</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>CBD2E4D5-7068-4FF5-B462-9822B4AD8D60</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Variable module.</Abstract>
- <Description>This module installs three EFI_RUNTIME_SERVICES: SetVariable, GetVariable, GetNextVariableName.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>Variable</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DxeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkFvbServiceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Variable.h</Filename>
- <Filename>Variable.c</Filename>
- <Filename>reclaim.h</Filename>
- <Filename>reclaim.c</Filename>
- <Filename>InitVariable.c</Filename>
- <Filename>Variable.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiVariableArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiVariableWriteArchProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiFaultTolerantWriteLiteProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>VariableServiceInitialize</ModuleEntryPoint>
- </Extern>
- <Extern>
- <SetVirtualAddressMapCallBack>VariableClassAddressChangeEvent</SetVirtualAddressMapCallBack>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The driver gets the Variable store base address from this PCD. This base address point to
- an EFI_FIRMWARE_VOLUMN_HEADER struct.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableSize</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The driver gets the NvStorage Variable Size from this PCD.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/VariableIpf.msa b/EdkModulePkg/Universal/Variable/RuntimeDxe/VariableIpf.msa
deleted file mode 100644
index 73f2b0d..0000000
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/VariableIpf.msa
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>VariableIpf</ModuleName>
- <ModuleType>DXE_SAL_DRIVER</ModuleType>
- <GuidValue>9D0E793B-3970-4a6c-BA26-B4E2C30B437B</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Variable module.</Abstract>
- <Description>This module installs three EFI_RUNTIME_SERVICES: SetVariable, GetVariable, GetNextVariableName.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>VariableIpf</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DxeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>EdkFvbServiceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ExtendedSalLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Variable.h</Filename>
- <Filename>Variable.c</Filename>
- <Filename>reclaim.h</Filename>
- <Filename>reclaim.c</Filename>
- <Filename>Ipf/InitVariable.c</Filename>
- <Filename>IpfVariable.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiFaultTolerantWriteLiteProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="SOMETIMES_CONSUMED">
- <ProtocolCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiExtendedSalVariableServicesProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>VariableServiceInitialize</ModuleEntryPoint>
- </Extern>
- <Extern>
- <SetVirtualAddressMapCallBack>VariableClassAddressChangeEvent</SetVirtualAddressMapCallBack>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableBase</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The driver gets the Variable store base address from this PCD. This base address point to
- an EFI_FIRMWARE_VOLUMN_HEADER struct.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdFlashNvStorageVariableSize</C_Name>
- <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The driver gets the NvStorage Variable Size from this PCD.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/reclaim.c b/EdkModulePkg/Universal/Variable/RuntimeDxe/reclaim.c
deleted file mode 100644
index 4c72490..0000000
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/reclaim.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- reclaim.c
-
-Abstract:
-
- Handles non-volatile variable store garbage collection, using FTW
- (Fault Tolerant Write) protocol.
-
-Revision History
-
---*/
-
-#include "reclaim.h"
-#include "Common/Variable.h"
-
-EFI_STATUS
-GetFvbHandleByAddress (
- IN EFI_PHYSICAL_ADDRESS Address,
- OUT EFI_HANDLE *FvbHandle
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- UINTN Index;
- EFI_PHYSICAL_ADDRESS FvbBaseAddress;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
-
- *FvbHandle = NULL;
- //
- // Locate all handles of Fvb protocol
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- //
- // Get the FVB to access variable store
- //
- for (Index = 0; Index < HandleCount; Index += 1) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID **) &Fvb
- );
- if (EFI_ERROR (Status)) {
- Status = EFI_NOT_FOUND;
- break;
- }
- //
- // Compare the address and select the right one
- //
- Status = Fvb->GetPhysicalAddress (Fvb, &FvbBaseAddress);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) FvbBaseAddress);
- if ((Address >= FvbBaseAddress) && (Address <= (FvbBaseAddress + FwVolHeader->FvLength))) {
- *FvbHandle = HandleBuffer[Index];
- Status = EFI_SUCCESS;
- break;
- }
- }
-
- FreePool (HandleBuffer);
- return Status;
-}
-
-STATIC
-EFI_STATUS
-GetLbaAndOffsetByAddress (
- IN EFI_PHYSICAL_ADDRESS Address,
- OUT EFI_LBA *Lba,
- OUT UINTN *Offset
- )
-{
- EFI_STATUS Status;
- EFI_HANDLE FvbHandle;
- EFI_PHYSICAL_ADDRESS FvbBaseAddress;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- EFI_FV_BLOCK_MAP_ENTRY *FvbMapEntry;
- UINT32 LbaIndex;
-
- *Lba = (EFI_LBA) (-1);
- *Offset = 0;
-
- //
- // Get the proper FVB
- //
- Status = GetFvbHandleByAddress (Address, &FvbHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->HandleProtocol (
- FvbHandle,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID **) &Fvb
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get the Base Address of FV
- //
- Status = Fvb->GetPhysicalAddress (Fvb, &FvbBaseAddress);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) FvbBaseAddress);
-
- //
- // Get the (LBA, Offset) of Address
- //
- if ((Address >= FvbBaseAddress) && (Address <= (FvbBaseAddress + FwVolHeader->FvLength))) {
- if ((FwVolHeader->FvLength) > (FwVolHeader->HeaderLength)) {
- //
- // BUGBUG: Assume one FV has one type of BlockLength
- //
- FvbMapEntry = &FwVolHeader->FvBlockMap[0];
- for (LbaIndex = 1; LbaIndex <= FvbMapEntry->NumBlocks; LbaIndex += 1) {
- if (Address < (FvbBaseAddress + FvbMapEntry->BlockLength * LbaIndex)) {
- //
- // Found the (Lba, Offset)
- //
- *Lba = LbaIndex - 1;
- *Offset = (UINTN) (Address - (FvbBaseAddress + FvbMapEntry->BlockLength * (LbaIndex - 1)));
- return EFI_SUCCESS;
- }
- }
- }
- }
-
- return EFI_ABORTED;
-}
-
-EFI_STATUS
-FtwVariableSpace (
- IN EFI_PHYSICAL_ADDRESS VariableBase,
- IN UINT8 *Buffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
- Write a buffer to Variable space, in the working block.
-
-Arguments:
- FvbHandle - Indicates a handle to FVB to access variable store
- Buffer - Point to the input buffer
- BufferSize - The number of bytes of the input Buffer
-
-Returns:
- EFI_SUCCESS - The function completed successfully
- EFI_ABORTED - The function could not complete successfully
- EFI_NOT_FOUND - Locate FVB protocol by handle fails
-
---*/
-{
- EFI_STATUS Status;
- EFI_HANDLE FvbHandle;
- EFI_FTW_LITE_PROTOCOL *FtwLiteProtocol;
- EFI_LBA VarLba;
- UINTN VarOffset;
- UINT8 *FtwBuffer;
- UINTN FtwBufferSize;
-
- //
- // Locate fault tolerant write protocol
- //
- Status = gBS->LocateProtocol (
- &gEfiFaultTolerantWriteLiteProtocolGuid,
- NULL,
- (VOID **) &FtwLiteProtocol
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
- //
- // Locate Fvb handle by address
- //
- Status = GetFvbHandleByAddress (VariableBase, &FvbHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Get LBA and Offset by address
- //
- Status = GetLbaAndOffsetByAddress (VariableBase, &VarLba, &VarOffset);
- if (EFI_ERROR (Status)) {
- return EFI_ABORTED;
- }
- //
- // Prepare for the variable data
- //
- FtwBufferSize = ((VARIABLE_STORE_HEADER *) ((UINTN) VariableBase))->Size;
- FtwBuffer = AllocateRuntimePool (FtwBufferSize);
- if (FtwBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- SetMem (FtwBuffer, FtwBufferSize, (UINT8) 0xff);
- CopyMem (FtwBuffer, Buffer, BufferSize);
-
- //
- // FTW write record
- //
- Status = FtwLiteProtocol->Write (
- FtwLiteProtocol,
- FvbHandle,
- VarLba, // LBA
- VarOffset, // Offset
- &FtwBufferSize, // NumBytes,
- FtwBuffer
- );
-
- FreePool (FtwBuffer);
- return Status;
-}
diff --git a/EdkModulePkg/Universal/Variable/RuntimeDxe/reclaim.h b/EdkModulePkg/Universal/Variable/RuntimeDxe/reclaim.h
deleted file mode 100644
index 7bc1020..0000000
--- a/EdkModulePkg/Universal/Variable/RuntimeDxe/reclaim.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- reclaim.h
-
-Abstract:
-
- Definitions for non-volatile variable store garbage collection
-
-Revision History
-
---*/
-
-#ifndef _VAR_RECLAIM_H
-#define _VAR_RECLAIM_H
-
-//
-// Functions
-//
-EFI_STATUS
-GetFvbHandleByAddress (
- IN EFI_PHYSICAL_ADDRESS VariableStoreBase,
- OUT EFI_HANDLE *FvbHandle
- )
-;
-
-EFI_STATUS
-FtwVariableSpace (
- IN EFI_PHYSICAL_ADDRESS VariableBaseAddress,
- IN UINT8 *Buffer,
- IN UINTN BufferSize
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.c b/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.c
deleted file mode 100644
index e38def3..0000000
--- a/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- WatchDogTimer.c
-
-Abstract:
-
- Generic watchdog timer implemenetation using EFI APIs
-
-Revision History
-
---*/
-
-#include "WatchDogTimer.h"
-
-//
-// Handle for the Watchdog Timer Architectural Protocol instance produced by this driver
-//
-EFI_HANDLE mWatchdogTimerHandle = NULL;
-
-//
-// The Watchdog Timer Architectural Protocol instance produced by this driver
-//
-EFI_WATCHDOG_TIMER_ARCH_PROTOCOL mWatchdogTimer = {
- WatchdogTimerDriverRegisterHandler,
- WatchdogTimerDriverSetTimerPeriod,
- WatchdogTimerDriverGetTimerPeriod
-};
-
-//
-// The watchdog timer period in 100 nS units
-//
-UINT64 mWatchdogTimerPeriod = 0;
-
-//
-// The notification function to call if the watchdig timer fires
-//
-EFI_WATCHDOG_TIMER_NOTIFY mWatchdogTimerNotifyFunction = NULL;
-
-//
-// The one-shot timer event that is armed when the watchdog timer is enabled
-//
-EFI_EVENT mWatchdogTimerEvent;
-
-//
-// Worker Functions
-//
-STATIC
-VOID
-EFIAPI
-WatchdogTimerDriverExpires (
- IN EFI_EVENT Timer,
- IN VOID *Context
- )
-/*++
-
- Routine Description:
-
- Notification function that is called if the watchdog timer is fired. If a
- handler has been registered with the Watchdog Timer Architectural Protocol,
- then that handler is called passing in the time period that has passed that
- cause the watchdog timer to fire. Then, a call to the Runtime Service
- ResetSystem() is made to reset the platform.
-
- Arguments:
-
- Timer - The one-shot timer event that was signaled when the watchdog timer
- expired.
-
- Context - The context that was registered when the event Timer was created.
-
- Returns:
-
- None.
-
---*/
-{
- //
- // Report error code before exiting
- //
- REPORT_STATUS_CODE (
- EFI_ERROR_CODE | EFI_ERROR_MINOR,
- (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_TIMER_EXPIRED)
- );
-
- //
- // If a notification function has been registered, then call it
- //
- if (mWatchdogTimerNotifyFunction != NULL) {
- mWatchdogTimerNotifyFunction (mWatchdogTimerPeriod);
- }
- //
- // Reset the platform
- //
- gRT->ResetSystem (EfiResetCold, EFI_TIMEOUT, 0, NULL);
-}
-
-EFI_STATUS
-EFIAPI
-WatchdogTimerDriverRegisterHandler (
- IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
- )
-/*++
-
-Routine Description:
-
- This function registers a handler that is to be invoked when the watchdog
- timer fires. By default, the EFI_WATCHDOG_TIMER protocol will call the
- Runtime Service ResetSystem() when the watchdog timer fires. If a
- NotifyFunction is registered, then the NotifyFunction will be called before
- the Runtime Service ResetSystem() is called. If NotifyFunction is NULL, then
- the watchdog handler is unregistered. If a watchdog handler is registered,
- then EFI_SUCCESS is returned. If an attempt is made to register a handler
- when a handler is already registered, then EFI_ALREADY_STARTED is returned.
- If an attempt is made to uninstall a handler when a handler is not installed,
- then return EFI_INVALID_PARAMETER.
-
-Arguments:
-
- This - The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
-
- NotifyFunction - The function to call when the watchdog timer fires. If this
- is NULL, then the handler will be unregistered.
-
-Returns:
-
- EFI_SUCCESS - The watchdog timer handler was registered or
- unregistered.
-
- EFI_ALREADY_STARTED - NotifyFunction is not NULL, and a handler is already
- registered.
-
- EFI_INVALID_PARAMETER - NotifyFunction is NULL, and a handler was not
- previously registered.
-
---*/
-{
- if (NotifyFunction == NULL && mWatchdogTimerNotifyFunction == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (NotifyFunction != NULL && mWatchdogTimerNotifyFunction != NULL) {
- return EFI_ALREADY_STARTED;
- }
-
- mWatchdogTimerNotifyFunction = NotifyFunction;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-WatchdogTimerDriverSetTimerPeriod (
- IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- IN UINT64 TimerPeriod
- )
-/*++
-
-Routine Description:
-
- This function sets the amount of time to wait before firing the watchdog
- timer to TimerPeriod 100 nS units. If TimerPeriod is 0, then the watchdog
- timer is disabled.
-
-Arguments:
-
- This - The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
-
- TimerPeriod - The amount of time in 100 nS units to wait before the watchdog
- timer is fired. If TimerPeriod is zero, then the watchdog
- timer is disabled.
-
-Returns:
-
- EFI_SUCCESS - The watchdog timer has been programmed to fire in Time
- 100 nS units.
-
- EFI_DEVICE_ERROR - A watchdog timer could not be programmed due to a device
- error.
-
---*/
-{
- mWatchdogTimerPeriod = TimerPeriod;
-
- return gBS->SetTimer (
- mWatchdogTimerEvent,
- (mWatchdogTimerPeriod == 0) ? TimerCancel : TimerRelative,
- mWatchdogTimerPeriod
- );
-}
-
-EFI_STATUS
-EFIAPI
-WatchdogTimerDriverGetTimerPeriod (
- IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- IN UINT64 *TimerPeriod
- )
-/*++
-
-Routine Description:
-
- This function retrieves the amount of time the system will wait before firing
- the watchdog timer. This period is returned in TimerPeriod, and EFI_SUCCESS
- is returned. If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.
-
-Arguments:
-
- This - The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.
-
- TimerPeriod - A pointer to the amount of time in 100 nS units that the system
- will wait before the watchdog timer is fired. If TimerPeriod of
- zero is returned, then the watchdog timer is disabled.
-
-Returns:
-
- EFI_SUCCESS - The amount of time that the system will wait before
- firing the watchdog timer was returned in TimerPeriod.
-
- EFI_INVALID_PARAMETER - TimerPeriod is NULL.
-
---*/
-{
- if (TimerPeriod == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *TimerPeriod = mWatchdogTimerPeriod;
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-WatchdogTimerDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Initialize the Watchdog Timer Architectural Protocol driver
-
-Arguments:
-
- ImageHandle - ImageHandle of the loaded driver
-
- SystemTable - Pointer to the System Table
-
-Returns:
-
- EFI_SUCCESS - Timer Architectural Protocol created
-
- EFI_OUT_OF_RESOURCES - Not enough resources available to initialize driver.
-
- EFI_DEVICE_ERROR - A device error occured attempting to initialize the driver.
-
---*/
-{
- EFI_STATUS Status;
-
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_SW_PC_INIT_BEGIN)
- );
- //
- // Make sure the Watchdog Timer Architectural Protocol is not already installed in the system
- //
- ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolGuid);
-
- //
- // Create the timer event used to implement a simple watchdog timer
- //
- Status = gBS->CreateEvent (
- EVT_TIMER | EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- WatchdogTimerDriverExpires,
- NULL,
- &mWatchdogTimerEvent
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install the Watchdog Timer Arch Protocol onto a new handle
- //
- Status = gBS->InstallMultipleProtocolInterfaces (
- &mWatchdogTimerHandle,
- &gEfiWatchdogTimerArchProtocolGuid,
- &mWatchdogTimer,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_SW_PC_INIT_END)
- );
-
- return Status;
-}
diff --git a/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.dxs b/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.dxs
deleted file mode 100644
index 0f40711..0000000
--- a/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.dxs
+++ /dev/null
@@ -1,26 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- WatchDogTimer.dxs
-
-Abstract:
-
- Dependency expression source file.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- EFI_TIMER_ARCH_PROTOCOL_GUID
-DEPENDENCY_END
-
diff --git a/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.h b/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.h
deleted file mode 100644
index bb1936b..0000000
--- a/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- WatchDogTimer.h
-
-Abstract:
-
- Generic watchdog timer implemenetation using EFI APIs
-
-Revision History
-
---*/
-
-#ifndef _WATCHDOG_TIMER_H_
-#define _WATCHDOG_TIMER_H_
-
-//
-// Function Prototypes
-//
-EFI_STATUS
-EFIAPI
-WatchdogTimerDriverRegisterHandler (
- IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction
- )
-;
-
-EFI_STATUS
-EFIAPI
-WatchdogTimerDriverSetTimerPeriod (
- IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- IN UINT64 TimerPeriod
- )
-;
-
-EFI_STATUS
-EFIAPI
-WatchdogTimerDriverGetTimerPeriod (
- IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This,
- IN UINT64 *TimerPeriod
- )
-;
-
-EFI_STATUS
-EFIAPI
-WatchdogTimerDriverInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.msa b/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.msa
deleted file mode 100644
index 9231ae5..0000000
--- a/EdkModulePkg/Universal/WatchdogTimer/Dxe/WatchDogTimer.msa
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>WatchDogTimer</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>F099D67F-71AE-4c36-B2A3-DCEB0EB2B7D8</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for WatchDogTimer module.</Abstract>
- <Description>Generic watchdog timer implemenetation using EFI APIs.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>WatchDogTimer</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiDriverEntryPoint</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>ReportStatusCodeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>WatchDogTimer.c</Filename>
- <Filename>WatchDogTimer.h</Filename>
- <Filename>WatchDogTimer.dxs</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gEfiWatchdogTimerArchProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <ModuleEntryPoint>WatchdogTimerDriverInitialize</ModuleEntryPoint>
- </Extern>
- </Externs>
-</ModuleSurfaceArea> \ No newline at end of file