diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-06-17 14:08:29 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-06-17 14:08:29 +0000 |
commit | 57d569635c05dc4ea9b9f1f8dcec69b9ddc989b2 (patch) | |
tree | 1f703abf7d95dcd50ee52da3b96eb1b4b2b4ea53 /include | |
parent | 59223edaa18759982db0a8aced0e77457d10c68e (diff) |
The rest of 2.3.6.
Diffstat (limited to 'include')
31 files changed, 3502 insertions, 0 deletions
diff --git a/include/asm-alpha/hdreg.h b/include/asm-alpha/hdreg.h new file mode 100644 index 000000000..2d9454754 --- /dev/null +++ b/include/asm-alpha/hdreg.h @@ -0,0 +1,12 @@ +/* + * linux/include/asm-alpha/hdreg.h + * + * Copyright (C) 1994-1996 Linus Torvalds & authors + */ + +#ifndef __ASMalpha_HDREG_H +#define __ASMalpha_HDREG_H + +typedef unsigned short ide_ioreg_t; + +#endif /* __ASMalpha_HDREG_H */ diff --git a/include/asm-arm/hdreg.h b/include/asm-arm/hdreg.h new file mode 100644 index 000000000..81bc05e16 --- /dev/null +++ b/include/asm-arm/hdreg.h @@ -0,0 +1,13 @@ +/* + * linux/include/asm-arm/hdreg.h + * + * Copyright (C) 1994-1996 Linus Torvalds & authors + */ + +#ifndef __ASMARM_HDREG_H +#define __ASMARM_HDREG_H + +typedef unsigned long ide_ioreg_t; + +#endif /* __ASMARM_HDREG_H */ + diff --git a/include/asm-i386/hdreg.h b/include/asm-i386/hdreg.h new file mode 100644 index 000000000..1ad5c0739 --- /dev/null +++ b/include/asm-i386/hdreg.h @@ -0,0 +1,12 @@ +/* + * linux/include/asm-i386/hdreg.h + * + * Copyright (C) 1994-1996 Linus Torvalds & authors + */ + +#ifndef __ASMi386_HDREG_H +#define __ASMi386_HDREG_H + +typedef unsigned short ide_ioreg_t; + +#endif /* __ASMi386_HDREG_H */ diff --git a/include/asm-i386/page_offset.h b/include/asm-i386/page_offset.h new file mode 100644 index 000000000..bb3a64dc1 --- /dev/null +++ b/include/asm-i386/page_offset.h @@ -0,0 +1,8 @@ +#include <linux/config.h> +#ifdef CONFIG_1GB +#define PAGE_OFFSET_RAW 0xC0000000 +#elif defined(CONFIG_2GB) +#define PAGE_OFFSET_RAW 0x80000000 +#elif defined(CONFIG_3GB) +#define PAGE_OFFSET_RAW 0x40000000 +#endif diff --git a/include/asm-m68k/hdreg.h b/include/asm-m68k/hdreg.h new file mode 100644 index 000000000..16249bd89 --- /dev/null +++ b/include/asm-m68k/hdreg.h @@ -0,0 +1,13 @@ +/* + * linux/include/asm-m68k/hdreg.h + * + * Copyright (C) 1994-1996 Linus Torvalds & authors + */ + +#ifndef _M68K_HDREG_H +#define _M68K_HDREG_H + +typedef unsigned int q40ide_ioreg_t; +typedef unsigned char * ide_ioreg_t; + +#endif /* _M68K_HDREG_H */ diff --git a/include/asm-mips/hdreg.h b/include/asm-mips/hdreg.h new file mode 100644 index 000000000..189dfc55c --- /dev/null +++ b/include/asm-mips/hdreg.h @@ -0,0 +1,18 @@ +/* $Id: hdreg.h,v 1.4 1998/05/08 21:05:26 davem Exp $ + * + * linux/include/asm-mips/hdreg.h + * + * Copyright (C) 1994-1996 Linus Torvalds & authors + */ + +/* + * This file contains the MIPS architecture specific IDE code. + */ + +#ifndef __ASM_MIPS_HDREG_H +#define __ASM_MIPS_HDREG_H + +typedef unsigned short ide_ioreg_t; + +#endif /* __ASM_MIPS_HDREG_H */ + diff --git a/include/asm-ppc/hdreg.h b/include/asm-ppc/hdreg.h new file mode 100644 index 000000000..58123536b --- /dev/null +++ b/include/asm-ppc/hdreg.h @@ -0,0 +1,17 @@ +/* + * linux/include/asm-ppc/hdreg.h + * + * Copyright (C) 1994-1996 Linus Torvalds & authors + */ + +/* + * This file contains the ppc architecture specific IDE code. + */ + +#ifndef __ASMPPC_HDREG_H +#define __ASMPPC_HDREG_H + +typedef unsigned int ide_ioreg_t; + +#endif /* __ASMPPC_HDREG_H */ + diff --git a/include/asm-sparc64/hdreg.h b/include/asm-sparc64/hdreg.h new file mode 100644 index 000000000..29b7cfe6d --- /dev/null +++ b/include/asm-sparc64/hdreg.h @@ -0,0 +1,13 @@ +/* $Id: hdreg.h,v 1.1 1999/05/14 07:23:13 davem Exp $ + * hdreg.h: Ultra/PCI specific IDE glue. + * + * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) + * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) + */ + +#ifndef __SPARC64_HDREG_H +#define __SPARC64_HDREG_H + +typedef unsigned long ide_ioreg_t; + +#endif /* __SPARC64_HDREG_H */ diff --git a/include/linux/blkpg.h b/include/linux/blkpg.h new file mode 100644 index 000000000..2a5e4fb82 --- /dev/null +++ b/include/linux/blkpg.h @@ -0,0 +1,64 @@ +#ifndef _LINUX_BLKPG_H +#define _LINUX_BLKPG_H + +/* + * Partition table and disk geometry handling + * + * A single ioctl with lots of subfunctions: + * + * Device number stuff: + * get_whole_disk() (given the device number of a partition, + * find the device number of the encompassing disk) + * get_all_partitions() (given the device number of a disk, return the + * device numbers of all its known partitions) + * + * Partition stuff: + * add_partition() + * delete_partition() + * test_partition_in_use() (also for test_disk_in_use) + * + * Geometry stuff: + * get_geometry() + * set_geometry() + * get_bios_drivedata() + * + * For today, only the partition stuff - aeb, 990515 + */ +#include <linux/ioctl.h> + +#define BLKPG _IO(0x12,105) + +/* The argument structure */ +struct blkpg_ioctl_arg { + int op; + int flags; + int datalen; + void *data; +}; + +/* The subfunctions (for the op field) */ +#define BLKPG_ADD_PARTITION 1 +#define BLKPG_DEL_PARTITION 2 + +/* Sizes of name fields. Unused at present. */ +#define BLKPG_DEVNAMELTH 64 +#define BLKPG_VOLNAMELTH 64 + +/* The data structure for ADD_PARTITION and DEL_PARTITION */ +struct blkpg_partition { + long long start; /* starting offset in bytes */ + long long length; /* length in bytes */ + int pno; /* partition number */ + char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2, + to be used in kernel messages */ + char volname[BLKPG_VOLNAMELTH]; /* volume label */ +}; + +#ifdef __KERNEL__ + +extern char * partition_name(kdev_t dev); +extern int blk_ioctl(kdev_t dev, unsigned int cmd, unsigned long arg); + +#endif /* __KERNEL__ */ + +#endif /* _LINUX_BLKPG_H */ diff --git a/include/linux/cyclomx.h b/include/linux/cyclomx.h new file mode 100644 index 000000000..721056e32 --- /dev/null +++ b/include/linux/cyclomx.h @@ -0,0 +1,91 @@ +/* +* cyclomx.h CYCLOM X Multiprotocol WAN Link Driver. +* User-level API definitions. +* +* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> +* +* Copyright: (c) 1998, 1999 Arnaldo Carvalho de Melo +* +* Based on wanpipe.h by Gene Kozin <genek@compuserve.com> +* +* 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. +* ============================================================================ +* 1999/05/19 acme wait_queue_head_t wait_stats(support for 2.3.*) +* 1999/01/03 acme judicious use of data types +* Dec 27, 1998 Arnaldo cleanup: PACKED not needed +* Aug 08, 1998 Arnaldo Version 0.0.1 +*/ +#ifndef _CYCLOMX_H +#define _CYCLOMX_H + +#include <linux/wanrouter.h> +#include <asm/spinlock.h> + +#ifdef __KERNEL__ +/* Kernel Interface */ + +#include <linux/cycx_drv.h> /* CYCLOM X support module API definitions */ +#include <linux/cycx_cfm.h> /* CYCLOM X firmware module definitions */ +#ifdef CONFIG_CYCLOMX_X25 +#include <linux/cycx_x25.h> +#endif + +#ifndef min +#define min(a,b) (((a)<(b))?(a):(b)) +#endif +#ifndef max +#define max(a,b) (((a)>(b))?(a):(b)) +#endif + +#define is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0) + +/* Adapter Data Space. + * This structure is needed because we handle multiple cards, otherwise + * static data would do it. + */ +typedef struct cycx { + char devname[WAN_DRVNAME_SZ+1]; /* card name */ + cycxhw_t hw; /* hardware configuration */ + wan_device_t wandev; /* WAN device data space */ + u32 open_cnt; /* number of open interfaces */ + u32 state_tick; /* link state timestamp */ + spinlock_t lock; + char in_isr; /* interrupt-in-service flag */ + char buff_int_mode_unbusy; /* flag for carrying out dev_tint */ + u16 irq_dis_if_send_count; /* Disabling irqs in if_send*/ +#if LINUX_VERSION_CODE >= 0x020300 + wait_queue_head_t wait_stats; /* to wait for the STATS indication */ +#else + struct wait_queue* wait_stats; /* to wait for the STATS indication */ +#endif + u32 mbox; /* -> mailbox */ + void (*isr)(struct cycx* card); /* interrupt service routine */ + int (*exec)(struct cycx* card, void* u_cmd, void* u_data); + union { +#ifdef CONFIG_CYCLOMX_X25 + struct { /* X.25 specific data */ + u32 lo_pvc; + u32 hi_pvc; + u32 lo_svc; + u32 hi_svc; + TX25Stats stats; + unsigned critical; /* critical section flag */ + u32 connection_keys; + } x; +#endif + } u; +} cycx_t; + +/* Public Functions */ +void cyclomx_open (cycx_t* card); /* cycx_main.c */ +void cyclomx_close (cycx_t* card); /* cycx_main.c */ +void cyclomx_set_state (cycx_t* card, int state); /* cycx_main.c */ + +#ifdef CONFIG_CYCLOMX_X25 +int cyx_init (cycx_t* card, wandev_conf_t* conf); /* cycx_x25.c */ +#endif +#endif /* __KERNEL__ */ +#endif /* _CYCLOMX_H */ diff --git a/include/linux/cycx_cfm.h b/include/linux/cycx_cfm.h new file mode 100644 index 000000000..3ea78dc9e --- /dev/null +++ b/include/linux/cycx_cfm.h @@ -0,0 +1,81 @@ +/* +* cycx_cfm.h CYCLOM X Multiprotocol WAN Link Driver. +* Definitions for the CYCLOM X Firmware Module (CFM). +* +* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> +* Copyright: (c) 1998, 1999 Arnaldo Carvalho de Melo +* +* Based on sdlasfm.h by Gene Kozin <74604.152@compuserve.com> +* +* 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. +* ============================================================================ +* Aug 08, 1998 Arnaldo Initial version. +*/ +#ifndef _CYCX_CFM_H +#define _CYCX_CFM_H + +/* Defines */ + +#define CFM_VERSION 2 +#define CFM_SIGNATURE "CFM - Cyclades CYCX Firmware Module" + +/* min/max */ +#define CFM_IMAGE_SIZE 0x20000 /* max size of CYCX code image file */ +#define CFM_DESCR_LEN 256 /* max length of description string */ +#define CFM_MAX_CYCX 1 /* max number of compatible adapters */ +#define CFM_LOAD_BUFSZ 0x400 /* buffer size for reset code (buffer_load) */ + +/* Firmware Commands */ +#define GEN_POWER_ON 0x1280 + +#define GEN_SET_SEG 0x1401 /* boot segment setting. */ +#define GEN_BOOT_DAT 0x1402 /* boot data. */ +#define GEN_START 0x1403 /* board start. */ +#define GEN_DEFPAR 0x1404 /* buffer length for boot. */ + +/* Adapter types */ +#define CYCX_2X 2 +#define CYCX_8X 8 +#define CYCX_16X 16 + +#define CFID_X25_2X 5200 + + +/* Data Types */ + +typedef struct cfm_info /* firmware module information */ +{ + unsigned short codeid; /* firmware ID */ + unsigned short version; /* firmaware version number */ + unsigned short adapter[CFM_MAX_CYCX]; /* compatible adapter types */ + unsigned long memsize; /* minimum memory size */ + unsigned short reserved[2]; /* reserved */ + unsigned short startoffs; /* entry point offset */ + unsigned short winoffs; /* dual-port memory window offset */ + unsigned short codeoffs; /* code load offset */ + unsigned long codesize; /* code size */ + unsigned short dataoffs; /* configuration data load offset */ + unsigned long datasize; /* configuration data size */ +} cfm_info_t; + +typedef struct cfm /* CYCX firmware file structire */ +{ + char signature[80]; /* CFM file signature */ + unsigned short version; /* file format version */ + unsigned short checksum; /* info + image */ + unsigned short reserved[6]; /* reserved */ + char descr[CFM_DESCR_LEN]; /* description string */ + cfm_info_t info; /* firmware module info */ + unsigned char image[1]; /* code image (variable size) */ +} cfm_t; + +typedef struct cycx_header_s { + unsigned long reset_size; + unsigned long data_size; + unsigned long code_size; +} cycx_header_t; + +#endif /* _CYCX_CFM_H */ diff --git a/include/linux/cycx_drv.h b/include/linux/cycx_drv.h new file mode 100644 index 000000000..3448b9066 --- /dev/null +++ b/include/linux/cycx_drv.h @@ -0,0 +1,66 @@ +/* +* cycx_drv.h CYCX Support Module. Kernel API Definitions. +* +* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> +* Copyright: (c) 1998, 1999 Arnaldo Carvalho de Melo +* +* Based on sdladrv.h by Gene Kozin <genek@compuserve.com> +* +* 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. +* ============================================================================ +* 1999/01/03 acme more judicious use of data types... +* uclong, ucchar, etc deleted, the u8, u16, u32 +* types are the portable way to go. +* 1999/01/03 acme judicious use of data types... u16, u32, etc +* Dec 26, 1998 Arnaldo FIXED_BUFFERS, CONF_OFFSET, +* removal of cy_read{bwl} +* Aug 08, 1998 Arnaldo Initial version. +*/ +#ifndef _CYCX_DRV_H +#define _CYCX_DRV_H + +#define CYCX_WINDOWSIZE 0x4000 /* default dual-port memory window size */ +#define GEN_CYCX_INTR 0x02 +#define RST_ENABLE 0x04 +#define START_CPU 0x06 +#define RST_DISABLE 0x08 +#define FIXED_BUFFERS 0x08 +#define TEST_PATTERN 0xaa55 +#define CMD_OFFSET 0x20 +#define CONF_OFFSET 0x0380 +#define RESET_OFFSET 0x3c00 /* For reset file load */ +#define DATA_OFFSET 0x0100 /* For code and data files load */ +#define START_OFFSET 0x3ff0 /* 80186 starts here */ + +#ifndef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + +/* Data Structures */ +/* Adapter hardware configuration. Pointer to this structure is passed to all + * APIs. */ +typedef struct cycxhw { + u32 type; /* adapter type */ + u32 fwid; /* firmware ID */ + int irq; /* interrupt request level */ + u32 dpmbase; /* dual-port memory base */ + u32 dpmsize; /* dual-port memory size */ + u32 pclk; /* CPU clock rate, kHz */ + u32 memory; /* memory size */ + u32 reserved[5]; +} cycxhw_t; + +/* Function Prototypes */ +extern int cycx_setup (cycxhw_t* hw, void* sfm, u32 len); +extern int cycx_down (cycxhw_t* hw); +extern int cycx_inten (cycxhw_t* hw); +extern int cycx_intde (cycxhw_t* hw); +extern int cycx_intack (cycxhw_t* hw); +extern int cycx_intr (cycxhw_t* hw); +extern int cycx_peek (cycxhw_t* hw, u32 addr, void* buf, u32 len); +extern int cycx_poke (cycxhw_t* hw, u32 addr, void* buf, u32 len); +extern int cycx_exec (u32 addr); +#endif /* _CYCX_DRV_H */ diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h new file mode 100644 index 000000000..e242e5795 --- /dev/null +++ b/include/linux/cycx_x25.h @@ -0,0 +1,103 @@ +/* +* cycx_x25.h Cyclom X.25 firmware API definitions. +* +* Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> +* +* Copyright: (c) 1998, 1999 Arnaldo Carvalho de Melo +* +* Based on sdla_x25.h by Gene Kozin <74604.152@compuserve.com> +* +* 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. +* ============================================================================ +* 1999/01/03 acme judicious use of data types +* +* 1999/01/02 acme #define X25_ACK_N3 0x4411 +* Dec 28, 1998 Arnaldo cleanup: lot'o'things removed +* commands listed, +* TX25Cmd & TX25Config structs +* typedef'ed +*/ +#ifndef _CYCX_X25_H +#define _CYCX_X25_H + +#ifndef PACKED +#define PACKED __attribute__((packed)) +#endif + +/* X.25 shared memory layout. */ +#define X25_MBOX_OFFS 0x300 /* general mailbox block */ +#define X25_RXMBOX_OFFS 0x340 /* receive mailbox */ + +/* DATA STRUCTURES */ +/* X.25 Command Block. */ +typedef struct X25Cmd +{ + u16 command PACKED; + u16 link PACKED; /* values: 0 or 1 */ + u16 len PACKED; /* values: 0 thru 0x205 (517) */ + u32 buf PACKED; +} TX25Cmd; + +/* Defines for the 'command' field. */ +#define X25_CONNECT_REQUEST 0x4401 +#define X25_CONNECT_RESPONSE 0x4402 +#define X25_DISCONNECT_REQUEST 0x4403 +#define X25_DISCONNECT_RESPONSE 0x4404 +#define X25_DATA_REQUEST 0x4405 +#define X25_ACK_TO_VC 0x4406 +#define X25_INTERRUPT_RESPONSE 0x4407 +#define X25_CONFIG 0x4408 +#define X25_CONNECT_INDICATION 0x4409 +#define X25_CONNECT_CONFIRM 0x440A +#define X25_DISCONNECT_INDICATION 0x440B +#define X25_DISCONNECT_CONFIRM 0x440C +#define X25_DATA_INDICATION 0x440E +#define X25_INTERRUPT_INDICATION 0x440F +#define X25_ACK_FROM_VC 0x4410 +#define X25_ACK_N3 0x4411 +#define X25_CONNECT_COLLISION 0x4413 +#define X25_N3WIN 0x4414 +#define X25_LINE_ON 0x4415 +#define X25_LINE_OFF 0x4416 +#define X25_RESET_REQUEST 0x4417 +#define X25_LOG 0x4500 +#define X25_STATISTIC 0x4600 +#define X25_TRACE 0x4700 +#define X25_N2TRACEXC 0x4702 +#define X25_N3TRACEXC 0x4703 + +typedef struct X25Config { + u8 link PACKED; /* link number */ + u8 speed PACKED; /* line speed */ + u8 clock PACKED; /* internal/external */ + u8 n2 PACKED; /* # of level 2 retransm.(values: 1 thru FF) */ + u8 n2win PACKED; /* level 2 window (values: 1 thru 7) */ + u8 n3win PACKED; /* level 3 window (values: 1 thru 7) */ + u8 nvc PACKED; /* # of logical channels (values: 1 thru 64) */ + u8 pktlen PACKED; /* level 3 packet lenght - log base 2 of size */ + u8 locaddr PACKED; /* my address */ + u8 remaddr PACKED; /* remote address */ + u16 t1 PACKED; /* time, in seconds */ + u16 t2 PACKED; /* time, in seconds */ + u8 t21 PACKED; /* time, in seconds */ + u8 npvc PACKED; /* # of permanent virt. circuits (1 thru nvc) */ + u8 t23 PACKED; /* time, in seconds */ + u8 flags PACKED; /* see dosx25.doc, in portuguese, for details */ +} TX25Config; + +typedef struct X25Stats { + u16 rx_crc_errors PACKED; + u16 rx_over_errors PACKED; + u16 n2_tx_frames PACKED; + u16 n2_rx_frames PACKED; + u16 tx_timeouts PACKED; + u16 rx_timeouts PACKED; + u16 n3_tx_packets PACKED; + u16 n3_rx_packets PACKED; + u16 tx_aborts PACKED; + u16 rx_aborts PACKED; +} TX25Stats; +#endif /* _CYCX_X25_H */ diff --git a/include/linux/dn.h b/include/linux/dn.h new file mode 100644 index 000000000..266dc0f25 --- /dev/null +++ b/include/linux/dn.h @@ -0,0 +1,161 @@ +#ifndef _LINUX_DN_H +#define _LINUX_DN_H + +/* + + DECnet Data Structures and Constants + +*/ + +/* + * DNPROTO_NSP can't be the same as SOL_SOCKET, + * so increment each by one (compared to ULTRIX) + */ +#define DNPROTO_NSP 2 /* NSP protocol number */ +#define DNPROTO_ROU 3 /* Routing protocol number */ +#define DNPROTO_NML 4 /* Net mgt protocol number */ +#define DNPROTO_EVL 5 /* Evl protocol number (usr) */ +#define DNPROTO_EVR 6 /* Evl protocol number (evl) */ +#define DNPROTO_NSPT 7 /* NSP trace protocol number */ + + +#define DN_ADDL 2 +#define DN_MAXADDL 2 /* ULTRIX headers have 20 here, but pathworks has 2 */ +#define DN_MAXOPTL 16 +#define DN_MAXOBJL 16 +#define DN_MAXACCL 40 +#define DN_MAXALIASL 128 +#define DN_MAXNODEL 256 +#define DNBUFSIZE 65023 + +/* + * SET/GET Socket options - must match the DSO_ numbers below + */ +#define SO_CONDATA 1 +#define SO_CONACCESS 2 +#define SO_PROXYUSR 3 +#define SO_LINKINFO 7 + +#define DSO_CONDATA 1 /* Set/Get connect data */ +#define DSO_DISDATA 10 /* Set/Get disconnect data */ +#define DSO_CONACCESS 2 /* Set/Get connect access data */ +#define DSO_ACCEPTMODE 4 /* Set/Get accept mode */ +#define DSO_CONACCEPT 5 /* Accept deferred connection */ +#define DSO_CONREJECT 6 /* Reject deferred connection */ +#define DSO_LINKINFO 7 /* Set/Get link information */ +#define DSO_STREAM 8 /* Set socket type to stream */ +#define DSO_SEQPACKET 9 /* Set socket type to sequenced packet */ +#define DSO_MAX 10 /* Maximum option number */ + + +/* LINK States */ +#define LL_INACTIVE 0 +#define LL_CONNECTING 1 +#define LL_RUNNING 2 +#define LL_DISCONNECTING 3 + +#define ACC_IMMED 0 +#define ACC_DEFER 1 + +#define SDF_WILD 1 /* Wild card object */ +#define SDF_PROXY 2 /* Addr eligible for proxy */ +#define SDF_UICPROXY 4 /* Use uic-based proxy */ + +/* Structures */ + + +struct dn_naddr +{ + unsigned short a_len; + unsigned char a_addr[DN_MAXADDL]; +}; + +struct sockaddr_dn +{ + unsigned short sdn_family; + unsigned char sdn_flags; + unsigned char sdn_objnum; + unsigned short sdn_objnamel; + unsigned char sdn_objname[DN_MAXOBJL]; + struct dn_naddr sdn_add; +}; +#define sdn_nodeaddrl sdn_add.a_len /* Node address length */ +#define sdn_nodeaddr sdn_add.a_addr /* Node address */ + + + +/* + * DECnet set/get DSO_CONDATA, DSO_DISDATA (optional data) structure + */ +struct optdata_dn { + unsigned short opt_status; /* Extended status return */ +#define opt_sts opt_status + unsigned short opt_optl; /* Length of user data */ + unsigned char opt_data[16]; /* User data */ +}; + +struct accessdata_dn +{ + unsigned char acc_accl; + unsigned char acc_acc[DN_MAXACCL]; + unsigned char acc_passl; + unsigned char acc_pass[DN_MAXACCL]; + unsigned char acc_userl; + unsigned char acc_user[DN_MAXACCL]; +}; + +/* + * DECnet logical link information structure + */ +struct linkinfo_dn { + unsigned short idn_segsize; /* Segment size for link */ + unsigned char idn_linkstate; /* Logical link state */ +}; + +/* + * Ethernet address format (for DECnet) + */ +union etheraddress { + unsigned char dne_addr[6]; /* Full ethernet address */ + struct { + unsigned char dne_hiord[4]; /* DECnet HIORD prefix */ + unsigned char dne_nodeaddr[2]; /* DECnet node address */ + } dne_remote; +}; + + +/* + * DECnet physical socket address format + */ +struct dn_addr { + unsigned short dna_family; /* AF_DECnet */ + union etheraddress dna_netaddr; /* DECnet ethernet address */ +}; + +#define DECNET_IOCTL_BASE 0x89 /* PROTOPRIVATE range */ + +#define SIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, struct dn_naddr) +#define SIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, struct dn_naddr) +#define OSIOCSNETADDR _IOW(DECNET_IOCTL_BASE, 0xe0, int) +#define OSIOCGNETADDR _IOR(DECNET_IOCTL_BASE, 0xe1, int) + +/* + * An unofficial structure used to set/get routes. + * Be warned, this will probably change as the routing + * evolves. Also this is only for use with the ioctl() + * and the routing will use rtnetlink eventually. + */ +struct dn_fib_rtinfo { + unsigned long flags; /* Flags */ +#define DN_FIB_RTINFO_F_REPLACE 0x0001 /* Replace any existing route */ +#define DN_FIB_RTINFO_F_DEVCOST 0x0002 /* Add cost of device */ + unsigned long timeout; /* Time in seconds route should last */ + unsigned short src; /* Source Address, 0 = any */ + unsigned short dst; /* Destination Address */ + unsigned short nhp; /* Next Hop Address */ + unsigned short hops; /* Hops on path */ + unsigned short cost; /* Cost of path */ + char device[16]; +}; + +#endif /* _LINUX_DN_H */ diff --git a/include/linux/hdsmart.h b/include/linux/hdsmart.h new file mode 100644 index 000000000..10bd7249d --- /dev/null +++ b/include/linux/hdsmart.h @@ -0,0 +1,61 @@ +#ifndef _LINUX_HDSMART_H +#define _LINUX_HDSMART_H + +/* + * This file contains some defines for the AT-hd-controller. + * Various sources. + */ + +#define NR_ATTRIBUTES 30 + +typedef struct threshold_s { + unsigned char id; + unsigned char threshold; + unsigned char reserved[10]; +} __attribute__ ((packed)) threshold_t; + +typedef struct thresholds_s { + unsigned short revision; + threshold_t thresholds[NR_ATTRIBUTES]; + unsigned char reserved[18]; + unsigned char vendor[131]; + unsigned char checksum; +} __attribute__ ((packed)) thresholds_t; + +typedef struct value_s { + unsigned char id; + unsigned short status; + unsigned char value; + unsigned char vendor[8]; +} __attribute__ ((packed)) value_t; + +typedef struct values_s { + unsigned short revision; + value_t values[NR_ATTRIBUTES]; + unsigned char offline_status; + unsigned char vendor1; + unsigned short offline_timeout; + unsigned char vendor2; + unsigned char offline_capability; + unsigned short smart_capability; + unsigned char reserved[16]; + unsigned char vendor[125]; + unsigned char checksum; +} __attribute__ ((packed)) values_t; + +#if !defined(__KERNEL__) || defined(_IDE_DISK_C) + +#define NR_OFFLINE_TEXTS 5 +struct { + unsigned char value; + char *text; +} offline_status_text[NR_OFFLINE_TEXTS] = { + { 0x00, "NeverStarted" }, + { 0x02, "Completed" }, + { 0x04, "Suspended" }, + { 0x05, "Aborted" }, + { 0x06, "Failed" } +}; +#endif /* !defined(__KERNEL__) || defined(_IDE_DISK_C) */ + +#endif /* _LINUX_HDSMART_H */ diff --git a/include/linux/i2o.h b/include/linux/i2o.h new file mode 100644 index 000000000..04079577e --- /dev/null +++ b/include/linux/i2o.h @@ -0,0 +1,588 @@ +#ifndef _I2O_H +#define _I2O_H + +/* + * Tunable parameters first + */ + +/* How many different OSM's are we allowing */ +#define MAX_I2O_MODULES 64 +/* How many controllers are we allowing */ +#define MAX_I2O_CONTROLLERS 32 + + +#ifdef __KERNEL__ /* ioctl stuff only thing exported to users */ + +/* + * I2O Interface Objects + */ + +#include <linux/notifier.h> +#include <asm/atomic.h> + +/* + * message structures + */ + +#define TID_SZ 12 +#define FUNCTION_SZ 8 + +struct i2o_message +{ + u32 version_size; + u32 function_addr; + u32 initiator_context; + /* List follows */ +}; + + +/* + * Each I2O device entity has one or more of these. There is one + * per device. *FIXME* how to handle multiple types on one unit. + */ + +struct i2o_device +{ + int class; /* Block, Net, SCSI etc (from spec) */ + int subclass; /* eth, fddi, tr etc (from spec) */ + int id; /* I2O ID assigned by the controller */ + int parent; /* Parent device */ + int flags; /* Control flags */ + int i2oversion; /* I2O version supported. Actually there + * should be high and low version */ + struct proc_dir_entry* proc_entry; /* /proc dir */ + struct i2o_driver *owner; /* Owning device */ + struct i2o_controller *controller; /* Controlling IOP */ + struct i2o_device *next; /* Chain */ + char dev_name[8]; /* linux /dev name if available */ +}; + +/* + * Resource data for each PCI I2O controller + */ + +struct i2o_pci +{ + int irq; +}; + +/* + * Each I2O controller has one of these objects + */ + +struct i2o_controller +{ + char name[16]; + int unit; + int status; /* I2O status */ + int i2oversion; + int type; +#define I2O_TYPE_PCI 0x01 /* PCI I2O controller */ + struct notifier_block *event_notifer; /* Events */ + atomic_t users; + struct i2o_device *devices; /* I2O device chain */ + struct i2o_controller *next; /* Controller chain */ + volatile u32 *post_port; /* Messaging ports */ + volatile u32 *reply_port; + volatile u32 *irq_mask; /* Interrupt port */ + u32 mem_offset; /* MFA offset */ + u32 mem_phys; /* MFA physical */ + u32 priv_mem; + u32 priv_mem_size; + u32 priv_io; + u32 priv_io_size; + + struct proc_dir_entry* proc_entry; /* /proc dir */ + + union + { /* Bus information */ + struct i2o_pci pci; + } bus; + void (*destructor)(struct i2o_controller *); /* Bus specific destructor */ + int (*bind)(struct i2o_controller *, struct i2o_device *); /* Bus specific attach/detach */ + int (*unbind)(struct i2o_controller *, struct i2o_device *); + void *page_frame; /* Message buffers */ + int inbound_size; /* Inbound queue size */ +}; + +struct i2o_handler +{ + void (*reply)(struct i2o_handler *, struct i2o_controller *, struct i2o_message *); + char *name; + int context; /* Low 8 bits of the transaction info */ + /* User data follows */ +}; + +/* + * Messenger inlines + */ + +extern inline u32 I2O_POST_READ32(struct i2o_controller *c) +{ + return *c->post_port; +} + +extern inline void I2O_POST_WRITE32(struct i2o_controller *c, u32 Val) +{ + *c->post_port = Val; +} + + +extern inline u32 I2O_REPLY_READ32(struct i2o_controller *c) +{ + return *c->reply_port; +} + +extern inline void I2O_REPLY_WRITE32(struct i2o_controller *c, u32 Val) +{ + *c->reply_port= Val; +} + + +extern inline u32 I2O_IRQ_READ32(struct i2o_controller *c) +{ + return *c->irq_mask; +} + +extern inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 Val) +{ + *c->irq_mask = Val; +} + + +extern inline void i2o_post_message(struct i2o_controller *c, u32 m) +{ + /* The second line isnt spurious - thats forcing PCI posting */ + I2O_POST_WRITE32(c,m); + (void) I2O_IRQ_READ32(c); +} + +extern inline void i2o_flush_reply(struct i2o_controller *c, u32 m) +{ + I2O_REPLY_WRITE32(c,m); +} + + +struct i2o_controller *i2o_controller_chain; + +extern int i2o_quiesce_controller(struct i2o_controller *); +extern int i2o_clear_controller(struct i2o_controller *); +extern int i2o_install_controller(struct i2o_controller *); +extern int i2o_delete_controller(struct i2o_controller *); +extern int i2o_activate_controller(struct i2o_controller *); +extern void i2o_unlock_controller(struct i2o_controller *); +extern struct i2o_controller *i2o_find_controller(int); +extern int i2o_num_controllers; + +extern int i2o_install_handler(struct i2o_handler *); +extern int i2o_remove_handler(struct i2o_handler *); + +extern int i2o_install_device(struct i2o_controller *, struct i2o_device *); +extern int i2o_delete_device(struct i2o_device *); +extern int i2o_claim_device(struct i2o_device *, struct i2o_driver *); +extern int i2o_release_device(struct i2o_device *); + +extern int i2o_post_this(struct i2o_controller *, int, u32 *, int); +extern int i2o_post_wait(struct i2o_controller *, int, u32 *, int, int *, int); +extern int i2o_issue_claim(struct i2o_controller *, int, int, int, int *); +extern int i2o_query_scalar(struct i2o_controller *, int, int, int, int, void *, + int, int *); +extern int i2o_params_set(struct i2o_controller *c, int, int, int, int, void *, + int, int *); + +extern void i2o_run_queue(struct i2o_controller *); + +extern void i2o_report_status(const char *, const char *, u8, u8, u16); +extern void report_common_status(u8); +extern void report_lan_dsc(u16); + +extern u32 i2o_wait_message(struct i2o_controller *, char *); + +extern const char *i2o_get_class_name(int); + + +/* + * I2O classes / subclasses + */ + +/* Class ID and Code Assignments + * (LCT.ClassID.Version field) + */ +#define I2O_CLASS_VERSION_10 0x00 +#define I2O_CLASS_VERSION_11 0x01 + +/* Class code names + * (from v1.5 Table 6-1 Class Code Assignments.) + */ + +#define I2O_CLASS_EXECUTIVE 0x000 +#define I2O_CLASS_DDM 0x001 +#define I2O_CLASS_RANDOM_BLOCK_STORAGE 0x010 +#define I2O_CLASS_SEQUENTIAL_STORAGE 0x011 +#define I2O_CLASS_LAN 0x020 +#define I2O_CLASS_WAN 0x030 +#define I2O_CLASS_FIBRE_CHANNEL_PORT 0x040 +#define I2O_CLASS_FIBRE_CHANNEL_PERIPHERAL 0x041 +#define I2O_CLASS_SCSI_PERIPHERAL 0x051 +#define I2O_CLASS_ATE_PORT 0x060 +#define I2O_CLASS_ATE_PERIPHERAL 0x061 +#define I2O_CLASS_FLOPPY_CONTROLLER 0x070 +#define I2O_CLASS_FLOPPY_DEVICE 0x071 +#define I2O_CLASS_BUS_ADAPTER_PORT 0x080 +#define I2O_CLASS_PEER_TRANSPORT_AGENT 0x090 +#define I2O_CLASS_PEER_TRANSPORT 0x091 + +/* Rest of 0x092 - 0x09f reserved for peer-to-peer classes + */ + +#define I2O_CLASS_MATCH_ANYCLASS 0xffffffff + +/* Subclasses + */ + +#define I2O_SUBCLASS_i960 0x001 +#define I2O_SUBCLASS_HDM 0x020 +#define I2O_SUBCLASS_ISM 0x021 + +/* Operation functions */ + +#define I2O_PARAMS_FIELD_GET 0x0001 +#define I2O_PARAMS_LIST_GET 0x0002 +#define I2O_PARAMS_MORE_GET 0x0003 +#define I2O_PARAMS_SIZE_GET 0x0004 +#define I2O_PARAMS_TABLE_GET 0x0005 +#define I2O_PARAMS_FIELD_SET 0x0006 +#define I2O_PARAMS_LIST_SET 0x0007 +#define I2O_PARAMS_ROW_ADD 0x0008 +#define I2O_PARAMS_ROW_DELETE 0x0009 +#define I2O_PARAMS_TABLE_CLEAR 0x000A + +/* + * I2O serial number conventions / formats + * (circa v1.5) + */ + +#define I2O_SNFORMAT_UNKNOWN 0 +#define I2O_SNFORMAT_BINARY 1 +#define I2O_SNFORMAT_ASCII 2 +#define I2O_SNFORMAT_UNICODE 3 +#define I2O_SNFORMAT_LAN48_MAC 4 +#define I2O_SNFORMAT_WAN 5 + +/* Plus new in v2.0 (Yellowstone pdf doc) + */ + +#define I2O_SNFORMAT_LAN64_MAC 6 +#define I2O_SNFORMAT_DDM 7 +#define I2O_SNFORMAT_IEEE_REG64 8 +#define I2O_SNFORMAT_IEEE_REG128 9 +#define I2O_SNFORMAT_UNKNOWN2 0xff + + +/* + * "Special" TID assignments + */ +#define I2O_IOP_TID 0 +#define I2O_HOST_TID 1 + + +/* Transaction Reply Lists (TRL) Control Word structure */ + +#define TRL_SINGLE_FIXED_LENGTH 0x00 +#define TRL_SINGLE_VARIABLE_LENGTH 0x40 +#define TRL_MULTIPLE_FIXED_LENGTH 0x80 + +/* LAN Class specific functions */ + +#define LAN_PACKET_SEND 0x3B +#define LAN_SDU_SEND 0x3D +#define LAN_RECEIVE_POST 0x3E +#define LAN_RESET 0x35 +#define LAN_SUSPEND 0x37 + +/* + * Messaging API values + */ + +#define I2O_CMD_ADAPTER_ASSIGN 0xB3 +#define I2O_CMD_ADAPTER_READ 0xB2 +#define I2O_CMD_ADAPTER_RELEASE 0xB5 +#define I2O_CMD_BIOS_INFO_SET 0xA5 +#define I2O_CMD_BOOT_DEVICE_SET 0xA7 +#define I2O_CMD_CONFIG_VALIDATE 0xBB +#define I2O_CMD_CONN_SETUP 0xCA +#define I2O_CMD_DDM_DESTROY 0xB1 +#define I2O_CMD_DDM_ENABLE 0xD5 +#define I2O_CMD_DDM_QUIESCE 0xC7 +#define I2O_CMD_DDM_RESET 0xD9 +#define I2O_CMD_DDM_SUSPEND 0xAF +#define I2O_CMD_DEVICE_ASSIGN 0xB7 +#define I2O_CMD_DEVICE_RELEASE 0xB9 +#define I2O_CMD_HRT_GET 0xA8 +#define I2O_CMD_ADAPTER_CLEAR 0xBE +#define I2O_CMD_ADAPTER_CONNECT 0xC9 +#define I2O_CMD_ADAPTER_RESET 0xBD +#define I2O_CMD_LCT_NOTIFY 0xA2 +#define I2O_CMD_OUTBOUND_INIT 0xA1 +#define I2O_CMD_PATH_ENABLE 0xD3 +#define I2O_CMD_PATH_QUIESCE 0xC5 +#define I2O_CMD_PATH_RESET 0xD7 +#define I2O_CMD_STATIC_MF_CREATE 0xDD +#define I2O_CMD_STATIC_MF_RELEASE 0xDF +#define I2O_CMD_STATUS_GET 0xA0 +#define I2O_CMD_SW_DOWNLOAD 0xA9 +#define I2O_CMD_SW_UPLOAD 0xAB +#define I2O_CMD_SW_REMOVE 0xAD +#define I2O_CMD_SYS_ENABLE 0xD1 +#define I2O_CMD_SYS_MODIFY 0xC1 +#define I2O_CMD_SYS_QUIESCE 0xC3 +#define I2O_CMD_SYS_TAB_SET 0xA3 + +#define I2O_CMD_UTIL_NOP 0x00 +#define I2O_CMD_UTIL_ABORT 0x01 +#define I2O_CMD_UTIL_CLAIM 0x09 +#define I2O_CMD_UTIL_RELEASE 0x0B +#define I2O_CMD_UTIL_PARAMS_GET 0x06 +#define I2O_CMD_UTIL_PARAMS_SET 0x05 +#define I2O_CMD_UTIL_EVT_REGISTER 0x13 +#define I2O_CMD_UTIL_ACK 0x14 +#define I2O_CMD_UTIL_CONFIG_DIALOG 0x10 +#define I2O_CMD_UTIL_DEVICE_RESERVE 0x0D +#define I2O_CMD_UTIL_DEVICE_RELEASE 0x0F +#define I2O_CMD_UTIL_LOCK 0x17 +#define I2O_CMD_UTIL_LOCK_RELEASE 0x19 +#define I2O_CMD_UTIL_REPLY_FAULT_NOTIFY 0x15 + +#define I2O_CMD_SCSI_EXEC 0x81 +#define I2O_CMD_SCSI_ABORT 0x83 +#define I2O_CMD_SCSI_BUSRESET 0x27 + +#define I2O_CMD_BLOCK_READ 0x30 +#define I2O_CMD_BLOCK_WRITE 0x31 +#define I2O_CMD_BLOCK_CFLUSH 0x37 +#define I2O_CMD_BLOCK_MLOCK 0x49 +#define I2O_CMD_BLOCK_MUNLOCK 0x4B +#define I2O_CMD_BLOCK_MMOUNT 0x41 +#define I2O_CMD_BLOCK_MEJECT 0x43 + +#define I2O_PRIVATE_MSG 0xFF + +/* + * Init Outbound Q status + */ + +#define I2O_CMD_OUTBOUND_INIT_IN_PROGRESS 0x01 +#define I2O_CMD_OUTBOUND_INIT_REJECTED 0x02 +#define I2O_CMD_OUTBOUND_INIT_FAILED 0x03 +#define I2O_CMD_OUTBOUND_INIT_COMPLETE 0x04 + +/* + * I2O Get Status State values + */ + +#define ADAPTER_STATE_INITIALIZING 0x01 +#define ADAPTER_STATE_RESET 0x02 +#define ADAPTER_STATE_HOLD 0x04 +#define ADAPTER_STATE_READY 0x05 +#define ADAPTER_STATE_OPERATIONAL 0x08 +#define ADAPTER_STATE_FAILED 0x10 +#define ADAPTER_STATE_FAULTED 0x11 + +/* I2O API function return values */ + +#define I2O_RTN_NO_ERROR 0 +#define I2O_RTN_NOT_INIT 1 +#define I2O_RTN_FREE_Q_EMPTY 2 +#define I2O_RTN_TCB_ERROR 3 +#define I2O_RTN_TRANSACTION_ERROR 4 +#define I2O_RTN_ADAPTER_ALREADY_INIT 5 +#define I2O_RTN_MALLOC_ERROR 6 +#define I2O_RTN_ADPTR_NOT_REGISTERED 7 +#define I2O_RTN_MSG_REPLY_TIMEOUT 8 +#define I2O_RTN_NO_STATUS 9 +#define I2O_RTN_NO_FIRM_VER 10 +#define I2O_RTN_NO_LINK_SPEED 11 + +/* Reply message status defines for all messages */ + +#define I2O_REPLY_STATUS_SUCCESS 0x00 +#define I2O_REPLY_STATUS_ABORT_DIRTY 0x01 +#define I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 0x02 +#define I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER 0x03 +#define I2O_REPLY_STATUS_ERROR_DIRTY 0x04 +#define I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER 0x05 +#define I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER 0x06 +#define I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY 0x08 +#define I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER 0x09 +#define I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER 0x0A +#define I2O_REPLY_STATUS_TRANSACTION_ERROR 0x0B +#define I2O_REPLY_STATUS_PROGRESS_REPORT 0x80 + +/* Status codes and Error Information for Parameter functions */ + +#define I2O_PARAMS_STATUS_SUCCESS 0x00 +#define I2O_PARAMS_STATUS_BAD_KEY_ABORT 0x01 +#define I2O_PARAMS_STATUS_BAD_KEY_CONTINUE 0x02 +#define I2O_PARAMS_STATUS_BUFFER_FULL 0x03 +#define I2O_PARAMS_STATUS_BUFFER_TOO_SMALL 0x04 +#define I2O_PARAMS_STATUS_FIELD_UNREADABLE 0x05 +#define I2O_PARAMS_STATUS_FIELD_UNWRITEABLE 0x06 +#define I2O_PARAMS_STATUS_INSUFFICIENT_FIELDS 0x07 +#define I2O_PARAMS_STATUS_INVALID_GROUP_ID 0x08 +#define I2O_PARAMS_STATUS_INVALID_OPERATION 0x09 +#define I2O_PARAMS_STATUS_NO_KEY_FIELD 0x0A +#define I2O_PARAMS_STATUS_NO_SUCH_FIELD 0x0B +#define I2O_PARAMS_STATUS_NON_DYNAMIC_GROUP 0x0C +#define I2O_PARAMS_STATUS_OPERATION_ERROR 0x0D +#define I2O_PARAMS_STATUS_SCALAR_ERROR 0x0E +#define I2O_PARAMS_STATUS_TABLE_ERROR 0x0F +#define I2O_PARAMS_STATUS_WRONG_GROUP_TYPE 0x10 + +/* DetailedStatusCode defines for Executive, DDM, Util and Transaction error + * messages: Table 3-2 Detailed Status Codes.*/ + +#define I2O_DSC_SUCCESS 0x0000 +#define I2O_DSC_BAD_KEY 0x0002 +#define I2O_DSC_TCL_ERROR 0x0003 +#define I2O_DSC_REPLY_BUFFER_FULL 0x0004 +#define I2O_DSC_NO_SUCH_PAGE 0x0005 +#define I2O_DSC_INSUFFICIENT_RESOURCE_SOFT 0x0006 +#define I2O_DSC_INSUFFICIENT_RESOURCE_HARD 0x0007 +#define I2O_DSC_CHAIN_BUFFER_TOO_LARGE 0x0009 +#define I2O_DSC_UNSUPPORTED_FUNCTION 0x000A +#define I2O_DSC_DEVICE_LOCKED 0x000B +#define I2O_DSC_DEVICE_RESET 0x000C +#define I2O_DSC_INAPPROPRIATE_FUNCTION 0x000D +#define I2O_DSC_INVALID_INITIATOR_ADDRESS 0x000E +#define I2O_DSC_INVALID_MESSAGE_FLAGS 0x000F +#define I2O_DSC_INVALID_OFFSET 0x0010 +#define I2O_DSC_INVALID_PARAMETER 0x0011 +#define I2O_DSC_INVALID_REQUEST 0x0012 +#define I2O_DSC_INVALID_TARGET_ADDRESS 0x0013 +#define I2O_DSC_MESSAGE_TOO_LARGE 0x0014 +#define I2O_DSC_MESSAGE_TOO_SMALL 0x0015 +#define I2O_DSC_MISSING_PARAMETER 0x0016 +#define I2O_DSC_TIMEOUT 0x0017 +#define I2O_DSC_UNKNOWN_ERROR 0x0018 +#define I2O_DSC_UNKNOWN_FUNCTION 0x0019 +#define I2O_DSC_UNSUPPORTED_VERSION 0x001A +#define I2O_DSC_DEVICE_BUSY 0x001B +#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C + +/* Message header defines for VersionOffset */ +#define I2OVER15 0x0001 +#define I2OVER20 0x0002 +/* Default is 1.5, FIXME: Need support for both 1.5 and 2.0 */ +#define I2OVERSION I2OVER15 +#define SGL_OFFSET_0 I2OVERSION +#define SGL_OFFSET_4 (0x0040 | I2OVERSION) +#define SGL_OFFSET_5 (0x0050 | I2OVERSION) +#define SGL_OFFSET_6 (0x0060 | I2OVERSION) +#define SGL_OFFSET_8 (0x0080 | I2OVERSION) +#define SGL_OFFSET_10 (0x00A0 | I2OVERSION) + +#define TRL_OFFSET_5 (0x0050 | I2OVERSION) +#define TRL_OFFSET_6 (0x0060 | I2OVERSION) + + /* msg header defines for MsgFlags */ +#define MSG_STATIC 0x0100 +#define MSG_64BIT_CNTXT 0x0200 +#define MSG_MULTI_TRANS 0x1000 +#define MSG_FAIL 0x2000 +#define MSG_LAST 0x4000 +#define MSG_REPLY 0x8000 + + /* normal LAN request message MsgFlags and VersionOffset (0x1041) */ +#define LAN_MSG_REQST (MSG_MULTI_TRANS | SGL_OFFSET_4) + + /* minimum size msg */ +#define THREE_WORD_MSG_SIZE 0x00030000 +#define FOUR_WORD_MSG_SIZE 0x00040000 +#define FIVE_WORD_MSG_SIZE 0x00050000 +#define SIX_WORD_MSG_SIZE 0x00060000 +#define SEVEN_WORD_MSG_SIZE 0x00070000 +#define EIGHT_WORD_MSG_SIZE 0x00080000 +#define NINE_WORD_MSG_SIZE 0x00090000 +#define TEN_WORD_MSG_SIZE 0x000A0000 +#define I2O_MESSAGE_SIZE(x) ((x)<<16) + + +/* Special TID Assignments */ + +#define ADAPTER_TID 0 +#define HOST_TID 1 + +#define MSG_FRAME_SIZE 128 +#define NMBR_MSG_FRAMES 128 + +#define MSG_POOL_SIZE 16384 + +#define I2O_POST_WAIT_OK 1 +#define I2O_POST_WAIT_TIMEOUT -1 + +#endif /* __KERNEL__ */ + +#include <asm/ioctl.h> + +/* + * I2O Control IOCTLs and structures + */ +#define I2O_MAGIC_NUMBER 'i' +#define I2OGETIOPS _IO(I2O_MAGIC_NUMBER,0) +#define I2OHRTGET _IO(I2O_MAGIC_NUMBER,1) +#define I2OLCTGET _IO(I2O_MAGIC_NUMBER,2) +#define I2OPARMSET _IO(I2O_MAGIC_NUMBER,3) +#define I2OPARMGET _IO(I2O_MAGIC_NUMBER,4) +#define I2OSWDL _IO(I2O_MAGIC_NUMBER,5) +#define I2OSWUL _IO(I2O_MAGIC_NUMBER,6) +#define I2OSWDEL _IO(I2O_MAGIC_NUMBER,7) +#define I2OHTML _IO(I2O_MAGIC_NUMBER,8) + +/* On hold until we figure this out +#define I2OEVTREG _IO(I2O_MAGIC_NUMBER,9) +#define I2OEVTCLR _IO(I2O_MAGIC_NUMBER,10) +#define I2OEVTGET _IO(I2O_MAGIC_NUMBER,11) + */ + +struct i2o_cmd_hrtlct +{ + unsigned int iop; /* IOP unit number */ + void *resbuf; /* Buffer for result */ + unsigned int *reslen; /* Buffer length in bytes */ +}; + + +struct i2o_cmd_psetget +{ + unsigned int iop; /* IOP unit number */ + unsigned int tid; /* Target device TID */ + void *opbuf; /* Operation List buffer */ + unsigned int oplen; /* Operation List buffer length in bytes */ + void *resbuf; /* Result List buffer */ + unsigned int *reslen; /* Result List buffer length in bytes */ +}; + +struct i2o_sw_xfer +{ + unsigned int iop; /* IOP unit number */ + unsigned char dl_flags; /* DownLoadFlags field */ + unsigned char sw_type; /* Software type */ + unsigned int sw_id; /* Software ID */ + void *buf; /* Pointer to software buffer */ + unsigned int *swlen; /* Length of software data */ + unsigned int *maxfrag; /* Maximum fragment count */ + unsigned int *curfrag; /* Current fragment count */ +}; + +struct i2o_html +{ + unsigned int iop; /* IOP unit number */ + unsigned int tid; /* Target device ID */ + unsigned int page; /* HTML page */ + void *resbuf; /* Buffer for reply HTML page */ + unsigned int *reslen; /* Length in bytes of reply buffer */ + void *qbuf; /* Pointer to HTTP query string */ + unsigned int qlen; /* Length in bytes of query string buffer */ +}; + +#endif diff --git a/include/linux/ide.h b/include/linux/ide.h new file mode 100644 index 000000000..c0b5ed929 --- /dev/null +++ b/include/linux/ide.h @@ -0,0 +1,813 @@ +#ifndef _IDE_H +#define _IDE_H +/* + * linux/drivers/block/ide.h + * + * Copyright (C) 1994-1998 Linus Torvalds & authors + */ + +#include <linux/config.h> +#include <linux/init.h> +#include <linux/ioport.h> +#include <linux/hdreg.h> +#include <linux/hdsmart.h> +#include <linux/blkdev.h> +#include <linux/proc_fs.h> +#include <asm/hdreg.h> + +/* + * This is the multiple IDE interface driver, as evolved from hd.c. + * It supports up to four IDE interfaces, on one or more IRQs (usually 14 & 15). + * There can be up to two drives per interface, as per the ATA-2 spec. + * + * Primary i/f: ide0: major=3; (hda) minor=0; (hdb) minor=64 + * Secondary i/f: ide1: major=22; (hdc or hd1a) minor=0; (hdd or hd1b) minor=64 + * Tertiary i/f: ide2: major=33; (hde) minor=0; (hdf) minor=64 + * Quaternary i/f: ide3: major=34; (hdg) minor=0; (hdh) minor=64 + */ + +/****************************************************************************** + * IDE driver configuration options (play with these as desired): + * + * REALLY_SLOW_IO can be defined in ide.c and ide-cd.c, if necessary + */ +#undef REALLY_FAST_IO /* define if ide ports are perfect */ +#define INITIAL_MULT_COUNT 0 /* off=0; on=2,4,8,16,32, etc.. */ + +#ifndef SUPPORT_SLOW_DATA_PORTS /* 1 to support slow data ports */ +#define SUPPORT_SLOW_DATA_PORTS 1 /* 0 to reduce kernel size */ +#endif +#ifndef SUPPORT_VLB_SYNC /* 1 to support weird 32-bit chips */ +#define SUPPORT_VLB_SYNC 1 /* 0 to reduce kernel size */ +#endif +#ifndef DISK_RECOVERY_TIME /* off=0; on=access_delay_time */ +#define DISK_RECOVERY_TIME 0 /* for hardware that needs it */ +#endif +#ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */ +#define OK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */ +#endif +#ifndef FAKE_FDISK_FOR_EZDRIVE /* 1 to help linux fdisk with EZDRIVE */ +#define FAKE_FDISK_FOR_EZDRIVE 1 /* 0 to reduce kernel size */ +#endif +#ifndef FANCY_STATUS_DUMPS /* 1 for human-readable drive errors */ +#define FANCY_STATUS_DUMPS 1 /* 0 to reduce kernel size */ +#endif + +#ifdef CONFIG_BLK_DEV_CMD640 +#if 0 /* change to 1 when debugging cmd640 problems */ +void cmd640_dump_regs (void); +#define CMD640_DUMP_REGS cmd640_dump_regs() /* for debugging cmd640 chipset */ +#endif +#endif /* CONFIG_BLK_DEV_CMD640 */ + +/* + * IDE_DRIVE_CMD is used to implement many features of the hdparm utility + */ +#define IDE_DRIVE_CMD 99 /* (magic) undef to reduce kernel size*/ + +/* + * "No user-serviceable parts" beyond this point :) + *****************************************************************************/ + +typedef unsigned char byte; /* used everywhere */ + +/* + * Probably not wise to fiddle with these + */ +#define ERROR_MAX 8 /* Max read/write errors per sector */ +#define ERROR_RESET 3 /* Reset controller every 4th retry */ +#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ + +/* + * Ensure that various configuration flags have compatible settings + */ +#ifdef REALLY_SLOW_IO +#undef REALLY_FAST_IO +#endif + +#define HWIF(drive) ((ide_hwif_t *)((drive)->hwif)) +#define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup)) + +/* + * Definitions for accessing IDE controller registers + */ +#define IDE_NR_PORTS (10) + +#define IDE_DATA_OFFSET (0) +#define IDE_ERROR_OFFSET (1) +#define IDE_NSECTOR_OFFSET (2) +#define IDE_SECTOR_OFFSET (3) +#define IDE_LCYL_OFFSET (4) +#define IDE_HCYL_OFFSET (5) +#define IDE_SELECT_OFFSET (6) +#define IDE_STATUS_OFFSET (7) +#define IDE_CONTROL_OFFSET (8) +#define IDE_IRQ_OFFSET (9) + +#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET +#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET + +#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) +#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) +#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) +#define IDE_SECTOR_REG (HWIF(drive)->io_ports[IDE_SECTOR_OFFSET]) +#define IDE_LCYL_REG (HWIF(drive)->io_ports[IDE_LCYL_OFFSET]) +#define IDE_HCYL_REG (HWIF(drive)->io_ports[IDE_HCYL_OFFSET]) +#define IDE_SELECT_REG (HWIF(drive)->io_ports[IDE_SELECT_OFFSET]) +#define IDE_STATUS_REG (HWIF(drive)->io_ports[IDE_STATUS_OFFSET]) +#define IDE_CONTROL_REG (HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]) +#define IDE_IRQ_REG (HWIF(drive)->io_ports[IDE_IRQ_OFFSET]) + +#define IDE_FEATURE_REG IDE_ERROR_REG +#define IDE_COMMAND_REG IDE_STATUS_REG +#define IDE_ALTSTATUS_REG IDE_CONTROL_REG +#define IDE_IREASON_REG IDE_NSECTOR_REG +#define IDE_BCOUNTL_REG IDE_LCYL_REG +#define IDE_BCOUNTH_REG IDE_HCYL_REG + +#ifdef REALLY_FAST_IO +#define OUT_BYTE(b,p) outb((b),(p)) +#define IN_BYTE(p) (byte)inb(p) +#else +#define OUT_BYTE(b,p) outb_p((b),(p)) +#define IN_BYTE(p) (byte)inb_p(p) +#endif /* REALLY_FAST_IO */ + +#define GET_ERR() IN_BYTE(IDE_ERROR_REG) +#define GET_STAT() IN_BYTE(IDE_STATUS_REG) +#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) +#define BAD_R_STAT (BUSY_STAT | ERR_STAT) +#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) +#define BAD_STAT (BAD_R_STAT | DRQ_STAT) +#define DRIVE_READY (READY_STAT | SEEK_STAT) +#define DATA_READY (DRQ_STAT) + +/* + * Some more useful definitions + */ +#define IDE_MAJOR_NAME "ide" /* the same for all i/f; see also genhd.c */ +#define MAJOR_NAME IDE_MAJOR_NAME +#define PARTN_BITS 6 /* number of minor dev bits for partitions */ +#define PARTN_MASK ((1<<PARTN_BITS)-1) /* a useful bit mask */ +#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ +#define SECTOR_WORDS (512 / 4) /* number of 32bit words per sector */ +#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) +#define IDE_MIN(a,b) ((a)<(b) ? (a):(b)) +#define IDE_MAX(a,b) ((a)>(b) ? (a):(b)) + +/* + * Timeouts for various operations: + */ +#define WAIT_DRQ (5*HZ/100) /* 50msec - spec allows up to 20ms */ +#ifdef CONFIG_APM +#define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */ +#else +#define WAIT_READY (3*HZ/100) /* 30msec - should be instantaneous */ +#endif /* CONFIG_APM */ +#define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?) + if all ATAPI CD is closed at boot */ +#define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */ +#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ +#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ + +#define SELECT_DRIVE(hwif,drive) \ +{ \ + if (hwif->selectproc) \ + hwif->selectproc(drive); \ + OUT_BYTE((drive)->select.all, hwif->io_ports[IDE_SELECT_OFFSET]); \ +} + +/* + * Check for an interrupt and acknowledge the interrupt status + */ +struct hwif_s; +typedef int (ide_ack_intr_t)(struct hwif_s *); + +/* + * Structure to hold all information about the location of this port + */ +typedef struct hw_regs_s { + ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */ + int irq; /* our irq number */ + ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ + void *priv; /* interface specific data */ +} hw_regs_t; + +/* + * Register new hardware with ide + */ +int ide_register_hw(hw_regs_t *hw, struct hwif_s **hwifp); + +/* + * Set up hw_regs_t structure before calling ide_register_hw (optional) + */ +void ide_setup_ports( hw_regs_t *hw, + ide_ioreg_t base, + int *offsets, + ide_ioreg_t ctrl, + ide_ioreg_t intr, + ide_ack_intr_t *ack_intr, + int irq); + +#include <asm/ide.h> + +/* + * Now for the data we need to maintain per-drive: ide_drive_t + */ + +#define ide_scsi 0x21 +#define ide_disk 0x20 +#define ide_optical 0x7 +#define ide_cdrom 0x5 +#define ide_tape 0x1 +#define ide_floppy 0x0 + +typedef union { + unsigned all : 8; /* all of the bits together */ + struct { + unsigned set_geometry : 1; /* respecify drive geometry */ + unsigned recalibrate : 1; /* seek to cyl 0 */ + unsigned set_multmode : 1; /* set multmode count */ + unsigned set_tune : 1; /* tune interface for drive */ + unsigned reserved : 4; /* unused */ + } b; + } special_t; + +typedef struct ide_drive_s { + struct request *queue; /* request queue */ + struct ide_drive_s *next; /* circular list of hwgroup drives */ + unsigned long sleep; /* sleep until this time */ + unsigned long service_start; /* time we started last request */ + unsigned long service_time; /* service time of last request */ + special_t special; /* special action flags */ + byte keep_settings; /* restore settings after drive reset */ + byte using_dma; /* disk is using dma for read/write */ + byte waiting_for_dma; /* dma currently in progress */ + byte unmask; /* flag: okay to unmask other irqs */ + byte slow; /* flag: slow data port */ + byte bswap; /* flag: byte swap data */ + byte dsc_overlap; /* flag: DSC overlap */ + byte nice1; /* flag: give potential excess bandwidth */ + unsigned present : 1; /* drive is physically present */ + unsigned noprobe : 1; /* from: hdx=noprobe */ + unsigned busy : 1; /* currently doing revalidate_disk() */ + unsigned removable : 1; /* 1 if need to do check_media_change */ + unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ + unsigned no_unmask : 1; /* disallow setting unmask bit */ + unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ + unsigned nobios : 1; /* flag: do not probe bios for drive */ + unsigned revalidate : 1; /* request revalidation */ + unsigned atapi_overlap : 1; /* flag: ATAPI overlap (not supported) */ + unsigned nice0 : 1; /* flag: give obvious excess bandwidth */ + unsigned nice2 : 1; /* flag: give a share in our own bandwidth */ + unsigned doorlocking : 1; /* flag: for removable only: door lock/unlock works */ + unsigned autotune : 2; /* 1=autotune, 2=noautotune, 0=default */ +#if FAKE_FDISK_FOR_EZDRIVE + unsigned remap_0_to_1 : 1; /* flag: partitioned with ezdrive */ +#endif /* FAKE_FDISK_FOR_EZDRIVE */ + byte media; /* disk, cdrom, tape, floppy, ... */ + select_t select; /* basic drive/head select reg value */ + byte ctl; /* "normal" value for IDE_CONTROL_REG */ + byte ready_stat; /* min status value for drive ready */ + byte mult_count; /* current multiple sector setting */ + byte mult_req; /* requested multiple sector setting */ + byte tune_req; /* requested drive tuning setting */ + byte io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ + byte bad_wstat; /* used for ignoring WRERR_STAT */ + byte nowerr; /* used for ignoring WRERR_STAT */ + byte sect0; /* offset of first sector for DM6:DDO */ + byte usage; /* current "open()" count for drive */ + byte head; /* "real" number of heads */ + byte sect; /* "real" sectors per track */ + byte bios_head; /* BIOS/fdisk/LILO number of heads */ + byte bios_sect; /* BIOS/fdisk/LILO sectors per track */ + unsigned short bios_cyl; /* BIOS/fdisk/LILO number of cyls */ + unsigned short cyl; /* "real" number of cyls */ + unsigned int drive_data; /* for use by tuneproc/selectproc as needed */ + void *hwif; /* actually (ide_hwif_t *) */ + wait_queue_head_t wqueue; /* used to wait for drive in open() */ + struct hd_driveid *id; /* drive model identification info */ + struct hd_struct *part; /* drive partition table */ + char name[4]; /* drive name, such as "hda" */ + void *driver; /* (ide_driver_t *) */ + void *driver_data; /* extra driver data */ + struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ + void *settings; /* /proc/ide/ drive settings */ + char driver_req[10]; /* requests specific driver */ +#if 1 + struct thresholds_s *smart_thresholds; + struct values_s *smart_values; +#else + thresholds_t smart_thresholds; + values_t smart_values; +#endif + } ide_drive_t; + +/* + * An ide_dmaproc_t() initiates/aborts DMA read/write operations on a drive. + * + * The caller is assumed to have selected the drive and programmed the drive's + * sector address using CHS or LBA. All that remains is to prepare for DMA + * and then issue the actual read/write DMA/PIO command to the drive. + * + * Returns 0 if all went well. + * Returns 1 if DMA read/write could not be started, in which case the caller + * should either try again later, or revert to PIO for the current request. + */ +typedef enum { ide_dma_read, ide_dma_write, ide_dma_begin, + ide_dma_end, ide_dma_check, ide_dma_on, + ide_dma_off, ide_dma_off_quietly, ide_dma_test_irq, + ide_dma_bad_drive, ide_dma_good_drive + } ide_dma_action_t; + +typedef int (ide_dmaproc_t)(ide_dma_action_t, ide_drive_t *); + + +/* + * An ide_tuneproc_t() is used to set the speed of an IDE interface + * to a particular PIO mode. The "byte" parameter is used + * to select the PIO mode by number (0,1,2,3,4,5), and a value of 255 + * indicates that the interface driver should "auto-tune" the PIO mode + * according to the drive capabilities in drive->id; + * + * Not all interface types support tuning, and not all of those + * support all possible PIO settings. They may silently ignore + * or round values as they see fit. + */ +typedef void (ide_tuneproc_t)(ide_drive_t *, byte); + +/* + * This is used to provide support for strange interfaces + */ +typedef void (ide_selectproc_t) (ide_drive_t *); + +/* + * hwif_chipset_t is used to keep track of the specific hardware + * chipset used by each IDE interface, if known. + */ +typedef enum { ide_unknown, ide_generic, ide_pci, + ide_cmd640, ide_dtc2278, ide_ali14xx, + ide_qd6580, ide_umc8672, ide_ht6560b, + ide_pdc4030, ide_rz1000, ide_trm290, + ide_cmd646, ide_cy82c693, ide_4drives + } hwif_chipset_t; + +typedef struct ide_pci_devid_s { + unsigned short vid; + unsigned short did; +} ide_pci_devid_t; + +#define IDE_PCI_DEVID_NULL ((ide_pci_devid_t){0,0}) +#define IDE_PCI_DEVID_EQ(a,b) (a.vid == b.vid && a.did == b.did) + +typedef struct hwif_s { + struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ + void *hwgroup; /* actually (ide_hwgroup_t *) */ + ide_ioreg_t io_ports[IDE_NR_PORTS]; /* task file registers */ + hw_regs_t hw; /* Hardware info */ + ide_drive_t drives[MAX_DRIVES]; /* drive info */ + struct gendisk *gd; /* gendisk structure */ + ide_tuneproc_t *tuneproc; /* routine to tune PIO mode for drives */ + ide_selectproc_t *selectproc; /* tweaks hardware to select drive */ + ide_dmaproc_t *dmaproc; /* dma read/write/abort routine */ + unsigned long *dmatable; /* dma physical region descriptor table */ + 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 */ + unsigned long config_data; /* for use by chipset-specific code */ + unsigned long select_data; /* for use by chipset-specific code */ + struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ + int irq; /* our irq number */ + byte major; /* our major number */ + char name[6]; /* name of interface, eg. "ide0" */ + byte index; /* 0 for ide0; 1 for ide1; ... */ + hwif_chipset_t chipset; /* sub-module for tuning.. */ + unsigned noprobe : 1; /* don't probe for this interface */ + unsigned present : 1; /* this interface exists */ + unsigned serialized : 1; /* serialized operation with mate hwif */ + unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ + unsigned reset : 1; /* reset after probe */ + unsigned autodma : 1; /* automatically try to enable DMA at boot */ + byte channel; /* for dual-port chips: 0=primary, 1=secondary */ + struct pci_dev *pci_dev; /* for pci chipsets */ + ide_pci_devid_t pci_devid; /* for pci chipsets: {VID,DID} */ +#if (DISK_RECOVERY_TIME > 0) + unsigned long last_time; /* time when previous rq was done */ +#endif + } ide_hwif_t; + +/* + * internal ide interrupt handler type + */ +typedef void (ide_handler_t)(ide_drive_t *); + +typedef struct hwgroup_s { + spinlock_t spinlock; /* protects "busy" and "handler" */ + ide_handler_t *handler;/* irq handler, if active */ + int busy; /* BOOL: protects all fields below */ + ide_drive_t *drive; /* current drive */ + ide_hwif_t *hwif; /* ptr to current hwif in linked-list */ + struct request *rq; /* current request */ + struct timer_list timer; /* failsafe timer */ + struct request wrq; /* local copy of current write rq */ + unsigned long poll_timeout; /* timeout value during long polls */ + } ide_hwgroup_t; + +/* + * configurable drive settings + */ + +#define TYPE_INT 0 +#define TYPE_INTA 1 +#define TYPE_BYTE 2 +#define TYPE_SHORT 3 + +#define SETTING_READ (1 << 0) +#define SETTING_WRITE (1 << 1) +#define SETTING_RW (SETTING_READ | SETTING_WRITE) + +typedef int (ide_procset_t)(ide_drive_t *, int); +typedef struct ide_settings_s { + char *name; + int rw; + int read_ioctl; + int write_ioctl; + int data_type; + int min; + int max; + int mul_factor; + int div_factor; + void *data; + ide_procset_t *set; + int auto_remove; + struct ide_settings_s *next; +} ide_settings_t; + +void ide_add_setting(ide_drive_t *drive, const char *name, int rw, int read_ioctl, int write_ioctl, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set); +void ide_remove_setting(ide_drive_t *drive, char *name); +ide_settings_t *ide_find_setting_by_name(ide_drive_t *drive, char *name); +int ide_read_setting(ide_drive_t *t, ide_settings_t *setting); +int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int val); +void ide_add_generic_settings(ide_drive_t *drive); + +/* + * /proc/ide interface + */ +typedef struct { + const char *name; + mode_t mode; + read_proc_t *read_proc; + write_proc_t *write_proc; +} ide_proc_entry_t; + +#ifdef CONFIG_PROC_FS +void proc_ide_create(void); +void proc_ide_destroy(void); +void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void *data); +void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p); +read_proc_t proc_ide_read_capacity; +read_proc_t proc_ide_read_geometry; + +/* + * Standard exit stuff: + */ +#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) \ +{ \ + len -= off; \ + if (len < count) { \ + *eof = 1; \ + if (len <= 0) \ + return 0; \ + } else \ + len = count; \ + *start = page + off; \ + return len; \ +} +#else +#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; +#endif + +/* + * Subdrivers support. + */ +#define IDE_SUBDRIVER_VERSION 1 + +typedef int (ide_cleanup_proc)(ide_drive_t *); +typedef void (ide_do_request_proc)(ide_drive_t *, struct request *, unsigned long); +typedef void (ide_end_request_proc)(byte, ide_hwgroup_t *); +typedef int (ide_ioctl_proc)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long); +typedef int (ide_open_proc)(struct inode *, struct file *, ide_drive_t *); +typedef void (ide_release_proc)(struct inode *, struct file *, ide_drive_t *); +typedef int (ide_check_media_change_proc)(ide_drive_t *); +typedef void (ide_pre_reset_proc)(ide_drive_t *); +typedef unsigned long (ide_capacity_proc)(ide_drive_t *); +typedef void (ide_special_proc)(ide_drive_t *); +typedef void (ide_setting_proc)(ide_drive_t *); + +typedef struct ide_driver_s { + const char *name; + const char *version; + byte media; + unsigned busy : 1; + unsigned supports_dma : 1; + unsigned supports_dsc_overlap : 1; + ide_cleanup_proc *cleanup; + ide_do_request_proc *do_request; + ide_end_request_proc *end_request; + ide_ioctl_proc *ioctl; + ide_open_proc *open; + ide_release_proc *release; + ide_check_media_change_proc *media_change; + ide_pre_reset_proc *pre_reset; + ide_capacity_proc *capacity; + ide_special_proc *special; + ide_proc_entry_t *proc; + } ide_driver_t; + +#define DRIVER(drive) ((ide_driver_t *)((drive)->driver)) + +/* + * IDE modules. + */ +#define IDE_CHIPSET_MODULE 0 /* not supported yet */ +#define IDE_PROBE_MODULE 1 +#define IDE_DRIVER_MODULE 2 + +typedef int (ide_module_init_proc)(void); + +typedef struct ide_module_s { + int type; + ide_module_init_proc *init; + void *info; + struct ide_module_s *next; +} ide_module_t; + +/* + * ide_hwifs[] is the master data structure used to keep track + * of just about everything in ide.c. Whenever possible, routines + * should be using pointers to a drive (ide_drive_t *) or + * pointers to a hwif (ide_hwif_t *), rather than indexing this + * structure directly (the allocation/layout may change!). + * + */ +#ifndef _IDE_C +extern ide_hwif_t ide_hwifs[]; /* master data repository */ +extern ide_module_t *ide_modules; +#endif + +/* + * We need blk.h, but we replace its end_request by our own version. + */ +#define IDE_DRIVER /* Toggle some magic bits in blk.h */ +#define LOCAL_END_REQUEST /* Don't generate end_request in blk.h */ +#include <linux/blk.h> + +void ide_end_request(byte uptodate, ide_hwgroup_t *hwgroup); + +/* + * This is used for (nearly) all data transfers from/to the IDE interface + */ +void ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount); +void ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount); + +/* + * This is used for (nearly) all ATAPI data transfers from/to the IDE interface + */ +void atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount); +void atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount); + +/* + * This is used on exit from the driver, to designate the next irq handler + * and also to start the safety timer. + */ +void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout); + +/* + * Error reporting, in human readable form (luxurious, but a memory hog). + */ +byte ide_dump_status (ide_drive_t *drive, const char *msg, byte stat); + +/* + * ide_error() takes action based on the error returned by the controller. + * The calling function must return afterwards, to restart the request. + */ +void ide_error (ide_drive_t *drive, const char *msg, byte stat); + +/* + * Issue a simple drive command + * The drive must be selected beforehand. + */ +void ide_cmd(ide_drive_t *drive, byte cmd, byte nsect, ide_handler_t *handler); + +/* + * ide_fixstring() cleans up and (optionally) byte-swaps a text string, + * removing leading/trailing blanks and compressing internal blanks. + * It is primarily used to tidy up the model name/number fields as + * returned by the WIN_[P]IDENTIFY commands. + */ +void ide_fixstring (byte *s, const int bytecount, const int byteswap); + +/* + * This routine busy-waits for the drive status to be not "busy". + * It then checks the status for all of the "good" bits and none + * of the "bad" bits, and if all is okay it returns 0. All other + * cases return 1 after invoking ide_error() -- caller should return. + * + */ +int ide_wait_stat (ide_drive_t *drive, byte good, byte bad, unsigned long timeout); + +/* + * This routine is called from the partition-table code in genhd.c + * to "convert" a drive to a logical geometry with fewer than 1024 cyls. + * + * The second parameter, "xparm", determines exactly how the translation + * will be handled: + * 0 = convert to CHS with fewer than 1024 cyls + * using the same method as Ontrack DiskManager. + * 1 = same as "0", plus offset everything by 63 sectors. + * -1 = similar to "0", plus redirect sector 0 to sector 1. + * >1 = convert to a CHS geometry with "xparm" heads. + * + * Returns 0 if the translation was not possible, if the device was not + * an IDE disk drive, or if a geometry was "forced" on the commandline. + * Returns 1 if the geometry translation was successful. + */ +int ide_xlate_1024 (kdev_t, int, const char *); + +/* + * Start a reset operation for an IDE interface. + * The caller should return immediately after invoking this. + */ +void ide_do_reset (ide_drive_t *); + +/* + * This function is intended to be used prior to invoking ide_do_drive_cmd(). + */ +void ide_init_drive_cmd (struct request *rq); + +/* + * "action" parameter type for ide_do_drive_cmd() below. + */ +typedef enum + {ide_wait, /* insert rq at end of list, and wait for it */ + ide_next, /* insert rq immediately after current request */ + ide_preempt, /* insert rq in front of current request */ + ide_end} /* insert rq at end of list, but don't wait for it */ + ide_action_t; + +/* + * This function issues a special IDE device request + * onto the request queue. + * + * If action is ide_wait, then the rq is queued at the end of the + * request queue, and the function sleeps until it has been processed. + * This is for use when invoked from an ioctl handler. + * + * If action is ide_preempt, then the rq is queued at the head of + * the request queue, displacing the currently-being-processed + * request and this function returns immediately without waiting + * for the new rq to be completed. This is VERY DANGEROUS, and is + * intended for careful use by the ATAPI tape/cdrom driver code. + * + * If action is ide_next, then the rq is queued immediately after + * the currently-being-processed-request (if any), and the function + * returns without waiting for the new rq to be completed. As above, + * This is VERY DANGEROUS, and is intended for careful use by the + * ATAPI tape/cdrom driver code. + * + * If action is ide_end, then the rq is queued at the end of the + * request queue, and the function returns immediately without waiting + * for the new rq to be completed. This is again intended for careful + * use by the ATAPI tape/cdrom driver code. + */ +int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t action); + +/* + * Clean up after success/failure of an explicit drive cmd. + * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD). + */ +void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err); + +/* + * Issue ATA command and wait for completion. + */ +int ide_wait_cmd (ide_drive_t *drive, int cmd, int nsect, int feature, int sectors, byte *buf); + +void ide_delay_50ms (void); + +/* + * ide_system_bus_speed() returns what we think is the system VESA/PCI + * bus speed (in MHz). This is used for calculating interface PIO timings. + * The default is 40 for known PCI systems, 50 otherwise. + * The "idebus=xx" parameter can be used to override this value. + */ +int ide_system_bus_speed (void); + +/* + * ide_multwrite() transfers a block of up to mcount sectors of data + * to a drive as part of a disk multwrite operation. + */ +void ide_multwrite (ide_drive_t *drive, unsigned int mcount); + +/* + * ide_stall_queue() can be used by a drive to give excess bandwidth back + * to the hwgroup by sleeping for timeout jiffies. + */ +void ide_stall_queue (ide_drive_t *drive, unsigned long timeout); + +/* + * ide_get_queue() returns the queue which corresponds to a given device. + */ +struct request **ide_get_queue (kdev_t dev); + +/* + * CompactFlash cards and their brethern pretend to be removable hard disks, + * but they never have a slave unit, and they don't have doorlock mechanisms. + * This test catches them, and is invoked elsewhere when setting appropriate config bits. + */ +int drive_is_flashcard (ide_drive_t *drive); + +int ide_spin_wait_hwgroup(ide_drive_t *drive, unsigned long *flags); +void ide_timer_expiry (unsigned long data); +void ide_intr (int irq, void *dev_id, struct pt_regs *regs); +void ide_geninit (struct gendisk *gd); +void do_ide0_request (void); +#if MAX_HWIFS > 1 +void do_ide1_request (void); +#endif +#if MAX_HWIFS > 2 +void do_ide2_request (void); +#endif +#if MAX_HWIFS > 3 +void do_ide3_request (void); +#endif +#if MAX_HWIFS > 4 +void do_ide4_request (void); +#endif +#if MAX_HWIFS > 5 +void do_ide5_request (void); +#endif +#if MAX_HWIFS > 6 +void do_ide6_request (void); +#endif +#if MAX_HWIFS > 7 +void do_ide7_request (void); +#endif +void ide_init_subdrivers (void); + +#ifndef _IDE_C +extern struct file_operations ide_fops[]; +#endif + +#ifdef _IDE_C +#ifdef CONFIG_BLK_DEV_IDE +int ideprobe_init (void); +#endif /* CONFIG_BLK_DEV_IDE */ +#ifdef CONFIG_BLK_DEV_IDEDISK +int idedisk_init (void); +#endif /* CONFIG_BLK_DEV_IDEDISK */ +#ifdef CONFIG_BLK_DEV_IDECD +int ide_cdrom_init (void); +#endif /* CONFIG_BLK_DEV_IDECD */ +#ifdef CONFIG_BLK_DEV_IDETAPE +int idetape_init (void); +#endif /* CONFIG_BLK_DEV_IDETAPE */ +#ifdef CONFIG_BLK_DEV_IDEFLOPPY +int idefloppy_init (void); +#endif /* CONFIG_BLK_DEV_IDEFLOPPY */ +#ifdef CONFIG_BLK_DEV_IDESCSI +int idescsi_init (void); +#endif /* CONFIG_BLK_DEV_IDESCSI */ +#endif /* _IDE_C */ + +int ide_register_module (ide_module_t *module); +void ide_unregister_module (ide_module_t *module); +ide_drive_t *ide_scan_devices (byte media, const char *name, ide_driver_t *driver, int n); +int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int version); +int ide_unregister_subdriver (ide_drive_t *drive); +int ide_replace_subdriver(ide_drive_t *drive, const char *driver); + +#ifdef CONFIG_BLK_DEV_IDEPCI +#define ON_BOARD 1 +#define NEVER_BOARD 0 +#ifdef CONFIG_BLK_DEV_OFFBOARD +# define OFF_BOARD ON_BOARD +#else /* CONFIG_BLK_DEV_OFFBOARD */ +# define OFF_BOARD NEVER_BOARD +#endif /* CONFIG_BLK_DEV_OFFBOARD */ +unsigned long ide_find_free_region (unsigned short size) __init; +void ide_scan_pcibus (void) __init; +#endif +#ifdef CONFIG_BLK_DEV_IDEDMA +#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_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); +int ide_release_dma (ide_hwif_t *hwif); +void ide_setup_dma (ide_hwif_t *hwif, unsigned long dmabase, unsigned int num_ports) __init; +unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif, int extra, const char *name) __init; +#endif + +#endif /* _IDE_H */ diff --git a/include/linux/isdn_budget.h b/include/linux/isdn_budget.h new file mode 100644 index 000000000..2eacceacf --- /dev/null +++ b/include/linux/isdn_budget.h @@ -0,0 +1,62 @@ +/* isdn_budget.h + * + * Linux ISDN subsystem, budget-accounting for network interfaces. + * + * Copyright 1997 by Christian Lademann <cal@zls.de> + * + * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/* +30.06.97:cal:angelegt +04.11.97:cal:budget.period: int --> time_t +*/ + +#ifndef __isdn_budget_h__ +#define __isdn_budget_h__ + +#include <linux/types.h> + +#define ISDN_BUDGET_DIAL 0 +#define ISDN_BUDGET_CHARGE 1 +#define ISDN_BUDGET_ONLINE 2 +#define ISDN_BUDGET_NUM_BUDGET 3 + +#define ISDN_BUDGET_INIT 0 +#define ISDN_BUDGET_CHECK_DIAL 1 +#define ISDN_BUDGET_CHECK_CHARGE 2 +#define ISDN_BUDGET_CHECK_ONLINE 3 +#define ISDN_BUDGET_START_ONLINE 10 + +#define ISDN_BUDGET_SET_BUDGET 0 +#define ISDN_BUDGET_GET_BUDGET 1 + +typedef struct { + char name [9]; /* Interface */ + int command, /* subcommand */ + budget, /* budget-nr. */ + amount, /* set/get budget-amount */ + used; /* set/get used amount */ + time_t period, /* set/get length of period */ + period_started; /* set/get startpoint of period */ +} isdn_ioctl_budget; + +#ifdef __KERNEL__ +extern int isdn_net_budget(int, struct device *); +extern int isdn_budget_ioctl(isdn_ioctl_budget *); +#endif /* __KERNEL__ */ + +#endif /* __isdn_budget_h__ */ diff --git a/include/linux/isdn_lzscomp.h b/include/linux/isdn_lzscomp.h new file mode 100644 index 000000000..8f64bfa67 --- /dev/null +++ b/include/linux/isdn_lzscomp.h @@ -0,0 +1,26 @@ +/* + * $Id: isdn_lzscomp.h,v 1.1 1998/07/08 16:52:33 hipp Exp $ + * + * Header for isdn_lzscomp.c + * Concentrated here to not mess up half a dozen kernel headers with code + * snippets + * + */ + +#define CI_LZS_COMPRESS 17 +#define CILEN_LZS_COMPRESS 5 + +#define LZS_CMODE_NONE 0 +#define LZS_CMODE_LCB 1 +#define LZS_CMODE_CRC 2 +#define LZS_CMODE_SEQNO 3 /* MUST be implemented (default) */ +#define LZS_CMODE_EXT 4 /* Seems to be what Win0.95 uses */ + +#define LZS_COMP_MAX_HISTS 1 /* Don't waste peers ressources */ +#define LZS_COMP_DEF_HISTS 1 /* Most likely to negotiate */ +#define LZS_DECOMP_MAX_HISTS 32 /* More is really nonsense */ +#define LZS_DECOMP_DEF_HISTS 8 /* If we get it, this may be optimal */ + +#define LZS_HIST_BYTE1(word) (word>>8) /* Just for better reading */ +#define LZS_HIST_BYTE2(word) (word&0xff) /* of this big endian stuff */ +#define LZS_HIST_WORD(b1,b2) ((b1<<8)|b2) /* (network byte order rulez) */ diff --git a/include/linux/isdn_timru.h b/include/linux/isdn_timru.h new file mode 100644 index 000000000..361dbbea1 --- /dev/null +++ b/include/linux/isdn_timru.h @@ -0,0 +1,119 @@ +/* isdn_timru.h + * + * Linux ISDN subsystem, timeout-rules for network interfaces. + * + * Copyright 1997 by Christian Lademann <cal@zls.de> + * + * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/* +02.06.97:cal:ISDN_TIMRU_PACKET_NONE def., ISDN_TIMRU_PACKET_* inkr. +*/ + +#ifndef __isdn_timru_h__ +#define __isdn_timru_h__ + +#define ISDN_TIMRU_PACKET_NONE 0 +#define ISDN_TIMRU_PACKET_SKB 1 +#define ISDN_TIMRU_PACKET_PPP 2 +#define ISDN_TIMRU_PACKET_PPP_NO_HEADER 3 + +#define ISDN_TIMRU_BRINGUP 0 +#define ISDN_TIMRU_KEEPUP_IN 1 +#define ISDN_TIMRU_KEEPUP_OUT 2 +#define ISDN_TIMRU_BRINGDOWN 3 +#define ISDN_TIMRU_NUM_CHECK 4 + +#define ISDN_TIMRU_PROTFAM_WILDCARD 0 +#define ISDN_TIMRU_PROTFAM_IP 1 +#define ISDN_TIMRU_PROTFAM_PPP 2 +#define ISDN_TIMRU_PROTFAM_IPX 3 +#define ISDN_TIMRU_NUM_PROTFAM 4 + +#define ISDN_TIMRU_IP_WILDCARD 0 +#define ISDN_TIMRU_IP_ICMP 1 +#define ISDN_TIMRU_IP_TCP 2 +#define ISDN_TIMRU_IP_UDP 3 + +#define ISDN_TIMRU_PPP_WILDCARD 0 +#define ISDN_TIMRU_PPP_IPCP 1 +#define ISDN_TIMRU_PPP_IPXCP 2 +#define ISDN_TIMRU_PPP_CCP 3 +#define ISDN_TIMRU_PPP_LCP 4 +#define ISDN_TIMRU_PPP_PAP 5 +#define ISDN_TIMRU_PPP_LQR 6 +#define ISDN_TIMRU_PPP_CHAP 7 + +typedef struct { + struct in_addr saddr, /* Source Address */ + smask, /* Source Subnetmask */ + daddr, /* Dest. Address */ + dmask; /* Dest. Subnetmask */ + ushort protocol; /* TCP, UDP, ... */ + union { + struct { + __u16 s_from, /* Source Port */ + s_to, + d_from, + d_to; + } port; + struct { + __u8 from, /* ICMP-Type */ + to; + } type; + } pt; +} isdn_timeout_rule_ip; + + +typedef struct { + ushort protocol; /* IPCP, LCP, ... */ +} isdn_timeout_rule_ppp; + + +typedef struct isdn_timeout_rule_s { + struct isdn_timeout_rule_s *next, /* Pointer to next rule */ + *prev; /* Pointer to previous rule */ + ushort type, /* BRINGUP, KEEPUP_*, ... */ + neg; + int timeout; /* Timeout value */ + ushort protfam; /* IP, IPX, PPP, ... */ + union { + isdn_timeout_rule_ip ip; /* IP-Rule */ + isdn_timeout_rule_ppp ppp; /* PPP-Rule */ + } rule; /* Prot.-specific rule */ +} isdn_timeout_rule; + + +typedef struct { + char name [9]; /* Interface */ + int where, /* 0/1: add to start/end of list, -1: handle default */ + type, + protfam, + index, + defval; + isdn_timeout_rule rule; /* Rule */ +} isdn_ioctl_timeout_rule; + +#ifdef __KERNEL__ +extern int isdn_net_recalc_timeout(int, int, struct device *, void *, ulong); +extern int isdn_timru_alloc_timeout_rules(struct device *); +extern int isdn_timru_ioctl_add_rule(isdn_ioctl_timeout_rule *); +extern int isdn_timru_ioctl_del_rule(isdn_ioctl_timeout_rule *); +extern int isdn_timru_ioctl_get_rule(isdn_ioctl_timeout_rule *); +#endif /* __KERNEL__ */ + +#endif /* __isdn_timru_h__ */ diff --git a/include/net/decnet_call.h b/include/net/decnet_call.h new file mode 100644 index 000000000..90a30561e --- /dev/null +++ b/include/net/decnet_call.h @@ -0,0 +1,2 @@ +/* Separate to keep compilation of protocols.c simpler */ +extern void decnet_proto_init(struct net_proto *pro); diff --git a/include/net/dn.h b/include/net/dn.h new file mode 100644 index 000000000..b2ad40426 --- /dev/null +++ b/include/net/dn.h @@ -0,0 +1,206 @@ +#ifndef _NET_DN_H +#define _NET_DN_H + +#include <linux/dn.h> +#include <asm/byteorder.h> + +typedef unsigned short dn_address; + +#define dn_ntohs(x) le16_to_cpu(x) +#define dn_htons(x) cpu_to_le16(x) + +struct dn_scp /* Session Control Port */ +{ + unsigned char state; +#define DN_O 1 /* Open */ +#define DN_CR 2 /* Connect Receive */ +#define DN_DR 3 /* Disconnect Reject */ +#define DN_DRC 4 /* Discon. Rej. Complete*/ +#define DN_CC 5 /* Connect Confirm */ +#define DN_CI 6 /* Connect Initiate */ +#define DN_NR 7 /* No resources */ +#define DN_NC 8 /* No communication */ +#define DN_CD 9 /* Connect Delivery */ +#define DN_RJ 10 /* Rejected */ +#define DN_RUN 11 /* Running */ +#define DN_DI 12 /* Disconnect Initiate */ +#define DN_DIC 13 /* Disconnect Complete */ +#define DN_DN 14 /* Disconnect Notificat */ +#define DN_CL 15 /* Closed */ +#define DN_CN 16 /* Closed Notification */ + + unsigned short addrloc; + unsigned short addrrem; + unsigned short numdat; + unsigned short numoth; + unsigned short numoth_rcv; + unsigned short numdat_rcv; + unsigned short ackxmt_dat; + unsigned short ackxmt_oth; + unsigned short ackrcv_dat; + unsigned short ackrcv_oth; + unsigned char flowrem_sw; + unsigned char flowloc_sw; +#define DN_SEND 2 +#define DN_DONTSEND 1 +#define DN_NOCHANGE 0 + unsigned char accept_mode; + unsigned short mss; + + struct optdata_dn conndata_in; + struct optdata_dn conndata_out; + struct optdata_dn discdata_in; + struct optdata_dn discdata_out; + struct accessdata_dn accessdata; + + struct sockaddr_dn addr; /* Local address */ + struct sockaddr_dn peer; /* Remote address */ + + /* + * In this case the RTT estimation is not specified in the + * docs, nor is any back off algorithm. Here we follow well + * known tcp algorithms with a few small variations. + * + * snd_window: Max number of packets we send before we wait for + * an ack to come back. This will become part of a + * more complicated scheme when we support flow + * control. + * + * nsp_srtt: Round-Trip-Time (x8) in jiffies. This is a rolling + * average. + * nsp_rttvar: Round-Trip-Time-Varience (x4) in jiffies. This is the + * varience of the smoothed average (but calculated in + * a simpler way than for normal statistical varience + * calculations). + * + * nsp_rxtshift: Backoff counter. Value is zero normally, each time + * a packet is lost is increases by one until an ack + * is received. Its used to index an array of backoff + * multipliers. + */ +#define NSP_MIN_WINDOW 1 +#define NSP_MAX_WINDOW 512 + unsigned long snd_window; +#define NSP_INITIAL_SRTT (HZ) + unsigned long nsp_srtt; +#define NSP_INITIAL_RTTVAR (HZ*3) + unsigned long nsp_rttvar; +#define NSP_MAXRXTSHIFT 12 + unsigned long nsp_rxtshift; + + /* + * Output queues, one for data, one for otherdata/linkservice + */ + struct sk_buff_head data_xmit_queue; + struct sk_buff_head other_xmit_queue; + + /* + * Input queue for other data + */ + struct sk_buff_head other_receive_queue; + int other_report; + + /* + * Stuff to do with the slow timer + */ + unsigned long stamp; /* time of last transmit */ + unsigned long persist; + int (*persist_fxn)(struct sock *sk); + unsigned long keepalive; + void (*keepalive_fxn)(struct sock *sk); + + /* + * This stuff is for the fast timer for delayed acks + */ + struct timer_list delack_timer; + int delack_pending; + void (*delack_fxn)(struct sock *sk); +}; + +/* + * src,dst : Source and Destination DECnet addresses + * neigh: Address from which we've just got this skb. + * hops : Number of hops through the network + * dst_port, src_port : NSP port numbers + * services, info : Useful data extracted from conninit messages + * rt_flags : Routing flags byte + * nsp_flags : NSP layer flags byte + * segsize : Size of segment + * segnum : Number, for data, otherdata and linkservice + * xmit_count : Number of times we've transmitted this skb + * stamp : Time stamp of first transmission, used in RTT calculations + * iif: Input interface number + * + * As a general policy, this structure keeps all addresses in network + * byte order, and all else in host byte order. Thus dst, src, dst_port + * src_port and neigh are in network order. All else is in host order. + * + */ +struct dn_skb_cb { + unsigned short dst; + unsigned short src; + unsigned short neigh; + unsigned short hops; + unsigned short dst_port; + unsigned short src_port; + unsigned char services; + unsigned char info; + unsigned char rt_flags; + unsigned char nsp_flags; + unsigned short segsize; + unsigned short segnum; + unsigned short xmit_count; + unsigned long stamp; + int iif; +}; + +static __inline__ dn_address dn_eth2dn(unsigned char *ethaddr) +{ + return ethaddr[4] | (ethaddr[5] << 8); +} + +static __inline__ dn_address dn_saddr2dn(struct sockaddr_dn *saddr) +{ + return *(dn_address *)saddr->sdn_nodeaddr; +} + +static __inline__ void dn_dn2eth(unsigned char *ethaddr, dn_address addr) +{ + ethaddr[0] = 0xAA; + ethaddr[1] = 0x00; + ethaddr[2] = 0x04; + ethaddr[3] = 0x00; + ethaddr[4] = (unsigned char)(addr & 0xff); + ethaddr[5] = (unsigned char)(addr >> 8); +} + +#define DN_MENUVER_ACC 0x01 +#define DN_MENUVER_USR 0x02 +#define DN_MENUVER_PRX 0x04 +#define DN_MENUVER_UIC 0x08 + +extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr); +extern struct sock *dn_find_by_skb(struct sk_buff *skb); +extern unsigned short dn_alloc_port(void); +#define DN_ASCBUF_LEN 7 +extern char *dn_addr2asc(dn_address, char *); +extern void dn_destroy_sock(struct sock *sk); + +extern int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf, unsigned char type); +extern int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *addr, unsigned char *type); + +extern void dn_start_slow_timer(struct sock *sk); +extern void dn_stop_slow_timer(struct sock *sk); +extern void dn_start_fast_timer(struct sock *sk); +extern void dn_stop_fast_timer(struct sock *sk); + +extern dn_address decnet_address; +extern unsigned char decnet_ether_address[6]; +extern int decnet_node_type; +extern int decnet_debug_level; +extern int decnet_time_wait; +extern int decnet_dn_count; +extern int decnet_di_count; +extern int decnet_dr_count; + +#endif /* _NET_DN_H */ diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h new file mode 100644 index 000000000..cb9eda018 --- /dev/null +++ b/include/net/dn_dev.h @@ -0,0 +1,194 @@ +#ifndef _NET_DN_DEV_H +#define _NET_DN_DEV_H + + +struct dn_dev; + +struct dn_ifaddr { + struct dn_ifaddr *ifa_next; + struct dn_dev *ifa_dev; + dn_address ifa_local; + unsigned char ifa_flags; + unsigned char ifa_scope; + char ifa_label[IFNAMSIZ]; +}; + +#define DN_DEV_S_RU 0 /* Run - working normally */ +#define DN_DEV_S_CR 1 /* Circuit Rejected */ +#define DN_DEV_S_DS 2 /* Data Link Start */ +#define DN_DEV_S_RI 3 /* Routing Layer Initialize */ +#define DN_DEV_S_RV 4 /* Routing Layer Verify */ +#define DN_DEV_S_RC 5 /* Routing Layer Complete */ +#define DN_DEV_S_OF 6 /* Off */ +#define DN_DEV_S_HA 7 /* Halt */ + + +/* + * The dn_dev_parms structure contains the set of parameters + * for each device (hence inclusion in the dn_dev structure) + * and an array is used to store the default types of supported + * device (in dn_dev.c). + * + * The type field matches the ARPHRD_ constants and is used in + * searching the list for supported devices when new devices + * come up. + * + * The mode field is used to find out if a device is broadcast, + * multipoint, or pointopoint. Please note that DECnet thinks + * different ways about devices to the rest of the kernel + * so the normal IFF_xxx flags are invalid here. For devices + * which can be any combination of the previously mentioned + * attributes, you can set this on a per device basis by + * installing an up() routine. + * + * The device state field, defines the initial state in which the + * device will come up. In the dn_dev structure, it is the actual + * state. + * + * The cost field is used in the routing algorithm. + * + * Timers: + * t1 - Routing timer, send routing messages when it expires + * t2 - Rate limit timer, min time between routing and hello messages + * t3 - Hello timer, send hello messages when it expires + * + * Callbacks: + * up() - Called to initialize device, return value can veto use of + * device with DECnet. + * down() - Called to turn device off when it goes down + * timer1() - Called when timer 1 goes off + * timer3() - Called when timer 3 goes off + * setsrc() - Called for each incomming frame to set previous hop info + * neigh_setup() - Called to do device specific setup of neighbours + * + * sysctl - Hook for sysctl things + * + */ +struct dn_dev_parms { + int type; /* ARPHRD_xxx */ + int mode; /* Broadcast, Unicast, Mulitpoint */ +#define DN_DEV_BCAST 1 +#define DN_DEV_UCAST 2 +#define DN_DEV_MPOINT 4 + int state; /* Initial state */ + int cost; /* Default cost of device */ + unsigned short blksize; /* Block Size */ + unsigned long t1; /* Default value of t1 */ + unsigned long t2; /* Default value of t2 */ + unsigned long t3; /* Default value of t3 */ + int priority; /* Priority to be a router */ + char *name; /* Name for sysctl */ + int ctl_name; /* Index for sysctl */ + int (*up)(struct device *); + void (*down)(struct device *); + void (*timer1)(struct device *); + void (*timer3)(struct device *); + int (*setsrc)(struct sk_buff *skb); + int (*neigh_setup)(struct neighbour *); + void *sysctl; +}; + + +struct dn_dev { + struct dn_ifaddr *ifa_list; + struct device *dev; + struct dn_dev_parms parms; + char use_long; + struct timer_list timer; + unsigned long t3, t1; + struct neigh_parms *neigh_parms; + unsigned char addr[ETH_ALEN]; + struct neighbour *router; /* Default router on circuit */ + struct neighbour *peer; /* Peer on pointopoint links */ + unsigned long uptime; /* Time device went up in jiffies */ +}; + +struct dn_short_packet +{ + unsigned char msgflg __attribute__((packed)); + unsigned short dstnode __attribute__((packed)); + unsigned short srcnode __attribute__((packed)); + unsigned char forward __attribute__((packed)); +}; + +struct dn_long_packet +{ + unsigned char msgflg __attribute__((packed)); + unsigned char d_area __attribute__((packed)); + unsigned char d_subarea __attribute__((packed)); + unsigned char d_id[6] __attribute__((packed)); + unsigned char s_area __attribute__((packed)); + unsigned char s_subarea __attribute__((packed)); + unsigned char s_id[6] __attribute__((packed)); + unsigned char nl2 __attribute__((packed)); + unsigned char visit_ct __attribute__((packed)); + unsigned char s_class __attribute__((packed)); + unsigned char pt __attribute__((packed)); +}; + +/*------------------------- DRP - Routing messages ---------------------*/ + + struct endnode_hello_message + { + unsigned char msgflg __attribute__((packed)); + unsigned char tiver[3] __attribute__((packed)); + unsigned char id[6] __attribute__((packed)); + unsigned char iinfo __attribute__((packed)); + unsigned short blksize __attribute__((packed)); + unsigned char area __attribute__((packed)); + unsigned char seed[8] __attribute__((packed)); + unsigned char neighbor[6] __attribute__((packed)); + unsigned short timer __attribute__((packed)); + unsigned char mpd __attribute__((packed)); + unsigned char datalen __attribute__((packed)); + unsigned char data[2] __attribute__((packed)); + }; + struct rtnode_hello_message + { + unsigned char msgflg __attribute__((packed)); + unsigned char tiver[3] __attribute__((packed)); + unsigned char id[6] __attribute__((packed)); + unsigned char iinfo __attribute__((packed)); + unsigned short blksize __attribute__((packed)); + unsigned char priority __attribute__((packed)); + unsigned char area __attribute__((packed)); + unsigned short timer __attribute__((packed)); + unsigned char mpd __attribute__((packed)); + }; + + +extern void dn_dev_init(void); +extern void dn_dev_cleanup(void); + +extern int dn_dev_ioctl(unsigned int cmd, void *arg); + +extern void dn_dev_devices_off(void); +extern void dn_dev_devices_on(void); + +extern void dn_dev_init_pkt(struct sk_buff *skb); +extern void dn_dev_veri_pkt(struct sk_buff *skb); +extern void dn_dev_hello(struct sk_buff *skb); + +extern void dn_dev_up(struct device *); +extern void dn_dev_down(struct device *); + +extern struct device *decnet_default_device; + +static __inline__ int dn_dev_islocal(struct device *dev, dn_address addr) +{ + struct dn_dev *dn_db = dev->dn_ptr; + struct dn_ifaddr *ifa; + + if (dn_db == NULL) { + printk(KERN_DEBUG "dn_dev_islocal: Called for non DECnet device\n"); + return 0; + } + + for(ifa = dn_db->ifa_list; ifa; ifa = ifa->ifa_next) + if ((addr ^ ifa->ifa_local) == 0) + return 1; + + return 0; +} + +#endif /* _NET_DN_DEV_H */ diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h new file mode 100644 index 000000000..22d227278 --- /dev/null +++ b/include/net/dn_fib.h @@ -0,0 +1,83 @@ +#ifndef _NET_DN_FIB_H +#define _NET_DN_FIB_H + +#ifdef CONFIG_DECNET_ROUTER + + +struct dn_fib_res { + dn_address res_addr; + dn_address res_mask; + int res_ifindex; + int res_proto; + int res_cost; + int res_type; + struct dn_fib_node *res_fn; + struct dn_fib_action *res_fa; +}; + +struct dn_fib_action { + struct dn_fib_action *fa_next; + dn_address fa_key; + dn_address fa_mask; + int fa_ifindex; + int fa_proto; + int fa_cost; + int fa_type; + union { + struct neighbour *fau_neigh; /* Normal route */ + int fau_error; /* Reject */ + int fau_table; /* Throw */ + } fa_u; +#define fa_neigh fa_u.fau_neigh +#define fa_error fa_u.fau_error +#define fa_table fa_u.fau_table +}; + +struct dn_fib_node { + struct dn_fib_node *fn_up; + dn_address fn_cmpmask; + dn_address fn_key; + int fn_shift; + struct dn_fib_action *fn_action; + struct dn_fib_node *fn_children[2]; +}; + +#define DN_FIB_NEXT(fibnode, key) ((fibnode)->fn_children[((key) ^ (fibnode)->fn_cmpmask) >> (fibnode)->fn_shift]) + +struct dn_fib_walker_t; + +struct dn_fib_table { + int n; + unsigned long count; + struct dn_fib_node *root; + + int (*insert)(struct dn_fib_table *t, struct dn_fib_action *fa); + int (*delete)(struct dn_fib_table *t, struct dn_fib_action *fa); + int (*lookup)(struct dn_fib_table *t, struct dn_fib_res *res); + int (*walk)(struct dn_fib_walker_t *fwt); +#ifdef CONFIG_RTNETLINK + int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb); +#endif /* CONFIG_RTNETLINK */ +}; + +struct dn_fib_walker_t { + struct dn_fib_table *table; + void *arg; + int (*fxn)(struct dn_fib_walker_t *fwt, struct dn_fib_node *n); +}; + +extern void dn_fib_init(void); +extern void dn_fib_cleanup(void); + +extern int dn_fib_rt_message(struct sk_buff *skb); +extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); + +#ifdef CONFIG_RTNETLINK +extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); +extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); +extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); +extern int dn_fib_rtm_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); +#endif /* CONFIG_RTNETLINK */ +#endif /* CONFIG_DECNET_ROUTER */ + +#endif /* _NET_DN_FIB_H */ diff --git a/include/net/dn_neigh.h b/include/net/dn_neigh.h new file mode 100644 index 000000000..b4e7ed1d8 --- /dev/null +++ b/include/net/dn_neigh.h @@ -0,0 +1,29 @@ +#ifndef _NET_DN_NEIGH_H +#define _NET_DN_NEIGH_H + +/* + * The position of the first two fields of + * this structure are critical - SJW + */ +struct dn_neigh { + struct neighbour n; + unsigned char addr[ETH_ALEN]; + unsigned long flags; +#define DN_NDFLAG_R1 0x0001 /* Router L1 */ +#define DN_NDFLAG_R2 0x0002 /* Router L2 */ +#define DN_NDFLAG_P3 0x0004 /* Phase III Node */ + unsigned long blksize; + unsigned char priority; +}; + +extern void dn_neigh_init(void); +extern void dn_neigh_cleanup(void); +extern struct neighbour *dn_neigh_lookup(struct neigh_table *tbl, void *ptr); +extern void dn_neigh_router_hello(struct sk_buff *skb); +extern void dn_neigh_endnode_hello(struct sk_buff *skb); +extern void dn_neigh_pointopoint_hello(struct sk_buff *skb); +extern int dn_neigh_elist(struct device *dev, unsigned char *ptr, int n); + +extern struct neigh_table dn_neigh_table; + +#endif /* _NET_DN_NEIGH_H */ diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h new file mode 100644 index 000000000..d8cef8c06 --- /dev/null +++ b/include/net/dn_nsp.h @@ -0,0 +1,194 @@ +#ifndef _NET_DN_NSP_H +#define _NET_DN_NSP_H +/****************************************************************************** + (c) 1995-1998 E.M. Serrat emserrat@geocities.com + + 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 + 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. +*******************************************************************************/ +/* dn_nsp.c functions prototyping */ + +extern void dn_nsp_send_data_ack(struct sock *sk); +extern void dn_nsp_send_oth_ack(struct sock *sk); +extern void dn_nsp_delayed_ack(struct sock *sk); +extern void dn_send_conn_ack(struct sock *sk); +extern void dn_send_conn_conf(struct sock *sk); +extern void dn_send_disc(struct sock *sk, unsigned char type, unsigned short reason); +extern void dn_nsp_send_lnk(struct sock *sk, unsigned short flags); +extern void dn_nsp_send_conninit(struct sock *sk, unsigned char flags); + +extern void dn_nsp_output(struct sock *sk); +extern int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *q, unsigned short acknum); +extern void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, int oob); +extern unsigned long dn_nsp_persist(struct sock *sk); +extern int dn_nsp_xmit_timeout(struct sock *sk); + +extern int dn_nsp_rx(struct sk_buff *); +extern int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb); + +extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri); +extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, int *size, int noblock, int *err); + +#define NSP_REASON_NR 1 +#define NSP_REASON_DC 42 +#define NSP_REASON_NL 41 + +#define NSP_DISCINIT 0x38 +#define NSP_DISCCONF 0x48 + +/*------------------------- NSP - messages ------------------------------*/ +/* Data Messages */ +/*---------------*/ + +/* Data Messages (data segment/interrupt/link service) */ + + struct nsp_data_seg_msg + { + unsigned char msgflg __attribute__((packed)); + unsigned short dstaddr __attribute__((packed)); + unsigned short srcaddr __attribute__((packed)); + }; + + struct nsp_data_opt_msg + { + unsigned short acknum __attribute__((packed)); + unsigned short segnum __attribute__((packed)); + unsigned short lsflgs __attribute__((packed)); + }; + + struct nsp_data_opt_msg1 + { + unsigned short acknum __attribute__((packed)); + unsigned short segnum __attribute__((packed)); + }; + +/* Acknowledgment Messages */ +/*-------------------------*/ + +/* Acknowledgment Messages (data/other data) */ + + struct nsp_data_ack_msg + { + unsigned char msgflg __attribute__((packed)); + unsigned short dstaddr __attribute__((packed)); + unsigned short srcaddr __attribute__((packed)); + unsigned short acknum __attribute__((packed)); + }; + +/* Connect Acknowledgment Message */ + + struct nsp_conn_ack_msg + { + unsigned char msgflg __attribute__((packed)); + unsigned short dstaddr __attribute__((packed)); + }; + +/* Control Messages */ +/*------------------*/ + +/* Connect Initiate/Retransmit Initiate/Connect Confirm */ + + struct nsp_conn_init_msg + { + unsigned char msgflg __attribute__((packed)); +#define NSP_CI 0x18 /* Connect Initiate */ +#define NSP_RCI 0x68 /* Retrans. Conn Init */ + unsigned short dstaddr __attribute__((packed)); + unsigned short srcaddr __attribute__((packed)); + unsigned char services __attribute__((packed)); +#define NSP_FC_NONE 0x00 /* Flow Control None */ +#define NSP_FC_SRC 0x04 /* Seg Req. Count */ +#define NSP_FC_SCMC 0x08 /* Sess. Control Mess */ + unsigned char info __attribute__((packed)); + unsigned short segsize __attribute__((packed)); + }; + +/* Disconnect Initiate/Disconnect Confirm */ + + struct nsp_disconn_init_msg + { + unsigned char msgflg __attribute__((packed)); + unsigned short dstaddr __attribute__((packed)); + unsigned short srcaddr __attribute__((packed)); + unsigned short reason __attribute__((packed)); + }; + + +/*------------------------- SCP - messages ------------------------------*/ + + struct srcobj_fmt + { + char format __attribute__((packed)); + unsigned char task __attribute__((packed)); + unsigned short grpcode __attribute__((packed)); + unsigned short usrcode __attribute__((packed)); + char dlen __attribute__((packed)); + }; + +/* + * A collection of functions for manipulating the sequence + * numbers used in NSP. Similar in operation to the functions + * of the same name in TCP. + */ +static __inline__ int before(unsigned short seq1, unsigned short seq2) +{ + seq1 &= 0x0fff; + seq2 &= 0x0fff; + + return (int)((seq1 - seq2) & 0x0fff) > 2048; +} + + +static __inline__ int after(unsigned short seq1, unsigned short seq2) +{ + seq1 &= 0x0fff; + seq2 &= 0x0fff; + + return (int)((seq2 - seq1) & 0x0fff) > 2048; +} + +static __inline__ int equal(unsigned short seq1, unsigned short seq2) +{ + return ((seq1 ^ seq2) & 0x0fff) == 0; +} + +static __inline__ int before_or_equal(unsigned short seq1, unsigned short seq2) +{ + return (before(seq1, seq2) || equal(seq1, seq2)); +} + +static __inline__ void seq_add(unsigned short *seq, unsigned short off) +{ + *seq += off; + *seq &= 0x0fff; +} + +static __inline__ int seq_next(unsigned short seq1, unsigned short seq2) +{ + return (((seq2&0x0fff) - (seq1&0x0fff)) == 1); +} + +/* + * Can we delay the ack ? + */ +static __inline__ int sendack(unsigned short seq) +{ + return (int)((seq & 0x1000) ? 0 : 1); +} + +/* + * Is socket congested ? + */ +static __inline__ int dn_congested(struct sock *sk) +{ + return atomic_read(&sk->rmem_alloc) > (sk->rcvbuf >> 1); +} + +#endif /* _NET_DN_NSP_H */ diff --git a/include/net/dn_raw.h b/include/net/dn_raw.h new file mode 100644 index 000000000..a4502d29c --- /dev/null +++ b/include/net/dn_raw.h @@ -0,0 +1,17 @@ +#ifndef _NET_DN_RAW_H +#define _NET_DN_RAW_H + +#ifdef CONFIG_DECNET_RAW + +extern struct proto_ops dn_raw_proto_ops; + +extern void dn_raw_rx_nsp(struct sk_buff *skb); +extern void dn_raw_rx_routing(struct sk_buff *skb); + +#ifdef CONFIG_DECNET_MOP +extern void dn_raw_rx_mop(struct sk_buff *skb); +#endif /* CONFIG_DECNET_MOP */ + +#endif /* CONFIG_DECNET_RAW */ + +#endif /* _NET_DN_RAW_H */ diff --git a/include/net/dn_route.h b/include/net/dn_route.h new file mode 100644 index 000000000..ecd1f313b --- /dev/null +++ b/include/net/dn_route.h @@ -0,0 +1,74 @@ +#ifndef _NET_DN_ROUTE_H +#define _NET_DN_ROUTE_H + +/****************************************************************************** + (c) 1995-1998 E.M. Serrat emserrat@geocities.com + + 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 + 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. +*******************************************************************************/ +/* dn_route.c functions prototyping */ +extern void dn_send_skb(struct sk_buff *); +extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri); +extern int dn_route_output(struct sock *sk); + +/* Masks for flags field */ +#define DN_RT_F_PID 0x07 /* Mask for packet type */ +#define DN_RT_F_PF 0x80 /* Padding Follows */ +#define DN_RT_F_VER 0x40 /* Version =0 discard packet if ==1 */ +#define DN_RT_F_IE 0x20 /* Intra Ethernet, Reserved in short pkt */ +#define DN_RT_F_RTS 0x10 /* Packet is being returned to sender */ +#define DN_RT_F_RQR 0x08 /* Return packet to sender upon non-delivery */ + +/* Mask for types of routing packets */ +#define DN_RT_PKT_MSK 0x06 +/* Types of routing packets */ +#define DN_RT_PKT_SHORT 0x02 /* Short routing packet */ +#define DN_RT_PKT_LONG 0x06 /* Long routing packet */ + +/* Mask for control/routing selection */ +#define DN_RT_PKT_CNTL 0x01 /* Set to 1 if a control packet */ +/* Types of control packets */ +#define DN_RT_CNTL_MSK 0x0f /* Mask for control packets */ +#define DN_RT_PKT_INIT 0x01 /* Initialisation packet */ +#define DN_RT_PKT_VERI 0x03 /* Verification Message */ +#define DN_RT_PKT_HELO 0x05 /* Hello and Test Message */ +#define DN_RT_PKT_L1RT 0x07 /* Level 1 Routing Message */ +#define DN_RT_PKT_L2RT 0x09 /* Level 2 Routing Message */ +#define DN_RT_PKT_ERTH 0x0b /* Ethernet Router Hello */ +#define DN_RT_PKT_EEDH 0x0d /* Ethernet EndNode Hello */ + +/* Values for info field in hello message */ +#define DN_RT_INFO_TYPE 0x03 /* Type mask */ +#define DN_RT_INFO_L1RT 0x02 /* L1 Router */ +#define DN_RT_INFO_L2RT 0x01 /* L2 Router */ +#define DN_RT_INFO_ENDN 0x03 /* EndNode */ +#define DN_RT_INFO_VERI 0x04 /* Verification Reqd. */ +#define DN_RT_INFO_RJCT 0x08 /* Reject Flag, Reserved */ +#define DN_RT_INFO_VFLD 0x10 /* Verification Failed, Reserved */ +#define DN_RT_INFO_NOML 0x20 /* No Multicast traffic accepted */ +#define DN_RT_INFO_BLKR 0x40 /* Blocking Requested */ + + +struct dn_route { + union { + struct dst_entry dst; + struct dn_route *rt_next; + } u; + unsigned short rt_saddr; + unsigned short rt_daddr; + int rt_iif; + int rt_oif; +}; + +extern void dn_route_init(void); +extern void dn_route_cleanup(void); + +#endif /* _NET_DN_ROUTE_H */ diff --git a/include/net/irda/smc-ircc.h b/include/net/irda/smc-ircc.h new file mode 100644 index 000000000..2c5cbf4fd --- /dev/null +++ b/include/net/irda/smc-ircc.h @@ -0,0 +1,160 @@ +/********************************************************************* + * + * Filename: smc.h + * Version: + * Description: + * Status: Experimental. + * Author: Thomas Davis (tadavis@jps.net) + * + * Copyright (c) 1998, 1999 Thomas Davis (tadavis@jps.net> + * All Rights Reserved + * + * 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. + * + * I, Thomas Davis, admit no liability nor provide warranty for any + * of this software. This material is provided "AS-IS" and at no charge. + * + * Definitions for the SMC IrCC controller. + * + ********************************************************************/ + +#ifndef SMC_IRCC_H +#define SMC_IRCC_H + +#define UART_MASTER 0x07 +#define UART_MASTER_POWERDOWN 1<<7 +#define UART_MASTER_RESET 1<<6 +#define UART_MASTER_INT_EN 1<<5 +#define UART_MASTER_ERROR_RESET 1<<4 + +/* Register block 0 */ + +#define UART_IIR 0x01 +#define UART_IER 0x02 +#define UART_LSR 0x03 +#define UART_LCR_A 0x04 +#define UART_LCR_B 0x05 +#define UART_BSR 0x06 + +#define UART_IIR_ACTIVE_FRAME 1<<7 +#define UART_IIR_EOM 1<<6 +#define UART_IIR_RAW_MODE 1<<5 +#define UART_IIR_FIFO 1<<4 + +#define UART_IER_ACTIVE_FRAME 1<<7 +#define UART_IER_EOM 1<<6 +#define UART_IER_RAW_MODE 1<<5 +#define UART_IER_FIFO 1<<4 + +#define UART_LSR_UNDERRUN 1<<7 +#define UART_LSR_OVERRUN 1<<6 +#define UART_LSR_FRAME_ERROR 1<<5 +#define UART_LSR_SIZE_ERROR 1<<4 +#define UART_LSR_CRC_ERROR 1<<3 +#define UART_LSR_FRAME_ABORT 1<<2 + +#define UART_LCR_A_FIFO_RESET 1<<7 +#define UART_LCR_A_FAST 1<<6 +#define UART_LCR_A_GP_DATA 1<<5 +#define UART_LCR_A_RAW_TX 1<<4 +#define UART_LCR_A_RAW_RX 1<<3 +#define UART_LCR_A_ABORT 1<<2 +#define UART_LCR_A_DATA_DONE 1<<1 + +#define UART_LCR_B_SCE_DISABLED 0x00<<6 +#define UART_LCR_B_SCE_TRANSMIT 0x01<<6 +#define UART_LCR_B_SCE_RECEIVE 0x02<<6 +#define UART_LCR_B_SCE_UNDEFINED 0x03<<6 +#define UART_LCR_B_SIP_ENABLE 1<<5 +#define UART_LCR_B_BRICK_WALL 1<<4 + +#define UART_BSR_NOT_EMPTY 1<<7 +#define UART_BSR_FIFO_FULL 1<<6 +#define UART_BSR_TIMEOUT 1<<5 + +/* Register block 1 */ + +#define UART_SCE_CFGA 0x00 +#define UART_SCE_CFGB 0x01 +#define UART_FIFO_THRESHOLD 0x02 + +#define UART_CFGA_AUX_IR 0x01<<7 +#define UART_CFGA_HALF_DUPLEX 0x01<<2 +#define UART_CFGA_TX_POLARITY 0x01<<1 +#define UART_CFGA_RX_POLARITY 0x01 + +#define UART_CFGA_COM 0x00<<3 +#define UART_CFGA_IRDA_SIR_A 0x01<<3 +#define UART_CFGA_ASK_SIR 0x02<<3 +#define UART_CFGA_IRDA_SIR_B 0x03<<3 +#define UART_CFGA_IRDA_HDLC 0x04<<3 +#define UART_CFGA_IRDA_4PPM 0x05<<3 +#define UART_CFGA_CONSUMER 0x06<<3 +#define UART_CFGA_RAW_IR 0x07<<3 +#define UART_CFGA_OTHER 0x08<<3 + +#define UART_IR_HDLC 0x04 +#define UART_IR_4PPM 0x01 +#define UART_IR_CONSUMER 0x02 + +#define UART_CFGB_LOOPBACK 0x01<<5 +#define UART_CFGB_LPBCK_TX_CRC 0x01<<4 +#define UART_CFGB_NOWAIT 0x01<<3 +#define UART_CFGB_STRING_MOVE 0x01<<2 +#define UART_CFGB_DMA_BURST 0x01<<1 +#define UART_CFGB_DMA_ENABLE 0x01 + +#define UART_CFGB_COM 0x00<<6 +#define UART_CFGB_IR 0x01<<6 +#define UART_CFGB_AUX 0x02<<6 +#define UART_CFGB_INACTIVE 0x03<<6 + +/* Register block 2 - Consumer IR - not used */ + +/* Register block 3 - Identification Registers! */ + +#define UART_ID_HIGH 0x00 /* 0x10 */ +#define UART_ID_LOW 0x01 /* 0xB8 */ +#define UART_CHIP_ID 0x02 /* 0xF1 */ +#define UART_VERSION 0x03 /* 0x01 */ +#define UART_INTERFACE 0x04 /* low 4 = DMA, high 4 = IRQ */ + +/* Register block 4 - IrDA */ +#define UART_CONTROL 0x00 +#define UART_BOF_COUNT_LO 0x01 +#define UART_BRICKWALL_CNT_LO 0x02 +#define UART_BRICKWALL_TX_CNT_HI 0x03 +#define UART_TX_SIZE_LO 0x04 +#define UART_RX_SIZE_HI 0x05 +#define UART_RX_SIZE_LO 0x06 + +#define UART_1152 0x01<<7 +#define UART_CRC 0x01<<6 + +/* For storing entries in the status FIFO */ +struct st_fifo_entry { + int status; + int len; +}; + +struct st_fifo { + struct st_fifo_entry entries[10]; + int head; + int tail; + int len; +}; + +/* Private data for each instance */ +struct ircc_cb { + struct st_fifo st_fifo; + + int tx_buff_offsets[10]; /* Offsets between frames in tx_buff */ + int tx_len; /* Number of frames in tx_buff */ + + struct irda_device idev; +}; + +#endif diff --git a/include/net/irda/toshoboe.h b/include/net/irda/toshoboe.h new file mode 100644 index 000000000..b2f5b953b --- /dev/null +++ b/include/net/irda/toshoboe.h @@ -0,0 +1,165 @@ +/********************************************************************* + * + * Filename: toshoboe.h + * Version: 0.1 + * Description: Driver for the Toshiba OBOE (or type-O) + * FIR Chipset. + * Status: Experimental. + * Author: James McKenzie <james@fishsoup.dhs.org> + * Created at: Sat May 8 12:35:27 1999 + * + * Copyright (c) 1999 James McKenzie, All Rights Reserved. + * + * 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. + * + * Neither James McKenzie nor Cambridge University admit liability nor + * provide warranty for any of this software. This material is + * provided "AS-IS" and at no charge. + * + * Applicable Models : Libretto 100CT. and many more + * + ********************************************************************/ + +/* + * $Log: toshoboe.h,v $ + * Revision 1.2 1999/05/09 01:43:08 root + * *** empty log message *** + * + * Revision 1.1 1999/05/09 01:25:58 root + * Initial revision + * + */ + +#ifndef TOSHOBOE_H +#define TOSHOBOE_H + +/* Registers */ +/*Receive and transmit task registers (read only) */ +#define OBOE_RCVT (0x00+(self->base)) +#define OBOE_XMTT (0x01+(self->base)) +#define OBOE_XMTT_OFFSET 0x40 + +/*Page pointers to the TaskFile structure */ +#define OBOE_TFP2 (0x02+(self->base)) +#define OBOE_TFP0 (0x04+(self->base)) +#define OBOE_TFP1 (0x05+(self->base)) + +/*Dunno */ +#define OBOE_REG_3 (0x03+(self->base)) + +/*Number of tasks to use in Xmit and Recv queues */ +#define OBOE_NTR (0x07+(self->base)) +#define OBOE_NTR_XMIT4 0x00 +#define OBOE_NTR_XMIT8 0x10 +#define OBOE_NTR_XMIT16 0x30 +#define OBOE_NTR_XMIT32 0x70 +#define OBOE_NTR_XMIT64 0xf0 +#define OBOE_NTR_RECV4 0x00 +#define OBOE_NTR_RECV8 0x01 +#define OBOE_NTR_RECV6 0x03 +#define OBOE_NTR_RECV32 0x07 +#define OBOE_NTR_RECV64 0x0f + +/* Dunno */ +#define OBOE_REG_9 (0x09+(self->base)) + +/* Interrupt Status Register */ +#define OBOE_ISR (0x0c+(self->base)) +#define OBOE_ISR_TXDONE 0x80 +#define OBOE_ISR_RXDONE 0x40 +#define OBOE_ISR_20 0x20 +#define OBOE_ISR_10 0x10 +#define OBOE_ISR_8 0x08 /*This is collision or parity or something */ +#define OBOE_ISR_4 0x08 +#define OBOE_ISR_2 0x08 +#define OBOE_ISR_1 0x08 + +/*Dunno */ +#define OBOE_REG_D (0x0d+(self->base)) + +/*Register Lock Register */ +#define OBOE_LOCK ((self->base)+0x0e) + + + +/*Speed control registers */ +#define OBOE_PMDL (0x10+(self->base)) +#define OBOE_PMDL_SIR 0x18 +#define OBOE_PMDL_MIR 0xa0 +#define OBOE_PMDL_FIR 0x40 + +#define OBOE_SMDL (0x18+(self->base)) +#define OBOE_SMDL_SIR 0x20 +#define OBOE_SMDL_MIR 0x01 +#define OBOE_SMDL_FIR 0x0f + +#define OBOE_UDIV (0x19+(self->base)) + +/*Dunno */ +#define OBOE_REG_11 (0x11+(self->base)) + +/*Chip Reset Register */ +#define OBOE_RST (0x15+(self->base)) +#define OBOE_RST_WRAP 0x8 + +/*Dunno */ +#define OBOE_REG_1A (0x1a+(self->base)) +#define OBOE_REG_1B (0x1b+(self->base)) + +/* The PCI ID of the OBOE chip */ +#ifndef PCI_DEVICE_ID_FIR701 +#define PCI_DEVICE_ID_FIR701 0x0701 +#endif + +typedef unsigned int dword; +typedef unsigned short int word; +typedef unsigned char byte; +typedef dword Paddr; + +struct OboeTask + { + __u16 len; + __u8 unused; + __u8 control; + __u32 buffer; + }; + +#define OBOE_NTASKS 64 + +struct OboeTaskFile + { + struct OboeTask recv[OBOE_NTASKS]; + struct OboeTask xmit[OBOE_NTASKS]; + }; + +#define OBOE_TASK_BUF_LEN (sizeof(struct OboeTaskFile) << 1) + +/*These set the number of slots in use */ +#define TX_SLOTS 4 +#define RX_SLOTS 4 + +/* You need also to change this, toshiba uses 4,8 and 4,4 */ +/* It makes no difference if you are only going to use ONETASK mode */ +/* remember each buffer use XX_BUF_SZ more _PHYSICAL_ memory */ +#define OBOE_NTR_VAL (OBOE_NTR_XMIT4 | OBOE_NTR_RECV4) + +struct toshoboe_cb + { + struct irda_device idev; /*IRDA device */ + struct pci_dev *pdev; /*PCI device */ + int base; /*IO base */ + int txpending; /*how many tx's are pending */ + int txs, rxs; /*Which slots are we at */ + void *taskfilebuf; /*The unaligned taskfile buffer */ + struct OboeTaskFile *taskfile; /*The taskfile */ + void *xmit_bufs[TX_SLOTS]; /*The buffers */ + void *recv_bufs[RX_SLOTS]; + }; + + +#endif + + diff --git a/include/video/fbcon-vga-planes.h b/include/video/fbcon-vga-planes.h new file mode 100644 index 000000000..31578d41c --- /dev/null +++ b/include/video/fbcon-vga-planes.h @@ -0,0 +1,37 @@ +/* + * FBcon low-level driver for VGA 4-plane modes + */ + +#ifndef _VIDEO_FBCON_VGA_PLANES_H +#define _VIDEO_FBCON_VGA_PLANES_H + +#include <linux/config.h> + +#ifdef MODULE +#if defined(CONFIG_FBCON_VGA_PLANES) || defined(CONFIG_FBCON_VGA_PLANES_MODULE) +#define FBCON_HAS_VGA_PLANES +#endif +#else +#if defined(CONFIG_FBCON_VGA_PLANES) +#define FBCON_HAS_VGA_PLANES +#endif +#endif + +extern struct display_switch fbcon_vga_planes; +extern struct display_switch fbcon_ega_planes; +extern void fbcon_vga_planes_setup(struct display *p); +extern void fbcon_vga_planes_bmove(struct display *p, int sy, int sx, int dy, int dx, + int height, int width); +extern void fbcon_vga_planes_clear(struct vc_data *conp, struct display *p, int sy, + int sx, int height, int width); +extern void fbcon_vga_planes_putc(struct vc_data *conp, struct display *p, int c, + int yy, int xx); +extern void fbcon_ega_planes_putc(struct vc_data *conp, struct display *p, int c, + int yy, int xx); +extern void fbcon_vga_planes_putcs(struct vc_data *conp, struct display *p, + const unsigned short *s, int count, int yy, int xx); +extern void fbcon_ega_planes_putcs(struct vc_data *conp, struct display *p, + const unsigned short *s, int count, int yy, int xx); +extern void fbcon_vga_planes_revc(struct display *p, int xx, int yy); + +#endif /* _VIDEO_FBCON_VGA_PLANES_H */ |