2 Copyright (c) 2000 by Juliusz Chroboczek
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 #define VBE_WINDOW_RELOCATE 1
27 #define VBE_WINDOW_READ 2
28 #define VBE_WINDOW_WRITE 4
30 typedef struct _VbeInfoBlock
{
31 U8 VbeSignature
[4]; /* VBE Signature */
32 U16 VbeVersion
; /* VBE Version */
33 U32 OemStringPtr
; /* Pointer to OEM String */
34 U8 Capabilities
[4]; /* Capabilities of graphics controller */
35 U32 VideoModePtr
; /* Pointer to VideoModeList */
36 U16 TotalMemory
; /* Number of 64kb memory blocks */
37 /* Added for VBE 2.0 */
38 U16 OemSoftwareRev
; /* VBE implementation Software revision */
39 U32 OemVendorNamePtr
; /* Pointer to Vendor Name String */
40 U32 OemProductNamePtr
; /* Pointer to Product Name String */
41 U32 OemProductRevPtr
; /* Pointer to Product Revision String */
42 U8 Reserved
[222]; /* Reserved for VBE implementation */
43 U8 OemData
[256]; /* Data Area for OEM Strings*/
44 } __attribute__((packed
)) VbeInfoBlock
;
46 typedef struct _VbeModeInfoBlock
{
47 /* Mandatory information for all VBE revisions */
48 U16 ModeAttributes
; /* mode attributes */
49 U8 WinAAttributes
; /* window A attributes */
50 U8 WinBAttributes
; /* window B attributes */
51 U16 WinGranularity
; /* window granularity */
52 U16 WinSize
; /* window size */
53 U16 WinASegment
; /* window A start segment */
54 U16 WinBSegment
; /* window B start segment */
55 U32 WinFuncPtr
; /* pointer to window function */
56 U16 BytesPerScanLine
; /* bytes per scan line */
57 /* Mandatory information for VBE 1.2 and above */
58 U16 XResolution
; /* horizontal resolution */
59 U16 YResolution
; /* vertical resolution */
60 U8 XCharSize
; /* character cell width in pixels */
61 U8 YCharSize
; /* character cell height in pixels */
62 U8 NumberOfPlanes
; /* number of memory planes */
63 U8 BitsPerPixel
; /* bits per pixel */
64 U8 NumberOfBanks
; /* number of banks */
65 U8 MemoryModel
; /* memory model type */
66 U8 BankSize
; /* bank size in KB */
67 U8 NumberOfImagePages
; /* number of images */
68 U8 Reserved
; /* reserved for page function */
69 /* Direct Color fields (required for direct/6 and YUV/7 memory models) */
70 U8 RedMaskSize
; /* size of direct color red mask in bits */
71 U8 RedFieldPosition
; /* bit position of lsb of red mask */
72 U8 GreenMaskSize
; /* size of direct color green mask in bits */
73 U8 GreenFieldPosition
; /* bit position of lsb of green mask */
74 U8 BlueMaskSize
; /* size of direct color blue mask in bits */
75 U8 BlueFieldPosition
; /* bit position of lsb of blue mask */
76 U8 RsvdMaskSize
; /* size of direct color reserved mask bits*/
77 U8 RsvdFieldPosition
; /* bit position of lsb of reserved mask */
78 U8 DirectColorModeInfo
; /* direct color mode attributes */
79 /* Mandatory information for VBE 2.0 and above */
80 U32 PhysBasePtr
; /* physical address for flat memory fb */
81 U32 OffScreenMemOffset
; /* pointer to start of off screen memory */
82 U16 OffScreenMemSize
; /* amount of off screen memory in 1k units */
83 U8 Reserved2
[206]; /* remainder of ModeInfoBlock */
84 } __attribute__((packed
)) VbeModeInfoBlock
;
86 typedef struct _VbeInfoRec
{
93 VbeModeInfoBlock vmib
;
94 } VbeInfoRec
, *VbeInfoPtr
;
96 typedef struct _SupVbeInfoBlock
{
97 U8 SupVbeSignature
[7]; /* Supplemental VBE Signature */
98 U16 SupVbeVersion
; /* Supplemental VBE Version*/
99 U8 SupVbeSubFunc
[8]; /* Bitfield of supported subfunctions */
100 U16 OemSoftwareRev
; /* OEM Software revision */
101 U32 OemVendorNamePtr
; /* Pointer to Vendor Name String */
102 U32 OemProductNamePtr
; /* Pointer to Product Name String */
103 U32 OemProductRevPtr
; /* Pointer to Product Revision String */
104 U32 OemStringPtr
; /* Pointer to OEM String */
105 U8 Reserved
[221]; /* Reserved */
106 } __attribute__((packed
)) SupVbeInfoBlock
;
109 VbeGetVib (Vm86InfoPtr vi
, VbeInfoBlock
*vib
);
112 VbeGetVmib (Vm86InfoPtr vi
, int mode
, VbeModeInfoBlock
*vmib
);
115 VbeReportInfo (Vm86InfoPtr vi
);
118 VbeGetNmode (Vm86InfoPtr vi
);
121 VbeGetModes (Vm86InfoPtr vi
, VesaModePtr modes
, int nmode
);
124 VbeInit (Vm86InfoPtr vi
);
127 VbeCleanup (Vm86InfoPtr vi
, VbeInfoPtr vbe
);
130 VbeSetMode (Vm86InfoPtr vi
, VbeInfoPtr vbe
, int mode
, int linear
, int direct
);
133 VbeGetMode(Vm86InfoPtr vi
, int *mode
);
136 VbeMapFramebuffer(Vm86InfoPtr vi
, VbeInfoPtr vbe
, int mode
, int *ret_size
, CARD32
*ret_phys
);
139 VbeUnmapFramebuffer(Vm86InfoPtr vi
, VbeInfoPtr vbe
, int mode
, void *fb
);
142 VbeSetPalette(Vm86InfoPtr vi
, VbeInfoPtr vbe
, int first
, int number
, U8
*entries
);
145 VbeGetPalette(Vm86InfoPtr vi
, VbeInfoPtr vbe
, int first
, int number
, U8
*entries
);
148 VbeSetPaletteOptions(Vm86InfoPtr vi
, VbeInfoPtr vbe
, U8 bits
, int wait
);
151 VbeSetWindow(Vm86InfoPtr vi
, VbeInfoPtr vbe
, int offset
, int purpose
, int *size_return
);
154 VbeDPMS(Vm86InfoPtr vi
, int mode
);
157 VbeDoInterrupt10(Vm86InfoPtr vi
);
160 VbeBoot(Vm86InfoPtr vi
);
163 VbeDoInterruptE6(Vm86InfoPtr vi
);