Commit 60798c6a authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Paul Mackerras

powerpc: cleanup iseries irq.c

Remove two useless counters.
DeStropify.
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
parent 2c5bd01f
...@@ -42,69 +42,50 @@ ...@@ -42,69 +42,50 @@
#include "irq.h" #include "irq.h"
#include "call_pci.h" #include "call_pci.h"
static long Pci_Interrupt_Count; enum pci_event_type {
static long Pci_Event_Count; pe_bus_created = 0, /* PHB has been created */
pe_bus_error = 1, /* PHB has failed */
enum XmPciLpEvent_Subtype { pe_bus_failed = 2, /* Msg to Secondary, Primary failed bus */
XmPciLpEvent_BusCreated = 0, // PHB has been created pe_node_failed = 4, /* Multi-adapter bridge has failed */
XmPciLpEvent_BusError = 1, // PHB has failed pe_node_recovered = 5, /* Multi-adapter bridge has recovered */
XmPciLpEvent_BusFailed = 2, // Msg to Secondary, Primary failed bus pe_bus_recovered = 12, /* PHB has been recovered */
XmPciLpEvent_NodeFailed = 4, // Multi-adapter bridge has failed pe_unquiese_bus = 18, /* Secondary bus unqiescing */
XmPciLpEvent_NodeRecovered = 5, // Multi-adapter bridge has recovered pe_bridge_error = 21, /* Bridge Error */
XmPciLpEvent_BusRecovered = 12, // PHB has been recovered pe_slot_interrupt = 22 /* Slot interrupt */
XmPciLpEvent_UnQuiesceBus = 18, // Secondary bus unqiescing
XmPciLpEvent_BridgeError = 21, // Bridge Error
XmPciLpEvent_SlotInterrupt = 22 // Slot interrupt
}; };
struct XmPciLpEvent_BusInterrupt { struct pci_event {
HvBusNumber busNumber; struct HvLpEvent event;
HvSubBusNumber subBusNumber;
};
struct XmPciLpEvent_NodeInterrupt {
HvBusNumber busNumber;
HvSubBusNumber subBusNumber;
HvAgentId deviceId;
};
struct XmPciLpEvent {
struct HvLpEvent hvLpEvent;
union { union {
u64 alignData; // Align on an 8-byte boundary u64 __align; /* Align on an 8-byte boundary */
struct { struct {
u32 fisr; u32 fisr;
HvBusNumber busNumber; HvBusNumber bus_number;
HvSubBusNumber subBusNumber; HvSubBusNumber sub_bus_number;
HvAgentId deviceId; HvAgentId dev_id;
} slotInterrupt; } slot;
struct {
struct XmPciLpEvent_BusInterrupt busFailed; HvBusNumber bus_number;
struct XmPciLpEvent_BusInterrupt busRecovered; HvSubBusNumber sub_bus_number;
struct XmPciLpEvent_BusInterrupt busCreated; } bus;
struct {
struct XmPciLpEvent_NodeInterrupt nodeFailed; HvBusNumber bus_number;
struct XmPciLpEvent_NodeInterrupt nodeRecovered; HvSubBusNumber sub_bus_number;
HvAgentId dev_id;
} eventData; } node;
} data;
}; };
static void intReceived(struct XmPciLpEvent *eventParm, static void int_received(struct pci_event *event, struct pt_regs *regs)
struct pt_regs *regsParm)
{ {
int irq; int irq;
#ifdef CONFIG_IRQSTACKS #ifdef CONFIG_IRQSTACKS
struct thread_info *curtp, *irqtp; struct thread_info *curtp, *irqtp;
#endif #endif
++Pci_Interrupt_Count; switch (event->event.xSubtype) {
case pe_slot_interrupt:
switch (eventParm->hvLpEvent.xSubtype) { irq = event->event.xCorrelationToken;
case XmPciLpEvent_SlotInterrupt:
irq = eventParm->hvLpEvent.xCorrelationToken;
/* Dispatch the interrupt handlers for this irq */ /* Dispatch the interrupt handlers for this irq */
#ifdef CONFIG_IRQSTACKS #ifdef CONFIG_IRQSTACKS
/* Switch to the irq stack to handle this */ /* Switch to the irq stack to handle this */
...@@ -113,83 +94,78 @@ static void intReceived(struct XmPciLpEvent *eventParm, ...@@ -113,83 +94,78 @@ static void intReceived(struct XmPciLpEvent *eventParm,
if (curtp != irqtp) { if (curtp != irqtp) {
irqtp->task = curtp->task; irqtp->task = curtp->task;
irqtp->flags = 0; irqtp->flags = 0;
call___do_IRQ(irq, regsParm, irqtp); call___do_IRQ(irq, regs, irqtp);
irqtp->task = NULL; irqtp->task = NULL;
if (irqtp->flags) if (irqtp->flags)
set_bits(irqtp->flags, &curtp->flags); set_bits(irqtp->flags, &curtp->flags);
} else } else
#endif #endif
__do_IRQ(irq, regsParm); __do_IRQ(irq, regs);
HvCallPci_eoi(eventParm->eventData.slotInterrupt.busNumber, HvCallPci_eoi(event->data.slot.bus_number,
eventParm->eventData.slotInterrupt.subBusNumber, event->data.slot.sub_bus_number,
eventParm->eventData.slotInterrupt.deviceId); event->data.slot.dev_id);
break; break;
/* Ignore error recovery events for now */ /* Ignore error recovery events for now */
case XmPciLpEvent_BusCreated: case pe_bus_created:
printk(KERN_INFO "intReceived: system bus %d created\n", printk(KERN_INFO "int_received: system bus %d created\n",
eventParm->eventData.busCreated.busNumber); event->data.bus.bus_number);
break; break;
case XmPciLpEvent_BusError: case pe_bus_error:
case XmPciLpEvent_BusFailed: case pe_bus_failed:
printk(KERN_INFO "intReceived: system bus %d failed\n", printk(KERN_INFO "int_received: system bus %d failed\n",
eventParm->eventData.busFailed.busNumber); event->data.bus.bus_number);
break; break;
case XmPciLpEvent_BusRecovered: case pe_bus_recovered:
case XmPciLpEvent_UnQuiesceBus: case pe_unquiese_bus:
printk(KERN_INFO "intReceived: system bus %d recovered\n", printk(KERN_INFO "int_received: system bus %d recovered\n",
eventParm->eventData.busRecovered.busNumber); event->data.bus.bus_number);
break; break;
case XmPciLpEvent_NodeFailed: case pe_node_failed:
case XmPciLpEvent_BridgeError: case pe_bridge_error:
printk(KERN_INFO printk(KERN_INFO
"intReceived: multi-adapter bridge %d/%d/%d failed\n", "int_received: multi-adapter bridge %d/%d/%d failed\n",
eventParm->eventData.nodeFailed.busNumber, event->data.node.bus_number,
eventParm->eventData.nodeFailed.subBusNumber, event->data.node.sub_bus_number,
eventParm->eventData.nodeFailed.deviceId); event->data.node.dev_id);
break; break;
case XmPciLpEvent_NodeRecovered: case pe_node_recovered:
printk(KERN_INFO printk(KERN_INFO
"intReceived: multi-adapter bridge %d/%d/%d recovered\n", "int_received: multi-adapter bridge %d/%d/%d recovered\n",
eventParm->eventData.nodeRecovered.busNumber, event->data.node.bus_number,
eventParm->eventData.nodeRecovered.subBusNumber, event->data.node.sub_bus_number,
eventParm->eventData.nodeRecovered.deviceId); event->data.node.dev_id);
break; break;
default: default:
printk(KERN_ERR printk(KERN_ERR
"intReceived: unrecognized event subtype 0x%x\n", "int_received: unrecognized event subtype 0x%x\n",
eventParm->hvLpEvent.xSubtype); event->event.xSubtype);
break; break;
} }
} }
static void XmPciLpEvent_handler(struct HvLpEvent *eventParm, static void pci_event_handler(struct HvLpEvent *event, struct pt_regs *regs)
struct pt_regs *regsParm)
{ {
#ifdef CONFIG_PCI if (event && (event->xType == HvLpEvent_Type_PciIo)) {
++Pci_Event_Count; switch (event->xFlags.xFunction) {
if (eventParm && (eventParm->xType == HvLpEvent_Type_PciIo)) {
switch (eventParm->xFlags.xFunction) {
case HvLpEvent_Function_Int: case HvLpEvent_Function_Int:
intReceived((struct XmPciLpEvent *)eventParm, regsParm); int_received((struct pci_event *)event, regs);
break; break;
case HvLpEvent_Function_Ack: case HvLpEvent_Function_Ack:
printk(KERN_ERR printk(KERN_ERR
"XmPciLpEvent_handler: unexpected ack received\n"); "pci_event_handler: unexpected ack received\n");
break; break;
default: default:
printk(KERN_ERR printk(KERN_ERR
"XmPciLpEvent_handler: unexpected event function %d\n", "pci_event_handler: unexpected event function %d\n",
(int)eventParm->xFlags.xFunction); (int)event->xFlags.xFunction);
break; break;
} }
} else if (eventParm) } else if (event)
printk(KERN_ERR printk(KERN_ERR
"XmPciLpEvent_handler: Unrecognized PCI event type 0x%x\n", "pci_event_handler: Unrecognized PCI event type 0x%x\n",
(int)eventParm->xType); (int)event->xType);
else else
printk(KERN_ERR "XmPciLpEvent_handler: NULL event received\n"); printk(KERN_ERR "pci_event_handler: NULL event received\n");
#endif
} }
/* /*
...@@ -199,18 +175,18 @@ static void XmPciLpEvent_handler(struct HvLpEvent *eventParm, ...@@ -199,18 +175,18 @@ static void XmPciLpEvent_handler(struct HvLpEvent *eventParm,
void __init iSeries_init_IRQ(void) void __init iSeries_init_IRQ(void)
{ {
/* Register PCI event handler and open an event path */ /* Register PCI event handler and open an event path */
int xRc; int ret;
xRc = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo, ret = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo,
&XmPciLpEvent_handler); &pci_event_handler);
if (xRc == 0) { if (ret == 0) {
xRc = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0); ret = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0);
if (xRc != 0) if (ret != 0)
printk(KERN_ERR "iSeries_init_IRQ: open event path " printk(KERN_ERR "iseries_init_IRQ: open event path "
"failed with rc 0x%x\n", xRc); "failed with rc 0x%x\n", ret);
} else } else
printk(KERN_ERR "iSeries_init_IRQ: register handler " printk(KERN_ERR "iseries_init_IRQ: register handler "
"failed with rc 0x%x\n", xRc); "failed with rc 0x%x\n", ret);
} }
#define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1) #define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1)
...@@ -221,40 +197,40 @@ void __init iSeries_init_IRQ(void) ...@@ -221,40 +197,40 @@ void __init iSeries_init_IRQ(void)
* This will be called by device drivers (via enable_IRQ) * This will be called by device drivers (via enable_IRQ)
* to enable INTA in the bridge interrupt status register. * to enable INTA in the bridge interrupt status register.
*/ */
static void iSeries_enable_IRQ(unsigned int irq) static void iseries_enable_IRQ(unsigned int irq)
{ {
u32 bus, deviceId, function, mask; u32 bus, dev_id, function, mask;
const u32 subBus = 0; const u32 sub_bus = 0;
unsigned int rirq = virt_irq_to_real_map[irq]; unsigned int rirq = virt_irq_to_real_map[irq];
/* The IRQ has already been locked by the caller */ /* The IRQ has already been locked by the caller */
bus = REAL_IRQ_TO_BUS(rirq); bus = REAL_IRQ_TO_BUS(rirq);
function = REAL_IRQ_TO_FUNC(rirq); function = REAL_IRQ_TO_FUNC(rirq);
deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
/* Unmask secondary INTA */ /* Unmask secondary INTA */
mask = 0x80000000; mask = 0x80000000;
HvCallPci_unmaskInterrupts(bus, subBus, deviceId, mask); HvCallPci_unmaskInterrupts(bus, sub_bus, dev_id, mask);
} }
/* This is called by iSeries_activate_IRQs */ /* This is called by iseries_activate_IRQs */
static unsigned int iSeries_startup_IRQ(unsigned int irq) static unsigned int iseries_startup_IRQ(unsigned int irq)
{ {
u32 bus, deviceId, function, mask; u32 bus, dev_id, function, mask;
const u32 subBus = 0; const u32 sub_bus = 0;
unsigned int rirq = virt_irq_to_real_map[irq]; unsigned int rirq = virt_irq_to_real_map[irq];
bus = REAL_IRQ_TO_BUS(rirq); bus = REAL_IRQ_TO_BUS(rirq);
function = REAL_IRQ_TO_FUNC(rirq); function = REAL_IRQ_TO_FUNC(rirq);
deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
/* Link the IRQ number to the bridge */ /* Link the IRQ number to the bridge */
HvCallXm_connectBusUnit(bus, subBus, deviceId, irq); HvCallXm_connectBusUnit(bus, sub_bus, dev_id, irq);
/* Unmask bridge interrupts in the FISR */ /* Unmask bridge interrupts in the FISR */
mask = 0x01010000 << function; mask = 0x01010000 << function;
HvCallPci_unmaskFisr(bus, subBus, deviceId, mask); HvCallPci_unmaskFisr(bus, sub_bus, dev_id, mask);
iSeries_enable_IRQ(irq); iseries_enable_IRQ(irq);
return 0; return 0;
} }
...@@ -279,76 +255,76 @@ void __init iSeries_activate_IRQs() ...@@ -279,76 +255,76 @@ void __init iSeries_activate_IRQs()
} }
/* this is not called anywhere currently */ /* this is not called anywhere currently */
static void iSeries_shutdown_IRQ(unsigned int irq) static void iseries_shutdown_IRQ(unsigned int irq)
{ {
u32 bus, deviceId, function, mask; u32 bus, dev_id, function, mask;
const u32 subBus = 0; const u32 sub_bus = 0;
unsigned int rirq = virt_irq_to_real_map[irq]; unsigned int rirq = virt_irq_to_real_map[irq];
/* irq should be locked by the caller */ /* irq should be locked by the caller */
bus = REAL_IRQ_TO_BUS(rirq); bus = REAL_IRQ_TO_BUS(rirq);
function = REAL_IRQ_TO_FUNC(rirq); function = REAL_IRQ_TO_FUNC(rirq);
deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
/* Invalidate the IRQ number in the bridge */ /* Invalidate the IRQ number in the bridge */
HvCallXm_connectBusUnit(bus, subBus, deviceId, 0); HvCallXm_connectBusUnit(bus, sub_bus, dev_id, 0);
/* Mask bridge interrupts in the FISR */ /* Mask bridge interrupts in the FISR */
mask = 0x01010000 << function; mask = 0x01010000 << function;
HvCallPci_maskFisr(bus, subBus, deviceId, mask); HvCallPci_maskFisr(bus, sub_bus, dev_id, mask);
} }
/* /*
* This will be called by device drivers (via disable_IRQ) * This will be called by device drivers (via disable_IRQ)
* to disable INTA in the bridge interrupt status register. * to disable INTA in the bridge interrupt status register.
*/ */
static void iSeries_disable_IRQ(unsigned int irq) static void iseries_disable_IRQ(unsigned int irq)
{ {
u32 bus, deviceId, function, mask; u32 bus, dev_id, function, mask;
const u32 subBus = 0; const u32 sub_bus = 0;
unsigned int rirq = virt_irq_to_real_map[irq]; unsigned int rirq = virt_irq_to_real_map[irq];
/* The IRQ has already been locked by the caller */ /* The IRQ has already been locked by the caller */
bus = REAL_IRQ_TO_BUS(rirq); bus = REAL_IRQ_TO_BUS(rirq);
function = REAL_IRQ_TO_FUNC(rirq); function = REAL_IRQ_TO_FUNC(rirq);
deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
/* Mask secondary INTA */ /* Mask secondary INTA */
mask = 0x80000000; mask = 0x80000000;
HvCallPci_maskInterrupts(bus, subBus, deviceId, mask); HvCallPci_maskInterrupts(bus, sub_bus, dev_id, mask);
} }
/* /*
* This does nothing because there is not enough information * This does nothing because there is not enough information
* provided to do the EOI HvCall. This is done by XmPciLpEvent.c * provided to do the EOI HvCall. This is done by XmPciLpEvent.c
*/ */
static void iSeries_end_IRQ(unsigned int irq) static void iseries_end_IRQ(unsigned int irq)
{ {
} }
static hw_irq_controller iSeries_IRQ_handler = { static hw_irq_controller iSeries_IRQ_handler = {
.typename = "iSeries irq controller", .typename = "iSeries irq controller",
.startup = iSeries_startup_IRQ, .startup = iseries_startup_IRQ,
.shutdown = iSeries_shutdown_IRQ, .shutdown = iseries_shutdown_IRQ,
.enable = iSeries_enable_IRQ, .enable = iseries_enable_IRQ,
.disable = iSeries_disable_IRQ, .disable = iseries_disable_IRQ,
.end = iSeries_end_IRQ .end = iseries_end_IRQ
}; };
/* /*
* This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot * This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot
* It calculates the irq value for the slot. * It calculates the irq value for the slot.
* Note that subBusNumber is always 0 (at the moment at least). * Note that sub_bus_number is always 0 (at the moment at least).
*/ */
int __init iSeries_allocate_IRQ(HvBusNumber busNumber, int __init iSeries_allocate_IRQ(HvBusNumber bus_number,
HvSubBusNumber subBusNumber, HvAgentId deviceId) HvSubBusNumber sub_bus_number, HvAgentId dev_id)
{ {
int virtirq; int virtirq;
unsigned int realirq; unsigned int realirq;
u8 idsel = (deviceId >> 4); u8 idsel = (dev_id >> 4);
u8 function = deviceId & 7; u8 function = dev_id & 7;
realirq = ((busNumber - 1) << 6) + ((idsel - 1) << 3) + function; realirq = ((bus_number - 1) << 6) + ((idsel - 1) << 3) + function;
virtirq = virt_irq_create_mapping(realirq); virtirq = virt_irq_create_mapping(realirq);
irq_desc[virtirq].handler = &iSeries_IRQ_handler; irq_desc[virtirq].handler = &iSeries_IRQ_handler;
......
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