Commit ff3df54e authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'irq-fixes' of git://git.parisc-linux.org/git/linux-2.6

* 'irq-fixes' of git://git.parisc-linux.org/git/linux-2.6:
  [PARISC] More pt_regs removal
  [PARISC] pdc_init no longer exists
  [PARISC] Make firmware calls irqsafe-ish...
  [PA-RISC] Fix boot breakage
  [PARISC] Use set_irq_regs
parents c7111c13 c7753f18
...@@ -424,7 +424,7 @@ struct parisc_device * create_tree_node(char id, struct device *parent) ...@@ -424,7 +424,7 @@ struct parisc_device * create_tree_node(char id, struct device *parent)
/* make the generic dma mask a pointer to the parisc one */ /* make the generic dma mask a pointer to the parisc one */
dev->dev.dma_mask = &dev->dma_mask; dev->dev.dma_mask = &dev->dma_mask;
dev->dev.coherent_dma_mask = dev->dma_mask; dev->dev.coherent_dma_mask = dev->dma_mask;
if (!device_register(&dev->dev)) { if (device_register(&dev->dev)) {
kfree(dev); kfree(dev);
return NULL; return NULL;
} }
...@@ -853,9 +853,9 @@ static void print_parisc_device(struct parisc_device *dev) ...@@ -853,9 +853,9 @@ static void print_parisc_device(struct parisc_device *dev)
*/ */
void init_parisc_bus(void) void init_parisc_bus(void)
{ {
if (!bus_register(&parisc_bus_type)) if (bus_register(&parisc_bus_type))
panic("Could not register PA-RISC bus type\n"); panic("Could not register PA-RISC bus type\n");
if (!device_register(&root)) if (device_register(&root))
panic("Could not register PA-RISC root device\n"); panic("Could not register PA-RISC root device\n");
get_device(&root); get_device(&root);
} }
......
...@@ -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;
} }
......
...@@ -347,12 +347,14 @@ static inline int eirr_to_irq(unsigned long eirr) ...@@ -347,12 +347,14 @@ static inline int eirr_to_irq(unsigned long eirr)
/* ONLY called from entry.S:intr_extint() */ /* ONLY called from entry.S:intr_extint() */
void do_cpu_irq_mask(struct pt_regs *regs) void do_cpu_irq_mask(struct pt_regs *regs)
{ {
struct pt_regs *old_regs;
unsigned long eirr_val; unsigned long eirr_val;
int irq, cpu = smp_processor_id(); int irq, cpu = smp_processor_id();
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
cpumask_t dest; cpumask_t dest;
#endif #endif
old_regs = set_irq_regs(regs);
local_irq_disable(); local_irq_disable();
irq_enter(); irq_enter();
...@@ -379,6 +381,7 @@ void do_cpu_irq_mask(struct pt_regs *regs) ...@@ -379,6 +381,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
out: out:
irq_exit(); irq_exit();
set_irq_regs(old_regs);
return; return;
set_out: set_out:
......
...@@ -154,7 +154,7 @@ halt_processor(void) ...@@ -154,7 +154,7 @@ halt_processor(void)
irqreturn_t irqreturn_t
ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs) ipi_interrupt(int irq, void *dev_id)
{ {
int this_cpu = smp_processor_id(); int this_cpu = smp_processor_id();
struct cpuinfo_parisc *p = &cpu_data[this_cpu]; struct cpuinfo_parisc *p = &cpu_data[this_cpu];
...@@ -414,19 +414,6 @@ smp_flush_tlb_all(void) ...@@ -414,19 +414,6 @@ smp_flush_tlb_all(void)
on_each_cpu(flush_tlb_all_local, NULL, 1, 1); on_each_cpu(flush_tlb_all_local, NULL, 1, 1);
} }
void
smp_do_timer(struct pt_regs *regs)
{
int cpu = smp_processor_id();
struct cpuinfo_parisc *data = &cpu_data[cpu];
if (!--data->prof_counter) {
data->prof_counter = data->prof_multiplier;
update_process_times(user_mode(regs));
}
}
/* /*
* Called by secondaries to update state and initialize CPU registers. * Called by secondaries to update state and initialize CPU registers.
*/ */
......
...@@ -34,10 +34,6 @@ ...@@ -34,10 +34,6 @@
static unsigned long clocktick __read_mostly; /* timer cycles per tick */ static unsigned long clocktick __read_mostly; /* timer cycles per tick */
#ifdef CONFIG_SMP
extern void smp_do_timer(struct pt_regs *regs);
#endif
/* /*
* We keep time on PA-RISC Linux by using the Interval Timer which is * We keep time on PA-RISC Linux by using the Interval Timer which is
* a pair of registers; one is read-only and one is write-only; both * a pair of registers; one is read-only and one is write-only; both
...@@ -55,13 +51,14 @@ extern void smp_do_timer(struct pt_regs *regs); ...@@ -55,13 +51,14 @@ extern void smp_do_timer(struct pt_regs *regs);
* held off for an arbitrarily long period of time by interrupts being * held off for an arbitrarily long period of time by interrupts being
* disabled, so we may miss one or more ticks. * disabled, so we may miss one or more ticks.
*/ */
irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) irqreturn_t timer_interrupt(int irq, void *dev_id)
{ {
unsigned long now; unsigned long now;
unsigned long next_tick; unsigned long next_tick;
unsigned long cycles_elapsed, ticks_elapsed; unsigned long cycles_elapsed, ticks_elapsed;
unsigned long cycles_remainder; unsigned long cycles_remainder;
unsigned int cpu = smp_processor_id(); unsigned int cpu = smp_processor_id();
struct cpuinfo_parisc *cpuinfo = &cpu_data[cpu];
/* gcc can optimize for "read-only" case with a local clocktick */ /* gcc can optimize for "read-only" case with a local clocktick */
unsigned long cpt = clocktick; unsigned long cpt = clocktick;
...@@ -69,7 +66,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -69,7 +66,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
profile_tick(CPU_PROFILING); profile_tick(CPU_PROFILING);
/* Initialize next_tick to the expected tick time. */ /* Initialize next_tick to the expected tick time. */
next_tick = cpu_data[cpu].it_value; next_tick = cpuinfo->it_value;
/* Get current interval timer. /* Get current interval timer.
* CR16 reads as 64 bits in CPU wide mode. * CR16 reads as 64 bits in CPU wide mode.
...@@ -120,7 +117,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -120,7 +117,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
*/ */
next_tick = now + cycles_remainder; next_tick = now + cycles_remainder;
cpu_data[cpu].it_value = next_tick; cpuinfo->it_value = next_tick;
/* Skip one clocktick on purpose if we are likely to miss next_tick. /* Skip one clocktick on purpose if we are likely to miss next_tick.
* We want to avoid the new next_tick being less than CR16. * We want to avoid the new next_tick being less than CR16.
...@@ -131,18 +128,19 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -131,18 +128,19 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
next_tick += cpt; next_tick += cpt;
/* Program the IT when to deliver the next interrupt. */ /* Program the IT when to deliver the next interrupt. */
/* Only bottom 32-bits of next_tick are written to cr16. */ /* Only bottom 32-bits of next_tick are written to cr16. */
mtctl(next_tick, 16); mtctl(next_tick, 16);
/* Done mucking with unreliable delivery of interrupts. /* Done mucking with unreliable delivery of interrupts.
* Go do system house keeping. * Go do system house keeping.
*/ */
#ifdef CONFIG_SMP
smp_do_timer(regs); if (!--cpuinfo->prof_counter) {
#else cpuinfo->prof_counter = cpuinfo->prof_multiplier;
update_process_times(user_mode(regs)); update_process_times(user_mode(get_irq_regs()));
#endif }
if (cpu == 0) { if (cpu == 0) {
write_seqlock(&xtime_lock); write_seqlock(&xtime_lock);
do_timer(ticks_elapsed); do_timer(ticks_elapsed);
...@@ -319,13 +317,15 @@ void __init time_init(void) ...@@ -319,13 +317,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;
......
...@@ -774,8 +774,6 @@ int pdc_sti_call(unsigned long func, unsigned long flags, ...@@ -774,8 +774,6 @@ int pdc_sti_call(unsigned long func, unsigned long flags,
unsigned long inptr, unsigned long outputr, unsigned long inptr, unsigned long outputr,
unsigned long glob_cfg); unsigned long glob_cfg);
extern void pdc_init(void);
static inline char * os_id_to_string(u16 os_id) { static inline char * os_id_to_string(u16 os_id) {
switch(os_id) { switch(os_id) {
case OS_ID_NONE: return "No OS"; case OS_ID_NONE: return "No OS";
......
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