]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/bhnd/bhnd_types.h
MFV r304732.
[FreeBSD/FreeBSD.git] / sys / dev / bhnd / bhnd_types.h
1 /*-
2  * Copyright (c) 2015 Landon Fuller <landon@landonf.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer,
10  *    without modification.
11  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13  *    redistribution must be conditioned upon including a substantially
14  *    similar Disclaimer requirement for further binary redistribution.
15  *
16  * NO WARRANTY
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
20  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27  * THE POSSIBILITY OF SUCH DAMAGES.
28  * 
29  * $FreeBSD$
30  */
31
32 #ifndef _BHND_BHND_TYPES_H_
33 #define _BHND_BHND_TYPES_H_
34
35 #include <sys/types.h>
36
37 #include "nvram/bhnd_nvram.h"
38
39 /** bhnd(4) device classes. */
40 typedef enum {
41         BHND_DEVCLASS_CC,               /**< chipcommon i/o controller */
42         BHND_DEVCLASS_CC_B,             /**< chipcommon auxiliary controller */
43         BHND_DEVCLASS_PMU,              /**< pmu controller */
44         BHND_DEVCLASS_PCI,              /**< pci host/device bridge */
45         BHND_DEVCLASS_PCIE,             /**< pcie host/device bridge */
46         BHND_DEVCLASS_PCCARD,           /**< pcmcia host/device bridge */
47         BHND_DEVCLASS_RAM,              /**< internal RAM/SRAM */
48         BHND_DEVCLASS_MEMC,             /**< memory controller */
49         BHND_DEVCLASS_ENET,             /**< 802.3 MAC/PHY */
50         BHND_DEVCLASS_ENET_MAC,         /**< 802.3 MAC */
51         BHND_DEVCLASS_ENET_PHY,         /**< 802.3 PHY */
52         BHND_DEVCLASS_WLAN,             /**< 802.11 MAC/PHY/Radio */
53         BHND_DEVCLASS_WLAN_MAC,         /**< 802.11 MAC */
54         BHND_DEVCLASS_WLAN_PHY,         /**< 802.11 PHY */
55         BHND_DEVCLASS_CPU,              /**< cpu core */
56         BHND_DEVCLASS_SOC_ROUTER,       /**< interconnect router */
57         BHND_DEVCLASS_SOC_BRIDGE,       /**< interconnect host bridge */
58         BHND_DEVCLASS_EROM,             /**< bus device enumeration ROM */
59         BHND_DEVCLASS_NVRAM,            /**< nvram/flash controller */
60         BHND_DEVCLASS_OTHER,            /**< other / unknown */
61
62         BHND_DEVCLASS_INVALID           /**< no/invalid class */
63 } bhnd_devclass_t;
64
65
66 /**
67  * bhnd(4) port types.
68  * 
69  * Only BHND_PORT_DEVICE is guaranteed to be supported by all bhnd(4) bus
70  * implementations.
71  */
72 typedef enum {
73         BHND_PORT_DEVICE        = 0,    /**< device memory */
74         BHND_PORT_BRIDGE        = 1,    /**< bridge memory */
75         BHND_PORT_AGENT         = 2,    /**< interconnect agent/wrapper */
76 } bhnd_port_type;
77
78 /**
79  * bhnd(4) attachment types.
80  */
81 typedef enum {
82         BHND_ATTACH_ADAPTER     = 0,    /**< A bridged card, such as a PCI WiFi chipset  */
83         BHND_ATTACH_NATIVE      = 1     /**< A bus resident on the native host, such as
84                                           *  the primary or secondary bus of an embedded
85                                           *  SoC */
86 } bhnd_attach_type;
87
88 /** Evaluates to true if @p cls is a device class that can be configured
89  *  as a host bridge device. */
90 #define BHND_DEVCLASS_SUPPORTS_HOSTB(cls)                                       \
91         ((cls) == BHND_DEVCLASS_PCI || (cls) == BHND_DEVCLASS_PCIE ||   \
92          (cls) == BHND_DEVCLASS_PCCARD)
93
94 /**
95  * BHND bus address.
96  * 
97  * @note While the interconnect may support 64-bit addressing, not
98  * all bridges and SoC CPUs will.
99  */
100 typedef uint64_t        bhnd_addr_t;
101 #define BHND_ADDR_MAX   UINT64_MAX      /**< Maximum bhnd_addr_t value */
102
103 /** BHND bus size. */
104 typedef uint64_t        bhnd_size_t;
105 #define BHND_SIZE_MAX   UINT64_MAX      /**< Maximum bhnd_size_t value */
106
107
108 #endif /* _BHND_BHND_TYPES_H_ */