DragonFly kernel List (threaded) for 2007-05
DragonFly BSD
DragonFly kernel List (threaded) for 2007-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Crash while iterating over devices and resource


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 3 May 2007 14:00:43 -0700 (PDT)

:Hi all,
:
:Since the old ndisulator code (which is in DragonFly) doesn't recognize 
:my wireless card I've taken a shot at converting the current ndisulator 
:code of FreeBSD to DragonFly.
:
:The code now correctly identifies my wireless card however the 
:win-driver want to map io space. In the function where ndisulator does 
:this it recursively iterate over all devices and resources to select the 
:correct device to map to. The driver crashes in this code.
:
:Attached is a minimal example of the code which crashes (it crashes in 
:the SLIST_FOREACH [macro]call) and a dump of the output just prior to 
:crashing and after the crash.
:
:Since I don't now much about hardware I'm not sure whether it is normal 
:that pci1 is a child of pci0, and I also would have thought the 
:resource_list pointer of pci1 (which it crashes on) would be more in 
:sequentual to the pointer of the resource_list pointers of agp0 and pcib1.
:
:Hope one of you can help.
:
:Martin

    I think its a bug in pci_get_resource_list().

struct resource_list *
pci_get_resource_list (device_t dev, device_t child)
{
        struct pci_devinfo *    dinfo = device_get_ivars(child);
        struct resource_list *  rl = &dinfo->resources;

        if (!rl)
                return (NULL);

        return (rl);
}

    That should probably be:

struct resource_list *
pci_get_resource_list (device_t dev, device_t child)
{
        struct pci_devinfo *dinfo = device_get_ivars(child);

        if (dinfo == NULL)
                return (NULL);
        return (&dinfo->resources);
}


    Try that and see what you get.

    The PCI heirarchy is a real mess.  The busses can hang off of each
    other, e.g. one pci bus can be a device on another pci bus.  It all
    gets fed into the cpu somehow :-)

					-Matt




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]