Home | History | Annotate | Line # | Download | only in rpi
      1  1.20   mlelstv /*	$NetBSD: vcprop.h,v 1.20 2021/03/08 13:53:08 mlelstv Exp $	*/
      2   1.1     skrll 
      3   1.1     skrll /*-
      4   1.1     skrll  * Copyright (c) 2012 The NetBSD Foundation, Inc.
      5   1.1     skrll  * All rights reserved.
      6   1.1     skrll  *
      7   1.1     skrll  * This code is derived from software contributed to The NetBSD Foundation
      8   1.1     skrll  * by Nick Hudson
      9   1.1     skrll  *
     10   1.1     skrll  * Redistribution and use in source and binary forms, with or without
     11   1.1     skrll  * modification, are permitted provided that the following conditions
     12   1.1     skrll  * are met:
     13   1.1     skrll  * 1. Redistributions of source code must retain the above copyright
     14   1.1     skrll  *    notice, this list of conditions and the following disclaimer.
     15   1.1     skrll  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1     skrll  *    notice, this list of conditions and the following disclaimer in the
     17   1.1     skrll  *    documentation and/or other materials provided with the distribution.
     18   1.1     skrll  *
     19   1.1     skrll  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20   1.1     skrll  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21   1.1     skrll  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22   1.1     skrll  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23   1.1     skrll  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24   1.1     skrll  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25   1.1     skrll  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26   1.1     skrll  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27   1.1     skrll  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28   1.1     skrll  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29   1.1     skrll  * POSSIBILITY OF SUCH DAMAGE.
     30   1.1     skrll  */
     31   1.1     skrll 
     32   1.1     skrll /*
     33   1.1     skrll  * Mailbox property interface
     34   1.1     skrll  */
     35   1.1     skrll 
     36   1.1     skrll #ifndef	_EVBARM_RPI_VCPROP_H_
     37   1.1     skrll #define	_EVBARM_RPI_VCPROP_H_
     38   1.1     skrll 
     39   1.9  jmcneill #include "opt_vcprop.h"
     40   1.9  jmcneill 
     41  1.19       rin #include <sys/endian.h>
     42  1.19       rin 
     43   1.1     skrll struct vcprop_tag {
     44   1.1     skrll 	uint32_t vpt_tag;
     45   1.1     skrll #define	VCPROPTAG_NULL			0x00000000
     46   1.1     skrll #define	VCPROPTAG_GET_FIRMWAREREV	0x00000001
     47  1.20   mlelstv #define	VCPROPTAG_GET_FIRMWAREVARIANT	0x00000002
     48  1.20   mlelstv #define	VCPROPTAG_GET_FIRMWAREHASH	0x00000003
     49   1.1     skrll #define	VCPROPTAG_GET_BOARDMODEL	0x00010001
     50   1.1     skrll #define	VCPROPTAG_GET_BOARDREVISION	0x00010002
     51   1.1     skrll #define	VCPROPTAG_GET_MACADDRESS	0x00010003
     52   1.1     skrll #define	VCPROPTAG_GET_BOARDSERIAL	0x00010004
     53   1.1     skrll #define	VCPROPTAG_GET_ARMMEMORY		0x00010005
     54   1.1     skrll #define	VCPROPTAG_GET_VCMEMORY		0x00010006
     55   1.1     skrll #define	VCPROPTAG_GET_CLOCKS		0x00010007
     56   1.2     skrll 
     57   1.3  jmcneill #define VCPROPTAG_GET_POWERSTATE	0x00020001
     58   1.3  jmcneill #define VCPROPTAG_GET_POWERTIMING	0x00020002
     59   1.3  jmcneill #define VCPROPTAG_SET_POWERSTATE	0x00028001
     60   1.3  jmcneill 
     61   1.2     skrll #define	VCPROPTAG_GET_CLOCKSTATE	0x00030001
     62   1.2     skrll #define	VCPROPTAG_SET_CLOCKSTATE	0x00038001
     63   1.2     skrll #define	VCPROPTAG_GET_CLOCKRATE		0x00030002
     64   1.2     skrll #define	VCPROPTAG_SET_CLOCKRATE		0x00038002
     65   1.4  jmcneill #define	VCPROPTAG_GET_MIN_CLOCKRATE	0x00030007
     66   1.4  jmcneill #define	VCPROPTAG_GET_MAX_CLOCKRATE	0x00030004
     67  1.15   mlelstv #define	VCPROPTAG_GET_TURBO		0x00030009
     68  1.15   mlelstv #define	VCPROPTAG_SET_TURBO		0x00038009
     69   1.3  jmcneill 
     70  1.20   mlelstv #define VCPROPTAG_GET_STC		0x0003000b
     71  1.20   mlelstv #define	VCPROPTAG_GET_THROTTLED		0x00030046
     72  1.20   mlelstv #define	VCPROPTAG_GET_CLOCK_MEASURED	0x00030047
     73  1.20   mlelstv #define	VCPROPTAG_NOTIFY_REBOOT		0x00030048
     74  1.20   mlelstv 
     75   1.3  jmcneill #define VCPROPTAG_GET_VOLTAGE		0x00030003
     76   1.3  jmcneill #define VCPROPTAG_SET_VOLTAGE		0x00038003
     77   1.3  jmcneill #define VCPROPTAG_GET_MIN_VOLTAGE	0x00030008
     78   1.3  jmcneill #define VCPROPTAG_GET_MAX_VOLTAGE	0x00030005
     79   1.3  jmcneill 
     80   1.3  jmcneill #define VCPROPTAG_GET_TEMPERATURE	0x00030006
     81   1.3  jmcneill #define VCPROPTAG_GET_MAX_TEMPERATURE	0x0003000a
     82   1.3  jmcneill 
     83  1.20   mlelstv #define VCPROPTAG_GET_DOMAIN_STATE	0x00030030
     84  1.20   mlelstv #define VCPROPTAG_SET_DOMAIN_STATE	0x00038030
     85  1.20   mlelstv 
     86  1.20   mlelstv #define VCPROPTAG_GET_GPIO_STATE	0x00030041
     87  1.20   mlelstv #define VCPROPTAG_SET_GPIO_STATE	0x00038041
     88  1.20   mlelstv #define VCPROPTAG_GET_GPIO_CONFIG	0x00030041
     89  1.20   mlelstv #define VCPROPTAG_SET_GPIO_CONFIG	0x00038041
     90  1.20   mlelstv #define VCPROPTAG_GET_PERIPH_REG	0x00030045
     91  1.20   mlelstv #define VCPROPTAG_SET_PERIPH_REG	0x00038045
     92  1.20   mlelstv 
     93  1.20   mlelstv #define VCPROPTAG_GET_OTP		0x00030021
     94  1.20   mlelstv #define VCPROPTAG_SET_OTP		0x00038021
     95  1.20   mlelstv 
     96  1.20   mlelstv #define VCPROPTAG_SET_SDHOST_CLOCK	0x00038042
     97  1.20   mlelstv 
     98  1.20   mlelstv #define VCPROPTAG_GET_POE_HAT_VAL	0x00030049
     99  1.20   mlelstv #define VCPROPTAG_SET_POE_HAT_VAL	0x00030050
    100  1.20   mlelstv 
    101  1.20   mlelstv #define VCPROPTAG_NOTIFY_XHCI_RESET	0x00030058
    102  1.20   mlelstv 
    103   1.1     skrll #define	VCPROPTAG_GET_CMDLINE		0x00050001
    104   1.1     skrll #define	VCPROPTAG_GET_DMACHAN		0x00060001
    105   1.5  jmcneill 
    106   1.5  jmcneill #define	VCPROPTAG_ALLOCATE_BUFFER	0x00040001
    107  1.20   mlelstv #define	VCPROPTAG_RELEASE_BUFFER	0x00048001
    108   1.7  jmcneill #define	VCPROPTAG_BLANK_SCREEN		0x00040002
    109   1.5  jmcneill #define	VCPROPTAG_GET_FB_RES		0x00040003
    110  1.20   mlelstv #define	VCPROPTAG_TST_FB_RES		0x00044003
    111   1.6  jmcneill #define	VCPROPTAG_SET_FB_RES		0x00048003
    112   1.7  jmcneill #define	VCPROPTAG_GET_FB_VRES		0x00040004
    113  1.20   mlelstv #define	VCPROPTAG_TST_FB_VRES		0x00044004
    114   1.7  jmcneill #define	VCPROPTAG_SET_FB_VRES		0x00048004
    115   1.5  jmcneill #define	VCPROPTAG_GET_FB_DEPTH		0x00040005
    116  1.20   mlelstv #define	VCPROPTAG_TST_FB_DEPTH		0x00044005
    117   1.6  jmcneill #define	VCPROPTAG_SET_FB_DEPTH		0x00048005
    118   1.5  jmcneill #define	VCPROPTAG_GET_FB_PIXEL_ORDER	0x00040006
    119  1.20   mlelstv #define	VCPROPTAG_TST_FB_PIXEL_ORDER	0x00044006
    120   1.6  jmcneill #define	VCPROPTAG_SET_FB_PIXEL_ORDER	0x00048006
    121   1.7  jmcneill #define	VCPROPTAG_GET_FB_ALPHA_MODE	0x00040007
    122  1.20   mlelstv #define	VCPROPTAG_TST_FB_ALPHA_MODE	0x00044007
    123   1.7  jmcneill #define	VCPROPTAG_SET_FB_ALPHA_MODE	0x00048007
    124   1.5  jmcneill #define	VCPROPTAG_GET_FB_PITCH		0x00040008
    125  1.20   mlelstv #define	VCPROPTAG_GET_VIRTUAL_OFFSET	0x00040009
    126  1.20   mlelstv #define	VCPROPTAG_TST_VIRTUAL_OFFSET	0x00044009
    127  1.20   mlelstv #define	VCPROPTAG_SET_VIRTUAL_OFFSET	0x00048009
    128  1.20   mlelstv #define	VCPROPTAG_GET_OVERSCAN		0x0004000a
    129  1.20   mlelstv #define	VCPROPTAG_TST_OVERSCAN		0x0004400a
    130  1.20   mlelstv #define	VCPROPTAG_SET_OVERSCAN		0x0004800a
    131  1.20   mlelstv #define	VCPROPTAG_GET_PALETTE		0x0004000b
    132  1.20   mlelstv #define	VCPROPTAG_TST_PALETTE		0x0004400b
    133  1.20   mlelstv #define	VCPROPTAG_SET_PALETTE		0x0004800b
    134  1.20   mlelstv #define	VCPROPTAG_GET_FB_LAYER		0x0004000c
    135  1.20   mlelstv #define	VCPROPTAG_TST_FB_LAYER		0x0004400c
    136  1.20   mlelstv #define	VCPROPTAG_SET_FB_LAYER		0x0004800c
    137  1.20   mlelstv #define	VCPROPTAG_GET_TRANSFORM		0x0004000d
    138  1.20   mlelstv #define	VCPROPTAG_TST_TRANSFORM		0x0004400d
    139  1.20   mlelstv #define	VCPROPTAG_SET_TRANSFORM		0x0004800d
    140  1.20   mlelstv #define	VCPROPTAG_GET_VSYNC		0x0004000e
    141  1.20   mlelstv #define	VCPROPTAG_TST_VSYNC		0x0004400e
    142  1.20   mlelstv #define	VCPROPTAG_SET_VSYNC		0x0004800e
    143  1.20   mlelstv #define	VCPROPTAG_GET_TOUCHBUF		0x0004000f
    144  1.20   mlelstv #define	VCPROPTAG_GET_SET_BACKLIGHT	0x0004800f
    145  1.20   mlelstv #define	VCPROPTAG_GET_GPIOVIRTBUF	0x00040010
    146  1.20   mlelstv #define	VCPROPTAG_SET_GPIOVIRTBUF	0x00048020
    147  1.20   mlelstv #define	VCPROPTAG_GET_NUM_DISPLAYS	0x00040013
    148  1.20   mlelstv #define	VCPROPTAG_SET_DISPLAYNUM	0x00048013
    149  1.20   mlelstv #define	VCPROPTAG_GET_DISPLAY_SETTINGS	0x00040014
    150  1.20   mlelstv #define	VCPROPTAG_GET_DISPLAYID		0x00040016
    151  1.20   mlelstv 
    152  1.20   mlelstv #define	VCPROPTAG_VCHIQ_INIT		0x00048010
    153  1.20   mlelstv 
    154  1.20   mlelstv #define	VCPROPTAG_SET_PLANE		0x00048015
    155  1.20   mlelstv #define	VCPROPTAG_GET_TIMING		0x00040017
    156  1.20   mlelstv #define	VCPROPTAG_SET_TIMING		0x00048017
    157  1.20   mlelstv #define	VCPROPTAG_GET_DISPLAY_CFG	0x00048018
    158   1.5  jmcneill 
    159   1.5  jmcneill #define	VCPROPTAG_GET_EDID_BLOCK	0x00030020
    160  1.20   mlelstv #define	VCPROPTAG_GET_EDID_BLOCK_DISP	0x00030021
    161   1.5  jmcneill 
    162  1.11  macallan #define	VCPROPTAG_ALLOCMEM		0x0003000c
    163  1.11  macallan #define	VCPROPTAG_LOCKMEM		0x0003000d
    164  1.11  macallan #define	VCPROPTAG_UNLOCKMEM		0x0003000e
    165  1.11  macallan #define	VCPROPTAG_RELEASEMEM		0x0003000f
    166  1.15   mlelstv #define	VCPROPTAG_EXECUTE_CODE		0x00030010
    167  1.15   mlelstv #define	VCPROPTAG_EXECUTE_QPU		0x00030011
    168  1.15   mlelstv #define	VCPROPTAG_SET_ENABLE_QPU	0x00030012
    169  1.15   mlelstv #define	VCPROPTAG_GET_DISPMANX_HANDLE	0x00030014
    170  1.11  macallan 
    171  1.12  macallan #define	VCPROPTAG_SET_CURSOR_INFO	0x00008010
    172  1.12  macallan #define	VCPROPTAG_SET_CURSOR_STATE	0x00008011
    173   1.5  jmcneill 
    174   1.1     skrll 	uint32_t vpt_len;
    175   1.1     skrll 	uint32_t vpt_rcode;
    176   1.1     skrll #define	VCPROPTAG_REQUEST	(0U << 31)
    177   1.1     skrll #define	VCPROPTAG_RESPONSE	(1U << 31)
    178   1.1     skrll 
    179   1.1     skrll };
    180   1.1     skrll 
    181   1.1     skrll #define VCPROPTAG_LEN(x) (sizeof((x)) - sizeof(struct vcprop_tag))
    182   1.1     skrll 
    183  1.20   mlelstv #define VCPROP_INIT_REQUEST(req)					\
    184  1.20   mlelstv 	do {								\
    185  1.20   mlelstv 		memset(&(req), 0, sizeof((req)));			\
    186  1.20   mlelstv 		(req).vb_hdr.vpb_len = htole32(sizeof((req)));		\
    187  1.20   mlelstv 		(req).vb_hdr.vpb_rcode = htole32(VCPROP_PROCESS_REQUEST);\
    188  1.20   mlelstv 		(req).end.vpt_tag = htole32(VCPROPTAG_NULL);			\
    189  1.20   mlelstv 	} while (0)
    190  1.20   mlelstv #define VCPROP_INIT_TAG(s, t)						\
    191  1.20   mlelstv 	do {								\
    192  1.20   mlelstv 		(s).tag.vpt_tag = htole32(t);				\
    193  1.20   mlelstv 		(s).tag.vpt_rcode = htole32(VCPROPTAG_REQUEST);		\
    194  1.20   mlelstv 		(s).tag.vpt_len = htole32(VCPROPTAG_LEN(s));		\
    195  1.20   mlelstv 	} while (0)
    196  1.20   mlelstv 
    197   1.1     skrll struct vcprop_memory {
    198   1.1     skrll 	uint32_t base;
    199   1.1     skrll 	uint32_t size;
    200   1.1     skrll };
    201   1.1     skrll 
    202   1.1     skrll #define	VCPROP_MAXMEMBLOCKS 4
    203   1.1     skrll struct vcprop_tag_memory {
    204   1.1     skrll 	struct vcprop_tag tag;
    205   1.1     skrll 	struct vcprop_memory mem[VCPROP_MAXMEMBLOCKS];
    206   1.1     skrll };
    207   1.1     skrll 
    208   1.1     skrll struct vcprop_tag_fwrev {
    209   1.1     skrll 	struct vcprop_tag tag;
    210   1.1     skrll 	uint32_t rev;
    211   1.1     skrll };
    212   1.1     skrll 
    213   1.1     skrll struct vcprop_tag_boardmodel {
    214   1.1     skrll 	struct vcprop_tag tag;
    215   1.1     skrll 	uint32_t model;
    216  1.18       rin };
    217   1.1     skrll 
    218   1.1     skrll struct vcprop_tag_boardrev {
    219   1.1     skrll 	struct vcprop_tag tag;
    220   1.1     skrll 	uint32_t rev;
    221  1.18       rin };
    222   1.1     skrll 
    223  1.16  jmcneill #define	VCPROP_REV_PCBREV	__BITS(3,0)
    224  1.16  jmcneill #define	VCPROP_REV_MODEL	__BITS(11,4)
    225  1.16  jmcneill #define	 RPI_MODEL_A		0
    226  1.16  jmcneill #define	 RPI_MODEL_B		1
    227  1.16  jmcneill #define	 RPI_MODEL_A_PLUS	2
    228  1.16  jmcneill #define	 RPI_MODEL_B_PLUS	3
    229  1.16  jmcneill #define	 RPI_MODEL_B_PI2	4
    230  1.16  jmcneill #define	 RPI_MODEL_ALPHA	5
    231  1.16  jmcneill #define	 RPI_MODEL_COMPUTE	6
    232  1.16  jmcneill #define	 RPI_MODEL_B_PI3	8
    233  1.20   mlelstv #define	 RPI_MODEL_ZERO		9
    234  1.20   mlelstv #define	 RPI_MODEL_COMPUTE_PI3	10
    235  1.20   mlelstv #define	 RPI_MODEL_ZERO_W	12
    236  1.20   mlelstv #define	 RPI_MODEL_B_PLUS_PI3	13
    237  1.20   mlelstv #define	 RPI_MODEL_A_PLUS_PI3	14
    238  1.20   mlelstv #define	 RPI_MODEL_CM_PLUS_PI3	16
    239  1.20   mlelstv #define	 RPI_MODEL_B_PI4	17
    240  1.16  jmcneill #define	VCPROP_REV_PROCESSOR	__BITS(15,12)
    241  1.16  jmcneill #define	 RPI_PROCESSOR_BCM2835	0
    242  1.16  jmcneill #define	 RPI_PROCESSOR_BCM2836	1
    243  1.16  jmcneill #define	 RPI_PROCESSOR_BCM2837	2
    244  1.20   mlelstv #define	 RPI_PROCESSOR_BCM2711	3
    245  1.16  jmcneill #define	VCPROP_REV_MANUF	__BITS(19,16)
    246  1.20   mlelstv #define	 RPI_MANUF_SONY         0
    247  1.20   mlelstv #define	 RPI_MANUF_EGOMAN       1
    248  1.20   mlelstv #define	 RPI_MANUF_QISDA        16
    249  1.20   mlelstv #define	 RPI_MANUF_EMBEST       2
    250  1.20   mlelstv #define	 RPI_MANUF_SONYJAPAN    3
    251  1.16  jmcneill #define	VCPROP_REV_MEMSIZE	__BITS(22,20)
    252  1.20   mlelstv #define	 RPI_MEMSIZE_256	0
    253  1.20   mlelstv #define	 RPI_MEMSIZE_512	1
    254  1.20   mlelstv #define	 RPI_MEMSIZE_1024	2
    255  1.20   mlelstv #define	 RPI_MEMSIZE_2048	3
    256  1.20   mlelstv #define	 RPI_MEMSIZE_4096	4
    257  1.16  jmcneill #define	VCPROP_REV_ENCFLAG	__BIT(23)
    258  1.16  jmcneill #define	VCPROP_REV_WARRANTY	__BITS(25,24)
    259  1.16  jmcneill 
    260   1.1     skrll struct vcprop_tag_macaddr {
    261   1.1     skrll 	struct vcprop_tag tag;
    262   1.1     skrll 	uint64_t addr;
    263   1.8     skrll } __packed;
    264   1.1     skrll 
    265   1.1     skrll struct vcprop_tag_boardserial {
    266   1.1     skrll 	struct vcprop_tag tag;
    267   1.1     skrll 	uint64_t sn;
    268   1.8     skrll } __packed;
    269   1.1     skrll 
    270   1.2     skrll #define	VCPROP_CLK_EMMC		1
    271   1.2     skrll #define	VCPROP_CLK_UART		2
    272   1.2     skrll #define	VCPROP_CLK_ARM		3
    273   1.2     skrll #define	VCPROP_CLK_CORE		4
    274   1.2     skrll #define	VCPROP_CLK_V3D		5
    275   1.2     skrll #define	VCPROP_CLK_H264		6
    276   1.2     skrll #define	VCPROP_CLK_ISP		7
    277   1.2     skrll #define	VCPROP_CLK_SDRAM	8
    278   1.2     skrll #define	VCPROP_CLK_PIXEL	9
    279   1.2     skrll #define	VCPROP_CLK_PWM		10
    280  1.17     skrll #define	VCPROP_CLK_EMMC2	12
    281   1.2     skrll 
    282   1.1     skrll struct vcprop_clock {
    283   1.1     skrll 	uint32_t pclk;
    284   1.1     skrll 	uint32_t cclk;
    285   1.1     skrll };
    286   1.1     skrll 
    287   1.1     skrll #define	VCPROP_MAXCLOCKS 16
    288   1.1     skrll struct vcprop_tag_clock {
    289   1.1     skrll 	struct vcprop_tag tag;
    290   1.1     skrll 	struct vcprop_clock clk[VCPROP_MAXCLOCKS];
    291   1.1     skrll };
    292   1.1     skrll 
    293   1.9  jmcneill #ifndef	VCPROP_MAXCMDLINE
    294   1.9  jmcneill #define	VCPROP_MAXCMDLINE 1024
    295   1.9  jmcneill #endif
    296   1.1     skrll struct vcprop_tag_cmdline {
    297   1.1     skrll 	struct vcprop_tag tag;
    298   1.1     skrll 	uint8_t cmdline[VCPROP_MAXCMDLINE];
    299   1.1     skrll };
    300   1.1     skrll 
    301   1.1     skrll struct vcprop_tag_dmachan {
    302   1.1     skrll 	struct vcprop_tag tag;
    303   1.1     skrll 	uint32_t mask;
    304   1.1     skrll };
    305   1.1     skrll 
    306   1.2     skrll struct vcprop_tag_clockstate {
    307   1.2     skrll 	struct vcprop_tag tag;
    308   1.2     skrll 	uint32_t id;
    309   1.2     skrll 	uint32_t state;
    310   1.2     skrll };
    311   1.2     skrll 
    312   1.2     skrll struct vcprop_tag_clockrate {
    313   1.2     skrll 	struct vcprop_tag tag;
    314   1.2     skrll 	uint32_t id;
    315   1.2     skrll 	uint32_t rate;
    316  1.14     skrll 	uint32_t noturbo;
    317   1.2     skrll };
    318   1.2     skrll 
    319  1.20   mlelstv struct vcprop_tag_sdhostclock {
    320  1.20   mlelstv 	struct vcprop_tag tag;
    321  1.20   mlelstv 	uint32_t clock;
    322  1.20   mlelstv 	uint32_t clock1;
    323  1.20   mlelstv 	uint32_t clock2;
    324  1.20   mlelstv };
    325  1.20   mlelstv 
    326   1.3  jmcneill #define VCPROP_VOLTAGE_CORE	1
    327   1.3  jmcneill #define VCPROP_VOLTAGE_SDRAM_C	2
    328   1.3  jmcneill #define VCPROP_VOLTAGE_SDRAM_P	3
    329   1.3  jmcneill #define VCPROP_VOLTAGE_SDRAM_I	4
    330   1.3  jmcneill 
    331   1.3  jmcneill struct vcprop_tag_voltage {
    332   1.3  jmcneill 	struct vcprop_tag tag;
    333   1.3  jmcneill 	uint32_t id;
    334   1.3  jmcneill 	uint32_t value;
    335   1.3  jmcneill };
    336   1.3  jmcneill 
    337   1.3  jmcneill #define VCPROP_TEMP_SOC		0
    338   1.3  jmcneill 
    339   1.3  jmcneill struct vcprop_tag_temperature {
    340   1.3  jmcneill 	struct vcprop_tag tag;
    341   1.3  jmcneill 	uint32_t id;
    342   1.3  jmcneill 	uint32_t value;
    343   1.3  jmcneill };
    344   1.3  jmcneill 
    345   1.3  jmcneill #define	VCPROP_POWER_SDCARD	0
    346   1.3  jmcneill #define	VCPROP_POWER_UART0	1
    347   1.3  jmcneill #define	VCPROP_POWER_UART1	2
    348   1.3  jmcneill #define	VCPROP_POWER_USB	3
    349   1.3  jmcneill #define	VCPROP_POWER_I2C0	4
    350   1.3  jmcneill #define	VCPROP_POWER_I2C1	5
    351   1.3  jmcneill #define	VCPROP_POWER_I2C2	6
    352   1.3  jmcneill #define	VCPROP_POWER_SPI	7
    353   1.3  jmcneill #define	VCPROP_POWER_CCP2TX	8
    354   1.3  jmcneill 
    355  1.20   mlelstv #define VCPROP_DOMAIN_I2C0           1
    356  1.20   mlelstv #define VCPROP_DOMAIN_I2C1           2
    357  1.20   mlelstv #define VCPROP_DOMAIN_I2C2           3
    358  1.20   mlelstv #define VCPROP_DOMAIN_VIDEO_SCALER   4
    359  1.20   mlelstv #define VCPROP_DOMAIN_VPU1           5
    360  1.20   mlelstv #define VCPROP_DOMAIN_HDMI           6
    361  1.20   mlelstv #define VCPROP_DOMAIN_USB            7
    362  1.20   mlelstv #define VCPROP_DOMAIN_VEC            8
    363  1.20   mlelstv #define VCPROP_DOMAIN_JPEG           9
    364  1.20   mlelstv #define VCPROP_DOMAIN_H264           10
    365  1.20   mlelstv #define VCPROP_DOMAIN_V3D            11
    366  1.20   mlelstv #define VCPROP_DOMAIN_ISP            12
    367  1.20   mlelstv #define VCPROP_DOMAIN_UNICAM0        13
    368  1.20   mlelstv #define VCPROP_DOMAIN_UNICAM1        14
    369  1.20   mlelstv #define VCPROP_DOMAIN_CCP2RX         15
    370  1.20   mlelstv #define VCPROP_DOMAIN_CSI2           16
    371  1.20   mlelstv #define VCPROP_DOMAIN_CPI            17
    372  1.20   mlelstv #define VCPROP_DOMAIN_DSI0           18
    373  1.20   mlelstv #define VCPROP_DOMAIN_DSI1           19
    374  1.20   mlelstv #define VCPROP_DOMAIN_TRANSPOSER     20
    375  1.20   mlelstv #define VCPROP_DOMAIN_CCP2TX         21
    376  1.20   mlelstv #define VCPROP_DOMAIN_CDP            22
    377  1.20   mlelstv #define VCPROP_DOMAIN_ARM            23
    378  1.20   mlelstv 
    379   1.3  jmcneill struct vcprop_tag_powertiming {
    380   1.3  jmcneill 	struct vcprop_tag tag;
    381   1.3  jmcneill 	uint32_t id;
    382   1.3  jmcneill 	uint32_t waitusec;
    383   1.3  jmcneill };
    384   1.3  jmcneill 
    385   1.3  jmcneill struct vcprop_tag_powerstate {
    386   1.3  jmcneill 	struct vcprop_tag tag;
    387   1.3  jmcneill 	uint32_t id;
    388   1.3  jmcneill 	uint32_t state;
    389   1.3  jmcneill };
    390   1.3  jmcneill 
    391   1.5  jmcneill struct vcprop_tag_allocbuf {
    392   1.5  jmcneill 	struct vcprop_tag tag;
    393   1.5  jmcneill 	uint32_t address;	/* alignment for request */
    394   1.5  jmcneill 	uint32_t size;
    395   1.5  jmcneill };
    396   1.5  jmcneill 
    397   1.7  jmcneill #define VCPROP_BLANK_OFF	0
    398   1.7  jmcneill #define VCPROP_BLANK_ON		1
    399   1.7  jmcneill 
    400   1.7  jmcneill struct vcprop_tag_blankscreen {
    401   1.7  jmcneill 	struct vcprop_tag tag;
    402   1.7  jmcneill 	uint32_t state;
    403   1.7  jmcneill };
    404   1.7  jmcneill 
    405   1.5  jmcneill struct vcprop_tag_fbres {
    406   1.5  jmcneill 	struct vcprop_tag tag;
    407   1.5  jmcneill 	uint32_t width;
    408   1.5  jmcneill 	uint32_t height;
    409   1.5  jmcneill };
    410   1.5  jmcneill 
    411   1.5  jmcneill struct vcprop_tag_fbdepth {
    412   1.5  jmcneill 	struct vcprop_tag tag;
    413   1.5  jmcneill 	uint32_t bpp;
    414   1.5  jmcneill };
    415   1.5  jmcneill 
    416   1.5  jmcneill #define VCPROP_PIXEL_BGR	0
    417   1.5  jmcneill #define VCPROP_PIXEL_RGB	1
    418   1.5  jmcneill 
    419   1.5  jmcneill struct vcprop_tag_fbpixelorder {
    420   1.5  jmcneill 	struct vcprop_tag tag;
    421  1.20   mlelstv 	uint32_t order;
    422   1.5  jmcneill };
    423   1.5  jmcneill 
    424   1.5  jmcneill struct vcprop_tag_fbpitch {
    425   1.5  jmcneill 	struct vcprop_tag tag;
    426   1.5  jmcneill 	uint32_t linebytes;
    427   1.5  jmcneill };
    428   1.5  jmcneill 
    429   1.7  jmcneill #define VCPROP_ALPHA_ENABLED	0
    430   1.7  jmcneill #define VCPROP_ALPHA_REVERSED	1
    431   1.7  jmcneill #define VCPROP_ALPHA_IGNORED	2
    432   1.7  jmcneill 
    433   1.7  jmcneill struct vcprop_tag_fbalpha {
    434   1.7  jmcneill 	struct vcprop_tag tag;
    435   1.7  jmcneill 	uint32_t state;
    436   1.7  jmcneill };
    437   1.7  jmcneill 
    438   1.5  jmcneill struct vcprop_tag_edidblock {
    439   1.5  jmcneill 	struct vcprop_tag tag;
    440   1.5  jmcneill 	uint32_t blockno;
    441   1.5  jmcneill 	uint32_t status;
    442   1.5  jmcneill 	uint8_t data[128];
    443   1.5  jmcneill };
    444   1.5  jmcneill 
    445  1.20   mlelstv struct vcprop_tag_numdpy {
    446  1.20   mlelstv 	struct vcprop_tag tag;
    447  1.20   mlelstv 	uint32_t count;
    448  1.20   mlelstv };
    449  1.20   mlelstv 
    450  1.20   mlelstv struct vcprop_tag_setdpy {
    451  1.20   mlelstv 	struct vcprop_tag tag;
    452  1.20   mlelstv 	uint32_t display_num;
    453  1.20   mlelstv };
    454  1.20   mlelstv 
    455  1.10  macallan struct vcprop_tag_cursorinfo {
    456  1.10  macallan 	struct vcprop_tag tag;
    457  1.10  macallan 	uint32_t width;
    458  1.10  macallan 	uint32_t height;
    459  1.13  macallan 	uint32_t format;
    460  1.11  macallan 	uint32_t pixels;	/* bus address in VC memory */
    461  1.10  macallan 	uint32_t hotspot_x;
    462  1.10  macallan 	uint32_t hotspot_y;
    463  1.10  macallan };
    464  1.10  macallan 
    465  1.10  macallan struct vcprop_tag_cursorstate {
    466  1.10  macallan 	struct vcprop_tag tag;
    467  1.10  macallan 	uint32_t enable;	/* 1 - visible */
    468  1.10  macallan 	uint32_t x;
    469  1.10  macallan 	uint32_t y;
    470  1.10  macallan 	uint32_t flags;		/* 0 - display coord. 1 - fb coord. */
    471  1.10  macallan };
    472  1.10  macallan 
    473  1.11  macallan struct vcprop_tag_allocmem {
    474  1.11  macallan 	struct vcprop_tag tag;
    475  1.11  macallan 	uint32_t size;	/* handle returned here */
    476  1.11  macallan 	uint32_t align;
    477  1.11  macallan 	uint32_t flags;
    478  1.11  macallan /*
    479  1.11  macallan  * flag definitions from
    480  1.11  macallan  * https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface
    481  1.11  macallan  */
    482  1.11  macallan #define MEM_FLAG_DISCARDABLE	(1 << 0) /* can be resized to 0 at any time. Use for cached data */
    483  1.11  macallan #define MEM_FLAG_NORMAL		(0 << 2) /* normal allocating alias. Don't use from ARM */
    484  1.11  macallan #define MEM_FLAG_DIRECT		(1 << 2) /* 0xC alias uncached */
    485  1.11  macallan #define MEM_FLAG_COHERENT	(2 << 2) /* 0x8 alias. Non-allocating in L2 but coherent */
    486  1.11  macallan #define MEM_FLAG_L1_NONALLOCATING (MEM_FLAG_DIRECT | MEM_FLAG_COHERENT) /* Allocating in L2 */
    487  1.11  macallan #define MEM_FLAG_ZERO		(1 << 4)  /* initialise buffer to all zeros */
    488  1.11  macallan #define MEM_FLAG_NO_INIT	(1 << 5) /* don't initialise (default is initialise to all ones */
    489  1.11  macallan #define MEM_FLAG_HINT_PERMALOCK	(1 << 6) /* Likely to be locked for long periods of time. */
    490  1.11  macallan };
    491  1.11  macallan 
    492  1.11  macallan /* also for unlock and release */
    493  1.11  macallan struct vcprop_tag_lockmem {
    494  1.11  macallan 	struct vcprop_tag tag;
    495  1.11  macallan 	uint32_t handle;	/* bus address returned here */
    496  1.11  macallan };
    497  1.11  macallan 
    498  1.20   mlelstv struct vcprop_tag_vchiqinit {
    499  1.20   mlelstv 	struct vcprop_tag tag;
    500  1.20   mlelstv 	uint32_t base;
    501  1.20   mlelstv };
    502  1.20   mlelstv 
    503  1.20   mlelstv struct vcprop_tag_notifyxhcireset {
    504  1.20   mlelstv 	struct vcprop_tag tag;
    505  1.20   mlelstv 	uint32_t deviceaddress;
    506  1.20   mlelstv };
    507  1.20   mlelstv 
    508   1.1     skrll struct vcprop_buffer_hdr {
    509   1.1     skrll 	uint32_t vpb_len;
    510   1.1     skrll 	uint32_t vpb_rcode;
    511   1.1     skrll #define	VCPROP_PROCESS_REQUEST 0
    512   1.1     skrll #define VCPROP_REQ_SUCCESS	(1U << 31)
    513   1.1     skrll #define VCPROP_REQ_EPARSE	(1U << 0)
    514   1.1     skrll };
    515   1.1     skrll 
    516   1.1     skrll static inline bool
    517   1.1     skrll vcprop_buffer_success_p(struct vcprop_buffer_hdr *vpbh)
    518   1.1     skrll {
    519   1.1     skrll 
    520  1.19       rin 	return le32toh(vpbh->vpb_rcode) & VCPROP_REQ_SUCCESS;
    521   1.1     skrll }
    522   1.1     skrll 
    523   1.1     skrll static inline bool
    524   1.1     skrll vcprop_tag_success_p(struct vcprop_tag *vpbt)
    525   1.1     skrll {
    526   1.1     skrll 
    527  1.19       rin 	return le32toh(vpbt->vpt_rcode) & VCPROPTAG_RESPONSE;
    528   1.1     skrll }
    529   1.1     skrll 
    530   1.1     skrll static inline size_t
    531   1.1     skrll vcprop_tag_resplen(struct vcprop_tag *vpbt)
    532   1.1     skrll {
    533   1.1     skrll 
    534  1.19       rin 	return le32toh(vpbt->vpt_rcode) & ~VCPROPTAG_RESPONSE;
    535   1.1     skrll }
    536   1.1     skrll 
    537  1.13  macallan uint32_t rpi_alloc_mem(uint32_t, uint32_t, uint32_t);
    538  1.13  macallan bus_addr_t rpi_lock_mem(uint32_t);
    539  1.13  macallan int rpi_unlock_mem(uint32_t);
    540  1.13  macallan int rpi_release_mem(uint32_t);
    541  1.13  macallan 
    542  1.13  macallan int rpi_fb_set_video(int);
    543  1.13  macallan 
    544  1.13  macallan int rpi_fb_movecursor(int, int, int);
    545  1.13  macallan int rpi_fb_initcursor(bus_addr_t, int, int);
    546  1.20   mlelstv 
    547  1.20   mlelstv int rpi_fb_set_pixelorder(uint32_t);
    548  1.20   mlelstv int rpi_fb_get_pixelorder(uint32_t *);
    549  1.20   mlelstv 
    550  1.20   mlelstv int rpi_set_domain(uint32_t, uint32_t);
    551  1.20   mlelstv int rpi_get_domain(uint32_t, uint32_t *);
    552  1.20   mlelstv 
    553  1.20   mlelstv int rpi_vchiq_init(uint32_t *);
    554  1.20   mlelstv 
    555  1.20   mlelstv int rpi_notify_xhci_reset(uint32_t);
    556  1.20   mlelstv 
    557  1.20   mlelstv #endif	/* _EVBARM_RPI_VCPROP_H_ */
    558  1.20   mlelstv 
    559