]>
git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciCommand.h
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _EFI_PCI_COMMAND_H
16 #define _EFI_PCI_COMMAND_H
19 // The PCI Command register bits owned by PCI Bus driver.
21 // They should be cleared at the beginning. The other registers
22 // are owned by chipset, we should not touch them.
24 #define EFI_PCI_COMMAND_BITS_OWNED ( \
25 EFI_PCI_COMMAND_IO_SPACE | \
26 EFI_PCI_COMMAND_MEMORY_SPACE | \
27 EFI_PCI_COMMAND_BUS_MASTER | \
28 EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE | \
29 EFI_PCI_COMMAND_VGA_PALETTE_SNOOP | \
30 EFI_PCI_COMMAND_FAST_BACK_TO_BACK \
34 // The PCI Bridge Control register bits owned by PCI Bus driver.
36 // They should be cleared at the beginning. The other registers
37 // are owned by chipset, we should not touch them.
39 #define EFI_PCI_BRIDGE_CONTROL_BITS_OWNED ( \
40 EFI_PCI_BRIDGE_CONTROL_ISA | \
41 EFI_PCI_BRIDGE_CONTROL_VGA | \
42 EFI_PCI_BRIDGE_CONTROL_VGA_16 | \
43 EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK \
47 // The PCCard Bridge Control register bits owned by PCI Bus driver.
49 // They should be cleared at the beginning. The other registers
50 // are owned by chipset, we should not touch them.
52 #define EFI_PCCARD_BRIDGE_CONTROL_BITS_OWNED ( \
53 EFI_PCI_BRIDGE_CONTROL_ISA | \
54 EFI_PCI_BRIDGE_CONTROL_VGA | \
55 EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK \
59 #define EFI_GET_REGISTER 1
60 #define EFI_SET_REGISTER 2
61 #define EFI_ENABLE_REGISTER 3
62 #define EFI_DISABLE_REGISTER 4
65 Operate the PCI register via PciIo function interface.
67 @param PciIoDevice Pointer to instance of PCI_IO_DEVICE
68 @param Command Operator command
69 @param Offset The address within the PCI configuration space for the PCI controller.
70 @param Operation Type of Operation
71 @param PtrCommand Return buffer holding old PCI command, if operation is not EFI_SET_REGISTER
73 @return status of PciIo operation
77 IN PCI_IO_DEVICE
*PciIoDevice
,
81 OUT UINT16
*PtrCommand
85 check the cpability of this device supports
87 @param PciIoDevice Pointer to instance of PCI_IO_DEVICE
90 @retval FALSE Not support
93 PciCapabilitySupport (
94 IN PCI_IO_DEVICE
*PciIoDevice
100 @param PciIoDevice - A pointer to the PCI_IO_DEVICE.
101 @param CapId - The cap ID.
102 @param Offset - A pointer to the offset.
103 @param NextRegBlock - A pointer to the next block.
105 @retval EFI_UNSUPPORTED Pci device does not support
106 @retval EFI_NOT_FOUND Pci device support but can not find register block.
107 @retval EFI_SUCCESS Success to locate capability register block
110 LocateCapabilityRegBlock (
111 IN PCI_IO_DEVICE
*PciIoDevice
,
113 IN OUT UINT8
*Offset
,
114 OUT UINT8
*NextRegBlock OPTIONAL
118 #define PciReadCommandRegister(a,b) \
119 PciOperateRegister (a,0, PCI_COMMAND_OFFSET, EFI_GET_REGISTER, b)
121 #define PciSetCommandRegister(a,b) \
122 PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_SET_REGISTER, NULL)
124 #define PciEnableCommandRegister(a,b) \
125 PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_ENABLE_REGISTER, NULL)
127 #define PciDisableCommandRegister(a,b) \
128 PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_DISABLE_REGISTER, NULL)
130 #define PciReadBridgeControlRegister(a,b) \
131 PciOperateRegister (a,0, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_GET_REGISTER, b)
133 #define PciSetBridgeControlRegister(a,b) \
134 PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_SET_REGISTER, NULL)
136 #define PciEnableBridgeControlRegister(a,b) \
137 PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_ENABLE_REGISTER, NULL)
139 #define PciDisableBridgeControlRegister(a,b) \
140 PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_DISABLE_REGISTER, NULL)