xref: /freebsd/sys/dev/isci/environment.h (revision 39ee7a7a6bdd1557b1c3532abf60d139798ac88b)
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
5  * All rights reserved.
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  *
11  *   * Redistributions of source code must retain the above copyright
12  *     notice, this list of conditions and the following disclaimer.
13  *   * Redistributions in binary form must reproduce the above copyright
14  *     notice, this list of conditions and the following disclaimer in
15  *     the documentation and/or other materials provided with the
16  *     distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * $FreeBSD$
31  */
32 
33 #ifndef ENVIRONMENT_H_
34 #define ENVIRONMENT_H_
35 
36 /**
37  * @file
38  *
39  * @brief Types and macros specific to the FreeBSD environment.
40  */
41 #include <sys/cdefs.h>
42 #include <sys/types.h>
43 #include <sys/libkern.h>
44 #include <machine/bus.h>
45 #include <opt_isci.h>
46 
47 typedef int8_t 		S8;
48 typedef uint8_t		U8;
49 
50 typedef int16_t		S16;
51 typedef uint16_t	U16;
52 
53 typedef int32_t		S32;
54 typedef uint32_t	U32;
55 
56 typedef int64_t		S64;
57 typedef uint64_t	U64;
58 
59 /* Technically, this should be defined as bus_addr_t, but SCIL makes some
60  *  incorrect assumptions in some of its physical address calculations which
61  *  necessitate using uint64_t here to avoid compiler warnings.  This is
62  *  easier for now than modifying SCIL, and works just as well.
63  */
64 typedef uint64_t	SCI_PHYSICAL_ADDRESS;
65 
66 typedef U64		SATI_LBA;
67 typedef void *		FUNCPTR;
68 
69 #define sci_cb_physical_address_upper(address) ((uint32_t)((address)>>32))
70 #define sci_cb_physical_address_lower(address) ((uint32_t)((address)&0xFFFFFFFF))
71 #define sci_cb_make_physical_address(physical_address, address_upper, address_lower) \
72 	((physical_address) = ((U64)(address_upper))<<32 | (address_lower))
73 
74 #define INLINE __inline
75 
76 #define PLACEMENT_HINTS(...)
77 
78 #define SCIC_SDS_4_ENABLED 1
79 #define PBG_BUILD 1
80 #define PHY_MAX_LINK_SPEED_GENERATION 3
81 
82 /* SCIL defines logging as SCI_LOGGING, but the FreeBSD driver name is ISCI.
83 	So we define ISCI_LOGGING as the option exported to the kernel, and
84 	translate it here. */
85 #ifdef ISCI_LOGGING
86 #define SCI_LOGGING
87 #endif
88 
89 #define __SCI_LIBRARY_MAJOR_VERSION__ 3
90 #define __SCI_LIBRARY_MINOR_VERSION__ 1
91 #define __SCI_LIBRARY_BUILD_VERSION__ 7142
92 
93 #define SATI_TRANSPORT_SUPPORTS_SATA
94 #define SATI_TRANSPORT_SUPPORTS_SAS
95 #define USE_ABSTRACT_LIST_FUNCTIONS
96 
97 #define ASSERT(cond)
98 #define assert(cond)
99 
100 #endif /* ENVIRONMENT_H_ */
101