All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/4] x86: Add a function to assign IRQ numbers to PCI device
       [not found] <1429870206-18792-1-git-send-email-bmeng.cn@gmail.com>
@ 2015-04-24 10:10 ` Bin Meng
  2015-04-25 14:18   ` Simon Glass
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 2/4] x86: Write configuration tables in last_stage_init() Bin Meng
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Bin Meng @ 2015-04-24 10:10 UTC (permalink / raw)
  To: u-boot

Add a function to assign an IRQ number to PCI device's interrupt
line register in its configuration space, so that the PCI device
can have its interrupt working under PIC mode after OS boots up.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/x86/cpu/pci.c         | 21 +++++++++++++++++++++
 arch/x86/include/asm/pci.h | 14 ++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/arch/x86/cpu/pci.c b/arch/x86/cpu/pci.c
index e23b233..c209f15 100644
--- a/arch/x86/cpu/pci.c
+++ b/arch/x86/cpu/pci.c
@@ -151,3 +151,24 @@ int pci_x86_write_config(struct udevice *bus, pci_dev_t bdf, uint offset,
 
 	return 0;
 }
+
+void pci_assign_irqs(int bus, int device, int func, u8 irq[4])
+{
+	pci_dev_t bdf;
+	u8 pin, line;
+
+	bdf = PCI_BDF(bus, device, func);
+
+	pin = x86_pci_read_config8(bdf, PCI_INTERRUPT_PIN);
+
+	/* PCI spec says all values except 1..4 are reserved */
+	if ((pin < 1) || (pin > 4))
+		return;
+
+	line = irq[pin - 1];
+
+	debug("Assigning IRQ %d to PCI device %d.%x.%d (INT%c)\n",
+	      line, bus, device, func, 'A' + pin - 1);
+
+	x86_pci_write_config8(bdf, PCI_INTERRUPT_LINE, line);
+}
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index a1969ed..56eaa25 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -64,6 +64,20 @@ int pci_x86_read_config(struct udevice *bus, pci_dev_t bdf, uint offset,
 int pci_x86_write_config(struct udevice *bus, pci_dev_t bdf, uint offset,
 			 ulong value, enum pci_size_t size);
 
+/**
+ * Assign IRQ number to a PCI device
+ *
+ * This function assigns IRQ for a PCI device. If the device does not exist
+ * or does not require interrupts then this function has no effect.
+ *
+ * @bus:	PCI bus number
+ * @device:	PCI device number
+ * @func:	PCI function number
+ * @irq:	An array of IRQ numbers that are assigned to INTA through
+ *		INTD of this PCI device.
+ */
+void pci_assign_irqs(int bus, int device, int func, u8 irq[4]);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _PCI_I386_H_ */
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 2/4] x86: Write configuration tables in last_stage_init()
       [not found] <1429870206-18792-1-git-send-email-bmeng.cn@gmail.com>
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 1/4] x86: Add a function to assign IRQ numbers to PCI device Bin Meng
@ 2015-04-24 10:10 ` Bin Meng
  2015-04-25 14:18   ` Simon Glass
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 3/4] x86: Support platform PIRQ routing Bin Meng
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 4/4] x86: queensbay: Implement " Bin Meng
  3 siblings, 1 reply; 9+ messages in thread
From: Bin Meng @ 2015-04-24 10:10 UTC (permalink / raw)
  To: u-boot

We can write the configuration table in last_stage_init() for all x86
boards, but not with coreboot since coreboot already has them.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/x86/cpu/cpu.c            | 10 +++++++++
 arch/x86/include/asm/tables.h | 49 +++++++++++++++++++++++++++++++++++++++++++
 arch/x86/lib/Makefile         |  1 +
 arch/x86/lib/tables.c         | 30 ++++++++++++++++++++++++++
 include/configs/x86-common.h  |  1 +
 5 files changed, 91 insertions(+)
 create mode 100644 arch/x86/include/asm/tables.h
 create mode 100644 arch/x86/lib/tables.c

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index a9ca50b..c9614f1 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -29,6 +29,7 @@
 #include <asm/processor.h>
 #include <asm/processor-flags.h>
 #include <asm/interrupt.h>
+#include <asm/tables.h>
 #include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -593,3 +594,12 @@ void show_boot_progress(int val)
 #endif
 	outb(val, POST_PORT);
 }
+
+#ifndef CONFIG_SYS_COREBOOT
+int last_stage_init(void)
+{
+	write_tables();
+
+	return 0;
+}
+#endif
diff --git a/arch/x86/include/asm/tables.h b/arch/x86/include/asm/tables.h
new file mode 100644
index 0000000..8146ba3
--- /dev/null
+++ b/arch/x86/include/asm/tables.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _X86_TABLES_H_
+#define _X86_TABLES_H_
+
+/*
+ * All x86 tables happen to like the address range from 0xf0000 to 0x100000.
+ * We use 0xf0000 as the starting address to store those tables, including
+ * PIRQ routing table, Multi-Processor table and ACPI table.
+ */
+#define ROM_TABLE_ADDR	0xf0000
+
+/**
+ * table_compute_checksum() - Compute a table checksum
+ *
+ * This computes an 8-bit checksum for the configuration table.
+ * All bytes in the configuration table, including checksum itself and
+ * reserved bytes must add up to zero.
+ *
+ * @v:		configuration table base address
+ * @len:	configuration table size
+ * @return:	the 8-bit checksum
+ */
+u8 table_compute_checksum(void *v, int len);
+
+/**
+ * write_tables() - Write x86 configuration tables
+ *
+ * This writes x86 configuration tables, including PIRQ routing table,
+ * Multi-Processor table and ACPI table. Whether a specific type of
+ * configuration table is written is controlled by a Kconfig option.
+ */
+void write_tables(void);
+
+/**
+ * write_pirq_routing_table() - Write PIRQ routing table
+ *
+ * This writes PIRQ routing table at a given address.
+ *
+ * @start:	start address to write PIRQ routing table
+ * @return:	end address of PIRQ routing table
+ */
+u32 write_pirq_routing_table(u32 start);
+
+#endif /* _X86_TABLES_H_ */
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index e49de05..0de0d89 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -26,6 +26,7 @@ obj-y	+= relocate.o
 obj-y += physmem.o
 obj-$(CONFIG_X86_RAMTEST) += ramtest.o
 obj-y	+= string.o
