summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-08 00:53:00 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-08 00:53:00 +0000
commitb8553086288629b4efb77e97f5582e08bc50ad65 (patch)
tree0a19bd1c21e148f35c7a0f76baa4f7a056b966b0 /include/linux
parent75b6d92f2dd5112b02f4e78cf9f35f9825946ef0 (diff)
Merge with 2.4.0-test3-pre4.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/blk.h20
-rw-r--r--include/linux/blkdev.h11
-rw-r--r--include/linux/dcache.h35
-rw-r--r--include/linux/devfs_fs_kernel.h21
-rw-r--r--include/linux/fs.h4
-rw-r--r--include/linux/fs_struct.h18
-rw-r--r--include/linux/init.h23
-rw-r--r--include/linux/jffs.h206
-rw-r--r--include/linux/matroxfb.h2
-rw-r--r--include/linux/mtd/cfi.h99
-rw-r--r--include/linux/mtd/compatmac.h202
-rw-r--r--include/linux/mtd/doc2000.h114
-rw-r--r--include/linux/mtd/flashchip.h65
-rw-r--r--include/linux/mtd/ftl.h73
-rw-r--r--include/linux/mtd/iflash.h98
-rw-r--r--include/linux/mtd/jedec.h69
-rw-r--r--include/linux/mtd/map.h103
-rw-r--r--include/linux/mtd/mapped.h92
-rw-r--r--include/linux/mtd/mtd.h217
-rw-r--r--include/linux/mtd/nand.h31
-rw-r--r--include/linux/mtd/nftl.h101
-rw-r--r--include/linux/mtd/pmc551.h121
-rw-r--r--include/linux/ncp_fs_sb.h1
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/quotaops.h2
-rw-r--r--include/linux/sched.h19
-rw-r--r--include/linux/timer.h42
-rw-r--r--include/linux/tpqic02.h7
-rw-r--r--include/linux/tty.h1
-rw-r--r--include/linux/usbdevice_fs.h1
30 files changed, 1693 insertions, 107 deletions
diff --git a/include/linux/blk.h b/include/linux/blk.h
index e8b5e5a85..ce00d0602 100644
--- a/include/linux/blk.h
+++ b/include/linux/blk.h
@@ -145,7 +145,6 @@ static void floppy_off(unsigned int nr);
/* Hard disk: timeout is 6 seconds. */
#define DEVICE_NAME "hard disk"
#define DEVICE_INTR do_hd
-#define DEVICE_TIMEOUT HD_TIMER
#define TIMEOUT_VALUE (6*HZ)
#define DEVICE_REQUEST do_hd_request
#define DEVICE_NR(device) (MINOR(device)>>6)
@@ -404,27 +403,8 @@ static void floppy_off(unsigned int nr);
static void (*DEVICE_INTR)(void) = NULL;
#endif
-#ifdef DEVICE_TIMEOUT
-
-#define SET_TIMER \
-((timer_table[DEVICE_TIMEOUT].expires = jiffies + TIMEOUT_VALUE), \
-(timer_active |= 1<<DEVICE_TIMEOUT))
-
-#define CLEAR_TIMER \
-timer_active &= ~(1<<DEVICE_TIMEOUT)
-
-#define SET_INTR(x) \
-if ((DEVICE_INTR = (x)) != NULL) \
- SET_TIMER; \
-else \
- CLEAR_TIMER;
-
-#else
-
#define SET_INTR(x) (DEVICE_INTR = (x))
-#endif /* DEVICE_TIMEOUT */
-
#ifdef DEVICE_REQUEST
static void (DEVICE_REQUEST)(request_queue_t *);
#endif
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 5b62f88ad..262d5ea37 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -23,9 +23,8 @@ struct request {
int elevator_sequence;
struct list_head table;
- /*
- * queue free list belongs to
- */
+ struct list_head *free_list;
+
volatile int rq_status; /* should split this into a few status bits */
#define RQ_INACTIVE (-1)
#define RQ_ACTIVE 1
@@ -70,16 +69,14 @@ typedef void (unplug_device_fn) (void *q);
/*
* Default nr free requests per queue
*/
-#define QUEUE_NR_REQUESTS 512
-#define QUEUE_WRITES_MAX ((2 * QUEUE_NR_REQUESTS) / 3)
+#define QUEUE_NR_REQUESTS 256
struct request_queue
{
/*
* the queue request freelist, one for reads and one for writes
*/
- struct list_head request_freelist;
- int queue_requests;
+ struct list_head request_freelist[2];
/*
* Together with queue_head for cacheline sharing
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 12bbfbdc1..bae5641fd 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -1,11 +1,11 @@
#ifndef __LINUX_DCACHE_H
#define __LINUX_DCACHE_H
+#ifdef __KERNEL__
+
#include <asm/atomic.h>
#include <linux/mount.h>
-#ifdef __KERNEL__
-
/*
* linux/include/linux/dcache.h
*
@@ -57,7 +57,7 @@ static __inline__ unsigned int full_name_hash(const unsigned char * name, unsign
#define DNAME_INLINE_LEN 16
struct dentry {
- int d_count;
+ atomic_t d_count;
unsigned int d_flags;
struct inode * d_inode; /* Where the name belongs to - NULL is negative */
struct dentry * d_parent; /* parent directory */
@@ -92,7 +92,16 @@ struct dentry_operations {
* might be a negative dentry which has no information associated with
* it */
-
+/*
+locking rules:
+ big lock dcache_lock may block
+d_revalidate: no no yes
+d_hash no no yes
+d_compare: no yes no
+d_delete: no yes no
+d_release: no no yes
+d_iput: no no yes
+ */
/* d_flags entries */
#define DCACHE_AUTOFS_PENDING 0x0001 /* autofs: "under construction" */
@@ -107,6 +116,8 @@ struct dentry_operations {
* s_nfsd_free_path semaphore will be down
*/
+extern spinlock_t dcache_lock;
+
/**
* d_drop - drop a dentry
* @dentry: dentry to drop
@@ -126,8 +137,10 @@ struct dentry_operations {
static __inline__ void d_drop(struct dentry * dentry)
{
+ spin_lock(&dcache_lock);
list_del(&dentry->d_hash);
INIT_LIST_HEAD(&dentry->d_hash);
+ spin_unlock(&dcache_lock);
}
static __inline__ int dname_external(struct dentry *d)
@@ -200,10 +213,6 @@ extern int d_validate(struct dentry *, struct dentry *, unsigned int, unsigned i
extern char * __d_path(struct dentry *, struct vfsmount *, struct dentry *,
struct vfsmount *, char *, int);
-/* write full pathname into buffer and return start of pathname */
-#define d_path(dentry, vfsmnt, buffer, buflen) \
- __d_path(dentry, vfsmnt, current->fs->root, current->fs->rootmnt, \
- buffer, buflen)
/* Allocation counts.. */
@@ -219,7 +228,7 @@ extern char * __d_path(struct dentry *, struct vfsmount *, struct dentry *,
static __inline__ struct dentry * dget(struct dentry *dentry)
{
if (dentry)
- dentry->d_count++;
+ atomic_inc(&dentry->d_count);
return dentry;
}
@@ -235,14 +244,18 @@ static __inline__ int d_unhashed(struct dentry *dentry)
return list_empty(&dentry->d_hash);
}
-extern void dput(struct dentry *);
+extern void __dput(struct dentry *);
+static __inline__ void dput(struct dentry *dentry)
+{
+ if (dentry && atomic_dec_and_test(&dentry->d_count))
+ __dput(dentry);
+}
static __inline__ int d_mountpoint(struct dentry *dentry)
{
return !list_empty(&dentry->d_vfsmnt);
}
-
#endif /* __KERNEL__ */
#endif /* __LINUX_DCACHE_H */
diff --git a/include/linux/devfs_fs_kernel.h b/include/linux/devfs_fs_kernel.h
index 8173779f3..4db152030 100644
--- a/include/linux/devfs_fs_kernel.h
+++ b/include/linux/devfs_fs_kernel.h
@@ -58,15 +58,12 @@ extern devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
unsigned int major, unsigned int minor,
umode_t mode, void *ops, void *info);
extern void devfs_unregister (devfs_handle_t de);
-extern int devfs_mk_symlink (devfs_handle_t dir,
- const char *name, unsigned int namelen,
- unsigned int flags,
- const char *link, unsigned int linklength,
+extern int devfs_mk_symlink (devfs_handle_t dir, const char *name,
+ unsigned int flags, const char *link,
devfs_handle_t *handle, void *info);
extern devfs_handle_t devfs_mk_dir (devfs_handle_t dir, const char *name,
- unsigned int namelen, void *info);
-extern devfs_handle_t devfs_find_handle (devfs_handle_t dir,
- const char *name,unsigned int namelen,
+ void *info);
+extern devfs_handle_t devfs_find_handle (devfs_handle_t dir, const char *name,
unsigned int major,unsigned int minor,
char type, int traverse_symlinks);
extern int devfs_get_flags (devfs_handle_t de, unsigned int *flags);
@@ -117,23 +114,19 @@ static inline void devfs_unregister (devfs_handle_t de)
{
return;
}
-static inline int devfs_mk_symlink (devfs_handle_t dir,
- const char *name, unsigned int namelen,
- unsigned int flags,
- const char *link, unsigned int linklength,
+static inline int devfs_mk_symlink (devfs_handle_t dir, const char *name,
+ unsigned int flags, const char *link,
devfs_handle_t *handle, void *info)
{
return 0;
}
static inline devfs_handle_t devfs_mk_dir (devfs_handle_t dir,
- const char *name,
- unsigned int namelen, void *info)
+ const char *name, void *info)
{
return NULL;
}
static inline devfs_handle_t devfs_find_handle (devfs_handle_t dir,
const char *name,
- unsigned int namelen,
unsigned int major,
unsigned int minor,
char type,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b30bb8a08..da3f0e56e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -86,7 +86,9 @@ extern int max_super_blocks, nr_super_blocks;
*/
#define FS_SINGLE 8 /*
* Filesystem that can have only one superblock;
- * kernel-wide vfsmnt is kept in ->kern_mnt.
+ * kernel-wide vfsmnt is placed in ->kern_mnt by
+ * kern_mount() which must be called _after_
+ * register_filesystem().
*/
#define FS_NOMOUNT 16 /* Never mount from userland */
#define FS_LITTER 32 /* Keeps the tree in dcache */
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 53f9c44f7..3d2df3cf4 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -4,6 +4,7 @@
struct fs_struct {
atomic_t count;
+ rwlock_t lock;
int umask;
struct dentry * root, * pwd, * altroot;
struct vfsmount * rootmnt, * pwdmnt, * altrootmnt;
@@ -11,6 +12,7 @@ struct fs_struct {
#define INIT_FS { \
ATOMIC_INIT(1), \
+ RW_LOCK_UNLOCKED, \
0022, \
NULL, NULL, NULL, NULL, NULL, NULL \
}
@@ -27,10 +29,14 @@ static inline void set_fs_root(struct fs_struct *fs,
struct vfsmount *mnt,
struct dentry *dentry)
{
- struct dentry *old_root = fs->root;
- struct vfsmount *old_rootmnt = fs->rootmnt;
+ struct dentry *old_root;
+ struct vfsmount *old_rootmnt;
+ write_lock(&fs->lock);
+ old_root = fs->root;
+ old_rootmnt = fs->rootmnt;
fs->rootmnt = mntget(mnt);
fs->root = dget(dentry);
+ write_unlock(&fs->lock);
if (old_root) {
dput(old_root);
mntput(old_rootmnt);
@@ -46,10 +52,14 @@ static inline void set_fs_pwd(struct fs_struct *fs,
struct vfsmount *mnt,
struct dentry *dentry)
{
- struct dentry *old_pwd = fs->pwd;
- struct vfsmount *old_pwdmnt = fs->pwdmnt;
+ struct dentry *old_pwd;
+ struct vfsmount *old_pwdmnt;
+ write_lock(&fs->lock);
+ old_pwd = fs->pwd;
+ old_pwdmnt = fs->pwdmnt;
fs->pwdmnt = mntget(mnt);
fs->pwd = dget(dentry);
+ write_unlock(&fs->lock);
if (old_pwd) {
dput(old_pwd);
mntput(old_pwdmnt);
diff --git a/include/linux/init.h b/include/linux/init.h
index 20fc892e9..6300d86da 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -43,11 +43,14 @@
* Used for initialization calls..
*/
typedef int (*initcall_t)(void);
+typedef void (*exitcall_t)(void);
extern initcall_t __initcall_start, __initcall_end;
#define __initcall(fn) \
static initcall_t __initcall_##fn __init_call = fn
+#define __exitcall(fn) \
+ static exitcall_t __exitcall_##fn __exit_call = fn
/*
* Used for kernel command line parameter setup
@@ -75,6 +78,7 @@ extern struct kernel_param __setup_start, __setup_end;
#define __exitdata __attribute__ ((unused, __section__ (".data.exit")))
#define __initsetup __attribute__ ((unused,__section__ (".setup.init")))
#define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
+#define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit")))
/* For assembly routines */
#define __INIT .section ".text.init","ax"
@@ -82,7 +86,7 @@ extern struct kernel_param __setup_start, __setup_end;
#define __INITDATA .section ".data.init","aw"
#define module_init(x) __initcall(x);
-#define module_exit(x) /* nothing */
+#define module_exit(x) __exitcall(x);
#else
@@ -98,8 +102,21 @@ extern struct kernel_param __setup_start, __setup_end;
/* Not sure what version aliases were introduced in, but certainly in 2.91.66. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91)
-#define module_init(x) int init_module(void) __attribute__((alias(#x)));
-#define module_exit(x) void cleanup_module(void) __attribute__((alias(#x)));
+/* These macros create a dummy inline: gcc 2.9x does not count alias
+ as usage, hence the `unused function' warning when __init functions
+ are declared static. We use the dummy __*_module_inline functions
+ both to kill the warning and check the type of the init/cleanup
+ function. */
+typedef int (*__init_module_func_t)(void);
+typedef void (*__cleanup_module_func_t)(void);
+#define module_init(x) \
+ int init_module(void) __attribute__((alias(#x))); \
+ extern inline __init_module_func_t __init_module_inline(void) \
+ { return x; }
+#define module_exit(x) \
+ void cleanup_module(void) __attribute__((alias(#x))); \
+ extern inline __cleanup_module_func_t __cleanup_module_inline(void) \
+ { return x; }
#else
#define module_init(x) int init_module(void) { return x(); }
#define module_exit(x) void cleanup_module(void) { x(); }
diff --git a/include/linux/jffs.h b/include/linux/jffs.h
new file mode 100644
index 000000000..07621e2d5
--- /dev/null
+++ b/include/linux/jffs.h
@@ -0,0 +1,206 @@
+/*
+ * JFFS -- Journalling Flash File System, Linux implementation.
+ *
+ * Copyright (C) 1999, 2000 Finn Hakansson, Axis Communications, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * $Id: jffs.h,v 1.5 2000/06/13 14:22:48 alex Exp $
+ *
+ * Ported to Linux 2.3.x and MTD:
+ * Copyright (C) 2000 Alexander Larsson (alex@cendio.se), Cendio Systems AB
+ *
+ */
+
+#ifndef __LINUX_JFFS_H__
+#define __LINUX_JFFS_H__
+
+#define JFFS_VERSION_STRING "1.0"
+
+/* This is a magic number that is used as an identification number for
+ this file system. It is written to the super_block structure. */
+#define JFFS_MAGIC_SB_BITMASK 0x07c0 /* 1984 */
+
+/* This is a magic number that every on-flash raw inode begins with. */
+#define JFFS_MAGIC_BITMASK 0x34383931 /* "1984" */
+
+/* These two bitmasks are the valid ones for the flash memories we have
+ for the moment. */
+#define JFFS_EMPTY_BITMASK 0xffffffff
+#define JFFS_DIRTY_BITMASK 0x00000000
+
+/* This is the inode number of the root node. */
+#define JFFS_MIN_INO 1
+
+/* How many slots in the file hash table should we have? */
+#define JFFS_HASH_SIZE 40
+
+/* Don't use more than 254 bytes as the maximum allowed length of a file's
+ name due to errors that could occur during the scanning of the flash
+ memory. In fact, a name length of 255 or 0xff, could be the result of
+ an uncompleted write. For instance, if a raw inode is written to the
+ flash memory and there is a power lossage just before the length of
+ the name is written, the length 255 would be interpreted as an illegal
+ value. */
+#define JFFS_MAX_NAME_LEN 254
+
+/* Commands for ioctl(). */
+#define JFFS_IOCTL_MAGIC 't'
+#define JFFS_PRINT_HASH _IO(JFFS_IOCTL_MAGIC, 90)
+#define JFFS_PRINT_TREE _IO(JFFS_IOCTL_MAGIC, 91)
+#define JFFS_GET_STATUS _IO(JFFS_IOCTL_MAGIC, 92)
+
+/* XXX: This is something that we should try to get rid of in the future. */
+#define JFFS_MODIFY_INODE 0x01
+#define JFFS_MODIFY_NAME 0x02
+#define JFFS_MODIFY_DATA 0x04
+#define JFFS_MODIFY_EXIST 0x08
+
+/* Using the garbage collection mechanism. */
+#define USE_GC
+
+struct jffs_control;
+
+/* The JFFS raw inode structure: Used for storage on physical media. */
+/* Perhaps the uid, gid, atime, mtime and ctime members should have
+ more space due to future changes in the Linux kernel. Anyhow, since
+ a user of this filesystem probably have to fix a large number of
+ other things, we have decided to not be forward compatible. */
+struct jffs_raw_inode
+{
+ __u32 magic; /* A constant magic number. */
+ __u32 ino; /* Inode number. */
+ __u32 pino; /* Parent's inode number. */
+ __u32 version; /* Version number. */
+ __u32 mode; /* The file's type or mode. */
+ __u16 uid; /* The file's owner. */
+ __u16 gid; /* The file's group. */
+ __u32 atime; /* Last access time. */
+ __u32 mtime; /* Last modification time. */
+ __u32 ctime; /* Creation time. */
+ __u32 offset; /* Where to begin to write. */
+ __u32 dsize; /* Size of the node's data. */
+ __u32 rsize; /* How much are going to be replaced? */
+ __u8 nsize; /* Name length. */
+ __u8 nlink; /* Number of links. */
+ __u8 spare : 6; /* For future use. */
+ __u8 rename : 1; /* Is this a special rename? */
+ __u8 deleted : 1; /* Has this file been deleted? */
+ __u8 accurate; /* The inode is obsolete if accurate == 0. */
+ __u32 dchksum; /* Checksum for the data. */
+ __u16 nchksum; /* Checksum for the name. */
+ __u16 chksum; /* Checksum for the raw inode. */
+};
+
+/* Define the offset of the accurate byte in struct jffs_raw_inode. */
+#define JFFS_RAW_INODE_ACCURATE_OFFSET (sizeof(struct jffs_raw_inode) \
+ - 2 * sizeof(__u32) - sizeof(__u8))
+
+/* Define the offset of the chksum member in struct jffs_raw_inode. */
+#define JFFS_RAW_INODE_CHKSUM_OFFSET (sizeof(struct jffs_raw_inode) \
+ - sizeof(__u16))
+
+/* Define the offset of the dchksum member in struct jffs_raw_inode. */
+#define JFFS_RAW_INODE_DCHKSUM_OFFSET (sizeof(struct jffs_raw_inode) \
+ - sizeof(__u16) - sizeof(__u16) \
+ - sizeof(__u32))
+
+
+/* The RAM representation of the node. The names of pointers to
+ jffs_nodes are very often just called `n' in the source code. */
+struct jffs_node
+{
+ __u32 ino; /* Inode number. */
+ __u32 version; /* Version number. */
+ __u32 data_offset; /* Logic location of the data to insert. */
+ __u32 data_size; /* The amount of data this node inserts. */
+ __u32 removed_size; /* The amount of data that this node removes. */
+ __u32 fm_offset; /* Physical location of the data in the actual
+ flash memory data chunk. */
+ __u8 name_size; /* Size of the name. */
+ struct jffs_fm *fm; /* Physical memory information. */
+ struct jffs_node *version_prev;
+ struct jffs_node *version_next;
+ struct jffs_node *range_prev;
+ struct jffs_node *range_next;
+};
+
+
+/* The RAM representation of a file (plain files, directories,
+ links, etc.). Pointers to jffs_files are normally named `f'
+ in the JFFS source code. */
+struct jffs_file
+{
+ __u32 ino; /* Inode number. */
+ __u32 pino; /* Parent's inode number. */
+ __u32 mode; /* file_type, mode */
+ __u16 uid; /* owner */
+ __u16 gid; /* group */
+ __u32 atime; /* Last access time. */
+ __u32 mtime; /* Last modification time. */
+ __u32 ctime; /* Creation time. */
+ __u8 nsize; /* Name length. */
+ __u8 nlink; /* Number of links. */
+ __u8 deleted; /* Has this file been deleted? */
+ char *name; /* The name of this file; NULL-terminated. */
+ __u32 size; /* The total size of the file's data. */
+ __u32 highest_version; /* The highest version number of this file. */
+ struct jffs_control *c;
+ struct jffs_file *parent; /* Reference to the parent directory. */
+ struct jffs_file *children; /* Always NULL for plain files. */
+ struct jffs_file *sibling_prev; /* Siblings in the same directory. */
+ struct jffs_file *sibling_next;
+ struct list_head hash; /* hash list. */
+ struct jffs_node *range_head; /* The final data. */
+ struct jffs_node *range_tail; /* The first data. */
+ struct jffs_node *version_head; /* The youngest node. */
+ struct jffs_node *version_tail; /* The oldest node. */
+};
+
+
+/* A struct for the overall file system control. Pointers to
+ jffs_control structs are named `c' in the source code. */
+struct jffs_control
+{
+ struct super_block *sb; /* Reference to the VFS super block. */
+ struct jffs_file *root; /* The root directory file. */
+ struct list_head *hash; /* Hash table for finding files by ino. */
+ struct jffs_fmcontrol *fmc; /* Flash memory control structure. */
+ __u32 hash_len; /* The size of the hash table. */
+ __u32 next_ino; /* Next inode number to use for new files. */
+ __u16 building_fs; /* Is the file system being built right now? */
+};
+
+
+/* Used to inform about flash status. */
+struct jffs_flash_status
+{
+ __u32 size;
+ __u32 used;
+ __u32 dirty;
+ __u32 begin;
+ __u32 end;
+};
+
+/* This stuff could be used for finding memory leaks. */
+#define JFFS_MEMORY_DEBUG 0
+
+#if defined(JFFS_MEMORY_DEBUG) && JFFS_MEMORY_DEBUG
+extern long no_jffs_file;
+extern long no_jffs_node;
+extern long no_jffs_control;
+extern long no_jffs_raw_inode;
+extern long no_jffs_node_ref;
+extern long no_jffs_fm;
+extern long no_jffs_fmcontrol;
+extern long no_hash;
+extern long no_name;
+#define DJM(x) x
+#else
+#define DJM(x)
+#endif
+
+#endif /* __LINUX_JFFS_H__ */
diff --git a/include/linux/matroxfb.h b/include/linux/matroxfb.h
index 182d76b25..baf4bcbac 100644
--- a/include/linux/matroxfb.h
+++ b/include/linux/matroxfb.h
@@ -8,6 +8,7 @@ struct matroxioc_output_mode {
__u32 output; /* which output */
#define MATROXFB_OUTPUT_PRIMARY 0x0000
#define MATROXFB_OUTPUT_SECONDARY 0x0001
+#define MATROXFB_OUTPUT_DFP 0x0002
__u32 mode; /* which mode */
#define MATROXFB_OUTPUT_MODE_PAL 0x0001
#define MATROXFB_OUTPUT_MODE_NTSC 0x0002
@@ -19,6 +20,7 @@ struct matroxioc_output_mode {
/* bitfield */
#define MATROXFB_OUTPUT_CONN_PRIMARY (1 << MATROXFB_OUTPUT_PRIMARY)
#define MATROXFB_OUTPUT_CONN_SECONDARY (1 << MATROXFB_OUTPUT_SECONDARY)
+#define MATROXFB_OUTPUT_CONN_DFP (1 << MATROXFB_OUTPUT_DFP)
/* connect these outputs to this framebuffer */
#define MATROXFB_SET_OUTPUT_CONNECTION _IOW('n',0xF8,sizeof(__u32))
/* which outputs are connected to this framebuffer */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
new file mode 100644
index 000000000..46cb1d94b
--- /dev/null
+++ b/include/linux/mtd/cfi.h
@@ -0,0 +1,99 @@
+
+/* Common Flash Interface structures
+ * See http://support.intel.com/design/flash/technote/index.htm
+ * $Id: cfi.h,v 1.6 2000/07/03 13:29:16 dwmw2 Exp $
+ */
+
+#ifndef __MTD_CFI_H__
+#define __MTD_CFI_H__
+
+#include <linux/types.h>
+#include <linux/mtd/flashchip.h>
+
+/* NB: We keep these structures in memory in HOST byteorder, except
+ * where individually noted.
+ */
+
+/* Basic Query Structure */
+struct cfi_ident {
+ __u8 qry[3];
+ __u16 P_ID;
+ __u16 P_ADR;
+ __u16 A_ID;
+ __u16 A_ADR;
+ __u8 VccMin;
+ __u8 VccMax;
+ __u8 VppMin;
+ __u8 VppMax;
+ __u8 WordWriteTimeoutTyp;
+ __u8 BufWriteTimeoutTyp;
+ __u8 BlockEraseTimeoutTyp;
+ __u8 ChipEraseTimeoutTyp;
+ __u8 WordWriteTimeoutMax;
+ __u8 BufWriteTimeoutMax;
+ __u8 BlockEraseTimeoutMax;
+ __u8 ChipEraseTimeoutMax;
+ __u8 DevSize;
+ __u16 InterfaceDesc;
+ __u16 MaxBufWriteSize;
+ __u8 NumEraseRegions;
+ __u32 EraseRegionInfo[1]; /* Not host ordered */
+} __attribute__((packed));
+
+/* Extended Query Structure for both PRI and ALT */
+
+struct cfi_extquery {
+ __u8 pri[3];
+ __u8 MajorVersion;
+ __u8 MinorVersion;
+} __attribute__((packed));
+
+/* Vendor-Specific PRI for Intel/Sharp Extended Command Set (0x0001) */
+
+struct cfi_pri_intelext {
+ __u8 pri[3];
+ __u8 MajorVersion;
+ __u8 MinorVersion;
+ __u32 FeatureSupport;
+ __u8 SuspendCmdSupport;
+ __u16 BlkStatusRegMask;
+ __u8 VccOptimal;
+ __u8 VppOptimal;
+} __attribute__((packed));
+
+struct cfi_pri_query {
+ __u8 NumFields;
+ __u32 ProtField[1]; /* Not host ordered */
+} __attribute__((packed));
+
+struct cfi_bri_query {
+ __u8 PageModeReadCap;
+ __u8 NumFields;
+ __u32 ConfField[1]; /* Not host ordered */
+} __attribute__((packed));
+
+#define P_ID_NONE 0
+#define P_ID_INTEL_EXT 1
+#define P_ID_AMD_STD 2
+#define P_ID_INTEL_STD 3
+#define P_ID_AMD_EXT 4
+#define P_ID_MITSUBISHI_STD 256
+#define P_ID_MITSUBISHI_EXT 257
+#define P_ID_RESERVED 65535
+
+
+struct cfi_private {
+ __u16 cmdset;
+ void *cmdset_priv;
+ int interleave;
+ struct mtd_info *(*cmdset_setup)(struct map_info *);
+ struct cfi_ident cfiq; /* For now only one. We insist that all devs
+ must be of the same type. */
+ int numchips;
+ unsigned long chipshift; /* Because they're of the same type */
+ struct flchip chips[0]; /* per-chip data structure for each chip */
+};
+
+#define MAX_CFI_CHIPS 8 /* Entirely arbitrary to avoid realloc() */
+
+#endif /* __MTD_CFI_H__ */
diff --git a/include/linux/mtd/compatmac.h b/include/linux/mtd/compatmac.h
new file mode 100644
index 000000000..e6844448c
--- /dev/null
+++ b/include/linux/mtd/compatmac.h
@@ -0,0 +1,202 @@
+
+/*
+ * mtd/include/compatmac.h
+ *
+ * $Id: compatmac.h,v 1.4 2000/07/03 10:01:38 dwmw2 Exp $
+ *
+ * Extensions and omissions from the normal 'linux/compatmac.h'
+ * files. hopefully this will end up empty as the 'real' one
+ * becomes fully-featured.
+ */
+
+
+/* First, include the parts which the kernel is good enough to provide
+ * to us
+ */
+
+#ifndef __LINUX_MTD_COMPATMAC_H__
+#define __LINUX_MTD_COMPATMAC_H__
+
+#include <linux/compatmac.h>
+#include <linux/types.h> /* used later in this header */
+#include <linux/module.h>
+#ifndef LINUX_VERSION_CODE
+#include <linux/version.h>
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
+#include <linux/vmalloc.h>
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,0,0)
+# error "This kernel is too old: not supported by this file"
+#endif
+
+/* Modularization issues */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,18)
+# define __USE_OLD_SYMTAB__
+# define EXPORT_NO_SYMBOLS register_symtab(NULL);
+# define REGISTER_SYMTAB(tab) register_symtab(tab)
+#else
+# define REGISTER_SYMTAB(tab) /* nothing */
+#endif
+
+#ifdef __USE_OLD_SYMTAB__
+# define __MODULE_STRING(s) /* nothing */
+# define MODULE_PARM(v,t) /* nothing */
+# define MODULE_PARM_DESC(v,t) /* nothing */
+# define MODULE_AUTHOR(n) /* nothing */
+# define MODULE_DESCRIPTION(d) /* nothing */
+# define MODULE_SUPPORTED_DEVICE(n) /* nothing */
+#endif
+
+/*
+ * "select" changed in 2.1.23. The implementation is twin, but this
+ * header is new
+ */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,22)
+# include <linux/poll.h>
+#else
+# define __USE_OLD_SELECT__
+#endif
+
+/* Other change in the fops are solved using pseudo-types */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
+# define lseek_t long long
+# define lseek_off_t long long
+#else
+# define lseek_t int
+# define lseek_off_t off_t
+#endif
+
+/* changed the prototype of read/write */
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) || defined(__alpha__)
+# define count_t unsigned long
+# define read_write_t long
+#else
+# define count_t int
+# define read_write_t int
+#endif
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,31)
+# define release_t void
+# define release_return(x) return
+#else
+# define release_t int
+# define release_return(x) return (x)
+#endif
+
+#if LINUX_VERSION_CODE < 0x20300
+#define __exit
+#endif
+#if LINUX_VERSION_CODE < 0x20200
+#define __init
+#else
+#include <linux/init.h>
+#endif
+
+#if LINUX_VERSION_CODE < 0x20300
+#define init_MUTEX(x) do {*(x) = MUTEX;} while (0)
+#define RQFUNC_ARG void
+#define blkdev_dequeue_request(req) do {CURRENT = req->next;} while (0)
+#else
+#define RQFUNC_ARG request_queue_t *q
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
+#define __MOD_INC_USE_COUNT(mod) \
+ (atomic_inc(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED|MOD_USED_ONCE)
+#define __MOD_DEC_USE_COUNT(mod) \
+ (atomic_dec(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED)
+#endif
+
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
+
+#define DECLARE_WAIT_QUEUE_HEAD(x) struct wait_queue *x = NULL
+#define init_waitqueue_head init_waitqueue
+
+static inline int try_inc_mod_count(struct module *mod)
+{
+ if (mod)
+ __MOD_INC_USE_COUNT(mod);
+ return 1;
+}
+#endif
+
+
+/* Yes, I'm aware that it's a fairly ugly hack.
+ Until the __constant_* macros appear in Linus' own kernels, this is
+ the way it has to be done.
+ DW 19/1/00
+ */
+
+#include <asm/byteorder.h>
+
+#ifndef __constant_cpu_to_le16
+
+#ifdef __BIG_ENDIAN
+#define __constant_cpu_to_le64(x) ___swab64((x))
+#define __constant_le64_to_cpu(x) ___swab64((x))
+#define __constant_cpu_to_le32(x) ___swab32((x))
+#define __constant_le32_to_cpu(x) ___swab32((x))
+#define __constant_cpu_to_le16(x) ___swab16((x))
+#define __constant_le16_to_cpu(x) ___swab16((x))
+#define __constant_cpu_to_be64(x) ((__u64)(x))
+#define __constant_be64_to_cpu(x) ((__u64)(x))
+#define __constant_cpu_to_be32(x) ((__u32)(x))
+#define __constant_be32_to_cpu(x) ((__u32)(x))
+#define __constant_cpu_to_be16(x) ((__u16)(x))
+#define __constant_be16_to_cpu(x) ((__u16)(x))
+#else
+#ifdef __LITTLE_ENDIAN
+#define __constant_cpu_to_le64(x) ((__u64)(x))
+#define __constant_le64_to_cpu(x) ((__u64)(x))
+#define __constant_cpu_to_le32(x) ((__u32)(x))
+#define __constant_le32_to_cpu(x) ((__u32)(x))
+#define __constant_cpu_to_le16(x) ((__u16)(x))
+#define __constant_le16_to_cpu(x) ((__u16)(x))
+#define __constant_cpu_to_be64(x) ___swab64((x))
+#define __constant_be64_to_cpu(x) ___swab64((x))
+#define __constant_cpu_to_be32(x) ___swab32((x))
+#define __constant_be32_to_cpu(x) ___swab32((x))
+#define __constant_cpu_to_be16(x) ___swab16((x))
+#define __constant_be16_to_cpu(x) ___swab16((x))
+#else
+#error No (recognised) endianness defined (unless it,s PDP)
+#endif /* __LITTLE_ENDIAN */
+#endif /* __BIG_ENDIAN */
+
+#endif /* ifndef __constant_cpu_to_le16 */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
+ #define mod_init_t int __init
+ #define mod_exit_t void
+#else
+ #define mod_init_t static int __init
+ #define mod_exit_t static void __exit
+#endif
+
+#ifndef THIS_MODULE
+#ifdef MODULE
+#define THIS_MODULE (&__this_module)
+#else
+#define THIS_MODULE (NULL)
+#endif
+#endif
+
+#if LINUX_VERSION_CODE < 0x20300
+#include <linux/interrupt.h>
+#define spin_lock_bh(lock) do {start_bh_atomic();spin_lock(lock);}while(0);
+#define spin_unlock_bh(lock) do {spin_unlock(lock);end_bh_atomic();}while(0);
+#else
+#include <asm/softirq.h>
+#include <linux/spinlock.h>
+#endif
+
+#endif /* __LINUX_MTD_COMPATMAC_H__ */
+
+
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
new file mode 100644
index 000000000..c10a1778e
--- /dev/null
+++ b/include/linux/mtd/doc2000.h
@@ -0,0 +1,114 @@
+
+/* Linux driver for Disk-On-Chip 2000 */
+/* (c) 1999 Machine Vision Holdings, Inc. */
+/* Author: David Woodhouse <dwmw2@mvhi.com> */
+/* $Id: doc2000.h,v 1.7 2000/06/26 20:40:53 dwmw2 Exp $ */
+
+#ifndef __MTD_DOC2000_H__
+#define __MTD_DOC2000_H__
+
+#include <linux/mtd/mtd.h>
+
+
+#define DoC_M_CDSN_IO 0x800
+#define DoC_Sig1 0
+#define DoC_Sig2 1
+
+#define DoC_ChipID 0x1000
+#define DoC_DOCStatus 0x1001
+#define DoC_DOCControl 0x1002
+#define DoC_FloorSelect 0x1003
+#define DoC_CDSNControl 0x1004
+#define DoC_CDSNDeviceSelect 0x1005
+#define DoC_ECCConf 0x1006
+#define DoC_2k_ECCStatus 0x1007
+
+#define DoC_CDSNSlowIO 0x100d
+#define DoC_ECCSyndrome0 0x1010
+#define DoC_ECCSyndrome1 0x1011
+#define DoC_ECCSyndrome2 0x1012
+#define DoC_ECCSyndrome3 0x1013
+#define DoC_ECCSyndrome4 0x1014
+#define DoC_ECCSyndrome5 0x1015
+#define DoC_AliasResolution 0x101b
+#define DoC_ConfigInput 0x101c
+#define DoC_ReadPipeInit 0x101d
+#define DoC_WritePipeTerm 0x101e
+#define DoC_LastDataRead 0x101f
+#define DoC_NOP 0x1020
+
+#define DoC_2k_CDSN_IO 0x1800
+
+/* How to access the device?
+ * On ARM, it'll be mmap'd directly with 32-bit wide accesses.
+ * On PPC, it's mmap'd and 16-bit wide.
+ * Others use readb/writeb
+ */
+#if defined(__arm__)
+#define ReadDOC(adr, reg) ((unsigned char)(*(__u32 *)(((unsigned long)adr)+(DoC_##reg<<2))))
+#define WriteDOC(d, adr, reg) do{ *(__u32 *)(((unsigned long)adr)+(DoC_##reg<<2)) = (__u32)d} while(0)
+#elif defined(__ppc__)
+#define ReadDOC(adr, reg) ((unsigned char)(*(__u16 *)(((unsigned long)adr)+(DoC_##reg<<1))))
+#define WriteDOC(d, adr, reg) do{ *(__u16 *)(((unsigned long)adr)+(DoC_##reg<<1)) = (__u16)d} while(0)
+#else
+#define ReadDOC(adr, reg) readb(((unsigned long)adr) + DoC_##reg)
+#define WriteDOC(d, adr, reg) writeb(d, ((unsigned long)adr) + DoC_##reg)
+#endif
+#define DOC_MODE_RESET 0
+#define DOC_MODE_NORMAL 1
+#define DOC_MODE_RESERVED1 2
+#define DOC_MODE_RESERVED2 3
+
+#define DOC_MODE_MDWREN 4
+#define DOC_MODE_CLR_ERR 0x80
+
+#define DOC_ChipID_Doc2k 0x20
+#define DOC_ChipID_DocMil 0x30
+
+#define CDSN_CTRL_FR_B 0x80
+#define CDSN_CTRL_ECC_IO 0x20
+#define CDSN_CTRL_FLASH_IO 0x10
+#define CDSN_CTRL_WP 8
+#define CDSN_CTRL_ALE 4
+#define CDSN_CTRL_CLE 2
+#define CDSN_CTRL_CE 1
+
+#define DOC_ECC_RESET 0
+#define DOC_ECC_ERROR 0x80
+#define DOC_ECC_RW 0x20
+#define DOC_ECC__EN 0x08
+#define DOC_TOGGLE_BIT 0x04
+#define DOC_ECC_RESV 0x02
+/* We have to also set the reserved bit 1 for enable */
+#define DOC_ECC_EN (DOC_ECC__EN | DOC_ECC_RESV)
+
+struct Nand {
+ char floor, chip;
+ unsigned long curadr;
+ unsigned char curmode;
+ /* Also some erase/write/pipeline info when we get that far */
+};
+
+#define MAX_FLOORS 4
+#define MAX_CHIPS 4
+
+struct DiskOnChip {
+ unsigned long physadr;
+ unsigned long virtadr;
+ unsigned long totlen;
+ char ChipID; /* Type of DiskOnChip */
+
+ unsigned long mfr; /* Flash IDs - only one type of flash per device */
+ unsigned long id;
+ int chipshift;
+
+ int curfloor;
+ int curchip;
+
+ int numchips;
+ struct Nand *chips;
+ struct mtd_info *nextdoc;
+};
+
+
+#endif /* __MTD_DOC2000_H__ */
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
new file mode 100644
index 000000000..17c7cec2c
--- /dev/null
+++ b/include/linux/mtd/flashchip.h
@@ -0,0 +1,65 @@
+
+/*
+ * struct flchip definition
+ *
+ * Contains information about the location and state of a given flash device
+ *
+ * (C) 2000 Red Hat. GPLd.
+ *
+ * $Id: flashchip.h,v 1.4 2000/07/03 12:58:41 dwmw2 Exp $
+ *
+ */
+
+#ifndef __MTD_FLASHCHIP_H__
+#define __MTD_FLASHCHIP_H__
+
+/* For spinlocks. sched.h includes spinlock.h from whichever directory it
+ * happens to be in - so we don't have to care whether we're on 2.2, which
+ * has asm/spinlock.h, or 2.4, which has linux/spinlock.h
+ */
+#include <linux/sched.h>
+
+typedef enum {
+ FL_READY,
+ FL_STATUS,
+ FL_CFI_QUERY,
+ FL_JEDEC_QUERY,
+ FL_ERASING,
+ FL_ERASE_SUSPENDED,
+ FL_WRITING,
+ FL_WRITE_SUSPENDED,
+ FL_PM_SUSPENDED,
+ FL_SYNCING,
+ FL_UNLOADING,
+ FL_UNKNOWN
+} flstate_t;
+
+
+
+/* NOTE: confusingly, this can be used to refer to more than one chip at a time,
+ if they're interleaved. */
+
+struct flchip {
+ unsigned long start; /* Offset within the map */
+ // unsigned long len;
+ /* We omit len for now, because when we group them together
+ we insist that they're all of the same size, and the chip size
+ is held in the next level up. If we get more versatile later,
+ it'll make it a damn sight harder to find which chip we want from
+ a given offset, and we'll want to add the per-chip length field
+ back in.
+ */
+ flstate_t state;
+ flstate_t oldstate;
+ spinlock_t *mutex;
+ spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
+ wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
+ to be ready */
+ int word_write_time;
+ int buffer_write_time;
+ int erase_time;
+};
+
+
+
+#endif /* __MTD_FLASHCHIP_H__ */
diff --git a/include/linux/mtd/ftl.h b/include/linux/mtd/ftl.h
new file mode 100644
index 000000000..4fc425262
--- /dev/null
+++ b/include/linux/mtd/ftl.h
@@ -0,0 +1,73 @@
+/*
+ * ftl.h 1.7 1999/10/25 20:23:17
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@pcmcia.sourceforge.org>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_FTL_H
+#define _LINUX_FTL_H
+
+typedef struct erase_unit_header_t {
+ u_int8_t LinkTargetTuple[5];
+ u_int8_t DataOrgTuple[10];
+ u_int8_t NumTransferUnits;
+ u_int32_t EraseCount;
+ u_int16_t LogicalEUN;
+ u_int8_t BlockSize;
+ u_int8_t EraseUnitSize;
+ u_int16_t FirstPhysicalEUN;
+ u_int16_t NumEraseUnits;
+ u_int32_t FormattedSize;
+ u_int32_t FirstVMAddress;
+ u_int16_t NumVMPages;
+ u_int8_t Flags;
+ u_int8_t Code;
+ u_int32_t SerialNumber;
+ u_int32_t AltEUHOffset;
+ u_int32_t BAMOffset;
+ u_int8_t Reserved[12];
+ u_int8_t EndTuple[2];
+} erase_unit_header_t;
+
+/* Flags in erase_unit_header_t */
+#define HIDDEN_AREA 0x01
+#define REVERSE_POLARITY 0x02
+#define DOUBLE_BAI 0x04
+
+/* Definitions for block allocation information */
+
+#define BLOCK_FREE(b) ((b) == 0xffffffff)
+#define BLOCK_DELETED(b) (((b) == 0) || ((b) == 0xfffffffe))
+
+#define BLOCK_TYPE(b) ((b) & 0x7f)
+#define BLOCK_ADDRESS(b) ((b) & ~0x7f)
+#define BLOCK_NUMBER(b) ((b) >> 9)
+#define BLOCK_CONTROL 0x30
+#define BLOCK_DATA 0x40
+#define BLOCK_REPLACEMENT 0x60
+#define BLOCK_BAD 0x70
+
+#endif /* _LINUX_FTL_H */
diff --git a/include/linux/mtd/iflash.h b/include/linux/mtd/iflash.h
new file mode 100644
index 000000000..50509ae22
--- /dev/null
+++ b/include/linux/mtd/iflash.h
@@ -0,0 +1,98 @@
+/* iflash.h $revision$ $date$ (David Hinds) */
+
+#ifndef __MTD_IFLASH_H__
+#define __MTD_IFLASH_H__
+
+/* Extended CIS registers for Series 2 and 2+ cards */
+/* The registers are all offsets from 0x4000 */
+#define CISREG_CSR 0x0100
+#define CISREG_WP 0x0104
+#define CISREG_RDYBSY 0x0140
+
+/* Extended CIS registers for Series 2 cards */
+#define CISREG_SLEEP 0x0118
+#define CISREG_RDY_MASK 0x0120
+#define CISREG_RDY_STATUS 0x0130
+
+/* Extended CIS registers for Series 2+ cards */
+#define CISREG_VCR 0x010c
+
+/* Card Status Register */
+#define CSR_SRESET 0x20 /* Soft reset */
+#define CSR_CMWP 0x10 /* Common memory write protect */
+#define CSR_PWRDOWN 0x08 /* Power down status */
+#define CSR_CISWP 0x04 /* Common memory CIS WP */
+#define CSR_WP 0x02 /* Mechanical write protect */
+#define CSR_READY 0x01 /* Ready/busy status */
+
+/* Write Protection Register */
+#define WP_BLKEN 0x04 /* Enable block locking */
+#define WP_CMWP 0x02 /* Common memory write protect */
+#define WP_CISWP 0x01 /* Common memory CIS WP */
+
+/* Voltage Control Register */
+#define VCR_VCC_LEVEL 0x80 /* 0 = 5V, 1 = 3.3V */
+#define VCR_VPP_VALID 0x02 /* Vpp Valid */
+#define VCR_VPP_GEN 0x01 /* Integrated Vpp generator */
+
+/* Ready/Busy Mode Register */
+#define RDYBSY_RACK 0x02 /* Ready acknowledge */
+#define RDYBSY_MODE 0x01 /* 1 = high performance */
+
+#define LOW(x) ((x) & 0xff)
+
+/* 28F008SA-Compatible Command Set */
+#define IF_READ_ARRAY 0xffff
+#define IF_INTEL_ID 0x9090
+#define IF_READ_CSR 0x7070
+#define IF_CLEAR_CSR 0x5050
+#define IF_WRITE 0x4040
+#define IF_BLOCK_ERASE 0x2020
+#define IF_ERASE_SUSPEND 0xb0b0
+#define IF_CONFIRM 0xd0d0
+
+/* 28F016SA Performance Enhancement Commands */
+#define IF_READ_PAGE 0x7575
+#define IF_PAGE_SWAP 0x7272
+#define IF_SINGLE_LOAD 0x7474
+#define IF_SEQ_LOAD 0xe0e0
+#define IF_PAGE_WRITE 0x0c0c
+#define IF_RDY_MODE 0x9696
+#define IF_RDY_LEVEL 0x0101
+#define IF_RDY_PULSE_WRITE 0x0202
+#define IF_RDY_PULSE_ERASE 0x0303
+#define IF_RDY_DISABLE 0x0404
+#define IF_LOCK_BLOCK 0x7777
+#define IF_UPLOAD_STATUS 0x9797
+#define IF_READ_ESR 0x7171
+#define IF_ERASE_UNLOCKED 0xa7a7
+#define IF_SLEEP 0xf0f0
+#define IF_ABORT 0x8080
+#define IF_UPLOAD_DEVINFO 0x9999
+
+/* Definitions for Compatible Status Register */
+#define CSR_WR_READY 0x8080 /* Write state machine status */
+#define CSR_ERA_SUSPEND 0x4040 /* Erase suspend status */
+#define CSR_ERA_ERR 0x2020 /* Erase status */
+#define CSR_WR_ERR 0x1010 /* Data write status */
+#define CSR_VPP_LOW 0x0808 /* Vpp status */
+
+/* Definitions for Global Status Register */
+#define GSR_WR_READY 0x8080 /* Write state machine status */
+#define GSR_OP_SUSPEND 0x4040 /* Operation suspend status */
+#define GSR_OP_ERR 0x2020 /* Device operation status */
+#define GSR_SLEEP 0x1010 /* Device sleep status */
+#define GSR_QUEUE_FULL 0x0808 /* Queue status */
+#define GSR_PAGE_AVAIL 0x0404 /* Page buffer available status */
+#define GSR_PAGE_READY 0x0202 /* Page buffer status */
+#define GSR_PAGE_SELECT 0x0101 /* Page buffer select status */
+
+/* Definitions for Block Status Register */
+#define BSR_READY 0x8080 /* Block status */
+#define BSR_UNLOCK 0x4040 /* Block lock status */
+#define BSR_FAILED 0x2020 /* Block operation status */
+#define BSR_ABORTED 0x1010 /* Operation abort status */
+#define BSR_QUEUE_FULL 0x0808 /* Queue status */
+#define BSR_VPP_LOW 0x0404 /* Vpp status */
+
+#endif /* __MTD_IFLASH_H__ */
diff --git a/include/linux/mtd/jedec.h b/include/linux/mtd/jedec.h
new file mode 100644
index 000000000..9d55006c7
--- /dev/null
+++ b/include/linux/mtd/jedec.h
@@ -0,0 +1,69 @@
+
+/* JEDEC Flash Interface.
+ * This is an older type of interface for self programming flash. It is
+ * commonly use in older AMD chips and is obsolete compared with CFI.
+ * It is called JEDEC because the JEDEC association distributes the ID codes
+ * for the chips.
+ *
+ * See the AMD flash databook for information on how to operate the interface.
+ *
+ * $Id: jedec.h,v 1.1 2000/07/04 07:21:51 jgg Exp $
+ */
+
+#ifndef __LINUX_MTD_JEDEC_H__
+#define __LINUX_MTD_JEDEC_H__
+
+#include <linux/types.h>
+#include <linux/mtd/map.h>
+
+#define MAX_JEDEC_CHIPS 16
+
+// Listing of all supported chips and their information
+struct JEDECTable
+{
+ __u16 jedec;
+ char *name;
+ unsigned long size;
+ unsigned long sectorsize;
+ __u32 capabilities;
+};
+
+// JEDEC being 0 is the end of the chip array
+struct jedec_flash_chip
+{
+ __u16 jedec;
+ unsigned long size;
+ unsigned long sectorsize;
+
+ // *(__u8*)(base + (adder << addrshift)) = data << datashift
+ // Address size = size << addrshift
+ unsigned long base; // Byte 0 of the flash, will be unaligned
+ unsigned int datashift; // Useful for 32bit/16bit accesses
+ unsigned int addrshift;
+ unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash
+
+ __u32 capabilities;
+
+ // These markers are filled in by the flash_chip_scan function
+ unsigned long start;
+ unsigned long length;
+};
+
+struct jedec_private
+{
+ unsigned long size; // Total size of all the devices
+
+ /* Bank handling. If sum(bank_fill) == size then this is linear flash.
+ Otherwise the mapping has holes in it. bank_fill may be used to
+ find the holes, but in the common symetric case
+ bank_fill[0] == bank_fill[*], thus addresses may be computed
+ mathmatically. bank_fill must be powers of two */
+ unsigned is_banked;
+ unsigned long bank_fill[MAX_JEDEC_CHIPS];
+
+ struct jedec_flash_chip chips[MAX_JEDEC_CHIPS];
+};
+
+extern const struct JEDECTable *jedec_idtoinf(__u8 mfr,__u8 id);
+
+#endif
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
new file mode 100644
index 000000000..4ca86bc4e
--- /dev/null
+++ b/include/linux/mtd/map.h
@@ -0,0 +1,103 @@
+
+/* Overhauled routines for dealing with different mmap regions of flash */
+/* $Id: map.h,v 1.5 2000/06/26 16:18:58 dwmw2 Exp $ */
+
+#ifndef __LINUX_MTD_MAP_H__
+#define __LINUX_MTD_MAP_H__
+
+#include <linux/types.h>
+#include <linux/mtd/mtd.h>
+#include <linux/kmod.h>
+#include <linux/malloc.h>
+
+/* The map stuff is very simple. You fill in your struct map_info with
+ a handful of routines for accessing the device, making sure they handle
+ paging etc. correctly if your device needs it. Then you pass it off
+ to a chip driver which deals with a mapped device - generally either
+ do_cfi_probe() or do_ram_probe(), either of which will return a
+ struct mtd_info if they liked what they saw. At which point, you
+ fill in the mtd->module with your own module address, and register
+ it.
+
+ The mtd->priv field will point to the struct map_info, and any further
+ private data required by the chip driver is linked from the
+ mtd->priv->fldrv_priv field. This allows the map driver to get at
+ the destructor function map->fldrv_destroy() when it's tired
+ of living.
+*/
+
+struct map_info {
+ char *name;
+ unsigned long size;
+ int buswidth; /* in octets */
+ __u8 (*read8)(struct map_info *, unsigned long);
+ __u16 (*read16)(struct map_info *, unsigned long);
+ __u32 (*read32)(struct map_info *, unsigned long);
+ /* If it returned a 'long' I'd call it readl.
+ * It doesn't.
+ * I won't.
+ * dwmw2 */
+
+ void (*copy_from)(struct map_info *, void *, unsigned long, ssize_t);
+ void (*write8)(struct map_info *, __u8, unsigned long);
+ void (*write16)(struct map_info *, __u16, unsigned long);
+ void (*write32)(struct map_info *, __u32, unsigned long);
+ void (*copy_to)(struct map_info *, unsigned long, const void *, ssize_t);
+ /* We put these two here rather than a single void *map_priv,
+ because we want mappers to be able to have quickly-accessible
+ cache for the 'currently-mapped page' without the _extra_
+ redirection that would be necessary. If you need more than
+ two longs, turn the second into a pointer. dwmw2 */
+ unsigned long map_priv_1;
+ unsigned long map_priv_2;
+ void *fldrv_priv;
+ void (*fldrv_destroy)(struct mtd_info *);
+};
+
+/*
+ * Probe for the contents of a map device and make an MTD structure
+ * if anything is recognised. Doesn't register it because the calling
+ * map driver needs to set the 'module' field first.
+ */
+static inline struct mtd_info *do_map_probe(struct map_info *map, char *funcname, char *modname)
+{
+ struct mtd_info *(*probe_p)(struct map_info *);
+ struct mtd_info *mtd = NULL;
+
+ probe_p = (void *)get_module_symbol(NULL, funcname);
+ if (!probe_p) {
+ request_module(modname);
+ probe_p = (void *)get_module_symbol(NULL, funcname);
+ }
+ if (probe_p) {
+ mtd = (*probe_p)(map);
+ put_module_symbol((unsigned long)probe_p);
+ }
+
+ return mtd;
+}
+
+
+/*
+ * Commonly-used probe functions for different types of chip.
+ */
+#define do_cfi_probe(x) do_map_probe(x, "cfi_probe", "cfi_probe")
+#define do_jedec_probe(x) do_map_probe(x, "jedec_probe", "jedec_probe")
+#define do_ram_probe(x) do_map_probe(x, "map_ram_probe", "map_ram")
+#define do_rom_probe(x) do_map_probe(x, "map_rom_probe", "map_rom")
+
+/*
+ * Destroy an MTD device which was created for a map device.
+ * Make sure the MTD device is already unregistered before calling this
+ */
+static inline void map_destroy(struct mtd_info *mtd)
+{
+ struct map_info *map = mtd->priv;
+
+ map->fldrv_destroy(mtd);
+ put_module_symbol((unsigned long)map->fldrv_destroy);
+ kfree(mtd);
+}
+
+
+#endif /* __LINUX_MTD_MAP_H__ */
diff --git a/include/linux/mtd/mapped.h b/include/linux/mtd/mapped.h
new file mode 100644
index 000000000..81668b71e
--- /dev/null
+++ b/include/linux/mtd/mapped.h
@@ -0,0 +1,92 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+// $Id: mapped.h,v 1.2 2000/03/14 17:13:12 dwmw2 Exp $
+/* ######################################################################
+
+ Memory Mapped MTD Routines
+
+ These routines are support routines for memory mapped chips, with
+ routines to support common sorts of flash. For devices that are based
+ on a memory mapped interface these routines provide everything necessary,
+ only a window changing function is required by the low level implementation.
+
+ The entry point to setup and register a memory mapped MTD device,
+ mtd_mapped_setup will perform a detection sequence that can determine
+ the type size and configuration of many sorts of chip setups.
+
+ ROMs and RAMs are detected and passed off to very simple routines, Flash
+ writing and erasing is handled as well.
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef __MTD_FLASH_H__
+#define __MTD_FLASH_H__
+
+#include <linux/types.h>
+#include <linux/mtd/mtd.h>
+
+// MTD flags for ordinary flash
+struct JEDECTable
+{
+ u_short jedec;
+ char *name;
+ u_long size;
+ u_long sectorsize;
+ u_long capabilities;
+};
+
+// JEDEC being 0 is the end of the chip array
+struct flash_chip
+{
+ u_short jedec;
+ u_long size;
+ u_long sectorsize;
+ u_long base;
+ u_long capabilities;
+
+ // These markers are filled in by the flash_chip_scan function
+ u_long start;
+ u_long length;
+};
+
+struct mapped_mtd_info
+{
+ struct mtd_info mtd;
+ u_long pagesize; // Size of the memory window
+ u_long maxsize; // Maximum MTD size in pages
+ u_char mfr,id;
+ char part[100]; // Part Catalogue number if available
+ int *lock;
+ // Multiple chip support, only used if this is type MTD_FLASH
+ u_char interleve; // Address chip interleve (0 = concatination)
+ struct flash_chip chips[5];
+
+ // Operations
+ unsigned long (*page)(struct mapped_mtd_info *map,unsigned long page);
+ int (*jedec_sense)(struct mapped_mtd_info *map);
+};
+
+extern struct JEDECTable mtd_JEDEC_table[];
+
+// Automatic configurators
+extern int mtd_mapped_setup(struct mapped_mtd_info *map);
+extern int mtd_mapped_remove(struct mapped_mtd_info *map);
+
+// Generic functions
+extern int flash_jedec(struct mapped_mtd_info *map);
+extern int flash_erase(struct mtd_info *map, struct erase_info *instr);
+extern int flash_write(struct mtd_info *map, loff_t start, size_t len,
+ size_t *retlen, const u_char *buf);
+extern int rom_read(struct mtd_info *map, loff_t start, size_t len,
+ size_t *retlen, u_char *buf);
+extern int ram_write(struct mtd_info *map, loff_t start, size_t len,
+ size_t *retlen, const u_char *buf);
+
+// Helpers
+extern int page_jump(struct mapped_mtd_info *map,unsigned long start,
+ unsigned long len,unsigned long *buffer,
+ unsigned long *size);
+extern void flash_chip_scan(struct mapped_mtd_info *map,unsigned long start,
+ unsigned long len);
+
+#endif /* __MTD_FLASH_H__ */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
new file mode 100644
index 000000000..a7bc521c2
--- /dev/null
+++ b/include/linux/mtd/mtd.h
@@ -0,0 +1,217 @@
+
+/* $Id: mtd.h,v 1.17 2000/07/04 07:24:49 jgg Exp $ */
+
+#ifndef __MTD_MTD_H__
+#define __MTD_MTD_H__
+
+#ifdef __KERNEL__
+
+#include <linux/version.h>
+#include <linux/types.h>
+#include <linux/mtd/compatmac.h>
+#include <linux/module.h>
+
+#endif /* __KERNEL__ */
+
+struct erase_info_user {
+ unsigned long start;
+ unsigned long length;
+};
+
+struct mtd_oob_buf {
+ loff_t start;
+ ssize_t length;
+ unsigned char *ptr;
+};
+
+
+#define MTD_CHAR_MAJOR 90
+#define MTD_BLOCK_MAJOR 31
+#define MAX_MTD_DEVICES 16
+
+
+
+#define MTD_ABSENT 0
+#define MTD_RAM 1
+#define MTD_ROM 2
+#define MTD_NORFLASH 3
+#define MTD_NANDFLASH 4
+#define MTD_PEROM 5
+#define MTD_OTHER 14
+#define MTD_UNKNOWN 15
+
+
+
+#define MTD_CLEAR_BITS 1 // Bits can be cleared (flash)
+#define MTD_SET_BITS 2 // Bits can be set
+#define MTD_ERASEABLE 4 // Has an erase function
+#define MTD_WRITEB_WRITEABLE 8 // Direct IO is possible
+#define MTD_VOLATILE 16 // Set for RAMs
+#define MTD_XIP 32 // eXecute-In-Place possible
+#define MTD_OOB 64 // Out-of-band data (NAND flash)
+#define MTD_ECC 128 // Device capable of automatic ECC
+
+// Some common devices / combinations of capabilities
+#define MTD_CAP_ROM 0
+#define MTD_CAP_RAM (MTD_CLEAR_BITS|MTD_SET_BITS|MTD_WRITEB_WRITEABLE)
+#define MTD_CAP_NORFLASH (MTD_CLEAR_BITS|MTD_ERASEABLE)
+#define MTD_CAP_NANDFLASH (MTD_CLEAR_BITS|MTD_ERASEABLE|MTD_OOB)
+#define MTD_WRITEABLE (MTD_CLEAR_BITS|MTD_SET_BITS)
+
+
+// Types of automatic ECC/Checksum available
+#define MTD_ECC_NONE 0 // No automatic ECC available
+#define MTD_ECC_RS_DiskOnChip 1 // Automatic ECC on DiskOnChip
+
+struct mtd_info_user {
+ u_char type;
+ u_long flags;
+ u_long size; // Total size of the MTD
+ u_long erasesize;
+ u_long oobblock; // Size of OOB blocks (e.g. 512)
+ u_long oobsize; // Amount of OOB data per block (e.g. 16)
+ u_long ecctype;
+ u_long eccsize;
+};
+
+#define MEMGETINFO _IOR('M', 1, struct mtd_info_user)
+#define MEMERASE _IOW('M', 2, struct erase_info_user)
+#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf)
+#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf)
+
+#ifndef __KERNEL__
+
+typedef struct mtd_info_user mtd_info_t;
+typedef struct erase_info_user erase_info_t;
+
+ /* User-space ioctl definitions */
+
+
+#else /* __KERNEL__ */
+
+
+#define MTD_ERASE_PENDING 0x01
+#define MTD_ERASING 0x02
+#define MTD_ERASE_SUSPEND 0x04
+#define MTD_ERASE_DONE 0x08
+#define MTD_ERASE_FAILED 0x10
+
+struct erase_info {
+ struct mtd_info *mtd;
+ u_long addr;
+ u_long len;
+ u_long time;
+ u_long retries;
+ u_int dev;
+ u_int cell;
+ void (*callback) (struct erase_info *self);
+ u_long priv;
+ u_char state;
+ struct erase_info *next;
+};
+
+
+struct mtd_info {
+ u_char type;
+ u_long flags;
+ u_long size; // Total size of the MTD
+ u_long erasesize;
+ u_long oobblock; // Size of OOB blocks (e.g. 512)
+ u_long oobsize; // Amount of OOB data per block (e.g. 16)
+ u_long ecctype;
+ u_long eccsize;
+
+ // Kernel-only stuff starts here.
+ char *name;
+
+ u_long bank_size;
+
+ struct module *module;
+ int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
+
+ /* This stuff for eXecute-In-Place */
+ int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf);
+
+ /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
+ void (*unpoint) (struct mtd_info *mtd, u_char * addr);
+
+
+ int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
+ int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
+
+ int (*read_ecc) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf, u_char *eccbuf);
+ int (*write_ecc) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf, u_char *eccbuf);
+
+ int (*read_oob) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
+ int (*write_oob) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
+
+ void (*sync) (struct mtd_info *mtd);
+
+ /* Power Management functions */
+ int (*suspend) (struct mtd_info *mtd);
+ void (*resume) (struct mtd_info *mtd);
+
+ void *priv;
+};
+
+
+ /* Kernel-side ioctl definitions */
+
+extern int add_mtd_device(struct mtd_info *mtd);
+extern int del_mtd_device (struct mtd_info *mtd);
+
+extern struct mtd_info *__get_mtd_device(struct mtd_info *mtd, int num);
+
+static inline struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
+{
+ struct mtd_info *ret;
+
+ ret = __get_mtd_device(mtd, num);
+
+ if (ret && ret->module && !try_inc_mod_count(ret->module))
+ return NULL;
+
+ return ret;
+}
+
+static inline void put_mtd_device(struct mtd_info *mtd)
+{
+ if (mtd->module)
+ __MOD_DEC_USE_COUNT(mtd->module);
+}
+
+
+struct mtd_notifier {
+ void (*add)(struct mtd_info *mtd);
+ void (*remove)(struct mtd_info *mtd);
+ struct mtd_notifier *next;
+};
+
+
+extern void register_mtd_user (struct mtd_notifier *new);
+extern int unregister_mtd_user (struct mtd_notifier *old);
+
+
+#ifndef MTDC
+#define MTD_ERASE(mtd, args...) (*(mtd->erase))(mtd, args)
+#define MTD_POINT(mtd, a,b,c,d) (*(mtd->point))(mtd, a,b,c, (u_char **)(d))
+#define MTD_UNPOINT(mtd, arg) (*(mtd->unpoint))(mtd, (u_char *)arg)
+#define MTD_READ(mtd, args...) (*(mtd->read))(mtd, args)
+#define MTD_WRITE(mtd, args...) (*(mtd->write))(mtd, args)
+#define MTD_READOOB(mtd, args...) (*(mtd->read_oob))(mtd, args)
+#define MTD_WRITEOOB(mtd, args...) (*(mtd->write_oob))(mtd, args)
+#define MTD_SYNC(mtd) do { if (mtd->sync) (*(mtd->sync))(mtd); } while (0)
+#endif /* MTDC */
+
+/* Debugging macros */
+
+#ifdef DEBUGLVL
+#define DEBUG(n, args...) if (DEBUGLVL>(n)) printk(KERN_DEBUG args)
+#else
+#define DEBUG(n, args...)
+#endif
+
+#endif /* __KERNEL__ */
+
+
+#endif /* __MTD_MTD_H__ */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
new file mode 100644
index 000000000..79ca1843c
--- /dev/null
+++ b/include/linux/mtd/nand.h
@@ -0,0 +1,31 @@
+
+/* Defines for NAND flash devices */
+/* (c) 1999 Machine Vision Holdings, Inc. */
+/* Author: David Woodhouse <dwmw2@mvhi.com> */
+/* $Id: nand.h,v 1.2 1999/08/17 22:57:08 dwmw2 Exp $ */
+
+#ifndef __MTD_NAND_H__
+#define __MTD_NAND_H__
+
+#define NAND_CMD_READ0 0
+#define NAND_CMD_READ1 1
+#define NAND_CMD_PAGEPROG 0x10
+#define NAND_CMD_READOOB 0x50
+#define NAND_CMD_ERASE1 0x60
+#define NAND_CMD_STATUS 0x70
+#define NAND_CMD_SEQIN 0x80
+#define NAND_CMD_READID 0x90
+#define NAND_CMD_ERASE2 0xd0
+#define NAND_CMD_RESET 0xff
+
+#define NAND_MFR_TOSHIBA 0x98
+#define NAND_MFR_SAMSUNG 0xec
+
+
+#endif /* __MTD_NAND_H__ */
+
+
+
+
+
+
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
new file mode 100644
index 000000000..153fa5c6a
--- /dev/null
+++ b/include/linux/mtd/nftl.h
@@ -0,0 +1,101 @@
+
+/* Defines for NAND Flash Translation Layer */
+/* (c) 1999 Machine Vision Holdings, Inc. */
+/* Author: David Woodhouse <dwmw2@mvhi.com> */
+/* $Id: nftl.h,v 1.6 2000/03/31 15:12:20 dwmw2 Exp $ */
+
+#ifndef __MTD_NFTL_H__
+#define __MTD_NFTL_H__
+
+#include <linux/mtd/mtd.h>
+
+/* Block Control Information */
+
+struct nftl_bci {
+ unsigned char ECCSig[6];
+ __u16 Status;
+}__attribute__((packed));
+
+/* Unit Control Information */
+
+struct nftl_uci0 {
+ __u16 VirtUnitNum;
+ __u16 ReplUnitNum;
+ __u16 SpareVirtUnitNum;
+ __u16 SpareReplUnitNum;
+} __attribute__((packed));
+
+struct nftl_uci1 {
+ __u32 WearInfo;
+ __u16 EraseMark;
+ __u16 EraseMark1;
+} __attribute__((packed));
+
+struct nftl_uci2 {
+ __u32 WriteInh;
+ __u32 unused;
+} __attribute__((packed));
+
+union nftl_uci {
+ struct nftl_uci0 a;
+ struct nftl_uci1 b;
+ struct nftl_uci2 c;
+};
+
+struct nftl_oob {
+ struct nftl_bci b;
+ union nftl_uci u;
+};
+
+/* NFTL Media Header */
+
+struct NFTLMediaHeader {
+ char DataOrgID[6];
+ __u16 NumEraseUnits;
+ __u16 FirstPhysicalEUN;
+ __u32 FormattedSize;
+ unsigned char UnitSizeFactor;
+} __attribute__((packed));
+
+#define MAX_ERASE_ZONES (8192 - 512)
+
+#define ERASE_MARK 0x3c69
+#define BLOCK_FREE 0xffff
+#define BLOCK_USED 0x5555
+#define BLOCK_IGNORE 0x1111
+#define BLOCK_DELETED 0x0000
+
+#define ZONE_GOOD 0xff
+#define ZONE_BAD_ORIGINAL 0
+#define ZONE_BAD_MARKED 7
+
+#ifdef __KERNEL__
+
+
+struct NFTLrecord {
+ struct mtd_info *mtd;
+ struct semaphore mutex;
+ __u16 MediaUnit, SpareMediaUnit;
+ __u32 EraseSize;
+ struct NFTLMediaHeader MediaHdr;
+ int usecount;
+ unsigned char heads;
+ unsigned char sectors;
+ unsigned short cylinders;
+ __u16 numvunits;
+ __u16 lastEUN;
+ __u16 numfreeEUNs;
+ __u16 LastFreeEUN; /* To speed up finding a free EUN */
+ __u32 long nr_sects;
+ int head,sect,cyl;
+ __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */
+ __u16 *VirtualUnitTable; /* [numEUNs]: VirtualUnitNumber for each */
+ __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */
+};
+
+#define NFTL_MAJOR 93
+#define MAX_NFTLS 16
+
+#endif /* __KERNEL__ */
+
+#endif /* __MTD_NFTL_H__ */
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h
new file mode 100644
index 000000000..05c506516
--- /dev/null
+++ b/include/linux/mtd/pmc551.h
@@ -0,0 +1,121 @@
+/*
+ * $Id: pmc551.h,v 1.2 2000/03/31 14:40:42 dwmw2 Exp $
+ *
+ * PMC551 PCI Mezzanine Ram Device
+ *
+ * Author:
+ * Mark Ferrell
+ * Copyright 1999,2000 Nortel Networks
+ *
+ * License:
+ * As part of this driver was derrived from the slram.c driver it falls
+ * under the same license, which is GNU General Public License v2
+ */
+
+#ifndef __MTD_PMC551_H__
+#define __MTD_PMC551_H__
+
+#include <linux/mtd/mtd.h>
+
+/*
+ * Our personal and private information
+ */
+struct mypriv {
+ struct pci_dev *dev;
+ u_char *start;
+ u32 mem_map0_base_val;
+ u32 curr_mem_map0_val;
+ u32 aperture_size;
+ struct mtd_info *nextpmc551;
+};
+
+/*
+ * Function Prototypes
+ */
+static int pmc551_erase(struct mtd_info *, struct erase_info *);
+static void pmc551_unpoint(struct mtd_info *, u_char *);
+static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);
+static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char
+*);
+
+/*
+ * Define the PCI ID's if the kernel doesn't define them for us
+ */
+#ifndef PCI_VENDOR_ID_V3_SEMI
+#define PCI_VENDOR_ID_V3_SEMI 0x11b0
+#endif
+
+#ifndef PCI_DEVICE_ID_V3_SEMI_V370PDC
+#define PCI_DEVICE_ID_V3_SEMI_V370PDC 0x0200
+#endif
+
+
+#define PMC551_PCI_MEM_MAP0 0x50
+#define PMC551_PCI_MEM_MAP1 0x54
+#define PMC551_PCI_MEM_MAP_MAP_ADDR_MASK 0x3ff00000
+#define PMC551_PCI_MEM_MAP_APERTURE_MASK 0x000000f0
+#define PMC551_PCI_MEM_MAP_1MB_APERTURE 0x00000000
+#define PMC551_PCI_MEM_MAP_2MB_APERTURE 0x00000010
+#define PMC551_PCI_MEM_MAP_REG_EN 0x00000002
+#define PMC551_PCI_MEM_MAP_ENABLE 0x00000001
+
+#define PMC551_SDRAM_MA 0x60
+#define PMC551_SDRAM_CMD 0x62
+#define PMC551_DRAM_CFG 0x64
+
+#define PMC551_DRAM_BLK0 0x68
+#define PMC551_DRAM_BLK1 0x6c
+#define PMC551_DRAM_BLK2 0x70
+#define PMC551_DRAM_BLK3 0x74
+#define PMC551_DRAM_BLK_GET_SIZE(x) ((512 * 1024) << ((x >> 4) & 0xf))
+#define PMC551_DRAM_BLK_SET_COL_MUX(x,v) (((x) & ~0x00007000) | (((v) & 0x7) << 12))
+#define PMC551_DRAM_BLK_SET_ROW_MUX(x,v) (((x) & ~0x00000f00) | (((v) & 0xf) << 8))
+
+
+/* Use a 1MB apeture into the card. */
+#define PMC551_APERTURE_SIZE 0x00100000
+#define PMC551_ADDR_HIGH_MASK 0x3ff00000
+#define PMC551_ADDR_LOW_MASK 0x000fffff
+#define PMC551_APERTURE_VAL PMC551_PCI_MEM_MAP_1MB_APERTURE
+/*
+ * Define the PCI ID's if the kernel doesn't define them for us
+ */
+#ifndef PCI_VENDOR_ID_V3_SEMI
+#define PCI_VENDOR_ID_V3_SEMI 0x11b0
+#endif
+
+#ifndef PCI_DEVICE_ID_V3_SEMI_V370PDC
+#define PCI_DEVICE_ID_V3_SEMI_V370PDC 0x0200
+#endif
+
+
+#define PMC551_PCI_MEM_MAP0 0x50
+#define PMC551_PCI_MEM_MAP1 0x54
+#define PMC551_PCI_MEM_MAP_MAP_ADDR_MASK 0x3ff00000
+#define PMC551_PCI_MEM_MAP_APERTURE_MASK 0x000000f0
+#define PMC551_PCI_MEM_MAP_1MB_APERTURE 0x00000000
+#define PMC551_PCI_MEM_MAP_2MB_APERTURE 0x00000010
+#define PMC551_PCI_MEM_MAP_REG_EN 0x00000002
+#define PMC551_PCI_MEM_MAP_ENABLE 0x00000001
+
+#define PMC551_SDRAM_MA 0x60
+#define PMC551_SDRAM_CMD 0x62
+#define PMC551_DRAM_CFG 0x64
+
+#define PMC551_DRAM_BLK0 0x68
+#define PMC551_DRAM_BLK1 0x6c
+#define PMC551_DRAM_BLK2 0x70
+#define PMC551_DRAM_BLK3 0x74
+#define PMC551_DRAM_BLK_GET_SIZE(x) ((512 * 1024) << ((x >> 4) & 0xf))
+#define PMC551_DRAM_BLK_SET_COL_MUX(x,v) (((x) & ~0x00007000) | (((v) & 0x7) << 12))
+#define PMC551_DRAM_BLK_SET_ROW_MUX(x,v) (((x) & ~0x00000f00) | (((v) & 0xf) << 8))
+
+
+/* Use a 1MB apeture into the card. */
+#define PMC551_APERTURE_SIZE 0x00100000
+#define PMC551_ADDR_HIGH_MASK 0x3ff00000
+#define PMC551_ADDR_LOW_MASK 0x000fffff
+#define PMC551_APERTURE_VAL PMC551_PCI_MEM_MAP_1MB_APERTURE
+
+#endif /* __MTD_PMC551_H__ */
+
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index fbb1537b3..fe250aba1 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -13,7 +13,6 @@
#ifdef __KERNEL__
-#define NCP_DEFAULT_BUFSIZE 1024
#define NCP_DEFAULT_OPTIONS 0 /* 2 for packet signatures */
struct ncp_server {
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ee129f8c5..f0f191483 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -365,7 +365,7 @@ struct net_device
#define HAVE_CHANGE_MTU
int (*change_mtu)(struct net_device *dev, int new_mtu);
-#define HAVE_TX_TIMOUT
+#define HAVE_TX_TIMEOUT
void (*tx_timeout) (struct net_device *dev);
int (*hard_header_parse)(struct sk_buff *skb,
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 3506c1ce1..8dea93d1a 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -96,10 +96,8 @@ extern __inline__ int DQUOT_TRANSFER(struct dentry *dentry, struct iattr *iattr)
int error = -EDQUOT;
if (dentry->d_inode->i_sb->dq_op) {
- lock_kernel();
dentry->d_inode->i_sb->dq_op->initialize(dentry->d_inode, -1);
error = dentry->d_inode->i_sb->dq_op->transfer(dentry, iattr);
- unlock_kernel();
} else {
error = notify_change(dentry, iattr);
}
diff --git a/include/linux/sched.h b/include/linux/sched.h
index e32e56cf1..d80ec061a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -852,6 +852,25 @@ static inline void task_unlock(struct task_struct *p)
spin_unlock(&p->alloc_lock);
}
+/* write full pathname into buffer and return start of pathname */
+static inline char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
+ char *buf, int buflen)
+{
+ char *res;
+ struct vfsmount *rootmnt;
+ struct dentry *root;
+ read_lock(&current->fs->lock);
+ rootmnt = mntget(current->fs->rootmnt);
+ root = dget(current->fs->root);
+ read_unlock(&current->fs->lock);
+ spin_lock(&dcache_lock);
+ res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen);
+ spin_unlock(&dcache_lock);
+ dput(root);
+ mntput(rootmnt);
+ return res;
+}
+
#endif /* __KERNEL__ */
#endif
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 9d6b8c3a2..e921de639 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -5,36 +5,6 @@
#include <linux/list.h>
/*
- * Old-style timers. Please don't use for any new code.
- *
- * Numbering of these timers should be consecutive to minimize
- * processing delays. [MJ]
- */
-
-#define BLANK_TIMER 0 /* Console screen-saver */
-#define BEEP_TIMER 1 /* Console beep */
-#define RS_TIMER 2 /* RS-232 ports */
-#define SWAP_TIMER 3 /* Background pageout */
-#define BACKGR_TIMER 4 /* io_request background I/O */
-#define HD_TIMER 5 /* Old IDE driver */
-#define FLOPPY_TIMER 6 /* Floppy */
-#define QIC02_TAPE_TIMER 7 /* QIC 02 tape */
-#define MCD_TIMER 8 /* Mitsumi CDROM */
-#define GSCD_TIMER 9 /* Goldstar CDROM */
-#define COMTROL_TIMER 10 /* Comtrol serial */
-#define DIGI_TIMER 11 /* Digi serial */
-
-#define COPRO_TIMER 31 /* 387 timeout for buggy hardware (boot only) */
-
-struct timer_struct {
- unsigned long expires;
- void (*fn)(void);
-};
-
-extern unsigned long timer_active;
-extern struct timer_struct timer_table[32];
-
-/*
* This is completely separate from the above, and is the
* "new and improved" way of handling timers more dynamically.
* Hopefully efficient and general enough for most things.
@@ -52,10 +22,9 @@ struct timer_list {
unsigned long expires;
unsigned long data;
void (*function)(unsigned long);
- unsigned long sequence;
};
-extern volatile unsigned long timer_sequence;
+extern volatile struct timer_list *running_timer;
extern void add_timer(struct timer_list * timer);
extern int del_timer(struct timer_list * timer);
@@ -71,9 +40,6 @@ extern void it_real_fn(unsigned long);
static inline void init_timer(struct timer_list * timer)
{
timer->list.next = timer->list.prev = NULL;
-#ifdef CONFIG_SMP
- timer->sequence = timer_sequence-1;
-#endif
}
static inline int timer_pending (const struct timer_list * timer)
@@ -82,9 +48,9 @@ static inline int timer_pending (const struct timer_list * timer)
}
#ifdef CONFIG_SMP
-#define timer_enter(t) do { (t)->sequence = timer_sequence; mb(); } while (0)
-#define timer_exit() do { timer_sequence++; } while (0)
-#define timer_is_running(t) ((t)->sequence == timer_sequence)
+#define timer_enter(t) do { running_timer = t; mb(); } while (0)
+#define timer_exit() do { running_timer = NULL; } while (0)
+#define timer_is_running(t) (running_timer == t)
#define timer_synchronize(t) while (timer_is_running(t)) barrier()
extern int del_timer_sync(struct timer_list * timer);
#else
diff --git a/include/linux/tpqic02.h b/include/linux/tpqic02.h
index fe13ad6e0..5ca01c314 100644
--- a/include/linux/tpqic02.h
+++ b/include/linux/tpqic02.h
@@ -663,10 +663,9 @@ struct tpstatus { /* sizeof(short)==2), LSB first */
#define TIM_R (8*60*HZ) /* 8 minutes (retensioning) */
#define TIM_F (2*3600*HZ) /* est. 1.2hr for full tape read/write+2 retens */
-#define TIMERON(t) timer_table[QIC02_TAPE_TIMER].expires = jiffies + (t); \
- timer_active |= (1<<QIC02_TAPE_TIMER)
-#define TIMEROFF timer_active &= ~(1<<QIC02_TAPE_TIMER)
-#define TIMERCONT timer_active |= (1<<QIC02_TAPE_TIMER)
+#define TIMERON(t) mod_timer(&tp_timer, jiffies + (t))
+#define TIMEROFF del_timer_sync(&tp_timer);
+#define TIMERCONT add_timer(&tp_timer);
typedef char flag;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 5d3d791d3..bb5bebde0 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -347,7 +347,6 @@ extern int kmsg_redirect;
extern void con_init(void);
extern void console_init(void);
-extern int rs_init(void);
extern int lp_init(void);
extern int pty_init(void);
extern void tty_init(void);
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 0bf8d3087..4ad7577df 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -140,6 +140,7 @@ struct usbdevfs_hub_portinfo {
#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
#define USBDEVFS_RESET _IO('U', 20)
+#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
/* --------------------------------------------------------------------- */