Date: Fri, 21 May 2004 13:27:16 -0400 From: John Baldwin <jhb@FreeBSD.org> To: Nate Lawson <njl@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/acpica acpivar.h Message-ID: <200405211327.16382.jhb@FreeBSD.org> In-Reply-To: <200405181653.i4IGrU6g062365@repoman.freebsd.org> References: <200405181653.i4IGrU6g062365@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405211327.16382.jhb>
