Date: Tue, 5 Aug 2014 23:32:53 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269611 - head/sys/dev/hpt27xx Message-ID: <53e169a5.5b5c.574add41@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Tue Aug 5 23:32:53 2014 New Revision: 269611 URL: http://svnweb.freebsd.org/changeset/base/269611 Log: Remove compat shims for FreeBSD versions older than 8.0. Reviewed by: Steve Chang <ychang@highpoint-tech.com> Modified: head/sys/dev/hpt27xx/hpt27xx_os_bsd.c head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c head/sys/dev/hpt27xx/os_bsd.h Modified: head/sys/dev/hpt27xx/hpt27xx_os_bsd.c ============================================================================== --- head/sys/dev/hpt27xx/hpt27xx_os_bsd.c Tue Aug 5 23:16:31 2014 (r269610) +++ head/sys/dev/hpt27xx/hpt27xx_os_bsd.c Tue Aug 5 23:32:53 2014 (r269611) @@ -78,57 +78,9 @@ void os_pci_writel (void *osext, HPT_U8 pci_write_config(((PHBA)osext)->pcidev, offset, value, 4); } -#if __FreeBSD_version < 500043 /* PCI space access */ HPT_U8 pcicfg_read_byte (HPT_U8 bus, HPT_U8 dev, HPT_U8 func, HPT_U8 reg) { - HPT_U8 v; - pcicfgregs pciref; - - pciref.bus = bus; - pciref.slot = dev; - pciref.func = func; - - v = pci_cfgread(&pciref, reg, 1); - return v; -} -HPT_U32 pcicfg_read_dword(HPT_U8 bus, HPT_U8 dev, HPT_U8 func, HPT_U8 reg) -{ - HPT_U32 v; - pcicfgregs pciref; - - pciref.bus = bus; - pciref.slot = dev; - pciref.func = func; - - v = pci_cfgread(&pciref, reg, 4); - return v; -} -void pcicfg_write_byte (HPT_U8 bus, HPT_U8 dev, HPT_U8 func, HPT_U8 reg, HPT_U8 v) -{ - pcicfgregs pciref; - - pciref.hose = -1; - pciref.bus = bus; - pciref.slot = dev; - pciref.func = func; - - pci_cfgwrite(&pciref, reg, v, 1); -} -void pcicfg_write_dword(HPT_U8 bus, HPT_U8 dev, HPT_U8 func, HPT_U8 reg, HPT_U32 v) -{ - pcicfgregs pciref; - - pciref.hose = -1; - pciref.bus = bus; - pciref.slot = dev; - pciref.func = func; - - pci_cfgwrite(&pciref, reg, v, 4); -}/* PCI space access */ -#else -HPT_U8 pcicfg_read_byte (HPT_U8 bus, HPT_U8 dev, HPT_U8 func, HPT_U8 reg) -{ return (HPT_U8)pci_cfgregread(bus, dev, func, reg, 1); } HPT_U32 pcicfg_read_dword(HPT_U8 bus, HPT_U8 dev, HPT_U8 func, HPT_U8 reg) @@ -143,7 +95,6 @@ void pcicfg_write_dword(HPT_U8 bus, HPT_ { pci_cfgregwrite(bus, dev, func, reg, v, 4); }/* PCI space access */ -#endif void *os_map_pci_bar( void *osext, Modified: head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c ============================================================================== --- head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Tue Aug 5 23:16:31 2014 (r269610) +++ head/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Tue Aug 5 23:32:53 2014 (r269611) @@ -80,9 +80,7 @@ static int hpt_attach(device_t dev) him = hpt_match(dev); hba->ext_type = EXT_TYPE_HBA; hba->ldm_adapter.him = him; -#if __FreeBSD_version >=440000 pci_enable_busmaster(dev); -#endif pci_id.vid = pci_get_vendor(dev); pci_id.did = pci_get_device(dev); @@ -788,12 +786,10 @@ static void hpt_action(struct cam_sim *s strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strncpy(cpi->hba_vid, "HPT ", HBA_IDLEN); strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); -#if (__FreeBSD_version >= 800000) cpi->transport = XPORT_SPI; cpi->transport_version = 2; cpi->protocol = PROTO_SCSI; cpi->protocol_version = SCSI_REV_2; -#endif cpi->ccb_h.status = CAM_REQ_CMP; break; } @@ -969,19 +965,7 @@ static struct cdevsw hpt_cdevsw = { .d_close = hpt_close, .d_ioctl = hpt_ioctl, .d_name = driver_name, -#if __FreeBSD_version>=503000 .d_version = D_VERSION, -#endif -#if (__FreeBSD_version>=503000 && __FreeBSD_version<600034) - .d_flags = D_NEEDGIANT, -#endif -#if __FreeBSD_version<600034 -#if __FreeBSD_version>501000 - .d_maj = MAJOR_AUTO, -#else - .d_maj = HPT_DEV_MAJOR, -#endif -#endif }; static struct intr_config_hook hpt_ich; @@ -1018,9 +1002,7 @@ static void hpt_final_init(void *dummy) /* initializing hardware */ ldm_for_each_vbus(vbus, vbus_ext) { /* make timer available here */ -#if (__FreeBSD_version >= 500000) mtx_init(&vbus_ext->lock, "hptsleeplock", NULL, MTX_DEF); -#endif callout_init_mtx(&vbus_ext->timer, &vbus_ext->lock, 0); if (hpt_init_vbus(vbus_ext)) { os_printk("fail to initialize hardware"); @@ -1043,10 +1025,8 @@ static void hpt_final_init(void *dummy) os_max_sg_descriptors, /* nsegments */ 0x10000, /* maxsegsize */ BUS_DMA_WAITOK, /* flags */ -#if __FreeBSD_version>502000 busdma_lock_mutex, /* lockfunc */ &vbus_ext->lock, /* lockfuncarg */ -#endif &vbus_ext->io_dmat /* tag */)) { return ; @@ -1074,13 +1054,8 @@ static void hpt_final_init(void *dummy) return ; } -#if __FreeBSD_version > 700025 vbus_ext->sim = cam_sim_alloc(hpt_action, hpt_poll, driver_name, vbus_ext, unit_number, &vbus_ext->lock, os_max_queue_comm, /*tagged*/8, devq); -#else - vbus_ext->sim = cam_sim_alloc(hpt_action, hpt_poll, driver_name, - vbus_ext, unit_number, os_max_queue_comm, /*tagged*/8, devq); -#endif unit_number++; if (!vbus_ext->sim) { os_printk("cam_sim_alloc failed"); @@ -1089,11 +1064,7 @@ static void hpt_final_init(void *dummy) } hpt_lock_vbus(vbus_ext); -#if __FreeBSD_version > 700044 if (xpt_bus_register(vbus_ext->sim, NULL, 0) != CAM_SUCCESS) { -#else - if (xpt_bus_register(vbus_ext->sim, 0) != CAM_SUCCESS) { -#endif hpt_unlock_vbus(vbus_ext); os_printk("xpt_bus_register failed"); cam_sim_free(vbus_ext->sim, /*free devq*/ TRUE); @@ -1131,11 +1102,7 @@ static void hpt_final_init(void *dummy) } if (bus_setup_intr(hba->pcidev, hba->irq_res, INTR_TYPE_CAM | INTR_MPSAFE, -#if __FreeBSD_version > 700025 NULL, hpt_pci_intr, vbus_ext, &hba->irq_handle)) -#else - hpt_pci_intr, vbus_ext, &hba->irq_handle)) -#endif { os_printk("can't set up interrupt"); return ; @@ -1160,7 +1127,7 @@ static void hpt_final_init(void *dummy) S_IRUSR | S_IWUSR, "%s", driver_name); } -#if defined(KLD_MODULE) && (__FreeBSD_version >= 503000) +#if defined(KLD_MODULE) typedef struct driverlink *driverlink_t; struct driverlink { @@ -1252,29 +1219,17 @@ __DRIVER_MODULE(TARGETNAME, pci, hpt_pci __MODULE_VERSION(TARGETNAME, 1); __MODULE_DEPEND(TARGETNAME, cam, 1, 1, 1); -#if __FreeBSD_version>503000 -typedef struct cdev * ioctl_dev_t; -#else -typedef dev_t ioctl_dev_t; -#endif - -#if __FreeBSD_version >= 500000 -typedef struct thread * ioctl_thread_t; -#else -typedef struct proc * ioctl_thread_t; -#endif - -static int hpt_open(ioctl_dev_t dev, int flags, int devtype, ioctl_thread_t td) +static int hpt_open(struct cdev *dev, int flags, int devtype, struct thread *td) { return 0; } -static int hpt_close(ioctl_dev_t dev, int flags, int devtype, ioctl_thread_t td) +static int hpt_close(struct cdev *dev, int flags, int devtype, struct thread *td) { return 0; } -static int hpt_ioctl(ioctl_dev_t dev, u_long cmd, caddr_t data, int fflag, ioctl_thread_t td) +static int hpt_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { PHPT_IOCTL_PARAM piop=(PHPT_IOCTL_PARAM)data; IOCTL_ARG ioctl_args; Modified: head/sys/dev/hpt27xx/os_bsd.h ============================================================================== --- head/sys/dev/hpt27xx/os_bsd.h Tue Aug 5 23:16:31 2014 (r269610) +++ head/sys/dev/hpt27xx/os_bsd.h Tue Aug 5 23:32:53 2014 (r269611) @@ -38,12 +38,8 @@ #include <sys/param.h> #include <sys/types.h> #include <sys/cons.h> -#if (__FreeBSD_version >= 500000) #include <sys/time.h> #include <sys/systm.h> -#else -#include <machine/clock.h> /*to support DELAY function under 4.x BSD versions*/ -#endif #include <sys/stat.h> #include <sys/malloc.h> @@ -51,11 +47,9 @@ #include <sys/libkern.h> #include <sys/kernel.h> -#if (__FreeBSD_version >= 500000) #include <sys/kthread.h> #include <sys/mutex.h> #include <sys/module.h> -#endif #include <sys/eventhandler.h> #include <sys/bus.h> @@ -63,9 +57,7 @@ #include <sys/ioccom.h> #include <machine/resource.h> -#if __FreeBSD_version >= 500043 #include <machine/pci_cfgreg.h> -#endif #include <machine/bus.h> #include <machine/stdarg.h> #include <sys/rman.h> @@ -73,17 +65,8 @@ #include <vm/vm.h> #include <vm/pmap.h> -#if (__FreeBSD_version >= 500000) #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> -#else -#include <pci/pcivar.h> -#include <pci/pcireg.h> -#endif - -#if (__FreeBSD_version <= 500043) -#include <sys/devicestat.h> -#endif #include <cam/cam.h> #include <cam/cam_ccb.h> @@ -95,10 +78,6 @@ #include <cam/scsi/scsi_all.h> #include <cam/scsi/scsi_message.h> -#if (__FreeBSD_version < 500043) -#include <sys/bus_private.h> -#endif - typedef struct _INQUIRYDATA { u_char DeviceType : 5; @@ -188,11 +167,7 @@ typedef struct _vbus_ext { struct cam_sim *sim; /* sim for this vbus */ struct cam_path *path; /* peripheral, path, tgt, lun with this vbus */ -#if (__FreeBSD_version >= 500000) struct mtx lock; /* general purpose lock */ -#else - int hpt_splx; -#endif bus_dma_tag_t io_dmat; /* I/O buffer DMA tag */ POS_CMDEXT cmdext_list; @@ -209,20 +184,9 @@ typedef struct _vbus_ext { } VBUS_EXT, *PVBUS_EXT; -#if __FreeBSD_version >= 500000 #define hpt_lock_vbus(vbus_ext) mtx_lock(&(vbus_ext)->lock) #define hpt_unlock_vbus(vbus_ext) mtx_unlock(&(vbus_ext)->lock) #define hpt_assert_vbus_locked(vbus_ext) mtx_assert(&(vbus_ext)->lock, MA_OWNED) -#else -static __inline void hpt_lock_vbus(PVBUS_EXT vbus_ext) -{ - vbus_ext->hpt_splx = splcam(); -} -static __inline void hpt_unlock_vbus(PVBUS_EXT vbus_ext) -{ - splx(vbus_ext->hpt_splx); -} -#endif #define HPT_OSM_TIMEOUT (20*hz) /* timeout value for OS commands */ @@ -231,35 +195,9 @@ static __inline void hpt_unlock_vbus(PVB #define HPT_SCAN_BUS _IO('H', 1) -#if __FreeBSD_version >= 501000 -#define TASK_ENQUEUE(task) taskqueue_enqueue(taskqueue_swi_giant,(task)); -#else #define TASK_ENQUEUE(task) taskqueue_enqueue(taskqueue_swi,(task)); -#endif -#if __FreeBSD_version >= 500000 static __inline int hpt_sleep(PVBUS_EXT vbus_ext, void *ident, int priority, const char *wmesg, int timo) { return msleep(ident, &vbus_ext->lock, priority, wmesg, timo); } -#else -static __inline int hpt_sleep(PVBUS_EXT vbus_ext, void *ident, int priority, const char *wmesg, int timo) -{ - int retval = 0; - - asleep(ident, priority, wmesg, timo); - hpt_unlock_vbus(vbus_ext); - retval = await(priority, timo); - hpt_lock_vbus(vbus_ext); - - return retval; -} -#endif - -#if __FreeBSD_version < 501000 -#define READ_16 0x88 -#define WRITE_16 0x8a -#define SERVICE_ACTION_IN 0x9e -#endif - -#define HPT_DEV_MAJOR 200
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53e169a5.5b5c.574add41>