#include "BdsPlatform.h"\r
\r
\r
+//\r
+// Global data\r
+//\r
+\r
+VOID *mEfiDevPathNotifyReg;\r
+EFI_EVENT mEfiDevPathEvent;\r
+\r
+\r
+//\r
+// Function prototypes\r
+//\r
+\r
+VOID\r
+InstallDevicePathCallback (\r
+ VOID\r
+ );\r
+\r
+\r
//\r
// BDS Platform Functions\r
//\r
--*/\r
{\r
DEBUG ((EFI_D_INFO, "PlatformBdsInit\n"));\r
+ InstallDevicePathCallback ();\r
}\r
\r
\r
)\r
{\r
//\r
- // Device 0 Function 0\r
+ // Bus 0, Device 0, Function 0 - Host to PCI Bridge\r
+ //\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 0, 0, 0x3c), 0x00);\r
+\r
+ //\r
+ // Bus 0, Device 1, Function 0 - PCI to ISA Bridge\r
//\r
- PciWrite8 (PCI_LIB_ADDRESS (0,0,0,0x3c), 0x00);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x3c), 0x00);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x60), 0x0b);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x61), 0x09);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x62), 0x0b);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x63), 0x09);\r
\r
//\r
- // Device 1 Function 0\r
+ // Bus 0, Device 1, Function 1 - IDE Controller\r
//\r
- PciWrite8 (PCI_LIB_ADDRESS (0,1,0,0x3c), 0x00);\r
- PciWrite8 (PCI_LIB_ADDRESS (0,1,0,0x60), 0x8b);\r
- PciWrite8 (PCI_LIB_ADDRESS (0,1,0,0x61), 0x89);\r
- PciWrite8 (PCI_LIB_ADDRESS (0,1,0,0x62), 0x0a);\r
- PciWrite8 (PCI_LIB_ADDRESS (0,1,0,0x63), 0x89);\r
- //PciWrite8 (PCI_LIB_ADDRESS (0,1,0,0x82), 0x02);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 1, 1, 0x3c), 0x00);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 1, 1, 0x0d), 0x40);\r
\r
//\r
- // Device 1 Function 1\r
+ // Bus 0, Device 1, Function 3 - Power Managment Controller\r
//\r
- PciWrite8 (PCI_LIB_ADDRESS (0,1,1,0x3c), 0x00);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 1, 3, 0x3c), 0x0b);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 1, 3, 0x3d), 0x01);\r
\r
//\r
- // Device 1 Function 3\r
+ // Bus 0, Device 2, Function 0 - Video Controller\r
//\r
- PciWrite8 (PCI_LIB_ADDRESS (0,1,3,0x3c), 0x0b);\r
- PciWrite8 (PCI_LIB_ADDRESS (0,1,3,0x3d), 0x01);\r
- PciWrite8 (PCI_LIB_ADDRESS (0,1,3,0x5f), 0x90);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 2, 0, 0x3c), 0x00);\r
\r
//\r
- // Device 2 Function 0\r
+ // Bus 0, Device 3, Function 0 - Network Controller\r
//\r
- PciWrite8 (PCI_LIB_ADDRESS (0,2,0,0x3c), 0x00);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 3, 0, 0x3c), 0x0b);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 3, 0, 0x3d), 0x01);\r
\r
//\r
- // Device 3 Function 0\r
+ // Bus 0, Device 4, Function 0 - RAM Memory\r
//\r
- PciWrite8 (PCI_LIB_ADDRESS (0,3,0,0x3c), 0x0b);\r
- PciWrite8 (PCI_LIB_ADDRESS (0,3,0,0x3d), 0x01);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 4, 0, 0x3c), 0x09);\r
+ PciWrite8 (PCI_LIB_ADDRESS (0, 4, 0, 0x3d), 0x01);\r
}\r
\r
\r
BdsLibConnectAll ();\r
\r
PciInitialization ();\r
+\r
+ //\r
+ // Clear the logo after all devices are connected.\r
+ //\r
+ gST->ConOut->ClearScreen (gST->ConOut);\r
}\r
\r
VOID\r
DEBUG ((EFI_D_INFO, "PlatformBdsLockNonUpdatableFlash\n"));\r
return EFI_SUCCESS;\r
}\r
+\r
+\r
+/**\r
+ This notification function is invoked when an instance of the\r
+ EFI_DEVICE_PATH_PROTOCOL is produced.\r
+\r
+ @param Event The event that occured\r
+ @param Context For EFI compatiblity. Not used.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+NotifyDevPath (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ EFI_HANDLE Handle;\r
+ EFI_STATUS Status;\r
+ UINTN BufferSize;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevPathNode;\r
+ ATAPI_DEVICE_PATH *Atapi;\r
+\r
+ //\r
+ // Examine all new handles\r
+ //\r
+ for (;;) {\r
+ //\r
+ // Get the next handle\r
+ //\r
+ BufferSize = sizeof (Handle);\r
+ Status = gBS->LocateHandle (\r
+ ByRegisterNotify,\r
+ NULL,\r
+ mEfiDevPathNotifyReg,\r
+ &BufferSize,\r
+ &Handle\r
+ );\r
+\r
+ //\r
+ // If not found, we're done\r
+ //\r
+ if (EFI_NOT_FOUND == Status) {\r
+ break;\r
+ }\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ continue;\r
+ }\r
+\r
+ //\r
+ // Get the DevicePath protocol on that handle\r
+ //\r
+ Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&DevPathNode);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ while (!IsDevicePathEnd (DevPathNode)) {\r
+ //\r
+ // Find the handler to dump this device path node\r
+ //\r
+ if (\r
+ (DevicePathType(DevPathNode) == MESSAGING_DEVICE_PATH) &&\r
+ (DevicePathSubType(DevPathNode) == MSG_ATAPI_DP)\r
+ ) {\r
+ Atapi = (ATAPI_DEVICE_PATH*) DevPathNode;\r
+ PciOr16 (\r
+ PCI_LIB_ADDRESS (\r
+ 0,\r
+ 1,\r
+ 1,\r
+ (Atapi->PrimarySecondary == 1) ? 0x42: 0x40\r
+ ),\r
+ BIT15\r
+ );\r
+ }\r
+\r
+ //\r
+ // Next device path node\r
+ //\r
+ DevPathNode = NextDevicePathNode (DevPathNode);\r
+ }\r
+ }\r
+\r
+ return;\r
+}\r
+\r
+\r
+VOID\r
+InstallDevicePathCallback (\r
+ VOID\r
+ )\r
+{\r
+ DEBUG ((EFI_D_INFO, "Registered NotifyDevPath Event\n"));\r
+ mEfiDevPathEvent = EfiCreateProtocolNotifyEvent (\r
+ &gEfiDevicePathProtocolGuid,\r
+ TPL_CALLBACK,\r
+ NotifyDevPath,\r
+ NULL,\r
+ &mEfiDevPathNotifyReg\r
+ );\r
+}\r
+\r