CVS commit: src/sys/arch/evbarm/rpi

2021-03-08 Thread Michael van Elst
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	

CVS commit: src/sys/arch/evbarm/rpi

2021-03-08 Thread Michael van Elst
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.



CVS commit: src/sys/arch/evbarm/rpi

2020-11-22 Thread Rin Okuyama
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.



CVS commit: src/sys/arch/evbarm/rpi

2020-11-22 Thread Rin Okuyama
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

2020-11-22 Thread Rin Okuyama
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

2020-11-22 Thread Rin Okuyama
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.



CVS commit: src/sys/arch/evbarm/rpi

2020-11-22 Thread Rin Okuyama
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

2020-11-22 Thread Rin Okuyama
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.



CVS commit: src/sys/arch/evbarm/rpi

2020-07-04 Thread Nick Hudson
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

2020-07-04 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2019-12-30 Thread Nick Hudson
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

2019-12-30 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2018-12-07 Thread Michael van Elst
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_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_log, 0, , ,
+	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

2018-12-07 Thread Michael van Elst
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.



CVS commit: src/sys/arch/evbarm/rpi

2018-08-03 Thread Nick Hudson
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

2018-08-03 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2018-06-27 Thread Ryo Shimizu
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.



CVS commit: src/sys/arch/evbarm/rpi

2018-06-27 Thread Ryo Shimizu
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

2018-01-01 Thread Nick Hudson
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

2018-01-01 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2018-01-01 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2018-01-01 Thread Nick Hudson
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

2017-11-09 Thread Nick Hudson
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

2017-11-09 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2017-11-04 Thread Jared D. McNeill
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

2017-11-04 Thread Jared D. McNeill
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.



CVS commit: src/sys/arch/evbarm/rpi

2017-08-12 Thread Jared D. McNeill
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.



CVS commit: src/sys/arch/evbarm/rpi

