vbe.h 5.5 KB

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