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 9 #ifndef ATI_INT_H 10 #define ATI_INT_H 11 12 #include "hw/pci/pci.h" 13 #include "vga_int.h" 14 15 /*#define DEBUG_ATI*/ 16 17 #ifdef DEBUG_ATI 18 #define DPRINTF(fmt, ...) printf("%s: " fmt, __func__, ## __VA_ARGS__) 19 #else 20 #define DPRINTF(fmt, ...) do {} while (0) 21 #endif 22 23 #define PCI_VENDOR_ID_ATI 0x1002 24 /* Rage128 Pro GL */ 25 #define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046 26 /* Radeon RV100 (VE) */ 27 #define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159 28 29 #define TYPE_ATI_VGA "ati-vga" 30 #define ATI_VGA(obj) OBJECT_CHECK(ATIVGAState, (obj), TYPE_ATI_VGA) 31 32 typedef struct ATIVGARegs { 33 uint32_t mm_index; 34 uint32_t bios_scratch[8]; 35 uint32_t crtc_gen_cntl; 36 uint32_t crtc_ext_cntl; 37 uint32_t dac_cntl; 38 uint32_t crtc_h_total_disp; 39 uint32_t crtc_h_sync_strt_wid; 40 uint32_t crtc_v_total_disp; 41 uint32_t crtc_v_sync_strt_wid; 42 uint32_t crtc_offset; 43 uint32_t crtc_offset_cntl; 44 uint32_t crtc_pitch; 45 uint32_t cur_offset; 46 uint32_t cur_hv_pos; 47 uint32_t cur_hv_offs; 48 uint32_t cur_color0; 49 uint32_t cur_color1; 50 uint32_t dst_offset; 51 uint32_t dst_pitch; 52 uint32_t dst_tile; 53 uint32_t dst_width; 54 uint32_t dst_height; 55 uint32_t src_offset; 56 uint32_t src_pitch; 57 uint32_t src_tile; 58 uint32_t src_x; 59 uint32_t src_y; 60 uint32_t dst_x; 61 uint32_t dst_y; 62 uint32_t dp_gui_master_cntl; 63 uint32_t dp_brush_bkgd_clr; 64 uint32_t dp_brush_frgd_clr; 65 uint32_t dp_src_frgd_clr; 66 uint32_t dp_src_bkgd_clr; 67 uint32_t dp_cntl; 68 uint32_t dp_datatype; 69 uint32_t dp_mix; 70 uint32_t dp_write_mask; 71 uint32_t default_offset; 72 uint32_t default_pitch; 73 uint32_t default_sc_bottom_right; 74 } ATIVGARegs; 75 76 typedef struct ATIVGAState { 77 PCIDevice dev; 78 VGACommonState vga; 79 char *model; 80 uint16_t dev_id; 81 uint8_t mode; 82 bool cursor_guest_mode; 83 uint16_t cursor_size; 84 uint32_t cursor_offset; 85 QEMUCursor *cursor; 86 MemoryRegion io; 87 MemoryRegion mm; 88 ATIVGARegs regs; 89 } ATIVGAState; 90 91 const char *ati_reg_name(int num); 92 93 void ati_2d_blt(ATIVGAState *s); 94 95 #endif /* ATI_INT_H */ 96