2017-08-12 Thread Jared D. McNeill
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(_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(_pi, plcomcnspeed, uart_clk,
 	plcomcnmode, PLCOMCNUNIT);
+#endif
+}
+
+static void
+consinit_com(void)
+{
+#if NCOM > 0
+	bus_space_tag_t iot = _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(_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(_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

2017-07-31 Thread Jared D. McNeill
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.



CVS commit: src/sys/arch/evbarm/rpi

2017-07-31 Thread Jared D. McNeill
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

2017-07-31 Thread Jared D. McNeill
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

2017-07-31 Thread Jared D. McNeill
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.



CVS commit: src/sys/arch/evbarm/rpi

2017-07-31 Thread Jared D. McNeill
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

2017-07-31 Thread Jared D. McNeill
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.



CVS commit: src/sys/arch/evbarm/rpi

2017-06-17 Thread Jared D. McNeill
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, );
 
-	cpu_dcache_inv_range((vaddr_t), sizeof(vb));
+	cpu_dcache_inv_range((vaddr_t)_uart, sizeof(vb_uart));
+
+	if (vcprop_tag_success_p(_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(_uart.vbt_uartclockrate.tag))
 		uart_clk = vb_uart.vbt_uartclockrate.rate;



CVS commit: src/sys/arch/evbarm/rpi

2017-06-17 Thread Jared D. McNeill
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.



CVS commit: src/sys/arch/evbarm/rpi

2017-01-06 Thread Nick Hudson
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

2017-01-06 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2016-04-03 Thread Michael van Elst
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

2016-04-03 Thread Michael van Elst
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.



CVS commit: src/sys/arch/evbarm/rpi

2016-03-14 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2016-03-14 Thread Nick Hudson
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

2015-08-01 Thread Nick Hudson
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 sys/cdefs.h
-__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

2015-08-01 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2015-05-31 Thread Nick Hudson
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 sys/cdefs.h
-__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

2015-05-31 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2015-05-27 Thread Jared D. McNeill
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 sys/cdefs.h
-__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

2015-05-27 Thread Jared D. McNeill
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.



CVS commit: src/sys/arch/evbarm/rpi

2015-05-21 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2015-05-21 Thread Nick Hudson
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 sys/cdefs.h
-__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

2015-05-21 Thread Jared D. McNeill
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 sys/cdefs.h
-__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

2015-05-21 Thread Jared D. McNeill
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.



CVS commit: src/sys/arch/evbarm/rpi

2015-05-01 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2015-05-01 Thread Nick Hudson
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 sys/cdefs.h
-__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

2015-04-11 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2015-04-11 Thread Nick Hudson
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 sys/cdefs.h
-__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

2015-03-27 Thread Nick Hudson
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 arm/armreg.h
 #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

2015-03-27 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2015-03-15 Thread Joerg Sonnenberger
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 sys/cdefs.h
-__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

2015-03-15 Thread Joerg Sonnenberger
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.



CVS commit: src/sys/arch/evbarm/rpi

2015-01-21 Thread Jared D. McNeill
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 sys/cdefs.h
-__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=n is passed in cmdline, override wsdisplay type */
 	if (get_bootconf_option(boot_args, genfb.type,



CVS commit: src/sys/arch/evbarm/rpi

2015-01-21 Thread Jared D. McNeill
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-10-07 Thread Michael van Elst
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 sys/cdefs.h
-__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

2014-10-07 Thread Michael van Elst
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-10-04 Thread Michael Lorenz
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 sys/cdefs.h
-__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

2014-10-04 Thread Michael van Elst
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 jmcne...@invisible.ca
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__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 sys/param.h
 #include sys/types.h
@@ -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

2014-10-04 Thread Michael Lorenz
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-10-03 Thread Nick Hudson
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

2014-10-03 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-10-01 Thread Michael van Elst
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 sys/cdefs.h
-__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

2014-10-01 Thread Michael van Elst
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 sys/cdefs.h
-__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

2014-10-01 Thread Michael van Elst
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-10-01 Thread Michael van Elst
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.



Re: CVS commit: src/sys/arch/evbarm/rpi

2014-09-30 Thread SAITOH Masanobu
Hi.

On 2014/09/29 0:39, Michael Lorenz wrote:
 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.

Did you forget something?

--- kern-RPI ---
rpi_machdep.o: In function `rpi_device_register':
rpi_machdep.c:(.text+0x54c): undefined reference to `rpi_alloc_mem'
rpi_machdep.c:(.text+0x554): undefined reference to `rpi_lock_mem'
rpi_machdep.c:(.text+0x5a0): undefined reference to `rpi_fb_movecursor'
rpi_machdep.c:(.text+0x680): undefined reference to `rpi_fb_initcursor'
rpi_machdep.o: In function `rpi_ioctl':
rpi_machdep.c:(.text+0x8c8): undefined reference to `rpi_fb_movecursor'
rpi_machdep.c:(.text+0x8f4): undefined reference to `rpi_fb_set_video'
rpi_machdep.c:(.text+0xaa4): undefined reference to `rpi_fb_initcursor'
rpi_machdep.c:(.text+0xac4): undefined reference to `rpi_fb_movecursor'

-- 
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


Re: CVS commit: src/sys/arch/evbarm/rpi

2014-09-30 Thread Michael
Hello,

On Wed, 01 Oct 2014 02:51:12 +0900
SAITOH Masanobu msai...@execsw.org wrote:

 Hi.
 
 On 2014/09/29 0:39, Michael Lorenz wrote:
  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.
 
 Did you forget something?
 
 --- kern-RPI ---
 rpi_machdep.o: In function `rpi_device_register':
 rpi_machdep.c:(.text+0x54c): undefined reference to `rpi_alloc_mem'
 rpi_machdep.c:(.text+0x554): undefined reference to `rpi_lock_mem'
 rpi_machdep.c:(.text+0x5a0): undefined reference to
 `rpi_fb_movecursor' rpi_machdep.c:(.text+0x680): undefined reference
 to `rpi_fb_initcursor' rpi_machdep.o: In function `rpi_ioctl':
 rpi_machdep.c:(.text+0x8c8): undefined reference to
 `rpi_fb_movecursor' rpi_machdep.c:(.text+0x8f4): undefined reference
 to `rpi_fb_set_video' rpi_machdep.c:(.text+0xaa4): undefined
 reference to `rpi_fb_initcursor' rpi_machdep.c:(.text+0xac4):
 undefined reference to `rpi_fb_movecursor'
 

Argh.
Yes, yes I did.
Sorry, will fix in a minute.

have fun
Michael




CVS commit: src/sys/arch/evbarm/rpi

2014-09-29 Thread Michael Lorenz
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 sys/cdefs.h
-__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

2014-09-29 Thread Michael Lorenz
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.



Re: CVS commit: src/sys/arch/evbarm/rpi

2014-09-28 Thread Christos Zoulas
In article 20140928143829.88f3...@cvs.netbsd.org,
Michael Lorenz source-changes-d@NetBSD.org wrote:
-=-=-=-=-=-

+  hcursor = rpi_alloc_mem(64 * 64 * 4, PAGE_SIZE,
+  MEM_FLAG_L1_NONALLOCATING | MEM_FLAG_HINT_PERMALOCK);

Can you put some constants here since this 64 * 64 * 4 gets repeated?
Maybe one constant for 64 and one for the whole thing?

+  int i, j, k;

uint32_t for the indexes?

+  copyin(cur-mask, cursor_mask, 64 * 8);
+  copyin(cur-image, cursor_bitmap, 64 * 8);

Error checking? More constants?

+  int i, j, idx;

uint32_t for the indexes?


christos



CVS commit: src/sys/arch/evbarm/rpi

2014-09-28 Thread Michael Lorenz
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

2014-09-28 Thread Michael Lorenz
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 sys/cdefs.h
-__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 arm/broadcom/bcm2835var.h
 #include arm/broadcom/bcm2835_pmvar.h
 #include arm/broadcom/bcm2835_mbox.h
+#include arm/broadcom/bcm_amba.h
 
 #include evbarm/rpi/vcio.h
 #include evbarm/rpi/vcpm.h
@@ -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,
-	

CVS commit: src/sys/arch/evbarm/rpi

2014-09-28 Thread Michael Lorenz
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 sys/cdefs.h
-__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

2014-09-28 Thread Michael Lorenz
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-09-28 Thread Michael Lorenz
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-09-28 Thread Michael Lorenz
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-09-23 Thread Michael Lorenz
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

2014-09-23 Thread Michael Lorenz
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

2014-09-23 Thread Michael Lorenz
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-09-07 Thread Nick Hudson
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 sys/cdefs.h
-__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

2014-09-07 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-09-05 Thread Michael Lorenz
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 sys/cdefs.h
-__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 dev/videomode/videomode.h
 #include dev/videomode/edidvar.h
+#include dev/wscons/wsconsio.h
 #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

2014-09-05 Thread Michael Lorenz
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-08-22 Thread Nick Hudson
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 sys/cdefs.h
-__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 dev/usb/ukbdvar.h
 #endif
 
-#include ksyms.h
-
 extern int KERNEL_BASE_phys[];
 extern int KERNEL_BASE_virt[];
 



CVS commit: src/sys/arch/evbarm/rpi

2014-08-22 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-07-27 Thread Nick Hudson
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 machine/asm.h
 #include arm/armreg.h
 #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

2014-07-27 Thread Nick Hudson
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-07-16 Thread Jared D. McNeill
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 sys/cdefs.h
-__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

2014-07-16 Thread Jared D. McNeill
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-05-14 Thread Joerg Sonnenberger
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 arm/armreg.h
 #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

2014-05-14 Thread Joerg Sonnenberger
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.



CVS commit: src/sys/arch/evbarm/rpi

2014-04-07 Thread Nick Hudson
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 arm/armreg.h
 #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	/* */



  1   2   >