+obj-y	+= tables.o
 obj-$(CONFIG_SYS_X86_TSC_TIMER)	+= tsc_timer.o
 obj-$(CONFIG_CMD_ZBOOT)	+= zimage.o
 obj-$(CONFIG_HAVE_FSP) += fsp/
diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c
new file mode 100644
index 0000000..b390a4b
--- /dev/null
+++ b/arch/x86/lib/tables.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/tables.h>
+
+u8 table_compute_checksum(void *v, int len)
+{
+	u8 *bytes = v;
+	u8 checksum = 0;
+	int i;
+
+	for (i = 0; i < len; i++)
+		checksum -= bytes[i];
+
+	return checksum;
+}
+
+void write_tables(void)
+{
+	u32 __maybe_unused rom_table_end = ROM_TABLE_ADDR;
+
+#if CONFIG_GENERATE_PIRQ_TABLE
+	rom_table_end = write_pirq_routing_table(rom_table_end);
+	rom_table_end = ALIGN(rom_table_end, 1024);
+#endif
+}
diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h
index 07a5aca..3e21e09 100644
--- a/include/configs/x86-common.h
+++ b/include/configs/x86-common.h
@@ -20,6 +20,7 @@
 #define CONFIG_PHYSMEM
 #define CONFIG_DISPLAY_BOARDINFO_LATE
 #define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_LAST_STAGE_INIT
 
 #define CONFIG_LMB
 #define CONFIG_OF_LIBFDT
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 3/4] x86: Support platform PIRQ routing
       [not found] <1429870206-18792-1-git-send-email-bmeng.cn@gmail.com>
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 1/4] x86: Add a function to assign IRQ numbers to PCI device Bin Meng
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 2/4] x86: Write configuration tables in last_stage_init() Bin Meng
@ 2015-04-24 10:10 ` Bin Meng
  2015-04-25 14:18   ` Simon Glass
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 4/4] x86: queensbay: Implement " Bin Meng
  3 siblings, 1 reply; 9+ messages in thread
From: Bin Meng @ 2015-04-24 10:10 UTC (permalink / raw)
  To: u-boot

On x86 boards, platform chipset receives up to four different
interrupt signals from PCI devices (INTA/B/C/D), which in turn
will be routed to chipset internal PIRQ lines then routed to
8259 PIC finally if configuring the whole system to work under
the so-called PIC mode (in contrast to symmetric IO mode which
uses IOAPIC).

We add two major APIs to aid this, one for routing PIRQ and the
other one for generating a PIRQ routing table.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/x86/Kconfig                    |  31 ++++++++
 arch/x86/include/asm/pirq_routing.h | 139 ++++++++++++++++++++++++++++++++++++
 arch/x86/lib/Makefile               |   1 +
 arch/x86/lib/pirq_routing.c         | 129 +++++++++++++++++++++++++++++++++
 4 files changed, 300 insertions(+)
 create mode 100644 arch/x86/include/asm/pirq_routing.h
 create mode 100644 arch/x86/lib/pirq_routing.c

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3f1401a..aaceaef 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -442,6 +442,37 @@ config TSC_FREQ_IN_MHZ
 	help
 	  The running frequency in MHz of Time-Stamp Counter (TSC).
 
+menu "System tables"
+
+config GENERATE_PIRQ_TABLE
+	bool "Generate a PIRQ table"
+	default n
+	help
+	  Generate a PIRQ routing table for this board. The PIRQ routing table
+	  is generated by U-Boot in the system memory from 0xf0000 to 0xfffff
+	  at every 16-byte boundary with a PCI IRQ routing signature ("$PIR").
+	  It specifies the interrupt router information as well how all the PCI
+	  devices' interrupt pins are wired to PIRQs.
+
+endmenu
+
+config MAX_PIRQ_LINKS
+	int
+	default 8
+	help
+	  This variable specifies the number of PIRQ interrupt links which are
+	  routable. On most older chipsets, this is 4, PIRQA through PIRQD.
+	  Some newer chipsets offer more than four links, commonly up to PIRQH.
+
+config IRQ_SLOT_COUNT
+	int
+	default 128
+	help
+	  U-Boot can support up to 254 IRQ slot info in the PIRQ routing table
+	  which in turns forms a table of exact 4KiB. The default value 128
+	  should be enough for most boards. If this does not fit your board,
+	  change it according to your needs.
+
 source "board/coreboot/coreboot/Kconfig"
 
 source "board/google/chromebook_link/Kconfig"
