1299097Sadrian/*-
2299097Sadrian * Copyright (c) 2015 Landon Fuller <landon@landonf.org>
3299097Sadrian * All rights reserved.
4299097Sadrian *
5299097Sadrian * Redistribution and use in source and binary forms, with or without
6299097Sadrian * modification, are permitted provided that the following conditions
7299097Sadrian * are met:
8299097Sadrian * 1. Redistributions of source code must retain the above copyright
9299097Sadrian *    notice, this list of conditions and the following disclaimer,
10299097Sadrian *    without modification.
11299097Sadrian * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12299097Sadrian *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13299097Sadrian *    redistribution must be conditioned upon including a substantially
14299097Sadrian *    similar Disclaimer requirement for further binary redistribution.
15299097Sadrian *
16299097Sadrian * NO WARRANTY
17299097Sadrian * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18299097Sadrian * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19299097Sadrian * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
20299097Sadrian * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21299097Sadrian * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22299097Sadrian * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23299097Sadrian * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24299097Sadrian * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25299097Sadrian * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26299097Sadrian * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27299097Sadrian * THE POSSIBILITY OF SUCH DAMAGES.
28299097Sadrian *
29299097Sadrian * $FreeBSD$
30299097Sadrian */
31299097Sadrian
32299097Sadrian#ifndef _IF_BWN_PCIVAR_H_
33299097Sadrian#define _IF_BWN_PCIVAR_H_
34299097Sadrian
35299097Sadrianstruct bwn_pci_devcfg;
36299097Sadrian
37299097Sadrian/** bwn_pci per-instance state. */
38299097Sadrianstruct bwn_pci_softc {
39299097Sadrian	device_t			 dev;		/**< device */
40299097Sadrian	device_t			 bhndb_dev;	/**< bhnd bridge device */
41299097Sadrian	const struct bwn_pci_devcfg	*devcfg;	/**< bwn device config */
42299097Sadrian	uint32_t			 quirks;	/**< quirk flags */
43299097Sadrian};
44299097Sadrian
45299097Sadrian/* bwn device quirks */
46299097Sadrianenum {
47299097Sadrian	/** No quirks */
48299097Sadrian	BWN_QUIRK_NONE			= 0,
49299097Sadrian
50299097Sadrian	/**
51299097Sadrian	 * This model/revision has not been tested and may not work.
52299097Sadrian	 */
53299097Sadrian	BWN_QUIRK_UNTESTED		= 1<<0,
54299097Sadrian
55299097Sadrian	/**
56299097Sadrian	 * Early dual-band devices did not support accessing multiple PHYs
57299097Sadrian	 * from a single WLAN core, and instead used separate 2GHz and 5GHz
58299097Sadrian	 * WLAN cores.
59299097Sadrian	 *
60299097Sadrian	 * However, not all cards with two WLAN cores are fully populated;
61299097Sadrian	 * we must whitelist the boards on which a second WLAN core is actually
62299097Sadrian	 * usable.
63299097Sadrian	 */
64299097Sadrian	BWN_QUIRK_WLAN_DUALCORE		= 1<<1,
65299097Sadrian
66299097Sadrian	/**
67299097Sadrian	 * Some early devices shipped with unconnected ethernet cores; set
68299097Sadrian	 * this quirk to treat these cores as unpopulated.
69299097Sadrian	 */
70299097Sadrian	BWN_QUIRK_ENET_HW_UNPOPULATED	= 1<<2,
71299097Sadrian};
72299097Sadrian
73299097Sadrian/* PCI device descriptor */
74299097Sadrianstruct bwn_pci_device {
75299097Sadrian	uint16_t	vendor;
76299097Sadrian	uint16_t	device;
77299097Sadrian	const char	*desc;
78299097Sadrian	uint32_t	quirks;
79299097Sadrian};
80299097Sadrian
81299097Sadrian
82299097Sadrian#define	BWN_BCM_DEV(_devid, _desc, _quirks)		\
83299097Sadrian    { PCI_VENDOR_BROADCOM, PCI_DEVID_ ## _devid,	\
84299097Sadrian        "Broadcom " _desc " Wireless", _quirks }
85299097Sadrian
86299097Sadrian/* Supported device table */
87299097Sadrianstruct bwn_pci_devcfg {
88299097Sadrian	const struct bhndb_hwcfg	*bridge_hwcfg;
89299097Sadrian	const struct bhndb_hw		*bridge_hwtable;
90299097Sadrian	const struct bwn_pci_device	*devices;
91299097Sadrian};
92299097Sadrian
93299097Sadrian#endif /* _IF_BWN_PCIVAR_H_ */