Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v2.6.16-rc3 380 lines 11 kB view raw
1#ifndef STICORE_H 2#define STICORE_H 3 4/* generic STI structures & functions */ 5 6#if 0 7#define DPRINTK(x) printk x 8#else 9#define DPRINTK(x) 10#endif 11 12#define MAX_STI_ROMS 4 /* max no. of ROMs which this driver handles */ 13 14#define STI_REGION_MAX 8 /* hardcoded STI constants */ 15#define STI_DEV_NAME_LENGTH 32 16#define STI_MONITOR_MAX 256 17 18#define STI_FONT_HPROMAN8 1 19#define STI_FONT_KANA8 2 20 21/* The latency of the STI functions cannot really be reduced by setting 22 * this to 0; STI doesn't seem to be designed to allow calling a different 23 * function (or the same function with different arguments) after a 24 * function exited with 1 as return value. 25 * 26 * As all of the functions below could be called from interrupt context, 27 * we have to spin_lock_irqsave around the do { ret = bla(); } while(ret==1) 28 * block. Really bad latency there. 29 * 30 * Probably the best solution to all this is have the generic code manage 31 * the screen buffer and a kernel thread to call STI occasionally. 32 * 33 * Luckily, the frame buffer guys have the same problem so we can just wait 34 * for them to fix it and steal their solution. prumpf 35 */ 36 37#define STI_WAIT 1 38 39#include <asm/io.h> /* for USE_HPPA_IOREMAP */ 40 41#if USE_HPPA_IOREMAP 42 43#define STI_PTR(p) (p) 44#define PTR_STI(p) (p) 45static inline int STI_CALL( unsigned long func, 46 void *flags, void *inptr, void *outptr, void *glob_cfg ) 47{ 48 int (*f)(void *,void *,void *,void *); 49 f = (void*)func; 50 return f(flags, inptr, outptr, glob_cfg); 51} 52 53#else /* !USE_HPPA_IOREMAP */ 54 55#define STI_PTR(p) ( virt_to_phys(p) ) 56#define PTR_STI(p) ( phys_to_virt((long)p) ) 57#define STI_CALL(func, flags, inptr, outptr, glob_cfg) \ 58 ({ \ 59 pdc_sti_call( func, (unsigned long)STI_PTR(flags), \ 60 (unsigned long)STI_PTR(inptr), \ 61 (unsigned long)STI_PTR(outptr), \ 62 (unsigned long)STI_PTR(glob_cfg)); \ 63 }) 64 65#endif /* USE_HPPA_IOREMAP */ 66 67 68#define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x) 69#define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y) 70 71/* sti_font_xy() use the native font ROM ! */ 72#define sti_font_x(sti) (PTR_STI(sti->font)->width) 73#define sti_font_y(sti) (PTR_STI(sti->font)->height) 74 75 76/* STI function configuration structs */ 77 78typedef union region { 79 struct { 80 u32 offset : 14; /* offset in 4kbyte page */ 81 u32 sys_only : 1; /* don't map to user space */ 82 u32 cache : 1; /* map to data cache */ 83 u32 btlb : 1; /* map to block tlb */ 84 u32 last : 1; /* last region in list */ 85 u32 length : 14; /* length in 4kbyte page */ 86 } region_desc; 87 88 u32 region; /* complete region value */ 89} region_t; 90 91#define REGION_OFFSET_TO_PHYS( rt, hpa ) \ 92 (((rt).region_desc.offset << 12) + (hpa)) 93 94struct sti_glob_cfg_ext { 95 u8 curr_mon; /* current monitor configured */ 96 u8 friendly_boot; /* in friendly boot mode */ 97 s16 power; /* power calculation (in Watts) */ 98 s32 freq_ref; /* frequency refrence */ 99 u32 sti_mem_addr; /* pointer to global sti memory (size=sti_mem_request) */ 100 u32 future_ptr; /* pointer to future data */ 101}; 102 103struct sti_glob_cfg { 104 s32 text_planes; /* number of planes used for text */ 105 s16 onscreen_x; /* screen width in pixels */ 106 s16 onscreen_y; /* screen height in pixels */ 107 s16 offscreen_x; /* offset width in pixels */ 108 s16 offscreen_y; /* offset height in pixels */ 109 s16 total_x; /* frame buffer width in pixels */ 110 s16 total_y; /* frame buffer height in pixels */ 111 u32 region_ptrs[STI_REGION_MAX]; /* region pointers */ 112 s32 reent_lvl; /* storage for reentry level value */ 113 u32 save_addr; /* where to save or restore reentrant state */ 114 u32 ext_ptr; /* pointer to extended glob_cfg data structure */ 115}; 116 117 118/* STI init function structs */ 119 120struct sti_init_flags { 121 u32 wait : 1; /* should routine idle wait or not */ 122 u32 reset : 1; /* hard reset the device? */ 123 u32 text : 1; /* turn on text display planes? */ 124 u32 nontext : 1; /* turn on non-text display planes? */ 125 u32 clear : 1; /* clear text display planes? */ 126 u32 cmap_blk : 1; /* non-text planes cmap black? */ 127 u32 enable_be_timer : 1; /* enable bus error timer */ 128 u32 enable_be_int : 1; /* enable bus error timer interrupt */ 129 u32 no_chg_tx : 1; /* don't change text settings */ 130 u32 no_chg_ntx : 1; /* don't change non-text settings */ 131 u32 no_chg_bet : 1; /* don't change berr timer settings */ 132 u32 no_chg_bei : 1; /* don't change berr int settings */ 133 u32 init_cmap_tx : 1; /* initialize cmap for text planes */ 134 u32 cmt_chg : 1; /* change current monitor type */ 135 u32 retain_ie : 1; /* don't allow reset to clear int enables */ 136 u32 caller_bootrom : 1; /* set only by bootrom for each call */ 137 u32 caller_kernel : 1; /* set only by kernel for each call */ 138 u32 caller_other : 1; /* set only by non-[BR/K] caller */ 139 u32 pad : 14; /* pad to word boundary */ 140 u32 future_ptr; /* pointer to future data */ 141}; 142 143struct sti_init_inptr_ext { 144 u8 config_mon_type; /* configure to monitor type */ 145 u8 pad[1]; /* pad to word boundary */ 146 u16 inflight_data; /* inflight data possible on PCI */ 147 u32 future_ptr; /* pointer to future data */ 148}; 149 150struct sti_init_inptr { 151 s32 text_planes; /* number of planes to use for text */ 152 u32 ext_ptr; /* pointer to extended init_graph inptr data structure*/ 153}; 154 155 156struct sti_init_outptr { 157 s32 errno; /* error number on failure */ 158 s32 text_planes; /* number of planes used for text */ 159 u32 future_ptr; /* pointer to future data */ 160}; 161 162 163 164/* STI configuration function structs */ 165 166struct sti_conf_flags { 167 u32 wait : 1; /* should routine idle wait or not */ 168 u32 pad : 31; /* pad to word boundary */ 169 u32 future_ptr; /* pointer to future data */ 170}; 171 172struct sti_conf_inptr { 173 u32 future_ptr; /* pointer to future data */ 174}; 175 176struct sti_conf_outptr_ext { 177 u32 crt_config[3]; /* hardware specific X11/OGL information */ 178 u32 crt_hdw[3]; 179 u32 future_ptr; 180}; 181 182struct sti_conf_outptr { 183 s32 errno; /* error number on failure */ 184 s16 onscreen_x; /* screen width in pixels */ 185 s16 onscreen_y; /* screen height in pixels */ 186 s16 offscreen_x; /* offscreen width in pixels */ 187 s16 offscreen_y; /* offscreen height in pixels */ 188 s16 total_x; /* frame buffer width in pixels */ 189 s16 total_y; /* frame buffer height in pixels */ 190 s32 bits_per_pixel; /* bits/pixel device has configured */ 191 s32 bits_used; /* bits which can be accessed */ 192 s32 planes; /* number of fb planes in system */ 193 u8 dev_name[STI_DEV_NAME_LENGTH]; /* null terminated product name */ 194 u32 attributes; /* flags denoting attributes */ 195 u32 ext_ptr; /* pointer to future data */ 196}; 197 198struct sti_rom { 199 u8 type[4]; 200 u8 res004; 201 u8 num_mons; 202 u8 revno[2]; 203 u32 graphics_id[2]; 204 205 u32 font_start; 206 u32 statesize; 207 u32 last_addr; 208 u32 region_list; 209 210 u16 reentsize; 211 u16 maxtime; 212 u32 mon_tbl_addr; 213 u32 user_data_addr; 214 u32 sti_mem_req; 215 216 u32 user_data_size; 217 u16 power; 218 u8 bus_support; 219 u8 ext_bus_support; 220 u8 alt_code_type; 221 u8 ext_dd_struct[3]; 222 u32 cfb_addr; 223 224 u32 init_graph; 225 u32 state_mgmt; 226 u32 font_unpmv; 227 u32 block_move; 228 u32 self_test; 229 u32 excep_hdlr; 230 u32 inq_conf; 231 u32 set_cm_entry; 232 u32 dma_ctrl; 233 u8 res040[7 * 4]; 234 235 u32 init_graph_addr; 236 u32 state_mgmt_addr; 237 u32 font_unp_addr; 238 u32 block_move_addr; 239 u32 self_test_addr; 240 u32 excep_hdlr_addr; 241 u32 inq_conf_addr; 242 u32 set_cm_entry_addr; 243 u32 image_unpack_addr; 244 u32 pa_risx_addrs[7]; 245}; 246 247struct sti_rom_font { 248 u16 first_char; 249 u16 last_char; 250 u8 width; 251 u8 height; 252 u8 font_type; /* language type */ 253 u8 bytes_per_char; 254 u32 next_font; 255 u8 underline_height; 256 u8 underline_pos; 257 u8 res008[2]; 258}; 259 260/* sticore internal font handling */ 261 262struct sti_cooked_font { 263 struct sti_rom_font *raw; 264 struct sti_cooked_font *next_font; 265}; 266 267struct sti_cooked_rom { 268 struct sti_rom *raw; 269 struct sti_cooked_font *font_start; 270}; 271 272/* STI font printing function structs */ 273 274struct sti_font_inptr { 275 u32 font_start_addr; /* address of font start */ 276 s16 index; /* index into font table of character */ 277 u8 fg_color; /* foreground color of character */ 278 u8 bg_color; /* background color of character */ 279 s16 dest_x; /* X location of character upper left */ 280 s16 dest_y; /* Y location of character upper left */ 281 u32 future_ptr; /* pointer to future data */ 282}; 283 284struct sti_font_flags { 285 u32 wait : 1; /* should routine idle wait or not */ 286 u32 non_text : 1; /* font unpack/move in non_text planes =1, text =0 */ 287 u32 pad : 30; /* pad to word boundary */ 288 u32 future_ptr; /* pointer to future data */ 289}; 290 291struct sti_font_outptr { 292 s32 errno; /* error number on failure */ 293 u32 future_ptr; /* pointer to future data */ 294}; 295 296/* STI blockmove structs */ 297 298struct sti_blkmv_flags { 299 u32 wait : 1; /* should routine idle wait or not */ 300 u32 color : 1; /* change color during move? */ 301 u32 clear : 1; /* clear during move? */ 302 u32 non_text : 1; /* block move in non_text planes =1, text =0 */ 303 u32 pad : 28; /* pad to word boundary */ 304 u32 future_ptr; /* pointer to future data */ 305}; 306 307struct sti_blkmv_inptr { 308 u8 fg_color; /* foreground color after move */ 309 u8 bg_color; /* background color after move */ 310 s16 src_x; /* source upper left pixel x location */ 311 s16 src_y; /* source upper left pixel y location */ 312 s16 dest_x; /* dest upper left pixel x location */ 313 s16 dest_y; /* dest upper left pixel y location */ 314 s16 width; /* block width in pixels */ 315 s16 height; /* block height in pixels */ 316 u32 future_ptr; /* pointer to future data */ 317}; 318 319struct sti_blkmv_outptr { 320 s32 errno; /* error number on failure */ 321 u32 future_ptr; /* pointer to future data */ 322}; 323 324 325/* internal generic STI struct */ 326 327struct sti_struct { 328 spinlock_t lock; 329 330 /* the following fields needs to be filled in by the word/byte routines */ 331 int font_width; 332 int font_height; 333 /* char **mon_strings; */ 334 int sti_mem_request; 335 u32 graphics_id[2]; 336 337 struct sti_cooked_rom *rom; 338 339 unsigned long font_unpmv; 340 unsigned long block_move; 341 unsigned long init_graph; 342 unsigned long inq_conf; 343 344 /* all following fields are initialized by the generic routines */ 345 int text_planes; 346 region_t regions[STI_REGION_MAX]; 347 unsigned long regions_phys[STI_REGION_MAX]; 348 349 struct sti_glob_cfg *glob_cfg; 350 struct sti_cooked_font *font; /* ptr to selected font (cooked) */ 351 352 struct sti_conf_outptr outptr; /* configuration */ 353 struct sti_conf_outptr_ext outptr_ext; 354 355 /* PCI data structures (pg. 17ff from sti.pdf) */ 356 struct pci_dev *pd; 357 u8 rm_entry[16]; /* pci region mapper array == pci config space offset */ 358 359 /* pointer to the fb_info where this STI device is used */ 360 struct fb_info *info; 361}; 362 363 364/* sticore interface functions */ 365 366struct sti_struct *sti_get_rom(unsigned int index); /* 0: default sti */ 367 368/* functions to call the STI ROM directly */ 369 370int sti_init_graph(struct sti_struct *sti); 371void sti_inq_conf(struct sti_struct *sti); 372void sti_putc(struct sti_struct *sti, int c, int y, int x); 373void sti_set(struct sti_struct *sti, int src_y, int src_x, 374 int height, int width, u8 color); 375void sti_clear(struct sti_struct *sti, int src_y, int src_x, 376 int height, int width, int c); 377void sti_bmove(struct sti_struct *sti, int src_y, int src_x, 378 int dst_y, int dst_x, int height, int width); 379 380#endif /* STICORE_H */