// SPDX-License-Identifier: GPL-2.0-or-later /* * Adaptec AAC series RAID controller driver * (c) Copyright 2001 Red Hat Inc. * * based on the old aacraid driver that is.. * Adaptec aacraid device driver for Linux. * * Copyright (c) 2000-2010 Adaptec, Inc. * 2010-2015 PMC-Sierra, Inc. (aacraid@pmc-sierra.com) * 2016-2017 Microsemi Corp. (aacraid@microsemi.com) * * Module Name: * commsup.c * * Abstract: Contain all routines that are required for FSA host/adapter * communication.
*/
# * 2010-2015 PMC-Sierra * Abstract: */ # <linux/inith> SPDX-License-Identifier GPL-2# /.java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 #</.h #include <linux linux.h # <linux.hjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 # </
include/hjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
include< scsi.java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 #include * @ * Allocate and map the shared * talk to # linux.h> #include <linux/delay.h> #include <linux/kthread.h> #include <linux/interrupt.h> #include <linux/cd.h> #include <scsi/scsi.h> #include <scsi/scsi_host.h> #include <scsijava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 #nclude</scsi_cmnd>
#include"aacraid.h"
/** * fib_map_alloc - allocate the fib objects * @dev: Adapter to allocate for * * Allocate and map the shared PCI space for the FIB blocks used to * talk to the Adaptec firmware.
*/
dprintk>hw_fib_va= dev-hw_fib_va=&pdev-dev
dev-dev-> ( aac_fib_xporthdr
>>can_queue ) ALIGN321,
AAC_NUM_MGT_FIB, &dev->hw_fib_pa));
dev->hw_fib_va = dma_alloc_coherent( &>hw_fib_pa );
( &dev->hw_fib_pa if (dev->hw_fib_va == NULL return-;
dev-can_queue+) +( -1,
&dev->hw_fib_pa, GFP_KERNEL); if (dev- 0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
*Free PCI and memory java.lang.StringIndexOutOfBoundsException: Range [1, 0) out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/** * aac_fib_map_free - free the fib objects * @dev: Adapter to free * * Free the PCI mappings and the memory allocated for FIB blocks * on this adapter.
*/
sp
{
size_t=(hw_fib(unsigned *+
size_t fib_size; int hw_fib->. java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
( ,fibptr hw_fib
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spin_lock_init Add
(>(> >. =
* Set
> java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
} else
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
+ * dev to java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 15
}
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/** * aac_fib_setup - setup the fibs * @dev: Adapter to set up * * Allocate the PCI space for the fibs, map it and then initialise the * fib area, the unmapped fib data and also the free list
*/
int aac_fib_setup(
{ struct struct hw_fib fibptr-callback_data=
dma_addr_t; int> =0;
u32 java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
/* 32 byte alignment for PMC */
> Null depend at
hw_fib >
( ->);
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
hw_fib(structhw_fib*(( sizeof(struct aac_fib_xporthdr));
hw_fib_pa+sizeofstructaac_fib_xporthdr);
/* * Initialise the fibs
*/
( =,fibptr= ev-[]java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
csi_host_ptr- +)
* aac_fib_alloc - the fib *
{
fibptr->flags = 0;
fibptr->size *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-> =dev
*
fibptr- fib* fibptr longfibptr-> =0
f> = ;
fibptr-java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 30
hw_fib->java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 13
cpu_to_le16dev->)/java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
}
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
(struct java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2 /* * one element is for the ptr to the separate sg list, * second element for 32 byte alignment
*/
fibptr->size (struct );
offsetof (/
hw_fib
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*
hw_fib_va-headerXferState=0;
}ibptr- = java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
/* *Assign vector numbers to fibs
*/ void,
/* * Add the fib chain to the free list
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
*
dev- if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
printk ,! (hw_fib_va-}ibptr->next free_fib = fibptr spin_unlock_irqrestore(&fibptr-}
* Set up the generic fib fields ready for usegeneric * aac_fib_alloc_tag-allocate a fib using tags * @dev: Adapter to allocate the fib for * @scmd: SCSI command * * Allocate a fib from the adapter fib pool using tags * from the blk layer.
*/
struct fib *aac_fib_alloc_tag(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
fibptr
fibptr = &dev->fibs[scsi_cmd_to_rq(scmd)->tag]; /* * Null out fields that depend on being zero at the start of * each I/O
*/
fibptr->hw_fib_va->header.XferState = 0;
fibptr- =;
>= java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
fibptr- = java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
fibptr- * Will deallocate *
return * java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/** * aac_fib_alloc - allocate a fib * @dev: Adapter to allocate the fib for * * Allocate a fib from the adapter fib pool. If the pool is empty we * return NULL.
*/
struct * supportjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
{ struct fib * how these queues unsignedlong flags;
spin_lock_irqsave * java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* * @entry * @ * @nonotify: notification * if(!fibptr){
spin_unlock_irqrestore(&dev->fib_lock, flags); return fibptr;
}
dev->free_fib = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*returned /* * Set the proper node type code and node byte size
*/
aac_queue ;
fibptr->size = sizeof(struct fib); /* * Null out fields that depend on being zero at the start of * each I/O
*/
fibptr->hw_fib_va- * to see if they have reached the * set the index back
ibptr- java.lang.StringIndexOutOfBoundsException: Range [0, 2) out of bounds for length 0
fibptr- = NULL
fibptr-
return fibptr;
}
/** * aac_fib_free - free a fib * @fibptr: fib to free up * * Frees up a fib and places it on the appropriate queue
*/
void * set the /* Interrupt Moderation onlyinterruptfor *the bitsinall but is java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{if(dxjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
if (--idxif(idx ! le32_to_cpu*q-.consumer){
if (fibptr->done == ( ifqid=AdapNormCmdQueuejava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
eturn;
spin_lock_irqsave&ibptr->fib_lockflags
}
}
((>flags ) &&
fibptr-
*ifqid =) {
(void*)fibptr,
le32_to_cpu }
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
fibptr- index0/* Wrap to front of the Producer Queue. */
*ndex *index =
spin_unlock_irqrestore(&fibptr->dev->fib_lock else java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
/** * aac_fib_init - initialise a fib * @fibptr: The fib to initialize * * Set up the generic fib fields ready for use
*/
void(if e32_to_cpu>onsumer
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 struct hw_fib entry turn0
memset(}
entry>base*;
;
* * * @wait: * * @nonotify * @nonotify: Don * * Gets the * index * *
hw_fib-u
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/** * fib_dealloc - deallocate a fib * @fibptr: fib to deallocate * * Will deallocate and return to the free pool the FIB pointed to by the * caller.
*/
static ( " failed\);
{ struct java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 4
hw_fib-cpu_to_le32(hw_fib-.Size;
}
!java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
((, qid&, , ) {
* these routines and are the only routines /* if no entries wait for some if caller wants to */
* how >header. java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
map 0
/** * aac_get_entry - get a queue entry * @dev: Adapter * @qid: Queue Number * @entry: Entry return * @index: Index return * @nonotify: notification control * * With a priority the routine returns a queue entry if the queue has free entries. If the queue * is full(no free entries) than no entry is returned and the function returns 0 otherwise 1 is * returned.
*/
staticreturn
{
s aac_queue unsigned * If MapFib is java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* * All of the queues wrap when they reach the end, so we check * to see if they have reached the end and if they have we just * set the index back to zero. This is a wrap. You could or off * the high bits in all updates but this is a bit faster I think.
*/
q java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
idx * * @ * @ * /* Interrupt Moderation, only interrupt for first two entries */ * @callback: Called * response * if (idx != le32_to_cpu(*(q->headers * an event *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(-i= 0 java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
qid AdapNormCmdQueue)
=ADAP_NORM_CMD_ENTRIES
**)
=ADAP_NORM_RESP_ENTRIES
s hw_fib hw_fib =>; if ! le32_to_cpu(>headers)))
unsignedunsignedlongflags=0
if sflags ;
( > )
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ if (*index >= ADAP_NORM_RESP_ENTRIES)
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3 if ((*index + 1) = * The * does not request * does * response and the * response and * * is not requested * routine when the * further processing will * will have a debug * it had a problemjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
KERN_WARNING%,%.n,
FIB_COUNTER_INCREMENTjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
0
} else(.)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
* =>+;
FIB_COUNT(.) >X | ((sponseExpected;
}
}
/** * aac_queue_get - get the next free QE * @dev: Adapter * @index: Returned index * @qid: Queue number * @hw_fib: Fib to associate with the queue entry * @wait: Wait if queue full * @fibptr: Driver fib object to go with fib * @nonotify: Don't notify the adapter * * Gets the next free QE off the requested priorty adapter command * queue and associates the Fib with the QE. The QE represented by * index is ready to insert on the queue when this routine returns * success.
*/
if (qid == AdapNormCmdQueue) { /* if no entries wait for some if caller wants to */ cpu_to_le32 while (!aac_get_entry(dev
printk * Set FIB state to indicate where *Mapthehwfibpointer *caller
}
hw_fib->.Command hw_fib->header.Command = (command;
hw_fib->header.XferState| ()java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
*/
entry- java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 10
{
((hw_fib-header) (le16_to_cpuhw_fib-header)>le16_to_cpu(>>.enderSize { /* if no entries wait for some if caller wants to */ -EMSGSIZE
} /* * Setup queue entry with command, status and fib mapped
*/
entry->size * Get a * the adapter a command isjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
entry- /* Restore adapters pointer to the FIB */
hw_fib-if(!){
map = 0;
} /* * If MapFib is true than we need to map the Fib and put pointers * in the queue entry.
*/ if ibptr-flags=FIB_CONTEXT_FLAG
fibptr- fibptr-done java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return
}
/* dprintk(KERN_DEBUG" Command= d\ dprintk("SubCommand=d." ( )(fibptr)))java.lang.StringIndexOutOfBoundsException: Index 125 out of bounds for length 125 * Define the highest level of host to adapter communication routines. * These routines will support host to adapter FS commuication. These * routines have no knowledge of the commuication method used. This level * sends and receives FIBs. This level has no knowledge of how these FIBs * get passed back and forth.
*/
/** dev->management_fib_count spin_unlock_irqrestore(&dev->manage_lock, spin_unlock_irqrestore(&dev->manage_lock, mflags); * aac_fib_send - send a fib to the adapter * @command: Command to send * @fibptr: The fib * @size: Size of fib data area * @priority: Priority of Fib * @wait: Async/sync select * @reply: True if a reply is wanted * @callback: Called with reply * @callback_data: Passed to callback * * Sends the requested FIB to the adapter and optionally will wait for a * response FIB. If the caller does not wish to wait for a response than * an event to wait on must be supplied. This event will be set when a * response FIB is received from the adapter.
*/
int
} return voidif
{
aac_dev java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 13
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spin_unlock_irqrestoredev-manage_lock )
*If callerwantedus towait java.lang.StringIndexOutOfBoundsException: Range [1, 0) out of bounds for length 0 unsignedspin_unlock_irqrestore(fibptr-event_lockflags
tate&cpu_to_le32()) return -EBUSY;
ifwait <0) java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
/* * There are 5 cases with the wait and response requested flags. * The only invalid cases are if the caller requests to wait and * does not request a response and if the caller does not want a * response and the Fib is not allocated from pool. If a response * is not requested the Fib will just be deallocaed by the DPC * routine when the response comes back from the adapter. No * further processing will be done besides deleting the Fib. We * will have a debug mode where the adapter can notify the host * it had a problem and the host can log that fact.
*/
fibptr->flags = 0; if (wait && !reply) { return -EINVAL;
} } (!if (>)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
> if time_is_before_eq_jiffiestimeout) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
(c_configAsyncSent;
} > atomic_dec(&q->numpe); ifwait {
(N)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
(&) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
hw_fib-X | (u32>,0,0 ,0java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(.java.lang.StringIndexOutOfBoundsException: Range [47, 45) out of bounds for length 47
} /* * Map the fib into 32bits by using the fib number
*/
}
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
/* use the same shifted value for handle to be compatible * with the new native hba command handle
*/
hw_fib->
cpu_to_le32 ( java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
/* * Set FIB state to indicate where it came from and if we want a * response from the adapter. Also load the command from the * caller. * * Map the hw fib pointer as a 32bit value
*/
(>, )java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
; } * Set the size of the Fib we want to send to the adapter
*/
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 return>,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} /* * Get a queue entry connect the FIB to it and send an notify * the adapter a command is ready.
*/
hw_fib->spin_unlock_irqrestore&>,flagsjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
/* * Fill in the Callback and CallbackContext if we are not * going to wait.
*/ if (! */
fibptr-callback 0 }
fibptr-> * If the user does not want userdoesnot *return ending
> =java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
}
return ;
FIB_COUNTER_INCREMENT
dprintk((KERN_DEBUG " *
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
(( =%.n" (( aac_query_mount *fib_data())-command) " a result ofa PCI interrupt ;\n"
dprintk( " = x.n,le32_to_cpu( "SAFEmode optionsacpi apicetc)\");
dprintk((KERN_DEBUG return-TIMEDOUT
dprintk
((KERN_DEBUG ""fibjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (!dev- if (callback) { return -EBUSY;
if () {
v->manage_lockmflags; ifdev-management_fib_count >=AAC_NUM_MGT_FIB {
KERN_INFONo :d\"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spin_unlock_irqrestoredev-manage_lock, mflags)
}
}
dev->
spin_unlock_irqrestore(&>manage_lock,mflags; /* bit1 of request_id must be 0 */
}
if (dev- hbacmd- = if (wait)
cpu_to_le32((()(fibptr - dev-fibs)< schedule)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
(&ev-, ); if (dev-> java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
ifwait java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0
} else (> = ){
dev->sync_fib = fibptr;
spin_unlock_irqrestore(&dev- fibptr-done spin_unlock_irqrestore>,);
(hw_fib_pa ,,
NULL, java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2
}
wait java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
-java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
wait_for_completion_interruptible>event_wait)
* java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return;
} returnjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
}(((&java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 return -;intwaitjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
u =;
f aac_adapter_deliverfibptr ! 0) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
spin_lock_irqsave&>event_lockibptr- =( FIB_CONTEXT_FLAG_NATIVE_HBA;
i(wait) {
spin_unlock_irqrestore(& (fibptr->done=0)| (>done=2) java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
((d>manage_lock, );
_(fibptr-event_lock,)
- 1;
}
hbacmd-lock_irqrestoreevent_lock flags;
}
/* * If the caller wanted us to wait for response wait now.
*/
returnETIMEDOUT;
fibptr-flags return0; if }java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 /* * *VERY* Dangerous to time out a command, the * assumption is made that we have no hope of * functioning because an interrupt routing or other * hardware failure has occurred.
*/ unsignedlong timeout = jiffies while (!try_wait_for_completion * EBUSY int dev-management_fib_countjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 23 if * we are a consumer of, andreturn the tate queue struct *=dev->[]; if(wait
{
printk aacraid asynchronous timedoutnjava.lang.StringIndexOutOfBoundsException: Index 93 out of bounds for length 93
Usually PCI \java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
bythe
}
urn-ETIMEDOUTjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
if ((blinkjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 if wait *@dev Adapter
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
*queuewas fullnotify theproducer
blinkfibptr-voidaac_consumer_freestructaac_dev *,structaac_queueq32qidjava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6 return notify;
}
_(*>.))==(q-.)
wasfull
*/
();
}
} if((fibptr-)){ /* Do nothing ... satisfy
* wait_for_completion_interruptible must_check */
}
spin_lock_irqsave
i ( return0;
spin_unlock_irqrestore&fibptr-, flags returnERESTARTSYS -INPROGRESS;
}
spin_unlock_irqrestore(
* aac_consumer_get - get the top of the queue
if(unlikely return -ETIMEDOUT; return 0;
} /* * If the user does not want a response than return success otherwise * return pending
*/
() break default: return 0;
}
int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback, voidcallback_data
{
int wait; unsignedlong/** unsigned long mflags = 0; struct aac_hba_cmd_req *hbacmd = (struct aac_hba_cmd_req *) fibptr->hw_fib_va;
if (command == HBA_IU_TYPE_SCSI_CMD_REQ) {
/* bit1 of request_id must be 0 */
hbacmd-> =
cpu_to_le32((u32fibptr - dev-))*entry >base ;
fibptr->flags |java.lang.StringIndexOutOfBoundsException: Range [3, 2) out of bounds for length 69
} else * = >;
-EINVAL
if ( * @dev: Adapter
spin_lock_irqsave(&dev- * @qid: Queue *
nsigned nointr * java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(>manage_lock mflags; return - >comm_interface=AC_COMM_MESSAGE_TYPE3 java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
}
dev->management_fib_count
spin_unlock_irqrestore(&.producer)1 =
spin_lock_irqsavefibptr->,flags
}
if kfreehw_fib;
(wait
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
>. =java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 4
>;
spin_unlock_irqrestore
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 return- >headerStructType= java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
}
(aac_config.);
(wait) java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
(& /*
if (unlikely(aac_pci_offline(dev))) return -EFAULT;
spin_lock_irqsave(&fibptr->event_lock, flags); if ((fibptr->done == 0) || (fibptr->done == 2)) {
fibptr->done = 2; /* Tell interrupt we aborted */
spin_unlock_irqrestore* all work aFIB sent
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
pin_unlock_irqrestore&>event_lockflags
(fibptr- =
if (unlikely ( >(>.)
ETIMEDOUT;
;
}
-;q dev-queues-[];
}
/** * aac_consumer_get - get the top of the queue * @dev: Adapter * @q: Queue * @entry: Return entry * * Will return a pointer to the entry on the top of the queue requested that * we are a consumer of, and return the address of the queue entry. It does * not change the state of the queue.
*/
int * plandoanything thestructuretype .java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
u32 >. ){ int (> =AAC_COMM_MESSAGE
i (*>.)= (*headers) return-java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
} else * This block handles the case where * @fibptr * command * /* * The consumer index must be wrapped if we have reached * the end of the queue, else we just use the entry * pointed to by the header index
*/ ifstruct fibptr-hw_fib_va
index = 0 } java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10 else
0java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
/
status = 1;
} return(status);
}
/** * aac_consumer_free - free consumer entry * @dev: Adapter * @q: Queue * @qid: Queue ident * * Frees up the current top of the queue we are a consumer of. If the * queue was full notify the producer that the queue is no longer full.
*/
oid aac_consumer_free hw_fib-header =FIB_MAGIC2&
{
nt h. ! )
u32 notify return -INVAL;
if ((le32_to_cpu(*q->headers. * This block completes a aac_adapter_notify(dev AdapNormRespQueue;
w ;
if (le32_to_cpu(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
else hw_fib- : java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
(java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
wasfull{ switch { fibptr-flags& {
case HostNormCmdQueue:
notify return 0; breakjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 caseHostNormRespQueue fib_deallocfibptrjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
notify HostNormRespNotFull; break; default:
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [9, 4) out of bounds for length 10
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
header=
r 0
}
/** * aac_fib_adapter_complete - complete adapter issued fib * @fibptr: fib to complete * @size: size of fib * * Will do all necessary work to complete a FIB that was sent from * the adapter.
*/
int*=dev-printfbuf
{ struct hw_fib{ struct aac_dev intlength=val 0xffff
truct *;
* The * There is nojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 unsigned ;
if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE1 ||
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
[length =0
if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(> =}
kfree(hw_fib);
0java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 /* * If we plan to do anything check the structure type first.
*/ ifstatiche size of the printfbuf is set in port *{
hw_fib-i ifBuCacheDataLoss if (aac_aif_dataaifcmd 2 dev_info(&dev->pdev->dev, "Backup unit had cache data loss - [%d]\n",
if(dev-
f( = (dev->,"BackupUnit datalossn";
returnnfodev->>dev " aac_aif_data(aifcmd, 2java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 6
} /*fine AIF_SNIFF_TIMEOUT ** * This block handles the case where the adapter had sent us a * command and we have finished processing the command. We * call completeFib when we are done processing the command * and want to send a response back to the adapter. This will * send the completed cdb to the adapter.
*/ if (hw_fib-} if
kfree (w_fib
} switchaac_aif_data, 1){
u32 index if (aac_aif_data(aifcmd, 2 dev_info(&dev->pdev->dev, "Backup unit had cache data loss aac_aif_data(aifcmd, cmd = ( aac_aifcmd *hw_fib- else
>headerXferState| cpu_to_le32 if((aifcmd2) if (size) { else if (e { return NOTHING
hw_fib->header.Size
}
* aac_handle_aif }device_config_needed ; /* Sniff for container changes */
aac_queue_get(dev, &index (!ev| !ev->sa_dev
headersproducer cpu_to_le32index+11;
spin_unlock_irqrestore( container =hw_fib* hw_fib=fibptr->hw_fib_vajava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 if (! u32,i,lun container
* certain AIF's come in we will set a
}
,
printk DELETE " caseaseAifCmdDriverNotify:
BUG();
} returnswitchle32_to_cpu(__le32)aifcmd-data[0]) {
}
/** * aac_fib_complete - fib completion handler * @fibptr: FIB to complete * * Will do all necessary work to complete a FIB.
*/
int aac_fib_complete(struct fib *fibptr reakreturn
{
if (fibptr-> if channel = dev-maximum_num_channels {
* re-configures that take place. As a result of this when return0
}
/* * Check for a fib which has already been completed or with a * status wait timeout
*/
}
* If we plan to do anything check the structure type first.
*/
/* hw_fib->header.StructType != FIB_MAGIC2 && hw_fib->header.StructType != FIB_MAGIC2_64) return -EINVAL; /* * This block completes a cdb which orginated on the host and we * just need to deallocate the cdb or reinit it. At this point the * command is complete that we had sent to the adapter and this * cdb could be reused.
*/
if ; break
/* } else if(hw_fib->header.XferState & cpu_to_le32(SentFromHost)) { /* * This handles the case when the host has aborted the I/O * to the adapter because the adapter is not responding
*/
fib_dealloc dev->fsa_dev[container].config_waiting_on dev->fsa_dev[container].config_waiting_stamp = scsi_device_put(device);
}elsejava.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 3
fib_deallocfibptr;
} else {
BUG();
return 0;
}
/** * aac_printf - handle printf from firmware * @dev: Adapter * @val: Message info * * Print a message passed to us by the controller firmware on the * Adaptec board
*/
( aac_dev java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
>java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 if (dev->printf_enabled)
{ intlengthval&0; int time_beforejiffies>[c]config_waiting_stamp +IF_SNIFF_TIMEOUT)
* The size of the printfbuf is set in port.c * There is no variable or define for it
*/ if (length > 255)
length if (>fsa_devcontainer]. = if > =
cp[length (,dev-fsa_dev ;
ev-fsa_devcontainer
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 case:
printkKERN_INFO"s:s"dev-name cp)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
}
memset
}
static void aac_handle_aif_bu(struct aac_dev *dev, struct aac_aifcmd *aifcmd) { switch (aac_aif_data(aifcmd, 1)) { case AifBuCacheDataLoss: if (aac_aif_data(aifcmd, 2)) dev_info(&dev->pdev->dev, "Backup unit had cache data loss - [%d]\n", aac_aif_data(aifcmd, 2)); else dev_info(&dev->pdev->dev, "Backup Unit had cache data loss\n"); break; case AifBuCacheDataRecover: if (aac_aif_data(aifcmd, 2)) dev_info(&dev->pdev->dev, "DDR cache data recovered successfully - [%d]\n", aac_aif_data(aifcmd, 2)); else dev_info(&dev->pdev->dev, "DDR cache data recovered successfully\n"); break; } }
#define AIF_SNIFF_TIMEOUT (500*HZ) /** * aac_handle_aif - Handle a message from the firmware * @dev: Which adapter this fib is from * @fibptr: Pointer to fibptr from adapter * * This routine handles a driver notify fib from the adapter and * dispatches it to the appropriate routine for handling.
*/ static
{ struct hw_fib * hw_fib = struct aac_aifcmd * aifcmd>[ (dev->[] &
channel,l, struct d; enum {
,
,
ADD >sa_devcontainer]onfig_waiting_stamp ;
CHANGE
} device_config_needed = NOTHING;
changes **java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
if(! |dev->fsa_dev return;
c=channel == =(java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 42
/* * We have set this up to try and minimize the number of * re-configures that take place. As a result of this when * certain AIF's come in we will set a flag waiting for another * type of AIF before setting the re-config flag.
*/ switch
case:
e32aifcmd-[0){ casejava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
=le32_to_cpu(_le32 if;
container=( } break;
}
id=>)=
channel >){
( = java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 24
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}
id ((_le32 *)aifcmd-)[0] == if (id >= dev->maximum_num_physicals) {
(u32-1 break
} if( ==ADD{
container asejava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
c =aac_phys_to_logical(
device_config_needed= DELETE break;
/* * Morph or Expand complete
*/ case AifDenMorphComplete id case = le32_to_cpujava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
= le32_to_cpu reak if (container >= dev->maximum_num_containers) break;
/* * Find the scsi_device associated with the SCSI * address. Make sure we have the right array, and if * so set the flag to initiate a new re-config once we * see an AifEnConfigChange AIF come through.
*/
AifEnEnclosureManagement:)
devicescsi_device_lookupdev-scsi_host_ptr
CONTAINER_TO_CHANNEL(container),
CONTAINER_TO_ID),
CONTAINER_TO_LUN( * target if (device *java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6
dev- =
>.=AifEnConfigChange
>[container =EM_DRIVE_INSERTION)||
scsi_device_putdevice
}
}
}
/* * If we are waiting on something and this happens to be * that thing then set the re-configure flag.
*/ ifif(container>2) java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 if (container >= dev->maximum_num_containers) break; if(dev-fsa_devreak
le32_to_cpu(*(__le32 java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
* thing set re-configure.
dev-lun container>6 xFF
ntainer= ;
container < dev->maximum_num_containers; ++container) if ((container ( =dev-){ if ((dev->fsa_dev[container].config_waiting_on if(0java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 10
le32_to_cpu((e32aifcmd->)&
time_before(jiffies, ))
dev- break
breakjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
case AifCmdEventNotify:
(e32_to_cpu(_le32aifcmd-data0)){
AifEnBatteryEvent
> ==
(((__le32 time_before(jiffies, = (EM_SES_DRIVE_INSERTION) break; /* * Add an Array.
*/ case AifEnAddContainer:
container = le32_to_cpu(((__le32caseAifCmdJobProgress aac_handle_aif_bu(dev,aifcmd; if (container >= dev->maximum_num_containers) break;
dev->fsa_dev[container].config_needed = ADD;
dev->fsa_dev AifEnConfigChange; dev->fsa_dev[container].config_waiting_stamp = jiffies; break;
/* * Delete an Array.
*/ case AifEnDeleteContainer:
container le32_to_cpu(__*)ifcmd->)[]; if (container >= dev->maximum_num_containers) break; if((dev-fsa_dev[.onfig_waiting_on
>fsa_dev[]config_waiting_onjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
?
>container ;
;
java.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 4
(container=0java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 /*
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
container= le32_to_cpu_le32 *aifcmd-data[java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 break; if (dev->fsa_dev[container ; * These are job progress AIFjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 4
} break;
dev->fsa_dev[container].config_needed = CHANGE;
* wait for a container changecontainer ;java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
onfigChange;
( = NOTHING java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 breakjava.lang.StringIndexOutOfBoundsException: Range [9, 10) out of bounds for length 9
case AifEnEnclosureManagement: /* * If in JBOD mode, automatic exposure of new * physical target to be suppressed until configured. */ if (dev->jbod) break; switch (le32_to_cpu(((__le32 *)aifcmd->data)[3])) { case EM_DRIVE_INSERTION: case EM_DRIVE_REMOVAL: case EM_SES_DRIVE_INSERTION: case EM_SES_DRIVE_REMOVAL: container = le32_to_cpu( ((__le32 *)aifcmd->data)[2]); if ((container >> 28)) { container = (u32)-1; break; } channel = (container >> 24) & 0xF; if (channel >= dev->maximum_num_channels) { container = (u32)-1; break; } id = container & 0xFFFF; lun = (container >> 16) & 0xFF; container = (u32)-1; if (id >= dev->maximum_num_physicals) { /* legacy dev_t ? */ if ((0x2000 <= id) || lun || channel || ((channel = (id >> 7) & 0x3F) >= dev->maximum_num_channels)) break; lun = (id >> 4) & 7; id &= 0xF; } channel = aac_phys_to_logical(channel); device_config_needed = ((((__le32 *)aifcmd->data)[3] == cpu_to_le32(EM_DRIVE_INSERTION)) || (((__le32 *)aifcmd->data)[3] == cpu_to_le32(EM_SES_DRIVE_INSERTION))) ? ADD : DELETE; break; } break; case AifBuManagerEvent: aac_handle_aif_bu(dev, aifcmd); break; }
/* * If we are waiting on something and this happens to be * that thing then set the re-configure flag. */ if (container != (u32)-1) { if (container >= dev->maximum_num_containers) break; if ((dev->fsa_dev[container].config_waiting_on == le32_to_cpu(*(__le32 *)aifcmd->data)) && time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) dev->fsa_dev[container].config_waiting_on = 0; } else for (container = 0; container < dev->maximum_num_containers; ++container) { if ((dev->fsa_dev[container].config_waiting_on == le32_to_cpu(*(__le32 *)aifcmd->data)) && time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) dev->fsa_dev[container].config_waiting_on = 0; } break;
case AifCmdJobProgress: /* * These are job progress AIF's. When a Clear is being * done on a container it is initially created then hidden from * the OS. When the clear completes we don't get a config * change so we monitor the job status complete on a clear then * wait for a container change. */
if (((__le32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero) && (((__le32 *)aifcmd->data)[6] == ((__le32 *)aifcmd->data)[5] || ((__le32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsSuccess))) { for (container = 0; container < dev->maximum_num_containers; ++container) { /* * Stomp on all config sequencing for all * containers? */ dev->fsa_dev[container].config_waiting_on = AifEnContainerChange; dev->fsa_dev[container].config_needed = ADD; dev->fsa_dev[container].config_waiting_stamp = jiffies; } } if (((__le32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero) && ((__le32 *)aifcmd->data)[6] == 0 && ((__le32 *)aifcmd->data)[4] == cpu_to_le32(AifJobStsRunning)) { for (container = 0; container < dev->maximum_num_containers; ++container) { /* * Stomp on all config sequencing for all * containers? */ dev->fsa_dev[container].config_waiting_on = AifEnContainerChange; dev->fsa_dev[container].config_needed = DELETE; dev->fsa_dev[container].config_waiting_stamp = jiffies; } } break; }
/* * If we decided that a re-configuration needs to be done, * schedule it here on the way out the door, please close the door * behind you. */
/* * Find the scsi_device associated with the SCSI address, * and mark it as changed, invalidating the cache. This deals * with changes to existing device IDs. */
if (!dev || !dev->scsi_host_ptr) return; /* * force reload of disk info via aac_probe_container */ if ((channel == CONTAINER_CHANNEL) && (device_config_needed != NOTHING)) { if (dev->fsa_dev[container].valid == 1) dev->fsa_dev[container].valid = 2; aac_probe_container(dev, container); } device = scsi_device_lookup(dev->scsi_host_ptr, channel, id, lun); if (device) { switch (device_config_needed) { case DELETE: #if (defined(AAC_DEBUG_INSTRUMENT_AIF_DELETE)) scsi_remove_device(device); #else if (scsi_device_online(device)) { scsi_device_set_state(device, SDEV_OFFLINE); sdev_printk(KERN_INFO, device, "Device offlined - %s\n", (channel == CONTAINER_CHANNEL) ? "array deleted" : "enclosure services event"); } #endif break; case ADD: if (!scsi_device_online(device)) { sdev_printk(KERN_INFO, device, "Device online - %s\n", (channel == CONTAINER_CHANNEL) ? "array created" : "enclosure services event"); scsi_device_set_state(device, SDEV_RUNNING); } fallthrough; case CHANGE: if ((channel == CONTAINER_CHANNEL) && (!dev->fsa_dev[container].valid)) { #if (defined(AAC_DEBUG_INSTRUMENT_AIF_DELETE)) scsi_remove_device(device); #else if (!scsi_device_online(device)) break; scsi_device_set_state(device, SDEV_OFFLINE); sdev_printk(KERN_INFO, device, "Device offlined - %s\n", "array failed"); #endif break; } scsi_rescan_device(device); break;
static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) { int index, quirks; int retval; struct Scsi_Host *host = aac->scsi_host_ptr; int jafo = 0; int bled; u64 dmamask; int num_of_fibs = 0;
/* * Assumptions: * - host is locked, unless called by the aacraid thread. * (a matter of convenience, due to legacy issues surrounding * eh_host_adapter_reset). * - in_reset is asserted, so no new i/o is getting to the * card. * - The card is dead, or will be very shortly ;-/ so no new * commands are completing in the interrupt service. */ aac_adapter_disable_int(aac); if (aac->thread && aac->thread->pid != current->pid) { spin_unlock_irq(host->host_lock); kthread_stop(aac->thread); aac->thread = NULL; jafo = 1; }
/* * If a positive health, means in a known DEAD PANIC * state and the adapter could be reset to `try again'. */ bled = forced ? 0 : aac_adapter_check_health(aac); retval = aac_adapter_restart(aac, bled, reset_type);
if (retval) goto out;
/* * Loop through the fibs, close the synchronous FIBS */ retval = 1; num_of_fibs = aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB; for (index = 0; index < num_of_fibs; index++) {
if (is_response_expected || fib->flags & FIB_CONTEXT_FLAG_WAIT) { unsigned long flagv; spin_lock_irqsave(&fib->event_lock, flagv); complete(&fib->event_wait); spin_unlock_irqrestore(&fib->event_lock, flagv); schedule(); retval = 0; } } /* Give some extra time for ioctls to complete. */ if (retval == 0) ssleep(2); index = aac->cardtype;
/* * Re-initialize the adapter, first free resources, then carefully * apply the initialization sequence to come back again. Only risk * is a change in Firmware dropping cache, it is assumed the caller * will ensure that i/o is queisced and the card is flushed in that * case. */ aac_free_irq(aac); aac_fib_map_free(aac); dma_free_coherent(&aac->pdev->dev, aac->comm_size, aac->comm_addr, aac->comm_phys); aac_adapter_ioremap(aac, 0); aac->comm_addr = NULL; aac->comm_phys = 0; kfree(aac->queues); aac->queues = NULL; kfree(aac->fsa_dev); aac->fsa_dev = NULL;
if ((retval = (*(aac_get_driver_ident(index)->init))(aac))) goto out;
if (jafo) { aac->thread = kthread_run(aac_command_thread, aac, "%s", aac->name); if (IS_ERR(aac->thread)) { retval = PTR_ERR(aac->thread); aac->thread = NULL; goto out; } } (void)aac_get_adapter_info(aac); if ((quirks & AAC_QUIRK_34SG) && (host->sg_tablesize > 34)) { host->sg_tablesize = 34; host->max_sectors = (host->sg_tablesize * 8) + 112; } if ((quirks & AAC_QUIRK_17SG) && (host->sg_tablesize > 17)) { host->sg_tablesize = 17; host->max_sectors = (host->sg_tablesize * 8) + 112; } aac_get_config_status(aac, 1); aac_get_containers(aac); /* * This is where the assumption that the Adapter is quiesced * is important. */ scsi_host_complete_all_commands(host, DID_RESET);
retval = 0; out: aac->in_reset = 0;
/* * Issue bus rescan to catch any configuration that might have * occurred */ if (!retval && !is_kdump_kernel()) { dev_info(&aac->pdev->dev, "Scheduling bus rescan\n"); aac_schedule_bus_scan(aac); }
if (jafo) { spin_lock_irq(host->host_lock); } return retval; }
int aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) { unsigned long flagv = 0; int retval, unblock_retval; struct Scsi_Host *host = aac->scsi_host_ptr; int bled;
if (spin_trylock_irqsave(&aac->fib_lock, flagv) == 0) return -EBUSY;
/* * Wait for all commands to complete to this specific * target (block maximum 60 seconds). Although not necessary, * it does make us a good storage citizen. */ scsi_host_block(host);
if (status >= 0) aac_fib_complete(fibctx); /* FIB should be freed only after getting * the response from the F/W */ if (status != -ERESTARTSYS) aac_fib_free(fibctx); } }
return retval; }
static inline int is_safw_raid_volume(struct aac_dev *aac, int bus, int target) { return bus == CONTAINER_CHANNEL && target < aac->maximum_num_containers; }
static struct scsi_device *aac_lookup_safw_scsi_device(struct aac_dev *dev, int bus, int target) { if (bus != CONTAINER_CHANNEL) bus = aac_phys_to_logical(bus);
/** * aac_handle_sa_aif - Handle a message from the firmware * @dev: Which adapter this fib is from * @fibptr: Pointer to fibptr from adapter * * This routine handles a driver notify fib from the adapter and * dispatches it to the appropriate routine for handling. */ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr) { int i; u32 events = 0;
if (fibptr->hbacmd_size & SA_AIF_HOTPLUG) events = SA_AIF_HOTPLUG; else if (fibptr->hbacmd_size & SA_AIF_HARDWARE) events = SA_AIF_HARDWARE; else if (fibptr->hbacmd_size & SA_AIF_PDEV_CHANGE) events = SA_AIF_PDEV_CHANGE; else if (fibptr->hbacmd_size & SA_AIF_LDEV_CHANGE) events = SA_AIF_LDEV_CHANGE; else if (fibptr->hbacmd_size & SA_AIF_BPSTAT_CHANGE) events = SA_AIF_BPSTAT_CHANGE; else if (fibptr->hbacmd_size & SA_AIF_BPCFG_CHANGE) events = SA_AIF_BPCFG_CHANGE;
switch (events) { case SA_AIF_HOTPLUG: case SA_AIF_HARDWARE: case SA_AIF_PDEV_CHANGE: case SA_AIF_LDEV_CHANGE: case SA_AIF_BPCFG_CHANGE:
aac_scan_host(dev);
break;
case SA_AIF_BPSTAT_CHANGE: /* currently do nothing */ break; }
for (i = 1; i <= 10; ++i) { events = src_readl(dev, MUnit.IDR); if (events & (1<<23)) { pr_warn(" AIF not cleared by firmware - %d/%d)\n", i, 10); ssleep(1); } } }
static int get_fib_count(struct aac_dev *dev) { unsigned int num = 0; struct list_head *entry; unsigned long flagv;
/* * Warning: no sleep allowed while * holding spinlock. We take the estimate * and pre-allocate a set of fibs outside the * lock. */ num = le32_to_cpu(dev->init->r7.adapter_fibs_size) / sizeof(struct hw_fib); /* some extra */ spin_lock_irqsave(&dev->fib_lock, flagv); entry = dev->fib_list.next; while (entry != &dev->fib_list) { entry = entry->next; ++num; } spin_unlock_irqrestore(&dev->fib_lock, flagv);
time_now = jiffies/HZ; spin_lock_irqsave(&dev->fib_lock, flagv); entry = dev->fib_list.next; /* * For each Context that is on the * fibctxList, make a copy of the * fib, and then set the event to wake up the * thread that is waiting for it. */
hw_fib_p = hw_fib_pool; fib_p = fib_pool; while (entry != &dev->fib_list) { /* * Extract the fibctx */ fibctx = list_entry(entry, struct aac_fib_context, next); /* * Check if the queue is getting * backlogged */ if (fibctx->count > 20) { /* * It's *not* jiffies folks, * but jiffies / HZ so do not * panic ... */ time_last = fibctx->jiffies; /* * Has it been > 2 minutes * since the last read off * the queue? */ if ((time_now - time_last) > aif_timeout) { entry = entry->next; aac_close_fib_context(dev, fibctx); continue; } } /* * Warning: no sleep allowed while * holding spinlock */ if (hw_fib_p >= &hw_fib_pool[num]) { pr_warn("aifd: didn't allocate NewFib\n"); entry = entry->next; continue; }
hw_newfib = *hw_fib_p; *(hw_fib_p++) = NULL; newfib = *fib_p; *(fib_p++) = NULL; /* * Make the copy of the FIB */ memcpy(hw_newfib, hw_fib, sizeof(struct hw_fib)); memcpy(newfib, fib, sizeof(struct fib)); newfib->hw_fib_va = hw_newfib; /* * Put the FIB onto the * fibctx's fibs */ list_add_tail(&newfib->fiblink, &fibctx->fib_list); fibctx->count++; /* * Set the event to wake up the * thread that is waiting. */ complete(&fibctx->completion);
entry = entry->next; } /* * Set the status of this FIB */ *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); aac_fib_adapter_complete(fib, sizeof(u32)); spin_unlock_irqrestore(&dev->fib_lock, flagv);
fib = list_entry(entry, struct fib, fiblink); hw_fib = fib->hw_fib_va; if (dev->sa_firmware) { /* Thor AIF */ aac_handle_sa_aif(dev, fib); aac_fib_adapter_complete(fib, (u16)sizeof(u32)); goto free_fib; } /* * We will process the FIB here or pass it to a * worker thread that is TBD. We Really can't * do anything at this point since we don't have * anything defined for this thread to do. */ memset(fib, 0, sizeof(struct fib)); fib->type = FSAFS_NTC_FIB_CONTEXT; fib->size = sizeof(struct fib); fib->hw_fib_va = hw_fib; fib->data = hw_fib->data; fib->dev = dev; /* * We only handle AifRequest fibs from the adapter. */
aifcmd = (struct aac_aifcmd *) hw_fib->data; if (aifcmd->command == cpu_to_le32(AifCmdDriverNotify)) { /* Handle Driver Notify Events */ aac_handle_aif(dev, fib); *(__le32 *)hw_fib->data = cpu_to_le32(ST_OK); aac_fib_adapter_complete(fib, (u16)sizeof(u32)); goto free_fib; } /* * The u32 here is important and intended. We are using * 32bit wrapping time to fit the adapter field */
ret = aac_send_wellness_command(dev, wellness_str, datasize);
out: return ret; }
static int aac_send_hosttime(struct aac_dev *dev, struct timespec64 *now) { int ret = -ENOMEM; struct fib *fibptr; __le32 *info;
fibptr = aac_fib_alloc(dev); if (!fibptr) goto out;
aac_fib_init(fibptr); info = (__le32 *)fib_data(fibptr); *info = cpu_to_le32(now->tv_sec); /* overflow in y2106 */ ret = aac_fib_send(SendHostTime, fibptr, sizeof(*info), FsaNormal, 1, 1, NULL, NULL);
/* * Do not set XferState to zero unless * receives a response from F/W */ if (ret >= 0) aac_fib_complete(fibptr);
/* * FIB should be freed only after * getting the response from the F/W */ if (ret != -ERESTARTSYS) aac_fib_free(fibptr);
out: return ret; }
/** * aac_command_thread - command processing thread * @data: Adapter to monitor * * Waits on the commandready event in it's queue. When the event gets set * it will pull FIBs off it's queue. It will continue to pull FIBs off * until the queue is empty. When the queue is empty it will wait for * more FIBs. */
int aac_command_thread(void *data) { struct aac_dev *dev = data; DECLARE_WAITQUEUE(wait, current); unsigned long next_jiffies = jiffies + HZ; unsigned long next_check_jiffies = next_jiffies; long difference = HZ;
/* * We can only have one thread per adapter for AIF's. */ if (dev->aif_thread) return -EINVAL;
/* * Let the DPC know it has a place to send the AIF's to. */ dev->aif_thread = 1; add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); set_current_state(TASK_INTERRUPTIBLE); dprintk ((KERN_INFO "aac_command_thread start\n")); while (1) {
/* Don't even try to talk to adapter if its sick */ ret = aac_adapter_check_health(dev); if (ret || !dev->queues) break; next_check_jiffies = jiffies + ((long)(unsigned)check_interval) * HZ; ktime_get_real_ts64(&now);
/* * we probably want usleep_range() here instead of the * jiffies computation */ schedule_timeout(difference);
if (kthread_should_stop()) break; } if (dev->queues) remove_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); dev->aif_thread = 0; return 0; }
int aac_acquire_irq(struct aac_dev *dev) { int i; int j; int ret = 0;
if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) { for (i = 0; i < dev->max_msix; i++) { dev->aac_msix[i].vector_no = i; dev->aac_msix[i].dev = dev; if (request_irq(pci_irq_vector(dev->pdev, i), dev->a_ops.adapter_intr, 0, "aacraid", &(dev->aac_msix[i]))) { printk(KERN_ERR "%s%d: Failed to register IRQ for vector %d.\n", dev->name, dev->id, i); for (j = 0 ; j < i ; j++) free_irq(pci_irq_vector(dev->pdev, j), &(dev->aac_msix[j])); pci_disable_msix(dev->pdev); ret = -1; } } } else { dev->aac_msix[0].vector_no = 0; dev->aac_msix[0].dev = dev;
if (request_irq(dev->pdev->irq, dev->a_ops.adapter_intr, IRQF_SHARED, "aacraid", &(dev->aac_msix[0])) < 0) { if (dev->msi) pci_disable_msi(dev->pdev); printk(KERN_ERR "%s%d: Interrupt unavailable.\n", dev->name, dev->id); ret = -1; } } return ret; }
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.64Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.