@@ -68,7 +68,7 @@ static BOOLEAN _SendSRB(PVOID DeviceExtension,
68
68
ULONGLONG PA )
69
69
{
70
70
ULONG dummy = 1 ;
71
- unsigned char * pStatus = NULL ;
71
+ PSTATUS_TABLE_ENTRY opEntry = NULL ;
72
72
PADAPTER_EXTENSION adaptExt = NULL ;
73
73
PSRB_EXTENSION srbExt = NULL ;
74
74
PREQUEST_LIST element ;
@@ -79,20 +79,34 @@ static BOOLEAN _SendSRB(PVOID DeviceExtension,
79
79
80
80
adaptExt = (PADAPTER_EXTENSION )DeviceExtension ;
81
81
srbExt = SRB_EXTENSION (Srb );
82
- pStatus = StatusTableInsert (& adaptExt -> StatusTable , srbExt -> id );
83
- if (pStatus == NULL )
82
+ opEntry = StatusTableInsert (& adaptExt -> StatusTable , srbExt -> id );
83
+ if (opEntry == NULL )
84
84
{
85
85
RhelDbgPrint (TRACE_LEVEL_WARNING , " Unable to allocate space for holding status for Srb 0x%p\n" , Srb );
86
86
return FALSE;
87
87
}
88
88
89
+ opEntry -> OutHdr = srbExt -> vbr .out_hdr ;
90
+ srbExt -> sg [0 ].physAddr = StorPortGetPhysicalAddress (DeviceExtension ,
91
+ NULL ,
92
+ & opEntry -> OutHdr ,
93
+ & dummy );
94
+ srbExt -> sg [0 ].length = sizeof (opEntry -> OutHdr );
95
+ if (srbExt -> sg [0 ].physAddr .QuadPart == 0 )
96
+ {
97
+ RhelDbgPrint (TRACE_LEVEL_WARNING , " Unable to translate address 0x%p, Srb 0x%p\n" , & opEntry -> OutHdr , Srb );
98
+ StatusTableDelete (& adaptExt -> StatusTable , srbExt -> id , NULL );
99
+ return FALSE;
100
+ }
101
+
89
102
srbExt -> sg [srbExt -> in + srbExt -> out - 1 ].physAddr = StorPortGetPhysicalAddress (DeviceExtension ,
90
103
NULL ,
91
- pStatus ,
104
+ & opEntry -> Status ,
92
105
& dummy );
106
+ srbExt -> sg [srbExt -> in + srbExt -> out - 1 ].length = sizeof (opEntry -> Status );
93
107
if (srbExt -> sg [srbExt -> in + srbExt -> out - 1 ].physAddr .QuadPart == 0 )
94
108
{
95
- RhelDbgPrint (TRACE_LEVEL_WARNING , " Unable to translate address 0x%p, Srb 0x%p\n" , pStatus , Srb );
109
+ RhelDbgPrint (TRACE_LEVEL_WARNING , " Unable to translate address 0x%p, Srb 0x%p\n" , & opEntry -> Status , Srb );
96
110
StatusTableDelete (& adaptExt -> StatusTable , srbExt -> id , NULL );
97
111
return FALSE;
98
112
}
@@ -146,7 +160,6 @@ RhelDoFlush(PVOID DeviceExtension, PSRB_TYPE Srb, BOOLEAN resend, BOOLEAN bIsr)
146
160
{
147
161
PADAPTER_EXTENSION adaptExt = (PADAPTER_EXTENSION )DeviceExtension ;
148
162
PSRB_EXTENSION srbExt = SRB_EXTENSION (Srb );
149
- ULONG fragLen = 0UL ;
150
163
PVOID va = NULL ;
151
164
ULONGLONG pa = 0ULL ;
152
165
@@ -197,11 +210,6 @@ RhelDoFlush(PVOID DeviceExtension, PSRB_TYPE Srb, BOOLEAN resend, BOOLEAN bIsr)
197
210
srbExt -> out = 1 ;
198
211
srbExt -> in = 1 ;
199
212
200
- srbExt -> sg [0 ].physAddr = StorPortGetPhysicalAddress (DeviceExtension , NULL , & srbExt -> vbr .out_hdr , & fragLen );
201
- srbExt -> sg [0 ].length = sizeof (srbExt -> vbr .out_hdr );
202
- srbExt -> sg [1 ].physAddr = StorPortGetPhysicalAddress (DeviceExtension , NULL , & srbExt -> vbr .status , & fragLen );
203
- srbExt -> sg [1 ].length = sizeof (srbExt -> vbr .status );
204
-
205
213
return _SendSRB (DeviceExtension , Srb , QueueNumber , MessageId , resend , va , pa );
206
214
}
207
215
@@ -332,12 +340,8 @@ RhelDoUnMap(IN PVOID DeviceExtension, IN PSRB_TYPE Srb)
332
340
srbExt -> out = 2 ;
333
341
srbExt -> in = 1 ;
334
342
335
- srbExt -> sg [0 ].physAddr = StorPortGetPhysicalAddress (DeviceExtension , NULL , & srbExt -> vbr .out_hdr , & fragLen );
336
- srbExt -> sg [0 ].length = sizeof (srbExt -> vbr .out_hdr );
337
343
srbExt -> sg [1 ].physAddr = MmGetPhysicalAddress (& adaptExt -> blk_discard [0 ]);
338
344
srbExt -> sg [1 ].length = sizeof (blk_discard_write_zeroes ) * BlockDescrCount ;
339
- srbExt -> sg [2 ].physAddr = StorPortGetPhysicalAddress (DeviceExtension , NULL , & srbExt -> vbr .status , & fragLen );
340
- srbExt -> sg [2 ].length = sizeof (srbExt -> vbr .status );
341
345
342
346
if (adaptExt -> num_queues > 1 )
343
347
{
@@ -427,12 +431,8 @@ RhelGetSerialNumber(IN PVOID DeviceExtension, IN PSRB_TYPE Srb)
427
431
srbExt -> out = 1 ;
428
432
srbExt -> in = 2 ;
429
433
430
- srbExt -> sg [0 ].physAddr = StorPortGetPhysicalAddress (DeviceExtension , NULL , & srbExt -> vbr .out_hdr , & fragLen );
431
- srbExt -> sg [0 ].length = sizeof (srbExt -> vbr .out_hdr );
432
434
srbExt -> sg [1 ].physAddr = StorPortGetPhysicalAddress (DeviceExtension , NULL , & adaptExt -> sn [0 ], & fragLen );
433
435
srbExt -> sg [1 ].length = sizeof (adaptExt -> sn );
434
- srbExt -> sg [2 ].physAddr = StorPortGetPhysicalAddress (DeviceExtension , NULL , & srbExt -> vbr .status , & fragLen );
435
- srbExt -> sg [2 ].length = sizeof (srbExt -> vbr .status );
436
436
437
437
return _SendSRB (DeviceExtension , Srb , QueueNumber , MessageId , FALSE, va , pa );
438
438
}
0 commit comments