Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Data written to and read from bcmmbox(4) should be ...
details: https://anonhg.NetBSD.org/src/rev/6dcdfedf071a
branches: trunk
changeset: 946554:6dcdfedf071a
user: rin <rin%NetBSD.org@localhost>
date: Tue Dec 01 04:14:31 2020 +0000
description:
Data written to and read from bcmmbox(4) should be in little-endian.
diffstat:
sys/arch/arm/broadcom/bcm283x_platform.c | 289 +++++++++++++++---------------
sys/arch/evbarm/rpi/rpi_vcmbox.c | 29 +-
sys/arch/evbarm/rpi/vcprop.h | 10 +-
sys/arch/evbarm/rpi/vcprop_subr.c | 163 +++++++++--------
4 files changed, 256 insertions(+), 235 deletions(-)
diffs (truncated from 1021 to 300 lines):
diff -r 8daab17d1801 -r 6dcdfedf071a sys/arch/arm/broadcom/bcm283x_platform.c
--- a/sys/arch/arm/broadcom/bcm283x_platform.c Tue Dec 01 03:28:08 2020 +0000
+++ b/sys/arch/arm/broadcom/bcm283x_platform.c Tue Dec 01 04:14:31 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm283x_platform.c,v 1.43 2020/11/23 06:24:35 rin Exp $ */
+/* $NetBSD: bcm283x_platform.c,v 1.44 2020/12/01 04:14:31 rin Exp $ */
/*-
* Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.43 2020/11/23 06:24:35 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.44 2020/12/01 04:14:31 rin Exp $");
#include "opt_arm_debug.h"
#include "opt_bcm283x.h"
@@ -53,6 +53,7 @@
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/device.h>
+#include <sys/endian.h>
#include <sys/kmem.h>
#include <sys/termios.h>
@@ -349,27 +350,28 @@
struct vcprop_tag end;
} vb_uart __cacheline_aligned = {
.vb_hdr = {
- .vpb_len = sizeof(vb_uart),
- .vpb_rcode = VCPROP_PROCESS_REQUEST,
+ .vpb_len = htole32(sizeof(vb_uart)),
+ .vpb_rcode = htole32(VCPROP_PROCESS_REQUEST),
},
.vbt_uartclockrate = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_CLOCKRATE,
- .vpt_len = VCPROPTAG_LEN(vb_uart.vbt_uartclockrate),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
+ .vpt_len =
+ htole32(VCPROPTAG_LEN(vb_uart.vbt_uartclockrate)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
- .id = VCPROP_CLK_UART
+ .id = htole32(VCPROP_CLK_UART)
},
.vbt_vpuclockrate = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_CLOCKRATE,
- .vpt_len = VCPROPTAG_LEN(vb_uart.vbt_vpuclockrate),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb_uart.vbt_vpuclockrate)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
- .id = VCPROP_CLK_CORE
+ .id = htole32(VCPROP_CLK_CORE)
},
.end = {
- .vpt_tag = VCPROPTAG_NULL
+ .vpt_tag = htole32(VCPROPTAG_NULL)
}
};
@@ -390,99 +392,100 @@
struct vcprop_tag end;
} vb __cacheline_aligned = {
.vb_hdr = {
- .vpb_len = sizeof(vb),
- .vpb_rcode = VCPROP_PROCESS_REQUEST,
+ .vpb_len = htole32(sizeof(vb)),
+ .vpb_rcode = htole32(VCPROP_PROCESS_REQUEST),
},
.vbt_fwrev = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_FIRMWAREREV,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_fwrev),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_FIRMWAREREV),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_fwrev)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_boardmodel = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_BOARDMODEL,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_boardmodel),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_BOARDMODEL),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_boardmodel)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_boardrev = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_BOARDREVISION,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_boardrev),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_BOARDREVISION),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_boardrev)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_macaddr = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_MACADDRESS,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_macaddr),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_MACADDRESS),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_macaddr)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_memory = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_ARMMEMORY,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_memory),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_ARMMEMORY),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_memory)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_serial = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_BOARDSERIAL,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_serial),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_BOARDSERIAL),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_serial)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_dmachan = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_DMACHAN,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_dmachan),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_DMACHAN),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_dmachan)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_cmdline = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_CMDLINE,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_cmdline),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_CMDLINE),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_cmdline)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
},
.vbt_emmcclockrate = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_CLOCKRATE,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_emmcclockrate),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_emmcclockrate)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
- .id = VCPROP_CLK_EMMC
+ .id = htole32(VCPROP_CLK_EMMC)
},
.vbt_armclockrate = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_CLOCKRATE,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_armclockrate),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_armclockrate)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
- .id = VCPROP_CLK_ARM
+ .id = htole32(VCPROP_CLK_ARM)
},
.vbt_vpuclockrate = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_CLOCKRATE,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_vpuclockrate),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb.vbt_vpuclockrate)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
- .id = VCPROP_CLK_CORE
+ .id = htole32(VCPROP_CLK_CORE)
},
.vbt_emmc2clockrate = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_CLOCKRATE,
- .vpt_len = VCPROPTAG_LEN(vb.vbt_emmc2clockrate),
- .vpt_rcode = VCPROPTAG_REQUEST
+ .vpt_tag = htole32(VCPROPTAG_GET_CLOCKRATE),
+ .vpt_len =
+ htole32(VCPROPTAG_LEN(vb.vbt_emmc2clockrate)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST)
},
- .id = VCPROP_CLK_EMMC2
+ .id = htole32(VCPROP_CLK_EMMC2)
},
.end = {
- .vpt_tag = VCPROPTAG_NULL
+ .vpt_tag = htole32(VCPROPTAG_NULL)
}
};
@@ -493,19 +496,19 @@
struct vcprop_tag end;
} vb_edid __cacheline_aligned = {
.vb_hdr = {
- .vpb_len = sizeof(vb_edid),
- .vpb_rcode = VCPROP_PROCESS_REQUEST,
+ .vpb_len = htole32(sizeof(vb_edid)),
+ .vpb_rcode = htole32(VCPROP_PROCESS_REQUEST),
},
.vbt_edid = {
.tag = {
- .vpt_tag = VCPROPTAG_GET_EDID_BLOCK,
- .vpt_len = VCPROPTAG_LEN(vb_edid.vbt_edid),
- .vpt_rcode = VCPROPTAG_REQUEST,
+ .vpt_tag = htole32(VCPROPTAG_GET_EDID_BLOCK),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb_edid.vbt_edid)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
- .blockno = 0,
+ .blockno = htole32(0),
},
.end = {
- .vpt_tag = VCPROPTAG_NULL
+ .vpt_tag = htole32(VCPROPTAG_NULL)
}
};
@@ -521,68 +524,69 @@
struct vcprop_tag end;
} vb_setfb __cacheline_aligned = {
.vb_hdr = {
- .vpb_len = sizeof(vb_setfb),
- .vpb_rcode = VCPROP_PROCESS_REQUEST,
+ .vpb_len = htole32(sizeof(vb_setfb)),
+ .vpb_rcode = htole32(VCPROP_PROCESS_REQUEST),
},
.vbt_res = {
.tag = {
- .vpt_tag = VCPROPTAG_SET_FB_RES,
- .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_res),
- .vpt_rcode = VCPROPTAG_REQUEST,
+ .vpt_tag = htole32(VCPROPTAG_SET_FB_RES),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb_setfb.vbt_res)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
- .width = 0,
- .height = 0,
+ .width = htole32(0),
+ .height = htole32(0),
},
.vbt_vres = {
.tag = {
- .vpt_tag = VCPROPTAG_SET_FB_VRES,
- .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_vres),
- .vpt_rcode = VCPROPTAG_REQUEST,
+ .vpt_tag = htole32(VCPROPTAG_SET_FB_VRES),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb_setfb.vbt_vres)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
- .width = 0,
- .height = 0,
+ .width = htole32(0),
+ .height = htole32(0),
},
.vbt_depth = {
.tag = {
- .vpt_tag = VCPROPTAG_SET_FB_DEPTH,
- .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_depth),
- .vpt_rcode = VCPROPTAG_REQUEST,
+ .vpt_tag = htole32(VCPROPTAG_SET_FB_DEPTH),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb_setfb.vbt_depth)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
- .bpp = 32,
+ .bpp = htole32(32),
},
.vbt_alpha = {
.tag = {
- .vpt_tag = VCPROPTAG_SET_FB_ALPHA_MODE,
- .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_alpha),
- .vpt_rcode = VCPROPTAG_REQUEST,
+ .vpt_tag = htole32(VCPROPTAG_SET_FB_ALPHA_MODE),
+ .vpt_len = htole32(VCPROPTAG_LEN(vb_setfb.vbt_alpha)),
+ .vpt_rcode = htole32(VCPROPTAG_REQUEST),
},
- .state = VCPROP_ALPHA_IGNORED,
+ .state = htole32(VCPROP_ALPHA_IGNORED),
},
.vbt_allocbuf = {
.tag = {
Home |
Main Index |
Thread Index |
Old Index