aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel/firmware.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/parisc/kernel/firmware.c')
-rw-r--r--arch/parisc/kernel/firmware.c250
1 files changed, 154 insertions, 96 deletions
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index c2531ae032cf..9158b707c0dd 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -160,13 +160,14 @@ void __init set_firmware_width(void)
160{ 160{
161#ifdef __LP64__ 161#ifdef __LP64__
162 int retval; 162 int retval;
163 unsigned long flags;
163 164
164 spin_lock_irq(&pdc_lock); 165 spin_lock_irqsave(&pdc_lock, flags);
165 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0); 166 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0);
166 convert_to_wide(pdc_result); 167 convert_to_wide(pdc_result);
167 if(pdc_result[0] != NARROW_FIRMWARE) 168 if(pdc_result[0] != NARROW_FIRMWARE)
168 parisc_narrow_firmware = 0; 169 parisc_narrow_firmware = 0;
169 spin_unlock_irq(&pdc_lock); 170 spin_unlock_irqrestore(&pdc_lock, flags);
170#endif 171#endif
171} 172}
172 173
@@ -196,10 +197,11 @@ void pdc_emergency_unlock(void)
196int pdc_add_valid(unsigned long address) 197int pdc_add_valid(unsigned long address)
197{ 198{
198 int retval; 199 int retval;
200 unsigned long flags;
199 201
200 spin_lock_irq(&pdc_lock); 202 spin_lock_irqsave(&pdc_lock, flags);
201 retval = mem_pdc_call(PDC_ADD_VALID, PDC_ADD_VALID_VERIFY, address); 203 retval = mem_pdc_call(PDC_ADD_VALID, PDC_ADD_VALID_VERIFY, address);
202 spin_unlock_irq(&pdc_lock); 204 spin_unlock_irqrestore(&pdc_lock, flags);
203 205
204 return retval; 206 return retval;
205} 207}
@@ -216,15 +218,16 @@ EXPORT_SYMBOL(pdc_add_valid);
216int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len) 218int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len)
217{ 219{
218 int retval; 220 int retval;
221 unsigned long flags;
219 222
220 spin_lock_irq(&pdc_lock); 223 spin_lock_irqsave(&pdc_lock, flags);
221 memcpy(&pdc_result, chassis_info, sizeof(*chassis_info)); 224 memcpy(&pdc_result, chassis_info, sizeof(*chassis_info));
222 memcpy(&pdc_result2, led_info, len); 225 memcpy(&pdc_result2, led_info, len);
223 retval = mem_pdc_call(PDC_CHASSIS, PDC_RETURN_CHASSIS_INFO, 226 retval = mem_pdc_call(PDC_CHASSIS, PDC_RETURN_CHASSIS_INFO,
224 __pa(pdc_result), __pa(pdc_result2), len); 227 __pa(pdc_result), __pa(pdc_result2), len);
225 memcpy(chassis_info, pdc_result, sizeof(*chassis_info)); 228 memcpy(chassis_info, pdc_result, sizeof(*chassis_info));
226 memcpy(led_info, pdc_result2, len); 229 memcpy(led_info, pdc_result2, len);
227 spin_unlock_irq(&pdc_lock); 230 spin_unlock_irqrestore(&pdc_lock, flags);
228 231
229 return retval; 232 return retval;
230} 233}
@@ -239,13 +242,14 @@ int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_inf
239int pdc_pat_chassis_send_log(unsigned long state, unsigned long data) 242int pdc_pat_chassis_send_log(unsigned long state, unsigned long data)
240{ 243{
241 int retval = 0; 244 int retval = 0;
245 unsigned long flags;
242 246
243 if (!is_pdc_pat()) 247 if (!is_pdc_pat())
244 return -1; 248 return -1;
245 249
246 spin_lock_irq(&pdc_lock); 250 spin_lock_irqsave(&pdc_lock, flags);
247 retval = mem_pdc_call(PDC_PAT_CHASSIS_LOG, PDC_PAT_CHASSIS_WRITE_LOG, __pa(&state), __pa(&data)); 251 retval = mem_pdc_call(PDC_PAT_CHASSIS_LOG, PDC_PAT_CHASSIS_WRITE_LOG, __pa(&state), __pa(&data));
248 spin_unlock_irq(&pdc_lock); 252 spin_unlock_irqrestore(&pdc_lock, flags);
249 253
250 return retval; 254 return retval;
251} 255}
@@ -258,10 +262,11 @@ int pdc_pat_chassis_send_log(unsigned long state, unsigned long data)
258int pdc_chassis_disp(unsigned long disp) 262int pdc_chassis_disp(unsigned long disp)
259{ 263{
260 int retval = 0; 264 int retval = 0;
265 unsigned long flags;
261 266
262 spin_lock_irq(&pdc_lock); 267 spin_lock_irqsave(&pdc_lock, flags);
263 retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_DISP, disp); 268 retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_DISP, disp);
264 spin_unlock_irq(&pdc_lock); 269 spin_unlock_irqrestore(&pdc_lock, flags);
265 270
266 return retval; 271 return retval;
267} 272}
@@ -273,11 +278,12 @@ int pdc_chassis_disp(unsigned long disp)
273int pdc_chassis_warn(unsigned long *warn) 278int pdc_chassis_warn(unsigned long *warn)
274{ 279{
275 int retval = 0; 280 int retval = 0;
281 unsigned long flags;
276 282
277 spin_lock_irq(&pdc_lock); 283 spin_lock_irqsave(&pdc_lock, flags);
278 retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_WARN, __pa(pdc_result)); 284 retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_WARN, __pa(pdc_result));
279 *warn = pdc_result[0]; 285 *warn = pdc_result[0];
280 spin_unlock_irq(&pdc_lock); 286 spin_unlock_irqrestore(&pdc_lock, flags);
281 287
282 return retval; 288 return retval;
283} 289}
@@ -292,15 +298,16 @@ int pdc_chassis_warn(unsigned long *warn)
292int __init pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info) 298int __init pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info)
293{ 299{
294 int retval; 300 int retval;
301 unsigned long flags;
295 302
296 spin_lock_irq(&pdc_lock); 303 spin_lock_irqsave(&pdc_lock, flags);
297 retval = mem_pdc_call(PDC_COPROC, PDC_COPROC_CFG, __pa(pdc_result)); 304 retval = mem_pdc_call(PDC_COPROC, PDC_COPROC_CFG, __pa(pdc_result));
298 convert_to_wide(pdc_result); 305 convert_to_wide(pdc_result);
299 pdc_coproc_info->ccr_functional = pdc_result[0]; 306 pdc_coproc_info->ccr_functional = pdc_result[0];
300 pdc_coproc_info->ccr_present = pdc_result[1]; 307 pdc_coproc_info->ccr_present = pdc_result[1];
301 pdc_coproc_info->revision = pdc_result[17]; 308 pdc_coproc_info->revision = pdc_result[17];
302 pdc_coproc_info->model = pdc_result[18]; 309 pdc_coproc_info->model = pdc_result[18];
303 spin_unlock_irq(&pdc_lock); 310 spin_unlock_irqrestore(&pdc_lock, flags);
304 311
305 return retval; 312 return retval;
306} 313}
@@ -320,14 +327,15 @@ int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
320 void *iodc_data, unsigned int iodc_data_size) 327 void *iodc_data, unsigned int iodc_data_size)
321{ 328{
322 int retval; 329 int retval;
330 unsigned long flags;
323 331
324 spin_lock_irq(&pdc_lock); 332 spin_lock_irqsave(&pdc_lock, flags);
325 retval = mem_pdc_call(PDC_IODC, PDC_IODC_READ, __pa(pdc_result), hpa, 333 retval = mem_pdc_call(PDC_IODC, PDC_IODC_READ, __pa(pdc_result), hpa,
326 index, __pa(pdc_result2), iodc_data_size); 334 index, __pa(pdc_result2), iodc_data_size);
327 convert_to_wide(pdc_result); 335 convert_to_wide(pdc_result);
328 *actcnt = pdc_result[0]; 336 *actcnt = pdc_result[0];
329 memcpy(iodc_data, pdc_result2, iodc_data_size); 337 memcpy(iodc_data, pdc_result2, iodc_data_size);
330 spin_unlock_irq(&pdc_lock); 338 spin_unlock_irqrestore(&pdc_lock, flags);
331 339
332 return retval; 340 return retval;
333} 341}
@@ -346,14 +354,15 @@ int pdc_system_map_find_mods(struct pdc_system_map_mod_info *pdc_mod_info,
346 struct pdc_module_path *mod_path, long mod_index) 354 struct pdc_module_path *mod_path, long mod_index)
347{ 355{
348 int retval; 356 int retval;
357 unsigned long flags;
349 358
350 spin_lock_irq(&pdc_lock); 359 spin_lock_irqsave(&pdc_lock, flags);
351 retval = mem_pdc_call(PDC_SYSTEM_MAP, PDC_FIND_MODULE, __pa(pdc_result), 360 retval = mem_pdc_call(PDC_SYSTEM_MAP, PDC_FIND_MODULE, __pa(pdc_result),
352 __pa(pdc_result2), mod_index); 361 __pa(pdc_result2), mod_index);
353 convert_to_wide(pdc_result); 362 convert_to_wide(pdc_result);
354 memcpy(pdc_mod_info, pdc_result, sizeof(*pdc_mod_info)); 363 memcpy(pdc_mod_info, pdc_result, sizeof(*pdc_mod_info));
355 memcpy(mod_path, pdc_result2, sizeof(*mod_path)); 364 memcpy(mod_path, pdc_result2, sizeof(*mod_path));
356 spin_unlock_irq(&pdc_lock); 365 spin_unlock_irqrestore(&pdc_lock, flags);
357 366
358 pdc_mod_info->mod_addr = f_extend(pdc_mod_info->mod_addr); 367 pdc_mod_info->mod_addr = f_extend(pdc_mod_info->mod_addr);
359 return retval; 368 return retval;
@@ -372,13 +381,14 @@ int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info,
372 long mod_index, long addr_index) 381 long mod_index, long addr_index)
373{ 382{
374 int retval; 383 int retval;
384 unsigned long flags;
375 385
376 spin_lock_irq(&pdc_lock); 386 spin_lock_irqsave(&pdc_lock, flags);
377 retval = mem_pdc_call(PDC_SYSTEM_MAP, PDC_FIND_ADDRESS, __pa(pdc_result), 387 retval = mem_pdc_call(PDC_SYSTEM_MAP, PDC_FIND_ADDRESS, __pa(pdc_result),
378 mod_index, addr_index); 388 mod_index, addr_index);
379 convert_to_wide(pdc_result); 389 convert_to_wide(pdc_result);
380 memcpy(pdc_addr_info, pdc_result, sizeof(*pdc_addr_info)); 390 memcpy(pdc_addr_info, pdc_result, sizeof(*pdc_addr_info));
381 spin_unlock_irq(&pdc_lock); 391 spin_unlock_irqrestore(&pdc_lock, flags);
382 392
383 pdc_addr_info->mod_addr = f_extend(pdc_addr_info->mod_addr); 393 pdc_addr_info->mod_addr = f_extend(pdc_addr_info->mod_addr);
384 return retval; 394 return retval;
@@ -393,12 +403,13 @@ int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info,
393int pdc_model_info(struct pdc_model *model) 403int pdc_model_info(struct pdc_model *model)
394{ 404{
395 int retval; 405 int retval;
406 unsigned long flags;
396 407
397 spin_lock_irq(&pdc_lock); 408 spin_lock_irqsave(&pdc_lock, flags);
398 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_INFO, __pa(pdc_result), 0); 409 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_INFO, __pa(pdc_result), 0);
399 convert_to_wide(pdc_result); 410 convert_to_wide(pdc_result);
400 memcpy(model, pdc_result, sizeof(*model)); 411 memcpy(model, pdc_result, sizeof(*model));
401 spin_unlock_irq(&pdc_lock); 412 spin_unlock_irqrestore(&pdc_lock, flags);
402 413
403 return retval; 414 return retval;
404} 415}
@@ -414,8 +425,9 @@ int pdc_model_info(struct pdc_model *model)
414int pdc_model_sysmodel(char *name) 425int pdc_model_sysmodel(char *name)
415{ 426{
416 int retval; 427 int retval;
428 unsigned long flags;
417 429
418 spin_lock_irq(&pdc_lock); 430 spin_lock_irqsave(&pdc_lock, flags);
419 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_SYSMODEL, __pa(pdc_result), 431 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_SYSMODEL, __pa(pdc_result),
420 OS_ID_HPUX, __pa(name)); 432 OS_ID_HPUX, __pa(name));
421 convert_to_wide(pdc_result); 433 convert_to_wide(pdc_result);
@@ -425,7 +437,7 @@ int pdc_model_sysmodel(char *name)
425 } else { 437 } else {
426 name[0] = 0; 438 name[0] = 0;
427 } 439 }
428 spin_unlock_irq(&pdc_lock); 440 spin_unlock_irqrestore(&pdc_lock, flags);
429 441
430 return retval; 442 return retval;
431} 443}
@@ -443,12 +455,13 @@ int pdc_model_sysmodel(char *name)
443int pdc_model_versions(unsigned long *versions, int id) 455int pdc_model_versions(unsigned long *versions, int id)
444{ 456{
445 int retval; 457 int retval;
458 unsigned long flags;
446 459
447 spin_lock_irq(&pdc_lock); 460 spin_lock_irqsave(&pdc_lock, flags);
448 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_VERSIONS, __pa(pdc_result), id); 461 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_VERSIONS, __pa(pdc_result), id);
449 convert_to_wide(pdc_result); 462 convert_to_wide(pdc_result);
450 *versions = pdc_result[0]; 463 *versions = pdc_result[0];
451 spin_unlock_irq(&pdc_lock); 464 spin_unlock_irqrestore(&pdc_lock, flags);
452 465
453 return retval; 466 return retval;
454} 467}
@@ -463,13 +476,14 @@ int pdc_model_versions(unsigned long *versions, int id)
463int pdc_model_cpuid(unsigned long *cpu_id) 476int pdc_model_cpuid(unsigned long *cpu_id)
464{ 477{
465 int retval; 478 int retval;
479 unsigned long flags;
466 480
467 spin_lock_irq(&pdc_lock); 481 spin_lock_irqsave(&pdc_lock, flags);
468 pdc_result[0] = 0; /* preset zero (call may not be implemented!) */ 482 pdc_result[0] = 0; /* preset zero (call may not be implemented!) */
469 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CPU_ID, __pa(pdc_result), 0); 483 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CPU_ID, __pa(pdc_result), 0);
470 convert_to_wide(pdc_result); 484 convert_to_wide(pdc_result);
471 *cpu_id = pdc_result[0]; 485 *cpu_id = pdc_result[0];
472 spin_unlock_irq(&pdc_lock); 486 spin_unlock_irqrestore(&pdc_lock, flags);
473 487
474 return retval; 488 return retval;
475} 489}
@@ -484,13 +498,14 @@ int pdc_model_cpuid(unsigned long *cpu_id)
484int pdc_model_capabilities(unsigned long *capabilities) 498int pdc_model_capabilities(unsigned long *capabilities)
485{ 499{
486 int retval; 500 int retval;
501 unsigned long flags;
487 502
488 spin_lock_irq(&pdc_lock); 503 spin_lock_irqsave(&pdc_lock, flags);
489 pdc_result[0] = 0; /* preset zero (call may not be implemented!) */ 504 pdc_result[0] = 0; /* preset zero (call may not be implemented!) */
490 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0); 505 retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0);
491 convert_to_wide(pdc_result); 506 convert_to_wide(pdc_result);
492 *capabilities = pdc_result[0]; 507 *capabilities = pdc_result[0];
493 spin_unlock_irq(&pdc_lock); 508 spin_unlock_irqrestore(&pdc_lock, flags);
494 509
495 return retval; 510 return retval;
496} 511}
@@ -504,12 +519,13 @@ int pdc_model_capabilities(unsigned long *capabilities)
504int pdc_cache_info(struct pdc_cache_info *cache_info) 519int pdc_cache_info(struct pdc_cache_info *cache_info)
505{ 520{
506 int retval; 521 int retval;
522 unsigned long flags;
507 523
508 spin_lock_irq(&pdc_lock); 524 spin_lock_irqsave(&pdc_lock, flags);
509 retval = mem_pdc_call(PDC_CACHE, PDC_CACHE_INFO, __pa(pdc_result), 0); 525 retval = mem_pdc_call(PDC_CACHE, PDC_CACHE_INFO, __pa(pdc_result), 0);
510 convert_to_wide(pdc_result); 526 convert_to_wide(pdc_result);
511 memcpy(cache_info, pdc_result, sizeof(*cache_info)); 527 memcpy(cache_info, pdc_result, sizeof(*cache_info));
512 spin_unlock_irq(&pdc_lock); 528 spin_unlock_irqrestore(&pdc_lock, flags);
513 529
514 return retval; 530 return retval;
515} 531}
@@ -523,13 +539,14 @@ int pdc_cache_info(struct pdc_cache_info *cache_info)
523int pdc_spaceid_bits(unsigned long *space_bits) 539int pdc_spaceid_bits(unsigned long *space_bits)
524{ 540{
525 int retval; 541 int retval;
542 unsigned long flags;
526 543
527 spin_lock_irq(&pdc_lock); 544 spin_lock_irqsave(&pdc_lock, flags);
528 pdc_result[0] = 0; 545 pdc_result[0] = 0;
529 retval = mem_pdc_call(PDC_CACHE, PDC_CACHE_RET_SPID, __pa(pdc_result), 0); 546 retval = mem_pdc_call(PDC_CACHE, PDC_CACHE_RET_SPID, __pa(pdc_result), 0);
530 convert_to_wide(pdc_result); 547 convert_to_wide(pdc_result);
531 *space_bits = pdc_result[0]; 548 *space_bits = pdc_result[0];
532 spin_unlock_irq(&pdc_lock); 549 spin_unlock_irqrestore(&pdc_lock, flags);
533 550
534 return retval; 551 return retval;
535} 552}
@@ -544,11 +561,12 @@ int pdc_spaceid_bits(unsigned long *space_bits)
544int pdc_btlb_info(struct pdc_btlb_info *btlb) 561int pdc_btlb_info(struct pdc_btlb_info *btlb)
545{ 562{
546 int retval; 563 int retval;
564 unsigned long flags;
547 565
548 spin_lock_irq(&pdc_lock); 566 spin_lock_irqsave(&pdc_lock, flags);
549 retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_INFO, __pa(pdc_result), 0); 567 retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_INFO, __pa(pdc_result), 0);
550 memcpy(btlb, pdc_result, sizeof(*btlb)); 568 memcpy(btlb, pdc_result, sizeof(*btlb));
551 spin_unlock_irq(&pdc_lock); 569 spin_unlock_irqrestore(&pdc_lock, flags);
552 570
553 if(retval < 0) { 571 if(retval < 0) {
554 btlb->max_size = 0; 572 btlb->max_size = 0;
@@ -572,13 +590,14 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address,
572 struct pdc_module_path *mod_path) 590 struct pdc_module_path *mod_path)
573{ 591{
574 int retval; 592 int retval;
593 unsigned long flags;
575 594
576 spin_lock_irq(&pdc_lock); 595 spin_lock_irqsave(&pdc_lock, flags);
577 memcpy(pdc_result2, mod_path, sizeof(*mod_path)); 596 memcpy(pdc_result2, mod_path, sizeof(*mod_path));
578 retval = mem_pdc_call(PDC_MEM_MAP, PDC_MEM_MAP_HPA, __pa(pdc_result), 597 retval = mem_pdc_call(PDC_MEM_MAP, PDC_MEM_MAP_HPA, __pa(pdc_result),
579 __pa(pdc_result2)); 598 __pa(pdc_result2));
580 memcpy(address, pdc_result, sizeof(*address)); 599 memcpy(address, pdc_result, sizeof(*address));
581 spin_unlock_irq(&pdc_lock); 600 spin_unlock_irqrestore(&pdc_lock, flags);
582 601
583 return retval; 602 return retval;
584} 603}
@@ -594,8 +613,9 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address,
594int pdc_lan_station_id(char *lan_addr, unsigned long hpa) 613int pdc_lan_station_id(char *lan_addr, unsigned long hpa)
595{ 614{
596 int retval; 615 int retval;
616 unsigned long flags;
597 617
598 spin_lock_irq(&pdc_lock); 618 spin_lock_irqsave(&pdc_lock, flags);
599 retval = mem_pdc_call(PDC_LAN_STATION_ID, PDC_LAN_STATION_ID_READ, 619 retval = mem_pdc_call(PDC_LAN_STATION_ID, PDC_LAN_STATION_ID_READ,
600 __pa(pdc_result), hpa); 620 __pa(pdc_result), hpa);
601 if (retval < 0) { 621 if (retval < 0) {
@@ -604,7 +624,7 @@ int pdc_lan_station_id(char *lan_addr, unsigned long hpa)
604 } else { 624 } else {
605 memcpy(lan_addr, pdc_result, PDC_LAN_STATION_ID_SIZE); 625 memcpy(lan_addr, pdc_result, PDC_LAN_STATION_ID_SIZE);
606 } 626 }
607 spin_unlock_irq(&pdc_lock); 627 spin_unlock_irqrestore(&pdc_lock, flags);
608 628
609 return retval; 629 return retval;
610} 630}
@@ -623,13 +643,14 @@ EXPORT_SYMBOL(pdc_lan_station_id);
623int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count) 643int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count)
624{ 644{
625 int retval; 645 int retval;
646 unsigned long flags;
626 647
627 spin_lock_irq(&pdc_lock); 648 spin_lock_irqsave(&pdc_lock, flags);
628 retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_READ, staddr, 649 retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_READ, staddr,
629 __pa(pdc_result), count); 650 __pa(pdc_result), count);
630 convert_to_wide(pdc_result); 651 convert_to_wide(pdc_result);
631 memcpy(memaddr, pdc_result, count); 652 memcpy(memaddr, pdc_result, count);
632 spin_unlock_irq(&pdc_lock); 653 spin_unlock_irqrestore(&pdc_lock, flags);
633 654
634 return retval; 655 return retval;
635} 656}
@@ -648,13 +669,14 @@ EXPORT_SYMBOL(pdc_stable_read);
648int pdc_stable_write(unsigned long staddr, void *memaddr, unsigned long count) 669int pdc_stable_write(unsigned long staddr, void *memaddr, unsigned long count)
649{ 670{
650 int retval; 671 int retval;
672 unsigned long flags;
651 673
652 spin_lock_irq(&pdc_lock); 674 spin_lock_irqsave(&pdc_lock, flags);
653 memcpy(pdc_result, memaddr, count); 675 memcpy(pdc_result, memaddr, count);
654 convert_to_wide(pdc_result); 676 convert_to_wide(pdc_result);
655 retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_WRITE, staddr, 677 retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_WRITE, staddr,
656 __pa(pdc_result), count); 678 __pa(pdc_result), count);
657 spin_unlock_irq(&pdc_lock); 679 spin_unlock_irqrestore(&pdc_lock, flags);
658 680
659 return retval; 681 return retval;
660} 682}
@@ -672,11 +694,12 @@ EXPORT_SYMBOL(pdc_stable_write);
672int pdc_stable_get_size(unsigned long *size) 694int pdc_stable_get_size(unsigned long *size)
673{ 695{
674 int retval; 696 int retval;
697 unsigned long flags;
675 698
676 spin_lock_irq(&pdc_lock); 699 spin_lock_irqsave(&pdc_lock, flags);
677 retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_RETURN_SIZE, __pa(pdc_result)); 700 retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_RETURN_SIZE, __pa(pdc_result));
678 *size = pdc_result[0]; 701 *size = pdc_result[0];
679 spin_unlock_irq(&pdc_lock); 702 spin_unlock_irqrestore(&pdc_lock, flags);
680 703
681 return retval; 704 return retval;
682} 705}
@@ -691,10 +714,11 @@ EXPORT_SYMBOL(pdc_stable_get_size);
691int pdc_stable_verify_contents(void) 714int pdc_stable_verify_contents(void)
692{ 715{
693 int retval; 716 int retval;
717 unsigned long flags;
694 718
695 spin_lock_irq(&pdc_lock); 719 spin_lock_irqsave(&pdc_lock, flags);
696 retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_VERIFY_CONTENTS); 720 retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_VERIFY_CONTENTS);
697 spin_unlock_irq(&pdc_lock); 721 spin_unlock_irqrestore(&pdc_lock, flags);
698 722
699 return retval; 723 return retval;
700} 724}
@@ -709,10 +733,11 @@ EXPORT_SYMBOL(pdc_stable_verify_contents);
709int pdc_stable_initialize(void) 733int pdc_stable_initialize(void)
710{ 734{
711 int retval; 735 int retval;
736 unsigned long flags;
712 737
713 spin_lock_irq(&pdc_lock); 738 spin_lock_irqsave(&pdc_lock, flags);
714 retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_INITIALIZE); 739 retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_INITIALIZE);
715 spin_unlock_irq(&pdc_lock); 740 spin_unlock_irqrestore(&pdc_lock, flags);
716 741
717 return retval; 742 return retval;
718} 743}
@@ -735,8 +760,9 @@ EXPORT_SYMBOL(pdc_stable_initialize);
735int pdc_get_initiator(struct hardware_path *hwpath, struct pdc_initiator *initiator) 760int pdc_get_initiator(struct hardware_path *hwpath, struct pdc_initiator *initiator)
736{ 761{
737 int retval; 762 int retval;
763 unsigned long flags;
738 764
739 spin_lock_irq(&pdc_lock); 765 spin_lock_irqsave(&pdc_lock, flags);
740 766
741/* BCJ-XXXX series boxes. E.G. "9000/785/C3000" */ 767/* BCJ-XXXX series boxes. E.G. "9000/785/C3000" */
742#define IS_SPROCKETS() (strlen(boot_cpu_data.pdc.sys_model_name) == 14 && \ 768#define IS_SPROCKETS() (strlen(boot_cpu_data.pdc.sys_model_name) == 14 && \
@@ -776,7 +802,8 @@ int pdc_get_initiator(struct hardware_path *hwpath, struct pdc_initiator *initia
776 } 802 }
777 803
778 out: 804 out:
779 spin_unlock_irq(&pdc_lock); 805 spin_unlock_irqrestore(&pdc_lock, flags);
806
780 return (retval >= PDC_OK); 807 return (retval >= PDC_OK);
781} 808}
782EXPORT_SYMBOL(pdc_get_initiator); 809EXPORT_SYMBOL(pdc_get_initiator);
@@ -794,13 +821,14 @@ EXPORT_SYMBOL(pdc_get_initiator);
794int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa) 821int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa)
795{ 822{
796 int retval; 823 int retval;
824 unsigned long flags;
797 825
798 spin_lock_irq(&pdc_lock); 826 spin_lock_irqsave(&pdc_lock, flags);
799 retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_GET_INT_TBL_SIZE, 827 retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_GET_INT_TBL_SIZE,
800 __pa(pdc_result), hpa); 828 __pa(pdc_result), hpa);
801 convert_to_wide(pdc_result); 829 convert_to_wide(pdc_result);
802 *num_entries = pdc_result[0]; 830 *num_entries = pdc_result[0];
803 spin_unlock_irq(&pdc_lock); 831 spin_unlock_irqrestore(&pdc_lock, flags);
804 832
805 return retval; 833 return retval;
806} 834}
@@ -817,14 +845,15 @@ int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa)
817int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl) 845int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl)
818{ 846{
819 int retval; 847 int retval;
848 unsigned long flags;
820 849
821 BUG_ON((unsigned long)tbl & 0x7); 850 BUG_ON((unsigned long)tbl & 0x7);
822 851
823 spin_lock_irq(&pdc_lock); 852 spin_lock_irqsave(&pdc_lock, flags);
824 pdc_result[0] = num_entries; 853 pdc_result[0] = num_entries;
825 retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_GET_INT_TBL, 854 retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_GET_INT_TBL,
826 __pa(pdc_result), hpa, __pa(tbl)); 855 __pa(pdc_result), hpa, __pa(tbl));
827 spin_unlock_irq(&pdc_lock); 856 spin_unlock_irqrestore(&pdc_lock, flags);
828 857
829 return retval; 858 return retval;
830} 859}
@@ -842,12 +871,15 @@ int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl)
842unsigned int pdc_pci_config_read(void *hpa, unsigned long cfg_addr) 871unsigned int pdc_pci_config_read(void *hpa, unsigned long cfg_addr)
843{ 872{
844 int retval; 873 int retval;
845 spin_lock_irq(&pdc_lock); 874 unsigned long flags;
875
876 spin_lock_irqsave(&pdc_lock, flags);
846 pdc_result[0] = 0; 877 pdc_result[0] = 0;
847 pdc_result[1] = 0; 878 pdc_result[1] = 0;
848 retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_READ_CONFIG, 879 retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_READ_CONFIG,
849 __pa(pdc_result), hpa, cfg_addr&~3UL, 4UL); 880 __pa(pdc_result), hpa, cfg_addr&~3UL, 4UL);
850 spin_unlock_irq(&pdc_lock); 881 spin_unlock_irqrestore(&pdc_lock, flags);
882
851 return retval ? ~0 : (unsigned int) pdc_result[0]; 883 return retval ? ~0 : (unsigned int) pdc_result[0];
852} 884}
853 885
@@ -863,12 +895,15 @@ unsigned int pdc_pci_config_read(void *hpa, unsigned long cfg_addr)
863void pdc_pci_config_write(void *hpa, unsigned long cfg_addr, unsigned int val) 895void pdc_pci_config_write(void *hpa, unsigned long cfg_addr, unsigned int val)
864{ 896{
865 int retval; 897 int retval;
866 spin_lock_irq(&pdc_lock); 898 unsigned long flags;
899
900 spin_lock_irqsave(&pdc_lock, flags);
867 pdc_result[0] = 0; 901 pdc_result[0] = 0;
868 retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_WRITE_CONFIG, 902 retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_WRITE_CONFIG,
869 __pa(pdc_result), hpa, 903 __pa(pdc_result), hpa,
870 cfg_addr&~3UL, 4UL, (unsigned long) val); 904 cfg_addr&~3UL, 4UL, (unsigned long) val);
871 spin_unlock_irq(&pdc_lock); 905 spin_unlock_irqrestore(&pdc_lock, flags);
906
872 return retval; 907 return retval;
873} 908}
874#endif /* UNTESTED CODE */ 909#endif /* UNTESTED CODE */
@@ -882,12 +917,13 @@ void pdc_pci_config_write(void *hpa, unsigned long cfg_addr, unsigned int val)
882int pdc_tod_read(struct pdc_tod *tod) 917int pdc_tod_read(struct pdc_tod *tod)
883{ 918{
884 int retval; 919 int retval;
920 unsigned long flags;
885 921
886 spin_lock_irq(&pdc_lock); 922 spin_lock_irqsave(&pdc_lock, flags);
887 retval = mem_pdc_call(PDC_TOD, PDC_TOD_READ, __pa(pdc_result), 0); 923 retval = mem_pdc_call(PDC_TOD, PDC_TOD_READ, __pa(pdc_result), 0);
888 convert_to_wide(pdc_result); 924 convert_to_wide(pdc_result);
889 memcpy(tod, pdc_result, sizeof(*tod)); 925 memcpy(tod, pdc_result, sizeof(*tod));
890 spin_unlock_irq(&pdc_lock); 926 spin_unlock_irqrestore(&pdc_lock, flags);
891 927
892 return retval; 928 return retval;
893} 929}
@@ -903,10 +939,11 @@ EXPORT_SYMBOL(pdc_tod_read);
903int pdc_tod_set(unsigned long sec, unsigned long usec) 939int pdc_tod_set(unsigned long sec, unsigned long usec)
904{ 940{
905 int retval; 941 int retval;
942 unsigned long flags;
906 943
907 spin_lock_irq(&pdc_lock); 944 spin_lock_irqsave(&pdc_lock, flags);
908 retval = mem_pdc_call(PDC_TOD, PDC_TOD_WRITE, sec, usec); 945 retval = mem_pdc_call(PDC_TOD, PDC_TOD_WRITE, sec, usec);
909 spin_unlock_irq(&pdc_lock); 946 spin_unlock_irqrestore(&pdc_lock, flags);
910 947
911 return retval; 948 return retval;
912} 949}
@@ -917,13 +954,14 @@ int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
917 struct pdc_memory_table *tbl, unsigned long entries) 954 struct pdc_memory_table *tbl, unsigned long entries)
918{ 955{
919 int retval; 956 int retval;
957 unsigned long flags;
920 958
921 spin_lock_irq(&pdc_lock); 959 spin_lock_irqsave(&pdc_lock, flags);
922 retval = mem_pdc_call(PDC_MEM, PDC_MEM_TABLE, __pa(pdc_result), __pa(pdc_result2), entries); 960 retval = mem_pdc_call(PDC_MEM, PDC_MEM_TABLE, __pa(pdc_result), __pa(pdc_result2), entries);
923 convert_to_wide(pdc_result); 961 convert_to_wide(pdc_result);
924 memcpy(r_addr, pdc_result, sizeof(*r_addr)); 962 memcpy(r_addr, pdc_result, sizeof(*r_addr));
925 memcpy(tbl, pdc_result2, entries * sizeof(*tbl)); 963 memcpy(tbl, pdc_result2, entries * sizeof(*tbl));
926 spin_unlock_irq(&pdc_lock); 964 spin_unlock_irqrestore(&pdc_lock, flags);
927 965
928 return retval; 966 return retval;
929} 967}
@@ -936,11 +974,12 @@ int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
936int pdc_do_firm_test_reset(unsigned long ftc_bitmap) 974int pdc_do_firm_test_reset(unsigned long ftc_bitmap)
937{ 975{
938 int retval; 976 int retval;
977 unsigned long flags;
939 978
940 spin_lock_irq(&pdc_lock); 979 spin_lock_irqsave(&pdc_lock, flags);
941 retval = mem_pdc_call(PDC_BROADCAST_RESET, PDC_DO_FIRM_TEST_RESET, 980 retval = mem_pdc_call(PDC_BROADCAST_RESET, PDC_DO_FIRM_TEST_RESET,
942 PDC_FIRM_TEST_MAGIC, ftc_bitmap); 981 PDC_FIRM_TEST_MAGIC, ftc_bitmap);
943 spin_unlock_irq(&pdc_lock); 982 spin_unlock_irqrestore(&pdc_lock, flags);
944 983
945 return retval; 984 return retval;
946} 985}
@@ -953,10 +992,11 @@ int pdc_do_firm_test_reset(unsigned long ftc_bitmap)
953int pdc_do_reset(void) 992int pdc_do_reset(void)
954{ 993{
955 int retval; 994 int retval;
995 unsigned long flags;
956 996
957 spin_lock_irq(&pdc_lock); 997 spin_lock_irqsave(&pdc_lock, flags);
958 retval = mem_pdc_call(PDC_BROADCAST_RESET, PDC_DO_RESET); 998 retval = mem_pdc_call(PDC_BROADCAST_RESET, PDC_DO_RESET);
959 spin_unlock_irq(&pdc_lock); 999 spin_unlock_irqrestore(&pdc_lock, flags);
960 1000
961 return retval; 1001 return retval;
962} 1002}
@@ -970,16 +1010,17 @@ int pdc_do_reset(void)
970int __init pdc_soft_power_info(unsigned long *power_reg) 1010int __init pdc_soft_power_info(unsigned long *power_reg)
971{ 1011{
972 int retval; 1012 int retval;
1013 unsigned long flags;
973 1014
974 *power_reg = (unsigned long) (-1); 1015 *power_reg = (unsigned long) (-1);
975 1016
976 spin_lock_irq(&pdc_lock); 1017 spin_lock_irqsave(&pdc_lock, flags);
977 retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_INFO, __pa(pdc_result), 0); 1018 retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_INFO, __pa(pdc_result), 0);
978 if (retval == PDC_OK) { 1019 if (retval == PDC_OK) {
979 convert_to_wide(pdc_result); 1020 convert_to_wide(pdc_result);
980 *power_reg = f_extend(pdc_result[0]); 1021 *power_reg = f_extend(pdc_result[0]);
981 } 1022 }
982 spin_unlock_irq(&pdc_lock); 1023 spin_unlock_irqrestore(&pdc_lock, flags);
983 1024
984 return retval; 1025 return retval;
985} 1026}
@@ -998,9 +1039,12 @@ int __init pdc_soft_power_info(unsigned long *power_reg)
998int pdc_soft_power_button(int sw_control) 1039int pdc_soft_power_button(int sw_control)
999{ 1040{
1000 int retval; 1041 int retval;
1001 spin_lock_irq(&pdc_lock); 1042 unsigned long flags;
1043
1044 spin_lock_irqsave(&pdc_lock, flags);
1002 retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_ENABLE, __pa(pdc_result), sw_control); 1045 retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_ENABLE, __pa(pdc_result), sw_control);
1003 spin_unlock_irq(&pdc_lock); 1046 spin_unlock_irqrestore(&pdc_lock, flags);
1047
1004 return retval; 1048 return retval;
1005} 1049}
1006 1050
@@ -1011,9 +1055,11 @@ int pdc_soft_power_button(int sw_control)
1011 */ 1055 */
1012void pdc_io_reset(void) 1056void pdc_io_reset(void)
1013{ 1057{
1014 spin_lock_irq(&pdc_lock); 1058 unsigned long flags;
1059
1060 spin_lock_irqsave(&pdc_lock, flags);
1015 mem_pdc_call(PDC_IO, PDC_IO_RESET, 0); 1061 mem_pdc_call(PDC_IO, PDC_IO_RESET, 0);
1016 spin_unlock_irq(&pdc_lock); 1062 spin_unlock_irqrestore(&pdc_lock, flags);
1017} 1063}
1018 1064
1019/* 1065/*
@@ -1027,9 +1073,11 @@ void pdc_io_reset(void)
1027 */ 1073 */
1028void pdc_io_reset_devices(void) 1074void pdc_io_reset_devices(void)
1029{ 1075{
1030 spin_lock_irq(&pdc_lock); 1076 unsigned long flags;
1077
1078 spin_lock_irqsave(&pdc_lock, flags);
1031 mem_pdc_call(PDC_IO, PDC_IO_RESET_DEVICES, 0); 1079 mem_pdc_call(PDC_IO, PDC_IO_RESET_DEVICES, 0);
1032 spin_unlock_irq(&pdc_lock); 1080 spin_unlock_irqrestore(&pdc_lock, flags);
1033} 1081}
1034 1082
1035 1083
@@ -1146,10 +1194,11 @@ int pdc_sti_call(unsigned long func, unsigned long flags,
1146 unsigned long glob_cfg) 1194 unsigned long glob_cfg)
1147{ 1195{
1148 int retval; 1196 int retval;
1197 unsigned long irqflags;
1149 1198
1150 spin_lock_irq(&pdc_lock); 1199 spin_lock_irqsave(&pdc_lock, irqflags);
1151 retval = real32_call(func, flags, inptr, outputr, glob_cfg); 1200 retval = real32_call(func, flags, inptr, outputr, glob_cfg);
1152 spin_unlock_irq(&pdc_lock); 1201 spin_unlock_irqrestore(&pdc_lock, irqflags);
1153 1202
1154 return retval; 1203 return retval;
1155} 1204}
@@ -1166,11 +1215,12 @@ EXPORT_SYMBOL(pdc_sti_call);
1166int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info) 1215int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info)
1167{ 1216{
1168 int retval; 1217 int retval;
1218 unsigned long flags;
1169 1219
1170 spin_lock_irq(&pdc_lock); 1220 spin_lock_irqsave(&pdc_lock, flags);
1171 retval = mem_pdc_call(PDC_PAT_CELL, PDC_PAT_CELL_GET_NUMBER, __pa(pdc_result)); 1221 retval = mem_pdc_call(PDC_PAT_CELL, PDC_PAT_CELL_GET_NUMBER, __pa(pdc_result));
1172 memcpy(cell_info, pdc_result, sizeof(*cell_info)); 1222 memcpy(cell_info, pdc_result, sizeof(*cell_info));
1173 spin_unlock_irq(&pdc_lock); 1223 spin_unlock_irqrestore(&pdc_lock, flags);
1174 1224
1175 return retval; 1225 return retval;
1176} 1226}
@@ -1190,16 +1240,17 @@ int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long
1190 unsigned long view_type, void *mem_addr) 1240 unsigned long view_type, void *mem_addr)
1191{ 1241{
1192 int retval; 1242 int retval;
1243 unsigned long flags;
1193 static struct pdc_pat_cell_mod_maddr_block result __attribute__ ((aligned (8))); 1244 static struct pdc_pat_cell_mod_maddr_block result __attribute__ ((aligned (8)));
1194 1245
1195 spin_lock_irq(&pdc_lock); 1246 spin_lock_irqsave(&pdc_lock, flags);
1196 retval = mem_pdc_call(PDC_PAT_CELL, PDC_PAT_CELL_MODULE, __pa(pdc_result), 1247 retval = mem_pdc_call(PDC_PAT_CELL, PDC_PAT_CELL_MODULE, __pa(pdc_result),
1197 ploc, mod, view_type, __pa(&result)); 1248 ploc, mod, view_type, __pa(&result));
1198 if(!retval) { 1249 if(!retval) {
1199 *actcnt = pdc_result[0]; 1250 *actcnt = pdc_result[0];
1200 memcpy(mem_addr, &result, *actcnt); 1251 memcpy(mem_addr, &result, *actcnt);
1201 } 1252 }
1202 spin_unlock_irq(&pdc_lock); 1253 spin_unlock_irqrestore(&pdc_lock, flags);
1203 1254
1204 return retval; 1255 return retval;
1205} 1256}
@@ -1214,12 +1265,13 @@ int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long
1214int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa) 1265int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa)
1215{ 1266{
1216 int retval; 1267 int retval;
1268 unsigned long flags;
1217 1269
1218 spin_lock_irq(&pdc_lock); 1270 spin_lock_irqsave(&pdc_lock, flags);
1219 retval = mem_pdc_call(PDC_PAT_CPU, PDC_PAT_CPU_GET_NUMBER, 1271 retval = mem_pdc_call(PDC_PAT_CPU, PDC_PAT_CPU_GET_NUMBER,
1220 __pa(&pdc_result), hpa); 1272 __pa(&pdc_result), hpa);
1221 memcpy(cpu_info, pdc_result, sizeof(*cpu_info)); 1273 memcpy(cpu_info, pdc_result, sizeof(*cpu_info));
1222 spin_unlock_irq(&pdc_lock); 1274 spin_unlock_irqrestore(&pdc_lock, flags);
1223 1275
1224 return retval; 1276 return retval;
1225} 1277}
@@ -1235,12 +1287,13 @@ int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa)
1235int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num) 1287int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num)
1236{ 1288{
1237 int retval; 1289 int retval;
1290 unsigned long flags;
1238 1291
1239 spin_lock_irq(&pdc_lock); 1292 spin_lock_irqsave(&pdc_lock, flags);
1240 retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_GET_PCI_ROUTING_TABLE_SIZE, 1293 retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_GET_PCI_ROUTING_TABLE_SIZE,
1241 __pa(pdc_result), cell_num); 1294 __pa(pdc_result), cell_num);
1242 *num_entries = pdc_result[0]; 1295 *num_entries = pdc_result[0];
1243 spin_unlock_irq(&pdc_lock); 1296 spin_unlock_irqrestore(&pdc_lock, flags);
1244 1297
1245 return retval; 1298 return retval;
1246} 1299}
@@ -1255,11 +1308,12 @@ int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num)
1255int pdc_pat_get_irt(void *r_addr, unsigned long cell_num) 1308int pdc_pat_get_irt(void *r_addr, unsigned long cell_num)
1256{ 1309{
1257 int retval; 1310 int retval;
1311 unsigned long flags;
1258 1312
1259 spin_lock_irq(&pdc_lock); 1313 spin_lock_irqsave(&pdc_lock, flags);
1260 retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_GET_PCI_ROUTING_TABLE, 1314 retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_GET_PCI_ROUTING_TABLE,
1261 __pa(r_addr), cell_num); 1315 __pa(r_addr), cell_num);
1262 spin_unlock_irq(&pdc_lock); 1316 spin_unlock_irqrestore(&pdc_lock, flags);
1263 1317
1264 return retval; 1318 return retval;
1265} 1319}
@@ -1276,13 +1330,14 @@ int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
1276 unsigned long count, unsigned long offset) 1330 unsigned long count, unsigned long offset)
1277{ 1331{
1278 int retval; 1332 int retval;
1333 unsigned long flags;
1279 1334
1280 spin_lock_irq(&pdc_lock); 1335 spin_lock_irqsave(&pdc_lock, flags);
1281 retval = mem_pdc_call(PDC_PAT_PD, PDC_PAT_PD_GET_ADDR_MAP, __pa(pdc_result), 1336 retval = mem_pdc_call(PDC_PAT_PD, PDC_PAT_PD_GET_ADDR_MAP, __pa(pdc_result),
1282 __pa(pdc_result2), count, offset); 1337 __pa(pdc_result2), count, offset);
1283 *actual_len = pdc_result[0]; 1338 *actual_len = pdc_result[0];
1284 memcpy(mem_addr, pdc_result2, *actual_len); 1339 memcpy(mem_addr, pdc_result2, *actual_len);
1285 spin_unlock_irq(&pdc_lock); 1340 spin_unlock_irqrestore(&pdc_lock, flags);
1286 1341
1287 return retval; 1342 return retval;
1288} 1343}
@@ -1297,7 +1352,9 @@ int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
1297int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr) 1352int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr)
1298{ 1353{
1299 int retval; 1354 int retval;
1300 spin_lock_irq(&pdc_lock); 1355 unsigned long flags;
1356
1357 spin_lock_irqsave(&pdc_lock, flags);
1301 retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_READ, 1358 retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_READ,
1302 __pa(pdc_result), pci_addr, pci_size); 1359 __pa(pdc_result), pci_addr, pci_size);
1303 switch(pci_size) { 1360 switch(pci_size) {
@@ -1305,7 +1362,7 @@ int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr)
1305 case 2: *(u16 *)mem_addr = (u16) pdc_result[0]; 1362 case 2: *(u16 *)mem_addr = (u16) pdc_result[0];
1306 case 4: *(u32 *)mem_addr = (u32) pdc_result[0]; 1363 case 4: *(u32 *)mem_addr = (u32) pdc_result[0];
1307 } 1364 }
1308 spin_unlock_irq(&pdc_lock); 1365 spin_unlock_irqrestore(&pdc_lock, flags);
1309 1366
1310 return retval; 1367 return retval;
1311} 1368}
@@ -1321,11 +1378,12 @@ int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr)
1321int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val) 1378int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val)
1322{ 1379{
1323 int retval; 1380 int retval;
1381 unsigned long flags;
1324 1382
1325 spin_lock_irq(&pdc_lock); 1383 spin_lock_irqsave(&pdc_lock, flags);
1326 retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_WRITE, 1384 retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_WRITE,
1327 pci_addr, pci_size, val); 1385 pci_addr, pci_size, val);
1328 spin_unlock_irq(&pdc_lock); 1386 spin_unlock_irqrestore(&pdc_lock, flags);
1329 1387
1330 return retval; 1388 return retval;
1331} 1389}