X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FBus%2FPci%2FAtapiPassThruDxe%2FAtapiPassThru.h;h=1ac174c7a0b9e9abad11b2483e9242d9a4850e2e;hp=49b97a821f2bb189046afe816811b11c59c00a7e;hb=68246fa809e4a8ab61ce7bbfdd1a0b31d03e83fb;hpb=581c608bab1bd19105697b2f98b61651051815de diff --git a/MdeModulePkg/Bus/Pci/AtapiPassThruDxe/AtapiPassThru.h b/MdeModulePkg/Bus/Pci/AtapiPassThruDxe/AtapiPassThru.h index 49b97a821f..1ac174c7a0 100644 --- a/MdeModulePkg/Bus/Pci/AtapiPassThruDxe/AtapiPassThru.h +++ b/MdeModulePkg/Bus/Pci/AtapiPassThruDxe/AtapiPassThru.h @@ -1,12 +1,12 @@ /** @file - Copyright (c) 2006, Intel Corporation - All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php + Copyright (c) 2006, Intel Corporation + All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: AtapiPassThru.h @@ -16,18 +16,12 @@ #define _APT_H -// -// The package level header files this module uses -// + #include -// -// The protocols, PPI and GUID defintions for this module -// + #include #include -// -// The Library classes this module consumes -// + #include #include #include @@ -62,6 +56,28 @@ typedef union { UINT16 DeviceControl; /* when write */ } IDE_AltStatus_OR_DeviceControl; + +typedef enum { + IdePrimary = 0, + IdeSecondary = 1, + IdeMaxChannel = 2 +} EFI_IDE_CHANNEL; + +/// + + +// +// Bit definitions in Programming Interface byte of the Class Code field +// in PCI IDE controller's Configuration Space +// +#define IDE_PRIMARY_OPERATING_MODE BIT0 +#define IDE_PRIMARY_PROGRAMMABLE_INDICATOR BIT1 +#define IDE_SECONDARY_OPERATING_MODE BIT2 +#define IDE_SECONDARY_PROGRAMMABLE_INDICATOR BIT3 + + +#define ATAPI_MAX_CHANNEL 2 + /// /// IDE registers set /// @@ -74,36 +90,38 @@ typedef struct { UINT16 CylinderMsb; UINT16 Head; IDE_CMD_OR_STATUS Reg; - IDE_AltStatus_OR_DeviceControl Alt; UINT16 DriveAddress; - - UINT16 MasterSlave; } IDE_BASE_REGISTERS; #define ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE EFI_SIGNATURE_32 ('a', 's', 'p', 't') typedef struct { - UINTN Signature; - - EFI_HANDLE Handle; - EFI_SCSI_PASS_THRU_PROTOCOL ScsiPassThru; - EFI_SCSI_PASS_THRU_MODE ScsiPassThruMode; - EFI_PCI_IO_PROTOCOL *PciIo; - + UINTN Signature; + EFI_HANDLE Handle; + EFI_SCSI_PASS_THRU_PROTOCOL ScsiPassThru; + EFI_SCSI_PASS_THRU_MODE ScsiPassThruMode; + EFI_PCI_IO_PROTOCOL *PciIo; + UINT64 OriginalPciAttributes; // // Local Data goes here // - IDE_BASE_REGISTERS *IoPort; - - CHAR16 ControllerName[100]; - CHAR16 ChannelName[100]; - - UINT32 LatestTargetId; - UINT64 LatestLun; - + IDE_BASE_REGISTERS *IoPort; + IDE_BASE_REGISTERS AtapiIoPortRegisters[2]; + CHAR16 ControllerName[100]; + CHAR16 ChannelName[100]; + UINT32 LatestTargetId; + UINT64 LatestLun; } ATAPI_SCSI_PASS_THRU_DEV; +// +// IDE registers' base addresses +// +typedef struct { + UINT16 CommandBlockBaseAddr; + UINT16 ControlBlockBaseAddr; +} IDE_REGISTERS_BASE_ADDR; + #define ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS(a) \ CR (a, \ ATAPI_SCSI_PASS_THRU_DEV, \ @@ -114,8 +132,9 @@ typedef struct { // // Global Variables // -extern EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding; -extern EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName; +extern EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding; +extern EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName; +extern EFI_COMPONENT_NAME2_PROTOCOL gAtapiScsiPassThruComponentName2; // // ATAPI Command op code @@ -284,6 +303,45 @@ AtapiScsiPassThruDriverBindingStop ( // // EFI Component Name Functions // +/** + Retrieves a Unicode string that is the user readable name of the driver. + + This function retrieves the user readable name of a driver in the form of a + Unicode string. If the driver specified by This has a user readable name in + the language specified by Language, then a pointer to the driver name is + returned in DriverName, and EFI_SUCCESS is returned. If the driver specified + by This does not support the language specified by Language, + then EFI_UNSUPPORTED is returned. + + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + EFI_COMPONENT_NAME_PROTOCOL instance. + + @param Language[in] A pointer to a Null-terminated ASCII string + array indicating the language. This is the + language of the driver name that the caller is + requesting, and it must match one of the + languages specified in SupportedLanguages. The + number of languages supported by a driver is up + to the driver writer. Language is specified + in RFC 3066 or ISO 639-2 language code format. + + @param DriverName[out] A pointer to the Unicode string to return. + This Unicode string is the name of the + driver specified by This in the language + specified by Language. + + @retval EFI_SUCCESS The Unicode string for the Driver specified by + This and the language specified by Language was + returned in DriverName. + + @retval EFI_INVALID_PARAMETER Language is NULL. + + @retval EFI_INVALID_PARAMETER DriverName is NULL. + + @retval EFI_UNSUPPORTED The driver specified by This does not support + the language specified by Language. + +**/ EFI_STATUS EFIAPI AtapiScsiPassThruComponentNameGetDriverName ( @@ -292,6 +350,75 @@ AtapiScsiPassThruComponentNameGetDriverName ( OUT CHAR16 **DriverName ); + +/** + Retrieves a Unicode string that is the user readable name of the controller + that is being managed by a driver. + + This function retrieves the user readable name of the controller specified by + ControllerHandle and ChildHandle in the form of a Unicode string. If the + driver specified by This has a user readable name in the language specified by + Language, then a pointer to the controller name is returned in ControllerName, + and EFI_SUCCESS is returned. If the driver specified by This is not currently + managing the controller specified by ControllerHandle and ChildHandle, + then EFI_UNSUPPORTED is returned. If the driver specified by This does not + support the language specified by Language, then EFI_UNSUPPORTED is returned. + + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or + EFI_COMPONENT_NAME_PROTOCOL instance. + + @param ControllerHandle[in] The handle of a controller that the driver + specified by This is managing. This handle + specifies the controller whose name is to be + returned. + + @param ChildHandle[in] The handle of the child controller to retrieve + the name of. This is an optional parameter that + may be NULL. It will be NULL for device + drivers. It will also be NULL for a bus drivers + that wish to retrieve the name of the bus + controller. It will not be NULL for a bus + driver that wishes to retrieve the name of a + child controller. + + @param Language[in] A pointer to a Null-terminated ASCII string + array indicating the language. This is the + language of the driver name that the caller is + requesting, and it must match one of the + languages specified in SupportedLanguages. The + number of languages supported by a driver is up + to the driver writer. Language is specified in + RFC 3066 or ISO 639-2 language code format. + + @param ControllerName[out] A pointer to the Unicode string to return. + This Unicode string is the name of the + controller specified by ControllerHandle and + ChildHandle in the language specified by + Language from the point of view of the driver + specified by This. + + @retval EFI_SUCCESS The Unicode string for the user readable name in + the language specified by Language for the + driver specified by This was returned in + DriverName. + + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. + + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid + EFI_HANDLE. + + @retval EFI_INVALID_PARAMETER Language is NULL. + + @retval EFI_INVALID_PARAMETER ControllerName is NULL. + + @retval EFI_UNSUPPORTED The driver specified by This is not currently + managing the controller specified by + ControllerHandle and ChildHandle. + + @retval EFI_UNSUPPORTED The driver specified by This does not support + the language specified by Language. + +**/ EFI_STATUS EFIAPI AtapiScsiPassThruComponentNameGetControllerName ( @@ -302,6 +429,7 @@ AtapiScsiPassThruComponentNameGetControllerName ( OUT CHAR16 **ControllerName ); + /** AtapiScsiPassThruDriverEntryPoint @@ -327,6 +455,7 @@ AtapiScsiPassThruDriverEntryPoint ( @param This @param Controller @param PciIo + @param OriginalPciAttributes @todo Add function description @todo This add argument description @@ -336,9 +465,10 @@ AtapiScsiPassThruDriverEntryPoint ( **/ EFI_STATUS RegisterAtapiScsiPassThru ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, - IN EFI_PCI_IO_PROTOCOL *PciIo + IN EFI_PCI_IO_PROTOCOL *PciIo, + IN UINT64 OriginalPciAttributes ) ; @@ -830,4 +960,51 @@ AtapiPassThruCheckErrorStatus ( ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate ) ; +EFI_STATUS +GetIdeRegistersBaseAddr ( + IN EFI_PCI_IO_PROTOCOL *PciIo, + OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr + ) +/*++ + +Routine Description: + Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode, + use fixed addresses. In Native-PCI mode, get base addresses from BARs in + the PCI IDE controller's Configuration Space. + +Arguments: + PciIo - Pointer to the EFI_PCI_IO_PROTOCOL instance + IdeRegsBaseAddr - Pointer to IDE_REGISTERS_BASE_ADDR to + receive IDE IO port registers' base addresses + +Returns: + + EFI_STATUS + +--*/ +; + +VOID +InitAtapiIoPortRegisters ( + IN ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate, + IN IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr + ) +/*++ + +Routine Description: + + Initialize each Channel's Base Address of CommandBlock and ControlBlock. + +Arguments: + + AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV + IdeRegsBaseAddr - The pointer of IDE_REGISTERS_BASE_ADDR + +Returns: + + None + +--*/ +; + #endif