]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Ppi/AtaController.h
MdeModulePkg/S3SmmInitDone.h: Fix copyright coding style error.
[mirror_edk2.git] / MdeModulePkg / Include / Ppi / AtaController.h
CommitLineData
ea060cfa 1/** @file\r
2 Define the PPI to abstract the functions that enable IDE and SATA channels, and to retrieve\r
3 the base I/O port address for each of the enabled IDE and SATA channels.\r
d1102dba
LG
4\r
5Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
ea060cfa 6\r
7This program and the accompanying materials\r
8are licensed and made available under the terms and conditions\r
9of the BSD License which accompanies this distribution. The\r
10full text of the license may be found at\r
11http://opensource.org/licenses/bsd-license.php\r
12\r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#ifndef _PEI_ATA_CONTROLLER_PPI_H_\r
19#define _PEI_ATA_CONTROLLER_PPI_H_\r
20\r
21///\r
d1102dba 22/// Global ID for the PEI_ATA_CONTROLLER_PPI.\r
ea060cfa 23///\r
24#define PEI_ATA_CONTROLLER_PPI_GUID \\r
25 { \\r
26 0xa45e60d1, 0xc719, 0x44aa, {0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d } \\r
27 }\r
28\r
29///\r
30/// Forward declaration for the PEI_ATA_CONTROLLER_PPI.\r
31///\r
32typedef struct _PEI_ATA_CONTROLLER_PPI PEI_ATA_CONTROLLER_PPI;\r
33\r
34///\r
d1102dba
LG
35/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to\r
36/// disable the IDE channels.\r
37/// This is designed for old generation chipset with PATA/SATA controllers.\r
38/// It may be ignored in PPI implementation for new generation chipset without PATA controller.\r
ea060cfa 39///\r
40#define PEI_ICH_IDE_NONE 0x00\r
41\r
42///\r
d1102dba 43/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to\r
ea060cfa 44/// enable the Primary IDE channel.\r
d1102dba
LG
45/// This is designed for old generation chipset with PATA/SATA controllers.\r
46/// It may be ignored in PPI implementation for new generation chipset without PATA controller.\r
ea060cfa 47///\r
48#define PEI_ICH_IDE_PRIMARY 0x01\r
49\r
50///\r
d1102dba 51/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to\r
ea060cfa 52/// enable the Secondary IDE channel.\r
d1102dba
LG
53/// This is designed for old generation chipset with PATA/SATA controllers.\r
54/// It may be ignored in PPI implementation for new generation chipset without PATA controller.\r
ea060cfa 55///\r
56#define PEI_ICH_IDE_SECONDARY 0x02\r
57\r
58///\r
d1102dba 59/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to\r
ea060cfa 60/// disable the SATA channel.\r
d1102dba
LG
61/// This is designed for old generation chipset with PATA/SATA controllers.\r
62/// It may be ignored in PPI implementation for new generation chipset without PATA controller.\r
ea060cfa 63///\r
64#define PEI_ICH_SATA_NONE 0x04\r
65\r
66///\r
d1102dba 67/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to\r
ea060cfa 68/// enable the Primary SATA channel.\r
d1102dba
LG
69/// This is designed for old generation chipset with PATA/SATA controllers.\r
70/// It may be ignored in PPI implementation for new generation chipset without PATA controller.\r
ea060cfa 71///\r
72#define PEI_ICH_SATA_PRIMARY 0x08\r
73\r
74///\r
d1102dba 75/// This bit is used in the ChannelMask parameter of EnableAtaChannel() to\r
ea060cfa 76/// enable the Secondary SATA channel.\r
d1102dba
LG
77/// This is designed for old generation chipset with PATA/SATA controllers.\r
78/// It may be ignored in PPI implementation for new generation chipset without PATA controller.\r
ea060cfa 79///\r
80#define PEI_ICH_SATA_SECONDARY 0x010\r
81\r
82///\r
83/// Structure that contains the base addresses for the IDE registers\r
84///\r
85typedef struct {\r
86 ///\r
87 /// Base I/O port address of the IDE controller's command block\r
88 ///\r
89 UINT16 CommandBlockBaseAddr;\r
90 ///\r
91 /// Base I/O port address of the IDE controller's control block\r
92 ///\r
93 UINT16 ControlBlockBaseAddr;\r
94} IDE_REGS_BASE_ADDR;\r
95\r
96/**\r
97 Sets IDE and SATA channels to an enabled or disabled state.\r
98\r
99 This service enables or disables the IDE and SATA channels specified by ChannelMask.\r
d1102dba
LG
100 It may ignore ChannelMask setting to enable or disable IDE and SATA channels based on the platform policy.\r
101 The number of the enabled channels will be returned by GET_IDE_REGS_BASE_ADDR() function.\r
ea060cfa 102\r
103 If the new state is set, then EFI_SUCCESS is returned. If the new state can\r
104 not be set, then EFI_DEVICE_ERROR is returned.\r
105\r
106 @param[in] PeiServices The pointer to the PEI Services Table.\r
107 @param[in] This The pointer to this instance of the PEI_ATA_CONTROLLER_PPI.\r
d1102dba 108 @param[in] ChannelMask The bitmask that identifies the IDE and SATA channels to\r
86ac8fb2 109 enable or disable. This parameter is optional.\r
ea060cfa 110\r
111 @retval EFI_SUCCESS The IDE or SATA channels were enabled or disabled successfully.\r
112 @retval EFI_DEVICE_ERROR The IDE or SATA channels could not be enabled or disabled.\r
113\r
114**/\r
115typedef\r
116EFI_STATUS\r
117(EFIAPI *PEI_ENABLE_ATA)(\r
118 IN EFI_PEI_SERVICES **PeiServices,\r
119 IN PEI_ATA_CONTROLLER_PPI *This,\r
120 IN UINT8 ChannelMask\r
121 );\r
122\r
123/**\r
d1102dba 124 Retrieves the I/O port base addresses for command and control registers of the\r
ea060cfa 125 enabled IDE/SATA channels.\r
126\r
127 This service fills in the structure poionted to by IdeRegsBaseAddr with the I/O\r
128 port base addresses for the command and control registers of the IDE and SATA\r
d1102dba 129 channels that were previously enabled in EnableAtaChannel(). The number of\r
ea060cfa 130 enabled IDE and SATA channels is returned.\r
131\r
132 @param[in] PeiServices The pointer to the PEI Services Table.\r
133 @param[in] This The pointer to this instance of the PEI_ATA_CONTROLLER_PPI.\r
d1102dba
LG
134 @param[out] IdeRegsBaseAddr The pointer to caller allocated space to return the\r
135 I/O port base addresses of the IDE and SATA channels\r
ea060cfa 136 that were previosuly enabled with EnableAtaChannel().\r
137\r
138 @return The number of enabled IDE and SATA channels in the platform.\r
139\r
140**/\r
141typedef\r
142UINT32\r
143(EFIAPI *GET_IDE_REGS_BASE_ADDR)(\r
144 IN EFI_PEI_SERVICES **PeiServices,\r
145 IN PEI_ATA_CONTROLLER_PPI *This,\r
d1102dba 146 OUT IDE_REGS_BASE_ADDR *IdeRegsBaseAddr\r
ea060cfa 147 );\r
148\r
149///\r
150/// This PPI contains services to enable and disable IDE and SATA channels and\r
151/// retrieves the base I/O port addresses to the enabled IDE and SATA channels.\r
152///\r
153struct _PEI_ATA_CONTROLLER_PPI {\r
154 PEI_ENABLE_ATA EnableAtaChannel;\r
155 GET_IDE_REGS_BASE_ADDR GetIdeRegsBaseAddr;\r
156};\r
157\r
158extern EFI_GUID gPeiAtaControllerPpiGuid;\r
159\r
160#endif\r
161\r
162\r