\r
#include "LegacyBiosInterface.h"\r
\r
-BOOLEAN mIdeDataBuiltFlag = FALSE;\r
+BOOLEAN mIdeDataBuiltFlag = FALSE;\r
\r
/**\r
Collect IDE Inquiry data from the IDE disks\r
**/\r
EFI_STATUS\r
LegacyBiosBuildIdeData (\r
- IN LEGACY_BIOS_INSTANCE *Private,\r
- IN HDD_INFO **HddInfo,\r
- IN UINT16 Flag\r
+ IN LEGACY_BIOS_INSTANCE *Private,\r
+ IN HDD_INFO **HddInfo,\r
+ IN UINT16 Flag\r
)\r
{\r
EFI_STATUS Status;\r
//\r
PciDevicePath = NULL;\r
LocalHddInfo = *HddInfo;\r
- Status = Private->LegacyBiosPlatform->GetPlatformHandle (\r
- Private->LegacyBiosPlatform,\r
- EfiGetPlatformIdeHandle,\r
- 0,\r
- &HandleBuffer,\r
- &HandleCount,\r
- (VOID *) &LocalHddInfo\r
- );\r
+ Status = Private->LegacyBiosPlatform->GetPlatformHandle (\r
+ Private->LegacyBiosPlatform,\r
+ EfiGetPlatformIdeHandle,\r
+ 0,\r
+ &HandleBuffer,\r
+ &HandleCount,\r
+ (VOID *)&LocalHddInfo\r
+ );\r
if (!EFI_ERROR (Status)) {\r
IdeController = HandleBuffer[0];\r
//\r
//\r
if (Flag != 0) {\r
gBS->DisconnectController (\r
- IdeController,\r
- NULL,\r
- NULL\r
- );\r
+ IdeController,\r
+ NULL,\r
+ NULL\r
+ );\r
}\r
\r
gBS->ConnectController (IdeController, NULL, NULL, FALSE);\r
// And GetIdeHandle will switch to Legacy mode, if required.\r
//\r
Private->LegacyBiosPlatform->GetPlatformHandle (\r
- Private->LegacyBiosPlatform,\r
- EfiGetPlatformIdeHandle,\r
- 0,\r
- &HandleBuffer,\r
- &HandleCount,\r
- (VOID *) &LocalHddInfo\r
- );\r
+ Private->LegacyBiosPlatform,\r
+ EfiGetPlatformIdeHandle,\r
+ 0,\r
+ &HandleBuffer,\r
+ &HandleCount,\r
+ (VOID *)&LocalHddInfo\r
+ );\r
}\r
\r
mIdeDataBuiltFlag = TRUE;\r
// Get Identity command from all drives\r
//\r
gBS->LocateHandleBuffer (\r
- ByProtocol,\r
- &gEfiDiskInfoProtocolGuid,\r
- NULL,\r
- &HandleCount,\r
- &HandleBuffer\r
- );\r
-\r
- Private->IdeDriveCount = (UINT8) HandleCount;\r
+ ByProtocol,\r
+ &gEfiDiskInfoProtocolGuid,\r
+ NULL,\r
+ &HandleCount,\r
+ &HandleBuffer\r
+ );\r
+\r
+ Private->IdeDriveCount = (UINT8)HandleCount;\r
for (Index = 0; Index < HandleCount; Index++) {\r
Status = gBS->HandleProtocol (\r
HandleBuffer[Index],\r
&gEfiDiskInfoProtocolGuid,\r
- (VOID **) &DiskInfo\r
+ (VOID **)&DiskInfo\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
Status = gBS->HandleProtocol (\r
HandleBuffer[Index],\r
&gEfiDevicePathProtocolGuid,\r
- (VOID *) &DevicePath\r
+ (VOID *)&DevicePath\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
while (!IsDevicePathEnd (DevicePathNode)) {\r
TempDevicePathNode = NextDevicePathNode (DevicePathNode);\r
if ((DevicePathType (DevicePathNode) == HARDWARE_DEVICE_PATH) &&\r
- ( DevicePathSubType (DevicePathNode) == HW_PCI_DP) &&\r
- ( DevicePathType(TempDevicePathNode) == MESSAGING_DEVICE_PATH) &&\r
- ( DevicePathSubType(TempDevicePathNode) == MSG_ATAPI_DP) ) {\r
- PciDevicePath = (PCI_DEVICE_PATH *) DevicePathNode;\r
+ (DevicePathSubType (DevicePathNode) == HW_PCI_DP) &&\r
+ (DevicePathType (TempDevicePathNode) == MESSAGING_DEVICE_PATH) &&\r
+ (DevicePathSubType (TempDevicePathNode) == MSG_ATAPI_DP))\r
+ {\r
+ PciDevicePath = (PCI_DEVICE_PATH *)DevicePathNode;\r
break;\r
}\r
+\r
DevicePathNode = NextDevicePathNode (DevicePathNode);\r
}\r
\r
for (PciIndex = 0; PciIndex < 8; PciIndex++) {\r
if ((PciDevicePath->Device == LocalHddInfo[PciIndex].Device) &&\r
(PciDevicePath->Function == LocalHddInfo[PciIndex].Function)\r
- ) {\r
+ )\r
+ {\r
break;\r
}\r
}\r
\r
InquiryData = NULL;\r
InquiryDataSize = 0;\r
- Status = DiskInfo->Inquiry (\r
- DiskInfo,\r
- NULL,\r
- &InquiryDataSize\r
- );\r
+ Status = DiskInfo->Inquiry (\r
+ DiskInfo,\r
+ NULL,\r
+ &InquiryDataSize\r
+ );\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
- InquiryData = (UINT8 *) AllocatePool (\r
- InquiryDataSize\r
- );\r
+ InquiryData = (UINT8 *)AllocatePool (\r
+ InquiryDataSize\r
+ );\r
if (InquiryData != NULL) {\r
Status = DiskInfo->Inquiry (\r
DiskInfo,\r
LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_SLAVE_ATAPI_ZIPDISK;\r
}\r
}\r
+\r
FreePool (InquiryData);\r
} else {\r
if (IdeDevice == 0) {\r
return EFI_SUCCESS;\r
}\r
\r
-\r
/**\r
If the IDE channel is in compatibility (legacy) mode, remove all\r
PCI I/O BAR addresses from the controller.\r
**/\r
VOID\r
InitLegacyIdeController (\r
- IN EFI_HANDLE IdeController\r
+ IN EFI_HANDLE IdeController\r
)\r
{\r
- EFI_PCI_IO_PROTOCOL *PciIo;\r
- UINT32 IOBarClear;\r
- EFI_STATUS Status;\r
- PCI_TYPE00 PciData;\r
+ EFI_PCI_IO_PROTOCOL *PciIo;\r
+ UINT32 IOBarClear;\r
+ EFI_STATUS Status;\r
+ PCI_TYPE00 PciData;\r
\r
//\r
// If the IDE channel is in compatibility (legacy) mode, remove all\r
(VOID **)&PciIo\r
);\r
if (EFI_ERROR (Status)) {\r
- return ;\r
+ return;\r
}\r
\r
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0, sizeof (PciData), &PciData);\r
if (EFI_ERROR (Status)) {\r
- return ;\r
+ return;\r
}\r
\r
//\r
// Check whether this is IDE\r
//\r
if ((PciData.Hdr.ClassCode[2] != PCI_CLASS_MASS_STORAGE) ||\r
- (PciData.Hdr.ClassCode[1] != PCI_CLASS_MASS_STORAGE_IDE)) {\r
- return ;\r
+ (PciData.Hdr.ClassCode[1] != PCI_CLASS_MASS_STORAGE_IDE))\r
+ {\r
+ return;\r
}\r
\r
//\r
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x10, 1, &IOBarClear);\r
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x14, 1, &IOBarClear);\r
}\r
+\r
if ((PciData.Hdr.ClassCode[0] & IDE_PI_REGISTER_SNE) == 0) {\r
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x18, 1, &IOBarClear);\r
PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x1C, 1, &IOBarClear);\r
}\r
\r
- return ;\r
+ return;\r
}\r