aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/kernel/pci.c
diff options
context:
space:
mode:
authorChris Zankel <czankel@tensilica.com>2005-06-30 05:59:00 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-30 11:45:11 -0400
commit9ec55a9bd365dfc78945bb8e6bf5d0fdf1d75ad0 (patch)
treea7299a8e320b2205426a7e030db61b44ce1887c7 /arch/xtensa/kernel/pci.c
parente7d163f7666560c90b163907b9d96ec6207e0f6f (diff)
[PATCH] xtensa: Fix asm macro
Removed dead code in arch/xtensa/kernel/pci.c and use the pci_name() macro. Fixed an error in the delay asm macro: '1' is an invalid immediate value. Signed-off-by: Chris Zankel <chris@zankel.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/xtensa/kernel/pci.c')
-rw-r--r--arch/xtensa/kernel/pci.c95
1 files changed, 5 insertions, 90 deletions
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index d29a81648637..09887c96e9a1 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -57,50 +57,6 @@ struct pci_controller** pci_ctrl_tail = &pci_ctrl_head;
57 57
58static int pci_bus_count; 58static int pci_bus_count;
59 59
60static void pcibios_fixup_resources(struct pci_dev* dev);
61
62#if 0 // FIXME
63struct pci_fixup pcibios_fixups[] = {
64 { DECLARE_PCI_FIXUP_HEADER, PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources },
65 { 0 }
66};
67#endif
68
69void
70pcibios_update_resource(struct pci_dev *dev, struct resource *root,
71 struct resource *res, int resource)
72{
73 u32 new, check, mask;
74 int reg;
75 struct pci_controller* pci_ctrl = dev->sysdata;
76
77 new = res->start;
78 if (pci_ctrl && res->flags & IORESOURCE_IO) {
79 new -= pci_ctrl->io_space.base;
80 }
81 new |= (res->flags & PCI_REGION_FLAG_MASK);
82 if (resource < 6) {
83 reg = PCI_BASE_ADDRESS_0 + 4*resource;
84 } else if (resource == PCI_ROM_RESOURCE) {
85 res->flags |= PCI_ROM_ADDRESS_ENABLE;
86 reg = dev->rom_base_reg;
87 } else {
88 /* Somebody might have asked allocation of a non-standard resource */
89 return;
90 }
91
92 pci_write_config_dword(dev, reg, new);
93 pci_read_config_dword(dev, reg, &check);
94 mask = (new & PCI_BASE_ADDRESS_SPACE_IO) ?
95 PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK;
96
97 if ((new ^ check) & mask) {
98 printk(KERN_ERR "PCI: Error while updating region "
99 "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
100 new, check);
101 }
102}
103
104/* 60/*
105 * We need to avoid collisions with `mirrored' VGA ports 61 * We need to avoid collisions with `mirrored' VGA ports
106 * and other strange ISA hardware, so we always want the 62 * and other strange ISA hardware, so we always want the
@@ -125,7 +81,7 @@ pcibios_align_resource(void *data, struct resource *res, unsigned long size,
125 81
126 if (size > 0x100) { 82 if (size > 0x100) {
127 printk(KERN_ERR "PCI: I/O Region %s/%d too large" 83 printk(KERN_ERR "PCI: I/O Region %s/%d too large"
128 " (%ld bytes)\n", dev->slot_name, 84 " (%ld bytes)\n", pci_name(dev),
129 dev->resource - res, size); 85 dev->resource - res, size);
130 } 86 }
131 87
@@ -149,7 +105,7 @@ pcibios_enable_resources(struct pci_dev *dev, int mask)
149 r = &dev->resource[idx]; 105 r = &dev->resource[idx];
150 if (!r->start && r->end) { 106 if (!r->start && r->end) {
151 printk (KERN_ERR "PCI: Device %s not available because " 107 printk (KERN_ERR "PCI: Device %s not available because "
152 "of resource collisions\n", dev->slot_name); 108 "of resource collisions\n", pci_name(dev));
153 return -EINVAL; 109 return -EINVAL;
154 } 110 }
155 if (r->flags & IORESOURCE_IO) 111 if (r->flags & IORESOURCE_IO)
@@ -161,7 +117,7 @@ pcibios_enable_resources(struct pci_dev *dev, int mask)
161 cmd |= PCI_COMMAND_MEMORY; 117 cmd |= PCI_COMMAND_MEMORY;
162 if (cmd != old_cmd) { 118 if (cmd != old_cmd) {
163 printk("PCI: Enabling device %s (%04x -> %04x)\n", 119 printk("PCI: Enabling device %s (%04x -> %04x)\n",
164 dev->slot_name, old_cmd, cmd); 120 pci_name(dev), old_cmd, cmd);
165 pci_write_config_word(dev, PCI_COMMAND, cmd); 121 pci_write_config_word(dev, PCI_COMMAND, cmd);
166 } 122 }
167 return 0; 123 return 0;
@@ -293,7 +249,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
293 r = &dev->resource[idx]; 249 r = &dev->resource[idx];
294 if (!r->start && r->end) { 250 if (!r->start && r->end) {
295 printk(KERN_ERR "PCI: Device %s not available because " 251 printk(KERN_ERR "PCI: Device %s not available because "
296 "of resource collisions\n", dev->slot_name); 252 "of resource collisions\n", pci_name(dev));
297 return -EINVAL; 253 return -EINVAL;
298 } 254 }
299 if (r->flags & IORESOURCE_IO) 255 if (r->flags & IORESOURCE_IO)
@@ -303,7 +259,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
303 } 259 }
304 if (cmd != old_cmd) { 260 if (cmd != old_cmd) {
305 printk("PCI: Enabling device %s (%04x -> %04x)\n", 261 printk("PCI: Enabling device %s (%04x -> %04x)\n",
306 dev->slot_name, old_cmd, cmd); 262 pci_name(dev), old_cmd, cmd);
307 pci_write_config_word(dev, PCI_COMMAND, cmd); 263 pci_write_config_word(dev, PCI_COMMAND, cmd);
308 } 264 }
309 265
@@ -325,47 +281,6 @@ pci_controller_num(struct pci_dev *dev)
325 281
326#endif /* CONFIG_PROC_FS */ 282#endif /* CONFIG_PROC_FS */
327 283
328
329static void
330pcibios_fixup_resources(struct pci_dev *dev)
331{
332 struct pci_controller* pci_ctrl = (struct pci_controller *)dev->sysdata;
333 int i;
334 unsigned long offset;
335
336 if (!pci_ctrl) {
337 printk(KERN_ERR "No pci_ctrl for PCI dev %s!\n",dev->slot_name);
338 return;
339 }
340 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
341 struct resource *res = dev->resource + i;
342 if (!res->start || !res->flags)
343 continue;
344 if (res->end == 0xffffffff) {
345 DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n",
346 dev->slot_name, i, res->start, res->end);
347 res->end -= res->start;
348 res->start = 0;
349 continue;
350 }
351 offset = 0;
352 if (res->flags & IORESOURCE_IO)
353 offset = (unsigned long) pci_ctrl->io_space.base;
354 else if (res->flags & IORESOURCE_MEM)
355 offset = (unsigned long) pci_ctrl->mem_space.base;
356
357 if (offset != 0) {
358 res->start += offset;
359 res->end += offset;
360#ifdef DEBUG
361 printk("Fixup res %d (%lx) of dev %s: %lx -> %lx\n",
362 i, res->flags, dev->slot_name,
363 res->start - offset, res->start);
364#endif
365 }
366 }
367}
368
369/* 284/*
370 * Platform support for /proc/bus/pci/X/Y mmap()s, 285 * Platform support for /proc/bus/pci/X/Y mmap()s,
371 * modelled on the sparc64 implementation by Dave Miller. 286 * modelled on the sparc64 implementation by Dave Miller.