0001
0002 #ifndef STICORE_H
0003 #define STICORE_H
0004
0005
0006
0007 #define MAX_STI_ROMS 4
0008
0009 #define STI_REGION_MAX 8
0010 #define STI_DEV_NAME_LENGTH 32
0011 #define STI_MONITOR_MAX 256
0012
0013 #define STI_FONT_HPROMAN8 1
0014 #define STI_FONT_KANA8 2
0015
0016 #define ALT_CODE_TYPE_UNKNOWN 0x00
0017 #define ALT_CODE_TYPE_PA_RISC_64 0x01
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #include <asm/io.h>
0036
0037 #define STI_WAIT 1
0038
0039 #define STI_PTR(p) ( virt_to_phys(p) )
0040 #define PTR_STI(p) ( phys_to_virt((unsigned long)p) )
0041
0042 #define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x)
0043 #define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y)
0044
0045
0046 #define sti_font_x(sti) (PTR_STI(sti->font)->width)
0047 #define sti_font_y(sti) (PTR_STI(sti->font)->height)
0048
0049 #ifdef CONFIG_64BIT
0050 #define STI_LOWMEM (GFP_KERNEL | GFP_DMA)
0051 #else
0052 #define STI_LOWMEM (GFP_KERNEL)
0053 #endif
0054
0055
0056
0057
0058 typedef union region {
0059 struct {
0060 u32 offset : 14;
0061 u32 sys_only : 1;
0062 u32 cache : 1;
0063 u32 btlb : 1;
0064 u32 last : 1;
0065 u32 length : 14;
0066 } region_desc;
0067
0068 u32 region;
0069 } region_t;
0070
0071 #define REGION_OFFSET_TO_PHYS( rt, hpa ) \
0072 (((rt).region_desc.offset << 12) + (hpa))
0073
0074 struct sti_glob_cfg_ext {
0075 u8 curr_mon;
0076 u8 friendly_boot;
0077 s16 power;
0078 s32 freq_ref;
0079 u32 sti_mem_addr;
0080 u32 future_ptr;
0081 };
0082
0083 struct sti_glob_cfg {
0084 s32 text_planes;
0085 s16 onscreen_x;
0086 s16 onscreen_y;
0087 s16 offscreen_x;
0088 s16 offscreen_y;
0089 s16 total_x;
0090 s16 total_y;
0091 u32 region_ptrs[STI_REGION_MAX];
0092 s32 reent_lvl;
0093 u32 save_addr;
0094 u32 ext_ptr;
0095 };
0096
0097
0098
0099
0100 struct sti_init_flags {
0101 u32 wait : 1;
0102 u32 reset : 1;
0103 u32 text : 1;
0104 u32 nontext : 1;
0105 u32 clear : 1;
0106 u32 cmap_blk : 1;
0107 u32 enable_be_timer : 1;
0108 u32 enable_be_int : 1;
0109 u32 no_chg_tx : 1;
0110 u32 no_chg_ntx : 1;
0111 u32 no_chg_bet : 1;
0112 u32 no_chg_bei : 1;
0113 u32 init_cmap_tx : 1;
0114 u32 cmt_chg : 1;
0115 u32 retain_ie : 1;
0116 u32 caller_bootrom : 1;
0117 u32 caller_kernel : 1;
0118 u32 caller_other : 1;
0119 u32 pad : 14;
0120 u32 future_ptr;
0121 };
0122
0123 struct sti_init_inptr_ext {
0124 u8 config_mon_type;
0125 u8 pad[1];
0126 u16 inflight_data;
0127 u32 future_ptr;
0128 };
0129
0130 struct sti_init_inptr {
0131 s32 text_planes;
0132 u32 ext_ptr;
0133 };
0134
0135
0136 struct sti_init_outptr {
0137 s32 errno;
0138 s32 text_planes;
0139 u32 future_ptr;
0140 };
0141
0142
0143
0144
0145
0146 struct sti_conf_flags {
0147 u32 wait : 1;
0148 u32 pad : 31;
0149 u32 future_ptr;
0150 };
0151
0152 struct sti_conf_inptr {
0153 u32 future_ptr;
0154 };
0155
0156 struct sti_conf_outptr_ext {
0157 u32 crt_config[3];
0158 u32 crt_hdw[3];
0159 u32 future_ptr;
0160 };
0161
0162 struct sti_conf_outptr {
0163 s32 errno;
0164 s16 onscreen_x;
0165 s16 onscreen_y;
0166 s16 offscreen_x;
0167 s16 offscreen_y;
0168 s16 total_x;
0169 s16 total_y;
0170 s32 bits_per_pixel;
0171 s32 bits_used;
0172 s32 planes;
0173 u8 dev_name[STI_DEV_NAME_LENGTH];
0174 u32 attributes;
0175 u32 ext_ptr;
0176 };
0177
0178 struct sti_rom {
0179 u8 type[4];
0180 u8 res004;
0181 u8 num_mons;
0182 u8 revno[2];
0183 u32 graphics_id[2];
0184
0185 u32 font_start;
0186 u32 statesize;
0187 u32 last_addr;
0188 u32 region_list;
0189
0190 u16 reentsize;
0191 u16 maxtime;
0192 u32 mon_tbl_addr;
0193 u32 user_data_addr;
0194 u32 sti_mem_req;
0195
0196 u32 user_data_size;
0197 u16 power;
0198 u8 bus_support;
0199 u8 ext_bus_support;
0200 u8 alt_code_type;
0201 u8 ext_dd_struct[3];
0202 u32 cfb_addr;
0203
0204 u32 init_graph;
0205 u32 state_mgmt;
0206 u32 font_unpmv;
0207 u32 block_move;
0208 u32 self_test;
0209 u32 excep_hdlr;
0210 u32 inq_conf;
0211 u32 set_cm_entry;
0212 u32 dma_ctrl;
0213 u8 res040[7 * 4];
0214
0215 u32 init_graph_addr;
0216 u32 state_mgmt_addr;
0217 u32 font_unp_addr;
0218 u32 block_move_addr;
0219 u32 self_test_addr;
0220 u32 excep_hdlr_addr;
0221 u32 inq_conf_addr;
0222 u32 set_cm_entry_addr;
0223 u32 image_unpack_addr;
0224 u32 pa_risx_addrs[7];
0225 };
0226
0227 struct sti_rom_font {
0228 u16 first_char;
0229 u16 last_char;
0230 u8 width;
0231 u8 height;
0232 u8 font_type;
0233 u8 bytes_per_char;
0234 u32 next_font;
0235 u8 underline_height;
0236 u8 underline_pos;
0237 u8 res008[2];
0238 };
0239
0240
0241
0242 struct sti_cooked_font {
0243 struct sti_rom_font *raw;
0244 void *raw_ptr;
0245 struct sti_cooked_font *next_font;
0246 int height, width;
0247 int refcount;
0248 u32 crc;
0249 };
0250
0251 struct sti_cooked_rom {
0252 struct sti_rom *raw;
0253 struct sti_cooked_font *font_start;
0254 };
0255
0256
0257
0258 struct sti_font_inptr {
0259 u32 font_start_addr;
0260 s16 index;
0261 u8 fg_color;
0262 u8 bg_color;
0263 s16 dest_x;
0264 s16 dest_y;
0265 u32 future_ptr;
0266 };
0267
0268 struct sti_font_flags {
0269 u32 wait : 1;
0270 u32 non_text : 1;
0271 u32 pad : 30;
0272 u32 future_ptr;
0273 };
0274
0275 struct sti_font_outptr {
0276 s32 errno;
0277 u32 future_ptr;
0278 };
0279
0280
0281
0282 struct sti_blkmv_flags {
0283 u32 wait : 1;
0284 u32 color : 1;
0285 u32 clear : 1;
0286 u32 non_text : 1;
0287 u32 pad : 28;
0288 u32 future_ptr;
0289 };
0290
0291 struct sti_blkmv_inptr {
0292 u8 fg_color;
0293 u8 bg_color;
0294 s16 src_x;
0295 s16 src_y;
0296 s16 dest_x;
0297 s16 dest_y;
0298 s16 width;
0299 s16 height;
0300 u32 future_ptr;
0301 };
0302
0303 struct sti_blkmv_outptr {
0304 s32 errno;
0305 u32 future_ptr;
0306 };
0307
0308
0309
0310
0311
0312 struct sti_all_data {
0313 struct sti_glob_cfg glob_cfg;
0314 struct sti_glob_cfg_ext glob_cfg_ext;
0315
0316 struct sti_conf_inptr inq_inptr;
0317 struct sti_conf_outptr inq_outptr;
0318 struct sti_conf_outptr_ext inq_outptr_ext;
0319
0320 struct sti_init_inptr_ext init_inptr_ext;
0321 struct sti_init_inptr init_inptr;
0322 struct sti_init_outptr init_outptr;
0323
0324 struct sti_blkmv_inptr blkmv_inptr;
0325 struct sti_blkmv_outptr blkmv_outptr;
0326
0327 struct sti_font_inptr font_inptr;
0328 struct sti_font_outptr font_outptr;
0329
0330
0331 unsigned long save_addr[1024 / sizeof(unsigned long)];
0332
0333 unsigned long sti_mem_addr[256 / sizeof(unsigned long)];
0334
0335 };
0336
0337
0338
0339 struct sti_struct {
0340 spinlock_t lock;
0341
0342
0343 int sti_mem_request;
0344 u32 graphics_id[2];
0345
0346 struct sti_cooked_rom *rom;
0347
0348 unsigned long font_unpmv;
0349 unsigned long block_move;
0350 unsigned long init_graph;
0351 unsigned long inq_conf;
0352
0353
0354 int text_planes;
0355 region_t regions[STI_REGION_MAX];
0356 unsigned long regions_phys[STI_REGION_MAX];
0357
0358 struct sti_glob_cfg *glob_cfg;
0359
0360 int wordmode;
0361 struct sti_cooked_font *font;
0362
0363 struct pci_dev *pd;
0364
0365
0366 u8 rm_entry[16];
0367
0368
0369 struct fb_info *info;
0370
0371
0372 struct sti_all_data *sti_data;
0373
0374
0375 char pa_path[24];
0376 };
0377
0378
0379
0380
0381 struct sti_struct *sti_get_rom(unsigned int index);
0382 void sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f);
0383
0384
0385
0386
0387 int sti_call(const struct sti_struct *sti, unsigned long func,
0388 const void *flags, void *inptr, void *outptr,
0389 struct sti_glob_cfg *glob_cfg);
0390
0391
0392
0393
0394 void sti_putc(struct sti_struct *sti, int c, int y, int x,
0395 struct sti_cooked_font *font);
0396 void sti_set(struct sti_struct *sti, int src_y, int src_x,
0397 int height, int width, u8 color);
0398 void sti_clear(struct sti_struct *sti, int src_y, int src_x,
0399 int height, int width, int c, struct sti_cooked_font *font);
0400 void sti_bmove(struct sti_struct *sti, int src_y, int src_x,
0401 int dst_y, int dst_x, int height, int width,
0402 struct sti_cooked_font *font);
0403
0404 #endif