1 #include <linux/timer.h>
2 #include <asm/sbus.h>
3 #include <asm/oplib.h>
4 #include <asm/fbio.h>
5 
6 #include <video/fbcon.h>
7 
8 struct bt_regs {
9 	volatile unsigned int addr;           /* address register */
10 	volatile unsigned int color_map;      /* color map */
11 	volatile unsigned int control;        /* control register */
12 	volatile unsigned int cursor;         /* cursor map register */
13 };
14 
15 struct fb_info_creator {
16 	struct ffb_fbc *fbc;
17 	struct ffb_dac *dac;
18 	int xy_margin;
19 	int fifo_cache;
20 	u64 yx_margin;
21 	int fg_cache;
22 	int bg_cache;
23 	int dac_rev;
24 };
25 struct fb_info_cgsix {
26 	struct bt_regs *bt;
27 	struct cg6_fbc *fbc;
28 	struct cg6_thc *thc;
29 	struct cg6_tec *tec;
30 	volatile u32 *fhc;
31 };
32 struct fb_info_bwtwo {
33 	struct bw2_regs *regs;
34 };
35 struct fb_info_cgthree {
36 	struct cg3_regs *regs;
37 };
38 struct fb_info_tcx {
39 	struct bt_regs *bt;
40 	struct tcx_thc *thc;
41 	struct tcx_tec *tec;
42 	u32 *cplane;
43 };
44 struct fb_info_leo {
45 	struct leo_lx_krn *lx_krn;
46 	struct leo_lc_ss0_usr *lc_ss0_usr;
47 	struct leo_ld_ss0 *ld_ss0;
48 	struct leo_ld_ss1 *ld_ss1;
49 	struct leo_cursor *cursor;
50 	unsigned int extent;
51 };
52 struct fb_info_cgfourteen {
53 	struct cg14_regs *regs;
54 	struct cg14_cursor *cursor;
55 	struct cg14_clut *clut;
56 	int ramsize;
57 	int mode;
58 };
59 struct fb_info_p9100 {
60 	struct p9100_ctrl *ctrl;
61 	volatile u32 *fbmem;
62 };
63 
64 struct cg_cursor {
65 	char	enable;         /* cursor is enabled */
66 	char	mode;		/* cursor mode */
67 	struct	fbcurpos cpos;  /* position */
68 	struct	fbcurpos chot;  /* hot-spot */
69 	struct	fbcurpos size;  /* size of mask & image fields */
70 	struct	fbcurpos hwsize; /* hw max size */
71 	int	bits[2][128];   /* space for mask & image bits */
72 	char	color [6];      /* cursor colors */
73 	struct	timer_list timer; /* cursor timer */
74 	int	blink_rate;	/* cursor blink rate */
75 };
76 
77 struct sbus_mmap_map {
78 	unsigned long voff;
79 	unsigned long poff;
80 	unsigned long size;
81 };
82 
83 #define SBUS_MMAP_FBSIZE(n) (-n)
84 #define SBUS_MMAP_EMPTY	0x80000000
85 
86 struct fb_info_sbusfb {
87 	struct fb_info info;
88 	struct fb_fix_screeninfo fix;
89 	struct fb_var_screeninfo var;
90 	struct display disp;
91 	struct display_switch dispsw;
92 	struct fbtype type;
93 	struct sbus_dev *sbdp;
94 	spinlock_t lock;
95 	int prom_node, prom_parent;
96 	union {
97 		struct fb_info_creator ffb;
98 		struct fb_info_cgsix cg6;
99 		struct fb_info_bwtwo bw2;
100 		struct fb_info_cgthree cg3;
101 		struct fb_info_tcx tcx;
102 		struct fb_info_leo leo;
103 		struct fb_info_cgfourteen cg14;
104 		struct fb_info_p9100 p9100;
105 	} s;
106 	unsigned char *color_map;
107 	struct cg_cursor cursor;
108 	unsigned char open;
109 	unsigned char mmaped;
110 	unsigned char blanked;
111 	int x_margin;
112 	int y_margin;
113 	int vtconsole;
114 	int consolecnt;
115 	int graphmode;
116 	int emulations[4];
117 	struct sbus_mmap_map *mmap_map;
118 	unsigned long physbase;
119 	int iospace;
120 	/* Methods */
121 	void (*setup)(struct display *);
122 	void (*setcursor)(struct fb_info_sbusfb *);
123 	void (*setcurshape)(struct fb_info_sbusfb *);
124 	void (*setcursormap)(struct fb_info_sbusfb *, unsigned char *, unsigned char *, unsigned char *);
125 	void (*loadcmap)(struct fb_info_sbusfb *, struct display *, int, int);
126 	void (*blank)(struct fb_info_sbusfb *);
127 	void (*unblank)(struct fb_info_sbusfb *);
128 	void (*margins)(struct fb_info_sbusfb *, struct display *, int, int);
129 	void (*reset)(struct fb_info_sbusfb *);
130 	void (*fill)(struct fb_info_sbusfb *, struct display *, int, int, unsigned short *);
131 	void (*switch_from_graph)(struct fb_info_sbusfb *);
132 	void (*restore_palette)(struct fb_info_sbusfb *);
133 	int (*ioctl)(struct fb_info_sbusfb *, unsigned int, unsigned long);
134 };
135 
136 extern char *creatorfb_init(struct fb_info_sbusfb *);
137 extern char *cgsixfb_init(struct fb_info_sbusfb *);
138 extern char *cgthreefb_init(struct fb_info_sbusfb *);
139 extern char *tcxfb_init(struct fb_info_sbusfb *);
140 extern char *leofb_init(struct fb_info_sbusfb *);
141 extern char *bwtwofb_init(struct fb_info_sbusfb *);
142 extern char *cgfourteenfb_init(struct fb_info_sbusfb *);
143 extern char *p9100fb_init(struct fb_info_sbusfb *);
144 
145 #define sbusfbinfod(disp) ((struct fb_info_sbusfb *)(disp->fb_info))
146 #define sbusfbinfo(info) ((struct fb_info_sbusfb *)(info))
147 #define CM(i, j) [3*(i)+(j)]
148 
149 #define SBUSFBINIT_SIZECHANGE ((char *)-1)
150