diff options
author | Dave Airlie <airlied@linux.ie> | 2006-10-10 06:38:24 +1000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-10-10 06:38:24 +1000 |
commit | a22248f04fe6003306255fecaf590b5796cd5c53 (patch) | |
tree | 3ea113fa5da70ece71b846d12aceaabd30379596 | |
parent | e745b910de5577fa25b4880d2af5db348df97dd6 (diff) |
add support for ATOM connectors
-rw-r--r-- | radeontool.c | 106 |
1 files changed, 86 insertions, 20 deletions
diff --git a/radeontool.c b/radeontool.c index ea72f45..3c81b43 100644 --- a/radeontool.c +++ b/radeontool.c @@ -827,20 +827,24 @@ struct nametable_entry const char *radeon_valname(const struct nametable_entry *table, unsigned int value) { + static char ret_buf[256]; while(table->name) { if (table->value == value) return table->name; table++; } - return "<unknown>"; + sprintf(ret_buf, "<unknown val %d>", value); + return ret_buf; } static struct nametable_entry hdr_type_name[] = { { 2, "Rage128 & Pro"}, { 3, "Rage M3"}, { 4, "Radeon"}, + { 36, "ATOM" }, { 0, NULL} }; + static void radeon_rom_legacy_clocks(unsigned char *bios, int hdr) { int pll_info_block = BIOS16(hdr + 0x30); @@ -861,25 +865,19 @@ static void radeon_rom_legacy_clocks(unsigned char *bios, int hdr) static void radeon_rom_atom_clocks(unsigned char *bios, int master) { -#if 0 -+ int pll_info_block = BIOS_IN16(info->bios_master_data_start + 12); -+ -+ if (pll_info_block == 0) { -+ radeon_warn("No clock info block in BIOS\n"); -+ return -ENODEV; -+ } -+ -+ rinfo->pll.ref_clk = BIOS_IN16(pll_info_block + 82); -+ /* ref div isn't provided, we keep the default read from existing -+ * settings for now. -+ */ -+ rinfo->pll.ppll_min = BIOS_IN16(pll_info_block + 78); -+ rinfo->pll.ppll_max = BIOS_IN32(pll_info_block + 32); -+ rinfo->pll.sclk = BIOS_IN32(pll_info_block + 8); -+ rinfo->pll.mclk = BIOS_IN32(pll_info_block + 12); -+ -+ radeon_info("Retreived clock infos from BIOS\n"); -#endif + + int pll_info_block = BIOS16(master + 12); + + if (pll_info_block == 0) { + printf("No clock info block in BIOS\n"); + } + + printf("Clock info block:\n"); + printf(" SCLK : %f\n", BIOS32(pll_info_block + 8) / 100.0); + printf(" MCLK : %f\n", BIOS32(pll_info_block + 12) / 100.0); + printf(" RefClk : %f\n", BIOS16(pll_info_block + 82) / 100.0); + printf(" PPLL Min: %f\n", BIOS16(pll_info_block + 78) / 100.0); + printf(" PPLL Max: %f\n", BIOS32(pll_info_block + 32) / 100.0); } @@ -964,6 +962,73 @@ static void radeon_rom_legacy_connectors(unsigned char *bios, int hdr) printf("\n"); } +static struct nametable_entry atomconn_type_name[] = { + { 0, "None"}, + { 1, "VGA"}, + { 2, "DVI-I"}, + { 3, "DVI-D"}, + { 4, "DVI-A"}, + { 5, "STV"}, + { 6, "CTV"}, + { 7, "LVDS"}, + { 8, "Digital"}, + { 9, "Unsupported"}, + { 0, NULL} +}; + +static void radeon_rom_atom_connectors(unsigned char *bios, int master) +{ + int offset = BIOS16(master + 22); + int tmp, i, tmp0; + int crtc, dac, connector, ddc=0; + + if (offset == 0) { + printf("No connector table in BIOS\n"); + return; + } + + tmp = BIOS16(offset + 4); + printf("Connector table:\n"); + for (i=0; i<8; i++) { + if (tmp & (1<<i)) { + int portinfo = BIOS16(offset+6+i*2); + + crtc = (portinfo >> 8) & 0xf; + dac = (portinfo & 0xf) - 1; + connector = (portinfo >> 4) & 0xf; + + tmp0 = BIOS16(master + 24); + if (1/*crtc*/) { + int gpio = BIOS16(tmp0 + 4 + 27 * crtc) * 4; + printf("gpio is %02X\n", gpio); + switch(gpio) + { + case RADEON_GPIO_MONID: ddc = 1; break; + case RADEON_GPIO_DVI_DDC: ddc = 2; break; + case RADEON_GPIO_VGA_DDC: ddc = 3; break; + case RADEON_GPIO_CRT2_DDC: ddc = 4; break; + default: ddc=0; break; + } + } + + printf("%d: %08x ", i, portinfo); + printf(", Id:%d", crtc); + printf(", Type:%s", radeon_valname(atomconn_type_name, connector)); + if (1/*crtc*/) + printf(", DDC:%s", radeon_valname(lddc_type_name, + ddc)); + printf(", DAC:%s", radeon_valname(ldac_type_name, dac)); + if (i==3) + printf(" TMDS: Internal\n"); + else if (i==7) + printf(" TMDS: External\n"); + else + printf("\n"); + + } + } +} + static void radeon_rom_legacy_dfptable(unsigned char *bios, int hdr) { int offset, i, n, rev, stride; @@ -1044,6 +1109,7 @@ void radeon_rom_tables(const char * file) int master = BIOS16(hdr+32); printf("ATOM BIOS detected !\n\n"); radeon_rom_atom_clocks(bios, master); + radeon_rom_atom_connectors(bios, master); // add more ... } else { printf("Legacy BIOS detected !\n"); |