/*
- * $Id: generic.c,v 1.4 1999/02/28 20:23:10 mj Exp $
- *
* The PCI Library -- Generic Direct Access Functions
*
- * Copyright (c) 1997--1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ * Copyright (c) 1997--2000 Martin Mares <mj@ucw.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
#include "internal.h"
-static void
+void
pci_generic_scan_bus(struct pci_access *a, byte *busmap, int bus)
{
int dev, multi, ht;
- struct pci_dev *t = pci_alloc_dev(a);
+ struct pci_dev *t;
a->debug("Scanning bus %02x for devices...\n", bus);
if (busmap[bus])
return;
}
busmap[bus] = 1;
+ t = pci_alloc_dev(a);
t->bus = bus;
for(dev=0; dev<32; dev++)
{
t->dev = dev;
multi = 0;
- for(t->func=0; t->func<8; t->func++)
+ for(t->func=0; !t->func || multi && t->func<8; t->func++)
{
u32 vd = pci_read_long(t, PCI_VENDOR_ID);
struct pci_dev *d;
if (!vd || vd == 0xffffffff)
- break;
+ continue;
ht = pci_read_byte(t, PCI_HEADER_TYPE);
if (!t->func)
multi = ht & 0x80;
default:
a->debug("Device %02x:%02x.%d has unknown header type %02x.\n", d->bus, d->dev, d->func, ht);
}
- if (!multi)
- break;
}
}
+ pci_free_dev(t);
}
void
pci_generic_scan_bus(a, busmap, 0);
}
-void
+int
pci_generic_fill_info(struct pci_dev *d, int flags)
{
struct pci_access *a = d->access;
d->rom_base_addr = a;
}
}
+ return flags & ~PCI_FILL_SIZES;
}
static int