From nobody Fri Dec 10 01:25:51 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AFF9A18DA45F; Fri, 10 Dec 2021 01:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J9CsC3J4Tz4jlc; Fri, 10 Dec 2021 01:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49E3611871; Fri, 10 Dec 2021 01:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BA1PpJr067480; Fri, 10 Dec 2021 01:25:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BA1Ppis067479; Fri, 10 Dec 2021 01:25:51 GMT (envelope-from git) Date: Fri, 10 Dec 2021 01:25:51 GMT Message-Id: <202112100125.1BA1Ppis067479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 63e0f96acecb - main - hpt27xx: Remove FreeBSD 9.x support including Giant. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63e0f96acecb4ca3aba778858361278177333dc1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639099551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9F//MO8E6/fYfHnss1ImX6w1ZXg1A6rkAK+BfA3gcjg=; b=WSI6gK0JWV2NyM2gHRrJIZp/CMj3kQNx2vdEYGedvc2vhJRWXb5sRq7cuuh+wPcdcxTYjc JbZJZv3GSi5/CSTZmZ2l1fERMXgLnDP47uh8z3fYfsHSy7tUGgkg4752DaOYSMzpE0Udjr 7ORI2ZYQd/ig5Jh1GK8aTqrU44jpevWpSGOdptD+7HAHDxM31pUC1B/I1LoWvbPnAIonSC WqZRYQlk5Zx8SIaeJYcdsmDozCzGOmUITI2UmMhqbirpdN8GTer2riya9EWXwTucTSASAK WpWt3jp/JfipEVDTLGbhVZOpfvHnW/I0RGDT5I7hFL7VhEBQL7q2aIAK8SfZwQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639099551; a=rsa-sha256; cv=none; b=P2Ur/Ijm9kWAXEZrdvLgPmXiSrfaXHQ/+FXOmw9Lco6tX5htxR0aD/VuSC6p/QEi5EU7GG x+HDCi7bJWM6xM4Imau9MGYS0d1VmA9MZOfVddCXIbZDMBXRN5UHM8VGtUR9L65UH/OUcC z5TFf802Ug5vJkZIqKDGmn/AaPOC/4V7t3aQcVcPT9l4CtEcs+4VkBfqrbFiKhbBPGU2XI JQZqymKAZpqz2FnIHMTXerj91OvPRyrNUhY6BcYB/mMD0NjPgzpb0GBghmybxi68CDuTkf DOpjf5Xc3w1+DBMvB/bwQLuI2D/ZPRP7YyRXp0p08157P2M3tIyEfVVqGL4Fjg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=63e0f96acecb4ca3aba778858361278177333dc1 commit 63e0f96acecb4ca3aba778858361278177333dc1 Author: Alexander Motin AuthorDate: 2021-12-10 01:24:29 +0000 Commit: Alexander Motin CommitDate: 2021-12-10 01:24:29 +0000 hpt27xx: Remove FreeBSD 9.x support including Giant. MFC after: 2 weeks --- sys/dev/hpt27xx/hpt27xx_os_bsd.c | 6 -- sys/dev/hpt27xx/hpt27xx_osm_bsd.c | 152 +++++--------------------------------- sys/dev/hpt27xx/os_bsd.h | 10 --- 3 files changed, 17 insertions(+), 151 deletions(-) diff --git a/sys/dev/hpt27xx/hpt27xx_os_bsd.c b/sys/dev/hpt27xx/hpt27xx_os_bsd.c index f429cc7142fa..86d72c5736df 100644 --- a/sys/dev/hpt27xx/hpt27xx_os_bsd.c +++ b/sys/dev/hpt27xx/hpt27xx_os_bsd.c @@ -250,14 +250,8 @@ void os_request_timer(void * osext, HPT_U32 interval) PVBUS_EXT vbus_ext = osext; HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS); - -#if (__FreeBSD_version >= 1000510) callout_reset_sbt(&vbus_ext->timer, SBT_1US * interval, 0, os_timer_for_ldm, vbus_ext, 0); -#else - untimeout(os_timer_for_ldm, vbus_ext, vbus_ext->timer); - vbus_ext->timer = timeout(os_timer_for_ldm, vbus_ext, interval * hz / 1000000); -#endif } HPT_TIME os_query_time(void) diff --git a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c index 9a5a27482fab..6defb2fa1399 100644 --- a/sys/dev/hpt27xx/hpt27xx_osm_bsd.c +++ b/sys/dev/hpt27xx/hpt27xx_osm_bsd.c @@ -376,10 +376,8 @@ static void hpt_shutdown_vbus(PVBUS_EXT vbus_ext, int howto) vbus_ext->hba_list = hba->next; free(hba->ldm_adapter.him_handle, M_DEVBUF); } -#if (__FreeBSD_version >= 1000510) callout_drain(&vbus_ext->timer); mtx_destroy(&vbus_ext->lock); -#endif free(vbus_ext, M_DEVBUF); KdPrint(("hpt_shutdown_vbus done")); } @@ -443,11 +441,7 @@ static void os_cmddone(PCOMMAND pCmd) union ccb *ccb = ext->ccb; KdPrint(("<8>os_cmddone(%p, %d)", pCmd, pCmd->Result)); -#if (__FreeBSD_version >= 1000510) callout_stop(&ext->timeout); -#else - untimeout(hpt_timeout, pCmd, ccb->ccb_h.timeout_ch); -#endif switch(pCmd->Result) { case RETURN_SUCCESS: ccb->ccb_h.status = CAM_REQ_CMP; @@ -490,39 +484,13 @@ static int os_buildsgl(PCOMMAND pCmd, PSG pSg, int logical) { POS_CMDEXT ext = (POS_CMDEXT)pCmd->priv; union ccb *ccb = ext->ccb; -#if (__FreeBSD_version >= 1000510) + if(logical) { os_set_sgptr(pSg, (HPT_U8 *)ccb->csio.data_ptr); pSg->size = ccb->csio.dxfer_len; pSg->eot = 1; return TRUE; } -#else - bus_dma_segment_t *sgList = (bus_dma_segment_t *)ccb->csio.data_ptr; - int idx; - - if(logical) { - if (ccb->ccb_h.flags & CAM_DATA_PHYS) - panic("physical address unsupported"); - - if (ccb->ccb_h.flags & CAM_SCATTER_VALID) { - if (ccb->ccb_h.flags & CAM_SG_LIST_PHYS) - panic("physical address unsupported"); - - for (idx = 0; idx < ccb->csio.sglist_cnt; idx++) { - os_set_sgptr(&pSg[idx], (HPT_U8 *)(HPT_UPTR)sgList[idx].ds_addr); - pSg[idx].size = sgList[idx].ds_len; - pSg[idx].eot = (idx==ccb->csio.sglist_cnt-1)? 1 : 0; - } - } - else { - os_set_sgptr(pSg, (HPT_U8 *)ccb->csio.data_ptr); - pSg->size = ccb->csio.dxfer_len; - pSg->eot = 1; - } - return TRUE; - } -#endif /* since we have provided physical sg, nobody will ask us to build physical sg */ HPT_ASSERT(0); return FALSE; @@ -559,11 +527,7 @@ static void hpt_io_dmamap_callback(void *arg, bus_dma_segment_t *segs, int nsegs BUS_DMASYNC_PREWRITE); } } -#if (__FreeBSD_version >= 1000510) callout_reset(&ext->timeout, HPT_OSM_TIMEOUT, hpt_timeout, pCmd); -#else - ext->ccb->ccb_h.timeout_ch = timeout(hpt_timeout, pCmd, HPT_OSM_TIMEOUT); -#endif ldm_queue_cmd(pCmd); } @@ -574,6 +538,7 @@ static void hpt_scsi_io(PVBUS_EXT vbus_ext, union ccb *ccb) PCOMMAND pCmd; POS_CMDEXT ext; HPT_U8 *cdb; + int error; if (ccb->ccb_h.flags & CAM_CDB_POINTER) cdb = ccb->csio.cdb_io.cdb_ptr; @@ -819,50 +784,19 @@ static void hpt_scsi_io(PVBUS_EXT vbus_ext, union ccb *ccb) pCmd->buildsgl = os_buildsgl; pCmd->psg = ext->psg; -#if (__FreeBSD_version < 1000510) - if (ccb->ccb_h.flags & CAM_SCATTER_VALID) { - int idx; - bus_dma_segment_t *sgList = (bus_dma_segment_t *)ccb->csio.data_ptr; - - if (ccb->ccb_h.flags & CAM_SG_LIST_PHYS) - pCmd->flags.physical_sg = 1; - - for (idx = 0; idx < ccb->csio.sglist_cnt; idx++) { - pCmd->psg[idx].addr.bus = sgList[idx].ds_addr; - pCmd->psg[idx].size = sgList[idx].ds_len; - pCmd->psg[idx].eot = (idx==ccb->csio.sglist_cnt-1)? 1 : 0; - } - - ccb->ccb_h.timeout_ch = timeout(hpt_timeout, pCmd, HPT_OSM_TIMEOUT); - ldm_queue_cmd(pCmd); - } - else -#endif - { - int error; - pCmd->flags.physical_sg = 1; -#if (__FreeBSD_version >= 1000510) - error = bus_dmamap_load_ccb(vbus_ext->io_dmat, - ext->dma_map, ccb, - hpt_io_dmamap_callback, pCmd, - BUS_DMA_WAITOK - ); -#else - error = bus_dmamap_load(vbus_ext->io_dmat, - ext->dma_map, - ccb->csio.data_ptr, ccb->csio.dxfer_len, - hpt_io_dmamap_callback, pCmd, - BUS_DMA_WAITOK - ); -#endif - KdPrint(("<8>bus_dmamap_load return %d", error)); - if (error && error!=EINPROGRESS) { - os_printk("bus_dmamap_load error %d", error); - cmdext_put(ext); - ldm_free_cmds(pCmd); - ccb->ccb_h.status = CAM_REQ_CMP_ERR; - xpt_done(ccb); - } + pCmd->flags.physical_sg = 1; + error = bus_dmamap_load_ccb(vbus_ext->io_dmat, + ext->dma_map, ccb, + hpt_io_dmamap_callback, pCmd, + BUS_DMA_WAITOK + ); + KdPrint(("<8>bus_dmamap_load return %d", error)); + if (error && error!=EINPROGRESS) { + os_printk("bus_dmamap_load error %d", error); + cmdext_put(ext); + ldm_free_cmds(pCmd); + ccb->ccb_h.status = CAM_REQ_CMP_ERR; + xpt_done(ccb); } return; } @@ -882,32 +816,17 @@ static void hpt_action(struct cam_sim *sim, union ccb *ccb) KdPrint(("<8>hpt_action(fn=%d, id=%d)", ccb->ccb_h.func_code, ccb->ccb_h.target_id)); -#if (__FreeBSD_version >= 1000510) hpt_assert_vbus_locked(vbus_ext); -#endif switch (ccb->ccb_h.func_code) { -#if (__FreeBSD_version < 1000510) 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; -#else - case XPT_SCSI_IO: - hpt_scsi_io(vbus_ext, ccb); - return; - case XPT_RESET_BUS: - ldm_reset_vbus((PVBUS)vbus_ext->vbus); - break; -#endif case XPT_GET_TRAN_SETTINGS: case XPT_SET_TRAN_SETTINGS: ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; @@ -966,14 +885,10 @@ static void hpt_pci_intr(void *arg) static void hpt_poll(struct cam_sim *sim) { -#if (__FreeBSD_version < 1000510) - hpt_pci_intr(cam_sim_softc(sim)); -#else PVBUS_EXT vbus_ext = (PVBUS_EXT)cam_sim_softc(sim); hpt_assert_vbus_locked(vbus_ext); ldm_intr((PVBUS)vbus_ext->vbus); -#endif } static void hpt_async(void * callback_arg, u_int32_t code, struct cam_path * path, void * arg) @@ -1160,11 +1075,7 @@ static void hpt_final_init(void *dummy) ldm_for_each_vbus(vbus, vbus_ext) { /* make timer available here */ mtx_init(&vbus_ext->lock, "hptsleeplock", NULL, MTX_DEF); -#if (__FreeBSD_version < 1000510) - callout_handle_init(&vbus_ext->timer); -#else callout_init_mtx(&vbus_ext->timer, &vbus_ext->lock, 0); -#endif if (hpt_init_vbus(vbus_ext)) { os_printk("fail to initialize hardware"); break; /* FIXME */ @@ -1207,23 +1118,15 @@ static void hpt_final_init(void *dummy) os_printk("Can't create dma map(%d)", i); return ; } -#if (__FreeBSD_version >= 1000510) callout_init_mtx(&ext->timeout, &vbus_ext->lock, 0); -#endif } if ((devq = cam_simq_alloc(os_max_queue_comm)) == NULL) { os_printk("cam_simq_alloc failed"); return ; } -#if (__FreeBSD_version >= 1000510) 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, &Giant, os_max_queue_comm, /*tagged*/8, devq); -#endif unit_number++; if (!vbus_ext->sim) { os_printk("cam_sim_alloc failed"); @@ -1269,11 +1172,7 @@ static void hpt_final_init(void *dummy) os_printk("can't allocate interrupt"); return ; } -#if (__FreeBSD_version >= 1000510) if (bus_setup_intr(hba->pcidev, hba->irq_res, INTR_TYPE_CAM | INTR_MPSAFE, -#else - if (bus_setup_intr(hba->pcidev, hba->irq_res, INTR_TYPE_CAM, -#endif NULL, hpt_pci_intr, vbus_ext, &hba->irq_handle)) { os_printk("can't set up interrupt"); @@ -1439,16 +1338,8 @@ static int hpt_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, stru if (!ioctl_args.lpOutBuffer) goto invalid; } - -#if __FreeBSD_version < 1000510 - mtx_lock(&Giant); -#endif hpt_do_ioctl(&ioctl_args); - -#if __FreeBSD_version < 1000510 - mtx_unlock(&Giant); -#endif if (ioctl_args.result==HPT_IOCTL_RESULT_OK) { if (piop->nOutBufferSize) { @@ -1488,20 +1379,14 @@ static int hpt_rescan_bus(void) { union ccb *ccb; PVBUS vbus; - PVBUS_EXT vbus_ext; -#if (__FreeBSD_version < 1000510) - mtx_lock(&Giant); -#endif + PVBUS_EXT vbus_ext; + ldm_for_each_vbus(vbus, vbus_ext) { if ((ccb = xpt_alloc_ccb()) == NULL) { return(ENOMEM); } -#if (__FreeBSD_version < 1000510) - if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(vbus_ext->sim), -#else if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(vbus_ext->sim), -#endif CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_free_ccb(ccb); @@ -1509,9 +1394,6 @@ static int hpt_rescan_bus(void) } xpt_rescan(ccb); } -#if (__FreeBSD_version < 1000510) - mtx_unlock(&Giant); -#endif return(0); } diff --git a/sys/dev/hpt27xx/os_bsd.h b/sys/dev/hpt27xx/os_bsd.h index 292ab68c583f..6ee0e5b0fd1f 100644 --- a/sys/dev/hpt27xx/os_bsd.h +++ b/sys/dev/hpt27xx/os_bsd.h @@ -155,9 +155,7 @@ typedef struct _os_cmdext { struct _os_cmdext *next; union ccb *ccb; bus_dmamap_t dma_map; -#if (__FreeBSD_version >= 1000510) struct callout timeout; -#endif SG psg[os_max_sg_descriptors]; } OS_CMDEXT, *POS_CMDEXT; @@ -178,11 +176,7 @@ typedef struct _vbus_ext { OSM_TASK *tasks; struct task worker; -#if (__FreeBSD_version >= 1000510) struct callout timer; -#else - struct callout_handle timer; -#endif eventhandler_tag shutdown_eh; /* the LDM vbus instance continues */ @@ -201,11 +195,7 @@ VBUS_EXT, *PVBUS_EXT; #define HPT_SCAN_BUS _IO('H', 1) -#if __FreeBSD_version < 1000510 -#define TASK_ENQUEUE(task) taskqueue_enqueue(taskqueue_swi_giant,(task)); -#else #define TASK_ENQUEUE(task) taskqueue_enqueue(taskqueue_swi,(task)); -#endif static __inline int hpt_sleep(PVBUS_EXT vbus_ext, void *ident, int priority, const char *wmesg, int timo) {