diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-03-20 17:18:17 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-03-21 02:55:53 -0400 |
commit | 0f0de06c809eac783ddb4ddfc52c9db43af94b4f (patch) | |
tree | 8eeb7b803fa69a0f58d1c1bac1dbbb29b614ded1 /drivers/gpu | |
parent | 1b5475dba7b19cace11c3f466ff7b7a58c23aab0 (diff) |
drm/radeon/kms: add ucode loading for SI
Currently the driver required 5 sets of ucode:
1. pfp - pre-fetch parser, part of the CP
2. me - micro engine, part of the CP
3. ce - constant engine, part of the CP
4. rlc - interrupt controller
5. mc - memory controller
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/si.c | 155 |
2 files changed, 156 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index f467fe5edf09..f1c2f58e5724 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1527,6 +1527,7 @@ struct radeon_device { | |||
1527 | const struct firmware *pfp_fw; /* r6/700 PFP firmware */ | 1527 | const struct firmware *pfp_fw; /* r6/700 PFP firmware */ |
1528 | const struct firmware *rlc_fw; /* r6/700 RLC firmware */ | 1528 | const struct firmware *rlc_fw; /* r6/700 RLC firmware */ |
1529 | const struct firmware *mc_fw; /* NI MC firmware */ | 1529 | const struct firmware *mc_fw; /* NI MC firmware */ |
1530 | const struct firmware *ce_fw; /* SI CE firmware */ | ||
1530 | struct r600_blit r600_blit; | 1531 | struct r600_blit r600_blit; |
1531 | struct r600_vram_scratch vram_scratch; | 1532 | struct r600_vram_scratch vram_scratch; |
1532 | int msi_enabled; /* msi enabled */ | 1533 | int msi_enabled; /* msi enabled */ |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 30b379e3f3f5..0938c21e792d 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -21,6 +21,10 @@ | |||
21 | * | 21 | * |
22 | * Authors: Alex Deucher | 22 | * Authors: Alex Deucher |
23 | */ | 23 | */ |
24 | #include <linux/firmware.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/module.h> | ||
24 | #include "drmP.h" | 28 | #include "drmP.h" |
25 | #include "radeon.h" | 29 | #include "radeon.h" |
26 | #include "radeon_asic.h" | 30 | #include "radeon_asic.h" |
@@ -28,6 +32,28 @@ | |||
28 | #include "sid.h" | 32 | #include "sid.h" |
29 | #include "atom.h" | 33 | #include "atom.h" |
30 | 34 | ||
35 | #define SI_PFP_UCODE_SIZE 2144 | ||
36 | #define SI_PM4_UCODE_SIZE 2144 | ||
37 | #define SI_CE_UCODE_SIZE 2144 | ||
38 | #define SI_RLC_UCODE_SIZE 2048 | ||
39 | #define SI_MC_UCODE_SIZE 7769 | ||
40 | |||
41 | MODULE_FIRMWARE("radeon/TAHITI_pfp.bin"); | ||
42 | MODULE_FIRMWARE("radeon/TAHITI_me.bin"); | ||
43 | MODULE_FIRMWARE("radeon/TAHITI_ce.bin"); | ||
44 | MODULE_FIRMWARE("radeon/TAHITI_mc.bin"); | ||
45 | MODULE_FIRMWARE("radeon/TAHITI_rlc.bin"); | ||
46 | MODULE_FIRMWARE("radeon/PITCAIRN_pfp.bin"); | ||
47 | MODULE_FIRMWARE("radeon/PITCAIRN_me.bin"); | ||
48 | MODULE_FIRMWARE("radeon/PITCAIRN_ce.bin"); | ||
49 | MODULE_FIRMWARE("radeon/PITCAIRN_mc.bin"); | ||
50 | MODULE_FIRMWARE("radeon/PITCAIRN_rlc.bin"); | ||
51 | MODULE_FIRMWARE("radeon/VERDE_pfp.bin"); | ||
52 | MODULE_FIRMWARE("radeon/VERDE_me.bin"); | ||
53 | MODULE_FIRMWARE("radeon/VERDE_ce.bin"); | ||
54 | MODULE_FIRMWARE("radeon/VERDE_mc.bin"); | ||
55 | MODULE_FIRMWARE("radeon/VERDE_rlc.bin"); | ||
56 | |||
31 | extern void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev); | 57 | extern void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev); |
32 | extern void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *save); | 58 | extern void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *save); |
33 | extern void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *save); | 59 | extern void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *save); |
@@ -51,6 +77,135 @@ int si_get_temp(struct radeon_device *rdev) | |||
51 | return actual_temp; | 77 | return actual_temp; |
52 | } | 78 | } |
53 | 79 | ||
80 | static int si_init_microcode(struct radeon_device *rdev) | ||
81 | { | ||
82 | struct platform_device *pdev; | ||
83 | const char *chip_name; | ||
84 | const char *rlc_chip_name; | ||
85 | size_t pfp_req_size, me_req_size, ce_req_size, rlc_req_size, mc_req_size; | ||
86 | char fw_name[30]; | ||
87 | int err; | ||
88 | |||
89 | DRM_DEBUG("\n"); | ||
90 | |||
91 | pdev = platform_device_register_simple("radeon_cp", 0, NULL, 0); | ||
92 | err = IS_ERR(pdev); | ||
93 | if (err) { | ||
94 | printk(KERN_ERR "radeon_cp: Failed to register firmware\n"); | ||
95 | return -EINVAL; | ||
96 | } | ||
97 | |||
98 | switch (rdev->family) { | ||
99 | case CHIP_TAHITI: | ||
100 | chip_name = "TAHITI"; | ||
101 | rlc_chip_name = "TAHITI"; | ||
102 | pfp_req_size = SI_PFP_UCODE_SIZE * 4; | ||
103 | me_req_size = SI_PM4_UCODE_SIZE * 4; | ||
104 | ce_req_size = SI_CE_UCODE_SIZE * 4; | ||
105 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; | ||
106 | mc_req_size = SI_MC_UCODE_SIZE * 4; | ||
107 | break; | ||
108 | case CHIP_PITCAIRN: | ||
109 | chip_name = "PITCAIRN"; | ||
110 | rlc_chip_name = "PITCAIRN"; | ||
111 | pfp_req_size = SI_PFP_UCODE_SIZE * 4; | ||
112 | me_req_size = SI_PM4_UCODE_SIZE * 4; | ||
113 | ce_req_size = SI_CE_UCODE_SIZE * 4; | ||
114 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; | ||
115 | mc_req_size = SI_MC_UCODE_SIZE * 4; | ||
116 | break; | ||
117 | case CHIP_VERDE: | ||
118 | chip_name = "VERDE"; | ||
119 | rlc_chip_name = "VERDE"; | ||
120 | pfp_req_size = SI_PFP_UCODE_SIZE * 4; | ||
121 | me_req_size = SI_PM4_UCODE_SIZE * 4; | ||
122 | ce_req_size = SI_CE_UCODE_SIZE * 4; | ||
123 | rlc_req_size = SI_RLC_UCODE_SIZE * 4; | ||
124 | mc_req_size = SI_MC_UCODE_SIZE * 4; | ||
125 | break; | ||
126 | default: BUG(); | ||
127 | } | ||
128 | |||
129 | DRM_INFO("Loading %s Microcode\n", chip_name); | ||
130 | |||
131 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_pfp.bin", chip_name); | ||
132 | err = request_firmware(&rdev->pfp_fw, fw_name, &pdev->dev); | ||
133 | if (err) | ||
134 | goto out; | ||
135 | if (rdev->pfp_fw->size != pfp_req_size) { | ||
136 | printk(KERN_ERR | ||
137 | "si_cp: Bogus length %zu in firmware \"%s\"\n", | ||
138 | rdev->pfp_fw->size, fw_name); | ||
139 | err = -EINVAL; | ||
140 | goto out; | ||
141 | } | ||
142 | |||
143 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_me.bin", chip_name); | ||
144 | err = request_firmware(&rdev->me_fw, fw_name, &pdev->dev); | ||
145 | if (err) | ||
146 | goto out; | ||
147 | if (rdev->me_fw->size != me_req_size) { | ||
148 | printk(KERN_ERR | ||
149 | "si_cp: Bogus length %zu in firmware \"%s\"\n", | ||
150 | rdev->me_fw->size, fw_name); | ||
151 | err = -EINVAL; | ||
152 | } | ||
153 | |||
154 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_ce.bin", chip_name); | ||
155 | err = request_firmware(&rdev->ce_fw, fw_name, &pdev->dev); | ||
156 | if (err) | ||
157 | goto out; | ||
158 | if (rdev->ce_fw->size != ce_req_size) { | ||
159 | printk(KERN_ERR | ||
160 | "si_cp: Bogus length %zu in firmware \"%s\"\n", | ||
161 | rdev->ce_fw->size, fw_name); | ||
162 | err = -EINVAL; | ||
163 | } | ||
164 | |||
165 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_rlc.bin", rlc_chip_name); | ||
166 | err = request_firmware(&rdev->rlc_fw, fw_name, &pdev->dev); | ||
167 | if (err) | ||
168 | goto out; | ||
169 | if (rdev->rlc_fw->size != rlc_req_size) { | ||
170 | printk(KERN_ERR | ||
171 | "si_rlc: Bogus length %zu in firmware \"%s\"\n", | ||
172 | rdev->rlc_fw->size, fw_name); | ||
173 | err = -EINVAL; | ||
174 | } | ||
175 | |||
176 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_mc.bin", chip_name); | ||
177 | err = request_firmware(&rdev->mc_fw, fw_name, &pdev->dev); | ||
178 | if (err) | ||
179 | goto out; | ||
180 | if (rdev->mc_fw->size != mc_req_size) { | ||
181 | printk(KERN_ERR | ||
182 | "si_mc: Bogus length %zu in firmware \"%s\"\n", | ||
183 | rdev->mc_fw->size, fw_name); | ||
184 | err = -EINVAL; | ||
185 | } | ||
186 | |||
187 | out: | ||
188 | platform_device_unregister(pdev); | ||
189 | |||
190 | if (err) { | ||
191 | if (err != -EINVAL) | ||
192 | printk(KERN_ERR | ||
193 | "si_cp: Failed to load firmware \"%s\"\n", | ||
194 | fw_name); | ||
195 | release_firmware(rdev->pfp_fw); | ||
196 | rdev->pfp_fw = NULL; | ||
197 | release_firmware(rdev->me_fw); | ||
198 | rdev->me_fw = NULL; | ||
199 | release_firmware(rdev->ce_fw); | ||
200 | rdev->ce_fw = NULL; | ||
201 | release_firmware(rdev->rlc_fw); | ||
202 | rdev->rlc_fw = NULL; | ||
203 | release_firmware(rdev->mc_fw); | ||
204 | rdev->mc_fw = NULL; | ||
205 | } | ||
206 | return err; | ||
207 | } | ||
208 | |||
54 | /* watermark setup */ | 209 | /* watermark setup */ |
55 | static u32 dce6_line_buffer_adjust(struct radeon_device *rdev, | 210 | static u32 dce6_line_buffer_adjust(struct radeon_device *rdev, |
56 | struct radeon_crtc *radeon_crtc, | 211 | struct radeon_crtc *radeon_crtc, |