Commit 71fa0a84 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6: (40 commits)
  [SCSI] aic79xx: Print out signalling
  [SCSI] aic7xxx: Remove slave_destroy
  [SCSI] aic79xx: set precompensation
  [SCSI] aic79xx: Fixup external device reset
  [SCSI] replace u8 and u32 with __u8 and __u32 in scsi.h for user space
  [SCSI] lpfc: fix printk format warning
  [SCSI] aic79xx: make ahd_set_tags() static
  [SCSI] aic7xxx: cleanups
  [SCSI] drivers/scsi: Handcrafted MIN/MAX macro removal
  [SCSI] scsi_debug: support REPORT TARGET PORT GROUPS
  [SCSI] qla1280 bus reset typo
  [SCSI] libiscsi: fix logout pdu processing
  [SCSI] libiscsi: fix aen support
  [SCSI] libiscsi: fix missed iscsi_task_put in xmit error path
  [SCSI] libiscsi: fix oops in connection create failure path
  [SCSI] iscsi class: fix slab corruption during restart
  [SCSI] Switch fdomain to the pci_get API
  [SCSI] add can_queue to host parameters
  [SCSI] megaraid_{mm,mbox}: 64-bit DMA capability fix
  [SCSI] aic94xx: Supermicro motherboards support
  ...
