Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _UVESAFB_H
0003 #define _UVESAFB_H
0004 
0005 #include <uapi/video/uvesafb.h>
0006 
0007 
0008 /* VBE CRTC Info Block */
0009 struct vbe_crtc_ib {
0010     u16 horiz_total;
0011     u16 horiz_start;
0012     u16 horiz_end;
0013     u16 vert_total;
0014     u16 vert_start;
0015     u16 vert_end;
0016     u8  flags;
0017     u32 pixel_clock;
0018     u16 refresh_rate;
0019     u8  reserved[40];
0020 } __attribute__ ((packed));
0021 
0022 #define VBE_MODE_VGACOMPAT  0x20
0023 #define VBE_MODE_COLOR      0x08
0024 #define VBE_MODE_SUPPORTEDHW    0x01
0025 #define VBE_MODE_GRAPHICS   0x10
0026 #define VBE_MODE_LFB        0x80
0027 
0028 #define VBE_MODE_MASK       (VBE_MODE_COLOR | VBE_MODE_SUPPORTEDHW | \
0029                 VBE_MODE_GRAPHICS | VBE_MODE_LFB)
0030 
0031 /* VBE Mode Info Block */
0032 struct vbe_mode_ib {
0033     /* for all VBE revisions */
0034     u16 mode_attr;
0035     u8  winA_attr;
0036     u8  winB_attr;
0037     u16 win_granularity;
0038     u16 win_size;
0039     u16 winA_seg;
0040     u16 winB_seg;
0041     u32 win_func_ptr;
0042     u16 bytes_per_scan_line;
0043 
0044     /* for VBE 1.2+ */
0045     u16 x_res;
0046     u16 y_res;
0047     u8  x_char_size;
0048     u8  y_char_size;
0049     u8  planes;
0050     u8  bits_per_pixel;
0051     u8  banks;
0052     u8  memory_model;
0053     u8  bank_size;
0054     u8  image_pages;
0055     u8  reserved1;
0056 
0057     /* Direct color fields for direct/6 and YUV/7 memory models. */
0058     /* Offsets are bit positions of lsb in the mask. */
0059     u8  red_len;
0060     u8  red_off;
0061     u8  green_len;
0062     u8  green_off;
0063     u8  blue_len;
0064     u8  blue_off;
0065     u8  rsvd_len;
0066     u8  rsvd_off;
0067     u8  direct_color_info;  /* direct color mode attributes */
0068 
0069     /* for VBE 2.0+ */
0070     u32 phys_base_ptr;
0071     u8  reserved2[6];
0072 
0073     /* for VBE 3.0+ */
0074     u16 lin_bytes_per_scan_line;
0075     u8  bnk_image_pages;
0076     u8  lin_image_pages;
0077     u8  lin_red_len;
0078     u8  lin_red_off;
0079     u8  lin_green_len;
0080     u8  lin_green_off;
0081     u8  lin_blue_len;
0082     u8  lin_blue_off;
0083     u8  lin_rsvd_len;
0084     u8  lin_rsvd_off;
0085     u32 max_pixel_clock;
0086     u16 mode_id;
0087     u8  depth;
0088 } __attribute__ ((packed));
0089 
0090 #define UVESAFB_DEFAULT_MODE "640x480-16"
0091 
0092 /* How long to wait for a reply from userspace [ms] */
0093 #define UVESAFB_TIMEOUT 5000
0094 
0095 /* Max number of concurrent tasks */
0096 #define UVESAFB_TASKS_MAX 16
0097 
0098 #define dac_reg (0x3c8)
0099 #define dac_val (0x3c9)
0100 
0101 struct uvesafb_pal_entry {
0102     u_char blue, green, red, pad;
0103 } __attribute__ ((packed));
0104 
0105 struct uvesafb_ktask {
0106     struct uvesafb_task t;
0107     void *buf;
0108     struct completion *done;
0109     u32 ack;
0110 };
0111 
0112 static int uvesafb_exec(struct uvesafb_ktask *tsk);
0113 
0114 #define UVESAFB_EXACT_RES   1
0115 #define UVESAFB_EXACT_DEPTH 2
0116 
0117 struct uvesafb_par {
0118     struct vbe_ib vbe_ib;       /* VBE Info Block */
0119     struct vbe_mode_ib *vbe_modes;  /* list of supported VBE modes */
0120     int vbe_modes_cnt;
0121 
0122     u8 nocrtc;
0123     u8 ypan;            /* 0 - nothing, 1 - ypan, 2 - ywrap */
0124     u8 pmi_setpal;          /* PMI for palette changes */
0125     u16 *pmi_base;          /* protected mode interface location */
0126     void *pmi_start;
0127     void *pmi_pal;
0128     u8 *vbe_state_orig;     /*
0129                      * original hardware state, before the
0130                      * driver was loaded
0131                      */
0132     u8 *vbe_state_saved;        /* state saved by fb_save_state */
0133     int vbe_state_size;
0134     atomic_t ref_count;
0135 
0136     int mode_idx;
0137     struct vbe_crtc_ib crtc;
0138     int mtrr_handle;
0139 };
0140 
0141 #endif /* _UVESAFB_H */