aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/slicoss
diff options
context:
space:
mode:
authorLior Dotan <liodot@gmail.com>2009-01-22 02:38:15 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-03 17:53:04 -0400
commit874073ea293dab27c5f3398dced66eb7912bf477 (patch)
tree2a5fd8762b9c75828dc6f639ab03ba996f24082e /drivers/staging/slicoss
parent20bec8ab1458c24bed0d5492ee15d87807fc415a (diff)
Staging: slicoss: use request_firmware
This patch uses request_firmware() to download the firmware to the card. Signed-off-by: Lior Dotan <liodot@gmail.com> Cc: Christopher Harrer <charrer@alacritech.com>
Diffstat (limited to 'drivers/staging/slicoss')
-rw-r--r--drivers/staging/slicoss/slic.h20
-rw-r--r--drivers/staging/slicoss/slicoss.c170
2 files changed, 58 insertions, 132 deletions
diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index a8ea59d7ea1..e8d388d3979 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -46,30 +46,10 @@
46#define OASIS_UCODE_VERS_DATE "2006/03/27 15:10:37" 46#define OASIS_UCODE_VERS_DATE "2006/03/27 15:10:37"
47#define OASIS_UCODE_HOSTIF_ID 3 47#define OASIS_UCODE_HOSTIF_ID 3
48 48
49static s32 ONumSections = 0x2;
50static u32 OSectionSize[] = {
51 0x00004000, 0x00010000,
52};
53
54static u32 OSectionStart[] = {
55 0x00000000, 0x00008000,
56};
57
58#define MOJAVE_UCODE_VERS_STRING "1.2" 49#define MOJAVE_UCODE_VERS_STRING "1.2"
59#define MOJAVE_UCODE_VERS_DATE "2006/03/27 15:12:22" 50#define MOJAVE_UCODE_VERS_DATE "2006/03/27 15:12:22"
60#define MOJAVE_UCODE_HOSTIF_ID 3 51#define MOJAVE_UCODE_HOSTIF_ID 3
61 52
62static s32 MNumSections = 0x2;
63static u32 MSectionSize[] =
64{
65 0x00008000, 0x00010000,
66};
67
68static u32 MSectionStart[] =
69{
70 0x00000000, 0x00008000,
71};
72
73#define GB_RCVUCODE_VERS_STRING "1.2" 53#define GB_RCVUCODE_VERS_STRING "1.2"
74#define GB_RCVUCODE_VERS_DATE "2006/03/27 15:12:15" 54#define GB_RCVUCODE_VERS_DATE "2006/03/27 15:12:15"
75static u32 OasisRcvUCodeLen = 512; 55static u32 OasisRcvUCodeLen = 512;
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index bf7da8f898a..7cdf2fadb2d 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2183,15 +2183,16 @@ static int slic_card_download_gbrcv(struct adapter *adapter)
2183 int ret; 2183 int ret;
2184 __iomem struct slic_regs *slic_regs = adapter->slic_regs; 2184 __iomem struct slic_regs *slic_regs = adapter->slic_regs;
2185 u32 codeaddr; 2185 u32 codeaddr;
2186 unsigned char *instruction = NULL; 2186 u32 instruction;
2187 int index = 0;
2187 u32 rcvucodelen = 0; 2188 u32 rcvucodelen = 0;
2188 2189
2189 switch (adapter->devid) { 2190 switch (adapter->devid) {
2190 case SLIC_2GB_DEVICE_ID: 2191 case SLIC_2GB_DEVICE_ID:
2191 file = "oasis_rcv.bin"; 2192 file = "oasisrcvucode.sys";
2192 break; 2193 break;
2193 case SLIC_1GB_DEVICE_ID: 2194 case SLIC_1GB_DEVICE_ID:
2194 file = "gb_rcv.bin"; 2195 file = "gbrcvucode.sys";
2195 break; 2196 break;
2196 default: 2197 default:
2197 ASSERT(0); 2198 ASSERT(0);
@@ -2204,8 +2205,8 @@ static int slic_card_download_gbrcv(struct adapter *adapter)
2204 return ret; 2205 return ret;
2205 } 2206 }
2206 2207
2207 instruction = (unsigned char *)fw->data; 2208 rcvucodelen = *(u32 *)(fw->data + index);
2208 rcvucodelen = fw->size; 2209 index += 4;
2209 switch (adapter->devid) { 2210 switch (adapter->devid) {
2210 case SLIC_2GB_DEVICE_ID: 2211 case SLIC_2GB_DEVICE_ID:
2211 if (rcvucodelen != OasisRcvUCodeLen) 2212 if (rcvucodelen != OasisRcvUCodeLen)
@@ -2219,24 +2220,24 @@ static int slic_card_download_gbrcv(struct adapter *adapter)
2219 ASSERT(0); 2220 ASSERT(0);
2220 break; 2221 break;
2221 } 2222 }
2222
2223 /* start download */ 2223 /* start download */
2224 WRITE_REG(slic_regs->slic_rcv_wcs, SLIC_RCVWCS_BEGIN, FLUSH); 2224 WRITE_REG(slic_regs->slic_rcv_wcs, SLIC_RCVWCS_BEGIN, FLUSH);
2225
2226 /* download the rcv sequencer ucode */ 2225 /* download the rcv sequencer ucode */
2227 for (codeaddr = 0; codeaddr < rcvucodelen; codeaddr++) { 2226 for (codeaddr = 0; codeaddr < rcvucodelen; codeaddr++) {
2228 /* write out instruction address */ 2227 /* write out instruction address */
2229 WRITE_REG(slic_regs->slic_rcv_wcs, codeaddr, FLUSH); 2228 WRITE_REG(slic_regs->slic_rcv_wcs, codeaddr, FLUSH);
2230 2229
2230 instruction = *(u32 *)(fw->data + index);
2231 index += 4;
2231 /* write out the instruction data low addr */ 2232 /* write out the instruction data low addr */
2232 WRITE_REG(slic_regs->slic_rcv_wcs, 2233 WRITE_REG(slic_regs->slic_rcv_wcs,
2233 (u32) *(u32 *) instruction, FLUSH); 2234 instruction, FLUSH);
2234 instruction += 4;
2235 2235
2236 instruction = *(u8 *)(fw->data + index);
2237 index++;
2236 /* write out the instruction data high addr */ 2238 /* write out the instruction data high addr */
2237 WRITE_REG(slic_regs->slic_rcv_wcs, (u32) *instruction, 2239 WRITE_REG(slic_regs->slic_rcv_wcs, (u8)instruction,
2238 FLUSH); 2240 FLUSH);
2239 instruction += 1;
2240 } 2241 }
2241 2242
2242 /* download finished */ 2243 /* download finished */
@@ -2254,16 +2255,14 @@ static int slic_card_download(struct adapter *adapter)
2254 int thissectionsize; 2255 int thissectionsize;
2255 int codeaddr; 2256 int codeaddr;
2256 __iomem struct slic_regs *slic_regs = adapter->slic_regs; 2257 __iomem struct slic_regs *slic_regs = adapter->slic_regs;
2257 u32 *instruction = NULL; 2258 u32 instruction;
2258 u32 *lastinstruct = NULL;
2259 u32 *startinstruct = NULL;
2260 unsigned char *nextinstruct;
2261 u32 baseaddress; 2259 u32 baseaddress;
2262 u32 failure; 2260 u32 failure;
2263 u32 i; 2261 u32 i;
2264 u32 numsects = 0; 2262 u32 numsects = 0;
2265 u32 sectsize[3]; 2263 u32 sectsize[3];
2266 u32 sectstart[3]; 2264 u32 sectstart[3];
2265 int ucode_start, index = 0;
2267 2266
2268/* DBG_MSG ("slicoss: %s (%s) adapter[%p] card[%p] devid[%x] \ 2267/* DBG_MSG ("slicoss: %s (%s) adapter[%p] card[%p] devid[%x] \
2269 jiffies[%lx] cpu %d\n", __func__, adapter->netdev->name, adapter, 2268 jiffies[%lx] cpu %d\n", __func__, adapter->netdev->name, adapter,
@@ -2271,24 +2270,10 @@ static int slic_card_download(struct adapter *adapter)
2271 2270
2272 switch (adapter->devid) { 2271 switch (adapter->devid) {
2273 case SLIC_2GB_DEVICE_ID: 2272 case SLIC_2GB_DEVICE_ID:
2274/* DBG_MSG ("slicoss: %s devid==SLIC_2GB_DEVICE_ID sections[%x]\n", 2273 file = "oasisdownload.sys";
2275 __func__, (uint) ONumSections); */
2276 file = "slic_oasis.bin";
2277 numsects = ONumSections;
2278 for (i = 0; i < numsects; i++) {
2279 sectsize[i] = OSectionSize[i];
2280 sectstart[i] = OSectionStart[i];
2281 }
2282 break; 2274 break;
2283 case SLIC_1GB_DEVICE_ID: 2275 case SLIC_1GB_DEVICE_ID:
2284/* DBG_MSG ("slicoss: %s devid==SLIC_1GB_DEVICE_ID sections[%x]\n", 2276 file = "gbdownload.sys";
2285 __func__, (uint) MNumSections); */
2286 file = "slic_mojave.bin";
2287 numsects = MNumSections;
2288 for (i = 0; i < numsects; i++) {
2289 sectsize[i] = MSectionSize[i];
2290 sectstart[i] = MSectionStart[i];
2291 }
2292 break; 2277 break;
2293 default: 2278 default:
2294 ASSERT(0); 2279 ASSERT(0);
@@ -2299,75 +2284,42 @@ static int slic_card_download(struct adapter *adapter)
2299 printk(KERN_ERR "SLICOSS: Failed to load firmware %s\n", file); 2284 printk(KERN_ERR "SLICOSS: Failed to load firmware %s\n", file);
2300 return ret; 2285 return ret;
2301 } 2286 }
2302 2287 numsects = *(u32 *)(fw->data + index);
2288 index += 4;
2303 ASSERT(numsects <= 3); 2289 ASSERT(numsects <= 3);
2304 2290 for (i = 0; i < numsects; i++) {
2291 sectsize[i] = *(u32 *)(fw->data + index);
2292 index += 4;
2293 }
2294 for (i = 0; i < numsects; i++) {
2295 sectstart[i] = *(u32 *)(fw->data + index);
2296 index += 4;
2297 }
2298 ucode_start = index;
2299 instruction = *(u32 *)(fw->data + index);
2300 index += 4;
2305 for (section = 0; section < numsects; section++) { 2301 for (section = 0; section < numsects; section++) {
2306 switch (adapter->devid) {
2307 case SLIC_2GB_DEVICE_ID:
2308 instruction = (u32 *)(fw->data + (SECTION_SIZE *
2309 section));
2310 baseaddress = sectstart[section];
2311 thissectionsize = sectsize[section] >> 3;
2312 lastinstruct =
2313 (u32 *)(fw->data + (SECTION_SIZE * section) +
2314 sectsize[section] - 8);
2315 break;
2316 case SLIC_1GB_DEVICE_ID:
2317 instruction = (u32 *)(fw->data + (SECTION_SIZE *
2318 section));
2319 baseaddress = sectstart[section];
2320 thissectionsize = sectsize[section] >> 3;
2321 lastinstruct =
2322 (u32 *)(fw->data + (SECTION_SIZE * section) +
2323 sectsize[section] - 8);
2324 break;
2325 default:
2326 ASSERT(0);
2327 break;
2328 }
2329
2330 baseaddress = sectstart[section]; 2302 baseaddress = sectstart[section];
2331 thissectionsize = sectsize[section] >> 3; 2303 thissectionsize = sectsize[section] >> 3;
2332 2304
2333 for (codeaddr = 0; codeaddr < thissectionsize; codeaddr++) { 2305 for (codeaddr = 0; codeaddr < thissectionsize; codeaddr++) {
2334 startinstruct = instruction;
2335 nextinstruct = ((unsigned char *)instruction) + 8;
2336 /* Write out instruction address */ 2306 /* Write out instruction address */
2337 WRITE_REG(slic_regs->slic_wcs, baseaddress + codeaddr, 2307 WRITE_REG(slic_regs->slic_wcs, baseaddress + codeaddr,
2338 FLUSH); 2308 FLUSH);
2339 /* Write out instruction to low addr */ 2309 /* Write out instruction to low addr */
2340 WRITE_REG(slic_regs->slic_wcs, *instruction, FLUSH); 2310 WRITE_REG(slic_regs->slic_wcs, instruction, FLUSH);
2341#ifdef CONFIG_X86_64 2311 instruction = *(u32 *)(fw->data + index);
2342 instruction = (u32 *)((unsigned char *)instruction + 4); 2312 index += 4;
2343#else 2313
2344 instruction++;
2345#endif
2346 /* Write out instruction to high addr */ 2314 /* Write out instruction to high addr */
2347 WRITE_REG(slic_regs->slic_wcs, *instruction, FLUSH); 2315 WRITE_REG(slic_regs->slic_wcs, instruction, FLUSH);
2348#ifdef CONFIG_X86_64 2316 instruction = *(u32 *)(fw->data + index);
2349 instruction = (u32 *)((unsigned char *)instruction + 4); 2317 index += 4;
2350#else
2351 instruction++;
2352#endif
2353 } 2318 }
2354 } 2319 }
2355 2320 index = ucode_start;
2356 for (section = 0; section < numsects; section++) { 2321 for (section = 0; section < numsects; section++) {
2357 switch (adapter->devid) { 2322 instruction = *(u32 *)(fw->data + index);
2358 case SLIC_2GB_DEVICE_ID:
2359 instruction = (u32 *)fw->data + (SECTION_SIZE *
2360 section);
2361 break;
2362 case SLIC_1GB_DEVICE_ID:
2363 instruction = (u32 *)fw->data + (SECTION_SIZE *
2364 section);
2365 break;
2366 default:
2367 ASSERT(0);
2368 break;
2369 }
2370
2371 baseaddress = sectstart[section]; 2323 baseaddress = sectstart[section];
2372 if (baseaddress < 0x8000) 2324 if (baseaddress < 0x8000)
2373 continue; 2325 continue;
@@ -2375,37 +2327,31 @@ static int slic_card_download(struct adapter *adapter)
2375 2327
2376/* DBG_MSG ("slicoss: COMPARE secton[%x] baseaddr[%x] sectnsize[%x]\n", 2328/* DBG_MSG ("slicoss: COMPARE secton[%x] baseaddr[%x] sectnsize[%x]\n",
2377 (uint)section,baseaddress,thissectionsize);*/ 2329 (uint)section,baseaddress,thissectionsize);*/
2378
2379 for (codeaddr = 0; codeaddr < thissectionsize; codeaddr++) { 2330 for (codeaddr = 0; codeaddr < thissectionsize; codeaddr++) {
2380 /* Write out instruction address */ 2331 /* Write out instruction address */
2381 WRITE_REG(slic_regs->slic_wcs, 2332 WRITE_REG(slic_regs->slic_wcs,
2382 SLIC_WCS_COMPARE | (baseaddress + codeaddr), 2333 SLIC_WCS_COMPARE | (baseaddress + codeaddr),
2383 FLUSH); 2334 FLUSH);
2384 /* Write out instruction to low addr */ 2335 /* Write out instruction to low addr */
2385 WRITE_REG(slic_regs->slic_wcs, *instruction, FLUSH); 2336 WRITE_REG(slic_regs->slic_wcs, instruction, FLUSH);
2386#ifdef CONFIG_X86_64 2337 instruction = *(u32 *)(fw->data + index);
2387 instruction = (u32 *)((unsigned char *)instruction + 4); 2338 index += 4;
2388#else
2389 instruction++;
2390#endif
2391 /* Write out instruction to high addr */ 2339 /* Write out instruction to high addr */
2392 WRITE_REG(slic_regs->slic_wcs, *instruction, FLUSH); 2340 WRITE_REG(slic_regs->slic_wcs, instruction, FLUSH);
2393#ifdef CONFIG_X86_64 2341 instruction = *(u32 *)(fw->data + index);
2394 instruction = (u32 *)((unsigned char *)instruction + 4); 2342 index += 4;
2395#else 2343
2396 instruction++;
2397#endif
2398 /* Check SRAM location zero. If it is non-zero. Abort.*/ 2344 /* Check SRAM location zero. If it is non-zero. Abort.*/
2399 failure = readl((u32 __iomem *)&slic_regs->slic_reset); 2345/* failure = readl((u32 __iomem *)&slic_regs->slic_reset);
2400 if (failure) { 2346 if (failure) {
2401 DBG_MSG 2347 DBG_MSG
2402 ("slicoss: %s FAILURE EXIT codeaddr[%x] \ 2348 ("slicoss: %s FAILURE EXIT codeaddr[%x] "
2403 thissectionsize[%x] failure[%x]\n", 2349 "thissectionsize[%x] failure[%x]\n",
2404 __func__, codeaddr, thissectionsize, 2350 __func__, codeaddr, thissectionsize,
2405 failure); 2351 failure);
2406 release_firmware(fw); 2352 release_firmware(fw);
2407 return -EIO; 2353 return -EIO;
2408 } 2354 }*/
2409 } 2355 }
2410 } 2356 }
2411/* DBG_MSG ("slicoss: Compare done\n");*/ 2357/* DBG_MSG ("slicoss: Compare done\n");*/
@@ -2570,8 +2516,8 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
2570 i++; 2516 i++;
2571 if (i > 5000) { 2517 if (i > 5000) {
2572 DBG_ERROR 2518 DBG_ERROR
2573 ("SLIC: %d config data fetch timed\ 2519 ("SLIC: %d config data fetch timed "
2574 out!\n", adapter->port); 2520 "out!\n", adapter->port);
2575 DBG_MSG("%s shmem[%p] shmem->isr[%x]\n", 2521 DBG_MSG("%s shmem[%p] shmem->isr[%x]\n",
2576 __func__, adapter->pshmem, 2522 __func__, adapter->pshmem,
2577 adapter->pshmem->isr); 2523 adapter->pshmem->isr);
@@ -2792,12 +2738,12 @@ static u32 slic_card_locate(struct adapter *adapter)
2792#if DBG 2738#if DBG
2793 if (adapter->devid == SLIC_2GB_DEVICE_ID) { 2739 if (adapter->devid == SLIC_2GB_DEVICE_ID) {
2794 DBG_MSG 2740 DBG_MSG
2795 ("SLICOSS ==> Initialize 2 Port Gigabit Server \ 2741 ("SLICOSS ==> Initialize 2 Port Gigabit Server "
2796 and Storage Accelerator\n"); 2742 "and Storage Accelerator\n");
2797 } else { 2743 } else {
2798 DBG_MSG 2744 DBG_MSG
2799 ("SLICOSS ==> Initialize 1 Port Gigabit Server \ 2745 ("SLICOSS ==> Initialize 1 Port Gigabit Server "
2800 and Storage Accelerator\n"); 2746 "and Storage Accelerator\n");
2801 } 2747 }
2802#endif 2748#endif
2803 card->busnumber = adapter->busnumber; 2749 card->busnumber = adapter->busnumber;
@@ -2865,8 +2811,8 @@ static u32 slic_card_locate(struct adapter *adapter)
2865 ASSERT(physcard); 2811 ASSERT(physcard);
2866 2812
2867 DBG_MSG 2813 DBG_MSG
2868 ("\n%s Allocate a PHYSICALcard:\n PHYSICAL_Card[%p]\n\ 2814 ("\n%s Allocate a PHYSICALcard:\n PHYSICAL_Card[%p]\n"
2869 LogicalCard [%p]\n adapter [%p]\n", 2815 " LogicalCard [%p]\n adapter [%p]\n",
2870 __func__, physcard, card, adapter); 2816 __func__, physcard, card, adapter);
2871 2817
2872 physcard->next = slic_global.phys_card; 2818 physcard->next = slic_global.phys_card;
@@ -4449,7 +4395,7 @@ static int slic_debug_card_show(struct seq_file *seq, void *v)
4449 unsigned char *oemfru = (unsigned char *)(&card->config.OemFru); 4395 unsigned char *oemfru = (unsigned char *)(&card->config.OemFru);
4450#endif 4396#endif
4451 4397
4452 seq_printf(seq, "driver_version : %s", slic_proc_version); 4398 seq_printf(seq, "driver_version : %s\n", slic_proc_version);
4453 seq_printf(seq, "Microcode versions: \n"); 4399 seq_printf(seq, "Microcode versions: \n");
4454 seq_printf(seq, " Gigabit (gb) : %s %s\n", 4400 seq_printf(seq, " Gigabit (gb) : %s %s\n",
4455 MOJAVE_UCODE_VERS_STRING, MOJAVE_UCODE_VERS_DATE); 4401 MOJAVE_UCODE_VERS_STRING, MOJAVE_UCODE_VERS_DATE);