cvs commit: src/sys/dev/acpica acpivar.h

Nate Lawson nate at root.org
Thu May 20 17:54:27 PDT 2004


Interesting, I didn't get that in my testing.  Try this patch:

Index: /sys/sys/bus.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/bus.h,v
retrieving revision 1.58
diff -u -r1.58 bus.h
--- /sys/sys/bus.h	17 Mar 2004 17:40:34 -0000	1.58
+++ /sys/sys/bus.h	21 May 2004 00:48:23 -0000
@@ -456,8 +456,9 @@
 static __inline type varp ## _get_ ## var(device_t dev)			\
 {									\
 	uintptr_t v;							\
-	BUS_READ_IVAR(device_get_parent(dev), dev,			\
-	    ivarp ## _IVAR_ ## ivar, &v);				\
+	if (BUS_READ_IVAR(device_get_parent(dev), dev,			\
+	    ivarp ## _IVAR_ ## ivar, &v) != 0)				\
+		v = (type) 0;						\
 	return ((type) v);						\
 }									\
 									\
I don't know if this change will be acceptable though.  It's probably
better to change the get function to take a pointer argument and return
the value from BUS_READ_IVAR.

-Nate

On Fri, 21 May 2004, Peter Edwards wrote:
> Hi Nate,
> This appears to be the cause of a boot-time panic for me, which for some
> reason only manifests itself when I've modules other than ACPI brought
> in by the loader (any of agp, vesa or snd_ich)
>
> Unlike the methods they replace, the __BUS_ACCESSOR methods from
> sys/bus.h don't seem to check the return code of BUS_READ_IVAR to return
> NULL on failure. The first few frames of the panic look like this
> (sorry, too early in the boot process for a dump: I can transcribe more
> if you need it)
>
>  > AcpiNsWalkNamespace() + 0x53 (contrib/dev/acpica/nswalk.c:291)
>  > AcpiWalkNamespace() + 0x47 (contrib/dev/acpica/nsxfeval.c:525)
>  > acpi_pci_attach()
>
> At the site of the crash:
>  > ChildType = ChildNode->Type
>
> The value of ChildNode appears to be 0xffffffff (taken from EAX), so it
> looks like that's what the __BUS_ACCESSOR method is returning for a
> failure.  Rolling back the commit fixes the issue.
>
> Nate Lawson wrote:
>
> >njl         2004/05/18 09:53:29 PDT
> >
> >  FreeBSD src repository
> >
> >  Modified files:
> >    sys/dev/acpica       acpivar.h
> >  Log:
> >  Use the simpler __BUS_ACCESSOR macros for ivars instead of defining them
> >  ourselves.
> >
> >  Revision  Changes    Path
> >  1.65      +3 -56     src/sys/dev/acpica/acpivar.h
> >
> >
> >
>


More information about the cvs-src mailing list