CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: mlelstv Date: Mon Mar 8 13:53:08 UTC 2021 Modified Files: src/sys/arch/evbarm/rpi: rpi_vcmbox.c vcprop.h vcprop_subr.c Log Message: Add some firmware support functions and define more properties - framebuffer - power management - vchiq init - RPI4 USB firmware support To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/rpi/rpi_vcmbox.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/rpi/vcprop.h cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/rpi/vcprop_subr.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_vcmbox.c diff -u src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.7 src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.8 --- src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.7 Tue Dec 1 04:14:31 2020 +++ src/sys/arch/evbarm/rpi/rpi_vcmbox.c Mon Mar 8 13:53:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_vcmbox.c,v 1.7 2020/12/01 04:14:31 rin Exp $ */ +/* $NetBSD: rpi_vcmbox.c,v 1.8 2021/03/08 13:53:08 mlelstv Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.7 2020/12/01 04:14:31 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.8 2021/03/08 13:53:08 mlelstv Exp $"); #include #include @@ -65,19 +65,8 @@ struct vcmbox_clockrate_request { #define RATE2MHZ(rate) ((rate) / 100) #define MHZ2RATE(mhz) ((mhz) * 100) -#define VCMBOX_INIT_REQUEST(req) \ - do {\ - memset(&(req), 0, sizeof((req))); \ - (req).vb_hdr.vpb_len = htole32(sizeof((req))); \ - (req).vb_hdr.vpb_rcode = htole32(VCPROP_PROCESS_REQUEST);\ - (req).end.vpt_tag = htole32(VCPROPTAG_NULL); \ - } while (0) -#define VCMBOX_INIT_TAG(s, t) \ - do {\ - (s).tag.vpt_tag = htole32(t);\ - (s).tag.vpt_rcode = htole32(VCPROPTAG_REQUEST); \ - (s).tag.vpt_len = htole32(VCPROPTAG_LEN(s)); \ - } while (0) +#define VCMBOX_INIT_REQUEST(r) VCPROP_INIT_REQUEST(r) +#define VCMBOX_INIT_TAG(s, t) VCPROP_INIT_TAG(s, t) struct vcmbox_softc { device_t sc_dev; Index: src/sys/arch/evbarm/rpi/vcprop.h diff -u src/sys/arch/evbarm/rpi/vcprop.h:1.19 src/sys/arch/evbarm/rpi/vcprop.h:1.20 --- src/sys/arch/evbarm/rpi/vcprop.h:1.19 Tue Dec 1 04:14:31 2020 +++ src/sys/arch/evbarm/rpi/vcprop.h Mon Mar 8 13:53:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.19 2020/12/01 04:14:31 rin Exp $ */ +/* $NetBSD: vcprop.h,v 1.20 2021/03/08 13:53:08 mlelstv Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -44,6 +44,8 @@ struct vcprop_tag { uint32_t vpt_tag; #define VCPROPTAG_NULL 0x #define VCPROPTAG_GET_FIRMWAREREV 0x0001 +#define VCPROPTAG_GET_FIRMWAREVARIANT 0x0002 +#define VCPROPTAG_GET_FIRMWAREHASH 0x0003 #define VCPROPTAG_GET_BOARDMODEL 0x00010001 #define VCPROPTAG_GET_BOARDREVISION 0x00010002 #define VCPROPTAG_GET_MACADDRESS 0x00010003 @@ -65,6 +67,11 @@ struct vcprop_tag { #define VCPROPTAG_GET_TURBO 0x00030009 #define VCPROPTAG_SET_TURBO 0x00038009 +#define VCPROPTAG_GET_STC 0x0003000b +#define VCPROPTAG_GET_THROTTLED 0x00030046 +#define VCPROPTAG_GET_CLOCK_MEASURED 0x00030047 +#define VCPROPTAG_NOTIFY_REBOOT 0x00030048 + #define VCPROPTAG_GET_VOLTAGE 0x00030003 #define VCPROPTAG_SET_VOLTAGE 0x00038003 #define VCPROPTAG_GET_MIN_VOLTAGE 0x00030008 @@ -73,24 +80,84 @@ struct vcprop_tag { #define VCPROPTAG_GET_TEMPERATURE 0x00030006 #define VCPROPTAG_GET_MAX_TEMPERATURE 0x0003000a +#define VCPROPTAG_GET_DOMAIN_STATE 0x00030030 +#define VCPROPTAG_SET_DOMAIN_STATE 0x00038030 + +#define VCPROPTAG_GET_GPIO_STATE 0x00030041 +#define VCPROPTAG_SET_GPIO_STATE 0x00038041 +#define VCPROPTAG_GET_GPIO_CONFIG 0x00030041 +#define VCPROPTAG_SET_GPIO_CONFIG 0x00038041 +#define VCPROPTAG_GET_PERIPH_REG 0x00030045 +#define VCPROPTAG_SET_PERIPH_REG 0x00038045 + +#define VCPROPTAG_GET_OTP 0x00030021 +#define VCPROPTAG_SET_OTP 0x00038021 + +#define VCPROPTAG_SET_SDHOST_CLOCK 0x00038042 + +#define VCPROPTAG_GET_POE_HAT_VAL 0x00030049 +#define VCPROPTAG_SET_POE_HAT_VAL 0x00030050 + +#define VCPROPTAG_NOTIFY_XHCI_RESET 0x00030058 + #define VCPROPTAG_GET_CMDLINE 0x00050001 #define VCPROPTAG_GET_DMACHAN 0x00060001 #define VCPROPTAG_ALLOCATE_BUFFER 0x00040001 +#define VCPROPTAG_RELEASE_BUFFER 0x00048001 #define VCPROPTAG_BLANK_SCREEN 0x00040002 #define VCPROPTAG_GET_FB_RES 0x00040003 +#define VCPROPTAG_TST_FB_RES 0x00044003 #define VCPROPTAG_SET_FB_RES 0x00048003 #define VCPROPTAG_GET_FB_VRES 0x00040004 +#define VCPROPTAG_TST_FB_VRES 0x00044004 #define VCPROPTAG_SET_FB_VRES 0x00048004 #define VCPROPTAG_GET_FB_DEPTH 0x00040005 +#define VCPROPTAG_TST_FB_DEPTH 0x00044005 #define VCPROPTAG_SET_FB_DEPTH 0x00048005 #define VCPROPTAG_GET_FB_PIXEL_ORDER 0x00040006 +#define VCPROPTAG_TST_FB_PIXEL_ORDER 0x00044006 #define VCPROPTAG_SET_FB_PIXEL_ORDER 0x00048006 #define VCPROPTAG_GET_FB_ALPHA_MODE 0x
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: rin Date: Mon Nov 23 06:39:54 UTC 2020 Modified Files: src/sys/arch/evbarm/rpi: vcprop_subr.c Log Message: Add missing __KERNEL_RCSID(). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/rpi/vcprop_subr.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/vcprop_subr.c diff -u src/sys/arch/evbarm/rpi/vcprop_subr.c:1.7 src/sys/arch/evbarm/rpi/vcprop_subr.c:1.8 --- src/sys/arch/evbarm/rpi/vcprop_subr.c:1.7 Mon Nov 23 06:29:54 2020 +++ src/sys/arch/evbarm/rpi/vcprop_subr.c Mon Nov 23 06:39:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop_subr.c,v 1.7 2020/11/23 06:29:54 rin Exp $ */ +/* $NetBSD: vcprop_subr.c,v 1.8 2020/11/23 06:39:54 rin Exp $ */ /* * Copyright (c) 2014 Michael Lorenz @@ -28,6 +28,8 @@ /* * Mailbox property interface wrapper functions */ +#include +__KERNEL_RCSID(0, "$NetBSD: vcprop_subr.c,v 1.8 2020/11/23 06:39:54 rin Exp $"); #include #include
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: rin Date: Mon Nov 23 06:29:54 UTC 2020 Modified Files: src/sys/arch/evbarm/rpi: rpi_vcmbox.c vcprop_subr.c Log Message: Sort headers. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/rpi/rpi_vcmbox.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/rpi/vcprop_subr.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_vcmbox.c diff -u src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.5 src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.6 --- src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.5 Sat Dec 8 06:53:11 2018 +++ src/sys/arch/evbarm/rpi/rpi_vcmbox.c Mon Nov 23 06:29:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_vcmbox.c,v 1.5 2018/12/08 06:53:11 mlelstv Exp $ */ +/* $NetBSD: rpi_vcmbox.c,v 1.6 2020/11/23 06:29:54 rin Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill @@ -31,15 +31,15 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.5 2018/12/08 06:53:11 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.6 2020/11/23 06:29:54 rin Exp $"); #include #include -#include -#include -#include #include +#include +#include #include +#include #include #include Index: src/sys/arch/evbarm/rpi/vcprop_subr.c diff -u src/sys/arch/evbarm/rpi/vcprop_subr.c:1.6 src/sys/arch/evbarm/rpi/vcprop_subr.c:1.7 --- src/sys/arch/evbarm/rpi/vcprop_subr.c:1.6 Sat Jul 4 15:14:56 2020 +++ src/sys/arch/evbarm/rpi/vcprop_subr.c Mon Nov 23 06:29:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop_subr.c,v 1.6 2020/07/04 15:14:56 skrll Exp $ */ +/* $NetBSD: vcprop_subr.c,v 1.7 2020/11/23 06:29:54 rin Exp $ */ /* * Copyright (c) 2014 Michael Lorenz @@ -30,8 +30,8 @@ */ #include -#include #include +#include #include
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: rin Date: Mon Nov 23 06:29:32 UTC 2020 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: Remove stray white space. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 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.17 src/sys/arch/evbarm/rpi/vcprop.h:1.18 --- src/sys/arch/evbarm/rpi/vcprop.h:1.17 Mon Dec 30 15:58:12 2019 +++ src/sys/arch/evbarm/rpi/vcprop.h Mon Nov 23 06:29:32 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.17 2019/12/30 15:58:12 skrll Exp $ */ +/* $NetBSD: vcprop.h,v 1.18 2020/11/23 06:29:32 rin Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -130,12 +130,12 @@ struct vcprop_tag_fwrev { struct vcprop_tag_boardmodel { struct vcprop_tag tag; uint32_t model; -} ; +}; struct vcprop_tag_boardrev { struct vcprop_tag tag; uint32_t rev; -} ; +}; #define VCPROP_REV_PCBREV __BITS(3,0) #define VCPROP_REV_MODEL __BITS(11,4)
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sat Jul 4 15:14:56 UTC 2020 Modified Files: src/sys/arch/evbarm/rpi: vcprop_subr.c Removed Files: src/sys/arch/evbarm/rpi: rpi.h Log Message: G/C To generate a diff of this commit: cvs rdiff -u -r1.5 -r0 src/sys/arch/evbarm/rpi/rpi.h cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/rpi/vcprop_subr.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/vcprop_subr.c diff -u src/sys/arch/evbarm/rpi/vcprop_subr.c:1.5 src/sys/arch/evbarm/rpi/vcprop_subr.c:1.6 --- src/sys/arch/evbarm/rpi/vcprop_subr.c:1.5 Mon Jan 1 17:03:25 2018 +++ src/sys/arch/evbarm/rpi/vcprop_subr.c Sat Jul 4 15:14:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop_subr.c,v 1.5 2018/01/01 17:03:25 skrll Exp $ */ +/* $NetBSD: vcprop_subr.c,v 1.6 2020/07/04 15:14:56 skrll Exp $ */ /* * Copyright (c) 2014 Michael Lorenz @@ -43,8 +43,6 @@ #include #include -#include - #include int
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Mon Dec 30 15:58:12 UTC 2019 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: Add emmc2 clock goop from mlelstv@ (missing commit) To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 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.16 src/sys/arch/evbarm/rpi/vcprop.h:1.17 --- src/sys/arch/evbarm/rpi/vcprop.h:1.16 Sat Jun 17 17:03:40 2017 +++ src/sys/arch/evbarm/rpi/vcprop.h Mon Dec 30 15:58:12 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.16 2017/06/17 17:03:40 jmcneill Exp $ */ +/* $NetBSD: vcprop.h,v 1.17 2019/12/30 15:58:12 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -179,6 +179,7 @@ struct vcprop_tag_boardserial { #define VCPROP_CLK_SDRAM 8 #define VCPROP_CLK_PIXEL 9 #define VCPROP_CLK_PWM 10 +#define VCPROP_CLK_EMMC2 12 struct vcprop_clock { uint32_t pclk;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: mlelstv Date: Sat Dec 8 06:53:11 UTC 2018 Modified Files: src/sys/arch/evbarm/rpi: rpi_vcmbox.c Log Message: Add machdep.cpu.frequency.available node to support estd. While the RPI can run at many intermediate clock frequencies, this is sufficient for estd and is known to work with every firmware revision. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/rpi/rpi_vcmbox.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_vcmbox.c diff -u src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.4 src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.5 --- src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.4 Sat Oct 4 13:18:34 2014 +++ src/sys/arch/evbarm/rpi/rpi_vcmbox.c Sat Dec 8 06:53:11 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_vcmbox.c,v 1.4 2014/10/04 13:18:34 mlelstv Exp $ */ +/* $NetBSD: rpi_vcmbox.c,v 1.5 2018/12/08 06:53:11 mlelstv Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.4 2014/10/04 13:18:34 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.5 2018/12/08 06:53:11 mlelstv Exp $"); #include #include @@ -233,6 +233,7 @@ vcmbox_cpufreq_init(struct vcmbox_softc { const struct sysctlnode *node, *cpunode, *freqnode; int error; + static char available[20]; error = vcmbox_read_clockrate(sc, VCPROPTAG_GET_MIN_CLOCKRATE, VCPROP_CLK_ARM, &sc->sc_cpu_minrate); @@ -297,6 +298,16 @@ vcmbox_cpufreq_init(struct vcmbox_softc goto sysctl_failed; sc->sc_node_max = node->sysctl_num; + snprintf(available, sizeof(available), "%" PRIu32 " %" PRIu32, + RATE2MHZ(sc->sc_cpu_minrate), RATE2MHZ(sc->sc_cpu_maxrate)); + + error = sysctl_createv(&sc->sc_log, 0, &freqnode, &node, + CTLFLAG_PERMANENT, CTLTYPE_STRING, "available", NULL, + NULL, 0, available, strlen(available), + CTL_CREATE, CTL_EOL); + if (error) + goto sysctl_failed; + return 0; sysctl_failed:
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Fri Aug 3 15:38:16 UTC 2018 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Subtract KERNEL_BASE_VOFFSET from all VAs to get PA. How did this work before? To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/rpi/rpi_start.S 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_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.18 src/sys/arch/evbarm/rpi/rpi_start.S:1.19 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.18 Wed Jun 27 11:12:15 2018 +++ src/sys/arch/evbarm/rpi/rpi_start.S Fri Aug 3 15:38:16 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.18 2018/06/27 11:12:15 ryo Exp $ */ +/* $NetBSD: rpi_start.S,v 1.19 2018/08/03 15:38:16 skrll Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -96,7 +96,7 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.18 2018/06/27 11:12:15 ryo Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.19 2018/08/03 15:38:16 skrll Exp $") #if defined(VERBOSE_INIT_ARM) @@ -141,16 +141,16 @@ _C_LABEL(rpi_start): #if defined(VERBOSE_INIT_ARM) /* stack for calling bcm2835_platform_early_putchar() */ ldr sp, Lbootstk -#if !defined(KERNEL_BASES_EQUAL) sub sp, sp, #KERNEL_BASE_VOFFSET -#endif #endif /* VERBOSE_INIT_ARM */ ldr r8, Luboot_args + sub r8, r8, #KERNEL_BASE_VOFFSET stmia r8!, {r0-r3} #ifdef FDT ldr r8, Lfdt_addr_r + sub r8, r8, #KERNEL_BASE_VOFFSET str r2, [r8] #endif mrs r0, cpsr
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: ryo Date: Wed Jun 27 11:05:38 UTC 2018 Modified Files: src/sys/arch/evbarm/rpi: rpi2_start.S Log Message: remove unnecessary code. .Lmmu_init_table is in same section, and also not r8. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/rpi/rpi2_start.S 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/rpi2_start.S diff -u src/sys/arch/evbarm/rpi/rpi2_start.S:1.5 src/sys/arch/evbarm/rpi/rpi2_start.S:1.6 --- src/sys/arch/evbarm/rpi/rpi2_start.S:1.5 Sat Mar 3 13:46:32 2018 +++ src/sys/arch/evbarm/rpi/rpi2_start.S Wed Jun 27 11:05:38 2018 @@ -39,7 +39,7 @@ #include "assym.h" -RCSID("$NetBSD: rpi2_start.S,v 1.5 2018/03/03 13:46:32 skrll Exp $") +RCSID("$NetBSD: rpi2_start.S,v 1.6 2018/06/27 11:05:38 ryo Exp $") #if defined(KERNEL_BASES_EQUAL) #define CALL(f) bl _C_LABEL(f) @@ -124,9 +124,6 @@ _C_LABEL(rpi_start): movt r0, #:upper16:TEMP_L1_TABLE movw r1, #:lower16:.Lmmu_init_table movt r1, #:upper16:.Lmmu_init_table -#if !defined(KERNEL_BASES_EQUAL) - sub r8, r8, #KERNEL_BASE_VOFFSET -#endif bl arm_boot_l1pt_init XPUTC(#'D')
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Mon Jan 1 17:03:25 UTC 2018 Modified Files: src/sys/arch/evbarm/rpi: vcprop_subr.c Log Message: Remove unnecessary #includE To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/rpi/vcprop_subr.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/vcprop_subr.c diff -u src/sys/arch/evbarm/rpi/vcprop_subr.c:1.4 src/sys/arch/evbarm/rpi/vcprop_subr.c:1.5 --- src/sys/arch/evbarm/rpi/vcprop_subr.c:1.4 Sun Dec 10 21:38:27 2017 +++ src/sys/arch/evbarm/rpi/vcprop_subr.c Mon Jan 1 17:03:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop_subr.c,v 1.4 2017/12/10 21:38:27 skrll Exp $ */ +/* $NetBSD: vcprop_subr.c,v 1.5 2018/01/01 17:03:25 skrll Exp $ */ /* * Copyright (c) 2014 Michael Lorenz @@ -35,8 +35,6 @@ #include -#include - #include #include #include
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Mon Jan 1 11:28:33 UTC 2018 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Need to map 512MB for some RPIs To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/rpi/rpi_start.S 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_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.15 src/sys/arch/evbarm/rpi/rpi_start.S:1.16 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.15 Sun Dec 10 21:38:27 2017 +++ src/sys/arch/evbarm/rpi/rpi_start.S Mon Jan 1 11:28:33 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.15 2017/12/10 21:38:27 skrll Exp $ */ +/* $NetBSD: rpi_start.S,v 1.16 2018/01/01 11:28:33 skrll Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -95,7 +95,7 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.15 2017/12/10 21:38:27 skrll Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.16 2018/01/01 11:28:33 skrll Exp $") #if defined(VERBOSE_INIT_ARM) @@ -353,10 +353,10 @@ Lctl_ID_dis: mmu_init_table: /* - * Map 256MB of VA==PA at 0x so we can keep the kernel going + * Map 512MB of VA==PA at 0x so we can keep the kernel going * and get access to the FDT the firmware loads */ - MMU_INIT(0x0, 0x0, 0x1000, L1_S_PROTO | L1_S_APv6_KRW) + MMU_INIT(0x0, 0x0, (512 * 1024 * 1204), L1_S_PROTO | L1_S_APv6_KRW) MMU_INIT(KERNEL_BASE, 0x0, (_end - KERNEL_BASE + 2 * L1_S_SIZE - 1),
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Thu Nov 9 21:39:48 UTC 2017 Modified Files: src/sys/arch/evbarm/rpi: vcprop_subr.c Log Message: Trailing whitespcae To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/rpi/vcprop_subr.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/vcprop_subr.c diff -u src/sys/arch/evbarm/rpi/vcprop_subr.c:1.2 src/sys/arch/evbarm/rpi/vcprop_subr.c:1.3 --- src/sys/arch/evbarm/rpi/vcprop_subr.c:1.2 Fri Oct 3 17:57:48 2014 +++ src/sys/arch/evbarm/rpi/vcprop_subr.c Thu Nov 9 21:39:48 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop_subr.c,v 1.2 2014/10/03 17:57:48 skrll Exp $ */ +/* $NetBSD: vcprop_subr.c,v 1.3 2017/11/09 21:39:48 skrll Exp $ */ /* * Copyright (c) 2014 Michael Lorenz @@ -28,7 +28,7 @@ /* * Mailbox property interface wrapper functions */ - + #include #include #include @@ -347,7 +347,7 @@ rpi_fb_initcursor(bus_addr_t pixels, int { int error; uint32_t res; - + struct __aligned(16) { struct vcprop_buffer_hdr vb_hdr;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Sat Nov 4 14:47:06 UTC 2017 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Firmware after May 8, 2017 places APs in WFE state at boot. Add a "sev" after writing the start vector, otherwise secondary CPUs will not boot. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 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.80 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.81 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.80 Wed Aug 16 20:54:19 2017 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sat Nov 4 14:47:06 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.80 2017/08/16 20:54:19 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.81 2017/11/04 14:47:06 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.80 2017/08/16 20:54:19 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.81 2017/11/04 14:47:06 jmcneill Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -660,6 +660,9 @@ rpi_bootstrap(void) } } + /* Wake up APs in case firmware has placed them in WFE state */ + __asm __volatile("sev"); + for (int loop = 0; loop < 16; loop++) { if (arm_cpu_hatched == __BITS(arm_cpu_max - 1, 1)) break;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Sat Aug 12 11:44:26 UTC 2017 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: For boards with bluetooth, use AUX UART for console and PLCOM for bt. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 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.78 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.79 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.78 Tue Aug 1 00:01:56 2017 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sat Aug 12 11:44:26 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.78 2017/08/01 00:01:56 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.79 2017/08/12 11:44:26 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.78 2017/08/01 00:01:56 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.79 2017/08/12 11:44:26 jmcneill Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include "bcmspi.h" #include "bsciic.h" #include "plcom.h" +#include "com.h" #include "genfb.h" #include "ukbd.h" @@ -97,6 +98,10 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include #endif +#if NCOM > 0 +#include +#endif + #if NGENFB > 0 #include #include @@ -182,6 +187,7 @@ static struct plcom_instance rpi_pi = { static struct __aligned(16) { struct vcprop_buffer_hdr vb_hdr; struct vcprop_tag_clockrate vbt_uartclockrate; + struct vcprop_tag_clockrate vbt_coreclockrate; struct vcprop_tag_boardrev vbt_boardrev; struct vcprop_tag end; } vb_uart = { @@ -197,6 +203,14 @@ static struct __aligned(16) { }, .id = VCPROP_CLK_UART }, + .vbt_coreclockrate = { + .tag = { + .vpt_tag = VCPROPTAG_GET_CLOCKRATE, + .vpt_len = VCPROPTAG_LEN(vb_uart.vbt_coreclockrate), + .vpt_rcode = VCPROPTAG_REQUEST + }, + .id = VCPROP_CLK_CORE + }, .vbt_boardrev = { .tag = { .vpt_tag = VCPROPTAG_GET_BOARDREVISION, @@ -466,9 +480,15 @@ rpi_uartinit(void) if (vcprop_tag_success_p(&vb_uart.vbt_boardrev.tag)) { if (rpi_rev_has_btwifi(vb_uart.vbt_boardrev.rev)) { +#if NCOM > 0 + /* Enable AUX UART on GPIO header */ + bcm2835gpio_function_select(14, BCM2835_GPIO_ALT5); + bcm2835gpio_function_select(15, BCM2835_GPIO_ALT5); +#else /* Enable UART0 (PL011) on GPIO header */ bcm2835gpio_function_select(14, BCM2835_GPIO_ALT0); bcm2835gpio_function_select(15, BCM2835_GPIO_ALT0); +#endif } } @@ -501,9 +521,15 @@ rpi_pinctrl(void) #endif if (rpi_rev_has_btwifi(vb.vbt_boardrev.rev)) { +#if NCOM > 0 + /* Enable UART0 (PL011) on BT */ + bcm2835gpio_function_select(32, BCM2835_GPIO_ALT3); + bcm2835gpio_function_select(33, BCM2835_GPIO_ALT3); +#else /* Enable AUX UART on BT */ bcm2835gpio_function_select(32, BCM2835_GPIO_ALT5); bcm2835gpio_function_select(33, BCM2835_GPIO_ALT5); +#endif bcm2835gpio_function_setpull(32, BCM2835_GPIO_GPPUD_PULLOFF); bcm2835gpio_function_setpull(33, BCM2835_GPIO_GPPUD_PULLUP); bcm2835gpio_function_select(43, BCM2835_GPIO_ALT0); @@ -814,16 +840,9 @@ initarm(void *arg) return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0); } -void -consinit(void) +static void +consinit_plcom(void) { - static int consinit_called = 0; - - if (consinit_called != 0) - return; - - consinit_called = 1; - #if (NPLCOM > 0 && defined(PLCONSOLE)) /* * Initialise the diagnostic serial console @@ -833,8 +852,48 @@ consinit(void) plcomcnattach(&rpi_pi, plcomcnspeed, uart_clk, plcomcnmode, PLCOMCNUNIT); +#endif +} + +static void +consinit_com(void) +{ +#if NCOM > 0 + bus_space_tag_t iot = &bcm2835_a4x_bs_tag; + const bus_addr_t addr = BCM2835_AUX_UART_BASE; + const int speed = B115200; + u_int freq = 0; + const u_int flags = TTYDEF_CFLAG; + + if (vcprop_tag_success_p(&vb_uart.vbt_coreclockrate.tag)) + freq = vb.vbt_coreclockrate.rate * 2; + + comcnattach(iot, addr, speed, freq, COM_TYPE_BCMAUXUART, flags); +#endif +} + +void +consinit(void) +{ + static int consinit_called = 0; + bool use_auxuart = false; + if (consinit_called != 0) + return; + + consinit_called = 1; + +#if NCOM > 0 + if (vcprop_tag_success_p(&vb_uart.vbt_boardrev.tag) && + rpi_rev_has_btwifi(vb_uart.vbt_boardrev.rev)) { + use_auxuart = true; + } #endif + + if (use_auxuart) + consinit_com(); + else + consinit_plcom(); } #ifdef KGDB
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Tue Aug 1 00:01:56 UTC 2017 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Enable GPCLK2 to Bluetooth. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 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.77 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.78 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.77 Mon Jul 31 10:45:04 2017 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Tue Aug 1 00:01:56 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.77 2017/07/31 10:45:04 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.78 2017/08/01 00:01:56 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.77 2017/07/31 10:45:04 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.78 2017/08/01 00:01:56 jmcneill Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -506,6 +506,8 @@ rpi_pinctrl(void) bcm2835gpio_function_select(33, BCM2835_GPIO_ALT5); bcm2835gpio_function_setpull(32, BCM2835_GPIO_GPPUD_PULLOFF); bcm2835gpio_function_setpull(33, BCM2835_GPIO_GPPUD_PULLUP); + bcm2835gpio_function_select(43, BCM2835_GPIO_ALT0); + bcm2835gpio_function_setpull(43, BCM2835_GPIO_GPPUD_PULLOFF); } }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Mon Jul 31 10:45:04 UTC 2017 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Only remap sdhost/sdhci on boards with wifi. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 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.76 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.77 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.76 Mon Jul 31 10:41:39 2017 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Mon Jul 31 10:45:04 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.76 2017/07/31 10:41:39 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.77 2017/07/31 10:45:04 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.76 2017/07/31 10:41:39 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.77 2017/07/31 10:45:04 jmcneill Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -481,20 +481,22 @@ static void rpi_pinctrl(void) { #if NBCMSDHOST > 0 - /* - * If the sdhost driver is present, map the SD card slot to the - * SD host controller and the sdhci driver to the SDIO pins. - */ - for (int pin = 48; pin <= 53; pin++) { - /* Enable SDHOST on SD card slot */ - bcm2835gpio_function_select(pin, BCM2835_GPIO_ALT0); - } - for (int pin = 34; pin <= 39; pin++) { - /* Enable SDHCI on SDIO */ - bcm2835gpio_function_select(pin, BCM2835_GPIO_ALT3); - bcm2835gpio_function_setpull(pin, - pin == 34 ? BCM2835_GPIO_GPPUD_PULLOFF : - BCM2835_GPIO_GPPUD_PULLUP); + if (rpi_rev_has_btwifi(vb.vbt_boardrev.rev)) { + /* + * If the sdhost driver is present, map the SD card slot to the + * SD host controller and the sdhci driver to the SDIO pins. + */ + for (int pin = 48; pin <= 53; pin++) { + /* Enable SDHOST on SD card slot */ + bcm2835gpio_function_select(pin, BCM2835_GPIO_ALT0); + } + for (int pin = 34; pin <= 39; pin++) { + /* Enable SDHCI on SDIO */ + bcm2835gpio_function_select(pin, BCM2835_GPIO_ALT3); + bcm2835gpio_function_setpull(pin, + pin == 34 ? BCM2835_GPIO_GPPUD_PULLOFF : + BCM2835_GPIO_GPPUD_PULLUP); + } } #endif
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Mon Jul 31 10:41:39 UTC 2017 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Enable AUX UART for BT on btwifi boards To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 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.75 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.76 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.75 Sun Jul 30 23:48:32 2017 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Mon Jul 31 10:41:39 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.75 2017/07/30 23:48:32 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.76 2017/07/31 10:41:39 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.75 2017/07/30 23:48:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.76 2017/07/31 10:41:39 jmcneill Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -497,6 +497,14 @@ rpi_pinctrl(void) BCM2835_GPIO_GPPUD_PULLUP); } #endif + + if (rpi_rev_has_btwifi(vb.vbt_boardrev.rev)) { + /* Enable AUX UART on BT */ + bcm2835gpio_function_select(32, BCM2835_GPIO_ALT5); + bcm2835gpio_function_select(33, BCM2835_GPIO_ALT5); + bcm2835gpio_function_setpull(32, BCM2835_GPIO_GPPUD_PULLOFF); + bcm2835gpio_function_setpull(33, BCM2835_GPIO_GPPUD_PULLUP); + } }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Sat Jun 17 22:50:23 UTC 2017 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Enable UART0 (PL011) on GPIO header for Raspberry Pi 3 / Zero W To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 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.71 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.72 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.71 Sat Jun 17 17:03:40 2017 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sat Jun 17 22:50:23 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.71 2017/06/17 17:03:40 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.72 2017/06/17 22:50:23 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.71 2017/06/17 17:03:40 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.72 2017/06/17 22:50:23 jmcneill Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include #include #include +#include #include #include @@ -180,6 +181,7 @@ static struct plcom_instance rpi_pi = { static struct __aligned(16) { struct vcprop_buffer_hdr vb_hdr; struct vcprop_tag_clockrate vbt_uartclockrate; + struct vcprop_tag_boardrev vbt_boardrev; struct vcprop_tag end; } vb_uart = { .vb_hdr = { @@ -194,6 +196,13 @@ static struct __aligned(16) { }, .id = VCPROP_CLK_UART }, + .vbt_boardrev = { + .tag = { + .vpt_tag = VCPROPTAG_GET_BOARDREVISION, + .vpt_len = VCPROPTAG_LEN(vb_uart.vbt_boardrev), + .vpt_rcode = VCPROPTAG_REQUEST + }, + }, .end = { .vpt_tag = VCPROPTAG_NULL } @@ -426,7 +435,20 @@ rpi_uartinit(void) bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, &res); - cpu_dcache_inv_range((vaddr_t)&vb, sizeof(vb)); + cpu_dcache_inv_range((vaddr_t)&vb_uart, sizeof(vb_uart)); + + if (vcprop_tag_success_p(&vb_uart.vbt_boardrev.tag) && + (vb_uart.vbt_boardrev.rev & VCPROP_REV_ENCFLAG) != 0) { + const uint32_t rev = vb_uart.vbt_boardrev.rev; + switch (__SHIFTOUT(rev, VCPROP_REV_MODEL)) { + case RPI_MODEL_B_PI3: + case RPI_MODEL_ZERO_W: + /* Enable UART0 (PL011) on GPIO header */ + bcm2835gpio_function_select(14, BCM2835_GPIO_ALT0); + bcm2835gpio_function_select(15, BCM2835_GPIO_ALT0); + break; + } + } if (vcprop_tag_success_p(&vb_uart.vbt_uartclockrate.tag)) uart_clk = vb_uart.vbt_uartclockrate.rate;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Fri Jan 6 14:53:32 UTC 2017 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Whitespace To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 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.68 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.69 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.68 Tue Feb 2 13:55:51 2016 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Fri Jan 6 14:53:32 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.68 2016/02/02 13:55:51 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.69 2017/01/06 14:53:32 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.68 2016/02/02 13:55:51 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.69 2017/01/06 14:53:32 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -188,8 +188,7 @@ static struct __aligned(16) { struct vcprop_tag_clockrate vbt_emmcclockrate; struct vcprop_tag_clockrate vbt_armclockrate; struct vcprop_tag end; -} vb = -{ +} vb = { .vb_hdr = { .vpb_len = sizeof(vb), .vpb_rcode = VCPROP_PROCESS_REQUEST, @@ -276,8 +275,7 @@ static struct __aligned(16) { struct vcprop_buffer_hdr vb_hdr; struct vcprop_tag_edidblock vbt_edid; struct vcprop_tag end; -} vb_edid = -{ +} vb_edid = { .vb_hdr = { .vpb_len = sizeof(vb_edid), .vpb_rcode = VCPROP_PROCESS_REQUEST, @@ -305,8 +303,7 @@ static struct __aligned(16) { struct vcprop_tag_blankscreen vbt_blank; struct vcprop_tag_fbpitch vbt_pitch; struct vcprop_tag end; -} vb_setfb = -{ +} vb_setfb = { .vb_hdr = { .vpb_len = sizeof(vb_setfb), .vpb_rcode = VCPROP_PROCESS_REQUEST,
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: mlelstv Date: Sun Apr 3 11:02:17 UTC 2016 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: Add more tags understood by the firmware. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 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.14 src/sys/arch/evbarm/rpi/vcprop.h:1.15 --- src/sys/arch/evbarm/rpi/vcprop.h:1.14 Mon Mar 14 07:43:00 2016 +++ src/sys/arch/evbarm/rpi/vcprop.h Sun Apr 3 11:02:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.14 2016/03/14 07:43:00 skrll Exp $ */ +/* $NetBSD: vcprop.h,v 1.15 2016/04/03 11:02:17 mlelstv Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -60,6 +60,8 @@ struct vcprop_tag { #define VCPROPTAG_SET_CLOCKRATE 0x00038002 #define VCPROPTAG_GET_MIN_CLOCKRATE 0x00030007 #define VCPROPTAG_GET_MAX_CLOCKRATE 0x00030004 +#define VCPROPTAG_GET_TURBO 0x00030009 +#define VCPROPTAG_SET_TURBO 0x00038009 #define VCPROPTAG_GET_VOLTAGE 0x00030003 #define VCPROPTAG_SET_VOLTAGE 0x00038003 @@ -92,6 +94,10 @@ struct vcprop_tag { #define VCPROPTAG_LOCKMEM 0x0003000d #define VCPROPTAG_UNLOCKMEM 0x0003000e #define VCPROPTAG_RELEASEMEM 0x0003000f +#define VCPROPTAG_EXECUTE_CODE 0x00030010 +#define VCPROPTAG_EXECUTE_QPU 0x00030011 +#define VCPROPTAG_SET_ENABLE_QPU 0x00030012 +#define VCPROPTAG_GET_DISPMANX_HANDLE 0x00030014 #define VCPROPTAG_SET_CURSOR_INFO 0x8010 #define VCPROPTAG_SET_CURSOR_STATE 0x8011
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Mon Mar 14 07:43:00 UTC 2016 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: Update vcprop_tag_clockrate structure To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 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.13 src/sys/arch/evbarm/rpi/vcprop.h:1.14 --- src/sys/arch/evbarm/rpi/vcprop.h:1.13 Sun Sep 28 14:38:29 2014 +++ src/sys/arch/evbarm/rpi/vcprop.h Mon Mar 14 07:43:00 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.13 2014/09/28 14:38:29 macallan Exp $ */ +/* $NetBSD: vcprop.h,v 1.14 2016/03/14 07:43:00 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -186,6 +186,7 @@ struct vcprop_tag_clockrate { struct vcprop_tag tag; uint32_t id; uint32_t rate; + uint32_t noturbo; }; #define VCPROP_VOLTAGE_CORE 1
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sat Aug 1 16:18:47 UTC 2015 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Re-enable cpus [123] now that bcm2835_intr.c is fixed with rev 1.11/ To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 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.66 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.67 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.66 Sun May 31 08:13:18 2015 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sat Aug 1 16:18:47 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.66 2015/05/31 08:13:18 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.67 2015/08/01 16:18:47 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.66 2015/05/31 08:13:18 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.67 2015/08/01 16:18:47 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -534,11 +534,6 @@ rpi_bootstrap(void) __func__, i); } } - - /* - * XXXNH: Disable non-boot CPUs for now - */ - arm_cpu_hatched = 0; #endif }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sun May 31 08:13:18 UTC 2015 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: No need to cpu_dcache_wbinv_all now that a9_mpsubr.S invalidates L1 only as it should To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 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.65 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.66 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.65 Wed May 27 09:40:51 2015 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sun May 31 08:13:18 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.65 2015/05/27 09:40:51 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.66 2015/05/31 08:13:18 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.65 2015/05/27 09:40:51 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.66 2015/05/31 08:13:18 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -503,8 +503,6 @@ rpi_bootstrap(void) extern void cortex_mpstart(void); - cpu_dcache_wbinv_all(); - for (size_t i = 1; i < arm_cpu_max; i++) { bus_space_tag_t iot = &bcm2835_bs_tag; bus_space_handle_t ioh = BCM2836_ARM_LOCAL_VBASE;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Wed May 27 09:40:51 UTC 2015 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: MP not ready, disable it again To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 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.64 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.65 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.64 Thu May 21 20:50:57 2015 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed May 27 09:40:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.64 2015/05/21 20:50:57 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.65 2015/05/27 09:40:51 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.64 2015/05/21 20:50:57 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.65 2015/05/27 09:40:51 jmcneill Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -536,6 +536,11 @@ rpi_bootstrap(void) __func__, i); } } + + /* + * XXXNH: Disable non-boot CPUs for now + */ + arm_cpu_hatched = 0; #endif }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Thu May 21 20:50:57 UTC 2015 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Before spinning up the secondary cpus flush the dcache otherwise the dcache invalidate in cortex_mpstart makes bad things happen. I have no idea why. RPI2 boots again To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 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.63 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.64 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.63 Thu May 21 10:35:08 2015 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Thu May 21 20:50:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.63 2015/05/21 10:35:08 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.64 2015/05/21 20:50:57 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.63 2015/05/21 10:35:08 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.64 2015/05/21 20:50:57 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -503,6 +503,8 @@ rpi_bootstrap(void) extern void cortex_mpstart(void); + cpu_dcache_wbinv_all(); + for (size_t i = 1; i < arm_cpu_max; i++) { bus_space_tag_t iot = &bcm2835_bs_tag; bus_space_handle_t ioh = BCM2836_ARM_LOCAL_VBASE;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Thu May 21 10:35:08 UTC 2015 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: re-enable multiprocessor support now that sdmmc has been fixed To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 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.62 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.63 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.62 Fri May 1 09:59:11 2015 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Thu May 21 10:35:08 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.62 2015/05/01 09:59:11 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.63 2015/05/21 10:35:08 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.62 2015/05/01 09:59:11 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.63 2015/05/21 10:35:08 jmcneill Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -534,11 +534,6 @@ rpi_bootstrap(void) __func__, i); } } - - /* - * XXXNH: Disable non-boot CPUs for now - */ - arm_cpu_hatched = 0; #endif }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Fri May 1 09:59:11 UTC 2015 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Disable non-boot CPUs on RPI2 - there are still issues with interrupt handling. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 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.61 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.62 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.61 Sun Apr 12 17:32:39 2015 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Fri May 1 09:59:11 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.61 2015/04/12 17:32:39 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.62 2015/05/01 09:59:11 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.61 2015/04/12 17:32:39 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.62 2015/05/01 09:59:11 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -534,6 +534,11 @@ rpi_bootstrap(void) __func__, i); } } + + /* + * XXXNH: Disable non-boot CPUs for now + */ + arm_cpu_hatched = 0; #endif }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sat Apr 11 15:29:58 UTC 2015 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Tweak cpu start up slightly and print TTBR for cortex_mmuinfo when VERBOSE_INIT_ARM To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 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.59 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.60 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.59 Sun Mar 15 22:54:03 2015 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sat Apr 11 15:29:58 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.59 2015/03/15 22:54:03 joerg Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.60 2015/04/11 15:29:58 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.59 2015/03/15 22:54:03 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.60 2015/04/11 15:29:58 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -491,17 +491,22 @@ rpi_bootstrap(void) #if defined(BCM2836) arm_cpu_max = 4; extern int cortex_mmuinfo; - bus_space_tag_t iot = &bcm2835_bs_tag; - bus_space_handle_t ioh = BCM2836_ARM_LOCAL_VBASE; #ifdef VERBOSE_INIT_ARM printf("%s: %d cpus present\n", __func__, arm_cpu_max); #endif - extern void cortex_mpstart(void); cortex_mmuinfo = armreg_ttbr_read(); +#ifdef VERBOSE_INIT_ARM + printf("%s: cortex_mmuinfo %x\n", __func__, cortex_mmuinfo); +#endif + + extern void cortex_mpstart(void); for (size_t i = 1; i < arm_cpu_max; i++) { + bus_space_tag_t iot = &bcm2835_bs_tag; + bus_space_handle_t ioh = BCM2836_ARM_LOCAL_VBASE; + bus_space_write_4(iot, ioh, BCM2836_LOCAL_MAILBOX3_SETN(i), (uint32_t)cortex_mpstart);
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Fri Mar 27 11:42:28 UTC 2015 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/rpi/rpi_start.S 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_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.13 src/sys/arch/evbarm/rpi/rpi_start.S:1.14 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.13 Sat Feb 28 09:34:34 2015 +++ src/sys/arch/evbarm/rpi/rpi_start.S Fri Mar 27 11:42:28 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.13 2015/02/28 09:34:34 skrll Exp $ */ +/* $NetBSD: rpi_start.S,v 1.14 2015/03/27 11:42:28 skrll Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -94,7 +94,7 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.13 2015/02/28 09:34:34 skrll Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.14 2015/03/27 11:42:28 skrll Exp $") /* * Workaround Erratum 411920 @@ -223,15 +223,15 @@ _C_LABEL(rpi_start): // When using split TTBRs, we need to set both since the physical // addresses we were/are using might be in either. mcr p15, 0, r0, c2, c0, 1 /* TTBR1 write */ -#endif +#endif #if defined(ARM_MMU_EXTENDED) mov r1, #TTBCR_S_N_1/* make sure TTBCR_S_N is 1 */ -#else +#else mov r1, #0 /* make sure TTBCR is 0 */ #endif mcr p15, 0, r1, c2, c0, 2 /* TTBCR write */ - + mov r0, #0 mcr p15, 0, r0, c8, c7, 0 /* Invalidate TLBs */
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: joerg Date: Sun Mar 15 22:54:03 UTC 2015 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Do invalidate the cache as RPI2 build with Clang can't fetch the memory config otherwise. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 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.58 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.59 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.58 Wed Mar 4 17:02:17 2015 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sun Mar 15 22:54:03 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.58 2015/03/04 17:02:17 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.59 2015/03/15 22:54:03 joerg Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.58 2015/03/04 17:02:17 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.59 2015/03/15 22:54:03 joerg Exp $"); #include "opt_arm_debug.h" #include "opt_bcm283x.h" @@ -431,13 +431,7 @@ rpi_bootparams(void) bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, &res); - /* - * No need to invalid the cache as the memory has never been referenced - * by the ARM. - * - * cpu_dcache_inv_range((vaddr_t)&vb, sizeof(vb)); - * - */ + cpu_dcache_inv_range((vaddr_t)&vb, sizeof(vb)); if (!vcprop_buffer_success_p(&vb.vb_hdr)) { bootconfig.dramblocks = 1;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Wed Jan 21 11:02:55 UTC 2015 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Newer Raspberry Pi firmware has changed the framebuffer from BGR to RGB. The method we use to set the pixel order (vcprop set pixel order) does not seem to work, nor does querying the pixel order (vcprop get pixel order). The firmware passes this information to the kernel by adding a "bcm2708_fb.fbswap" kernel cmdline arg. 0=BGR, 1=RGB. If the parameter is absent, assume we are running on old firmware and use BGR mode. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 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.55 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.56 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.55 Tue Oct 7 08:37:18 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Jan 21 11:02:55 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.55 2014/10/07 08:37:18 mlelstv Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.56 2015/01/21 11:02:55 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.55 2014/10/07 08:37:18 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.56 2015/01/21 11:02:55 jmcneill Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -296,7 +296,6 @@ static struct __aligned(16) { struct vcprop_tag_fbres vbt_res; struct vcprop_tag_fbres vbt_vres; struct vcprop_tag_fbdepth vbt_depth; - struct vcprop_tag_fbpixelorder vbt_pixelorder; struct vcprop_tag_fbalpha vbt_alpha; struct vcprop_tag_allocbuf vbt_allocbuf; struct vcprop_tag_blankscreen vbt_blank; @@ -334,14 +333,6 @@ static struct __aligned(16) { }, .bpp = 32, }, - .vbt_pixelorder = { - .tag = { - .vpt_tag = VCPROPTAG_SET_FB_PIXEL_ORDER, - .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_pixelorder), - .vpt_rcode = VCPROPTAG_REQUEST, - }, - .state = VCPROP_PIXEL_BGR, - }, .vbt_alpha = { .tag = { .vpt_tag = VCPROPTAG_SET_FB_ALPHA_MODE, @@ -750,6 +741,7 @@ rpi_fb_init(prop_dictionary_t dict, void char *ptr; int integer; int error; + bool is_bgr = true; if (get_bootconf_option(boot_args, "fb", BOOTOPT_TYPE_STRING, &ptr)) { @@ -779,7 +771,6 @@ rpi_fb_init(prop_dictionary_t dict, void !vcprop_tag_success_p(&vb_setfb.vbt_res.tag) || !vcprop_tag_success_p(&vb_setfb.vbt_vres.tag) || !vcprop_tag_success_p(&vb_setfb.vbt_depth.tag) || - !vcprop_tag_success_p(&vb_setfb.vbt_pixelorder.tag) || !vcprop_tag_success_p(&vb_setfb.vbt_allocbuf.tag) || !vcprop_tag_success_p(&vb_setfb.vbt_blank.tag) || !vcprop_tag_success_p(&vb_setfb.vbt_pitch.tag)) { @@ -798,8 +789,6 @@ rpi_fb_init(prop_dictionary_t dict, void vb_setfb.vbt_res.width, vb_setfb.vbt_res.height); printf("%s: vwidth = %d vheight = %d\n", __func__, vb_setfb.vbt_vres.width, vb_setfb.vbt_vres.height); - printf("%s: pixelorder = %d\n", __func__, - vb_setfb.vbt_pixelorder.state); #endif if (vb_setfb.vbt_allocbuf.address == 0 || @@ -821,8 +810,20 @@ rpi_fb_init(prop_dictionary_t dict, void vb_setfb.vbt_pitch.linebytes); prop_dictionary_set_uint32(dict, "address", vb_setfb.vbt_allocbuf.address); - if (vb_setfb.vbt_pixelorder.state == VCPROP_PIXEL_BGR) - prop_dictionary_set_bool(dict, "is_bgr", true); + + /* + * Old firmware uses BGR. New firmware uses RGB. The get and set + * pixel order mailbox properties don't seem to work. The firmware + * adds a kernel cmdline option bcm2708_fb.fbswap=<0|1>, so use it + * to determine pixel order. 0 means BGR, 1 means RGB. + * + * See https://github.com/raspberrypi/linux/issues/514 + */ + if (get_bootconf_option(boot_args, "bcm2708_fb.fbswap", +BOOTOPT_TYPE_INT, &integer)) { + is_bgr = integer == 0; + } + prop_dictionary_set_bool(dict, "is_bgr", is_bgr); /* if "genfb.type=" is passed in cmdline, override wsdisplay type */ if (get_bootconf_option(boot_args, "genfb.type",
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: mlelstv Date: Tue Oct 7 08:37:18 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: fwrev is a timestamp, print in decimal. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 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.54 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.55 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.54 Sat Oct 4 13:05:57 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Tue Oct 7 08:37:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.54 2014/10/04 13:05:57 macallan Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.55 2014/10/07 08:37:18 mlelstv Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.54 2014/10/04 13:05:57 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.55 2014/10/07 08:37:18 mlelstv Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -1082,7 +1082,7 @@ SYSCTL_SETUP(sysctl_machdep_rpi, "sysctl NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, - CTLFLAG_PERMANENT|CTLFLAG_READONLY|CTLFLAG_HEX, + CTLFLAG_PERMANENT|CTLFLAG_READONLY, CTLTYPE_INT, "firmware_revision", NULL, NULL, 0, &vb.vbt_fwrev.rev, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: mlelstv Date: Sat Oct 4 13:18:34 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_vcmbox.c Log Message: be verbose about sysmon error. enable monitoring. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/rpi/rpi_vcmbox.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_vcmbox.c diff -u src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.3 src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.4 --- src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.3 Tue Apr 1 06:55:29 2014 +++ src/sys/arch/evbarm/rpi/rpi_vcmbox.c Sat Oct 4 13:18:34 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_vcmbox.c,v 1.3 2014/04/01 06:55:29 skrll Exp $ */ +/* $NetBSD: rpi_vcmbox.c,v 1.4 2014/10/04 13:18:34 mlelstv Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.3 2014/04/01 06:55:29 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.4 2014/10/04 13:18:34 mlelstv Exp $"); #include #include @@ -152,7 +152,11 @@ vcmbox_attach(device_t parent, device_t sc->sc_sme->sme_refresh = vcmbox_sensor_refresh; sc->sc_sme->sme_get_limits = vcmbox_sensor_get_limits; vcmbox_create_sensors(sc); - sysmon_envsys_register(sc->sc_sme); + if (sysmon_envsys_register(sc->sc_sme) == 0) + return; + + aprint_error_dev(self, "unable to register with sysmon\n"); + sysmon_envsys_destroy(sc->sc_sme); } static int @@ -355,7 +359,8 @@ vcmbox_create_sensors(struct vcmbox_soft sc->sc_sensor[VCMBOX_SENSOR_TEMP].sensor = VCMBOX_SENSOR_TEMP; sc->sc_sensor[VCMBOX_SENSOR_TEMP].units = ENVSYS_STEMP; sc->sc_sensor[VCMBOX_SENSOR_TEMP].state = ENVSYS_SINVALID; - sc->sc_sensor[VCMBOX_SENSOR_TEMP].flags = ENVSYS_FHAS_ENTROPY; + sc->sc_sensor[VCMBOX_SENSOR_TEMP].flags = ENVSYS_FMONLIMITS | + ENVSYS_FHAS_ENTROPY; strlcpy(sc->sc_sensor[VCMBOX_SENSOR_TEMP].desc, vcmbox_sensor_name[VCMBOX_SENSOR_TEMP], sizeof(sc->sc_sensor[VCMBOX_SENSOR_TEMP].desc));
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: macallan Date: Sat Oct 4 13:05:57 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: pay attention to copyin()'s return values To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 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.53 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.54 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.53 Fri Oct 3 11:40:55 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sat Oct 4 13:05:57 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.53 2014/10/03 11:40:55 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.54 2014/10/04 13:05:57 macallan Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.53 2014/10/03 11:40:55 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.54 2014/10/04 13:05:57 macallan Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -911,9 +911,12 @@ rpi_fb_do_cursor(struct wsdisplay_cursor shape = 1; } if (cur->which & WSDISPLAY_CURSOR_DOSHAPE) { + int err; - copyin(cur->mask, cursor_mask, CURSOR_BITMAP_SIZE); - copyin(cur->image, cursor_bitmap, CURSOR_BITMAP_SIZE); + err = copyin(cur->mask, cursor_mask, CURSOR_BITMAP_SIZE); + err += copyin(cur->image, cursor_bitmap, CURSOR_BITMAP_SIZE); + if (err != 0) + return EFAULT; shape = 1; } if (shape) {
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Fri Oct 3 17:57:48 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: vcprop_subr.c Log Message: Better error handling. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/rpi/vcprop_subr.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/vcprop_subr.c diff -u src/sys/arch/evbarm/rpi/vcprop_subr.c:1.1 src/sys/arch/evbarm/rpi/vcprop_subr.c:1.2 --- src/sys/arch/evbarm/rpi/vcprop_subr.c:1.1 Sun Sep 28 14:38:29 2014 +++ src/sys/arch/evbarm/rpi/vcprop_subr.c Fri Oct 3 17:57:48 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop_subr.c,v 1.1 2014/09/28 14:38:29 macallan Exp $ */ +/* $NetBSD: vcprop_subr.c,v 1.2 2014/10/03 17:57:48 skrll Exp $ */ /* * Copyright (c) 2014 Michael Lorenz @@ -90,7 +90,15 @@ rpi_fb_set_video(int b) vb_setblank.vbt_blank.state, error, res, vb_setblank.vbt_blank.tag.vpt_rcode); #endif - return (error == 0); + if (error) + return error; + + if (!vcprop_buffer_success_p(&vb_setblank.vb_hdr) || + !vcprop_tag_success_p(&vb_setblank.vbt_blank.tag)) { + return EIO; + } + + return 0; } uint32_t @@ -131,9 +139,16 @@ rpi_alloc_mem(uint32_t size, uint32_t al vb_allocmem.vbt_am.size, error, res, vb_allocmem.vbt_am.tag.vpt_rcode); #endif - if (error == 0) - return vb_allocmem.vbt_am.size; - return 0; + if (error) + return error; + + if (!vcprop_buffer_success_p(&vb_allocmem.vb_hdr) || + !vcprop_tag_success_p(&vb_allocmem.vbt_am.tag)) { + return EIO; + } + + /* Return the handle from the VC */ + return vb_allocmem.vbt_am.size; } bus_addr_t @@ -172,9 +187,15 @@ rpi_lock_mem(uint32_t handle) vb_lockmem.vbt_lm.handle, error, res, vb_lockmem.vbt_lm.tag.vpt_rcode); #endif - if (error == 0) - return (vb_lockmem.vbt_lm.handle /*& 0x3fff*/); - return 0; + if (error) + return 0; + + if (!vcprop_buffer_success_p(&vb_lockmem.vb_hdr) || + !vcprop_tag_success_p(&vb_lockmem.vbt_lm.tag)) { + return 0; + } + + return vb_lockmem.vbt_lm.handle; } int @@ -213,7 +234,15 @@ rpi_unlock_mem(uint32_t handle) vb_unlockmem.vbt_lm.handle, error, res, vb_unlockmem.vbt_lm.tag.vpt_rcode); #endif - return (error == 0); + if (error) + return error; + + if (!vcprop_buffer_success_p(&vb_unlockmem.vb_hdr) || + !vcprop_tag_success_p(&vb_unlockmem.vbt_lm.tag)) { + return EIO; + } + + return 0; } int @@ -252,7 +281,15 @@ rpi_release_mem(uint32_t handle) vb_releasemem.vbt_lm.handle, error, res, vb_releasemem.vbt_lm.tag.vpt_rcode); #endif - return (error == 0); + if (error) + return error; + + if (!vcprop_buffer_success_p(&vb_releasemem.vb_hdr) || + !vcprop_tag_success_p(&vb_releasemem.vbt_lm.tag)) { + return EIO; + } + + return 0; } int @@ -294,7 +331,15 @@ rpi_fb_movecursor(int x, int y, int on) vb_cursorstate.vbt_cs.enable, error, res, vb_cursorstate.vbt_cs.tag.vpt_rcode); #endif - return (error == 0); + if (error) + return error; + + if (!vcprop_buffer_success_p(&vb_cursorstate.vb_hdr) || + !vcprop_tag_success_p(&vb_cursorstate.vbt_cs.tag)) { + return EIO; + } + + return 0; } int @@ -339,5 +384,13 @@ rpi_fb_initcursor(bus_addr_t pixels, int vb_cursorinfo.vbt_ci.width, error, res, vb_cursorinfo.vbt_ci.tag.vpt_rcode); #endif - return (error == 0); + if (error) + return error; + + if (!vcprop_buffer_success_p(&vb_cursorinfo.vb_hdr) || + !vcprop_tag_success_p(&vb_cursorinfo.vbt_ci.tag)) { + return EIO; + } + + return 0; }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: mlelstv Date: Wed Oct 1 13:31:27 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: turn off hardware cursor while blanking screen. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 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.51 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.52 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.51 Wed Oct 1 13:30:18 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Oct 1 13:31:27 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.51 2014/10/01 13:30:18 mlelstv Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.52 2014/10/01 13:31:27 mlelstv Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.51 2014/10/01 13:30:18 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.52 2014/10/01 13:31:27 mlelstv Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -941,6 +941,8 @@ rpi_ioctl(void *v, void *vs, u_long cmd, return 0; rpi_video_on = d; rpi_fb_set_video(d); + rpi_fb_movecursor(cursor_x, cursor_y, + d ? cursor_on : 0); } return 0; case WSDISPLAYIO_GVIDEO:
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: mlelstv Date: Wed Oct 1 13:30:18 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: make board/firmware revisions visible via sysctl To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 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.50 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.51 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.50 Mon Sep 29 21:45:15 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Oct 1 13:30:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.50 2014/09/29 21:45:15 macallan Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.51 2014/10/01 13:30:18 mlelstv Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.50 2014/09/29 21:45:15 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.51 2014/10/01 13:30:18 mlelstv Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -1062,6 +1062,21 @@ SYSCTL_SETUP(sysctl_machdep_rpi, "sysctl NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READONLY|CTLFLAG_HEX, + CTLTYPE_INT, "firmware_revision", NULL, NULL, 0, + &vb.vbt_fwrev.rev, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READONLY, + CTLTYPE_INT, "board_model", NULL, NULL, 0, + &vb.vbt_boardmodel.model, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READONLY, + CTLTYPE_INT, "board_revision", NULL, NULL, 0, + &vb.vbt_boardrev.rev, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READONLY|CTLFLAG_HEX|CTLFLAG_PRIVATE, CTLTYPE_QUAD, "serial", NULL, NULL, 0, &vb.vbt_serial.sn, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: macallan Date: Mon Sep 29 21:45:15 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: shut up gcc warning while there, do some magic number reduction To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 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.49 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.50 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.49 Sun Sep 28 15:39:36 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Mon Sep 29 21:45:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.49 2014/09/28 15:39:36 macallan Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.50 2014/09/29 21:45:15 macallan Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.49 2014/09/28 15:39:36 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.50 2014/09/29 21:45:15 macallan Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -382,6 +382,8 @@ void bcmgenfb_set_ioctl(int(*)(void *, v extern void bcmgenfb_ddb_trap_callback(int where); static int rpi_ioctl(void *, void *, u_long, void *, int, lwp_t *); +#define CURSOR_BITMAP_SIZE (64 * 8) +#define CURSOR_ARGB_SIZE (64 * 64 * 4) static int rpi_video_on = WSDISPLAYIO_VIDEO_ON; static uint32_t hcursor = 0; static bus_addr_t pcursor = 0; @@ -826,7 +828,7 @@ rpi_fb_init(prop_dictionary_t dict, void prop_dictionary_set_uint32(dict, "wsdisplay_type", integer); } - hcursor = rpi_alloc_mem(64 * 64 * 4, PAGE_SIZE, + hcursor = rpi_alloc_mem(CURSOR_ARGB_SIZE, PAGE_SIZE, MEM_FLAG_L1_NONALLOCATING | MEM_FLAG_HINT_PERMALOCK); pcursor = rpi_lock_mem(hcursor); #ifdef RPI_IOCTL_DEBUG @@ -834,7 +836,7 @@ rpi_fb_init(prop_dictionary_t dict, void printf("pcursor: %08x\n", (uint32_t)pcursor); printf("fb: %08x\n", (uint32_t)vb_setfb.vbt_allocbuf.address); #endif - if (bus_space_map(aaa->aaa_iot, pcursor, 64 * 64 * 4, + if (bus_space_map(aaa->aaa_iot, pcursor, CURSOR_ARGB_SIZE, BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE, &hc) != 0) { printf("couldn't map cursor memory\n"); } else { @@ -849,7 +851,7 @@ rpi_fb_init(prop_dictionary_t dict, void } k += 64; } - cpu_dcache_wb_range(cmem, 64 * 64 * 4); + cpu_dcache_wb_range((vaddr_t)cmem, CURSOR_ARGB_SIZE); rpi_fb_initcursor(pcursor, 0, 0); } #ifdef RPI_IOCTL_DEBUG @@ -900,15 +902,15 @@ rpi_fb_do_cursor(struct wsdisplay_cursor } if (cur->which & WSDISPLAY_CURSOR_DOSHAPE) { - copyin(cur->mask, cursor_mask, 64 * 8); - copyin(cur->image, cursor_bitmap, 64 * 8); + copyin(cur->mask, cursor_mask, CURSOR_BITMAP_SIZE); + copyin(cur->image, cursor_bitmap, CURSOR_BITMAP_SIZE); shape = 1; } if (shape) { int i, j, idx; uint8_t mask; - for (i = 0; i < 64 * 8; i++) { + for (i = 0; i < CURSOR_BITMAP_SIZE; i++) { mask = 0x01; for (j = 0; j < 8; j++) { idx = ((cursor_mask[i] & mask) ? 2 : 0) | @@ -918,7 +920,7 @@ rpi_fb_do_cursor(struct wsdisplay_cursor } } /* just in case */ - cpu_dcache_wb_range(cmem, 64 * 64 * 4); + cpu_dcache_wb_range((vaddr_t)cmem, CURSOR_ARGB_SIZE); rpi_fb_initcursor(pcursor, hot_x, hot_y); } if (pos) {
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: macallan Date: Sun Sep 28 15:39:36 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: make global variables static also, make cursor test pattern red/green to highlight RGB vs. BGR To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 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.48 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.49 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.48 Sun Sep 28 14:38:29 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sun Sep 28 15:39:36 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.48 2014/09/28 14:38:29 macallan Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.49 2014/09/28 15:39:36 macallan Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.48 2014/09/28 14:38:29 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.49 2014/09/28 15:39:36 macallan Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -382,13 +382,13 @@ void bcmgenfb_set_ioctl(int(*)(void *, v extern void bcmgenfb_ddb_trap_callback(int where); static int rpi_ioctl(void *, void *, u_long, void *, int, lwp_t *); -int rpi_video_on = WSDISPLAYIO_VIDEO_ON; -uint32_t hcursor = 0; -bus_addr_t pcursor = 0; -uint32_t *cmem = NULL; -int cursor_x = 0, cursor_y = 0, hot_x = 0, hot_y = 0, cursor_on = 0; -uint32_t cursor_cmap[4]; -uint8_t cursor_mask[8 * 64], cursor_bitmap[8 * 64]; +static int rpi_video_on = WSDISPLAYIO_VIDEO_ON; +static uint32_t hcursor = 0; +static bus_addr_t pcursor = 0; +static uint32_t *cmem = NULL; +static int cursor_x = 0, cursor_y = 0, hot_x = 0, hot_y = 0, cursor_on = 0; +static uint32_t cursor_cmap[4]; +static uint8_t cursor_mask[8 * 64], cursor_bitmap[8 * 64]; #endif @@ -845,7 +845,7 @@ rpi_fb_init(prop_dictionary_t dict, void for (j = 0; j < 64; j++) { for (i = 0; i < 64; i++) { cmem[i + k] = - ((i & 8) ^ (j & 8)) ? 0xa0ff : 0xa0ff; + ((i & 8) ^ (j & 8)) ? 0xa0ff : 0xa000ff00; } k += 64; }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: macallan Date: Sun Sep 28 14:38:29 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c vcprop.h Added Files: src/sys/arch/evbarm/rpi: vcprop_subr.c Log Message: add hardware cursor support To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/arch/evbarm/rpi/rpi_machdep.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/rpi/vcprop.h cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/rpi/vcprop_subr.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.47 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.48 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.47 Fri Sep 12 15:29:30 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sun Sep 28 14:38:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.47 2014/09/12 15:29:30 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.48 2014/09/28 14:38:29 macallan Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.47 2014/09/12 15:29:30 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.48 2014/09/28 14:38:29 macallan Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include #include #include +#include #include #include @@ -376,16 +377,21 @@ static struct __aligned(16) { }, }; -int rpi_fb_set_video(int); -int rpi_video_on = WSDISPLAYIO_VIDEO_ON; - extern void bcmgenfb_set_console_dev(device_t dev); void bcmgenfb_set_ioctl(int(*)(void *, void *, u_long, void *, int, struct lwp *)); extern void bcmgenfb_ddb_trap_callback(int where); static int rpi_ioctl(void *, void *, u_long, void *, int, lwp_t *); +int rpi_video_on = WSDISPLAYIO_VIDEO_ON; +uint32_t hcursor = 0; +bus_addr_t pcursor = 0; +uint32_t *cmem = NULL; +int cursor_x = 0, cursor_y = 0, hot_x = 0, hot_y = 0, cursor_on = 0; +uint32_t cursor_cmap[4]; +uint8_t cursor_mask[8 * 64], cursor_bitmap[8 * 64]; #endif + static void rpi_bootparams(void) { @@ -731,8 +737,10 @@ rpi_fb_get_edid_mode(uint32_t *pwidth, u * - If "console=fb" is present, attach framebuffer to console. */ static bool -rpi_fb_init(prop_dictionary_t dict) +rpi_fb_init(prop_dictionary_t dict, void *aux) { + struct amba_attach_args *aaa = aux; + bus_space_handle_t hc; uint32_t width = 0, height = 0; uint32_t res; char *ptr; @@ -818,49 +826,105 @@ rpi_fb_init(prop_dictionary_t dict) prop_dictionary_set_uint32(dict, "wsdisplay_type", integer); } + hcursor = rpi_alloc_mem(64 * 64 * 4, PAGE_SIZE, + MEM_FLAG_L1_NONALLOCATING | MEM_FLAG_HINT_PERMALOCK); + pcursor = rpi_lock_mem(hcursor); +#ifdef RPI_IOCTL_DEBUG + printf("hcursor: %08x\n", hcursor); + printf("pcursor: %08x\n", (uint32_t)pcursor); + printf("fb: %08x\n", (uint32_t)vb_setfb.vbt_allocbuf.address); +#endif + if (bus_space_map(aaa->aaa_iot, pcursor, 64 * 64 * 4, + BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE, &hc) != 0) { + printf("couldn't map cursor memory\n"); + } else { + int i, j, k; + + cmem = bus_space_vaddr(aaa->aaa_iot, hc); + k = 0; + for (j = 0; j < 64; j++) { + for (i = 0; i < 64; i++) { +cmem[i + k] = + ((i & 8) ^ (j & 8)) ? 0xa0ff : 0xa0ff; + } + k += 64; + } + cpu_dcache_wb_range(cmem, 64 * 64 * 4); + rpi_fb_initcursor(pcursor, 0, 0); + } +#ifdef RPI_IOCTL_DEBUG + rpi_fb_movecursor(600, 400, 1); +#else + rpi_fb_movecursor(cursor_x, cursor_y, cursor_on); +#endif return true; } -int -rpi_fb_set_video(int b) +static int +rpi_fb_do_cursor(struct wsdisplay_cursor *cur) { - int error; - uint32_t res; + int pos = 0; + int shape = 0; - /* - * might as well put it here since we need to re-init it every time - * and it's not like this is going to be called very often anyway - */ - struct __aligned(16) { - struct vcprop_buffer_hdr vb_hdr; - struct vcprop_tag_blankscreen vbt_blank; - struct vcprop_tag end; - } vb_setblank = - { - .vb_hdr = { - .vpb_len = sizeof(vb_setblank), - .vpb_rcode = VCPROP_PROCESS_REQUEST, - }, - .vbt_blank = { - .tag = { -.vpt_tag = VCPROPTAG_BLANK_SCREEN, -.vpt_len = VCPROPTAG_LEN(vb_setblank.vbt_blank), -.vpt_rcode = VCPROPTAG_REQUEST, - }, - .state = (b != 0) ? VCPROP_BLANK_OFF : VCPROP_BLANK_ON, - }, - .end = { - .vpt_tag = VCPROPTAG_NULL, - }, - }; + if (cur->which & WSDISPLAY_CURSOR_DOCUR) { + if (cursor_on != cur->enable) { + cursor_on = cur->enable; + pos = 1; + } + } + if (cur->which & WSDISPLAY_CURSOR_DOHOT) { - error = bcmmbox_request(BCMMBOX_CHANARM2VC, &vb_setblank, - sizeof(vb_setblank), &res); -#ifdef RPI_IOCTL_DEBUG - printf("%s: %d %d %d %08x %08x\n", __func__, b, - vb_setblank.vbt_blank.state, error, res, vb_setblank.vbt_blank.tag.vpt_rcode); -#endif - return (error == 0); + hot_x = cur-
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: macallan Date: Sun Sep 28 12:57:22 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: the RPi wiki had the values for VCPROPTAG_SET_CURSOR_INFO and VCPROPTAG_SET_CURSOR_STATE swapped - now they actually work thanks jmcneill@ for having the right idea To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/arch/evbarm/rpi/vcprop.h:1.12 --- src/sys/arch/evbarm/rpi/vcprop.h:1.11 Tue Sep 23 10:52:21 2014 +++ src/sys/arch/evbarm/rpi/vcprop.h Sun Sep 28 12:57:22 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.11 2014/09/23 10:52:21 macallan Exp $ */ +/* $NetBSD: vcprop.h,v 1.12 2014/09/28 12:57:22 macallan Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -93,8 +93,8 @@ struct vcprop_tag { #define VCPROPTAG_UNLOCKMEM 0x0003000e #define VCPROPTAG_RELEASEMEM 0x0003000f -#define VCPROPTAG_SET_CURSOR_INFO 0x8011 -#define VCPROPTAG_SET_CURSOR_STATE 0x8010 +#define VCPROPTAG_SET_CURSOR_INFO 0x8010 +#define VCPROPTAG_SET_CURSOR_STATE 0x8011 uint32_t vpt_len; uint32_t vpt_rcode;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: macallan Date: Tue Sep 23 10:52:21 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: add VC memory management goop To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 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.10 src/sys/arch/evbarm/rpi/vcprop.h:1.11 --- src/sys/arch/evbarm/rpi/vcprop.h:1.10 Tue Sep 23 09:18:33 2014 +++ src/sys/arch/evbarm/rpi/vcprop.h Tue Sep 23 10:52:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.10 2014/09/23 09:18:33 macallan Exp $ */ +/* $NetBSD: vcprop.h,v 1.11 2014/09/23 10:52:21 macallan Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -88,6 +88,11 @@ struct vcprop_tag { #define VCPROPTAG_GET_EDID_BLOCK 0x00030020 +#define VCPROPTAG_ALLOCMEM 0x0003000c +#define VCPROPTAG_LOCKMEM 0x0003000d +#define VCPROPTAG_UNLOCKMEM 0x0003000e +#define VCPROPTAG_RELEASEMEM 0x0003000f + #define VCPROPTAG_SET_CURSOR_INFO 0x8011 #define VCPROPTAG_SET_CURSOR_STATE 0x8010 @@ -283,7 +288,7 @@ struct vcprop_tag_cursorinfo { uint32_t width; uint32_t height; uint32_t __pad; /* unused */ - uint32_t pixels; + uint32_t pixels; /* bus address in VC memory */ uint32_t hotspot_x; uint32_t hotspot_y; }; @@ -296,6 +301,31 @@ struct vcprop_tag_cursorstate { uint32_t flags; /* 0 - display coord. 1 - fb coord. */ }; +struct vcprop_tag_allocmem { + struct vcprop_tag tag; + uint32_t size; /* handle returned here */ + uint32_t align; + uint32_t flags; +/* + * flag definitions from + * https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface + */ +#define MEM_FLAG_DISCARDABLE (1 << 0) /* can be resized to 0 at any time. Use for cached data */ +#define MEM_FLAG_NORMAL (0 << 2) /* normal allocating alias. Don't use from ARM */ +#define MEM_FLAG_DIRECT (1 << 2) /* 0xC alias uncached */ +#define MEM_FLAG_COHERENT (2 << 2) /* 0x8 alias. Non-allocating in L2 but coherent */ +#define MEM_FLAG_L1_NONALLOCATING (MEM_FLAG_DIRECT | MEM_FLAG_COHERENT) /* Allocating in L2 */ +#define MEM_FLAG_ZERO (1 << 4) /* initialise buffer to all zeros */ +#define MEM_FLAG_NO_INIT (1 << 5) /* don't initialise (default is initialise to all ones */ +#define MEM_FLAG_HINT_PERMALOCK (1 << 6) /* Likely to be locked for long periods of time. */ +}; + +/* also for unlock and release */ +struct vcprop_tag_lockmem { + struct vcprop_tag tag; + uint32_t handle; /* bus address returned here */ +}; + struct vcprop_buffer_hdr { uint32_t vpb_len; uint32_t vpb_rcode;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: macallan Date: Tue Sep 23 09:18:33 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: add goop for hardware cursor handling To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 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.9 src/sys/arch/evbarm/rpi/vcprop.h:1.10 --- src/sys/arch/evbarm/rpi/vcprop.h:1.9 Fri Jul 25 11:39:34 2014 +++ src/sys/arch/evbarm/rpi/vcprop.h Tue Sep 23 09:18:33 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.9 2014/07/25 11:39:34 jmcneill Exp $ */ +/* $NetBSD: vcprop.h,v 1.10 2014/09/23 09:18:33 macallan Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -88,6 +88,8 @@ struct vcprop_tag { #define VCPROPTAG_GET_EDID_BLOCK 0x00030020 +#define VCPROPTAG_SET_CURSOR_INFO 0x8011 +#define VCPROPTAG_SET_CURSOR_STATE 0x8010 uint32_t vpt_len; uint32_t vpt_rcode; @@ -276,6 +278,24 @@ struct vcprop_tag_edidblock { uint8_t data[128]; }; +struct vcprop_tag_cursorinfo { + struct vcprop_tag tag; + uint32_t width; + uint32_t height; + uint32_t __pad; /* unused */ + uint32_t pixels; + uint32_t hotspot_x; + uint32_t hotspot_y; +}; + +struct vcprop_tag_cursorstate { + struct vcprop_tag tag; + uint32_t enable; /* 1 - visible */ + uint32_t x; + uint32_t y; + uint32_t flags; /* 0 - display coord. 1 - fb coord. */ +}; + struct vcprop_buffer_hdr { uint32_t vpb_len; uint32_t vpb_rcode;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sun Sep 7 15:28:24 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Grab the DMA channel mask from the firmware. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 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.45 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.46 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.45 Fri Sep 5 21:22:35 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sun Sep 7 15:28:24 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.45 2014/09/05 21:22:35 macallan Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.46 2014/09/07 15:28:24 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.45 2014/09/05 21:22:35 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.46 2014/09/07 15:28:24 skrll Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -177,6 +177,7 @@ static struct __aligned(16) { struct vcprop_tag_macaddr vbt_macaddr; struct vcprop_tag_memory vbt_memory; struct vcprop_tag_boardserial vbt_serial; + struct vcprop_tag_dmachan vbt_dmachan; struct vcprop_tag_cmdline vbt_cmdline; struct vcprop_tag_clockrate vbt_emmcclockrate; struct vcprop_tag_clockrate vbt_armclockrate; @@ -229,6 +230,13 @@ static struct __aligned(16) { .vpt_rcode = VCPROPTAG_REQUEST }, }, + .vbt_dmachan = { + .tag = { + .vpt_tag = VCPROPTAG_GET_DMACHAN, + .vpt_len = VCPROPTAG_LEN(vb.vbt_dmachan), + .vpt_rcode = VCPROPTAG_REQUEST + }, + }, .vbt_cmdline = { .tag = { .vpt_tag = VCPROPTAG_GET_CMDLINE, @@ -457,6 +465,9 @@ rpi_bootparams(void) if (vcprop_tag_success_p(&vb.vbt_serial.tag)) printf("%s: board serial %llx\n", __func__, vb.vbt_serial.sn); + if (vcprop_tag_success_p(&vb.vbt_dmachan.tag)) + printf("%s: DMA channel mask 0x%08x\n", __func__, + vb.vbt_dmachan.mask); if (vcprop_tag_success_p(&vb.vbt_cmdline.tag)) printf("%s: cmdline %s\n", __func__,
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: macallan Date: Fri Sep 5 21:22:35 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: implement WSCONSIO_[G|S]VIDEO by hijacking bcm2835_genfb's ioctl next step: hardware cursor To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 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.44 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.45 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.44 Fri Aug 22 09:49:13 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Fri Sep 5 21:22:35 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.44 2014/08/22 09:49:13 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.45 2014/09/05 21:22:35 macallan Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.44 2014/08/22 09:49:13 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.45 2014/09/05 21:22:35 macallan Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -92,6 +92,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #if NGENFB > 0 #include #include +#include #endif #if NUKBD > 0 @@ -367,8 +368,14 @@ static struct __aligned(16) { }, }; +int rpi_fb_set_video(int); +int rpi_video_on = WSDISPLAYIO_VIDEO_ON; + extern void bcmgenfb_set_console_dev(device_t dev); +void bcmgenfb_set_ioctl(int(*)(void *, void *, u_long, void *, int, struct lwp *)); extern void bcmgenfb_ddb_trap_callback(int where); +static int rpi_ioctl(void *, void *, u_long, void *, int, lwp_t *); + #endif static void @@ -802,6 +809,71 @@ rpi_fb_init(prop_dictionary_t dict) return true; } + +int +rpi_fb_set_video(int b) +{ + int error; + uint32_t res; + + /* + * might as well put it here since we need to re-init it every time + * and it's not like this is going to be called very often anyway + */ + struct __aligned(16) { + struct vcprop_buffer_hdr vb_hdr; + struct vcprop_tag_blankscreen vbt_blank; + struct vcprop_tag end; + } vb_setblank = + { + .vb_hdr = { + .vpb_len = sizeof(vb_setblank), + .vpb_rcode = VCPROP_PROCESS_REQUEST, + }, + .vbt_blank = { + .tag = { +.vpt_tag = VCPROPTAG_BLANK_SCREEN, +.vpt_len = VCPROPTAG_LEN(vb_setblank.vbt_blank), +.vpt_rcode = VCPROPTAG_REQUEST, + }, + .state = (b != 0) ? VCPROP_BLANK_OFF : VCPROP_BLANK_ON, + }, + .end = { + .vpt_tag = VCPROPTAG_NULL, + }, + }; + + error = bcmmbox_request(BCMMBOX_CHANARM2VC, &vb_setblank, + sizeof(vb_setblank), &res); +#ifdef RPI_IOCTL_DEBUG + printf("%s: %d %d %d %08x %08x\n", __func__, b, + vb_setblank.vbt_blank.state, error, res, vb_setblank.vbt_blank.tag.vpt_rcode); +#endif + return (error == 0); +} + +static int +rpi_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, lwp_t *l) +{ + + switch (cmd) { + case WSDISPLAYIO_SVIDEO: + { + int d = *(int *)data; + if (d == rpi_video_on) +return 0; + rpi_video_on = d; + rpi_fb_set_video(d); + } + return 0; + case WSDISPLAYIO_GVIDEO: + *(int *)data = rpi_video_on; + return 0; + default: + return EPASSTHROUGH; + } +} + #endif static void @@ -849,6 +921,7 @@ rpi_device_register(device_t dev, void * char *ptr; bcmgenfb_set_console_dev(dev); + bcmgenfb_set_ioctl(&rpi_ioctl); #ifdef DDB db_trap_callback = bcmgenfb_ddb_trap_callback; #endif
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Fri Aug 22 09:49:13 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Remove unnecessary #include To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 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.43 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.44 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.43 Fri Jul 25 11:39:34 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Fri Aug 22 09:49:13 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.43 2014/07/25 11:39:34 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.44 2014/08/22 09:49:13 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.43 2014/07/25 11:39:34 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.44 2014/08/22 09:49:13 skrll Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -98,8 +98,6 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include #endif -#include "ksyms.h" - extern int KERNEL_BASE_phys[]; extern int KERNEL_BASE_virt[];
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sun Jul 27 09:04:09 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Prepare for ARM_MMU_EXTENDED To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/rpi/rpi_start.S 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_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.11 src/sys/arch/evbarm/rpi/rpi_start.S:1.12 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.11 Wed May 14 14:38:54 2014 +++ src/sys/arch/evbarm/rpi/rpi_start.S Sun Jul 27 09:04:09 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.11 2014/05/14 14:38:54 joerg Exp $ */ +/* $NetBSD: rpi_start.S,v 1.12 2014/07/27 09:04:09 skrll Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -82,12 +82,13 @@ */ #include "opt_cputypes.h" +#include "opt_cpuoptions.h" #include #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.11 2014/05/14 14:38:54 joerg Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.12 2014/07/27 09:04:09 skrll Exp $") /* * Workaround Erratum 411920 @@ -209,9 +210,23 @@ _C_LABEL(rpi_start): mcr p15, 0, r0, c7, c10, 4 /* Drain the write buffers. */ ldr r0, Ltemp_l1_table /* The page table address */ - mcr p15, 0, r0, c2, c0, 0 /* Set Translation Table Base */ - mov r0, #0 + mcr p15, 0, r0, c2, c0, 0 /* Set Translation Table Base 0 (TTB0) */ + +#if defined(ARM_MMU_EXTENDED) + // When using split TTBRs, we need to set both since the physical + // addresses we were/are using might be in either. + mcr p15, 0, r0, c2, c0, 1 /* TTBR1 write */ +#endif + +#if defined(ARM_MMU_EXTENDED) + mov r1, #TTBCR_S_N_1/* make sure TTBCR_S_N is 1 */ +#else + mov r1, #0 /* make sure TTBCR is 0 */ +#endif + mcr p15, 0, r1, c2, c0, 2 /* TTBCR write */ + + mov r0, #0 mcr p15, 0, r0, c8, c7, 0 /* Invalidate TLBs */ /* Set the Domain Access register. Very important! */ @@ -267,18 +282,22 @@ Lstart: /* bits to set in the Control Register */ Lcontrol_set: +#ifdef ARM11_COMPAT_MMU +#define CPU_CONTROL_EXTRA CPU_CONTROL_SYST_ENABLE +#else +#define CPU_CONTROL_EXTRA CPU_CONTROL_XP_ENABLE +#endif .word CPU_CONTROL_MMU_ENABLE | \ CPU_CONTROL_DC_ENABLE | \ - CPU_CONTROL_WBUF_ENABLE |/* not defined in 1176 */ \ - CPU_CONTROL_32BP_ENABLE | \ - CPU_CONTROL_32BD_ENABLE | \ - CPU_CONTROL_LABT_ENABLE | \ - CPU_CONTROL_SYST_ENABLE | \ + CPU_CONTROL_WBUF_ENABLE |/* not defined in 1176 (SBO) */ \ + CPU_CONTROL_32BP_ENABLE |/* SBO */ \ + CPU_CONTROL_32BD_ENABLE |/* SBO */ \ + CPU_CONTROL_LABT_ENABLE |/* SBO */ \ (1 << 16) | /* SBO - Global enable for data tcm */ \ (1 << 18) | /* SBO - Global enable for insn tcm */ \ CPU_CONTROL_UNAL_ENABLE | \ - CPU_CONTROL_IC_ENABLE - + CPU_CONTROL_IC_ENABLE | \ + CPU_CONTROL_EXTRA /* bits to clear in the Control Register */ Lcontrol_clr: @@ -305,20 +324,26 @@ Lctl_ID_dis: .word n_sec ; \ .word attr ; +#ifdef ARM11_COMPAT_MMU +#define L1_S_APv6_KRW L1_S_AP_KRW +#else +#define L1_S_APv6_KRW L1_S_APv7_KRW +#endif + mmu_init_table: /* Add 1MB of VA==PA at 0x so we can keep the kernel going */ MMU_INIT(0x0, 0x0, (_end - KERNEL_BASE + 2 * L1_S_SIZE - 1), - L1_S_PROTO | L1_S_AP_KRW) + L1_S_PROTO | L1_S_APv6_KRW) MMU_INIT(KERNEL_BASE, 0x0, (_end - KERNEL_BASE + 2 * L1_S_SIZE - 1), - L1_S_PROTO | L1_S_AP_KRW | L1_S_B | L1_S_C) + L1_S_PROTO | L1_S_APv6_KRW | L1_S_B | L1_S_C) /* Map the 16MB of peripherals */ MMU_INIT(RPI_KERNEL_IO_VBASE, RPI_KERNEL_IO_PBASE, (RPI_KERNEL_IO_VSIZE + L1_S_SIZE - 1), - L1_S_PROTO | L1_S_AP_KRW) + L1_S_PROTO | L1_S_APv6_KRW) /* end of table */ MMU_INIT(0, 0, 0, 0)
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Wed Jul 16 23:54:32 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: need opt_arm_debug.h for VERBOSE_INIT_ARM To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 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.41 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.42 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.41 Sun Apr 6 12:43:19 2014 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Jul 16 23:54:32 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.41 2014/04/06 12:43:19 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.42 2014/07/16 23:54:32 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,11 +30,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.41 2014/04/06 12:43:19 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.42 2014/07/16 23:54:32 jmcneill Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" #include "opt_kgdb.h" +#include "opt_arm_debug.h" #include "sdhc.h" #include "bcmdwctwo.h"
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: joerg Date: Wed May 14 14:38:54 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Enabling alignment faults and unaligned access at the same time makes the former win. LLVM is more aggressive than GCC about using unaligned access, so it would crash during pmap_init. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/rpi/rpi_start.S 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_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.10 src/sys/arch/evbarm/rpi/rpi_start.S:1.11 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.10 Mon Apr 7 14:40:17 2014 +++ src/sys/arch/evbarm/rpi/rpi_start.S Wed May 14 14:38:54 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.10 2014/04/07 14:40:17 skrll Exp $ */ +/* $NetBSD: rpi_start.S,v 1.11 2014/05/14 14:38:54 joerg Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -87,7 +87,7 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.10 2014/04/07 14:40:17 skrll Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.11 2014/05/14 14:38:54 joerg Exp $") /* * Workaround Erratum 411920 @@ -268,7 +268,6 @@ Lstart: /* bits to set in the Control Register */ Lcontrol_set: .word CPU_CONTROL_MMU_ENABLE | \ - CPU_CONTROL_AFLT_ENABLE | \ CPU_CONTROL_DC_ENABLE | \ CPU_CONTROL_WBUF_ENABLE |/* not defined in 1176 */ \ CPU_CONTROL_32BP_ENABLE | \
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Mon Apr 7 14:40:18 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Whitespace. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/rpi/rpi_start.S 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_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.9 src/sys/arch/evbarm/rpi/rpi_start.S:1.10 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.9 Tue Apr 1 06:55:29 2014 +++ src/sys/arch/evbarm/rpi/rpi_start.S Mon Apr 7 14:40:17 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.9 2014/04/01 06:55:29 skrll Exp $ */ +/* $NetBSD: rpi_start.S,v 1.10 2014/04/07 14:40:17 skrll Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -87,7 +87,7 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.9 2014/04/01 06:55:29 skrll Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.10 2014/04/07 14:40:17 skrll Exp $") /* * Workaround Erratum 411920 @@ -201,7 +201,7 @@ _C_LABEL(rpi_start): mcr p15, 0, r0, c7, c14, 0 /* Clean and Invalidate Entire Data Cache */ -ldr r2, Lctl_ID_dis /* Disable I+D caches */ + ldr r2, Lctl_ID_dis /* Disable I+D caches */ mrc p15, 0, r1, c1, c0, 0 /* " " " */ and r1, r1, r2 /* " " " */ mcr p15, 0, r1, c1, c0, 0 /* " " " */
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Tue Apr 1 06:55:29 UTC 2014 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c rpi_start.S rpi_vcmbox.c Log Message: Trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/arch/evbarm/rpi/rpi_machdep.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/rpi/rpi_start.S cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/rpi/rpi_vcmbox.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.39 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.40 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.39 Tue Dec 10 16:30:36 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Tue Apr 1 06:55:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.39 2013/12/10 16:30:36 joerg Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.40 2014/04/01 06:55:29 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.39 2013/12/10 16:30:36 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.40 2014/04/01 06:55:29 skrll Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -380,20 +380,20 @@ rpi_bootparams(void) bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANPM, ( #if (NSDHC > 0) - (1 << VCPM_POWER_SDCARD) | + (1 << VCPM_POWER_SDCARD) | #endif #if (NPLCOM > 0) (1 << VCPM_POWER_UART0) | #endif #if (NBCMDWCTWO > 0) - (1 << VCPM_POWER_USB) | + (1 << VCPM_POWER_USB) | #endif #if (NBSCIIC > 0) - (1 << VCPM_POWER_I2C0) | (1 << VCPM_POWER_I2C1) | + (1 << VCPM_POWER_I2C0) | (1 << VCPM_POWER_I2C1) | /* (1 << VCPM_POWER_I2C2) | */ #endif #if (NBCMSPI > 0) - (1 << VCPM_POWER_SPI) | + (1 << VCPM_POWER_SPI) | #endif 0) << 4); @@ -645,7 +645,7 @@ rpi_fb_get_edid_mode(uint32_t *pwidth, u uint8_t edid_data[1024]; uint32_t res; int error; - + error = bcmmbox_request(BCMMBOX_CHANARM2VC, &vb_edid, sizeof(vb_edid), &res); if (error) { @@ -688,7 +688,7 @@ rpi_fb_init(prop_dictionary_t dict) uint32_t width = 0, height = 0; uint32_t res; char *ptr; - int integer; + int integer; int error; if (get_bootconf_option(boot_args, "fb", Index: src/sys/arch/evbarm/rpi/rpi_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.8 src/sys/arch/evbarm/rpi/rpi_start.S:1.9 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.8 Tue Nov 12 17:14:39 2013 +++ src/sys/arch/evbarm/rpi/rpi_start.S Tue Apr 1 06:55:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.8 2013/11/12 17:14:39 skrll Exp $ */ +/* $NetBSD: rpi_start.S,v 1.9 2014/04/01 06:55:29 skrll Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -87,11 +87,11 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.8 2013/11/12 17:14:39 skrll Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.9 2014/04/01 06:55:29 skrll Exp $") /* - * Workaround Erratum 411920 - * + * Workaround Erratum 411920 + * * - value of arg 'reg' Should Be Zero */ #define Invalidate_I_cache(reg) \ @@ -230,12 +230,12 @@ _C_LABEL(rpi_start): ldr r1, Lcontrol_set orr r0, r0, r1 ldr lr, Lstart - + .align 5 @ turn mmu on! mov r0, r0 mcr p15, 0, r0, c1, c0, 0 - + /* * Ensure that the coprocessor has finished turning on the MMU. */ @@ -258,7 +258,7 @@ Ll1_s_frame: Ltemp_l1_table: /* Put the temporary L1 translation table just below the kernel. */ .word 0x4000 - + Lstart: .word start /* Index: src/sys/arch/evbarm/rpi/rpi_vcmbox.c diff -u src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.2 src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.3 --- src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.2 Mon Jan 7 22:32:24 2013 +++ src/sys/arch/evbarm/rpi/rpi_vcmbox.c Tue Apr 1 06:55:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_vcmbox.c,v 1.2 2013/01/07 22:32:24 jmcneill Exp $ */ +/* $NetBSD: rpi_vcmbox.c,v 1.3 2014/04/01 06:55:29 skrll Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.2 2013/01/07 22:32:24 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.3 2014/04/01 06:55:29 skrll Exp $"); #include #include @@ -264,7 +264,7 @@ vcmbox_cpufreq_init(struct vcmbox_softc error = sysctl_createv(&sc->sc_log, 0, &freqnode, &node, CTLFLAG_READWRITE, CTLTYPE_INT, "target", NULL, vcmbox_cpufreq_sysctl_helper, 0, (void *)sc, 0, - CTL_CREATE, CTL_EOL); + CTL_CREATE, CTL_EOL); if (error) goto sysctl_failed; sc->sc_node_target = node->sysctl_num; @@ -272,7 +272,7 @@ vcmbox_cpufreq_init(struct vcmbox_softc error = sysctl_createv(&sc->sc_log, 0, &freqnode, &node, 0, CTLTYPE_INT, "current", NULL, vcmbox_cpufreq_sysctl_helper, 0, (void *)sc, 0, - CTL_CREATE, CTL_EOL); + CTL_CREATE, CTL_EOL); if (error) goto sysctl_fail
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: joerg Date: Tue Dec 10 16:30:36 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Move alignment attribute onto the types, not the variable instances. Drop (unused) packed attribute. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 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.38 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.39 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.38 Tue Oct 15 09:07:48 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Tue Dec 10 16:30:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.38 2013/10/15 09:07:48 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.39 2013/12/10 16:30:36 joerg Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.38 2013/10/15 09:07:48 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.39 2013/12/10 16:30:36 joerg Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_ddb.h" @@ -168,7 +168,7 @@ static struct plcom_instance rpi_pi = { /* Smallest amount of RAM start.elf could give us. */ #define RPI_MINIMUM_SPLIT (128U * 1024 * 1024) -static struct { +static struct __aligned(16) { struct vcprop_buffer_hdr vb_hdr; struct vcprop_tag_fwrev vbt_fwrev; struct vcprop_tag_boardmodel vbt_boardmodel; @@ -180,7 +180,7 @@ static struct { struct vcprop_tag_clockrate vbt_emmcclockrate; struct vcprop_tag_clockrate vbt_armclockrate; struct vcprop_tag end; -} vb __packed __aligned(16) = +} vb = { .vb_hdr = { .vpb_len = sizeof(vb), @@ -257,11 +257,11 @@ static struct { }; #if NGENFB > 0 -static struct { +static struct __aligned(16) { struct vcprop_buffer_hdr vb_hdr; struct vcprop_tag_edidblock vbt_edid; struct vcprop_tag end; -} vb_edid __packed __aligned(16) = +} vb_edid = { .vb_hdr = { .vpb_len = sizeof(vb_edid), @@ -280,7 +280,7 @@ static struct { } }; -static struct { +static struct __aligned(16) { struct vcprop_buffer_hdr vb_hdr; struct vcprop_tag_fbres vbt_res; struct vcprop_tag_fbres vbt_vres; @@ -291,7 +291,7 @@ static struct { struct vcprop_tag_blankscreen vbt_blank; struct vcprop_tag_fbpitch vbt_pitch; struct vcprop_tag end; -} vb_setfb __packed __aligned(16) = +} vb_setfb = { .vb_hdr = { .vpb_len = sizeof(vb_setfb),
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Thu Sep 5 07:09:33 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi.h Log Message: Whitespace To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/rpi/rpi.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/rpi.h diff -u src/sys/arch/evbarm/rpi/rpi.h:1.1 src/sys/arch/evbarm/rpi/rpi.h:1.2 --- src/sys/arch/evbarm/rpi/rpi.h:1.1 Thu Jul 26 06:21:57 2012 +++ src/sys/arch/evbarm/rpi/rpi.h Thu Sep 5 07:09:33 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi.h,v 1.1 2012/07/26 06:21:57 skrll Exp $ */ +/* $NetBSD: rpi.h,v 1.2 2013/09/05 07:09:33 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #define KERNEL_VM_SIZE (0xf000 - KERNEL_VM_BASE) /* - * BCM2835 ARM Peripherals + * BCM2835 ARM Peripherals */ #define RPI_KERNEL_IO_VBASE BCM2835_PERIPHERALS_VBASE #define RPI_KERNEL_IO_PBASE BCM2835_PERIPHERALS_BASE
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sat May 11 14:19:44 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Add attempt at KGDB support from Reiound. I couldn't get gdb to attach properly, but the kernel was definitely in kgdb_trap and would respond to $?#3f if typed via tip(1) To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 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.36 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.37 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.36 Sat May 11 07:42:34 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sat May 11 14:19:44 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.36 2013/05/11 07:42:34 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.37 2013/05/11 14:19:44 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,9 +30,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.36 2013/05/11 07:42:34 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.37 2013/05/11 14:19:44 skrll Exp $"); #include "opt_evbarm_boardtype.h" +#include "opt_ddb.h" +#include "opt_kgdb.h" #include "sdhc.h" #include "dotg.h" @@ -146,8 +148,21 @@ int plcomcnmode = PLCONMODE; #endif #include "opt_kgdb.h" +#if (NPLCOM == 0) +#error Enable plcom for KGDB support +#endif #ifdef KGDB #include +static void kgdb_port_init(void); +#endif + +#if (NPLCOM > 0 && (defined(PLCONSOLE) || defined(KGDB))) +static struct plcom_instance rpi_pi = { + .pi_type = PLCOM_TYPE_PL011, + .pi_flags = PLC_FLAG_32BIT_ACCESS, + .pi_iot = &bcm2835_bs_tag, + .pi_size = BCM2835_UART0_SIZE +}; #endif /* Smallest amount of RAM start.elf could give us. */ @@ -534,6 +549,10 @@ initarm(void *arg) printf("done.\n"); #endif +#ifdef KGDB + kgdb_port_init(); +#endif + #ifdef __HAVE_MEMORY_DISK__ md_root_setconf(memory_disk, sizeof memory_disk); #endif @@ -557,14 +576,7 @@ void consinit(void) { static int consinit_called = 0; -#if (NPLCOM > 0 && defined(PLCONSOLE)) - static struct plcom_instance rpi_pi = { - .pi_type = PLCOM_TYPE_PL011, - .pi_flags = PLC_FLAG_32BIT_ACCESS, - .pi_iot = &bcm2835_bs_tag, - .pi_size = BCM2835_UART0_SIZE - }; -#endif + if (consinit_called != 0) return; @@ -583,6 +595,31 @@ consinit(void) #endif } +#ifdef KGDB +#if !defined(KGDB_PLCOMUNIT) || !defined(KGDB_DEVRATE) || !defined(KGDB_CONMODE) +#error Specify KGDB_PLCOMUNIT, KGDB_DEVRATE and KGDB_CONMODE for KGDB. +#endif + +void +static kgdb_port_init(void) +{ + static int kgdbsinit_called = 0; + int res; + + if (kgdbsinit_called != 0) + return; + + kgdbsinit_called = 1; + + rpi_pi.pi_iobase = consaddr; + + res = plcom_kgdb_attach(&rpi_pi, KGDB_DEVRATE, BCM2835_UART0_CLK, + KGDB_CONMODE, KGDB_PLCOMUNIT); + if (res) + panic("KGDB uart can not be initialized, err=%d.", res); +} +#endif + #if NGENFB > 0 static bool rpi_fb_parse_mode(const char *s, uint32_t *pwidth, uint32_t *pheight)
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Wed Apr 17 06:12:43 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: Added __packed in a couple of places to help AEABI To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 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.7 src/sys/arch/evbarm/rpi/vcprop.h:1.8 --- src/sys/arch/evbarm/rpi/vcprop.h:1.7 Tue Jan 8 15:07:32 2013 +++ src/sys/arch/evbarm/rpi/vcprop.h Wed Apr 17 06:12:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.7 2013/01/08 15:07:32 jmcneill Exp $ */ +/* $NetBSD: vcprop.h,v 1.8 2013/04/17 06:12:42 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -125,12 +125,12 @@ struct vcprop_tag_boardrev { struct vcprop_tag_macaddr { struct vcprop_tag tag; uint64_t addr; -}; +} __packed; struct vcprop_tag_boardserial { struct vcprop_tag tag; uint64_t sn; -}; +} __packed; #define VCPROP_CLK_EMMC 1 #define VCPROP_CLK_UART 2
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Mon Feb 4 21:46:14 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Oops, put back the initialisation of cpu_cc_freq To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 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.33 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.34 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.33 Mon Feb 4 21:43:17 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Mon Feb 4 21:46:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.33 2013/02/04 21:43:17 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.34 2013/02/04 21:46:14 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.33 2013/02/04 21:43:17 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.34 2013/02/04 21:46:14 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -501,13 +501,15 @@ initarm(void *arg) rpi_bootparams(); -#ifdef VERBOSE_INIT_ARM if (vcprop_tag_success_p(&vb.vbt_armclockrate.tag)) { curcpu()->ci_data.cpu_cc_freq = vb.vbt_armclockrate.rate; +#ifdef VERBOSE_INIT_ARM printf("%s: arm clock %d\n", __func__, vb.vbt_armclockrate.rate); +#endif } +#ifdef VERBOSE_INIT_ARM printf("initarm: Configuring system ...\n"); #endif arm32_bootmem_init(bootconfig.dram[0].address,
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Mon Feb 4 21:43:17 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Fix some VERBOSE_INIT_ARM output To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 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.32 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.33 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.32 Mon Jan 28 19:47:02 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Mon Feb 4 21:43:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.32 2013/01/28 19:47:02 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.33 2013/02/04 21:43:17 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.32 2013/01/28 19:47:02 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.33 2013/02/04 21:43:17 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -409,11 +409,6 @@ rpi_bootparams(void) if (vcprop_tag_success_p(&vb.vbt_armclockrate.tag)) curcpu()->ci_data.cpu_cc_freq = vb.vbt_armclockrate.rate; - if (vcprop_tag_success_p(&vb.vbt_macaddr.tag)) - printf("%s: mac-address %llx\n", __func__, - vb.vbt_macaddr.addr); - - #ifdef VERBOSE_INIT_ARM if (vcprop_tag_success_p(&vb.vbt_fwrev.tag)) printf("%s: firmware rev %x\n", __func__, @@ -506,13 +501,13 @@ initarm(void *arg) rpi_bootparams(); +#ifdef VERBOSE_INIT_ARM if (vcprop_tag_success_p(&vb.vbt_armclockrate.tag)) { curcpu()->ci_data.cpu_cc_freq = vb.vbt_armclockrate.rate; printf("%s: arm clock %d\n", __func__, vb.vbt_armclockrate.rate); } -#ifdef VERBOSE_INIT_ARM printf("initarm: Configuring system ...\n"); #endif arm32_bootmem_init(bootconfig.dram[0].address,
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Mon Jan 28 19:47:03 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: add machdep.serial sysctl for getting board serial number To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 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.31 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.32 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.31 Fri Jan 25 13:32:21 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Mon Jan 28 19:47:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.31 2013/01/25 13:32:21 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.32 2013/01/28 19:47:02 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.31 2013/01/25 13:32:21 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.32 2013/01/28 19:47:02 jmcneill Exp $"); #include "opt_evbarm_boardtype.h" @@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include #include #include +#include #include #include @@ -787,3 +788,15 @@ rpi_device_register(device_t dev, void * } #endif } + +SYSCTL_SETUP(sysctl_machdep_rpi, "sysctl machdep subtree setup (rpi)") +{ + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL, + NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL); + + sysctl_createv(clog, 0, NULL, NULL, + CTLFLAG_PERMANENT|CTLFLAG_READONLY|CTLFLAG_HEX|CTLFLAG_PRIVATE, + CTLTYPE_QUAD, "serial", NULL, NULL, 0, + &vb.vbt_serial.sn, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL); +}
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Fri Jan 25 13:32:21 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: dont crash if edid data is missing or bad To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 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.30 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.31 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.30 Mon Jan 21 20:42:22 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Fri Jan 25 13:32:21 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.30 2013/01/21 20:42:22 jakllsch Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.31 2013/01/25 13:32:21 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.30 2013/01/21 20:42:22 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.31 2013/01/25 13:32:21 jmcneill Exp $"); #include "opt_evbarm_boardtype.h" @@ -609,7 +609,8 @@ rpi_fb_get_edid_mode(uint32_t *pwidth, u } if (!vcprop_buffer_success_p(&vb_edid.vb_hdr) || - !vcprop_tag_success_p(&vb_edid.vbt_edid.tag)) + !vcprop_tag_success_p(&vb_edid.vbt_edid.tag) || + vb_edid.vbt_edid.status != 0) return false; memset(edid_data, 0, sizeof(edid_data)); @@ -620,8 +621,10 @@ rpi_fb_get_edid_mode(uint32_t *pwidth, u edid_print(&ei); #endif - *pwidth = ei.edid_preferred_mode->hdisplay; - *pheight = ei.edid_preferred_mode->vdisplay; + if (ei.edid_preferred_mode) { + *pwidth = ei.edid_preferred_mode->hdisplay; + *pheight = ei.edid_preferred_mode->vdisplay; + } return true; }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jakllsch Date: Mon Jan 21 20:42:22 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Assume the first ld@sdmmc to attach is the booted device until possibily-otherwise specified during evbarm cpu_rootconf(). To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 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.29 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.30 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.29 Sat Jan 19 17:45:28 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Mon Jan 21 20:42:22 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.29 2013/01/19 17:45:28 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.30 2013/01/21 20:42:22 jakllsch Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.29 2013/01/19 17:45:28 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.30 2013/01/21 20:42:22 jakllsch Exp $"); #include "opt_evbarm_boardtype.h" @@ -738,6 +738,12 @@ rpi_device_register(device_t dev, void * prop_dictionary_set_uint32(dict, "frequency", vb.vbt_emmcclockrate.rate); } + if (booted_device == NULL && + device_is_a(dev, "ld") && + device_is_a(device_parent(dev), "sdmmc")) { + booted_partition = 0; + booted_device = dev; + } #endif if (device_is_a(dev, "usmsc") && vcprop_tag_success_p(&vb.vbt_macaddr.tag)) {
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Sat Jan 19 17:45:28 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: if the firmware gives us a bad emmc clock rate, ignore it To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 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.28 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.29 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.28 Fri Jan 11 12:47:38 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sat Jan 19 17:45:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.28 2013/01/11 12:47:38 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.29 2013/01/19 17:45:28 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.28 2013/01/11 12:47:38 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.29 2013/01/19 17:45:28 jmcneill Exp $"); #include "opt_evbarm_boardtype.h" @@ -733,7 +733,8 @@ rpi_device_register(device_t dev, void * #if NSDHC > 0 if (device_is_a(dev, "sdhc") && - vcprop_tag_success_p(&vb.vbt_emmcclockrate.tag)) { + vcprop_tag_success_p(&vb.vbt_emmcclockrate.tag) && + vb.vbt_emmcclockrate.rate > 0) { prop_dictionary_set_uint32(dict, "frequency", vb.vbt_emmcclockrate.rate); }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Fri Jan 11 12:47:38 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: allow ukbd to be the console keyboard if genfb is the console display device To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 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.27 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.28 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.27 Thu Jan 10 14:15:20 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Fri Jan 11 12:47:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.27 2013/01/10 14:15:20 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.28 2013/01/11 12:47:38 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.27 2013/01/10 14:15:20 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.28 2013/01/11 12:47:38 jmcneill Exp $"); #include "opt_evbarm_boardtype.h" @@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include "bsciic.h" #include "plcom.h" #include "genfb.h" +#include "ukbd.h" #include #include @@ -81,6 +82,10 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include #endif +#if NUKBD > 0 +#include +#endif + #include "ksyms.h" extern int KERNEL_BASE_phys[]; @@ -762,6 +767,10 @@ rpi_device_register(device_t dev, void * if (get_bootconf_option(boot_args, "console", BOOTOPT_TYPE_STRING, &ptr) && strncmp(ptr, "fb", 2) == 0) { prop_dictionary_set_bool(dict, "is_console", true); +#if NUKBD > 0 + /* allow ukbd to be the console keyboard */ + ukbd_cnattach(); +#endif } else { prop_dictionary_set_bool(dict, "is_console", false); }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Thu Jan 10 14:15:20 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Modify fb attachment so genfb still attaches even if it isn't the console device. Slight change to cmdline.txt to allow for this: - console=fb enables fb console, otherwise serial console will be used - fb=WxH to select a mode, otherwise EDID will be tried and fallback to default mode (1280x720) - fb=disable to disable fb completely To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 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.26 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.27 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.26 Wed Jan 9 23:58:40 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Thu Jan 10 14:15:20 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.26 2013/01/09 23:58:40 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.27 2013/01/10 14:15:20 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.26 2013/01/09 23:58:40 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.27 2013/01/10 14:15:20 jmcneill Exp $"); #include "opt_evbarm_boardtype.h" @@ -574,15 +574,15 @@ consinit(void) static bool rpi_fb_parse_mode(const char *s, uint32_t *pwidth, uint32_t *pheight) { - if (strncmp(s, "fb", 2) != 0) + char *x; + + if (strncmp(s, "disable", 7) == 0) return false; - if (strncmp(s, "fb:", 3) == 0) { - char *x = strchr(s + 3, 'x'); - if (x) { - *pwidth = strtoul(s + 3, NULL, 10); - *pheight = strtoul(x + 1, NULL, 10); - } + x = strchr(s, 'x'); + if (x) { + *pwidth = strtoul(s, NULL, 10); + *pheight = strtoul(x + 1, NULL, 10); } return true; @@ -625,15 +625,9 @@ rpi_fb_get_edid_mode(uint32_t *pwidth, u * Initialize framebuffer console. * * Some notes about boot parameters: - * - If "console=" specifies something other than fb, ignore framebuffer - *completely. - * - If "console=fb" is present, try to use the preferred mode of the - *display from the EDID block. If the EDID block is not present, use - *RPI_FB_WIDTH and RPI_FB_HEIGHT. - * - If "console=fb:x" is present, use the specified mode. - * - * If the specified mode cannot be set, the framebuffer will not be used - * as the console device. + * - If "fb=disable" is present, ignore framebuffer completely. + * - If "fb=x is present, use the specified mode. + * - If "console=fb" is present, attach framebuffer to console. */ static bool rpi_fb_init(prop_dictionary_t dict) @@ -644,24 +638,18 @@ rpi_fb_init(prop_dictionary_t dict) int integer; int error; - if (get_bootconf_option(boot_args, "console", + if (get_bootconf_option(boot_args, "fb", BOOTOPT_TYPE_STRING, &ptr)) { if (rpi_fb_parse_mode(ptr, &width, &height) == false) return false; - if (width == 0 || height == 0) - rpi_fb_get_edid_mode(&width, &height); - if (width == 0 || height == 0) { - width = RPI_FB_WIDTH; - height = RPI_FB_HEIGHT; - } - } else { - /* console= not specified, so only attach if EDID block found */ - if (rpi_fb_get_edid_mode(&width, &height) == false) - return false; } - - if (width == 0 || height == 0) - return false; + if (width == 0 || height == 0) { + rpi_fb_get_edid_mode(&width, &height); + } + if (width == 0 || height == 0) { + width = RPI_FB_WIDTH; + height = RPI_FB_HEIGHT; + } vb_setfb.vbt_res.width = width; vb_setfb.vbt_res.height = height; @@ -768,9 +756,15 @@ rpi_device_register(device_t dev, void * #if NGENFB > 0 if (device_is_a(dev, "genfb")) { + char *ptr; if (rpi_fb_init(dict) == false) return; - prop_dictionary_set_bool(dict, "is_console", true); + if (get_bootconf_option(boot_args, "console", + BOOTOPT_TYPE_STRING, &ptr) && strncmp(ptr, "fb", 2) == 0) { + prop_dictionary_set_bool(dict, "is_console", true); + } else { + prop_dictionary_set_bool(dict, "is_console", false); + } } #endif }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Wed Jan 9 23:04:11 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Provide the mac address for usmsc(4) as read from the firmware. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 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.24 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.25 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.24 Wed Jan 9 22:36:07 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Jan 9 23:04:10 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.24 2013/01/09 22:36:07 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.25 2013/01/09 23:04:10 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.24 2013/01/09 22:36:07 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.25 2013/01/09 23:04:10 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include #include +#include #include #include @@ -402,6 +403,11 @@ rpi_bootparams(void) if (vcprop_tag_success_p(&vb.vbt_armclockrate.tag)) curcpu()->ci_data.cpu_cc_freq = vb.vbt_armclockrate.rate; + if (vcprop_tag_success_p(&vb.vbt_macaddr.tag)) + printf("%s: mac-address %llx\n", __func__, + vb.vbt_macaddr.addr); + + #ifdef VERBOSE_INIT_ARM if (vcprop_tag_success_p(&vb.vbt_fwrev.tag)) printf("%s: firmware rev %x\n", __func__, @@ -732,6 +738,26 @@ rpi_device_register(device_t dev, void * "frequency", vb.vbt_emmcclockrate.rate); } #endif + if (device_is_a(dev, "usmsc") && + vcprop_tag_success_p(&vb.vbt_macaddr.tag)) { + const uint8_t enaddr[ETHER_ADDR_LEN] = { + (vb.vbt_macaddr.addr >> 0) & 0xff, + (vb.vbt_macaddr.addr >> 8) & 0xff, + (vb.vbt_macaddr.addr >> 16) & 0xff, + (vb.vbt_macaddr.addr >> 24) & 0xff, + (vb.vbt_macaddr.addr >> 32) & 0xff, + (vb.vbt_macaddr.addr >> 40) & 0xff + }; + + prop_data_t pd = prop_data_create_data(enaddr, ETHER_ADDR_LEN); + KASSERT(pd != NULL); + if (prop_dictionary_set(device_properties(dev), "mac-address", + pd) == false) { + aprint_error_dev(dev, + "WARNING: Unable to set mac-address property\n"); + } + prop_object_release(pd); + } #if NGENFB > 0 if (device_is_a(dev, "genfb")) {
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Wed Jan 9 22:36:07 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: framebuffer only seems to support BGR mode, so request it and set is_bgr property on device when in BGR mode To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 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.23 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.24 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.23 Wed Jan 9 22:23:44 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Jan 9 22:36:07 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.23 2013/01/09 22:23:44 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.24 2013/01/09 22:36:07 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.23 2013/01/09 22:23:44 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.24 2013/01/09 22:36:07 jmcneill Exp $"); #include "opt_evbarm_boardtype.h" @@ -300,7 +300,7 @@ static struct { .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_pixelorder), .vpt_rcode = VCPROPTAG_REQUEST, }, - .state = VCPROP_PIXEL_RGB, + .state = VCPROP_PIXEL_BGR, }, .vbt_alpha = { .tag = { @@ -690,6 +690,8 @@ rpi_fb_init(prop_dictionary_t dict) vb_setfb.vbt_res.width, vb_setfb.vbt_res.height); printf("%s: vwidth = %d vheight = %d\n", __func__, vb_setfb.vbt_vres.width, vb_setfb.vbt_vres.height); + printf("%s: pixelorder = %d\n", __func__, + vb_setfb.vbt_pixelorder.state); #endif if (vb_setfb.vbt_allocbuf.address == 0 || @@ -711,6 +713,8 @@ rpi_fb_init(prop_dictionary_t dict) vb_setfb.vbt_pitch.linebytes); prop_dictionary_set_uint32(dict, "address", vb_setfb.vbt_allocbuf.address); + if (vb_setfb.vbt_pixelorder.state == VCPROP_PIXEL_BGR) + prop_dictionary_set_bool(dict, "is_bgr", true); return true; }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Wed Jan 9 00:24:54 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: genfb support for rpi To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 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.21 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.22 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.21 Tue Jan 8 16:49:43 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Jan 9 00:24:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.21 2013/01/08 16:49:43 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.22 2013/01/09 00:24:54 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,13 +30,15 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.21 2013/01/08 16:49:43 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.22 2013/01/09 00:24:54 jmcneill Exp $"); #include "opt_evbarm_boardtype.h" #include "sdhc.h" #include "bcmspi.h" #include "bsciic.h" +#include "plcom.h" +#include "genfb.h" #include #include @@ -67,12 +69,16 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include -#include "plcom.h" -#if (NPLCOM > 0) +#if NPLCOM > 0 #include #include #endif +#if NGENFB > 0 +#include +#include +#endif + #include "ksyms.h" extern int KERNEL_BASE_phys[]; @@ -94,6 +100,13 @@ static void rpi_device_register(device_t #define KERN_VTOPHYS(va) ((paddr_t)((vaddr_t)va + KERN_VTOPDIFF)) #define KERN_PHYSTOV(pa) ((vaddr_t)((paddr_t)pa - KERN_VTOPDIFF)) +#ifndef RPI_FB_WIDTH +#define RPI_FB_WIDTH 1280 +#endif +#ifndef RPI_FB_HEIGHT +#define RPI_FB_HEIGHT 720 +#endif + #define PLCONADDR 0x20201000 #ifndef CONSDEVNAME @@ -213,6 +226,118 @@ static struct { } }; +#if NGENFB > 0 +static struct { + struct vcprop_buffer_hdr vb_hdr; + struct vcprop_tag_edidblock vbt_edid; + struct vcprop_tag end; +} vb_edid __packed __aligned(16) = +{ + .vb_hdr = { + .vpb_len = sizeof(vb_edid), + .vpb_rcode = VCPROP_PROCESS_REQUEST, + }, + .vbt_edid = { + .tag = { + .vpt_tag = VCPROPTAG_GET_EDID_BLOCK, + .vpt_len = VCPROPTAG_LEN(vb_edid.vbt_edid), + .vpt_rcode = VCPROPTAG_REQUEST, + }, + .blockno = 0, + }, + .end = { + .vpt_tag = VCPROPTAG_NULL + } +}; + +static struct { + struct vcprop_buffer_hdr vb_hdr; + struct vcprop_tag_fbres vbt_res; + struct vcprop_tag_fbres vbt_vres; + struct vcprop_tag_fbdepth vbt_depth; + struct vcprop_tag_fbpixelorder vbt_pixelorder; + struct vcprop_tag_fbalpha vbt_alpha; + struct vcprop_tag_allocbuf vbt_allocbuf; + struct vcprop_tag_blankscreen vbt_blank; + struct vcprop_tag_fbpitch vbt_pitch; + struct vcprop_tag end; +} vb_setfb __packed __aligned(16) = +{ + .vb_hdr = { + .vpb_len = sizeof(vb_setfb), + .vpb_rcode = VCPROP_PROCESS_REQUEST, + }, + .vbt_res = { + .tag = { + .vpt_tag = VCPROPTAG_SET_FB_RES, + .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_res), + .vpt_rcode = VCPROPTAG_REQUEST, + }, + .width = 0, + .height = 0, + }, + .vbt_vres = { + .tag = { + .vpt_tag = VCPROPTAG_SET_FB_VRES, + .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_vres), + .vpt_rcode = VCPROPTAG_REQUEST, + }, + .width = 0, + .height = 0, + }, + .vbt_depth = { + .tag = { + .vpt_tag = VCPROPTAG_SET_FB_DEPTH, + .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_depth), + .vpt_rcode = VCPROPTAG_REQUEST, + }, + .bpp = 32, + }, + .vbt_pixelorder = { + .tag = { + .vpt_tag = VCPROPTAG_SET_FB_PIXEL_ORDER, + .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_pixelorder), + .vpt_rcode = VCPROPTAG_REQUEST, + }, + .state = VCPROP_PIXEL_RGB, + }, + .vbt_alpha = { + .tag = { + .vpt_tag = VCPROPTAG_SET_FB_ALPHA_MODE, + .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_alpha), + .vpt_rcode = VCPROPTAG_REQUEST, + }, + .state = VCPROP_ALPHA_IGNORED, + }, + .vbt_allocbuf = { + .tag = { + .vpt_tag = VCPROPTAG_ALLOCATE_BUFFER, + .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_allocbuf), + .vpt_rcode = VCPROPTAG_REQUEST, + }, + .address = PAGE_SIZE, /* alignment */ + }, + .vbt_blank = { + .tag = { + .vpt_tag = VCPROPTAG_BLANK_SCREEN, + .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_blank), + .vpt_rcode = VCPROPTAG_REQUEST, + }, + .state = VCPROP_BLANK_OFF, + }, + .vbt_pitch = { + .tag = { + .vpt_tag = VCPROPTAG_GET_FB_PITCH, + .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_pitch), + .vpt_rcode = VCPROPTAG_REQUEST, + }, + }, + .end = { + .vpt_tag = VCPROPTAG_NULL, + }, +}; +#endif + static void rpi_bootparams(void) { @@ -227,7 +352,6 @@ rpi_bootparams(void) #if (NPLCOM > 0) (1 << VCPM_POWER_UART0) | #endif - #if (NBSCIIC > 0) (1 << VCPM_POWER_I2C0) | (1 << VCPM_POWER_I2C1) | /* (1 << VCPM_POWER_I2C2) | */ @@ -244,9 +368,9 @@ rpi_bootparams(void) /* * No need to invalid the cache as the memory has never been referenced * by the ARM. - *
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Tue Jan 8 16:49:43 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Added Files: src/sys/arch/evbarm/rpi: vcpm.h Log Message: Use the VC power manager mailbox channel to power up the devices we have support for. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/rpi/rpi_machdep.c cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/rpi/vcpm.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/rpi_machdep.c diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.20 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.21 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.20 Mon Jan 7 20:42:24 2013 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Tue Jan 8 16:49:43 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.20 2013/01/07 20:42:24 jmcneill Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.21 2013/01/08 16:49:43 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,10 +30,14 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.20 2013/01/07 20:42:24 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.21 2013/01/08 16:49:43 skrll Exp $"); #include "opt_evbarm_boardtype.h" +#include "sdhc.h" +#include "bcmspi.h" +#include "bsciic.h" + #include #include #include @@ -58,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include #include +#include #include #include @@ -215,6 +220,23 @@ rpi_bootparams(void) bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(BCM2835_ARMMBOX_BASE); uint32_t res; + bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANPM, ( +#if (NSDHC > 0) + (1 << VCPM_POWER_SDCARD) | +#endif +#if (NPLCOM > 0) + (1 << VCPM_POWER_UART0) | +#endif + +#if (NBSCIIC > 0) + (1 << VCPM_POWER_I2C0) | (1 << VCPM_POWER_I2C1) | + /* (1 << VCPM_POWER_I2C2) | */ +#endif +#if (NBCMSPI > 0) + (1 << VCPM_POWER_SPI) | +#endif + 0) << 4); + bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANARM2VC, KERN_VTOPHYS(&vb)); bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, &res); Added files: Index: src/sys/arch/evbarm/rpi/vcpm.h diff -u /dev/null src/sys/arch/evbarm/rpi/vcpm.h:1.1 --- /dev/null Tue Jan 8 16:49:43 2013 +++ src/sys/arch/evbarm/rpi/vcpm.h Tue Jan 8 16:49:43 2013 @@ -0,0 +1,49 @@ +/* $NetBSD: vcpm.h,v 1.1 2013/01/08 16:49:43 skrll Exp $ */ + +/*- + * Copyright (c) 2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson + * + * 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. + */ + +/* + * Power Manager Mailbox interface + */ + +#ifndef _EVBARM_RPI_VCPM_H_ +#define _EVBARM_RPI_VCPM_H_ + +#define VCPM_POWER_SDCARD 0 +#define VCPM_POWER_UART0 1 +#define VCPM_POWER_UART1 2 +#define VCPM_POWER_USB 3 +#define VCPM_POWER_I2C0 4 +#define VCPM_POWER_I2C1 5 +#define VCPM_POWER_I2C2 6 +#define VCPM_POWER_SPI 7 +#define VCPM_POWER_CCP2TX 8 + +#endif /* _EVBARM_RPI_VCPM_H_ */
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Tue Jan 8 15:07:32 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: add vc fb alpha and screen blanking tags To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/arch/evbarm/rpi/vcprop.h:1.7 --- src/sys/arch/evbarm/rpi/vcprop.h:1.6 Tue Jan 8 13:02:54 2013 +++ src/sys/arch/evbarm/rpi/vcprop.h Tue Jan 8 15:07:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.6 2013/01/08 13:02:54 jmcneill Exp $ */ +/* $NetBSD: vcprop.h,v 1.7 2013/01/08 15:07:32 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -71,12 +71,17 @@ struct vcprop_tag { #define VCPROPTAG_GET_DMACHAN 0x00060001 #define VCPROPTAG_ALLOCATE_BUFFER 0x00040001 +#define VCPROPTAG_BLANK_SCREEN 0x00040002 #define VCPROPTAG_GET_FB_RES 0x00040003 #define VCPROPTAG_SET_FB_RES 0x00048003 +#define VCPROPTAG_GET_FB_VRES 0x00040004 +#define VCPROPTAG_SET_FB_VRES 0x00048004 #define VCPROPTAG_GET_FB_DEPTH 0x00040005 #define VCPROPTAG_SET_FB_DEPTH 0x00048005 #define VCPROPTAG_GET_FB_PIXEL_ORDER 0x00040006 #define VCPROPTAG_SET_FB_PIXEL_ORDER 0x00048006 +#define VCPROPTAG_GET_FB_ALPHA_MODE 0x00040007 +#define VCPROPTAG_SET_FB_ALPHA_MODE 0x00048007 #define VCPROPTAG_GET_FB_PITCH 0x00040008 #define VCPROPTAG_GET_EDID_BLOCK 0x00030020 @@ -219,6 +224,14 @@ struct vcprop_tag_allocbuf { uint32_t size; }; +#define VCPROP_BLANK_OFF 0 +#define VCPROP_BLANK_ON 1 + +struct vcprop_tag_blankscreen { + struct vcprop_tag tag; + uint32_t state; +}; + struct vcprop_tag_fbres { struct vcprop_tag tag; uint32_t width; @@ -243,6 +256,15 @@ struct vcprop_tag_fbpitch { uint32_t linebytes; }; +#define VCPROP_ALPHA_ENABLED 0 +#define VCPROP_ALPHA_REVERSED 1 +#define VCPROP_ALPHA_IGNORED 2 + +struct vcprop_tag_fbalpha { + struct vcprop_tag tag; + uint32_t state; +}; + struct vcprop_tag_edidblock { struct vcprop_tag tag; uint32_t blockno;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Tue Jan 8 13:02:54 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: add a couple more fb prop tags To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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.5 src/sys/arch/evbarm/rpi/vcprop.h:1.6 --- src/sys/arch/evbarm/rpi/vcprop.h:1.5 Tue Jan 8 10:23:50 2013 +++ src/sys/arch/evbarm/rpi/vcprop.h Tue Jan 8 13:02:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.5 2013/01/08 10:23:50 jmcneill Exp $ */ +/* $NetBSD: vcprop.h,v 1.6 2013/01/08 13:02:54 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -72,8 +72,11 @@ struct vcprop_tag { #define VCPROPTAG_ALLOCATE_BUFFER 0x00040001 #define VCPROPTAG_GET_FB_RES 0x00040003 +#define VCPROPTAG_SET_FB_RES 0x00048003 #define VCPROPTAG_GET_FB_DEPTH 0x00040005 +#define VCPROPTAG_SET_FB_DEPTH 0x00048005 #define VCPROPTAG_GET_FB_PIXEL_ORDER 0x00040006 +#define VCPROPTAG_SET_FB_PIXEL_ORDER 0x00048006 #define VCPROPTAG_GET_FB_PITCH 0x00040008 #define VCPROPTAG_GET_EDID_BLOCK 0x00030020
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Tue Jan 8 10:23:51 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: add some framebuffer related vc tags To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/arch/evbarm/rpi/vcprop.h:1.5 --- src/sys/arch/evbarm/rpi/vcprop.h:1.4 Mon Jan 7 22:32:24 2013 +++ src/sys/arch/evbarm/rpi/vcprop.h Tue Jan 8 10:23:50 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.4 2013/01/07 22:32:24 jmcneill Exp $ */ +/* $NetBSD: vcprop.h,v 1.5 2013/01/08 10:23:50 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -69,6 +69,16 @@ struct vcprop_tag { #define VCPROPTAG_GET_CMDLINE 0x00050001 #define VCPROPTAG_GET_DMACHAN 0x00060001 + +#define VCPROPTAG_ALLOCATE_BUFFER 0x00040001 +#define VCPROPTAG_GET_FB_RES 0x00040003 +#define VCPROPTAG_GET_FB_DEPTH 0x00040005 +#define VCPROPTAG_GET_FB_PIXEL_ORDER 0x00040006 +#define VCPROPTAG_GET_FB_PITCH 0x00040008 + +#define VCPROPTAG_GET_EDID_BLOCK 0x00030020 + + uint32_t vpt_len; uint32_t vpt_rcode; #define VCPROPTAG_REQUEST (0U << 31) @@ -200,6 +210,43 @@ struct vcprop_tag_powerstate { uint32_t state; }; +struct vcprop_tag_allocbuf { + struct vcprop_tag tag; + uint32_t address; /* alignment for request */ + uint32_t size; +}; + +struct vcprop_tag_fbres { + struct vcprop_tag tag; + uint32_t width; + uint32_t height; +}; + +struct vcprop_tag_fbdepth { + struct vcprop_tag tag; + uint32_t bpp; +}; + +#define VCPROP_PIXEL_BGR 0 +#define VCPROP_PIXEL_RGB 1 + +struct vcprop_tag_fbpixelorder { + struct vcprop_tag tag; + uint32_t state; +}; + +struct vcprop_tag_fbpitch { + struct vcprop_tag tag; + uint32_t linebytes; +}; + +struct vcprop_tag_edidblock { + struct vcprop_tag tag; + uint32_t blockno; + uint32_t status; + uint8_t data[128]; +}; + struct vcprop_buffer_hdr { uint32_t vpb_len; uint32_t vpb_rcode;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Mon Jan 7 22:32:24 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_vcmbox.c vcprop.h Log Message: Add support for rpi cpu frequency scaling through machdep.cpu.frequency.* sysctls. The minimum and maximum supported frequencies are based on the "arm_freq_min" and "arm_freq" values in config.txt. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/rpi/rpi_vcmbox.c cvs rdiff -u -r1.3 -r1.4 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/rpi_vcmbox.c diff -u src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.1 src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.2 --- src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.1 Mon Jan 7 20:19:33 2013 +++ src/sys/arch/evbarm/rpi/rpi_vcmbox.c Mon Jan 7 22:32:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_vcmbox.c,v 1.1 2013/01/07 20:19:33 jmcneill Exp $ */ +/* $NetBSD: rpi_vcmbox.c,v 1.2 2013/01/07 22:32:24 jmcneill Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.1 2013/01/07 20:19:33 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.2 2013/01/07 22:32:24 jmcneill Exp $"); #include #include @@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c #include #include #include +#include #include @@ -54,6 +55,15 @@ struct vcmbox_temp_request { struct vcprop_tag end; } __packed; +struct vcmbox_clockrate_request { + struct vcprop_buffer_hdr vb_hdr; + struct vcprop_tag_clockrate vbt_clockrate; + struct vcprop_tag end; +} __packed; + +#define RATE2MHZ(rate) ((rate) / 100) +#define MHZ2RATE(mhz) ((mhz) * 100) + #define VCMBOX_INIT_REQUEST(req) \ do {\ memset(&(req), 0, sizeof((req))); \ @@ -76,6 +86,15 @@ struct vcmbox_softc { #define VCMBOX_SENSOR_TEMP 0 #define VCMBOX_NSENSORS 1 envsys_data_t sc_sensor[VCMBOX_NSENSORS]; + + /* cpu frequency scaling */ + struct sysctllog *sc_log; + uint32_t sc_cpu_minrate; + uint32_t sc_cpu_maxrate; + int sc_node_target; + int sc_node_current; + int sc_node_min; + int sc_node_max; }; static const char *vcmbox_sensor_name[VCMBOX_NSENSORS] = { @@ -89,9 +108,17 @@ static int vcmbox_sensor_id[VCMBOX_NSENS static int vcmbox_match(device_t, cfdata_t, void *); static void vcmbox_attach(device_t, device_t, void *); -static void vcmbox_create_sensors(struct vcmbox_softc *); static int vcmbox_read_temp(struct vcmbox_softc *, uint32_t, int, uint32_t *); +static int vcmbox_read_clockrate(struct vcmbox_softc *, uint32_t, int, + uint32_t *); +static int vcmbox_write_clockrate(struct vcmbox_softc *, uint32_t, int, + uint32_t); + +static int vcmbox_cpufreq_init(struct vcmbox_softc *); +static int vcmbox_cpufreq_sysctl_helper(SYSCTLFN_PROTO); + +static void vcmbox_create_sensors(struct vcmbox_softc *); static void vcmbox_sensor_get_limits(struct sysmon_envsys *, envsys_data_t *, sysmon_envsys_lim_t *, uint32_t *); @@ -117,6 +144,8 @@ vcmbox_attach(device_t parent, device_t aprint_naive("\n"); aprint_normal("\n"); + vcmbox_cpufreq_init(sc); + sc->sc_sme = sysmon_envsys_create(); sc->sc_sme->sme_cookie = sc; sc->sc_sme->sme_name = device_xname(sc->sc_dev); @@ -126,28 +155,6 @@ vcmbox_attach(device_t parent, device_t sysmon_envsys_register(sc->sc_sme); } -static void -vcmbox_create_sensors(struct vcmbox_softc *sc) -{ - uint32_t val; - - sc->sc_sensor[VCMBOX_SENSOR_TEMP].sensor = VCMBOX_SENSOR_TEMP; - sc->sc_sensor[VCMBOX_SENSOR_TEMP].units = ENVSYS_STEMP; - sc->sc_sensor[VCMBOX_SENSOR_TEMP].state = ENVSYS_SINVALID; - sc->sc_sensor[VCMBOX_SENSOR_TEMP].flags = ENVSYS_FHAS_ENTROPY; - strlcpy(sc->sc_sensor[VCMBOX_SENSOR_TEMP].desc, - vcmbox_sensor_name[VCMBOX_SENSOR_TEMP], - sizeof(sc->sc_sensor[VCMBOX_SENSOR_TEMP].desc)); - if (vcmbox_read_temp(sc, VCPROPTAG_GET_MAX_TEMPERATURE, - vcmbox_sensor_id[VCMBOX_SENSOR_TEMP], &val) == 0) { - sc->sc_sensor[VCMBOX_SENSOR_TEMP].value_max = - val * 1000 + 27315; - sc->sc_sensor[VCMBOX_SENSOR_TEMP].flags |= ENVSYS_FVALID_MAX; - } - sysmon_envsys_sensor_attach(sc->sc_sme, - &sc->sc_sensor[VCMBOX_SENSOR_TEMP]); -} - static int vcmbox_read_temp(struct vcmbox_softc *sc, uint32_t tag, int id, uint32_t *val) { @@ -170,6 +177,198 @@ vcmbox_read_temp(struct vcmbox_softc *sc return 0; } +static int +vcmbox_read_clockrate(struct vcmbox_softc *sc, uint32_t tag, int id, +uint32_t *val) +{ + struct vcmbox_clockrate_request vb; + uint32_t res; + int error; + + VCMBOX_INIT_REQUEST(vb); + VCMBOX_INIT_TAG(vb.vbt_clockrate, tag); + vb.vbt_clockrate.id = id; + error = bcmmbox_request(BCMMBOX_CHANARM2VC, &vb, sizeof(vb), &res); + if (error) + return error; + if (!vcprop_buffer_success_p(&vb.vb_hdr) || + !vcprop_tag_success_p(&vb.vbt_clockrate.tag)) { + return EIO; +
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Mon Jan 7 20:42:24 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: pass cmdline.txt boot arguments to kernel To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 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.19 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.20 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.19 Wed Dec 19 15:49:47 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Mon Jan 7 20:42:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.19 2012/12/19 15:49:47 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.20 2013/01/07 20:42:24 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.19 2012/12/19 15:49:47 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.20 2013/01/07 20:42:24 jmcneill Exp $"); #include "opt_evbarm_boardtype.h" @@ -362,6 +362,8 @@ initarm(void *arg) md_root_setconf(memory_disk, sizeof memory_disk); #endif + if (vcprop_tag_success_p(&vb.vbt_cmdline.tag)) + strlcpy(bootargs, vb.vbt_cmdline.cmdline, sizeof(bootargs)); boot_args = bootargs; parse_mi_bootargs(boot_args);
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jmcneill Date: Mon Jan 7 20:18:28 UTC 2013 Modified Files: src/sys/arch/evbarm/rpi: vcprop.h Log Message: add some more vcprop definitions -- power, temperature, and voltage related To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 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.2 src/sys/arch/evbarm/rpi/vcprop.h:1.3 --- src/sys/arch/evbarm/rpi/vcprop.h:1.2 Tue Oct 30 20:11:37 2012 +++ src/sys/arch/evbarm/rpi/vcprop.h Mon Jan 7 20:18:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.2 2012/10/30 20:11:37 skrll Exp $ */ +/* $NetBSD: vcprop.h,v 1.3 2013/01/07 20:18:28 jmcneill Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -48,11 +48,23 @@ struct vcprop_tag { #define VCPROPTAG_GET_VCMEMORY 0x00010006 #define VCPROPTAG_GET_CLOCKS 0x00010007 +#define VCPROPTAG_GET_POWERSTATE 0x00020001 +#define VCPROPTAG_GET_POWERTIMING 0x00020002 +#define VCPROPTAG_SET_POWERSTATE 0x00028001 + #define VCPROPTAG_GET_CLOCKSTATE 0x00030001 #define VCPROPTAG_SET_CLOCKSTATE 0x00038001 #define VCPROPTAG_GET_CLOCKRATE 0x00030002 #define VCPROPTAG_SET_CLOCKRATE 0x00038002 - + +#define VCPROPTAG_GET_VOLTAGE 0x00030003 +#define VCPROPTAG_SET_VOLTAGE 0x00038003 +#define VCPROPTAG_GET_MIN_VOLTAGE 0x00030008 +#define VCPROPTAG_GET_MAX_VOLTAGE 0x00030005 + +#define VCPROPTAG_GET_TEMPERATURE 0x00030006 +#define VCPROPTAG_GET_MAX_TEMPERATURE 0x0003000a + #define VCPROPTAG_GET_CMDLINE 0x00050001 #define VCPROPTAG_GET_DMACHAN 0x00060001 uint32_t vpt_len; @@ -100,7 +112,6 @@ struct vcprop_tag_boardserial { uint64_t sn; }; - #define VCPROP_CLK_EMMC 1 #define VCPROP_CLK_UART 2 #define VCPROP_CLK_ARM 3 @@ -146,6 +157,47 @@ struct vcprop_tag_clockrate { uint32_t rate; }; +#define VCPROP_VOLTAGE_CORE 1 +#define VCPROP_VOLTAGE_SDRAM_C 2 +#define VCPROP_VOLTAGE_SDRAM_P 3 +#define VCPROP_VOLTAGE_SDRAM_I 4 + +struct vcprop_tag_voltage { + struct vcprop_tag tag; + uint32_t id; + uint32_t value; +}; + +#define VCPROP_TEMP_SOC 0 + +struct vcprop_tag_temperature { + struct vcprop_tag tag; + uint32_t id; + uint32_t value; +}; + +#define VCPROP_POWER_SDCARD 0 +#define VCPROP_POWER_UART0 1 +#define VCPROP_POWER_UART1 2 +#define VCPROP_POWER_USB 3 +#define VCPROP_POWER_I2C0 4 +#define VCPROP_POWER_I2C1 5 +#define VCPROP_POWER_I2C2 6 +#define VCPROP_POWER_SPI 7 +#define VCPROP_POWER_CCP2TX 8 + +struct vcprop_tag_powertiming { + struct vcprop_tag tag; + uint32_t id; + uint32_t waitusec; +}; + +struct vcprop_tag_powerstate { + struct vcprop_tag tag; + uint32_t id; + uint32_t state; +}; + struct vcprop_buffer_hdr { uint32_t vpb_len; uint32_t vpb_rcode;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Wed Dec 19 15:49:47 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Get the CPU frequency and set cpu_cc_freq. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 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.18 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.19 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.18 Tue Oct 30 20:14:22 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Dec 19 15:49:47 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.18 2012/10/30 20:14:22 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.19 2012/12/19 15:49:47 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.18 2012/10/30 20:14:22 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.19 2012/12/19 15:49:47 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -130,6 +130,7 @@ static struct { struct vcprop_tag_boardserial vbt_serial; struct vcprop_tag_cmdline vbt_cmdline; struct vcprop_tag_clockrate vbt_emmcclockrate; + struct vcprop_tag_clockrate vbt_armclockrate; struct vcprop_tag end; } vb __packed __aligned(16) = { @@ -194,6 +195,14 @@ static struct { }, .id = VCPROP_CLK_EMMC }, + .vbt_armclockrate = { + .tag = { + .vpt_tag = VCPROPTAG_GET_CLOCKRATE, + .vpt_len = VCPROPTAG_LEN(vb.vbt_armclockrate), + .vpt_rcode = VCPROPTAG_REQUEST + }, + .id = VCPROP_CLK_ARM + }, .end = { .vpt_tag = VCPROPTAG_NULL } @@ -239,6 +248,9 @@ rpi_bootparams(void) bootconfig.dramblocks++; } } + + if (vcprop_tag_success_p(&vb.vbt_armclockrate.tag)) + curcpu()->ci_data.cpu_cc_freq = vb.vbt_armclockrate.rate; #ifdef VERBOSE_INIT_ARM if (vcprop_tag_success_p(&vb.vbt_fwrev.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/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 -__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: Fri Oct 26 10:03:13 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Count the memory regions in bootconfig.dramblocks when using the VCPROP information. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 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.15 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.16 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.15 Fri Oct 19 12:33:27 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Fri Oct 26 10:03:13 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.15 2012/10/19 12:33:27 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.16 2012/10/26 10:03:13 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.15 2012/10/19 12:33:27 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.16 2012/10/26 10:03:13 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -218,9 +218,12 @@ rpi_bootparams(void) size_t n = vcprop_tag_resplen(&vptp_mem->tag) / sizeof(struct vcprop_memory); + bootconfig.dramblocks = 0; + for (int i = 0; i < n && i < DRAM_BLOCKS; i++) { bootconfig.dram[i].address = vptp_mem->mem[i].base; bootconfig.dram[i].pages = atop(vptp_mem->mem[i].size); + bootconfig.dramblocks++; } }
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Fri Oct 19 12:33:27 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Make the first 8 pages available for use. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 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.14 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.15 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.14 Fri Oct 19 11:31:50 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Fri Oct 19 12:33:27 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.14 2012/10/19 11:31:50 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.15 2012/10/19 12:33:27 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.14 2012/10/19 11:31:50 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.15 2012/10/19 12:33:27 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -67,6 +67,9 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include "ksyms.h" +extern int KERNEL_BASE_phys[]; +extern int KERNEL_BASE_virt[]; + BootConfig bootconfig; /* Boot config storage */ static char bootargs[MAX_BOOT_STRING]; char *boot_args = NULL; @@ -77,12 +80,10 @@ void rpi_bootparams(void); * Macros to translate between physical and virtual for a subset of the * kernel address space. *Not* for general use. */ -#define KERNEL_BASE_PHYS (paddr_t)0 -#define KERN_VTOPHYS(va) \ - ((paddr_t)((vaddr_t)va - KERNEL_BASE + KERNEL_BASE_PHYS)) -#define KERN_PHYSTOV(pa) \ - ((vaddr_t)((paddr_t)pa - KERNEL_BASE_PHYS + KERNEL_BASE)) +#define KERN_VTOPDIFF ((vaddr_t)KERNEL_BASE_phys - (vaddr_t)KERNEL_BASE_virt) +#define KERN_VTOPHYS(va) ((paddr_t)((vaddr_t)va + KERN_VTOPDIFF)) +#define KERN_PHYSTOV(pa) ((vaddr_t)((paddr_t)pa - KERN_VTOPDIFF)) #define PLCONADDR 0x20201000 @@ -318,7 +319,7 @@ initarm(void *arg) printf("initarm: Configuring system ...\n"); #endif arm32_bootmem_init(bootconfig.dram[0].address, - bootconfig.dram[0].pages * PAGE_SIZE, bootconfig.dram[0].address); + bootconfig.dram[0].pages * PAGE_SIZE, (uintptr_t)KERNEL_BASE_phys); arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, rpi_devmap, false);
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Fri Oct 19 11:31:51 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Style change. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 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.13 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.14 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.13 Sun Oct 14 16:16:52 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Fri Oct 19 11:31:50 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.13 2012/10/14 16:16:52 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.14 2012/10/19 11:31:50 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.13 2012/10/14 16:16:52 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.14 2012/10/19 11:31:50 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -300,7 +300,7 @@ initarm(void *arg) panic("cpu not recognized!"); /* map some peripheral registers */ - pmap_devmap_bootstrap((vaddr_t)armreg_ttbr_read() & ~(L1_TABLE_SIZE - 1), + pmap_devmap_bootstrap((vaddr_t)armreg_ttbr_read() & -L1_TABLE_SIZE, rpi_devmap); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sun Oct 14 16:16:52 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Added Files: src/sys/arch/evbarm/rpi: vcio.h vcprop.h Log Message: Add the Raspberry PI firmware VC mailbox channel numbers. Add some VC property tag definitions and use them to get ARM/VC memory split. Grab a few others things in the process, but don't do anything other than display them when VERBOSE_INIT_ARM is defined. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/rpi/rpi_machdep.c cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/rpi/vcio.h \ 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/rpi_machdep.c diff -u src/sys/arch/evbarm/rpi/rpi_machdep.c:1.12 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.13 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.12 Sat Oct 13 14:22:12 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sun Oct 14 16:16:52 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.12 2012/10/13 14:22:12 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.13 2012/10/14 16:16:52 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.12 2012/10/13 14:22:12 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.13 2012/10/14 16:16:52 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -49,8 +49,13 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include #include +#include #include #include +#include + +#include +#include #include @@ -66,11 +71,16 @@ BootConfig bootconfig; /* Boot config s static char bootargs[MAX_BOOT_STRING]; char *boot_args = NULL; +void rpi_bootparams(void); + /* * Macros to translate between physical and virtual for a subset of the * kernel address space. *Not* for general use. */ -#define KERNEL_BASE_PHYS (paddr_t)0 +#define KERNEL_BASE_PHYS (paddr_t)0 + +#define KERN_VTOPHYS(va) \ + ((paddr_t)((vaddr_t)va - KERNEL_BASE + KERNEL_BASE_PHYS)) #define KERN_PHYSTOV(pa) \ ((vaddr_t)((paddr_t)pa - KERNEL_BASE_PHYS + KERNEL_BASE)) @@ -103,7 +113,137 @@ int plcomcnmode = PLCONMODE; #endif /* Smallest amount of RAM start.elf could give us. */ -#define RPI_MINIMUM_ARM_RAM_SPLIT (128U * 1024 * 1024) +#define RPI_MINIMUM_SPLIT (128U * 1024 * 1024) + +static struct { + struct vcprop_buffer_hdr vb_hdr; + struct vcprop_tag_fwrev vbt_fwrev; + struct vcprop_tag_boardmodel vbt_boardmodel; + struct vcprop_tag_boardrev vbt_boardrev; + struct vcprop_tag_macaddr vbt_macaddr; + struct vcprop_tag_memory vbt_memory; + struct vcprop_tag_boardserial vbt_serial; + struct vcprop_tag_cmdline vbt_cmdline; + struct vcprop_tag end; +} vb __packed __aligned(16) = +{ + .vb_hdr = { + .vpb_len = sizeof(vb), + .vpb_rcode = VCPROP_PROCESS_REQUEST, + }, + .vbt_fwrev = { + .tag = { + .vpt_tag = VCPROPTAG_GET_FIRMWAREREV, + .vpt_len = VCPROPTAG_LEN(vb.vbt_fwrev), + .vpt_rcode = VCPROPTAG_REQUEST + }, + }, + .vbt_boardmodel = { + .tag = { + .vpt_tag = VCPROPTAG_GET_BOARDMODEL, + .vpt_len = VCPROPTAG_LEN(vb.vbt_boardmodel), + .vpt_rcode = VCPROPTAG_REQUEST + }, + }, + .vbt_boardrev = { + .tag = { + .vpt_tag = VCPROPTAG_GET_BOARDREVISION, + .vpt_len = VCPROPTAG_LEN(vb.vbt_boardrev), + .vpt_rcode = VCPROPTAG_REQUEST + }, + }, + .vbt_macaddr = { + .tag = { + .vpt_tag = VCPROPTAG_GET_MACADDRESS, + .vpt_len = VCPROPTAG_LEN(vb.vbt_macaddr), + .vpt_rcode = VCPROPTAG_REQUEST + }, + }, + .vbt_memory = { + .tag = { + .vpt_tag = VCPROPTAG_GET_ARMMEMORY, + .vpt_len = VCPROPTAG_LEN(vb.vbt_memory), + .vpt_rcode = VCPROPTAG_REQUEST + }, + }, + .vbt_serial = { + .tag = { + .vpt_tag = VCPROPTAG_GET_BOARDSERIAL, + .vpt_len = VCPROPTAG_LEN(vb.vbt_serial), + .vpt_rcode = VCPROPTAG_REQUEST + }, + }, + .vbt_cmdline = { + .tag = { + .vpt_tag = VCPROPTAG_GET_CMDLINE, + .vpt_len = VCPROPTAG_LEN(vb.vbt_cmdline), + .vpt_rcode = VCPROPTAG_REQUEST + }, + }, + .end = { + .vpt_tag = VCPROPTAG_NULL + } +}; + +void +rpi_bootparams(void) +{ + bus_space_tag_t iot = &bcm2835_bs_tag; + bus_space_handle_t ioh = BCM2835_IOPHYSTOVIRT(BCM2835_ARMMBOX_BASE); + uint32_t res; + + bcm2835_mbox_write(iot, ioh, BCMMBOX_CHANARM2VC, KERN_VTOPHYS(&vb)); + + bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, &res); + + /* + * No need to invalid the cache as the memory has never been referenced + * by the ARM. + * + * cpu_dcache_inv_range((vaddr_t)&vb, sizeof(vb)); + * + */ + + if (!vcprop_buffer_success_p(&vb.vb_hdr)) { + bootconfig.dramblocks = 1; + bootconfig.dram[0].address = 0x0; + bootconfig.dram[0].pages = atop(RPI_MINIMUM_SPLIT); + return; + } + + struct vcprop_tag_memory *vptp_mem = &vb.vbt_memory; + + if (vcprop_tag_success_p(&vptp_mem->tag)) { + size_t n = vcprop_tag_resplen(&vptp_mem->tag) / + sizeof(struct vcprop_m
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sat Oct 13 14:22:13 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Remove some unused includes To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.12 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.11 Wed Oct 3 13:13:38 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sat Oct 13 14:22:12 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.11 2012/10/03 13:13:38 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.12 2012/10/13 14:22:12 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,14 +30,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.11 2012/10/03 13:13:38 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.12 2012/10/13 14:22:12 skrll Exp $"); #include "opt_evbarm_boardtype.h" #include #include -#include -#include #include #include @@ -64,7 +62,6 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include "ksyms.h" - BootConfig bootconfig; /* Boot config storage */ static char bootargs[MAX_BOOT_STRING]; char *boot_args = NULL;
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Wed Oct 3 13:13:39 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Use armreg_ttbr_read instead of local version. No code change. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 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.10 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.11 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.10 Wed Oct 3 13:06:06 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Oct 3 13:13:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.10 2012/10/03 13:06:06 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.11 2012/10/03 13:13:38 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.10 2012/10/03 13:06:06 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.11 2012/10/03 13:13:38 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -108,17 +108,6 @@ int plcomcnmode = PLCONMODE; /* Smallest amount of RAM start.elf could give us. */ #define RPI_MINIMUM_ARM_RAM_SPLIT (128U * 1024 * 1024) -static inline -pd_entry_t * -read_ttb(void) -{ - long ttb; - - __asm volatile("mrc p15, 0, %0, c2, c0, 0" : "=r" (ttb)); - - return (pd_entry_t *)(ttb & ~((1<<14)-1)); -} - /* * Static device mappings. These peripheral registers are mapped at * fixed virtual addresses very early in initarm() so that we can use @@ -231,7 +220,8 @@ initarm(void *arg) panic("cpu not recognized!"); /* map some peripheral registers */ - pmap_devmap_bootstrap((vaddr_t)read_ttb(), rpi_devmap); + pmap_devmap_bootstrap((vaddr_t)armreg_ttbr_read() & ~(L1_TABLE_SIZE - 1), + rpi_devmap); cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Wed Oct 3 13:06:06 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Remove one set of _[AS] defines. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 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.9 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.10 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.9 Wed Oct 3 13:01:27 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Oct 3 13:06:06 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.9 2012/10/03 13:01:27 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.10 2012/10/03 13:06:06 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.9 2012/10/03 13:01:27 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.10 2012/10/03 13:06:06 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -108,6 +108,16 @@ int plcomcnmode = PLCONMODE; /* Smallest amount of RAM start.elf could give us. */ #define RPI_MINIMUM_ARM_RAM_SPLIT (128U * 1024 * 1024) +static inline +pd_entry_t * +read_ttb(void) +{ + long ttb; + + __asm volatile("mrc p15, 0, %0, c2, c0, 0" : "=r" (ttb)); + + return (pd_entry_t *)(ttb & ~((1<<14)-1)); +} /* * Static device mappings. These peripheral registers are mapped at @@ -123,19 +133,6 @@ int plcomcnmode = PLCONMODE; * registers segment-aligned and segment-rounded in order to avoid * using the 2nd page tables. */ -#define _A(a) ((a) & ~L1_S_OFFSET) -#define _S(s) (((s) + L1_S_SIZE - 1) & ~(L1_S_SIZE-1)) - -static inline -pd_entry_t * -read_ttb(void) -{ - long ttb; - - __asm volatile("mrc p15, 0, %0, c2, c0, 0" : "=r" (ttb)); - - return (pd_entry_t *)(ttb & ~((1<<14)-1)); -} #define _A(a) ((a) & ~L1_S_OFFSET) #define _S(s) (((s) + L1_S_SIZE - 1) & ~(L1_S_SIZE-1))
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Wed Oct 3 13:01:27 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Remove some unnecessary headers. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 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.8 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.9 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.8 Wed Oct 3 13:00:47 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Oct 3 13:01:27 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.8 2012/10/03 13:00:47 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.9 2012/10/03 13:01:27 skrll Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.8 2012/10/03 13:00:47 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.9 2012/10/03 13:01:27 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -45,8 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include -#include -#include #include #include
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Wed Oct 3 13:00:47 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Update copyright To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 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.7 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.8 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.7 Sat Sep 1 17:14:56 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Wed Oct 3 13:00:47 2012 @@ -1,37 +1,11 @@ -/* $NetBSD: rpi_machdep.c,v 1.7 2012/09/01 17:14:56 skrll Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.8 2012/10/03 13:00:47 skrll Exp $ */ -/* - * Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved. - * Written by Hiroyuki Bessho for Genetec Corporation. - * - * 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. - * 3. The name of Genetec Corporation may not be used to endorse or - *promote products derived from this software without specific prior - *written permission. - * - * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION - * 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. - * - * Copyright (c) 2001 Wasabi Systems, Inc. +/*- + * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. * - * Written by Jason R. Thorpe for Wasabi Systems, Inc. + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -41,18 +15,11 @@ * 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. - * 3. All advertising materials mentioning features or use of this software - *must display the following acknowledgement: - * This product includes software developed for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - *or promote products derived from this software without specific prior - *written permission. * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * 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 WASABI SYSTEMS, INC + * 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 @@ -60,69 +27,10 @@ * 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. - * - * Copyright (c) 1997,1998 Mark Brinicombe. - * Copyright (c) 1997,1998 Causality Limited. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - *notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - *notice, this list of conditions an
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sun Sep 23 15:56:32 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Map 1M beyond _end to make sure we bootstrap. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/rpi/rpi_start.S 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_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.6 src/sys/arch/evbarm/rpi/rpi_start.S:1.7 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.6 Sun Sep 16 14:14:56 2012 +++ src/sys/arch/evbarm/rpi/rpi_start.S Sun Sep 23 15:56:32 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.6 2012/09/16 14:14:56 skrll Exp $ */ +/* $NetBSD: rpi_start.S,v 1.7 2012/09/23 15:56:32 skrll Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -87,7 +87,7 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.6 2012/09/16 14:14:56 skrll Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.7 2012/09/23 15:56:32 skrll Exp $") /* * Workaround Erratum 411920 @@ -308,11 +308,11 @@ Lctl_ID_dis: mmu_init_table: /* Add 1MB of VA==PA at 0x so we can keep the kernel going */ MMU_INIT(0x0, 0x0, - (_end - KERNEL_BASE + L1_S_SIZE - 1), + (_end - KERNEL_BASE + 2 * L1_S_SIZE - 1), L1_S_PROTO | L1_S_AP_KRW) MMU_INIT(KERNEL_BASE, 0x0, - (_end - KERNEL_BASE + L1_S_SIZE - 1), + (_end - KERNEL_BASE + 2 * L1_S_SIZE - 1), L1_S_PROTO | L1_S_AP_KRW | L1_S_B | L1_S_C) /* Map the 16MB of peripherals */
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sun Sep 16 14:14:56 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Don't depend on any memory split for initial L1 table. Size kernel mapping according to actual size. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/rpi/rpi_start.S 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_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.5 src/sys/arch/evbarm/rpi/rpi_start.S:1.6 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.5 Wed Aug 22 12:36:35 2012 +++ src/sys/arch/evbarm/rpi/rpi_start.S Sun Sep 16 14:14:56 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.5 2012/08/22 12:36:35 jakllsch Exp $ */ +/* $NetBSD: rpi_start.S,v 1.6 2012/09/16 14:14:56 skrll Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -87,11 +87,7 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.5 2012/08/22 12:36:35 jakllsch Exp $") - -/* Location (in MiB) to put temporary MMU tables just below. */ -/* Raspberry Pi start.elf will give us anywhere between 128MiB and 240MiB */ -#define MINSPLIT 128 +RCSID("$NetBSD: rpi_start.S,v 1.6 2012/09/16 14:14:56 skrll Exp $") /* * Workaround Erratum 411920 @@ -177,6 +173,7 @@ _C_LABEL(rpi_start): bhi 2b 3: ldmia itable!, {va,pa,n_sec,attr} + mov n_sec, n_sec, lsr #L1_S_SHIFT /* Convert va to l1 offset: va = 4 * (va >> L1_S_SHIFT) */ mov va, va, LSR #L1_S_SHIFT mov va, va, LSL #2 @@ -259,8 +256,8 @@ Ll1_s_frame: .word L1_S_FRAME Ltemp_l1_table: - /* Put the temporary L1 translation table at the end of SDRAM. */ - .word 0x + MINSPLIT * 0x10 - L1_TABLE_SIZE + /* Put the temporary L1 translation table just below the kernel. */ + .word 0x4000 Lstart: .word start @@ -310,17 +307,17 @@ Lctl_ID_dis: mmu_init_table: /* Add 1MB of VA==PA at 0x so we can keep the kernel going */ - MMU_INIT(0x, 0x, - (MINSPLIT * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, + MMU_INIT(0x0, 0x0, + (_end - KERNEL_BASE + L1_S_SIZE - 1), L1_S_PROTO | L1_S_AP_KRW) MMU_INIT(KERNEL_BASE, 0x0, - (MINSPLIT * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, + (_end - KERNEL_BASE + L1_S_SIZE - 1), L1_S_PROTO | L1_S_AP_KRW | L1_S_B | L1_S_C) /* Map the 16MB of peripherals */ MMU_INIT(RPI_KERNEL_IO_VBASE, RPI_KERNEL_IO_PBASE, - (RPI_KERNEL_IO_VSIZE + L1_S_SIZE - 1) / L1_S_SIZE, + (RPI_KERNEL_IO_VSIZE + L1_S_SIZE - 1), L1_S_PROTO | L1_S_AP_KRW) /* end of table */
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Sat Sep 1 17:14:56 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c Log Message: Switch RaspberryPI to use the new boot/init code. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.7 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.6 Wed Aug 22 12:36:35 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Sat Sep 1 17:14:56 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.6 2012/08/22 12:36:35 jakllsch Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.7 2012/09/01 17:14:56 skrll Exp $ */ /* * Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved. @@ -122,7 +122,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.6 2012/08/22 12:36:35 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.7 2012/09/01 17:14:56 skrll Exp $"); #include "opt_evbarm_boardtype.h" @@ -158,43 +158,16 @@ __KERNEL_RCSID(0, "$NetBSD: rpi_machdep. #include "ksyms.h" -static void setup_real_page_tables(void); BootConfig bootconfig; /* Boot config storage */ static char bootargs[MAX_BOOT_STRING]; char *boot_args = NULL; -vm_offset_t physical_start; -vm_offset_t physical_freestart; -vm_offset_t physical_freeend; -vm_offset_t physical_end; -u_int free_pages; - -vm_offset_t msgbufphys; - -extern char etext[]; -extern char __data_start[], _edata[]; -extern char __bss_start[], __bss_end__[]; -extern char _end[]; - -#define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */ -#define KERNEL_PT_KERNEL 1 /* Page table for mapping kernel */ -#define KERNEL_PT_KERNEL_NUM 4 - -#define KERNEL_PT_VMDATA (KERNEL_PT_KERNEL + KERNEL_PT_KERNEL_NUM) -/* Page tables for mapping kernel VM */ -#define KERNEL_PT_VMDATA_NUM 4 /* start with 16MB of KVM */ -#define NUM_KERNEL_PTS (KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM) - -pv_addr_t kernel_pt_table[NUM_KERNEL_PTS]; - /* * Macros to translate between physical and virtual for a subset of the * kernel address space. *Not* for general use. */ -#define KERNEL_BASE_PHYS physical_start -#define KERN_VTOPHYS(va) \ - ((paddr_t)((vaddr_t)va - KERNEL_BASE + KERNEL_BASE_PHYS)) +#define KERNEL_BASE_PHYS (paddr_t)0 #define KERN_PHYSTOV(pa) \ ((vaddr_t)((paddr_t)pa - KERNEL_BASE_PHYS + KERNEL_BASE)) @@ -229,57 +202,6 @@ int plcomcnmode = PLCONMODE; /* Smallest amount of RAM start.elf could give us. */ #define RPI_MINIMUM_ARM_RAM_SPLIT (128U * 1024 * 1024) -void -cpu_reboot(int howto, char *bootstr) -{ - - /* - * If we are still cold then hit the air brakes - * and crash to earth fast - */ - if (cold) { - doshutdownhooks(); - printf("The operating system has halted.\r\n"); - printf("Please press any key to reboot.\r\n"); - cngetc(); - printf("rebooting...\r\n"); - bcm2835_system_reset(); - } - - /* - * If RB_NOSYNC was not specified sync the discs. - * Note: Unless cold is set to 1 here, syslogd will die during the - * unmount. It looks like syslogd is getting woken up only to find - * that it cannot page part of the binary in as the filesystem has - * been unmounted. - */ - if (!(howto & RB_NOSYNC)) - bootsync(); - - /* Say NO to interrupts */ - splhigh(); - - /* Do a dump if requested. */ - if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) - dumpsys(); - - /* Run any shutdown hooks */ - doshutdownhooks(); - - /* Make sure IRQ's are disabled */ - IRQdisable; - - if (howto & RB_HALT) { - printf("The operating system has halted.\r\n"); - printf("Please press any key to reboot.\r\n"); - cngetc(); - } - - printf("rebooting...\r\n"); - bcm2835_system_reset(); - - /*NOTREACHED*/ -} /* * Static device mappings. These peripheral registers are mapped at @@ -369,12 +291,10 @@ parse_linux_atags(void *atag_base) atp->u.mem.size - 1); continue; } - physical_end = atp->u.mem.size; - physmem = physical_end / PAGE_SIZE; KASSERT(atp->u.mem.start == 0); - physical_start = atp->u.mem.start; bootconfig.dram[bootconfig.dramblocks].address = 0x0; - bootconfig.dram[bootconfig.dramblocks].pages = physmem; + bootconfig.dram[bootconfig.dramblocks].pages = + atp->u.mem.size / PAGE_SIZE; ++bootconfig.dramblocks; } @@ -431,132 +351,16 @@ initarm(void *arg) parse_linux_atags((void *)KERN_PHYSTOV(rpi_boot_regs[2])); } else { bootconfig.dramblocks = 1; - physical_end = RPI_MINIMUM_ARM_RAM_SPLIT; - physmem = physical_end / PAGE_SIZE; - physical_start = 0; bootconfig.dram[0].address = 0x0; - bootconfig.dram[0].pages = physmem; + bootconfig.dram[0].pages = + RPI_MINIMUM_ARM_RAM_SPLIT / PAGE_SIZE; } + arm32_bootmem_init(bootconfig.dram[0].address, + bootconfig.dram[0].pages * PAGE_SIZE
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jakllsch Date: Thu Aug 16 23:40:19 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_machdep.c rpi_start.S Log Message: Get accessible memory quantity and kernel command line via Linux ARM 'A'-tag interface used by Raspberry Pi's start.elf. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/rpi/rpi_machdep.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/rpi/rpi_start.S 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.4 src/sys/arch/evbarm/rpi/rpi_machdep.c:1.5 --- src/sys/arch/evbarm/rpi/rpi_machdep.c:1.4 Thu Aug 16 18:22:46 2012 +++ src/sys/arch/evbarm/rpi/rpi_machdep.c Thu Aug 16 23:40:19 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_machdep.c,v 1.4 2012/08/16 18:22:46 matt Exp $ */ +/* $NetBSD: rpi_machdep.c,v 1.5 2012/08/16 23:40:19 jakllsch Exp $ */ /* * Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved. @@ -122,7 +122,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.4 2012/08/16 18:22:46 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.5 2012/08/16 23:40:19 jakllsch Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_broadcom.h" @@ -227,6 +227,9 @@ int plcomcnmode = PLCONMODE; #include #endif +/* Smallest amount of RAM start.elf could give us. */ +#define RPI_MINIMUM_ARM_RAM_SPLIT (128U * 1024 * 1024) + void cpu_reboot(int howto, char *bootstr) { @@ -324,6 +327,65 @@ static const struct pmap_devmap rpi_devm #undef _A #undef _S +#define LINUX_ARM_MACHTYPE_BCM2708 3138 + +#define LINUX_ATAG_NONE 0x +struct linux_atag_header { + uint32_t size; + uint32_t tag; +} __packed __aligned(4); + +#define LINUX_ATAG_MEM 0x54410002 +struct linux_atag_mem { + uint32_t size; + uint32_t start; +} __packed __aligned(4); + +#define LINUX_ATAG_CMDLINE 0x54410009 +struct linux_atag_cmdline { + char cmdline[1]; +} __packed __aligned(4); + +struct linux_atag { + struct linux_atag_header hdr; + union { + struct linux_atag_mem mem; + struct linux_atag_cmdline cmdline; + } u; +} __packed __aligned(4); + +static void +parse_linux_atags(void *atag_base) +{ + struct linux_atag *atp; + + for (atp = atag_base; + atp->hdr.size >= sizeof(struct linux_atag_header)/sizeof(uint32_t); + atp = (void *)((uintptr_t)atp + sizeof(uint32_t) * atp->hdr.size)) { + printf("atag: size %08x tag %08x\n", atp->hdr.size, atp->hdr.tag); + if (atp->hdr.tag == LINUX_ATAG_MEM) { + if (bootconfig.dramblocks > 1) { +printf("Ignoring RAM block 0x%08x-0x%08x\n", +atp->u.mem.start, atp->u.mem.start + +atp->u.mem.size - 1); +continue; + } + physical_end = atp->u.mem.size; + physmem = physical_end / PAGE_SIZE; + KASSERT(atp->u.mem.start == 0); + physical_start = atp->u.mem.start; + bootconfig.dram[bootconfig.dramblocks].address = 0x0; + bootconfig.dram[bootconfig.dramblocks].pages = physmem; + ++bootconfig.dramblocks; + } + + if (atp->hdr.tag == LINUX_ATAG_CMDLINE) { + strncpy(bootargs, atp->u.cmdline.cmdline, + sizeof(bootargs)); + } + } +} + /* * u_int initarm(...) * @@ -364,13 +426,19 @@ initarm(void *arg) printf("initarm: Configuring system ...\n"); #endif - bootconfig.dramblocks = 1; - physical_end = (MEMSIZE * 1024 * 1024); /* MEMSIZE */ - physmem = physical_end / PAGE_SIZE; - physical_start = 0; + extern const uint32_t rpi_boot_regs[4]; + if (rpi_boot_regs[0] == 0 && + rpi_boot_regs[1] == LINUX_ARM_MACHTYPE_BCM2708) { + parse_linux_atags((void *)KERN_PHYSTOV(rpi_boot_regs[2])); + } else { + bootconfig.dramblocks = 1; + physical_end = RPI_MINIMUM_ARM_RAM_SPLIT; + physmem = physical_end / PAGE_SIZE; + physical_start = 0; - bootconfig.dram[0].address = 0x0; - bootconfig.dram[0].pages = physmem; + bootconfig.dram[0].address = 0x0; + bootconfig.dram[0].pages = physmem; + } /* * Our kernel is at the beginning of memory, so set our free space to @@ -500,6 +568,9 @@ initarm(void *arg) md_root_setconf(memory_disk, sizeof memory_disk); #endif + boot_args = bootargs; + parse_mi_bootargs(boot_args); + #ifdef BOOTHOWTO boothowto |= BOOTHOWTO; #endif Index: src/sys/arch/evbarm/rpi/rpi_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.3 src/sys/arch/evbarm/rpi/rpi_start.S:1.4 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.3 Thu Aug 16 21:46:18 2012 +++ src/sys/arch/evbarm/rpi/rpi_start.S Thu Aug 16 23:40:19 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.3 2012/08/16 21:46:18 jakllsch Exp $ */ +/* $NetBSD: rpi_start.S,v 1.4 2012/08/16 23:40:19 jakllsch Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -88,7 +88,7 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.3 2012/08/16 21:46:18 jakllsch Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.4 2012/08/16 23:40:19 jakll
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: jakllsch Date: Thu Aug 16 21:46:18 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Do not depend on MEMSIZE being defined, instead always place temporary MMU tables just below 128MiB. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/rpi/rpi_start.S 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_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.2 src/sys/arch/evbarm/rpi/rpi_start.S:1.3 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.2 Thu Jul 26 12:39:27 2012 +++ src/sys/arch/evbarm/rpi/rpi_start.S Thu Aug 16 21:46:18 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.2 2012/07/26 12:39:27 skrll Exp $ */ +/* $NetBSD: rpi_start.S,v 1.3 2012/08/16 21:46:18 jakllsch Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -88,7 +88,11 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.2 2012/07/26 12:39:27 skrll Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.3 2012/08/16 21:46:18 jakllsch Exp $") + +/* Location (in MiB) to put temporary MMU tables just below. */ +/* Raspberry Pi start.elf will give us anywhere between 128MiB and 240MiB */ +#define MINSPLIT 128 /* * Workaround Erratum 411920 @@ -254,7 +258,7 @@ Ll1_s_frame: Ltemp_l1_table: /* Put the temporary L1 translation table at the end of SDRAM. */ - .word 0x + MEMSIZE * 0x10 - L1_TABLE_SIZE + .word 0x + MINSPLIT * 0x10 - L1_TABLE_SIZE Lstart: .word start @@ -305,11 +309,11 @@ Lctl_ID_dis: mmu_init_table: /* Add 1MB of VA==PA at 0x so we can keep the kernel going */ MMU_INIT(0x, 0x, - (MEMSIZE * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, + (MINSPLIT * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, L1_S_PROTO | L1_S_AP_KRW) MMU_INIT(KERNEL_BASE, 0x0, - (MEMSIZE * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, + (MINSPLIT * L1_S_SIZE + L1_S_SIZE - 1) / L1_S_SIZE, L1_S_PROTO | L1_S_AP_KRW | L1_S_B | L1_S_C) /* Map the 16MB of peripherals */
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: skrll Date: Thu Jul 26 12:39:27 UTC 2012 Modified Files: src/sys/arch/evbarm/rpi: rpi_start.S Log Message: Remove #if 0 code. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/rpi/rpi_start.S 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_start.S diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.1 src/sys/arch/evbarm/rpi/rpi_start.S:1.2 --- src/sys/arch/evbarm/rpi/rpi_start.S:1.1 Thu Jul 26 06:21:57 2012 +++ src/sys/arch/evbarm/rpi/rpi_start.S Thu Jul 26 12:39:27 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_start.S,v 1.1 2012/07/26 06:21:57 skrll Exp $ */ +/* $NetBSD: rpi_start.S,v 1.2 2012/07/26 12:39:27 skrll Exp $ */ /* * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. @@ -88,7 +88,7 @@ #include #include "assym.h" -RCSID("$NetBSD: rpi_start.S,v 1.1 2012/07/26 06:21:57 skrll Exp $") +RCSID("$NetBSD: rpi_start.S,v 1.2 2012/07/26 12:39:27 skrll Exp $") /* * Workaround Erratum 411920 @@ -211,18 +211,10 @@ _C_LABEL(rpi_start): mov r0, #0 mcr p15, 0, r0, c8, c7, 0 /* Invalidate TLBs */ -#if 0 - /* copied from arm11x6_setttb */ - mcr p15, 0, r0, c7, c10, 4 /* Drain the write buffers. */ -#endif - /* Set the Domain Access register. Very important! */ mov r0, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT) mcr p15, 0, r0, c3, c0, 0 -#if 0 - mrc p15, 0, r0, c2, c0, 0 /* Read the Translation Table Base */ -#endif /* * Enable the MMU, etc. */