aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/aic7xxx/aic79xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/aic7xxx/aic79xx.c')
-rw-r--r--sys/dev/aic7xxx/aic79xx.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/sys/dev/aic7xxx/aic79xx.c b/sys/dev/aic7xxx/aic79xx.c
index 1b1d31769f90..2b5015b20e41 100644
--- a/sys/dev/aic7xxx/aic79xx.c
+++ b/sys/dev/aic7xxx/aic79xx.c
@@ -6229,6 +6229,9 @@ ahd_init(struct ahd_softc *ahd)
size_t driver_data_size;
int i;
int error;
+#ifdef AHD_TARGET_MODE
+ int tmode_enable;
+#endif
u_int warn_user;
uint8_t current_sensing;
uint8_t fstat;
@@ -6261,8 +6264,22 @@ ahd_init(struct ahd_softc *ahd)
/*
* Only allow target mode features if this unit has them enabled.
*/
- if ((AHD_TMODE_ENABLE & (0x1 << ahd->unit)) == 0)
+#ifdef AHD_TARGET_MODE
+ tmode_enable = ((AHD_TMODE_ENABLE & (0x1 << ahd->unit)) != 0);
+ resource_int_value(device_get_name(ahd->dev_softc),
+ device_get_unit(ahd->dev_softc),
+ "tmode_enable", &tmode_enable);
+
+ if (tmode_enable == 0) {
ahd->features &= ~AHD_TARGETMODE;
+ } else {
+ if (bootverbose && ((ahd->features & AHD_TARGETMODE) != 0))
+ printf("%s: enabling target mode\n", ahd_name(ahd));
+ }
+
+#else
+ ahd->features &= ~AHD_TARGETMODE;
+#endif
/* DMA tag for mapping buffers into device visible space. */
if (aic_dma_tag_create(ahd, ahd->parent_dmat, /*alignment*/1,
@@ -8576,8 +8593,7 @@ ahd_loadseq(struct ahd_softc *ahd)
if (sg_prefetch_align == 0)
sg_prefetch_align = 8;
/* Round down to the nearest power of 2. */
- while (powerof2(sg_prefetch_align) == 0)
- sg_prefetch_align--;
+ sg_prefetch_align = rounddown_pow_of_two(sg_prefetch_align);
cacheline_mask = sg_prefetch_align - 1;