+++ /dev/null
-/** @file\r
- Header file for IDE Bus Driver, containing the helper functions'\r
- prototype.\r
-\r
- Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
- @par Revision Reference:\r
- 2002-6: Add Atapi6 enhancement, support >120GB hard disk, including\r
- Add - IDEBlkIoReadBlocksExt() func definition\r
- Add - IDEBlkIoWriteBlocksExt() func definition\r
-\r
-**/\r
-\r
-#ifndef _IDE_H_\r
-#define _IDE_H_\r
-\r
-//\r
-// Helper functions Prototype\r
-//\r
-/**\r
- read a one-byte data from a IDE port.\r
-\r
- @param PciIo The PCI IO protocol instance\r
- @param Port the IDE Port number\r
-\r
- return the one-byte data read from IDE port\r
-**/\r
-UINT8\r
-IDEReadPortB (\r
- IN EFI_PCI_IO_PROTOCOL *PciIo,\r
- IN UINT16 Port\r
- );\r
-\r
-/**\r
- Reads multiple words of data from the IDE data port.\r
- Call the IO abstraction once to do the complete read,\r
- not one word at a time.\r
-\r
- @param PciIo Pointer to the EFI_PCI_IO instance\r
- @param Port IO port to read\r
- @param Count No. of UINT16's to read\r
- @param Buffer Pointer to the data buffer for read\r
-\r
-**/\r
-VOID\r
-IDEReadPortWMultiple (\r
- IN EFI_PCI_IO_PROTOCOL *PciIo,\r
- IN UINT16 Port,\r
- IN UINTN Count,\r
- OUT VOID *Buffer\r
- );\r
-\r
-/**\r
- write a 1-byte data to a specific IDE port.\r
-\r
- @param PciIo PCI IO protocol instance\r
- @param Port The IDE port to be writen\r
- @param Data The data to write to the port\r
-**/\r
-VOID\r
-IDEWritePortB (\r
- IN EFI_PCI_IO_PROTOCOL *PciIo,\r
- IN UINT16 Port,\r
- IN UINT8 Data\r
- );\r
-\r
-/**\r
- write a 1-word data to a specific IDE port.\r
-\r
- @param PciIo PCI IO protocol instance\r
- @param Port The IDE port to be writen\r
- @param Data The data to write to the port\r
-**/\r
-VOID\r
-IDEWritePortW (\r
- IN EFI_PCI_IO_PROTOCOL *PciIo,\r
- IN UINT16 Port,\r
- IN UINT16 Data\r
- );\r
-\r
-/**\r
- Write multiple words of data to the IDE data port.\r
- Call the IO abstraction once to do the complete read,\r
- not one word at a time.\r
-\r
- @param PciIo Pointer to the EFI_PCI_IO instance\r
- @param Port IO port to read\r
- @param Count No. of UINT16's to read\r
- @param Buffer Pointer to the data buffer for read\r
-\r
-**/\r
-VOID\r
-IDEWritePortWMultiple (\r
- IN EFI_PCI_IO_PROTOCOL *PciIo,\r
- IN UINT16 Port,\r
- IN UINTN Count,\r
- IN VOID *Buffer\r
- );\r
-\r
-/**\r
- Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode,\r
- use fixed addresses. In Native-PCI mode, get base addresses from BARs in\r
- the PCI IDE controller's Configuration Space.\r
-\r
- The steps to get IDE IO port registers' base addresses for each channel\r
- as follows:\r
-\r
- 1. Examine the Programming Interface byte of the Class Code fields in PCI IDE\r
- controller's Configuration Space to determine the operating mode.\r
-\r
- 2. a) In 'Compatibility' mode, use fixed addresses shown in the Table 1 below.\r
- <pre>\r
- ___________________________________________\r
- | | Command Block | Control Block |\r
- | Channel | Registers | Registers |\r
- |___________|_______________|_______________|\r
- | Primary | 1F0h - 1F7h | 3F6h - 3F7h |\r
- |___________|_______________|_______________|\r
- | Secondary | 170h - 177h | 376h - 377h |\r
- |___________|_______________|_______________|\r
-\r
- Table 1. Compatibility resource mappings\r
- </pre>\r
-\r
- b) In Native-PCI mode, IDE registers are mapped into IO space using the BARs\r
- in IDE controller's PCI Configuration Space, shown in the Table 2 below.\r
- <pre>\r
- ___________________________________________________\r
- | | Command Block | Control Block |\r
- | Channel | Registers | Registers |\r
- |___________|___________________|___________________|\r
- | Primary | BAR at offset 0x10| BAR at offset 0x14|\r
- |___________|___________________|___________________|\r
- | Secondary | BAR at offset 0x18| BAR at offset 0x1C|\r
- |___________|___________________|___________________|\r
-\r
- Table 2. BARs for Register Mapping\r
- </pre>\r
- @note Refer to Intel ICH4 datasheet, Control Block Offset: 03F4h for\r
- primary, 0374h for secondary. So 2 bytes extra offset should be\r
- added to the base addresses read from BARs.\r
-\r
- For more details, please refer to PCI IDE Controller Specification and Intel\r
- ICH4 Datasheet.\r
-\r
- @param PciIo Pointer to the EFI_PCI_IO_PROTOCOL instance\r
- @param IdeRegsBaseAddr Pointer to IDE_REGISTERS_BASE_ADDR to\r
- receive IDE IO port registers' base addresses\r
-\r
- @retval EFI_UNSUPPORTED return this value when the BARs is not IO type\r
- @retval EFI_SUCCESS Get the Base address successfully\r
- @retval other read the pci configureation data error\r
-\r
-**/\r
-EFI_STATUS\r
-GetIdeRegistersBaseAddr (\r
- IN EFI_PCI_IO_PROTOCOL *PciIo,\r
- OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr\r
- );\r
-\r
-/**\r
- This function is used to requery IDE resources. The IDE controller will\r
- probably switch between native and legacy modes during the EFI->CSM->OS\r
- transfer. We do this everytime before an BlkIo operation to ensure its\r
- succeess.\r
-\r
- @param IdeDev The BLK_IO private data which specifies the IDE device\r
-\r
- @retval EFI_INVALID_PARAMETER return this value when the channel is invalid\r
- @retval EFI_SUCCESS reassign the IDE IO resource successfully\r
- @retval other get the IDE current base address effor\r
-\r
-**/\r
-EFI_STATUS\r
-ReassignIdeResources (\r
- IN IDE_BLK_IO_DEV *IdeDev\r
- );\r
-\r
-/**\r
- Detect if there is disk attached to this port.\r
-\r
- @param IdeDev The BLK_IO private data which specifies the IDE device.\r
-\r
- @retval EFI_NOT_FOUND The device or channel is not found\r
- @retval EFI_SUCCESS The device is found\r
-\r
-**/\r
-EFI_STATUS\r
-DiscoverIdeDevice (\r
- IN IDE_BLK_IO_DEV *IdeDev\r
- );\r
-\r
-/**\r
- This interface is used to initialize all state data related to the\r
- detection of one channel.\r
-\r
-**/\r
-VOID\r
-InitializeIDEChannelData (\r
- VOID\r
- );\r
-\r
-/**\r
- This function is used to poll for the DRQ bit clear in the Status\r
- Register. DRQ is cleared when the device is finished transferring data.\r
- So this function is called after data transfer is finished.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used\r
- to record all the information of the IDE device.\r
- @param TimeoutInMilliSeconds used to designate the timeout for the DRQ clear.\r
-\r
- @retval EFI_SUCCESS DRQ bit clear within the time out.\r
-\r
- @retval EFI_TIMEOUT DRQ bit not clear within the time out.\r
-\r
- @note\r
- Read Status Register will clear interrupt status.\r
-\r
-**/\r
-EFI_STATUS\r
-DRQClear (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN UINTN TimeoutInMilliSeconds\r
- );\r
-\r
-/**\r
- This function is used to poll for the DRQ bit clear in the Alternate\r
- Status Register. DRQ is cleared when the device is finished\r
- transferring data. So this function is called after data transfer\r
- is finished.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used\r
- to record all the information of the IDE device.\r
-\r
- @param TimeoutInMilliSeconds used to designate the timeout for the DRQ clear.\r
-\r
- @retval EFI_SUCCESS DRQ bit clear within the time out.\r
-\r
- @retval EFI_TIMEOUT DRQ bit not clear within the time out.\r
- @note\r
- Read Alternate Status Register will not clear interrupt status.\r
-\r
-**/\r
-EFI_STATUS\r
-DRQClear2 (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN UINTN TimeoutInMilliSeconds\r
- );\r
-\r
-/**\r
- This function is used to poll for the DRQ bit set in the\r
- Status Register.\r
- DRQ is set when the device is ready to transfer data. So this function\r
- is called after the command is sent to the device and before required\r
- data is transferred.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure,used to\r
- record all the information of the IDE device.\r
- @param TimeoutInMilliSeconds used to designate the timeout for the DRQ ready.\r
-\r
- @retval EFI_SUCCESS DRQ bit set within the time out.\r
- @retval EFI_TIMEOUT DRQ bit not set within the time out.\r
- @retval EFI_ABORTED DRQ bit not set caused by the command abort.\r
-\r
- @note Read Status Register will clear interrupt status.\r
-\r
-**/\r
-EFI_STATUS\r
-DRQReady (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN UINTN TimeoutInMilliSeconds\r
- );\r
-\r
-/**\r
- This function is used to poll for the DRQ bit set in the Alternate Status Register.\r
- DRQ is set when the device is ready to transfer data. So this function is called after\r
- the command is sent to the device and before required data is transferred.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used to\r
- record all the information of the IDE device.\r
-\r
- @param TimeoutInMilliSeconds used to designate the timeout for the DRQ ready.\r
-\r
- @retval EFI_SUCCESS DRQ bit set within the time out.\r
- @retval EFI_TIMEOUT DRQ bit not set within the time out.\r
- @retval EFI_ABORTED DRQ bit not set caused by the command abort.\r
- @note Read Alternate Status Register will not clear interrupt status.\r
-\r
-**/\r
-EFI_STATUS\r
-DRQReady2 (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN UINTN TimeoutInMilliSeconds\r
- );\r
-\r
-/**\r
- This function is used to poll for the BSY bit clear in the Status Register. BSY\r
- is clear when the device is not busy. Every command must be sent after device is not busy.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used\r
- to record all the information of the IDE device.\r
- @param TimeoutInMilliSeconds used to designate the timeout for the DRQ ready.\r
-\r
- @retval EFI_SUCCESS BSY bit clear within the time out.\r
- @retval EFI_TIMEOUT BSY bit not clear within the time out.\r
-\r
- @note Read Status Register will clear interrupt status.\r
-**/\r
-EFI_STATUS\r
-WaitForBSYClear (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN UINTN TimeoutInMilliSeconds\r
- );\r
-\r
-/**\r
- This function is used to poll for the BSY bit clear in the Alternate Status Register.\r
- BSY is clear when the device is not busy. Every command must be sent after device is\r
- not busy.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used to record\r
- all the information of the IDE device.\r
- @param TimeoutInMilliSeconds used to designate the timeout for the DRQ ready.\r
-\r
- @retval EFI_SUCCESS BSY bit clear within the time out.\r
- @retval EFI_TIMEOUT BSY bit not clear within the time out.\r
- @note Read Alternate Status Register will not clear interrupt status.\r
-\r
-**/\r
-EFI_STATUS\r
-WaitForBSYClear2 (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN UINTN TimeoutInMilliSeconds\r
- );\r
-\r
-/**\r
- This function is used to poll for the DRDY bit set in the Status Register. DRDY\r
- bit is set when the device is ready to accept command. Most ATA commands must be\r
- sent after DRDY set except the ATAPI Packet Command.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used\r
- to record all the information of the IDE device.\r
- @param DelayInMilliSeconds used to designate the timeout for the DRQ ready.\r
-\r
- @retval EFI_SUCCESS DRDY bit set within the time out.\r
- @retval EFI_TIMEOUT DRDY bit not set within the time out.\r
-\r
- @note Read Status Register will clear interrupt status.\r
-**/\r
-EFI_STATUS\r
-DRDYReady (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN UINTN DelayInMilliSeconds\r
- );\r
-\r
-/**\r
- This function is used to poll for the DRDY bit set in the Alternate Status Register.\r
- DRDY bit is set when the device is ready to accept command. Most ATA commands must\r
- be sent after DRDY set except the ATAPI Packet Command.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used\r
- to record all the information of the IDE device.\r
- @param DelayInMilliSeconds used to designate the timeout for the DRQ ready.\r
-\r
- @retval EFI_SUCCESS DRDY bit set within the time out.\r
- @retval EFI_TIMEOUT DRDY bit not set within the time out.\r
-\r
- @note Read Alternate Status Register will clear interrupt status.\r
-\r
-**/\r
-EFI_STATUS\r
-DRDYReady2 (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN UINTN DelayInMilliSeconds\r
- );\r
-\r
-//\r
-// ATA device functions' prototype\r
-//\r
-/**\r
- Sends out an ATA Identify Command to the specified device.\r
-\r
- This function is called by DiscoverIdeDevice() during its device\r
- identification. It sends out the ATA Identify Command to the\r
- specified device. Only ATA device responses to this command. If\r
- the command succeeds, it returns the Identify data structure which\r
- contains information about the device. This function extracts the\r
- information it needs to fill the IDE_BLK_IO_DEV data structure,\r
- including device type, media block size, media capacity, and etc.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure,used to record\r
- all the information of the IDE device.\r
-\r
- @retval EFI_SUCCESS Identify ATA device successfully.\r
- @retval EFI_DEVICE_ERROR ATA Identify Device Command failed or device is not ATA device.\r
- @note parameter IdeDev will be updated in this function.\r
-\r
-**/\r
-EFI_STATUS\r
-ATAIdentify (\r
- IN IDE_BLK_IO_DEV *IdeDev\r
- );\r
-\r
-/**\r
- This function is called by ATAIdentify() or ATAPIIdentify() to print device's module name.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used to record\r
- all the information of the IDE device.\r
-**/\r
-VOID\r
-PrintAtaModuleName (\r
- IN IDE_BLK_IO_DEV *IdeDev\r
- );\r
-/**\r
- This function is used to send out ATA commands conforms to the PIO Data In Protocol.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used to record\r
- all the information of the IDE device.\r
- @param Buffer buffer contained data transferred from device to host.\r
- @param ByteCount data size in byte unit of the buffer.\r
- @param AtaCommand value of the Command Register\r
- @param Head value of the Head/Device Register\r
- @param SectorCount value of the Sector Count Register\r
- @param SectorNumber value of the Sector Number Register\r
- @param CylinderLsb value of the low byte of the Cylinder Register\r
- @param CylinderMsb value of the high byte of the Cylinder Register\r
-\r
- @retval EFI_SUCCESS send out the ATA command and device send required data successfully.\r
- @retval EFI_DEVICE_ERROR command sent failed.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaPioDataIn (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN VOID *Buffer,\r
- IN UINT32 ByteCount,\r
- IN UINT8 AtaCommand,\r
- IN UINT8 Head,\r
- IN UINT8 SectorCount,\r
- IN UINT8 SectorNumber,\r
- IN UINT8 CylinderLsb,\r
- IN UINT8 CylinderMsb\r
- );\r
-\r
-/**\r
- This function is used to send out ATA commands conforms to the\r
- PIO Data Out Protocol.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used\r
- to record all the information of the IDE device.\r
- @param *Buffer buffer contained data transferred from host to device.\r
- @param ByteCount data size in byte unit of the buffer.\r
- @param AtaCommand value of the Command Register\r
- @param Head value of the Head/Device Register\r
- @param SectorCount value of the Sector Count Register\r
- @param SectorNumber value of the Sector Number Register\r
- @param CylinderLsb value of the low byte of the Cylinder Register\r
- @param CylinderMsb value of the high byte of the Cylinder Register\r
-\r
- @retval EFI_SUCCESS send out the ATA command and device received required\r
- data successfully.\r
- @retval EFI_DEVICE_ERROR command sent failed.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaPioDataOut (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN VOID *Buffer,\r
- IN UINT32 ByteCount,\r
- IN UINT8 AtaCommand,\r
- IN UINT8 Head,\r
- IN UINT8 SectorCount,\r
- IN UINT8 SectorNumber,\r
- IN UINT8 CylinderLsb,\r
- IN UINT8 CylinderMsb\r
- );\r
-\r
-/**\r
- This function is used to analyze the Status Register and print out\r
- some debug information and if there is ERR bit set in the Status\r
- Register, the Error Register's value is also be parsed and print out.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used to\r
- record all the information of the IDE device.\r
-\r
- @retval EFI_SUCCESS No err information in the Status Register.\r
- @retval EFI_DEVICE_ERROR Any err information in the Status Register.\r
-\r
-**/\r
-EFI_STATUS\r
-CheckErrorStatus (\r
- IN IDE_BLK_IO_DEV *IdeDev\r
- );\r
-\r
-/**\r
- This function is used to implement the Soft Reset on the specified device. But,\r
- the ATA Soft Reset mechanism is so strong a reset method that it will force\r
- resetting on both devices connected to the same cable.\r
-\r
- It is called by IdeBlkIoReset(), a interface function of Block\r
- I/O protocol.\r
-\r
- This function can also be used by the ATAPI device to perform reset when\r
- ATAPI Reset command is failed.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used to record\r
- all the information of the IDE device.\r
- @retval EFI_SUCCESS Soft reset completes successfully.\r
- @retval EFI_DEVICE_ERROR Any step during the reset process is failed.\r
-\r
- @note The registers initial values after ATA soft reset are different\r
- to the ATA device and ATAPI device.\r
-**/\r
-EFI_STATUS\r
-AtaSoftReset (\r
- IN IDE_BLK_IO_DEV *IdeDev\r
- );\r
-\r
-/**\r
- This function is the ATA implementation for ReadBlocks in the\r
- Block I/O Protocol interface.\r
-\r
- @param IdeBlkIoDevice Indicates the calling context.\r
- @param MediaId The media id that the read request is for.\r
- @param Lba The starting logical block address to read from on the device.\r
- @param BufferSize The size of the Buffer in bytes. This must be a multiple\r
- of the intrinsic block size of the device.\r
-\r
- @param Buffer A pointer to the destination buffer for the data. The caller\r
- is responsible for either having implicit or explicit ownership\r
- of the memory that data is read into.\r
-\r
- @retval EFI_SUCCESS Read Blocks successfully.\r
- @retval EFI_DEVICE_ERROR Read Blocks failed.\r
- @retval EFI_NO_MEDIA There is no media in the device.\r
- @retval EFI_MEDIA_CHANGE The MediaId is not for the current media.\r
- @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the\r
- intrinsic block size of the device.\r
- @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
- or the data buffer is not valid.\r
-\r
- @note If Read Block error because of device error, this function will call\r
- AtaSoftReset() function to reset device.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaBlkIoReadBlocks (\r
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,\r
- IN UINT32 MediaId,\r
- IN EFI_LBA Lba,\r
- IN UINTN BufferSize,\r
- OUT VOID *Buffer\r
- );\r
-\r
-/**\r
- This function is the ATA implementation for WriteBlocks in the\r
- Block I/O Protocol interface.\r
-\r
- @param IdeBlkIoDevice Indicates the calling context.\r
- @param MediaId The media id that the write request is for.\r
- @param Lba The starting logical block address to write onto the device.\r
- @param BufferSize The size of the Buffer in bytes. This must be a multiple\r
- of the intrinsic block size of the device.\r
- @param Buffer A pointer to the source buffer for the data.The caller\r
- is responsible for either having implicit or explicit\r
- ownership of the memory that data is written from.\r
-\r
- @retval EFI_SUCCESS Write Blocks successfully.\r
- @retval EFI_DEVICE_ERROR Write Blocks failed.\r
- @retval EFI_NO_MEDIA There is no media in the device.\r
- @retval EFI_MEDIA_CHANGE The MediaId is not for the current media.\r
-\r
- @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the\r
- intrinsic block size of the device.\r
- @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
- or the data buffer is not valid.\r
-\r
- @note If Write Block error because of device error, this function will call\r
- AtaSoftReset() function to reset device.\r
-**/\r
-EFI_STATUS\r
-AtaBlkIoWriteBlocks (\r
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,\r
- IN UINT32 MediaId,\r
- IN EFI_LBA Lba,\r
- IN UINTN BufferSize,\r
- OUT VOID *Buffer\r
- );\r
-\r
-/**\r
- This function is called by DiscoverIdeDevice() during its device\r
- identification.\r
- Its main purpose is to get enough information for the device media\r
- to fill in the Media data structure of the Block I/O Protocol interface.\r
-\r
- There are 5 steps to reach such objective:\r
- 1. Sends out the ATAPI Identify Command to the specified device.\r
- Only ATAPI device responses to this command. If the command succeeds,\r
- it returns the Identify data structure which filled with information\r
- about the device. Since the ATAPI device contains removable media,\r
- the only meaningful information is the device module name.\r
- 2. Sends out ATAPI Inquiry Packet Command to the specified device.\r
- This command will return inquiry data of the device, which contains\r
- the device type information.\r
- 3. Allocate sense data space for future use. We don't detect the media\r
- presence here to improvement boot performance, especially when CD\r
- media is present. The media detection will be performed just before\r
- each BLK_IO read/write\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used\r
- to record all the information of the IDE device.\r
-\r
- @retval EFI_SUCCESS Identify ATAPI device successfully.\r
- @retval EFI_DEVICE_ERROR ATAPI Identify Device Command failed or device type\r
- is not supported by this IDE driver.\r
- @retval EFI_OUT_OF_RESOURCES Allocate memory for sense data failed\r
-\r
- @note Parameter "IdeDev" will be updated in this function.\r
-**/\r
-EFI_STATUS\r
-ATAPIIdentify (\r
- IN IDE_BLK_IO_DEV *IdeDev\r
- );\r
-\r
-/**\r
- This function is used to implement the Soft Reset on the specified\r
- ATAPI device. Different from the AtaSoftReset(), here reset is a ATA\r
- Soft Reset Command special for ATAPI device, and it only take effects\r
- on the specified ATAPI device, not on the whole IDE bus.\r
- Since the ATAPI soft reset is needed when device is in exceptional\r
- condition (such as BSY bit is always set ), I think the Soft Reset\r
- command should be sent without waiting for the BSY clear and DRDY\r
- set.\r
- This function is called by IdeBlkIoReset(),\r
- a interface function of Block I/O protocol.\r
-\r
- @param IdeDev pointer pointing to IDE_BLK_IO_DEV data structure, used\r
- to record all the information of the IDE device.\r
-\r
- @retval EFI_SUCCESS Soft reset completes successfully.\r
- @retval EFI_DEVICE_ERROR Any step during the reset process is failed.\r
-\r
-**/\r
-EFI_STATUS\r
-AtapiSoftReset (\r
- IN IDE_BLK_IO_DEV *IdeDev\r
- );\r
-\r
-/**\r
- This function is the ATAPI implementation for ReadBlocks in the\r
- Block I/O Protocol interface.\r
-\r
- @param IdeBlkIoDevice Indicates the calling context.\r
- @param MediaId The media id that the read request is for.\r
- @param Lba The starting logical block address to read from on the device.\r
- @param BufferSize The size of the Buffer in bytes. This must be a multiple\r
- of the intrinsic block size of the device.\r
- @param Buffer A pointer to the destination buffer for the data. The caller\r
- is responsible for either having implicit or explicit\r
- ownership of the memory that data is read into.\r
-\r
- @retval EFI_SUCCESS Read Blocks successfully.\r
- @retval EFI_DEVICE_ERROR Read Blocks failed.\r
- @retval EFI_NO_MEDIA There is no media in the device.\r
- @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
- @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the\r
- intrinsic block size of the device.\r
- @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
- or the data buffer is not valid.\r
-**/\r
-EFI_STATUS\r
-AtapiBlkIoReadBlocks (\r
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,\r
- IN UINT32 MediaId,\r
- IN EFI_LBA Lba,\r
- IN UINTN BufferSize,\r
- OUT VOID *Buffer\r
- );\r
-\r
-/**\r
- This function is the ATAPI implementation for WriteBlocks in the\r
- Block I/O Protocol interface.\r
-\r
- @param IdeBlkIoDevice Indicates the calling context.\r
- @param MediaId The media id that the write request is for.\r
- @param Lba The starting logical block address to write onto the device.\r
- @param BufferSize The size of the Buffer in bytes. This must be a multiple\r
- of the intrinsic block size of the device.\r
- @param Buffer A pointer to the source buffer for the data. The caller\r
- is responsible for either having implicit or explicit ownership\r
- of the memory that data is written from.\r
-\r
- @retval EFI_SUCCESS Write Blocks successfully.\r
- @retval EFI_DEVICE_ERROR Write Blocks failed.\r
- @retval EFI_NO_MEDIA There is no media in the device.\r
- @retval EFI_MEDIA_CHANGE The MediaId is not for the current media.\r
- @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the\r
- intrinsic block size of the device.\r
- @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
- or the data buffer is not valid.\r
-\r
- @retval EFI_WRITE_PROTECTED The write protected is enabled or the media does not support write\r
-**/\r
-EFI_STATUS\r
-AtapiBlkIoWriteBlocks (\r
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice,\r
- IN UINT32 MediaId,\r
- IN EFI_LBA Lba,\r
- IN UINTN BufferSize,\r
- OUT VOID *Buffer\r
- );\r
-\r
-/**\r
- Release resources of an IDE device before stopping it.\r
-\r
- @param IdeBlkIoDevice Standard IDE device private data structure\r
-\r
-**/\r
-VOID\r
-ReleaseIdeResources (\r
- IN IDE_BLK_IO_DEV *IdeBlkIoDevice\r
- );\r
-\r
-/**\r
- Set the calculated Best transfer mode to a detected device\r
-\r
- @param IdeDev Standard IDE device private data structure\r
- @param TransferMode The device transfer mode to be set\r
- @return Set transfer mode Command execute status.\r
-**/\r
-EFI_STATUS\r
-SetDeviceTransferMode (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN ATA_TRANSFER_MODE *TransferMode\r
- );\r
-/**\r
- Send ATA command into device with NON_DATA protocol.\r
-\r
- @param IdeDev Standard IDE device private data structure\r
- @param AtaCommand The ATA command to be sent\r
- @param Device The value in Device register\r
- @param Feature The value in Feature register\r
- @param SectorCount The value in SectorCount register\r
- @param LbaLow The value in LBA_LOW register\r
- @param LbaMiddle The value in LBA_MIDDLE register\r
- @param LbaHigh The value in LBA_HIGH register\r
-\r
- @retval EFI_SUCCESS Reading succeed\r
- @retval EFI_ABORTED Command failed\r
- @retval EFI_DEVICE_ERROR Device status error.\r
-\r
-**/\r
-EFI_STATUS\r
-AtaNonDataCommandIn (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN UINT8 AtaCommand,\r
- IN UINT8 Device,\r
- IN UINT8 Feature,\r
- IN UINT8 SectorCount,\r
- IN UINT8 LbaLow,\r
- IN UINT8 LbaMiddle,\r
- IN UINT8 LbaHigh\r
- );\r
-\r
-/**\r
- Enable Long Physical Sector Feature for ATA device.\r
-\r
- @param IdeDev The IDE device data\r
-\r
- @retval EFI_SUCCESS The ATA device supports Long Physical Sector feature\r
- and corresponding fields in BlockIo structure is updated.\r
- @retval EFI_UNSUPPORTED The device is not ATA device or Long Physical Sector\r
- feature is not supported.\r
-**/\r
-EFI_STATUS\r
-AtaEnableLongPhysicalSector (\r
- IN IDE_BLK_IO_DEV *IdeDev\r
- );\r
-\r
-/**\r
- Set drive parameters for devices not support PACKETS command.\r
-\r
- @param IdeDev Standard IDE device private data structure\r
- @param DriveParameters The device parameters to be set into the disk\r
- @return SetParameters Command execute status.\r
-\r
-**/\r
-EFI_STATUS\r
-SetDriveParameters (\r
- IN IDE_BLK_IO_DEV *IdeDev,\r
- IN ATA_DRIVE_PARMS *DriveParameters\r
- );\r
-\r
-/**\r
- Enable Interrupt on IDE controller.\r
-\r
- @param IdeDev Standard IDE device private data structure\r
-\r
- @retval EFI_SUCCESS Enable Interrupt successfully\r
-**/\r
-EFI_STATUS\r
-EnableInterrupt (\r
- IN IDE_BLK_IO_DEV *IdeDev\r
- );\r
-#endif\r