diff --git a/arch/x86/include/asm/pirq_routing.h b/arch/x86/include/asm/pirq_routing.h
new file mode 100644
index 0000000..ddc08e1
--- /dev/null
+++ b/arch/x86/include/asm/pirq_routing.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * Ported from coreboot src/arch/x86/include/arch/pirq_routing.h
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _PIRQ_ROUTING_H_
+#define _PIRQ_ROUTING_H_
+
+/*
+ * This is the maximum number on interrupt entries that a PCI device may have.
+ *   This is NOT the number of slots or devices in the system
+ *   This is NOT the number of entries in the PIRQ table
+ *
+ * This tells us that in the PIRQ table, we are going to have 4 link-bitmap
+ * entries per PCI device which is fixed at 4: INTA, INTB, INTC, and INTD.
+ *
+ * CAUTION: If you change this, PIRQ routing will not work correctly.
+ */
+#define MAX_INTX_ENTRIES	4
+
+#define PIRQ_SIGNATURE		\
+	(('$' << 0) + ('P' << 8) + ('I' << 16) + ('R' << 24))
+#define PIRQ_VERSION		0x0100
+
+struct __packed irq_info {
+	u8 bus;			/* Bus number */
+	u8 devfn;		/* Device and function number */
+	struct __packed {
+		u8 link;	/* IRQ line ID, 0=not routed */
+		u16 bitmap;	/* Available IRQs */
+	} irq[MAX_INTX_ENTRIES];
+	u8 slot;		/* Slot number, 0=onboard */
+	u8 rfu;
+};
+
+struct __packed irq_routing_table {
+	u32 signature;		/* PIRQ_SIGNATURE */
+	u16 version;		/* PIRQ_VERSION */
+	u16 size;		/* Table size in bytes */
+	u8 rtr_bus;		/* busno of the interrupt router */
+	u8 rtr_devfn;		/* devfn of the interrupt router */
+	u16 exclusive_irqs;	/* IRQs devoted exclusively to PCI usage */
+	u16 rtr_vendor;		/* Vendor ID of the interrupt router */
+	u16 rtr_device;		/* Device ID of the interrupt router */
+	u32 miniport_data;
+	u8 rfu[11];
+	u8 checksum;		/* Modulo 256 checksum must give zero */
+	struct irq_info slots[CONFIG_IRQ_SLOT_COUNT];
+};
+
+/**
+ * get_irq_slot_count() - Get the number of entries in the irq_info table
+ *
+ * This calculates the number of entries for the irq_info table.
+ *
+ * @rt:		pointer to the base address of the struct irq_info
+ * @return:	number of entries
+ */
+static inline int get_irq_slot_count(struct irq_routing_table *rt)
+{
+	return (rt->size - 32) / sizeof(struct irq_info);
+}
+
+/**
+ * pirq_check_irq_routed() - Check whether an IRQ is routed to 8259 PIC
+ *
+ * This function checks whether an IRQ is routed to 8259 PIC for a given link.
+ *
+ * Note: this function should be provided by the platform codes, as the
+ * implementation of interrupt router may be different.
+ *
+ * @link:	link number which represents a PIRQ
+ * @irq:	the 8259 IRQ number
+ * @return:	true if the irq is already routed to 8259 for a given link,
+ *		false elsewise
+ */
+bool pirq_check_irq_routed(int link, u8 irq);
+
+/**
+ * pirq_translate_link() - Translate a link value
+ *
+ * This function translates a platform-specific link value to a link number.
+ * On Intel platforms, the link value is normally a offset into the PCI
+ * configuration space into the legacy bridge.
+ *
+ * Note: this function should be provided by the platform codes, as the
+ * implementation of interrupt router may be different.
+ *
+ * @link:	platform-specific link value
+ * @return:	link number which represents a PIRQ
+ */
+int pirq_translate_link(int link);
+
+/**
+ * pirq_assign_irq() - Assign an IRQ to a PIRQ link
+ *
+ * This function assigns the IRQ to a PIRQ link so that the PIRQ is routed to
+ * the 8259 PIC.
+ *
+ * Note: this function should be provided by the platform codes, as the
+ * implementation of interrupt router may be different.
+ *
+ * @link:	link number which represents a PIRQ
+ * @irq:	IRQ to which the PIRQ is routed
+ */
+void pirq_assign_irq(int link, u8 irq);
+
+/**
+ * pirq_route_irqs() - Route PIRQs to 8259 PIC
+ *
+ * This function configures all PCI devices' interrupt pins and maps them to
+ * PIRQs and finally 8259 PIC. The routed irq number is written to interrupt
+ * line register in the configuration space of the PCI device for OS to use.
+ * The configuration source is taken from a struct irq_info table, the format
+ * of which is defined in PIRQ routing table spec and PCI BIOS spec.
+ *
+ * @irq:	pointer to the base address of the struct irq_info
+ * @num:	number of entries in the struct irq_info
+ */
+void pirq_route_irqs(struct irq_info *irq, int num);
+
+/**
+ * copy_pirq_routing_table() - Copy a PIRQ routing table
+ *
+ * This helper function copies the given PIRQ routing table to a given address.
+ * Before copying, it does several sanity tests against the PIRQ routing table.
+ * It also fixes up the table checksum and align the given address to a 16 byte
+ * boundary to meet the PIRQ routing table spec requirements.
+ *
+ * @addr:	address to store the copied PIRQ routing table
+ * @rt:		pointer to the PIRQ routing table to copy from
+ * @return:	end address of the copied PIRQ routing table
+ */
+u32 copy_pirq_routing_table(u32 addr, struct irq_routing_table *rt);
+
+#endif /* _PIRQ_ROUTING_H_ */
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 0de0d89..0178fe1 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -22,6 +22,7 @@ ifndef CONFIG_DM_PCI
 obj-$(CONFIG_PCI) += pci_type1.o
 endif
 obj-y	+= pch-uclass.o
+obj-y	+= pirq_routing.o
 obj-y	+= relocate.o
 obj-y += physmem.o
 obj-$(CONFIG_X86_RAMTEST) += ramtest.o
