Commit 09690b18 authored by Kyle McMartin's avatar Kyle McMartin Committed by Matthew Wilcox

[PARISC] Make firmware calls irqsafe-ish...

There's no reason why we shouldn't be using _irqsave instead of
_irq for any of these calls. fwiw, this fixes the
"start_kernel(): bug: interrupts were enabled early" message displayed
on bootup recently.
Signed-off-by: default avatarKyle McMartin <kyle@parisc-linux.org>
Signed-off-by: default avatarMatthew Wilcox <matthew@wil.cx>
parent ba0e427f
...@@ -160,13 +160,14 @@ void __init set_firmware_width(void) ...@@ -160,13 +160,14 @@ void __init set_firmware_width(void)
{ {
#ifdef __LP64__ #ifdef __LP64__
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0); retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
if(pdc_result[0] != NARROW_FIRMWARE) if(pdc_result[0] != NARROW_FIRMWARE)
parisc_narrow_firmware = 0; parisc_narrow_firmware = 0;
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
#endif #endif
} }
...@@ -196,10 +197,11 @@ void pdc_emergency_unlock(void) ...@@ -196,10 +197,11 @@ void pdc_emergency_unlock(void)
int pdc_add_valid(unsigned long address) int pdc_add_valid(unsigned long address)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_ADD_VALID, PDC_ADD_VALID_VERIFY, address); retval = mem_pdc_call(PDC_ADD_VALID, PDC_ADD_VALID_VERIFY, address);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -216,15 +218,16 @@ EXPORT_SYMBOL(pdc_add_valid); ...@@ -216,15 +218,16 @@ EXPORT_SYMBOL(pdc_add_valid);
int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len) int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
memcpy(&pdc_result, chassis_info, sizeof(*chassis_info)); memcpy(&pdc_result, chassis_info, sizeof(*chassis_info));
memcpy(&pdc_result2, led_info, len); memcpy(&pdc_result2, led_info, len);
retval = mem_pdc_call(PDC_CHASSIS, PDC_RETURN_CHASSIS_INFO, retval = mem_pdc_call(PDC_CHASSIS, PDC_RETURN_CHASSIS_INFO,
__pa(pdc_result), __pa(pdc_result2), len); __pa(pdc_result), __pa(pdc_result2), len);
memcpy(chassis_info, pdc_result, sizeof(*chassis_info)); memcpy(chassis_info, pdc_result, sizeof(*chassis_info));
memcpy(led_info, pdc_result2, len); memcpy(led_info, pdc_result2, len);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -239,13 +242,14 @@ int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_inf ...@@ -239,13 +242,14 @@ int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_inf
int pdc_pat_chassis_send_log(unsigned long state, unsigned long data) int pdc_pat_chassis_send_log(unsigned long state, unsigned long data)
{ {
int retval = 0; int retval = 0;
unsigned long flags;
if (!is_pdc_pat()) if (!is_pdc_pat())
return -1; return -1;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_PAT_CHASSIS_LOG, PDC_PAT_CHASSIS_WRITE_LOG, __pa(&state), __pa(&data)); retval = mem_pdc_call(PDC_PAT_CHASSIS_LOG, PDC_PAT_CHASSIS_WRITE_LOG, __pa(&state), __pa(&data));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -258,10 +262,11 @@ int pdc_pat_chassis_send_log(unsigned long state, unsigned long data) ...@@ -258,10 +262,11 @@ int pdc_pat_chassis_send_log(unsigned long state, unsigned long data)
int pdc_chassis_disp(unsigned long disp) int pdc_chassis_disp(unsigned long disp)
{ {
int retval = 0; int retval = 0;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_DISP, disp); retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_DISP, disp);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -273,11 +278,12 @@ int pdc_chassis_disp(unsigned long disp) ...@@ -273,11 +278,12 @@ int pdc_chassis_disp(unsigned long disp)
int pdc_chassis_warn(unsigned long *warn) int pdc_chassis_warn(unsigned long *warn)
{ {
int retval = 0; int retval = 0;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_WARN, __pa(pdc_result)); retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_WARN, __pa(pdc_result));
*warn = pdc_result[0]; *warn = pdc_result[0];
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -292,15 +298,16 @@ int pdc_chassis_warn(unsigned long *warn) ...@@ -292,15 +298,16 @@ int pdc_chassis_warn(unsigned long *warn)
int __init pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info) int __init pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_COPROC, PDC_COPROC_CFG, __pa(pdc_result)); retval = mem_pdc_call(PDC_COPROC, PDC_COPROC_CFG, __pa(pdc_result));
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
pdc_coproc_info->ccr_functional = pdc_result[0]; pdc_coproc_info->ccr_functional = pdc_result[0];
pdc_coproc_info->ccr_present = pdc_result[1]; pdc_coproc_info->ccr_present = pdc_result[1];
pdc_coproc_info->revision = pdc_result[17]; pdc_coproc_info->revision = pdc_result[17];
pdc_coproc_info->model = pdc_result[18]; pdc_coproc_info->model = pdc_result[18];
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -320,14 +327,15 @@ int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index, ...@@ -320,14 +327,15 @@ int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
void *iodc_data, unsigned int iodc_data_size) void *iodc_data, unsigned int iodc_data_size)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_IODC, PDC_IODC_READ, __pa(pdc_result), hpa, retval = mem_pdc_call(PDC_IODC, PDC_IODC_READ, __pa(pdc_result), hpa,
index, __pa(pdc_result2), iodc_data_size); index, __pa(pdc_result2), iodc_data_size);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
*actcnt = pdc_result[0]; *actcnt = pdc_result[0];
memcpy(iodc_data, pdc_result2, iodc_data_size); memcpy(iodc_data, pdc_result2, iodc_data_size);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -346,14 +354,15 @@ int pdc_system_map_find_mods(struct pdc_system_map_mod_info *pdc_mod_info, ...@@ -346,14 +354,15 @@ int pdc_system_map_find_mods(struct pdc_system_map_mod_info *pdc_mod_info,
struct pdc_module_path *mod_path, long mod_index) struct pdc_module_path *mod_path, long mod_index)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_SYSTEM_MAP, PDC_FIND_MODULE, __pa(pdc_result), retval = mem_pdc_call(PDC_SYSTEM_MAP, PDC_FIND_MODULE, __pa(pdc_result),
__pa(pdc_result2), mod_index); __pa(pdc_result2), mod_index);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
memcpy(pdc_mod_info, pdc_result, sizeof(*pdc_mod_info)); memcpy(pdc_mod_info, pdc_result, sizeof(*pdc_mod_info));
memcpy(mod_path, pdc_result2, sizeof(*mod_path)); memcpy(mod_path, pdc_result2, sizeof(*mod_path));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
pdc_mod_info->mod_addr = f_extend(pdc_mod_info->mod_addr); pdc_mod_info->mod_addr = f_extend(pdc_mod_info->mod_addr);
return retval; return retval;
...@@ -372,13 +381,14 @@ int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info, ...@@ -372,13 +381,14 @@ int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info,
long mod_index, long addr_index) long mod_index, long addr_index)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_SYSTEM_MAP, PDC_FIND_ADDRESS, __pa(pdc_result), retval = mem_pdc_call(PDC_SYSTEM_MAP, PDC_FIND_ADDRESS, __pa(pdc_result),
mod_index, addr_index); mod_index, addr_index);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
memcpy(pdc_addr_info, pdc_result, sizeof(*pdc_addr_info)); memcpy(pdc_addr_info, pdc_result, sizeof(*pdc_addr_info));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
pdc_addr_info->mod_addr = f_extend(pdc_addr_info->mod_addr); pdc_addr_info->mod_addr = f_extend(pdc_addr_info->mod_addr);
return retval; return retval;
...@@ -393,12 +403,13 @@ int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info, ...@@ -393,12 +403,13 @@ int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info,
int pdc_model_info(struct pdc_model *model) int pdc_model_info(struct pdc_model *model)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_INFO, __pa(pdc_result), 0); retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_INFO, __pa(pdc_result), 0);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
memcpy(model, pdc_result, sizeof(*model)); memcpy(model, pdc_result, sizeof(*model));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -414,8 +425,9 @@ int pdc_model_info(struct pdc_model *model) ...@@ -414,8 +425,9 @@ int pdc_model_info(struct pdc_model *model)
int pdc_model_sysmodel(char *name) int pdc_model_sysmodel(char *name)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_SYSMODEL, __pa(pdc_result), retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_SYSMODEL, __pa(pdc_result),
OS_ID_HPUX, __pa(name)); OS_ID_HPUX, __pa(name));
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
...@@ -425,7 +437,7 @@ int pdc_model_sysmodel(char *name) ...@@ -425,7 +437,7 @@ int pdc_model_sysmodel(char *name)
} else { } else {
name[0] = 0; name[0] = 0;
} }
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -443,12 +455,13 @@ int pdc_model_sysmodel(char *name) ...@@ -443,12 +455,13 @@ int pdc_model_sysmodel(char *name)
int pdc_model_versions(unsigned long *versions, int id) int pdc_model_versions(unsigned long *versions, int id)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_VERSIONS, __pa(pdc_result), id); retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_VERSIONS, __pa(pdc_result), id);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
*versions = pdc_result[0]; *versions = pdc_result[0];
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -463,13 +476,14 @@ int pdc_model_versions(unsigned long *versions, int id) ...@@ -463,13 +476,14 @@ int pdc_model_versions(unsigned long *versions, int id)
int pdc_model_cpuid(unsigned long *cpu_id) int pdc_model_cpuid(unsigned long *cpu_id)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
pdc_result[0] = 0; /* preset zero (call may not be implemented!) */ pdc_result[0] = 0; /* preset zero (call may not be implemented!) */
retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CPU_ID, __pa(pdc_result), 0); retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CPU_ID, __pa(pdc_result), 0);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
*cpu_id = pdc_result[0]; *cpu_id = pdc_result[0];
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -484,13 +498,14 @@ int pdc_model_cpuid(unsigned long *cpu_id) ...@@ -484,13 +498,14 @@ int pdc_model_cpuid(unsigned long *cpu_id)
int pdc_model_capabilities(unsigned long *capabilities) int pdc_model_capabilities(unsigned long *capabilities)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
pdc_result[0] = 0; /* preset zero (call may not be implemented!) */ pdc_result[0] = 0; /* preset zero (call may not be implemented!) */
retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0); retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
*capabilities = pdc_result[0]; *capabilities = pdc_result[0];
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -504,12 +519,13 @@ int pdc_model_capabilities(unsigned long *capabilities) ...@@ -504,12 +519,13 @@ int pdc_model_capabilities(unsigned long *capabilities)
int pdc_cache_info(struct pdc_cache_info *cache_info) int pdc_cache_info(struct pdc_cache_info *cache_info)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_CACHE, PDC_CACHE_INFO, __pa(pdc_result), 0); retval = mem_pdc_call(PDC_CACHE, PDC_CACHE_INFO, __pa(pdc_result), 0);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
memcpy(cache_info, pdc_result, sizeof(*cache_info)); memcpy(cache_info, pdc_result, sizeof(*cache_info));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -523,13 +539,14 @@ int pdc_cache_info(struct pdc_cache_info *cache_info) ...@@ -523,13 +539,14 @@ int pdc_cache_info(struct pdc_cache_info *cache_info)
int pdc_spaceid_bits(unsigned long *space_bits) int pdc_spaceid_bits(unsigned long *space_bits)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
pdc_result[0] = 0; pdc_result[0] = 0;
retval = mem_pdc_call(PDC_CACHE, PDC_CACHE_RET_SPID, __pa(pdc_result), 0); retval = mem_pdc_call(PDC_CACHE, PDC_CACHE_RET_SPID, __pa(pdc_result), 0);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
*space_bits = pdc_result[0]; *space_bits = pdc_result[0];
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -544,11 +561,12 @@ int pdc_spaceid_bits(unsigned long *space_bits) ...@@ -544,11 +561,12 @@ int pdc_spaceid_bits(unsigned long *space_bits)
int pdc_btlb_info(struct pdc_btlb_info *btlb) int pdc_btlb_info(struct pdc_btlb_info *btlb)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_INFO, __pa(pdc_result), 0); retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_INFO, __pa(pdc_result), 0);
memcpy(btlb, pdc_result, sizeof(*btlb)); memcpy(btlb, pdc_result, sizeof(*btlb));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
if(retval < 0) { if(retval < 0) {
btlb->max_size = 0; btlb->max_size = 0;
...@@ -572,13 +590,14 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address, ...@@ -572,13 +590,14 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address,
struct pdc_module_path *mod_path) struct pdc_module_path *mod_path)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
memcpy(pdc_result2, mod_path, sizeof(*mod_path)); memcpy(pdc_result2, mod_path, sizeof(*mod_path));
retval = mem_pdc_call(PDC_MEM_MAP, PDC_MEM_MAP_HPA, __pa(pdc_result), retval = mem_pdc_call(PDC_MEM_MAP, PDC_MEM_MAP_HPA, __pa(pdc_result),
__pa(pdc_result2)); __pa(pdc_result2));
memcpy(address, pdc_result, sizeof(*address)); memcpy(address, pdc_result, sizeof(*address));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -594,8 +613,9 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address, ...@@ -594,8 +613,9 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address,
int pdc_lan_station_id(char *lan_addr, unsigned long hpa) int pdc_lan_station_id(char *lan_addr, unsigned long hpa)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_LAN_STATION_ID, PDC_LAN_STATION_ID_READ, retval = mem_pdc_call(PDC_LAN_STATION_ID, PDC_LAN_STATION_ID_READ,
__pa(pdc_result), hpa); __pa(pdc_result), hpa);
if (retval < 0) { if (retval < 0) {
...@@ -604,7 +624,7 @@ int pdc_lan_station_id(char *lan_addr, unsigned long hpa) ...@@ -604,7 +624,7 @@ int pdc_lan_station_id(char *lan_addr, unsigned long hpa)
} else { } else {
memcpy(lan_addr, pdc_result, PDC_LAN_STATION_ID_SIZE); memcpy(lan_addr, pdc_result, PDC_LAN_STATION_ID_SIZE);
} }
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -623,13 +643,14 @@ EXPORT_SYMBOL(pdc_lan_station_id); ...@@ -623,13 +643,14 @@ EXPORT_SYMBOL(pdc_lan_station_id);
int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count) int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_READ, staddr, retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_READ, staddr,
__pa(pdc_result), count); __pa(pdc_result), count);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
memcpy(memaddr, pdc_result, count); memcpy(memaddr, pdc_result, count);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -648,13 +669,14 @@ EXPORT_SYMBOL(pdc_stable_read); ...@@ -648,13 +669,14 @@ EXPORT_SYMBOL(pdc_stable_read);
int pdc_stable_write(unsigned long staddr, void *memaddr, unsigned long count) int pdc_stable_write(unsigned long staddr, void *memaddr, unsigned long count)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
memcpy(pdc_result, memaddr, count); memcpy(pdc_result, memaddr, count);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_WRITE, staddr, retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_WRITE, staddr,
__pa(pdc_result), count); __pa(pdc_result), count);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -672,11 +694,12 @@ EXPORT_SYMBOL(pdc_stable_write); ...@@ -672,11 +694,12 @@ EXPORT_SYMBOL(pdc_stable_write);
int pdc_stable_get_size(unsigned long *size) int pdc_stable_get_size(unsigned long *size)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_RETURN_SIZE, __pa(pdc_result)); retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_RETURN_SIZE, __pa(pdc_result));
*size = pdc_result[0]; *size = pdc_result[0];
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -691,10 +714,11 @@ EXPORT_SYMBOL(pdc_stable_get_size); ...@@ -691,10 +714,11 @@ EXPORT_SYMBOL(pdc_stable_get_size);
int pdc_stable_verify_contents(void) int pdc_stable_verify_contents(void)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_VERIFY_CONTENTS); retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_VERIFY_CONTENTS);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -709,10 +733,11 @@ EXPORT_SYMBOL(pdc_stable_verify_contents); ...@@ -709,10 +733,11 @@ EXPORT_SYMBOL(pdc_stable_verify_contents);
int pdc_stable_initialize(void) int pdc_stable_initialize(void)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_INITIALIZE); retval = mem_pdc_call(PDC_STABLE, PDC_STABLE_INITIALIZE);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -735,8 +760,9 @@ EXPORT_SYMBOL(pdc_stable_initialize); ...@@ -735,8 +760,9 @@ EXPORT_SYMBOL(pdc_stable_initialize);
int pdc_get_initiator(struct hardware_path *hwpath, struct pdc_initiator *initiator) int pdc_get_initiator(struct hardware_path *hwpath, struct pdc_initiator *initiator)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
/* BCJ-XXXX series boxes. E.G. "9000/785/C3000" */ /* BCJ-XXXX series boxes. E.G. "9000/785/C3000" */
#define IS_SPROCKETS() (strlen(boot_cpu_data.pdc.sys_model_name) == 14 && \ #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,7 +802,8 @@ int pdc_get_initiator(struct hardware_path *hwpath, struct pdc_initiator *initia
} }
out: out:
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return (retval >= PDC_OK); return (retval >= PDC_OK);
} }
EXPORT_SYMBOL(pdc_get_initiator); EXPORT_SYMBOL(pdc_get_initiator);
...@@ -794,13 +821,14 @@ EXPORT_SYMBOL(pdc_get_initiator); ...@@ -794,13 +821,14 @@ EXPORT_SYMBOL(pdc_get_initiator);
int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa) int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_GET_INT_TBL_SIZE, retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_GET_INT_TBL_SIZE,
__pa(pdc_result), hpa); __pa(pdc_result), hpa);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
*num_entries = pdc_result[0]; *num_entries = pdc_result[0];
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -817,14 +845,15 @@ int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa) ...@@ -817,14 +845,15 @@ int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa)
int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl) int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl)
{ {
int retval; int retval;
unsigned long flags;
BUG_ON((unsigned long)tbl & 0x7); BUG_ON((unsigned long)tbl & 0x7);
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
pdc_result[0] = num_entries; pdc_result[0] = num_entries;
retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_GET_INT_TBL, retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_GET_INT_TBL,
__pa(pdc_result), hpa, __pa(tbl)); __pa(pdc_result), hpa, __pa(tbl));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -842,12 +871,15 @@ int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl) ...@@ -842,12 +871,15 @@ int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl)
unsigned int pdc_pci_config_read(void *hpa, unsigned long cfg_addr) unsigned int pdc_pci_config_read(void *hpa, unsigned long cfg_addr)
{ {
int retval; int retval;
spin_lock_irq(&pdc_lock); unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
pdc_result[0] = 0; pdc_result[0] = 0;
pdc_result[1] = 0; pdc_result[1] = 0;
retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_READ_CONFIG, retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_READ_CONFIG,
__pa(pdc_result), hpa, cfg_addr&~3UL, 4UL); __pa(pdc_result), hpa, cfg_addr&~3UL, 4UL);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval ? ~0 : (unsigned int) pdc_result[0]; return retval ? ~0 : (unsigned int) pdc_result[0];
} }
...@@ -863,12 +895,15 @@ unsigned int pdc_pci_config_read(void *hpa, unsigned long cfg_addr) ...@@ -863,12 +895,15 @@ unsigned int pdc_pci_config_read(void *hpa, unsigned long cfg_addr)
void pdc_pci_config_write(void *hpa, unsigned long cfg_addr, unsigned int val) void pdc_pci_config_write(void *hpa, unsigned long cfg_addr, unsigned int val)
{ {
int retval; int retval;
spin_lock_irq(&pdc_lock); unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
pdc_result[0] = 0; pdc_result[0] = 0;
retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_WRITE_CONFIG, retval = mem_pdc_call(PDC_PCI_INDEX, PDC_PCI_WRITE_CONFIG,
__pa(pdc_result), hpa, __pa(pdc_result), hpa,
cfg_addr&~3UL, 4UL, (unsigned long) val); cfg_addr&~3UL, 4UL, (unsigned long) val);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
#endif /* UNTESTED CODE */ #endif /* UNTESTED CODE */
...@@ -882,12 +917,13 @@ void pdc_pci_config_write(void *hpa, unsigned long cfg_addr, unsigned int val) ...@@ -882,12 +917,13 @@ void pdc_pci_config_write(void *hpa, unsigned long cfg_addr, unsigned int val)
int pdc_tod_read(struct pdc_tod *tod) int pdc_tod_read(struct pdc_tod *tod)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_TOD, PDC_TOD_READ, __pa(pdc_result), 0); retval = mem_pdc_call(PDC_TOD, PDC_TOD_READ, __pa(pdc_result), 0);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
memcpy(tod, pdc_result, sizeof(*tod)); memcpy(tod, pdc_result, sizeof(*tod));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -903,10 +939,11 @@ EXPORT_SYMBOL(pdc_tod_read); ...@@ -903,10 +939,11 @@ EXPORT_SYMBOL(pdc_tod_read);
int pdc_tod_set(unsigned long sec, unsigned long usec) int pdc_tod_set(unsigned long sec, unsigned long usec)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_TOD, PDC_TOD_WRITE, sec, usec); retval = mem_pdc_call(PDC_TOD, PDC_TOD_WRITE, sec, usec);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -917,13 +954,14 @@ int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr, ...@@ -917,13 +954,14 @@ int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
struct pdc_memory_table *tbl, unsigned long entries) struct pdc_memory_table *tbl, unsigned long entries)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_MEM, PDC_MEM_TABLE, __pa(pdc_result), __pa(pdc_result2), entries); retval = mem_pdc_call(PDC_MEM, PDC_MEM_TABLE, __pa(pdc_result), __pa(pdc_result2), entries);
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
memcpy(r_addr, pdc_result, sizeof(*r_addr)); memcpy(r_addr, pdc_result, sizeof(*r_addr));
memcpy(tbl, pdc_result2, entries * sizeof(*tbl)); memcpy(tbl, pdc_result2, entries * sizeof(*tbl));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -936,11 +974,12 @@ int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr, ...@@ -936,11 +974,12 @@ int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
int pdc_do_firm_test_reset(unsigned long ftc_bitmap) int pdc_do_firm_test_reset(unsigned long ftc_bitmap)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_BROADCAST_RESET, PDC_DO_FIRM_TEST_RESET, retval = mem_pdc_call(PDC_BROADCAST_RESET, PDC_DO_FIRM_TEST_RESET,
PDC_FIRM_TEST_MAGIC, ftc_bitmap); PDC_FIRM_TEST_MAGIC, ftc_bitmap);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -953,10 +992,11 @@ int pdc_do_firm_test_reset(unsigned long ftc_bitmap) ...@@ -953,10 +992,11 @@ int pdc_do_firm_test_reset(unsigned long ftc_bitmap)
int pdc_do_reset(void) int pdc_do_reset(void)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_BROADCAST_RESET, PDC_DO_RESET); retval = mem_pdc_call(PDC_BROADCAST_RESET, PDC_DO_RESET);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -970,16 +1010,17 @@ int pdc_do_reset(void) ...@@ -970,16 +1010,17 @@ int pdc_do_reset(void)
int __init pdc_soft_power_info(unsigned long *power_reg) int __init pdc_soft_power_info(unsigned long *power_reg)
{ {
int retval; int retval;
unsigned long flags;
*power_reg = (unsigned long) (-1); *power_reg = (unsigned long) (-1);
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_INFO, __pa(pdc_result), 0); retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_INFO, __pa(pdc_result), 0);
if (retval == PDC_OK) { if (retval == PDC_OK) {
convert_to_wide(pdc_result); convert_to_wide(pdc_result);
*power_reg = f_extend(pdc_result[0]); *power_reg = f_extend(pdc_result[0]);
} }
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -998,9 +1039,12 @@ int __init pdc_soft_power_info(unsigned long *power_reg) ...@@ -998,9 +1039,12 @@ int __init pdc_soft_power_info(unsigned long *power_reg)
int pdc_soft_power_button(int sw_control) int pdc_soft_power_button(int sw_control)
{ {
int retval; int retval;
spin_lock_irq(&pdc_lock); unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_ENABLE, __pa(pdc_result), sw_control); retval = mem_pdc_call(PDC_SOFT_POWER, PDC_SOFT_POWER_ENABLE, __pa(pdc_result), sw_control);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -1011,9 +1055,11 @@ int pdc_soft_power_button(int sw_control) ...@@ -1011,9 +1055,11 @@ int pdc_soft_power_button(int sw_control)
*/ */
void pdc_io_reset(void) void pdc_io_reset(void)
{ {
spin_lock_irq(&pdc_lock); unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
mem_pdc_call(PDC_IO, PDC_IO_RESET, 0); mem_pdc_call(PDC_IO, PDC_IO_RESET, 0);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
} }
/* /*
...@@ -1027,9 +1073,11 @@ void pdc_io_reset(void) ...@@ -1027,9 +1073,11 @@ void pdc_io_reset(void)
*/ */
void pdc_io_reset_devices(void) void pdc_io_reset_devices(void)
{ {
spin_lock_irq(&pdc_lock); unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
mem_pdc_call(PDC_IO, PDC_IO_RESET_DEVICES, 0); mem_pdc_call(PDC_IO, PDC_IO_RESET_DEVICES, 0);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
} }
...@@ -1146,10 +1194,11 @@ int pdc_sti_call(unsigned long func, unsigned long flags, ...@@ -1146,10 +1194,11 @@ int pdc_sti_call(unsigned long func, unsigned long flags,
unsigned long glob_cfg) unsigned long glob_cfg)
{ {
int retval; int retval;
unsigned long irqflags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, irqflags);
retval = real32_call(func, flags, inptr, outputr, glob_cfg); retval = real32_call(func, flags, inptr, outputr, glob_cfg);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, irqflags);
return retval; return retval;
} }
...@@ -1166,11 +1215,12 @@ EXPORT_SYMBOL(pdc_sti_call); ...@@ -1166,11 +1215,12 @@ EXPORT_SYMBOL(pdc_sti_call);
int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info) int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_PAT_CELL, PDC_PAT_CELL_GET_NUMBER, __pa(pdc_result)); retval = mem_pdc_call(PDC_PAT_CELL, PDC_PAT_CELL_GET_NUMBER, __pa(pdc_result));
memcpy(cell_info, pdc_result, sizeof(*cell_info)); memcpy(cell_info, pdc_result, sizeof(*cell_info));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -1190,16 +1240,17 @@ int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long ...@@ -1190,16 +1240,17 @@ int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long
unsigned long view_type, void *mem_addr) unsigned long view_type, void *mem_addr)
{ {
int retval; int retval;
unsigned long flags;
static struct pdc_pat_cell_mod_maddr_block result __attribute__ ((aligned (8))); static struct pdc_pat_cell_mod_maddr_block result __attribute__ ((aligned (8)));
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_PAT_CELL, PDC_PAT_CELL_MODULE, __pa(pdc_result), retval = mem_pdc_call(PDC_PAT_CELL, PDC_PAT_CELL_MODULE, __pa(pdc_result),
ploc, mod, view_type, __pa(&result)); ploc, mod, view_type, __pa(&result));
if(!retval) { if(!retval) {
*actcnt = pdc_result[0]; *actcnt = pdc_result[0];
memcpy(mem_addr, &result, *actcnt); memcpy(mem_addr, &result, *actcnt);
} }
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -1214,12 +1265,13 @@ int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long ...@@ -1214,12 +1265,13 @@ int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long
int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa) int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_PAT_CPU, PDC_PAT_CPU_GET_NUMBER, retval = mem_pdc_call(PDC_PAT_CPU, PDC_PAT_CPU_GET_NUMBER,
__pa(&pdc_result), hpa); __pa(&pdc_result), hpa);
memcpy(cpu_info, pdc_result, sizeof(*cpu_info)); memcpy(cpu_info, pdc_result, sizeof(*cpu_info));
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -1235,12 +1287,13 @@ int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa) ...@@ -1235,12 +1287,13 @@ int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa)
int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num) int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_GET_PCI_ROUTING_TABLE_SIZE, retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_GET_PCI_ROUTING_TABLE_SIZE,
__pa(pdc_result), cell_num); __pa(pdc_result), cell_num);
*num_entries = pdc_result[0]; *num_entries = pdc_result[0];
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -1255,11 +1308,12 @@ int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num) ...@@ -1255,11 +1308,12 @@ int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num)
int pdc_pat_get_irt(void *r_addr, unsigned long cell_num) int pdc_pat_get_irt(void *r_addr, unsigned long cell_num)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_GET_PCI_ROUTING_TABLE, retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_GET_PCI_ROUTING_TABLE,
__pa(r_addr), cell_num); __pa(r_addr), cell_num);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -1276,13 +1330,14 @@ int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr, ...@@ -1276,13 +1330,14 @@ int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
unsigned long count, unsigned long offset) unsigned long count, unsigned long offset)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_PAT_PD, PDC_PAT_PD_GET_ADDR_MAP, __pa(pdc_result), retval = mem_pdc_call(PDC_PAT_PD, PDC_PAT_PD_GET_ADDR_MAP, __pa(pdc_result),
__pa(pdc_result2), count, offset); __pa(pdc_result2), count, offset);
*actual_len = pdc_result[0]; *actual_len = pdc_result[0];
memcpy(mem_addr, pdc_result2, *actual_len); memcpy(mem_addr, pdc_result2, *actual_len);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -1297,7 +1352,9 @@ int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr, ...@@ -1297,7 +1352,9 @@ int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr) int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr)
{ {
int retval; int retval;
spin_lock_irq(&pdc_lock); unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_READ, retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_READ,
__pa(pdc_result), pci_addr, pci_size); __pa(pdc_result), pci_addr, pci_size);
switch(pci_size) { 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,7 +1362,7 @@ int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr)
case 2: *(u16 *)mem_addr = (u16) pdc_result[0]; case 2: *(u16 *)mem_addr = (u16) pdc_result[0];
case 4: *(u32 *)mem_addr = (u32) pdc_result[0]; case 4: *(u32 *)mem_addr = (u32) pdc_result[0];
} }
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
...@@ -1321,11 +1378,12 @@ int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr) ...@@ -1321,11 +1378,12 @@ int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr)
int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val) int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val)
{ {
int retval; int retval;
unsigned long flags;
spin_lock_irq(&pdc_lock); spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_WRITE, retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_WRITE,
pci_addr, pci_size, val); pci_addr, pci_size, val);
spin_unlock_irq(&pdc_lock); spin_unlock_irqrestore(&pdc_lock, flags);
return retval; return retval;
} }
......
...@@ -319,13 +319,15 @@ void __init time_init(void) ...@@ -319,13 +319,15 @@ void __init time_init(void)
start_cpu_itimer(); /* get CPU 0 started */ start_cpu_itimer(); /* get CPU 0 started */
if(pdc_tod_read(&tod_data) == 0) { if (pdc_tod_read(&tod_data) == 0) {
write_seqlock_irq(&xtime_lock); unsigned long flags;
write_seqlock_irqsave(&xtime_lock, flags);
xtime.tv_sec = tod_data.tod_sec; xtime.tv_sec = tod_data.tod_sec;
xtime.tv_nsec = tod_data.tod_usec * 1000; xtime.tv_nsec = tod_data.tod_usec * 1000;
set_normalized_timespec(&wall_to_monotonic, set_normalized_timespec(&wall_to_monotonic,
-xtime.tv_sec, -xtime.tv_nsec); -xtime.tv_sec, -xtime.tv_nsec);
write_sequnlock_irq(&xtime_lock); write_sequnlock_irqrestore(&xtime_lock, flags);
} else { } else {
printk(KERN_ERR "Error reading tod clock\n"); printk(KERN_ERR "Error reading tod clock\n");
xtime.tv_sec = 0; xtime.tv_sec = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment