summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-18 00:24:27 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-18 00:24:27 +0000
commitb9558d5f86c471a125abf1fb3a3882fb053b1f8c (patch)
tree707b53ec64e740a7da87d5f36485e3cd9b1c794e /include
parentb3ac367c7a3e6047abe74817db27e34e759f279f (diff)
Merge with Linux 2.3.41.
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/ioctls.h3
-rw-r--r--include/asm-alpha/parport.h8
-rw-r--r--include/asm-alpha/siginfo.h2
-rw-r--r--include/asm-arm/parport.h8
-rw-r--r--include/asm-arm/siginfo.h18
-rw-r--r--include/asm-arm/termios.h1
-rw-r--r--include/asm-i386/parport.h8
-rw-r--r--include/asm-i386/pci.h131
-rw-r--r--include/asm-i386/semaphore.h11
-rw-r--r--include/asm-i386/siginfo.h18
-rw-r--r--include/asm-i386/termios.h1
-rw-r--r--include/asm-i386/types.h4
-rw-r--r--include/asm-i386/unistd.h1
-rw-r--r--include/asm-m68k/amigahw.h2
-rw-r--r--include/asm-m68k/apollodma.h248
-rw-r--r--include/asm-m68k/apollohw.h54
-rw-r--r--include/asm-m68k/bootinfo.h32
-rw-r--r--include/asm-m68k/bvme6000hw.h1
-rw-r--r--include/asm-m68k/cache.h12
-rw-r--r--include/asm-m68k/div64.h35
-rw-r--r--include/asm-m68k/dma.h13
-rw-r--r--include/asm-m68k/entry.h10
-rw-r--r--include/asm-m68k/fcntl.h2
-rw-r--r--include/asm-m68k/hardirq.h4
-rw-r--r--include/asm-m68k/mmu_context.h1
-rw-r--r--include/asm-m68k/movs.h28
-rw-r--r--include/asm-m68k/mvme147hw.h3
-rw-r--r--include/asm-m68k/mvme16xhw.h1
-rw-r--r--include/asm-m68k/page.h78
-rw-r--r--include/asm-m68k/page_offset.h9
-rw-r--r--include/asm-m68k/pci.h38
-rw-r--r--include/asm-m68k/pgalloc.h399
-rw-r--r--include/asm-m68k/pgtable.h524
-rw-r--r--include/asm-m68k/poll.h1
-rw-r--r--include/asm-m68k/semaphore.h175
-rw-r--r--include/asm-m68k/setup.h3
-rw-r--r--include/asm-m68k/siginfo.h16
-rw-r--r--include/asm-m68k/stat.h38
-rw-r--r--include/asm-m68k/system.h65
-rw-r--r--include/asm-m68k/termios.h3
-rw-r--r--include/asm-m68k/uaccess.h59
-rw-r--r--include/asm-m68k/virtconvert.h17
-rw-r--r--include/asm-mips/checksum.h4
-rw-r--r--include/asm-mips/parport.h10
-rw-r--r--include/asm-mips/pci.h160
-rw-r--r--include/asm-mips/semaphore.h176
-rw-r--r--include/asm-mips/siginfo.h4
-rw-r--r--include/asm-mips/termios.h3
-rw-r--r--include/asm-mips/types.h4
-rw-r--r--include/asm-mips/unistd.h5
-rw-r--r--include/asm-mips64/checksum.h4
-rw-r--r--include/asm-mips64/parport.h10
-rw-r--r--include/asm-mips64/pci.h160
-rw-r--r--include/asm-mips64/semaphore.h179
-rw-r--r--include/asm-mips64/siginfo.h4
-rw-r--r--include/asm-mips64/termios.h3
-rw-r--r--include/asm-mips64/types.h4
-rw-r--r--include/asm-mips64/unistd.h20
-rw-r--r--include/asm-ppc/siginfo.h2
-rw-r--r--include/asm-ppc/termios.h3
-rw-r--r--include/asm-sparc/asm_offsets.h136
-rw-r--r--include/asm-sparc/hdreg.h13
-rw-r--r--include/asm-sparc/ide.h289
-rw-r--r--include/asm-sparc/io.h11
-rw-r--r--include/asm-sparc/irq.h3
-rw-r--r--include/asm-sparc/pci.h3
-rw-r--r--include/asm-sparc/processor.h10
-rw-r--r--include/asm-sparc/sbus.h6
-rw-r--r--include/asm-sparc/semaphore.h11
-rw-r--r--include/asm-sparc/sembuf.h2
-rw-r--r--include/asm-sparc/siginfo.h11
-rw-r--r--include/asm-sparc/smp.h6
-rw-r--r--include/asm-sparc/stat.h36
-rw-r--r--include/asm-sparc/termbits.h3
-rw-r--r--include/asm-sparc/unistd.h2
-rw-r--r--include/asm-sparc64/asm_offsets.h162
-rw-r--r--include/asm-sparc64/checksum.h24
-rw-r--r--include/asm-sparc64/dma.h6
-rw-r--r--include/asm-sparc64/floppy.h17
-rw-r--r--include/asm-sparc64/io.h2
-rw-r--r--include/asm-sparc64/parport.h2
-rw-r--r--include/asm-sparc64/pci.h57
-rw-r--r--include/asm-sparc64/processor.h15
-rw-r--r--include/asm-sparc64/sbus.h12
-rw-r--r--include/asm-sparc64/semaphore.h11
-rw-r--r--include/asm-sparc64/siginfo.h9
-rw-r--r--include/asm-sparc64/smp.h6
-rw-r--r--include/asm-sparc64/termbits.h3
-rw-r--r--include/asm-sparc64/types.h4
-rw-r--r--include/asm-sparc64/unistd.h2
-rw-r--r--include/linux/acpi.h130
-rw-r--r--include/linux/auto_fs.h21
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/cdrom.h4
-rw-r--r--include/linux/cyclomx.h6
-rw-r--r--include/linux/etherdevice.h3
-rw-r--r--include/linux/fs.h15
-rw-r--r--include/linux/hdreg.h1
-rw-r--r--include/linux/hfs_sysdep.h2
-rw-r--r--include/linux/highuid.h9
-rw-r--r--include/linux/ide.h6
-rw-r--r--include/linux/init.h2
-rw-r--r--include/linux/input.h15
-rw-r--r--include/linux/isapnp.h2
-rw-r--r--include/linux/kdev_t.h2
-rw-r--r--include/linux/mm.h20
-rw-r--r--include/linux/parport_pc.h5
-rw-r--r--include/linux/pci.h23
-rw-r--r--include/linux/pci_ids.h13
-rw-r--r--include/linux/pm.h157
-rw-r--r--include/linux/random.h2
-rw-r--r--include/linux/sdla_chdlc.h808
-rw-r--r--include/linux/sdla_fr.h260
-rw-r--r--include/linux/sdla_ppp.h231
-rw-r--r--include/linux/sdladrv.h20
-rw-r--r--include/linux/sdlapci.h68
-rw-r--r--include/linux/sdlasfm.h16
-rw-r--r--include/linux/serial.h14
-rw-r--r--include/linux/serialP.h38
-rw-r--r--include/linux/skbuff.h13
-rw-r--r--include/linux/slab.h3
-rw-r--r--include/linux/smp.h1
-rw-r--r--include/linux/sockios.h4
-rw-r--r--include/linux/sysctl.h7
-rw-r--r--include/linux/tcp.h1
-rw-r--r--include/linux/udf_fs.h37
-rw-r--r--include/linux/udf_fs_i.h3
-rw-r--r--include/linux/udf_fs_sb.h28
-rw-r--r--include/linux/udf_udf.h3
-rw-r--r--include/linux/utsname.h2
-rw-r--r--include/linux/videodev.h1
-rw-r--r--include/linux/wanpipe.h196
-rw-r--r--include/linux/wanrouter.h174
-rw-r--r--include/linux/zorro.h34
-rw-r--r--include/net/dst.h6
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/route.h3
-rw-r--r--include/net/snmp.h19
-rw-r--r--include/net/sock.h167
-rw-r--r--include/net/tcp.h727
140 files changed, 5368 insertions, 1673 deletions
diff --git a/include/asm-alpha/ioctls.h b/include/asm-alpha/ioctls.h
index 2a065c5b6..4c96cdd35 100644
--- a/include/asm-alpha/ioctls.h
+++ b/include/asm-alpha/ioctls.h
@@ -61,6 +61,9 @@
# define TIOCM_DSR 0x100
# define TIOCM_CD TIOCM_CAR
# define TIOCM_RI TIOCM_RNG
+# define TIOCM_OUT1 0x2000
+# define TIOCM_OUT2 0x4000
+# define TIOCM_LOOP 0x8000
#define TIOCGSOFTCAR 0x5419
#define TIOCSSOFTCAR 0x541A
diff --git a/include/asm-alpha/parport.h b/include/asm-alpha/parport.h
index e9b590ee1..bc6b79597 100644
--- a/include/asm-alpha/parport.h
+++ b/include/asm-alpha/parport.h
@@ -39,16 +39,16 @@ parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
do {
if (!*io_hi) *io_hi = 0x400 + *io;
if (parport_pc_probe_port(*(io++), *(io_hi++),
- *(irq++), *(dma++)))
+ *(irq++), *(dma++), NULL))
count++;
} while (*io && (++i < PARPORT_PC_MAX_PORTS));
} else {
/* Probe all the likely ports. */
- if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0], NULL))
count++;
- if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0], NULL))
count++;
- if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0], NULL))
count++;
count += parport_pc_init_pci (irq[0], dma[0]);
}
diff --git a/include/asm-alpha/siginfo.h b/include/asm-alpha/siginfo.h
index a8bedd8e0..ec9e9595c 100644
--- a/include/asm-alpha/siginfo.h
+++ b/include/asm-alpha/siginfo.h
@@ -149,7 +149,7 @@ typedef struct siginfo {
#define CLD_TRAPPED 4 /* traced child has trapped */
#define CLD_STOPPED 5 /* child has stopped */
#define CLD_CONTINUED 6 /* stopped child has continued */
-#define NSIGCHLD
+#define NSIGCHLD 6
/*
* SIGPOLL si_codes
diff --git a/include/asm-arm/parport.h b/include/asm-arm/parport.h
index bcb533af4..b61c0d62c 100644
--- a/include/asm-arm/parport.h
+++ b/include/asm-arm/parport.h
@@ -39,16 +39,16 @@ parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
do {
if (!*io_hi) *io_hi = 0x400 + *io;
if (parport_pc_probe_port(*(io++), *(io_hi++),
- *(irq++), *(dma++)))
+ *(irq++), *(dma++), NULL))
count++;
} while (*io && (++i < PARPORT_PC_MAX_PORTS));
} else {
/* Probe all the likely ports. */
- if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0], NULL))
count++;
- if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0], NULL))
count++;
- if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0], NULL))
count++;
count += parport_pc_init_pci (irq[0], dma[0]);
}
diff --git a/include/asm-arm/siginfo.h b/include/asm-arm/siginfo.h
index 4ffd51452..945d4d429 100644
--- a/include/asm-arm/siginfo.h
+++ b/include/asm-arm/siginfo.h
@@ -24,8 +24,7 @@ typedef struct siginfo {
/* kill() */
struct {
pid_t _pid; /* sender's pid */
- old_uid_t _uid; /* backwards compatibility */
- uid_t _uid32; /* sender's uid */
+ uid_t _uid; /* sender's uid */
} _kill;
/* POSIX.1b timers */
@@ -37,19 +36,17 @@ typedef struct siginfo {
/* POSIX.1b signals */
struct {
pid_t _pid; /* sender's pid */
- old_uid_t _uid; /* backwards compatibility */
+ uid_t _uid; /* sender's uid */
sigval_t _sigval;
- uid_t _uid32; /* sender's uid */
} _rt;
/* SIGCHLD */
struct {
pid_t _pid; /* which child */
- old_uid_t _uid; /* backwards compatibility */
+ uid_t _uid; /* sender's uid */
int _status; /* exit code */
clock_t _utime;
clock_t _stime;
- uid_t _uid32; /* sender's uid */
} _sigchld;
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
@@ -65,18 +62,11 @@ typedef struct siginfo {
} _sifields;
} siginfo_t;
-#define UID16_SIGINFO_COMPAT_NEEDED
-
/*
* How these fields are to be accessed.
*/
#define si_pid _sifields._kill._pid
-#ifdef __KERNEL__
-#define si_uid _sifields._kill._uid32
-#define si_uid16 _sifields._kill._uid
-#else
#define si_uid _sifields._kill._uid
-#endif /* __KERNEL__ */
#define si_status _sifields._sigchld._status
#define si_utime _sifields._sigchld._utime
#define si_stime _sifields._sigchld._stime
@@ -159,7 +149,7 @@ typedef struct siginfo {
#define CLD_TRAPPED 4 /* traced child has trapped */
#define CLD_STOPPED 5 /* child has stopped */
#define CLD_CONTINUED 6 /* stopped child has continued */
-#define NSIGCHLD
+#define NSIGCHLD 6
/*
* SIGPOLL si_codes
diff --git a/include/asm-arm/termios.h b/include/asm-arm/termios.h
index 1ccc31eb7..c45cea198 100644
--- a/include/asm-arm/termios.h
+++ b/include/asm-arm/termios.h
@@ -45,6 +45,7 @@ struct termio {
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
diff --git a/include/asm-i386/parport.h b/include/asm-i386/parport.h
index c08ee4686..1c2855bbe 100644
--- a/include/asm-i386/parport.h
+++ b/include/asm-i386/parport.h
@@ -39,16 +39,16 @@ parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
do {
if (!*io_hi) *io_hi = 0x400 + *io;
if (parport_pc_probe_port(*(io++), *(io_hi++),
- *(irq++), *(dma++)))
+ *(irq++), *(dma++), NULL))
count++;
} while (*io && (++i < PARPORT_PC_MAX_PORTS));
} else {
/* Probe all the likely ports. */
- if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0], NULL))
count++;
- if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0], NULL))
count++;
- if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0], NULL))
count++;
count += parport_pc_init_pci (irq[0], dma[0]);
}
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index ef5198dfc..8cc99dda0 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -10,5 +10,136 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
+#ifdef __KERNEL__
+
+/* Dynamic DMA mapping stuff.
+ * i386 has everything mapped statically.
+ */
+
+#include <linux/types.h>
+#include <linux/slab.h>
+#include <asm/scatterlist.h>
+#include <linux/string.h>
+#include <asm/io.h>
+
+struct pci_dev;
+
+/* Allocate and map kernel buffer using consistent mode DMA for a device.
+ * hwdev should be valid struct pci_dev pointer for PCI devices,
+ * NULL for PCI-like buses (ISA, EISA).
+ * Returns non-NULL cpu-view pointer to the buffer if successful and
+ * sets *dma_addrp to the pci side dma address as well, else *dma_addrp
+ * is undefined.
+ */
+extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
+ dma_addr_t *dma_handle);
+
+/* Free and unmap a consistent DMA buffer.
+ * cpu_addr is what was returned from pci_alloc_consistent,
+ * size must be the same as what as passed into pci_alloc_consistent,
+ * and likewise dma_addr must be the same as what *dma_addrp was set to.
+ *
+ * References to the memory and mappings associated with cpu_addr/dma_addr
+ * past this call are illegal.
+ */
+extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
+ void *vaddr, dma_addr_t dma_handle);
+
+/* Map a single buffer of the indicated size for DMA in streaming mode.
+ * The 32-bit bus address to use is returned.
+ *
+ * Once the device is given the dma address, the device owns this memory
+ * until either pci_unmap_single or pci_dma_sync_single is performed.
+ */
+extern inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
+ size_t size)
+{
+ return virt_to_bus(ptr);
+}
+
+/* Unmap a single streaming mode DMA translation. The dma_addr and size
+ * must match what was provided for in a previous pci_map_single call. All
+ * other usages are undefined.
+ *
+ * After this call, reads by the cpu to the buffer are guarenteed to see
+ * whatever the device wrote there.
+ */
+extern inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
+ size_t size)
+{
+ /* Nothing to do */
+}
+
+/* Map a set of buffers described by scatterlist in streaming
+ * mode for DMA. This is the scather-gather version of the
+ * above pci_map_single interface. Here the scatter gather list
+ * elements are each tagged with the appropriate dma address
+ * and length. They are obtained via sg_dma_{address,length}(SG).
+ *
+ * NOTE: An implementation may be able to use a smaller number of
+ * DMA address/length pairs than there are SG table elements.
+ * (for example via virtual mapping capabilities)
+ * The routine returns the number of addr/length pairs actually
+ * used, at most nents.
+ *
+ * Device ownership issues as mentioned above for pci_map_single are
+ * the same here.
+ */
+extern inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
+ int nents)
+{
+ return nents;
+}
+
+/* Unmap a set of streaming mode DMA translations.
+ * Again, cpu read rules concerning calls here are the same as for
+ * pci_unmap_single() above.
+ */
+extern inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
+ int nents)
+{
+ /* Nothing to do */
+}
+
+/* Make physical memory consistent for a single
+ * streaming mode DMA translation after a transfer.
+ *
+ * If you perform a pci_map_single() but wish to interrogate the
+ * buffer using the cpu, yet do not wish to teardown the PCI dma
+ * mapping, you must call this function before doing so. At the
+ * next point you give the PCI dma address back to the card, the
+ * device again owns the buffer.
+ */
+extern inline void pci_dma_sync_single(struct pci_dev *hwdev,
+ dma_addr_t dma_handle,
+ size_t size)
+{
+ /* Nothing to do */
+}
+
+/* Make physical memory consistent for a set of streaming
+ * mode DMA translations after a transfer.
+ *
+ * The same as pci_dma_sync_single but for a scatter-gather list,
+ * same rules and usage.
+ */
+extern inline void pci_dma_sync_sg(struct pci_dev *hwdev,
+ struct scatterlist *sg,
+ int nelems)
+{
+ /* Nothing to do */
+}
+
+/* These macros should be used after a pci_map_sg call has been done
+ * to get bus addresses of each of the SG entries and their lengths.
+ * You should only work with the number of sg entries pci_map_sg
+ * returns, or alternatively stop on the first sg_dma_len(sg) which
+ * is 0.
+ */
+#define sg_dma_address(sg) (virt_to_bus((sg)->address))
+#define sg_dma_len(sg) ((sg)->length)
+
+#endif /* __KERNEL__ */
+
#endif /* __i386_PCI_H */
diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h
index ef4c558da..827c53192 100644
--- a/include/asm-i386/semaphore.h
+++ b/include/asm-i386/semaphore.h
@@ -238,11 +238,18 @@ struct rw_semaphore {
#define __RWSEM_DEBUG_INIT /* */
#endif
-#define __RWSEM_INITIALIZER(name) \
-{ ATOMIC_INIT(RW_LOCK_BIAS), 0, 0, 0, 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), \
+#define __RWSEM_INITIALIZER(name,count) \
+{ ATOMIC_INIT(count), 0, 0, 0, 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), \
__WAIT_QUEUE_HEAD_INITIALIZER((name).write_bias_wait) \
__SEM_DEBUG_INIT(name) __RWSEM_DEBUG_INIT }
+#define __DECLARE_RWSEM_GENERIC(name,count) \
+ struct rw_semaphore name = __RWSEM_INITIALIZER(name,count)
+
+#define DECLARE_RWSEM(name) __DECLARE_RWSEM_GENERIC(name,RW_LOCK_BIAS)
+#define DECLARE_RWSEM_READ_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,RW_LOCK_BIAS-1)
+#define DECLARE_RWSEM_WRITE_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,0)
+
extern inline void init_rwsem(struct rw_semaphore *sem)
{
atomic_set(&sem->count, RW_LOCK_BIAS);
diff --git a/include/asm-i386/siginfo.h b/include/asm-i386/siginfo.h
index 467aa9d39..c762775c1 100644
--- a/include/asm-i386/siginfo.h
+++ b/include/asm-i386/siginfo.h
@@ -24,8 +24,7 @@ typedef struct siginfo {
/* kill() */
struct {
pid_t _pid; /* sender's pid */
- old_uid_t _uid; /* backwards compatibility */
- uid_t _uid32; /* sender's uid */
+ uid_t _uid; /* sender's uid */
} _kill;
/* POSIX.1b timers */
@@ -37,19 +36,17 @@ typedef struct siginfo {
/* POSIX.1b signals */
struct {
pid_t _pid; /* sender's pid */
- old_uid_t _uid; /* backwards compatibility */
+ uid_t _uid; /* sender's uid */
sigval_t _sigval;
- uid_t _uid32; /* sender's uid */
} _rt;
/* SIGCHLD */
struct {
pid_t _pid; /* which child */
- old_uid_t _uid; /* backwards compatibility */
+ uid_t _uid; /* sender's uid */
int _status; /* exit code */
clock_t _utime;
clock_t _stime;
- uid_t _uid32; /* sender's uid */
} _sigchld;
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
@@ -65,18 +62,11 @@ typedef struct siginfo {
} _sifields;
} siginfo_t;
-#define UID16_SIGINFO_COMPAT_NEEDED
-
/*
* How these fields are to be accessed.
*/
#define si_pid _sifields._kill._pid
-#ifdef __KERNEL__
-#define si_uid _sifields._kill._uid32
-#define si_uid16 _sifields._kill._uid
-#else
#define si_uid _sifields._kill._uid
-#endif /* __KERNEL__ */
#define si_status _sifields._sigchld._status
#define si_utime _sifields._sigchld._utime
#define si_stime _sifields._sigchld._stime
@@ -159,7 +149,7 @@ typedef struct siginfo {
#define CLD_TRAPPED 4 /* traced child has trapped */
#define CLD_STOPPED 5 /* child has stopped */
#define CLD_CONTINUED 6 /* stopped child has continued */
-#define NSIGCHLD
+#define NSIGCHLD 6
/*
* SIGPOLL si_codes
diff --git a/include/asm-i386/termios.h b/include/asm-i386/termios.h
index 9e55723d3..9b337736f 100644
--- a/include/asm-i386/termios.h
+++ b/include/asm-i386/termios.h
@@ -35,6 +35,7 @@ struct termio {
#define TIOCM_RI TIOCM_RNG
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
diff --git a/include/asm-i386/types.h b/include/asm-i386/types.h
index d792546f9..6c8bc62c2 100644
--- a/include/asm-i386/types.h
+++ b/include/asm-i386/types.h
@@ -41,6 +41,10 @@ typedef unsigned long long u64;
#define BITS_PER_LONG 32
+/* Dma addresses are 32-bits wide. */
+
+typedef u32 dma_addr_t;
+
#endif /* __KERNEL__ */
#endif
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index 22286e151..6ec03679f 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -221,6 +221,7 @@
#define __NR_setgid32 214
#define __NR_setfsuid32 215
#define __NR_setfsgid32 216
+#define __NR_pivot_root 217
/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
diff --git a/include/asm-m68k/amigahw.h b/include/asm-m68k/amigahw.h
index 39dd49979..d63ceca32 100644
--- a/include/asm-m68k/amigahw.h
+++ b/include/asm-m68k/amigahw.h
@@ -281,7 +281,7 @@ struct CIA {
#define CHIP_PHYSADDR (0x000000)
#define chipaddr ((unsigned long)(zTwoBase + CHIP_PHYSADDR))
void amiga_chip_init (void);
-void *amiga_chip_alloc (long size);
+void *amiga_chip_alloc (long size, const char *name);
void amiga_chip_free (void *);
unsigned long amiga_chip_avail( void ); /*MILAN*/
diff --git a/include/asm-m68k/apollodma.h b/include/asm-m68k/apollodma.h
new file mode 100644
index 000000000..3abef61cb
--- /dev/null
+++ b/include/asm-m68k/apollodma.h
@@ -0,0 +1,248 @@
+/* $Id: dma.h,v 1.7 1992/12/14 00:29:34 root Exp root $
+ * linux/include/asm/dma.h: Defines for using and allocating dma channels.
+ * Written by Hennus Bergman, 1992.
+ * High DMA channel support & info by Hannu Savolainen
+ * and John Boyd, Nov. 1992.
+ */
+
+#ifndef _ASM_APOLLO_DMA_H
+#define _ASM_APOLLO_DMA_H
+
+#include <asm/apollohw.h> /* need byte IO */
+#include <asm/spinlock.h> /* And spinlocks */
+#include <linux/delay.h>
+
+
+#define dma_outb(val,addr) (*((volatile unsigned char *)(addr+IO_BASE)) = (val))
+#define dma_inb(addr) (*((volatile unsigned char *)(addr+IO_BASE)))
+
+/*
+ * NOTES about DMA transfers:
+ *
+ * controller 1: channels 0-3, byte operations, ports 00-1F
+ * controller 2: channels 4-7, word operations, ports C0-DF
+ *
+ * - ALL registers are 8 bits only, regardless of transfer size
+ * - channel 4 is not used - cascades 1 into 2.
+ * - channels 0-3 are byte - addresses/counts are for physical bytes
+ * - channels 5-7 are word - addresses/counts are for physical words
+ * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries
+ * - transfer count loaded to registers is 1 less than actual count
+ * - controller 2 offsets are all even (2x offsets for controller 1)
+ * - page registers for 5-7 don't use data bit 0, represent 128K pages
+ * - page registers for 0-3 use bit 0, represent 64K pages
+ *
+ * DMA transfers are limited to the lower 16MB of _physical_ memory.
+ * Note that addresses loaded into registers must be _physical_ addresses,
+ * not logical addresses (which may differ if paging is active).
+ *
+ * Address mapping for channels 0-3:
+ *
+ * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses)
+ * | ... | | ... | | ... |
+ * | ... | | ... | | ... |
+ * | ... | | ... | | ... |
+ * P7 ... P0 A7 ... A0 A7 ... A0
+ * | Page | Addr MSB | Addr LSB | (DMA registers)
+ *
+ * Address mapping for channels 5-7:
+ *
+ * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses)
+ * | ... | \ \ ... \ \ \ ... \ \
+ * | ... | \ \ ... \ \ \ ... \ (not used)
+ * | ... | \ \ ... \ \ \ ... \
+ * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0
+ * | Page | Addr MSB | Addr LSB | (DMA registers)
+ *
+ * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses
+ * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at
+ * the hardware level, so odd-byte transfers aren't possible).
+ *
+ * Transfer count (_not # bytes_) is limited to 64K, represented as actual
+ * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more,
+ * and up to 128K bytes may be transferred on channels 5-7 in one operation.
+ *
+ */
+
+#define MAX_DMA_CHANNELS 8
+
+/* The maximum address that we can perform a DMA transfer to on this platform */#define MAX_DMA_ADDRESS (PAGE_OFFSET+0x1000000)
+
+/* 8237 DMA controllers */
+#define IO_DMA1_BASE 0x10C00 /* 8 bit slave DMA, channels 0..3 */
+#define IO_DMA2_BASE 0x10D00 /* 16 bit master DMA, ch 4(=slave input)..7 */
+
+/* DMA controller registers */
+#define DMA1_CMD_REG (IO_DMA1_BASE+0x08) /* command register (w) */
+#define DMA1_STAT_REG (IO_DMA1_BASE+0x08) /* status register (r) */
+#define DMA1_REQ_REG (IO_DMA1_BASE+0x09) /* request register (w) */
+#define DMA1_MASK_REG (IO_DMA1_BASE+0x0A) /* single-channel mask (w) */
+#define DMA1_MODE_REG (IO_DMA1_BASE+0x0B) /* mode register (w) */
+#define DMA1_CLEAR_FF_REG (IO_DMA1_BASE+0x0C) /* clear pointer flip-flop (w) */
+#define DMA1_TEMP_REG (IO_DMA1_BASE+0x0D) /* Temporary Register (r) */
+#define DMA1_RESET_REG (IO_DMA1_BASE+0x0D) /* Master Clear (w) */
+#define DMA1_CLR_MASK_REG (IO_DMA1_BASE+0x0E) /* Clear Mask */
+#define DMA1_MASK_ALL_REG (IO_DMA1_BASE+0x0F) /* all-channels mask (w) */
+
+#define DMA2_CMD_REG (IO_DMA2_BASE+0x10) /* command register (w) */
+#define DMA2_STAT_REG (IO_DMA2_BASE+0x10) /* status register (r) */
+#define DMA2_REQ_REG (IO_DMA2_BASE+0x12) /* request register (w) */
+#define DMA2_MASK_REG (IO_DMA2_BASE+0x14) /* single-channel mask (w) */
+#define DMA2_MODE_REG (IO_DMA2_BASE+0x16) /* mode register (w) */
+#define DMA2_CLEAR_FF_REG (IO_DMA2_BASE+0x18) /* clear pointer flip-flop (w) */
+#define DMA2_TEMP_REG (IO_DMA2_BASE+0x1A) /* Temporary Register (r) */
+#define DMA2_RESET_REG (IO_DMA2_BASE+0x1A) /* Master Clear (w) */
+#define DMA2_CLR_MASK_REG (IO_DMA2_BASE+0x1C) /* Clear Mask */
+#define DMA2_MASK_ALL_REG (IO_DMA2_BASE+0x1E) /* all-channels mask (w) */
+
+#define DMA_ADDR_0 (IO_DMA1_BASE+0x00) /* DMA address registers */
+#define DMA_ADDR_1 (IO_DMA1_BASE+0x02)
+#define DMA_ADDR_2 (IO_DMA1_BASE+0x04)
+#define DMA_ADDR_3 (IO_DMA1_BASE+0x06)
+#define DMA_ADDR_4 (IO_DMA2_BASE+0x00)
+#define DMA_ADDR_5 (IO_DMA2_BASE+0x04)
+#define DMA_ADDR_6 (IO_DMA2_BASE+0x08)
+#define DMA_ADDR_7 (IO_DMA2_BASE+0x0C)
+
+#define DMA_CNT_0 (IO_DMA1_BASE+0x01) /* DMA count registers */
+#define DMA_CNT_1 (IO_DMA1_BASE+0x03)
+#define DMA_CNT_2 (IO_DMA1_BASE+0x05)
+#define DMA_CNT_3 (IO_DMA1_BASE+0x07)
+#define DMA_CNT_4 (IO_DMA2_BASE+0x02)
+#define DMA_CNT_5 (IO_DMA2_BASE+0x06)
+#define DMA_CNT_6 (IO_DMA2_BASE+0x0A)
+#define DMA_CNT_7 (IO_DMA2_BASE+0x0E)
+
+#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
+#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
+#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
+
+#define DMA_AUTOINIT 0x10
+
+#define DMA_8BIT 0
+#define DMA_16BIT 1
+#define DMA_BUSMASTER 2
+
+extern spinlock_t dma_spin_lock;
+
+static __inline__ unsigned long claim_dma_lock(void)
+{
+ unsigned long flags;
+ spin_lock_irqsave(&dma_spin_lock, flags);
+ return flags;
+}
+
+static __inline__ void release_dma_lock(unsigned long flags)
+{
+ spin_unlock_irqrestore(&dma_spin_lock, flags);
+}
+
+/* enable/disable a specific DMA channel */
+static __inline__ void enable_dma(unsigned int dmanr)
+{
+ if (dmanr<=3)
+ dma_outb(dmanr, DMA1_MASK_REG);
+ else
+ dma_outb(dmanr & 3, DMA2_MASK_REG);
+}
+
+static __inline__ void disable_dma(unsigned int dmanr)
+{
+ if (dmanr<=3)
+ dma_outb(dmanr | 4, DMA1_MASK_REG);
+ else
+ dma_outb((dmanr & 3) | 4, DMA2_MASK_REG);
+}
+
+/* Clear the 'DMA Pointer Flip Flop'.
+ * Write 0 for LSB/MSB, 1 for MSB/LSB access.
+ * Use this once to initialize the FF to a known state.
+ * After that, keep track of it. :-)
+ * --- In order to do that, the DMA routines below should ---
+ * --- only be used while holding the DMA lock ! ---
+ */
+static __inline__ void clear_dma_ff(unsigned int dmanr)
+{
+ if (dmanr<=3)
+ dma_outb(0, DMA1_CLEAR_FF_REG);
+ else
+ dma_outb(0, DMA2_CLEAR_FF_REG);
+}
+
+/* set mode (above) for a specific DMA channel */
+static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
+{
+ if (dmanr<=3)
+ dma_outb(mode | dmanr, DMA1_MODE_REG);
+ else
+ dma_outb(mode | (dmanr&3), DMA2_MODE_REG);
+}
+
+/* Set transfer address & page bits for specific DMA channel.
+ * Assumes dma flipflop is clear.
+ */
+static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
+{
+ if (dmanr <= 3) {
+ dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
+ dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
+ } else {
+ dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
+ dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
+ }
+}
+
+
+/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for
+ * a specific DMA channel.
+ * You must ensure the parameters are valid.
+ * NOTE: from a manual: "the number of transfers is one more
+ * than the initial word count"! This is taken into account.
+ * Assumes dma flip-flop is clear.
+ * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
+ */
+static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
+{
+ count--;
+ if (dmanr <= 3) {
+ dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
+ dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
+ } else {
+ dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
+ dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
+ }
+}
+
+
+/* Get DMA residue count. After a DMA transfer, this
+ * should return zero. Reading this while a DMA transfer is
+ * still in progress will return unpredictable results.
+ * If called before the channel has been used, it may return 1.
+ * Otherwise, it returns the number of _bytes_ left to transfer.
+ *
+ * Assumes DMA flip-flop is clear.
+ */
+static __inline__ int get_dma_residue(unsigned int dmanr)
+{
+ unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
+ : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;
+
+ /* using short to get 16-bit wrap around */
+ unsigned short count;
+
+ count = 1 + dma_inb(io_port);
+ count += dma_inb(io_port) << 8;
+
+ return (dmanr<=3)? count : (count<<1);
+}
+
+
+/* These are in kernel/dma.c: */
+extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
+extern void free_dma(unsigned int dmanr); /* release it again */
+
+/* These are in arch/m68k/apollo/dma.c: */
+extern unsigned short dma_map_page(unsigned long phys_addr,int count,int type);
+extern void dma_unmap_page(unsigned short dma_addr);
+
+#endif /* _ASM_APOLLO_DMA_H */
diff --git a/include/asm-m68k/apollohw.h b/include/asm-m68k/apollohw.h
index 54177aa3d..e12a638ca 100644
--- a/include/asm-m68k/apollohw.h
+++ b/include/asm-m68k/apollohw.h
@@ -3,6 +3,18 @@
#ifndef _ASMm68k_APOLLOHW_H_
#define _ASMm68k_APOLLOHW_H_
+/*
+ apollo models
+*/
+
+extern u_long apollo_model;
+
+#define APOLLO_UNKNOWN (0)
+#define APOLLO_DN3000 (1)
+#define APOLLO_DN3010 (2)
+#define APOLLO_DN3500 (3)
+#define APOLLO_DN4000 (4)
+#define APOLLO_DN4500 (5)
/*
see scn2681 data sheet for more info.
@@ -52,16 +64,42 @@ struct mc146818 {
unsigned char month, year;
};
+
#define IO_BASE 0x80000000
-#define SIO01_PHYSADDR 0x10400
-#define SIO23_PHYSADDR 0x10500
-#define RTC_PHYSADDR 0x10900
-#define PICA 0x11000
-#define PICB 0x11100
-#define sio01 ((*(volatile struct SCN2681 *)(IO_BASE + SIO01_PHYSADDR)))
-#define sio23 ((*(volatile struct SCN2681 *)(IO_BASE + SIO01_PHYSADDR)))
-#define rtc (((volatile struct mc146818 *)(IO_BASE + RTC_PHYSADDR)))
+extern u_long sio01_physaddr;
+extern u_long sio23_physaddr;
+extern u_long rtc_physaddr;
+extern u_long pica_physaddr;
+extern u_long picb_physaddr;
+extern u_long cpuctrl_physaddr;
+extern u_long timer_physaddr;
+
+#define SAU7_SIO01_PHYSADDR 0x10400
+#define SAU7_SIO23_PHYSADDR 0x10500
+#define SAU7_RTC_PHYSADDR 0x10900
+#define SAU7_PICA 0x11000
+#define SAU7_PICB 0x11100
+#define SAU7_CPUCTRL 0x10100
+#define SAU7_TIMER 0x010800
+
+#define SAU8_SIO01_PHYSADDR 0x8400
+#define SAU8_RTC_PHYSADDR 0x8900
+#define SAU8_PICA 0x9400
+#define SAU8_PICB 0x9500
+#define SAU8_CPUCTRL 0x8100
+#define SAU8_TIMER 0x8800
+
+#define sio01 ((*(volatile struct SCN2681 *)(IO_BASE + sio01_physaddr)))
+#define sio23 ((*(volatile struct SCN2681 *)(IO_BASE + sio23_physaddr)))
+#define rtc (((volatile struct mc146818 *)(IO_BASE + rtc_physaddr)))
+#define cpuctrl (*(volatile unsigned int *)(IO_BASE + cpuctrl_physaddr))
+#define pica (IO_BASE + pica_physaddr)
+#define picb (IO_BASE + picb_physaddr)
+#define timer (IO_BASE + timer_physaddr)
+#define addr_xlat_map ((unsigned short *)(IO_BASE + 0x17000))
+
+#define isaIO2mem(x) (((((x) & 0x3f8) << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE)
#define inb(addr) (*((volatile unsigned char *)(addr)))
#define outb(val,addr) (*((volatile unsigned char *)(addr)) = (val))
diff --git a/include/asm-m68k/bootinfo.h b/include/asm-m68k/bootinfo.h
index 871d051fe..19f340b5c 100644
--- a/include/asm-m68k/bootinfo.h
+++ b/include/asm-m68k/bootinfo.h
@@ -103,6 +103,30 @@ struct bi_record {
#define ATARI_MACH_AB40 3 /* Afterburner040 on Falcon */
/*
+ * VME-specific tags
+ */
+
+#define BI_VME_TYPE 0x8000 /* VME sub-architecture (u_long) */
+#define BI_VME_BRDINFO 0x8001 /* VME board information (struct) */
+
+/* BI_VME_TYPE codes */
+#define VME_TYPE_TP34V 0x0034 /* Tadpole TP34V */
+#define VME_TYPE_MVME147 0x0147 /* Motorola MVME147 */
+#define VME_TYPE_MVME162 0x0162 /* Motorola MVME162 */
+#define VME_TYPE_MVME166 0x0166 /* Motorola MVME166 */
+#define VME_TYPE_MVME167 0x0167 /* Motorola MVME167 */
+#define VME_TYPE_MVME172 0x0172 /* Motorola MVME172 */
+#define VME_TYPE_MVME177 0x0177 /* Motorola MVME177 */
+#define VME_TYPE_BVME4000 0x4000 /* BVM Ltd. BVME4000 */
+#define VME_TYPE_BVME6000 0x6000 /* BVM Ltd. BVME6000 */
+
+/* BI_VME_BRDINFO is a 32 byte struct as returned by the Bug code on
+ * Motorola VME boards. Contains board number, Bug version, board
+ * configuration options, etc. See include/asm/mvme16xhw.h for details.
+ */
+
+
+ /*
* Macintosh-specific tags (all u_long)
*/
@@ -184,6 +208,14 @@ extern struct mac_booter_data
#endif
/*
+ * Apollo-specific tags
+ */
+
+#define BI_APOLLO_MODEL 0x8000 /* model (u_long) */
+
+
+
+ /*
* Stuff for bootinfo interface versioning
*
* At the start of kernel code, a 'struct bootversion' is located.
diff --git a/include/asm-m68k/bvme6000hw.h b/include/asm-m68k/bvme6000hw.h
index 853120a04..28a859b03 100644
--- a/include/asm-m68k/bvme6000hw.h
+++ b/include/asm-m68k/bvme6000hw.h
@@ -95,6 +95,7 @@ typedef struct {
#define BVME_SCC_A_ADDR 0xffb0000b
#define BVME_SCC_B_ADDR 0xffb00003
+#define BVME_SCC_RTxC 7372800
#define BVME_CONFIG_REG 0xff500003
diff --git a/include/asm-m68k/cache.h b/include/asm-m68k/cache.h
index 9e009ce18..52262e891 100644
--- a/include/asm-m68k/cache.h
+++ b/include/asm-m68k/cache.h
@@ -7,16 +7,4 @@
/* bytes per L1 cache line */
#define L1_CACHE_BYTES 16
-#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
-
-#define SMP_CACHE_BYTES L1_CACHE_BYTES
-
-#ifdef MODULE
-#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
-#else
-#define __cacheline_aligned \
- __attribute__((__aligned__(L1_CACHE_BYTES), \
- __section__(".data.cacheline_aligned")))
-#endif
-
#endif
diff --git a/include/asm-m68k/div64.h b/include/asm-m68k/div64.h
new file mode 100644
index 000000000..16bf1f88d
--- /dev/null
+++ b/include/asm-m68k/div64.h
@@ -0,0 +1,35 @@
+#ifndef _M68K_DIV64_H
+#define _M68K_DIV64_H
+
+/* n = n / base; return rem; */
+
+#if 1
+#define do_div(n, base) ({ \
+ union { \
+ unsigned long n32[2]; \
+ unsigned long long n64; \
+ } __n; \
+ unsigned long __rem, __upper; \
+ \
+ __n.n64 = (n); \
+ if ((__upper = __n.n32[0])) { \
+ asm ("divul.l %2,%1:%0" \
+ : "=d" (__n.n32[0]), "=d" (__upper) \
+ : "d" (base), "0" (__n.n32[0])); \
+ } \
+ asm ("divu.l %2,%1:%0" \
+ : "=d" (__n.n32[1]), "=d" (__rem) \
+ : "d" (base), "1" (__upper), "0" (__n.n32[1])); \
+ (n) = __n.n64; \
+ __rem; \
+})
+#else
+#define do_div(n,base) ({ \
+ int __res; \
+ __res = ((unsigned long) n) % (unsigned) base; \
+ n = ((unsigned long) n) / (unsigned) base; \
+ __res; \
+})
+#endif
+
+#endif /* _M68K_DIV64_H */
diff --git a/include/asm-m68k/dma.h b/include/asm-m68k/dma.h
index af73a0f6f..d5266a886 100644
--- a/include/asm-m68k/dma.h
+++ b/include/asm-m68k/dma.h
@@ -1,12 +1,21 @@
#ifndef _M68K_DMA_H
#define _M68K_DMA_H 1
-/* Don't define MAX_DMA_ADDRESS; it's useless on the m68k and any
- occurrence should be flagged as an error. */
+#include <linux/config.h>
+
+/* it's useless on the m68k, but unfortunately needed by the new
+ bootmem allocator (but this should do it for this) */
+#define MAX_DMA_ADDRESS PAGE_OFFSET
#define MAX_DMA_CHANNELS 8
extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
extern void free_dma(unsigned int dmanr); /* release it again */
+#ifdef CONFIG_PCI
+extern int isa_dma_bridge_buggy;
+#else
+#define isa_dma_bridge_buggy (0)
+#endif
+
#endif /* _M68K_DMA_H */
diff --git a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h
index 56ab0dcf8..3575894b5 100644
--- a/include/asm-m68k/entry.h
+++ b/include/asm-m68k/entry.h
@@ -34,10 +34,6 @@
* the whole kernel.
*/
-#ifdef __ASSEMBLY__
-
-#define curptr a2
-
/* the following macro is used when enabling interrupts */
#if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES)
/* block out HSYNC on the atari */
@@ -49,6 +45,10 @@
#define MAX_NOINT_IPL 0
#endif /* machine compilation types */
+#ifdef __ASSEMBLY__
+
+#define curptr a2
+
LFLUSH_I_AND_D = 0x00000808
LSIGTRAP = 5
@@ -162,7 +162,7 @@ PF_DTRACE_BIT = 5
#endif
#define GET_CURRENT(tmp) \
"movel %%sp,"#tmp"\n\t" \
- "andw #-KTHREAD_SIZE,"#tmp"\n\t" \
+ "andw #-"STR(KTHREAD_SIZE)","#tmp"\n\t" \
"movel "#tmp",%%a2"
#endif
diff --git a/include/asm-m68k/fcntl.h b/include/asm-m68k/fcntl.h
index 2235bd5bb..b5780416f 100644
--- a/include/asm-m68k/fcntl.h
+++ b/include/asm-m68k/fcntl.h
@@ -18,6 +18,8 @@
#define FASYNC 020000 /* fcntl, for BSD compatibility */
#define O_DIRECTORY 040000 /* must be a directory */
#define O_NOFOLLOW 0100000 /* don't follow links */
+#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
+#define O_LARGEFILE 0400000
#define F_DUPFD 0 /* dup */
#define F_GETFD 1 /* get f_flags */
diff --git a/include/asm-m68k/hardirq.h b/include/asm-m68k/hardirq.h
index 6e8e0d4ac..0e3cd0c6f 100644
--- a/include/asm-m68k/hardirq.h
+++ b/include/asm-m68k/hardirq.h
@@ -10,8 +10,8 @@ extern unsigned int local_irq_count[NR_CPUS];
#define hardirq_trylock(cpu) (local_irq_count[cpu] == 0)
#define hardirq_endlock(cpu) do { } while (0)
-#define hardirq_enter(cpu) (local_irq_count[cpu]++)
-#define hardirq_exit(cpu) (local_irq_count[cpu]--)
+#define irq_enter(cpu) (local_irq_count[cpu]++)
+#define irq_exit(cpu) (local_irq_count[cpu]--)
#define synchronize_irq() barrier()
diff --git a/include/asm-m68k/mmu_context.h b/include/asm-m68k/mmu_context.h
index a8a1dfc61..f54fbfa17 100644
--- a/include/asm-m68k/mmu_context.h
+++ b/include/asm-m68k/mmu_context.h
@@ -7,6 +7,7 @@
#include <asm/setup.h>
#include <asm/page.h>
+#include <asm/pgalloc.h>
extern inline void
init_new_context(struct task_struct *tsk, struct mm_struct *mm)
diff --git a/include/asm-m68k/movs.h b/include/asm-m68k/movs.h
index 67dbea369..540d3e60e 100644
--- a/include/asm-m68k/movs.h
+++ b/include/asm-m68k/movs.h
@@ -10,46 +10,46 @@
/* Set DFC register value */
#define SET_DFC(x) \
- __asm__ __volatile__ (" movec %0,%/dfc" : : "d" (x));
+ __asm__ __volatile__ ("movec %0,%%dfc" : : "r" (x))
/* Get DFC register value */
#define GET_DFC(x) \
- __asm__ __volatile__ (" movec %/dfc, %0" : "=d" (x) : );
+ __asm__ __volatile__ ("movec %%dfc,%0" : "=r" (x))
/* Set SFC register value */
#define SET_SFC(x) \
- __asm__ __volatile__ (" movec %0,%/sfc" : : "d" (x));
+ __asm__ __volatile__ ("movec %0,%%sfc" : : "r" (x))
/* Get SFC register value */
#define GET_SFC(x) \
- __asm__ __volatile__ (" movec %/sfc, %0" : "=d" (x) : );
+ __asm__ __volatile__ ("movec %%sfc,%0" : "=r" (x))
#define SET_VBR(x) \
- __asm__ __volatile__ (" movec %0,%/vbr" : : "r" (x));
+ __asm__ __volatile__ ("movec %0,%%vbr" : : "r" (x))
#define GET_VBR(x) \
- __asm__ __volatile__ (" movec %/vbr, %0" : "=g" (x) : );
+ __asm__ __volatile__ ("movec %%vbr,%0" : "=r" (x))
-/* Set a byte using the "movs" instruction */
+/* Set a byte using the "moves" instruction */
#define SET_CONTROL_BYTE(addr,value) \
- __asm__ __volatile__ (" movsb %0, %1@" : : "d" (value), "a" (addr));
+ __asm__ __volatile__ ("movesb %1,%0" : "=m" (addr) : "d" (value))
-/* Get a byte using the "movs" instruction */
+/* Get a byte using the "moves" instruction */
#define GET_CONTROL_BYTE(addr,value) \
- __asm__ __volatile__ (" movsb %1@, %0" : "=d" (value) : "a" (addr));
+ __asm__ __volatile__ ("movesb %1,%0" : "=d" (value) : "m" (addr))
-/* Set a (long)word using the "movs" instruction */
+/* Set a (long)word using the "moves" instruction */
#define SET_CONTROL_WORD(addr,value) \
- __asm__ __volatile__ (" movsl %0, %1@" : : "d" (value), "a" (addr));
+ __asm__ __volatile__ ("movesl %1,%0" : "=m" (addr) : "r" (value))
-/* Get a (long)word using the "movs" instruction */
+/* Get a (long)word using the "moves" instruction */
#define GET_CONTROL_WORD(addr,value) \
- __asm__ __volatile__ (" movsl %1@, %0" : "=d" (value) : "a" (addr));
+ __asm__ __volatile__ ("movesl %1,%0" : "=d" (value) : "m" (addr))
#endif
diff --git a/include/asm-m68k/mvme147hw.h b/include/asm-m68k/mvme147hw.h
index f57216b9e..195a50893 100644
--- a/include/asm-m68k/mvme147hw.h
+++ b/include/asm-m68k/mvme147hw.h
@@ -85,11 +85,12 @@ struct pcc_regs {
#define M147_SCC_A_ADDR 0xfffe3002
#define M147_SCC_B_ADDR 0xfffe3000
+#define M147_SCC_PCLK 5000000
#define MVME147_IRQ_SCSI_PORT 0x45
#define MVME147_IRQ_SCSI_DMA 0x46
-/* SCC interrupts, for MVME162 */
+/* SCC interrupts, for MVME147 */
#define MVME147_IRQ_TYPE_PRIO 0
#define MVME147_IRQ_SCC_BASE 0x60
diff --git a/include/asm-m68k/mvme16xhw.h b/include/asm-m68k/mvme16xhw.h
index 75a21d8a4..4102460fb 100644
--- a/include/asm-m68k/mvme16xhw.h
+++ b/include/asm-m68k/mvme16xhw.h
@@ -62,6 +62,7 @@ typedef struct {
#define MVME_SCC_A_ADDR 0xfff45005
#define MVME_SCC_B_ADDR 0xfff45001
+#define MVME_SCC_PCLK 10000000
#define MVME162_IRQ_TYPE_PRIO 0
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index 6a3d9df66..23dd731c8 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -25,16 +25,14 @@
#ifndef __ASSEMBLY__
-#define STRICT_MM_TYPECHECKS
-
-#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
+#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
#define free_user_page(page, addr) free_page(addr)
/*
* We don't need to check for alignment etc.
*/
#ifdef CPU_M68040_OR_M68060_ONLY
-static inline void copy_page(unsigned long to, unsigned long from)
+static inline void copy_page(void *to, void *from)
{
unsigned long tmp;
@@ -49,11 +47,10 @@ static inline void copy_page(unsigned long to, unsigned long from)
);
}
-static inline void clear_page(unsigned long page)
+static inline void clear_page(void *page)
{
- unsigned long data, sp, tmp;
-
- sp = page;
+ unsigned long data, tmp;
+ void *sp = page;
data = 0;
@@ -75,11 +72,10 @@ static inline void clear_page(unsigned long page)
}
#else
-#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
-#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
+#define clear_page(page) memset((page), 0, PAGE_SIZE)
+#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
#endif
-#ifdef STRICT_MM_TYPECHECKS
/*
* These are used to make use of C type-checking..
*/
@@ -98,55 +94,29 @@ typedef struct { unsigned long pgprot; } pgprot_t;
#define __pgd(x) ((pgd_t) { (x) } )
#define __pgprot(x) ((pgprot_t) { (x) } )
-#else
-/*
- * .. while these make it easier on the compiler
- */
-typedef unsigned long pte_t;
-typedef struct { unsigned long pmd[16]; } pmd_t;
-typedef unsigned long pgd_t;
-typedef unsigned long pgprot_t;
+/* to align the pointer to the (next) page boundary */
+#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
-#define pte_val(x) (x)
-#define pmd_val(x) ((&x)->pmd[0])
-#define pgd_val(x) (x)
-#define pgprot_val(x) (x)
+#endif /* !__ASSEMBLY__ */
-#define __pte(x) (x)
-#define __pmd(x) ((pmd_t) { (x) } )
-#define __pgd(x) (x)
-#define __pgprot(x) (x)
+#include <asm/page_offset.h>
-#endif
+#define PAGE_OFFSET (PAGE_OFFSET_RAW)
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
+#ifndef __ASSEMBLY__
-/* This handles the memory map.. */
#ifndef CONFIG_SUN3
-#define PAGE_OFFSET 0
+
+#ifdef CONFIG_SINGLE_MEMORY_CHUNK
+extern unsigned long m68k_memoffset;
+
+#define __pa(vaddr) ((unsigned long)(vaddr)+m68k_memoffset)
+#define __va(paddr) ((void *)((unsigned long)(paddr)-m68k_memoffset))
#else
-#define PAGE_OFFSET 0x0E000000
+#define __pa(vaddr) virt_to_phys((void *)vaddr)
+#define __va(paddr) phys_to_virt((unsigned long)paddr)
#endif
-#ifndef CONFIG_SUN3
-#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
-/*
- * A hacky workaround for the problems with mmap() of frame buffer
- * memory in the lower 16MB physical memoryspace.
- *
- * This is a short term solution, we will have to deal properly
- * with this in 2.3.x.
- */
-extern inline void *__va(unsigned long physaddr)
-{
-#ifdef CONFIG_AMIGA
- if (MACH_IS_AMIGA && (physaddr < 16*1024*1024))
- return (void *)0xffffffff;
- else
-#endif
- return (void *)(physaddr+PAGE_OFFSET);
-}
#else /* !CONFIG_SUN3 */
/* This #define is a horrible hack to suppress lots of warnings. --m */
#define __pa(x) ___pa((unsigned long)x)
@@ -172,9 +142,7 @@ static inline void *__va(unsigned long x)
}
#endif /* CONFIG_SUN3 */
-#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT)
-
-#endif /* !__ASSEMBLY__ */
+#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
#ifndef CONFIG_SUN3
#define BUG() do { \
@@ -192,6 +160,8 @@ static inline void *__va(unsigned long x)
BUG(); \
} while (0)
+#endif /* __ASSEMBLY__ */
+
#endif /* __KERNEL__ */
#endif /* _M68K_PAGE_H */
diff --git a/include/asm-m68k/page_offset.h b/include/asm-m68k/page_offset.h
new file mode 100644
index 000000000..39e30499c
--- /dev/null
+++ b/include/asm-m68k/page_offset.h
@@ -0,0 +1,9 @@
+#include <linux/config.h>
+
+/* This handles the memory map.. */
+#ifndef CONFIG_SUN3
+#define PAGE_OFFSET_RAW 0x00000000
+#else
+#define PAGE_OFFSET_RAW 0x0E000000
+#endif
+
diff --git a/include/asm-m68k/pci.h b/include/asm-m68k/pci.h
new file mode 100644
index 000000000..76915264d
--- /dev/null
+++ b/include/asm-m68k/pci.h
@@ -0,0 +1,38 @@
+#ifndef _ASM_M68K_PCI_H
+#define _ASM_M68K_PCI_H
+
+/*
+ * asm-m68k/pci_m68k.h - m68k specific PCI declarations.
+ *
+ * Written by Wout Klaren.
+ */
+
+struct pci_ops;
+
+/*
+ * Structure with hardware dependent information and functions of the
+ * PCI bus.
+ */
+
+struct pci_bus_info
+{
+ /*
+ * Resources of the PCI bus.
+ */
+
+ struct resource mem_space;
+ struct resource io_space;
+
+ /*
+ * System dependent functions.
+ */
+
+ struct pci_ops *m68k_pci_ops;
+
+ void (*fixup)(int pci_modify);
+ void (*conf_device)(unsigned char bus, unsigned char device_fn);
+};
+
+#define pcibios_assign_all_busses() 0
+
+#endif /* _ASM_M68K_PCI_H */
diff --git a/include/asm-m68k/pgalloc.h b/include/asm-m68k/pgalloc.h
new file mode 100644
index 000000000..3d2a2b87d
--- /dev/null
+++ b/include/asm-m68k/pgalloc.h
@@ -0,0 +1,399 @@
+#ifndef _M68K_PGALLOC_H
+#define _M68K_PGALLOC_H
+
+#include <asm/setup.h>
+#include <asm/virtconvert.h>
+
+extern struct pgtable_cache_struct {
+ unsigned long *pmd_cache;
+ unsigned long *pte_cache;
+/* This counts in units of pointer tables, of which can be eight per page. */
+ unsigned long pgtable_cache_sz;
+} quicklists;
+
+#define pgd_quicklist ((unsigned long *)0)
+#define pmd_quicklist (quicklists.pmd_cache)
+#define pte_quicklist (quicklists.pte_cache)
+/* This isn't accurate because of fragmentation of allocated pages for
+ pointer tables, but that should not be a problem. */
+#define pgtable_cache_size ((quicklists.pgtable_cache_sz+7)/8)
+
+extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long offset);
+extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset);
+
+extern pmd_t *get_pointer_table(void);
+extern int free_pointer_table(pmd_t *);
+
+extern inline pte_t *get_pte_fast(void)
+{
+ unsigned long *ret;
+
+ ret = pte_quicklist;
+ if (ret) {
+ pte_quicklist = (unsigned long *)*ret;
+ ret[0] = 0;
+ quicklists.pgtable_cache_sz -= 8;
+ }
+ return (pte_t *)ret;
+}
+
+extern inline void free_pte_fast(pte_t *pte)
+{
+ *(unsigned long *)pte = (unsigned long)pte_quicklist;
+ pte_quicklist = (unsigned long *)pte;
+ quicklists.pgtable_cache_sz += 8;
+}
+
+extern inline void free_pte_slow(pte_t *pte)
+{
+ cache_page((unsigned long)pte);
+ free_page((unsigned long) pte);
+}
+
+extern inline pmd_t *get_pmd_fast(void)
+{
+ unsigned long *ret;
+
+ ret = pmd_quicklist;
+ if (ret) {
+ pmd_quicklist = (unsigned long *)*ret;
+ ret[0] = 0;
+ quicklists.pgtable_cache_sz--;
+ }
+ return (pmd_t *)ret;
+}
+
+extern inline void free_pmd_fast(pmd_t *pmd)
+{
+ *(unsigned long *)pmd = (unsigned long)pmd_quicklist;
+ pmd_quicklist = (unsigned long *) pmd;
+ quicklists.pgtable_cache_sz++;
+}
+
+extern inline int free_pmd_slow(pmd_t *pmd)
+{
+ return free_pointer_table(pmd);
+}
+
+/* The pgd cache is folded into the pmd cache, so these are dummy routines. */
+extern inline pgd_t *get_pgd_fast(void)
+{
+ return (pgd_t *)0;
+}
+
+extern inline void free_pgd_fast(pgd_t *pgd)
+{
+}
+
+extern inline void free_pgd_slow(pgd_t *pgd)
+{
+}
+
+extern void __bad_pte(pmd_t *pmd);
+extern void __bad_pmd(pgd_t *pgd);
+
+extern inline void pte_free(pte_t *pte)
+{
+ free_pte_fast(pte);
+}
+
+extern inline pte_t *pte_alloc(pmd_t *pmd, unsigned long address)
+{
+ address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
+ if (pmd_none(*pmd)) {
+ pte_t *page = get_pte_fast();
+
+ if (!page)
+ return get_pte_slow(pmd, address);
+ pmd_set(pmd,page);
+ return page + address;
+ }
+ if (pmd_bad(*pmd)) {
+ __bad_pte(pmd);
+ return NULL;
+ }
+ return (pte_t *)__pmd_page(*pmd) + address;
+}
+
+extern inline void pmd_free(pmd_t *pmd)
+{
+ free_pmd_fast(pmd);
+}
+
+extern inline pmd_t *pmd_alloc(pgd_t *pgd, unsigned long address)
+{
+ address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
+ if (pgd_none(*pgd)) {
+ pmd_t *page = get_pmd_fast();
+
+ if (!page)
+ return get_pmd_slow(pgd, address);
+ pgd_set(pgd, page);
+ return page + address;
+ }
+ if (pgd_bad(*pgd)) {
+ __bad_pmd(pgd);
+ return NULL;
+ }
+ return (pmd_t *)__pgd_page(*pgd) + address;
+}
+
+extern inline void pte_free_kernel(pte_t *pte)
+{
+ free_pte_fast(pte);
+}
+
+extern inline pte_t *pte_alloc_kernel(pmd_t *pmd, unsigned long address)
+{
+ return pte_alloc(pmd, address);
+}
+
+extern inline void pmd_free_kernel(pmd_t *pmd)
+{
+ free_pmd_fast(pmd);
+}
+
+extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
+{
+ return pmd_alloc(pgd, address);
+}
+
+extern inline void pgd_free(pgd_t *pgd)
+{
+ free_pmd_fast((pmd_t *)pgd);
+}
+
+extern inline pgd_t *pgd_alloc(void)
+{
+ pgd_t *pgd = (pgd_t *)get_pmd_fast();
+ if (!pgd)
+ pgd = (pgd_t *)get_pointer_table();
+ return pgd;
+}
+
+extern int do_check_pgt_cache(int, int);
+
+extern inline void set_pgdir(unsigned long address, pgd_t entry)
+{
+}
+
+
+/*
+ * Cache handling functions
+ */
+
+#define flush_icache() \
+({ \
+ if (CPU_IS_040_OR_060) \
+ __asm__ __volatile__("nop\n\t" \
+ ".chip 68040\n\t" \
+ "cinva %%ic\n\t" \
+ ".chip 68k" : ); \
+ else { \
+ unsigned long _tmp; \
+ __asm__ __volatile__("movec %%cacr,%0\n\t" \
+ "orw %1,%0\n\t" \
+ "movec %0,%%cacr" \
+ : "=&d" (_tmp) \
+ : "id" (FLUSH_I)); \
+ } \
+})
+
+/*
+ * invalidate the cache for the specified memory range.
+ * It starts at the physical address specified for
+ * the given number of bytes.
+ */
+extern void cache_clear(unsigned long paddr, int len);
+/*
+ * push any dirty cache in the specified memory range.
+ * It starts at the physical address specified for
+ * the given number of bytes.
+ */
+extern void cache_push(unsigned long paddr, int len);
+
+/*
+ * push and invalidate pages in the specified user virtual
+ * memory range.
+ */
+extern void cache_push_v(unsigned long vaddr, int len);
+
+/* cache code */
+#define FLUSH_I_AND_D (0x00000808)
+#define FLUSH_I (0x00000008)
+
+/* This is needed whenever the virtual mapping of the current
+ process changes. */
+#define __flush_cache_all() \
+({ \
+ if (CPU_IS_040_OR_060) \
+ __asm__ __volatile__("nop\n\t" \
+ ".chip 68040\n\t" \
+ "cpusha %dc\n\t" \
+ ".chip 68k"); \
+ else { \
+ unsigned long _tmp; \
+ __asm__ __volatile__("movec %%cacr,%0\n\t" \
+ "orw %1,%0\n\t" \
+ "movec %0,%%cacr" \
+ : "=&d" (_tmp) \
+ : "di" (FLUSH_I_AND_D)); \
+ } \
+})
+
+#define __flush_cache_030() \
+({ \
+ if (CPU_IS_020_OR_030) { \
+ unsigned long _tmp; \
+ __asm__ __volatile__("movec %%cacr,%0\n\t" \
+ "orw %1,%0\n\t" \
+ "movec %0,%%cacr" \
+ : "=&d" (_tmp) \
+ : "di" (FLUSH_I_AND_D)); \
+ } \
+})
+
+#define flush_cache_all() __flush_cache_all()
+
+extern inline void flush_cache_mm(struct mm_struct *mm)
+{
+ if (mm == current->mm)
+ __flush_cache_030();
+}
+
+extern inline void flush_cache_range(struct mm_struct *mm,
+ unsigned long start,
+ unsigned long end)
+{
+ if (mm == current->mm)
+ __flush_cache_030();
+}
+
+extern inline void flush_cache_page(struct vm_area_struct *vma,
+ unsigned long vmaddr)
+{
+ if (vma->vm_mm == current->mm)
+ __flush_cache_030();
+}
+
+/* Push the page at kernel virtual address and clear the icache */
+#define flush_page_to_ram(page) __flush_page_to_ram(page_address(page))
+extern inline void __flush_page_to_ram(unsigned long address)
+{
+ if (CPU_IS_040_OR_060) {
+ __asm__ __volatile__("nop\n\t"
+ ".chip 68040\n\t"
+ "cpushp %%dc,(%0)\n\t"
+ "cinvp %%ic,(%0)\n\t"
+ ".chip 68k"
+ : : "a" (__pa((void *)address)));
+ } else {
+ unsigned long _tmp;
+ __asm__ __volatile__("movec %%cacr,%0\n\t"
+ "orw %1,%0\n\t"
+ "movec %0,%%cacr"
+ : "=&d" (_tmp)
+ : "di" (FLUSH_I));
+ }
+}
+
+/* Push n pages at kernel virtual address and clear the icache */
+extern inline void flush_icache_range (unsigned long address,
+ unsigned long endaddr)
+{
+ if (CPU_IS_040_OR_060) {
+ short n = (endaddr - address + PAGE_SIZE - 1) / PAGE_SIZE;
+
+ while (--n >= 0) {
+ __asm__ __volatile__("nop\n\t"
+ ".chip 68040\n\t"
+ "cpushp %%dc,(%0)\n\t"
+ "cinvp %%ic,(%0)\n\t"
+ ".chip 68k"
+ : : "a" (virt_to_phys((void *)address)));
+ address += PAGE_SIZE;
+ }
+ } else {
+ unsigned long tmp;
+ __asm__ __volatile__("movec %%cacr,%0\n\t"
+ "orw %1,%0\n\t"
+ "movec %0,%%cacr"
+ : "=&d" (tmp)
+ : "di" (FLUSH_I));
+ }
+}
+
+
+/*
+ * flush all user-space atc entries.
+ */
+static inline void __flush_tlb(void)
+{
+ if (CPU_IS_040_OR_060)
+ __asm__ __volatile__(".chip 68040\n\t"
+ "pflushan\n\t"
+ ".chip 68k");
+ else
+ __asm__ __volatile__("pflush #0,#4");
+}
+
+static inline void __flush_tlb_one(unsigned long addr)
+{
+ if (CPU_IS_040_OR_060) {
+ __asm__ __volatile__(".chip 68040\n\t"
+ "pflush (%0)\n\t"
+ ".chip 68k"
+ : : "a" (addr));
+ } else
+ __asm__ __volatile__("pflush #0,#4,(%0)" : : "a" (addr));
+}
+
+#define flush_tlb() __flush_tlb()
+
+/*
+ * flush all atc entries (both kernel and user-space entries).
+ */
+static inline void flush_tlb_all(void)
+{
+ if (CPU_IS_040_OR_060)
+ __asm__ __volatile__(".chip 68040\n\t"
+ "pflusha\n\t"
+ ".chip 68k");
+ else
+ __asm__ __volatile__("pflusha");
+}
+
+static inline void flush_tlb_mm(struct mm_struct *mm)
+{
+ if (mm == current->mm)
+ __flush_tlb();
+}
+
+static inline void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
+{
+ if (vma->vm_mm == current->mm)
+ __flush_tlb_one(addr);
+}
+
+static inline void flush_tlb_range(struct mm_struct *mm,
+ unsigned long start, unsigned long end)
+{
+ if (mm == current->mm)
+ __flush_tlb();
+}
+
+extern inline void flush_tlb_kernel_page(unsigned long addr)
+{
+ if (CPU_IS_040_OR_060) {
+ mm_segment_t old_fs = get_fs();
+ set_fs(KERNEL_DS);
+ __asm__ __volatile__(".chip 68040\n\t"
+ "pflush (%0)\n\t"
+ ".chip 68k"
+ : : "a" (addr));
+ set_fs(old_fs);
+ } else
+ __asm__ __volatile__("pflush #4,#4,(%0)" : : "a" (addr));
+}
+
+#endif /* _M68K_PGALLOC_H */
diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h
index c94acfc38..9df773f9f 100644
--- a/include/asm-m68k/pgtable.h
+++ b/include/asm-m68k/pgtable.h
@@ -15,226 +15,6 @@
#include <asm/virtconvert.h>
-/*
- * Cache handling functions
- */
-
-#define flush_icache() \
-do { \
- if (CPU_IS_040_OR_060) \
- asm __volatile__ ("nop\n\t" \
- ".chip 68040\n\t" \
- "cinva %%ic\n\t" \
- ".chip 68k" : ); \
- else { \
- unsigned long _tmp; \
- asm __volatile__ ("movec %%cacr,%0\n\t" \
- "orw %1,%0\n\t" \
- "movec %0,%%cacr" \
- : "=&d" (_tmp) \
- : "id" (FLUSH_I)); \
- } \
-} while (0)
-
-/*
- * invalidate the cache for the specified memory range.
- * It starts at the physical address specified for
- * the given number of bytes.
- */
-extern void cache_clear (unsigned long paddr, int len);
-/*
- * push any dirty cache in the specified memory range.
- * It starts at the physical address specified for
- * the given number of bytes.
- */
-extern void cache_push (unsigned long paddr, int len);
-
-/*
- * push and invalidate pages in the specified user virtual
- * memory range.
- */
-extern void cache_push_v (unsigned long vaddr, int len);
-
-/* cache code */
-#define FLUSH_I_AND_D (0x00000808)
-#define FLUSH_I (0x00000008)
-
-/* This is needed whenever the virtual mapping of the current
- process changes. */
-#define __flush_cache_all() \
- do { \
- if (CPU_IS_040_OR_060) \
- __asm__ __volatile__ ("nop\n\t" \
- ".chip 68040\n\t" \
- "cpusha %dc\n\t" \
- ".chip 68k"); \
- else { \
- unsigned long _tmp; \
- __asm__ __volatile__ ("movec %%cacr,%0\n\t" \
- "orw %1,%0\n\t" \
- "movec %0,%%cacr" \
- : "=&d" (_tmp) \
- : "di" (FLUSH_I_AND_D)); \
- } \
- } while (0)
-
-#define __flush_cache_030() \
- do { \
- if (CPU_IS_020_OR_030) { \
- unsigned long _tmp; \
- __asm__ __volatile__ ("movec %%cacr,%0\n\t" \
- "orw %1,%0\n\t" \
- "movec %0,%%cacr" \
- : "=&d" (_tmp) \
- : "di" (FLUSH_I_AND_D)); \
- } \
- } while (0)
-
-#define flush_cache_all() __flush_cache_all()
-
-extern inline void flush_cache_mm(struct mm_struct *mm)
-{
- if (mm == current->mm)
- __flush_cache_030();
-}
-
-extern inline void flush_cache_range(struct mm_struct *mm,
- unsigned long start,
- unsigned long end)
-{
- if (mm == current->mm)
- __flush_cache_030();
-}
-
-extern inline void flush_cache_page(struct vm_area_struct *vma,
- unsigned long vmaddr)
-{
- if (vma->vm_mm == current->mm)
- __flush_cache_030();
-}
-
-/* Push the page at kernel virtual address and clear the icache */
-extern inline void flush_page_to_ram (unsigned long address)
-{
- if (CPU_IS_040_OR_060) {
- __asm__ __volatile__ ("nop\n\t"
- ".chip 68040\n\t"
- "cpushp %%dc,(%0)\n\t"
- "cinvp %%ic,(%0)\n\t"
- ".chip 68k"
- : : "a" (virt_to_phys((void *)address)));
- }
- else {
- unsigned long _tmp;
- __asm volatile ("movec %%cacr,%0\n\t"
- "orw %1,%0\n\t"
- "movec %0,%%cacr"
- : "=&d" (_tmp)
- : "di" (FLUSH_I));
- }
-}
-
-/* Push n pages at kernel virtual address and clear the icache */
-extern inline void flush_icache_range (unsigned long address,
- unsigned long endaddr)
-{
- if (CPU_IS_040_OR_060) {
- short n = (endaddr - address + PAGE_SIZE - 1) / PAGE_SIZE;
-
- while (n--) {
- __asm__ __volatile__ ("nop\n\t"
- ".chip 68040\n\t"
- "cpushp %%dc,(%0)\n\t"
- "cinvp %%ic,(%0)\n\t"
- ".chip 68k"
- : : "a" (virt_to_phys((void *)address)));
- address += PAGE_SIZE;
- }
- }
- else {
- unsigned long _tmp;
- __asm volatile ("movec %%cacr,%0\n\t"
- "orw %1,%0\n\t"
- "movec %0,%%cacr"
- : "=&d" (_tmp)
- : "di" (FLUSH_I));
- }
-}
-
-
-/*
- * flush all user-space atc entries.
- */
-static inline void __flush_tlb(void)
-{
- if (CPU_IS_040_OR_060)
- __asm__ __volatile__(".chip 68040\n\t"
- "pflushan\n\t"
- ".chip 68k");
- else
- __asm__ __volatile__("pflush #0,#4");
-}
-
-static inline void __flush_tlb_one(unsigned long addr)
-{
- if (CPU_IS_040_OR_060) {
- __asm__ __volatile__(".chip 68040\n\t"
- "pflush (%0)\n\t"
- ".chip 68k"
- : : "a" (addr));
- } else
- __asm__ __volatile__("pflush #0,#4,(%0)" : : "a" (addr));
-}
-
-#define flush_tlb() __flush_tlb()
-
-/*
- * flush all atc entries (both kernel and user-space entries).
- */
-static inline void flush_tlb_all(void)
-{
- if (CPU_IS_040_OR_060)
- __asm__ __volatile__(".chip 68040\n\t"
- "pflusha\n\t"
- ".chip 68k");
- else
- __asm__ __volatile__("pflusha");
-}
-
-static inline void flush_tlb_mm(struct mm_struct *mm)
-{
- if (mm == current->mm)
- __flush_tlb();
-}
-
-static inline void flush_tlb_page(struct vm_area_struct *vma,
- unsigned long addr)
-{
- if (vma->vm_mm == current->mm)
- __flush_tlb_one(addr);
-}
-
-static inline void flush_tlb_range(struct mm_struct *mm,
- unsigned long start, unsigned long end)
-{
- if (mm == current->mm)
- __flush_tlb();
-}
-
-extern inline void flush_tlb_kernel_page(unsigned long addr)
-{
- if (CPU_IS_040_OR_060) {
- mm_segment_t old_fs = get_fs();
- set_fs(KERNEL_DS);
- __asm__ __volatile__(".chip 68040\n\t"
- "pflush (%0)\n\t"
- ".chip 68k"
- : : "a" (addr));
- set_fs(old_fs);
- } else
- __asm__ __volatile__("pflush #4,#4,(%0)" : : "a" (addr));
-}
-
/* Certain architectures need to do special things when pte's
* within a page table are directly modified. Thus, the following
* hook is made available.
@@ -391,7 +171,7 @@ extern pte_t * __bad_pagetable(void);
#define BAD_PAGETABLE __bad_pagetable()
#define BAD_PAGE __bad_page()
-#define ZERO_PAGE(vaddr) empty_zero_page
+#define ZERO_PAGE(vaddr) (mem_map + MAP_NR(empty_zero_page))
/* number of bits that fit into a memory pointer */
#define BITS_PER_PTR (8*sizeof(unsigned long))
@@ -403,67 +183,78 @@ extern pte_t * __bad_pagetable(void);
/* 64-bit machines, beware! SRB. */
#define SIZEOF_PTR_LOG2 2
-/* to find an entry in a page-table */
-#define PAGE_PTR(address) \
-((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
-
/*
* Conversion functions: convert a page and protection to a page entry,
* and a page entry and page directory to the page they refer to.
*/
-#define mk_pte(page, pgprot) \
-({ pte_t __pte; pte_val(__pte) = virt_to_phys((void *)page) + pgprot_val(pgprot); __pte; })
+#define __mk_pte(page, pgprot) \
+({ \
+ pte_t __pte; \
+ \
+ pte_val(__pte) = __pa((void *)page) + pgprot_val(pgprot); \
+ __pte; \
+})
+#define mk_pte(page, pgprot) __mk_pte(page_address(page), (pgprot))
#define mk_pte_phys(physpage, pgprot) \
-({ pte_t __pte; pte_val(__pte) = (unsigned long)physpage + pgprot_val(pgprot); __pte; })
+({ \
+ pte_t __pte; \
+ \
+ pte_val(__pte) = (physpage) + pgprot_val(pgprot); \
+ __pte; \
+})
extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
{ pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; }
extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
{
- int i;
- unsigned long ptbl;
- ptbl = virt_to_phys(ptep) | _PAGE_TABLE | _PAGE_ACCESSED;
- for (i = 0; i < 16; i++, ptbl += (sizeof(pte_t)*PTRS_PER_PTE/16))
- pmdp->pmd[i] = ptbl;
+ unsigned long ptbl = virt_to_phys(ptep) | _PAGE_TABLE | _PAGE_ACCESSED;
+ unsigned long *ptr = pmdp->pmd;
+ short i = 16;
+ while (--i >= 0) {
+ *ptr++ = ptbl;
+ ptbl += (sizeof(pte_t)*PTRS_PER_PTE/16);
+ }
}
extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp)
-{ pgd_val(*pgdp) = _PAGE_TABLE | _PAGE_ACCESSED | virt_to_phys(pmdp); }
-
-extern inline unsigned long pte_page(pte_t pte)
-{ return (unsigned long)phys_to_virt(pte_val(pte) & PAGE_MASK); }
-
-extern inline unsigned long pmd_page2(pmd_t *pmd)
-{ return (unsigned long)phys_to_virt(pmd_val(*pmd) & _TABLE_MASK); }
-#define pmd_page(pmd) pmd_page2(&(pmd))
-
-extern inline unsigned long pgd_page(pgd_t pgd)
-{ return (unsigned long)phys_to_virt(pgd_val(pgd) & _TABLE_MASK); }
-
-extern inline int pte_none(pte_t pte) { return !pte_val(pte); }
-extern inline int pte_present(pte_t pte) { return pte_val(pte) & (_PAGE_PRESENT | _PAGE_FAKE_SUPER); }
-extern inline void pte_clear(pte_t *ptep) { pte_val(*ptep) = 0; }
-
-extern inline int pmd_none2(pmd_t *pmd) { return !pmd_val(*pmd); }
-#define pmd_none(pmd) pmd_none2(&(pmd))
-extern inline int pmd_bad2(pmd_t *pmd) { return (pmd_val(*pmd) & _DESCTYPE_MASK) != _PAGE_TABLE; }
-#define pmd_bad(pmd) pmd_bad2(&(pmd))
-extern inline int pmd_present2(pmd_t *pmd) { return pmd_val(*pmd) & _PAGE_TABLE; }
-#define pmd_present(pmd) pmd_present2(&(pmd))
-extern inline void pmd_clear(pmd_t * pmdp)
-{
- short i;
-
- for (i = 15; i >= 0; i--)
- pmdp->pmd[i] = 0;
-}
-
-extern inline int pgd_none(pgd_t pgd) { return !pgd_val(pgd); }
-extern inline int pgd_bad(pgd_t pgd) { return (pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE; }
-extern inline int pgd_present(pgd_t pgd) { return pgd_val(pgd) & _PAGE_TABLE; }
-
-extern inline void pgd_clear(pgd_t * pgdp) { pgd_val(*pgdp) = 0; }
+{ pgd_val(*pgdp) = _PAGE_TABLE | _PAGE_ACCESSED | __pa(pmdp); }
+
+#define __pte_page(pte) ((unsigned long)__va(pte_val(pte) & PAGE_MASK))
+#define __pmd_page(pmd) ((unsigned long)__va(pmd_val(pmd) & _TABLE_MASK))
+#define __pgd_page(pgd) ((unsigned long)__va(pgd_val(pgd) & _TABLE_MASK))
+
+#define pte_none(pte) (!pte_val(pte))
+#define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_FAKE_SUPER))
+#define pte_clear(ptep) ({ pte_val(*(ptep)) = 0; })
+#define pte_pagenr(pte) ((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT)
+
+#define pmd_none(pmd) (!pmd_val(pmd))
+#define pmd_bad(pmd) ((pmd_val(pmd) & _DESCTYPE_MASK) != _PAGE_TABLE)
+#define pmd_present(pmd) (pmd_val(pmd) & _PAGE_TABLE)
+#define pmd_clear(pmdp) ({ \
+ unsigned long *__ptr = pmdp->pmd; \
+ short __i = 16; \
+ while (--__i >= 0) \
+ *__ptr++ = 0; \
+})
+
+#define pgd_none(pgd) (!pgd_val(pgd))
+#define pgd_bad(pgd) ((pgd_val(pgd) & _DESCTYPE_MASK) != _PAGE_TABLE)
+#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_TABLE)
+#define pgd_clear(pgdp) ({ pgd_val(*pgdp) = 0; })
+
+/* Permanent address of a page. */
+#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; })
+#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT))
+#define pte_page(pte) (mem_map+pte_pagenr(pte))
+
+#define pte_ERROR(e) \
+ printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), pte_val(e))
+#define pmd_ERROR(e) \
+ printk("%s:%d: bad pmd %p(%08lx).\n", __FILE__, __LINE__, &(e), pmd_val(e))
+#define pgd_ERROR(e) \
+ printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e))
/*
* The following only work if pte_present() is true.
@@ -512,13 +303,13 @@ extern inline pgd_t * pgd_offset_k(unsigned long address)
/* Find an entry in the second-level page table.. */
extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
{
- return (pmd_t *) pgd_page(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PMD-1));
+ return (pmd_t *)__pgd_page(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PMD-1));
}
/* Find an entry in the third-level page table.. */
extern inline pte_t * pte_offset(pmd_t * pmdp, unsigned long address)
{
- return (pte_t *) pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1));
+ return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1));
}
/*
@@ -559,178 +350,6 @@ static inline void cache_page (unsigned long vaddr)
}
}
-extern struct pgtable_cache_struct {
- unsigned long *pmd_cache;
- unsigned long *pte_cache;
-/* This counts in units of pointer tables, of which can be eight per page. */
- unsigned long pgtable_cache_sz;
-} quicklists;
-
-#define pgd_quicklist ((unsigned long *)0)
-#define pmd_quicklist (quicklists.pmd_cache)
-#define pte_quicklist (quicklists.pte_cache)
-/* This isn't accurate because of fragmentation of allocated pages for
- pointer tables, but that should not be a problem. */
-#define pgtable_cache_size ((quicklists.pgtable_cache_sz+7)/8)
-
-extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long offset);
-extern pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset);
-
-extern pmd_t *get_pointer_table(void);
-extern int free_pointer_table(pmd_t *);
-
-extern __inline__ pte_t *get_pte_fast(void)
-{
- unsigned long *ret;
-
- ret = pte_quicklist;
- if (ret) {
- pte_quicklist = (unsigned long *)*ret;
- ret[0] = 0;
- quicklists.pgtable_cache_sz -= 8;
- }
- return (pte_t *)ret;
-}
-
-extern __inline__ void free_pte_fast(pte_t *pte)
-{
- *(unsigned long *)pte = (unsigned long)pte_quicklist;
- pte_quicklist = (unsigned long *)pte;
- quicklists.pgtable_cache_sz += 8;
-}
-
-extern __inline__ void free_pte_slow(pte_t *pte)
-{
- cache_page((unsigned long)pte);
- free_page((unsigned long) pte);
-}
-
-extern __inline__ pmd_t *get_pmd_fast(void)
-{
- unsigned long *ret;
-
- ret = pmd_quicklist;
- if (ret) {
- pmd_quicklist = (unsigned long *)*ret;
- ret[0] = 0;
- quicklists.pgtable_cache_sz--;
- }
- return (pmd_t *)ret;
-}
-
-extern __inline__ void free_pmd_fast(pmd_t *pmd)
-{
- *(unsigned long *)pmd = (unsigned long)pmd_quicklist;
- pmd_quicklist = (unsigned long *) pmd;
- quicklists.pgtable_cache_sz++;
-}
-
-extern __inline__ int free_pmd_slow(pmd_t *pmd)
-{
- return free_pointer_table(pmd);
-}
-
-/* The pgd cache is folded into the pmd cache, so these are dummy routines. */
-extern __inline__ pgd_t *get_pgd_fast(void)
-{
- return (pgd_t *)0;
-}
-
-extern __inline__ void free_pgd_fast(pgd_t *pgd)
-{
-}
-
-extern __inline__ void free_pgd_slow(pgd_t *pgd)
-{
-}
-
-extern void __bad_pte(pmd_t *pmd);
-extern void __bad_pmd(pgd_t *pgd);
-
-extern inline void pte_free(pte_t * pte)
-{
- free_pte_fast(pte);
-}
-
-extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address)
-{
- address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
- if (pmd_none(*pmd)) {
- pte_t * page = get_pte_fast();
-
- if (!page)
- return get_pte_slow(pmd, address);
- pmd_set(pmd,page);
- return page + address;
- }
- if (pmd_bad(*pmd)) {
- __bad_pte(pmd);
- return NULL;
- }
- return (pte_t *) pmd_page(*pmd) + address;
-}
-
-extern inline void pmd_free(pmd_t * pmd)
-{
- free_pmd_fast(pmd);
-}
-
-extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address)
-{
- address = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
- if (pgd_none(*pgd)) {
- pmd_t *page = get_pmd_fast();
-
- if (!page)
- return get_pmd_slow(pgd, address);
- pgd_set(pgd, page);
- return page + address;
- }
- if (pgd_bad(*pgd)) {
- __bad_pmd(pgd);
- return NULL;
- }
- return (pmd_t *) pgd_page(*pgd) + address;
-}
-
-extern inline void pte_free_kernel(pte_t * pte)
-{
- free_pte_fast(pte);
-}
-
-extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address)
-{
- return pte_alloc(pmd, address);
-}
-
-extern inline void pmd_free_kernel(pmd_t * pmd)
-{
- free_pmd_fast(pmd);
-}
-
-extern inline pmd_t * pmd_alloc_kernel(pgd_t * pgd, unsigned long address)
-{
- return pmd_alloc(pgd, address);
-}
-
-extern inline void pgd_free(pgd_t * pgd)
-{
- free_pmd_fast((pmd_t *)pgd);
-}
-
-extern inline pgd_t * pgd_alloc(void)
-{
- pgd_t *pgd = (pgd_t *)get_pmd_fast();
- if (!pgd)
- pgd = (pgd_t *)get_pointer_table();
- return pgd;
-}
-
-extern int do_check_pgt_cache(int, int);
-
-extern inline void set_pgdir(unsigned long address, pgd_t entry)
-{
-}
/*
* Check if the addr/len goes up to the end of a physical
@@ -760,21 +379,12 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma,
{
}
-/*
- * I don't know what is going on here, but since these were changed,
- * swapping hasn't been working on the 68040.
- */
-/* With the new handling of PAGE_NONE the old definitions definitely
- don't work any more. */
-
-#define SWP_TYPE(entry) (((entry) >> 2) & 0x7f)
-#if 0
-#define SWP_OFFSET(entry) ((entry) >> 9)
-#define SWP_ENTRY(type,offset) (((type) << 2) | ((offset) << 9))
-#else
-#define SWP_OFFSET(entry) ((entry) >> PAGE_SHIFT)
-#define SWP_ENTRY(type,offset) (((type) << 2) | ((offset) << PAGE_SHIFT))
-#endif
+/* Encode and de-code a swap entry (must be !pte_none(e) && !pte_present(e)) */
+#define SWP_TYPE(x) (((x).val >> 1) & 0xff)
+#define SWP_OFFSET(x) ((x).val >> 10)
+#define SWP_ENTRY(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 10) })
+#define pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
+#define swp_entry_to_pte(x) ((pte_t) { (x).val })
#endif /* __ASSEMBLY__ */
diff --git a/include/asm-m68k/poll.h b/include/asm-m68k/poll.h
index f66153a74..32dcf6490 100644
--- a/include/asm-m68k/poll.h
+++ b/include/asm-m68k/poll.h
@@ -11,6 +11,7 @@
#define POLLWRNORM POLLOUT
#define POLLRDBAND 128
#define POLLWRBAND 256
+#define POLLMSG 0x0400
struct pollfd {
int fd;
diff --git a/include/asm-m68k/semaphore.h b/include/asm-m68k/semaphore.h
index cb4f38230..16ab57862 100644
--- a/include/asm-m68k/semaphore.h
+++ b/include/asm-m68k/semaphore.h
@@ -1,6 +1,8 @@
#ifndef _M68K_SEMAPHORE_H
#define _M68K_SEMAPHORE_H
+#ifndef __ASSEMBLY__
+
#include <linux/linkage.h>
#include <linux/wait.h>
#include <linux/spinlock.h>
@@ -9,13 +11,14 @@
#include <asm/atomic.h>
/*
- * SMP- and interrupt-safe semaphores..
+ * Interrupt-safe semaphores..
*
* (C) Copyright 1996 Linus Torvalds
*
* m68k version by Andreas Schwab
*/
+
struct semaphore {
atomic_t count;
atomic_t waking;
@@ -180,4 +183,174 @@ extern inline void up(struct semaphore * sem)
: "memory");
}
+
+/* rw mutexes (should that be mutices? =) -- throw rw
+ * spinlocks and semaphores together, and this is what we
+ * end up with...
+ *
+ * m68k version by Roman Zippel
+ */
+
+struct rw_semaphore {
+ atomic_t count;
+ volatile unsigned char write_bias_granted;
+ volatile unsigned char read_bias_granted;
+ volatile unsigned char pad1;
+ volatile unsigned char pad2;
+ wait_queue_head_t wait;
+ wait_queue_head_t write_bias_wait;
+#if WAITQUEUE_DEBUG
+ long __magic;
+ atomic_t readers;
+ atomic_t writers;
+#endif
+};
+#endif /* __ASSEMBLY__ */
+
+#define RW_LOCK_BIAS 0x01000000
+
+#ifndef __ASSEMBLY__
+
+extern inline void down_read(struct rw_semaphore *sem)
+{
+ register struct rw_semaphore *__sem __asm__ ("%a1") = sem;
+
+#if WAITQUEUE_DEBUG
+ if (sem->__magic != (long)&sem->__magic)
+ BUG();
+#endif
+ __asm__ __volatile__(
+ "| atomic down_read operation\n\t"
+ "subql #1,%0@\n\t"
+ "jmi 2f\n"
+ "1:\n"
+ ".section .text.lock,\"ax\"\n"
+ ".even\n"
+ "2:\n\t"
+ "pea 1b\n\t"
+ "jbra __down_read_failed\n"
+ ".previous"
+ : /* no outputs */
+ : "a" (__sem)
+ : "memory");
+#if WAITQUEUE_DEBUG
+ if (sem->write_bias_granted)
+ BUG();
+ if (atomic_read(&sem->writers))
+ BUG();
+ atomic_inc(&sem->readers);
+#endif
+}
+
+extern inline void down_write(struct rw_semaphore *sem)
+{
+ register struct rw_semaphore *__sem __asm__ ("%a1") = sem;
+
+#if WAITQUEUE_DEBUG
+ if (sem->__magic != (long)&sem->__magic)
+ BUG();
+#endif
+ __asm__ __volatile__(
+ "| atomic down_write operation\n\t"
+ "subl %1,%0@\n\t"
+ "jne 2f\n"
+ "1:\n"
+ ".section .text.lock,\"ax\"\n"
+ ".even\n"
+ "2:\n\t"
+ "pea 1b\n\t"
+ "jbra __down_write_failed\n"
+ ".previous"
+ : /* no outputs */
+ : "a" (__sem), "id" (RW_LOCK_BIAS)
+ : "memory");
+#if WAITQUEUE_DEBUG
+ if (atomic_read(&sem->writers))
+ BUG();
+ if (atomic_read(&sem->readers))
+ BUG();
+ if (sem->read_bias_granted)
+ BUG();
+ if (sem->write_bias_granted)
+ BUG();
+ atomic_inc(&sem->writers);
+#endif
+}
+
+/* When a reader does a release, the only significant
+ * case is when there was a writer waiting, and we've
+ * bumped the count to 0: we must wake the writer up.
+ */
+extern inline void __up_read(struct rw_semaphore *sem)
+{
+ register struct rw_semaphore *__sem __asm__ ("%a1") = sem;
+
+ __asm__ __volatile__(
+ "| atomic up_read operation\n\t"
+ "addql #1,%0@\n\t"
+ "jeq 2f\n"
+ "1:\n"
+ ".section .text.lock,\"ax\"\n"
+ ".even\n"
+ "2:\n\t"
+ "pea 1b\n\t"
+ "jbra __rwsem_wake\n"
+ ".previous"
+ : /* no outputs */
+ : "a" (__sem)
+ : "memory");
+}
+
+extern inline void up_read(struct rw_semaphore *sem)
+{
+#if WAITQUEUE_DEBUG
+ if (sem->write_bias_granted)
+ BUG();
+ if (atomic_read(&sem->writers))
+ BUG();
+ atomic_dec(&sem->readers);
+#endif
+ __up_read(sem);
+}
+
+/* releasing the writer is easy -- just release it and
+ * wake up any sleepers.
+ */
+extern inline void __up_write(struct rw_semaphore *sem)
+{
+ register struct rw_semaphore *__sem __asm__ ("%a1") = sem;
+
+ __asm__ __volatile__(
+ "| atomic up_write operation\n\t"
+ "addl %1,%0@\n\t"
+ "jcs 2f\n"
+ "1:\n"
+ ".section .text.lock,\"ax\"\n"
+ ".even\n"
+ "2:\n\t"
+ "pea 1b\n\t"
+ "jbra __rwsem_wake\n"
+ ".previous"
+ : /* no outputs */
+ : "a" (__sem), "id" (RW_LOCK_BIAS)
+ : "memory");
+}
+
+extern inline void up_write(struct rw_semaphore *sem)
+{
+#if WAITQUEUE_DEBUG
+ if (sem->read_bias_granted)
+ BUG();
+ if (sem->write_bias_granted)
+ BUG();
+ if (atomic_read(&sem->readers))
+ BUG();
+ if (atomic_read(&sem->writers) != 1)
+ BUG();
+ atomic_dec(&sem->writers);
+#endif
+ __up_write(sem);
+}
+#endif /* __ASSEMBLY__ */
+
#endif
diff --git a/include/asm-m68k/setup.h b/include/asm-m68k/setup.h
index b2b11ed76..6d198bc5f 100644
--- a/include/asm-m68k/setup.h
+++ b/include/asm-m68k/setup.h
@@ -246,6 +246,9 @@ extern unsigned long m68k_machtype;
extern unsigned long m68k_cputype;
extern unsigned long m68k_fputype;
extern unsigned long m68k_mmutype; /* Not really used yet */
+#ifdef CONFIG_VME
+extern unsigned long vme_brdtype;
+#endif
/*
* m68k_is040or060 is != 0 for a '040 or higher;
diff --git a/include/asm-m68k/siginfo.h b/include/asm-m68k/siginfo.h
index 2dac2b063..4061e6f72 100644
--- a/include/asm-m68k/siginfo.h
+++ b/include/asm-m68k/siginfo.h
@@ -24,8 +24,7 @@ typedef struct siginfo {
/* kill() */
struct {
pid_t _pid; /* sender's pid */
- old_uid_t _uid; /* backwards compatibility */
- uid_t _uid32; /* sender's uid */
+ uid_t _uid; /* sender's uid */
} _kill;
/* POSIX.1b timers */
@@ -37,19 +36,17 @@ typedef struct siginfo {
/* POSIX.1b signals */
struct {
pid_t _pid; /* sender's pid */
- old_uid_t _uid; /* backwards compatibility */
+ uid_t _uid; /* sender's uid */
sigval_t _sigval;
- uid_t _uid32; /* sender's uid */
} _rt;
/* SIGCHLD */
struct {
pid_t _pid; /* which child */
- old_uid_t _uid; /* backwards compatibility */
+ uid_t _uid; /* sender's uid */
int _status; /* exit code */
clock_t _utime;
clock_t _stime;
- uid_t _uid32; /* sender's uid */
} _sigchld;
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
@@ -65,18 +62,11 @@ typedef struct siginfo {
} _sifields;
} siginfo_t;
-#define UID16_SIGINFO_COMPAT_NEEDED
-
/*
* How these fields are to be accessed.
*/
#define si_pid _sifields._kill._pid
-#ifdef __KERNEL__
-#define si_uid _sifields._kill._uid32
-#define si_uid16 _sifields._kill._uid
-#else
#define si_uid _sifields._kill._uid
-#endif /* __KERNEL__ */
#define si_status _sifields._sigchld._status
#define si_utime _sifields._sigchld._utime
#define si_stime _sifields._sigchld._stime
diff --git a/include/asm-m68k/stat.h b/include/asm-m68k/stat.h
index c2145c33d..b28ce37c5 100644
--- a/include/asm-m68k/stat.h
+++ b/include/asm-m68k/stat.h
@@ -38,8 +38,40 @@ struct stat {
unsigned long __unused5;
};
-/* stat64 struct goes here -- someone please make
- * it mesh with whatever glibc does in userland on
- * m68k's.
+/* This matches struct stat64 in glibc2.1, hence the absolutely
+ * insane amounts of padding around dev_t's.
*/
+struct stat64 {
+ unsigned short st_dev;
+ unsigned char __pad0[10];
+
+ unsigned long st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+
+ unsigned long st_uid;
+ unsigned long st_gid;
+
+ unsigned short st_rdev;
+ unsigned char __pad3[10];
+
+ long long st_size;
+ unsigned long st_blksize;
+
+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
+ unsigned long __pad4; /* future possible st_blocks high bits */
+
+ unsigned long st_atime;
+ unsigned long __pad5;
+
+ unsigned long st_mtime;
+ unsigned long __pad6;
+
+ unsigned long st_ctime;
+ unsigned long __pad7; /* will be high 32 bits of ctime someday */
+
+ unsigned long __unused1;
+ unsigned long __unused2;
+};
+
#endif /* _M68K_STAT_H */
diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h
index 7d1afa286..7b6ae7d16 100644
--- a/include/asm-m68k/system.h
+++ b/include/asm-m68k/system.h
@@ -4,6 +4,7 @@
#include <linux/config.h> /* get configuration macros */
#include <linux/linkage.h>
#include <asm/segment.h>
+#include <asm/entry.h>
#define prepare_to_switch() do { } while(0)
@@ -44,36 +45,52 @@ asmlinkage void resume(void);
(last) = _last; \
}
+
+/* interrupt control.. */
+#if 0
+#define __sti() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory")
+#else
+#include <asm/hardirq.h>
+#define __sti() ({ \
+ if (!local_irq_count[smp_processor_id()]) \
+ asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory"); \
+})
+#endif
+#define __cli() asm volatile ("oriw #0x0700,%%sr": : : "memory")
+#define __save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory")
+#define __restore_flags(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory")
+
+/* For spinlocks etc */
+#define local_irq_save(x) ({ __save_flags(x); __cli(); })
+#define local_irq_restore(x) __restore_flags(x)
+#define local_irq_disable() __cli()
+#define local_irq_enable() __sti()
+
+#define cli() __cli()
+#define sti() __sti()
+#define save_flags(x) __save_flags(x)
+#define restore_flags(x) __restore_flags(x)
+
+
+/*
+ * Force strict CPU ordering.
+ * Not really required on m68k...
+ */
+#define nop() asm volatile ("nop"::)
+#define mb() asm volatile ("" : : :"memory")
+#define rmb() asm volatile ("" : : :"memory")
+#define wmb() asm volatile ("" : : :"memory")
+#define set_rmb(var, value) do { xchg(&var, value); } while (0)
+#define set_mb(var, value) set_rmb(var, value)
+#define set_wmb(var, value) do { var = value; wmb(); } while (0)
+
+
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
#define tas(ptr) (xchg((ptr),1))
struct __xchg_dummy { unsigned long a[100]; };
#define __xg(x) ((volatile struct __xchg_dummy *)(x))
-#if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES)
-/* block out HSYNC on the atari */
-#define __sti() __asm__ __volatile__ ("andiw #0xfbff,%/sr": : : "memory")
-#else /* portable version */
-#define __sti() __asm__ __volatile__ ("andiw #0xf8ff,%/sr": : : "memory")
-#endif /* machine compilation types */
-#define __cli() __asm__ __volatile__ ("oriw #0x0700,%/sr": : : "memory")
-#define nop() __asm__ __volatile__ ("nop"::)
-#define mb() __asm__ __volatile__ ("" : : :"memory")
-#define rmb() __asm__ __volatile__ ("" : : :"memory")
-#define wmb() __asm__ __volatile__ ("" : : :"memory")
-
-#define __save_flags(x) \
-__asm__ __volatile__("movew %/sr,%0":"=d" (x) : /* no input */ :"memory")
-
-#define __restore_flags(x) \
-__asm__ __volatile__("movew %0,%/sr": /* no outputs */ :"d" (x) : "memory")
-
-#define cli() __cli()
-#define sti() __sti()
-#define save_flags(x) __save_flags(x)
-#define restore_flags(x) __restore_flags(x)
-#define save_and_cli(flags) do { save_flags(flags); cli(); } while(0)
-
#ifndef CONFIG_RMW_INSNS
static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
{
diff --git a/include/asm-m68k/termios.h b/include/asm-m68k/termios.h
index 07f6b8585..0f127c134 100644
--- a/include/asm-m68k/termios.h
+++ b/include/asm-m68k/termios.h
@@ -43,6 +43,9 @@ struct termio {
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h
index 548ce9ede..82897ade9 100644
--- a/include/asm-m68k/uaccess.h
+++ b/include/asm-m68k/uaccess.h
@@ -799,33 +799,46 @@ strncpy_from_user(char *dst, const char *src, long count)
/*
* Return the size of a string (including the ending 0)
*
- * Return 0 for error
+ * Return 0 on exception, a value greater than N if too long
*/
-static inline long strlen_user(const char * src)
+static inline long strnlen_user(const char *src, long n)
{
- long res = -(long) src;
- __asm__ __volatile__
- ("1: movesb (%1)+,%%d0\n"
- "12:tstb %%d0\n"
- " jne 1b\n"
- " addl %1,%0\n"
- "2:\n"
- ".section .fixup,\"ax\"\n"
- " .even\n"
- "3: moveq %2,%0\n"
- " jra 2b\n"
- ".previous\n"
- ".section __ex_table,\"a\"\n"
- " .align 4\n"
- " .long 1b,3b\n"
- " .long 12b,3b\n"
- ".previous"
- : "=d"(res), "=a"(src)
- : "i"(0), "0"(res), "1"(src)
- : "d0");
- return res;
+ long res;
+
+ res = -(long)src;
+ __asm__ __volatile__
+ ("1:\n"
+ " tstl %2\n"
+ " jeq 3f\n"
+ "2: movesb (%1)+,%%d0\n"
+ "22:\n"
+ " subql #1,%2\n"
+ " tstb %%d0\n"
+ " jne 1b\n"
+ " jra 4f\n"
+ "3:\n"
+ " addql #1,%0\n"
+ "4:\n"
+ " addl %1,%0\n"
+ "5:\n"
+ ".section .fixup,\"ax\"\n"
+ " .even\n"
+ "6: moveq %3,%0\n"
+ " jra 5b\n"
+ ".previous\n"
+ ".section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 2b,6b\n"
+ " .long 22b,6b\n"
+ ".previous"
+ : "=d"(res), "=a"(src), "=d"(n)
+ : "i"(0), "0"(res), "1"(src), "2"(n)
+ : "d0");
+ return res;
}
+#define strlen_user(str) strnlen_user(str, 32767)
+
/*
* Zero Userspace
*/
diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h
index 302308d88..4841264ab 100644
--- a/include/asm-m68k/virtconvert.h
+++ b/include/asm-m68k/virtconvert.h
@@ -9,6 +9,7 @@
#include <linux/config.h>
#include <asm/setup.h>
+#include <asm/page.h>
#ifdef CONFIG_AMIGA
#include <asm/amigahw.h>
@@ -34,22 +35,22 @@ extern inline unsigned long mm_ptov(unsigned long paddr)
#endif
#ifdef CONFIG_SINGLE_MEMORY_CHUNK
-extern inline unsigned long virt_to_phys(volatile void * address)
+extern inline unsigned long virt_to_phys(volatile void *vaddr)
{
- unsigned long voff = (unsigned long) address;
+ unsigned long voff = (unsigned long)vaddr - PAGE_OFFSET;
if (voff < m68k_memory[0].size)
- return m68k_memory[0].addr + voff;
- else
- return mm_vtop_fallback(voff);
+ return voff + m68k_memory[0].addr;
+ return mm_vtop_fallback((unsigned long)vaddr);
}
extern inline void * phys_to_virt(unsigned long paddr)
{
- unsigned long base = m68k_memory[0].addr;
+ unsigned long poff = paddr - m68k_memory[0].addr;
+
+ if (poff < m68k_memory[0].size)
+ return (void *)(poff + PAGE_OFFSET);
- if ((paddr >= base) && (paddr < (base + m68k_memory[0].size)))
- return (void *)(paddr - base);
#ifdef CONFIG_AMIGA
/*
* if on an amiga and address is in first 16M, move it
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
index 5d4f314dc..a5c61a5d0 100644
--- a/include/asm-mips/checksum.h
+++ b/include/asm-mips/checksum.h
@@ -1,4 +1,4 @@
-/* $Id: checksum.h,v 1.6 1998/09/19 19:19:36 ralf Exp $
+/* $Id: checksum.h,v 1.7 2000/02/16 01:07:48 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -9,6 +9,8 @@
#ifndef _ASM_CHECKSUM_H
#define _ASM_CHECKSUM_H
+#include <asm/uaccess.h>
+
/*
* computes the checksum of a memory block at buff, length len,
* and adds in "sum" (32-bit)
diff --git a/include/asm-mips/parport.h b/include/asm-mips/parport.h
index dcf0ff69d..0ae99c2e9 100644
--- a/include/asm-mips/parport.h
+++ b/include/asm-mips/parport.h
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: parport.h,v 1.1 1999/10/09 00:01:43 ralf Exp $
*
* parport.h: ia32-specific parport initialisation
*
@@ -39,16 +39,16 @@ parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
do {
if (!*io_hi) *io_hi = 0x400 + *io;
if (parport_pc_probe_port(*(io++), *(io_hi++),
- *(irq++), *(dma++)))
+ *(irq++), *(dma++), NULL))
count++;
} while (*io && (++i < PARPORT_PC_MAX_PORTS));
} else {
/* Probe all the likely ports. */
- if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0], NULL))
count++;
- if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0], NULL))
count++;
- if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0], NULL))
count++;
count += parport_pc_init_pci (irq[0], dma[0]);
}
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
index b6a865e9a..20c330760 100644
--- a/include/asm-mips/pci.h
+++ b/include/asm-mips/pci.h
@@ -1,4 +1,4 @@
-/* $Id: pci.h,v 1.6 1999/10/09 00:01:43 ralf Exp $
+/* $Id: pci.h,v 1.7 2000/02/16 01:07:48 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -16,4 +16,162 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
+#ifdef __KERNEL__
+
+/*
+ * Dynamic DMA mapping stuff.
+ * MIPS has everything mapped statically.
+ */
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/slab.h>
+#include <asm/scatterlist.h>
+#include <linux/string.h>
+#include <asm/io.h>
+
+struct pci_dev;
+
+/*
+ * Allocate and map kernel buffer using consistent mode DMA for a device.
+ * hwdev should be valid struct pci_dev pointer for PCI devices,
+ * NULL for PCI-like buses (ISA, EISA).
+ * Returns non-NULL cpu-view pointer to the buffer if successful and
+ * sets *dma_addrp to the pci side dma address as well, else *dma_addrp
+ * is undefined.
+ */
+extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
+ dma_addr_t *dma_handle);
+
+/*
+ * Free and unmap a consistent DMA buffer.
+ * cpu_addr is what was returned from pci_alloc_consistent,
+ * size must be the same as what as passed into pci_alloc_consistent,
+ * and likewise dma_addr must be the same as what *dma_addrp was set to.
+ *
+ * References to the memory and mappings associated with cpu_addr/dma_addr
+ * past this call are illegal.
+ */
+extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
+ void *vaddr, dma_addr_t dma_handle);
+
+/*
+ * Map a single buffer of the indicated size for DMA in streaming mode.
+ * The 32-bit bus address to use is returned.
+ *
+ * Once the device is given the dma address, the device owns this memory
+ * until either pci_unmap_single or pci_dma_sync_single is performed.
+ */
+extern inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
+ size_t size)
+{
+ dma_cache_wback_inv((unsigned long)ptr, size);
+
+ return virt_to_bus(ptr);
+}
+
+/*
+ * Unmap a single streaming mode DMA translation. The dma_addr and size
+ * must match what was provided for in a previous pci_map_single call. All
+ * other usages are undefined.
+ *
+ * After this call, reads by the cpu to the buffer are guarenteed to see
+ * whatever the device wrote there.
+ */
+extern inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
+ size_t size)
+{
+ /* Nothing to do */
+}
+
+/*
+ * Map a set of buffers described by scatterlist in streaming
+ * mode for DMA. This is the scather-gather version of the
+ * above pci_map_single interface. Here the scatter gather list
+ * elements are each tagged with the appropriate dma address
+ * and length. They are obtained via sg_dma_{address,length}(SG).
+ *
+ * NOTE: An implementation may be able to use a smaller number of
+ * DMA address/length pairs than there are SG table elements.
+ * (for example via virtual mapping capabilities)
+ * The routine returns the number of addr/length pairs actually
+ * used, at most nents.
+ *
+ * Device ownership issues as mentioned above for pci_map_single are
+ * the same here.
+ */
+extern inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
+ int nents)
+{
+ /* Make sure that gcc doesn't leave the empty loop body. */
+#ifndef CONFIG_COHERENT_IO
+ int i;
+
+ for (i = 0; i < nents; i++, sg++)
+ dma_cache_wback_inv((unsigned long)sg->address, sg->length);
+#endif
+
+ return nents;
+}
+
+/*
+ * Unmap a set of streaming mode DMA translations.
+ * Again, cpu read rules concerning calls here are the same as for
+ * pci_unmap_single() above.
+ */
+extern inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
+ int nents)
+{
+ /* Nothing to do */
+}
+
+/*
+ * Make physical memory consistent for a single
+ * streaming mode DMA translation after a transfer.
+ *
+ * If you perform a pci_map_single() but wish to interrogate the
+ * buffer using the cpu, yet do not wish to teardown the PCI dma
+ * mapping, you must call this function before doing so. At the
+ * next point you give the PCI dma address back to the card, the
+ * device again owns the buffer.
+ */
+extern inline void pci_dma_sync_single(struct pci_dev *hwdev,
+ dma_addr_t dma_handle,
+ size_t size)
+{
+ dma_cache_wback_inv((unsigned long)bus_to_virt(dma_handle), size);
+}
+
+/*
+ * Make physical memory consistent for a set of streaming
+ * mode DMA translations after a transfer.
+ *
+ * The same as pci_dma_sync_single but for a scatter-gather list,
+ * same rules and usage.
+ */
+extern inline void pci_dma_sync_sg(struct pci_dev *hwdev,
+ struct scatterlist *sg,
+ int nelems)
+{
+ /* Make sure that gcc doesn't leave the empty loop body. */
+#ifndef CONFIG_COHERENT_IO
+ int i;
+
+ for (i = 0; i < nelems; i++, sg++)
+ dma_cache_wback_inv((unsigned long)sg->address, sg->length);
+#endif
+}
+
+/*
+ * These macros should be used after a pci_map_sg call has been done
+ * to get bus addresses of each of the SG entries and their lengths.
+ * You should only work with the number of sg entries pci_map_sg
+ * returns, or alternatively stop on the first sg_dma_len(sg) which
+ * is 0.
+ */
+#define sg_dma_address(sg) (virt_to_bus((sg)->address))
+#define sg_dma_len(sg) ((sg)->length)
+
+#endif /* __KERNEL__ */
+
#endif /* _ASM_PCI_H */
diff --git a/include/asm-mips/semaphore.h b/include/asm-mips/semaphore.h
index 433c3b862..6a0fab080 100644
--- a/include/asm-mips/semaphore.h
+++ b/include/asm-mips/semaphore.h
@@ -1,4 +1,4 @@
-/* $Id: semaphore.h,v 1.11 1999/10/20 21:10:58 ralf Exp $
+/* $Id: semaphore.h,v 1.12 1999/12/08 22:05:10 harald Exp $
*
* SMP- and interrupt-safe semaphores..
*
@@ -7,8 +7,8 @@
* for more details.
*
* (C) Copyright 1996 Linus Torvalds
- * (C) Copyright 1998, 1999 Ralf Baechle
- * (C) Copyright 1999 Silicon Graphics, Inc.
+ * (C) Copyright 1998, 1999, 2000 Ralf Baechle
+ * (C) Copyright 1999, 2000 Silicon Graphics, Inc.
*/
#ifndef _ASM_SEMAPHORE_H
#define _ASM_SEMAPHORE_H
@@ -189,4 +189,174 @@ extern inline void up(struct semaphore * sem)
__up(sem);
}
+/*
+ * rw mutexes (should that be mutices? =) -- throw rw spinlocks and
+ * semaphores together, and this is what we end up with...
+ *
+ * The lock is initialized to BIAS. This way, a writer subtracts BIAS ands
+ * gets 0 for the case of an uncontended lock. Readers decrement by 1 and
+ * see a positive value when uncontended, negative if there are writers
+ * waiting (in which case it goes to sleep).
+ *
+ * The value 0x01000000 supports up to 128 processors and lots of processes.
+ * BIAS must be chosen such that subtracting BIAS once per CPU will result
+ * in the int remaining negative. In terms of fairness, this should result
+ * in the lock flopping back and forth between readers and writers under
+ * heavy use.
+ *
+ * Once we start supporting machines with more than 128 CPUs, we should go
+ * for using a 64bit atomic type instead of 32bit as counter. We shall
+ * probably go for bias 0x80000000 then, so that single sethi can set it.
+ * */
+
+#define RW_LOCK_BIAS 0x01000000
+
+struct rw_semaphore {
+ atomic_t count;
+ /* bit 0 means read bias granted;
+ bit 1 means write bias granted. */
+ unsigned granted;
+ wait_queue_head_t wait;
+ wait_queue_head_t write_bias_wait;
+#if WAITQUEUE_DEBUG
+ long __magic;
+ atomic_t readers;
+ atomic_t writers;
+#endif
+};
+
+#if WAITQUEUE_DEBUG
+#define __RWSEM_DEBUG_INIT , ATOMIC_INIT(0), ATOMIC_INIT(0)
+#else
+#define __RWSEM_DEBUG_INIT /* */
+#endif
+
+#define __RWSEM_INITIALIZER(name,count) \
+ { ATOMIC_INIT(count), 0, \
+ __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), \
+ __WAIT_QUEUE_HEAD_INITIALIZER((name).write_bias_wait) \
+ __SEM_DEBUG_INIT(name) __RWSEM_DEBUG_INIT }
+
+#define __DECLARE_RWSEM_GENERIC(name,count) \
+ struct rw_semaphore name = __RWSEM_INITIALIZER(name,count)
+
+#define DECLARE_RWSEM(name) \
+ __DECLARE_RWSEM_GENERIC(name, RW_LOCK_BIAS)
+#define DECLARE_RWSEM_READ_LOCKED(name) \
+ __DECLARE_RWSEM_GENERIC(name, RW_LOCK_BIAS-1)
+#define DECLARE_RWSEM_WRITE_LOCKED(name) \
+ __DECLARE_RWSEM_GENERIC(name, 0)
+
+extern inline void init_rwsem(struct rw_semaphore *sem)
+{
+ atomic_set(&sem->count, RW_LOCK_BIAS);
+ sem->granted = 0;
+ init_waitqueue_head(&sem->wait);
+ init_waitqueue_head(&sem->write_bias_wait);
+#if WAITQUEUE_DEBUG
+ sem->__magic = (long)&sem->__magic;
+ atomic_set(&sem->readers, 0);
+ atomic_set(&sem->writers, 0);
+#endif
+}
+
+/* The expensive part is outlined. */
+extern void __down_read(struct rw_semaphore *sem, int count);
+extern void __down_write(struct rw_semaphore *sem, int count);
+extern void __rwsem_wake(struct rw_semaphore *sem, unsigned long readers);
+
+extern inline void down_read(struct rw_semaphore *sem)
+{
+ int count;
+
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
+ count = atomic_dec_return(&sem->count);
+ if (count < 0) {
+ __down_read(sem, count);
+ }
+ mb();
+
+#if WAITQUEUE_DEBUG
+ if (sem->granted & 2)
+ BUG();
+ if (atomic_read(&sem->writers))
+ BUG();
+ atomic_inc(&sem->readers);
+#endif
+}
+
+extern inline void down_write(struct rw_semaphore *sem)
+{
+ int count;
+
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
+ count = atomic_sub_return(RW_LOCK_BIAS, &sem->count);
+ if (count) {
+ __down_write(sem, count);
+ }
+ mb();
+
+#if WAITQUEUE_DEBUG
+ if (atomic_read(&sem->writers))
+ BUG();
+ if (atomic_read(&sem->readers))
+ BUG();
+ if (sem->granted & 3)
+ BUG();
+ atomic_inc(&sem->writers);
+#endif
+}
+
+/* When a reader does a release, the only significant case is when
+ there was a writer waiting, and we've bumped the count to 0: we must
+ wake the writer up. */
+
+extern inline void up_read(struct rw_semaphore *sem)
+{
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+ if (sem->granted & 2)
+ BUG();
+ if (atomic_read(&sem->writers))
+ BUG();
+ atomic_dec(&sem->readers);
+#endif
+
+ mb();
+ if (atomic_inc_return(&sem->count) == 0)
+ __rwsem_wake(sem, 0);
+}
+
+/*
+ * Releasing the writer is easy -- just release it and wake up any sleepers.
+ */
+extern inline void up_write(struct rw_semaphore *sem)
+{
+ int count;
+
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+ if (sem->granted & 3)
+ BUG();
+ if (atomic_read(&sem->readers))
+ BUG();
+ if (atomic_read(&sem->writers) != 1)
+ BUG();
+ atomic_dec(&sem->writers);
+#endif
+
+ mb();
+ count = atomic_add_return(RW_LOCK_BIAS, &sem->count);
+ if (count - RW_LOCK_BIAS < 0 && count >= 0) {
+ /* Only do the wake if we're no longer negative. */
+ __rwsem_wake(sem, count);
+ }
+}
+
#endif /* _ASM_SEMAPHORE_H */
diff --git a/include/asm-mips/siginfo.h b/include/asm-mips/siginfo.h
index ef8ea8765..2dd4765e7 100644
--- a/include/asm-mips/siginfo.h
+++ b/include/asm-mips/siginfo.h
@@ -1,4 +1,4 @@
-/* $Id: siginfo.h,v 1.4 1999/06/13 16:35:54 ralf Exp $
+/* $Id: siginfo.h,v 1.5 1999/08/18 23:37:49 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -169,7 +169,7 @@ typedef struct siginfo {
#define CLD_TRAPPED 4 /* traced child has trapped */
#define CLD_STOPPED 5 /* child has stopped */
#define CLD_CONTINUED 6 /* stopped child has continued */
-#define NSIGCLD 6
+#define NSIGCHLD 6
/*
* SIGPOLL si_codes
diff --git a/include/asm-mips/termios.h b/include/asm-mips/termios.h
index e7688850b..2e0ed639a 100644
--- a/include/asm-mips/termios.h
+++ b/include/asm-mips/termios.h
@@ -1,4 +1,4 @@
-/* $Id: termios.h,v 1.8 2000/01/27 22:49:42 ralf Exp $
+/* $Id: termios.h,v 1.8 2000/01/27 23:45:30 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -83,6 +83,7 @@ struct termio {
#define TIOCM_DSR 0x400 /* data set ready */
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
/* line disciplines */
#define N_TTY 0
diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h
index 99b23a1e9..d7bf84ee4 100644
--- a/include/asm-mips/types.h
+++ b/include/asm-mips/types.h
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: types.h,v 1.3 1999/08/18 23:37:50 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -70,6 +70,8 @@ typedef unsigned long long u64;
#define BITS_PER_LONG _MIPS_SZLONG
+typedef unsigned long dma_addr_t;
+
#endif /* __KERNEL__ */
#endif /* _ASM_TYPES_H */
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index d1dbd1e5f..c07c5154a 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -1,4 +1,4 @@
-/* $Id: unistd.h,v 1.18 2000/02/04 07:40:53 ralf Exp $
+/* $Id: unistd.h,v 1.19 2000/02/05 06:47:37 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -1202,11 +1202,12 @@
#define __NR_stat64 (__NR_Linux + 213)
#define __NR_lstat64 (__NR_Linux + 214)
#define __NR_fstat64 (__NR_Linux + 215)
+#define __NR_pivot_root (__NR_Linux + 216)
/*
* Offset of the last Linux flavoured syscall
*/
-#define __NR_Linux_syscalls 215
+#define __NR_Linux_syscalls 216
#ifndef _LANGUAGE_ASSEMBLY
diff --git a/include/asm-mips64/checksum.h b/include/asm-mips64/checksum.h
index 7d389ed21..979088f57 100644
--- a/include/asm-mips64/checksum.h
+++ b/include/asm-mips64/checksum.h
@@ -1,4 +1,4 @@
-/* $Id: checksum.h,v 1.3 1999/11/19 23:22:59 ralf Exp $
+/* $Id: checksum.h,v 1.4 2000/02/16 01:07:48 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -10,6 +10,8 @@
#ifndef _ASM_CHECKSUM_H
#define _ASM_CHECKSUM_H
+#include <asm/checksum.h>
+
/*
* computes the checksum of a memory block at buff, length len,
* and adds in "sum" (32-bit)
diff --git a/include/asm-mips64/parport.h b/include/asm-mips64/parport.h
index dcf0ff69d..0ae99c2e9 100644
--- a/include/asm-mips64/parport.h
+++ b/include/asm-mips64/parport.h
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: parport.h,v 1.1 1999/10/09 00:01:43 ralf Exp $
*
* parport.h: ia32-specific parport initialisation
*
@@ -39,16 +39,16 @@ parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
do {
if (!*io_hi) *io_hi = 0x400 + *io;
if (parport_pc_probe_port(*(io++), *(io_hi++),
- *(irq++), *(dma++)))
+ *(irq++), *(dma++), NULL))
count++;
} while (*io && (++i < PARPORT_PC_MAX_PORTS));
} else {
/* Probe all the likely ports. */
- if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0], NULL))
count++;
- if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0], NULL))
count++;
- if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0]))
+ if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0], NULL))
count++;
count += parport_pc_init_pci (irq[0], dma[0]);
}
diff --git a/include/asm-mips64/pci.h b/include/asm-mips64/pci.h
index 96a39ad98..a1e0e992e 100644
--- a/include/asm-mips64/pci.h
+++ b/include/asm-mips64/pci.h
@@ -1,4 +1,4 @@
-/* $Id: pci.h,v 1.1 1999/12/04 03:59:12 ralf Exp $
+/* $Id: pci.h,v 1.2 2000/02/16 01:07:49 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -16,4 +16,162 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
+#ifdef __KERNEL__
+
+/*
+ * Dynamic DMA mapping stuff.
+ * MIPS has everything mapped statically.
+ */
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/slab.h>
+#include <asm/scatterlist.h>
+#include <linux/string.h>
+#include <asm/io.h>
+
+struct pci_dev;
+
+/*
+ * Allocate and map kernel buffer using consistent mode DMA for a device.
+ * hwdev should be valid struct pci_dev pointer for PCI devices,
+ * NULL for PCI-like buses (ISA, EISA).
+ * Returns non-NULL cpu-view pointer to the buffer if successful and
+ * sets *dma_addrp to the pci side dma address as well, else *dma_addrp
+ * is undefined.
+ */
+extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
+ dma_addr_t *dma_handle);
+
+/*
+ * Free and unmap a consistent DMA buffer.
+ * cpu_addr is what was returned from pci_alloc_consistent,
+ * size must be the same as what as passed into pci_alloc_consistent,
+ * and likewise dma_addr must be the same as what *dma_addrp was set to.
+ *
+ * References to the memory and mappings associated with cpu_addr/dma_addr
+ * past this call are illegal.
+ */
+extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
+ void *vaddr, dma_addr_t dma_handle);
+
+/*
+ * Map a single buffer of the indicated size for DMA in streaming mode.
+ * The 32-bit bus address to use is returned.
+ *
+ * Once the device is given the dma address, the device owns this memory
+ * until either pci_unmap_single or pci_dma_sync_single is performed.
+ */
+extern inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
+ size_t size)
+{
+ dma_cache_wback_inv((unsigned long)ptr, size);
+
+ return virt_to_bus(ptr);
+}
+
+/*
+ * Unmap a single streaming mode DMA translation. The dma_addr and size
+ * must match what was provided for in a previous pci_map_single call. All
+ * other usages are undefined.
+ *
+ * After this call, reads by the cpu to the buffer are guarenteed to see
+ * whatever the device wrote there.
+ */
+extern inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
+ size_t size)
+{
+ /* Nothing to do */
+}
+
+/*
+ * Map a set of buffers described by scatterlist in streaming
+ * mode for DMA. This is the scather-gather version of the
+ * above pci_map_single interface. Here the scatter gather list
+ * elements are each tagged with the appropriate dma address
+ * and length. They are obtained via sg_dma_{address,length}(SG).
+ *
+ * NOTE: An implementation may be able to use a smaller number of
+ * DMA address/length pairs than there are SG table elements.
+ * (for example via virtual mapping capabilities)
+ * The routine returns the number of addr/length pairs actually
+ * used, at most nents.
+ *
+ * Device ownership issues as mentioned above for pci_map_single are
+ * the same here.
+ */
+extern inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
+ int nents)
+{
+ /* Make sure that gcc doesn't leave the empty loop body. */
+#ifndef CONFIG_COHERENT_IO
+ int i;
+
+ for (i = 0; i < nents; i++, sg++)
+ dma_cache_wback_inv((unsigned long)sg->address, sg->length);
+#endif
+
+ return nents;
+}
+
+/*
+ * Unmap a set of streaming mode DMA translations.
+ * Again, cpu read rules concerning calls here are the same as for
+ * pci_unmap_single() above.
+ */
+extern inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
+ int nents)
+{
+ /* Nothing to do */
+}
+
+/*
+ * Make physical memory consistent for a single
+ * streaming mode DMA translation after a transfer.
+ *
+ * If you perform a pci_map_single() but wish to interrogate the
+ * buffer using the cpu, yet do not wish to teardown the PCI dma
+ * mapping, you must call this function before doing so. At the
+ * next point you give the PCI dma address back to the card, the
+ * device again owns the buffer.
+ */
+extern inline void pci_dma_sync_single(struct pci_dev *hwdev,
+ dma_addr_t dma_handle,
+ size_t size)
+{
+ dma_cache_wback_inv((unsigned long)bus_to_virt(dma_handle), size);
+}
+
+/*
+ * Make physical memory consistent for a set of streaming
+ * mode DMA translations after a transfer.
+ *
+ * The same as pci_dma_sync_single but for a scatter-gather list,
+ * same rules and usage.
+ */
+extern inline void pci_dma_sync_sg(struct pci_dev *hwdev,
+ struct scatterlist *sg,
+ int nelems)
+{
+ /* Make sure that gcc doesn't leave the empty loop body. */
+#ifndef CONFIG_COHERENT_IO
+ int i;
+
+ for (i = 0; i < nelems; i++, sg++)
+ dma_cache_wback_inv((unsigned long)sg->address, sg->length);
+#endif
+}
+
+/*
+ * These macros should be used after a pci_map_sg call has been done
+ * to get bus addresses of each of the SG entries and their lengths.
+ * You should only work with the number of sg entries pci_map_sg
+ * returns, or alternatively stop on the first sg_dma_len(sg) which
+ * is 0.
+ */
+#define sg_dma_address(sg) (virt_to_bus((sg)->address))
+#define sg_dma_len(sg) ((sg)->length)
+
+#endif /* __KERNEL__ */
+
#endif /* _ASM_PCI_H */
diff --git a/include/asm-mips64/semaphore.h b/include/asm-mips64/semaphore.h
index 52f5eb11d..626d2d2fd 100644
--- a/include/asm-mips64/semaphore.h
+++ b/include/asm-mips64/semaphore.h
@@ -1,11 +1,11 @@
-/* $Id: semaphore.h,v 1.3 1999/12/04 03:59:12 ralf Exp $
+/* $Id: semaphore.h,v 1.4 1999/12/09 11:01:42 ralf Exp $
*
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1996 Linus Torvalds
- * Copyright (C) 1998, 1999 Ralf Baechle
- * Copyright (C) 1999 Silicon Graphics, Inc.
+ * Copyright (C) 1998, 1999, 2000 Ralf Baechle
+ * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
*/
#ifndef _ASM_SEMAPHORE_H
#define _ASM_SEMAPHORE_H
@@ -170,4 +170,177 @@ extern inline void up(struct semaphore * sem)
__up(sem);
}
+/*
+ * rw mutexes (should that be mutices? =) -- throw rw spinlocks and
+ * semaphores together, and this is what we end up with...
+ *
+ * The lock is initialized to BIAS. This way, a writer subtracts BIAS ands
+ * gets 0 for the case of an uncontended lock. Readers decrement by 1 and
+ * see a positive value when uncontended, negative if there are writers
+ * waiting (in which case it goes to sleep).
+ *
+ * The value 0x01000000 supports up to 128 processors and lots of processes.
+ * BIAS must be chosen such that subtracting BIAS once per CPU will result
+ * in the int remaining negative. In terms of fairness, this should result
+ * in the lock flopping back and forth between readers and writers under
+ * heavy use.
+ *
+ * Once we start supporting machines with more than 128 CPUs, we should go
+ * for using a 64bit atomic type instead of 32bit as counter. We shall
+ * probably go for bias 0x80000000 then, so that single sethi can set it.
+ * */
+
+#define RW_LOCK_BIAS 0x01000000
+
+struct rw_semaphore {
+ atomic_t count;
+ /* bit 0 means read bias granted;
+ bit 1 means write bias granted. */
+ unsigned granted;
+ wait_queue_head_t wait;
+ wait_queue_head_t write_bias_wait;
+#if WAITQUEUE_DEBUG
+ long __magic;
+ atomic_t readers;
+ atomic_t writers;
+#endif
+};
+
+#if WAITQUEUE_DEBUG
+#define __RWSEM_DEBUG_INIT , ATOMIC_INIT(0), ATOMIC_INIT(0)
+#else
+#define __RWSEM_DEBUG_INIT /* */
+#endif
+
+#define __RWSEM_INITIALIZER(name,count) \
+ { (count), 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), \
+ __WAIT_QUEUE_HEAD_INITIALIZER((name).write_bias_wait) \
+ __SEM_DEBUG_INIT(name) __RWSEM_DEBUG_INIT }
+
+#define __DECLARE_RWSEM_GENERIC(name,count) \
+ struct rw_semaphore name = __RWSEM_INITIALIZER(name,count)
+
+#define DECLARE_RWSEM(name) \
+ __DECLARE_RWSEM_GENERIC(name, RW_LOCK_BIAS)
+#define DECLARE_RWSEM_READ_LOCKED(name) \
+ __DECLARE_RWSEM_GENERIC(name, RW_LOCK_BIAS-1)
+#define DECLARE_RWSEM_WRITE_LOCKED(name) \
+ __DECLARE_RWSEM_GENERIC(name, 0)
+
+extern inline void init_rwsem(struct rw_semaphore *sem)
+{
+ atomic_set(&sem->count, RW_LOCK_BIAS);
+ sem->granted = 0;
+ init_waitqueue_head(&sem->wait);
+ init_waitqueue_head(&sem->write_bias_wait);
+#if WAITQUEUE_DEBUG
+ sem->__magic = (long)&sem->__magic;
+ atomic_set(&sem->readers, 0);
+ atomic_set(&sem->writers, 0);
+#endif
+}
+
+/* The expensive part is outlined. */
+extern void __down_read(struct rw_semaphore *sem, int count);
+extern void __down_write(struct rw_semaphore *sem, int count);
+extern void __rwsem_wake(struct rw_semaphore *sem, unsigned long readers);
+
+extern inline void down_read(struct rw_semaphore *sem)
+{
+ int count;
+
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
+ count = atomic_dec_return(&sem->count);
+ if (count < 0) {
+ __down_read(sem, count);
+ }
+ mb();
+
+#if WAITQUEUE_DEBUG
+ if (sem->granted & 2)
+ BUG();
+ if (atomic_read(&sem->writers))
+ BUG();
+ atomic_inc(&sem->readers);
+#endif
+}
+
+extern inline void down_write(struct rw_semaphore *sem)
+{
+ int count;
+
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
+ count = atomic_sub_return(RW_LOCK_BIAS, &sem->count);
+ if (count) {
+ __down_write(sem, count);
+ }
+ mb();
+
+#if WAITQUEUE_DEBUG
+ if (atomic_read(&sem->writers))
+ BUG();
+ if (atomic_read(&sem->readers))
+ BUG();
+ if (sem->granted & 3)
+ BUG();
+ atomic_inc(&sem->writers);
+#endif
+}
+
+/* When a reader does a release, the only significant case is when
+ there was a writer waiting, and we've bumped the count to 0: we must
+ wake the writer up. */
+
+extern inline void up_read(struct rw_semaphore *sem)
+{
+ int count;
+
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+ if (sem->granted & 2)
+ BUG();
+ if (atomic_read(&sem->writers))
+ BUG();
+ atomic_dec(&sem->readers);
+#endif
+
+ mb();
+ count = atomic_inc_return(&sem->count);
+ if (count == 0) {
+ __rwsem_wake(sem, 0);
+ }
+}
+
+/*
+ * Releasing the writer is easy -- just release it and wake up any sleepers.
+ */
+extern inline void up_write(struct rw_semaphore *sem)
+{
+ int count;
+
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+ if (sem->granted & 3)
+ BUG();
+ if (atomic_read(&sem->readers))
+ BUG();
+ if (atomic_read(&sem->writers) != 1)
+ BUG();
+ atomic_dec(&sem->writers);
+#endif
+
+ mb();
+ count = atomic_add_return(RW_LOCK_BIAS, &sem->count);
+ if (count - RW_LOCK_BIAS < 0 && count >= 0) {
+ /* Only do the wake if we're no longer negative. */
+ __rwsem_wake(sem, count);
+ }
+}
+
#endif /* _ASM_SEMAPHORE_H */
diff --git a/include/asm-mips64/siginfo.h b/include/asm-mips64/siginfo.h
index cdd8e5ff4..f20703273 100644
--- a/include/asm-mips64/siginfo.h
+++ b/include/asm-mips64/siginfo.h
@@ -1,4 +1,4 @@
-/* $Id: siginfo.h,v 1.1 1999/08/18 23:37:52 ralf Exp $
+/* $Id: siginfo.h,v 1.2 2000/01/27 01:05:37 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -169,7 +169,7 @@ typedef struct siginfo {
#define CLD_TRAPPED 4 /* traced child has trapped */
#define CLD_STOPPED 5 /* child has stopped */
#define CLD_CONTINUED 6 /* stopped child has continued */
-#define NSIGCLD 6
+#define NSIGCHLD 6
/*
* SIGPOLL si_codes
diff --git a/include/asm-mips64/termios.h b/include/asm-mips64/termios.h
index 05eb9c253..930a6dcb1 100644
--- a/include/asm-mips64/termios.h
+++ b/include/asm-mips64/termios.h
@@ -1,4 +1,4 @@
-/* $Id: termios.h,v 1.1 1999/08/18 23:37:53 ralf Exp $
+/* $Id: termios.h,v 1.2 2000/01/27 23:45:30 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -83,6 +83,7 @@ struct termio {
#define TIOCM_DSR 0x400 /* data set ready */
#define TIOCM_OUT1 0x2000
#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
/* line disciplines */
#define N_TTY 0
diff --git a/include/asm-mips64/types.h b/include/asm-mips64/types.h
index cc07bde05..989e79622 100644
--- a/include/asm-mips64/types.h
+++ b/include/asm-mips64/types.h
@@ -1,4 +1,4 @@
-/* $Id: types.h,v 1.1 1999/08/18 23:37:53 ralf Exp $
+/* $Id: types.h,v 1.2 1999/12/04 03:59:12 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -70,6 +70,8 @@ typedef unsigned long long u64;
#define BITS_PER_LONG _MIPS_SZLONG
+typedef unsigned long dma_addr_t;
+
#endif /* __KERNEL__ */
#endif /* _ASM_TYPES_H */
diff --git a/include/asm-mips64/unistd.h b/include/asm-mips64/unistd.h
index 5ab08b0bc..0308f3bf3 100644
--- a/include/asm-mips64/unistd.h
+++ b/include/asm-mips64/unistd.h
@@ -1,4 +1,4 @@
-/* $Id: unistd.h,v 1.8 2000/02/04 07:40:53 ralf Exp $
+/* $Id: unistd.h,v 1.9 2000/02/05 06:47:37 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -1195,17 +1195,18 @@
#define __NR_Linux32_sendfile (__NR_Linux32 + 207)
#define __NR_Linux32_getpmsg (__NR_Linux32 + 208)
#define __NR_Linux32_putpmsg (__NR_Linux32 + 209)
-#define __NR_mmap2 (__NR_Linux32 + 210)
-#define __NR_truncate64 (__NR_Linux32 + 211)
-#define __NR_ftruncate64 (__NR_Linux32 + 212)
-#define __NR_stat64 (__NR_Linux32 + 213)
-#define __NR_lstat64 (__NR_Linux32 + 214)
-#define __NR_fstat64 (__NR_Linux32 + 215)
+#define __NR_Linux32_mmap2 (__NR_Linux32 + 210)
+#define __NR_Linux32_truncate64 (__NR_Linux32 + 211)
+#define __NR_Linux32_ftruncate64 (__NR_Linux32 + 212)
+#define __NR_Linux32_stat64 (__NR_Linux32 + 213)
+#define __NR_Linux32_lstat64 (__NR_Linux32 + 214)
+#define __NR_Linux32_fstat64 (__NR_Linux32 + 215)
+#define __NR_Linux32_root_pivot (__NR_Linux32 + 216)
/*
* Offset of the last Linux o32 flavoured syscall
*/
-#define __NR_Linux32_syscalls 215
+#define __NR_Linux32_syscalls 216
/*
* Linux 64-bit syscalls are in the range from 5000 to 5999.
@@ -1421,11 +1422,12 @@
#define __NR_sendfile (__NR_Linux + 207)
#define __NR_getpmsg (__NR_Linux + 208)
#define __NR_putpmsg (__NR_Linux + 209)
+#define __NR_root_pivot (__NR_Linux + 210)
/*
* Offset of the last Linux flavoured syscall
*/
-#define __NR_Linux_syscalls 209
+#define __NR_Linux_syscalls 210
#ifndef _LANGUAGE_ASSEMBLY
diff --git a/include/asm-ppc/siginfo.h b/include/asm-ppc/siginfo.h
index f838fcc82..58e4b22e9 100644
--- a/include/asm-ppc/siginfo.h
+++ b/include/asm-ppc/siginfo.h
@@ -149,7 +149,7 @@ typedef struct siginfo {
#define CLD_TRAPPED 4 /* traced child has trapped */
#define CLD_STOPPED 5 /* child has stopped */
#define CLD_CONTINUED 6 /* stopped child has continued */
-#define NSIGCHLD
+#define NSIGCHLD 6
/*
* SIGPOLL si_codes
diff --git a/include/asm-ppc/termios.h b/include/asm-ppc/termios.h
index e74609c13..2a9b8b025 100644
--- a/include/asm-ppc/termios.h
+++ b/include/asm-ppc/termios.h
@@ -166,6 +166,9 @@ struct termio {
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
diff --git a/include/asm-sparc/asm_offsets.h b/include/asm-sparc/asm_offsets.h
index 58f26364c..15f2d5093 100644
--- a/include/asm-sparc/asm_offsets.h
+++ b/include/asm-sparc/asm_offsets.h
@@ -159,32 +159,32 @@
#define AOFF_task_semsleeping 0x00000238
#define ASIZ_task_semsleeping 0x00000004
#define AOFF_task_thread 0x00000240
-#define ASIZ_task_thread 0x00000388
-#define AOFF_task_fs 0x000005c8
+#define ASIZ_task_thread 0x00000380
+#define AOFF_task_fs 0x000005c0
#define ASIZ_task_fs 0x00000004
-#define AOFF_task_files 0x000005cc
+#define AOFF_task_files 0x000005c4
#define ASIZ_task_files 0x00000004
-#define AOFF_task_sigmask_lock 0x000005d0
+#define AOFF_task_sigmask_lock 0x000005c8
#define ASIZ_task_sigmask_lock 0x00000000
-#define AOFF_task_sig 0x000005d0
+#define AOFF_task_sig 0x000005c8
#define ASIZ_task_sig 0x00000004
-#define AOFF_task_signal 0x000005d4
+#define AOFF_task_signal 0x000005cc
#define ASIZ_task_signal 0x00000008
-#define AOFF_task_blocked 0x000005dc
+#define AOFF_task_blocked 0x000005d4
#define ASIZ_task_blocked 0x00000008
-#define AOFF_task_sigqueue 0x000005e4
+#define AOFF_task_sigqueue 0x000005dc
#define ASIZ_task_sigqueue 0x00000004
-#define AOFF_task_sigqueue_tail 0x000005e8
+#define AOFF_task_sigqueue_tail 0x000005e0
#define ASIZ_task_sigqueue_tail 0x00000004
-#define AOFF_task_sas_ss_sp 0x000005ec
+#define AOFF_task_sas_ss_sp 0x000005e4
#define ASIZ_task_sas_ss_sp 0x00000004
-#define AOFF_task_sas_ss_size 0x000005f0
+#define AOFF_task_sas_ss_size 0x000005e8
#define ASIZ_task_sas_ss_size 0x00000004
-#define AOFF_task_parent_exec_id 0x000005f4
+#define AOFF_task_parent_exec_id 0x000005ec
#define ASIZ_task_parent_exec_id 0x00000004
-#define AOFF_task_self_exec_id 0x000005f8
+#define AOFF_task_self_exec_id 0x000005f0
#define ASIZ_task_self_exec_id 0x00000004
-#define AOFF_task_exit_sem 0x000005fc
+#define AOFF_task_exit_sem 0x000005f4
#define ASIZ_task_exit_sem 0x0000001c
#define AOFF_mm_mmap 0x00000000
#define ASIZ_mm_mmap 0x00000004
@@ -248,45 +248,41 @@
#define ASIZ_thread_uwinmask 0x00000004
#define AOFF_thread_kregs 0x00000004
#define ASIZ_thread_kregs 0x00000004
-#define AOFF_thread_sig_address 0x00000008
-#define ASIZ_thread_sig_address 0x00000004
-#define AOFF_thread_sig_desc 0x0000000c
-#define ASIZ_thread_sig_desc 0x00000004
-#define AOFF_thread_ksp 0x00000010
+#define AOFF_thread_ksp 0x00000008
#define ASIZ_thread_ksp 0x00000004
-#define AOFF_thread_kpc 0x00000014
+#define AOFF_thread_kpc 0x0000000c
#define ASIZ_thread_kpc 0x00000004
-#define AOFF_thread_kpsr 0x00000018
+#define AOFF_thread_kpsr 0x00000010
#define ASIZ_thread_kpsr 0x00000004
-#define AOFF_thread_kwim 0x0000001c
+#define AOFF_thread_kwim 0x00000014
#define ASIZ_thread_kwim 0x00000004
-#define AOFF_thread_fork_kpsr 0x00000020
+#define AOFF_thread_fork_kpsr 0x00000018
#define ASIZ_thread_fork_kpsr 0x00000004
-#define AOFF_thread_fork_kwim 0x00000024
+#define AOFF_thread_fork_kwim 0x0000001c
#define ASIZ_thread_fork_kwim 0x00000004
-#define AOFF_thread_reg_window 0x00000028
+#define AOFF_thread_reg_window 0x00000020
#define ASIZ_thread_reg_window 0x00000200
-#define AOFF_thread_rwbuf_stkptrs 0x00000228
+#define AOFF_thread_rwbuf_stkptrs 0x00000220
#define ASIZ_thread_rwbuf_stkptrs 0x00000020
-#define AOFF_thread_w_saved 0x00000248
+#define AOFF_thread_w_saved 0x00000240
#define ASIZ_thread_w_saved 0x00000004
-#define AOFF_thread_float_regs 0x00000250
+#define AOFF_thread_float_regs 0x00000248
#define ASIZ_thread_float_regs 0x00000080
-#define AOFF_thread_fsr 0x000002d0
+#define AOFF_thread_fsr 0x000002c8
#define ASIZ_thread_fsr 0x00000004
-#define AOFF_thread_fpqdepth 0x000002d4
+#define AOFF_thread_fpqdepth 0x000002cc
#define ASIZ_thread_fpqdepth 0x00000004
-#define AOFF_thread_fpqueue 0x000002d8
+#define AOFF_thread_fpqueue 0x000002d0
#define ASIZ_thread_fpqueue 0x00000080
-#define AOFF_thread_flags 0x00000358
+#define AOFF_thread_flags 0x00000350
#define ASIZ_thread_flags 0x00000004
-#define AOFF_thread_current_ds 0x0000035c
+#define AOFF_thread_current_ds 0x00000354
#define ASIZ_thread_current_ds 0x00000004
-#define AOFF_thread_core_exec 0x00000360
+#define AOFF_thread_core_exec 0x00000358
#define ASIZ_thread_core_exec 0x00000020
-#define AOFF_thread_new_signal 0x00000380
+#define AOFF_thread_new_signal 0x00000378
#define ASIZ_thread_new_signal 0x00000004
-#define AOFF_thread_refcount 0x00000384
+#define AOFF_thread_refcount 0x0000037c
#define ASIZ_thread_refcount 0x00000004
#else /* CONFIG_SMP */
@@ -444,32 +440,32 @@
#define AOFF_task_semsleeping 0x00000338
#define ASIZ_task_semsleeping 0x00000004
#define AOFF_task_thread 0x00000340
-#define ASIZ_task_thread 0x00000388
-#define AOFF_task_fs 0x000006c8
+#define ASIZ_task_thread 0x00000380
+#define AOFF_task_fs 0x000006c0
#define ASIZ_task_fs 0x00000004
-#define AOFF_task_files 0x000006cc
+#define AOFF_task_files 0x000006c4
#define ASIZ_task_files 0x00000004
-#define AOFF_task_sigmask_lock 0x000006d0
+#define AOFF_task_sigmask_lock 0x000006c8
#define ASIZ_task_sigmask_lock 0x00000008
-#define AOFF_task_sig 0x000006d8
+#define AOFF_task_sig 0x000006d0
#define ASIZ_task_sig 0x00000004
-#define AOFF_task_signal 0x000006dc
+#define AOFF_task_signal 0x000006d4
#define ASIZ_task_signal 0x00000008
-#define AOFF_task_blocked 0x000006e4
+#define AOFF_task_blocked 0x000006dc
#define ASIZ_task_blocked 0x00000008
-#define AOFF_task_sigqueue 0x000006ec
+#define AOFF_task_sigqueue 0x000006e4
#define ASIZ_task_sigqueue 0x00000004
-#define AOFF_task_sigqueue_tail 0x000006f0
+#define AOFF_task_sigqueue_tail 0x000006e8
#define ASIZ_task_sigqueue_tail 0x00000004
-#define AOFF_task_sas_ss_sp 0x000006f4
+#define AOFF_task_sas_ss_sp 0x000006ec
#define ASIZ_task_sas_ss_sp 0x00000004
-#define AOFF_task_sas_ss_size 0x000006f8
+#define AOFF_task_sas_ss_size 0x000006f0
#define ASIZ_task_sas_ss_size 0x00000004
-#define AOFF_task_parent_exec_id 0x000006fc
+#define AOFF_task_parent_exec_id 0x000006f4
#define ASIZ_task_parent_exec_id 0x00000004
-#define AOFF_task_self_exec_id 0x00000700
+#define AOFF_task_self_exec_id 0x000006f8
#define ASIZ_task_self_exec_id 0x00000004
-#define AOFF_task_exit_sem 0x00000704
+#define AOFF_task_exit_sem 0x000006fc
#define ASIZ_task_exit_sem 0x00000024
#define AOFF_mm_mmap 0x00000000
#define ASIZ_mm_mmap 0x00000004
@@ -533,45 +529,41 @@
#define ASIZ_thread_uwinmask 0x00000004
#define AOFF_thread_kregs 0x00000004
#define ASIZ_thread_kregs 0x00000004
-#define AOFF_thread_sig_address 0x00000008
-#define ASIZ_thread_sig_address 0x00000004
-#define AOFF_thread_sig_desc 0x0000000c
-#define ASIZ_thread_sig_desc 0x00000004
-#define AOFF_thread_ksp 0x00000010
+#define AOFF_thread_ksp 0x00000008
#define ASIZ_thread_ksp 0x00000004
-#define AOFF_thread_kpc 0x00000014
+#define AOFF_thread_kpc 0x0000000c
#define ASIZ_thread_kpc 0x00000004
-#define AOFF_thread_kpsr 0x00000018
+#define AOFF_thread_kpsr 0x00000010
#define ASIZ_thread_kpsr 0x00000004
-#define AOFF_thread_kwim 0x0000001c
+#define AOFF_thread_kwim 0x00000014
#define ASIZ_thread_kwim 0x00000004
-#define AOFF_thread_fork_kpsr 0x00000020
+#define AOFF_thread_fork_kpsr 0x00000018
#define ASIZ_thread_fork_kpsr 0x00000004
-#define AOFF_thread_fork_kwim 0x00000024
+#define AOFF_thread_fork_kwim 0x0000001c
#define ASIZ_thread_fork_kwim 0x00000004
-#define AOFF_thread_reg_window 0x00000028
+#define AOFF_thread_reg_window 0x00000020
#define ASIZ_thread_reg_window 0x00000200
-#define AOFF_thread_rwbuf_stkptrs 0x00000228
+#define AOFF_thread_rwbuf_stkptrs 0x00000220
#define ASIZ_thread_rwbuf_stkptrs 0x00000020
-#define AOFF_thread_w_saved 0x00000248
+#define AOFF_thread_w_saved 0x00000240
#define ASIZ_thread_w_saved 0x00000004
-#define AOFF_thread_float_regs 0x00000250
+#define AOFF_thread_float_regs 0x00000248
#define ASIZ_thread_float_regs 0x00000080
-#define AOFF_thread_fsr 0x000002d0
+#define AOFF_thread_fsr 0x000002c8
#define ASIZ_thread_fsr 0x00000004
-#define AOFF_thread_fpqdepth 0x000002d4
+#define AOFF_thread_fpqdepth 0x000002cc
#define ASIZ_thread_fpqdepth 0x00000004
-#define AOFF_thread_fpqueue 0x000002d8
+#define AOFF_thread_fpqueue 0x000002d0
#define ASIZ_thread_fpqueue 0x00000080
-#define AOFF_thread_flags 0x00000358
+#define AOFF_thread_flags 0x00000350
#define ASIZ_thread_flags 0x00000004
-#define AOFF_thread_current_ds 0x0000035c
+#define AOFF_thread_current_ds 0x00000354
#define ASIZ_thread_current_ds 0x00000004
-#define AOFF_thread_core_exec 0x00000360
+#define AOFF_thread_core_exec 0x00000358
#define ASIZ_thread_core_exec 0x00000020
-#define AOFF_thread_new_signal 0x00000380
+#define AOFF_thread_new_signal 0x00000378
#define ASIZ_thread_new_signal 0x00000004
-#define AOFF_thread_refcount 0x00000384
+#define AOFF_thread_refcount 0x0000037c
#define ASIZ_thread_refcount 0x00000004
#endif /* CONFIG_SMP */
diff --git a/include/asm-sparc/hdreg.h b/include/asm-sparc/hdreg.h
new file mode 100644
index 000000000..1c321c3e7
--- /dev/null
+++ b/include/asm-sparc/hdreg.h
@@ -0,0 +1,13 @@
+/* $Id: hdreg.h,v 1.1 2000/01/21 04:56:27 zaitcev Exp $
+ * hdreg.h: SPARC PCI specific IDE glue.
+ *
+ * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
+ */
+
+#ifndef __SPARC_HDREG_H
+#define __SPARC_HDREG_H
+
+typedef unsigned int ide_ioreg_t;
+
+#endif /* __SPARC_HDREG_H */
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h
new file mode 100644
index 000000000..bec4233e6
--- /dev/null
+++ b/include/asm-sparc/ide.h
@@ -0,0 +1,289 @@
+/* $Id: ide.h,v 1.2 2000/01/21 04:56:27 zaitcev Exp $
+ * ide.h: SPARC PCI specific IDE glue.
+ *
+ * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
+ * Adaptation from sparc64 version to sparc by Pete Zaitcev.
+ */
+
+#ifndef _SPARC_IDE_H
+#define _SPARC_IDE_H
+
+#ifdef __KERNEL__
+
+#include <asm/pgtable.h>
+#include <asm/io.h>
+#include <asm/hdreg.h>
+#include <asm/psr.h>
+
+#undef MAX_HWIFS
+#define MAX_HWIFS 2
+
+#define ide__sti() __sti()
+
+static __inline__ int ide_default_irq(ide_ioreg_t base)
+{
+ return 0;
+}
+
+static __inline__ ide_ioreg_t ide_default_io_base(int index)
+{
+ return 0;
+}
+
+/*
+ * Doing any sort of ioremap() here does not work
+ * because this function may be called with null aguments.
+ */
+static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
+{
+ ide_ioreg_t reg = data_port;
+ int i;
+
+ for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
+ hw->io_ports[i] = reg;
+ reg += 1;
+ }
+ if (ctrl_port) {
+ hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
+ } else {
+ hw->io_ports[IDE_CONTROL_OFFSET] = 0;
+ }
+ if (irq != NULL)
+ *irq = 0;
+}
+
+/*
+ * This registers the standard ports for this architecture with the IDE
+ * driver.
+ */
+static __inline__ void ide_init_default_hwifs(void)
+{
+#ifdef __DO_I_NEED_THIS
+ hw_regs_t hw;
+ int index;
+
+ for (index = 0; index < MAX_HWIFS; index++) {
+ ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, 0);
+ hw.irq = ide_default_irq(ide_default_io_base(index));
+ ide_register_hw(&hw, NULL);
+ }
+#endif /* __DO_I_NEED_THIS */
+}
+
+typedef union {
+ unsigned int all : 8; /* all of the bits together */
+ struct {
+ unsigned int bit7 : 1;
+ unsigned int lba : 1;
+ unsigned int bit5 : 1;
+ unsigned int unit : 1;
+ unsigned int head : 4;
+ } b;
+} select_t;
+
+static __inline__ int ide_request_irq(unsigned int irq,
+ void (*handler)(int, void *, struct pt_regs *),
+ unsigned long flags, const char *name, void *devid)
+{
+ return request_irq(irq, handler, SA_SHIRQ, name, devid);
+}
+
+static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
+{
+ free_irq(irq, dev_id);
+}
+
+static __inline__ int ide_check_region(ide_ioreg_t base, unsigned int size)
+{
+ /* We leave these empty because pcic.c calls sparc_alloc_io() */
+ return 0;
+}
+
+static __inline__ void ide_request_region(ide_ioreg_t base, unsigned int size,
+ const char *name)
+{
+}
+
+static __inline__ void ide_release_region(ide_ioreg_t base, unsigned int size)
+{
+}
+
+#undef SUPPORT_SLOW_DATA_PORTS
+#define SUPPORT_SLOW_DATA_PORTS 0
+
+#undef SUPPORT_VLB_SYNC
+#define SUPPORT_VLB_SYNC 0
+
+#undef HD_DATA
+#define HD_DATA ((ide_ioreg_t)0)
+
+/* From m68k code... */
+
+#ifdef insl
+#undef insl
+#endif
+#ifdef outsl
+#undef outsl
+#endif
+#ifdef insw
+#undef insw
+#endif
+#ifdef outsw
+#undef outsw
+#endif
+
+#define insl(data_reg, buffer, wcount) insw(data_reg, buffer, (wcount)<<1)
+#define outsl(data_reg, buffer, wcount) outsw(data_reg, buffer, (wcount)<<1)
+
+#define insw(port, buf, nr) ide_insw((port), (buf), (nr))
+#define outsw(port, buf, nr) ide_outsw((port), (buf), (nr))
+
+static __inline__ void ide_insw(unsigned long port,
+ void *dst,
+ unsigned long count)
+{
+ volatile unsigned short *data_port;
+ /* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */
+ u16 *ps = dst;
+ u32 *pi;
+
+ data_port = (volatile unsigned short *)port;
+
+ if(((unsigned long)ps) & 0x2) {
+ *ps++ = *data_port;
+ count--;
+ }
+ pi = (u32 *)ps;
+ while(count >= 2) {
+ u32 w;
+
+ w = (*data_port) << 16;
+ w |= (*data_port);
+ *pi++ = w;
+ count -= 2;
+ }
+ ps = (u16 *)pi;
+ if(count)
+ *ps++ = *data_port;
+
+ /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */
+}
+
+static __inline__ void ide_outsw(unsigned long port,
+ const void *src,
+ unsigned long count)
+{
+ volatile unsigned short *data_port;
+ /* unsigned long end = (unsigned long)src + (count << 1); */
+ const u16 *ps = src;
+ const u32 *pi;
+
+ data_port = (volatile unsigned short *)port;
+
+ if(((unsigned long)src) & 0x2) {
+ *data_port = *ps++;
+ count--;
+ }
+ pi = (const u32 *)ps;
+ while(count >= 2) {
+ u32 w;
+
+ w = *pi++;
+ *data_port = (w >> 16);
+ *data_port = w;
+ count -= 2;
+ }
+ ps = (const u16 *)pi;
+ if(count)
+ *data_port = *ps;
+
+ /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */
+}
+
+#define T_CHAR (0x0000) /* char: don't touch */
+#define T_SHORT (0x4000) /* short: 12 -> 21 */
+#define T_INT (0x8000) /* int: 1234 -> 4321 */
+#define T_TEXT (0xc000) /* text: 12 -> 21 */
+
+#define T_MASK_TYPE (0xc000)
+#define T_MASK_COUNT (0x3fff)
+
+#define D_CHAR(cnt) (T_CHAR | (cnt))
+#define D_SHORT(cnt) (T_SHORT | (cnt))
+#define D_INT(cnt) (T_INT | (cnt))
+#define D_TEXT(cnt) (T_TEXT | (cnt))
+
+static u_short driveid_types[] = {
+ D_SHORT(10), /* config - vendor2 */
+ D_TEXT(20), /* serial_no */
+ D_SHORT(3), /* buf_type - ecc_bytes */
+ D_TEXT(48), /* fw_rev - model */
+ D_CHAR(2), /* max_multsect - vendor3 */
+ D_SHORT(1), /* dword_io */
+ D_CHAR(2), /* vendor4 - capability */
+ D_SHORT(1), /* reserved50 */
+ D_CHAR(4), /* vendor5 - tDMA */
+ D_SHORT(4), /* field_valid - cur_sectors */
+ D_INT(1), /* cur_capacity */
+ D_CHAR(2), /* multsect - multsect_valid */
+ D_INT(1), /* lba_capacity */
+ D_SHORT(194) /* dma_1word - reservedyy */
+};
+
+#define num_driveid_types (sizeof(driveid_types)/sizeof(*driveid_types))
+
+static __inline__ void ide_fix_driveid(struct hd_driveid *id)
+{
+ u_char *p = (u_char *)id;
+ int i, j, cnt;
+ u_char t;
+
+ for (i = 0; i < num_driveid_types; i++) {
+ cnt = driveid_types[i] & T_MASK_COUNT;
+ switch (driveid_types[i] & T_MASK_TYPE) {
+ case T_CHAR:
+ p += cnt;
+ break;
+ case T_SHORT:
+ for (j = 0; j < cnt; j++) {
+ t = p[0];
+ p[0] = p[1];
+ p[1] = t;
+ p += 2;
+ }
+ break;
+ case T_INT:
+ for (j = 0; j < cnt; j++) {
+ t = p[0];
+ p[0] = p[3];
+ p[3] = t;
+ t = p[1];
+ p[1] = p[2];
+ p[2] = t;
+ p += 4;
+ }
+ break;
+ case T_TEXT:
+ for (j = 0; j < cnt; j += 2) {
+ t = p[0];
+ p[0] = p[1];
+ p[1] = t;
+ p += 2;
+ }
+ break;
+ };
+ }
+}
+
+/*
+ * The following are not needed for the non-m68k ports
+ */
+#define ide_ack_intr(hwif) (1)
+/* #define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) */
+#define ide_release_lock(lock) do {} while (0)
+#define ide_get_lock(lock, hdlr, data) do {} while (0)
+
+#endif /* __KERNEL__ */
+
+#endif /* _SPARC_IDE_H */
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
index 80fa5caa6..71610a59f 100644
--- a/include/asm-sparc/io.h
+++ b/include/asm-sparc/io.h
@@ -1,5 +1,5 @@
/*
- * $Id: io.h,v 1.24 1999/12/20 04:58:40 davem Exp $
+ * $Id: io.h,v 1.25 2000/01/22 07:35:46 zaitcev Exp $
*/
#ifndef __SPARC_IO_H
#define __SPARC_IO_H
@@ -12,7 +12,7 @@
#include <asm/system.h>
#define virt_to_bus virt_to_phys
-
+#define bus_to_virt phys_to_virt
extern __inline__ unsigned flip_dword (unsigned d) {
return ((d&0xff)<<24) | (((d>>8)&0xff)<<16) | (((d>>16)&0xff)<<8)| ((d>>24)&0xff);
@@ -78,6 +78,13 @@ extern __inline__ void writel(unsigned int b, unsigned long addr) {
#define outl(b, addr) writel(b, addr)
#define outb_p(b, addr) writeb(b, addr)
+extern void outsb(unsigned long addr, const void *src, unsigned long cnt);
+extern void outsw(unsigned long addr, const void *src, unsigned long cnt);
+extern void outsl(unsigned long addr, const void *src, unsigned long cnt);
+extern void insb(unsigned long addr, void *dst, unsigned long count);
+extern void insw(unsigned long addr, void *dst, unsigned long count);
+extern void insl(unsigned long addr, void *dst, unsigned long count);
+
#define IO_SPACE_LIMIT 0xffffffff
/*
diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h
index 05c3374fa..b7ea70091 100644
--- a/include/asm-sparc/irq.h
+++ b/include/asm-sparc/irq.h
@@ -1,4 +1,4 @@
-/* $Id: irq.h,v 1.27 1999/08/14 03:52:02 anton Exp $
+/* $Id: irq.h,v 1.28 2000/01/22 06:06:58 zaitcev Exp $
* irq.h: IRQ registers on the Sparc.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -49,6 +49,7 @@ BTFIXUPDEF_CALL(void, clear_clock_irq, void)
BTFIXUPDEF_CALL(void, clear_profile_irq, int)
BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int)
+#define disable_irq_nosync disable_irq
#define disable_irq(irq) BTFIXUP_CALL(disable_irq)(irq)
#define enable_irq(irq) BTFIXUP_CALL(enable_irq)(irq)
#define disable_pil_irq(irq) BTFIXUP_CALL(disable_pil_irq)(irq)
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
index 17c8ce462..f30a5bcc2 100644
--- a/include/asm-sparc/pci.h
+++ b/include/asm-sparc/pci.h
@@ -7,4 +7,7 @@
*/
#define pcibios_assign_all_busses() 0
+#define PCIBIOS_MIN_IO 0UL
+#define PCIBIOS_MIN_MEM 0UL
+
#endif /* __SPARC_PCI_H */
diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h
index a74493500..278c15c80 100644
--- a/include/asm-sparc/processor.h
+++ b/include/asm-sparc/processor.h
@@ -1,4 +1,4 @@
-/* $Id: processor.h,v 1.76 2000/01/09 09:13:38 anton Exp $
+/* $Id: processor.h,v 1.77 2000/01/21 11:39:17 jj Exp $
* include/asm-sparc/processor.h
*
* Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
@@ -58,10 +58,6 @@ struct thread_struct {
unsigned long uwinmask __attribute__ ((aligned (8)));
struct pt_regs *kregs;
- /* For signal handling */
- unsigned long sig_address __attribute__ ((aligned (8)));
- unsigned long sig_desc;
-
/* Context switch saved kernel state. */
unsigned long ksp __attribute__ ((aligned (8)));
unsigned long kpc;
@@ -99,8 +95,8 @@ struct thread_struct {
NULL, __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
#define INIT_THREAD { \
-/* uwinmask, kregs, sig_address, sig_desc, ksp, kpc, kpsr, kwim */ \
- 0, 0, 0, 0, 0, 0, 0, 0, \
+/* uwinmask, kregs, ksp, kpc, kpsr, kwim */ \
+ 0, 0, 0, 0, 0, 0, \
/* fork_kpsr, fork_kwim */ \
0, 0, \
/* reg_window */ \
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h
index ecfc3037f..c96b5660e 100644
--- a/include/asm-sparc/sbus.h
+++ b/include/asm-sparc/sbus.h
@@ -101,9 +101,9 @@ sbus_is_slave(struct sbus_dev *dev)
#define sbus_can_burst64(sdev) (1)
extern void sbus_set_sbus64(struct sbus_dev *, int);
-/* These yield IOMMU mappings in consistant mode. */
-extern void *sbus_alloc_consistant(struct sbus_dev *, long, u32 *dma_addrp);
-extern void sbus_free_consistant(struct sbus_dev *, long, void *, u32);
+/* These yield IOMMU mappings in consistent mode. */
+extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp);
+extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32);
/* All the rest use streaming mode mappings. */
extern u32 sbus_map_single(struct sbus_dev *, void *, long);
diff --git a/include/asm-sparc/semaphore.h b/include/asm-sparc/semaphore.h
index 68c2dc359..ec2471223 100644
--- a/include/asm-sparc/semaphore.h
+++ b/include/asm-sparc/semaphore.h
@@ -250,11 +250,18 @@ struct rw_semaphore {
#define __RWSEM_DEBUG_INIT /* */
#endif
-#define __RWSEM_INITIALIZER(name) \
-{ RW_LOCK_BIAS, 0, 0xff, 0xff, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), \
+#define __RWSEM_INITIALIZER(name,count) \
+{ (count), 0, 0xff, 0xff, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), \
__WAIT_QUEUE_HEAD_INITIALIZER((name).write_bias_wait) \
__SEM_DEBUG_INIT(name) __RWSEM_DEBUG_INIT }
+#define __DECLARE_RWSEM_GENERIC(name,count) \
+ struct rw_semaphore name = __RWSEM_INITIALIZER(name,count)
+
+#define DECLARE_RWSEM(name) __DECLARE_RWSEM_GENERIC(name,RW_LOCK_BIAS)
+#define DECLARE_RWSEM_READ_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,RW_LOCK_BIAS-1)
+#define DECLARE_RWSEM_WRITE_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,0)
+
extern inline void init_rwsem(struct rw_semaphore *sem)
{
sem->count = RW_LOCK_BIAS;
diff --git a/include/asm-sparc/sembuf.h b/include/asm-sparc/sembuf.h
index 47b2ef9bc..a79c4bb3c 100644
--- a/include/asm-sparc/sembuf.h
+++ b/include/asm-sparc/sembuf.h
@@ -8,7 +8,7 @@
*
* Pad space is left for:
* - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 64-bit values
+ * - 2 miscellaneous 32-bit values
*/
struct semid64_ds {
diff --git a/include/asm-sparc/siginfo.h b/include/asm-sparc/siginfo.h
index 2baed407f..480126b38 100644
--- a/include/asm-sparc/siginfo.h
+++ b/include/asm-sparc/siginfo.h
@@ -1,4 +1,4 @@
-/* $Id: siginfo.h,v 1.5 1999/07/29 12:56:57 jj Exp $
+/* $Id: siginfo.h,v 1.6 2000/01/21 11:39:17 jj Exp $
* siginfo.c:
*/
@@ -81,6 +81,11 @@ typedef struct siginfo {
#define si_band _sifields._sigpoll._band
#define si_fd _sifields._sigpoll._fd
+#ifdef __KERNEL__
+#define __SI_MASK 0
+#define __SI_FAULT 0
+#endif
+
/*
* si_code values
* Digital reserves positive values for kernel-generated signals.
@@ -127,7 +132,7 @@ typedef struct siginfo {
* SIGSEGV si_codes
*/
#define SEGV_MAPERR 1 /* address not mapped to object */
-#define SRGV_ACCERR 2 /* invalid permissions for mapped object */
+#define SEGV_ACCERR 2 /* invalid permissions for mapped object */
#define NSIGSEGV 2
/*
@@ -154,7 +159,7 @@ typedef struct siginfo {
#define CLD_TRAPPED 4 /* traced child has trapped */
#define CLD_STOPPED 5 /* child has stopped */
#define CLD_CONTINUED 6 /* stopped child has continued */
-#define NSIGCHLD
+#define NSIGCHLD 6
/*
* SIGPOLL si_codes
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
index 7c69f57c2..ca4604fe7 100644
--- a/include/asm-sparc/smp.h
+++ b/include/asm-sparc/smp.h
@@ -92,7 +92,7 @@ extern __inline__ void xc5(smpfunc_t func, unsigned long arg1, unsigned long arg
unsigned long arg3, unsigned long arg4, unsigned long arg5)
{ smp_cross_call(func, arg1, arg2, arg3, arg4, arg5); }
-extern __volatile__ int cpu_number_map[NR_CPUS];
+extern __volatile__ int __cpu_number_map[NR_CPUS];
extern __volatile__ int __cpu_logical_map[NR_CPUS];
extern unsigned long smp_proc_in_lock[NR_CPUS];
@@ -100,6 +100,10 @@ extern __inline__ int cpu_logical_map(int cpu)
{
return __cpu_logical_map[cpu];
}
+extern __inline__ int cpu_number_map(int cpu)
+{
+ return __cpu_number_map[cpu];
+}
extern __inline__ int hard_smp4m_processor_id(void)
{
diff --git a/include/asm-sparc/stat.h b/include/asm-sparc/stat.h
index dd266dc5d..4b0dd7fa4 100644
--- a/include/asm-sparc/stat.h
+++ b/include/asm-sparc/stat.h
@@ -1,4 +1,4 @@
-/* $Id: stat.h,v 1.10 1999/12/21 14:09:41 jj Exp $ */
+/* $Id: stat.h,v 1.11 2000/01/16 15:22:53 jj Exp $ */
#ifndef _SPARC_STAT_H
#define _SPARC_STAT_H
@@ -19,23 +19,23 @@ struct __old_kernel_stat {
};
struct stat {
- dev_t st_dev;
- ino_t st_ino;
- mode_t st_mode;
- short st_nlink;
- uid_t st_uid;
- gid_t st_gid;
- dev_t st_rdev;
- off_t st_size;
- time_t st_atime;
- unsigned long __unused1;
- time_t st_mtime;
- unsigned long __unused2;
- time_t st_ctime;
- unsigned long __unused3;
- off_t st_blksize;
- off_t st_blocks;
- unsigned long __unused4[2];
+ unsigned short st_dev;
+ unsigned long st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ long st_size;
+ long st_atime;
+ unsigned long __unused1;
+ long st_mtime;
+ unsigned long __unused2;
+ long st_ctime;
+ unsigned long __unused3;
+ long st_blksize;
+ long st_blocks;
+ unsigned long __unused4[2];
};
struct stat64 {
diff --git a/include/asm-sparc/termbits.h b/include/asm-sparc/termbits.h
index c0c4959a2..2d07e4e1e 100644
--- a/include/asm-sparc/termbits.h
+++ b/include/asm-sparc/termbits.h
@@ -203,6 +203,9 @@ struct termios {
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index f16345145..c25741549 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -1,4 +1,4 @@
-/* $Id: unistd.h,v 1.63 2000/01/12 11:47:40 anton Exp $ */
+/* $Id: unistd.h,v 1.64 2000/01/16 06:20:32 davem Exp $ */
#ifndef _SPARC_UNISTD_H
#define _SPARC_UNISTD_H
diff --git a/include/asm-sparc64/asm_offsets.h b/include/asm-sparc64/asm_offsets.h
index 07dfc1d30..895583bb8 100644
--- a/include/asm-sparc64/asm_offsets.h
+++ b/include/asm-sparc64/asm_offsets.h
@@ -165,34 +165,34 @@
#define AOFF_task_semsleeping 0x00000378
#define ASIZ_task_semsleeping 0x00000008
#define AOFF_task_thread 0x00000380
-#define ASIZ_task_thread 0x00000460
-#define AOFF_task_fs 0x000007e0
+#define ASIZ_task_thread 0x00000450
+#define AOFF_task_fs 0x000007d0
#define ASIZ_task_fs 0x00000008
-#define AOFF_task_files 0x000007e8
+#define AOFF_task_files 0x000007d8
#define ASIZ_task_files 0x00000008
-#define AOFF_task_sigmask_lock 0x000007f0
+#define AOFF_task_sigmask_lock 0x000007e0
#define ASIZ_task_sigmask_lock 0x00000000
-#define AOFF_task_sig 0x000007f0
+#define AOFF_task_sig 0x000007e0
#define ASIZ_task_sig 0x00000008
-#define AOFF_task_signal 0x000007f8
+#define AOFF_task_signal 0x000007e8
#define ASIZ_task_signal 0x00000008
-#define AOFF_task_blocked 0x00000800
+#define AOFF_task_blocked 0x000007f0
#define ASIZ_task_blocked 0x00000008
-#define AOFF_task_sigqueue 0x00000808
+#define AOFF_task_sigqueue 0x000007f8
#define ASIZ_task_sigqueue 0x00000008
-#define AOFF_task_sigqueue_tail 0x00000810
+#define AOFF_task_sigqueue_tail 0x00000800
#define ASIZ_task_sigqueue_tail 0x00000008
-#define AOFF_task_sas_ss_sp 0x00000818
+#define AOFF_task_sas_ss_sp 0x00000808
#define ASIZ_task_sas_ss_sp 0x00000008
-#define AOFF_task_sas_ss_size 0x00000820
+#define AOFF_task_sas_ss_size 0x00000810
#define ASIZ_task_sas_ss_size 0x00000008
-#define AOFF_task_parent_exec_id 0x00000828
+#define AOFF_task_parent_exec_id 0x00000818
#define ASIZ_task_parent_exec_id 0x00000004
-#define AOFF_task_self_exec_id 0x0000082c
+#define AOFF_task_self_exec_id 0x0000081c
#define ASIZ_task_self_exec_id 0x00000004
-#define AOFF_task_exit_sem 0x00000830
+#define AOFF_task_exit_sem 0x00000820
#define ASIZ_task_exit_sem 0x00000030
-#define ASIZ_task 0x00000860
+#define ASIZ_task 0x00000850
#define AOFF_mm_mmap 0x00000000
#define ASIZ_mm_mmap 0x00000008
#define AOFF_mm_mmap_avl 0x00000008
@@ -278,29 +278,23 @@
#define ASIZ_thread_gsr 0x00000007
#define AOFF_thread___pad2 0x0000002f
#define ASIZ_thread___pad2 0x00000001
-#define AOFF_thread_sig_address 0x00000030
-#define ASIZ_thread_sig_address 0x00000008
-#define AOFF_thread_sig_desc 0x00000038
-#define ASIZ_thread_sig_desc 0x00000008
-#define AOFF_thread_xfsr 0x00000040
+#define AOFF_thread_xfsr 0x00000030
#define ASIZ_thread_xfsr 0x00000038
-#define AOFF_thread___pad3 0x00000078
-#define ASIZ_thread___pad3 0x00000008
-#define AOFF_thread_reg_window 0x00000080
+#define AOFF_thread_reg_window 0x00000068
#define ASIZ_thread_reg_window 0x00000380
-#define AOFF_thread_rwbuf_stkptrs 0x00000400
+#define AOFF_thread_rwbuf_stkptrs 0x000003e8
#define ASIZ_thread_rwbuf_stkptrs 0x00000038
-#define AOFF_thread_user_cntd0 0x00000438
+#define AOFF_thread_user_cntd0 0x00000420
#define ASIZ_thread_user_cntd0 0x00000008
-#define AOFF_thread_user_cntd1 0x00000440
+#define AOFF_thread_user_cntd1 0x00000428
#define ASIZ_thread_user_cntd1 0x00000008
-#define AOFF_thread_kernel_cntd0 0x00000448
+#define AOFF_thread_kernel_cntd0 0x00000430
#define ASIZ_thread_kernel_cntd0 0x00000008
-#define AOFF_thread_kernel_cntd1 0x00000450
+#define AOFF_thread_kernel_cntd1 0x00000438
#define ASIZ_thread_kernel_cntd1 0x00000008
-#define AOFF_thread_pcr_reg 0x00000458
+#define AOFF_thread_pcr_reg 0x00000440
#define ASIZ_thread_pcr_reg 0x00000008
-#define ASIZ_thread 0x00000460
+#define ASIZ_thread 0x00000450
#else /* CONFIG_SMP */
@@ -459,34 +453,34 @@
#define AOFF_task_semsleeping 0x00000570
#define ASIZ_task_semsleeping 0x00000008
#define AOFF_task_thread 0x00000580
-#define ASIZ_task_thread 0x00000460
-#define AOFF_task_fs 0x000009e0
+#define ASIZ_task_thread 0x00000450
+#define AOFF_task_fs 0x000009d0
#define ASIZ_task_fs 0x00000008
-#define AOFF_task_files 0x000009e8
+#define AOFF_task_files 0x000009d8
#define ASIZ_task_files 0x00000008
-#define AOFF_task_sigmask_lock 0x000009f0
+#define AOFF_task_sigmask_lock 0x000009e0
#define ASIZ_task_sigmask_lock 0x00000001
-#define AOFF_task_sig 0x000009f8
+#define AOFF_task_sig 0x000009e8
#define ASIZ_task_sig 0x00000008
-#define AOFF_task_signal 0x00000a00
+#define AOFF_task_signal 0x000009f0
#define ASIZ_task_signal 0x00000008
-#define AOFF_task_blocked 0x00000a08
+#define AOFF_task_blocked 0x000009f8
#define ASIZ_task_blocked 0x00000008
-#define AOFF_task_sigqueue 0x00000a10
+#define AOFF_task_sigqueue 0x00000a00
#define ASIZ_task_sigqueue 0x00000008
-#define AOFF_task_sigqueue_tail 0x00000a18
+#define AOFF_task_sigqueue_tail 0x00000a08
#define ASIZ_task_sigqueue_tail 0x00000008
-#define AOFF_task_sas_ss_sp 0x00000a20
+#define AOFF_task_sas_ss_sp 0x00000a10
#define ASIZ_task_sas_ss_sp 0x00000008
-#define AOFF_task_sas_ss_size 0x00000a28
+#define AOFF_task_sas_ss_size 0x00000a18
#define ASIZ_task_sas_ss_size 0x00000008
-#define AOFF_task_parent_exec_id 0x00000a30
+#define AOFF_task_parent_exec_id 0x00000a20
#define ASIZ_task_parent_exec_id 0x00000004
-#define AOFF_task_self_exec_id 0x00000a34
+#define AOFF_task_self_exec_id 0x00000a24
#define ASIZ_task_self_exec_id 0x00000004
-#define AOFF_task_exit_sem 0x00000a38
+#define AOFF_task_exit_sem 0x00000a28
#define ASIZ_task_exit_sem 0x00000038
-#define ASIZ_task 0x00000a70
+#define ASIZ_task 0x00000a60
#define AOFF_mm_mmap 0x00000000
#define ASIZ_mm_mmap 0x00000008
#define AOFF_mm_mmap_avl 0x00000008
@@ -572,29 +566,23 @@
#define ASIZ_thread_gsr 0x00000007
#define AOFF_thread___pad2 0x0000002f
#define ASIZ_thread___pad2 0x00000001
-#define AOFF_thread_sig_address 0x00000030
-#define ASIZ_thread_sig_address 0x00000008
-#define AOFF_thread_sig_desc 0x00000038
-#define ASIZ_thread_sig_desc 0x00000008
-#define AOFF_thread_xfsr 0x00000040
+#define AOFF_thread_xfsr 0x00000030
#define ASIZ_thread_xfsr 0x00000038
-#define AOFF_thread___pad3 0x00000078
-#define ASIZ_thread___pad3 0x00000008
-#define AOFF_thread_reg_window 0x00000080
+#define AOFF_thread_reg_window 0x00000068
#define ASIZ_thread_reg_window 0x00000380
-#define AOFF_thread_rwbuf_stkptrs 0x00000400
+#define AOFF_thread_rwbuf_stkptrs 0x000003e8
#define ASIZ_thread_rwbuf_stkptrs 0x00000038
-#define AOFF_thread_user_cntd0 0x00000438
+#define AOFF_thread_user_cntd0 0x00000420
#define ASIZ_thread_user_cntd0 0x00000008
-#define AOFF_thread_user_cntd1 0x00000440
+#define AOFF_thread_user_cntd1 0x00000428
#define ASIZ_thread_user_cntd1 0x00000008
-#define AOFF_thread_kernel_cntd0 0x00000448
+#define AOFF_thread_kernel_cntd0 0x00000430
#define ASIZ_thread_kernel_cntd0 0x00000008
-#define AOFF_thread_kernel_cntd1 0x00000450
+#define AOFF_thread_kernel_cntd1 0x00000438
#define ASIZ_thread_kernel_cntd1 0x00000008
-#define AOFF_thread_pcr_reg 0x00000458
+#define AOFF_thread_pcr_reg 0x00000440
#define ASIZ_thread_pcr_reg 0x00000008
-#define ASIZ_thread 0x00000460
+#define ASIZ_thread 0x00000450
#else /* SPIN_LOCK_DEBUG */
@@ -751,34 +739,34 @@
#define AOFF_task_semsleeping 0x00000578
#define ASIZ_task_semsleeping 0x00000008
#define AOFF_task_thread 0x00000580
-#define ASIZ_task_thread 0x00000460
-#define AOFF_task_fs 0x000009e0
+#define ASIZ_task_thread 0x00000450
+#define AOFF_task_fs 0x000009d0
#define ASIZ_task_fs 0x00000008
-#define AOFF_task_files 0x000009e8
+#define AOFF_task_files 0x000009d8
#define ASIZ_task_files 0x00000008
-#define AOFF_task_sigmask_lock 0x000009f0
+#define AOFF_task_sigmask_lock 0x000009e0
#define ASIZ_task_sigmask_lock 0x0000000c
-#define AOFF_task_sig 0x00000a00
+#define AOFF_task_sig 0x000009f0
#define ASIZ_task_sig 0x00000008
-#define AOFF_task_signal 0x00000a08
+#define AOFF_task_signal 0x000009f8
#define ASIZ_task_signal 0x00000008
-#define AOFF_task_blocked 0x00000a10
+#define AOFF_task_blocked 0x00000a00
#define ASIZ_task_blocked 0x00000008
-#define AOFF_task_sigqueue 0x00000a18
+#define AOFF_task_sigqueue 0x00000a08
#define ASIZ_task_sigqueue 0x00000008
-#define AOFF_task_sigqueue_tail 0x00000a20
+#define AOFF_task_sigqueue_tail 0x00000a10
#define ASIZ_task_sigqueue_tail 0x00000008
-#define AOFF_task_sas_ss_sp 0x00000a28
+#define AOFF_task_sas_ss_sp 0x00000a18
#define ASIZ_task_sas_ss_sp 0x00000008
-#define AOFF_task_sas_ss_size 0x00000a30
+#define AOFF_task_sas_ss_size 0x00000a20
#define ASIZ_task_sas_ss_size 0x00000008
-#define AOFF_task_parent_exec_id 0x00000a38
+#define AOFF_task_parent_exec_id 0x00000a28
#define ASIZ_task_parent_exec_id 0x00000004
-#define AOFF_task_self_exec_id 0x00000a3c
+#define AOFF_task_self_exec_id 0x00000a2c
#define ASIZ_task_self_exec_id 0x00000004
-#define AOFF_task_exit_sem 0x00000a40
+#define AOFF_task_exit_sem 0x00000a30
#define ASIZ_task_exit_sem 0x00000040
-#define ASIZ_task 0x00000a80
+#define ASIZ_task 0x00000a70
#define AOFF_mm_mmap 0x00000000
#define ASIZ_mm_mmap 0x00000008
#define AOFF_mm_mmap_avl 0x00000008
@@ -864,29 +852,23 @@
#define ASIZ_thread_gsr 0x00000007
#define AOFF_thread___pad2 0x0000002f
#define ASIZ_thread___pad2 0x00000001
-#define AOFF_thread_sig_address 0x00000030
-#define ASIZ_thread_sig_address 0x00000008
-#define AOFF_thread_sig_desc 0x00000038
-#define ASIZ_thread_sig_desc 0x00000008
-#define AOFF_thread_xfsr 0x00000040
+#define AOFF_thread_xfsr 0x00000030
#define ASIZ_thread_xfsr 0x00000038
-#define AOFF_thread___pad3 0x00000078
-#define ASIZ_thread___pad3 0x00000008
-#define AOFF_thread_reg_window 0x00000080
+#define AOFF_thread_reg_window 0x00000068
#define ASIZ_thread_reg_window 0x00000380
-#define AOFF_thread_rwbuf_stkptrs 0x00000400
+#define AOFF_thread_rwbuf_stkptrs 0x000003e8
#define ASIZ_thread_rwbuf_stkptrs 0x00000038
-#define AOFF_thread_user_cntd0 0x00000438
+#define AOFF_thread_user_cntd0 0x00000420
#define ASIZ_thread_user_cntd0 0x00000008
-#define AOFF_thread_user_cntd1 0x00000440
+#define AOFF_thread_user_cntd1 0x00000428
#define ASIZ_thread_user_cntd1 0x00000008
-#define AOFF_thread_kernel_cntd0 0x00000448
+#define AOFF_thread_kernel_cntd0 0x00000430
#define ASIZ_thread_kernel_cntd0 0x00000008
-#define AOFF_thread_kernel_cntd1 0x00000450
+#define AOFF_thread_kernel_cntd1 0x00000438
#define ASIZ_thread_kernel_cntd1 0x00000008
-#define AOFF_thread_pcr_reg 0x00000458
+#define AOFF_thread_pcr_reg 0x00000440
#define ASIZ_thread_pcr_reg 0x00000008
-#define ASIZ_thread 0x00000460
+#define ASIZ_thread 0x00000450
#endif /* SPIN_LOCK_DEBUG */
#endif /* CONFIG_SMP */
diff --git a/include/asm-sparc64/checksum.h b/include/asm-sparc64/checksum.h
index 6f6f8fe06..b2c06823a 100644
--- a/include/asm-sparc64/checksum.h
+++ b/include/asm-sparc64/checksum.h
@@ -1,4 +1,4 @@
-/* $Id: checksum.h,v 1.14 2000/01/05 21:27:42 davem Exp $ */
+/* $Id: checksum.h,v 1.15 2000/01/19 04:06:09 davem Exp $ */
#ifndef __SPARC64_CHECKSUM_H
#define __SPARC64_CHECKSUM_H
@@ -37,12 +37,6 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
* here even more important to align src and dst on a 32-bit (or even
* better 64-bit) boundary
*/
-/* FIXME: Remove these macros ASAP */
-#define csum_partial_copy(src, dst, len, sum) \
- csum_partial_copy_nocheck(src,dst,len,sum)
-#define csum_partial_copy_fromuser(s, d, l, w) \
- csum_partial_copy_from_user((char *) (s), (d), (l), (w), NULL)
-
extern unsigned int csum_partial_copy_sparc64(const char *src, char *dst, int len, unsigned int sum);
extern __inline__ unsigned int
@@ -66,15 +60,19 @@ csum_partial_copy_from_user(const char *src, char *dst, int len,
return csum_partial_copy_sparc64(src, dst, len, sum);
}
-#if 0
-/* XXX should implement this now... -DaveM */
+/*
+ * Copy and checksum to user
+ */
+#define HAVE_CSUM_COPY_USER
+extern unsigned int csum_partial_copy_user_sparc64(const char *src, char *dst, int len, unsigned int sum);
extern __inline__ unsigned int
-csum_partial_copy_to_user(const char *src, char *dst, int len,
- unsigned int sum, int *err)
+csum_and_copy_to_user(const char *src, char *dst, int len,
+ unsigned int sum, int *err)
{
- return 0;
+ __asm__ __volatile__ ("stx %0, [%%sp + 0x7ff + 128]"
+ : : "r" (err));
+ return csum_partial_copy_user_sparc64(src, dst, len, sum);
}
-#endif
/* ihl is always 5 or greater, almost always is 5, and iph is word aligned
* the majority of the time.
diff --git a/include/asm-sparc64/dma.h b/include/asm-sparc64/dma.h
index 9bab4ebca..4f0b0baf2 100644
--- a/include/asm-sparc64/dma.h
+++ b/include/asm-sparc64/dma.h
@@ -218,4 +218,10 @@ extern int isa_dma_bridge_buggy;
#define isa_dma_bridge_buggy (0)
#endif
+/* We support dynamic DMA remapping and adjacent SG entries
+ * which have addresses modulo DMA_CHUNK_SIZE will be merged
+ * by dma_prepare_sg().
+ */
+#define DMA_CHUNK_SIZE 8192
+
#endif /* !(_ASM_SPARC64_DMA_H) */
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index 9a7fd950a..3758686e2 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -270,7 +270,10 @@ static int sun_fd_eject(int drive)
#include <asm/ns87303.h>
static struct linux_ebus_dma *sun_pci_fd_ebus_dma;
+static struct pci_dev *sun_pci_ebus_dev;
static int sun_pci_broken_drive = -1;
+static unsigned int sun_pci_dma_addr = -1U;
+static int sun_pci_dma_len;
extern void floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs);
@@ -363,6 +366,11 @@ static void sun_pci_fd_disable_dma(void)
writel(dcsr, &sun_pci_fd_ebus_dma->dcsr);
}
}
+ if (sun_pci_dma_addr != -1U)
+ pci_unmap_single(sun_pci_ebus_dev,
+ sun_pci_dma_addr,
+ sun_pci_dma_len);
+ sun_pci_dma_addr = -1U;
}
static void sun_pci_fd_set_dma_mode(int mode)
@@ -389,12 +397,17 @@ static void sun_pci_fd_set_dma_mode(int mode)
static void sun_pci_fd_set_dma_count(int length)
{
+ sun_pci_dma_len = length;
writel(length, &sun_pci_fd_ebus_dma->dbcr);
}
static void sun_pci_fd_set_dma_addr(char *buffer)
{
- unsigned int addr = virt_to_bus(buffer);
+ unsigned int addr;
+
+ addr = sun_pci_dma_addr = pci_map_single(sun_pci_ebus_dev,
+ buffer,
+ sun_pci_dma_len);
writel(addr, &sun_pci_fd_ebus_dma->dacr);
}
@@ -599,6 +612,8 @@ static unsigned long __init sun_floppy_init(void)
auxio_reg = edev->resource[2].start;
writel(readl(auxio_reg)|0x2, auxio_reg);
+ sun_pci_ebus_dev = ebus->self;
+
sun_pci_fd_ebus_dma = (struct linux_ebus_dma *)
edev->resource[1].start;
sun_pci_fd_reset_dma();
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index 5dc5c88c6..37a1e847b 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -13,7 +13,7 @@
#define __SLOW_DOWN_IO do { } while (0)
#define SLOW_DOWN_IO do { } while (0)
-#undef NEW_PCI_DMA_MAP
+#define NEW_PCI_DMA_MAP
#ifndef NEW_PCI_DMA_MAP
#define PCI_DVMA_HASHSZ 256
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index 97aeaf7f6..5184ba51a 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -149,7 +149,7 @@ parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
if (parport_pc_probe_port(base, base + 0x400,
edev->irqs[0],
- count))
+ count, ebus->self))
count++;
}
}
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index 4131b698f..881de6c2f 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -1,8 +1,6 @@
#ifndef __SPARC64_PCI_H
#define __SPARC64_PCI_H
-#include <asm/scatterlist.h>
-
/* Can be used to override the logic in pci_scan_bus for skipping
* already-configured bus numbers - to be used for buggy BIOSes
* or architectures with incomplete PCI setup by the loader.
@@ -12,32 +10,37 @@
#define PCIBIOS_MIN_IO 0UL
#define PCIBIOS_MIN_MEM 0UL
+#ifdef __KERNEL__
+
+/* Dynamic DMA mapping stuff.
+ */
+
+#include <asm/scatterlist.h>
+
struct pci_dev;
-/* Allocate and map kernel buffer using consistant mode DMA for PCI device.
- * Returns non-NULL cpu-view pointer to the buffer if successful and
- * sets *dma_addrp to the pci side dma address as well, else *dma_addrp
- * is undefined.
+/* Allocate and map kernel buffer using consistent mode DMA for a device.
+ * hwdev should be valid struct pci_dev pointer for PCI devices.
*/
-extern void *pci_alloc_consistant(struct pci_dev *pdev, long size, u32 *dma_addrp);
+extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle);
-/* Free and unmap a consistant DMA buffer.
- * cpu_addr is what was returned from pci_alloc_consistant,
- * size must be the same as what as passed into pci_alloc_consistant,
+/* Free and unmap a consistent DMA buffer.
+ * cpu_addr is what was returned from pci_alloc_consistent,
+ * size must be the same as what as passed into pci_alloc_consistent,
* and likewise dma_addr must be the same as what *dma_addrp was set to.
*
* References to the memory and mappings assosciated with cpu_addr/dma_addr
* past this call are illegal.
*/
-extern void pci_free_consistant(struct pci_dev *pdev, long size, void *cpu_addr, u32 dma_addr);
+extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle);
-/* Map a single buffer of the indicate size for PCI DMA in streaming mode.
- * The 32-bit PCI bus mastering address to use is returned.
+/* Map a single buffer of the indicated size for DMA in streaming mode.
+ * The 32-bit bus address to use is returned.
*
* Once the device is given the dma address, the device owns this memory
- * until either pci_unmap_single or pci_sync_single is performed.
+ * until either pci_unmap_single or pci_dma_sync_single is performed.
*/
-extern u32 pci_map_single(struct pci_dev *pdev, void *buffer, long size);
+extern dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size);
/* Unmap a single streaming mode DMA translation. The dma_addr and size
* must match what was provided for in a previous pci_map_single call. All
@@ -46,32 +49,32 @@ extern u32 pci_map_single(struct pci_dev *pdev, void *buffer, long size);
* After this call, reads by the cpu to the buffer are guarenteed to see
* whatever the device wrote there.
*/
-extern void pci_unmap_single(struct pci_dev *pdev, u32 dma_addr, long size);
+extern void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size);
/* Map a set of buffers described by scatterlist in streaming
- * mode for PCI DMA. This is the scather-gather version of the
+ * mode for DMA. This is the scather-gather version of the
* above pci_map_single interface. Here the scatter gather list
- * elements are each tagged with the appropriate PCI dma address
+ * elements are each tagged with the appropriate dma address
* and length. They are obtained via sg_dma_{address,length}(SG).
*
* NOTE: An implementation may be able to use a smaller number of
* DMA address/length pairs than there are SG table elements.
* (for example via virtual mapping capabilities)
- * The routine returns the number of addr/length pairs actually
- * used, at most nents.
+ * The routine returns the number of addr/length pairs actually
+ * used, at most nents.
*
* Device ownership issues as mentioned above for pci_map_single are
* the same here.
*/
-extern int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents);
+extern int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents);
/* Unmap a set of streaming mode DMA translations.
* Again, cpu read rules concerning calls here are the same as for
* pci_unmap_single() above.
*/
-extern void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents);
+extern void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nhwents);
-/* Make physical memory consistant for a single
+/* Make physical memory consistent for a single
* streaming mode DMA translation after a transfer.
*
* If you perform a pci_map_single() but wish to interrogate the
@@ -80,14 +83,16 @@ extern void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents
* next point you give the PCI dma address back to the card, the
* device again owns the buffer.
*/
-extern void pci_dma_sync_single(struct pci_dev *, u32, long);
+extern void pci_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size);
-/* Make physical memory consistant for a set of streaming
+/* Make physical memory consistent for a set of streaming
* mode DMA translations after a transfer.
*
* The same as pci_dma_sync_single but for a scatter-gather list,
* same rules and usage.
*/
-extern void pci_dma_sync_sg(struct pci_dev *, struct scatterlist *, int);
+extern void pci_dma_sync_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nelems);
+
+#endif /* __KERNEL__ */
#endif /* __SPARC64_PCI_H */
diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h
index 807dd0cf4..158fbbf39 100644
--- a/include/asm-sparc64/processor.h
+++ b/include/asm-sparc64/processor.h
@@ -1,4 +1,4 @@
-/* $Id: processor.h,v 1.60 2000/01/07 20:21:45 davem Exp $
+/* $Id: processor.h,v 1.61 2000/01/21 11:39:22 jj Exp $
* include/asm-sparc64/processor.h
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -56,16 +56,11 @@ struct thread_struct {
unsigned char __pad1[3];
struct pt_regs *kregs;
- /* D$ line 2 */
+ /* D$ line 2, 3, 4 */
unsigned long *utraps;
unsigned char gsr[7];
unsigned char __pad2;
- unsigned long sig_address;
- unsigned long sig_desc;
-
- /* D$ lines 3 and 4 */
unsigned long xfsr[7];
- unsigned long __pad3;
struct reg_window reg_window[NSWINS];
unsigned long rwbuf_stkptrs[NSWINS];
@@ -92,10 +87,8 @@ struct thread_struct {
0, 0, 0, 0, KERNEL_DS, \
/* w_saved, fpdepth, fpsaved, pad1, kregs, */ \
0, 0, { 0 }, { 0 }, 0, \
-/* utraps, gsr, pad2, sig_address, sig_desc, */ \
- 0, { 0 }, 0, 0, 0, \
-/* xfsr, pad3, */ \
- { 0 }, 0, \
+/* utraps, gsr, pad2, xfsr, */ \
+ 0, { 0 }, 0, { 0 }, \
/* reg_window */ \
{ { { 0, }, { 0, } }, }, \
/* rwbuf_stkptrs */ \
diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h
index 1718e234f..1b0b5137a 100644
--- a/include/asm-sparc64/sbus.h
+++ b/include/asm-sparc64/sbus.h
@@ -94,18 +94,18 @@ extern struct sbus_bus *sbus_root;
#define sbus_can_burst64(sdev) (1)
extern void sbus_set_sbus64(struct sbus_dev *, int);
-/* These yield IOMMU mappings in consistant mode. */
-extern void *sbus_alloc_consistant(struct sbus_dev *, long, u32 *dma_addrp);
-extern void sbus_free_consistant(struct sbus_dev *, long, void *, u32);
+/* These yield IOMMU mappings in consistent mode. */
+extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp);
+extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t);
/* All the rest use streaming mode mappings. */
-extern u32 sbus_map_single(struct sbus_dev *, void *, long);
-extern void sbus_unmap_single(struct sbus_dev *, u32, long);
+extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t);
+extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t);
extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int);
extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int);
/* Finally, allow explicit synchronization of streamable mappings. */
-extern void sbus_dma_sync_single(struct sbus_dev *, u32, long);
+extern void sbus_dma_sync_single(struct sbus_dev *, dma_addr_t, size_t);
extern void sbus_dma_sync_sg(struct sbus_dev *, struct scatterlist *, int);
#endif /* !(_SPARC64_SBUS_H) */
diff --git a/include/asm-sparc64/semaphore.h b/include/asm-sparc64/semaphore.h
index 046385d3c..1d7b0e31c 100644
--- a/include/asm-sparc64/semaphore.h
+++ b/include/asm-sparc64/semaphore.h
@@ -253,11 +253,18 @@ struct rw_semaphore {
#define __RWSEM_DEBUG_INIT /* */
#endif
-#define __RWSEM_INITIALIZER(name) \
-{ RW_LOCK_BIAS, 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), \
+#define __RWSEM_INITIALIZER(name,count) \
+{ (count), 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), \
__WAIT_QUEUE_HEAD_INITIALIZER((name).write_bias_wait) \
__SEM_DEBUG_INIT(name) __RWSEM_DEBUG_INIT }
+#define __DECLARE_RWSEM_GENERIC(name,count) \
+ struct rw_semaphore name = __RWSEM_INITIALIZER(name,count)
+
+#define DECLARE_RWSEM(name) __DECLARE_RWSEM_GENERIC(name,RW_LOCK_BIAS)
+#define DECLARE_RWSEM_READ_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,RW_LOCK_BIAS-1)
+#define DECLARE_RWSEM_WRITE_LOCKED(name) __DECLARE_RWSEM_GENERIC(name,0)
+
extern inline void init_rwsem(struct rw_semaphore *sem)
{
sem->count = RW_LOCK_BIAS;
diff --git a/include/asm-sparc64/siginfo.h b/include/asm-sparc64/siginfo.h
index 9e60d6015..ee7d80809 100644
--- a/include/asm-sparc64/siginfo.h
+++ b/include/asm-sparc64/siginfo.h
@@ -141,6 +141,11 @@ typedef struct siginfo32 {
#define si_band _sifields._sigpoll._band
#define si_fd _sifields._sigpoll._fd
+#ifdef __KERNEL__
+#define __SI_MASK 0
+#define __SI_FAULT 0
+#endif
+
/*
* si_code values
* Digital reserves positive values for kernel-generated signals.
@@ -187,7 +192,7 @@ typedef struct siginfo32 {
* SIGSEGV si_codes
*/
#define SEGV_MAPERR 1 /* address not mapped to object */
-#define SRGV_ACCERR 2 /* invalid permissions for mapped object */
+#define SEGV_ACCERR 2 /* invalid permissions for mapped object */
#define NSIGSEGV 2
/*
@@ -214,7 +219,7 @@ typedef struct siginfo32 {
#define CLD_TRAPPED 4 /* traced child has trapped */
#define CLD_STOPPED 5 /* child has stopped */
#define CLD_CONTINUED 6 /* stopped child has continued */
-#define NSIGCHLD
+#define NSIGCHLD 6
/*
* SIGPOLL si_codes
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index 7cd66aa56..116fe903e 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -68,13 +68,17 @@ extern void smp_callin(void);
extern void smp_boot_cpus(void);
extern void smp_store_cpu_info(int id);
-extern __volatile__ int cpu_number_map[NR_CPUS];
+extern __volatile__ int __cpu_number_map[NR_CPUS];
extern __volatile__ int __cpu_logical_map[NR_CPUS];
extern __inline__ int cpu_logical_map(int cpu)
{
return __cpu_logical_map[cpu];
}
+extern __inline__ int cpu_number_map(int cpu)
+{
+ return __cpu_number_map[cpu];
+}
extern __inline__ int hard_smp_processor_id(void)
{
diff --git a/include/asm-sparc64/termbits.h b/include/asm-sparc64/termbits.h
index 6d490333c..faa32e785 100644
--- a/include/asm-sparc64/termbits.h
+++ b/include/asm-sparc64/termbits.h
@@ -204,6 +204,9 @@ struct termios {
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+#define TIOCM_LOOP 0x8000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
diff --git a/include/asm-sparc64/types.h b/include/asm-sparc64/types.h
index e96909af4..f8e42235c 100644
--- a/include/asm-sparc64/types.h
+++ b/include/asm-sparc64/types.h
@@ -45,6 +45,10 @@ typedef unsigned long u64;
#define BITS_PER_LONG 64
+/* Dma addresses are 32-bits wide for now. */
+
+typedef u32 dma_addr_t;
+
#endif /* __KERNEL__ */
#endif /* defined(_SPARC64_TYPES_H) */
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 49c063d44..d1c874480 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -1,4 +1,4 @@
-/* $Id: unistd.h,v 1.39 2000/01/11 17:34:05 jj Exp $ */
+/* $Id: unistd.h,v 1.40 2000/01/16 06:20:38 davem Exp $ */
#ifndef _SPARC64_UNISTD_H
#define _SPARC64_UNISTD_H
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index c96ef3283..5b1ad645c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -24,7 +24,6 @@
#include <linux/types.h>
#include <linux/ioctl.h>
#ifdef __KERNEL__
-#include <linux/config.h>
#include <linux/sched.h>
#include <linux/wait.h>
#endif /* __KERNEL__ */
@@ -57,139 +56,10 @@ enum
typedef int acpi_dstate_t;
-/*
- * HID (PnP) values
- */
-enum
-{
- ACPI_UNKNOWN_HID = 0x00000000, /* generic */
- ACPI_KBC_HID = 0x41d00303, /* keyboard controller */
- ACPI_COM_HID = 0x41d00500, /* serial port */
- ACPI_FDC_HID = 0x41d00700, /* floppy controller */
- ACPI_VGA_HID = 0x41d00900, /* VGA controller */
- ACPI_ISA_HID = 0x41d00a00, /* ISA bus */
- ACPI_EISA_HID = 0x41d00a01, /* EISA bus */
- ACPI_PCI_HID = 0x41d00a03, /* PCI bus */
-};
-
-typedef int acpi_hid_t;
-
#ifdef __KERNEL__
-/*
- * Device types
- */
-enum
-{
- ACPI_SYS_DEV, /* system device (fan, KB controller, ...) */
- ACPI_PCI_DEV, /* generic PCI device */
- ACPI_PCI_BUS, /* PCI bus */
- ACPI_ISA_DEV, /* generic ISA device */
- ACPI_ISA_BUS, /* ISA bus */
- ACPI_USB_DEV, /* generic USB device */
- ACPI_USB_HUB, /* USB hub device */
- ACPI_USB_CTRL, /* USB controller */
- ACPI_SCSI_DEV, /* generic SCSI device */
- ACPI_SCSI_CTRL, /* SCSI controller */
-};
-
-typedef int acpi_dev_t;
-
-/*
- * Device addresses
- */
-#define ACPI_PCI_ADR(dev) ((dev)->bus->number << 16 | (dev)->devfn)
-
-struct acpi_dev;
-
-/*
- * Device state transition function
- */
-typedef int (*acpi_transition)(struct acpi_dev *dev, acpi_dstate_t state);
-
-/*
- * Static device information
- */
-struct acpi_dev_info
-{
- acpi_dev_t type; /* device type */
- acpi_hid_t hid; /* PnP identifier */
- acpi_transition transition; /* state transition callback */
-
- /* other information like D-states supported,
- * D-state latencies, and in-rush current needs
- * will go here
- */
-};
-
-/*
- * Dynamic device information
- */
-struct acpi_dev
-{
- struct acpi_dev_info info; /* static device info */
- unsigned long adr; /* bus address or unique id */
- acpi_dstate_t state; /* current D-state */
- unsigned long accessed; /* last access time */
- unsigned long idle; /* last idle time */
- struct list_head entry; /* linked list entry */
-};
-
-#ifdef CONFIG_ACPI
-
-extern wait_queue_head_t acpi_control_wait;
-
-/*
- * Register a device with the ACPI subsystem
- */
-struct acpi_dev *acpi_register(struct acpi_dev_info *info, unsigned long adr);
-
-/*
- * Unregister a device with ACPI
- */
-void acpi_unregister(struct acpi_dev *dev);
-
-/*
- * Update device access time and wake up device, if necessary
- */
-extern inline void acpi_access(struct acpi_dev *dev)
-{
- extern void acpi_wakeup(struct acpi_dev*);
- if (dev) {
- if (dev->state != ACPI_D0)
- acpi_wakeup(dev);
- dev->accessed = jiffies;
- }
-}
-
-/*
- * Identify device as currently being idle
- */
-extern inline void acpi_dev_idle(struct acpi_dev *dev)
-{
- if (dev) {
- dev->idle = jiffies;
- if (waitqueue_active(&acpi_control_wait))
- wake_up(&acpi_control_wait);
- }
-}
-
extern int acpi_active;
-#else /* CONFIG_ACPI */
-
-extern inline struct acpi_dev*
-acpi_register(struct acpi_dev_info *info, unsigned long adr)
-{
- return 0;
-}
-
-extern inline void acpi_unregister(struct acpi_dev *dev) {}
-extern inline void acpi_access(struct acpi_dev *dev) {}
-extern inline void acpi_dev_idle(struct acpi_dev *dev) {}
-
-#endif /* CONFIG_ACPI */
-
extern void (*acpi_idle)(void);
extern void (*acpi_power_off)(void);
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index 9a0ddd6c4..a8b313539 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -20,7 +20,8 @@
#include <linux/ioctl.h>
#include <asm/types.h>
-#define AUTOFS_PROTO_VERSION 3
+#define AUTOFS_MIN_PROTO_VERSION 3 /* Min version we support */
+#define AUTOFS_PROTO_VERSION 4 /* Current version */
/*
* Architectures where both 32- and 64-bit binaries can be executed
@@ -46,6 +47,7 @@ typedef unsigned long autofs_wqt_t;
enum autofs_packet_type {
autofs_ptype_missing, /* Missing entry (mount request) */
autofs_ptype_expire, /* Expire entry (umount request) */
+ autofs_ptype_expire_multi, /* Expire entry (umount request) */
};
struct autofs_packet_hdr {
@@ -60,18 +62,35 @@ struct autofs_packet_missing {
char name[NAME_MAX+1];
};
+/* v3 expire (via ioctl) */
struct autofs_packet_expire {
struct autofs_packet_hdr hdr;
int len;
char name[NAME_MAX+1];
};
+/* v4 multi expire (via pipe) */
+struct autofs_packet_expire_multi {
+ struct autofs_packet_hdr hdr;
+ autofs_wqt_t wait_queue_token;
+ int len;
+ char name[NAME_MAX+1];
+};
+
+union autofs_packet_union {
+ struct autofs_packet_hdr hdr;
+ struct autofs_packet_missing missing;
+ struct autofs_packet_expire expire;
+ struct autofs_packet_expire_multi expire_multi;
+};
+
#define AUTOFS_IOC_READY _IO(0x93,0x60)
#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
+#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int)
#ifdef __KERNEL__
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e8b4c0b9b..c86eecc9b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -25,7 +25,8 @@ struct request {
int errors;
unsigned long sector;
unsigned long nr_sectors;
- unsigned long nr_segments;
+ unsigned int nr_segments;
+ unsigned int nr_hw_segments;
unsigned long current_nr_sectors;
void * special;
char * buffer;
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 13b877ec7..78f7d426b 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -872,6 +872,10 @@ typedef struct {
__u32 last_rec_address;
} track_information;
+extern int cdrom_get_disc_info(kdev_t dev, disc_information *di);
+extern int cdrom_get_track_info(kdev_t dev, __u16 track, __u8 type,
+ track_information *ti);
+
/* The SCSI spec says there could be 256 slots. */
#define CDROM_MAX_SLOTS 256
diff --git a/include/linux/cyclomx.h b/include/linux/cyclomx.h
index 2e387395e..983295c18 100644
--- a/include/linux/cyclomx.h
+++ b/include/linux/cyclomx.h
@@ -13,6 +13,8 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
* ============================================================================
+* 2000/01/21 acme rename cyclomx_open to cyclomx_mod_inc_use_count
+* and cyclomx_close to cyclomx_mod_dec_use_count
* 1999/05/19 acme wait_queue_head_t wait_stats(support for 2.3.*)
* 1999/01/03 acme judicious use of data types
* 1998/12/27 acme cleanup: PACKED not needed
@@ -80,8 +82,8 @@ typedef struct cycx {
} cycx_t;
/* Public Functions */
-void cyclomx_open (cycx_t *card); /* cycx_main.c */
-void cyclomx_close (cycx_t *card); /* cycx_main.c */
+void cyclomx_mod_inc_use_count (cycx_t *card); /* cycx_main.c */
+void cyclomx_mod_dec_use_count (cycx_t *card); /* cycx_main.c */
void cyclomx_set_state (cycx_t *card, int state); /* cycx_main.c */
#ifdef CONFIG_CYCLOMX_X25
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 56ace40e0..f008ca74f 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -24,7 +24,6 @@
#ifndef _LINUX_ETHERDEVICE_H
#define _LINUX_ETHERDEVICE_H
-#include <linux/config.h>
#include <linux/if_ether.h>
#ifdef __KERNEL__
@@ -41,7 +40,7 @@ extern int eth_header_parse(struct sk_buff *skb,
unsigned char *haddr);
extern struct net_device * init_etherdev(struct net_device *, int);
-#ifdef CONFIG_IP_ROUTER
+#if 1 /*def CONFIG_IP_ROUTER*/
static __inline__ void eth_copy_and_sum (struct sk_buff *dest, unsigned char *src, int len, int base)
{
memcpy (dest->data, src, len);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0046b3f7e..35530b777 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -19,6 +19,7 @@
#include <linux/dcache.h>
#include <linux/stat.h>
#include <linux/cache.h>
+#include <linux/stddef.h>
#include <asm/atomic.h>
#include <asm/bitops.h>
@@ -66,10 +67,6 @@ extern int max_super_blocks, nr_super_blocks;
#define WRITERAW 5 /* raw write - don't play with buffer lists */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
#define NIL_FILP ((struct file *)0)
#define SEL_IN 1
#define SEL_OUT 2
@@ -783,9 +780,9 @@ extern int register_chrdev(unsigned int, const char *, struct file_operations *)
extern int unregister_chrdev(unsigned int, const char *);
extern int chrdev_open(struct inode *, struct file *);
extern struct file_operations def_chr_fops;
-extern char * bdevname(kdev_t);
-extern char * cdevname(kdev_t);
-extern char * kdevname(kdev_t);
+extern const char * bdevname(kdev_t);
+extern const char * cdevname(kdev_t);
+extern const char * kdevname(kdev_t);
extern void init_special_inode(struct inode *, umode_t, int);
extern struct inode_operations fifo_inode_operations;
@@ -1001,8 +998,8 @@ extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *);
extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *, writepage_t);
extern void do_generic_file_read(struct file *, loff_t *, read_descriptor_t *, read_actor_t);
-extern int vfs_readlink(struct dentry *, char *, int, char *);
-extern struct dentry *vfs_follow_link(struct dentry *, struct dentry *, unsigned, char *);
+extern int vfs_readlink(struct dentry *, char *, int, const char *);
+extern struct dentry *vfs_follow_link(struct dentry *, struct dentry *, unsigned, const char *);
extern int page_readlink(struct dentry *, char *, int);
extern struct dentry *page_follow_link(struct dentry *, struct dentry *, unsigned);
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index a2f08879c..fcac3cd06 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -49,6 +49,7 @@
#define WIN_SEEK 0x70
#define WIN_DIAGNOSE 0x90
#define WIN_SPECIFY 0x91 /* set drive geometry translation */
+#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */
#define WIN_SETIDLE1 0xE3
#define WIN_SETIDLE2 0x97
diff --git a/include/linux/hfs_sysdep.h b/include/linux/hfs_sysdep.h
index c3b866f25..5172139ec 100644
--- a/include/linux/hfs_sysdep.h
+++ b/include/linux/hfs_sysdep.h
@@ -121,7 +121,7 @@ extern inline void hfs_mdb_dirty(hfs_sysmdb sys_mdb) {
sys_mdb->s_dirt = 1;
}
-extern inline char *hfs_mdb_name(hfs_sysmdb sys_mdb) {
+extern inline const char *hfs_mdb_name(hfs_sysmdb sys_mdb) {
return kdevname(sys_mdb->s_dev);
}
diff --git a/include/linux/highuid.h b/include/linux/highuid.h
index 40f121ca7..5d287bbb3 100644
--- a/include/linux/highuid.h
+++ b/include/linux/highuid.h
@@ -63,13 +63,6 @@ extern int overflowgid;
#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid)
#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid)
-/* specific to kernel/signal.c */
-#ifdef UID16_SIGINFO_COMPAT_NEEDED
-#define SET_SIGINFO_UID16(var, uid) var = high2lowuid(uid)
-#else
-#define SET_SIGINFO_UID16(var, uid) do { ; } while (0)
-#endif
-
#else
#define SET_UID16(var, uid) do { ; } while (0)
@@ -82,8 +75,6 @@ extern int overflowgid;
#define SET_STAT_UID(stat, uid) (stat).st_uid = uid
#define SET_STAT_GID(stat, gid) (stat).st_gid = gid
-#define SET_SIGINFO_UID16(var, uid) do { ; } while (0)
-
#endif /* CONFIG_UID16 */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 1b438bf74..49ce1c179 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -373,7 +373,10 @@ typedef struct hwif_s {
ide_selectproc_t *selectproc; /* tweaks hardware to select drive */
ide_resetproc_t *resetproc; /* routine to reset controller after a disk reset */
ide_dmaproc_t *dmaproc; /* dma read/write/abort routine */
- unsigned long *dmatable; /* dma physical region descriptor table */
+ unsigned int *dmatable_cpu; /* dma physical region descriptor table (cpu view) */
+ u32 dmatable_dma; /* dma physical region descriptor table (dma view) */
+ struct scatterlist *sg_table; /* Scatter-gather list used to build the above */
+ int sg_nents; /* Current number of entries in it */
struct hwif_s *mate; /* other hwif from same PCI chip */
unsigned long dma_base; /* base addr for dma ports */
unsigned dma_extra; /* extra addr for dma ports */
@@ -836,6 +839,7 @@ void ide_scan_pcibus (int scan_direction) __init;
#define BAD_DMA_DRIVE 0
#define GOOD_DMA_DRIVE 1
int ide_build_dmatable (ide_drive_t *drive, ide_dma_action_t func);
+void ide_destroy_dmatable (ide_drive_t *drive);
ide_startstop_t ide_dma_intr (ide_drive_t *drive);
int check_drive_lists (ide_drive_t *drive, int good_bad);
int ide_dmaproc (ide_dma_action_t func, ide_drive_t *drive);
diff --git a/include/linux/init.h b/include/linux/init.h
index 4d4e6e156..20fc892e9 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -90,7 +90,7 @@ extern struct kernel_param __setup_start, __setup_end;
#define __exit
#define __initdata
#define __exitdata
-#define __initcall
+#define __initcall(fn)
/* For assembly routines */
#define __INIT
#define __FINIT
diff --git a/include/linux/input.h b/include/linux/input.h
index 1e998c944..fefc77b51 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -285,11 +285,16 @@ struct input_event {
#define BTN_MODE 0x13c
#define BTN_DIGI 0x140
-#define BTN_PEN 0x140
-#define BTN_RUBBER 0x141
-#define BTN_PEN_SIDE 0x142
-#define BTN_PEN_SIDE2 0x143
-#define BTN_NEAR 0x144
+#define BTN_TOOL_PEN 0x140
+#define BTN_TOOL_RUBBER 0x141
+#define BTN_TOOL_BRUSH 0x142
+#define BTN_TOOL_PENCIL 0x143
+#define BTN_TOOL_AIRBRUSH 0x144
+#define BTN_TOOL_FINGER 0x145
+#define BTN_TOOL_MOUSE 0x146
+#define BTN_TOUCH 0x147
+#define BTN_STYLUS 0x148
+#define BTN_STYLUS2 0x149
#define KEY_MAX 0x1ff
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
index 5a074285e..7a52a7c4d 100644
--- a/include/linux/isapnp.h
+++ b/include/linux/isapnp.h
@@ -128,7 +128,7 @@ struct isapnp_resources {
struct isapnp_resources *next; /* next resource */
};
-#if defined(CONFIG_ISAPNP) || defined(CONFIG_ISAPNP_MODULE)
+#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
#define __ISAPNP__
diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h
index a06cdb9ed..aeee1fbee 100644
--- a/include/linux/kdev_t.h
+++ b/include/linux/kdev_t.h
@@ -73,7 +73,7 @@ typedef unsigned short kdev_t;
#define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi))
#define B_FREE 0xffff /* yuk */
-extern char * kdevname(kdev_t); /* note: returns pointer to static data! */
+extern const char * kdevname(kdev_t); /* note: returns pointer to static data! */
/*
As long as device numbers in the outside world have 16 bits only,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d5daeba2c..0d7609741 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -451,25 +451,23 @@ extern struct page *filemap_nopage(struct vm_area_struct * area,
* GFP bitmasks..
*/
#define __GFP_WAIT 0x01
-#define __GFP_LOW 0x02
-#define __GFP_MED 0x04
-#define __GFP_HIGH 0x08
-#define __GFP_IO 0x10
-#define __GFP_SWAP 0x20
+#define __GFP_HIGH 0x02
+#define __GFP_IO 0x04
+#define __GFP_SWAP 0x08
#ifdef CONFIG_HIGHMEM
-#define __GFP_HIGHMEM 0x40
+#define __GFP_HIGHMEM 0x10
#else
#define __GFP_HIGHMEM 0x0 /* noop */
#endif
-#define __GFP_DMA 0x80
-#define __GFP_UNCACHED 0x100
+#define __GFP_DMA 0x20
+#define __GFP_UNCACHED 0x40
-#define GFP_BUFFER (__GFP_LOW | __GFP_WAIT)
+#define GFP_BUFFER (__GFP_WAIT)
#define GFP_ATOMIC (__GFP_HIGH)
-#define GFP_USER (__GFP_LOW | __GFP_WAIT | __GFP_IO)
+#define GFP_USER (__GFP_WAIT | __GFP_IO)
#define GFP_HIGHUSER (GFP_USER | __GFP_HIGHMEM)
-#define GFP_KERNEL (__GFP_MED | __GFP_WAIT | __GFP_IO)
+#define GFP_KERNEL (__GFP_HIGH | __GFP_WAIT | __GFP_IO)
#define GFP_NFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO)
#define GFP_KSWAPD (__GFP_IO | __GFP_SWAP)
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index 6898c4e5f..9a25fea0d 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -37,6 +37,8 @@ struct parport_pc_private {
/* buffer suitable for DMA, if DMA enabled */
char *dma_buf;
+ dma_addr_t dma_handle;
+ struct pci_dev *dev;
};
extern __inline__ void parport_pc_write_data(struct parport *p, unsigned char d)
@@ -175,6 +177,7 @@ extern void parport_pc_dec_use_count(void);
/* PCMCIA code will want to get us to look at a port. Provide a mechanism. */
extern struct parport *parport_pc_probe_port (unsigned long base,
unsigned long base_hi,
- int irq, int dma);
+ int irq, int dma,
+ struct pci_dev *dev);
#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3c51b15e7..6472c3b59 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -315,6 +315,11 @@ struct pci_dev {
struct pci_driver *driver; /* which driver has allocated this device */
void *driver_data; /* data private to the driver */
+ dma_addr_t dma_mask; /* Mask of the bits of bus address this
+ device implements. Normally this is
+ 0xffffffff. You only need to change
+ this if your device has broken DMA
+ or supports 64-bit transfers. */
/* device is compatible with these IDs */
unsigned short vendor_compatible[DEVICE_COUNT_COMPATIBLE];
@@ -462,16 +467,16 @@ int pci_proc_detach_device(struct pci_dev *dev);
void pci_name_device(struct pci_dev *dev);
char *pci_class_name(u32 class);
void pci_read_bridge_bases(struct pci_bus *child);
-struct resource *pci_find_parent_resource(struct pci_dev *dev, struct resource *res);
+struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res);
int pci_setup_device(struct pci_dev * dev);
/* Generic PCI functions exported to card drivers */
-struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, struct pci_dev *from);
+struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from);
struct pci_dev *pci_find_subsys (unsigned int vendor, unsigned int device,
unsigned int ss_vendor, unsigned int ss_device,
- struct pci_dev *from);
-struct pci_dev *pci_find_class (unsigned int class, struct pci_dev *from);
+ const struct pci_dev *from);
+struct pci_dev *pci_find_class (unsigned int class, const struct pci_dev *from);
struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn);
int pci_find_capability (struct pci_dev *dev, int cap);
@@ -526,8 +531,8 @@ int pci_register_driver(struct pci_driver *);
void pci_unregister_driver(struct pci_driver *);
void pci_insert_device(struct pci_dev *, struct pci_bus *);
void pci_remove_device(struct pci_dev *);
-struct pci_driver *pci_dev_driver(struct pci_dev *);
-const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, struct pci_dev *dev);
+struct pci_driver *pci_dev_driver(const struct pci_dev *);
+const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev);
/*
* If the system does not have PCI, clearly these return errors. Define
@@ -548,17 +553,17 @@ extern inline int pcibios_present(void) { return 0; }
_PCI_NOP_ALL(read, *)
_PCI_NOP_ALL(write,)
-extern inline struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, struct pci_dev *from)
+extern inline struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from)
{ return NULL; }
-extern inline struct pci_dev *pci_find_class(unsigned int class, struct pci_dev *from)
+extern inline struct pci_dev *pci_find_class(unsigned int class, const struct pci_dev *from)
{ return NULL; }
extern inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn)
{ return NULL; }
extern inline struct pci_dev *pci_find_subsys(unsigned int vendor, unsigned int device,
-unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from)
+unsigned int ss_vendor, unsigned int ss_device, const struct pci_dev *from)
{ return NULL; }
extern inline void pci_set_master(struct pci_dev *dev) { }
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 23e74d28b..ffc2aa7f3 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -829,6 +829,7 @@
#define PCI_VENDOR_ID_ATT 0x11c1
#define PCI_DEVICE_ID_ATT_L56XMF 0x0440
+#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480
#define PCI_VENDOR_ID_SPECIALIX 0x11cb
#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000
@@ -1020,7 +1021,15 @@
#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a
#define PCI_VENDOR_ID_LAVA 0x1407
-#define PCI_DEVICE_ID_LAVA_DUAL_SERIAL 0x0100
+#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */
+#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */
+#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */
+#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */
+#define PCI_DEVICE_ID_LAVA_QUAD_A 0x0201 /* 2x 16650, half of 4 port */
+#define PCI_DEVICE_ID_LAVA_QUAD_B 0x0202 /* 2x 16650, half of 4 port */
+#define PCI_DEVICE_ID_LAVA_SSERIAL 0x0500 /* 1x 16550 */
+#define PCI_DEVICE_ID_LAVA_PORT_650 0x0600 /* 1x 16650 */
+
#define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000
#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */
#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */
@@ -1031,6 +1040,8 @@
#define PCI_VENDOR_ID_OXSEMI 0x1415
#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501
+#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x950A
+#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511
#define PCI_VENDOR_ID_PANACOM 0x14d4
#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400
diff --git a/include/linux/pm.h b/include/linux/pm.h
new file mode 100644
index 000000000..8108f3764
--- /dev/null
+++ b/include/linux/pm.h
@@ -0,0 +1,157 @@
+/*
+ * pm.h - Power management interface
+ *
+ * Copyright (C) 2000 Andrew Henroid
+ *
+ * This program 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _LINUX_PM_H
+#define _LINUX_PM_H
+
+#include <linux/config.h>
+#include <linux/list.h>
+
+/*
+ * Power management requests
+ */
+enum
+{
+ PM_SUSPEND, /* enter D1-D3 */
+ PM_RESUME, /* enter D0 */
+
+ /* enable wake-on */
+ PM_SET_WAKEUP,
+
+ /* bus resource management */
+ PM_GET_RESOURCES,
+ PM_SET_RESOURCES,
+
+ /* base station management */
+ PM_EJECT,
+ PM_LOCK,
+};
+
+typedef int pm_request_t;
+
+/*
+ * Device types
+ */
+enum
+{
+ PM_UNKNOWN_DEV = 0, /* generic */
+ PM_SYS_DEV, /* system device (fan, KB controller, ...) */
+ PM_PCI_DEV, /* PCI device */
+ PM_USB_DEV, /* USB device */
+ PM_SCSI_DEV, /* SCSI device */
+ PM_ISA_DEV, /* ISA device */
+};
+
+typedef int pm_dev_t;
+
+/*
+ * System device hardware ID (PnP) values
+ */
+enum
+{
+ PM_SYS_UNKNOWN = 0x00000000, /* generic */
+ PM_SYS_KBC = 0x41d00303, /* keyboard controller */
+ PM_SYS_COM = 0x41d00500, /* serial port */
+ PM_SYS_FDC = 0x41d00700, /* floppy controller */
+ PM_SYS_VGA = 0x41d00900, /* VGA controller */
+};
+
+/*
+ * Device identifier
+ */
+#define PM_PCI_ID(dev) ((dev)->bus->number << 16 | (dev)->devfn)
+
+/*
+ * Request handler callback
+ */
+struct pm_dev;
+
+typedef int (*pm_callback)(struct pm_dev *dev, pm_request_t rqst, void *data);
+
+/*
+ * Dynamic device information
+ */
+struct pm_dev
+{
+ pm_dev_t type;
+ unsigned long id;
+ pm_callback callback;
+ void *data;
+
+ unsigned long flags;
+ unsigned long status;
+
+ struct list_head entry;
+};
+
+#if defined(CONFIG_ACPI) || defined(CONFIG_APM)
+
+/*
+ * Register a device with power management
+ */
+struct pm_dev *pm_register(pm_dev_t type,
+ unsigned long id,
+ pm_callback callback);
+
+/*
+ * Unregister a device with power management
+ */
+void pm_unregister(struct pm_dev *dev);
+
+/*
+ * Send a request to all devices
+ */
+int pm_send_request(pm_request_t rqst, void *data);
+
+/*
+ * Find a device
+ */
+struct pm_dev *pm_find(pm_dev_t type, struct pm_dev *from);
+
+extern inline void pm_access(struct pm_dev *dev) {}
+extern inline void pm_dev_idle(struct pm_dev *dev) {}
+
+#else // CONFIG_ACPI || CONFIG_APM
+
+extern inline struct pm_dev *pm_register(pm_dev_t type,
+ unsigned long id,
+ pm_callback callback)
+{
+ return 0;
+}
+
+extern inline void pm_unregister(struct pm_dev *dev) {}
+
+extern inline int pm_send_request(pm_request_t rqst, void *data)
+{
+ return 0;
+}
+
+extern inline struct pm_dev *pm_find(pm_dev_t type, struct pm_dev *from)
+{
+ return 0;
+}
+
+extern inline void pm_access(struct pm_dev *dev) {}
+extern inline void pm_dev_idle(struct pm_dev *dev) {}
+
+#endif // CONFIG_ACPI || CONFIG_APM
+
+#endif /* _LINUX_PM_H */
diff --git a/include/linux/random.h b/include/linux/random.h
index 10a7fd810..b830c859c 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -46,6 +46,8 @@ extern void rand_initialize(void);
extern void rand_initialize_irq(int irq);
extern void rand_initialize_blkdev(int irq, int mode);
+extern void batch_entropy_store(u32 a, u32 b, int num);
+
extern void add_keyboard_randomness(unsigned char scancode);
extern void add_mouse_randomness(__u32 mouse_data);
extern void add_interrupt_randomness(int irq);
diff --git a/include/linux/sdla_chdlc.h b/include/linux/sdla_chdlc.h
new file mode 100644
index 000000000..c82fe14b0
--- /dev/null
+++ b/include/linux/sdla_chdlc.h
@@ -0,0 +1,808 @@
+/*************************************************************************
+ sdla_chdlc.h Sangoma Cisco HDLC firmware API definitions
+
+ Author: Gideon Hack
+ Nenad Corbic <ncorbic@sangoma.com>
+
+ Copyright: (c) 1995-1999 Sangoma Technologies Inc.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the term 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.
+
+===========================================================================
+ Oct 04, 1999 Nenad Corbic Updated API support
+ Jun 02, 1999 Gideon Hack Changes for S514 usage.
+ Oct 28, 1998 Jaspreet Singh Made changes for Dual Port CHDLC.
+ Jun 11, 1998 David Fong Initial version.
+===========================================================================
+
+ Organization
+ - Compatibility notes
+ - Constants defining the shared memory control block (mailbox)
+ - Interface commands
+ - Return code from interface commands
+ - Constants for the commands (structures for casting data)
+ - UDP Management constants and structures
+
+*************************************************************************/
+
+#ifndef _SDLA_CHDLC_H
+# define _SDLC_CHDLC_H
+
+/*------------------------------------------------------------------------
+ Notes:
+
+ All structres defined in this file are byte-aligned.
+
+ Compiler Platform
+ ------------------------
+ GNU C Linux
+
+------------------------------------------------------------------------*/
+
+#ifndef PACKED
+#define PACKED __attribute__((packed))
+#endif /* PACKED */
+
+
+/* ----------------------------------------------------------------------------
+ * Constants defining the shared memory control block (mailbox)
+ * --------------------------------------------------------------------------*/
+
+#define PRI_BASE_ADDR_MB_STRUCT 0xE000 /* the base address of the mailbox structure on the adapter */
+#define SEC_BASE_ADDR_MB_STRUCT 0xE800 /* the base address of the mailbox structure on the adapter */
+#define SIZEOF_MB_DATA_BFR 2032 /* the size of the actual mailbox data area */
+#define NUMBER_MB_RESERVED_BYTES 0x0B /* the number of reserved bytes in the mailbox header area */
+
+
+#define MIN_LGTH_CHDLC_DATA_CFG 300 /* min length of the CHDLC data field (for configuration purposes) */
+#define PRI_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* PRIMARY - max length of the CHDLC data field */
+
+typedef struct {
+ unsigned char opp_flag PACKED; /* the opp flag */
+ unsigned char command PACKED; /* the user command */
+ unsigned short buffer_length PACKED; /* the data length */
+ unsigned char return_code PACKED; /* the return code */
+ unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */
+ unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; /* the data area */
+} CHDLC_MAILBOX_STRUCT;
+
+typedef struct {
+ pid_t pid_num PACKED;
+ CHDLC_MAILBOX_STRUCT cmdarea PACKED;
+
+} CMDBLOCK_STRUCT;
+
+
+
+
+/* ----------------------------------------------------------------------------
+ * Interface commands
+ * --------------------------------------------------------------------------*/
+
+/* global interface commands */
+#define READ_GLOBAL_EXCEPTION_CONDITION 0x01
+#define SET_GLOBAL_CONFIGURATION 0x02
+#define READ_GLOBAL_CONFIGURATION 0x03
+#define READ_GLOBAL_STATISTICS 0x04
+#define FLUSH_GLOBAL_STATISTICS 0x05
+#define SET_MODEM_STATUS 0x06 /* set status of DTR or RTS */
+#define READ_MODEM_STATUS 0x07 /* read status of CTS and DCD */
+#define READ_COMMS_ERROR_STATS 0x08
+#define FLUSH_COMMS_ERROR_STATS 0x09
+#define SET_TRACE_CONFIGURATION 0x0A /* set the line trace config */
+#define READ_TRACE_CONFIGURATION 0x0B /* read the line trace config */
+#define READ_TRACE_STATISTICS 0x0C /* read the trace statistics */
+#define FLUSH_TRACE_STATISTICS 0x0D /* flush the trace statistics */
+#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the S508/FT1 monitoring */
+#define SET_FT1_CONFIGURATION 0x18 /* set the FT1 configuration */
+#define READ_FT1_CONFIGURATION 0x19 /* read the FT1 configuration */
+#define TRANSMIT_ASYNC_DATA_TO_FT1 0x1A /* output asynchronous data to the FT1 */
+#define RECEIVE_ASYNC_DATA_FROM_FT1 0x1B /* receive asynchronous data from the FT1 */
+#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the FT1 monitoring */
+
+#define READ_FT1_OPERATIONAL_STATS 0x1D /* read the S508/FT1 operational statistics */
+#define SET_FT1_MODE 0x1E /* set the operational mode of the S508/FT1 module */
+
+/* CHDLC-level interface commands */
+#define READ_CHDLC_CODE_VERSION 0x20
+#define READ_CHDLC_EXCEPTION_CONDITION 0x21 /* read exception condition from the adapter */
+#define SET_CHDLC_CONFIGURATION 0x22
+#define READ_CHDLC_CONFIGURATION 0x23
+#define ENABLE_CHDLC_COMMUNICATIONS 0x24
+#define DISABLE_CHDLC_COMMUNICATIONS 0x25
+#define READ_CHDLC_LINK_STATUS 0x26
+#define READ_CHDLC_OPERATIONAL_STATS 0x27
+#define FLUSH_CHDLC_OPERATIONAL_STATS 0x28
+#define SET_CHDLC_INTERRUPT_TRIGGERS 0x30 /* set application interrupt triggers */
+#define READ_CHDLC_INTERRUPT_TRIGGERS 0x31 /* read application interrupt trigger configuration */
+
+/* Special UDP drivers management commands */
+#define CPIPE_ENABLE_TRACING 0x50
+#define CPIPE_DISABLE_TRACING 0x51
+#define CPIPE_GET_TRACE_INFO 0x52
+#define CPIPE_GET_IBA_DATA 0x53
+#define CPIPE_FT1_READ_STATUS 0x54
+#define CPIPE_DRIVER_STAT_IFSEND 0x55
+#define CPIPE_DRIVER_STAT_INTR 0x56
+#define CPIPE_DRIVER_STAT_GEN 0x57
+#define CPIPE_FLUSH_DRIVER_STATS 0x58
+#define CPIPE_ROUTER_UP_TIME 0x59
+
+/* Driver specific commands for API */
+#define CHDLC_READ_TRACE_DATA 0xE4 /* read trace data */
+#define TRACE_ALL 0x00
+#define TRACE_PROT 0x01
+#define TRACE_DATA 0x02
+
+/* ----------------------------------------------------------------------------
+ * Return codes from interface commands
+ * --------------------------------------------------------------------------*/
+
+#define COMMAND_OK 0x00
+
+/* return codes from global interface commands */
+#define NO_GLOBAL_EXCEP_COND_TO_REPORT 0x01 /* there is no CHDLC exception condition to report */
+#define LGTH_GLOBAL_CFG_DATA_INVALID 0x01 /* the length of the passed global configuration data is invalid */
+#define LGTH_TRACE_CFG_DATA_INVALID 0x01 /* the length of the passed trace configuration data is invalid */
+#define IRQ_TIMEOUT_VALUE_INVALID 0x02 /* an invalid application IRQ timeout value was selected */
+#define TRACE_CONFIG_INVALID 0x02 /* the passed line trace configuration is invalid */
+#define ADAPTER_OPERATING_FREQ_INVALID 0x03 /* an invalid adapter operating frequency was selected */
+#define TRC_DEAC_TMR_INVALID 0x03 /* the trace deactivation timer is invalid */
+#define S508_FT1_ADPTR_NOT_PRESENT 0x0C /* the S508/FT1 adapter is not present */
+#define INVALID_FT1_STATUS_SELECTION 0x0D /* the S508/FT1 status selection is invalid */
+#define FT1_OP_STATS_NOT_ENABLED 0x0D /* the FT1 operational statistics have not been enabled */
+#define FT1_OP_STATS_NOT_AVAILABLE 0x0E /* the FT1 operational statistics are not currently available */
+#define S508_FT1_MODE_SELECTION_BUSY 0x0E /* the S508/FT1 adapter is busy selecting the operational mode */
+
+/* return codes from command READ_GLOBAL_EXCEPTION_CONDITION */
+#define EXCEP_MODEM_STATUS_CHANGE 0x10 /* a modem status change occurred */
+#define EXCEP_TRC_DISABLED 0x11 /* the trace has been disabled */
+#define EXCEP_IRQ_TIMEOUT 0x12 /* IRQ timeout */
+
+/* return codes from CHDLC-level interface commands */
+#define NO_CHDLC_EXCEP_COND_TO_REPORT 0x21 /* there is no CHDLC exception condition to report */
+#define CHDLC_COMMS_DISABLED 0x21 /* communications are not currently enabled */
+#define CHDLC_COMMS_ENABLED 0x21 /* communications are currently enabled */
+#define DISABLE_CHDLC_COMMS_BEFORE_CFG 0x21 /* CHDLC communications must be disabled before setting the configuration */
+#define ENABLE_CHDLC_COMMS_BEFORE_CONN 0x21 /* communications must be enabled before using the CHDLC_CONNECT conmmand */
+#define CHDLC_CFG_BEFORE_COMMS_ENABLED 0x22 /* perform a SET_CHDLC_CONFIGURATION before enabling comms */
+#define LGTH_CHDLC_CFG_DATA_INVALID 0x22 /* the length of the passed CHDLC configuration data is invalid */
+#define LGTH_INT_TRIGGERS_DATA_INVALID 0x22 /* the length of the passed interrupt trigger data is invalid */
+#define INVALID_IRQ_SELECTED 0x23 /* in invalid IRQ was selected in the SET_CHDLC_INTERRUPT_TRIGGERS */
+#define INVALID_CHDLC_CFG_DATA 0x23 /* the passed CHDLC configuration data is invalid */
+#define IRQ_TMR_VALUE_INVALID 0x24 /* an invalid application IRQ timer value was selected */
+#define LARGER_PERCENT_TX_BFR_REQUIRED 0x24 /* a larger Tx buffer percentage is required */
+#define LARGER_PERCENT_RX_BFR_REQUIRED 0x25 /* a larger Rx buffer percentage is required */
+#define S514_BOTH_PORTS_SAME_CLK_MODE 0x26 /* S514 - both ports must have same clock mode */
+#define INVALID_CMND_HDLC_STREAM_MODE 0x4E /* the CHDLC interface command is invalid for HDLC streaming mode */
+#define INVALID_CHDLC_COMMAND 0x4F /* the defined CHDLC interface command is invalid */
+
+/* return codes from command READ_CHDLC_EXCEPTION_CONDITION */
+#define EXCEP_LINK_ACTIVE 0x30 /* the CHDLC link has become active */
+#define EXCEP_LINK_INACTIVE_MODEM 0x31 /* the CHDLC link has become inactive (modem status) */
+#define EXCEP_LINK_INACTIVE_KPALV 0x32 /* the CHDLC link has become inactive (keepalive status) */
+#define EXCEP_IP_ADDRESS_DISCOVERED 0x33 /* the IP address has been discovered */
+#define EXCEP_LOOPBACK_CONDITION 0x34 /* a loopback condition has occurred */
+
+
+/* return code from command CHDLC_SEND_WAIT and CHDLC_SEND_NO_WAIT */
+#define LINK_DISCONNECTED 0x21
+#define NO_TX_BFRS_AVAIL 0x24
+
+
+/* ----------------------------------------------------------------------------
+ * Constants for the SET_GLOBAL_CONFIGURATION/READ_GLOBAL_CONFIGURATION commands
+ * --------------------------------------------------------------------------*/
+
+/* the global configuration structure */
+typedef struct {
+ unsigned short adapter_config_options PACKED; /* adapter config options */
+ unsigned short app_IRQ_timeout PACKED; /* application IRQ timeout */
+ unsigned long adapter_operating_frequency PACKED; /* adapter operating frequency */
+} GLOBAL_CONFIGURATION_STRUCT;
+
+/* settings for the 'app_IRQ_timeout' */
+#define MAX_APP_IRQ_TIMEOUT_VALUE 5000 /* the maximum permitted IRQ timeout */
+
+
+
+/* ----------------------------------------------------------------------------
+ * Constants for the READ_GLOBAL_STATISTICS command
+ * --------------------------------------------------------------------------*/
+
+/* the global statistics structure */
+typedef struct {
+ unsigned short app_IRQ_timeout_count PACKED;
+} GLOBAL_STATS_STRUCT;
+
+
+
+/* ----------------------------------------------------------------------------
+ * Constants for the READ_COMMS_ERROR_STATS command
+ * --------------------------------------------------------------------------*/
+
+/* the communications error statistics structure */
+typedef struct {
+ unsigned short Rx_overrun_err_count PACKED;
+ unsigned short CRC_err_count PACKED; /* receiver CRC error count */
+ unsigned short Rx_abort_count PACKED; /* abort frames recvd count */
+ unsigned short Rx_dis_pri_bfrs_full_count PACKED;/* receiver disabled */
+ unsigned short comms_err_stat_reserved_1 PACKED;/* reserved for later */
+ unsigned short sec_Tx_abort_msd_Tx_int_count PACKED; /* secondary - abort frames transmitted count (missed Tx interrupt) */
+ unsigned short missed_Tx_und_int_count PACKED; /* missed tx underrun interrupt count */
+ unsigned short sec_Tx_abort_count PACKED; /*secondary-abort frames tx count */
+ unsigned short DCD_state_change_count PACKED; /* DCD state change */
+ unsigned short CTS_state_change_count PACKED; /* CTS state change */
+} COMMS_ERROR_STATS_STRUCT;
+
+
+
+/* ----------------------------------------------------------------------------
+ * Constants used for line tracing
+ * --------------------------------------------------------------------------*/
+
+/* the trace configuration structure (SET_TRACE_CONFIGURATION/READ_TRACE_CONFIGURATION commands) */
+typedef struct {
+ unsigned char trace_config PACKED; /* trace configuration */
+ unsigned short trace_deactivation_timer PACKED; /* trace deactivation timer */
+ unsigned long ptr_trace_stat_el_cfg_struct PACKED; /* a pointer to the line trace element configuration structure */
+} LINE_TRACE_CONFIG_STRUCT;
+
+/* 'trace_config' bit settings */
+#define TRACE_INACTIVE 0x00 /* trace is inactive */
+#define TRACE_ACTIVE 0x01 /* trace is active */
+#define TRACE_DELAY_MODE 0x04 /* operate the trace in delay mode */
+#define TRACE_DATA_FRAMES 0x08 /* trace Data frames */
+#define TRACE_SLARP_FRAMES 0x10 /* trace SLARP frames */
+#define TRACE_CDP_FRAMES 0x20 /* trace CDP frames */
+
+/* the line trace status element configuration structure */
+typedef struct {
+ unsigned short number_trace_status_elements PACKED; /* number of line trace elements */
+ unsigned long base_addr_trace_status_elements PACKED; /* base address of the trace element list */
+ unsigned long next_trace_element_to_use PACKED; /* pointer to the next trace element to be used */
+ unsigned long base_addr_trace_buffer PACKED; /* base address of the trace data buffer */
+ unsigned long end_addr_trace_buffer PACKED; /* end address of the trace data buffer */
+} TRACE_STATUS_EL_CFG_STRUCT;
+
+/* the line trace status element structure */
+typedef struct {
+ unsigned char opp_flag PACKED; /* opp flag */
+ unsigned short trace_length PACKED; /* trace length */
+ unsigned char trace_type PACKED; /* trace type */
+ unsigned short trace_time_stamp PACKED; /* time stamp */
+ unsigned short trace_reserved_1 PACKED; /* reserved for later use */
+ unsigned long trace_reserved_2 PACKED; /* reserved for later use */
+ unsigned long ptr_data_bfr PACKED; /* ptr to the trace data buffer */
+} TRACE_STATUS_ELEMENT_STRUCT;
+
+/* "trace_type" bit settings */
+#define TRACE_INCOMING 0x00
+#define TRACE_OUTGOINGING 0x01
+#define TRACE_INCOMING_ABORTED 0x10
+#define TRACE_INCOMING_CRC_ERROR 0x20
+#define TRACE_INCOMING_OVERRUN_ERROR 0x40
+
+
+
+/* the line trace statistics structure */
+typedef struct {
+ unsigned long frames_traced_count PACKED; /* number of frames traced */
+ unsigned long trc_frms_not_recorded_count PACKED; /* number of trace frames discarded */
+} LINE_TRACE_STATS_STRUCT;
+
+
+/* ----------------------------------------------------------------------------
+ * Constants for the FT1_MONITOR_STATUS_CTRL command
+ * --------------------------------------------------------------------------*/
+
+#define DISABLE_FT1_STATUS_STATISTICS 0x00 /* disable the FT1 status and statistics monitoring */
+#define ENABLE_READ_FT1_STATUS 0x01 /* read the FT1 operational status */
+#define ENABLE_READ_FT1_OP_STATS 0x02 /* read the FT1 operational statistics */
+#define FLUSH_FT1_OP_STATS 0x04 /* flush the FT1 operational statistics */
+
+
+
+
+/* ----------------------------------------------------------------------------
+ * Constants for the SET_CHDLC_CONFIGURATION command
+ * --------------------------------------------------------------------------*/
+
+/* the CHDLC configuration structure */
+typedef struct {
+ unsigned long baud_rate PACKED; /* the baud rate */
+ unsigned short line_config_options PACKED; /* line configuration options */
+ unsigned short modem_config_options PACKED; /* modem configration options */
+ unsigned short modem_status_timer PACKED; /* timer for monitoring modem status changes */
+ unsigned short CHDLC_API_options PACKED; /* CHDLC API options */
+ unsigned short CHDLC_protocol_options PACKED; /* CHDLC protocol options */
+ unsigned short percent_data_buffer_for_Tx PACKED; /* percentage data buffering used for Tx */
+ unsigned short CHDLC_statistics_options PACKED; /* CHDLC operational statistics options */
+ unsigned short max_CHDLC_data_field_length PACKED; /* the maximum length of the CHDLC Data field */
+ unsigned short transmit_keepalive_timer PACKED; /* the transmit keepalive timer */
+ unsigned short receive_keepalive_timer PACKED; /* the receive keepalive timer */
+ unsigned short keepalive_error_tolerance PACKED; /* the receive keepalive error tolerance */
+ unsigned short SLARP_request_timer PACKED; /* the SLARP request timer */
+ unsigned long IP_address PACKED; /* the IP address */
+ unsigned long IP_netmask PACKED; /* the IP netmask */
+ unsigned long ptr_shared_mem_info_struct PACKED; /* a pointer to the shared memory area information structure */
+ unsigned long ptr_CHDLC_Tx_stat_el_cfg_struct PACKED; /* a pointer to the transmit status element configuration structure */
+ unsigned long ptr_CHDLC_Rx_stat_el_cfg_struct PACKED; /* a pointer to the receive status element configuration structure */
+} CHDLC_CONFIGURATION_STRUCT;
+
+/* settings for the 'line_config_options' */
+#define INTERFACE_LEVEL_V35 0x0000 /* V.35 interface level */
+#define INTERFACE_LEVEL_RS232 0x0001 /* RS-232 interface level */
+
+/* settings for the 'modem_config_options' */
+
+#define DONT_RAISE_DTR_RTS_ON_EN_COMMS 0x0001
+/* don't automatically raise DTR and RTS when performing an
+ ENABLE_CHDLC_COMMUNICATIONS command */
+
+#define DONT_REPORT_CHG_IN_MODEM_STAT 0x0002
+/* don't report changes in modem status to the application */
+
+
+/* bit settings for the 'CHDLC_protocol_options' byte */
+
+#define IGNORE_DCD_FOR_LINK_STAT 0x0001
+/* ignore DCD in determining the CHDLC link status */
+
+#define IGNORE_CTS_FOR_LINK_STAT 0x0002
+/* ignore CTS in determining the CHDLC link status */
+
+#define IGNORE_KPALV_FOR_LINK_STAT 0x0004
+/* ignore keepalive frames in determining the CHDLC link status */
+
+#define HDLC_STREAMING_MODE 0x8000
+
+/* settings for the 'CHDLC_statistics_options' */
+
+#define CHDLC_TX_DATA_BYTE_COUNT_STAT 0x0001
+/* record the number of Data bytes transmitted */
+
+#define CHDLC_RX_DATA_BYTE_COUNT_STAT 0x0002
+/* record the number of Data bytes received */
+
+#define CHDLC_TX_THROUGHPUT_STAT 0x0004
+/* compute the Data frame transmit throughput */
+
+#define CHDLC_RX_THROUGHPUT_STAT 0x0008
+/* compute the Data frame receive throughput */
+
+
+/* permitted minimum and maximum values for setting the CHDLC configuration */
+#define PRI_MAX_BAUD_RATE_S508 2666666 /* PRIMARY - maximum baud rate (S508) */
+#define SEC_MAX_BAUD_RATE_S508 258064 /* SECONDARY - maximum baud rate (S508) */
+#define PRI_MAX_BAUD_RATE_S514 2750000 /* PRIMARY - maximum baud rate (S508) */
+#define SEC_MAX_BAUD_RATE_S514 515625 /* SECONDARY - maximum baud rate (S508) */
+
+#define MIN_MODEM_TIMER 0 /* minimum modem status timer */
+#define MAX_MODEM_TIMER 5000 /* maximum modem status timer */
+
+#define SEC_MAX_NO_DATA_BYTES_IN_FRAME 2048 /* SECONDARY - max length of the CHDLC data field */
+
+#define MIN_Tx_KPALV_TIMER 0 /* minimum transmit keepalive timer */
+#define MAX_Tx_KPALV_TIMER 60000 /* maximum transmit keepalive timer */
+#define DEFAULT_Tx_KPALV_TIMER 10000 /* default transmit keepalive timer */
+
+#define MIN_Rx_KPALV_TIMER 10 /* minimum receive keepalive timer */
+#define MAX_Rx_KPALV_TIMER 60000 /* maximum receive keepalive timer */
+#define DEFAULT_Rx_KPALV_TIMER 10000 /* default receive keepalive timer */
+
+#define MIN_KPALV_ERR_TOL 1 /* min kpalv error tolerance count */
+#define MAX_KPALV_ERR_TOL 20 /* max kpalv error tolerance count */
+#define DEFAULT_KPALV_ERR_TOL 3 /* default value */
+
+#define MIN_SLARP_REQ_TIMER 0 /* min transmit SLARP Request timer */
+#define MAX_SLARP_REQ_TIMER 60000 /* max transmit SLARP Request timer */
+#define DEFAULT_SLARP_REQ_TIMER 0 /* default value -- no SLARP */
+
+
+
+/* ----------------------------------------------------------------------------
+ * Constants for the READ_CHDLC_LINK_STATUS command
+ * --------------------------------------------------------------------------*/
+
+/* the CHDLC status structure */
+typedef struct {
+ unsigned char CHDLC_link_status PACKED; /* CHDLC link status */
+ unsigned char no_Data_frms_for_app PACKED; /* number of Data frames available for the application */
+ unsigned char receiver_status PACKED; /* enabled/disabled */
+ unsigned char SLARP_state PACKED; /* internal SLARP state */
+} CHDLC_LINK_STATUS_STRUCT;
+
+/* settings for the 'CHDLC_link_status' variable */
+#define CHDLC_LINK_INACTIVE 0x00 /* the CHDLC link is inactive */
+#define CHDLC_LINK_ACTIVE 0x01 /* the CHDLC link is active */
+
+
+
+/* ----------------------------------------------------------------------------
+ * Constants for the READ_CHDLC_OPERATIONAL_STATS command
+ * --------------------------------------------------------------------------*/
+
+/* the CHDLC operational statistics structure */
+typedef struct {
+
+ /* Data frame transmission statistics */
+ unsigned long Data_frames_Tx_count PACKED; /* # of frames transmitted */
+ unsigned long Data_bytes_Tx_count PACKED; /* # of bytes transmitted */
+ unsigned long Data_Tx_throughput PACKED; /* transmit throughput */
+ unsigned long no_ms_for_Data_Tx_thruput_comp PACKED; /* millisecond time used for the Tx throughput computation */
+ unsigned long Tx_Data_discard_lgth_err_count PACKED; /* number of Data frames discarded (length error) */
+ unsigned long reserved_Data_frm_Tx_stat1 PACKED; /* reserved for later */
+ unsigned long reserved_Data_frm_Tx_stat2 PACKED; /* reserved for later */
+ unsigned long reserved_Data_frm_Tx_stat3 PACKED; /* reserved for later */
+
+ /* Data frame reception statistics */
+ unsigned long Data_frames_Rx_count PACKED; /* number of frames received */
+ unsigned long Data_bytes_Rx_count PACKED; /* number of bytes received */
+ unsigned long Data_Rx_throughput PACKED; /* receive throughput */
+ unsigned long no_ms_for_Data_Rx_thruput_comp PACKED; /* millisecond time used for the Rx throughput computation */
+ unsigned long Rx_Data_discard_short_count PACKED; /* received Data frames discarded (too short) */
+ unsigned long Rx_Data_discard_long_count PACKED; /* received Data frames discarded (too long) */
+ unsigned long Rx_Data_discard_inactive_count PACKED; /* received Data frames discarded (link inactive) */
+ unsigned long reserved_Data_frm_Rx_stat1 PACKED; /* reserved for later */
+
+ /* SLARP frame transmission/reception statistics */
+ unsigned long CHDLC_SLARP_REQ_Tx_count PACKED; /* number of SLARP Request frames transmitted */
+ unsigned long CHDLC_SLARP_REQ_Rx_count PACKED; /* number of SLARP Request frames received */
+ unsigned long CHDLC_SLARP_REPLY_Tx_count PACKED; /* number of SLARP Reply frames transmitted */
+ unsigned long CHDLC_SLARP_REPLY_Rx_count PACKED; /* number of SLARP Reply frames received */
+ unsigned long CHDLC_SLARP_KPALV_Tx_count PACKED; /* number of SLARP keepalive frames transmitted */
+ unsigned long CHDLC_SLARP_KPALV_Rx_count PACKED; /* number of SLARP keepalive frames received */
+ unsigned long reserved_SLARP_stat1 PACKED; /* reserved for later */
+ unsigned long reserved_SLARP_stat2 PACKED; /* reserved for later */
+
+ /* CDP frame transmission/reception statistics */
+ unsigned long CHDLC_CDP_Tx_count PACKED; /* number of CDP frames transmitted */
+ unsigned long CHDLC_CDP_Rx_count PACKED; /* number of CDP frames received */
+ unsigned long reserved_CDP_stat1 PACKED; /* reserved for later */
+ unsigned long reserved_CDP_stat2 PACKED; /* reserved for later */
+ unsigned long reserved_CDP_stat3 PACKED; /* reserved for later */
+ unsigned long reserved_CDP_stat4 PACKED; /* reserved for later */
+ unsigned long reserved_CDP_stat5 PACKED; /* reserved for later */
+ unsigned long reserved_CDP_stat6 PACKED; /* reserved for later */
+
+ /* Incomming frames with a format error statistics */
+ unsigned short Rx_frm_incomp_CHDLC_hdr_count PACKED; /* frames received of with incomplete Cisco HDLC header */
+ unsigned short Rx_frms_too_long_count PACKED; /* frames received of excessive length count */
+ unsigned short Rx_invalid_CHDLC_addr_count PACKED; /* frames received with an invalid CHDLC address count */
+ unsigned short Rx_invalid_CHDLC_ctrl_count PACKED; /* frames received with an invalid CHDLC control field count */
+ unsigned short Rx_invalid_CHDLC_type_count PACKED; /* frames received of an invalid CHDLC frame type count */
+ unsigned short Rx_SLARP_invalid_code_count PACKED; /* SLARP frame received with an invalid packet code */
+ unsigned short Rx_SLARP_Reply_bad_IP_addr PACKED; /* SLARP Reply received - bad IP address */
+ unsigned short Rx_SLARP_Reply_bad_netmask PACKED; /* SLARP Reply received - bad netmask */
+ unsigned long reserved_frm_format_err1 PACKED; /* reserved for later */
+ unsigned long reserved_frm_format_err2 PACKED; /* reserved for later */
+ unsigned long reserved_frm_format_err3 PACKED; /* reserved for later */
+ unsigned long reserved_frm_format_err4 PACKED; /* reserved for later */
+
+ /* CHDLC timeout/retry statistics */
+ unsigned short SLARP_Rx_keepalive_TO_count PACKED; /* timeout count for incomming SLARP frames */
+ unsigned short SLARP_Request_TO_count PACKED; /* timeout count for SLARP Request frames */
+ unsigned long To_retry_reserved_stat1 PACKED; /* reserved for later */
+ unsigned long To_retry_reserved_stat2 PACKED; /* reserved for later */
+ unsigned long To_retry_reserved_stat3 PACKED; /* reserved for later */
+
+ /* CHDLC link active/inactive and loopback statistics */
+ unsigned short link_active_count PACKED; /* number of times that the link went active */
+ unsigned short link_inactive_modem_count PACKED; /* number of times that the link went inactive (modem failure) */
+ unsigned short link_inactive_keepalive_count PACKED; /* number of times that the link went inactive (keepalive failure) */
+ unsigned short link_looped_count PACKED; /* link looped count */
+ unsigned long link_status_reserved_stat1 PACKED; /* reserved for later use */
+ unsigned long link_status_reserved_stat2 PACKED; /* reserved for later use */
+
+ /* miscellaneous statistics */
+ unsigned long reserved_misc_stat1 PACKED; /* reserved for later */
+ unsigned long reserved_misc_stat2 PACKED; /* reserved for later */
+ unsigned long reserved_misc_stat3 PACKED; /* reserved for later */
+ unsigned long reserved_misc_stat4 PACKED; /* reserved for later */
+
+} CHDLC_OPERATIONAL_STATS_STRUCT;
+
+
+
+/* ----------------------------------------------------------------------------
+ * Constants for using application interrupts
+ * --------------------------------------------------------------------------*/
+
+/* the structure used for the SET_CHDLC_INTERRUPT_TRIGGERS/READ_CHDLC_INTERRUPT_TRIGGERS command */
+typedef struct {
+ unsigned char CHDLC_interrupt_triggers PACKED; /* CHDLC interrupt trigger configuration */
+ unsigned char IRQ PACKED; /* IRQ to be used */
+ unsigned short interrupt_timer PACKED; /* interrupt timer */
+ unsigned short misc_interrupt_bits PACKED; /* miscellaneous bits */
+} CHDLC_INT_TRIGGERS_STRUCT;
+
+/* 'CHDLC_interrupt_triggers' bit settings */
+#define APP_INT_ON_RX_FRAME 0x01 /* interrupt on Data frame reception */
+#define APP_INT_ON_TX_FRAME 0x02 /* interrupt when an Data frame may be transmitted */
+#define APP_INT_ON_COMMAND_COMPLETE 0x04 /* interrupt when an interface command is complete */
+#define APP_INT_ON_TIMER 0x08 /* interrupt on a defined millisecond timeout */
+#define APP_INT_ON_GLOBAL_EXCEP_COND 0x10 /* interrupt on a global exception condition */
+#define APP_INT_ON_CHDLC_EXCEP_COND 0x20 /* interrupt on an CHDLC exception condition */
+#define APP_INT_ON_TRACE_DATA_AVAIL 0x80 /* interrupt when trace data is available */
+
+/* interrupt types indicated at 'interrupt_type' byte of the INTERRUPT_INFORMATION_STRUCT */
+#define NO_APP_INTS_PEND 0x00 /* no interrups are pending */
+#define RX_APP_INT_PEND 0x01 /* a receive interrupt is pending */
+#define TX_APP_INT_PEND 0x02 /* a transmit interrupt is pending */
+#define COMMAND_COMPLETE_APP_INT_PEND 0x04 /* a 'command complete' interrupt is pending */
+#define TIMER_APP_INT_PEND 0x08 /* a timer interrupt is pending */
+#define GLOBAL_EXCEP_COND_APP_INT_PEND 0x10 /* a global exception condition interrupt is pending */
+#define CHDLC_EXCEP_COND_APP_INT_PEND 0x20 /* an CHDLC exception condition interrupt is pending */
+#define TRACE_DATA_AVAIL_APP_INT_PEND 0x80 /* a trace data available interrupt is pending */
+
+
+/* modem status changes */
+#define DCD_HIGH 0x08
+#define CTS_HIGH 0x20
+
+
+/* ----------------------------------------------------------------------------
+ * Constants for Data frame transmission
+ * --------------------------------------------------------------------------*/
+
+/* the Data frame transmit status element configuration structure */
+typedef struct {
+ unsigned short number_Tx_status_elements PACKED; /* number of transmit status elements */
+ unsigned long base_addr_Tx_status_elements PACKED; /* base address of the transmit element list */
+ unsigned long next_Tx_status_element_to_use PACKED; /* pointer to the next transmit element to be used */
+} CHDLC_TX_STATUS_EL_CFG_STRUCT;
+
+/* the Data frame transmit status element structure */
+typedef struct {
+ unsigned char opp_flag PACKED; /* opp flag */
+ unsigned short frame_length PACKED; /* length of the frame to be transmitted */
+ unsigned char reserved_1 PACKED; /* reserved for internal use */
+ unsigned long reserved_2 PACKED; /* reserved for internal use */
+ unsigned long reserved_3 PACKED; /* reserved for internal use */
+ unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
+} CHDLC_DATA_TX_STATUS_EL_STRUCT;
+
+
+
+/* ----------------------------------------------------------------------------
+ * Constants for Data frame reception
+ * --------------------------------------------------------------------------*/
+
+/* the Data frame receive status element configuration structure */
+typedef struct {
+ unsigned short number_Rx_status_elements PACKED; /* number of receive status elements */
+ unsigned long base_addr_Rx_status_elements PACKED; /* base address of the receive element list */
+ unsigned long next_Rx_status_element_to_use PACKED; /* pointer to the next receive element to be used */
+ unsigned long base_addr_Rx_buffer PACKED; /* base address of the receive data buffer */
+ unsigned long end_addr_Rx_buffer PACKED; /* end address of the receive data buffer */
+} CHDLC_RX_STATUS_EL_CFG_STRUCT;
+
+/* the Data frame receive status element structure */
+typedef struct {
+ unsigned char opp_flag PACKED; /* opp flag */
+ unsigned short frame_length PACKED; /* length of the received frame */
+ unsigned char error_flag PACKED; /* frame errors (HDLC_STREAMING_MODE)*/
+ unsigned short time_stamp PACKED; /* receive time stamp (HDLC_STREAMING_MODE) */
+ unsigned long reserved_1 PACKED; /* reserved for internal use */
+ unsigned short reserved_2 PACKED; /* reserved for internal use */
+ unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
+} CHDLC_DATA_RX_STATUS_EL_STRUCT;
+
+
+
+/* ----------------------------------------------------------------------------
+ * Constants defining the shared memory information area
+ * --------------------------------------------------------------------------*/
+
+/* the global information structure */
+typedef struct {
+ unsigned char global_status PACKED; /* global status */
+ unsigned char modem_status PACKED; /* current modem status */
+ unsigned char global_excep_conditions PACKED; /* global exception conditions */
+ unsigned char glob_info_reserved[5] PACKED; /* reserved */
+ unsigned char codename[4] PACKED; /* Firmware name */
+ unsigned char codeversion[4] PACKED; /* Firmware version */
+} GLOBAL_INFORMATION_STRUCT;
+
+/* the CHDLC information structure */
+typedef struct {
+ unsigned char CHDLC_status PACKED; /* CHDLC status */
+ unsigned char CHDLC_excep_conditions PACKED; /* CHDLC exception conditions */
+ unsigned char CHDLC_info_reserved[14] PACKED; /* reserved */
+} CHDLC_INFORMATION_STRUCT;
+
+/* the interrupt information structure */
+typedef struct {
+ unsigned char interrupt_type PACKED; /* type of interrupt triggered */
+ unsigned char interrupt_permission PACKED; /* interrupt permission mask */
+ unsigned char int_info_reserved[14] PACKED; /* reserved */
+} INTERRUPT_INFORMATION_STRUCT;
+
+/* the S508/FT1 information structure */
+typedef struct {
+ unsigned char parallel_port_A_input PACKED; /* input - parallel port A */
+ unsigned char parallel_port_B_input PACKED; /* input - parallel port B */
+ unsigned char FT1_info_reserved[14] PACKED; /* reserved */
+} FT1_INFORMATION_STRUCT;
+
+/* the shared memory area information structure */
+typedef struct {
+ GLOBAL_INFORMATION_STRUCT global_info_struct PACKED; /* the global information structure */
+ CHDLC_INFORMATION_STRUCT CHDLC_info_struct PACKED; /* the CHDLC information structure */
+ INTERRUPT_INFORMATION_STRUCT interrupt_info_struct PACKED; /* the interrupt information structure */
+ FT1_INFORMATION_STRUCT FT1_info_struct PACKED; /* the S508/FT1 information structure */
+} SHARED_MEMORY_INFO_STRUCT;
+
+/* ----------------------------------------------------------------------------
+ * UDP Management constants and structures
+ * --------------------------------------------------------------------------*/
+
+/* The embedded control block for UDP mgmt
+ This is essentially a mailbox structure, without the large data field */
+
+typedef struct {
+ unsigned char opp_flag PACKED; /* the opp flag */
+ unsigned char command PACKED; /* the user command */
+ unsigned short buffer_length PACKED; /* the data length */
+ unsigned char return_code PACKED; /* the return code */
+ unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */
+} cblock_t;
+
+
+/* UDP management packet layout (data area of ip packet) */
+/*
+typedef struct {
+ unsigned char signature[8] PACKED;
+ unsigned char request_reply PACKED;
+ unsigned char id PACKED;
+ unsigned char reserved[6] PACKED;
+ cblock_t cblock PACKED;
+ unsigned char num_frames PACKED;
+ unsigned char ismoredata PACKED;
+ unsigned char data[SIZEOF_MB_DATA_BFR] PACKED;
+} udp_management_packet_t;
+
+*/
+
+typedef struct {
+ unsigned char num_frames PACKED;
+ unsigned char ismoredata PACKED;
+} trace_info_t;
+
+typedef struct {
+ ip_pkt_t ip_pkt PACKED;
+ udp_pkt_t udp_pkt PACKED;
+ wp_mgmt_t wp_mgmt PACKED;
+ cblock_t cblock PACKED;
+ trace_info_t trace_info PACKED;
+ unsigned char data[SIZEOF_MB_DATA_BFR] PACKED;
+} chdlc_udp_pkt_t;
+
+typedef struct ft1_exec_cmd{
+ unsigned char command PACKED; /* the user command */
+ unsigned short buffer_length PACKED; /* the data length */
+ unsigned char return_code PACKED; /* the return code */
+ unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED;
+} ft1_exec_cmd_t;
+
+typedef struct {
+ unsigned char opp_flag PACKED;
+ ft1_exec_cmd_t cmd PACKED;
+ unsigned char data[SIZEOF_MB_DATA_BFR] PACKED;
+} ft1_exec_t;
+
+#define UDPMGMT_SIGNATURE "CTPIPEAB"
+
+
+/* UDP/IP packet (for UDP management) layout */
+/*
+typedef struct {
+ unsigned char reserved[2] PACKED;
+ unsigned short ip_length PACKED;
+ unsigned char reserved2[4] PACKED;
+ unsigned char ip_ttl PACKED;
+ unsigned char ip_protocol PACKED;
+ unsigned short ip_checksum PACKED;
+ unsigned long ip_src_address PACKED;
+ unsigned long ip_dst_address PACKED;
+ unsigned short udp_src_port PACKED;
+ unsigned short udp_dst_port PACKED;
+ unsigned short udp_length PACKED;
+ unsigned short udp_checksum PACKED;
+ udp_management_packet_t um_packet PACKED;
+} ip_packet_t;
+*/
+
+/* valid ip_protocol for UDP management */
+#define UDPMGMT_UDP_PROTOCOL 0x11
+
+
+typedef struct {
+ unsigned char status PACKED;
+ unsigned char data_avail PACKED;
+ unsigned short real_length PACKED;
+ unsigned short time_stamp PACKED;
+ unsigned char data[1] PACKED;
+} trace_pkt_t;
+
+typedef struct {
+ unsigned char error_flag PACKED;
+ unsigned short time_stamp PACKED;
+ unsigned char reserved[13] PACKED;
+} api_rx_hdr_t;
+
+typedef struct {
+ api_rx_hdr_t api_rx_hdr PACKED;
+ void * data PACKED;
+} api_rx_element_t;
+
+typedef struct {
+ unsigned char attr PACKED;
+ unsigned char reserved[15] PACKED;
+} api_tx_hdr_t;
+
+typedef struct {
+ api_tx_hdr_t api_tx_hdr PACKED;
+ void * data PACKED;
+} api_tx_element_t;
+
+/* ----------------------------------------------------------------------------
+ * Constants for the SET_FT1_CONFIGURATION/READ_FT1_CONFIGURATION command
+ * --------------------------------------------------------------------------*/
+
+/* the FT1 configuration structure */
+typedef struct {
+ unsigned short framing_mode;
+ unsigned short encoding_mode;
+ unsigned short line_build_out;
+ unsigned short channel_base;
+ unsigned short baud_rate_kbps; /* the baud rate (in kbps) */
+ unsigned short clock_mode;
+} ft1_config_t;
+
+/* settings for the 'framing_mode' */
+#define ESF_FRAMING 0x00 /* ESF framing */
+#define D4_FRAMING 0x01 /* D4 framing */
+
+/* settings for the 'encoding_mode' */
+#define B8ZS_ENCODING 0x00 /* B8ZS encoding */
+#define AMI_ENCODING 0x01 /* AMI encoding */
+
+/* settings for the 'line_build_out' */
+#define LN_BLD_CSU_0dB_DSX1_0_to_133 0x00 /* set build out to CSU (0db) or DSX-1 (0-133ft) */
+#define LN_BLD_DSX1_133_to_266 0x01 /* set build out DSX-1 (133-266ft) */
+#define LN_BLD_DSX1_266_to_399 0x02 /* set build out DSX-1 (266-399ft) */
+#define LN_BLD_DSX1_399_to_533 0x03 /* set build out DSX-1 (399-533ft) */
+#define LN_BLD_DSX1_533_to_655 0x04 /* set build out DSX-1 (533-655ft) */
+#define LN_BLD_CSU_NEG_7dB 0x05 /* set build out to CSU (-7.5db) */
+#define LN_BLD_CSU_NEG_15dB 0x06 /* set build out to CSU (-15db) */
+#define LN_BLD_CSU_NEG_22dB 0x07 /* set build out to CSU (-22.5db) */
+
+/* settings for the 'channel_base' */
+#define MIN_CHANNEL_BASE_VALUE 1 /* the minimum permitted channel base value */
+#define MAX_CHANNEL_BASE_VALUE 24 /* the maximum permitted channel base value */
+
+/* settings for the 'baud_rate_kbps' */
+#define MIN_BAUD_RATE_KBPS 0 /* the minimum permitted baud rate (kbps) */
+#define MAX_BAUD_RATE_KBPS 1536 /* the maximum permitted baud rate (kbps) */
+#define BAUD_RATE_FT1_AUTO_CONFIG 0xFFFF /* the baud rate used to trigger an automatic FT1 configuration */
+
+/* settings for the 'clock_mode' */
+#define CLOCK_MODE_NORMAL 0x00 /* clock mode set to normal (slave) */
+#define CLOCK_MODE_MASTER 0x01 /* clock mode set to master */
+
+
+#define BAUD_RATE_FT1_AUTO_CONFIG 0xFFFF
+#define AUTO_FT1_CONFIG_NOT_COMPLETE 0x08
+#define AUTO_FT1_CFG_FAIL_OP_MODE 0x0C
+#define AUTO_FT1_CFG_FAIL_INVALID_LINE 0x0D
+
+
+#ifdef _MSC_
+# pragma pack()
+#endif
+#endif /* _SDLA_CHDLC_H */
diff --git a/include/linux/sdla_fr.h b/include/linux/sdla_fr.h
index 533f2acb0..f5aef96a5 100644
--- a/include/linux/sdla_fr.h
+++ b/include/linux/sdla_fr.h
@@ -1,16 +1,18 @@
/*****************************************************************************
* sdla_fr.h Sangoma frame relay firmware API definitions.
*
-* Author: Jaspreet Singh <jaspreet@sangoma.com>
-* Gene Kozin <74604.152@compuserve.com>
+* Author: Gideon Hack
+* Nenad Corbic <ncorbic@sangoma.com>
*
-* Copyright: (c) 1995-1996 Sangoma Technologies Inc.
+* Copyright: (c) 1995-1999 Sangoma Technologies Inc.
*
* This program 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.
* ============================================================================
+* Oct 04, 1999 Gideon Hack Updated API structures
+* Jun 02, 1999 Gideon Hack Modifications for S514 support
* Oct 12, 1997 Jaspreet Singh Added FR_READ_DLCI_IB_MAPPING
* Jul 21, 1997 Jaspreet Singh Changed FRRES_TOO_LONG and FRRES_TOO_MANY to
* 0x05 and 0x06 respectively.
@@ -24,26 +26,16 @@
/*----------------------------------------------------------------------------
* Notes:
* ------
- * 1. All structures defined in this file are byte-alined. To ensure
- * portability of this code between different platforms and compilers, one
- * of the following defines must be defined before including this file:
+ * 1. All structures defined in this file are byte-alined.
*
- * Compiler Platform Define Use option
- * -------- -------- ------ ----------
- * GNU C Linux _GNUC_ -
- * Microsoft C DOS/Windows _MSC_ -
+ * Compiler Platform
+ * -------- --------
+ * GNU C Linux
*/
-#ifdef _GNUC_
-# ifndef PACKED
+#ifndef PACKED
# define PACKED __attribute__((packed))
-# endif /* PACKED */
-#else
-# define PACKED
-#endif
-#ifdef _MSC_
-# pragma pack(1)
-#endif
+#endif /* PACKED */
/* Adapter memory layout */
#define FR_MB_VECTOR 0xE000 /* mailbox window vector */
@@ -59,6 +51,11 @@
/* Important constants */
#define FR502_MAX_DATA 4096 /* maximum data buffer length */
#define FR508_MAX_DATA 4080 /* maximum data buffer length */
+#define MIN_LGTH_FR_DATA_CFG 300 /* min Information frame length
+(for configuration purposes) */
+#define FR_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* max Information frame length */
+
+#define HIGHEST_VALID_DLCI 991
/****** Data Structures *****************************************************/
@@ -90,6 +87,7 @@ typedef struct fr_cmd
#define FR_FLUSH_STATISTICS 0x16
#define FR_LIST_ACTIVE_DLCI 0x17
#define FR_FLUSH_DATA_BUFFERS 0x18
+#define FR_READ_ADD_DLC_STATS 0x19
#define FR_ADD_DLCI 0x20
#define FR_DELETE_DLCI 0x21
#define FR_ACTIVATE_DLCI 0x22
@@ -102,6 +100,20 @@ typedef struct fr_cmd
#define FR_READ_CODE_VERSION 0x40
#define FR_SET_INTR_MODE 0x50
#define FR_READ_INTR_MODE 0x51
+#define FR_SET_TRACE_CONFIG 0x60
+#define FR_FT1_STATUS_CTRL 0x80
+#define FR_SET_FT1_MODE 0x81
+
+/* Special UDP drivers management commands */
+#define FPIPE_ENABLE_TRACING 0x41
+#define FPIPE_DISABLE_TRACING 0x42
+#define FPIPE_GET_TRACE_INFO 0x43
+#define FPIPE_FT1_READ_STATUS 0x44
+#define FPIPE_DRIVER_STAT_IFSEND 0x45
+#define FPIPE_DRIVER_STAT_INTR 0x46
+#define FPIPE_DRIVER_STAT_GEN 0x47
+#define FPIPE_FLUSH_DRIVER_STATS 0x48
+#define FPIPE_ROUTER_UP_TIME 0x49
/* 'result' field defines */
#define FRRES_OK 0x00 /* command executed successfully */
@@ -169,7 +181,7 @@ typedef struct fr508_flags
} fr508_flags_t;
/* 'event' field defines */
-#define FR_EVENT_STATUS 0x01 /* channel status change ??? */
+#define FR_EVENT_STATUS 0x01 /* channel status change */
#define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */
#define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */
#define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low */
@@ -185,6 +197,8 @@ typedef struct fr508_flags
#define FR_INTR_READY 0x08 /* interface command completed */
#define FR_INTR_DLC 0x10 /* DLC status change */
#define FR_INTR_TIMER 0x20 /* millisecond timer */
+#define FR_INTR_TX_MULT_DLCIs 0x80 /* Tx interrupt on multiple DLCIs */
+
/*----------------------------------------------------------------------------
* Receive Buffer Configuration Info. S508 only!
@@ -206,7 +220,7 @@ typedef struct fr_buf_info
* 'rse_base' field of the frBufInfo_t structure into absolute adapter
* memory address space.
*/
-typedef struct fr_buf_ctl
+typedef struct fr_rx_buf_ctl
{
unsigned char flag PACKED; /* 00h: ready flag */
unsigned short length PACKED; /* 01h: frame length */
@@ -215,7 +229,18 @@ typedef struct fr_buf_ctl
unsigned short tmstamp PACKED; /* 06h: time stamp */
unsigned short rsrv[2] PACKED; /* 08h: */
unsigned long offset PACKED; /* 0Ch: buffer absolute address */
-} fr_buf_ctl_t;
+} fr_rx_buf_ctl_t;
+
+typedef struct fr_tx_buf_ctl
+{
+ unsigned char flag PACKED; /* 00h: ready flag */
+ unsigned short rsrv0[2] PACKED; /* 01h: */
+ unsigned short length PACKED; /* 05h: frame length */
+ unsigned short dlci PACKED; /* 07h: DLCI */
+ unsigned char attr PACKED; /* 09h: FECN/BECN/DE/CR */
+ unsigned short rsrv1 PACKED; /* 0Ah: */
+ unsigned long offset PACKED; /* 0Ch: buffer absolute address */
+} fr_tx_buf_ctl_t;
/*----------------------------------------------------------------------------
* Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0.
@@ -271,6 +296,52 @@ typedef struct fr_conf
#define FRCFG_MODE_V35 0x0000 /* S508 only */
#define FRCFG_MODE_RS232 0x0002 /* S508 only */
+/* defines for line tracing */
+
+/* the line trace status element presented by the frame relay code */
+typedef struct {
+ unsigned char flag PACKED; /* ready flag */
+ unsigned short length PACKED; /* trace length */
+ unsigned char rsrv0[2] PACKED; /* reserved */
+ unsigned char attr PACKED; /* trace attributes */
+ unsigned short tmstamp PACKED; /* time stamp */
+ unsigned char rsrv1[4] PACKED; /* reserved */
+ unsigned long offset PACKED; /* buffer absolute address */
+} fr_trc_el_t;
+
+typedef struct {
+ unsigned char status PACKED; /* status flag */
+ unsigned char data_passed PACKED; /* 0 if no data passed, 1 if */
+ /* data passed */
+ unsigned short length PACKED; /* frame length */
+ unsigned short tmstamp PACKED; /* time stamp */
+} fpipemon_trc_hdr_t;
+
+typedef struct {
+ fpipemon_trc_hdr_t fpipemon_trc_hdr PACKED;
+ unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] PACKED;
+} fpipemon_trc_t;
+
+/* bit settings for the 'status' byte - note that bits 1, 2 and 3 are used */
+/* for returning the number of frames being passed to fpipemon */
+#define TRC_OUTGOING_FRM 0x01
+#define TRC_ABORT_ERROR 0x10
+#define TRC_CRC_ERROR 0x20
+#define TRC_OVERRUN_ERROR 0x40
+#define MORE_TRC_DATA 0x80
+
+#define MAX_FRMS_TRACED 0x07
+
+#define NO_TRC_ELEMENTS_OFF 0x9000
+#define BASE_TRC_ELEMENTS_OFF 0x9002
+#define TRC_ACTIVE 0x01
+#define FLUSH_TRC_BUFFERS 0x02
+#define FLUSH_TRC_STATISTICS 0x04
+#define TRC_SIGNALLING_FRMS 0x10
+#define TRC_INFO_FRMS 0x20
+#define ACTIVATE_TRC (TRC_ACTIVE | TRC_SIGNALLING_FRMS | TRC_INFO_FRMS)
+#define RESET_TRC (FLUSH_TRC_BUFFERS | FLUSH_TRC_STATISTICS)
+
/*----------------------------------------------------------------------------
* Channel configuration.
* This structure is passed to the FR_SET_CONFIG command when dlci != 0.
@@ -415,6 +486,151 @@ typedef struct fr_comm_stat
#define FR_ISF_LVE 2 /* issue Link Verification Enquiry */
#define FR_ISF_FSE 3 /* issue Full Status Enquiry */
+/*----------------------------------------------------------------------------
+ * Frame Relay ARP Header -- Used for Dynamic route creation with InvARP
+ */
+
+typedef struct arphdr_fr
+ {
+ unsigned short ar_hrd PACKED; /* format of hardware addr */
+ unsigned short ar_pro PACKED; /* format of protocol addr */
+ unsigned char ar_hln PACKED; /* length of hardware addr */
+ unsigned char ar_pln PACKED; /* length of protocol addr */
+ unsigned short ar_op PACKED; /* ARP opcode */
+ unsigned short ar_sha PACKED; /* Sender DLCI addr 2 bytes */
+ unsigned long ar_sip PACKED; /* Sender IP addr 4 bytes */
+ unsigned short ar_tha PACKED; /* Target DLCI addr 2 bytes */
+ unsigned long ar_tip PACKED; /* Target IP addr 4 bytes */
+ } arphdr_fr_t;
+
+/*----------------------------------------------------------------------------
+ * Frame Relay RFC 1490 SNAP Header -- Used to check for ARP packets
+ */
+typedef struct arphdr_1490
+ {
+ unsigned char control PACKED; /* UI, etc... */
+ unsigned char pad PACKED; /* Pad */
+ unsigned char NLPID PACKED; /* SNAP */
+ unsigned char OUI[3] PACKED; /* Ethertype, etc... */
+ unsigned short PID PACKED; /* ARP, IP, etc... */
+ } arphdr_1490_t;
+
+/* UDP/IP packet (for UDP management) layout */
+
+/* The embedded control block for UDP mgmt
+ This is essentially a mailbox structure, without the large data field */
+
+typedef struct {
+ unsigned char opp_flag PACKED; /* the opp flag */
+ unsigned char command PACKED; /* command code */
+ unsigned short length PACKED; /* length of data buffer */
+ unsigned char result PACKED; /* return code */
+ unsigned short dlci PACKED; /* DLCI number */
+ unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
+ unsigned short rxlost1 PACKED; /* frames discarded at int. level */
+ unsigned long rxlost2 PACKED; /* frames discarded at app. level */
+ unsigned char rsrv[2] PACKED; /* reserved for future use */
+} cblock_t;
+
+
+/* UDP management packet layout (data area of ip packet) */
+
+typedef struct {
+ unsigned char control PACKED;
+ unsigned char NLPID PACKED;
+} fr_encap_hdr_t;
+
+typedef struct {
+ fr_encap_hdr_t fr_encap_hdr PACKED;
+ ip_pkt_t ip_pkt PACKED;
+ udp_pkt_t udp_pkt PACKED;
+ wp_mgmt_t wp_mgmt PACKED;
+ cblock_t cblock PACKED;
+ unsigned char data[4080] PACKED;
+} fr_udp_pkt_t;
+
+
+/* valid ip_protocol for UDP management */
+#define UDPMGMT_UDP_PROTOCOL 0x11
+
+#define UDPMGMT_FPIPE_SIGNATURE "FPIPE8ND"
+#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS"
+
+/* values for request/reply byte */
+#define UDPMGMT_REQUEST 0x01
+#define UDPMGMT_REPLY 0x02
+#define UDP_OFFSET 12
+
+typedef struct {
+ unsigned long if_send_entry;
+ unsigned long if_send_skb_null;
+ unsigned long if_send_broadcast;
+ unsigned long if_send_multicast;
+ unsigned long if_send_critical_ISR;
+ unsigned long if_send_critical_non_ISR;
+ unsigned long if_send_busy;
+ unsigned long if_send_busy_timeout;
+ unsigned long if_send_DRVSTATS_request;
+ unsigned long if_send_FPIPE_request;
+ unsigned long if_send_wan_disconnected;
+ unsigned long if_send_dlci_disconnected;
+ unsigned long if_send_no_bfrs;
+ unsigned long if_send_adptr_bfrs_full;
+ unsigned long if_send_bfrs_passed_to_adptr;
+ unsigned long if_send_consec_send_fail;
+} drvstats_if_send_t;
+
+typedef struct {
+ unsigned long rx_intr_no_socket;
+ unsigned long rx_intr_dev_not_started;
+ unsigned long rx_intr_DRVSTATS_request;
+ unsigned long rx_intr_FPIPE_request;
+ unsigned long rx_intr_bfr_not_passed_to_stack;
+ unsigned long rx_intr_bfr_passed_to_stack;
+ } drvstats_rx_intr_t;
+
+typedef struct {
+ unsigned long UDP_FPIPE_mgmt_kmalloc_err;
+ unsigned long UDP_FPIPE_mgmt_direction_err;
+ unsigned long UDP_FPIPE_mgmt_adptr_type_err;
+ unsigned long UDP_FPIPE_mgmt_adptr_cmnd_OK;
+ unsigned long UDP_FPIPE_mgmt_adptr_cmnd_timeout;
+ unsigned long UDP_FPIPE_mgmt_adptr_send_passed;
+ unsigned long UDP_FPIPE_mgmt_adptr_send_failed;
+ unsigned long UDP_FPIPE_mgmt_not_passed_to_stack;
+ unsigned long UDP_FPIPE_mgmt_passed_to_stack;
+ unsigned long UDP_FPIPE_mgmt_no_socket;
+ unsigned long UDP_DRVSTATS_mgmt_kmalloc_err;
+ unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_OK;
+ unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_timeout;
+ unsigned long UDP_DRVSTATS_mgmt_adptr_send_passed;
+ unsigned long UDP_DRVSTATS_mgmt_adptr_send_failed;
+ unsigned long UDP_DRVSTATS_mgmt_not_passed_to_stack;
+ unsigned long UDP_DRVSTATS_mgmt_passed_to_stack;
+ unsigned long UDP_DRVSTATS_mgmt_no_socket;
+} drvstats_gen_t;
+
+typedef struct {
+ unsigned char attr PACKED;
+ unsigned short time_stamp PACKED;
+ unsigned char reserved[13] PACKED;
+} api_rx_hdr_t;
+
+typedef struct {
+ api_rx_hdr_t api_rx_hdr PACKED;
+ void * data PACKED;
+} api_rx_element_t;
+
+typedef struct {
+ unsigned char attr PACKED;
+ unsigned char reserved[15] PACKED;
+} api_tx_hdr_t;
+
+typedef struct {
+ api_tx_hdr_t api_tx_hdr PACKED;
+ void * data PACKED;
+} api_tx_element_t;
+
#ifdef _MSC_
# pragma pack()
#endif
diff --git a/include/linux/sdla_ppp.h b/include/linux/sdla_ppp.h
index 267986833..95d5c0fe0 100644
--- a/include/linux/sdla_ppp.h
+++ b/include/linux/sdla_ppp.h
@@ -19,38 +19,25 @@
/*----------------------------------------------------------------------------
* Notes:
* ------
- * 1. All structures defined in this file are byte-alined. To ensure
- * portability of this code between different platforms and compilers, one
- * of the following defines must be defined before including this file:
+ * 1. All structures defined in this file are byte-alined.
*
- * Compiler Platform Define Use option
- * -------- -------- ------ ----------
- * GNU C Linux _GNUC_ -
- * Microsoft C DOS/Windows _MSC_ -
+ * Compiler Platform
+ * -------- --------
+ * GNU C Linux
*/
-#ifdef _GNUC_
-# ifndef PACKED
+#ifndef PACKED
# define PACKED __attribute__((packed))
-# endif /* PACKED */
-#else
-# define PACKED
-#endif
-#ifdef _MSC_
-# pragma pack(1)
-#endif
+#endif /* PACKED */
/* Adapter memory layout and important constants */
-
-#define PPP502_MB_VECT 0xA000 /* mailbox window vector */
-#define PPP502_MB_OFFS 0x1C00 /* mailbox offset */
-#define PPP502_FLG_OFFS 0 /* status flags offset */
-#define PPP502_BUF_OFFS 0x0010 /* buffer info block offset */
-
#define PPP508_MB_VECT 0xE000 /* mailbox window vector */
-#define PPP508_MB_OFFS 0 /* mailbox offset */
+#define PPP508_MB_OFFS 0 /* mailbox offset */
#define PPP508_FLG_OFFS 0x1000 /* status flags offset */
#define PPP508_BUF_OFFS 0x1100 /* buffer info block offset */
+#define PPP514_MB_OFFS 0xE000 /* mailbox offset */
+#define PPP514_FLG_OFFS 0xF000 /* status flags offset */
+#define PPP514_BUF_OFFS 0xF100 /* buffer info block offset */
#define PPP_MAX_DATA 1008 /* command block data buffer length */
@@ -59,14 +46,46 @@
/*----------------------------------------------------------------------------
* PPP Command Block.
*/
-typedef struct ppp_cmd
-{
+typedef struct ppp_cmd{
unsigned char command PACKED; /* command code */
unsigned short length PACKED; /* length of data buffer */
unsigned char result PACKED; /* return code */
unsigned char rsrv[11] PACKED; /* reserved for future use */
} ppp_cmd_t;
+typedef struct cblock{
+ unsigned char opp_flag PACKED;
+ unsigned char command PACKED; /* command code */
+ unsigned short length PACKED; /* length of data buffer */
+ unsigned char result PACKED; /* return code */
+ unsigned char rsrv[11] PACKED; /* reserved for future use */
+} cblock_t;
+
+typedef struct ppp_udp_pkt{
+ ip_pkt_t ip_pkt PACKED;
+ udp_pkt_t udp_pkt PACKED;
+ wp_mgmt_t wp_mgmt PACKED;
+ cblock_t cblock PACKED;
+ unsigned char data[MAX_LGTH_UDP_MGNT_PKT] PACKED;
+} ppp_udp_pkt_t;
+
+typedef struct {
+ unsigned char status PACKED;
+ unsigned char data_avail PACKED;
+ unsigned short real_length PACKED;
+ unsigned short time_stamp PACKED;
+ unsigned char data[1] PACKED;
+} trace_pkt_t;
+
+
+typedef struct {
+ unsigned char opp_flag PACKED;
+ unsigned char trace_type PACKED;
+ unsigned short trace_length PACKED;
+ unsigned short trace_data_ptr PACKED;
+ unsigned short trace_time_stamp PACKED;
+} trace_element_t;
+
/* 'command' field defines */
#define PPP_READ_CODE_VERSION 0x10 /* configuration commands */
#define PPP_SET_CONFIG 0x05
@@ -145,26 +164,46 @@ typedef struct ppp_flags
#define PPP_INTR_DISC 0x10 /* data link disconnected */
#define PPP_INTR_OPEN 0x20 /* data link open */
#define PPP_INTR_DROP_DTR 0x40 /* DTR drop timeout expired */
+#define PPP_INTR_TIMER 0x80 /* timer interrupt */
+
/* 'mstatus' defines */
#define PPP_MDM_DCD 0x08 /* mdm_status: DCD */
#define PPP_MDM_CTS 0x20 /* mdm_status: CTS */
-/*----------------------------------------------------------------------------
- * PPP Buffer Info.
- * This structure is located at offset PPP502_BUF_OFFS into
- * PPP502_MB_VECT.
- */
-typedef struct ppp502_buf_info
-{
- unsigned short txb_num PACKED; /* 00: number of transmit buffers */
- unsigned short txb_offs PACKED; /* 02: offset of the buffer ctl. */
- unsigned char rsrv1[4] PACKED;
- unsigned short rxb_num PACKED; /* 08: number of receive buffers */
- unsigned short rxb_offs PACKED; /* 0A: offset of the buffer ctl. */
- unsigned char rsrv2[2] PACKED;
- unsigned short rxb_next PACKED; /* 0E: index of the next buffer */
-} ppp502_buf_info_t;
+/* 'disc_cause' defines */
+#define PPP_LOCAL_TERMINATION 0x0001 /* Local Request by PPP termination phase */
+#define PPP_DCD_CTS_DROP 0x0002 /* DCD and/or CTS dropped. Link down */
+#define PPP_REMOTE_TERMINATION 0x0800 /* Remote Request by PPP termination phase */
+
+/* 'misc_config_bits' defines */
+#define DONT_RE_TX_ABORTED_I_FRAMES 0x01
+#define TX_FRM_BYTE_COUNT_STATS 0x02
+#define RX_FRM_BYTE_COUNT_STATS 0x04
+#define TIME_STAMP_IN_RX_FRAMES 0x08
+#define NON_STD_ADPTR_FREQ 0x10
+#define INTERFACE_LEVEL_RS232 0x20
+#define AUTO_LINK_RECOVERY 0x100
+#define DONT_TERMINATE_LNK_MAX_CONFIG 0x200
+
+/* 'authentication options' defines */
+#define NO_AUTHENTICATION 0x00
+#define INBOUND_AUTH 0x80
+#define PAP_AUTH 0x01
+#define CHAP_AUTH 0x02
+
+/* 'ip options' defines */
+#define L_AND_R_IP_NO_ASSIG 0x00
+#define L_IP_LOCAL_ASSIG 0x01
+#define L_IP_REMOTE_ASSIG 0x02
+#define R_IP_LOCAL_ASSIG 0x04
+#define R_IP_REMOTE_ASSIG 0x08
+#define ENABLE_IP 0x80
+
+/* 'ipx options' defines */
+#define ROUTING_PROT_DEFAULT 0x20
+#define ENABLE_IPX 0x80
+#define DISABLE_IPX 0x00
/*----------------------------------------------------------------------------
* PPP Buffer Info.
@@ -203,37 +242,6 @@ typedef struct ppp_buf_ctl
} ppp_buf_ctl_t;
/*----------------------------------------------------------------------------
- * S502 Adapter Configuration Block (passed to the PPP_SET_CONFIG command).
- */
-typedef struct ppp502_conf
-{
- unsigned char line_speed PACKED; /* 00: 0 - external clk. */
- unsigned short txbuf_num PACKED; /* 01: number of Tx buffers */
- unsigned short conf_flags PACKED; /* 03: configuration bits */
- unsigned short mtu_local PACKED; /* 05: local MTU */
- unsigned short mtu_remote PACKED; /* 07: remote MTU */
- unsigned short restart_tmr PACKED; /* 09: restart timer */
- unsigned short auth_rsrt_tmr PACKED; /* 0B: authentication timer */
- unsigned short auth_wait_tmr PACKED; /* 0D: authentication timer */
- unsigned short mdm_fail_tmr PACKED; /* 0F: modem failure timer */
- unsigned short dtr_drop_tmr PACKED; /* 11: DTR drop timer */
- unsigned short connect_tmout PACKED; /* 13: connection timeout */
- unsigned short conf_retry PACKED; /* 15: max. retry */
- unsigned short term_retry PACKED; /* 17: max. retry */
- unsigned short fail_retry PACKED; /* 19: max. retry */
- unsigned short auth_retry PACKED; /* 1B: max. retry */
- unsigned char auth_options PACKED; /* 1D: authentication opt. */
- unsigned char ip_options PACKED; /* 1E: IP options */
- unsigned char ip_local[4] PACKED; /* 1F: local IP address */
- unsigned char ip_remote[4] PACKED; /* 23: remote IP address */
- unsigned char ipx_options PACKED; /* 27: IPX options */
- unsigned char ipx_netno[4] PACKED; /* 28: IPX net number */
- unsigned char ipx_local[6] PACKED; /* 2C: local IPX node number*/
- unsigned char ipx_remote[6] PACKED; /* 32: remote IPX node num.*/
- unsigned char ipx_router[48] PACKED; /* 38: IPX router name*/
-} ppp502_conf_t;
-
-/*----------------------------------------------------------------------------
* S508 Adapter Configuration Block (passed to the PPP_SET_CONFIG command).
*/
typedef struct ppp508_conf
@@ -255,8 +263,8 @@ typedef struct ppp508_conf
unsigned short auth_retry PACKED; /* 1E: max. retry */
unsigned char auth_options PACKED; /* 20: authentication opt. */
unsigned char ip_options PACKED; /* 21: IP options */
- unsigned char ip_local[4] PACKED; /* 22: local IP address */
- unsigned char ip_remote[4] PACKED; /* 26: remote IP address */
+ unsigned long ip_local PACKED; /* 22: local IP address */
+ unsigned long ip_remote PACKED; /* 26: remote IP address */
unsigned char ipx_options PACKED; /* 2A: IPX options */
unsigned char ipx_netno[4] PACKED; /* 2B: IPX net number */
unsigned char ipx_local[6] PACKED; /* 2F: local IPX node number*/
@@ -265,6 +273,25 @@ typedef struct ppp508_conf
unsigned long alt_cpu_clock PACKED; /* 6B: */
} ppp508_conf_t;
+/*----------------------------------------------------------------------------
+ * S508 Adapter Read Connection Information Block
+ * Returned by the PPP_GET_CONNECTION_INFO command
+ */
+typedef struct ppp508_connect_info
+{
+ unsigned short mru PACKED; /* 00-01 Remote Max Rec' Unit */
+ unsigned char ip_options PACKED; /* 02: Negotiated ip options */
+ unsigned long ip_local PACKED; /* 03-06: local IP address */
+ unsigned long ip_remote PACKED; /* 07-0A: remote IP address */
+ unsigned char ipx_options PACKED; /* 0B: Negotiated ipx options */
+ unsigned char ipx_netno[4] PACKED; /* 0C-0F: IPX net number */
+ unsigned char ipx_local[6] PACKED; /* 10-1F: local IPX node # */
+ unsigned char ipx_remote[6] PACKED; /* 16-1B: remote IPX node # */
+ unsigned char ipx_router[48] PACKED; /* 1C-4B: IPX router name */
+ unsigned char auth_status PACKED; /* 4C: Authentication Status */
+ unsigned char inbd_auth_peerID[1] PACKED; /* 4D: variable length inbound authenticated peer ID */
+} ppp508_connect_info_t;
+
/* 'line_speed' field */
#define PPP_BITRATE_1200 0x01
#define PPP_BITRATE_2400 0x02
@@ -303,16 +330,6 @@ typedef struct ppp508_conf
#define PPP_IPX_ENABLE 0x80
/*----------------------------------------------------------------------------
- * S502 Adapter Configuration Block (returned by the PPP_READ_CONFIG command).
- */
-typedef struct ppp502_get_conf
-{
- ppp502_conf_t conf PACKED; /* 00: requested config. */
- unsigned short txb_num PACKED; /* 68: number of Tx buffers */
- unsigned short rxb_num PACKED; /* 6A: number of Rx buffers */
-} ppp502_get_conf_t;
-
-/*----------------------------------------------------------------------------
* S508 Adapter Configuration Block (returned by the PPP_READ_CONFIG command).
*/
typedef struct ppp508_get_conf
@@ -324,20 +341,6 @@ typedef struct ppp508_get_conf
} ppp508_get_conf_t;
/*----------------------------------------------------------------------------
- * S502 Operational Statistics (returned by the PPP_READ_STATISTIC command).
- */
-typedef struct ppp502_Stats
-{
- unsigned short rx_lost_intr PACKED; /* 00: */
- unsigned short rx_lost_buff PACKED; /* 02: */
- unsigned short tx_abort PACKED; /* 04: */
- unsigned long tx_frames PACKED; /* 06: */
- unsigned long tx_bytes PACKED; /* 0A: */
- unsigned long rx_frames PACKED; /* 0E: */
- unsigned long rx_bytes PACKED; /* 12: */
-} ppp502_Stats_t;
-
-/*----------------------------------------------------------------------------
* S508 Operational Statistics (returned by the PPP_READ_STATISTIC command).
*/
typedef struct ppp508_stats
@@ -530,6 +533,40 @@ typedef struct ppp_conn_info
unsigned char peer_id[0] PACKED; /* 4D: */
} ppp_conn_info_t;
+/* Data structure for SET_TRIGGER_INTR command
+ */
+
+typedef struct ppp_intr_info{
+ unsigned char i_enable PACKED; /* 0 Interrupt enable bits */
+ unsigned char irq PACKED; /* 1 Irq number */
+ unsigned short timer_len PACKED; /* 2 Timer delay */
+} ppp_intr_info_t;
+
+
+#define FT1_MONITOR_STATUS_CTRL 0x80
+#define SET_FT1_MODE 0x81
+
+
+
+/* Special UDP drivers management commands */
+#define PPIPE_ENABLE_TRACING 0x20
+#define PPIPE_DISABLE_TRACING 0x21
+#define PPIPE_GET_TRACE_INFO 0x22
+#define PPIPE_GET_IBA_DATA 0x23
+#define PPIPE_KILL_BOARD 0x24
+#define PPIPE_FT1_READ_STATUS 0x25
+#define PPIPE_DRIVER_STAT_IFSEND 0x26
+#define PPIPE_DRIVER_STAT_INTR 0x27
+#define PPIPE_DRIVER_STAT_GEN 0x28
+#define PPIPE_FLUSH_DRIVER_STATS 0x29
+#define PPIPE_ROUTER_UP_TIME 0x30
+
+#define DISABLE_TRACING 0x00
+#define TRACE_SIGNALLING_FRAMES 0x01
+#define TRACE_DATA_FRAMES 0x02
+
+
+
#ifdef _MSC_
# pragma pack()
#endif
diff --git a/include/linux/sdladrv.h b/include/linux/sdladrv.h
index 23ae8a1e2..724fd6c75 100644
--- a/include/linux/sdladrv.h
+++ b/include/linux/sdladrv.h
@@ -1,15 +1,16 @@
/*****************************************************************************
* sdladrv.h SDLA Support Module. Kernel API Definitions.
*
-* Author: Gene Kozin <genek@compuserve.com>
+* Author: Gideon Hack
*
-* Copyright: (c) 1995-1996 Sangoma Technologies Inc.
+* Copyright: (c) 1995-1999 Sangoma Technologies Inc.
*
* This program 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.
* ============================================================================
+* Jun 02, 1999 Gideon Hack Added support for the S514 PCI adapter.
* Dec 11, 1996 Gene Kozin Complete overhaul.
* Oct 17, 1996 Gene Kozin Minor bug fixes.
* Jun 12, 1996 Gene Kozin Added support for S503 card.
@@ -18,6 +19,11 @@
#ifndef _SDLADRV_H
#define _SDLADRV_H
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= 0x020100
+#define LINUX_2_1
+#endif
+
#define SDLA_MAXIORANGE 4 /* maximum I/O port range */
#define SDLA_WINDOWSIZE 0x2000 /* default dual-port memory window size */
@@ -33,6 +39,14 @@ typedef struct sdlahw
unsigned fwid; /* firmware ID */
unsigned port; /* adapter I/O port base */
int irq; /* interrupt request level */
+ char S514_cpu_no[1]; /* PCI CPU Number */
+ unsigned char S514_slot_no; /* PCI Slot Number */
+#ifdef LINUX_2_1
+ struct pci_dev *pci_dev; /* PCI device */
+#else
+ unsigned char pci_bus; /* PCI bus number */
+ unsigned char pci_dev_func; /* PCI device/function number */
+#endif
void * dpmbase; /* dual-port memory base */
unsigned dpmsize; /* dual-port memory size */
unsigned pclk; /* CPU clock rate, kHz */
@@ -50,6 +64,8 @@ extern int sdla_down (sdlahw_t* hw);
extern int sdla_inten (sdlahw_t* hw);
extern int sdla_intde (sdlahw_t* hw);
extern int sdla_intack (sdlahw_t* hw);
+extern void S514_intack (sdlahw_t* hw, u32 int_status);
+extern void read_S514_int_stat (sdlahw_t* hw, u32* int_status);
extern int sdla_intr (sdlahw_t* hw);
extern int sdla_mapmem (sdlahw_t* hw, unsigned long addr);
extern int sdla_peek (sdlahw_t* hw, unsigned long addr, void* buf,
diff --git a/include/linux/sdlapci.h b/include/linux/sdlapci.h
new file mode 100644
index 000000000..857fd062c
--- /dev/null
+++ b/include/linux/sdlapci.h
@@ -0,0 +1,68 @@
+/*****************************************************************************
+* sdlapci.h WANPIPE(tm) Multiprotocol WAN Link Driver.
+* Definitions for the SDLA PCI adapter.
+*
+* Author: Gideon Hack <ghack@sangoma.com>
+*
+* Copyright: (c) 1999 Sangoma Technologies Inc.
+*
+* This program 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.
+* ============================================================================
+* Jun 02, 1999 Gideon Hack Initial version.
+*****************************************************************************/
+#ifndef _SDLAPCI_H
+#define _SDLAPCI_H
+
+/****** Defines *************************************************************/
+
+/* Definitions for identifying and finding S514 PCI adapters */
+#define V3_VENDOR_ID 0x11B0 /* V3 vendor ID number */
+#define V3_DEVICE_ID 0x0002 /* V3 device ID number */
+#define SANGOMA_SUBSYS_VENDOR 0x4753 /* ID for Sangoma */
+#define PCI_DEV_SLOT_MASK 0x1F /* mask for slot numbering */
+#define PCI_IRQ_NOT_ALLOCATED 0xFF /* interrupt line for no IRQ */
+
+/* Local PCI register offsets */
+#define PCI_VENDOR_ID_WORD 0x00 /* vendor ID */
+#define PCI_IO_BASE_DWORD 0x10 /* IO base */
+#define PCI_MEM_BASE0_DWORD 0x14 /* memory base - apperture 0 */
+#define PCI_MEM_BASE1_DWORD 0x18 /* memory base - apperture 1 */
+#define PCI_SUBSYS_VENDOR_WORD 0x2C /* subsystem vendor ID */
+#define PCI_INT_LINE_BYTE 0x3C /* interrupt line */
+#define PCI_INT_PIN_BYTE 0x3D /* interrupt pin */
+#define PCI_MAP0_DWORD 0x40 /* PCI to local bus address 0 */
+#define PCI_MAP1_DWORD 0x44 /* PCI to local bus address 1 */
+#define PCI_INT_STATUS 0x48 /* interrupt status */
+#define PCI_INT_CONFIG 0x4C /* interrupt configuration */
+
+/* Local PCI register usage */
+#define PCI_MEMORY_ENABLE 0x00000003 /* enable PCI memory */
+#define PCI_CPU_A_MEM_DISABLE 0x00000002 /* disable CPU A memory */
+#define PCI_CPU_B_MEM_DISABLE 0x00100002 /* disable CPU B memory */
+#define PCI_ENABLE_IRQ_CPU_A 0x005A0004 /* enable IRQ for CPU A */
+#define PCI_ENABLE_IRQ_CPU_B 0x005A0008 /* enable IRQ for CPU B */
+#define PCI_DISABLE_IRQ_CPU_A 0x00000004 /* disable IRQ for CPU A */
+#define PCI_DISABLE_IRQ_CPU_B 0x00000008 /* disable IRQ for CPU B */
+
+/* Setting for the Interrupt Status register */
+#define IRQ_CPU_A 0x04 /* IRQ for CPU A */
+#define IRQ_CPU_B 0x08 /* IRQ for CPU B */
+
+/* The maximum size of the S514 memory */
+#define MAX_SIZEOF_S514_MEMORY (256 * 1024)
+
+/* S514 control register offsets within the memory address space */
+#define S514_CTRL_REG_BYTE 0x80000
+
+/* S514 adapter control bytes */
+#define S514_CPU_HALT 0x00
+#define S514_CPU_START 0x01
+
+/* The maximum number of S514 adapters supported */
+#define MAX_S514_CARDS 8
+
+#endif /* _SDLAPCI_H */
+
diff --git a/include/linux/sdlasfm.h b/include/linux/sdlasfm.h
index 65e7f30a8..94aaa8ada 100644
--- a/include/linux/sdlasfm.h
+++ b/include/linux/sdlasfm.h
@@ -2,15 +2,16 @@
* sdlasfm.h WANPIPE(tm) Multiprotocol WAN Link Driver.
* Definitions for the SDLA Firmware Module (SFM).
*
-* Author: Gene Kozin <74604.152@compuserve.com>
+* Author: Gideon Hack
*
-* Copyright: (c) 1995-1996 Sangoma Technologies Inc.
+* Copyright: (c) 1995-1999 Sangoma Technologies Inc.
*
* This program 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.
* ============================================================================
+* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
* Dec 11, 1996 Gene Kozin Cosmetic changes
* Apr 16, 1996 Gene Kozin Changed adapter & firmware IDs. Version 2
* Dec 15, 1995 Gene Kozin Structures chaned
@@ -36,6 +37,12 @@
#define SDLA_S508 5080
#define SDLA_S507 5070
#define SDLA_S509 5090
+#define SDLA_S514 5140
+
+/* S514 PCI adapter CPU numbers */
+#define S514_CPU_A 'A'
+#define S514_CPU_B 'B'
+
/* Firmware identification numbers:
* 0 .. 999 Test & Diagnostics
@@ -46,6 +53,7 @@
* 5000 .. 5999 X.25
* 6000 .. 6999 Frame Relay
* 7000 .. 7999 PPP
+ * 8000 .. 8999 Cisco HDLC
*/
#define SFID_CALIB502 200
#define SFID_STRM502 1200
@@ -53,12 +61,16 @@
#define SFID_BSC502 2200
#define SFID_SDLC502 3200
#define SFID_HDLC502 4200
+#define SFID_HDLC508 4800
#define SFID_X25_502 5200
#define SFID_X25_508 5800
#define SFID_FR502 6200
#define SFID_FR508 6800
#define SFID_PPP502 7200
#define SFID_PPP508 7800
+#define SFID_PPP514 7140
+#define SFID_CHDLC508 8800
+#define SFID_CHDLC514 8140
/****** Data Types **********************************************************/
diff --git a/include/linux/serial.h b/include/linux/serial.h
index bfeee939c..ffc8d9d49 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -38,20 +38,6 @@ struct serial_struct {
#define ASYNC_CLOSING_WAIT_NONE 65535
/*
- * The size of the serial xmit buffer is 1 page, or 4096 bytes
- */
-#define SERIAL_XMIT_SIZE 4096
-
-/*
- * Counters of the input lines (CTS, DSR, RI, CD) interrupts
- */
-struct async_icount {
- __u32 cts, dsr, rng, dcd, tx, rx;
- __u32 frame, parity, overrun, brk;
- __u32 buf_overrun;
-};
-
-/*
* These are the supported serial types.
*/
#define PORT_UNKNOWN 0
diff --git a/include/linux/serialP.h b/include/linux/serialP.h
index 3fdadb4a1..ffd52dd86 100644
--- a/include/linux/serialP.h
+++ b/include/linux/serialP.h
@@ -19,11 +19,18 @@
* For definitions of the flags field, see tty.h
*/
-#include <linux/config.h>
#include <linux/termios.h>
#include <linux/tqueue.h>
#include <linux/wait.h>
+/*
+ * Counters of the input lines (CTS, DSR, RI, CD) interrupts
+ */
+struct async_icount {
+ __u32 cts, dsr, rng, dcd, tx, rx;
+ __u32 frame, parity, overrun, brk;
+ __u32 buf_overrun;
+};
struct serial_state {
int magic;
@@ -158,7 +165,7 @@ struct pci_board {
};
struct pci_board_inst {
- struct pci_board *board;
+ struct pci_board board;
struct pci_dev *dev;
};
@@ -172,7 +179,28 @@ struct pci_board_inst {
#define SPCI_FL_BASE2 0x0002
#define SPCI_FL_BASE3 0x0003
#define SPCI_FL_BASE4 0x0004
-#define SPCI_FL_IOMEM 0x0008 /* Use I/O mapped memory */
-#define SPCI_FL_BASE_TABLE 0x0010 /* Use base address table for UART */
-
+#define SPCI_FL_GET_BASE(x) (x & SPCI_FL_BASE_MASK)
+
+#define SPCI_FL_IRQ_MASK (0x0007 << 4)
+#define SPCI_FL_IRQBASE0 (0x0000 << 4)
+#define SPCI_FL_IRQBASE1 (0x0001 << 4)
+#define SPCI_FL_IRQBASE2 (0x0002 << 4)
+#define SPCI_FL_IRQBASE3 (0x0003 << 4)
+#define SPCI_FL_IRQBASE4 (0x0004 << 4)
+#define SPCI_FL_GET_IRQBASE(x) ((x & SPCI_FL_IRQ_MASK) >> 4)
+
+/* Use sucessiveentries base resource table */
+#define SPCI_FL_BASE_TABLE 0x0100
+
+/* Use successive entries in the irq resource table */
+#define SPCI_FL_IRQ_TABLE 0x0200
+
+/* Use the irq resource table instead of dev->irq */
+#define SPCI_FL_IRQRESOURCE 0x0400
+
+/* Use the Base address register size to cap number of ports */
+#define SPCI_FL_REGION_SZ_CAP 0x0800
+
+#define SPCI_FL_PNPDEFAULT (SPCI_FL_IRQRESOURCE)
+
#endif /* _LINUX_SERIAL_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7bea8a9a0..f2170ed5f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -202,16 +202,25 @@ extern __inline__ int skb_queue_empty(struct sk_buff_head *list)
return (list->next == (struct sk_buff *) list);
}
+extern __inline__ struct sk_buff *skb_get(struct sk_buff *skb)
+{
+ atomic_inc(&skb->users);
+ return skb;
+}
+
+/* If users==1, we are the only owner and are can avoid redundant
+ * atomic change.
+ */
extern __inline__ void kfree_skb(struct sk_buff *skb)
{
- if (atomic_dec_and_test(&skb->users))
+ if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users))
__kfree_skb(skb);
}
/* Use this if you didn't touch the skb state [for fast switching] */
extern __inline__ void kfree_skb_fast(struct sk_buff *skb)
{
- if (atomic_dec_and_test(&skb->users))
+ if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users))
kfree_skbmem(skb);
}
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 97f6923da..36f1a6718 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -22,7 +22,8 @@ typedef struct kmem_cache_s kmem_cache_t;
#define SLAB_NFS GFP_NFS
#define SLAB_DMA GFP_DMA
-#define SLAB_LEVEL_MASK 0x0000007fUL
+#define SLAB_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_SWAP| \
+ __GFP_HIGHMEM)
#define SLAB_NO_GROW 0x00001000UL /* don't grow a cache */
/* flags to pass to kmem_cache_create().
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 2c6771a4f..5f8a10198 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -80,6 +80,7 @@ extern volatile int smp_msg_id;
#define smp_threads_ready 1
#define kernel_lock()
#define cpu_logical_map(cpu) 0
+#define cpu_number_map(cpu) 0
#define smp_call_function(func,info,retry,wait) ({ 0; })
#endif
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index 995e43e9a..fe38a2d40 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -20,6 +20,10 @@
#include <asm/sockios.h>
+/* Linux-specific socket ioctls */
+#define SIOCINQ FIONREAD
+#define SIOCOUTQ TIOCOUTQ
+
/* Routing table calls. */
#define SIOCADDRT 0x890B /* add routing table entry */
#define SIOCDELRT 0x890C /* delete routing table entry */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index d0a68c502..03148253d 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -251,7 +251,12 @@ enum
NET_IPV4_INET_PEER_MINTTL=70,
NET_IPV4_INET_PEER_MAXTTL=71,
NET_IPV4_INET_PEER_GC_MINTIME=72,
- NET_IPV4_INET_PEER_GC_MAXTIME=73
+ NET_IPV4_INET_PEER_GC_MAXTIME=73,
+ NET_TCP_ORPHAN_RETRIES=74,
+ NET_TCP_ABORT_ON_OVERFLOW=75,
+ NET_TCP_SYNACK_RETRIES=76,
+ NET_TCP_MAX_ORPHANS=77,
+ NET_TCP_MAX_TW_BUCKETS=78,
};
enum {
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 1e78e322c..e030ee09f 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -124,5 +124,6 @@ enum {
#define TCP_SYNCNT 7 /* Number of SYN retransmits */
#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */
#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */
+#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
#endif /* _LINUX_TCP_H */
diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h
index e3dbdd5fd..162823404 100644
--- a/include/linux/udf_fs.h
+++ b/include/linux/udf_fs.h
@@ -1,7 +1,17 @@
/*
* udf_fs.h
*
- * Included by fs/filesystems.c
+ * PURPOSE
+ * Included by fs/filesystems.c
+ *
+ * DESCRIPTION
+ * OSTA-UDF(tm) = Optical Storage Technology Association
+ * Universal Disk Format.
+ *
+ * This code is based on version 2.00 of the UDF specification,
+ * and revision 3 of the ECMA 167 standard [equivalent to ISO 13346].
+ * http://www.osta.org/ * http://www.ecma.ch/
+ * http://www.iso.org/
*
* CONTACTS
* E-mail regarding any portion of the Linux UDF file system should be
@@ -14,15 +24,17 @@
* ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work.
*
+ * (C) 1999-2000 Ben Fennema
+ * (C) 1999-2000 Stelias Computing Inc
+ *
* HISTORY
- * July 21, 1997 - Andrew E. Mileski
- * Written, tested, and released.
*
- * 10/2/98 dgb rearranged all headers
- * 11/26/98 bf added byte order macros
- * 12/5/98 dgb removed other includes to reduce kernel namespace pollution.
+ * 10/02/98 dgb rearranged all headers
+ * 11/26/98 blf added byte order macros
+ * 12/05/98 dgb removed other includes to reduce kernel namespace pollution.
* This should only be included by the kernel now!
*/
+
#if !defined(_LINUX_UDF_FS_H)
#define _LINUX_UDF_FS_H
@@ -30,8 +42,8 @@
#define UDF_DEFAULT_PREALLOC_BLOCKS 8
#define UDF_DEFAULT_PREALLOC_DIR_BLOCKS 0
-#define UDFFS_DATE "99/11/18"
-#define UDFFS_VERSION "0.8.9.4"
+#define UDFFS_DATE "2000/01/17"
+#define UDFFS_VERSION "0.9.0"
#define UDFFS_DEBUG
#ifdef UDFFS_DEBUG
@@ -48,15 +60,6 @@
#define udf_info(f, a...) \
printk (KERN_INFO "UDF-fs INFO " ## f, ## a);
-struct udf_addr
-{
- __u32 block;
- __u16 partition;
- unsigned error : 1;
- unsigned reserved : 15;
-};
-
-
/* Prototype for fs/filesystem.c (the only thing really required in this file) */
extern int init_udf_fs(void);
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index c9d7b2fe7..a4bf4ba34 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -34,10 +34,7 @@ struct udf_inode_info
long i_umtime;
long i_uctime;
/* Physical address of inode */
- lb_addr i_ext0Location; /* partition relative */
lb_addr i_location;
- __u32 i_ext0Length; /* in blocks */
- __u32 i_ext0Offset; /* for short directories */
__u64 i_unique;
__u32 i_lenEAttr;
__u32 i_lenAlloc;
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
index 87635c411..d160eed0a 100644
--- a/include/linux/udf_fs_sb.h
+++ b/include/linux/udf_fs_sb.h
@@ -29,14 +29,22 @@
struct udf_sparing_data
{
- __u32 s_spar_loc;
- __u16 s_spar_plen;
+ __u32 s_spar_loc[4];
+ __u8 s_spar_pshift;
+ __u8 s_spar_indexsize;
+ __u32 *s_spar_map;
+ union
+ {
+ __u8 *s_spar_remap8;
+ __u16 *s_spar_remap16;
+ __u32 *s_spar_remap32;
+ } s_spar_remap;
};
struct udf_virtual_data
{
- __u32 s_num_entries;
- __u16 s_start_offset;
+ __u32 s_num_entries;
+ __u16 s_start_offset;
};
struct udf_part_map
@@ -51,6 +59,7 @@ struct udf_part_map
struct udf_sparing_data s_sparing;
struct udf_virtual_data s_virtual;
} s_type_specific;
+ __u32 (*s_partition_func)(struct super_block *, __u32, __u16, __u32);
__u16 s_volumeseqnum;
};
@@ -72,8 +81,6 @@ struct udf_sb_info
struct buffer_head *s_lvidbh;
- lb_addr s_location;
-
__u16 s_loaded_block_bitmaps;
__u32 s_block_bitmap_number[UDF_MAX_BLOCK_LOADED];
struct buffer_head *s_block_bitmap[UDF_MAX_BLOCK_LOADED];
@@ -89,20 +96,11 @@ struct udf_sb_info
/* Fileset Info */
__u16 s_serialnum;
- /* Character Mapping Info */
- struct nls_table *s_nls_iocharset;
- __u8 s_utf8;
-
/* Miscellaneous flags */
__u32 s_flags;
/* VAT inode */
struct inode *s_vat;
-
-#if LINUX_VERSION_CODE < 0x020206
- int s_rename_lock;
- struct wait_queue * s_rename_wait;
-#endif
};
#endif /* !defined(_LINUX_UDF_FS_SB_H) */
diff --git a/include/linux/udf_udf.h b/include/linux/udf_udf.h
index b9778916a..e0f071ddd 100644
--- a/include/linux/udf_udf.h
+++ b/include/linux/udf_udf.h
@@ -101,8 +101,7 @@ struct SparablePartitionMap
Uint8 numSparingTables;
Uint8 reserved2[1]; /* #00 */
Uint32 sizeSparingTable;
- Uint32 locSparingTable[0];
- Uint8 pad[0];
+ Uint32 locSparingTable[4];
};
/* DVD Copyright Management Info, see UDF 1.02 3.3.4.5.1.2 */
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index a83503f99..13e1da0c5 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -32,5 +32,5 @@ struct new_utsname {
extern struct new_utsname system_utsname;
-extern struct semaphore uts_sem;
+extern struct rw_semaphore uts_sem;
#endif
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 88465e567..e1ba268a7 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -370,6 +370,7 @@ struct video_code
#define VID_HARDWARE_CPIA 24
#define VID_HARDWARE_ZR36120 25 /* Zoran ZR36120/ZR36125 */
#define VID_HARDWARE_ZR36067 26 /* Zoran ZR36067/36060 */
+#define VID_HARDWARE_OV511 27
/*
* Initialiser list
diff --git a/include/linux/wanpipe.h b/include/linux/wanpipe.h
index 434ade5a2..830e48e43 100644
--- a/include/linux/wanpipe.h
+++ b/include/linux/wanpipe.h
@@ -2,16 +2,23 @@
* wanpipe.h WANPIPE(tm) Multiprotocol WAN Link Driver.
* User-level API definitions.
*
-* Author: Gene Kozin <genek@compuserve.com>
-* Jaspreet Singh <jaspreet@sangoma.com>
+* Author: Nenad Corbic <ncorbic@sangoma.com>
+* Gideon Hack
*
-* Copyright: (c) 1995-1997 Sangoma Technologies Inc.
+* Copyright: (c) 1995-1999 Sangoma Technologies Inc.
*
* This program 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.
* ============================================================================
+* Oct 04, 1999 Nenad Corbic New CHDLC and FRAME RELAY code, SMP support
+* Jun 02, 1999 Gideon Hack Added 'update_call_count' for Cisco HDLC
+* support
+* Jun 26, 1998 David Fong Added 'ip_mode' in sdla_t.u.p for dynamic IP
+* routing mode configuration
+* Jun 12, 1998 David Fong Added Cisco HDLC union member in sdla_t
+* Dec 08, 1997 Jaspreet Singh Added 'authenticator' in union of 'sdla_t'
* Nov 26, 1997 Jaspreet Singh Added 'load_sharing' structure. Also added
* 'devs_struct','dev_to_devtint_next' to 'sdla_t'
* Nov 24, 1997 Jaspreet Singh Added 'irq_dis_if_send_count',
@@ -28,6 +35,10 @@
#ifndef _WANPIPE_H
#define _WANPIPE_H
+#ifdef __SMP__
+#include <asm/spinlock.h> /* Support for SMP Locking */
+#endif
+
#include <linux/wanrouter.h>
/* Defines */
@@ -42,6 +53,16 @@
#define WANPIPE_DUMP (ROUTER_USER+0) /* dump adapter's memory */
#define WANPIPE_EXEC (ROUTER_USER+1) /* execute firmware command */
+#define TRACE_ALL 0x00
+#define TRACE_PROT 0x01
+#define TRACE_DATA 0x02
+
+/* values for request/reply byte */
+#define UDPMGMT_REQUEST 0x01
+#define UDPMGMT_REPLY 0x02
+#define UDP_OFFSET 12
+
+
/*
* Data structures for IOCTL calls.
*/
@@ -97,16 +118,86 @@ typedef struct global_stats
} global_stats_t;
-/* This structure is used for maitaining a circular linked list of all
- * interfaces(devices) per card. It is used in the Interrupt Service routine
- * for a transmit interrupt where the start of the loop to dev_tint all
- * interfaces changes.
- */
-typedef struct load_sharing
-{
- struct net_device* dev_ptr;
- struct load_sharing* next;
-} load_sharing_t;
+
+typedef struct{
+ unsigned short udp_src_port PACKED;
+ unsigned short udp_dst_port PACKED;
+ unsigned short udp_length PACKED;
+ unsigned short udp_checksum PACKED;
+} udp_pkt_t;
+
+
+typedef struct {
+ unsigned char ver_inet_hdr_length PACKED;
+ unsigned char service_type PACKED;
+ unsigned short total_length PACKED;
+ unsigned short identifier PACKED;
+ unsigned short flags_frag_offset PACKED;
+ unsigned char ttl PACKED;
+ unsigned char protocol PACKED;
+ unsigned short hdr_checksum PACKED;
+ unsigned long ip_src_address PACKED;
+ unsigned long ip_dst_address PACKED;
+} ip_pkt_t;
+
+
+typedef struct {
+ unsigned char signature[8] PACKED;
+ unsigned char request_reply PACKED;
+ unsigned char id PACKED;
+ unsigned char reserved[6] PACKED;
+} wp_mgmt_t;
+
+/*************************************************************************
+ Data Structure for if_send statistics
+*************************************************************************/
+typedef struct if_send_stat{
+ unsigned long if_send_entry;
+ unsigned long if_send_skb_null;
+ unsigned long if_send_broadcast;
+ unsigned long if_send_multicast;
+ unsigned long if_send_critical_ISR;
+ unsigned long if_send_critical_non_ISR;
+ unsigned long if_send_tbusy;
+ unsigned long if_send_tbusy_timeout;
+ unsigned long if_send_PIPE_request;
+ unsigned long if_send_wan_disconnected;
+ unsigned long if_send_dlci_disconnected;
+ unsigned long if_send_no_bfrs;
+ unsigned long if_send_adptr_bfrs_full;
+ unsigned long if_send_bfr_passed_to_adptr;
+ unsigned long if_send_protocol_error;
+ unsigned long if_send_bfr_not_passed_to_adptr;
+ unsigned long if_send_tx_int_enabled;
+ unsigned long if_send_consec_send_fail;
+} if_send_stat_t;
+
+typedef struct rx_intr_stat{
+ unsigned long rx_intr_no_socket;
+ unsigned long rx_intr_dev_not_started;
+ unsigned long rx_intr_PIPE_request;
+ unsigned long rx_intr_bfr_not_passed_to_stack;
+ unsigned long rx_intr_bfr_passed_to_stack;
+} rx_intr_stat_t;
+
+typedef struct pipe_mgmt_stat{
+ unsigned long UDP_PIPE_mgmt_kmalloc_err;
+ unsigned long UDP_PIPE_mgmt_direction_err;
+ unsigned long UDP_PIPE_mgmt_adptr_type_err;
+ unsigned long UDP_PIPE_mgmt_adptr_cmnd_OK;
+ unsigned long UDP_PIPE_mgmt_adptr_cmnd_timeout;
+ unsigned long UDP_PIPE_mgmt_adptr_send_passed;
+ unsigned long UDP_PIPE_mgmt_adptr_send_failed;
+ unsigned long UDP_PIPE_mgmt_not_passed_to_stack;
+ unsigned long UDP_PIPE_mgmt_passed_to_stack;
+ unsigned long UDP_PIPE_mgmt_no_socket;
+ unsigned long UDP_PIPE_mgmt_passed_to_adptr;
+} pipe_mgmt_stat_t;
+
+
+
+#define MAX_LGTH_UDP_MGNT_PKT 2000
+
/* This is used for interrupt testing */
#define INTR_TEST_MODE 0x02
@@ -154,23 +245,23 @@ typedef struct sdla
char in_isr; /* interrupt-in-service flag */
char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
char dlci_int_mode_unbusy; /* flag for carrying out dev_tint */
+ char configured; /* flag for previous configurations */
unsigned short irq_dis_if_send_count; /* Disabling irqs in if_send*/
unsigned short irq_dis_poll_count; /* Disabling irqs in poll routine*/
+ unsigned short force_enable_irq;
+ char TracingEnabled; /* flag for enabling trace */
global_stats_t statistics; /* global statistics */
-
- /* The following is used as a pointer to the structure in our
- circular linked list which changes the start of the loop for
- dev_tint of all interfaces */
-
- load_sharing_t* dev_to_devtint_next;
- load_sharing_t* devs_struct;
-
+#ifdef __SMP__
+ spinlock_t lock; /* Support for SMP Locking */
+#endif
void* mbox; /* -> mailbox */
void* rxmb; /* -> receive mailbox */
void* flags; /* -> adapter status flags */
void (*isr)(struct sdla* card); /* interrupt service routine */
void (*poll)(struct sdla* card); /* polling routine */
int (*exec)(struct sdla* card, void* u_cmd, void* u_data);
+
+ struct sdla *next; /* Secondary Port Device: Piggibacking */
union
{
struct
@@ -188,6 +279,19 @@ typedef struct sdla
unsigned rx_top; /* S508 receive buffer end */
unsigned short node_dlci[100];
unsigned short dlci_num;
+ struct net_device *dlci_to_dev_map[991 + 1];
+ unsigned tx_interrupts_pending;
+ unsigned short timer_int_enabled;
+ unsigned short udp_pkt_lgth;
+ int udp_type;
+ char udp_pkt_src;
+ unsigned udp_dlci;
+ char udp_pkt_data[MAX_LGTH_UDP_MGNT_PKT];
+ void* trc_el_base; /* first trace element */
+ void* trc_el_last; /* last trace element */
+ void *curr_trc_el; /* current trace element */
+ unsigned short trc_bfr_space; /* trace buffer space */
+ unsigned char update_comms_stats;
} f;
struct /****** PPP-specific data ***********/
{
@@ -199,7 +303,53 @@ typedef struct sdla
void* rxbuf_last; /* -> last Rx buffer */
unsigned rx_base; /* S508 receive buffer base */
unsigned rx_top; /* S508 receive buffer end */
+ char ip_mode; /* STATIC/HOST/PEER IP Mode */
+ char authenticator; /* Authenticator for PAP/CHAP */
} p;
+ struct /* Cisco HDLC-specific data */
+ {
+ char if_name[WAN_IFNAME_SZ+1]; /* interface name */
+ unsigned char comm_port;/* Communication Port O or 1 */
+ unsigned char usedby; /* Used by WANPIPE or API */
+ void* rxmb; /* Receive mail box */
+ void* flags; /* flags */
+ void* tx_status; /* Tx status element */
+ void* rx_status; /* Rx status element */
+ void* txbuf; /* -> current Tx buffer */
+ void* txbuf_base; /* -> first Tx buffer */
+ void* txbuf_last; /* -> last Tx buffer */
+ void* rxbuf_base; /* -> first Rx buffer */
+ void* rxbuf_last; /* -> last Rx buffer */
+ unsigned rx_base; /* S508 receive buffer base */
+ unsigned rx_top; /* S508 receive buffer end */
+ unsigned short protocol_options;
+ unsigned short kpalv_tx; /* Tx kpalv timer */
+ unsigned short kpalv_rx; /* Rx kpalv timer */
+ unsigned short kpalv_err; /* Error tolerance */
+ unsigned short slarp_timer; /* SLARP req timer */
+ unsigned state; /* state of the link */
+ unsigned char api_status;
+ unsigned char update_call_count;
+ } c;
+ struct
+ {
+ void* tx_status; /* Tx status element */
+ void* rx_status; /* Rx status element */
+ void* trace_status; /* Trace status element */
+ void* txbuf; /* -> current Tx buffer */
+ void* txbuf_base; /* -> first Tx buffer */
+ void* txbuf_last; /* -> last Tx buffer */
+ void* rxbuf_base; /* -> first Rx buffer */
+ void* rxbuf_last; /* -> last Rx buffer */
+ void* tracebuf; /* -> current Trace buffer */
+ void* tracebuf_base; /* -> current Trace buffer */
+ void* tracebuf_last; /* -> current Trace buffer */
+ unsigned rx_base; /* receive buffer base */
+ unsigned rx_end; /* receive buffer end */
+ unsigned trace_base; /* trace buffer base */
+ unsigned trace_end; /* trace buffer end */
+
+ } h;
} u;
} sdla_t;
@@ -212,6 +362,10 @@ void wanpipe_set_state (sdla_t* card, int state); /* wpmain.c */
int wpx_init (sdla_t* card, wandev_conf_t* conf); /* wpx.c */
int wpf_init (sdla_t* card, wandev_conf_t* conf); /* wpf.c */
int wpp_init (sdla_t* card, wandev_conf_t* conf); /* wpp.c */
+int wpc_init (sdla_t* card, wandev_conf_t* conf); /* Cisco HDLC */
+int bsc_init (sdla_t* card, wandev_conf_t* conf); /* BSC streaming */
+int hdlc_init(sdla_t* card, wandev_conf_t* conf); /* HDLC support */
+int wpft1_init (sdla_t* card, wandev_conf_t* conf); /* FT1 Config support */
#endif /* __KERNEL__ */
#endif /* _WANPIPE_H */
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index accecf8d2..7efa6a9c1 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -1,21 +1,29 @@
/*****************************************************************************
-* router.h Definitions for the WAN Multiprotocol Router Module.
+* wanrouter.h Definitions for the WAN Multiprotocol Router Module.
* This module provides API and common services for WAN Link
* Drivers and is completely hardware-independent.
*
-* Author: Gene Kozin <genek@compuserve.com>
-* Jaspreet Singh <jaspreet@sangoma.com>
+* Author: Nenad Corbic <ncorbic@sangoma.com>
+* Gideon Hack
* Additions: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*
-* Copyright: (c) 1995-1997 Sangoma Technologies Inc.
+* Copyright: (c) 1995-1999 Sangoma Technologies Inc.
*
* This program 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.
* ============================================================================
+* Oct 04, 1999 Nenad Corbic Updated for 2.1.0 release
+* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
* May 23, 1999 Arnaldo Melo Added local_addr to wanif_conf_t
* WAN_DISCONNECTING state added
+* Jul 20, 1998 David Fong Added Inverse ARP options to 'wanif_conf_t'
+* Jun 12, 1998 David Fong Added Cisco HDLC support.
+* Dec 16, 1997 Jaspreet Singh Moved 'enable_IPX' and 'network_number' to
+* 'wanif_conf_t'
+* Dec 05, 1997 Jaspreet Singh Added 'pap', 'chap' to 'wanif_conf_t'
+* Added 'authenticator' to 'wan_ppp_conf_t'
* Nov 06, 1997 Jaspreet Singh Changed Router Driver version to 1.1 from 1.0
* Oct 20, 1997 Jaspreet Singh Added 'cir','bc','be' and 'mc' to 'wanif_conf_t'
* Added 'enable_IPX' and 'network_number' to
@@ -32,6 +40,12 @@
* Jan 16, 1997 Gene Kozin router_devlist made public
* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h).
*****************************************************************************/
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= 0x020100
+#define LINUX_2_1
+#endif
+
#ifndef _ROUTER_H
#define _ROUTER_H
@@ -54,6 +68,10 @@ enum router_ioctls
ROUTER_USER_MAX = (ROUTER_IOCTL<<8)+31
};
+/* identifiers for displaying proc file data for dual port adapters */
+#define PROC_DATA_PORT_0 0x8000 /* the data is for port 0 */
+#define PROC_DATA_PORT_1 0x8001 /* the data is for port 1 */
+
/* NLPID for packet encapsulation (ISO/IEC TR 9577) */
#define NLPID_IP 0xCC /* Internet Protocol Datagram */
#define NLPID_SNAP 0x80 /* IEEE Subnetwork Access Protocol */
@@ -66,12 +84,14 @@ enum router_ioctls
#define WAN_IFNAME_SZ 15 /* max length of the interface name */
#define WAN_DRVNAME_SZ 15 /* max length of the link driver name */
#define WAN_ADDRESS_SZ 31 /* max length of the WAN media address */
+#define USED_BY_FIELD 8 /* max length of the used by field */
/* Defines for UDP PACKET TYPE */
#define UDP_PTPIPE_TYPE 0x01
#define UDP_FPIPE_TYPE 0x02
-#define UDP_DRVSTATS_TYPE 0x03
-#define UDP_INVALID_TYPE 0x04
+#define UDP_CPIPE_TYPE 0x03
+#define UDP_DRVSTATS_TYPE 0x04
+#define UDP_INVALID_TYPE 0x05
/* Command return code */
#define CMD_OK 0 /* normal firmware return code */
@@ -129,7 +149,7 @@ typedef struct wan_fr_conf
unsigned n392; /* error threshold counter */
unsigned n393; /* monitored events counter */
unsigned dlci_num; /* number of DLCs (access node) */
- unsigned dlci[100]; /* List of all DLCIs */
+ unsigned dlci[100]; /* List of all DLCIs */
} wan_fr_conf_t;
/*----------------------------------------------------------------------------
@@ -149,9 +169,27 @@ typedef struct wan_ppp_conf
unsigned auth_retry; /* max. retry */
unsigned auth_options; /* authentication opt. */
unsigned ip_options; /* IP options */
+ char authenticator; /* AUTHENTICATOR or not */
+ char ip_mode; /* Static/Host/Peer */
} wan_ppp_conf_t;
/*----------------------------------------------------------------------------
+ * CHDLC-specific link-level configuration.
+ */
+typedef struct wan_chdlc_conf
+{
+ unsigned char ignore_dcd; /* Protocol options: */
+ unsigned char ignore_cts; /* Ignore these to determine */
+ unsigned char ignore_keepalive; /* link status (Yes or No) */
+ unsigned char hdlc_streaming; /* hdlc_streaming mode (Y/N) */
+ unsigned keepalive_tx_tmr; /* transmit keepalive timer */
+ unsigned keepalive_rx_tmr; /* receive keepalive timer */
+ unsigned keepalive_err_margin; /* keepalive_error_tolerance */
+ unsigned slarp_timer; /* SLARP request timer */
+} wan_chdlc_conf_t;
+
+
+/*----------------------------------------------------------------------------
* WAN device configuration. Passed to ROUTER_SETUP IOCTL.
*/
typedef struct wandev_conf
@@ -164,18 +202,21 @@ typedef struct wandev_conf
unsigned msize; /* dual-port memory size */
int irq; /* interrupt request level */
int dma; /* DMA request level */
+ char S514_CPU_no[1]; /* S514 PCI adapter CPU number ('A' or 'B') */
+ unsigned PCI_slot_no; /* S514 PCI adapter slot number */
+ char comm_port; /* Communication Port (PRI=0, SEC=1) */
unsigned bps; /* data transfer rate */
unsigned mtu; /* maximum transmit unit size */
unsigned udp_port; /* UDP port for management */
unsigned char ttl; /* Time To Live for UDP security */
+ unsigned char ft1; /* FT1 Configurator Option */
char interface; /* RS-232/V.35, etc. */
char clocking; /* external/internal */
char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */
char station; /* DTE/DCE, primary/secondary, etc. */
char connection; /* permanent/switched/on-demand */
+ char read_mode; /* read mode: Polling or interrupt */
unsigned hw_opt[4]; /* other hardware options */
- unsigned char enable_IPX; /* Enable or Disable IPX */
- unsigned long network_number; /* Network Number for IPX */
unsigned reserved[4];
/****** arbitrary data ***************/
unsigned data_size; /* data buffer size */
@@ -185,6 +226,7 @@ typedef struct wandev_conf
wan_x25_conf_t x25; /* X.25 configuration */
wan_ppp_conf_t ppp; /* PPP configuration */
wan_fr_conf_t fr; /* frame relay configuration */
+ wan_chdlc_conf_t chdlc; /* Cisco HDLC configuration */
} u;
} wandev_conf_t;
@@ -192,6 +234,9 @@ typedef struct wandev_conf
#define WANCONFIG_X25 101 /* X.25 link */
#define WANCONFIG_FR 102 /* frame relay link */
#define WANCONFIG_PPP 103 /* synchronous PPP link */
+#define WANCONFIG_CHDLC 104 /* Cisco HDLC Link */
+#define WANCONFIG_BSC 105 /* BiSync Streaming */
+#define WANCONFIG_HDLC 106 /* HDLC Support */
/*
* Configuration options defines.
@@ -234,9 +279,29 @@ typedef struct wandev_conf
#define WANOPT_ONDEMAND 2 /* activate DTR only before sending */
/* frame relay in-channel signalling */
-#define WANOPT_FR_ANSI 0 /* ANSI T1.617 Annex D */
-#define WANOPT_FR_Q933 1 /* ITU Q.933A */
-#define WANOPT_FR_LMI 2 /* LMI */
+#define WANOPT_FR_ANSI 1 /* ANSI T1.617 Annex D */
+#define WANOPT_FR_Q933 2 /* ITU Q.933A */
+#define WANOPT_FR_LMI 3 /* LMI */
+
+/* PPP IP Mode Options */
+#define WANOPT_PPP_STATIC 0
+#define WANOPT_PPP_HOST 1
+#define WANOPT_PPP_PEER 2
+
+/* CHDLC Protocol Options */
+/* DF Commmented out for now.
+
+#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT
+#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT
+#define WANOPT_CHDLC_NO_KEEPALIVE IGNORE_KPALV_FOR_LINK_STAT
+*/
+
+/* Port options */
+#define WANOPT_PRI 0
+#define WANOPT_SEC 1
+/* read mode */
+#define WANOPT_INTR 0
+#define WANOPT_POLL 1
/*----------------------------------------------------------------------------
* WAN Link Status Info (for ROUTER_STAT IOCTL).
@@ -278,8 +343,9 @@ enum wan_states
WAN_DISCONNECTED, /* link/channel is disconnected */
WAN_CONNECTING, /* connection is in progress */
WAN_CONNECTED, /* link/channel is operational */
- WAN_DISCONNECTING, /* disconnection is in progress */
- WAN_LIMIT /* for verification only */
+ WAN_LIMIT, /* for verification only */
+ WAN_DUALPORT, /* for Dual Port cards */
+ WAN_DISCONNECTING /* link/channel is disconnecting */
};
/* 'modem_status' masks */
@@ -297,16 +363,38 @@ typedef struct wanif_conf
unsigned config_id; /* configuration identifier */
char name[WAN_IFNAME_SZ+1]; /* interface name, ASCIIZ */
char addr[WAN_ADDRESS_SZ+1]; /* media address, ASCIIZ */
+ char usedby[USED_BY_FIELD]; /* used by API or WANPIPE */
unsigned idle_timeout; /* sec, before disconnecting */
unsigned hold_timeout; /* sec, before re-connecting */
unsigned cir; /* Committed Information Rate fwd,bwd*/
unsigned bc; /* Committed Burst Size fwd, bwd */
unsigned be; /* Excess Burst Size fwd, bwd */
+ unsigned char enable_IPX; /* Enable or Disable IPX */
+ unsigned char inarp; /* Send Inverse ARP requests Y/N */
+ unsigned inarp_interval; /* sec, between InARP requests */
+ unsigned long network_number; /* Network Number for IPX */
char mc; /* Multicast on or off */
char local_addr[WAN_ADDRESS_SZ+1];/* local media address, ASCIIZ */
unsigned char port; /* board port */
unsigned char protocol; /* prococol used in this channel (TCPOX25 or X25) */
- int reserved[8]; /* reserved for future extensions */
+ char pap; /* PAP enabled or disabled */
+ char chap; /* CHAP enabled or disabled */
+ unsigned char userid[511]; /* List of User Id */
+ unsigned char passwd[511]; /* List of passwords */
+ unsigned char sysname[31]; /* Name of the system */
+ unsigned char ignore_dcd; /* Protocol options: */
+ unsigned char ignore_cts; /* Ignore these to determine */
+ unsigned char ignore_keepalive; /* link status (Yes or No) */
+ unsigned char hdlc_streaming; /* Hdlc streaming mode (Y/N) */
+ unsigned keepalive_tx_tmr; /* transmit keepalive timer */
+ unsigned keepalive_rx_tmr; /* receive keepalive timer */
+ unsigned keepalive_err_margin; /* keepalive_error_tolerance */
+ unsigned slarp_timer; /* SLARP request timer */
+ unsigned char ttl; /* Time To Live for UDP security */
+ char interface; /* RS-232/V.35, etc. */
+ char clocking; /* external/internal */
+ unsigned bps; /* data transfer rate */
+ unsigned mtu; /* maximum transmit unit size */
} wanif_conf_t;
#ifdef __KERNEL__
@@ -316,7 +404,6 @@ typedef struct wanif_conf
#include <linux/proc_fs.h> /* proc filesystem pragmatics */
#include <linux/inet.h> /* in_aton(), in_ntoa() prototypes */
#include <linux/netdevice.h> /* support for network drivers */
-
/*----------------------------------------------------------------------------
* WAN device data space.
*/
@@ -325,9 +412,12 @@ typedef struct wan_device
unsigned magic; /* magic number */
char* name; /* -> WAN device name (ASCIIZ) */
void* private; /* -> driver private data */
+ unsigned config_id; /* Configuration ID */
/****** hardware configuration ******/
unsigned ioport; /* adapter I/O port base #1 */
- void * maddr; /* dual-port memory address */
+ char S514_cpu_no[1]; /* PCI CPU Number */
+ unsigned char S514_slot_no; /* PCI Slot Number */
+ unsigned long maddr; /* dual-port memory address */
unsigned msize; /* dual-port memory size */
int irq; /* interrupt request level */
int dma; /* DMA request level */
@@ -341,24 +431,31 @@ typedef struct wan_device
char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */
char station; /* DTE/DCE, primary/secondary, etc. */
char connection; /* permanent/switched/on-demand */
+ char signalling; /* Signalling RS232 or V35 */
+ char read_mode; /* read mode: Polling or interrupt */
+ char new_if_cnt; /* Number of interfaces per wanpipe */
+ char del_if_cnt; /* Number of times del_if() gets called */
+ unsigned char piggyback; /* Piggibacking a port */
unsigned hw_opt[4]; /* other hardware options */
- unsigned char enable_IPX; /* Enable or Disable IPX */
- unsigned long network_number; /* Network Number for IPX */
/****** status and statistics *******/
char state; /* device state */
- unsigned modem_status; /* modem status */
+ char api_status; /* device api status */
+#ifdef LINUX_2_1
+ struct net_device_stats stats; /* interface statistics */
+#else
struct enet_statistics stats; /* interface statistics */
+#endif
unsigned reserved[16]; /* reserved for future use */
unsigned critical; /* critical section flag */
/****** device management methods ***/
- int (*setup) (struct wan_device* wandev, wandev_conf_t* conf);
- int (*shutdown) (struct wan_device* wandev);
- int (*update) (struct wan_device* wandev);
- int (*ioctl) (struct wan_device* wandev, unsigned cmd,
+ int (*setup) (struct wan_device *wandev, wandev_conf_t *conf);
+ int (*shutdown) (struct wan_device *wandev);
+ int (*update) (struct wan_device *wandev);
+ int (*ioctl) (struct wan_device *wandev, unsigned cmd,
unsigned long arg);
- int (*new_if) (struct wan_device* wandev, struct net_device* dev,
- wanif_conf_t* conf);
- int (*del_if) (struct wan_device* wandev, struct net_device* dev);
+ int (*new_if) (struct wan_device *wandev, struct net_device *dev,
+ wanif_conf_t *conf);
+ int (*del_if) (struct wan_device *wandev, struct net_device *dev);
/****** maintained by the router ****/
struct wan_device* next; /* -> next device */
struct net_device* dev; /* list of network interfaces */
@@ -367,23 +464,20 @@ typedef struct wan_device
} wan_device_t;
/* Public functions available for device drivers */
-extern int register_wan_device(wan_device_t* wandev);
-extern int unregister_wan_device(char* name);
-unsigned short wanrouter_type_trans(struct sk_buff* skb, struct net_device* dev);
-int wanrouter_encapsulate(struct sk_buff* skb, struct net_device* dev);
+extern int register_wan_device(wan_device_t *wandev);
+extern int unregister_wan_device(char *name);
+unsigned short wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev);
+int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev);
/* Proc interface functions. These must not be called by the drivers! */
-extern int wanrouter_proc_init (void);
-extern void wanrouter_proc_cleanup (void);
-extern int wanrouter_proc_add (wan_device_t* wandev);
-extern int wanrouter_proc_delete (wan_device_t* wandev);
-extern int wanrouter_ioctl(
- struct inode* inode, struct file* file,
- unsigned int cmd, unsigned long arg)
-;
+extern int wanrouter_proc_init(void);
+extern void wanrouter_proc_cleanup(void);
+extern int wanrouter_proc_add(wan_device_t *wandev);
+extern int wanrouter_proc_delete(wan_device_t *wandev);
+extern int wanrouter_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
/* Public Data */
-extern wan_device_t* router_devlist; /* list of registered devices */
+extern wan_device_t *router_devlist; /* list of registered devices */
#endif /* __KERNEL__ */
#endif /* _ROUTER_H */
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index 9ec9ca719..26c7a460e 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -1,7 +1,7 @@
/*
* linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions
*
- * Copyright (C) 1995-1998 Geert Uytterhoeven
+ * Copyright (C) 1995-2000 Geert Uytterhoeven
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
@@ -39,6 +39,9 @@
typedef __u32 zorro_id;
+#define ZORRO_WILDCARD (0xffffffff) /* not official */
+
+
#define ZORRO_MANUF_PACIFIC_PERIPHERALS 0x00D3
#define ZORRO_PROD_PACIFIC_PERIPHERALS_SE_2000_A500 ZORRO_ID(PACIFIC_PERIPHERALS, 0x00, 0)
#define ZORRO_PROD_PACIFIC_PERIPHERALS_SCSI ZORRO_ID(PACIFIC_PERIPHERALS, 0x0A, 0)
@@ -694,8 +697,19 @@ CD_sizeof = CD_Unused+(4*4)
#ifdef __KERNEL__
+#include <linux/ioport.h>
+
+struct zorro_dev {
+ struct ExpansionRom rom;
+ zorro_id id;
+ u16 slotaddr;
+ u16 slotsize;
+ char name[48];
+ struct resource resource;
+};
+
extern unsigned int zorro_num_autocon; /* # of autoconfig devices found */
-extern struct ConfigDev zorro_autocon[ZORRO_NUM_AUTO];
+extern struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
/*
@@ -705,10 +719,18 @@ extern struct ConfigDev zorro_autocon[ZORRO_NUM_AUTO];
extern void zorro_init(void);
extern void zorro_proc_init(void);
-extern unsigned int zorro_find(zorro_id id, unsigned int part, unsigned int index);
-extern const struct ConfigDev *zorro_get_board(unsigned int key);
-extern void zorro_config_board(unsigned int key, unsigned int part);
-extern void zorro_unconfig_board(unsigned int key, unsigned int part);
+extern struct zorro_dev *zorro_find_device(zorro_id id,
+ struct zorro_dev *from);
+
+#define zorro_request_device(z, name) \
+ request_mem_region((z)->resource.start, \
+ (z)->resource.end-(z)->resource.start+1, (name))
+#define zorro_check_device(z) \
+ check_mem_region((z)->resource.start, \
+ (z)->resource.end-(z)->resource.start+1)
+#define zorro_release_device(z) \
+ release_mem_region((z)->resource.start, \
+ (z)->resource.end-(z)->resource.start+1)
/*
diff --git a/include/net/dst.h b/include/net/dst.h
index 79a3cd392..4bca9c092 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -29,10 +29,13 @@ struct dst_entry
struct dst_entry *next;
atomic_t __refcnt; /* client references */
int __use;
- struct net_device *dev;
+ struct net_device *dev;
int obsolete;
+ int flags;
+#define DST_HOST 1
unsigned long lastuse;
unsigned long expires;
+
unsigned mxlock;
unsigned pmtu;
unsigned window;
@@ -41,6 +44,7 @@ struct dst_entry
unsigned ssthresh;
unsigned cwnd;
unsigned advmss;
+
unsigned long rate_last; /* rate limiting for ICMP */
unsigned long rate_tokens;
diff --git a/include/net/ip.h b/include/net/ip.h
index eeb25ffea..a17c12bbd 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -84,7 +84,7 @@ extern int ip_mc_procinfo(char *, char **, off_t, int);
* Functions provided by ip.c
*/
-extern void ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
+extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
u32 saddr, u32 daddr,
struct ip_options *opt);
extern int ip_rcv(struct sk_buff *skb, struct net_device *dev,
diff --git a/include/net/route.h b/include/net/route.h
index 9ccfd3bea..180daad87 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -92,8 +92,7 @@ struct ip_rt_acct
__u32 i_packets;
};
-extern struct ip_rt_acct ip_rt_acct[256];
-extern rwlock_t ip_rt_acct_lock;
+extern struct ip_rt_acct *ip_rt_acct;
extern void ip_rt_init(void);
extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw,
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 4469fdcd1..5105fd220 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -182,7 +182,24 @@ struct linux_mib
unsigned long OfoPruned;
unsigned long OutOfWindowIcmps;
unsigned long LockDroppedIcmps;
- unsigned long __pad[32-9];
+ unsigned long TimeWaited;
+ unsigned long TimeWaitRecycled;
+ unsigned long TimeWaitKilled;
+ unsigned long PAWSPassiveRejected;
+ unsigned long PAWSActiveRejected;
+ unsigned long PAWSEstabRejected;
+ unsigned long DelayedACKs;
+ unsigned long DelayedACKLocked;
+ unsigned long DelayedACKLost;
+ unsigned long ListenOverflows;
+ unsigned long ListenDrops;
+ unsigned long TCPPrequeued;
+ unsigned long TCPDirectCopyFromBacklog;
+ unsigned long TCPDirectCopyFromPrequeue;
+ unsigned long TCPPrequeueDropped;
+ unsigned long TCPHPHits;
+ unsigned long TCPHPHitsToUser;
+ unsigned long __pad[32-26];
};
#define SNMP_INC_STATS(mib, field) ((mib)[2*smp_processor_id()+!in_interrupt()].field++)
diff --git a/include/net/sock.h b/include/net/sock.h
index 5aa0172c2..5dc9f5be3 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -96,7 +96,6 @@ struct atm_vcc;
#include <asm/atomic.h>
#include <net/dst.h>
-#define MIN_WRITE_SPACE 2048
/* The AF_UNIX specific socket options */
struct unix_opt {
@@ -229,41 +228,66 @@ struct tcp_opt {
__u32 snd_nxt; /* Next sequence we send */
__u32 snd_una; /* First byte we want an ack for */
- __u32 rcv_tstamp; /* timestamp of last received packet */
- __u32 lrcvtime; /* timestamp of last received data packet*/
- __u32 srtt; /* smothed round trip time << 3 */
+ __u32 snd_sml; /* Last byte of the most recently transmitted small packet */
+ __u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
+ __u32 lsndtime; /* timestamp of last sent data packet (for restart window) */
- __u32 ato; /* delayed ack timeout */
- __u32 snd_wl1; /* Sequence for window update */
+ /* Delayed ACK control data */
+ struct {
+ __u8 pending; /* ACK is pending */
+ __u8 quick; /* Scheduled number of quick acks */
+ __u8 pingpong; /* The session is interactive */
+ __u8 blocked; /* Delayed ACK was blocked by socket lock*/
+ __u32 ato; /* Predicted tick of soft clock */
+ __u32 lrcvtime; /* timestamp of last received data packet*/
+ __u16 last_seg_size; /* Size of last incoming segment */
+ __u16 rcv_mss; /* MSS used for delayed ACK decisions */
+ } ack;
+
+ /* Data for direct copy to user */
+ struct {
+ struct sk_buff_head prequeue;
+ int memory;
+ struct task_struct *task;
+ struct iovec *iov;
+ int len;
+ } ucopy;
+ __u32 snd_wl1; /* Sequence for window update */
__u32 snd_wl2; /* Ack sequence for update */
__u32 snd_wnd; /* The window we expect to receive */
- __u32 max_window;
+ __u32 max_window; /* Maximal window ever seen from peer */
__u32 pmtu_cookie; /* Last pmtu seen by socket */
__u16 mss_cache; /* Cached effective mss, not including SACKS */
__u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
- __u16 ext_header_len; /* Dave, do you allow mw to use this hole? 8) --ANK */
- __u8 pending; /* pending events */
+ __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */
+ __u8 dup_acks; /* Consequetive duplicate acks seen from other end */
__u8 retransmits;
- __u32 last_ack_sent; /* last ack we sent */
- __u32 backoff; /* backoff */
+ __u16 __empty1;
+ __u8 defer_accept;
+
+/* RTT measurement */
+ __u8 backoff; /* backoff */
+ __u32 srtt; /* smothed round trip time << 3 */
__u32 mdev; /* medium deviation */
- __u32 snd_cwnd; /* Sending congestion window */
__u32 rto; /* retransmit timeout */
__u32 packets_out; /* Packets which are "in flight" */
__u32 fackets_out; /* Non-retrans SACK'd packets */
__u32 retrans_out; /* Fast-retransmitted packets out */
__u32 high_seq; /* snd_nxt at onset of congestion */
+
/*
* Slow start and congestion control (see also Nagle, and Karn & Partridge)
*/
__u32 snd_ssthresh; /* Slow start size threshold */
+ __u32 snd_cwnd; /* Sending congestion window */
__u16 snd_cwnd_cnt; /* Linear increase counter */
__u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
- __u8 dup_acks; /* Consequetive duplicate acks seen from other end */
- __u8 delayed_acks;
+
+ __u8 nonagle; /* Disable Nagle algorithm? */
+ __u8 syn_retries; /* num of allowed syn retries */
__u16 user_mss; /* mss requested by user in ioctl */
/* Two commonly used timers in both sender and receiver paths. */
@@ -294,34 +318,49 @@ struct tcp_opt {
__u8 snd_wscale; /* Window scaling received from sender */
__u8 rcv_wscale; /* Window scaling to send to receiver */
__u8 rexmt_done; /* Retransmitted up to send head? */
+ __u8 keepalive_probes; /* num of allowed keep alive probes */
+
+/* PAWS/RTTM data */
__u32 rcv_tsval; /* Time stamp value */
__u32 rcv_tsecr; /* Time stamp echo reply */
__u32 ts_recent; /* Time stamp to echo next */
long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
- int num_sacks; /* Number of SACK blocks */
+ __u32 last_ack_sent; /* last ack we sent (RTTM/PAWS) */
+
+/* SACKs data */
struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
struct timer_list probe_timer; /* Probes */
- __u32 window_clamp; /* XXX Document this... -DaveM */
- __u32 probes_out; /* unanswered 0 window probes */
+ __u32 window_clamp; /* Maximal window to advertise */
+ __u8 probes_out; /* unanswered 0 window probes */
+ __u8 num_sacks; /* Number of SACK blocks */
+ __u16 advmss; /* Advertised MSS */
+
+ __u32 syn_stamp;
__u32 syn_seq;
__u32 fin_seq;
__u32 urg_seq;
__u32 urg_data;
- __u32 last_seg_size; /* Size of last incoming segment */
- __u32 rcv_mss; /* MSS used for delayed ACK decisions */
+ /* The syn_wait_lock is necessary only to avoid tcp_get_info having
+ * to grab the main lock sock while browsing the listening hash
+ * (otherwise it's deadlock prone).
+ * This lock is acquired in read mode only from tcp_get_info() and
+ * it's acquired in write mode _only_ from code that is actively
+ * changing the syn_wait_queue. All readers that are holding
+ * the master sock lock don't need to grab this lock in read mode
+ * too as the syn_wait_queue writes are always protected from
+ * the main sock lock.
+ */
+ rwlock_t syn_wait_lock;
+ struct tcp_listen_opt *listen_opt;
+ struct open_request *accept_queue; /* Established children */
- struct open_request *syn_wait_queue;
- struct open_request **syn_wait_last;
+ int write_pending; /* A write to socket waits to start. */
- int syn_backlog; /* Backlog of received SYNs */
- int write_pending;
-
unsigned int keepalive_time; /* time before keep alive takes place */
unsigned int keepalive_intvl; /* time interval between keep alive probes */
- unsigned char keepalive_probes; /* num of allowed keep alive probes */
- unsigned char syn_retries; /* num of allowed syn retries */
+ int linger2;
};
@@ -411,7 +450,7 @@ struct sock {
unsigned short family; /* Address family */
unsigned char reuse, /* SO_REUSEADDR setting */
- nonagle; /* Disable Nagle algorithm? */
+ __unused;
atomic_t refcnt; /* Reference count */
socket_lock_t lock; /* Synchronizer... */
@@ -498,6 +537,9 @@ struct sock {
unsigned char localroute; /* Route locally only */
unsigned char protocol;
struct ucred peercred;
+ int rcvlowat;
+ long rcvtimeo;
+ long sndtimeo;
#ifdef CONFIG_FILTER
/* Socket Filtering Instructions */
@@ -557,7 +599,7 @@ struct sock {
struct timer_list timer; /* This is the sock cleanup timer. */
struct timeval stamp;
- /* Identd */
+ /* Identd and reporting IO signals */
struct socket *socket;
/* RPC layer private data */
@@ -599,12 +641,6 @@ struct proto {
int (*disconnect)(struct sock *sk, int flags);
struct sock * (*accept) (struct sock *sk, int flags, int *err);
- void (*retransmit)(struct sock *sk, int all);
- void (*write_wakeup)(struct sock *sk);
- void (*read_wakeup)(struct sock *sk);
-
- unsigned int (*poll)(struct file * file, struct socket *sock,
- struct poll_table_struct *wait);
int (*ioctl)(struct sock *sk, int cmd,
unsigned long arg);
@@ -632,8 +668,6 @@ struct proto {
void (*unhash)(struct sock *sk);
int (*get_port)(struct sock *sk, unsigned short snum);
- unsigned short max_header;
- unsigned long retransmits;
char name[32];
struct {
@@ -672,6 +706,9 @@ static void __inline__ sock_prot_dec_use(struct proto *prot)
* While locked, BH processing will add new packets to
* the backlog queue. This queue is processed by the
* owner of the socket lock right before it is released.
+ *
+ * Since ~2.3.5 it is also exclusive sleep lock serializing
+ * accesses from user process context.
*/
extern void __lock_sock(struct sock *sk);
extern void __release_sock(struct sock *sk);
@@ -682,11 +719,12 @@ do { spin_lock_bh(&((__sk)->lock.slock)); \
(__sk)->lock.users = 1; \
spin_unlock_bh(&((__sk)->lock.slock)); \
} while(0)
+
#define release_sock(__sk) \
do { spin_lock_bh(&((__sk)->lock.slock)); \
- (__sk)->lock.users = 0; \
if ((__sk)->backlog.tail != NULL) \
__release_sock(__sk); \
+ (__sk)->lock.users = 0; \
wake_up(&((__sk)->lock.wq)); \
spin_unlock_bh(&((__sk)->lock.slock)); \
} while(0)
@@ -788,9 +826,6 @@ extern int sock_no_mmap(struct file *file,
* Default socket callbacks and setup code
*/
-extern void sock_def_callback1(struct sock *);
-extern void sock_def_callback2(struct sock *, int);
-extern void sock_def_callback3(struct sock *);
extern void sock_def_destruct(struct sock *);
/* Initialise core socket variables */
@@ -888,6 +923,34 @@ extern __inline__ void sock_put(struct sock *sk)
sk_free(sk);
}
+/* Detach socket from process context.
+ * Announce socket dead, detach it from wait queue and inode.
+ * Note that parent inode held reference count on this struct sock,
+ * we do not release it in this function, because protocol
+ * probably wants some additional cleanups or even continuing
+ * to work with this socket (TCP).
+ *
+ * NOTE: When softnet goes in replace _irq with _bh!
+ */
+extern __inline__ void sock_orphan(struct sock *sk)
+{
+ write_lock_irq(&sk->callback_lock);
+ sk->dead = 1;
+ sk->socket = NULL;
+ sk->sleep = NULL;
+ write_unlock_irq(&sk->callback_lock);
+}
+
+extern __inline__ void sock_graft(struct sock *sk, struct socket *parent)
+{
+ write_lock_irq(&sk->callback_lock);
+ sk->sleep = &parent->wait;
+ parent->sk = sk;
+ sk->socket = parent;
+ write_unlock_irq(&sk->callback_lock);
+}
+
+
extern __inline__ struct dst_entry *
__sk_dst_get(struct sock *sk)
{
@@ -1071,13 +1134,18 @@ extern __inline__ unsigned long sock_wspace(struct sock *sk)
return amt;
}
+#define SOCK_MIN_SNDBUF 2048
+#define SOCK_MIN_RCVBUF 128
+/* Must be less or equal SOCK_MIN_SNDBUF */
+#define SOCK_MIN_WRITE_SPACE SOCK_MIN_SNDBUF
+
/*
* Default write policy as shown to user space via poll/select/SIGIO
* Kernel internally doesn't use the MIN_WRITE_SPACE threshold.
*/
extern __inline__ int sock_writeable(struct sock *sk)
{
- return sock_wspace(sk) >= MIN_WRITE_SPACE;
+ return sock_wspace(sk) >= SOCK_MIN_WRITE_SPACE;
}
extern __inline__ int gfp_any(void)
@@ -1085,6 +1153,20 @@ extern __inline__ int gfp_any(void)
return in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
}
+extern __inline__ long sock_rcvtimeo(struct sock *sk, int noblock)
+{
+ return noblock ? 0 : sk->rcvtimeo;
+}
+
+extern __inline__ long sock_sndtimeo(struct sock *sk, int noblock)
+{
+ return noblock ? 0 : sk->sndtimeo;
+}
+
+extern __inline__ int sock_rcvlowat(struct sock *sk, int waitall, int len)
+{
+ return waitall ? len : min(sk->rcvlowat, len);
+}
/*
* Enable debug/info messages
@@ -1117,4 +1199,7 @@ extern __inline__ int gfp_any(void)
lock_sock(sk); \
}
+extern __u32 sysctl_wmem_max;
+extern __u32 sysctl_rmem_max;
+
#endif /* _SOCK_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index ef7da5368..1892cb30d 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -19,6 +19,7 @@
#define _TCP_H
#define TCP_DEBUG 1
+#undef TCP_FORMAL_WINDOW
#include <linux/config.h>
#include <linux/tcp.h>
@@ -130,27 +131,27 @@ struct tcp_tw_bucket {
struct sock *bind_next;
struct sock **bind_pprev;
unsigned char state,
- zapped;
+ substate; /* "zapped" is replaced with "substate" */
__u16 sport;
unsigned short family;
unsigned char reuse,
- nonagle;
+ rcv_wscale; /* It is also TW bucket specific */
atomic_t refcnt;
/* And these are ours. */
int hashent;
+ int timeout;
__u32 rcv_nxt;
__u32 snd_nxt;
+ __u32 rcv_wnd;
+ __u32 syn_seq;
__u32 ts_recent;
long ts_recent_stamp;
+ unsigned long ttd;
struct tcp_bind_bucket *tb;
struct tcp_tw_bucket *next_death;
struct tcp_tw_bucket **pprev_death;
- int death_slot;
-#ifdef CONFIG_TCP_TW_RECYCLE
- unsigned long ttd;
- int rto;
-#endif
+
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
struct in6_addr v6_daddr;
struct in6_addr v6_rcv_saddr;
@@ -169,10 +170,11 @@ extern __inline__ void tcp_tw_put(struct tcp_tw_bucket *tw)
}
}
-extern int tcp_tw_death_row_slot;
+extern atomic_t tcp_orphan_count;
+extern int tcp_tw_count;
+extern void tcp_time_wait(struct sock *sk, int state, int timeo);
extern void tcp_timewait_kill(struct tcp_tw_bucket *tw);
-extern void tcp_tw_schedule(struct tcp_tw_bucket *tw);
-extern void tcp_tw_reschedule(struct tcp_tw_bucket *tw);
+extern void tcp_tw_schedule(struct tcp_tw_bucket *tw, int timeo);
extern void tcp_tw_deschedule(struct tcp_tw_bucket *tw);
@@ -224,67 +226,81 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
return tcp_lhashfn(sk->num);
}
-/* Note, that it is > than ipv6 header */
-#define NETHDR_SIZE (sizeof(struct iphdr) + 40)
-
-/*
- * 40 is maximal IP options size
- * 20 is the maximum TCP options size we can currently construct on a SYN.
- * 40 is the maximum possible TCP options size.
- */
-
-#define MAX_SYN_SIZE (NETHDR_SIZE + sizeof(struct tcphdr) + 20 + MAX_HEADER + 15)
-#define MAX_FIN_SIZE (NETHDR_SIZE + sizeof(struct tcphdr) + MAX_HEADER + 15)
-#define BASE_ACK_SIZE (NETHDR_SIZE + MAX_HEADER + 15)
-#define MAX_ACK_SIZE (NETHDR_SIZE + sizeof(struct tcphdr) + MAX_HEADER + 15)
-#define MAX_RESET_SIZE (NETHDR_SIZE + sizeof(struct tcphdr) + MAX_HEADER + 15)
-#define MAX_TCPHEADER_SIZE (NETHDR_SIZE + sizeof(struct tcphdr) + 20 + MAX_HEADER + 15)
+#define MAX_TCP_HEADER (128 + MAX_HEADER)
/*
* Never offer a window over 32767 without using window scaling. Some
* poor stacks do signed 16bit maths!
*/
-#define MAX_WINDOW 32767
-#define MAX_DELAY_ACK 2
+#define MAX_TCP_WINDOW 32767
+
+/* Minimal accepted MSS. It is (60+60+8) - (20+20). */
+#define TCP_MIN_MSS 88
+
+/* Minimal RCV_MSS. */
+#define TCP_MIN_RCVMSS 536
/*
* How much of the receive buffer do we advertize
* (the rest is reserved for headers and driver packet overhead)
* Use a power of 2.
*/
-#define WINDOW_ADVERTISE_DIVISOR 2
+#define TCP_WINDOW_ADVERTISE_DIVISOR 2
/* urg_data states */
-#define URG_VALID 0x0100
-#define URG_NOTYET 0x0200
-#define URG_READ 0x0400
+#define TCP_URG_VALID 0x0100
+#define TCP_URG_NOTYET 0x0200
+#define TCP_URG_READ 0x0400
-#define TCP_RETR1 7 /*
+#define TCP_RETR1 3 /*
* This is how many retries it does before it
* tries to figure out if the gateway is
- * down.
+ * down. Minimal RFC value is 3; it corresponds
+ * to ~3sec-8min depending on RTO.
*/
#define TCP_RETR2 15 /*
* This should take at least
* 90 minutes to time out.
+ * RFC1122 says that the limit is 100 sec.
+ * 15 is ~13-30min depending on RTO.
+ */
+
+#define TCP_SYN_RETRIES 5 /* number of times to retry active opening a
+ * connection: ~180sec is RFC minumum */
+
+#define TCP_SYNACK_RETRIES 5 /* number of times to retry passive opening a
+ * connection: ~180sec is RFC minumum */
+
+
+#define TCP_ORPHAN_RETRIES 7 /* number of times to retry on an orphaned
+ * socket. 7 is ~50sec-16min.
*/
-#define TCP_TIMEOUT_LEN (15*60*HZ) /* should be about 15 mins */
-#define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to successfully
- * close the socket, about 60 seconds */
-#define TCP_FIN_TIMEOUT (3*60*HZ) /* BSD style FIN_WAIT2 deadlock breaker */
-
-#define TCP_ACK_TIME (3*HZ) /* time to delay before sending an ACK */
-#define TCP_WRITE_TIME (30*HZ) /* initial time to wait for an ACK,
- * after last transmit */
-#define TCP_TIMEOUT_INIT (3*HZ) /* RFC 1122 initial timeout value */
-#define TCP_SYN_RETRIES 10 /* number of times to retry opening a
- * connection (TCP_RETR2-....) */
-#define TCP_PROBEWAIT_LEN (1*HZ)/* time to wait between probes when
- * I've got something to write and
- * there is no window */
-#define TCP_KEEPALIVE_TIME (120*60*HZ) /* two hours */
+
+#define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT
+ * state, about 60 seconds */
+#define TCP_FIN_TIMEOUT TCP_TIMEWAIT_LEN
+ /* BSD style FIN_WAIT2 deadlock breaker.
+ * It used to be 3min, new value is 60sec,
+ * to combine FIN-WAIT-2 timeout with
+ * TIME-WAIT timer.
+ */
+
+#define TCP_DELACK_MAX (HZ/2) /* maximal time to delay before sending an ACK */
+#define TCP_DELACK_MIN (2) /* minimal time to delay before sending an ACK,
+ * 2 scheduler ticks, not depending on HZ */
+#define TCP_ATO_MAX ((TCP_DELACK_MAX*4)/5) /* ATO producing TCP_DELACK_MAX */
+#define TCP_ATO_MIN 2
+#define TCP_RTO_MAX (120*HZ)
+#define TCP_RTO_MIN (HZ/5)
+#define TCP_TIMEOUT_INIT (3*HZ) /* RFC 1122 initial RTO value */
+
+#define TCP_RESOURCE_PROBE_INTERVAL (HZ/2) /* Maximal interval between probes
+ * for local resources.
+ */
+
+#define TCP_KEEPALIVE_TIME (120*60*HZ) /* two hours */
#define TCP_KEEPALIVE_PROBES 9 /* Max of 9 keepalive probes */
#define TCP_KEEPALIVE_INTVL (75*HZ)
@@ -293,14 +309,39 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
#define MAX_TCP_KEEPCNT 127
#define MAX_TCP_SYNCNT 127
-#define TCP_SYNACK_PERIOD (HZ/2) /* How often to run the synack slow timer */
-#define TCP_QUICK_TRIES 8 /* How often we try to retransmit, until
- * we tell the link layer that it is something
- * wrong (e.g. that it can expire redirects) */
-
/* TIME_WAIT reaping mechanism. */
#define TCP_TWKILL_SLOTS 8 /* Please keep this a power of 2. */
-#define TCP_TWKILL_PERIOD ((HZ*60)/TCP_TWKILL_SLOTS)
+#define TCP_TWKILL_PERIOD (TCP_TIMEWAIT_LEN/TCP_TWKILL_SLOTS)
+
+#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */
+#define TCP_SYNQ_HSIZE 64 /* Size of SYNACK hash table */
+
+#define TCP_PAWS_24DAYS (60 * 60 * 24 * 24)
+#define TCP_PAWS_MSL 60 /* Per-host timestamps are invalidated
+ * after this time. It should be equal
+ * (or greater than) TCP_TIMEWAIT_LEN
+ * to provide reliability equal to one
+ * provided by timewait state.
+ */
+#define TCP_PAWS_WINDOW 1 /* Replay window for per-host
+ * timestamps. It must be less than
+ * minimal timewait lifetime.
+ */
+
+#define TCP_TW_RECYCLE_SLOTS_LOG 5
+#define TCP_TW_RECYCLE_SLOTS (1<<TCP_TW_RECYCLE_SLOTS_LOG)
+
+/* If time > 4sec, it is "slow" path, no recycling is required,
+ so that we select tick to get range about 4 seconds.
+ */
+
+#if HZ == 100
+#define TCP_TW_RECYCLE_TICK (7+2-TCP_TW_RECYCLE_SLOTS_LOG)
+#elif HZ == 1024
+#define TCP_TW_RECYCLE_TICK (10+2-TCP_TW_RECYCLE_SLOTS_LOG)
+#else
+#error HZ != 100 && HZ != 1024.
+#endif
/*
* TCP option
@@ -331,23 +372,40 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
#define TCPOLEN_SACK_BASE_ALIGNED 4
#define TCPOLEN_SACK_PERBLOCK 8
-#define TIME_WRITE 1 /* Not yet used */
-#define TIME_RETRANS 2 /* Retransmit timer */
-#define TIME_DACK 3 /* Delayed ack timer */
-#define TIME_PROBE0 4
-#define TIME_KEEPOPEN 5
+#define TCP_TIME_RETRANS 1 /* Retransmit timer */
+#define TCP_TIME_DACK 2 /* Delayed ack timer */
+#define TCP_TIME_PROBE0 3 /* Zero window probe timer */
+#define TCP_TIME_KEEPOPEN 4 /* Keepalive timer */
/* sysctl variables for tcp */
+extern int sysctl_max_syn_backlog;
+extern int sysctl_tcp_timestamps;
+extern int sysctl_tcp_window_scaling;
+extern int sysctl_tcp_sack;
+extern int sysctl_tcp_fin_timeout;
+extern int sysctl_tcp_tw_recycle;
extern int sysctl_tcp_keepalive_time;
extern int sysctl_tcp_keepalive_probes;
extern int sysctl_tcp_keepalive_intvl;
extern int sysctl_tcp_syn_retries;
+extern int sysctl_tcp_synack_retries;
+extern int sysctl_tcp_retries1;
+extern int sysctl_tcp_retries2;
+extern int sysctl_tcp_orphan_retries;
+extern int sysctl_tcp_syncookies;
+extern int sysctl_tcp_retrans_collapse;
+extern int sysctl_tcp_stdurg;
+extern int sysctl_tcp_rfc1337;
+extern int sysctl_tcp_tw_recycle;
+extern int sysctl_tcp_abort_on_overflow;
+extern int sysctl_tcp_max_orphans;
+extern int sysctl_tcp_max_tw_buckets;
struct open_request;
struct or_calltable {
int family;
- void (*rtx_syn_ack) (struct sock *sk, struct open_request *req);
+ int (*rtx_syn_ack) (struct sock *sk, struct open_request *req, struct dst_entry*);
void (*send_ack) (struct sk_buff *skb, struct open_request *req);
void (*destructor) (struct open_request *req);
void (*send_reset) (struct sk_buff *skb);
@@ -376,12 +434,14 @@ struct open_request {
__u16 rmt_port;
__u16 mss;
__u8 retrans;
- __u8 __pad;
- unsigned snd_wscale : 4,
+ __u8 index;
+ __u16 snd_wscale : 4,
rcv_wscale : 4,
tstamp_ok : 1,
sack_ok : 1,
- wscale_ok : 1;
+ wscale_ok : 1,
+ ecn_ok : 1,
+ acked : 1;
/* The following two fields can be easily recomputed I think -AK */
__u32 window_clamp; /* window clamp at creation time */
__u32 rcv_wnd; /* rcv_wnd offered first time */
@@ -400,8 +460,14 @@ struct open_request {
/* SLAB cache for open requests. */
extern kmem_cache_t *tcp_openreq_cachep;
-#define tcp_openreq_alloc() kmem_cache_alloc(tcp_openreq_cachep, SLAB_ATOMIC)
-#define tcp_openreq_free(req) kmem_cache_free(tcp_openreq_cachep, req)
+#define tcp_openreq_alloc() kmem_cache_alloc(tcp_openreq_cachep, SLAB_ATOMIC)
+#define tcp_openreq_fastfree(req) kmem_cache_free(tcp_openreq_cachep, req)
+
+extern __inline__ void tcp_openreq_free(struct open_request *req)
+{
+ req->class->destructor(req);
+ tcp_openreq_fastfree(req);
+}
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
#define TCP_INET_FAMILY(fam) ((fam) == AF_INET)
@@ -441,9 +507,9 @@ struct tcp_func {
int (*hash_connecting) (struct sock *sk);
- __u16 net_header_len;
-
+ int (*remember_stamp) (struct sock *sk);
+ __u16 net_header_len;
int (*setsockopt) (struct sock *sk,
int level,
@@ -506,7 +572,11 @@ extern void tcp_shutdown (struct sock *sk, int how);
extern int tcp_v4_rcv(struct sk_buff *skb,
unsigned short len);
-extern int tcp_do_sendmsg(struct sock *sk, struct msghdr *msg);
+extern int tcp_v4_remember_stamp(struct sock *sk);
+
+extern int tcp_v4_tw_remember_stamp(struct tcp_tw_bucket *tw);
+
+extern int tcp_sendmsg(struct sock *sk, struct msghdr *msg, int size);
extern int tcp_ioctl(struct sock *sk,
int cmd,
@@ -522,6 +592,23 @@ extern int tcp_rcv_established(struct sock *sk,
struct tcphdr *th,
unsigned len);
+static __inline__ void tcp_dec_quickack_mode(struct tcp_opt *tp)
+{
+ if (tp->ack.quick && --tp->ack.quick == 0 && !tp->ack.pingpong) {
+ /* Leaving quickack mode we deflate ATO to give peer
+ * a time to adapt to new worse(!) RTO. It is not required
+ * in pingpong mode, when ACKs were delayed in any case.
+ */
+ tp->ack.ato = TCP_ATO_MIN;
+ }
+}
+
+static __inline__ void tcp_delack_init(struct tcp_opt *tp)
+{
+ memset(&tp->ack, 0, sizeof(tp->ack));
+}
+
+
enum tcp_tw_status
{
TCP_TW_SUCCESS = 0,
@@ -530,6 +617,7 @@ enum tcp_tw_status
TCP_TW_SYN = 3
};
+
extern enum tcp_tw_status tcp_timewait_state_process(struct tcp_tw_bucket *tw,
struct sk_buff *skb,
struct tcphdr *th,
@@ -537,7 +625,10 @@ extern enum tcp_tw_status tcp_timewait_state_process(struct tcp_tw_bucket *tw,
extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
struct open_request *req,
- struct open_request *prev);
+ struct open_request **prev);
+extern int tcp_child_process(struct sock *parent,
+ struct sock *child,
+ struct sk_buff *skb);
extern void tcp_close(struct sock *sk,
long timeout);
@@ -557,6 +648,8 @@ extern int tcp_recvmsg(struct sock *sk,
int len, int nonblock,
int flags, int *addr_len);
+extern int tcp_listen_start(struct sock *sk);
+
extern void tcp_parse_options(struct sock *sk, struct tcphdr *th,
struct tcp_opt *tp, int no_fancy);
@@ -614,9 +707,7 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
/* tcp_output.c */
-extern void tcp_read_wakeup(struct sock *);
-extern void tcp_write_xmit(struct sock *);
-extern void tcp_time_wait(struct sock *);
+extern int tcp_write_xmit(struct sock *);
extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
extern void tcp_fack_retransmit(struct sock *);
extern void tcp_xmit_retransmit_queue(struct sock *);
@@ -624,46 +715,22 @@ extern void tcp_simple_retransmit(struct sock *);
extern void tcp_send_probe0(struct sock *);
extern void tcp_send_partial(struct sock *);
-extern void tcp_write_wakeup(struct sock *);
+extern int tcp_write_wakeup(struct sock *);
extern void tcp_send_fin(struct sock *sk);
extern void tcp_send_active_reset(struct sock *sk, int priority);
extern int tcp_send_synack(struct sock *);
-extern void tcp_transmit_skb(struct sock *, struct sk_buff *);
-extern void tcp_send_skb(struct sock *, struct sk_buff *, int force_queue);
+extern int tcp_transmit_skb(struct sock *, struct sk_buff *);
+extern void tcp_send_skb(struct sock *, struct sk_buff *, int force_queue, unsigned mss_now);
extern void tcp_send_ack(struct sock *sk);
-extern void tcp_send_delayed_ack(struct sock *sk, int max_timeout);
+extern void tcp_send_delayed_ack(struct sock *sk);
/* tcp_timer.c */
extern void tcp_reset_xmit_timer(struct sock *, int, unsigned long);
extern void tcp_init_xmit_timers(struct sock *);
extern void tcp_clear_xmit_timers(struct sock *);
-extern void tcp_retransmit_timer(unsigned long);
-extern void tcp_delack_timer(unsigned long);
-extern void tcp_probe_timer(unsigned long);
-
extern void tcp_delete_keepalive_timer (struct sock *);
extern void tcp_reset_keepalive_timer (struct sock *, unsigned long);
-extern void tcp_keepalive_timer (unsigned long);
-
-/*
- * TCP slow timer
- */
-extern struct timer_list tcp_slow_timer;
-
-struct tcp_sl_timer {
- atomic_t count;
- unsigned long period;
- unsigned long last;
- void (*handler) (unsigned long);
-};
-
-#define TCP_SLT_SYNACK 0
-#define TCP_SLT_TWKILL 1
-#define TCP_SLT_MAX 2
-
-extern struct tcp_sl_timer tcp_slt_array[TCP_SLT_MAX];
-
extern int tcp_sync_mss(struct sock *sk, u32 pmtu);
/* Compute the current effective MSS, taking SACKs and IP options,
@@ -673,7 +740,7 @@ extern int tcp_sync_mss(struct sock *sk, u32 pmtu);
static __inline__ unsigned int tcp_current_mss(struct sock *sk)
{
struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
- struct dst_entry *dst = sk->dst_cache;
+ struct dst_entry *dst = __sk_dst_get(sk);
int mss_now = tp->mss_cache;
if (dst && dst->pmtu != tp->pmtu_cookie)
@@ -682,7 +749,7 @@ static __inline__ unsigned int tcp_current_mss(struct sock *sk)
if(tp->sack_ok && tp->num_sacks)
mss_now -= (TCPOLEN_SACK_BASE_ALIGNED +
(tp->num_sacks * TCPOLEN_SACK_PERBLOCK));
- return mss_now > 8 ? mss_now : 8;
+ return mss_now;
}
/* Initialize RCV_MSS value.
@@ -704,9 +771,24 @@ extern __inline__ void tcp_initialize_rcv_mss(struct sock *sk)
else
mss = tp->mss_cache;
- tp->rcv_mss = max(min(mss, 536), 8);
+ tp->ack.rcv_mss = max(min(mss, TCP_MIN_RCVMSS), TCP_MIN_MSS);
+}
+
+static __inline__ void __tcp_fast_path_on(struct tcp_opt *tp, u32 snd_wnd)
+{
+ tp->pred_flags = htonl((tp->tcp_header_len << 26) |
+ ntohl(TCP_FLAG_ACK) |
+ snd_wnd);
+}
+
+static __inline__ void tcp_fast_path_on(struct tcp_opt *tp)
+{
+ __tcp_fast_path_on(tp, tp->snd_wnd>>tp->snd_wscale);
}
+
+
+
/* Compute the actual receive window we are currently advertising.
* Rcv_nxt can be after the window if our peer push more data
* than the offered window.
@@ -751,23 +833,26 @@ extern __inline__ u16 tcp_select_window(struct sock *sk)
}
/* RFC1323 scaling applied */
- return new_win >> tp->rcv_wscale;
-}
-
-/* See if we can advertise non-zero, and if so how much we
- * can increase our advertisement. If it becomes more than
- * twice what we are talking about right now, return true.
- */
-extern __inline__ int tcp_raise_window(struct sock *sk)
-{
- struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
- u32 cur_win = tcp_receive_window(tp);
- u32 new_win = __tcp_select_window(sk);
+ new_win >>= tp->rcv_wscale;
+
+#ifdef TCP_FORMAL_WINDOW
+ if (new_win == 0) {
+ /* If we advertise zero window, disable fast path. */
+ tp->pred_flags = 0;
+ } else if (cur_win == 0 && tp->pred_flags == 0 &&
+ skb_queue_len(&tp->out_of_order_queue) == 0 &&
+ !tp->urg_data) {
+ /* If we open zero window, enable fast path.
+ Without this it will be open by the first data packet,
+ it is too late to merge checksumming to copy.
+ */
+ tcp_fast_path_on(tp);
+ }
+#endif
- return (new_win && (new_win > (cur_win << 1)));
+ return new_win;
}
-
/* TCP timestamps are only 32-bits, this causes a slight
* complication on 64-bit systems since we store a snapshot
* of jiffies in the buffer control blocks below. We decidely
@@ -804,6 +889,8 @@ struct tcp_skb_cb {
#define TCPCB_FLAG_PSH 0x08
#define TCPCB_FLAG_ACK 0x10
#define TCPCB_FLAG_URG 0x20
+#define TCPCB_FLAG_ECE 0x40
+#define TCPCB_FLAG_CWR 0x80
__u8 sacked; /* State flags for SACK/FACK. */
#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */
@@ -860,13 +947,91 @@ extern __inline__ __u32 tcp_recalc_ssthresh(struct tcp_opt *tp)
return max(min(FlightSize, tp->snd_cwnd) >> 1, 2);
}
+/* Set slow start threshould and cwnd not falling to slow start */
+extern __inline__ void __tcp_enter_cong_avoid(struct tcp_opt *tp)
+{
+ tp->snd_ssthresh = tcp_recalc_ssthresh(tp);
+ if (tp->snd_ssthresh > tp->snd_cwnd_clamp)
+ tp->snd_ssthresh = tp->snd_cwnd_clamp;
+ tp->snd_cwnd = tp->snd_ssthresh;
+ tp->snd_cwnd_cnt = 0;
+ tp->high_seq = tp->snd_nxt;
+}
+
+extern __inline__ void tcp_enter_cong_avoid(struct tcp_opt *tp)
+{
+ if (!tp->high_seq || after(tp->snd_nxt, tp->high_seq))
+ __tcp_enter_cong_avoid(tp);
+}
+
+
+/* Increase initial CWND conservatively, i.e. only if estimated
+ RTT is low enough. It is not quite correct, we should use
+ POWER i.e. RTT*BANDWIDTH, but we still cannot estimate this.
+
+ Numbers are taken from RFC1414.
+ */
+static __inline__ __u32 tcp_init_cwnd(struct tcp_opt *tp)
+{
+ __u32 cwnd;
+
+ if (!tp->srtt || tp->srtt > ((HZ/50)<<3) || tp->mss_cache > 1460)
+ cwnd = 2;
+ else if (tp->mss_cache > 1095)
+ cwnd = 3;
+ else
+ cwnd = 4;
+
+ return min(cwnd, tp->snd_cwnd_clamp);
+}
+
+
+static __inline__ int tcp_minshall_check(struct tcp_opt *tp)
+{
+ return after(tp->snd_sml,tp->snd_una) &&
+ !after(tp->snd_sml, tp->snd_nxt);
+}
+
+static __inline__ void tcp_minshall_update(struct tcp_opt *tp, int mss, int len)
+{
+ if (len < mss)
+ tp->snd_sml = tp->snd_nxt;
+}
+
+/* Return 0, if packet can be sent now without violation Nagle's rules:
+ 1. It is full sized.
+ 2. Or it contains FIN or URG.
+ 3. Or TCP_NODELAY was set.
+ 4. Or TCP_CORK is not set, and all sent packets are ACKed.
+ With Minshall's modification: all sent small packets are ACKed.
+ */
+
+static __inline__ int tcp_nagle_check(struct tcp_opt *tp, struct sk_buff *skb, unsigned mss_now)
+{
+ return (skb->len < mss_now &&
+ !(TCP_SKB_CB(skb)->flags & (TCPCB_FLAG_URG|TCPCB_FLAG_FIN)) &&
+ (tp->nonagle == 2 ||
+ (!tp->nonagle &&
+ tp->packets_out &&
+ tcp_minshall_check(tp))));
+}
+
/* This checks if the data bearing packet SKB (usually tp->send_head)
* should be put on the wire right now.
*/
-static __inline__ int tcp_snd_test(struct sock *sk, struct sk_buff *skb)
+static __inline__ int tcp_snd_test(struct tcp_opt *tp, struct sk_buff *skb,
+ unsigned cur_mss, int tail)
{
- struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
- int nagle_check = 1;
+ /*
+ * Reset CWND after idle period longer RTO to "restart window".
+ * It is "side" effect of the function, which is _not_ good
+ * from viewpoint of clarity. But we have to make it before
+ * checking congestion window below. Alternative is to prepend
+ * all the calls with this test.
+ */
+ if (tp->packets_out==0 &&
+ (s32)(tcp_time_stamp - tp->lsndtime) > tp->rto)
+ tp->snd_cwnd = min(tp->snd_cwnd, tcp_init_cwnd(tp));
/* RFC 1122 - section 4.2.3.4
*
@@ -876,97 +1041,126 @@ static __inline__ int tcp_snd_test(struct sock *sk, struct sk_buff *skb)
* b) There are packets in flight and we have a small segment
* [SWS avoidance and Nagle algorithm]
* (part of SWS is done on packetization)
+ * Minshall version sounds: there are no _small_
+ * segments in flight. (tcp_nagle_check)
* c) We are retransmiting [Nagle]
* d) We have too many packets 'in flight'
*
* Don't use the nagle rule for urgent data (or
* for the final FIN -DaveM).
+ *
+ * Also, Nagle rule does not apply to frames, which
+ * sit in the middle of queue (they have no chances
+ * to get new data) and if room at tail of skb is
+ * not enough to save something seriously (<32 for now).
*/
- if ((sk->nonagle == 2 && (skb->len < tp->mss_cache)) ||
- (!sk->nonagle &&
- skb->len < (tp->mss_cache >> 1) &&
- tp->packets_out &&
- !(TCP_SKB_CB(skb)->flags & (TCPCB_FLAG_URG|TCPCB_FLAG_FIN))))
- nagle_check = 0;
-
- /*
- * Reset CWND after idle period longer rto. Actually, it would
- * be better to save last send time, but VJ in SIGCOMM'88 proposes
- * to use keepalive timestamp. Well, it is not good, certainly,
- * because SMTP is still broken, but it is better than nothing yet.
- */
- if (tp->packets_out==0 && (s32)(tcp_time_stamp - tp->rcv_tstamp) > tp->rto)
- tp->snd_cwnd = min(tp->snd_cwnd, 2);
/* Don't be strict about the congestion window for the
* final FIN frame. -DaveM
*/
- return (nagle_check &&
+ return ((!tail || !tcp_nagle_check(tp, skb, cur_mss) ||
+ skb_tailroom(skb) < 32) &&
((tcp_packets_in_flight(tp) < tp->snd_cwnd) ||
(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN)) &&
!after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd) &&
tp->retransmits == 0);
}
+static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_opt *tp)
+{
+ if (!tp->packets_out && !tp->probe_timer.prev)
+ tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0, tp->rto);
+}
+
+static __inline__ int tcp_skb_is_last(struct sock *sk, struct sk_buff *skb)
+{
+ return (skb->next == (struct sk_buff*)&sk->write_queue);
+}
+
/* Push out any pending frames which were held back due to
* TCP_CORK or attempt at coalescing tiny packets.
* The socket must be locked by the caller.
*/
-static __inline__ void tcp_push_pending_frames(struct sock *sk, struct tcp_opt *tp)
+static __inline__ void __tcp_push_pending_frames(struct sock *sk,
+ struct tcp_opt *tp,
+ unsigned cur_mss)
{
- if(tp->send_head) {
- if(tcp_snd_test(sk, tp->send_head))
- tcp_write_xmit(sk);
- else if(tp->packets_out == 0 && !tp->pending) {
- /* We held off on this in tcp_send_skb() */
- tp->pending = TIME_PROBE0;
- tcp_reset_xmit_timer(sk, TIME_PROBE0, tp->rto);
- }
+ struct sk_buff *skb = tp->send_head;
+
+ if (skb) {
+ if (!tcp_snd_test(tp, skb, cur_mss, tcp_skb_is_last(sk, skb)) ||
+ tcp_write_xmit(sk))
+ tcp_check_probe_timer(sk, tp);
}
}
-/* This tells the input processing path that an ACK should go out
- * right now.
- */
-#define tcp_enter_quickack_mode(__tp) ((__tp)->ato |= (1<<31))
-#define tcp_exit_quickack_mode(__tp) ((__tp)->ato &= ~(1<<31))
-#define tcp_in_quickack_mode(__tp) (((__tp)->ato & (1 << 31)) != 0)
+static __inline__ void tcp_push_pending_frames(struct sock *sk,
+ struct tcp_opt *tp)
+{
+ __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk));
+}
+
+extern void tcp_destroy_sock(struct sock *sk);
+
/*
- * List all states of a TCP socket that can be viewed as a "connected"
- * state. This now includes TCP_SYN_RECV, although I am not yet fully
- * convinced that this is the solution for the 'getpeername(2)'
- * problem. Thanks to Stephen A. Wood <saw@cebaf.gov> -FvK
+ * Calculate(/check) TCP checksum
*/
+static __inline__ u16 tcp_v4_check(struct tcphdr *th, int len,
+ unsigned long saddr, unsigned long daddr,
+ unsigned long base)
+{
+ return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
+}
-extern __inline const int tcp_connected(const int state)
+static __inline__ int __tcp_checksum_complete(struct sk_buff *skb)
{
- return ((1 << state) &
- (TCPF_ESTABLISHED|TCPF_CLOSE_WAIT|TCPF_FIN_WAIT1|
- TCPF_FIN_WAIT2|TCPF_SYN_RECV));
+ return (unsigned short)csum_fold(csum_partial(skb->h.raw, skb->len, skb->csum));
}
-extern __inline const int tcp_established(const int state)
+static __inline__ int tcp_checksum_complete(struct sk_buff *skb)
{
- return ((1 << state) &
- (TCPF_ESTABLISHED|TCPF_CLOSE_WAIT|TCPF_FIN_WAIT1|
- TCPF_FIN_WAIT2));
+ return skb->ip_summed != CHECKSUM_UNNECESSARY &&
+ __tcp_checksum_complete(skb);
}
-extern void tcp_destroy_sock(struct sock *sk);
+/* Prequeue for VJ style copy to user, combined with checksumming. */
+static __inline__ void tcp_prequeue_init(struct tcp_opt *tp)
+{
+ tp->ucopy.task = NULL;
+ tp->ucopy.len = 0;
+ tp->ucopy.memory = 0;
+ skb_queue_head_init(&tp->ucopy.prequeue);
+}
-/*
- * Calculate(/check) TCP checksum
+/* Packet is added to VJ-style prequeue for processing in process
+ * context, if a reader task is waiting. Apparently, this exciting
+ * idea (VJ's mail "Re: query about TCP header on tcp-ip" of 07 Sep 93)
+ * failed somewhere. Latency? Burstiness? Well, at least now we will
+ * see, why it failed. 8)8) --ANK
*/
-static __inline__ u16 tcp_v4_check(struct tcphdr *th, int len,
- unsigned long saddr, unsigned long daddr,
- unsigned long base)
+static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
{
- return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
+ struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
+
+ if (tp->ucopy.task) {
+ if ((tp->ucopy.memory += skb->truesize) <= (sk->rcvbuf<<1)) {
+ __skb_queue_tail(&tp->ucopy.prequeue, skb);
+ if (skb_queue_len(&tp->ucopy.prequeue) == 1)
+ wake_up_interruptible(sk->sleep);
+ } else {
+ NET_INC_STATS_BH(TCPPrequeueDropped);
+ tp->ucopy.memory -= skb->truesize;
+ kfree_skb(skb);
+ }
+ return 1;
+ }
+ return 0;
}
+
#undef STATE_TRACE
#ifdef STATE_TRACE
@@ -1007,9 +1201,12 @@ static __inline__ void tcp_set_state(struct sock *sk, int state)
static __inline__ void tcp_done(struct sock *sk)
{
+ tcp_set_state(sk, TCP_CLOSE);
+ tcp_clear_xmit_timers(sk);
+
sk->shutdown = SHUTDOWN_MASK;
- if (!sk->dead)
+ if (!sk->dead)
sk->state_change(sk);
else
tcp_destroy_sock(sk);
@@ -1106,7 +1303,7 @@ extern __inline__ void tcp_select_initial_window(int space, __u32 mss,
* our initial window offering to 32k. There should also
* be a sysctl option to stop being nice.
*/
- (*rcv_wnd) = min(space, MAX_WINDOW);
+ (*rcv_wnd) = min(space, MAX_TCP_WINDOW);
(*rcv_wscale) = 0;
if (wscale_ok) {
/* See RFC1323 for an explanation of the limit to 14 */
@@ -1123,52 +1320,127 @@ extern __inline__ void tcp_select_initial_window(int space, __u32 mss,
extern __inline__ int tcp_space(struct sock *sk)
{
return (sk->rcvbuf - atomic_read(&sk->rmem_alloc)) /
- WINDOW_ADVERTISE_DIVISOR;
+ TCP_WINDOW_ADVERTISE_DIVISOR;
}
extern __inline__ int tcp_full_space( struct sock *sk)
{
- return sk->rcvbuf / WINDOW_ADVERTISE_DIVISOR;
+ return sk->rcvbuf / TCP_WINDOW_ADVERTISE_DIVISOR;
}
-extern __inline__ void tcp_synq_unlink(struct tcp_opt *tp, struct open_request *req, struct open_request *prev)
+extern __inline__ void tcp_init_buffer_space(struct sock *sk)
{
- if(!req->dl_next)
- tp->syn_wait_last = (struct open_request **)prev;
- prev->dl_next = req->dl_next;
+ struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
+ int rcvbuf = tp->advmss+MAX_TCP_HEADER+16+sizeof(struct sk_buff);
+ int sndbuf = tp->mss_clamp+MAX_TCP_HEADER+16+sizeof(struct sk_buff);
+
+ if (sk->rcvbuf < 3*rcvbuf)
+ sk->rcvbuf = min (3*rcvbuf, sysctl_rmem_max);
+ if (sk->sndbuf < 3*sndbuf)
+ sk->sndbuf = min (3*sndbuf, sysctl_wmem_max);
}
-extern __inline__ void tcp_synq_queue(struct tcp_opt *tp, struct open_request *req)
-{
- req->dl_next = NULL;
- *tp->syn_wait_last = req;
- tp->syn_wait_last = &req->dl_next;
+extern __inline__ void tcp_acceptq_removed(struct sock *sk)
+{
+ sk->ack_backlog--;
}
-extern __inline__ void tcp_synq_init(struct tcp_opt *tp)
+extern __inline__ void tcp_acceptq_added(struct sock *sk)
{
- tp->syn_wait_queue = NULL;
- tp->syn_wait_last = &tp->syn_wait_queue;
+ sk->ack_backlog++;
}
-extern void __tcp_inc_slow_timer(struct tcp_sl_timer *slt);
-extern __inline__ void tcp_inc_slow_timer(int timer)
+extern __inline__ int tcp_acceptq_is_full(struct sock *sk)
{
- struct tcp_sl_timer *slt = &tcp_slt_array[timer];
-
- if (atomic_read(&slt->count) == 0)
- {
- __tcp_inc_slow_timer(slt);
- }
+ return sk->ack_backlog > sk->max_ack_backlog;
+}
+
+extern __inline__ void tcp_acceptq_queue(struct sock *sk, struct open_request *req,
+ struct sock *child)
+{
+ struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
+
+ req->sk = child;
+ tcp_acceptq_added(sk);
+
+ req->dl_next = tp->accept_queue;
+ tp->accept_queue = req;
+}
+
+struct tcp_listen_opt
+{
+ u8 max_qlen_log; /* log_2 of maximal queued SYNs */
+ int qlen;
+ int qlen_young;
+ int clock_hand;
+ struct open_request *syn_table[TCP_SYNQ_HSIZE];
+};
+
+extern __inline__ void
+tcp_synq_removed(struct sock *sk, struct open_request *req)
+{
+ struct tcp_listen_opt *lopt = sk->tp_pinfo.af_tcp.listen_opt;
+
+ if (--lopt->qlen == 0)
+ tcp_delete_keepalive_timer(sk);
+ if (req->retrans == 0)
+ lopt->qlen_young--;
+}
+
+extern __inline__ void tcp_synq_added(struct sock *sk)
+{
+ struct tcp_listen_opt *lopt = sk->tp_pinfo.af_tcp.listen_opt;
+
+ if (lopt->qlen++ == 0)
+ tcp_reset_keepalive_timer(sk, TCP_TIMEOUT_INIT);
+ lopt->qlen_young++;
+}
+
+extern __inline__ int tcp_synq_len(struct sock *sk)
+{
+ return sk->tp_pinfo.af_tcp.listen_opt->qlen;
+}
+
+extern __inline__ int tcp_synq_young(struct sock *sk)
+{
+ return sk->tp_pinfo.af_tcp.listen_opt->qlen_young;
+}
- atomic_inc(&slt->count);
+extern __inline__ int tcp_synq_is_full(struct sock *sk)
+{
+ return tcp_synq_len(sk)>>sk->tp_pinfo.af_tcp.listen_opt->max_qlen_log;
}
-extern __inline__ void tcp_dec_slow_timer(int timer)
+extern __inline__ void tcp_synq_unlink(struct tcp_opt *tp, struct open_request *req,
+ struct open_request **prev)
{
- struct tcp_sl_timer *slt = &tcp_slt_array[timer];
+ write_lock(&tp->syn_wait_lock);
+ *prev = req->dl_next;
+ write_unlock(&tp->syn_wait_lock);
+}
- atomic_dec(&slt->count);
+extern __inline__ void tcp_synq_drop(struct sock *sk, struct open_request *req,
+ struct open_request **prev)
+{
+ tcp_synq_unlink(&sk->tp_pinfo.af_tcp, req, prev);
+ tcp_synq_removed(sk, req);
+ tcp_openreq_free(req);
+}
+
+static __inline__ void tcp_openreq_init(struct open_request *req,
+ struct tcp_opt *tp,
+ struct sk_buff *skb)
+{
+ req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */
+ req->rcv_isn = TCP_SKB_CB(skb)->seq;
+ req->mss = tp->mss_clamp;
+ req->ts_recent = tp->saw_tstamp ? tp->rcv_tsval : 0;
+ req->tstamp_ok = tp->tstamp_ok;
+ req->sack_ok = tp->sack_ok;
+ req->snd_wscale = tp->snd_wscale;
+ req->wscale_ok = tp->wscale_ok;
+ req->acked = 0;
+ req->rmt_port = skb->h.th->source;
}
extern const char timer_bug_msg[];
@@ -1179,13 +1451,14 @@ static inline void tcp_clear_xmit_timer(struct sock *sk, int what)
struct timer_list *timer;
switch (what) {
- case TIME_RETRANS:
+ case TCP_TIME_RETRANS:
timer = &tp->retransmit_timer;
break;
- case TIME_DACK:
+ case TCP_TIME_DACK:
+ tp->ack.blocked = 0;
timer = &tp->delack_timer;
break;
- case TIME_PROBE0:
+ case TCP_TIME_PROBE0:
timer = &tp->probe_timer;
break;
default:
@@ -1199,7 +1472,7 @@ static inline void tcp_clear_xmit_timer(struct sock *sk, int what)
spin_unlock_bh(&sk->timer_lock);
}
-/* This function does not return reliable answer. You is only as advice.
+/* This function does not return reliable answer. Use it only as advice.
*/
static inline int tcp_timer_is_set(struct sock *sk, int what)
@@ -1208,13 +1481,13 @@ static inline int tcp_timer_is_set(struct sock *sk, int what)
int ret;
switch (what) {
- case TIME_RETRANS:
+ case TCP_TIME_RETRANS:
ret = tp->retransmit_timer.prev != NULL;
break;
- case TIME_DACK:
+ case TCP_TIME_DACK:
ret = tp->delack_timer.prev != NULL;
break;
- case TIME_PROBE0:
+ case TCP_TIME_PROBE0:
ret = tp->probe_timer.prev != NULL;
break;
default:
@@ -1248,18 +1521,46 @@ extern __inline__ void tcp_listen_unlock(void)
static inline int keepalive_intvl_when(struct tcp_opt *tp)
{
- if (tp->keepalive_intvl)
- return tp->keepalive_intvl;
- else
- return sysctl_tcp_keepalive_intvl;
+ return tp->keepalive_intvl ? : sysctl_tcp_keepalive_intvl;
}
static inline int keepalive_time_when(struct tcp_opt *tp)
{
- if (tp->keepalive_time)
- return tp->keepalive_time;
- else
- return sysctl_tcp_keepalive_time;
+ return tp->keepalive_time ? : sysctl_tcp_keepalive_time;
}
+static inline int tcp_fin_time(struct tcp_opt *tp)
+{
+ int fin_timeout = tp->linger2 ? : sysctl_tcp_fin_timeout;
+
+ if (fin_timeout < (tp->rto<<2) - (tp->rto>>1))
+ fin_timeout = (tp->rto<<2) - (tp->rto>>1);
+
+ return fin_timeout;
+}
+
+#if 0 /* TCP_DEBUG */
+#define TCP_CHECK_TIMER(sk) \
+do { struct tcp_opt *__tp = &sk->tp_pinfo.af_tcp; \
+ if (sk->state != TCP_CLOSE) { \
+ if (__tp->packets_out) { \
+ if (!tcp_timer_is_set(sk, TCP_TIME_RETRANS) && !timer_is_running(&__tp->retransmit_timer) && net_ratelimit()) \
+ printk(KERN_DEBUG "sk=%p RETRANS" __FUNCTION__ "(%d) %d\n", sk, __LINE__, sk->state); \
+ } else if (__tp->send_head) { \
+ if (!tcp_timer_is_set(sk, TCP_TIME_PROBE0) && !timer_is_running(&__tp->probe_timer) && net_ratelimit()) \
+ printk(KERN_DEBUG "sk=%p PROBE0" __FUNCTION__ "(%d) %d\n", sk, __LINE__, sk->state); \
+ } \
+ if (__tp->ack.pending) { \
+ if (!tcp_timer_is_set(sk, TCP_TIME_DACK) && !timer_is_running(&__tp->delack_timer) && net_ratelimit()) \
+ printk(KERN_DEBUG "sk=%p DACK" __FUNCTION__ "(%d) %d\n", sk, __LINE__, sk->state); \
+ } \
+ if (__tp->packets_out > skb_queue_len(&sk->write_queue) || \
+ (__tp->send_head && skb_queue_len(&sk->write_queue) == 0)) { \
+ printk(KERN_DEBUG "sk=%p QUEUE" __FUNCTION__ "(%d) %d %d %d %p\n", sk, __LINE__, sk->state, __tp->packets_out, skb_queue_len(&sk->write_queue), __tp->send_head); \
+ } \
+ } } while (0)
+#else
+#define TCP_CHECK_TIMER(sk) do { } while (0);
+#endif
+
#endif /* _TCP_H */