/freebsd/sys/dev/amdgpio/ |
H A D | amdgpio.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 59 { -1, 0, 0 } 65 return (bus_read_4(sc->sc_res[0], off)); in amdgpio_read_4() 70 uint32_t val) in amdgpio_write_4() argument 72 bus_write_4(sc->sc_res[0], off, val); in amdgpio_write_4() 76 amdgpio_is_pin_output(struct amdgpio_softc *sc, uint32_t pin) in amdgpio_is_pin_output() argument 78 uint32_t reg, val; in amdgpio_is_pin_output() local 81 /* Get the current pin state */ in amdgpio_is_pin_output() 84 reg = AMDGPIO_PIN_REGISTER(pin); in amdgpio_is_pin_output() [all …]
|
/freebsd/sys/dev/gpio/ |
H A D | chvgpio.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 76 #define CHVGPIO_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx) 77 #define CHVGPIO_UNLOCK(_sc) mtx_unlock_spin(&(_sc)->sc_mtx) 79 mtx_init(&_sc->sc_mtx, device_get_nameunit((_sc)->sc_dev), \ 81 #define CHVGPIO_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) 82 #define CHVGPIO_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) 83 #define CHVGPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED) 112 chvgpio_pad_cfg0_offset(int pin) in chvgpio_pad_cfg0_offset() argument 114 return (CHVGPIO_PAD_CFG0 + 1024 * (pin / 15) + 8 * (pin % 15)); in chvgpio_pad_cfg0_offset() [all …]
|
H A D | bytgpio.c | 1 /*- 52 #define BYTGPIO_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx) 53 #define BYTGPIO_UNLOCK(_sc) mtx_unlock_spin(&(_sc)->sc_mtx) 55 mtx_init(&_sc->sc_mtx, device_get_nameunit((_sc)->sc_dev), \ 57 #define BYTGPIO_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) 58 #define BYTGPIO_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) 59 #define BYTGPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED) 67 #define PADCONF_FUNC_ANY -1 285 #define BYGPIO_PIN_REGISTER(sc, pin, 283 BYGPIO_PIN_REGISTER(sc,pin,r) global() argument 300 bytgpio_write_4(struct bytgpio_softc * sc,bus_size_t off,uint32_t val) bytgpio_write_4() argument 328 bytgpio_valid_pin(struct bytgpio_softc * sc,int pin) bytgpio_valid_pin() argument 341 bytgpio_pad_is_gpio(struct bytgpio_softc * sc,int pin) bytgpio_pad_is_gpio() argument 351 bytgpio_pin_getcaps(device_t dev,uint32_t pin,uint32_t * caps) bytgpio_pin_getcaps() argument 367 bytgpio_pin_getflags(device_t dev,uint32_t pin,uint32_t * flags) bytgpio_pin_getflags() argument 370 uint32_t reg, val; bytgpio_pin_getflags() local 398 bytgpio_pin_setflags(device_t dev,uint32_t pin,uint32_t flags) bytgpio_pin_setflags() argument 401 uint32_t reg, val; bytgpio_pin_setflags() local 441 bytgpio_pin_getname(device_t dev,uint32_t pin,char * name) bytgpio_pin_getname() argument 457 bytgpio_pin_set(device_t dev,uint32_t pin,unsigned int value) bytgpio_pin_set() argument 460 uint32_t reg, val; bytgpio_pin_set() local 483 bytgpio_pin_get(device_t dev,uint32_t pin,unsigned int * value) bytgpio_pin_get() argument 486 uint32_t reg, val; bytgpio_pin_get() local 515 bytgpio_pin_toggle(device_t dev,uint32_t pin) bytgpio_pin_toggle() argument 518 uint32_t reg, val; bytgpio_pin_toggle() local 558 int pin; bytgpio_attach() local 559 uint32_t reg, val; bytgpio_attach() local [all...] |
H A D | gpiomdio.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 61 #define MDO sc->miibb_ops.mbo_bits[MII_BIT_MDO] 62 #define MDI sc->miibb_ops.mbo_bits[MII_BIT_MDI] 63 #define MDC sc->miibb_ops.mbo_bits[MII_BIT_MDC] 64 #define MDIRPHY sc->miibb_ops.mbo_bits[MII_BIT_DIR_HOST_PHY] 65 #define MDIRHOST sc->miibb_ops.mbo_bits[MII_BIT_DIR_PHY_HOST] 90 if (devi->npins < GPIOMDIO_MIN_PINS) { in gpiomdio_probe() 93 GPIOMDIO_MIN_PINS, devi->npins); in gpiomdio_probe() 96 device_set_desc(dev, "GPIO MDIO bit-banging Bus driver"); in gpiomdio_probe() [all …]
|
/freebsd/sys/amd64/vmm/io/ |
H A D | vatpic.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 54 #define VATPIC_LOCK(vatpic) mtx_lock_spin(&((vatpic)->mtx)) 55 #define VATPIC_UNLOCK(vatpic) mtx_unlock_spin(&((vatpic)->mtx)) 56 #define VATPIC_LOCKED(vatpic) mtx_owned(&((vatpic)->mtx)) 72 bool sfn; /* special fully-nested mode */ 80 int acnt[8]; /* sum of pin asserts and deasserts */ 94 VM_CTR0((vatpic)->vm, fmt) 97 VM_CTR1((vatpic)->vm, fmt, a1) 100 VM_CTR2((vatpic)->vm, fmt, a1, a2) [all …]
|
/freebsd/sys/dev/iicbus/gpio/ |
H A D | pcf8574.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 30 * Driver for PCF8574 / PCF8574A 8-bit I/O expander 31 * with quasi-bidirectional I/O. 87 pcf8574_read(struct pcf8574_softc *sc, uint8_t *val) in pcf8574_read() argument 92 msg.slave = sc->addr; in pcf8574_read() 95 msg.buf = val; in pcf8574_read() 97 error = iicbus_transfer_excl(sc->dev, &msg, 1, IIC_WAIT); in pcf8574_read() 102 pcf8574_write(struct pcf8574_softc *sc, uint8_t val) in pcf8574_write() argument 107 msg.slave = sc->addr; in pcf8574_write() [all …]
|
H A D | tca64xx.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 62 #define TCA64XX_BIT_FROM_PIN(pin) (pin % TCA64XX_PINS_PER_REG) argument 63 #define TCA64XX_REG_ADDR(pin, baseaddr) (baseaddr | (pin / \ argument 173 msgs[0].slave = sc->addr; in tca64xx_read() 178 msgs[1].slave = sc->addr; in tca64xx_read() 188 tca64xx_write(device_t dev, uint8_t reg, uint8_t val) in tca64xx_write() argument 193 uint8_t buffer[2] = {reg, val}; in tca64xx_write() 197 msg.slave = sc->addr; in tca64xx_write() 216 switch (compat_ptr->ocd_data) { in tca64xx_probe() [all …]
|
/freebsd/sys/arm/mv/ |
H A D | mvebu_gpio.c | 1 /*- 57 #define GPIO_LOCK(_sc) mtx_lock(&(_sc)->mtx) 58 #define GPIO_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx) 59 #define GPIO_LOCK_INIT(_sc) mtx_init(&_sc->mtx, \ 60 device_get_nameunit(_sc->dev), "mvebu_gpio", MTX_DEF) 61 #define GPIO_LOCK_DESTROY(_sc) mtx_destroy(&_sc->mtx); 62 #define GPIO_ASSERT_LOCKED(_sc) mtx_assert(&_sc->mtx, MA_OWNED); 63 #define GPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->mtx, MA_NOTOWNED); 112 {"marvell,armada-8k-gpio", 1}, 116 /* -------------------------------------------------------------------------- [all …]
|
H A D | a37x0_gpio.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 4 * Copyright (c) 2018-2019, Rubicon Communications, LLC (Netgate) 65 SYSCON_WRITE_4((_sc)->syscon, (_off), (_val)) 67 SYSCON_READ_4((_sc)->syscon, (_off)) 77 { "marvell,armada3710-nb-pinctrl", A37X0_NB_GPIO }, 78 { "marvell,armada3710-sb-pinctrl", A37X0_SB_GPIO }, 96 return (sc->sc_busdev); in a37x0_gpio_get_bus() 105 *maxpin = sc->sc_npins - 1; in a37x0_gpio_pin_max() 111 a37x0_gpio_pin_getname(device_t dev, uint32_t pin, char *name) in a37x0_gpio_pin_getname() argument [all …]
|
/freebsd/sys/arm/allwinner/ |
H A D | aw_gpio.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 210 {"allwinner,sun4i-a10-pinctrl", (uintptr_t)&a10_gpio_conf}, 213 {"allwinner,sun5i-a13-pinctrl", (uintptr_t)&a13_gpio_conf}, 216 {"allwinner,sun7i-a20-pinctrl", (uintptr_t)&a20_gpio_conf}, 219 {"allwinner,sun6i-a31-pinctrl", (uintptr_t)&a31_gpio_conf}, 222 {"allwinner,sun6i-a31s-pinctrl", (uintptr_t)&a31s_gpio_conf}, 225 {"allwinner,sun6i-a31-r-pinctrl", (uintptr_t)&a31_r_gpio_conf}, 228 {"allwinner,sun6i-a33-pinctrl", (uintptr_t)&a33_gpio_conf}, 231 {"allwinner,sun8i-a83t-pinctrl", (uintptr_t)&a83t_gpio_conf}, [all …]
|
H A D | axp81x.c | 1 /*- 28 * X-Powers AXP803/813/818 PMU for Allwinner SoCs 193 #define AXP_BAP_CAP_WARN_LV1BASE 5 /* 5-20%, 1% per step */ 215 { "x-powers,axp803", AXP803 }, 216 { "x-powers,axp813", AXP813 }, 217 { "x-powers,axp818", AXP813 }, 223 { -1, 0 } 527 .name = "ldo-io0", 540 .name = "ldo-io1", 706 #define AXP_LOCK(sc) mtx_lock(&(sc)->mtx) [all …]
|
H A D | axp209.c | 1 /*- 2 * Copyright (c) 2015-2016 Emmanuel Vadot <manu@freebsd.org> 29 * X-Power AXP209/AXP211 PMU for Allwinner SoCs 525 .value_convert = -(AXP209_TEMPMON_MIN - AXP209_0C_TO_K), 589 .value_convert = -(AXP221_TEMPMON_MIN - AXP209_0C_TO_K), 622 { "x-powers,axp209", AXP209 }, 623 { "x-powers,axp221", AXP221 }, 629 { -1, 0, 0 } 632 #define AXP_LOCK(sc) mtx_lock(&(sc)->mtx) 633 #define AXP_UNLOCK(sc) mtx_unlock(&(sc)->mtx) [all …]
|
/freebsd/sys/arm/nvidia/ |
H A D | tegra_gpio.c | 1 /*- 54 #define GPIO_LOCK(_sc) mtx_lock(&(_sc)->mtx) 55 #define GPIO_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx) 56 #define GPIO_LOCK_INIT(_sc) mtx_init(&_sc->mtx, \ 57 device_get_nameunit(_sc->dev), "tegra_gpio", MTX_DEF) 58 #define GPIO_LOCK_DESTROY(_sc) mtx_destroy(&_sc->mtx); 59 #define GPIO_ASSERT_LOCKED(_sc) mtx_assert(&_sc->mtx, MA_OWNED); 60 #define GPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->mtx, MA_NOTOWNED); 62 #define WR4(_sc, _r, _v) bus_write_4((_sc)->mem_res, (_r), (_v)) 63 #define RD4(_sc, _r) bus_read_4((_sc)->mem_res, (_r)) [all …]
|
/freebsd/sys/dev/nctgpio/ |
H A D | nctgpio.c | 1 /*- 51 #define NCT_PPOD_LDN 0xf /* LDN used to select Push-Pull/Open-Drain */ 63 #define NCT_PIN_IS_VALID(_sc, _p) ((_p) < (_sc)->npins) 64 #define NCT_PIN_GROUP(_sc, _p) ((_sc)->pinmap[(_p)].group) 65 #define NCT_PIN_GRPNUM(_sc, _p) ((_sc)->pinmap[(_p)].grpnum) 66 #define NCT_PIN_BIT(_sc, _p) ((_sc)->pinmap[(_p)].bit) 98 uint8_t ppod_reg; /* Push-Pull/Open-Drain */ 130 #define GPIO_LOCK_INIT(_sc) mtx_init(&(_sc)->mtx, \ 132 #define GPIO_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->mtx) 133 #define GPIO_LOCK(_sc) mtx_lock(&(_sc)->mtx) [all …]
|
/freebsd/contrib/libfido2/src/ |
H A D | bio.c | 2 * Copyright (c) 2019-2022 Yubico AB. All rights reserved. 3 * Use of this source code is governed by a BSD-style 5 * SPDX-License-Identifier: BSD-2-Clause 25 int ok = -1; in bio_prepare_hmac() 39 &cbor_alloc_len)) == 0 || cbor_len > SIZE_MAX - sizeof(prefix)) { in bio_prepare_hmac() 44 if ((hmac_data->ptr = malloc(cbor_len + sizeof(prefix))) == NULL) { in bio_prepare_hmac() 49 memcpy(hmac_data->ptr, prefix, sizeof(prefix)); in bio_prepare_hmac() 50 memcpy(hmac_data->ptr + sizeof(prefix), cbor, cbor_len); in bio_prepare_hmac() 51 hmac_data->len = cbor_len + sizeof(prefix); in bio_prepare_hmac() 62 const char *pin, const fido_blob_t *token, int *ms) in bio_tx() argument [all …]
|
H A D | credman.c | 2 * Copyright (c) 2019-2022 Yubico AB. All rights reserved. 3 * Use of this source code is governed by a BSD-style 5 * SPDX-License-Identifier: BSD-2-Clause 31 return (-1); in credman_grow_array() 42 return (-1); in credman_grow_array() 46 return (-1); in credman_grow_array() 61 int ok = -1; in credman_prepare_hmac() 86 param_cbor[1] = cbor_encode_pubkey(&cred->attcred.id); in credman_prepare_hmac() 87 param_cbor[2] = cbor_encode_user_entity(&cred->user); in credman_prepare_hmac() 95 return (-1); in credman_prepare_hmac() [all …]
|
/freebsd/contrib/libfido2/tools/ |
H A D | assert_get.c | 2 * Copyright (c) 2018-2023 Yubico AB. All rights reserved. 3 * Use of this source code is governed by a BSD-style 5 * SPDX-License-Identifier: BSD-2-Clause 16 #include "../openbsd-compat/openbsd-compat.h" 22 fido_opt_t pin; member 47 char *val; in parse_toggle() local 214 char pin[128]; assert_get() local [all...] |
/freebsd/sys/dev/ftgpio/ |
H A D | ftgpio.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 4 * Copyright (c) 2016-2023 Stormshield 48 #define GPIO_LOCK_INIT(_sc) mtx_init(&(_sc)->mtx, \ 50 #define GPIO_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->mtx) 51 #define GPIO_LOCK(_sc) mtx_lock(&(_sc)->mtx) 52 #define GPIO_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx) 53 #define GPIO_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->mtx, MA_OWNED) 54 #define GPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->mtx, MA_NOTOWNED) 125 ioreg = (((0xf - group) << 4) + reg); in ftgpio_group_get_ioreg() [all …]
|
/freebsd/sys/dev/p2sb/ |
H A D | lewisburg_gpiocm.c | 1 /*- 54 #define LBGGPIOCM_READ(sc, reg) p2sb_port_read_4(sc->p2sb, sc->port, reg) 55 #define LBGGPIOCM_WRITE(sc, reg, val) \ argument 56 p2sb_port_write_4(sc->p2sb, sc->port, reg, val) 57 #define LBGGPIOCM_LOCK(sc) p2sb_lock(sc->p2sb) 58 #define LBGGPIOCM_UNLOCK(sc) p2sb_unlock(sc->p2sb) 107 for (i = 0; i < sc->community->ngroups; ++i) in lbggpiocm_get_group() 108 if (sc->community->groups[i].dev == child) in lbggpiocm_get_group() 109 return (&sc->community->groups[i]); in lbggpiocm_get_group() 115 lbggpiocm_getpad(struct lbggpiocm_softc *sc, uint32_t pin) in lbggpiocm_getpad() argument [all …]
|
/freebsd/sys/dev/qcom_tlmm/ |
H A D | qcom_tlmm_pin.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 60 qcom_tlmm_pin_lookup(struct qcom_tlmm_softc *sc, int pin) in qcom_tlmm_pin_lookup() argument 62 if (pin >= sc->gpio_npins) in qcom_tlmm_pin_lookup() 65 return &sc->gpio_pins[pin]; in qcom_tlmm_pin_lookup() 70 struct gpio_pin *pin, unsigned int flags) in qcom_tlmm_pin_configure() argument 79 pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); in qcom_tlmm_pin_configure() 84 * function pin here, set the output in qcom_tlmm_pin_configure() 85 * pin value before we flip on oe_output. in qcom_tlmm_pin_configure() 87 pin->gp_flags |= GPIO_PIN_OUTPUT; in qcom_tlmm_pin_configure() [all …]
|
H A D | qcom_tlmm_ipq4018_hw.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 63 * Set the pin function. This is a hardware and pin specific mapping. 69 int pin, int function) in qcom_tlmm_ipq4018_hw_pin_set_function() argument 75 if (pin >= sc->gpio_npins) in qcom_tlmm_ipq4018_hw_pin_set_function() 78 reg = GPIO_READ(sc, QCOM_TLMM_IPQ4018_REG_PIN(pin, in qcom_tlmm_ipq4018_hw_pin_set_function() 84 GPIO_WRITE(sc, QCOM_TLMM_IPQ4018_REG_PIN(pin, in qcom_tlmm_ipq4018_hw_pin_set_function() 91 * Get the pin function. This is a hardware and pin specific mapping. 97 int pin, int *function) in qcom_tlmm_ipq4018_hw_pin_get_function() argument 103 if (pin >= sc->gpio_npins) in qcom_tlmm_ipq4018_hw_pin_get_function() [all …]
|
/freebsd/contrib/wpa/wpa_supplicant/dbus/ |
H A D | dbus_new_handlers_wps.c | 2 * WPA Supplicant / dbus-based control interface (WPS) 25 int role; /* 0 - not set, 1 - enrollee, 2 - registrar */ 26 int type; /* 0 - not set, 1 - pin, 2 - pbc */ 28 char *pin; member 39 char *val; in wpas_dbus_handler_wps_role() local 45 "dbus: WPS.Start - Wrong Role type, string required"); in wpas_dbus_handler_wps_role() 48 return -1; in wpas_dbus_handler_wps_role() 50 dbus_message_iter_get_basic(&variant_iter, &val); in wpas_dbus_handler_wps_role() 51 if (os_strcmp(val, "enrollee") == 0) in wpas_dbus_handler_wps_role() 52 params->role = 1; in wpas_dbus_handler_wps_role() [all …]
|
/freebsd/contrib/libfido2/fuzz/ |
H A D | fuzz_credman.c | 2 * Copyright (c) 2019-2021 Yubico AB. All rights reserved. 3 * Use of this source code is governed by a BSD-style 5 * SPDX-License-Identifier: BSD-2-Clause 18 #include "../openbsd-compat/openbsd-compat.h" 22 char pin[MAXSTR]; member 86 int ok = -1; in unpack() 97 if (unpack_int(v[0], &p->seed) < 0 || in unpack() 98 unpack_string(v[1], p->pin) < 0 || in unpack() 99 unpack_string(v[2], p->rp_id) < 0 || in unpack() 100 unpack_blob(v[3], &p->cred_id) < 0 || in unpack() [all …]
|
/freebsd/sys/powerpc/mpc85xx/ |
H A D | mpc85xx_gpio.c | 1 /*- 55 #define GPIO_LOCK(sc) mtx_lock(&(sc)->sc_mtx) 56 #define GPIO_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) 58 mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \ 60 #define GPIO_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); 77 return (sc->busdev); in mpc85xx_gpio_get_bus() 88 /* Get a specific pin's capabilities. */ 90 mpc85xx_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) in mpc85xx_gpio_pin_getcaps() argument 93 if (!VALID_PIN(pin)) in mpc85xx_gpio_pin_getcaps() 101 /* Get a specific pin's name. */ [all …]
|
/freebsd/sys/arm64/nvidia/tegra210/ |
H A D | max77620.h | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 217 uint8_t gpio_reg_pue; /* pull-up enables */ 218 uint8_t gpio_reg_pde; /* pull-down enables */ 224 #define RD1(sc, reg, val) max77620_read(sc, reg, val) argument 225 #define WR1(sc, reg, val) max77620_write(sc, reg, val) argument 228 int max77620_read(struct max77620_softc *sc, uint8_t reg, uint8_t *val); 229 int max77620_write(struct max77620_softc *sc, uint8_t reg, uint8_t val); 248 int max77620_gpio_pin_getname(device_t dev, uint32_t pin, char *name); 249 int max77620_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags); [all …]
|