18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef STICORE_H 38c2ecf20Sopenharmony_ci#define STICORE_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* generic STI structures & functions */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define MAX_STI_ROMS 4 /* max no. of ROMs which this driver handles */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define STI_REGION_MAX 8 /* hardcoded STI constants */ 108c2ecf20Sopenharmony_ci#define STI_DEV_NAME_LENGTH 32 118c2ecf20Sopenharmony_ci#define STI_MONITOR_MAX 256 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define STI_FONT_HPROMAN8 1 148c2ecf20Sopenharmony_ci#define STI_FONT_KANA8 2 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#define ALT_CODE_TYPE_UNKNOWN 0x00 /* alt code type values */ 178c2ecf20Sopenharmony_ci#define ALT_CODE_TYPE_PA_RISC_64 0x01 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci/* The latency of the STI functions cannot really be reduced by setting 208c2ecf20Sopenharmony_ci * this to 0; STI doesn't seem to be designed to allow calling a different 218c2ecf20Sopenharmony_ci * function (or the same function with different arguments) after a 228c2ecf20Sopenharmony_ci * function exited with 1 as return value. 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * As all of the functions below could be called from interrupt context, 258c2ecf20Sopenharmony_ci * we have to spin_lock_irqsave around the do { ret = bla(); } while(ret==1) 268c2ecf20Sopenharmony_ci * block. Really bad latency there. 278c2ecf20Sopenharmony_ci * 288c2ecf20Sopenharmony_ci * Probably the best solution to all this is have the generic code manage 298c2ecf20Sopenharmony_ci * the screen buffer and a kernel thread to call STI occasionally. 308c2ecf20Sopenharmony_ci * 318c2ecf20Sopenharmony_ci * Luckily, the frame buffer guys have the same problem so we can just wait 328c2ecf20Sopenharmony_ci * for them to fix it and steal their solution. prumpf 338c2ecf20Sopenharmony_ci */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#include <asm/io.h> 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define STI_WAIT 1 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define STI_PTR(p) ( virt_to_phys(p) ) 408c2ecf20Sopenharmony_ci#define PTR_STI(p) ( phys_to_virt((unsigned long)p) ) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x) 438c2ecf20Sopenharmony_ci#define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y) 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* sti_font_xy() use the native font ROM ! */ 468c2ecf20Sopenharmony_ci#define sti_font_x(sti) (PTR_STI(sti->font)->width) 478c2ecf20Sopenharmony_ci#define sti_font_y(sti) (PTR_STI(sti->font)->height) 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#ifdef CONFIG_64BIT 508c2ecf20Sopenharmony_ci#define STI_LOWMEM (GFP_KERNEL | GFP_DMA) 518c2ecf20Sopenharmony_ci#else 528c2ecf20Sopenharmony_ci#define STI_LOWMEM (GFP_KERNEL) 538c2ecf20Sopenharmony_ci#endif 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* STI function configuration structs */ 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_citypedef union region { 598c2ecf20Sopenharmony_ci struct { 608c2ecf20Sopenharmony_ci u32 offset : 14; /* offset in 4kbyte page */ 618c2ecf20Sopenharmony_ci u32 sys_only : 1; /* don't map to user space */ 628c2ecf20Sopenharmony_ci u32 cache : 1; /* map to data cache */ 638c2ecf20Sopenharmony_ci u32 btlb : 1; /* map to block tlb */ 648c2ecf20Sopenharmony_ci u32 last : 1; /* last region in list */ 658c2ecf20Sopenharmony_ci u32 length : 14; /* length in 4kbyte page */ 668c2ecf20Sopenharmony_ci } region_desc; 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci u32 region; /* complete region value */ 698c2ecf20Sopenharmony_ci} region_t; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci#define REGION_OFFSET_TO_PHYS( rt, hpa ) \ 728c2ecf20Sopenharmony_ci (((rt).region_desc.offset << 12) + (hpa)) 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_cistruct sti_glob_cfg_ext { 758c2ecf20Sopenharmony_ci u8 curr_mon; /* current monitor configured */ 768c2ecf20Sopenharmony_ci u8 friendly_boot; /* in friendly boot mode */ 778c2ecf20Sopenharmony_ci s16 power; /* power calculation (in Watts) */ 788c2ecf20Sopenharmony_ci s32 freq_ref; /* frequency reference */ 798c2ecf20Sopenharmony_ci u32 sti_mem_addr; /* pointer to global sti memory (size=sti_mem_request) */ 808c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 818c2ecf20Sopenharmony_ci}; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_cistruct sti_glob_cfg { 848c2ecf20Sopenharmony_ci s32 text_planes; /* number of planes used for text */ 858c2ecf20Sopenharmony_ci s16 onscreen_x; /* screen width in pixels */ 868c2ecf20Sopenharmony_ci s16 onscreen_y; /* screen height in pixels */ 878c2ecf20Sopenharmony_ci s16 offscreen_x; /* offset width in pixels */ 888c2ecf20Sopenharmony_ci s16 offscreen_y; /* offset height in pixels */ 898c2ecf20Sopenharmony_ci s16 total_x; /* frame buffer width in pixels */ 908c2ecf20Sopenharmony_ci s16 total_y; /* frame buffer height in pixels */ 918c2ecf20Sopenharmony_ci u32 region_ptrs[STI_REGION_MAX]; /* region pointers */ 928c2ecf20Sopenharmony_ci s32 reent_lvl; /* storage for reentry level value */ 938c2ecf20Sopenharmony_ci u32 save_addr; /* where to save or restore reentrant state */ 948c2ecf20Sopenharmony_ci u32 ext_ptr; /* pointer to extended glob_cfg data structure */ 958c2ecf20Sopenharmony_ci}; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* STI init function structs */ 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_cistruct sti_init_flags { 1018c2ecf20Sopenharmony_ci u32 wait : 1; /* should routine idle wait or not */ 1028c2ecf20Sopenharmony_ci u32 reset : 1; /* hard reset the device? */ 1038c2ecf20Sopenharmony_ci u32 text : 1; /* turn on text display planes? */ 1048c2ecf20Sopenharmony_ci u32 nontext : 1; /* turn on non-text display planes? */ 1058c2ecf20Sopenharmony_ci u32 clear : 1; /* clear text display planes? */ 1068c2ecf20Sopenharmony_ci u32 cmap_blk : 1; /* non-text planes cmap black? */ 1078c2ecf20Sopenharmony_ci u32 enable_be_timer : 1; /* enable bus error timer */ 1088c2ecf20Sopenharmony_ci u32 enable_be_int : 1; /* enable bus error timer interrupt */ 1098c2ecf20Sopenharmony_ci u32 no_chg_tx : 1; /* don't change text settings */ 1108c2ecf20Sopenharmony_ci u32 no_chg_ntx : 1; /* don't change non-text settings */ 1118c2ecf20Sopenharmony_ci u32 no_chg_bet : 1; /* don't change berr timer settings */ 1128c2ecf20Sopenharmony_ci u32 no_chg_bei : 1; /* don't change berr int settings */ 1138c2ecf20Sopenharmony_ci u32 init_cmap_tx : 1; /* initialize cmap for text planes */ 1148c2ecf20Sopenharmony_ci u32 cmt_chg : 1; /* change current monitor type */ 1158c2ecf20Sopenharmony_ci u32 retain_ie : 1; /* don't allow reset to clear int enables */ 1168c2ecf20Sopenharmony_ci u32 caller_bootrom : 1; /* set only by bootrom for each call */ 1178c2ecf20Sopenharmony_ci u32 caller_kernel : 1; /* set only by kernel for each call */ 1188c2ecf20Sopenharmony_ci u32 caller_other : 1; /* set only by non-[BR/K] caller */ 1198c2ecf20Sopenharmony_ci u32 pad : 14; /* pad to word boundary */ 1208c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 1218c2ecf20Sopenharmony_ci}; 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_cistruct sti_init_inptr_ext { 1248c2ecf20Sopenharmony_ci u8 config_mon_type; /* configure to monitor type */ 1258c2ecf20Sopenharmony_ci u8 pad[1]; /* pad to word boundary */ 1268c2ecf20Sopenharmony_ci u16 inflight_data; /* inflight data possible on PCI */ 1278c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 1288c2ecf20Sopenharmony_ci}; 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_cistruct sti_init_inptr { 1318c2ecf20Sopenharmony_ci s32 text_planes; /* number of planes to use for text */ 1328c2ecf20Sopenharmony_ci u32 ext_ptr; /* pointer to extended init_graph inptr data structure*/ 1338c2ecf20Sopenharmony_ci}; 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_cistruct sti_init_outptr { 1378c2ecf20Sopenharmony_ci s32 errno; /* error number on failure */ 1388c2ecf20Sopenharmony_ci s32 text_planes; /* number of planes used for text */ 1398c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 1408c2ecf20Sopenharmony_ci}; 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci/* STI configuration function structs */ 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_cistruct sti_conf_flags { 1478c2ecf20Sopenharmony_ci u32 wait : 1; /* should routine idle wait or not */ 1488c2ecf20Sopenharmony_ci u32 pad : 31; /* pad to word boundary */ 1498c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 1508c2ecf20Sopenharmony_ci}; 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_cistruct sti_conf_inptr { 1538c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 1548c2ecf20Sopenharmony_ci}; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_cistruct sti_conf_outptr_ext { 1578c2ecf20Sopenharmony_ci u32 crt_config[3]; /* hardware specific X11/OGL information */ 1588c2ecf20Sopenharmony_ci u32 crt_hdw[3]; 1598c2ecf20Sopenharmony_ci u32 future_ptr; 1608c2ecf20Sopenharmony_ci}; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_cistruct sti_conf_outptr { 1638c2ecf20Sopenharmony_ci s32 errno; /* error number on failure */ 1648c2ecf20Sopenharmony_ci s16 onscreen_x; /* screen width in pixels */ 1658c2ecf20Sopenharmony_ci s16 onscreen_y; /* screen height in pixels */ 1668c2ecf20Sopenharmony_ci s16 offscreen_x; /* offscreen width in pixels */ 1678c2ecf20Sopenharmony_ci s16 offscreen_y; /* offscreen height in pixels */ 1688c2ecf20Sopenharmony_ci s16 total_x; /* frame buffer width in pixels */ 1698c2ecf20Sopenharmony_ci s16 total_y; /* frame buffer height in pixels */ 1708c2ecf20Sopenharmony_ci s32 bits_per_pixel; /* bits/pixel device has configured */ 1718c2ecf20Sopenharmony_ci s32 bits_used; /* bits which can be accessed */ 1728c2ecf20Sopenharmony_ci s32 planes; /* number of fb planes in system */ 1738c2ecf20Sopenharmony_ci u8 dev_name[STI_DEV_NAME_LENGTH]; /* null terminated product name */ 1748c2ecf20Sopenharmony_ci u32 attributes; /* flags denoting attributes */ 1758c2ecf20Sopenharmony_ci u32 ext_ptr; /* pointer to future data */ 1768c2ecf20Sopenharmony_ci}; 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_cistruct sti_rom { 1798c2ecf20Sopenharmony_ci u8 type[4]; 1808c2ecf20Sopenharmony_ci u8 res004; 1818c2ecf20Sopenharmony_ci u8 num_mons; 1828c2ecf20Sopenharmony_ci u8 revno[2]; 1838c2ecf20Sopenharmony_ci u32 graphics_id[2]; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci u32 font_start; 1868c2ecf20Sopenharmony_ci u32 statesize; 1878c2ecf20Sopenharmony_ci u32 last_addr; 1888c2ecf20Sopenharmony_ci u32 region_list; 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci u16 reentsize; 1918c2ecf20Sopenharmony_ci u16 maxtime; 1928c2ecf20Sopenharmony_ci u32 mon_tbl_addr; 1938c2ecf20Sopenharmony_ci u32 user_data_addr; 1948c2ecf20Sopenharmony_ci u32 sti_mem_req; 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci u32 user_data_size; 1978c2ecf20Sopenharmony_ci u16 power; 1988c2ecf20Sopenharmony_ci u8 bus_support; 1998c2ecf20Sopenharmony_ci u8 ext_bus_support; 2008c2ecf20Sopenharmony_ci u8 alt_code_type; 2018c2ecf20Sopenharmony_ci u8 ext_dd_struct[3]; 2028c2ecf20Sopenharmony_ci u32 cfb_addr; 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci u32 init_graph; 2058c2ecf20Sopenharmony_ci u32 state_mgmt; 2068c2ecf20Sopenharmony_ci u32 font_unpmv; 2078c2ecf20Sopenharmony_ci u32 block_move; 2088c2ecf20Sopenharmony_ci u32 self_test; 2098c2ecf20Sopenharmony_ci u32 excep_hdlr; 2108c2ecf20Sopenharmony_ci u32 inq_conf; 2118c2ecf20Sopenharmony_ci u32 set_cm_entry; 2128c2ecf20Sopenharmony_ci u32 dma_ctrl; 2138c2ecf20Sopenharmony_ci u8 res040[7 * 4]; 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci u32 init_graph_addr; 2168c2ecf20Sopenharmony_ci u32 state_mgmt_addr; 2178c2ecf20Sopenharmony_ci u32 font_unp_addr; 2188c2ecf20Sopenharmony_ci u32 block_move_addr; 2198c2ecf20Sopenharmony_ci u32 self_test_addr; 2208c2ecf20Sopenharmony_ci u32 excep_hdlr_addr; 2218c2ecf20Sopenharmony_ci u32 inq_conf_addr; 2228c2ecf20Sopenharmony_ci u32 set_cm_entry_addr; 2238c2ecf20Sopenharmony_ci u32 image_unpack_addr; 2248c2ecf20Sopenharmony_ci u32 pa_risx_addrs[7]; 2258c2ecf20Sopenharmony_ci}; 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_cistruct sti_rom_font { 2288c2ecf20Sopenharmony_ci u16 first_char; 2298c2ecf20Sopenharmony_ci u16 last_char; 2308c2ecf20Sopenharmony_ci u8 width; 2318c2ecf20Sopenharmony_ci u8 height; 2328c2ecf20Sopenharmony_ci u8 font_type; /* language type */ 2338c2ecf20Sopenharmony_ci u8 bytes_per_char; 2348c2ecf20Sopenharmony_ci s32 next_font; /* note: signed int */ 2358c2ecf20Sopenharmony_ci u8 underline_height; 2368c2ecf20Sopenharmony_ci u8 underline_pos; 2378c2ecf20Sopenharmony_ci u8 res008[2]; 2388c2ecf20Sopenharmony_ci}; 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci/* sticore internal font handling */ 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_cistruct sti_cooked_font { 2438c2ecf20Sopenharmony_ci struct sti_rom_font *raw; /* native ptr for STI functions */ 2448c2ecf20Sopenharmony_ci void *raw_ptr; /* kmalloc'ed font data */ 2458c2ecf20Sopenharmony_ci struct sti_cooked_font *next_font; 2468c2ecf20Sopenharmony_ci int height, width; 2478c2ecf20Sopenharmony_ci int refcount; 2488c2ecf20Sopenharmony_ci u32 crc; 2498c2ecf20Sopenharmony_ci}; 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_cistruct sti_cooked_rom { 2528c2ecf20Sopenharmony_ci struct sti_rom *raw; 2538c2ecf20Sopenharmony_ci struct sti_cooked_font *font_start; 2548c2ecf20Sopenharmony_ci}; 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci/* STI font printing function structs */ 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_cistruct sti_font_inptr { 2598c2ecf20Sopenharmony_ci u32 font_start_addr; /* address of font start */ 2608c2ecf20Sopenharmony_ci s16 index; /* index into font table of character */ 2618c2ecf20Sopenharmony_ci u8 fg_color; /* foreground color of character */ 2628c2ecf20Sopenharmony_ci u8 bg_color; /* background color of character */ 2638c2ecf20Sopenharmony_ci s16 dest_x; /* X location of character upper left */ 2648c2ecf20Sopenharmony_ci s16 dest_y; /* Y location of character upper left */ 2658c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 2668c2ecf20Sopenharmony_ci}; 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_cistruct sti_font_flags { 2698c2ecf20Sopenharmony_ci u32 wait : 1; /* should routine idle wait or not */ 2708c2ecf20Sopenharmony_ci u32 non_text : 1; /* font unpack/move in non_text planes =1, text =0 */ 2718c2ecf20Sopenharmony_ci u32 pad : 30; /* pad to word boundary */ 2728c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 2738c2ecf20Sopenharmony_ci}; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_cistruct sti_font_outptr { 2768c2ecf20Sopenharmony_ci s32 errno; /* error number on failure */ 2778c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 2788c2ecf20Sopenharmony_ci}; 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci/* STI blockmove structs */ 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_cistruct sti_blkmv_flags { 2838c2ecf20Sopenharmony_ci u32 wait : 1; /* should routine idle wait or not */ 2848c2ecf20Sopenharmony_ci u32 color : 1; /* change color during move? */ 2858c2ecf20Sopenharmony_ci u32 clear : 1; /* clear during move? */ 2868c2ecf20Sopenharmony_ci u32 non_text : 1; /* block move in non_text planes =1, text =0 */ 2878c2ecf20Sopenharmony_ci u32 pad : 28; /* pad to word boundary */ 2888c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 2898c2ecf20Sopenharmony_ci}; 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_cistruct sti_blkmv_inptr { 2928c2ecf20Sopenharmony_ci u8 fg_color; /* foreground color after move */ 2938c2ecf20Sopenharmony_ci u8 bg_color; /* background color after move */ 2948c2ecf20Sopenharmony_ci s16 src_x; /* source upper left pixel x location */ 2958c2ecf20Sopenharmony_ci s16 src_y; /* source upper left pixel y location */ 2968c2ecf20Sopenharmony_ci s16 dest_x; /* dest upper left pixel x location */ 2978c2ecf20Sopenharmony_ci s16 dest_y; /* dest upper left pixel y location */ 2988c2ecf20Sopenharmony_ci s16 width; /* block width in pixels */ 2998c2ecf20Sopenharmony_ci s16 height; /* block height in pixels */ 3008c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 3018c2ecf20Sopenharmony_ci}; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_cistruct sti_blkmv_outptr { 3048c2ecf20Sopenharmony_ci s32 errno; /* error number on failure */ 3058c2ecf20Sopenharmony_ci u32 future_ptr; /* pointer to future data */ 3068c2ecf20Sopenharmony_ci}; 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci/* sti_all_data is an internal struct which needs to be allocated in 3108c2ecf20Sopenharmony_ci * low memory (< 4GB) if STI is used with 32bit STI on a 64bit kernel */ 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_cistruct sti_all_data { 3138c2ecf20Sopenharmony_ci struct sti_glob_cfg glob_cfg; 3148c2ecf20Sopenharmony_ci struct sti_glob_cfg_ext glob_cfg_ext; 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci struct sti_conf_inptr inq_inptr; 3178c2ecf20Sopenharmony_ci struct sti_conf_outptr inq_outptr; /* configuration */ 3188c2ecf20Sopenharmony_ci struct sti_conf_outptr_ext inq_outptr_ext; 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci struct sti_init_inptr_ext init_inptr_ext; 3218c2ecf20Sopenharmony_ci struct sti_init_inptr init_inptr; 3228c2ecf20Sopenharmony_ci struct sti_init_outptr init_outptr; 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci struct sti_blkmv_inptr blkmv_inptr; 3258c2ecf20Sopenharmony_ci struct sti_blkmv_outptr blkmv_outptr; 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci struct sti_font_inptr font_inptr; 3288c2ecf20Sopenharmony_ci struct sti_font_outptr font_outptr; 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci /* leave as last entries */ 3318c2ecf20Sopenharmony_ci unsigned long save_addr[1024 / sizeof(unsigned long)]; 3328c2ecf20Sopenharmony_ci /* min 256 bytes which is STI default, max sti->sti_mem_request */ 3338c2ecf20Sopenharmony_ci unsigned long sti_mem_addr[256 / sizeof(unsigned long)]; 3348c2ecf20Sopenharmony_ci /* do not add something below here ! */ 3358c2ecf20Sopenharmony_ci}; 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_ci/* internal generic STI struct */ 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_cistruct sti_struct { 3408c2ecf20Sopenharmony_ci spinlock_t lock; 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci /* char **mon_strings; */ 3438c2ecf20Sopenharmony_ci int sti_mem_request; 3448c2ecf20Sopenharmony_ci u32 graphics_id[2]; 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci struct sti_cooked_rom *rom; 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ci unsigned long font_unpmv; 3498c2ecf20Sopenharmony_ci unsigned long block_move; 3508c2ecf20Sopenharmony_ci unsigned long init_graph; 3518c2ecf20Sopenharmony_ci unsigned long inq_conf; 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ci /* all following fields are initialized by the generic routines */ 3548c2ecf20Sopenharmony_ci int text_planes; 3558c2ecf20Sopenharmony_ci region_t regions[STI_REGION_MAX]; 3568c2ecf20Sopenharmony_ci unsigned long regions_phys[STI_REGION_MAX]; 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci struct sti_glob_cfg *glob_cfg; /* points into sti_all_data */ 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci int wordmode; 3618c2ecf20Sopenharmony_ci struct sti_cooked_font *font; /* ptr to selected font (cooked) */ 3628c2ecf20Sopenharmony_ci 3638c2ecf20Sopenharmony_ci struct pci_dev *pd; 3648c2ecf20Sopenharmony_ci 3658c2ecf20Sopenharmony_ci /* PCI data structures (pg. 17ff from sti.pdf) */ 3668c2ecf20Sopenharmony_ci u8 rm_entry[16]; /* pci region mapper array == pci config space offset */ 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_ci /* pointer to the fb_info where this STI device is used */ 3698c2ecf20Sopenharmony_ci struct fb_info *info; 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci /* pointer to all internal data */ 3728c2ecf20Sopenharmony_ci struct sti_all_data *sti_data; 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci /* pa_path of this device */ 3758c2ecf20Sopenharmony_ci char pa_path[24]; 3768c2ecf20Sopenharmony_ci}; 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci/* sticore interface functions */ 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_cistruct sti_struct *sti_get_rom(unsigned int index); /* 0: default sti */ 3828c2ecf20Sopenharmony_civoid sti_font_convert_bytemode(struct sti_struct *sti, struct sti_cooked_font *f); 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci 3858c2ecf20Sopenharmony_ci/* sticore main function to call STI firmware */ 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ciint sti_call(const struct sti_struct *sti, unsigned long func, 3888c2ecf20Sopenharmony_ci const void *flags, void *inptr, void *outptr, 3898c2ecf20Sopenharmony_ci struct sti_glob_cfg *glob_cfg); 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ci/* functions to call the STI ROM directly */ 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_civoid sti_putc(struct sti_struct *sti, int c, int y, int x, 3958c2ecf20Sopenharmony_ci struct sti_cooked_font *font); 3968c2ecf20Sopenharmony_civoid sti_set(struct sti_struct *sti, int src_y, int src_x, 3978c2ecf20Sopenharmony_ci int height, int width, u8 color); 3988c2ecf20Sopenharmony_civoid sti_clear(struct sti_struct *sti, int src_y, int src_x, 3998c2ecf20Sopenharmony_ci int height, int width, int c, struct sti_cooked_font *font); 4008c2ecf20Sopenharmony_civoid sti_bmove(struct sti_struct *sti, int src_y, int src_x, 4018c2ecf20Sopenharmony_ci int dst_y, int dst_x, int height, int width, 4028c2ecf20Sopenharmony_ci struct sti_cooked_font *font); 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_ci#endif /* STICORE_H */ 405