xref: /openbmc/qemu/hw/display/ati_int.h (revision 9f33cf2a89b5f8b437f3c62158c9ac2aa6ba9d48)
1862b4a29SBALATON Zoltan /*
2862b4a29SBALATON Zoltan  * QEMU ATI SVGA emulation
3862b4a29SBALATON Zoltan  *
4862b4a29SBALATON Zoltan  * Copyright (c) 2019 BALATON Zoltan
5862b4a29SBALATON Zoltan  *
6862b4a29SBALATON Zoltan  * This work is licensed under the GNU GPL license version 2 or later.
7862b4a29SBALATON Zoltan  */
8862b4a29SBALATON Zoltan 
9862b4a29SBALATON Zoltan #ifndef ATI_INT_H
10862b4a29SBALATON Zoltan #define ATI_INT_H
11862b4a29SBALATON Zoltan 
12b7105d28SBALATON Zoltan #include "qemu/timer.h"
13edf5ca5dSMarkus Armbruster #include "hw/pci/pci_device.h"
14c82c7336SBALATON Zoltan #include "hw/i2c/bitbang_i2c.h"
15862b4a29SBALATON Zoltan #include "vga_int.h"
16db1015e9SEduardo Habkost #include "qom/object.h"
17862b4a29SBALATON Zoltan 
18862b4a29SBALATON Zoltan /*#define DEBUG_ATI*/
19862b4a29SBALATON Zoltan 
20862b4a29SBALATON Zoltan #ifdef DEBUG_ATI
21862b4a29SBALATON Zoltan #define DPRINTF(fmt, ...) printf("%s: " fmt, __func__, ## __VA_ARGS__)
22862b4a29SBALATON Zoltan #else
23862b4a29SBALATON Zoltan #define DPRINTF(fmt, ...) do {} while (0)
24862b4a29SBALATON Zoltan #endif
25862b4a29SBALATON Zoltan 
26862b4a29SBALATON Zoltan #define PCI_VENDOR_ID_ATI 0x1002
27862b4a29SBALATON Zoltan /* Rage128 Pro GL */
28862b4a29SBALATON Zoltan #define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046
29862b4a29SBALATON Zoltan /* Radeon RV100 (VE) */
30862b4a29SBALATON Zoltan #define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159
31862b4a29SBALATON Zoltan 
32862b4a29SBALATON Zoltan #define TYPE_ATI_VGA "ati-vga"
338063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(ATIVGAState, ATI_VGA)
34862b4a29SBALATON Zoltan 
35862b4a29SBALATON Zoltan typedef struct ATIVGARegs {
36862b4a29SBALATON Zoltan     uint32_t mm_index;
37862b4a29SBALATON Zoltan     uint32_t bios_scratch[8];
38b7105d28SBALATON Zoltan     uint32_t gen_int_cntl;
39b7105d28SBALATON Zoltan     uint32_t gen_int_status;
40862b4a29SBALATON Zoltan     uint32_t crtc_gen_cntl;
41862b4a29SBALATON Zoltan     uint32_t crtc_ext_cntl;
42862b4a29SBALATON Zoltan     uint32_t dac_cntl;
43c82c7336SBALATON Zoltan     uint32_t gpio_vga_ddc;
44c82c7336SBALATON Zoltan     uint32_t gpio_dvi_ddc;
45c82c7336SBALATON Zoltan     uint32_t gpio_monid;
468bb9a2b2SBALATON Zoltan     uint32_t config_cntl;
47bf9ac62aSBALATON Zoltan     uint32_t palette[256];
48862b4a29SBALATON Zoltan     uint32_t crtc_h_total_disp;
49862b4a29SBALATON Zoltan     uint32_t crtc_h_sync_strt_wid;
50862b4a29SBALATON Zoltan     uint32_t crtc_v_total_disp;
51862b4a29SBALATON Zoltan     uint32_t crtc_v_sync_strt_wid;
52862b4a29SBALATON Zoltan     uint32_t crtc_offset;
53862b4a29SBALATON Zoltan     uint32_t crtc_offset_cntl;
54862b4a29SBALATON Zoltan     uint32_t crtc_pitch;
55862b4a29SBALATON Zoltan     uint32_t cur_offset;
56862b4a29SBALATON Zoltan     uint32_t cur_hv_pos;
57862b4a29SBALATON Zoltan     uint32_t cur_hv_offs;
58862b4a29SBALATON Zoltan     uint32_t cur_color0;
59862b4a29SBALATON Zoltan     uint32_t cur_color1;
60862b4a29SBALATON Zoltan     uint32_t dst_offset;
61862b4a29SBALATON Zoltan     uint32_t dst_pitch;
62862b4a29SBALATON Zoltan     uint32_t dst_tile;
63862b4a29SBALATON Zoltan     uint32_t dst_width;
64862b4a29SBALATON Zoltan     uint32_t dst_height;
65862b4a29SBALATON Zoltan     uint32_t src_offset;
66862b4a29SBALATON Zoltan     uint32_t src_pitch;
67862b4a29SBALATON Zoltan     uint32_t src_tile;
68862b4a29SBALATON Zoltan     uint32_t src_x;
69862b4a29SBALATON Zoltan     uint32_t src_y;
70862b4a29SBALATON Zoltan     uint32_t dst_x;
71862b4a29SBALATON Zoltan     uint32_t dst_y;
72862b4a29SBALATON Zoltan     uint32_t dp_gui_master_cntl;
73862b4a29SBALATON Zoltan     uint32_t dp_brush_bkgd_clr;
74862b4a29SBALATON Zoltan     uint32_t dp_brush_frgd_clr;
75862b4a29SBALATON Zoltan     uint32_t dp_src_frgd_clr;
76862b4a29SBALATON Zoltan     uint32_t dp_src_bkgd_clr;
77862b4a29SBALATON Zoltan     uint32_t dp_cntl;
78862b4a29SBALATON Zoltan     uint32_t dp_datatype;
79862b4a29SBALATON Zoltan     uint32_t dp_mix;
80862b4a29SBALATON Zoltan     uint32_t dp_write_mask;
81862b4a29SBALATON Zoltan     uint32_t default_offset;
82862b4a29SBALATON Zoltan     uint32_t default_pitch;
83866ad5f5SBALATON Zoltan     uint32_t default_tile;
84862b4a29SBALATON Zoltan     uint32_t default_sc_bottom_right;
85862b4a29SBALATON Zoltan } ATIVGARegs;
86862b4a29SBALATON Zoltan 
87db1015e9SEduardo Habkost struct ATIVGAState {
88862b4a29SBALATON Zoltan     PCIDevice dev;
89862b4a29SBALATON Zoltan     VGACommonState vga;
90862b4a29SBALATON Zoltan     char *model;
91862b4a29SBALATON Zoltan     uint16_t dev_id;
92862b4a29SBALATON Zoltan     uint8_t mode;
93*08730ee0SBALATON Zoltan     uint8_t use_pixman;
94862b4a29SBALATON Zoltan     bool cursor_guest_mode;
95862b4a29SBALATON Zoltan     uint16_t cursor_size;
96862b4a29SBALATON Zoltan     uint32_t cursor_offset;
97862b4a29SBALATON Zoltan     QEMUCursor *cursor;
98b7105d28SBALATON Zoltan     QEMUTimer vblank_timer;
9941742927SPeter Maydell     bitbang_i2c_interface bbi2c;
100862b4a29SBALATON Zoltan     MemoryRegion io;
101862b4a29SBALATON Zoltan     MemoryRegion mm;
102862b4a29SBALATON Zoltan     ATIVGARegs regs;
103db1015e9SEduardo Habkost };
104862b4a29SBALATON Zoltan 
105862b4a29SBALATON Zoltan const char *ati_reg_name(int num);
106862b4a29SBALATON Zoltan 
107862b4a29SBALATON Zoltan void ati_2d_blt(ATIVGAState *s);
108862b4a29SBALATON Zoltan 
109862b4a29SBALATON Zoltan #endif /* ATI_INT_H */
110