summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/aic7xxx.c109
-rw-r--r--sys/dev/ic/aic7xxx_inline.h62
-rw-r--r--sys/dev/ic/aic7xxxvar.h9
3 files changed, 17 insertions, 163 deletions
diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c
index b6bce03ac1e..fb02b2cd7bb 100644
--- a/sys/dev/ic/aic7xxx.c
+++ b/sys/dev/ic/aic7xxx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx.c,v 1.74 2007/05/02 02:20:36 krw Exp $ */
+/* $OpenBSD: aic7xxx.c,v 1.75 2007/05/14 01:37:49 deraadt Exp $ */
/* $NetBSD: aic7xxx.c,v 1.108 2003/11/02 11:07:44 wiz Exp $ */
/*
@@ -40,7 +40,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: aic7xxx.c,v 1.74 2007/05/02 02:20:36 krw Exp $
+ * $Id: aic7xxx.c,v 1.75 2007/05/14 01:37:49 deraadt Exp $
*/
/*
* Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc. - April 2003
@@ -3955,22 +3955,6 @@ ahc_softc_insert(struct ahc_softc *ahc)
ahc->init_level++;
}
-/*
- * Verify that the passed in softc pointer is for a
- * controller that is still configured.
- */
-struct ahc_softc *
-ahc_find_softc(struct ahc_softc *ahc)
-{
- struct ahc_softc *list_ahc;
-
- TAILQ_FOREACH(list_ahc, &ahc_tailq, links) {
- if (list_ahc == ahc)
- return (ahc);
- }
- return (NULL);
-}
-
void
ahc_set_unit(struct ahc_softc *ahc, int unit)
{
@@ -4470,6 +4454,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc)
}
}
+#ifndef DEBUG
void
ahc_controller_info(struct ahc_softc *ahc, char *buf, size_t buf_len)
{
@@ -4513,6 +4498,7 @@ ahc_controller_info(struct ahc_softc *ahc, char *buf, size_t buf_len)
snprintf(buf + len, buf_len - len, "%d SCBs",
ahc->scb_data->maxhscbs);
}
+#endif /* !DEBUG */
int
ahc_chip_init(struct ahc_softc *ahc)
@@ -5014,89 +5000,6 @@ ahc_intr_enable(struct ahc_softc *ahc, int enable)
ahc_outb(ahc, HCNTRL, hcntrl);
}
-/*
- * Ensure that the card is paused in a location
- * outside of all critical sections and that all
- * pending work is completed prior to returning.
- * This routine should only be called from outside
- * an interrupt context.
- */
-void
-ahc_pause_and_flushwork(struct ahc_softc *ahc)
-{
- int intstat;
- int maxloops;
- int paused;
-
- maxloops = 1000;
- ahc->flags |= AHC_ALL_INTERRUPTS;
- paused = FALSE;
- do {
- if (paused) {
- ahc_unpause(ahc);
- /*
- * Give the sequencer some time to service
- * any active selections.
- */
- aic_delay(500);
- }
- ahc_intr(ahc);
- ahc_pause(ahc);
- paused = TRUE;
- ahc_outb(ahc, SCSISEQ, ahc_inb(ahc, SCSISEQ) & ~ENSELO);
- intstat = ahc_inb(ahc, INTSTAT);
- if ((intstat & INT_PEND) == 0) {
- ahc_clear_critical_section(ahc);
- intstat = ahc_inb(ahc, INTSTAT);
- }
- } while (--maxloops
- && (intstat != 0xFF || (ahc->features & AHC_REMOVABLE) == 0)
- && ((intstat & INT_PEND) != 0
- || (ahc_inb(ahc, SSTAT0) & (SELDO|SELINGO)) != 0));
- if (maxloops == 0) {
- printf("Infinite interrupt loop, INTSTAT = %x",
- ahc_inb(ahc, INTSTAT));
- }
- ahc_platform_flushwork(ahc);
- ahc->flags &= ~AHC_ALL_INTERRUPTS;
-}
-
-int
-ahc_suspend(struct ahc_softc *ahc)
-{
-
- ahc_pause_and_flushwork(ahc);
-
- if (LIST_FIRST(&ahc->pending_scbs) != NULL) {
- ahc_unpause(ahc);
- return (EBUSY);
- }
-
-#ifdef AHC_TARGET_MODE
- /*
- * XXX What about ATIOs that have not yet been serviced?
- * Perhaps we should just refuse to be suspended if we
- * are acting in a target role.
- */
- if (ahc->pending_device != NULL) {
- ahc_unpause(ahc);
- return (EBUSY);
- }
-#endif
- ahc_shutdown(ahc);
- return (0);
-}
-
-int
-ahc_resume(struct ahc_softc *ahc)
-{
-
- ahc_reset(ahc, /*reinit*/TRUE);
- ahc_intr_enable(ahc, TRUE);
- ahc_restart(ahc);
- return (0);
-}
-
/************************** Busy Target Table *********************************/
/*
* Return the untagged transaction id for a given target/channel lun.
@@ -6531,6 +6434,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
}
}
+#ifndef SMALL_KERNEL
int
ahc_print_register(ahc_reg_parse_entry_t *table, u_int num_entries,
const char *name, u_int address, u_int value,
@@ -6576,6 +6480,7 @@ ahc_print_register(ahc_reg_parse_entry_t *table, u_int num_entries,
return (printed);
}
+#endif
void
ahc_dump_card_state(struct ahc_softc *ahc)
@@ -7216,6 +7121,7 @@ ahc_update_scsiid(struct ahc_softc *ahc, u_int targid_mask)
ahc_outb(ahc, SCSIID, scsiid);
}
+#ifdef AHC_TARGET_MODE
void
ahc_run_tqinfifo(struct ahc_softc *ahc, int paused)
{
@@ -7274,6 +7180,7 @@ ahc_run_tqinfifo(struct ahc_softc *ahc, int paused)
}
}
}
+#endif
static int
ahc_handle_target_cmd(struct ahc_softc *ahc, struct target_cmd *cmd)
diff --git a/sys/dev/ic/aic7xxx_inline.h b/sys/dev/ic/aic7xxx_inline.h
index 3a239b4d606..5ba96272742 100644
--- a/sys/dev/ic/aic7xxx_inline.h
+++ b/sys/dev/ic/aic7xxx_inline.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxx_inline.h,v 1.13 2007/04/23 07:34:51 art Exp $ */
+/* $OpenBSD: aic7xxx_inline.h,v 1.14 2007/05/14 01:37:49 deraadt Exp $ */
/* $NetBSD: aic7xxx_inline.h,v 1.4 2003/11/02 11:07:44 wiz Exp $ */
/*
@@ -173,13 +173,13 @@ IO_INLINE uint32_t
struct ahc_dma_seg *sg);
IO_INLINE uint32_t
ahc_hscb_busaddr(struct ahc_softc *ahc, u_int index);
-IO_INLINE void ahc_sync_scb(struct ahc_softc *ahc,
- struct scb *scb, int op);
-IO_INLINE void ahc_sync_sglist(struct ahc_softc *ahc,
- struct scb *scb, int op);
+IO_INLINE void ahc_sync_scb(struct ahc_softc *ahc,
+ struct scb *scb, int op);
+#ifdef AHC_TARGET_MODE
IO_INLINE uint32_t
ahc_targetcmd_offset(struct ahc_softc *ahc,
u_int index);
+#endif
#ifdef IO_EXPAND
@@ -222,23 +222,13 @@ ahc_sync_scb(struct ahc_softc *ahc, struct scb *scb, int op)
/*len*/sizeof(*scb->hscb), op);
}
-IO_INLINE void
-ahc_sync_sglist(struct ahc_softc *ahc, struct scb *scb, int op)
-{
- if (scb->sg_count == 0)
- return;
-
- ahc_dmamap_sync(ahc, ahc->parent_dmat, scb->sg_map->sg_dmamap,
- /*offset*/(scb->sg_list - scb->sg_map->sg_vaddr)
- * sizeof(struct ahc_dma_seg),
- /*len*/sizeof(struct ahc_dma_seg) * scb->sg_count, op);
-}
-
+#ifdef AHC_TARGET_MODE
IO_INLINE uint32_t
ahc_targetcmd_offset(struct ahc_softc *ahc, u_int index)
{
return (((uint8_t *)&ahc->targetcmds[index]) - ahc->qoutfifo);
}
+#endif /* AHC_TARGET_MODE */
#endif /* IO_EXPAND */
/******************************** Debugging ***********************************/
@@ -268,10 +258,6 @@ IO_INLINE uint32_t
ahc_inl(struct ahc_softc *ahc, u_int port);
IO_INLINE void ahc_outl(struct ahc_softc *ahc, u_int port,
uint32_t value);
-IO_INLINE uint64_t
- ahc_inq(struct ahc_softc *ahc, u_int port);
-IO_INLINE void ahc_outq(struct ahc_softc *ahc, u_int port,
- uint64_t value);
IO_INLINE struct scb*
ahc_get_scb(struct ahc_softc *ahc);
IO_INLINE void ahc_free_scb(struct ahc_softc *ahc, struct scb *scb);
@@ -353,32 +339,6 @@ ahc_outl(struct ahc_softc *ahc, u_int port, uint32_t value)
ahc_outb(ahc, port+3, ((value) >> 24) & 0xFF);
}
-IO_INLINE uint64_t
-ahc_inq(struct ahc_softc *ahc, u_int port)
-{
- return ((ahc_inb(ahc, port))
- | (ahc_inb(ahc, port+1) << 8)
- | (ahc_inb(ahc, port+2) << 16)
- | (ahc_inb(ahc, port+3) << 24)
- | (((uint64_t)ahc_inb(ahc, port+4)) << 32)
- | (((uint64_t)ahc_inb(ahc, port+5)) << 40)
- | (((uint64_t)ahc_inb(ahc, port+6)) << 48)
- | (((uint64_t)ahc_inb(ahc, port+7)) << 56));
-}
-
-IO_INLINE void
-ahc_outq(struct ahc_softc *ahc, u_int port, uint64_t value)
-{
- ahc_outb(ahc, port, value & 0xFF);
- ahc_outb(ahc, port+1, (value >> 8) & 0xFF);
- ahc_outb(ahc, port+2, (value >> 16) & 0xFF);
- ahc_outb(ahc, port+3, (value >> 24) & 0xFF);
- ahc_outb(ahc, port+4, (value >> 32) & 0xFF);
- ahc_outb(ahc, port+5, (value >> 40) & 0xFF);
- ahc_outb(ahc, port+6, (value >> 48) & 0xFF);
- ahc_outb(ahc, port+7, (value >> 56) & 0xFF);
-}
-
/*
* Get a free scb. If there are none, see if we can allocate a new SCB.
*/
@@ -536,7 +496,6 @@ ahc_get_sense_bufaddr(struct ahc_softc *ahc, struct scb *scb)
/************************** Interrupt Processing ******************************/
IO_INLINE void ahc_sync_qoutfifo(struct ahc_softc *ahc, int op);
-IO_INLINE void ahc_sync_qinfifo(struct ahc_softc *ahc, int op);
IO_INLINE void ahc_sync_tqinfifo(struct ahc_softc *ahc, int op);
IO_INLINE u_int ahc_check_cmdcmpltqueues(struct ahc_softc *ahc);
IO_INLINE int ahc_intr(struct ahc_softc *ahc);
@@ -550,13 +509,6 @@ ahc_sync_qoutfifo(struct ahc_softc *ahc, int op)
}
IO_INLINE void
-ahc_sync_qinfifo(struct ahc_softc *ahc, int op)
-{
- ahc_dmamap_sync(ahc, ahc->parent_dmat, ahc->shared_data_dmamap,
- /*offset*/256, /*len*/256, op);
-}
-
-IO_INLINE void
ahc_sync_tqinfifo(struct ahc_softc *ahc, int op)
{
#ifdef AHC_TARGET_MODE
diff --git a/sys/dev/ic/aic7xxxvar.h b/sys/dev/ic/aic7xxxvar.h
index 053df04bdb8..c7947436f34 100644
--- a/sys/dev/ic/aic7xxxvar.h
+++ b/sys/dev/ic/aic7xxxvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic7xxxvar.h,v 1.22 2006/03/04 19:33:21 miod Exp $ */
+/* $OpenBSD: aic7xxxvar.h,v 1.23 2007/05/14 01:37:49 deraadt Exp $ */
/*
* Core definitions and data structures shareable across OS platforms.
*
@@ -38,7 +38,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
- * $Id: aic7xxxvar.h,v 1.22 2006/03/04 19:33:21 miod Exp $
+ * $Id: aic7xxxvar.h,v 1.23 2007/05/14 01:37:49 deraadt Exp $
*
* $FreeBSD: src/sys/dev/aic7xxx/aic7xxx.h,v 1.50 2003/12/17 00:02:09 gibbs Exp $
*/
@@ -1178,7 +1178,6 @@ struct ahc_pci_identity {
ahc_device_setup_t *setup;
};
extern struct ahc_pci_identity ahc_pci_ident_table[];
-extern const u_int ahc_num_pci_devs;
/***************************** VL/EISA Declarations ***************************/
struct aic7770_identity {
@@ -1227,11 +1226,7 @@ void ahc_controller_info(struct ahc_softc *, char *, size_t);
int ahc_chip_init(struct ahc_softc *ahc);
int ahc_init(struct ahc_softc *ahc);
void ahc_intr_enable(struct ahc_softc *ahc, int enable);
-void ahc_pause_and_flushwork(struct ahc_softc *ahc);
-int ahc_suspend(struct ahc_softc *ahc);
-int ahc_resume(struct ahc_softc *ahc);
void ahc_softc_insert(struct ahc_softc *);
-struct ahc_softc *ahc_find_softc(struct ahc_softc *ahc);
void ahc_set_unit(struct ahc_softc *, int);
void ahc_set_name(struct ahc_softc *, char *);
void ahc_alloc_scbs(struct ahc_softc *ahc);