summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Bus
diff options
context:
space:
mode:
authorgikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-02 01:50:07 +0000
committergikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-02 01:50:07 +0000
commit75eccf9d4a1895f33ba1ada0ab9873f633e87031 (patch)
tree851a34d08513d7df9150aecaedfb4faeb9513ea6 /IntelFrameworkModulePkg/Bus
parentef1ad620f00df8e0860f720386d6b8ee5c792d1b (diff)
downloadedk2-platforms-75eccf9d4a1895f33ba1ada0ab9873f633e87031.tar.xz
Function AtaEnableLongPhysicalSector () added for Long physical sector process.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8004 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Bus')
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ata.c64
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.c8
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.h16
3 files changed, 87 insertions, 1 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ata.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ata.c
index 25ecedb78b..f4e2e5d6d7 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ata.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ata.c
@@ -1904,6 +1904,70 @@ AtaSMARTSupport (
}
/**
+ Enable Long Physical Sector Feature for ATA device.
+
+ @param IdeDev The IDE device data
+
+ @retval EFI_SUCCESS The ATA device supports Long Physical Sector feature
+ and corresponding fields in BlockIo structure is updated.
+ @retval EFI_UNSUPPORTED The device is not ATA device or Long Physical Sector
+ feature is not supported.
+**/
+EFI_STATUS
+AtaEnableLongPhysicalSector (
+ IN IDE_BLK_IO_DEV *IdeDev
+ )
+{
+ EFI_ATA_IDENTIFY_DATA *AtaIdentifyData;
+ UINT16 PhyLogicSectorSupport;
+
+ ASSERT (IdeDev->pIdData != NULL);
+ //
+ // Only valid for ATA device
+ //
+ AtaIdentifyData = (EFI_ATA_IDENTIFY_DATA *) &IdeDev->pIdData->AtaData;
+ if (AtaIdentifyData->config & 0x8000) {
+ return EFI_UNSUPPORTED;
+ }
+ PhyLogicSectorSupport = AtaIdentifyData->phy_logic_sector_support;
+ //
+ // Check whether Long Physical Sector Feature is supported
+ //
+ if ((PhyLogicSectorSupport & 0xc000) == 0x4000) {
+ IdeDev->BlkIo.Media->LogicalBlocksPerPhysicalBlock = 1;
+ IdeDev->BlkIo.Media->LowestAlignedLba = 0;
+ //
+ // Check whether one physical block contains multiple physical blocks
+ //
+ if (PhyLogicSectorSupport & 0x2000) {
+ IdeDev->BlkIo.Media->LogicalBlocksPerPhysicalBlock =
+ (UINT32) (1 << (PhyLogicSectorSupport & 0x000f));
+ //
+ // Check lowest alignment of logical blocks within physical block
+ //
+ if ((AtaIdentifyData->alignment_logic_in_phy_blocks & 0xc000) == 0x4000) {
+ IdeDev->BlkIo.Media->LowestAlignedLba =
+ (EFI_LBA) (AtaIdentifyData->alignment_logic_in_phy_blocks & 0x3fff);
+ }
+ }
+ //
+ // Check logical block size
+ //
+ IdeDev->BlkIo.Media->BlockSize = 0x200;
+ if (PhyLogicSectorSupport & 0x1000) {
+ IdeDev->BlkIo.Media->BlockSize = (UINT32) (
+ ((AtaIdentifyData->logic_sector_size_hi << 16) |
+ AtaIdentifyData->logic_sector_size_lo) * sizeof (UINT16)
+ );
+ }
+ return EFI_SUCCESS;
+ } else {
+ return EFI_UNSUPPORTED;
+ }
+}
+
+
+/**
Send ATA Ext command into device with NON_DATA protocol
@param IdeDev Standard IDE device private data structure
diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.c
index c6902afe01..6ffc2fcf2b 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.c
@@ -421,6 +421,7 @@ DiscoverIdeDevice (
// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
+ EFI_STATUS LongPhyStatus;
//
// If a channel has not been checked, check it now. Then set it to "checked" state
@@ -485,7 +486,12 @@ DiscoverIdeDevice (
//
// Init Block I/O interface
//
- IdeDev->BlkIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION;
+ LongPhyStatus = AtaEnableLongPhysicalSector (IdeDev);
+ if (!EFI_ERROR (LongPhyStatus)) {
+ IdeDev->BlkIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION2;
+ } else {
+ IdeDev->BlkIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION;
+ }
IdeDev->BlkIo.Reset = IDEBlkIoReset;
IdeDev->BlkIo.ReadBlocks = IDEBlkIoReadBlocks;
IdeDev->BlkIo.WriteBlocks = IDEBlkIoWriteBlocks;
diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.h b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.h
index f2cc9df454..bb2a4a75c3 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.h
+++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ide.h
@@ -1165,6 +1165,22 @@ AtaSMARTSupport (
IN IDE_BLK_IO_DEV *IdeDev
);
+
+/**
+ Enable Long Physical Sector Feature for ATA device.
+
+ @param IdeDev The IDE device data
+
+ @retval EFI_SUCCESS The ATA device supports Long Physical Sector feature
+ and corresponding fields in BlockIo structure is updated.
+ @retval EFI_UNSUPPORTED The device is not ATA device or Long Physical Sector
+ feature is not supported.
+**/
+EFI_STATUS
+AtaEnableLongPhysicalSector (
+ IN IDE_BLK_IO_DEV *IdeDev
+ );
+
/**
TODO: Add function description