filo on Tyan s2880
Stefan Reinauer
stepan at suse.de
Thu Oct 30 07:02:01 CET 2003
* SONE Takeshi <ts1 at tsn.or.jp> [031030 13:25]:
> On Thu, Oct 30, 2003 at 12:40:02PM +0100, Stefan Reinauer wrote:
> > * SONE Takeshi <ts1 at tsn.or.jp> [031030 11:40]:
> > > On Thu, Oct 30, 2003 at 11:34:29AM +0100, Stefan Reinauer wrote:
> > > > I am using an etherboot payload that reads an elf image from
> > > > the first sectors on the disk. This works fine, I put filo there
> > > > so I can load a kernel from any filesystem. Unfortunately filo seems
> > > > to find no IDE controller, it says IDE channel 0 not found.
> > > > Etherboot and Linux can see the ide controller though (it's on bus 1)
> > >
> > > Maybe the problem is with my PCI code.
> > > Please send me the output log with DEBUG_ALL.
> >
> > You only seem to scan bus 0:
>
> Ok..
> My PCI scan routine starts from bus 0, and recurses when PCI bridges are
> found. I think I took this algorithm from pciutils.
>
> However your board has only host bridges on bus 0, so FILO doesn't know
> if bus 1 exists.
>
> I checked Etherboot and it just scans bus 0 to 255 unconditionally.
> I don't know which is better.
> Anyway attached patch changes the PCI scan to Etherboot way.
Thanks. with this patch it also works using PCI.
Stefan
--
Stefan Reinauer, SUSE LINUX AG
Teamleader Architecture Development
-------------- next part --------------
Index: main/pci.c
===================================================================
RCS file: /home/ts1/cvsroot/filo/main/pci.c,v
retrieving revision 1.3
diff -u -r1.3 pci.c
--- main/pci.c 14 Oct 2003 19:54:29 -0000 1.3
+++ main/pci.c 30 Oct 2003 12:22:17 -0000
@@ -6,37 +6,34 @@
static struct pci_dev *dev_list;
static int n_devs;
-static void pci_scan_bus(int bus)
+static void pci_scan_bus(void)
{
- int devnum, fn, is_multi, vid;
+ int bus, devnum, fn, is_multi, vid;
pci_addr addr;
unsigned int htype;
- for (devnum = 0; devnum < 32; devnum++) {
- is_multi = 0;
- for (fn = 0; fn==0 || (is_multi && fn<8); fn++) {
- addr = PCI_ADDR(bus, devnum, fn);
- vid = pci_read16(addr, PCI_VENDOR_ID);
- if (vid==0xffff || vid==0)
- continue;
-
- htype = pci_read8(addr, PCI_HEADER_TYPE);
- if (fn == 0)
- is_multi = htype & 0x80;
- htype &= 0x7f;
-
- if (dev_list) {
- dev_list[n_devs].addr = addr;
- dev_list[n_devs].vendor = vid;
- dev_list[n_devs].device = pci_read16(addr, PCI_DEVICE_ID);
- dev_list[n_devs].devclass = pci_read16(addr, PCI_CLASS_DEVICE);
- dev_list[n_devs].prog_if = pci_read8(addr, PCI_CLASS_PROG);
+ for (bus = 0; bus < 256; bus++) {
+ for (devnum = 0; devnum < 32; devnum++) {
+ is_multi = 0;
+ for (fn = 0; fn==0 || (is_multi && fn<8); fn++) {
+ addr = PCI_ADDR(bus, devnum, fn);
+ vid = pci_read16(addr, PCI_VENDOR_ID);
+ if (vid==0xffff || vid==0)
+ continue;
+
+ htype = pci_read8(addr, PCI_HEADER_TYPE);
+ if (fn == 0)
+ is_multi = htype & 0x80;
+
+ if (dev_list) {
+ dev_list[n_devs].addr = addr;
+ dev_list[n_devs].vendor = vid;
+ dev_list[n_devs].device = pci_read16(addr, PCI_DEVICE_ID);
+ dev_list[n_devs].devclass = pci_read16(addr, PCI_CLASS_DEVICE);
+ dev_list[n_devs].prog_if = pci_read8(addr, PCI_CLASS_PROG);
+ }
+ n_devs++;
}
- n_devs++;
-
- if (htype==PCI_HEADER_TYPE_BRIDGE
- || htype==PCI_HEADER_TYPE_CARDBUS)
- pci_scan_bus(pci_read8(addr, PCI_SECONDARY_BUS));
}
}
}
@@ -46,13 +43,13 @@
/* Count devices */
dev_list = 0;
debug("Scanning PCI: ");
- pci_scan_bus(0);
+ pci_scan_bus();
debug("found %d devices\n", n_devs);
/* Make the list */
dev_list = malloc(n_devs * sizeof(struct pci_dev));
n_devs = 0;
- pci_scan_bus(0);
+ pci_scan_bus();
#if DEBUG
{
More information about the coreboot
mailing list