11#ifndef _NVM_EXPRESS_PEI_H_
12#define _NVM_EXPRESS_PEI_H_
51#define IS_PCI_NVMHCI(_p) IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SOLID_STATE, PCI_IF_MASS_STORAGE_SOLID_STATE_ENTERPRISE_NVMHCI)
61#define NVME_MAX_QUEUES 2
62#define NVME_ASQ_SIZE 1
63#define NVME_ACQ_SIZE 1
64#define NVME_CSQ_SIZE 63
65#define NVME_CCQ_SIZE 63
66#define NVME_PRP_SIZE (8)
68#define NVME_MEM_MAX_PAGES \
76#define NVME_ADMIN_QUEUE 0x00
77#define NVME_IO_QUEUE 0x01
78#define NVME_GENERIC_TIMEOUT 5000000
79#define NVME_POLL_INTERVAL 100
92#define NVME_CONTROLLER_NSID 0
97#define NVME_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('N','V','P','C')
106 UINTN DevicePathLength;
138 NVME_SQ *SqBuffer[NVME_MAX_QUEUES];
139 NVME_CQ *CqBuffer[NVME_MAX_QUEUES];
147 UINT8 Pt[NVME_MAX_QUEUES];
148 UINT16 Cid[NVME_MAX_QUEUES];
158 UINT32 ActiveNamespaceNum;
162#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO(a) \
163 CR (a, PEI_NVME_CONTROLLER_PRIVATE_DATA, BlkIoPpi, NVME_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)
164#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO2(a) \
165 CR (a, PEI_NVME_CONTROLLER_PRIVATE_DATA, BlkIo2Ppi, NVME_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)
166#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY(a) \
167 CR (a, PEI_NVME_CONTROLLER_PRIVATE_DATA, StorageSecurityPpi, NVME_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)
168#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_NVME_PASSTHRU(a) \
169 CR (a, PEI_NVME_CONTROLLER_PRIVATE_DATA, NvmePassThruPpi, NVME_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)
170#define GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a) \
171 CR (a, PEI_NVME_CONTROLLER_PRIVATE_DATA, EndOfPeiNotifyList, NVME_PEI_CONTROLLER_PRIVATE_DATA_SIGNATURE)
198 OUT VOID **HostAddress,
218 IN VOID *HostAddress,
244 IN VOID *HostAddress,
300 OUT BOOLEAN *EntireDevicePathEnd
340 IN UINT32 NamespaceId,
341 IN UINT64 NamespaceUuid,
EFI_STATUS IoMmuUnmap(IN VOID *Mapping)
EFI_STATUS NvmeBuildDevicePath(IN PEI_NVME_CONTROLLER_PRIVATE_DATA *Private, IN UINT32 NamespaceId, IN UINT64 NamespaceUuid, OUT UINTN *DevicePathLength, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
BOOLEAN NvmeS3SkipThisController(IN EFI_DEVICE_PATH_PROTOCOL *HcDevicePath, IN UINTN HcDevicePathLength)
EFI_STATUS IoMmuAllocateBuffer(IN UINTN Pages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
EFI_STATUS EFIAPI NvmePeimEndOfPei(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
EFI_STATUS IoMmuMap(IN EDKII_IOMMU_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
EFI_STATUS GetDevicePathInstanceSize(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINTN *InstanceSize, OUT BOOLEAN *EntireDevicePathEnd)
EFI_STATUS NvmeIsHcDevicePathValid(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN UINTN DevicePathLength)
EFI_STATUS EFIAPI NvmePciDevicePpiInstallationCallback(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
EFI_STATUS EFIAPI NvmeHostControllerPpiInstallationCallback(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
EFI_STATUS IoMmuFreeBuffer(IN UINTN Pages, IN VOID *HostAddress, IN VOID *Mapping)
UINT64 EFI_PHYSICAL_ADDRESS