2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2016 Landon J. Fuller <landonf@FreeBSD.org>.
5 * Copyright (c) 2017 The FreeBSD Foundation
8 * Portions of this software were developed by Landon Fuller
9 * under sponsorship from the FreeBSD Foundation.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #ifndef _IF_BWN_SIBA_COMPAT_H_
36 #define _IF_BWN_SIBA_COMPAT_H_
38 #define BWN_USE_SIBA 0
39 #include "if_bwn_siba.h"
41 #include "if_bwnvar.h"
43 #define BWN_BHND_NUM_CORE_PWR 4
46 * Compatiblity shim state.
49 device_t chipc_dev; /**< ChipCommon device */
50 device_t gpio_dev; /**< GPIO device */
52 device_t pmu_dev; /**< PMU device, or NULL if no PMU */
53 uint32_t pmu_cctl_addr; /**< chipctrl_addr target of
54 reads/writes to/from the
55 chipctrl_data register */
57 uint8_t sromrev; /**< SROM format revision */
59 /* NVRAM variables for which bwn(4) expects the bus to manage storage
60 * for (and in some cases, allow writes). */
61 uint8_t mac_80211bg[6]; /**< D11 unit 0 */
62 uint8_t mac_80211a[6]; /**< D11 unit 1 */
64 uint32_t boardflags; /**< boardflags (bwn-writable) */
65 uint8_t pa0maxpwr; /**< 2GHz max power (bwn-writable) */
69 * Return the bwn(4) device's bhnd compatiblity context.
71 static inline struct bwn_bhnd_ctx *
72 bwn_bhnd_get_ctx(device_t dev)
74 struct bwn_softc *sc = device_get_softc(dev);
75 return (sc->sc_bus_ctx);
79 * Fetch an NVRAM variable via bhnd_nvram_getvar_*().
81 #define BWN_BHND_NVRAM_FETCH_VAR(_dev, _type, _name, _result) \
85 error = bhnd_nvram_getvar_ ## _type(_dev, _name, _result); \
87 panic("NVRAM variable %s unreadable: %d", _name, \
93 * Fetch and return an NVRAM variable via bhnd_nvram_getvar_*().
95 #define BWN_BHND_NVRAM_RETURN_VAR(_dev, _type, _name) \
98 BWN_BHND_NVRAM_FETCH_VAR(_dev, _type, _name, &value); \
102 #endif /* _IF_BWN_SIBA_COMPAT_H_ */