parents 9d81a782 d6b9ccbb
......@@ -70,9 +70,9 @@
#define FCP_CMND(SCpnt) ((fcp_cmnd *)&(SCpnt->SCp))
#define FC_SCMND(SCpnt) ((fc_channel *)(SCpnt->device->host->hostdata[0]))
#define SC_FCMND(fcmnd) ((Scsi_Cmnd *)((long)fcmnd - (long)&(((Scsi_Cmnd *)0)->SCp)))
#define SC_FCMND(fcmnd) ((struct scsi_cmnd *)((long)fcmnd - (long)&(((struct scsi_cmnd *)0)->SCp)))
static int fcp_scsi_queue_it(fc_channel *, Scsi_Cmnd *, fcp_cmnd *, int);
static int fcp_scsi_queue_it(fc_channel *, struct scsi_cmnd *, fcp_cmnd *, int);
void fcp_queue_empty(fc_channel *);
static void fcp_scsi_insert_queue (fc_channel *fc, fcp_cmnd *fcmd)
......@@ -378,14 +378,14 @@ void fcp_register(fc_channel *fc, u8 type, int unregister)
printk ("FC: %segistering unknown type %02x\n", unregister ? "Unr" : "R", type);
}
static void fcp_scsi_done(Scsi_Cmnd *SCpnt);
static void fcp_scsi_done(struct scsi_cmnd *SCpnt);
static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hdr *fch)
{
fcp_cmnd *fcmd;
fcp_rsp *rsp;
int host_status;
Scsi_Cmnd *SCpnt;
struct scsi_cmnd *SCpnt;
int sense_len;
int rsp_status;
......@@ -757,13 +757,14 @@ void fcp_release(fc_channel *fcchain, int count) /* count must > 0 */
}
static void fcp_scsi_done (Scsi_Cmnd *SCpnt)
static void fcp_scsi_done(struct scsi_cmnd *SCpnt)
{
if (FCP_CMND(SCpnt)->done)
FCP_CMND(SCpnt)->done(SCpnt);
}
static int fcp_scsi_queue_it(fc_channel *fc, Scsi_Cmnd *SCpnt, fcp_cmnd *fcmd, int prepare)
static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt,
fcp_cmnd *fcmd, int prepare)
{
long i;
fcp_cmd *cmd;
......@@ -837,7 +838,8 @@ static int fcp_scsi_queue_it(fc_channel *fc, Scsi_Cmnd *SCpnt, fcp_cmnd *fcmd, i
return 0;
}
int fcp_scsi_queuecommand(Scsi_Cmnd *SCpnt, void (* done)(Scsi_Cmnd *))
int fcp_scsi_queuecommand(struct scsi_cmnd *SCpnt,
void (* done)(struct scsi_cmnd *))
{
fcp_cmnd *fcmd = FCP_CMND(SCpnt);
fc_channel *fc = FC_SCMND(SCpnt);
......@@ -873,7 +875,7 @@ void fcp_queue_empty(fc_channel *fc)
}
}
int fcp_scsi_abort(Scsi_Cmnd *SCpnt)
int fcp_scsi_abort(struct scsi_cmnd *SCpnt)
{
/* Internal bookkeeping only. Lose 1 cmd_slots slot. */
fcp_cmnd *fcmd = FCP_CMND(SCpnt);
......@@ -910,7 +912,7 @@ int fcp_scsi_abort(Scsi_Cmnd *SCpnt)
}
#if 0
void fcp_scsi_reset_done(Scsi_Cmnd *SCpnt)
void fcp_scsi_reset_done(struct scsi_cmnd *SCpnt)
{
fc_channel *fc = FC_SCMND(SCpnt);
......@@ -921,7 +923,7 @@ void fcp_scsi_reset_done(Scsi_Cmnd *SCpnt)
#define FCP_RESET_TIMEOUT (2*HZ)
int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt)
int fcp_scsi_dev_reset(struct scsi_cmnd *SCpnt)
{
#if 0 /* broken junk, but if davem wants to compile this driver, let him.. */
unsigned long flags;
......@@ -931,7 +933,7 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt)
DECLARE_MUTEX_LOCKED(sem);
if (!fc->rst_pkt) {
fc->rst_pkt = (Scsi_Cmnd *) kmalloc(sizeof(SCpnt), GFP_KERNEL);
fc->rst_pkt = (struct scsi_cmnd *) kmalloc(sizeof(SCpnt), GFP_KERNEL);
if (!fc->rst_pkt) return FAILED;
fcmd = FCP_CMND(fc->rst_pkt);
......@@ -999,7 +1001,7 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt)
return SUCCESS;
}
static int __fcp_scsi_host_reset(Scsi_Cmnd *SCpnt)
static int __fcp_scsi_host_reset(struct scsi_cmnd *SCpnt)
{
fc_channel *fc = FC_SCMND(SCpnt);
fcp_cmnd *fcmd = FCP_CMND(SCpnt);
......@@ -1020,7 +1022,7 @@ static int __fcp_scsi_host_reset(Scsi_Cmnd *SCpnt)
else return FAILED;
}
int fcp_scsi_host_reset(Scsi_Cmnd *SCpnt)
int fcp_scsi_host_reset(struct scsi_cmnd *SCpnt)
{
unsigned long flags;
int rc;
......
......@@ -39,7 +39,7 @@ struct _fc_channel;
typedef struct fcp_cmnd {
struct fcp_cmnd *next;
struct fcp_cmnd *prev;
void (*done)(Scsi_Cmnd *);
void (*done)(struct scsi_cmnd *);
unsigned short proto;
unsigned short token;
unsigned int did;
......@@ -94,14 +94,14 @@ typedef struct _fc_channel {
long *scsi_bitmap;
long scsi_bitmap_end;
int scsi_free;
int (*encode_addr)(Scsi_Cmnd *, u16 *, struct _fc_channel *, fcp_cmnd *);
int (*encode_addr)(struct scsi_cmnd *, u16 *, struct _fc_channel *, fcp_cmnd *);
fcp_cmnd *scsi_que;
char scsi_name[4];
fcp_cmnd **cmd_slots;
int channels;
int targets;
long *ages;
Scsi_Cmnd *rst_pkt;
struct scsi_cmnd *rst_pkt;
fcp_posmap *posmap;
/* LOGIN stuff */
fcp_cmnd *login;
......@@ -155,9 +155,10 @@ int fc_do_prli(fc_channel *, unsigned char);
for_each_fc_channel(fc) \
if (fc->state == FC_STATE_ONLINE)
int fcp_scsi_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
int fcp_scsi_abort(Scsi_Cmnd *);
int fcp_scsi_dev_reset(Scsi_Cmnd *);
int fcp_scsi_host_reset(Scsi_Cmnd *);
int fcp_scsi_queuecommand(struct scsi_cmnd *,
void (* done) (struct scsi_cmnd *));
int fcp_scsi_abort(struct scsi_cmnd *);
int fcp_scsi_dev_reset(struct scsi_cmnd *);
int fcp_scsi_host_reset(struct scsi_cmnd *);
#endif /* !(_FCP_SCSI_H) */
......@@ -75,8 +75,8 @@
#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR
#endif
#define MPT_LINUX_VERSION_COMMON "3.04.01"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.01"
#define MPT_LINUX_VERSION_COMMON "3.04.02"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.04.02"
#define WHAT_MAGIC_STRING "@" "(" "#" ")"
#define show_mptmod_ver(s,ver) \
......
......@@ -96,6 +96,10 @@ static int mptfc_qcmd(struct scsi_cmnd *SCpnt,
static void mptfc_target_destroy(struct scsi_target *starget);
static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout);
static void __devexit mptfc_remove(struct pci_dev *pdev);
static int mptfc_abort(struct scsi_cmnd *SCpnt);
static int mptfc_dev_reset(struct scsi_cmnd *SCpnt);
static int mptfc_bus_reset(struct scsi_cmnd *SCpnt);
static int mptfc_host_reset(struct scsi_cmnd *SCpnt);
static struct scsi_host_template mptfc_driver_template = {
.module = THIS_MODULE,
......@@ -110,10 +114,10 @@ static struct scsi_host_template mptfc_driver_template = {
.target_destroy = mptfc_target_destroy,
.slave_destroy = mptscsih_slave_destroy,
.change_queue_depth = mptscsih_change_queue_depth,
.eh_abort_handler = mptscsih_abort,
.eh_device_reset_handler = mptscsih_dev_reset,
.eh_bus_reset_handler = mptscsih_bus_reset,
.eh_host_reset_handler = mptscsih_host_reset,
.eh_abort_handler = mptfc_abort,
.eh_device_reset_handler = mptfc_dev_reset,
.eh_bus_reset_handler = mptfc_bus_reset,
.eh_host_reset_handler = mptfc_host_reset,
.bios_param = mptscsih_bios_param,
.can_queue = MPT_FC_CAN_QUEUE,
.this_id = -1,
......@@ -171,6 +175,77 @@ static struct fc_function_template mptfc_transport_functions = {
.show_host_symbolic_name = 1,
};
static int
mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
int (*func)(struct scsi_cmnd *SCpnt),
const char *caller)
{
struct scsi_device *sdev = SCpnt->device;
struct Scsi_Host *shost = sdev->host;
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
unsigned long flags;
int ready;
spin_lock_irqsave(shost->host_lock, flags);
while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) {
spin_unlock_irqrestore(shost->host_lock, flags);
dfcprintk ((MYIOC_s_INFO_FMT
"mptfc_block_error_handler.%d: %d:%d, port status is "
"DID_IMM_RETRY, deferring %s recovery.\n",
((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
SCpnt->device->id,SCpnt->device->lun,caller));
msleep(1000);
spin_lock_irqsave(shost->host_lock, flags);
}
spin_unlock_irqrestore(shost->host_lock, flags);
if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) {
dfcprintk ((MYIOC_s_INFO_FMT
"%s.%d: %d:%d, failing recovery, "
"port state %d, vdev %p.\n", caller,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
SCpnt->device->id,SCpnt->device->lun,ready,
SCpnt->device->hostdata));
return FAILED;
}
dfcprintk ((MYIOC_s_INFO_FMT
"%s.%d: %d:%d, executing recovery.\n", caller,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
SCpnt->device->id,SCpnt->device->lun));
return (*func)(SCpnt);
}
static int
mptfc_abort(struct scsi_cmnd *SCpnt)
{
return
mptfc_block_error_handler(SCpnt, mptscsih_abort, __FUNCTION__);
}
static int
mptfc_dev_reset(struct scsi_cmnd *SCpnt)
{
return
mptfc_block_error_handler(SCpnt, mptscsih_dev_reset, __FUNCTION__);
}
static int
mptfc_bus_reset(struct scsi_cmnd *SCpnt)
{
return
mptfc_block_error_handler(SCpnt, mptscsih_bus_reset, __FUNCTION__);
}
static int
mptfc_host_reset(struct scsi_cmnd *SCpnt)
{
return
mptfc_block_error_handler(SCpnt, mptscsih_host_reset, __FUNCTION__);
}
static void
mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
{
......@@ -562,6 +637,12 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
return 0;
}
if (!SCpnt->device->hostdata) { /* vdev */
SCpnt->result = DID_NO_CONNECT << 16;
done(SCpnt);
return 0;
}
/* dd_data is null until finished adding target */
ri = *((struct mptfc_rport_info **)rport->dd_data);
if (unlikely(!ri)) {
......
......@@ -107,6 +107,10 @@ zfcp_address_to_sg(void *address, struct scatterlist *list)
(ZFCP_MAX_SBALS_PER_REQ * ZFCP_MAX_SBALES_PER_SBAL - 2)
/* request ID + QTCB in SBALE 0 + 1 of first SBAL in chain */
#define ZFCP_MAX_SECTORS (ZFCP_MAX_SBALES_PER_REQ * 8)
/* max. number of (data buffer) SBALEs in largest SBAL chain
multiplied with number of sectors per 4k block */
/* FIXME(tune): free space should be one max. SBAL chain plus what? */
#define ZFCP_QDIO_PCI_INTERVAL (QDIO_MAX_BUFFERS_PER_Q \
- (ZFCP_MAX_SBALS_PER_REQ + 4))
......
......@@ -58,6 +58,7 @@ struct zfcp_data zfcp_data = {
.cmd_per_lun = 1,
.use_clustering = 1,
.sdev_attrs = zfcp_sysfs_sdev_attrs,
.max_sectors = ZFCP_MAX_SECTORS,
},
.driver_version = ZFCP_VERSION,
};
......
......@@ -53,14 +53,6 @@ struct ahd_platform_data;
struct scb_platform_data;
/****************************** Useful Macros *********************************/
#ifndef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef TRUE
#define TRUE 1
#endif
......@@ -972,8 +964,6 @@ int ahd_read_seeprom(struct ahd_softc *ahd, uint16_t *buf,
int ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf,
u_int start_addr, u_int count);
int ahd_wait_seeprom(struct ahd_softc *ahd);
int ahd_verify_vpd_cksum(struct vpd_config *vpd);
int ahd_verify_cksum(struct seeprom_config *sc);
int ahd_acquire_seeprom(struct ahd_softc *ahd);
void ahd_release_seeprom(struct ahd_softc *ahd);
......@@ -1320,8 +1310,6 @@ struct ahd_pci_identity {
char *name;
ahd_device_setup_t *setup;
};
extern struct ahd_pci_identity ahd_pci_ident_table [];
extern const u_int ahd_num_pci_devs;
/***************************** VL/EISA Declarations ***************************/
struct aic7770_identity {
......@@ -1339,15 +1327,6 @@ extern const int ahd_num_aic7770_devs;
/*************************** Function Declarations ****************************/
/******************************************************************************/
void ahd_reset_cmds_pending(struct ahd_softc *ahd);
u_int ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl);
void ahd_busy_tcl(struct ahd_softc *ahd,
u_int tcl, u_int busyid);
static __inline void ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl);
static __inline void
ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl)
{
ahd_busy_tcl(ahd, tcl, SCB_LIST_NULL);
}
/***************************** PCI Front End *********************************/
struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t);
......@@ -1356,7 +1335,6 @@ int ahd_pci_config(struct ahd_softc *,
int ahd_pci_test_register_access(struct ahd_softc *);
/************************** SCB and SCB queue management **********************/
int ahd_probe_scbs(struct ahd_softc *);
void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd,
struct scb *scb);
int ahd_match_scb(struct ahd_softc *ahd, struct scb *scb,
......@@ -1374,33 +1352,20 @@ int ahd_parse_vpddata(struct ahd_softc *ahd,
int ahd_parse_cfgdata(struct ahd_softc *ahd,
struct seeprom_config *sc);
void ahd_intr_enable(struct ahd_softc *ahd, int enable);
void ahd_update_coalescing_values(struct ahd_softc *ahd,
u_int timer,
u_int maxcmds,
u_int mincmds);
void ahd_enable_coalescing(struct ahd_softc *ahd,
int enable);
void ahd_pause_and_flushwork(struct ahd_softc *ahd);
int ahd_suspend(struct ahd_softc *ahd);
int ahd_resume(struct ahd_softc *ahd);
void ahd_set_unit(struct ahd_softc *, int);
void ahd_set_name(struct ahd_softc *, char *);
struct scb *ahd_get_scb(struct ahd_softc *ahd, u_int col_idx);
void ahd_free_scb(struct ahd_softc *ahd, struct scb *scb);
void ahd_alloc_scbs(struct ahd_softc *ahd);
void ahd_free(struct ahd_softc *ahd);
int ahd_reset(struct ahd_softc *ahd, int reinit);
void ahd_shutdown(void *arg);
int ahd_write_flexport(struct ahd_softc *ahd,
u_int addr, u_int value);
int ahd_read_flexport(struct ahd_softc *ahd, u_int addr,
uint8_t *value);
int ahd_wait_flexport(struct ahd_softc *ahd);
/*************************** Interrupt Services *******************************/
void ahd_pci_intr(struct ahd_softc *ahd);
void ahd_clear_intstat(struct ahd_softc *ahd);
void ahd_flush_qoutfifo(struct ahd_softc *ahd);
void ahd_run_qoutfifo(struct ahd_softc *ahd);
#ifdef AHD_TARGET_MODE
void ahd_run_tqinfifo(struct ahd_softc *ahd, int paused);
......@@ -1409,7 +1374,6 @@ void ahd_handle_hwerrint(struct ahd_softc *ahd);
void ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat);
void ahd_handle_scsiint(struct ahd_softc *ahd,
u_int intstat);
void ahd_clear_critical_section(struct ahd_softc *ahd);
/***************************** Error Recovery *********************************/
typedef enum {
......@@ -1426,23 +1390,9 @@ int ahd_search_disc_list(struct ahd_softc *ahd, int target,
char channel, int lun, u_int tag,
int stop_on_first, int remove,
int save_state);
void ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb);
int ahd_reset_channel(struct ahd_softc *ahd, char channel,
int initiate_reset);
int ahd_abort_scbs(struct ahd_softc *ahd, int target,
char channel, int lun, u_int tag,
role_t role, uint32_t status);
void ahd_restart(struct ahd_softc *ahd);
void ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo);
void ahd_handle_scb_status(struct ahd_softc *ahd,
struct scb *scb);
void ahd_handle_scsi_status(struct ahd_softc *ahd,
struct scb *scb);
void ahd_calc_residual(struct ahd_softc *ahd,
struct scb *scb);
/*************************** Utility Functions ********************************/
struct ahd_phase_table_entry*
ahd_lookup_phase_entry(int phase);
void ahd_compile_devinfo(struct ahd_devinfo *devinfo,
u_int our_id, u_int target,
u_int lun, char channel,
......@@ -1450,14 +1400,6 @@ void ahd_compile_devinfo(struct ahd_devinfo *devinfo,
/************************** Transfer Negotiation ******************************/
void ahd_find_syncrate(struct ahd_softc *ahd, u_int *period,
u_int *ppr_options, u_int maxsync);
void ahd_validate_offset(struct ahd_softc *ahd,
struct ahd_initiator_tinfo *tinfo,
u_int period, u_int *offset,
int wide, role_t role);
void ahd_validate_width(struct ahd_softc *ahd,
struct ahd_initiator_tinfo *tinfo,
u_int *bus_width,
role_t role);
/*
* Negotiation types. These are used to qualify if we should renegotiate
* even if our goal and current transport parameters are identical.
......@@ -1486,11 +1428,6 @@ typedef enum {
AHD_QUEUE_TAGGED
} ahd_queue_alg;
void ahd_set_tags(struct ahd_softc *ahd,
struct scsi_cmnd *cmd,
struct ahd_devinfo *devinfo,
ahd_queue_alg alg);
/**************************** Target Mode *************************************/
#ifdef AHD_TARGET_MODE
void ahd_send_lstate_events(struct ahd_softc *,
......@@ -1528,10 +1465,8 @@ extern uint32_t ahd_debug;
#define AHD_SHOW_INT_COALESCING 0x10000
#define AHD_DEBUG_SEQUENCER 0x20000
#endif
void ahd_print_scb(struct scb *scb);
void ahd_print_devinfo(struct ahd_softc *ahd,
struct ahd_devinfo *devinfo);
void ahd_dump_sglist(struct scb *scb);
void ahd_dump_card_state(struct ahd_softc *ahd);
int ahd_print_register(ahd_reg_parse_entry_t *table,
u_int num_entries,
......@@ -1540,5 +1475,4 @@ int ahd_print_register(ahd_reg_parse_entry_t *table,
u_int value,
u_int *cur_column,
u_int wrap_point);
void ahd_dump_scbs(struct ahd_softc *ahd);
#endif /* _AIC79XX_H_ */
......@@ -52,7 +52,7 @@
/***************************** Lookup Tables **********************************/
char *ahd_chip_names[] =
static char *ahd_chip_names[] =
{
"NONE",
"aic7901",
......@@ -237,10 +237,33 @@ static int ahd_handle_target_cmd(struct ahd_softc *ahd,
struct target_cmd *cmd);
#endif
static int ahd_abort_scbs(struct ahd_softc *ahd, int target,
char channel, int lun, u_int tag,
role_t role, uint32_t status);
static void ahd_alloc_scbs(struct ahd_softc *ahd);
static void ahd_busy_tcl(struct ahd_softc *ahd, u_int tcl,
u_int scbid);
static void ahd_calc_residual(struct ahd_softc *ahd,
struct scb *scb);
static void ahd_clear_critical_section(struct ahd_softc *ahd);
static void ahd_clear_intstat(struct ahd_softc *ahd);
static void ahd_enable_coalescing(struct ahd_softc *ahd,
int enable);
static u_int ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl);
static void ahd_freeze_devq(struct ahd_softc *ahd,
struct scb *scb);
static void ahd_handle_scb_status(struct ahd_softc *ahd,
struct scb *scb);
static struct ahd_phase_table_entry* ahd_lookup_phase_entry(int phase);
static void ahd_shutdown(void *arg);
static void ahd_update_coalescing_values(struct ahd_softc *ahd,
u_int timer,
u_int maxcmds,
u_int mincmds);
static int ahd_verify_vpd_cksum(struct vpd_config *vpd);
static int ahd_wait_seeprom(struct ahd_softc *ahd);
/******************************** Private Inlines *****************************/
static __inline void ahd_assert_atn(struct ahd_softc *ahd);
static __inline int ahd_currently_packetized(struct ahd_softc *ahd);
static __inline int ahd_set_active_fifo(struct ahd_softc *ahd);
static __inline void
ahd_assert_atn(struct ahd_softc *ahd)
......@@ -294,11 +317,44 @@ ahd_set_active_fifo(struct ahd_softc *ahd)
}
}
static __inline void
ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl)
{
ahd_busy_tcl(ahd, tcl, SCB_LIST_NULL);
}
/*
* Determine whether the sequencer reported a residual
* for this SCB/transaction.
*/
static __inline void
ahd_update_residual(struct ahd_softc *ahd, struct scb *scb)
{
uint32_t sgptr;
sgptr = ahd_le32toh(scb->hscb->sgptr);
if ((sgptr & SG_STATUS_VALID) != 0)
ahd_calc_residual(ahd, scb);
}
static __inline void
ahd_complete_scb(struct ahd_softc *ahd, struct scb *scb)
{
uint32_t sgptr;
sgptr = ahd_le32toh(scb->hscb->sgptr);
if ((sgptr & SG_STATUS_VALID) != 0)
ahd_handle_scb_status(ahd, scb);
else
ahd_done(ahd, scb);
}
/************************* Sequencer Execution Control ************************/
/*
* Restart the sequencer program from address zero
*/
void
static void
ahd_restart(struct ahd_softc *ahd)
{
......@@ -342,7 +398,7 @@ ahd_restart(struct ahd_softc *ahd)
ahd_unpause(ahd);
}
void
static void
ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo)
{
ahd_mode_state saved_modes;
......@@ -366,7 +422,7 @@ ahd_clear_fifo(struct ahd_softc *ahd, u_int fifo)
* Flush and completed commands that are sitting in the command
* complete queues down on the chip but have yet to be dma'ed back up.
*/
void
static void
ahd_flush_qoutfifo(struct ahd_softc *ahd)
{
struct scb *scb;
......@@ -905,6 +961,51 @@ ahd_handle_hwerrint(struct ahd_softc *ahd)
ahd_free(ahd);
}
#ifdef AHD_DEBUG
static void
ahd_dump_sglist(struct scb *scb)
{
int i;
if (scb->sg_count > 0) {
if ((scb->ahd_softc->flags & AHD_64BIT_ADDRESSING) != 0) {
struct ahd_dma64_seg *sg_list;
sg_list = (struct ahd_dma64_seg*)scb->sg_list;
for (i = 0; i < scb->sg_count; i++) {
uint64_t addr;
uint32_t len;
addr = ahd_le64toh(sg_list[i].addr);
len = ahd_le32toh(sg_list[i].len);
printf("sg[%d] - Addr 0x%x%x : Length %d%s\n",
i,
(uint32_t)((addr >> 32) & 0xFFFFFFFF),
(uint32_t)(addr & 0xFFFFFFFF),
sg_list[i].len & AHD_SG_LEN_MASK,
(sg_list[i].len & AHD_DMA_LAST_SEG)
? " Last" : "");
}
} else {
struct ahd_dma_seg *sg_list;
sg_list = (struct ahd_dma_seg*)scb->sg_list;
for (i = 0; i < scb->sg_count; i++) {
uint32_t len;
len = ahd_le32toh(sg_list[i].len);
printf("sg[%d] - Addr 0x%x%x : Length %d%s\n",
i,
(len & AHD_SG_HIGH_ADDR_MASK) >> 24,
ahd_le32toh(sg_list[i].addr),
len & AHD_SG_LEN_MASK,
len & AHD_DMA_LAST_SEG ? " Last" : "");
}
}
}
}
#endif /* AHD_DEBUG */
void
ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
{
......@@ -1053,10 +1154,12 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
* If a target takes us into the command phase