Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8055
b: refs/heads/master
c: b2ad7b5
h: refs/heads/master
i:
  8053: b87d2d2
  8051: 604f3e7
  8047: 501c9c2
v: v3
  • Loading branch information
Paul Mackerras committed Sep 9, 2005
1 parent 4c566de commit 01228a1
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 58 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 766375362a1dcac63dc0c0fb61ce4143c8de63d9
refs/heads/master: b2ad7b5e8115582cdf5bbda065aa516c24d62c21
6 changes: 3 additions & 3 deletions trunk/arch/ppc64/kernel/misc.S
Original file line number Diff line number Diff line change
Expand Up @@ -1431,9 +1431,9 @@ _GLOBAL(sys_call_table)
.llong .sys_ni_syscall /* 195 - 32bit only stat64 */
.llong .sys_ni_syscall /* 32bit only lstat64 */
.llong .sys_ni_syscall /* 32bit only fstat64 */
.llong .sys_ni_syscall /* 32bit only pciconfig_read */
.llong .sys_ni_syscall /* 32bit only pciconfig_write */
.llong .sys_ni_syscall /* 32bit only pciconfig_iobase */
.llong .sys_pciconfig_read
.llong .sys_pciconfig_write
.llong .sys_pciconfig_iobase /* 200 - pciconfig_iobase */
.llong .sys_ni_syscall /* reserved for MacOnLinux */
.llong .sys_getdents64
.llong .sys_pivot_root
Expand Down
60 changes: 60 additions & 0 deletions trunk/arch/ppc64/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/bootmem.h>
#include <linux/mm.h>
#include <linux/list.h>
#include <linux/syscalls.h>

#include <asm/processor.h>
#include <asm/io.h>
Expand Down Expand Up @@ -984,3 +985,62 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar,
}

#endif /* CONFIG_PPC_MULTIPLATFORM */


#define IOBASE_BRIDGE_NUMBER 0
#define IOBASE_MEMORY 1
#define IOBASE_IO 2
#define IOBASE_ISA_IO 3
#define IOBASE_ISA_MEM 4

long sys_pciconfig_iobase(long which, unsigned long in_bus,
unsigned long in_devfn)
{
struct pci_controller* hose;
struct list_head *ln;
struct pci_bus *bus = NULL;
struct device_node *hose_node;

/* Argh ! Please forgive me for that hack, but that's the
* simplest way to get existing XFree to not lockup on some
* G5 machines... So when something asks for bus 0 io base
* (bus 0 is HT root), we return the AGP one instead.
*/
#ifdef CONFIG_PPC_PMAC
if (systemcfg->platform == PLATFORM_POWERMAC &&
machine_is_compatible("MacRISC4"))
if (in_bus == 0)
in_bus = 0xf0;
#endif /* CONFIG_PPC_PMAC */

/* That syscall isn't quite compatible with PCI domains, but it's
* used on pre-domains setup. We return the first match
*/

for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) {
bus = pci_bus_b(ln);
if (in_bus >= bus->number && in_bus < (bus->number + bus->subordinate))
break;
bus = NULL;
}
if (bus == NULL || bus->sysdata == NULL)
return -ENODEV;

hose_node = (struct device_node *)bus->sysdata;
hose = PCI_DN(hose_node)->phb;

switch (which) {
case IOBASE_BRIDGE_NUMBER:
return (long)hose->first_busno;
case IOBASE_MEMORY:
return (long)hose->pci_mem_offset;
case IOBASE_IO:
return (long)hose->io_base_phys;
case IOBASE_ISA_IO:
return (long)isa_io_base;
case IOBASE_ISA_MEM:
return -EINVAL;
}

return -EOPNOTSUPP;
}
55 changes: 1 addition & 54 deletions trunk/arch/ppc64/kernel/sys_ppc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,62 +708,9 @@ asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubu
compat_ptr(ubuf));
}

#define IOBASE_BRIDGE_NUMBER 0
#define IOBASE_MEMORY 1
#define IOBASE_IO 2
#define IOBASE_ISA_IO 3
#define IOBASE_ISA_MEM 4

asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn)
{
#ifdef CONFIG_PCI
struct pci_controller* hose;
struct list_head *ln;
struct pci_bus *bus = NULL;
struct device_node *hose_node;

/* Argh ! Please forgive me for that hack, but that's the
* simplest way to get existing XFree to not lockup on some
* G5 machines... So when something asks for bus 0 io base
* (bus 0 is HT root), we return the AGP one instead.
*/
#ifdef CONFIG_PPC_PMAC
if (systemcfg->platform == PLATFORM_POWERMAC &&
machine_is_compatible("MacRISC4"))
if (in_bus == 0)
in_bus = 0xf0;
#endif /* CONFIG_PPC_PMAC */

/* That syscall isn't quite compatible with PCI domains, but it's
* used on pre-domains setup. We return the first match
*/

for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) {
bus = pci_bus_b(ln);
if (in_bus >= bus->number && in_bus < (bus->number + bus->subordinate))
break;
bus = NULL;
}
if (bus == NULL || bus->sysdata == NULL)
return -ENODEV;

hose_node = bus->sysdata;
hose = PCI_DN(hose_node)->phb;

switch (which) {
case IOBASE_BRIDGE_NUMBER:
return (long)hose->first_busno;
case IOBASE_MEMORY:
return (long)hose->pci_mem_offset;
case IOBASE_IO:
return (long)hose->io_base_phys;
case IOBASE_ISA_IO:
return (long)isa_io_base;
case IOBASE_ISA_MEM:
return -EINVAL;
}
#endif /* CONFIG_PCI */
return -EOPNOTSUPP;
return sys_pciconfig_iobase(which, in_bus, in_devfn);
}


Expand Down

0 comments on commit 01228a1

Please sign in to comment.