xref: /freebsd/sys/dev/sdio/sdiob.h (revision 7899f917b1c0ea178f1d2be0cfb452086d079d23)
1 /*-
2  * Copyright (c) 2019 The FreeBSD Foundation
3  *
4  * Portions of this software were developed by Björn Zeeb
5  * under sponsorship from the FreeBSD Foundation.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  *
28  * Portions of this software may have been developed with reference to
29  * the SD Simplified Specification.  The following disclaimer may apply:
30  *
31  * The following conditions apply to the release of the simplified
32  * specification ("Simplified Specification") by the SD Card Association and
33  * the SD Group. The Simplified Specification is a subset of the complete SD
34  * Specification which is owned by the SD Card Association and the SD
35  * Group. This Simplified Specification is provided on a non-confidential
36  * basis subject to the disclaimers below. Any implementation of the
37  * Simplified Specification may require a license from the SD Card
38  * Association, SD Group, SD-3C LLC or other third parties.
39  *
40  * Disclaimers:
41  *
42  * The information contained in the Simplified Specification is presented only
43  * as a standard specification for SD Cards and SD Host/Ancillary products and
44  * is provided "AS-IS" without any representations or warranties of any
45  * kind. No responsibility is assumed by the SD Group, SD-3C LLC or the SD
46  * Card Association for any damages, any infringements of patents or other
47  * right of the SD Group, SD-3C LLC, the SD Card Association or any third
48  * parties, which may result from its use. No license is granted by
49  * implication, estoppel or otherwise under any patent or other rights of the
50  * SD Group, SD-3C LLC, the SD Card Association or any third party. Nothing
51  * herein shall be construed as an obligation by the SD Group, the SD-3C LLC
52  * or the SD Card Association to disclose or distribute any technical
53  * information, know-how or other confidential information to any third party.
54  *
55  */
56 
57 #ifndef _SDIOB_H
58 #define	_SDIOB_H
59 
60 #define	SDIOB_NAME			sdiob
61 #define	_SDIOB_NAME_S(x)		__STRING(x)
62 #define	SDIOB_NAME_S			_SDIOB_NAME_S(SDIOB_NAME)
63 
64 #ifdef _SYS_BUS_H_
65 /* Ivars for sdiob. */
66 enum sdiob_dev_enum {
67 	SDIOB_IVAR_SUPPORT_MULTIBLK,
68 	SDIOB_IVAR_FUNCTION,
69 	SDIOB_IVAR_FUNCNUM,
70 	SDIOB_IVAR_CLASS,
71 	SDIOB_IVAR_VENDOR,
72 	SDIOB_IVAR_DEVICE,
73 	SDIOB_IVAR_DRVDATA,
74 };
75 
76 #define	SDIOB_ACCESSOR(var, ivar, type)				\
77     __BUS_ACCESSOR(sdio, var, SDIOB, ivar, type)
78 
79 SDIOB_ACCESSOR(support_multiblk,SUPPORT_MULTIBLK,	bool)
80 SDIOB_ACCESSOR(function,	FUNCTION,		struct sdio_func *)
81 SDIOB_ACCESSOR(funcnum,		FUNCNUM,		uint8_t)
82 SDIOB_ACCESSOR(class,		CLASS,			uint8_t)
83 SDIOB_ACCESSOR(vendor,		VENDOR,			uint16_t)
84 SDIOB_ACCESSOR(device,		DEVICE,			uint16_t)
85 SDIOB_ACCESSOR(drvdata,		DRVDATA,		void *)
86 
87 #undef SDIOB_ACCESSOR
88 #endif  /* _SYS_BUS_H_ */
89 
90 #endif	/* _SDIOB_H */
91