162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef STICORE_H 362306a36Sopenharmony_ci#define STICORE_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_cistruct fb_info; 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci/* generic STI structures & functions */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#define MAX_STI_ROMS 4 /* max no. of ROMs which this driver handles */ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#define STI_REGION_MAX 8 /* hardcoded STI constants */ 1262306a36Sopenharmony_ci#define STI_DEV_NAME_LENGTH 32 1362306a36Sopenharmony_ci#define STI_MONITOR_MAX 256 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#define STI_FONT_HPROMAN8 1 1662306a36Sopenharmony_ci#define STI_FONT_KANA8 2 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define ALT_CODE_TYPE_UNKNOWN 0x00 /* alt code type values */ 1962306a36Sopenharmony_ci#define ALT_CODE_TYPE_PA_RISC_64 0x01 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci/* The latency of the STI functions cannot really be reduced by setting 2262306a36Sopenharmony_ci * this to 0; STI doesn't seem to be designed to allow calling a different 2362306a36Sopenharmony_ci * function (or the same function with different arguments) after a 2462306a36Sopenharmony_ci * function exited with 1 as return value. 2562306a36Sopenharmony_ci * 2662306a36Sopenharmony_ci * As all of the functions below could be called from interrupt context, 2762306a36Sopenharmony_ci * we have to spin_lock_irqsave around the do { ret = bla(); } while(ret==1) 2862306a36Sopenharmony_ci * block. Really bad latency there. 2962306a36Sopenharmony_ci * 3062306a36Sopenharmony_ci * Probably the best solution to all this is have the generic code manage 3162306a36Sopenharmony_ci * the screen buffer and a kernel thread to call STI occasionally. 3262306a36Sopenharmony_ci * 3362306a36Sopenharmony_ci * Luckily, the frame buffer guys have the same problem so we can just wait 3462306a36Sopenharmony_ci * for them to fix it and steal their solution. prumpf 3562306a36Sopenharmony_ci */ 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#include <asm/io.h> 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define STI_WAIT 1 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci#define STI_PTR(p) ( virt_to_phys(p) ) 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x) 4462306a36Sopenharmony_ci#define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y) 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci/* sti_font_xy() use the native font ROM ! */ 4762306a36Sopenharmony_ci#define sti_font_x(sti) (PTR_STI(sti->font)->width) 4862306a36Sopenharmony_ci#define sti_font_y(sti) (PTR_STI(sti->font)->height) 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#ifdef CONFIG_64BIT 5162306a36Sopenharmony_ci#define STI_LOWMEM (GFP_KERNEL | GFP_DMA) 5262306a36Sopenharmony_ci#else 5362306a36Sopenharmony_ci#define STI_LOWMEM (GFP_KERNEL) 5462306a36Sopenharmony_ci#endif 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci/* STI function configuration structs */ 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_citypedef union region { 6062306a36Sopenharmony_ci struct { 6162306a36Sopenharmony_ci u32 offset : 14; /* offset in 4kbyte page */ 6262306a36Sopenharmony_ci u32 sys_only : 1; /* don't map to user space */ 6362306a36Sopenharmony_ci u32 cache : 1; /* map to data cache */ 6462306a36Sopenharmony_ci u32 btlb : 1; /* map to block tlb */ 6562306a36Sopenharmony_ci u32 last : 1; /* last region in list */ 6662306a36Sopenharmony_ci u32 length : 14; /* length in 4kbyte page */ 6762306a36Sopenharmony_ci } region_desc; 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci u32 region; /* complete region value */ 7062306a36Sopenharmony_ci} region_t; 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci#define REGION_OFFSET_TO_PHYS( rt, hpa ) \ 7362306a36Sopenharmony_ci (((rt).region_desc.offset << 12) + (hpa)) 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_cistruct sti_glob_cfg_ext { 7662306a36Sopenharmony_ci u8 curr_mon; /* current monitor configured */ 7762306a36Sopenharmony_ci u8 friendly_boot; /* in friendly boot mode */ 7862306a36Sopenharmony_ci s16 power; /* power calculation (in Watts) */ 7962306a36Sopenharmony_ci s32 freq_ref; /* frequency reference */ 8062306a36Sopenharmony_ci u32 *sti_mem_addr; /* pointer to global sti memory (size=sti_mem_request) */ 8162306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 8262306a36Sopenharmony_ci}; 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_cistruct sti_glob_cfg { 8562306a36Sopenharmony_ci s32 text_planes; /* number of planes used for text */ 8662306a36Sopenharmony_ci s16 onscreen_x; /* screen width in pixels */ 8762306a36Sopenharmony_ci s16 onscreen_y; /* screen height in pixels */ 8862306a36Sopenharmony_ci s16 offscreen_x; /* offset width in pixels */ 8962306a36Sopenharmony_ci s16 offscreen_y; /* offset height in pixels */ 9062306a36Sopenharmony_ci s16 total_x; /* frame buffer width in pixels */ 9162306a36Sopenharmony_ci s16 total_y; /* frame buffer height in pixels */ 9262306a36Sopenharmony_ci u32 *region_ptrs[STI_REGION_MAX]; /* region pointers */ 9362306a36Sopenharmony_ci s32 reent_lvl; /* storage for reentry level value */ 9462306a36Sopenharmony_ci u32 *save_addr; /* where to save or restore reentrant state */ 9562306a36Sopenharmony_ci u32 *ext_ptr; /* pointer to extended glob_cfg data structure */ 9662306a36Sopenharmony_ci}; 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci/* STI init function structs */ 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_cistruct sti_init_flags { 10262306a36Sopenharmony_ci u32 wait : 1; /* should routine idle wait or not */ 10362306a36Sopenharmony_ci u32 reset : 1; /* hard reset the device? */ 10462306a36Sopenharmony_ci u32 text : 1; /* turn on text display planes? */ 10562306a36Sopenharmony_ci u32 nontext : 1; /* turn on non-text display planes? */ 10662306a36Sopenharmony_ci u32 clear : 1; /* clear text display planes? */ 10762306a36Sopenharmony_ci u32 cmap_blk : 1; /* non-text planes cmap black? */ 10862306a36Sopenharmony_ci u32 enable_be_timer : 1; /* enable bus error timer */ 10962306a36Sopenharmony_ci u32 enable_be_int : 1; /* enable bus error timer interrupt */ 11062306a36Sopenharmony_ci u32 no_chg_tx : 1; /* don't change text settings */ 11162306a36Sopenharmony_ci u32 no_chg_ntx : 1; /* don't change non-text settings */ 11262306a36Sopenharmony_ci u32 no_chg_bet : 1; /* don't change berr timer settings */ 11362306a36Sopenharmony_ci u32 no_chg_bei : 1; /* don't change berr int settings */ 11462306a36Sopenharmony_ci u32 init_cmap_tx : 1; /* initialize cmap for text planes */ 11562306a36Sopenharmony_ci u32 cmt_chg : 1; /* change current monitor type */ 11662306a36Sopenharmony_ci u32 retain_ie : 1; /* don't allow reset to clear int enables */ 11762306a36Sopenharmony_ci u32 caller_bootrom : 1; /* set only by bootrom for each call */ 11862306a36Sopenharmony_ci u32 caller_kernel : 1; /* set only by kernel for each call */ 11962306a36Sopenharmony_ci u32 caller_other : 1; /* set only by non-[BR/K] caller */ 12062306a36Sopenharmony_ci u32 pad : 14; /* pad to word boundary */ 12162306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 12262306a36Sopenharmony_ci}; 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_cistruct sti_init_inptr_ext { 12562306a36Sopenharmony_ci u8 config_mon_type; /* configure to monitor type */ 12662306a36Sopenharmony_ci u8 pad[1]; /* pad to word boundary */ 12762306a36Sopenharmony_ci u16 inflight_data; /* inflight data possible on PCI */ 12862306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 12962306a36Sopenharmony_ci}; 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_cistruct sti_init_inptr { 13262306a36Sopenharmony_ci s32 text_planes; /* number of planes to use for text */ 13362306a36Sopenharmony_ci u32 *ext_ptr; /* pointer to extended init_graph inptr data structure*/ 13462306a36Sopenharmony_ci}; 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_cistruct sti_init_outptr { 13862306a36Sopenharmony_ci s32 errno; /* error number on failure */ 13962306a36Sopenharmony_ci s32 text_planes; /* number of planes used for text */ 14062306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 14162306a36Sopenharmony_ci}; 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ci/* STI configuration function structs */ 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_cistruct sti_conf_flags { 14862306a36Sopenharmony_ci u32 wait : 1; /* should routine idle wait or not */ 14962306a36Sopenharmony_ci u32 pad : 31; /* pad to word boundary */ 15062306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 15162306a36Sopenharmony_ci}; 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_cistruct sti_conf_inptr { 15462306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 15562306a36Sopenharmony_ci}; 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_cistruct sti_conf_outptr_ext { 15862306a36Sopenharmony_ci u32 crt_config[3]; /* hardware specific X11/OGL information */ 15962306a36Sopenharmony_ci u32 crt_hdw[3]; 16062306a36Sopenharmony_ci u32 *future_ptr; 16162306a36Sopenharmony_ci}; 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_cistruct sti_conf_outptr { 16462306a36Sopenharmony_ci s32 errno; /* error number on failure */ 16562306a36Sopenharmony_ci s16 onscreen_x; /* screen width in pixels */ 16662306a36Sopenharmony_ci s16 onscreen_y; /* screen height in pixels */ 16762306a36Sopenharmony_ci s16 offscreen_x; /* offscreen width in pixels */ 16862306a36Sopenharmony_ci s16 offscreen_y; /* offscreen height in pixels */ 16962306a36Sopenharmony_ci s16 total_x; /* frame buffer width in pixels */ 17062306a36Sopenharmony_ci s16 total_y; /* frame buffer height in pixels */ 17162306a36Sopenharmony_ci s32 bits_per_pixel; /* bits/pixel device has configured */ 17262306a36Sopenharmony_ci s32 bits_used; /* bits which can be accessed */ 17362306a36Sopenharmony_ci s32 planes; /* number of fb planes in system */ 17462306a36Sopenharmony_ci u8 dev_name[STI_DEV_NAME_LENGTH]; /* null terminated product name */ 17562306a36Sopenharmony_ci u32 attributes; /* flags denoting attributes */ 17662306a36Sopenharmony_ci u32 *ext_ptr; /* pointer to future data */ 17762306a36Sopenharmony_ci}; 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_cistruct sti_rom { 18062306a36Sopenharmony_ci u8 type[4]; 18162306a36Sopenharmony_ci u8 res004; 18262306a36Sopenharmony_ci u8 num_mons; 18362306a36Sopenharmony_ci u8 revno[2]; 18462306a36Sopenharmony_ci u32 graphics_id[2]; 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_ci u32 font_start; 18762306a36Sopenharmony_ci u32 statesize; 18862306a36Sopenharmony_ci u32 last_addr; 18962306a36Sopenharmony_ci u32 region_list; 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci u16 reentsize; 19262306a36Sopenharmony_ci u16 maxtime; 19362306a36Sopenharmony_ci u32 mon_tbl_addr; 19462306a36Sopenharmony_ci u32 user_data_addr; 19562306a36Sopenharmony_ci u32 sti_mem_req; 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ci u32 user_data_size; 19862306a36Sopenharmony_ci u16 power; 19962306a36Sopenharmony_ci u8 bus_support; 20062306a36Sopenharmony_ci u8 ext_bus_support; 20162306a36Sopenharmony_ci u8 alt_code_type; 20262306a36Sopenharmony_ci u8 ext_dd_struct[3]; 20362306a36Sopenharmony_ci u32 cfb_addr; 20462306a36Sopenharmony_ci 20562306a36Sopenharmony_ci u32 init_graph; 20662306a36Sopenharmony_ci u32 state_mgmt; 20762306a36Sopenharmony_ci u32 font_unpmv; 20862306a36Sopenharmony_ci u32 block_move; 20962306a36Sopenharmony_ci u32 self_test; 21062306a36Sopenharmony_ci u32 excep_hdlr; 21162306a36Sopenharmony_ci u32 inq_conf; 21262306a36Sopenharmony_ci u32 set_cm_entry; 21362306a36Sopenharmony_ci u32 dma_ctrl; 21462306a36Sopenharmony_ci u8 res040[7 * 4]; 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ci u32 init_graph_addr; 21762306a36Sopenharmony_ci u32 state_mgmt_addr; 21862306a36Sopenharmony_ci u32 font_unp_addr; 21962306a36Sopenharmony_ci u32 block_move_addr; 22062306a36Sopenharmony_ci u32 self_test_addr; 22162306a36Sopenharmony_ci u32 excep_hdlr_addr; 22262306a36Sopenharmony_ci u32 inq_conf_addr; 22362306a36Sopenharmony_ci u32 set_cm_entry_addr; 22462306a36Sopenharmony_ci u32 image_unpack_addr; 22562306a36Sopenharmony_ci u32 pa_risx_addrs[7]; 22662306a36Sopenharmony_ci}; 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_cistruct sti_rom_font { 22962306a36Sopenharmony_ci u16 first_char; 23062306a36Sopenharmony_ci u16 last_char; 23162306a36Sopenharmony_ci u8 width; 23262306a36Sopenharmony_ci u8 height; 23362306a36Sopenharmony_ci u8 font_type; /* language type */ 23462306a36Sopenharmony_ci u8 bytes_per_char; 23562306a36Sopenharmony_ci s32 next_font; /* note: signed int */ 23662306a36Sopenharmony_ci u8 underline_height; 23762306a36Sopenharmony_ci u8 underline_pos; 23862306a36Sopenharmony_ci u8 res008[2]; 23962306a36Sopenharmony_ci}; 24062306a36Sopenharmony_ci 24162306a36Sopenharmony_ci/* sticore internal font handling */ 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_cistruct sti_cooked_font { 24462306a36Sopenharmony_ci struct sti_rom_font *raw; /* native ptr for STI functions */ 24562306a36Sopenharmony_ci void *raw_ptr; /* kmalloc'ed font data */ 24662306a36Sopenharmony_ci struct sti_cooked_font *next_font; 24762306a36Sopenharmony_ci int height, width; 24862306a36Sopenharmony_ci int refcount; 24962306a36Sopenharmony_ci u32 crc; 25062306a36Sopenharmony_ci}; 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_cistruct sti_cooked_rom { 25362306a36Sopenharmony_ci struct sti_rom *raw; 25462306a36Sopenharmony_ci struct sti_cooked_font *font_start; 25562306a36Sopenharmony_ci}; 25662306a36Sopenharmony_ci 25762306a36Sopenharmony_ci/* STI font printing function structs */ 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_cistruct sti_font_inptr { 26062306a36Sopenharmony_ci u32 *font_start_addr; /* address of font start */ 26162306a36Sopenharmony_ci s16 index; /* index into font table of character */ 26262306a36Sopenharmony_ci u8 fg_color; /* foreground color of character */ 26362306a36Sopenharmony_ci u8 bg_color; /* background color of character */ 26462306a36Sopenharmony_ci s16 dest_x; /* X location of character upper left */ 26562306a36Sopenharmony_ci s16 dest_y; /* Y location of character upper left */ 26662306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 26762306a36Sopenharmony_ci}; 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_cistruct sti_font_flags { 27062306a36Sopenharmony_ci u32 wait : 1; /* should routine idle wait or not */ 27162306a36Sopenharmony_ci u32 non_text : 1; /* font unpack/move in non_text planes =1, text =0 */ 27262306a36Sopenharmony_ci u32 pad : 30; /* pad to word boundary */ 27362306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 27462306a36Sopenharmony_ci}; 27562306a36Sopenharmony_ci 27662306a36Sopenharmony_cistruct sti_font_outptr { 27762306a36Sopenharmony_ci s32 errno; /* error number on failure */ 27862306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 27962306a36Sopenharmony_ci}; 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_ci/* STI blockmove structs */ 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_cistruct sti_blkmv_flags { 28462306a36Sopenharmony_ci u32 wait : 1; /* should routine idle wait or not */ 28562306a36Sopenharmony_ci u32 color : 1; /* change color during move? */ 28662306a36Sopenharmony_ci u32 clear : 1; /* clear during move? */ 28762306a36Sopenharmony_ci u32 non_text : 1; /* block move in non_text planes =1, text =0 */ 28862306a36Sopenharmony_ci u32 pad : 28; /* pad to word boundary */ 28962306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 29062306a36Sopenharmony_ci}; 29162306a36Sopenharmony_ci 29262306a36Sopenharmony_cistruct sti_blkmv_inptr { 29362306a36Sopenharmony_ci u8 fg_color; /* foreground color after move */ 29462306a36Sopenharmony_ci u8 bg_color; /* background color after move */ 29562306a36Sopenharmony_ci s16 src_x; /* source upper left pixel x location */ 29662306a36Sopenharmony_ci s16 src_y; /* source upper left pixel y location */ 29762306a36Sopenharmony_ci s16 dest_x; /* dest upper left pixel x location */ 29862306a36Sopenharmony_ci s16 dest_y; /* dest upper left pixel y location */ 29962306a36Sopenharmony_ci s16 width; /* block width in pixels */ 30062306a36Sopenharmony_ci s16 height; /* block height in pixels */ 30162306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 30262306a36Sopenharmony_ci}; 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_cistruct sti_blkmv_outptr { 30562306a36Sopenharmony_ci s32 errno; /* error number on failure */ 30662306a36Sopenharmony_ci u32 *future_ptr; /* pointer to future data */ 30762306a36Sopenharmony_ci}; 30862306a36Sopenharmony_ci 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_ci/* sti_all_data is an internal struct which needs to be allocated in 31162306a36Sopenharmony_ci * low memory (< 4GB) if STI is used with 32bit STI on a 64bit kernel */ 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_cistruct sti_all_data { 31462306a36Sopenharmony_ci struct sti_glob_cfg glob_cfg; 31562306a36Sopenharmony_ci struct sti_glob_cfg_ext glob_cfg_ext; 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ci struct sti_conf_inptr inq_inptr; 31862306a36Sopenharmony_ci struct sti_conf_outptr inq_outptr; /* configuration */ 31962306a36Sopenharmony_ci struct sti_conf_outptr_ext inq_outptr_ext; 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ci struct sti_init_inptr_ext init_inptr_ext; 32262306a36Sopenharmony_ci struct sti_init_inptr init_inptr; 32362306a36Sopenharmony_ci struct sti_init_outptr init_outptr; 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_ci struct sti_blkmv_inptr blkmv_inptr; 32662306a36Sopenharmony_ci struct sti_blkmv_outptr blkmv_outptr; 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_ci struct sti_font_inptr font_inptr; 32962306a36Sopenharmony_ci struct sti_font_outptr font_outptr; 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_ci /* leave as last entries */ 33262306a36Sopenharmony_ci unsigned long save_addr[1024 / sizeof(unsigned long)]; 33362306a36Sopenharmony_ci /* min 256 bytes which is STI default, max sti->sti_mem_request */ 33462306a36Sopenharmony_ci unsigned long sti_mem_addr[256 / sizeof(unsigned long)]; 33562306a36Sopenharmony_ci /* do not add something below here ! */ 33662306a36Sopenharmony_ci}; 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_ci/* internal generic STI struct */ 33962306a36Sopenharmony_ci 34062306a36Sopenharmony_cistruct sti_struct { 34162306a36Sopenharmony_ci spinlock_t lock; 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_ci /* char **mon_strings; */ 34462306a36Sopenharmony_ci int sti_mem_request; 34562306a36Sopenharmony_ci u32 graphics_id[2]; 34662306a36Sopenharmony_ci 34762306a36Sopenharmony_ci struct sti_cooked_rom *rom; 34862306a36Sopenharmony_ci 34962306a36Sopenharmony_ci unsigned long font_unpmv; 35062306a36Sopenharmony_ci unsigned long block_move; 35162306a36Sopenharmony_ci unsigned long init_graph; 35262306a36Sopenharmony_ci unsigned long inq_conf; 35362306a36Sopenharmony_ci int do_call64; /* call 64-bit code */ 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_ci /* all following fields are initialized by the generic routines */ 35662306a36Sopenharmony_ci int text_planes; 35762306a36Sopenharmony_ci region_t regions[STI_REGION_MAX]; 35862306a36Sopenharmony_ci unsigned long regions_phys[STI_REGION_MAX]; 35962306a36Sopenharmony_ci 36062306a36Sopenharmony_ci struct sti_glob_cfg *glob_cfg; /* points into sti_all_data */ 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci int wordmode; 36362306a36Sopenharmony_ci struct sti_cooked_font *font; /* ptr to selected font (cooked) */ 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_ci struct pci_dev *pd; 36662306a36Sopenharmony_ci 36762306a36Sopenharmony_ci /* PCI data structures (pg. 17ff from sti.pdf) */ 36862306a36Sopenharmony_ci u8 rm_entry[16]; /* pci region mapper array == pci config space offset */ 36962306a36Sopenharmony_ci 37062306a36Sopenharmony_ci /* pointer to the fb_info where this STI device is used */ 37162306a36Sopenharmony_ci struct fb_info *info; 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci /* pointer to all internal data */ 37462306a36Sopenharmony_ci struct sti_all_data *sti_data; 37562306a36Sopenharmony_ci 37662306a36Sopenharmony_ci /* pa_path of this device */ 37762306a36Sopenharmony_ci char pa_path[24]; 37862306a36Sopenharmony_ci}; 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ci 38162306a36Sopenharmony_ci/* sticore interface functions */ 38262306a36Sopenharmony_ci 38362306a36Sopenharmony_cistruct sti_struct *sti_get_rom(unsigned int index); /* 0: default sti */ 38462306a36Sopenharmony_civoid sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f); 38562306a36Sopenharmony_ci 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_ci/* sticore main function to call STI firmware */ 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_ciint sti_call(const struct sti_struct *sti, unsigned long func, 39062306a36Sopenharmony_ci const void *flags, void *inptr, void *outptr, 39162306a36Sopenharmony_ci struct sti_glob_cfg *glob_cfg); 39262306a36Sopenharmony_ci 39362306a36Sopenharmony_ci 39462306a36Sopenharmony_ci/* functions to call the STI ROM directly */ 39562306a36Sopenharmony_ci 39662306a36Sopenharmony_civoid sti_putc(struct sti_struct *sti, int c, int y, int x, 39762306a36Sopenharmony_ci struct sti_cooked_font *font); 39862306a36Sopenharmony_civoid sti_set(struct sti_struct *sti, int src_y, int src_x, 39962306a36Sopenharmony_ci int height, int width, u8 color); 40062306a36Sopenharmony_civoid sti_clear(struct sti_struct *sti, int src_y, int src_x, 40162306a36Sopenharmony_ci int height, int width, int c, struct sti_cooked_font *font); 40262306a36Sopenharmony_civoid sti_bmove(struct sti_struct *sti, int src_y, int src_x, 40362306a36Sopenharmony_ci int dst_y, int dst_x, int height, int width, 40462306a36Sopenharmony_ci struct sti_cooked_font *font); 40562306a36Sopenharmony_ci 40662306a36Sopenharmony_ci#endif /* STICORE_H */ 407