diff options
-rw-r--r-- | arch/sh/boards/mach-se/7751/pci.c | 9 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci-lib.c | 42 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci-new.c | 23 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci.c | 23 | ||||
-rw-r--r-- | arch/sh/include/asm/pci.h | 5 |
5 files changed, 49 insertions, 53 deletions
diff --git a/arch/sh/boards/mach-se/7751/pci.c b/arch/sh/boards/mach-se/7751/pci.c index 203b2923fe7f..9ec64a416b30 100644 --- a/arch/sh/boards/mach-se/7751/pci.c +++ b/arch/sh/boards/mach-se/7751/pci.c | |||
@@ -30,6 +30,9 @@ | |||
30 | #define PCIC_WRITE(x,v) writel((v), PCI_REG(x)) | 30 | #define PCIC_WRITE(x,v) writel((v), PCI_REG(x)) |
31 | #define PCIC_READ(x) readl(PCI_REG(x)) | 31 | #define PCIC_READ(x) readl(PCI_REG(x)) |
32 | 32 | ||
33 | #define xPCIBIOS_MIN_IO board_pci_channels->io_resource->start | ||
34 | #define xPCIBIOS_MIN_MEM board_pci_channels->mem_resource->start | ||
35 | |||
33 | /* | 36 | /* |
34 | * Description: This function sets up and initializes the pcic, sets | 37 | * Description: This function sets up and initializes the pcic, sets |
35 | * up the BARS, maps the DRAM into the address space etc, etc. | 38 | * up the BARS, maps the DRAM into the address space etc, etc. |
@@ -97,12 +100,12 @@ int __init pcibios_init_platform(void) | |||
97 | * meaning all calls go straight through... use BUG_ON to | 100 | * meaning all calls go straight through... use BUG_ON to |
98 | * catch erroneous assumption. | 101 | * catch erroneous assumption. |
99 | */ | 102 | */ |
100 | BUG_ON(PCIBIOS_MIN_MEM != SH7751_PCI_MEMORY_BASE); | 103 | BUG_ON(xPCIBIOS_MIN_MEM != SH7751_PCI_MEMORY_BASE); |
101 | 104 | ||
102 | PCIC_WRITE(SH7751_PCIMBR, PCIBIOS_MIN_MEM); | 105 | PCIC_WRITE(SH7751_PCIMBR, xPCIBIOS_MIN_MEM); |
103 | 106 | ||
104 | /* Set IOBR for window containing area specified in pci.h */ | 107 | /* Set IOBR for window containing area specified in pci.h */ |
105 | PCIC_WRITE(SH7751_PCIIOBR, (PCIBIOS_MIN_IO & SH7751_PCIIOBR_MASK)); | 108 | PCIC_WRITE(SH7751_PCIIOBR, (xPCIBIOS_MIN_IO & SH7751_PCIIOBR_MASK)); |
106 | 109 | ||
107 | /* All done, may as well say so... */ | 110 | /* All done, may as well say so... */ |
108 | printk("SH7751 PCI: Finished initialization of the PCI controller\n"); | 111 | printk("SH7751 PCI: Finished initialization of the PCI controller\n"); |
diff --git a/arch/sh/drivers/pci/pci-lib.c b/arch/sh/drivers/pci/pci-lib.c index 1a43a350d574..8ab1a2d1b483 100644 --- a/arch/sh/drivers/pci/pci-lib.c +++ b/arch/sh/drivers/pci/pci-lib.c | |||
@@ -4,6 +4,41 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/pci.h> | 5 | #include <linux/pci.h> |
6 | 6 | ||
7 | unsigned long PCIBIOS_MIN_IO = 0x0000; | ||
8 | unsigned long PCIBIOS_MIN_MEM = 0; | ||
9 | |||
10 | /* | ||
11 | * We need to avoid collisions with `mirrored' VGA ports | ||
12 | * and other strange ISA hardware, so we always want the | ||
13 | * addresses to be allocated in the 0x000-0x0ff region | ||
14 | * modulo 0x400. | ||
15 | */ | ||
16 | void pcibios_align_resource(void *data, struct resource *res, | ||
17 | resource_size_t size, resource_size_t align) | ||
18 | { | ||
19 | struct pci_dev *dev = data; | ||
20 | struct pci_channel *chan = dev->sysdata; | ||
21 | resource_size_t start = res->start; | ||
22 | |||
23 | if (res->flags & IORESOURCE_IO) { | ||
24 | if (start < PCIBIOS_MIN_IO + chan->io_resource->start) | ||
25 | start = PCIBIOS_MIN_IO + chan->io_resource->start; | ||
26 | |||
27 | /* | ||
28 | * Put everything into 0x00-0xff region modulo 0x400. | ||
29 | */ | ||
30 | if (start & 0x300) { | ||
31 | start = (start + 0x3ff) & ~0x3ff; | ||
32 | res->start = start; | ||
33 | } | ||
34 | } else if (res->flags & IORESOURCE_MEM) { | ||
35 | if (start < PCIBIOS_MIN_MEM + chan->mem_resource->start) | ||
36 | start = PCIBIOS_MIN_MEM + chan->mem_resource->start; | ||
37 | } | ||
38 | |||
39 | res->start = start; | ||
40 | } | ||
41 | |||
7 | int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | 42 | int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, |
8 | enum pci_mmap_state mmap_state, int write_combine) | 43 | enum pci_mmap_state mmap_state, int write_combine) |
9 | { | 44 | { |
@@ -24,3 +59,10 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
24 | vma->vm_end - vma->vm_start, | 59 | vma->vm_end - vma->vm_start, |
25 | vma->vm_page_prot); | 60 | vma->vm_page_prot); |
26 | } | 61 | } |
62 | |||
63 | #ifdef CONFIG_HOTPLUG | ||
64 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
65 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
66 | EXPORT_SYMBOL(PCIBIOS_MIN_IO); | ||
67 | EXPORT_SYMBOL(PCIBIOS_MIN_MEM); | ||
68 | #endif | ||
diff --git a/arch/sh/drivers/pci/pci-new.c b/arch/sh/drivers/pci/pci-new.c index 097eb8811120..4e9251f3d090 100644 --- a/arch/sh/drivers/pci/pci-new.c +++ b/arch/sh/drivers/pci/pci-new.c | |||
@@ -129,29 +129,6 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | |||
129 | res->end = region->end + offset; | 129 | res->end = region->end + offset; |
130 | } | 130 | } |
131 | 131 | ||
132 | void pcibios_align_resource(void *data, struct resource *res, | ||
133 | resource_size_t size, resource_size_t align) | ||
134 | __attribute__ ((weak)); | ||
135 | |||
136 | /* | ||
137 | * We need to avoid collisions with `mirrored' VGA ports | ||
138 | * and other strange ISA hardware, so we always want the | ||
139 | * addresses to be allocated in the 0x000-0x0ff region | ||
140 | * modulo 0x400. | ||
141 | */ | ||
142 | void pcibios_align_resource(void *data, struct resource *res, | ||
143 | resource_size_t size, resource_size_t align) | ||
144 | { | ||
145 | if (res->flags & IORESOURCE_IO) { | ||
146 | resource_size_t start = res->start; | ||
147 | |||
148 | if (start & 0x300) { | ||
149 | start = (start + 0x3ff) & ~0x3ff; | ||
150 | res->start = start; | ||
151 | } | ||
152 | } | ||
153 | } | ||
154 | |||
155 | int pcibios_enable_device(struct pci_dev *dev, int mask) | 132 | int pcibios_enable_device(struct pci_dev *dev, int mask) |
156 | { | 133 | { |
157 | u16 cmd, old_cmd; | 134 | u16 cmd, old_cmd; |
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index 6d659cd93c9d..f670988e033d 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -86,29 +86,6 @@ void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | |||
86 | res->end = region->end; | 86 | res->end = region->end; |
87 | } | 87 | } |
88 | 88 | ||
89 | void pcibios_align_resource(void *data, struct resource *res, | ||
90 | resource_size_t size, resource_size_t align) | ||
91 | __attribute__ ((weak)); | ||
92 | |||
93 | /* | ||
94 | * We need to avoid collisions with `mirrored' VGA ports | ||
95 | * and other strange ISA hardware, so we always want the | ||
96 | * addresses to be allocated in the 0x000-0x0ff region | ||
97 | * modulo 0x400. | ||
98 | */ | ||
99 | void pcibios_align_resource(void *data, struct resource *res, | ||
100 | resource_size_t size, resource_size_t align) | ||
101 | { | ||
102 | if (res->flags & IORESOURCE_IO) { | ||
103 | resource_size_t start = res->start; | ||
104 | |||
105 | if (start & 0x300) { | ||
106 | start = (start + 0x3ff) & ~0x3ff; | ||
107 | res->start = start; | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | |||
112 | int pcibios_enable_device(struct pci_dev *dev, int mask) | 89 | int pcibios_enable_device(struct pci_dev *dev, int mask) |
113 | { | 90 | { |
114 | u16 cmd, old_cmd; | 91 | u16 cmd, old_cmd; |
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h index 46afd449739d..5212bf6dd4b1 100644 --- a/arch/sh/include/asm/pci.h +++ b/arch/sh/include/asm/pci.h | |||
@@ -33,10 +33,7 @@ struct pci_channel { | |||
33 | */ | 33 | */ |
34 | extern struct pci_channel board_pci_channels[]; | 34 | extern struct pci_channel board_pci_channels[]; |
35 | 35 | ||
36 | /* ugly as hell, but makes drivers/pci/setup-res.c compile and work */ | 36 | extern unsigned long PCIBIOS_MIN_IO, PCIBIOS_MIN_MEM; |
37 | #define __PCI_CHAN(bus) ((struct pci_channel *)bus->sysdata) | ||
38 | #define PCIBIOS_MIN_IO __PCI_CHAN(bus)->io_resource->start | ||
39 | #define PCIBIOS_MIN_MEM __PCI_CHAN(bus)->mem_resource->start | ||
40 | 37 | ||
41 | struct pci_dev; | 38 | struct pci_dev; |
42 | 39 | ||