Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * fbif.h -- Xen virtual frame buffer device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Permission is hereby granted, free of charge, to any person obtaining a copy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * of this software and associated documentation files (the "Software"), to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * deal in the Software without restriction, including without limitation the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * sell copies of the Software, and to permit persons to whom the Software is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * furnished to do so, subject to the following conditions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * The above copyright notice and this permission notice shall be included in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * all copies or substantial portions of the Software.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * DEALINGS IN THE SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #ifndef __XEN_PUBLIC_IO_FBIF_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define __XEN_PUBLIC_IO_FBIF_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) /* Out events (frontend -> backend) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * Out events may be sent only when requested by backend, and receipt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * of an unknown out event is an error.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) /* Event type 1 currently not used */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  * Framebuffer update notification event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * Capable frontend sets feature-update in xenstore.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * Backend requests it by setting request-update in xenstore.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define XENFB_TYPE_UPDATE 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) struct xenfb_update {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	uint8_t type;		/* XENFB_TYPE_UPDATE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	int32_t x;		/* source x */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	int32_t y;		/* source y */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	int32_t width;		/* rect width */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	int32_t height;		/* rect height */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  * Framebuffer resize notification event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * Capable backend sets feature-resize in xenstore.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define XENFB_TYPE_RESIZE 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) struct xenfb_resize {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	uint8_t type;		/* XENFB_TYPE_RESIZE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	int32_t width;		/* width in pixels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	int32_t height;		/* height in pixels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	int32_t stride;		/* stride in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	int32_t depth;		/* depth in bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	int32_t offset;		/* start offset within framebuffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define XENFB_OUT_EVENT_SIZE 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) union xenfb_out_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	uint8_t type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	struct xenfb_update update;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	struct xenfb_resize resize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	char pad[XENFB_OUT_EVENT_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) /* In events (backend -> frontend) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * Frontends should ignore unknown in events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * No in events currently defined.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #define XENFB_IN_EVENT_SIZE 40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) union xenfb_in_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	uint8_t type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	char pad[XENFB_IN_EVENT_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) /* shared page */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) #define XENFB_IN_RING_SIZE 1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #define XENFB_IN_RING_LEN (XENFB_IN_RING_SIZE / XENFB_IN_EVENT_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #define XENFB_IN_RING_OFFS 1024
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #define XENFB_IN_RING(page) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	((union xenfb_in_event *)((char *)(page) + XENFB_IN_RING_OFFS))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #define XENFB_IN_RING_REF(page, idx) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	(XENFB_IN_RING((page))[(idx) % XENFB_IN_RING_LEN])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define XENFB_OUT_RING_SIZE 2048
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define XENFB_OUT_RING_LEN (XENFB_OUT_RING_SIZE / XENFB_OUT_EVENT_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define XENFB_OUT_RING_OFFS (XENFB_IN_RING_OFFS + XENFB_IN_RING_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define XENFB_OUT_RING(page) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	((union xenfb_out_event *)((char *)(page) + XENFB_OUT_RING_OFFS))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #define XENFB_OUT_RING_REF(page, idx) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	(XENFB_OUT_RING((page))[(idx) % XENFB_OUT_RING_LEN])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) struct xenfb_page {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	uint32_t in_cons, in_prod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	uint32_t out_cons, out_prod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	int32_t width;          /* width of the framebuffer (in pixels) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	int32_t height;         /* height of the framebuffer (in pixels) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	uint32_t line_length;   /* length of a row of pixels (in bytes) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	uint32_t mem_length;    /* length of the framebuffer (in bytes) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	uint8_t depth;          /* depth of a pixel (in bits) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	 * Framebuffer page directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	 * Each directory page holds PAGE_SIZE / sizeof(*pd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	 * framebuffer pages, and can thus map up to PAGE_SIZE *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	 * PAGE_SIZE / sizeof(*pd) bytes.  With PAGE_SIZE == 4096 and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	 * sizeof(unsigned long) == 4/8, that's 4 Megs 32 bit and 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	 * Megs 64 bit.  256 directories give enough room for a 512
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	 * Meg framebuffer with a max resolution of 12,800x10,240.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	 * Should be enough for a while with room leftover for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	 * expansion.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	unsigned long pd[256];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * Wart: xenkbd needs to know default resolution.  Put it here until a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * better solution is found, but don't leak it to the backend.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #ifdef __KERNEL__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #define XENFB_WIDTH 800
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #define XENFB_HEIGHT 600
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #define XENFB_DEPTH 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #endif