From 1e22c4d9f9a6537b31fb3f9bbaf2cd0c640d3ef9 Mon Sep 17 00:00:00 2001 From: mdkinney Date: Mon, 13 Jul 2009 19:01:33 +0000 Subject: Add the following PI 1.2 Protocols to the MdePkg 1) Disk Info Protocol and its associated device GUIDs 2) PCI Hot Plug Request Protocol git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8936 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Include/Protocol/DiskInfo.h | 200 ++++++++++++++++++++++++++++ MdePkg/Include/Protocol/PciHotPlugRequest.h | 170 +++++++++++++++++++++++ MdePkg/MdePkg.dec | 28 ++++ 3 files changed, 398 insertions(+) create mode 100644 MdePkg/Include/Protocol/DiskInfo.h create mode 100644 MdePkg/Include/Protocol/PciHotPlugRequest.h (limited to 'MdePkg') diff --git a/MdePkg/Include/Protocol/DiskInfo.h b/MdePkg/Include/Protocol/DiskInfo.h new file mode 100644 index 0000000..025ed67 --- /dev/null +++ b/MdePkg/Include/Protocol/DiskInfo.h @@ -0,0 +1,200 @@ +/** @file + Provides the basic interfaces to abstract platform information regarding an + IDE controller. + + Copyright (c) 2006 - 2009, 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. + + @par Revision Reference: + This Protocol is defined in UEFI Platform Initialization Specification 1.2 + Volume 5: Standards + +**/ + +#ifndef __DISK_INFO_H__ +#define __DISK_INFO_H__ + +/// +/// Global ID for EFI_DISK_INFO_PROTOCOL +/// +#define EFI_DISK_INFO_PROTOCOL_GUID \ + { \ + 0xd432a67f, 0x14dc, 0x484b, {0xb3, 0xbb, 0x3f, 0x2, 0x91, 0x84, 0x93, 0x27 } \ + } + +/// +/// Forward declaration for EFI_DISK_INFO_PROTOCOL +/// +typedef struct _EFI_DISK_INFO_PROTOCOL EFI_DISK_INFO_PROTOCOL; + +/// +/// Global ID for an IDE interface. Used to fill in EFI_DISK_INFO_PROTOCOL.Interface +/// +#define EFI_DISK_INFO_IDE_INTERFACE_GUID \ + { \ + 0x5e948fe3, 0x26d3, 0x42b5, {0xaf, 0x17, 0x61, 0x2, 0x87, 0x18, 0x8d, 0xec } \ + } + +/// +/// Global ID for a SCSI interface. Used to fill in EFI_DISK_INFO_PROTOCOL.Interface +/// +#define EFI_DISK_INFO_SCSI_INTERFACE_GUID \ + { \ + 0x8f74baa, 0xea36, 0x41d9, {0x95, 0x21, 0x21, 0xa7, 0xf, 0x87, 0x80, 0xbc } \ + } + +/// +/// Global ID for a USB interface. Used to fill in EFI_DISK_INFO_PROTOCOL.Interface +/// +#define EFI_DISK_INFO_USB_INTERFACE_GUID \ + { \ + 0xcb871572, 0xc11a, 0x47b5, {0xb4, 0x92, 0x67, 0x5e, 0xaf, 0xa7, 0x77, 0x27 } \ + } + +/// +/// Global ID for an AHCI interface. Used to fill in EFI_DISK_INFO_PROTOCOL.Interface +/// +#define EFI_DISK_INFO_AHCI_INTERFACE_GUID \ + { \ + 0x9e498932, 0x4abc, 0x45af, {0xa3, 0x4d, 0x2, 0x47, 0x78, 0x7b, 0xe7, 0xc6} \ + } + +/** + Provides inquiry information for the controller type. + + This function is used by the IDE bus driver to get inquiry data. Data format + of Identify data is defined by the Interface GUID. + + @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance. + @param[in,out] InquiryData Pointer to a buffer for the inquiry data. + @param[in,out] InquiryDataSize Pointer to the value for the inquiry data size. + + @retval EFI_SUCCESS The command was accepted without any errors. + @retval EFI_NOT_FOUND Device does not support this data class + @retval EFI_DEVICE_ERROR Error reading InquiryData from device + @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DISK_INFO_INQUIRY)( + IN EFI_DISK_INFO_PROTOCOL *This, + IN OUT VOID *InquiryData, + IN OUT UINT32 *InquiryDataSize + ); + +/** + Provides identify information for the controller type. + + This function is used by the IDE bus driver to get identify data. Data format + of Identify data is defined by the Interface GUID. + + @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL + instance. + @param[in,out] IdentifyData Pointer to a buffer for the identify data. + @param[in,out] IdentifyDataSize Pointer to the value for the identify data + size. + + @retval EFI_SUCCESS The command was accepted without any errors. + @retval EFI_NOT_FOUND Device does not support this data class + @retval EFI_DEVICE_ERROR Error reading IdentifyData from device + @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DISK_INFO_IDENTIFY)( + IN EFI_DISK_INFO_PROTOCOL *This, + IN OUT VOID *IdentifyData, + IN OUT UINT32 *IdentifyDataSize + ); + +/** + Provides sense data information for the controller type. + + This function is used by the IDE bus driver to get sense data. + Data format of Sense data is defined by the Interface GUID. + + @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance. + @param[in,out] SenseData Pointer to the SenseData. + @param[in,out] SenseDataSize Size of SenseData in bytes. + @param[out] SenseDataNumber Pointer to the value for the sense data size. + + @retval EFI_SUCCESS The command was accepted without any errors. + @retval EFI_NOT_FOUND Device does not support this data class. + @retval EFI_DEVICE_ERROR Error reading SenseData from device. + @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DISK_INFO_SENSE_DATA)( + IN EFI_DISK_INFO_PROTOCOL *This, + IN OUT VOID *SenseData, + IN OUT UINT32 *SenseDataSize, + OUT UINT8 *SenseDataNumber + ); + +/** + This function is used by the IDE bus driver to get controller information. + + @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance. + @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary. + @param[out] IdeDevice Pointer to the Ide Device number. Master or slave. + + @retval EFI_SUCCESS IdeChannel and IdeDevice are valid. + @retval EFI_UNSUPPORTED This is not an IDE device. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_DISK_INFO_WHICH_IDE)( + IN EFI_DISK_INFO_PROTOCOL *This, + OUT UINT32 *IdeChannel, + OUT UINT32 *IdeDevice + ); + +/// +/// The EFI_DISK_INFO_PROTOCOL provides controller specific information. +/// +struct _EFI_DISK_INFO_PROTOCOL { + /// + /// A GUID that defines the format of buffers for the other member functions + /// of this protocol. + /// + EFI_GUID Interface; + /// + /// Return the results of the Inquiry command to a drive in InquiryData. Data + /// format of Inquiry data is defined by the Interface GUID. + /// + EFI_DISK_INFO_INQUIRY Inquiry; + /// + /// Return the results of the Identify command to a drive in IdentifyData. Data + /// format of Identify data is defined by the Interface GUID. + /// + EFI_DISK_INFO_IDENTIFY Identify; + /// + /// Return the results of the Request Sense command to a drive in SenseData. Data + /// format of Sense data is defined by the Interface GUID. + /// + EFI_DISK_INFO_SENSE_DATA SenseData; + /// + /// Specific controller. + /// + EFI_DISK_INFO_WHICH_IDE WhichIde; +}; + +extern EFI_GUID gEfiDiskInfoProtocolGuid; + +extern EFI_GUID gEfiDiskInfoIdeInterfaceGuid; +extern EFI_GUID gEfiDiskInfoScsiInterfaceGuid; +extern EFI_GUID gEfiDiskInfoUsbInterfaceGuid; +extern EFI_GUID gEfiDiskInfoAhciInterfaceGuid; + +#endif diff --git a/MdePkg/Include/Protocol/PciHotPlugRequest.h b/MdePkg/Include/Protocol/PciHotPlugRequest.h new file mode 100644 index 0000000..249216c --- /dev/null +++ b/MdePkg/Include/Protocol/PciHotPlugRequest.h @@ -0,0 +1,170 @@ +/** @file + Provides services to notify the PCI bus driver that some events have happened + in a hot-plug controller (such as a PC Card socket, or PHPC), and to ask the + PCI bus driver to create or destroy handles for PCI-like devices. + + A hot-plug capable PCI bus driver should produce the EFI PCI Hot Plug Request + protocol. When a PCI device or a PCI-like device (for example, 32-bit PC Card) + is installed after PCI bus does the enumeration, the PCI bus driver can be + notified through this protocol. For example, when a 32-bit PC Card is inserted + into the PC Card socket, the PC Card bus driver can call interface of this + protocol to notify PCI bus driver to allocate resource and create handles for + this PC Card. + + The EFI_PCI_HOTPLUG_REQUEST_PROTOCOL is installed by the PCI bus driver on a + separate handle when PCI bus driver starts up. There is only one instance in + the system. Any driver that wants to use this protocol must locate it globally. + The EFI_PCI_HOTPLUG_REQUEST_PROTOCOL allows the driver of hot-plug controller, + for example, PC Card Bus driver, to notify PCI bus driver that an event has + happened in the hot-plug controller, and the PCI bus driver is requested to + create (add) or destroy (remove) handles for the specified PCI-like devices. + For example, when a 32-bit PC Card is inserted, this protocol interface will + be called with an add operation, and the PCI bus driver will enumerate and + start the devices inserted; when a 32-bit PC Card is removed, this protocol + interface will be called with a remove operation, and the PCI bus driver will + stop the devices and destroy their handles. The existence of this protocol + represents the capability of the PCI bus driver. If this protocol exists in + system, it means PCI bus driver is hot-plug capable, thus together with the + effort of PC Card bus driver, hot-plug of PC Card can be supported. Otherwise, + the hot-plug capability is not provided. + + Copyright (c) 2006 - 2009, 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. + + @par Revision Reference: + This Protocol is defined in UEFI Platform Initialization Specification 1.2 + Volume 5: Standards + +**/ + +#ifndef __PCI_HOTPLUG_REQUEST_H_ +#define __PCI_HOTPLUG_REQUEST_H_ + +/// +/// Global ID for EFI_PCI_HOTPLUG_REQUEST_PROTOCOL +/// +#define EFI_PCI_HOTPLUG_REQUEST_PROTOCOL_GUID \ + { \ + 0x19cb87ab, 0x2cb9, 0x4665, {0x83, 0x60, 0xdd, 0xcf, 0x60, 0x54, 0xf7, 0x9d} \ + } + +/// +/// Forward declaration for EFI_PCI_HOTPLUG_REQUEST_PROTOCOL +/// +typedef struct _EFI_PCI_HOTPLUG_REQUEST_PROTOCOL EFI_PCI_HOTPLUG_REQUEST_PROTOCOL; + +/// +/// Enumeration of PCI hot plug operations +/// +typedef enum { + /// + /// The PCI bus driver is requested to create handles for the specified devices. + /// An array of EFI_HANDLE is returned, with a NULL element marking the end of + /// the array. + /// + EfiPciHotPlugRequestAdd, + + /// + /// The PCI bus driver is requested to destroy handles for the specified devices. + /// + EfiPciHotplugRequestRemove +} EFI_PCI_HOTPLUG_OPERATION; + +/** + This function is used to notify PCI bus driver that some events happened in a + hot-plug controller, and the PCI bus driver is requested to start or stop + specified PCI-like devices. + + This function allows the PCI bus driver to be notified to act as requested when + a hot-plug event has happened on the hot-plug controller. Currently, the + operations include add operation and remove operation. If it is a add operation, + the PCI bus driver will enumerate, allocate resources for devices behind the + hot-plug controller, and create handle for the device specified by RemainingDevicePath. + The RemainingDevicePath is an optional parameter. If it is not NULL, only the + specified device is started; if it is NULL, all devices behind the hot-plug + controller are started. The newly created handles of PC Card functions are + returned in the ChildHandleBuffer, together with the number of child handle in + NumberOfChildren. If it is a remove operation, when NumberOfChildren contains + a non-zero value, child handles specified in ChildHandleBuffer are stopped and + destroyed; otherwise, PCI bus driver is notified to stop managing the controller + handle. + + @param[in] This A pointer to the EFI_PCI_HOTPLUG_REQUEST_PROTOCOL + instance. + @param[in] Operation The operation the PCI bus driver is requested + to make. + @param[in] Controller The handle of the hot-plug controller. + @param[in] RemainingDevicePath The remaining device path for the PCI-like + hot-plug device. It only contains device + path nodes behind the hot-plug controller. + It is an optional parameter and only valid + when the Operation is a add operation. If + it is NULL, all devices behind the PC Card + socket are started. + @param[in,out] NumberOfChildren The number of child handles. For an add + operation, it is an output parameter. For + a remove operation, it's an input parameter. + When it contains a non-zero value, children + handles specified in ChildHandleBuffer are + destroyed. Otherwise, PCI bus driver is + notified to stop managing the controller + handle. + @param[in,out] ChildHandleBuffer The buffer which contains the child handles. + For an add operation, it is an output + parameter and contains all newly created + child handles. For a remove operation, it + contains child handles to be destroyed when + NumberOfChildren contains a non-zero value. + It can be NULL when NumberOfChildren is 0. + It's the caller's responsibility to allocate + and free memory for this buffer. + + @retval EFI_SUCCESS The handles for the specified device have been + created or destroyed as requested, and for an + add operation, the new handles are returned in + ChildHandleBuffer. + @retval EFI_INVALID_PARAMETER Operation is not a legal value. + @retval EFI_INVALID_PARAMETER Controller is NULL or not a valid handle. + @retval EFI_INVALID_PARAMETER NumberOfChildren is NULL. + @retval EFI_INVALID_PARAMETER ChildHandleBuffer is NULL while Operation is + remove and NumberOfChildren contains a non-zero + value. + @retval EFI_INVALID_PARAMETER ChildHandleBuffer is NULL while Operation is add. + @retval EFI_OUT_OF_RESOURCES There are no enough resources to start the + devices. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_PCI_HOTPLUG_REQUEST_NOTIFY)( + IN EFI_PCI_HOTPLUG_REQUEST_PROTOCOL *This, + IN EFI_PCI_HOTPLUG_OPERATION Operation, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL, + IN OUT UINT8 *NumberOfChildren, + IN OUT EFI_HANDLE *ChildHandleBuffer + ); + +/// +/// Provides services to notify PCI bus driver that some events have happened in +/// a hot-plug controller (for example, PC Card socket, or PHPC), and ask PCI bus +/// driver to create or destroy handles for the PCI-like devices. +/// +struct _EFI_PCI_HOTPLUG_REQUEST_PROTOCOL { + /// + /// Notify the PCI bus driver that some events have happened in a hot-plug + /// controller (for example, PC Card socket, or PHPC), and ask PCI bus driver + /// to create or destroy handles for the PCI-like devices. See Section 0 for + /// a detailed description. + /// + EFI_PCI_HOTPLUG_REQUEST_NOTIFY Notify; +}; + +extern EFI_GUID gEfiPciHotPlugRequestProtocolGuid; + +#endif diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 65030a9..7b03e77 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -351,6 +351,26 @@ ## Include/Guid/HardwareErrorVariable.h gEfiHardwareErrorVariableGuid = { 0x414E6BDD, 0xE47B, 0x47cc, { 0xB2, 0x44, 0xBB, 0x61, 0x02, 0x0C, 0xF5, 0x16 }} + + # + # GUID defined in PI1.2 + # + + ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify Ide interface. + ## Include/Protocol/DiskInfo.h + gEfiDiskInfoIdeInterfaceGuid = { 0x5E948FE3, 0x26D3, 0x42B5, { 0xAF, 0x17, 0x61, 0x02, 0x87, 0x18, 0x8D, 0xEC }} + + ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify Scsi interface. + ## Include/Protocol/DiskInfo.h + gEfiDiskInfoScsiInterfaceGuid = { 0x08F74BAA, 0xEA36, 0x41D9, { 0x95, 0x21, 0x21, 0xA7, 0x0F, 0x87, 0x80, 0xBC }} + + ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify Usb interface. + ## Include/Protocol/DiskInfo.h + gEfiDiskInfoUsbInterfaceGuid = { 0xCB871572, 0xC11A, 0x47B5, { 0xB4, 0x92, 0x67, 0x5E, 0xAF, 0xA7, 0x77, 0x27 }} + + ## Guid for EFI_DISK_INFO_PROTOCOL.Interface to specify Ahci interface. + ## Include/Protocol/DiskInfo.h + gEfiDiskInfoAhciInterfaceGuid = { 0x9e498932, 0x4abc, 0x45af, { 0xa3, 0x4d, 0x02, 0x47, 0x78, 0x7b, 0xe7, 0xc6 }} [Ppis] ## Include/Ppi/MasterBootMode.h @@ -494,6 +514,14 @@ ## Include/Protocol/MpService.h gEfiMpServiceProtocolGuid = { 0x3fdda605, 0xa76e, 0x4f46, { 0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08 }} + + ## This protocol is used to add or remove all PCI child devices on the PCI root bridge. + ## Include/Protocol/PciHotPlugRequest.h + gEfiPciHotPlugRequestProtocolGuid = { 0x19CB87AB, 0x2CB9, 0x4665, { 0x83, 0x60, 0xDD, 0xCF, 0x60, 0x54, 0xF7, 0x9D }} + + ## Disk Info protocol is used to export Inquiry Data for a drive. + ## Include/Protocol/DiskInfo.h + gEfiDiskInfoProtocolGuid = { 0xD432A67F, 0x14DC, 0x484B, { 0xB3, 0xBB, 0x3F, 0x02, 0x91, 0x84, 0x93, 0x27 }} # # Protocols defined in UEFI2.1/UEFI2.0/EFI1.1 -- cgit v1.1