Remove ifdefs for FreeBSD 6, 7, 8 and 9. Assume we're past that.

Differential Revision: https://reviews.freebsd.org/D22539
This commit is contained in:
Warner Losh 2019-12-06 21:50:24 +00:00
parent fdfcae4a2f
commit 232d888970
4 changed files with 1 additions and 101 deletions

View File

@ -188,11 +188,7 @@ static char *aac_describe_code(struct aac_code_lookup *table,
static d_open_t aac_open;
static d_ioctl_t aac_ioctl;
static d_poll_t aac_poll;
#if __FreeBSD_version >= 702000
static void aac_cdevpriv_dtor(void *arg);
#else
static d_close_t aac_close;
#endif
static int aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib);
static int aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t arg);
static void aac_handle_aif(struct aac_softc *sc, struct aac_fib *fib);
@ -220,9 +216,6 @@ static struct cdevsw aacraid_cdevsw = {
.d_version = D_VERSION,
.d_flags = 0,
.d_open = aac_open,
#if __FreeBSD_version < 702000
.d_close = aac_close,
#endif
.d_ioctl = aac_ioctl,
.d_poll = aac_poll,
.d_name = "aacraid",
@ -275,10 +268,9 @@ aacraid_attach(struct aac_softc *sc)
TAILQ_INIT(&sc->aac_container_tqh);
TAILQ_INIT(&sc->aac_ev_cmfree);
#if __FreeBSD_version >= 800000
/* Initialize the clock daemon callout. */
callout_init_mtx(&sc->aac_daemontime, &sc->aac_io_lock, 0);
#endif
/*
* Initialize the adapter.
*/
@ -351,18 +343,9 @@ aacraid_attach(struct aac_softc *sc)
/* enable interrupts now */
AAC_ACCESS_DEVREG(sc, AAC_ENABLE_INTERRUPT);
#if __FreeBSD_version >= 800000
mtx_lock(&sc->aac_io_lock);
callout_reset(&sc->aac_daemontime, 60 * hz, aac_daemon, sc);
mtx_unlock(&sc->aac_io_lock);
#else
{
struct timeval tv;
tv.tv_sec = 60;
tv.tv_usec = 0;
sc->timeout_id = timeout(aac_daemon, (void *)sc, tvtohz(&tv));
}
#endif
return(0);
}
@ -378,14 +361,10 @@ aac_daemon(void *arg)
sc = arg;
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
#if __FreeBSD_version >= 800000
mtx_assert(&sc->aac_io_lock, MA_OWNED);
if (callout_pending(&sc->aac_daemontime) ||
callout_active(&sc->aac_daemontime) == 0)
return;
#else
mtx_lock(&sc->aac_io_lock);
#endif
getmicrotime(&tv);
if (!aacraid_alloc_command(sc, &cm)) {
@ -412,14 +391,7 @@ aac_daemon(void *arg)
aacraid_release_command(cm);
}
#if __FreeBSD_version >= 800000
callout_schedule(&sc->aac_daemontime, 30 * 60 * hz);
#else
mtx_unlock(&sc->aac_io_lock);
tv.tv_sec = 30 * 60;
tv.tv_usec = 0;
sc->timeout_id = timeout(aac_daemon, (void *)sc, tvtohz(&tv));
#endif
}
void
@ -762,11 +734,7 @@ aacraid_detach(device_t dev)
sc = device_get_softc(dev);
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
#if __FreeBSD_version >= 800000
callout_drain(&sc->aac_daemontime);
#else
untimeout(aac_daemon, (void *)sc, sc->timeout_id);
#endif
/* Remove the child containers */
while ((co = TAILQ_FIRST(&sc->aac_container_tqh)) != NULL) {
TAILQ_REMOVE(&sc->aac_container_tqh, co, co_link);
@ -2591,10 +2559,8 @@ aac_open(struct cdev *dev, int flags, int fmt, struct thread *td)
sc = dev->si_drv1;
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
#if __FreeBSD_version >= 702000
device_busy(sc->aac_dev);
devfs_set_cdevpriv(sc, aac_cdevpriv_dtor);
#endif
return 0;
}
@ -3077,7 +3043,6 @@ aac_request_aif(struct aac_softc *sc)
}
#if __FreeBSD_version >= 702000
/*
* cdevpriv interface private destructor.
*/
@ -3090,17 +3055,6 @@ aac_cdevpriv_dtor(void *arg)
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
device_unbusy(sc->aac_dev);
}
#else
static int
aac_close(struct cdev *dev, int flags, int fmt, struct thread *td)
{
struct aac_softc *sc;
sc = dev->si_drv1;
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
return 0;
}
#endif
/*
* Handle an AIF sent to us by the controller; queue it for later reference.

View File

@ -49,9 +49,6 @@ __FBSDID("$FreeBSD$");
#include <cam/cam_ccb.h>
#include <cam/cam_debug.h>
#include <cam/cam_periph.h>
#if __FreeBSD_version < 801000
#include <cam/cam_xpt_periph.h>
#endif
#include <cam/cam_sim.h>
#include <cam/cam_xpt_sim.h>
#include <cam/scsi/scsi_all.h>
@ -73,11 +70,9 @@ __FBSDID("$FreeBSD$");
#include <dev/aacraid/aacraid_debug.h>
#include <dev/aacraid/aacraid_var.h>
#if __FreeBSD_version >= 700025
#ifndef CAM_NEW_TRAN_CODE
#define CAM_NEW_TRAN_CODE 1
#endif
#endif
#ifndef SVPD_SUPPORTED_PAGE_LIST
struct scsi_vpd_supported_page_list
@ -93,11 +88,7 @@ struct scsi_vpd_supported_page_list
#endif
/************************** Version Compatibility *************************/
#if __FreeBSD_version < 700031
#define aac_sim_alloc(a,b,c,d,e,f,g,h,i) cam_sim_alloc(a,b,c,d,e,g,h,i)
#else
#define aac_sim_alloc cam_sim_alloc
#endif
struct aac_cam {
device_t dev;
@ -113,10 +104,8 @@ static void aac_cam_action(struct cam_sim *, union ccb *);
static void aac_cam_poll(struct cam_sim *);
static void aac_cam_complete(struct aac_command *);
static void aac_container_complete(struct aac_command *);
#if __FreeBSD_version >= 700000
static void aac_cam_rescan(struct aac_softc *sc, uint32_t channel,
uint32_t target_id);
#endif
static void aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb,
u_int8_t status, u_int8_t key, u_int8_t asc, u_int8_t ascq);
static int aac_load_map_command_sg(struct aac_softc *, struct aac_command *);
@ -154,12 +143,8 @@ static void
aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb, u_int8_t status,
u_int8_t key, u_int8_t asc, u_int8_t ascq)
{
#if __FreeBSD_version >= 900000
struct scsi_sense_data_fixed *sense =
(struct scsi_sense_data_fixed *)&ccb->csio.sense_data;
#else
struct scsi_sense_data *sense = &ccb->csio.sense_data;
#endif
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "Error %d!", status);
@ -179,7 +164,6 @@ aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb, u_int8_t status,
}
}
#if __FreeBSD_version >= 700000
static void
aac_cam_rescan(struct aac_softc *sc, uint32_t channel, uint32_t target_id)
{
@ -215,7 +199,6 @@ aac_cam_rescan(struct aac_softc *sc, uint32_t channel, uint32_t target_id)
break;
}
}
#endif
static void
aac_cam_event(struct aac_softc *sc, struct aac_event *event, void *arg)
@ -327,9 +310,7 @@ aac_cam_attach(device_t dev)
return (EIO);
}
#if __FreeBSD_version >= 700000
inf->aac_sc->cam_rescan_cb = aac_cam_rescan;
#endif
mtx_unlock(&inf->aac_sc->aac_io_lock);
camsc->sim = sim;
@ -1021,9 +1002,7 @@ aac_cam_action(struct cam_sim *sim, union ccb *ccb)
cpi->max_lun = 7; /* Per the controller spec */
cpi->initiator_id = camsc->inf->InitiatorBusId;
cpi->bus_id = camsc->inf->BusNumber;
#if __FreeBSD_version >= 800000
cpi->maxio = sc->aac_max_sectors << 9;
#endif
/*
* Resetting via the passthrough or parallel bus scan

View File

@ -36,9 +36,7 @@ __FBSDID("$FreeBSD$");
*/
#include <sys/param.h>
#if __FreeBSD_version >= 900000
#include <sys/capsicum.h>
#endif
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/kernel.h>
@ -82,16 +80,12 @@ static int
aacraid_linux_ioctl(struct thread *td, struct linux_ioctl_args *args)
{
struct file *fp;
#if __FreeBSD_version >= 900000
cap_rights_t rights;
#endif
u_long cmd;
int error;
if ((error = fget(td, args->fd,
#if __FreeBSD_version >= 900000
cap_rights_init(&rights, CAP_IOCTL),
#endif
&fp)) != 0) {
return (error);
}

View File

@ -33,9 +33,7 @@
*/
#include <sys/bio.h>
#if __FreeBSD_version >= 800000
#include <sys/callout.h>
#endif
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/taskqueue.h>
@ -56,38 +54,17 @@
# define AAC_DRIVER_BUILD 1
#endif
#if __FreeBSD_version <= 601000
#define bus_get_dma_tag(x) NULL
#endif
/* **************************** NewBUS interrupt Crock ************************/
#if __FreeBSD_version < 700031
#define aac_bus_setup_intr(d, i, f, U, if, ifa, hp) \
bus_setup_intr(d, i, f, if, ifa, hp)
#else
#define aac_bus_setup_intr bus_setup_intr
#endif
/* **************************** NewBUS CAM Support ****************************/
#if __FreeBSD_version < 700049
#define aac_xpt_bus_register(sim, parent, bus) \
xpt_bus_register(sim, bus)
#else
#define aac_xpt_bus_register xpt_bus_register
#endif
/**************************** Kernel Thread Support ***************************/
#if __FreeBSD_version > 800001
#define aac_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg)
#define aac_kthread_exit(status) \
kproc_exit(status)
#else
#define aac_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg)
#define aac_kthread_exit(status) \
kthread_exit(status)
#endif
/*
* Driver Parameter Definitions
@ -362,11 +339,7 @@ struct aac_softc
void *aac_intr[AAC_MAX_MSIX]; /* interrupt handle */
struct aac_msix_ctx aac_msix[AAC_MAX_MSIX]; /* context */
eventhandler_tag eh;
#if __FreeBSD_version >= 800000
struct callout aac_daemontime; /* clock daemon callout */
#else
struct callout_handle timeout_id; /* timeout handle */
#endif
/* controller features, limits and status */
int aac_state;