29 OUT UINT16 *PtrCommand
37 PciIo = &PciIoDevice->PciIo;
39 if (Operation != EFI_SET_REGISTER) {
40 Status = PciIo->Pci.
Read (
48 if (Operation == EFI_GET_REGISTER) {
49 *PtrCommand = OldCommand;
54 if (Operation == EFI_ENABLE_REGISTER) {
55 OldCommand = (UINT16)(OldCommand | Command);
56 }
else if (Operation == EFI_DISABLE_REGISTER) {
57 OldCommand = (UINT16)(OldCommand & ~(Command));
62 return PciIo->Pci.
Write (
109 IN OUT UINT8 *Offset,
110 OUT UINT8 *NextRegBlock OPTIONAL
114 UINT16 CapabilityEntry;
121 return EFI_UNSUPPORTED;
125 CapabilityPtr = *Offset;
129 PciIoDevice->PciIo.Pci.Read (
137 PciIoDevice->PciIo.Pci.Read (
140 PCI_CAPBILITY_POINTER_OFFSET,
147 while ((CapabilityPtr >= 0x40) && ((CapabilityPtr & 0x03) == 0x00)) {
148 PciIoDevice->PciIo.Pci.Read (
156 CapabilityID = (UINT8)CapabilityEntry;
158 if (CapabilityID == CapId) {
159 *Offset = CapabilityPtr;
160 if (NextRegBlock !=
NULL) {
161 *NextRegBlock = (UINT8)(CapabilityEntry >> 8);
171 if (CapabilityPtr == (UINT8)(CapabilityEntry >> 8)) {
175 CapabilityPtr = (UINT8)(CapabilityEntry >> 8);
178 return EFI_NOT_FOUND;
198 IN OUT UINT32 *Offset,
199 OUT UINT32 *NextRegBlock OPTIONAL
203 UINT32 CapabilityPtr;
204 UINT32 CapabilityEntry;
210 if (!PciIoDevice->IsPciExp) {
211 return EFI_UNSUPPORTED;
215 CapabilityPtr = *Offset;
217 CapabilityPtr = EFI_PCIE_CAPABILITY_BASE_OFFSET;
220 while (CapabilityPtr != 0) {
224 CapabilityPtr &= 0xFFC;
225 Status = PciIoDevice->PciIo.Pci.Read (
232 if (EFI_ERROR (Status)) {
236 if (CapabilityEntry == MAX_UINT32) {
239 "%a: [%02x|%02x|%02x] failed to access config space at offset 0x%x\n",
241 PciIoDevice->BusNumber,
242 PciIoDevice->DeviceNumber,
243 PciIoDevice->FunctionNumber,
249 CapabilityID = (UINT16)CapabilityEntry;
251 if (CapabilityID == CapId) {
252 *Offset = CapabilityPtr;
253 if (NextRegBlock !=
NULL) {
254 *NextRegBlock = (CapabilityEntry >> 20) & 0xFFF;
260 CapabilityPtr = (CapabilityEntry >> 20) & 0xFFF;
263 return EFI_NOT_FOUND;
#define DEBUG(Expression)
#define EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR
#define IS_CARDBUS_BRIDGE(_p)
#define EFI_PCI_STATUS_CAPABILITY
0x0010
BOOLEAN PciCapabilitySupport(IN PCI_IO_DEVICE *PciIoDevice)
EFI_STATUS LocatePciExpressCapabilityRegBlock(IN PCI_IO_DEVICE *PciIoDevice, IN UINT16 CapId, IN OUT UINT32 *Offset, OUT UINT32 *NextRegBlock OPTIONAL)
EFI_STATUS PciOperateRegister(IN PCI_IO_DEVICE *PciIoDevice, IN UINT16 Command, IN UINT8 Offset, IN UINT8 Operation, OUT UINT16 *PtrCommand)
EFI_STATUS LocateCapabilityRegBlock(IN PCI_IO_DEVICE *PciIoDevice, IN UINT8 CapId, IN OUT UINT8 *Offset, OUT UINT8 *NextRegBlock OPTIONAL)
EFI_PCI_IO_PROTOCOL_CONFIG Read
EFI_PCI_IO_PROTOCOL_CONFIG Write