| 1 | /******************************************************************************* |
| 2 | Copyright (C) Marvell International Ltd. and its affiliates |
| 3 | |
| 4 | This software file (the "File") is owned and distributed by Marvell |
| 5 | International Ltd. and/or its affiliates ("Marvell") under the following |
| 6 | alternative licensing terms. Once you have made an election to distribute the |
| 7 | File under one of the following license alternatives, please (i) delete this |
| 8 | introductory statement regarding license alternatives, (ii) delete the two |
| 9 | license alternatives that you have not elected to use and (iii) preserve the |
| 10 | Marvell copyright notice above. |
| 11 | |
| 12 | |
| 13 | ******************************************************************************** |
| 14 | Marvell GPL License Option |
| 15 | |
| 16 | If you received this File from Marvell, you may opt to use, redistribute and/or |
| 17 | modify this File in accordance with the terms and conditions of the General |
| 18 | Public License Version 2, June 1991 (the "GPL License"), a copy of which is |
| 19 | available along with the File in the license.txt file or by writing to the Free |
| 20 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or |
| 21 | on the worldwide web at http://www.gnu.org/licenses/gpl.txt. |
| 22 | |
| 23 | THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED |
| 24 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY |
| 25 | DISCLAIMED. The GPL License provides additional details about this warranty |
| 26 | disclaimer. |
| 27 | *******************************************************************************/ |
| 28 | /******************************************************************************* |
| 29 | * mvOsLinux.h - O.S. interface header file for Linux |
| 30 | * |
| 31 | * DESCRIPTION: |
| 32 | * This header file contains OS dependent definition under Linux |
| 33 | * |
| 34 | * DEPENDENCIES: |
| 35 | * Linux kernel header files. |
| 36 | * |
| 37 | * FILE REVISION NUMBER: |
| 38 | * $Revision: 1.1 $ |
| 39 | *******************************************************************************/ |
| 40 | |
| 41 | #ifndef __INCmvOsLinuxh |
| 42 | #define __INCmvOsLinuxh |
| 43 | |
| 44 | /* Includes */ |
| 45 | #include <linux/autoconf.h> |
| 46 | #include <linux/module.h> |
| 47 | #include <linux/types.h> |
| 48 | #include <linux/string.h> |
| 49 | #include <linux/kernel.h> |
| 50 | #include <linux/timer.h> |
| 51 | #include <linux/mm.h> |
| 52 | #include <linux/interrupt.h> |
| 53 | #include <linux/major.h> |
| 54 | #include <linux/errno.h> |
| 55 | #include <linux/genhd.h> |
| 56 | #include <linux/slab.h> |
| 57 | #include <linux/delay.h> |
| 58 | #include <linux/ide.h> |
| 59 | #include <linux/pci.h> |
| 60 | |
| 61 | #include <asm/byteorder.h> |
| 62 | #include <asm/irq.h> |
| 63 | #include <asm/uaccess.h> |
| 64 | #include <asm/io.h> |
| 65 | #include "mvOs.h" |
| 66 | |
| 67 | |
| 68 | /* Definitions */ |
| 69 | #define MV_DEFAULT_QUEUE_DEPTH 2 |
| 70 | #define MV_SATA_SUPPORT_EDMA_SINGLE_DATA_REGION |
| 71 | #define MV_SATA_SUPPORT_GEN2E_128_QUEUE_LEN |
| 72 | |
| 73 | #ifdef CONFIG_MV88F6082 |
| 74 | #define MV_SATA_OVERRIDE_SW_QUEUE_SIZE |
| 75 | #define MV_SATA_REQUESTED_SW_QUEUE_SIZE 2 |
| 76 | #undef MV_SATA_SUPPORT_GEN2E_128_QUEUE_LEN |
| 77 | #endif |
| 78 | |
| 79 | /* System dependent macro for flushing CPU write cache */ |
| 80 | #if defined (MV_BRIDGE_SYNC_REORDER) |
| 81 | #define MV_CPU_WRITE_BUFFER_FLUSH() do { \ |
| 82 | wmb(); \ |
| 83 | mvOsBridgeReorderWA(); \ |
| 84 | } while (0) |
| 85 | #else |
| 86 | #define MV_CPU_WRITE_BUFFER_FLUSH() wmb() |
| 87 | #endif /* CONFIG_MV78XX0 */ |
| 88 | |
| 89 | /* System dependent little endian from / to CPU conversions */ |
| 90 | #define MV_CPU_TO_LE16(x) cpu_to_le16(x) |
| 91 | #define MV_CPU_TO_LE32(x) cpu_to_le32(x) |
| 92 | |
| 93 | #define MV_LE16_TO_CPU(x) le16_to_cpu(x) |
| 94 | #define MV_LE32_TO_CPU(x) le32_to_cpu(x) |
| 95 | |
| 96 | #ifdef __BIG_ENDIAN_BITFIELD |
| 97 | #define MV_BIG_ENDIAN_BITFIELD |
| 98 | #endif |
| 99 | |
| 100 | /* System dependent register read / write in byte/word/dword variants */ |
| 101 | #define MV_REG_WRITE_BYTE(base, offset, val) writeb(val, base + offset) |
| 102 | #define MV_REG_WRITE_WORD(base, offset, val) writew(val, base + offset) |
| 103 | #define MV_REG_WRITE_DWORD(base, offset, val) writel(val, base + offset) |
| 104 | #define MV_REG_READ_BYTE(base, offset) readb(base + offset) |
| 105 | #define MV_REG_READ_WORD(base, offset) readw(base + offset) |
| 106 | #define MV_REG_READ_DWORD(base, offset) readl(base + offset) |
| 107 | |
| 108 | |
| 109 | /* Typedefs */ |
| 110 | |
| 111 | /* System dependant typedefs */ |
| 112 | typedef void *MV_VOID_PTR; |
| 113 | typedef u32 *MV_U32_PTR; |
| 114 | typedef u16 *MV_U16_PTR; |
| 115 | typedef u8 *MV_U8_PTR; |
| 116 | typedef char *MV_CHAR_PTR; |
| 117 | typedef void *MV_BUS_ADDR_T; |
| 118 | typedef unsigned long MV_CPU_FLAGS; |
| 119 | |
| 120 | |
| 121 | /* Structures */ |
| 122 | /* System dependent structure */ |
| 123 | typedef struct mvOsSemaphore |
| 124 | { |
| 125 | int notUsed; |
| 126 | } MV_OS_SEMAPHORE; |
| 127 | |
| 128 | |
| 129 | /* Functions (User implemented)*/ |
| 130 | |
| 131 | /* Semaphore init, take and release */ |
| 132 | #define mvOsSemInit(x) MV_TRUE |
| 133 | #define mvOsSemTake(x) |
| 134 | #define mvOsSemRelease(x) |
| 135 | |
| 136 | /* Interrupt masking and unmasking functions */ |
| 137 | MV_CPU_FLAGS mvOsSaveFlagsAndMaskCPUInterrupts(MV_VOID); |
| 138 | MV_VOID mvOsRestoreFlags(MV_CPU_FLAGS); |
| 139 | |
| 140 | /* Delay function in micro seconds resolution */ |
| 141 | void mvMicroSecondsDelay(MV_VOID_PTR, MV_U32); |
| 142 | |
| 143 | /* Typedefs */ |
| 144 | typedef enum mvBoolean |
| 145 | { |
| 146 | MV_SFALSE, MV_STRUE |
| 147 | } MV_BOOLEAN; |
| 148 | |
| 149 | /* System logging function */ |
| 150 | #include "mvLog.h" |
| 151 | /* Enable READ/WRITE Long SCSI command only when driver is compiled for debugging */ |
| 152 | #ifdef MV_LOGGER |
| 153 | #define MV_SATA_SUPPORT_READ_WRITE_LONG |
| 154 | #endif |
| 155 | |
| 156 | #define MV_IAL_LOG_ID 3 |
| 157 | |
| 158 | #endif /* __INCmvOsLinuxh */ |
| 159 | |