aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-10-10 08:58:41 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-10 08:58:41 -0400
commit3c3f42d63a11f2e22dbff6bb4d170f92dbd39316 (patch)
tree2619d63e6d49480b55de02044a75f8c843dbd811
parente574d238ab907963ae6f97cb6bf12bb8fd48c376 (diff)
powerpc: Start merging 64-bit support into powermac files
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/platforms/powermac/pci.c194
-rw-r--r--arch/powerpc/platforms/powermac/pic.c32
-rw-r--r--arch/powerpc/platforms/powermac/pmac.h25
-rw-r--r--arch/powerpc/platforms/powermac/setup.c20
4 files changed, 128 insertions, 143 deletions
<
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 40bcd3e55afb..afb147e6b89f 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1,8 +1,5 @@
1/* 1/*
2 * Support for PCI bridges found on Power Macintoshes. 2 * Support for PCI bridges found on Power Macintoshes.
3 * At present the "bandit" and "chaos" bridges are supported.
4 * Fortunately you access configuration space in the same
5 * way with either bridge.
6 * 3 *
7 * Copyright (C) 2003 Benjamin Herrenschmuidt (benh@kernel.crashing.org) 4 * Copyright (C) 2003 Benjamin Herrenschmuidt (benh@kernel.crashing.org)
8 * Copyright (C) 1997 Paul Mackerras (paulus@samba.org) 5 * Copyright (C) 1997 Paul Mackerras (paulus@samba.org)
@@ -26,6 +23,10 @@
26#include <asm/pci-bridge.h> 23#include <asm/pci-bridge.h>
27#include <asm/machdep.h> 24#include <asm/machdep.h>
28#include <asm/pmac_feature.h> 25#include <asm/pmac_feature.h>
26#ifdef CONFIG_PPC64
27#include <asm/iommu.h>
28#include <asm/ppc-pci.h>
29#endif
29 30
30#undef DEBUG 31#undef DEBUG
31 32
@@ -160,9 +161,13 @@ static unsigned long macrisc_cfg_access(struct pci_controller* hose,
160static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn, 161static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
161 int offset, int len, u32 *val) 162 int offset, int len, u32 *val)
162{ 163{
163 struct pci_controller *hose = bus->sysdata; 164 struct pci_controller *hose;
164 unsigned long addr; 165 unsigned long addr;
165 166
167 hose = pci_bus_to_host(bus);
168 if (hose == NULL)
169 return PCIBIOS_DEVICE_NOT_FOUND;
170
166 addr = macrisc_cfg_access(hose, bus->number, devfn, offset); 171 addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
167 if (!addr) 172 if (!addr)
168 return PCIBIOS_DEVICE_NOT_FOUND; 173 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -187,9 +192,13 @@ static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
187static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn, 192static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
188 int offset, int len, u32 val) 193 int offset, int len, u32 val)
189{ 194{
190 struct pci_controller *hose = bus->sysdata; 195 struct pci_controller *hose;
191 unsigned long addr; 196 unsigned long addr;
192 197
198 hose = pci_bus_to_host(bus);
199 if (hose == NULL)
200 return PCIBIOS_DEVICE_NOT_FOUND;
201
193 addr = macrisc_cfg_access(hose, bus->number, devfn, offset); 202 addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
194 if (!addr) 203 if (!addr)
195 return PCIBIOS_DEVICE_NOT_FOUND; 204 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -221,7 +230,7 @@ static struct pci_ops macrisc_pci_ops =
221}; 230};
222 231
223/* 232/*
224 * Verifiy that a specific (bus, dev_fn) exists on chaos 233 * Verify that a specific (bus, dev_fn) exists on chaos
225 */ 234 */
226static int 235static int
227chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) 236chaos_validate_dev(struct pci_bus *bus, int devfn, int offset)
@@ -274,7 +283,6 @@ static struct pci_ops chaos_pci_ops =
274}; 283};
275 284
276#ifdef CONFIG_POWER4 285#ifdef CONFIG_POWER4
277
278/* 286/*
279 * These versions of U3 HyperTransport config space access ops do not 287 * These versions of U3 HyperTransport config space access ops do not
280 * implement self-view of the HT host yet 288 * implement self-view of the HT host yet
@@ -342,11 +350,11 @@ static unsigned long u3_ht_cfg_access(struct pci_controller* hose,
342static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, 350static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
343 int offset, int len, u32 *val) 351 int offset, int len, u32 *val)
344{ 352{
345 struct pci_controller *hose = bus->sysdata; 353 struct pci_controller *hose;
346 unsigned long addr; 354 unsigned long addr;
347 355
348 struct device_node *np = pci_busdev_to_OF_node(bus, devfn); 356 hose = pci_bus_to_host(bus);
349 if (np == NULL) 357 if (hose == NULL)
350 return PCIBIOS_DEVICE_NOT_FOUND; 358 return PCIBIOS_DEVICE_NOT_FOUND;
351 359
352 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); 360 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
@@ -357,19 +365,19 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
357 case 0: 365 case 0:
358 break; 366 break;
359 case 1: 367 case 1:
360 switch (len) { 368 switch (len) {
361 case 1: 369 case 1:
362 *val = 0xff; break; 370 *val = 0xff; break;
363 case 2: 371 case 2:
364 *val = 0xffff; break; 372 *val = 0xffff; break;
365 default: 373 default:
366 *val = 0xfffffffful; break; 374 *val = 0xfffffffful; break;
367 } 375 }
368 return PCIBIOS_SUCCESSFUL; 376 return PCIBIOS_SUCCESSFUL;
369 default: 377 default:
370 return PCIBIOS_DEVICE_NOT_FOUND; 378 return PCIBIOS_DEVICE_NOT_FOUND;
371 } 379 }
372 380
373 /* 381 /*
374 * Note: the caller has already checked that offset is 382 * Note: the caller has already checked that offset is
375 * suitably aligned and that len is 1, 2 or 4. 383 * suitably aligned and that len is 1, 2 or 4.
@@ -391,11 +399,11 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
391static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, 399static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
392 int offset, int len, u32 val) 400 int offset, int len, u32 val)
393{ 401{
394 struct pci_controller *hose = bus->sysdata; 402 struct pci_controller *hose;
395 unsigned long addr; 403 unsigned long addr;
396 404
397 struct device_node *np = pci_busdev_to_OF_node(bus, devfn); 405 hose = pci_bus_to_host(bus);
398 if (np == NULL) 406 if (hose == NULL)
399 return PCIBIOS_DEVICE_NOT_FOUND; 407 return PCIBIOS_DEVICE_NOT_FOUND;
400 408
401 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); 409 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
@@ -437,15 +445,13 @@ static struct pci_ops u3_ht_pci_ops =
437 u3_ht_read_config, 445 u3_ht_read_config,
438 u3_ht_write_config 446 u3_ht_write_config
439}; 447};
440
441#endif /* CONFIG_POWER4 */ 448#endif /* CONFIG_POWER4 */
442 449
443/* 450/*
444 * For a bandit bridge, turn on cache coherency if necessary. 451 * For a bandit bridge, turn on cache coherency if necessary.
445 * N.B. we could clean this up using the hose ops directly. 452 * N.B. we could clean this up using the hose ops directly.
446 */ 453 */
447static void __init 454static void __init init_bandit(struct pci_controller *bp)
448init_bandit(struct pci_controller *bp)
449{ 455{
450 unsigned int vendev, magic; 456 unsigned int vendev, magic;
451 int rev; 457 int rev;
@@ -485,8 +491,7 @@ init_bandit(struct pci_controller *bp)
485/* 491/*
486 * Tweak the PCI-PCI bridge chip on the blue & white G3s. 492 * Tweak the PCI-PCI bridge chip on the blue & white G3s.
487 */ 493 */
488static void __init 494static void __init init_p2pbridge(void)
489init_p2pbridge(void)