1f11c7f63SJim Harris /*- 2*718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause 3*718cf2ccSPedro 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 * $FreeBSD$ 33f11c7f63SJim Harris */ 34f11c7f63SJim Harris 35f11c7f63SJim Harris #ifndef ENVIRONMENT_H_ 36f11c7f63SJim Harris #define ENVIRONMENT_H_ 37f11c7f63SJim Harris 38f11c7f63SJim Harris /** 39f11c7f63SJim Harris * @file 40f11c7f63SJim Harris * 41f11c7f63SJim Harris * @brief Types and macros specific to the FreeBSD environment. 42f11c7f63SJim Harris */ 43f11c7f63SJim Harris #include <sys/cdefs.h> 44f11c7f63SJim Harris #include <sys/types.h> 45f11c7f63SJim Harris #include <sys/libkern.h> 46f11c7f63SJim Harris #include <machine/bus.h> 474e38d895SWarner Losh #include "opt_isci.h" 48f11c7f63SJim Harris 49f11c7f63SJim Harris typedef int8_t S8; 50f11c7f63SJim Harris typedef uint8_t U8; 51f11c7f63SJim Harris 52f11c7f63SJim Harris typedef int16_t S16; 53f11c7f63SJim Harris typedef uint16_t U16; 54f11c7f63SJim Harris 55f11c7f63SJim Harris typedef int32_t S32; 56f11c7f63SJim Harris typedef uint32_t U32; 57f11c7f63SJim Harris 58f11c7f63SJim Harris typedef int64_t S64; 59f11c7f63SJim Harris typedef uint64_t U64; 60f11c7f63SJim Harris 61f11c7f63SJim Harris /* Technically, this should be defined as bus_addr_t, but SCIL makes some 62f11c7f63SJim Harris * incorrect assumptions in some of its physical address calculations which 63f11c7f63SJim Harris * necessitate using uint64_t here to avoid compiler warnings. This is 64f11c7f63SJim Harris * easier for now than modifying SCIL, and works just as well. 65f11c7f63SJim Harris */ 66f11c7f63SJim Harris typedef uint64_t SCI_PHYSICAL_ADDRESS; 67f11c7f63SJim Harris 68f11c7f63SJim Harris typedef U64 SATI_LBA; 69f11c7f63SJim Harris typedef void * FUNCPTR; 70f11c7f63SJim Harris 71f11c7f63SJim Harris #define sci_cb_physical_address_upper(address) ((uint32_t)((address)>>32)) 72f11c7f63SJim Harris #define sci_cb_physical_address_lower(address) ((uint32_t)((address)&0xFFFFFFFF)) 73f11c7f63SJim Harris #define sci_cb_make_physical_address(physical_address, address_upper, address_lower) \ 74f11c7f63SJim Harris ((physical_address) = ((U64)(address_upper))<<32 | (address_lower)) 75f11c7f63SJim Harris 76f11c7f63SJim Harris #define INLINE __inline 77f11c7f63SJim Harris 78f11c7f63SJim Harris #define PLACEMENT_HINTS(...) 79f11c7f63SJim Harris 80f11c7f63SJim Harris #define SCIC_SDS_4_ENABLED 1 81f11c7f63SJim Harris #define PBG_BUILD 1 82f11c7f63SJim Harris #define PHY_MAX_LINK_SPEED_GENERATION 3 83f11c7f63SJim Harris 84f11c7f63SJim Harris /* SCIL defines logging as SCI_LOGGING, but the FreeBSD driver name is ISCI. 85f11c7f63SJim Harris So we define ISCI_LOGGING as the option exported to the kernel, and 86f11c7f63SJim Harris translate it here. */ 87f11c7f63SJim Harris #ifdef ISCI_LOGGING 88f11c7f63SJim Harris #define SCI_LOGGING 89f11c7f63SJim Harris #endif 90f11c7f63SJim Harris 91f11c7f63SJim Harris #define __SCI_LIBRARY_MAJOR_VERSION__ 3 92f11c7f63SJim Harris #define __SCI_LIBRARY_MINOR_VERSION__ 1 93f11c7f63SJim Harris #define __SCI_LIBRARY_BUILD_VERSION__ 7142 94f11c7f63SJim Harris 95f11c7f63SJim Harris #define SATI_TRANSPORT_SUPPORTS_SATA 96f11c7f63SJim Harris #define SATI_TRANSPORT_SUPPORTS_SAS 97f11c7f63SJim Harris #define USE_ABSTRACT_LIST_FUNCTIONS 98f11c7f63SJim Harris 99f11c7f63SJim Harris #define ASSERT(cond) 100f11c7f63SJim Harris #define assert(cond) 101f11c7f63SJim Harris 102f11c7f63SJim Harris #endif /* ENVIRONMENT_H_ */ 103