From owner-svn-src-all@freebsd.org Wed Nov 22 20:27:48 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1810BDF4BAF; Wed, 22 Nov 2017 20:27:48 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF02A686A6; Wed, 22 Nov 2017 20:27:47 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAMKRk8o077845; Wed, 22 Nov 2017 20:27:46 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAMKRkTc077837; Wed, 22 Nov 2017 20:27:46 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201711222027.vAMKRkTc077837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Wed, 22 Nov 2017 20:27:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326102 - in head/sys: conf dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/cores/chipc/pwrctl dev/bhnd/cores/pmu dev/bhnd/siba mips/broadcom modules/bhnd modules/bh... X-SVN-Group: head X-SVN-Commit-Author: landonf X-SVN-Commit-Paths: in head/sys: conf dev/bhnd dev/bhnd/bcma dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/cores/chipc/pwrctl dev/bhnd/cores/pmu dev/bhnd/siba mips/broadcom modules/bhnd modules/bhnd/bhndb modules/bhnd/bhn... X-SVN-Commit-Revision: 326102 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Nov 2017 20:27:48 -0000 Author: landonf Date: Wed Nov 22 20:27:46 2017 New Revision: 326102 URL: https://svnweb.freebsd.org/changeset/base/326102 Log: bhnd(4): extend the PMU APIs to support bwn(4) The bwn(4) driver requires a number of extensions to the bhnd(4) PMU interface to support external configuration of PLLs, LDOs, and other parameters that require chipset or PHY-specific workarounds. These changes add support for: - Writing raw voltage register values to PHY-specific LDO regulator registers (required by LP-PHY). - Enabling/disabling PHY-specific LDOs (required by LP-PHY) - Writing to arbitrary PMU chipctrl registers (required for common PHY PLL reset support). - Requesting chipset/PLL-specific spurious signal avoidance modes. - Querying clock frequency and latency. Additionally, rather than updating legacy PWRCTL support to conform to the new PMU interface: - PWRCTL API is now provided by a bhnd_pwrctl_if.m interface. - Since PWRCTL is only found in older SSB-based chipsets, translation from bhnd(4) bus APIs to corresponding PWRCTL operations is now handled entirely within the siba(4) driver. - The PWRCTL-specific host bridge clock gating APIs in bhnd_bus_if.m have been lifted out into a standalone bhnd_pwrctl_hostb_if.m interface. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12664 Added: head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.h (contents, props changed) head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_hostb_if.m (contents, props changed) head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_if.m (contents, props changed) head/sys/dev/bhnd/cores/pmu/bhnd_pmu_types.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/bhnd/bcma/bcma.c head/sys/dev/bhnd/bcma/bcmavar.h head/sys/dev/bhnd/bhnd.c head/sys/dev/bhnd/bhnd.h head/sys/dev/bhnd/bhnd_bus_if.m head/sys/dev/bhnd/bhnd_private.h head/sys/dev/bhnd/bhnd_subr.c head/sys/dev/bhnd/bhnd_types.h head/sys/dev/bhnd/bhndb/bhnd_bhndb.c head/sys/dev/bhnd/bhndb/bhndb_pci.c head/sys/dev/bhnd/bhndreg.h head/sys/dev/bhnd/bhndvar.h head/sys/dev/bhnd/cores/chipc/chipc.c head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.c head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_private.h head/sys/dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_subr.c head/sys/dev/bhnd/cores/pmu/bhnd_pmu.c head/sys/dev/bhnd/cores/pmu/bhnd_pmu.h head/sys/dev/bhnd/cores/pmu/bhnd_pmu_core.c head/sys/dev/bhnd/cores/pmu/bhnd_pmu_if.m head/sys/dev/bhnd/cores/pmu/bhnd_pmu_private.h head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c head/sys/dev/bhnd/cores/pmu/bhnd_pmureg.h head/sys/dev/bhnd/cores/pmu/bhnd_pmuvar.h head/sys/dev/bhnd/siba/siba.c head/sys/dev/bhnd/siba/siba_bhndb.c head/sys/dev/bhnd/siba/siba_subr.c head/sys/dev/bhnd/siba/sibavar.h head/sys/mips/broadcom/siba_nexus.c head/sys/modules/bhnd/Makefile head/sys/modules/bhnd/bhndb/Makefile head/sys/modules/bhnd/bhndb_pci/Makefile head/sys/modules/bhnd/siba/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Nov 22 19:58:29 2017 (r326101) +++ head/sys/conf/files Wed Nov 22 20:27:46 2017 (r326102) @@ -1250,6 +1250,8 @@ dev/bhnd/cores/chipc/chipc_slicer.c optional bhnd cfi dev/bhnd/cores/chipc/chipc_spi.c optional bhnd spibus dev/bhnd/cores/chipc/chipc_subr.c optional bhnd dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl.c optional bhnd +dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_if.m optional bhnd +dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_hostb_if.m optional bhnd dev/bhnd/cores/chipc/pwrctl/bhnd_pwrctl_subr.c optional bhnd dev/bhnd/cores/pci/bhnd_pci.c optional bhnd pci dev/bhnd/cores/pci/bhnd_pci_hostb.c optional bhndb bhnd pci Modified: head/sys/dev/bhnd/bcma/bcma.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma.c Wed Nov 22 19:58:29 2017 (r326101) +++ head/sys/dev/bhnd/bcma/bcma.c Wed Nov 22 20:27:46 2017 (r326102) @@ -193,7 +193,7 @@ bcma_write_ivar(device_t dev, device_t child, int inde case BHND_IVAR_CORE_UNIT: return (EINVAL); case BHND_IVAR_PMU_INFO: - dinfo->pmu_info = (struct bhnd_core_pmu_info *) value; + dinfo->pmu_info = (void *)value; return (0); default: return (ENOENT); @@ -349,17 +349,15 @@ bcma_reset_hw(device_t dev, device_t child, uint16_t i static int bcma_suspend_hw(device_t dev, device_t child) { - struct bcma_devinfo *dinfo; - struct bhnd_core_pmu_info *pm; - struct bhnd_resource *r; - uint32_t rst; - int error; + struct bcma_devinfo *dinfo; + struct bhnd_resource *r; + uint32_t rst; + int error; if (device_get_parent(child) != dev) return (EINVAL); dinfo = device_get_ivars(child); - pm = dinfo->pmu_info; /* Can't suspend the core without access to the agent registers */ if ((r = dinfo->res_agent) == NULL) @@ -381,12 +379,6 @@ bcma_suspend_hw(device_t dev, device_t child) /* Clear core flags */ if ((error = bhnd_write_ioctl(child, 0x0, UINT16_MAX))) return (error); - - /* Inform PMU that all outstanding request state should be discarded */ - if (pm != NULL) { - if ((error = BHND_PMU_CORE_RELEASE(pm->pm_pmu, pm))) - return (error); - } return (0); } Modified: head/sys/dev/bhnd/bcma/bcmavar.h ============================================================================== --- head/sys/dev/bhnd/bcma/bcmavar.h Wed Nov 22 19:58:29 2017 (r326101) +++ head/sys/dev/bhnd/bcma/bcmavar.h Wed Nov 22 20:27:46 2017 (r326102) @@ -175,17 +175,17 @@ struct bcma_corecfg { * BCMA per-device info */ struct bcma_devinfo { - struct resource_list resources; /**< Slave port memory regions. */ - struct bcma_corecfg *corecfg; /**< IP core/block config */ + struct resource_list resources; /**< Slave port memory regions. */ + struct bcma_corecfg *corecfg; /**< IP core/block config */ - struct bhnd_resource *res_agent; /**< Agent (wrapper) resource, or NULL. Not - * all bcma(4) cores have or require an agent. */ - int rid_agent; /**< Agent resource ID, or -1 */ + struct bhnd_resource *res_agent; /**< Agent (wrapper) resource, or NULL. Not + * all bcma(4) cores have or require an agent. */ + int rid_agent; /**< Agent resource ID, or -1 */ - u_int num_intrs; /**< number of interrupt descriptors. */ - struct bcma_intr_list intrs; /**< interrupt descriptors */ + u_int num_intrs; /**< number of interrupt descriptors. */ + struct bcma_intr_list intrs; /**< interrupt descriptors */ - struct bhnd_core_pmu_info *pmu_info; /**< Bus-managed PMU state, or NULL */ + void *pmu_info; /**< Bus-managed PMU state, or NULL */ }; Modified: head/sys/dev/bhnd/bhnd.c ============================================================================== --- head/sys/dev/bhnd/bhnd.c Wed Nov 22 19:58:29 2017 (r326101) +++ head/sys/dev/bhnd/bhnd.c Wed Nov 22 20:27:46 2017 (r326102) @@ -62,15 +62,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include -#include #include "bhnd_chipc_if.h" #include "bhnd_nvram_if.h" #include "bhnd.h" +#include "bhndreg.h" #include "bhndvar.h" #include "bhnd_private.h" @@ -363,24 +361,28 @@ int bhnd_generic_alloc_pmu(device_t dev, device_t child) { struct bhnd_softc *sc; - struct bhnd_resource *br; - struct bhnd_core_pmu_info *pm; + struct bhnd_resource *r; + struct bhnd_core_clkctl *clkctl; struct resource_list *rl; struct resource_list_entry *rle; device_t pmu_dev; bhnd_addr_t r_addr; bhnd_size_t r_size; bus_size_t pmu_regs; + u_int max_latency; int error; GIANT_REQUIRED; /* for newbus */ - + + if (device_get_parent(child) != dev) + return (EINVAL); + sc = device_get_softc(dev); - pm = bhnd_get_pmu_info(child); + clkctl = bhnd_get_pmu_info(child); pmu_regs = BHND_CLK_CTL_ST; /* already allocated? */ - if (pm != NULL) { + if (clkctl != NULL) { panic("duplicate PMU allocation for %s", device_get_nameunit(child)); } @@ -440,36 +442,38 @@ bhnd_generic_alloc_pmu(device_t dev, device_t child) else pmu_regs -= r_addr - rman_get_start(rle->res); - /* Retain PMU reference on behalf of our caller */ + /* Retain a PMU reference for the clkctl instance state */ pmu_dev = bhnd_retain_provider(child, BHND_SERVICE_PMU); if (pmu_dev == NULL) { - device_printf(sc->dev, - "pmu unavailable; cannot allocate request state\n"); + device_printf(sc->dev, "PMU not found\n"); return (ENXIO); } - /* Allocate and initialize PMU info */ - br = malloc(sizeof(struct bhnd_resource), M_BHND, M_NOWAIT); - if (br == NULL) { + /* Fetch the maximum transition latency from our PMU */ + max_latency = bhnd_pmu_get_max_transition_latency(pmu_dev); + + /* Allocate a new bhnd_resource wrapping the standard resource we + * fetched from the resource list; we'll free this in + * bhnd_generic_release_pmu() */ + r = malloc(sizeof(struct bhnd_resource), M_BHND, M_NOWAIT); + if (r == NULL) { bhnd_release_provider(child, pmu_dev, BHND_SERVICE_PMU); return (ENOMEM); } - br->res = rle->res; - br->direct = ((rman_get_flags(rle->res) & RF_ACTIVE) != 0); + r->res = rle->res; + r->direct = ((rman_get_flags(rle->res) & RF_ACTIVE) != 0); - pm = malloc(sizeof(*pm), M_BHND, M_NOWAIT); - if (pm == NULL) { + /* Allocate the clkctl instance */ + clkctl = bhnd_alloc_core_clkctl(child, pmu_dev, r, pmu_regs, + max_latency); + if (clkctl == NULL) { + free(r, M_BHND); bhnd_release_provider(child, pmu_dev, BHND_SERVICE_PMU); - free(br, M_BHND); return (ENOMEM); } - pm->pm_dev = child; - pm->pm_res = br; - pm->pm_regs = pmu_regs; - pm->pm_pmu = pmu_dev; - bhnd_set_pmu_info(child, pm); + bhnd_set_pmu_info(child, clkctl); return (0); } @@ -479,48 +483,148 @@ bhnd_generic_alloc_pmu(device_t dev, device_t child) int bhnd_generic_release_pmu(device_t dev, device_t child) { - struct bhnd_softc *sc; - struct bhnd_core_pmu_info *pm; - int error; + struct bhnd_softc *sc; + struct bhnd_core_clkctl *clkctl; + struct bhnd_resource *r; + device_t pmu_dev; GIANT_REQUIRED; /* for newbus */ sc = device_get_softc(dev); - /* dispatch release request */ - pm = bhnd_get_pmu_info(child); - if (pm == NULL) + if (device_get_parent(child) != dev) + return (EINVAL); + + clkctl = bhnd_get_pmu_info(child); + if (clkctl == NULL) panic("pmu over-release for %s", device_get_nameunit(child)); - if ((error = BHND_PMU_CORE_RELEASE(pm->pm_pmu, pm))) - return (error); + /* Clear all FORCE, AREQ, and ERSRC flags, unless we're already in + * RESET. Suspending a core clears clkctl automatically (and attempting + * to access the PMU registers in a suspended core will trigger a + * system livelock). */ + if (!bhnd_is_hw_suspended(clkctl->cc_dev)) { + BHND_CLKCTL_LOCK(clkctl); - /* free PMU info */ + /* Clear all FORCE, AREQ, and ERSRC flags */ + BHND_CLKCTL_SET_4(clkctl, 0x0, BHND_CCS_FORCE_MASK | + BHND_CCS_AREQ_MASK | BHND_CCS_ERSRC_REQ_MASK); + + BHND_CLKCTL_UNLOCK(clkctl); + } + + /* Clear child's PMU info reference */ bhnd_set_pmu_info(child, NULL); - bhnd_release_provider(pm->pm_dev, pm->pm_pmu, BHND_SERVICE_PMU); - free(pm->pm_res, M_BHND); - free(pm, M_BHND); + /* Before freeing the clkctl instance, save a pointer to resources we + * need to clean up manually */ + r = clkctl->cc_res; + pmu_dev = clkctl->cc_pmu_dev; + /* Free the clkctl instance */ + bhnd_free_core_clkctl(clkctl); + + /* Free the child's bhnd resource wrapper */ + free(r, M_BHND); + + /* Release the child's PMU provider reference */ + bhnd_release_provider(child, pmu_dev, BHND_SERVICE_PMU); + return (0); } /** + * Default bhnd(4) bus driver implementation of BHND_BUS_GET_CLOCK_LATENCY(). + */ +int +bhnd_generic_get_clock_latency(device_t dev, device_t child, bhnd_clock clock, + u_int *latency) +{ + struct bhnd_core_clkctl *clkctl; + + if (device_get_parent(child) != dev) + return (EINVAL); + + if ((clkctl = bhnd_get_pmu_info(child)) == NULL) + panic("no active PMU allocation"); + + return (bhnd_pmu_get_clock_latency(clkctl->cc_pmu_dev, clock, latency)); +} + +/** + * Default bhnd(4) bus driver implementation of BHND_BUS_GET_CLOCK_FREQ(). + */ +int +bhnd_generic_get_clock_freq(device_t dev, device_t child, bhnd_clock clock, + u_int *freq) +{ + struct bhnd_core_clkctl *clkctl; + + if (device_get_parent(child) != dev) + return (EINVAL); + + if ((clkctl = bhnd_get_pmu_info(child)) == NULL) + panic("no active PMU allocation"); + + return (bhnd_pmu_get_clock_freq(clkctl->cc_pmu_dev, clock, freq)); +} + +/** * Default bhnd(4) bus driver implementation of BHND_BUS_REQUEST_CLOCK(). */ int bhnd_generic_request_clock(device_t dev, device_t child, bhnd_clock clock) { - struct bhnd_softc *sc; - struct bhnd_core_pmu_info *pm; + struct bhnd_softc *sc; + struct bhnd_core_clkctl *clkctl; + uint32_t avail; + uint32_t req; + int error; sc = device_get_softc(dev); - if ((pm = bhnd_get_pmu_info(child)) == NULL) - panic("no active PMU request state"); + if (device_get_parent(child) != dev) + return (EINVAL); - /* dispatch request to PMU */ - return (BHND_PMU_CORE_REQ_CLOCK(pm->pm_pmu, pm, clock)); + if ((clkctl = bhnd_get_pmu_info(child)) == NULL) + panic("no active PMU allocation"); + + BHND_ASSERT_CLKCTL_AVAIL(clkctl); + + avail = 0x0; + req = 0x0; + + switch (clock) { + case BHND_CLOCK_DYN: + break; + case BHND_CLOCK_ILP: + req |= BHND_CCS_FORCEILP; + break; + case BHND_CLOCK_ALP: + req |= BHND_CCS_FORCEALP; + avail |= BHND_CCS_ALPAVAIL; + break; + case BHND_CLOCK_HT: + req |= BHND_CCS_FORCEHT; + avail |= BHND_CCS_HTAVAIL; + break; + default: + device_printf(dev, "%s requested unknown clock: %#x\n", + device_get_nameunit(clkctl->cc_dev), clock); + return (ENODEV); + } + + BHND_CLKCTL_LOCK(clkctl); + + /* Issue request */ + BHND_CLKCTL_SET_4(clkctl, req, BHND_CCS_FORCE_MASK); + + /* Wait for clock availability */ + error = bhnd_core_clkctl_wait(clkctl, avail, avail); + + BHND_CLKCTL_UNLOCK(clkctl); + + return (error); } /** @@ -529,16 +633,64 @@ bhnd_generic_request_clock(device_t dev, device_t chil int bhnd_generic_enable_clocks(device_t dev, device_t child, uint32_t clocks) { - struct bhnd_softc *sc; - struct bhnd_core_pmu_info *pm; + struct bhnd_softc *sc; + struct bhnd_core_clkctl *clkctl; + uint32_t avail; + uint32_t req; + int error; sc = device_get_softc(dev); - if ((pm = bhnd_get_pmu_info(child)) == NULL) - panic("no active PMU request state"); + if (device_get_parent(child) != dev) + return (EINVAL); - /* dispatch request to PMU */ - return (BHND_PMU_CORE_EN_CLOCKS(pm->pm_pmu, pm, clocks)); + if ((clkctl = bhnd_get_pmu_info(child)) == NULL) + panic("no active PMU allocation"); + + BHND_ASSERT_CLKCTL_AVAIL(clkctl); + + sc = device_get_softc(dev); + + avail = 0x0; + req = 0x0; + + /* Build clock request flags */ + if (clocks & BHND_CLOCK_DYN) /* nothing to enable */ + clocks &= ~BHND_CLOCK_DYN; + + if (clocks & BHND_CLOCK_ILP) /* nothing to enable */ + clocks &= ~BHND_CLOCK_ILP; + + if (clocks & BHND_CLOCK_ALP) { + req |= BHND_CCS_ALPAREQ; + avail |= BHND_CCS_ALPAVAIL; + clocks &= ~BHND_CLOCK_ALP; + } + + if (clocks & BHND_CLOCK_HT) { + req |= BHND_CCS_HTAREQ; + avail |= BHND_CCS_HTAVAIL; + clocks &= ~BHND_CLOCK_HT; + } + + /* Check for unknown clock values */ + if (clocks != 0x0) { + device_printf(dev, "%s requested unknown clocks: %#x\n", + device_get_nameunit(clkctl->cc_dev), clocks); + return (ENODEV); + } + + BHND_CLKCTL_LOCK(clkctl); + + /* Issue request */ + BHND_CLKCTL_SET_4(clkctl, req, BHND_CCS_AREQ_MASK); + + /* Wait for clock availability */ + error = bhnd_core_clkctl_wait(clkctl, avail, avail); + + BHND_CLKCTL_UNLOCK(clkctl); + + return (error); } /** @@ -547,16 +699,41 @@ bhnd_generic_enable_clocks(device_t dev, device_t chil int bhnd_generic_request_ext_rsrc(device_t dev, device_t child, u_int rsrc) { - struct bhnd_softc *sc; - struct bhnd_core_pmu_info *pm; + struct bhnd_softc *sc; + struct bhnd_core_clkctl *clkctl; + uint32_t req; + uint32_t avail; + int error; sc = device_get_softc(dev); - if ((pm = bhnd_get_pmu_info(child)) == NULL) - panic("no active PMU request state"); + if (device_get_parent(child) != dev) + return (EINVAL); - /* dispatch request to PMU */ - return (BHND_PMU_CORE_REQ_EXT_RSRC(pm->pm_pmu, pm, rsrc)); + if ((clkctl = bhnd_get_pmu_info(child)) == NULL) + panic("no active PMU allocation"); + + BHND_ASSERT_CLKCTL_AVAIL(clkctl); + + sc = device_get_softc(dev); + + if (rsrc > BHND_CCS_ERSRC_MAX) + return (EINVAL); + + req = BHND_CCS_SET_BITS((1<pm_pmu, pm, rsrc)); -} + if ((clkctl = bhnd_get_pmu_info(child)) == NULL) + panic("no active PMU allocation"); + BHND_ASSERT_CLKCTL_AVAIL(clkctl); + + sc = device_get_softc(dev); + + if (rsrc > BHND_CCS_ERSRC_MAX) + return (EINVAL); + + mask = BHND_CCS_SET_BITS((1<cc_dev), \ + ("reading clkctl on suspended core will trigger system livelock")) + +#define BHND_CLKCTL_LOCK_INIT(_clkctl) mtx_init(&(_clkctl)->cc_mtx, \ + device_get_nameunit((_clkctl)->cc_dev), NULL, MTX_DEF) +#define BHND_CLKCTL_LOCK(_clkctl) mtx_lock(&(_clkctl)->cc_mtx) +#define BHND_CLKCTL_UNLOCK(_clkctl) mtx_unlock(&(_clkctl)->cc_mtx) +#define BHND_CLKCTL_LOCK_ASSERT(_clkctl, what) \ + mtx_assert(&(_clkctl)->cc_mtx, what) +#define BHND_CLKCTL_LOCK_DESTROY(_clkctl) mtx_destroy(&(_clkctl->cc_mtx)) + +#define BHND_CLKCTL_READ_4(_clkctl) \ + bhnd_bus_read_4((_clkctl)->cc_res, (_clkctl)->cc_res_offset) + +#define BHND_CLKCTL_WRITE_4(_clkctl, _val) \ + bhnd_bus_write_4((_clkctl)->cc_res, (_clkctl)->cc_res_offset, (_val)) + +#define BHND_CLKCTL_SET_4(_clkctl, _val, _mask) \ + BHND_CLKCTL_WRITE_4((_clkctl), \ + ((_val) & (_mask)) | (BHND_CLKCTL_READ_4(_clkctl) & ~(_mask))) + #endif /* _BHND_BHND_PRIVATE_H_ */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***