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

John Baldwin jhb at FreeBSD.org
Fri May 21 10:27:46 PDT 2004


On Tuesday 18 May 2004 12:53 pm, 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.

This breaks probing of non-ACPI PCI busses.  The problem is that 
acpi_get_handle() no longer returns NULL if there is no handle.  The previous 
acpi_get_handle() did this:

+static __inline ACPI_HANDLE
+acpi_get_handle(device_t dev)
+{
+    uintptr_t up;
+
+    if (BUS_READ_IVAR(device_get_parent(dev), dev, ACPI_IVAR_HANDLE, &up))
+       return (NULL);
+    return ((ACPI_HANDLE)up);
+}

The __BUS_ACCESSOR() macros do not check for any errors from BUS_READ_IVAR() 
and just return whatever stack garbage there is if the handle doesn't exist:

#define __BUS_ACCESSOR(varp, var, ivarp, ivar, type)			\
									\
static __inline type varp ## _get_ ## var(device_t dev)			\
{									\
	uintptr_t v;							\
	BUS_READ_IVAR(device_get_parent(dev), dev,			\
	    ivarp ## _IVAR_ ## ivar, &v);				\
	return ((type) v);						\
}									\

__BUS_ACCESSOR() is thus not suitable for cases where the ivar might not exist 
such as acpi_get_handle() and acpi_get_private().

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the cvs-src mailing list