diff --git a/arch/x86/lib/pirq_routing.c b/arch/x86/lib/pirq_routing.c
new file mode 100644
index 0000000..5a2591a
--- /dev/null
+++ b/arch/x86/lib/pirq_routing.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * Part of this file is ported from coreboot src/arch/x86/boot/pirq_routing.c
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <pci.h>
+#include <asm/pci.h>
+#include <asm/pirq_routing.h>
+#include <asm/tables.h>
+
+static bool irq_already_routed[16];
+
+static u8 pirq_get_next_free_irq(u8 *pirq, u16 bitmap)
+{
+	int i, link;
+	u8 irq = 0;
+
+	/* IRQ sharing starts from IRQ#3 */
+	for (i = 3; i < 16; i++) {
+		/* Can we assign this IRQ? */
+		if (!((bitmap >> i) & 1))
+			continue;
+
+		/* We can, now let's assume we can use this IRQ */
+		irq = i;
+
+		/* Have we already routed it? */
+		if (irq_already_routed[irq])
+			continue;
+
+		for (link = 0; link < CONFIG_MAX_PIRQ_LINKS; link++) {
+			if (pirq_check_irq_routed(link, irq)) {
+				irq_already_routed[irq] = true;
+				break;
+			}
+		}
+
+		/* If it's not yet routed, use it */
+		if (!irq_already_routed[irq]) {
+			irq_already_routed[irq] = true;
+			break;
+		}
+
+		/* But if it was already routed, try the next one */
+	}
+
+	/* Now we get our IRQ */
+	return irq;
+}
+
+void pirq_route_irqs(struct irq_info *irq, int num)
+{
+	unsigned char irq_slot[MAX_INTX_ENTRIES];
+	unsigned char pirq[CONFIG_MAX_PIRQ_LINKS];
+	int i, intx;
+
+	memset(pirq, 0, CONFIG_MAX_PIRQ_LINKS);
+
+	/* Set PCI IRQs */
+	for (i = 0; i < num; i++) {
+		debug("PIRQ Entry %d Dev: %d.%x.%d\n", i,
+		      irq->bus, irq->devfn >> 3, irq->devfn & 7);
+
+		for (intx = 0; intx < MAX_INTX_ENTRIES; intx++) {
+			int link = irq->irq[intx].link;
+			int bitmap = irq->irq[intx].bitmap;
+			int irq = 0;
+
+			debug("INT%c link: %x bitmap: %x ",
+			      'A' + intx, link, bitmap);
+
+			if (!bitmap || !link) {
+				debug("not routed\n");
+				irq_slot[intx] = irq;
+				continue;
+			}
+
+			/* translate link value to link number */
+			link = pirq_translate_link(link);
+
+			/* yet not routed */
+			if (!pirq[link]) {
+				irq = pirq_get_next_free_irq(pirq, bitmap);
+				pirq[link] = irq;
+			} else {
+				irq = pirq[link];
+			}
+
+			debug("IRQ: %d\n", irq);
+			irq_slot[intx] = irq;
+
+			/* Assign IRQ in the interrupt router */
+			pirq_assign_irq(link, irq);
+		}
+
+		/* Bus, device, slots IRQs for {A,B,C,D} */
+		pci_assign_irqs(irq->bus, irq->devfn >> 3, irq->devfn & 7,
+				irq_slot);
+
+		irq++;
+	}
+
+	for (i = 0; i < CONFIG_MAX_PIRQ_LINKS; i++)
+		debug("PIRQ%c: %d\n", 'A' + i, pirq[i]);
+}
+
+u32 copy_pirq_routing_table(u32 addr, struct irq_routing_table *rt)
+{
+	if (rt->signature != PIRQ_SIGNATURE || rt->version != PIRQ_VERSION ||
+	    rt->size % 16) {
+		debug("Interrupt Routing Table not valid\n");
+		return addr;
+	}
+
+	/* Fix up the table checksum */
+	rt->checksum = table_compute_checksum(rt, rt->size);
+
+	/* Align the table to be 16 byte aligned */
+	addr = ALIGN(addr, 16);
+
+	debug("Copying Interrupt Routing Table to 0x%x\n", addr);
+	memcpy((void *)addr, rt, rt->size);
+
+	return addr + rt->size;
+}
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 4/4] x86: queensbay: Implement PIRQ routing
       [not found] <1429870206-18792-1-git-send-email-bmeng.cn@gmail.com>
                   ` (2 preceding siblings ...)
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 3/4] x86: Support platform PIRQ routing Bin Meng
@ 2015-04-24 10:10 ` Bin Meng
  2015-04-24 12:40   ` Simon Glass
  3 siblings, 1 reply; 9+ messages in thread
From: Bin Meng @ 2015-04-24 10:10 UTC (permalink / raw)
  To: u-boot

Implement Intel Queensbay platform-specific PIRQ routing support.
The chipset PIRQ routing setup is called in the arch_misc_init().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

Changes in v2:
- Correct a typo in the commit message
- Use a local variable in fill_irq_info()
- Print a debug message if creating pirq table fails
- Use a C structure for RCBA register access

 arch/x86/cpu/queensbay/Makefile              |   2 +-
 arch/x86/cpu/queensbay/irq.c                 | 242 +++++++++++++++++++++++++++
 arch/x86/cpu/queensbay/tnc.c                 |  10 +-
 arch/x86/include/asm/arch-queensbay/device.h |  94 +++++++++++
 arch/x86/include/asm/arch-queensbay/irq.h    |  55 ++++++
 arch/x86/include/asm/arch-queensbay/tnc.h    |  39 ++++-
 arch/x86/include/asm/u-boot-x86.h            |   2 +
 configs/crownbay_defconfig                   |   1 +
 include/configs/crownbay.h                   |   1 +
 9 files changed, 442 insertions(+), 4 deletions(-)
 create mode 100644 arch/x86/cpu/queensbay/irq.c
 create mode 100644 arch/x86/include/asm/arch-queensbay/device.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/irq.h

diff --git a/arch/x86/cpu/queensbay/Makefile b/arch/x86/cpu/queensbay/Makefile
index d8761fd..4599a48 100644
--- a/arch/x86/cpu/queensbay/Makefile
+++ b/arch/x86/cpu/queensbay/Makefile
@@ -5,5 +5,5 @@
 #
 
 obj-y += fsp_configs.o
-obj-y += tnc.o topcliff.o
+obj-y += irq.o tnc.o topcliff.o
 obj-$(CONFIG_PCI) += tnc_pci.o
diff --git a/arch/x86/cpu/queensbay/irq.c b/arch/x86/cpu/queensbay/irq.c
new file mode 100644
index 0000000..faf9515
--- /dev/null
+++ b/arch/x86/cpu/queensbay/irq.c
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <malloc.h>
+#include <asm/io.h>
+#include <asm/pci.h>
+#include <asm/post.h>
+#include <asm/processor.h>
+#include <asm/pirq_routing.h>
+#include <asm/arch/device.h>
+#include <asm/arch/tnc.h>
+#include <asm/arch/irq.h>
+
+static struct irq_routing_table *pirq_routing_table;
+
+bool pirq_check_irq_routed(int link, u8 irq)
+{
+	u8 pirq;
+
+	pirq = x86_pci_read_config8(TNC_LPC, LINK_N2V(link));
+	pirq &= 0xf;
+
+	/* IRQ# 0/1/2/8/13 are reserved */
+	if (pirq < 3 || pirq == 8 || pirq == 13)
+		return false;
+
+	return pirq == irq ? true : false;
+}
+
+int pirq_translate_link(int link)
+{
+	return LINK_V2N(link);
+}
+
+void pirq_assign_irq(int link, u8 irq)
+{
+	/* IRQ# 0/1/2/8/13 are reserved */
+	if (irq < 3 || irq == 8 || irq == 13)
+		return;
+
+	x86_pci_write_config8(TNC_LPC, LINK_N2V(link), irq);
+}
+
+static inline void fill_irq_info(struct irq_info **slotp, int *entries, u8 bus,
+				 u8 device, u8 func, u8 pin, u8 pirq)
+{
+	struct irq_info *slot = *slotp;
+
+	slot->bus = bus;
+	slot->devfn = (device << 3) | func;
+	slot->irq[pin - 1].link = LINK_N2V(pirq);
+	slot->irq[pin - 1].bitmap = PIRQ_BITMAP;
+	(*entries)++;
+	(*slotp)++;
+}
+
+/* PCIe port downstream INTx swizzle */
+static inline u8 pin_swizzle(u8 pin, int port)
+{
+	return (pin + port) % 4;
+}
+
+__weak int board_fill_irq_info(struct irq_info *slot)
+{
+	return 0;
+}
+
+static int create_pirq_routing_table(void)
+{
+	struct irq_routing_table *rt;
+	struct irq_info *slot;
+	int irq_entries = 0;
+	pci_dev_t tcf_bdf;
+	u8 tcf_bus, bus;
+	int i;
+
+	rt = malloc(sizeof(struct irq_routing_table));
+	if (!rt)
+		return -ENOMEM;
+	memset((char *)rt, 0, sizeof(struct irq_routing_table));
+
+	/* Populate the PIRQ table fields */
+	rt->signature = PIRQ_SIGNATURE;
+	rt->version = PIRQ_VERSION;
+	rt->rtr_bus = 0;
+	rt->rtr_devfn = (TNC_LPC_DEV << 3) | TNC_LPC_FUNC;
+	rt->rtr_vendor = PCI_VENDOR_ID_INTEL;
+	rt->rtr_device = PCI_DEVICE_ID_INTEL_ICH7_31;
+
+	slot = rt->slots;
+
+	/*
+	 * Now fill in the irq_info entries in the PIRQ table
+	 *
+	 * We start from internal TunnelCreek PCI devices first, then
+	 * followed by all the 4 PCIe ports downstream devices, including
+	 * the Queensbay platform Topcliff chipset devices.
+	 */
+	fill_irq_info(&slot, &irq_entries, 0, TNC_IGD_DEV,
+		      TNC_IGD_FUNC, INTA, PIRQE);
+	fill_irq_info(&slot, &irq_entries, 0, TNC_SDVO_DEV,
+		      TNC_SDVO_FUNC, INTA, PIRQF);
+	fill_irq_info(&slot, &irq_entries, 0, TNC_HDA_DEV,
+		      TNC_HDA_FUNC, INTA, PIRQG);
+	fill_irq_info(&slot, &irq_entries, 0, TNC_PCIE0_DEV,
+		      TNC_PCIE0_FUNC, INTA, PIRQE);
+	fill_irq_info(&slot, &irq_entries, 0, TNC_PCIE1_DEV,
+		      TNC_PCIE1_FUNC, INTA, PIRQF);
+	fill_irq_info(&slot, &irq_entries, 0, TNC_PCIE2_DEV,
+		      TNC_PCIE2_FUNC, INTA, PIRQG);
+	fill_irq_info(&slot, &irq_entries, 0, TNC_PCIE3_DEV,
+		      TNC_PCIE3_FUNC, INTA, PIRQH);
+
+	/* Check which PCIe port the Topcliff chipset is connected to */
+	tcf_bdf = pci_find_device(PCI_VENDOR_ID_INTEL, 0x8800, 0);
+	tcf_bus = PCI_BUS(tcf_bdf);
+	for (i = 0; i < 4; i++) {
+		bus = x86_pci_read_config8(PCI_BDF(0, TNC_PCIE0_DEV + i, 0),
+					   PCI_SECONDARY_BUS);
+		if (bus == tcf_bus)
+			break;
+	}
+
+	/* Fill in the Topcliff chipset devices' irq info */
+	if (i < 4) {
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_PCIE_PORT_DEV,
+			      TCF_PCIE_PORT_FUNC, INTA, pin_swizzle(PIRQA, i));
+
+		tcf_bus++;
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_0,
+			      TCF_GBE_FUNC, INTA, pin_swizzle(PIRQA, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_0,
+			      TCF_GPIO_FUNC, INTA, pin_swizzle(PIRQA, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_2,
+			      TCF_USB1_OHCI0_FUNC, INTB, pin_swizzle(PIRQB, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_2,
+			      TCF_USB1_OHCI1_FUNC, INTB, pin_swizzle(PIRQB, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_2,
+			      TCF_USB1_OHCI2_FUNC, INTB, pin_swizzle(PIRQB, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_2,
+			      TCF_USB1_EHCI_FUNC, INTB, pin_swizzle(PIRQB, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_2,
+			      TCF_USB_DEVICE_FUNC, INTB, pin_swizzle(PIRQB, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_4,
+			      TCF_SDIO0_FUNC, INTC, pin_swizzle(PIRQC, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_4,
+			      TCF_SDIO1_FUNC, INTC, pin_swizzle(PIRQC, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_6,
+			      TCF_SATA_FUNC, INTD, pin_swizzle(PIRQD, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_8,
+			      TCF_USB2_OHCI0_FUNC, INTA, pin_swizzle(PIRQA, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_8,
+			      TCF_USB2_OHCI1_FUNC, INTA, pin_swizzle(PIRQA, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_8,
+			      TCF_USB2_OHCI2_FUNC, INTA, pin_swizzle(PIRQA, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_8,
+			      TCF_USB2_EHCI_FUNC, INTA, pin_swizzle(PIRQA, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_10,
+			      TCF_DMA1_FUNC, INTB, pin_swizzle(PIRQB, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_10,
+			      TCF_UART0_FUNC, INTB, pin_swizzle(PIRQB, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_10,
+			      TCF_UART1_FUNC, INTB, pin_swizzle(PIRQB, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_10,
+			      TCF_UART2_FUNC, INTB, pin_swizzle(PIRQB, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_10,
+			      TCF_UART3_FUNC, INTB, pin_swizzle(PIRQB, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_12,
+			      TCF_DMA2_FUNC, INTC, pin_swizzle(PIRQC, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_12,
+			      TCF_SPI_FUNC, INTC, pin_swizzle(PIRQC, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_12,
+			      TCF_I2C_FUNC, INTC, pin_swizzle(PIRQC, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_12,
+			      TCF_CAN_FUNC, INTC, pin_swizzle(PIRQC, i));
+		fill_irq_info(&slot, &irq_entries, tcf_bus, TCF_DEV_12,
+			      TCF_1588_FUNC, INTC, pin_swizzle(PIRQC, i));
+	}
+
+	/* Call board-specific routine to fill in add-in card's irq info */
+	irq_entries += board_fill_irq_info(slot);
+
+	rt->size = irq_entries * sizeof(struct irq_info) + 32;
+
+	pirq_routing_table = rt;
+
+	return 0;
+}
+
+void pirq_init(void)
+{
+	struct tnc_rcba *rcba;
+	u32 base;
+
+	base = x86_pci_read_config32(TNC_LPC, LPC_RCBA);
+	base &= ~MEM_BAR_EN;
+	rcba = (struct tnc_rcba *)base;
+
+	/* Make sure all internal PCI devices are using INTA */
+	writel(INTA, &rcba->d02ip);
+	writel(INTA, &rcba->d03ip);
+	writel(INTA, &rcba->d27ip);
+	writel(INTA, &rcba->d31ip);
+	writel(INTA, &rcba->d23ip);
+	writel(INTA, &rcba->d24ip);
+	writel(INTA, &rcba->d25ip);
+	writel(INTA, &rcba->d26ip);
+
+	/*
+	 * Route TunnelCreek PCI device interrupt pin to PIRQ
+	 *
+	 * Since PCIe downstream ports received INTx are routed to PIRQ
+	 * A/B/C/D directly and not configurable, we route internal PCI
+	 * device's INTx to PIRQ E/F/G/H.
+	 */
+	writew(PIRQE, &rcba->d02ir);
+	writew(PIRQF, &rcba->d03ir);
+	writew(PIRQG, &rcba->d27ir);
+	writew(PIRQH, &rcba->d31ir);
+	writew(PIRQE, &rcba->d23ir);
+	writew(PIRQF, &rcba->d24ir);
+	writew(PIRQG, &rcba->d25ir);
+	writew(PIRQH, &rcba->d26ir);
+
+	if (create_pirq_routing_table()) {
+		debug("Failed to create pirq routing table\n");
+	} else {
+		/* Route PIRQ */
+		pirq_route_irqs(pirq_routing_table->slots,
+				get_irq_slot_count(pirq_routing_table));
+	}
+}
+
+u32 write_pirq_routing_table(u32 addr)
+{
+	return copy_pirq_routing_table(addr, pirq_routing_table);
+}
diff --git a/arch/x86/cpu/queensbay/tnc.c b/arch/x86/cpu/queensbay/tnc.c
index f756a0d..b46a7e9 100644
--- a/arch/x86/cpu/queensbay/tnc.c
+++ b/arch/x86/cpu/queensbay/tnc.c
@@ -8,7 +8,8 @@
 #include <asm/io.h>
 #include <asm/pci.h>
 #include <asm/post.h>
-#include <asm/arch/tnc.h>
+#include <asm/arch/device.h>
+#include <asm/arch/irq.h>
 #include <asm/fsp/fsp_support.h>
 #include <asm/processor.h>
 
@@ -43,3 +44,10 @@ int arch_cpu_init(void)
 
 	return 0;
 }
+
+int arch_misc_init(void)
+{
+	pirq_init();
+
+	return 0;
+}
diff --git a/arch/x86/include/asm/arch-queensbay/device.h b/arch/x86/include/asm/arch-queensbay/device.h
new file mode 100644
index 0000000..953b48f
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/device.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _QUEENSBAY_DEVICE_H_
+#define _QUEENSBAY_DEVICE_H_
+
+#include <pci.h>
+
+/* TunnelCreek PCI Devices */
+#define TNC_HOST_BRIDGE_DEV	0
+#define TNC_HOST_BRIDGE_FUNC	0
+#define TNC_IGD_DEV		2
+#define TNC_IGD_FUNC		0
+#define TNC_SDVO_DEV		3
+#define TNC_SDVO_FUNC		0
+#define TNC_PCIE0_DEV		23
+#define TNC_PCIE0_FUNC		0
+#define TNC_PCIE1_DEV		24
+#define TNC_PCIE1_FUNC		0
+#define TNC_PCIE2_DEV		25
+#define TNC_PCIE2_FUNC		0
+#define TNC_PCIE3_DEV		26
+#define TNC_PCIE3_FUNC		0
+#define TNC_HDA_DEV		27
+#define TNC_HDA_FUNC		0
+#define TNC_LPC_DEV		31
+#define TNC_LPC_FUNC		0
+
+#define TNC_HOST_BRIDGE		\
+	PCI_BDF(0, TNC_HOST_BRIDGE_DEV, TNC_HOST_BRIDGE_FUNC)
+#define TNC_IGD			\
+	PCI_BDF(0, TNC_IGD_DEV, TNC_IGD_FUNC)
+#define TNC_SDVO		\
+	PCI_BDF(0, TNC_SDVO_DEV, TNC_SDVO_FUNC)
+#define TNC_PCIE0		\
+	PCI_BDF(0, TNC_PCIE0_DEV, TNC_PCIE0_FUNC)
+#define TNC_PCIE1		\
+	PCI_BDF(0, TNC_PCIE1_DEV, TNC_PCIE1_FUNC)
+#define TNC_PCIE2		\
+	PCI_BDF(0, TNC_PCIE2_DEV, TNC_PCIE2_FUNC)
+#define TNC_PCIE3		\
+	PCI_BDF(0, TNC_PCIE3_DEV, TNC_PCIE3_FUNC)
+#define TNC_HDA			\
+	PCI_BDF(0, TNC_HDA_DEV, TNC_HDA_FUNC)
+#define TNC_LPC			\
+	PCI_BDF(0, TNC_LPC_DEV, TNC_LPC_FUNC)
+
+/* Topcliff IOH PCI Devices */
+#define TCF_PCIE_PORT_DEV	0
+#define TCF_PCIE_PORT_FUNC	0
+
+#define TCF_DEV_0		0
+#define TCF_PKT_HUB_FUNC	0
+#define TCF_GBE_FUNC		1
+#define TCF_GPIO_FUNC		2
+
+#define TCF_DEV_2		2
+#define TCF_USB1_OHCI0_FUNC	0
+#define TCF_USB1_OHCI1_FUNC	1
+#define TCF_USB1_OHCI2_FUNC	2
+#define TCF_USB1_EHCI_FUNC	3
+#define TCF_USB_DEVICE_FUNC	4
+
+#define TCF_DEV_4		4
+#define TCF_SDIO0_FUNC		0
+#define TCF_SDIO1_FUNC		1
+
+#define TCF_DEV_6		6
+#define TCF_SATA_FUNC		0
+
+#define TCF_DEV_8		8
+#define TCF_USB2_OHCI0_FUNC	0
+#define TCF_USB2_OHCI1_FUNC	1
+#define TCF_USB2_OHCI2_FUNC	2
+#define TCF_USB2_EHCI_FUNC	3
+
+#define TCF_DEV_10		10
+#define TCF_DMA1_FUNC		0
+#define TCF_UART0_FUNC		1
+#define TCF_UART1_FUNC		2
+#define TCF_UART2_FUNC		3
+#define TCF_UART3_FUNC		4
+
+#define TCF_DEV_12		12
+#define TCF_DMA2_FUNC		0
+#define TCF_SPI_FUNC		1
+#define TCF_I2C_FUNC		2
+#define TCF_CAN_FUNC		3
+#define TCF_1588_FUNC		4
+
+#endif /* _QUEENSBAY_DEVICE_H_ */
diff --git a/arch/x86/include/asm/arch-queensbay/irq.h b/arch/x86/include/asm/arch-queensbay/irq.h
new file mode 100644
index 0000000..e7f8616
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/irq.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _ARCH_IRQ_H_
+#define _ARCH_IRQ_H_
+
+enum pci_int_pin {
+	INTX,
+	INTA,
+	INTB,
+	INTC,
+	INTD
+};
+
+enum pirq_pin {
+	PIRQA,
+	PIRQB,
+	PIRQC,
+	PIRQD,
+	PIRQE,
+	PIRQF,
+	PIRQG,
+	PIRQH
+};
+
+/* PIRQ link number and value conversion */
+#define LINK_V2N(link)	(link - 0x60)
+#define LINK_N2V(link)	(link + 0x60)
+
+#define PIRQ_BITMAP	0xdee0
+
+struct irq_info;
+
+/**
+ * board_fill_irq_info() - Board-specific irq_info fill routine
+ *
+ * This fills the irq_info table for any board-specific add-in cards.
+ *
+ * @slot:	pointer to the struct irq_info that is to be filled in
+ * @return:	number of entries were written to the struct irq_info
+ */
+int board_fill_irq_info(struct irq_info *slot);
+
+/**
+ * pirq_init() - Initialize platform PIRQ routing
+ *
+ * This initializes the PIRQ routing on the platform and configures all PCI
+ * devices' interrupt line register to a working IRQ number on the 8259 PIC.
+ */
+void pirq_init(void);
+
+#endif /* _ARCH_IRQ_H_ */
diff --git a/arch/x86/include/asm/arch-queensbay/tnc.h b/arch/x86/include/asm/arch-queensbay/tnc.h
index 10ea51d..ad9a6c4 100644
--- a/arch/x86/include/asm/arch-queensbay/tnc.h
+++ b/arch/x86/include/asm/arch-queensbay/tnc.h
@@ -7,8 +7,43 @@
 #ifndef _X86_ARCH_TNC_H_
 #define _X86_ARCH_TNC_H_
 
-#include <pci.h>
+/* Memory BAR Enable */
+#define MEM_BAR_EN	0x00000001
 
-#define TNC_LPC		PCI_BDF(0, 31, 0)
+/* LPC PCI Configuration Registers */
+#define LPC_RCBA	0xf0
+
+/* Root Complex Register Block */
+struct tnc_rcba {
+	u32	rctl;
+	u32	esd;
+	u32	rsvd1[2];
+	u32	hdd;
+	u32	rsvd2;
+	u32	hdba;
+	u32	rsvd3[3129];
+	u32	d31ip;
+	u32	rsvd4[3];
+	u32	d27ip;
+	u32	rsvd5;
+	u32	d02ip;
+	u32	rsvd6;
+	u32	d26ip;
+	u32	d25ip;
+	u32	d24ip;
+	u32	d23ip;
+	u32	d03ip;
+	u32	rsvd7[3];
+	u16	d31ir;
+	u16	rsvd8[3];
+	u16	d27ir;
+	u16	d26ir;
+	u16	d25ir;
+	u16	d24ir;
+	u16	d23ir;
+	u16	rsvd9[7];
+	u16	d02ir;
+	u16	d03ir;
+};
 
 #endif /* _X86_ARCH_TNC_H_ */
diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h
index c743efd..122e054 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -53,6 +53,8 @@ int video_bios_init(void);
 void	board_init_f_r_trampoline(ulong) __attribute__ ((noreturn));
 void	board_init_f_r(void) __attribute__ ((noreturn));
 
+int arch_misc_init(void);
+
 /* Read the time stamp counter */
 static inline __attribute__((no_instrument_function)) uint64_t rdtsc(void)
 {
diff --git a/configs/crownbay_defconfig b/configs/crownbay_defconfig
index ce90553..47763f9 100644
--- a/configs/crownbay_defconfig
+++ b/configs/crownbay_defconfig
@@ -4,3 +4,4 @@ CONFIG_TARGET_CROWNBAY=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_SEPARATE=y
 CONFIG_DEFAULT_DEVICE_TREE="crownbay"
+CONFIG_GENERATE_PIRQ_TABLE=y
diff --git a/include/configs/crownbay.h b/include/configs/crownbay.h
index 42042d1..4fef433 100644
--- a/include/configs/crownbay.h
+++ b/include/configs/crownbay.h
@@ -15,6 +15,7 @@
 
 #define CONFIG_SYS_MONITOR_LEN		(1 << 20)
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_ARCH_MISC_INIT
 
 #define CONFIG_NR_DRAM_BANKS		1
 
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 4/4] x86: queensbay: Implement PIRQ routing
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 4/4] x86: queensbay: Implement " Bin Meng
@ 2015-04-24 12:40   ` Simon Glass
  2015-04-25 14:18     ` Simon Glass
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Glass @ 2015-04-24 12:40 UTC (permalink / raw)
  To: u-boot

On 24 April 2015 at 04:10, Bin Meng <bmeng.cn@gmail.com> wrote:
> Implement Intel Queensbay platform-specific PIRQ routing support.
> The chipset PIRQ routing setup is called in the arch_misc_init().
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
> Changes in v2:
> - Correct a typo in the commit message
> - Use a local variable in fill_irq_info()
> - Print a debug message if creating pirq table fails
> - Use a C structure for RCBA register access
>
>  arch/x86/cpu/queensbay/Makefile              |   2 +-
>  arch/x86/cpu/queensbay/irq.c                 | 242 +++++++++++++++++++++++++++
>  arch/x86/cpu/queensbay/tnc.c                 |  10 +-
>  arch/x86/include/asm/arch-queensbay/device.h |  94 +++++++++++
>  arch/x86/include/asm/arch-queensbay/irq.h    |  55 ++++++
>  arch/x86/include/asm/arch-queensbay/tnc.h    |  39 ++++-
>  arch/x86/include/asm/u-boot-x86.h            |   2 +
>  configs/crownbay_defconfig                   |   1 +
>  include/configs/crownbay.h                   |   1 +
>  9 files changed, 442 insertions(+), 4 deletions(-)
>  create mode 100644 arch/x86/cpu/queensbay/irq.c
>  create mode 100644 arch/x86/include/asm/arch-queensbay/device.h
>  create mode 100644 arch/x86/include/asm/arch-queensbay/irq.h

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 1/4] x86: Add a function to assign IRQ numbers to PCI device
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 1/4] x86: Add a function to assign IRQ numbers to PCI device Bin Meng
@ 2015-04-25 14:18   ` Simon Glass
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2015-04-25 14:18 UTC (permalink / raw)
  To: u-boot

