Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Aug 2014 23:39:35 +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: r269613 - head/sys/dev/hptnr
Message-ID:  <53e16b38.5b98.1bb028c@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Aug  5 23:39:35 2014
New Revision: 269613
URL: http://svnweb.freebsd.org/changeset/base/269613

Log:
  Various fixes to hptnr(4):
  - Use the existing vbus locks instead of Giant for the CAM sim lock.
  - Use callout(9) instead of timeout(9).
  - Mark the interrupt handler MPSAFE.
  - Don't attempt to pass data in the softc from probe() to attach().
  - Remove compat shims for FreeBSD versions older than 8.0.
  
  Reviewed by:	Steve Chang <ychang@highpoint-tech.com>

Modified:
  head/sys/dev/hptnr/hptnr_os_bsd.c
  head/sys/dev/hptnr/hptnr_osm_bsd.c
  head/sys/dev/hptnr/os_bsd.h

Modified: head/sys/dev/hptnr/hptnr_os_bsd.c
==============================================================================
--- head/sys/dev/hptnr/hptnr_os_bsd.c	Tue Aug  5 23:35:19 2014	(r269612)
+++ head/sys/dev/hptnr/hptnr_os_bsd.c	Tue Aug  5 23:39:35 2014	(r269613)
@@ -86,25 +86,10 @@ BUS_ADDRESS get_dmapool_phy_addr(void *o
 	return (BUS_ADDRESS)vtophys(dmapool_virt_addr);
 }
 
-#if __FreeBSD_version < 500043
-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;
-}/* PCI space access */
-#else 
 HPT_U32 pcicfg_read_dword(HPT_U8 bus, HPT_U8 dev, HPT_U8 func, HPT_U8 reg)
 {
 	return (HPT_U32)pci_cfgregread(bus, dev, func, reg, 4);;
 }/* PCI space access */
-#endif
 
 void *os_map_pci_bar(
     void *osext, 
@@ -249,9 +234,9 @@ void  os_request_timer(void * osext, HPT
 	PVBUS_EXT vbus_ext = osext;
 
 	HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS);
-	
-	untimeout(os_timer_for_ldm, vbus_ext, vbus_ext->timer);
-	vbus_ext->timer = timeout(os_timer_for_ldm, vbus_ext, interval * hz / 1000000);
+
+	callout_reset(&vbus_ext->timer, interval * hz / 1000000,
+	    os_timer_for_ldm, vbus_ext);
 }
 
 HPT_TIME os_query_time(void)

Modified: head/sys/dev/hptnr/hptnr_osm_bsd.c
==============================================================================
--- head/sys/dev/hptnr/hptnr_osm_bsd.c	Tue Aug  5 23:35:19 2014	(r269612)
+++ head/sys/dev/hptnr/hptnr_osm_bsd.c	Tue Aug  5 23:39:35 2014	(r269613)
@@ -31,12 +31,11 @@
 #include <dev/hptnr/os_bsd.h>
 #include <dev/hptnr/hptintf.h>
 
-static int hpt_probe(device_t dev)
+static HIM *hpt_match(device_t dev)
 {
 	PCI_ID pci_id;
 	HIM *him;
 	int i;
-	PHBA hba;
 
 	for (him = him_list; him; him = him->next) {
 		for (i=0; him->get_supported_device_id(i, &pci_id); i++) {
@@ -44,36 +43,46 @@ static int hpt_probe(device_t dev)
 				him->get_controller_count(&pci_id,0,0);
 			if ((pci_get_vendor(dev) == pci_id.vid) &&
 				(pci_get_device(dev) == pci_id.did)){
-				KdPrint(("hpt_probe: adapter at PCI %d:%d:%d, IRQ %d",
-					pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev), pci_get_irq(dev)
-				));
-				device_set_desc(dev, him->name);
-				hba = (PHBA)device_get_softc(dev);
-				memset(hba, 0, sizeof(HBA));
-				hba->ext_type = EXT_TYPE_HBA;
-				hba->ldm_adapter.him = him;
-				return 0;
+				return (him);
 			}
 		}
 	}
 
