x86: irq: Move irq_router to a per driver priv

At present irq_router is declared as a static struct irq_router in
arch/x86/cpu/irq.c. Since it's a driver control block, it makes sense
to move it to a per driver priv. Adjust existing APIs to accept an
additional parameter of irq_router's udevice.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
diff --git a/arch/x86/lib/pirq_routing.c b/arch/x86/lib/pirq_routing.c
index ba41169..3cc6adb 100644
--- a/arch/x86/lib/pirq_routing.c
+++ b/arch/x86/lib/pirq_routing.c
@@ -14,7 +14,7 @@
 
 static bool irq_already_routed[16];
 
-static u8 pirq_get_next_free_irq(u8 *pirq, u16 bitmap)
+static u8 pirq_get_next_free_irq(struct udevice *dev, u8 *pirq, u16 bitmap)
 {
 	int i, link;
 	u8 irq = 0;
@@ -33,7 +33,7 @@
 			continue;
 
 		for (link = 0; link < CONFIG_MAX_PIRQ_LINKS; link++) {
-			if (pirq_check_irq_routed(link, irq)) {
+			if (pirq_check_irq_routed(dev, link, irq)) {
 				irq_already_routed[irq] = true;
 				break;
 			}
@@ -52,7 +52,7 @@
 	return irq;
 }
 
-void pirq_route_irqs(struct irq_info *irq, int num)
+void pirq_route_irqs(struct udevice *dev, struct irq_info *irq, int num)
 {
 	unsigned char irq_slot[MAX_INTX_ENTRIES];
 	unsigned char pirq[CONFIG_MAX_PIRQ_LINKS];
@@ -80,11 +80,11 @@
 			}
 
 			/* translate link value to link number */
-			link = pirq_translate_link(link);
+			link = pirq_translate_link(dev, link);
 
 			/* yet not routed */
 			if (!pirq[link]) {
-				irq = pirq_get_next_free_irq(pirq, bitmap);
+				irq = pirq_get_next_free_irq(dev, pirq, bitmap);
 				pirq[link] = irq;
 			} else {
 				irq = pirq[link];
@@ -94,7 +94,7 @@
 			irq_slot[intx] = irq;
 
 			/* Assign IRQ in the interrupt router */
-			pirq_assign_irq(link, irq);
+			pirq_assign_irq(dev, link, irq);
 		}
 
 		/* Bus, device, slots IRQs for {A,B,C,D} */