On 24 April 2015 at 04:10, Bin Meng <bmeng.cn@gmail.com> wrote:
> Add a function to assign an IRQ number to PCI device's interrupt
> line register in its configuration space, so that the PCI device
> can have its interrupt working under PIC mode after OS boots up.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Acked-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  arch/x86/cpu/pci.c         | 21 +++++++++++++++++++++
>  arch/x86/include/asm/pci.h | 14 ++++++++++++++
>  2 files changed, 35 insertions(+)

Applied to u-boot-x86, thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 2/4] x86: Write configuration tables in last_stage_init()
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 2/4] x86: Write configuration tables in last_stage_init() Bin Meng
@ 2015-04-25 14:18   ` Simon Glass
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2015-04-25 14:18 UTC (permalink / raw)
  To: u-boot

On 24 April 2015 at 04:10, Bin Meng <bmeng.cn@gmail.com> wrote:
> We can write the configuration table in last_stage_init() for all x86
> boards, but not with coreboot since coreboot already has them.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Acked-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  arch/x86/cpu/cpu.c            | 10 +++++++++
>  arch/x86/include/asm/tables.h | 49 +++++++++++++++++++++++++++++++++++++++++++
>  arch/x86/lib/Makefile         |  1 +
>  arch/x86/lib/tables.c         | 30 ++++++++++++++++++++++++++
>  include/configs/x86-common.h  |  1 +
>  5 files changed, 91 insertions(+)
>  create mode 100644 arch/x86/include/asm/tables.h
>  create mode 100644 arch/x86/lib/tables.c

Applied to u-boot-x86, thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 3/4] x86: Support platform PIRQ routing
  2015-04-24 10:10 ` [U-Boot] [PATCH v2 3/4] x86: Support platform PIRQ routing Bin Meng
