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