2
0

ati_int.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * QEMU ATI SVGA emulation
  3. *
  4. * Copyright (c) 2019 BALATON Zoltan
  5. *
  6. * This work is licensed under the GNU GPL license version 2 or later.
  7. */
  8. #ifndef ATI_INT_H
  9. #define ATI_INT_H
  10. #include "qemu/timer.h"
  11. #include "hw/pci/pci_device.h"
  12. #include "hw/i2c/bitbang_i2c.h"
  13. #include "vga_int.h"
  14. #include "qom/object.h"
  15. /*#define DEBUG_ATI*/
  16. #ifdef DEBUG_ATI
  17. #define DPRINTF(fmt, ...) printf("%s: " fmt, __func__, ## __VA_ARGS__)
  18. #else
  19. #define DPRINTF(fmt, ...) do {} while (0)
  20. #endif
  21. #define PCI_VENDOR_ID_ATI 0x1002
  22. /* Rage128 Pro GL */
  23. #define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046
  24. /* Radeon RV100 (VE) */
  25. #define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159
  26. #define TYPE_ATI_VGA "ati-vga"
  27. OBJECT_DECLARE_SIMPLE_TYPE(ATIVGAState, ATI_VGA)
  28. typedef struct ATIVGARegs {
  29. uint32_t mm_index;
  30. uint32_t bios_scratch[8];
  31. uint32_t gen_int_cntl;
  32. uint32_t gen_int_status;
  33. uint32_t crtc_gen_cntl;
  34. uint32_t crtc_ext_cntl;
  35. uint32_t dac_cntl;
  36. uint32_t gpio_vga_ddc;
  37. uint32_t gpio_dvi_ddc;
  38. uint32_t gpio_monid;
  39. uint32_t config_cntl;
  40. uint32_t crtc_h_total_disp;
  41. uint32_t crtc_h_sync_strt_wid;
  42. uint32_t crtc_v_total_disp;
  43. uint32_t crtc_v_sync_strt_wid;
  44. uint32_t crtc_offset;
  45. uint32_t crtc_offset_cntl;
  46. uint32_t crtc_pitch;
  47. uint32_t cur_offset;
  48. uint32_t cur_hv_pos;
  49. uint32_t cur_hv_offs;
  50. uint32_t cur_color0;
  51. uint32_t cur_color1;
  52. uint32_t dst_offset;
  53. uint32_t dst_pitch;
  54. uint32_t dst_tile;
  55. uint32_t dst_width;
  56. uint32_t dst_height;
  57. uint32_t src_offset;
  58. uint32_t src_pitch;
  59. uint32_t src_tile;
  60. uint32_t src_x;
  61. uint32_t src_y;
  62. uint32_t dst_x;
  63. uint32_t dst_y;
  64. uint32_t dp_gui_master_cntl;
  65. uint32_t dp_brush_bkgd_clr;
  66. uint32_t dp_brush_frgd_clr;
  67. uint32_t dp_src_frgd_clr;
  68. uint32_t dp_src_bkgd_clr;
  69. uint32_t dp_cntl;
  70. uint32_t dp_datatype;
  71. uint32_t dp_mix;
  72. uint32_t dp_write_mask;
  73. uint32_t default_offset;
  74. uint32_t default_pitch;
  75. uint32_t default_tile;
  76. uint32_t default_sc_bottom_right;
  77. } ATIVGARegs;
  78. struct ATIVGAState {
  79. PCIDevice dev;
  80. VGACommonState vga;
  81. char *model;
  82. uint16_t dev_id;
  83. uint8_t mode;
  84. bool cursor_guest_mode;
  85. uint16_t cursor_size;
  86. uint32_t cursor_offset;
  87. QEMUCursor *cursor;
  88. QEMUTimer vblank_timer;
  89. bitbang_i2c_interface bbi2c;
  90. MemoryRegion io;
  91. MemoryRegion mm;
  92. ATIVGARegs regs;
  93. };
  94. const char *ati_reg_name(int num);
  95. void ati_2d_blt(ATIVGAState *s);
  96. #endif /* ATI_INT_H */