cirrus_vga_internal.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * QEMU Cirrus CLGD 54xx VGA Emulator, ISA bus support
  3. *
  4. * Copyright (c) 2004 Fabrice Bellard
  5. * Copyright (c) 2004 Makoto Suzuki (suzu)
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8. * of this software and associated documentation files (the "Software"), to deal
  9. * in the Software without restriction, including without limitation the rights
  10. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the Software is
  12. * furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  20. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  23. * THE SOFTWARE.
  24. */
  25. #ifndef CIRRUS_VGA_INTERNAL_H
  26. #define CIRRUS_VGA_INTERNAL_H
  27. #include "vga_int.h"
  28. /* IDs */
  29. #define CIRRUS_ID_CLGD5422 (0x23 << 2)
  30. #define CIRRUS_ID_CLGD5426 (0x24 << 2)
  31. #define CIRRUS_ID_CLGD5424 (0x25 << 2)
  32. #define CIRRUS_ID_CLGD5428 (0x26 << 2)
  33. #define CIRRUS_ID_CLGD5430 (0x28 << 2)
  34. #define CIRRUS_ID_CLGD5434 (0x2A << 2)
  35. #define CIRRUS_ID_CLGD5436 (0x2B << 2)
  36. #define CIRRUS_ID_CLGD5446 (0x2E << 2)
  37. extern const VMStateDescription vmstate_cirrus_vga;
  38. struct CirrusVGAState;
  39. typedef void (*cirrus_bitblt_rop_t)(struct CirrusVGAState *s,
  40. uint32_t dstaddr, uint32_t srcaddr,
  41. int dstpitch, int srcpitch,
  42. int bltwidth, int bltheight);
  43. typedef struct CirrusVGAState {
  44. VGACommonState vga;
  45. MemoryRegion cirrus_vga_io;
  46. MemoryRegion cirrus_linear_io;
  47. MemoryRegion cirrus_linear_bitblt_io;
  48. MemoryRegion cirrus_mmio_io;
  49. MemoryRegion pci_bar;
  50. bool linear_vram; /* vga.vram mapped over cirrus_linear_io */
  51. MemoryRegion low_mem_container; /* container for 0xa0000-0xc0000 */
  52. MemoryRegion low_mem; /* always mapped, overridden by: */
  53. MemoryRegion cirrus_bank[2]; /* aliases at 0xa0000-0xb0000 */
  54. uint32_t cirrus_addr_mask;
  55. uint32_t linear_mmio_mask;
  56. uint8_t cirrus_shadow_gr0;
  57. uint8_t cirrus_shadow_gr1;
  58. uint8_t cirrus_hidden_dac_lockindex;
  59. uint8_t cirrus_hidden_dac_data;
  60. uint32_t cirrus_bank_base[2];
  61. uint32_t cirrus_bank_limit[2];
  62. uint8_t cirrus_hidden_palette[48];
  63. bool enable_blitter;
  64. int cirrus_blt_pixelwidth;
  65. int cirrus_blt_width;
  66. int cirrus_blt_height;
  67. int cirrus_blt_dstpitch;
  68. int cirrus_blt_srcpitch;
  69. uint32_t cirrus_blt_fgcol;
  70. uint32_t cirrus_blt_bgcol;
  71. uint32_t cirrus_blt_dstaddr;
  72. uint32_t cirrus_blt_srcaddr;
  73. uint8_t cirrus_blt_mode;
  74. uint8_t cirrus_blt_modeext;
  75. cirrus_bitblt_rop_t cirrus_rop;
  76. #define CIRRUS_BLTBUFSIZE (2048 * 4) /* one line width */
  77. uint8_t cirrus_bltbuf[CIRRUS_BLTBUFSIZE];
  78. uint8_t *cirrus_srcptr;
  79. uint8_t *cirrus_srcptr_end;
  80. uint32_t cirrus_srccounter;
  81. /* hwcursor display state */
  82. int last_hw_cursor_size;
  83. int last_hw_cursor_x;
  84. int last_hw_cursor_y;
  85. int last_hw_cursor_y_start;
  86. int last_hw_cursor_y_end;
  87. int real_vram_size; /* XXX: suppress that */
  88. int device_id;
  89. int bustype;
  90. } CirrusVGAState;
  91. void cirrus_init_common(CirrusVGAState *s, Object *owner,
  92. int device_id, int is_pci,
  93. MemoryRegion *system_memory, MemoryRegion *system_io);
  94. #endif