From: jchen20 Date: Fri, 19 Jun 2009 08:40:58 +0000 (+0000) Subject: Code scrub for IdeBusDxe driver and PeiS3Lib.(undergoing) X-Git-Tag: edk2-stable201903~17698 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=e72ca438d435df18e620a20ef0b86de0837cc62a;ds=sidebyside Code scrub for IdeBusDxe driver and PeiS3Lib.(undergoing) git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8609 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ata.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ata.c index f4e2e5d6d7..87d466f9d0 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ata.c +++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ata.c @@ -96,7 +96,7 @@ ATAIdentify ( // if (!EFI_ERROR (Status)) { - IdeDev->pIdData = AtaIdentifyPointer; + IdeDev->IdData = AtaIdentifyPointer; // // Print ATA Module Name @@ -173,7 +173,7 @@ ATAIdentify ( // // Make sure the pIdData will not be freed again. // - IdeDev->pIdData = NULL; + IdeDev->IdData = NULL; return EFI_DEVICE_ERROR; } @@ -212,11 +212,11 @@ AtaAtapi6Identify ( EFI_LBA Capacity; EFI_IDENTIFY_DATA *Atapi6IdentifyStruct; - if (IdeDev->pIdData == NULL) { + if (IdeDev->IdData == NULL) { return EFI_INVALID_PARAMETER; } - Atapi6IdentifyStruct = IdeDev->pIdData; + Atapi6IdentifyStruct = IdeDev->IdData; if ((Atapi6IdentifyStruct->AtapiData.cmd_set_support_83 & (BIT15 | BIT14)) != 0x4000) { // @@ -282,11 +282,11 @@ PrintAtaModuleName ( IN IDE_BLK_IO_DEV *IdeDev ) { - if (IdeDev->pIdData == NULL) { + if (IdeDev->IdData == NULL) { return ; } - SwapStringChars (IdeDev->ModelName, IdeDev->pIdData->AtaData.ModelName, 40); + SwapStringChars (IdeDev->ModelName, IdeDev->IdData->AtaData.ModelName, 40); IdeDev->ModelName[40] = 0x00; } @@ -1779,13 +1779,13 @@ AtaSMARTSupport ( // // Detect if the device supports S.M.A.R.T. // - if ((IdeDev->pIdData->AtaData.command_set_supported_83 & 0xc000) != 0x4000) { + if ((IdeDev->IdData->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) { + if ((IdeDev->IdData->AtaData.command_set_supported_82 & 0x0001) != 0x0001) { // // S.M.A.R.T is not supported by the device // @@ -1921,12 +1921,12 @@ AtaEnableLongPhysicalSector ( EFI_ATA_IDENTIFY_DATA *AtaIdentifyData; UINT16 PhyLogicSectorSupport; - ASSERT (IdeDev->pIdData != NULL); + ASSERT (IdeDev->IdData != NULL); // // Only valid for ATA device // - AtaIdentifyData = (EFI_ATA_IDENTIFY_DATA *) &IdeDev->pIdData->AtaData; - if (AtaIdentifyData->config & 0x8000) { + AtaIdentifyData = (EFI_ATA_IDENTIFY_DATA *) &IdeDev->IdData->AtaData; + if ((AtaIdentifyData->config & 0x8000) != 0) { return EFI_UNSUPPORTED; } PhyLogicSectorSupport = AtaIdentifyData->phy_logic_sector_support; @@ -1939,7 +1939,7 @@ AtaEnableLongPhysicalSector ( // // Check whether one physical block contains multiple physical blocks // - if (PhyLogicSectorSupport & 0x2000) { + if ((PhyLogicSectorSupport & 0x2000) != 0) { IdeDev->BlkIo.Media->LogicalBlocksPerPhysicalBlock = (UINT32) (1 << (PhyLogicSectorSupport & 0x000f)); // @@ -1954,7 +1954,7 @@ AtaEnableLongPhysicalSector ( // Check logical block size // IdeDev->BlkIo.Media->BlockSize = 0x200; - if (PhyLogicSectorSupport & 0x1000) { + if ((PhyLogicSectorSupport & 0x1000) != 0) { IdeDev->BlkIo.Media->BlockSize = (UINT32) ( ((AtaIdentifyData->logic_sector_size_hi << 16) | AtaIdentifyData->logic_sector_size_lo) * sizeof (UINT16) diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Atapi.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Atapi.c index 1f989e72f6..b53f20ee82 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Atapi.c +++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Atapi.c @@ -259,7 +259,7 @@ ATAPIIdentify ( return EFI_DEVICE_ERROR; } - IdeDev->pIdData = AtapiIdentifyPointer; + IdeDev->IdData = AtapiIdentifyPointer; PrintAtaModuleName (IdeDev); // @@ -267,22 +267,22 @@ ATAPIIdentify ( // Status = AtapiInquiry (IdeDev); if (EFI_ERROR (Status)) { - gBS->FreePool (IdeDev->pIdData); + gBS->FreePool (IdeDev->IdData); // // Make sure the pIdData will not be freed again. // - IdeDev->pIdData = NULL; + IdeDev->IdData = NULL; return EFI_DEVICE_ERROR; } // // Get media removable info from INQUIRY data. // - IdeDev->BlkIo.Media->RemovableMedia = (UINT8) ((IdeDev->pInquiryData->RMB & 0x80) == 0x80); + IdeDev->BlkIo.Media->RemovableMedia = (UINT8) ((IdeDev->InquiryData->RMB & 0x80) == 0x80); // // Identify device type via INQUIRY data. // - switch (IdeDev->pInquiryData->peripheral_type & 0x1f) { + switch (IdeDev->InquiryData->peripheral_type & 0x1f) { // // Magnetic Disk @@ -338,13 +338,13 @@ ATAPIIdentify ( default: IdeDev->Type = IdeUnknown; - gBS->FreePool (IdeDev->pIdData); - gBS->FreePool (IdeDev->pInquiryData); + gBS->FreePool (IdeDev->IdData); + gBS->FreePool (IdeDev->InquiryData); // // Make sure the pIdData and pInquiryData will not be freed again. // - IdeDev->pIdData = NULL; - IdeDev->pInquiryData = NULL; + IdeDev->IdData = NULL; + IdeDev->InquiryData = NULL; return EFI_DEVICE_ERROR; } @@ -355,13 +355,13 @@ ATAPIIdentify ( IdeDev->SenseData = AllocatePool (IdeDev->SenseDataNumber * sizeof (ATAPI_REQUEST_SENSE_DATA)); if (IdeDev->SenseData == NULL) { - gBS->FreePool (IdeDev->pIdData); - gBS->FreePool (IdeDev->pInquiryData); + gBS->FreePool (IdeDev->IdData); + gBS->FreePool (IdeDev->InquiryData); // // Make sure the pIdData and pInquiryData will not be freed again. // - IdeDev->pIdData = NULL; - IdeDev->pInquiryData = NULL; + IdeDev->IdData = NULL; + IdeDev->InquiryData = NULL; return EFI_OUT_OF_RESOURCES; } @@ -423,7 +423,7 @@ AtapiInquiry ( return EFI_DEVICE_ERROR; } - IdeDev->pInquiryData = InquiryData; + IdeDev->InquiryData = InquiryData; return EFI_SUCCESS; } diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.c index ed02b38dcf..96f1ce3bd8 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.c +++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.c @@ -1368,14 +1368,14 @@ ReleaseIdeResources ( IdeBlkIoDevice->Cache = NULL; } - if (IdeBlkIoDevice->pIdData != NULL) { - gBS->FreePool (IdeBlkIoDevice->pIdData); - IdeBlkIoDevice->pIdData = NULL; + if (IdeBlkIoDevice->IdData != NULL) { + gBS->FreePool (IdeBlkIoDevice->IdData); + IdeBlkIoDevice->IdData = NULL; } - if (IdeBlkIoDevice->pInquiryData != NULL) { - gBS->FreePool (IdeBlkIoDevice->pInquiryData); - IdeBlkIoDevice->pInquiryData = NULL; + if (IdeBlkIoDevice->InquiryData != NULL) { + gBS->FreePool (IdeBlkIoDevice->InquiryData); + IdeBlkIoDevice->InquiryData = NULL; } if (IdeBlkIoDevice->ControllerNameTable != NULL) { diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.h b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.h index bb2a4a75c3..bacae8a6cb 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.h +++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.h @@ -506,7 +506,7 @@ AtaSoftReset ( @param IdeBlkIoDevice TODO: add argument description @param MediaId TODO: add argument description - @param LBA TODO: add argument description + @param Lba TODO: add argument description @param BufferSize TODO: add argument description @param Buffer TODO: add argument description @@ -517,7 +517,7 @@ EFI_STATUS AtaBlkIoReadBlocks ( IN IDE_BLK_IO_DEV *IdeBlkIoDevice, IN UINT32 MediaId, - IN EFI_LBA LBA, + IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer ); @@ -527,7 +527,7 @@ AtaBlkIoReadBlocks ( @param IdeBlkIoDevice TODO: add argument description @param MediaId TODO: add argument description - @param LBA TODO: add argument description + @param Lba TODO: add argument description @param BufferSize TODO: add argument description @param Buffer TODO: add argument description @@ -538,7 +538,7 @@ EFI_STATUS AtaBlkIoWriteBlocks ( IN IDE_BLK_IO_DEV *IdeBlkIoDevice, IN UINT32 MediaId, - IN EFI_LBA LBA, + IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer ); @@ -751,7 +751,7 @@ AtapiSoftReset ( @param IdeBlkIoDevice TODO: add argument description @param MediaId TODO: add argument description - @param LBA TODO: add argument description + @param Lba TODO: add argument description @param BufferSize TODO: add argument description @param Buffer TODO: add argument description @@ -762,7 +762,7 @@ EFI_STATUS AtapiBlkIoReadBlocks ( IN IDE_BLK_IO_DEV *IdeBlkIoDevice, IN UINT32 MediaId, - IN EFI_LBA LBA, + IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer ); @@ -772,7 +772,7 @@ AtapiBlkIoReadBlocks ( @param IdeBlkIoDevice TODO: add argument description @param MediaId TODO: add argument description - @param LBA TODO: add argument description + @param Lba TODO: add argument description @param BufferSize TODO: add argument description @param Buffer TODO: add argument description @@ -783,7 +783,7 @@ EFI_STATUS AtapiBlkIoWriteBlocks ( IN IDE_BLK_IO_DEV *IdeBlkIoDevice, IN UINT32 MediaId, - IN EFI_LBA LBA, + IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer ); diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c index b09bb8a53f..9c7d6e2063 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c +++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c @@ -413,7 +413,7 @@ IDEBusDriverBindingStart ( } EndIdeDevice = (UINT8) MIN ((MaxDevices - 1), EndIdeDevice); - + ASSERT (EndIdeDevice < IdeMaxDevice); // // Now inform the IDE Controller Init Module. Sept10 // @@ -556,7 +556,7 @@ IDEBusDriverBindingStart ( // // Submit identify data to IDE controller init driver // - CopyMem (&IdentifyData, IdeBlkIoDevicePtr->pIdData, sizeof (IdentifyData)); + CopyMem (&IdentifyData, IdeBlkIoDevicePtr->IdData, sizeof (IdentifyData)); IdeBusDriverPrivateData->DeviceFound[IdeChannel * 2 + IdeDevice] = TRUE; IdeInit->SubmitData (IdeInit, IdeChannel, IdeDevice, &IdentifyData); } else { @@ -611,7 +611,7 @@ IDEBusDriverBindingStart ( // // Set best supported PIO mode on this IDE device // - if (SupportedModes->PioMode.Mode <= ATA_PIO_MODE_2) { + if (SupportedModes->PioMode.Mode <= AtaPioMode2) { TransferMode.ModeCategory = ATA_MODE_CATEGORY_DEFAULT_PIO; } else { TransferMode.ModeCategory = ATA_MODE_CATEGORY_FLOW_PIO; @@ -672,9 +672,9 @@ IDEBusDriverBindingStart ( // // 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; + DriveParameters.Sector = (UINT8) IdeBlkIoDevicePtr->IdData->AtaData.sectors_per_track; + DriveParameters.Heads = (UINT8) (IdeBlkIoDevicePtr->IdData->AtaData.heads - 1); + DriveParameters.MultipleSector = (UINT8) IdeBlkIoDevicePtr->IdData->AtaData.multi_sector_cmd_max_sct_cnt; // // Set Parameters for the device: // 1) Init @@ -1307,11 +1307,11 @@ IDEDiskInfoInquiry ( return EFI_BUFFER_TOO_SMALL; } - if (IdeBlkIoDevice->pInquiryData == NULL) { + if (IdeBlkIoDevice->InquiryData == NULL) { return EFI_NOT_FOUND; } - gBS->CopyMem (InquiryData, IdeBlkIoDevice->pInquiryData, sizeof (ATAPI_INQUIRY_DATA)); + gBS->CopyMem (InquiryData, IdeBlkIoDevice->InquiryData, sizeof (ATAPI_INQUIRY_DATA)); *InquiryDataSize = sizeof (ATAPI_INQUIRY_DATA); return EFI_SUCCESS; @@ -1348,11 +1348,11 @@ IDEDiskInfoIdentify ( return EFI_BUFFER_TOO_SMALL; } - if (IdeBlkIoDevice->pIdData == NULL) { + if (IdeBlkIoDevice->IdData == NULL) { return EFI_NOT_FOUND; } - gBS->CopyMem (IdentifyData, IdeBlkIoDevice->pIdData, sizeof (EFI_IDENTIFY_DATA)); + gBS->CopyMem (IdentifyData, IdeBlkIoDevice->IdData, sizeof (EFI_IDENTIFY_DATA)); *IdentifyDataSize = sizeof (EFI_IDENTIFY_DATA); return EFI_SUCCESS; diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.h b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.h index 1c5b559bd8..092b219503 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.h +++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.h @@ -95,8 +95,8 @@ typedef struct { IDE_BASE_REGISTERS *IoPort; UINT16 AtapiError; - ATAPI_INQUIRY_DATA *pInquiryData; - EFI_IDENTIFY_DATA *pIdData; + ATAPI_INQUIRY_DATA *InquiryData; + EFI_IDENTIFY_DATA *IdData; ATA_PIO_MODE PioMode; EFI_ATA_MODE UdmaMode; CHAR8 ModelName[41]; @@ -315,7 +315,7 @@ IDEBlkIoReset ( @param This TODO: add argument description @param MediaId TODO: add argument description - @param LBA TODO: add argument description + @param Lba TODO: add argument description @param BufferSize TODO: add argument description @param Buffer TODO: add argument description @@ -327,7 +327,7 @@ EFIAPI IDEBlkIoReadBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, - IN EFI_LBA LBA, + IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer ); @@ -337,7 +337,7 @@ IDEBlkIoReadBlocks ( @param This TODO: add argument description @param MediaId TODO: add argument description - @param LBA TODO: add argument description + @param Lba TODO: add argument description @param BufferSize TODO: add argument description @param Buffer TODO: add argument description @@ -349,7 +349,7 @@ EFIAPI IDEBlkIoWriteBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, - IN EFI_LBA LBA, + IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer ); diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf index 7071a1e143..7052d3f949 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf +++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf @@ -52,7 +52,6 @@ [Packages] MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec IntelFrameworkPkg/IntelFrameworkPkg.dec IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec @@ -72,15 +71,15 @@ [Guids] - gEfiDiskInfoIdeInterfaceGuid # SOMETIMES_CONSUMED - gEfiEventExitBootServicesGuid + gEfiDiskInfoIdeInterfaceGuid # CONSUMES ## GUID + gEfiEventExitBootServicesGuid # CONSUMES ## Event [Protocols] - gEfiDiskInfoProtocolGuid # PROTOCOL BY_START - gEfiBlockIoProtocolGuid # PROTOCOL BY_START - gEfiIdeControllerInitProtocolGuid # PROTOCOL TO_START - gEfiPciIoProtocolGuid # PROTOCOL TO_START - gEfiDevicePathProtocolGuid # PROTOCOL TO_START + gEfiDiskInfoProtocolGuid # BY_START + gEfiBlockIoProtocolGuid # BY_START + gEfiIdeControllerInitProtocolGuid # TO_START + gEfiPciIoProtocolGuid # TO_START + gEfiDevicePathProtocolGuid # TO_START diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeData.h b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeData.h index 47385c71a4..1baf46b6d6 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeData.h +++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeData.h @@ -197,35 +197,35 @@ typedef struct { #define SETFEATURE TRUE #define CLEARFEATURE FALSE -// -// PIO mode definition -// -typedef enum { - ATA_PIO_MODE_BELOW_2, - ATA_PIO_MODE_2, - ATA_PIO_MODE_3, - ATA_PIO_MODE_4 +/// +/// PIO mode definition +/// +typedef enum _ATA_PIO_MODE_ { + AtaPioModeBelow2, + AtaPioMode2, + AtaPioMode3, + AtaPioMode4 } ATA_PIO_MODE; // // Multi word DMA definition // -typedef enum { - ATA_MDMA_MODE_0, - ATA_MDMA_MODE_1, - ATA_MDMA_MODE_2 +typedef enum _ATA_MDMA_MODE_ { + AtaMdmaMode0, + AtaMdmaMode1, + AtaMdmaMode2 } 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 +typedef enum _ATA_UDMA_MODE_ { + AtaUdmaMode0, + AtaUdmaMode1, + AtaUdmaMode2, + AtaUdmaMode3, + AtaUdmaMode4, + AtaUdmaMode5 } ATA_UDMA_MODE; #define ATA_MODE_CATEGORY_DEFAULT_PIO 0x00 diff --git a/IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.c b/IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.c index 1d7907ef7f..e4088694be 100644 --- a/IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.c +++ b/IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.c @@ -1,5 +1,6 @@ /**@file - S3 Library. This library class defines a set of methods related do S3 mode + This library provides API to invoke the S3 resume vector in the APCI Table in S3 resume mode. + This library instance is only for PEI phase use and the APIs in this instance Copyright (c) 2006 - 2008 Intel Corporation All rights reserved. This program and the accompanying materials diff --git a/IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf b/IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf index e4851a48d8..76fb867aca 100644 --- a/IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf +++ b/IntelFrameworkModulePkg/Library/PeiS3Lib/PeiS3Lib.inf @@ -1,7 +1,8 @@ #/** @file -# Graphics Library for UEFI drivers # -# This library provides supports for basic graphic functions. +# This library provides API to invoke the S3 resume vector in the APCI Table in S3 resume mode. +# This library instance is only for PEI phase use and the APIs in this instance +# # Copyright (c) 2006 - 2009, Intel Corporation. # # All rights reserved. This program and the accompanying materials @@ -39,11 +40,10 @@ IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec [LibraryClasses] - BaseLib PeiServicesTablePointerLib DebugLib [Ppis] - gEfiPeiS3ResumePpiGuid # PPI ALWAYS_CONSUMED + gEfiPeiS3ResumePpiGuid # ALWAYS_CONSUMES