- for (; i < hdr_cnt && i < MAX_HDRIVES; ++i) {
- cmd.Service = CACHESERVICE;
- cmd.OpCode = GDT_INFO;
- cmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
- gdth_do_req(srp, &cmd, cmnd, 30);
- status = (ushort)srp->sr_command->SCp.Status;
- info = (ulong32)srp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
- gdth_do_cmd(scp, &cmd, cmnd, 30);
- status = (ushort)scp->SCp.Status;
- info = (ulong32)scp->SCp.Message;
-#else
- gdth_do_cmd(&scp, &cmd, cmnd, 30);
- status = (ushort)scp.SCp.Status;
- info = (ulong32)scp.SCp.Message;
-#endif
- GDTH_LOCK_HA(ha, flags);
- rsc.hdr_list[i].bus = ha->virt_bus;
- rsc.hdr_list[i].target = i;
- rsc.hdr_list[i].lun = 0;
- if (status != S_OK) {
- ha->hdr[i].present = FALSE;
- } else {
- ha->hdr[i].present = TRUE;
- ha->hdr[i].size = info;
- /* evaluate mapping */
- ha->hdr[i].size &= ~SECS32;
- gdth_eval_mapping(ha->hdr[i].size,&cyls,&hds,&secs);
- ha->hdr[i].heads = hds;
- ha->hdr[i].secs = secs;
- /* round size */
- ha->hdr[i].size = cyls * hds * secs;
- }
- GDTH_UNLOCK_HA(ha, flags);
- if (status != S_OK)
- continue;
-
- /* devtype, cluster info, R/W attribs */
- cmd.Service = CACHESERVICE;
- cmd.OpCode = GDT_DEVTYPE;
- cmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
- gdth_do_req(srp, &cmd, cmnd, 30);
- status = (ushort)srp->sr_command->SCp.Status;
- info = (ulong32)srp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
- gdth_do_cmd(scp, &cmd, cmnd, 30);
- status = (ushort)scp->SCp.Status;
- info = (ulong32)scp->SCp.Message;
-#else
- gdth_do_cmd(&scp, &cmd, cmnd, 30);
- status = (ushort)scp.SCp.Status;
- info = (ulong32)scp.SCp.Message;
-#endif
- GDTH_LOCK_HA(ha, flags);
- ha->hdr[i].devtype = (status == S_OK ? (ushort)info : 0);
- GDTH_UNLOCK_HA(ha, flags);
-
- cmd.Service = CACHESERVICE;
- cmd.OpCode = GDT_CLUST_INFO;
- cmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
- gdth_do_req(srp, &cmd, cmnd, 30);
- status = (ushort)srp->sr_command->SCp.Status;
- info = (ulong32)srp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
- gdth_do_cmd(scp, &cmd, cmnd, 30);
- status = (ushort)scp->SCp.Status;
- info = (ulong32)scp->SCp.Message;
-#else
- gdth_do_cmd(&scp, &cmd, cmnd, 30);
- status = (ushort)scp.SCp.Status;
- info = (ulong32)scp.SCp.Message;
-#endif
- GDTH_LOCK_HA(ha, flags);
- ha->hdr[i].cluster_type =
- ((status == S_OK && !shared_access) ? (ushort)info : 0);
- GDTH_UNLOCK_HA(ha, flags);
- rsc.hdr_list[i].cluster_type = ha->hdr[i].cluster_type;
-
- cmd.Service = CACHESERVICE;
- cmd.OpCode = GDT_RW_ATTRIBS;
- cmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
- gdth_do_req(srp, &cmd, cmnd, 30);
- status = (ushort)srp->sr_command->SCp.Status;
- info = (ulong32)srp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
- gdth_do_cmd(scp, &cmd, cmnd, 30);
- status = (ushort)scp->SCp.Status;
- info = (ulong32)scp->SCp.Message;
-#else
- gdth_do_cmd(&scp, &cmd, cmnd, 30);
- status = (ushort)scp.SCp.Status;
- info = (ulong32)scp.SCp.Message;
-#endif
- GDTH_LOCK_HA(ha, flags);
- ha->hdr[i].rw_attribs = (status == S_OK ? (ushort)info : 0);
- GDTH_UNLOCK_HA(ha, flags);
+
+ status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
+ i = 0;
+ hdr_cnt = (status == S_OK ? (ushort)info : 0);
+ } else {
+ i = rsc->hdr_no;
+ hdr_cnt = i + 1;
+ }
+
+ for (; i < hdr_cnt && i < MAX_HDRIVES; ++i) {
+ cmd->Service = CACHESERVICE;
+ cmd->OpCode = GDT_INFO;
+ if (ha->cache_feat & GDT_64BIT)
+ cmd->u.cache64.DeviceNo = i;
+ else
+ cmd->u.cache.DeviceNo = i;
+
+ status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info);
+
+ spin_lock_irqsave(&ha->smp_lock, flags);
+ rsc->hdr_list[i].bus = ha->virt_bus;
+ rsc->hdr_list[i].target = i;
+ rsc->hdr_list[i].lun = 0;
+ if (status != S_OK) {
+ ha->hdr[i].present = FALSE;
+ } else {
+ ha->hdr[i].present = TRUE;
+ ha->hdr[i].size = info;
+ /* evaluate mapping */
+ ha->hdr[i].size &= ~SECS32;
+ gdth_eval_mapping(ha->hdr[i].size,&cyls,&hds,&secs);
+ ha->hdr[i].heads = hds;
+ ha->hdr[i].secs = secs;
+ /* round size */
+ ha->hdr[i].size = cyls * hds * secs;