+	return (NULL);
+}
+
+static int hpt_probe(device_t dev)
+{
+	HIM *him;
+
+	him = hpt_match(dev);
+	if (him != NULL) {
+		KdPrint(("hpt_probe: adapter at PCI %d:%d:%d, IRQ %d",
+			pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev), pci_get_irq(dev)
+			));
+		device_set_desc(dev, him->name);
+		return (BUS_PROBE_DEFAULT);
+	}
+
 	return (ENXIO);
 }
 
 static int hpt_attach(device_t dev)
 {
 	PHBA hba = (PHBA)device_get_softc(dev);
-	HIM *him = hba->ldm_adapter.him;
+	HIM *him;
 	PCI_ID pci_id;
 	HPT_UINT size;
 	PVBUS vbus;
 	PVBUS_EXT vbus_ext;
 	
 	KdPrint(("hpt_attach(%d/%d/%d)", pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev)));
-	
-#if __FreeBSD_version >=440000
+
+	him = hpt_match(dev);
+	hba->ext_type = EXT_TYPE_HBA;
+	hba->ldm_adapter.him = him;
+
 	pci_enable_busmaster(dev);
-#endif
 
 	pci_id.vid = pci_get_vendor(dev);
 	pci_id.did = pci_get_device(dev);
@@ -82,8 +91,6 @@ static int hpt_attach(device_t dev)
 
 	size = him->get_adapter_size(&pci_id);
 	hba->ldm_adapter.him_handle = malloc(size, M_DEVBUF, M_WAITOK);
-	if (!hba->ldm_adapter.him_handle)
-		return ENXIO;
 
 	hba->pcidev = dev;
 	hba->pciaddr.tree = 0;
