CVS commit: src/sys/arch/arm/pic
Module Name:src Committed By: msaitoh Date: Tue Oct 30 07:42:38 UTC 2012 Modified Files: src/sys/arch/arm/pic: pic.c Log Message: Fix a bug that incorrect arg is passed to pic_block_irqs() on disestablish. Fixes PR#45371 by Yuichiro Goto. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/pic/pic.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/arm/pic/pic.c diff -u src/sys/arch/arm/pic/pic.c:1.14 src/sys/arch/arm/pic/pic.c:1.15 --- src/sys/arch/arm/pic/pic.c:1.14 Sat Sep 1 01:44:16 2012 +++ src/sys/arch/arm/pic/pic.c Tue Oct 30 07:42:35 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pic.c,v 1.14 2012/09/01 01:44:16 matt Exp $ */ +/* $NetBSD: pic.c,v 1.15 2012/10/30 07:42:35 msaitoh Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pic.c,v 1.14 2012/09/01 01:44:16 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: pic.c,v 1.15 2012/10/30 07:42:35 msaitoh Exp $); #define _INTR_PRIVATE #include sys/param.h @@ -684,7 +684,7 @@ pic_disestablish_source(struct intrsourc KASSERT(is == pic-pic_sources[irq]); - (*pic-pic_ops-pic_block_irqs)(pic, irq ~31, __BIT(irq)); + (*pic-pic_ops-pic_block_irqs)(pic, irq ~0x1f, __BIT(irq 0x1f)); pic-pic_sources[irq] = NULL; pic__iplsources[pic_ipl_offset[is-is_ipl] + is-is_iplidx] = NULL; /*
CVS commit: src/common/lib/libc/arch/arm/gen
Module Name:src Committed By: christos Date: Tue Oct 30 12:42:14 UTC 2012 Modified Files: src/common/lib/libc/arch/arm/gen: divsi3.S Added Files: src/common/lib/libc/arch/arm/gen: divide.S udivsi3.S Log Message: split udivsi3 and divsi3 to fix static linking. This could be done better. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/arm/gen/divide.S \ src/common/lib/libc/arch/arm/gen/udivsi3.S cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/gen/divsi3.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/arch/arm/gen/divsi3.S diff -u src/common/lib/libc/arch/arm/gen/divsi3.S:1.3 src/common/lib/libc/arch/arm/gen/divsi3.S:1.4 --- src/common/lib/libc/arch/arm/gen/divsi3.S:1.3 Tue Oct 9 22:16:54 2012 +++ src/common/lib/libc/arch/arm/gen/divsi3.S Tue Oct 30 08:42:13 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: divsi3.S,v 1.3 2012/10/10 02:16:54 christos Exp $ */ +/* $NetBSD: divsi3.S,v 1.4 2012/10/30 12:42:13 christos Exp $ */ /* * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND @@ -16,359 +16,7 @@ #include machine/asm.h -/* - * stack is aligned as there's a possibility of branching to .L_overflow - * which makes a C call - */ - -.L_overflow: -#if !defined(_KERNEL) !defined(_STANDALONE) - mov r0, #8 /* SIGFPE */ - bl PIC_SYM(_C_LABEL(raise), PLT) /* raise it */ - mov r0, #0 -#else - /* XXX should cause a fatal error */ - mvn r0, #0 -#endif - RET - -ENTRY_NP(__aeabi_uidivmod) -ENTRY_NP(__aeabi_uidiv) -ENTRY(__udivsi3) -.L_udivide:/* r0 = r0 / r1; r1 = r0 % r1 */ - eor r0, r1, r0 - eor r1, r0, r1 - eor r0, r1, r0 - /* r0 = r1 / r0; r1 = r1 % r0 */ - cmp r0, #1 - bcc .L_overflow - beq .L_divide_l0 - mov ip, #0 - movs r1, r1 - bpl .L_divide_l1 - orr ip, ip, #0x2000 /* ip bit 0x2000 = -ve r1 */ - movs r1, r1, lsr #1 - orrcs ip, ip, #0x1000 /* ip bit 0x1000 = bit 0 of r1 */ - b .L_divide_l1 - -.L_divide_l0:/* r0 == 1 */ - mov r0, r1 - mov r1, #0 - RET - ENTRY_NP(__aeabi_idivmod) ENTRY_NP(__aeabi_idiv) ENTRY(__divsi3) -.L_divide:/* r0 = r0 / r1; r1 = r0 % r1 */ - eor r0, r1, r0 - eor r1, r0, r1 - eor r0, r1, r0 - /* r0 = r1 / r0; r1 = r1 % r0 */ - cmp r0, #1 - bcc .L_overflow - beq .L_divide_l0 - ands ip, r0, #0x8000 - rsbmi r0, r0, #0 - ands r2, r1, #0x8000 - eor ip, ip, r2 - rsbmi r1, r1, #0 - orr ip, r2, ip, lsr #1 /* ip bit 0x4000 = -ve division */ - /* ip bit 0x8000 = -ve remainder */ - -.L_divide_l1: - mov r2, #1 - mov r3, #0 - - /* - * If the highest bit of the dividend is set, we have to be - * careful when shifting the divisor. Test this. - */ - movs r1,r1 - bpl .L_old_code - - /* - * At this point, the highest bit of r1 is known to be set. - * We abuse this below in the tst instructions. - */ - tst r1, r0 /*, lsl #0 */ - bmi .L_divide_b1 - tst r1, r0, lsl #1 - bmi .L_divide_b2 - tst r1, r0, lsl #2 - bmi .L_divide_b3 - tst r1, r0, lsl #3 - bmi .L_divide_b4 - tst r1, r0, lsl #4 - bmi .L_divide_b5 - tst r1, r0, lsl #5 - bmi .L_divide_b6 - tst r1, r0, lsl #6 - bmi .L_divide_b7 - tst r1, r0, lsl #7 - bmi .L_divide_b8 - tst r1, r0, lsl #8 - bmi .L_divide_b9 - tst r1, r0, lsl #9 - bmi .L_divide_b10 - tst r1, r0, lsl #10 - bmi .L_divide_b11 - tst r1, r0, lsl #11 - bmi .L_divide_b12 - tst r1, r0, lsl #12 - bmi .L_divide_b13 - tst r1, r0, lsl #13 - bmi .L_divide_b14 - tst r1, r0, lsl #14 - bmi .L_divide_b15 - tst r1, r0, lsl #15 - bmi .L_divide_b16 - tst r1, r0, lsl #16 - bmi .L_divide_b17 - tst r1, r0, lsl #17 - bmi .L_divide_b18 - tst r1, r0, lsl #18 - bmi .L_divide_b19 - tst r1, r0, lsl #19 - bmi .L_divide_b20 - tst r1, r0, lsl #20 - bmi .L_divide_b21 - tst r1, r0, lsl #21 - bmi .L_divide_b22 - tst r1, r0, lsl #22 - bmi .L_divide_b23 - tst r1, r0, lsl #23 - bmi .L_divide_b24 - tst r1, r0, lsl #24 - bmi .L_divide_b25 - tst r1, r0, lsl #25 - bmi .L_divide_b26 - tst r1, r0, lsl #26 - bmi .L_divide_b27 - tst r1, r0, lsl #27 - bmi .L_divide_b28 - tst r1, r0, lsl #28 - bmi .L_divide_b29 - tst r1, r0, lsl #29 - bmi .L_divide_b30 - tst r1, r0, lsl #30 - bmi .L_divide_b31 -/* - * instead of: - * tst r1, r0, lsl #31 - * bmi .L_divide_b32 - */ - b .L_divide_b32 - -.L_old_code: - cmp r1, r0 - bcc .L_divide_b0 - cmp r1, r0, lsl #1 - bcc .L_divide_b1 - cmp r1, r0, lsl #2 - bcc .L_divide_b2 - cmp r1, r0, lsl #3 - bcc .L_divide_b3 - cmp r1, r0, lsl #4 - bcc .L_divide_b4 - cmp r1, r0, lsl #5 - bcc .L_divide_b5 - cmp r1, r0, lsl #6 - bcc .L_divide_b6 - cmp r1, r0, lsl #7 - bcc .L_divide_b7 - cmp r1, r0, lsl #8 - bcc .L_divide_b8 - cmp r1, r0, lsl #9 - bcc .L_divide_b9 - cmp r1, r0, lsl #10 - bcc .L_divide_b10 - cmp r1, r0, lsl #11 - bcc .L_divide_b11 - cmp r1, r0, lsl #12 - bcc .L_divide_b12 - cmp r1, r0, lsl #13 - bcc .L_divide_b13 - cmp r1, r0, lsl #14 - bcc .L_divide_b14 - cmp r1, r0, lsl #15 - bcc .L_divide_b15 - cmp r1, r0,
CVS commit: src/lib/libc/arch/arm/gen
Module Name:src Committed By: christos Date: Tue Oct 30 12:42:37 UTC 2012 Modified Files: src/lib/libc/arch/arm/gen: Makefile.inc Log Message: add new files to fix static linking To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/lib/libc/arch/arm/gen/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/arm/gen/Makefile.inc diff -u src/lib/libc/arch/arm/gen/Makefile.inc:1.19 src/lib/libc/arch/arm/gen/Makefile.inc:1.20 --- src/lib/libc/arch/arm/gen/Makefile.inc:1.19 Tue Oct 9 22:15:03 2012 +++ src/lib/libc/arch/arm/gen/Makefile.inc Tue Oct 30 08:42:37 2012 @@ -1,7 +1,7 @@ -# $NetBSD: Makefile.inc,v 1.19 2012/10/10 02:15:03 christos Exp $ +# $NetBSD: Makefile.inc,v 1.20 2012/10/30 12:42:37 christos Exp $ SRCS+= alloca.S byte_swap_2.S byte_swap_4.S bswap64.c divsi3.S \ - fabs.c flt_rounds.c modsi3.S umodsi3.S + fabs.c flt_rounds.c modsi3.S umodsi3.S divide.S divsi3.S udivsi3.S # Common ieee754 constants and functions SRCS+= infinityf_ieee754.c infinity_ieee754.c infinityl_dbl_ieee754.c
CVS commit: src/sys/lib/libkern/arch/arm
Module Name:src Committed By: christos Date: Tue Oct 30 16:36:03 UTC 2012 Modified Files: src/sys/lib/libkern/arch/arm: Makefile.inc Log Message: add new divsi3 related files. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/lib/libkern/arch/arm/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/lib/libkern/arch/arm/Makefile.inc diff -u src/sys/lib/libkern/arch/arm/Makefile.inc:1.11 src/sys/lib/libkern/arch/arm/Makefile.inc:1.12 --- src/sys/lib/libkern/arch/arm/Makefile.inc:1.11 Tue Oct 9 22:15:31 2012 +++ src/sys/lib/libkern/arch/arm/Makefile.inc Tue Oct 30 12:36:03 2012 @@ -1,8 +1,8 @@ -# $NetBSD: Makefile.inc,v 1.11 2012/10/10 02:15:31 christos Exp $ +# $NetBSD: Makefile.inc,v 1.12 2012/10/30 16:36:03 christos Exp $ SRCS+= byte_swap_2.S byte_swap_4.S SRCS+= ffs.S -SRCS+= divsi3.S clzsi2.S modsi3.S umodsi3.S +SRCS+= divsi3.S udivsi3.S divide.S clzsi2.S modsi3.S umodsi3.S SRCS+= memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S .if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: skrll Date: Tue Oct 30 17:26:29 UTC 2012 Modified Files: src/sys/arch/evbarm/conf: RPI Log Message: Comment out VERBOSE_INIT_ARM by default To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/conf/RPI 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/evbarm/conf/RPI diff -u src/sys/arch/evbarm/conf/RPI:1.10 src/sys/arch/evbarm/conf/RPI:1.11 --- src/sys/arch/evbarm/conf/RPI:1.10 Wed Oct 17 14:49:40 2012 +++ src/sys/arch/evbarm/conf/RPI Tue Oct 30 17:26:29 2012 @@ -1,5 +1,5 @@ # -# $NetBSD: RPI,v 1.10 2012/10/17 14:49:40 apb Exp $ +# $NetBSD: RPI,v 1.11 2012/10/30 17:26:29 skrll Exp $ # # RPi -- Raspberry Pi # @@ -138,7 +138,7 @@ options DIAGNOSTIC # internally consist options DEBUG #options LOCKDEBUG #options IPKDB # remote kernel debugging -options VERBOSE_INIT_ARM # verbose bootstraping messages +#options VERBOSE_INIT_ARM # verbose bootstraping messages options DDB # in-kernel debugger options DDB_ONPANIC=1 options DDB_HISTORY_SIZE=100 # Enable history editing in DDB
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Tue Oct 30 20:02:16 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Make rpi_bootparams static To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbarm/rpi/rpi_machdep.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/evbarm/rpi/rpi_machdep.c diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.16 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.17 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.16 Fri Oct 26 10:03:13 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Tue Oct 30 20:02:15 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.16 2012/10/26 10:03:13 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.17 2012/10/30 20:02:15 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rpi_machdep.c,v 1.16 2012/10/26 10:03:13 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: rpi_machdep.c,v 1.17 2012/10/30 20:02:15 skrll Exp $); #include opt_evbarm_boardtype.h @@ -74,7 +74,7 @@ BootConfig bootconfig; /* Boot config s static char bootargs[MAX_BOOT_STRING]; char *boot_args = NULL; -void rpi_bootparams(void); +static void rpi_bootparams(void); /* * Macros to translate between physical and virtual for a subset of the @@ -186,7 +186,7 @@ static struct { } }; -void +static void rpi_bootparams(void) { bus_space_tag_t iot = bcm2835_bs_tag;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Tue Oct 30 20:11:37 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: Add VCPROPTAG_[GS]ET_CLOCK{R,ST}ATE To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/rpi/vcprop.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/arch/evbarm/rpi/vcprop.h diff -u src/sys/arch/evbarm/rpi/vcprop.h:1.1 src/sys/arch/evbarm/rpi/vcprop.h:1.2 --- src/sys/arch/evbarm/rpi/vcprop.h:1.1 Sun Oct 14 16:16:52 2012 +++ src/sys/arch/evbarm/rpi/vcprop.h Tue Oct 30 20:11:37 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.1 2012/10/14 16:16:52 skrll Exp $ */ +/* $NetBSD: vcprop.h,v 1.2 2012/10/30 20:11:37 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -47,6 +47,11 @@ struct vcprop_tag { #define VCPROPTAG_GET_ARMMEMORY 0x00010005 #define VCPROPTAG_GET_VCMEMORY 0x00010006 #define VCPROPTAG_GET_CLOCKS 0x00010007 + +#define VCPROPTAG_GET_CLOCKSTATE 0x00030001 +#define VCPROPTAG_SET_CLOCKSTATE 0x00038001 +#define VCPROPTAG_GET_CLOCKRATE 0x00030002 +#define VCPROPTAG_SET_CLOCKRATE 0x00038002 #define VCPROPTAG_GET_CMDLINE 0x00050001 #define VCPROPTAG_GET_DMACHAN 0x00060001 @@ -95,6 +100,18 @@ struct vcprop_tag_boardserial { uint64_t sn; }; + +#define VCPROP_CLK_EMMC 1 +#define VCPROP_CLK_UART 2 +#define VCPROP_CLK_ARM 3 +#define VCPROP_CLK_CORE 4 +#define VCPROP_CLK_V3D 5 +#define VCPROP_CLK_H264 6 +#define VCPROP_CLK_ISP 7 +#define VCPROP_CLK_SDRAM 8 +#define VCPROP_CLK_PIXEL 9 +#define VCPROP_CLK_PWM 10 + struct vcprop_clock { uint32_t pclk; uint32_t cclk; @@ -117,6 +134,18 @@ struct vcprop_tag_dmachan { uint32_t mask; }; +struct vcprop_tag_clockstate { + struct vcprop_tag tag; + uint32_t id; + uint32_t state; +}; + +struct vcprop_tag_clockrate { + struct vcprop_tag tag; + uint32_t id; + uint32_t rate; +}; + struct vcprop_buffer_hdr { uint32_t vpb_len; uint32_t vpb_rcode;
CVS commit: src/sys/arch
Module Name:src Committed By: skrll Date: Tue Oct 30 20:14:22 UTC 2012 Modified Files: src/sys/arch/arm/broadcom: bcm2835_emmc.c src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Query the EMMC clock rate and use it if it's available. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/broadcom/bcm2835_emmc.c cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/rpi/rpi_machdep.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/arm/broadcom/bcm2835_emmc.c diff -u src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.1 src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.2 --- src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.1 Thu Jul 26 06:21:57 2012 +++ src/sys/arch/arm/broadcom/bcm2835_emmc.c Tue Oct 30 20:14:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_emmc.c,v 1.1 2012/07/26 06:21:57 skrll Exp $ */ +/* $NetBSD: bcm2835_emmc.c,v 1.2 2012/10/30 20:14:22 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: bcm2835_emmc.c,v 1.1 2012/07/26 06:21:57 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: bcm2835_emmc.c,v 1.2 2012/10/30 20:14:22 skrll Exp $); #include sys/param.h #include sys/systm.h @@ -77,7 +77,9 @@ static void bcmemmc_attach(device_t parent, device_t self, void *aux) { struct bcmemmc_softc *sc = device_private(self); + prop_dictionary_t dict = device_properties(self); struct amba_attach_args *aaa = aux; + prop_number_t frequency; int error; sc-sc.sc_dev = self; @@ -88,9 +90,15 @@ bcmemmc_attach(device_t parent, device_t sc-sc.sc_flags |= SDHC_FLAG_HOSTCAPS; sc-sc.sc_caps = SDHC_VOLTAGE_SUPP_3_3V; sc-sc.sc_host = sc-sc_hosts; - sc-sc.sc_clkbase = 5; /* 50MHz */ + sc-sc.sc_clkbase = 5; /* Default to 50MHz */ sc-sc_iot = aaa-aaa_iot; +/* Fetch the EMMC clock frequency from property if set. */ +frequency = prop_dictionary_get(dict, frequency); +if (frequency != NULL) { + sc-sc.sc_clkbase = prop_number_integer_value(frequency) / 1000; + } + error = bus_space_map(sc-sc_iot, aaa-aaa_addr, aaa-aaa_size, 0, sc-sc_ioh); if (error) { Index: src/sys/arch/evbarm/rpi/rpi_machdep.c diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.17 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.18 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.17 Tue Oct 30 20:02:15 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Tue Oct 30 20:14:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.17 2012/10/30 20:02:15 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.18 2012/10/30 20:14:22 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: rpi_machdep.c,v 1.17 2012/10/30 20:02:15 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: rpi_machdep.c,v 1.18 2012/10/30 20:14:22 skrll Exp $); #include opt_evbarm_boardtype.h @@ -39,12 +39,15 @@ __KERNEL_RCSID(0, $NetBSD: rpi_machdep. #include sys/termios.h #include sys/bus.h +#include prop/proplib.h + #include dev/cons.h #include uvm/uvm_extern.h #include arm/arm32/machdep.h +#include machine/autoconf.h #include machine/vmparam.h #include machine/bootconfig.h #include machine/pmap.h @@ -75,6 +78,7 @@ static char bootargs[MAX_BOOT_STRING]; char *boot_args = NULL; static void rpi_bootparams(void); +static void rpi_device_register(device_t, void *); /* * Macros to translate between physical and virtual for a subset of the @@ -125,6 +129,7 @@ static struct { struct vcprop_tag_memory vbt_memory; struct vcprop_tag_boardserial vbt_serial; struct vcprop_tag_cmdline vbt_cmdline; + struct vcprop_tag_clockrate vbt_emmcclockrate; struct vcprop_tag end; } vb __packed __aligned(16) = { @@ -181,6 +186,14 @@ static struct { .vpt_rcode = VCPROPTAG_REQUEST }, }, + .vbt_emmcclockrate = { + .tag = { + .vpt_tag = VCPROPTAG_GET_CLOCKRATE, + .vpt_len = VCPROPTAG_LEN(vb.vbt_emmcclockrate), + .vpt_rcode = VCPROPTAG_REQUEST + }, + .id = VCPROP_CLK_EMMC + }, .end = { .vpt_tag = VCPROPTAG_NULL } @@ -344,6 +357,9 @@ initarm(void *arg) boothowto |= BOOTHOWTO; #endif + /* we've a specific device_register routine */ + evbarm_device_register = rpi_device_register; + return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0); } @@ -377,3 +393,15 @@ consinit(void) #endif } + +static void +rpi_device_register(device_t dev, void *aux) +{ + prop_dictionary_t dict = device_properties(dev); + + if (device_is_a(dev, sdhc) + vcprop_tag_success_p(vb.vbt_emmcclockrate.tag)) { + prop_dictionary_set_uint32(dict, + frequency, vb.vbt_emmcclockrate.rate); + } +}
CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: skrll Date: Tue Oct 30 20:20:45 UTC 2012 Modified Files: src/sys/arch/arm/broadcom: bcm2835_emmc.c Log Message: Whitespace. *sigh* To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_emmc.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/arm/broadcom/bcm2835_emmc.c diff -u src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.2 src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.3 --- src/sys/arch/arm/broadcom/bcm2835_emmc.c:1.2 Tue Oct 30 20:14:22 2012 +++ src/sys/arch/arm/broadcom/bcm2835_emmc.c Tue Oct 30 20:20:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_emmc.c,v 1.2 2012/10/30 20:14:22 skrll Exp $ */ +/* $NetBSD: bcm2835_emmc.c,v 1.3 2012/10/30 20:20:45 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: bcm2835_emmc.c,v 1.2 2012/10/30 20:14:22 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: bcm2835_emmc.c,v 1.3 2012/10/30 20:20:45 skrll Exp $); #include sys/param.h #include sys/systm.h @@ -93,9 +93,9 @@ bcmemmc_attach(device_t parent, device_t sc-sc.sc_clkbase = 5; /* Default to 50MHz */ sc-sc_iot = aaa-aaa_iot; -/* Fetch the EMMC clock frequency from property if set. */ -frequency = prop_dictionary_get(dict, frequency); -if (frequency != NULL) { + /* Fetch the EMMC clock frequency from property if set. */ + frequency = prop_dictionary_get(dict, frequency); + if (frequency != NULL) { sc-sc.sc_clkbase = prop_number_integer_value(frequency) / 1000; } @@ -115,7 +115,7 @@ bcmemmc_attach(device_t parent, device_t if (sc-sc_ih == NULL) { aprint_error_dev(self, failed to establish interrupt %d\n, - aaa-aaa_intr); + aaa-aaa_intr); goto fail; } aprint_normal_dev(self, interrupting on intr %d\n, aaa-aaa_intr);
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: rkujawa Date: Tue Oct 30 21:24:26 UTC 2012 Modified Files: src/usr.sbin/syslogd: syslogd.8 Log Message: Note enchancements that appeared in NetBSD 6.0. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/syslogd/syslogd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/syslogd.8 diff -u src/usr.sbin/syslogd/syslogd.8:1.51 src/usr.sbin/syslogd/syslogd.8:1.52 --- src/usr.sbin/syslogd/syslogd.8:1.51 Sun Apr 8 22:00:41 2012 +++ src/usr.sbin/syslogd/syslogd.8 Tue Oct 30 21:24:26 2012 @@ -1,4 +1,4 @@ -.\ $NetBSD: syslogd.8,v 1.51 2012/04/08 22:00:41 wiz Exp $ +.\ $NetBSD: syslogd.8,v 1.52 2012/10/30 21:24:26 rkujawa Exp $ .\ .\ Copyright (c) 1983, 1986, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -267,3 +267,6 @@ Support for multiple log sockets appeare .Nx 1.4 . libwrap support appeared in .Nx 1.6 . +Support for RFC 5424, TLS encryption and authentication, signed messages +appeared in +.Nx 6.0 .
CVS commit: src/sys/dev/nand
Module Name:src Committed By: ahoka Date: Tue Oct 30 22:03:00 UTC 2012 Added Files: src/sys/dev/nand: nand_samsung.c Log Message: Add support for samsung devices, currently a draft to aid Kirkwood NAND driver development. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/nand/nand_samsung.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/dev/nand/nand_samsung.c diff -u /dev/null src/sys/dev/nand/nand_samsung.c:1.1 --- /dev/null Tue Oct 30 22:03:00 2012 +++ src/sys/dev/nand/nand_samsung.c Tue Oct 30 22:03:00 2012 @@ -0,0 +1,135 @@ +/* $NetBSD: nand_samsung.c,v 1.1 2012/10/30 22:03:00 ahoka Exp $ */ + +/*- + * Copyright (c) 2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Adam Hoka. + * + * 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 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Device specific functions for legacy Samsung NAND chips + * + * Currently supported: + * K9XXG08UXA + */ + +#include sys/cdefs.h +__KERNEL_RCSID(0, $NetBSD: nand_samsung.c,v 1.1 2012/10/30 22:03:00 ahoka Exp $); + +#include nand.h +#include onfi.h + +int +nand_read_parameters_samsung(device_t self, struct nand_chip * const chip) +{ + uint8_t mfgrid; + uint8_t devid; + uint8_t dontcare1; + uint8_t dontcare2; + uint8_t params2; + + /* Only for Samsung devices, obviously */ + if (chip-nc_manf_id != NAND_MFR_SAMSUNG) { + return 1; + } + + nand_select(self, true); + nand_command(self, ONFI_READ_ID); + nand_address(self, 0x00); + nand_read_1(self, mfgrid); + nand_read_1(self, devid); + nand_read_1(self, params1); + nand_read_1(self, params2); + nand_read_1(self, params3); + nand_select(self, false); + + enum { + NAND_SAMSUNG_PAGEMASK = 0x3, + NAND_SAMSUNG_BLOCKMASK = 0x3 4, + NAND_SAMSUNG_SPAREMASK = 0x1 2, + NAND_SAMSUNG_BITSMASK = 0x1 6 + }; + + /* K9XXG08UXA */ + if (devid == 0xdc) { + switch (params2 NAND_SAMSUNG_PAGEMASK) { + case 0x0: + chip-nc_page_size = 1024; + break; + case 0x1: + chip-nc_page_size = 2048; + break; + case 0x2: + chip-nc_page_size = 4096; + break; + case 0x3: + chip-nc_page_size = 8192; + break; + } + + switch ((params2 NAND_SAMSUNG_PAGEMASK) 4) { + case 0x0: + chip-nc_block_size = 64 * 1024; + break; + case 0x0: + chip-nc_block_size = 128 * 1024; + break; + case 0x0: + chip-nc_block_size = 256 * 1024; + break; + case 0x0: + chip-nc_block_size = 512 * 1024; + break; + } + + /* 8/16 bytes per 512 bytes! XXX do i get this right? */ + switch ((params2 NAND_SAMSUNG_SPAREMASK) 2) { + case 0x0: + chip-nc_spare_size = 8 * chip-nc_page_size / 512; + break; + case 0x1: + chip-nc_spare_size = 16 * chip-nc_page_size / 512; + break; + } + + switch ((params2 NAND_SAMSUNG_BITSMASK) 6) { + case 0x0: + /* its an 8bit chip */ + break; + case 0x1: + chip-nc_flags |= NC_BUSWIDTH_16; + break; + } + + // TODO make this nice like the above + chip-nc_size = (((params3 4) 0x7) + 1) * 64 * 1024 * 1024; + } else { + return 1; + } + + return 0; +} +
CVS commit: src/share/man/man4/man4.amiga
Module Name:src Committed By: rkujawa Date: Tue Oct 30 22:29:01 UTC 2012 Modified Files: src/share/man/man4/man4.amiga: ed.4 Log Message: Note that driver was rewritten. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/man4.amiga/ed.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/man4.amiga/ed.4 diff -u src/share/man/man4/man4.amiga/ed.4:1.13 src/share/man/man4/man4.amiga/ed.4:1.14 --- src/share/man/man4/man4.amiga/ed.4:1.13 Sat Jul 26 20:17:33 2003 +++ src/share/man/man4/man4.amiga/ed.4 Tue Oct 30 22:29:01 2012 @@ -1,4 +1,4 @@ -.\ $NetBSD: ed.4,v 1.13 2003/07/26 20:17:33 salo Exp $ +.\ $NetBSD: ed.4,v 1.14 2012/10/30 22:29:01 rkujawa Exp $ .\ .\ Copyright (c) 1994 Christopher G. Demetriou .\ All rights reserved. @@ -32,7 +32,7 @@ .\ .\ Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp .\ -.Dd August 30, 1994 +.Dd October 30, 2012 .Dt ED 4 amiga .Os .Sh NAME @@ -76,3 +76,5 @@ The .Nm interface first appeared in .Nx 1.0 . +It was rewritten by Frank Wille for +.Nx 7.0 .
CVS commit: src/sys/dev/nand
Module Name:src Committed By: riz Date: Tue Oct 30 22:43:36 UTC 2012 Modified Files: src/sys/dev/nand: nand_samsung.c Log Message: Make this compile. (Still untested) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/nand/nand_samsung.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/nand/nand_samsung.c diff -u src/sys/dev/nand/nand_samsung.c:1.1 src/sys/dev/nand/nand_samsung.c:1.2 --- src/sys/dev/nand/nand_samsung.c:1.1 Tue Oct 30 22:03:00 2012 +++ src/sys/dev/nand/nand_samsung.c Tue Oct 30 22:43:36 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: nand_samsung.c,v 1.1 2012/10/30 22:03:00 ahoka Exp $ */ +/* $NetBSD: nand_samsung.c,v 1.2 2012/10/30 22:43:36 riz Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: nand_samsung.c,v 1.1 2012/10/30 22:03:00 ahoka Exp $); +__KERNEL_RCSID(0, $NetBSD: nand_samsung.c,v 1.2 2012/10/30 22:43:36 riz Exp $); #include nand.h #include onfi.h @@ -47,9 +47,9 @@ nand_read_parameters_samsung(device_t se { uint8_t mfgrid; uint8_t devid; - uint8_t dontcare1; - uint8_t dontcare2; + uint8_t params1; uint8_t params2; + uint8_t params3; /* Only for Samsung devices, obviously */ if (chip-nc_manf_id != NAND_MFR_SAMSUNG) { @@ -94,13 +94,13 @@ nand_read_parameters_samsung(device_t se case 0x0: chip-nc_block_size = 64 * 1024; break; - case 0x0: + case 0x1: chip-nc_block_size = 128 * 1024; break; - case 0x0: + case 0x2: chip-nc_block_size = 256 * 1024; break; - case 0x0: + case 0x3: chip-nc_block_size = 512 * 1024; break; }
CVS commit: src/usr.sbin/syslogd
Module Name:src Committed By: wiz Date: Tue Oct 30 23:03:02 UTC 2012 Modified Files: src/usr.sbin/syslogd: syslogd.8 Log Message: Remove trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/syslogd/syslogd.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/syslogd/syslogd.8 diff -u src/usr.sbin/syslogd/syslogd.8:1.52 src/usr.sbin/syslogd/syslogd.8:1.53 --- src/usr.sbin/syslogd/syslogd.8:1.52 Tue Oct 30 21:24:26 2012 +++ src/usr.sbin/syslogd/syslogd.8 Tue Oct 30 23:03:02 2012 @@ -1,4 +1,4 @@ -.\ $NetBSD: syslogd.8,v 1.52 2012/10/30 21:24:26 rkujawa Exp $ +.\ $NetBSD: syslogd.8,v 1.53 2012/10/30 23:03:02 wiz Exp $ .\ .\ Copyright (c) 1983, 1986, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -267,6 +267,6 @@ Support for multiple log sockets appeare .Nx 1.4 . libwrap support appeared in .Nx 1.6 . -Support for RFC 5424, TLS encryption and authentication, signed messages +Support for RFC 5424, TLS encryption and authentication, signed messages appeared in .Nx 6.0 .
CVS commit: src/sys/dev/sysmon
Module Name:src Committed By: macallan Date: Wed Oct 31 05:42:48 UTC 2012 Modified Files: src/sys/dev/sysmon: sysmon_envsys_events.c Log Message: in sme_battery_check(): - don't assume that all batteries have exactly one ENVSYS_INDICATOR - check capacity and charge sensors for ENVSYS_SVALID before using them now this works on macppc To generate a diff of this commit: cvs rdiff -u -r1.105 -r1.106 src/sys/dev/sysmon/sysmon_envsys_events.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/sysmon/sysmon_envsys_events.c diff -u src/sys/dev/sysmon/sysmon_envsys_events.c:1.105 src/sys/dev/sysmon/sysmon_envsys_events.c:1.106 --- src/sys/dev/sysmon/sysmon_envsys_events.c:1.105 Thu Sep 6 12:21:40 2012 +++ src/sys/dev/sysmon/sysmon_envsys_events.c Wed Oct 31 05:42:47 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: sysmon_envsys_events.c,v 1.105 2012/09/06 12:21:40 pgoyette Exp $ */ +/* $NetBSD: sysmon_envsys_events.c,v 1.106 2012/10/31 05:42:47 macallan Exp $ */ /*- * Copyright (c) 2007, 2008 Juan Romero Pardines. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sysmon_envsys_events.c,v 1.105 2012/09/06 12:21:40 pgoyette Exp $); +__KERNEL_RCSID(0, $NetBSD: sysmon_envsys_events.c,v 1.106 2012/10/31 05:42:47 macallan Exp $); #include sys/param.h #include sys/types.h @@ -1027,6 +1027,7 @@ sme_acadapter_check(void) sensor = true; /* refresh current sensor */ sysmon_envsys_refresh_sensor(sme, edata); + if (edata-value_cur) return false; } @@ -1061,10 +1062,16 @@ sme_battery_check(void) continue; present = true; + + /* + * XXX + * this assumes that the first valid ENVSYS_INDICATOR is the + * presence indicator + */ TAILQ_FOREACH(edata, sme-sme_sensors_list, sensors_head) { - if (edata-units == ENVSYS_INDICATOR - !edata-value_cur) { -present = false; + if ((edata-units == ENVSYS_INDICATOR) + (edata-state == ENVSYS_SVALID)) { +present = edata-value_cur; break; } } @@ -1076,6 +1083,9 @@ sme_battery_check(void) batteriesfound++; batterycap = batterycharge = false; TAILQ_FOREACH(edata, sme-sme_sensors_list, sensors_head) { + /* no need to even look at sensors that aren't valid */ + if (edata-state != ENVSYS_SVALID) +continue; if (edata-units == ENVSYS_BATTERY_CAPACITY) { batterycap = true; if (!sme_battery_critical(edata))
CVS commit: src/sys/arch/macppc/dev
Module Name:src Committed By: macallan Date: Wed Oct 31 05:46:49 UTC 2012 Modified Files: src/sys/arch/macppc/dev: smartbat.c Log Message: implement limits and support event monitoring now emergency shutdown on low battery works To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/macppc/dev/smartbat.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/macppc/dev/smartbat.c diff -u src/sys/arch/macppc/dev/smartbat.c:1.12 src/sys/arch/macppc/dev/smartbat.c:1.13 --- src/sys/arch/macppc/dev/smartbat.c:1.12 Tue Sep 18 04:36:25 2012 +++ src/sys/arch/macppc/dev/smartbat.c Wed Oct 31 05:46:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: smartbat.c,v 1.12 2012/09/18 04:36:25 macallan Exp $ */ +/* $NetBSD: smartbat.c,v 1.13 2012/10/31 05:46:49 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: smartbat.c,v 1.12 2012/09/18 04:36:25 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: smartbat.c,v 1.13 2012/10/31 05:46:49 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -91,6 +91,8 @@ static void smartbat_attach(device_t, de static int smartbat_match(device_t, cfdata_t, void *); static void smartbat_setup_envsys(struct smartbat_softc *); static void smartbat_refresh(struct sysmon_envsys *, envsys_data_t *); +static void smartbat_get_limits(struct sysmon_envsys *, envsys_data_t *, +sysmon_envsys_lim_t *, uint32_t *); static void smartbat_refresh_ac(struct sysmon_envsys *, envsys_data_t *); static void smartbat_poll(void *); static int smartbat_update(struct smartbat_softc *, int); @@ -212,8 +214,14 @@ smartbat_setup_envsys(struct smartbat_so sc-sc_bat_sensor[BAT_CHARGING].value_cur = TRUE; sc-sc_bat_sensor[BAT_CHARGING].state = ENVSYS_SVALID; - for (i = 0; i BAT_NSENSORS; i++) { + for (i = 0; i BAT_NSENSORS; i++) sc-sc_bat_sensor[i].flags = ENVSYS_FMONNOTSUPP; + + sc-sc_bat_sensor[BAT_CHARGE].flags = + ENVSYS_FMONLIMITS | ENVSYS_FPERCENT | ENVSYS_FVALID_MAX; + sc-sc_bat_sensor[BAT_CHARGE_STATE].flags = ENVSYS_FMONSTCHANGED; + + for (i = 0; i BAT_NSENSORS; i++) { if (sysmon_envsys_sensor_attach(sc-sc_bat_sme, sc-sc_bat_sensor[i])) { sysmon_envsys_destroy(sc-sc_bat_sme); @@ -225,6 +233,8 @@ smartbat_setup_envsys(struct smartbat_so sc-sc_bat_sme-sme_cookie = sc; sc-sc_bat_sme-sme_refresh = smartbat_refresh; sc-sc_bat_sme-sme_class = SME_CLASS_BATTERY; + sc-sc_bat_sme-sme_flags = SME_POLL_ONLY | SME_INIT_REFRESH; + sc-sc_bat_sme-sme_get_limits = smartbat_get_limits; if (sysmon_envsys_register(sc-sc_bat_sme)) { aprint_error(%s: unable to register with sysmon\n, @@ -237,12 +247,14 @@ static void smartbat_refresh(struct sysmon_envsys *sme, envsys_data_t *edata) { struct smartbat_softc *sc = sme-sme_cookie; - int which = edata-sensor, present; + int which = edata-sensor, present, ch; smartbat_update(sc, 0); present = (sc-sc_flags PMU_PWR_BATT_PRESENT) != 0; + ch = sc-sc_charge * 100 / sc-sc_max_charge; if (present) { + edata-state = ENVSYS_SVALID; switch (which) { case BAT_PRESENT: edata-value_cur = present; @@ -258,6 +270,14 @@ smartbat_refresh(struct sysmon_envsys *s break; case BAT_CHARGE: edata-value_cur = sc-sc_charge * 1000; + edata-value_max = sc-sc_max_charge * 1000; + if (ch 6) { +edata-state = ENVSYS_SCRITICAL; + } else if (ch 11) { +edata-state = ENVSYS_SCRITUNDER; + } else if (ch 20) { +edata-state = ENVSYS_SWARNUNDER; + } break; case BAT_CHARGING: if ((sc-sc_flags PMU_PWR_BATT_CHARGING) @@ -268,17 +288,15 @@ smartbat_refresh(struct sysmon_envsys *s break; case BAT_CHARGE_STATE: { -int ch = sc-sc_charge * 100 / -sc-sc_max_charge; if (ch 6) { edata-value_cur = ENVSYS_BATTERY_CAPACITY_CRITICAL; -} else if (ch 11) { +} else if (ch 10) { edata-value_cur = - ENVSYS_BATTERY_CAPACITY_WARNING; + ENVSYS_BATTERY_CAPACITY_LOW; } else if (ch 20) { edata-value_cur = - ENVSYS_BATTERY_CAPACITY_LOW; + ENVSYS_BATTERY_CAPACITY_WARNING; } else { edata-value_cur = ENVSYS_BATTERY_CAPACITY_NORMAL; @@ -289,7 +307,6 @@ smartbat_refresh(struct sysmon_envsys *s edata-value_cur = (sc-sc_flags PMU_PWR_BATT_FULL); break; } - edata-state = ENVSYS_SVALID; } else { /* battery isn't there */ switch (which) { @@ -313,6 +330,21 @@ smartbat_refresh(struct sysmon_envsys *s } static void +smartbat_get_limits(struct sysmon_envsys *sme, envsys_data_t *edata, +sysmon_envsys_lim_t *limits, uint32_t *props) +{ + struct smartbat_softc *sc = sme-sme_cookie; + + if (edata-sensor != BAT_CHARGE) + return; + + limits-sel_critmin = sc-sc_max_charge * 1000 / 100 * 10; /* 20% */ + limits-sel_warnmin = sc-sc_max_charge * 1000 / 100 * 20; /* 10% */ + +