]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Bus/Pci/PciBus/Dxe/PciCommand.h
The reasons for the changes made are:
[mirror_edk2.git] / EdkModulePkg / Bus / Pci / PciBus / Dxe / PciCommand.h
1 /*++
2
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
8
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.
11
12 Module Name:
13
14 PciCommand.h
15
16 Abstract:
17
18 PCI Bus Driver
19
20 Revision History
21
22 --*/
23
24 #ifndef _EFI_PCI_COMMAND_H
25 #define _EFI_PCI_COMMAND_H
26
27 //
28 // The PCI Command register bits owned by PCI Bus driver.
29 //
30 // They should be cleared at the beginning. The other registers
31 // are owned by chipset, we should not touch them.
32 //
33 #define EFI_PCI_COMMAND_BITS_OWNED ( \
34 EFI_PCI_COMMAND_IO_SPACE | \
35 EFI_PCI_COMMAND_MEMORY_SPACE | \
36 EFI_PCI_COMMAND_BUS_MASTER | \
37 EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE | \
38 EFI_PCI_COMMAND_VGA_PALETTE_SNOOP | \
39 EFI_PCI_COMMAND_FAST_BACK_TO_BACK \
40 )
41
42 //
43 // The PCI Bridge Control register bits owned by PCI Bus driver.
44 //
45 // They should be cleared at the beginning. The other registers
46 // are owned by chipset, we should not touch them.
47 //
48 #define EFI_PCI_BRIDGE_CONTROL_BITS_OWNED ( \
49 EFI_PCI_BRIDGE_CONTROL_ISA | \
50 EFI_PCI_BRIDGE_CONTROL_VGA | \
51 EFI_PCI_BRIDGE_CONTROL_VGA_16 | \
52 EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK \
53 )
54
55 //
56 // The PCCard Bridge Control register bits owned by PCI Bus driver.
57 //
58 // They should be cleared at the beginning. The other registers
59 // are owned by chipset, we should not touch them.
60 //
61 #define EFI_PCCARD_BRIDGE_CONTROL_BITS_OWNED ( \
62 EFI_PCI_BRIDGE_CONTROL_ISA | \
63 EFI_PCI_BRIDGE_CONTROL_VGA | \
64 EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK \
65 )
66
67
68 #define EFI_GET_REGISTER 1
69 #define EFI_SET_REGISTER 2
70 #define EFI_ENABLE_REGISTER 3
71 #define EFI_DISABLE_REGISTER 4
72
73 EFI_STATUS
74 PciOperateRegister (
75 IN PCI_IO_DEVICE *PciIoDevice,
76 IN UINT16 Command,
77 IN UINT8 Offset,
78 IN UINT8 Operation,
79 OUT UINT16 *PtrCommand
80 )
81 /*++
82
83 Routine Description:
84
85 TODO: Add function description
86
87 Arguments:
88
89 PciIoDevice - TODO: add argument description
90 Command - TODO: add argument description
91 Offset - TODO: add argument description
92 Operation - TODO: add argument description
93 PtrCommand - TODO: add argument description
94
95 Returns:
96
97 TODO: add return values
98
99 --*/
100 ;
101
102 BOOLEAN
103 PciCapabilitySupport (
104 IN PCI_IO_DEVICE *PciIoDevice
105 )
106 /*++
107
108 Routine Description:
109
110 TODO: Add function description
111
112 Arguments:
113
114 PciIoDevice - TODO: add argument description
115
116 Returns:
117
118 TODO: add return values
119
120 --*/
121 ;
122
123 EFI_STATUS
124 LocateCapabilityRegBlock (
125 IN PCI_IO_DEVICE *PciIoDevice,
126 IN UINT8 CapId,
127 IN OUT UINT8 *Offset,
128 OUT UINT8 *NextRegBlock OPTIONAL
129 )
130 /*++
131
132 Routine Description:
133
134 TODO: Add function description
135
136 Arguments:
137
138 PciIoDevice - TODO: add argument description
139 CapId - TODO: add argument description
140 Offset - TODO: add argument description
141 NextRegBlock - TODO: add argument description
142
143 Returns:
144
145 TODO: add return values
146
147 --*/
148 ;
149
150
151 #define PciReadCommandRegister(a,b) \
152 PciOperateRegister (a,0, PCI_COMMAND_OFFSET, EFI_GET_REGISTER, b)
153
154 #define PciSetCommandRegister(a,b) \
155 PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_SET_REGISTER, NULL)
156
157 #define PciEnableCommandRegister(a,b) \
158 PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_ENABLE_REGISTER, NULL)
159
160 #define PciDisableCommandRegister(a,b) \
161 PciOperateRegister (a,b, PCI_COMMAND_OFFSET, EFI_DISABLE_REGISTER, NULL)
162
163 #define PciReadBridgeControlRegister(a,b) \
164 PciOperateRegister (a,0, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_GET_REGISTER, b)
165
166 #define PciSetBridgeControlRegister(a,b) \
167 PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_SET_REGISTER, NULL)
168
169 #define PciEnableBridgeControlRegister(a,b) \
170 PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_ENABLE_REGISTER, NULL)
171
172 #define PciDisableBridgeControlRegister(a,b) \
173 PciOperateRegister (a,b, PCI_BRIDGE_CONTROL_REGISTER_OFFSET, EFI_DISABLE_REGISTER, NULL)
174
175 #endif