xref: /openbmc/linux/arch/m68k/include/asm/fbio.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
249148020SSam Ravnborg #ifndef __LINUX_FBIO_H
349148020SSam Ravnborg #define __LINUX_FBIO_H
449148020SSam Ravnborg 
549148020SSam Ravnborg #include <linux/compiler.h>
649148020SSam Ravnborg #include <linux/types.h>
749148020SSam Ravnborg 
849148020SSam Ravnborg /* Constants used for fbio SunOS compatibility */
949148020SSam Ravnborg /* (C) 1996 Miguel de Icaza */
1049148020SSam Ravnborg 
1149148020SSam Ravnborg /* Frame buffer types */
1249148020SSam Ravnborg #define FBTYPE_NOTYPE           -1
1349148020SSam Ravnborg #define FBTYPE_SUN1BW           0   /* mono */
1449148020SSam Ravnborg #define FBTYPE_SUN1COLOR        1
1549148020SSam Ravnborg #define FBTYPE_SUN2BW           2
1649148020SSam Ravnborg #define FBTYPE_SUN2COLOR        3
1749148020SSam Ravnborg #define FBTYPE_SUN2GP           4
1849148020SSam Ravnborg #define FBTYPE_SUN5COLOR        5
1949148020SSam Ravnborg #define FBTYPE_SUN3COLOR        6
2049148020SSam Ravnborg #define FBTYPE_MEMCOLOR         7
2149148020SSam Ravnborg #define FBTYPE_SUN4COLOR        8
2249148020SSam Ravnborg 
2349148020SSam Ravnborg #define FBTYPE_NOTSUN1          9
2449148020SSam Ravnborg #define FBTYPE_NOTSUN2          10
2549148020SSam Ravnborg #define FBTYPE_NOTSUN3          11
2649148020SSam Ravnborg 
2749148020SSam Ravnborg #define FBTYPE_SUNFAST_COLOR    12  /* cg6 */
2849148020SSam Ravnborg #define FBTYPE_SUNROP_COLOR     13
2949148020SSam Ravnborg #define FBTYPE_SUNFB_VIDEO      14
3049148020SSam Ravnborg #define FBTYPE_SUNGIFB          15
3149148020SSam Ravnborg #define FBTYPE_SUNGPLAS         16
3249148020SSam Ravnborg #define FBTYPE_SUNGP3           17
3349148020SSam Ravnborg #define FBTYPE_SUNGT            18
3449148020SSam Ravnborg #define FBTYPE_SUNLEO           19      /* zx Leo card */
3549148020SSam Ravnborg #define FBTYPE_MDICOLOR         20      /* cg14 */
3649148020SSam Ravnborg #define FBTYPE_TCXCOLOR		21	/* SUNW,tcx card */
3749148020SSam Ravnborg 
3849148020SSam Ravnborg #define FBTYPE_LASTPLUSONE      21	/* This is not last + 1 in fact... */
3949148020SSam Ravnborg 
4049148020SSam Ravnborg /* Does not seem to be listed in the Sun file either */
4149148020SSam Ravnborg #define FBTYPE_CREATOR          22
4249148020SSam Ravnborg #define FBTYPE_PCI_IGA1682	23
4349148020SSam Ravnborg #define FBTYPE_P9100COLOR	24
4449148020SSam Ravnborg 
4549148020SSam Ravnborg #define FBTYPE_PCI_GENERIC	1000
4649148020SSam Ravnborg #define FBTYPE_PCI_MACH64	1001
4749148020SSam Ravnborg 
4849148020SSam Ravnborg /* fbio ioctls */
4949148020SSam Ravnborg /* Returned by FBIOGTYPE */
5049148020SSam Ravnborg struct  fbtype {
5149148020SSam Ravnborg         int     fb_type;        /* fb type, see above */
5249148020SSam Ravnborg         int     fb_height;      /* pixels */
5349148020SSam Ravnborg         int     fb_width;       /* pixels */
5449148020SSam Ravnborg         int     fb_depth;
5549148020SSam Ravnborg         int     fb_cmsize;      /* color map entries */
5649148020SSam Ravnborg         int     fb_size;        /* fb size in bytes */
5749148020SSam Ravnborg };
5849148020SSam Ravnborg #define FBIOGTYPE _IOR('F', 0, struct fbtype)
5949148020SSam Ravnborg 
6049148020SSam Ravnborg struct  fbcmap {
6149148020SSam Ravnborg         int             index;          /* first element (0 origin) */
6249148020SSam Ravnborg         int             count;
6349148020SSam Ravnborg         unsigned char   __user *red;
6449148020SSam Ravnborg         unsigned char   __user *green;
6549148020SSam Ravnborg         unsigned char   __user *blue;
6649148020SSam Ravnborg };
6749148020SSam Ravnborg 
6849148020SSam Ravnborg #ifdef __KERNEL__
6949148020SSam Ravnborg #define FBIOPUTCMAP_SPARC _IOW('F', 3, struct fbcmap)
7049148020SSam Ravnborg #define FBIOGETCMAP_SPARC _IOW('F', 4, struct fbcmap)
7149148020SSam Ravnborg #else
7249148020SSam Ravnborg #define FBIOPUTCMAP _IOW('F', 3, struct fbcmap)
7349148020SSam Ravnborg #define FBIOGETCMAP _IOW('F', 4, struct fbcmap)
7449148020SSam Ravnborg #endif
7549148020SSam Ravnborg 
7649148020SSam Ravnborg /* # of device specific values */
7749148020SSam Ravnborg #define FB_ATTR_NDEVSPECIFIC    8
7849148020SSam Ravnborg /* # of possible emulations */
7949148020SSam Ravnborg #define FB_ATTR_NEMUTYPES       4
8049148020SSam Ravnborg 
8149148020SSam Ravnborg struct fbsattr {
8249148020SSam Ravnborg         int     flags;
8349148020SSam Ravnborg         int     emu_type;	/* -1 if none */
8449148020SSam Ravnborg         int     dev_specific[FB_ATTR_NDEVSPECIFIC];
8549148020SSam Ravnborg };
8649148020SSam Ravnborg 
8749148020SSam Ravnborg struct fbgattr {
8849148020SSam Ravnborg         int     real_type;	/* real frame buffer type */
8949148020SSam Ravnborg         int     owner;		/* unknown */
9049148020SSam Ravnborg         struct fbtype fbtype;	/* real frame buffer fbtype */
9149148020SSam Ravnborg         struct fbsattr sattr;
9249148020SSam Ravnborg         int     emu_types[FB_ATTR_NEMUTYPES]; /* supported emulations */
9349148020SSam Ravnborg };
9449148020SSam Ravnborg #define FBIOSATTR  _IOW('F', 5, struct fbgattr) /* Unsupported: */
9549148020SSam Ravnborg #define FBIOGATTR  _IOR('F', 6, struct fbgattr)	/* supported */
9649148020SSam Ravnborg 
9749148020SSam Ravnborg #define FBIOSVIDEO _IOW('F', 7, int)
9849148020SSam Ravnborg #define FBIOGVIDEO _IOR('F', 8, int)
9949148020SSam Ravnborg 
10049148020SSam Ravnborg struct fbcursor {
10149148020SSam Ravnborg         short set;              /* what to set, choose from the list above */
10249148020SSam Ravnborg         short enable;           /* cursor on/off */
10349148020SSam Ravnborg         struct fbcurpos pos;    /* cursor position */
10449148020SSam Ravnborg         struct fbcurpos hot;    /* cursor hot spot */
10549148020SSam Ravnborg         struct fbcmap cmap;     /* color map info */
10649148020SSam Ravnborg         struct fbcurpos size;   /* cursor bit map size */
10749148020SSam Ravnborg         char __user *image;     /* cursor image bits */
10849148020SSam Ravnborg         char __user *mask;      /* cursor mask bits */
10949148020SSam Ravnborg };
11049148020SSam Ravnborg 
11149148020SSam Ravnborg /* set/get cursor attributes/shape */
11249148020SSam Ravnborg #define FBIOSCURSOR     _IOW('F', 24, struct fbcursor)
11349148020SSam Ravnborg #define FBIOGCURSOR     _IOWR('F', 25, struct fbcursor)
11449148020SSam Ravnborg 
11549148020SSam Ravnborg /* set/get cursor position */
11649148020SSam Ravnborg #define FBIOSCURPOS     _IOW('F', 26, struct fbcurpos)
11749148020SSam Ravnborg #define FBIOGCURPOS     _IOW('F', 27, struct fbcurpos)
11849148020SSam Ravnborg 
11949148020SSam Ravnborg /* get max cursor size */
12049148020SSam Ravnborg #define FBIOGCURMAX     _IOR('F', 28, struct fbcurpos)
12149148020SSam Ravnborg 
12249148020SSam Ravnborg /* wid manipulation */
12349148020SSam Ravnborg struct fb_wid_alloc {
12449148020SSam Ravnborg #define FB_WID_SHARED_8		0
12549148020SSam Ravnborg #define FB_WID_SHARED_24	1
12649148020SSam Ravnborg #define FB_WID_DBL_8		2
12749148020SSam Ravnborg #define FB_WID_DBL_24		3
12849148020SSam Ravnborg 	__u32	wa_type;
12949148020SSam Ravnborg 	__s32	wa_index;	/* Set on return */
13049148020SSam Ravnborg 	__u32	wa_count;
13149148020SSam Ravnborg };
13249148020SSam Ravnborg struct fb_wid_item {
13349148020SSam Ravnborg 	__u32	wi_type;
13449148020SSam Ravnborg 	__s32	wi_index;
13549148020SSam Ravnborg 	__u32	wi_attrs;
13649148020SSam Ravnborg 	__u32	wi_values[32];
13749148020SSam Ravnborg };
13849148020SSam Ravnborg struct fb_wid_list {
13949148020SSam Ravnborg 	__u32	wl_flags;
14049148020SSam Ravnborg 	__u32	wl_count;
14149148020SSam Ravnborg 	struct fb_wid_item	*wl_list;
14249148020SSam Ravnborg };
14349148020SSam Ravnborg 
14449148020SSam Ravnborg #define FBIO_WID_ALLOC	_IOWR('F', 30, struct fb_wid_alloc)
14549148020SSam Ravnborg #define FBIO_WID_FREE	_IOW('F', 31, struct fb_wid_alloc)
14649148020SSam Ravnborg #define FBIO_WID_PUT	_IOW('F', 32, struct fb_wid_list)
14749148020SSam Ravnborg #define FBIO_WID_GET	_IOWR('F', 33, struct fb_wid_list)
14849148020SSam Ravnborg 
14949148020SSam Ravnborg /* Creator ioctls */
15049148020SSam Ravnborg #define FFB_IOCTL	('F'<<8)
15149148020SSam Ravnborg #define FFB_SYS_INFO		(FFB_IOCTL|80)
15249148020SSam Ravnborg #define FFB_CLUTREAD		(FFB_IOCTL|81)
15349148020SSam Ravnborg #define FFB_CLUTPOST		(FFB_IOCTL|82)
15449148020SSam Ravnborg #define FFB_SETDIAGMODE		(FFB_IOCTL|83)
15549148020SSam Ravnborg #define FFB_GETMONITORID	(FFB_IOCTL|84)
15649148020SSam Ravnborg #define FFB_GETVIDEOMODE	(FFB_IOCTL|85)
15749148020SSam Ravnborg #define FFB_SETVIDEOMODE	(FFB_IOCTL|86)
15849148020SSam Ravnborg #define FFB_SETSERVER		(FFB_IOCTL|87)
15949148020SSam Ravnborg #define FFB_SETOVCTL		(FFB_IOCTL|88)
16049148020SSam Ravnborg #define FFB_GETOVCTL		(FFB_IOCTL|89)
16149148020SSam Ravnborg #define FFB_GETSAXNUM		(FFB_IOCTL|90)
16249148020SSam Ravnborg #define FFB_FBDEBUG		(FFB_IOCTL|91)
16349148020SSam Ravnborg 
16449148020SSam Ravnborg /* Cg14 ioctls */
16549148020SSam Ravnborg #define MDI_IOCTL          ('M'<<8)
16649148020SSam Ravnborg #define MDI_RESET          (MDI_IOCTL|1)
16749148020SSam Ravnborg #define MDI_GET_CFGINFO    (MDI_IOCTL|2)
16849148020SSam Ravnborg #define MDI_SET_PIXELMODE  (MDI_IOCTL|3)
16949148020SSam Ravnborg #    define MDI_32_PIX     32
17049148020SSam Ravnborg #    define MDI_16_PIX     16
17149148020SSam Ravnborg #    define MDI_8_PIX      8
17249148020SSam Ravnborg 
17349148020SSam Ravnborg struct mdi_cfginfo {
17449148020SSam Ravnborg 	int     mdi_ncluts;     /* Number of implemented CLUTs in this MDI */
17549148020SSam Ravnborg         int     mdi_type;       /* FBTYPE name */
17649148020SSam Ravnborg         int     mdi_height;     /* height */
177551e378cSDaniel Mack         int     mdi_width;      /* width */
17849148020SSam Ravnborg         int     mdi_size;       /* available ram */
17949148020SSam Ravnborg         int     mdi_mode;       /* 8bpp, 16bpp or 32bpp */
18049148020SSam Ravnborg         int     mdi_pixfreq;    /* pixel clock (from PROM) */
18149148020SSam Ravnborg };
18249148020SSam Ravnborg 
18349148020SSam Ravnborg /* SparcLinux specific ioctl for the MDI, should be replaced for
18449148020SSam Ravnborg  * the SET_XLUT/SET_CLUTn ioctls instead
18549148020SSam Ravnborg  */
18649148020SSam Ravnborg #define MDI_CLEAR_XLUT       (MDI_IOCTL|9)
18749148020SSam Ravnborg 
18849148020SSam Ravnborg /* leo & ffb ioctls */
18949148020SSam Ravnborg struct fb_clut_alloc {
19049148020SSam Ravnborg 	__u32	clutid;	/* Set on return */
19149148020SSam Ravnborg  	__u32	flag;
19249148020SSam Ravnborg  	__u32	index;
19349148020SSam Ravnborg };
19449148020SSam Ravnborg 
19549148020SSam Ravnborg struct fb_clut {
19649148020SSam Ravnborg #define FB_CLUT_WAIT	0x00000001	/* Not yet implemented */
19749148020SSam Ravnborg  	__u32	flag;
19849148020SSam Ravnborg  	__u32	clutid;
19949148020SSam Ravnborg  	__u32	offset;
20049148020SSam Ravnborg  	__u32	count;
20149148020SSam Ravnborg  	char *	red;
20249148020SSam Ravnborg  	char *	green;
20349148020SSam Ravnborg  	char *	blue;
20449148020SSam Ravnborg };
20549148020SSam Ravnborg 
20649148020SSam Ravnborg struct fb_clut32 {
20749148020SSam Ravnborg  	__u32	flag;
20849148020SSam Ravnborg  	__u32	clutid;
20949148020SSam Ravnborg  	__u32	offset;
21049148020SSam Ravnborg  	__u32	count;
21149148020SSam Ravnborg  	__u32	red;
21249148020SSam Ravnborg  	__u32	green;
21349148020SSam Ravnborg  	__u32	blue;
21449148020SSam Ravnborg };
21549148020SSam Ravnborg 
21649148020SSam Ravnborg #define LEO_CLUTALLOC	_IOWR('L', 53, struct fb_clut_alloc)
21749148020SSam Ravnborg #define LEO_CLUTFREE	_IOW('L', 54, struct fb_clut_alloc)
21849148020SSam Ravnborg #define LEO_CLUTREAD	_IOW('L', 55, struct fb_clut)
21949148020SSam Ravnborg #define LEO_CLUTPOST	_IOW('L', 56, struct fb_clut)
22049148020SSam Ravnborg #define LEO_SETGAMMA	_IOW('L', 68, int) /* Not yet implemented */
22149148020SSam Ravnborg #define LEO_GETGAMMA	_IOR('L', 69, int) /* Not yet implemented */
22249148020SSam Ravnborg 
22349148020SSam Ravnborg #ifdef __KERNEL__
22449148020SSam Ravnborg /* Addresses on the fd of a cgsix that are mappable */
22549148020SSam Ravnborg #define CG6_FBC    0x70000000
22649148020SSam Ravnborg #define CG6_TEC    0x70001000
22749148020SSam Ravnborg #define CG6_BTREGS 0x70002000
22849148020SSam Ravnborg #define CG6_FHC    0x70004000
22949148020SSam Ravnborg #define CG6_THC    0x70005000
23049148020SSam Ravnborg #define CG6_ROM    0x70006000
23149148020SSam Ravnborg #define CG6_RAM    0x70016000
23249148020SSam Ravnborg #define CG6_DHC    0x80000000
23349148020SSam Ravnborg 
23449148020SSam Ravnborg #define CG3_MMAP_OFFSET 0x4000000
23549148020SSam Ravnborg 
23649148020SSam Ravnborg /* Addresses on the fd of a tcx that are mappable */
23749148020SSam Ravnborg #define TCX_RAM8BIT   		0x00000000
23849148020SSam Ravnborg #define TCX_RAM24BIT   		0x01000000
23949148020SSam Ravnborg #define TCX_UNK3   		0x10000000
24049148020SSam Ravnborg #define TCX_UNK4   		0x20000000
24149148020SSam Ravnborg #define TCX_CONTROLPLANE   	0x28000000
24249148020SSam Ravnborg #define TCX_UNK6   		0x30000000
24349148020SSam Ravnborg #define TCX_UNK7   		0x38000000
24449148020SSam Ravnborg #define TCX_TEC    		0x70000000
24549148020SSam Ravnborg #define TCX_BTREGS 		0x70002000
24649148020SSam Ravnborg #define TCX_THC    		0x70004000
24749148020SSam Ravnborg #define TCX_DHC    		0x70008000
24849148020SSam Ravnborg #define TCX_ALT	   		0x7000a000
24949148020SSam Ravnborg #define TCX_SYNC   		0x7000e000
25049148020SSam Ravnborg #define TCX_UNK2    		0x70010000
25149148020SSam Ravnborg 
25249148020SSam Ravnborg /* CG14 definitions */
25349148020SSam Ravnborg 
25449148020SSam Ravnborg /* Offsets into the OBIO space: */
25549148020SSam Ravnborg #define CG14_REGS        0       /* registers */
25649148020SSam Ravnborg #define CG14_CURSORREGS  0x1000  /* cursor registers */
25749148020SSam Ravnborg #define CG14_DACREGS     0x2000  /* DAC registers */
25849148020SSam Ravnborg #define CG14_XLUT        0x3000  /* X Look Up Table -- ??? */
25949148020SSam Ravnborg #define CG14_CLUT1       0x4000  /* Color Look Up Table */
26049148020SSam Ravnborg #define CG14_CLUT2       0x5000  /* Color Look Up Table */
26149148020SSam Ravnborg #define CG14_CLUT3       0x6000  /* Color Look Up Table */
26249148020SSam Ravnborg #define CG14_AUTO	 0xf000
26349148020SSam Ravnborg 
26449148020SSam Ravnborg #endif /* KERNEL */
26549148020SSam Ravnborg 
26649148020SSam Ravnborg /* These are exported to userland for applications to use */
26749148020SSam Ravnborg /* Mappable offsets for the cg14: control registers */
26849148020SSam Ravnborg #define MDI_DIRECT_MAP 0x10000000
26949148020SSam Ravnborg #define MDI_CTLREG_MAP 0x20000000
27049148020SSam Ravnborg #define MDI_CURSOR_MAP 0x30000000
27149148020SSam Ravnborg #define MDI_SHDW_VRT_MAP 0x40000000
27249148020SSam Ravnborg 
27349148020SSam Ravnborg /* Mappable offsets for the cg14: frame buffer resolutions */
27449148020SSam Ravnborg /* 32 bits */
27549148020SSam Ravnborg #define MDI_CHUNKY_XBGR_MAP 0x50000000
27649148020SSam Ravnborg #define MDI_CHUNKY_BGR_MAP 0x60000000
27749148020SSam Ravnborg 
27849148020SSam Ravnborg /* 16 bits */
27949148020SSam Ravnborg #define MDI_PLANAR_X16_MAP 0x70000000
28049148020SSam Ravnborg #define MDI_PLANAR_C16_MAP 0x80000000
28149148020SSam Ravnborg 
28249148020SSam Ravnborg /* 8 bit is done as CG3 MMAP offset */
28349148020SSam Ravnborg /* 32 bits, planar */
28449148020SSam Ravnborg #define MDI_PLANAR_X32_MAP 0x90000000
28549148020SSam Ravnborg #define MDI_PLANAR_B32_MAP 0xa0000000
28649148020SSam Ravnborg #define MDI_PLANAR_G32_MAP 0xb0000000
28749148020SSam Ravnborg #define MDI_PLANAR_R32_MAP 0xc0000000
28849148020SSam Ravnborg 
28949148020SSam Ravnborg /* Mappable offsets on leo */
29049148020SSam Ravnborg #define LEO_SS0_MAP            0x00000000
29149148020SSam Ravnborg #define LEO_LC_SS0_USR_MAP     0x00800000
29249148020SSam Ravnborg #define LEO_LD_SS0_MAP         0x00801000
29349148020SSam Ravnborg #define LEO_LX_CURSOR_MAP      0x00802000
29449148020SSam Ravnborg #define LEO_SS1_MAP            0x00803000
29549148020SSam Ravnborg #define LEO_LC_SS1_USR_MAP     0x01003000
29649148020SSam Ravnborg #define LEO_LD_SS1_MAP         0x01004000
29749148020SSam Ravnborg #define LEO_UNK_MAP            0x01005000
29849148020SSam Ravnborg #define LEO_LX_KRN_MAP         0x01006000
29949148020SSam Ravnborg #define LEO_LC_SS0_KRN_MAP     0x01007000
30049148020SSam Ravnborg #define LEO_LC_SS1_KRN_MAP     0x01008000
30149148020SSam Ravnborg #define LEO_LD_GBL_MAP         0x01009000
30249148020SSam Ravnborg #define LEO_UNK2_MAP           0x0100a000
30349148020SSam Ravnborg 
30449148020SSam Ravnborg #ifdef __KERNEL__
30549148020SSam Ravnborg struct  fbcmap32 {
30649148020SSam Ravnborg 	int             index;          /* first element (0 origin) */
30749148020SSam Ravnborg 	int             count;
30849148020SSam Ravnborg 	u32		red;
30949148020SSam Ravnborg 	u32		green;
31049148020SSam Ravnborg 	u32		blue;
31149148020SSam Ravnborg };
31249148020SSam Ravnborg 
31349148020SSam Ravnborg #define FBIOPUTCMAP32	_IOW('F', 3, struct fbcmap32)
31449148020SSam Ravnborg #define FBIOGETCMAP32	_IOW('F', 4, struct fbcmap32)
31549148020SSam Ravnborg 
31649148020SSam Ravnborg struct fbcursor32 {
31749148020SSam Ravnborg 	short set;		/* what to set, choose from the list above */
31849148020SSam Ravnborg 	short enable;		/* cursor on/off */
31949148020SSam Ravnborg 	struct fbcurpos pos;	/* cursor position */
32049148020SSam Ravnborg 	struct fbcurpos hot;	/* cursor hot spot */
32149148020SSam Ravnborg 	struct fbcmap32 cmap;	/* color map info */
32249148020SSam Ravnborg 	struct fbcurpos size;	/* cursor bit map size */
32349148020SSam Ravnborg 	u32	image;		/* cursor image bits */
32449148020SSam Ravnborg 	u32	mask;		/* cursor mask bits */
32549148020SSam Ravnborg };
32649148020SSam Ravnborg 
32749148020SSam Ravnborg #define FBIOSCURSOR32	_IOW('F', 24, struct fbcursor32)
32849148020SSam Ravnborg #define FBIOGCURSOR32	_IOW('F', 25, struct fbcursor32)
32949148020SSam Ravnborg #endif
33049148020SSam Ravnborg 
33149148020SSam Ravnborg #endif /* __LINUX_FBIO_H */
332