V4L/DVB (6715): ivtv: Remove unnecessary register update
[linux-2.6/verdex.git] / drivers / s390 / scsi / zfcp_qdio.c
blob51d92b196ee716848268a79d4c8a7653b282e775
1 /*
2 * This file is part of the zfcp device driver for
3 * FCP adapters for IBM System z9 and zSeries.
5 * (C) Copyright IBM Corp. 2002, 2006
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "zfcp_ext.h"
24 static void zfcp_qdio_sbal_limit(struct zfcp_fsf_req *, int);
25 static inline volatile struct qdio_buffer_element *zfcp_qdio_sbale_get
26 (struct zfcp_qdio_queue *, int, int);
27 static inline volatile struct qdio_buffer_element *zfcp_qdio_sbale_resp
28 (struct zfcp_fsf_req *, int, int);
29 static volatile struct qdio_buffer_element *zfcp_qdio_sbal_chain
30 (struct zfcp_fsf_req *, unsigned long);
31 static volatile struct qdio_buffer_element *zfcp_qdio_sbale_next
32 (struct zfcp_fsf_req *, unsigned long);
33 static int zfcp_qdio_sbals_zero(struct zfcp_qdio_queue *, int, int);
34 static inline int zfcp_qdio_sbals_wipe(struct zfcp_fsf_req *);
35 static void zfcp_qdio_sbale_fill
36 (struct zfcp_fsf_req *, unsigned long, void *, int);
37 static int zfcp_qdio_sbals_from_segment
38 (struct zfcp_fsf_req *, unsigned long, void *, unsigned long);
40 static qdio_handler_t zfcp_qdio_request_handler;
41 static qdio_handler_t zfcp_qdio_response_handler;
42 static int zfcp_qdio_handler_error_check(struct zfcp_adapter *,
43 unsigned int, unsigned int, unsigned int, int, int);
45 #define ZFCP_LOG_AREA ZFCP_LOG_AREA_QDIO
48 * Frees BUFFER memory for each of the pointers of the struct qdio_buffer array
49 * in the adapter struct sbuf is the pointer array.
51 * locks: must only be called with zfcp_data.config_sema taken
53 static void
54 zfcp_qdio_buffers_dequeue(struct qdio_buffer **sbuf)
56 int pos;
58 for (pos = 0; pos < QDIO_MAX_BUFFERS_PER_Q; pos += QBUFF_PER_PAGE)
59 free_page((unsigned long) sbuf[pos]);
63 * Allocates BUFFER memory to each of the pointers of the qdio_buffer_t
64 * array in the adapter struct.
65 * Cur_buf is the pointer array
67 * returns: zero on success else -ENOMEM
68 * locks: must only be called with zfcp_data.config_sema taken
70 static int
71 zfcp_qdio_buffers_enqueue(struct qdio_buffer **sbuf)
73 int pos;
75 for (pos = 0; pos < QDIO_MAX_BUFFERS_PER_Q; pos += QBUFF_PER_PAGE) {
76 sbuf[pos] = (struct qdio_buffer *) get_zeroed_page(GFP_KERNEL);
77 if (!sbuf[pos]) {
78 zfcp_qdio_buffers_dequeue(sbuf);
79 return -ENOMEM;
82 for (pos = 0; pos < QDIO_MAX_BUFFERS_PER_Q; pos++)
83 if (pos % QBUFF_PER_PAGE)
84 sbuf[pos] = sbuf[pos - 1] + 1;
85 return 0;
88 /* locks: must only be called with zfcp_data.config_sema taken */
89 int
90 zfcp_qdio_allocate_queues(struct zfcp_adapter *adapter)
92 int ret;
94 ret = zfcp_qdio_buffers_enqueue(adapter->request_queue.buffer);
95 if (ret)
96 return ret;
97 return zfcp_qdio_buffers_enqueue(adapter->response_queue.buffer);
100 /* locks: must only be called with zfcp_data.config_sema taken */
101 void
102 zfcp_qdio_free_queues(struct zfcp_adapter *adapter)
104 ZFCP_LOG_TRACE("freeing request_queue buffers\n");
105 zfcp_qdio_buffers_dequeue(adapter->request_queue.buffer);
107 ZFCP_LOG_TRACE("freeing response_queue buffers\n");
108 zfcp_qdio_buffers_dequeue(adapter->response_queue.buffer);
112 zfcp_qdio_allocate(struct zfcp_adapter *adapter)
114 struct qdio_initialize *init_data;
116 init_data = &adapter->qdio_init_data;
118 init_data->cdev = adapter->ccw_device;
119 init_data->q_format = QDIO_SCSI_QFMT;
120 memcpy(init_data->adapter_name, zfcp_get_busid_by_adapter(adapter), 8);
121 ASCEBC(init_data->adapter_name, 8);
122 init_data->qib_param_field_format = 0;
123 init_data->qib_param_field = NULL;
124 init_data->input_slib_elements = NULL;
125 init_data->output_slib_elements = NULL;
126 init_data->min_input_threshold = ZFCP_MIN_INPUT_THRESHOLD;
127 init_data->max_input_threshold = ZFCP_MAX_INPUT_THRESHOLD;
128 init_data->min_output_threshold = ZFCP_MIN_OUTPUT_THRESHOLD;
129 init_data->max_output_threshold = ZFCP_MAX_OUTPUT_THRESHOLD;
130 init_data->no_input_qs = 1;
131 init_data->no_output_qs = 1;
132 init_data->input_handler = zfcp_qdio_response_handler;
133 init_data->output_handler = zfcp_qdio_request_handler;
134 init_data->int_parm = (unsigned long) adapter;
135 init_data->flags = QDIO_INBOUND_0COPY_SBALS |
136 QDIO_OUTBOUND_0COPY_SBALS | QDIO_USE_OUTBOUND_PCIS;
137 init_data->input_sbal_addr_array =
138 (void **) (adapter->response_queue.buffer);
139 init_data->output_sbal_addr_array =
140 (void **) (adapter->request_queue.buffer);
142 return qdio_allocate(init_data);
146 * function: zfcp_qdio_handler_error_check
148 * purpose: called by the response handler to determine error condition
150 * returns: error flag
153 static int
154 zfcp_qdio_handler_error_check(struct zfcp_adapter *adapter, unsigned int status,
155 unsigned int qdio_error, unsigned int siga_error,
156 int first_element, int elements_processed)
158 int retval = 0;
160 if (unlikely(status & QDIO_STATUS_LOOK_FOR_ERROR)) {
161 retval = -EIO;
163 ZFCP_LOG_INFO("QDIO problem occurred (status=0x%x, "
164 "qdio_error=0x%x, siga_error=0x%x)\n",
165 status, qdio_error, siga_error);
167 zfcp_hba_dbf_event_qdio(adapter, status, qdio_error, siga_error,
168 first_element, elements_processed);
170 * Restarting IO on the failed adapter from scratch.
171 * Since we have been using this adapter, it is save to assume
172 * that it is not failed but recoverable. The card seems to
173 * report link-up events by self-initiated queue shutdown.
174 * That is why we need to clear the link-down flag
175 * which is set again in case we have missed by a mile.
177 zfcp_erp_adapter_reopen(adapter,
178 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
179 ZFCP_STATUS_COMMON_ERP_FAILED);
181 return retval;
185 * function: zfcp_qdio_request_handler
187 * purpose: is called by QDIO layer for completed SBALs in request queue
189 * returns: (void)
191 static void
192 zfcp_qdio_request_handler(struct ccw_device *ccw_device,
193 unsigned int status,
194 unsigned int qdio_error,
195 unsigned int siga_error,
196 unsigned int queue_number,
197 int first_element,
198 int elements_processed,
199 unsigned long int_parm)
201 struct zfcp_adapter *adapter;
202 struct zfcp_qdio_queue *queue;
204 adapter = (struct zfcp_adapter *) int_parm;
205 queue = &adapter->request_queue;
207 ZFCP_LOG_DEBUG("adapter %s, first=%d, elements_processed=%d\n",
208 zfcp_get_busid_by_adapter(adapter),
209 first_element, elements_processed);
211 if (unlikely(zfcp_qdio_handler_error_check(adapter, status, qdio_error,
212 siga_error, first_element,
213 elements_processed)))
214 goto out;
216 * we stored address of struct zfcp_adapter data structure
217 * associated with irq in int_parm
220 /* cleanup all SBALs being program-owned now */
221 zfcp_qdio_zero_sbals(queue->buffer, first_element, elements_processed);
223 /* increase free space in outbound queue */
224 atomic_add(elements_processed, &queue->free_count);
225 ZFCP_LOG_DEBUG("free_count=%d\n", atomic_read(&queue->free_count));
226 wake_up(&adapter->request_wq);
227 ZFCP_LOG_DEBUG("elements_processed=%d, free count=%d\n",
228 elements_processed, atomic_read(&queue->free_count));
229 out:
230 return;
234 * zfcp_qdio_reqid_check - checks for valid reqids.
236 static void zfcp_qdio_reqid_check(struct zfcp_adapter *adapter,
237 unsigned long req_id)
239 struct zfcp_fsf_req *fsf_req;
240 unsigned long flags;
242 debug_long_event(adapter->erp_dbf, 4, req_id);
244 spin_lock_irqsave(&adapter->req_list_lock, flags);
245 fsf_req = zfcp_reqlist_find(adapter, req_id);
247 if (!fsf_req)
249 * Unknown request means that we have potentially memory
250 * corruption and must stop the machine immediatly.
252 panic("error: unknown request id (%ld) on adapter %s.\n",
253 req_id, zfcp_get_busid_by_adapter(adapter));
255 zfcp_reqlist_remove(adapter, fsf_req);
256 atomic_dec(&adapter->reqs_active);
257 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
259 /* finish the FSF request */
260 zfcp_fsf_req_complete(fsf_req);
264 * function: zfcp_qdio_response_handler
266 * purpose: is called by QDIO layer for completed SBALs in response queue
268 * returns: (void)
270 static void
271 zfcp_qdio_response_handler(struct ccw_device *ccw_device,
272 unsigned int status,
273 unsigned int qdio_error,
274 unsigned int siga_error,
275 unsigned int queue_number,
276 int first_element,
277 int elements_processed,
278 unsigned long int_parm)
280 struct zfcp_adapter *adapter;
281 struct zfcp_qdio_queue *queue;
282 int buffer_index;
283 int i;
284 struct qdio_buffer *buffer;
285 int retval = 0;
286 u8 count;
287 u8 start;
288 volatile struct qdio_buffer_element *buffere = NULL;
289 int buffere_index;
291 adapter = (struct zfcp_adapter *) int_parm;
292 queue = &adapter->response_queue;
294 if (unlikely(zfcp_qdio_handler_error_check(adapter, status, qdio_error,
295 siga_error, first_element,
296 elements_processed)))
297 goto out;
300 * we stored address of struct zfcp_adapter data structure
301 * associated with irq in int_parm
304 buffere = &(queue->buffer[first_element]->element[0]);
305 ZFCP_LOG_DEBUG("first BUFFERE flags=0x%x\n", buffere->flags);
307 * go through all SBALs from input queue currently
308 * returned by QDIO layer
311 for (i = 0; i < elements_processed; i++) {
313 buffer_index = first_element + i;
314 buffer_index %= QDIO_MAX_BUFFERS_PER_Q;
315 buffer = queue->buffer[buffer_index];
317 /* go through all SBALEs of SBAL */
318 for (buffere_index = 0;
319 buffere_index < QDIO_MAX_ELEMENTS_PER_BUFFER;
320 buffere_index++) {
322 /* look for QDIO request identifiers in SB */
323 buffere = &buffer->element[buffere_index];
324 zfcp_qdio_reqid_check(adapter,
325 (unsigned long) buffere->addr);
328 * A single used SBALE per inbound SBALE has been
329 * implemented by QDIO so far. Hope they will
330 * do some optimisation. Will need to change to
331 * unlikely() then.
333 if (likely(buffere->flags & SBAL_FLAGS_LAST_ENTRY))
334 break;
337 if (unlikely(!(buffere->flags & SBAL_FLAGS_LAST_ENTRY))) {
338 ZFCP_LOG_NORMAL("bug: End of inbound data "
339 "not marked!\n");
344 * put range of SBALs back to response queue
345 * (including SBALs which have already been free before)
347 count = atomic_read(&queue->free_count) + elements_processed;
348 start = queue->free_index;
350 ZFCP_LOG_TRACE("calling do_QDIO on adapter %s (flags=0x%x, "
351 "queue_no=%i, index_in_queue=%i, count=%i, "
352 "buffers=0x%lx\n",
353 zfcp_get_busid_by_adapter(adapter),
354 QDIO_FLAG_SYNC_INPUT | QDIO_FLAG_UNDER_INTERRUPT,
355 0, start, count, (unsigned long) &queue->buffer[start]);
357 retval = do_QDIO(ccw_device,
358 QDIO_FLAG_SYNC_INPUT | QDIO_FLAG_UNDER_INTERRUPT,
359 0, start, count, NULL);
361 if (unlikely(retval)) {
362 atomic_set(&queue->free_count, count);
363 ZFCP_LOG_DEBUG("clearing of inbound data regions failed, "
364 "queues may be down "
365 "(count=%d, start=%d, retval=%d)\n",
366 count, start, retval);
367 } else {
368 queue->free_index += count;
369 queue->free_index %= QDIO_MAX_BUFFERS_PER_Q;
370 atomic_set(&queue->free_count, 0);
371 ZFCP_LOG_TRACE("%i buffers enqueued to response "
372 "queue at position %i\n", count, start);
374 out:
375 return;
379 * zfcp_qdio_sbale_get - return pointer to SBALE of qdio_queue
380 * @queue: queue from which SBALE should be returned
381 * @sbal: specifies number of SBAL in queue
382 * @sbale: specifes number of SBALE in SBAL
384 static inline volatile struct qdio_buffer_element *
385 zfcp_qdio_sbale_get(struct zfcp_qdio_queue *queue, int sbal, int sbale)
387 return &queue->buffer[sbal]->element[sbale];
391 * zfcp_qdio_sbale_req - return pointer to SBALE of request_queue for
392 * a struct zfcp_fsf_req
394 volatile struct qdio_buffer_element *
395 zfcp_qdio_sbale_req(struct zfcp_fsf_req *fsf_req, int sbal, int sbale)
397 return zfcp_qdio_sbale_get(&fsf_req->adapter->request_queue,
398 sbal, sbale);
402 * zfcp_qdio_sbale_resp - return pointer to SBALE of response_queue for
403 * a struct zfcp_fsf_req
405 static inline volatile struct qdio_buffer_element *
406 zfcp_qdio_sbale_resp(struct zfcp_fsf_req *fsf_req, int sbal, int sbale)
408 return zfcp_qdio_sbale_get(&fsf_req->adapter->response_queue,
409 sbal, sbale);
413 * zfcp_qdio_sbale_curr - return current SBALE on request_queue for
414 * a struct zfcp_fsf_req
416 volatile struct qdio_buffer_element *
417 zfcp_qdio_sbale_curr(struct zfcp_fsf_req *fsf_req)
419 return zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr,
420 fsf_req->sbale_curr);
424 * zfcp_qdio_sbal_limit - determine maximum number of SBALs that can be used
425 * on the request_queue for a struct zfcp_fsf_req
426 * @fsf_req: the number of the last SBAL that can be used is stored herein
427 * @max_sbals: used to pass an upper limit for the number of SBALs
429 * Note: We can assume at least one free SBAL in the request_queue when called.
431 static void
432 zfcp_qdio_sbal_limit(struct zfcp_fsf_req *fsf_req, int max_sbals)
434 int count = atomic_read(&fsf_req->adapter->request_queue.free_count);
435 count = min(count, max_sbals);
436 fsf_req->sbal_last = fsf_req->sbal_first;
437 fsf_req->sbal_last += (count - 1);
438 fsf_req->sbal_last %= QDIO_MAX_BUFFERS_PER_Q;
442 * zfcp_qdio_sbal_chain - chain SBALs if more than one SBAL is needed for a
443 * request
444 * @fsf_req: zfcp_fsf_req to be processed
445 * @sbtype: SBAL flags which have to be set in first SBALE of new SBAL
447 * This function changes sbal_curr, sbale_curr, sbal_number of fsf_req.
449 static volatile struct qdio_buffer_element *
450 zfcp_qdio_sbal_chain(struct zfcp_fsf_req *fsf_req, unsigned long sbtype)
452 volatile struct qdio_buffer_element *sbale;
454 /* set last entry flag in current SBALE of current SBAL */
455 sbale = zfcp_qdio_sbale_curr(fsf_req);
456 sbale->flags |= SBAL_FLAGS_LAST_ENTRY;
458 /* don't exceed last allowed SBAL */
459 if (fsf_req->sbal_curr == fsf_req->sbal_last)
460 return NULL;
462 /* set chaining flag in first SBALE of current SBAL */
463 sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0);
464 sbale->flags |= SBAL_FLAGS0_MORE_SBALS;
466 /* calculate index of next SBAL */
467 fsf_req->sbal_curr++;
468 fsf_req->sbal_curr %= QDIO_MAX_BUFFERS_PER_Q;
470 /* keep this requests number of SBALs up-to-date */
471 fsf_req->sbal_number++;
473 /* start at first SBALE of new SBAL */
474 fsf_req->sbale_curr = 0;
476 /* set storage-block type for new SBAL */
477 sbale = zfcp_qdio_sbale_curr(fsf_req);
478 sbale->flags |= sbtype;
480 return sbale;
484 * zfcp_qdio_sbale_next - switch to next SBALE, chain SBALs if needed
486 static volatile struct qdio_buffer_element *
487 zfcp_qdio_sbale_next(struct zfcp_fsf_req *fsf_req, unsigned long sbtype)
489 if (fsf_req->sbale_curr == ZFCP_LAST_SBALE_PER_SBAL)
490 return zfcp_qdio_sbal_chain(fsf_req, sbtype);
492 fsf_req->sbale_curr++;
494 return zfcp_qdio_sbale_curr(fsf_req);
498 * zfcp_qdio_sbals_zero - initialize SBALs between first and last in queue
499 * with zero from
501 static int
502 zfcp_qdio_sbals_zero(struct zfcp_qdio_queue *queue, int first, int last)
504 struct qdio_buffer **buf = queue->buffer;
505 int curr = first;
506 int count = 0;
508 for(;;) {
509 curr %= QDIO_MAX_BUFFERS_PER_Q;
510 count++;
511 memset(buf[curr], 0, sizeof(struct qdio_buffer));
512 if (curr == last)
513 break;
514 curr++;
516 return count;
521 * zfcp_qdio_sbals_wipe - reset all changes in SBALs for an fsf_req
523 static inline int
524 zfcp_qdio_sbals_wipe(struct zfcp_fsf_req *fsf_req)
526 return zfcp_qdio_sbals_zero(&fsf_req->adapter->request_queue,
527 fsf_req->sbal_first, fsf_req->sbal_curr);
532 * zfcp_qdio_sbale_fill - set address and lenght in current SBALE
533 * on request_queue
535 static void
536 zfcp_qdio_sbale_fill(struct zfcp_fsf_req *fsf_req, unsigned long sbtype,
537 void *addr, int length)
539 volatile struct qdio_buffer_element *sbale;
541 sbale = zfcp_qdio_sbale_curr(fsf_req);
542 sbale->addr = addr;
543 sbale->length = length;
547 * zfcp_qdio_sbals_from_segment - map memory segment to SBALE(s)
548 * @fsf_req: request to be processed
549 * @sbtype: SBALE flags
550 * @start_addr: address of memory segment
551 * @total_length: length of memory segment
553 * Alignment and length of the segment determine how many SBALEs are needed
554 * for the memory segment.
556 static int
557 zfcp_qdio_sbals_from_segment(struct zfcp_fsf_req *fsf_req, unsigned long sbtype,
558 void *start_addr, unsigned long total_length)
560 unsigned long remaining, length;
561 void *addr;
563 /* split segment up heeding page boundaries */
564 for (addr = start_addr, remaining = total_length; remaining > 0;
565 addr += length, remaining -= length) {
566 /* get next free SBALE for new piece */
567 if (NULL == zfcp_qdio_sbale_next(fsf_req, sbtype)) {
568 /* no SBALE left, clean up and leave */
569 zfcp_qdio_sbals_wipe(fsf_req);
570 return -EINVAL;
572 /* calculate length of new piece */
573 length = min(remaining,
574 (PAGE_SIZE - ((unsigned long) addr &
575 (PAGE_SIZE - 1))));
576 /* fill current SBALE with calculated piece */
577 zfcp_qdio_sbale_fill(fsf_req, sbtype, addr, length);
579 return total_length;
584 * zfcp_qdio_sbals_from_sg - fill SBALs from scatter-gather list
585 * @fsf_req: request to be processed
586 * @sbtype: SBALE flags
587 * @sg: scatter-gather list
588 * @sg_count: number of elements in scatter-gather list
589 * @max_sbals: upper bound for number of SBALs to be used
592 zfcp_qdio_sbals_from_sg(struct zfcp_fsf_req *fsf_req, unsigned long sbtype,
593 struct scatterlist *sgl, int sg_count, int max_sbals)
595 int sg_index;
596 struct scatterlist *sg_segment;
597 int retval;
598 volatile struct qdio_buffer_element *sbale;
599 int bytes = 0;
601 /* figure out last allowed SBAL */
602 zfcp_qdio_sbal_limit(fsf_req, max_sbals);
604 /* set storage-block type for current SBAL */
605 sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0);
606 sbale->flags |= sbtype;
608 /* process all segements of scatter-gather list */
609 for_each_sg(sgl, sg_segment, sg_count, sg_index) {
610 retval = zfcp_qdio_sbals_from_segment(
611 fsf_req,
612 sbtype,
613 zfcp_sg_to_address(sg_segment),
614 sg_segment->length);
615 if (retval < 0) {
616 bytes = retval;
617 goto out;
618 } else
619 bytes += retval;
621 /* assume that no other SBALEs are to follow in the same SBAL */
622 sbale = zfcp_qdio_sbale_curr(fsf_req);
623 sbale->flags |= SBAL_FLAGS_LAST_ENTRY;
624 out:
625 return bytes;
630 * zfcp_qdio_sbals_from_scsicmnd - fill SBALs from scsi command
631 * @fsf_req: request to be processed
632 * @sbtype: SBALE flags
633 * @scsi_cmnd: either scatter-gather list or buffer contained herein is used
634 * to fill SBALs
637 zfcp_qdio_sbals_from_scsicmnd(struct zfcp_fsf_req *fsf_req,
638 unsigned long sbtype, struct scsi_cmnd *scsi_cmnd)
640 return zfcp_qdio_sbals_from_sg(fsf_req, sbtype, scsi_sglist(scsi_cmnd),
641 scsi_sg_count(scsi_cmnd),
642 ZFCP_MAX_SBALS_PER_REQ);
646 * zfcp_qdio_determine_pci - set PCI flag in first SBALE on qdio queue if needed
649 zfcp_qdio_determine_pci(struct zfcp_qdio_queue *req_queue,
650 struct zfcp_fsf_req *fsf_req)
652 int new_distance_from_int;
653 int pci_pos;
654 volatile struct qdio_buffer_element *sbale;
656 new_distance_from_int = req_queue->distance_from_int +
657 fsf_req->sbal_number;
659 if (unlikely(new_distance_from_int >= ZFCP_QDIO_PCI_INTERVAL)) {
660 new_distance_from_int %= ZFCP_QDIO_PCI_INTERVAL;
661 pci_pos = fsf_req->sbal_first;
662 pci_pos += fsf_req->sbal_number;
663 pci_pos -= new_distance_from_int;
664 pci_pos -= 1;
665 pci_pos %= QDIO_MAX_BUFFERS_PER_Q;
666 sbale = zfcp_qdio_sbale_req(fsf_req, pci_pos, 0);
667 sbale->flags |= SBAL_FLAGS0_PCI;
669 return new_distance_from_int;
673 * function: zfcp_zero_sbals
675 * purpose: zeros specified range of SBALs
677 * returns:
679 void
680 zfcp_qdio_zero_sbals(struct qdio_buffer *buf[], int first, int clean_count)
682 int cur_pos;
683 int index;
685 for (cur_pos = first; cur_pos < (first + clean_count); cur_pos++) {
686 index = cur_pos % QDIO_MAX_BUFFERS_PER_Q;
687 memset(buf[index], 0, sizeof (struct qdio_buffer));
688 ZFCP_LOG_TRACE("zeroing BUFFER %d at address %p\n",
689 index, buf[index]);
693 #undef ZFCP_LOG_AREA