1230557Sjimharris/*-
2230557Sjimharris * BSD LICENSE
3230557Sjimharris *
4230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
5230557Sjimharris * All rights reserved.
6230557Sjimharris *
7230557Sjimharris * Redistribution and use in source and binary forms, with or without
8230557Sjimharris * modification, are permitted provided that the following conditions
9230557Sjimharris * are met:
10230557Sjimharris *
11230557Sjimharris *   * Redistributions of source code must retain the above copyright
12230557Sjimharris *     notice, this list of conditions and the following disclaimer.
13230557Sjimharris *   * Redistributions in binary form must reproduce the above copyright
14230557Sjimharris *     notice, this list of conditions and the following disclaimer in
15230557Sjimharris *     the documentation and/or other materials provided with the
16230557Sjimharris *     distribution.
17230557Sjimharris *
18230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29230557Sjimharris *
30230557Sjimharris * $FreeBSD$
31230557Sjimharris */
32230557Sjimharris
33230557Sjimharris#ifndef ENVIRONMENT_H_
34230557Sjimharris#define ENVIRONMENT_H_
35230557Sjimharris
36230557Sjimharris/**
37230557Sjimharris * @file
38230557Sjimharris *
39230557Sjimharris * @brief Types and macros specific to the FreeBSD environment.
40230557Sjimharris */
41230557Sjimharris#include <sys/cdefs.h>
42230557Sjimharris#include <sys/types.h>
43230557Sjimharris#include <sys/libkern.h>
44230557Sjimharris#include <machine/bus.h>
45230557Sjimharris#include <opt_isci.h>
46230557Sjimharris
47230557Sjimharristypedef int8_t 		S8;
48230557Sjimharristypedef uint8_t		U8;
49230557Sjimharris
50230557Sjimharristypedef int16_t		S16;
51230557Sjimharristypedef uint16_t	U16;
52230557Sjimharris
53230557Sjimharristypedef int32_t		S32;
54230557Sjimharristypedef uint32_t	U32;
55230557Sjimharris
56230557Sjimharristypedef int64_t		S64;
57230557Sjimharristypedef uint64_t	U64;
58230557Sjimharris
59230557Sjimharris/* Technically, this should be defined as bus_addr_t, but SCIL makes some
60230557Sjimharris *  incorrect assumptions in some of its physical address calculations which
61230557Sjimharris *  necessitate using uint64_t here to avoid compiler warnings.  This is
62230557Sjimharris *  easier for now than modifying SCIL, and works just as well.
63230557Sjimharris */
64230557Sjimharristypedef uint64_t	SCI_PHYSICAL_ADDRESS;
65230557Sjimharris
66230557Sjimharristypedef U64		SATI_LBA;
67230557Sjimharristypedef void *		FUNCPTR;
68230557Sjimharris
69230557Sjimharris#define sci_cb_physical_address_upper(address) ((uint32_t)((address)>>32))
70230557Sjimharris#define sci_cb_physical_address_lower(address) ((uint32_t)((address)&0xFFFFFFFF))
71230557Sjimharris#define sci_cb_make_physical_address(physical_address, address_upper, address_lower) \
72230557Sjimharris	((physical_address) = ((U64)(address_upper))<<32 | (address_lower))
73230557Sjimharris
74230557Sjimharris#define INLINE __inline
75230557Sjimharris
76230557Sjimharris#define PLACEMENT_HINTS(...)
77230557Sjimharris
78230557Sjimharris#define SCIC_SDS_4_ENABLED 1
79230557Sjimharris#define PBG_BUILD 1
80230557Sjimharris#define PHY_MAX_LINK_SPEED_GENERATION 3
81230557Sjimharris
82230557Sjimharris/* SCIL defines logging as SCI_LOGGING, but the FreeBSD driver name is ISCI.
83230557Sjimharris	So we define ISCI_LOGGING as the option exported to the kernel, and
84230557Sjimharris	translate it here. */
85230557Sjimharris#ifdef ISCI_LOGGING
86230557Sjimharris#define SCI_LOGGING
87230557Sjimharris#endif
88230557Sjimharris
89230557Sjimharris#define __SCI_LIBRARY_MAJOR_VERSION__ 3
90230557Sjimharris#define __SCI_LIBRARY_MINOR_VERSION__ 1
91230557Sjimharris#define __SCI_LIBRARY_BUILD_VERSION__ 7142
92230557Sjimharris
93230557Sjimharris#define SATI_TRANSPORT_SUPPORTS_SATA
94230557Sjimharris#define SATI_TRANSPORT_SUPPORTS_SAS
95230557Sjimharris#define USE_ABSTRACT_LIST_FUNCTIONS
96230557Sjimharris
97230557Sjimharris#define ASSERT(cond)
98230557Sjimharris#define assert(cond)
99230557Sjimharris
100230557Sjimharris#endif /* ENVIRONMENT_H_ */
101