Commit 48f97bf4 authored by Paul Mackerras's avatar Paul Mackerras

Merge samba.org:/home/paulus/kernel/linux-2.5

into samba.org:/home/paulus/kernel/for-linus-ppc
parents 2c66151c bb5eec4a
...@@ -29,13 +29,12 @@ ...@@ -29,13 +29,12 @@
* to reduce code space and undefined function references. * to reduce code space and undefined function references.
*/ */
#include <linux/ptrace.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/threads.h> #include <linux/threads.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/ptrace.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/timex.h> #include <linux/timex.h>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/mm.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/highmem.h> #include <linux/highmem.h>
...@@ -202,7 +203,7 @@ __ioremap(unsigned long addr, unsigned long size, unsigned long flags) ...@@ -202,7 +203,7 @@ __ioremap(unsigned long addr, unsigned long size, unsigned long flags)
err = map_page(v+i, p+i, flags); err = map_page(v+i, p+i, flags);
if (err) { if (err) {
if (mem_init_done) if (mem_init_done)
vfree((void *)v); vunmap((void *)v);
return NULL; return NULL;
} }
...@@ -219,7 +220,7 @@ void iounmap(void *addr) ...@@ -219,7 +220,7 @@ void iounmap(void *addr)
if (v_mapped_by_bats((unsigned long)addr)) return; if (v_mapped_by_bats((unsigned long)addr)) return;
if (addr > high_memory && (unsigned long) addr < ioremap_bot) if (addr > high_memory && (unsigned long) addr < ioremap_bot)
vfree((void *) (PAGE_MASK & (unsigned long) addr)); vunmap((void *) (PAGE_MASK & (unsigned long)addr));
} }
#endif /* CONFIG_PPC_ISERIES */ #endif /* CONFIG_PPC_ISERIES */
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/open_pic.h> #include <asm/open_pic.h>
#define MAX_DEVNR 22
/* Which PCI interrupt line does a given device [slot] use? */ /* Which PCI interrupt line does a given device [slot] use? */
/* Note: This really should be two dimensional based in slot/pin used */ /* Note: This really should be two dimensional based in slot/pin used */
...@@ -616,47 +615,79 @@ static unsigned char prep_pci_intpins[4][4] __prepdata = ...@@ -616,47 +615,79 @@ static unsigned char prep_pci_intpins[4][4] __prepdata =
#define ELCRM_INT7_LVL 0x80 #define ELCRM_INT7_LVL 0x80
#define ELCRM_INT5_LVL 0x20 #define ELCRM_INT5_LVL 0x20
#define CFGPTR(dev) (0x80800000 | (1<<(dev>>3)) | ((dev&7)<<8) | offset) /*
* PCI config space access.
*/
#define CFGADDR(dev) ((1<<(dev>>3)) | ((dev&7)<<8))
#define DEVNO(dev) (dev>>3) #define DEVNO(dev) (dev>>3)
#define cfg_read(val, addr, type, op) *val = op((type)(addr)) #define MIN_DEVNR 11
#define cfg_write(val, addr, type, op) op((type *)(addr), (val)) #define MAX_DEVNR 22
#define cfg_read_bad(val, size) *val = bad_##size; static int __prep
#define cfg_write_bad(val, size) prep_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
int len, u32 *val)
#define bad_byte 0xff {
#define bad_word 0xffff struct pci_controller *hose = bus->sysdata;
#define bad_dword 0xffffffffU volatile unsigned char *cfg_data;
#define PREP_PCI_OP(rw, size, type, op) \ if (bus->number != 0 || DEVNO(devfn) < MIN_DEVNR
static int __prep \ || DEVNO(devfn) > MAX_DEVNR)
prep_##rw##_config_##size(struct pci_dev *dev, int offset, type val) \ return PCIBIOS_DEVICE_NOT_FOUND;
{ \
if ((dev->bus->number != 0) || (DEVNO(dev->devfn) > MAX_DEVNR)) \ /*
{ \ * Note: the caller has already checked that offset is
cfg_##rw##_bad(val, size) \ * suitably aligned and that len is 1, 2 or 4.
return PCIBIOS_DEVICE_NOT_FOUND; \ */
} \ cfg_data = hose->cfg_data + CFGADDR(devfn) + offset;
cfg_##rw(val, CFGPTR(dev->devfn), type, op); \ switch (len) {
return PCIBIOS_SUCCESSFUL; \ case 1:
*val = in_8((u8 *)cfg_data);
break;
case 2:
*val = in_le16((u16 *)cfg_data);
break;
default:
*val = in_le32((u32 *)cfg_data);
break;
}
return PCIBIOS_SUCCESSFUL;
} }
PREP_PCI_OP(read, byte, u8 *, in_8) static int __prep
PREP_PCI_OP(read, word, u16 *, in_le16) prep_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
PREP_PCI_OP(read, dword, u32 *, in_le32) int len, u32 val)
PREP_PCI_OP(write, byte, u8, out_8) {
PREP_PCI_OP(write, word, u16, out_le16) struct pci_controller *hose = bus->sysdata;
PREP_PCI_OP(write, dword, u32, out_le32) volatile unsigned char *cfg_data;
if (bus->number != 0 || DEVNO(devfn) < MIN_DEVNR
|| DEVNO(devfn) > MAX_DEVNR)
return PCIBIOS_DEVICE_NOT_FOUND;
/*
* Note: the caller has already checked that offset is
* suitably aligned and that len is 1, 2 or 4.
*/
cfg_data = hose->cfg_data + CFGADDR(devfn) + offset;
switch (len) {
case 1:
out_8((u8 *)cfg_data, val);
break;
case 2:
out_le16((u16 *)cfg_data, val);
break;
default:
out_le32((u32 *)cfg_data, val);
break;
}
return PCIBIOS_SUCCESSFUL;
}
static struct pci_ops prep_pci_ops = static struct pci_ops prep_pci_ops =
{ {
prep_read_config_byte, prep_read_config,
prep_read_config_word, prep_write_config
prep_read_config_dword,
prep_write_config_byte,
prep_write_config_word,
prep_write_config_dword
}; };
#define MOTOROLA_CPUTYPE_REG 0x800 #define MOTOROLA_CPUTYPE_REG 0x800
...@@ -1239,10 +1270,12 @@ prep_find_bridges(void) ...@@ -1239,10 +1270,12 @@ prep_find_bridges(void)
hose->last_busno = 0xff; hose->last_busno = 0xff;
hose->pci_mem_offset = PREP_ISA_MEM_BASE; hose->pci_mem_offset = PREP_ISA_MEM_BASE;
hose->io_base_phys = PREP_ISA_IO_BASE; hose->io_base_phys = PREP_ISA_IO_BASE;
hose->io_base_virt = (void *)0x80000000; /* see prep_map_io() */ hose->io_base_virt = ioremap(PREP_ISA_IO_BASE, 0x800000);
prep_init_resource(&hose->io_resource, 0, 0x00ffffff, IORESOURCE_IO); prep_init_resource(&hose->io_resource, 0, 0x007fffff, IORESOURCE_IO);
prep_init_resource(&hose->mem_resources[0], 0xc0000000, 0xfeffffff, prep_init_resource(&hose->mem_resources[0], 0xc0000000, 0xfeffffff,
IORESOURCE_MEM); IORESOURCE_MEM);
/* XXX why can't we use the indirect config space access method? */
hose->cfg_data = ioremap(PREP_ISA_IO_BASE + 0x800000, 0x800000);
hose->ops = &prep_pci_ops; hose->ops = &prep_pci_ops;
printk("PReP architecture\n"); printk("PReP architecture\n");
......
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