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: Martin <dragonfly@xxxxxxxx>
Date: Sat, 05 May 2007 19:51:41 +0200

Matthew Dillon wrote:
: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


This fixed the issue! However the next one I got stuck on was the orm0. I fixed that by changing:


struct resource_list *
bus_generic_get_resource_list(device_t dev, device_t child)
{
	struct resource_list *rl;

	if (dev->parent)
		rl = BUS_GET_RESOURCE_LIST(dev->parent, child);
	else
		rl = NULL;
	return (rl);
}

to the FreeBSD version:

struct resource_list *
bus_generic_get_resource_list(device_t dev, device_t child)
{
	return (NULL);
}

I've no idea whether this correct.

After this one I got stuck on rl0. This one I simple passed by physically removing my network card ;) I need to figure out which part of the code is crashing in the rl-driver/resources so I can put this card back in, but first I want to make some progress with the ndisulator code.

Martin



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