@ 2015-04-25 14:18   ` Simon Glass
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2015-04-25 14:18 UTC (permalink / raw)
  To: u-boot

On 24 April 2015 at 04:10, Bin Meng <bmeng.cn@gmail.com> wrote:
> On x86 boards, platform chipset receives up to four different
> interrupt signals from PCI devices (INTA/B/C/D), which in turn
> will be routed to chipset internal PIRQ lines then routed to
> 8259 PIC finally if configuring the whole system to work under
> the so-called PIC mode (in contrast to symmetric IO mode which
> uses IOAPIC).
>
> We add two major APIs to aid this, one for routing PIRQ and the
> other one for generating a PIRQ routing table.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Acked-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  arch/x86/Kconfig                    |  31 ++++++++
>  arch/x86/include/asm/pirq_routing.h | 139 ++++++++++++++++++++++++++++++++++++
>  arch/x86/lib/Makefile               |   1 +
>  arch/x86/lib/pirq_routing.c         | 129 +++++++++++++++++++++++++++++++++
>  4 files changed, 300 insertions(+)
>  create mode 100644 arch/x86/include/asm/pirq_routing.h
>  create mode 100644 arch/x86/lib/pirq_routing.c

Applied to u-boot-x86, thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH v2 4/4] x86: queensbay: Implement PIRQ routing
  2015-04-24 12:40   ` Simon Glass
