32 #ifdef CONFIG_PPC_PMAC
34 #include <asm/machdep.h>
37 #include <asm/pci-bridge.h>
333 rev =
RBIOS8(check_offset);
345 rev =
RBIOS8(check_offset);
357 rev =
RBIOS8(check_offset);
369 rev =
RBIOS8(check_offset);
381 while (
RBIOS8(check_offset++));
464 memcpy((
unsigned char *)edid, raw, size);
471 rdev->
mode_info.bios_hardcoded_edid = edid;
482 if (rdev->
mode_info.bios_hardcoded_edid) {
485 memcpy((
unsigned char *)edid,
486 (
unsigned char *)rdev->
mode_info.bios_hardcoded_edid,
487 rdev->
mode_info.bios_hardcoded_edid_size);
590 i2c.mask_clk_reg = ddc_line;
591 i2c.mask_data_reg = ddc_line;
592 i2c.a_clk_reg = ddc_line;
593 i2c.a_data_reg = ddc_line;
594 i2c.en_clk_reg = ddc_line;
595 i2c.en_data_reg = ddc_line;
596 i2c.y_clk_reg = ddc_line;
597 i2c.y_data_reg = ddc_line;
600 if (clk_mask && data_mask) {
602 i2c.mask_clk_mask = clk_mask;
603 i2c.mask_data_mask = data_mask;
604 i2c.a_clk_mask = clk_mask;
605 i2c.a_data_mask = data_mask;
606 i2c.en_clk_mask = clk_mask;
607 i2c.en_data_mask = data_mask;
608 i2c.y_clk_mask = clk_mask;
609 i2c.y_data_mask = data_mask;
613 i2c.mask_clk_mask = (0x20 << 8);
614 i2c.mask_data_mask = 0x80;
615 i2c.a_clk_mask = (0x20 << 8);
616 i2c.a_data_mask = 0x80;
617 i2c.en_clk_mask = (0x20 << 8);
618 i2c.en_data_mask = 0x80;
619 i2c.y_clk_mask = (0x20 << 8);
620 i2c.y_data_mask = 0x80;
633 switch (rdev->family) {
642 i2c.hw_capable =
true;
645 i2c.hw_capable =
false;
653 i2c.hw_capable =
true;
656 i2c.hw_capable =
false;
666 i2c.hw_capable =
true;
669 i2c.hw_capable =
false;
678 i2c.hw_capable =
true;
681 i2c.hw_capable =
false;
692 i2c.hw_capable =
true;
698 i2c.hw_capable =
false;
701 i2c.hw_capable =
false;
706 i2c.hw_capable =
false;
734 blocks =
RBIOS8(offset + 2);
735 for (i = 0; i < blocks; i++) {
736 id =
RBIOS8(offset + 3 + (i * 5) + 0);
738 clk =
RBIOS8(offset + 3 + (i * 5) + 3);
739 data =
RBIOS8(offset + 3 + (i * 5) + 4);
741 i2c = combios_setup_i2c_bus(rdev,
DDC_MONID,
742 (1 << clk), (1 << data));
767 i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
770 i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
775 i2c.hw_capable =
true;
787 i2c = combios_setup_i2c_bus(rdev,
DDC_CRT2, 0, 0);
791 i2c = radeon_combios_get_i2c_info_from_table(rdev);
797 i2c = combios_setup_i2c_bus(rdev,
DDC_MONID, 0, 0);
801 i2c = combios_setup_i2c_bus(rdev,
DDC_MONID, 0, 0);
804 i2c = combios_setup_i2c_bus(rdev,
DDC_CRT2, 0, 0);
872 sclk =
RBIOS16(pll_info + 0xa);
873 mclk =
RBIOS16(pll_info + 0x8);
885 rdev->
clock.max_pixel_clock = 35000;
931 static void radeon_legacy_get_primary_dac_info_from_table(
struct radeon_device *rdev,
958 rev =
RBIOS8(dac_info) & 0x3;
960 bg =
RBIOS8(dac_info + 0x2) & 0xf;
961 dac = (
RBIOS8(dac_info + 0x2) >> 4) & 0xf;
964 bg =
RBIOS8(dac_info + 0x2) & 0xf;
965 dac =
RBIOS8(dac_info + 0x3) & 0xf;
974 radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac);
988 if (
RBIOS8(tv_info + 6) ==
'T') {
989 switch (
RBIOS8(tv_info + 7) & 0xf) {
992 DRM_DEBUG_KMS(
"Default TV standard: NTSC\n");
996 DRM_DEBUG_KMS(
"Default TV standard: PAL\n");
1000 DRM_DEBUG_KMS(
"Default TV standard: PAL-M\n");
1004 DRM_DEBUG_KMS(
"Default TV standard: PAL-60\n");
1008 DRM_DEBUG_KMS(
"Default TV standard: NTSC-J\n");
1012 DRM_DEBUG_KMS(
"Default TV standard: SCART-PAL\n");
1017 (
"Unknown TV standard; defaulting to NTSC\n");
1021 switch ((
RBIOS8(tv_info + 9) >> 2) & 0x3) {
1023 DRM_DEBUG_KMS(
"29.498928713 MHz TV ref clk\n");
1026 DRM_DEBUG_KMS(
"28.636360000 MHz TV ref clk\n");
1029 DRM_DEBUG_KMS(
"14.318180000 MHz TV ref clk\n");
1032 DRM_DEBUG_KMS(
"27.000000000 MHz TV ref clk\n");
1063 static void radeon_legacy_get_tv_dac_info_from_table(
struct radeon_device *rdev,
1092 rev =
RBIOS8(dac_info + 0x3);
1095 dac =
RBIOS8(dac_info + 0xd) & 0xf;
1099 dac =
RBIOS8(dac_info + 0xf) & 0xf;
1102 bg =
RBIOS8(dac_info + 0x10) & 0xf;
1103 dac =
RBIOS8(dac_info + 0x11) & 0xf;
1108 }
else if (rev > 1) {
1110 dac = (
RBIOS8(dac_info + 0
xc) >> 4) & 0xf;
1113 bg =
RBIOS8(dac_info + 0xd) & 0xf;
1114 dac = (
RBIOS8(dac_info + 0xd) >> 4) & 0xf;
1118 dac = (
RBIOS8(dac_info + 0
xe) >> 4) & 0xf;
1131 rev =
RBIOS8(dac_info) & 0x3;
1133 bg =
RBIOS8(dac_info + 0x3) & 0xf;
1134 dac = (
RBIOS8(dac_info + 0x3) >> 4) & 0xf;
1136 (bg << 16) | (dac << 20);
1143 bg =
RBIOS8(dac_info + 0x4) & 0xf;
1144 dac =
RBIOS8(dac_info + 0x5) & 0xf;
1146 (bg << 16) | (dac << 20);
1154 DRM_INFO(
"No TV DAC info found in BIOS\n");
1159 radeon_legacy_get_tv_dac_info_from_table(rdev, tv_dac);
1169 uint32_t fp_vert_stretch, fp_horz_stretch;
1213 if ((ppll_val & 0x000707ff) == 0x1bb)
1227 DRM_INFO(
"Panel info derived from registers\n");
1228 DRM_INFO(
"Panel Size %dx%d\n", lvds->
native_mode.hdisplay,
1253 for (i = 0; i < 24; i++)
1254 stmp[i] =
RBIOS8(lcd_info + i + 1);
1257 DRM_INFO(
"Panel ID String: %s\n", stmp);
1262 DRM_INFO(
"Panel Size %dx%d\n", lvds->
native_mode.hdisplay,
1279 panel_setup =
RBIOS32(lcd_info + 0x39);
1281 if (panel_setup & 0x1)
1284 if ((panel_setup >> 4) & 0x1)
1287 switch ((panel_setup >> 8) & 0x7) {
1301 if ((panel_setup >> 16) & 0x1)
1304 if ((panel_setup >> 17) & 0x1)
1307 if ((panel_setup >> 18) & 0x1)
1310 if ((panel_setup >> 23) & 0x1)
1315 for (i = 0; i < 32; i++) {
1316 tmp =
RBIOS16(lcd_info + 64 + i * 2);
1334 ((
RBIOS16(tmp + 28) & 0xf800) >> 11);
1344 DRM_INFO(
"No panel info found in BIOS\n");
1345 lvds = radeon_legacy_get_lvds_info_from_regs(rdev);
1354 {{12000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}},
1355 {{12000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}},
1356 {{0, 0}, {0, 0}, {0, 0}, {0, 0}},
1357 {{15000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}},
1358 {{12000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}},
1359 {{15000, 0xa1b}, {0xffffffff, 0xa3f}, {0, 0}, {0, 0}},
1360 {{15500, 0x81b}, {0xffffffff, 0x83f}, {0, 0}, {0, 0}},
1361 {{0, 0}, {0, 0}, {0, 0}, {0, 0}},
1362 {{13000, 0x400f4}, {15000, 0x400f7}, {0xffffffff, 0x40111}, {0, 0}},
1363 {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}},
1364 {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}},
1365 {{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}},
1366 {{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}},
1367 {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}},
1368 {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}},
1369 {{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}},
1370 { {0, 0}, {0, 0}, {0, 0}, {0, 0} },
1371 { {0, 0}, {0, 0}, {0, 0}, {0, 0} },
1381 for (i = 0; i < 4; i++) {
1403 DRM_DEBUG_KMS(
"DFP table revision: %d\n", ver);
1405 n =
RBIOS8(tmds_info + 5) + 1;
1408 for (i = 0; i <
n; i++) {
1410 RBIOS32(tmds_info + i * 10 + 0x08);
1412 RBIOS16(tmds_info + i * 10 + 0x10);
1413 DRM_DEBUG_KMS(
"TMDS PLL From COMBIOS %u %x\n",
1417 }
else if (ver == 4) {
1419 n =
RBIOS8(tmds_info + 5) + 1;
1422 for (i = 0; i <
n; i++) {
1424 RBIOS32(tmds_info + stride + 0x08);
1426 RBIOS16(tmds_info + stride + 0x10);
1431 DRM_DEBUG_KMS(
"TMDS PLL From COMBIOS %u %x\n",
1437 DRM_INFO(
"No TMDS info found in BIOS\n");
1451 i2c_bus = combios_setup_i2c_bus(rdev,
DDC_MONID, 0, 0);
1455 switch (rdev->
mode_info.connector_table) {
1479 i2c_bus = combios_setup_i2c_bus(rdev,
DDC_MONID, 0, 0);
1487 DRM_DEBUG_KMS(
"External TMDS Table revision: %d\n", ver);
1490 gpio =
RBIOS8(offset + 4 + 3);
1493 i2c_bus.
valid =
true;
1498 i2c_bus = combios_setup_i2c_bus(rdev, gpio, 0, 0);
1504 DRM_INFO(
"No valid Ext TMDS info found in BIOS\n");
1519 #ifdef CONFIG_PPC_PMAC
1564 }
else if ((rdev->
pdev->device == 0x4a48) &&
1565 (rdev->
pdev->subsystem_vendor == 0x1002) &&
1566 (rdev->
pdev->subsystem_device == 0x4a48)) {
1571 (rdev->
pdev->device == 0x4150) &&
1572 (rdev->
pdev->subsystem_vendor == 0x1002) &&
1573 (rdev->
pdev->subsystem_device == 0x4150)) {
1576 }
else if ((rdev->
pdev->device == 0x4c66) &&
1577 (rdev->
pdev->subsystem_vendor == 0x1002) &&
1578 (rdev->
pdev->subsystem_device == 0x4c66)) {
1591 switch (rdev->
mode_info.connector_table) {
1593 DRM_INFO(
"Connector Table: %d (generic)\n",
1598 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
1628 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
1643 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
1664 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
1681 ddc_i2c.
valid =
false;
1697 DRM_INFO(
"Connector Table: %d (ibook)\n",
1700 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
1712 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
1724 ddc_i2c.
valid =
false;
1738 DRM_INFO(
"Connector Table: %d (powerbook external tmds)\n",
1741 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
1753 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
1773 ddc_i2c.
valid =
false;
1787 DRM_INFO(
"Connector Table: %d (powerbook internal tmds)\n",
1790 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
1802 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
1821 ddc_i2c.
valid =
false;
1835 DRM_INFO(
"Connector Table: %d (powerbook vga)\n",
1838 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
1850 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
1862 ddc_i2c.
valid =
false;
1876 DRM_INFO(
"Connector Table: %d (mini external tmds)\n",
1879 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_CRT2, 0, 0);
1899 ddc_i2c.
valid =
false;
1913 DRM_INFO(
"Connector Table: %d (mini internal tmds)\n",
1916 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_CRT2, 0, 0);
1935 ddc_i2c.
valid =
false;
1949 DRM_INFO(
"Connector Table: %d (imac g5 isight)\n",
1952 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_MONID, 0, 0);
1964 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
1976 ddc_i2c.
valid =
false;
1990 DRM_INFO(
"Connector Table: %d (emac)\n",
1993 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
2005 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_CRT2, 0, 0);
2017 ddc_i2c.
valid =
false;
2031 DRM_INFO(
"Connector Table: %d (rn50-power)\n",
2034 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
2045 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_CRT2, 0, 0);
2058 DRM_INFO(
"Connector Table: %d (mac x800)\n",
2061 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
2080 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_MONID, 0, 0);
2100 DRM_INFO(
"Connector Table: %d (mac g5 9600)\n",
2103 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
2122 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
2141 ddc_i2c.
valid =
false;
2155 DRM_INFO(
"Connector Table: %d (SAM440ep embedded board)\n",
2170 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
2189 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
2202 ddc_i2c.
valid =
false;
2216 DRM_INFO(
"Connector table: %d (invalid)\n",
2226 static bool radeon_apply_legacy_quirks(
struct drm_device *dev,
2236 if (dev->pdev->device == 0x515e &&
2237 dev->pdev->subsystem_vendor == 0x1014) {
2244 if (dev->pdev->device == 0x5B60 &&
2245 dev->pdev->subsystem_vendor == 0x17af &&
2246 dev->pdev->subsystem_device == 0x201e && bios_index == 2) {
2254 static bool radeon_apply_legacy_tv_quirks(
struct drm_device *dev)
2257 if (dev->pdev->device == 0x5975 &&
2258 dev->pdev->subsystem_vendor == 0x1025 &&
2259 dev->pdev->subsystem_device == 0x009f)
2263 if (dev->pdev->device == 0x5974 &&
2264 dev->pdev->subsystem_vendor == 0x103c &&
2265 dev->pdev->subsystem_device == 0x280a)
2269 if (dev->pdev->device == 0x5955 &&
2270 dev->pdev->subsystem_vendor == 0x1462 &&
2271 dev->pdev->subsystem_device == 0x0131)
2289 if (ext_tmds_info) {
2325 for (i = 0; i < 4; i++) {
2326 entry = conn_info + 2 + i * 2;
2333 connector = (tmp >> 12) & 0xf;
2335 ddc_type = (tmp >> 8) & 0xf;
2337 ddc_i2c = radeon_combios_get_i2c_info_from_table(rdev);
2339 ddc_i2c = combios_setup_i2c_bus(rdev, ddc_type, 0, 0);
2341 switch (connector) {
2345 if ((tmp >> 4) & 0x1)
2355 if (!radeon_apply_legacy_quirks(dev, i, &connector,
2359 switch (connector) {
2361 if ((tmp >> 4) & 0x1)
2422 if ((tmp >> 4) & 0x1) {
2430 connector_object_id = combios_check_dl_dvi(dev, 0);
2447 connector_object_id,
2451 if ((tmp >> 4) & 0x1) {
2453 connector_object_id = combios_check_dl_dvi(dev, 1);
2466 connector_object_id,
2486 DRM_ERROR(
"Unknown connector type: %d\n",
2496 DRM_DEBUG_KMS(
"Found DFP table, assuming DVI connector\n");
2509 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_DVI, 0, 0);
2522 DRM_DEBUG_KMS(
"Found CRT table, assuming VGA connector\n");
2529 ddc_i2c = combios_setup_i2c_bus(rdev,
DDC_VGA, 0, 0);
2539 DRM_DEBUG_KMS(
"No connector info found\n");
2550 combios_get_table_offset(dev,
2560 ddc_type =
RBIOS8(lcd_ddc_info + 2);
2564 combios_setup_i2c_bus(rdev,
2572 combios_setup_i2c_bus(rdev,
2580 combios_setup_i2c_bus(rdev, ddc_type, 0, 0);
2583 DRM_DEBUG_KMS(
"LCD DDC Info Table found!\n");
2585 ddc_i2c.
valid =
false;
2603 if (
RBIOS8(tv_info + 6) ==
'T') {
2604 if (radeon_apply_legacy_tv_quirks(dev)) {
2606 ddc_i2c.
valid =
false;
2629 static const char *thermal_controller_names[] = {
2640 int state_index = 0;
2643 rdev->
pm.default_power_state_index = -1;
2647 if (rdev->
pm.power_state) {
2649 rdev->
pm.power_state[0].clock_info =
2651 rdev->
pm.power_state[1].clock_info =
2653 if (!rdev->
pm.power_state[0].clock_info ||
2654 !rdev->
pm.power_state[1].clock_info)
2662 u8 thermal_controller = 0,
gpio = 0, i2c_addr = 0, clk_bit = 0, data_bit = 0;
2667 thermal_controller =
RBIOS8(offset + 3);
2669 i2c_addr =
RBIOS8(offset + 5);
2670 }
else if (rev == 1) {
2671 thermal_controller =
RBIOS8(offset + 4);
2673 i2c_addr =
RBIOS8(offset + 6);
2674 }
else if (rev == 2) {
2675 thermal_controller =
RBIOS8(offset + 4);
2677 i2c_addr =
RBIOS8(offset + 6);
2678 clk_bit =
RBIOS8(offset + 0xa);
2681 if ((thermal_controller > 0) && (thermal_controller < 3)) {
2682 DRM_INFO(
"Possible %s thermal controller at 0x%02x\n",
2683 thermal_controller_names[thermal_controller],
2687 i2c_bus.
valid =
true;
2692 i2c_bus = combios_setup_i2c_bus(rdev,
gpio, 1 << clk_bit, 1 << data_bit);
2694 i2c_bus = combios_setup_i2c_bus(rdev,
gpio, 0, 0);
2696 if (rdev->
pm.i2c_bus) {
2698 const char *
name = thermal_controller_names[thermal_controller];
2699 info.
addr = i2c_addr >> 1;
2708 if ((dev->pdev->device == 0x4152) &&
2709 (dev->pdev->subsystem_vendor == 0x1043) &&
2710 (dev->pdev->subsystem_device == 0xc002)) {
2711 i2c_bus = combios_setup_i2c_bus(rdev,
DDC_MONID, 0, 0);
2713 if (rdev->
pm.i2c_bus) {
2715 const char *
name =
"f75375";
2719 DRM_INFO(
"Possible %s thermal controller at 0x%02x\n",
2729 blocks =
RBIOS8(offset + 0x2);
2731 rdev->
pm.power_state[state_index].num_clock_modes = 1;
2732 rdev->
pm.power_state[state_index].clock_info[0].mclk =
RBIOS32(offset + 0x5 + 0x2);
2733 rdev->
pm.power_state[state_index].clock_info[0].sclk =
RBIOS32(offset + 0x5 + 0x6);
2734 if ((rdev->
pm.power_state[state_index].clock_info[0].mclk == 0) ||
2735 (rdev->
pm.power_state[state_index].clock_info[0].sclk == 0))
2737 rdev->
pm.power_state[state_index].type =
2739 misc =
RBIOS16(offset + 0x5 + 0x0);
2742 rdev->
pm.power_state[state_index].misc = misc;
2743 rdev->
pm.power_state[state_index].misc2 = misc2;
2745 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
VOLTAGE_GPIO;
2747 rdev->
pm.power_state[state_index].clock_info[0].voltage.active_high =
2750 rdev->
pm.power_state[state_index].clock_info[0].voltage.active_high =
2752 rdev->
pm.power_state[state_index].clock_info[0].voltage.gpio.valid =
true;
2754 rdev->
pm.power_state[state_index].clock_info[0].voltage.gpio.reg =
2756 tmp =
RBIOS8(offset + 0x5 + 0xd);
2757 rdev->
pm.power_state[state_index].clock_info[0].voltage.gpio.mask = (1 <<
tmp);
2760 u16 voltage_table_offset =
RBIOS16(offset + 0x5 + 0
xc);
2761 if (entries && voltage_table_offset) {
2762 rdev->
pm.power_state[state_index].clock_info[0].voltage.gpio.reg =
2763 RBIOS16(voltage_table_offset) * 4;
2764 tmp =
RBIOS8(voltage_table_offset + 0x2);
2765 rdev->
pm.power_state[state_index].clock_info[0].voltage.gpio.mask = (1 <<
tmp);
2767 rdev->
pm.power_state[state_index].clock_info[0].voltage.gpio.valid =
false;
2769 switch ((misc2 & 0x700) >> 8) {
2772 rdev->
pm.power_state[state_index].clock_info[0].voltage.delay = 0;
2775 rdev->
pm.power_state[state_index].clock_info[0].voltage.delay = 33;
2778 rdev->
pm.power_state[state_index].clock_info[0].voltage.delay = 66;
2781 rdev->
pm.power_state[state_index].clock_info[0].voltage.delay = 99;
2784 rdev->
pm.power_state[state_index].clock_info[0].voltage.delay = 132;
2788 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
VOLTAGE_NONE;
2790 rdev->
pm.power_state[state_index].pcie_lanes =
2791 RBIOS8(offset + 0x5 + 0x10);
2803 rdev->
pm.power_state[state_index].type =
2805 rdev->
pm.power_state[state_index].num_clock_modes = 1;
2806 rdev->
pm.power_state[state_index].clock_info[0].mclk = rdev->
clock.default_mclk;
2807 rdev->
pm.power_state[state_index].clock_info[0].sclk = rdev->
clock.default_sclk;
2808 rdev->
pm.power_state[state_index].default_clock_mode = &rdev->
pm.power_state[state_index].clock_info[0];
2809 if ((state_index > 0) &&
2810 (rdev->
pm.power_state[0].clock_info[0].voltage.type ==
VOLTAGE_GPIO))
2811 rdev->
pm.power_state[state_index].clock_info[0].voltage =
2812 rdev->
pm.power_state[0].clock_info[0].voltage;
2814 rdev->
pm.power_state[state_index].clock_info[0].voltage.type =
VOLTAGE_NONE;
2815 rdev->
pm.power_state[state_index].pcie_lanes = 16;
2816 rdev->
pm.power_state[state_index].flags = 0;
2817 rdev->
pm.default_power_state_index = state_index;
2818 rdev->
pm.num_power_states = state_index + 1;
2820 rdev->
pm.current_power_state_index = rdev->
pm.default_power_state_index;
2821 rdev->
pm.current_clock_mode_index = 0;
2825 rdev->
pm.default_power_state_index = state_index;
2826 rdev->
pm.num_power_states = 0;
2828 rdev->
pm.current_power_state_index = rdev->
pm.default_power_state_index;
2829 rdev->
pm.current_clock_mode_index = 0;
2899 blocks =
RBIOS8(offset + 3);
2901 while (blocks > 0) {
2906 reg = (
id & 0x1fff) * 4;
2912 reg = (
id & 0x1fff) * 4;
2918 val = (val & and_mask) | or_mask;
2932 slave_addr =
id & 0xff;
2944 DRM_ERROR(
"Unknown id %d\n",
id >> 13);
2955 index = offset + 10;
2957 while (
id != 0xffff) {
2961 reg = (
id & 0x1fff) * 4;
2966 reg = (
id & 0x1fff) * 4;
2972 val = (val & and_mask) | or_mask;
2987 val = (val & and_mask) | or_mask;
2999 DRM_ERROR(
"Unknown id %d\n",
id >> 13);
3108 shift =
RBIOS8(offset) * 8;
3110 and_mask =
RBIOS8(offset) << shift;
3111 and_mask |= ~(0xff << shift);
3113 or_mask =
RBIOS8(offset) << shift;
3155 mclk_cntl &= 0xffff0000;
3164 ~RADEON_CG_NO1_DEBUG_0);
3179 static void combios_parse_ram_reset_table(
struct drm_device *dev,
3187 while (val != 0xff) {
3194 channel_complete_mask =
3197 channel_complete_mask =
3202 channel_complete_mask) ==
3203 channel_complete_mask)
3215 or_mask = val << 24;
3227 int mem_addr_mapping)
3238 mem_cntl &= ~(0xff << 8);
3239 mem_cntl |= (mem_addr_mapping & 0xff) << 8;
3247 addr = ram * 1024 * 1024;
3260 static void combios_write_ram_size(
struct drm_device *dev)
3277 mem_cntl =
RBIOS32(offset + 1);
3278 mem_size =
RBIOS16(offset + 5);
3289 rev =
RBIOS8(offset - 1);
3294 int mem_addr_mapping = 0;
3300 if (mem_addr_mapping != 0x25)
3303 combios_detect_ram(dev, ram,
3310 mem_size =
RBIOS8(offset);
3312 mem_size =
RBIOS8(offset);
3318 mem_size *= (1024 * 1024);
3334 combios_parse_mmio_table(dev, table);
3339 combios_parse_pll_table(dev, table);
3344 combios_parse_mmio_table(dev, table);
3351 combios_parse_mmio_table(dev, table);
3356 combios_parse_ram_reset_table(dev, table);
3362 combios_parse_mmio_table(dev, table);
3365 combios_write_ram_size(dev);
3372 rdev->
pdev->subsystem_vendor == 0x103c &&
3373 rdev->
pdev->subsystem_device == 0x308b)
3380 rdev->
pdev->subsystem_vendor == 0x103c &&
3381 rdev->
pdev->subsystem_device == 0x30a4)
3388 rdev->
pdev->subsystem_vendor == 0x103c &&
3389 rdev->
pdev->subsystem_device == 0x30ae)
3395 combios_parse_pll_table(dev, table);
3402 uint32_t bios_0_scratch, bios_6_scratch, bios_7_scratch;
3455 DRM_DEBUG_KMS(
"TV1 connected\n");
3462 DRM_DEBUG_KMS(
"TV1 disconnected\n");
3471 DRM_DEBUG_KMS(
"LCD1 connected\n");
3476 DRM_DEBUG_KMS(
"LCD1 disconnected\n");
3485 DRM_DEBUG_KMS(
"CRT1 connected\n");
3490 DRM_DEBUG_KMS(
"CRT1 disconnected\n");
3499 DRM_DEBUG_KMS(
"CRT2 connected\n");
3504 DRM_DEBUG_KMS(
"CRT2 disconnected\n");
3513 DRM_DEBUG_KMS(
"DFP1 connected\n");
3518 DRM_DEBUG_KMS(
"DFP1 disconnected\n");
3527 DRM_DEBUG_KMS(
"DFP2 connected\n");
3532 DRM_DEBUG_KMS(
"DFP2 disconnected\n");