Commit ee634c3f authored by Anton Blanchard's avatar Anton Blanchard

rework ISA bridge probe and use, from Todd Inglett

parent a6908fdd
......@@ -352,20 +352,6 @@ void iSeries_pcibios_fixup_bus(struct pci_bus* PciBus)
PPCDBG(PPCDBG_BUSWALK,__FUNCTION__"(0x%04X) Entry.\n",PciBus->number);
}
/***********************************************************************
* find_floppy(void)
*
* Finds the default floppy device, if the system has one, and returns
* the pci_dev for the isa bridge for the floppy device.
*
* Note: On iSeries there will only be a virtual diskette.
***********************************************************************/
struct pci_dev*
find_floppy(void)
{
PPCDBG(PPCDBG_BUSWALK,"- Find Floppy pci_dev.. None on iSeries.\n");
return NULL;
}
/***********************************************************************
......
......@@ -757,34 +757,6 @@ pci_find_hose_for_OF_device(struct device_node *node)
return NULL;
}
/***********************************************************************
* find_floppy(void)
*
* Finds the default floppy device, if the system has one, and returns
* the pci_dev for the isa bridge for the floppy device.
*
* Note: This functions finds the first "fdc" device and then looks to
* the parent device which should be the isa bridge device. If there
* is more than one floppy on the system, it will find the first one
* and maybe that is okay.
***********************************************************************/
struct pci_dev*
find_floppy(void)
{
struct device_node *floppy_dn;
struct pci_dev *floppy_dev = NULL;
int *reg;
floppy_dn = find_type_devices("fdc");
if (floppy_dn && floppy_dn->parent) {
if ((reg = (unsigned int *)get_property(floppy_dn->parent,"reg", 0)) != NULL)
floppy_dev = pci_find_slot((reg[0] & 0x00ff0000) >> 16, (reg[0] & 0x0000ff00) >> 8);
}
PPCDBG(PPCDBG_BUSWALK,"\tFloppy pci_dev\n");
PPCDBGCALL(PPCDBG_BUSWALK, dumpPci_Dev(floppy_dev) );
return floppy_dev;
}
/***********************************************************************
* ppc64_pcibios_init
*
......
......@@ -58,7 +58,6 @@ static void fixup_broken_pcnet32(struct pci_dev* dev);
static void fixup_windbond_82c105(struct pci_dev* dev);
void fixup_resources(struct pci_dev* dev);
struct pci_dev *find_floppy(void);
void iSeries_pcibios_init(void);
void pSeries_pcibios_init(void);
......@@ -94,8 +93,8 @@ struct pci_controller *phbtab[PCI_MAX_PHB];
static int pci_bus_count;
/* Floppy dev for ppc64_fd_dma_setup(). May be null if no floppy in the system. */
struct pci_dev *ppc64_floppy_dev = NULL;
/* Cached ISA bridge dev. */
struct pci_dev *ppc64_isabridge_dev = NULL;
struct pci_fixup pcibios_fixups[] = {
{ PCI_FIXUP_HEADER, PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32 },
......@@ -492,7 +491,10 @@ pcibios_init(void)
create_tce_tables();
PPCDBG(PPCDBG_BUSWALK,"pSeries create_tce_tables()\n");
#endif
ppc64_floppy_dev = find_floppy();
/* Cache the location of the ISA bridge (if we have one) */
if (ppc64_isabridge_dev = pci_find_class(PCI_CLASS_BRIDGE_ISA << 8, NULL))
printk("ISA bridge at %s\n", ppc64_isabridge_dev->slot_name);
printk("PCI: Probing PCI hardware done\n");
PPCDBG(PPCDBG_BUSWALK,"PCI: Probing PCI hardware done.\n");
......
......@@ -46,7 +46,7 @@ extern int pci_set_reset(struct pci_dev*,int);
extern int device_Location(struct pci_dev*,char*);
extern int format_device_location(struct pci_dev*,char*, int );
extern struct pci_dev *ppc64_floppy_dev;
extern struct pci_dev *ppc64_isabridge_dev; /* may be NULL if no ISA bus */
/*******************************************************************
* PCI device_node operations
......
......@@ -131,8 +131,12 @@ u8 iSeries_Get_Bus( struct pci_dev * dv )
return 0;
}
static inline struct TceTable *get_tce_table(struct pci_dev *dev) {
static inline struct TceTable *get_tce_table(struct pci_dev *dev)
{
if (!dev)
dev = ppc64_isabridge_dev;
if (!dev)
return NULL;
if ( ( _machine == _MACH_iSeries ) && ( dev->bus ) )
return tceTables[dev->bus->number];
/* On the iSeries, the virtual bus will take this path. There is a */
......
......@@ -36,8 +36,6 @@
#define fd_dma_setup(addr,size,mode,io) ppc64_fd_dma_setup(addr,size,mode,io)
extern struct pci_dev *ppc64_floppy_dev;
static __inline__ int
ppc64_fd_dma_setup(char *addr, unsigned long size, int mode, int io)
{
......@@ -52,12 +50,12 @@ ppc64_fd_dma_setup(char *addr, unsigned long size, int mode, int io)
if (bus_addr
&& (addr != prev_addr || size != prev_size || dir != prev_dir)) {
/* different from last time -- unmap prev */
pci_unmap_single(ppc64_floppy_dev, bus_addr, prev_size, prev_dir);
pci_unmap_single(NULL, bus_addr, prev_size, prev_dir);
bus_addr = 0;
}
if (!bus_addr) /* need to map it */ {
bus_addr = pci_map_single(ppc64_floppy_dev, addr, size, dir);
bus_addr = pci_map_single(NULL, addr, size, dir);
}
/* remember this one as prev */
......
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