diff options
Diffstat (limited to 'drivers/pnp/pnpbios/bioscalls.c')
-rw-r--r-- | drivers/pnp/pnpbios/bioscalls.c | 282 |
1 files changed, 156 insertions, 126 deletions
diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c index a1f0b0ba2bfe..d546f79d4d3b 100644 --- a/drivers/pnp/pnpbios/bioscalls.c +++ b/drivers/pnp/pnpbios/bioscalls.c | |||
@@ -26,11 +26,10 @@ | |||
26 | #include "pnpbios.h" | 26 | #include "pnpbios.h" |
27 | 27 | ||
28 | static struct { | 28 | static struct { |
29 | u16 offset; | 29 | u16 offset; |
30 | u16 segment; | 30 | u16 segment; |
31 | } pnp_bios_callpoint; | 31 | } pnp_bios_callpoint; |
32 | 32 | ||
33 | |||
34 | /* | 33 | /* |
35 | * These are some opcodes for a "static asmlinkage" | 34 | * These are some opcodes for a "static asmlinkage" |
36 | * As this code is *not* executed inside the linux kernel segment, but in a | 35 | * As this code is *not* executed inside the linux kernel segment, but in a |
@@ -44,8 +43,7 @@ static struct { | |||
44 | 43 | ||
45 | asmlinkage void pnp_bios_callfunc(void); | 44 | asmlinkage void pnp_bios_callfunc(void); |
46 | 45 | ||
47 | __asm__( | 46 | __asm__(".text \n" |
48 | ".text \n" | ||
49 | __ALIGN_STR "\n" | 47 | __ALIGN_STR "\n" |
50 | "pnp_bios_callfunc:\n" | 48 | "pnp_bios_callfunc:\n" |
51 | " pushl %edx \n" | 49 | " pushl %edx \n" |
@@ -54,9 +52,7 @@ __asm__( | |||
54 | " pushl %eax \n" | 52 | " pushl %eax \n" |
55 | " lcallw *pnp_bios_callpoint\n" | 53 | " lcallw *pnp_bios_callpoint\n" |
56 | " addl $16, %esp \n" | 54 | " addl $16, %esp \n" |
57 | " lret \n" | 55 | " lret \n" ".previous \n"); |
58 | ".previous \n" | ||
59 | ); | ||
60 | 56 | ||
61 | #define Q2_SET_SEL(cpu, selname, address, size) \ | 57 | #define Q2_SET_SEL(cpu, selname, address, size) \ |
62 | do { \ | 58 | do { \ |
@@ -78,7 +74,6 @@ u32 pnp_bios_is_utter_crap = 0; | |||
78 | 74 | ||
79 | static spinlock_t pnp_bios_lock; | 75 | static spinlock_t pnp_bios_lock; |
80 | 76 | ||
81 | |||
82 | /* | 77 | /* |
83 | * Support Functions | 78 | * Support Functions |
84 | */ | 79 | */ |
@@ -97,7 +92,7 @@ static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3, | |||
97 | * PnP BIOSes are generally not terribly re-entrant. | 92 | * PnP BIOSes are generally not terribly re-entrant. |
98 | * Also, don't rely on them to save everything correctly. | 93 | * Also, don't rely on them to save everything correctly. |
99 | */ | 94 | */ |
100 | if(pnp_bios_is_utter_crap) | 95 | if (pnp_bios_is_utter_crap) |
101 | return PNP_FUNCTION_NOT_SUPPORTED; | 96 | return PNP_FUNCTION_NOT_SUPPORTED; |
102 | 97 | ||
103 | cpu = get_cpu(); | 98 | cpu = get_cpu(); |
@@ -113,112 +108,127 @@ static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3, | |||
113 | if (ts2_size) | 108 | if (ts2_size) |
114 | Q2_SET_SEL(smp_processor_id(), PNP_TS2, ts2_base, ts2_size); | 109 | Q2_SET_SEL(smp_processor_id(), PNP_TS2, ts2_base, ts2_size); |
115 | 110 | ||
116 | __asm__ __volatile__( | 111 | __asm__ __volatile__("pushl %%ebp\n\t" |
117 | "pushl %%ebp\n\t" | 112 | "pushl %%edi\n\t" |
118 | "pushl %%edi\n\t" | 113 | "pushl %%esi\n\t" |
119 | "pushl %%esi\n\t" | 114 | "pushl %%ds\n\t" |
120 | "pushl %%ds\n\t" | 115 | "pushl %%es\n\t" |
121 | "pushl %%es\n\t" | 116 | "pushl %%fs\n\t" |
122 | "pushl %%fs\n\t" | 117 | "pushl %%gs\n\t" |
123 | "pushl %%gs\n\t" | 118 | "pushfl\n\t" |
124 | "pushfl\n\t" | 119 | "movl %%esp, pnp_bios_fault_esp\n\t" |
125 | "movl %%esp, pnp_bios_fault_esp\n\t" | 120 | "movl $1f, pnp_bios_fault_eip\n\t" |
126 | "movl $1f, pnp_bios_fault_eip\n\t" | 121 | "lcall %5,%6\n\t" |
127 | "lcall %5,%6\n\t" | 122 | "1:popfl\n\t" |
128 | "1:popfl\n\t" | 123 | "popl %%gs\n\t" |
129 | "popl %%gs\n\t" | 124 | "popl %%fs\n\t" |
130 | "popl %%fs\n\t" | 125 | "popl %%es\n\t" |
131 | "popl %%es\n\t" | 126 | "popl %%ds\n\t" |
132 | "popl %%ds\n\t" | 127 | "popl %%esi\n\t" |
133 | "popl %%esi\n\t" | 128 | "popl %%edi\n\t" "popl %%ebp\n\t":"=a"(status) |
134 | "popl %%edi\n\t" | 129 | :"0"((func) | (((u32) arg1) << 16)), |
135 | "popl %%ebp\n\t" | 130 | "b"((arg2) | (((u32) arg3) << 16)), |
136 | : "=a" (status) | 131 | "c"((arg4) | (((u32) arg5) << 16)), |
137 | : "0" ((func) | (((u32)arg1) << 16)), | 132 | "d"((arg6) | (((u32) arg7) << 16)), |
138 | "b" ((arg2) | (((u32)arg3) << 16)), | 133 | "i"(PNP_CS32), "i"(0) |
139 | "c" ((arg4) | (((u32)arg5) << 16)), | 134 | :"memory"); |
140 | "d" ((arg6) | (((u32)arg7) << 16)), | ||
141 | "i" (PNP_CS32), | ||
142 | "i" (0) | ||
143 | : "memory" | ||
144 | ); | ||
145 | spin_unlock_irqrestore(&pnp_bios_lock, flags); | 135 | spin_unlock_irqrestore(&pnp_bios_lock, flags); |
146 | 136 | ||
147 | get_cpu_gdt_table(cpu)[0x40 / 8] = save_desc_40; | 137 | get_cpu_gdt_table(cpu)[0x40 / 8] = save_desc_40; |
148 | put_cpu(); | 138 | put_cpu(); |
149 | 139 | ||
150 | /* If we get here and this is set then the PnP BIOS faulted on us. */ | 140 | /* If we get here and this is set then the PnP BIOS faulted on us. */ |
151 | if(pnp_bios_is_utter_crap) | 141 | if (pnp_bios_is_utter_crap) { |
152 | { | 142 | printk(KERN_ERR |
153 | printk(KERN_ERR "PnPBIOS: Warning! Your PnP BIOS caused a fatal error. Attempting to continue\n"); | 143 | "PnPBIOS: Warning! Your PnP BIOS caused a fatal error. Attempting to continue\n"); |
154 | printk(KERN_ERR "PnPBIOS: You may need to reboot with the \"pnpbios=off\" option to operate stably\n"); | 144 | printk(KERN_ERR |
155 | printk(KERN_ERR "PnPBIOS: Check with your vendor for an updated BIOS\n"); | 145 | "PnPBIOS: You may need to reboot with the \"pnpbios=off\" option to operate stably\n"); |
146 | printk(KERN_ERR | ||
147 | "PnPBIOS: Check with your vendor for an updated BIOS\n"); | ||
156 | } | 148 | } |
157 | 149 | ||
158 | return status; | 150 | return status; |
159 | } | 151 | } |
160 | 152 | ||
161 | void pnpbios_print_status(const char * module, u16 status) | 153 | void pnpbios_print_status(const char *module, u16 status) |
162 | { | 154 | { |
163 | switch(status) { | 155 | switch (status) { |
164 | case PNP_SUCCESS: | 156 | case PNP_SUCCESS: |
165 | printk(KERN_ERR "PnPBIOS: %s: function successful\n", module); | 157 | printk(KERN_ERR "PnPBIOS: %s: function successful\n", module); |
166 | break; | 158 | break; |
167 | case PNP_NOT_SET_STATICALLY: | 159 | case PNP_NOT_SET_STATICALLY: |
168 | printk(KERN_ERR "PnPBIOS: %s: unable to set static resources\n", module); | 160 | printk(KERN_ERR "PnPBIOS: %s: unable to set static resources\n", |
161 | module); | ||
169 | break; | 162 | break; |
170 | case PNP_UNKNOWN_FUNCTION: | 163 | case PNP_UNKNOWN_FUNCTION: |
171 | printk(KERN_ERR "PnPBIOS: %s: invalid function number passed\n", module); | 164 | printk(KERN_ERR "PnPBIOS: %s: invalid function number passed\n", |
165 | module); | ||
172 | break; | 166 | break; |
173 | case PNP_FUNCTION_NOT_SUPPORTED: | 167 | case PNP_FUNCTION_NOT_SUPPORTED: |
174 | printk(KERN_ERR "PnPBIOS: %s: function not supported on this system\n", module); | 168 | printk(KERN_ERR |
169 | "PnPBIOS: %s: function not supported on this system\n", | ||
170 | module); | ||
175 | break; | 171 | break; |
176 | case PNP_INVALID_HANDLE: | 172 | case PNP_INVALID_HANDLE: |
177 | printk(KERN_ERR "PnPBIOS: %s: invalid handle\n", module); | 173 | printk(KERN_ERR "PnPBIOS: %s: invalid handle\n", module); |
178 | break; | 174 | break; |
179 | case PNP_BAD_PARAMETER: | 175 | case PNP_BAD_PARAMETER: |
180 | printk(KERN_ERR "PnPBIOS: %s: invalid parameters were passed\n", module); | 176 | printk(KERN_ERR "PnPBIOS: %s: invalid parameters were passed\n", |
177 | module); | ||
181 | break; | 178 | break; |
182 | case PNP_SET_FAILED: | 179 | case PNP_SET_FAILED: |
183 | printk(KERN_ERR "PnPBIOS: %s: unable to set resources\n", module); | 180 | printk(KERN_ERR "PnPBIOS: %s: unable to set resources\n", |
181 | module); | ||
184 | break; | 182 | break; |
185 | case PNP_EVENTS_NOT_PENDING: | 183 | case PNP_EVENTS_NOT_PENDING: |
186 | printk(KERN_ERR "PnPBIOS: %s: no events are pending\n", module); | 184 | printk(KERN_ERR "PnPBIOS: %s: no events are pending\n", module); |
187 | break; | 185 | break; |
188 | case PNP_SYSTEM_NOT_DOCKED: | 186 | case PNP_SYSTEM_NOT_DOCKED: |
189 | printk(KERN_ERR "PnPBIOS: %s: the system is not docked\n", module); | 187 | printk(KERN_ERR "PnPBIOS: %s: the system is not docked\n", |
188 | module); | ||
190 | break; | 189 | break; |
191 | case PNP_NO_ISA_PNP_CARDS: | 190 | case PNP_NO_ISA_PNP_CARDS: |
192 | printk(KERN_ERR "PnPBIOS: %s: no isapnp cards are installed on this system\n", module); | 191 | printk(KERN_ERR |
192 | "PnPBIOS: %s: no isapnp cards are installed on this system\n", | ||
193 | module); | ||
193 | break; | 194 | break; |
194 | case PNP_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES: | 195 | case PNP_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES: |
195 | printk(KERN_ERR "PnPBIOS: %s: cannot determine the capabilities of the docking station\n", module); | 196 | printk(KERN_ERR |
197 | "PnPBIOS: %s: cannot determine the capabilities of the docking station\n", | ||
198 | module); | ||
196 | break; | 199 | break; |
197 | case PNP_CONFIG_CHANGE_FAILED_NO_BATTERY: | 200 | case PNP_CONFIG_CHANGE_FAILED_NO_BATTERY: |
198 | printk(KERN_ERR "PnPBIOS: %s: unable to undock, the system does not have a battery\n", module); | 201 | printk(KERN_ERR |
202 | "PnPBIOS: %s: unable to undock, the system does not have a battery\n", | ||
203 | module); | ||
199 | break; | 204 | break; |
200 | case PNP_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT: | 205 | case PNP_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT: |
201 | printk(KERN_ERR "PnPBIOS: %s: could not dock due to resource conflicts\n", module); | 206 | printk(KERN_ERR |
207 | "PnPBIOS: %s: could not dock due to resource conflicts\n", | ||
208 | module); | ||
202 | break; | 209 | break; |
203 | case PNP_BUFFER_TOO_SMALL: | 210 | case PNP_BUFFER_TOO_SMALL: |
204 | printk(KERN_ERR "PnPBIOS: %s: the buffer passed is too small\n", module); | 211 | printk(KERN_ERR "PnPBIOS: %s: the buffer passed is too small\n", |
212 | module); | ||
205 | break; | 213 | break; |
206 | case PNP_USE_ESCD_SUPPORT: | 214 | case PNP_USE_ESCD_SUPPORT: |
207 | printk(KERN_ERR "PnPBIOS: %s: use ESCD instead\n", module); | 215 | printk(KERN_ERR "PnPBIOS: %s: use ESCD instead\n", module); |
208 | break; | 216 | break; |
209 | case PNP_MESSAGE_NOT_SUPPORTED: | 217 | case PNP_MESSAGE_NOT_SUPPORTED: |
210 | printk(KERN_ERR "PnPBIOS: %s: the message is unsupported\n", module); | 218 | printk(KERN_ERR "PnPBIOS: %s: the message is unsupported\n", |
219 | module); | ||
211 | break; | 220 | break; |
212 | case PNP_HARDWARE_ERROR: | 221 | case PNP_HARDWARE_ERROR: |
213 | printk(KERN_ERR "PnPBIOS: %s: a hardware failure has occured\n", module); | 222 | printk(KERN_ERR "PnPBIOS: %s: a hardware failure has occured\n", |
223 | module); | ||
214 | break; | 224 | break; |
215 | default: | 225 | default: |
216 | printk(KERN_ERR "PnPBIOS: %s: unexpected status 0x%x\n", module, status); | 226 | printk(KERN_ERR "PnPBIOS: %s: unexpected status 0x%x\n", module, |
227 | status); | ||
217 | break; | 228 | break; |
218 | } | 229 | } |
219 | } | 230 | } |
220 | 231 | ||
221 | |||
222 | /* | 232 | /* |
223 | * PnP BIOS Low Level Calls | 233 | * PnP BIOS Low Level Calls |
224 | */ | 234 | */ |
@@ -245,17 +255,19 @@ static int __pnp_bios_dev_node_info(struct pnp_dev_node_info *data) | |||
245 | u16 status; | 255 | u16 status; |
246 | if (!pnp_bios_present()) | 256 | if (!pnp_bios_present()) |
247 | return PNP_FUNCTION_NOT_SUPPORTED; | 257 | return PNP_FUNCTION_NOT_SUPPORTED; |
248 | status = call_pnp_bios(PNP_GET_NUM_SYS_DEV_NODES, 0, PNP_TS1, 2, PNP_TS1, PNP_DS, 0, 0, | 258 | status = |
249 | data, sizeof(struct pnp_dev_node_info), NULL, 0); | 259 | call_pnp_bios(PNP_GET_NUM_SYS_DEV_NODES, 0, PNP_TS1, 2, PNP_TS1, |
260 | PNP_DS, 0, 0, data, sizeof(struct pnp_dev_node_info), | ||
261 | NULL, 0); | ||
250 | data->no_nodes &= 0xff; | 262 | data->no_nodes &= 0xff; |
251 | return status; | 263 | return status; |
252 | } | 264 | } |
253 | 265 | ||
254 | int pnp_bios_dev_node_info(struct pnp_dev_node_info *data) | 266 | int pnp_bios_dev_node_info(struct pnp_dev_node_info *data) |
255 | { | 267 | { |
256 | int status = __pnp_bios_dev_node_info( data ); | 268 | int status = __pnp_bios_dev_node_info(data); |
257 | if ( status ) | 269 | if (status) |
258 | pnpbios_print_status( "dev_node_info", status ); | 270 | pnpbios_print_status("dev_node_info", status); |
259 | return status; | 271 | return status; |
260 | } | 272 | } |
261 | 273 | ||
@@ -273,60 +285,64 @@ int pnp_bios_dev_node_info(struct pnp_dev_node_info *data) | |||
273 | * or volatile current (0) config | 285 | * or volatile current (0) config |
274 | * Output: *nodenum=next node or 0xff if no more nodes | 286 | * Output: *nodenum=next node or 0xff if no more nodes |
275 | */ | 287 | */ |
276 | static int __pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data) | 288 | static int __pnp_bios_get_dev_node(u8 * nodenum, char boot, |
289 | struct pnp_bios_node *data) | ||
277 | { | 290 | { |
278 | u16 status; | 291 | u16 status; |
279 | u16 tmp_nodenum; | 292 | u16 tmp_nodenum; |
280 | if (!pnp_bios_present()) | 293 | if (!pnp_bios_present()) |
281 | return PNP_FUNCTION_NOT_SUPPORTED; | 294 | return PNP_FUNCTION_NOT_SUPPORTED; |
282 | if ( !boot && pnpbios_dont_use_current_config ) | 295 | if (!boot && pnpbios_dont_use_current_config) |
283 | return PNP_FUNCTION_NOT_SUPPORTED; | 296 | return PNP_FUNCTION_NOT_SUPPORTED; |
284 | tmp_nodenum = *nodenum; | 297 | tmp_nodenum = *nodenum; |
285 | status = call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2, boot ? 2 : 1, PNP_DS, 0, | 298 | status = |
286 | &tmp_nodenum, sizeof(tmp_nodenum), data, 65536); | 299 | call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2, |
300 | boot ? 2 : 1, PNP_DS, 0, &tmp_nodenum, | ||
301 | sizeof(tmp_nodenum), data, 65536); | ||
287 | *nodenum = tmp_nodenum; | 302 | *nodenum = tmp_nodenum; |
288 | return status; | 303 | return status; |
289 | } | 304 | } |
290 | 305 | ||
291 | int pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data) | 306 | int pnp_bios_get_dev_node(u8 * nodenum, char boot, struct pnp_bios_node *data) |
292 | { | 307 | { |
293 | int status; | 308 | int status; |
294 | status = __pnp_bios_get_dev_node( nodenum, boot, data ); | 309 | status = __pnp_bios_get_dev_node(nodenum, boot, data); |
295 | if ( status ) | 310 | if (status) |
296 | pnpbios_print_status( "get_dev_node", status ); | 311 | pnpbios_print_status("get_dev_node", status); |
297 | return status; | 312 | return status; |
298 | } | 313 | } |
299 | 314 | ||
300 | |||
301 | /* | 315 | /* |
302 | * Call PnP BIOS with function 0x02, "set system device node" | 316 | * Call PnP BIOS with function 0x02, "set system device node" |
303 | * Input: *nodenum = desired node, | 317 | * Input: *nodenum = desired node, |
304 | * boot = whether to set nonvolatile boot (!=0) | 318 | * boot = whether to set nonvolatile boot (!=0) |
305 | * or volatile current (0) config | 319 | * or volatile current (0) config |
306 | */ | 320 | */ |
307 | static int __pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data) | 321 | static int __pnp_bios_set_dev_node(u8 nodenum, char boot, |
322 | struct pnp_bios_node *data) | ||
308 | { | 323 | { |
309 | u16 status; | 324 | u16 status; |
310 | if (!pnp_bios_present()) | 325 | if (!pnp_bios_present()) |
311 | return PNP_FUNCTION_NOT_SUPPORTED; | 326 | return PNP_FUNCTION_NOT_SUPPORTED; |
312 | if ( !boot && pnpbios_dont_use_current_config ) | 327 | if (!boot && pnpbios_dont_use_current_config) |
313 | return PNP_FUNCTION_NOT_SUPPORTED; | 328 | return PNP_FUNCTION_NOT_SUPPORTED; |
314 | status = call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1, boot ? 2 : 1, PNP_DS, 0, 0, | 329 | status = |
315 | data, 65536, NULL, 0); | 330 | call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1, |
331 | boot ? 2 : 1, PNP_DS, 0, 0, data, 65536, NULL, 0); | ||
316 | return status; | 332 | return status; |
317 | } | 333 | } |
318 | 334 | ||
319 | int pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data) | 335 | int pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data) |
320 | { | 336 | { |
321 | int status; | 337 | int status; |
322 | status = __pnp_bios_set_dev_node( nodenum, boot, data ); | 338 | status = __pnp_bios_set_dev_node(nodenum, boot, data); |
323 | if ( status ) { | 339 | if (status) { |
324 | pnpbios_print_status( "set_dev_node", status ); | 340 | pnpbios_print_status("set_dev_node", status); |
325 | return status; | 341 | return status; |
326 | } | 342 | } |
327 | if ( !boot ) { /* Update devlist */ | 343 | if (!boot) { /* Update devlist */ |
328 | status = pnp_bios_get_dev_node( &nodenum, boot, data ); | 344 | status = pnp_bios_get_dev_node(&nodenum, boot, data); |
329 | if ( status ) | 345 | if (status) |
330 | return status; | 346 | return status; |
331 | } | 347 | } |
332 | return status; | 348 | return status; |
@@ -336,12 +352,12 @@ int pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data) | |||
336 | /* | 352 | /* |
337 | * Call PnP BIOS with function 0x03, "get event" | 353 | * Call PnP BIOS with function 0x03, "get event" |
338 | */ | 354 | */ |
339 | static int pnp_bios_get_event(u16 *event) | 355 | static int pnp_bios_get_event(u16 * event) |
340 | { | 356 | { |
341 | u16 status; | 357 | u16 status; |
342 | if (!pnp_bios_present()) | 358 | if (!pnp_bios_present()) |
343 | return PNP_FUNCTION_NOT_SUPPORTED; | 359 | return PNP_FUNCTION_NOT_SUPPORTED; |
344 | status = call_pnp_bios(PNP_GET_EVENT, 0, PNP_TS1, PNP_DS, 0, 0 ,0 ,0, | 360 | status = call_pnp_bios(PNP_GET_EVENT, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0, |
345 | event, sizeof(u16), NULL, 0); | 361 | event, sizeof(u16), NULL, 0); |
346 | return status; | 362 | return status; |
347 | } | 363 | } |
@@ -356,7 +372,9 @@ static int pnp_bios_send_message(u16 message) | |||
356 | u16 status; | 372 | u16 status; |
357 | if (!pnp_bios_present()) | 373 | if (!pnp_bios_present()) |
358 | return PNP_FUNCTION_NOT_SUPPORTED; | 374 | return PNP_FUNCTION_NOT_SUPPORTED; |
359 | status = call_pnp_bios(PNP_SEND_MESSAGE, message, PNP_DS, 0, 0, 0, 0, 0, 0, 0, 0, 0); | 375 | status = |
376 | call_pnp_bios(PNP_SEND_MESSAGE, message, PNP_DS, 0, 0, 0, 0, 0, 0, | ||
377 | 0, 0, 0); | ||
360 | return status; | 378 | return status; |
361 | } | 379 | } |
362 | #endif | 380 | #endif |
@@ -369,8 +387,10 @@ int pnp_bios_dock_station_info(struct pnp_docking_station_info *data) | |||
369 | u16 status; | 387 | u16 status; |
370 | if (!pnp_bios_present()) | 388 | if (!pnp_bios_present()) |
371 | return PNP_FUNCTION_NOT_SUPPORTED; | 389 | return PNP_FUNCTION_NOT_SUPPORTED; |
372 | status = call_pnp_bios(PNP_GET_DOCKING_STATION_INFORMATION, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0, | 390 | status = |
373 | data, sizeof(struct pnp_docking_station_info), NULL, 0); | 391 | call_pnp_bios(PNP_GET_DOCKING_STATION_INFORMATION, 0, PNP_TS1, |
392 | PNP_DS, 0, 0, 0, 0, data, | ||
393 | sizeof(struct pnp_docking_station_info), NULL, 0); | ||
374 | return status; | 394 | return status; |
375 | } | 395 | } |
376 | 396 | ||
@@ -384,8 +404,9 @@ static int pnp_bios_set_stat_res(char *info) | |||
384 | u16 status; | 404 | u16 status; |
385 | if (!pnp_bios_present()) | 405 | if (!pnp_bios_present()) |
386 | return PNP_FUNCTION_NOT_SUPPORTED; | 406 | return PNP_FUNCTION_NOT_SUPPORTED; |
387 | status = call_pnp_bios(PNP_SET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0, | 407 | status = |
388 | info, *((u16 *) info), 0, 0); | 408 | call_pnp_bios(PNP_SET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, |
409 | 0, 0, 0, 0, info, *((u16 *) info), 0, 0); | ||
389 | return status; | 410 | return status; |
390 | } | 411 | } |
391 | #endif | 412 | #endif |
@@ -399,17 +420,18 @@ static int __pnp_bios_get_stat_res(char *info) | |||
399 | u16 status; | 420 | u16 status; |
400 | if (!pnp_bios_present()) | 421 | if (!pnp_bios_present()) |
401 | return PNP_FUNCTION_NOT_SUPPORTED; | 422 | return PNP_FUNCTION_NOT_SUPPORTED; |
402 | status = call_pnp_bios(PNP_GET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0, | 423 | status = |
403 | info, 65536, NULL, 0); | 424 | call_pnp_bios(PNP_GET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, |
425 | 0, 0, 0, 0, info, 65536, NULL, 0); | ||
404 | return status; | 426 | return status; |
405 | } | 427 | } |
406 | 428 | ||
407 | int pnp_bios_get_stat_res(char *info) | 429 | int pnp_bios_get_stat_res(char *info) |
408 | { | 430 | { |
409 | int status; | 431 | int status; |
410 | status = __pnp_bios_get_stat_res( info ); | 432 | status = __pnp_bios_get_stat_res(info); |
411 | if ( status ) | 433 | if (status) |
412 | pnpbios_print_status( "get_stat_res", status ); | 434 | pnpbios_print_status("get_stat_res", status); |
413 | return status; | 435 | return status; |
414 | } | 436 | } |
415 | 437 | ||
@@ -417,13 +439,14 @@ int pnp_bios_get_stat_res(char *info) | |||
417 | /* | 439 | /* |
418 | * Call PnP BIOS with function 0x0b, "get APM id table" | 440 | * Call PnP BIOS with function 0x0b, "get APM id table" |
419 | */ | 441 | */ |
420 | static int pnp_bios_apm_id_table(char *table, u16 *size) | 442 | static int pnp_bios_apm_id_table(char *table, u16 * size) |
421 | { | 443 | { |
422 | u16 status; | 444 | u16 status; |
423 | if (!pnp_bios_present()) | 445 | if (!pnp_bios_present()) |
424 | return PNP_FUNCTION_NOT_SUPPORTED; | 446 | return PNP_FUNCTION_NOT_SUPPORTED; |
425 | status = call_pnp_bios(PNP_GET_APM_ID_TABLE, 0, PNP_TS2, 0, PNP_TS1, PNP_DS, 0, 0, | 447 | status = |
426 | table, *size, size, sizeof(u16)); | 448 | call_pnp_bios(PNP_GET_APM_ID_TABLE, 0, PNP_TS2, 0, PNP_TS1, PNP_DS, |
449 | 0, 0, table, *size, size, sizeof(u16)); | ||
427 | return status; | 450 | return status; |
428 | } | 451 | } |
429 | #endif | 452 | #endif |
@@ -436,17 +459,19 @@ static int __pnp_bios_isapnp_config(struct pnp_isa_config_struc *data) | |||
436 | u16 status; | 459 | u16 status; |
437 | if (!pnp_bios_present()) | 460 | if (!pnp_bios_present()) |
438 | return PNP_FUNCTION_NOT_SUPPORTED; | 461 | return PNP_FUNCTION_NOT_SUPPORTED; |
439 | status = call_pnp_bios(PNP_GET_PNP_ISA_CONFIG_STRUC, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0, | 462 | status = |
440 | data, sizeof(struct pnp_isa_config_struc), NULL, 0); | 463 | call_pnp_bios(PNP_GET_PNP_ISA_CONFIG_STRUC, 0, PNP_TS1, PNP_DS, 0, |
464 | 0, 0, 0, data, sizeof(struct pnp_isa_config_struc), | ||
465 | NULL, 0); | ||
441 | return status; | 466 | return status; |
442 | } | 467 | } |
443 | 468 | ||
444 | int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data) | 469 | int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data) |
445 | { | 470 | { |
446 | int status; | 471 | int status; |
447 | status = __pnp_bios_isapnp_config( data ); | 472 | status = __pnp_bios_isapnp_config(data); |
448 | if ( status ) | 473 | if (status) |
449 | pnpbios_print_status( "isapnp_config", status ); | 474 | pnpbios_print_status("isapnp_config", status); |
450 | return status; | 475 | return status; |
451 | } | 476 | } |
452 | 477 | ||
@@ -458,17 +483,19 @@ static int __pnp_bios_escd_info(struct escd_info_struc *data) | |||
458 | u16 status; | 483 | u16 status; |
459 | if (!pnp_bios_present()) | 484 | if (!pnp_bios_present()) |
460 | return ESCD_FUNCTION_NOT_SUPPORTED; | 485 | return ESCD_FUNCTION_NOT_SUPPORTED; |
461 | status = call_pnp_bios(PNP_GET_ESCD_INFO, 0, PNP_TS1, 2, PNP_TS1, 4, PNP_TS1, PNP_DS, | 486 | status = |
462 | data, sizeof(struct escd_info_struc), NULL, 0); | 487 | call_pnp_bios(PNP_GET_ESCD_INFO, 0, PNP_TS1, 2, PNP_TS1, 4, PNP_TS1, |
488 | PNP_DS, data, sizeof(struct escd_info_struc), NULL, | ||
489 | 0); | ||
463 | return status; | 490 | return status; |
464 | } | 491 | } |
465 | 492 | ||
466 | int pnp_bios_escd_info(struct escd_info_struc *data) | 493 | int pnp_bios_escd_info(struct escd_info_struc *data) |
467 | { | 494 | { |
468 | int status; | 495 | int status; |
469 | status = __pnp_bios_escd_info( data ); | 496 | status = __pnp_bios_escd_info(data); |
470 | if ( status ) | 497 | if (status) |
471 | pnpbios_print_status( "escd_info", status ); | 498 | pnpbios_print_status("escd_info", status); |
472 | return status; | 499 | return status; |
473 | } | 500 | } |
474 | 501 | ||
@@ -481,17 +508,18 @@ static int __pnp_bios_read_escd(char *data, u32 nvram_base) | |||
481 | u16 status; | 508 | u16 status; |
482 | if (!pnp_bios_present()) | 509 | if (!pnp_bios_present()) |
483 | return ESCD_FUNCTION_NOT_SUPPORTED; | 510 | return ESCD_FUNCTION_NOT_SUPPORTED; |
484 | status = call_pnp_bios(PNP_READ_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0, | 511 | status = |
485 | data, 65536, __va(nvram_base), 65536); | 512 | call_pnp_bios(PNP_READ_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0, |
513 | data, 65536, __va(nvram_base), 65536); | ||
486 | return status; | 514 | return status; |
487 | } | 515 | } |
488 | 516 | ||
489 | int pnp_bios_read_escd(char *data, u32 nvram_base) | 517 | int pnp_bios_read_escd(char *data, u32 nvram_base) |
490 | { | 518 | { |
491 | int status; | 519 | int status; |
492 | status = __pnp_bios_read_escd( data, nvram_base ); | 520 | status = __pnp_bios_read_escd(data, nvram_base); |
493 | if ( status ) | 521 | if (status) |
494 | pnpbios_print_status( "read_escd", status ); | 522 | pnpbios_print_status("read_escd", status); |
495 | return status; | 523 | return status; |
496 | } | 524 | } |
497 | 525 | ||
@@ -504,13 +532,13 @@ static int pnp_bios_write_escd(char *data, u32 nvram_base) | |||
504 | u16 status; | 532 | u16 status; |
505 | if (!pnp_bios_present()) | 533 | if (!pnp_bios_present()) |
506 | return ESCD_FUNCTION_NOT_SUPPORTED; | 534 | return ESCD_FUNCTION_NOT_SUPPORTED; |
507 | status = call_pnp_bios(PNP_WRITE_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0, | 535 | status = |
508 | data, 65536, __va(nvram_base), 65536); | 536 | call_pnp_bios(PNP_WRITE_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0, |
537 | data, 65536, __va(nvram_base), 65536); | ||
509 | return status; | 538 | return status; |
510 | } | 539 | } |
511 | #endif | 540 | #endif |
512 | 541 | ||
513 | |||
514 | /* | 542 | /* |
515 | * Initialization | 543 | * Initialization |
516 | */ | 544 | */ |
@@ -524,12 +552,14 @@ void pnpbios_calls_init(union pnp_bios_install_struct *header) | |||
524 | 552 | ||
525 | set_base(bad_bios_desc, __va((unsigned long)0x40 << 4)); | 553 | set_base(bad_bios_desc, __va((unsigned long)0x40 << 4)); |
526 | _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4)); | 554 | _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4)); |
527 | for (i = 0; i < NR_CPUS; i++) { | 555 | for (i = 0; i < NR_CPUS; i++) { |
528 | struct desc_struct *gdt = get_cpu_gdt_table(i); | 556 | struct desc_struct *gdt = get_cpu_gdt_table(i); |
529 | if (!gdt) | 557 | if (!gdt) |
530 | continue; | 558 | continue; |
531 | set_base(gdt[GDT_ENTRY_PNPBIOS_CS32], &pnp_bios_callfunc); | 559 | set_base(gdt[GDT_ENTRY_PNPBIOS_CS32], &pnp_bios_callfunc); |
532 | set_base(gdt[GDT_ENTRY_PNPBIOS_CS16], __va(header->fields.pm16cseg)); | 560 | set_base(gdt[GDT_ENTRY_PNPBIOS_CS16], |
533 | set_base(gdt[GDT_ENTRY_PNPBIOS_DS], __va(header->fields.pm16dseg)); | 561 | __va(header->fields.pm16cseg)); |
534 | } | 562 | set_base(gdt[GDT_ENTRY_PNPBIOS_DS], |
563 | __va(header->fields.pm16dseg)); | ||
564 | } | ||
535 | } | 565 | } |