@ 2015-04-25 14:18     ` Simon Glass
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2015-04-25 14:18 UTC (permalink / raw)
  To: u-boot

On 24 April 2015 at 06:40, Simon Glass <sjg@chromium.org> wrote:
> On 24 April 2015 at 04:10, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Implement Intel Queensbay platform-specific PIRQ routing support.
>> The chipset PIRQ routing setup is called in the arch_misc_init().
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>
>> ---
>>
>> Changes in v2:
>> - Correct a typo in the commit message
>> - Use a local variable in fill_irq_info()
>> - Print a debug message if creating pirq table fails
>> - Use a C structure for RCBA register access
>>
>>  arch/x86/cpu/queensbay/Makefile              |   2 +-
>>  arch/x86/cpu/queensbay/irq.c                 | 242 +++++++++++++++++++++++++++
>>  arch/x86/cpu/queensbay/tnc.c                 |  10 +-
>>  arch/x86/include/asm/arch-queensbay/device.h |  94 +++++++++++
>>  arch/x86/include/asm/arch-queensbay/irq.h    |  55 ++++++
>>  arch/x86/include/asm/arch-queensbay/tnc.h    |  39 ++++-
>>  arch/x86/include/asm/u-boot-x86.h            |   2 +
>>  configs/crownbay_defconfig                   |   1 +
>>  include/configs/crownbay.h                   |   1 +
>>  9 files changed, 442 insertions(+), 4 deletions(-)
>>  create mode 100644 arch/x86/cpu/queensbay/irq.c
>>  create mode 100644 arch/x86/include/asm/arch-queensbay/device.h
>>  create mode 100644 arch/x86/include/asm/arch-queensbay/irq.h
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-x86, thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-04-25 14:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1429870206-18792-1-git-send-email-bmeng.cn@gmail.com>
2015-04-24 10:10 ` [U-Boot] [PATCH v2 1/4] x86: Add a function to assign IRQ numbers to PCI device Bin Meng
2015-04-25 14:18   ` Simon Glass
2015-04-24 10:10 ` [U-Boot] [PATCH v2 2/4] x86: Write configuration tables in last_stage_init() Bin Meng
2015-04-25 14:18   ` Simon Glass
2015-04-24 10:10 ` [U-Boot] [PATCH v2 3/4] x86: Support platform PIRQ routing Bin Meng
2015-04-25 14:18   ` Simon Glass
2015-04-24 10:10 ` [U-Boot] [PATCH v2 4/4] x86: queensbay: Implement " Bin Meng
2015-04-24 12:40   ` Simon Glass
2015-04-25 14:18     ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.