@@ -86,37 +86,50 @@ bool HyperVPCIBridge::configure(IOService *provider) {
86
86
}
87
87
88
88
UInt32 HyperVPCIBridge::configRead32 (IOPCIAddressSpace space, UInt8 offset) {
89
- HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset);
90
-
89
+ UInt32 offset32 = offset | (space.es .registerNumExtended << 8 );
90
+ HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset32);
91
+
91
92
if (space.es .deviceNum != 0 || space.es .functionNum != 0 ) {
92
93
return 0xFFFFFFFF ;
93
94
}
94
-
95
- return readPCIConfig (offset, sizeof (UInt32 ));
95
+
96
+ //
97
+ // Perform 32-bit extended read.
98
+ //
99
+ return readPCIConfig (offset32, sizeof (UInt32 ));
96
100
}
97
101
98
102
void HyperVPCIBridge::configWrite32 (IOPCIAddressSpace space, UInt8 offset, UInt32 data) {
99
- HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset);
100
-
103
+ UInt32 offset32 = offset | (space.es .registerNumExtended << 8 );
104
+ HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset32);
105
+
101
106
if (space.es .deviceNum != 0 || space.es .functionNum != 0 ) {
102
107
return ;
103
108
}
104
-
105
- writePCIConfig (offset, sizeof (UInt32 ), data);
109
+
110
+ //
111
+ // Perform 32-bit extended write.
112
+ //
113
+ writePCIConfig (offset32, sizeof (UInt32 ), data);
106
114
}
107
115
108
116
UInt16 HyperVPCIBridge::configRead16 (IOPCIAddressSpace space, UInt8 offset) {
109
- HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset);
110
-
117
+ UInt32 offset32 = offset | (space.es .registerNumExtended << 8 );
118
+ HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset32);
119
+
111
120
if (space.es .deviceNum != 0 || space.es .functionNum != 0 ) {
112
121
return 0xFFFF ;
113
122
}
114
-
115
- return (UInt16 )readPCIConfig (offset, sizeof (UInt16 ));
123
+
124
+ //
125
+ // Perform 16-bit extended read.
126
+ //
127
+ return (UInt16 )readPCIConfig (offset32, sizeof (UInt16 ));
116
128
}
117
129
118
130
void HyperVPCIBridge::configWrite16 (IOPCIAddressSpace space, UInt8 offset, UInt16 data) {
119
- HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset);
131
+ UInt32 offset32 = offset | (space.es .registerNumExtended << 8 );
132
+ HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset32);
120
133
121
134
if (space.es .deviceNum != 0 || space.es .functionNum != 0 ) {
122
135
return ;
@@ -126,7 +139,7 @@ void HyperVPCIBridge::configWrite16(IOPCIAddressSpace space, UInt8 offset, UInt1
126
139
// Hook writes to MSI or MSI-X control register.
127
140
// This is the final step in configuring interrupts by IOPCIFamily.
128
141
//
129
- if (!interruptConfigured && offset == msiCap + 0x2 && data & 0x1 ) {
142
+ if (!interruptConfigured && offset32 == msiCap + 0x2 && data & 0x1 ) {
130
143
HVDBGLOG (" Original value: 0x%X" , data);
131
144
132
145
if (isMsiX) {
@@ -163,28 +176,39 @@ void HyperVPCIBridge::configWrite16(IOPCIAddressSpace space, UInt8 offset, UInt1
163
176
interruptConfigured = true ;
164
177
}
165
178
} else {
166
- writePCIConfig (offset, sizeof (UInt16 ), data);
179
+ //
180
+ // Perform 16-bit extended write.
181
+ //
182
+ writePCIConfig (offset32, sizeof (UInt16 ), data);
167
183
}
168
184
}
169
185
170
186
UInt8 HyperVPCIBridge::configRead8 (IOPCIAddressSpace space, UInt8 offset) {
171
- HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset);
172
-
187
+ UInt32 offset32 = offset | (space.es .registerNumExtended << 8 );
188
+ HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset32);
189
+
173
190
if (space.es .deviceNum != 0 || space.es .functionNum != 0 ) {
174
191
return 0xFF ;
175
192
}
176
-
177
- return (UInt8 )readPCIConfig (offset, sizeof (UInt8 ));
193
+
194
+ //
195
+ // Perform 8-bit extended read.
196
+ //
197
+ return (UInt8 )readPCIConfig (offset32, sizeof (UInt8 ));
178
198
}
179
199
180
200
void HyperVPCIBridge::configWrite8 (IOPCIAddressSpace space, UInt8 offset, UInt8 data) {
181
- HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset);
182
-
201
+ UInt32 offset32 = offset | (space.es .registerNumExtended << 8 );
202
+ HVDBGLOG (" Bus: %u, device: %u, function: %u, offset %X" , space.es .busNum , space.es .deviceNum , space.es .functionNum , offset32);
203
+
183
204
if (space.es .deviceNum != 0 || space.es .functionNum != 0 ) {
184
205
return ;
185
206
}
186
-
187
- writePCIConfig (offset, sizeof (UInt8 ), data);
207
+
208
+ //
209
+ // Perform 8-bit extended write.
210
+ //
211
+ writePCIConfig (offset32, sizeof (UInt8 ), data);
188
212
}
189
213
190
214
bool HyperVPCIBridge::publishNub (IOPCIDevice *nub, UInt32 index) {
0 commit comments