Re: 2.4.x jobs (updated)

From: Martin Mares (mj@suse.cz)
Date: Thu Mar 16 2000 - 07:40:49 EST


Hello!

> In my case for 2.4.x I'm going to need to play "BIOS" on sparc64 and
> init all the latency timer (based upon min_gnt, max_latency, and 66MHZ
> settings) and cache line size values because the boot firmware doesn't
> do it. I want to remove all of the ifdef __sparc__ garbage in PCI
> drivers which exists now to accomplish this.
>
> Also for some controllers I know cases where if you set the latency
> timer such that PIO's from the host bridge are blocked out for more
> than a certain amount of clocks, it can hang the host bridge. I'd
> like to be able to control this.

   Is this patch okay for you?

                                Have a nice fortnight

-- 
Martin `MJ' Mares <mj@ucw.cz> <mj@suse.cz> http://atrey.karlin.mff.cuni.cz/~mj/
"Lottery -- a tax on people who can't do math."

--- include/linux/pci.h.mj Thu Mar 16 13:24:37 2000 +++ include/linux/pci.h Thu Mar 16 13:26:28 2000 @@ -293,8 +293,6 @@ #define PCI_DMA_FROMDEVICE 2 #define PCI_DMA_NONE 3 -#include <asm/pci.h> - #define DEVICE_COUNT_COMPATIBLE 4 #define DEVICE_COUNT_IRQ 2 #define DEVICE_COUNT_DMA 2 @@ -541,6 +539,10 @@ void pci_remove_device(struct pci_dev *); struct pci_driver *pci_dev_driver(const struct pci_dev *); const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev); + +/* Include architecture-dependent settings and functions */ + +#include <asm/pci.h> /* * If the system does not have PCI, clearly these return errors. Define --- include/asm-i386/pci.h.mj Thu Mar 16 13:20:40 2000 +++ include/asm-i386/pci.h Thu Mar 16 13:26:06 2000 @@ -1,6 +1,8 @@ #ifndef __i386_PCI_H #define __i386_PCI_H +#ifdef __KERNEL__ + /* Can be used to override the logic in pci_scan_bus for skipping already-configured bus numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the loader */ @@ -10,7 +12,7 @@ #define PCIBIOS_MIN_IO 0x1000 #define PCIBIOS_MIN_MEM 0x10000000 -#ifdef __KERNEL__ +void pcibios_set_master(struct pci_dev *dev); /* Dynamic DMA mapping stuff. * i386 has everything mapped statically. @@ -164,4 +166,3 @@ #endif /* __KERNEL__ */ #endif /* __i386_PCI_H */ - --- include/asm-mips/pci.h.mj Thu Mar 16 13:22:31 2000 +++ include/asm-mips/pci.h Thu Mar 16 13:22:31 2000 @@ -7,6 +7,8 @@ #ifndef _ASM_PCI_H #define _ASM_PCI_H +#ifdef __KERNEL__ + /* Can be used to override the logic in pci_scan_bus for skipping already-configured bus numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the loader */ @@ -16,7 +18,10 @@ #define PCIBIOS_MIN_IO 0x1000 #define PCIBIOS_MIN_MEM 0x10000000 -#ifdef __KERNEL__ +extern inline void pcibios_set_master(struct pci_dev *dev) +{ + /* No special bus mastering setup handling */ +} /* * Dynamic DMA mapping stuff. --- include/asm-alpha/pci.h.mj Thu Mar 16 13:21:25 2000 +++ include/asm-alpha/pci.h Thu Mar 16 13:21:25 2000 @@ -39,6 +39,11 @@ #define PCIBIOS_MIN_IO alpha_mv.min_io_address #define PCIBIOS_MIN_MEM alpha_mv.min_mem_address +extern inline void pcibios_set_master(struct pci_dev *dev) +{ + /* No special bus mastering setup handling */ +} + /* IOMMU controls. */ /* Allocate and map kernel buffer using consistant mode DMA for PCI --- include/asm-m68k/pci.h.mj Thu Mar 16 13:22:19 2000 +++ include/asm-m68k/pci.h Thu Mar 16 13:22:19 2000 @@ -35,4 +35,9 @@ #define pcibios_assign_all_busses() 0 +extern inline void pcibios_set_master(struct pci_dev *dev) +{ + /* No special bus mastering setup handling */ +} + #endif /* _ASM_M68K_PCI_H */ --- include/asm-sparc/pci.h.mj Thu Mar 16 13:23:21 2000 +++ include/asm-sparc/pci.h Thu Mar 16 13:23:21 2000 @@ -1,6 +1,8 @@ #ifndef __SPARC_PCI_H #define __SPARC_PCI_H +#ifdef __KERNEL__ + /* Can be used to override the logic in pci_scan_bus for skipping * already-configured bus numbers - to be used for buggy BIOSes * or architectures with incomplete PCI setup by the loader. @@ -10,7 +12,10 @@ #define PCIBIOS_MIN_IO 0UL #define PCIBIOS_MIN_MEM 0UL -#ifdef __KERNEL__ +extern inline void pcibios_set_master(struct pci_dev *dev) +{ + /* No special bus mastering setup handling */ +} /* Dynamic DMA mapping stuff. */ --- include/asm-ppc/pci.h.mj Thu Mar 16 13:22:54 2000 +++ include/asm-ppc/pci.h Thu Mar 16 13:22:54 2000 @@ -10,6 +10,11 @@ #define PCIBIOS_MIN_IO 0x1000 #define PCIBIOS_MIN_MEM 0x10000000 +extern inline void pcibios_set_master(struct pci_dev *dev) +{ + /* No special bus mastering setup handling */ +} + /* Dynamic DMA Mapping stuff * ++ajoshi */ --- include/asm-sparc64/pci.h.mj Thu Mar 16 13:23:30 2000 +++ include/asm-sparc64/pci.h Thu Mar 16 13:23:30 2000 @@ -1,6 +1,8 @@ #ifndef __SPARC64_PCI_H #define __SPARC64_PCI_H +#ifdef __KERNEL__ + /* Can be used to override the logic in pci_scan_bus for skipping * already-configured bus numbers - to be used for buggy BIOSes * or architectures with incomplete PCI setup by the loader. @@ -10,7 +12,10 @@ #define PCIBIOS_MIN_IO 0UL #define PCIBIOS_MIN_MEM 0UL -#ifdef __KERNEL__ +extern inline void pcibios_set_master(struct pci_dev *dev) +{ + /* No special bus mastering setup handling */ +} /* Dynamic DMA mapping stuff. */ --- include/asm-arm/pci.h.mj Thu Mar 16 13:21:46 2000 +++ include/asm-arm/pci.h Thu Mar 16 13:21:46 2000 @@ -1,12 +1,17 @@ #ifndef ASMARM_PCI_H #define ASMARM_PCI_H +#ifdef __KERNEL__ + #define pcibios_assign_all_busses() 0 #define PCIBIOS_MIN_IO 0x8000 #define PCIBIOS_MIN_MEM 0x40000000 -#ifdef __KERNEL__ +extern inline void pcibios_set_master(struct pci_dev *dev) +{ + /* No special bus mastering setup handling */ +} #include <asm/scatterlist.h> #include <asm/io.h> --- include/asm-sh/pci.h.mj Thu Mar 16 13:23:06 2000 +++ include/asm-sh/pci.h Thu Mar 16 13:23:06 2000 @@ -1,13 +1,18 @@ #ifndef __ASM_SH_PCI_H #define __ASM_SH_PCI_H +#ifdef __KERNEL__ + /* Can be used to override the logic in pci_scan_bus for skipping already-configured bus numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the loader */ #define pcibios_assign_all_busses() 0 -#ifdef __KERNEL__ +extern inline void pcibios_set_master(struct pci_dev *dev) +{ + /* No special bus mastering setup handling */ +} /* Dynamic DMA mapping stuff. * SuperH has everything mapped statically like x86. --- include/asm-ia64/pci.h.mj Thu Mar 16 13:22:08 2000 +++ include/asm-ia64/pci.h Thu Mar 16 13:22:08 2000 @@ -11,6 +11,11 @@ #define PCIBIOS_MIN_IO 0x1000 #define PCIBIOS_MIN_MEM 0x10000000 +extern inline void pcibios_set_master(struct pci_dev *dev) +{ + /* No special bus mastering setup handling */ +} + /* * Dynamic DMA mapping API. * IA-64 has everything mapped statically. --- include/asm-mips64/pci.h.mj Thu Mar 16 13:22:45 2000 +++ include/asm-mips64/pci.h Thu Mar 16 13:22:45 2000 @@ -7,6 +7,8 @@ #ifndef _ASM_PCI_H #define _ASM_PCI_H +#ifdef __KERNEL__ + /* Can be used to override the logic in pci_scan_bus for skipping already-configured bus numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the loader */ @@ -16,7 +18,10 @@ #define PCIBIOS_MIN_IO 0x1000 #define PCIBIOS_MIN_MEM 0x10000000 -#ifdef __KERNEL__ +extern inline void pcibios_set_master(struct pci_dev *dev) +{ + /* No special bus mastering setup handling */ +} /* * Dynamic DMA mapping stuff. --- drivers/pci/pci.c.mj Thu Mar 16 13:15:28 2000 +++ drivers/pci/pci.c Thu Mar 16 13:18:57 2000 @@ -384,19 +384,14 @@ pci_set_master(struct pci_dev *dev) { u16 cmd; - u8 lat; pci_read_config_word(dev, PCI_COMMAND, &cmd); if (! (cmd & PCI_COMMAND_MASTER)) { - printk("PCI: Enabling bus mastering for device %s\n", dev->slot_name); + DBG("PCI: Enabling bus mastering for device %s\n", dev->slot_name); cmd |= PCI_COMMAND_MASTER; pci_write_config_word(dev, PCI_COMMAND, cmd); } - pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); - if (lat < 16) { - printk("PCI: Increasing latency timer of device %s to 64\n", dev->slot_name); - pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); - } + pcibios_set_master(dev); } /* --- arch/i386/kernel/pci-i386.c.mj Thu Mar 16 13:26:27 2000 +++ arch/i386/kernel/pci-i386.c Thu Mar 16 13:26:27 2000 @@ -323,3 +323,17 @@ } return 0; } + +/* + * If we set up a device for bus mastering, we need to check the latency + * timer as certain crappy BIOSes forget to set it properly. + */ +void pcibios_set_master(struct pci_dev *dev) +{ + u8 lat; + pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); + if (lat < 16) { + printk("PCI: Increasing latency timer of device %s to 64\n", dev->slot_name); + pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); + } +}

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:21 EST