Reduce loglevel for mode line removals from 1 to 3.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- vgasrc/atiext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vgasrc/atiext.c b/vgasrc/atiext.c index 8c9e6966db47..b3975226c478 100644 --- a/vgasrc/atiext.c +++ b/vgasrc/atiext.c @@ -343,7 +343,7 @@ ati_setup(void) height > 0xfff || mem > totalmem || memmodel != MM_DIRECT) { - dprintf(1, "ati: removing mode 0x%x\n", GET_GLOBAL(m->mode)); + dprintf(3, "ati: removing mode 0x%x\n", GET_GLOBAL(m->mode)); SET_VGA(m->mode, 0xffff); } }
Cut & paste bug probably. Had no bad effect so far because the code doesn't read registers larger than 0x100.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- vgasrc/atiext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vgasrc/atiext.c b/vgasrc/atiext.c index b3975226c478..a24b980638a9 100644 --- a/vgasrc/atiext.c +++ b/vgasrc/atiext.c @@ -117,7 +117,7 @@ static inline u32 ati_read(u32 reg) val = inl(io_addr + reg); } else { outl(reg, io_addr + MM_INDEX); - reg = inl(io_addr + MM_DATA); + val = inl(io_addr + MM_DATA); } return val; }
Prepare to support other ati cards. Also log access mode and whenever we got a valid edid block.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- vgasrc/atiext.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/vgasrc/atiext.c b/vgasrc/atiext.c index a24b980638a9..901e82d01383 100644 --- a/vgasrc/atiext.c +++ b/vgasrc/atiext.c @@ -43,6 +43,11 @@ #define CRT_CRTC_ON 0x00008000
static u32 ati_io_addr VAR16 = 0; +static u32 ati_i2c_reg VAR16; +static u32 ati_i2c_bit_scl_out VAR16; +static u32 ati_i2c_bit_sda_out VAR16; +static u32 ati_i2c_bit_sda_in VAR16; +
int is_ati_mode(struct vgamode_s *vmode_g) @@ -206,18 +211,18 @@ ati_i2c_set_scl_sda(int scl, int sda) u32 data = 0;
if (!scl) - data |= (1 << 17); + data |= (1 << GET_GLOBAL(ati_i2c_bit_scl_out)); if (!sda) - data |= (1 << 16); - ati_write(GPIO_DVI_DDC, data); + data |= (1 << GET_GLOBAL(ati_i2c_bit_sda_out)); + ati_write(GET_GLOBAL(ati_i2c_reg), data); }
static int ati_i2c_get_sda(void) { - u32 data = ati_read(GPIO_DVI_DDC); + u32 data = ati_read(GET_GLOBAL(ati_i2c_reg));
- return data & (1 << 8) ? 1 : 0; + return data & (1 << GET_GLOBAL(ati_i2c_bit_sda_in)) ? 1 : 0; }
static void ati_i2c_start(void) @@ -275,7 +280,6 @@ static void ati_i2c_edid(void) u8 byte; int i;
- dprintf(1, "ati: reading edid blob\n"); ati_i2c_start(); ati_i2c_send_byte(0x50 << 1 | 1); ati_i2c_ack(); @@ -287,6 +291,22 @@ static void ati_i2c_edid(void) ati_i2c_stop(); }
+static void ati_i2c_edid_radeon(void) +{ + int valid; + + SET_VGA(ati_i2c_bit_scl_out, 17); + SET_VGA(ati_i2c_bit_sda_out, 16); + SET_VGA(ati_i2c_bit_sda_in, 8); + + dprintf(1, "ati: reading edid blob (radeon dvi) ... \n"); + SET_VGA(ati_i2c_reg, GPIO_DVI_DDC); + ati_i2c_edid(); + valid = (GET_GLOBAL(VBE_edid[0]) == 0x00 && + GET_GLOBAL(VBE_edid[1]) == 0xff); + dprintf(1, "ati: ... %s\n", valid ? "good" : "invalid"); +} + /**************************************************************** * init ****************************************************************/ @@ -351,7 +371,7 @@ ati_setup(void) u16 device = pci_config_readw(bdf, PCI_DEVICE_ID); switch (device) { case 0x5159: - ati_i2c_edid(); + ati_i2c_edid_radeon(); break; }
Try vga ddc bus before dvi ddc bus. Return early in case we got valid data.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- vgasrc/atiext.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/vgasrc/atiext.c b/vgasrc/atiext.c index 901e82d01383..71dfa859a22d 100644 --- a/vgasrc/atiext.c +++ b/vgasrc/atiext.c @@ -299,6 +299,15 @@ static void ati_i2c_edid_radeon(void) SET_VGA(ati_i2c_bit_sda_out, 16); SET_VGA(ati_i2c_bit_sda_in, 8);
+ dprintf(1, "ati: reading edid blob (radeon vga) ... \n"); + SET_VGA(ati_i2c_reg, GPIO_VGA_DDC); + ati_i2c_edid(); + valid = (GET_GLOBAL(VBE_edid[0]) == 0x00 && + GET_GLOBAL(VBE_edid[1]) == 0xff); + dprintf(1, "ati: ... %s\n", valid ? "good" : "invalid"); + if (valid) + return; + dprintf(1, "ati: reading edid blob (radeon dvi) ... \n"); SET_VGA(ati_i2c_reg, GPIO_DVI_DDC); ati_i2c_edid();
Signed-off-by: Gerd Hoffmann kraxel@redhat.com --- vgasrc/atiext.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/vgasrc/atiext.c b/vgasrc/atiext.c index 71dfa859a22d..69dfd46e550a 100644 --- a/vgasrc/atiext.c +++ b/vgasrc/atiext.c @@ -21,6 +21,7 @@ #define CRTC_EXT_CNTL 0x0054 #define GPIO_VGA_DDC 0x0060 #define GPIO_DVI_DDC 0x0064 +#define GPIO_MONID 0x0068 #define CRTC_H_TOTAL_DISP 0x0200 #define CRTC_V_TOTAL_DISP 0x0208 #define CRTC_OFFSET 0x0224 @@ -47,6 +48,7 @@ static u32 ati_i2c_reg VAR16; static u32 ati_i2c_bit_scl_out VAR16; static u32 ati_i2c_bit_sda_out VAR16; static u32 ati_i2c_bit_sda_in VAR16; +static u32 ati_i2c_bit_enable VAR16 = -1;
int @@ -208,8 +210,11 @@ ati_set_mode(struct vgamode_s *vmode_g, int flags) static void ati_i2c_set_scl_sda(int scl, int sda) { + u32 enable = GET_GLOBAL(ati_i2c_bit_enable); u32 data = 0;
+ if (enable != -1) + data |= (1 << enable); if (!scl) data |= (1 << GET_GLOBAL(ati_i2c_bit_scl_out)); if (!sda) @@ -316,6 +321,23 @@ static void ati_i2c_edid_radeon(void) dprintf(1, "ati: ... %s\n", valid ? "good" : "invalid"); }
+static void ati_i2c_edid_rage128(void) +{ + int valid; + + SET_VGA(ati_i2c_bit_enable, 25); + SET_VGA(ati_i2c_bit_scl_out, 18); + SET_VGA(ati_i2c_bit_sda_out, 17); + SET_VGA(ati_i2c_bit_sda_in, 9); + SET_VGA(ati_i2c_reg, GPIO_MONID); + + dprintf(1, "ati: reading edid blob (rage128) ... \n"); + ati_i2c_edid(); + valid = (GET_GLOBAL(VBE_edid[0]) == 0x00 && + GET_GLOBAL(VBE_edid[1]) == 0xff); + dprintf(1, "ati: ... %s\n", valid ? "good" : "invalid"); +} + /**************************************************************** * init ****************************************************************/ @@ -379,6 +401,9 @@ ati_setup(void)
u16 device = pci_config_readw(bdf, PCI_DEVICE_ID); switch (device) { + case 0x5046: + ati_i2c_edid_rage128(); + break; case 0x5159: ati_i2c_edid_radeon(); break;
On Mon, Jun 24, 2019 at 02:44:00PM +0200, Gerd Hoffmann wrote:
Reduce loglevel for mode line removals from 1 to 3.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com
Thanks. I don't know enough about the ati code to provide much feedback, but for what it's worth, the series looks fine to me.
-Kevin
On Mon, Jun 24, 2019 at 08:52:27AM -0400, Kevin O'Connor wrote:
On Mon, Jun 24, 2019 at 02:44:00PM +0200, Gerd Hoffmann wrote:
Reduce loglevel for mode line removals from 1 to 3.
Signed-off-by: Gerd Hoffmann kraxel@redhat.com
Thanks. I don't know enough about the ati code to provide much feedback, but for what it's worth, the series looks fine to me.
Pushed to master.
cheers, Gerd