diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2008-05-27 23:28:59 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-06-18 21:27:39 -0400 |
commit | 45e519052e8f583a709edd442a23f59581d3fe42 (patch) | |
tree | e928f17fdc5f8c52d33a649c361aa5c2cdee720c /drivers/char/drm | |
parent | 2735977b12cb0f113aae24afff04747b6d0f5bf1 (diff) |
drm/radeon: merge IGP chip setup and fixup RS400 vs RS480 support
We only support RS480 (AMD based IGP) at the moment not
RS400 (Intel based IGP) ones.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/char/drm')
-rw-r--r-- | drivers/char/drm/drm_pciids.h | 14 | ||||
-rw-r--r-- | drivers/char/drm/radeon_cp.c | 169 | ||||
-rw-r--r-- | drivers/char/drm/radeon_drv.h | 120 |
3 files changed, 138 insertions, 165 deletions
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h index a6a499f97e22..bad096f896ad 100644 --- a/drivers/char/drm/drm_pciids.h +++ b/drivers/char/drm/drm_pciids.h | |||
@@ -103,20 +103,18 @@ | |||
103 | {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 103 | {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
104 | {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \ | 104 | {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \ |
105 | {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ | 105 | {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ |
106 | {0x1002, 0x5954, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | 106 | {0x1002, 0x5954, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ |
107 | {0x1002, 0x5955, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | 107 | {0x1002, 0x5955, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ |
108 | {0x1002, 0x5974, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | 108 | {0x1002, 0x5974, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ |
109 | {0x1002, 0x5975, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | 109 | {0x1002, 0x5975, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ |
110 | {0x1002, 0x5960, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 110 | {0x1002, 0x5960, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
111 | {0x1002, 0x5961, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 111 | {0x1002, 0x5961, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
112 | {0x1002, 0x5962, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 112 | {0x1002, 0x5962, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
113 | {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 113 | {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
114 | {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 114 | {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
115 | {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ | 115 | {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ |
116 | {0x1002, 0x5a41, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | 116 | {0x1002, 0x5a61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ |
117 | {0x1002, 0x5a42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | 117 | {0x1002, 0x5a62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ |
118 | {0x1002, 0x5a61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | ||
119 | {0x1002, 0x5a62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ | ||
120 | {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ | 118 | {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ |
121 | {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ | 119 | {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ |
122 | {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ | 120 | {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ |
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 38eda336a657..3a424986e85e 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c | |||
@@ -2,6 +2,7 @@ | |||
2 | /* | 2 | /* |
3 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. | 3 | * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. |
4 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. | 4 | * Copyright 2000 VA Linux Systems, Inc., Fremont, California. |
5 | * Copyright 2007 Advanced Micro Devices, Inc. | ||
5 | * All Rights Reserved. | 6 | * All Rights Reserved. |
6 | * | 7 | * |
7 | * Permission is hereby granted, free of charge, to any person obtaining a | 8 | * Permission is hereby granted, free of charge, to any person obtaining a |
@@ -40,7 +41,7 @@ | |||
40 | 41 | ||
41 | static int radeon_do_cleanup_cp(struct drm_device * dev); | 42 | static int radeon_do_cleanup_cp(struct drm_device * dev); |
42 | 43 | ||
43 | static u32 RADEON_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | 44 | static u32 R500_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) |
44 | { | 45 | { |
45 | u32 ret; | 46 | u32 ret; |
46 | RADEON_WRITE(R520_MC_IND_INDEX, 0x7f0000 | (addr & 0xff)); | 47 | RADEON_WRITE(R520_MC_IND_INDEX, 0x7f0000 | (addr & 0xff)); |
@@ -49,21 +50,41 @@ static u32 RADEON_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | |||
49 | return ret; | 50 | return ret; |
50 | } | 51 | } |
51 | 52 | ||
53 | static u32 RS480_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | ||
54 | { | ||
55 | u32 ret; | ||
56 | RADEON_WRITE(RS480_NB_MC_INDEX, addr & 0xff); | ||
57 | ret = RADEON_READ(RS480_NB_MC_DATA); | ||
58 | RADEON_WRITE(RS480_NB_MC_INDEX, 0xff); | ||
59 | return ret; | ||
60 | } | ||
61 | |||
52 | static u32 RS690_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | 62 | static u32 RS690_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) |
53 | { | 63 | { |
64 | u32 ret; | ||
54 | RADEON_WRITE(RS690_MC_INDEX, (addr & RS690_MC_INDEX_MASK)); | 65 | RADEON_WRITE(RS690_MC_INDEX, (addr & RS690_MC_INDEX_MASK)); |
55 | return RADEON_READ(RS690_MC_DATA); | 66 | ret = RADEON_READ(RS690_MC_DATA); |
67 | RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_MASK); | ||
68 | return ret; | ||
69 | } | ||
70 | |||
71 | static u32 IGP_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | ||
72 | { | ||
73 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) | ||
74 | return RS690_READ_MCIND(dev_priv, addr); | ||
75 | else | ||
76 | return RS480_READ_MCIND(dev_priv, addr); | ||
56 | } | 77 | } |
57 | 78 | ||
58 | u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv) | 79 | u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv) |
59 | { | 80 | { |
60 | 81 | ||
61 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) | 82 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) |
62 | return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION); | 83 | return R500_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION); |
63 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) | 84 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) |
64 | return RS690_READ_MCIND(dev_priv, RS690_MC_FB_LOCATION); | 85 | return RS690_READ_MCIND(dev_priv, RS690_MC_FB_LOCATION); |
65 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) | 86 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) |
66 | return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION); | 87 | return R500_READ_MCIND(dev_priv, R520_MC_FB_LOCATION); |
67 | else | 88 | else |
68 | return RADEON_READ(RADEON_MC_FB_LOCATION); | 89 | return RADEON_READ(RADEON_MC_FB_LOCATION); |
69 | } | 90 | } |
@@ -71,11 +92,11 @@ u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv) | |||
71 | static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc) | 92 | static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc) |
72 | { | 93 | { |
73 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) | 94 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) |
74 | RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc); | 95 | R500_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc); |
75 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) | 96 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) |
76 | RS690_WRITE_MCIND(RS690_MC_FB_LOCATION, fb_loc); | 97 | RS690_WRITE_MCIND(RS690_MC_FB_LOCATION, fb_loc); |
77 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) | 98 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) |
78 | RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc); | 99 | R500_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc); |
79 | else | 100 | else |
80 | RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc); | 101 | RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc); |
81 | } | 102 | } |
@@ -83,11 +104,11 @@ static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc) | |||
83 | static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc) | 104 | static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc) |
84 | { | 105 | { |
85 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) | 106 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) |
86 | RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc); | 107 | R500_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc); |
87 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) | 108 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) |
88 | RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, agp_loc); | 109 | RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, agp_loc); |
89 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) | 110 | else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) |
90 | RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc); | 111 | R500_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc); |
91 | else | 112 | else |
92 | RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc); | 113 | RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc); |
93 | } | 114 | } |
@@ -106,15 +127,6 @@ static u32 RADEON_READ_PCIE(drm_radeon_private_t *dev_priv, int addr) | |||
106 | return RADEON_READ(RADEON_PCIE_DATA); | 127 | return RADEON_READ(RADEON_PCIE_DATA); |
107 | } | 128 | } |
108 | 129 | ||
109 | static u32 RADEON_READ_IGPGART(drm_radeon_private_t *dev_priv, int addr) | ||
110 | { | ||
111 | u32 ret; | ||
112 | RADEON_WRITE(RS400_NB_MC_INDEX, addr & 0x7f); | ||
113 | ret = RADEON_READ(RS400_NB_MC_DATA); | ||
114 | RADEON_WRITE(RS400_NB_MC_INDEX, 0x7f); | ||
115 | return ret; | ||
116 | } | ||
117 | |||
118 | #if RADEON_FIFO_DEBUG | 130 | #if RADEON_FIFO_DEBUG |
119 | static void radeon_status(drm_radeon_private_t * dev_priv) | 131 | static void radeon_status(drm_radeon_private_t * dev_priv) |
120 | { | 132 | { |
@@ -255,7 +267,7 @@ static void radeon_cp_load_microcode(drm_radeon_private_t * dev_priv) | |||
255 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R350) || | 267 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R350) || |
256 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV350) || | 268 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV350) || |
257 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV380) || | 269 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV380) || |
258 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS400)) { | 270 | ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS480)) { |
259 | DRM_INFO("Loading R300 Microcode\n"); | 271 | DRM_INFO("Loading R300 Microcode\n"); |
260 | for (i = 0; i < 256; i++) { | 272 | for (i = 0; i < 256; i++) { |
261 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, | 273 | RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, |
@@ -604,114 +616,77 @@ static void radeon_test_writeback(drm_radeon_private_t * dev_priv) | |||
604 | /* Enable or disable IGP GART on the chip */ | 616 | /* Enable or disable IGP GART on the chip */ |
605 | static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on) | 617 | static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on) |
606 | { | 618 | { |
607 | u32 temp, tmp; | ||
608 | |||
609 | tmp = RADEON_READ(RADEON_AIC_CNTL); | ||
610 | if (on) { | ||
611 | DRM_DEBUG("programming igpgart %08X %08lX %08X\n", | ||
612 | dev_priv->gart_vm_start, | ||
613 | (long)dev_priv->gart_info.bus_addr, | ||
614 | dev_priv->gart_size); | ||
615 | |||
616 | RADEON_WRITE_IGPGART(RS400_MC_MISC_CNTL, RS400_GART_INDEX_REG_EN); | ||
617 | RADEON_WRITE_IGPGART(RS400_AGP_ADDRESS_SPACE_SIZE, (RS400_GART_EN | | ||
618 | RS400_VA_SIZE_32MB)); | ||
619 | RADEON_WRITE_IGPGART(RS400_GART_FEATURE_ID, (RS400_HANG_EN | | ||
620 | RS400_TLB_ENABLE | | ||
621 | RS400_GTW_LAC_EN | | ||
622 | RS400_1LEVEL_GART)); | ||
623 | RADEON_WRITE_IGPGART(RS400_GART_BASE, | ||
624 | dev_priv->gart_info.bus_addr); | ||
625 | |||
626 | temp = RADEON_READ_IGPGART(dev_priv, RS400_AGP_MODE_CNTL); | ||
627 | RADEON_WRITE_IGPGART(RS400_AGP_MODE_CNTL, temp); | ||
628 | |||
629 | RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev_priv->gart_vm_start); | ||
630 | dev_priv->gart_size = 32*1024*1024; | ||
631 | radeon_write_agp_location(dev_priv, | ||
632 | (((dev_priv->gart_vm_start - 1 + | ||
633 | dev_priv->gart_size) & 0xffff0000) | | ||
634 | (dev_priv->gart_vm_start >> 16))); | ||
635 | |||
636 | temp = RADEON_READ_IGPGART(dev_priv, RS400_AGP_ADDRESS_SPACE_SIZE); | ||
637 | RADEON_WRITE_IGPGART(RS400_AGP_ADDRESS_SPACE_SIZE, temp); | ||
638 | |||
639 | RADEON_READ_IGPGART(dev_priv, RS400_GART_CACHE_CNTRL); | ||
640 | RADEON_WRITE_IGPGART(RS400_GART_CACHE_CNTRL, RS400_GART_CACHE_INVALIDATE); | ||
641 | RADEON_READ_IGPGART(dev_priv, RS400_GART_CACHE_CNTRL); | ||
642 | RADEON_WRITE_IGPGART(RS400_GART_CACHE_CNTRL, 0); | ||
643 | } | ||
644 | } | ||
645 | |||
646 | /* Enable or disable RS690 GART on the chip */ | ||
647 | static void radeon_set_rs690gart(drm_radeon_private_t *dev_priv, int on) | ||
648 | { | ||
649 | u32 temp; | 619 | u32 temp; |
650 | 620 | ||
651 | if (on) { | 621 | if (on) { |
652 | DRM_DEBUG("programming rs690 gart %08X %08lX %08X\n", | 622 | DRM_DEBUG("programming igp gart %08X %08lX %08X\n", |
653 | dev_priv->gart_vm_start, | 623 | dev_priv->gart_vm_start, |
654 | (long)dev_priv->gart_info.bus_addr, | 624 | (long)dev_priv->gart_info.bus_addr, |
655 | dev_priv->gart_size); | 625 | dev_priv->gart_size); |
656 | 626 | ||
657 | temp = RS690_READ_MCIND(dev_priv, RS400_MC_MISC_CNTL); | 627 | temp = IGP_READ_MCIND(dev_priv, RS480_MC_MISC_CNTL); |
658 | RS690_WRITE_MCIND(RS400_MC_MISC_CNTL, (RS400_GART_INDEX_REG_EN | | 628 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) |
659 | RS690_BLOCK_GFX_D3_EN)); | 629 | IGP_WRITE_MCIND(RS480_MC_MISC_CNTL, (RS480_GART_INDEX_REG_EN | |
630 | RS690_BLOCK_GFX_D3_EN)); | ||
631 | else | ||
632 | IGP_WRITE_MCIND(RS480_MC_MISC_CNTL, RS480_GART_INDEX_REG_EN); | ||
660 | 633 | ||
661 | RS690_WRITE_MCIND(RS400_AGP_ADDRESS_SPACE_SIZE, (RS400_GART_EN | | 634 | IGP_WRITE_MCIND(RS480_AGP_ADDRESS_SPACE_SIZE, (RS480_GART_EN | |
662 | RS400_VA_SIZE_32MB)); | 635 | RS480_VA_SIZE_32MB)); |
663 | 636 | ||
664 | temp = RS690_READ_MCIND(dev_priv, RS400_GART_FEATURE_ID); | 637 | temp = IGP_READ_MCIND(dev_priv, RS480_GART_FEATURE_ID); |
665 | RS690_WRITE_MCIND(RS400_GART_FEATURE_ID, (RS400_HANG_EN | | 638 | IGP_WRITE_MCIND(RS480_GART_FEATURE_ID, (RS480_HANG_EN | |
666 | RS400_TLB_ENABLE | | 639 | RS480_TLB_ENABLE | |
667 | RS400_GTW_LAC_EN | | 640 | RS480_GTW_LAC_EN | |
668 | RS400_1LEVEL_GART)); | 641 | RS480_1LEVEL_GART)); |
669 | 642 | ||
670 | temp = dev_priv->gart_info.bus_addr & 0xfffff000; | 643 | temp = dev_priv->gart_info.bus_addr & 0xfffff000; |
671 | temp |= (upper_32_bits(dev_priv->gart_info.bus_addr) & 0xff) << 4; | 644 | temp |= (upper_32_bits(dev_priv->gart_info.bus_addr) & 0xff) << 4; |
672 | RS690_WRITE_MCIND(RS400_GART_BASE, temp); | 645 | IGP_WRITE_MCIND(RS480_GART_BASE, temp); |
673 | 646 | ||
674 | temp = RS690_READ_MCIND(dev_priv, RS400_AGP_MODE_CNTL); | 647 | temp = IGP_READ_MCIND(dev_priv, RS480_AGP_MODE_CNTL); |
675 | RS690_WRITE_MCIND(RS400_AGP_MODE_CNTL, ((1 << RS400_REQ_TYPE_SNOOP_SHIFT) | | 648 | IGP_WRITE_MCIND(RS480_AGP_MODE_CNTL, ((1 << RS480_REQ_TYPE_SNOOP_SHIFT) | |
676 | RS400_REQ_TYPE_SNOOP_DIS)); | 649 | RS480_REQ_TYPE_SNOOP_DIS)); |
677 | 650 | ||
678 | RS690_WRITE_MCIND(RS690_MC_AGP_BASE, | 651 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) { |
679 | (unsigned int)dev_priv->gart_vm_start); | 652 | IGP_WRITE_MCIND(RS690_MC_AGP_BASE, |
680 | 653 | (unsigned int)dev_priv->gart_vm_start); | |
681 | RS690_WRITE_MCIND(RS690_MC_AGP_BASE_2, 0); | 654 | IGP_WRITE_MCIND(RS690_MC_AGP_BASE_2, 0); |
655 | } else { | ||
656 | RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev_priv->gart_vm_start); | ||
657 | RADEON_WRITE(RS480_AGP_BASE_2, 0); | ||
658 | } | ||
682 | 659 | ||
683 | dev_priv->gart_size = 32*1024*1024; | 660 | dev_priv->gart_size = 32*1024*1024; |
684 | temp = (((dev_priv->gart_vm_start - 1 + dev_priv->gart_size) & | 661 | temp = (((dev_priv->gart_vm_start - 1 + dev_priv->gart_size) & |
685 | 0xffff0000) | (dev_priv->gart_vm_start >> 16)); | 662 | 0xffff0000) | (dev_priv->gart_vm_start >> 16)); |
686 | 663 | ||
687 | RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, temp); | 664 | radeon_write_agp_location(dev_priv, temp); |
688 | 665 | ||
689 | temp = RS690_READ_MCIND(dev_priv, RS400_AGP_ADDRESS_SPACE_SIZE); | 666 | temp = IGP_READ_MCIND(dev_priv, RS480_AGP_ADDRESS_SPACE_SIZE); |
690 | RS690_WRITE_MCIND(RS400_AGP_ADDRESS_SPACE_SIZE, (RS400_GART_EN | | 667 | IGP_WRITE_MCIND(RS480_AGP_ADDRESS_SPACE_SIZE, (RS480_GART_EN | |
691 | RS400_VA_SIZE_32MB)); | 668 | RS480_VA_SIZE_32MB)); |
692 | 669 | ||
693 | do { | 670 | do { |
694 | temp = RS690_READ_MCIND(dev_priv, RS400_GART_CACHE_CNTRL); | 671 | temp = IGP_READ_MCIND(dev_priv, RS480_GART_CACHE_CNTRL); |
695 | if ((temp & RS690_MC_GART_CLEAR_STATUS) == | 672 | if ((temp & RS480_GART_CACHE_INVALIDATE) == 0) |
696 | RS690_MC_GART_CLEAR_DONE) | ||
697 | break; | 673 | break; |
698 | DRM_UDELAY(1); | 674 | DRM_UDELAY(1); |
699 | } while (1); | 675 | } while (1); |
700 | 676 | ||
701 | RS690_WRITE_MCIND(RS400_GART_CACHE_CNTRL, | 677 | IGP_WRITE_MCIND(RS480_GART_CACHE_CNTRL, |
702 | RS400_GART_CACHE_INVALIDATE); | 678 | RS480_GART_CACHE_INVALIDATE); |
703 | 679 | ||
704 | do { | 680 | do { |
705 | temp = RS690_READ_MCIND(dev_priv, RS400_GART_CACHE_CNTRL); | 681 | temp = IGP_READ_MCIND(dev_priv, RS480_GART_CACHE_CNTRL); |
706 | if ((temp & RS690_MC_GART_CLEAR_STATUS) == | 682 | if ((temp & RS480_GART_CACHE_INVALIDATE) == 0) |
707 | RS690_MC_GART_CLEAR_DONE) | ||
708 | break; | 683 | break; |
709 | DRM_UDELAY(1); | 684 | DRM_UDELAY(1); |
710 | } while (1); | 685 | } while (1); |
711 | 686 | ||
712 | RS690_WRITE_MCIND(RS400_GART_CACHE_CNTRL, 0); | 687 | IGP_WRITE_MCIND(RS480_GART_CACHE_CNTRL, 0); |
713 | } else { | 688 | } else { |
714 | RS690_WRITE_MCIND(RS400_AGP_ADDRESS_SPACE_SIZE, 0); | 689 | IGP_WRITE_MCIND(RS480_AGP_ADDRESS_SPACE_SIZE, 0); |
715 | } | 690 | } |
716 | } | 691 | } |
717 | 692 | ||
@@ -749,12 +724,8 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on) | |||
749 | { | 724 | { |
750 | u32 tmp; | 725 | u32 tmp; |
751 | 726 | ||
752 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) { | 727 | if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || |
753 | radeon_set_rs690gart(dev_priv, on); | 728 | (dev_priv->flags & RADEON_IS_IGPGART)) { |
754 | return; | ||
755 | } | ||
756 | |||
757 | if (dev_priv->flags & RADEON_IS_IGPGART) { | ||
758 | radeon_set_igpgart(dev_priv, on); | 729 | radeon_set_igpgart(dev_priv, on); |
759 | return; | 730 | return; |
760 | } | 731 | } |
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index f25933e9e56a..3063b0fa512f 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h | |||
@@ -122,7 +122,7 @@ enum radeon_family { | |||
122 | CHIP_RV380, | 122 | CHIP_RV380, |
123 | CHIP_R420, | 123 | CHIP_R420, |
124 | CHIP_RV410, | 124 | CHIP_RV410, |
125 | CHIP_RS400, | 125 | CHIP_RS480, |
126 | CHIP_RS690, | 126 | CHIP_RS690, |
127 | CHIP_RV515, | 127 | CHIP_RV515, |
128 | CHIP_R520, | 128 | CHIP_R520, |
@@ -459,9 +459,9 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, | |||
459 | #define RADEON_PCIE_TX_GART_END_LO 0x16 | 459 | #define RADEON_PCIE_TX_GART_END_LO 0x16 |
460 | #define RADEON_PCIE_TX_GART_END_HI 0x17 | 460 | #define RADEON_PCIE_TX_GART_END_HI 0x17 |
461 | 461 | ||
462 | #define RS400_NB_MC_INDEX 0x168 | 462 | #define RS480_NB_MC_INDEX 0x168 |
463 | # define RS400_NB_MC_IND_WR_EN (1 << 8) | 463 | # define RS480_NB_MC_IND_WR_EN (1 << 8) |
464 | #define RS400_NB_MC_DATA 0x16c | 464 | #define RS480_NB_MC_DATA 0x16c |
465 | 465 | ||
466 | #define RS690_MC_INDEX 0x78 | 466 | #define RS690_MC_INDEX 0x78 |
467 | # define RS690_MC_INDEX_MASK 0x1ff | 467 | # define RS690_MC_INDEX_MASK 0x1ff |
@@ -470,46 +470,42 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, | |||
470 | #define RS690_MC_DATA 0x7c | 470 | #define RS690_MC_DATA 0x7c |
471 | 471 | ||
472 | /* MC indirect registers */ | 472 | /* MC indirect registers */ |
473 | #define RS400_MC_MISC_CNTL 0x18 | 473 | #define RS480_MC_MISC_CNTL 0x18 |
474 | # define RS400_DISABLE_GTW (1 << 1) | 474 | # define RS480_DISABLE_GTW (1 << 1) |
475 | /* switch between MCIND GART and MM GART registers. 0 = mmgart, 1 = mcind gart */ | 475 | /* switch between MCIND GART and MM GART registers. 0 = mmgart, 1 = mcind gart */ |
476 | # define RS400_GART_INDEX_REG_EN (1 << 12) | 476 | # define RS480_GART_INDEX_REG_EN (1 << 12) |
477 | # define RS690_BLOCK_GFX_D3_EN (1 << 14) | 477 | # define RS690_BLOCK_GFX_D3_EN (1 << 14) |
478 | #define RS400_K8_FB_LOCATION 0x1e | 478 | #define RS480_K8_FB_LOCATION 0x1e |
479 | #define RS400_GART_FEATURE_ID 0x2b | 479 | #define RS480_GART_FEATURE_ID 0x2b |
480 | # define RS400_HANG_EN (1 << 11) | 480 | # define RS480_HANG_EN (1 << 11) |
481 | # define RS400_TLB_ENABLE (1 << 18) | 481 | # define RS480_TLB_ENABLE (1 << 18) |
482 | # define RS400_P2P_ENABLE (1 << 19) | 482 | # define RS480_P2P_ENABLE (1 << 19) |
483 | # define RS400_GTW_LAC_EN (1 << 25) | 483 | # define RS480_GTW_LAC_EN (1 << 25) |
484 | # define RS400_2LEVEL_GART (0 << 30) | 484 | # define RS480_2LEVEL_GART (0 << 30) |
485 | # define RS400_1LEVEL_GART (1 << 30) | 485 | # define RS480_1LEVEL_GART (1 << 30) |
486 | # define RS400_PDC_EN (1 << 31) | 486 | # define RS480_PDC_EN (1 << 31) |
487 | #define RS400_GART_BASE 0x2c | 487 | #define RS480_GART_BASE 0x2c |
488 | #define RS400_GART_CACHE_CNTRL 0x2e | 488 | #define RS480_GART_CACHE_CNTRL 0x2e |
489 | # define RS400_GART_CACHE_INVALIDATE (1 << 0) /* wait for it to clear */ | 489 | # define RS480_GART_CACHE_INVALIDATE (1 << 0) /* wait for it to clear */ |
490 | /* ??? */ | 490 | #define RS480_AGP_ADDRESS_SPACE_SIZE 0x38 |
491 | # define RS690_MC_GART_CLEAR_STATUS (1 << 1) | 491 | # define RS480_GART_EN (1 << 0) |
492 | # define RS690_MC_GART_CLEAR_DONE (0 << 1) | 492 | # define RS480_VA_SIZE_32MB (0 << 1) |
493 | # define RS690_MC_GART_CLEAR_PENDING (1 << 1) | 493 | # define RS480_VA_SIZE_64MB (1 << 1) |
494 | #define RS400_AGP_ADDRESS_SPACE_SIZE 0x38 | 494 | # define RS480_VA_SIZE_128MB (2 << 1) |
495 | # define RS400_GART_EN (1 << 0) | 495 | # define RS480_VA_SIZE_256MB (3 << 1) |
496 | # define RS400_VA_SIZE_32MB (0 << 1) | 496 | # define RS480_VA_SIZE_512MB (4 << 1) |
497 | # define RS400_VA_SIZE_64MB (1 << 1) | 497 | # define RS480_VA_SIZE_1GB (5 << 1) |
498 | # define RS400_VA_SIZE_128MB (2 << 1) | 498 | # define RS480_VA_SIZE_2GB (6 << 1) |
499 | # define RS400_VA_SIZE_256MB (3 << 1) | 499 | #define RS480_AGP_MODE_CNTL 0x39 |
500 | # define RS400_VA_SIZE_512MB (4 << 1) | 500 | # define RS480_POST_GART_Q_SIZE (1 << 18) |
501 | # define RS400_VA_SIZE_1GB (5 << 1) | 501 | # define RS480_NONGART_SNOOP (1 << 19) |
502 | # define RS400_VA_SIZE_2GB (6 << 1) | 502 | # define RS480_AGP_RD_BUF_SIZE (1 << 20) |
503 | #define RS400_AGP_MODE_CNTL 0x39 | 503 | # define RS480_REQ_TYPE_SNOOP_SHIFT 22 |
504 | # define RS400_POST_GART_Q_SIZE (1 << 18) | 504 | # define RS480_REQ_TYPE_SNOOP_MASK 0x3 |
505 | # define RS400_NONGART_SNOOP (1 << 19) | 505 | # define RS480_REQ_TYPE_SNOOP_DIS (1 << 24) |
506 | # define RS400_AGP_RD_BUF_SIZE (1 << 20) | 506 | #define RS480_MC_MISC_UMA_CNTL 0x5f |
507 | # define RS400_REQ_TYPE_SNOOP_SHIFT 22 | 507 | #define RS480_MC_MCLK_CNTL 0x7a |
508 | # define RS400_REQ_TYPE_SNOOP_MASK 0x3 | 508 | #define RS480_MC_UMA_DUALCH_CNTL 0x86 |
509 | # define RS400_REQ_TYPE_SNOOP_DIS (1 << 24) | ||
510 | #define RS400_MC_MISC_UMA_CNTL 0x5f | ||
511 | #define RS400_MC_MCLK_CNTL 0x7a | ||
512 | #define RS400_MC_UMA_DUALCH_CNTL 0x86 | ||
513 | 509 | ||
514 | #define RS690_MC_FB_LOCATION 0x100 | 510 | #define RS690_MC_FB_LOCATION 0x100 |
515 | #define RS690_MC_AGP_LOCATION 0x101 | 511 | #define RS690_MC_AGP_LOCATION 0x101 |
@@ -529,8 +525,8 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, | |||
529 | #define RADEON_MPP_TB_CONFIG 0x01c0 | 525 | #define RADEON_MPP_TB_CONFIG 0x01c0 |
530 | #define RADEON_MEM_CNTL 0x0140 | 526 | #define RADEON_MEM_CNTL 0x0140 |
531 | #define RADEON_MEM_SDRAM_MODE_REG 0x0158 | 527 | #define RADEON_MEM_SDRAM_MODE_REG 0x0158 |
532 | #define RADEON_AGP_BASE_2 0x015c | 528 | #define RADEON_AGP_BASE_2 0x015c /* r200+ only */ |
533 | #define RS400_AGP_BASE_2 0x0164 | 529 | #define RS480_AGP_BASE_2 0x0164 |
534 | #define RADEON_AGP_BASE 0x0170 | 530 | #define RADEON_AGP_BASE 0x0170 |
535 | 531 | ||
536 | #define RADEON_RB3D_COLOROFFSET 0x1c40 | 532 | #define RADEON_RB3D_COLOROFFSET 0x1c40 |
@@ -1105,14 +1101,6 @@ do { \ | |||
1105 | RADEON_WRITE(RADEON_CLOCK_CNTL_DATA, (val)); \ | 1101 | RADEON_WRITE(RADEON_CLOCK_CNTL_DATA, (val)); \ |
1106 | } while (0) | 1102 | } while (0) |
1107 | 1103 | ||
1108 | #define RADEON_WRITE_IGPGART(addr, val) \ | ||
1109 | do { \ | ||
1110 | RADEON_WRITE(RS400_NB_MC_INDEX, \ | ||
1111 | ((addr) & 0x7f) | RS400_NB_MC_IND_WR_EN); \ | ||
1112 | RADEON_WRITE(RS400_NB_MC_DATA, (val)); \ | ||
1113 | RADEON_WRITE(RS400_NB_MC_INDEX, 0x7f); \ | ||
1114 | } while (0) | ||
1115 | |||
1116 | #define RADEON_WRITE_PCIE(addr, val) \ | 1104 | #define RADEON_WRITE_PCIE(addr, val) \ |
1117 | do { \ | 1105 | do { \ |
1118 | RADEON_WRITE8(RADEON_PCIE_INDEX, \ | 1106 | RADEON_WRITE8(RADEON_PCIE_INDEX, \ |
@@ -1120,12 +1108,20 @@ do { \ | |||
1120 | RADEON_WRITE(RADEON_PCIE_DATA, (val)); \ | 1108 | RADEON_WRITE(RADEON_PCIE_DATA, (val)); \ |
1121 | } while (0) | 1109 | } while (0) |
1122 | 1110 | ||
1123 | #define RADEON_WRITE_MCIND(addr, val) \ | 1111 | #define R500_WRITE_MCIND(addr, val) \ |
1124 | do { \ | 1112 | do { \ |
1125 | RADEON_WRITE(R520_MC_IND_INDEX, 0xff0000 | ((addr) & 0xff)); \ | 1113 | RADEON_WRITE(R520_MC_IND_INDEX, 0xff0000 | ((addr) & 0xff)); \ |
1126 | RADEON_WRITE(R520_MC_IND_DATA, (val)); \ | 1114 | RADEON_WRITE(R520_MC_IND_DATA, (val)); \ |
1127 | RADEON_WRITE(R520_MC_IND_INDEX, 0); \ | 1115 | RADEON_WRITE(R520_MC_IND_INDEX, 0); \ |
1128 | } while (0) | 1116 | } while (0) |
1117 | |||
1118 | #define RS480_WRITE_MCIND(addr, val) \ | ||
1119 | do { \ | ||
1120 | RADEON_WRITE(RS480_NB_MC_INDEX, \ | ||
1121 | ((addr) & 0xff) | RS480_NB_MC_IND_WR_EN); \ | ||
1122 | RADEON_WRITE(RS480_NB_MC_DATA, (val)); \ | ||
1123 | RADEON_WRITE(RS480_NB_MC_INDEX, 0xff); \ | ||
1124 | } while (0) | ||
1129 | 1125 | ||
1130 | #define RS690_WRITE_MCIND(addr, val) \ | 1126 | #define RS690_WRITE_MCIND(addr, val) \ |
1131 | do { \ | 1127 | do { \ |
@@ -1134,6 +1130,14 @@ do { \ | |||
1134 | RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK); \ | 1130 | RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK); \ |
1135 | } while (0) | 1131 | } while (0) |
1136 | 1132 | ||
1133 | #define IGP_WRITE_MCIND(addr, val) \ | ||
1134 | do { \ | ||
1135 | if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) \ | ||
1136 | RS690_WRITE_MCIND(addr, val); \ | ||
1137 | else \ | ||
1138 | RS480_WRITE_MCIND(addr, val); \ | ||
1139 | } while (0) | ||
1140 | |||
1137 | #define CP_PACKET0( reg, n ) \ | 1141 | #define CP_PACKET0( reg, n ) \ |
1138 | (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) | 1142 | (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) |
1139 | #define CP_PACKET0_TABLE( reg, n ) \ | 1143 | #define CP_PACKET0_TABLE( reg, n ) \ |