diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/gdth.c | 558 | ||||
-rw-r--r-- | drivers/scsi/gdth.h | 17 | ||||
-rw-r--r-- | drivers/scsi/gdth_proc.c | 80 | ||||
-rw-r--r-- | drivers/scsi/gdth_proc.h | 20 |
4 files changed, 291 insertions, 384 deletions
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index c4db926a7dd8..c90e407e1e42 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -139,14 +139,15 @@ | |||
139 | static void gdth_delay(int milliseconds); | 139 | static void gdth_delay(int milliseconds); |
140 | static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs); | 140 | static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs); |
141 | static irqreturn_t gdth_interrupt(int irq, void *dev_id); | 141 | static irqreturn_t gdth_interrupt(int irq, void *dev_id); |
142 | static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp); | 142 | static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index, |
143 | static int gdth_async_event(int hanum); | 143 | Scsi_Cmnd *scp); |
144 | static int gdth_async_event(gdth_ha_str *ha); | ||
144 | static void gdth_log_event(gdth_evt_data *dvr, char *buffer); | 145 | static void gdth_log_event(gdth_evt_data *dvr, char *buffer); |
145 | 146 | ||
146 | static void gdth_putq(int hanum,Scsi_Cmnd *scp,unchar priority); | 147 | static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar priority); |
147 | static void gdth_next(int hanum); | 148 | static void gdth_next(gdth_ha_str *ha); |
148 | static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b); | 149 | static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b); |
149 | static int gdth_special_cmd(int hanum,Scsi_Cmnd *scp); | 150 | static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp); |
150 | static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, ushort source, | 151 | static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, ushort source, |
151 | ushort idx, gdth_evt_data *evt); | 152 | ushort idx, gdth_evt_data *evt); |
152 | static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr); | 153 | static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr); |
@@ -154,30 +155,30 @@ static void gdth_readapp_event(gdth_ha_str *ha, unchar application, | |||
154 | gdth_evt_str *estr); | 155 | gdth_evt_str *estr); |
155 | static void gdth_clear_events(void); | 156 | static void gdth_clear_events(void); |
156 | 157 | ||
157 | static void gdth_copy_internal_data(int hanum,Scsi_Cmnd *scp, | 158 | static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp, |
158 | char *buffer,ushort count); | 159 | char *buffer,ushort count); |
159 | static int gdth_internal_cache_cmd(int hanum,Scsi_Cmnd *scp); | 160 | static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp); |
160 | static int gdth_fill_cache_cmd(int hanum,Scsi_Cmnd *scp,ushort hdrive); | 161 | static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive); |
161 | 162 | ||
162 | static void gdth_enable_int(int hanum); | 163 | static void gdth_enable_int(gdth_ha_str *ha); |
163 | static int gdth_get_status(unchar *pIStatus,int irq); | 164 | static int gdth_get_status(unchar *pIStatus,int irq); |
164 | static int gdth_test_busy(int hanum); | 165 | static int gdth_test_busy(gdth_ha_str *ha); |
165 | static int gdth_get_cmd_index(int hanum); | 166 | static int gdth_get_cmd_index(gdth_ha_str *ha); |
166 | static void gdth_release_event(int hanum); | 167 | static void gdth_release_event(gdth_ha_str *ha); |
167 | static int gdth_wait(int hanum,int index,ulong32 time); | 168 | static int gdth_wait(gdth_ha_str *ha, int index,ulong32 time); |
168 | static int gdth_internal_cmd(int hanum,unchar service,ushort opcode,ulong32 p1, | 169 | static int gdth_internal_cmd(gdth_ha_str *ha, unchar service, ushort opcode, |
169 | ulong64 p2,ulong64 p3); | 170 | ulong32 p1, ulong64 p2,ulong64 p3); |
170 | static int gdth_search_drives(int hanum); | 171 | static int gdth_search_drives(gdth_ha_str *ha); |
171 | static int gdth_analyse_hdrive(int hanum, ushort hdrive); | 172 | static int gdth_analyse_hdrive(gdth_ha_str *ha, ushort hdrive); |
172 | 173 | ||
173 | static const char *gdth_ctr_name(int hanum); | 174 | static const char *gdth_ctr_name(gdth_ha_str *ha); |
174 | 175 | ||
175 | static int gdth_open(struct inode *inode, struct file *filep); | 176 | static int gdth_open(struct inode *inode, struct file *filep); |
176 | static int gdth_close(struct inode *inode, struct file *filep); | 177 | static int gdth_close(struct inode *inode, struct file *filep); |
177 | static int gdth_ioctl(struct inode *inode, struct file *filep, | 178 | static int gdth_ioctl(struct inode *inode, struct file *filep, |
178 | unsigned int cmd, unsigned long arg); | 179 | unsigned int cmd, unsigned long arg); |
179 | 180 | ||
180 | static void gdth_flush(int hanum); | 181 | static void gdth_flush(gdth_ha_str *ha); |
181 | static int gdth_halt(struct notifier_block *nb, ulong event, void *buf); | 182 | static int gdth_halt(struct notifier_block *nb, ulong event, void *buf); |
182 | static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)); | 183 | static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)); |
183 | static void gdth_scsi_done(struct scsi_cmnd *scp); | 184 | static void gdth_scsi_done(struct scsi_cmnd *scp); |
@@ -285,10 +286,6 @@ static struct timer_list gdth_timer; | |||
285 | #define GDTOFFSOF(a,b) (size_t)&(((a*)0)->b) | 286 | #define GDTOFFSOF(a,b) (size_t)&(((a*)0)->b) |
286 | #define INDEX_OK(i,t) ((i)<ARRAY_SIZE(t)) | 287 | #define INDEX_OK(i,t) ((i)<ARRAY_SIZE(t)) |
287 | 288 | ||
288 | #define NUMDATA(a) ( (gdth_num_str *)((a)->hostdata)) | ||
289 | #define HADATA(a) (&((gdth_ext_str *)((a)->hostdata))->haext) | ||
290 | #define CMDDATA(a) (&((gdth_ext_str *)((a)->hostdata))->cmdext) | ||
291 | |||
292 | #define BUS_L2P(a,b) ((b)>(a)->virt_bus ? (b-1):(b)) | 289 | #define BUS_L2P(a,b) ((b)>(a)->virt_bus ? (b-1):(b)) |
293 | 290 | ||
294 | #ifdef CONFIG_ISA | 291 | #ifdef CONFIG_ISA |
@@ -1212,16 +1209,14 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha) | |||
1212 | 1209 | ||
1213 | /* controller protocol functions */ | 1210 | /* controller protocol functions */ |
1214 | 1211 | ||
1215 | static void __init gdth_enable_int(int hanum) | 1212 | static void __init gdth_enable_int(gdth_ha_str *ha) |
1216 | { | 1213 | { |
1217 | gdth_ha_str *ha; | ||
1218 | ulong flags; | 1214 | ulong flags; |
1219 | gdt2_dpram_str __iomem *dp2_ptr; | 1215 | gdt2_dpram_str __iomem *dp2_ptr; |
1220 | gdt6_dpram_str __iomem *dp6_ptr; | 1216 | gdt6_dpram_str __iomem *dp6_ptr; |
1221 | gdt6m_dpram_str __iomem *dp6m_ptr; | 1217 | gdt6m_dpram_str __iomem *dp6m_ptr; |
1222 | 1218 | ||
1223 | TRACE(("gdth_enable_int() hanum %d\n",hanum)); | 1219 | TRACE(("gdth_enable_int() hanum %d\n",ha->hanum)); |
1224 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
1225 | spin_lock_irqsave(&ha->smp_lock, flags); | 1220 | spin_lock_irqsave(&ha->smp_lock, flags); |
1226 | 1221 | ||
1227 | if (ha->type == GDT_EISA) { | 1222 | if (ha->type == GDT_EISA) { |
@@ -1261,7 +1256,7 @@ static int gdth_get_status(unchar *pIStatus,int irq) | |||
1261 | 1256 | ||
1262 | *pIStatus = 0; | 1257 | *pIStatus = 0; |
1263 | for (i=0; i<gdth_ctr_count; ++i) { | 1258 | for (i=0; i<gdth_ctr_count; ++i) { |
1264 | ha = HADATA(gdth_ctr_tab[i]); | 1259 | ha = shost_priv(gdth_ctr_tab[i]); |
1265 | if (ha->irq != (unchar)irq) /* check IRQ */ | 1260 | if (ha->irq != (unchar)irq) /* check IRQ */ |
1266 | continue; | 1261 | continue; |
1267 | if (ha->type == GDT_EISA) | 1262 | if (ha->type == GDT_EISA) |
@@ -1285,14 +1280,12 @@ static int gdth_get_status(unchar *pIStatus,int irq) | |||
1285 | } | 1280 | } |
1286 | 1281 | ||
1287 | 1282 | ||
1288 | static int gdth_test_busy(int hanum) | 1283 | static int gdth_test_busy(gdth_ha_str *ha) |
1289 | { | 1284 | { |
1290 | register gdth_ha_str *ha; | ||
1291 | register int gdtsema0 = 0; | 1285 | register int gdtsema0 = 0; |
1292 | 1286 | ||
1293 | TRACE(("gdth_test_busy() hanum %d\n",hanum)); | 1287 | TRACE(("gdth_test_busy() hanum %d\n", ha->hanum)); |
1294 | 1288 | ||
1295 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
1296 | if (ha->type == GDT_EISA) | 1289 | if (ha->type == GDT_EISA) |
1297 | gdtsema0 = (int)inb(ha->bmic + SEMA0REG); | 1290 | gdtsema0 = (int)inb(ha->bmic + SEMA0REG); |
1298 | else if (ha->type == GDT_ISA) | 1291 | else if (ha->type == GDT_ISA) |
@@ -1309,14 +1302,12 @@ static int gdth_test_busy(int hanum) | |||
1309 | } | 1302 | } |
1310 | 1303 | ||
1311 | 1304 | ||
1312 | static int gdth_get_cmd_index(int hanum) | 1305 | static int gdth_get_cmd_index(gdth_ha_str *ha) |
1313 | { | 1306 | { |
1314 | register gdth_ha_str *ha; | ||
1315 | int i; | 1307 | int i; |
1316 | 1308 | ||
1317 | TRACE(("gdth_get_cmd_index() hanum %d\n",hanum)); | 1309 | TRACE(("gdth_get_cmd_index() hanum %d\n", ha->hanum)); |
1318 | 1310 | ||
1319 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
1320 | for (i=0; i<GDTH_MAXCMDS; ++i) { | 1311 | for (i=0; i<GDTH_MAXCMDS; ++i) { |
1321 | if (ha->cmd_tab[i].cmnd == UNUSED_CMND) { | 1312 | if (ha->cmd_tab[i].cmnd == UNUSED_CMND) { |
1322 | ha->cmd_tab[i].cmnd = ha->pccb->RequestBuffer; | 1313 | ha->cmd_tab[i].cmnd = ha->pccb->RequestBuffer; |
@@ -1329,13 +1320,10 @@ static int gdth_get_cmd_index(int hanum) | |||
1329 | } | 1320 | } |
1330 | 1321 | ||
1331 | 1322 | ||
1332 | static void gdth_set_sema0(int hanum) | 1323 | static void gdth_set_sema0(gdth_ha_str *ha) |
1333 | { | 1324 | { |
1334 | register gdth_ha_str *ha; | 1325 | TRACE(("gdth_set_sema0() hanum %d\n", ha->hanum)); |
1335 | |||
1336 | TRACE(("gdth_set_sema0() hanum %d\n",hanum)); | ||
1337 | 1326 | ||
1338 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
1339 | if (ha->type == GDT_EISA) { | 1327 | if (ha->type == GDT_EISA) { |
1340 | outb(1, ha->bmic + SEMA0REG); | 1328 | outb(1, ha->bmic + SEMA0REG); |
1341 | } else if (ha->type == GDT_ISA) { | 1329 | } else if (ha->type == GDT_ISA) { |
@@ -1350,9 +1338,8 @@ static void gdth_set_sema0(int hanum) | |||
1350 | } | 1338 | } |
1351 | 1339 | ||
1352 | 1340 | ||
1353 | static void gdth_copy_command(int hanum) | 1341 | static void gdth_copy_command(gdth_ha_str *ha) |
1354 | { | 1342 | { |
1355 | register gdth_ha_str *ha; | ||
1356 | register gdth_cmd_str *cmd_ptr; | 1343 | register gdth_cmd_str *cmd_ptr; |
1357 | register gdt6m_dpram_str __iomem *dp6m_ptr; | 1344 | register gdt6m_dpram_str __iomem *dp6m_ptr; |
1358 | register gdt6c_dpram_str __iomem *dp6c_ptr; | 1345 | register gdt6c_dpram_str __iomem *dp6c_ptr; |
@@ -1360,9 +1347,8 @@ static void gdth_copy_command(int hanum) | |||
1360 | gdt2_dpram_str __iomem *dp2_ptr; | 1347 | gdt2_dpram_str __iomem *dp2_ptr; |
1361 | ushort cp_count,dp_offset,cmd_no; | 1348 | ushort cp_count,dp_offset,cmd_no; |
1362 | 1349 | ||
1363 | TRACE(("gdth_copy_command() hanum %d\n",hanum)); | 1350 | TRACE(("gdth_copy_command() hanum %d\n", ha->hanum)); |
1364 | 1351 | ||
1365 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
1366 | cp_count = ha->cmd_len; | 1352 | cp_count = ha->cmd_len; |
1367 | dp_offset= ha->cmd_offs_dpmem; | 1353 | dp_offset= ha->cmd_offs_dpmem; |
1368 | cmd_no = ha->cmd_cnt; | 1354 | cmd_no = ha->cmd_cnt; |
@@ -1411,12 +1397,9 @@ static void gdth_copy_command(int hanum) | |||
1411 | } | 1397 | } |
1412 | 1398 | ||
1413 | 1399 | ||
1414 | static void gdth_release_event(int hanum) | 1400 | static void gdth_release_event(gdth_ha_str *ha) |
1415 | { | 1401 | { |
1416 | register gdth_ha_str *ha; | 1402 | TRACE(("gdth_release_event() hanum %d\n", ha->hanum)); |
1417 | |||
1418 | TRACE(("gdth_release_event() hanum %d\n",hanum)); | ||
1419 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
1420 | 1403 | ||
1421 | #ifdef GDTH_STATISTICS | 1404 | #ifdef GDTH_STATISTICS |
1422 | { | 1405 | { |
@@ -1450,46 +1433,41 @@ static void gdth_release_event(int hanum) | |||
1450 | } | 1433 | } |
1451 | } | 1434 | } |
1452 | 1435 | ||
1453 | 1436 | static int gdth_wait(gdth_ha_str *ha, int index, ulong32 time) | |
1454 | static int gdth_wait(int hanum,int index,ulong32 time) | ||
1455 | { | 1437 | { |
1456 | gdth_ha_str *ha; | ||
1457 | int answer_found = FALSE; | 1438 | int answer_found = FALSE; |
1458 | 1439 | ||
1459 | TRACE(("gdth_wait() hanum %d index %d time %d\n",hanum,index,time)); | 1440 | TRACE(("gdth_wait() hanum %d index %d time %d\n", ha->hanum, index, time)); |
1460 | 1441 | ||
1461 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
1462 | if (index == 0) | 1442 | if (index == 0) |
1463 | return 1; /* no wait required */ | 1443 | return 1; /* no wait required */ |
1464 | 1444 | ||
1465 | gdth_from_wait = TRUE; | 1445 | gdth_from_wait = TRUE; |
1466 | do { | 1446 | do { |
1467 | gdth_interrupt((int)ha->irq,ha); | 1447 | gdth_interrupt((int)ha->irq,ha); |
1468 | if (wait_hanum==hanum && wait_index==index) { | 1448 | if (wait_hanum==ha->hanum && wait_index==index) { |
1469 | answer_found = TRUE; | 1449 | answer_found = TRUE; |
1470 | break; | 1450 | break; |
1471 | } | 1451 | } |
1472 | gdth_delay(1); | 1452 | gdth_delay(1); |
1473 | } while (--time); | 1453 | } while (--time); |
1474 | gdth_from_wait = FALSE; | 1454 | gdth_from_wait = FALSE; |
1475 | 1455 | ||
1476 | while (gdth_test_busy(hanum)) | 1456 | while (gdth_test_busy(ha)) |
1477 | gdth_delay(0); | 1457 | gdth_delay(0); |
1478 | 1458 | ||
1479 | return (answer_found); | 1459 | return (answer_found); |
1480 | } | 1460 | } |
1481 | 1461 | ||
1482 | 1462 | ||
1483 | static int gdth_internal_cmd(int hanum,unchar service,ushort opcode,ulong32 p1, | 1463 | static int gdth_internal_cmd(gdth_ha_str *ha, unchar service, ushort opcode, |
1484 | ulong64 p2,ulong64 p3) | 1464 | ulong32 p1, ulong64 p2, ulong64 p3) |
1485 | { | 1465 | { |
1486 | register gdth_ha_str *ha; | ||
1487 | register gdth_cmd_str *cmd_ptr; | 1466 | register gdth_cmd_str *cmd_ptr; |
1488 | int retries,index; | 1467 | int retries,index; |
1489 | 1468 | ||
1490 | TRACE2(("gdth_internal_cmd() service %d opcode %d\n",service,opcode)); | 1469 | TRACE2(("gdth_internal_cmd() service %d opcode %d\n",service,opcode)); |
1491 | 1470 | ||
1492 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
1493 | cmd_ptr = ha->pccb; | 1471 | cmd_ptr = ha->pccb; |
1494 | memset((char*)cmd_ptr,0,sizeof(gdth_cmd_str)); | 1472 | memset((char*)cmd_ptr,0,sizeof(gdth_cmd_str)); |
1495 | 1473 | ||
@@ -1497,11 +1475,11 @@ static int gdth_internal_cmd(int hanum,unchar service,ushort opcode,ulong32 p1, | |||
1497 | for (retries = INIT_RETRIES;;) { | 1475 | for (retries = INIT_RETRIES;;) { |
1498 | cmd_ptr->Service = service; | 1476 | cmd_ptr->Service = service; |
1499 | cmd_ptr->RequestBuffer = INTERNAL_CMND; | 1477 | cmd_ptr->RequestBuffer = INTERNAL_CMND; |
1500 | if (!(index=gdth_get_cmd_index(hanum))) { | 1478 | if (!(index=gdth_get_cmd_index(ha))) { |
1501 | TRACE(("GDT: No free command index found\n")); | 1479 | TRACE(("GDT: No free command index found\n")); |
1502 | return 0; | 1480 | return 0; |
1503 | } | 1481 | } |
1504 | gdth_set_sema0(hanum); | 1482 | gdth_set_sema0(ha); |
1505 | cmd_ptr->OpCode = opcode; | 1483 | cmd_ptr->OpCode = opcode; |
1506 | cmd_ptr->BoardNode = LOCALBOARD; | 1484 | cmd_ptr->BoardNode = LOCALBOARD; |
1507 | if (service == CACHESERVICE) { | 1485 | if (service == CACHESERVICE) { |
@@ -1541,10 +1519,10 @@ static int gdth_internal_cmd(int hanum,unchar service,ushort opcode,ulong32 p1, | |||
1541 | ha->cmd_len = sizeof(gdth_cmd_str); | 1519 | ha->cmd_len = sizeof(gdth_cmd_str); |
1542 | ha->cmd_offs_dpmem = 0; | 1520 | ha->cmd_offs_dpmem = 0; |
1543 | ha->cmd_cnt = 0; | 1521 | ha->cmd_cnt = 0; |
1544 | gdth_copy_command(hanum); | 1522 | gdth_copy_command(ha); |
1545 | gdth_release_event(hanum); | 1523 | gdth_release_event(ha); |
1546 | gdth_delay(20); | 1524 | gdth_delay(20); |
1547 | if (!gdth_wait(hanum,index,INIT_TIMEOUT)) { | 1525 | if (!gdth_wait(ha, index, INIT_TIMEOUT)) { |
1548 | printk("GDT: Initialization error (timeout service %d)\n",service); | 1526 | printk("GDT: Initialization error (timeout service %d)\n",service); |
1549 | return 0; | 1527 | return 0; |
1550 | } | 1528 | } |
@@ -1559,9 +1537,8 @@ static int gdth_internal_cmd(int hanum,unchar service,ushort opcode,ulong32 p1, | |||
1559 | 1537 | ||
1560 | /* search for devices */ | 1538 | /* search for devices */ |
1561 | 1539 | ||
1562 | static int __init gdth_search_drives(int hanum) | 1540 | static int __init gdth_search_drives(gdth_ha_str *ha) |
1563 | { | 1541 | { |
1564 | register gdth_ha_str *ha; | ||
1565 | ushort cdev_cnt, i; | 1542 | ushort cdev_cnt, i; |
1566 | int ok; | 1543 | int ok; |
1567 | ulong32 bus_no, drv_cnt, drv_no, j; | 1544 | ulong32 bus_no, drv_cnt, drv_no, j; |
@@ -1581,22 +1558,21 @@ static int __init gdth_search_drives(int hanum) | |||
1581 | ulong flags; | 1558 | ulong flags; |
1582 | #endif | 1559 | #endif |
1583 | 1560 | ||
1584 | TRACE(("gdth_search_drives() hanum %d\n",hanum)); | 1561 | TRACE(("gdth_search_drives() hanum %d\n", ha->hanum)); |
1585 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
1586 | ok = 0; | 1562 | ok = 0; |
1587 | 1563 | ||
1588 | /* initialize controller services, at first: screen service */ | 1564 | /* initialize controller services, at first: screen service */ |
1589 | ha->screen_feat = 0; | 1565 | ha->screen_feat = 0; |
1590 | if (!force_dma32) { | 1566 | if (!force_dma32) { |
1591 | ok = gdth_internal_cmd(hanum,SCREENSERVICE,GDT_X_INIT_SCR,0,0,0); | 1567 | ok = gdth_internal_cmd(ha, SCREENSERVICE, GDT_X_INIT_SCR, 0, 0, 0); |
1592 | if (ok) | 1568 | if (ok) |
1593 | ha->screen_feat = GDT_64BIT; | 1569 | ha->screen_feat = GDT_64BIT; |
1594 | } | 1570 | } |
1595 | if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC)) | 1571 | if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC)) |
1596 | ok = gdth_internal_cmd(hanum,SCREENSERVICE,GDT_INIT,0,0,0); | 1572 | ok = gdth_internal_cmd(ha, SCREENSERVICE, GDT_INIT, 0, 0, 0); |
1597 | if (!ok) { | 1573 | if (!ok) { |
1598 | printk("GDT-HA %d: Initialization error screen service (code %d)\n", | 1574 | printk("GDT-HA %d: Initialization error screen service (code %d)\n", |
1599 | hanum, ha->status); | 1575 | ha->hanum, ha->status); |
1600 | return 0; | 1576 | return 0; |
1601 | } | 1577 | } |
1602 | TRACE2(("gdth_search_drives(): SCREENSERVICE initialized\n")); | 1578 | TRACE2(("gdth_search_drives(): SCREENSERVICE initialized\n")); |
@@ -1620,25 +1596,26 @@ static int __init gdth_search_drives(int hanum) | |||
1620 | TRACE2(("gdth_search_drives(): RTC: %x/%x/%x\n",*(ulong32 *)&rtc[0], | 1596 | TRACE2(("gdth_search_drives(): RTC: %x/%x/%x\n",*(ulong32 *)&rtc[0], |
1621 | *(ulong32 *)&rtc[4], *(ulong32 *)&rtc[8])); | 1597 | *(ulong32 *)&rtc[4], *(ulong32 *)&rtc[8])); |
1622 | /* 3. send to controller firmware */ | 1598 | /* 3. send to controller firmware */ |
1623 | gdth_internal_cmd(hanum,SCREENSERVICE,GDT_REALTIME, *(ulong32 *)&rtc[0], | 1599 | gdth_internal_cmd(ha, SCREENSERVICE, GDT_REALTIME, *(ulong32 *)&rtc[0], |
1624 | *(ulong32 *)&rtc[4], *(ulong32 *)&rtc[8]); | 1600 | *(ulong32 *)&rtc[4], *(ulong32 *)&rtc[8]); |
1625 | #endif | 1601 | #endif |
1626 | 1602 | ||
1627 | /* unfreeze all IOs */ | 1603 | /* unfreeze all IOs */ |
1628 | gdth_internal_cmd(hanum,CACHESERVICE,GDT_UNFREEZE_IO,0,0,0); | 1604 | gdth_internal_cmd(ha, CACHESERVICE, GDT_UNFREEZE_IO, 0, 0, 0); |
1629 | 1605 | ||
1630 | /* initialize cache service */ | 1606 | /* initialize cache service */ |
1631 | ha->cache_feat = 0; | 1607 | ha->cache_feat = 0; |
1632 | if (!force_dma32) { | 1608 | if (!force_dma32) { |
1633 | ok = gdth_internal_cmd(hanum,CACHESERVICE,GDT_X_INIT_HOST,LINUX_OS,0,0); | 1609 | ok = gdth_internal_cmd(ha, CACHESERVICE, GDT_X_INIT_HOST, LINUX_OS, |
1610 | 0, 0); | ||
1634 | if (ok) | 1611 | if (ok) |
1635 | ha->cache_feat = GDT_64BIT; | 1612 | ha->cache_feat = GDT_64BIT; |
1636 | } | 1613 | } |
1637 | if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC)) | 1614 | if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC)) |
1638 | ok = gdth_internal_cmd(hanum,CACHESERVICE,GDT_INIT,LINUX_OS,0,0); | 1615 | ok = gdth_internal_cmd(ha, CACHESERVICE, GDT_INIT, LINUX_OS, 0, 0); |
1639 | if (!ok) { | 1616 | if (!ok) { |
1640 | printk("GDT-HA %d: Initialization error cache service (code %d)\n", | 1617 | printk("GDT-HA %d: Initialization error cache service (code %d)\n", |
1641 | hanum, ha->status); | 1618 | ha->hanum, ha->status); |
1642 | return 0; | 1619 | return 0; |
1643 | } | 1620 | } |
1644 | TRACE2(("gdth_search_drives(): CACHESERVICE initialized\n")); | 1621 | TRACE2(("gdth_search_drives(): CACHESERVICE initialized\n")); |
@@ -1667,9 +1644,9 @@ static int __init gdth_search_drives(int hanum) | |||
1667 | pmod->cmd_buff_size = 0; | 1644 | pmod->cmd_buff_size = 0; |
1668 | pmod->reserved1 = 0; | 1645 | pmod->reserved1 = 0; |
1669 | pmod->reserved2 = 0; | 1646 | pmod->reserved2 = 0; |
1670 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL,SET_PERF_MODES, | 1647 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, SET_PERF_MODES, |
1671 | INVALID_CHANNEL,sizeof(gdth_perf_modes))) { | 1648 | INVALID_CHANNEL,sizeof(gdth_perf_modes))) { |
1672 | printk("GDT-HA %d: Interrupt coalescing activated\n", hanum); | 1649 | printk("GDT-HA %d: Interrupt coalescing activated\n", ha->hanum); |
1673 | } | 1650 | } |
1674 | } | 1651 | } |
1675 | #endif | 1652 | #endif |
@@ -1681,7 +1658,7 @@ static int __init gdth_search_drives(int hanum) | |||
1681 | iocr->hdr.first_chan = 0; | 1658 | iocr->hdr.first_chan = 0; |
1682 | iocr->hdr.last_chan = MAXBUS-1; | 1659 | iocr->hdr.last_chan = MAXBUS-1; |
1683 | iocr->hdr.list_offset = GDTOFFSOF(gdth_raw_iochan_str, list[0]); | 1660 | iocr->hdr.list_offset = GDTOFFSOF(gdth_raw_iochan_str, list[0]); |
1684 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL,IOCHAN_RAW_DESC, | 1661 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, IOCHAN_RAW_DESC, |
1685 | INVALID_CHANNEL,sizeof(gdth_raw_iochan_str))) { | 1662 | INVALID_CHANNEL,sizeof(gdth_raw_iochan_str))) { |
1686 | TRACE2(("IOCHAN_RAW_DESC supported!\n")); | 1663 | TRACE2(("IOCHAN_RAW_DESC supported!\n")); |
1687 | ha->bus_cnt = iocr->hdr.chan_count; | 1664 | ha->bus_cnt = iocr->hdr.chan_count; |
@@ -1696,13 +1673,13 @@ static int __init gdth_search_drives(int hanum) | |||
1696 | chn = (gdth_getch_str *)ha->pscratch; | 1673 | chn = (gdth_getch_str *)ha->pscratch; |
1697 | for (bus_no = 0; bus_no < MAXBUS; ++bus_no) { | 1674 | for (bus_no = 0; bus_no < MAXBUS; ++bus_no) { |
1698 | chn->channel_no = bus_no; | 1675 | chn->channel_no = bus_no; |
1699 | if (!gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL, | 1676 | if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1700 | SCSI_CHAN_CNT | L_CTRL_PATTERN, | 1677 | SCSI_CHAN_CNT | L_CTRL_PATTERN, |
1701 | IO_CHANNEL | INVALID_CHANNEL, | 1678 | IO_CHANNEL | INVALID_CHANNEL, |
1702 | sizeof(gdth_getch_str))) { | 1679 | sizeof(gdth_getch_str))) { |
1703 | if (bus_no == 0) { | 1680 | if (bus_no == 0) { |
1704 | printk("GDT-HA %d: Error detecting channel count (0x%x)\n", | 1681 | printk("GDT-HA %d: Error detecting channel count (0x%x)\n", |
1705 | hanum, ha->status); | 1682 | ha->hanum, ha->status); |
1706 | return 0; | 1683 | return 0; |
1707 | } | 1684 | } |
1708 | break; | 1685 | break; |
@@ -1717,10 +1694,10 @@ static int __init gdth_search_drives(int hanum) | |||
1717 | TRACE2(("gdth_search_drives() %d channels\n",ha->bus_cnt)); | 1694 | TRACE2(("gdth_search_drives() %d channels\n",ha->bus_cnt)); |
1718 | 1695 | ||
1719 | /* read cache configuration */ | 1696 | /* read cache configuration */ |
1720 | if (!gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL,CACHE_INFO, | 1697 | if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_INFO, |
1721 | INVALID_CHANNEL,sizeof(gdth_cinfo_str))) { | 1698 | INVALID_CHANNEL,sizeof(gdth_cinfo_str))) { |
1722 | printk("GDT-HA %d: Initialization error cache service (code %d)\n", | 1699 | printk("GDT-HA %d: Initialization error cache service (code %d)\n", |
1723 | hanum, ha->status); | 1700 | ha->hanum, ha->status); |
1724 | return 0; | 1701 | return 0; |
1725 | } | 1702 | } |
1726 | ha->cpar = ((gdth_cinfo_str *)ha->pscratch)->cpar; | 1703 | ha->cpar = ((gdth_cinfo_str *)ha->pscratch)->cpar; |
@@ -1730,11 +1707,11 @@ static int __init gdth_search_drives(int hanum) | |||
1730 | 1707 | ||
1731 | /* read board info and features */ | 1708 | /* read board info and features */ |
1732 | ha->more_proc = FALSE; | 1709 | ha->more_proc = FALSE; |
1733 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL,BOARD_INFO, | 1710 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, BOARD_INFO, |
1734 | INVALID_CHANNEL,sizeof(gdth_binfo_str))) { | 1711 | INVALID_CHANNEL,sizeof(gdth_binfo_str))) { |
1735 | memcpy(&ha->binfo, (gdth_binfo_str *)ha->pscratch, | 1712 | memcpy(&ha->binfo, (gdth_binfo_str *)ha->pscratch, |
1736 | sizeof(gdth_binfo_str)); | 1713 | sizeof(gdth_binfo_str)); |
1737 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL,BOARD_FEATURES, | 1714 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, BOARD_FEATURES, |
1738 | INVALID_CHANNEL,sizeof(gdth_bfeat_str))) { | 1715 | INVALID_CHANNEL,sizeof(gdth_bfeat_str))) { |
1739 | TRACE2(("BOARD_INFO/BOARD_FEATURES supported\n")); | 1716 | TRACE2(("BOARD_INFO/BOARD_FEATURES supported\n")); |
1740 | ha->bfeat = *(gdth_bfeat_str *)ha->pscratch; | 1717 | ha->bfeat = *(gdth_bfeat_str *)ha->pscratch; |
@@ -1742,7 +1719,7 @@ static int __init gdth_search_drives(int hanum) | |||
1742 | } | 1719 | } |
1743 | } else { | 1720 | } else { |
1744 | TRACE2(("BOARD_INFO requires firmware >= 1.10/2.08\n")); | 1721 | TRACE2(("BOARD_INFO requires firmware >= 1.10/2.08\n")); |
1745 | strcpy(ha->binfo.type_string, gdth_ctr_name(hanum)); | 1722 | strcpy(ha->binfo.type_string, gdth_ctr_name(ha)); |
1746 | } | 1723 | } |
1747 | TRACE2(("Controller name: %s\n",ha->binfo.type_string)); | 1724 | TRACE2(("Controller name: %s\n",ha->binfo.type_string)); |
1748 | 1725 | ||
@@ -1755,7 +1732,7 @@ static int __init gdth_search_drives(int hanum) | |||
1755 | ioc->hdr.first_chan = 0; | 1732 | ioc->hdr.first_chan = 0; |
1756 | ioc->hdr.last_chan = MAXBUS-1; | 1733 | ioc->hdr.last_chan = MAXBUS-1; |
1757 | ioc->hdr.list_offset = GDTOFFSOF(gdth_iochan_str, list[0]); | 1734 | ioc->hdr.list_offset = GDTOFFSOF(gdth_iochan_str, list[0]); |
1758 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL,IOCHAN_DESC, | 1735 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, IOCHAN_DESC, |
1759 | INVALID_CHANNEL,sizeof(gdth_iochan_str))) { | 1736 | INVALID_CHANNEL,sizeof(gdth_iochan_str))) { |
1760 | for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { | 1737 | for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { |
1761 | ha->raw[bus_no].address = ioc->list[bus_no].address; | 1738 | ha->raw[bus_no].address = ioc->list[bus_no].address; |
@@ -1770,7 +1747,7 @@ static int __init gdth_search_drives(int hanum) | |||
1770 | for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { | 1747 | for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { |
1771 | chn = (gdth_getch_str *)ha->pscratch; | 1748 | chn = (gdth_getch_str *)ha->pscratch; |
1772 | chn->channel_no = ha->raw[bus_no].local_no; | 1749 | chn->channel_no = ha->raw[bus_no].local_no; |
1773 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL, | 1750 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1774 | SCSI_CHAN_CNT | L_CTRL_PATTERN, | 1751 | SCSI_CHAN_CNT | L_CTRL_PATTERN, |
1775 | ha->raw[bus_no].address | INVALID_CHANNEL, | 1752 | ha->raw[bus_no].address | INVALID_CHANNEL, |
1776 | sizeof(gdth_getch_str))) { | 1753 | sizeof(gdth_getch_str))) { |
@@ -1782,7 +1759,7 @@ static int __init gdth_search_drives(int hanum) | |||
1782 | drl = (gdth_drlist_str *)ha->pscratch; | 1759 | drl = (gdth_drlist_str *)ha->pscratch; |
1783 | drl->sc_no = ha->raw[bus_no].local_no; | 1760 | drl->sc_no = ha->raw[bus_no].local_no; |
1784 | drl->sc_cnt = ha->raw[bus_no].pdev_cnt; | 1761 | drl->sc_cnt = ha->raw[bus_no].pdev_cnt; |
1785 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL, | 1762 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1786 | SCSI_DR_LIST | L_CTRL_PATTERN, | 1763 | SCSI_DR_LIST | L_CTRL_PATTERN, |
1787 | ha->raw[bus_no].address | INVALID_CHANNEL, | 1764 | ha->raw[bus_no].address | INVALID_CHANNEL, |
1788 | sizeof(gdth_drlist_str))) { | 1765 | sizeof(gdth_drlist_str))) { |
@@ -1795,10 +1772,10 @@ static int __init gdth_search_drives(int hanum) | |||
1795 | } | 1772 | } |
1796 | 1773 | ||
1797 | /* logical drives */ | 1774 | /* logical drives */ |
1798 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL,CACHE_DRV_CNT, | 1775 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_DRV_CNT, |
1799 | INVALID_CHANNEL,sizeof(ulong32))) { | 1776 | INVALID_CHANNEL,sizeof(ulong32))) { |
1800 | drv_cnt = *(ulong32 *)ha->pscratch; | 1777 | drv_cnt = *(ulong32 *)ha->pscratch; |
1801 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL,CACHE_DRV_LIST, | 1778 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_DRV_LIST, |
1802 | INVALID_CHANNEL,drv_cnt * sizeof(ulong32))) { | 1779 | INVALID_CHANNEL,drv_cnt * sizeof(ulong32))) { |
1803 | for (j = 0; j < drv_cnt; ++j) { | 1780 | for (j = 0; j < drv_cnt; ++j) { |
1804 | drv_no = ((ulong32 *)ha->pscratch)[j]; | 1781 | drv_no = ((ulong32 *)ha->pscratch)[j]; |
@@ -1812,7 +1789,7 @@ static int __init gdth_search_drives(int hanum) | |||
1812 | alst->entries_avail = MAX_LDRIVES; | 1789 | alst->entries_avail = MAX_LDRIVES; |
1813 | alst->first_entry = 0; | 1790 | alst->first_entry = 0; |
1814 | alst->list_offset = GDTOFFSOF(gdth_arcdl_str, list[0]); | 1791 | alst->list_offset = GDTOFFSOF(gdth_arcdl_str, list[0]); |
1815 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL, | 1792 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1816 | ARRAY_DRV_LIST2 | LA_CTRL_PATTERN, | 1793 | ARRAY_DRV_LIST2 | LA_CTRL_PATTERN, |
1817 | INVALID_CHANNEL, sizeof(gdth_arcdl_str) + | 1794 | INVALID_CHANNEL, sizeof(gdth_arcdl_str) + |
1818 | (alst->entries_avail-1) * sizeof(gdth_alist_str))) { | 1795 | (alst->entries_avail-1) * sizeof(gdth_alist_str))) { |
@@ -1823,7 +1800,7 @@ static int __init gdth_search_drives(int hanum) | |||
1823 | ha->hdr[j].is_hotfix = alst->list[j].is_hotfix; | 1800 | ha->hdr[j].is_hotfix = alst->list[j].is_hotfix; |
1824 | ha->hdr[j].master_no = alst->list[j].cd_handle; | 1801 | ha->hdr[j].master_no = alst->list[j].cd_handle; |
1825 | } | 1802 | } |
1826 | } else if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL, | 1803 | } else if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1827 | ARRAY_DRV_LIST | LA_CTRL_PATTERN, | 1804 | ARRAY_DRV_LIST | LA_CTRL_PATTERN, |
1828 | 0, 35 * sizeof(gdth_alist_str))) { | 1805 | 0, 35 * sizeof(gdth_alist_str))) { |
1829 | for (j = 0; j < 35; ++j) { | 1806 | for (j = 0; j < 35; ++j) { |
@@ -1841,24 +1818,24 @@ static int __init gdth_search_drives(int hanum) | |||
1841 | /* initialize raw service */ | 1818 | /* initialize raw service */ |
1842 | ha->raw_feat = 0; | 1819 | ha->raw_feat = 0; |
1843 | if (!force_dma32) { | 1820 | if (!force_dma32) { |
1844 | ok = gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_X_INIT_RAW,0,0,0); | 1821 | ok = gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_X_INIT_RAW, 0, 0, 0); |
1845 | if (ok) | 1822 | if (ok) |
1846 | ha->raw_feat = GDT_64BIT; | 1823 | ha->raw_feat = GDT_64BIT; |
1847 | } | 1824 | } |
1848 | if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC)) | 1825 | if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC)) |
1849 | ok = gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_INIT,0,0,0); | 1826 | ok = gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_INIT, 0, 0, 0); |
1850 | if (!ok) { | 1827 | if (!ok) { |
1851 | printk("GDT-HA %d: Initialization error raw service (code %d)\n", | 1828 | printk("GDT-HA %d: Initialization error raw service (code %d)\n", |
1852 | hanum, ha->status); | 1829 | ha->hanum, ha->status); |
1853 | return 0; | 1830 | return 0; |
1854 | } | 1831 | } |
1855 | TRACE2(("gdth_search_drives(): RAWSERVICE initialized\n")); | 1832 | TRACE2(("gdth_search_drives(): RAWSERVICE initialized\n")); |
1856 | 1833 | ||
1857 | /* set/get features raw service (scatter/gather) */ | 1834 | /* set/get features raw service (scatter/gather) */ |
1858 | if (gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_SET_FEAT,SCATTER_GATHER, | 1835 | if (gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_SET_FEAT, SCATTER_GATHER, |
1859 | 0,0)) { | 1836 | 0, 0)) { |
1860 | TRACE2(("gdth_search_drives(): set features RAWSERVICE OK\n")); | 1837 | TRACE2(("gdth_search_drives(): set features RAWSERVICE OK\n")); |
1861 | if (gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_GET_FEAT,0,0,0)) { | 1838 | if (gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_GET_FEAT, 0, 0, 0)) { |
1862 | TRACE2(("gdth_search_dr(): get feat RAWSERVICE %d\n", | 1839 | TRACE2(("gdth_search_dr(): get feat RAWSERVICE %d\n", |
1863 | ha->info)); | 1840 | ha->info)); |
1864 | ha->raw_feat |= (ushort)ha->info; | 1841 | ha->raw_feat |= (ushort)ha->info; |
@@ -1866,10 +1843,10 @@ static int __init gdth_search_drives(int hanum) | |||
1866 | } | 1843 | } |
1867 | 1844 | ||
1868 | /* set/get features cache service (equal to raw service) */ | 1845 | /* set/get features cache service (equal to raw service) */ |
1869 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_SET_FEAT,0, | 1846 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_SET_FEAT, 0, |
1870 | SCATTER_GATHER,0)) { | 1847 | SCATTER_GATHER,0)) { |
1871 | TRACE2(("gdth_search_drives(): set features CACHESERVICE OK\n")); | 1848 | TRACE2(("gdth_search_drives(): set features CACHESERVICE OK\n")); |
1872 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_GET_FEAT,0,0,0)) { | 1849 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_GET_FEAT, 0, 0, 0)) { |
1873 | TRACE2(("gdth_search_dr(): get feat CACHESERV. %d\n", | 1850 | TRACE2(("gdth_search_dr(): get feat CACHESERV. %d\n", |
1874 | ha->info)); | 1851 | ha->info)); |
1875 | ha->cache_feat |= (ushort)ha->info; | 1852 | ha->cache_feat |= (ushort)ha->info; |
@@ -1878,22 +1855,22 @@ static int __init gdth_search_drives(int hanum) | |||
1878 | 1855 | ||
1879 | /* reserve drives for raw service */ | 1856 | /* reserve drives for raw service */ |
1880 | if (reserve_mode != 0) { | 1857 | if (reserve_mode != 0) { |
1881 | gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_RESERVE_ALL, | 1858 | gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESERVE_ALL, |
1882 | reserve_mode == 1 ? 1 : 3, 0, 0); | 1859 | reserve_mode == 1 ? 1 : 3, 0, 0); |
1883 | TRACE2(("gdth_search_drives(): RESERVE_ALL code %d\n", | 1860 | TRACE2(("gdth_search_drives(): RESERVE_ALL code %d\n", |
1884 | ha->status)); | 1861 | ha->status)); |
1885 | } | 1862 | } |
1886 | for (i = 0; i < MAX_RES_ARGS; i += 4) { | 1863 | for (i = 0; i < MAX_RES_ARGS; i += 4) { |
1887 | if (reserve_list[i] == hanum && reserve_list[i+1] < ha->bus_cnt && | 1864 | if (reserve_list[i] == ha->hanum && reserve_list[i+1] < ha->bus_cnt && |
1888 | reserve_list[i+2] < ha->tid_cnt && reserve_list[i+3] < MAXLUN) { | 1865 | reserve_list[i+2] < ha->tid_cnt && reserve_list[i+3] < MAXLUN) { |
1889 | TRACE2(("gdth_search_drives(): reserve ha %d bus %d id %d lun %d\n", | 1866 | TRACE2(("gdth_search_drives(): reserve ha %d bus %d id %d lun %d\n", |
1890 | reserve_list[i], reserve_list[i+1], | 1867 | reserve_list[i], reserve_list[i+1], |
1891 | reserve_list[i+2], reserve_list[i+3])); | 1868 | reserve_list[i+2], reserve_list[i+3])); |
1892 | if (!gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_RESERVE,0, | 1869 | if (!gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESERVE, 0, |
1893 | reserve_list[i+1], reserve_list[i+2] | | 1870 | reserve_list[i+1], reserve_list[i+2] | |
1894 | (reserve_list[i+3] << 8))) { | 1871 | (reserve_list[i+3] << 8))) { |
1895 | printk("GDT-HA %d: Error raw service (RESERVE, code %d)\n", | 1872 | printk("GDT-HA %d: Error raw service (RESERVE, code %d)\n", |
1896 | hanum, ha->status); | 1873 | ha->hanum, ha->status); |
1897 | } | 1874 | } |
1898 | } | 1875 | } |
1899 | } | 1876 | } |
@@ -1902,12 +1879,12 @@ static int __init gdth_search_drives(int hanum) | |||
1902 | oemstr = (gdth_oem_str_ioctl *)ha->pscratch; | 1879 | oemstr = (gdth_oem_str_ioctl *)ha->pscratch; |
1903 | oemstr->params.ctl_version = 0x01; | 1880 | oemstr->params.ctl_version = 0x01; |
1904 | oemstr->params.buffer_size = sizeof(oemstr->text); | 1881 | oemstr->params.buffer_size = sizeof(oemstr->text); |
1905 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL, | 1882 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1906 | CACHE_READ_OEM_STRING_RECORD,INVALID_CHANNEL, | 1883 | CACHE_READ_OEM_STRING_RECORD,INVALID_CHANNEL, |
1907 | sizeof(gdth_oem_str_ioctl))) { | 1884 | sizeof(gdth_oem_str_ioctl))) { |
1908 | TRACE2(("gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD OK\n")); | 1885 | TRACE2(("gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD OK\n")); |
1909 | printk("GDT-HA %d: Vendor: %s Name: %s\n", | 1886 | printk("GDT-HA %d: Vendor: %s Name: %s\n", |
1910 | hanum,oemstr->text.oem_company_name,ha->binfo.type_string); | 1887 | ha->hanum, oemstr->text.oem_company_name, ha->binfo.type_string); |
1911 | /* Save the Host Drive inquiry data */ | 1888 | /* Save the Host Drive inquiry data */ |
1912 | strlcpy(ha->oem_name,oemstr->text.scsi_host_drive_inquiry_vendor_id, | 1889 | strlcpy(ha->oem_name,oemstr->text.scsi_host_drive_inquiry_vendor_id, |
1913 | sizeof(ha->oem_name)); | 1890 | sizeof(ha->oem_name)); |
@@ -1915,7 +1892,7 @@ static int __init gdth_search_drives(int hanum) | |||
1915 | /* Old method, based on PCI ID */ | 1892 | /* Old method, based on PCI ID */ |
1916 | TRACE2(("gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD failed\n")); | 1893 | TRACE2(("gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD failed\n")); |
1917 | printk("GDT-HA %d: Name: %s\n", | 1894 | printk("GDT-HA %d: Name: %s\n", |
1918 | hanum,ha->binfo.type_string); | 1895 | ha->hanum, ha->binfo.type_string); |
1919 | if (ha->oem_id == OEM_ID_INTEL) | 1896 | if (ha->oem_id == OEM_ID_INTEL) |
1920 | strlcpy(ha->oem_name,"Intel ", sizeof(ha->oem_name)); | 1897 | strlcpy(ha->oem_name,"Intel ", sizeof(ha->oem_name)); |
1921 | else | 1898 | else |
@@ -1924,24 +1901,22 @@ static int __init gdth_search_drives(int hanum) | |||
1924 | 1901 | ||
1925 | /* scanning for host drives */ | 1902 | /* scanning for host drives */ |
1926 | for (i = 0; i < cdev_cnt; ++i) | 1903 | for (i = 0; i < cdev_cnt; ++i) |
1927 | gdth_analyse_hdrive(hanum,i); | 1904 | gdth_analyse_hdrive(ha, i); |
1928 | 1905 | ||
1929 | TRACE(("gdth_search_drives() OK\n")); | 1906 | TRACE(("gdth_search_drives() OK\n")); |
1930 | return 1; | 1907 | return 1; |
1931 | } | 1908 | } |
1932 | 1909 | ||
1933 | static int gdth_analyse_hdrive(int hanum,ushort hdrive) | 1910 | static int gdth_analyse_hdrive(gdth_ha_str *ha, ushort hdrive) |
1934 | { | 1911 | { |
1935 | register gdth_ha_str *ha; | ||
1936 | ulong32 drv_cyls; | 1912 | ulong32 drv_cyls; |
1937 | int drv_hds, drv_secs; | 1913 | int drv_hds, drv_secs; |
1938 | 1914 | ||
1939 | TRACE(("gdth_analyse_hdrive() hanum %d drive %d\n",hanum,hdrive)); | 1915 | TRACE(("gdth_analyse_hdrive() hanum %d drive %d\n", ha->hanum, hdrive)); |
1940 | if (hdrive >= MAX_HDRIVES) | 1916 | if (hdrive >= MAX_HDRIVES) |
1941 | return 0; | 1917 | return 0; |
1942 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
1943 | 1918 | ||
1944 | if (!gdth_internal_cmd(hanum,CACHESERVICE,GDT_INFO,hdrive,0,0)) | 1919 | if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_INFO, hdrive, 0, 0)) |
1945 | return 0; | 1920 | return 0; |
1946 | ha->hdr[hdrive].present = TRUE; | 1921 | ha->hdr[hdrive].present = TRUE; |
1947 | ha->hdr[hdrive].size = ha->info; | 1922 | ha->hdr[hdrive].size = ha->info; |
@@ -1961,7 +1936,7 @@ static int gdth_analyse_hdrive(int hanum,ushort hdrive) | |||
1961 | ha->hdr[hdrive].size = drv_cyls * drv_hds * drv_secs; | 1936 | ha->hdr[hdrive].size = drv_cyls * drv_hds * drv_secs; |
1962 | 1937 | ||
1963 | if (ha->cache_feat & GDT_64BIT) { | 1938 | if (ha->cache_feat & GDT_64BIT) { |
1964 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_X_INFO,hdrive,0,0) | 1939 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_X_INFO, hdrive, 0, 0) |
1965 | && ha->info2 != 0) { | 1940 | && ha->info2 != 0) { |
1966 | ha->hdr[hdrive].size = ((ulong64)ha->info2 << 32) | ha->info; | 1941 | ha->hdr[hdrive].size = ((ulong64)ha->info2 << 32) | ha->info; |
1967 | } | 1942 | } |
@@ -1970,14 +1945,14 @@ static int gdth_analyse_hdrive(int hanum,ushort hdrive) | |||
1970 | hdrive,ha->hdr[hdrive].size,drv_hds,drv_secs)); | 1945 | hdrive,ha->hdr[hdrive].size,drv_hds,drv_secs)); |
1971 | 1946 | ||
1972 | /* get informations about device */ | 1947 | /* get informations about device */ |
1973 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_DEVTYPE,hdrive,0,0)) { | 1948 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_DEVTYPE, hdrive, 0, 0)) { |
1974 | TRACE2(("gdth_search_dr() cache drive %d devtype %d\n", | 1949 | TRACE2(("gdth_search_dr() cache drive %d devtype %d\n", |
1975 | hdrive,ha->info)); | 1950 | hdrive,ha->info)); |
1976 | ha->hdr[hdrive].devtype = (ushort)ha->info; | 1951 | ha->hdr[hdrive].devtype = (ushort)ha->info; |
1977 | } | 1952 | } |
1978 | 1953 | ||
1979 | /* cluster info */ | 1954 | /* cluster info */ |
1980 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_CLUST_INFO,hdrive,0,0)) { | 1955 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_CLUST_INFO, hdrive, 0, 0)) { |
1981 | TRACE2(("gdth_search_dr() cache drive %d cluster info %d\n", | 1956 | TRACE2(("gdth_search_dr() cache drive %d cluster info %d\n", |
1982 | hdrive,ha->info)); | 1957 | hdrive,ha->info)); |
1983 | if (!shared_access) | 1958 | if (!shared_access) |
@@ -1985,7 +1960,7 @@ static int gdth_analyse_hdrive(int hanum,ushort hdrive) | |||
1985 | } | 1960 | } |
1986 | 1961 | ||
1987 | /* R/W attributes */ | 1962 | /* R/W attributes */ |
1988 | if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_RW_ATTRIBS,hdrive,0,0)) { | 1963 | if (gdth_internal_cmd(ha, CACHESERVICE, GDT_RW_ATTRIBS, hdrive, 0, 0)) { |
1989 | TRACE2(("gdth_search_dr() cache drive %d r/w attrib. %d\n", | 1964 | TRACE2(("gdth_search_dr() cache drive %d r/w attrib. %d\n", |
1990 | hdrive,ha->info)); | 1965 | hdrive,ha->info)); |
1991 | ha->hdr[hdrive].rw_attribs = (unchar)ha->info; | 1966 | ha->hdr[hdrive].rw_attribs = (unchar)ha->info; |
@@ -1997,16 +1972,14 @@ static int gdth_analyse_hdrive(int hanum,ushort hdrive) | |||
1997 | 1972 | ||
1998 | /* command queueing/sending functions */ | 1973 | /* command queueing/sending functions */ |
1999 | 1974 | ||
2000 | static void gdth_putq(int hanum,Scsi_Cmnd *scp,unchar priority) | 1975 | static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar priority) |
2001 | { | 1976 | { |
2002 | register gdth_ha_str *ha; | ||
2003 | register Scsi_Cmnd *pscp; | 1977 | register Scsi_Cmnd *pscp; |
2004 | register Scsi_Cmnd *nscp; | 1978 | register Scsi_Cmnd *nscp; |
2005 | ulong flags; | 1979 | ulong flags; |
2006 | unchar b, t; | 1980 | unchar b, t; |
2007 | 1981 | ||
2008 | TRACE(("gdth_putq() priority %d\n",priority)); | 1982 | TRACE(("gdth_putq() priority %d\n",priority)); |
2009 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
2010 | spin_lock_irqsave(&ha->smp_lock, flags); | 1983 | spin_lock_irqsave(&ha->smp_lock, flags); |
2011 | 1984 | ||
2012 | if (!IS_GDTH_INTERNAL_CMD(scp)) { | 1985 | if (!IS_GDTH_INTERNAL_CMD(scp)) { |
@@ -2017,7 +1990,7 @@ static void gdth_putq(int hanum,Scsi_Cmnd *scp,unchar priority) | |||
2017 | if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) || | 1990 | if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) || |
2018 | (b==ha->virt_bus && t<MAX_HDRIVES && ha->hdr[t].lock)) { | 1991 | (b==ha->virt_bus && t<MAX_HDRIVES && ha->hdr[t].lock)) { |
2019 | TRACE2(("gdth_putq(): locked IO ->update_timeout()\n")); | 1992 | TRACE2(("gdth_putq(): locked IO ->update_timeout()\n")); |
2020 | scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0); | 1993 | scp->SCp.buffers_residual = gdth_update_timeout(scp, 0); |
2021 | } | 1994 | } |
2022 | } | 1995 | } |
2023 | } | 1996 | } |
@@ -2049,9 +2022,8 @@ static void gdth_putq(int hanum,Scsi_Cmnd *scp,unchar priority) | |||
2049 | #endif | 2022 | #endif |
2050 | } | 2023 | } |
2051 | 2024 | ||
2052 | static void gdth_next(int hanum) | 2025 | static void gdth_next(gdth_ha_str *ha) |
2053 | { | 2026 | { |
2054 | register gdth_ha_str *ha; | ||
2055 | register Scsi_Cmnd *pscp; | 2027 | register Scsi_Cmnd *pscp; |
2056 | register Scsi_Cmnd *nscp; | 2028 | register Scsi_Cmnd *nscp; |
2057 | unchar b, t, l, firsttime; | 2029 | unchar b, t, l, firsttime; |
@@ -2059,8 +2031,7 @@ static void gdth_next(int hanum) | |||
2059 | ulong flags = 0; | 2031 | ulong flags = 0; |
2060 | int cmd_index; | 2032 | int cmd_index; |
2061 | 2033 | ||
2062 | TRACE(("gdth_next() hanum %d\n",hanum)); | 2034 | TRACE(("gdth_next() hanum %d\n", ha->hanum)); |
2063 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
2064 | if (!gdth_polling) | 2035 | if (!gdth_polling) |
2065 | spin_lock_irqsave(&ha->smp_lock, flags); | 2036 | spin_lock_irqsave(&ha->smp_lock, flags); |
2066 | 2037 | ||
@@ -2085,13 +2056,13 @@ static void gdth_next(int hanum) | |||
2085 | b = t = l = 0; | 2056 | b = t = l = 0; |
2086 | 2057 | ||
2087 | if (firsttime) { | 2058 | if (firsttime) { |
2088 | if (gdth_test_busy(hanum)) { /* controller busy ? */ | 2059 | if (gdth_test_busy(ha)) { /* controller busy ? */ |
2089 | TRACE(("gdth_next() controller %d busy !\n",hanum)); | 2060 | TRACE(("gdth_next() controller %d busy !\n", ha->hanum)); |
2090 | if (!gdth_polling) { | 2061 | if (!gdth_polling) { |
2091 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 2062 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
2092 | return; | 2063 | return; |
2093 | } | 2064 | } |
2094 | while (gdth_test_busy(hanum)) | 2065 | while (gdth_test_busy(ha)) |
2095 | gdth_delay(1); | 2066 | gdth_delay(1); |
2096 | } | 2067 | } |
2097 | firsttime = FALSE; | 2068 | firsttime = FALSE; |
@@ -2143,11 +2114,11 @@ static void gdth_next(int hanum) | |||
2143 | 2114 | ||
2144 | if (nscp->SCp.sent_command != -1) { | 2115 | if (nscp->SCp.sent_command != -1) { |
2145 | if ((nscp->SCp.phase & 0xff) == CACHESERVICE) { | 2116 | if ((nscp->SCp.phase & 0xff) == CACHESERVICE) { |
2146 | if (!(cmd_index=gdth_fill_cache_cmd(hanum,nscp,t))) | 2117 | if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) |
2147 | this_cmd = FALSE; | 2118 | this_cmd = FALSE; |
2148 | next_cmd = FALSE; | 2119 | next_cmd = FALSE; |
2149 | } else if ((nscp->SCp.phase & 0xff) == SCSIRAWSERVICE) { | 2120 | } else if ((nscp->SCp.phase & 0xff) == SCSIRAWSERVICE) { |
2150 | if (!(cmd_index=gdth_fill_raw_cmd(hanum,nscp,BUS_L2P(ha,b)))) | 2121 | if (!(cmd_index=gdth_fill_raw_cmd(ha, nscp, BUS_L2P(ha, b)))) |
2151 | this_cmd = FALSE; | 2122 | this_cmd = FALSE; |
2152 | next_cmd = FALSE; | 2123 | next_cmd = FALSE; |
2153 | } else { | 2124 | } else { |
@@ -2161,12 +2132,12 @@ static void gdth_next(int hanum) | |||
2161 | gdth_scsi_done(nscp); | 2132 | gdth_scsi_done(nscp); |
2162 | } | 2133 | } |
2163 | } else if (IS_GDTH_INTERNAL_CMD(nscp)) { | 2134 | } else if (IS_GDTH_INTERNAL_CMD(nscp)) { |
2164 | if (!(cmd_index=gdth_special_cmd(hanum,nscp))) | 2135 | if (!(cmd_index=gdth_special_cmd(ha, nscp))) |
2165 | this_cmd = FALSE; | 2136 | this_cmd = FALSE; |
2166 | next_cmd = FALSE; | 2137 | next_cmd = FALSE; |
2167 | } else if (b != ha->virt_bus) { | 2138 | } else if (b != ha->virt_bus) { |
2168 | if (ha->raw[BUS_L2P(ha,b)].io_cnt[t] >= GDTH_MAX_RAW || | 2139 | if (ha->raw[BUS_L2P(ha,b)].io_cnt[t] >= GDTH_MAX_RAW || |
2169 | !(cmd_index=gdth_fill_raw_cmd(hanum,nscp,BUS_L2P(ha,b)))) | 2140 | !(cmd_index=gdth_fill_raw_cmd(ha, nscp, BUS_L2P(ha, b)))) |
2170 | this_cmd = FALSE; | 2141 | this_cmd = FALSE; |
2171 | else | 2142 | else |
2172 | ha->raw[BUS_L2P(ha,b)].io_cnt[t]++; | 2143 | ha->raw[BUS_L2P(ha,b)].io_cnt[t]++; |
@@ -2204,7 +2175,7 @@ static void gdth_next(int hanum) | |||
2204 | nscp->SCp.have_data_in++; | 2175 | nscp->SCp.have_data_in++; |
2205 | else | 2176 | else |
2206 | gdth_scsi_done(nscp); | 2177 | gdth_scsi_done(nscp); |
2207 | } else if (gdth_internal_cache_cmd(hanum, nscp)) | 2178 | } else if (gdth_internal_cache_cmd(ha, nscp)) |
2208 | gdth_scsi_done(nscp); | 2179 | gdth_scsi_done(nscp); |
2209 | break; | 2180 | break; |
2210 | 2181 | ||
@@ -2224,7 +2195,7 @@ static void gdth_next(int hanum) | |||
2224 | nscp->cmnd[3] = (ha->hdr[t].devtype&1) ? 1:0; | 2195 | nscp->cmnd[3] = (ha->hdr[t].devtype&1) ? 1:0; |
2225 | TRACE(("Prevent/allow r. %d rem. drive %d\n", | 2196 | TRACE(("Prevent/allow r. %d rem. drive %d\n", |
2226 | nscp->cmnd[4],nscp->cmnd[3])); | 2197 | nscp->cmnd[4],nscp->cmnd[3])); |
2227 | if (!(cmd_index=gdth_fill_cache_cmd(hanum,nscp,t))) | 2198 | if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) |
2228 | this_cmd = FALSE; | 2199 | this_cmd = FALSE; |
2229 | } | 2200 | } |
2230 | break; | 2201 | break; |
@@ -2233,7 +2204,7 @@ static void gdth_next(int hanum) | |||
2233 | case RELEASE: | 2204 | case RELEASE: |
2234 | TRACE2(("cache cmd %s\n",nscp->cmnd[0] == RESERVE ? | 2205 | TRACE2(("cache cmd %s\n",nscp->cmnd[0] == RESERVE ? |
2235 | "RESERVE" : "RELEASE")); | 2206 | "RESERVE" : "RELEASE")); |
2236 | if (!(cmd_index=gdth_fill_cache_cmd(hanum,nscp,t))) | 2207 | if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) |
2237 | this_cmd = FALSE; | 2208 | this_cmd = FALSE; |
2238 | break; | 2209 | break; |
2239 | 2210 | ||
@@ -2256,7 +2227,7 @@ static void gdth_next(int hanum) | |||
2256 | nscp->SCp.have_data_in++; | 2227 | nscp->SCp.have_data_in++; |
2257 | else | 2228 | else |
2258 | gdth_scsi_done(nscp); | 2229 | gdth_scsi_done(nscp); |
2259 | } else if (!(cmd_index=gdth_fill_cache_cmd(hanum, nscp, t))) | 2230 | } else if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) |
2260 | this_cmd = FALSE; | 2231 | this_cmd = FALSE; |
2261 | break; | 2232 | break; |
2262 | 2233 | ||
@@ -2265,7 +2236,7 @@ static void gdth_next(int hanum) | |||
2265 | nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], | 2236 | nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], |
2266 | nscp->cmnd[4],nscp->cmnd[5])); | 2237 | nscp->cmnd[4],nscp->cmnd[5])); |
2267 | printk("GDT-HA %d: Unknown SCSI command 0x%x to cache service !\n", | 2238 | printk("GDT-HA %d: Unknown SCSI command 0x%x to cache service !\n", |
2268 | hanum, nscp->cmnd[0]); | 2239 | ha->hanum, nscp->cmnd[0]); |
2269 | nscp->result = DID_ABORT << 16; | 2240 | nscp->result = DID_ABORT << 16; |
2270 | if (!nscp->SCp.have_data_in) | 2241 | if (!nscp->SCp.have_data_in) |
2271 | nscp->SCp.have_data_in++; | 2242 | nscp->SCp.have_data_in++; |
@@ -2286,30 +2257,28 @@ static void gdth_next(int hanum) | |||
2286 | } | 2257 | } |
2287 | 2258 | ||
2288 | if (ha->cmd_cnt > 0) { | 2259 | if (ha->cmd_cnt > 0) { |
2289 | gdth_release_event(hanum); | 2260 | gdth_release_event(ha); |
2290 | } | 2261 | } |
2291 | 2262 | ||
2292 | if (!gdth_polling) | 2263 | if (!gdth_polling) |
2293 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 2264 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
2294 | 2265 | ||
2295 | if (gdth_polling && ha->cmd_cnt > 0) { | 2266 | if (gdth_polling && ha->cmd_cnt > 0) { |
2296 | if (!gdth_wait(hanum,cmd_index,POLL_TIMEOUT)) | 2267 | if (!gdth_wait(ha, cmd_index, POLL_TIMEOUT)) |
2297 | printk("GDT-HA %d: Command %d timed out !\n", | 2268 | printk("GDT-HA %d: Command %d timed out !\n", |
2298 | hanum,cmd_index); | 2269 | ha->hanum, cmd_index); |
2299 | } | 2270 | } |
2300 | } | 2271 | } |
2301 | 2272 | ||
2302 | static void gdth_copy_internal_data(int hanum,Scsi_Cmnd *scp, | 2273 | static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp, |
2303 | char *buffer,ushort count) | 2274 | char *buffer,ushort count) |
2304 | { | 2275 | { |
2305 | ushort cpcount,i; | 2276 | ushort cpcount,i; |
2306 | ushort cpsum,cpnow; | 2277 | ushort cpsum,cpnow; |
2307 | struct scatterlist *sl; | 2278 | struct scatterlist *sl; |
2308 | gdth_ha_str *ha; | ||
2309 | char *address; | 2279 | char *address; |
2310 | 2280 | ||
2311 | cpcount = count<=(ushort)scp->request_bufflen ? count:(ushort)scp->request_bufflen; | 2281 | cpcount = count<=(ushort)scp->request_bufflen ? count:(ushort)scp->request_bufflen; |
2312 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
2313 | 2282 | ||
2314 | if (scp->use_sg) { | 2283 | if (scp->use_sg) { |
2315 | sl = (struct scatterlist *)scp->request_buffer; | 2284 | sl = (struct scatterlist *)scp->request_buffer; |
@@ -2323,7 +2292,7 @@ static void gdth_copy_internal_data(int hanum,Scsi_Cmnd *scp, | |||
2323 | cpsum += cpnow; | 2292 | cpsum += cpnow; |
2324 | if (!sl->page) { | 2293 | if (!sl->page) { |
2325 | printk("GDT-HA %d: invalid sc/gt element in gdth_copy_internal_data()\n", | 2294 | printk("GDT-HA %d: invalid sc/gt element in gdth_copy_internal_data()\n", |
2326 | hanum); | 2295 | ha->hanum); |
2327 | return; | 2296 | return; |
2328 | } | 2297 | } |
2329 | local_irq_save(flags); | 2298 | local_irq_save(flags); |
@@ -2342,16 +2311,14 @@ static void gdth_copy_internal_data(int hanum,Scsi_Cmnd *scp, | |||
2342 | } | 2311 | } |
2343 | } | 2312 | } |
2344 | 2313 | ||
2345 | static int gdth_internal_cache_cmd(int hanum,Scsi_Cmnd *scp) | 2314 | static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp) |
2346 | { | 2315 | { |
2347 | register gdth_ha_str *ha; | ||
2348 | unchar t; | 2316 | unchar t; |
2349 | gdth_inq_data inq; | 2317 | gdth_inq_data inq; |
2350 | gdth_rdcap_data rdc; | 2318 | gdth_rdcap_data rdc; |
2351 | gdth_sense_data sd; | 2319 | gdth_sense_data sd; |
2352 | gdth_modep_data mpd; | 2320 | gdth_modep_data mpd; |
2353 | 2321 | ||
2354 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
2355 | t = scp->device->id; | 2322 | t = scp->device->id; |
2356 | TRACE(("gdth_internal_cache_cmd() cmd 0x%x hdrive %d\n", | 2323 | TRACE(("gdth_internal_cache_cmd() cmd 0x%x hdrive %d\n", |
2357 | scp->cmnd[0],t)); | 2324 | scp->cmnd[0],t)); |
@@ -2382,7 +2349,7 @@ static int gdth_internal_cache_cmd(int hanum,Scsi_Cmnd *scp) | |||
2382 | strcpy(inq.vendor,ha->oem_name); | 2349 | strcpy(inq.vendor,ha->oem_name); |
2383 | sprintf(inq.product,"Host Drive #%02d",t); | 2350 | sprintf(inq.product,"Host Drive #%02d",t); |
2384 | strcpy(inq.revision," "); | 2351 | strcpy(inq.revision," "); |
2385 | gdth_copy_internal_data(hanum,scp,(char*)&inq,sizeof(gdth_inq_data)); | 2352 | gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data)); |
2386 | break; | 2353 | break; |
2387 | 2354 | ||
2388 | case REQUEST_SENSE: | 2355 | case REQUEST_SENSE: |
@@ -2392,7 +2359,7 @@ static int gdth_internal_cache_cmd(int hanum,Scsi_Cmnd *scp) | |||
2392 | sd.key = NO_SENSE; | 2359 | sd.key = NO_SENSE; |
2393 | sd.info = 0; | 2360 | sd.info = 0; |
2394 | sd.add_length= 0; | 2361 | sd.add_length= 0; |
2395 | gdth_copy_internal_data(hanum,scp,(char*)&sd,sizeof(gdth_sense_data)); | 2362 | gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data)); |
2396 | break; | 2363 | break; |
2397 | 2364 | ||
2398 | case MODE_SENSE: | 2365 | case MODE_SENSE: |
@@ -2404,7 +2371,7 @@ static int gdth_internal_cache_cmd(int hanum,Scsi_Cmnd *scp) | |||
2404 | mpd.bd.block_length[0] = (SECTOR_SIZE & 0x00ff0000) >> 16; | 2371 | mpd.bd.block_length[0] = (SECTOR_SIZE & 0x00ff0000) >> 16; |
2405 | mpd.bd.block_length[1] = (SECTOR_SIZE & 0x0000ff00) >> 8; | 2372 | mpd.bd.block_length[1] = (SECTOR_SIZE & 0x0000ff00) >> 8; |
2406 | mpd.bd.block_length[2] = (SECTOR_SIZE & 0x000000ff); | 2373 | mpd.bd.block_length[2] = (SECTOR_SIZE & 0x000000ff); |
2407 | gdth_copy_internal_data(hanum,scp,(char*)&mpd,sizeof(gdth_modep_data)); | 2374 | gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data)); |
2408 | break; | 2375 | break; |
2409 | 2376 | ||
2410 | case READ_CAPACITY: | 2377 | case READ_CAPACITY: |
@@ -2414,7 +2381,7 @@ static int gdth_internal_cache_cmd(int hanum,Scsi_Cmnd *scp) | |||
2414 | else | 2381 | else |
2415 | rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1); | 2382 | rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1); |
2416 | rdc.block_length = cpu_to_be32(SECTOR_SIZE); | 2383 | rdc.block_length = cpu_to_be32(SECTOR_SIZE); |
2417 | gdth_copy_internal_data(hanum,scp,(char*)&rdc,sizeof(gdth_rdcap_data)); | 2384 | gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data)); |
2418 | break; | 2385 | break; |
2419 | 2386 | ||
2420 | case SERVICE_ACTION_IN: | 2387 | case SERVICE_ACTION_IN: |
@@ -2425,7 +2392,8 @@ static int gdth_internal_cache_cmd(int hanum,Scsi_Cmnd *scp) | |||
2425 | TRACE2(("Read capacity (16) hdrive %d\n",t)); | 2392 | TRACE2(("Read capacity (16) hdrive %d\n",t)); |
2426 | rdc16.last_block_no = cpu_to_be64(ha->hdr[t].size-1); | 2393 | rdc16.last_block_no = cpu_to_be64(ha->hdr[t].size-1); |
2427 | rdc16.block_length = cpu_to_be32(SECTOR_SIZE); | 2394 | rdc16.block_length = cpu_to_be32(SECTOR_SIZE); |
2428 | gdth_copy_internal_data(hanum,scp,(char*)&rdc16,sizeof(gdth_rdcap16_data)); | 2395 | gdth_copy_internal_data(ha, scp, (char*)&rdc16, |
2396 | sizeof(gdth_rdcap16_data)); | ||
2429 | } else { | 2397 | } else { |
2430 | scp->result = DID_ABORT << 16; | 2398 | scp->result = DID_ABORT << 16; |
2431 | } | 2399 | } |
@@ -2443,10 +2411,9 @@ static int gdth_internal_cache_cmd(int hanum,Scsi_Cmnd *scp) | |||
2443 | 2411 | ||
2444 | return 0; | 2412 | return 0; |
2445 | } | 2413 | } |
2446 | 2414 | ||
2447 | static int gdth_fill_cache_cmd(int hanum,Scsi_Cmnd *scp,ushort hdrive) | 2415 | static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive) |
2448 | { | 2416 | { |
2449 | register gdth_ha_str *ha; | ||
2450 | register gdth_cmd_str *cmdp; | 2417 | register gdth_cmd_str *cmdp; |
2451 | struct scatterlist *sl; | 2418 | struct scatterlist *sl; |
2452 | ulong32 cnt, blockcnt; | 2419 | ulong32 cnt, blockcnt; |
@@ -2456,7 +2423,6 @@ static int gdth_fill_cache_cmd(int hanum,Scsi_Cmnd *scp,ushort hdrive) | |||
2456 | struct page *page; | 2423 | struct page *page; |
2457 | ulong offset; | 2424 | ulong offset; |
2458 | 2425 | ||
2459 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
2460 | cmdp = ha->pccb; | 2426 | cmdp = ha->pccb; |
2461 | TRACE(("gdth_fill_cache_cmd() cmd 0x%x cmdsize %d hdrive %d\n", | 2427 | TRACE(("gdth_fill_cache_cmd() cmd 0x%x cmdsize %d hdrive %d\n", |
2462 | scp->cmnd[0],scp->cmd_len,hdrive)); | 2428 | scp->cmnd[0],scp->cmd_len,hdrive)); |
@@ -2472,13 +2438,13 @@ static int gdth_fill_cache_cmd(int hanum,Scsi_Cmnd *scp,ushort hdrive) | |||
2472 | cmdp->Service = CACHESERVICE; | 2438 | cmdp->Service = CACHESERVICE; |
2473 | cmdp->RequestBuffer = scp; | 2439 | cmdp->RequestBuffer = scp; |
2474 | /* search free command index */ | 2440 | /* search free command index */ |
2475 | if (!(cmd_index=gdth_get_cmd_index(hanum))) { | 2441 | if (!(cmd_index=gdth_get_cmd_index(ha))) { |
2476 | TRACE(("GDT: No free command index found\n")); | 2442 | TRACE(("GDT: No free command index found\n")); |
2477 | return 0; | 2443 | return 0; |
2478 | } | 2444 | } |
2479 | /* if it's the first command, set command semaphore */ | 2445 | /* if it's the first command, set command semaphore */ |
2480 | if (ha->cmd_cnt == 0) | 2446 | if (ha->cmd_cnt == 0) |
2481 | gdth_set_sema0(hanum); | 2447 | gdth_set_sema0(ha); |
2482 | 2448 | ||
2483 | /* fill command */ | 2449 | /* fill command */ |
2484 | read_write = 0; | 2450 | read_write = 0; |
@@ -2650,13 +2616,12 @@ static int gdth_fill_cache_cmd(int hanum,Scsi_Cmnd *scp,ushort hdrive) | |||
2650 | } | 2616 | } |
2651 | 2617 | ||
2652 | /* copy command */ | 2618 | /* copy command */ |
2653 | gdth_copy_command(hanum); | 2619 | gdth_copy_command(ha); |
2654 | return cmd_index; | 2620 | return cmd_index; |
2655 | } | 2621 | } |
2656 | 2622 | ||
2657 | static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b) | 2623 | static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, unchar b) |
2658 | { | 2624 | { |
2659 | register gdth_ha_str *ha; | ||
2660 | register gdth_cmd_str *cmdp; | 2625 | register gdth_cmd_str *cmdp; |
2661 | struct scatterlist *sl; | 2626 | struct scatterlist *sl; |
2662 | ushort i; | 2627 | ushort i; |
@@ -2666,7 +2631,6 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b) | |||
2666 | struct page *page; | 2631 | struct page *page; |
2667 | ulong offset; | 2632 | ulong offset; |
2668 | 2633 | ||
2669 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
2670 | t = scp->device->id; | 2634 | t = scp->device->id; |
2671 | l = scp->device->lun; | 2635 | l = scp->device->lun; |
2672 | cmdp = ha->pccb; | 2636 | cmdp = ha->pccb; |
@@ -2681,13 +2645,13 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b) | |||
2681 | cmdp->Service = SCSIRAWSERVICE; | 2645 | cmdp->Service = SCSIRAWSERVICE; |
2682 | cmdp->RequestBuffer = scp; | 2646 | cmdp->RequestBuffer = scp; |
2683 | /* search free command index */ | 2647 | /* search free command index */ |
2684 | if (!(cmd_index=gdth_get_cmd_index(hanum))) { | 2648 | if (!(cmd_index=gdth_get_cmd_index(ha))) { |
2685 | TRACE(("GDT: No free command index found\n")); | 2649 | TRACE(("GDT: No free command index found\n")); |
2686 | return 0; | 2650 | return 0; |
2687 | } | 2651 | } |
2688 | /* if it's the first command, set command semaphore */ | 2652 | /* if it's the first command, set command semaphore */ |
2689 | if (ha->cmd_cnt == 0) | 2653 | if (ha->cmd_cnt == 0) |
2690 | gdth_set_sema0(hanum); | 2654 | gdth_set_sema0(ha); |
2691 | 2655 | ||
2692 | /* fill command */ | 2656 | /* fill command */ |
2693 | if (scp->SCp.sent_command != -1) { | 2657 | if (scp->SCp.sent_command != -1) { |
@@ -2855,17 +2819,15 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b) | |||
2855 | } | 2819 | } |
2856 | 2820 | ||
2857 | /* copy command */ | 2821 | /* copy command */ |
2858 | gdth_copy_command(hanum); | 2822 | gdth_copy_command(ha); |
2859 | return cmd_index; | 2823 | return cmd_index; |
2860 | } | 2824 | } |
2861 | 2825 | ||
2862 | static int gdth_special_cmd(int hanum,Scsi_Cmnd *scp) | 2826 | static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp) |
2863 | { | 2827 | { |
2864 | register gdth_ha_str *ha; | ||
2865 | register gdth_cmd_str *cmdp; | 2828 | register gdth_cmd_str *cmdp; |
2866 | int cmd_index; | 2829 | int cmd_index; |
2867 | 2830 | ||
2868 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
2869 | cmdp= ha->pccb; | 2831 | cmdp= ha->pccb; |
2870 | TRACE2(("gdth_special_cmd(): ")); | 2832 | TRACE2(("gdth_special_cmd(): ")); |
2871 | 2833 | ||
@@ -2876,14 +2838,14 @@ static int gdth_special_cmd(int hanum,Scsi_Cmnd *scp) | |||
2876 | cmdp->RequestBuffer = scp; | 2838 | cmdp->RequestBuffer = scp; |
2877 | 2839 | ||
2878 | /* search free command index */ | 2840 | /* search free command index */ |
2879 | if (!(cmd_index=gdth_get_cmd_index(hanum))) { | 2841 | if (!(cmd_index=gdth_get_cmd_index(ha))) { |
2880 | TRACE(("GDT: No free command index found\n")); | 2842 | TRACE(("GDT: No free command index found\n")); |
2881 | return 0; | 2843 | return 0; |
2882 | } | 2844 | } |
2883 | 2845 | ||
2884 | /* if it's the first command, set command semaphore */ | 2846 | /* if it's the first command, set command semaphore */ |
2885 | if (ha->cmd_cnt == 0) | 2847 | if (ha->cmd_cnt == 0) |
2886 | gdth_set_sema0(hanum); | 2848 | gdth_set_sema0(ha); |
2887 | 2849 | ||
2888 | /* evaluate command size, check space */ | 2850 | /* evaluate command size, check space */ |
2889 | if (cmdp->OpCode == GDT_IOCTL) { | 2851 | if (cmdp->OpCode == GDT_IOCTL) { |
@@ -2921,7 +2883,7 @@ static int gdth_special_cmd(int hanum,Scsi_Cmnd *scp) | |||
2921 | } | 2883 | } |
2922 | 2884 | ||
2923 | /* copy command */ | 2885 | /* copy command */ |
2924 | gdth_copy_command(hanum); | 2886 | gdth_copy_command(ha); |
2925 | return cmd_index; | 2887 | return cmd_index; |
2926 | } | 2888 | } |
2927 | 2889 | ||
@@ -3087,7 +3049,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id) | |||
3087 | spin_unlock_irqrestore(&ha2->smp_lock, flags); | 3049 | spin_unlock_irqrestore(&ha2->smp_lock, flags); |
3088 | return IRQ_HANDLED; | 3050 | return IRQ_HANDLED; |
3089 | } | 3051 | } |
3090 | ha = HADATA(gdth_ctr_tab[hanum]); | 3052 | ha = shost_priv(gdth_ctr_tab[hanum]); |
3091 | 3053 | ||
3092 | #ifdef GDTH_STATISTICS | 3054 | #ifdef GDTH_STATISTICS |
3093 | ++act_ints; | 3055 | ++act_ints; |
@@ -3233,10 +3195,10 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id) | |||
3233 | 3195 | ||
3234 | if (IStatus == ASYNCINDEX) { | 3196 | if (IStatus == ASYNCINDEX) { |
3235 | TRACE2(("gdth_interrupt() async. event\n")); | 3197 | TRACE2(("gdth_interrupt() async. event\n")); |
3236 | gdth_async_event(hanum); | 3198 | gdth_async_event(ha); |
3237 | if (!gdth_polling) | 3199 | if (!gdth_polling) |
3238 | spin_unlock_irqrestore(&ha2->smp_lock, flags); | 3200 | spin_unlock_irqrestore(&ha2->smp_lock, flags); |
3239 | gdth_next(hanum); | 3201 | gdth_next(ha); |
3240 | return IRQ_HANDLED; | 3202 | return IRQ_HANDLED; |
3241 | } | 3203 | } |
3242 | 3204 | ||
@@ -3270,11 +3232,11 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id) | |||
3270 | } | 3232 | } |
3271 | 3233 | ||
3272 | TRACE(("gdth_interrupt() sync. status\n")); | 3234 | TRACE(("gdth_interrupt() sync. status\n")); |
3273 | rval = gdth_sync_event(hanum,Service,IStatus,scp); | 3235 | rval = gdth_sync_event(ha,Service,IStatus,scp); |
3274 | if (!gdth_polling) | 3236 | if (!gdth_polling) |
3275 | spin_unlock_irqrestore(&ha2->smp_lock, flags); | 3237 | spin_unlock_irqrestore(&ha2->smp_lock, flags); |
3276 | if (rval == 2) { | 3238 | if (rval == 2) { |
3277 | gdth_putq(hanum,scp,scp->SCp.this_residual); | 3239 | gdth_putq(ha, scp,scp->SCp.this_residual); |
3278 | } else if (rval == 1) { | 3240 | } else if (rval == 1) { |
3279 | gdth_scsi_done(scp); | 3241 | gdth_scsi_done(scp); |
3280 | } | 3242 | } |
@@ -3304,18 +3266,17 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id) | |||
3304 | } | 3266 | } |
3305 | #endif | 3267 | #endif |
3306 | 3268 | ||
3307 | gdth_next(hanum); | 3269 | gdth_next(ha); |
3308 | return IRQ_HANDLED; | 3270 | return IRQ_HANDLED; |
3309 | } | 3271 | } |
3310 | 3272 | ||
3311 | static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp) | 3273 | static int gdth_sync_event(gdth_ha_str *ha, int service, unchar index, |
3274 | Scsi_Cmnd *scp) | ||
3312 | { | 3275 | { |
3313 | register gdth_ha_str *ha; | ||
3314 | gdth_msg_str *msg; | 3276 | gdth_msg_str *msg; |
3315 | gdth_cmd_str *cmdp; | 3277 | gdth_cmd_str *cmdp; |
3316 | unchar b, t; | 3278 | unchar b, t; |
3317 | 3279 | ||
3318 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
3319 | cmdp = ha->pccb; | 3280 | cmdp = ha->pccb; |
3320 | TRACE(("gdth_sync_event() serv %d status %d\n", | 3281 | TRACE(("gdth_sync_event() serv %d status %d\n", |
3321 | service,ha->status)); | 3282 | service,ha->status)); |
@@ -3333,12 +3294,12 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp) | |||
3333 | } | 3294 | } |
3334 | 3295 | ||
3335 | if (msg->msg_ext && !msg->msg_answer) { | 3296 | if (msg->msg_ext && !msg->msg_answer) { |
3336 | while (gdth_test_busy(hanum)) | 3297 | while (gdth_test_busy(ha)) |
3337 | gdth_delay(0); | 3298 | gdth_delay(0); |
3338 | cmdp->Service = SCREENSERVICE; | 3299 | cmdp->Service = SCREENSERVICE; |
3339 | cmdp->RequestBuffer = SCREEN_CMND; | 3300 | cmdp->RequestBuffer = SCREEN_CMND; |
3340 | gdth_get_cmd_index(hanum); | 3301 | gdth_get_cmd_index(ha); |
3341 | gdth_set_sema0(hanum); | 3302 | gdth_set_sema0(ha); |
3342 | cmdp->OpCode = GDT_READ; | 3303 | cmdp->OpCode = GDT_READ; |
3343 | cmdp->BoardNode = LOCALBOARD; | 3304 | cmdp->BoardNode = LOCALBOARD; |
3344 | cmdp->u.screen.reserved = 0; | 3305 | cmdp->u.screen.reserved = 0; |
@@ -3348,8 +3309,8 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp) | |||
3348 | ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) | 3309 | ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) |
3349 | + sizeof(ulong64); | 3310 | + sizeof(ulong64); |
3350 | ha->cmd_cnt = 0; | 3311 | ha->cmd_cnt = 0; |
3351 | gdth_copy_command(hanum); | 3312 | gdth_copy_command(ha); |
3352 | gdth_release_event(hanum); | 3313 | gdth_release_event(ha); |
3353 | return 0; | 3314 | return 0; |
3354 | } | 3315 | } |
3355 | 3316 | ||
@@ -3367,12 +3328,12 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp) | |||
3367 | } | 3328 | } |
3368 | msg->msg_ext = 0; | 3329 | msg->msg_ext = 0; |
3369 | msg->msg_answer = 0; | 3330 | msg->msg_answer = 0; |
3370 | while (gdth_test_busy(hanum)) | 3331 | while (gdth_test_busy(ha)) |
3371 | gdth_delay(0); | 3332 | gdth_delay(0); |
3372 | cmdp->Service = SCREENSERVICE; | 3333 | cmdp->Service = SCREENSERVICE; |
3373 | cmdp->RequestBuffer = SCREEN_CMND; | 3334 | cmdp->RequestBuffer = SCREEN_CMND; |
3374 | gdth_get_cmd_index(hanum); | 3335 | gdth_get_cmd_index(ha); |
3375 | gdth_set_sema0(hanum); | 3336 | gdth_set_sema0(ha); |
3376 | cmdp->OpCode = GDT_WRITE; | 3337 | cmdp->OpCode = GDT_WRITE; |
3377 | cmdp->BoardNode = LOCALBOARD; | 3338 | cmdp->BoardNode = LOCALBOARD; |
3378 | cmdp->u.screen.reserved = 0; | 3339 | cmdp->u.screen.reserved = 0; |
@@ -3382,8 +3343,8 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp) | |||
3382 | ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) | 3343 | ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) |
3383 | + sizeof(ulong64); | 3344 | + sizeof(ulong64); |
3384 | ha->cmd_cnt = 0; | 3345 | ha->cmd_cnt = 0; |
3385 | gdth_copy_command(hanum); | 3346 | gdth_copy_command(ha); |
3386 | gdth_release_event(hanum); | 3347 | gdth_release_event(ha); |
3387 | return 0; | 3348 | return 0; |
3388 | } | 3349 | } |
3389 | printk("\n"); | 3350 | printk("\n"); |
@@ -3496,7 +3457,7 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp) | |||
3496 | } | 3457 | } |
3497 | if (!IS_GDTH_INTERNAL_CMD(scp)) { | 3458 | if (!IS_GDTH_INTERNAL_CMD(scp)) { |
3498 | ha->dvr.size = sizeof(ha->dvr.eu.sync); | 3459 | ha->dvr.size = sizeof(ha->dvr.eu.sync); |
3499 | ha->dvr.eu.sync.ionode = hanum; | 3460 | ha->dvr.eu.sync.ionode = ha->hanum; |
3500 | ha->dvr.eu.sync.service = service; | 3461 | ha->dvr.eu.sync.service = service; |
3501 | ha->dvr.eu.sync.status = ha->status; | 3462 | ha->dvr.eu.sync.status = ha->status; |
3502 | ha->dvr.eu.sync.info = ha->info; | 3463 | ha->dvr.eu.sync.info = ha->info; |
@@ -3680,25 +3641,23 @@ static char *async_cache_tab[] = { | |||
3680 | }; | 3641 | }; |
3681 | 3642 | ||
3682 | 3643 | ||
3683 | static int gdth_async_event(int hanum) | 3644 | static int gdth_async_event(gdth_ha_str *ha) |
3684 | { | 3645 | { |
3685 | gdth_ha_str *ha; | ||
3686 | gdth_cmd_str *cmdp; | 3646 | gdth_cmd_str *cmdp; |
3687 | int cmd_index; | 3647 | int cmd_index; |
3688 | 3648 | ||
3689 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
3690 | cmdp= ha->pccb; | 3649 | cmdp= ha->pccb; |
3691 | TRACE2(("gdth_async_event() ha %d serv %d\n", | 3650 | TRACE2(("gdth_async_event() ha %d serv %d\n", |
3692 | hanum,ha->service)); | 3651 | ha->hanum, ha->service)); |
3693 | 3652 | ||
3694 | if (ha->service == SCREENSERVICE) { | 3653 | if (ha->service == SCREENSERVICE) { |
3695 | if (ha->status == MSG_REQUEST) { | 3654 | if (ha->status == MSG_REQUEST) { |
3696 | while (gdth_test_busy(hanum)) | 3655 | while (gdth_test_busy(ha)) |
3697 | gdth_delay(0); | 3656 | gdth_delay(0); |
3698 | cmdp->Service = SCREENSERVICE; | 3657 | cmdp->Service = SCREENSERVICE; |
3699 | cmdp->RequestBuffer = SCREEN_CMND; | 3658 | cmdp->RequestBuffer = SCREEN_CMND; |
3700 | cmd_index = gdth_get_cmd_index(hanum); | 3659 | cmd_index = gdth_get_cmd_index(ha); |
3701 | gdth_set_sema0(hanum); | 3660 | gdth_set_sema0(ha); |
3702 | cmdp->OpCode = GDT_READ; | 3661 | cmdp->OpCode = GDT_READ; |
3703 | cmdp->BoardNode = LOCALBOARD; | 3662 | cmdp->BoardNode = LOCALBOARD; |
3704 | cmdp->u.screen.reserved = 0; | 3663 | cmdp->u.screen.reserved = 0; |
@@ -3708,7 +3667,7 @@ static int gdth_async_event(int hanum) | |||
3708 | ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) | 3667 | ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) |
3709 | + sizeof(ulong64); | 3668 | + sizeof(ulong64); |
3710 | ha->cmd_cnt = 0; | 3669 | ha->cmd_cnt = 0; |
3711 | gdth_copy_command(hanum); | 3670 | gdth_copy_command(ha); |
3712 | if (ha->type == GDT_EISA) | 3671 | if (ha->type == GDT_EISA) |
3713 | printk("[EISA slot %d] ",(ushort)ha->brd_phys); | 3672 | printk("[EISA slot %d] ",(ushort)ha->brd_phys); |
3714 | else if (ha->type == GDT_ISA) | 3673 | else if (ha->type == GDT_ISA) |
@@ -3716,19 +3675,19 @@ static int gdth_async_event(int hanum) | |||
3716 | else | 3675 | else |
3717 | printk("[PCI %d/%d] ",(ushort)(ha->brd_phys>>8), | 3676 | printk("[PCI %d/%d] ",(ushort)(ha->brd_phys>>8), |
3718 | (ushort)((ha->brd_phys>>3)&0x1f)); | 3677 | (ushort)((ha->brd_phys>>3)&0x1f)); |
3719 | gdth_release_event(hanum); | 3678 | gdth_release_event(ha); |
3720 | } | 3679 | } |
3721 | 3680 | ||
3722 | } else { | 3681 | } else { |
3723 | if (ha->type == GDT_PCIMPR && | 3682 | if (ha->type == GDT_PCIMPR && |
3724 | (ha->fw_vers & 0xff) >= 0x1a) { | 3683 | (ha->fw_vers & 0xff) >= 0x1a) { |
3725 | ha->dvr.size = 0; | 3684 | ha->dvr.size = 0; |
3726 | ha->dvr.eu.async.ionode = hanum; | 3685 | ha->dvr.eu.async.ionode = ha->hanum; |
3727 | ha->dvr.eu.async.status = ha->status; | 3686 | ha->dvr.eu.async.status = ha->status; |
3728 | /* severity and event_string already set! */ | 3687 | /* severity and event_string already set! */ |
3729 | } else { | 3688 | } else { |
3730 | ha->dvr.size = sizeof(ha->dvr.eu.async); | 3689 | ha->dvr.size = sizeof(ha->dvr.eu.async); |
3731 | ha->dvr.eu.async.ionode = hanum; | 3690 | ha->dvr.eu.async.ionode = ha->hanum; |
3732 | ha->dvr.eu.async.service = ha->service; | 3691 | ha->dvr.eu.async.service = ha->service; |
3733 | ha->dvr.eu.async.status = ha->status; | 3692 | ha->dvr.eu.async.status = ha->status; |
3734 | ha->dvr.eu.async.info = ha->info; | 3693 | ha->dvr.eu.async.info = ha->info; |
@@ -3810,9 +3769,8 @@ static void gdth_timeout(ulong data) | |||
3810 | Scsi_Cmnd *nscp; | 3769 | Scsi_Cmnd *nscp; |
3811 | gdth_ha_str *ha; | 3770 | gdth_ha_str *ha; |
3812 | ulong flags; | 3771 | ulong flags; |
3813 | int hanum = 0; | ||
3814 | 3772 | ||
3815 | ha = HADATA(gdth_ctr_tab[hanum]); | 3773 | ha = shost_priv(gdth_ctr_tab[0]); |
3816 | spin_lock_irqsave(&ha->smp_lock, flags); | 3774 | spin_lock_irqsave(&ha->smp_lock, flags); |
3817 | 3775 | ||
3818 | for (act_stats=0,i=0; i<GDTH_MAXCMDS; ++i) | 3776 | for (act_stats=0,i=0; i<GDTH_MAXCMDS; ++i) |
@@ -4012,17 +3970,14 @@ static int __init gdth_detect(struct scsi_host_template *shtp) | |||
4012 | 3970 | ||
4013 | static int gdth_release(struct Scsi_Host *shp) | 3971 | static int gdth_release(struct Scsi_Host *shp) |
4014 | { | 3972 | { |
4015 | int hanum; | 3973 | gdth_ha_str *ha = shost_priv(shp); |
4016 | gdth_ha_str *ha; | ||
4017 | 3974 | ||
4018 | TRACE2(("gdth_release()\n")); | 3975 | TRACE2(("gdth_release()\n")); |
4019 | hanum = NUMDATA(shp)->hanum; | ||
4020 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
4021 | if (ha->sdev) { | 3976 | if (ha->sdev) { |
4022 | scsi_free_host_dev(ha->sdev); | 3977 | scsi_free_host_dev(ha->sdev); |
4023 | ha->sdev = NULL; | 3978 | ha->sdev = NULL; |
4024 | } | 3979 | } |
4025 | gdth_flush(hanum); | 3980 | gdth_flush(ha); |
4026 | 3981 | ||
4027 | if (shp->irq) { | 3982 | if (shp->irq) { |
4028 | free_irq(shp->irq,ha); | 3983 | free_irq(shp->irq,ha); |
@@ -4063,14 +4018,10 @@ static int gdth_release(struct Scsi_Host *shp) | |||
4063 | } | 4018 | } |
4064 | 4019 | ||
4065 | 4020 | ||
4066 | static const char *gdth_ctr_name(int hanum) | 4021 | static const char *gdth_ctr_name(gdth_ha_str *ha) |
4067 | { | 4022 | { |
4068 | gdth_ha_str *ha; | ||
4069 | |||
4070 | TRACE2(("gdth_ctr_name()\n")); | 4023 | TRACE2(("gdth_ctr_name()\n")); |
4071 | 4024 | ||
4072 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
4073 | |||
4074 | if (ha->type == GDT_EISA) { | 4025 | if (ha->type == GDT_EISA) { |
4075 | switch (ha->stype) { | 4026 | switch (ha->stype) { |
4076 | case GDT3_ID: | 4027 | case GDT3_ID: |
@@ -4097,29 +4048,23 @@ static const char *gdth_ctr_name(int hanum) | |||
4097 | 4048 | ||
4098 | static const char *gdth_info(struct Scsi_Host *shp) | 4049 | static const char *gdth_info(struct Scsi_Host *shp) |
4099 | { | 4050 | { |
4100 | int hanum; | 4051 | gdth_ha_str *ha = shost_priv(shp); |
4101 | gdth_ha_str *ha; | ||
4102 | 4052 | ||
4103 | TRACE2(("gdth_info()\n")); | 4053 | TRACE2(("gdth_info()\n")); |
4104 | hanum = NUMDATA(shp)->hanum; | ||
4105 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
4106 | |||
4107 | return ((const char *)ha->binfo.type_string); | 4054 | return ((const char *)ha->binfo.type_string); |
4108 | } | 4055 | } |
4109 | 4056 | ||
4110 | static int gdth_eh_bus_reset(Scsi_Cmnd *scp) | 4057 | static int gdth_eh_bus_reset(Scsi_Cmnd *scp) |
4111 | { | 4058 | { |
4112 | int i, hanum; | 4059 | gdth_ha_str *ha = shost_priv(scp->device->host); |
4113 | gdth_ha_str *ha; | 4060 | int i; |
4114 | ulong flags; | 4061 | ulong flags; |
4115 | Scsi_Cmnd *cmnd; | 4062 | Scsi_Cmnd *cmnd; |
4116 | unchar b; | 4063 | unchar b; |
4117 | 4064 | ||
4118 | TRACE2(("gdth_eh_bus_reset()\n")); | 4065 | TRACE2(("gdth_eh_bus_reset()\n")); |
4119 | 4066 | ||
4120 | hanum = NUMDATA(scp->device->host)->hanum; | ||
4121 | b = scp->device->channel; | 4067 | b = scp->device->channel; |
4122 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
4123 | 4068 | ||
4124 | /* clear command tab */ | 4069 | /* clear command tab */ |
4125 | spin_lock_irqsave(&ha->smp_lock, flags); | 4070 | spin_lock_irqsave(&ha->smp_lock, flags); |
@@ -4136,9 +4081,9 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *scp) | |||
4136 | if (ha->hdr[i].present) { | 4081 | if (ha->hdr[i].present) { |
4137 | spin_lock_irqsave(&ha->smp_lock, flags); | 4082 | spin_lock_irqsave(&ha->smp_lock, flags); |
4138 | gdth_polling = TRUE; | 4083 | gdth_polling = TRUE; |
4139 | while (gdth_test_busy(hanum)) | 4084 | while (gdth_test_busy(ha)) |
4140 | gdth_delay(0); | 4085 | gdth_delay(0); |
4141 | if (gdth_internal_cmd(hanum, CACHESERVICE, | 4086 | if (gdth_internal_cmd(ha, CACHESERVICE, |
4142 | GDT_CLUST_RESET, i, 0, 0)) | 4087 | GDT_CLUST_RESET, i, 0, 0)) |
4143 | ha->hdr[i].cluster_type &= ~CLUSTER_RESERVED; | 4088 | ha->hdr[i].cluster_type &= ~CLUSTER_RESERVED; |
4144 | gdth_polling = FALSE; | 4089 | gdth_polling = FALSE; |
@@ -4151,9 +4096,9 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *scp) | |||
4151 | for (i = 0; i < MAXID; ++i) | 4096 | for (i = 0; i < MAXID; ++i) |
4152 | ha->raw[BUS_L2P(ha,b)].io_cnt[i] = 0; | 4097 | ha->raw[BUS_L2P(ha,b)].io_cnt[i] = 0; |
4153 | gdth_polling = TRUE; | 4098 | gdth_polling = TRUE; |
4154 | while (gdth_test_busy(hanum)) | 4099 | while (gdth_test_busy(ha)) |
4155 | gdth_delay(0); | 4100 | gdth_delay(0); |
4156 | gdth_internal_cmd(hanum, SCSIRAWSERVICE, GDT_RESET_BUS, | 4101 | gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESET_BUS, |
4157 | BUS_L2P(ha,b), 0, 0); | 4102 | BUS_L2P(ha,b), 0, 0); |
4158 | gdth_polling = FALSE; | 4103 | gdth_polling = FALSE; |
4159 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 4104 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
@@ -4164,18 +4109,15 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *scp) | |||
4164 | static int gdth_bios_param(struct scsi_device *sdev,struct block_device *bdev,sector_t cap,int *ip) | 4109 | static int gdth_bios_param(struct scsi_device *sdev,struct block_device *bdev,sector_t cap,int *ip) |
4165 | { | 4110 | { |
4166 | unchar b, t; | 4111 | unchar b, t; |
4167 | int hanum; | 4112 | gdth_ha_str *ha = shost_priv(sdev->host); |
4168 | gdth_ha_str *ha; | ||
4169 | struct scsi_device *sd; | 4113 | struct scsi_device *sd; |
4170 | unsigned capacity; | 4114 | unsigned capacity; |
4171 | 4115 | ||
4172 | sd = sdev; | 4116 | sd = sdev; |
4173 | capacity = cap; | 4117 | capacity = cap; |
4174 | hanum = NUMDATA(sd->host)->hanum; | ||
4175 | b = sd->channel; | 4118 | b = sd->channel; |
4176 | t = sd->id; | 4119 | t = sd->id; |
4177 | TRACE2(("gdth_bios_param() ha %d bus %d target %d\n", hanum, b, t)); | 4120 | TRACE2(("gdth_bios_param() ha %d bus %d target %d\n", ha->hanum, b, t)); |
4178 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
4179 | 4121 | ||
4180 | if (b != ha->virt_bus || ha->hdr[t].heads == 0) { | 4122 | if (b != ha->virt_bus || ha->hdr[t].heads == 0) { |
4181 | /* raw device or host drive without mapping information */ | 4123 | /* raw device or host drive without mapping information */ |
@@ -4196,7 +4138,7 @@ static int gdth_bios_param(struct scsi_device *sdev,struct block_device *bdev,se | |||
4196 | static int gdth_queuecommand(struct scsi_cmnd *scp, | 4138 | static int gdth_queuecommand(struct scsi_cmnd *scp, |
4197 | void (*done)(struct scsi_cmnd *)) | 4139 | void (*done)(struct scsi_cmnd *)) |
4198 | { | 4140 | { |
4199 | int hanum; | 4141 | gdth_ha_str *ha = shost_priv(scp->device->host); |
4200 | int priority; | 4142 | int priority; |
4201 | 4143 | ||
4202 | TRACE(("gdth_queuecommand() cmd 0x%x\n", scp->cmnd[0])); | 4144 | TRACE(("gdth_queuecommand() cmd 0x%x\n", scp->cmnd[0])); |
@@ -4208,7 +4150,6 @@ static int gdth_queuecommand(struct scsi_cmnd *scp, | |||
4208 | scp->SCp.Status = GDTH_MAP_NONE; | 4150 | scp->SCp.Status = GDTH_MAP_NONE; |
4209 | scp->SCp.buffer = (struct scatterlist *)NULL; | 4151 | scp->SCp.buffer = (struct scatterlist *)NULL; |
4210 | 4152 | ||
4211 | hanum = NUMDATA(scp->device->host)->hanum; | ||
4212 | #ifdef GDTH_STATISTICS | 4153 | #ifdef GDTH_STATISTICS |
4213 | ++act_ios; | 4154 | ++act_ios; |
4214 | #endif | 4155 | #endif |
@@ -4217,10 +4158,10 @@ static int gdth_queuecommand(struct scsi_cmnd *scp, | |||
4217 | if (IS_GDTH_INTERNAL_CMD(scp)) | 4158 | if (IS_GDTH_INTERNAL_CMD(scp)) |
4218 | priority = scp->SCp.this_residual; | 4159 | priority = scp->SCp.this_residual; |
4219 | else | 4160 | else |
4220 | gdth_update_timeout(hanum, scp, scp->timeout_per_command * 6); | 4161 | gdth_update_timeout(scp, scp->timeout_per_command * 6); |
4221 | 4162 | ||
4222 | gdth_putq( hanum, scp, priority ); | 4163 | gdth_putq(ha, scp, priority); |
4223 | gdth_next( hanum ); | 4164 | gdth_next(ha); |
4224 | return 0; | 4165 | return 0; |
4225 | } | 4166 | } |
4226 | 4167 | ||
@@ -4231,7 +4172,7 @@ static int gdth_open(struct inode *inode, struct file *filep) | |||
4231 | int i; | 4172 | int i; |
4232 | 4173 | ||
4233 | for (i = 0; i < gdth_ctr_count; i++) { | 4174 | for (i = 0; i < gdth_ctr_count; i++) { |
4234 | ha = HADATA(gdth_ctr_tab[i]); | 4175 | ha = shost_priv(gdth_ctr_tab[i]); |
4235 | if (!ha->sdev) | 4176 | if (!ha->sdev) |
4236 | ha->sdev = scsi_get_host_dev(gdth_ctr_tab[i]); | 4177 | ha->sdev = scsi_get_host_dev(gdth_ctr_tab[i]); |
4237 | } | 4178 | } |
@@ -4255,7 +4196,7 @@ static int ioc_event(void __user *arg) | |||
4255 | if (copy_from_user(&evt, arg, sizeof(gdth_ioctl_event)) || | 4196 | if (copy_from_user(&evt, arg, sizeof(gdth_ioctl_event)) || |
4256 | evt.ionode >= gdth_ctr_count) | 4197 | evt.ionode >= gdth_ctr_count) |
4257 | return -EFAULT; | 4198 | return -EFAULT; |
4258 | ha = HADATA(gdth_ctr_tab[evt.ionode]); | 4199 | ha = shost_priv(gdth_ctr_tab[evt.ionode]); |
4259 | 4200 | ||
4260 | if (evt.erase == 0xff) { | 4201 | if (evt.erase == 0xff) { |
4261 | if (evt.event.event_source == ES_TEST) | 4202 | if (evt.event.event_source == ES_TEST) |
@@ -4292,7 +4233,7 @@ static int ioc_lockdrv(void __user *arg) | |||
4292 | if (copy_from_user(&ldrv, arg, sizeof(gdth_ioctl_lockdrv)) || | 4233 | if (copy_from_user(&ldrv, arg, sizeof(gdth_ioctl_lockdrv)) || |
4293 | ldrv.ionode >= gdth_ctr_count) | 4234 | ldrv.ionode >= gdth_ctr_count) |
4294 | return -EFAULT; | 4235 | return -EFAULT; |
4295 | ha = HADATA(gdth_ctr_tab[ldrv.ionode]); | 4236 | ha = shost_priv(gdth_ctr_tab[ldrv.ionode]); |
4296 | 4237 | ||
4297 | for (i = 0; i < ldrv.drive_cnt && i < MAX_HDRIVES; ++i) { | 4238 | for (i = 0; i < ldrv.drive_cnt && i < MAX_HDRIVES; ++i) { |
4298 | j = ldrv.drives[i]; | 4239 | j = ldrv.drives[i]; |
@@ -4302,14 +4243,14 @@ static int ioc_lockdrv(void __user *arg) | |||
4302 | spin_lock_irqsave(&ha->smp_lock, flags); | 4243 | spin_lock_irqsave(&ha->smp_lock, flags); |
4303 | ha->hdr[j].lock = 1; | 4244 | ha->hdr[j].lock = 1; |
4304 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 4245 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
4305 | gdth_wait_completion(ldrv.ionode, ha->bus_cnt, j); | 4246 | gdth_wait_completion(ha, ha->bus_cnt, j); |
4306 | gdth_stop_timeout(ldrv.ionode, ha->bus_cnt, j); | 4247 | gdth_stop_timeout(ha, ha->bus_cnt, j); |
4307 | } else { | 4248 | } else { |
4308 | spin_lock_irqsave(&ha->smp_lock, flags); | 4249 | spin_lock_irqsave(&ha->smp_lock, flags); |
4309 | ha->hdr[j].lock = 0; | 4250 | ha->hdr[j].lock = 0; |
4310 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 4251 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
4311 | gdth_start_timeout(ldrv.ionode, ha->bus_cnt, j); | 4252 | gdth_start_timeout(ha, ha->bus_cnt, j); |
4312 | gdth_next(ldrv.ionode); | 4253 | gdth_next(ha); |
4313 | } | 4254 | } |
4314 | } | 4255 | } |
4315 | return 0; | 4256 | return 0; |
@@ -4319,16 +4260,14 @@ static int ioc_resetdrv(void __user *arg, char *cmnd) | |||
4319 | { | 4260 | { |
4320 | gdth_ioctl_reset res; | 4261 | gdth_ioctl_reset res; |
4321 | gdth_cmd_str cmd; | 4262 | gdth_cmd_str cmd; |
4322 | int hanum; | ||
4323 | gdth_ha_str *ha; | 4263 | gdth_ha_str *ha; |
4324 | int rval; | 4264 | int rval; |
4325 | 4265 | ||
4326 | if (copy_from_user(&res, arg, sizeof(gdth_ioctl_reset)) || | 4266 | if (copy_from_user(&res, arg, sizeof(gdth_ioctl_reset)) || |
4327 | res.ionode >= gdth_ctr_count || res.number >= MAX_HDRIVES) | 4267 | res.ionode >= gdth_ctr_count || res.number >= MAX_HDRIVES) |
4328 | return -EFAULT; | 4268 | return -EFAULT; |
4329 | hanum = res.ionode; | 4269 | ha = shost_priv(gdth_ctr_tab[res.ionode]); |
4330 | ha = HADATA(gdth_ctr_tab[hanum]); | 4270 | |
4331 | |||
4332 | if (!ha->hdr[res.number].present) | 4271 | if (!ha->hdr[res.number].present) |
4333 | return 0; | 4272 | return 0; |
4334 | memset(&cmd, 0, sizeof(gdth_cmd_str)); | 4273 | memset(&cmd, 0, sizeof(gdth_cmd_str)); |
@@ -4354,22 +4293,20 @@ static int ioc_general(void __user *arg, char *cmnd) | |||
4354 | gdth_ioctl_general gen; | 4293 | gdth_ioctl_general gen; |
4355 | char *buf = NULL; | 4294 | char *buf = NULL; |
4356 | ulong64 paddr; | 4295 | ulong64 paddr; |
4357 | int hanum; | ||
4358 | gdth_ha_str *ha; | 4296 | gdth_ha_str *ha; |
4359 | int rval; | 4297 | int rval; |
4360 | 4298 | ||
4361 | if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general)) || | 4299 | if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general)) || |
4362 | gen.ionode >= gdth_ctr_count) | 4300 | gen.ionode >= gdth_ctr_count) |
4363 | return -EFAULT; | 4301 | return -EFAULT; |
4364 | hanum = gen.ionode; | 4302 | ha = shost_priv(gdth_ctr_tab[gen.ionode]); |
4365 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
4366 | if (gen.data_len + gen.sense_len != 0) { | 4303 | if (gen.data_len + gen.sense_len != 0) { |
4367 | if (!(buf = gdth_ioctl_alloc(hanum, gen.data_len + gen.sense_len, | 4304 | if (!(buf = gdth_ioctl_alloc(ha, gen.data_len + gen.sense_len, |
4368 | FALSE, &paddr))) | 4305 | FALSE, &paddr))) |
4369 | return -EFAULT; | 4306 | return -EFAULT; |
4370 | if (copy_from_user(buf, arg + sizeof(gdth_ioctl_general), | 4307 | if (copy_from_user(buf, arg + sizeof(gdth_ioctl_general), |
4371 | gen.data_len + gen.sense_len)) { | 4308 | gen.data_len + gen.sense_len)) { |
4372 | gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); | 4309 | gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
4373 | return -EFAULT; | 4310 | return -EFAULT; |
4374 | } | 4311 | } |
4375 | 4312 | ||
@@ -4443,7 +4380,7 @@ static int ioc_general(void __user *arg, char *cmnd) | |||
4443 | gen.command.u.raw.sense_data = (ulong32)paddr + gen.data_len; | 4380 | gen.command.u.raw.sense_data = (ulong32)paddr + gen.data_len; |
4444 | } | 4381 | } |
4445 | } else { | 4382 | } else { |
4446 | gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); | 4383 | gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
4447 | return -EFAULT; | 4384 | return -EFAULT; |
4448 | } | 4385 | } |
4449 | } | 4386 | } |
@@ -4455,15 +4392,15 @@ static int ioc_general(void __user *arg, char *cmnd) | |||
4455 | 4392 | ||
4456 | if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf, | 4393 | if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf, |
4457 | gen.data_len + gen.sense_len)) { | 4394 | gen.data_len + gen.sense_len)) { |
4458 | gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); | 4395 | gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
4459 | return -EFAULT; | 4396 | return -EFAULT; |
4460 | } | 4397 | } |
4461 | if (copy_to_user(arg, &gen, | 4398 | if (copy_to_user(arg, &gen, |
4462 | sizeof(gdth_ioctl_general) - sizeof(gdth_cmd_str))) { | 4399 | sizeof(gdth_ioctl_general) - sizeof(gdth_cmd_str))) { |
4463 | gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); | 4400 | gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
4464 | return -EFAULT; | 4401 | return -EFAULT; |
4465 | } | 4402 | } |
4466 | gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr); | 4403 | gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
4467 | return 0; | 4404 | return 0; |
4468 | } | 4405 | } |
4469 | 4406 | ||
@@ -4473,7 +4410,7 @@ static int ioc_hdrlist(void __user *arg, char *cmnd) | |||
4473 | gdth_cmd_str *cmd; | 4410 | gdth_cmd_str *cmd; |
4474 | gdth_ha_str *ha; | 4411 | gdth_ha_str *ha; |
4475 | unchar i; | 4412 | unchar i; |
4476 | int hanum, rc = -ENOMEM; | 4413 | int rc = -ENOMEM; |
4477 | u32 cluster_type = 0; | 4414 | u32 cluster_type = 0; |
4478 | 4415 | ||
4479 | rsc = kmalloc(sizeof(*rsc), GFP_KERNEL); | 4416 | rsc = kmalloc(sizeof(*rsc), GFP_KERNEL); |
@@ -4486,8 +4423,7 @@ static int ioc_hdrlist(void __user *arg, char *cmnd) | |||
4486 | rc = -EFAULT; | 4423 | rc = -EFAULT; |
4487 | goto free_fail; | 4424 | goto free_fail; |
4488 | } | 4425 | } |
4489 | hanum = rsc->ionode; | 4426 | ha = shost_priv(gdth_ctr_tab[rsc->ionode]); |
4490 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
4491 | memset(cmd, 0, sizeof(gdth_cmd_str)); | 4427 | memset(cmd, 0, sizeof(gdth_cmd_str)); |
4492 | 4428 | ||
4493 | for (i = 0; i < MAX_HDRIVES; ++i) { | 4429 | for (i = 0; i < MAX_HDRIVES; ++i) { |
@@ -4528,7 +4464,7 @@ static int ioc_rescan(void __user *arg, char *cmnd) | |||
4528 | gdth_cmd_str *cmd; | 4464 | gdth_cmd_str *cmd; |
4529 | ushort i, status, hdr_cnt; | 4465 | ushort i, status, hdr_cnt; |
4530 | ulong32 info; | 4466 | ulong32 info; |
4531 | int hanum, cyls, hds, secs; | 4467 | int cyls, hds, secs; |
4532 | int rc = -ENOMEM; | 4468 | int rc = -ENOMEM; |
4533 | ulong flags; | 4469 | ulong flags; |
4534 | gdth_ha_str *ha; | 4470 | gdth_ha_str *ha; |
@@ -4543,8 +4479,7 @@ static int ioc_rescan(void __user *arg, char *cmnd) | |||
4543 | rc = -EFAULT; | 4479 | rc = -EFAULT; |
4544 | goto free_fail; | 4480 | goto free_fail; |
4545 | } | 4481 | } |
4546 | hanum = rsc->ionode; | 4482 | ha = shost_priv(gdth_ctr_tab[rsc->ionode]); |
4547 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
4548 | memset(cmd, 0, sizeof(gdth_cmd_str)); | 4483 | memset(cmd, 0, sizeof(gdth_cmd_str)); |
4549 | 4484 | ||
4550 | if (rsc->flag == 0) { | 4485 | if (rsc->flag == 0) { |
@@ -4703,7 +4638,7 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, | |||
4703 | if (copy_from_user(&ctrt, argp, sizeof(gdth_ioctl_ctrtype)) || | 4638 | if (copy_from_user(&ctrt, argp, sizeof(gdth_ioctl_ctrtype)) || |
4704 | ctrt.ionode >= gdth_ctr_count) | 4639 | ctrt.ionode >= gdth_ctr_count) |
4705 | return -EFAULT; | 4640 | return -EFAULT; |
4706 | ha = HADATA(gdth_ctr_tab[ctrt.ionode]); | 4641 | ha = shost_priv(gdth_ctr_tab[ctrt.ionode]); |
4707 | if (ha->type == GDT_ISA || ha->type == GDT_EISA) { | 4642 | if (ha->type == GDT_ISA || ha->type == GDT_EISA) { |
4708 | ctrt.type = (unchar)((ha->stype>>20) - 0x10); | 4643 | ctrt.type = (unchar)((ha->stype>>20) - 0x10); |
4709 | } else { | 4644 | } else { |
@@ -4744,7 +4679,7 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, | |||
4744 | if (copy_from_user(&lchn, argp, sizeof(gdth_ioctl_lockchn)) || | 4679 | if (copy_from_user(&lchn, argp, sizeof(gdth_ioctl_lockchn)) || |
4745 | lchn.ionode >= gdth_ctr_count) | 4680 | lchn.ionode >= gdth_ctr_count) |
4746 | return -EFAULT; | 4681 | return -EFAULT; |
4747 | ha = HADATA(gdth_ctr_tab[lchn.ionode]); | 4682 | ha = shost_priv(gdth_ctr_tab[lchn.ionode]); |
4748 | 4683 | ||
4749 | i = lchn.channel; | 4684 | i = lchn.channel; |
4750 | if (i < ha->bus_cnt) { | 4685 | if (i < ha->bus_cnt) { |
@@ -4753,16 +4688,16 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, | |||
4753 | ha->raw[i].lock = 1; | 4688 | ha->raw[i].lock = 1; |
4754 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 4689 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
4755 | for (j = 0; j < ha->tid_cnt; ++j) { | 4690 | for (j = 0; j < ha->tid_cnt; ++j) { |
4756 | gdth_wait_completion(lchn.ionode, i, j); | 4691 | gdth_wait_completion(ha, i, j); |
4757 | gdth_stop_timeout(lchn.ionode, i, j); | 4692 | gdth_stop_timeout(ha, i, j); |
4758 | } | 4693 | } |
4759 | } else { | 4694 | } else { |
4760 | spin_lock_irqsave(&ha->smp_lock, flags); | 4695 | spin_lock_irqsave(&ha->smp_lock, flags); |
4761 | ha->raw[i].lock = 0; | 4696 | ha->raw[i].lock = 0; |
4762 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 4697 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
4763 | for (j = 0; j < ha->tid_cnt; ++j) { | 4698 | for (j = 0; j < ha->tid_cnt; ++j) { |
4764 | gdth_start_timeout(lchn.ionode, i, j); | 4699 | gdth_start_timeout(ha, i, j); |
4765 | gdth_next(lchn.ionode); | 4700 | gdth_next(ha); |
4766 | } | 4701 | } |
4767 | } | 4702 | } |
4768 | } | 4703 | } |
@@ -4778,13 +4713,12 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, | |||
4778 | case GDTIOCTL_RESET_BUS: | 4713 | case GDTIOCTL_RESET_BUS: |
4779 | { | 4714 | { |
4780 | gdth_ioctl_reset res; | 4715 | gdth_ioctl_reset res; |
4781 | int hanum, rval; | 4716 | int rval; |
4782 | 4717 | ||
4783 | if (copy_from_user(&res, argp, sizeof(gdth_ioctl_reset)) || | 4718 | if (copy_from_user(&res, argp, sizeof(gdth_ioctl_reset)) || |
4784 | res.ionode >= gdth_ctr_count) | 4719 | res.ionode >= gdth_ctr_count) |
4785 | return -EFAULT; | 4720 | return -EFAULT; |
4786 | hanum = res.ionode; | 4721 | ha = shost_priv(gdth_ctr_tab[res.ionode]); |
4787 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
4788 | 4722 | ||
4789 | scp = kzalloc(sizeof(*scp), GFP_KERNEL); | 4723 | scp = kzalloc(sizeof(*scp), GFP_KERNEL); |
4790 | if (!scp) | 4724 | if (!scp) |
@@ -4813,16 +4747,14 @@ static int gdth_ioctl(struct inode *inode, struct file *filep, | |||
4813 | 4747 | ||
4814 | 4748 | ||
4815 | /* flush routine */ | 4749 | /* flush routine */ |
4816 | static void gdth_flush(int hanum) | 4750 | static void gdth_flush(gdth_ha_str *ha) |
4817 | { | 4751 | { |
4818 | int i; | 4752 | int i; |
4819 | gdth_ha_str *ha; | ||
4820 | gdth_cmd_str gdtcmd; | 4753 | gdth_cmd_str gdtcmd; |
4821 | char cmnd[MAX_COMMAND_SIZE]; | 4754 | char cmnd[MAX_COMMAND_SIZE]; |
4822 | memset(cmnd, 0xff, MAX_COMMAND_SIZE); | 4755 | memset(cmnd, 0xff, MAX_COMMAND_SIZE); |
4823 | 4756 | ||
4824 | TRACE2(("gdth_flush() hanum %d\n",hanum)); | 4757 | TRACE2(("gdth_flush() hanum %d\n", ha->hanum)); |
4825 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
4826 | 4758 | ||
4827 | for (i = 0; i < MAX_HDRIVES; ++i) { | 4759 | for (i = 0; i < MAX_HDRIVES; ++i) { |
4828 | if (ha->hdr[i].present) { | 4760 | if (ha->hdr[i].present) { |
@@ -4838,9 +4770,9 @@ static void gdth_flush(int hanum) | |||
4838 | gdtcmd.u.cache.BlockNo = 1; | 4770 | gdtcmd.u.cache.BlockNo = 1; |
4839 | gdtcmd.u.cache.sg_canz = 0; | 4771 | gdtcmd.u.cache.sg_canz = 0; |
4840 | } | 4772 | } |
4841 | TRACE2(("gdth_flush(): flush ha %d drive %d\n", hanum, i)); | 4773 | TRACE2(("gdth_flush(): flush ha %d drive %d\n", ha->hanum, i)); |
4842 | 4774 | ||
4843 | gdth_execute(gdth_ctr_tab[hanum], &gdtcmd, cmnd, 30, NULL); | 4775 | gdth_execute(ha->shost, &gdtcmd, cmnd, 30, NULL); |
4844 | } | 4776 | } |
4845 | } | 4777 | } |
4846 | } | 4778 | } |
@@ -4864,7 +4796,8 @@ static int gdth_halt(struct notifier_block *nb, ulong event, void *buf) | |||
4864 | notifier_disabled = 1; | 4796 | notifier_disabled = 1; |
4865 | printk("GDT-HA: Flushing all host drives .. "); | 4797 | printk("GDT-HA: Flushing all host drives .. "); |
4866 | for (hanum = 0; hanum < gdth_ctr_count; ++hanum) { | 4798 | for (hanum = 0; hanum < gdth_ctr_count; ++hanum) { |
4867 | gdth_flush(hanum); | 4799 | gdth_ha_str *ha = shost_priv(gdth_ctr_tab[hanum]); |
4800 | gdth_flush(ha); | ||
4868 | 4801 | ||
4869 | #ifndef __alpha__ | 4802 | #ifndef __alpha__ |
4870 | /* controller reset */ | 4803 | /* controller reset */ |
@@ -4872,8 +4805,8 @@ static int gdth_halt(struct notifier_block *nb, ulong event, void *buf) | |||
4872 | gdtcmd.BoardNode = LOCALBOARD; | 4805 | gdtcmd.BoardNode = LOCALBOARD; |
4873 | gdtcmd.Service = CACHESERVICE; | 4806 | gdtcmd.Service = CACHESERVICE; |
4874 | gdtcmd.OpCode = GDT_RESET; | 4807 | gdtcmd.OpCode = GDT_RESET; |
4875 | TRACE2(("gdth_halt(): reset controller %d\n", hanum)); | 4808 | TRACE2(("gdth_halt(): reset controller %d\n", ha->hanum)); |
4876 | gdth_execute(gdth_ctr_tab[hanum], &gdtcmd, cmnd, 10, NULL); | 4809 | gdth_execute(ha->shost, &gdtcmd, cmnd, 10, NULL); |
4877 | #endif | 4810 | #endif |
4878 | } | 4811 | } |
4879 | printk("Done.\n"); | 4812 | printk("Done.\n"); |
@@ -4923,10 +4856,10 @@ static int gdth_isa_probe_one(struct scsi_host_template *shtp, ulong32 isa_bios) | |||
4923 | if (!gdth_search_isa(isa_bios)) | 4856 | if (!gdth_search_isa(isa_bios)) |
4924 | return -ENXIO; | 4857 | return -ENXIO; |
4925 | 4858 | ||
4926 | shp = scsi_register(shtp, sizeof(gdth_ext_str)); | 4859 | shp = scsi_register(shtp, sizeof(gdth_ha_str)); |
4927 | if (!shp) | 4860 | if (!shp) |
4928 | return -ENOMEM; | 4861 | return -ENOMEM; |
4929 | ha = HADATA(shp); | 4862 | ha = shost_priv(shp); |
4930 | 4863 | ||
4931 | error = -ENODEV; | 4864 | error = -ENODEV; |
4932 | if (!gdth_init_isa(isa_bios,ha)) | 4865 | if (!gdth_init_isa(isa_bios,ha)) |
@@ -4956,9 +4889,10 @@ static int gdth_isa_probe_one(struct scsi_host_template *shtp, ulong32 isa_bios) | |||
4956 | hanum = gdth_ctr_count; | 4889 | hanum = gdth_ctr_count; |
4957 | gdth_ctr_tab[gdth_ctr_count++] = shp; | 4890 | gdth_ctr_tab[gdth_ctr_count++] = shp; |
4958 | 4891 | ||
4959 | NUMDATA(shp)->hanum = (ushort)hanum; | 4892 | ha->hanum = (ushort)hanum; |
4893 | ha->shost = shp; | ||
4960 | 4894 | ||
4961 | ha->pccb = CMDDATA(shp); | 4895 | ha->pccb = &ha->cmdext; |
4962 | ha->ccb_phys = 0L; | 4896 | ha->ccb_phys = 0L; |
4963 | ha->pdev = NULL; | 4897 | ha->pdev = NULL; |
4964 | 4898 | ||
@@ -4995,7 +4929,7 @@ static int gdth_isa_probe_one(struct scsi_host_template *shtp, ulong32 isa_bios) | |||
4995 | ha->scan_mode = rescan ? 0x10 : 0; | 4929 | ha->scan_mode = rescan ? 0x10 : 0; |
4996 | 4930 | ||
4997 | error = -ENODEV; | 4931 | error = -ENODEV; |
4998 | if (!gdth_search_drives(hanum)) { | 4932 | if (!gdth_search_drives(ha)) { |
4999 | printk("GDT-ISA: Error during device scan\n"); | 4933 | printk("GDT-ISA: Error during device scan\n"); |
5000 | goto out_free_coal_stat; | 4934 | goto out_free_coal_stat; |
5001 | } | 4935 | } |
@@ -5012,7 +4946,7 @@ static int gdth_isa_probe_one(struct scsi_host_template *shtp, ulong32 isa_bios) | |||
5012 | shp->max_channel = ha->bus_cnt; | 4946 | shp->max_channel = ha->bus_cnt; |
5013 | 4947 | ||
5014 | spin_lock_init(&ha->smp_lock); | 4948 | spin_lock_init(&ha->smp_lock); |
5015 | gdth_enable_int(hanum); | 4949 | gdth_enable_int(ha); |
5016 | 4950 | ||
5017 | return 0; | 4951 | return 0; |
5018 | 4952 | ||
@@ -5049,10 +4983,10 @@ static int gdth_eisa_probe_one(struct scsi_host_template *shtp, | |||
5049 | if (!gdth_search_eisa(eisa_slot)) | 4983 | if (!gdth_search_eisa(eisa_slot)) |
5050 | return -ENXIO; | 4984 | return -ENXIO; |
5051 | 4985 | ||
5052 | shp = scsi_register(shtp,sizeof(gdth_ext_str)); | 4986 | shp = scsi_register(shtp,sizeof(gdth_ha_str)); |
5053 | if (!shp) | 4987 | if (!shp) |
5054 | return -ENOMEM; | 4988 | return -ENOMEM; |
5055 | ha = HADATA(shp); | 4989 | ha = shost_priv(shp); |
5056 | 4990 | ||
5057 | error = -ENODEV; | 4991 | error = -ENODEV; |
5058 | if (!gdth_init_eisa(eisa_slot,ha)) | 4992 | if (!gdth_init_eisa(eisa_slot,ha)) |
@@ -5074,11 +5008,12 @@ static int gdth_eisa_probe_one(struct scsi_host_template *shtp, | |||
5074 | hanum = gdth_ctr_count; | 5008 | hanum = gdth_ctr_count; |
5075 | gdth_ctr_tab[gdth_ctr_count++] = shp; | 5009 | gdth_ctr_tab[gdth_ctr_count++] = shp; |
5076 | 5010 | ||
5077 | NUMDATA(shp)->hanum = (ushort)hanum; | 5011 | ha->hanum = (ushort)hanum; |
5078 | TRACE2(("EISA detect Bus 0: hanum %d\n", | 5012 | ha->shost = shp; |
5079 | NUMDATA(shp)->hanum)); | 5013 | |
5014 | TRACE2(("EISA detect Bus 0: hanum %d\n", ha->hanum)); | ||
5080 | 5015 | ||
5081 | ha->pccb = CMDDATA(shp); | 5016 | ha->pccb = &ha->cmdext; |
5082 | ha->ccb_phys = 0L; | 5017 | ha->ccb_phys = 0L; |
5083 | 5018 | ||
5084 | error = -ENOMEM; | 5019 | error = -ENOMEM; |
@@ -5119,7 +5054,7 @@ static int gdth_eisa_probe_one(struct scsi_host_template *shtp, | |||
5119 | ha->cmd_tab[i].cmnd = UNUSED_CMND; | 5054 | ha->cmd_tab[i].cmnd = UNUSED_CMND; |
5120 | ha->scan_mode = rescan ? 0x10 : 0; | 5055 | ha->scan_mode = rescan ? 0x10 : 0; |
5121 | 5056 | ||
5122 | if (!gdth_search_drives(hanum)) { | 5057 | if (!gdth_search_drives(ha)) { |
5123 | printk("GDT-EISA: Error during device scan\n"); | 5058 | printk("GDT-EISA: Error during device scan\n"); |
5124 | error = -ENODEV; | 5059 | error = -ENODEV; |
5125 | goto out_free_ccb_phys; | 5060 | goto out_free_ccb_phys; |
@@ -5137,7 +5072,7 @@ static int gdth_eisa_probe_one(struct scsi_host_template *shtp, | |||
5137 | shp->max_channel = ha->bus_cnt; | 5072 | shp->max_channel = ha->bus_cnt; |
5138 | 5073 | ||
5139 | spin_lock_init(&ha->smp_lock); | 5074 | spin_lock_init(&ha->smp_lock); |
5140 | gdth_enable_int(hanum); | 5075 | gdth_enable_int(ha); |
5141 | return 0; | 5076 | return 0; |
5142 | 5077 | ||
5143 | out_free_ccb_phys: | 5078 | out_free_ccb_phys: |
@@ -5172,10 +5107,10 @@ static int gdth_pci_probe_one(struct scsi_host_template *shtp, | |||
5172 | dma_addr_t scratch_dma_handle = 0; | 5107 | dma_addr_t scratch_dma_handle = 0; |
5173 | int error, hanum, i; | 5108 | int error, hanum, i; |
5174 | 5109 | ||
5175 | shp = scsi_register(shtp,sizeof(gdth_ext_str)); | 5110 | shp = scsi_register(shtp,sizeof(gdth_ha_str)); |
5176 | if (!shp) | 5111 | if (!shp) |
5177 | return -ENOMEM; | 5112 | return -ENOMEM; |
5178 | ha = HADATA(shp); | 5113 | ha = shost_priv(shp); |
5179 | 5114 | ||
5180 | error = -ENODEV; | 5115 | error = -ENODEV; |
5181 | if (!gdth_init_pci(&pcistr[ctr],ha)) | 5116 | if (!gdth_init_pci(&pcistr[ctr],ha)) |
@@ -5200,9 +5135,10 @@ static int gdth_pci_probe_one(struct scsi_host_template *shtp, | |||
5200 | hanum = gdth_ctr_count; | 5135 | hanum = gdth_ctr_count; |
5201 | gdth_ctr_tab[gdth_ctr_count++] = shp; | 5136 | gdth_ctr_tab[gdth_ctr_count++] = shp; |
5202 | 5137 | ||
5203 | NUMDATA(shp)->hanum = (ushort)hanum; | 5138 | ha->hanum = (ushort)hanum; |
5139 | ha->shost = shp; | ||
5204 | 5140 | ||
5205 | ha->pccb = CMDDATA(shp); | 5141 | ha->pccb = &ha->cmdext; |
5206 | ha->ccb_phys = 0L; | 5142 | ha->ccb_phys = 0L; |
5207 | 5143 | ||
5208 | error = -ENOMEM; | 5144 | error = -ENOMEM; |
@@ -5238,8 +5174,8 @@ static int gdth_pci_probe_one(struct scsi_host_template *shtp, | |||
5238 | ha->scan_mode = rescan ? 0x10 : 0; | 5174 | ha->scan_mode = rescan ? 0x10 : 0; |
5239 | 5175 | ||
5240 | error = -ENODEV; | 5176 | error = -ENODEV; |
5241 | if (!gdth_search_drives(hanum)) { | 5177 | if (!gdth_search_drives(ha)) { |
5242 | printk("GDT-PCI %d: Error during device scan\n", hanum); | 5178 | printk("GDT-PCI %d: Error during device scan\n", ha->hanum); |
5243 | goto out_free_coal_stat; | 5179 | goto out_free_coal_stat; |
5244 | } | 5180 | } |
5245 | 5181 | ||
@@ -5252,16 +5188,16 @@ static int gdth_pci_probe_one(struct scsi_host_template *shtp, | |||
5252 | !ha->dma64_support) { | 5188 | !ha->dma64_support) { |
5253 | if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) { | 5189 | if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) { |
5254 | printk(KERN_WARNING "GDT-PCI %d: " | 5190 | printk(KERN_WARNING "GDT-PCI %d: " |
5255 | "Unable to set 32-bit DMA\n", hanum); | 5191 | "Unable to set 32-bit DMA\n", ha->hanum); |
5256 | goto out_free_coal_stat; | 5192 | goto out_free_coal_stat; |
5257 | } | 5193 | } |
5258 | } else { | 5194 | } else { |
5259 | shp->max_cmd_len = 16; | 5195 | shp->max_cmd_len = 16; |
5260 | if (!pci_set_dma_mask(pcistr[ctr].pdev, DMA_64BIT_MASK)) { | 5196 | if (!pci_set_dma_mask(pcistr[ctr].pdev, DMA_64BIT_MASK)) { |
5261 | printk("GDT-PCI %d: 64-bit DMA enabled\n", hanum); | 5197 | printk("GDT-PCI %d: 64-bit DMA enabled\n", ha->hanum); |
5262 | } else if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) { | 5198 | } else if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) { |
5263 | printk(KERN_WARNING "GDT-PCI %d: " | 5199 | printk(KERN_WARNING "GDT-PCI %d: " |
5264 | "Unable to set 64/32-bit DMA\n", hanum); | 5200 | "Unable to set 64/32-bit DMA\n", ha->hanum); |
5265 | goto out_free_coal_stat; | 5201 | goto out_free_coal_stat; |
5266 | } | 5202 | } |
5267 | } | 5203 | } |
@@ -5271,7 +5207,7 @@ static int gdth_pci_probe_one(struct scsi_host_template *shtp, | |||
5271 | shp->max_channel = ha->bus_cnt; | 5207 | shp->max_channel = ha->bus_cnt; |
5272 | 5208 | ||
5273 | spin_lock_init(&ha->smp_lock); | 5209 | spin_lock_init(&ha->smp_lock); |
5274 | gdth_enable_int(hanum); | 5210 | gdth_enable_int(ha); |
5275 | return 0; | 5211 | return 0; |
5276 | 5212 | ||
5277 | out_free_coal_stat: | 5213 | out_free_coal_stat: |
diff --git a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h index 68845873cf9d..e8b9eb771d36 100644 --- a/drivers/scsi/gdth.h +++ b/drivers/scsi/gdth.h | |||
@@ -853,6 +853,8 @@ typedef struct { | |||
853 | 853 | ||
854 | /* controller information structure */ | 854 | /* controller information structure */ |
855 | typedef struct { | 855 | typedef struct { |
856 | struct Scsi_Host *shost; | ||
857 | ushort hanum; | ||
856 | ushort oem_id; /* OEM */ | 858 | ushort oem_id; /* OEM */ |
857 | ushort type; /* controller class */ | 859 | ushort type; /* controller class */ |
858 | ulong32 stype; /* subtype (PCI: device ID) */ | 860 | ulong32 stype; /* subtype (PCI: device ID) */ |
@@ -864,6 +866,7 @@ typedef struct { | |||
864 | void __iomem *brd; /* DPRAM address */ | 866 | void __iomem *brd; /* DPRAM address */ |
865 | ulong32 brd_phys; /* slot number/BIOS address */ | 867 | ulong32 brd_phys; /* slot number/BIOS address */ |
866 | gdt6c_plx_regs *plx; /* PLX regs (new PCI contr.) */ | 868 | gdt6c_plx_regs *plx; /* PLX regs (new PCI contr.) */ |
869 | gdth_cmd_str cmdext; | ||
867 | gdth_cmd_str *pccb; /* address command structure */ | 870 | gdth_cmd_str *pccb; /* address command structure */ |
868 | ulong32 ccb_phys; /* phys. address */ | 871 | ulong32 ccb_phys; /* phys. address */ |
869 | #ifdef INT_COAL | 872 | #ifdef INT_COAL |
@@ -937,20 +940,6 @@ typedef struct { | |||
937 | struct scsi_device *sdev; | 940 | struct scsi_device *sdev; |
938 | } gdth_ha_str; | 941 | } gdth_ha_str; |
939 | 942 | ||
940 | /* structure for scsi_register(), SCSI bus != 0 */ | ||
941 | typedef struct { | ||
942 | ushort hanum; | ||
943 | ushort busnum; | ||
944 | } gdth_num_str; | ||
945 | |||
946 | /* structure for scsi_register() */ | ||
947 | typedef struct { | ||
948 | gdth_num_str numext; /* must be the first element */ | ||
949 | gdth_ha_str haext; | ||
950 | gdth_cmd_str cmdext; | ||
951 | } gdth_ext_str; | ||
952 | |||
953 | |||
954 | /* INQUIRY data format */ | 943 | /* INQUIRY data format */ |
955 | typedef struct { | 944 | typedef struct { |
956 | unchar type_qual; | 945 | unchar type_qual; |
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c index b060bd6ffe17..fe070ab991a0 100644 --- a/drivers/scsi/gdth_proc.c +++ b/drivers/scsi/gdth_proc.c | |||
@@ -7,31 +7,29 @@ | |||
7 | int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length, | 7 | int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length, |
8 | int inout) | 8 | int inout) |
9 | { | 9 | { |
10 | int hanum; | 10 | gdth_ha_str *ha = shost_priv(host); |
11 | 11 | ||
12 | TRACE2(("gdth_proc_info() length %d offs %d inout %d\n", | 12 | TRACE2(("gdth_proc_info() length %d offs %d inout %d\n", |
13 | length,(int)offset,inout)); | 13 | length,(int)offset,inout)); |
14 | 14 | ||
15 | hanum = NUMDATA(host)->hanum; | ||
16 | |||
17 | if (inout) | 15 | if (inout) |
18 | return(gdth_set_info(buffer,length,host,hanum)); | 16 | return(gdth_set_info(buffer,length,host,ha)); |
19 | else | 17 | else |
20 | return(gdth_get_info(buffer,start,offset,length,host,hanum)); | 18 | return(gdth_get_info(buffer,start,offset,length,host,ha)); |
21 | } | 19 | } |
22 | 20 | ||
23 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, | 21 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, |
24 | int hanum) | 22 | gdth_ha_str *ha) |
25 | { | 23 | { |
26 | int ret_val = -EINVAL; | 24 | int ret_val = -EINVAL; |
27 | 25 | ||
28 | TRACE2(("gdth_set_info() ha %d\n",hanum,)); | 26 | TRACE2(("gdth_set_info() ha %d\n",ha->hanum,)); |
29 | 27 | ||
30 | if (length >= 4) { | 28 | if (length >= 4) { |
31 | if (strncmp(buffer,"gdth",4) == 0) { | 29 | if (strncmp(buffer,"gdth",4) == 0) { |
32 | buffer += 5; | 30 | buffer += 5; |
33 | length -= 5; | 31 | length -= 5; |
34 | ret_val = gdth_set_asc_info(host, buffer, length, hanum); | 32 | ret_val = gdth_set_asc_info(host, buffer, length, ha); |
35 | } | 33 | } |
36 | } | 34 | } |
37 | 35 | ||
@@ -39,11 +37,10 @@ static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, | |||
39 | } | 37 | } |
40 | 38 | ||
41 | static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | 39 | static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, |
42 | int length,int hanum) | 40 | int length, gdth_ha_str *ha) |
43 | { | 41 | { |
44 | int orig_length, drive, wb_mode; | 42 | int orig_length, drive, wb_mode; |
45 | int i, found; | 43 | int i, found; |
46 | gdth_ha_str *ha; | ||
47 | gdth_cmd_str gdtcmd; | 44 | gdth_cmd_str gdtcmd; |
48 | gdth_cpar_str *pcpar; | 45 | gdth_cpar_str *pcpar; |
49 | ulong64 paddr; | 46 | ulong64 paddr; |
@@ -52,8 +49,7 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
52 | memset(cmnd, 0xff, 12); | 49 | memset(cmnd, 0xff, 12); |
53 | memset(&gdtcmd, 0, sizeof(gdth_cmd_str)); | 50 | memset(&gdtcmd, 0, sizeof(gdth_cmd_str)); |
54 | 51 | ||
55 | TRACE2(("gdth_set_asc_info() ha %d\n",hanum)); | 52 | TRACE2(("gdth_set_asc_info() ha %d\n",ha->hanum)); |
56 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
57 | orig_length = length + 5; | 53 | orig_length = length + 5; |
58 | drive = -1; | 54 | drive = -1; |
59 | wb_mode = 0; | 55 | wb_mode = 0; |
@@ -129,7 +125,7 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
129 | } | 125 | } |
130 | 126 | ||
131 | if (wb_mode) { | 127 | if (wb_mode) { |
132 | if (!gdth_ioctl_alloc(hanum, sizeof(gdth_cpar_str), TRUE, &paddr)) | 128 | if (!gdth_ioctl_alloc(ha, sizeof(gdth_cpar_str), TRUE, &paddr)) |
133 | return(-EBUSY); | 129 | return(-EBUSY); |
134 | pcpar = (gdth_cpar_str *)ha->pscratch; | 130 | pcpar = (gdth_cpar_str *)ha->pscratch; |
135 | memcpy( pcpar, &ha->cpar, sizeof(gdth_cpar_str) ); | 131 | memcpy( pcpar, &ha->cpar, sizeof(gdth_cpar_str) ); |
@@ -143,7 +139,7 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
143 | 139 | ||
144 | gdth_execute(host, &gdtcmd, cmnd, 30, NULL); | 140 | gdth_execute(host, &gdtcmd, cmnd, 30, NULL); |
145 | 141 | ||
146 | gdth_ioctl_free(hanum, GDTH_SCRATCH, ha->pscratch, paddr); | 142 | gdth_ioctl_free(ha, GDTH_SCRATCH, ha->pscratch, paddr); |
147 | printk("Done.\n"); | 143 | printk("Done.\n"); |
148 | return(orig_length); | 144 | return(orig_length); |
149 | } | 145 | } |
@@ -153,11 +149,10 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
153 | } | 149 | } |
154 | 150 | ||
155 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | 151 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, |
156 | struct Scsi_Host *host,int hanum) | 152 | struct Scsi_Host *host, gdth_ha_str *ha) |
157 | { | 153 | { |
158 | int size = 0,len = 0; | 154 | int size = 0,len = 0; |
159 | off_t begin = 0,pos = 0; | 155 | off_t begin = 0,pos = 0; |
160 | gdth_ha_str *ha; | ||
161 | int id, i, j, k, sec, flag; | 156 | int id, i, j, k, sec, flag; |
162 | int no_mdrv = 0, drv_no, is_mirr; | 157 | int no_mdrv = 0, drv_no, is_mirr; |
163 | ulong32 cnt; | 158 | ulong32 cnt; |
@@ -186,8 +181,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
186 | memset(cmnd, 0xff, 12); | 181 | memset(cmnd, 0xff, 12); |
187 | memset(gdtcmd, 0, sizeof(gdth_cmd_str)); | 182 | memset(gdtcmd, 0, sizeof(gdth_cmd_str)); |
188 | 183 | ||
189 | TRACE2(("gdth_get_info() ha %d\n",hanum)); | 184 | TRACE2(("gdth_get_info() ha %d\n",ha->hanum)); |
190 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
191 | 185 | ||
192 | 186 | ||
193 | /* request is i.e. "cat /proc/scsi/gdth/0" */ | 187 | /* request is i.e. "cat /proc/scsi/gdth/0" */ |
@@ -220,7 +214,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
220 | strcpy(hrec, ha->binfo.type_string); | 214 | strcpy(hrec, ha->binfo.type_string); |
221 | size = sprintf(buffer+len, | 215 | size = sprintf(buffer+len, |
222 | " Number: \t%d \tName: \t%s\n", | 216 | " Number: \t%d \tName: \t%s\n", |
223 | hanum, hrec); | 217 | ha->hanum, hrec); |
224 | len += size; pos = begin + len; | 218 | len += size; pos = begin + len; |
225 | 219 | ||
226 | if (ha->more_proc) | 220 | if (ha->more_proc) |
@@ -270,7 +264,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
270 | len += size; pos = begin + len; | 264 | len += size; pos = begin + len; |
271 | flag = FALSE; | 265 | flag = FALSE; |
272 | 266 | ||
273 | buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr); | 267 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
274 | if (!buf) | 268 | if (!buf) |
275 | goto stop_output; | 269 | goto stop_output; |
276 | for (i = 0; i < ha->bus_cnt; ++i) { | 270 | for (i = 0; i < ha->bus_cnt; ++i) { |
@@ -373,7 +367,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
373 | goto stop_output; | 367 | goto stop_output; |
374 | } | 368 | } |
375 | } | 369 | } |
376 | gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr); | 370 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
377 | 371 | ||
378 | if (!flag) { | 372 | if (!flag) { |
379 | size = sprintf(buffer+len, "\n --\n"); | 373 | size = sprintf(buffer+len, "\n --\n"); |
@@ -385,7 +379,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
385 | len += size; pos = begin + len; | 379 | len += size; pos = begin + len; |
386 | flag = FALSE; | 380 | flag = FALSE; |
387 | 381 | ||
388 | buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr); | 382 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
389 | if (!buf) | 383 | if (!buf) |
390 | goto stop_output; | 384 | goto stop_output; |
391 | for (i = 0; i < MAX_LDRIVES; ++i) { | 385 | for (i = 0; i < MAX_LDRIVES; ++i) { |
@@ -479,7 +473,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
479 | if (pos > offset + length) | 473 | if (pos > offset + length) |
480 | goto stop_output; | 474 | goto stop_output; |
481 | } | 475 | } |
482 | gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr); | 476 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
483 | 477 | ||
484 | if (!flag) { | 478 | if (!flag) { |
485 | size = sprintf(buffer+len, "\n --\n"); | 479 | size = sprintf(buffer+len, "\n --\n"); |
@@ -491,7 +485,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
491 | len += size; pos = begin + len; | 485 | len += size; pos = begin + len; |
492 | flag = FALSE; | 486 | flag = FALSE; |
493 | 487 | ||
494 | buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr); | 488 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
495 | if (!buf) | 489 | if (!buf) |
496 | goto stop_output; | 490 | goto stop_output; |
497 | for (i = 0; i < MAX_LDRIVES; ++i) { | 491 | for (i = 0; i < MAX_LDRIVES; ++i) { |
@@ -550,7 +544,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
550 | goto stop_output; | 544 | goto stop_output; |
551 | } | 545 | } |
552 | } | 546 | } |
553 | gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr); | 547 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
554 | 548 | ||
555 | if (!flag) { | 549 | if (!flag) { |
556 | size = sprintf(buffer+len, "\n --\n"); | 550 | size = sprintf(buffer+len, "\n --\n"); |
@@ -562,7 +556,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
562 | len += size; pos = begin + len; | 556 | len += size; pos = begin + len; |
563 | flag = FALSE; | 557 | flag = FALSE; |
564 | 558 | ||
565 | buf = gdth_ioctl_alloc(hanum, sizeof(gdth_hget_str), FALSE, &paddr); | 559 | buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr); |
566 | if (!buf) | 560 | if (!buf) |
567 | goto stop_output; | 561 | goto stop_output; |
568 | for (i = 0; i < MAX_LDRIVES; ++i) { | 562 | for (i = 0; i < MAX_LDRIVES; ++i) { |
@@ -595,7 +589,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
595 | } | 589 | } |
596 | } | 590 | } |
597 | } | 591 | } |
598 | gdth_ioctl_free(hanum, sizeof(gdth_hget_str), buf, paddr); | 592 | gdth_ioctl_free(ha, sizeof(gdth_hget_str), buf, paddr); |
599 | 593 | ||
600 | for (i = 0; i < MAX_HDRIVES; ++i) { | 594 | for (i = 0; i < MAX_HDRIVES; ++i) { |
601 | if (!(ha->hdr[i].present)) | 595 | if (!(ha->hdr[i].present)) |
@@ -633,7 +627,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
633 | id = gdth_read_event(ha, id, estr); | 627 | id = gdth_read_event(ha, id, estr); |
634 | if (estr->event_source == 0) | 628 | if (estr->event_source == 0) |
635 | break; | 629 | break; |
636 | if (estr->event_data.eu.driver.ionode == hanum && | 630 | if (estr->event_data.eu.driver.ionode == ha->hanum && |
637 | estr->event_source == ES_ASYNC) { | 631 | estr->event_source == ES_ASYNC) { |
638 | gdth_log_event(&estr->event_data, hrec); | 632 | gdth_log_event(&estr->event_data, hrec); |
639 | do_gettimeofday(&tv); | 633 | do_gettimeofday(&tv); |
@@ -668,17 +662,15 @@ free_fail: | |||
668 | return rc; | 662 | return rc; |
669 | } | 663 | } |
670 | 664 | ||
671 | static char *gdth_ioctl_alloc(int hanum, int size, int scratch, | 665 | static char *gdth_ioctl_alloc(gdth_ha_str *ha, int size, int scratch, |
672 | ulong64 *paddr) | 666 | ulong64 *paddr) |
673 | { | 667 | { |
674 | gdth_ha_str *ha; | ||
675 | ulong flags; | 668 | ulong flags; |
676 | char *ret_val; | 669 | char *ret_val; |
677 | 670 | ||
678 | if (size == 0) | 671 | if (size == 0) |
679 | return NULL; | 672 | return NULL; |
680 | 673 | ||
681 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
682 | spin_lock_irqsave(&ha->smp_lock, flags); | 674 | spin_lock_irqsave(&ha->smp_lock, flags); |
683 | 675 | ||
684 | if (!ha->scratch_busy && size <= GDTH_SCRATCH) { | 676 | if (!ha->scratch_busy && size <= GDTH_SCRATCH) { |
@@ -698,12 +690,10 @@ static char *gdth_ioctl_alloc(int hanum, int size, int scratch, | |||
698 | return ret_val; | 690 | return ret_val; |
699 | } | 691 | } |
700 | 692 | ||
701 | static void gdth_ioctl_free(int hanum, int size, char *buf, ulong64 paddr) | 693 | static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, ulong64 paddr) |
702 | { | 694 | { |
703 | gdth_ha_str *ha; | ||
704 | ulong flags; | 695 | ulong flags; |
705 | 696 | ||
706 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
707 | spin_lock_irqsave(&ha->smp_lock, flags); | 697 | spin_lock_irqsave(&ha->smp_lock, flags); |
708 | 698 | ||
709 | if (buf == ha->pscratch) { | 699 | if (buf == ha->pscratch) { |
@@ -716,13 +706,11 @@ static void gdth_ioctl_free(int hanum, int size, char *buf, ulong64 paddr) | |||
716 | } | 706 | } |
717 | 707 | ||
718 | #ifdef GDTH_IOCTL_PROC | 708 | #ifdef GDTH_IOCTL_PROC |
719 | static int gdth_ioctl_check_bin(int hanum, ushort size) | 709 | static int gdth_ioctl_check_bin(gdth_ha_str *ha, ushort size) |
720 | { | 710 | { |
721 | gdth_ha_str *ha; | ||
722 | ulong flags; | 711 | ulong flags; |
723 | int ret_val; | 712 | int ret_val; |
724 | 713 | ||
725 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
726 | spin_lock_irqsave(&ha->smp_lock, flags); | 714 | spin_lock_irqsave(&ha->smp_lock, flags); |
727 | 715 | ||
728 | ret_val = FALSE; | 716 | ret_val = FALSE; |
@@ -735,15 +723,13 @@ static int gdth_ioctl_check_bin(int hanum, ushort size) | |||
735 | } | 723 | } |
736 | #endif | 724 | #endif |
737 | 725 | ||
738 | static void gdth_wait_completion(int hanum, int busnum, int id) | 726 | static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id) |
739 | { | 727 | { |
740 | gdth_ha_str *ha; | ||
741 | ulong flags; | 728 | ulong flags; |
742 | int i; | 729 | int i; |
743 | Scsi_Cmnd *scp; | 730 | Scsi_Cmnd *scp; |
744 | unchar b, t; | 731 | unchar b, t; |
745 | 732 | ||
746 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
747 | spin_lock_irqsave(&ha->smp_lock, flags); | 733 | spin_lock_irqsave(&ha->smp_lock, flags); |
748 | 734 | ||
749 | for (i = 0; i < GDTH_MAXCMDS; ++i) { | 735 | for (i = 0; i < GDTH_MAXCMDS; ++i) { |
@@ -763,14 +749,12 @@ static void gdth_wait_completion(int hanum, int busnum, int id) | |||
763 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 749 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
764 | } | 750 | } |
765 | 751 | ||
766 | static void gdth_stop_timeout(int hanum, int busnum, int id) | 752 | static void gdth_stop_timeout(gdth_ha_str *ha, int busnum, int id) |
767 | { | 753 | { |
768 | gdth_ha_str *ha; | ||
769 | ulong flags; | 754 | ulong flags; |
770 | Scsi_Cmnd *scp; | 755 | Scsi_Cmnd *scp; |
771 | unchar b, t; | 756 | unchar b, t; |
772 | 757 | ||
773 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
774 | spin_lock_irqsave(&ha->smp_lock, flags); | 758 | spin_lock_irqsave(&ha->smp_lock, flags); |
775 | 759 | ||
776 | for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { | 760 | for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { |
@@ -779,21 +763,19 @@ static void gdth_stop_timeout(int hanum, int busnum, int id) | |||
779 | t = scp->device->id; | 763 | t = scp->device->id; |
780 | if (t == (unchar)id && b == (unchar)busnum) { | 764 | if (t == (unchar)id && b == (unchar)busnum) { |
781 | TRACE2(("gdth_stop_timeout(): update_timeout()\n")); | 765 | TRACE2(("gdth_stop_timeout(): update_timeout()\n")); |
782 | scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0); | 766 | scp->SCp.buffers_residual = gdth_update_timeout(scp, 0); |
783 | } | 767 | } |
784 | } | 768 | } |
785 | } | 769 | } |
786 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 770 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
787 | } | 771 | } |
788 | 772 | ||
789 | static void gdth_start_timeout(int hanum, int busnum, int id) | 773 | static void gdth_start_timeout(gdth_ha_str *ha, int busnum, int id) |
790 | { | 774 | { |
791 | gdth_ha_str *ha; | ||
792 | ulong flags; | 775 | ulong flags; |
793 | Scsi_Cmnd *scp; | 776 | Scsi_Cmnd *scp; |
794 | unchar b, t; | 777 | unchar b, t; |
795 | 778 | ||
796 | ha = HADATA(gdth_ctr_tab[hanum]); | ||
797 | spin_lock_irqsave(&ha->smp_lock, flags); | 779 | spin_lock_irqsave(&ha->smp_lock, flags); |
798 | 780 | ||
799 | for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { | 781 | for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) { |
@@ -802,14 +784,14 @@ static void gdth_start_timeout(int hanum, int busnum, int id) | |||
802 | t = scp->device->id; | 784 | t = scp->device->id; |
803 | if (t == (unchar)id && b == (unchar)busnum) { | 785 | if (t == (unchar)id && b == (unchar)busnum) { |
804 | TRACE2(("gdth_start_timeout(): update_timeout()\n")); | 786 | TRACE2(("gdth_start_timeout(): update_timeout()\n")); |
805 | gdth_update_timeout(hanum, scp, scp->SCp.buffers_residual); | 787 | gdth_update_timeout(scp, scp->SCp.buffers_residual); |
806 | } | 788 | } |
807 | } | 789 | } |
808 | } | 790 | } |
809 | spin_unlock_irqrestore(&ha->smp_lock, flags); | 791 | spin_unlock_irqrestore(&ha->smp_lock, flags); |
810 | } | 792 | } |
811 | 793 | ||
812 | static int gdth_update_timeout(int hanum, Scsi_Cmnd *scp, int timeout) | 794 | static int gdth_update_timeout(Scsi_Cmnd *scp, int timeout) |
813 | { | 795 | { |
814 | int oldto; | 796 | int oldto; |
815 | 797 | ||
diff --git a/drivers/scsi/gdth_proc.h b/drivers/scsi/gdth_proc.h index dd717776e6b5..45e6fdacf36e 100644 --- a/drivers/scsi/gdth_proc.h +++ b/drivers/scsi/gdth_proc.h | |||
@@ -9,20 +9,20 @@ int gdth_execute(struct Scsi_Host *shost, gdth_cmd_str *gdtcmd, char *cmnd, | |||
9 | int timeout, u32 *info); | 9 | int timeout, u32 *info); |
10 | 10 | ||
11 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, | 11 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, |
12 | int hanum); | 12 | gdth_ha_str *ha); |
13 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | 13 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, |
14 | struct Scsi_Host *host,int hanum); | 14 | struct Scsi_Host *host, gdth_ha_str *ha); |
15 | 15 | ||
16 | static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | 16 | static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, |
17 | int length, int hanum); | 17 | int length, gdth_ha_str *ha); |
18 | 18 | ||
19 | static char *gdth_ioctl_alloc(int hanum, int size, int scratch, | 19 | static char *gdth_ioctl_alloc(gdth_ha_str *ha, int size, int scratch, |
20 | ulong64 *paddr); | 20 | ulong64 *paddr); |
21 | static void gdth_ioctl_free(int hanum, int size, char *buf, ulong64 paddr); | 21 | static void gdth_ioctl_free(gdth_ha_str *ha, int size, char *buf, ulong64 paddr); |
22 | static void gdth_wait_completion(int hanum, int busnum, int id); | 22 | static void gdth_wait_completion(gdth_ha_str *ha, int busnum, int id); |
23 | static void gdth_stop_timeout(int hanum, int busnum, int id); | 23 | static void gdth_stop_timeout(gdth_ha_str *ha, int busnum, int id); |
24 | static void gdth_start_timeout(int hanum, int busnum, int id); | 24 | static void gdth_start_timeout(gdth_ha_str *ha, int busnum, int id); |
25 | static int gdth_update_timeout(int hanum, Scsi_Cmnd *scp, int timeout); | 25 | static int gdth_update_timeout(Scsi_Cmnd *scp, int timeout); |
26 | 26 | ||
27 | #endif | 27 | #endif |
28 | 28 | ||