CVS commit: src/sys/dev/hpc
Module Name:src Committed By: rin Date: Sat Jun 5 02:27:08 UTC 2021 Modified Files: src/sys/dev/hpc: hpcfb.c Log Message: hpcfb_cnattach(): If fbconf == NULL, this is for early console output (used for hpcmips/VR41xx machines), and wsdisplay_preattach() should be used instead of wsdisplay_cnattach(). Fix KASSERT failure for double attach of wsdisplay, reported in port-mips. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/dev/hpc/hpcfb.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/hpc/hpcfb.c diff -u src/sys/dev/hpc/hpcfb.c:1.61 src/sys/dev/hpc/hpcfb.c:1.62 --- src/sys/dev/hpc/hpcfb.c:1.61 Sat Apr 24 23:36:54 2021 +++ src/sys/dev/hpc/hpcfb.c Sat Jun 5 02:27:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: hpcfb.c,v 1.61 2021/04/24 23:36:54 thorpej Exp $ */ +/* $NetBSD: hpcfb.c,v 1.62 2021/06/05 02:27:08 rin Exp $ */ /*- * Copyright (c) 1999 @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.61 2021/04/24 23:36:54 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.62 2021/06/05 02:27:08 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_hpcfb.h" @@ -410,8 +410,17 @@ hpcfb_cnattach(struct hpcfb_fbconf *fbco hpcfb_console_wsscreen.capabilities = hpcfb_console_dc.dc_rinfo.ri_caps; hpcfb_allocattr(_console_dc, WSCOL_WHITE, WSCOL_BLACK, 0, ); - wsdisplay_cnattach(_console_wsscreen, _console_dc, - 0, 0, defattr); +#if NBIVIDEO > 0 + /* + * This is early console. Do not really attach wsdisplay. + */ + if (fbconf == &__fbconf) + wsdisplay_preattach(_console_wsscreen, _console_dc, + 0, 0, defattr); + else +#endif + wsdisplay_cnattach(_console_wsscreen, _console_dc, + 0, 0, defattr); hpcfbconsole = 1; return (0);
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: uwe Date: Tue Sep 18 14:57:32 UTC 2018 Modified Files: src/sys/dev/hpc: hpckbd.c Log Message: Clarify the comment in the "unconst" version of hpckbd_keymap_setup. Both sh3 (P1) and mips (kseg0) have the kernel directly mapped. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c diff -u src/sys/dev/hpc/hpckbd.c:1.34 src/sys/dev/hpc/hpckbd.c:1.35 --- src/sys/dev/hpc/hpckbd.c:1.34 Tue Sep 18 09:09:26 2018 +++ src/sys/dev/hpc/hpckbd.c Tue Sep 18 14:57:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: hpckbd.c,v 1.34 2018/09/18 09:09:26 uwe Exp $ */ +/* $NetBSD: hpckbd.c,v 1.35 2018/09/18 14:57:32 uwe Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.34 2018/09/18 09:09:26 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.35 2018/09/18 14:57:32 uwe Exp $"); #include #include @@ -280,9 +280,8 @@ hpckbd_keymap_setup(struct hpckbd_core * * is a hint as to what is wrong. This actually ends up modifying * initialized data which is marked "const". * - * The reason we get away with it here is that on sh3 kernel - * is directly mapped. For mips, read-only data is mapped - * read/write at the moment. + * The reason we get away with it here is that on sh3 and mips + * the kernel is directly mapped. */ desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc); for (i = 0; desc[i].name != 0; i++) {
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: uwe Date: Tue Sep 18 09:09:26 UTC 2018 Modified Files: src/sys/dev/hpc: hpckbd.c Log Message: Fix comment formatting in previous. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c diff -u src/sys/dev/hpc/hpckbd.c:1.33 src/sys/dev/hpc/hpckbd.c:1.34 --- src/sys/dev/hpc/hpckbd.c:1.33 Tue Sep 18 02:58:10 2018 +++ src/sys/dev/hpc/hpckbd.c Tue Sep 18 09:09:26 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: hpckbd.c,v 1.33 2018/09/18 02:58:10 rin Exp $ */ +/* $NetBSD: hpckbd.c,v 1.34 2018/09/18 09:09:26 uwe Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.33 2018/09/18 02:58:10 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.34 2018/09/18 09:09:26 uwe Exp $"); #include #include @@ -263,9 +263,9 @@ hpckbd_getevent(struct hpckbd_core* hc, #if defined(hpcsh) || defined(hpcmips) /* - * XXX: Use the old wrong code for now as hpcsh and hpcmips attach console very - * early when malloc(9) is not yet available. It is convenient to be able to do - * early DDB on wscons. + * XXX: Use the old wrong code for now as hpcsh and hpcmips attach + * console very early when malloc(9) is not yet available. It is + * convenient to be able to do early DDB on wscons. */ void hpckbd_keymap_setup(struct hpckbd_core *hc,
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: rin Date: Tue Sep 18 02:58:10 UTC 2018 Modified Files: src/sys/dev/hpc: hpckbd.c Log Message: Apply workaround introduced in r1.31 to hpcmips. Fix kernel crash when console is attached. Now, my MC/R550 boots multiuser. Thanks Masahiko Ito for encouraging me to do bisection to find this out. XXX pullup-8, pullup-7 To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c diff -u src/sys/dev/hpc/hpckbd.c:1.32 src/sys/dev/hpc/hpckbd.c:1.33 --- src/sys/dev/hpc/hpckbd.c:1.32 Mon Aug 7 23:57:40 2017 +++ src/sys/dev/hpc/hpckbd.c Tue Sep 18 02:58:10 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: hpckbd.c,v 1.32 2017/08/07 23:57:40 uwe Exp $ */ +/* $NetBSD: hpckbd.c,v 1.33 2018/09/18 02:58:10 rin Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.32 2017/08/07 23:57:40 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.33 2018/09/18 02:58:10 rin Exp $"); #include #include @@ -261,10 +261,11 @@ hpckbd_getevent(struct hpckbd_core* hc, } -#ifdef hpcsh +#if defined(hpcsh) || defined(hpcmips) /* - * XXX: Use the old wrong code for now as hpcsh attaches console very - * early and it's convenient to be able to do early DDB on wscons. + * XXX: Use the old wrong code for now as hpcsh and hpcmips attach console very + * early when malloc(9) is not yet available. It is convenient to be able to do + * early DDB on wscons. */ void hpckbd_keymap_setup(struct hpckbd_core *hc, @@ -278,8 +279,10 @@ hpckbd_keymap_setup(struct hpckbd_core * * XXX The way this is done is really wrong. The __UNCONST() * is a hint as to what is wrong. This actually ends up modifying * initialized data which is marked "const". + * * The reason we get away with it here is that on sh3 kernel - * is directly mapped. + * is directly mapped. For mips, read-only data is mapped + * read/write at the moment. */ desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc); for (i = 0; desc[i].name != 0; i++) {
CVS commit: src/sys/dev/hpc/apm
Module Name:src Committed By: maya Date: Sat Jul 21 18:11:09 UTC 2018 Modified Files: src/sys/dev/hpc/apm: apmdev.c Log Message: Remove unused variable. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/hpc/apm/apmdev.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/hpc/apm/apmdev.c diff -u src/sys/dev/hpc/apm/apmdev.c:1.31 src/sys/dev/hpc/apm/apmdev.c:1.32 --- src/sys/dev/hpc/apm/apmdev.c:1.31 Wed Oct 25 08:12:38 2017 +++ src/sys/dev/hpc/apm/apmdev.c Sat Jul 21 18:11:09 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: apmdev.c,v 1.31 2017/10/25 08:12:38 maya Exp $ */ +/* $NetBSD: apmdev.c,v 1.32 2018/07/21 18:11:09 maya Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: apmdev.c,v 1.31 2017/10/25 08:12:38 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: apmdev.c,v 1.32 2018/07/21 18:11:09 maya Exp $"); #ifdef _KERNEL_OPT #include "opt_apm.h" @@ -137,7 +137,6 @@ const struct cdevsw apmdev_cdevsw = { }; /* configurable variables */ -int apm_bogus_bios = 0; #ifdef APM_NO_STANDBY int apm_do_standby = 0; #else
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: uwe Date: Mon Aug 7 23:57:40 UTC 2017 Modified Files: src/sys/dev/hpc: hpckbd.c Log Message: XXX: On hpcsh only - bring back old incorrect hpckbd_keymap_setup() fixed in 1.31. The old one with UNCONST does work on hpcsh b/c the kernel is directly mapped. The new one does not work on hpcsh b/c it calls consinit() very early when malloc() is not yet available. The real fix for this is to fix the constness of wscons keymap structures that is self-contradictory. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c diff -u src/sys/dev/hpc/hpckbd.c:1.31 src/sys/dev/hpc/hpckbd.c:1.32 --- src/sys/dev/hpc/hpckbd.c:1.31 Mon Jun 12 09:23:39 2017 +++ src/sys/dev/hpc/hpckbd.c Mon Aug 7 23:57:40 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: hpckbd.c,v 1.31 2017/06/12 09:23:39 manu Exp $ */ +/* $NetBSD: hpckbd.c,v 1.32 2017/08/07 23:57:40 uwe Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.31 2017/06/12 09:23:39 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.32 2017/08/07 23:57:40 uwe Exp $"); #include #include @@ -260,6 +260,40 @@ hpckbd_getevent(struct hpckbd_core* hc, return (1); } + +#ifdef hpcsh +/* + * XXX: Use the old wrong code for now as hpcsh attaches console very + * early and it's convenient to be able to do early DDB on wscons. + */ +void +hpckbd_keymap_setup(struct hpckbd_core *hc, + const keysym_t *map, int mapsize) +{ + int i; + struct wscons_keydesc *desc; + + /* fix keydesc table */ + /* + * XXX The way this is done is really wrong. The __UNCONST() + * is a hint as to what is wrong. This actually ends up modifying + * initialized data which is marked "const". + * The reason we get away with it here is that on sh3 kernel + * is directly mapped. + */ + desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc); + for (i = 0; desc[i].name != 0; i++) { + if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) { + desc[i].map = map; + desc[i].map_size = mapsize; + } + } + + return; +} + +#else + void hpckbd_keymap_setup(struct hpckbd_core *hc, const keysym_t *map, int mapsize) @@ -294,6 +328,7 @@ hpckbd_keymap_setup(struct hpckbd_core * return; } +#endif void hpckbd_keymap_lookup(struct hpckbd_core *hc)
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: uwe Date: Wed Aug 2 00:58:18 UTC 2017 Modified Files: src/sys/dev/hpc: hpf1275a_tty.c Log Message: Fix the previous fix that doesn't even compile. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/hpc/hpf1275a_tty.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/hpc/hpf1275a_tty.c diff -u src/sys/dev/hpc/hpf1275a_tty.c:1.27 src/sys/dev/hpc/hpf1275a_tty.c:1.28 --- src/sys/dev/hpc/hpf1275a_tty.c:1.27 Fri Jun 28 14:44:15 2013 +++ src/sys/dev/hpc/hpf1275a_tty.c Wed Aug 2 00:58:18 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: hpf1275a_tty.c,v 1.27 2013/06/28 14:44:15 christos Exp $ */ +/* $NetBSD: hpf1275a_tty.c,v 1.28 2017/08/02 00:58:18 uwe Exp $ */ /* * Copyright (c) 2004 Valeriy E. Ushakov @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpf1275a_tty.c,v 1.27 2013/06/28 14:44:15 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpf1275a_tty.c,v 1.28 2017/08/02 00:58:18 uwe Exp $"); #include "opt_wsdisplay_compat.h" @@ -307,7 +307,7 @@ hpf1275a_open(dev_t dev, struct tty *tp) .cf_fstate = FSTATE_STAR, }; struct lwp *l = curlwp; /* XXX */ - struct hpf1275a_softc *sc = device_private(self); + struct hpf1275a_softc *sc; device_t self; int error, s; @@ -328,6 +328,7 @@ hpf1275a_open(dev_t dev, struct tty *tp) return (EIO); } + sc = device_private(self); tp->t_sc = sc; sc->sc_tp = tp;
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: maxv Date: Sun Jun 25 12:21:00 UTC 2017 Modified Files: src/sys/dev/hpc: hpcapm.c Log Message: spl leak, found by Mootja To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/hpc/hpcapm.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/hpc/hpcapm.c diff -u src/sys/dev/hpc/hpcapm.c:1.20 src/sys/dev/hpc/hpcapm.c:1.21 --- src/sys/dev/hpc/hpcapm.c:1.20 Sat Nov 9 21:31:56 2013 +++ src/sys/dev/hpc/hpcapm.c Sun Jun 25 12:21:00 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: hpcapm.c,v 1.20 2013/11/09 21:31:56 christos Exp $ */ +/* $NetBSD: hpcapm.c,v 1.21 2017/06/25 12:21:00 maxv Exp $ */ /* * Copyright (c) 2000 Takemura Shin @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpcapm.c,v 1.20 2013/11/09 21:31:56 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpcapm.c,v 1.21 2017/06/25 12:21:00 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_hpcapm.h" @@ -415,6 +415,8 @@ hpcapm_get_event(void *scx, u_int *event sc->power_state = APM_SYS_READY; } else *event_info = 0; + splx(s); + return (0); } }
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: manu Date: Mon Jun 12 09:23:39 UTC 2017 Modified Files: src/sys/dev/hpc: hpckbd.c Log Message: Restore wscons keymaps feature on hpcarm hpc ports need to alter keydesc data at runtime in order to load alternate keymaps. But since keydesc is const initialized data, it is mapped read only and the operation should fail. It seems older compiler failed to enforce the read-only mapping and this is why it used to work, but on recent NetBSD releases, the feature is broken. We fix it by duplicating the keydesc data once into a malloc'ed area that can be modified. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c diff -u src/sys/dev/hpc/hpckbd.c:1.30 src/sys/dev/hpc/hpckbd.c:1.31 --- src/sys/dev/hpc/hpckbd.c:1.30 Sat Oct 27 17:18:17 2012 +++ src/sys/dev/hpc/hpckbd.c Mon Jun 12 09:23:39 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: hpckbd.c,v 1.30 2012/10/27 17:18:17 chs Exp $ */ +/* $NetBSD: hpckbd.c,v 1.31 2017/06/12 09:23:39 manu Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -30,11 +30,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30 2012/10/27 17:18:17 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.31 2017/06/12 09:23:39 manu Exp $"); #include #include #include +#include #include @@ -264,22 +265,30 @@ hpckbd_keymap_setup(struct hpckbd_core * const keysym_t *map, int mapsize) { int i; - struct wscons_keydesc *desc; + const struct wscons_keydesc *desc; + static struct wscons_keydesc *ndesc = NULL; - /* fix keydesc table */ /* - * XXX The way this is done is really wrong. The __UNCONST() - * is a hint as to what is wrong. This actually ends up modifying - * initialized data which is marked "const". - * The reason we get away with it here is apparently that text - * and read-only data gets mapped read/write on the platforms - * using this code. + * fix keydesc table. Since it is const data, we must + * copy it once before changingg it. */ - desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc); + + if (ndesc == NULL) { + size_t sz; + + for (sz = 0; hpckbd_keymapdata.keydesc[sz].name != 0; sz++); + + ndesc = malloc(sz * sizeof(*ndesc), M_DEVBUF, M_WAITOK); + memcpy(ndesc, hpckbd_keymapdata.keydesc, sz * sizeof(*ndesc)); + + hpckbd_keymapdata.keydesc = ndesc; + } + + desc = hpckbd_keymapdata.keydesc; for (i = 0; desc[i].name != 0; i++) { if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) { - desc[i].map = map; - desc[i].map_size = mapsize; + ndesc[i].map = map; + ndesc[i].map_size = mapsize; } }
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: skrll Date: Tue Sep 6 06:27:17 UTC 2016 Modified Files: src/sys/dev/hpc: btnmgr.c Log Message: Don't read beyond the end of an array To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/hpc/btnmgr.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/hpc/btnmgr.c diff -u src/sys/dev/hpc/btnmgr.c:1.28 src/sys/dev/hpc/btnmgr.c:1.29 --- src/sys/dev/hpc/btnmgr.c:1.28 Fri Jul 25 08:10:37 2014 +++ src/sys/dev/hpc/btnmgr.c Tue Sep 6 06:27:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: btnmgr.c,v 1.28 2014/07/25 08:10:37 dholland Exp $ */ +/* $NetBSD: btnmgr.c,v 1.29 2016/09/06 06:27:17 skrll Exp $ */ /*- * Copyright (c) 1999 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: btnmgr.c,v 1.28 2014/07/25 08:10:37 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: btnmgr.c,v 1.29 2016/09/06 06:27:17 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_btnmgr.h" @@ -205,7 +205,7 @@ btnmgrattach(device_t parent, /* * install button event listener */ - for (id = 0; id <= n_button_config; id++) + for (id = 0; id < n_button_config; id++) if (button_config[id].name != NULL) sc->sc_hook_tag = config_hook(CONFIG_HOOK_BUTTONEVENT, id, CONFIG_HOOK_SHARE,
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: ozaki-r Date: Tue Apr 7 01:24:32 UTC 2015 Modified Files: src/sys/dev/hpc: hpcfb.c Log Message: Add missing semicolon To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/hpc/hpcfb.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/hpc/hpcfb.c diff -u src/sys/dev/hpc/hpcfb.c:1.59 src/sys/dev/hpc/hpcfb.c:1.60 --- src/sys/dev/hpc/hpcfb.c:1.59 Sat Apr 4 15:39:40 2015 +++ src/sys/dev/hpc/hpcfb.c Tue Apr 7 01:24:32 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: hpcfb.c,v 1.59 2015/04/04 15:39:40 christos Exp $ */ +/* $NetBSD: hpcfb.c,v 1.60 2015/04/07 01:24:32 ozaki-r Exp $ */ /*- * Copyright (c) 1999 @@ -43,7 +43,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.59 2015/04/04 15:39:40 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.60 2015/04/07 01:24:32 ozaki-r Exp $); #ifdef _KERNEL_OPT #include opt_hpcfb.h @@ -472,7 +472,7 @@ hpcfb_init(struct hpcfb_fbconf *fbconf, } if (rasops_init(ri, HPCFB_MAX_ROW, HPCFB_MAX_COLUMN)) { - aprint_error_dev(dc-dc_sc-sc_dev, rasops_init() failed!) + aprint_error_dev(dc-dc_sc-sc_dev, rasops_init() failed!); return -1; }
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: christos Date: Sat Apr 4 15:39:40 UTC 2015 Modified Files: src/sys/dev/hpc: hpcfb.c Log Message: fix leak, found by Brainy. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/dev/hpc/hpcfb.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/hpc/hpcfb.c diff -u src/sys/dev/hpc/hpcfb.c:1.58 src/sys/dev/hpc/hpcfb.c:1.59 --- src/sys/dev/hpc/hpcfb.c:1.58 Sat Nov 13 08:51:59 2010 +++ src/sys/dev/hpc/hpcfb.c Sat Apr 4 11:39:40 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: hpcfb.c,v 1.58 2010/11/13 13:51:59 uebayasi Exp $ */ +/* $NetBSD: hpcfb.c,v 1.59 2015/04/04 15:39:40 christos Exp $ */ /*- * Copyright (c) 1999 @@ -43,7 +43,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.58 2010/11/13 13:51:59 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.59 2015/04/04 15:39:40 christos Exp $); #ifdef _KERNEL_OPT #include opt_hpcfb.h @@ -472,7 +472,8 @@ hpcfb_init(struct hpcfb_fbconf *fbconf, } if (rasops_init(ri, HPCFB_MAX_ROW, HPCFB_MAX_COLUMN)) { - panic(%s(%d): rasops_init() failed!, __FILE__, __LINE__); + aprint_error_dev(dc-dc_sc-sc_dev, rasops_init() failed!) + return -1; } /* over write color map of rasops */ @@ -722,13 +723,15 @@ hpcfb_alloc_screen(void *v, const struct DPRINTF((%s(%d): hpcfb_alloc_screen()\n, __FILE__, __LINE__)); - dc = malloc(sizeof(struct hpcfb_devconfig), M_DEVBUF, M_WAITOK|M_ZERO); + dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK|M_ZERO); if (dc == NULL) - return (ENOMEM); + return ENOMEM; dc-dc_sc = sc; - if (hpcfb_init(sc-sc_fbconflist[0], dc) != 0) - return (EINVAL); + if (hpcfb_init(sc-sc_fbconflist[0], dc) != 0) { + free(dc, M_DEVBUF); + return EINVAL; + } if (sc-sc_accessops-font) { sc-sc_accessops-font(sc-sc_accessctx, dc-dc_rinfo.ri_font);
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: christos Date: Sat Nov 9 21:31:56 UTC 2013 Modified Files: src/sys/dev/hpc: hpcapm.c Log Message: fix unused variable warning To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/hpc/hpcapm.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/hpc/hpcapm.c diff -u src/sys/dev/hpc/hpcapm.c:1.19 src/sys/dev/hpc/hpcapm.c:1.20 --- src/sys/dev/hpc/hpcapm.c:1.19 Sat Oct 27 13:18:17 2012 +++ src/sys/dev/hpc/hpcapm.c Sat Nov 9 16:31:56 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: hpcapm.c,v 1.19 2012/10/27 17:18:17 chs Exp $ */ +/* $NetBSD: hpcapm.c,v 1.20 2013/11/09 21:31:56 christos Exp $ */ /* * Copyright (c) 2000 Takemura Shin @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpcapm.c,v 1.19 2012/10/27 17:18:17 chs Exp $); +__KERNEL_RCSID(0, $NetBSD: hpcapm.c,v 1.20 2013/11/09 21:31:56 christos Exp $); #ifdef _KERNEL_OPT #include opt_hpcapm.h @@ -294,17 +294,11 @@ hpcapm_hook(void *ctx, int type, long id static void hpcapm_disconnect(void *scx) { - struct apmhpc_softc *sc; - - sc = scx; } static void hpcapm_enable(void *scx, int onoff) { - struct apmhpc_softc *sc; - - sc = scx; } static int @@ -432,26 +426,16 @@ hpcapm_get_event(void *scx, u_int *event static void hpcapm_cpu_busy(void *scx) { - struct apmhpc_softc *sc; - - sc = scx; } static void hpcapm_cpu_idle(void *scx) { - struct apmhpc_softc *sc; - - sc = scx; } static void hpcapm_get_capabilities(void *scx, u_int *numbatts, u_int *capflags) { - struct apmhpc_softc *sc; - *numbatts = 0; *capflags = APM_GLOBAL_STANDBY | APM_GLOBAL_SUSPEND; - - sc = scx; }
CVS commit: src/sys/dev/hpc/apm
Module Name:src Committed By: christos Date: Sat Nov 9 02:44:52 UTC 2013 Modified Files: src/sys/dev/hpc/apm: apmdev.c Log Message: fixed unused variable warning To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/hpc/apm/apmdev.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/hpc/apm/apmdev.c diff -u src/sys/dev/hpc/apm/apmdev.c:1.27 src/sys/dev/hpc/apm/apmdev.c:1.28 --- src/sys/dev/hpc/apm/apmdev.c:1.27 Wed Oct 3 19:55:22 2012 +++ src/sys/dev/hpc/apm/apmdev.c Fri Nov 8 21:44:52 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: apmdev.c,v 1.27 2012/10/03 23:55:22 christos Exp $ */ +/* $NetBSD: apmdev.c,v 1.28 2013/11/09 02:44:52 christos Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: apmdev.c,v 1.27 2012/10/03 23:55:22 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: apmdev.c,v 1.28 2013/11/09 02:44:52 christos Exp $); #ifdef _KERNEL_OPT #include opt_apm.h @@ -461,6 +461,8 @@ apm_event_handle(struct apm_softc *sc, u if (error == 0 (sc-sc_flags (SCFLAG_OREAD|SCFLAG_OWRITE)) == 0) apm_power_print(sc, pi); +#else + __USE(error); #endif apm_record_event(sc, event_code); break;
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: christos Date: Fri Jun 28 14:44:15 UTC 2013 Modified Files: src/sys/dev/hpc: hpf1275a_tty.c Log Message: fix uninitialized pointer. This could have never worked. http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/hpc/hpf1275a_tty.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/hpc/hpf1275a_tty.c diff -u src/sys/dev/hpc/hpf1275a_tty.c:1.26 src/sys/dev/hpc/hpf1275a_tty.c:1.27 --- src/sys/dev/hpc/hpf1275a_tty.c:1.26 Sat Oct 27 13:18:17 2012 +++ src/sys/dev/hpc/hpf1275a_tty.c Fri Jun 28 10:44:15 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: hpf1275a_tty.c,v 1.26 2012/10/27 17:18:17 chs Exp $ */ +/* $NetBSD: hpf1275a_tty.c,v 1.27 2013/06/28 14:44:15 christos Exp $ */ /* * Copyright (c) 2004 Valeriy E. Ushakov @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpf1275a_tty.c,v 1.26 2012/10/27 17:18:17 chs Exp $); +__KERNEL_RCSID(0, $NetBSD: hpf1275a_tty.c,v 1.27 2013/06/28 14:44:15 christos Exp $); #include opt_wsdisplay_compat.h @@ -307,7 +307,7 @@ hpf1275a_open(dev_t dev, struct tty *tp) .cf_fstate = FSTATE_STAR, }; struct lwp *l = curlwp; /* XXX */ - struct hpf1275a_softc *sc; + struct hpf1275a_softc *sc = device_private(self); device_t self; int error, s; @@ -328,7 +328,7 @@ hpf1275a_open(dev_t dev, struct tty *tp) return (EIO); } - tp-t_sc = device_private(self); + tp-t_sc = sc; sc-sc_tp = tp; splx(s);
CVS commit: src/sys/dev/hpc/apm
Module Name:src Committed By: christos Date: Wed Oct 3 23:55:22 UTC 2012 Modified Files: src/sys/dev/hpc/apm: apmdev.c Log Message: remove diagnostic printfs to make this compile again. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/hpc/apm/apmdev.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/hpc/apm/apmdev.c diff -u src/sys/dev/hpc/apm/apmdev.c:1.26 src/sys/dev/hpc/apm/apmdev.c:1.27 --- src/sys/dev/hpc/apm/apmdev.c:1.26 Sun Sep 30 17:36:20 2012 +++ src/sys/dev/hpc/apm/apmdev.c Wed Oct 3 19:55:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: apmdev.c,v 1.26 2012/09/30 21:36:20 dsl Exp $ */ +/* $NetBSD: apmdev.c,v 1.27 2012/10/03 23:55:22 christos Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: apmdev.c,v 1.26 2012/09/30 21:36:20 dsl Exp $); +__KERNEL_RCSID(0, $NetBSD: apmdev.c,v 1.27 2012/10/03 23:55:22 christos Exp $); #ifdef _KERNEL_OPT #include opt_apm.h @@ -584,12 +584,6 @@ apm_set_ver(struct apm_softc *sc) ok: aprint_normal(Power Management spec V%d.%d, apm_majver, apm_minver); apm_inited = 1; -#ifdef DIAGNOSTIC - if (sc-sc_detail APM_BIOS_PM_DISABLED) - aprint_normal( (BIOS mgmt disabled)); - if (sc-sc_detail APM_BIOS_PM_DISENGAGED) - aprint_normal( (BIOS managing devices)); -#endif } static int
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: nonaka Date: Sat Jun 11 16:34:36 UTC 2011 Modified Files: src/sys/dev/hpc: hpckbd.c Log Message: split device_t/softc. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c diff -u src/sys/dev/hpc/hpckbd.c:1.28 src/sys/dev/hpc/hpckbd.c:1.29 --- src/sys/dev/hpc/hpckbd.c:1.28 Tue May 12 14:22:39 2009 +++ src/sys/dev/hpc/hpckbd.c Sat Jun 11 16:34:36 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: hpckbd.c,v 1.28 2009/05/12 14:22:39 cegger Exp $ */ +/* $NetBSD: hpckbd.c,v 1.29 2011/06/11 16:34:36 nonaka Exp $ */ /*- * Copyright (c) 1999-2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpckbd.c,v 1.28 2009/05/12 14:22:39 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: hpckbd.c,v 1.29 2011/06/11 16:34:36 nonaka Exp $); #include sys/param.h #include sys/systm.h @@ -87,7 +87,7 @@ }; struct hpckbd_softc { - struct device sc_dev; + device_t sc_dev; struct hpckbd_core *sc_core; struct hpckbd_core sc_coredata; }; @@ -104,7 +104,7 @@ int __hpckbd_input(void *, int, int); void __hpckbd_input_hook(void *); -CFATTACH_DECL(hpckbd, sizeof(struct hpckbd_softc), +CFATTACH_DECL_NEW(hpckbd, sizeof(struct hpckbd_softc), hpckbd_match, hpckbd_attach, NULL, NULL); /* wskbd accessopts */ @@ -139,8 +139,7 @@ }; int -hpckbd_match(device_t parent, - cfdata_t cf, void *aux) +hpckbd_match(device_t parent, cfdata_t cf, void *aux) { return (1); } @@ -153,6 +152,8 @@ struct hpckbd_ic_if *ic = haa-haa_ic; struct wskbddev_attach_args wa; + sc-sc_dev = self; + /* * Initialize core if it isn't console */
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: tsutsui Date: Sun Aug 1 02:43:12 UTC 2010 Modified Files: src/sys/dev/hpc: hpcfb.c Log Message: Remove deprecated powerhook_establish(9) since apmdev(4) which required the old API was gone. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/dev/hpc/hpcfb.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/hpc/hpcfb.c diff -u src/sys/dev/hpc/hpcfb.c:1.56 src/sys/dev/hpc/hpcfb.c:1.57 --- src/sys/dev/hpc/hpcfb.c:1.56 Fri Jun 18 09:11:44 2010 +++ src/sys/dev/hpc/hpcfb.c Sun Aug 1 02:43:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hpcfb.c,v 1.56 2010/06/18 09:11:44 tsutsui Exp $ */ +/* $NetBSD: hpcfb.c,v 1.57 2010/08/01 02:43:12 tsutsui Exp $ */ /*- * Copyright (c) 1999 @@ -43,7 +43,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.56 2010/06/18 09:11:44 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.57 2010/08/01 02:43:12 tsutsui Exp $); #ifdef _KERNEL_OPT #include opt_hpcfb.h @@ -156,7 +156,6 @@ struct hpcfb_devconfig *sc_dc; /* device configuration */ const struct hpcfb_accessops *sc_accessops; void *sc_accessctx; - void *sc_powerhook; /* power management hook */ device_t sc_wsdisplay; int sc_screen_resumed; int sc_polling; @@ -344,17 +343,6 @@ } #endif /* HPCFB_JUMP */ - /* - * apmdev(4) uses dopowerhooks(9), apm(4) uses pmf(9), and the - * two apm drivers are mutually exclusive. Register power - * hooks with both. - */ - sc-sc_powerhook = powerhook_establish(device_xname(sc-sc_dev), - hpcfb_power, sc); - if (sc-sc_powerhook == NULL) - aprint_error_dev(self, - WARNING: unable to establish power hook\n); - if (!pmf_device_register(self, hpcfb_suspend, hpcfb_resume)) aprint_error_dev(self, unable to establish power handler\n); }
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: tsutsui Date: Sun Aug 1 02:47:43 UTC 2010 Modified Files: src/sys/dev/hpc: bivideo.c Log Message: Replace powerhook_establish(9) with pmf(9). To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/hpc/bivideo.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/hpc/bivideo.c diff -u src/sys/dev/hpc/bivideo.c:1.30 src/sys/dev/hpc/bivideo.c:1.31 --- src/sys/dev/hpc/bivideo.c:1.30 Tue May 12 14:22:39 2009 +++ src/sys/dev/hpc/bivideo.c Sun Aug 1 02:47:43 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bivideo.c,v 1.30 2009/05/12 14:22:39 cegger Exp $ */ +/* $NetBSD: bivideo.c,v 1.31 2010/08/01 02:47:43 tsutsui Exp $ */ /*- * Copyright (c) 1999-2001 @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: bivideo.c,v 1.30 2009/05/12 14:22:39 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: bivideo.c,v 1.31 2010/08/01 02:47:43 tsutsui Exp $); #ifdef _KERNEL_OPT #include opt_hpcfb.h @@ -88,7 +88,6 @@ struct device sc_dev; struct hpcfb_fbconf sc_fbconf; struct hpcfb_dspconf sc_dspconf; - void *sc_powerhook; /* power management hook */ int sc_powerstate; #define PWRSTAT_SUSPEND (10) #define PWRSTAT_VIDEOOFF (11) @@ -110,6 +109,8 @@ static int bivideo_init(struct hpcfb_fbconf *); static void bivideo_power(int, void *); static void bivideo_update_powerstate(struct bivideo_softc *, int); +static bool bivideo_suspend(device_t, const pmf_qual_t *); +static bool bivideo_resume(device_t, const pmf_qual_t *); void bivideo_init_backlight(struct bivideo_softc *, int); void bivideo_init_brightness(struct bivideo_softc *, int); void bivideo_init_contrast(struct bivideo_softc *, int); @@ -178,10 +179,8 @@ /* Add a suspend hook to power saving */ sc-sc_powerstate = 0; - sc-sc_powerhook = powerhook_establish(device_xname(sc-sc_dev), - bivideo_power, sc); - if (sc-sc_powerhook == NULL) - aprint_error_dev(sc-sc_dev, WARNING: unable to establish power hook\n); + if (!pmf_device_register(self, bivideo_suspend, bivideo_resume)) + aprint_error_dev(self, unable to establish power handler\n); /* initialize backlight brightness and lcd contrast */ sc-sc_lcd_inited = 0; @@ -372,6 +371,24 @@ (sc-sc_powerstate PWRSTAT_BACKLIGHT))); } +static bool +bivideo_suspend(device_t self, const pmf_qual_t *qual) +{ + struct bivideo_softc *sc = device_private(self); + + bivideo_power(PWR_SUSPEND, sc); + return true; +} + +static bool +bivideo_resume(device_t self, const pmf_qual_t *qual) +{ + struct bivideo_softc *sc = device_private(self); + + bivideo_power(PWR_RESUME, sc); + return true; +} + int bivideo_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l) {
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: tsutsui Date: Fri Jun 18 09:11:44 UTC 2010 Modified Files: src/sys/dev/hpc: hpcfb.c Log Message: Add WSDISPLAYIO_LINEBYTES, which is required by Xorg wsfb server. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/dev/hpc/hpcfb.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/hpc/hpcfb.c diff -u src/sys/dev/hpc/hpcfb.c:1.55 src/sys/dev/hpc/hpcfb.c:1.56 --- src/sys/dev/hpc/hpcfb.c:1.55 Sat May 15 08:53:27 2010 +++ src/sys/dev/hpc/hpcfb.c Fri Jun 18 09:11:44 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hpcfb.c,v 1.55 2010/05/15 08:53:27 tsutsui Exp $ */ +/* $NetBSD: hpcfb.c,v 1.56 2010/06/18 09:11:44 tsutsui Exp $ */ /*- * Copyright (c) 1999 @@ -43,7 +43,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.55 2010/05/15 08:53:27 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.56 2010/06/18 09:11:44 tsutsui Exp $); #ifdef _KERNEL_OPT #include opt_hpcfb.h @@ -582,6 +582,10 @@ wdf-cmsize = 256; /* */ return (0); + case WSDISPLAYIO_LINEBYTES: + *(u_int *)data = dc-dc_rinfo.ri_stride; + return 0; + case WSDISPLAYIO_SMODE: if (*(int *)data == WSDISPLAYIO_MODE_EMUL){ if (sc-sc_mapping){
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: tsutsui Date: Sat May 15 06:01:13 UTC 2010 Modified Files: src/sys/dev/hpc: hpcfb.c Log Message: Set RI_NO_AUTO in ri-ri_flg if hpcfb_init() is invoked from cnattach. Fixes silent hang on hpcsh and hpcmips. XXX: all other rasops based console devices need to set this flag?? To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/dev/hpc/hpcfb.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/hpc/hpcfb.c diff -u src/sys/dev/hpc/hpcfb.c:1.53 src/sys/dev/hpc/hpcfb.c:1.54 --- src/sys/dev/hpc/hpcfb.c:1.53 Wed Feb 24 22:37:57 2010 +++ src/sys/dev/hpc/hpcfb.c Sat May 15 06:01:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: hpcfb.c,v 1.53 2010/02/24 22:37:57 dyoung Exp $ */ +/* $NetBSD: hpcfb.c,v 1.54 2010/05/15 06:01:12 tsutsui Exp $ */ /*- * Copyright (c) 1999 @@ -43,7 +43,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.53 2010/02/24 22:37:57 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.54 2010/05/15 06:01:12 tsutsui Exp $); #ifdef _KERNEL_OPT #include opt_hpcfb.h @@ -451,6 +451,9 @@ #else ri-ri_flg = RI_CURSOR; #endif + if (dc == hpcfb_console_dc) + ri-ri_flg |= RI_NO_AUTO; + switch (ri-ri_depth) { case 8: if (32 = fbconf-hf_pack_width
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: cegger Date: Tue May 12 14:22:39 UTC 2009 Modified Files: src/sys/dev/hpc: bivideo.c btnmgr.c button.c hpcapm.c hpcin.c hpcioman.c hpckbd.c hpcout.c hpf1275a_tty.c pwctl.c Log Message: struct device * - device_t, no functional changes intended. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/hpc/bivideo.c cvs rdiff -u -r1.24 -r1.25 src/sys/dev/hpc/btnmgr.c \ src/sys/dev/hpc/hpf1275a_tty.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/hpc/button.c src/sys/dev/hpc/hpcout.c cvs rdiff -u -r1.17 -r1.18 src/sys/dev/hpc/hpcapm.c \ src/sys/dev/hpc/hpcioman.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/hpc/hpcin.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/hpc/hpckbd.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/hpc/pwctl.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/hpc/bivideo.c diff -u src/sys/dev/hpc/bivideo.c:1.29 src/sys/dev/hpc/bivideo.c:1.30 --- src/sys/dev/hpc/bivideo.c:1.29 Tue May 12 12:13:49 2009 +++ src/sys/dev/hpc/bivideo.c Tue May 12 14:22:39 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: bivideo.c,v 1.29 2009/05/12 12:13:49 cegger Exp $ */ +/* $NetBSD: bivideo.c,v 1.30 2009/05/12 14:22:39 cegger Exp $ */ /*- * Copyright (c) 1999-2001 @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: bivideo.c,v 1.29 2009/05/12 12:13:49 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: bivideo.c,v 1.30 2009/05/12 14:22:39 cegger Exp $); #ifdef _KERNEL_OPT #include opt_hpcfb.h @@ -79,8 +79,8 @@ /* * function prototypes */ -int bivideomatch(struct device *, cfdata_t, void *); -void bivideoattach(struct device *, struct device *, void *); +int bivideomatch(device_t, cfdata_t, void *); +void bivideoattach(device_t, device_t, void *); int bivideo_ioctl(void *, u_long, void *, int, struct lwp *); paddr_t bivideo_mmap(void *, off_t, int); @@ -140,7 +140,7 @@ * function bodies */ int -bivideomatch(struct device *parent, cfdata_t match, void *aux) +bivideomatch(device_t parent, cfdata_t match, void *aux) { struct mainbus_attach_args *ma = aux; @@ -152,7 +152,7 @@ } void -bivideoattach(struct device *parent, struct device *self, void *aux) +bivideoattach(device_t parent, device_t self, void *aux) { struct bivideo_softc *sc = device_private(self); struct hpcfb_attach_args ha; Index: src/sys/dev/hpc/btnmgr.c diff -u src/sys/dev/hpc/btnmgr.c:1.24 src/sys/dev/hpc/btnmgr.c:1.25 --- src/sys/dev/hpc/btnmgr.c:1.24 Tue May 12 12:13:49 2009 +++ src/sys/dev/hpc/btnmgr.c Tue May 12 14:22:39 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: btnmgr.c,v 1.24 2009/05/12 12:13:49 cegger Exp $ */ +/* $NetBSD: btnmgr.c,v 1.25 2009/05/12 14:22:39 cegger Exp $ */ /*- * Copyright (c) 1999 @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: btnmgr.c,v 1.24 2009/05/12 12:13:49 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: btnmgr.c,v 1.25 2009/05/12 14:22:39 cegger Exp $); #ifdef _KERNEL_OPT #include opt_btnmgr.h @@ -77,14 +77,14 @@ struct device sc_dev; config_hook_tag sc_hook_tag; int sc_enabled; - struct device *sc_wskbddev; + device_t sc_wskbddev; #ifdef WSDISPLAY_COMPAT_RAWKBD int sc_rawkbd; #endif }; -int btnmgrmatch(struct device *, cfdata_t, void *); -void btnmgrattach(struct device *, struct device *, void *); +int btnmgrmatch(device_t, cfdata_t, void *); +void btnmgrattach(device_t, device_t, void *); const char *btnmgr_name(long); static int btnmgr_hook(void *, int, long, void *); @@ -173,7 +173,7 @@ * function bodies */ int -btnmgrmatch(struct device *parent, cfdata_t match, void *aux) +btnmgrmatch(device_t parent, cfdata_t match, void *aux) { struct mainbus_attach_args *ma = aux; @@ -184,8 +184,8 @@ } void -btnmgrattach(struct device *parent, - struct device *self, void *aux) +btnmgrattach(device_t parent, + device_t self, void *aux) { int id; struct btnmgr_softc *sc = device_private(self); Index: src/sys/dev/hpc/hpf1275a_tty.c diff -u src/sys/dev/hpc/hpf1275a_tty.c:1.24 src/sys/dev/hpc/hpf1275a_tty.c:1.25 --- src/sys/dev/hpc/hpf1275a_tty.c:1.24 Tue May 12 12:13:49 2009 +++ src/sys/dev/hpc/hpf1275a_tty.c Tue May 12 14:22:39 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hpf1275a_tty.c,v 1.24 2009/05/12 12:13:49 cegger Exp $ */ +/* $NetBSD: hpf1275a_tty.c,v 1.25 2009/05/12 14:22:39 cegger Exp $ */ /* * Copyright (c) 2004 Valeriy E. Ushakov @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpf1275a_tty.c,v 1.24 2009/05/12 12:13:49 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: hpf1275a_tty.c,v 1.25 2009/05/12 14:22:39 cegger Exp $); #include opt_wsdisplay_compat.h @@ -59,7 +59,7 @@ struct device sc_dev; struct tty *sc_tp; /* back reference to the tty */ - struct device *sc_wskbd; /* wskbd child */ + device_t sc_wskbd; /* wskbd child */ int sc_enabled; #ifdef WSDISPLAY_COMPAT_RAWKBD int sc_rawkbd; @@ -76,9 +76,9 @@ static
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: uwe Date: Sun Apr 5 01:48:47 UTC 2009 Modified Files: src/sys/dev/hpc: hpcfb.c Log Message: Split device_t and softc. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/hpc/hpcfb.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/hpc/hpcfb.c diff -u src/sys/dev/hpc/hpcfb.c:1.48 src/sys/dev/hpc/hpcfb.c:1.49 --- src/sys/dev/hpc/hpcfb.c:1.48 Sat Mar 14 21:04:19 2009 +++ src/sys/dev/hpc/hpcfb.c Sun Apr 5 01:48:47 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hpcfb.c,v 1.48 2009/03/14 21:04:19 dsl Exp $ */ +/* $NetBSD: hpcfb.c,v 1.49 2009/04/05 01:48:47 uwe Exp $ */ /*- * Copyright (c) 1999 @@ -43,7 +43,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.48 2009/03/14 21:04:19 dsl Exp $); +__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.49 2009/04/05 01:48:47 uwe Exp $); #ifdef _KERNEL_OPT #include opt_hpcfb.h @@ -153,12 +153,12 @@ #define HPCFB_MAX_JUMP 5 struct hpcfb_softc { - struct device sc_dev; + device_t sc_dev; struct hpcfb_devconfig *sc_dc; /* device configuration */ const struct hpcfb_accessops *sc_accessops; void *sc_accessctx; void *sc_powerhook; /* power management hook */ - struct device *sc_wsdisplay; + device_t sc_wsdisplay; int sc_screen_resumed; int sc_polling; int sc_mapping; @@ -174,8 +174,8 @@ /* * function prototypes */ -int hpcfbmatch(struct device *, struct cfdata *, void *); -void hpcfbattach(struct device *, struct device *, void *); +int hpcfbmatch(device_t, cfdata_t, void *); +void hpcfbattach(device_t, device_t, void *); int hpcfbprint(void *, const char *); int hpcfb_ioctl(void *, void *, u_long, void *, int, struct lwp *); @@ -231,7 +231,7 @@ /* * static variables */ -CFATTACH_DECL(hpcfb, sizeof(struct hpcfb_softc), +CFATTACH_DECL_NEW(hpcfb, sizeof(struct hpcfb_softc), hpcfbmatch, hpcfbattach, NULL, NULL); struct wsscreen_descr hpcfb_stdscreen = { @@ -280,20 +280,21 @@ */ int -hpcfbmatch(struct device *parent, - struct cfdata *match, void *aux) +hpcfbmatch(device_t parent, cfdata_t match, void *aux) { return (1); } void -hpcfbattach(struct device *parent, - struct device *self, void *aux) +hpcfbattach(device_t parent, device_t self, void *aux) { - struct hpcfb_softc *sc = device_private(self); + struct hpcfb_softc *sc; struct hpcfb_attach_args *ha = aux; struct wsemuldisplaydev_attach_args wa; + sc = device_private(self); + sc-sc_dev = self; + sc-sc_accessops = ha-ha_accessops; sc-sc_accessctx = ha-ha_accessctx; sc-sc_nfbconf = ha-ha_nfbconf; @@ -318,10 +319,10 @@ callout_init(sc-sc_switch_callout, 0); /* Add a power hook to power management */ - sc-sc_powerhook = powerhook_establish(device_xname(sc-sc_dev), + sc-sc_powerhook = powerhook_establish(device_xname(sc-sc_dev), hpcfb_power, sc); if (sc-sc_powerhook == NULL) - aprint_error_dev(sc-sc_dev, WARNING: unable to establish power hook\n); + aprint_error_dev(sc-sc_dev, WARNING: unable to establish power hook\n); wa.console = hpcfbconsole; wa.scrdata = hpcfb_screenlist; @@ -335,12 +336,12 @@ * Create a kernel thread to scroll, */ if (kthread_create(PRI_NONE, 0, NULL, hpcfb_thread, sc, - sc-sc_thread, %s, device_xname(sc-sc_dev)) != 0) { + sc-sc_thread, %s, device_xname(sc-sc_dev)) != 0) { /* * We were unable to create the HPCFB thread; bail out. */ sc-sc_thread = 0; - aprint_error_dev(sc-sc_dev, unable to create thread, kernel + aprint_error_dev(sc-sc_dev, unable to create thread, kernel hpcfb scroll support disabled\n); } #endif /* HPCFB_JUMP */
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: uwe Date: Fri Apr 3 04:21:51 UTC 2009 Modified Files: src/sys/dev/hpc: files.hpcapm Log Message: Config glue for attaching apm at apmdevif. Unfortunately dev/apm/files.apm and dev/hpc/apm/files.apm cannot be included both at the same time (they define same options and config(1) complains), so you need to comment out old code and uncomment new code to be able to replace apmdev0 at hpcapm0 with apm0 at hpcapm0 in your kernel config. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hpc/files.hpcapm 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/hpc/files.hpcapm diff -u src/sys/dev/hpc/files.hpcapm:1.2 src/sys/dev/hpc/files.hpcapm:1.3 --- src/sys/dev/hpc/files.hpcapm:1.2 Mon Oct 9 10:33:42 2006 +++ src/sys/dev/hpc/files.hpcapm Fri Apr 3 04:21:51 2009 @@ -1,8 +1,33 @@ -# $NetBSD: files.hpcapm,v 1.2 2006/10/09 10:33:42 peter Exp $ +# $NetBSD: files.hpcapm,v 1.3 2009/04/03 04:21:51 uwe Exp $ # H/PC APM device emulator +# XXX: transitioning from apmdev(4) to apm(4) +# XXX: cannot include both, unfortunately +# +# While drivers are not converted let kernels have either old +# +# apmdev0 at hpcapm0 # defined in dev/hpc/apm/files.apm +# +# to maintain status quo, xor new +# +# apm0 at hpcapm0 +# +# for those who do driver convertion to pmf(9). + +#-if old apmdev(4) - dopowerhooks(9) + include dev/hpc/apm/files.apm +#-else new apm(4) - pmf(9) + +#include dev/apm/files.apm +#define apmdevif {} +#attach apm at apmdevif with apm_apmdevif +#file dev/hpc/apm_apmdevif.c apm_apmdevif + +#-endif + + define hpcapmif { } device hpcapm: apmdevif attach hpcapm at hpcapmif
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: uwe Date: Fri Apr 3 05:01:10 UTC 2009 Modified Files: src/sys/dev/hpc: files.hpcapm src/sys/dev/hpc/apm: apmdev.c files.apm Log Message: Use dev/apm/files.apm for APM options in opt_apm.h. Now both apm and apmdev files.apm can be included so you can switch from apmdev0 to apm0 at hpcapm0 in your kernel config easily. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hpc/files.hpcapm cvs rdiff -u -r1.22 -r1.23 src/sys/dev/hpc/apm/apmdev.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hpc/apm/files.apm 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/hpc/files.hpcapm diff -u src/sys/dev/hpc/files.hpcapm:1.3 src/sys/dev/hpc/files.hpcapm:1.4 --- src/sys/dev/hpc/files.hpcapm:1.3 Fri Apr 3 04:21:51 2009 +++ src/sys/dev/hpc/files.hpcapm Fri Apr 3 05:01:09 2009 @@ -1,32 +1,20 @@ -# $NetBSD: files.hpcapm,v 1.3 2009/04/03 04:21:51 uwe Exp $ +# $NetBSD: files.hpcapm,v 1.4 2009/04/03 05:01:09 uwe Exp $ # H/PC APM device emulator -# XXX: transitioning from apmdev(4) to apm(4) -# XXX: cannot include both, unfortunately -# +include dev/hpc/apm/files.apm + +# Transitioning from apmdev(4) to apm(4) # While drivers are not converted let kernels have either old # -# apmdev0 at hpcapm0 # defined in dev/hpc/apm/files.apm +# apmdev0 at hpcapm0 # # to maintain status quo, xor new # # apm0 at hpcapm0 # # for those who do driver convertion to pmf(9). - -#-if old apmdev(4) - dopowerhooks(9) - -include dev/hpc/apm/files.apm - -#-else new apm(4) - pmf(9) - -#include dev/apm/files.apm -#define apmdevif {} -#attach apm at apmdevif with apm_apmdevif -#file dev/hpc/apm_apmdevif.c apm_apmdevif - -#-endif - +attach apm at apmdevif with apm_apmdevif +file dev/hpc/apm_apmdevif.c apm_apmdevif define hpcapmif { } device hpcapm: apmdevif Index: src/sys/dev/hpc/apm/apmdev.c diff -u src/sys/dev/hpc/apm/apmdev.c:1.22 src/sys/dev/hpc/apm/apmdev.c:1.23 --- src/sys/dev/hpc/apm/apmdev.c:1.22 Fri Apr 3 04:13:17 2009 +++ src/sys/dev/hpc/apm/apmdev.c Fri Apr 3 05:01:10 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: apmdev.c,v 1.22 2009/04/03 04:13:17 uwe Exp $ */ +/* $NetBSD: apmdev.c,v 1.23 2009/04/03 05:01:10 uwe Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,10 +33,10 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: apmdev.c,v 1.22 2009/04/03 04:13:17 uwe Exp $); +__KERNEL_RCSID(0, $NetBSD: apmdev.c,v 1.23 2009/04/03 05:01:10 uwe Exp $); #ifdef _KERNEL_OPT -#include opt_apmdev.h +#include opt_apm.h #endif #ifdef APM_NOIDLE Index: src/sys/dev/hpc/apm/files.apm diff -u src/sys/dev/hpc/apm/files.apm:1.3 src/sys/dev/hpc/apm/files.apm:1.4 --- src/sys/dev/hpc/apm/files.apm:1.3 Fri Feb 24 13:06:12 2006 +++ src/sys/dev/hpc/apm/files.apm Fri Apr 3 05:01:10 2009 @@ -1,12 +1,12 @@ -# $NetBSD: files.apm,v 1.3 2006/02/24 13:06:12 cube Exp $ +# $NetBSD: files.apm,v 1.4 2009/04/03 05:01:10 uwe Exp $ # # Common APM support files # -defflag opt_apmdev.h APM_DISABLE APM_FORCE_64K_SEGMENTS APM_NO_IDLE - APM_NO_STANDBY APM_V10_ONLY APM_NO_V12 APMDEBUG - APM_POWER_PRINT -defparam opt_apmdev.h APMDEBUG_VALUE APM_DISABLE_INTERRUPTS + + +include dev/apm/files.apm + define apmdevif {} device apmdev attach apmdev at apmdevif
CVS commit: src/sys/dev/hpc
Module Name:src Committed By: uwe Date: Mon Mar 30 06:17:40 UTC 2009 Modified Files: src/sys/dev/hpc: hpcapm.c Log Message: Fix battery_state vs. battery_flags confusion. Fill all fields of struct apm_power_info in hpcapm_get_powstat. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/hpc/hpcapm.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/hpc/hpcapm.c diff -u src/sys/dev/hpc/hpcapm.c:1.13 src/sys/dev/hpc/hpcapm.c:1.14 --- src/sys/dev/hpc/hpcapm.c:1.13 Fri Oct 19 11:59:42 2007 +++ src/sys/dev/hpc/hpcapm.c Mon Mar 30 06:17:39 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: hpcapm.c,v 1.13 2007/10/19 11:59:42 ad Exp $ */ +/* $NetBSD: hpcapm.c,v 1.14 2009/03/30 06:17:39 uwe Exp $ */ /* * Copyright (c) 2000 Takemura Shin @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hpcapm.c,v 1.13 2007/10/19 11:59:42 ad Exp $); +__KERNEL_RCSID(0, $NetBSD: hpcapm.c,v 1.14 2009/03/30 06:17:39 uwe Exp $); #ifdef _KERNEL_OPT #include opt_hpcapm.h @@ -78,7 +78,7 @@ void *sc_apmdev; volatile unsigned int events; volatile int power_state; - volatile int battery_state; + volatile int battery_flags; volatile int ac_state; config_hook_tag sc_standby_hook; config_hook_tag sc_suspend_hook; @@ -124,7 +124,7 @@ sc-events = 0; sc-power_state = APM_SYS_READY; - sc-battery_state = APM_BATT_FLAG_UNKNOWN; + sc-battery_flags = APM_BATT_FLAG_UNKNOWN; sc-ac_state = APM_AC_UNKNOWN; sc-battery_life = APM_BATT_LIFE_UNKNOWN; sc-minutes_left = 0; @@ -193,22 +193,22 @@ switch (message) { case CONFIG_HOOK_BATT_CRITICAL: DPRINTF((hpcapm: battery state critical\n)); - charge = sc-battery_state APM_BATT_FLAG_CHARGING; - sc-battery_state = APM_BATT_FLAG_CRITICAL; - sc-battery_state |= charge; + charge = sc-battery_flags APM_BATT_FLAG_CHARGING; + sc-battery_flags = APM_BATT_FLAG_CRITICAL; + sc-battery_flags |= charge; sc-battery_life = 0; break; case CONFIG_HOOK_BATT_LOW: DPRINTF((hpcapm: battery state low\n)); - charge = sc-battery_state APM_BATT_FLAG_CHARGING; - sc-battery_state = APM_BATT_FLAG_LOW; - sc-battery_state |= charge; + charge = sc-battery_flags APM_BATT_FLAG_CHARGING; + sc-battery_flags = APM_BATT_FLAG_LOW; + sc-battery_flags |= charge; break; case CONFIG_HOOK_BATT_HIGH: DPRINTF((hpcapm: battery state high\n)); - charge = sc-battery_state APM_BATT_FLAG_CHARGING; - sc-battery_state = APM_BATT_FLAG_HIGH; - sc-battery_state |= charge; + charge = sc-battery_flags APM_BATT_FLAG_CHARGING; + sc-battery_flags = APM_BATT_FLAG_HIGH; + sc-battery_flags |= charge; break; case CONFIG_HOOK_BATT_10P: DPRINTF((hpcapm: battery life 10%%\n)); @@ -252,12 +252,12 @@ break; case CONFIG_HOOK_BATT_UNKNOWN: DPRINTF((hpcapm: battery state unknown\n)); - sc-battery_state = APM_BATT_FLAG_UNKNOWN; + sc-battery_flags = APM_BATT_FLAG_UNKNOWN; sc-battery_life = APM_BATT_LIFE_UNKNOWN; break; case CONFIG_HOOK_BATT_NO_SYSTEM_BATTERY: DPRINTF((hpcapm: battery state no system battery?\n)); - sc-battery_state = APM_BATT_FLAG_NO_SYSTEM_BATTERY; + sc-battery_flags = APM_BATT_FLAG_NO_SYSTEM_BATTERY; sc-battery_life = APM_BATT_LIFE_UNKNOWN; break; } @@ -266,17 +266,17 @@ switch (message) { case CONFIG_HOOK_AC_OFF: DPRINTF((hpcapm: ac not connected\n)); - sc-battery_state = ~APM_BATT_FLAG_CHARGING; + sc-battery_flags = ~APM_BATT_FLAG_CHARGING; sc-ac_state = APM_AC_OFF; break; case CONFIG_HOOK_AC_ON_CHARGE: DPRINTF((hpcapm: charging\n)); - sc-battery_state |= APM_BATT_FLAG_CHARGING; + sc-battery_flags |= APM_BATT_FLAG_CHARGING; sc-ac_state = APM_AC_ON; break; case CONFIG_HOOK_AC_ON_NOCHARGE: DPRINTF((hpcapm: ac connected\n)); - sc-battery_state = ~APM_BATT_FLAG_CHARGING; + sc-battery_flags = ~APM_BATT_FLAG_CHARGING; sc-ac_state = APM_AC_ON; break; case CONFIG_HOOK_AC_UNKNOWN: @@ -374,21 +374,30 @@ sc = scx; + pinfo-nbattery = 0; + pinfo-batteryid = 0; + pinfo-minutes_valid = 0; + pinfo-minutes_left = 0; + pinfo-battery_state = APM_BATT_UNKNOWN; /* XXX: ignored */ + if (config_hook_call(CONFIG_HOOK_GET, CONFIG_HOOK_ACADAPTER, val) != -1) pinfo-ac_state = val; else pinfo-ac_state = sc-ac_state; + if (config_hook_call(CONFIG_HOOK_GET, CONFIG_HOOK_CHARGE, val) != -1) - pinfo-battery_state = val; + pinfo-battery_flags = val; else - pinfo-battery_state = sc-battery_state; + pinfo-battery_flags = sc-battery_flags; + if (config_hook_call(CONFIG_HOOK_GET, CONFIG_HOOK_BATTERYVAL, val) != -1) pinfo-battery_life = val; else pinfo-battery_life = sc-battery_life; + return (0); }
CVS commit: src/sys/dev/hpc/apm
Module Name:src Committed By: uwe Date: Mon Mar 30 06:22:25 UTC 2009 Modified Files: src/sys/dev/hpc/apm: apmdev.c apmvar.h Log Message: Split device_t and softc, use aprint_*, rename/reformat stuff to minimize diffs to dev/apm/apm.c (even at the cost of uglification). Tested on Jornada 690 (hpcsh). To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/hpc/apm/apmdev.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hpc/apm/apmvar.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/hpc/apm/apmdev.c diff -u src/sys/dev/hpc/apm/apmdev.c:1.19 src/sys/dev/hpc/apm/apmdev.c:1.20 --- src/sys/dev/hpc/apm/apmdev.c:1.19 Thu Jun 12 01:46:32 2008 +++ src/sys/dev/hpc/apm/apmdev.c Mon Mar 30 06:22:25 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: apmdev.c,v 1.19 2008/06/12 01:46:32 rafal Exp $ */ +/* $NetBSD: apmdev.c,v 1.20 2009/03/30 06:22:25 uwe Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: apmdev.c,v 1.19 2008/06/12 01:46:32 rafal Exp $); +__KERNEL_RCSID(0, $NetBSD: apmdev.c,v 1.20 2009/03/30 06:22:25 uwe Exp $); #ifdef _KERNEL_OPT #include opt_apmdev.h @@ -53,7 +53,6 @@ #include sys/kernel.h #include sys/proc.h #include sys/kthread.h -#include sys/mutex.h #include sys/user.h #include sys/malloc.h #include sys/device.h @@ -67,41 +66,37 @@ #include machine/stdarg.h -#if defined(APMDEBUG) -#define DPRINTF(f, x) do { if (apmdebug (f)) printf x; } while (0) +#ifdef APMDEBUG +#define DPRINTF(f, x) do { if (apmdebug (f)) printf x; } while (0) -#define APMDEBUG_INFO 0x01 -#define APMDEBUG_APMCALLS 0x02 -#define APMDEBUG_EVENTS 0x04 -#define APMDEBUG_PROBE 0x10 -#define APMDEBUG_ATTACH 0x40 -#define APMDEBUG_DEVICE 0x20 -#define APMDEBUG_ANOM 0x40 #ifdef APMDEBUG_VALUE int apmdebug = APMDEBUG_VALUE; #else int apmdebug = 0; -#endif +#endif /* APMDEBUG_VALUE */ + #else #define DPRINTF(f, x) /**/ -#endif +#endif /* APMDEBUG */ #define APM_NEVENTS 16 struct apm_softc { - struct device sc_dev; + device_t sc_dev; struct selinfo sc_rsel; struct selinfo sc_xsel; int sc_flags; - int event_count; - int event_ptr; + int sc_event_count; + int sc_event_ptr; int sc_power_state; lwp_t *sc_thread; - kmutex_t sc_mutex; - struct apm_event_info event_list[APM_NEVENTS]; - struct apm_accessops *ops; - void *cookie; + kmutex_t sc_lock; + struct apm_event_info sc_event_list[APM_NEVENTS]; + struct apm_accessops *sc_ops; + int sc_vers; + int sc_detail; + void *sc_cookie; }; #define SCFLAG_OREAD 0x001 #define SCFLAG_OWRITE 0x002 @@ -118,11 +113,13 @@ * APM module. This is both the APM thread itself, as well as * user context. */ -#define APM_LOCK(apmsc) mutex_enter((apmsc)-sc_mutex) -#define APM_UNLOCK(apmsc) mutex_exit((apmsc)-sc_mutex) +#define APM_LOCK(apmsc) \ + (void) mutex_enter((apmsc)-sc_lock) +#define APM_UNLOCK(apmsc) \ + (void) mutex_exit((apmsc)-sc_lock) -static void apmattach(struct device *, struct device *, void *); -static int apmmatch(struct device *, struct cfdata *, void *); +static void apmattach(device_t, device_t, void *); +static int apmmatch(device_t, cfdata_t, void *); static void apm_event_handle(struct apm_softc *, u_int, u_int); static void apm_periodic_check(struct apm_softc *); @@ -133,13 +130,13 @@ static void apm_power_print(struct apm_softc *, struct apm_power_info *); #endif static int apm_record_event(struct apm_softc *, u_int); -static void apm_set_ver(struct apm_softc *, u_long); +static void apm_set_ver(struct apm_softc *); static void apm_standby(struct apm_softc *); static const char *apm_strerror(int); static void apm_suspend(struct apm_softc *); static void apm_resume(struct apm_softc *, u_int, u_int); -CFATTACH_DECL(apmdev, sizeof(struct apm_softc), +CFATTACH_DECL_NEW(apmdev, sizeof(struct apm_softc), apmmatch, apmattach, NULL, NULL); extern struct cfdriver apmdev_cd; @@ -247,10 +244,11 @@ { if (pi-battery_life != APM_BATT_LIFE_UNKNOWN) { - printf(%s: battery life expectancy: %d%%\n, - device_xname(sc-sc_dev), pi-battery_life); + aprint_normal_dev(sc-sc_dev, + battery life expectancy: %d%%\n, + pi-battery_life); } - printf(%s: A/C state: , device_xname(sc-sc_dev)); + aprint_normal_dev(sc-sc_dev, A/C state: ); switch (pi-ac_state) { case APM_AC_OFF: printf(off\n); @@ -266,8 +264,8 @@ printf(unknown\n); break; } - if (apm_major == 1 apm_minor == 0) { - printf(%s: battery charge state:, device_xname(sc-sc_dev)); + aprint_normal_dev(sc-sc_dev, battery charge state:); + if (apm_minver == 0) switch (pi-battery_state) { case APM_BATT_HIGH: printf(high\n); @@ -288,22 +286,26 @@ printf(undecoded state %x\n, pi-battery_state); break; } - } else { - if (pi-battery_stateAPM_BATT_FLAG_CHARGING) - printf(charging ); + else if