@@ -93,7 +100,7 @@ static int hpt_attach(device_t dev)
 
 	if (!him->create_adapter(&pci_id, hba->pciaddr, hba->ldm_adapter.him_handle, hba)) {
 		free(hba->ldm_adapter.him_handle, M_DEVBUF);
-		return -1;
+		return ENXIO;
 	}
 
 	os_printk("adapter at PCI %d:%d:%d, IRQ %d",
@@ -101,12 +108,8 @@ static int hpt_attach(device_t dev)
 
 	if (!ldm_register_adapter(&hba->ldm_adapter)) {
 		size = ldm_get_vbus_size();
-		vbus_ext = malloc(sizeof(VBUS_EXT) + size, M_DEVBUF, M_WAITOK);
-		if (!vbus_ext) {
-			free(hba->ldm_adapter.him_handle, M_DEVBUF);
-			return -1;
-		}
-		memset(vbus_ext, 0, sizeof(VBUS_EXT));
+		vbus_ext = malloc(sizeof(VBUS_EXT) + size, M_DEVBUF, M_WAITOK |
+			M_ZERO);
 		vbus_ext->ext_type = EXT_TYPE_VBUS;
 		ldm_create_vbus((PVBUS)vbus_ext->vbus, vbus_ext);
 		ldm_register_adapter(&hba->ldm_adapter);
@@ -287,7 +290,7 @@ static int hpt_flush_vdev(PVBUS_EXT vbus
 
 	KdPrint(("flusing dev %p", vd));
 
-	hpt_lock_vbus(vbus_ext);
+	hpt_assert_vbus_locked(vbus_ext);
 
 	if (mIsArray(vd->type) && vd->u.array.transform)
 		count = MAX(vd->u.array.transform->source->cmds_per_request,
@@ -298,7 +301,6 @@ static int hpt_flush_vdev(PVBUS_EXT vbus
 	pCmd = ldm_alloc_cmds(vd->vbus, count);
 
 	if (!pCmd) {
-		hpt_unlock_vbus(vbus_ext);
 		return -1;
 	}
 
@@ -324,8 +326,6 @@ static int hpt_flush_vdev(PVBUS_EXT vbus
 
 	ldm_free_cmds(pCmd);
 
-	hpt_unlock_vbus(vbus_ext);
-
 	return result;
 }
 
@@ -340,6 +340,7 @@ static void hpt_shutdown_vbus(PVBUS_EXT 
 
 	/* stop all ctl tasks and disable the worker taskqueue */
 	hpt_stop_tasks(vbus_ext);
+	hpt_lock_vbus(vbus_ext);
 	vbus_ext->worker.ta_context = 0;
 
 	/* flush devices */
@@ -352,7 +353,6 @@ static void hpt_shutdown_vbus(PVBUS_EXT 
 		}
 	}
 
-	hpt_lock_vbus(vbus_ext);
 	ldm_shutdown(vbus);
 	hpt_unlock_vbus(vbus_ext);
 
@@ -368,6 +368,8 @@ static void hpt_shutdown_vbus(PVBUS_EXT 
 		free(hba->ldm_adapter.him_handle, M_DEVBUF);
 	}
 
+	callout_drain(&vbus_ext->timer);
+	mtx_destroy(&vbus_ext->lock);
 	free(vbus_ext, M_DEVBUF);
 	KdPrint(("hpt_shutdown_vbus done"));
 }
@@ -431,8 +433,8 @@ static void os_cmddone(PCOMMAND pCmd)
 	union ccb *ccb = ext->ccb;
 
 	KdPrint(("os_cmddone(%p, %d)", pCmd, pCmd->Result));
-	
-	untimeout(hpt_timeout, pCmd, ext->timeout_ch);
+
+	callout_stop(&ext->timeout);
 
 	switch(pCmd->Result) {
 	case RETURN_SUCCESS:
@@ -511,7 +513,7 @@ static void hpt_io_dmamap_callback(void 
 		}
 	}
 
-	ext->timeout_ch = timeout(hpt_timeout, pCmd, HPT_OSM_TIMEOUT);
+	callout_reset(&ext->timeout, HPT_OSM_TIMEOUT, hpt_timeout, pCmd);
 	ldm_queue_cmd(pCmd);
 }
 
@@ -728,18 +730,15 @@ static void hpt_action(struct cam_sim *s
 
 	KdPrint(("hpt_action(fn=%d, id=%d)", ccb->ccb_h.func_code, ccb->ccb_h.target_id));
 
+	hpt_assert_vbus_locked(vbus_ext);
 	switch (ccb->ccb_h.func_code) {
 	
 	case XPT_SCSI_IO:
-		hpt_lock_vbus(vbus_ext);
 		hpt_scsi_io(vbus_ext, ccb);
-		hpt_unlock_vbus(vbus_ext);
 		return;
 
 	case XPT_RESET_BUS:
-		hpt_lock_vbus(vbus_ext);
 		ldm_reset_vbus((PVBUS)vbus_ext->vbus);
-		hpt_unlock_vbus(vbus_ext);
 		break;
 
 	case XPT_GET_TRAN_SETTINGS:
@@ -773,12 +772,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;
 	}
@@ -802,7 +799,9 @@ static void hpt_pci_intr(void *arg)
 
 static void hpt_poll(struct cam_sim *sim)
 {
-	hpt_pci_intr(cam_sim_softc(sim));
+	PVBUS_EXT vbus_ext = cam_sim_softc(sim);
+	hpt_assert_vbus_locked(vbus_ext);
+	ldm_intr((PVBUS)vbus_ext->vbus);
 }
 
 static void hpt_async(void * callback_arg, u_int32_t code, struct cam_path * path, void * arg)
@@ -951,19 +950,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;
@@ -1000,7 +987,8 @@ static void hpt_final_init(void *dummy)
 	/* initializing hardware */
 	ldm_for_each_vbus(vbus, vbus_ext) {
 		/* make timer available here */
-		callout_handle_init(&vbus_ext->timer);
+		mtx_init(&vbus_ext->lock, "hptsleeplock", NULL, MTX_DEF);
+		callout_init_mtx(&vbus_ext->timer, &vbus_ext->lock, 0);
 		if (hpt_init_vbus(vbus_ext)) {
 			os_printk("fail to initialize hardware");
 			break; /* FIXME */
@@ -1012,9 +1000,6 @@ static void hpt_final_init(void *dummy)
 		struct cam_devq *devq;
 		struct ccb_setasync	ccb;
 		
-#if (__FreeBSD_version >= 500000)
-		mtx_init(&vbus_ext->lock, "hptsleeplock", NULL, MTX_DEF);
-#endif
 		if (bus_dma_tag_create(NULL,/* parent */
 				4,	/* alignment */
 				BUS_SPACE_MAXADDR_32BIT+1, /* boundary */
@@ -1025,10 +1010,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 ;
@@ -1048,7 +1031,7 @@ static void hpt_final_init(void *dummy)
 				os_printk("Can't create dma map(%d)", i);
 				return ;
 			}
-			callout_handle_init(&ext->timeout_ch);
+			callout_init_mtx(&ext->timeout, &vbus_ext->lock, 0);
 		}
 
 		if ((devq = cam_simq_alloc(os_max_queue_comm)) == NULL) {
@@ -1056,25 +1039,19 @@ 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, &Giant, os_max_queue_comm, /*tagged*/8,  devq);
-#else 
+		hpt_lock_vbus(vbus_ext);
 		vbus_ext->sim = cam_sim_alloc(hpt_action, hpt_poll, driver_name,
-				vbus_ext, unit_number, os_max_queue_comm, /*tagged*/8,  devq);
-#endif
+				vbus_ext, unit_number, &vbus_ext->lock,
+				os_max_queue_comm, /*tagged*/8,  devq);
 		unit_number++;
 		if (!vbus_ext->sim) {
 			os_printk("cam_sim_alloc failed");
 			cam_simq_free(devq);
+			hpt_unlock_vbus(vbus_ext);
 			return ;
 		}
 
-#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
 			os_printk("xpt_bus_register failed");
 			cam_sim_free(vbus_ext->sim, /*free devq*/ TRUE);
 			vbus_ext->sim = NULL;
@@ -1088,9 +1065,11 @@ static void hpt_final_init(void *dummy)
 			os_printk("xpt_create_path failed");
 			xpt_bus_deregister(cam_sim_path(vbus_ext->sim));
 			cam_sim_free(vbus_ext->sim, /*free_devq*/TRUE);
+			hpt_unlock_vbus(vbus_ext);
 			vbus_ext->sim = NULL;
 			return ;
 		}
+		hpt_unlock_vbus(vbus_ext);
 
 		xpt_setup_ccb(&ccb.ccb_h, vbus_ext->path, /*priority*/5);
 		ccb.ccb_h.func_code = XPT_SASYNC_CB;
@@ -1108,12 +1087,8 @@ static void hpt_final_init(void *dummy)
 				return ;
 			}
 			
-			if (bus_setup_intr(hba->pcidev, hba->irq_res, INTR_TYPE_CAM,
-#if __FreeBSD_version > 700025
+			if (bus_setup_intr(hba->pcidev, hba->irq_res, INTR_TYPE_CAM | INTR_MPSAFE,
 				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 ;
@@ -1138,7 +1113,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 {
@@ -1230,29 +1205,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;
@@ -1291,16 +1254,8 @@ static int hpt_ioctl(ioctl_dev_t dev, u_
 				goto invalid;
 		}
 		
-#if (__FreeBSD_version >= 500000)
-		mtx_lock(&Giant);
-#endif
-
 		hpt_do_ioctl(&ioctl_args);
 	
-#if (__FreeBSD_version >= 500000)
-		mtx_unlock(&Giant);
-#endif
-
 		if (ioctl_args.result==HPT_IOCTL_RESULT_OK) {
 			if (piop->nOutBufferSize) {
 				if (copyout(ioctl_args.lpOutBuffer,
@@ -1341,8 +1296,6 @@ static int	hpt_rescan_bus(void)
 	PVBUS 				vbus;
 	PVBUS_EXT			vbus_ext;	
 		
-	mtx_lock(&Giant);
-
 	ldm_for_each_vbus(vbus, vbus_ext) {
 		if ((ccb = xpt_alloc_ccb()) == NULL)
 		{
@@ -1356,6 +1309,5 @@ static int	hpt_rescan_bus(void)
 		}
 		xpt_rescan(ccb);
 	}
-	mtx_unlock(&Giant);
 	return(0);	
 }

Modified: head/sys/dev/hptnr/os_bsd.h
==============================================================================
--- head/sys/dev/hptnr/os_bsd.h	Tue Aug  5 23:35:19 2014	(r269612)
+++ head/sys/dev/hptnr/os_bsd.h	Tue Aug  5 23:39:35 2014	(r269613)
@@ -40,12 +40,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>
@@ -53,11 +49,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>
@@ -65,9 +59,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>
@@ -75,17 +67,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>
@@ -97,10 +80,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;
@@ -176,7 +155,7 @@ typedef struct _os_cmdext {
 	struct _os_cmdext *next;
 	union ccb         *ccb;
 	bus_dmamap_t       dma_map;
-	struct callout_handle timeout_ch;
+	struct callout     timeout;
 	SG                 psg[os_max_sg_descriptors];
 }
 OS_CMDEXT, *POS_CMDEXT;
@@ -190,11 +169,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;
@@ -202,7 +177,7 @@ typedef struct _vbus_ext {
 	OSM_TASK         *tasks;
 	struct task       worker;
 	
-	struct callout_handle timer;
+	struct callout    timer;
 
 	eventhandler_tag  shutdown_eh;
 	
@@ -211,19 +186,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)
-#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_assert_vbus_locked(vbus_ext)	mtx_assert(&(vbus_ext)->lock, MA_OWNED)
 
 
 #define HPT_OSM_TIMEOUT (20*hz)  /* timeout value for OS commands */
@@ -232,36 +197,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?53e16b38.5b98.1bb028c>