TianoCore EDK2 master
Loading...
Searching...
No Matches
SataController.h
Go to the documentation of this file.
1
10#ifndef _SATA_CONTROLLER_H_
11#define _SATA_CONTROLLER_H_
12
13#include <Uefi.h>
14
16
19#include <Protocol/PciIo.h>
21#include <Protocol/DevicePath.h>
22
23#include <Library/BaseLib.h>
25#include <Library/DebugLib.h>
26#include <Library/UefiLib.h>
30
31//
32// Global Variables definitions
33//
37
38#define AHCI_BAR_INDEX 0x05
39#define R_AHCI_CAP 0x0
40#define B_AHCI_CAP_NPS (BIT4 | BIT3 | BIT2 | BIT1 | BIT0) // Number of Ports
41#define B_AHCI_CAP_SPM BIT17 // Supports Port Multiplier
42#define R_AHCI_PI 0xC
43
47#define AHCI_MAX_DEVICES 0x01
48
52#define AHCI_MULTI_MAX_DEVICES 0x0F
53
57#define IDE_MAX_CHANNEL 0x02
58
62#define IDE_MAX_DEVICES 0x02
63
64#define SATA_ENUMER_ALL FALSE
65
66//
67// Sata Controller driver private data structure
68//
69#define SATA_CONTROLLER_SIGNATURE SIGNATURE_32('S','A','T','A')
70
72 //
73 // Standard signature used to identify Sata Controller private data
74 //
75 UINT32 Signature;
76
77 //
78 // Protocol instance of IDE_CONTROLLER_INIT produced by this driver
79 //
81
82 //
83 // Copy of protocol pointers used by this driver
84 //
86
87 //
88 // The number of devices that are supported by this channel
89 //
90 UINT8 DeviceCount;
91
92 //
93 // The highest disqulified mode for each attached device,
94 // From ATA/ATAPI spec, if a mode is not supported,
95 // the modes higher than it is also not supported
96 //
97 EFI_ATA_COLLECTIVE_MODE *DisqualifiedModes;
98
99 //
100 // A copy of EFI_IDENTIFY_DATA data for each attached SATA device and its flag
101 //
102 EFI_IDENTIFY_DATA *IdentifyData;
103 BOOLEAN *IdentifyValid;
104
105 //
106 // Track the state so that the PCI attributes that were modified
107 // can be restored to the original value later.
108 //
109 BOOLEAN PciAttributesChanged;
110
111 //
112 // Copy of the original PCI Attributes
113 //
114 UINT64 OriginalPciAttributes;
116
117#define SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS(a) CR(a, EFI_SATA_CONTROLLER_PRIVATE_DATA, IdeInit, SATA_CONTROLLER_SIGNATURE)
118
119//
120// Driver binding functions declaration
121//
122
138EFIAPI
141 IN EFI_HANDLE Controller,
142 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
143 );
144
160EFIAPI
163 IN EFI_HANDLE Controller,
164 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
165 );
166
180EFIAPI
183 IN EFI_HANDLE Controller,
184 IN UINTN NumberOfChildren,
185 IN EFI_HANDLE *ChildHandleBuffer
186 );
187
188//
189// IDE controller init functions declaration
190//
191
230EFIAPI
233 IN UINT8 Channel,
234 OUT BOOLEAN *Enabled,
235 OUT UINT8 *MaxDevices
236 );
237
264EFIAPI
268 IN UINT8 Channel
269 );
270
311EFIAPI
314 IN UINT8 Channel,
315 IN UINT8 Device,
316 IN EFI_IDENTIFY_DATA *IdentifyData
317 );
318
360EFIAPI
363 IN UINT8 Channel,
364 IN UINT8 Device,
366 );
367
423EFIAPI
426 IN UINT8 Channel,
427 IN UINT8 Device,
428 OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes
429 );
430
455EFIAPI
458 IN UINT8 Channel,
459 IN UINT8 Device,
461 );
462
463//
464// Forward reference declaration
465//
466
489EFIAPI
492 IN CHAR8 *Language,
493 OUT CHAR16 **DriverName
494 );
495
537EFIAPI
540 IN EFI_HANDLE ControllerHandle,
541 IN EFI_HANDLE ChildHandle OPTIONAL,
542 IN CHAR8 *Language,
543 OUT CHAR16 **ControllerName
544 );
545
546#endif
UINT64 UINTN
EFI_IDE_CONTROLLER_ENUM_PHASE
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS EFIAPI SataControllerSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI IdeInitNotifyPhase(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase, IN UINT8 Channel)
EFI_STATUS EFIAPI SataControllerComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
EFI_STATUS EFIAPI IdeInitSubmitData(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN UINT8 Channel, IN UINT8 Device, IN EFI_IDENTIFY_DATA *IdentifyData)
EFI_STATUS EFIAPI IdeInitSetTiming(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN UINT8 Channel, IN UINT8 Device, IN EFI_ATA_COLLECTIVE_MODE *Modes)
EFI_COMPONENT_NAME_PROTOCOL gSataControllerComponentName
Definition: ComponentName.c:14
EFI_STATUS EFIAPI SataControllerComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
Definition: ComponentName.c:80
EFI_DRIVER_BINDING_PROTOCOL gSataControllerDriverBinding
EFI_COMPONENT_NAME2_PROTOCOL gSataControllerComponentName2
Definition: ComponentName.c:23
EFI_STATUS EFIAPI SataControllerStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS EFIAPI IdeInitGetChannelInfo(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN UINT8 Channel, OUT BOOLEAN *Enabled, OUT UINT8 *MaxDevices)
EFI_STATUS EFIAPI SataControllerStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI IdeInitDisqualifyMode(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN UINT8 Channel, IN UINT8 Device, IN EFI_ATA_COLLECTIVE_MODE *BadModes)
EFI_STATUS EFIAPI IdeInitCalculateMode(IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This, IN UINT8 Channel, IN UINT8 Device, OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33