Re: CVS commit: src/sys/sys
On 09/10/2013 10:42 PM, David Holland wrote: On Tue, Sep 10, 2013 at 12:54:14PM +, Gr?goire Sutre wrote: Modified Files: src/sys/sys: cdefs.h Log Message: Unbreak vax build (which still uses gcc 4.1). See PR lib/48131. Shouldn't that be conditionalized on the gcc version, then? We would have to determine precisely which gcc version requires the fix. Here, I have merely restored some bits that I over-simplified previously. (I didn't try a vax build at that time.) Grégoire
CVS commit: src/sys/sys
Module Name:src Committed By: gsutre Date: Tue Sep 10 12:54:14 UTC 2013 Modified Files: src/sys/sys: cdefs.h Log Message: Unbreak vax build (which still uses gcc 4.1). See PR lib/48131. To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/sys/sys/cdefs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/cdefs.h diff -u src/sys/sys/cdefs.h:1.109 src/sys/sys/cdefs.h:1.110 --- src/sys/sys/cdefs.h:1.109 Thu Sep 5 21:00:15 2013 +++ src/sys/sys/cdefs.h Tue Sep 10 12:54:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: cdefs.h,v 1.109 2013/09/05 21:00:15 gsutre Exp $ */ +/* $NetBSD: cdefs.h,v 1.110 2013/09/10 12:54:14 gsutre Exp $ */ /* * Copyright (c) 1991, 1993 @@ -553,8 +553,14 @@ #define __type_mask(t) (/*LINTED*/sizeof(t) sizeof(intmax_t) ? \ (~((1ULL (sizeof(t) * NBBY)) - 1)) : 0ULL) +#ifndef __ASSEMBLER__ +static __inline long long __zeroll(void) { return 0; } +static __inline unsigned long long __zeroull(void) { return 0; } +#else #define __zeroll() (0LL) #define __zeroull() (0ULL) +#endif + #define __negative_p(x) (!((x) 0) ((x) != 0)) #define __type_min_s(t) ((t)((1ULL (sizeof(t) * NBBY - 1
CVS commit: src/sys/sys
Module Name:src Committed By: gsutre Date: Tue Sep 10 12:54:14 UTC 2013 Modified Files: src/sys/sys: cdefs.h Log Message: Unbreak vax build (which still uses gcc 4.1). See PR lib/48131. To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/sys/sys/cdefs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/include/sys
Module Name:src Committed By: gsutre Date: Thu Sep 5 09:01:27 UTC 2013 Modified Files: src/tests/include/sys: t_cdefs.c Log Message: Fix two tests for typefit: constants larger than LLONG_MAX do not fit in a signed long long. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/include/sys/t_cdefs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/include/sys/t_cdefs.c diff -u src/tests/include/sys/t_cdefs.c:1.2 src/tests/include/sys/t_cdefs.c:1.3 --- src/tests/include/sys/t_cdefs.c:1.2 Fri Mar 23 23:12:28 2012 +++ src/tests/include/sys/t_cdefs.c Thu Sep 5 09:01:27 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: t_cdefs.c,v 1.2 2012/03/23 23:12:28 matt Exp $ */ +/* $NetBSD: t_cdefs.c,v 1.3 2013/09/05 09:01:27 gsutre Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved.); -__RCSID($NetBSD: t_cdefs.c,v 1.2 2012/03/23 23:12:28 matt Exp $); +__RCSID($NetBSD: t_cdefs.c,v 1.3 2013/09/05 09:01:27 gsutre Exp $); #include atf-c.h #include sys/types.h @@ -206,8 +206,8 @@ ATF_TC_BODY(stypefit, tc) CHECK(signed long long, -1, 0); CHECK(signed long long, 1, 0); CHECK(signed long long, 0x7fffLL, 0); - CHECK(signed long long, 0x8000LL, 0); - CHECK(signed long long, 0xLL, 0); + CHECK(signed long long, 0x8000LL, 1); + CHECK(signed long long, 0xLL, 1); #undef CHECK }
CVS commit: src/sys/sys
Module Name:src Committed By: gsutre Date: Thu Sep 5 09:03:13 UTC 2013 Modified Files: src/sys/sys: cdefs.h Log Message: Check for overflow in __type_fit_s when casting to intmax_t. Fixes the first half of PR lib/48131. ok christos@ To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/sys/cdefs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/cdefs.h diff -u src/sys/sys/cdefs.h:1.107 src/sys/sys/cdefs.h:1.108 --- src/sys/sys/cdefs.h:1.107 Wed May 29 19:02:30 2013 +++ src/sys/sys/cdefs.h Thu Sep 5 09:03:13 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: cdefs.h,v 1.107 2013/05/29 19:02:30 martin Exp $ */ +/* $NetBSD: cdefs.h,v 1.108 2013/09/05 09:03:13 gsutre Exp $ */ /* * Copyright (c) 1991, 1993 @@ -575,7 +575,8 @@ static __inline int __negative_p(double #define __type_fit_s(t, a) (/*LINTED*/__negative_p(a) ? \ ((intmax_t)((a) + __zeroll()) = (intmax_t)__type_min_s(t)) : \ -((intmax_t)((a) + __zeroll()) = (intmax_t)__type_max_s(t))) +((intmax_t)((a) + __zeroll()) = (intmax_t)0 \ + (intmax_t)((a) + __zeroll()) = (intmax_t)__type_max_s(t))) /* * return true if value 'a' fits in type 't'
CVS commit: src/sys/sys
Module Name:src Committed By: gsutre Date: Thu Sep 5 21:00:15 UTC 2013 Modified Files: src/sys/sys: cdefs.h Log Message: Implement __negative_p without floating-point arithmetic, using a solution proposed by jxh on Stack Overflow. Fixes the second half of PR lib/48131. While there, simplify __type_fit_u by using the same logic as in __type_fit_s. ok christos@ To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/sys/cdefs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/cdefs.h diff -u src/sys/sys/cdefs.h:1.108 src/sys/sys/cdefs.h:1.109 --- src/sys/sys/cdefs.h:1.108 Thu Sep 5 09:03:13 2013 +++ src/sys/sys/cdefs.h Thu Sep 5 21:00:15 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: cdefs.h,v 1.108 2013/09/05 09:03:13 gsutre Exp $ */ +/* $NetBSD: cdefs.h,v 1.109 2013/09/05 21:00:15 gsutre Exp $ */ /* * Copyright (c) 1991, 1993 @@ -553,13 +553,9 @@ #define __type_mask(t) (/*LINTED*/sizeof(t) sizeof(intmax_t) ? \ (~((1ULL (sizeof(t) * NBBY)) - 1)) : 0ULL) -#ifndef __ASSEMBLER__ -static __inline long long __zeroll(void) { return 0; } -static __inline int __negative_p(double x) { return x 0; } -#else #define __zeroll() (0LL) -#define __negative_p(x) ((x) 0) -#endif +#define __zeroull() (0ULL) +#define __negative_p(x) (!((x) 0) ((x) != 0)) #define __type_min_s(t) ((t)((1ULL (sizeof(t) * NBBY - 1 #define __type_max_s(t) ((t)~((1ULL (sizeof(t) * NBBY - 1 @@ -570,8 +566,8 @@ static __inline int __negative_p(double #define __type_max(t) (__type_is_signed(t) ? __type_max_s(t) : __type_max_u(t)) -#define __type_fit_u(t, a) (/*LINTED*/sizeof(t) sizeof(intmax_t) ? \ -(((a) __type_mask(t)) == 0) : !__negative_p(a)) +#define __type_fit_u(t, a) (/*LINTED*/!__negative_p(a) \ +(uintmax_t)((a) + __zeroull()) = (uintmax_t)__type_max_u(t)) #define __type_fit_s(t, a) (/*LINTED*/__negative_p(a) ? \ ((intmax_t)((a) + __zeroll()) = (intmax_t)__type_min_s(t)) : \
CVS commit: src/tests/include/sys
Module Name:src Committed By: gsutre Date: Thu Sep 5 09:01:27 UTC 2013 Modified Files: src/tests/include/sys: t_cdefs.c Log Message: Fix two tests for typefit: constants larger than LLONG_MAX do not fit in a signed long long. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/include/sys/t_cdefs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/sys
Module Name:src Committed By: gsutre Date: Thu Sep 5 09:03:13 UTC 2013 Modified Files: src/sys/sys: cdefs.h Log Message: Check for overflow in __type_fit_s when casting to intmax_t. Fixes the first half of PR lib/48131. ok christos@ To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/sys/cdefs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/sys
Module Name:src Committed By: gsutre Date: Thu Sep 5 21:00:15 UTC 2013 Modified Files: src/sys/sys: cdefs.h Log Message: Implement __negative_p without floating-point arithmetic, using a solution proposed by jxh on Stack Overflow. Fixes the second half of PR lib/48131. While there, simplify __type_fit_u by using the same logic as in __type_fit_s. ok christos@ To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/sys/cdefs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tools/gmake
Module Name:src Committed By: gsutre Date: Fri Aug 16 10:29:32 UTC 2013 Modified Files: src/tools/gmake: Makefile Log Message: Use makeinfo built from src/tools/texinfo. Fixes PR toolchain/48123. ok apb@ To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tools/gmake/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tools/gmake/Makefile diff -u src/tools/gmake/Makefile:1.2 src/tools/gmake/Makefile:1.3 --- src/tools/gmake/Makefile:1.2 Fri Oct 27 22:36:23 2006 +++ src/tools/gmake/Makefile Fri Aug 16 10:29:32 2013 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2006/10/27 22:36:23 uwe Exp $ +# $NetBSD: Makefile,v 1.3 2013/08/16 10:29:32 gsutre Exp $ # GNUHOSTDIST= ${.CURDIR}/../../gnu/dist/gmake @@ -11,6 +11,8 @@ CONFIGURE_ENV+= CC=${HOST_CC:Q} \ CONFIGURE_ARGS= --program-prefix=${_TOOL_PREFIX}g CONFIGURE_ARGS+=--disable-nls +MAKE_ARGS= MAKEINFO=${TOOL_MAKEINFO:Q} + .NOTPARALLEL: .include ${.CURDIR}/../Makefile.gnuhost
CVS commit: src/tools/gmake
Module Name:src Committed By: gsutre Date: Fri Aug 16 10:29:32 UTC 2013 Modified Files: src/tools/gmake: Makefile Log Message: Use makeinfo built from src/tools/texinfo. Fixes PR toolchain/48123. ok apb@ To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tools/gmake/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/mit/xorg/server/xorg-server
Module Name:src Committed By: gsutre Date: Wed Oct 3 21:50:14 UTC 2012 Modified Files: src/external/mit/xorg/server/xorg-server: Makefile.Xserver src/external/mit/xorg/server/xorg-server/glx: Makefile.glx src/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg: Makefile Log Message: Enable GLX DRI2 support. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 \ src/external/mit/xorg/server/xorg-server/Makefile.Xserver cvs rdiff -u -r1.9 -r1.10 \ src/external/mit/xorg/server/xorg-server/glx/Makefile.glx cvs rdiff -u -r1.4 -r1.5 \ src/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/mit/xorg/server/xorg-server/Makefile.Xserver diff -u src/external/mit/xorg/server/xorg-server/Makefile.Xserver:1.12 src/external/mit/xorg/server/xorg-server/Makefile.Xserver:1.13 --- src/external/mit/xorg/server/xorg-server/Makefile.Xserver:1.12 Tue Aug 2 09:11:37 2011 +++ src/external/mit/xorg/server/xorg-server/Makefile.Xserver Wed Oct 3 21:50:14 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.Xserver,v 1.12 2011/08/02 09:11:37 mrg Exp $ +# $NetBSD: Makefile.Xserver,v 1.13 2012/10/03 21:50:14 gsutre Exp $ .for _SL in \ mi \ @@ -41,6 +41,7 @@ hw/xfree86/dixmods/xtrap \ hw/xfree86/doc \ hw/xfree86/dri \ + hw/xfree86/dri2 \ hw/xfree86/dummy \ hw/xfree86/i2c \ hw/xfree86/init \ Index: src/external/mit/xorg/server/xorg-server/glx/Makefile.glx diff -u src/external/mit/xorg/server/xorg-server/glx/Makefile.glx:1.9 src/external/mit/xorg/server/xorg-server/glx/Makefile.glx:1.10 --- src/external/mit/xorg/server/xorg-server/glx/Makefile.glx:1.9 Tue Aug 2 07:41:01 2011 +++ src/external/mit/xorg/server/xorg-server/glx/Makefile.glx Wed Oct 3 21:50:14 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.glx,v 1.9 2011/08/02 07:41:01 mrg Exp $ +# $NetBSD: Makefile.glx,v 1.10 2012/10/03 21:50:14 gsutre Exp $ .PATH: ${X11SRCDIR.xorg-server}/glx .PATH: ${X11SRCDIR.MesaLib}/src/mesa/glapi @@ -14,6 +14,7 @@ SRCS.glx= \ glapi_gentable.c \ glthread.c \ glxdri.c \ +glxdri2.c \ extension_string.c \ indirect_util.c \ indirect_program.c \ @@ -47,6 +48,8 @@ CPPFLAGS+= \ -I${X11SRCDIR.xorg-server}/include \ -I${X11SRCDIR.xorg-server}/glx \ -I${X11SRCDIR.xorg-server}/Xext \ + -I${X11SRCDIR.xorg-server}/hw/xfree86/dri \ + -I${X11SRCDIR.xorg-server}/hw/xfree86/dri2 \ -I${X11SRCDIR.MesaLib}/include \ -I${X11SRCDIR.MesaLib}/src/glx \ -I${X11SRCDIR.MesaLib}/src/mesa \ Index: src/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile diff -u src/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile:1.4 src/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile:1.5 --- src/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile:1.4 Sat Oct 22 14:40:41 2011 +++ src/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile Wed Oct 3 21:50:14 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2011/10/22 14:40:41 jmcneill Exp $ +# $NetBSD: Makefile,v 1.5 2012/10/03 21:50:14 gsutre Exp $ .include bsd.own.mk @@ -58,6 +58,7 @@ LDADD+= ${LDADD.xkb} LDADD+= ${LDADD.os} LDADD+= ${LDADD.glx} LDADD+= ${LDADD.hw/xfree86/dri} +LDADD+= ${LDADD.hw/xfree86/dri2} LDADD+= ${LDADD.hw/xfree86/dixmods/fb} LDADD+= ${LDADD.hw/xfree86/dixmods/xorgxkb} LDADD+= -lpixman-1 -lXfont -lfreetype -lXau -lfontenc -lXdmcp @@ -99,6 +100,7 @@ DPADD+= ${DPADD.dix} \ ${DPADD.os} \ ${DPADD.glx} \ ${DPADD.hw/xfree86/dri} \ + ${DPADD.hw/xfree86/dri2} \ ${DPADD.hw/xfree86/dixmods/fb} \ ${DPADD.hw/xfree86/fb} \ ${DPADD.hw/xfree86/init} \
CVS commit: src/external/mit/xorg/server/xorg-server
Module Name:src Committed By: gsutre Date: Wed Oct 3 21:50:14 UTC 2012 Modified Files: src/external/mit/xorg/server/xorg-server: Makefile.Xserver src/external/mit/xorg/server/xorg-server/glx: Makefile.glx src/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg: Makefile Log Message: Enable GLX DRI2 support. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 \ src/external/mit/xorg/server/xorg-server/Makefile.Xserver cvs rdiff -u -r1.9 -r1.10 \ src/external/mit/xorg/server/xorg-server/glx/Makefile.glx cvs rdiff -u -r1.4 -r1.5 \ src/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: gsutre Date: Sat Sep 29 10:26:15 UTC 2012 Modified Files: src/sys/dev/pci: pcidevs Log Message: Add Intel Ivy Bridge host bridge and integrated graphics device IDs, from the Linux Intel AGP driver. To generate a diff of this commit: cvs rdiff -u -r1.1138 -r1.1139 src/sys/dev/pci/pcidevs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: gsutre Date: Sat Sep 29 10:27:25 UTC 2012 Modified Files: src/sys/dev/pci: pcidevs.h pcidevs_data.h Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.1131 -r1.1132 src/sys/dev/pci/pcidevs.h cvs rdiff -u -r1.1130 -r1.1131 src/sys/dev/pci/pcidevs_data.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: gsutre Date: Sun Sep 9 20:23:38 UTC 2012 Modified Files: src/sys/dev/usb: uhub.c Log Message: In uhub_childdet, do not free the array of sub-devices if there is none. This prevents a kernel panic at shutdown on my laptop. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/dev/usb/uhub.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/uhub.c diff -u src/sys/dev/usb/uhub.c:1.117 src/sys/dev/usb/uhub.c:1.118 --- src/sys/dev/usb/uhub.c:1.117 Mon Mar 12 02:44:17 2012 +++ src/sys/dev/usb/uhub.c Sun Sep 9 20:23:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uhub.c,v 1.117 2012/03/12 02:44:17 mrg Exp $ */ +/* $NetBSD: uhub.c,v 1.118 2012/09/09 20:23:38 gsutre Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ /* @@ -36,7 +36,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uhub.c,v 1.117 2012/03/12 02:44:17 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: uhub.c,v 1.118 2012/09/09 20:23:38 gsutre Exp $); #include opt_usb.h @@ -671,7 +671,7 @@ uhub_childdet(device_t self, device_t ch nports = devhub-hub-hubdesc.bNbrPorts; for (port = 0; port nports; port++) { dev = devhub-hub-ports[port].device; - if (!dev) + if (!dev || dev-subdevlen == 0) continue; for (i = 0; i dev-subdevlen; i++) { if (dev-subdevs[i] == child) {
CVS commit: src/sys/dev/usb
Module Name:src Committed By: gsutre Date: Sun Sep 9 20:23:38 UTC 2012 Modified Files: src/sys/dev/usb: uhub.c Log Message: In uhub_childdet, do not free the array of sub-devices if there is none. This prevents a kernel panic at shutdown on my laptop. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/dev/usb/uhub.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: gsutre Date: Wed Sep 21 08:57:12 UTC 2011 Modified Files: src/sys/arch/i386/stand/lib: biosdisk.c Log Message: Fix btinfo_bootdisk's labelsector and btinfo_bootwedge's startblk for the non-GPT case. ok jakllsch@ To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/stand/lib/biosdisk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/lib/biosdisk.c diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.38 src/sys/arch/i386/stand/lib/biosdisk.c:1.39 --- src/sys/arch/i386/stand/lib/biosdisk.c:1.38 Sun Jul 17 20:54:41 2011 +++ src/sys/arch/i386/stand/lib/biosdisk.c Wed Sep 21 08:57:12 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: biosdisk.c,v 1.38 2011/07/17 20:54:41 joerg Exp $ */ +/* $NetBSD: biosdisk.c,v 1.39 2011/09/21 08:57:12 gsutre Exp $ */ /* * Copyright (c) 1996, 1998 @@ -389,12 +389,12 @@ ingest_label(d, lp); #ifdef _STANDALONE - bi_disk.labelsector = d-boff + LABELSECTOR; + bi_disk.labelsector = sector + LABELSECTOR; bi_disk.label.type = lp-d_type; memcpy(bi_disk.label.packname, lp-d_packname, 16); bi_disk.label.checksum = lp-d_checksum; - bi_wedge.matchblk = d-boff + LABELSECTOR; + bi_wedge.matchblk = sector + LABELSECTOR; bi_wedge.matchnblks = 1; md5(bi_wedge.matchhash, d-buf, d-ll.secsize);
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: gsutre Date: Wed Sep 21 08:57:12 UTC 2011 Modified Files: src/sys/arch/i386/stand/lib: biosdisk.c Log Message: Fix btinfo_bootdisk's labelsector and btinfo_bootwedge's startblk for the non-GPT case. ok jakllsch@ To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/arch/i386/stand/lib/biosdisk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: gsutre Date: Mon Sep 19 10:03:32 UTC 2011 Modified Files: src/sys/arch/x86/x86: x86_autoconf.c Log Message: PR/38356: Minoura Makoto: Use the device's unit (instead of autoconf's) to match the bootinfo root device. Fixes multiboot(8) root= option as well as GRUB knetbsd --root option. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/arch/x86/x86/x86_autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/x86_autoconf.c diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.60 src/sys/arch/x86/x86/x86_autoconf.c:1.61 --- src/sys/arch/x86/x86/x86_autoconf.c:1.60 Sat Jul 2 13:09:31 2011 +++ src/sys/arch/x86/x86/x86_autoconf.c Mon Sep 19 10:03:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_autoconf.c,v 1.60 2011/07/02 13:09:31 mrg Exp $ */ +/* $NetBSD: x86_autoconf.c,v 1.61 2011/09/19 10:03:32 gsutre Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: x86_autoconf.c,v 1.60 2011/07/02 13:09:31 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: x86_autoconf.c,v 1.61 2011/09/19 10:03:32 gsutre Exp $); #include sys/param.h #include sys/systm.h @@ -442,7 +442,7 @@ len = strlen(cd-cf_name); if (strncmp(cd-cf_name, biv-devname, len) == 0 - biv-devname[len] - '0' == cd-cf_unit) { + biv-devname[len] - '0' == device_unit(dv)) { handle_wedges(dv, biv-devname[len + 1] - 'a'); break; }
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: gsutre Date: Mon Sep 19 10:03:32 UTC 2011 Modified Files: src/sys/arch/x86/x86: x86_autoconf.c Log Message: PR/38356: Minoura Makoto: Use the device's unit (instead of autoconf's) to match the bootinfo root device. Fixes multiboot(8) root= option as well as GRUB knetbsd --root option. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/arch/x86/x86/x86_autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys
On 09/01/2011 05:10 PM, Christos Zoulas wrote: Module Name:src Committed By: christos Date: Thu Sep 1 15:10:32 UTC 2011 Modified Files: src/sys/arch/i386/eisa: eisa_machdep.c src/sys/arch/i386/mca: mca_machdep.c src/sys/arch/x86/include: bus_private.h src/sys/arch/x86/isa: isa_machdep.c src/sys/arch/x86/pci: pci_machdep.c src/sys/arch/x86/x86: bus_dma.c src/sys/arch/xen/xen: isa_machdep.c xpci_xenbus.c src/sys/sys: bus.h Log Message: Add bus_dma overrides. From dyoung Should NULL be allowed as first argument of bus_dma_tag_create? I would prefer for NULL to be allowed to make my life easier in the drmgem port from OpenBSD. But maybe requiring non-NULL would make more sense if this shall be used from MI device drivers only? +int +bus_dma_tag_create(bus_dma_tag_t obdt, const uint64_t present, +const struct bus_dma_overrides *ov, void *ctx, bus_dma_tag_t *bdtp) { + uint64_t bit, bits, nbits; + bus_dma_tag_t bdt; + const void *fp; - (*tag-_dmatag_destroy)(tag); + if (ov == NULL || present == 0) + return EINVAL; + + bdt = kmem_alloc(sizeof(struct x86_bus_dma_tag), KM_SLEEP); + + if (bdt == NULL) + return ENOMEM; + + bdt-bdt_super = obdt; + + for (bits = present; bits != 0; bits = nbits) { + nbits = bits (bits - 1); + bit = nbits ^ bits; + if ((fp = bit_to_function_pointer(ov, bit)) == NULL) { +#ifdef DEBUG + printf(%s: missing bit % PRIx64 \n, __func__, bit); +#endif + goto einval; + } + } + + bdt-bdt_ov = ov; + bdt-bdt_exists = obdt-bdt_exists | present; Here obdt might be NULL. Note: bus_space_tag_create has the same issue. Grégoire
Re: CVS commit: src/sys
On 09/18/2011 12:22 AM, Christos Zoulas wrote: Should NULL be allowed as first argument of bus_dma_tag_create? I would prefer for NULL to be allowed to make my life easier in the drmgem port from OpenBSD. But maybe requiring non-NULL would make more sense if this shall be used from MI device drivers only? I don't see why not, but still you need it for the scatter-gather private data. The sg private data can be placed in the bdt_ctx field. At least, it's the way I've updated the port today, but I don't pretend it's the right way. I've left tar files of stuff that I was playing with (starting from your git files) on http://www.netbsd.org/~christos/ Thanks, I'll look at them. Grégoire
CVS commit: src/sys/dev/pci
Module Name:src Committed By: gsutre Date: Sun Jan 30 23:43:09 UTC 2011 Modified Files: src/sys/dev/pci: agp_i810.c Log Message: Enable 36-bit addressing for chipsets that support it. While there, factorize offset computation. Inspired from OpenBSD and Intel docs. Note: agp_i810_bind/unbind_page will now fail with EINVAL if the physical address is too large for the chipset (instead of silently truncating it). ok jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/agp_i810.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/agp_i810.c diff -u src/sys/dev/pci/agp_i810.c:1.70 src/sys/dev/pci/agp_i810.c:1.71 --- src/sys/dev/pci/agp_i810.c:1.70 Tue Jan 25 10:52:11 2011 +++ src/sys/dev/pci/agp_i810.c Sun Jan 30 23:43:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: agp_i810.c,v 1.70 2011/01/25 10:52:11 gsutre Exp $ */ +/* $NetBSD: agp_i810.c,v 1.71 2011/01/30 23:43:08 gsutre Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.70 2011/01/25 10:52:11 gsutre Exp $); +__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.71 2011/01/30 23:43:08 gsutre Exp $); #include sys/param.h #include sys/systm.h @@ -100,8 +100,8 @@ static int agp_i810_init(struct agp_softc *); static int agp_i810_init(struct agp_softc *); -static void agp_i810_write_gtt_entry(struct agp_i810_softc *, off_t, - u_int32_t); +static int agp_i810_write_gtt_entry(struct agp_i810_softc *, off_t, +bus_addr_t); static struct agp_methods agp_i810_methods = { agp_i810_get_aperture, @@ -116,12 +116,37 @@ agp_i810_unbind_memory, }; -static void -agp_i810_write_gtt_entry(struct agp_i810_softc *isc, off_t off, u_int32_t v) +static int +agp_i810_write_gtt_entry(struct agp_i810_softc *isc, off_t off, bus_addr_t v) { - u_int32_t base_off; + u_int32_t pte; + bus_size_t base_off, wroff; + + /* Bits 11:4 (physical start address extension) should be zero. */ + if ((v 0xff0) != 0) + return EINVAL; + + pte = (u_int32_t)v; + /* + * We need to massage the pte if bus_addr_t is wider than 32 bits. + * The compiler isn't smart enough, hence the casts to uintmax_t. + */ + if (sizeof(bus_addr_t) sizeof(u_int32_t)) { + /* 965+ can do 36-bit addressing, add in the extra bits. */ + if (isc-chiptype == CHIP_I965 || + isc-chiptype == CHIP_G33 || + isc-chiptype == CHIP_G4X) { + if (((uintmax_t)v 36) != 0) +return EINVAL; + pte |= (v 28) 0xf0; + } else { + if (((uintmax_t)v 32) != 0) +return EINVAL; + } + } base_off = 0; + wroff = (off AGP_PAGE_SHIFT) * 4; switch (isc-chiptype) { case CHIP_I810: @@ -137,12 +162,12 @@ break; case CHIP_I915: case CHIP_G33: - bus_space_write_4(isc-gtt_bst, isc-gtt_bsh, - (u_int32_t)((off) AGP_PAGE_SHIFT) * 4, (v)); - return; + bus_space_write_4(isc-gtt_bst, isc-gtt_bsh, wroff, pte); + return 0; } - - WRITE4(base_off + (u_int32_t)(off AGP_PAGE_SHIFT) * 4, v); + + WRITE4(base_off + wroff, pte); + return 0; } /* XXXthorpej -- duplicated code (see arch/x86/pci/pchb.c) */ @@ -829,8 +854,7 @@ } } - agp_i810_write_gtt_entry(isc, offset, physical | 1); - return 0; + return agp_i810_write_gtt_entry(isc, offset, physical | 1); } static int @@ -851,8 +875,7 @@ } } - agp_i810_write_gtt_entry(isc, offset, 0); - return 0; + return agp_i810_write_gtt_entry(isc, offset, 0); } /*
CVS commit: src/sys/dev/pci
Module Name:src Committed By: gsutre Date: Sun Jan 30 23:43:09 UTC 2011 Modified Files: src/sys/dev/pci: agp_i810.c Log Message: Enable 36-bit addressing for chipsets that support it. While there, factorize offset computation. Inspired from OpenBSD and Intel docs. Note: agp_i810_bind/unbind_page will now fail with EINVAL if the physical address is too large for the chipset (instead of silently truncating it). ok jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/agp_i810.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: gsutre Date: Tue Jan 25 10:52:11 UTC 2011 Modified Files: src/sys/dev/pci: agp_i810.c Log Message: Typos, fix memory binding for memory type 2, and add consistency checks. From OpenBSD. ok jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/agp_i810.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/agp_i810.c diff -u src/sys/dev/pci/agp_i810.c:1.69 src/sys/dev/pci/agp_i810.c:1.70 --- src/sys/dev/pci/agp_i810.c:1.69 Sat Nov 13 13:52:04 2010 +++ src/sys/dev/pci/agp_i810.c Tue Jan 25 10:52:11 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: agp_i810.c,v 1.69 2010/11/13 13:52:04 uebayasi Exp $ */ +/* $NetBSD: agp_i810.c,v 1.70 2011/01/25 10:52:11 gsutre Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.69 2010/11/13 13:52:04 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.70 2011/01/25 10:52:11 gsutre Exp $); #include sys/param.h #include sys/systm.h @@ -819,10 +819,10 @@ return EINVAL; } - if (isc-chiptype != CHIP_I830) { + if (isc-chiptype != CHIP_I810) { if ((offset AGP_PAGE_SHIFT) isc-stolen) { #ifdef AGP_DEBUG - printf(%s: trying to bind into stolen memory, + printf(%s: trying to bind into stolen memory\n, device_xname(sc-as_dev)); #endif return EINVAL; @@ -844,7 +844,7 @@ if (isc-chiptype != CHIP_I810 ) { if ((offset AGP_PAGE_SHIFT) isc-stolen) { #ifdef AGP_DEBUG - printf(%s: trying to unbind from stolen memory, + printf(%s: trying to unbind from stolen memory\n, device_xname(sc-as_dev)); #endif return EINVAL; @@ -968,6 +968,9 @@ struct agp_i810_softc *isc = sc-as_chipc; u_int32_t regval, i; + if (mem-am_is_bound != 0) + return EINVAL; + /* * XXX evil hack: the PGTBL_CTL appearently gets overwritten by the * X server for mysterious reasons which leads to crashes if we write @@ -983,7 +986,9 @@ } if (mem-am_type == 2) { - agp_i810_write_gtt_entry(isc, offset, mem-am_physical | 1); + for (i = 0; i mem-am_size; i += AGP_PAGE_SIZE) + agp_i810_bind_page(sc, offset + i, + mem-am_physical + i); mem-am_offset = offset; mem-am_is_bound = 1; return 0; @@ -996,7 +1001,7 @@ return EINVAL; for (i = 0; i mem-am_size; i += AGP_PAGE_SIZE) - agp_i810_write_gtt_entry(isc, offset, i | 3); + agp_i810_write_gtt_entry(isc, i, i | 3); mem-am_is_bound = 1; return 0; } @@ -1007,8 +1012,12 @@ struct agp_i810_softc *isc = sc-as_chipc; u_int32_t i; + if (mem-am_is_bound == 0) + return EINVAL; + if (mem-am_type == 2) { - agp_i810_write_gtt_entry(isc, mem-am_offset, 0); + for (i = 0; i mem-am_size; i += AGP_PAGE_SIZE) + agp_i810_unbind_page(sc, mem-am_offset + i); mem-am_offset = 0; mem-am_is_bound = 0; return 0;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: gsutre Date: Tue Jan 25 10:52:11 UTC 2011 Modified Files: src/sys/dev/pci: agp_i810.c Log Message: Typos, fix memory binding for memory type 2, and add consistency checks. From OpenBSD. ok jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/agp_i810.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/i386/i386
On 01/12/2011 05:09 AM, enami tsugutomo wrote: =?UTF-8?B?R3LDqWdvaXJlIFN1dHJl?=gsu...@netbsd.org writes: Assume for instance that the boot-loader left us with: +--+ ++ +--+ | string table | | kernel | | symbol table | +--+ ++ +--+ The new addresses computed by lines 338-359 (here, it's really lines 344-345) will move the tables so that they end up as: ++--+--+ | kernel | symbol table | string table | ++--+--+ If this ascii art is correct, memmove should be used instead of memcpy. Agreed. I should have mentioned it in the commit message. Here, I just wanted to restore previous (working) behavior. Note that the figure is just an example: afaik, no assumption can be made regarding the placement of the tables. Also, if initial order is kernel, string table, symbol table and a gap between kernel and string table is smaller than symbol table, copying it may overwrite the string table. Is there any guarantee that the gap is large enough? The code (that was already there) takes care of this by examining all possible cases. If initial order is kernel, string table, symbol table, then the order remains the same. Grégoire
CVS commit: src/sys/arch/i386/i386
Module Name:src Committed By: gsutre Date: Tue Jan 11 12:24:38 UTC 2011 Modified Files: src/sys/arch/i386/i386: multiboot.c Log Message: As said in the comment (lines 327-336), we must make sure that we don't overwrite valid data when moving the symbol and string tables. Assume for instance that the boot-loader left us with: +--+ ++ +--+ | string table | | kernel | | symbol table | +--+ ++ +--+ The new addresses computed by lines 338-359 (here, it's really lines 344-345) will move the tables so that they end up as: ++--+--+ | kernel | symbol table | string table | ++--+--+ The current version (rev. 1.20) will, however, first copy the string table and then the symbol table. But the copy of the string table will overwrite the symbol table (see the pictures). The old code (rev. 1.19) uses the right order of table copy to make sure that we don't overwrite one table when moving the other. Here, we simply restore this behavior. This makes multibooting from GRUB2 work again (for MONOLITHIC). ok jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/i386/multiboot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/i386/multiboot.c diff -u src/sys/arch/i386/i386/multiboot.c:1.20 src/sys/arch/i386/i386/multiboot.c:1.21 --- src/sys/arch/i386/i386/multiboot.c:1.20 Sat Jul 24 00:45:55 2010 +++ src/sys/arch/i386/i386/multiboot.c Tue Jan 11 12:24:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: multiboot.c,v 1.20 2010/07/24 00:45:55 jym Exp $ */ +/* $NetBSD: multiboot.c,v 1.21 2011/01/11 12:24:37 gsutre Exp $ */ /*- * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: multiboot.c,v 1.20 2010/07/24 00:45:55 jym Exp $); +__KERNEL_RCSID(0, $NetBSD: multiboot.c,v 1.21 2011/01/11 12:24:37 gsutre Exp $); #include opt_multiboot.h @@ -339,28 +339,35 @@ (void *)strtabp RELOC(void *, end)) { symstart = RELOC(Elf32_Addr, end); strstart = symstart + symsize; + memcpy((void *)symstart, (void *)symaddr, symsize); + memcpy((void *)strstart, (void *)straddr, strsize); } else if ((void *)symtabp RELOC(void *, end) (void *)strtabp RELOC(void *, end)) { symstart = RELOC(Elf32_Addr, end); strstart = symstart + symsize; + memcpy((void *)symstart, (void *)symaddr, symsize); + memcpy((void *)strstart, (void *)straddr, strsize); } else if ((void *)symtabp RELOC(void *, end) (void *)strtabp RELOC(void *, end)) { strstart = RELOC(Elf32_Addr, end); symstart = strstart + strsize; + memcpy((void *)strstart, (void *)straddr, strsize); + memcpy((void *)symstart, (void *)symaddr, symsize); } else { /* symtabp and strtabp are both over end */ if (symtabp strtabp) { symstart = RELOC(Elf32_Addr, end); strstart = symstart + symsize; + memcpy((void *)symstart, (void *)symaddr, symsize); + memcpy((void *)strstart, (void *)straddr, strsize); } else { strstart = RELOC(Elf32_Addr, end); symstart = strstart + strsize; + memcpy((void *)strstart, (void *)straddr, strsize); + memcpy((void *)symstart, (void *)symaddr, symsize); } } - memcpy((void *)strstart, (void *)straddr, strsize); - memcpy((void *)symstart, (void *)symaddr, symsize); - *RELOC(int *, esym) = (int)(symstart + symsize + strsize + KERNBASE);
CVS commit: src/share/man/man4
Module Name:src Committed By: gsutre Date: Sun Nov 7 14:56:51 UTC 2010 Modified Files: src/share/man/man4: acpi.4 Log Message: Note fujitsu(4). To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/share/man/man4/acpi.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/acpi.4 diff -u src/share/man/man4/acpi.4:1.61 src/share/man/man4/acpi.4:1.62 --- src/share/man/man4/acpi.4:1.61 Wed Oct 27 14:39:26 2010 +++ src/share/man/man4/acpi.4 Sun Nov 7 14:56:51 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: acpi.4,v 1.61 2010/10/27 14:39:26 gsutre Exp $ +.\ $NetBSD: acpi.4,v 1.62 2010/11/07 14:56:51 gsutre Exp $ .\ .\ Copyright (c) 2002, 2004, 2010 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -24,7 +24,7 @@ .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\ POSSIBILITY OF SUCH DAMAGE. .\ -.Dd October 24, 2010 +.Dd November 7, 2010 .Dt ACPI 4 .Os .Sh NAME @@ -241,6 +241,8 @@ NS8250-, NS16450-, and NS16550-based serial ports. .It Xr fdc 4 Floppy disk controllers. +.It Xr fujitsu 4 +Fujitsu brightness, pointer, and hotkeys. .It Xr hpet 4 High Precision Event Timer .Pq Tn HPET .
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Sun Nov 7 16:36:26 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_display.c Log Message: Replace ACPI_UINT64 by ACPICA's ACPI_INTEGER. Remove superfluous casts. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/acpi_display.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_display.c diff -u src/sys/dev/acpi/acpi_display.c:1.6 src/sys/dev/acpi/acpi_display.c:1.7 --- src/sys/dev/acpi/acpi_display.c:1.6 Thu Nov 4 20:08:12 2010 +++ src/sys/dev/acpi/acpi_display.c Sun Nov 7 16:36:26 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_display.c,v 1.6 2010/11/04 20:08:12 jruoho Exp $ */ +/* $NetBSD: acpi_display.c,v 1.7 2010/11/07 16:36:26 gsutre Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_display.c,v 1.6 2010/11/04 20:08:12 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_display.c,v 1.7 2010/11/07 16:36:26 gsutre Exp $); #include sys/param.h #include sys/device.h @@ -85,9 +85,6 @@ #define _COMPONENT ACPI_DISPLAY_COMPONENT ACPI_MODULE_NAME (acpi_display) -/* Type for integer values that are passed to/from ACPICA. */ -#define ACPI_UINT64 uint64_t - /* Notifications specific to display adapter devices (ACPI 4.0a, Sec. B.5). */ #define ACPI_NOTIFY_CycleOutputDevice 0x80 #define ACPI_NOTIFY_OutputDeviceStatusChange 0x81 @@ -1232,7 +1229,7 @@ int error; node = *rnode; - asc = (struct acpidisp_vga_softc *)node.sysctl_data; + asc = node.sysctl_data; mutex_enter(asc-sc_mtx); val = (uint32_t)asc-sc_policy.raw; @@ -1264,7 +1261,7 @@ int error; node = *rnode; - asc = (struct acpidisp_vga_softc *)node.sysctl_data; + asc = node.sysctl_data; mutex_enter(asc-sc_mtx); val = (asc-sc_policy.fmt.output == ACPI_DISP_POLICY_OUTPUT_AUTO); @@ -1296,7 +1293,7 @@ int error; node = *rnode; - osc = (struct acpidisp_out_softc *)node.sysctl_data; + osc = node.sysctl_data; mutex_enter(osc-sc_mtx); error = acpidisp_get_status(osc, val); @@ -1322,7 +1319,7 @@ int error; node = *rnode; - osc = (struct acpidisp_out_softc *)node.sysctl_data; + osc = node.sysctl_data; mutex_enter(osc-sc_mtx); error = acpidisp_get_state(osc, val); @@ -1354,7 +1351,7 @@ uint8_t lo, up, level; node = *rnode; - osc = (struct acpidisp_out_softc *)node.sysctl_data; + osc = node.sysctl_data; bc = osc-sc_brctl; KASSERT(bc != NULL); @@ -1509,7 +1506,7 @@ struct acpidisp_outdev *od; struct acpi_devnode *ad; ACPI_HANDLE hdl; - ACPI_UINT64 val; + ACPI_INTEGER val; ACPI_STATUS rv; uint16_t devid; uint32_t i; @@ -1705,7 +1702,7 @@ acpidisp_set_policy(const struct acpidisp_vga_softc *asc, uint8_t value) { ACPI_HANDLE hdl = asc-sc_node-ad_handle; - ACPI_UINT64 val; + ACPI_INTEGER val; ACPI_STATUS rv; ACPI_DEBUG_PRINT((ACPI_DB_INFO, %s: set %s: 0x%PRIx8\n, @@ -1714,7 +1711,7 @@ if (!(asc-sc_caps ACPI_DISP_VGA_CAP__DOS)) return ENODEV; - val = (ACPI_UINT64)value; + val = (ACPI_INTEGER)value; rv = acpi_eval_set_integer(hdl, _DOS, val); if (ACPI_FAILURE(rv)) { aprint_error_dev(asc-sc_dev, failed to evaluate %s.%s: %s\n, @@ -1729,7 +1726,7 @@ acpidisp_get_status(const struct acpidisp_out_softc *osc, uint32_t *valuep) { ACPI_HANDLE hdl = osc-sc_node-ad_handle; - ACPI_UINT64 val; + ACPI_INTEGER val; ACPI_STATUS rv; if (!(osc-sc_caps ACPI_DISP_OUT_CAP__DCS)) @@ -1757,7 +1754,7 @@ acpidisp_get_state(const struct acpidisp_out_softc *osc, uint32_t *valuep) { ACPI_HANDLE hdl = osc-sc_node-ad_handle; - ACPI_UINT64 val; + ACPI_INTEGER val; ACPI_STATUS rv; if (!(osc-sc_caps ACPI_DISP_OUT_CAP__DGS)) @@ -1785,7 +1782,7 @@ acpidisp_set_state(const struct acpidisp_out_softc *osc, uint32_t value) { ACPI_HANDLE hdl = osc-sc_node-ad_handle; - ACPI_UINT64 val; + ACPI_INTEGER val; ACPI_STATUS rv; ACPI_DEBUG_PRINT((ACPI_DB_INFO, %s: set %s: 0x%PRIx32\n, @@ -1794,7 +1791,7 @@ if (!(osc-sc_caps ACPI_DISP_OUT_CAP__DSS)) return ENODEV; - val = (ACPI_UINT64)value; + val = (ACPI_INTEGER)value; rv = acpi_eval_set_integer(hdl, _DSS, val); if (ACPI_FAILURE(rv)) { aprint_error_dev(osc-sc_dev, failed to evaluate %s.%s: %s\n, @@ -1809,7 +1806,7 @@ acpidisp_get_brightness(const struct acpidisp_out_softc *osc, uint8_t *valuep) { ACPI_HANDLE hdl = osc-sc_node-ad_handle; - ACPI_UINT64 val; + ACPI_INTEGER val; ACPI_STATUS rv; if (!(osc-sc_caps ACPI_DISP_OUT_CAP__BQC)) @@ -1837,7 +1834,7 @@ acpidisp_set_brightness(const struct acpidisp_out_softc *osc, uint8_t value) { ACPI_HANDLE hdl = osc-sc_node-ad_handle; - ACPI_UINT64 val; + ACPI_INTEGER val; ACPI_STATUS rv; ACPI_DEBUG_PRINT((ACPI_DB_INFO, %s: set %s: %PRIu8\n, @@ -1846,7 +1843,7 @@ if (!(osc-sc_caps ACPI_DISP_OUT_CAP__BCM)) return ENODEV; - val =
CVS commit: src/share/man/man4
Module Name:src Committed By: gsutre Date: Sun Nov 7 14:56:51 UTC 2010 Modified Files: src/share/man/man4: acpi.4 Log Message: Note fujitsu(4). To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/share/man/man4/acpi.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Sun Nov 7 16:36:26 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_display.c Log Message: Replace ACPI_UINT64 by ACPICA's ACPI_INTEGER. Remove superfluous casts. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/acpi_display.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: gsutre Date: Fri Nov 5 10:28:22 UTC 2010 Modified Files: src/distrib/sets/lists/man: mi src/share/man/man4: Makefile src/sys/arch/amd64/conf: GENERIC src/sys/arch/i386/conf: ALL GENERIC src/sys/dev/acpi: files.acpi Added Files: src/share/man/man4: fujitsu.4 src/sys/dev/acpi: fujitsu_acpi.c Log Message: Merge ACPI Fujitsu Driver. Provides support for hotkeys and other built-in components through vendor-specific ACPI devices. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.1246 -r1.1247 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.530 -r1.531 src/share/man/man4/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man4/fujitsu.4 cvs rdiff -u -r1.288 -r1.289 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.273 -r1.274 src/sys/arch/i386/conf/ALL cvs rdiff -u -r1.996 -r1.997 src/sys/arch/i386/conf/GENERIC cvs rdiff -u -r1.81 -r1.82 src/sys/dev/acpi/files.acpi cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/fujitsu_acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1246 src/distrib/sets/lists/man/mi:1.1247 --- src/distrib/sets/lists/man/mi:1.1246 Wed Nov 3 18:57:33 2010 +++ src/distrib/sets/lists/man/mi Fri Nov 5 10:28:22 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1246 2010/11/03 18:57:33 christos Exp $ +# $NetBSD: mi,v 1.1247 2010/11/05 10:28:22 gsutre Exp $ # # Note: don't delete entries from here - mark them as obsolete instead. # @@ -950,6 +950,9 @@ ./usr/share/man/cat4/fss.0 man-sys-catman .cat ./usr/share/man/cat4/fssbs.0 man-obsolete obsolete ./usr/share/man/cat4/fta.0 man-sys-catman .cat +./usr/share/man/cat4/fujbp.0 man-sys-catman .cat +./usr/share/man/cat4/fujhk.0 man-sys-catman .cat +./usr/share/man/cat4/fujitsu.0 man-sys-catman .cat ./usr/share/man/cat4/fwhrng.0 man-obsolete obsolete ./usr/share/man/cat4/fwip.0 man-sys-catman .cat ./usr/share/man/cat4/fwiso.0 man-obsolete obsolete @@ -3642,6 +3645,9 @@ ./usr/share/man/html4/fss.html man-sys-htmlman html ./usr/share/man/html4/fssbs.html man-obsolete obsolete ./usr/share/man/html4/fta.html man-sys-htmlman html +./usr/share/man/html4/fujbp.html man-sys-htmlman html +./usr/share/man/html4/fujhk.html man-sys-htmlman html +./usr/share/man/html4/fujitsu.html man-sys-htmlman html ./usr/share/man/html4/fwhrng.html man-obsolete obsolete ./usr/share/man/html4/fwip.html man-sys-htmlman html ./usr/share/man/html4/fwohci.html man-sys-htmlman html @@ -6112,6 +6118,9 @@ ./usr/share/man/man4/fss.4 man-sys-man .man ./usr/share/man/man4/fssbs.4 man-obsolete obsolete ./usr/share/man/man4/fta.4 man-sys-man .man +./usr/share/man/man4/fujbp.4 man-sys-man .man +./usr/share/man/man4/fujhk.4 man-sys-man .man +./usr/share/man/man4/fujitsu.4 man-sys-man .man ./usr/share/man/man4/fwhrng.4 man-obsolete obsolete ./usr/share/man/man4/fwip.4 man-sys-man .man ./usr/share/man/man4/fwiso.4 man-obsolete obsolete Index: src/share/man/man4/Makefile diff -u src/share/man/man4/Makefile:1.530 src/share/man/man4/Makefile:1.531 --- src/share/man/man4/Makefile:1.530 Wed Nov 3 18:57:57 2010 +++ src/share/man/man4/Makefile Fri Nov 5 10:28:22 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.530 2010/11/03 18:57:57 christos Exp $ +# $NetBSD: Makefile,v 1.531 2010/11/05 10:28:22 gsutre Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \ @@ -24,7 +24,7 @@ dmphy.4 dpt.4 dpti.4 drm.4 drum.4 \ eap.4 ebus.4 edc.4 elmc.4 emuxki.4 en.4 envsys.4 ep.4 esh.4 esis.4 \ esa.4 esiop.4 esm.4 eso.4 etherip.4 exphy.4 \ - fast_ipsec.4 fd.4 finsio.4 fpa.4 fms.4 fss.4 fxp.4 \ + fast_ipsec.4 fd.4 finsio.4 fpa.4 fms.4 fss.4 fujitsu.4 fxp.4 \ gcscaudio.4 gem.4 genfb.4 gentbi.4 geodeide.4 \ glxtphy.4 gpib.4 gpio.4 gpiolock.4 gpiosim.4 gre.4 gphyter.4 gsip.4 \ hdaudio.4 hifn.4 hme.4 hpqlb.4 hptide.4 \ @@ -174,6 +174,7 @@ MLINKS+=dbcool.4 adt7476.4 MLINKS+=fd.4 stderr.4 fd.4 stdin.4 fd.4 stdout.4 MLINKS+=fpa.4 fea.4 fpa.4 fta.4 +MLINKS+=fujitsu.4 fujbp.4 fujitsu.4 fujhk.4 MLINKS+=hdaudio.4 hdafg.4 MLINKS+=hdaudio.4 hdaudiobus.4 MLINKS+=icp.4 icpsp.4 Index: src/sys/arch/amd64/conf/GENERIC diff -u src/sys/arch/amd64/conf/GENERIC:1.288 src/sys/arch/amd64/conf/GENERIC:1.289 --- src/sys/arch/amd64/conf/GENERIC:1.288 Wed Nov 3 20:09:09 2010 +++ src/sys/arch/amd64/conf/GENERIC Fri Nov 5 10:28:21 2010 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.288 2010/11/03 20:09:09 christos Exp $ +# $NetBSD: GENERIC,v 1.289 2010/11/05 10:28:21 gsutre Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident GENERIC-$Revision: 1.288 $ +#ident GENERIC-$Revision: 1.289 $ maxusers 64 # estimated number of users @@ -294,6 +294,8 @@
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Fri Nov 5 10:35:01 UTC 2010 Modified Files: src/sys/dev/acpi: fujitsu_acpi.c Log Message: Hm, the warning sign was not big enough. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/fujitsu_acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/fujitsu_acpi.c diff -u src/sys/dev/acpi/fujitsu_acpi.c:1.1 src/sys/dev/acpi/fujitsu_acpi.c:1.2 --- src/sys/dev/acpi/fujitsu_acpi.c:1.1 Fri Nov 5 10:28:21 2010 +++ src/sys/dev/acpi/fujitsu_acpi.c Fri Nov 5 10:35:00 2010 @@ -1,5 +1,4 @@ -/* XXX REMOVE ME $Id: fujitsu_acpi.c,v 1.1 2010/11/05 10:28:21 gsutre Exp $ */ -/* $NetBSD: fujitsu_acpi.c,v 1.1 2010/11/05 10:28:21 gsutre Exp $ */ +/* $NetBSD: fujitsu_acpi.c,v 1.2 2010/11/05 10:35:00 gsutre Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -78,7 +77,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: fujitsu_acpi.c,v 1.1 2010/11/05 10:28:21 gsutre Exp $); +__KERNEL_RCSID(0, $NetBSD: fujitsu_acpi.c,v 1.2 2010/11/05 10:35:00 gsutre Exp $); #include sys/param.h #include sys/device.h
CVS commit: src/doc
Module Name:src Committed By: gsutre Date: Fri Nov 5 11:23:54 UTC 2010 Modified Files: src/doc: CHANGES Log Message: Mention fujitsu(4). To generate a diff of this commit: cvs rdiff -u -r1.1449 -r1.1450 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.1449 src/doc/CHANGES:1.1450 --- src/doc/CHANGES:1.1449 Wed Nov 3 22:40:51 2010 +++ src/doc/CHANGES Fri Nov 5 11:23:54 2010 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1449 $ +# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1450 $ # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -768,3 +768,5 @@ xz(1): Import of XZ 5.0.0. [joerg 20101102] if_otus(4): Port the Atheros AR9001U from OpenBSD (Anon Ymous) [christos 20101103] + fujitsu(4): Add brightness and hotkey drivers for Fujitsu laptops. + [gsutre 20101105]
CVS commit: src/share/man/man4
Module Name:src Committed By: gsutre Date: Fri Nov 5 14:43:57 UTC 2010 Modified Files: src/share/man/man4: fujitsu.4 Log Message: Remove .Pp before .Bl and bump date. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/fujitsu.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/fujitsu.4 diff -u src/share/man/man4/fujitsu.4:1.3 src/share/man/man4/fujitsu.4:1.4 --- src/share/man/man4/fujitsu.4:1.3 Fri Nov 5 11:14:53 2010 +++ src/share/man/man4/fujitsu.4 Fri Nov 5 14:43:56 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: fujitsu.4,v 1.3 2010/11/05 11:14:53 jruoho Exp $ +.\ $NetBSD: fujitsu.4,v 1.4 2010/11/05 14:43:56 gsutre Exp $ .\ .\ Copyright (c) 2010 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -24,7 +24,7 @@ .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\ POSSIBILITY OF SUCH DAMAGE. .\ -.Dd November 3, 2010 +.Dd November 5, 2010 .Dt FUJITSU 4 .Os .Sh NAME @@ -50,7 +50,6 @@ The following .Xr sysctl 8 read/write variables are provided (when hardware support is available): -.Pp .Bl -tag -width hw.acpi.fujbp0.brightness -offset indent .It Va hw.acpi.fujbp0.brightness Brightness level (integer).
CVS commit: src
Module Name:src Committed By: gsutre Date: Fri Nov 5 10:28:22 UTC 2010 Modified Files: src/distrib/sets/lists/man: mi src/share/man/man4: Makefile src/sys/arch/amd64/conf: GENERIC src/sys/arch/i386/conf: ALL GENERIC src/sys/dev/acpi: files.acpi Added Files: src/share/man/man4: fujitsu.4 src/sys/dev/acpi: fujitsu_acpi.c Log Message: Merge ACPI Fujitsu Driver. Provides support for hotkeys and other built-in components through vendor-specific ACPI devices. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.1246 -r1.1247 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.530 -r1.531 src/share/man/man4/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man4/fujitsu.4 cvs rdiff -u -r1.288 -r1.289 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.273 -r1.274 src/sys/arch/i386/conf/ALL cvs rdiff -u -r1.996 -r1.997 src/sys/arch/i386/conf/GENERIC cvs rdiff -u -r1.81 -r1.82 src/sys/dev/acpi/files.acpi cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/fujitsu_acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Fri Nov 5 10:35:01 UTC 2010 Modified Files: src/sys/dev/acpi: fujitsu_acpi.c Log Message: Hm, the warning sign was not big enough. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/fujitsu_acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man4
Module Name:src Committed By: gsutre Date: Fri Nov 5 14:43:57 UTC 2010 Modified Files: src/share/man/man4: fujitsu.4 Log Message: Remove .Pp before .Bl and bump date. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/fujitsu.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Tue Nov 2 16:45:48 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_util.c Log Message: acpi_eval_integer: check that the evaluation produced a result. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpi_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_util.c diff -u src/sys/dev/acpi/acpi_util.c:1.5 src/sys/dev/acpi/acpi_util.c:1.6 --- src/sys/dev/acpi/acpi_util.c:1.5 Mon Jun 7 17:13:52 2010 +++ src/sys/dev/acpi/acpi_util.c Tue Nov 2 16:45:48 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_util.c,v 1.5 2010/06/07 17:13:52 jruoho Exp $ */ +/* $NetBSD: acpi_util.c,v 1.6 2010/11/02 16:45:48 gsutre Exp $ */ /*- * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_util.c,v 1.5 2010/06/07 17:13:52 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_util.c,v 1.6 2010/11/02 16:45:48 gsutre Exp $); #include sys/param.h @@ -90,6 +90,7 @@ if (handle == NULL) handle = ACPI_ROOT_OBJECT; + (void)memset(obj, 0, sizeof(obj)); buf.Pointer = obj; buf.Length = sizeof(obj); @@ -98,6 +99,10 @@ if (ACPI_FAILURE(rv)) return rv; + /* Check that evaluation produced a return value. */ + if (buf.Length == 0) + return AE_NULL_OBJECT; + if (obj.Type != ACPI_TYPE_INTEGER) return AE_TYPE;
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Tue Nov 2 16:45:48 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_util.c Log Message: acpi_eval_integer: check that the evaluation produced a result. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpi_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Fri Oct 29 09:04:39 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_display.c Log Message: Lock the _DGS values (desired output state) during the display output switch. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpi_display.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: gsutre Date: Thu Oct 28 21:45:02 UTC 2010 Modified Files: src/share/man/man4: acpivga.4 src/sys/dev/acpi: acpi_display.c Log Message: Simplify the sysctl variable for BIOS switch policy, and document it in acpivga(4). The previous hw.acpi.acpivga0.policy variable is renamed into bios_policy for consistency, and is for ACPI_DEBUG only. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/acpivga.4 cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_display.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/acpivga.4 diff -u src/share/man/man4/acpivga.4:1.2 src/share/man/man4/acpivga.4:1.3 --- src/share/man/man4/acpivga.4:1.2 Thu Oct 28 14:36:04 2010 +++ src/share/man/man4/acpivga.4 Thu Oct 28 21:45:02 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: acpivga.4,v 1.2 2010/10/28 14:36:04 jruoho Exp $ +.\ $NetBSD: acpivga.4,v 1.3 2010/10/28 21:45:02 gsutre Exp $ .\ .\ Copyright (c) 2010 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -47,22 +47,29 @@ .Tn ACPI BIOS. .Pp -The driver handles brightness hotkeys and output switch hotkeys. +The driver handles brightness hotkeys and display switch hotkeys. In addition, the following .Xr sysctl 8 read/write variables are provided (when hardware support is available): .Bl -tag -width Ds -.It Va hw.acpi.acpivga0.policy -BIOS switch policy. -Accepted values range from 0 to 7. -For more information, refer to the documentation of the _DOS method, -in Section B.4.1 of the -.Tn ACPI -specification (revision 4.0a). +.It Va hw.acpi.acpivga0.bios_switch +BIOS output switching policy. +This boolean variable controls the behavior of the BIOS when a display +switch hotkey is pressed. +.Bl -tag -width xxx -compact +.It Sy 1 +the BIOS should automatically switch outputs, with no interaction from +.Nm . +.It Sy 0 +the BIOS should only notify +.Nm +of the desired output state changes. +.El .It Va hw.acpi.acpiout0.brightness Brightness level. -Typical values range from 0 to 100, but any integer value is accepted (the -driver uses the closest brightness level supported by the device). +This integer variable typically ranges from 0 to 100, but any integer value +is accepted (the driver uses the closest brightness level supported by the +device). .El .Pp Please note, however, that future versions of @@ -99,7 +106,17 @@ BIOSes implement only part of the .Tn ACPI video extensions. -In particular, display output switching often does not work. +In particular, display output switching via these extensions often does not +work. +For this reason, +.Nm +enables +.Va hw.acpi.acpivga0.bios_switch +by default. +If the display switch hotkey does not work with this default setting, try +setting +.Va hw.acpi.acpivga0.bios_switch +to 0. .Pp Brightness level should be controlled via .Xr wsconsctl 8 Index: src/sys/dev/acpi/acpi_display.c diff -u src/sys/dev/acpi/acpi_display.c:1.3 src/sys/dev/acpi/acpi_display.c:1.4 --- src/sys/dev/acpi/acpi_display.c:1.3 Tue Oct 26 22:27:44 2010 +++ src/sys/dev/acpi/acpi_display.c Thu Oct 28 21:45:02 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_display.c,v 1.3 2010/10/26 22:27:44 gsutre Exp $ */ +/* $NetBSD: acpi_display.c,v 1.4 2010/10/28 21:45:02 gsutre Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_display.c,v 1.3 2010/10/26 22:27:44 gsutre Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_display.c,v 1.4 2010/10/28 21:45:02 gsutre Exp $); #include sys/param.h #include sys/device.h @@ -347,7 +347,10 @@ static void acpidisp_vga_sysctl_setup(struct acpidisp_vga_softc *); static void acpidisp_out_sysctl_setup(struct acpidisp_out_softc *); +#ifdef ACPI_DEBUG static int acpidisp_vga_sysctl_policy(SYSCTLFN_PROTO); +#endif +static int acpidisp_vga_sysctl_policy_output(SYSCTLFN_PROTO); #ifdef ACPI_DISP_SWITCH_SYSCTLS static int acpidisp_out_sysctl_status(SYSCTLFN_PROTO); static int acpidisp_out_sysctl_state(SYSCTLFN_PROTO); @@ -1114,11 +1117,19 @@ CTL_CREATE, CTL_EOL)) != 0) goto fail; +#ifdef ACPI_DEBUG (void)sysctl_createv(asc-sc_log, 0, rnode, NULL, - CTLFLAG_READWRITE | CTLFLAG_HEX, CTLTYPE_INT, policy, - SYSCTL_DESCR(Current BIOS switch policy), + CTLFLAG_READWRITE | CTLFLAG_HEX, CTLTYPE_INT, bios_policy, + SYSCTL_DESCR(Current BIOS switch policies (debug)), acpidisp_vga_sysctl_policy, 0, asc, 0, CTL_CREATE, CTL_EOL); +#endif + + (void)sysctl_createv(asc-sc_log, 0, rnode, NULL, + CTLFLAG_READWRITE, CTLTYPE_BOOL, bios_switch, + SYSCTL_DESCR(Current BIOS output switching policy), + acpidisp_vga_sysctl_policy_output, 0, asc, 0, + CTL_CREATE, CTL_EOL); } return; @@ -1202,6 +1213,7 @@ * Sysctl callbacks. */ +#ifdef ACPI_DEBUG static int acpidisp_vga_sysctl_policy(SYSCTLFN_ARGS) {
CVS commit: src
Module Name:src Committed By: gsutre Date: Thu Oct 28 21:45:02 UTC 2010 Modified Files: src/share/man/man4: acpivga.4 src/sys/dev/acpi: acpi_display.c Log Message: Simplify the sysctl variable for BIOS switch policy, and document it in acpivga(4). The previous hw.acpi.acpivga0.policy variable is renamed into bios_policy for consistency, and is for ACPI_DEBUG only. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/acpivga.4 cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_display.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: gsutre Date: Wed Oct 27 14:39:27 UTC 2010 Modified Files: src/share/man/man4: acpi.4 src/sys/dev/acpi: acpi_debug.c Log Message: Make acpi(4) debug aware of ACPI_DISPLAY_COMPONENT. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/share/man/man4/acpi.4 cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_debug.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/acpi.4 diff -u src/share/man/man4/acpi.4:1.60 src/share/man/man4/acpi.4:1.61 --- src/share/man/man4/acpi.4:1.60 Sun Oct 24 08:31:49 2010 +++ src/share/man/man4/acpi.4 Wed Oct 27 14:39:26 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: acpi.4,v 1.60 2010/10/24 08:31:49 jruoho Exp $ +.\ $NetBSD: acpi.4,v 1.61 2010/10/27 14:39:26 gsutre Exp $ .\ .\ Copyright (c) 2002, 2004, 2010 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -445,6 +445,7 @@ .It Li ACPI_LID_COMPONENT Ta ACPI_LV_OPTIMIZATIONS .It Li ACPI_RESOURCE_COMPONENT Ta ACPI_LV_VERBOSITY2 * .It Li ACPI_TZ_COMPONENT Ta +.It Li ACPI_DISPLAY_COMPONENT Ta .It Li ACPI_ALL_DRIVERS * Ta ACPI_LV_MUTEX .It Ta ACPI_LV_THREADS .It Ta ACPI_LV_IO Index: src/sys/dev/acpi/acpi_debug.c diff -u src/sys/dev/acpi/acpi_debug.c:1.3 src/sys/dev/acpi/acpi_debug.c:1.4 --- src/sys/dev/acpi/acpi_debug.c:1.3 Wed Jun 30 07:42:36 2010 +++ src/sys/dev/acpi/acpi_debug.c Wed Oct 27 14:39:26 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_debug.c,v 1.3 2010/06/30 07:42:36 jruoho Exp $ */ +/* $NetBSD: acpi_debug.c,v 1.4 2010/10/27 14:39:26 gsutre Exp $ */ /*- * Copyright (c) 2010 Jukka Ruohonen jruoho...@iki.fi @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_debug.c,v 1.3 2010/06/30 07:42:36 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_debug.c,v 1.4 2010/10/27 14:39:26 gsutre Exp $); #include sys/param.h #include sys/sysctl.h @@ -183,6 +183,7 @@ ACPI_DEBUG_ADD(acpi_debug_layer_d, ACPI_LID_COMPONENT); ACPI_DEBUG_ADD(acpi_debug_layer_d, ACPI_RESOURCE_COMPONENT); ACPI_DEBUG_ADD(acpi_debug_layer_d, ACPI_TZ_COMPONENT); + ACPI_DEBUG_ADD(acpi_debug_layer_d, ACPI_DISPLAY_COMPONENT); ACPI_DEBUG_ADD(acpi_debug_layer_d, ACPI_ALL_DRIVERS); /*
CVS commit: src
Module Name:src Committed By: gsutre Date: Wed Oct 27 14:39:27 UTC 2010 Modified Files: src/share/man/man4: acpi.4 src/sys/dev/acpi: acpi_debug.c Log Message: Make acpi(4) debug aware of ACPI_DISPLAY_COMPONENT. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/share/man/man4/acpi.4 cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_debug.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Tue Oct 26 22:27:44 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_display.c acpi_pci.c acpi_verbose.c acpivar.h Log Message: An _ADR object is not required for PCI root bridges. To solve this, the structure acpi_pciinfo now tells whether the ACPI device node is a PCI bridge, a regular PCI device, or both. Problem reported by jmcneill@, who also suggested the solution. ok jmcneill@, jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/acpi_display.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/acpi/acpi_pci.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/acpi/acpi_verbose.c cvs rdiff -u -r1.64 -r1.65 src/sys/dev/acpi/acpivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_display.c diff -u src/sys/dev/acpi/acpi_display.c:1.2 src/sys/dev/acpi/acpi_display.c:1.3 --- src/sys/dev/acpi/acpi_display.c:1.2 Mon Oct 25 17:06:58 2010 +++ src/sys/dev/acpi/acpi_display.c Tue Oct 26 22:27:44 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_display.c,v 1.2 2010/10/25 17:06:58 jruoho Exp $ */ +/* $NetBSD: acpi_display.c,v 1.3 2010/10/26 22:27:44 gsutre Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_display.c,v 1.2 2010/10/25 17:06:58 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_display.c,v 1.3 2010/10/26 22:27:44 gsutre Exp $); #include sys/param.h #include sys/device.h @@ -406,7 +406,9 @@ return 0; ap = ad-ad_pciinfo; - if ((ap == NULL) || (ap-ap_function == 0x)) + if ((ap == NULL) || + !(ap-ap_flags ACPI_PCI_INFO_DEVICE) || + (ap-ap_function == 0x)) return 0; KASSERT(ap-ap_bus 256 ap-ap_device 32 ap-ap_function 8); Index: src/sys/dev/acpi/acpi_pci.c diff -u src/sys/dev/acpi/acpi_pci.c:1.15 src/sys/dev/acpi/acpi_pci.c:1.16 --- src/sys/dev/acpi/acpi_pci.c:1.15 Fri Sep 24 07:48:59 2010 +++ src/sys/dev/acpi/acpi_pci.c Tue Oct 26 22:27:44 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_pci.c,v 1.15 2010/09/24 07:48:59 gsutre Exp $ */ +/* $NetBSD: acpi_pci.c,v 1.16 2010/10/26 22:27:44 gsutre Exp $ */ /* * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_pci.c,v 1.15 2010/09/24 07:48:59 gsutre Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_pci.c,v 1.16 2010/10/26 22:27:44 gsutre Exp $); #include sys/param.h #include sys/device.h @@ -158,6 +158,10 @@ * PCI device if it has an ancestor that is a PCI root bridge and such * that all intermediate nodes are PCI-to-PCI bridges. Depth-first * recursive implementation. + * + * PCI root bridges do not necessarily contain an _ADR, since they already + * contain an _HID (ACPI 4.0a, p. 197). However we require an _ADR for + * all non-root PCI devices. */ ACPI_STATUS acpi_pcidev_scan(struct acpi_devnode *ad) @@ -169,16 +173,14 @@ ad-ad_pciinfo = NULL; - if (ad-ad_devinfo-Type != ACPI_TYPE_DEVICE || - !(ad-ad_devinfo-Valid ACPI_VALID_ADR)) - goto rec; - /* * We attach PCI information only to devices that are present, * enabled, and functioning properly. * Note: there is a possible race condition, because _STA may * have changed since ad-ad_devinfo-CurrentStatus was set. */ + if (ad-ad_devinfo-Type != ACPI_TYPE_DEVICE) + goto rec; if ((ad-ad_devinfo-Valid ACPI_VALID_STA) != 0 (ad-ad_devinfo-CurrentStatus ACPI_STA_OK) != ACPI_STA_OK) goto rec; @@ -201,29 +203,43 @@ if (ACPI_SUCCESS(rv)) ap-ap_segment = ACPI_LOWORD(val); - /* Try to get bus number using _CRS first. */ - rv = acpi_pcidev_pciroot_bus(ad-ad_handle, ap-ap_bus); + /* Try to get downstream bus number using _CRS first. */ + rv = acpi_pcidev_pciroot_bus(ad-ad_handle, ap-ap_downbus); if (ACPI_FAILURE(rv)) { rv = acpi_eval_integer(ad-ad_handle, _BBN, val); if (ACPI_SUCCESS(rv)) -ap-ap_bus = ACPI_LOWORD(val); +ap-ap_downbus = ACPI_LOWORD(val); } - ap-ap_device = ACPI_HILODWORD(ad-ad_devinfo-Address); - ap-ap_function = ACPI_LOLODWORD(ad-ad_devinfo-Address); - - if (ap-ap_bus 255 || ap-ap_device 31 || - (ap-ap_function 7 ap-ap_function != 0x)) { + if (ap-ap_downbus 255) { aprint_error_dev(ad-ad_root, - invalid PCI address for %s\n, ad-ad_name); + invalid PCI downstream bus for %s\n, ad-ad_name); kmem_free(ap, sizeof(*ap)); goto rec; } - ap-ap_bridge = true; - ap-ap_downbus = ap-ap_bus; + ap-ap_flags |= ACPI_PCI_INFO_BRIDGE; + + /* + * This ACPI node denotes a PCI root bridge, but it may also + * denote a PCI device on the bridge's downstream bus segment. + */ + if (ad-ad_devinfo-Valid ACPI_VALID_ADR) { + ap-ap_bus = ap-ap_downbus; + ap-ap_device = + ACPI_HILODWORD(ad-ad_devinfo-Address); + ap-ap_function = + ACPI_LOLODWORD(ad-ad_devinfo-Address); + + if
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Tue Oct 26 22:27:44 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_display.c acpi_pci.c acpi_verbose.c acpivar.h Log Message: An _ADR object is not required for PCI root bridges. To solve this, the structure acpi_pciinfo now tells whether the ACPI device node is a PCI bridge, a regular PCI device, or both. Problem reported by jmcneill@, who also suggested the solution. ok jmcneill@, jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/acpi_display.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/acpi/acpi_pci.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/acpi/acpi_verbose.c cvs rdiff -u -r1.64 -r1.65 src/sys/dev/acpi/acpivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: gsutre Date: Tue Oct 12 23:01:55 UTC 2010 Modified Files: src/distrib/sets/lists/man: mi src/share/man/man4: Makefile Added Files: src/share/man/man4: acpivga.4 Log Message: Add acpivga(4). To generate a diff of this commit: cvs rdiff -u -r1.1239 -r1.1240 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.526 -r1.527 src/share/man/man4/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man4/acpivga.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1239 src/distrib/sets/lists/man/mi:1.1240 --- src/distrib/sets/lists/man/mi:1.1239 Sat Oct 2 06:26:28 2010 +++ src/distrib/sets/lists/man/mi Tue Oct 12 23:01:55 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1239 2010/10/02 06:26:28 kiyohara Exp $ +# $NetBSD: mi,v 1.1240 2010/10/12 23:01:55 gsutre Exp $ # # Note: don't delete entries from here - mark them as obsolete instead. # @@ -628,8 +628,10 @@ ./usr/share/man/cat4/acpiec.0 man-sys-catman .cat ./usr/share/man/cat4/acpiecdt.0 man-sys-catman .cat ./usr/share/man/cat4/acpilid.0 man-sys-catman .cat +./usr/share/man/cat4/acpiout.0 man-sys-catman .cat ./usr/share/man/cat4/acpismbus.0 man-sys-catman .cat ./usr/share/man/cat4/acpitz.0 man-sys-catman .cat +./usr/share/man/cat4/acpivga.0 man-sys-catman .cat ./usr/share/man/cat4/acpiwmi.0 man-sys-catman .cat ./usr/share/man/cat4/adb.0 man-sys-catman .cat ./usr/share/man/cat4/adbbt.0 man-sys-catman .cat @@ -3351,8 +3353,10 @@ ./usr/share/man/html4/acpiec.html man-sys-htmlman html ./usr/share/man/html4/acpiecdt.html man-sys-htmlman html ./usr/share/man/html4/acpilid.html man-sys-htmlman html +./usr/share/man/html4/acpiout.html man-sys-htmlman html ./usr/share/man/html4/acpismbus.html man-sys-htmlman html ./usr/share/man/html4/acpitz.html man-sys-htmlman html +./usr/share/man/html4/acpivga.html man-sys-htmlman html ./usr/share/man/html4/acpiwmi.html man-sys-htmlman html ./usr/share/man/html4/adb.html man-sys-htmlman html ./usr/share/man/html4/adbbt.html man-sys-htmlman html @@ -5774,8 +5778,10 @@ ./usr/share/man/man4/acpiec.4 man-sys-man .man ./usr/share/man/man4/acpiecdt.4 man-sys-man .man ./usr/share/man/man4/acpilid.4 man-sys-man .man +./usr/share/man/man4/acpiout.4 man-sys-man .man ./usr/share/man/man4/acpismbus.4 man-sys-man .man ./usr/share/man/man4/acpitz.4 man-sys-man .man +./usr/share/man/man4/acpivga.4 man-sys-man .man ./usr/share/man/man4/acpiwmi.4 man-sys-man .man ./usr/share/man/man4/adb.4 man-sys-man .man ./usr/share/man/man4/adbbt.4 man-sys-man .man Index: src/share/man/man4/Makefile diff -u src/share/man/man4/Makefile:1.526 src/share/man/man4/Makefile:1.527 --- src/share/man/man4/Makefile:1.526 Sat Oct 2 06:22:00 2010 +++ src/share/man/man4/Makefile Tue Oct 12 23:01:55 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.526 2010/10/02 06:22:00 kiyohara Exp $ +# $NetBSD: Makefile,v 1.527 2010/10/12 23:01:55 gsutre Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \ @@ -83,7 +83,7 @@ # ACPI devices MAN+= acpi.4 acpiacad.4 acpibat.4 acpibut.4 acpicpu.4 \ acpidalb.4 acpiec.4 acpilid.4 \ - acpismbus.4 acpitz.4 acpiwmi.4 + acpismbus.4 acpitz.4 acpivga.4 acpiwmi.4 # Radio devices MAN+= radio.4 az.4 mr.4 rt.4 rtii.4 sf2r.4 @@ -147,6 +147,7 @@ MLINKS+=drm.4 viadrm.4 MLINKS+=acpiec.4 acpiecdt.4 +MLINKS+=acpivga.4 acpiout.4 MLINKS+=acpiwmi.4 wmidell.4 acpiwmi.4 wmihp.4 MLINKS+=aibs.4 aiboost.4 MLINKS+=ata.4 atabus.4 Added files: Index: src/share/man/man4/acpivga.4 diff -u /dev/null src/share/man/man4/acpivga.4:1.1 --- /dev/null Tue Oct 12 23:01:55 2010 +++ src/share/man/man4/acpivga.4 Tue Oct 12 23:01:55 2010 @@ -0,0 +1,119 @@ +.\ $NetBSD: acpivga.4,v 1.1 2010/10/12 23:01:55 gsutre Exp $ +.\ +.\ Copyright (c) 2010 The NetBSD Foundation, Inc. +.\ All rights reserved. +.\ +.\ Redistribution and use in source and binary forms, with or without +.\ modification, are permitted provided that the following conditions +.\ are met: +.\ 1. Redistributions of source code must retain the above copyright +.\notice, this list of conditions and the following disclaimer. +.\ 2. Redistributions in binary form must reproduce the above copyright +.\notice, this list of conditions and the following disclaimer in the +.\documentation and/or other materials provided with the distribution. +.\ +.\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\ CONSEQUENTIAL DAMAGES
CVS commit: src/doc
Module Name:src Committed By: gsutre Date: Tue Oct 12 23:30:47 UTC 2010 Modified Files: src/doc: CHANGES Log Message: Mention acpivga(4). To generate a diff of this commit: cvs rdiff -u -r1.1440 -r1.1441 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.1440 src/doc/CHANGES:1.1441 --- src/doc/CHANGES:1.1440 Thu Oct 7 14:41:02 2010 +++ src/doc/CHANGES Tue Oct 12 23:30:47 2010 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1440 $ +# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1441 $ # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -723,3 +723,4 @@ evbarm: Support Marvell Sheevaplug and some Marvell SoC NAS box. [kiyohara 20101002] dhcpcd(8): Import dhcpcd-5.2.8. [roy 20101007] + acpivga(4): Add a driver for ACPI video extensions. [gsutre 20101012]
CVS commit: src/sys
Module Name:src Committed By: gsutre Date: Tue Oct 12 19:10:51 UTC 2010 Modified Files: src/sys/arch/amd64/conf: GENERIC src/sys/arch/i386/conf: ALL GENERIC src/sys/dev/acpi: acpi.c acpireg.h files.acpi Added Files: src/sys/dev/acpi: acpi_display.c Log Message: Merge ACPI display driver. Provides generic support for brightness control and output switching, through ACPI video extensions. TODO: use wsconsctl(8) instead of sysctl(8) for brightness control. ok jruoho@ also discussed with cegger@ and jmcneill@ To generate a diff of this commit: cvs rdiff -u -r1.285 -r1.286 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.267 -r1.268 src/sys/arch/i386/conf/ALL cvs rdiff -u -r1.993 -r1.994 src/sys/arch/i386/conf/GENERIC cvs rdiff -u -r1.220 -r1.221 src/sys/dev/acpi/acpi.c cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/acpi_display.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/acpireg.h cvs rdiff -u -r1.80 -r1.81 src/sys/dev/acpi/files.acpi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: gsutre Date: Tue Oct 12 23:01:55 UTC 2010 Modified Files: src/distrib/sets/lists/man: mi src/share/man/man4: Makefile Added Files: src/share/man/man4: acpivga.4 Log Message: Add acpivga(4). To generate a diff of this commit: cvs rdiff -u -r1.1239 -r1.1240 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.526 -r1.527 src/share/man/man4/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man4/acpivga.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: gsutre Date: Tue Oct 12 23:30:47 UTC 2010 Modified Files: src/doc: CHANGES Log Message: Mention acpivga(4). To generate a diff of this commit: cvs rdiff -u -r1.1440 -r1.1441 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Fri Oct 8 07:04:32 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_power.c acpi_wakedev.c Log Message: Store sysctl MIBs instead of a pointer to the root of the sysctl sub-tree (because the pointer may be invalid at the time we use it). ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/acpi/acpi_power.c cvs rdiff -u -r1.17 -r1.18 src/sys/dev/acpi/acpi_wakedev.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_power.c diff -u src/sys/dev/acpi/acpi_power.c:1.22 src/sys/dev/acpi/acpi_power.c:1.23 --- src/sys/dev/acpi/acpi_power.c:1.22 Fri Aug 6 18:10:40 2010 +++ src/sys/dev/acpi/acpi_power.c Fri Oct 8 07:04:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_power.c,v 1.22 2010/08/06 18:10:40 jruoho Exp $ */ +/* $NetBSD: acpi_power.c,v 1.23 2010/10/08 07:04:31 gsutre Exp $ */ /*- * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -56,7 +56,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_power.c,v 1.22 2010/08/06 18:10:40 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_power.c,v 1.23 2010/10/08 07:04:31 gsutre Exp $); #include sys/param.h #include sys/kmem.h @@ -99,7 +99,8 @@ static TAILQ_HEAD(, acpi_power_res) res_head = TAILQ_HEAD_INITIALIZER(res_head); -static const struct sysctlnode *anode = NULL; +static int32_t acpi_power_acpinode = CTL_EOL; +static int32_t acpi_power_powernode = CTL_EOL; static struct acpi_power_res *acpi_power_res_init(ACPI_HANDLE); static struct acpi_power_res *acpi_power_res_get(ACPI_HANDLE); @@ -691,6 +692,7 @@ SYSCTL_SETUP(sysctl_acpi_power_setup, sysctl hw.acpi.power subtree setup) { + const struct sysctlnode *anode; int err; err = sysctl_createv(NULL, 0, NULL, anode, @@ -699,7 +701,7 @@ CTL_HW, CTL_EOL); if (err != 0) - goto fail; + return; err = sysctl_createv(NULL, 0, anode, anode, CTLFLAG_PERMANENT, CTLTYPE_NODE, acpi, @@ -707,7 +709,9 @@ CTL_CREATE, CTL_EOL); if (err != 0) - goto fail; + return; + + acpi_power_acpinode = anode-sysctl_num; err = sysctl_createv(NULL, 0, anode, anode, CTLFLAG_PERMANENT, CTLTYPE_NODE, @@ -716,12 +720,9 @@ CTL_CREATE, CTL_EOL); if (err != 0) - goto fail; - - return; + return; -fail: - anode = NULL; + acpi_power_powernode = anode-sysctl_num; } void @@ -732,7 +733,8 @@ KASSERT(ad != NULL ad-ad_root != NULL); KASSERT((ad-ad_flags ACPI_DEVICE_POWER) != 0); - if (anode == NULL) + if (acpi_power_acpinode == CTL_EOL || + acpi_power_powernode == CTL_EOL) return; /* @@ -740,9 +742,10 @@ * may power multiple devices, it is unclear whether * power resources should be controllable by an user. */ - err = sysctl_createv(NULL, 0, anode, NULL, + err = sysctl_createv(NULL, 0, NULL, NULL, CTLFLAG_READONLY, CTLTYPE_STRING, ad-ad_name, NULL, acpi_power_sysctl, 0, ad, 0, + CTL_HW, acpi_power_acpinode, acpi_power_powernode, CTL_CREATE, CTL_EOL); if (err != 0) Index: src/sys/dev/acpi/acpi_wakedev.c diff -u src/sys/dev/acpi/acpi_wakedev.c:1.17 src/sys/dev/acpi/acpi_wakedev.c:1.18 --- src/sys/dev/acpi/acpi_wakedev.c:1.17 Mon Jun 7 14:12:20 2010 +++ src/sys/dev/acpi/acpi_wakedev.c Fri Oct 8 07:04:31 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_wakedev.c,v 1.17 2010/06/07 14:12:20 jruoho Exp $ */ +/* $NetBSD: acpi_wakedev.c,v 1.18 2010/10/08 07:04:31 gsutre Exp $ */ /*- * Copyright (c) 2009, 2010 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_wakedev.c,v 1.17 2010/06/07 14:12:20 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_wakedev.c,v 1.18 2010/10/08 07:04:31 gsutre Exp $); #include sys/param.h #include sys/device.h @@ -50,7 +50,8 @@ NULL, }; -static const struct sysctlnode *rnode = NULL; +static int32_t acpi_wakedev_acpinode = CTL_EOL; +static int32_t acpi_wakedev_wakenode = CTL_EOL; static void acpi_wakedev_method(struct acpi_devnode *, int, int); static void acpi_wakedev_gpe(struct acpi_devnode *, int, int); @@ -58,6 +59,7 @@ SYSCTL_SETUP(sysctl_acpi_wakedev_setup, sysctl hw.acpi.wake subtree setup) { + const struct sysctlnode *rnode; int err; err = sysctl_createv(NULL, 0, NULL, rnode, @@ -66,7 +68,7 @@ CTL_HW, CTL_EOL); if (err != 0) - goto fail; + return; err = sysctl_createv(NULL, 0, rnode, rnode, CTLFLAG_PERMANENT, CTLTYPE_NODE, acpi, @@ -74,7 +76,9 @@ CTL_CREATE, CTL_EOL); if (err != 0) - goto fail; + return; + + acpi_wakedev_acpinode = rnode-sysctl_num; err = sysctl_createv(NULL, 0, rnode, rnode, CTLFLAG_PERMANENT, CTLTYPE_NODE, @@ -83,12 +87,9 @@ CTL_CREATE, CTL_EOL); if (err != 0) - goto fail; - - return; + return; -fail: - rnode = NULL; + acpi_wakedev_wakenode = rnode-sysctl_num; } void @@ -104,12 +105,14 @@ if
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Fri Oct 8 07:04:32 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_power.c acpi_wakedev.c Log Message: Store sysctl MIBs instead of a pointer to the root of the sysctl sub-tree (because the pointer may be invalid at the time we use it). ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/acpi/acpi_power.c cvs rdiff -u -r1.17 -r1.18 src/sys/dev/acpi/acpi_wakedev.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Sat Oct 2 18:06:47 UTC 2010 Modified Files: src/sys/dev/acpi: acpi.c sony_acpi.c wss_acpi.c ym_acpi.c Log Message: Drop _HID requirement for attachment under acpi(4). From now on, drivers attaching to the acpinodebus interface should not assume that the passed acpi_devnode has a valid _HID. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.219 -r1.220 src/sys/dev/acpi/acpi.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/acpi/sony_acpi.c cvs rdiff -u -r1.26 -r1.27 src/sys/dev/acpi/wss_acpi.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/acpi/ym_acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi.c diff -u src/sys/dev/acpi/acpi.c:1.219 src/sys/dev/acpi/acpi.c:1.220 --- src/sys/dev/acpi/acpi.c:1.219 Mon Sep 6 15:54:26 2010 +++ src/sys/dev/acpi/acpi.c Sat Oct 2 18:06:47 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi.c,v 1.219 2010/09/06 15:54:26 jmcneill Exp $ */ +/* $NetBSD: acpi.c,v 1.220 2010/10/02 18:06:47 gsutre Exp $ */ /*- * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. @@ -100,7 +100,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.219 2010/09/06 15:54:26 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.220 2010/10/02 18:06:47 gsutre Exp $); #include opt_acpi.h #include opt_pcifixup.h @@ -979,15 +979,6 @@ } /* - * The same problem as above. As for example - * thermal zones and power resources do not - * have a valid HID, only evaluate devices. - */ - if (di-Type == ACPI_TYPE_DEVICE - (di-Valid ACPI_VALID_HID) == 0) - continue; - - /* * Handled internally. */ if (di-Type == ACPI_TYPE_POWER) Index: src/sys/dev/acpi/sony_acpi.c diff -u src/sys/dev/acpi/sony_acpi.c:1.19 src/sys/dev/acpi/sony_acpi.c:1.20 --- src/sys/dev/acpi/sony_acpi.c:1.19 Tue Aug 24 14:53:45 2010 +++ src/sys/dev/acpi/sony_acpi.c Sat Oct 2 18:06:47 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sony_acpi.c,v 1.19 2010/08/24 14:53:45 jruoho Exp $ */ +/* $NetBSD: sony_acpi.c,v 1.20 2010/10/02 18:06:47 gsutre Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sony_acpi.c,v 1.19 2010/08/24 14:53:45 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: sony_acpi.c,v 1.20 2010/10/02 18:06:47 gsutre Exp $); #include sys/param.h #include sys/sysctl.h @@ -444,7 +444,8 @@ if (ACPI_FAILURE(rv) || devinfo == NULL) return AE_OK; /* we don't want to stop searching */ - if (devinfo-HardwareId.String + if ((devinfo-Valid ACPI_VALID_HID) != 0 + devinfo-HardwareId.String strncmp(devinfo-HardwareId.String, SNY6001, 7) == 0) sc-sc_has_pic = true; Index: src/sys/dev/acpi/wss_acpi.c diff -u src/sys/dev/acpi/wss_acpi.c:1.26 src/sys/dev/acpi/wss_acpi.c:1.27 --- src/sys/dev/acpi/wss_acpi.c:1.26 Fri Mar 5 14:00:17 2010 +++ src/sys/dev/acpi/wss_acpi.c Sat Oct 2 18:06:47 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: wss_acpi.c,v 1.26 2010/03/05 14:00:17 jruoho Exp $ */ +/* $NetBSD: wss_acpi.c,v 1.27 2010/10/02 18:06:47 gsutre Exp $ */ /* * Copyright (c) 2002 Jared D. McNeill jmcne...@invisible.ca @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: wss_acpi.c,v 1.26 2010/03/05 14:00:17 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: wss_acpi.c,v 1.27 2010/10/02 18:06:47 gsutre Exp $); #include sys/param.h #include sys/audioio.h @@ -91,6 +91,9 @@ { struct acpi_attach_args *aa = aux; + if ((aa-aa_node-ad_devinfo-Valid ACPI_VALID_HID) == 0) + return 0; + if (aa-aa_node-ad_type != ACPI_TYPE_DEVICE || wss_acpi_hints_index(aa-aa_node-ad_devinfo-HardwareId.String) == -1) return 0; Index: src/sys/dev/acpi/ym_acpi.c diff -u src/sys/dev/acpi/ym_acpi.c:1.11 src/sys/dev/acpi/ym_acpi.c:1.12 --- src/sys/dev/acpi/ym_acpi.c:1.11 Fri Mar 5 14:00:17 2010 +++ src/sys/dev/acpi/ym_acpi.c Sat Oct 2 18:06:47 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ym_acpi.c,v 1.11 2010/03/05 14:00:17 jruoho Exp $ */ +/* $NetBSD: ym_acpi.c,v 1.12 2010/10/02 18:06:47 gsutre Exp $ */ /* * Copyright (c) 2006 Jasper Wallace jas...@pointless.net @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ym_acpi.c,v 1.11 2010/03/05 14:00:17 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: ym_acpi.c,v 1.12 2010/10/02 18:06:47 gsutre Exp $); #include sys/param.h #include sys/systm.h @@ -62,6 +62,8 @@ if (aa-aa_node-ad_type != ACPI_TYPE_DEVICE) return 0; + if (!(aa-aa_node-ad_devinfo-Valid ACPI_VALID_HID)) + return 0; if (!aa-aa_node-ad_devinfo-HardwareId.String) return 0; /* Yamaha OPL3-SA2 or OPL3-SA3 */
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Sat Oct 2 18:06:47 UTC 2010 Modified Files: src/sys/dev/acpi: acpi.c sony_acpi.c wss_acpi.c ym_acpi.c Log Message: Drop _HID requirement for attachment under acpi(4). From now on, drivers attaching to the acpinodebus interface should not assume that the passed acpi_devnode has a valid _HID. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.219 -r1.220 src/sys/dev/acpi/acpi.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/acpi/sony_acpi.c cvs rdiff -u -r1.26 -r1.27 src/sys/dev/acpi/wss_acpi.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/acpi/ym_acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man4
Module Name:src Committed By: gsutre Date: Wed Sep 29 22:38:34 UTC 2010 Modified Files: src/share/man/man4: acpi.4 Log Message: Fix a typo. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/share/man/man4/acpi.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/acpi.4 diff -u src/share/man/man4/acpi.4:1.58 src/share/man/man4/acpi.4:1.59 --- src/share/man/man4/acpi.4:1.58 Mon Sep 6 16:01:25 2010 +++ src/share/man/man4/acpi.4 Wed Sep 29 22:38:34 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: acpi.4,v 1.58 2010/09/06 16:01:25 jmcneill Exp $ +.\ $NetBSD: acpi.4,v 1.59 2010/09/29 22:38:34 gsutre Exp $ .\ .\ Copyright (c) 2002, 2004, 2010 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -486,7 +486,7 @@ specific parts are typically limited to .Dv ACPI_LV_DEBUG_OBJECT and -.Dv ACPI_LV_DEBUG_INFO . +.Dv ACPI_LV_INFO . The debug output can be stopped by setting .Ic hw.acpi.debug.level to
CVS commit: src/share/man/man4
Module Name:src Committed By: gsutre Date: Wed Sep 29 22:38:34 UTC 2010 Modified Files: src/share/man/man4: acpi.4 Log Message: Fix a typo. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/share/man/man4/acpi.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Fri Sep 24 07:49:00 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_pci.c acpi_verbose.c acpivar.h Log Message: Do not discard ACPI PCI addresses with function number 0x: the ACPI specification allows them (ACPI 4.0a, p. 200). ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/acpi/acpi_pci.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/acpi_verbose.c cvs rdiff -u -r1.62 -r1.63 src/sys/dev/acpi/acpivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_pci.c diff -u src/sys/dev/acpi/acpi_pci.c:1.14 src/sys/dev/acpi/acpi_pci.c:1.15 --- src/sys/dev/acpi/acpi_pci.c:1.14 Mon Aug 9 09:36:42 2010 +++ src/sys/dev/acpi/acpi_pci.c Fri Sep 24 07:48:59 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_pci.c,v 1.14 2010/08/09 09:36:42 gsutre Exp $ */ +/* $NetBSD: acpi_pci.c,v 1.15 2010/09/24 07:48:59 gsutre Exp $ */ /* * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_pci.c,v 1.14 2010/08/09 09:36:42 gsutre Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_pci.c,v 1.15 2010/09/24 07:48:59 gsutre Exp $); #include sys/param.h #include sys/device.h @@ -113,9 +113,10 @@ if (ACPI_FAILURE(rv)) return rv; - if (bus 0 || bus 0x) + if (bus == -1) return AE_NOT_EXIST; + /* Here it holds that 0 = bus = 0x. */ *busp = (uint16_t)bus; return rv; @@ -142,7 +143,10 @@ if (*bus != -1) return AE_ALREADY_EXISTS; - *bus = addr64.Minimum; + if (addr64.Minimum 0x) + return AE_BAD_DATA; + + *bus = (int32_t)addr64.Minimum; return AE_OK; } @@ -211,7 +215,7 @@ ap-ap_function = ACPI_LOLODWORD(ad-ad_devinfo-Address); if (ap-ap_bus 255 || ap-ap_device 31 || - ap-ap_function 7) { + (ap-ap_function 7 ap-ap_function != 0x)) { aprint_error_dev(ad-ad_root, invalid PCI address for %s\n, ad-ad_name); kmem_free(ap, sizeof(*ap)); @@ -246,21 +250,31 @@ ap-ap_device = ACPI_HILODWORD(ad-ad_devinfo-Address); ap-ap_function = ACPI_LOLODWORD(ad-ad_devinfo-Address); - if (ap-ap_device 31 || ap-ap_function 7) { + if (ap-ap_device 31 || + (ap-ap_function 7 ap-ap_function != 0x)) { aprint_error_dev(ad-ad_root, invalid PCI address for %s\n, ad-ad_name); kmem_free(ap, sizeof(*ap)); goto rec; } - /* - * Check whether this device is a PCI-to-PCI - * bridge and get its secondary bus number. - */ - rv = acpi_pcidev_ppb_downbus(ap-ap_segment, ap-ap_bus, - ap-ap_device, ap-ap_function, ap-ap_downbus); + if (ap-ap_function == 0x) { + /* + * Assume that this device is not a PCI-to-PCI bridge. + * XXX: Do we need to be smarter? + */ + ap-ap_bridge = false; + } else { + /* + * Check whether this device is a PCI-to-PCI + * bridge and get its secondary bus number. + */ + rv = acpi_pcidev_ppb_downbus(ap-ap_segment, ap-ap_bus, + ap-ap_device, ap-ap_function, ap-ap_downbus); + + ap-ap_bridge = (rv != AE_OK) ? false : true; + } - ap-ap_bridge = (rv != AE_OK) ? false : true; ad-ad_pciinfo = ap; goto rec; Index: src/sys/dev/acpi/acpi_verbose.c diff -u src/sys/dev/acpi/acpi_verbose.c:1.10 src/sys/dev/acpi/acpi_verbose.c:1.11 --- src/sys/dev/acpi/acpi_verbose.c:1.10 Wed Aug 11 10:32:42 2010 +++ src/sys/dev/acpi/acpi_verbose.c Fri Sep 24 07:48:59 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_verbose.c,v 1.10 2010/08/11 10:32:42 gsutre Exp $ */ +/* $NetBSD: acpi_verbose.c,v 1.11 2010/09/24 07:48:59 gsutre Exp $ */ /*- * Copyright (c) 2003, 2007, 2010 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_verbose.c,v 1.10 2010/08/11 10:32:42 gsutre Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_verbose.c,v 1.11 2010/09/24 07:48:59 gsutre Exp $); #include sys/param.h #include sys/device.h @@ -510,6 +510,9 @@ struct pci_softc *pci; deviter_t di; + if (ap-ap_function == 0x) + return NULL; + for (dv = deviter_first(di, DEVITER_F_ROOT_FIRST); dv != NULL; dv = deviter_next(di)) { pr = device_parent(dv); Index: src/sys/dev/acpi/acpivar.h diff -u src/sys/dev/acpi/acpivar.h:1.62 src/sys/dev/acpi/acpivar.h:1.63 --- src/sys/dev/acpi/acpivar.h:1.62 Mon Sep 6 15:54:27 2010 +++ src/sys/dev/acpi/acpivar.h Fri Sep 24 07:48:59 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpivar.h,v 1.62 2010/09/06 15:54:27 jmcneill Exp $ */ +/* $NetBSD: acpivar.h,v 1.63 2010/09/24 07:48:59 gsutre Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -66,6 +66,17 @@ /* * PCI information for ACPI device nodes that correspond to PCI devices. + * + * Remarks: + * + * ap_bus = 255 + * ap_device = 31 + * ap_function = 7 or ap_function == 0x + * ap_downbus = 255 if ap_bridge == true + * + * The device and function numbers are encoded in the value returned by + *
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Fri Sep 24 07:49:00 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_pci.c acpi_verbose.c acpivar.h Log Message: Do not discard ACPI PCI addresses with function number 0x: the ACPI specification allows them (ACPI 4.0a, p. 200). ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/acpi/acpi_pci.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/acpi/acpi_verbose.c cvs rdiff -u -r1.62 -r1.63 src/sys/dev/acpi/acpivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Wed Aug 11 10:32:42 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_verbose.c Log Message: acpi_print_tree: print ACPI and PCI autoconf(9) device names. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/acpi/acpi_verbose.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_verbose.c diff -u src/sys/dev/acpi/acpi_verbose.c:1.9 src/sys/dev/acpi/acpi_verbose.c:1.10 --- src/sys/dev/acpi/acpi_verbose.c:1.9 Sat Aug 7 18:59:53 2010 +++ src/sys/dev/acpi/acpi_verbose.c Wed Aug 11 10:32:42 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_verbose.c,v 1.9 2010/08/07 18:59:53 jruoho Exp $ */ +/* $NetBSD: acpi_verbose.c,v 1.10 2010/08/11 10:32:42 gsutre Exp $ */ /*- * Copyright (c) 2003, 2007, 2010 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_verbose.c,v 1.9 2010/08/07 18:59:53 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_verbose.c,v 1.10 2010/08/11 10:32:42 gsutre Exp $); #include sys/param.h #include sys/device.h @@ -77,8 +77,12 @@ #include dev/acpi/acpivar.h #include dev/acpi/acpidevs_data.h +#include dev/pci/pcivar.h + #include prop/proplib.h +#include locators.h + static bool acpiverbose_modcmd_prop(prop_dictionary_t); void acpi_print_verbose_real(struct acpi_softc *); @@ -88,6 +92,7 @@ static void acpi_print_fadt(struct acpi_softc *); static void acpi_print_devnodes(struct acpi_softc *); static void acpi_print_tree(struct acpi_devnode *, uint32_t); +static device_t device_find_by_acpi_pci_info(const struct acpi_pci_info *); extern ACPI_TABLE_HEADER *madt_header; @@ -455,6 +460,7 @@ acpi_print_tree(struct acpi_devnode *ad, uint32_t level) { struct acpi_devnode *child; + device_t pcidev; uint32_t i; for (i = 0; i level; i++) @@ -464,6 +470,9 @@ ((ad-ad_flags ACPI_DEVICE_POWER) != 0) ? 'P' : ' ', ((ad-ad_flags ACPI_DEVICE_WAKEUP) != 0) ? 'W' : ' '); + if (ad-ad_device != NULL) + aprint_normal(%s , device_xname(ad-ad_device)); + if (ad-ad_pciinfo != NULL) { aprint_normal((PCI) @ 0x%02X:0x%02X:0x%02X:0x%02X , @@ -474,8 +483,12 @@ aprint_normal([R] ); if (ad-ad_pciinfo-ap_bridge != false) - aprint_normal([B] - 0x%02X, + aprint_normal([B] - 0x%02X , ad-ad_pciinfo-ap_downbus); + + pcidev = device_find_by_acpi_pci_info(ad-ad_pciinfo); + if (pcidev != NULL) + aprint_normal(%s, device_xname(pcidev)); } aprint_normal(\n); @@ -483,3 +496,34 @@ SIMPLEQ_FOREACH(child, ad-ad_child_head, ad_child_list) acpi_print_tree(child, level + 1); } + +/* + * device_find_by_acpi_pci_info: + * + * Returns the device corresponding to the given PCI info, or NULL + * if it doesn't exist. + */ +static device_t +device_find_by_acpi_pci_info(const struct acpi_pci_info *ap) +{ + device_t dv, pr; + struct pci_softc *pci; + deviter_t di; + + for (dv = deviter_first(di, DEVITER_F_ROOT_FIRST); dv != NULL; + dv = deviter_next(di)) { + pr = device_parent(dv); + if ((pr == NULL) || !device_is_a(pr, pci)) + continue; + if (dv-dv_locators == NULL) /* This should not happen. */ + continue; + pci = device_private(pr); + if (pci-sc_bus == ap-ap_bus + device_locator(dv, PCICF_DEV) == ap-ap_device + device_locator(dv, PCICF_FUNCTION) == ap-ap_function) + break; + } + deviter_release(di); + + return dv; +}
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Wed Aug 11 10:32:42 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_verbose.c Log Message: acpi_print_tree: print ACPI and PCI autoconf(9) device names. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/acpi/acpi_verbose.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Mon Aug 9 09:36:42 UTC 2010 Modified Files: src/sys/dev/acpi: acpi.c acpi_pci.c Log Message: acpi_pcidev_scan: attach PCI information only to working devices. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.214 -r1.215 src/sys/dev/acpi/acpi.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/acpi/acpi_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi.c diff -u src/sys/dev/acpi/acpi.c:1.214 src/sys/dev/acpi/acpi.c:1.215 --- src/sys/dev/acpi/acpi.c:1.214 Sat Aug 7 20:07:25 2010 +++ src/sys/dev/acpi/acpi.c Mon Aug 9 09:36:42 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi.c,v 1.214 2010/08/07 20:07:25 jruoho Exp $ */ +/* $NetBSD: acpi.c,v 1.215 2010/08/09 09:36:42 gsutre Exp $ */ /*- * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. @@ -100,7 +100,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.214 2010/08/07 20:07:25 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi.c,v 1.215 2010/08/09 09:36:42 gsutre Exp $); #include opt_acpi.h #include opt_pcifixup.h @@ -963,6 +963,8 @@ * functioning properly. However, if a device is enabled, * it is decoding resources and we should claim these, * if possible. This requires changes to bus_space(9). + * Note: there is a possible race condition, because _STA + * may have changed since di-CurrentStatus was set. */ if (di-Type == ACPI_TYPE_DEVICE) { Index: src/sys/dev/acpi/acpi_pci.c diff -u src/sys/dev/acpi/acpi_pci.c:1.13 src/sys/dev/acpi/acpi_pci.c:1.14 --- src/sys/dev/acpi/acpi_pci.c:1.13 Sun Aug 8 16:26:47 2010 +++ src/sys/dev/acpi/acpi_pci.c Mon Aug 9 09:36:42 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_pci.c,v 1.13 2010/08/08 16:26:47 gsutre Exp $ */ +/* $NetBSD: acpi_pci.c,v 1.14 2010/08/09 09:36:42 gsutre Exp $ */ /* * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_pci.c,v 1.13 2010/08/08 16:26:47 gsutre Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_pci.c,v 1.14 2010/08/09 09:36:42 gsutre Exp $); #include sys/param.h #include sys/device.h @@ -169,6 +169,16 @@ !(ad-ad_devinfo-Valid ACPI_VALID_ADR)) goto rec; + /* + * We attach PCI information only to devices that are present, + * enabled, and functioning properly. + * Note: there is a possible race condition, because _STA may + * have changed since ad-ad_devinfo-CurrentStatus was set. + */ + if ((ad-ad_devinfo-Valid ACPI_VALID_STA) != 0 + (ad-ad_devinfo-CurrentStatus ACPI_STA_OK) != ACPI_STA_OK) + goto rec; + if (ad-ad_devinfo-Flags ACPI_PCI_ROOT_BRIDGE) { ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Sun Aug 8 16:26:47 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_pci.c Log Message: acpi_pcidev_scan: discard invalid PCI addresses. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/acpi/acpi_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_pci.c diff -u src/sys/dev/acpi/acpi_pci.c:1.12 src/sys/dev/acpi/acpi_pci.c:1.13 --- src/sys/dev/acpi/acpi_pci.c:1.12 Wed Jun 9 04:20:10 2010 +++ src/sys/dev/acpi/acpi_pci.c Sun Aug 8 16:26:47 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_pci.c,v 1.12 2010/06/09 04:20:10 mrg Exp $ */ +/* $NetBSD: acpi_pci.c,v 1.13 2010/08/08 16:26:47 gsutre Exp $ */ /* * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_pci.c,v 1.12 2010/06/09 04:20:10 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_pci.c,v 1.13 2010/08/08 16:26:47 gsutre Exp $); #include sys/param.h #include sys/device.h @@ -163,11 +163,11 @@ ACPI_INTEGER val; ACPI_STATUS rv; + ad-ad_pciinfo = NULL; + if (ad-ad_devinfo-Type != ACPI_TYPE_DEVICE || - !(ad-ad_devinfo-Valid ACPI_VALID_ADR)) { - ad-ad_pciinfo = NULL; + !(ad-ad_devinfo-Valid ACPI_VALID_ADR)) goto rec; - } if (ad-ad_devinfo-Flags ACPI_PCI_ROOT_BRIDGE) { @@ -200,6 +200,14 @@ ap-ap_device = ACPI_HILODWORD(ad-ad_devinfo-Address); ap-ap_function = ACPI_LOLODWORD(ad-ad_devinfo-Address); + if (ap-ap_bus 255 || ap-ap_device 31 || + ap-ap_function 7) { + aprint_error_dev(ad-ad_root, + invalid PCI address for %s\n, ad-ad_name); + kmem_free(ap, sizeof(*ap)); + goto rec; + } + ap-ap_bridge = true; ap-ap_downbus = ap-ap_bus; @@ -228,6 +236,13 @@ ap-ap_device = ACPI_HILODWORD(ad-ad_devinfo-Address); ap-ap_function = ACPI_LOLODWORD(ad-ad_devinfo-Address); + if (ap-ap_device 31 || ap-ap_function 7) { + aprint_error_dev(ad-ad_root, + invalid PCI address for %s\n, ad-ad_name); + kmem_free(ap, sizeof(*ap)); + goto rec; + } + /* * Check whether this device is a PCI-to-PCI * bridge and get its secondary bus number. @@ -256,8 +271,8 @@ * acpi_pcidev_ppb_downbus: * * Retrieve the secondary bus number of the PCI-to-PCI bridge having the - * given PCI id. If successful, return AE_OK and fill *busp. Otherwise, - * return an exception code and leave *busp unchanged. + * given PCI id. If successful, return AE_OK and fill *downbus. + * Otherwise, return an exception code and leave *downbus unchanged. * * XXX Need to deal with PCI segment groups (see also acpica/OsdHardware.c). */
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: gsutre Date: Sun Aug 8 16:26:47 UTC 2010 Modified Files: src/sys/dev/acpi: acpi_pci.c Log Message: acpi_pcidev_scan: discard invalid PCI addresses. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/acpi/acpi_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/notes/common
Module Name:src Committed By: gsutre Date: Sun Jul 11 20:00:52 UTC 2010 Modified Files: src/distrib/notes/common: main Log Message: Add myself To generate a diff of this commit: cvs rdiff -u -r1.464 -r1.465 src/distrib/notes/common/main Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/notes/common/main diff -u src/distrib/notes/common/main:1.464 src/distrib/notes/common/main:1.465 --- src/distrib/notes/common/main:1.464 Thu Jun 10 17:49:32 2010 +++ src/distrib/notes/common/main Sun Jul 11 20:00:52 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: main,v 1.464 2010/06/10 17:49:32 dholland Exp $ +.\ $NetBSD: main,v 1.465 2010/07/11 20:00:52 gsutre Exp $ .\ .\ Copyright (c) 1999-2008 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -1334,6 +1334,7 @@ .It Ta Bill Studenmund Ta Mt wrstu...@netbsd.org .It Ta Kevin Sullivan Ta Mt sulli...@netbsd.org .It Ta Kimmo Suominen Ta Mt k...@netbsd.org +.It Ta Gr\('egoire Sutre Ta Mt gsu...@netbsd.org .It Ta Sergey Svishchev Ta Mt shatte...@netbsd.org .It Ta Robert Swindells Ta Mt r...@netbsd.org .It Ta Shin Takemura Ta Mt takem...@netbsd.org
CVS commit: src/sys/dev/acpi/acpica
Module Name:src Committed By: gsutre Date: Sat Jul 10 21:31:00 UTC 2010 Modified Files: src/sys/dev/acpi/acpica: OsdHardware.c Log Message: AcpiOsDerivePciId: make sure that we only update the PCI bus number, and that we do so only if it was succesfully derived. ok jruoho@, kochi@ To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpica/OsdHardware.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpica/OsdHardware.c diff -u src/sys/dev/acpi/acpica/OsdHardware.c:1.5 src/sys/dev/acpi/acpica/OsdHardware.c:1.6 --- src/sys/dev/acpi/acpica/OsdHardware.c:1.5 Tue Sep 15 19:41:30 2009 +++ src/sys/dev/acpi/acpica/OsdHardware.c Sat Jul 10 21:31:00 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: OsdHardware.c,v 1.5 2009/09/15 19:41:30 drochner Exp $ */ +/* $NetBSD: OsdHardware.c,v 1.6 2010/07/10 21:31:00 gsutre Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -44,13 +44,14 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.5 2009/09/15 19:41:30 drochner Exp $); +__KERNEL_RCSID(0, $NetBSD: OsdHardware.c,v 1.6 2010/07/10 21:31:00 gsutre Exp $); #include sys/param.h #include sys/device.h #include dev/acpi/acpica.h #include dev/acpi/acpivar.h +#include dev/acpi/acpi_pci.h #include machine/acpi_machdep.h @@ -276,66 +277,99 @@ return AE_OK; } -/* get PCI bus# from root bridge recursively */ -static int -get_bus_number( -ACPI_HANDLErhandle, -ACPI_HANDLEchandle, -ACPI_PCI_ID**PciId) +/* + * acpi_os_derive_pciid_rec: + * + * Helper function for AcpiOsDerivePciId. The parameters are: + * - chandle: a handle to the node whose PCI id shall be derived. + * - rhandle: a handle the PCI root bridge upstream of chandle. + * - pciid: where the derived PCI id is returned. + * + * This function assumes that rhandle is a proper ancestor of chandle, + * and that pciid has already been filled by ACPICA: + * - segment# and bus# obtained from _SEG and _BBN on rhandle, + * - device# and function# obtained from _ADR on the ACPI device node + * whose scope chandle is in). + */ +static ACPI_STATUS +acpi_os_derive_pciid_rec(ACPI_HANDLE chandle, ACPI_HANDLE rhandle, ACPI_PCI_ID *pciid) { - ACPI_HANDLE handle; + ACPI_HANDLE phandle; + ACPI_INTEGER address; + ACPI_OBJECT_TYPE objtype; ACPI_STATUS rv; - ACPI_OBJECT_TYPE type; - ACPI_PCI_ID *id; - ACPI_INTEGER v; - int bus; + uint16_t valb; - id = *PciId; + KASSERT(chandle != rhandle); - rv = AcpiGetParent(chandle, handle); - if (ACPI_FAILURE(rv)) - return 0; + /* + * Get parent device node. This is should not fail since chandle has + * at least one ancestor that is a device node: rhandle. + */ + phandle = chandle; + do { + rv = AcpiGetParent(phandle, phandle); + if (ACPI_FAILURE(rv)) + return rv; + rv = AcpiGetType(phandle, objtype); + if (ACPI_FAILURE(rv)) + return rv; + } + while (objtype != ACPI_TYPE_DEVICE); /* - * When handle == rhandle, we have valid PciId-Bus - * which was obtained from _BBN in evrgnini.c - * so we don't have to reevaluate _BBN. + * If the parent is rhandle then we have nothing to do since ACPICA + * has pre-filled the PCI id to the best it could. */ - if (handle != rhandle) { - bus = get_bus_number(rhandle, handle, PciId); + if (phandle == rhandle) + return AE_OK; - rv = AcpiGetType(handle, type); - if (ACPI_FAILURE(rv) || type != ACPI_TYPE_DEVICE) - return bus; + /* Recursive call to get PCI id of the parent */ + rv = acpi_os_derive_pciid_rec(phandle, rhandle, pciid); + if (ACPI_FAILURE(rv)) + return rv; - rv = acpi_eval_integer(handle, METHOD_NAME__ADR, v); + /* + * If this is not an ACPI device, return the PCI id of its parent. + */ + rv = AcpiGetType(chandle, objtype); + if (ACPI_FAILURE(rv)) + return rv; + if (objtype != ACPI_TYPE_DEVICE) + return AE_OK; - if (ACPI_FAILURE(rv)) - return bus; + /* + * This is an ACPI device node. Its parent device node is not a PCI + * root bridge. Check that it is a PCI-to-PCI bridge and get its + * secondary bus#. + */ + rv = acpi_pcidev_ppb_downbus(pciid-Segment, pciid-Bus, pciid-Device, + pciid-Function, valb); + if (ACPI_FAILURE(rv)) + return rv; - id-Bus = bus; - id-Device = ACPI_HIWORD((ACPI_INTEGER)v); - id-Function = ACPI_LOWORD((ACPI_INTEGER)v); - - /* read HDR_TYPE register */ - rv = AcpiOsReadPciConfiguration(id, 0x0e, v, 8); - if (ACPI_SUCCESS(rv) - /* mask multifunction bit check bridge type */ - ((v 0x7f) == 1 || (v 0x7f) == 2)) { - /* read SECONDARY_BUS register */ - rv = AcpiOsReadPciConfiguration(id, 0x19, v, 8); - if (ACPI_SUCCESS(rv)) -id-Bus = v; - } - } + /* Get address (contains dev# and fun# for PCI devices). */ + rv = acpi_eval_integer(chandle, METHOD_NAME__ADR, address); + if (ACPI_FAILURE(rv)) + return rv; - return id-Bus; + pciid-Bus = valb; + pciid-Device =
CVS commit: src/sys/dev/acpi/acpica
Module Name:src Committed By: gsutre Date: Sat Jul 10 21:31:00 UTC 2010 Modified Files: src/sys/dev/acpi/acpica: OsdHardware.c Log Message: AcpiOsDerivePciId: make sure that we only update the PCI bus number, and that we do so only if it was succesfully derived. ok jruoho@, kochi@ To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpica/OsdHardware.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.