📄 1001.pci.patch
字号:
help Add support for Sigma Designs SMP865x board. Say Y here to support this machine type.diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/arch/mips/mm/init.c linux-2.6.15/arch/mips/mm/init.c--- linux-2.6.15.ref/arch/mips/mm/init.c 2006-01-25 20:51:10.000000000 -0800+++ linux-2.6.15/arch/mips/mm/init.c 2007-06-20 12:07:42.000000000 -0700@@ -35,6 +35,13 @@ #include <asm/pgalloc.h> #include <asm/tlb.h> +#ifdef CONFIG_TANGO2+#include <asm/tango2/hardware.h>+#endif+#ifdef CONFIG_TANGO3+#include <asm/tango3/hardware.h>+#endif+ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); unsigned long highstart_pfn, highend_pfn;@@ -139,20 +146,35 @@ void __init paging_init(void) {- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};+ unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0, 0}; unsigned long max_dma, high, low; +#if defined(CONFIG_TANGOX) && defined(CONFIG_PCI)+ extern unsigned long em8xxx_kmem_start;+ extern unsigned long em8xxx_kmem_size;+ extern int tangox_pci_host_enabled(void);+#endif+ pagetable_init(); #ifdef CONFIG_HIGHMEM kmap_init(); #endif - max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; low = max_low_pfn; high = highend_pfn; -#ifdef CONFIG_ISA+#if defined(CONFIG_TANGOX) && defined(CONFIG_PCI)+ /* If PCI is used, then limit DMA memory to MAX_PCIMEM_MAP_SIZE if kernel memory is > MAX_PCIMEM_MAP_SIZE */+ if (tangox_pci_host_enabled() && (em8xxx_kmem_size>(MAX_PCIMEM_MAP_SIZE<<20))) + max_dma = virt_to_phys((char *)((em8xxx_kmem_start+(MAX_PCIMEM_MAP_SIZE<<20))&0xfff00000)) >> PAGE_SHIFT;+ else+ max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;+#else+ max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;+#endif /* CONFIG_TANGOX && CONFIG_PCI */++#if defined(CONFIG_ISA) || (defined(CONFIG_TANGOX) && defined(CONFIG_PCI)) if (low < max_dma) zones_size[ZONE_DMA] = low; else {@@ -162,6 +184,7 @@ #else zones_size[ZONE_DMA] = low; #endif+ #ifdef CONFIG_HIGHMEM if (cpu_has_dc_aliases) { printk(KERN_WARNING "This processor doesn't support highmem.");diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/arch/mips/pci/fixup-tangox.c linux-2.6.15/arch/mips/pci/fixup-tangox.c--- linux-2.6.15.ref/arch/mips/pci/fixup-tangox.c 1969-12-31 16:00:00.000000000 -0800+++ linux-2.6.15/arch/mips/pci/fixup-tangox.c 2007-06-20 12:07:42.000000000 -0700@@ -0,0 +1,53 @@+/*+ * This program is free software; you can redistribute it and/or+ * modify it under the terms of the GNU General Public License+ * as published by the Free Software Foundation; either version 2+ * of the License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.+ */++#include <linux/types.h>+#include <linux/pci.h>+#include <linux/kernel.h>+#include <linux/init.h>+#include <linux/delay.h>++#ifdef CONFIG_TANGO2+#include <asm/tango2/hardware.h>+#include <asm/tango2/tango2_pci.h>+#elif defined(CONFIG_TANGO3)+#include <asm/tango3/hardware.h>+#include <asm/tango3/tango3_pci.h>+#endif++extern int tangox_pcidev_irq_map(int pci_idsel, int int_num);++int pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)+{+ /* return xenv config */+ return tangox_pcidev_irq_map(slot, pin);+}++int pcibios_plat_dev_init(struct pci_dev *dev)+{+ return 0;+}++/*+ * final fixup for our pci bus, called after all resource allocation.+ */+static void tangox_fixup(struct pci_dev *dev)+{+ dev->dev.platform_data = 0;+}++DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, tangox_fixup);+diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/arch/mips/pci/Makefile linux-2.6.15/arch/mips/pci/Makefile--- linux-2.6.15.ref/arch/mips/pci/Makefile 2006-01-25 20:51:10.000000000 -0800+++ linux-2.6.15/arch/mips/pci/Makefile 2007-06-20 12:07:42.000000000 -0700@@ -55,3 +55,5 @@ obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-tx4938.o ops-tx4938.o obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o++obj-$(CONFIG_TANGOX) += pci-tangox.o fixup-tangox.o ops-tangox.odiff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/arch/mips/pci/ops-tangox.c linux-2.6.15/arch/mips/pci/ops-tangox.c--- linux-2.6.15.ref/arch/mips/pci/ops-tangox.c 1969-12-31 16:00:00.000000000 -0800+++ linux-2.6.15/arch/mips/pci/ops-tangox.c 2007-06-20 12:07:42.000000000 -0700@@ -0,0 +1,130 @@+/*+ * This program is free software; you can redistribute it and/or+ * modify it under the terms of the GNU General Public License+ * as published by the Free Software Foundation; either version 2+ * of the License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.+ */++#include <linux/config.h>+#include <linux/types.h>+#include <linux/pci.h>+#include <linux/kernel.h>+#include <linux/init.h>++#include <asm/io.h>+#ifdef CONFIG_TANGO2+#include <asm/tango2/tango2_pci.h>+#elif defined(CONFIG_TANGO3)+#include <asm/tango3/tango3_pci.h>+#endif++/*+ * remapped address to access config space from kernel+ */+void __iomem *tangox_pci_config_base;++/*+ * list of devices for which we allow configuration access+ */+int enabled_devices[PCIEM86XX_IDSEL_MAX];++/*+ * find cfg address to use for given bus/device/Address+ */+#define CFG_ADDR(bus,devfn,where) \+ (tangox_pci_config_base + (((bus) << 16) + ((devfn) << 8) + (where)))++/*+ * read/write callbacks for pci configuration memory access+ */+int tangox_pcibios_read(struct pci_bus *bus, unsigned int devfn,+ int where, int size, u32 *val)+{+ void __iomem *addr = CFG_ADDR(bus->number, devfn, where);+ int ret, slot;++ slot = PCI_SLOT(devfn);++ /*+ * check that it is ok to use this slot+ */+ if (!enabled_devices[slot] || slot >= PCIEM86XX_IDSEL_MAX)+ return PCIBIOS_DEVICE_NOT_FOUND;++ /*+ * reject silly sizes+ */+ if ((size == 2) && (where & 1))+ return PCIBIOS_BAD_REGISTER_NUMBER;+ else if ((size == 4) && (where & 3))+ return PCIBIOS_BAD_REGISTER_NUMBER;++ switch (size) {+ case 1:+ ret = tangox_cfg_read8(addr, val);+ break;++ case 2:+ ret = tangox_cfg_read16(addr, val);+ break;++ default:+ ret = tangox_cfg_read32(addr, val);+ break;+ }++ return ret;+}++int tangox_pcibios_write(struct pci_bus *bus, unsigned int devfn,+ int where, int size, u32 val)+{+ void __iomem *addr = CFG_ADDR(bus->number, devfn, where);+ int ret, slot;++ slot = PCI_SLOT(devfn);++ /*+ * check that it is ok to use this slot+ */+ if (!enabled_devices[slot] || slot >= PCIEM86XX_IDSEL_MAX)+ return PCIBIOS_DEVICE_NOT_FOUND;++ /*+ * reject silly sizes+ */+ if ((size == 2) && (where & 1))+ return PCIBIOS_BAD_REGISTER_NUMBER;+ else if ((size == 4) && (where & 3))+ return PCIBIOS_BAD_REGISTER_NUMBER;++ switch (size) {+ case 1:+ ret = tangox_cfg_write8(addr, &val);+ break;++ case 2:+ ret = tangox_cfg_write16(addr, &val);+ break;++ default:+ ret = tangox_cfg_write32(addr, &val);+ break;+ }++ return ret;+}++struct pci_ops tangox_pci_ops = {+ .read = tangox_pcibios_read,+ .write = tangox_pcibios_write,+};diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/arch/mips/pci/pci.c linux-2.6.15/arch/mips/pci/pci.c--- linux-2.6.15.ref/arch/mips/pci/pci.c 2006-01-25 20:51:10.000000000 -0800+++ linux-2.6.15/arch/mips/pci/pci.c 2007-06-20 12:07:42.000000000 -0700@@ -322,5 +322,17 @@ char *pcibios_setup(char *str) {+ extern int pci_enabled;++ if (strcmp(str, "disabled") == 0) {+ pci_enabled = 0;+ return(NULL);+ } else if (strcmp(str, "off") == 0) {+ pci_enabled = 0;+ return(NULL);+ } else if (strcmp(str, "on") == 0) {+ pci_enabled = 1;+ return(NULL);+ } return str; }diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/arch/mips/pci/pci-tangox.c linux-2.6.15/arch/mips/pci/pci-tangox.c--- linux-2.6.15.ref/arch/mips/pci/pci-tangox.c 1969-12-31 16:00:00.000000000 -0800+++ linux-2.6.15/arch/mips/pci/pci-tangox.c 2007-06-20 12:07:42.000000000 -0700@@ -0,0 +1,356 @@+/*+ * This program is free software; you can redistribute it and/or+ * modify it under the terms of the GNU General Public License+ * as published by the Free Software Foundation; either version 2+ * of the License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU General Public License for more details.+ *+ * You should have received a copy of the GNU General Public License+ * along with this program; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.+ */++#include <linux/types.h>+#include <linux/pci.h>+#include <linux/kernel.h>+#include <linux/init.h>++#include <asm/pci.h>+#include <asm/dma.h>++#ifdef CONFIG_TANGO2+#include <asm/tango2/tango2_gbus.h>+#include <asm/tango2/hardware.h>+#include <asm/tango2/tango2_pci.h>+#elif defined(CONFIG_TANGO3)+#include <asm/tango3/tango3_gbus.h>+#include <asm/tango3/hardware.h>+#include <asm/tango3/tango3_pci.h>+#endif++/*+ * computed in prom.c+ */+extern unsigned long em8xxx_kmem_start;+extern unsigned long em8xxx_kmem_size;++/*+ * pci addresses used by dma subsystem+ */+unsigned long g_pcimem_busaddr;+unsigned long g_pcimem_physaddr;+unsigned long g_pcimem_physaddr_end;++void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen);+//void pci_iounmap(struct pci_dev *dev, void __iomem *addr);+unsigned char *__unused_ptr1__ = (unsigned char *)pci_iomap;+//unsigned char *__unused_ptr2__ = (unsigned char *)pci_iounmap;++/*+ * We can't touch iospace directly from kseg1, we need to remap it.+ * No need to remap too much space, only 256 bytes per device is+ * allowed, so 64k should be more than enough.+ */+#define MEMORY_SIZE_PCI_IO (64 * 1024)++static struct resource tangox_pci_io_resource = {+ .name = "tangox pci IO space",+ .start = MEMORY_BASE_PCI_IO,+ .end = MEMORY_BASE_PCI_IO + MEMORY_SIZE_PCI_IO - 1,+ .flags = IORESOURCE_IO+};++/*+ * give 512MB for PCI memory space+ */+static struct resource tangox_pci_mem_resource = {+ .name = "tangox pci memory space",+ .start = MEMORY_BASE_PCI_MEMORY,+ .end = MEMORY_BASE_PCI_MEMORY + 0x1fffffff,+ .flags = IORESOURCE_MEM+};+++/*+ * Need to remap config space to access it from kernel. Note that+ * remap size is just enough for PCIEM86XX_IDSEL_MAX devices on 1 bus.+ */+#define MEMORY_SIZE_PCI_CONFIG (PCIEM86XX_IDSEL_MAX * (1 << 11))++/*+ * in ops-tangox.c+ */+extern void __iomem *tangox_pci_config_base;+extern struct pci_ops tangox_pci_ops;+extern int enabled_devices[PCIEM86XX_IDSEL_MAX];++struct pci_controller tangox_controller = {+ .pci_ops = &tangox_pci_ops,+ .io_resource = &tangox_pci_io_resource,+ .mem_resource = &tangox_pci_mem_resource,++ /*+ * gbus addresses are not the same as pci addresses, tell+ * Linux about this so it can adjust resource addresses.+ */+ .mem_offset = MEMORY_BASE_PCI_MEMORY,+ .io_offset = MEMORY_BASE_PCI_CONFIG,+};++/*+ * helpers to access host interface registers+ */+#define RD_HOST_REG32(r) \+ gbus_readl(REG_BASE_host_interface + (r))++#define WR_HOST_REG32(r, v) \+ gbus_writel(REG_BASE_host_interface + (r), (v))++#define RD_HOST_REG8(r) \+ gbus_readb(REG_BASE_host_interface + (r))++#define WR_HOST_REG8(r, v) \+ gbus_writeb(REG_BASE_host_interface + (r), (v))+++/*+ * This is the interrupt handler for bus fault interrupt. Just clear+ * it and warn user+ */+static irqreturn_t pci_busfault_intr(int irq, void *devinfo,+ struct pt_regs *regs)+{+ static const char *reasons[] = {+ "OK", "Master Abort", "Retry timer expired", "Unknown" };+ static int faultcount = 0;+ unsigned int data;++ data = (RD_HOST_REG8(PCI_host_reg2 + 3) >> 1) & 3;+ WR_HOST_REG8(PCI_host_reg2 + 3, 1);+ WR_HOST_REG8(PCI_host_reg2 + 3, 0);++ /* don't flood */+ if (printk_ratelimit())+ printk("PCI: PCI bus fault (count %d): %s\n",+ ++faultcount, reasons[data]);++ return IRQ_HANDLED;+}++/*+ * platform initialization code+ */+extern int tangox_pci_host_enabled(void);+extern int tangox_pcidev_enabled(int idsel);++/* can turned on/off by XENV or cmd line */+int pci_enabled = 1; +
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -