SHM_UNLOCK: fix Unevictable pages stranded after swap
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / spectra / ffsport.h
blob85c0750612f6058dcc10305d9a979643410c9a4f
1 /*
2 * NAND Flash Controller Device Driver
3 * Copyright (c) 2009, Intel Corporation and its suppliers.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef _FFSPORT_
21 #define _FFSPORT_
23 #include "ffsdefs.h"
25 #if defined __GNUC__
26 #define PACKED
27 #define PACKED_GNU __attribute__ ((packed))
28 #define UNALIGNED
29 #endif
31 #include <linux/semaphore.h>
32 #include <linux/string.h> /* for strcpy(), stricmp(), etc */
33 #include <linux/mm.h> /* for kmalloc(), kfree() */
34 #include <linux/vmalloc.h>
35 #include <linux/module.h>
36 #include <linux/moduleparam.h>
37 #include <linux/init.h>
39 #include <linux/kernel.h> /* printk() */
40 #include <linux/fs.h> /* everything... */
41 #include <linux/errno.h> /* error codes */
42 #include <linux/types.h> /* size_t */
43 #include <linux/genhd.h>
44 #include <linux/blkdev.h>
45 #include <linux/hdreg.h>
46 #include <linux/pci.h>
47 #include "flash.h"
49 #define VERBOSE 1
51 #define NAND_DBG_WARN 1
52 #define NAND_DBG_DEBUG 2
53 #define NAND_DBG_TRACE 3
55 extern int nand_debug_level;
57 #ifdef VERBOSE
58 #define nand_dbg_print(level, args...) \
59 do { \
60 if (level <= nand_debug_level) \
61 printk(KERN_ALERT args); \
62 } while (0)
63 #else
64 #define nand_dbg_print(level, args...)
65 #endif
67 #ifdef SUPPORT_BIG_ENDIAN
68 #define INVERTUINT16(w) ((u16)(((u16)(w)) << 8) | \
69 (u16)((u16)(w) >> 8))
71 #define INVERTUINT32(dw) (((u32)(dw) << 24) | \
72 (((u32)(dw) << 8) & 0x00ff0000) | \
73 (((u32)(dw) >> 8) & 0x0000ff00) | \
74 ((u32)(dw) >> 24))
75 #else
76 #define INVERTUINT16(w) w
77 #define INVERTUINT32(dw) dw
78 #endif
80 extern int GLOB_Calc_Used_Bits(u32 n);
81 extern u64 GLOB_u64_Div(u64 addr, u32 divisor);
82 extern u64 GLOB_u64_Remainder(u64 addr, u32 divisor_type);
83 extern int register_spectra_ftl(void);
85 #endif /* _FFSPORT_ */