[SCSI] aic7xxx: add static
This patch adds static (and sometimes const) keywords where appropriate. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Acked-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
parent
d10c2e4627
commit
d1d7b19d43
|
@ -1314,7 +1314,7 @@ typedef int (ahd_device_setup_t)(struct ahd_softc *);
|
||||||
struct ahd_pci_identity {
|
struct ahd_pci_identity {
|
||||||
uint64_t full_id;
|
uint64_t full_id;
|
||||||
uint64_t id_mask;
|
uint64_t id_mask;
|
||||||
char *name;
|
const char *name;
|
||||||
ahd_device_setup_t *setup;
|
ahd_device_setup_t *setup;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1322,7 +1322,7 @@ struct ahd_pci_identity {
|
||||||
struct aic7770_identity {
|
struct aic7770_identity {
|
||||||
uint32_t full_id;
|
uint32_t full_id;
|
||||||
uint32_t id_mask;
|
uint32_t id_mask;
|
||||||
char *name;
|
const char *name;
|
||||||
ahd_device_setup_t *setup;
|
ahd_device_setup_t *setup;
|
||||||
};
|
};
|
||||||
extern struct aic7770_identity aic7770_ident_table [];
|
extern struct aic7770_identity aic7770_ident_table [];
|
||||||
|
@ -1333,7 +1333,6 @@ extern const int ahd_num_aic7770_devs;
|
||||||
|
|
||||||
/*************************** Function Declarations ****************************/
|
/*************************** Function Declarations ****************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
void ahd_reset_cmds_pending(struct ahd_softc *ahd);
|
|
||||||
|
|
||||||
/***************************** PCI Front End *********************************/
|
/***************************** PCI Front End *********************************/
|
||||||
struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t);
|
struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t);
|
||||||
|
@ -1376,16 +1375,6 @@ int ahd_write_flexport(struct ahd_softc *ahd,
|
||||||
int ahd_read_flexport(struct ahd_softc *ahd, u_int addr,
|
int ahd_read_flexport(struct ahd_softc *ahd, u_int addr,
|
||||||
uint8_t *value);
|
uint8_t *value);
|
||||||
|
|
||||||
/*************************** Interrupt Services *******************************/
|
|
||||||
void ahd_run_qoutfifo(struct ahd_softc *ahd);
|
|
||||||
#ifdef AHD_TARGET_MODE
|
|
||||||
void ahd_run_tqinfifo(struct ahd_softc *ahd, int paused);
|
|
||||||
#endif
|
|
||||||
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);
|
|
||||||
|
|
||||||
/***************************** Error Recovery *********************************/
|
/***************************** Error Recovery *********************************/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SEARCH_COMPLETE,
|
SEARCH_COMPLETE,
|
||||||
|
@ -1479,7 +1468,7 @@ extern uint32_t ahd_debug;
|
||||||
void ahd_print_devinfo(struct ahd_softc *ahd,
|
void ahd_print_devinfo(struct ahd_softc *ahd,
|
||||||
struct ahd_devinfo *devinfo);
|
struct ahd_devinfo *devinfo);
|
||||||
void ahd_dump_card_state(struct ahd_softc *ahd);
|
void ahd_dump_card_state(struct ahd_softc *ahd);
|
||||||
int ahd_print_register(ahd_reg_parse_entry_t *table,
|
int ahd_print_register(const ahd_reg_parse_entry_t *table,
|
||||||
u_int num_entries,
|
u_int num_entries,
|
||||||
const char *name,
|
const char *name,
|
||||||
u_int address,
|
u_int address,
|
||||||
|
|
|
@ -266,6 +266,18 @@ static int ahd_match_scb(struct ahd_softc *ahd, struct scb *scb,
|
||||||
int target, char channel, int lun,
|
int target, char channel, int lun,
|
||||||
u_int tag, role_t role);
|
u_int tag, role_t role);
|
||||||
|
|
||||||
|
static void ahd_reset_cmds_pending(struct ahd_softc *ahd);
|
||||||
|
|
||||||
|
/*************************** Interrupt Services *******************************/
|
||||||
|
static void ahd_run_qoutfifo(struct ahd_softc *ahd);
|
||||||
|
#ifdef AHD_TARGET_MODE
|
||||||
|
static void ahd_run_tqinfifo(struct ahd_softc *ahd, int paused);
|
||||||
|
#endif
|
||||||
|
static void ahd_handle_hwerrint(struct ahd_softc *ahd);
|
||||||
|
static void ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat);
|
||||||
|
static void ahd_handle_scsiint(struct ahd_softc *ahd,
|
||||||
|
u_int intstat);
|
||||||
|
|
||||||
/************************ Sequencer Execution Control *************************/
|
/************************ Sequencer Execution Control *************************/
|
||||||
void
|
void
|
||||||
ahd_set_modes(struct ahd_softc *ahd, ahd_mode src, ahd_mode dst)
|
ahd_set_modes(struct ahd_softc *ahd, ahd_mode src, ahd_mode dst)
|
||||||
|
@ -285,7 +297,7 @@ ahd_set_modes(struct ahd_softc *ahd, ahd_mode src, ahd_mode dst)
|
||||||
ahd->dst_mode = dst;
|
ahd->dst_mode = dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_update_modes(struct ahd_softc *ahd)
|
ahd_update_modes(struct ahd_softc *ahd)
|
||||||
{
|
{
|
||||||
ahd_mode_state mode_ptr;
|
ahd_mode_state mode_ptr;
|
||||||
|
@ -301,7 +313,7 @@ ahd_update_modes(struct ahd_softc *ahd)
|
||||||
ahd_known_modes(ahd, src, dst);
|
ahd_known_modes(ahd, src, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_assert_modes(struct ahd_softc *ahd, ahd_mode srcmode,
|
ahd_assert_modes(struct ahd_softc *ahd, ahd_mode srcmode,
|
||||||
ahd_mode dstmode, const char *file, int line)
|
ahd_mode dstmode, const char *file, int line)
|
||||||
{
|
{
|
||||||
|
@ -422,7 +434,7 @@ ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_setup_scb_common(struct ahd_softc *ahd, struct scb *scb)
|
ahd_setup_scb_common(struct ahd_softc *ahd, struct scb *scb)
|
||||||
{
|
{
|
||||||
/* XXX Handle target mode SCBs. */
|
/* XXX Handle target mode SCBs. */
|
||||||
|
@ -443,7 +455,7 @@ ahd_setup_scb_common(struct ahd_softc *ahd, struct scb *scb)
|
||||||
ahd_htole32(scb->sense_busaddr);
|
ahd_htole32(scb->sense_busaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_setup_data_scb(struct ahd_softc *ahd, struct scb *scb)
|
ahd_setup_data_scb(struct ahd_softc *ahd, struct scb *scb)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -480,7 +492,7 @@ ahd_setup_data_scb(struct ahd_softc *ahd, struct scb *scb)
|
||||||
scb->hscb->sgptr = ahd_htole32(scb->sg_list_busaddr|SG_FULL_RESID);
|
scb->hscb->sgptr = ahd_htole32(scb->sg_list_busaddr|SG_FULL_RESID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_setup_noxfer_scb(struct ahd_softc *ahd, struct scb *scb)
|
ahd_setup_noxfer_scb(struct ahd_softc *ahd, struct scb *scb)
|
||||||
{
|
{
|
||||||
scb->hscb->sgptr = ahd_htole32(SG_LIST_NULL);
|
scb->hscb->sgptr = ahd_htole32(SG_LIST_NULL);
|
||||||
|
@ -489,7 +501,7 @@ ahd_setup_noxfer_scb(struct ahd_softc *ahd, struct scb *scb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************** Memory mapping routines ***************************/
|
/************************** Memory mapping routines ***************************/
|
||||||
void *
|
static void *
|
||||||
ahd_sg_bus_to_virt(struct ahd_softc *ahd, struct scb *scb, uint32_t sg_busaddr)
|
ahd_sg_bus_to_virt(struct ahd_softc *ahd, struct scb *scb, uint32_t sg_busaddr)
|
||||||
{
|
{
|
||||||
dma_addr_t sg_offset;
|
dma_addr_t sg_offset;
|
||||||
|
@ -499,7 +511,7 @@ ahd_sg_bus_to_virt(struct ahd_softc *ahd, struct scb *scb, uint32_t sg_busaddr)
|
||||||
return ((uint8_t *)scb->sg_list + sg_offset);
|
return ((uint8_t *)scb->sg_list + sg_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
static uint32_t
|
||||||
ahd_sg_virt_to_bus(struct ahd_softc *ahd, struct scb *scb, void *sg)
|
ahd_sg_virt_to_bus(struct ahd_softc *ahd, struct scb *scb, void *sg)
|
||||||
{
|
{
|
||||||
dma_addr_t sg_offset;
|
dma_addr_t sg_offset;
|
||||||
|
@ -511,7 +523,7 @@ ahd_sg_virt_to_bus(struct ahd_softc *ahd, struct scb *scb, void *sg)
|
||||||
return (scb->sg_list_busaddr + sg_offset);
|
return (scb->sg_list_busaddr + sg_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_sync_scb(struct ahd_softc *ahd, struct scb *scb, int op)
|
ahd_sync_scb(struct ahd_softc *ahd, struct scb *scb, int op)
|
||||||
{
|
{
|
||||||
ahd_dmamap_sync(ahd, ahd->scb_data.hscb_dmat,
|
ahd_dmamap_sync(ahd, ahd->scb_data.hscb_dmat,
|
||||||
|
@ -532,7 +544,7 @@ ahd_sync_sglist(struct ahd_softc *ahd, struct scb *scb, int op)
|
||||||
/*len*/ahd_sg_size(ahd) * scb->sg_count, op);
|
/*len*/ahd_sg_size(ahd) * scb->sg_count, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_sync_sense(struct ahd_softc *ahd, struct scb *scb, int op)
|
ahd_sync_sense(struct ahd_softc *ahd, struct scb *scb, int op)
|
||||||
{
|
{
|
||||||
ahd_dmamap_sync(ahd, ahd->scb_data.sense_dmat,
|
ahd_dmamap_sync(ahd, ahd->scb_data.sense_dmat,
|
||||||
|
@ -541,12 +553,14 @@ ahd_sync_sense(struct ahd_softc *ahd, struct scb *scb, int op)
|
||||||
/*len*/AHD_SENSE_BUFSIZE, op);
|
/*len*/AHD_SENSE_BUFSIZE, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
#ifdef AHD_TARGET_MODE
|
||||||
|
static uint32_t
|
||||||
ahd_targetcmd_offset(struct ahd_softc *ahd, u_int index)
|
ahd_targetcmd_offset(struct ahd_softc *ahd, u_int index)
|
||||||
{
|
{
|
||||||
return (((uint8_t *)&ahd->targetcmds[index])
|
return (((uint8_t *)&ahd->targetcmds[index])
|
||||||
- (uint8_t *)ahd->qoutfifo);
|
- (uint8_t *)ahd->qoutfifo);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*********************** Miscelaneous Support Functions ***********************/
|
/*********************** Miscelaneous Support Functions ***********************/
|
||||||
/*
|
/*
|
||||||
|
@ -653,31 +667,35 @@ ahd_set_scbptr(struct ahd_softc *ahd, u_int scbptr)
|
||||||
ahd_outb(ahd, SCBPTR+1, (scbptr >> 8) & 0xFF);
|
ahd_outb(ahd, SCBPTR+1, (scbptr >> 8) & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int
|
#if 0 /* unused */
|
||||||
|
static u_int
|
||||||
ahd_get_hnscb_qoff(struct ahd_softc *ahd)
|
ahd_get_hnscb_qoff(struct ahd_softc *ahd)
|
||||||
{
|
{
|
||||||
return (ahd_inw_atomic(ahd, HNSCB_QOFF));
|
return (ahd_inw_atomic(ahd, HNSCB_QOFF));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_set_hnscb_qoff(struct ahd_softc *ahd, u_int value)
|
ahd_set_hnscb_qoff(struct ahd_softc *ahd, u_int value)
|
||||||
{
|
{
|
||||||
ahd_outw_atomic(ahd, HNSCB_QOFF, value);
|
ahd_outw_atomic(ahd, HNSCB_QOFF, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int
|
#if 0 /* unused */
|
||||||
|
static u_int
|
||||||
ahd_get_hescb_qoff(struct ahd_softc *ahd)
|
ahd_get_hescb_qoff(struct ahd_softc *ahd)
|
||||||
{
|
{
|
||||||
return (ahd_inb(ahd, HESCB_QOFF));
|
return (ahd_inb(ahd, HESCB_QOFF));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_set_hescb_qoff(struct ahd_softc *ahd, u_int value)
|
ahd_set_hescb_qoff(struct ahd_softc *ahd, u_int value)
|
||||||
{
|
{
|
||||||
ahd_outb(ahd, HESCB_QOFF, value);
|
ahd_outb(ahd, HESCB_QOFF, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int
|
static u_int
|
||||||
ahd_get_snscb_qoff(struct ahd_softc *ahd)
|
ahd_get_snscb_qoff(struct ahd_softc *ahd)
|
||||||
{
|
{
|
||||||
u_int oldvalue;
|
u_int oldvalue;
|
||||||
|
@ -688,35 +706,39 @@ ahd_get_snscb_qoff(struct ahd_softc *ahd)
|
||||||
return (oldvalue);
|
return (oldvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_set_snscb_qoff(struct ahd_softc *ahd, u_int value)
|
ahd_set_snscb_qoff(struct ahd_softc *ahd, u_int value)
|
||||||
{
|
{
|
||||||
AHD_ASSERT_MODES(ahd, AHD_MODE_CCHAN_MSK, AHD_MODE_CCHAN_MSK);
|
AHD_ASSERT_MODES(ahd, AHD_MODE_CCHAN_MSK, AHD_MODE_CCHAN_MSK);
|
||||||
ahd_outw(ahd, SNSCB_QOFF, value);
|
ahd_outw(ahd, SNSCB_QOFF, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int
|
#if 0 /* unused */
|
||||||
|
static u_int
|
||||||
ahd_get_sescb_qoff(struct ahd_softc *ahd)
|
ahd_get_sescb_qoff(struct ahd_softc *ahd)
|
||||||
{
|
{
|
||||||
AHD_ASSERT_MODES(ahd, AHD_MODE_CCHAN_MSK, AHD_MODE_CCHAN_MSK);
|
AHD_ASSERT_MODES(ahd, AHD_MODE_CCHAN_MSK, AHD_MODE_CCHAN_MSK);
|
||||||
return (ahd_inb(ahd, SESCB_QOFF));
|
return (ahd_inb(ahd, SESCB_QOFF));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_set_sescb_qoff(struct ahd_softc *ahd, u_int value)
|
ahd_set_sescb_qoff(struct ahd_softc *ahd, u_int value)
|
||||||
{
|
{
|
||||||
AHD_ASSERT_MODES(ahd, AHD_MODE_CCHAN_MSK, AHD_MODE_CCHAN_MSK);
|
AHD_ASSERT_MODES(ahd, AHD_MODE_CCHAN_MSK, AHD_MODE_CCHAN_MSK);
|
||||||
ahd_outb(ahd, SESCB_QOFF, value);
|
ahd_outb(ahd, SESCB_QOFF, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int
|
#if 0 /* unused */
|
||||||
|
static u_int
|
||||||
ahd_get_sdscb_qoff(struct ahd_softc *ahd)
|
ahd_get_sdscb_qoff(struct ahd_softc *ahd)
|
||||||
{
|
{
|
||||||
AHD_ASSERT_MODES(ahd, AHD_MODE_CCHAN_MSK, AHD_MODE_CCHAN_MSK);
|
AHD_ASSERT_MODES(ahd, AHD_MODE_CCHAN_MSK, AHD_MODE_CCHAN_MSK);
|
||||||
return (ahd_inb(ahd, SDSCB_QOFF) | (ahd_inb(ahd, SDSCB_QOFF + 1) << 8));
|
return (ahd_inb(ahd, SDSCB_QOFF) | (ahd_inb(ahd, SDSCB_QOFF + 1) << 8));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_set_sdscb_qoff(struct ahd_softc *ahd, u_int value)
|
ahd_set_sdscb_qoff(struct ahd_softc *ahd, u_int value)
|
||||||
{
|
{
|
||||||
AHD_ASSERT_MODES(ahd, AHD_MODE_CCHAN_MSK, AHD_MODE_CCHAN_MSK);
|
AHD_ASSERT_MODES(ahd, AHD_MODE_CCHAN_MSK, AHD_MODE_CCHAN_MSK);
|
||||||
|
@ -756,14 +778,14 @@ ahd_inw_scbram(struct ahd_softc *ahd, u_int offset)
|
||||||
| (ahd_inb_scbram(ahd, offset+1) << 8));
|
| (ahd_inb_scbram(ahd, offset+1) << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
static uint32_t
|
||||||
ahd_inl_scbram(struct ahd_softc *ahd, u_int offset)
|
ahd_inl_scbram(struct ahd_softc *ahd, u_int offset)
|
||||||
{
|
{
|
||||||
return (ahd_inw_scbram(ahd, offset)
|
return (ahd_inw_scbram(ahd, offset)
|
||||||
| (ahd_inw_scbram(ahd, offset+2) << 16));
|
| (ahd_inw_scbram(ahd, offset+2) << 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
static uint64_t
|
||||||
ahd_inq_scbram(struct ahd_softc *ahd, u_int offset)
|
ahd_inq_scbram(struct ahd_softc *ahd, u_int offset)
|
||||||
{
|
{
|
||||||
return (ahd_inl_scbram(ahd, offset)
|
return (ahd_inl_scbram(ahd, offset)
|
||||||
|
@ -784,7 +806,7 @@ ahd_lookup_scb(struct ahd_softc *ahd, u_int tag)
|
||||||
return (scb);
|
return (scb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_swap_with_next_hscb(struct ahd_softc *ahd, struct scb *scb)
|
ahd_swap_with_next_hscb(struct ahd_softc *ahd, struct scb *scb)
|
||||||
{
|
{
|
||||||
struct hardware_scb *q_hscb;
|
struct hardware_scb *q_hscb;
|
||||||
|
@ -869,7 +891,7 @@ ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************** Interrupt Processing ******************************/
|
/************************** Interrupt Processing ******************************/
|
||||||
void
|
static void
|
||||||
ahd_sync_qoutfifo(struct ahd_softc *ahd, int op)
|
ahd_sync_qoutfifo(struct ahd_softc *ahd, int op)
|
||||||
{
|
{
|
||||||
ahd_dmamap_sync(ahd, ahd->shared_data_dmat, ahd->shared_data_map.dmamap,
|
ahd_dmamap_sync(ahd, ahd->shared_data_dmat, ahd->shared_data_map.dmamap,
|
||||||
|
@ -877,7 +899,7 @@ ahd_sync_qoutfifo(struct ahd_softc *ahd, int op)
|
||||||
/*len*/AHD_SCB_MAX * sizeof(struct ahd_completion), op);
|
/*len*/AHD_SCB_MAX * sizeof(struct ahd_completion), op);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_sync_tqinfifo(struct ahd_softc *ahd, int op)
|
ahd_sync_tqinfifo(struct ahd_softc *ahd, int op)
|
||||||
{
|
{
|
||||||
#ifdef AHD_TARGET_MODE
|
#ifdef AHD_TARGET_MODE
|
||||||
|
@ -897,7 +919,7 @@ ahd_sync_tqinfifo(struct ahd_softc *ahd, int op)
|
||||||
*/
|
*/
|
||||||
#define AHD_RUN_QOUTFIFO 0x1
|
#define AHD_RUN_QOUTFIFO 0x1
|
||||||
#define AHD_RUN_TQINFIFO 0x2
|
#define AHD_RUN_TQINFIFO 0x2
|
||||||
u_int
|
static u_int
|
||||||
ahd_check_cmdcmpltqueues(struct ahd_softc *ahd)
|
ahd_check_cmdcmpltqueues(struct ahd_softc *ahd)
|
||||||
{
|
{
|
||||||
u_int retval;
|
u_int retval;
|
||||||
|
@ -1640,7 +1662,7 @@ clrchn:
|
||||||
* a copy of the first byte (little endian) of the sgptr
|
* a copy of the first byte (little endian) of the sgptr
|
||||||
* hscb field.
|
* hscb field.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
ahd_run_qoutfifo(struct ahd_softc *ahd)
|
ahd_run_qoutfifo(struct ahd_softc *ahd)
|
||||||
{
|
{
|
||||||
struct ahd_completion *completion;
|
struct ahd_completion *completion;
|
||||||
|
@ -1679,7 +1701,7 @@ ahd_run_qoutfifo(struct ahd_softc *ahd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************* Interrupt Handling *********************************/
|
/************************* Interrupt Handling *********************************/
|
||||||
void
|
static void
|
||||||
ahd_handle_hwerrint(struct ahd_softc *ahd)
|
ahd_handle_hwerrint(struct ahd_softc *ahd)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1753,7 +1775,7 @@ ahd_dump_sglist(struct scb *scb)
|
||||||
}
|
}
|
||||||
#endif /* AHD_DEBUG */
|
#endif /* AHD_DEBUG */
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
|
ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
|
||||||
{
|
{
|
||||||
u_int seqintcode;
|
u_int seqintcode;
|
||||||
|
@ -2365,7 +2387,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
|
||||||
ahd_unpause(ahd);
|
ahd_unpause(ahd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat)
|
ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat)
|
||||||
{
|
{
|
||||||
struct scb *scb;
|
struct scb *scb;
|
||||||
|
@ -8131,7 +8153,7 @@ ahd_qinfifo_count(struct ahd_softc *ahd)
|
||||||
+ ARRAY_SIZE(ahd->qinfifo) - wrap_qinpos);
|
+ ARRAY_SIZE(ahd->qinfifo) - wrap_qinpos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_reset_cmds_pending(struct ahd_softc *ahd)
|
ahd_reset_cmds_pending(struct ahd_softc *ahd)
|
||||||
{
|
{
|
||||||
struct scb *scb;
|
struct scb *scb;
|
||||||
|
@ -9656,7 +9678,7 @@ sized:
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ahd_print_register(ahd_reg_parse_entry_t *table, u_int num_entries,
|
ahd_print_register(const ahd_reg_parse_entry_t *table, u_int num_entries,
|
||||||
const char *name, u_int address, u_int value,
|
const char *name, u_int address, u_int value,
|
||||||
u_int *cur_column, u_int wrap_point)
|
u_int *cur_column, u_int wrap_point)
|
||||||
{
|
{
|
||||||
|
@ -10647,7 +10669,7 @@ ahd_update_scsiid(struct ahd_softc *ahd, u_int targid_mask)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahd_run_tqinfifo(struct ahd_softc *ahd, int paused)
|
ahd_run_tqinfifo(struct ahd_softc *ahd, int paused)
|
||||||
{
|
{
|
||||||
struct target_cmd *cmd;
|
struct target_cmd *cmd;
|
||||||
|
|
|
@ -66,10 +66,6 @@ static __inline void ahd_extract_mode_state(struct ahd_softc *ahd,
|
||||||
|
|
||||||
void ahd_set_modes(struct ahd_softc *ahd, ahd_mode src,
|
void ahd_set_modes(struct ahd_softc *ahd, ahd_mode src,
|
||||||
ahd_mode dst);
|
ahd_mode dst);
|
||||||
void ahd_update_modes(struct ahd_softc *ahd);
|
|
||||||
void ahd_assert_modes(struct ahd_softc *ahd, ahd_mode srcmode,
|
|
||||||
ahd_mode dstmode, const char *file,
|
|
||||||
int line);
|
|
||||||
ahd_mode_state ahd_save_modes(struct ahd_softc *ahd);
|
ahd_mode_state ahd_save_modes(struct ahd_softc *ahd);
|
||||||
void ahd_restore_modes(struct ahd_softc *ahd,
|
void ahd_restore_modes(struct ahd_softc *ahd,
|
||||||
ahd_mode_state state);
|
ahd_mode_state state);
|
||||||
|
@ -104,33 +100,12 @@ ahd_extract_mode_state(struct ahd_softc *ahd, ahd_mode_state state,
|
||||||
void *ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb,
|
void *ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb,
|
||||||
void *sgptr, dma_addr_t addr,
|
void *sgptr, dma_addr_t addr,
|
||||||
bus_size_t len, int last);
|
bus_size_t len, int last);
|
||||||
void ahd_setup_scb_common(struct ahd_softc *ahd,
|
|
||||||
struct scb *scb);
|
|
||||||
void ahd_setup_data_scb(struct ahd_softc *ahd,
|
|
||||||
struct scb *scb);
|
|
||||||
void ahd_setup_noxfer_scb(struct ahd_softc *ahd,
|
|
||||||
struct scb *scb);
|
|
||||||
|
|
||||||
/************************** Memory mapping routines ***************************/
|
/************************** Memory mapping routines ***************************/
|
||||||
static __inline size_t ahd_sg_size(struct ahd_softc *ahd);
|
static __inline size_t ahd_sg_size(struct ahd_softc *ahd);
|
||||||
|
|
||||||
void *
|
|
||||||
ahd_sg_bus_to_virt(struct ahd_softc *ahd,
|
|
||||||
struct scb *scb,
|
|
||||||
uint32_t sg_busaddr);
|
|
||||||
uint32_t
|
|
||||||
ahd_sg_virt_to_bus(struct ahd_softc *ahd,
|
|
||||||
struct scb *scb,
|
|
||||||
void *sg);
|
|
||||||
void ahd_sync_scb(struct ahd_softc *ahd,
|
|
||||||
struct scb *scb, int op);
|
|
||||||
void ahd_sync_sglist(struct ahd_softc *ahd,
|
void ahd_sync_sglist(struct ahd_softc *ahd,
|
||||||
struct scb *scb, int op);
|
struct scb *scb, int op);
|
||||||
void ahd_sync_sense(struct ahd_softc *ahd,
|
|
||||||
struct scb *scb, int op);
|
|
||||||
uint32_t
|
|
||||||
ahd_targetcmd_offset(struct ahd_softc *ahd,
|
|
||||||
u_int index);
|
|
||||||
|
|
||||||
static __inline size_t
|
static __inline size_t
|
||||||
ahd_sg_size(struct ahd_softc *ahd)
|
ahd_sg_size(struct ahd_softc *ahd)
|
||||||
|
@ -160,26 +135,10 @@ void ahd_outq(struct ahd_softc *ahd, u_int port,
|
||||||
uint64_t value);
|
uint64_t value);
|
||||||
u_int ahd_get_scbptr(struct ahd_softc *ahd);
|
u_int ahd_get_scbptr(struct ahd_softc *ahd);
|
||||||
void ahd_set_scbptr(struct ahd_softc *ahd, u_int scbptr);
|
void ahd_set_scbptr(struct ahd_softc *ahd, u_int scbptr);
|
||||||
u_int ahd_get_hnscb_qoff(struct ahd_softc *ahd);
|
|
||||||
void ahd_set_hnscb_qoff(struct ahd_softc *ahd, u_int value);
|
|
||||||
u_int ahd_get_hescb_qoff(struct ahd_softc *ahd);
|
|
||||||
void ahd_set_hescb_qoff(struct ahd_softc *ahd, u_int value);
|
|
||||||
u_int ahd_get_snscb_qoff(struct ahd_softc *ahd);
|
|
||||||
void ahd_set_snscb_qoff(struct ahd_softc *ahd, u_int value);
|
|
||||||
u_int ahd_get_sescb_qoff(struct ahd_softc *ahd);
|
|
||||||
void ahd_set_sescb_qoff(struct ahd_softc *ahd, u_int value);
|
|
||||||
u_int ahd_get_sdscb_qoff(struct ahd_softc *ahd);
|
|
||||||
void ahd_set_sdscb_qoff(struct ahd_softc *ahd, u_int value);
|
|
||||||
u_int ahd_inb_scbram(struct ahd_softc *ahd, u_int offset);
|
u_int ahd_inb_scbram(struct ahd_softc *ahd, u_int offset);
|
||||||
u_int ahd_inw_scbram(struct ahd_softc *ahd, u_int offset);
|
u_int ahd_inw_scbram(struct ahd_softc *ahd, u_int offset);
|
||||||
uint32_t
|
|
||||||
ahd_inl_scbram(struct ahd_softc *ahd, u_int offset);
|
|
||||||
uint64_t
|
|
||||||
ahd_inq_scbram(struct ahd_softc *ahd, u_int offset);
|
|
||||||
struct scb *
|
struct scb *
|
||||||
ahd_lookup_scb(struct ahd_softc *ahd, u_int tag);
|
ahd_lookup_scb(struct ahd_softc *ahd, u_int tag);
|
||||||
void ahd_swap_with_next_hscb(struct ahd_softc *ahd,
|
|
||||||
struct scb *scb);
|
|
||||||
void ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb);
|
void ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb);
|
||||||
|
|
||||||
static __inline uint8_t *
|
static __inline uint8_t *
|
||||||
|
@ -212,9 +171,6 @@ ahd_get_sense_bufaddr(struct ahd_softc *ahd, struct scb *scb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************** Interrupt Processing ******************************/
|
/************************** Interrupt Processing ******************************/
|
||||||
void ahd_sync_qoutfifo(struct ahd_softc *ahd, int op);
|
|
||||||
void ahd_sync_tqinfifo(struct ahd_softc *ahd, int op);
|
|
||||||
u_int ahd_check_cmdcmpltqueues(struct ahd_softc *ahd);
|
|
||||||
int ahd_intr(struct ahd_softc *ahd);
|
int ahd_intr(struct ahd_softc *ahd);
|
||||||
|
|
||||||
#endif /* _AIC79XX_INLINE_H_ */
|
#endif /* _AIC79XX_INLINE_H_ */
|
||||||
|
|
|
@ -388,7 +388,6 @@ ahd_delay(long usec)
|
||||||
|
|
||||||
/***************************** Low Level I/O **********************************/
|
/***************************** Low Level I/O **********************************/
|
||||||
uint8_t ahd_inb(struct ahd_softc * ahd, long port);
|
uint8_t ahd_inb(struct ahd_softc * ahd, long port);
|
||||||
uint16_t ahd_inw_atomic(struct ahd_softc * ahd, long port);
|
|
||||||
void ahd_outb(struct ahd_softc * ahd, long port, uint8_t val);
|
void ahd_outb(struct ahd_softc * ahd, long port, uint8_t val);
|
||||||
void ahd_outw_atomic(struct ahd_softc * ahd,
|
void ahd_outw_atomic(struct ahd_softc * ahd,
|
||||||
long port, uint16_t val);
|
long port, uint16_t val);
|
||||||
|
@ -411,7 +410,8 @@ ahd_inb(struct ahd_softc * ahd, long port)
|
||||||
return (x);
|
return (x);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t
|
#if 0 /* unused */
|
||||||
|
static uint16_t
|
||||||
ahd_inw_atomic(struct ahd_softc * ahd, long port)
|
ahd_inw_atomic(struct ahd_softc * ahd, long port)
|
||||||
{
|
{
|
||||||
uint8_t x;
|
uint8_t x;
|
||||||
|
@ -424,6 +424,7 @@ ahd_inw_atomic(struct ahd_softc * ahd, long port)
|
||||||
mb();
|
mb();
|
||||||
return (x);
|
return (x);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
ahd_outb(struct ahd_softc * ahd, long port, uint8_t val)
|
ahd_outb(struct ahd_softc * ahd, long port, uint8_t val)
|
||||||
|
|
|
@ -374,7 +374,6 @@ void ahd_delay(long);
|
||||||
|
|
||||||
/***************************** Low Level I/O **********************************/
|
/***************************** Low Level I/O **********************************/
|
||||||
uint8_t ahd_inb(struct ahd_softc * ahd, long port);
|
uint8_t ahd_inb(struct ahd_softc * ahd, long port);
|
||||||
uint16_t ahd_inw_atomic(struct ahd_softc * ahd, long port);
|
|
||||||
void ahd_outb(struct ahd_softc * ahd, long port, uint8_t val);
|
void ahd_outb(struct ahd_softc * ahd, long port, uint8_t val);
|
||||||
void ahd_outw_atomic(struct ahd_softc * ahd,
|
void ahd_outw_atomic(struct ahd_softc * ahd,
|
||||||
long port, uint16_t val);
|
long port, uint16_t val);
|
||||||
|
|
|
@ -97,7 +97,7 @@ static ahd_device_setup_t ahd_aic7901A_setup;
|
||||||
static ahd_device_setup_t ahd_aic7902_setup;
|
static ahd_device_setup_t ahd_aic7902_setup;
|
||||||
static ahd_device_setup_t ahd_aic790X_setup;
|
static ahd_device_setup_t ahd_aic790X_setup;
|
||||||
|
|
||||||
static struct ahd_pci_identity ahd_pci_ident_table [] =
|
static struct ahd_pci_identity ahd_pci_ident_table[] =
|
||||||
{
|
{
|
||||||
/* aic7901 based controllers */
|
/* aic7901 based controllers */
|
||||||
{
|
{
|
||||||
|
|
|
@ -736,7 +736,7 @@ struct ahc_syncrate {
|
||||||
#define ST_SXFR 0x010 /* Rate Single Transition Only */
|
#define ST_SXFR 0x010 /* Rate Single Transition Only */
|
||||||
#define DT_SXFR 0x040 /* Rate Double Transition Only */
|
#define DT_SXFR 0x040 /* Rate Double Transition Only */
|
||||||
uint8_t period; /* Period to send to SCSI target */
|
uint8_t period; /* Period to send to SCSI target */
|
||||||
char *rate;
|
const char *rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Safe and valid period for async negotiations. */
|
/* Safe and valid period for async negotiations. */
|
||||||
|
@ -1133,10 +1133,6 @@ extern const int ahc_num_aic7770_devs;
|
||||||
|
|
||||||
/*************************** Function Declarations ****************************/
|
/*************************** Function Declarations ****************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
u_int ahc_index_busy_tcl(struct ahc_softc *ahc, u_int tcl);
|
|
||||||
void ahc_unbusy_tcl(struct ahc_softc *ahc, u_int tcl);
|
|
||||||
void ahc_busy_tcl(struct ahc_softc *ahc,
|
|
||||||
u_int tcl, u_int busyid);
|
|
||||||
|
|
||||||
/***************************** PCI Front End *********************************/
|
/***************************** PCI Front End *********************************/
|
||||||
struct ahc_pci_identity *ahc_find_pci_device(ahc_dev_softc_t);
|
struct ahc_pci_identity *ahc_find_pci_device(ahc_dev_softc_t);
|
||||||
|
@ -1155,9 +1151,6 @@ int aic7770_config(struct ahc_softc *ahc,
|
||||||
|
|
||||||
/************************** SCB and SCB queue management **********************/
|
/************************** SCB and SCB queue management **********************/
|
||||||
int ahc_probe_scbs(struct ahc_softc *);
|
int ahc_probe_scbs(struct ahc_softc *);
|
||||||
void ahc_run_untagged_queues(struct ahc_softc *ahc);
|
|
||||||
void ahc_run_untagged_queue(struct ahc_softc *ahc,
|
|
||||||
struct scb_tailq *queue);
|
|
||||||
void ahc_qinfifo_requeue_tail(struct ahc_softc *ahc,
|
void ahc_qinfifo_requeue_tail(struct ahc_softc *ahc,
|
||||||
struct scb *scb);
|
struct scb *scb);
|
||||||
int ahc_match_scb(struct ahc_softc *ahc, struct scb *scb,
|
int ahc_match_scb(struct ahc_softc *ahc, struct scb *scb,
|
||||||
|
@ -1178,22 +1171,8 @@ int ahc_resume(struct ahc_softc *ahc);
|
||||||
#endif
|
#endif
|
||||||
void ahc_set_unit(struct ahc_softc *, int);
|
void ahc_set_unit(struct ahc_softc *, int);
|
||||||
void ahc_set_name(struct ahc_softc *, char *);
|
void ahc_set_name(struct ahc_softc *, char *);
|
||||||
void ahc_alloc_scbs(struct ahc_softc *ahc);
|
|
||||||
void ahc_free(struct ahc_softc *ahc);
|
void ahc_free(struct ahc_softc *ahc);
|
||||||
int ahc_reset(struct ahc_softc *ahc, int reinit);
|
int ahc_reset(struct ahc_softc *ahc, int reinit);
|
||||||
void ahc_shutdown(void *arg);
|
|
||||||
|
|
||||||
/*************************** Interrupt Services *******************************/
|
|
||||||
void ahc_clear_intstat(struct ahc_softc *ahc);
|
|
||||||
void ahc_run_qoutfifo(struct ahc_softc *ahc);
|
|
||||||
#ifdef AHC_TARGET_MODE
|
|
||||||
void ahc_run_tqinfifo(struct ahc_softc *ahc, int paused);
|
|
||||||
#endif
|
|
||||||
void ahc_handle_brkadrint(struct ahc_softc *ahc);
|
|
||||||
void ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat);
|
|
||||||
void ahc_handle_scsiint(struct ahc_softc *ahc,
|
|
||||||
u_int intstat);
|
|
||||||
void ahc_clear_critical_section(struct ahc_softc *ahc);
|
|
||||||
|
|
||||||
/***************************** Error Recovery *********************************/
|
/***************************** Error Recovery *********************************/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -1214,36 +1193,19 @@ int ahc_search_disc_list(struct ahc_softc *ahc, int target,
|
||||||
char channel, int lun, u_int tag,
|
char channel, int lun, u_int tag,
|
||||||
int stop_on_first, int remove,
|
int stop_on_first, int remove,
|
||||||
int save_state);
|
int save_state);
|
||||||
void ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb);
|
|
||||||
int ahc_reset_channel(struct ahc_softc *ahc, char channel,
|
int ahc_reset_channel(struct ahc_softc *ahc, char channel,
|
||||||
int initiate_reset);
|
int initiate_reset);
|
||||||
int ahc_abort_scbs(struct ahc_softc *ahc, int target,
|
|
||||||
char channel, int lun, u_int tag,
|
|
||||||
role_t role, uint32_t status);
|
|
||||||
void ahc_restart(struct ahc_softc *ahc);
|
|
||||||
void ahc_calc_residual(struct ahc_softc *ahc,
|
|
||||||
struct scb *scb);
|
|
||||||
/*************************** Utility Functions ********************************/
|
/*************************** Utility Functions ********************************/
|
||||||
struct ahc_phase_table_entry*
|
|
||||||
ahc_lookup_phase_entry(int phase);
|
|
||||||
void ahc_compile_devinfo(struct ahc_devinfo *devinfo,
|
void ahc_compile_devinfo(struct ahc_devinfo *devinfo,
|
||||||
u_int our_id, u_int target,
|
u_int our_id, u_int target,
|
||||||
u_int lun, char channel,
|
u_int lun, char channel,
|
||||||
role_t role);
|
role_t role);
|
||||||
/************************** Transfer Negotiation ******************************/
|
/************************** Transfer Negotiation ******************************/
|
||||||
struct ahc_syncrate* ahc_find_syncrate(struct ahc_softc *ahc, u_int *period,
|
const struct ahc_syncrate* ahc_find_syncrate(struct ahc_softc *ahc, u_int *period,
|
||||||
u_int *ppr_options, u_int maxsync);
|
u_int *ppr_options, u_int maxsync);
|
||||||
u_int ahc_find_period(struct ahc_softc *ahc,
|
u_int ahc_find_period(struct ahc_softc *ahc,
|
||||||
u_int scsirate, u_int maxsync);
|
u_int scsirate, u_int maxsync);
|
||||||
void ahc_validate_offset(struct ahc_softc *ahc,
|
|
||||||
struct ahc_initiator_tinfo *tinfo,
|
|
||||||
struct ahc_syncrate *syncrate,
|
|
||||||
u_int *offset, int wide,
|
|
||||||
role_t role);
|
|
||||||
void ahc_validate_width(struct ahc_softc *ahc,
|
|
||||||
struct ahc_initiator_tinfo *tinfo,
|
|
||||||
u_int *bus_width,
|
|
||||||
role_t role);
|
|
||||||
/*
|
/*
|
||||||
* Negotiation types. These are used to qualify if we should renegotiate
|
* Negotiation types. These are used to qualify if we should renegotiate
|
||||||
* even if our goal and current transport parameters are identical.
|
* even if our goal and current transport parameters are identical.
|
||||||
|
@ -1263,7 +1225,7 @@ void ahc_set_width(struct ahc_softc *ahc,
|
||||||
u_int width, u_int type, int paused);
|
u_int width, u_int type, int paused);
|
||||||
void ahc_set_syncrate(struct ahc_softc *ahc,
|
void ahc_set_syncrate(struct ahc_softc *ahc,
|
||||||
struct ahc_devinfo *devinfo,
|
struct ahc_devinfo *devinfo,
|
||||||
struct ahc_syncrate *syncrate,
|
const struct ahc_syncrate *syncrate,
|
||||||
u_int period, u_int offset,
|
u_int period, u_int offset,
|
||||||
u_int ppr_options,
|
u_int ppr_options,
|
||||||
u_int type, int paused);
|
u_int type, int paused);
|
||||||
|
@ -1305,11 +1267,10 @@ extern uint32_t ahc_debug;
|
||||||
#define AHC_SHOW_MASKED_ERRORS 0x1000
|
#define AHC_SHOW_MASKED_ERRORS 0x1000
|
||||||
#define AHC_DEBUG_SEQUENCER 0x2000
|
#define AHC_DEBUG_SEQUENCER 0x2000
|
||||||
#endif
|
#endif
|
||||||
void ahc_print_scb(struct scb *scb);
|
|
||||||
void ahc_print_devinfo(struct ahc_softc *ahc,
|
void ahc_print_devinfo(struct ahc_softc *ahc,
|
||||||
struct ahc_devinfo *dev);
|
struct ahc_devinfo *dev);
|
||||||
void ahc_dump_card_state(struct ahc_softc *ahc);
|
void ahc_dump_card_state(struct ahc_softc *ahc);
|
||||||
int ahc_print_register(ahc_reg_parse_entry_t *table,
|
int ahc_print_register(const ahc_reg_parse_entry_t *table,
|
||||||
u_int num_entries,
|
u_int num_entries,
|
||||||
const char *name,
|
const char *name,
|
||||||
u_int address,
|
u_int address,
|
||||||
|
|
|
@ -51,8 +51,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************************** Lookup Tables **********************************/
|
/***************************** Lookup Tables **********************************/
|
||||||
char *ahc_chip_names[] =
|
static const char *const ahc_chip_names[] = {
|
||||||
{
|
|
||||||
"NONE",
|
"NONE",
|
||||||
"aic7770",
|
"aic7770",
|
||||||
"aic7850",
|
"aic7850",
|
||||||
|
@ -75,10 +74,10 @@ static const u_int num_chip_names = ARRAY_SIZE(ahc_chip_names);
|
||||||
*/
|
*/
|
||||||
struct ahc_hard_error_entry {
|
struct ahc_hard_error_entry {
|
||||||
uint8_t errno;
|
uint8_t errno;
|
||||||
char *errmesg;
|
const char *errmesg;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct ahc_hard_error_entry ahc_hard_errors[] = {
|
static const struct ahc_hard_error_entry ahc_hard_errors[] = {
|
||||||
{ ILLHADDR, "Illegal Host Access" },
|
{ ILLHADDR, "Illegal Host Access" },
|
||||||
{ ILLSADDR, "Illegal Sequencer Address referrenced" },
|
{ ILLSADDR, "Illegal Sequencer Address referrenced" },
|
||||||
{ ILLOPCODE, "Illegal Opcode in sequencer program" },
|
{ ILLOPCODE, "Illegal Opcode in sequencer program" },
|
||||||
|
@ -90,7 +89,7 @@ static struct ahc_hard_error_entry ahc_hard_errors[] = {
|
||||||
};
|
};
|
||||||
static const u_int num_errors = ARRAY_SIZE(ahc_hard_errors);
|
static const u_int num_errors = ARRAY_SIZE(ahc_hard_errors);
|
||||||
|
|
||||||
static struct ahc_phase_table_entry ahc_phase_table[] =
|
static const struct ahc_phase_table_entry ahc_phase_table[] =
|
||||||
{
|
{
|
||||||
{ P_DATAOUT, MSG_NOOP, "in Data-out phase" },
|
{ P_DATAOUT, MSG_NOOP, "in Data-out phase" },
|
||||||
{ P_DATAIN, MSG_INITIATOR_DET_ERR, "in Data-in phase" },
|
{ P_DATAIN, MSG_INITIATOR_DET_ERR, "in Data-in phase" },
|
||||||
|
@ -115,7 +114,7 @@ static const u_int num_phases = ARRAY_SIZE(ahc_phase_table) - 1;
|
||||||
* Provides a mapping of tranfer periods in ns to the proper value to
|
* Provides a mapping of tranfer periods in ns to the proper value to
|
||||||
* stick in the scsixfer reg.
|
* stick in the scsixfer reg.
|
||||||
*/
|
*/
|
||||||
static struct ahc_syncrate ahc_syncrates[] =
|
static const struct ahc_syncrate ahc_syncrates[] =
|
||||||
{
|
{
|
||||||
/* ultra2 fast/ultra period rate */
|
/* ultra2 fast/ultra period rate */
|
||||||
{ 0x42, 0x000, 9, "80.0" },
|
{ 0x42, 0x000, 9, "80.0" },
|
||||||
|
@ -148,7 +147,7 @@ static struct ahc_tmode_tstate*
|
||||||
static void ahc_free_tstate(struct ahc_softc *ahc,
|
static void ahc_free_tstate(struct ahc_softc *ahc,
|
||||||
u_int scsi_id, char channel, int force);
|
u_int scsi_id, char channel, int force);
|
||||||
#endif
|
#endif
|
||||||
static struct ahc_syncrate*
|
static const struct ahc_syncrate*
|
||||||
ahc_devlimited_syncrate(struct ahc_softc *ahc,
|
ahc_devlimited_syncrate(struct ahc_softc *ahc,
|
||||||
struct ahc_initiator_tinfo *,
|
struct ahc_initiator_tinfo *,
|
||||||
u_int *period,
|
u_int *period,
|
||||||
|
@ -204,9 +203,9 @@ static void ahc_setup_target_msgin(struct ahc_softc *ahc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bus_dmamap_callback_t ahc_dmamap_cb;
|
static bus_dmamap_callback_t ahc_dmamap_cb;
|
||||||
static void ahc_build_free_scb_list(struct ahc_softc *ahc);
|
static void ahc_build_free_scb_list(struct ahc_softc *ahc);
|
||||||
static int ahc_init_scbdata(struct ahc_softc *ahc);
|
static int ahc_init_scbdata(struct ahc_softc *ahc);
|
||||||
static void ahc_fini_scbdata(struct ahc_softc *ahc);
|
static void ahc_fini_scbdata(struct ahc_softc *ahc);
|
||||||
static void ahc_qinfifo_requeue(struct ahc_softc *ahc,
|
static void ahc_qinfifo_requeue(struct ahc_softc *ahc,
|
||||||
struct scb *prev_scb,
|
struct scb *prev_scb,
|
||||||
struct scb *scb);
|
struct scb *scb);
|
||||||
|
@ -238,6 +237,71 @@ static int ahc_handle_target_cmd(struct ahc_softc *ahc,
|
||||||
struct target_cmd *cmd);
|
struct target_cmd *cmd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static u_int ahc_index_busy_tcl(struct ahc_softc *ahc, u_int tcl);
|
||||||
|
static void ahc_unbusy_tcl(struct ahc_softc *ahc, u_int tcl);
|
||||||
|
static void ahc_busy_tcl(struct ahc_softc *ahc,
|
||||||
|
u_int tcl, u_int busyid);
|
||||||
|
|
||||||
|
/************************** SCB and SCB queue management **********************/
|
||||||
|
static void ahc_run_untagged_queues(struct ahc_softc *ahc);
|
||||||
|
static void ahc_run_untagged_queue(struct ahc_softc *ahc,
|
||||||
|
struct scb_tailq *queue);
|
||||||
|
|
||||||
|
/****************************** Initialization ********************************/
|
||||||
|
static void ahc_alloc_scbs(struct ahc_softc *ahc);
|
||||||
|
static void ahc_shutdown(void *arg);
|
||||||
|
|
||||||
|
/*************************** Interrupt Services *******************************/
|
||||||
|
static void ahc_clear_intstat(struct ahc_softc *ahc);
|
||||||
|
static void ahc_run_qoutfifo(struct ahc_softc *ahc);
|
||||||
|
#ifdef AHC_TARGET_MODE
|
||||||
|
static void ahc_run_tqinfifo(struct ahc_softc *ahc, int paused);
|
||||||
|
#endif
|
||||||
|
static void ahc_handle_brkadrint(struct ahc_softc *ahc);
|
||||||
|
static void ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat);
|
||||||
|
static void ahc_handle_scsiint(struct ahc_softc *ahc,
|
||||||
|
u_int intstat);
|
||||||
|
static void ahc_clear_critical_section(struct ahc_softc *ahc);
|
||||||
|
|
||||||
|
/***************************** Error Recovery *********************************/
|
||||||
|
static void ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb);
|
||||||
|
static int ahc_abort_scbs(struct ahc_softc *ahc, int target,
|
||||||
|
char channel, int lun, u_int tag,
|
||||||
|
role_t role, uint32_t status);
|
||||||
|
static void ahc_calc_residual(struct ahc_softc *ahc,
|
||||||
|
struct scb *scb);
|
||||||
|
|
||||||
|
/*********************** Untagged Transaction Routines ************************/
|
||||||
|
static inline void ahc_freeze_untagged_queues(struct ahc_softc *ahc);
|
||||||
|
static inline void ahc_release_untagged_queues(struct ahc_softc *ahc);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Block our completion routine from starting the next untagged
|
||||||
|
* transaction for this target or target lun.
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
ahc_freeze_untagged_queues(struct ahc_softc *ahc)
|
||||||
|
{
|
||||||
|
if ((ahc->flags & AHC_SCB_BTT) == 0)
|
||||||
|
ahc->untagged_queue_lock++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Allow the next untagged transaction for this target or target lun
|
||||||
|
* to be executed. We use a counting semaphore to allow the lock
|
||||||
|
* to be acquired recursively. Once the count drops to zero, the
|
||||||
|
* transaction queues will be run.
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
ahc_release_untagged_queues(struct ahc_softc *ahc)
|
||||||
|
{
|
||||||
|
if ((ahc->flags & AHC_SCB_BTT) == 0) {
|
||||||
|
ahc->untagged_queue_lock--;
|
||||||
|
if (ahc->untagged_queue_lock == 0)
|
||||||
|
ahc_run_untagged_queues(ahc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/************************* Sequencer Execution Control ************************/
|
/************************* Sequencer Execution Control ************************/
|
||||||
/*
|
/*
|
||||||
* Work around any chip bugs related to halting sequencer execution.
|
* Work around any chip bugs related to halting sequencer execution.
|
||||||
|
@ -247,7 +311,7 @@ static int ahc_handle_target_cmd(struct ahc_softc *ahc,
|
||||||
* manual pause while accessing scb ram, accesses to certain registers
|
* manual pause while accessing scb ram, accesses to certain registers
|
||||||
* will hang the system (infinite pci retries).
|
* will hang the system (infinite pci retries).
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
ahc_pause_bug_fix(struct ahc_softc *ahc)
|
ahc_pause_bug_fix(struct ahc_softc *ahc)
|
||||||
{
|
{
|
||||||
if ((ahc->features & AHC_ULTRA2) != 0)
|
if ((ahc->features & AHC_ULTRA2) != 0)
|
||||||
|
@ -304,7 +368,7 @@ ahc_unpause(struct ahc_softc *ahc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************** Memory mapping routines ***************************/
|
/************************** Memory mapping routines ***************************/
|
||||||
struct ahc_dma_seg *
|
static struct ahc_dma_seg *
|
||||||
ahc_sg_bus_to_virt(struct scb *scb, uint32_t sg_busaddr)
|
ahc_sg_bus_to_virt(struct scb *scb, uint32_t sg_busaddr)
|
||||||
{
|
{
|
||||||
int sg_index;
|
int sg_index;
|
||||||
|
@ -316,7 +380,7 @@ ahc_sg_bus_to_virt(struct scb *scb, uint32_t sg_busaddr)
|
||||||
return (&scb->sg_list[sg_index]);
|
return (&scb->sg_list[sg_index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
static uint32_t
|
||||||
ahc_sg_virt_to_bus(struct scb *scb, struct ahc_dma_seg *sg)
|
ahc_sg_virt_to_bus(struct scb *scb, struct ahc_dma_seg *sg)
|
||||||
{
|
{
|
||||||
int sg_index;
|
int sg_index;
|
||||||
|
@ -327,14 +391,14 @@ ahc_sg_virt_to_bus(struct scb *scb, struct ahc_dma_seg *sg)
|
||||||
return (scb->sg_list_phys + (sg_index * sizeof(*scb->sg_list)));
|
return (scb->sg_list_phys + (sg_index * sizeof(*scb->sg_list)));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
static uint32_t
|
||||||
ahc_hscb_busaddr(struct ahc_softc *ahc, u_int index)
|
ahc_hscb_busaddr(struct ahc_softc *ahc, u_int index)
|
||||||
{
|
{
|
||||||
return (ahc->scb_data->hscb_busaddr
|
return (ahc->scb_data->hscb_busaddr
|
||||||
+ (sizeof(struct hardware_scb) * index));
|
+ (sizeof(struct hardware_scb) * index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_sync_scb(struct ahc_softc *ahc, struct scb *scb, int op)
|
ahc_sync_scb(struct ahc_softc *ahc, struct scb *scb, int op)
|
||||||
{
|
{
|
||||||
ahc_dmamap_sync(ahc, ahc->scb_data->hscb_dmat,
|
ahc_dmamap_sync(ahc, ahc->scb_data->hscb_dmat,
|
||||||
|
@ -355,18 +419,20 @@ ahc_sync_sglist(struct ahc_softc *ahc, struct scb *scb, int op)
|
||||||
/*len*/sizeof(struct ahc_dma_seg) * scb->sg_count, op);
|
/*len*/sizeof(struct ahc_dma_seg) * scb->sg_count, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
#ifdef AHC_TARGET_MODE
|
||||||
|
static uint32_t
|
||||||
ahc_targetcmd_offset(struct ahc_softc *ahc, u_int index)
|
ahc_targetcmd_offset(struct ahc_softc *ahc, u_int index)
|
||||||
{
|
{
|
||||||
return (((uint8_t *)&ahc->targetcmds[index]) - ahc->qoutfifo);
|
return (((uint8_t *)&ahc->targetcmds[index]) - ahc->qoutfifo);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*********************** Miscelaneous Support Functions ***********************/
|
/*********************** Miscelaneous Support Functions ***********************/
|
||||||
/*
|
/*
|
||||||
* Determine whether the sequencer reported a residual
|
* Determine whether the sequencer reported a residual
|
||||||
* for this SCB/transaction.
|
* for this SCB/transaction.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
ahc_update_residual(struct ahc_softc *ahc, struct scb *scb)
|
ahc_update_residual(struct ahc_softc *ahc, struct scb *scb)
|
||||||
{
|
{
|
||||||
uint32_t sgptr;
|
uint32_t sgptr;
|
||||||
|
@ -504,7 +570,7 @@ ahc_lookup_scb(struct ahc_softc *ahc, u_int tag)
|
||||||
return (scb);
|
return (scb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_swap_with_next_hscb(struct ahc_softc *ahc, struct scb *scb)
|
ahc_swap_with_next_hscb(struct ahc_softc *ahc, struct scb *scb)
|
||||||
{
|
{
|
||||||
struct hardware_scb *q_hscb;
|
struct hardware_scb *q_hscb;
|
||||||
|
@ -593,7 +659,7 @@ ahc_get_sense_buf(struct ahc_softc *ahc, struct scb *scb)
|
||||||
return (&ahc->scb_data->sense[offset]);
|
return (&ahc->scb_data->sense[offset]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
static uint32_t
|
||||||
ahc_get_sense_bufaddr(struct ahc_softc *ahc, struct scb *scb)
|
ahc_get_sense_bufaddr(struct ahc_softc *ahc, struct scb *scb)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
|
@ -604,14 +670,14 @@ ahc_get_sense_bufaddr(struct ahc_softc *ahc, struct scb *scb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************** Interrupt Processing ******************************/
|
/************************** Interrupt Processing ******************************/
|
||||||
void
|
static void
|
||||||
ahc_sync_qoutfifo(struct ahc_softc *ahc, int op)
|
ahc_sync_qoutfifo(struct ahc_softc *ahc, int op)
|
||||||
{
|
{
|
||||||
ahc_dmamap_sync(ahc, ahc->shared_data_dmat, ahc->shared_data_dmamap,
|
ahc_dmamap_sync(ahc, ahc->shared_data_dmat, ahc->shared_data_dmamap,
|
||||||
/*offset*/0, /*len*/256, op);
|
/*offset*/0, /*len*/256, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_sync_tqinfifo(struct ahc_softc *ahc, int op)
|
ahc_sync_tqinfifo(struct ahc_softc *ahc, int op)
|
||||||
{
|
{
|
||||||
#ifdef AHC_TARGET_MODE
|
#ifdef AHC_TARGET_MODE
|
||||||
|
@ -631,7 +697,7 @@ ahc_sync_tqinfifo(struct ahc_softc *ahc, int op)
|
||||||
*/
|
*/
|
||||||
#define AHC_RUN_QOUTFIFO 0x1
|
#define AHC_RUN_QOUTFIFO 0x1
|
||||||
#define AHC_RUN_TQINFIFO 0x2
|
#define AHC_RUN_TQINFIFO 0x2
|
||||||
u_int
|
static u_int
|
||||||
ahc_check_cmdcmpltqueues(struct ahc_softc *ahc)
|
ahc_check_cmdcmpltqueues(struct ahc_softc *ahc)
|
||||||
{
|
{
|
||||||
u_int retval;
|
u_int retval;
|
||||||
|
@ -745,7 +811,7 @@ ahc_intr(struct ahc_softc *ahc)
|
||||||
/*
|
/*
|
||||||
* Restart the sequencer program from address zero
|
* Restart the sequencer program from address zero
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
ahc_restart(struct ahc_softc *ahc)
|
ahc_restart(struct ahc_softc *ahc)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -806,7 +872,7 @@ ahc_restart(struct ahc_softc *ahc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************* Input/Output Queues ********************************/
|
/************************* Input/Output Queues ********************************/
|
||||||
void
|
static void
|
||||||
ahc_run_qoutfifo(struct ahc_softc *ahc)
|
ahc_run_qoutfifo(struct ahc_softc *ahc)
|
||||||
{
|
{
|
||||||
struct scb *scb;
|
struct scb *scb;
|
||||||
|
@ -853,7 +919,7 @@ ahc_run_qoutfifo(struct ahc_softc *ahc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_run_untagged_queues(struct ahc_softc *ahc)
|
ahc_run_untagged_queues(struct ahc_softc *ahc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -862,7 +928,7 @@ ahc_run_untagged_queues(struct ahc_softc *ahc)
|
||||||
ahc_run_untagged_queue(ahc, &ahc->untagged_queues[i]);
|
ahc_run_untagged_queue(ahc, &ahc->untagged_queues[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_run_untagged_queue(struct ahc_softc *ahc, struct scb_tailq *queue)
|
ahc_run_untagged_queue(struct ahc_softc *ahc, struct scb_tailq *queue)
|
||||||
{
|
{
|
||||||
struct scb *scb;
|
struct scb *scb;
|
||||||
|
@ -878,7 +944,7 @@ ahc_run_untagged_queue(struct ahc_softc *ahc, struct scb_tailq *queue)
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************* Interrupt Handling *********************************/
|
/************************* Interrupt Handling *********************************/
|
||||||
void
|
static void
|
||||||
ahc_handle_brkadrint(struct ahc_softc *ahc)
|
ahc_handle_brkadrint(struct ahc_softc *ahc)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -907,7 +973,7 @@ ahc_handle_brkadrint(struct ahc_softc *ahc)
|
||||||
ahc_shutdown(ahc);
|
ahc_shutdown(ahc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
|
ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)
|
||||||
{
|
{
|
||||||
struct scb *scb;
|
struct scb *scb;
|
||||||
|
@ -1458,7 +1524,7 @@ unpause:
|
||||||
ahc_unpause(ahc);
|
ahc_unpause(ahc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat)
|
ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat)
|
||||||
{
|
{
|
||||||
u_int scb_index;
|
u_int scb_index;
|
||||||
|
@ -1911,7 +1977,7 @@ ahc_force_renegotiation(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define AHC_MAX_STEPS 2000
|
#define AHC_MAX_STEPS 2000
|
||||||
void
|
static void
|
||||||
ahc_clear_critical_section(struct ahc_softc *ahc)
|
ahc_clear_critical_section(struct ahc_softc *ahc)
|
||||||
{
|
{
|
||||||
int stepping;
|
int stepping;
|
||||||
|
@ -2004,7 +2070,7 @@ ahc_clear_critical_section(struct ahc_softc *ahc)
|
||||||
/*
|
/*
|
||||||
* Clear any pending interrupt status.
|
* Clear any pending interrupt status.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
ahc_clear_intstat(struct ahc_softc *ahc)
|
ahc_clear_intstat(struct ahc_softc *ahc)
|
||||||
{
|
{
|
||||||
/* Clear any interrupt conditions this may have caused */
|
/* Clear any interrupt conditions this may have caused */
|
||||||
|
@ -2023,7 +2089,8 @@ ahc_clear_intstat(struct ahc_softc *ahc)
|
||||||
uint32_t ahc_debug = AHC_DEBUG_OPTS;
|
uint32_t ahc_debug = AHC_DEBUG_OPTS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
#if 0 /* unused */
|
||||||
|
static void
|
||||||
ahc_print_scb(struct scb *scb)
|
ahc_print_scb(struct scb *scb)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -2055,6 +2122,7 @@ ahc_print_scb(struct scb *scb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************* Transfer Negotiation *******************************/
|
/************************* Transfer Negotiation *******************************/
|
||||||
/*
|
/*
|
||||||
|
@ -2138,7 +2206,7 @@ ahc_free_tstate(struct ahc_softc *ahc, u_int scsi_id, char channel, int force)
|
||||||
* by the capabilities of the bus connectivity of and sync settings for
|
* by the capabilities of the bus connectivity of and sync settings for
|
||||||
* the target.
|
* the target.
|
||||||
*/
|
*/
|
||||||
struct ahc_syncrate *
|
const struct ahc_syncrate *
|
||||||
ahc_devlimited_syncrate(struct ahc_softc *ahc,
|
ahc_devlimited_syncrate(struct ahc_softc *ahc,
|
||||||
struct ahc_initiator_tinfo *tinfo,
|
struct ahc_initiator_tinfo *tinfo,
|
||||||
u_int *period, u_int *ppr_options, role_t role)
|
u_int *period, u_int *ppr_options, role_t role)
|
||||||
|
@ -2193,11 +2261,11 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc,
|
||||||
* Return the period and offset that should be sent to the target
|
* Return the period and offset that should be sent to the target
|
||||||
* if this was the beginning of an SDTR.
|
* if this was the beginning of an SDTR.
|
||||||
*/
|
*/
|
||||||
struct ahc_syncrate *
|
const struct ahc_syncrate *
|
||||||
ahc_find_syncrate(struct ahc_softc *ahc, u_int *period,
|
ahc_find_syncrate(struct ahc_softc *ahc, u_int *period,
|
||||||
u_int *ppr_options, u_int maxsync)
|
u_int *ppr_options, u_int maxsync)
|
||||||
{
|
{
|
||||||
struct ahc_syncrate *syncrate;
|
const struct ahc_syncrate *syncrate;
|
||||||
|
|
||||||
if ((ahc->features & AHC_DT) == 0)
|
if ((ahc->features & AHC_DT) == 0)
|
||||||
*ppr_options &= ~MSG_EXT_PPR_DT_REQ;
|
*ppr_options &= ~MSG_EXT_PPR_DT_REQ;
|
||||||
|
@ -2272,7 +2340,7 @@ ahc_find_syncrate(struct ahc_softc *ahc, u_int *period,
|
||||||
u_int
|
u_int
|
||||||
ahc_find_period(struct ahc_softc *ahc, u_int scsirate, u_int maxsync)
|
ahc_find_period(struct ahc_softc *ahc, u_int scsirate, u_int maxsync)
|
||||||
{
|
{
|
||||||
struct ahc_syncrate *syncrate;
|
const struct ahc_syncrate *syncrate;
|
||||||
|
|
||||||
if ((ahc->features & AHC_ULTRA2) != 0)
|
if ((ahc->features & AHC_ULTRA2) != 0)
|
||||||
scsirate &= SXFR_ULTRA2;
|
scsirate &= SXFR_ULTRA2;
|
||||||
|
@ -2310,10 +2378,10 @@ ahc_find_period(struct ahc_softc *ahc, u_int scsirate, u_int maxsync)
|
||||||
* Truncate the given synchronous offset to a value the
|
* Truncate the given synchronous offset to a value the
|
||||||
* current adapter type and syncrate are capable of.
|
* current adapter type and syncrate are capable of.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
ahc_validate_offset(struct ahc_softc *ahc,
|
ahc_validate_offset(struct ahc_softc *ahc,
|
||||||
struct ahc_initiator_tinfo *tinfo,
|
struct ahc_initiator_tinfo *tinfo,
|
||||||
struct ahc_syncrate *syncrate,
|
const struct ahc_syncrate *syncrate,
|
||||||
u_int *offset, int wide, role_t role)
|
u_int *offset, int wide, role_t role)
|
||||||
{
|
{
|
||||||
u_int maxoffset;
|
u_int maxoffset;
|
||||||
|
@ -2342,7 +2410,7 @@ ahc_validate_offset(struct ahc_softc *ahc,
|
||||||
* Truncate the given transfer width parameter to a value the
|
* Truncate the given transfer width parameter to a value the
|
||||||
* current adapter type is capable of.
|
* current adapter type is capable of.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo,
|
ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo,
|
||||||
u_int *bus_width, role_t role)
|
u_int *bus_width, role_t role)
|
||||||
{
|
{
|
||||||
|
@ -2417,7 +2485,7 @@ ahc_update_neg_request(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ahc_set_syncrate(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
|
ahc_set_syncrate(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
|
||||||
struct ahc_syncrate *syncrate, u_int period,
|
const struct ahc_syncrate *syncrate, u_int period,
|
||||||
u_int offset, u_int ppr_options, u_int type, int paused)
|
u_int offset, u_int ppr_options, u_int type, int paused)
|
||||||
{
|
{
|
||||||
struct ahc_initiator_tinfo *tinfo;
|
struct ahc_initiator_tinfo *tinfo;
|
||||||
|
@ -2724,11 +2792,11 @@ ahc_fetch_devinfo(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
|
||||||
role);
|
role);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ahc_phase_table_entry*
|
static const struct ahc_phase_table_entry*
|
||||||
ahc_lookup_phase_entry(int phase)
|
ahc_lookup_phase_entry(int phase)
|
||||||
{
|
{
|
||||||
struct ahc_phase_table_entry *entry;
|
const struct ahc_phase_table_entry *entry;
|
||||||
struct ahc_phase_table_entry *last_entry;
|
const struct ahc_phase_table_entry *last_entry;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* num_phases doesn't include the default entry which
|
* num_phases doesn't include the default entry which
|
||||||
|
@ -2894,7 +2962,7 @@ ahc_build_transfer_msg(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
|
||||||
*/
|
*/
|
||||||
struct ahc_initiator_tinfo *tinfo;
|
struct ahc_initiator_tinfo *tinfo;
|
||||||
struct ahc_tmode_tstate *tstate;
|
struct ahc_tmode_tstate *tstate;
|
||||||
struct ahc_syncrate *rate;
|
const struct ahc_syncrate *rate;
|
||||||
int dowide;
|
int dowide;
|
||||||
int dosync;
|
int dosync;
|
||||||
int doppr;
|
int doppr;
|
||||||
|
@ -3560,7 +3628,7 @@ ahc_parse_msg(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
|
||||||
switch (ahc->msgin_buf[2]) {
|
switch (ahc->msgin_buf[2]) {
|
||||||
case MSG_EXT_SDTR:
|
case MSG_EXT_SDTR:
|
||||||
{
|
{
|
||||||
struct ahc_syncrate *syncrate;
|
const struct ahc_syncrate *syncrate;
|
||||||
u_int period;
|
u_int period;
|
||||||
u_int ppr_options;
|
u_int ppr_options;
|
||||||
u_int offset;
|
u_int offset;
|
||||||
|
@ -3735,7 +3803,7 @@ ahc_parse_msg(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
|
||||||
}
|
}
|
||||||
case MSG_EXT_PPR:
|
case MSG_EXT_PPR:
|
||||||
{
|
{
|
||||||
struct ahc_syncrate *syncrate;
|
const struct ahc_syncrate *syncrate;
|
||||||
u_int period;
|
u_int period;
|
||||||
u_int offset;
|
u_int offset;
|
||||||
u_int bus_width;
|
u_int bus_width;
|
||||||
|
@ -4488,7 +4556,7 @@ ahc_free(struct ahc_softc *ahc)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_shutdown(void *arg)
|
ahc_shutdown(void *arg)
|
||||||
{
|
{
|
||||||
struct ahc_softc *ahc;
|
struct ahc_softc *ahc;
|
||||||
|
@ -4892,7 +4960,7 @@ ahc_fini_scbdata(struct ahc_softc *ahc)
|
||||||
free(scb_data->scbarray, M_DEVBUF);
|
free(scb_data->scbarray, M_DEVBUF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_alloc_scbs(struct ahc_softc *ahc)
|
ahc_alloc_scbs(struct ahc_softc *ahc)
|
||||||
{
|
{
|
||||||
struct scb_data *scb_data;
|
struct scb_data *scb_data;
|
||||||
|
@ -5625,7 +5693,7 @@ ahc_resume(struct ahc_softc *ahc)
|
||||||
* Return the untagged transaction id for a given target/channel lun.
|
* Return the untagged transaction id for a given target/channel lun.
|
||||||
* Optionally, clear the entry.
|
* Optionally, clear the entry.
|
||||||
*/
|
*/
|
||||||
u_int
|
static u_int
|
||||||
ahc_index_busy_tcl(struct ahc_softc *ahc, u_int tcl)
|
ahc_index_busy_tcl(struct ahc_softc *ahc, u_int tcl)
|
||||||
{
|
{
|
||||||
u_int scbid;
|
u_int scbid;
|
||||||
|
@ -5646,7 +5714,7 @@ ahc_index_busy_tcl(struct ahc_softc *ahc, u_int tcl)
|
||||||
return (scbid);
|
return (scbid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_unbusy_tcl(struct ahc_softc *ahc, u_int tcl)
|
ahc_unbusy_tcl(struct ahc_softc *ahc, u_int tcl)
|
||||||
{
|
{
|
||||||
u_int target_offset;
|
u_int target_offset;
|
||||||
|
@ -5664,7 +5732,7 @@ ahc_unbusy_tcl(struct ahc_softc *ahc, u_int tcl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_busy_tcl(struct ahc_softc *ahc, u_int tcl, u_int scbid)
|
ahc_busy_tcl(struct ahc_softc *ahc, u_int tcl, u_int scbid)
|
||||||
{
|
{
|
||||||
u_int target_offset;
|
u_int target_offset;
|
||||||
|
@ -5719,7 +5787,7 @@ ahc_match_scb(struct ahc_softc *ahc, struct scb *scb, int target,
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb)
|
ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb)
|
||||||
{
|
{
|
||||||
int target;
|
int target;
|
||||||
|
@ -6260,7 +6328,7 @@ ahc_rem_wscb(struct ahc_softc *ahc, u_int scbpos, u_int prev)
|
||||||
* been modified from CAM_REQ_INPROG. This routine assumes that the sequencer
|
* been modified from CAM_REQ_INPROG. This routine assumes that the sequencer
|
||||||
* is paused before it is called.
|
* is paused before it is called.
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
ahc_abort_scbs(struct ahc_softc *ahc, int target, char channel,
|
ahc_abort_scbs(struct ahc_softc *ahc, int target, char channel,
|
||||||
int lun, u_int tag, role_t role, uint32_t status)
|
int lun, u_int tag, role_t role, uint32_t status)
|
||||||
{
|
{
|
||||||
|
@ -6582,7 +6650,7 @@ ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset)
|
||||||
/*
|
/*
|
||||||
* Calculate the residual for a just completed SCB.
|
* Calculate the residual for a just completed SCB.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb)
|
ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb)
|
||||||
{
|
{
|
||||||
struct hardware_scb *hscb;
|
struct hardware_scb *hscb;
|
||||||
|
@ -7049,7 +7117,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ahc_print_register(ahc_reg_parse_entry_t *table, u_int num_entries,
|
ahc_print_register(const ahc_reg_parse_entry_t *table, u_int num_entries,
|
||||||
const char *name, u_int address, u_int value,
|
const char *name, u_int address, u_int value,
|
||||||
u_int *cur_column, u_int wrap_point)
|
u_int *cur_column, u_int wrap_point)
|
||||||
{
|
{
|
||||||
|
@ -7733,7 +7801,7 @@ ahc_update_scsiid(struct ahc_softc *ahc, u_int targid_mask)
|
||||||
ahc_outb(ahc, SCSIID, scsiid);
|
ahc_outb(ahc, SCSIID, scsiid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_run_tqinfifo(struct ahc_softc *ahc, int paused)
|
ahc_run_tqinfifo(struct ahc_softc *ahc, int paused)
|
||||||
{
|
{
|
||||||
struct target_cmd *cmd;
|
struct target_cmd *cmd;
|
||||||
|
|
|
@ -46,58 +46,13 @@
|
||||||
#define _AIC7XXX_INLINE_H_
|
#define _AIC7XXX_INLINE_H_
|
||||||
|
|
||||||
/************************* Sequencer Execution Control ************************/
|
/************************* Sequencer Execution Control ************************/
|
||||||
void ahc_pause_bug_fix(struct ahc_softc *ahc);
|
|
||||||
int ahc_is_paused(struct ahc_softc *ahc);
|
int ahc_is_paused(struct ahc_softc *ahc);
|
||||||
void ahc_pause(struct ahc_softc *ahc);
|
void ahc_pause(struct ahc_softc *ahc);
|
||||||
void ahc_unpause(struct ahc_softc *ahc);
|
void ahc_unpause(struct ahc_softc *ahc);
|
||||||
|
|
||||||
/*********************** Untagged Transaction Routines ************************/
|
|
||||||
static __inline void ahc_freeze_untagged_queues(struct ahc_softc *ahc);
|
|
||||||
static __inline void ahc_release_untagged_queues(struct ahc_softc *ahc);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Block our completion routine from starting the next untagged
|
|
||||||
* transaction for this target or target lun.
|
|
||||||
*/
|
|
||||||
static __inline void
|
|
||||||
ahc_freeze_untagged_queues(struct ahc_softc *ahc)
|
|
||||||
{
|
|
||||||
if ((ahc->flags & AHC_SCB_BTT) == 0)
|
|
||||||
ahc->untagged_queue_lock++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Allow the next untagged transaction for this target or target lun
|
|
||||||
* to be executed. We use a counting semaphore to allow the lock
|
|
||||||
* to be acquired recursively. Once the count drops to zero, the
|
|
||||||
* transaction queues will be run.
|
|
||||||
*/
|
|
||||||
static __inline void
|
|
||||||
ahc_release_untagged_queues(struct ahc_softc *ahc)
|
|
||||||
{
|
|
||||||
if ((ahc->flags & AHC_SCB_BTT) == 0) {
|
|
||||||
ahc->untagged_queue_lock--;
|
|
||||||
if (ahc->untagged_queue_lock == 0)
|
|
||||||
ahc_run_untagged_queues(ahc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************** Memory mapping routines ***************************/
|
/************************** Memory mapping routines ***************************/
|
||||||
struct ahc_dma_seg *
|
|
||||||
ahc_sg_bus_to_virt(struct scb *scb,
|
|
||||||
uint32_t sg_busaddr);
|
|
||||||
uint32_t
|
|
||||||
ahc_sg_virt_to_bus(struct scb *scb,
|
|
||||||
struct ahc_dma_seg *sg);
|
|
||||||
uint32_t
|
|
||||||
ahc_hscb_busaddr(struct ahc_softc *ahc, u_int index);
|
|
||||||
void ahc_sync_scb(struct ahc_softc *ahc,
|
|
||||||
struct scb *scb, int op);
|
|
||||||
void ahc_sync_sglist(struct ahc_softc *ahc,
|
void ahc_sync_sglist(struct ahc_softc *ahc,
|
||||||
struct scb *scb, int op);
|
struct scb *scb, int op);
|
||||||
uint32_t
|
|
||||||
ahc_targetcmd_offset(struct ahc_softc *ahc,
|
|
||||||
u_int index);
|
|
||||||
|
|
||||||
/******************************** Debugging ***********************************/
|
/******************************** Debugging ***********************************/
|
||||||
static __inline char *ahc_name(struct ahc_softc *ahc);
|
static __inline char *ahc_name(struct ahc_softc *ahc);
|
||||||
|
@ -110,8 +65,6 @@ ahc_name(struct ahc_softc *ahc)
|
||||||
|
|
||||||
/*********************** Miscellaneous Support Functions ***********************/
|
/*********************** Miscellaneous Support Functions ***********************/
|
||||||
|
|
||||||
void ahc_update_residual(struct ahc_softc *ahc,
|
|
||||||
struct scb *scb);
|
|
||||||
struct ahc_initiator_tinfo *
|
struct ahc_initiator_tinfo *
|
||||||
ahc_fetch_transinfo(struct ahc_softc *ahc,
|
ahc_fetch_transinfo(struct ahc_softc *ahc,
|
||||||
char channel, u_int our_id,
|
char channel, u_int our_id,
|
||||||
|
@ -134,20 +87,12 @@ struct scb*
|
||||||
void ahc_free_scb(struct ahc_softc *ahc, struct scb *scb);
|
void ahc_free_scb(struct ahc_softc *ahc, struct scb *scb);
|
||||||
struct scb *
|
struct scb *
|
||||||
ahc_lookup_scb(struct ahc_softc *ahc, u_int tag);
|
ahc_lookup_scb(struct ahc_softc *ahc, u_int tag);
|
||||||
void ahc_swap_with_next_hscb(struct ahc_softc *ahc,
|
|
||||||
struct scb *scb);
|
|
||||||
void ahc_queue_scb(struct ahc_softc *ahc, struct scb *scb);
|
void ahc_queue_scb(struct ahc_softc *ahc, struct scb *scb);
|
||||||
struct scsi_sense_data *
|
struct scsi_sense_data *
|
||||||
ahc_get_sense_buf(struct ahc_softc *ahc,
|
ahc_get_sense_buf(struct ahc_softc *ahc,
|
||||||
struct scb *scb);
|
struct scb *scb);
|
||||||
uint32_t
|
|
||||||
ahc_get_sense_bufaddr(struct ahc_softc *ahc,
|
|
||||||
struct scb *scb);
|
|
||||||
|
|
||||||
/************************** Interrupt Processing ******************************/
|
/************************** Interrupt Processing ******************************/
|
||||||
void ahc_sync_qoutfifo(struct ahc_softc *ahc, int op);
|
|
||||||
void ahc_sync_tqinfifo(struct ahc_softc *ahc, int op);
|
|
||||||
u_int ahc_check_cmdcmpltqueues(struct ahc_softc *ahc);
|
|
||||||
int ahc_intr(struct ahc_softc *ahc);
|
int ahc_intr(struct ahc_softc *ahc);
|
||||||
|
|
||||||
#endif /* _AIC7XXX_INLINE_H_ */
|
#endif /* _AIC7XXX_INLINE_H_ */
|
||||||
|
|
|
@ -2386,7 +2386,7 @@ static void ahc_linux_set_period(struct scsi_target *starget, int period)
|
||||||
unsigned int ppr_options = tinfo->goal.ppr_options;
|
unsigned int ppr_options = tinfo->goal.ppr_options;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned long offset = tinfo->goal.offset;
|
unsigned long offset = tinfo->goal.offset;
|
||||||
struct ahc_syncrate *syncrate;
|
const struct ahc_syncrate *syncrate;
|
||||||
|
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
offset = MAX_OFFSET;
|
offset = MAX_OFFSET;
|
||||||
|
@ -2430,7 +2430,7 @@ static void ahc_linux_set_offset(struct scsi_target *starget, int offset)
|
||||||
unsigned int ppr_options = 0;
|
unsigned int ppr_options = 0;
|
||||||
unsigned int period = 0;
|
unsigned int period = 0;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct ahc_syncrate *syncrate = NULL;
|
const struct ahc_syncrate *syncrate = NULL;
|
||||||
|
|
||||||
ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
|
ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
|
||||||
starget->channel + 'A', ROLE_INITIATOR);
|
starget->channel + 'A', ROLE_INITIATOR);
|
||||||
|
@ -2460,7 +2460,7 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt)
|
||||||
unsigned int period = tinfo->goal.period;
|
unsigned int period = tinfo->goal.period;
|
||||||
unsigned int width = tinfo->goal.width;
|
unsigned int width = tinfo->goal.width;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct ahc_syncrate *syncrate;
|
const struct ahc_syncrate *syncrate;
|
||||||
|
|
||||||
if (dt && spi_max_width(starget)) {
|
if (dt && spi_max_width(starget)) {
|
||||||
ppr_options |= MSG_EXT_PPR_DT_REQ;
|
ppr_options |= MSG_EXT_PPR_DT_REQ;
|
||||||
|
|
|
@ -398,9 +398,6 @@ struct info_str {
|
||||||
int pos;
|
int pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ahc_format_transinfo(struct info_str *info,
|
|
||||||
struct ahc_transinfo *tinfo);
|
|
||||||
|
|
||||||
/******************************** Locking *************************************/
|
/******************************** Locking *************************************/
|
||||||
/* Lock protecting internal data structures */
|
/* Lock protecting internal data structures */
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ copy_info(struct info_str *info, char *fmt, ...)
|
||||||
return (len);
|
return (len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo)
|
ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo)
|
||||||
{
|
{
|
||||||
u_int speed;
|
u_int speed;
|
||||||
|
|
Loading…
Reference in New Issue