104 #define GDTH_STATISTICS
106 #include <linux/module.h>
108 #include <linux/version.h>
109 #include <linux/kernel.h>
110 #include <linux/types.h>
111 #include <linux/pci.h>
112 #include <linux/string.h>
113 #include <linux/ctype.h>
117 #include <linux/in.h>
119 #include <linux/time.h>
122 #include <linux/list.h>
124 #include <linux/slab.h>
129 #include <linux/reboot.h>
133 #include <asm/uaccess.h>
143 static void gdth_delay(
int milliseconds);
144 static void gdth_eval_mapping(
u32 size,
u32 *cyls,
int *
heads,
int *secs);
147 int gdth_from_wait,
int* pIndex);
151 static void gdth_log_event(gdth_evt_data *dvr,
char *
buffer);
162 static void gdth_clear_events(
void);
183 static long gdth_unlocked_ioctl(
struct file *filep,
unsigned int cmd,
189 struct gdth_cmndinfo *cmndinfo);
193 static u8 DebugState = DEBUG_GDTH;
196 #define MAX_SERBUF 160
197 static void ser_init(
void);
198 static void ser_puts(
char *
str);
199 static void ser_putc(
char c);
200 static int ser_printk(
const char *
fmt, ...);
201 static char strbuf[MAX_SERBUF+1];
203 #define COM_BASE 0x2f8
205 #define COM_BASE 0x3f8
207 static void ser_init()
209 unsigned port=COM_BASE;
223 static void ser_puts(
char *
str)
232 static void ser_putc(
char c)
234 unsigned port=COM_BASE;
236 while ((
inb(port+5) & 0x20)==0);
240 while ((
inb(port+5) & 0x20)==0);
245 static int ser_printk(
const char *
fmt, ...)
257 #define TRACE(a) {if (DebugState==1) {ser_printk a;}}
258 #define TRACE2(a) {if (DebugState==1 || DebugState==2) {ser_printk a;}}
259 #define TRACE3(a) {if (DebugState!=0) {ser_printk a;}}
262 #define TRACE(a) {if (DebugState==1) {printk a;}}
263 #define TRACE2(a) {if (DebugState==1 || DebugState==2) {printk a;}}
264 #define TRACE3(a) {if (DebugState!=0) {printk a;}}
273 #ifdef GDTH_STATISTICS
274 static u32 max_rq=0, max_index=0, max_sg=0;
276 static u32 max_int_coal=0;
278 static u32 act_ints=0, act_ios=0, act_stats=0, act_rq=0;
282 #define PTR2USHORT(a) (u16)(unsigned long)(a)
283 #define GDTOFFSOF(a,b) (size_t)&(((a*)0)->b)
284 #define INDEX_OK(i,t) ((i)<ARRAY_SIZE(t))
286 #define BUS_L2P(a,b) ((b)>(a)->virt_bus ? (b-1):(b))
289 static u8 gdth_drq_tab[4] = {5,6,7,7};
291 #if defined(CONFIG_EISA) || defined(CONFIG_ISA)
292 static u8 gdth_irq_tab[6] = {0,10,11,12,14,0};
294 static u8 gdth_polling;
295 static int gdth_ctr_count = 0;
297 static u8 gdth_write_through =
FALSE;
307 static u8 gdth_direction_tab[0x100] = {
308 DNO,
DNO,
DIN,
DIN,
DOU,
DIN,
DIN,
DOU,
DIN,
DUN,
DOU,
DOU,
DUN,
DUN,
DUN,
DIN,
309 DNO,
DIN,
DIN,
DOU,
DIN,
DOU,
DNO,
DNO,
DOU,
DNO,
DIN,
DNO,
DIN,
DOU,
DNO,
DUN,
310 DIN,
DUN,
DIN,
DUN,
DOU,
DIN,
DUN,
DUN,
DIN,
DIN,
DOU,
DNO,
DUN,
DIN,
DOU,
DOU,
311 DOU,
DOU,
DOU,
DNO,
DIN,
DNO,
DNO,
DIN,
DOU,
DOU,
DOU,
DOU,
DIN,
DOU,
DIN,
DOU,
312 DOU,
DOU,
DIN,
DIN,
DIN,
DNO,
DUN,
DNO,
DNO,
DNO,
DUN,
DNO,
DOU,
DIN,
DUN,
DUN,
313 DUN,
DUN,
DUN,
DUN,
DUN,
DOU,
DUN,
DUN,
DUN,
DUN,
DIN,
DUN,
DUN,
DUN,
DUN,
DUN,
314 DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
315 DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
316 DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DIN,
DUN,
DOU,
DUN,
DUN,
DUN,
DUN,
DUN,
317 DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DIN,
DUN,
318 DUN,
DUN,
DUN,
DUN,
DUN,
DNO,
DNO,
DUN,
DIN,
DNO,
DOU,
DUN,
DNO,
DUN,
DOU,
DOU,
319 DOU,
DOU,
DOU,
DNO,
DUN,
DIN,
DOU,
DIN,
DIN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
320 DUN,
DUN,
DOU,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
321 DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
322 DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DOU,
DUN,
DUN,
DUN,
DUN,
DUN,
323 DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,
DUN,DUN
329 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
330 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
332 static int disable __initdata = 0;
334 static int reserve_mode = 1;
337 {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
338 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
339 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
341 static int reverse_scan = 0;
343 static int hdr_channel = 0;
345 static int max_ids =
MAXID;
347 static int rescan = 0;
349 static int shared_access = 1;
351 static int probe_eisa_isa = 0;
353 static int force_dma32 = 0;
372 .unlocked_ioctl = gdth_unlocked_ioctl,
374 .release = gdth_close,
386 if (hanum == ha->hanum)
401 if (ha->cmndinfo[i].index == 0) {
402 priv = &ha->cmndinfo[
i];
403 memset(priv, 0,
sizeof(*priv));
409 spin_unlock_irqrestore(&ha->smp_lock, flags);
414 static void gdth_put_cmndinfo(
struct gdth_cmndinfo *priv)
420 static void gdth_delay(
int milliseconds)
422 if (milliseconds == 0) {
431 struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
432 int internal_command = cmndinfo->internal_command;
434 TRACE2((
"gdth_scsi_done()\n"));
436 gdth_put_cmndinfo(cmndinfo);
439 if (internal_command)
450 struct gdth_cmndinfo cmndinfo;
465 memset(&cmndinfo, 0,
sizeof(cmndinfo));
472 cmndinfo.internal_cmd_str = gdtcmd;
473 cmndinfo.internal_command = 1;
475 TRACE((
"__gdth_execute() cmd 0x%x\n", scp->
cmnd[0]));
476 __gdth_queuecommand(ha, scp, &cmndinfo);
480 rval = cmndinfo.status;
482 *info = cmndinfo.info;
498 static void gdth_eval_mapping(
u32 size,
u32 *cyls,
int *
heads,
int *secs)
519 static int __init gdth_search_eisa(
u16 eisa_adr)
523 TRACE((
"gdth_search_eisa() adr. %x\n",eisa_adr));
538 static int __init gdth_search_isa(
u32 bios_adr)
543 TRACE((
"gdth_search_isa() bios adr. %x\n",bios_adr));
556 static bool gdth_search_vortex(
u16 device)
570 static int gdth_pci_init_one(
struct pci_dev *pdev,
572 static void gdth_pci_remove_one(
struct pci_dev *pdev);
588 .id_table = gdthtable,
589 .probe = gdth_pci_init_one,
590 .remove = gdth_pci_remove_one,
597 pci_set_drvdata(pdev, NULL);
615 TRACE((
"gdth_search_dev() cnt %d vendor %x device %x\n",
616 gdth_ctr_count, vendor, device));
618 memset(&gdth_pcistr, 0,
sizeof(gdth_pcistr));
627 if (gdth_ctr_count >=
MAXHA)
631 gdth_pcistr.
pdev = pdev;
642 !(base2 & IORESOURCE_MEM) ||
648 TRACE2((
"Controller found at %d/%d, irq %d, dpmem 0x%lx\n",
649 gdth_pcistr.
pdev->bus->number,
654 rc = gdth_pci_probe_one(&gdth_pcistr, &ha);
666 u8 prot_ver,eisacf,
i,irq_found;
668 TRACE((
"gdth_init_eisa() adr. %x\n",eisa_adr));
679 if (--retries == 0) {
680 printk(
"GDT-EISA: Initialization error (DEINIT failed)\n");
684 TRACE2((
"wait for DEINIT: retries=%d\n",retries));
689 printk(
"GDT-EISA: Illegal protocol version\n");
710 if (--retries == 0) {
711 printk(
"GDT-EISA: Initialization error (get IRQ failed)\n");
718 TRACE2((
"GDT3000/3020: IRQ=%d\n",ha->
irq));
721 TRACE2((
"Unknown IRQ, use IRQ table from cmd line !\n"));
722 for (i = 0, irq_found =
FALSE;
724 if (irq[i]==10 || irq[i]==11 || irq[i]==12 || irq[i]==14) {
732 printk(
"GDT-EISA: Can not detect controller IRQ,\n");
733 printk(
"Use IRQ setting from command line (IRQ = %d)\n",
736 printk(
"GDT-EISA: Initialization error (unknown IRQ), Enable\n");
737 printk(
"the controller BIOS or use command line parameters\n");
745 ha->
irq = gdth_irq_tab[eisacf];
759 register gdt2_dpram_str
__iomem *dp2_ptr;
764 TRACE((
"gdth_init_isa() bios adr. %x\n",bios_adr));
766 ha->
brd =
ioremap(bios_adr,
sizeof(gdt2_dpram_str));
767 if (ha->
brd == NULL) {
768 printk(
"GDT-ISA: Initialization error (DPMEM remap error)\n");
772 writeb(1, &dp2_ptr->io.memlock);
774 memset_io(&dp2_ptr->u, 0,
sizeof(dp2_ptr->u));
775 if (
readl(&dp2_ptr->u) != 0) {
776 printk(
"GDT-ISA: Initialization error (DPMEM write error)\n");
782 writeb(0xff, &dp2_ptr->io.irqdel);
783 writeb(0x00, &dp2_ptr->io.irqen);
784 writeb(0x00, &dp2_ptr->u.ic.S_Status);
785 writeb(0x00, &dp2_ptr->u.ic.Cmd_Index);
787 irq_drq =
readb(&dp2_ptr->io.rq);
788 for (i=0; i<3; ++
i) {
789 if ((irq_drq & 1)==0)
793 ha->
drq = gdth_drq_tab[
i];
795 irq_drq =
readb(&dp2_ptr->io.rq) >> 3;
796 for (i=1; i<5; ++
i) {
797 if ((irq_drq & 1)==0)
801 ha->
irq = gdth_irq_tab[
i];
804 writel(bios_adr, &dp2_ptr->u.ic.S_Info[0]);
805 writeb(0xff, &dp2_ptr->u.ic.S_Cmd_Indx);
806 writeb(0, &dp2_ptr->io.event);
809 while (
readb(&dp2_ptr->u.ic.S_Status) != 0xff) {
810 if (--retries == 0) {
811 printk(
"GDT-ISA: Initialization error (DEINIT failed)\n");
817 prot_ver = (
u8)
readl(&dp2_ptr->u.ic.S_Info[0]);
818 writeb(0, &dp2_ptr->u.ic.Status);
819 writeb(0xff, &dp2_ptr->io.irqdel);
821 printk(
"GDT-ISA: Illegal protocol version\n");
833 writel(0x00, &dp2_ptr->u.ic.S_Info[0]);
834 writel(0x00, &dp2_ptr->u.ic.S_Info[1]);
835 writel(0x01, &dp2_ptr->u.ic.S_Info[2]);
836 writel(0x00, &dp2_ptr->u.ic.S_Info[3]);
837 writeb(0xfe, &dp2_ptr->u.ic.S_Cmd_Indx);
838 writeb(0, &dp2_ptr->io.event);
841 while (
readb(&dp2_ptr->u.ic.S_Status) != 0xfe) {
842 if (--retries == 0) {
843 printk(
"GDT-ISA: Initialization error\n");
849 writeb(0, &dp2_ptr->u.ic.Status);
850 writeb(0xff, &dp2_ptr->io.irqdel);
861 register gdt6_dpram_str
__iomem *dp6_ptr;
862 register gdt6c_dpram_str
__iomem *dp6c_ptr;
863 register gdt6m_dpram_str
__iomem *dp6m_ptr;
869 TRACE((
"gdth_init_pci()\n"));
883 if (ha->
brd == NULL) {
884 printk(
"GDT-PCI: Initialization error (DPMEM remap error)\n");
891 printk(
"GDT-PCI: Cannot access DPMEM at 0x%lx (shadowed?)\n",
894 for (i = 0xC8000; i < 0xE8000; i += 0x4000) {
897 if (ha->
brd == NULL) {
898 printk(
"GDT-PCI: Initialization error (DPMEM remap error)\n");
902 TRACE2((
"init_pci_old() address 0x%x busy\n", i));
908 if (ha->
brd == NULL) {
909 printk(
"GDT-PCI: Initialization error (DPMEM remap error)\n");
915 printk(
"GDT-PCI: Use free address at 0x%x\n", i);
921 printk(
"GDT-PCI: No free address found!\n");
926 memset_io(&dp6_ptr->u, 0,
sizeof(dp6_ptr->u));
927 if (
readl(&dp6_ptr->u) != 0) {
928 printk(
"GDT-PCI: Initialization error (DPMEM write error)\n");
934 writeb(0xff, &dp6_ptr->io.irqdel);
935 writeb(0x00, &dp6_ptr->io.irqen);
936 writeb(0x00, &dp6_ptr->u.ic.S_Status);
937 writeb(0x00, &dp6_ptr->u.ic.Cmd_Index);
940 writeb(0xff, &dp6_ptr->u.ic.S_Cmd_Indx);
941 writeb(0, &dp6_ptr->io.event);
944 while (
readb(&dp6_ptr->u.ic.S_Status) != 0xff) {
945 if (--retries == 0) {
946 printk(
"GDT-PCI: Initialization error (DEINIT failed)\n");
952 prot_ver = (
u8)
readl(&dp6_ptr->u.ic.S_Info[0]);
953 writeb(0, &dp6_ptr->u.ic.S_Status);
954 writeb(0xff, &dp6_ptr->io.irqdel);
956 printk(
"GDT-PCI: Illegal protocol version\n");
965 writel(0x00, &dp6_ptr->u.ic.S_Info[0]);
966 writel(0x00, &dp6_ptr->u.ic.S_Info[1]);
967 writel(0x00, &dp6_ptr->u.ic.S_Info[2]);
968 writel(0x00, &dp6_ptr->u.ic.S_Info[3]);
969 writeb(0xfe, &dp6_ptr->u.ic.S_Cmd_Indx);
970 writeb(0, &dp6_ptr->io.event);
973 while (
readb(&dp6_ptr->u.ic.S_Status) != 0xfe) {
974 if (--retries == 0) {
975 printk(
"GDT-PCI: Initialization error\n");
981 writeb(0, &dp6_ptr->u.ic.S_Status);
982 writeb(0xff, &dp6_ptr->io.irqdel);
987 ha->
plx = (gdt6c_plx_regs *)pcistr->
io;
988 TRACE2((
"init_pci_new() dpmem %lx irq %d\n",
991 if (ha->
brd == NULL) {
992 printk(
"GDT-PCI: Initialization error (DPMEM remap error)\n");
1000 printk(
"GDT-PCI: Cannot access DPMEM at 0x%lx (shadowed?)\n",
1003 for (i = 0xC8000; i < 0xE8000; i += 0x4000) {
1006 if (ha->
brd == NULL) {
1007 printk(
"GDT-PCI: Initialization error (DPMEM remap error)\n");
1011 TRACE2((
"init_pci_plx() address 0x%x busy\n", i));
1016 ha->
brd =
ioremap(i,
sizeof(gdt6c_dpram_str));
1017 if (ha->
brd == NULL) {
1018 printk(
"GDT-PCI: Initialization error (DPMEM remap error)\n");
1024 printk(
"GDT-PCI: Use free address at 0x%x\n", i);
1030 printk(
"GDT-PCI: No free address found!\n");
1035 memset_io(&dp6c_ptr->u, 0,
sizeof(dp6c_ptr->u));
1036 if (
readl(&dp6c_ptr->u) != 0) {
1037 printk(
"GDT-PCI: Initialization error (DPMEM write error)\n");
1046 writeb(0x00, &dp6c_ptr->u.ic.S_Status);
1047 writeb(0x00, &dp6c_ptr->u.ic.Cmd_Index);
1050 writeb(0xff, &dp6c_ptr->u.ic.S_Cmd_Indx);
1056 while (
readb(&dp6c_ptr->u.ic.S_Status) != 0xff) {
1057 if (--retries == 0) {
1058 printk(
"GDT-PCI: Initialization error (DEINIT failed)\n");
1064 prot_ver = (
u8)
readl(&dp6c_ptr->u.ic.S_Info[0]);
1065 writeb(0, &dp6c_ptr->u.ic.Status);
1067 printk(
"GDT-PCI: Illegal protocol version\n");
1076 writel(0x00, &dp6c_ptr->u.ic.S_Info[0]);
1077 writel(0x00, &dp6c_ptr->u.ic.S_Info[1]);
1078 writel(0x00, &dp6c_ptr->u.ic.S_Info[2]);
1079 writel(0x00, &dp6c_ptr->u.ic.S_Info[3]);
1080 writeb(0xfe, &dp6c_ptr->u.ic.S_Cmd_Indx);
1086 while (
readb(&dp6c_ptr->u.ic.S_Status) != 0xfe) {
1087 if (--retries == 0) {
1088 printk(
"GDT-PCI: Initialization error\n");
1094 writeb(0, &dp6c_ptr->u.ic.S_Status);
1099 TRACE2((
"init_pci_mpr() dpmem %lx irq %d\n",pcistr->
dpmem,ha->
irq));
1101 if (ha->
brd == NULL) {
1102 printk(
"GDT-PCI: Initialization error (DPMEM remap error)\n");
1107 pci_read_config_word(pdev,
PCI_COMMAND, &command);
1109 pci_write_config_word(pdev,
PCI_COMMAND, command);
1122 while( ((
int)
readb(&dp6m_ptr->i960r.sema0_reg) ) & 3 )
1128 printk(
"GDT-PCI: Cannot access DPMEM at 0x%lx (shadowed?)\n",
1131 for (i = 0xC8000; i < 0xE8000; i += 0x4000) {
1134 if (ha->
brd == NULL) {
1135 printk(
"GDT-PCI: Initialization error (DPMEM remap error)\n");
1139 TRACE2((
"init_pci_mpr() address 0x%x busy\n", i));
1144 ha->
brd =
ioremap(i,
sizeof(gdt6m_dpram_str));
1145 if (ha->
brd == NULL) {
1146 printk(
"GDT-PCI: Initialization error (DPMEM remap error)\n");
1152 printk(
"GDT-PCI: Use free address at 0x%x\n", i);
1158 printk(
"GDT-PCI: No free address found!\n");
1163 memset_io(&dp6m_ptr->u, 0,
sizeof(dp6m_ptr->u));
1167 &dp6m_ptr->i960r.edoor_en_reg);
1168 writeb(0xff, &dp6m_ptr->i960r.edoor_reg);
1169 writeb(0x00, &dp6m_ptr->u.ic.S_Status);
1170 writeb(0x00, &dp6m_ptr->u.ic.Cmd_Index);
1173 writeb(0xff, &dp6m_ptr->u.ic.S_Cmd_Indx);
1174 writeb(1, &dp6m_ptr->i960r.ldoor_reg);
1177 while (
readb(&dp6m_ptr->u.ic.S_Status) != 0xff) {
1178 if (--retries == 0) {
1179 printk(
"GDT-PCI: Initialization error (DEINIT failed)\n");
1185 prot_ver = (
u8)
readl(&dp6m_ptr->u.ic.S_Info[0]);
1186 writeb(0, &dp6m_ptr->u.ic.S_Status);
1188 printk(
"GDT-PCI: Illegal protocol version\n");
1197 writel(0x00, &dp6m_ptr->u.ic.S_Info[0]);
1198 writel(0x00, &dp6m_ptr->u.ic.S_Info[1]);
1199 writel(0x00, &dp6m_ptr->u.ic.S_Info[2]);
1200 writel(0x00, &dp6m_ptr->u.ic.S_Info[3]);
1201 writeb(0xfe, &dp6m_ptr->u.ic.S_Cmd_Indx);
1202 writeb(1, &dp6m_ptr->i960r.ldoor_reg);
1205 while (
readb(&dp6m_ptr->u.ic.S_Status) != 0xfe) {
1206 if (--retries == 0) {
1207 printk(
"GDT-PCI: Initialization error\n");
1213 writeb(0, &dp6m_ptr->u.ic.S_Status);
1216 writeb(0xfd, &dp6m_ptr->u.ic.S_Cmd_Indx);
1217 writeb(1, &dp6m_ptr->i960r.ldoor_reg);
1220 while (
readb(&dp6m_ptr->u.ic.S_Status) != 0xfd) {
1221 if (--retries == 0) {
1222 printk(
"GDT-PCI: Initialization error (DEINIT failed)\n");
1228 prot_ver = (
u8)(
readl(&dp6m_ptr->u.ic.S_Info[0]) >> 16);
1229 writeb(0, &dp6m_ptr->u.ic.S_Status);
1230 if (prot_ver < 0x2b)
1244 unsigned long flags;
1245 gdt2_dpram_str
__iomem *dp2_ptr;
1246 gdt6_dpram_str
__iomem *dp6_ptr;
1247 gdt6m_dpram_str
__iomem *dp6m_ptr;
1249 TRACE((
"gdth_enable_int() hanum %d\n",ha->
hanum));
1258 writeb(1, &dp2_ptr->io.irqdel);
1259 writeb(0, &dp2_ptr->u.ic.Cmd_Index);
1260 writeb(1, &dp2_ptr->io.irqen);
1263 writeb(1, &dp6_ptr->io.irqdel);
1264 writeb(0, &dp6_ptr->u.ic.Cmd_Index);
1265 writeb(1, &dp6_ptr->io.irqen);
1271 writeb(0xff, &dp6m_ptr->i960r.edoor_reg);
1273 &dp6m_ptr->i960r.edoor_en_reg);
1275 spin_unlock_irqrestore(&ha->
smp_lock, flags);
1283 TRACE((
"gdth_get_status() irq %d ctr_count %d\n", ha->
irq, gdth_ctr_count));
1304 register int gdtsema0 = 0;
1306 TRACE((
"gdth_test_busy() hanum %d\n", ha->
hanum));
1320 return (gdtsema0 & 1);
1328 TRACE((
"gdth_get_cmd_index() hanum %d\n", ha->
hanum));
1334 ha->
pccb->CommandIndex = (
u32)i+2;
1344 TRACE((
"gdth_set_sema0() hanum %d\n", ha->
hanum));
1362 register gdth_cmd_str *cmd_ptr;
1363 register gdt6m_dpram_str
__iomem *dp6m_ptr;
1364 register gdt6c_dpram_str
__iomem *dp6c_ptr;
1365 gdt6_dpram_str
__iomem *dp6_ptr;
1366 gdt2_dpram_str
__iomem *dp2_ptr;
1367 u16 cp_count,dp_offset,cmd_no;
1369 TRACE((
"gdth_copy_command() hanum %d\n", ha->
hanum));
1382 cp_count += (4 - (cp_count & 3));
1390 &dp2_ptr->u.ic.comm_queue[cmd_no].offset);
1392 &dp2_ptr->u.ic.comm_queue[cmd_no].serv_id);
1393 memcpy_toio(&dp2_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count);
1397 &dp6_ptr->u.ic.comm_queue[cmd_no].offset);
1399 &dp6_ptr->u.ic.comm_queue[cmd_no].serv_id);
1400 memcpy_toio(&dp6_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count);
1404 &dp6c_ptr->u.ic.comm_queue[cmd_no].offset);
1406 &dp6c_ptr->u.ic.comm_queue[cmd_no].serv_id);
1407 memcpy_toio(&dp6c_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count);
1411 &dp6m_ptr->u.ic.comm_queue[cmd_no].offset);
1413 &dp6m_ptr->u.ic.comm_queue[cmd_no].serv_id);
1414 memcpy_toio(&dp6m_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count);
1421 TRACE((
"gdth_release_event() hanum %d\n", ha->
hanum));
1423 #ifdef GDTH_STATISTICS
1430 if (max_index < i) {
1432 TRACE3((
"GDT: max_index = %d\n",(
u16)i));
1438 ha->
pccb->Service |= 0x80;
1457 int answer_found =
FALSE;
1460 TRACE((
"gdth_wait() hanum %d index %d time %d\n", ha->
hanum, index, time));
1466 __gdth_interrupt(ha,
true, &wait_index);
1467 if (wait_index == index) {
1468 answer_found =
TRUE;
1474 while (gdth_test_busy(ha))
1477 return (answer_found);
1484 register gdth_cmd_str *cmd_ptr;
1487 TRACE2((
"gdth_internal_cmd() service %d opcode %d\n",service,opcode));
1490 memset((
char*)cmd_ptr,0,
sizeof(gdth_cmd_str));
1496 if (!(index=gdth_get_cmd_index(ha))) {
1497 TRACE((
"GDT: No free command index found\n"));
1501 cmd_ptr->OpCode =
opcode;
1505 cmd_ptr->u.ioctl.subfunc =
p1;
1506 cmd_ptr->u.ioctl.channel = (
u32)p2;
1507 cmd_ptr->u.ioctl.param_size = (
u16)p3;
1511 cmd_ptr->u.cache64.DeviceNo = (
u16)p1;
1512 cmd_ptr->u.cache64.BlockNo = p2;
1514 cmd_ptr->u.cache.DeviceNo = (
u16)p1;
1515 cmd_ptr->u.cache.BlockNo = (
u32)p2;
1520 cmd_ptr->u.raw64.direction =
p1;
1521 cmd_ptr->u.raw64.bus = (
u8)p2;
1522 cmd_ptr->u.raw64.target = (
u8)p3;
1523 cmd_ptr->u.raw64.lun = (
u8)(p3 >> 8);
1525 cmd_ptr->u.raw.direction =
p1;
1526 cmd_ptr->u.raw.bus = (
u8)p2;
1527 cmd_ptr->u.raw.target = (
u8)p3;
1528 cmd_ptr->u.raw.lun = (
u8)(p3 >> 8);
1532 *(
u32 *)&cmd_ptr->u.screen.su.data[0] = p1;
1533 *(
u32 *)&cmd_ptr->u.screen.su.data[4] = (
u32)p2;
1534 *(
u32 *)&cmd_ptr->u.screen.su.data[8] = (
u32)p3;
1537 ha->
cmd_len =
sizeof(gdth_cmd_str);
1540 gdth_copy_command(ha);
1541 gdth_release_event(ha);
1544 printk(
"GDT: Initialization error (timeout service %d)\n",service);
1562 u32 bus_no, drv_cnt, drv_no,
j;
1563 gdth_getch_str *
chn;
1564 gdth_drlist_str *drl;
1565 gdth_iochan_str *
ioc;
1566 gdth_raw_iochan_str *iocr;
1567 gdth_arcdl_str *alst;
1568 gdth_alist_str *alst2;
1569 gdth_oem_str_ioctl *oemstr;
1571 gdth_perf_modes *pmod;
1576 unsigned long flags;
1579 TRACE((
"gdth_search_drives() hanum %d\n", ha->
hanum));
1592 printk(
"GDT-HA %d: Initialization error screen service (code %d)\n",
1596 TRACE2((
"gdth_search_drives(): SCREENSERVICE initialized\n"));
1602 for (j = 0; j < 1000000; ++
j)
1605 for (j = 0; j < 1000000; ++
j)
1610 for (j = 0; j < 12; ++
j)
1613 spin_unlock_irqrestore(&rtc_lock, flags);
1614 TRACE2((
"gdth_search_drives(): RTC: %x/%x/%x\n",*(
u32 *)&rtc[0],
1615 *(
u32 *)&rtc[4], *(
u32 *)&rtc[8]));
1618 *(
u32 *)&rtc[4], *(
u32 *)&rtc[8]);
1632 if (force_dma32 || (!ok && ha->
status == (
u16)S_NOFUNC))
1635 printk(
"GDT-HA %d: Initialization error cache service (code %d)\n",
1639 TRACE2((
"gdth_search_drives(): CACHESERVICE initialized\n"));
1646 pmod = (gdth_perf_modes *)ha->
pscratch;
1649 *((
u64 *)&pmod->st_buff_addr1) = ha->coal_stat_phys;
1651 pmod->st_buff_addr2 = 0;
1652 pmod->st_buff_u_addr2 = 0;
1653 pmod->st_buff_indx2 = 0;
1654 pmod->st_buff_size =
sizeof(gdth_coal_status) *
MAXOFFSETS;
1656 pmod->cmd_buff_addr1 = 0;
1657 pmod->cmd_buff_u_addr1 = 0;
1658 pmod->cmd_buff_indx1 = 0;
1659 pmod->cmd_buff_addr2 = 0;
1660 pmod->cmd_buff_u_addr2 = 0;
1661 pmod->cmd_buff_indx2 = 0;
1662 pmod->cmd_buff_size = 0;
1663 pmod->reserved1 = 0;
1664 pmod->reserved2 = 0;
1667 printk(
"GDT-HA %d: Interrupt coalescing activated\n", ha->
hanum);
1673 iocr = (gdth_raw_iochan_str *)ha->
pscratch;
1674 iocr->hdr.version = 0xffffffff;
1675 iocr->hdr.list_entries =
MAXBUS;
1676 iocr->hdr.first_chan = 0;
1677 iocr->hdr.last_chan =
MAXBUS-1;
1678 iocr->hdr.list_offset =
GDTOFFSOF(gdth_raw_iochan_str,
list[0]);
1681 TRACE2((
"IOCHAN_RAW_DESC supported!\n"));
1682 ha->
bus_cnt = iocr->hdr.chan_count;
1683 for (bus_no = 0; bus_no < ha->
bus_cnt; ++bus_no) {
1684 if (iocr->list[bus_no].proc_id <
MAXID)
1685 ha->
bus_id[bus_no] = iocr->list[bus_no].proc_id;
1687 ha->
bus_id[bus_no] = 0xff;
1691 chn = (gdth_getch_str *)ha->
pscratch;
1692 for (bus_no = 0; bus_no <
MAXBUS; ++bus_no) {
1693 chn->channel_no = bus_no;
1697 sizeof(gdth_getch_str))) {
1699 printk(
"GDT-HA %d: Error detecting channel count (0x%x)\n",
1705 if (chn->siop_id <
MAXID)
1706 ha->
bus_id[bus_no] = chn->siop_id;
1708 ha->
bus_id[bus_no] = 0xff;
1717 printk(
"GDT-HA %d: Initialization error cache service (code %d)\n",
1722 TRACE2((
"gdth_search_drives() cinfo: vs %x sta %d str %d dw %d b %d\n",
1724 ha->
cpar.write_back,ha->
cpar.block_size));
1731 sizeof(gdth_binfo_str));
1734 TRACE2((
"BOARD_INFO/BOARD_FEATURES supported\n"));
1739 TRACE2((
"BOARD_INFO requires firmware >= 1.10/2.08\n"));
1742 TRACE2((
"Controller name: %s\n",ha->
binfo.type_string));
1747 ioc = (gdth_iochan_str *)ha->
pscratch;
1748 ioc->hdr.version = 0xffffffff;
1749 ioc->hdr.list_entries = MAXBUS;
1750 ioc->hdr.first_chan = 0;
1751 ioc->hdr.last_chan = MAXBUS-1;
1755 for (bus_no = 0; bus_no < ha->
bus_cnt; ++bus_no) {
1756 ha->
raw[bus_no].address = ioc->list[bus_no].address;
1757 ha->
raw[bus_no].local_no = ioc->list[bus_no].local_no;
1760 for (bus_no = 0; bus_no < ha->
bus_cnt; ++bus_no) {
1762 ha->
raw[bus_no].local_no = bus_no;
1765 for (bus_no = 0; bus_no < ha->
bus_cnt; ++bus_no) {
1766 chn = (gdth_getch_str *)ha->
pscratch;
1767 chn->channel_no = ha->
raw[bus_no].local_no;
1771 sizeof(gdth_getch_str))) {
1772 ha->
raw[bus_no].pdev_cnt = chn->drive_cnt;
1773 TRACE2((
"Channel %d: %d phys. drives\n",
1774 bus_no,chn->drive_cnt));
1776 if (ha->
raw[bus_no].pdev_cnt > 0) {
1777 drl = (gdth_drlist_str *)ha->
pscratch;
1778 drl->sc_no = ha->
raw[bus_no].local_no;
1779 drl->sc_cnt = ha->
raw[bus_no].pdev_cnt;
1783 sizeof(gdth_drlist_str))) {
1784 for (j = 0; j < ha->
raw[bus_no].pdev_cnt; ++
j)
1785 ha->
raw[bus_no].id_list[j] = drl->sc_list[j];
1787 ha->
raw[bus_no].pdev_cnt = 0;
1798 for (j = 0; j < drv_cnt; ++
j) {
1801 ha->
hdr[drv_no].is_logdrv =
TRUE;
1802 TRACE2((
"Drive %d is log. drive\n",drv_no));
1806 alst = (gdth_arcdl_str *)ha->
pscratch;
1808 alst->first_entry = 0;
1813 (alst->entries_avail-1) *
sizeof(gdth_alist_str))) {
1814 for (j = 0; j < alst->entries_init; ++
j) {
1815 ha->
hdr[
j].is_arraydrv = alst->list[
j].is_arrayd;
1816 ha->
hdr[
j].is_master = alst->list[
j].is_master;
1817 ha->
hdr[
j].is_parity = alst->list[
j].is_parity;
1818 ha->
hdr[
j].is_hotfix = alst->list[
j].is_hotfix;
1819 ha->
hdr[
j].master_no = alst->list[
j].cd_handle;
1823 0, 35 *
sizeof(gdth_alist_str))) {
1824 for (j = 0; j < 35; ++
j) {
1825 alst2 = &((gdth_alist_str *)ha->
pscratch)[
j];
1826 ha->
hdr[
j].is_arraydrv = alst2->is_arrayd;
1827 ha->
hdr[
j].is_master = alst2->is_master;
1828 ha->
hdr[
j].is_parity = alst2->is_parity;
1829 ha->
hdr[
j].is_hotfix = alst2->is_hotfix;
1830 ha->
hdr[
j].master_no = alst2->cd_handle;
1843 if (force_dma32 || (!ok && ha->
status == (
u16)S_NOFUNC))
1846 printk(
"GDT-HA %d: Initialization error raw service (code %d)\n",
1850 TRACE2((
"gdth_search_drives(): RAWSERVICE initialized\n"));
1855 TRACE2((
"gdth_search_drives(): set features RAWSERVICE OK\n"));
1857 TRACE2((
"gdth_search_dr(): get feat RAWSERVICE %d\n",
1866 TRACE2((
"gdth_search_drives(): set features CACHESERVICE OK\n"));
1868 TRACE2((
"gdth_search_dr(): get feat CACHESERV. %d\n",
1875 if (reserve_mode != 0) {
1877 reserve_mode == 1 ? 1 : 3, 0, 0);
1878 TRACE2((
"gdth_search_drives(): RESERVE_ALL code %d\n",
1882 if (reserve_list[i] == ha->
hanum && reserve_list[i+1] < ha->
bus_cnt &&
1883 reserve_list[i+2] < ha->
tid_cnt && reserve_list[i+3] <
MAXLUN) {
1884 TRACE2((
"gdth_search_drives(): reserve ha %d bus %d id %d lun %d\n",
1885 reserve_list[i], reserve_list[i+1],
1886 reserve_list[i+2], reserve_list[i+3]));
1888 reserve_list[i+1], reserve_list[i+2] |
1889 (reserve_list[i+3] << 8))) {
1890 printk(
"GDT-HA %d: Error raw service (RESERVE, code %d)\n",
1897 oemstr = (gdth_oem_str_ioctl *)ha->
pscratch;
1898 oemstr->params.ctl_version = 0x01;
1899 oemstr->params.buffer_size =
sizeof(oemstr->text);
1902 sizeof(gdth_oem_str_ioctl))) {
1903 TRACE2((
"gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD OK\n"));
1904 printk(
"GDT-HA %d: Vendor: %s Name: %s\n",
1905 ha->
hanum, oemstr->text.oem_company_name, ha->
binfo.type_string);
1911 TRACE2((
"gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD failed\n"));
1912 printk(
"GDT-HA %d: Name: %s\n",
1921 for (i = 0; i < cdev_cnt; ++
i)
1922 gdth_analyse_hdrive(ha, i);
1924 TRACE((
"gdth_search_drives() OK\n"));
1931 int drv_hds, drv_secs;
1933 TRACE((
"gdth_analyse_hdrive() hanum %d drive %d\n", ha->
hanum, hdrive));
1939 ha->
hdr[hdrive].present =
TRUE;
1940 ha->
hdr[hdrive].size = ha->
info;
1944 if (ha->
info2 == 0) {
1945 gdth_eval_mapping(ha->
hdr[hdrive].size,&drv_cyls,&drv_hds,&drv_secs);
1947 drv_hds = ha->
info2 & 0xff;
1948 drv_secs = (ha->
info2 >> 8) & 0xff;
1949 drv_cyls = (
u32)ha->
hdr[hdrive].size / drv_hds / drv_secs;
1951 ha->
hdr[hdrive].heads = (
u8)drv_hds;
1952 ha->
hdr[hdrive].secs = (
u8)drv_secs;
1954 ha->
hdr[hdrive].size = drv_cyls * drv_hds * drv_secs;
1958 && ha->
info2 != 0) {
1962 TRACE2((
"gdth_search_dr() cdr. %d size %d hds %d scs %d\n",
1963 hdrive,ha->
hdr[hdrive].size,drv_hds,drv_secs));
1967 TRACE2((
"gdth_search_dr() cache drive %d devtype %d\n",
1974 TRACE2((
"gdth_search_dr() cache drive %d cluster info %d\n",
1977 ha->
hdr[hdrive].cluster_type = (
u8)ha->
info;
1982 TRACE2((
"gdth_search_dr() cache drive %d r/w attrib. %d\n",
1984 ha->
hdr[hdrive].rw_attribs = (
u8)ha->
info;
1995 struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
1998 unsigned long flags;
2000 TRACE((
"gdth_putq() priority %d\n",priority));
2003 if (!cmndinfo->internal_command)
2013 while (nscp && gdth_cmnd_priv(nscp)->priority <=
priority) {
2017 pscp->
SCp.ptr = (
char *)scp;
2018 scp->
SCp.ptr = (
char *)nscp;
2020 spin_unlock_irqrestore(&ha->
smp_lock, flags);
2022 #ifdef GDTH_STATISTICS
2026 if (max_rq < flags) {
2028 TRACE3((
"GDT: max_rq = %d\n",(
u16)max_rq));
2037 u8 b,
t,
l, firsttime;
2038 u8 this_cmd, next_cmd;
2039 unsigned long flags = 0;
2042 TRACE((
"gdth_next() hanum %d\n", ha->
hanum));
2047 this_cmd = firsttime =
TRUE;
2052 struct gdth_cmndinfo *nscp_cmndinfo = gdth_cmnd_priv(nscp);
2053 if (nscp != pscp && nscp != (
Scsi_Cmnd *)pscp->
SCp.ptr)
2055 if (!nscp_cmndinfo->internal_command) {
2056 b = nscp->
device->channel;
2068 if (gdth_test_busy(ha)) {
2069 TRACE((
"gdth_next() controller %d busy !\n", ha->
hanum));
2070 if (!gdth_polling) {
2071 spin_unlock_irqrestore(&ha->
smp_lock, flags);
2074 while (gdth_test_busy(ha))
2080 if (!nscp_cmndinfo->internal_command) {
2081 if (nscp_cmndinfo->phase == -1) {
2084 TRACE2((
"TEST_UNIT_READY Bus %d Id %d LUN %d\n",
2088 if (b == 0 && t == 0 && l == 0) {
2092 }
else if ((ha->
scan_mode & 0x0f) == 1) {
2093 if (b == 0 && ((t == 0 && l == 1) ||
2094 (t == 1 && l == 0))) {
2096 nscp_cmndinfo->phase = ((ha->
scan_mode & 0x10 ? 1:0) << 8)
2099 TRACE2((
"Scan mode: 0x%x (SCAN_START)\n",
2110 TRACE2((
"Scan mode: 0x%x (SCAN_END)\n",
2124 if (nscp_cmndinfo->OpCode != -1) {
2126 if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t)))
2130 if (!(cmd_index=gdth_fill_raw_cmd(ha, nscp,
BUS_L2P(ha, b))))
2138 if (!nscp_cmndinfo->wait_for_completion)
2139 nscp_cmndinfo->wait_for_completion++;
2141 gdth_scsi_done(nscp);
2143 }
else if (gdth_cmnd_priv(nscp)->internal_command) {
2144 if (!(cmd_index=gdth_special_cmd(ha, nscp)))
2149 !(cmd_index=gdth_fill_raw_cmd(ha, nscp,
BUS_L2P(ha, b))))
2154 TRACE2((
"Command 0x%x to bus %d id %d lun %d -> IGNORE\n",
2155 nscp->
cmnd[0], b, t, l));
2157 if (!nscp_cmndinfo->wait_for_completion)
2158 nscp_cmndinfo->wait_for_completion++;
2160 gdth_scsi_done(nscp);
2162 switch (nscp->
cmnd[0]) {
2171 TRACE((
"cache cmd %x/%x/%x/%x/%x/%x\n",nscp->
cmnd[0],
2176 TRACE2((
"cmd 0x%x target %d: UNIT_ATTENTION\n",
2183 if (!nscp_cmndinfo->wait_for_completion)
2184 nscp_cmndinfo->wait_for_completion++;
2186 gdth_scsi_done(nscp);
2187 }
else if (gdth_internal_cache_cmd(ha, nscp))
2188 gdth_scsi_done(nscp);
2192 TRACE((
"cache cmd %x/%x/%x/%x/%x/%x\n",nscp->
cmnd[0],
2195 if ( (nscp->
cmnd[4]&1) && !(ha->
hdr[t].devtype&1) ) {
2196 TRACE((
"Prevent r. nonremov. drive->do nothing\n"));
2199 if (!nscp_cmndinfo->wait_for_completion)
2200 nscp_cmndinfo->wait_for_completion++;
2202 gdth_scsi_done(nscp);
2204 nscp->
cmnd[3] = (ha->
hdr[
t].devtype&1) ? 1:0;
2205 TRACE((
"Prevent/allow r. %d rem. drive %d\n",
2207 if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t)))
2215 "RESERVE" :
"RELEASE"));
2216 if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t)))
2226 if (ha->
hdr[t].media_changed) {
2228 TRACE2((
"cmd 0x%x target %d: UNIT_ATTENTION\n",
2235 if (!nscp_cmndinfo->wait_for_completion)
2236 nscp_cmndinfo->wait_for_completion++;
2238 gdth_scsi_done(nscp);
2239 }
else if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t)))
2244 TRACE2((
"cache cmd %x/%x/%x/%x/%x/%x unknown\n",nscp->
cmnd[0],
2247 printk(
"GDT-HA %d: Unknown SCSI command 0x%x to cache service !\n",
2250 if (!nscp_cmndinfo->wait_for_completion)
2251 nscp_cmndinfo->wait_for_completion++;
2253 gdth_scsi_done(nscp);
2263 pscp->
SCp.ptr = nscp->
SCp.ptr;
2269 gdth_release_event(ha);
2273 spin_unlock_irqrestore(&ha->
smp_lock, flags);
2275 if (gdth_polling && ha->
cmd_cnt > 0) {
2277 printk(
"GDT-HA %d: Command %d timed out !\n",
2278 ha->
hanum, cmd_index);
2289 u16 cpcount,
i, max_sg = scsi_sg_count(scp);
2294 cpcount =
min_t(
u16, count, scsi_bufflen(scp));
2299 unsigned long flags;
2301 TRACE((
"copy_internal() now %d sum %d count %d %d\n",
2302 cpnow, cpsum, cpcount, scsi_bufflen(scp)));
2303 if (cpsum+cpnow > cpcount)
2304 cpnow = cpcount - cpsum;
2307 printk(
"GDT-HA %d: invalid sc/gt element in gdth_copy_internal_data()\n",
2313 memcpy(address, buffer, cpnow);
2317 if (cpsum == cpcount)
2322 printk(
"GDT-HA %d: SCSI command with no buffers but data transfer expected!\n",
2332 gdth_rdcap_data rdc;
2334 gdth_modep_data mpd;
2335 struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
2338 TRACE((
"gdth_internal_cache_cmd() cmd 0x%x hdrive %d\n",
2344 switch (scp->
cmnd[0]) {
2348 TRACE2((
"Test/Verify/Start hdrive %d\n",t));
2352 TRACE2((
"Inquiry hdrive %d devtype %d\n",
2353 t,ha->
hdr[t].devtype));
2357 inq.modif_rmb = 0x00;
2358 if ((ha->
hdr[t].devtype & 1) ||
2360 inq.modif_rmb = 0x80;
2365 sprintf(inq.product,
"Host Drive #%02d",t);
2366 strcpy(inq.revision,
" ");
2367 gdth_copy_internal_data(ha, scp, (
char*)&inq,
sizeof(gdth_inq_data));
2371 TRACE2((
"Request sense hdrive %d\n",t));
2372 sd.errorcode = 0x70;
2377 gdth_copy_internal_data(ha, scp, (
char*)&sd,
sizeof(gdth_sense_data));
2381 TRACE2((
"Mode sense hdrive %d\n",t));
2382 memset((
char*)&mpd,0,
sizeof(gdth_modep_data));
2383 mpd.hd.data_length =
sizeof(gdth_modep_data);
2384 mpd.hd.dev_par = (ha->
hdr[
t].devtype&2) ? 0x80:0;
2385 mpd.hd.bd_length =
sizeof(mpd.bd);
2386 mpd.bd.block_length[0] = (
SECTOR_SIZE & 0x00ff0000) >> 16;
2387 mpd.bd.block_length[1] = (
SECTOR_SIZE & 0x0000ff00) >> 8;
2388 mpd.bd.block_length[2] = (
SECTOR_SIZE & 0x000000ff);
2389 gdth_copy_internal_data(ha, scp, (
char*)&mpd,
sizeof(gdth_modep_data));
2393 TRACE2((
"Read capacity hdrive %d\n",t));
2394 if (ha->
hdr[t].size > (
u64)0xffffffff)
2395 rdc.last_block_no = 0xffffffff;
2399 gdth_copy_internal_data(ha, scp, (
char*)&rdc,
sizeof(gdth_rdcap_data));
2405 gdth_rdcap16_data rdc16;
2407 TRACE2((
"Read capacity (16) hdrive %d\n",t));
2410 gdth_copy_internal_data(ha, scp, (
char*)&rdc16,
2411 sizeof(gdth_rdcap16_data));
2418 TRACE2((
"Internal cache cmd 0x%x unknown\n",scp->
cmnd[0]));
2422 if (!cmndinfo->wait_for_completion)
2423 cmndinfo->wait_for_completion++;
2432 register gdth_cmd_str *cmdp;
2433 struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
2436 int i, cmd_index, read_write, sgcnt, mode64;
2439 TRACE((
"gdth_fill_cache_cmd() cmd 0x%x cmdsize %d hdrive %d\n",
2451 cmdp->RequestBuffer =
scp;
2453 if (!(cmd_index=gdth_get_cmd_index(ha))) {
2454 TRACE((
"GDT: No free command index found\n"));
2463 if (cmndinfo->OpCode != -1)
2464 cmdp->OpCode = cmndinfo->OpCode;
2470 if (scp->
cmnd[4] & 1)
2472 else if (scp->
cmnd[3] & 1)
2480 if (gdth_write_through || ((ha->
hdr[hdrive].rw_attribs & 1) &&
2492 cmdp->u.cache64.DeviceNo = hdrive;
2493 cmdp->u.cache64.BlockNo = 1;
2494 cmdp->u.cache64.sg_canz = 0;
2496 cmdp->u.cache.DeviceNo = hdrive;
2497 cmdp->u.cache.BlockNo = 1;
2498 cmdp->u.cache.sg_canz = 0;
2507 }
else if (scp->
cmd_len == 10) {
2515 blockcnt= scp->
cmnd[4]==0 ? 0x100 : scp->
cmnd[4];
2518 cmdp->u.cache64.BlockNo = blockno;
2519 cmdp->u.cache64.BlockCnt = blockcnt;
2521 cmdp->u.cache.BlockNo = (
u32)blockno;
2522 cmdp->u.cache.BlockCnt = blockcnt;
2525 if (scsi_bufflen(scp)) {
2526 cmndinfo->dma_dir = (read_write == 1 ?
2528 sgcnt = pci_map_sg(ha->
pdev, scsi_sglist(scp), scsi_sg_count(scp),
2533 cmdp->u.cache64.DestAddr= (
u64)-1;
2534 cmdp->u.cache64.sg_canz = sgcnt;
2537 #ifdef GDTH_DMA_STATISTICS
2538 if (cmdp->u.cache64.sg_lst[i].sg_ptr > (
u64)0xffffffff)
2543 cmdp->u.cache64.sg_lst[
i].sg_len =
sg_dma_len(sl);
2548 cmdp->u.cache.DestAddr= 0xffffffff;
2549 cmdp->u.cache.sg_canz = sgcnt;
2552 #ifdef GDTH_DMA_STATISTICS
2559 #ifdef GDTH_STATISTICS
2560 if (max_sg < (
u32)sgcnt) {
2561 max_sg = (
u32)sgcnt;
2562 TRACE3((
"GDT: max_sg = %d\n",max_sg));
2570 TRACE((
"cache cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
2571 cmdp->u.cache64.DestAddr,cmdp->u.cache64.sg_canz,
2572 cmdp->u.cache64.sg_lst[0].sg_ptr,
2573 cmdp->u.cache64.sg_lst[0].sg_len));
2574 TRACE((
"cache cmd: cmd %d blockno. %d, blockcnt %d\n",
2575 cmdp->OpCode,cmdp->u.cache64.BlockNo,cmdp->u.cache64.BlockCnt));
2577 (
u16)cmdp->u.cache64.sg_canz *
sizeof(gdth_sg64_str);
2579 TRACE((
"cache cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
2580 cmdp->u.cache.DestAddr,cmdp->u.cache.sg_canz,
2581 cmdp->u.cache.sg_lst[0].sg_ptr,
2582 cmdp->u.cache.sg_lst[0].sg_len));
2583 TRACE((
"cache cmd: cmd %d blockno. %d, blockcnt %d\n",
2584 cmdp->OpCode,cmdp->u.cache.BlockNo,cmdp->u.cache.BlockCnt));
2586 (
u16)cmdp->u.cache.sg_canz *
sizeof(gdth_sg_str);
2594 TRACE2((
"gdth_fill_cache() DPMEM overflow\n"));
2601 gdth_copy_command(ha);
2607 register gdth_cmd_str *cmdp;
2610 int cmd_index, sgcnt, mode64;
2614 struct gdth_cmndinfo *cmndinfo;
2619 TRACE((
"gdth_fill_raw_cmd() cmd 0x%x bus %d ID %d LUN %d\n",
2620 scp->
cmnd[0],b,t,l));
2628 cmdp->RequestBuffer =
scp;
2630 if (!(cmd_index=gdth_get_cmd_index(ha))) {
2631 TRACE((
"GDT: No free command index found\n"));
2638 cmndinfo = gdth_cmnd_priv(scp);
2640 if (cmndinfo->OpCode != -1) {
2641 cmdp->OpCode = cmndinfo->OpCode;
2644 cmdp->u.raw64.direction = (cmndinfo->phase >> 8);
2645 TRACE2((
"special raw cmd 0x%x param 0x%x\n",
2646 cmdp->OpCode, cmdp->u.raw64.direction));
2650 cmdp->u.raw.direction = (cmndinfo->phase >> 8);
2651 TRACE2((
"special raw cmd 0x%x param 0x%x\n",
2652 cmdp->OpCode, cmdp->u.raw.direction));
2660 sense_paddr = pci_map_page(ha->
pdev,page,offset,
2663 cmndinfo->sense_paddr = sense_paddr;
2667 cmdp->u.raw64.reserved = 0;
2668 cmdp->u.raw64.mdisc_time = 0;
2669 cmdp->u.raw64.mcon_time = 0;
2670 cmdp->u.raw64.clen = scp->
cmd_len;
2671 cmdp->u.raw64.target =
t;
2672 cmdp->u.raw64.lun =
l;
2673 cmdp->u.raw64.bus =
b;
2674 cmdp->u.raw64.priority = 0;
2675 cmdp->u.raw64.sdlen = scsi_bufflen(scp);
2676 cmdp->u.raw64.sense_len = 16;
2677 cmdp->u.raw64.sense_data = sense_paddr;
2678 cmdp->u.raw64.direction =
2681 cmdp->u.raw64.sg_ranz = 0;
2683 cmdp->u.raw.reserved = 0;
2684 cmdp->u.raw.mdisc_time = 0;
2685 cmdp->u.raw.mcon_time = 0;
2686 cmdp->u.raw.clen = scp->
cmd_len;
2687 cmdp->u.raw.target =
t;
2688 cmdp->u.raw.lun =
l;
2689 cmdp->u.raw.bus =
b;
2690 cmdp->u.raw.priority = 0;
2691 cmdp->u.raw.link_p = 0;
2692 cmdp->u.raw.sdlen = scsi_bufflen(scp);
2693 cmdp->u.raw.sense_len = 16;
2694 cmdp->u.raw.sense_data = sense_paddr;
2695 cmdp->u.raw.direction =
2698 cmdp->u.raw.sg_ranz = 0;
2701 if (scsi_bufflen(scp)) {
2703 sgcnt = pci_map_sg(ha->
pdev, scsi_sglist(scp), scsi_sg_count(scp),
2708 cmdp->u.raw64.sdata = (
u64)-1;
2709 cmdp->u.raw64.sg_ranz = sgcnt;
2712 #ifdef GDTH_DMA_STATISTICS
2713 if (cmdp->u.raw64.sg_lst[i].sg_ptr > (
u64)0xffffffff)
2723 cmdp->u.raw.sdata = 0xffffffff;
2724 cmdp->u.raw.sg_ranz = sgcnt;
2727 #ifdef GDTH_DMA_STATISTICS
2734 #ifdef GDTH_STATISTICS
2735 if (max_sg < sgcnt) {
2737 TRACE3((
"GDT: max_sg = %d\n",sgcnt));
2743 TRACE((
"raw cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
2744 cmdp->u.raw64.sdata,cmdp->u.raw64.sg_ranz,
2745 cmdp->u.raw64.sg_lst[0].sg_ptr,
2746 cmdp->u.raw64.sg_lst[0].sg_len));
2749 (
u16)cmdp->u.raw64.sg_ranz *
sizeof(gdth_sg64_str);
2751 TRACE((
"raw cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
2752 cmdp->u.raw.sdata,cmdp->u.raw.sg_ranz,
2753 cmdp->u.raw.sg_lst[0].sg_ptr,
2754 cmdp->u.raw.sg_lst[0].sg_len));
2757 (
u16)cmdp->u.raw.sg_ranz *
sizeof(gdth_sg_str);
2767 TRACE2((
"gdth_fill_raw() DPMEM overflow\n"));
2774 gdth_copy_command(ha);
2780 register gdth_cmd_str *cmdp;
2781 struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
2785 TRACE2((
"gdth_special_cmd(): "));
2790 *cmdp = *cmndinfo->internal_cmd_str;
2791 cmdp->RequestBuffer =
scp;
2794 if (!(cmd_index=gdth_get_cmd_index(ha))) {
2795 TRACE((
"GDT: No free command index found\n"));
2809 TRACE2((
"cache command %d\n",cmdp->OpCode));
2812 GDTOFFSOF(gdth_cmd_str,
u.cache64.sg_lst) +
sizeof(gdth_sg64_str);
2815 GDTOFFSOF(gdth_cmd_str,
u.cache.sg_lst) +
sizeof(gdth_sg_str);
2817 TRACE2((
"raw command %d\n",cmdp->OpCode));
2820 GDTOFFSOF(gdth_cmd_str,
u.raw64.sg_lst) +
sizeof(gdth_sg64_str);
2823 GDTOFFSOF(gdth_cmd_str,
u.raw.sg_lst) +
sizeof(gdth_sg_str);
2832 TRACE2((
"gdth_special_cmd() DPMEM overflow\n"));
2839 gdth_copy_command(ha);
2852 TRACE2((
"gdth_store_event() source %d idx %d\n", source, idx));
2856 if (ebuffer[elastidx].event_source == source &&
2857 ebuffer[elastidx].event_idx == idx &&
2858 ((evt->size != 0 && ebuffer[elastidx].event_data.size != 0 &&
2860 (
char *)&evt->eu, evt->size)) ||
2861 (evt->size == 0 && ebuffer[elastidx].event_data.size == 0 &&
2863 (
char *)&evt->event_string)))) {
2864 e = &ebuffer[elastidx];
2866 e->last_stamp = tv.tv_sec;
2869 if (ebuffer[elastidx].event_source != 0) {
2873 if (elastidx == eoldidx) {
2879 e = &ebuffer[elastidx];
2880 e->event_source =
source;
2883 e->first_stamp = e->last_stamp = tv.tv_sec;
2885 e->event_data = *
evt;
2895 unsigned long flags;
2897 TRACE2((
"gdth_read_event() handle %d\n", handle));
2903 estr->event_source = 0;
2906 spin_unlock_irqrestore(&ha->
smp_lock, flags);
2909 e = &ebuffer[eindex];
2910 if (e->event_source != 0) {
2911 if (eindex != elastidx) {
2917 memcpy(estr, e,
sizeof(gdth_evt_str));
2919 spin_unlock_irqrestore(&ha->
smp_lock, flags);
2928 unsigned long flags;
2931 TRACE2((
"gdth_readapp_event() app. %d\n", application));
2935 e = &ebuffer[eindex];
2936 if (e->event_source == 0)
2938 if ((e->application & application) == 0) {
2943 if (eindex == elastidx)
2949 memcpy(estr, e,
sizeof(gdth_evt_str));
2951 estr->event_source = 0;
2952 spin_unlock_irqrestore(&ha->
smp_lock, flags);
2955 static void gdth_clear_events(
void)
2957 TRACE((
"gdth_clear_events()"));
2959 eoldidx = elastidx = 0;
2960 ebuffer[0].event_source = 0;
2967 int gdth_from_wait,
int* pIndex)
2970 gdt6_dpram_str
__iomem *dp6_ptr;
2971 gdt2_dpram_str
__iomem *dp2_ptr;
2976 unsigned long flags = 0;
2978 int coalesced =
FALSE;
2980 gdth_coal_status *pcs =
NULL;
2981 int act_int_coal = 0;
2984 TRACE((
"gdth_interrupt() IRQ %d\n", ha->
irq));
2988 if (!gdth_from_wait) {
2997 IStatus = gdth_get_status(ha);
3001 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3005 #ifdef GDTH_STATISTICS
3014 pcs = ha->coal_stat;
3023 IStatus = (
u8)(pcs->status & 0xff);
3028 if (IStatus & 0x80) {
3031 TRACE2((
"gdth_interrupt() error %d/%d\n",IStatus,ha->
status));
3042 if (IStatus & 0x80) {
3045 TRACE2((
"gdth_interrupt() error %d/%d\n",IStatus,ha->
status));
3048 ha->
info =
readl(&dp2_ptr->u.ic.Info[0]);
3052 writeb(0xff, &dp2_ptr->io.irqdel);
3053 writeb(0, &dp2_ptr->u.ic.Cmd_Index);
3054 writeb(0, &dp2_ptr->io.Sema1);
3057 if (IStatus & 0x80) {
3060 TRACE2((
"gdth_interrupt() error %d/%d\n",IStatus,ha->
status));
3063 ha->
info =
readl(&dp6_ptr->u.ic.Info[0]);
3067 writeb(0xff, &dp6_ptr->io.irqdel);
3068 writeb(0, &dp6_ptr->u.ic.Cmd_Index);
3069 writeb(0, &dp6_ptr->io.Sema1);
3071 if (IStatus & 0x80) {
3074 TRACE2((
"gdth_interrupt() error %d/%d\n",IStatus,ha->
status));
3085 if (IStatus & 0x80) {
3089 ha->
status = pcs->ext_status & 0xffff;
3093 TRACE2((
"gdth_interrupt() error %d/%d\n",IStatus,ha->
status));
3099 ha->
info = pcs->info0;
3100 ha->
info2 = pcs->info1;
3101 ha->
service = (pcs->ext_status >> 16) & 0xffff;
3105 ha->
info =
readl(&dp6m_ptr->i960r.info[0]);
3112 (ha->
fw_vers & 0xff) >= 0x1a) {
3114 (&((gdt6m_dpram_str
__iomem *)ha->
brd)->i960r.severity);
3115 for (i = 0; i < 256; ++
i) {
3117 (&((gdt6m_dpram_str
__iomem *)ha->
brd)->i960r.evt_str[i]);
3118 if (ha->
dvr.event_string[i] == 0)
3129 writeb(0xff, &dp6m_ptr->i960r.edoor_reg);
3130 writeb(0, &dp6m_ptr->i960r.sema1_reg);
3133 TRACE2((
"gdth_interrupt() unknown controller type\n"));
3135 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3139 TRACE((
"gdth_interrupt() index %d stat %d info %d\n",
3142 if (gdth_from_wait) {
3143 *pIndex = (
int)IStatus;
3147 TRACE2((
"gdth_interrupt() async. event\n"));
3148 gdth_async_event(ha);
3150 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3156 TRACE2((
"Service unknown or not initialized !\n"));
3157 ha->
dvr.size =
sizeof(ha->
dvr.eu.driver);
3158 ha->
dvr.eu.driver.ionode = ha->
hanum;
3161 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3164 scp = ha->
cmd_tab[IStatus-2].cmnd;
3165 Service = ha->
cmd_tab[IStatus-2].service;
3168 TRACE2((
"gdth_interrupt() index to unused command (%d)\n",IStatus));
3169 ha->
dvr.size =
sizeof(ha->
dvr.eu.driver);
3170 ha->
dvr.eu.driver.ionode = ha->
hanum;
3171 ha->
dvr.eu.driver.index = IStatus;
3174 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3178 TRACE((
"gdth_interrupt() answer to internal command\n"));
3180 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3184 TRACE((
"gdth_interrupt() sync. status\n"));
3185 rval = gdth_sync_event(ha,Service,IStatus,scp);
3187 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3189 gdth_putq(ha, scp, gdth_cmnd_priv(scp)->priority);
3190 }
else if (rval == 1) {
3191 gdth_scsi_done(scp);
3198 #ifdef GDTH_STATISTICS
3200 if (act_int_coal > max_int_coal) {
3201 max_int_coal = act_int_coal;
3202 printk(
"GDT: max_int_coal = %d\n",(
u16)max_int_coal);
3206 if (pcs->status == 0)
3214 writeb(0xff, &dp6m_ptr->i960r.edoor_reg);
3215 writeb(0, &dp6m_ptr->i960r.sema1_reg);
3227 return __gdth_interrupt(ha,
false, NULL);
3230 static int gdth_sync_event(
gdth_ha_str *ha,
int service,
u8 index,
3236 struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
3239 TRACE((
"gdth_sync_event() serv %d status %d\n",
3244 TRACE((
"len: %d, answer: %d, ext: %d, alen: %d\n",
3245 msg->msg_len,msg->msg_answer,msg->msg_ext,msg->msg_alen));
3246 if (msg->msg_len >
MSGLEN+1)
3249 if (!(msg->msg_answer && msg->msg_ext)) {
3250 msg->msg_text[msg->msg_len] =
'\0';
3251 printk(
"%s",msg->msg_text);
3254 if (msg->msg_ext && !msg->msg_answer) {
3255 while (gdth_test_busy(ha))
3259 gdth_get_cmd_index(ha);
3263 cmdp->u.screen.reserved = 0;
3264 cmdp->u.screen.su.msg.msg_handle= msg->msg_handle;
3265 cmdp->u.screen.su.msg.msg_addr = ha->
msg_phys;
3270 gdth_copy_command(ha);
3271 gdth_release_event(ha);
3275 if (msg->msg_answer && msg->msg_alen) {
3277 if (msg->msg_alen == 1) {
3280 msg->msg_text[0] = 0;
3284 msg->msg_text[0] = 1;
3285 msg->msg_text[1] = 0;
3288 msg->msg_answer = 0;
3289 while (gdth_test_busy(ha))
3293 gdth_get_cmd_index(ha);
3297 cmdp->u.screen.reserved = 0;
3298 cmdp->u.screen.su.msg.msg_handle= msg->msg_handle;
3299 cmdp->u.screen.su.msg.msg_addr = ha->
msg_phys;
3304 gdth_copy_command(ha);
3305 gdth_release_event(ha);
3311 b = scp->
device->channel;
3313 if (cmndinfo->OpCode == -1 && b != ha->
virt_bus) {
3318 TRACE2((
"Controller busy -> retry !\n"));
3324 if (scsi_bufflen(scp))
3325 pci_unmap_sg(ha->
pdev, scsi_sglist(scp), scsi_sg_count(scp),
3328 if (cmndinfo->sense_paddr)
3329 pci_unmap_page(ha->
pdev, cmndinfo->sense_paddr, 16,
3333 cmndinfo->status =
S_OK;
3334 cmndinfo->info = ha->
info;
3335 if (cmndinfo->OpCode != -1) {
3336 TRACE2((
"gdth_sync_event(): special cmd 0x%x OK\n",
3341 if (!(ha->
hdr[t].cluster_type &
3345 if (ha->
hdr[t].cluster_type &
3348 cmndinfo->phase = -2;
3351 cmndinfo->OpCode = -1;
3358 ha->
hdr[
t].cluster_type &= ~CLUSTER_MOUNTED;
3361 cmndinfo->OpCode = -1;
3377 cmndinfo->status = ha->
status;
3378 cmndinfo->info = ha->
info;
3380 if (cmndinfo->OpCode != -1) {
3381 TRACE2((
"gdth_sync_event(): special cmd 0x%x error 0x%x\n",
3382 cmndinfo->OpCode, ha->
status));
3385 cmndinfo->OpCode = -1;
3396 (ha->
hdr[t].cluster_type &
3409 if (!cmndinfo->internal_command) {
3410 ha->
dvr.size =
sizeof(ha->
dvr.eu.sync);
3411 ha->
dvr.eu.sync.ionode = ha->
hanum;
3414 ha->
dvr.eu.sync.info = ha->
info;
3415 ha->
dvr.eu.sync.hostdrive =
t;
3416 if (ha->
status >= 0x8000)
3419 gdth_store_event(ha,
ES_SYNC, service, &ha->
dvr);
3430 if (!cmndinfo->wait_for_completion)
3431 cmndinfo->wait_for_completion++;
3439 static char *async_cache_tab[] = {
3440 "\011\000\002\002\002\004\002\006\004"
3441 "GDT HA %u, service %u, async. status %u/%lu unknown",
3442 "\011\000\002\002\002\004\002\006\004"
3443 "GDT HA %u, service %u, async. status %u/%lu unknown",
3444 "\005\000\002\006\004"
3445 "GDT HA %u, Host Drive %lu not ready",
3446 "\005\000\002\006\004"
3447 "GDT HA %u, Host Drive %lu: REASSIGN not successful and/or data error on reassigned blocks. Drive may crash in the future and should be replaced",
3448 "\005\000\002\006\004"
3449 "GDT HA %u, mirror update on Host Drive %lu failed",
3450 "\005\000\002\006\004"
3451 "GDT HA %u, Mirror Drive %lu failed",
3452 "\005\000\002\006\004"
3453 "GDT HA %u, Mirror Drive %lu: REASSIGN not successful and/or data error on reassigned blocks. Drive may crash in the future and should be replaced",
3454 "\005\000\002\006\004"
3455 "GDT HA %u, Host Drive %lu write protected",
3456 "\005\000\002\006\004"
3457 "GDT HA %u, media changed in Host Drive %lu",
3458 "\005\000\002\006\004"
3459 "GDT HA %u, Host Drive %lu is offline",
3460 "\005\000\002\006\004"
3461 "GDT HA %u, media change of Mirror Drive %lu",
3462 "\005\000\002\006\004"
3463 "GDT HA %u, Mirror Drive %lu is write protected",
3464 "\005\000\002\006\004"
3465 "GDT HA %u, general error on Host Drive %lu. Please check the devices of this drive!",
3466 "\007\000\002\006\002\010\002"
3467 "GDT HA %u, Array Drive %u: Cache Drive %u failed",
3468 "\005\000\002\006\002"
3469 "GDT HA %u, Array Drive %u: FAIL state entered",
3470 "\005\000\002\006\002"
3471 "GDT HA %u, Array Drive %u: error",
3472 "\007\000\002\006\002\010\002"
3473 "GDT HA %u, Array Drive %u: failed drive replaced by Cache Drive %u",
3474 "\005\000\002\006\002"
3475 "GDT HA %u, Array Drive %u: parity build failed",
3476 "\005\000\002\006\002"
3477 "GDT HA %u, Array Drive %u: drive rebuild failed",
3478 "\005\000\002\010\002"
3479 "GDT HA %u, Test of Hot Fix %u failed",
3480 "\005\000\002\006\002"
3481 "GDT HA %u, Array Drive %u: drive build finished successfully",
3482 "\005\000\002\006\002"
3483 "GDT HA %u, Array Drive %u: drive rebuild finished successfully",
3484 "\007\000\002\006\002\010\002"
3485 "GDT HA %u, Array Drive %u: Hot Fix %u activated",
3486 "\005\000\002\006\002"
3487 "GDT HA %u, Host Drive %u: processing of i/o aborted due to serious drive error",
3488 "\005\000\002\010\002"
3489 "GDT HA %u, mirror update on Cache Drive %u completed",
3490 "\005\000\002\010\002"
3491 "GDT HA %u, mirror update on Cache Drive %lu failed",
3492 "\005\000\002\006\002"
3493 "GDT HA %u, Array Drive %u: drive rebuild started",
3494 "\005\000\002\012\001"
3495 "GDT HA %u, Fault bus %u: SHELF OK detected",
3496 "\005\000\002\012\001"
3497 "GDT HA %u, Fault bus %u: SHELF not OK detected",
3498 "\007\000\002\012\001\013\001"
3499 "GDT HA %u, Fault bus %u, ID %u: Auto Hot Plug started",
3500 "\007\000\002\012\001\013\001"
3501 "GDT HA %u, Fault bus %u, ID %u: new disk detected",
3502 "\007\000\002\012\001\013\001"
3503 "GDT HA %u, Fault bus %u, ID %u: old disk detected",
3504 "\007\000\002\012\001\013\001"
3505 "GDT HA %u, Fault bus %u, ID %u: plugging an active disk is invalid",
3506 "\007\000\002\012\001\013\001"
3507 "GDT HA %u, Fault bus %u, ID %u: invalid device detected",
3508 "\011\000\002\012\001\013\001\006\004"
3509 "GDT HA %u, Fault bus %u, ID %u: insufficient disk capacity (%lu MB required)",
3510 "\007\000\002\012\001\013\001"
3511 "GDT HA %u, Fault bus %u, ID %u: disk write protected",
3512 "\007\000\002\012\001\013\001"
3513 "GDT HA %u, Fault bus %u, ID %u: disk not available",
3514 "\007\000\002\012\001\006\004"
3515 "GDT HA %u, Fault bus %u: swap detected (%lu)",
3516 "\007\000\002\012\001\013\001"
3517 "GDT HA %u, Fault bus %u, ID %u: Auto Hot Plug finished successfully",
3518 "\007\000\002\012\001\013\001"
3519 "GDT HA %u, Fault bus %u, ID %u: Auto Hot Plug aborted due to user Hot Plug",
3520 "\007\000\002\012\001\013\001"
3521 "GDT HA %u, Fault bus %u, ID %u: Auto Hot Plug aborted",
3522 "\007\000\002\012\001\013\001"
3523 "GDT HA %u, Fault bus %u, ID %u: Auto Hot Plug for Hot Fix started",
3524 "\005\000\002\006\002"
3525 "GDT HA %u, Array Drive %u: drive build started",
3527 "GDT HA %u, DRAM parity error detected",
3528 "\005\000\002\006\002"
3529 "GDT HA %u, Mirror Drive %u: update started",
3530 "\007\000\002\006\002\010\002"
3531 "GDT HA %u, Mirror Drive %u: Hot Fix %u activated",
3532 "\005\000\002\006\002"
3533 "GDT HA %u, Array Drive %u: no matching Pool Hot Fix Drive available",
3534 "\005\000\002\006\002"
3535 "GDT HA %u, Array Drive %u: Pool Hot Fix Drive available",
3536 "\005\000\002\006\002"
3537 "GDT HA %u, Mirror Drive %u: no matching Pool Hot Fix Drive available",
3538 "\005\000\002\006\002"
3539 "GDT HA %u, Mirror Drive %u: Pool Hot Fix Drive available",
3540 "\007\000\002\012\001\013\001"
3541 "GDT HA %u, SCSI bus %u, ID %u: IGNORE_WIDE_RESIDUE message received",
3542 "\005\000\002\006\002"
3543 "GDT HA %u, Array Drive %u: expand started",
3544 "\005\000\002\006\002"
3545 "GDT HA %u, Array Drive %u: expand finished successfully",
3546 "\005\000\002\006\002"
3547 "GDT HA %u, Array Drive %u: expand failed",
3549 "GDT HA %u, CPU temperature critical",
3551 "GDT HA %u, CPU temperature OK",
3552 "\005\000\002\006\004"
3553 "GDT HA %u, Host drive %lu created",
3554 "\005\000\002\006\002"
3555 "GDT HA %u, Array Drive %u: expand restarted",
3556 "\005\000\002\006\002"
3557 "GDT HA %u, Array Drive %u: expand stopped",
3558 "\005\000\002\010\002"
3559 "GDT HA %u, Mirror Drive %u: drive build quited",
3560 "\005\000\002\006\002"
3561 "GDT HA %u, Array Drive %u: parity build quited",
3562 "\005\000\002\006\002"
3563 "GDT HA %u, Array Drive %u: drive rebuild quited",
3564 "\005\000\002\006\002"
3565 "GDT HA %u, Array Drive %u: parity verify started",
3566 "\005\000\002\006\002"
3567 "GDT HA %u, Array Drive %u: parity verify done",
3568 "\005\000\002\006\002"
3569 "GDT HA %u, Array Drive %u: parity verify failed",
3570 "\005\000\002\006\002"
3571 "GDT HA %u, Array Drive %u: parity error detected",
3572 "\005\000\002\006\002"
3573 "GDT HA %u, Array Drive %u: parity verify quited",
3574 "\005\000\002\006\002"
3575 "GDT HA %u, Host Drive %u reserved",
3576 "\005\000\002\006\002"
3577 "GDT HA %u, Host Drive %u mounted and released",
3578 "\005\000\002\006\002"
3579 "GDT HA %u, Host Drive %u released",
3581 "GDT HA %u, DRAM error detected and corrected with ECC",
3583 "GDT HA %u, Uncorrectable DRAM error detected with ECC",
3584 "\011\000\002\012\001\013\001\014\001"
3585 "GDT HA %u, SCSI bus %u, ID %u, LUN %u: reassigning block",
3586 "\005\000\002\006\002"
3587 "GDT HA %u, Host drive %u resetted locally",
3588 "\005\000\002\006\002"
3589 "GDT HA %u, Host drive %u resetted remotely",
3591 "GDT HA %u, async. status 75 unknown",
3601 TRACE2((
"gdth_async_event() ha %d serv %d\n",
3606 while (gdth_test_busy(ha))
3610 cmd_index = gdth_get_cmd_index(ha);
3614 cmdp->u.screen.reserved = 0;
3616 cmdp->u.screen.su.msg.msg_addr = ha->
msg_phys;
3621 gdth_copy_command(ha);
3629 gdth_release_event(ha);
3634 (ha->
fw_vers & 0xff) >= 0x1a) {
3636 ha->
dvr.eu.async.ionode = ha->
hanum;
3640 ha->
dvr.size =
sizeof(ha->
dvr.eu.async);
3641 ha->
dvr.eu.async.ionode = ha->
hanum;
3644 ha->
dvr.eu.async.info = ha->
info;
3648 gdth_log_event( &ha->
dvr, NULL );
3652 TRACE2((
"gdth_async_event(): new host drive %d created\n",
3660 static void gdth_log_event(gdth_evt_data *dvr,
char *buffer)
3662 gdth_stackframe
stack;
3666 TRACE2((
"gdth_log_event()\n"));
3667 if (dvr->size == 0) {
3668 if (buffer == NULL) {
3669 printk(
"Adapter %d: %s\n",dvr->eu.async.ionode,dvr->event_string);
3671 sprintf(buffer,
"Adapter %d: %s\n",
3672 dvr->eu.async.ionode,dvr->event_string);
3675 INDEX_OK(dvr->eu.async.status, async_cache_tab)) {
3676 TRACE2((
"GDT: Async. event cache service, event no.: %d\n",
3677 dvr->eu.async.status));
3679 f = async_cache_tab[dvr->eu.async.status];
3682 for (j=0,i=1; i < f[0]; i+=2) {
3685 stack.b[j++] = *(
u32*)&dvr->eu.stream[(
int)f[
i]];
3688 stack.b[j++] = *(
u16*)&dvr->eu.stream[(
int)f[
i]];
3691 stack.b[j++] = *(
u8*)&dvr->eu.stream[(
int)f[
i]];
3698 if (buffer == NULL) {
3699 printk(&f[(
int)f[0]],stack);
3702 sprintf(buffer,&f[(
int)f[0]],stack);
3706 if (buffer == NULL) {
3707 printk(
"GDT HA %u, Unknown async. event service %d event no. %d\n",
3708 dvr->eu.async.ionode,dvr->eu.async.service,dvr->eu.async.status);
3710 sprintf(buffer,
"GDT HA %u, Unknown async. event service %d event no. %d",
3711 dvr->eu.async.ionode,dvr->eu.async.service,dvr->eu.async.status);
3716 #ifdef GDTH_STATISTICS
3717 static u8 gdth_timer_running;
3719 static void gdth_timeout(
unsigned long data)
3724 unsigned long flags;
3726 if(
unlikely(list_empty(&gdth_instances))) {
3727 gdth_timer_running = 0;
3741 TRACE2((
"gdth_to(): ints %d, ios %d, act_stats %d, act_rq %d\n",
3742 act_ints, act_ios, act_stats, act_rq));
3743 act_ints = act_ios = 0;
3747 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3750 static void gdth_timer_init(
void)
3752 if (gdth_timer_running)
3754 gdth_timer_running = 1;
3755 TRACE2((
"gdth_detect(): Initializing timer !\n"));
3757 gdth_timer.data = 0
L;
3758 gdth_timer.function = gdth_timeout;
3762 static inline void gdth_timer_init(
void)
3767 static void __init internal_setup(
char *str,
int *ints)
3770 char *cur_str, *argv;
3772 TRACE2((
"internal_setup() str %s ints[0] %d\n",
3773 str ? str:
"NULL", ints ? ints[0]:0));
3781 for (i = 0; i <
argc; ++
i)
3788 while (argv && (cur_str =
strchr(argv,
':'))) {
3789 int val = 0, c = *++cur_str;
3791 if (c ==
'n' || c ==
'N')
3793 else if (c ==
'y' || c ==
'Y')
3798 if (!
strncmp(argv,
"disable:", 8))
3800 else if (!
strncmp(argv,
"reserve_mode:", 13))
3802 else if (!
strncmp(argv,
"reverse_scan:", 13))
3804 else if (!
strncmp(argv,
"hdr_channel:", 12))
3806 else if (!
strncmp(argv,
"max_ids:", 8))
3808 else if (!
strncmp(argv,
"rescan:", 7))
3810 else if (!
strncmp(argv,
"shared_access:", 14))
3811 shared_access = val;
3812 else if (!
strncmp(argv,
"probe_eisa_isa:", 15))
3813 probe_eisa_isa = val;
3814 else if (!
strncmp(argv,
"reserve_list:", 13)) {
3815 reserve_list[0] =
val;
3817 cur_str =
strchr(cur_str,
',');
3820 if (!
isdigit((
int)*++cur_str)) {
3833 if ((argv =
strchr(argv,
',')))
3844 TRACE2((
"option_setup() str %s\n", str ? str:
"NULL"));
3848 if ((cur =
strchr(cur,
',')) != NULL) cur++;
3852 internal_setup(cur, ints);
3858 TRACE2((
"gdth_ctr_name()\n"));
3861 switch (ha->
stype) {
3863 return(
"GDT3000/3020");
3865 return(
"GDT3000A/3020A/3050A");
3867 return(
"GDT3000B/3010A");
3870 return(
"GDT2000/2020");
3872 switch (ha->
pdev->device) {
3874 return(
"GDT6000/6020/6050");
3876 return(
"GDT6000B/6010");
3884 static const char *gdth_info(
struct Scsi_Host *shp)
3888 TRACE2((
"gdth_info()\n"));
3889 return ((
const char *)ha->
binfo.type_string);
3892 static enum blk_eh_timer_return gdth_timed_out(
struct scsi_cmnd *scp)
3895 struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
3897 unsigned long flags;
3898 enum blk_eh_timer_return
retval = BLK_EH_NOT_HANDLED;
3900 TRACE((
"%s() cmd 0x%x\n", scp->
cmnd[0], __func__));
3901 b = scp->
device->channel;
3909 if (++cmndinfo->timeout_count < 6)
3910 retval = BLK_EH_RESET_TIMER;
3915 (b == ha->
virt_bus && t < MAX_HDRIVES && ha->
hdr[t].lock)) {
3916 TRACE2((
"%s(): locked IO, reset timeout\n", __func__));
3917 retval = BLK_EH_RESET_TIMER;
3919 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3925 static int gdth_eh_bus_reset(
Scsi_Cmnd *scp)
3929 unsigned long flags;
3933 TRACE2((
"gdth_eh_bus_reset()\n"));
3935 b = scp->
device->channel;
3944 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3949 if (ha->
hdr[i].present) {
3951 gdth_polling =
TRUE;
3952 while (gdth_test_busy(ha))
3957 gdth_polling =
FALSE;
3958 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3964 for (i = 0; i <
MAXID; ++
i)
3966 gdth_polling =
TRUE;
3967 while (gdth_test_busy(ha))
3971 gdth_polling =
FALSE;
3972 spin_unlock_irqrestore(&ha->
smp_lock, flags);
3988 TRACE2((
"gdth_bios_param() ha %d bus %d target %d\n", ha->
hanum, b, t));
3992 TRACE2((
"Evaluate mapping\n"));
3993 gdth_eval_mapping(capacity,&ip[2],&ip[0],&ip[1]);
3995 ip[0] = ha->
hdr[
t].heads;
3996 ip[1] = ha->
hdr[
t].secs;
3997 ip[2] = capacity / ip[0] / ip[1];
4000 TRACE2((
"gdth_bios_param(): %d heads, %d secs, %d cyls\n",
4001 ip[0],ip[1],ip[2]));
4006 static int gdth_queuecommand_lck(
struct scsi_cmnd *scp,
4010 struct gdth_cmndinfo *cmndinfo;
4012 TRACE((
"gdth_queuecommand() cmd 0x%x\n", scp->
cmnd[0]));
4014 cmndinfo = gdth_get_cmndinfo(ha);
4018 cmndinfo->timeout_count = 0;
4021 return __gdth_queuecommand(ha, scp, cmndinfo);
4027 struct gdth_cmndinfo *cmndinfo)
4029 scp->host_scribble = (
unsigned char *)cmndinfo;
4030 cmndinfo->wait_for_completion = 1;
4031 cmndinfo->phase = -1;
4032 cmndinfo->OpCode = -1;
4034 #ifdef GDTH_STATISTICS
4038 gdth_putq(ha, scp, cmndinfo->priority);
4055 TRACE((
"gdth_open()\n"));
4059 static int gdth_close(
struct inode *inode,
struct file *filep)
4061 TRACE((
"gdth_close()\n"));
4069 unsigned long flags;
4073 ha = gdth_find_ha(evt.
ionode);
4077 if (evt.
erase == 0xff) {
4079 evt.
event.event_data.size=
sizeof(evt.
event.event_data.eu.test);
4081 evt.
event.event_data.size=
sizeof(evt.
event.event_data.eu.driver);
4083 evt.
event.event_data.size=
sizeof(evt.
event.event_data.eu.sync);
4085 evt.
event.event_data.size=
sizeof(evt.
event.event_data.eu.async);
4087 gdth_store_event(ha, evt.
event.event_source, evt.
event.event_idx,
4088 &evt.
event.event_data);
4089 spin_unlock_irqrestore(&ha->
smp_lock, flags);
4090 }
else if (evt.
erase == 0xfe) {
4091 gdth_clear_events();
4092 }
else if (evt.
erase == 0) {
4095 gdth_readapp_event(ha, evt.
erase, &evt.
event);
4102 static int ioc_lockdrv(
void __user *arg)
4106 unsigned long flags;
4111 ha = gdth_find_ha(ldrv.
ionode);
4117 if (j >= MAX_HDRIVES || !ha->
hdr[j].present)
4121 ha->
hdr[
j].lock = 1;
4122 spin_unlock_irqrestore(&ha->
smp_lock, flags);
4123 gdth_wait_completion(ha, ha->
bus_cnt, j);
4126 ha->
hdr[
j].lock = 0;
4127 spin_unlock_irqrestore(&ha->
smp_lock, flags);
4134 static int ioc_resetdrv(
void __user *arg,
char *cmnd)
4142 res.
number >= MAX_HDRIVES)
4144 ha = gdth_find_ha(res.
ionode);
4150 memset(&cmd, 0,
sizeof(gdth_cmd_str));
4154 cmd.u.cache64.DeviceNo = res.
number;
4156 cmd.u.cache.DeviceNo = res.
number;
4168 static int ioc_general(
void __user *arg,
char *cmnd)
4178 ha = gdth_find_ha(gen.
ionode);
4210 gen.
command.u.cache64.sg_canz = 1;
4213 gen.
command.u.cache64.sg_lst[1].sg_len = 0;
4216 gen.
command.u.cache64.sg_canz = 0;
4220 gen.
command.u.cache.DestAddr = 0xffffffff;
4221 gen.
command.u.cache.sg_canz = 1;
4222 gen.
command.u.cache.sg_lst[0].sg_ptr = (
u32)paddr;
4224 gen.
command.u.cache.sg_lst[1].sg_len = 0;
4227 gen.
command.u.cache.sg_canz = 0;
4246 gen.
command.u.raw64.sg_ranz = 1;
4249 gen.
command.u.raw64.sg_lst[1].sg_len = 0;
4252 gen.
command.u.raw64.sg_ranz = 0;
4257 gen.
command.u.raw.sdata = 0xffffffff;
4258 gen.
command.u.raw.sg_ranz = 1;
4259 gen.
command.u.raw.sg_lst[0].sg_ptr = (
u32)paddr;
4261 gen.
command.u.raw.sg_lst[1].sg_len = 0;
4264 gen.
command.u.raw.sg_ranz = 0;
4295 static int ioc_hdrlist(
void __user *arg,
char *cmnd)
4302 u32 cluster_type = 0;
4310 (NULL == (ha = gdth_find_ha(rsc->
ionode)))) {
4314 memset(cmd, 0,
sizeof(gdth_cmd_str));
4317 if (!ha->
hdr[i].present) {
4329 cmd->u.cache64.DeviceNo =
i;
4331 cmd->u.cache.DeviceNo =
i;
4333 rsc->
hdr_list[
i].cluster_type = cluster_type;
4348 static int ioc_rescan(
void __user *arg,
char *cmnd)
4354 int cyls, hds, secs;
4356 unsigned long flags;
4365 (NULL == (ha = gdth_find_ha(rsc->
ionode)))) {
4369 memset(cmd, 0,
sizeof(gdth_cmd_str));
4371 if (rsc->
flag == 0) {
4376 cmd->u.cache64.DeviceNo =
LINUX_OS;
4384 hdr_cnt = (status ==
S_OK ? (
u16)info : 0);
4394 cmd->u.cache64.DeviceNo =
i;
4396 cmd->u.cache.DeviceNo =
i;
4404 if (status !=
S_OK) {
4411 gdth_eval_mapping(ha->
hdr[i].size,&cyls,&hds,&secs);
4412 ha->
hdr[
i].heads = hds;
4413 ha->
hdr[
i].secs = secs;
4415 ha->
hdr[
i].size = cyls * hds * secs;
4417 spin_unlock_irqrestore(&ha->
smp_lock, flags);
4428 cmd->u.cache64.DeviceNo =
i;
4430 cmd->u.cache.DeviceNo =
i;
4435 ha->
hdr[
i].devtype = (status ==
S_OK ? (
u16)info : 0);
4436 spin_unlock_irqrestore(&ha->
smp_lock, flags);
4441 cmd->u.cache64.DeviceNo =
i;
4443 cmd->u.cache.DeviceNo =
i;
4448 ha->
hdr[
i].cluster_type =
4449 ((status ==
S_OK && !shared_access) ? (
u16)info : 0);
4450 spin_unlock_irqrestore(&ha->
smp_lock, flags);
4456 cmd->u.cache64.DeviceNo =
i;
4458 cmd->u.cache.DeviceNo =
i;
4463 ha->
hdr[
i].rw_attribs = (status ==
S_OK ? (
u16)info : 0);
4464 spin_unlock_irqrestore(&ha->
smp_lock, flags);
4478 static int gdth_ioctl(
struct file *filep,
unsigned int cmd,
unsigned long arg)
4482 unsigned long flags;
4488 TRACE((
"gdth_ioctl() cmd 0x%x\n", cmd));
4493 int cnt = gdth_ctr_count;
4494 if (
put_user(cnt, (
int __user *)argp))
4502 if (
put_user(ver, (
int __user *)argp))
4511 osv.
version = (
u8)(LINUX_VERSION_CODE >> 16);
4524 (NULL == (ha = gdth_find_ha(ctrt.
ionode))))
4535 if (ha->
stype >= 0x300)
4551 return ioc_general(argp, cmnd);
4557 return ioc_lockdrv(argp);
4565 (NULL == (ha = gdth_find_ha(lchn.
ionode))))
4569 if (i < ha->bus_cnt) {
4572 ha->
raw[
i].lock = 1;
4573 spin_unlock_irqrestore(&ha->
smp_lock, flags);
4575 gdth_wait_completion(ha, i, j);
4578 ha->
raw[
i].lock = 0;
4579 spin_unlock_irqrestore(&ha->
smp_lock, flags);
4588 return ioc_rescan(argp, cmnd);
4591 return ioc_hdrlist(argp, cmnd);
4599 (NULL == (ha = gdth_find_ha(res.
ionode))))
4608 rval = gdth_eh_bus_reset(scp);
4618 return ioc_resetdrv(argp, cmnd);
4626 static long gdth_unlocked_ioctl(
struct file *
file,
unsigned int cmd,
4632 ret = gdth_ioctl(file, cmd, arg);
4642 gdth_cmd_str gdtcmd;
4649 if (ha->
hdr[i].present) {
4654 gdtcmd.u.cache64.DeviceNo =
i;
4655 gdtcmd.u.cache64.BlockNo = 1;
4656 gdtcmd.u.cache64.sg_canz = 0;
4658 gdtcmd.u.cache.DeviceNo =
i;
4659 gdtcmd.u.cache.BlockNo = 1;
4660 gdtcmd.u.cache.sg_canz = 0;
4662 TRACE2((
"gdth_flush(): flush ha %d drive %d\n", ha->
hanum, i));
4670 static int gdth_slave_configure(
struct scsi_device *sdev)
4679 .name =
"GDT SCSI Disk Array Controller",
4681 .queuecommand = gdth_queuecommand,
4682 .eh_bus_reset_handler = gdth_eh_bus_reset,
4683 .slave_configure = gdth_slave_configure,
4684 .bios_param = gdth_bios_param,
4686 .eh_timed_out = gdth_timed_out,
4687 .proc_name =
"gdth",
4692 .unchecked_isa_dma = 1,
4697 static int __init gdth_isa_probe_one(
u32 isa_bios)
4704 if (!gdth_search_isa(isa_bios))
4710 ha = shost_priv(shp);
4713 if (!gdth_init_isa(isa_bios,ha))
4717 printk(
"Configuring GDT-ISA HA at BIOS 0x%05X IRQ %u DRQ %u\n",
4718 isa_bios, ha->
irq, ha->
drq);
4722 printk(
"GDT-ISA: Unable to allocate IRQ\n");
4728 printk(
"GDT-ISA: Unable to allocate DMA channel\n");
4738 ha->
hanum = gdth_ctr_count++;
4748 &scratch_dma_handle);
4750 goto out_dec_counters;
4754 &scratch_dma_handle);
4756 goto out_free_pscratch;
4762 &scratch_dma_handle);
4765 ha->coal_stat_phys = scratch_dma_handle;
4771 if (max_ids > 0 && max_ids < ha->tid_cnt)
4778 if (!gdth_search_drives(ha)) {
4779 printk(
"GDT-ISA: Error during device scan\n");
4780 goto out_free_coal_stat;
4783 if (hdr_channel < 0 || hdr_channel > ha->
bus_cnt)
4795 gdth_enable_int(ha);
4797 error = scsi_add_host(shp, NULL);
4799 goto out_free_coal_stat;
4810 ha->coal_stat, ha->coal_stat_phys);
4829 static int __init gdth_eisa_probe_one(
u16 eisa_slot)
4836 if (!gdth_search_eisa(eisa_slot))
4842 ha = shost_priv(shp);
4845 if (!gdth_init_eisa(eisa_slot,ha))
4849 printk(
"Configuring GDT-EISA HA at Slot %d IRQ %u\n",
4850 eisa_slot >> 12, ha->
irq);
4854 printk(
"GDT-EISA: Unable to allocate IRQ\n");
4862 ha->
hanum = gdth_ctr_count++;
4865 TRACE2((
"EISA detect Bus 0: hanum %d\n", ha->
hanum));
4874 &scratch_dma_handle);
4880 &scratch_dma_handle);
4882 goto out_free_pscratch;
4888 &scratch_dma_handle);
4891 ha->coal_stat_phys = scratch_dma_handle;
4897 goto out_free_coal_stat;
4902 if (max_ids > 0 && max_ids < ha->tid_cnt)
4908 if (!gdth_search_drives(ha)) {
4909 printk(
"GDT-EISA: Error during device scan\n");
4911 goto out_free_ccb_phys;
4914 if (hdr_channel < 0 || hdr_channel > ha->
bus_cnt)
4926 gdth_enable_int(ha);
4928 error = scsi_add_host(shp, NULL);
4930 goto out_free_ccb_phys;
4939 pci_unmap_single(ha->
pdev,ha->
ccb_phys,
sizeof(gdth_cmd_str),
4944 ha->coal_stat, ha->coal_stat_phys);
4976 ha = shost_priv(shp);
4979 if (!gdth_init_pci(pdev, pcistr, ha))
4983 printk(
"Configuring GDT-PCI HA at %d/%d IRQ %u\n",
4991 printk(
"GDT-PCI: Unable to allocate IRQ\n");
4999 ha->
hanum = gdth_ctr_count++;
5008 &scratch_dma_handle);
5014 &scratch_dma_handle);
5016 goto out_free_pscratch;
5022 &scratch_dma_handle);
5025 ha->coal_stat_phys = scratch_dma_handle;
5031 if (max_ids > 0 && max_ids < ha->tid_cnt)
5038 if (!gdth_search_drives(ha)) {
5039 printk(
"GDT-PCI %d: Error during device scan\n", ha->
hanum);
5040 goto out_free_coal_stat;
5043 if (hdr_channel < 0 || hdr_channel > ha->
bus_cnt)
5052 "Unable to set 32-bit DMA\n", ha->
hanum);
5053 goto out_free_coal_stat;
5058 printk(
"GDT-PCI %d: 64-bit DMA enabled\n", ha->
hanum);
5061 "Unable to set 64/32-bit DMA\n", ha->
hanum);
5062 goto out_free_coal_stat;
5071 gdth_enable_int(ha);
5073 error = scsi_add_host(shp, &pdev->
dev);
5075 goto out_free_coal_stat;
5078 pci_set_drvdata(ha->
pdev, ha);
5090 ha->coal_stat, ha->coal_stat_phys);
5111 TRACE2((
"gdth_remove_one()\n"));
5132 MAXOFFSETS, ha->coal_stat, ha->coal_stat_phys);
5151 TRACE2((
"gdth_halt() event %d\n", (
int)event));
5165 static int __init gdth_init(
void)
5168 printk(
"GDT-HA: Controller driver disabled from"
5169 " command line !\n");
5173 printk(
"GDT-HA: Storage RAID Controller Driver. Version: %s\n",
5177 gdth_polling =
TRUE;
5178 gdth_clear_events();
5182 if (probe_eisa_isa) {
5186 for (isa_bios = 0xc8000UL; isa_bios <= 0xd8000
UL;
5187 isa_bios += 0x8000
UL)
5188 gdth_isa_probe_one(isa_bios);
5193 for (eisa_slot = 0x1000; eisa_slot <= 0x8000;
5194 eisa_slot += 0x1000)
5195 gdth_eisa_probe_one(eisa_slot);
5202 if (pci_register_driver(&gdth_pci_driver)) {
5206 gdth_remove_one(ha);
5211 TRACE2((
"gdth_detect() %d controller detected\n", gdth_ctr_count));
5213 major = register_chrdev(0,
"gdth", &gdth_fops);
5215 gdth_polling =
FALSE;
5219 static void __exit gdth_exit(
void)
5223 unregister_chrdev(major,
"gdth");
5226 #ifdef GDTH_STATISTICS
5235 gdth_remove_one(ha);